6941287: 4/4 jrunscriptTest.sh test does not work right under Cygwin
authordcubed
Wed, 21 Jul 2010 16:58:35 -0700
changeset 6118 556743b0d56f
parent 6117 471ae95609d5
child 6119 296bbd35a3f4
6941287: 4/4 jrunscriptTest.sh test does not work right under Cygwin Summary: Add golden_diff variable for doing proper golden file diffs on Cygwin. Reviewed-by: ohair, dholmes
jdk/test/sun/tools/jrunscript/common.sh
jdk/test/sun/tools/jrunscript/jrunscript-eTest.sh
jdk/test/sun/tools/jrunscript/jrunscript-fTest.sh
jdk/test/sun/tools/jrunscript/jrunscriptTest.sh
--- a/jdk/test/sun/tools/jrunscript/common.sh	Wed Jul 21 18:08:46 2010 +0100
+++ b/jdk/test/sun/tools/jrunscript/common.sh	Wed Jul 21 16:58:35 2010 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 2010, Oracle and/or its affiliates. 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
@@ -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
 
--- a/jdk/test/sun/tools/jrunscript/jrunscript-eTest.sh	Wed Jul 21 18:08:46 2010 +0100
+++ b/jdk/test/sun/tools/jrunscript/jrunscript-eTest.sh	Wed Jul 21 16:58:35 2010 -0700
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 #
-# Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 2010, Oracle and/or its affiliates. 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
@@ -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."
--- a/jdk/test/sun/tools/jrunscript/jrunscript-fTest.sh	Wed Jul 21 18:08:46 2010 +0100
+++ b/jdk/test/sun/tools/jrunscript/jrunscript-fTest.sh	Wed Jul 21 16:58:35 2010 -0700
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 #
-# Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 2010, Oracle and/or its affiliates. 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
@@ -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."
--- a/jdk/test/sun/tools/jrunscript/jrunscriptTest.sh	Wed Jul 21 18:08:46 2010 +0100
+++ b/jdk/test/sun/tools/jrunscript/jrunscriptTest.sh	Wed Jul 21 16:58:35 2010 -0700
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 #
-# Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 2010, Oracle and/or its affiliates. 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
@@ -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."