summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Kossakowski <grzegorz.kossakowski@gmail.com>2015-03-23 17:13:11 -0700
committerAdriaan Moors <adriaan.moors@typesafe.com>2015-04-17 11:56:52 -0700
commit0e70049f9bcda462fcc30971227bf0c53b90cb9f (patch)
treec2f03f878da27c0fe0a2f253a585d7b390e81306
parentdbb5274ae1a9f8f2a2aa89c18ca22733478743e7 (diff)
downloadscala-0e70049f9bcda462fcc30971227bf0c53b90cb9f.tar.gz
scala-0e70049f9bcda462fcc30971227bf0c53b90cb9f.tar.bz2
scala-0e70049f9bcda462fcc30971227bf0c53b90cb9f.zip
`test/it:test` runs partest regression tests
Partest tests are defined in Integration configuration. This means you need to run them with `test/it:test` command. We put them in separate configuration because they are slow to run so user needs to ask explicitly for partest to run. Introduce a common way of setting jar location so it can be reused between `scalaSubprojectSettings` and `partestJavaAgent`.
-rw-r--r--build.sbt62
1 files changed, 60 insertions, 2 deletions
diff --git a/build.sbt b/build.sbt
index 2f2b30147a..d89bdd8067 100644
--- a/build.sbt
+++ b/build.sbt
@@ -56,10 +56,12 @@ val bootstrapScalaVersion = "2.11.5"
val scalaParserCombinatorsDep = "org.scala-lang.modules" %% "scala-parser-combinators" % versionNumber("scala-parser-combinators") exclude("org.scala-lang", "scala-library")
val scalaXmlDep = "org.scala-lang.modules" %% "scala-xml" % versionNumber("scala-xml") exclude("org.scala-lang", "scala-library")
val partestDep = "org.scala-lang.modules" %% "scala-partest" % versionNumber("partest") exclude("org.scala-lang", "scala-library")
+val partestInterfaceDep = "org.scala-lang.modules" %% "scala-partest-interface" % "0.5.0" exclude("org.scala-lang", "scala-library")
val junitDep = "junit" % "junit" % "4.11"
val junitIntefaceDep = "com.novocode" % "junit-interface" % "0.11" % "test"
val jlineDep = "jline" % "jline" % versionProps("jline.version")
val antDep = "org.apache.ant" % "ant" % "1.9.4"
+val scalacheckDep = "org.scalacheck" %% "scalacheck" % "1.11.4" exclude("org.scala-lang", "scala-library")
lazy val commonSettings = clearSourceAndResourceDirectories ++ Seq[Setting[_]](
organization := "org.scala-lang",
@@ -111,7 +113,7 @@ val disableDocsAndPublishingTasks = Seq[Setting[_]](
packageBin in Compile := file("!!! NO PACKAGING !!!")
)
-lazy val scalaSubprojectSettings = commonSettings ++ Seq[Setting[_]](
+lazy val setJarLocation: Setting[_] =
artifactPath in packageBin in Compile := {
// two lines below are copied over from sbt's sources:
// https://github.com/sbt/sbt/blob/0.13/main/src/main/scala/sbt/Defaults.scala#L628
@@ -123,7 +125,7 @@ lazy val scalaSubprojectSettings = commonSettings ++ Seq[Setting[_]](
val resolvedArtifactName = s"${resolvedArtifact.name}.${resolvedArtifact.extension}"
buildDirectory.value / "pack/lib" / resolvedArtifactName
}
-)
+lazy val scalaSubprojectSettings: Seq[Setting[_]] = commonSettings :+ setJarLocation
lazy val generatePropertiesFileSettings = Seq[Setting[_]](
copyrightString := "Copyright 2002-2013, LAMP/EPFL",
@@ -179,6 +181,10 @@ lazy val compiler = configureAsSubproject(project)
lazy val interactive = configureAsSubproject(project)
.settings(disableDocsAndPublishingTasks: _*)
+ .settings(
+ scalaVersion := bootstrapScalaVersion,
+ ivyScala := ivyScala.value map { _.copy(overrideScalaVersion = true) }
+ )
.dependsOn(compiler)
lazy val repl = configureAsSubproject(project)
@@ -230,6 +236,58 @@ lazy val junit = project.in(file("test") / "junit")
unmanagedSourceDirectories in Test := List(baseDirectory.value)
)
+lazy val partestJavaAgent = (project in file(".") / "src" / "partest-javaagent").
+ dependsOn(asm).
+ settings(commonSettings: _*).
+ settings(
+ doc := file("!!! NO DOCS !!!"),
+ publishLocal := {},
+ publish := {},
+ scalaVersion := bootstrapScalaVersion,
+ ivyScala := ivyScala.value map { _.copy(overrideScalaVersion = true) },
+ // Setting name to "scala-partest-javaagent" so that the jar file gets that name, which the Runner relies on
+ name := "scala-partest-javaagent",
+ // writing jar file to $buildDirectory/pack/lib because that's where it's expected to be found
+ setJarLocation,
+ // add required manifest entry - previously included from file
+ packageOptions in (Compile, packageBin) +=
+ Package.ManifestAttributes( "Premain-Class" -> "scala.tools.partest.javaagent.ProfilingAgent" ),
+ // we need to build this to a JAR
+ exportJars := true
+ )
+
+lazy val test = project.
+ dependsOn(compiler, interactive, actors, repl, scalap, partestExtras, partestJavaAgent, asm, scaladoc).
+ configs(IntegrationTest).
+ settings(disableDocsAndPublishingTasks: _*).
+ settings(commonSettings: _*).
+ settings(Defaults.itSettings: _*).
+ settings(
+ scalaVersion := bootstrapScalaVersion,
+ ivyScala := ivyScala.value map { _.copy(overrideScalaVersion = true) },
+ libraryDependencies ++= Seq(partestDep, scalaXmlDep, partestInterfaceDep, scalacheckDep),
+ unmanagedBase in Test := baseDirectory.value / "files" / "lib",
+ unmanagedJars in Test <+= (unmanagedBase) (j => Attributed.blank(j)) map(identity),
+ // no main sources
+ sources in Compile := Seq.empty,
+ // test sources are compiled in partest run, not here
+ sources in IntegrationTest := Seq.empty,
+ fork in IntegrationTest := true,
+ javaOptions in IntegrationTest += "-Xmx1G",
+ testFrameworks += new TestFramework("scala.tools.partest.Framework"),
+ testOptions in IntegrationTest += Tests.Setup( () => root.base.getAbsolutePath + "/pull-binary-libs.sh" ! ),
+ definedTests in IntegrationTest += (
+ new sbt.TestDefinition(
+ "partest",
+ // marker fingerprint since there are no test classes
+ // to be discovered by sbt:
+ new sbt.testing.AnnotatedFingerprint {
+ def isModule = true
+ def annotationName = "partest"
+ }, true, Array())
+ )
+ )
+
lazy val root = (project in file(".")).
aggregate(library, forkjoin, reflect, compiler, asm, interactive, repl,
scaladoc, scalap, actors, partestExtras, junit).settings(