8009140: jtreg tests under sun/tools/jrunscript should use nashorn engine
Reviewed-by: alanb
--- a/jdk/test/sun/tools/jrunscript/CheckEngine.java Wed Feb 27 14:24:45 2013 +0000
+++ b/jdk/test/sun/tools/jrunscript/CheckEngine.java Wed Feb 27 20:34:12 2013 +0530
@@ -33,7 +33,7 @@
public static void main(String... args) {
int exitCode = 0;
ScriptEngine engine =
- (new ScriptEngineManager()).getEngineByName("js");
+ (new ScriptEngineManager()).getEngineByName("nashorn");
if (engine == null &&
!(System.getProperty("java.runtime.name").startsWith("Java(TM)"))) {
--- a/jdk/test/sun/tools/jrunscript/jrunscript-DTest.sh Wed Feb 27 14:24:45 2013 +0000
+++ b/jdk/test/sun/tools/jrunscript/jrunscript-DTest.sh Wed Feb 27 20:34:12 2013 +0530
@@ -43,7 +43,7 @@
# to script as java.lang.System property. sysProps is
# jrunscript shell built-in variable for System properties.
-${JRUNSCRIPT} -Djrunscript.foo=bar <<EOF
+${JRUNSCRIPT} -l nashorn -Djrunscript.foo=bar <<EOF
if (sysProps["jrunscript.foo"] == "bar") { println("Passed"); exit(0); }
// unexpected value
println("Unexpected System property value");
--- a/jdk/test/sun/tools/jrunscript/jrunscript-argsTest.sh Wed Feb 27 14:24:45 2013 +0000
+++ b/jdk/test/sun/tools/jrunscript/jrunscript-argsTest.sh Wed Feb 27 20:34:12 2013 +0530
@@ -41,7 +41,7 @@
# we check whether "excess" args are passed as script arguments
-${JRUNSCRIPT} -J-Djava.awt.headless=true -f - hello world <<EOF
+${JRUNSCRIPT} -l nashorn -J-Djava.awt.headless=true -f - hello world <<EOF
if (typeof(arguments) == 'undefined') { println("arguments expected"); exit(1); }
--- a/jdk/test/sun/tools/jrunscript/jrunscript-cpTest.sh Wed Feb 27 14:24:45 2013 +0000
+++ b/jdk/test/sun/tools/jrunscript/jrunscript-cpTest.sh Wed Feb 27 20:34:12 2013 +0530
@@ -46,7 +46,7 @@
# work with jrunscript. Script should be able to
# access Java class "Hello".
-${JRUNSCRIPT} -cp . <<EOF
+${JRUNSCRIPT} -l nashorn -cp . <<EOF
var v;
try { v = new Packages.Hello(); } catch (e) { println(e); exit(1) }
if (v.string != 'hello') { println("Unexpected property value"); exit(1); }
@@ -58,7 +58,7 @@
# -classpath and -cp are synonyms
-${JRUNSCRIPT} -classpath . <<EOF
+${JRUNSCRIPT} -l nashorn -classpath . <<EOF
var v;
try { v = new Packages.Hello(); } catch (e) { println(e); exit(1) }
if (v.string != 'hello') { println("unexpected property value"); exit(1); }
--- a/jdk/test/sun/tools/jrunscript/jrunscript-eTest.sh Wed Feb 27 14:24:45 2013 +0000
+++ b/jdk/test/sun/tools/jrunscript/jrunscript-eTest.sh Wed Feb 27 20:34:12 2013 +0530
@@ -39,21 +39,10 @@
exit 0
fi
-rm -f jrunscript-eTest.out 2>/dev/null
-${JRUNSCRIPT} -J-Djava.awt.headless=true -e "println('hello')" > jrunscript-eTest.out 2>&1
-
-$golden_diff jrunscript-eTest.out ${TESTSRC}/dash-e.out
-if [ $? != 0 ]
-then
- echo "Output of jrunscript -e differ from expected output. Failed."
- rm -f jrunscript-eTest.out 2>/dev/null
- exit 1
-fi
-
# -e option with JavaScript explicitly choosen as language
rm -f jrunscript-eTest.out 2>/dev/null
-${JRUNSCRIPT} -J-Djava.awt.headless=true -l js -e "println('hello')" > jrunscript-eTest.out 2>&1
+${JRUNSCRIPT} -J-Djava.awt.headless=true -l nashorn -e "println('hello')" > jrunscript-eTest.out 2>&1
$golden_diff jrunscript-eTest.out ${TESTSRC}/dash-e.out
if [ $? != 0 ]
--- a/jdk/test/sun/tools/jrunscript/jrunscript-fTest.sh Wed Feb 27 14:24:45 2013 +0000
+++ b/jdk/test/sun/tools/jrunscript/jrunscript-fTest.sh Wed Feb 27 20:34:12 2013 +0530
@@ -39,22 +39,11 @@
exit 0
fi
-rm -f jrunscript-fTest.out 2>/dev/null
-${JRUNSCRIPT} -J-Djava.awt.headless=true -f ${TESTSRC}/hello.js > jrunscript-fTest.out 2>&1
-
-$golden_diff jrunscript-fTest.out ${TESTSRC}/dash-f.out
-if [ $? != 0 ]
-then
- echo "Output of jrunscript -f differ from expected output. Failed."
- rm -f jrunscript-fTest.out 2>/dev/null
- exit 1
-fi
-
# -f option used with JavaScript as language chosen explicitly
# with -l option
rm -f jrunscript-fTest.out 2>/dev/null
-${JRUNSCRIPT} -J-Djava.awt.headless=true -l js -f ${TESTSRC}/hello.js > jrunscript-fTest.out 2>&1
+${JRUNSCRIPT} -J-Djava.awt.headless=true -l nashorn -f ${TESTSRC}/hello.js > jrunscript-fTest.out 2>&1
$golden_diff jrunscript-fTest.out ${TESTSRC}/dash-f.out
if [ $? != 0 ]
--- a/jdk/test/sun/tools/jrunscript/jrunscriptTest.sh Wed Feb 27 14:24:45 2013 +0000
+++ b/jdk/test/sun/tools/jrunscript/jrunscriptTest.sh Wed Feb 27 20:34:12 2013 +0530
@@ -40,7 +40,7 @@
fi
rm -f jrunscriptTest.out 2>/dev/null
-${JRUNSCRIPT} -J-Djava.awt.headless=true > jrunscriptTest.out 2>&1 <<EOF
+${JRUNSCRIPT} -J-Djava.awt.headless=true -l nashorn > jrunscriptTest.out 2>&1 <<EOF
v = 2 + 5;
v *= 5;
v = v + " is the value";
@@ -52,25 +52,7 @@
$golden_diff jrunscriptTest.out ${TESTSRC}/repl.out
if [ $? != 0 ]
then
- echo "Output of jrunscript session differ from expected output. Failed."
- rm -f jrunscriptTest.out 2>/dev/null
- exit 1
-fi
-
-rm -f jrunscriptTest.out 2>/dev/null
-${JRUNSCRIPT} -J-Djava.awt.headless=true -l js > jrunscriptTest.out 2>&1 <<EOF
-v = 2 + 5;
-v *= 5;
-v = v + " is the value";
-if (v != 0) { println('yes v != 0'); }
-java.lang.System.out.println('hello world from script');
-new java.lang.Runnable() { run: function() { println('I am runnable'); }}.run();
-EOF
-
-$golden_diff jrunscriptTest.out ${TESTSRC}/repl.out
-if [ $? != 0 ]
-then
- echo "Output of jrunscript -l js differ from expected output. Failed."
+ echo "Output of jrunscript -l nashorn differ from expected output. Failed."
rm -f jrunscriptTest.out 2>/dev/null
exit 1
fi
--- a/jdk/test/sun/tools/jrunscript/repl.out Wed Feb 27 14:24:45 2013 +0000
+++ b/jdk/test/sun/tools/jrunscript/repl.out Wed Feb 27 20:34:12 2013 +0530
@@ -1,7 +1,7 @@
-js> 7.0
-js> 35.0
-js> 35 is the value
-js> yes v != 0
-js> hello world from script
-js> I am runnable
-js>
\ No newline at end of file
+nashorn> 7
+nashorn> 35.0
+nashorn> 35 is the value
+nashorn> yes v != 0
+nashorn> hello world from script
+nashorn> I am runnable
+nashorn>
\ No newline at end of file