From 43b64762628a79eb38c2e907f7c3e2afbff77a03 Mon Sep 17 00:00:00 2001 From: Andrey Mirtchovski Date: Mon, 5 Mar 2018 20:04:25 +0000 Subject: [PATCH] os/signal: disable loading of history during test This change modifies Go to disable loading of users' shell history for TestTerminalSignal tests. TestTerminalSignal, as part of its workload, will execute a new interactive bash shell. Bash will attempt to load the user's history from the file pointed to by the HISTFILE environment variable. For users with large histories that may take up to several seconds, pushing the whole test past the 5 second timeout and causing it to fail. Change-Id: I11b2f83ee91f51fa1e9774a39181ab365f9a6b3a GitHub-Last-Rev: 7efdf616a2fcecdf479420fc0004057cee2ea6b2 GitHub-Pull-Request: golang/go#24255 Reviewed-on: https://go-review.googlesource.com/98616 Reviewed-by: Brad Fitzpatrick --- src/os/signal/signal_cgo_test.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/os/signal/signal_cgo_test.go b/src/os/signal/signal_cgo_test.go index 84a2a08ce9..16aeea8221 100644 --- a/src/os/signal/signal_cgo_test.go +++ b/src/os/signal/signal_cgo_test.go @@ -89,6 +89,8 @@ func TestTerminalSignal(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() cmd := exec.CommandContext(ctx, bash, "--norc", "--noprofile", "-i") + // Clear HISTFILE so that we don't read or clobber the user's bash history. + cmd.Env = append(os.Environ(), "HISTFILE=") cmd.Stdin = slave cmd.Stdout = slave cmd.Stderr = slave