Imported Upstream version 6.0.0.172

Former-commit-id: f3cc9b82f3e5bd8f0fd3ebc098f789556b44e9cd
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2019-04-12 14:10:50 +00:00
parent 8016999e4d
commit 64ac736ec5
32155 changed files with 3981439 additions and 75368 deletions

View File

@@ -0,0 +1,155 @@
//
// HelixBase.cs
//
// Authors:
// Alexander Köplinger <alkpli@microsoft.com>
//
// Copyright (C) 2018 Microsoft
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Threading.Tasks;
using Microsoft.DotNet.Helix.Client;
public class HelixBase
{
protected IHelixApi _api;
public HelixBase ()
{
_api = ApiFactory.GetAuthenticated (GetEnvironmentVariable ("MONO_HELIX_API_KEY"));
}
protected string GetEnvironmentVariable (string variable)
{
return Environment.GetEnvironmentVariable (variable) ?? throw new ArgumentException ($"No value for '{variable}'.");
}
protected string McUrlEncode (string input)
{
// encodes the URL in a way Mission Control understands (% replaced with ~)
var result = WebUtility.UrlEncode (input);
return result.Replace ("%", "~");
}
public async Task<bool> WaitForJobCompletion (string correlationId)
{
bool success = false;
bool printedMcLink = false;
Console.WriteLine ($"Waiting for job '{correlationId}' to finish...");
int sleepTime = 0;
while (true)
{
await Task.Delay (sleepTime);
sleepTime = Math.Min (30000, sleepTime + 10000);
var statusContent = await _api.Job.DetailsAsync (correlationId);
if (String.IsNullOrEmpty (statusContent.JobList))
{
Console.WriteLine ("Job list isn't available yet.");
continue;
}
if (!printedMcLink)
{
var mcResultsUrl = $"https://mc.dot.net/#/user/{McUrlEncode (statusContent.Creator)}/{McUrlEncode (statusContent.Source)}/{McUrlEncode (statusContent.Type)}/{McUrlEncode (statusContent.Build)}";
Console.WriteLine ($"View test results on Mission Control: {mcResultsUrl}");
printedMcLink = true;
}
var isFinished = statusContent.WorkItems.Unscheduled == 0 &&
statusContent.WorkItems.Waiting == 0 &&
statusContent.WorkItems.Running == 0;
if (isFinished)
{
Console.WriteLine ("Job finished, fetching results...");
var resultsContent = (await _api.Aggregate.JobSummaryMethodAsync (new List<string> { "job.name" }, maxResultSets: 1, filtername: correlationId));
if (resultsContent.Count != 1)
throw new InvalidOperationException ("No results found for job.");
resultsContent[0].Validate ();
var resultData = resultsContent[0].Data;
var workItemStatus = resultData.WorkItemStatus;
var analyses = resultData.Analysis;
if (workItemStatus.ContainsKey ("none"))
{
Console.WriteLine ($"Still processing xunit data from {workItemStatus["none"]} work items. Stay tuned.");
continue;
}
if (analyses.Count > 0)
{
if (analyses.Count > 1)
throw new InvalidOperationException ("Job contains multiple analyses, this shouldn't happen.");
var analysis = analyses[0];
if (analysis.Name != "xunit")
throw new InvalidOperationException ($"Job contains unknown analysis '{analysis.Name}', this shouldn't happen.");
if (analysis.Status == null)
throw new InvalidOperationException ($"Job contains no status for analysis '{analysis.Name}', this shouldn't happen.");
analysis.Status.TryGetValue ("pass", out int? pass);
analysis.Status.TryGetValue ("skip", out int? skip);
analysis.Status.TryGetValue ("fail", out int? fail);
int? total = pass + skip + fail;
if (total == null || total == 0)
throw new InvalidOperationException ($"Job contains no test results, this shouldn't happen.");
Console.WriteLine ("");
Console.WriteLine ($"Tests run: {total}, Passed: {pass ?? 0}, Errors: 0, Failures: {fail ?? 0}, Inconclusive: 0");
Console.WriteLine ($" Not run: {skip ?? 0}, Invalid: 0, Ignored: 0, Skipped: {skip ?? 0}");
Console.WriteLine ("");
success = (fail == 0);
}
if (workItemStatus.ContainsKey ("fail"))
{
success = false;
Console.WriteLine ($"{workItemStatus["fail"]} work items failed.");
}
}
else
{
Console.WriteLine ($"Waiting for work items to finish: Unscheduled: {statusContent.WorkItems.Unscheduled}, Waiting: {statusContent.WorkItems.Waiting}, Running: {statusContent.WorkItems.Running}");
continue;
}
Console.WriteLine ($"Job {(success ? "SUCCEEDED" : "FAILED")}.");
return success;
}
}
}

View File

@@ -0,0 +1,100 @@
//
// HelixTestBase.cs
//
// Authors:
// Alexander Köplinger <alkpli@microsoft.com>
//
// Copyright (C) 2018 Microsoft
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.IO;
using System.Threading.Tasks;
using Microsoft.DotNet.Helix.Client;
public abstract class HelixTestBase : HelixBase
{
IJobDefinition _job;
protected HelixTestBase (string helixType) : base ()
{
var helixSource = GetEnvironmentVariable ("MONO_HELIX_SOURCE");
if (helixSource.StartsWith ("pr/"))
{
// workaround for https://github.com/dotnet/arcade/issues/1392
var storage = new Storage ((HelixApi)_api);
var anonymousApi = ApiFactory.GetAnonymous ();
typeof (HelixApi).GetProperty ("Storage").SetValue (anonymousApi, storage, null);
_api = anonymousApi;
}
var build = _api.Job.Define ()
.WithSource (helixSource)
.WithType (helixType)
.WithBuild (GetEnvironmentVariable ("MONO_HELIX_BUILD_MONIKER"));
_job = build
.WithTargetQueue (GetEnvironmentVariable ("MONO_HELIX_TARGET_QUEUE"))
.WithCreator (GetEnvironmentVariable ("MONO_HELIX_CREATOR"))
.WithCorrelationPayloadDirectory (GetEnvironmentVariable ("MONO_HELIX_TEST_PAYLOAD_DIRECTORY"))
.WithCorrelationPayloadFiles (GetEnvironmentVariable ("MONO_HELIX_XUNIT_REPORTER_PATH"))
// these are well-known properties used by Mission Control
.WithProperty ("architecture", GetEnvironmentVariable ("MONO_HELIX_ARCHITECTURE"))
.WithProperty ("operatingSystem", GetEnvironmentVariable ("MONO_HELIX_OPERATINGSYSTEM"));
}
protected void CreateWorkItem (string name, string command, int timeoutInSeconds)
{
_job.DefineWorkItem (name)
.WithCommand ($"chmod +x $HELIX_CORRELATION_PAYLOAD/mono-test.sh; $HELIX_CORRELATION_PAYLOAD/mono-test.sh {command}; exit_code=$1; $HELIX_PYTHONPATH $HELIX_CORRELATION_PAYLOAD/xunit-reporter.py; exit $exit_code")
.WithEmptyPayload ()
.WithTimeout (TimeSpan.FromSeconds (timeoutInSeconds))
.AttachToJob ();
}
protected void CreateCustomWorkItem (string suite, int timeoutInSeconds = 900)
{
CreateWorkItem (suite, $"--{suite}", timeoutInSeconds);
}
protected void CreateNunitWorkItem (string assembly, string profile = "net_4_x", int timeoutInSeconds = 900)
{
var flakyTestRetries = Environment.GetEnvironmentVariable ("MONO_FLAKY_TEST_RETRIES") ?? "0";
CreateWorkItem (assembly, $"--nunit {profile}/tests/{assembly} --flaky-test-retries={flakyTestRetries}", timeoutInSeconds);
}
protected void CreateXunitWorkItem (string assembly, string profile = "net_4_x", int timeoutInSeconds = 900)
{
CreateWorkItem (assembly, $"--xunit {profile}/tests/{assembly}", timeoutInSeconds);
}
public async Task<string> SendJob ()
{
Console.WriteLine ($"Sending job to Helix...");
var sentJob = await _job.SendAsync ();
Console.WriteLine ($"Job '{sentJob.CorrelationId}' created.");
return sentJob.CorrelationId;
}
}

View File

@@ -0,0 +1,161 @@
//
// MainlineTests.cs
//
// Authors:
// Alexander Köplinger <alkpli@microsoft.com>
//
// Copyright (C) 2018 Microsoft
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
public class MainlineTests : HelixTestBase
{
public MainlineTests (string type) : base ($"test/{type}/")
{
}
public HelixTestBase CreateJob ()
{
// xunit tests
CreateXunitWorkItem ("net_4_x_corlib_xunit-test.dll");
CreateXunitWorkItem ("net_4_x_System_xunit-test.dll");
CreateXunitWorkItem ("net_4_x_System.Xml_xunit-test.dll");
CreateXunitWorkItem ("net_4_x_System.Xml.Linq_xunit-test.dll");
CreateXunitWorkItem ("net_4_x_System.Threading.Tasks.Dataflow_xunit-test.dll");
CreateXunitWorkItem ("net_4_x_System.Security_xunit-test.dll");
CreateXunitWorkItem ("net_4_x_System.Runtime.Serialization_xunit-test.dll");
CreateXunitWorkItem ("net_4_x_System.Runtime.CompilerServices.Unsafe_xunit-test.dll");
CreateXunitWorkItem ("net_4_x_System.Numerics_xunit-test.dll");
CreateXunitWorkItem ("net_4_x_System.Json_xunit-test.dll");
CreateXunitWorkItem ("net_4_x_System.Drawing_xunit-test.dll");
CreateXunitWorkItem ("net_4_x_System.Data_xunit-test.dll");
CreateXunitWorkItem ("net_4_x_System.Core_xunit-test.dll");
CreateXunitWorkItem ("net_4_x_System.ComponentModel.Composition_xunit-test.dll");
CreateXunitWorkItem ("net_4_x_System.Net.Http.FunctionalTests_xunit-test.dll");
CreateXunitWorkItem ("net_4_x_System.Net.Http.UnitTests_xunit-test.dll");
CreateXunitWorkItem ("net_4_x_Mono.Profiler.Log_xunit-test.dll");
CreateXunitWorkItem ("net_4_x_Microsoft.CSharp_xunit-test.dll");
// NUnit tests
CreateNunitWorkItem ("net_4_x_corlib_test.dll");
CreateNunitWorkItem ("net_4_x_WindowsBase_test.dll");
CreateNunitWorkItem ("net_4_x_WebMatrix.Data_test.dll");
CreateNunitWorkItem ("net_4_x_System_test.dll");
CreateNunitWorkItem ("net_4_x_System.Xml_test.dll");
CreateNunitWorkItem ("net_4_x_System.Xml.Linq_test.dll");
CreateNunitWorkItem ("net_4_x_System.Xaml_test.dll");
CreateNunitWorkItem ("net_4_x_System.Windows.Forms_test.dll");
CreateNunitWorkItem ("net_4_x_System.Windows.Forms.DataVisualization_test.dll");
CreateNunitWorkItem ("net_4_x_System.Web_test.dll");
CreateNunitWorkItem ("net_4_x_System.Web.Services_test.dll");
CreateNunitWorkItem ("net_4_x_System.Web.Routing_test.dll");
CreateNunitWorkItem ("net_4_x_System.Web.Extensions_test.dll");
CreateNunitWorkItem ("net_4_x_System.Web.DynamicData_test.dll");
CreateNunitWorkItem ("net_4_x_System.Web.Abstractions_test.dll");
CreateNunitWorkItem ("net_4_x_System.Transactions_test.dll");
CreateNunitWorkItem ("net_4_x_System.Threading.Tasks.Dataflow_test.dll");
CreateNunitWorkItem ("net_4_x_System.ServiceProcess_test.dll");
CreateNunitWorkItem ("net_4_x_System.ServiceModel_test.dll");
CreateNunitWorkItem ("net_4_x_System.ServiceModel.Web_test.dll");
CreateNunitWorkItem ("net_4_x_System.ServiceModel.Discovery_test.dll");
CreateNunitWorkItem ("net_4_x_System.Security_test.dll");
CreateNunitWorkItem ("net_4_x_System.Runtime.Serialization_test.dll");
CreateNunitWorkItem ("net_4_x_System.Runtime.Serialization.Formatters.Soap_test.dll");
CreateNunitWorkItem ("net_4_x_System.Runtime.Remoting_test.dll");
CreateNunitWorkItem ("net_4_x_System.Runtime.DurableInstancing_test.dll");
CreateNunitWorkItem ("net_4_x_System.Runtime.Caching_test.dll");
CreateNunitWorkItem ("net_4_x_System.Numerics_test.dll");
CreateNunitWorkItem ("net_4_x_System.Net.Http_test.dll");
CreateNunitWorkItem ("net_4_x_System.Net.Http.WebRequest_test.dll");
//CreateNunitWorkItem ("net_4_x_System.Messaging_test.dll"); // needs RabbitMQ installed and hangs on process exit
CreateNunitWorkItem ("net_4_x_System.Json_test.dll");
CreateNunitWorkItem ("net_4_x_System.Json.Microsoft_test.dll");
CreateNunitWorkItem ("net_4_x_System.IdentityModel_test.dll");
CreateNunitWorkItem ("net_4_x_System.IO.Compression_test.dll");
CreateNunitWorkItem ("net_4_x_System.IO.Compression.FileSystem_test.dll");
CreateNunitWorkItem ("net_4_x_System.Drawing_test.dll");
CreateNunitWorkItem ("net_4_x_System.DirectoryServices_test.dll");
CreateNunitWorkItem ("net_4_x_System.Design_test.dll");
CreateNunitWorkItem ("net_4_x_System.Data_test.dll");
CreateNunitWorkItem ("net_4_x_System.Data.Services_test.dll");
CreateNunitWorkItem ("net_4_x_System.Data.OracleClient_test.dll");
CreateNunitWorkItem ("net_4_x_System.Data.Linq_test.dll");
CreateNunitWorkItem ("net_4_x_System.Data.DataSetExtensions_test.dll");
CreateNunitWorkItem ("net_4_x_System.Core_test.dll");
CreateNunitWorkItem ("net_4_x_System.Configuration_test.dll");
CreateNunitWorkItem ("net_4_x_System.ComponentModel.DataAnnotations_test.dll");
//CreateNunitWorkItem("net_4_x_monodoc_test.dll"); // fails one test and needs to get rid of CallerFilePath to locate test resources
CreateNunitWorkItem ("net_4_x_Novell.Directory.Ldap_test.dll");
CreateNunitWorkItem ("net_4_x_Mono.XBuild.Tasks_test.dll");
CreateNunitWorkItem ("net_4_x_Mono.Tasklets_test.dll");
CreateNunitWorkItem ("net_4_x_Mono.Security_test.dll");
CreateNunitWorkItem ("net_4_x_Mono.Runtime.Tests_test.dll");
CreateNunitWorkItem ("net_4_x_Mono.Posix_test.dll");
CreateNunitWorkItem ("net_4_x_Mono.Parallel_test.dll");
CreateNunitWorkItem ("net_4_x_Mono.Options_test.dll");
CreateNunitWorkItem ("net_4_x_Mono.Messaging_test.dll");
CreateNunitWorkItem ("net_4_x_Mono.Messaging.RabbitMQ_test.dll");
CreateNunitWorkItem ("net_4_x_Mono.Debugger.Soft_test.dll");
CreateNunitWorkItem ("net_4_x_Mono.Data.Tds_test.dll");
CreateNunitWorkItem ("net_4_x_Mono.Data.Sqlite_test.dll");
CreateNunitWorkItem ("net_4_x_Mono.CodeContracts_test.dll");
CreateNunitWorkItem ("net_4_x_Mono.CSharp_test.dll");
CreateNunitWorkItem ("net_4_x_Mono.C5_test.dll");
CreateNunitWorkItem ("net_4_x_I18N.West_test.dll");
CreateNunitWorkItem ("net_4_x_I18N.Rare_test.dll");
CreateNunitWorkItem ("net_4_x_I18N.Other_test.dll");
CreateNunitWorkItem ("net_4_x_I18N.MidEast_test.dll");
CreateNunitWorkItem ("net_4_x_I18N.CJK_test.dll");
CreateNunitWorkItem ("net_4_x_Cscompmgd_test.dll");
CreateNunitWorkItem ("net_4_x_Commons.Xml.Relaxng_test.dll");
CreateNunitWorkItem ("net_4_x_Microsoft.Build_test.dll");
CreateNunitWorkItem ("net_4_x_Microsoft.Build.Utilities_test.dll");
CreateNunitWorkItem ("net_4_x_Microsoft.Build.Tasks_test.dll");
CreateNunitWorkItem ("net_4_x_Microsoft.Build.Framework_test.dll");
CreateNunitWorkItem ("net_4_x_Microsoft.Build.Engine_test.dll");
CreateNunitWorkItem ("BinarySerializationOverVersionsTest.dll");
CreateNunitWorkItem ("xbuild_12_Microsoft.Build_test.dll", profile: "xbuild_12");
CreateNunitWorkItem ("xbuild_12_Microsoft.Build.Utilities_test.dll", profile: "xbuild_12");
CreateNunitWorkItem ("xbuild_12_Microsoft.Build.Tasks_test.dll", profile: "xbuild_12");
CreateNunitWorkItem ("xbuild_12_Microsoft.Build.Framework_test.dll", profile: "xbuild_12");
CreateNunitWorkItem ("xbuild_12_Microsoft.Build.Engine_test.dll", profile: "xbuild_12");
CreateNunitWorkItem ("xbuild_14_Microsoft.Build_test.dll", profile: "xbuild_14");
CreateNunitWorkItem ("xbuild_14_Microsoft.Build.Utilities_test.dll", profile: "xbuild_14");
CreateNunitWorkItem ("xbuild_14_Microsoft.Build.Tasks_test.dll", profile: "xbuild_14");
CreateNunitWorkItem ("xbuild_14_Microsoft.Build.Framework_test.dll", profile: "xbuild_14");
CreateNunitWorkItem ("xbuild_14_Microsoft.Build.Engine_test.dll", profile: "xbuild_14");
// custom test suites
CreateCustomWorkItem ("mcs", timeoutInSeconds: 1800);
CreateCustomWorkItem ("mcs-errors", timeoutInSeconds: 1800);
CreateCustomWorkItem ("verify");
CreateCustomWorkItem ("aot-test", timeoutInSeconds: 1800);
CreateCustomWorkItem ("mini");
CreateCustomWorkItem ("symbolicate");
CreateCustomWorkItem ("csi");
CreateCustomWorkItem ("profiler");
CreateCustomWorkItem ("runtime", timeoutInSeconds: 1800);
return this;
}
}

View File

@@ -0,0 +1,20 @@
thisdir = tools/mono-helix-client
SUBDIRS =
include ../../build/rules.make
PROGRAM = mono-helix-client.exe
NO_INSTALL = yes
LIB_REFS = System System.Net.Http Facades/netstandard Facades/System.Runtime Facades/System.Threading.Tasks
helix_binaries = $(topdir)/../external/helix-binaries
LOCAL_MCS_FLAGS = -r:$(helix_binaries)/Microsoft.DotNet.Helix.Client.dll -r:$(helix_binaries)/Microsoft.DotNet.Helix.JobSender.dll -r:$(helix_binaries)/Microsoft.Rest.ClientRuntime.dll
with_helix_client = MONO_PATH="$(helix_binaries)$(PLATFORM_PATH_SEPARATOR)$(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)" $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)/mono-helix-client.exe
upload-to-helix:
MONO_HELIX_XUNIT_REPORTER_PATH="$(abspath $(helix_binaries)/xunit-reporter.py)" $(with_helix_client) --tests="$(MONO_HELIX_TYPE)" --correlationIdFile="$(MONO_HELIX_CORRELATION_ID_FILE)"
wait-for-job-completion:
$(with_helix_client) --wait="$(MONO_HELIX_CORRELATION_ID)"
include ../../build/executable.make

View File

@@ -0,0 +1,78 @@
//
// mono-helix-client.cs
//
// Authors:
// Alexander Köplinger <alkpli@microsoft.com>
//
// Copyright (C) 2018 Microsoft
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.IO;
using System.Threading.Tasks;
public class Program
{
public static int Main (string[] args)
{
return MainAsync (args).GetAwaiter ().GetResult ();
}
public static async Task<int> MainAsync (string[] args)
{
string tests = "";
string correlationId = "";
string correlationIdFile = "";
bool waitForJobCompletion = false;
var options = new Mono.Options.OptionSet {
{ "tests=", "Tests to run", param => { if (param != null) tests = param; } },
{ "correlationIdFile=", "File to write correlation ID to", param => { if (param != null) correlationIdFile = param; } },
{ "wait=", "Wait for job to complete", param => { if (param != null) { correlationId = param; waitForJobCompletion = true; } } },
};
try {
options.Parse (args);
} catch (Mono.Options.OptionException e) {
Console.WriteLine ("Option error: {0}", e.Message);
return 1;
}
if (tests == "mainline" || tests == "mainline-cxx") {
var t = new MainlineTests (tests);
correlationId = await t.CreateJob ().SendJob ();
if (!String.IsNullOrEmpty (correlationIdFile))
File.WriteAllText (correlationIdFile, correlationId);
return 0;
}
if (waitForJobCompletion) {
var success = await new HelixBase ().WaitForJobCompletion (correlationId);
return success ? 0 : 1;
}
Console.Error.WriteLine ("Error: Invalid arguments.");
return 1;
}
}

View File

@@ -0,0 +1,5 @@
HelixBase.cs
HelixTestBase.cs
MainlineTests.cs
mono-helix-client.cs
../../class/Mono.Options/Mono.Options/Options.cs