8008582: jtreg failures after conversion of shell tests to Java
authorvromero
Thu, 14 Mar 2013 08:30:16 +0000
changeset 16549 1bdeedb5446c
parent 16548 d55a654e2751
child 16550 f20e2521f3df
8008582: jtreg failures after conversion of shell tests to Java Reviewed-by: jjg
langtools/src/share/classes/com/sun/tools/javac/util/ArrayUtils.java
langtools/test/tools/javac/4846262/CheckEBCDICLocaleTest.java
langtools/test/tools/javac/ClassPathTest/ClassPathTest.java
langtools/test/tools/javac/ProtectedInnerClass/ProtectedInnerClassesTest.java
langtools/test/tools/javac/lib/ToolBox.java
langtools/test/tools/javac/links/LinksTest.java
langtools/test/tools/javac/newlines/NewLineTest.java
langtools/test/tools/javah/6257087/T6257087.java
langtools/test/tools/javah/constMacroTest/ConstMacroTest.java
langtools/test/tools/javap/stackmap/StackmapTest.java
--- a/langtools/src/share/classes/com/sun/tools/javac/util/ArrayUtils.java	Thu Mar 14 01:45:44 2013 -0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/ArrayUtils.java	Thu Mar 14 08:30:16 2013 +0000
@@ -85,17 +85,4 @@
         }
     }
 
-    public static <T> T[] concat(T[] anArr, T[] anotherArr) {
-        int newLength = anArr.length + anotherArr.length;
-        @SuppressWarnings("unchecked")
-        T[] result = (T[]) Array.newInstance(anArr.getClass().getComponentType(), newLength);
-        System.arraycopy(anArr, 0, result, 0, anArr.length);
-        System.arraycopy(anotherArr, 0, result, anArr.length, anotherArr.length);
-        return result;
-    }
-
-    @SuppressWarnings("unchecked")
-    public static <T> T[] concatOpen(T[] anArr, T... anotherArr) {
-        return concat(anArr, anotherArr);
-    }
 }
--- a/langtools/test/tools/javac/4846262/CheckEBCDICLocaleTest.java	Thu Mar 14 01:45:44 2013 -0400
+++ b/langtools/test/tools/javac/4846262/CheckEBCDICLocaleTest.java	Thu Mar 14 08:30:16 2013 +0000
@@ -34,9 +34,7 @@
 import java.nio.file.Files;
 import java.nio.file.Paths;
 import java.util.Arrays;
-import com.sun.tools.javac.util.ArrayUtils;
 
-//original test: test/tools/javac/4846262/Test.sh
 public class CheckEBCDICLocaleTest {
 
     private static final String TestSrc =
@@ -46,11 +44,11 @@
         "    }\n" +
         "}";
 
-    private static final String TestOut =
-        "output/Test.java:3: error: not a statement\n" +
+    private static final String TestOutTemplate =
+        "output%1$sTest.java:3: error: not a statement\n" +
         "        abcdefg\n" +
         "        ^\n" +
-        "output/Test.java:3: error: ';' expected\n" +
+        "output%1$sTest.java:3: error: ';' expected\n" +
         "        abcdefg\n" +
         "               ^\n" +
         "2 errors\n";
@@ -62,38 +60,37 @@
     public void test() throws Exception {
         String native2asciiBinary = Paths.get(
                 System.getProperty("test.jdk"),"bin", "native2ascii").toString();
-        String testVMOpts = System.getProperty("test.tool.vm.opts");
-        String[] mainArgs = ToolBox.getJavacBin();
 
         ToolBox.createJavaFileFromSource(TestSrc);
         Files.createDirectory(Paths.get("output"));
 
-//"${TESTJAVA}${FS}bin${FS}native2ascii" ${TESTTOOLVMOPTS} -reverse -encoding IBM1047 ${TESTSRC}${FS}Test.java Test.java
         ToolBox.AnyToolArgs nativeCmdParams =
                 new ToolBox.AnyToolArgs()
-                .setAllArgs(native2asciiBinary, testVMOpts,
-                    "-reverse", "-encoding", "IBM1047",
-                    "Test.java", "output/Test.java");
+                .appendArgs(native2asciiBinary)
+                .appendArgs(ToolBox.testToolVMOpts)
+                .appendArgs("-reverse", "-encoding", "IBM1047", "Test.java",
+                "output/Test.java");
         ToolBox.executeCommand(nativeCmdParams);
 
-//"${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -J-Duser.language=en -J-Duser.region=US -J-Dfile.encoding=IBM1047 Test.java 2>Test.tmp
         ToolBox.AnyToolArgs javacParams =
                 new ToolBox.AnyToolArgs(ToolBox.Expect.FAIL)
-                .setAllArgs(ArrayUtils.concatOpen(mainArgs, "-J-Duser.language=en",
+                .appendArgs(ToolBox.javacBinary)
+                .appendArgs(ToolBox.testToolVMOpts)
+                .appendArgs("-J-Duser.language=en",
                 "-J-Duser.region=US", "-J-Dfile.encoding=IBM1047",
-                "output/Test.java"))
+                "output/Test.java")
                 .setErrOutput(new File("Test.tmp"));
         ToolBox.executeCommand(javacParams);
 
-//"${TESTJAVA}${FS}bin${FS}native2ascii" ${TESTTOOLVMOPTS} -encoding IBM1047 Test.tmp Test.out
-        nativeCmdParams.setAllArgs(native2asciiBinary, "-encoding", "IBM1047",
-                    "Test.tmp", "Test.out");
+        nativeCmdParams = new ToolBox.AnyToolArgs()
+                .appendArgs(native2asciiBinary)
+                .appendArgs(ToolBox.testToolVMOpts)
+                .appendArgs("-encoding", "IBM1047", "Test.tmp", "Test.out");
         ToolBox.executeCommand(nativeCmdParams);
 
-//diff ${DIFFOPTS} -c "${TESTSRC}${FS}Test.out" Test.out
+        String goldenFile = String.format(TestOutTemplate, File.separator);
         ToolBox.compareLines(Paths.get("Test.out"),
-                Arrays.asList(TestOut.split("\n")), null);
-
+                Arrays.asList(goldenFile.split("\n")), null, true);
     }
 
 }
--- a/langtools/test/tools/javac/ClassPathTest/ClassPathTest.java	Thu Mar 14 01:45:44 2013 -0400
+++ b/langtools/test/tools/javac/ClassPathTest/ClassPathTest.java	Thu Mar 14 08:30:16 2013 +0000
@@ -31,9 +31,11 @@
  */
 
 import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
 import java.util.Map;
 import java.util.TreeMap;
-import com.sun.tools.javac.util.ArrayUtils;
 
 //original test: test/tools/javac/ClassPathTest/ClassPathTest.sh
 public class ClassPathTest {
@@ -92,24 +94,31 @@
     }
 
     void checkCompileCommands() throws Exception {
-        String[] mainArgs = ToolBox.getJavacBin();
-
 //        Without the -cp . parameter the command will fail seems like when called
 //        from the command line, the current dir is added to the classpath
 //        automatically but this is not happening when called using ProcessBuilder
 
 //        testJavac success ClassPathTest3.java
-        String[] commonArgs = ArrayUtils.concatOpen(mainArgs, "-cp", ".");
+        List<String> mainArgs = new ArrayList<>();
+        mainArgs.add(ToolBox.javacBinary.toString());
+        if (ToolBox.testToolVMOpts != null) {
+            mainArgs.addAll(ToolBox.testToolVMOpts);
+        }
 
-        ToolBox.AnyToolArgs successParams =
-                new ToolBox.AnyToolArgs()
-                .setAllArgs(ArrayUtils.concatOpen(commonArgs, "ClassPathTest3.java"));
+        List<String> commonArgs = new ArrayList<>();
+        commonArgs.addAll(mainArgs);
+        commonArgs.addAll(Arrays.asList("-cp", "."));
+
+        ToolBox.AnyToolArgs successParams = new ToolBox.AnyToolArgs()
+                .appendArgs(commonArgs)
+                .appendArgs("ClassPathTest3.java");
         ToolBox.executeCommand(successParams);
 
 //        testJavac failure ClassPathTest1.java
         ToolBox.AnyToolArgs failParams =
                 new ToolBox.AnyToolArgs(ToolBox.Expect.FAIL)
-                .setAllArgs(ArrayUtils.concatOpen(commonArgs, "ClassPathTest1.java"));
+                .appendArgs(commonArgs)
+                .appendArgs("ClassPathTest1.java");
         ToolBox.executeCommand(failParams);
 
 //        This is done inside the executeCommand method
@@ -119,29 +128,50 @@
         extVars.put("CLASSPATH", "bar");
 
 //        testJavac success ClassPathTest2.java
-        successParams.setAllArgs(ArrayUtils.concatOpen(mainArgs, "ClassPathTest2.java")).set(extVars);
+        successParams = new ToolBox.AnyToolArgs()
+                .appendArgs(mainArgs)
+                .appendArgs("ClassPathTest2.java")
+                .set(extVars);
         ToolBox.executeCommand(successParams);
 
 //        testJavac failure ClassPathTest1.java
-        failParams.setAllArgs(ArrayUtils.concatOpen(mainArgs, "ClassPathTest1.java")).set(extVars);
+        failParams = new ToolBox.AnyToolArgs(ToolBox.Expect.FAIL)
+                .appendArgs(mainArgs)
+                .appendArgs("ClassPathTest1.java")
+                .set(extVars);
         ToolBox.executeCommand(failParams);
 
 //        testJavac failure ClassPathTest3.java
-        failParams.setAllArgs(ArrayUtils.concatOpen(mainArgs, "ClassPathTest3.java"));
+        failParams = new ToolBox.AnyToolArgs(ToolBox.Expect.FAIL)
+                .appendArgs(mainArgs)
+                .appendArgs("ClassPathTest3.java")
+                .set(extVars);
         ToolBox.executeCommand(failParams);
 
 //        testJavac success -classpath foo ClassPathTest1.java
 
-        commonArgs = ArrayUtils.concatOpen(mainArgs, "-cp", "foo");
-        successParams.setAllArgs(ArrayUtils.concatOpen(commonArgs, "ClassPathTest1.java"));
+        commonArgs.clear();
+        commonArgs.addAll(mainArgs);
+        commonArgs.addAll(Arrays.asList("-cp", "foo"));
+
+        successParams = new ToolBox.AnyToolArgs()
+                .appendArgs(commonArgs)
+                .appendArgs("ClassPathTest1.java")
+                .set(extVars);
         ToolBox.executeCommand(successParams);
 
 //        testJavac failure -classpath foo ClassPathTest2.java
-        failParams.setAllArgs(ArrayUtils.concatOpen(commonArgs, "ClassPathTest2.java"));
+        failParams = new ToolBox.AnyToolArgs(ToolBox.Expect.FAIL)
+                .appendArgs(commonArgs)
+                .appendArgs("ClassPathTest2.java")
+                .set(extVars);
         ToolBox.executeCommand(failParams);
 
 //        testJavac failure -classpath foo ClassPathTest3.java
-        failParams.setAllArgs(ArrayUtils.concatOpen(commonArgs, "ClassPathTest3.java"));
+        failParams = new ToolBox.AnyToolArgs(ToolBox.Expect.FAIL)
+                .appendArgs(commonArgs)
+                .appendArgs("ClassPathTest3.java")
+                .set(extVars);
         ToolBox.executeCommand(failParams);
     }
 
--- a/langtools/test/tools/javac/ProtectedInnerClass/ProtectedInnerClassesTest.java	Thu Mar 14 01:45:44 2013 -0400
+++ b/langtools/test/tools/javac/ProtectedInnerClass/ProtectedInnerClassesTest.java	Thu Mar 14 08:30:16 2013 +0000
@@ -91,7 +91,9 @@
 //"${TESTJAVA}${FS}bin${FS}java" ${TESTVMOPTS} -classpath "${CLASSPATH}${PS}${TESTCLASSES}" p2.ProtectedInnerClass2
         ToolBox.AnyToolArgs javaParams =
                 new ToolBox.AnyToolArgs()
-                .setAllArgs(ToolBox.javaBinary, "-classpath", System.getProperty("user.dir"),
+                .appendArgs(ToolBox.javaBinary)
+                .appendArgs(ToolBox.testVMOpts)
+                .appendArgs("-classpath", System.getProperty("user.dir"),
                     "p2.ProtectedInnerClass2");
         ToolBox.executeCommand(javaParams);
     }
@@ -101,14 +103,15 @@
 //@run compile p1/ProtectedInnerClass1.java
         ToolBox.JavaToolArgs javacParams =
                 new ToolBox.JavaToolArgs()
-                .setOptions("-d", ".")
+                .appendArgs("-d", ".")
                 .setSources(protectedInnerClass1Src);
 
         ToolBox.javac(javacParams);
 
 //@run compile/fail p2/ProtectedInnerClass3.java
-        javacParams.setSources(protectedInnerClass3Src)
-                .set(ToolBox.Expect.FAIL);
+        javacParams = new ToolBox.JavaToolArgs(ToolBox.Expect.FAIL)
+                .appendArgs("-d", ".")
+                .setSources(protectedInnerClass3Src);
         ToolBox.javac(javacParams);
     }
 
--- a/langtools/test/tools/javac/lib/ToolBox.java	Thu Mar 14 01:45:44 2013 -0400
+++ b/langtools/test/tools/javac/lib/ToolBox.java	Thu Mar 14 08:30:16 2013 +0000
@@ -38,6 +38,7 @@
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.EnumSet;
 import java.util.List;
 import java.util.Map;
@@ -65,15 +66,32 @@
 
     public static final String lineSeparator = System.getProperty("line.separator");
     public static final String jdkUnderTest = System.getProperty("test.jdk");
-    public static final String testVMOpts = System.getProperty("test.tool.vm.opts");
-    public static final String javaBinary = Paths.get(jdkUnderTest, "bin", "java").toString();
-    //why this one private. Because the function which provide also the test options should be used
-    private static final String javacBinary = Paths.get(jdkUnderTest, "bin", "javac").toString();
+    public static final Path javaBinary = Paths.get(jdkUnderTest, "bin", "java");
+    public static final Path javacBinary = Paths.get(jdkUnderTest, "bin", "javac");
+
+    public static final List<String> testToolVMOpts;
+    public static final List<String> testVMOpts;
 
     private static final Charset defaultCharset = Charset.defaultCharset();
 
     static final JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
 
+    static {
+        String sysProp = System.getProperty("test.tool.vm.opts");
+        if (sysProp != null && sysProp.length() > 0) {
+            testToolVMOpts = Arrays.asList(sysProp.split("\\s+"));
+        } else {
+            testToolVMOpts = Collections.<String>emptyList();
+        }
+
+        sysProp = System.getProperty("test.vm.opts");
+        if (sysProp != null && sysProp.length() > 0) {
+            testVMOpts = Arrays.asList(sysProp.split("\\s+"));
+        } else {
+            testVMOpts = Collections.<String>emptyList();
+        }
+    }
+
     /**
      * The expected result of command-like method execution.
      */
@@ -199,8 +217,8 @@
         protected Expect whatToExpect;
         protected WriterHelper stdOutput;
         protected WriterHelper errOutput;
-        protected List<String> options;
-        protected String[] optionsArr;
+        protected List<String> args = new ArrayList<>();
+        protected String[] argsArr;
 
         protected GenericArgs() {
             set(Expect.SUCCESS);
@@ -238,19 +256,50 @@
 
         public T setAllArgs(String... args) {
             currentParams.add(AcceptedParams.OPTIONS);
-            this.optionsArr = args;
+            this.argsArr = args;
+            return (T) this;
+        }
+
+
+        public T appendArgs(String... args) {
+            appendArgs(Arrays.asList(args));
+            return (T)this;
+        }
+
+        public T appendArgs(Path... args) {
+            if (args != null) {
+                List<String> list = new ArrayList<>();
+                for (int i = 0; i < args.length; i++) {
+                    if (args[i] != null) {
+                        list.add(args[i].toString());
+                    }
+                }
+                appendArgs(list);
+            }
+            return (T)this;
+        }
+
+        public T appendArgs(List<String> args) {
+            if (args != null && args.size() > 0) {
+                currentParams.add(AcceptedParams.OPTIONS);
+                for (int i = 0; i < args.size(); i++) {
+                    if (args.get(i) != null) {
+                        this.args.add(args.get(i));
+                    }
+                }
+            }
             return (T)this;
         }
 
         public T setOptions(List<String> options) {
             currentParams.add(AcceptedParams.OPTIONS);
-            this.options = options;
+            this.args = options;
             return (T)this;
         }
 
         public T setOptions(String... options) {
             currentParams.add(AcceptedParams.OPTIONS);
-            this.options = Arrays.asList(options);
+            this.args = Arrays.asList(options);
             return (T)this;
         }
 
@@ -365,8 +414,12 @@
      * Custom exception for not equal resources.
      */
     public static class ResourcesNotEqualException extends Exception {
-        public ResourcesNotEqualException() {
-            super("The resources provided for comparison are different");
+        public ResourcesNotEqualException(List<String> res1, List<String> res2) {
+            super(createMessage(res1, res2));
+        }
+
+        public ResourcesNotEqualException(String line1, String line2) {
+            super(createMessage(line1, line2));
         }
 
         public ResourcesNotEqualException(Path path1, Path path2) {
@@ -379,15 +432,20 @@
                     .append(path1.toString()).append(" and \n")
                     .append(path2.toString()).append("are different").toString();
         }
-    }
 
-    /**
-     * Method to get the a path to the javac command available at the jdk being
-     * tested along with the test vm options.
-     * @return a String[] with the two components mentioned.
-     */
-    public static String[] getJavacBin() {
-        return new String[]{javacBinary, testVMOpts};
+        private static String createMessage(String line1, String line2) {
+            return new StringBuilder()
+                    .append("The resources provided for comparison are different at lines: \n")
+                    .append(line1).append(" and \n")
+                    .append(line2).toString();
+        }
+
+        private static String createMessage(List<String> res1, List<String> res2) {
+            return new StringBuilder()
+                    .append("The resources provided for comparison are different: \n")
+                    .append("Resource 1 is: ").append(res1).append("\n and \n")
+                    .append("Resource 2 is: ").append(res2).append("\n").toString();
+        }
     }
 
     /**
@@ -396,7 +454,7 @@
     public static int javac(JavaToolArgs params)
             throws CommandExecutionException, IOException {
         if (params.hasMinParams()) {
-            if (params.optionsArr != null) {
+            if (params.argsArr != null) {
                 return genericJavaCMD(JavaCMD.JAVAC, params);
             } else {
                 return genericJavaCMD(JavaCMD.JAVAC_API, params);
@@ -437,14 +495,14 @@
         JAVAC {
             @Override
             int run(JavaToolArgs params, PrintWriter pw) {
-                return com.sun.tools.javac.Main.compile(params.optionsArr, pw);
+                return com.sun.tools.javac.Main.compile(params.argsArr, pw);
             }
         },
         JAVAC_API {
             @Override
             int run(JavaToolArgs params, PrintWriter pw) {
                 JavacTask ct = (JavacTask)comp.getTask(pw, null, null,
-                        params.options, null, params.sources);
+                        params.args, null, params.sources);
                 return ((JavacTaskImpl)ct).doCall().exitCode;
             }
 
@@ -467,13 +525,13 @@
         JAVAH {
             @Override
             int run(JavaToolArgs params, PrintWriter pw) {
-                return com.sun.tools.javah.Main.run(params.optionsArr, pw);
+                return com.sun.tools.javah.Main.run(params.argsArr, pw);
             }
         },
         JAVAP {
             @Override
             int run(JavaToolArgs params, PrintWriter pw) {
-                return com.sun.tools.javap.Main.run(params.optionsArr, pw);
+                return com.sun.tools.javap.Main.run(params.argsArr, pw);
             }
         };
 
@@ -486,9 +544,9 @@
         List<String> getExceptionMsgContent(JavaToolArgs params) {
             List<String> result = new ArrayList<>();
             result.add(getName());
-            result.addAll(params.optionsArr != null ?
-                    Arrays.asList(params.optionsArr) :
-                    params.options);
+            result.addAll(params.argsArr != null ?
+                    Arrays.asList(params.argsArr) :
+                    params.args);
             return result;
         }
     }
@@ -509,7 +567,7 @@
         String out = (sw == null) ? null : sw.toString();
 
         if (params.errOutput != null && (out != null) && !out.isEmpty()) {
-            params.errOutput.addAll(splitLines(out));
+            params.errOutput.addAll(splitLines(out, lineSeparator));
         }
 
         if ( (rc == 0 && params.whatToExpect == Expect.SUCCESS) ||
@@ -542,9 +600,9 @@
     public static int executeCommand(AnyToolArgs params)
             throws CommandExecutionException, IOException, InterruptedException {
         if (params.hasMinParams()) {
-            List<String> cmd = (params.options != null) ?
-                    params.options :
-                    Arrays.asList(params.optionsArr);
+            List<String> cmd = (params.args != null) ?
+                    params.args :
+                    Arrays.asList(params.argsArr);
             return executeCommand(cmd, params.extraEnv, params.stdOutput,
                     params.errOutput, params.whatToExpect);
         }
@@ -630,7 +688,7 @@
             List<String> list2, boolean trim) throws ResourcesNotEqualException {
         if ((list1 == list2) || (list1 == null && list2 == null)) return;
         if (list1.size() != list2.size())
-            throw new ResourcesNotEqualException();
+            throw new ResourcesNotEqualException(list1, list2);
         int i = 0;
         int j = 0;
         while (i < list1.size() &&
@@ -639,7 +697,7 @@
             i++; j++;
         }
         if (!(i == list1.size() && j == list2.size()))
-            throw new ResourcesNotEqualException();
+            throw new ResourcesNotEqualException(list1, list2);
     }
 
     private static boolean equals(String s1, String s2, boolean trim) {
@@ -652,8 +710,8 @@
      * and later the regExpr is seek in every split line. If a match is found,
      * the whole line is added to the result.
      */
-    public static List<String> grep(String regExpr, String text) {
-        return grep(regExpr, splitLines(text));
+    public static List<String> grep(String regExpr, String text, String sep) {
+        return grep(regExpr, splitLines(text, sep));
     }
 
     public static List<String> grep(String regExpr, List<String> text) {
@@ -865,8 +923,8 @@
     /**
      * Splits a String using the System's line separator character as splitting point.
      */
-    public static List<String> splitLines(String lines) {
-        return Arrays.asList(lines.split(lineSeparator));
+    public static List<String> splitLines(String lines, String sep) {
+        return Arrays.asList(lines.split(sep));
     }
 
     /**
@@ -882,6 +940,14 @@
     }
 
     /**
+     * Returns true if the OS is a Windows version.
+     */
+    public static boolean isWindows() {
+        String osName = System.getProperty("os.name");
+        return osName.toUpperCase().startsWith("WINDOWS");
+    }
+
+    /**
      * Class representing an in-memory java source file. It is able to extract
      * the file name from simple source codes using regular expressions.
      */
--- a/langtools/test/tools/javac/links/LinksTest.java	Thu Mar 14 01:45:44 2013 -0400
+++ b/langtools/test/tools/javac/links/LinksTest.java	Thu Mar 14 08:30:16 2013 +0000
@@ -50,14 +50,17 @@
 //      cp ${TESTSRC}/b/B.java tmp
         ToolBox.writeFile(Paths.get("tmp", "B.java"), BSrc);
 
+        try {
 //        ln -s `pwd`/tmp "${TESTCLASSES}/a"
-        Files.createSymbolicLink(Paths.get("a"), Paths.get("tmp"));
-//
-////"${TESTJAVA}/bin/javac" ${TESTTOOLVMOPTS} -sourcepath "${TESTCLASSES}" -d "${TESTCLASSES}/classes" "${TESTSRC}/T.java" 2>&1
-        ToolBox.JavaToolArgs javacArgs =
-                new ToolBox.JavaToolArgs()
-                .setOptions("-sourcepath", ".", "-d", ".").setSources(TSrc);
-        ToolBox.javac(javacArgs);
+            Files.createSymbolicLink(Paths.get("a"), Paths.get("tmp"));
+            ////"${TESTJAVA}/bin/javac" ${TESTTOOLVMOPTS} -sourcepath "${TESTCLASSES}" -d "${TESTCLASSES}/classes" "${TESTSRC}/T.java" 2>&1
+            ToolBox.JavaToolArgs javacArgs =
+                    new ToolBox.JavaToolArgs()
+                    .setOptions("-sourcepath", ".", "-d", ".").setSources(TSrc);
+            ToolBox.javac(javacArgs);
+        } catch (UnsupportedOperationException e) {
+            System.err.println("Symbolic links not supported on this system. The test can't finish");
+        }
     }
 
 }
--- a/langtools/test/tools/javac/newlines/NewLineTest.java	Thu Mar 14 01:45:44 2013 -0400
+++ b/langtools/test/tools/javac/newlines/NewLineTest.java	Thu Mar 14 08:30:16 2013 +0000
@@ -34,19 +34,18 @@
 import java.nio.charset.Charset;
 import java.nio.file.Files;
 import java.util.List;
-import com.sun.tools.javac.util.ArrayUtils;
 
 //original test: test/tools/javac/newlines/Newlines.sh
 public class NewLineTest {
 
     public static void main(String args[]) throws Exception {
-        String[] mainArgs = ToolBox.getJavacBin();
-
 //        "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -J-Dline.separator='@' > ${TMP1} 2>&1
         File javacErrOutput = new File("output.txt");
         ToolBox.AnyToolArgs cmdArgs =
                 new ToolBox.AnyToolArgs(ToolBox.Expect.FAIL)
-                .setAllArgs(ArrayUtils.concatOpen(mainArgs, "-J-Dline.separator='@'"))
+                .appendArgs(ToolBox.javacBinary)
+                .appendArgs(ToolBox.testToolVMOpts)
+                .appendArgs("-J-Dline.separator='@'")
                 .setErrOutput(javacErrOutput);
         ToolBox.executeCommand(cmdArgs);
 
--- a/langtools/test/tools/javah/6257087/T6257087.java	Thu Mar 14 01:45:44 2013 -0400
+++ b/langtools/test/tools/javah/6257087/T6257087.java	Thu Mar 14 08:30:16 2013 +0000
@@ -32,7 +32,6 @@
 
 import java.nio.file.Paths;
 
-//original test: test/tools/javah/6257087/foo.sh
 public class T6257087 {
 
     private static final String fooBarGoldenFile =
@@ -59,17 +58,13 @@
         "#endif";
 
     public static void main(String[] args) throws Exception {
-//        "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d "${TC}" "${TS}${FS}foo.java"
-
-//        "${TESTJAVA}${FS}bin${FS}javah" ${TESTTOOLVMOPTS} -classpath "${TC}" -d "${TC}" foo
         ToolBox.JavaToolArgs javahArgs =
                 new ToolBox.JavaToolArgs()
                 .setAllArgs("-cp", System.getProperty("test.classes"), "foo");
         ToolBox.javah(javahArgs);
 
-//        diff ${DIFFOPTS} -c "${TS}${FS}foo_bar.h" "${TC}${FS}foo_bar.h"
         ToolBox.compareLines(Paths.get("foo_bar.h"),
-                ToolBox.splitLines(fooBarGoldenFile), null);
+                ToolBox.splitLines(fooBarGoldenFile, "\n"), null, true);
     }
 
 }
--- a/langtools/test/tools/javah/constMacroTest/ConstMacroTest.java	Thu Mar 14 01:45:44 2013 -0400
+++ b/langtools/test/tools/javah/constMacroTest/ConstMacroTest.java	Thu Mar 14 08:30:16 2013 +0000
@@ -38,7 +38,7 @@
 //original test: test/tools/javah/ConstMacroTest.sh
 public class ConstMacroTest {
 
-    private static final String SubClassConstsGoldenFile =
+    private static final String subClassConstsGoldenFileTemplate =
         "/* DO NOT EDIT THIS FILE - it is machine generated */\n" +
         "#include <jni.h>\n" +
         "/* Header for class SubClassConsts */\n" +
@@ -49,7 +49,7 @@
         "extern \"C\" {\n" +
         "#endif\n" +
         "#undef SubClassConsts_serialVersionUID\n" +
-        "#define SubClassConsts_serialVersionUID 6733861379283244755LL\n" +
+        "#define SubClassConsts_serialVersionUID 6733861379283244755%s\n" +
         "#undef SubClassConsts_SUPER_INT_CONSTANT\n" +
         "#define SubClassConsts_SUPER_INT_CONSTANT 3L\n" +
         "#undef SubClassConsts_SUPER_FLOAT_CONSTANT\n" +
@@ -71,6 +71,9 @@
         "#endif\n" +
         "#endif";
 
+    private static final String serialVersionUIDSuffix =
+            ToolBox.isWindows() ? "i64" : "LL"; ;
+
     public static void main(String[] args) throws Exception {
         //first steps are now done by jtreg
 //        cp "${TESTSRC}${FS}SuperClassConsts.java" .
@@ -85,8 +88,10 @@
         ToolBox.javah(successParams);
 
 //        diff ${DIFFOPTS} "${TESTSRC}${FS}${EXPECTED_JAVAH_OUT_FILE}" "${GENERATED_HEADER_FILE}"
+        String subClassConstGoldenFile = String.format(subClassConstsGoldenFileTemplate,
+                serialVersionUIDSuffix);
         ToolBox.compareLines(Paths.get("SubClassConsts.h"),
-                ToolBox.splitLines(SubClassConstsGoldenFile), null);
+                ToolBox.splitLines(subClassConstGoldenFile, "\n"), null, true);
     }
 
 }
--- a/langtools/test/tools/javap/stackmap/StackmapTest.java	Thu Mar 14 01:45:44 2013 -0400
+++ b/langtools/test/tools/javap/stackmap/StackmapTest.java	Thu Mar 14 08:30:16 2013 +0000
@@ -84,10 +84,11 @@
                 new ToolBox.JavaToolArgs()
                 .setAllArgs("-v", "Test.class");
         String out = ToolBox.javap(javapParams);
-        List<String> grepResult = ToolBox.grep("frame_type", out);
-        grepResult.addAll(ToolBox.grep("offset_delta", out));
-        grepResult.addAll(ToolBox.grep("stack = ", out));
-        grepResult.addAll(ToolBox.grep("locals = ", out));
+        List<String> grepResult = ToolBox.grep("frame_type", out,
+                ToolBox.lineSeparator);
+        grepResult.addAll(ToolBox.grep("offset_delta", out, ToolBox.lineSeparator));
+        grepResult.addAll(ToolBox.grep("stack = ", out, ToolBox.lineSeparator));
+        grepResult.addAll(ToolBox.grep("locals = ", out, ToolBox.lineSeparator));
         List<String> goldenList = Arrays.asList(goldenOut.split("\n"));
 
 //        diff -w "${OUTFILE}" "${TESTSRC}${FS}T6271292.out"