Skip to content

Commit 81ef825

Browse files
authored
[tests] Ignore XUnit nonuapaottests category (#1630)
Fixes: #1400 Related: #1421 The mono/corefx xUnit test [`TaskSchedulerTests.GetTaskSchedulersForDebugger_ReturnsDefaultScheduler()`][0] [fails when built in Release mode][1]: [0]: https://github.com/dotnet/corefx/blob/893708a4c46047af6fb14bc0f2c33b3ca6adc527/src/System.Threading.Tasks/tests/TaskScheduler/TaskSchedulerTests.cs#L293-L301 [1]: https://jenkins.mono-project.com/view/Xamarin.Android/job/xamarin-android/980/testReport/junit/Test%20collection%20for%20System.Threading.Tasks.Tests/TaskSchedulerTests/System_Threading_Tasks_Tests_TaskSchedulerTests_GetTaskSchedulersForDebugger_ReturnsDefaultScheduler___Release/ System.NullReferenceException : Object reference not set to an instance of an object +++++++++++++++++++ STACK TRACE: at System.Threading.Tasks.Tests.TaskSchedulerTests.GetTaskSchedulersForDebugger_ReturnsDefaultScheduler () The cause is that the test grabs the `MethodInfo` for the `TaskScheduler.GetTaskSchedulersForDebugger()` method, which the linker removes -- correctly! as there are no references to it -- and the test then attempts to *invoke* the `MethodInfo`, but the `MethodInfo` is `null` (linked away!), resulting in the `NullReferenceException`. The test should be fixed, but in the meantime we can instead ignore the xUnit *category* of this test when building for Release.
1 parent b0efc6a commit 81ef825

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

tests/BCL-Tests/Xamarin.Android.Bcl-Tests/XUnitInstrumentation.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,10 @@ protected override void ConfigureFilters (XUnitTestRunner runner)
6565
// From some failing corefx tests
6666
new XUnitFilter ("category", "nonlinuxtests", true),
6767
new XUnitFilter ("category", "nonmonotests", true),
68-
new XUnitFilter ("category", "nonnetfxtests", true)
68+
new XUnitFilter ("category", "nonnetfxtests", true),
69+
#if !DEBUG // aka "Release"
70+
new XUnitFilter ("category", "nonuapaottests", true),
71+
#endif // !DEBUG
6972
};
7073

7174
if (excludedTestNames != null && excludedTestNames.Count > 0) {

0 commit comments

Comments
 (0)