Skip to content

Commit b4be01e

Browse files
committed
Allow running long tests with testOnly
Improves #3194
1 parent 0ed66e4 commit b4be01e

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package dotty.tools.dotc
2+
3+
/** SlowTest category for JUnit */
4+
trait SlowTests

project/Build.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -465,13 +465,13 @@ object Build {
465465

466466
test in Test := {
467467
// Exclude legacy tests by default
468-
(testOnly in Test).toTask(" -- --exclude-categories=java.lang.Exception").value
468+
(testOnly in Test).toTask(" -- --exclude-categories=java.lang.Exception,dotty.tools.dotc.SlowTests").value
469469
},
470470

471471
vulpix := Def.inputTaskDyn {
472472
val args: Seq[String] = spaceDelimited("<arg>").parsed
473-
val cmd = " dotty.tools.dotc.CompilationTests" + {
474-
if (args.nonEmpty) " -- -Ddotty.tests.filter=" + args.mkString(" ")
473+
val cmd = " dotty.tools.dotc.CompilationTests -- --exclude-categories=dotty.tools.dotc.SlowTests" + {
474+
if (args.nonEmpty) " -Ddotty.tests.filter=" + args.mkString(" ")
475475
else ""
476476
}
477477
(testOnly in Test).toTask(cmd)

0 commit comments

Comments
 (0)