summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Gampe <agampe@google.com>2015-01-27 16:12:08 -0800
committerAndreas Gampe <agampe@google.com>2015-02-02 10:35:13 -0800
commit7403503d9ba33463e850b7e87a1b0430372d7003 (patch)
tree61444b6255e52f0728c3f3e0b8b8c4ca982307ca
parent04a77807a657e86495e7ececf7dc530fa5003c4c (diff)
downloadandroid_art-7403503d9ba33463e850b7e87a1b0430372d7003.tar.gz
android_art-7403503d9ba33463e850b7e87a1b0430372d7003.tar.bz2
android_art-7403503d9ba33463e850b7e87a1b0430372d7003.zip
ART: Fix run-tests for emulator
On a standard emulator, there is no sdcard emulation, so trying to create a temp file in /sdcard will fail - it will try to create in the root file system, which is read-only. Change-Id: If7d1ad82db156177a5be58c2f79ed730cf7ab6b9
-rw-r--r--test/099-vmdebug/src/Main.java18
-rw-r--r--test/802-deoptimization/src/CatchHandlerOnEntryHelper.java4
-rw-r--r--test/802-deoptimization/src/DeoptimizationController.java20
3 files changed, 29 insertions, 13 deletions
diff --git a/test/099-vmdebug/src/Main.java b/test/099-vmdebug/src/Main.java
index 7f24b1b825..4d781c3fc2 100644
--- a/test/099-vmdebug/src/Main.java
+++ b/test/099-vmdebug/src/Main.java
@@ -28,14 +28,22 @@ public class Main {
testMethodTracing();
}
- private static void testMethodTracing() throws Exception {
- File tempFile;
+ private static File createTempFile() throws Exception {
try {
- tempFile = File.createTempFile("test", ".trace");
+ return File.createTempFile("test", ".trace");
} catch (IOException e) {
- System.setProperty("java.io.tmpdir", "/sdcard");
- tempFile = File.createTempFile("test", ".trace");
+ System.setProperty("java.io.tmpdir", "/data/local/tmp");
+ try {
+ return File.createTempFile("test", ".trace");
+ } catch (IOException e2) {
+ System.setProperty("java.io.tmpdir", "/sdcard");
+ return File.createTempFile("test", ".trace");
+ }
}
+ }
+
+ private static void testMethodTracing() throws Exception {
+ File tempFile = createTempFile();
tempFile.deleteOnExit();
String tempFileName = tempFile.getPath();
diff --git a/test/802-deoptimization/src/CatchHandlerOnEntryHelper.java b/test/802-deoptimization/src/CatchHandlerOnEntryHelper.java
index a88d31b1af..9c41abfc0f 100644
--- a/test/802-deoptimization/src/CatchHandlerOnEntryHelper.java
+++ b/test/802-deoptimization/src/CatchHandlerOnEntryHelper.java
@@ -21,10 +21,10 @@ public class CatchHandlerOnEntryHelper {
public static void throwExceptionDuringDeopt(int i) {
if (i == 0) {
- DeoptimizationController.startDeoptomization();
+ DeoptimizationController.startDeoptimization();
throw new RuntimeException("Test exception");
} else {
- DeoptimizationController.stopDeoptomization();
+ DeoptimizationController.stopDeoptimization();
}
}
}
diff --git a/test/802-deoptimization/src/DeoptimizationController.java b/test/802-deoptimization/src/DeoptimizationController.java
index c031c07a0f..c926669503 100644
--- a/test/802-deoptimization/src/DeoptimizationController.java
+++ b/test/802-deoptimization/src/DeoptimizationController.java
@@ -22,15 +22,23 @@ import java.lang.reflect.Method;
* Controls deoptimization using dalvik.system.VMDebug class.
*/
public class DeoptimizationController {
- public static void startDeoptomization() {
+ private static File createTempFile() throws Exception {
try {
- File tempFile;
+ return File.createTempFile("test", ".trace");
+ } catch (IOException e) {
+ System.setProperty("java.io.tmpdir", "/data/local/tmp");
try {
- tempFile = File.createTempFile("test", ".trace");
- } catch (IOException e) {
+ return File.createTempFile("test", ".trace");
+ } catch (IOException e2) {
System.setProperty("java.io.tmpdir", "/sdcard");
- tempFile = File.createTempFile("test", ".trace");
+ return File.createTempFile("test", ".trace");
}
+ }
+ }
+
+ public static void startDeoptimization() {
+ try {
+ File tempFile = createTempFile();
tempFile.deleteOnExit();
String tempFileName = tempFile.getPath();
@@ -43,7 +51,7 @@ public class DeoptimizationController {
}
}
- public static void stopDeoptomization() {
+ public static void stopDeoptimization() {
try {
VMDebug.stopMethodTracing();
if (VMDebug.getMethodTracingMode() != 0) {