Skip to content

Commit 9123221

Browse files
committed
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 <[email protected]> Run-TryBot: Cherry Mui <[email protected]> TryBot-Result: Gopher Robot <[email protected]>
1 parent e870de9 commit 9123221

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

misc/cgo/testsanitizers/libfuzzer_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ func TestLibFuzzer(t *testing.T) {
6060
mustRun(t, cmd)
6161

6262
cmd = hangProneCmd(outPath)
63+
cmd.Dir = dir.Base()
6364
outb, err := cmd.CombinedOutput()
6465
out := string(outb)
6566
if err == nil {

0 commit comments

Comments
 (0)