Skip to content

Commit a4f3ba0

Browse files
authored
Run UI tests in CI (#34)
Run UI tests in CI
1 parent 82333cc commit a4f3ba0

File tree

2 files changed

+53
-44
lines changed

2 files changed

+53
-44
lines changed

.github/workflows/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ jobs:
1414
steps:
1515
- uses: actions/checkout@v2
1616

17+
- name: Install packages
18+
run: sudo apt-get install ninja-build
19+
1720
- name: Download artifact
1821
uses: dawidd6/action-download-artifact@v2
1922
with:

test.sh

Lines changed: 50 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -106,69 +106,75 @@ rm -r ./target || true
106106
../../../../../cargo.sh test
107107
popd
108108

109-
pushd regex
110-
echo "[TEST] rust-lang/regex example shootout-regex-dna"
111-
../cargo.sh clean
112-
# Make sure `[codegen mono items] start` doesn't poison the diff
113-
../cargo.sh build --example shootout-regex-dna
114-
cat examples/regexdna-input.txt | ../cargo.sh run --example shootout-regex-dna | grep -v "Spawned thread" > res.txt
115-
diff -u res.txt examples/regexdna-output.txt
116-
117-
echo "[TEST] rust-lang/regex tests"
118-
../cargo.sh test --tests -- --exclude-should-panic --test-threads 1 -Zunstable-options
119-
popd
109+
# TODO: uncomment when having SIMD support.
110+
#pushd regex
111+
#echo "[TEST] rust-lang/regex example shootout-regex-dna"
112+
#../cargo.sh clean
113+
## Make sure `[codegen mono items] start` doesn't poison the diff
114+
#../cargo.sh build --example shootout-regex-dna
115+
#cat examples/regexdna-input.txt | ../cargo.sh run --example shootout-regex-dna | grep -v "Spawned thread" > res.txt
116+
#diff -u res.txt examples/regexdna-output.txt
117+
118+
#echo "[TEST] rust-lang/regex tests"
119+
#../cargo.sh test --tests -- --exclude-should-panic --test-threads 1 -Zunstable-options
120+
#popd
120121

121-
echo
122-
echo "[BENCH COMPILE] mod_bench"
122+
#echo
123+
#echo "[BENCH COMPILE] mod_bench"
123124

124-
COMPILE_MOD_BENCH_INLINE="$RUSTC example/mod_bench.rs --crate-type bin -Zmir-opt-level=3 -O --crate-name mod_bench_inline"
125-
COMPILE_MOD_BENCH_LLVM_0="rustc example/mod_bench.rs --crate-type bin -Copt-level=0 -o target/out/mod_bench_llvm_0 -Cpanic=abort"
126-
COMPILE_MOD_BENCH_LLVM_1="rustc example/mod_bench.rs --crate-type bin -Copt-level=1 -o target/out/mod_bench_llvm_1 -Cpanic=abort"
127-
COMPILE_MOD_BENCH_LLVM_2="rustc example/mod_bench.rs --crate-type bin -Copt-level=2 -o target/out/mod_bench_llvm_2 -Cpanic=abort"
128-
COMPILE_MOD_BENCH_LLVM_3="rustc example/mod_bench.rs --crate-type bin -Copt-level=3 -o target/out/mod_bench_llvm_3 -Cpanic=abort"
125+
#COMPILE_MOD_BENCH_INLINE="$RUSTC example/mod_bench.rs --crate-type bin -Zmir-opt-level=3 -O --crate-name mod_bench_inline"
126+
#COMPILE_MOD_BENCH_LLVM_0="rustc example/mod_bench.rs --crate-type bin -Copt-level=0 -o target/out/mod_bench_llvm_0 -Cpanic=abort"
127+
#COMPILE_MOD_BENCH_LLVM_1="rustc example/mod_bench.rs --crate-type bin -Copt-level=1 -o target/out/mod_bench_llvm_1 -Cpanic=abort"
128+
#COMPILE_MOD_BENCH_LLVM_2="rustc example/mod_bench.rs --crate-type bin -Copt-level=2 -o target/out/mod_bench_llvm_2 -Cpanic=abort"
129+
#COMPILE_MOD_BENCH_LLVM_3="rustc example/mod_bench.rs --crate-type bin -Copt-level=3 -o target/out/mod_bench_llvm_3 -Cpanic=abort"
129130

130-
# Use 100 runs, because a single compilations doesn't take more than ~150ms, so it isn't very slow
131-
hyperfine --runs ${COMPILE_RUNS:-100} "$COMPILE_MOD_BENCH_INLINE" "$COMPILE_MOD_BENCH_LLVM_0" "$COMPILE_MOD_BENCH_LLVM_1" "$COMPILE_MOD_BENCH_LLVM_2" "$COMPILE_MOD_BENCH_LLVM_3"
131+
## Use 100 runs, because a single compilations doesn't take more than ~150ms, so it isn't very slow
132+
#hyperfine --runs ${COMPILE_RUNS:-100} "$COMPILE_MOD_BENCH_INLINE" "$COMPILE_MOD_BENCH_LLVM_0" "$COMPILE_MOD_BENCH_LLVM_1" "$COMPILE_MOD_BENCH_LLVM_2" "$COMPILE_MOD_BENCH_LLVM_3"
132133

133-
echo
134-
echo "[BENCH RUN] mod_bench"
135-
hyperfine --runs ${RUN_RUNS:-10} ./target/out/mod_bench{,_inline} ./target/out/mod_bench_llvm_*
134+
#echo
135+
#echo "[BENCH RUN] mod_bench"
136+
#hyperfine --runs ${RUN_RUNS:-10} ./target/out/mod_bench{,_inline} ./target/out/mod_bench_llvm_*
136137

137138
echo
138139
echo "[TEST] rust-lang/rust"
139140

140-
#git clone https://github.com/rust-lang/rust.git --depth=1 || true
141-
#cd rust
142-
##git fetch
143-
##git checkout $(rustc -V | cut -d' ' -f3 | tr -d '(')
144-
#export RUSTFLAGS=
141+
rust_toolchain=$(cat rust-toolchain)
142+
143+
git clone https://github.com/rust-lang/rust.git || true
144+
cd rust
145+
git fetch
146+
git checkout $(rustc -V | cut -d' ' -f3 | tr -d '(')
147+
export RUSTFLAGS=
145148

146149
##git apply ../rust_lang.patch
147150

148151

149152
#rm config.toml || true
150153

151-
#cat > config.toml <<EOF
152-
#[rust]
153-
#codegen-backends = []
154-
#[build]
155-
#local-rebuild = true
156-
#rustc = "$HOME/.rustup/toolchains/nightly-$TARGET_TRIPLE/bin/rustc"
157-
#EOF
158-
159-
#git checkout $(rustc -V | cut -d' ' -f3 | tr -d '(') src/test
160-
#rm -r src/test/ui/{asm-*,abi*,extern/,panic-runtime/,panics/,unsized-locals/,proc-macro/,threads-sendsync/,thinlto/,simd*,borrowck/,test*,*lto*.rs} || true
161-
#for test in $(rg --files-with-matches "asm!|catch_unwind|should_panic|thread|lto" src/test/ui); do
162-
#rm $test
163-
#done
154+
cat > config.toml <<EOF
155+
[rust]
156+
codegen-backends = []
157+
[build]
158+
cargo = "$(which cargo)"
159+
local-rebuild = true
160+
rustc = "$HOME/.rustup/toolchains/$rust_toolchain-$TARGET_TRIPLE/bin/rustc"
161+
EOF
162+
163+
rustc -V | cut -d' ' -f3 | tr -d '('
164+
git checkout $(rustc -V | cut -d' ' -f3 | tr -d '(') src/test
165+
rm -r src/test/ui/{abi*,extern/,panic-runtime/,panics/,unsized-locals/,proc-macro/,threads-sendsync/,thinlto/,simd*,borrowck/,test*,*lto*.rs} || true
166+
for test in $(rg --files-with-matches "catch_unwind|should_panic|thread|lto" src/test/ui); do
167+
rm $test
168+
done
164169
#rm src/test/ui/consts/const-size_of-cycle.rs || true # Error file path difference
165170
#rm src/test/ui/impl-trait/impl-generic-mismatch.rs || true # ^
166171
#rm src/test/ui/type_length_limit.rs || true
167172
#rm src/test/ui/issues/issue-50993.rs || true # Target `thumbv7em-none-eabihf` is not supported
168173
#rm src/test/ui/macros/same-sequence-span.rs || true # Proc macro .rustc section not found?
169174
#rm src/test/ui/suggestions/issue-61963.rs || true # ^
170175

171-
#RUSTC_ARGS="-Zpanic-abort-tests -Zcodegen-backend="$(pwd)"/../target/"$CHANNEL"/librustc_codegen_gcc."$dylib_ext" --sysroot "$(pwd)"/../build_sysroot/sysroot -Cpanic=abort"
176+
RUSTC_ARGS="-Zpanic-abort-tests -Zcodegen-backend="$(pwd)"/../target/"$CHANNEL"/librustc_codegen_gcc."$dylib_ext" --sysroot "$(pwd)"/../build_sysroot/sysroot -Cpanic=abort"
172177

173-
#echo "[TEST] rustc test suite"
174-
#./x.py test --stage 0 src/test/ui/ --rustc-args "$RUSTC_ARGS" 2>&1 | tee log.txt
178+
echo "[TEST] rustc test suite"
179+
# TODO: remove excluded tests when they stop stalling.
180+
COMPILETEST_FORCE_STAGE0=1 ./x.py test --run always --stage 0 src/test/ui/ --rustc-args "$RUSTC_ARGS" --exclude src/test/ui/numbers-arithmetic/saturating-float-casts.rs --exclude src/test/ui/issues/issue-50811.rs

0 commit comments

Comments
 (0)