From: Igor Kulaychuk Date: Wed, 22 Aug 2018 15:04:41 +0000 (+0300) Subject: Add support for Windows in TestRunner X-Git-Tag: submit/tizen/20180921.084208~2^2~9 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0e38f22802e6500ac3c45fbf7778670214320569;p=sdk%2Ftools%2Fnetcoredbg.git Add support for Windows in TestRunner --- diff --git a/tests/runner/Runner.cs b/tests/runner/Runner.cs index 01f1bf8..47f820b 100644 --- a/tests/runner/Runner.cs +++ b/tests/runner/Runner.cs @@ -5,6 +5,7 @@ using System.IO; using System.Collections.Generic; using System.Threading.Tasks; using System.Threading.Tasks.Dataflow; +using System.Runtime.InteropServices; using Xunit; using Xunit.Abstractions; @@ -51,9 +52,19 @@ namespace Runner process.StartInfo.RedirectStandardOutput = true; process.StartInfo.RedirectStandardInput = true; process.StartInfo.UseShellExecute = false; - process.StartInfo.Arguments = String.Format("-c \"{0}\"", command); - process.StartInfo.FileName = "/bin/sh"; - + if (TestRunner.IsWindows) + { + // For older Windows versions: + // process.StartInfo.Arguments = String.Format("/C \"{0}\"", command); + // process.StartInfo.FileName = "cmd"; + process.StartInfo.Arguments = String.Format("-NoLogo -Command \"{0}\"", command); + process.StartInfo.FileName = "powershell"; + } + else + { + process.StartInfo.Arguments = String.Format("-c \"{0}\"", command); + process.StartInfo.FileName = "/bin/sh"; + } // enable raising events because Process does not raise events by default process.EnableRaisingEvents = true; // attach the event handler for OutputDataReceived before starting the process @@ -263,6 +274,14 @@ namespace Runner private readonly ITestOutputHelper output; private string debuggerCommand; private Dictionary allTests; + + public static bool IsWindows { + get + { + return RuntimeInformation.IsOSPlatform(OSPlatform.Windows); + } + } + public TestRunner(ITestOutputHelper output) { this.output = output; @@ -281,7 +300,7 @@ namespace Runner } else { - this.debuggerCommand = Path.Combine(d.Parent.Parent.Parent.Parent.Parent.FullName, "bin", "netcoredbg"); + this.debuggerCommand = Path.Combine(d.Parent.Parent.Parent.Parent.Parent.FullName, "bin", "netcoredbg" + (IsWindows ? ".exe" : "")); } var timeout = Environment.GetEnvironmentVariable("TIMEOUT");