summaryrefslogtreecommitdiff
path: root/hints/linux-android.sh
diff options
context:
space:
mode:
authorJess Robinson <castaway@desert-island.me.uk>2013-04-19 12:00:14 +0100
committerBrian Fraser <fraserbn@gmail.com>2014-01-26 14:44:19 -0300
commit77e493b5e4bd0e0f2e89cbe532341410e592b9a8 (patch)
treeb211fba35d0880944c5ee5354c9e89d0f4494d38 /hints/linux-android.sh
parentbbbf0767314ad86932380126374b4aba250945ce (diff)
downloadperl-77e493b5e4bd0e0f2e89cbe532341410e592b9a8.tar.gz
Android hints, run-adb-shell: Handle the -env switch
Currently, this is used during 'make test' to specify LD_LIBRARY_PATH
Diffstat (limited to 'hints/linux-android.sh')
-rw-r--r--hints/linux-android.sh22
1 files changed, 15 insertions, 7 deletions
diff --git a/hints/linux-android.sh b/hints/linux-android.sh
index cc7895cb83..e6b775a950 100644
--- a/hints/linux-android.sh
+++ b/hints/linux-android.sh
@@ -30,6 +30,7 @@ from=$from-$targetfrom
cat >$run <<EOF
#!/bin/sh
doexit="echo \\\$?"
+env=''
case "\$1" in
-cwd)
shift
@@ -37,28 +38,35 @@ case "\$1" in
shift
;;
esac
+case "\$1" in
+-env)
+ shift
+ env=\$1
+ shift
+ ;;
+esac
case "\$cwd" in
'') cwd=$targetdir ;;
esac
+case "\$env" in
+'') env="echo "
+esac
exe=\$1
shift
+args=\$@
$to \$exe > /dev/null 2>&1
# send copy results to /dev/null as otherwise it outputs speed stats which gets in our way.
-foo=\`adb -s $targethost shell "sh -c '(cd \$cwd && \$exe \$@ > \$exe.stdout) ; \$doexit '"\`
+# sometimes there is no $?, I dunno why? we then get Cross/run-adb-shell: line 39: exit: XX: numeric argument required
+foo=\`adb -s $targethost shell "sh -c '(cd \$cwd && \$env ; \$exe \$args > \$exe.stdout) ; \$doexit '"\`
# We get back Ok\r\n on android for some reason, grrr:
$from \$exe.stdout
result=\`cat \$exe.stdout\`
rm \$exe.stdout
foo=\`echo \$foo | sed -e 's|\r||g'\`
# Also, adb doesn't exit with the commands exit code, like ssh does, double-grr
-echo \$result
+echo "\$result"
exit \$foo
-# if test "X\$doexit" != X; then
-# exit \$foo
-#else
-# echo \$foo
-#fi
EOF
chmod a+rx $run