|
1 | 1 | #!/usr/bin/env bash |
2 | 2 |
|
3 | | -set -eux |
4 | | - |
5 | | -SBT="./project/scripts/sbt" # if run on CI |
6 | | -# SBT="sbt" # if run locally |
7 | | - |
8 | | -SOURCE="tests/pos/HelloWorld.scala" |
9 | | -MAIN="HelloWorld" |
10 | | -EXPECTED_OUTPUT="hello world" |
11 | | - |
12 | | -# check that benchmarks can run |
13 | | -"$SBT" "dotty-bench/jmh:run 1 1 tests/pos/alias.scala" |
14 | | -"$SBT" "dotty-bench-bootstrapped/jmh:run 1 1 tests/pos/alias.scala" |
15 | | -"$SBT" "dotty-bench-bootstrapped/jmh:run 1 1 -with-compiler compiler/src/dotty/tools/dotc/core/Types.scala" |
16 | | - |
17 | | -OUT=$(mktemp -d) |
18 | | -OUT1=$(mktemp -d) |
19 | | -tmp=$(mktemp) |
20 | | - |
21 | | -clear_out() |
22 | | -{ |
23 | | - local out="$1" |
24 | | - rm -rf "$out/*" |
25 | | -} |
| 3 | +source $(dirname $0)/cmdTestsCommon.inc.sh |
26 | 4 |
|
27 | 5 | # check that `sbt dotc` compiles and `sbt dotr` runs it |
28 | 6 | echo "testing sbt dotc and dotr" |
@@ -50,34 +28,6 @@ clear_out "$OUT" |
50 | 28 | "$SBT" ";dotc -d $OUT/out.jar $SOURCE; dotc -decompile -classpath $OUT/out.jar -color:never $MAIN" > "$tmp" |
51 | 29 | grep -qe "def main(args: scala.Array\[scala.Predef.String\]): scala.Unit =" "$tmp" |
52 | 30 |
|
53 | | -echo "testing scala.quoted.Expr.run from sbt dotr" |
54 | | -"$SBT" ";dotty-compiler-bootstrapped/dotc tests/run-with-compiler/quote-run.scala; dotty-compiler-bootstrapped/dotr -with-compiler Test" > "$tmp" |
55 | | -grep -qe "val a: scala.Int = 3" "$tmp" |
56 | | - |
57 | | - |
58 | | -# setup for `dotc`/`dotr` script tests |
59 | | -"$SBT" dist-bootstrapped/pack |
60 | | - |
61 | | -# check that `dotc` compiles and `dotr` runs it |
62 | | -echo "testing ./bin/dotc and ./bin/dotr" |
63 | | -clear_out "$OUT" |
64 | | -./bin/dotc "$SOURCE" -d "$OUT" |
65 | | -./bin/dotr -classpath "$OUT" "$MAIN" > "$tmp" |
66 | | -test "$EXPECTED_OUTPUT" = "$(cat "$tmp")" |
67 | | - |
68 | | -# check that `dotc -from-tasty` compiles and `dotr` runs it |
69 | | -echo "testing ./bin/dotc -from-tasty and dotr -classpath" |
70 | | -clear_out "$OUT1" |
71 | | -./bin/dotc -from-tasty -classpath "$OUT" -d "$OUT1" "$MAIN" |
72 | | -./bin/dotr -classpath "$OUT1" "$MAIN" > "$tmp" |
73 | | -test "$EXPECTED_OUTPUT" = "$(cat "$tmp")" |
74 | | - |
75 | | -# echo ":quit" | ./dist-bootstrapped/target/pack/bin/dotr # not supported by CI |
76 | | - |
77 | | -echo "testing ./bin/dotd" |
78 | | -clear_out "$OUT" |
79 | | -./bin/dotd -project Hello -siteroot "$OUT" "$SOURCE" |
80 | | - |
81 | 31 | ## Disabled because of flakeyness, should be changed to not depend on sbt |
82 | 32 | # echo "running Vulpix meta test" |
83 | 33 | # tmp=$(mktemp) |
|
0 commit comments