xharness icon indicating copy to clipboard operation
xharness copied to clipboard

`OuterLoop`, and `SkipOnPlatform` attributes conflict, and don't work correctly when used together

Open radical opened this issue 3 years ago • 4 comments

Consider https://github.com/dotnet/runtime/blob/978df67ced885aeca5f7e75379451bc1a57cc219/src/libraries/System.Net.WebSockets/tests/WebSocketCreateTest.cs#L40-L45

        [OuterLoop("Uses external servers")]
        [Theory]
        [MemberData(nameof(EchoServers))]
        [SkipOnPlatform(TestPlatforms.Browser, "System.Net.Sockets is not supported on this platform.")]
        [ActiveIssue("https://github.com/dotnet/runtime/issues/34690", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)]
        public async Task WebSocketProtocol_CreateFromConnectedStream_CanSendReceiveData(Uri echoUri)

This has both OuterLoop, and SkipOnPlatform attributes. This should run when using category=outerloop, but get skipped if it is running on the browser. Instead, the tests run anyway, and fail because the operations are not supported on browser.

I can reproduce this with ./dotnet.sh build /bl src/libraries/System.Net.WebSockets/tests/System.Net.WebSockets.Tests.csproj /p:Configuration=Release /p:TargetOS=Browser /p:TargetArchitecture=wasm /t:Test -p:Scenario=WasmTestOnBrowser -p:TestScope=outerloop -p:XUnitClassName=System.Net.WebSockets.Tests.WebSocketTests

this is the xharness command line: wasm test-browser --app=. --output-directory=/workspaces/runtime/artifacts/bin/System.Net.WebSockets.Tests/Release/net7.0/browser-wasm/AppBundle/xharness-output --browser-arg=--no-sandbox -s dotnet.js.symbols --symbol-patterns wasm-symbol-patterns.txt --browser-arg=--no-sandbox -- --run WasmTestRunner.dll System.Net.WebSockets.Tests.dll -class System.Net.WebSockets.Tests.WebSocketTests -trait category=OuterLoop -notrait category=failing.

I don't think this is wasm, or SkipOnPlatform specific.

cc @akoeplinger @premun

radical avatar Jun 14 '22 20:06 radical

I think this is something that is actually implemented in runtime? https://github.com/dotnet/runtime/blob/2f38fb55e965d685fff9ee07e0f9c50d3e6bafaf/docs/workflow/testing/libraries/filtering-tests.md

My understanding was that you provide the filters and also this file with ignores/excludes and XHarness only triggers the regular Xunit runner over that? But @akoeplinger might know more

premun avatar Jun 15 '22 11:06 premun

That doc is mostly relevant for the regular xunit console runner, but we implement most of that logic ourselves, e.g. https://github.com/dotnet/xharness/blob/5a55841656f09a48df3e6a416b594fef686dd938/src/Microsoft.DotNet.XHarness.TestRunners.Xunit/WasmApplicationEntryPoint.cs#L30-L31

It's most likely some issue there.

akoeplinger avatar Jun 15 '22 12:06 akoeplinger

Closing this as this is not implemented in xharness but in runtime

premun avatar Mar 28 '23 15:03 premun

This is still an issue, reopening.

akoeplinger avatar Jul 24 '23 09:07 akoeplinger