public TestRun(TestDescription description, RunningMode runningMode) { this.description = description; Process p = new Process(); p.StartInfo.UseShellExecute = false; p.StartInfo.CreateNoWindow = true; p.StartInfo.RedirectStandardOutput = true; p.EnableRaisingEvents = true; string program = "unhandled-exception-test-case"; if (description.RCIL) { program = program + "-legacy"; } program = program + (description.USE20 ? ".2.exe" : ".1.exe"); if (runningMode.UseMonoRuntime) { p.StartInfo.FileName = runningMode.RUNTIME; p.StartInfo.Arguments = "--debug " + program + " " + description.Arguments; } else { p.StartInfo.FileName = program; p.StartInfo.Arguments = description.Arguments; } Console.WriteLine("Starting process \"{0}\" \"{1}\"", p.StartInfo.FileName, p.StartInfo.Arguments); p.Start(); // Do not wait for the child process to exit before // reading to the end of its redirected stream. // p.WaitForExit (); // Read the output stream first and then wait. string output = p.StandardOutput.ReadToEnd(); p.WaitForExit(); string[] outputLines = output.Split('\n'); result = new TestResult(p.ExitCode, outputLines); }
public static int Main(string [] args) { RunningMode runningMode = (args.Length > 0) ? new RunningMode(args [0]) : new RunningMode("RUNTIME:mono,GTC:F"); if (args.Length > 1) { Console.WriteLine("Extra arguments unrecognized"); return(1); } Console.WriteLine("Starting test run, UseMonoRuntime is {0}, GTC is {1}", runningMode.UseMonoRuntime, runningMode.GTC); int result = 0; if (!runningMode.GTC) { foreach (TestDescription test in tests) { TestRun testRun = new TestRun(test, runningMode); if (!testRun.Process(runningMode)) { result++; } } } else { for (int i = TestDescription.MIN_CONFIG_CODE; i <= TestDescription.MAX_CONFIG_CODE; i++) { TestDescription test = TestDescription.FromCode(i); if (test != null) { TestRun testRun = new TestRun(test, runningMode); testRun.Process(runningMode); } } } return(result); }
public TestRun(TestDescription description, RunningMode runningMode) { this.description = description; Process p = new Process (); p.StartInfo.UseShellExecute = false; p.StartInfo.CreateNoWindow = true; p.StartInfo.RedirectStandardOutput = true; p.EnableRaisingEvents = true; string program = "unhandled-exception-test-case"; if (description.RCIL) { program = program + "-legacy"; } program = program + (description.USE20 ? ".2.exe" : ".1.exe"); if (runningMode.UseMonoRuntime) { p.StartInfo.FileName = runningMode.RUNTIME; p.StartInfo.Arguments = "--debug " + program + " " + description.Arguments; } else { p.StartInfo.FileName = program; p.StartInfo.Arguments = description.Arguments; } Console.WriteLine ("Starting process \"{0}\" \"{1}\"", p.StartInfo.FileName, p.StartInfo.Arguments); p.Start(); string output = p.StandardOutput.ReadToEnd (); p.WaitForExit (); string[] outputLines = output.Split ('\n'); result = new TestResult (p.ExitCode, outputLines); }