diff options
author | Stefan Zeiger <szeiger@novocode.com> | 2015-10-27 14:07:52 +0100 |
---|---|---|
committer | Stefan Zeiger <szeiger@novocode.com> | 2015-12-04 16:22:24 -0800 |
commit | 780ac4124a5bf34a3297b563fa4ea09741aa2d7b (patch) | |
tree | f677bc74a7a5c805a996d6c9e4347cb3dd895bc1 | |
parent | 9fb965e4ef22019dcbd0f7441576df354bb1feb8 (diff) | |
download | scala-780ac4124a5bf34a3297b563fa4ea09741aa2d7b.tar.gz scala-780ac4124a5bf34a3297b563fa4ea09741aa2d7b.tar.bz2 scala-780ac4124a5bf34a3297b563fa4ea09741aa2d7b.zip |
Make all of partest work in the sbt build
- Fix the scoping of files/lib/*.jar. These files were not on the
classpath when running partest from sbt.
- Pass the same standard Java options to partest as from the command
line. This requires new versions of scala-partest and
scala-partest-interface.
- Fix the classpath scanning in jvm/innerClassEnclMethodJavaReflection.
It only worked for JARs and relative directories but not for absolute
directory paths (which are produced by sbt).
-rw-r--r-- | build.sbt | 7 | ||||
-rw-r--r-- | test/files/jvm/innerClassEnclMethodJavaReflection.scala | 9 | ||||
-rw-r--r-- | versions.properties | 2 |
3 files changed, 10 insertions, 8 deletions
@@ -68,7 +68,7 @@ val scalaParserCombinatorsDep = withoutScalaLang("org.scala-lang.modules" %% "sc val scalaSwingDep = withoutScalaLang("org.scala-lang.modules" %% "scala-swing" % versionNumber("scala-swing")) val scalaXmlDep = withoutScalaLang("org.scala-lang.modules" %% "scala-xml" % versionNumber("scala-xml")) val partestDep = withoutScalaLang("org.scala-lang.modules" %% "scala-partest" % versionNumber("partest")) -val partestInterfaceDep = withoutScalaLang("org.scala-lang.modules" %% "scala-partest-interface" % "0.5.0") +val partestInterfaceDep = withoutScalaLang("org.scala-lang.modules" %% "scala-partest-interface" % "0.7.0") val junitDep = "junit" % "junit" % "4.11" val junitIntefaceDep = "com.novocode" % "junit-interface" % "0.11" % "test" val asmDep = "org.scala-lang.modules" % "scala-asm" % versionProps("scala-asm.version") @@ -553,8 +553,8 @@ lazy val test = project .settings( publishArtifact := false, libraryDependencies ++= Seq(asmDep, partestDep, scalaXmlDep, partestInterfaceDep, scalacheckDep), - unmanagedBase in Test := baseDirectory.value / "files" / "lib", - unmanagedJars in Test <+= (unmanagedBase) (j => Attributed.blank(j)) map(identity), + unmanagedBase in IntegrationTest := baseDirectory.value / "files" / "lib", + unmanagedJars in IntegrationTest <+= (unmanagedBase) (j => Attributed.blank(j)) map(identity), // no main sources sources in Compile := Seq.empty, // test sources are compiled in partest run, not here @@ -563,6 +563,7 @@ lazy val test = project javaOptions in IntegrationTest += "-Xmx1G", testFrameworks += new TestFramework("scala.tools.partest.Framework"), testOptions in IntegrationTest += Tests.Setup( () => root.base.getAbsolutePath + "/pull-binary-libs.sh" ! ), + testOptions in IntegrationTest += Tests.Argument("-Dpartest.java_opts=-Xmx1024M -Xms64M -XX:MaxPermSize=128M"), definedTests in IntegrationTest += ( new sbt.TestDefinition( "partest", diff --git a/test/files/jvm/innerClassEnclMethodJavaReflection.scala b/test/files/jvm/innerClassEnclMethodJavaReflection.scala index a4d64d0b67..a60b5cac8e 100644 --- a/test/files/jvm/innerClassEnclMethodJavaReflection.scala +++ b/test/files/jvm/innerClassEnclMethodJavaReflection.scala @@ -25,12 +25,13 @@ object Test extends App { def testClasses(jarOrDirectory: String): Unit = { val classPath = AbstractFile.getDirectory(new java.io.File(jarOrDirectory)) + val basePath = classPath.path + "/" - def flatten(f: AbstractFile): Iterator[AbstractFile] = - if (f.isClassContainer) f.iterator.flatMap(flatten) - else Iterator(f) + def flatten(f: AbstractFile, s: String): Iterator[(AbstractFile, String)] = + if (f.isClassContainer) f.iterator.map(ch => (ch, (if(s.isEmpty) "" else s + "/") + ch.name)).flatMap((flatten _).tupled) + else Iterator((f, s)) - val classFullNames = flatten(classPath).filter(_.hasExtension("class")).map(_.path.replace("/", ".").replaceAll(".class$", "")) + val classFullNames = flatten(classPath, "").filter(_._1.hasExtension("class")).map(_._2.replace("/", ".").replaceAll(".class$", "")) // it seems that Class objects can only be GC'd together with their class loader // (http://stackoverflow.com/questions/2433261/when-and-how-are-classes-garbage-collected-in-java) diff --git a/versions.properties b/versions.properties index 2253921940..145881ab9b 100644 --- a/versions.properties +++ b/versions.properties @@ -36,7 +36,7 @@ jline.version=2.12.1 scala-asm.version=5.0.4-scala-3 # external modules, used internally (not shipped) -partest.version.number=1.0.9 +partest.version.number=1.0.11 scalacheck.version.number=1.11.6 # TODO: modularize the compiler |