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 -Zunstable-options -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 -Zunstable-options -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] issue_91827_extern_types"
39 $MY_RUSTC example/issue-91827-extern-types.rs --crate-name issue_91827_extern_types --crate-type bin --target "$TARGET_TRIPLE"
40 $RUN_WRAPPER ./target/out/issue_91827_extern_types
42 echo "[AOT] alloc_system"
43 $MY_RUSTC example/alloc_system.rs --crate-type lib --target "$TARGET_TRIPLE"
45 echo "[AOT] alloc_example"
46 $MY_RUSTC example/alloc_example.rs --crate-type bin --target "$TARGET_TRIPLE"
47 $RUN_WRAPPER ./target/out/alloc_example
49 if [[ "$JIT_SUPPORTED" = "1" ]]; then
50 echo "[JIT] std_example"
51 $MY_RUSTC -Zunstable-options -Cllvm-args=mode=jit -Cprefer-dynamic example/std_example.rs --target "$HOST_TRIPLE"
53 echo "[JIT-lazy] std_example"
54 $MY_RUSTC -Zunstable-options -Cllvm-args=mode=jit-lazy -Cprefer-dynamic example/std_example.rs --target "$HOST_TRIPLE"
56 echo "[JIT] std_example (skipped)"
59 echo "[AOT] dst_field_align"
60 # FIXME Re-add -Zmir-opt-level=2 once rust-lang/rust#67529 is fixed.
61 $MY_RUSTC example/dst-field-align.rs --crate-name dst_field_align --crate-type bin --target "$TARGET_TRIPLE"
62 $RUN_WRAPPER ./target/out/dst_field_align || (echo $?; false)
64 echo "[AOT] std_example"
65 $MY_RUSTC example/std_example.rs --crate-type bin --target "$TARGET_TRIPLE"
66 $RUN_WRAPPER ./target/out/std_example arg
68 echo "[AOT] subslice-patterns-const-eval"
69 $MY_RUSTC example/subslice-patterns-const-eval.rs --crate-type bin -Cpanic=abort --target "$TARGET_TRIPLE"
70 $RUN_WRAPPER ./target/out/subslice-patterns-const-eval
72 echo "[AOT] track-caller-attribute"
73 $MY_RUSTC example/track-caller-attribute.rs --crate-type bin -Cpanic=abort --target "$TARGET_TRIPLE"
74 $RUN_WRAPPER ./target/out/track-caller-attribute
76 echo "[AOT] mod_bench"
77 $MY_RUSTC example/mod_bench.rs --crate-type bin --target "$TARGET_TRIPLE"
78 $RUN_WRAPPER ./target/out/mod_bench
81 function extended_sysroot_tests() {
84 if [[ "$HOST_TRIPLE" = "$TARGET_TRIPLE" ]]; then
85 echo "[TEST] rust-random/rand"
86 ../build/cargo test --workspace
88 echo "[AOT] rust-random/rand"
89 ../build/cargo build --workspace --target $TARGET_TRIPLE --tests
93 pushd simple-raytracer
94 if [[ "$HOST_TRIPLE" = "$TARGET_TRIPLE" ]]; then
95 echo "[BENCH COMPILE] ebobby/simple-raytracer"
96 hyperfine --runs "${RUN_RUNS:-10}" --warmup 1 --prepare "../build/cargo clean" \
97 "RUSTC=rustc RUSTFLAGS='' cargo build" \
98 "../build/cargo build"
100 echo "[BENCH RUN] ebobby/simple-raytracer"
101 cp ./target/debug/main ./raytracer_cg_clif
102 hyperfine --runs "${RUN_RUNS:-10}" ./raytracer_cg_llvm ./raytracer_cg_clif
105 echo "[BENCH COMPILE] ebobby/simple-raytracer (skipped)"
106 echo "[COMPILE] ebobby/simple-raytracer"
107 ../build/cargo build --target $TARGET_TRIPLE
108 echo "[BENCH RUN] ebobby/simple-raytracer (skipped)"
112 pushd build_sysroot/sysroot_src/library/core/tests
113 echo "[TEST] libcore"
114 ../../../../../build/cargo clean
115 if [[ "$HOST_TRIPLE" = "$TARGET_TRIPLE" ]]; then
116 ../../../../../build/cargo test
118 ../../../../../build/cargo build --target $TARGET_TRIPLE --tests
123 echo "[TEST] rust-lang/regex example shootout-regex-dna"
125 export RUSTFLAGS="$RUSTFLAGS --cap-lints warn" # newer aho_corasick versions throw a deprecation warning
126 # Make sure `[codegen mono items] start` doesn't poison the diff
127 ../build/cargo build --example shootout-regex-dna --target $TARGET_TRIPLE
128 if [[ "$HOST_TRIPLE" = "$TARGET_TRIPLE" ]]; then
129 cat examples/regexdna-input.txt \
130 | ../build/cargo run --example shootout-regex-dna --target $TARGET_TRIPLE \
131 | grep -v "Spawned thread" > res.txt
132 diff -u res.txt examples/regexdna-output.txt
135 if [[ "$HOST_TRIPLE" = "$TARGET_TRIPLE" ]]; then
136 echo "[TEST] rust-lang/regex tests"
137 ../build/cargo test --tests -- --exclude-should-panic --test-threads 1 -Zunstable-options -q
139 echo "[AOT] rust-lang/regex tests"
140 ../build/cargo build --tests --target $TARGET_TRIPLE
145 echo "[TEST] rust-lang/portable-simd"
147 ../build/cargo build --all-targets --target $TARGET_TRIPLE
148 if [[ "$HOST_TRIPLE" = "$TARGET_TRIPLE" ]]; then
149 ../build/cargo test -q
162 extended_sysroot_tests
165 echo "unknown test suite"