You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have noticed this behavior since upgrading to macOS 14.4. I don't believe it was present in macOS 14.2
If I have a test case that starts a process and then sends a SIGINT to it, the signal is not delivered if the test case is run via test2json. If it is run directly via go test or by directly executing a test binary, the signal is delivered.
The following is a minimal testcase that reproduces the behavior:
If I run this test via go test or create a binary and run it, it passes:
spike@Codebook execsigs % go test -v execsigs_test.go
=== RUN TestSigInt
--- PASS: TestSigInt (0.00s)
PASS
ok command-line-arguments 0.833s
spike@Codebook execsigs % go test -c -o test execsigs_test.go
spike@Codebook execsigs % ./test -test.v
=== RUN TestSigInt
--- PASS: TestSigInt (0.00s)
PASS
But if I run via test2json, it fails. The SIGINT is not delivered to sleep and so instead of exiting with an error, the test takes 10 seconds and the process exits cleanly.
spike@Codebook execsigs % go tool test2json ./test -test.v=test2json
{"Action":"start"}
{"Action":"run","Test":"TestSigInt"}
{"Action":"output","Test":"TestSigInt","Output":"=== RUN TestSigInt\n"}
{"Action":"output","Test":"TestSigInt","Output":"--- FAIL: TestSigInt (10.01s)\n"}
{"Action":"fail","Test":"TestSigInt"}
{"Action":"output","Output":"FAIL\n"}
{"Action":"fail"}
What did you expect to see?
test2json result of the test should be identical to go test, i.e. the SIGINT is delivered to the process during the test.
This is pretty annoying because IDEs like GoLand depend on test2json to execute go tests under the hood.
The text was updated successfully, but these errors were encountered:
This is NOT a duplicate of #54023 which appears to be about whether test2json handles signals sent to it. This is about whether a unit test can successfully send a signal to a 3rd process created by the test.
seankhliao
changed the title
cmd/test2json: signals are not sent to os.Process when run via test2json
cmd/test2json: tests inherit signal.Ignore from test2son
Mar 27, 2024
Go version
go version go1.22.1 darwin/arm64
Output of
go env
in your module/workspace:What did you do?
I have noticed this behavior since upgrading to macOS 14.4. I don't believe it was present in macOS 14.2
If I have a test case that starts a process and then sends a
SIGINT
to it, the signal is not delivered if the test case is run via test2json. If it is run directly viago test
or by directly executing a test binary, the signal is delivered.The following is a minimal testcase that reproduces the behavior:
What did you see happen?
If I run this test via
go test
or create a binary and run it, it passes:But if I run via
test2json
, it fails. The SIGINT is not delivered tosleep
and so instead of exiting with an error, the test takes 10 seconds and the process exits cleanly.What did you expect to see?
test2json
result of the test should be identical togo test
, i.e. the SIGINT is delivered to the process during the test.This is pretty annoying because IDEs like GoLand depend on
test2json
to execute go tests under the hood.The text was updated successfully, but these errors were encountered: