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 27d57480f6e2..07d631944a7c 100755 --- a/project/scripts/cmdTests +++ b/project/scripts/cmdTests @@ -1,28 +1,6 @@ #!/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" - -# 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/*" -} +source $(dirname $0)/cmdTestsCommon.inc.sh # check that `sbt dotc` compiles and `sbt dotr` runs it echo "testing sbt dotc and dotr" @@ -50,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) 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/*" +}