diff options
author | Andreas Gampe <agampe@google.com> | 2015-01-27 16:12:08 -0800 |
---|---|---|
committer | Andreas Gampe <agampe@google.com> | 2015-02-02 10:35:13 -0800 |
commit | 7403503d9ba33463e850b7e87a1b0430372d7003 (patch) | |
tree | 61444b6255e52f0728c3f3e0b8b8c4ca982307ca /test/099-vmdebug | |
parent | 04a77807a657e86495e7ececf7dc530fa5003c4c (diff) | |
download | android_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
Diffstat (limited to 'test/099-vmdebug')
-rw-r--r-- | test/099-vmdebug/src/Main.java | 18 |
1 files changed, 13 insertions, 5 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(); |