From 9123221ccf3c80c741ead5b6f2e960573b1676b9 Mon Sep 17 00:00:00 2001 From: Cherry Mui Date: Tue, 27 Dec 2022 17:29:28 -0500 Subject: [PATCH] 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 Run-TryBot: Cherry Mui TryBot-Result: Gopher Robot --- misc/cgo/testsanitizers/libfuzzer_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/misc/cgo/testsanitizers/libfuzzer_test.go b/misc/cgo/testsanitizers/libfuzzer_test.go index 6eebb17abf..345751b9c7 100644 --- a/misc/cgo/testsanitizers/libfuzzer_test.go +++ b/misc/cgo/testsanitizers/libfuzzer_test.go @@ -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 { -- 2.48.1