Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testing: tests involving SIGINT handler fail with -test.v #21000

Closed
hyangah opened this issue Jul 13, 2017 · 1 comment

Comments

Projects
None yet
3 participants
@hyangah
Copy link
Contributor

commented Jul 13, 2017

Since http://golang.org/cl/44352, a SIGINT handler is set up by testing framework when running tests with -v.
The handler reports in-progress tests upon SIGINT, and then re-raise SIGINT.
This can cause troubles when other SIGINT handlers exist.

Minimal repro case from @neild

func TestSignals(t *testing.T) {
	proc, err := os.FindProcess(os.Getpid())
	if err != nil {
		t.Fatal(err)
	}

	sigc := make(chan os.Signal, 1)
	signal.Notify(sigc, os.Interrupt)

	go func() {
		<-sigc
		signal.Stop(sigc)
	}()

	proc.Signal(os.Interrupt)
	time.Sleep(1 * time.Second)
}
$ go test -v
=== RUN   TestSignals
tests in progress: TestSignals
signal: interrupt
FAIL    _/usr/local/google/home/hakim/tmp/signal        0.020s

$ go test
PASS
ok      _/usr/local/google/home/hakim/tmp/signal        1.016s

This is confusing and affecting users.

@bcmills @ianlancetaylor

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Jul 13, 2017

Already fixed by CL 48370 which rolled back the patch installed to fix #19397. Closing this issue.

@golang golang locked and limited conversation to collaborators Jul 13, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.