JDK-6941287 : jrunscriptTest.sh test does not work right under Cygwin
  • Type: Bug
  • Component: core-svc
  • Sub-Component: tools
  • Affected Version: 6,7
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows
  • CPU: generic,x86
  • Submitted: 2010-04-06
  • Updated: 2011-03-23
  • Resolved: 2010-08-11
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7 Other
7 b105Fixed OpenJDK6Fixed
Description
The following SDK/JDK test:

    sun/tools/jrunscript/jrunscriptTest.sh

does not execute properly when run under Cygwin on Windows.

The test fails with the following output:

----------System.out:(13/245)----------
1,3c1,3
< js> 7.0
< js> 35.0
< js> 35 is the value
---
> js> 7.0
> js> 35.0
> js> 35 is the value
5c5
< js> hello world from script
---
> js> hello world from script
Output of jrunscript session differ from expected output. Failed.
----------System.err:(0/0)----------
result: Failed. Execution failed: exit code 1


test result: Failed. Execution failed: exit code 1

Comments
EVALUATION http://hg.openjdk.java.net/jdk6/jdk6/jdk/rev/50002bfcff96
26-07-2010

EVALUATION http://hg.openjdk.java.net/jdk7/tl/jdk/rev/d899526a187a
22-07-2010

SUGGESTED FIX See attached 6941287-webrev-cr0.tgz for the webrev of the proposed fix.
20-07-2010

SUGGESTED FIX Here are the diffs for the fix: diff -r 445b9928fb70 test/sun/tools/jrunscript/common.sh --- a/test/sun/tools/jrunscript/common.sh Sat Feb 06 09:26:57 2010 -0800 +++ b/test/sun/tools/jrunscript/common.sh Tue Apr 06 14:04:45 2010 -0600 @@ -43,10 +43,20 @@ Windows_*) PS=";" FS="\\" + # MKS diff deals with trailing CRs automatically + golden_diff="diff" + ;; + CYGWIN*) + PS=":" + FS="/" + # Cygwin diff needs to be told to ignore trailing CRs + golden_diff="diff --strip-trailing-cr" ;; *) PS=":" FS="/" + # Assume any other platform doesn't have the trailing CR stuff + golden_diff="diff" ;; esac diff -r 445b9928fb70 test/sun/tools/jrunscript/jrunscript-eTest.sh --- a/test/sun/tools/jrunscript/jrunscript-eTest.sh Sat Feb 06 09:26:57 2010 -0800 +++ b/test/sun/tools/jrunscript/jrunscript-eTest.sh Tue Apr 06 14:04:45 2010 -0600 @@ -42,7 +42,7 @@ rm -f jrunscript-eTest.out 2>/dev/null ${JRUNSCRIPT} -e "println('hello')" > jrunscript-eTest.out 2>&1 -diff jrunscript-eTest.out ${TESTSRC}/dash-e.out +$golden_diff jrunscript-eTest.out ${TESTSRC}/dash-e.out if [ $? != 0 ] then echo "Output of jrunscript -e differ from expected output. Failed." @@ -55,7 +55,7 @@ rm -f jrunscript-eTest.out 2>/dev/null ${JRUNSCRIPT} -l js -e "println('hello')" > jrunscript-eTest.out 2>&1 -diff jrunscript-eTest.out ${TESTSRC}/dash-e.out +$golden_diff jrunscript-eTest.out ${TESTSRC}/dash-e.out if [ $? != 0 ] then echo "Output of jrunscript -e differ from expected output. Failed." diff -r 445b9928fb70 test/sun/tools/jrunscript/jrunscript-fTest.sh --- a/test/sun/tools/jrunscript/jrunscript-fTest.sh Sat Feb 06 09:26:57 2010 -0800 +++ b/test/sun/tools/jrunscript/jrunscript-fTest.sh Tue Apr 06 14:04:45 2010 -0600 @@ -42,7 +42,7 @@ rm -f jrunscript-fTest.out 2>/dev/null ${JRUNSCRIPT} -f ${TESTSRC}/hello.js > jrunscript-fTest.out 2>&1 -diff jrunscript-fTest.out ${TESTSRC}/dash-f.out +$golden_diff jrunscript-fTest.out ${TESTSRC}/dash-f.out if [ $? != 0 ] then echo "Output of jrunscript -f differ from expected output. Failed." @@ -56,7 +56,7 @@ rm -f jrunscript-fTest.out 2>/dev/null ${JRUNSCRIPT} -l js -f ${TESTSRC}/hello.js > jrunscript-fTest.out 2>&1 -diff jrunscript-fTest.out ${TESTSRC}/dash-f.out +$golden_diff jrunscript-fTest.out ${TESTSRC}/dash-f.out if [ $? != 0 ] then echo "Output of jrunscript -f differ from expected output. Failed." diff -r 445b9928fb70 test/sun/tools/jrunscript/jrunscriptTest.sh --- a/test/sun/tools/jrunscript/jrunscriptTest.sh Sat Feb 06 09:26:57 2010 -0800 +++ b/test/sun/tools/jrunscript/jrunscriptTest.sh Tue Apr 06 14:04:45 2010 -0600 @@ -49,7 +49,7 @@ new java.lang.Runnable() { run: function() { println('I am runnable'); }}.run(); EOF -diff jrunscriptTest.out ${TESTSRC}/repl.out +$golden_diff jrunscriptTest.out ${TESTSRC}/repl.out if [ $? != 0 ] then echo "Output of jrunscript session differ from expected output. Failed." @@ -67,7 +67,7 @@ new java.lang.Runnable() { run: function() { println('I am runnable'); }}.run(); EOF -diff jrunscriptTest.out ${TESTSRC}/repl.out +$golden_diff jrunscriptTest.out ${TESTSRC}/repl.out if [ $? != 0 ] then echo "Output of jrunscript -l js differ from expected output. Failed." I went ahead and tweaked jrunscript-eTest.sh and jrunscript-fTest.sh to use $golden_diff even though they weren't failing in order to "future proof" them.
06-04-2010

EVALUATION Here is the part of the script that is failing: rm -f jrunscriptTest.out 2>/dev/null ${JRUNSCRIPT} > 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 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 The test is using diff to compare the output generated by jrunscript with a golden file in the source base. When this test is run under Cygwin, the jrunscriptTest.out contains CTRL-M chars at the end of each line. The golden file in the source base does not contain CTRL-M chars. There are two other golden files in this part of the MISC_REGRESSION test suite: dash-e.out and dash-f.out. These golden files are a single line and their related tests are not failing for some reason.
06-04-2010