8077168: CodeStoreAndPathTest.java fails in jtreg mode on Mac

Use correct path on JRT file system

Reviewed-by: attila, sundar
This commit is contained in:
Michael Haupt 2015-08-18 09:13:46 -07:00
parent 19a69d8cbf
commit 5899d6fbda
2 changed files with 9 additions and 6 deletions

View File

@ -398,7 +398,7 @@ public final class OptimisticTypesPersistence {
} else if(protocol.equals("jrt")) {
return getJrtVersionDirName();
} else {
throw new AssertionError();
throw new AssertionError("unknown protocol");
}
}
@ -556,13 +556,15 @@ public final class OptimisticTypesPersistence {
return Math.max(0, Integer.parseInt(str));
}
private static final String JRT_NASHORN_DIR = "/modules/jdk.scripting.nashorn";
// version directory name if nashorn is loaded from jrt:/ URL
private static String getJrtVersionDirName() throws Exception {
final FileSystem fs = getJrtFileSystem();
// consider all .class resources under nashorn module to compute checksum
final Path nashorn = fs.getPath("/jdk.scripting.nashorn");
final Path nashorn = fs.getPath(JRT_NASHORN_DIR);
if (! Files.isDirectory(nashorn)) {
throw new FileNotFoundException("missing /jdk.scripting.nashorn dir in jrt fs");
throw new FileNotFoundException("missing " + JRT_NASHORN_DIR + " dir in jrt fs");
}
final MessageDigest digest = MessageDigest.getInstance("SHA-1");
Files.walk(nashorn).forEach(new Consumer<Path>() {

View File

@ -26,6 +26,7 @@ package jdk.nashorn.internal.runtime.test;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;
import java.io.File;
import java.io.IOException;
import java.nio.file.DirectoryStream;
@ -38,7 +39,6 @@ import jdk.nashorn.api.scripting.NashornScriptEngineFactory;
import org.testng.annotations.Test;
/**
* @ignore Fails with jtreg, but passes with ant test run. Ignore for now.
* @test
* @bug 8039185 8039403
* @summary Test for persistent code cache and path handling
@ -113,7 +113,8 @@ public class CodeStoreAndPathTest {
assertEquals(actualCodeCachePath, expectedCodeCachePath);
// Check that code cache dir exists and it's not empty
final File file = new File(actualCodeCachePath.toUri());
assertFalse(!file.isDirectory(), "No code cache directory was created!");
assertTrue(file.exists(), "No code cache directory was created!");
assertTrue(file.isDirectory(), "Code cache location is not a directory!");
assertFalse(file.list().length == 0, "Code cache directory is empty!");
}
@ -174,7 +175,7 @@ public class CodeStoreAndPathTest {
return codeCachePath.resolve(file);
}
}
throw new AssertionError("Code cache path not found");
throw new AssertionError("Code cache path not found: " + codeCachePath.toString());
}
private static void checkCompiledScripts(final DirectoryStream<Path> stream, final int numberOfScripts) throws IOException {