aboutsummaryrefslogtreecommitdiff
path: root/src/testing/fuzz.go
diff options
context:
space:
mode:
authorsuntala <artichaut2023@gmail.com>2025-05-13 21:30:35 +0000
committerGopher Robot <gobot@golang.org>2025-05-13 15:43:42 -0700
commit9e026bf9cc1dcb6ef24d26398182a22d9d6cd2d2 (patch)
tree0b001b08e1a9f4006a3e0b08dfa4b7c1c274c320 /src/testing/fuzz.go
parentc44c4de51b68a88e2b8e4a0ae102f941155522d0 (diff)
downloadgo-9e026bf9cc1dcb6ef24d26398182a22d9d6cd2d2.tar.xz
testing: add Output
Output is a method on T, B and F. It provides an io.Writer that writes to the same test output stream as TB.Log. The new output writer is used to refactor the implementation of Log. It maintains the formatting provided by Log while making call site information optional. Additionally, it provides buffering of log messages. This fixes and expands on https://go-review.googlesource.com/c/go/+/646956. For #59928. Change-Id: I08179c35a681f601cf125c0f4aeb648bc10c7a9f GitHub-Last-Rev: e6e202793c9bc471493187e0556a3a1e7305ff82 GitHub-Pull-Request: golang/go#73703 Reviewed-on: https://go-review.googlesource.com/c/go/+/672395 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Alan Donovan <adonovan@google.com> Reviewed-by: Alan Donovan <adonovan@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Jonathan Amsterdam <jba@google.com>
Diffstat (limited to 'src/testing/fuzz.go')
-rw-r--r--src/testing/fuzz.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/testing/fuzz.go b/src/testing/fuzz.go
index 0e04aff6e7..c07d6a0604 100644
--- a/src/testing/fuzz.go
+++ b/src/testing/fuzz.go
@@ -320,6 +320,7 @@ func (f *F) Fuzz(ff any) {
t.parent.w = captureOut
}
t.w = indenter{&t.common}
+ t.setOutputWriter()
if t.chatty != nil {
t.chatty.Updatef(t.name, "=== RUN %s\n", t.name)
}
@@ -529,6 +530,7 @@ func runFuzzTests(deps testDeps, fuzzTests []InternalFuzzTarget, deadline time.T
fstate: fstate,
}
f.w = indenter{&f.common}
+ f.setOutputWriter()
if f.chatty != nil {
f.chatty.Updatef(f.name, "=== RUN %s\n", f.name)
}
@@ -614,6 +616,7 @@ func runFuzzing(deps testDeps, fuzzTests []InternalFuzzTarget) (ok bool) {
tstate: tstate,
}
f.w = indenter{&f.common}
+ f.setOutputWriter()
if f.chatty != nil {
f.chatty.Updatef(f.name, "=== RUN %s\n", f.name)
}