mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-10-03 02:25:35 +00:00
ci: update cargo fuzz command to use nightly toolchain explicitly (#9298)
* ci: update cargo fuzz command to use nightly toolchain explicitly
* ci: honor RUSTUP_TOOLCHAIN pin in fuzz orchestration script
An explicit `+toolchain` argument overrides the RUSTUP_TOOLCHAIN env var
in rustup precedence, so the hard-coded `cargo +nightly` in
run-fuzz-targets.sh bypassed the pinned FUZZ_RUST_TOOLCHAIN
(nightly-2026-03-21) configured in the workflow.
- Invoke `cargo +"${RUSTUP_TOOLCHAIN:-nightly}" fuzz run` in the script
so CI uses the pinned toolchain and local runs fall back to the
floating nightly
- Pass RUSTUP_TOOLCHAIN through to all four fuzz-test action invocations,
covering the no-prebuilt-binaries path and making the reproduce command
in the summary print the exact pinned toolchain
- Add test_rustup_toolchain_env_is_honored covering the pinned-env
scenario for both the cargo invocation args and the summary text
Addresses #9298 (review).
Signed-off-by: Ning Sun <sunning@greptime.com>
---------
Signed-off-by: Ning Sun <sunning@greptime.com>
This commit is contained in:
@@ -31,7 +31,7 @@ new_fixture() {
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
printf '%s\t%s\t%s\n' "${GT_FUZZ_DUMP_DIR}" "$*" "${MOCK_CARGO_MARKER:-}" >>"${MOCK_CARGO_LOG}"
|
||||
target="$3"
|
||||
target="$4"
|
||||
case " ${MOCK_FAIL_TARGETS:-} " in
|
||||
*" ${target} "*) exit 17 ;;
|
||||
esac
|
||||
@@ -117,6 +117,20 @@ EOF
|
||||
set -e
|
||||
}
|
||||
|
||||
test_rustup_toolchain_env_is_honored() {
|
||||
new_fixture
|
||||
export RUSTUP_TOOLCHAIN=nightly-2026-03-21
|
||||
run_fixture $'fuzz_create_table' true true "fuzz_create_table"
|
||||
unset RUSTUP_TOOLCHAIN
|
||||
|
||||
assert_eq 1 "${fixture_status}" "pinned toolchain run status"
|
||||
grep -q -- '+nightly-2026-03-21 fuzz run fuzz_create_table' "${fixture}/cargo.log" || \
|
||||
fail "pinned toolchain missing from cargo invocation"
|
||||
grep -q 'cargo +nightly-2026-03-21 fuzz run fuzz_create_table' "${fixture}/artifacts/summary.md" || \
|
||||
fail "pinned toolchain missing from reproduce command"
|
||||
cleanup_fixture
|
||||
}
|
||||
|
||||
test_successful_targets_run_in_order() {
|
||||
new_fixture
|
||||
run_fixture $'fuzz_create_table\nfuzz_insert' false true ""
|
||||
@@ -125,7 +139,7 @@ test_successful_targets_run_in_order() {
|
||||
assert_eq 2 "$(wc -l <"${fixture}/cargo.log" | tr -d ' ')" "cargo invocation count"
|
||||
assert_eq \
|
||||
$'fuzz_create_table\nfuzz_insert' \
|
||||
"$(awk -F '\t' '{print $2}' "${fixture}/cargo.log" | sed -E 's/^fuzz run ([^ ]+).*/\1/')" \
|
||||
"$(awk -F '\t' '{print $2}' "${fixture}/cargo.log" | sed -E 's/^\+nightly fuzz run ([^ ]+).*/\1/')" \
|
||||
"target order"
|
||||
grep -q -- '--features=unstable' "${fixture}/cargo.log" || fail "unstable feature missing"
|
||||
grep -q -- '-max_total_time=120' "${fixture}/cargo.log" || fail "fuzz time missing"
|
||||
@@ -175,7 +189,7 @@ test_fail_fast_stops_after_first_failure() {
|
||||
fail "skipped target annotation missing"
|
||||
grep -q '### Reproduce failed targets' "${fixture}/artifacts/summary.md" || \
|
||||
fail "reproduction section missing"
|
||||
grep -q 'cargo fuzz run fuzz_insert' "${fixture}/artifacts/summary.md" || \
|
||||
grep -q 'cargo +nightly fuzz run fuzz_insert' "${fixture}/artifacts/summary.md" || \
|
||||
fail "reproduction command missing"
|
||||
cleanup_fixture
|
||||
}
|
||||
@@ -367,5 +381,6 @@ test_collector_keeps_target_scopes_separate
|
||||
test_cluster_collector_honors_target_scope_and_namespace
|
||||
test_setup_failure_writes_artifact_contract
|
||||
test_setup_failure_keeps_manifest_when_collection_fails
|
||||
test_rustup_toolchain_env_is_honored
|
||||
|
||||
printf 'All fuzz orchestration script tests passed.\n'
|
||||
|
||||
@@ -104,7 +104,7 @@ write_summary() {
|
||||
reproduce_args+=("GT_FUZZ_INSTANCE_ROOT_DIR=${GT_FUZZ_INSTANCE_ROOT_DIR}")
|
||||
fi
|
||||
fi
|
||||
reproduce_args+=(cargo fuzz run "${target}" --fuzz-dir tests-fuzz -D -s none)
|
||||
reproduce_args+=(cargo +"${RUSTUP_TOOLCHAIN:-nightly}" fuzz run "${target}" --fuzz-dir tests-fuzz -D -s none)
|
||||
if [[ "${fuzz_unstable}" == true ]]; then
|
||||
reproduce_args+=(--features=unstable)
|
||||
fi
|
||||
@@ -195,7 +195,7 @@ for ((index = 0; index < ${#targets[@]}; index++)); do
|
||||
fi
|
||||
run_args=("${fuzz_binary}" "-max_total_time=${FUZZ_MAX_TOTAL_TIME}" "-artifact_prefix=${target_dir}/libfuzzer/")
|
||||
else
|
||||
run_args=(cargo fuzz run "${target}" --fuzz-dir tests-fuzz -D -s none)
|
||||
run_args=(cargo +"${RUSTUP_TOOLCHAIN:-nightly}" fuzz run "${target}" --fuzz-dir tests-fuzz -D -s none)
|
||||
if [[ "${fuzz_unstable}" == true ]]; then
|
||||
run_args+=(--features=unstable)
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user