Updates IsolatedHostTest to new testRunFailed interface.
Bug: b/159484093
Test: N/A
Change-Id: Ief99fade16e8a1c99ab2ff9043dcf54ba4d51742
diff --git a/test_framework/com/android/tradefed/testtype/IsolatedHostTest.java b/test_framework/com/android/tradefed/testtype/IsolatedHostTest.java
index 4ee1863..169cd8c 100644
--- a/test_framework/com/android/tradefed/testtype/IsolatedHostTest.java
+++ b/test_framework/com/android/tradefed/testtype/IsolatedHostTest.java
@@ -237,7 +237,11 @@
} catch (IOException e) {
if (!mReportedFailure) {
// Avoid overriding the failure
- listener.testRunFailed(StreamUtil.getStackTrace(e));
+ FailureDescription failure =
+ FailureDescription.create(
+ StreamUtil.getStackTrace(e), FailureStatus.INFRA_FAILURE);
+ listener.testRunFailed(failure);
+ listener.testRunEnded(0L, new HashMap<String, Metric>());
}
}
}
@@ -482,7 +486,10 @@
if (!runStarted) {
listener.testRunStarted(this.getClass().getCanonicalName(), 0);
}
- listener.testRunFailed(reply.getMessage());
+ FailureDescription failure =
+ FailureDescription.create(
+ reply.getMessage(), FailureStatus.INFRA_FAILURE);
+ listener.testRunFailed(failure);
listener.testRunEnded(0L, new HashMap<String, Metric>());
break mainLoop;
case RUNNER_STATUS_STARTING:
@@ -548,7 +555,15 @@
}
}
} catch (SocketTimeoutException e) {
- listener.testRunFailed(StreamUtil.getStackTrace(e));
+ mReportedFailure = true;
+ FailureDescription failure =
+ FailureDescription.create(
+ StreamUtil.getStackTrace(e), FailureStatus.INFRA_FAILURE);
+ listener.testRunFailed(failure);
+ listener.testRunEnded(
+ Duration.between(start, Instant.now()).toMillis(),
+ new HashMap<String, Metric>());
+ break mainLoop;
}
}
} finally {