From: Johan Lorensson Date: Tue, 29 Nov 2016 07:47:12 +0000 (+0100) Subject: Merge pull request #4023 from lateralusX/jlorenss/test-driver-reporter X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;h=5d2f0cfa018a77d32a2fb569ec8103a743c6f5fe;hp=e186dcff2c2b6c6f32c72858425ba8b9d8b33efb;p=mono.git Merge pull request #4023 from lateralusX/jlorenss/test-driver-reporter Adding support to get test results back from TestDriver. --- diff --git a/mono/mini/TestDriver.cs b/mono/mini/TestDriver.cs index fdd7a10466f..639c5253970 100644 --- a/mono/mini/TestDriver.cs +++ b/mono/mini/TestDriver.cs @@ -13,10 +13,22 @@ public class CategoryAttribute : Attribute get; set; } } +public class TestDriverReporter +{ + public int FailedTests { get; private set; } + public int SkippedTests { get; private set; } + public int ExecutedTests { get; private set; } + + public void ReportResults (int executed, int skipped, int failed) { + ExecutedTests = executed; + SkippedTests = skipped; + FailedTests = failed; + } +}; public class TestDriver { - static public int RunTests (Type type, string[] args) { + static public int RunTests(Type type, string[] args, TestDriverReporter reporter) { int failed = 0, ran = 0; int result, expected; int i, j, iterations; @@ -135,11 +147,20 @@ public class TestDriver { } } + if (reporter != null) { + reporter.ReportResults (ran, nskipped, failed); + } + //Console.WriteLine ("Regression tests: {0} ran, {1} failed in [{2}]{3}", ran, failed, type.Assembly.GetName().Name, type); return failed; } + + static public int RunTests (Type type, string[] args) { + return RunTests (type, args, null); + } + static public int RunTests (Type type) { - return RunTests (type, null); + return RunTests (type, null, null); } }