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
cd $WORKSPACE/tests
./run-tests
./run-tests ~jenkins/
#------------------------------------------------------------------------------#
@ -67,7 +67,7 @@ python setup.py install
# run tests in new pip+virtualenv install
. $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() {
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`))
echo "name $name"
apk=`aapt d badging "$f" | sed -n "s,^package: name='\(.*\)' versionCode='\([0-9][0-9]*\)' .*,\1_\2.apk,p"`
echo "apk $apk"
cp -f $f $1/repo/$apk
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
if [ ! -e repo/$apk ] && [ ! -e archive/$apk ]; then
echo "$f --> repo/$apk"
ln $f $1/repo/$apk || \
rsync -axv $f $1/repo/$apk # rsync if hard link is not possible
fi
done
}
@ -34,6 +37,16 @@ create_test_file() {
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
WORKSPACE=`dirname $(pwd)`
echo "Setting Workspace to $WORKSPACE"