diff options
-rw-r--r-- | project/Build.scala | 10 | ||||
-rw-r--r-- | test/dotty/partest/DPConsoleRunner.scala | 13 |
2 files changed, 15 insertions, 8 deletions
diff --git a/project/Build.scala b/project/Build.scala index 504185e65..271e54f87 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -74,12 +74,16 @@ object DottyBuild extends Build { partestLockFile.createNewFile partestLockFile.deleteOnExit }, - runPartestRunner <<= Def.taskDyn { + runPartestRunner <<= Def.inputTaskDyn { + // Magic! This is both an input task and a dynamic task. Apparently + // command line arguments get passed to the last task in an aliased + // sequence (see partest alias below), so this works. + val args = Def.spaceDelimited("<arg>").parsed val jars = Seq((packageBin in Compile).value.getAbsolutePath) ++ getJarPaths(partestDeps.value, ivyPaths.value.ivyHome) val dottyJars = "-dottyJars " + jars.length + " " + jars.mkString(" ") // Provide the jars required on the classpath of run tests - runTask(Test, "dotty.partest.DPConsoleRunner", dottyJars) + runTask(Test, "dotty.partest.DPConsoleRunner", dottyJars + " " + args.mkString(" ")) }, // Adjust classpath for running dotty @@ -170,7 +174,7 @@ object DottyBuild extends Build { lazy val partestLockFile = new File("." + File.separator + "tests" + File.separator + "locks" + File.separator + s"partest-$pid.lock") def pid = java.lang.Long.parseLong(java.lang.management.ManagementFactory.getRuntimeMXBean().getName().split("@")(0)) - lazy val runPartestRunner = TaskKey[Unit]("runPartestRunner", "Runs partest") + lazy val runPartestRunner = InputKey[Unit]("runPartestRunner", "Runs partest") lazy val partestDeps = SettingKey[Seq[ModuleID]]("partestDeps", "Finds jars for partest dependencies") def getJarPaths(modules: Seq[ModuleID], ivyHome: Option[File]): Seq[String] = ivyHome match { diff --git a/test/dotty/partest/DPConsoleRunner.scala b/test/dotty/partest/DPConsoleRunner.scala index 31b8467d3..1f3eaa39d 100644 --- a/test/dotty/partest/DPConsoleRunner.scala +++ b/test/dotty/partest/DPConsoleRunner.scala @@ -23,21 +23,24 @@ object DPConsoleRunner { // extra jars for run tests are passed with -dottyJars <count> <jar1> <jar2> ... val jarFinder = """-dottyJars (\d*) (.*)""".r val (jarList, otherArgs) = args.toList.partition(jarFinder.findFirstIn(_).isDefined) - val extraJars = jarList match { + val (extraJars, moreArgs) = jarList match { case Nil => sys.error("Error: DPConsoleRunner needs \"-dottyJars <jarCount> <jars>*\".") case jarFinder(nr, jarString) :: Nil => val jars = jarString.split(" ").toList - if (jars.length.toString != nr) - sys.error("Error: DPConsoleRunner found wrong number of dottyJars: " + jars + ", expected: " + nr + ". Make sure the path doesn't contain any spaces.") - else jars + val count = nr.toInt + if (jars.length < count) + sys.error("Error: DPConsoleRunner found wrong number of dottyJars: " + jars + ", expected: " + nr) + else (jars.take(count), jars.drop(count)) case list => sys.error("Error: DPConsoleRunner found several -dottyJars options: " + list) } - new DPConsoleRunner(otherArgs mkString (" "), extraJars).runPartest + new DPConsoleRunner((otherArgs ::: moreArgs) mkString (" "), extraJars).runPartest } } // console runner has a suite runner which creates a test runner for each test class DPConsoleRunner(args: String, extraJars: List[String]) extends ConsoleRunner(args) { + println("ConsoleRunner options: " + args) + override val suiteRunner = new DPSuiteRunner ( testSourcePath = optSourcePath getOrElse DPConfig.testRoot, fileManager = new DottyFileManager(extraJars), |