diff options
author | Paul Phillips <paulp@improving.org> | 2010-04-21 05:08:25 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2010-04-21 05:08:25 +0000 |
commit | 4214e738c0fc29cbef7bb8c61ddfcd03816d881e (patch) | |
tree | 06c55df26b9807edefea0ca74ee6e7b0e315a09a /src | |
parent | b2deee49ce08b47959c5bc3996f3a01194b00866 (diff) | |
download | scala-4214e738c0fc29cbef7bb8c61ddfcd03816d881e.tar.gz scala-4214e738c0fc29cbef7bb8c61ddfcd03816d881e.tar.bz2 scala-4214e738c0fc29cbef7bb8c61ddfcd03816d881e.zip |
Handled action items (1) and (4) of the phaller...
Handled action items (1) and (4) of the phaller/cunei/rytz agenda
for a less regressive partest, to the extent possible without some
accompanying sbaz changes. Unnecessary sanity check which failed on sane
but non-trunk filesystem layouts removed. Files with custom command
sequences explicitly qualify the path to the filenames listed in the
.cmds file. Review by phaller.
Diffstat (limited to 'src')
-rw-r--r-- | src/partest/scala/tools/partest/Actions.scala | 13 | ||||
-rw-r--r-- | src/partest/scala/tools/partest/Compilable.scala | 14 | ||||
-rw-r--r-- | src/partest/scala/tools/partest/Config.scala | 2 | ||||
-rw-r--r-- | src/partest/scala/tools/partest/Entities.scala | 2 | ||||
-rw-r--r-- | src/partest/scala/tools/partest/Partest.scala | 4 | ||||
-rw-r--r-- | src/partest/scala/tools/partest/category/Compiler.scala | 2 | ||||
-rw-r--r-- | src/partest/scala/tools/partest/io/Logging.scala | 6 |
7 files changed, 18 insertions, 25 deletions
diff --git a/src/partest/scala/tools/partest/Actions.scala b/src/partest/scala/tools/partest/Actions.scala index 54b14ccf46..5cbe64ce23 100644 --- a/src/partest/scala/tools/partest/Actions.scala +++ b/src/partest/scala/tools/partest/Actions.scala @@ -35,11 +35,11 @@ trait Actions { val cmd = fromArgs(args) if (isVerbose) { - trace(execEnv.mkString("ENV(", "\n", "\n)")) + trace("runExec: " + execEnv.mkString("ENV(", "\n", "\n)")) execCwd foreach (x => trace("CWD(" + x + ")")) } - trace(cmd) + trace("runExec: " + cmd) isDryRun || execAndLog(cmd) } @@ -69,20 +69,19 @@ trait Actions { trait ScriptableTest { self: TestEntity => - // def customTestStep(line: String): TestStep - /** Translates a line from a .cmds file into a teststep. */ def customTestStep(line: String): TestStep = { + trace("customTestStep: " + line) val (cmd, rest) = line span (x => !Character.isWhitespace(x)) - val args = toArgs(rest) + def qualify(name: String) = sourcesDir / name path + val args = toArgs(rest) map qualify def fail: TestStep = (_: TestEntity) => error("Parse error: did not understand '%s'" format line) val f: TestEntity => Boolean = cmd match { case "scalac" => _ scalac args case "javac" => _ javac args case "scala" => _ runScala args - case "diff" => if (args.size != 2) fail else _ => diffFiles(File(args(0)), File(args(1))) == "" case _ => fail } f @@ -109,6 +108,8 @@ trait Actions { * to know exactly when and how two-pass compilation fails. */ def compile() = { + trace("compile: " + sourceFiles) + def compileJava() = javac(javaSources) def compileScala() = scalac(scalaSources) def compileAll() = scalac(allSources) diff --git a/src/partest/scala/tools/partest/Compilable.scala b/src/partest/scala/tools/partest/Compilable.scala index 73dcdfce73..ddaa277842 100644 --- a/src/partest/scala/tools/partest/Compilable.scala +++ b/src/partest/scala/tools/partest/Compilable.scala @@ -43,18 +43,12 @@ trait PartestCompilation { def scalac(args: List[String]): Boolean = { val allArgs = assembleScalacArgs(args) val (global, files) = newGlobal(allArgs) - val foundFiles = execCwd match { - case Some(cwd) => files map (x => File(cwd / x)) - case _ => files map (x => File(x)) - } def nonFileArgs = if (isVerbose) global.settings.recreateArgs else assembleScalacArgs(Nil) - def traceArgs = fromArgs(nonFileArgs ++ (foundFiles map tracePath)) - def traceMsg = - if (isVerbose) "%s %s".format(build.scalaBin / "scalac", traceArgs) - else "scalac " + traceArgs + def traceArgs = fromArgs(nonFileArgs ++ (files map tracePath)) + def traceMsg = "scalac " + traceArgs trace(traceMsg) - isDryRun || global.partestCompile(foundFiles map (_.path), true) + isDryRun || global.partestCompile(files, true) } /** Actually running the test, post compilation. @@ -71,7 +65,7 @@ trait PartestCompilation { val cmd = fromArgs(javaCmdAndOptions ++ createPropertyString() ++ scalaCmdAndOptions) def traceMsg = if (isVerbose) cmd else fromArgs(javaCmd :: args) - trace(traceMsg) + trace("runScala: " + traceMsg) isDryRun || execAndLog(cmd) } diff --git a/src/partest/scala/tools/partest/Config.scala b/src/partest/scala/tools/partest/Config.scala index 288a3034e9..2ed096d930 100644 --- a/src/partest/scala/tools/partest/Config.scala +++ b/src/partest/scala/tools/partest/Config.scala @@ -15,7 +15,7 @@ trait Config { lazy val src = absolutize(srcDir).toDirectory lazy val build = new TestBuild() - def javaHomeEnv = envOrElse("JAVA_HOME", null) + def javaHomeEnv = envOrElse("JAVA_HOME", "") def javaCmd = envOrElse("JAVACMD", "java") def javacCmd = Option(javaHomeEnv) map (x => Path(x) / "bin" / "javac" path) getOrElse "javac" diff --git a/src/partest/scala/tools/partest/Entities.scala b/src/partest/scala/tools/partest/Entities.scala index dcb64b19ed..bea505b594 100644 --- a/src/partest/scala/tools/partest/Entities.scala +++ b/src/partest/scala/tools/partest/Entities.scala @@ -23,7 +23,7 @@ trait Entities { def category: TestCategory lazy val label = location.stripExtension - lazy val testClasspath = returning(createClasspathString())(vtrace) + lazy val testClasspath = returning(createClasspathString())(x => vtrace("testClasspath: " + x)) /** Was this test successful? Calling this for the first time forces * lazy val "process" which actually runs the test. diff --git a/src/partest/scala/tools/partest/Partest.scala b/src/partest/scala/tools/partest/Partest.scala index 7efac63354..b3fe9a98ef 100644 --- a/src/partest/scala/tools/partest/Partest.scala +++ b/src/partest/scala/tools/partest/Partest.scala @@ -29,12 +29,8 @@ class Partest(args: List[String]) extends { lazy val testBuildDir = searchForDir(buildDir) lazy val partestDir = searchForDir(rootDir) lazy val allCategories = List(Pos, Neg, Run, Jvm, Res, Shootout, Scalap, Scalacheck, BuildManager, Script) - lazy val selectedCategories = if (isAllImplied) allCategories else specifiedCats - // Coarse validation of partest directory: holds a file called partest. - (partestDir / "partest").isFile || error("'%s' is not a valid partest directory." format partestDir) - def specifiedTests = parsed.residualArgs map (x => Path(x).normalize) def specifiedKinds = testKinds filter (x => isSet(x) || (runSets contains x)) def specifiedCats = specifiedKinds flatMap (x => allCategories find (_.kind == x)) diff --git a/src/partest/scala/tools/partest/category/Compiler.scala b/src/partest/scala/tools/partest/category/Compiler.scala index 6ff963e447..49775d5031 100644 --- a/src/partest/scala/tools/partest/category/Compiler.scala +++ b/src/partest/scala/tools/partest/category/Compiler.scala @@ -123,7 +123,7 @@ trait Compiler { def sendCommand(line: String): Boolean = { val compileRegex = """^>>compile (.*)$""".r val updateRegex = """^>>update\s+(.*)""".r - trace(line drop 2) + trace("send: " + (line drop 2)) isDryRun || (line match { case compileRegex(xs) => pbm.buildManagerCompile(xs) diff --git a/src/partest/scala/tools/partest/io/Logging.scala b/src/partest/scala/tools/partest/io/Logging.scala index 3b7fdc02f7..52239ffb2c 100644 --- a/src/partest/scala/tools/partest/io/Logging.scala +++ b/src/partest/scala/tools/partest/io/Logging.scala @@ -62,8 +62,10 @@ trait Logging { /** For tracing. Outputs a line describing the next action. tracePath * is a path wrapper which prints name or full path depending on verbosity. */ - def trace(msg: String) = if (isTrace || isDryRun) System.err.println(">> [%s] %s".format(label, msg)) - def tracePath(path: Path) = if (isVerbose) path.path else path.name + def trace(msg: String) = if (isTrace || isDryRun) System.err.println(">> [%s] %s".format(label, msg)) + + def tracePath(path: Path): String = if (isVerbose) path.path else path.name + def tracePath(path: String): String = tracePath(Path(path)) /** v == verbose. */ |