From f75c629d17eb2cfb16d3f30f116d1d0ffbcdb851 Mon Sep 17 00:00:00 2001 From: Etienne Kneuss <ekneuss@gmail.com> Date: Fri, 12 Feb 2016 17:24:56 +0100 Subject: [PATCH] Run tests in parallel when asked only (-Dparallel=123) --- .larabot.conf | 8 ++++---- build.sbt | 22 +++++++++++++++++++--- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/.larabot.conf b/.larabot.conf index 6a037e0ad..22677f335 100644 --- a/.larabot.conf +++ b/.larabot.conf @@ -1,8 +1,8 @@ commands = [ - "sbt -batch test" - "sbt -batch integration:test" - "sbt -batch regression:test" - "sbt -batch genc:test" + "sbt -batch -Dparallel=10 test" + "sbt -batch -Dparallel=10 integration:test" + "sbt -batch -Dparallel=10 regression:test" + "sbt -batch -Dparallel=10 genc:test" ] trusted = [ diff --git a/build.sbt b/build.sbt index 0e3e147a1..6507f84a7 100644 --- a/build.sbt +++ b/build.sbt @@ -56,6 +56,20 @@ clean := { } } +lazy val nParallel = { + val p = System.getProperty("parallel") + if (p ne null) { + try { + p.toInt + } catch { + case nfe: NumberFormatException => + 1 + } + } else { + 1 + } +} + lazy val script = taskKey[Unit]("Generate the leon Bash script") script := { @@ -107,14 +121,17 @@ sourcesInBase in Compile := false Keys.fork in run := true + lazy val testSettings = Seq( //Keys.fork := true, - logBuffered := true, - parallelExecution := true + logBuffered := (nParallel > 1), + parallelExecution := (nParallel > 1) //testForkedParallel := true, //javaOptions ++= Seq("-Xss64M", "-Xmx4G") ) +concurrentRestrictions in Global += Tags.limit(Tags.Test, nParallel) + // Unit Tests testOptions in Test := Seq(Tests.Argument("-oDF"), Tests.Filter(_ startsWith "leon.unit.")) @@ -138,7 +155,6 @@ lazy val IsabelleTest = config("isabelle") extend(Test) testOptions in IsabelleTest := Seq(Tests.Argument("-oDF"), Tests.Filter(_ startsWith "leon.isabelle.")) parallelExecution in IsabelleTest := false - fork in IsabelleTest := true // GenC Tests -- GitLab