[CI] Allow to ignore tests if dotnet is enabled. (#11604)
This commit is contained in:
Родитель
52c75d30b4
Коммит
8ec9182b12
|
@ -108,6 +108,7 @@ test.config: Makefile $(TOP)/Make.config $(TOP)/mk/mono.mk
|
||||||
@echo "WATCH_SDK_VERSION=$(WATCH_SDK_VERSION)" >> $@
|
@echo "WATCH_SDK_VERSION=$(WATCH_SDK_VERSION)" >> $@
|
||||||
@echo "OSX_SDK_VERSION=$(OSX_SDK_VERSION)" >> $@
|
@echo "OSX_SDK_VERSION=$(OSX_SDK_VERSION)" >> $@
|
||||||
@echo "DOTNET6_BCL_DIR=$(DOTNET6_BCL_DIR)" >> $@
|
@echo "DOTNET6_BCL_DIR=$(DOTNET6_BCL_DIR)" >> $@
|
||||||
|
@echo "ENABLE_DOTNET=$(ENABLE_DOTNET)" >> $@
|
||||||
|
|
||||||
test-system.config: Makefile $(TOP)/Make.config $(TOP)/mk/mono.mk
|
test-system.config: Makefile $(TOP)/Make.config $(TOP)/mk/mono.mk
|
||||||
@rm -f $@
|
@rm -f $@
|
||||||
|
|
|
@ -42,6 +42,7 @@ namespace Xamarin.Tests
|
||||||
public static bool include_dotnet_watchos;
|
public static bool include_dotnet_watchos;
|
||||||
public static bool include_maccatalyst;
|
public static bool include_maccatalyst;
|
||||||
public static bool include_device;
|
public static bool include_device;
|
||||||
|
public static bool include_dotnet;
|
||||||
|
|
||||||
static Version xcode_version;
|
static Version xcode_version;
|
||||||
public static Version XcodeVersion {
|
public static Version XcodeVersion {
|
||||||
|
@ -270,6 +271,7 @@ namespace Xamarin.Tests
|
||||||
include_dotnet_watchos = !string.IsNullOrEmpty (GetVariable ("INCLUDE_DOTNET_WATCH", ""));
|
include_dotnet_watchos = !string.IsNullOrEmpty (GetVariable ("INCLUDE_DOTNET_WATCH", ""));
|
||||||
include_maccatalyst = !string.IsNullOrEmpty (GetVariable ("INCLUDE_MACCATALYST", ""));
|
include_maccatalyst = !string.IsNullOrEmpty (GetVariable ("INCLUDE_MACCATALYST", ""));
|
||||||
include_device = !string.IsNullOrEmpty (GetVariable ("INCLUDE_DEVICE", ""));
|
include_device = !string.IsNullOrEmpty (GetVariable ("INCLUDE_DEVICE", ""));
|
||||||
|
include_dotnet = !string.IsNullOrEmpty (GetVariable ("ENABLE_DOTNET", ""));
|
||||||
DotNet6BclDir = GetVariable ("DOTNET6_BCL_DIR", null);
|
DotNet6BclDir = GetVariable ("DOTNET6_BCL_DIR", null);
|
||||||
|
|
||||||
XcodeVersionString = GetXcodeVersion (xcode_root);
|
XcodeVersionString = GetXcodeVersion (xcode_root);
|
||||||
|
@ -294,6 +296,7 @@ namespace Xamarin.Tests
|
||||||
Console.WriteLine (" INCLUDE_TVOS={0}", include_tvos);
|
Console.WriteLine (" INCLUDE_TVOS={0}", include_tvos);
|
||||||
Console.WriteLine (" INCLUDE_WATCHOS={0}", include_watchos);
|
Console.WriteLine (" INCLUDE_WATCHOS={0}", include_watchos);
|
||||||
Console.WriteLine (" INCLUDE_MACCATALYST={0}", include_maccatalyst);
|
Console.WriteLine (" INCLUDE_MACCATALYST={0}", include_maccatalyst);
|
||||||
|
Console.WriteLine (" ENABLE_DOTNET={0}", include_dotnet);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string RootPath {
|
public static string RootPath {
|
||||||
|
@ -700,6 +703,13 @@ namespace Xamarin.Tests
|
||||||
Assert.Ignore ("This build does not include device support.");
|
Assert.Ignore ("This build does not include device support.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void AssertDotNetAvailable ()
|
||||||
|
{
|
||||||
|
if (include_dotnet)
|
||||||
|
return;
|
||||||
|
Assert.Ignore (".NET tests not enabled");
|
||||||
|
}
|
||||||
|
|
||||||
public static string CloneTestDirectory (string directory)
|
public static string CloneTestDirectory (string directory)
|
||||||
{
|
{
|
||||||
// Copy the test projects to a temporary directory so that we can run the tests from there without affecting the working directory.
|
// Copy the test projects to a temporary directory so that we can run the tests from there without affecting the working directory.
|
||||||
|
|
|
@ -51,6 +51,8 @@ namespace Xamarin.iOS.Tasks {
|
||||||
[TestCase ("MyXamarinFormsApp")]
|
[TestCase ("MyXamarinFormsApp")]
|
||||||
public void CompareBuilds (string project, int expectedErrorCount = 0)
|
public void CompareBuilds (string project, int expectedErrorCount = 0)
|
||||||
{
|
{
|
||||||
|
Configuration.AssertDotNetAvailable ();
|
||||||
|
|
||||||
tfi = "Xamarin.iOS";
|
tfi = "Xamarin.iOS";
|
||||||
switch (project) {
|
switch (project) {
|
||||||
case "MyMetalGame":
|
case "MyMetalGame":
|
||||||
|
|
|
@ -132,6 +132,7 @@ namespace Xharness {
|
||||||
public string MONO_IOS_SDK_DESTDIR { get; }
|
public string MONO_IOS_SDK_DESTDIR { get; }
|
||||||
public string MONO_MAC_SDK_DESTDIR { get; }
|
public string MONO_MAC_SDK_DESTDIR { get; }
|
||||||
public bool ENABLE_XAMARIN { get; }
|
public bool ENABLE_XAMARIN { get; }
|
||||||
|
public bool ENABLE_DOTNET { get; }
|
||||||
|
|
||||||
// Run
|
// Run
|
||||||
|
|
||||||
|
@ -203,6 +204,7 @@ namespace Xharness {
|
||||||
MONO_IOS_SDK_DESTDIR = config ["MONO_IOS_SDK_DESTDIR"];
|
MONO_IOS_SDK_DESTDIR = config ["MONO_IOS_SDK_DESTDIR"];
|
||||||
MONO_MAC_SDK_DESTDIR = config ["MONO_MAC_SDK_DESTDIR"];
|
MONO_MAC_SDK_DESTDIR = config ["MONO_MAC_SDK_DESTDIR"];
|
||||||
ENABLE_XAMARIN = config.ContainsKey ("ENABLE_XAMARIN") && !string.IsNullOrEmpty (config ["ENABLE_XAMARIN"]);
|
ENABLE_XAMARIN = config.ContainsKey ("ENABLE_XAMARIN") && !string.IsNullOrEmpty (config ["ENABLE_XAMARIN"]);
|
||||||
|
ENABLE_DOTNET = config.ContainsKey ("ENABLE_DOTNET") && !string.IsNullOrEmpty (config ["ENABLE_DOTNET"]);
|
||||||
|
|
||||||
if (string.IsNullOrEmpty (SdkRoot))
|
if (string.IsNullOrEmpty (SdkRoot))
|
||||||
SdkRoot = config ["XCODE_DEVELOPER_ROOT"] ?? configuration.SdkRoot;
|
SdkRoot = config ["XCODE_DEVELOPER_ROOT"] ?? configuration.SdkRoot;
|
||||||
|
|
|
@ -43,6 +43,7 @@ namespace Xharness {
|
||||||
string MONO_IOS_SDK_DESTDIR { get; }
|
string MONO_IOS_SDK_DESTDIR { get; }
|
||||||
string MONO_MAC_SDK_DESTDIR { get; }
|
string MONO_MAC_SDK_DESTDIR { get; }
|
||||||
bool ENABLE_XAMARIN { get; }
|
bool ENABLE_XAMARIN { get; }
|
||||||
|
bool ENABLE_DOTNET { get; }
|
||||||
string XcodeRoot { get; }
|
string XcodeRoot { get; }
|
||||||
string LogDirectory { get; }
|
string LogDirectory { get; }
|
||||||
double Timeout { get; }
|
double Timeout { get; }
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
|
@ -327,6 +327,11 @@ namespace Xharness.Jenkins {
|
||||||
MainLog.WriteLine ("The macOS build is disabled, so any macOS tests will be disabled as well.");
|
MainLog.WriteLine ("The macOS build is disabled, so any macOS tests will be disabled as well.");
|
||||||
jenkins.IncludeMac = false;
|
jenkins.IncludeMac = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!Harness.ENABLE_DOTNET) {
|
||||||
|
MainLog.WriteLine ("The .NET build is disabled, so any .NET tests will be disabled as well.");
|
||||||
|
jenkins.IncludeDotNet = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.DotNet.XHarness.Common.Execution;
|
using Microsoft.DotNet.XHarness.Common.Execution;
|
||||||
using Microsoft.DotNet.XHarness.Common.Logging;
|
using Microsoft.DotNet.XHarness.Common.Logging;
|
||||||
|
@ -14,6 +15,7 @@ namespace Xharness.Jenkins.TestTasks {
|
||||||
|
|
||||||
public bool SpecifyPlatform { get; set; } = true;
|
public bool SpecifyPlatform { get; set; } = true;
|
||||||
public bool SpecifyConfiguration { get; set; } = true;
|
public bool SpecifyConfiguration { get; set; } = true;
|
||||||
|
public List<string> Constants { get; } = new List<string> ();
|
||||||
|
|
||||||
public BuildTool (IProcessManager processManager)
|
public BuildTool (IProcessManager processManager)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.DotNet.XHarness.Common.Execution;
|
using Microsoft.DotNet.XHarness.Common.Execution;
|
||||||
using Microsoft.DotNet.XHarness.Common.Logging;
|
using Microsoft.DotNet.XHarness.Common.Logging;
|
||||||
|
@ -33,6 +34,10 @@ namespace Xharness.Jenkins.TestTasks {
|
||||||
set => buildToolTask.SpecifyConfiguration = value;
|
set => buildToolTask.SpecifyConfiguration = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<string> Constants {
|
||||||
|
get => buildToolTask.Constants;
|
||||||
|
}
|
||||||
|
|
||||||
public override TestProject TestProject {
|
public override TestProject TestProject {
|
||||||
get => base.TestProject;
|
get => base.TestProject;
|
||||||
set {
|
set {
|
||||||
|
|
|
@ -32,6 +32,8 @@ namespace Xharness.Jenkins.TestTasks {
|
||||||
if (Platform == TestPlatform.MacCatalyst)
|
if (Platform == TestPlatform.MacCatalyst)
|
||||||
args.Add ("/r");
|
args.Add ("/r");
|
||||||
args.Add (projectFile);
|
args.Add (projectFile);
|
||||||
|
if (Constants.Count > 0)
|
||||||
|
args.Add($"/p:DefineConstants=\"{string.Join(";", Constants)}\"");
|
||||||
return args;
|
return args;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче