Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: third_party/go/src/golang.org/x/mobile/build/androidtest.bash

Issue 1275153002: Remove third_party/golang.org/x/mobile as it is no longer used with Go 1.5. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Remove golang.org/x/mobile Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 #!/usr/bin/env bash
2
3 # Copyright 2014 The Go Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style
5 # license that can be found in the LICENSE file.
6
7 # For testing Android. Run from a repository root.
8 # build/androidtest.bash
9 # The compiler runs locally, pushes the copy of the repository
10 # to a target device using adb, and runs tests in the device
11 # using adb shell commands.
12
13 set -e
14 ulimit -c 0 # no core files
15
16 function die() {
17 echo "FAIL: $1"
18 exit 1
19 }
20
21 if [ -z "${GOPATH}" ]; then
22 die 'GOPATH must be set.'
23 fi
24
25 readonly CURDIR=`pwd`
26 if [ ! -f AUTHORS ]; then
27 die 'androidtest.bash must be run from the repository root.'
28 fi
29
30 function pkg() {
31 local paths=(${GOPATH//:/ })
32 for e in "${paths[@]}"; do
33 e="${e%/}"
34 local relpath="${CURDIR#"${e}/src/"}"
35 if [ "${relpath}" != "${CURDIR}" ]; then
36 echo "${relpath}"
37 break
38 fi
39 done
40 }
41
42 export PKG="$(pkg)"
43 if [ -z "${PKG}" ]; then
44 die 'androidtest.bash failed to determine the repository package name.'
45 fi
46
47 export DEVICEDIR=/data/local/tmp/androidtest-$$
48 export TMPDIR=`mktemp -d /tmp/androidtest.XXXXX`
49
50 function cleanup() {
51 echo '# Cleaning up...'
52 rm -rf "$TMPDIR"
53 adb shell rm -rf "${DEVICEDIR}"
54 }
55 trap cleanup EXIT
56
57 # 'adb sync' syncs data in ANDROID_PRODUCT_OUT directory.
58 # We copy the entire golang.org/x/mobile/... (with -p option to preserve
59 # file properties) to the directory assuming tests may depend only
60 # on data in the same subrepository.
61 echo '# Syncing test files to android device'
62 export ANDROID_PRODUCT_OUT="${TMPDIR}/androidtest-$$"
63 readonly LOCALDIR="${ANDROID_PRODUCT_OUT}/${DEVICEDIR}"
64
65 mkdir -p "${LOCALDIR}/${PKG}"
66 echo "cp -R --preserve=all ./* ${LOCALDIR}/${PKG}/"
67 cp -R --preserve=all ./* "${LOCALDIR}/${PKG}/"
68
69 time adb sync data &> /dev/null
70 echo ''
71
72 echo '# Run tests on android (arm7)'
73 # Build go_android_${GOARCH}_exec that will be invoked for
74 # GOOS=android GOARCH=$GOARCH go test/run.
75 mkdir -p "${TMPDIR}/bin"
76 export PATH=${TMPDIR}/bin:${PATH}
77 GOOS="${GOHOSTOS}" GOARCH="${GOHOSTARCH}" go build \
78 -o "${TMPDIR}/bin/go_android_arm_exec" \
79 "${GOPATH}/src/golang.org/x/mobile/build/go_android_exec.go"
80 CGO_ENABLED=1 GOOS=android GOARCH=arm GOARM=7 \
81 go test ./...
82
83 # Special tests for mobile subrepository.
84 if [ "$PKG" = "golang.org/x/mobile" ]; then
85 echo '# Run mobile=repository specific android tests.'
86
87 cd "${CURDIR}/bind/java"; ./test.bash
88 fi
89
90 exit 0
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698