diff --git a/.drone.yml b/.drone.yml index 42d2585a216f..2271488f0a6f 100644 --- a/.drone.yml +++ b/.drone.yml @@ -13,7 +13,7 @@ pipeline: image: lampepfl/dotty:2017-09-08 commands: - cp -R . /tmp/1/ && cd /tmp/1/ - - ./project/scripts/sbt test + - ./project/scripts/sbt testAll - ./project/scripts/sbt ";dotty-bench/jmh:run 1 1 tests/run/arrays.scala" test_bootstrapped: @@ -21,7 +21,7 @@ pipeline: image: lampepfl/dotty:2017-09-08 commands: - cp -R . /tmp/2/ && cd /tmp/2/ - - ./project/scripts/sbt dotty-bootstrapped/test + - ./project/scripts/sbt dotty-bootstrapped/testAll - ./project/scripts/sbt ";dotty-bench-bootstrapped/jmh:run 1 1 tests/run/arrays.scala" test_optimised: @@ -29,7 +29,7 @@ pipeline: image: lampepfl/dotty:2017-09-08 commands: - cp -R . /tmp/3/ && cd /tmp/3/ - - ./project/scripts/sbt dotty-optimised/test + - ./project/scripts/sbt dotty-optimised/testAll test_sbt: group: test diff --git a/compiler/test/dotc/tests.scala b/compiler/test/dotc/tests.scala index fa71a5deeece..7b0672a55939 100644 --- a/compiler/test/dotc/tests.scala +++ b/compiler/test/dotc/tests.scala @@ -1,6 +1,7 @@ package dotc import dotty.Jars +import dotty.LegacyTests import dotty.tools.dotc.CompilerTest import dotty.tools.StdLibSources import org.junit.experimental.categories.Category @@ -15,7 +16,7 @@ import scala.io.Source * ======= * These are legacy, do not add tests here, see `CompilationTests.scala` */ -@Category(Array(classOf[java.lang.Exception])) +@Category(Array(classOf[LegacyTests])) class tests extends CompilerTest { // tests that match regex '(pos|dotc|run|java|compileStdLib)\.*' would be diff --git a/compiler/test/dotty/TestCategories.scala b/compiler/test/dotty/TestCategories.scala new file mode 100644 index 000000000000..b411fac93ade --- /dev/null +++ b/compiler/test/dotty/TestCategories.scala @@ -0,0 +1,7 @@ +package dotty + +/** SlowTest category for JUnit */ +trait SlowTests + +/** Legacy tests category for JUnit */ +trait LegacyTests diff --git a/compiler/test/dotty/tools/dotc/CompilationTests.scala b/compiler/test/dotty/tools/dotc/CompilationTests.scala index cc2a99d3a2b2..d3df0708c0ba 100644 --- a/compiler/test/dotty/tools/dotc/CompilationTests.scala +++ b/compiler/test/dotty/tools/dotc/CompilationTests.scala @@ -5,6 +5,7 @@ package dotc import org.junit.{ Test, BeforeClass, AfterClass } import org.junit.Assert._ import org.junit.Assume._ +import org.junit.experimental.categories.Category import java.nio.file._ import java.util.stream.{ Stream => JStream } @@ -295,8 +296,8 @@ class CompilationTests extends ParallelTesting { tests.foreach(_.delete()) } + @Category(Array(classOf[SlowTests])) @Test def testOptimised: Unit = { - assumeTrue("Only executes on Drone", dotty.Properties.isRunByDrone) val outputDir = defaultOutputDir + "optimised/" compileFilesInDir("../tests/pos", defaultOptimised, outputDir).checkCompile() compileFilesInDir("../tests/run", defaultOptimised, outputDir).checkRuns() diff --git a/compiler/test/dotty/tools/dotc/IdempotencyTests.scala b/compiler/test/dotty/tools/dotc/IdempotencyTests.scala index 96a7b1356dc8..706c80d32524 100644 --- a/compiler/test/dotty/tools/dotc/IdempotencyTests.scala +++ b/compiler/test/dotty/tools/dotc/IdempotencyTests.scala @@ -7,6 +7,7 @@ import java.nio.file.{Files, Path, Paths} import org.junit.Assume.assumeTrue import org.junit.{AfterClass, Test} +import org.junit.experimental.categories.Category import scala.concurrent.duration._ import vulpix.{ParallelTesting, SummaryReport, SummaryReporting, TestConfiguration} @@ -24,9 +25,8 @@ class IdempotencyTests extends ParallelTesting { def isInteractive = SummaryReport.isInteractive def testFilter = Properties.testsFilter - /* TODO: Only run them selectively? */ + @Category(Array(classOf[SlowTests])) @Test def idempotency: Unit = { - assumeTrue("Only executes on Drone", dotty.Properties.isRunByDrone) val opt = defaultOptions.and("-YemitTasty") diff --git a/project/Build.scala b/project/Build.scala index 0bc6894eda46..1cfdc5bb2fd6 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -76,6 +76,9 @@ object Build { // Run tests with filter through vulpix test suite lazy val vulpix = inputKey[Unit]("runs integration test with the supplied filter") + // Run all tests including tests marked with SlowTests + lazy val testAll = inputKey[Unit]("runs all tests including SlowTests") + // Used to compile files similar to ./bin/dotc script lazy val dotc = inputKey[Unit]("run the compiler using the correct classpath, or the user supplied classpath") @@ -465,13 +468,18 @@ object Build { test in Test := { // Exclude legacy tests by default - (testOnly in Test).toTask(" -- --exclude-categories=java.lang.Exception").value + (testOnly in Test).toTask(" -- --exclude-categories=dotty.LegacyTests,dotty.SlowTests").value + }, + + testAll in Test := { + // Exclude legacy tests by default + (testOnly in Test).toTask(" -- --exclude-categories=dotty.LegacyTests").value }, vulpix := Def.inputTaskDyn { val args: Seq[String] = spaceDelimited("").parsed - val cmd = " dotty.tools.dotc.CompilationTests" + { - if (args.nonEmpty) " -- -Ddotty.tests.filter=" + args.mkString(" ") + val cmd = " dotty.tools.dotc.CompilationTests -- --exclude-categories=dotty.SlowTests" + { + if (args.nonEmpty) " -Ddotty.tests.filter=" + args.mkString(" ") else "" } (testOnly in Test).toTask(cmd)