Split tests to have faster CI
This commit is contained in:
parent
0d687bd829
commit
50f359c8a1
2 changed files with 76 additions and 13 deletions
7
.github/workflows/ci.yml
vendored
7
.github/workflows/ci.yml
vendored
|
@ -23,8 +23,11 @@ jobs:
|
||||||
"--mini-tests",
|
"--mini-tests",
|
||||||
"--std-tests",
|
"--std-tests",
|
||||||
"--test-libcore",
|
"--test-libcore",
|
||||||
"--extended-tests",
|
"--extended-rand-tests",
|
||||||
"--test-successful-rustc",
|
"--extended-regex-example-tests",
|
||||||
|
"--extended-regex-tests",
|
||||||
|
"--test-successful-rustc --nb-parts 2 --current-part 0",
|
||||||
|
"--test-successful-rustc --nb-parts 2 --current-part 1",
|
||||||
"--test-failing-rustc",
|
"--test-failing-rustc",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
82
test.sh
82
test.sh
|
@ -19,6 +19,8 @@ gcc_master_branch=1
|
||||||
channel="debug"
|
channel="debug"
|
||||||
funcs=()
|
funcs=()
|
||||||
build_only=0
|
build_only=0
|
||||||
|
nb_parts=0
|
||||||
|
current_part=0
|
||||||
|
|
||||||
while [[ $# -gt 0 ]]; do
|
while [[ $# -gt 0 ]]; do
|
||||||
case $1 in
|
case $1 in
|
||||||
|
@ -77,6 +79,19 @@ while [[ $# -gt 0 ]]; do
|
||||||
funcs+=(extended_sysroot_tests)
|
funcs+=(extended_sysroot_tests)
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
"--extended-rand-tests")
|
||||||
|
funcs+=(extended_rand_tests)
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
"--extended-regex-example-tests")
|
||||||
|
funcs+=(extended_regex_example_tests)
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
"--extended-regex-tests")
|
||||||
|
funcs+=(extended_regex_tests)
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
|
||||||
"--mini-tests")
|
"--mini-tests")
|
||||||
funcs+=(mini_tests)
|
funcs+=(mini_tests)
|
||||||
shift
|
shift
|
||||||
|
@ -90,6 +105,16 @@ while [[ $# -gt 0 ]]; do
|
||||||
build_only=1
|
build_only=1
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
"--nb-parts")
|
||||||
|
shift
|
||||||
|
nb_parts=$1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
"--current-part")
|
||||||
|
shift
|
||||||
|
current_part=$1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Unknown option $1"
|
echo "Unknown option $1"
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -200,7 +225,7 @@ function test_libcore() {
|
||||||
#echo "[BENCH RUN] mod_bench"
|
#echo "[BENCH RUN] mod_bench"
|
||||||
#hyperfine --runs ${RUN_RUNS:-10} ./target/out/mod_bench{,_inline} ./target/out/mod_bench_llvm_*
|
#hyperfine --runs ${RUN_RUNS:-10} ./target/out/mod_bench{,_inline} ./target/out/mod_bench_llvm_*
|
||||||
|
|
||||||
function extended_sysroot_tests() {
|
function extended_rand_tests() {
|
||||||
if (( $gcc_master_branch == 0 )); then
|
if (( $gcc_master_branch == 0 )); then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
@ -210,17 +235,12 @@ function extended_sysroot_tests() {
|
||||||
echo "[TEST] rust-random/rand"
|
echo "[TEST] rust-random/rand"
|
||||||
../cargo.sh test --workspace
|
../cargo.sh test --workspace
|
||||||
popd
|
popd
|
||||||
|
}
|
||||||
|
|
||||||
#pushd simple-raytracer
|
function extended_regex_example_tests() {
|
||||||
#echo "[BENCH COMPILE] ebobby/simple-raytracer"
|
if (( $gcc_master_branch == 0 )); then
|
||||||
#hyperfine --runs "${RUN_RUNS:-10}" --warmup 1 --prepare "cargo clean" \
|
return
|
||||||
#"RUSTC=rustc RUSTFLAGS='' cargo build" \
|
fi
|
||||||
#"../cargo.sh build"
|
|
||||||
|
|
||||||
#echo "[BENCH RUN] ebobby/simple-raytracer"
|
|
||||||
#cp ./target/debug/main ./raytracer_cg_gcc
|
|
||||||
#hyperfine --runs "${RUN_RUNS:-10}" ./raytracer_cg_llvm ./raytracer_cg_gcc
|
|
||||||
#popd
|
|
||||||
|
|
||||||
pushd regex
|
pushd regex
|
||||||
echo "[TEST] rust-lang/regex example shootout-regex-dna"
|
echo "[TEST] rust-lang/regex example shootout-regex-dna"
|
||||||
|
@ -232,12 +252,38 @@ function extended_sysroot_tests() {
|
||||||
| ../cargo.sh run --example shootout-regex-dna \
|
| ../cargo.sh run --example shootout-regex-dna \
|
||||||
| grep -v "Spawned thread" > res.txt
|
| grep -v "Spawned thread" > res.txt
|
||||||
diff -u res.txt examples/regexdna-output.txt
|
diff -u res.txt examples/regexdna-output.txt
|
||||||
|
popd
|
||||||
|
}
|
||||||
|
|
||||||
|
function extended_regex_tests() {
|
||||||
|
if (( $gcc_master_branch == 0 )); then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
pushd regex
|
||||||
echo "[TEST] rust-lang/regex tests"
|
echo "[TEST] rust-lang/regex tests"
|
||||||
|
export CG_RUSTFLAGS="--cap-lints warn" # newer aho_corasick versions throw a deprecation warning
|
||||||
../cargo.sh test --tests -- --exclude-should-panic --test-threads 1 -Zunstable-options -q
|
../cargo.sh test --tests -- --exclude-should-panic --test-threads 1 -Zunstable-options -q
|
||||||
popd
|
popd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function extended_sysroot_tests() {
|
||||||
|
#pushd simple-raytracer
|
||||||
|
#echo "[BENCH COMPILE] ebobby/simple-raytracer"
|
||||||
|
#hyperfine --runs "${RUN_RUNS:-10}" --warmup 1 --prepare "cargo clean" \
|
||||||
|
#"RUSTC=rustc RUSTFLAGS='' cargo build" \
|
||||||
|
#"../cargo.sh build"
|
||||||
|
|
||||||
|
#echo "[BENCH RUN] ebobby/simple-raytracer"
|
||||||
|
#cp ./target/debug/main ./raytracer_cg_gcc
|
||||||
|
#hyperfine --runs "${RUN_RUNS:-10}" ./raytracer_cg_llvm ./raytracer_cg_gcc
|
||||||
|
#popd
|
||||||
|
|
||||||
|
extended_rand_tests
|
||||||
|
extended_regex_example_tests
|
||||||
|
extended_regex_tests
|
||||||
|
}
|
||||||
|
|
||||||
function test_rustc() {
|
function test_rustc() {
|
||||||
echo
|
echo
|
||||||
echo "[TEST] rust-lang/rust"
|
echo "[TEST] rust-lang/rust"
|
||||||
|
@ -297,6 +343,20 @@ EOF
|
||||||
xargs -a ../failing-ui-tests.txt -d'\n' git checkout --
|
xargs -a ../failing-ui-tests.txt -d'\n' git checkout --
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ $nb_parts -gt 0 ]; then
|
||||||
|
echo "Splitting ui_test into $nb_parts parts (and running part $current_part)"
|
||||||
|
find src/test/ui -type f -name '*.rs' -not -path "*/auxiliary/*" > ui_tests
|
||||||
|
count=$((`wc -l < ui_tests` / $nb_parts))
|
||||||
|
# We increment the number of tests by one because if this is an odd number, we would skip
|
||||||
|
# one test.
|
||||||
|
count=$((count + 1))
|
||||||
|
split -d -l $count -a 1 ui_tests ui_tests.split
|
||||||
|
# Removing all tests.
|
||||||
|
find src/test/ui -type f -name '*.rs' -not -path "*/auxiliary/*" -exec rm {} \;
|
||||||
|
# Putting back only the ones we want to test.
|
||||||
|
xargs -a "ui_tests.split$current_part" -d'\n' git checkout --
|
||||||
|
fi
|
||||||
|
|
||||||
echo "[TEST] rustc test suite"
|
echo "[TEST] rustc test suite"
|
||||||
COMPILETEST_FORCE_STAGE0=1 ./x.py test --run always --stage 0 src/test/ui/ --rustc-args "$RUSTC_ARGS"
|
COMPILETEST_FORCE_STAGE0=1 ./x.py test --run always --stage 0 src/test/ui/ --rustc-args "$RUSTC_ARGS"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue