Skip to content

Commit d6bae54

Browse files
committed
Fix #3664: Run test in CI instead of testAll
We remove `testAll` which is now equivalent to `test`. If one only want to run the compilation tests, he can use the `vulpix` command. This commit also, clean the sbt build
1 parent f4a22a8 commit d6bae54

File tree

2 files changed

+79
-95
lines changed

2 files changed

+79
-95
lines changed

.drone.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,23 @@ pipeline:
2525
image: lampepfl/dotty:2017-11-17
2626
commands:
2727
- cp -R . /tmp/1/ && cd /tmp/1/
28-
- ./project/scripts/sbt ";compile ;testAll"
28+
- ./project/scripts/sbt ";compile ;test"
2929
- ./project/scripts/sbtTests
3030

3131
test_bootstrapped:
3232
group: test
3333
image: lampepfl/dotty:2017-11-17
3434
commands:
3535
- cp -R . /tmp/2/ && cd /tmp/2/
36-
- ./project/scripts/sbt ";dotty-bootstrapped/compile ;dotty-bootstrapped/testAll"
36+
- ./project/scripts/sbt ";dotty-bootstrapped/compile ;dotty-bootstrapped/test"
3737
- ./project/scripts/sbtBootstrappedTests
3838

3939
test_optimised:
4040
group: test
4141
image: lampepfl/dotty:2017-11-17
4242
commands:
4343
- cp -R . /tmp/3/ && cd /tmp/3/
44-
- ./project/scripts/sbt dotty-optimised/testAll
44+
- ./project/scripts/sbt dotty-optimised/test
4545

4646
test_sbt:
4747
group: test

project/Build.scala

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

81-
// Run all tests including tests marked with SlowTests
82-
lazy val testAll = inputKey[Unit]("runs all tests including SlowTests")
83-
8481
// Used to compile files similar to ./bin/dotc script
8582
lazy val dotc =
8683
inputKey[Unit]("run the compiler using the correct classpath, or the user supplied classpath")
@@ -124,7 +121,11 @@ object Build {
124121
// Override `runCode` from sbt-dotty to use the language-server and
125122
// vscode extension from the source repository of dotty instead of a
126123
// published version.
127-
runCode := (run in `dotty-language-server`).toTask("").value
124+
runCode := (run in `dotty-language-server`).toTask("").value,
125+
126+
// include sources in eclipse (downloads source code for all dependencies)
127+
//http://stackoverflow.com/questions/10472840/how-to-attach-sources-to-sbt-managed-dependencies-in-scala-ide#answer-11683728
128+
EclipseKeys.withSource := true
128129
)
129130

130131
// Settings shared globally (scoped in Global). Used in build.sbt
@@ -180,7 +181,12 @@ object Build {
180181
resourceDirectory in Test := baseDirectory.value / "test-resources",
181182

182183
// Prevent sbt from rewriting our dependencies
183-
ivyScala ~= (_ map (_ copy (overrideScalaVersion = false)))
184+
ivyScala ~= (_ map (_ copy (overrideScalaVersion = false))),
185+
186+
libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % Test,
187+
188+
// enable verbose exception messages for JUnit
189+
testOptions in Test += Tests.Argument(TestFrameworks.JUnit, "-a", "-v")
184190
)
185191

186192
// Settings used for projects compiled only with Scala 2
@@ -345,9 +351,6 @@ object Build {
345351
connectInput in run := true,
346352
outputStrategy := Some(StdoutOutput),
347353

348-
// enable verbose exception messages for JUnit
349-
testOptions in Test += Tests.Argument(TestFrameworks.JUnit, "-a", "-v"),
350-
351354
javaOptions ++= (javaOptions in `dotty-compiler`).value,
352355
fork in run := true,
353356
fork in Test := true,
@@ -387,7 +390,6 @@ object Build {
387390
}.evaluated,
388391

389392
libraryDependencies ++= Seq(
390-
"com.novocode" % "junit-interface" % "0.11" % "test",
391393
"com.vladsch.flexmark" % "flexmark" % "0.11.1",
392394
"com.vladsch.flexmark" % "flexmark-ext-gfm-tasklist" % "0.11.1",
393395
"com.vladsch.flexmark" % "flexmark-ext-gfm-tables" % "0.11.1",
@@ -455,9 +457,6 @@ object Build {
455457
pairs.map(_._2)
456458
}.taskValue,
457459

458-
// Used by the backend
459-
libraryDependencies += "org.scala-lang.modules" % "scala-asm" % "6.0.0-scala-1",
460-
461460
// set system in/out for repl
462461
connectInput in run := true,
463462
outputStrategy := Some(StdoutOutput),
@@ -483,18 +482,13 @@ object Build {
483482
Seq(file)
484483
}.taskValue,
485484

486-
// include sources in eclipse (downloads source code for all dependencies)
487-
//http://stackoverflow.com/questions/10472840/how-to-attach-sources-to-sbt-managed-dependencies-in-scala-ide#answer-11683728
488-
com.typesafe.sbteclipse.plugin.EclipsePlugin.EclipseKeys.withSource := true,
489-
490485
// get libraries onboard
491-
libraryDependencies ++= Seq("com.typesafe.sbt" % "sbt-interface" % sbtVersion.value,
492-
("org.scala-lang.modules" %% "scala-xml" % "1.0.6").withDottyCompat(),
493-
"com.novocode" % "junit-interface" % "0.11" % "test",
494-
"org.scala-lang" % "scala-library" % scalacVersion % "test"),
495-
496-
// enable improved incremental compilation algorithm
497-
incOptions := incOptions.value.withNameHashing(true),
486+
libraryDependencies ++= Seq(
487+
"org.scala-lang.modules" % "scala-asm" % "6.0.0-scala-1", // used by the backend
488+
"com.typesafe.sbt" % "sbt-interface" % sbtVersion.value,
489+
("org.scala-lang.modules" %% "scala-xml" % "1.0.6").withDottyCompat(),
490+
"org.scala-lang" % "scala-library" % scalacVersion % "test"
491+
),
498492

499493
// For convenience, change the baseDirectory when running the compiler
500494
baseDirectory in (Compile, run) := baseDirectory.value / "..",
@@ -503,12 +497,63 @@ object Build {
503497

504498
test in Test := {
505499
// Exclude legacy tests by default
506-
(testOnly in Test).toTask(" -- --exclude-categories=dotty.LegacyTests,dotty.SlowTests").value
500+
(testOnly in Test).toTask(" -- --exclude-categories=dotty.LegacyTests").value
507501
},
508502

509-
testAll in Test := {
510-
// Exclude legacy tests by default
511-
(testOnly in Test).toTask(" -- --exclude-categories=dotty.LegacyTests").value
503+
testOptions in Test += Tests.Argument(
504+
TestFrameworks.JUnit, "--run-listener=dotty.tools.ContextEscapeDetector"
505+
),
506+
507+
// Spawn new JVM in run and test
508+
fork in run := true,
509+
fork in Test := true,
510+
parallelExecution in Test := false,
511+
512+
// Add git-hash used to package the distribution to the manifest to know it in runtime and report it in REPL
513+
packageOptions += ManifestAttributes(("Git-Hash", VersionUtil.gitHash)),
514+
515+
// http://grokbase.com/t/gg/simple-build-tool/135ke5y90p/sbt-setting-jvm-boot-paramaters-for-scala
516+
// packageAll should always be run before tests
517+
javaOptions ++= {
518+
val attList = (dependencyClasspath in Runtime).value
519+
val pA = packageAll.value
520+
521+
// put needed dependencies on classpath:
522+
val path = for {
523+
file <- attList.map(_.data)
524+
path = file.getAbsolutePath
525+
// FIXME: when we snip the cord, this should go bye-bye
526+
if path.contains("scala-library") ||
527+
// FIXME: currently needed for tests referencing scalac internals
528+
path.contains("scala-reflect") ||
529+
// FIXME: should go away when xml literal parsing is removed
530+
path.contains("scala-xml") ||
531+
// used for tests that compile dotty
532+
path.contains("scala-asm") ||
533+
// needed for the xsbti interface
534+
path.contains("sbt-interface")
535+
} yield "-Xbootclasspath/p:" + path
536+
537+
val ci_build = // propagate if this is a ci build
538+
if (sys.props.isDefinedAt(JENKINS_BUILD))
539+
List(s"-D$JENKINS_BUILD=${sys.props(JENKINS_BUILD)}") ::: jenkinsMemLimit
540+
else if (sys.props.isDefinedAt(DRONE_MEM))
541+
List("-Xmx" + sys.props(DRONE_MEM))
542+
else List()
543+
544+
val tuning =
545+
if (sys.props.isDefinedAt("Oshort"))
546+
// Optimize for short-running applications, see https://github.com/lampepfl/dotty/issues/222
547+
List("-XX:+TieredCompilation", "-XX:TieredStopAtLevel=1")
548+
else List()
549+
550+
val jars = List(
551+
"-Ddotty.tests.classes.interfaces=" + pA("dotty-interfaces"),
552+
"-Ddotty.tests.classes.library=" + pA("dotty-library"),
553+
"-Ddotty.tests.classes.compiler=" + pA("dotty-compiler")
554+
)
555+
556+
jars ::: tuning ::: agentOptions ::: ci_build ::: path.toList
512557
},
513558

514559
vulpix := Def.inputTaskDyn {
@@ -545,13 +590,7 @@ object Build {
545590
},
546591
run := dotc.evaluated,
547592
dotc := runCompilerMain().evaluated,
548-
repl := runCompilerMain(repl = true).evaluated,
549-
550-
// enable verbose exception messages for JUnit
551-
testOptions in Test += Tests.Argument(
552-
TestFrameworks.JUnit, "-a", "-v",
553-
"--run-listener=dotty.tools.ContextEscapeDetector"
554-
),
593+
repl := runCompilerMain(repl = true).evaluated
555594

556595
/* Add the sources of scalajs-ir.
557596
* To guarantee that dotty can bootstrap without depending on a version
@@ -584,59 +623,7 @@ object Build {
584623
// IO.unzip(scalaJSIRSourcesJar, trgDir)
585624
// (trgDir ** "*.scala").get.toSet
586625
// } (Set(scalaJSIRSourcesJar)).toSeq
587-
//}.taskValue,
588-
589-
// Spawn new JVM in run and test
590-
fork in run := true,
591-
fork in Test := true,
592-
parallelExecution in Test := false,
593-
594-
// Add git-hash used to package the distribution to the manifest to know it in runtime and report it in REPL
595-
packageOptions += ManifestAttributes(("Git-Hash", VersionUtil.gitHash)),
596-
597-
// http://grokbase.com/t/gg/simple-build-tool/135ke5y90p/sbt-setting-jvm-boot-paramaters-for-scala
598-
// packageAll should always be run before tests
599-
javaOptions ++= {
600-
val attList = (dependencyClasspath in Runtime).value
601-
val pA = packageAll.value
602-
603-
// put needed dependencies on classpath:
604-
val path = for {
605-
file <- attList.map(_.data)
606-
path = file.getAbsolutePath
607-
// FIXME: when we snip the cord, this should go bye-bye
608-
if path.contains("scala-library") ||
609-
// FIXME: currently needed for tests referencing scalac internals
610-
path.contains("scala-reflect") ||
611-
// FIXME: should go away when xml literal parsing is removed
612-
path.contains("scala-xml") ||
613-
// used for tests that compile dotty
614-
path.contains("scala-asm") ||
615-
// needed for the xsbti interface
616-
path.contains("sbt-interface")
617-
} yield "-Xbootclasspath/p:" + path
618-
619-
val ci_build = // propagate if this is a ci build
620-
if (sys.props.isDefinedAt(JENKINS_BUILD))
621-
List(s"-D$JENKINS_BUILD=${sys.props(JENKINS_BUILD)}") ::: jenkinsMemLimit
622-
else if (sys.props.isDefinedAt(DRONE_MEM))
623-
List("-Xmx" + sys.props(DRONE_MEM))
624-
else List()
625-
626-
val tuning =
627-
if (sys.props.isDefinedAt("Oshort"))
628-
// Optimize for short-running applications, see https://github.com/lampepfl/dotty/issues/222
629-
List("-XX:+TieredCompilation", "-XX:TieredStopAtLevel=1")
630-
else List()
631-
632-
val jars = List(
633-
"-Ddotty.tests.classes.interfaces=" + pA("dotty-interfaces"),
634-
"-Ddotty.tests.classes.library=" + pA("dotty-library"),
635-
"-Ddotty.tests.classes.compiler=" + pA("dotty-compiler")
636-
)
637-
638-
jars ::: tuning ::: agentOptions ::: ci_build ::: path.toList
639-
}
626+
//}.taskValue
640627
)
641628

642629
def runCompilerMain(repl: Boolean = false) = Def.inputTaskDyn {
@@ -678,7 +665,7 @@ object Build {
678665
"dotty-compiler" -> (packageBin in Compile).value,
679666
"dotty-library" -> (packageBin in (`dotty-library`, Compile)).value,
680667
"dotty-compiler-test" -> (packageBin in Test).value
681-
) map { case (k, v) => (k, v.getAbsolutePath) }
668+
).mapValues(_.getAbsolutePath)
682669
}
683670
)
684671

@@ -706,10 +693,7 @@ object Build {
706693

707694
// Settings shared between dotty-library and dotty-library-bootstrapped
708695
lazy val dottyLibrarySettings = Seq(
709-
libraryDependencies ++= Seq(
710-
"org.scala-lang" % "scala-library" % scalacVersion,
711-
"com.novocode" % "junit-interface" % "0.11" % "test"
712-
)
696+
libraryDependencies += "org.scala-lang" % "scala-library" % scalacVersion
713697
)
714698

715699
lazy val `dotty-library` = project.in(file("library")).asDottyLibrary(NonBootstrapped)

0 commit comments

Comments
 (0)