diff --git a/eng/pipelines/libraries/helix-queues-setup.yml b/eng/pipelines/libraries/helix-queues-setup.yml index 9e00ebdc373f4b..7cbce3032b83df 100644 --- a/eng/pipelines/libraries/helix-queues-setup.yml +++ b/eng/pipelines/libraries/helix-queues-setup.yml @@ -181,7 +181,7 @@ jobs: - (Ubuntu.2604.Amd64.Open)AzureLinux.4.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-26.04-helix-webassembly-amd64@sha256:ad1f7dcade2316b01be4f731474775e2d82e7bf40f8e54c9af848b5a66a7b735 # Browser WebAssembly - - ${{ if eq(parameters.platform, 'browser_wasm') }}: + - ${{ if in(parameters.platform, 'browser_wasm', 'browser_wasm64') }}: - (Ubuntu.2604.Amd64.Open)AzureLinux.4.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-26.04-helix-webassembly-amd64@sha256:ad1f7dcade2316b01be4f731474775e2d82e7bf40f8e54c9af848b5a66a7b735 # Browser WebAssembly Firefox diff --git a/eng/pipelines/libraries/outerloop.yml b/eng/pipelines/libraries/outerloop.yml index 2df660f73a7416..322b58d4a6f279 100644 --- a/eng/pipelines/libraries/outerloop.yml +++ b/eng/pipelines/libraries/outerloop.yml @@ -141,6 +141,7 @@ extends: runtimeFlavor: coreclr platforms: - browser_wasm + - browser_wasm64 jobParameters: testScope: all nameSuffix: LibraryTestsCoreCLR @@ -169,6 +170,7 @@ extends: parameters: platforms: - browser_wasm + - browser_wasm64 nameSuffix: _R2R readyToRun: true testScope: all diff --git a/eng/testing/WasmRunnerTemplate.cmd b/eng/testing/WasmRunnerTemplate.cmd index 463883384bde3d..4426ef79123b5b 100644 --- a/eng/testing/WasmRunnerTemplate.cmd +++ b/eng/testing/WasmRunnerTemplate.cmd @@ -80,6 +80,14 @@ if [%XUNIT_RANDOM_ORDER_SEED%] NEQ [] ( set "WasmXHarnessMonoArgs=%WasmXHarnessMonoArgs% --setenv=XUNIT_RANDOM_ORDER_SEED=%XUNIT_RANDOM_ORDER_SEED%" ) +:: The app doesn't inherit the host environment, so tell it when it runs in CI ([SkipOnCI], PlatformDetection.IsNotBrowserOnCI). +set "_IS_CI=" +if defined HELIX_WORKITEM_ROOT set "_IS_CI=1" +if defined DOTNET_CI set "_IS_CI=1" +if defined _IS_CI ( + set "WasmXHarnessMonoArgs=%WasmXHarnessMonoArgs% --setenv=DOTNET_CI=true" +) + echo EXECUTION_DIR=%EXECUTION_DIR% echo SCENARIO=%SCENARIO% echo XHARNESS_OUT=%XHARNESS_OUT% diff --git a/eng/testing/WasmRunnerTemplate.sh b/eng/testing/WasmRunnerTemplate.sh index 626c3c0ff80f39..51d2c09e50d0ee 100644 --- a/eng/testing/WasmRunnerTemplate.sh +++ b/eng/testing/WasmRunnerTemplate.sh @@ -76,6 +76,11 @@ if [[ -n "$XUNIT_RANDOM_ORDER_SEED" ]]; then WasmXHarnessMonoArgs="${WasmXHarnessMonoArgs} --setenv=XUNIT_RANDOM_ORDER_SEED=${XUNIT_RANDOM_ORDER_SEED}" fi +# The app doesn't inherit the host environment, so tell it when it runs in CI ([SkipOnCI], PlatformDetection.IsNotBrowserOnCI). +if [[ -n "$HELIX_WORKITEM_ROOT" || -n "$DOTNET_CI" ]]; then + WasmXHarnessMonoArgs="${WasmXHarnessMonoArgs} --setenv=DOTNET_CI=true" +fi + echo PATH=$PATH echo EXECUTION_DIR=$EXECUTION_DIR echo SCENARIO=$SCENARIO diff --git a/eng/testing/tests.wasm.targets b/eng/testing/tests.wasm.targets index c8a13c00047ece..f63849c78d3876 100644 --- a/eng/testing/tests.wasm.targets +++ b/eng/testing/tests.wasm.targets @@ -37,6 +37,8 @@ Innerloop keeps the existing 01:30:00 budget. Keep this in sync with the per-batch and AzDO job timeouts in src/libraries/sendtohelix-browser.targets and eng/pipelines/libraries/outerloop.yml (suite <= batch <= job). --> + + 06:00:00 04:00:00 01:30:00 $(BundleDir) diff --git a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs index c3a3ad9ffd6fca..2595f625ee8433 100644 --- a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs +++ b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs @@ -59,6 +59,8 @@ public static partial class PlatformDetection public static bool IsWasi => RuntimeInformation.IsOSPlatform(OSPlatform.Create("WASI")); public static bool IsWasm => IsBrowser || IsWasi; public static bool IsNotBrowser => !IsBrowser; + // Browser test runners forward DOTNET_CI to the app on CI; for tests that exhaust CI machine memory but can run locally. + public static bool IsNotBrowserOnCI => !IsBrowser || string.IsNullOrEmpty(Environment.GetEnvironmentVariable("DOTNET_CI")); public static bool IsNotWasi => !IsWasi; public static bool IsMobile => IsBrowser || IsWasi || IsAppleMobile || IsAndroid; public static bool IsNotMobile => !IsMobile; diff --git a/src/libraries/Common/tests/Tests/System/Net/ArrayBufferTests.cs b/src/libraries/Common/tests/Tests/System/Net/ArrayBufferTests.cs index 2294a166581a8e..ad6629d99c6373 100644 --- a/src/libraries/Common/tests/Tests/System/Net/ArrayBufferTests.cs +++ b/src/libraries/Common/tests/Tests/System/Net/ArrayBufferTests.cs @@ -195,7 +195,7 @@ public void AddSeveralBytesRepeatedlyAndConsumeSeveralBytesRepeatedly_Success(bo } [OuterLoop] - [ConditionalTheory(typeof(Environment), nameof(Environment.Is64BitProcess))] + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.Is64BitProcess), nameof(PlatformDetection.IsNotBrowserOnCI))] [InlineData(true)] [InlineData(false)] public void CanResizeToMaxArraySize(bool usePool) diff --git a/src/libraries/System.Memory/tests/Base64/Base64EncoderUnitTests.cs b/src/libraries/System.Memory/tests/Base64/Base64EncoderUnitTests.cs index a4ba6c0b1176a4..d53fb347b9d3fb 100644 --- a/src/libraries/System.Memory/tests/Base64/Base64EncoderUnitTests.cs +++ b/src/libraries/System.Memory/tests/Base64/Base64EncoderUnitTests.cs @@ -195,7 +195,7 @@ public void EncodingOutputTooSmallRetry(bool isFinalBlock) Assert.True(Base64TestHelper.VerifyEncodingCorrectness(expectedConsumed, encodedBytes.Length, source, encodedBytes)); } - [Theory] + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowserOnCI))] [InlineData(true)] [InlineData(false)] [OuterLoop] diff --git a/src/libraries/System.Memory/tests/Base64Url/Base64UrlEncoderUnitTests.cs b/src/libraries/System.Memory/tests/Base64Url/Base64UrlEncoderUnitTests.cs index bfabcc40d51b02..7dbec88ebdeac3 100644 --- a/src/libraries/System.Memory/tests/Base64Url/Base64UrlEncoderUnitTests.cs +++ b/src/libraries/System.Memory/tests/Base64Url/Base64UrlEncoderUnitTests.cs @@ -192,7 +192,7 @@ public void EncodingOutputTooSmallRetry(bool isFinalBlock) Assert.True(Base64TestHelper.VerifyUrlEncodingCorrectness(expectedConsumed, encodedBytes.Length, source, encodedBytes)); } - [Theory] + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowserOnCI))] [InlineData(true)] [InlineData(false)] [OuterLoop] diff --git a/src/libraries/System.Memory/tests/MemoryMarshal/CreateReadOnlySpanFromNullTerminated.cs b/src/libraries/System.Memory/tests/MemoryMarshal/CreateReadOnlySpanFromNullTerminated.cs index d4f8d7977cba5a..6dad5a85fea5a9 100644 --- a/src/libraries/System.Memory/tests/MemoryMarshal/CreateReadOnlySpanFromNullTerminated.cs +++ b/src/libraries/System.Memory/tests/MemoryMarshal/CreateReadOnlySpanFromNullTerminated.cs @@ -62,7 +62,7 @@ public static unsafe void CreateReadOnlySpanFromNullTerminated_Byte(int expected } [OuterLoop] - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.Is64BitProcess))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.Is64BitProcess), nameof(PlatformDetection.IsNotBrowserOnCI))] public static unsafe void CreateReadOnlySpanFromNullTerminated_Char_ExceedsMaximum() { char* mem; @@ -90,7 +90,7 @@ public static unsafe void CreateReadOnlySpanFromNullTerminated_Char_ExceedsMaxim } [OuterLoop] - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.Is64BitProcess))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.Is64BitProcess), nameof(PlatformDetection.IsNotBrowserOnCI))] public static unsafe void CreateReadOnlySpanFromNullTerminated_Byte_ExceedsMaximum() { byte* mem; diff --git a/src/libraries/System.Runtime.Intrinsics/tests/Wasm/PackedSimdTests.cs b/src/libraries/System.Runtime.Intrinsics/tests/Wasm/PackedSimdTests.cs index 892cb290b36a22..ccc5b4b9063e20 100644 --- a/src/libraries/System.Runtime.Intrinsics/tests/Wasm/PackedSimdTests.cs +++ b/src/libraries/System.Runtime.Intrinsics/tests/Wasm/PackedSimdTests.cs @@ -818,13 +818,18 @@ public unsafe void NativeUnsignedIntegerArithmeticTest() [Fact] public unsafe void NativeIntegerLoadStoreTest() { - nint[] values = new nint[] { 1, 2, 3, 4 }; + nint[] values = new nint[Vector128.Count]; + for (int i = 0; i < values.Length; i++) + { + values[i] = (nint)(i + 1); + } + fixed (nint* ptr = values) { var loaded = PackedSimd.LoadVector128(ptr); Assert.Equal(Vector128.Create(values.AsSpan()), loaded); - nint[] storeTarget = new nint[4]; + nint[] storeTarget = new nint[values.Length]; fixed (nint* storePtr = storeTarget) { PackedSimd.Store(storePtr, loaded); @@ -836,13 +841,18 @@ public unsafe void NativeIntegerLoadStoreTest() [Fact] public unsafe void NativeUnsignedIntegerLoadStoreTest() { - nuint[] values = new nuint[] { 1, 2, 3, 4 }; + nuint[] values = new nuint[Vector128.Count]; + for (int i = 0; i < values.Length; i++) + { + values[i] = (nuint)(i + 1); + } + fixed (nuint* ptr = values) { var loaded = PackedSimd.LoadVector128(ptr); Assert.Equal(Vector128.Create(values.AsSpan()), loaded); - nuint[] storeTarget = new nuint[4]; + nuint[] storeTarget = new nuint[values.Length]; fixed (nuint* storePtr = storeTarget) { PackedSimd.Store(storePtr, loaded); @@ -861,7 +871,7 @@ public void NativeIntegerShiftTest() var rightShiftLogical = PackedSimd.ShiftRightLogical(v, 2); Assert.Equal(Vector128.Create([(nint)64, (-64), 128, (-128)]), leftShift); Assert.Equal(Vector128.Create([(nint)4, (-4), 8, (-8)]), rightShiftArith); - Assert.Equal(Vector128.Create([(nint)4, 1073741820, 8, 1073741816]), rightShiftLogical); + Assert.Equal(Vector128.Create([(nint)4, unchecked((nint)((nuint)(nint)(-16) >> 2)), 8, unchecked((nint)((nuint)(nint)(-32) >> 2))]), rightShiftLogical); } [Fact] @@ -872,7 +882,7 @@ public void NativeUnsignedIntegerShiftTest() var leftShift = PackedSimd.ShiftLeft(v, 2); var rightShiftLogical = PackedSimd.ShiftRightLogical(v, 2); Assert.Equal(Vector128.Create([(nuint)64, unchecked((nuint)(-64)), (nuint)128, unchecked((nuint)(-128))]), leftShift); - Assert.Equal(Vector128.Create([(nuint)4, (nuint)1073741820, (nuint)8, (nuint)1073741816]), rightShiftLogical); + Assert.Equal(Vector128.Create([(nuint)4, unchecked((nuint)(-16)) >> 2, (nuint)8, unchecked((nuint)(-32)) >> 2]), rightShiftLogical); } [Fact] diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/DoubleTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/DoubleTests.cs index 01b07b4f0102cc..78ee3057e73342 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/DoubleTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/DoubleTests.cs @@ -1096,7 +1096,7 @@ public static void ToString_ExactPowerOfTwo_Roundtrips(ulong bits, string expect Assert.Equal(d, double.Parse(expected, CultureInfo.InvariantCulture)); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.Is64BitProcess))] // Requires a lot of memory + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.Is64BitProcess), nameof(PlatformDetection.IsNotBrowserOnCI))] // Requires a lot of memory [OuterLoop("Takes a long time, allocates a lot of memory")] [SkipOnMono("Frequently throws OOM on Mono")] public static void ToString_ValidLargeFormat() diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Utf8JsonWriterTests.cs b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Utf8JsonWriterTests.cs index e0828b3e97784b..1e8dea24d215fc 100644 --- a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Utf8JsonWriterTests.cs +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Utf8JsonWriterTests.cs @@ -3516,7 +3516,7 @@ public void WritingTooLargePropertyStandalone(JsonWriterOptions options) } } - [ConditionalTheory(typeof(Environment), nameof(Environment.Is64BitProcess))] + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.Is64BitProcess), nameof(PlatformDetection.IsNotBrowserOnCI))] [OuterLoop] [MemberData(nameof(JsonOptions_TestData))] public void WritingTooLargeBase64Bytes(JsonWriterOptions options) @@ -6976,7 +6976,7 @@ private static void WriteStringHelper(JsonEncodedText text, string expectedMessa } } - [ConditionalTheory(typeof(Environment), nameof(Environment.Is64BitProcess))] + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.Is64BitProcess), nameof(PlatformDetection.IsNotBrowserOnCI))] [OuterLoop] [MemberData(nameof(JsonOptions_TestData))] public void WriteTooLargeArguments(JsonWriterOptions options) diff --git a/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/Regex.Match.Tests.cs b/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/Regex.Match.Tests.cs index 4c14d842eb1c4a..784f99260d7741 100644 --- a/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/Regex.Match.Tests.cs +++ b/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/Regex.Match.Tests.cs @@ -2719,6 +2719,11 @@ public async Task StressTestDeepNestingOfLoops(RegexEngine engine, string begin, string fullpattern = string.Concat(Enumerable.Repeat(begin, pattern_repetition)) + inner + string.Concat(Enumerable.Repeat(end, pattern_repetition)); string fullinput = string.Concat(Enumerable.Repeat(input, input_repetition)); + if (RegexHelpers.IsNonBacktracking(engine) && !expectNotSupported && !PlatformDetection.IsMultithreadingSupported) + { + throw new SkipTestException("Deep nesting with NonBacktracking hits threading APIs not supported on single-threaded WASM."); + } + if (expectNotSupported) { // NonBacktracking rejects deeply nested unbounded capturing loops via the diff --git a/src/libraries/sendtohelix-browser.targets b/src/libraries/sendtohelix-browser.targets index 0c4d4c84f3884a..0dbd22ca8dded8 100644 --- a/src/libraries/sendtohelix-browser.targets +++ b/src/libraries/sendtohelix-browser.targets @@ -54,8 +54,11 @@ <_IsOuterloopTestScope Condition="'$(TestScope)' == 'outerloop' or '$(TestScope)' == 'all'">true <_WasmBatchMinutesPerSuite Condition="'$(_WasmBatchMinutesPerSuite)' == '' and '$(_IsOuterloopTestScope)' == 'true'">40 <_WasmBatchMinutesPerSuite Condition="'$(_WasmBatchMinutesPerSuite)' == ''">20 + + <_WasmBatchMinimumMinutes Condition="'$(_WasmBatchMinimumMinutes)' == '' and '$(_IsOuterloopTestScope)' == 'true' and '$(TargetsWasm64)' == 'true'">390 <_WasmBatchMinimumMinutes Condition="'$(_WasmBatchMinimumMinutes)' == '' and '$(_IsOuterloopTestScope)' == 'true'">270 <_WasmBatchMinimumMinutes Condition="'$(_WasmBatchMinimumMinutes)' == ''">30 + <_WasmBatchMaximumMinutes Condition="'$(_WasmBatchMaximumMinutes)' == '' and '$(_IsOuterloopTestScope)' == 'true' and '$(TargetsWasm64)' == 'true'">420 <_WasmBatchMaximumMinutes Condition="'$(_WasmBatchMaximumMinutes)' == '' and '$(_IsOuterloopTestScope)' == 'true'">300 <_WasmBatchMaximumMinutes Condition="'$(_WasmBatchMaximumMinutes)' == ''">1439