2018-08-10 19:09:21 +02:00
|
|
|
#!/bin/bash
|
2019-07-30 14:51:05 +02:00
|
|
|
set -e
|
|
|
|
|
2020-08-19 14:07:43 +02:00
|
|
|
# Build cg_clif
|
2020-09-29 14:43:34 +02:00
|
|
|
export RUSTFLAGS="-Zrun_dsymutil=no"
|
2019-07-30 13:37:47 +02:00
|
|
|
if [[ "$1" == "--release" ]]; then
|
|
|
|
export CHANNEL='release'
|
2020-09-29 14:43:34 +02:00
|
|
|
cargo build --release
|
2019-07-30 13:37:47 +02:00
|
|
|
else
|
|
|
|
export CHANNEL='debug'
|
2020-09-29 14:43:34 +02:00
|
|
|
cargo build --bin cg_clif
|
2019-07-30 13:37:47 +02:00
|
|
|
fi
|
|
|
|
|
2020-08-19 14:07:43 +02:00
|
|
|
# Config
|
2020-09-16 16:46:02 +02:00
|
|
|
source scripts/config.sh
|
2020-08-19 14:07:43 +02:00
|
|
|
export CG_CLIF_INCR_CACHE_DISABLED=1
|
2020-09-29 14:43:34 +02:00
|
|
|
RUSTC=$RUSTC" "$RUSTFLAGS" -L crate=target/out --out-dir target/out -Cdebuginfo=2"
|
2018-08-08 19:46:16 +02:00
|
|
|
|
2020-08-19 14:07:43 +02:00
|
|
|
# Cleanup
|
2018-08-31 19:50:26 +02:00
|
|
|
rm -r target/out || true
|
2018-08-14 22:01:18 +02:00
|
|
|
|
2020-08-19 14:07:43 +02:00
|
|
|
# Perform all tests
|
2018-09-09 14:45:23 +02:00
|
|
|
echo "[BUILD] mini_core"
|
2020-04-17 16:54:46 +02:00
|
|
|
$RUSTC example/mini_core.rs --crate-name mini_core --crate-type lib,dylib --target $TARGET_TRIPLE
|
2018-08-14 22:01:18 +02:00
|
|
|
|
2018-11-02 20:09:52 +01:00
|
|
|
echo "[BUILD] example"
|
2020-04-17 16:54:46 +02:00
|
|
|
$RUSTC example/example.rs --crate-type lib --target $TARGET_TRIPLE
|
2018-08-14 22:01:18 +02:00
|
|
|
|
2020-09-23 18:34:54 +02:00
|
|
|
if [[ "$JIT_SUPPORTED" = "1" ]]; then
|
2020-04-17 16:54:46 +02:00
|
|
|
echo "[JIT] mini_core_hello_world"
|
2020-09-29 18:41:59 +02:00
|
|
|
CG_CLIF_JIT_ARGS="abc bcd" $RUSTC --jit example/mini_core_hello_world.rs --cfg jit --target $HOST_TRIPLE
|
2020-04-17 16:54:46 +02:00
|
|
|
else
|
|
|
|
echo "[JIT] mini_core_hello_world (skipped)"
|
|
|
|
fi
|
2018-08-14 22:01:18 +02:00
|
|
|
|
2018-09-09 14:45:23 +02:00
|
|
|
echo "[AOT] mini_core_hello_world"
|
2020-04-17 16:54:46 +02:00
|
|
|
$RUSTC example/mini_core_hello_world.rs --crate-name mini_core_hello_world --crate-type bin -g --target $TARGET_TRIPLE
|
|
|
|
$RUN_WRAPPER ./target/out/mini_core_hello_world abc bcd
|
2019-12-17 16:37:57 +01:00
|
|
|
# (echo "break set -n main"; echo "run"; sleep 1; echo "si -c 10"; sleep 1; echo "frame variable") | lldb -- ./target/out/mini_core_hello_world abc bcd
|
2019-12-16 12:06:52 +01:00
|
|
|
|
2019-03-02 21:09:28 +01:00
|
|
|
echo "[AOT] arbitrary_self_types_pointers_and_wrappers"
|
2020-04-17 16:54:46 +02:00
|
|
|
$RUSTC example/arbitrary_self_types_pointers_and_wrappers.rs --crate-name arbitrary_self_types_pointers_and_wrappers --crate-type bin --target $TARGET_TRIPLE
|
|
|
|
$RUN_WRAPPER ./target/out/arbitrary_self_types_pointers_and_wrappers
|
2019-03-02 21:09:28 +01:00
|
|
|
|
2018-12-14 13:58:33 +01:00
|
|
|
echo "[BUILD] sysroot"
|
2020-06-13 19:19:38 +02:00
|
|
|
time ./build_sysroot/build_sysroot.sh --release
|
2018-10-08 19:40:06 +02:00
|
|
|
|
2019-08-10 16:50:23 +02:00
|
|
|
echo "[AOT] alloc_example"
|
2020-04-17 16:54:46 +02:00
|
|
|
$RUSTC example/alloc_example.rs --crate-type bin --target $TARGET_TRIPLE
|
|
|
|
$RUN_WRAPPER ./target/out/alloc_example
|
2018-11-05 18:42:43 +01:00
|
|
|
|
2020-09-23 18:34:54 +02:00
|
|
|
if [[ "$JIT_SUPPORTED" = "1" ]]; then
|
2020-04-17 16:54:46 +02:00
|
|
|
echo "[JIT] std_example"
|
2020-09-29 18:41:59 +02:00
|
|
|
$RUSTC --jit example/std_example.rs --target $HOST_TRIPLE
|
2020-04-17 16:54:46 +02:00
|
|
|
else
|
|
|
|
echo "[JIT] std_example (skipped)"
|
|
|
|
fi
|
2019-08-10 16:50:23 +02:00
|
|
|
|
2019-09-02 19:50:21 +02:00
|
|
|
echo "[AOT] dst_field_align"
|
2019-12-22 14:49:10 +01:00
|
|
|
# FIXME Re-add -Zmir-opt-level=2 once rust-lang/rust#67529 is fixed.
|
2020-04-17 16:54:46 +02:00
|
|
|
$RUSTC example/dst-field-align.rs --crate-name dst_field_align --crate-type bin --target $TARGET_TRIPLE
|
|
|
|
$RUN_WRAPPER ./target/out/dst_field_align || (echo $?; false)
|
2019-09-02 19:50:21 +02:00
|
|
|
|
2019-08-10 16:50:23 +02:00
|
|
|
echo "[AOT] std_example"
|
2020-04-17 16:54:46 +02:00
|
|
|
$RUSTC example/std_example.rs --crate-type bin --target $TARGET_TRIPLE
|
2020-06-20 12:01:24 +02:00
|
|
|
$RUN_WRAPPER ./target/out/std_example arg
|
2019-02-11 19:40:07 +01:00
|
|
|
|
2020-01-11 14:15:24 +01:00
|
|
|
echo "[AOT] subslice-patterns-const-eval"
|
2020-04-17 16:54:46 +02:00
|
|
|
$RUSTC example/subslice-patterns-const-eval.rs --crate-type bin -Cpanic=abort --target $TARGET_TRIPLE
|
|
|
|
$RUN_WRAPPER ./target/out/subslice-patterns-const-eval
|
2020-01-11 14:15:24 +01:00
|
|
|
|
2020-01-11 16:49:42 +01:00
|
|
|
echo "[AOT] track-caller-attribute"
|
2020-04-17 16:54:46 +02:00
|
|
|
$RUSTC example/track-caller-attribute.rs --crate-type bin -Cpanic=abort --target $TARGET_TRIPLE
|
|
|
|
$RUN_WRAPPER ./target/out/track-caller-attribute
|
2020-01-11 16:49:42 +01:00
|
|
|
|
2020-09-18 14:45:52 +02:00
|
|
|
echo "[AOT] mod_bench"
|
2020-04-17 16:54:46 +02:00
|
|
|
$RUSTC example/mod_bench.rs --crate-type bin --target $TARGET_TRIPLE
|
2020-09-18 14:45:52 +02:00
|
|
|
$RUN_WRAPPER ./target/out/mod_bench
|
2018-11-10 15:33:44 +01:00
|
|
|
|
2020-08-15 20:55:03 +02:00
|
|
|
pushd rand
|
|
|
|
rm -r ./target || true
|
|
|
|
../cargo.sh test --workspace
|
|
|
|
popd
|
|
|
|
|
2019-08-30 17:29:38 +02:00
|
|
|
pushd simple-raytracer
|
2020-04-17 16:54:46 +02:00
|
|
|
if [[ "$HOST_TRIPLE" = "$TARGET_TRIPLE" ]]; then
|
|
|
|
echo "[BENCH COMPILE] ebobby/simple-raytracer"
|
2020-04-20 17:13:43 +02:00
|
|
|
hyperfine --runs ${RUN_RUNS:-10} --warmup 1 --prepare "cargo clean" \
|
2020-09-29 14:43:34 +02:00
|
|
|
"RUSTC=rustc RUSTFLAGS='' cargo build" \
|
2019-11-23 15:10:29 +01:00
|
|
|
"../cargo.sh build"
|
2019-08-30 17:29:38 +02:00
|
|
|
|
2020-04-17 16:54:46 +02:00
|
|
|
echo "[BENCH RUN] ebobby/simple-raytracer"
|
2020-04-20 17:13:43 +02:00
|
|
|
cp ./target/debug/main ./raytracer_cg_clif
|
2020-04-17 16:54:46 +02:00
|
|
|
hyperfine --runs ${RUN_RUNS:-10} ./raytracer_cg_llvm ./raytracer_cg_clif
|
|
|
|
else
|
|
|
|
echo "[BENCH COMPILE] ebobby/simple-raytracer (skipped)"
|
|
|
|
echo "[COMPILE] ebobby/simple-raytracer"
|
|
|
|
../cargo.sh build
|
|
|
|
echo "[BENCH RUN] ebobby/simple-raytracer (skipped)"
|
|
|
|
fi
|
2019-08-30 17:29:38 +02:00
|
|
|
popd
|
|
|
|
|
2020-07-30 15:14:19 +02:00
|
|
|
pushd build_sysroot/sysroot_src/library/core/tests
|
2020-04-17 16:54:46 +02:00
|
|
|
echo "[TEST] libcore"
|
2019-12-20 16:02:47 +01:00
|
|
|
rm -r ./target || true
|
|
|
|
../../../../../cargo.sh test
|
2019-11-24 15:44:39 +01:00
|
|
|
popd
|
|
|
|
|
2019-07-30 13:37:47 +02:00
|
|
|
pushd regex
|
|
|
|
echo "[TEST] rust-lang/regex example shootout-regex-dna"
|
|
|
|
../cargo.sh clean
|
|
|
|
# Make sure `[codegen mono items] start` doesn't poison the diff
|
|
|
|
../cargo.sh build --example shootout-regex-dna
|
2019-10-27 16:55:35 +01:00
|
|
|
cat examples/regexdna-input.txt | ../cargo.sh run --example shootout-regex-dna | grep -v "Spawned thread" > res.txt
|
2019-07-30 13:37:47 +02:00
|
|
|
diff -u res.txt examples/regexdna-output.txt
|
|
|
|
|
2019-08-10 14:06:08 +02:00
|
|
|
echo "[TEST] rust-lang/regex tests"
|
2019-08-09 14:33:59 +02:00
|
|
|
../cargo.sh test --tests -- --exclude-should-panic --test-threads 1 -Zunstable-options
|
2019-07-30 13:37:47 +02:00
|
|
|
popd
|