mirror of
https://github.com/golang/go
synced 2024-11-24 09:00:13 -07:00
the android runner script
this is a version synthesized from rsc's, dean's and my versions. changes and updates: - embeds the retval script and pushes a new version to the device if needed - passes arguments correctly to the program on the device - export GOARCH, GOTRACEBACK and GOGC from the local environment to the device. - added times.out support to run-arm enabled a few tests that are now passing and moved the GOGC=off workaround to run-arm. R=dpx CC=golang-dev, rsc https://golang.org/cl/880046
This commit is contained in:
parent
a8c18e14ef
commit
0b2e0265ae
49
misc/arm/a
Executable file
49
misc/arm/a
Executable file
@ -0,0 +1,49 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Copyright 2010 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.
|
||||||
|
|
||||||
|
# This is a small script for executing go binaries on the android platform.
|
||||||
|
#
|
||||||
|
# example:
|
||||||
|
# ./a 5.out foo bar baz
|
||||||
|
#
|
||||||
|
# The script exports the local values of GOARCH, GOTRACEBACK and GOGC
|
||||||
|
# to the android environment.
|
||||||
|
#
|
||||||
|
# Known issues:
|
||||||
|
# The script fails unless the last character output by the program is "\n"
|
||||||
|
#
|
||||||
|
# TODO(kaib): add gdb bridge support
|
||||||
|
|
||||||
|
exp ()
|
||||||
|
{
|
||||||
|
if [ ${!1} ]; then
|
||||||
|
echo "export $1=\"${!1}\"; "
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# adb does not correctly return the exit value of the executed program. use this
|
||||||
|
# wrapper to manually extract the exit value
|
||||||
|
rloc=/data/local/tmp/retval
|
||||||
|
rsize=$(adb shell "ls -l $rloc"|tr -s ' '|cut -d' ' -f4)
|
||||||
|
rcheck=38
|
||||||
|
if [ $rsize != $rcheck ] ; then
|
||||||
|
# echo "debug: retval size incorrect want $rcheck, got $rsize. uploading"
|
||||||
|
echo >/tmp/adb.retval '#!/system/bin/sh
|
||||||
|
"$@"
|
||||||
|
echo RETVAL: $?'
|
||||||
|
adb push /tmp/adb.retval $rloc >/dev/null 2>&1
|
||||||
|
adb shell chmod 755 $rloc
|
||||||
|
fi
|
||||||
|
|
||||||
|
# run the main binary
|
||||||
|
if [ "$*" != "$1" ]; then
|
||||||
|
args=$(echo $*| cut -d' ' -f2-)
|
||||||
|
fi
|
||||||
|
adb push $1 /data/local/tmp/$1 >/dev/null 2>&1
|
||||||
|
adb shell "$(exp GOARCH) $(exp GOTRACEBACK) $(exp GOGC) \
|
||||||
|
/data/local/tmp/retval /data/local/tmp/$1 $args" \
|
||||||
|
2>&1|tr -d '\r' |tee /tmp/adb.out|grep -v RETVAL
|
||||||
|
exit $(grep RETVAL /tmp/adb.out|tr -d '\n\r'| cut -d' ' -f2)
|
@ -1,6 +1,6 @@
|
|||||||
./235.go # slow
|
./235.go
|
||||||
./64bit.go # slow
|
./64bit.go # slow with GOGC=on
|
||||||
# ./args.go # android runner doesn't pass args through
|
./args.go
|
||||||
./assign.go
|
./assign.go
|
||||||
./bigalg.go
|
./bigalg.go
|
||||||
./blank.go
|
./blank.go
|
||||||
@ -34,7 +34,7 @@
|
|||||||
./defer.go
|
./defer.go
|
||||||
# ./deferprint.go # need floating point
|
# ./deferprint.go # need floating point
|
||||||
./empty.go
|
./empty.go
|
||||||
# ./env.go # android runner doesn't pass env through
|
./env.go
|
||||||
./escape.go
|
./escape.go
|
||||||
# ./float_lit.go # need floating point
|
# ./float_lit.go # need floating point
|
||||||
# ./floatcmp.go # need floating point
|
# ./floatcmp.go # need floating point
|
||||||
|
13
test/run-arm
13
test/run-arm
@ -35,6 +35,14 @@ FAILEDFILE=/tmp/gotest3-$$-$USER
|
|||||||
# on thresher, 3GB suffices to run the tests; with 2GB, peano fails.
|
# on thresher, 3GB suffices to run the tests; with 2GB, peano fails.
|
||||||
ulimit -v 4000000
|
ulimit -v 4000000
|
||||||
|
|
||||||
|
# no core files please
|
||||||
|
ulimit -c 0
|
||||||
|
|
||||||
|
true >times.out
|
||||||
|
|
||||||
|
# TODO(kaib): figure out why the GC makes things so utterly slow.
|
||||||
|
export GOGC=off
|
||||||
|
export GOTRACEBACK=0
|
||||||
|
|
||||||
for i in $(cat arm-pass.txt | sed 's/#.*//')
|
for i in $(cat arm-pass.txt | sed 's/#.*//')
|
||||||
do
|
do
|
||||||
@ -42,7 +50,7 @@ do
|
|||||||
dir=$(dirname $i)
|
dir=$(dirname $i)
|
||||||
export D=$dir
|
export D=$dir
|
||||||
sed '/^\/\//!q' $i | sed 's@//@@; $d' |sed 's|./\$A.out|$E &|' >$RUNFILE
|
sed '/^\/\//!q' $i | sed 's@//@@; $d' |sed 's|./\$A.out|$E &|' >$RUNFILE
|
||||||
if ! sh $RUNFILE >$TMP1FILE 2>&1
|
if ! { time -p bash -c "bash $RUNFILE >$TMP1FILE 2>&1" ; } 2>$TMP2FILE
|
||||||
then
|
then
|
||||||
echo
|
echo
|
||||||
echo "===========" $i
|
echo "===========" $i
|
||||||
@ -58,6 +66,7 @@ do
|
|||||||
then
|
then
|
||||||
echo $i succeeded with no output.
|
echo $i succeeded with no output.
|
||||||
fi
|
fi
|
||||||
|
echo $(awk 'NR==1{print $2}' $TMP2FILE) $D/$F >>times.out
|
||||||
done | # clean up some stack noise
|
done | # clean up some stack noise
|
||||||
egrep -v '^(r[0-9a-z]+|[cfg]s) +0x' |
|
egrep -v '^(r[0-9a-z]+|[cfg]s) +0x' |
|
||||||
sed '/tmp.*Bus error/s/.*Bus/Bus/; /tmp.*Trace.BPT/s/.*Trace/Trace/
|
sed '/tmp.*Bus error/s/.*Bus/Bus/; /tmp.*Trace.BPT/s/.*Trace/Trace/
|
||||||
@ -75,7 +84,7 @@ done | # clean up some stack noise
|
|||||||
failed=0
|
failed=0
|
||||||
rm -f $RUNFILE $TMP1FILE $TMP2FILE *.$A $A.out
|
rm -f $RUNFILE $TMP1FILE $TMP2FILE *.$A $A.out
|
||||||
diffmsg=""
|
diffmsg=""
|
||||||
if ! diff run.out golden-arm.out
|
if ! diff -b run.out golden-arm.out
|
||||||
then
|
then
|
||||||
diffmsg="; test output differs"
|
diffmsg="; test output differs"
|
||||||
failed=1
|
failed=1
|
||||||
|
Loading…
Reference in New Issue
Block a user