Closed millerresearch closed 4 hours ago
Related Issues
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)
Thanks for the report.
Change https://go.dev/cl/596735 mentions this issue: go/analysis/internal/checker: allow for Plan 9 reduced exit codes in tests
Go version
gotip
Output of
go env
in your module/workspace:What did you do?
In
x/tools
subrepo, Plan 9 builder rango test -json -short ./...
What did you see happen?
Tests
TestFixes
andTestNoEnd
are consistently failing:What did you expect to see?
Expected all tests to pass or be skipped.
The underlying problem is that process exit codes in UNIX-family operating systems are numeric, but in Plan 9 they are strings. The Plan 9 convention is that an empty string exit code means "success"; any other string means "failure" and the content of the string explains the reason, in more detail than a numeric
errno
value would allow.The current Plan 9 implementation of
os.ProcessState.ExitCode()
is to return 0 if the Plan 9 exit string is empty, and 1 otherwise. This is sufficient in most cases, but not for applications which attempt to pass more information via exit codes than a simple fail/succeed indication -- as in the case of these failing tests where an exit code of 3 is expected.My opinion is that it would not be unreasonable, when both parent and child process are Go programs, that if the child process exits with
os.Exit(
n)
then the correspondingos.Wait()
in the parent should return with anExitCode()
of n. This could be arranged by parsing the Plan 9 exit string, and if it contains a non-zero numeric value and nothing else, returning that value instead of 1.In the meantime, however, the
TestFixes
andTestNoEnd
tests should be modified to permit an exit code of 1 in the case of Plan 9,.