mirror of
https://github.com/BepInEx/dotnet-runtime.git
synced 2026-11-22 19:10:41 -10:00
* [wasm] Add support for a random test case orderer, for xunit tests
This is enabled by default for wasm with
`$(XUnitUseRandomizedTestOrderer)=true`.
When the library tests run, they print two messages like:
```
info: Using random seed for test cases: 700149826
info: Using random seed for collections: 700149826
info: Starting: System.Collections.Immutable.Tests.dll
```
These seeds are picked randomly every time the tests are run. To run the
tests with a specific seed, use environment variable
`XUNIT_RANDOM_ORDER_SEED`.
When running with tests, this can be used as:
`WasmXHarnessMonoArgs="--setenv=XUNIT_RANDOM_ORDER_SEED=<seed>`
* Enable test orderer only for libraries tests
* [wasm] Automatically pass XUNIT_RANDOM_ORDER_SEED envvar to wasm apps
* Disable random test ordering for `System.Xml.RW.XmlWriterApi.Tests`
`System.Xml.Tests.TCCloseOutput.*` tests seem to depend on the order of
execution.
```
[06:35:14] fail: [FAIL] System.Xml.Tests.TCCloseOutput.CloseOutput_4(utils: XmlWriterUtils { Async = False, WriterType = UTF8Writer }, outputType: "Stream")
[06:35:14] info: System.IO.FileNotFoundException : File Not Found: writer.out
[06:35:14] info: at XmlCoreTest.Common.FilePathUtil.getStream(String filename)
[06:35:14] info: at System.Xml.Tests.TCCloseOutput.CloseOutput_4(XmlWriterUtils utils, String outputType)
[06:35:14] info: at System.Reflection.RuntimeMethodInfo.InvokeWorker(Object obj, BindingFlags invokeAttr, Span`1 parameters)
```
* [wasm] Disable random tests ordering for `System.Runtime.Loader`
It seems to cause failures like, reproducible with
`XUNIT_RANDOM_ORDER_SEED=2106784294`:
```
[06:25:43] fail: [FAIL] System.Runtime.Loader.Tests.SatelliteAssembliesTests.SatelliteLoadsCorrectly_FromName(alc: "Empty", assemblyName: "System.Runtime.Loader.Tests", culture: "en")
[06:25:43] info: Assert.Same() Failure
[06:25:43] info: Expected: "Default" System.Runtime.Loader.DefaultAssemblyLoadContext #0
[06:25:43] info: Actual: "Empty" System.Runtime.Loader.AssemblyLoadContext #4
[06:25:43] info: at System.Runtime.Loader.Tests.SatelliteAssembliesTests.SatelliteLoadsCorrectly_FromName(String alc, String assemblyName, String culture)
[06:25:43] info: at System.Reflection.RuntimeMethodInfo.InvokeWorker(Object obj, BindingFlags invokeAttr, Span`1 parameters)
```
* [wasm] Disable random test ordering for `System.Runtime.Numerics`
Randomized runs seem to fail with:
```
[03:29:54] info: Starting: System.Runtime.Numerics.Tests.dll
[03:29:58] fail: [FAIL] System.Numerics.Tests.cast_toTest.RunDoubleExplicitCastToBigIntegerTests
[03:29:58] info: Assert.Equal() Failure
[03:29:58] info: ↓ (pos 0)
[03:29:58] info: Expected: -0
[03:29:58] info: Actual: 0
[03:29:58] info: ↑ (pos 0)
[03:29:58] info: at System.Numerics.Tests.cast_toTest.VerifyDoubleExplicitCastToBigInteger(Double value)
[03:29:58] info: at System.Numerics.Tests.cast_toTest.RunDoubleExplicitCastToBigIntegerTests()
[03:29:58] info: at System.Reflection.RuntimeMethodInfo.InvokeWorker(Object obj, BindingFlags invokeAttr, Span`1 parameters)
```
Reproducible with `XUNIT_RANDOM_SEED_ORDER=1883302047`.
* Add issues for the failing tests
94 lines
2.7 KiB
Batchfile
94 lines
2.7 KiB
Batchfile
@echo off
|
|
setlocal enabledelayedexpansion
|
|
|
|
:: SetCommands defined in eng\testing\tests.wasm.targets
|
|
[[SetCommands]]
|
|
[[SetCommandsEcho]]
|
|
|
|
set EXECUTION_DIR=%~dp0
|
|
if [%3] NEQ [] (
|
|
set SCENARIO=%3
|
|
)
|
|
|
|
if [%HELIX_WORKITEM_UPLOAD_ROOT%] == [] (
|
|
set "XHARNESS_OUT=%EXECUTION_DIR%xharness-output"
|
|
) else (
|
|
set "XHARNESS_OUT=%HELIX_WORKITEM_UPLOAD_ROOT%\xharness-output"
|
|
)
|
|
|
|
if [%XHARNESS_CLI_PATH%] NEQ [] (
|
|
:: When running in CI, we only have the .NET runtime available
|
|
:: We need to call the XHarness CLI DLL directly via dotnet exec
|
|
set HARNESS_RUNNER=dotnet.exe exec "%XHARNESS_CLI_PATH%"
|
|
) else (
|
|
set HARNESS_RUNNER=dotnet.exe xharness
|
|
)
|
|
|
|
if [%XHARNESS_COMMAND%] == [] (
|
|
if /I [%SCENARIO%]==[WasmTestOnBrowser] (
|
|
set XHARNESS_COMMAND=test-browser
|
|
) else (
|
|
set XHARNESS_COMMAND=test
|
|
)
|
|
)
|
|
|
|
if /I [%XHARNESS_COMMAND%] == [test] (
|
|
if [%JS_ENGINE%] == [] (
|
|
if /I [%SCENARIO%] == [WasmTestOnNodeJs] (
|
|
set "JS_ENGINE=--engine^=NodeJS"
|
|
) else (
|
|
set "JS_ENGINE=--engine^=V8"
|
|
)
|
|
)
|
|
if [%MAIN_JS%] == [] (
|
|
set "MAIN_JS=--js-file^=test-main.js"
|
|
)
|
|
|
|
if [%JS_ENGINE_ARGS%] == [] (
|
|
set "JS_ENGINE_ARGS=--engine-arg^=--stack-trace-limit^=1000"
|
|
)
|
|
) else (
|
|
if [%BROWSER_PATH%] == [] if not [%HELIX_CORRELATION_PAYLOAD%] == [] (
|
|
set "BROWSER_PATH=--browser-path^=%HELIX_CORRELATION_PAYLOAD%\chrome-win\chrome.exe"
|
|
)
|
|
)
|
|
|
|
if [%XHARNESS_ARGS%] == [] (
|
|
set "XHARNESS_ARGS=%JS_ENGINE% %JS_ENGINE_ARGS% %BROWSER_PATH% %MAIN_JS%"
|
|
)
|
|
|
|
if [%XUNIT_RANDOM_ORDER_SEED%] NEQ [] (
|
|
set "WasmXHarnessMonoArgs=%WasmXHarnessMonoArgs% --setenv=XUNIT_RANDOM_ORDER_SEED=%XUNIT_RANDOM_ORDER_SEED%"
|
|
)
|
|
|
|
echo EXECUTION_DIR=%EXECUTION_DIR%
|
|
echo SCENARIO=%SCENARIO%
|
|
echo XHARNESS_OUT=%XHARNESS_OUT%
|
|
echo XHARNESS_CLI_PATH=%XHARNESS_CLI_PATH%
|
|
echo HARNESS_RUNNER=%HARNESS_RUNNER%
|
|
echo XHARNESS_COMMAND=%XHARNESS_COMMAND%
|
|
echo MAIN_JS=%MAIN_JS%
|
|
echo JS_ENGINE=%JS_ENGINE%
|
|
echo JS_ENGINE_ARGS=%JS_ENGINE_ARGS%
|
|
echo XHARNESS_ARGS=%XHARNESS_ARGS%
|
|
|
|
:: ========================= BEGIN Test Execution =============================
|
|
echo ----- start %DATE% %TIME% =============== To repro directly: =====================================================
|
|
echo pushd %EXECUTION_DIR%
|
|
:: RunCommands defined in eng\testing\tests.wasm.targets
|
|
[[RunCommandsEcho]]
|
|
echo popd
|
|
echo ===========================================================================================================
|
|
pushd %EXECUTION_DIR%
|
|
@echo on
|
|
:: RunCommands defined in eng\testing\tests.wasm.targets
|
|
[[RunCommands]]
|
|
set EXIT_CODE=%ERRORLEVEL%
|
|
@echo off
|
|
popd
|
|
echo ----- end %DATE% %TIME% ----- exit code %EXIT_CODE% ----------------------------------------------------------
|
|
|
|
echo XHarness artifacts: %XHARNESS_OUT%
|
|
|
|
exit /b %EXIT_CODE%
|