Skip to content

Commit

Permalink
Set ANDROID_DATA for DalvikExecTest
Browse files Browse the repository at this point in the history
Also increase timeout to allow for dexopt of BOOTCLASSPATH

Bug: 5310023
Change-Id: Icaa81a3bb3cea10c610e6ad671a001f6dbfeda17
  • Loading branch information
bdcgoogle committed Oct 15, 2011
1 parent ba6dde5 commit 513ac78
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 6 additions & 1 deletion luni/src/test/java/libcore/java/util/jar/DalvikExecTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand All @@ -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);
}

Expand Down
6 changes: 3 additions & 3 deletions support/src/test/java/tests/support/Support_Exec.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
* <p>This method assumes the target process will complete within ten
* <p>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 {
Expand All @@ -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;
Expand Down

0 comments on commit 513ac78

Please sign in to comment.