[tests] Add a new --expected-exit-code option to the managed test-runner
authorAlexander Köplinger <alex.koeplinger@outlook.com>
Mon, 19 Oct 2015 14:33:54 +0000 (16:33 +0200)
committerAlexander Köplinger <alex.koeplinger@outlook.com>
Mon, 19 Oct 2015 14:34:05 +0000 (16:34 +0200)
mono/tests/test-runner.cs

index 0f8b1b060ec7a22d6a89489eca9d076d0e8a527e..a762e116f0892a2fc6d3588dc2f9ce167d06f33a 100644 (file)
@@ -64,6 +64,7 @@ public class TestRunner
                // Defaults
                int concurrency = 1;
                int timeout = 2 * 60; // in seconds
+               int expectedExitCode = 0;
 
                DateTime test_start_time = DateTime.UtcNow;
 
@@ -116,6 +117,13 @@ public class TestRunner
                                        foreach (var s in args [i + 1].Split ())
                                                opt_sets.Add (s);
                                        i += 2;
+                               } else if (args [i] == "--expected-exit-code") {
+                                       if (i + i >= args.Length) {
+                                               Console.WriteLine ("Missing argument to --expected-exit-code command line option.");
+                                               return 1;
+                                       }
+                                       expectedExitCode = Int32.Parse (args [i + 1]);
+                                       i += 2;
                                } else {
                                        Console.WriteLine ("Unknown command line option: '" + args [i] + "'.");
                                        return 1;
@@ -275,7 +283,7 @@ public class TestRunner
                                process.WaitForExit ();
 
                                lock (monitor) {
-                                       if (process.ExitCode == 0) {
+                                       if (process.ExitCode == expectedExitCode) {
                                                if (concurrency == 1)
                                                        Console.WriteLine ("passed.");
                                                else