From 95f6192c39d4cd92fa387a094fea50a102c291d6 Mon Sep 17 00:00:00 2001
From: "Paolo G. Giarrusso"
Date: Sun, 26 Aug 2018 15:56:03 +0200
Subject: [PATCH 1/2] cmdTests: Abstract some setup code
---
project/scripts/cmdTests | 19 +------------------
project/scripts/cmdTestsCommon.inc.sh | 18 ++++++++++++++++++
2 files changed, 19 insertions(+), 18 deletions(-)
create mode 100644 project/scripts/cmdTestsCommon.inc.sh
diff --git a/project/scripts/cmdTests b/project/scripts/cmdTests
index 27d57480f6e2..5a4ae6990803 100755
--- a/project/scripts/cmdTests
+++ b/project/scripts/cmdTests
@@ -1,29 +1,12 @@
#!/usr/bin/env bash
-set -eux
-
-SBT="./project/scripts/sbt" # if run on CI
-# SBT="sbt" # if run locally
-
-SOURCE="tests/pos/HelloWorld.scala"
-MAIN="HelloWorld"
-EXPECTED_OUTPUT="hello world"
+source $(dirname $0)/cmdTestsCommon.inc.sh
# check that benchmarks can run
"$SBT" "dotty-bench/jmh:run 1 1 tests/pos/alias.scala"
"$SBT" "dotty-bench-bootstrapped/jmh:run 1 1 tests/pos/alias.scala"
"$SBT" "dotty-bench-bootstrapped/jmh:run 1 1 -with-compiler compiler/src/dotty/tools/dotc/core/Types.scala"
-OUT=$(mktemp -d)
-OUT1=$(mktemp -d)
-tmp=$(mktemp)
-
-clear_out()
-{
- local out="$1"
- rm -rf "$out/*"
-}
-
# check that `sbt dotc` compiles and `sbt dotr` runs it
echo "testing sbt dotc and dotr"
"$SBT" ";dotc $SOURCE -d $OUT ;dotr -classpath $OUT $MAIN" > "$tmp"
diff --git a/project/scripts/cmdTestsCommon.inc.sh b/project/scripts/cmdTestsCommon.inc.sh
new file mode 100644
index 000000000000..a5e3ed7c1c5f
--- /dev/null
+++ b/project/scripts/cmdTestsCommon.inc.sh
@@ -0,0 +1,18 @@
+set -eux
+
+SBT="./project/scripts/sbt" # if run on CI
+# SBT="sbt" # if run locally
+
+SOURCE="tests/pos/HelloWorld.scala"
+MAIN="HelloWorld"
+EXPECTED_OUTPUT="hello world"
+
+OUT=$(mktemp -d)
+OUT1=$(mktemp -d)
+tmp=$(mktemp)
+
+clear_out()
+{
+ local out="$1"
+ rm -rf "$out/*"
+}
From 7b27debc0d25ab825a498eb0a83f73dc2e004d18 Mon Sep 17 00:00:00 2001
From: "Paolo G. Giarrusso"
Date: Sun, 26 Aug 2018 15:59:04 +0200
Subject: [PATCH 2/2] Don't bootstrap on non-bootstrap CI job
The bootstrap is already done on the other job, and even tho it's not so
expensive, moving the tests there will help balance the job runtime.
---
.drone.yml | 1 +
project/scripts/bootstrapCmdTests | 37 +++++++++++++++++++++++++++++++
project/scripts/cmdTests | 33 ---------------------------
3 files changed, 38 insertions(+), 33 deletions(-)
create mode 100755 project/scripts/bootstrapCmdTests
diff --git a/.drone.yml b/.drone.yml
index 88e6fe8e4007..901fede8e4d4 100644
--- a/.drone.yml
+++ b/.drone.yml
@@ -35,6 +35,7 @@ pipeline:
commands:
- cp -R . /tmp/2/ && cd /tmp/2/
- ./project/scripts/sbt ";dotty-bootstrapped/compile ;dotty-bootstrapped/test"
+ - ./project/scripts/bootstrapCmdTests
test_sbt:
group: test
diff --git a/project/scripts/bootstrapCmdTests b/project/scripts/bootstrapCmdTests
new file mode 100755
index 000000000000..d87dc562a892
--- /dev/null
+++ b/project/scripts/bootstrapCmdTests
@@ -0,0 +1,37 @@
+#!/usr/bin/env bash
+
+source $(dirname $0)/cmdTestsCommon.inc.sh
+
+# check that benchmarks can run
+"$SBT" "dotty-bench/jmh:run 1 1 tests/pos/alias.scala"
+# The above is here as it relies on the bootstrapped library.
+"$SBT" "dotty-bench-bootstrapped/jmh:run 1 1 tests/pos/alias.scala"
+"$SBT" "dotty-bench-bootstrapped/jmh:run 1 1 -with-compiler compiler/src/dotty/tools/dotc/core/Types.scala"
+
+echo "testing scala.quoted.Expr.run from sbt dotr"
+"$SBT" ";dotty-compiler-bootstrapped/dotc tests/run-with-compiler/quote-run.scala; dotty-compiler-bootstrapped/dotr -with-compiler Test" > "$tmp"
+grep -qe "val a: scala.Int = 3" "$tmp"
+
+
+# setup for `dotc`/`dotr` script tests
+"$SBT" dist-bootstrapped/pack
+
+# check that `dotc` compiles and `dotr` runs it
+echo "testing ./bin/dotc and ./bin/dotr"
+clear_out "$OUT"
+./bin/dotc "$SOURCE" -d "$OUT"
+./bin/dotr -classpath "$OUT" "$MAIN" > "$tmp"
+test "$EXPECTED_OUTPUT" = "$(cat "$tmp")"
+
+# check that `dotc -from-tasty` compiles and `dotr` runs it
+echo "testing ./bin/dotc -from-tasty and dotr -classpath"
+clear_out "$OUT1"
+./bin/dotc -from-tasty -classpath "$OUT" -d "$OUT1" "$MAIN"
+./bin/dotr -classpath "$OUT1" "$MAIN" > "$tmp"
+test "$EXPECTED_OUTPUT" = "$(cat "$tmp")"
+
+# echo ":quit" | ./dist-bootstrapped/target/pack/bin/dotr # not supported by CI
+
+echo "testing ./bin/dotd"
+clear_out "$OUT"
+./bin/dotd -project Hello -siteroot "$OUT" "$SOURCE"
diff --git a/project/scripts/cmdTests b/project/scripts/cmdTests
index 5a4ae6990803..07d631944a7c 100755
--- a/project/scripts/cmdTests
+++ b/project/scripts/cmdTests
@@ -2,11 +2,6 @@
source $(dirname $0)/cmdTestsCommon.inc.sh
-# check that benchmarks can run
-"$SBT" "dotty-bench/jmh:run 1 1 tests/pos/alias.scala"
-"$SBT" "dotty-bench-bootstrapped/jmh:run 1 1 tests/pos/alias.scala"
-"$SBT" "dotty-bench-bootstrapped/jmh:run 1 1 -with-compiler compiler/src/dotty/tools/dotc/core/Types.scala"
-
# check that `sbt dotc` compiles and `sbt dotr` runs it
echo "testing sbt dotc and dotr"
"$SBT" ";dotc $SOURCE -d $OUT ;dotr -classpath $OUT $MAIN" > "$tmp"
@@ -33,34 +28,6 @@ clear_out "$OUT"
"$SBT" ";dotc -d $OUT/out.jar $SOURCE; dotc -decompile -classpath $OUT/out.jar -color:never $MAIN" > "$tmp"
grep -qe "def main(args: scala.Array\[scala.Predef.String\]): scala.Unit =" "$tmp"
-echo "testing scala.quoted.Expr.run from sbt dotr"
-"$SBT" ";dotty-compiler-bootstrapped/dotc tests/run-with-compiler/quote-run.scala; dotty-compiler-bootstrapped/dotr -with-compiler Test" > "$tmp"
-grep -qe "val a: scala.Int = 3" "$tmp"
-
-
-# setup for `dotc`/`dotr` script tests
-"$SBT" dist-bootstrapped/pack
-
-# check that `dotc` compiles and `dotr` runs it
-echo "testing ./bin/dotc and ./bin/dotr"
-clear_out "$OUT"
-./bin/dotc "$SOURCE" -d "$OUT"
-./bin/dotr -classpath "$OUT" "$MAIN" > "$tmp"
-test "$EXPECTED_OUTPUT" = "$(cat "$tmp")"
-
-# check that `dotc -from-tasty` compiles and `dotr` runs it
-echo "testing ./bin/dotc -from-tasty and dotr -classpath"
-clear_out "$OUT1"
-./bin/dotc -from-tasty -classpath "$OUT" -d "$OUT1" "$MAIN"
-./bin/dotr -classpath "$OUT1" "$MAIN" > "$tmp"
-test "$EXPECTED_OUTPUT" = "$(cat "$tmp")"
-
-# echo ":quit" | ./dist-bootstrapped/target/pack/bin/dotr # not supported by CI
-
-echo "testing ./bin/dotd"
-clear_out "$OUT"
-./bin/dotd -project Hello -siteroot "$OUT" "$SOURCE"
-
## Disabled because of flakeyness, should be changed to not depend on sbt
# echo "running Vulpix meta test"
# tmp=$(mktemp)