diff options
author | Brett Chabot <brettchabot@android.com> | 2011-10-25 18:09:39 -0700 |
---|---|---|
committer | Brett Chabot <brettchabot@android.com> | 2011-10-25 18:13:46 -0700 |
commit | 44650b16f2f6e14f179b3c9e2feb4e79e9e27573 (patch) | |
tree | 5dcea1ac8017fff1a92080b767f8d5490f2234f6 | |
parent | 6bb6bc20d99dd79400f12ff60dccd2b59a91c383 (diff) | |
download | cts-44650b16f2f6e14f179b3c9e2feb4e79e9e27573.tar.gz |
Fix vm-tests attempt 2
Pass in ANDROID_DATA env variable, so dalvikvm will use the dalvik-cache
folder in /data/local/tmp/dalvik-cache.
Also remove all files when test completes.
Bug 5493719
Change-Id: Ifa63f25f4c5b374a7a44fce79075401a51de2987
-rw-r--r-- | tools/tradefed-host/src/com/android/cts/tradefed/testtype/VMHostTest.java | 19 | ||||
-rw-r--r-- | tools/vm-tests-tf/src/util/build/BuildDalvikSuite.java | 5 |
2 files changed, 18 insertions, 6 deletions
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/VMHostTest.java b/tools/tradefed-host/src/com/android/cts/tradefed/testtype/VMHostTest.java index 31a1602d972..e97264036e2 100644 --- a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/VMHostTest.java +++ b/tools/tradefed-host/src/com/android/cts/tradefed/testtype/VMHostTest.java @@ -46,6 +46,7 @@ public class VMHostTest extends JarHostTest { getDevice().getSerialNumber())); } super.run(listener); + cleanupDeviceFiles(getDevice()); } /** @@ -58,10 +59,7 @@ public class VMHostTest extends JarHostTest { */ private boolean installVmPrereqs(ITestDevice device, CtsBuildHelper ctsBuild) throws DeviceNotAvailableException { - if (device.doesFileExist(VM_TEST_TEMP_DIR)) { - CLog.d("Removing device's temp dir %s from previous runs.", VM_TEST_TEMP_DIR); - device.executeShellCommand(String.format("rm -r %s", VM_TEST_TEMP_DIR)); - } + cleanupDeviceFiles(device); // Creates temp directory recursively. We also need to create the dalvik-cache directory // which is used by the dalvikvm to optimize things. Without the dalvik-cache, there will be // a sigsev thrown by the vm. @@ -97,6 +95,19 @@ public class VMHostTest extends JarHostTest { } /** + * Removes temporary file directory from device + * + * @param device + * @throws DeviceNotAvailableException + */ + private void cleanupDeviceFiles(ITestDevice device) throws DeviceNotAvailableException { + if (device.doesFileExist(VM_TEST_TEMP_DIR)) { + CLog.d("Removing device's temp dir %s from previous runs.", VM_TEST_TEMP_DIR); + device.executeShellCommand(String.format("rm -r %s", VM_TEST_TEMP_DIR)); + } + } + + /** * Creates the file directory recursively in the device. * * @param device the {@link ITestDevice} diff --git a/tools/vm-tests-tf/src/util/build/BuildDalvikSuite.java b/tools/vm-tests-tf/src/util/build/BuildDalvikSuite.java index d31daa17aa7..eebbb00d421 100644 --- a/tools/vm-tests-tf/src/util/build/BuildDalvikSuite.java +++ b/tools/vm-tests-tf/src/util/build/BuildDalvikSuite.java @@ -217,8 +217,9 @@ public class BuildDalvikSuite { } private String getShellExecJavaLine(String classpath, String mainclass) { - String cmd = String.format("dalvikvm -Xint:portable -Xmx512M -Xss32K -Djava.io.tmpdir=%s" + - " -classpath %s %s", TARGET_JAR_ROOT_PATH, classpath, mainclass); + String cmd = String.format("ANDROID_DATA=%s dalvikvm -Xint:portable -Xmx512M -Xss32K " + + ""-Djava.io.tmpdir=%s" -classpath %s %s", TARGET_JAR_ROOT_PATH, TARGET_JAR_ROOT_PATH, + classpath, mainclass); return "String res = getDevice().executeShellCommand(\""+ cmd + "\");\n" + "// A sucessful adb shell command returns an empty string.\n" + "assertEquals(\"" + cmd + "\", \"\", res);"; |