[Mono] need to skip tests failed with PlatformNotSupportedException
#72.175 aperta il 20 feb 2024
Metriche repository
- Star
- (20.414 star)
- Metriche merge PR
- (Merge medio 6g 17h) (256 PR mergiate in 30 g)
Descrizione
I was testing roslyn testcase on ppc64le and we got few test cases failed with PlatformNotSupportedException. I have investigated and found EXCEPTION POINTERS are not supported on MONO runtime. And resulting to fail testcaes with PlatformNotSupportedException.
Exception is thrown from here. https://github.com/dotnet/runtime/blob/803afaad000d84bef1625b1659dd9d97f66c83de/src/mono/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.Mono.cs#L92
public static IntPtr GetExceptionPointers()
{
throw new PlatformNotSupportedException();
}
The Dispose() function from Roslyn calls the GetExceptionPointers from here.
https://github.com/dotnet/roslyn/blob/e7cae311ab49148335e969b94fb47f0dffaa95df/src/Test/PdbUtilities/EditAndContinue/EditAndContinueTest.cs#L192C9-L203C10
public void Dispose()
{
// If the test has thrown an exception, or the test host has crashed, we don't want to assert here
// or we'll hide it, so we need to do this dodgy looking thing.
var isInException = Marshal.GetExceptionPointers() != IntPtr.Zero;
Assert.True(isInException || _hasVerified, "No Verify call since the last AddGeneration call.");
foreach (var disposable in _disposables)
{
disposable.Dispose();
}
}
We need to skip these tests. I could not find the way to skip tests for mono runtime in roslyn.
However, I have tried the [ConditionalFact(typeof(ClrOnly))] for skipping the test but it didn't work.
Is there any way in roslyn to skip tests those are not supported on mono.
Example:
$ dotnet --info
.NET SDK:
Version: 8.0.100
Commit: 57efcf1350
Workload version: 8.0.100-manifests.e15fffd0
Runtime Environment:
OS Name: ubuntu
OS Version: 20.04
OS Platform: Linux
RID: linux-ppc64le
Base Path: /home/ubuntu/vikas/debugger/output_release/.dotnet/sdk/8.0.100/
.NET workloads installed:
Workload version: 8.0.100-manifests.e15fffd0
There are no installed workloads to display.
Host:
Version: 8.0.0
Architecture: ppc64le
Commit: 5535e31a71
.NET SDKs installed:
8.0.100 [/home/ubuntu/vikas/debugger/output_release/.dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 8.0.0 [/home/ubuntu/vikas/debugger/output_release/.dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 8.0.0 [/home/ubuntu/vikas/debugger/output_release/.dotnet/shared/Microsoft.NETCore.App]
Other architectures found:
None
Environment variables:
DOTNET_ROOT [/home/ubuntu/vikas/debugger/output_release/.dotnet]
global.json file:
/home/ubuntu/vikas/roslyn/global.json
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
Steps to Reproduce:
$ cd src/Compilers/CSharp/Test/Emit2$ dotnet test --filter FullyQualifiedName=Microsoft.CodeAnalysis.CSharp.EditAndContinue.UnitTests.EditAndContinueStateMachineTests.AsyncMethodOverloads
Backtrace:
Stack trace:
[xUnit.net 00:03:42.14] Microsoft.CodeAnalysis.CSharp.EditAndContinue.UnitTests.EditAndContinueStateMachineTests.AsyncMethodOverloads [FAIL]
Failed Microsoft.CodeAnalysis.CSharp.EditAndContinue.UnitTests.EditAndContinueStateMachineTests.AsyncMethodOverloads [87 ms]
Error Message:
System.PlatformNotSupportedException : Operation is not supported on this platform.
Stack Trace:
at System.Runtime.InteropServices.Marshal.GetExceptionPointers()
at Microsoft.CodeAnalysis.EditAndContinue.UnitTests.EditAndContinueTest`1[[Microsoft.CodeAnalysis.CSharp.EditAndContinue.UnitTests.EditAndContinueTest, Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests, Version=42.42.42.42, Culture=neutral, PublicKeyToken=31bf3856ad364e35]].Dispose() in /home/ubuntu/vikas/roslyn/src/Test/PdbUtilities/EditAndContinue/EditAndContinueTest.cs:line 196
at Microsoft.CodeAnalysis.CSharp.EditAndContinue.UnitTests.EditAndContinueStateMachineTests.AsyncMethodOverloads() in /home/ubuntu/vikas/roslyn/src/Compilers/CSharp/Test/Emit2/Emit/EditAndContinue/EditAndContinueStateMachineTests.cs:line 681
at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)