tests: specify dir for APKs as cmd line arg, and set jenkins to ~

This lets people easily set whatever dir they want, while letting jenkins
search through its whole workspace for any APKs that have been built. Also,
only include the latest version of a given packageName+versionCode.
This commit is contained in:
Hans-Christoph Steiner 2014-06-02 13:21:54 -04:00
parent 78d5ebf26c
commit 9b313e76bb
2 changed files with 20 additions and 7 deletions

View file

@ -47,7 +47,7 @@ cd $WORKSPACE/fdroidserver/getsig
#------------------------------------------------------------------------------# #------------------------------------------------------------------------------#
# run local tests # run local tests
cd $WORKSPACE/tests cd $WORKSPACE/tests
./run-tests ./run-tests ~jenkins/
#------------------------------------------------------------------------------# #------------------------------------------------------------------------------#
@ -67,7 +67,7 @@ python setup.py install
# run tests in new pip+virtualenv install # run tests in new pip+virtualenv install
. $WORKSPACE/env/bin/activate . $WORKSPACE/env/bin/activate
fdroid=$WORKSPACE/env/bin/fdroid $WORKSPACE/tests/run-tests fdroid=$WORKSPACE/env/bin/fdroid $WORKSPACE/tests/run-tests ~jenkins/
#------------------------------------------------------------------------------# #------------------------------------------------------------------------------#

View file

@ -9,12 +9,15 @@ echo_header() {
} }
copy_apks_into_repo() { copy_apks_into_repo() {
for f in `ls -1 ../../*/bin/*.apk`; do for f in `find $APKDIR -name '*.apk' | grep -F -v -e unaligned -e unsigned`; do
name=$(basename $(dirname `dirname $f`)) name=$(basename $(dirname `dirname $f`))
echo "name $name" apk=`aapt dump badging "$f" | sed -n "s,^package: name='\(.*\)' versionCode='\([0-9][0-9]*\)' .*,\1_\2.apk,p"`
apk=`aapt d 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
echo "apk $apk" if [ ! -e repo/$apk ] && [ ! -e archive/$apk ]; then
cp -f $f $1/repo/$apk echo "$f --> repo/$apk"
ln $f $1/repo/$apk || \
rsync -axv $f $1/repo/$apk # rsync if hard link is not possible
fi
done done
} }
@ -34,6 +37,16 @@ create_test_file() {
mktemp --tmpdir=$WORKSPACE/.testfiles mktemp --tmpdir=$WORKSPACE/.testfiles
} }
#------------------------------------------------------------------------------#
# "main"
if [ $# -ne 1 ]; then
echo "Usage: $0 '/path/to/folder/with/apks'"
exit 1
fi
APKDIR=$1
if [ -z $WORKSPACE ]; then if [ -z $WORKSPACE ]; then
WORKSPACE=`dirname $(pwd)` WORKSPACE=`dirname $(pwd)`
echo "Setting Workspace to $WORKSPACE" echo "Setting Workspace to $WORKSPACE"