[tests/xharness] Skip legacy tests if legacy isn't enabled. (#16073)

This commit is contained in:
Rolf Bjarne Kvinge 2022-09-23 13:54:26 +02:00 коммит произвёл GitHub
Родитель 63cc404abb
Коммит f592de721d
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
7 изменённых файлов: 37 добавлений и 12 удалений

Просмотреть файл

@ -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,
};

Просмотреть файл

@ -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,
};

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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";

Просмотреть файл

@ -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}");
}
}
}

Просмотреть файл

@ -106,6 +106,8 @@ namespace Xharness {
watchOS = 1 << 11,
[Label ("dotnet")]
Dotnet = 1 << 12,
[Label ("legacy-xamarin")]
LegacyXamarin = 1 << 13,
[Label ("all")]
All = 0xFFFFFFFF,
}