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 2 commits
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
6 changes: 3 additions & 3 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,23 @@ 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:
group: test
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:
group: test
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
Expand Down
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
12 changes: 10 additions & 2 deletions project/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -464,14 +467,19 @@ object Build {
baseDirectory in (Test, run) := baseDirectory.value,

test in Test := {
// Exclude legacy tests by default
(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

},

testAll in Test := {
// Exclude legacy tests by default
(testOnly in Test).toTask(" -- --exclude-categories=java.lang.Exception").value
Copy link
Contributor

Choose a reason for hiding this comment

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

While you're at it, could you create a meaningful category for legacy tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will

},

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