private Set<File> expectationFiles = new LinkedHashSet<File>();
private File xmlReportsDirectory;
private String javaHome;
+ private List<String> vmArgs = new ArrayList<String>();
private boolean clean = true;
private String deviceRunnerDir = "/sdcard/dalvikrunner";
private List<File> testFiles = new ArrayList<File>();
} else if ("--verbose".equals(args[i])) {
Logger.getLogger("dalvik.runner").setLevel(Level.FINE);
+ } else if ("--vm-arg".equals(args[i])) {
+ vmArgs.add(args[++i]);
+
} else if ("--xml-reports-directory".equals(args[i])) {
xmlReportsDirectory = new File(args[++i]);
if (!xmlReportsDirectory.isDirectory()) {
System.out.println(" test before the runner aborts it.");
System.out.println(" Default is: " + timeoutSeconds);
System.out.println();
+ System.out.println(" --vm-arg <argument>: include the specified argument when spawning a");
+ System.out.println(" virtual machine. Examples: -Xint:fast, -ea, -Xmx16M");
+ System.out.println();
System.out.println(" --xml-reports-directory <path>: directory to emit JUnit-style");
System.out.println(" XML test results.");
System.out.println();
private void run() throws Exception {
Vm vm = javaHome != null
- ? new JavaVm(debugPort, timeoutSeconds, sdkJar, localTemp, javaHome, clean)
- : new DeviceDalvikVm(debugPort, timeoutSeconds, sdkJar, localTemp,
- clean, deviceRunnerDir);
+ ? new JavaVm(debugPort, timeoutSeconds, sdkJar, localTemp,
+ javaHome, vmArgs, clean)
+ : new DeviceDalvikVm(debugPort, timeoutSeconds, sdkJar,
+ localTemp, vmArgs, clean, deviceRunnerDir);
List<CodeFinder> codeFinders = Arrays.asList(
new JtregFinder(localTemp),
new JUnitFinder(),
package dalvik.runner;
import java.io.File;
+import java.util.List;
import java.util.logging.Logger;
/**
private final Adb adb = new Adb();
- DeviceDalvikVm(Integer debugPort, long timeoutSeconds,
- File sdkJar, File localTemp, boolean clean, String runnerDir) {
- super(debugPort, timeoutSeconds, sdkJar, localTemp, clean);
+ DeviceDalvikVm(Integer debugPort, long timeoutSeconds, File sdkJar,
+ File localTemp, List<String> additionalVmArgs, boolean clean, String runnerDir) {
+ super(debugPort, timeoutSeconds, sdkJar, localTemp, additionalVmArgs, clean);
this.runnerDir = new File(runnerDir);
this.testTemp = new File(this.runnerDir, "/tests.tmp");
package dalvik.runner;
import java.io.File;
+import java.util.List;
/**
* A local Java virtual machine like Harmony or the RI.
private final String javaHome;
- JavaVm(Integer debugPort, long timeoutSeconds, File sdkJar,
- File localTemp, String javaHome, boolean clean) {
- super(debugPort, timeoutSeconds, sdkJar, localTemp, clean);
+ JavaVm(Integer debugPort, long timeoutSeconds, File sdkJar, File localTemp,
+ String javaHome, List<String> additionalVmArgs, boolean clean) {
+ super(debugPort, timeoutSeconds, sdkJar, localTemp, additionalVmArgs, clean);
this.javaHome = javaHome;
}
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
-import java.io.InputStreamReader;
import java.io.IOException;
+import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
= Executors.newFixedThreadPool(1, Threads.daemonThreadFactory());
protected final Integer debugPort;
+ protected final List<String> additionalVmArgs;
protected final long timeoutSeconds;
protected final File sdkJar;
protected final File localTemp;
private Classpath testRunnerClasses;
Vm(Integer debugPort, long timeoutSeconds, File sdkJar, File localTemp,
- boolean clean) {
+ List<String> additionalVmArgs, boolean clean) {
this.debugPort = debugPort;
this.timeoutSeconds = timeoutSeconds;
this.sdkJar = sdkJar;
this.localTemp = localTemp;
+ this.additionalVmArgs = additionalVmArgs;
this.clean = clean;
}
.classpath(getRuntimeSupportClasspath())
.userDir(testRun.getUserDir())
.debugPort(debugPort)
+ .vmArgs(additionalVmArgs)
.mainClass(testRun.getTestRunner().getName())
.build();
private Integer debugPort;
private String mainClass;
private List<String> vmCommand = Collections.singletonList("java");
- private List<String> vmArgs = Collections.emptyList();
+ private List<String> vmArgs = new ArrayList<String>();
public VmCommandBuilder vmCommand(String... vmCommand) {
this.vmCommand = Arrays.asList(vmCommand.clone());
}
public VmCommandBuilder vmArgs(String... vmArgs) {
- this.vmArgs = Arrays.asList(vmArgs.clone());
+ return vmArgs(Arrays.asList(vmArgs));
+ }
+
+ public VmCommandBuilder vmArgs(Collection<String> vmArgs) {
+ this.vmArgs.addAll(vmArgs);
return this;
}