Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion eng/pipelines/libraries/helix-queues-setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions eng/pipelines/libraries/outerloop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ extends:
runtimeFlavor: coreclr
platforms:
- browser_wasm
- browser_wasm64
jobParameters:
testScope: all
nameSuffix: LibraryTestsCoreCLR
Expand Down Expand Up @@ -169,6 +170,7 @@ extends:
parameters:
platforms:
- browser_wasm
- browser_wasm64
nameSuffix: _R2R
readyToRun: true
testScope: all
Expand Down
8 changes: 8 additions & 0 deletions eng/testing/WasmRunnerTemplate.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -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%
Expand Down
5 changes: 5 additions & 0 deletions eng/testing/WasmRunnerTemplate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions eng/testing/tests.wasm.targets
Original file line number Diff line number Diff line change
Expand Up @@ -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). -->
<!-- wasm64 runs the 64-bit-only large-allocation tests and is slower; System.Memory.Tests alone exceeds 4 hours. -->
<WasmXHarnessTestsTimeout Condition="'$(WasmXHarnessTestsTimeout)' == '' and ('$(TestScope)' == 'outerloop' or '$(TestScope)' == 'all') and '$(TargetsWasm64)' == 'true'">06:00:00</WasmXHarnessTestsTimeout>
<WasmXHarnessTestsTimeout Condition="'$(WasmXHarnessTestsTimeout)' == '' and ('$(TestScope)' == 'outerloop' or '$(TestScope)' == 'all')">04:00:00</WasmXHarnessTestsTimeout>
<WasmXHarnessTestsTimeout Condition="'$(WasmXHarnessTestsTimeout)' == ''">01:30:00</WasmXHarnessTestsTimeout>
<RunWorkingDirectory>$(BundleDir)</RunWorkingDirectory>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<nint>.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);
Expand All @@ -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<nuint>.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);
Expand All @@ -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]
Expand All @@ -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]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions src/libraries/sendtohelix-browser.targets
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,11 @@
<_IsOuterloopTestScope Condition="'$(TestScope)' == 'outerloop' or '$(TestScope)' == 'all'">true</_IsOuterloopTestScope>
<_WasmBatchMinutesPerSuite Condition="'$(_WasmBatchMinutesPerSuite)' == '' and '$(_IsOuterloopTestScope)' == 'true'">40</_WasmBatchMinutesPerSuite>
<_WasmBatchMinutesPerSuite Condition="'$(_WasmBatchMinutesPerSuite)' == ''">20</_WasmBatchMinutesPerSuite>
<!-- wasm64 uses a 06:00:00 outerloop suite timeout (see tests.wasm.targets). -->
<_WasmBatchMinimumMinutes Condition="'$(_WasmBatchMinimumMinutes)' == '' and '$(_IsOuterloopTestScope)' == 'true' and '$(TargetsWasm64)' == 'true'">390</_WasmBatchMinimumMinutes>
<_WasmBatchMinimumMinutes Condition="'$(_WasmBatchMinimumMinutes)' == '' and '$(_IsOuterloopTestScope)' == 'true'">270</_WasmBatchMinimumMinutes>
<_WasmBatchMinimumMinutes Condition="'$(_WasmBatchMinimumMinutes)' == ''">30</_WasmBatchMinimumMinutes>
<_WasmBatchMaximumMinutes Condition="'$(_WasmBatchMaximumMinutes)' == '' and '$(_IsOuterloopTestScope)' == 'true' and '$(TargetsWasm64)' == 'true'">420</_WasmBatchMaximumMinutes>
<_WasmBatchMaximumMinutes Condition="'$(_WasmBatchMaximumMinutes)' == '' and '$(_IsOuterloopTestScope)' == 'true'">300</_WasmBatchMaximumMinutes>
<_WasmBatchMaximumMinutes Condition="'$(_WasmBatchMaximumMinutes)' == ''">1439</_WasmBatchMaximumMinutes>

Expand Down