CI: test ./miri bench
This commit is contained in:
parent
f9cff630a1
commit
bfc897ec07
@ -17,11 +17,11 @@ begingroup "Building Miri"
|
|||||||
echo "Installing release version of Miri"
|
echo "Installing release version of Miri"
|
||||||
export RUSTFLAGS="-D warnings"
|
export RUSTFLAGS="-D warnings"
|
||||||
export CARGO_INCREMENTAL=0
|
export CARGO_INCREMENTAL=0
|
||||||
./miri install # implicitly locked
|
export CARGO_EXTRA_FLAGS="--locked"
|
||||||
|
./miri install
|
||||||
|
|
||||||
# Prepare debug build for direct `./miri` invocations
|
# Prepare debug build for direct `./miri` invocations
|
||||||
echo "Building debug version of Miri"
|
echo "Building debug version of Miri"
|
||||||
export CARGO_EXTRA_FLAGS="--locked"
|
|
||||||
./miri check --no-default-features # make sure this can be built
|
./miri check --no-default-features # make sure this can be built
|
||||||
./miri check --all-features # and this, too
|
./miri check --all-features # and this, too
|
||||||
./miri build --all-targets # the build that all the `./miri test` below will use
|
./miri build --all-targets # the build that all the `./miri test` below will use
|
||||||
@ -39,8 +39,11 @@ function run_tests {
|
|||||||
## ui test suite
|
## ui test suite
|
||||||
./miri test
|
./miri test
|
||||||
if [ -z "${MIRI_TEST_TARGET+exists}" ]; then
|
if [ -z "${MIRI_TEST_TARGET+exists}" ]; then
|
||||||
# Only for host architecture: tests with optimizations (`-O` is what cargo passes, but crank MIR
|
# Host-only tests: running these on all targets is unlikely to catch more problems and would
|
||||||
# optimizations up all the way, too).
|
# cost a lot of CI time.
|
||||||
|
|
||||||
|
# Tests with optimizations (`-O` is what cargo passes, but crank MIR optimizations up all the
|
||||||
|
# way, too).
|
||||||
# Optimizations change diagnostics (mostly backtraces), so we don't check
|
# Optimizations change diagnostics (mostly backtraces), so we don't check
|
||||||
# them. Also error locations change so we don't run the failing tests.
|
# them. Also error locations change so we don't run the failing tests.
|
||||||
# We explicitly enable debug-assertions here, they are disabled by -O but we have tests
|
# We explicitly enable debug-assertions here, they are disabled by -O but we have tests
|
||||||
@ -51,6 +54,9 @@ function run_tests {
|
|||||||
for FILE in tests/many-seeds/*.rs; do
|
for FILE in tests/many-seeds/*.rs; do
|
||||||
MIRI_SEEDS=64 CARGO_EXTRA_FLAGS="$CARGO_EXTRA_FLAGS -q" ./miri many-seeds ./miri run "$FILE"
|
MIRI_SEEDS=64 CARGO_EXTRA_FLAGS="$CARGO_EXTRA_FLAGS -q" ./miri many-seeds ./miri run "$FILE"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Check that the benchmarks build and run, but without actually benchmarking.
|
||||||
|
HYPERFINE="bash -c" ./miri bench
|
||||||
fi
|
fi
|
||||||
|
|
||||||
## test-cargo-miri
|
## test-cargo-miri
|
||||||
@ -75,13 +81,6 @@ function run_tests {
|
|||||||
unset RUSTC MIRI
|
unset RUSTC MIRI
|
||||||
rm -rf .cargo
|
rm -rf .cargo
|
||||||
|
|
||||||
# Ensure that our benchmarks all work, but only on Linux hosts.
|
|
||||||
if [ -z "${MIRI_TEST_TARGET+exists}" ] && [ "$HOST_TARGET" = x86_64-unknown-linux-gnu ] ; then
|
|
||||||
for BENCH in $(ls "bench-cargo-miri"); do
|
|
||||||
cargo miri run --manifest-path bench-cargo-miri/$BENCH/Cargo.toml
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
endgroup
|
endgroup
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,6 +184,8 @@ many-seeds)
|
|||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
bench)
|
bench)
|
||||||
|
# The hyperfine to use
|
||||||
|
HYPERFINE=${HYPERFINE:-hyperfine -w 1 -m 5 --shell=none}
|
||||||
# Make sure we have an up-to-date Miri installed
|
# Make sure we have an up-to-date Miri installed
|
||||||
"$0" install
|
"$0" install
|
||||||
# Run the requested benchmarks
|
# Run the requested benchmarks
|
||||||
@ -193,7 +195,7 @@ bench)
|
|||||||
BENCHES=("$@")
|
BENCHES=("$@")
|
||||||
fi
|
fi
|
||||||
for BENCH in "${BENCHES[@]}"; do
|
for BENCH in "${BENCHES[@]}"; do
|
||||||
hyperfine -w 1 -m 5 --shell=none "cargo +$TOOLCHAIN miri run --manifest-path $MIRIDIR/bench-cargo-miri/$BENCH/Cargo.toml"
|
$HYPERFINE "cargo +$TOOLCHAIN miri run --manifest-path $MIRIDIR/bench-cargo-miri/$BENCH/Cargo.toml"
|
||||||
done
|
done
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
@ -280,10 +282,9 @@ find_sysroot() {
|
|||||||
# Run command.
|
# Run command.
|
||||||
case "$COMMAND" in
|
case "$COMMAND" in
|
||||||
install)
|
install)
|
||||||
# "--locked" to respect the Cargo.lock file if it exists.
|
|
||||||
# Install binaries to the miri toolchain's sysroot so they do not interact with other toolchains.
|
# Install binaries to the miri toolchain's sysroot so they do not interact with other toolchains.
|
||||||
$CARGO install $CARGO_EXTRA_FLAGS --path "$MIRIDIR" --force --locked --root "$SYSROOT" "$@"
|
$CARGO install $CARGO_EXTRA_FLAGS --path "$MIRIDIR" --force --root "$SYSROOT" "$@"
|
||||||
$CARGO install $CARGO_EXTRA_FLAGS --path "$MIRIDIR"/cargo-miri --force --locked --root "$SYSROOT" "$@"
|
$CARGO install $CARGO_EXTRA_FLAGS --path "$MIRIDIR"/cargo-miri --force --root "$SYSROOT" "$@"
|
||||||
;;
|
;;
|
||||||
check)
|
check)
|
||||||
# Check, and let caller control flags.
|
# Check, and let caller control flags.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user