Repository navigation
fix(go): keep the final fuzz stats in the go test summary - #1444
Conversation
|
The code is ready for review. Thanks for the attention. |
|
Anything, Guys? |
1 similar comment
|
Anything, Guys? |
|
#1610 (merged 2026-05-08) changed run_test so that any -bench run skips -json and passes output through raw, which covers the benchmark part of this PR and makes the BENCH_RESULT_RE path and its tests dead code. What develop still lacks is the fuzz handling (keeping the last |
|
I'll do it today |
… filter Successful fuzz runs collapsed to a bare "N passed", dropping the final "fuzz: elapsed:" line. Non-JSON stdout (e.g. setup errors) was discarded, so users saw "Go test: No tests found" instead of the real error.
76c6283 to
1de69e6
Compare
|
@KuSh thanks for the feedback, the PR is ready for review. |
KuSh
left a comment
There was a problem hiding this comment.
Round 1 of 3 — CHANGES REQUESTED
Claim: keep the final fuzz: elapsed: line in the green go test summary, and show non-JSON stdout lines instead of "No tests found". The benchmark part of the title and description landed in #1610 and is no longer in the diff.
Scope (round 1, frozen): accept if narrowed to "keep the last fuzz: elapsed: line per package in the green go test summary". The non-JSON surfacing is the part to cut.
Ran: rtk go test and rtk pipe -f go-test, develop merge-base against this head, on real Go 1.24.6 and 1.22.12 (docker). Green units, green fuzz (-fuzztime=4s, 100x, with -timeout), failing fuzz, missing go, -list/-n/-x/-work/-c, 9 error scenarios, plain-text and chatter-merged pipe inputs; stdout and stderr captured separately; the hook form is rtk go test …. Savings 95% on the green fuzz run vs the 20% floor. fmt, clippy and cargo test --all pass on this head (4075 tests) and on this head merged onto current develop (4106).
Pins: 4 mutations of the new logic run against the 107 go_cmd tests; 3 caught, 1 survived (blocker 2).
CI @1de69e6: 11/11 green (the run was waiting for approval; I approved it).
Blocks merge (2, frozen at round 1)
src/cmds/go/go_cmd.rs:416— the non-JSON arm is unreachable on the real producer, and wrong on the only input that reaches it.rtk go testruns the filter on stdout only. Go 1.24.6 and 1.22.12 write no non-JSON line to stdout in any of the 9 scenarios above (compile failure, missing package, nogo.mod,-list,-n,-x,-work,-c, bad vet flag); those errors go to stderr, which rtk already forwards. The three new tests useerror: cannot find package, which no producer emits on stdout.rtk pipe -f go-testis the only caller that can feed it. A green no-test stream plus onego: downloading …line (stderr merged by2>&1) printsGo test: No tests foundon develop andGo test: error+ that line on this head, at exit 0. Plain-text output of 25okpackages and oneFAILprintsGo test: error, 20oklines and... +10 more lines; theFAILis in the hidden part.- To merge: cut the arm and its three tests (the narrowed claim above). The plain-text pipe input is tracked in #4418.
src/cmds/go/go_cmd.rs:423— unpinned behaviour: no test pins that a failing fuzz run reports the failure instead of the fuzz summary.- Mutation:
if !has_failures && total_fuzz > 0 {→if total_fuzz > 0 {passes 107/107go_cmdtests. With it, a crashing fuzz target printsGo test: N passed, 1 fuzz in 1 packagesplus the last progress line, and the failure is gone. This precedence is the new decision in the PR; nothing exercises it. - To merge, a test must: feed a failing-fuzz stream (real shape:
fuzz: elapsed:output events with aTest, then--- FAIL, afailevent for the test and a package-levelfail), and assert the output starts withGo test: … failed, contains the failure text, and contains nofuzz in. The mutation above must turn it red. - The behaviour itself is correct: on a real failing fuzz run (
-fuzz=FuzzRev -fuzztime=4s) develop and this head print byte-identical failure reports. This would be a fixup on its own; it is listed here because blocker 1 sends the PR back anyway.
- Mutation:
Optional — will not hold merge
test_filter_go_test_fuzz_multi_package_sortedmodels a stream Go cannot produce:-fuzzover several packages stops withcannot use -fuzz flag with multiple packageson stderr and an empty stdout.- The header
N fuzz in M packagescounts packages, and2 passed, 1 fuzzcounts the same target in both numbers. Wording only. - The description still lists the benchmark change and its manual test (#1610 has it). After the narrowing,
Fixes #1445would close that issue with its third item unaddressed;Part of #1445may fit better. That is the author's and the maintainer's call.
Filed as follow-ups
- #4418
rtk pipe -f go-testreports plain-textgo testoutput as "No tests found" — pre-existing; the only input that reaches the cut arm. - #4419
rtk go test -listprints "No tests found" while the stream lists the tests — pre-existing, outside this PR's hunks.
Checked and correct — no need to re-verify
- The fuzz half works:
-fuzz=FuzzRev -fuzztime=4sprintsGo test: 2 passed in 1 packageson develop and, on this head, the same line plusfuzz: elapsed: 5s, execs: …. The kept line is Go's own last progress line, so its(0/sec)is Go's. - Failing fuzz runs, green unit runs and a missing
gobinary print the same output as develop.-fuzz -timeout 2sis a green run. - Mutations that were caught: keeping the first progress line instead of the last (2 tests), applying the non-JSON branch when tests passed (1 test).
Your questions
None.
Next
Delete the non-JSON arm and its three tests, and add the failing-fuzz test described in blocker 2. Then this merges once CI is green on the final head.
Rounds: 1/3. Threads: 0 open.
Non-JSON stdout never reaches the filter from rtk go test (Go writes errors to stderr), and via rtk pipe it hid real failures, so the arm and its tests are removed. Add a test asserting a failing fuzz run reports the failure instead of the green fuzz summary.
|
Real run on Go 1.27.1 with the latest head. Green fuzz run ( Failing fuzz run ( |
|
@KuSh all blockers are fixed, let me know if you have any further considerations. |
A fuzz run whose package fails without a test-level fail (TestMain exiting non-zero after a green run) must report the failure, not the fuzz summary. Also move the comment back above the output push and restore the blank line the previous commit removed. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
KuSh
left a comment
There was a problem hiding this comment.
Round 2 of 3 — APPROVED, follow-ups filed
Claim: keep the final fuzz: elapsed: line of a package in the green go test summary.
Scope (round 1, frozen): accept if narrowed to that claim. The PR is now exactly that.
Ran: rtk go test and rtk pipe -f go-test, develop merge-base against this head and against the fixup below, on Go 1.26.1. Green and failing fuzz (-fuzztime=4s, 100x, with -timeout), units, -list, no tests, setup failure, missing go, a TestMain that exits non-zero after a green fuzz run, the hook form (rtk go test …); stdout and stderr captured separately. Everything except the fuzz line is byte-identical to develop, and both round-1 pipe repros now match develop. Savings on green fuzz runs 95–96% vs the 20% floor.
Pins: 10 mutations of the new logic on 4daca6a; the capture, keep-last, count, header and failure-over-fuzz guard mutations are caught. Four pass the suite (sort, swapped header counts, the fuzz: prefix, trim_end) and none changes the output of a stream Go can emit: -fuzz over several packages is refused by Go, and a green fuzz run only prints fuzz: elapsed: lines. On the fixup, narrowing the guard to total_fail == 0, dropping total_pkg_fail and dropping the guard each turn a test red.
CI @77b6861: 11/11 green. fmt, clippy and cargo test --all also pass locally on the fixup (4073 tests), and the fixup applies cleanly on current develop.
Blocks merge (0; the 2 from round 1 are fixed in 4daca6a)
- The non-JSON arm is removed; the pipe outputs are identical to develop.
- Failing-fuzz precedence is pinned by
test_filter_go_test_failing_fuzz_reports_failure_not_fuzz_summary; theif total_fuzz > 0mutation turns it red.
Filed as follow-ups
- #4434 A failing fuzz run drops the failing-input path and the re-run command — pre-existing, outside this PR's hunks.
- #4418 and #4419 from round 1 are unchanged.
Checked and correct — no need to re-verify
- The summary with the fuzz line appears only on green runs. Failing fuzz, unit failures and package-level failures print the same as develop.
- Missing
go, the hook form and the setup-failure row are unchanged from develop.
Your questions
None.
Next
Fixup 77b6861 pushed, code-reviewed and run before/after by a fresh agent (six rows identical) — approving. It adds test_filter_go_test_fuzz_package_failure_reports_failure_not_fuzz_summary (a package-level failure after a green fuzz run, the real TestMain exit-3 shape, must report the failure), restores the blank line the PR deleted, and puts a comment back above the code it describes. No production behaviour changes.
Rounds: 2/3. Threads: 0 open, 1 resolved this round (the other was already resolved).
Summary
Part of #1445
fuzz: elapsed:line of a package in the greengo testsummary instead of dropping all fuzz output; the intermediate progress lines are still filtered, and a run with a failure still reports the failure.Test plan
cargo fmt --all && cargo clippy --all-targets && cargo testrtk go test -fuzz=FuzzRev -fuzztime=4s ./pkgprints the final fuzz stats line