Skip to content

Allow running long tests with testOnly #3227

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 3, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion compiler/test/dotty/tools/dotc/CompilationTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions compiler/test/dotty/tools/dotc/IdempotencyTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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")

Expand Down
4 changes: 4 additions & 0 deletions compiler/test/dotty/tools/dotc/SlowTests.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package dotty.tools.dotc

/** SlowTest category for JUnit */
trait SlowTests
6 changes: 3 additions & 3 deletions project/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -465,13 +465,13 @@ 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=java.lang.Exception,dotty.tools.dotc.SlowTests").value
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean that Drone will not run them?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, it won't. I will have to find a workaround

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

},

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