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 $MY_RUSTC example/dst-field-align.rs --crate-name dst_field_align --crate-type bin --target "$TARGET_TRIPLE"
61 $RUN_WRAPPER ./target/out/dst_field_align || (echo $?; false)
63 echo "[AOT] std_example"
64 $MY_RUSTC example/std_example.rs --crate-type bin --target "$TARGET_TRIPLE"
65 $RUN_WRAPPER ./target/out/std_example arg
67 echo "[AOT] subslice-patterns-const-eval"
68 $MY_RUSTC example/subslice-patterns-const-eval.rs --crate-type bin -Cpanic=abort --target "$TARGET_TRIPLE"
69 $RUN_WRAPPER ./target/out/subslice-patterns-const-eval
71 echo "[AOT] track-caller-attribute"
72 $MY_RUSTC example/track-caller-attribute.rs --crate-type bin -Cpanic=abort --target "$TARGET_TRIPLE"
73 $RUN_WRAPPER ./target/out/track-caller-attribute
75 echo "[AOT] mod_bench"
76 $MY_RUSTC example/mod_bench.rs --crate-type bin --target "$TARGET_TRIPLE"
77 $RUN_WRAPPER ./target/out/mod_bench
80 function extended_sysroot_tests() {
82 ../build/cargo-clif clean
83 if [[ "$HOST_TRIPLE" = "$TARGET_TRIPLE" ]]; then
84 echo "[TEST] rust-random/rand"
85 ../build/cargo-clif test --workspace
87 echo "[AOT] rust-random/rand"
88 ../build/cargo-clif build --workspace --target $TARGET_TRIPLE --tests
92 pushd simple-raytracer
93 if [[ "$HOST_TRIPLE" = "$TARGET_TRIPLE" ]]; then
94 echo "[BENCH COMPILE] ebobby/simple-raytracer"
95 hyperfine --runs "${RUN_RUNS:-10}" --warmup 1 --prepare "../build/cargo-clif clean" \
96 "RUSTC=rustc RUSTFLAGS='' cargo build" \
97 "../build/cargo-clif build"
99 echo "[BENCH RUN] ebobby/simple-raytracer"
100 cp ./target/debug/main ./raytracer_cg_clif
101 hyperfine --runs "${RUN_RUNS:-10}" ./raytracer_cg_llvm ./raytracer_cg_clif
103 ../build/cargo-clif clean
104 echo "[BENCH COMPILE] ebobby/simple-raytracer (skipped)"
105 echo "[COMPILE] ebobby/simple-raytracer"
106 ../build/cargo-clif build --target $TARGET_TRIPLE
107 echo "[BENCH RUN] ebobby/simple-raytracer (skipped)"
111 pushd build_sysroot/sysroot_src/library/core/tests
112 echo "[TEST] libcore"
113 ../../../../../build/cargo-clif clean
114 if [[ "$HOST_TRIPLE" = "$TARGET_TRIPLE" ]]; then
115 ../../../../../build/cargo-clif test
117 ../../../../../build/cargo-clif build --target $TARGET_TRIPLE --tests
122 echo "[TEST] rust-lang/regex example shootout-regex-dna"
123 ../build/cargo-clif clean
124 export RUSTFLAGS="$RUSTFLAGS --cap-lints warn" # newer aho_corasick versions throw a deprecation warning
125 # Make sure `[codegen mono items] start` doesn't poison the diff
126 ../build/cargo-clif build --example shootout-regex-dna --target $TARGET_TRIPLE
127 if [[ "$HOST_TRIPLE" = "$TARGET_TRIPLE" ]]; then
128 cat examples/regexdna-input.txt \
129 | ../build/cargo-clif run --example shootout-regex-dna --target $TARGET_TRIPLE \
130 | grep -v "Spawned thread" > res.txt
131 diff -u res.txt examples/regexdna-output.txt
134 if [[ "$HOST_TRIPLE" = "$TARGET_TRIPLE" ]]; then
135 echo "[TEST] rust-lang/regex tests"
136 ../build/cargo-clif test --tests -- --exclude-should-panic --test-threads 1 -Zunstable-options -q
138 echo "[AOT] rust-lang/regex tests"
139 ../build/cargo-clif build --tests --target $TARGET_TRIPLE
144 echo "[TEST] rust-lang/portable-simd"
145 ../build/cargo-clif clean
146 ../build/cargo-clif build --all-targets --target $TARGET_TRIPLE
147 if [[ "$HOST_TRIPLE" = "$TARGET_TRIPLE" ]]; then
148 ../build/cargo-clif test -q
161 extended_sysroot_tests
164 echo "unknown test suite"