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 all 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/dotc/tests.scala
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
7 changes: 7 additions & 0 deletions compiler/test/dotty/TestCategories.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package dotty

/** SlowTest category for JUnit */
trait SlowTests

/** Legacy tests category for JUnit */
trait LegacyTests
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
14 changes: 11 additions & 3 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 @@ -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("<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.SlowTests" + {
if (args.nonEmpty) " -Ddotty.tests.filter=" + args.mkString(" ")
else ""
}
(testOnly in Test).toTask(cmd)
Expand Down