< prev index next >

test/src/jdk/nashorn/internal/runtime/test/CodeStoreAndPathTest.java

Print this page
rev 1377 : 8077168: CodeStoreAndPathTest.java fails in jtreg mode on Mac

@@ -24,10 +24,11 @@
  */
 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;
 import java.nio.file.FileSystems;
 import java.nio.file.Files;

@@ -36,11 +37,10 @@
 import javax.script.ScriptException;
 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
  * @run testng jdk.nashorn.internal.runtime.test.CodeStoreAndPathTest
  */

@@ -111,11 +111,12 @@
                             "nashorn.persistent.code.cache")).toAbsolutePath();
         // Check that nashorn code cache is created in current working directory
         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!");
     }
 
     @Test
     public void changeUserDirTest() throws ScriptException, IOException {

@@ -172,11 +173,11 @@
         for (final String file : files) {
             if (file.endsWith("_opt") == optimistic) {
                 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 {
         int n = numberOfScripts;
         for (@SuppressWarnings("unused") final Path file : stream) {
< prev index next >