5 source scripts/config.sh
6 source scripts/ext_config.sh
7 export RUSTC=false # ensure that cg_llvm isn't accidentally used
8 MY_RUSTC="$(pwd)/build/bin/cg_clif $RUSTFLAGS -L crate=target/out --out-dir target/out -Cdebuginfo=2"
10 function no_sysroot_tests() {
11 echo "[BUILD] mini_core"
12 $MY_RUSTC example/mini_core.rs --crate-name mini_core --crate-type lib,dylib --target "$TARGET_TRIPLE"
14 echo "[BUILD] example"
15 $MY_RUSTC example/example.rs --crate-type lib --target "$TARGET_TRIPLE"
17 if [[ "$JIT_SUPPORTED" = "1" ]]; then
18 echo "[JIT] mini_core_hello_world"
19 CG_CLIF_JIT_ARGS="abc bcd" $MY_RUSTC -Cllvm-args=mode=jit -Cprefer-dynamic example/mini_core_hello_world.rs --cfg jit --target "$HOST_TRIPLE"
21 echo "[JIT-lazy] mini_core_hello_world"
22 CG_CLIF_JIT_ARGS="abc bcd" $MY_RUSTC -Cllvm-args=mode=jit-lazy -Cprefer-dynamic example/mini_core_hello_world.rs --cfg jit --target "$HOST_TRIPLE"
24 echo "[JIT] mini_core_hello_world (skipped)"
27 echo "[AOT] mini_core_hello_world"
28 $MY_RUSTC example/mini_core_hello_world.rs --crate-name mini_core_hello_world --crate-type bin -g --target "$TARGET_TRIPLE"
29 $RUN_WRAPPER ./target/out/mini_core_hello_world abc bcd
30 # (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
33 function base_sysroot_tests() {
34 echo "[AOT] arbitrary_self_types_pointers_and_wrappers"
35 $MY_RUSTC example/arbitrary_self_types_pointers_and_wrappers.rs --crate-name arbitrary_self_types_pointers_and_wrappers --crate-type bin --target "$TARGET_TRIPLE"
36 $RUN_WRAPPER ./target/out/arbitrary_self_types_pointers_and_wrappers
38 echo "[AOT] alloc_system"
39 $MY_RUSTC example/alloc_system.rs --crate-type lib --target "$TARGET_TRIPLE"
41 echo "[AOT] alloc_example"
42 $MY_RUSTC example/alloc_example.rs --crate-type bin --target "$TARGET_TRIPLE"
43 $RUN_WRAPPER ./target/out/alloc_example
45 if [[ "$JIT_SUPPORTED" = "1" ]]; then
46 echo "[JIT] std_example"
47 $MY_RUSTC -Cllvm-args=mode=jit -Cprefer-dynamic example/std_example.rs --target "$HOST_TRIPLE"
49 echo "[JIT-lazy] std_example"
50 $MY_RUSTC -Cllvm-args=mode=jit-lazy -Cprefer-dynamic example/std_example.rs --target "$HOST_TRIPLE"
52 echo "[JIT] std_example (skipped)"
55 echo "[AOT] dst_field_align"
56 # FIXME Re-add -Zmir-opt-level=2 once rust-lang/rust#67529 is fixed.
57 $MY_RUSTC example/dst-field-align.rs --crate-name dst_field_align --crate-type bin --target "$TARGET_TRIPLE"
58 $RUN_WRAPPER ./target/out/dst_field_align || (echo $?; false)
60 echo "[AOT] std_example"
61 $MY_RUSTC example/std_example.rs --crate-type bin --target "$TARGET_TRIPLE"
62 $RUN_WRAPPER ./target/out/std_example arg
64 echo "[AOT] subslice-patterns-const-eval"
65 $MY_RUSTC example/subslice-patterns-const-eval.rs --crate-type bin -Cpanic=abort --target "$TARGET_TRIPLE"
66 $RUN_WRAPPER ./target/out/subslice-patterns-const-eval
68 echo "[AOT] track-caller-attribute"
69 $MY_RUSTC example/track-caller-attribute.rs --crate-type bin -Cpanic=abort --target "$TARGET_TRIPLE"
70 $RUN_WRAPPER ./target/out/track-caller-attribute
72 echo "[AOT] mod_bench"
73 $MY_RUSTC example/mod_bench.rs --crate-type bin --target "$TARGET_TRIPLE"
74 $RUN_WRAPPER ./target/out/mod_bench
77 function extended_sysroot_tests() {
80 if [[ "$HOST_TRIPLE" = "$TARGET_TRIPLE" ]]; then
81 echo "[TEST] rust-random/rand"
82 ../build/cargo test --workspace
84 echo "[AOT] rust-random/rand"
85 ../build/cargo build --workspace --target $TARGET_TRIPLE --tests
89 pushd simple-raytracer
90 if [[ "$HOST_TRIPLE" = "$TARGET_TRIPLE" ]]; then
91 echo "[BENCH COMPILE] ebobby/simple-raytracer"
92 hyperfine --runs "${RUN_RUNS:-10}" --warmup 1 --prepare "../build/cargo clean" \
93 "RUSTC=rustc RUSTFLAGS='' cargo build" \
94 "../build/cargo build"
96 echo "[BENCH RUN] ebobby/simple-raytracer"
97 cp ./target/debug/main ./raytracer_cg_clif
98 hyperfine --runs "${RUN_RUNS:-10}" ./raytracer_cg_llvm ./raytracer_cg_clif
101 echo "[BENCH COMPILE] ebobby/simple-raytracer (skipped)"
102 echo "[COMPILE] ebobby/simple-raytracer"
103 ../build/cargo build --target $TARGET_TRIPLE
104 echo "[BENCH RUN] ebobby/simple-raytracer (skipped)"
108 pushd build_sysroot/sysroot_src/library/core/tests
109 echo "[TEST] libcore"
110 ../../../../../build/cargo clean
111 if [[ "$HOST_TRIPLE" = "$TARGET_TRIPLE" ]]; then
112 ../../../../../build/cargo test
114 ../../../../../build/cargo build --target $TARGET_TRIPLE --tests
119 echo "[TEST] rust-lang/regex example shootout-regex-dna"
121 export RUSTFLAGS="$RUSTFLAGS --cap-lints warn" # newer aho_corasick versions throw a deprecation warning
122 # Make sure `[codegen mono items] start` doesn't poison the diff
123 ../build/cargo build --example shootout-regex-dna --target $TARGET_TRIPLE
124 if [[ "$HOST_TRIPLE" = "$TARGET_TRIPLE" ]]; then
125 cat examples/regexdna-input.txt \
126 | ../build/cargo run --example shootout-regex-dna --target $TARGET_TRIPLE \
127 | grep -v "Spawned thread" > res.txt
128 diff -u res.txt examples/regexdna-output.txt
131 if [[ "$HOST_TRIPLE" = "$TARGET_TRIPLE" ]]; then
132 echo "[TEST] rust-lang/regex tests"
133 ../build/cargo test --tests -- --exclude-should-panic --test-threads 1 -Zunstable-options -q
135 echo "[AOT] rust-lang/regex tests"
136 ../build/cargo build --tests --target $TARGET_TRIPLE
149 extended_sysroot_tests
152 echo "unknown test suite"