1
0
mirror of https://github.com/golang/go synced 2024-11-22 16:14:56 -07:00
go/misc
Austin Clements 27aa60f540 misc/android: improve exit code workaround
go_android_exec gets the exit status of the process run inside the
Android emulator by sending a small shell script that runs the desired
command and then prints "exitcode=" followed by the exit code. This is
necessary because adb does not reliably pass through the exit status
of the subprocess.

An old bug about this
(https://code.google.com/p/android/issues/detail?id=3254) was closed
in 2016 as fixed in Android N (7.0), but it seems that the adb on the
Android builder at least still sometimes fails to pass through the
exit code.

Unfortunately, this workaround has the effect of injecting
"exitcode=N" into the output of the subprocess it runs, which messes
up tests that are looking for golden output from a subprocess.

Fix this by inserting a filter Writer that looks for the final
"exitcode=N" and strips it from the exec wrapper's own stdout.

For #15919.

This will help us in cleaning up "host tests" for #37486.

Change-Id: I9859f5b215e0ec4a7e33ada04a1857f3cfaf55ae
Reviewed-on: https://go-review.googlesource.com/c/go/+/488975
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Austin Clements <austin@google.com>
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
2023-05-03 14:54:58 +00:00
..
arm
cgo cmd/link: write buildid to plugin 2023-04-28 16:02:17 +00:00
chrome/gophertool
go_android_exec misc/android: improve exit code workaround 2023-05-03 14:54:58 +00:00
ios
linkcheck
reboot make.{bash,bat}: check unmodified $PATH for $GOROOT/bin presence 2023-04-19 14:36:22 +00:00
swig
wasm misc/wasm: default to /tmp if TMPDIR is unset 2023-04-26 21:21:32 +00:00
editors
go.mod misc: update go.mod to 1.21 2023-01-26 16:55:59 +00:00