aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland Shoemaker <roland@golang.org>2021-09-02 14:38:58 -0700
committerRoland Shoemaker <roland@golang.org>2021-09-03 18:34:56 +0000
commit9c56a64673d2f458e28c603f95b4efb5d39beef2 (patch)
tree79d3b1366cec6ee66767ca0b1e204c82f17a7197
parente5247f7886aad90d6fa402b5308d4c30afdfebdf (diff)
downloadgo-9c56a64673d2f458e28c603f95b4efb5d39beef2.tar.xz
[dev.fuzz] internal/fuzz: maintain debug info during minimization
Change-Id: I70c0229e43dfe37f70b9c79c2e6fe88d7b8d7bd0 Reviewed-on: https://go-review.googlesource.com/c/go/+/347231 Trust: Roland Shoemaker <roland@golang.org> Run-TryBot: Roland Shoemaker <roland@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com>
-rw-r--r--src/internal/fuzz/fuzz.go3
-rw-r--r--src/internal/fuzz/worker.go5
2 files changed, 7 insertions, 1 deletions
diff --git a/src/internal/fuzz/fuzz.go b/src/internal/fuzz/fuzz.go
index 722933a0bf..5b940e4929 100644
--- a/src/internal/fuzz/fuzz.go
+++ b/src/internal/fuzz/fuzz.go
@@ -341,10 +341,11 @@ func CoordinateFuzzing(ctx context.Context, opts CoordinateFuzzingOpts) (err err
if printDebugInfo() {
fmt.Fprintf(
c.opts.Log,
- "DEBUG worker reported interesting input that doesn't expand coverage, elapsed: %s, id: %s, parent: %s\n",
+ "DEBUG worker reported interesting input that doesn't expand coverage, elapsed: %s, id: %s, parent: %s, minimized: %t\n",
time.Since(c.startTime),
result.entry.Name,
result.entry.Parent,
+ result.minimizeAttempted,
)
}
}
diff --git a/src/internal/fuzz/worker.go b/src/internal/fuzz/worker.go
index 2f5704094e..32b13662c8 100644
--- a/src/internal/fuzz/worker.go
+++ b/src/internal/fuzz/worker.go
@@ -1017,6 +1017,11 @@ func (wc *workerClient) minimize(ctx context.Context, entryIn CorpusEntry, args
return CorpusEntry{}, minimizeResponse{}, errSharedMemClosed
}
entryOut.Data = mem.valueCopy()
+ h := sha256.Sum256(entryOut.Data)
+ name := fmt.Sprintf("%x", h[:4])
+ entryOut.Name = name
+ entryOut.Parent = entryIn.Parent
+ entryOut.Generation = entryIn.Generation
resp.Count = mem.header().count
return entryOut, resp, callErr