diff options
author | Iulian Dragos <jaguarul@gmail.com> | 2011-01-24 19:17:32 +0000 |
---|---|---|
committer | Iulian Dragos <jaguarul@gmail.com> | 2011-01-24 19:17:32 +0000 |
commit | f253b67d4a50a066fb91ce03fa1eb12db9a9c1e0 (patch) | |
tree | 17921974620182355dab935e09f864a24cd5789d /src/partest | |
parent | e07ca49a24d15ab1b279203ad208153a44732550 (diff) | |
download | scala-f253b67d4a50a066fb91ce03fa1eb12db9a9c1e0.tar.gz scala-f253b67d4a50a066fb91ce03fa1eb12db9a9c1e0.tar.bz2 scala-f253b67d4a50a066fb91ce03fa1eb12db9a9c1e0.zip |
Added presentation compiler tests.
Diffstat (limited to 'src/partest')
5 files changed, 40 insertions, 13 deletions
diff --git a/src/partest/scala/tools/partest/PartestTask.scala b/src/partest/scala/tools/partest/PartestTask.scala index e49c5a5c6e..551500e626 100644 --- a/src/partest/scala/tools/partest/PartestTask.scala +++ b/src/partest/scala/tools/partest/PartestTask.scala @@ -72,6 +72,11 @@ class PartestTask extends Task with CompilationPathProperty { specializedFiles = Some(input) } + def addConfiguredPresentationTests(input: FileSet) { + presentationFiles = Some(input) + } + + def setSrcDir(input: String) { srcDir = Some(input) } @@ -146,6 +151,7 @@ class PartestTask extends Task with CompilationPathProperty { private var shootoutFiles: Option[FileSet] = None private var scalapFiles: Option[FileSet] = None private var specializedFiles: Option[FileSet] = None + private var presentationFiles: Option[FileSet] = None private var errorOnFailed: Boolean = false private var scalacOpts: Option[String] = None private var timeout: Option[String] = None @@ -170,14 +176,25 @@ class PartestTask extends Task with CompilationPathProperty { // println("----> " + fileSet) val fileTests = getFiles(Some(fs)) filterNot (x => shouldExclude(x.getName)) - val dirTests: Iterator[SPath] = fileSetToDir(fs).dirs filterNot (x => shouldExclude(x.name)) - val dirResult = dirTests.toList.toArray map (_.jfile) + val dirResult = getDirs(Some(fs)) filterNot (x => shouldExclude(x.getName)) // println("dirs: " + dirResult.toList) // println("files: " + fileTests.toList) dirResult ++ fileTests } + private def getDirs(fileSet: Option[FileSet]): Array[File] = fileSet match { + case None => Array() + case Some(fs) => + def shouldExclude(name: String) = (name endsWith ".obj") || (name startsWith ".") + + val dirTests: Iterator[SPath] = fileSetToDir(fs).dirs filterNot (x => shouldExclude(x.name)) + val dirResult = dirTests.toList.toArray map (_.jfile) + + dirResult + } + + private def getPosFiles = getFilesAndDirs(posFiles) private def getNegFiles = getFilesAndDirs(negFiles) private def getRunFiles = getFilesAndDirs(runFiles) @@ -189,6 +206,7 @@ class PartestTask extends Task with CompilationPathProperty { private def getShootoutFiles = getFiles(shootoutFiles) private def getScalapFiles = getFiles(scalapFiles) private def getSpecializedFiles = getFiles(specializedFiles) + private def getPresentationFiles = getDirs(presentationFiles) override def execute() { if (isPartestDebug || debug) { @@ -236,7 +254,8 @@ class PartestTask extends Task with CompilationPathProperty { (getScriptFiles, "script", "Running script files"), (getShootoutFiles, "shootout", "Running shootout tests"), (getScalapFiles, "scalap", "Running scalap tests"), - (getSpecializedFiles, "specialized", "Running specialized files") + (getSpecializedFiles, "specialized", "Running specialized files"), + (getPresentationFiles, "presentation", "Running presentation compiler test files") ) def runSet(set: TFSet): (Int, Int, Iterable[String]) = { diff --git a/src/partest/scala/tools/partest/nest/CompileManager.scala b/src/partest/scala/tools/partest/nest/CompileManager.scala index b9067a95ac..42e4d02934 100644 --- a/src/partest/scala/tools/partest/nest/CompileManager.scala +++ b/src/partest/scala/tools/partest/nest/CompileManager.scala @@ -84,14 +84,15 @@ class DirectCompiler(val fileManager: FileManager) extends SimpleCompiler { val testRep: ExtConsoleReporter = global.reporter.asInstanceOf[ExtConsoleReporter] val testFileFn: (File, FileManager) => TestFile = kind match { - case "pos" => PosTestFile.apply - case "neg" => NegTestFile.apply - case "run" => RunTestFile.apply - case "jvm" => JvmTestFile.apply - case "shootout" => ShootoutTestFile.apply - case "scalap" => ScalapTestFile.apply - case "scalacheck" => ScalaCheckTestFile.apply - case "specialized" => SpecializedTestFile.apply + case "pos" => PosTestFile.apply + case "neg" => NegTestFile.apply + case "run" => RunTestFile.apply + case "jvm" => JvmTestFile.apply + case "shootout" => ShootoutTestFile.apply + case "scalap" => ScalapTestFile.apply + case "scalacheck" => ScalaCheckTestFile.apply + case "specialized" => SpecializedTestFile.apply + case "presentation" => PresentationTestFile.apply } val test: TestFile = testFileFn(files.head, fileManager) test.defineSettings(command.settings, out.isEmpty) diff --git a/src/partest/scala/tools/partest/nest/ConsoleRunner.scala b/src/partest/scala/tools/partest/nest/ConsoleRunner.scala index b99f3d37bd..b665974ec8 100644 --- a/src/partest/scala/tools/partest/nest/ConsoleRunner.scala +++ b/src/partest/scala/tools/partest/nest/ConsoleRunner.scala @@ -36,7 +36,8 @@ class ConsoleRunner extends DirectRunner { TestSet("script", pathFilter, "Testing script tests"), TestSet("scalacheck", x => pathFilter(x) || x.isDirectory, "Testing ScalaCheck tests"), TestSet("scalap", _.isDirectory, "Run scalap decompiler tests"), - TestSet("specialized", pathFilter, "Testing specialized tests") + TestSet("specialized", pathFilter, "Testing specialized tests"), + TestSet("presentation", _.isDirectory, "Testing presentation compiler tests.") ) } @@ -57,7 +58,7 @@ class ConsoleRunner extends DirectRunner { private val unaryArgs = List( "--pack", "--all", "--verbose", "--show-diff", "--show-log", - "--failed", "--update-check", "--version", "--ansi", "--debug" + "--failed", "--update-check", "--version", "--ansi", "--debug", "--help" ) ::: testSetArgs private val binaryArgs = List( @@ -71,6 +72,7 @@ class ConsoleRunner extends DirectRunner { /** Early return on no args, version, or invalid args */ if (argstr == "") return NestUI.usage() if (parsed isSet "--version") return printVersion + if (parsed isSet "--help") return NestUI.usage() if (args exists (x => !denotesTestPath(x))) { val invalid = (args filterNot denotesTestPath).head NestUI.failure("Invalid argument '%s'\n" format invalid) diff --git a/src/partest/scala/tools/partest/nest/TestFile.scala b/src/partest/scala/tools/partest/nest/TestFile.scala index 636c29a050..9bfb4a992a 100644 --- a/src/partest/scala/tools/partest/nest/TestFile.scala +++ b/src/partest/scala/tools/partest/nest/TestFile.scala @@ -55,3 +55,4 @@ case class SpecializedTestFile(file: JFile, fileManager: FileManager) extends Te settings.classpath.value = ClassPath.join(PathSettings.srcSpecLib.toString, settings.classpath.value) } } +case class PresentationTestFile(file: JFile, fileManager: FileManager) extends TestFile("presentation") diff --git a/src/partest/scala/tools/partest/nest/Worker.scala b/src/partest/scala/tools/partest/nest/Worker.scala index 71d446f4ef..2278cb4def 100644 --- a/src/partest/scala/tools/partest/nest/Worker.scala +++ b/src/partest/scala/tools/partest/nest/Worker.scala @@ -315,6 +315,7 @@ class Worker(val fileManager: FileManager, params: TestRunParams) extends Actor "-Dpartest.output="+outDir.getAbsolutePath, "-Dpartest.lib="+LATEST_LIB, "-Dpartest.cwd="+outDir.getParent, + "-Dpartest.testname="+fileBase, "-Djavacmd="+JAVACMD, "-Djavaccmd="+javacCmd, "-Duser.language=en -Duser.country=US" @@ -593,6 +594,9 @@ class Worker(val fileManager: FileManager, params: TestRunParams) extends Actor case "specialized" => runSpecializedTest(file) + case "presentation" => + runJvmTest(file) // for the moment, it's exactly the same as for a run test + case "buildmanager" => val logFile = createLogFile(file) if (!fileManager.failed || logFile.canRead) { |