Add environment property for timeout in android tests

This commit is contained in:
Natalia Ukhorskaya
2014-01-28 16:03:54 +04:00
parent 72dc8ff41b
commit 1836c4c560
@@ -160,7 +160,20 @@ public class RunUtils {
handler.startNotify();
if (settings.waitForEnd) {
handler.waitFor(1200000);
String timeoutAsString = System.getenv("kotlin.tests.android.timeout");
if (timeoutAsString == null) {
timeoutAsString = "30";
System.err.println("Default value for timeout used: timeout = 30 min. You can change it using 'kotlin.tests.android.timeout' environment variable");
}
int timeout;
try {
timeout = Integer.parseInt(timeoutAsString);
}
catch (NumberFormatException e) {
timeout = 30;
System.err.println("Timeout system property should be a number");
}
handler.waitFor(timeout * 60 * 1000);
if (!handler.isProcessTerminated()) {
System.out.println("Output before handler.isProcessTerminated() " + settings.commandLine);