diff --git a/tests/xharness/AppRunner.cs b/tests/xharness/AppRunner.cs index 424b9032d1a4..7e3b2693aef5 100644 --- a/tests/xharness/AppRunner.cs +++ b/tests/xharness/AppRunner.cs @@ -13,6 +13,7 @@ using Microsoft.DotNet.XHarness.iOS.Shared; using Microsoft.DotNet.XHarness.iOS.Shared.Listeners; using Microsoft.DotNet.XHarness.iOS.Shared.Hardware; +using Xharness.TestTasks; namespace Xharness { @@ -31,7 +32,7 @@ class AppRunner { readonly TestTarget target; readonly IHarness harness; readonly double timeoutMultiplier; - readonly BuildToolTask buildTask; + readonly IBuildToolTask buildTask; string deviceName; string companionDeviceName; @@ -77,7 +78,7 @@ public AppRunner (IProcessManager processManager, bool ensureCleanSimulatorState = false, double timeoutMultiplier = 1, string variation = null, - BuildToolTask buildTask = null) + IBuildToolTask buildTask = null) { if (appBundleInformationParser is null) throw new ArgumentNullException (nameof (appBundleInformationParser)); diff --git a/tests/xharness/Jenkins/Jenkins.cs b/tests/xharness/Jenkins/Jenkins.cs index 526db685c929..f6345d1a0151 100644 --- a/tests/xharness/Jenkins/Jenkins.cs +++ b/tests/xharness/Jenkins/Jenkins.cs @@ -227,7 +227,12 @@ IEnumerable CreateRunSimulatorTaskAsync (MSBuildTask buildTask for (int i = 0; i < targets.Length; i++) { var sims = simulators.SelectDevices (targets [i], SimulatorLoadLog, false); - runtasks.Add (new RunSimulatorTask (simulators, buildTask, processManager, sims) { + runtasks.Add (new RunSimulatorTask ( + jenkins: this, + simulators: simulators, + buildTask: buildTask, + processManager: processManager, + candidates: sims) { Platform = platforms [i], Ignored = ignored[i] || buildTask.Ignored }); @@ -549,7 +554,12 @@ async Task> CreateRunSimulatorTasksAsync () } var testVariations = CreateTestVariations (runSimulatorTasks, (buildTask, test, candidates) => - new RunSimulatorTask (simulators, buildTask, processManager, candidates?.Cast () ?? test.Candidates)).ToList (); + new RunSimulatorTask ( + jenkins: this, + simulators: simulators, + buildTask: buildTask, + processManager: processManager, + candidates: candidates?.Cast () ?? test.Candidates)).ToList (); foreach (var tv in testVariations) { if (!tv.Ignored) @@ -587,7 +597,12 @@ Task> CreateRunDeviceTasksAsync () TestName = project.Name, }; build64.CloneTestProject (project); - projectTasks.Add (new RunDeviceTask (devices, build64, processManager, devices.Connected64BitIOS.Where (d => project.IsSupported (d.DevicePlatform, d.ProductVersion))) { Ignored = !IncludeiOS64 }); + projectTasks.Add (new RunDeviceTask ( + jenkins: this, + devices: devices, + buildTask: build64, + processManager: processManager, + candidates: devices.Connected64BitIOS.Where (d => project.IsSupported (d.DevicePlatform, d.ProductVersion))) { Ignored = !IncludeiOS64 }); var build32 = new MSBuildTask (jenkins: this, testProject: project, processManager: processManager) { ProjectConfiguration = project.Name != "dont link" ? "Debug32" : "Release32", @@ -596,7 +611,12 @@ Task> CreateRunDeviceTasksAsync () TestName = project.Name, }; build32.CloneTestProject (project); - projectTasks.Add (new RunDeviceTask (devices, build32, processManager, devices.Connected32BitIOS.Where (d => project.IsSupported (d.DevicePlatform, d.ProductVersion))) { Ignored = !IncludeiOS32 }); + projectTasks.Add (new RunDeviceTask ( + jenkins: this, + devices: devices, + buildTask: build32, + processManager: processManager, + candidates: devices.Connected32BitIOS.Where (d => project.IsSupported (d.DevicePlatform, d.ProductVersion))) { Ignored = !IncludeiOS32 }); var todayProject = project.AsTodayExtensionProject (); var buildToday = new MSBuildTask (jenkins: this, testProject: todayProject, processManager: processManager) { @@ -606,7 +626,12 @@ Task> CreateRunDeviceTasksAsync () TestName = project.Name, }; buildToday.CloneTestProject (todayProject); - projectTasks.Add (new RunDeviceTask (devices, buildToday, processManager, devices.Connected64BitIOS.Where (d => project.IsSupported (d.DevicePlatform, d.ProductVersion))) { Ignored = !IncludeiOSExtensions, BuildOnly = ForceExtensionBuildOnly }); + projectTasks.Add (new RunDeviceTask ( + jenkins: this, + devices: devices, + buildTask: buildToday, + processManager: processManager, + candidates: devices.Connected64BitIOS.Where (d => project.IsSupported (d.DevicePlatform, d.ProductVersion))) { Ignored = !IncludeiOSExtensions, BuildOnly = ForceExtensionBuildOnly }); } if (!project.SkiptvOSVariation) { @@ -618,7 +643,12 @@ Task> CreateRunDeviceTasksAsync () TestName = project.Name, }; buildTV.CloneTestProject (tvOSProject); - projectTasks.Add (new RunDeviceTask (devices, buildTV, processManager, devices.ConnectedTV.Where (d => project.IsSupported (d.DevicePlatform, d.ProductVersion))) { Ignored = !IncludetvOS }); + projectTasks.Add (new RunDeviceTask ( + jenkins: this, + devices: devices, + buildTask: buildTV, + processManager: processManager, + candidates: devices.ConnectedTV.Where (d => project.IsSupported (d.DevicePlatform, d.ProductVersion))) { Ignored = !IncludetvOS }); } if (!project.SkipwatchOSVariation) { @@ -631,7 +661,12 @@ Task> CreateRunDeviceTasksAsync () TestName = project.Name, }; buildWatch32.CloneTestProject (watchOSProject); - projectTasks.Add (new RunDeviceTask (devices, buildWatch32, processManager, devices.ConnectedWatch) { Ignored = !IncludewatchOS }); + projectTasks.Add (new RunDeviceTask ( + jenkins: this, + devices: devices, + buildTask: buildWatch32, + processManager: processManager, + candidates: devices.ConnectedWatch) { Ignored = !IncludewatchOS }); } if (!project.SkipwatchOSARM64_32Variation) { @@ -642,7 +677,12 @@ Task> CreateRunDeviceTasksAsync () TestName = project.Name, }; buildWatch64_32.CloneTestProject (watchOSProject); - projectTasks.Add (new RunDeviceTask (devices, buildWatch64_32, processManager, devices.ConnectedWatch32_64.Where (d => project.IsSupported (d.DevicePlatform, d.ProductVersion))) { Ignored = !IncludewatchOS }); + projectTasks.Add (new RunDeviceTask ( + jenkins: this, + devices: devices, + buildTask: buildWatch64_32, + processManager: processManager, + candidates: devices.ConnectedWatch32_64.Where (d => project.IsSupported (d.DevicePlatform, d.ProductVersion))) { Ignored = !IncludewatchOS }); } } foreach (var task in projectTasks) { @@ -653,7 +693,13 @@ Task> CreateRunDeviceTasksAsync () rv.AddRange (projectTasks); } - return Task.FromResult> (CreateTestVariations (rv, (buildTask, test, candidates) => new RunDeviceTask (devices, buildTask, processManager, candidates?.Cast () ?? test.Candidates))); + return Task.FromResult> (CreateTestVariations (rv, (buildTask, test, candidates) + => new RunDeviceTask ( + jenkins: this, + devices: devices, + buildTask: buildTask, + processManager: processManager, + candidates: candidates?.Cast () ?? test.Candidates))); } static string AddSuffixToPath (string path, string suffix) @@ -942,7 +988,7 @@ Task PopulateTasksAsync () SolutionPath = Path.GetFullPath (Path.Combine (Harness.RootDirectory, "..", "msbuild", "Xamarin.MacDev.Tasks.sln")), SupportsParallelExecution = false, }; - var nunitExecutioniOSMSBuild_net461 = new NUnitExecuteTask (buildiOSMSBuild_net461, processManager) + var nunitExecutioniOSMSBuild_net461 = new NUnitExecuteTask (this, buildiOSMSBuild_net461, processManager) { TestLibrary = Path.Combine (Harness.RootDirectory, "..", "msbuild", "tests", "Xamarin.iOS.Tasks.Tests", "bin", "Debug-net461", "net461", "Xamarin.iOS.Tasks.Tests.dll"), TestProject = net461Project, @@ -965,7 +1011,7 @@ Task PopulateTasksAsync () SolutionPath = Path.GetFullPath (Path.Combine (Harness.RootDirectory, "..", "msbuild", "Xamarin.MacDev.Tasks.sln")), SupportsParallelExecution = false, }; - var nunitExecutioniOSMSBuild_netstandard2 = new NUnitExecuteTask (buildiOSMSBuild_netstandard2, processManager) { + var nunitExecutioniOSMSBuild_netstandard2 = new NUnitExecuteTask (this, buildiOSMSBuild_netstandard2, processManager) { TestLibrary = Path.Combine (Harness.RootDirectory, "..", "msbuild", "tests", "Xamarin.iOS.Tasks.Tests", "bin", "Debug-netstandard2.0", "net461", "Xamarin.iOS.Tasks.Tests.dll"), TestProject = netstandard2Project, ProjectConfiguration = "Debug-netstandard2.0", @@ -986,7 +1032,7 @@ Task PopulateTasksAsync () Platform = TestPlatform.iOS, }; buildInstallSources.SolutionPath = Path.GetFullPath (Path.Combine (Harness.RootDirectory, "..", "tools", "install-source", "install-source.sln")); // this is required for nuget restore to be executed - var nunitExecutionInstallSource = new NUnitExecuteTask (buildInstallSources, processManager) + var nunitExecutionInstallSource = new NUnitExecuteTask (this, buildInstallSources, processManager) { TestLibrary = Path.Combine (Harness.RootDirectory, "..", "tools", "install-source", "InstallSourcesTests", "bin", "Release", "InstallSourcesTests.dll"), TestProject = installSourcesProject, @@ -1042,7 +1088,7 @@ Task PopulateTasksAsync () var ignored_main = ignored; if (project.IsNUnitProject) { var dll = Path.Combine (Path.GetDirectoryName (build.TestProject.Path), project.Xml.GetOutputAssemblyPath (build.ProjectPlatform, build.ProjectConfiguration).Replace ('\\', '/')); - exec = new NUnitExecuteTask (build, processManager) { + exec = new NUnitExecuteTask (this, build, processManager) { Ignored = ignored_main, TestLibrary = dll, TestProject = project, @@ -1053,14 +1099,14 @@ Task PopulateTasksAsync () }; execs = new [] { exec }; } else { - exec = new MacExecuteTask (build, processManager, crashReportSnapshotFactory) { + exec = new MacExecuteTask (this, build, processManager, crashReportSnapshotFactory) { Ignored = ignored_main, BCLTest = project.IsBclTest, TestName = project.Name, IsUnitTest = true, }; execs = CreateTestVariations (new [] { exec }, (buildTask, test, candidates) => - new MacExecuteTask (buildTask, processManager, crashReportSnapshotFactory) { IsUnitTest = true } ); + new MacExecuteTask (this, buildTask, processManager, crashReportSnapshotFactory) { IsUnitTest = true } ); } foreach (var e in execs) @@ -1079,7 +1125,7 @@ Task PopulateTasksAsync () Target = "dependencies", WorkingDirectory = Path.GetFullPath (Path.Combine (Harness.RootDirectory, "mtouch")), }; - var nunitExecutionMTouch = new NUnitExecuteTask (buildMTouch, processManager) + var nunitExecutionMTouch = new NUnitExecuteTask (this, buildMTouch, processManager) { TestLibrary = Path.Combine (Harness.RootDirectory, "mtouch", "bin", "Debug", "mtouch.dll"), TestProject = new TestProject (Path.GetFullPath (Path.Combine (Harness.RootDirectory, "mtouch", "mtouch.csproj"))), @@ -1099,7 +1145,7 @@ Task PopulateTasksAsync () Target = "build-unit-tests", WorkingDirectory = Path.GetFullPath (Path.Combine (Harness.RootDirectory, "generator")), }; - var runGenerator = new NUnitExecuteTask (buildGenerator, processManager) { + var runGenerator = new NUnitExecuteTask (this, buildGenerator, processManager) { TestLibrary = Path.Combine (Harness.RootDirectory, "generator", "bin", "Debug", "generator-tests.dll"), TestProject = new TestProject (Path.GetFullPath (Path.Combine (Harness.RootDirectory, "generator", "generator-tests.csproj"))), Platform = TestPlatform.iOS, @@ -1117,7 +1163,7 @@ Task PopulateTasksAsync () SpecifyConfiguration = false, Platform = TestPlatform.iOS, }; - var runDotNetGenerator = new DotNetTestTask (buildDotNetGenerator, processManager) { + var runDotNetGenerator = new DotNetTestTask (this, buildDotNetGenerator, processManager) { TestProject = buildDotNetGeneratorProject, Platform = TestPlatform.iOS, TestName = "Generator tests", @@ -1163,7 +1209,7 @@ Task PopulateTasksAsync () Ignored = !IncludeXtro, Timeout = TimeSpan.FromMinutes (15), }; - var runXtroReporter = new RunXtroTask (buildXtroTests, processManager, crashReportSnapshotFactory) { + var runXtroReporter = new RunXtroTask (this, buildXtroTests, processManager, crashReportSnapshotFactory) { Platform = TestPlatform.Mac, TestName = buildXtroTests.TestName, Ignored = buildXtroTests.Ignored, @@ -1179,7 +1225,7 @@ Task PopulateTasksAsync () Ignored = !IncludeCecil, Timeout = TimeSpan.FromMinutes (5), }; - var runCecilTests = new NUnitExecuteTask (buildCecilTests, processManager) { + var runCecilTests = new NUnitExecuteTask (this, buildCecilTests, processManager) { TestLibrary = Path.Combine (buildCecilTests.WorkingDirectory, "bin", "Debug", "cecil-tests.dll"), TestProject = new TestProject (Path.Combine (buildCecilTests.WorkingDirectory, "cecil-tests.csproj")), Platform = TestPlatform.iOS, @@ -1206,7 +1252,7 @@ Task PopulateTasksAsync () Platform = TestPlatform.All, ProjectConfiguration = "Debug", }; - var runSampleTests = new NUnitExecuteTask (buildSampleTests, processManager) { + var runSampleTests = new NUnitExecuteTask (this, buildSampleTests, processManager) { TestLibrary = Path.Combine (Harness.RootDirectory, "sampletester", "bin", "Debug", "sampletester.dll"), TestProject = new TestProject (Path.GetFullPath (Path.Combine (Harness.RootDirectory, "sampletester", "sampletester.csproj"))), Platform = TestPlatform.All, diff --git a/tests/xharness/Jenkins/TestTasks/BuildToolTask.cs b/tests/xharness/Jenkins/TestTasks/BuildToolTask.cs index 5c8c36cec101..eb64e867488c 100644 --- a/tests/xharness/Jenkins/TestTasks/BuildToolTask.cs +++ b/tests/xharness/Jenkins/TestTasks/BuildToolTask.cs @@ -1,12 +1,13 @@ using System; using System.Threading.Tasks; using Microsoft.DotNet.XHarness.iOS.Shared.Execution; +using Xharness.TestTasks; namespace Xharness.Jenkins.TestTasks { - public abstract class BuildToolTask : AppleTestTask + public abstract class BuildToolTask : AppleTestTask, IBuildToolTask { - protected Xharness.TestTasks.BuildTool buildToolTask; + protected BuildTool buildToolTask; public IProcessManager ProcessManager { get; } diff --git a/tests/xharness/Jenkins/TestTasks/DotNetTestTask.cs b/tests/xharness/Jenkins/TestTasks/DotNetTestTask.cs index d36a0d9db985..fff869664810 100644 --- a/tests/xharness/Jenkins/TestTasks/DotNetTestTask.cs +++ b/tests/xharness/Jenkins/TestTasks/DotNetTestTask.cs @@ -6,8 +6,8 @@ namespace Xharness.Jenkins.TestTasks { class DotNetTestTask : RunTestTask { - public DotNetTestTask (DotNetBuildTask build_task, IProcessManager processManager) - : base (build_task, processManager) + public DotNetTestTask (Jenkins jenkins, DotNetBuildTask build_task, IProcessManager processManager) + : base (jenkins, build_task, processManager) { DotNetBuildTask.SetDotNetEnvironmentVariables (Environment); } diff --git a/tests/xharness/Jenkins/TestTasks/MacExecuteTask.cs b/tests/xharness/Jenkins/TestTasks/MacExecuteTask.cs index 7e513ea2044a..60e603a9331a 100644 --- a/tests/xharness/Jenkins/TestTasks/MacExecuteTask.cs +++ b/tests/xharness/Jenkins/TestTasks/MacExecuteTask.cs @@ -18,8 +18,8 @@ class MacExecuteTask : MacTask public bool BCLTest; public bool IsUnitTest; - public MacExecuteTask (BuildToolTask build_task, IProcessManager processManager, ICrashSnapshotReporterFactory crashReportSnapshotFactory) - : base (build_task, processManager) + public MacExecuteTask (Jenkins jenkins, BuildToolTask build_task, IProcessManager processManager, ICrashSnapshotReporterFactory crashReportSnapshotFactory) + : base (jenkins, build_task, processManager) { this.CrashReportSnapshotFactory = crashReportSnapshotFactory ?? throw new ArgumentNullException (nameof (crashReportSnapshotFactory)); } diff --git a/tests/xharness/Jenkins/TestTasks/MacTask.cs b/tests/xharness/Jenkins/TestTasks/MacTask.cs index be25f0692c70..31083ea2d858 100644 --- a/tests/xharness/Jenkins/TestTasks/MacTask.cs +++ b/tests/xharness/Jenkins/TestTasks/MacTask.cs @@ -5,8 +5,8 @@ namespace Xharness.Jenkins.TestTasks { abstract class MacTask : RunTestTask { - public MacTask (BuildToolTask build_task, IProcessManager processManager) - : base (build_task, processManager) + public MacTask (Jenkins jenkins, BuildToolTask build_task, IProcessManager processManager) + : base (jenkins, build_task, processManager) { } diff --git a/tests/xharness/Jenkins/TestTasks/NUnitExecuteTask.cs b/tests/xharness/Jenkins/TestTasks/NUnitExecuteTask.cs index e9efa07e3f04..8746c6279007 100644 --- a/tests/xharness/Jenkins/TestTasks/NUnitExecuteTask.cs +++ b/tests/xharness/Jenkins/TestTasks/NUnitExecuteTask.cs @@ -17,8 +17,8 @@ class NUnitExecuteTask : RunTestTask public bool ProduceHtmlReport = true; public bool InProcess; - public NUnitExecuteTask (BuildToolTask build_task, IProcessManager processManager) - : base (build_task, processManager) + public NUnitExecuteTask (Jenkins jenkins, BuildToolTask build_task, IProcessManager processManager) + : base (jenkins, build_task, processManager) { } diff --git a/tests/xharness/Jenkins/TestTasks/RunDeviceTask.cs b/tests/xharness/Jenkins/TestTasks/RunDeviceTask.cs index a51437057c82..0a10cca37e3f 100644 --- a/tests/xharness/Jenkins/TestTasks/RunDeviceTask.cs +++ b/tests/xharness/Jenkins/TestTasks/RunDeviceTask.cs @@ -40,10 +40,10 @@ public override string ProgressMessage { } } - public RunDeviceTask (IHardwareDeviceLoader devices, MSBuildTask build_task, IProcessManager ProcessManager, IEnumerable candidates) - : base (build_task, ProcessManager, candidates.OrderBy ((v) => v.DebugSpeed)) + public RunDeviceTask (Jenkins jenkins, IHardwareDeviceLoader devices, MSBuildTask buildTask, IProcessManager processManager, IEnumerable candidates) + : base (jenkins, buildTask, processManager, candidates.OrderBy ((v) => v.DebugSpeed)) { - switch (build_task.Platform) { + switch (buildTask.Platform) { case TestPlatform.iOS: case TestPlatform.iOS_Unified: case TestPlatform.iOS_Unified32: diff --git a/tests/xharness/Jenkins/TestTasks/RunSimulatorTask.cs b/tests/xharness/Jenkins/TestTasks/RunSimulatorTask.cs index 0e6f1690c451..f6ac7b6bb2d6 100644 --- a/tests/xharness/Jenkins/TestTasks/RunSimulatorTask.cs +++ b/tests/xharness/Jenkins/TestTasks/RunSimulatorTask.cs @@ -29,8 +29,8 @@ public ISimulatorDevice [] Simulators { } } - public RunSimulatorTask (ISimulatorLoader simulators, MSBuildTask build_task, IProcessManager ProcessManager, IEnumerable candidates = null) - : base (build_task, ProcessManager, candidates) + public RunSimulatorTask (Jenkins jenkins, ISimulatorLoader simulators, MSBuildTask buildTask, IProcessManager processManager, IEnumerable candidates = null) + : base (jenkins, buildTask, processManager, candidates) { var project = Path.GetFileNameWithoutExtension (ProjectFile); if (project.EndsWith ("-tvos", StringComparison.Ordinal)) { @@ -127,8 +127,10 @@ protected override async Task RunTestAsync () ExecutionResult = runner.Result; KnownFailure = null; - if (Jenkins.IsKnownTestIssue (runner.MainLog, out KnownFailure)) + if (Jenkins.IsKnownTestIssue (runner.MainLog, out var failure)) { + KnownFailure = failure; Jenkins.MainLog.WriteLine ($"Test run has a known failure: '{KnownFailure}'"); + } } protected override string XIMode { diff --git a/tests/xharness/Jenkins/TestTasks/RunTestTask.cs b/tests/xharness/Jenkins/TestTasks/RunTestTask.cs index 2e3c4670a405..0e710813c8c9 100644 --- a/tests/xharness/Jenkins/TestTasks/RunTestTask.cs +++ b/tests/xharness/Jenkins/TestTasks/RunTestTask.cs @@ -8,6 +8,7 @@ using Microsoft.DotNet.XHarness.iOS.Shared.Execution; using Microsoft.DotNet.XHarness.iOS.Shared.Logging; using Microsoft.DotNet.XHarness.iOS.Shared.Utilities; +using Xharness.TestTasks; namespace Xharness.Jenkins.TestTasks { internal abstract class RunTestTask : AppleTestTask @@ -15,12 +16,12 @@ internal abstract class RunTestTask : AppleTestTask protected IProcessManager ProcessManager { get; } IResultParser ResultParser { get; } = new XmlResultParser (); - public readonly BuildToolTask BuildTask; + public readonly IBuildToolTask BuildTask; public TimeSpan Timeout = TimeSpan.FromMinutes (10); public double TimeoutMultiplier { get; set; } = 1; public string WorkingDirectory; - public RunTestTask (BuildToolTask build_task, IProcessManager processManager) : base (build_task.Jenkins) + public RunTestTask (Jenkins jenkins, IBuildToolTask build_task, IProcessManager processManager) : base (jenkins) { this.BuildTask = build_task; this.ProcessManager = processManager ?? throw new ArgumentNullException (nameof (processManager)); diff --git a/tests/xharness/Jenkins/TestTasks/RunXITask.cs b/tests/xharness/Jenkins/TestTasks/RunXITask.cs index 76abc19f18aa..5e27421a9593 100644 --- a/tests/xharness/Jenkins/TestTasks/RunXITask.cs +++ b/tests/xharness/Jenkins/TestTasks/RunXITask.cs @@ -24,8 +24,8 @@ abstract class RunXITask : RunTestTask where TDevice : class, IDevice public string BundleIdentifier => runner.AppInformation.BundleIdentifier; - public RunXITask (BuildToolTask build_task, IProcessManager processManager, IEnumerable candidates) - : base (build_task, processManager) + public RunXITask (Jenkins jenkins, BuildToolTask build_task, IProcessManager processManager, IEnumerable candidates) + : base (jenkins, build_task, processManager) { this.Candidates = candidates; } diff --git a/tests/xharness/Jenkins/TestTasks/RunXtroTask.cs b/tests/xharness/Jenkins/TestTasks/RunXtroTask.cs index 0547d38b5a24..e14ce9d2cab1 100644 --- a/tests/xharness/Jenkins/TestTasks/RunXtroTask.cs +++ b/tests/xharness/Jenkins/TestTasks/RunXtroTask.cs @@ -8,8 +8,8 @@ namespace Xharness.Jenkins.TestTasks { class RunXtroTask : MacExecuteTask { - public RunXtroTask (BuildToolTask build_task, IProcessManager processManager, ICrashSnapshotReporterFactory crashReportSnapshotFactory) - : base (build_task, processManager, crashReportSnapshotFactory) + public RunXtroTask (Jenkins jenkins, BuildToolTask build_task, IProcessManager processManager, ICrashSnapshotReporterFactory crashReportSnapshotFactory) + : base (jenkins, build_task, processManager, crashReportSnapshotFactory) { } diff --git a/tests/xharness/TestTasks/IBuildToolTask.cs b/tests/xharness/TestTasks/IBuildToolTask.cs new file mode 100644 index 000000000000..e722bd91fc44 --- /dev/null +++ b/tests/xharness/TestTasks/IBuildToolTask.cs @@ -0,0 +1,19 @@ +using System.Threading.Tasks; +using Microsoft.DotNet.XHarness.iOS.Shared.Execution; + +namespace Xharness.TestTasks { + + /// + /// Interface to be implemented by those tasks that represent a build execution. + /// + public interface IBuildToolTask : ITestTask { + IProcessManager ProcessManager { get; } + string TestName { get; set; } + bool SpecifyPlatform { get; set; } + bool SpecifyConfiguration { get; set; } + TestProject TestProject { get; set; } + TestPlatform Platform { get; set; } + string Mode { get; set; } + public Task CleanAsync (); + } +} diff --git a/tests/xharness/TestTasks/ITestTask.cs b/tests/xharness/TestTasks/ITestTask.cs new file mode 100644 index 000000000000..a0d81f0ba861 --- /dev/null +++ b/tests/xharness/TestTasks/ITestTask.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Microsoft.DotNet.XHarness.iOS.Shared; +using Microsoft.DotNet.XHarness.iOS.Shared.Logging; + +namespace Xharness.TestTasks { + public interface ITestTask { + bool HasCustomTestName { get; } + bool BuildSucceeded { get; } + bool Succeeded { get; } + bool Failed { get; } + bool Ignored { get; set; } + bool TimedOut { get; } + + string KnownFailure { get; set; } + string ProjectConfiguration { get; set; } + string ProjectPlatform { get; set; } + string ProjectFile { get; } + + public string FailureMessage { get; set; } + + + TimeSpan Duration { get; } + Task InitialTask { get; set; } + TestExecutingResult ExecutionResult { get; set; } + IEnumerable AggregatedLogs { get; } + ILogs Logs { get; } + + + Task RunAsync (); + void Reset (); + } +} diff --git a/tests/xharness/TestTasks/TestTask.cs b/tests/xharness/TestTasks/TestTask.cs index b07d130907f9..0e4054c0175e 100644 --- a/tests/xharness/TestTasks/TestTask.cs +++ b/tests/xharness/TestTasks/TestTask.cs @@ -11,7 +11,7 @@ using Microsoft.DotNet.XHarness.iOS.Shared.Utilities; namespace Xharness.TestTasks { - public abstract class TestTasks : IEnvManager, IEventLogger + public abstract class TestTasks : IEnvManager, IEventLogger, ITestTask { static int counter; static DriveInfo RootDrive; @@ -20,12 +20,12 @@ public abstract class TestTasks : IEnvManager, IEventLogger public readonly int ID; public bool BuildOnly; - public string KnownFailure; - public string ProjectConfiguration; - public string ProjectPlatform; + public string KnownFailure { get; set; } + public string ProjectConfiguration { get; set; } + public string ProjectPlatform { get; set; } public Dictionary Environment = new Dictionary (); public Func Dependency; // a task that's feteched and awaited before this task's ExecuteAsync method - public Task InitialTask; // a task that's executed before this task's ExecuteAsync method. + public Task InitialTask { get; set; } // a task that's executed before this task's ExecuteAsync method. public Task CompletedTask; // a task that's executed after this task's ExecuteAsync method. public List Resources = new List (); diff --git a/tests/xharness/xharness.csproj b/tests/xharness/xharness.csproj index 28fa2539863d..421ae5975b24 100644 --- a/tests/xharness/xharness.csproj +++ b/tests/xharness/xharness.csproj @@ -127,6 +127,8 @@ + +