1
0
mirror of https://github.com/golang/go synced 2024-09-24 01:20:13 -06:00

misc/cgo/testcshared: use adb exec-out instead of adb shell

Adb exec-out is like adb shell except non-flaky in non-interactive
settings. Don't ask why.

Change-Id: I7ac3c72912883d80bc787c1d0fc101db6bae9c52
Reviewed-on: https://go-review.googlesource.com/c/go/+/170952
Run-TryBot: Elias Naur <mail@eliasnaur.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Elias Naur 2019-04-08 15:45:16 +02:00
parent 081bc62d72
commit 00530918db

View File

@ -46,7 +46,7 @@ func testMain(m *testing.M) int {
androiddir = fmt.Sprintf("/data/local/tmp/testcshared-%d", os.Getpid())
if GOOS == "android" {
args := append(adbCmd(), "shell", "mkdir", "-p", androiddir)
args := append(adbCmd(), "exec-out", "mkdir", "-p", androiddir)
cmd := exec.Command(args[0], args[1:]...)
out, err := cmd.CombinedOutput()
if err != nil {
@ -191,7 +191,7 @@ func adbRun(t *testing.T, env []string, adbargs ...string) string {
if GOOS != "android" {
t.Fatalf("trying to run adb command when operating system is not android.")
}
args := append(adbCmd(), "shell")
args := append(adbCmd(), "exec-out")
// Propagate LD_LIBRARY_PATH to the adb shell invocation.
for _, e := range env {
if strings.Index(e, "LD_LIBRARY_PATH=") != -1 {
@ -298,7 +298,7 @@ func cleanupAndroid() {
if GOOS != "android" {
return
}
args := append(adbCmd(), "shell", "rm", "-rf", androiddir)
args := append(adbCmd(), "exec-out", "rm", "-rf", androiddir)
cmd := exec.Command(args[0], args[1:]...)
out, err := cmd.CombinedOutput()
if err != nil {