mirror of
https://github.com/golang/go
synced 2024-11-18 15:14:44 -07:00
68f57c8327
The tests for go/types depend on reading gc export data from the $GOROOT/pkg directory. This is the first use of these files as testdata, so previously they were not copied to the android device. Now they are used, copy them. Fixes android/arm build. Change-Id: If13bbe603ce0aff697a73a97ae9a7d6b3ea800f9 Reviewed-on: https://go-review.googlesource.com/8624 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
59 lines
1.8 KiB
Bash
Executable File
59 lines
1.8 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Copyright 2014 The Go Authors. All rights reserved.
|
|
# Use of this source code is governed by a BSD-style
|
|
# 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
|
|
|
|
if [ ! -f make.bash ]; then
|
|
echo 'androidtest.bash must be run from $GOROOT/src' 1>&2
|
|
exit 1
|
|
fi
|
|
|
|
if [ -z $GOOS ]; then
|
|
export GOOS=android
|
|
fi
|
|
if [ "$GOOS" != "android" ]; then
|
|
echo "androidtest.bash requires GOOS=android, got GOOS=$GOOS" 1>&2
|
|
exit 1
|
|
fi
|
|
|
|
export CGO_ENABLED=1
|
|
|
|
# Run the build for the host bootstrap, so we can build go_android_exec.
|
|
# Also lets us fail early before the (slow) adb push if the build is broken.
|
|
./make.bash
|
|
export GOROOT=$(dirname $(pwd))
|
|
export PATH=$GOROOT/bin:$PATH
|
|
GOOS=$GOHOSTOS GOARCH=$GOHOSTARCH go build \
|
|
-o ../bin/go_android_${GOARCH}_exec \
|
|
../misc/android/go_android_exec.go
|
|
|
|
# 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=/tmp/androidtest-$$
|
|
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 "${GOROOT}/pkg/android_$GOARCH" "${FAKE_GOROOT}/pkg/"
|
|
echo '# Syncing test files to android device'
|
|
time adb sync data &> /dev/null
|
|
echo ''
|
|
rm -rf "$ANDROID_PRODUCT_OUT"
|
|
|
|
# Run standard build and tests.
|
|
./all.bash --no-clean
|