aboutsummaryrefslogtreecommitdiff
path: root/src/com/android/tradefed/invoker
diff options
context:
space:
mode:
authorjdesprez <jdesprez@google.com>2017-08-11 16:48:24 -0700
committerjdesprez <jdesprez@google.com>2017-08-16 15:30:27 -0700
commita90f97235f7745e8437e9b5119948fbd7f8a8ed8 (patch)
treea388798b4b9164a50a2d854d978672d9df4627d8 /src/com/android/tradefed/invoker
parent7d427ca2c4b10e5e33bc12440e0f9fab208c29f1 (diff)
downloadtradefederation-a90f97235f7745e8437e9b5119948fbd7f8a8ed8.tar.gz
Ensure cleanUp of build info is called
Ensure we call clean up on the build info even in case of - exceptions - multi device where only some of the builds are downloaded Test: unit tests Bug: 64576937 Change-Id: I190fab6b7e171acafdf28502df7d04146006441b
Diffstat (limited to 'src/com/android/tradefed/invoker')
-rw-r--r--src/com/android/tradefed/invoker/TestInvocation.java18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/com/android/tradefed/invoker/TestInvocation.java b/src/com/android/tradefed/invoker/TestInvocation.java
index 605f7018b..237a5e9b1 100644
--- a/src/com/android/tradefed/invoker/TestInvocation.java
+++ b/src/com/android/tradefed/invoker/TestInvocation.java
@@ -901,8 +901,6 @@ public class TestInvocation implements ITestInvocation {
"No build found to test for device: %s",
device.getSerialNumber());
rescheduleTest(config, rescheduler);
- // save current log contents to global log
- getLogRegistry().dumpToGlobalLog(config.getLogOutput());
// Set the exit code to error
setExitCode(ExitCode.NO_BUILD,
new BuildRetrievalError("No build found to test."));
@@ -941,6 +939,22 @@ public class TestInvocation implements ITestInvocation {
} catch (IOException e) {
CLog.e(e);
} finally {
+
+ // Ensure build infos are always cleaned up at the end of invocation.
+ for (String cleanUpDevice : context.getDeviceConfigNames()) {
+ if (context.getBuildInfo(cleanUpDevice) != null) {
+ try {
+ config.getDeviceConfigByName(cleanUpDevice)
+ .getBuildProvider()
+ .cleanUp(context.getBuildInfo(cleanUpDevice));
+ } catch (RuntimeException e) {
+ // We catch an simply log exception in cleanUp to avoid missing any final
+ // step of the invocation.
+ CLog.e(e);
+ }
+ }
+ }
+
// ensure we always deregister the logger
for (String deviceName : context.getDeviceConfigNames()) {
if (!(context.getDevice(deviceName).getIDevice() instanceof StubDevice)) {