From 5f3b57a3315739c408b7baa920f2af73ae1ff868 Mon Sep 17 00:00:00 2001 From: Nicolas Stucki Date: Tue, 3 Apr 2018 16:00:45 +0200 Subject: [PATCH 1/2] Fix #4143: Ignore lines "Picked up _JAVA_OPTIONS" in tests --- compiler/test/dotty/tools/vulpix/ParallelTesting.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/test/dotty/tools/vulpix/ParallelTesting.scala b/compiler/test/dotty/tools/vulpix/ParallelTesting.scala index 4a10c2dc90bd..69fef56c1e6f 100644 --- a/compiler/test/dotty/tools/vulpix/ParallelTesting.scala +++ b/compiler/test/dotty/tools/vulpix/ParallelTesting.scala @@ -600,7 +600,7 @@ trait ParallelTesting extends RunnerOrchestration { self => else runMain(testSource.runClassPath) match { case Success(_) if !checkFile.isDefined || !checkFile.get.exists => // success! case Success(output) => { - val outputLines = output.lines.toArray :+ DiffUtil.EOF + val outputLines = output.lines.filterNot(_.startsWith("Picked up _JAVA_OPTIONS")).toArray :+ DiffUtil.EOF val checkLines: Array[String] = Source.fromFile(checkFile.get).getLines().toArray :+ DiffUtil.EOF val sourceTitle = testSource.title From ffa2a743f1f91e2dfb27f91e1e37eee03cc36229 Mon Sep 17 00:00:00 2001 From: Nicolas Stucki Date: Wed, 4 Apr 2018 11:36:54 +0200 Subject: [PATCH 2/2] Fix #4143: Ignore lines printed before the start of the test --- compiler/test/dotty/tools/vulpix/ChildJVMMain.java | 4 ++++ compiler/test/dotty/tools/vulpix/ParallelTesting.scala | 2 +- .../test/dotty/tools/vulpix/RunnerOrchestration.scala | 8 +++++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/compiler/test/dotty/tools/vulpix/ChildJVMMain.java b/compiler/test/dotty/tools/vulpix/ChildJVMMain.java index ce9aebf719e1..9cc14d473262 100644 --- a/compiler/test/dotty/tools/vulpix/ChildJVMMain.java +++ b/compiler/test/dotty/tools/vulpix/ChildJVMMain.java @@ -9,6 +9,7 @@ import java.lang.reflect.Method; public class ChildJVMMain { + static final String MessageStart = "##THIS IS THE START FOR ME, HELLO##"; static final String MessageEnd = "##THIS IS THE END FOR ME, GOODBYE##"; private static void runMain(String dir) throws Exception { @@ -23,6 +24,9 @@ private static void runMain(String dir) throws Exception { Class cls = ucl.loadClass("Test"); Method meth = cls.getMethod("main", String[].class); Object[] args = new Object[]{ new String[]{ "jvm" } }; + + System.out.println(MessageStart); + meth.invoke(null, args); } diff --git a/compiler/test/dotty/tools/vulpix/ParallelTesting.scala b/compiler/test/dotty/tools/vulpix/ParallelTesting.scala index 69fef56c1e6f..4a10c2dc90bd 100644 --- a/compiler/test/dotty/tools/vulpix/ParallelTesting.scala +++ b/compiler/test/dotty/tools/vulpix/ParallelTesting.scala @@ -600,7 +600,7 @@ trait ParallelTesting extends RunnerOrchestration { self => else runMain(testSource.runClassPath) match { case Success(_) if !checkFile.isDefined || !checkFile.get.exists => // success! case Success(output) => { - val outputLines = output.lines.filterNot(_.startsWith("Picked up _JAVA_OPTIONS")).toArray :+ DiffUtil.EOF + val outputLines = output.lines.toArray :+ DiffUtil.EOF val checkLines: Array[String] = Source.fromFile(checkFile.get).getLines().toArray :+ DiffUtil.EOF val sourceTitle = testSource.title diff --git a/compiler/test/dotty/tools/vulpix/RunnerOrchestration.scala b/compiler/test/dotty/tools/vulpix/RunnerOrchestration.scala index 94bc9eb3275b..767e92fc584e 100644 --- a/compiler/test/dotty/tools/vulpix/RunnerOrchestration.scala +++ b/compiler/test/dotty/tools/vulpix/RunnerOrchestration.scala @@ -118,7 +118,13 @@ trait RunnerOrchestration { if (childStdout eq null) childStdout = new BufferedReader(new InputStreamReader(process.getInputStream)) - var childOutput = childStdout.readLine() + var childOutput: String = childStdout.readLine() + + // Discard all messages until the test starts + while (childOutput != ChildJVMMain.MessageStart && childOutput != null) + childOutput = childStdout.readLine() + childOutput = childStdout.readLine() + while (childOutput != ChildJVMMain.MessageEnd && childOutput != null) { sb.append(childOutput) sb += '\n'