@@ -17,6 +17,7 @@ export LIBRARY_PATH="$GCC_PATH"
17
17
if [[ " $1 " == " --release" ]]; then
18
18
export CHANNEL=' release'
19
19
CARGO_INCREMENTAL=1 cargo rustc --release
20
+ shift
20
21
else
21
22
echo $LD_LIBRARY_PATH
22
23
export CHANNEL=' debug'
25
26
26
27
source config.sh
27
28
28
- rm -r target/out || true
29
- mkdir -p target/out/gccjit
29
+ function clean() {
30
+ rm -r target/out || true
31
+ mkdir -p target/out/gccjit
32
+ }
30
33
31
- echo " [BUILD] mini_core"
32
- $RUSTC example/mini_core.rs --crate-name mini_core --crate-type lib,dylib --target $TARGET_TRIPLE
34
+ function mini_tests() {
35
+ echo " [BUILD] mini_core"
36
+ $RUSTC example/mini_core.rs --crate-name mini_core --crate-type lib,dylib --target $TARGET_TRIPLE
33
37
34
- echo " [BUILD] example"
35
- $RUSTC example/example.rs --crate-type lib --target $TARGET_TRIPLE
38
+ echo " [BUILD] example"
39
+ $RUSTC example/example.rs --crate-type lib --target $TARGET_TRIPLE
36
40
37
- echo " [AOT] mini_core_hello_world"
38
- $RUSTC example/mini_core_hello_world.rs --crate-name mini_core_hello_world --crate-type bin -g --target $TARGET_TRIPLE
39
- $RUN_WRAPPER ./target/out/mini_core_hello_world abc bcd
41
+ echo " [AOT] mini_core_hello_world"
42
+ $RUSTC example/mini_core_hello_world.rs --crate-name mini_core_hello_world --crate-type bin -g --target $TARGET_TRIPLE
43
+ $RUN_WRAPPER ./target/out/mini_core_hello_world abc bcd
44
+ }
40
45
41
- echo " [BUILD] sysroot"
42
- time ./build_sysroot/build_sysroot.sh
46
+ function build_sysroot() {
47
+ echo " [BUILD] sysroot"
48
+ time ./build_sysroot/build_sysroot.sh
49
+ }
43
50
44
- echo " [AOT] arbitrary_self_types_pointers_and_wrappers"
45
- $RUSTC example/arbitrary_self_types_pointers_and_wrappers.rs --crate-name arbitrary_self_types_pointers_and_wrappers --crate-type bin --target $TARGET_TRIPLE
46
- $RUN_WRAPPER ./target/out/arbitrary_self_types_pointers_and_wrappers
51
+ function std_tests() {
52
+ echo " [AOT] arbitrary_self_types_pointers_and_wrappers"
53
+ $RUSTC example/arbitrary_self_types_pointers_and_wrappers.rs --crate-name arbitrary_self_types_pointers_and_wrappers --crate-type bin --target $TARGET_TRIPLE
54
+ $RUN_WRAPPER ./target/out/arbitrary_self_types_pointers_and_wrappers
47
55
48
- echo " [AOT] alloc_system"
49
- $RUSTC example/alloc_system.rs --crate-type lib --target " $TARGET_TRIPLE "
56
+ echo " [AOT] alloc_system"
57
+ $RUSTC example/alloc_system.rs --crate-type lib --target " $TARGET_TRIPLE "
50
58
51
- echo " [AOT] alloc_example"
52
- $RUSTC example/alloc_example.rs --crate-type bin --target $TARGET_TRIPLE
53
- $RUN_WRAPPER ./target/out/alloc_example
59
+ echo " [AOT] alloc_example"
60
+ $RUSTC example/alloc_example.rs --crate-type bin --target $TARGET_TRIPLE
61
+ $RUN_WRAPPER ./target/out/alloc_example
54
62
55
- echo " [AOT] dst_field_align"
56
- # FIXME(antoyo): Re-add -Zmir-opt-level=2 once rust-lang/rust#67529 is fixed.
57
- $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)
63
+ echo " [AOT] dst_field_align"
64
+ # FIXME(antoyo): Re-add -Zmir-opt-level=2 once rust-lang/rust#67529 is fixed.
65
+ $RUSTC example/dst-field-align.rs --crate-name dst_field_align --crate-type bin --target $TARGET_TRIPLE
66
+ $RUN_WRAPPER ./target/out/dst_field_align || (echo $? ; false)
59
67
60
- echo " [AOT] std_example"
61
- $RUSTC example/std_example.rs --crate-type bin --target $TARGET_TRIPLE
62
- $RUN_WRAPPER ./target/out/std_example --target $TARGET_TRIPLE
68
+ echo " [AOT] std_example"
69
+ $RUSTC example/std_example.rs --crate-type bin --target $TARGET_TRIPLE
70
+ $RUN_WRAPPER ./target/out/std_example --target $TARGET_TRIPLE
63
71
64
- echo " [AOT] subslice-patterns-const-eval"
65
- $RUSTC example/subslice-patterns-const-eval.rs --crate-type bin -Cpanic=abort --target $TARGET_TRIPLE
66
- $RUN_WRAPPER ./target/out/subslice-patterns-const-eval
72
+ echo " [AOT] subslice-patterns-const-eval"
73
+ $RUSTC example/subslice-patterns-const-eval.rs --crate-type bin -Cpanic=abort --target $TARGET_TRIPLE
74
+ $RUN_WRAPPER ./target/out/subslice-patterns-const-eval
67
75
68
- echo " [AOT] track-caller-attribute"
69
- $RUSTC example/track-caller-attribute.rs --crate-type bin -Cpanic=abort --target $TARGET_TRIPLE
70
- $RUN_WRAPPER ./target/out/track-caller-attribute
76
+ echo " [AOT] track-caller-attribute"
77
+ $RUSTC example/track-caller-attribute.rs --crate-type bin -Cpanic=abort --target $TARGET_TRIPLE
78
+ $RUN_WRAPPER ./target/out/track-caller-attribute
71
79
72
- echo " [BUILD] mod_bench"
73
- $RUSTC example/mod_bench.rs --crate-type bin --target $TARGET_TRIPLE
80
+ echo " [BUILD] mod_bench"
81
+ $RUSTC example/mod_bench.rs --crate-type bin --target $TARGET_TRIPLE
82
+ }
74
83
75
84
# FIXME(antoyo): linker gives multiple definitions error on Linux
76
85
# echo "[BUILD] sysroot in release mode"
@@ -95,11 +104,13 @@ $RUSTC example/mod_bench.rs --crate-type bin --target $TARGET_TRIPLE
95
104
# fi
96
105
# popd
97
106
98
- pushd build_sysroot/sysroot_src/library/core/tests
99
- echo " [TEST] libcore"
100
- rm -r ./target || true
101
- ../../../../../cargo.sh test
102
- popd
107
+ function test_libcore() {
108
+ pushd build_sysroot/sysroot_src/library/core/tests
109
+ echo " [TEST] libcore"
110
+ rm -r ./target || true
111
+ ../../../../../cargo.sh test
112
+ popd
113
+ }
103
114
104
115
# TODO(antoyo): uncomment when it works.
105
116
# pushd regex
@@ -130,20 +141,21 @@ popd
130
141
# echo "[BENCH RUN] mod_bench"
131
142
# hyperfine --runs ${RUN_RUNS:-10} ./target/out/mod_bench{,_inline} ./target/out/mod_bench_llvm_*
132
143
133
- echo
134
- echo " [TEST] rust-lang/rust"
144
+ function test_rustc() {
145
+ echo
146
+ echo " [TEST] rust-lang/rust"
135
147
136
- rust_toolchain=$( cat rust-toolchain)
148
+ rust_toolchain=$( cat rust-toolchain)
137
149
138
- git clone https://github.com/rust-lang/rust.git || true
139
- cd rust
140
- git fetch
141
- git checkout $( rustc -V | cut -d' ' -f3 | tr -d ' (' )
142
- export RUSTFLAGS=
150
+ git clone https://github.com/rust-lang/rust.git || true
151
+ cd rust
152
+ git fetch
153
+ git checkout $( rustc -V | cut -d' ' -f3 | tr -d ' (' )
154
+ export RUSTFLAGS=
143
155
144
- rm config.toml || true
156
+ rm config.toml || true
145
157
146
- cat > config.toml << EOF
158
+ cat > config.toml << EOF
147
159
[rust]
148
160
codegen-backends = []
149
161
deny-warnings = false
@@ -154,24 +166,52 @@ local-rebuild = true
154
166
rustc = "$HOME /.rustup/toolchains/$rust_toolchain -$TARGET_TRIPLE /bin/rustc"
155
167
EOF
156
168
157
- rustc -V | cut -d' ' -f3 | tr -d ' ('
158
- git checkout $( rustc -V | cut -d' ' -f3 | tr -d ' (' ) src/test
159
-
160
- for test in $( rg -i --files-with-matches " //(\[\w+\])?~|// error-pattern:|// build-fail|// run-fail|-Cllvm-args" src/test/ui) ; do
161
- rm $test
162
- done
163
-
164
- git checkout -- src/test/ui/issues/auxiliary/issue-3136-a.rs # contains //~ERROR, but shouldn't be removed
165
-
166
- rm -r src/test/ui/{abi* ,extern/,llvm-asm/,panic-runtime/,panics/,unsized-locals/,proc-macro/,threads-sendsync/,thinlto/,simd* ,borrowck/,test* ,* lto* .rs} || true
167
- for test in $( rg --files-with-matches " catch_unwind|should_panic|thread|lto" src/test/ui) ; do
168
- rm $test
169
- done
170
- git checkout src/test/ui/type-alias-impl-trait/auxiliary/cross_crate_ice.rs
171
- git checkout src/test/ui/type-alias-impl-trait/auxiliary/cross_crate_ice2.rs
172
- rm src/test/ui/llvm-asm/llvm-asm-in-out-operand.rs || true # TODO(antoyo): Enable back this test if I ever implement the llvm_asm! macro.
173
-
174
- RUSTC_ARGS=" -Zpanic-abort-tests -Zsymbol-mangling-version=v0 -Zcodegen-backend=" $( pwd) " /../target/" $CHANNEL " /librustc_codegen_gcc." $dylib_ext " --sysroot " $( pwd) " /../build_sysroot/sysroot -Cpanic=abort"
175
-
176
- echo " [TEST] rustc test suite"
177
- COMPILETEST_FORCE_STAGE0=1 ./x.py test --run always --stage 0 src/test/ui/ --rustc-args " $RUSTC_ARGS "
169
+ rustc -V | cut -d' ' -f3 | tr -d ' ('
170
+ git checkout $( rustc -V | cut -d' ' -f3 | tr -d ' (' ) src/test
171
+
172
+ for test in $( rg -i --files-with-matches " //(\[\w+\])?~|// error-pattern:|// build-fail|// run-fail|-Cllvm-args" src/test/ui) ; do
173
+ rm $test
174
+ done
175
+
176
+ git checkout -- src/test/ui/issues/auxiliary/issue-3136-a.rs # contains //~ERROR, but shouldn't be removed
177
+
178
+ rm -r src/test/ui/{abi* ,extern/,llvm-asm/,panic-runtime/,panics/,unsized-locals/,proc-macro/,threads-sendsync/,thinlto/,simd* ,borrowck/,test* ,* lto* .rs} || true
179
+ for test in $( rg --files-with-matches " catch_unwind|should_panic|thread|lto" src/test/ui) ; do
180
+ rm $test
181
+ done
182
+ git checkout src/test/ui/type-alias-impl-trait/auxiliary/cross_crate_ice.rs
183
+ git checkout src/test/ui/type-alias-impl-trait/auxiliary/cross_crate_ice2.rs
184
+ rm src/test/ui/llvm-asm/llvm-asm-in-out-operand.rs || true # TODO(antoyo): Enable back this test if I ever implement the llvm_asm! macro.
185
+
186
+ RUSTC_ARGS=" -Zpanic-abort-tests -Zsymbol-mangling-version=v0 -Zcodegen-backend=" $( pwd) " /../target/" $CHANNEL " /librustc_codegen_gcc." $dylib_ext " --sysroot " $( pwd) " /../build_sysroot/sysroot -Cpanic=abort"
187
+
188
+ echo " [TEST] rustc test suite"
189
+ COMPILETEST_FORCE_STAGE0=1 ./x.py test --run always --stage 0 src/test/ui/ --rustc-args " $RUSTC_ARGS "
190
+ }
191
+
192
+ function clean_ui_tests() {
193
+ find rust/build/x86_64-unknown-linux-gnu/test/ui/ -name stamp -exec rm -rf {} \;
194
+ }
195
+
196
+ case $1 in
197
+ " --test-rustc" )
198
+ test_rustc
199
+ ;;
200
+
201
+ " --test-libcore" )
202
+ test_libcore
203
+ ;;
204
+
205
+ " --clean-ui-tests" )
206
+ clean_ui_tests
207
+ ;;
208
+
209
+ * )
210
+ clean
211
+ mini_tests
212
+ build_sysroot
213
+ std_tests
214
+ test_libcore
215
+ test_rustc
216
+ ;;
217
+ esac
0 commit comments