summaryrefslogtreecommitdiff
path: root/project
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2010-09-14 04:48:30 +0000
committerPaul Phillips <paulp@improving.org>2010-09-14 04:48:30 +0000
commitc40a798bf0b9ebe26385d42dbd90edc61ca0896d (patch)
tree746508b3b4ae7f25a0d59d17cf8ccd55bad05b68 /project
parent964cceed6db7b028d694521d251f236ca0c0ccb5 (diff)
downloadscala-c40a798bf0b9ebe26385d42dbd90edc61ca0896d.tar.gz
scala-c40a798bf0b9ebe26385d42dbd90edc61ca0896d.tar.bz2
scala-c40a798bf0b9ebe26385d42dbd90edc61ca0896d.zip
Couldn't bear to see sbt seemingly so close but...
Couldn't bear to see sbt seemingly so close but still unable to run tests. Made some progress but bogged down in scalacheck when I realized things were farther from working than I'd thought. Please forgive this brief expression of frustration, because the despair is palpable: the weeks of work I did on partest was apparently of no interest, and now I'm in here having to fix the same partest bugs again, in a more virulent form. They've evolved into some kind of ant-partest-sbt artificial creature, more fearsome than any one of them could be under its own power. Did we not know we have a whole directory full of pretty code like this? List( "Scala compiler classes in: " + testBuildDir, "Scala version is: " + nsc.Properties.versionMsg, "Scalac options are: " + universe.scalacOpts, "Java binaries in: " + javaBin, "Java runtime is: " + javaInfoString, "Java runtime options: " + (Process.javaVmArguments mkString " "), "Javac options are: " + universe.javacOpts, "Java options are: " + universe.javaOpts, "Source directory is: " + src, "Selected categories: " + (selectedCategories mkString " "), "" ) mkString "\n" It's src/partest-alternative in case anyone wants to consider any of it. At the very least there are individual files or functions which could be cherry picked. -- This patch contains: -- Readability efforts. Twelve parameter functions whose last six parameters are "true,true,failedOnly,true,false,log" are pretty challenging to work with. Changes to the environment variables sbt was setting to look a bit more like what partest expects and will crash without. Sets partest.debug=true if the sbt logger level is at Debug. On my machine all test groups except scalacheck appear to run to completion. Review by moix. (Hello, moix! I am available for assistance if you are in the market for it. You have brought us long suffering ant-ers to the brink of sbt goodness: and now, we enter the fray!)
Diffstat (limited to 'project')
-rwxr-xr-xproject/build/Partest.scala56
1 files changed, 31 insertions, 25 deletions
diff --git a/project/build/Partest.scala b/project/build/Partest.scala
index 5a6cdc2506..009064c005 100755
--- a/project/build/Partest.scala
+++ b/project/build/Partest.scala
@@ -29,24 +29,23 @@ class TestConfiguration(val library:Path, val classpath:Iterable[Path], val test
trait PartestRunner{
self: BasicLayer with Packer =>
- import Partest.{runTest}
+ import Partest.runTest
import TestSetType._
-
- lazy val testRoot = projectRoot / "test"
+ lazy val testRoot = projectRoot / "test"
lazy val testFiles = testRoot / "files" ##
- lazy val testLibs = testFiles / "lib"
+ lazy val testLibs = testFiles / "lib"
- lazy val posFilesTest = TestSet(Std,"pos", "Compiling files that are expected to build", testFiles / "pos" * ("*.scala" || DirectoryFilter))
- lazy val negFilesTest = TestSet(Std,"neg", "Compiling files that are expected to fail", testFiles / "neg" * ("*.scala" || DirectoryFilter))
- lazy val runFilesTest = TestSet(Std,"run", "Compiling and running files", testFiles / "run" ** ("*.scala" ))
- lazy val jvmFilesTest = TestSet(Std,"jvm", "Compiling and running files", testFiles / "jvm" *("*.scala" || DirectoryFilter))
- lazy val resFilesTest = TestSet(Std,"res", "Running resident compiler scenarii", testFiles / "res" * ("*.res"))
+ lazy val posFilesTest = TestSet(Std,"pos", "Compiling files that are expected to build", testFiles / "pos" * ("*.scala" || DirectoryFilter))
+ lazy val negFilesTest = TestSet(Std,"neg", "Compiling files that are expected to fail", testFiles / "neg" * ("*.scala" || DirectoryFilter))
+ lazy val runFilesTest = TestSet(Std,"run", "Compiling and running files", testFiles / "run" ** ("*.scala" ))
+ lazy val jvmFilesTest = TestSet(Std,"jvm", "Compiling and running files", testFiles / "jvm" *("*.scala" || DirectoryFilter))
+ lazy val resFilesTest = TestSet(Std,"res", "Running resident compiler scenarii", testFiles / "res" * ("*.res"))
lazy val buildmanagerFilesTest = TestSet(Std,"buildmanager", "Running Build Manager scenarii", testFiles / "buildmanager" * DirectoryFilter)
- lazy val scalacheckFilesTest = TestSet(Std,"scalacheck", "Running scalacheck tests", testFiles / "scalacheck" ** ("*.scala"))
- lazy val scriptFilesTest = TestSet(Std,"script", "Running script files", testFiles / "script" * ("*.scala"))
- lazy val shootoutFilesTest = TestSet(Std,"shootout", "Running shootout tests", testFiles / "shootout" * ("*.scala"))
- lazy val scalapFilesTest = TestSet(Std,"scalap", "Running scalap tests", testFiles / "scalap" ** ("*.scala"))
+ lazy val scalacheckFilesTest = TestSet(Std,"scalacheck", "Running scalacheck tests", testFiles / "scalacheck" ** ("*.scala"))
+ lazy val scriptFilesTest = TestSet(Std,"script", "Running script files", testFiles / "script" * ("*.scala"))
+ lazy val shootoutFilesTest = TestSet(Std,"shootout", "Running shootout tests", testFiles / "shootout" * ("*.scala"))
+ lazy val scalapFilesTest = TestSet(Std,"scalap", "Running scalap tests", testFiles / "scalap" ** ("*.scala"))
lazy val negContinuationTest = TestSet(Continuations,"neg", "Compiling continuations files that are expected to fail", testFiles / "continuations-neg" * ("*.scala" || DirectoryFilter))
lazy val runContinuationTest = TestSet(Continuations,"run", "Compiling and running continuations files", testFiles / "continuations-run" ** ("*.scala" ))
@@ -63,7 +62,7 @@ trait PartestRunner{
private lazy val partestCompletionList = filesTestMap.keys.toList:::partestOptions:::filesTestMap.values.toList.flatMap{_.files.map(_.toString.substring(testFiles.asFile.toString.length+1))}
- private def runPartest(tests:List[TestSet],scalacOpts:Option[String], failedOnly:Boolean) = {
+ private def runPartest(tests:List[TestSet],scalacOpts:Option[String], failedOnly:Boolean) = {
val config = new TestConfiguration(
outputLibraryJar,
@@ -74,14 +73,23 @@ trait PartestRunner{
)
val javaHome = Path.fromFile(new File(System.getProperty("java.home")))
- val java = javaHome / "bin" / "java"
- val javac = javaHome/"bin"/"javac"
+ val java = Some(javaHome / "bin" / "java" asFile)
+ val javac = Some(javaHome / "bin" / "javac" asFile)
+ val timeout = Some("2400000")
+ val loader = info.launcher.topLoader
+ val isDebug = info.logger atLevel Level.Debug
+
log.debug("Ready to run tests")
- if (tests.isEmpty){
+
+ if (tests.isEmpty) {
log.debug("Empty test list")
None
- }else
- runTest(info.launcher.topLoader,config,Some(java.asFile),Some(javac.asFile),scalacOpts,Some("2400000"), true,true,failedOnly,true,false,log)
+ }
+ else runTest(
+ loader, config, java, javac,
+ scalacOpts, timeout, true, true,
+ failedOnly, true, isDebug, log
+ )
}
lazy val externalPartest = task {args => task {
@@ -107,7 +115,7 @@ trait PartestRunner{
- def resolveSets(l:List[String],rem:List[String],acc:List[TestSet]):(List[String],List[TestSet]) = {
+ def resolveSets(l:List[String],rem:List[String],acc:List[TestSet]): (List[String], List[TestSet]) = {
def searchSet(arg:String):Option[TestSet] = {
filesTestMap.get(arg)
}
@@ -202,7 +210,7 @@ object Partest {
setMethod.invoke(fileManager, Array(value).asInstanceOf[Array[Object]]: _*)
}
- System.setProperty("partest.srcdir",config.testRoot.absolutePath)
+ // System.setProperty("partest.srcdir", "files")
setFileManagerBooleanProperty("showDiff", showDiff)
setFileManagerBooleanProperty("showLog", showLog)
@@ -213,10 +221,8 @@ object Partest {
setFileManagerStringProperty("JAVAC_CMD", "javac")
setFileManagerStringProperty("CLASSPATH",(config.classpath.map(_.absolutePath).mkString(File.pathSeparator)))
setFileManagerStringProperty("LATEST_LIB", config.library.absolutePath)
- scalacOpts match {
- case None => setFileManagerStringProperty("SCALAC_OPTS","")
- case Some(options) => setFileManagerStringProperty("SCALAC_OPTS",options)
- }
+ setFileManagerStringProperty("SCALAC_OPTS", scalacOpts getOrElse "")
+
if (!timeout.isEmpty)
setFileManagerStringProperty("timeout", timeout.get)