changeset 989:3c354c3af1d8

8056050: runExternalJsTest method in test/jdk/nashorn/internal/runtime/ClassFilter.java slows down "ant test" Reviewed-by: attila, jlaskey
author sundar
date Tue, 26 Aug 2014 17:21:17 +0530
parents d81f7c897bdf
children fda747208c6f
files test/src/jdk/nashorn/internal/runtime/ClassFilterTest.java
diffstat 1 files changed, 20 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/test/src/jdk/nashorn/internal/runtime/ClassFilterTest.java	Tue Aug 26 11:45:36 2014 +0200
+++ b/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"},