From 49b343d0245fbf37d1e1cfa9a62c75d4635015fc Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Mon, 17 Nov 2014 17:24:02 +0100 Subject: [PATCH 1/2] run-tests: make sure not to include the bad APKs in tests/ These APKs are meant for specific tests, not the tests that want just a collection of good APKs. --- tests/run-tests | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/run-tests b/tests/run-tests index c12c78a7..ba0d80e6 100755 --- a/tests/run-tests +++ b/tests/run-tests @@ -10,7 +10,7 @@ echo_header() { copy_apks_into_repo() { set +x - for f in `find $APKDIR -name '*.apk' | grep -F -v -e unaligned -e unsigned`; do + for f in `find $APKDIR -name '*.apk' | grep -F -v -e unaligned -e unsigned -e badsig -e badcert`; do name=$(basename $(dirname `dirname $f`)) apk=`$aapt dump badging "$f" | sed -n "s,^package: name='\(.*\)' versionCode='\([0-9][0-9]*\)' .*,\1_\2.apk,p"` test $f -nt repo/$apk && rm -f repo/$apk # delete existing if $f is newer From 14cd8359290df8866ff35c4930b5fa610e71a099 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Mon, 17 Nov 2014 17:40:48 +0100 Subject: [PATCH 2/2] run-tests: properly handle zero and multiple args The test for the help flag threw an error if there were 0 args, or if arg 1 was set to a space-separated list. The -z tests would fail if the arg was set to a space-separated list. --- tests/run-tests | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/run-tests b/tests/run-tests index ba0d80e6..ae566b74 100755 --- a/tests/run-tests +++ b/tests/run-tests @@ -46,19 +46,19 @@ create_test_file() { #------------------------------------------------------------------------------# # "main" -if [ $1 = "-h" ] || [ $1 = "--help" ]; then +if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then set +x echo "Usage: $0 '/path/to/folder/with/apks'" exit 1 fi -if [ -z $ANDROID_HOME ]; then +if [ -z "$ANDROID_HOME" ]; then echo "ANDROID_HOME must be set with the path to the Android SDK, i.e.: " echo " export ANDROID_HOME=/opt/android-sdk" exit 1 fi -if [ -z $1 ]; then +if [ -z "$1" ]; then APKDIR=`pwd` else APKDIR=$1