changeset 496:17527939e5b1

6705893: javax.script tests should not require a js engine on OpenJDK Summary: Fixed the tests to pass with open JDK. Reviewed-by: darcy
author swamyv
date Mon, 18 Aug 2008 15:28:54 -0700
parents e093efae8c5f
children b6f746b0ecc4
files test/javax/script/E4XErrorTest.java test/javax/script/Helper.java test/javax/script/JavaScriptScopeTest.java test/javax/script/NullUndefinedVarTest.java test/javax/script/PluggableContextTest.java test/javax/script/ProviderTest.java test/javax/script/RhinoExceptionTest.java test/javax/script/Test1.java test/javax/script/Test2.java test/javax/script/Test3.java test/javax/script/Test4.java test/javax/script/Test5.java test/javax/script/Test6.java test/javax/script/Test7.java test/javax/script/Test8.java test/javax/script/VersionTest.java test/sun/tools/jrunscript/CheckEngine.java test/sun/tools/jrunscript/common.sh test/sun/tools/jrunscript/jrunscript-DTest.sh test/sun/tools/jrunscript/jrunscript-argsTest.sh test/sun/tools/jrunscript/jrunscript-cpTest.sh test/sun/tools/jrunscript/jrunscript-eTest.sh test/sun/tools/jrunscript/jrunscript-fTest.sh test/sun/tools/jrunscript/jrunscriptTest.sh
diffstat 24 files changed, 207 insertions(+), 41 deletions(-) [+]
line wrap: on
line diff
--- a/test/javax/script/E4XErrorTest.java	Sun Aug 17 17:02:04 2008 -0700
+++ b/test/javax/script/E4XErrorTest.java	Mon Aug 18 15:28:54 2008 -0700
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 6346734
+ * @bug 6346734 6705893
  * @summary We do *not* support E4X (ECMAScript for XML) in our
  * implementation. We want to throw error on XML literals
  * as early as possible rather than at "runtime" - i.e., when
@@ -37,9 +37,10 @@
 
         public static void main(String[] args) throws Exception {
             ScriptEngineManager manager = new ScriptEngineManager();
-            ScriptEngine jsengine = manager.getEngineByName("js");
+            ScriptEngine jsengine = Helper.getJsEngine(manager);
             if (jsengine == null) {
-                throw new RuntimeException("no js engine found");
+                System.out.println("Warning: No js engine found; test vacuously passes.");
+                return;
             }
 
             // The test below depends on the error message content
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/script/Helper.java	Mon Aug 18 15:28:54 2008 -0700
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+import javax.script.*;
+
+/**
+ * Helper class to consolidate testing requirements for a js engine.
+ * A js engine is required as part of Sun's product JDK.
+ */
+public class Helper {
+    private Helper() {}; // Don't instantiate
+
+    public static ScriptEngine getJsEngine(ScriptEngineManager m) {
+        ScriptEngine e  = m.getEngineByName("js");
+        if (e == null &&
+            System.getProperty("java.runtime.name").startsWith("Java(TM)")) {
+            // A js engine is requied for Sun's product JDK
+            throw new RuntimeException("no js engine found");
+        }
+        return e;
+    }
+}
--- a/test/javax/script/JavaScriptScopeTest.java	Sun Aug 17 17:02:04 2008 -0700
+++ b/test/javax/script/JavaScriptScopeTest.java	Mon Aug 18 15:28:54 2008 -0700
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 6346733
+ * @bug 6346733 6705893
  * @summary Verify that independent Bindings instances don't
  * get affected by default scope assignments. Also, verify
  * that script globals can be created and accessed from Java
@@ -36,9 +36,10 @@
 
         public static void main(String[] args) throws Exception {
             ScriptEngineManager manager = new ScriptEngineManager();
-            ScriptEngine jsengine = manager.getEngineByName("js");
+            ScriptEngine jsengine = Helper.getJsEngine(manager);
             if (jsengine == null) {
-                throw new RuntimeException("no js engine found");
+                System.out.println("Warning: No js engine found; test vacuously passes.");
+                return;
             }
             jsengine.eval("var v = 'hello';");
             // Create a new scope
--- a/test/javax/script/NullUndefinedVarTest.java	Sun Aug 17 17:02:04 2008 -0700
+++ b/test/javax/script/NullUndefinedVarTest.java	Mon Aug 18 15:28:54 2008 -0700
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 6346732
+ * @bug 6346732 6705893
  * @summary should be able to assign null and undefined
  * value to JavaScript global variables.
  */
@@ -34,9 +34,10 @@
 
         public static void main(String[] args) throws Exception {
             ScriptEngineManager manager = new ScriptEngineManager();
-            ScriptEngine jsengine = manager.getEngineByName("js");
+            ScriptEngine jsengine = Helper.getJsEngine(manager);
             if (jsengine == null) {
-                throw new RuntimeException("no js engine found");
+                System.out.println("Warning: No js engine found; test vacuously passes.");
+                return;
             }
             jsengine.eval("var n = null; " +
                           "if (n !== null) throw 'expecting null';" +
--- a/test/javax/script/PluggableContextTest.java	Sun Aug 17 17:02:04 2008 -0700
+++ b/test/javax/script/PluggableContextTest.java	Mon Aug 18 15:28:54 2008 -0700
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 6398614
+ * @bug 6398614 6705893
  * @summary Create a user defined ScriptContext and check
  * that script can access variables from non-standard scopes
  */
@@ -35,7 +35,11 @@
         ScriptEngineManager m = new ScriptEngineManager();
         ScriptContext ctx = new MyContext();
         ctx.setAttribute("x", "hello", MyContext.APP_SCOPE);
-        ScriptEngine e = m.getEngineByName("js");
+        ScriptEngine e = Helper.getJsEngine(m);
+        if (e == null) {
+            System.out.println("Warning: No js engine found; test vacuously passes.");
+            return;
+        }
         // the following reference to 'x' throws exception
         // if APP_SCOPE is not searched.
         e.eval("x", ctx);
--- a/test/javax/script/ProviderTest.java	Sun Aug 17 17:02:04 2008 -0700
+++ b/test/javax/script/ProviderTest.java	Mon Aug 18 15:28:54 2008 -0700
@@ -35,9 +35,10 @@
         if (se == null) {
             throw new RuntimeException("can't locate dummy engine");
         }
-        se = manager.getEngineByName("js");
+        se = Helper.getJsEngine(manager);
         if (se == null) {
-            throw new RuntimeException("can't locate JavaScript engine");
+            System.out.println("Warning: No js engine found; test vacuously passes.");
+            return;
         }
     }
 }
--- a/test/javax/script/RhinoExceptionTest.java	Sun Aug 17 17:02:04 2008 -0700
+++ b/test/javax/script/RhinoExceptionTest.java	Mon Aug 18 15:28:54 2008 -0700
@@ -23,8 +23,8 @@
 
 /*
  * @test
- * @bug 6474943
- * @summary Test that Rhion exception messages are
+ * @bug 6474943 6705893
+ * @summary Test that Rhino exception messages are
  * available from ScriptException.
  */
 
@@ -36,7 +36,11 @@
 
     public static void main(String[] args) throws Exception {
         ScriptEngineManager m = new ScriptEngineManager();
-        ScriptEngine engine = m.getEngineByName("js");
+        ScriptEngine engine = Helper.getJsEngine(m);
+        if (engine == null) {
+            System.out.println("Warning: No js engine found; test vacuously passes.");
+            return;
+        }
         engine.put("msg", ERROR_MSG);
         try {
             engine.eval("throw new Error(msg);");
--- a/test/javax/script/Test1.java	Sun Aug 17 17:02:04 2008 -0700
+++ b/test/javax/script/Test1.java	Mon Aug 18 15:28:54 2008 -0700
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 6249843
+ * @bug 6249843 6705893
  * @summary Create JavaScript engine and execute a simple script.
  * Tests script engine discovery mechanism.
  */
@@ -35,9 +35,10 @@
         public static void main(String[] args) throws Exception {
             System.out.println("\nTest1\n");
             ScriptEngineManager manager = new ScriptEngineManager();
-            ScriptEngine jsengine = manager.getEngineByName("js");
+            ScriptEngine jsengine = Helper.getJsEngine(manager);
             if (jsengine == null) {
-                throw new RuntimeException("no js engine found");
+                     System.out.println("Warning: No js engine found; test vacuously passes.");
+                     return;
             }
             jsengine.eval(new FileReader(
                      new File(System.getProperty("test.src", "."), "Test1.js")));
--- a/test/javax/script/Test2.java	Sun Aug 17 17:02:04 2008 -0700
+++ b/test/javax/script/Test2.java	Mon Aug 18 15:28:54 2008 -0700
@@ -50,7 +50,11 @@
         public static void main(String[] args) throws Exception {
             System.out.println("\nTest2\n");
             ScriptEngineManager m = new ScriptEngineManager();
-            ScriptEngine eng = m.getEngineByName("js");
+            ScriptEngine eng = Helper.getJsEngine(m);
+            if (eng == null) {
+                     System.out.println("Warning: No js engine found; test vacuously passes.");
+                     return;
+            }
             eng.put("Testobj", new Testobj("Hello World"));
             eng.eval(new FileReader(
                     new File(System.getProperty("test.src", "."), "Test2.js")));
--- a/test/javax/script/Test3.java	Sun Aug 17 17:02:04 2008 -0700
+++ b/test/javax/script/Test3.java	Mon Aug 18 15:28:54 2008 -0700
@@ -4,6 +4,7 @@
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
+
  * published by the Free Software Foundation.
  *
  * This code is distributed in the hope that it will be useful, but WITHOUT
@@ -23,7 +24,7 @@
 
 /*
  * @test
- * @bug 6249843
+ * @bug 6249843 6705893
  * @summary Test engine and global scopes
  */
 
@@ -37,7 +38,11 @@
             final Reader reader = new FileReader(
                 new File(System.getProperty("test.src", "."), "Test3.js"));
             ScriptEngineManager m = new ScriptEngineManager();
-            final ScriptEngine engine = m.getEngineByName("js");
+            final ScriptEngine engine = Helper.getJsEngine(m);
+            if (engine == null) {
+                System.out.println("Warning: No js engine found; test vacuously passes.");
+                return;
+            }
             Bindings en = new SimpleBindings();
             engine.setBindings(en, ScriptContext.ENGINE_SCOPE);
             en.put("key", "engine value");
--- a/test/javax/script/Test4.java	Sun Aug 17 17:02:04 2008 -0700
+++ b/test/javax/script/Test4.java	Mon Aug 18 15:28:54 2008 -0700
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 6249843
+ * @bug 6249843 6705893
  * @summary Test script functions implementing Java interface
  */
 
@@ -34,7 +34,11 @@
         public static void main(String[] args) throws Exception {
             System.out.println("\nTest4\n");
             ScriptEngineManager m = new ScriptEngineManager();
-            ScriptEngine e  = m.getEngineByName("js");
+            ScriptEngine e  = Helper.getJsEngine(m);
+            if (e == null) {
+                System.out.println("Warning: No js engine found; test vacuously passes.");
+                return;
+            }
             e.eval(new FileReader(
                 new File(System.getProperty("test.src", "."), "Test4.js")));
             Invocable inv = (Invocable)e;
--- a/test/javax/script/Test5.java	Sun Aug 17 17:02:04 2008 -0700
+++ b/test/javax/script/Test5.java	Mon Aug 18 15:28:54 2008 -0700
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 6249843
+ * @bug 6249843 6705893
  * @summary Tests engine, global scopes and scope hiding.
  */
 
@@ -34,7 +34,11 @@
         public static void main(String[] args) throws Exception {
                 System.out.println("\nTest5\n");
                 ScriptEngineManager m = new ScriptEngineManager();
-                ScriptEngine engine = m.getEngineByName("js");
+                ScriptEngine engine = Helper.getJsEngine(m);
+                if (engine == null) {
+                    System.out.println("Warning: No js engine found; test vacuously passes.");
+                    return;
+                }
                 Bindings g = new SimpleBindings();
                 Bindings e = new SimpleBindings();
                 g.put("key", "value in global");
--- a/test/javax/script/Test6.java	Sun Aug 17 17:02:04 2008 -0700
+++ b/test/javax/script/Test6.java	Mon Aug 18 15:28:54 2008 -0700
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 6249843
+ * @bug 6249843 6705893
  * @summary Test basic script compilation. Value eval'ed from
  * compiled and interpreted scripts should be same.
  */
@@ -35,7 +35,11 @@
         public static void main(String[] args) throws Exception {
             System.out.println("\nTest6\n");
             ScriptEngineManager m = new ScriptEngineManager();
-            ScriptEngine engine = m.getEngineByName("js");
+            ScriptEngine engine = Helper.getJsEngine(m);
+            if (engine == null) {
+                System.out.println("Warning: No js engine found; test vacuously passes.");
+                return;
+            }
             Reader reader = new FileReader(
                 new File(System.getProperty("test.src", "."), "Test6.js"));
             engine.eval(reader);
--- a/test/javax/script/Test7.java	Sun Aug 17 17:02:04 2008 -0700
+++ b/test/javax/script/Test7.java	Mon Aug 18 15:28:54 2008 -0700
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 6249843
+ * @bug 6249843 6705893
  * @summary Tests importPackage and java access in script
  */
 
@@ -37,7 +37,11 @@
                 new File(System.getProperty("test.src", "."), "Test7.js");
             Reader r = new FileReader(file);
             ScriptEngineManager m = new ScriptEngineManager();
-            ScriptEngine eng = m.getEngineByName("js");
+            ScriptEngine eng = Helper.getJsEngine(m);
+            if (eng == null) {
+                System.out.println("Warning: No js engine found; test vacuously passes.");
+                return;
+            }
             eng.put("filename", file.getAbsolutePath());
             eng.eval(r);
             String str = (String)eng.get("firstLine");
--- a/test/javax/script/Test8.java	Sun Aug 17 17:02:04 2008 -0700
+++ b/test/javax/script/Test8.java	Mon Aug 18 15:28:54 2008 -0700
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 6249843
+ * @bug 6249843 6705893
  * @summary Test invoking script function or method from Java
  */
 
@@ -34,7 +34,11 @@
         public static void main(String[] args) throws Exception {
             System.out.println("\nTest8\n");
             ScriptEngineManager m = new ScriptEngineManager();
-            ScriptEngine e  = m.getEngineByName("js");
+            ScriptEngine e  = Helper.getJsEngine(m);
+            if (e == null) {
+                System.out.println("Warning: No js engine found; test vacuously passes.");
+                return;
+            }
             e.eval(new FileReader(
                 new File(System.getProperty("test.src", "."), "Test8.js")));
             Invocable inv = (Invocable)e;
--- a/test/javax/script/VersionTest.java	Sun Aug 17 17:02:04 2008 -0700
+++ b/test/javax/script/VersionTest.java	Mon Aug 18 15:28:54 2008 -0700
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 6346729
+ * @bug 6346729 6705893
  * @summary Create JavaScript engine and check language and engine version
  */
 
@@ -37,9 +37,10 @@
 
         public static void main(String[] args) throws Exception {
             ScriptEngineManager manager = new ScriptEngineManager();
-            ScriptEngine jsengine = manager.getEngineByName("js");
+            ScriptEngine jsengine = Helper.getJsEngine(manager);
             if (jsengine == null) {
-                throw new RuntimeException("no js engine found");
+                System.out.println("Warning: No js engine found; test vacuously passes.");
+                return;
             }
             String langVersion = jsengine.getFactory().getLanguageVersion();
             if (! langVersion.equals(JS_LANG_VERSION)) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/sun/tools/jrunscript/CheckEngine.java	Mon Aug 18 15:28:54 2008 -0700
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+import javax.script.*;
+
+/*
+ * If the JDK being tested is <b>not</b> a Sun product JDK and a js
+ * engine is not present, return an exit code of 2 to indicate that
+ * the jrunscript tests which assume a js engine can be vacuously
+ * passed.
+ */
+public class CheckEngine {
+    public static void main(String... args) {
+        int exitCode = 0;
+        ScriptEngine engine =
+            (new ScriptEngineManager()).getEngineByName("js");
+
+        if (engine == null &&
+            !(System.getProperty("java.runtime.name").startsWith("Java(TM)"))) {
+            exitCode = 2;
+        }
+
+        System.exit(exitCode);
+    }
+}
--- a/test/sun/tools/jrunscript/common.sh	Sun Aug 17 17:02:04 2008 -0700
+++ b/test/sun/tools/jrunscript/common.sh	Mon Aug 18 15:28:54 2008 -0700
@@ -52,4 +52,5 @@
 
     JRUNSCRIPT="${TESTJAVA}/bin/jrunscript"
     JAVAC="${TESTJAVA}/bin/javac"
+    JAVA="${TESTJAVA}/bin/java"
 }
--- a/test/sun/tools/jrunscript/jrunscript-DTest.sh	Sun Aug 17 17:02:04 2008 -0700
+++ b/test/sun/tools/jrunscript/jrunscript-DTest.sh	Mon Aug 18 15:28:54 2008 -0700
@@ -25,13 +25,19 @@
 
 
 # @test
-# @bug 6265810
+# @bug 6265810 6705893
+# @build CheckEngine
 # @run shell jrunscript-DTest.sh
 # @summary Test that output of 'jrunscript -D' 
 
 . ${TESTSRC-.}/common.sh
 
 setup
+${JAVA} -cp ${TESTCLASSES} CheckEngine
+if [ $? -eq 2 ]; then
+    echo "No js engine found and engine not required; test vacuously passes."
+    exit 0
+fi
 
 # test whether value specifieD by -D option is passed
 # to script as java.lang.System property.  sysProps is
--- a/test/sun/tools/jrunscript/jrunscript-argsTest.sh	Sun Aug 17 17:02:04 2008 -0700
+++ b/test/sun/tools/jrunscript/jrunscript-argsTest.sh	Mon Aug 18 15:28:54 2008 -0700
@@ -25,13 +25,19 @@
 
 
 # @test
-# @bug 6265810
+# @bug 6265810 6705893
+# @build CheckEngine
 # @run shell jrunscript-argsTest.sh
 # @summary Test passing of script arguments from command line
 
 . ${TESTSRC-.}/common.sh
 
 setup
+${JAVA} -cp ${TESTCLASSES} CheckEngine
+if [ $? -eq 2 ]; then
+    echo "No js engine found and engine not required; test vacuously passes."
+    exit 0
+fi
 
 # we check whether "excess" args are passed as script arguments
 
--- a/test/sun/tools/jrunscript/jrunscript-cpTest.sh	Sun Aug 17 17:02:04 2008 -0700
+++ b/test/sun/tools/jrunscript/jrunscript-cpTest.sh	Mon Aug 18 15:28:54 2008 -0700
@@ -25,13 +25,19 @@
 
 
 # @test
-# @bug 6265810
+# @bug 6265810 6705893
+# @build CheckEngine
 # @run shell jrunscript-cpTest.sh
 # @summary Test -cp option to set classpath
 
 . ${TESTSRC-.}/common.sh
 
 setup
+${JAVA} -cp ${TESTCLASSES} CheckEngine
+if [ $? -eq 2 ]; then
+    echo "No js engine found and engine not required; test vacuously passes."
+    exit 0
+fi
 
 rm -f Hello.class
 ${JAVAC} ${TESTSRC}/Hello.java -d .
--- a/test/sun/tools/jrunscript/jrunscript-eTest.sh	Sun Aug 17 17:02:04 2008 -0700
+++ b/test/sun/tools/jrunscript/jrunscript-eTest.sh	Mon Aug 18 15:28:54 2008 -0700
@@ -25,13 +25,19 @@
 
 
 # @test
-# @bug 6265810
+# @bug 6265810 6705893
+# @build CheckEngine
 # @run shell jrunscript-eTest.sh
 # @summary Test that output of 'jrunscript -e' matches the dash-e.out file
 
 . ${TESTSRC-.}/common.sh
 
 setup
+${JAVA} -cp ${TESTCLASSES} CheckEngine
+if [ $? -eq 2 ]; then
+    echo "No js engine found and engine not required; test vacuously passes."
+    exit 0
+fi
 
 rm -f jrunscript-eTest.out 2>/dev/null
 ${JRUNSCRIPT} -e "println('hello')" > jrunscript-eTest.out 2>&1
--- a/test/sun/tools/jrunscript/jrunscript-fTest.sh	Sun Aug 17 17:02:04 2008 -0700
+++ b/test/sun/tools/jrunscript/jrunscript-fTest.sh	Mon Aug 18 15:28:54 2008 -0700
@@ -25,13 +25,19 @@
 
 
 # @test
-# @bug 6265810
+# @bug 6265810 6705893
+# @build CheckEngine
 # @run shell jrunscript-fTest.sh
 # @summary Test that output of 'jrunscript -f' matches the dash-f.out file
 
 . ${TESTSRC-.}/common.sh
 
 setup
+${JAVA} -cp ${TESTCLASSES} CheckEngine
+if [ $? -eq 2 ]; then
+    echo "No js engine found and engine not required; test vacuously passes."
+    exit 0
+fi
 
 rm -f jrunscript-fTest.out 2>/dev/null
 ${JRUNSCRIPT} -f ${TESTSRC}/hello.js > jrunscript-fTest.out 2>&1
--- a/test/sun/tools/jrunscript/jrunscriptTest.sh	Sun Aug 17 17:02:04 2008 -0700
+++ b/test/sun/tools/jrunscript/jrunscriptTest.sh	Mon Aug 18 15:28:54 2008 -0700
@@ -25,13 +25,19 @@
 
 
 # @test
-# @bug 6265810
+# @bug 6265810 6705893
+# @build CheckEngine
 # @run shell jrunscriptTest.sh
 # @summary Test that output of 'jrunscript' interactive matches the repl.out file
 
 . ${TESTSRC-.}/common.sh
 
 setup
+${JAVA} -cp ${TESTCLASSES} CheckEngine
+if [ $? -eq 2 ]; then
+    echo "No js engine found and engine not required; test vacuously passes."
+    exit 0
+fi
 
 rm -f jrunscriptTest.out 2>/dev/null
 ${JRUNSCRIPT} > jrunscriptTest.out 2>&1 <<EOF