aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortbell <none@none>2008-08-19 16:05:26 -0700
committertbell <none@none>2008-08-19 16:05:26 -0700
commit572a1fc902e74a00950a687de61b05021a6f2ab9 (patch)
tree1b7f5febf76697917846935740bfe93dad8c8375
parent147a1d803f0ce07c4d1948f47d686ca1514542c4 (diff)
parent0bd406ac9b13482a78cebd88c4e1ecb7ce535ae5 (diff)
Merge
-rw-r--r--test/java/lang/management/ThreadMXBean/Locks.java8
-rw-r--r--test/javax/script/E4XErrorTest.java7
-rw-r--r--test/javax/script/Helper.java41
-rw-r--r--test/javax/script/JavaScriptScopeTest.java7
-rw-r--r--test/javax/script/NullUndefinedVarTest.java7
-rw-r--r--test/javax/script/PluggableContextTest.java8
-rw-r--r--test/javax/script/ProviderTest.java5
-rw-r--r--test/javax/script/RhinoExceptionTest.java10
-rw-r--r--test/javax/script/Test1.java7
-rw-r--r--test/javax/script/Test2.java6
-rw-r--r--test/javax/script/Test3.java9
-rw-r--r--test/javax/script/Test4.java8
-rw-r--r--test/javax/script/Test5.java8
-rw-r--r--test/javax/script/Test6.java8
-rw-r--r--test/javax/script/Test7.java8
-rw-r--r--test/javax/script/Test8.java8
-rw-r--r--test/javax/script/VersionTest.java7
-rw-r--r--test/sun/tools/jrunscript/CheckEngine.java45
-rw-r--r--test/sun/tools/jrunscript/common.sh1
-rw-r--r--test/sun/tools/jrunscript/jrunscript-DTest.sh8
-rw-r--r--test/sun/tools/jrunscript/jrunscript-argsTest.sh8
-rw-r--r--test/sun/tools/jrunscript/jrunscript-cpTest.sh8
-rw-r--r--test/sun/tools/jrunscript/jrunscript-eTest.sh8
-rw-r--r--test/sun/tools/jrunscript/jrunscript-fTest.sh8
-rw-r--r--test/sun/tools/jrunscript/jrunscriptTest.sh8
25 files changed, 213 insertions, 43 deletions
diff --git a/test/java/lang/management/ThreadMXBean/Locks.java b/test/java/lang/management/ThreadMXBean/Locks.java
index 9819375d1..cd81d89f3 100644
--- a/test/java/lang/management/ThreadMXBean/Locks.java
+++ b/test/java/lang/management/ThreadMXBean/Locks.java
@@ -197,8 +197,12 @@ public class Locks {
synchronized (ready) {
// wait until WaitingThread about to wait for objC
thrsync.waitForSignal();
- // give chance to enter wait.
- goSleep(100);
+
+ int retryCount = 0;
+ while (waiter.getState() != Thread.State.WAITING
+ && retryCount++ < 500) {
+ goSleep(100);
+ }
checkBlockedObject(waiter, objC, null, Thread.State.WAITING);
synchronized (objC) {
diff --git a/test/javax/script/E4XErrorTest.java b/test/javax/script/E4XErrorTest.java
index 5936fd42e..11aa5f004 100644
--- a/test/javax/script/E4XErrorTest.java
+++ b/test/javax/script/E4XErrorTest.java
@@ -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 class E4XErrorTest {
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
diff --git a/test/javax/script/Helper.java b/test/javax/script/Helper.java
new file mode 100644
index 000000000..8d259cca8
--- /dev/null
+++ b/test/javax/script/Helper.java
@@ -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;
+ }
+}
diff --git a/test/javax/script/JavaScriptScopeTest.java b/test/javax/script/JavaScriptScopeTest.java
index 1bce7b6e0..9793d7a08 100644
--- a/test/javax/script/JavaScriptScopeTest.java
+++ b/test/javax/script/JavaScriptScopeTest.java
@@ -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 class JavaScriptScopeTest {
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
diff --git a/test/javax/script/NullUndefinedVarTest.java b/test/javax/script/NullUndefinedVarTest.java
index b07d5afdf..646009cd6 100644
--- a/test/javax/script/NullUndefinedVarTest.java
+++ b/test/javax/script/NullUndefinedVarTest.java
@@ -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 class NullUndefinedVarTest {
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';" +
diff --git a/test/javax/script/PluggableContextTest.java b/test/javax/script/PluggableContextTest.java
index 1e6f4fa52..eeb2cb008 100644
--- a/test/javax/script/PluggableContextTest.java
+++ b/test/javax/script/PluggableContextTest.java
@@ -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 @@ public class PluggableContextTest {
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);
diff --git a/test/javax/script/ProviderTest.java b/test/javax/script/ProviderTest.java
index 79d6f1661..9cdcccdb2 100644
--- a/test/javax/script/ProviderTest.java
+++ b/test/javax/script/ProviderTest.java
@@ -35,9 +35,10 @@ public class ProviderTest {
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;
}
}
}
diff --git a/test/javax/script/RhinoExceptionTest.java b/test/javax/script/RhinoExceptionTest.java
index 439b947b2..cf52f128a 100644
--- a/test/javax/script/RhinoExceptionTest.java
+++ b/test/javax/script/RhinoExceptionTest.java
@@ -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 class RhinoExceptionTest {
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);");
diff --git a/test/javax/script/Test1.java b/test/javax/script/Test1.java
index fdfdef9bc..ba6bcebdb 100644
--- a/test/javax/script/Test1.java
+++ b/test/javax/script/Test1.java
@@ -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 class Test1 {
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")));
diff --git a/test/javax/script/Test2.java b/test/javax/script/Test2.java
index 0a70eb1b1..7e0eef21c 100644
--- a/test/javax/script/Test2.java
+++ b/test/javax/script/Test2.java
@@ -50,7 +50,11 @@ public class Test2 {
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")));
diff --git a/test/javax/script/Test3.java b/test/javax/script/Test3.java
index 84b610aaa..4c14f4633 100644
--- a/test/javax/script/Test3.java
+++ b/test/javax/script/Test3.java
@@ -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 @@ public class Test3 {
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");
diff --git a/test/javax/script/Test4.java b/test/javax/script/Test4.java
index bae255097..de6754235 100644
--- a/test/javax/script/Test4.java
+++ b/test/javax/script/Test4.java
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 6249843
+ * @bug 6249843 6705893
* @summary Test script functions implementing Java interface
*/
@@ -34,7 +34,11 @@ public class Test4 {
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;
diff --git a/test/javax/script/Test5.java b/test/javax/script/Test5.java
index cf32cff3e..037e82258 100644
--- a/test/javax/script/Test5.java
+++ b/test/javax/script/Test5.java
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 6249843
+ * @bug 6249843 6705893
* @summary Tests engine, global scopes and scope hiding.
*/
@@ -34,7 +34,11 @@ public class Test5 {
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");
diff --git a/test/javax/script/Test6.java b/test/javax/script/Test6.java
index 15bbda1e0..a347dd844 100644
--- a/test/javax/script/Test6.java
+++ b/test/javax/script/Test6.java
@@ -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 class Test6 {
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);
diff --git a/test/javax/script/Test7.java b/test/javax/script/Test7.java
index 9cdd8ac3e..204883456 100644
--- a/test/javax/script/Test7.java
+++ b/test/javax/script/Test7.java
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 6249843
+ * @bug 6249843 6705893
* @summary Tests importPackage and java access in script
*/
@@ -37,7 +37,11 @@ public class Test7 {
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");
diff --git a/test/javax/script/Test8.java b/test/javax/script/Test8.java
index 80f0a6afd..b55f849f2 100644
--- a/test/javax/script/Test8.java
+++ b/test/javax/script/Test8.java
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 6249843
+ * @bug 6249843 6705893
* @summary Test invoking script function or method from Java
*/
@@ -34,7 +34,11 @@ public class Test8 {
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;
diff --git a/test/javax/script/VersionTest.java b/test/javax/script/VersionTest.java
index b4fc2fc76..773a9843f 100644
--- a/test/javax/script/VersionTest.java
+++ b/test/javax/script/VersionTest.java
@@ -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 class VersionTest {
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)) {
diff --git a/test/sun/tools/jrunscript/CheckEngine.java b/test/sun/tools/jrunscript/CheckEngine.java
new file mode 100644
index 000000000..5301fc4fb
--- /dev/null
+++ b/test/sun/tools/jrunscript/CheckEngine.java
@@ -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);
+ }
+}
diff --git a/test/sun/tools/jrunscript/common.sh b/test/sun/tools/jrunscript/common.sh
index cfb6b0137..2f63c7e33 100644
--- a/test/sun/tools/jrunscript/common.sh
+++ b/test/sun/tools/jrunscript/common.sh
@@ -52,4 +52,5 @@ setup() {
JRUNSCRIPT="${TESTJAVA}/bin/jrunscript"
JAVAC="${TESTJAVA}/bin/javac"
+ JAVA="${TESTJAVA}/bin/java"
}
diff --git a/test/sun/tools/jrunscript/jrunscript-DTest.sh b/test/sun/tools/jrunscript/jrunscript-DTest.sh
index 448d4c616..6919493a5 100644
--- a/test/sun/tools/jrunscript/jrunscript-DTest.sh
+++ b/test/sun/tools/jrunscript/jrunscript-DTest.sh
@@ -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
diff --git a/test/sun/tools/jrunscript/jrunscript-argsTest.sh b/test/sun/tools/jrunscript/jrunscript-argsTest.sh
index cdced76c8..4c7282cc8 100644
--- a/test/sun/tools/jrunscript/jrunscript-argsTest.sh
+++ b/test/sun/tools/jrunscript/jrunscript-argsTest.sh
@@ -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
diff --git a/test/sun/tools/jrunscript/jrunscript-cpTest.sh b/test/sun/tools/jrunscript/jrunscript-cpTest.sh
index 599234db8..5f1dde4b1 100644
--- a/test/sun/tools/jrunscript/jrunscript-cpTest.sh
+++ b/test/sun/tools/jrunscript/jrunscript-cpTest.sh
@@ -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 .
diff --git a/test/sun/tools/jrunscript/jrunscript-eTest.sh b/test/sun/tools/jrunscript/jrunscript-eTest.sh
index fb67830cf..52aee2213 100644
--- a/test/sun/tools/jrunscript/jrunscript-eTest.sh
+++ b/test/sun/tools/jrunscript/jrunscript-eTest.sh
@@ -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
diff --git a/test/sun/tools/jrunscript/jrunscript-fTest.sh b/test/sun/tools/jrunscript/jrunscript-fTest.sh
index a5eb5c7d2..3dfe64b21 100644
--- a/test/sun/tools/jrunscript/jrunscript-fTest.sh
+++ b/test/sun/tools/jrunscript/jrunscript-fTest.sh
@@ -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
diff --git a/test/sun/tools/jrunscript/jrunscriptTest.sh b/test/sun/tools/jrunscript/jrunscriptTest.sh
index 0e17b771c..64cd14f58 100644
--- a/test/sun/tools/jrunscript/jrunscriptTest.sh
+++ b/test/sun/tools/jrunscript/jrunscriptTest.sh
@@ -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