8056050: runExternalJsTest method in test/jdk/nashorn/internal/runtime/ClassFilter.java slows down "ant test"
authorsundar
Tue, 26 Aug 2014 17:21:17 +0530
changeset 26247 ec63f6d0eee4
parent 26246 66c7c54fe70c
child 26248 9e9455565f77
8056050: runExternalJsTest method in test/jdk/nashorn/internal/runtime/ClassFilter.java slows down "ant test" Reviewed-by: attila, jlaskey
nashorn/test/src/jdk/nashorn/internal/runtime/ClassFilterTest.java
--- a/nashorn/test/src/jdk/nashorn/internal/runtime/ClassFilterTest.java	Tue Aug 26 11:45:36 2014 +0200
+++ b/nashorn/test/src/jdk/nashorn/internal/runtime/ClassFilterTest.java	Tue Aug 26 17:21:17 2014 +0530
@@ -38,10 +38,15 @@
 import static org.testng.Assert.fail;
 
 public class ClassFilterTest {
+    private static final String NASHORN_CODE_CACHE = "nashorn.persistent.code.cache";
+    private static final String CLASSFILTER_CODE_CACHE = "build/classfilter_nashorn_code_cache";
 
-    private final String codeCache = "build/nashorn_code_cache";
-
-    @Test
+    // @Test
+    // This test takes too much time for basic "ant clean test" run.
+    // Given that "allow-all-java-classes" is equivalent to no java class
+    // filter and external tests don't access any java, not sure if this
+    // test contributes much. We need faster "ant clean test" cycle for
+    // developers.
     public void runExternalJsTest() {
         String[] paths = new String[]{
                 "test/script/basic/compile-octane.js",
@@ -107,7 +112,18 @@
 
     @Test
     public void persistentCacheTest() {
-        System.setProperty("nashorn.persistent.code.cache", codeCache);
+        final String oldCodeCache = System.getProperty(NASHORN_CODE_CACHE);
+        System.setProperty(NASHORN_CODE_CACHE, CLASSFILTER_CODE_CACHE);
+        try {
+            persistentCacheTestImpl();
+        } finally {
+            if (oldCodeCache != null) {
+                System.setProperty(NASHORN_CODE_CACHE, oldCodeCache);
+            }
+        }
+    }
+
+    private void persistentCacheTestImpl() {
         NashornScriptEngineFactory factory = new NashornScriptEngineFactory();
         ScriptEngine engine = factory.getScriptEngine(
                 new String[]{"--persistent-code-cache"},