1
0
mirror of https://github.com/golang/go synced 2024-11-26 03:57:57 -07:00

misc/cgo/testsanitizers: run libfuzzer tests in temp directory

The libFuzzer generated binary by default writes failure input
into the current directory. Set cmd.Dir to the temporary directory
so it won't write to GOROOT when running the test.

Change-Id: I3e4ce7e3f845be5c9f09511c36e7a9a396eafad2
Reviewed-on: https://go-review.googlesource.com/c/go/+/459556
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
Cherry Mui 2022-12-27 17:29:28 -05:00
parent e870de9936
commit 9123221ccf

View File

@ -60,6 +60,7 @@ func TestLibFuzzer(t *testing.T) {
mustRun(t, cmd)
cmd = hangProneCmd(outPath)
cmd.Dir = dir.Base()
outb, err := cmd.CombinedOutput()
out := string(outb)
if err == nil {