Commit 9a95bac1 authored by trinity-1686a's avatar trinity-1686a
Browse files

better config for fuzz

parent 6ce6e400
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@ cd "$TOPDIR"
# for some reason, compiling with coverage is very slow, especially for curve25519-dalek,
# and mixing normal runs and coverage runs trash the cache. Here we set an alternative
# target directory so it's possible to reuse cached artifacts between coverage runs.
export CARGO_TARGET_DIR="target-coverage"
export CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-target-coverage}

# remove comments starting with #@ to run in parallel. This makes output very messy, uses a lot more
# ram and make the load average go crazy, but it's also way faster both to compile (due to 
@@ -28,7 +28,7 @@ for d in ./crates/*/fuzz; do
        mkdir -p "$TOPDIR/target/debug/$crate"
        mkdir -p "$coverage_dir/$crate"
        for fuzzer in $(cargo fuzz list); do
            cargo +nightly fuzz coverage "$fuzzer"
            cargo fuzz coverage "$fuzzer"

            # we copy binary and coverage data where with_coverage expect it to be
            cp "target-coverage/x86_64-unknown-linux-gnu/release/$fuzzer" "$TOPDIR/target/debug/$crate/$fuzzer"
+8 −2
Original line number Diff line number Diff line
@@ -2,11 +2,17 @@

set -e

echo "Using toolchain +${RUST_FUZZ_TOOLCHAIN:=nightly}. (Override with \$RUST_FUZZ_TOOLCHAIN)"

# Validate that "+${RUST_FUZZ_TOOLCHAIN}" is installed.  This will log a message to stderr
# if it itsn't.
cargo "+${RUST_FUZZ_TOOLCHAIN}" -h >/dev/null

for d in ./crates/*/fuzz; do
    pushd "$(dirname "$d")"
    for fuzzer in $(cargo fuzz list); do
	echo "$fuzzer"
	cargo +nightly fuzz build "$fuzzer"
	cargo "+${RUST_FUZZ_TOOLCHAIN}" fuzz build "$fuzzer"
    done
    popd
done
@@ -20,7 +26,7 @@ while true; do
    for d in ./crates/*/fuzz; do
	pushd "$(dirname "$d")"
	for fuzzer in $(cargo fuzz list); do
	    cargo +nightly fuzz run "$fuzzer" -- \
	    cargo "+${RUST_FUZZ_TOOLCHAIN}" fuzz run "$fuzzer" -- \
		-jobs="${JOBS:-0}" \
		-workers="${JOBS:-0}" \
		-max_total_time=$((DURATION * 60)) \