mirror of
https://github.com/golang/go
synced 2024-11-06 14:16:15 -07:00
27aa60f540
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> |
||
---|---|---|
.. | ||
exitcode_test.go | ||
main.go | ||
README |
Android ======= For details on developing Go for Android, see the documentation in the mobile subrepository: https://github.com/golang/mobile To run the standard library tests, enable Cgo and use an appropriate C compiler from the Android NDK. For example, CGO_ENABLED=1 \ GOOS=android \ GOARCH=arm64 \ CC_FOR_TARGET=$NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android21-clang \ ./all.bash To run tests on the Android device, add the bin directory to PATH so the go tool can find the go_android_$GOARCH_exec wrapper generated by make.bash. For example, to run the go1 benchmarks export PATH=$GOROOT/bin:$PATH cd $GOROOT/test/bench/go1/ GOOS=android GOARCH=arm64 go test -bench=. -count=N -timeout=T