Skip to content

Commit 96b0ae4

Browse files
Merge pull request #3227 from dotty-staging/improve-#3194
Allow running long tests with testOnly
2 parents a54bf68 + aeb82a3 commit 96b0ae4

File tree

6 files changed

+27
-10
lines changed

6 files changed

+27
-10
lines changed

.drone.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,23 @@ pipeline:
1313
image: lampepfl/dotty:2017-09-27
1414
commands:
1515
- cp -R . /tmp/1/ && cd /tmp/1/
16-
- ./project/scripts/sbt test
16+
- ./project/scripts/sbt testAll
1717
- ./project/scripts/sbt ";dotty-bench/jmh:run 1 1 tests/run/arrays.scala"
1818

1919
test_bootstrapped:
2020
group: test
2121
image: lampepfl/dotty:2017-09-27
2222
commands:
2323
- cp -R . /tmp/2/ && cd /tmp/2/
24-
- ./project/scripts/sbt dotty-bootstrapped/test
24+
- ./project/scripts/sbt dotty-bootstrapped/testAll
2525
- ./project/scripts/sbt ";dotty-bench-bootstrapped/jmh:run 1 1 tests/run/arrays.scala"
2626

2727
test_optimised:
2828
group: test
2929
image: lampepfl/dotty:2017-09-27
3030
commands:
3131
- cp -R . /tmp/3/ && cd /tmp/3/
32-
- ./project/scripts/sbt dotty-optimised/test
32+
- ./project/scripts/sbt dotty-optimised/testAll
3333

3434
test_sbt:
3535
group: test

compiler/test/dotc/tests.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package dotc
22

33
import dotty.Jars
4+
import dotty.LegacyTests
45
import dotty.tools.dotc.CompilerTest
56
import dotty.tools.StdLibSources
67
import org.junit.experimental.categories.Category
@@ -15,7 +16,7 @@ import scala.io.Source
1516
* =======
1617
* These are legacy, do not add tests here, see `CompilationTests.scala`
1718
*/
18-
@Category(Array(classOf[java.lang.Exception]))
19+
@Category(Array(classOf[LegacyTests]))
1920
class tests extends CompilerTest {
2021

2122
// tests that match regex '(pos|dotc|run|java|compileStdLib)\.*' would be
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package dotty
2+
3+
/** SlowTest category for JUnit */
4+
trait SlowTests
5+
6+
/** Legacy tests category for JUnit */
7+
trait LegacyTests

compiler/test/dotty/tools/dotc/CompilationTests.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ package dotc
55
import org.junit.{ Test, BeforeClass, AfterClass }
66
import org.junit.Assert._
77
import org.junit.Assume._
8+
import org.junit.experimental.categories.Category
89

910
import java.nio.file._
1011
import java.util.stream.{ Stream => JStream }
@@ -295,8 +296,8 @@ class CompilationTests extends ParallelTesting {
295296
tests.foreach(_.delete())
296297
}
297298

299+
@Category(Array(classOf[SlowTests]))
298300
@Test def testOptimised: Unit = {
299-
assumeTrue("Only executes on Drone", dotty.Properties.isRunByDrone)
300301
val outputDir = defaultOutputDir + "optimised/"
301302
compileFilesInDir("../tests/pos", defaultOptimised, outputDir).checkCompile()
302303
compileFilesInDir("../tests/run", defaultOptimised, outputDir).checkRuns()

compiler/test/dotty/tools/dotc/IdempotencyTests.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import java.nio.file.{Files, Path, Paths}
77

88
import org.junit.Assume.assumeTrue
99
import org.junit.{AfterClass, Test}
10+
import org.junit.experimental.categories.Category
1011

1112
import scala.concurrent.duration._
1213
import vulpix.{ParallelTesting, SummaryReport, SummaryReporting, TestConfiguration}
@@ -24,9 +25,8 @@ class IdempotencyTests extends ParallelTesting {
2425
def isInteractive = SummaryReport.isInteractive
2526
def testFilter = Properties.testsFilter
2627

27-
/* TODO: Only run them selectively? */
28+
@Category(Array(classOf[SlowTests]))
2829
@Test def idempotency: Unit = {
29-
assumeTrue("Only executes on Drone", dotty.Properties.isRunByDrone)
3030

3131
val opt = defaultOptions.and("-YemitTasty")
3232

project/Build.scala

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ object Build {
7676
// Run tests with filter through vulpix test suite
7777
lazy val vulpix = inputKey[Unit]("runs integration test with the supplied filter")
7878

79+
// Run all tests including tests marked with SlowTests
80+
lazy val testAll = inputKey[Unit]("runs all tests including SlowTests")
81+
7982
// Used to compile files similar to ./bin/dotc script
8083
lazy val dotc =
8184
inputKey[Unit]("run the compiler using the correct classpath, or the user supplied classpath")
@@ -465,13 +468,18 @@ object Build {
465468

466469
test in Test := {
467470
// Exclude legacy tests by default
468-
(testOnly in Test).toTask(" -- --exclude-categories=java.lang.Exception").value
471+
(testOnly in Test).toTask(" -- --exclude-categories=dotty.LegacyTests,dotty.SlowTests").value
472+
},
473+
474+
testAll in Test := {
475+
// Exclude legacy tests by default
476+
(testOnly in Test).toTask(" -- --exclude-categories=dotty.LegacyTests").value
469477
},
470478

471479
vulpix := Def.inputTaskDyn {
472480
val args: Seq[String] = spaceDelimited("<arg>").parsed
473-
val cmd = " dotty.tools.dotc.CompilationTests" + {
474-
if (args.nonEmpty) " -- -Ddotty.tests.filter=" + args.mkString(" ")
481+
val cmd = " dotty.tools.dotc.CompilationTests -- --exclude-categories=dotty.SlowTests" + {
482+
if (args.nonEmpty) " -Ddotty.tests.filter=" + args.mkString(" ")
475483
else ""
476484
}
477485
(testOnly in Test).toTask(cmd)

0 commit comments

Comments
 (0)