On Mon, Mar 5, 2018 at 10:10 AM, andrey mirtchovski <mirtchov...@gmail.com> wrote: > > I finally found some time to work on this and I think I figured out > why it fails. I run a very large history file (my HISTSIZE is set to > 100000) and on this particular machine I'm at the limit. This causes > the os/signal test to run an average 6-7 seconds. The test timeout as > shown in my second email seems to be 5 seconds. > > The easiest way I could find to disable history loading in the bash > shell is to set HISTFILE=/dev/null. This reduces the test duration to > ~0.2 seconds from ~1.9 seconds. This is sufficient to pass the test: > > ------------8<-------------------- > $ go test -run TestTerminalSignal # original > PASS > ok os/signal 1.923s > $ vi signal_cgo_test.go > $ go test -run TestTerminalSignal # with HISTFILE=/dev/null > PASS > ok os/signal 0.136s > $ git diff . > diff --git a/src/os/signal/signal_cgo_test.go > b/src/os/signal/signal_cgo_test.go > index 84a2a08ce9..c1cedc7910 100644 > --- a/src/os/signal/signal_cgo_test.go > +++ b/src/os/signal/signal_cgo_test.go > @@ -89,6 +89,7 @@ func TestTerminalSignal(t *testing.T) { > ctx, cancel := context.WithTimeout(context.Background(), > 10*time.Second) > defer cancel() > cmd := exec.CommandContext(ctx, bash, "--norc", "--noprofile", "-i") > + cmd.Env = append(os.Environ(), "HISTFILE=/dev/null") > cmd.Stdin = slave > cmd.Stdout = slave > cmd.Stderr = slave > ------------8<-------------------- > > If this is an acceptable solution I can prepare a PR on GitHub.
Thanks for figuring this out. It seems very strange to me that a history file could cause the test to take more than 5 seconds. That said, setting HISTFILE is probably a good idea anyhow. I think it should work to set it to the empty string, which would be slightly better than /dev/null. Thanks. Ian > On Tue, Feb 6, 2018 at 4:20 PM, Ian Lance Taylor <i...@golang.org> wrote: >> On Tue, Feb 6, 2018 at 2:54 PM, andrey mirtchovski >> <mirtchov...@gmail.com> wrote: >>> $ go test -c os/signal >>> $ ./signal.test >>> PASS >>> $ go tool dist test -v >>> >>> ##### Testing packages. >>> # go tool dist test -run=^go_test:archive/tar$ >>> [...] >>> ok net/url (cached) >>> ok os 0.677s >>> ok os/exec 1.414s >>> --- FAIL: TestTerminalSignal (5.01s) >>> signal_cgo_test.go:138: "PS1='prompt> '\r\n" >>> signal_cgo_test.go:163: timed out waiting for shell prompt >>> FAIL >>> FAIL os/signal 10.104s >>> ok os/user (cached) >>> [...] >>> >>> At which point I interrupted it. I blew up the entire go repo at and >>> cloned it again at tip. This persists. >>> >>> $ go version >>> go version devel +23e8e197b0 Tue Feb 6 18:24:33 2018 +0000 darwin/amd64 >> >> I'm sorry, I have no idea, and nobody else has reported this. We >> could just disable the test, but it would be nice to see at least one >> more report before doing that. >> >> Ian -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.