6877229: more javac tests fail on Windows
authorjjg
Mon, 31 Aug 2009 12:36:26 -0700
changeset 3774 33a6953bed15
parent 3773 054ea6d9111b
child 3775 805c58e05571
6877229: more javac tests fail on Windows Reviewed-by: darcy
langtools/test/tools/javac/6589361/T6589361.java
langtools/test/tools/javac/MissingInclude.sh
langtools/test/tools/javac/T5090006/compiler.sh
langtools/test/tools/javac/api/6440333/T6440333.java
langtools/test/tools/javac/api/Sibling.java
langtools/test/tools/javac/code/ArrayClone.java
langtools/test/tools/javac/constDebug/ConstDebug.sh
langtools/test/tools/javac/fatalErrors/NoJavaLang.sh
langtools/test/tools/javac/innerClassFile/Driver.sh
langtools/test/tools/javac/quid/QuotedIdent.java
langtools/test/tools/javac/quid/QuotedIdent2.java
langtools/test/tools/javac/stackmap/T4955930.sh
--- a/langtools/test/tools/javac/6589361/T6589361.java	Fri Aug 28 16:54:10 2009 -0700
+++ b/langtools/test/tools/javac/6589361/T6589361.java	Mon Aug 31 12:36:26 2009 -0700
@@ -23,8 +23,9 @@
             set.add(JavaFileObject.Kind.CLASS);
             Iterable<JavaFileObject> files = fm.list(StandardLocation.PLATFORM_CLASS_PATH, "java.lang", set, false);
             for (JavaFileObject file : files) {
-
-                if (file.toString().contains("java" + File.separator + "lang" + File.separator + "Object.class")) {
+                // Note: Zip/Jar entry names use '/', not File.separator, but just to be sure,
+                // we normalize the filename as well.
+                if (file.toString().replace(File.separatorChar, '/').contains("java/lang/Object.class")) {
                     String str = fm.inferBinaryName(StandardLocation.CLASS_PATH, file);
                     if (!str.equals("java.lang.Object")) {
                         throw new AssertionError("Error in JavacFileManager.inferBinaryName method!");
@@ -40,7 +41,7 @@
                 fm.close();
             }
         }
-        throw new AssertionError("Could not fing java/lang/Object.class while compiling");
+        throw new AssertionError("Could not find java/lang/Object.class while compiling");
     }
 
 }
--- a/langtools/test/tools/javac/MissingInclude.sh	Fri Aug 28 16:54:10 2009 -0700
+++ b/langtools/test/tools/javac/MissingInclude.sh	Mon Aug 31 12:36:26 2009 -0700
@@ -47,14 +47,10 @@
 # set platform-dependent variables
 OS=`uname -s`
 case "$OS" in
-  SunOS | Linux )
-    NULL=/dev/null
-    PS=":"
+  SunOS | Linux | CYGWIN* )
     FS="/"
     ;;
   Windows* )
-    NULL=NUL
-    PS=";"
     FS="\\"
     ;;
   * )
--- a/langtools/test/tools/javac/T5090006/compiler.sh	Fri Aug 28 16:54:10 2009 -0700
+++ b/langtools/test/tools/javac/T5090006/compiler.sh	Mon Aug 31 12:36:26 2009 -0700
@@ -47,14 +47,10 @@
 # set platform-dependent variables
 OS=`uname -s`
 case "$OS" in
-  SunOS | Linux )
-    NULL=/dev/null
-    PS=":"
+  SunOS | Linux | CYGWIN* )
     FS="/"
     ;;
   Windows* )
-    NULL=NUL
-    PS=";"
     FS="\\"
     ;;
   * )
--- a/langtools/test/tools/javac/api/6440333/T6440333.java	Fri Aug 28 16:54:10 2009 -0700
+++ b/langtools/test/tools/javac/api/6440333/T6440333.java	Mon Aug 31 12:36:26 2009 -0700
@@ -26,6 +26,7 @@
  * @bug     6440333
  * @summary SimpleJavaFileObject.toString() generates URI with some extra message
  * @author  Peter von der Ah\u00e9
+ * @ignore 6877223 test ignored because of issues with File.toUri on Windows (6877206)
  * @library ../lib
  * @compile T6440333.java
  * @run main T6440333
@@ -42,6 +43,10 @@
         JavaFileObject fo = fm.getJavaFileObjects(src).iterator().next();
         String expect = src.getCanonicalFile().getPath().replace(File.separatorChar, '/');
         System.err.println("Expect " + expect);
+        // CURRENTLY, the following line fails on Windows because a file C:/w/jjg/...
+        // returns a URI file://C/w/jjg... which incorrectly encodes the drive letter
+        // in the URI authority.   This is against the spec that the authority is
+        // undefined and breaks the contract that new File(f.toURI()).equals(f.getAbsoluteFile())
         System.err.println("Got: " +  fo.toUri().getPath());
         if (!expect.equals(fo.toUri().getPath())) {
             throw new AssertionError();
--- a/langtools/test/tools/javac/api/Sibling.java	Fri Aug 28 16:54:10 2009 -0700
+++ b/langtools/test/tools/javac/api/Sibling.java	Mon Aug 31 12:36:26 2009 -0700
@@ -26,6 +26,7 @@
  * @bug     6399602
  * @summary Verify that files are created relative to sibling
  * @author  Peter von der Ah\u00e9
+ * @ignore 6877223 test ignored because of issues with File.toUri on Windows (6877206)
  */
 
 import java.io.File;
--- a/langtools/test/tools/javac/code/ArrayClone.java	Fri Aug 28 16:54:10 2009 -0700
+++ b/langtools/test/tools/javac/code/ArrayClone.java	Mon Aug 31 12:36:26 2009 -0700
@@ -47,7 +47,7 @@
         String out = sw.toString();
         System.out.println(out);
 
-        for (String line: out.split("\n")) {
+        for (String line: out.split("(\\n|\\r\\n?)")) {
             String match = "[ \t]+[0-9]+:[ \t]+invokevirtual[ \t]+#[0-9]+[ \t]+// Method \"\\[Ljava/lang/String;\".clone:\\(\\)Ljava/lang/Object;";
             if (line.matches(match))
                 return;
--- a/langtools/test/tools/javac/constDebug/ConstDebug.sh	Fri Aug 28 16:54:10 2009 -0700
+++ b/langtools/test/tools/javac/constDebug/ConstDebug.sh	Mon Aug 31 12:36:26 2009 -0700
@@ -48,12 +48,14 @@
 OS=`uname -s`
 case "$OS" in
   SunOS | Linux )
-    NULL=/dev/null
     PS=":"
     FS="/"
     ;;
+  CYGWIN* )
+    PS=";" # Platform PS, not Cygwin PS
+    FS="/"
+    ;;
   Windows* )
-    NULL=NUL
     PS=";"
     FS="\\"
     ;;
@@ -69,7 +71,7 @@
 "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -g -d . -classpath .${PS}${TESTSRC} $1.java 2> ${TMP1}
 result=$?
 if [ $result -ne 0 ]; then exit $result; fi
-if strings $1.class | grep clinit; then
+if "${TESTJAVA}${FS}bin${FS}javap" $1.class | grep clinit; then
   echo "Failed"
   exit 1;
 else
--- a/langtools/test/tools/javac/fatalErrors/NoJavaLang.sh	Fri Aug 28 16:54:10 2009 -0700
+++ b/langtools/test/tools/javac/fatalErrors/NoJavaLang.sh	Mon Aug 31 12:36:26 2009 -0700
@@ -49,13 +49,13 @@
 OS=`uname -s`
 case "$OS" in
   SunOS | Linux )
-    NULL=/dev/null
-    PS=":"
     FS="/"
     ;;
+  CYGWIN* )
+    FS="/"
+    DIFFOPTS="--strip-trailing-cr"
+    ;;
   Windows* )
-    NULL=NUL
-    PS=";"
     FS="\\"
     ;;
   * )
@@ -98,7 +98,7 @@
 
 # expected message
 cat "${TMP1}"
-diff -c "${TESTSRC}${FS}NoJavaLang.out" "${TMP1}"
+diff ${DIFFOPTS} -c "${TESTSRC}${FS}NoJavaLang.out" "${TMP1}"
 result=$?
 rm "${TMP1}"
 
--- a/langtools/test/tools/javac/innerClassFile/Driver.sh	Fri Aug 28 16:54:10 2009 -0700
+++ b/langtools/test/tools/javac/innerClassFile/Driver.sh	Mon Aug 31 12:36:26 2009 -0700
@@ -23,6 +23,12 @@
 # have any questions.
 #
 
+# @test
+# @bug 4491755 4785453
+# @summary Prob w/static inner class with same name as a regular class
+# @author gafter
+#
+# @run shell Driver.sh
 
 if [ "${TESTSRC}" = "" ]
 then
@@ -47,14 +53,10 @@
 # set platform-dependent variables
 OS=`uname -s`
 case "$OS" in
-  SunOS | Linux )
-    NULL=/dev/null
-    PS=":"
+  SunOS | Linux | CYGWIN* )
     FS="/"
     ;;
   Windows* )
-    NULL=NUL
-    PS=";"
     FS="\\"
     ;;
   * )
--- a/langtools/test/tools/javac/quid/QuotedIdent.java	Fri Aug 28 16:54:10 2009 -0700
+++ b/langtools/test/tools/javac/quid/QuotedIdent.java	Mon Aug 31 12:36:26 2009 -0700
@@ -26,6 +26,9 @@
  * @bug 6746458
  * @summary Verify correct lexing of quoted identifiers.
  * @author jrose
+ * @ignore 6877225 test fails on Windows:
+ *      QuotedIdent.java:81: error while writing QuotedIdent.*86: PATH\QuotedIdent$*86.class
+ *      (The filename, directory name, or volume label syntax is incorrect)
  *
  * @library ..
  * @run main quid.QuotedIdent
--- a/langtools/test/tools/javac/quid/QuotedIdent2.java	Fri Aug 28 16:54:10 2009 -0700
+++ b/langtools/test/tools/javac/quid/QuotedIdent2.java	Mon Aug 31 12:36:26 2009 -0700
@@ -26,6 +26,9 @@
  * @bug 6746458
  * @summary Verify correct separate compilation of classes with extended identifiers.
  * @author jrose
+ * @ignore 6877225 test fails on Windows:
+ *      QuotedIdent.java:81: error while writing QuotedIdent.*86: PATH\QuotedIdent$*86.class
+ *      (The filename, directory name, or volume label syntax is incorrect)
  *
  * @library ..
  * @run main quid.QuotedIdent2
--- a/langtools/test/tools/javac/stackmap/T4955930.sh	Fri Aug 28 16:54:10 2009 -0700
+++ b/langtools/test/tools/javac/stackmap/T4955930.sh	Mon Aug 31 12:36:26 2009 -0700
@@ -41,7 +41,7 @@
 # set platform-dependent variables
 OS=`uname -s`
 case "$OS" in
-  SunOS | Linux )
+  SunOS | Linux | CYGWIN* )
     FS="/"
     ;;
   Windows_95 | Windows_98 | Windows_NT )