8156470: [JITtester] EOL on Windows
authordpochepk
Wed, 25 May 2016 16:22:31 +0300
changeset 38712 6bc0837b2633
parent 38711 462b3dc4ab27
child 38713 4a16e9ea88a0
8156470: [JITtester] EOL on Windows Reviewed-by: kvn
hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/jtreg/JitTesterDriver.java
hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/utils/FixedTrees.java
--- a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/jtreg/JitTesterDriver.java	Wed May 25 16:20:02 2016 +0300
+++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/jtreg/JitTesterDriver.java	Wed May 25 16:22:31 2016 +0300
@@ -33,6 +33,7 @@
 import java.nio.file.Paths;
 import java.util.Arrays;
 import java.util.function.Predicate;
+import java.util.regex.Pattern;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
@@ -52,14 +53,16 @@
             throw new Error("Unexpected exception on test jvm start :" + e, e);
         }
 
+        Pattern splitOut = Pattern.compile("\\n"); // tests use \n only in stdout
+        Pattern splitErr = Pattern.compile("\\r?\\n"); // can handle both \r\n and \n
         Path testDir = Paths.get(Utils.TEST_SRC);
         String goldOut = formatOutput(streamGoldFile(testDir, args[0], "out"), s -> true);
-        Asserts.assertEQ(oa.getStdout(), goldOut, "Actual stdout isn't equal to golden one");
-
+        String anlzOut = formatOutput(Arrays.stream(splitOut.split(oa.getStdout())), s -> true);
+        Asserts.assertEQ(anlzOut, goldOut, "Actual stdout isn't equal to golden one");
         // TODO: add a comment why we skip such lines
         Predicate<String> notStartWhitespaces = s -> !(s.startsWith("\t") || s.startsWith(" "));
         String goldErr = formatOutput(streamGoldFile(testDir, args[0], "err"), notStartWhitespaces);
-        String anlzErr = formatOutput(Arrays.stream(oa.getStderr().split(Utils.NEW_LINE)),
+        String anlzErr = formatOutput(Arrays.stream(splitErr.split(oa.getStderr())),
                                       notStartWhitespaces);
         Asserts.assertEQ(anlzErr, goldErr, "Actual stderr isn't equal to golden one");
 
--- a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/utils/FixedTrees.java	Wed May 25 16:20:02 2016 +0300
+++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/utils/FixedTrees.java	Wed May 25 16:22:31 2016 +0300
@@ -37,7 +37,6 @@
 import jdk.test.lib.jittester.Operator;
 import jdk.test.lib.jittester.OperatorKind;
 import jdk.test.lib.jittester.PrintVariables;
-import jdk.test.lib.jittester.ProductionFailedException;
 import jdk.test.lib.jittester.Statement;
 import jdk.test.lib.jittester.StaticMemberVariable;
 import jdk.test.lib.jittester.Symbol;
@@ -171,22 +170,22 @@
         TryCatchBlock tryCatch1 = new TryCatchBlock(tryNode, nothing, catchBlocks1, 3);
         TypeKlass printStreamKlass = new TypeKlass("java.io.PrintStream");
         TypeKlass systemKlass = new TypeKlass("java.lang.System");
-        FunctionInfo systemOutPrintlnInfo = new FunctionInfo("println", printStreamKlass,
+        FunctionInfo systemOutPrintInfo = new FunctionInfo("print", printStreamKlass,
                 TypeList.VOID, 0, FunctionInfo.PUBLIC,
                 new VariableInfo("this", owner, printStreamKlass, VariableInfo.LOCAL | VariableInfo.INITIALIZED),
                 new VariableInfo("t", owner, TypeList.OBJECT,
                         VariableInfo.LOCAL  | VariableInfo.INITIALIZED));
-        List<IRNode> printlnArgs = new ArrayList<>();
+        List<IRNode> printArgs = new ArrayList<>();
         VariableInfo systemOutInfo = new VariableInfo("out", systemKlass, printStreamKlass,
                 VariableInfo.STATIC | VariableInfo.PUBLIC);
         StaticMemberVariable systemOutVar = new StaticMemberVariable(owner, systemOutInfo);
-        printlnArgs.add(systemOutVar);
-        printlnArgs.add(tVar);
-        Function println = new Function(printStreamKlass, systemOutPrintlnInfo, printlnArgs);
-        ArrayList<IRNode> printlnBlockContent = new ArrayList<>();
-        printlnBlockContent.add(new Statement(println, true));
-        Block printlnBlock = new Block(owner, TypeList.VOID, printlnBlockContent, 3);
-        TryCatchBlock tryCatch2 = new TryCatchBlock(printlnBlock, nothing, catchBlocks2, 3);
+        printArgs.add(systemOutVar);
+        printArgs.add(tVar);
+        Function print = new Function(printStreamKlass, systemOutPrintInfo, printArgs);
+        ArrayList<IRNode> printBlockContent = new ArrayList<>();
+        printBlockContent.add(new Statement(print, true));
+        Block printBlock = new Block(owner, TypeList.VOID, printBlockContent, 3);
+        TryCatchBlock tryCatch2 = new TryCatchBlock(printBlock, nothing, catchBlocks2, 3);
 
         List<IRNode> mainTryCatchBlockContent = new ArrayList<>();
         mainTryCatchBlockContent.add(new Statement(testInit, true));