From 225ace260f614deb74c8770608c4c9109d336bba Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Fri, 19 Jan 2018 03:12:15 -0800 Subject: Get Travis CI green again after adding Ammonite integration test --- build.sbt | 6 +++- ci/test.sh | 4 ++- ci/test2.sh | 5 ++- ci/test3.sh | 6 +++- .../src/main/scala/mill/scalalib/TestRunner.scala | 38 ++++++++++++---------- 5 files changed, 38 insertions(+), 21 deletions(-) diff --git a/build.sbt b/build.sbt index ca1a745f..e3a7e00d 100644 --- a/build.sbt +++ b/build.sbt @@ -1,5 +1,7 @@ import java.io.File +parallelExecution := false + val sharedSettings = Seq( scalaVersion := "2.12.4", organization := "com.lihaoyi", @@ -7,6 +9,7 @@ val sharedSettings = Seq( testFrameworks += new TestFramework("mill.UTestFramework"), + parallelExecution in Test := false, test in assembly := {}, @@ -238,11 +241,12 @@ lazy val bin = project mainClass in (Test, run) := Some("mill.Main"), baseDirectory in (Test, run) := (baseDirectory in (Compile, run)).value / ".." / "..", assemblyOption in assembly := { + val extraArgs = (bridgeProps.value ++ jsbridgeProps.value).mkString(" ") (assemblyOption in assembly).value.copy( prependShellScript = Some( Seq( "#!/usr/bin/env sh", - s"""exec java ${(bridgeProps.value ++ jsbridgeProps.value).mkString(" ")} -cp "$$0" mill.Main "$$@" """ + s"""exec java $extraArgs $$JAVA_OPTS -cp "$$0" mill.Main "$$@" """ ) ) ) diff --git a/ci/test.sh b/ci/test.sh index 78060622..f77456f7 100755 --- a/ci/test.sh +++ b/ci/test.sh @@ -6,4 +6,6 @@ set -eux git clean -xdf # First build & run tests using SBT -sbt core/test scalalib/test scalajslib/test integration/test bin/test:assembly +sbt core/test scalalib/test scalajslib/test +sbt integration/test +sbt bin/test:assembly diff --git a/ci/test2.sh b/ci/test2.sh index 9d84ecdc..ebb3ddb5 100755 --- a/ci/test2.sh +++ b/ci/test2.sh @@ -8,4 +8,7 @@ git clean -xdf sbt bin/test:assembly # Run tests using Mill built using SBT -target/bin/mill --all {core,scalalib,scalajslib,integration}.test devAssembly +target/bin/mill --all {core,scalalib,scalajslib}.test devAssembly +target/bin/mill integration.test mill.integration.AmmoniteTests +target/bin/mill integration.test "mill.integration.{AcyclicTests,BetterFilesTests,JawnTests}" +target/bin/mill devAssembly diff --git a/ci/test3.sh b/ci/test3.sh index ffeb259c..b10da68d 100755 --- a/ci/test3.sh +++ b/ci/test3.sh @@ -12,4 +12,8 @@ sbt bin/test:assembly target/bin/mill devAssembly # Second build & run tests using Mill -out/devAssembly/dest --all {core,scalalib,scalajslib,integration}.test devAssembly + +out/devAssembly/dest --all {core,scalalib,scalajslib}.test devAssembly +out/devAssembly/dest integration.test mill.integration.AmmoniteTests +out/devAssembly/dest integration.test "mill.integration.{AcyclicTests,BetterFilesTests,JawnTests}" +out/devAssembly/dest devAssembly diff --git a/scalalib/src/main/scala/mill/scalalib/TestRunner.scala b/scalalib/src/main/scala/mill/scalalib/TestRunner.scala index fa387eef..01726022 100644 --- a/scalalib/src/main/scala/mill/scalalib/TestRunner.scala +++ b/scalalib/src/main/scala/mill/scalalib/TestRunner.scala @@ -48,23 +48,27 @@ object TestRunner { testClasses } def main(args: Array[String]): Unit = { - val result = apply( - frameworkName = args(0), - entireClasspath = Agg.from(args(1).split(" ").map(Path(_))), - testClassfilePath = Agg.from(args(2).split(" ").map(Path(_))), - args = args(3) match{ case "" => Nil case x => x.split(" ").toList } - )(new PrintLogger( - args(5) == "true", - if(args(5) == "true") Colors.Default - else Colors.BlackWhite, - System.out, - System.err, - System.err - )) - val outputPath = args(4) - - ammonite.ops.write(Path(outputPath), upickle.default.write(result)) - + try{ + val result = apply( + frameworkName = args(0), + entireClasspath = Agg.from(args(1).split(" ").map(Path(_))), + testClassfilePath = Agg.from(args(2).split(" ").map(Path(_))), + args = args(3) match{ case "" => Nil case x => x.split(" ").toList } + )(new PrintLogger( + args(5) == "true", + if(args(5) == "true") Colors.Default + else Colors.BlackWhite, + System.out, + System.err, + System.err + )) + val outputPath = args(4) + + ammonite.ops.write(Path(outputPath), upickle.default.write(result)) + }catch{case e: Throwable => + println(e) + e.printStackTrace() + } // Tests are over, kill the JVM whether or not anyone's threads are still running // Always return 0, even if tests fail. The caller can pick up the detailed test // results from the outputPath -- cgit v1.2.3