diff --git a/tests/xharness/Harness.cs b/tests/xharness/Harness.cs index f26efc62c7..03dfc6cdfd 100644 --- a/tests/xharness/Harness.cs +++ b/tests/xharness/Harness.cs @@ -379,6 +379,7 @@ namespace Xharness { SolutionPath = Path.GetFullPath (Path.Combine (RootDirectory, "tests-mac.sln")), Configurations = p.Configurations, Platform = p.Platform, + Ignore = !INCLUDE_XAMARIN_LEGACY, }); } @@ -388,6 +389,7 @@ namespace Xharness { MonoNativeInfo = monoNativeInfo, Name = monoNativeInfo.ProjectName, Platform = "AnyCPU", + Ignore = !INCLUDE_XAMARIN_LEGACY, }; diff --git a/tests/xharness/Jenkins/Jenkins.cs b/tests/xharness/Jenkins/Jenkins.cs index 254c95b5ad..b2e8139594 100644 --- a/tests/xharness/Jenkins/Jenkins.cs +++ b/tests/xharness/Jenkins/Jenkins.cs @@ -89,21 +89,29 @@ namespace Xharness.Jenkins { public bool IsIncluded (TestProject project) { - MainLog.WriteLine ($"Testing {project.Name} with label {project.Label.ToString ()} is included."); if (!project.IsExecutableProject) { - MainLog.WriteLine ($"Ignoring {project.Name} because is not a executable project."); + MainLog.WriteLine ($"Ignoring {project.Name} with label {project.Label} because is not a executable project."); return false; } if (!TestSelection.IsEnabled(TestLabel.SystemPermission) && project.Label == TestLabel.Introspection) { - MainLog.WriteLine ($"Ignoring {project.Name} because we cannot include the system permission tests"); + MainLog.WriteLine ($"Ignoring {project.Name} with label {project.Label} because we cannot include the system permission tests"); return false; } - MainLog.WriteLine ($"Selected tests are {TestSelection.SelectedTests.ToString ()}"); - MainLog.WriteLine ($"Selected platforms are {TestSelection.SelectedPlatforms.ToString () }"); - MainLog.WriteLine ($"Prohect {project.Name} is included: {TestSelection.IsEnabled (project.Label)}"); - return TestSelection.IsEnabled (project.Label); + if (project.IsDotNetProject && !TestSelection.IsEnabled (PlatformLabel.Dotnet)) { + MainLog.WriteLine ($"Ignoring {project.Name} with label {project.Label} because it's a .NET project and .NET is not included."); + return false; + } + + if (!project.IsDotNetProject && !TestSelection.IsEnabled (PlatformLabel.LegacyXamarin)) { + MainLog.WriteLine ($"Ignoring {project.Name} with label {project.Label} because it's a legacy Xamarin project and legacy Xamarin projects are not included."); + return false; + } + + var rv = TestSelection.IsEnabled (project.Label); + MainLog.WriteLine ($"Including {project.Name} with label {project.Label.ToString ()}: {rv}"); + return rv; } public bool IsBetaXcode => Harness.XcodeRoot.IndexOf ("beta", StringComparison.OrdinalIgnoreCase) >= 0; @@ -150,7 +158,7 @@ namespace Xharness.Jenkins { TestName = "Xtro", Target = "wrench", WorkingDirectory = Path.Combine (HarnessConfiguration.RootDirectory, "xtro-sharpie"), - Ignored = !TestSelection.IsEnabled (TestLabel.Xtro), + Ignored = !TestSelection.IsEnabled (TestLabel.Xtro) || !TestSelection.IsEnabled (PlatformLabel.LegacyXamarin), Timeout = TimeSpan.FromMinutes (15), SupportsParallelExecution = false, }; diff --git a/tests/xharness/Jenkins/MakeTestTaskEnumerable.cs b/tests/xharness/Jenkins/MakeTestTaskEnumerable.cs index 2cdddacefe..c21f0d3001 100644 --- a/tests/xharness/Jenkins/MakeTestTaskEnumerable.cs +++ b/tests/xharness/Jenkins/MakeTestTaskEnumerable.cs @@ -41,7 +41,7 @@ namespace Xharness.Jenkins { TestName = "Mac Binding Projects", Target = "all", WorkingDirectory = Path.Combine (HarnessConfiguration.RootDirectory, "mac-binding-project"), - Ignored = !jenkins.TestSelection.IsEnabled (TestLabel.MacBindingProject) || !jenkins.TestSelection.IsEnabled (PlatformLabel.Mac), + Ignored = !jenkins.TestSelection.IsEnabled (TestLabel.MacBindingProject) || !jenkins.TestSelection.IsEnabled (PlatformLabel.Mac) || !jenkins.TestSelection.IsEnabled (PlatformLabel.LegacyXamarin), Timeout = TimeSpan.FromMinutes (15), }; yield return runMacBindingProject; diff --git a/tests/xharness/Jenkins/NUnitTestTasksEnumerable.cs b/tests/xharness/Jenkins/NUnitTestTasksEnumerable.cs index ef7262c96d..f976e3466b 100644 --- a/tests/xharness/Jenkins/NUnitTestTasksEnumerable.cs +++ b/tests/xharness/Jenkins/NUnitTestTasksEnumerable.cs @@ -115,7 +115,7 @@ namespace Xharness.Jenkins { TestName = "Generator tests", Mode = "NUnit", Timeout = TimeSpan.FromMinutes (10), - Ignored = !jenkins.TestSelection.IsEnabled (TestLabel.Generator), + Ignored = !jenkins.TestSelection.IsEnabled (TestLabel.Generator) || !jenkins.Harness.INCLUDE_XAMARIN_LEGACY, }; yield return runGenerator; diff --git a/tests/xharness/Jenkins/RunSimulatorTasksFactory.cs b/tests/xharness/Jenkins/RunSimulatorTasksFactory.cs index 09b40cd31e..228729a5c7 100644 --- a/tests/xharness/Jenkins/RunSimulatorTasksFactory.cs +++ b/tests/xharness/Jenkins/RunSimulatorTasksFactory.cs @@ -61,8 +61,6 @@ namespace Xharness.Jenkins { break; } - configIgnored |= project.IsDotNetProject && !jenkins.TestSelection.IsEnabled (PlatformLabel.Dotnet); - var derived = new MSBuildTask (jenkins: jenkins, testProject: project, processManager: processManager); derived.ProjectConfiguration = config; derived.ProjectPlatform = "iPhoneSimulator"; diff --git a/tests/xharness/Jenkins/TestSelector.cs b/tests/xharness/Jenkins/TestSelector.cs index 68e018c6e5..b9bdb0b468 100644 --- a/tests/xharness/Jenkins/TestSelector.cs +++ b/tests/xharness/Jenkins/TestSelector.cs @@ -24,6 +24,7 @@ namespace Xharness.Jenkins { PlatformLabel.iOS | PlatformLabel.iOSSimulator | PlatformLabel.MacCatalyst | + PlatformLabel.LegacyXamarin | PlatformLabel.Dotnet; public bool ForceExtensionBuildOnly { get; set; } @@ -291,6 +292,20 @@ namespace Xharness.Jenkins { MainLog?.WriteLine ("The .NET build is disabled, so any .NET tests will be disabled as well."); selection.SetEnabled (PlatformLabel.Dotnet, false); } + + if (!Harness.INCLUDE_XAMARIN_LEGACY) { + MainLog?.WriteLine ("The legacy Xamarin build is disabled, so any legacy Xamarin tests will be disabled as well."); + selection.SetEnabled (PlatformLabel.LegacyXamarin, false); + selection.SetEnabled (PlatformLabel.watchOS, false); + selection.SetEnabled (TestLabel.Bcl, false); + selection.SetEnabled (TestLabel.InstallSource, false); + selection.SetEnabled (TestLabel.Mmp, false); + selection.SetEnabled (TestLabel.Mononative, false); + selection.SetEnabled (TestLabel.Mtouch, false); + selection.SetEnabled (TestLabel.Xammac, false); + } + + MainLog?.WriteLine ($"Final test selection: tests: {selection.SelectedTests} platforms: {selection.SelectedPlatforms}"); } } } diff --git a/tests/xharness/TestLabel.cs b/tests/xharness/TestLabel.cs index a5216d2efa..12b2cf2f96 100644 --- a/tests/xharness/TestLabel.cs +++ b/tests/xharness/TestLabel.cs @@ -106,6 +106,8 @@ namespace Xharness { watchOS = 1 << 11, [Label ("dotnet")] Dotnet = 1 << 12, + [Label ("legacy-xamarin")] + LegacyXamarin = 1 << 13, [Label ("all")] All = 0xFFFFFFFF, }