Return exit code 1 in android test runner if a test failed (#36319)

* Return exit code 1 in android test runner if a test failed

* Exit instrumentation with runner exit code
This commit is contained in:
Santiago Fernandez Madero authored and GitHub committed 2020-05-13 09:00:23 -07:00
1 parent 5c667210d0
commit 5615bdaea8
1 file changed
+8 -1
@@ -24,11 +24,18 @@ public class SimpleAndroidTestRunner : AndroidApplicationEntryPoint, IDevice
Console.WriteLine($"Test libs were not found (*.Tests.dll was not found in {Environment.CurrentDirectory})");
return -1;
}
int exitCode = 0;
s_MainTestName = Path.GetFileNameWithoutExtension(s_testLibs[0]);
var simpleTestRunner = new SimpleAndroidTestRunner(true);
simpleTestRunner.TestsCompleted += (e, result) =>
{
if (result.FailedTests > 0)
exitCode = 1;
};
await simpleTestRunner.RunAsync();
Console.WriteLine("----- Done -----");
return 0;
return exitCode;
}
public SimpleAndroidTestRunner(bool verbose)