private void StopXsp(ExternalProcess xsp) { try { if (xsp != null) { xsp.Kill(); xsp.Dispose(); } } catch (Exception ex) { Console.WriteLine("Exception while trying to stop XSP: " + ex.Message + " (" + ex.GetType().FullName + ")"); } }
public void Start() { do { EnsureAgviewerProcess(); // If agviewer process dies and the tests aren't finished // mark the current test as a failure (since it somehow crashed the viewer) // and move to the next test in the queue. if (agviewer_process.ExitedEvent.WaitOne()) { if (run_complete) { break; } if (current_test != null) { int exit_code = 256; try { exit_code = agviewer_process.ExitCode; } catch (Exception ex) { Log.WriteLine("Exception (ignored) while trying to get exit code: {0}", ex); } if (exit_code == 0) { Log.WriteLine("Start (): agviewer decided to exit."); OnTestComplete(current_test, TestCompleteReason.Finished); } else { Log.WriteLine("Start (): agviewer crashed, exit code: {0}", exit_code); OnTestComplete(current_test, TestCompleteReason.Crashed); } } agviewer_process.Kill(); } } while (!run_complete); }
public static TestResult RunTest(Test test, int timeout, out string stdout, out string stderr) { if (agviewer_process == null || !agviewer_process.IsRunning) { if (agviewer_process != null) { agviewer_process.Kill(); } string args = String.Format("-working-dir {0} {1}", Path.GetFullPath(Path.GetDirectoryName(test.InputFile)), Path.GetFullPath(test.InputFile)); agviewer_process = new ExternalProcess(GetProcessPath(), args, timeout); if (!string.IsNullOrEmpty(Environment.GetEnvironmentVariable("MOON_PATH"))) { agviewer_process.EnvironmentVariables ["MONO_PATH"] = Environment.GetEnvironmentVariable("MOON_PATH") + ":" + Environment.GetEnvironmentVariable("MONO_PATH"); } agviewer_process.Run(false); } else { Console.WriteLine("agviewer process not shutdown: {0}.", agviewer_process.IsRunning); // logging_server.RunNextTest (Path.GetFullPath (test.InputFile)); } stdout = String.Empty; // ep.Stdout; stderr = String.Empty; // ep.Stder; /* * if (!logging_server.WaitForTestToComplete (test.InputFileName, agviewer_process, timeout)) { * test.SetFailedReason ("Test timed out."); * return TestResult.Fail; * } */ return(TestResult.Pass); }