aboutsummaryrefslogtreecommitdiff
path: root/src/androidtest.bash
diff options
context:
space:
mode:
authorElias Naur <mail@eliasnaur.com>2019-02-24 15:18:02 +0100
committerBrad Fitzpatrick <bradfitz@golang.org>2019-02-26 18:00:48 +0000
commite3d99a3f8608e308eedc201b83eeb2f0e0d9dc81 (patch)
tree17530050f0fcf0b10a80ec80199ffea97cde4404 /src/androidtest.bash
parent3ef7e3d44f3dfaceab83b779c8bcd1cebe834de2 (diff)
downloadgo-e3d99a3f8608e308eedc201b83eeb2f0e0d9dc81.tar.xz
misc/android,cmd/dist: move $GOROOT copying to the exec wrapper
To run the standard library tests on Android, the androidtest.bash script copies GOROOT to the device. Move that logic to the android exec wrapper, thereby making androidtest.bash obsolete. Apart from making Android less special, the sharded builder infrastructure should now be able to run (emulated) Android builders and trybots without special treatment. Updates #23824 Change-Id: I41591fea9a15b38c6dcf84046ea57f1e9165eaa5 Reviewed-on: https://go-review.googlesource.com/c/163619 Run-TryBot: Elias Naur <mail@eliasnaur.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/androidtest.bash')
-rwxr-xr-xsrc/androidtest.bash52
1 files changed, 2 insertions, 50 deletions
diff --git a/src/androidtest.bash b/src/androidtest.bash
index 12f240cc58..ba776d2278 100755
--- a/src/androidtest.bash
+++ b/src/androidtest.bash
@@ -4,8 +4,6 @@
# license that can be found in the LICENSE file.
# For testing Android.
-# The compiler runs locally, then a copy of the GOROOT is pushed to a
-# target device using adb, and the tests are run there.
set -e
ulimit -c 0 # no core files
@@ -31,55 +29,9 @@ fi
export CGO_ENABLED=1
unset GOBIN
-# Do the build first, so we can build the 'cleaner' binary.
-# Also lets us fail early before the (slow) adb push if the build is broken.
-. ./make.bash --no-banner
export GOROOT=$(dirname $(pwd))
+# Put the exec wrapper into PATH
export PATH=$GOROOT/bin:$PATH
-export pkgdir=$(dirname $(go list -f '{{.Target}}' runtime))
-if [ "$pkgdir" = "" ]; then
- echo "could not find android pkg dir" 1>&2
- exit 1
-fi
-
-export ANDROID_TEST_DIR=/tmp/androidtest-$$
-
-function cleanup() {
- rm -rf ${ANDROID_TEST_DIR}
-}
-trap cleanup EXIT
-
-# Push GOROOT to target device.
-#
-# The adb sync command will sync either the /system or /data
-# directories of an android device from a similar directory
-# on the host. We copy the files required for running tests under
-# /data/local/tmp/goroot. The adb sync command does not follow
-# symlinks so we have to copy.
-export ANDROID_PRODUCT_OUT="${ANDROID_TEST_DIR}/out"
-FAKE_GOROOT=$ANDROID_PRODUCT_OUT/data/local/tmp/goroot
-mkdir -p $FAKE_GOROOT
-mkdir -p $FAKE_GOROOT/pkg
-cp -a "${GOROOT}/src" "${FAKE_GOROOT}/"
-cp -a "${GOROOT}/test" "${FAKE_GOROOT}/"
-cp -a "${GOROOT}/lib" "${FAKE_GOROOT}/"
-cp -a "${pkgdir}" "${FAKE_GOROOT}/pkg/"
-
-echo '# Syncing test files to android device'
-adb $GOANDROID_ADB_FLAGS shell mkdir -p /data/local/tmp/goroot
-time adb $GOANDROID_ADB_FLAGS sync data &> /dev/null
-
-export CLEANER=${ANDROID_TEST_DIR}/androidcleaner-$$
-cp ../misc/android/cleaner.go $CLEANER.go
-echo 'var files = `' >> $CLEANER.go
-(cd $ANDROID_PRODUCT_OUT/data/local/tmp/goroot; find . >> $CLEANER.go)
-echo '`' >> $CLEANER.go
-go build -o $CLEANER $CLEANER.go
-adb $GOANDROID_ADB_FLAGS push $CLEANER /data/local/tmp/cleaner
-adb $GOANDROID_ADB_FLAGS shell /data/local/tmp/cleaner
-
-echo ''
-
# Run standard tests.
-bash run.bash --no-rebuild
+bash all.bash