|
| 1 | +package dotty |
| 2 | +package tools |
| 3 | +package dotc |
| 4 | + |
| 5 | +import org.junit.{ Test, AfterClass } |
| 6 | + |
| 7 | +import scala.concurrent.duration._ |
| 8 | + |
| 9 | +import vulpix.{ ParallelTesting, SummaryReport, SummaryReporting, TestConfiguration } |
| 10 | + |
| 11 | + |
| 12 | +class IdempotencyTests extends ParallelTesting { |
| 13 | + import TestConfiguration._ |
| 14 | + import IdempotencyTests._ |
| 15 | + |
| 16 | + // Test suite configuration -------------------------------------------------- |
| 17 | + |
| 18 | + def maxDuration = 30.seconds |
| 19 | + def numberOfSlaves = 5 |
| 20 | + def safeMode = Properties.testsSafeMode |
| 21 | + def isInteractive = SummaryReport.isInteractive |
| 22 | + def testFilter = Properties.testsFilter |
| 23 | + |
| 24 | + /* TODO: Only run them selectively? */ |
| 25 | + @Test def bytecodeIdempotency: Unit = { |
| 26 | + val opt = defaultOptions.and("-YemitTasty") |
| 27 | + |
| 28 | + def idempotency1() = { |
| 29 | + compileDir("../collection-strawman/src/main", opt) + |
| 30 | + compileFilesInDir("../tests/pos", opt) |
| 31 | + } |
| 32 | + def idempotency2() = { |
| 33 | + compileDir("../collection-strawman/src/main", opt) + |
| 34 | + compileFilesInDir("../tests/pos", opt) |
| 35 | + } |
| 36 | + |
| 37 | + val tests = (idempotency1() + idempotency2()).keepOutput.checkCompile() |
| 38 | + |
| 39 | + assert(new java.io.File("../out/idempotency1/").exists) |
| 40 | + assert(new java.io.File("../out/idempotency2/").exists) |
| 41 | + |
| 42 | + compileList("idempotency", List("../tests/idempotency/Checker.scala", "../tests/idempotency/IdempotencyCheck.scala"), defaultOptions).checkRuns() |
| 43 | + |
| 44 | + tests.delete() |
| 45 | + } |
| 46 | + |
| 47 | +} |
| 48 | + |
| 49 | +object IdempotencyTests { |
| 50 | + implicit val summaryReport: SummaryReporting = new SummaryReport |
| 51 | + @AfterClass def cleanup(): Unit = summaryReport.echoSummary() |
| 52 | +} |
0 commit comments