From 513ac78ca8aaeb61fa06928ca10aeff34a7b4683 Mon Sep 17 00:00:00 2001 From: Brian Carlstrom Date: Fri, 14 Oct 2011 17:41:32 -0700 Subject: [PATCH] Set ANDROID_DATA for DalvikExecTest Also increase timeout to allow for dexopt of BOOTCLASSPATH Bug: 5310023 Change-Id: Icaa81a3bb3cea10c610e6ad671a001f6dbfeda17 --- .../test/java/libcore/java/util/jar/DalvikExecTest.java | 7 ++++++- support/src/test/java/tests/support/Support_Exec.java | 6 +++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/luni/src/test/java/libcore/java/util/jar/DalvikExecTest.java b/luni/src/test/java/libcore/java/util/jar/DalvikExecTest.java index 08ec096b8..021cd3fac 100644 --- a/luni/src/test/java/libcore/java/util/jar/DalvikExecTest.java +++ b/luni/src/test/java/libcore/java/util/jar/DalvikExecTest.java @@ -45,7 +45,6 @@ String execDalvik1(String classpath, String mainClass, String arg1) builder.command().add("dalvikvm"); // for host mode, assume dalvikvm is on the path } - builder.command().add("-Djava.io.tmpdir=/tmp/mc"); builder.command().add("-Duser.language=en"); builder.command().add("-Duser.region=US"); builder.command().add("-Xbootclasspath:" + System.getProperty("java.boot.class.path")); @@ -57,6 +56,12 @@ String execDalvik1(String classpath, String mainClass, String arg1) builder.command().add(arg1); } + // Create a writable dalvik-cache under ANDROID_DATA. + // The default dalvik-cache is only writable by the system user (and root). + String tmp = System.getProperty("java.io.tmpdir"); + builder.environment().put("ANDROID_DATA", tmp); + new File(tmp, "dalvik-cache").mkdir(); + return execAndGetOutput(builder); } diff --git a/support/src/test/java/tests/support/Support_Exec.java b/support/src/test/java/tests/support/Support_Exec.java index 124dcdcad..0502b9ca8 100644 --- a/support/src/test/java/tests/support/Support_Exec.java +++ b/support/src/test/java/tests/support/Support_Exec.java @@ -77,7 +77,7 @@ public static String createPath(String... elements) { * standard err, and returns. If the stream emits anything to standard err, * an AssertionFailedError will be thrown. * - *

This method assumes the target process will complete within ten + *

This method assumes the target process will complete within thirty * seconds. If it does not, an AssertionFailedError will be thrown. */ public static String execAndGetOutput(ProcessBuilder builder) throws IOException { @@ -92,8 +92,8 @@ public static String execAndGetOutput(ProcessBuilder builder) throws IOException Throwable failure; String out = ""; try { - out = outFuture.get(10, TimeUnit.SECONDS); - String err = errFuture.get(10, TimeUnit.SECONDS); + out = outFuture.get(30, TimeUnit.SECONDS); + String err = errFuture.get(30, TimeUnit.SECONDS); failure = err.length() > 0 ? new AssertionFailedError("Unexpected err stream data:\n" + err) : null;