x/tools/go/analysis/internal/checker: tests failing on Plan 9 because of dependence on numeric exit codes #68290
Labels
help wanted
NeedsFix
The path to resolution is known, but the work has not been done.
OS-Plan9
Tools
This label describes issues relating to any tools in the x/tools repository.
Milestone
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,.The text was updated successfully, but these errors were encountered: