Skip to content

Commit ccfe7d8

Browse files
Add asm test suite
1 parent b3198c7 commit ccfe7d8

File tree

1 file changed

+41
-23
lines changed

1 file changed

+41
-23
lines changed

test.sh

Lines changed: 41 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@ while [[ $# -gt 0 ]]; do
7575
shift
7676
;;
7777

78+
"--asm-tests")
79+
funcs+=(asm_tests)
80+
shift
81+
;;
82+
7883
"--extended-tests")
7984
funcs+=(extended_sysroot_tests)
8085
shift
@@ -197,6 +202,40 @@ function std_tests() {
197202
$RUSTC example/mod_bench.rs --crate-type bin --target $TARGET_TRIPLE
198203
}
199204

205+
function setup_rustc() {
206+
rust_toolchain=$(cat rust-toolchain | grep channel | sed 's/channel = "\(.*\)"/\1/')
207+
208+
git clone https://github.com/rust-lang/rust.git || true
209+
cd rust
210+
git fetch
211+
git checkout $(rustc -V | cut -d' ' -f3 | tr -d '(')
212+
export RUSTFLAGS=
213+
214+
rm config.toml || true
215+
216+
cat > config.toml <<EOF
217+
[rust]
218+
codegen-backends = []
219+
deny-warnings = false
220+
221+
[build]
222+
cargo = "$(which cargo)"
223+
local-rebuild = true
224+
rustc = "$HOME/.rustup/toolchains/$rust_toolchain-$TARGET_TRIPLE/bin/rustc"
225+
EOF
226+
227+
rustc -V | cut -d' ' -f3 | tr -d '('
228+
git checkout $(rustc -V | cut -d' ' -f3 | tr -d '(') src/test
229+
}
230+
231+
function asm_tests() {
232+
setup_rustc
233+
234+
echo "[TEST] rustc test suite"
235+
RUSTC_ARGS="-Zpanic-abort-tests -Csymbol-mangling-version=v0 -Zcodegen-backend="$(pwd)"/../target/"$CHANNEL"/librustc_codegen_gcc."$dylib_ext" --sysroot "$(pwd)"/../build_sysroot/sysroot -Cpanic=abort"
236+
COMPILETEST_FORCE_STAGE0=1 ./x.py test --run always --stage 0 src/test/assembly/asm --rustc-args "$RUSTC_ARGS"
237+
}
238+
200239
# FIXME(antoyo): linker gives multiple definitions error on Linux
201240
#echo "[BUILD] sysroot in release mode"
202241
#./build_sysroot/build_sysroot.sh --release
@@ -288,29 +327,7 @@ function test_rustc() {
288327
echo
289328
echo "[TEST] rust-lang/rust"
290329

291-
rust_toolchain=$(cat rust-toolchain | grep channel | sed 's/channel = "\(.*\)"/\1/')
292-
293-
git clone https://github.com/rust-lang/rust.git || true
294-
cd rust
295-
git fetch
296-
git checkout $(rustc -V | cut -d' ' -f3 | tr -d '(')
297-
export RUSTFLAGS=
298-
299-
rm config.toml || true
300-
301-
cat > config.toml <<EOF
302-
[rust]
303-
codegen-backends = []
304-
deny-warnings = false
305-
306-
[build]
307-
cargo = "$(which cargo)"
308-
local-rebuild = true
309-
rustc = "$HOME/.rustup/toolchains/$rust_toolchain-$TARGET_TRIPLE/bin/rustc"
310-
EOF
311-
312-
rustc -V | cut -d' ' -f3 | tr -d '('
313-
git checkout $(rustc -V | cut -d' ' -f3 | tr -d '(') src/test
330+
setup_rustc
314331

315332
for test in $(rg -i --files-with-matches "//(\[\w+\])?~|// error-pattern:|// build-fail|// run-fail|-Cllvm-args" src/test/ui); do
316333
rm $test
@@ -380,6 +397,7 @@ function all() {
380397
mini_tests
381398
build_sysroot
382399
std_tests
400+
asm_tests
383401
test_libcore
384402
extended_sysroot_tests
385403
test_rustc

0 commit comments

Comments
 (0)