command line: Forward --timeout values to caliper as --time-limit.
Also forwards the correct timeout value if @Large is used.
Test: art/tools/run-libcore-tests.sh '--mode=host' '--variant=X32'
Change-Id: I66b9e40cc114d36cf77bb63891301a77093ddcc0
diff --git a/src/vogar/tasks/RunActionTask.java b/src/vogar/tasks/RunActionTask.java
index 3c43d7b..26b4e3e 100644
--- a/src/vogar/tasks/RunActionTask.java
+++ b/src/vogar/tasks/RunActionTask.java
@@ -45,7 +45,7 @@
};
protected final Run run;
- private final boolean useLargeTimeout;
+ private final int timeoutSeconds;
private final Action action;
private final String actionName;
private Command currentCommand;
@@ -57,7 +57,10 @@
this.run = run;
this.action = action;
this.actionName = action.getName();
- this.useLargeTimeout = useLargeTimeout;
+
+ this.timeoutSeconds = useLargeTimeout
+ ? run.largeTimeoutSeconds
+ : run.smallTimeoutSeconds;
}
@Override public boolean isAction() {
@@ -80,9 +83,6 @@
try {
currentCommand.start();
- int timeoutSeconds = useLargeTimeout
- ? run.largeTimeoutSeconds
- : run.smallTimeoutSeconds;
if (timeoutSeconds != 0) {
currentCommand.scheduleTimeout(timeoutSeconds);
}
@@ -151,6 +151,11 @@
if (skipPast != null) {
vmCommandBuilder.args("--skipPast", skipPast);
}
+
+ // Forward timeout value to Caliper which has its own separate timeout.
+ if (run.runnerType.supportsCaliper()) {
+ vmCommandBuilder.args("--time-limit", String.format("%ds", timeoutSeconds));
+ }
return vmCommandBuilder
.temp(workingDirectory)
.debugPort(run.debugPort)
@@ -181,8 +186,8 @@
if (run.runnerType.supportsCaliper()) {
run.console.verbose("running " + outcomeName + " with unlimited timeout");
Command command = currentCommand;
- if (command != null && run.smallTimeoutSeconds != 0) {
- command.scheduleTimeout(run.smallTimeoutSeconds);
+ if (command != null && timeoutSeconds != 0) {
+ command.scheduleTimeout(timeoutSeconds);
}
run.driver.recordResults = false;
} else {
@@ -198,8 +203,8 @@
@Override public void finish(Outcome outcome) {
Command command = currentCommand;
- if (command != null && run.smallTimeoutSeconds != 0) {
- command.scheduleTimeout(run.smallTimeoutSeconds);
+ if (command != null && timeoutSeconds != 0) {
+ command.scheduleTimeout(timeoutSeconds);
}
lastFinishedOutcome = toQualifiedOutcomeName(outcome.getName());
// TODO: support flexible timeouts for JUnit tests