diff options
author | Felix Mulder <felix.mulder@gmail.com> | 2017-04-07 14:46:17 +0200 |
---|---|---|
committer | Felix Mulder <felix.mulder@gmail.com> | 2017-04-12 11:31:15 +0200 |
commit | d42a28d07683d95e6dffd27cdb9078ebeb599c15 (patch) | |
tree | 3907a8a0d59a99b23f3ce483cb5006c137373eba /compiler/test/dotty/tools | |
parent | 55803b2657a473a1ebbebfd9ab7ba4c1b4e27d38 (diff) | |
download | dotty-d42a28d07683d95e6dffd27cdb9078ebeb599c15.tar.gz dotty-d42a28d07683d95e6dffd27cdb9078ebeb599c15.tar.bz2 dotty-d42a28d07683d95e6dffd27cdb9078ebeb599c15.zip |
Add ability to only compile run tests
Diffstat (limited to 'compiler/test/dotty/tools')
-rw-r--r-- | compiler/test/dotty/tools/vulpix/ParallelTesting.scala | 38 | ||||
-rw-r--r-- | compiler/test/dotty/tools/vulpix/SummaryReport.java | 19 | ||||
-rw-r--r-- | compiler/test/dotty/tools/vulpix/VulpixTests.scala | 3 |
3 files changed, 44 insertions, 16 deletions
diff --git a/compiler/test/dotty/tools/vulpix/ParallelTesting.scala b/compiler/test/dotty/tools/vulpix/ParallelTesting.scala index 8cafd543b..e1babfb9c 100644 --- a/compiler/test/dotty/tools/vulpix/ParallelTesting.scala +++ b/compiler/test/dotty/tools/vulpix/ParallelTesting.scala @@ -426,8 +426,21 @@ trait ParallelTesting extends RunnerOrchestration { self => private final class RunTest(testSources: List[TestSource], times: Int, threadLimit: Option[Int], suppressAllOutput: Boolean) extends Test(testSources, times, threadLimit, suppressAllOutput) { + private[this] var didAddNoRunWarning = false + private[this] def addNoRunWarning() = if (!didAddNoRunWarning) { + didAddNoRunWarning = true + SummaryReport.addStartingMessage { + """|WARNING + |------- + |Run tests were only compiled, not run - this is due to `dotty.tests.norun` + |property being set + |""".stripMargin + } + } + private def verifyOutput(checkFile: JFile, dir: JFile, testSource: TestSource, warnings: Int) = { - runMain(testSource.classPath) match { + if (Properties.testsNoRun) addNoRunWarning() + else runMain(testSource.classPath) match { case Success(output) => { val outputLines = output.lines.toArray val checkLines: Array[String] = Source.fromFile(checkFile).getLines.toArray @@ -511,16 +524,19 @@ trait ParallelTesting extends RunnerOrchestration { self => } if (errorCount == 0 && hasCheckFile) verifier() - else if (errorCount == 0) runMain(testSource.classPath) match { - case Success(_) => // success! - case Failure(output) => - echo(s" failed when running '${testSource.title}'") - echo(output) - failTestSource(testSource) - case Timeout => - echo(" failed because test " + testSource.title + " timed out") - failTestSource(testSource, Some("test timed out")) - } + else if (errorCount == 0) { + if (Properties.testsNoRun) addNoRunWarning() + else runMain(testSource.classPath) match { + case Success(_) => // success! + case Failure(output) => + echo(s" failed when running '${testSource.title}'") + echo(output) + failTestSource(testSource) + case Timeout => + echo(" failed because test " + testSource.title + " timed out") + failTestSource(testSource, Some("test timed out")) + } + } else if (errorCount > 0) { echo(s"\n Compilation failed for: '$testSource'") val buildInstr = testSource.buildInstructions(errorCount, warningCount) diff --git a/compiler/test/dotty/tools/vulpix/SummaryReport.java b/compiler/test/dotty/tools/vulpix/SummaryReport.java index 1a7fc2a61..23209eefc 100644 --- a/compiler/test/dotty/tools/vulpix/SummaryReport.java +++ b/compiler/test/dotty/tools/vulpix/SummaryReport.java @@ -10,8 +10,10 @@ import scala.Unit; import dotty.tools.dotc.reporting.TestReporter; import dotty.Properties; -/** Note that while `ParallelTesting` runs in parallel, JUnit tests cannot with - * this class +/** This class adds summary reports to `ParallelTesting` + * + * It is written in Java because we currently cannot explicitly write static + * methods in Scala without SIP-25 (`@static` fields and methods in Scala) */ public class SummaryReport { public final static boolean isInteractive = @@ -20,6 +22,7 @@ public class SummaryReport { private static TestReporter rep = TestReporter.reporter(System.out, -1); private static ArrayDeque<String> failedTests = new ArrayDeque<>(); private static ArrayDeque<String> reproduceInstructions = new ArrayDeque<>(); + private static ArrayDeque<String> startingMessages = new ArrayDeque<>(); private static Supplier<Void> cleanup; private static int passed; private static int failed; @@ -40,6 +43,10 @@ public class SummaryReport { reproduceInstructions.offer(msg); } + public final static void addStartingMessage(String msg) { + startingMessages.offer(msg); + } + public final static void addCleanup(Function0<Unit> func) { // Wow, look at how neatly we - compose cleanup callbacks: if (cleanup == null) { @@ -61,6 +68,10 @@ public class SummaryReport { rep = TestReporter.reporter(System.out, -1); failedTests = new ArrayDeque<>(); reproduceInstructions = new ArrayDeque<>(); + startingMessages = new ArrayDeque<>(); + cleanup = null; + passed = 0; + failed = 0; } @AfterClass public final static void teardown() { @@ -73,6 +84,10 @@ public class SummaryReport { "\n" ); + startingMessages + .stream() + .forEach(rep::echo); + failedTests .stream() .map(x -> " " + x) diff --git a/compiler/test/dotty/tools/vulpix/VulpixTests.scala b/compiler/test/dotty/tools/vulpix/VulpixTests.scala index 2483bf6f0..646e1bb29 100644 --- a/compiler/test/dotty/tools/vulpix/VulpixTests.scala +++ b/compiler/test/dotty/tools/vulpix/VulpixTests.scala @@ -71,7 +71,4 @@ class VulpixTests extends ParallelTesting { @Test def deadlock: Unit = compileFile("../tests/partest-test/deadlock.scala", defaultOptions).expectFailure.checkRuns() - - @Test def forkbomb: Unit = - compileFile("../tests/partest-test/forkbomb.scala", defaultOptions).expectFailure.checkRuns() } |