2014-04-10 18:31:14 +02:00
|
|
|
#!/bin/bash
|
2014-04-01 22:16:24 +02:00
|
|
|
|
2014-06-05 22:55:52 +02:00
|
|
|
set -e # quit script on error
|
2014-04-01 22:16:24 +02:00
|
|
|
|
2014-05-30 03:43:16 +02:00
|
|
|
echo_header() {
|
2015-11-01 13:51:25 +01:00
|
|
|
{ echo -e "==============================================================================\n$1"; } 2>/dev/null
|
2014-05-30 03:43:16 +02:00
|
|
|
}
|
|
|
|
|
2014-04-04 04:17:52 +02:00
|
|
|
copy_apks_into_repo() {
|
2014-06-05 22:55:52 +02:00
|
|
|
set +x
|
2014-11-17 17:24:02 +01:00
|
|
|
for f in `find $APKDIR -name '*.apk' | grep -F -v -e unaligned -e unsigned -e badsig -e badcert`; do
|
2014-04-04 04:17:52 +02:00
|
|
|
name=$(basename $(dirname `dirname $f`))
|
2014-06-17 01:18:28 +02:00
|
|
|
apk=`$aapt dump badging "$f" | sed -n "s,^package: name='\(.*\)' versionCode='\([0-9][0-9]*\)' .*,\1_\2.apk,p"`
|
2014-06-02 19:21:54 +02:00
|
|
|
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
|
2014-04-04 04:17:52 +02:00
|
|
|
done
|
2014-06-05 22:55:52 +02:00
|
|
|
set -x
|
2014-04-04 04:17:52 +02:00
|
|
|
}
|
|
|
|
|
2014-06-30 17:28:38 +02:00
|
|
|
# keep this as an old version to test the automatic parsing of build-tools
|
|
|
|
# verion numbers in `fdroid init`
|
2014-04-24 01:21:22 +02:00
|
|
|
create_fake_android_home() {
|
2014-07-03 22:33:40 +02:00
|
|
|
mkdir $1/tools
|
|
|
|
mkdir $1/platform-tools
|
2014-04-24 01:21:22 +02:00
|
|
|
mkdir $1/build-tools
|
2014-06-30 17:28:38 +02:00
|
|
|
mkdir $1/build-tools/19.0.2
|
|
|
|
touch $1/build-tools/19.0.2/aapt
|
2014-04-24 01:21:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
create_test_dir() {
|
|
|
|
test -e $WORKSPACE/.testfiles || mkdir $WORKSPACE/.testfiles
|
2016-02-15 15:29:11 +01:00
|
|
|
mktemp -d $WORKSPACE/.testfiles/run-tests.XXXX
|
2014-04-24 01:21:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
create_test_file() {
|
|
|
|
test -e $WORKSPACE/.testfiles || mkdir $WORKSPACE/.testfiles
|
2015-07-27 20:34:01 +02:00
|
|
|
TMPDIR=$WORKSPACE/.testfiles mktemp
|
2014-04-24 01:21:22 +02:00
|
|
|
}
|
|
|
|
|
2014-06-02 19:21:54 +02:00
|
|
|
#------------------------------------------------------------------------------#
|
|
|
|
# "main"
|
|
|
|
|
2014-11-17 17:40:48 +01:00
|
|
|
if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
|
2014-06-27 23:06:18 +02:00
|
|
|
set +x
|
2014-06-02 19:21:54 +02:00
|
|
|
echo "Usage: $0 '/path/to/folder/with/apks'"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2014-11-17 17:40:48 +01:00
|
|
|
if [ -z "$ANDROID_HOME" ]; then
|
2014-06-17 01:18:28 +02:00
|
|
|
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
|
|
|
|
|
2015-11-01 13:48:25 +01:00
|
|
|
if [ -d tests ]; then
|
|
|
|
cd tests
|
|
|
|
fi
|
|
|
|
|
2014-11-17 17:40:48 +01:00
|
|
|
if [ -z "$1" ]; then
|
2014-06-27 23:06:18 +02:00
|
|
|
APKDIR=`pwd`
|
|
|
|
else
|
|
|
|
APKDIR=$1
|
|
|
|
fi
|
2014-06-02 19:21:54 +02:00
|
|
|
|
2014-04-01 22:16:24 +02:00
|
|
|
if [ -z $WORKSPACE ]; then
|
|
|
|
WORKSPACE=`dirname $(pwd)`
|
|
|
|
echo "Setting Workspace to $WORKSPACE"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# allow the location of the script to be overridden
|
|
|
|
if [ -z $fdroid ]; then
|
|
|
|
fdroid="$WORKSPACE/fdroid"
|
|
|
|
fi
|
|
|
|
|
2014-06-17 01:18:28 +02:00
|
|
|
# allow the location of aapt to be overridden
|
|
|
|
if [ -z $aapt ]; then
|
|
|
|
aapt=`ls -1 $ANDROID_HOME/build-tools/*/aapt | sort | tail -1`
|
|
|
|
fi
|
|
|
|
|
2014-06-30 17:31:38 +02:00
|
|
|
# allow the location of python to be overridden
|
|
|
|
if [ -z $python ]; then
|
2016-01-04 21:17:58 +01:00
|
|
|
python=python3
|
2014-06-30 17:31:38 +02:00
|
|
|
fi
|
|
|
|
|
2015-11-01 13:52:16 +01:00
|
|
|
set -x # show each command as it is executed
|
2014-06-27 23:06:52 +02:00
|
|
|
|
2014-07-01 03:40:31 +02:00
|
|
|
#------------------------------------------------------------------------------#
|
|
|
|
echo_header "run commit hooks"
|
|
|
|
|
|
|
|
cd $WORKSPACE
|
|
|
|
./hooks/pre-commit
|
|
|
|
|
|
|
|
|
2014-08-30 17:07:29 +02:00
|
|
|
#------------------------------------------------------------------------------#
|
|
|
|
echo_header "test python getsig replacement"
|
|
|
|
|
|
|
|
cd $WORKSPACE/tests/getsig
|
|
|
|
./make.sh
|
2016-11-07 21:47:53 +01:00
|
|
|
|
|
|
|
cd $WORKSPACE/tests
|
2014-12-09 15:15:36 +01:00
|
|
|
for testcase in $WORKSPACE/tests/*.TestCase; do
|
|
|
|
$testcase
|
|
|
|
done
|
2014-08-30 17:07:29 +02:00
|
|
|
|
|
|
|
|
2015-09-01 11:23:23 +02:00
|
|
|
#------------------------------------------------------------------------------#
|
|
|
|
echo_header "print fdroid version"
|
|
|
|
|
|
|
|
$fdroid --version
|
|
|
|
|
|
|
|
|
2017-03-16 18:51:43 +01:00
|
|
|
#------------------------------------------------------------------------------#
|
|
|
|
echo_header 'run process when building and signing are on separate machines'
|
|
|
|
|
|
|
|
REPOROOT=`create_test_dir`
|
|
|
|
cd $REPOROOT
|
|
|
|
cp $WORKSPACE/tests/keystore.jks $REPOROOT/
|
|
|
|
$fdroid init --keystore keystore.jks --repo-keyalias=sova
|
|
|
|
echo 'keystorepass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI="' >> config.py
|
|
|
|
echo 'keypass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI="' >> config.py
|
|
|
|
echo "accepted_formats = ['txt', 'yml']" >> config.py
|
|
|
|
echo 'keydname = "CN=Birdman, OU=Cell, O=Alcatraz, L=Alcatraz, S=California, C=US"' >> config.py
|
|
|
|
test -d archive || mkdir archive
|
|
|
|
test -d metadata || mkdir metadata
|
|
|
|
cp $WORKSPACE/tests/metadata/info.guardianproject.urzip.yml metadata/
|
|
|
|
test -d repo || mkdir repo
|
|
|
|
test -d unsigned || mkdir unsigned
|
|
|
|
cp $WORKSPACE/tests/urzip-release-unsigned.apk unsigned/info.guardianproject.urzip_100.apk
|
|
|
|
$fdroid publish --verbose
|
|
|
|
$fdroid update --verbose --nosign
|
|
|
|
$fdroid signindex --verbose
|
|
|
|
test -e repo/index.xml
|
|
|
|
test -e repo/index.jar
|
|
|
|
test -e repo/index-v1.jar
|
|
|
|
test -L urzip.apk
|
|
|
|
grep -F '<application id=' repo/index.xml > /dev/null
|
|
|
|
|
|
|
|
|
2016-02-16 23:36:27 +01:00
|
|
|
#------------------------------------------------------------------------------#
|
|
|
|
echo_header "test UTF-8 metadata"
|
|
|
|
|
|
|
|
REPOROOT=`create_test_dir`
|
|
|
|
cd $REPOROOT
|
|
|
|
|
|
|
|
$fdroid init
|
|
|
|
sed -i.tmp 's,^ *repo_description.*,repo_description = """获取已安装在您的设备上的应用的,' config.py
|
2017-02-24 10:28:00 +01:00
|
|
|
echo "mirrors = ('https://foo.bar/fdroid', 'http://secret.onion/fdroid')" >> config.py
|
2016-02-16 23:36:27 +01:00
|
|
|
mkdir metadata
|
|
|
|
cp $WORKSPACE/tests/urzip.apk repo/
|
2016-12-06 16:11:25 +01:00
|
|
|
cp $WORKSPACE/tests/metadata/info.guardianproject.urzip.yml metadata/
|
2016-02-16 23:36:27 +01:00
|
|
|
|
|
|
|
$fdroid readmeta
|
|
|
|
$fdroid update
|
|
|
|
|
|
|
|
|
2016-11-07 21:47:53 +01:00
|
|
|
#------------------------------------------------------------------------------#
|
|
|
|
echo_header 'run `fdroid build` in fresh git checkout from import.TestCase'
|
|
|
|
|
|
|
|
cd $WORKSPACE/tests/tmp/importer
|
2017-02-23 22:32:08 +01:00
|
|
|
git remote update -p
|
|
|
|
git clean -fdx
|
|
|
|
# stick with known working commit, in case future commits break things for this code
|
|
|
|
git reset --hard cecf00c08aec56ae7a5eba444150c4d1ae868814
|
2016-11-07 21:47:53 +01:00
|
|
|
if [ -d $ANDROID_HOME/platforms/android-23 ]; then
|
|
|
|
echo "build_tools = '`ls -1 $ANDROID_HOME/build-tools/ | sort -n | tail -1`'" > config.py
|
|
|
|
echo "force_build_tools = True" >> config.py
|
|
|
|
$fdroid build --verbose org.fdroid.ci.test.app:300
|
|
|
|
else
|
|
|
|
echo 'WARNING: Skipping `fdroid build` test since android-23 is missing!'
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
2016-06-23 17:11:49 +02:00
|
|
|
#------------------------------------------------------------------------------#
|
2016-11-03 10:26:38 +01:00
|
|
|
echo_header "copy tests/repo, generate java/gpg keys, update, and gpgsign"
|
2016-06-23 17:11:49 +02:00
|
|
|
|
|
|
|
REPOROOT=`create_test_dir`
|
2016-11-03 10:26:38 +01:00
|
|
|
GNUPGHOME=$REPOROOT/gnupghome
|
2017-02-23 21:23:45 +01:00
|
|
|
KEYSTORE=$WORKSPACE/tests/keystore.jks
|
2016-06-23 17:11:49 +02:00
|
|
|
cd $REPOROOT
|
2017-02-23 21:23:45 +01:00
|
|
|
$fdroid init --keystore $KEYSTORE --repo-keyalias=sova
|
|
|
|
echo 'keystorepass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI="' >> config.py
|
|
|
|
echo 'keypass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI="' >> config.py
|
|
|
|
cp -a $WORKSPACE/tests/metadata $WORKSPACE/tests/repo $WORKSPACE/tests/stats $REPOROOT/
|
2016-11-03 10:26:38 +01:00
|
|
|
cp -a $WORKSPACE/tests/gnupghome $GNUPGHOME
|
|
|
|
chmod 0700 $GNUPGHOME
|
2016-11-23 15:01:23 +01:00
|
|
|
echo "accepted_formats = ['json', 'txt', 'yml']" >> config.py
|
2016-08-16 21:02:15 +02:00
|
|
|
echo "install_list = 'org.adaway'" >> config.py
|
2017-02-23 21:23:45 +01:00
|
|
|
echo "uninstall_list = ('com.android.vending', 'com.facebook.orca',)" >> config.py
|
2016-11-03 10:26:38 +01:00
|
|
|
echo "gpghome = '$GNUPGHOME'" >> config.py
|
|
|
|
echo "gpgkey = 'CE71F7FB'" >> config.py
|
2017-02-23 21:23:45 +01:00
|
|
|
echo "mirrors = ('http://foobarfoobarfoobar.onion/fdroid','https://foo.bar/fdroid',)" >> config.py
|
|
|
|
$fdroid update --verbose --pretty
|
2016-06-23 17:11:49 +02:00
|
|
|
test -e repo/index.xml
|
|
|
|
test -e repo/index.jar
|
2016-11-28 21:09:07 +01:00
|
|
|
test -e repo/index-v1.jar
|
2016-06-23 17:11:49 +02:00
|
|
|
grep -F '<application id=' repo/index.xml > /dev/null
|
2016-08-16 21:02:15 +02:00
|
|
|
grep -F '<install packageName=' repo/index.xml > /dev/null
|
2016-08-23 20:30:27 +02:00
|
|
|
grep -F '<uninstall packageName=' repo/index.xml > /dev/null
|
2016-11-03 10:26:38 +01:00
|
|
|
$fdroid gpgsign --verbose
|
|
|
|
$fdroid gpgsign --verbose
|
|
|
|
test -e repo/obb.mainpatch.current_1619.apk.asc
|
|
|
|
test -e repo/obb.main.twoversions_1101617_src.tar.gz.asc
|
|
|
|
! test -e repo/obb.mainpatch.current_1619.apk.asc.asc
|
|
|
|
! test -e repo/obb.main.twoversions_1101617_src.tar.gz.asc.asc
|
|
|
|
! test -e repo/index.xml.asc
|
2016-06-23 17:11:49 +02:00
|
|
|
|
2017-02-23 21:23:45 +01:00
|
|
|
# we can't easily reproduce the timestamps for things, so just hardcode them
|
|
|
|
sed -i --expression='s,timestamp="[0-9]*",timestamp="1480431575",' repo/index.xml
|
|
|
|
diff $WORKSPACE/tests/repo/index.xml repo/index.xml
|
2016-06-23 17:11:49 +02:00
|
|
|
|
2015-08-05 12:53:17 +02:00
|
|
|
#------------------------------------------------------------------------------#
|
|
|
|
echo_header "test metadata checks"
|
|
|
|
|
|
|
|
REPOROOT=`create_test_dir`
|
|
|
|
cd $REPOROOT
|
|
|
|
|
|
|
|
touch config.py
|
|
|
|
mkdir repo
|
|
|
|
cp $WORKSPACE/tests/urzip.apk $REPOROOT/repo/
|
|
|
|
|
|
|
|
set +e
|
|
|
|
$fdroid build
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
echo "This should have failed because there is no metadata!"
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
echo "testing metadata checks passed"
|
|
|
|
fi
|
|
|
|
set -e
|
|
|
|
|
|
|
|
mkdir $REPOROOT/metadata/
|
|
|
|
cp $WORKSPACE/tests/metadata/org.smssecure.smssecure.txt $REPOROOT/metadata/
|
|
|
|
$fdroid readmeta
|
|
|
|
|
|
|
|
# now make a fake duplicate
|
2016-03-21 21:51:23 +01:00
|
|
|
touch $REPOROOT/metadata/org.smssecure.smssecure.yml
|
2015-08-05 12:53:17 +02:00
|
|
|
|
|
|
|
set +e
|
|
|
|
$fdroid readmeta
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
echo "This should have failed because there is a duplicate metadata file!"
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
echo "testing duplicate metadata checks passed"
|
|
|
|
fi
|
|
|
|
set -e
|
|
|
|
|
|
|
|
|
2016-02-11 23:49:54 +01:00
|
|
|
#------------------------------------------------------------------------------#
|
|
|
|
echo_header "ensure commands that don't need the JDK work without a JDK configed"
|
|
|
|
|
|
|
|
REPOROOT=`create_test_dir`
|
|
|
|
cd $REPOROOT
|
|
|
|
mkdir repo
|
|
|
|
mkdir metadata
|
|
|
|
echo "License:GPL" >> metadata/fake.txt
|
|
|
|
echo "Summary:Yup still fake" >> metadata/fake.txt
|
|
|
|
echo "Categories:Internet" >> metadata/fake.txt
|
|
|
|
echo "Description:" >> metadata/fake.txt
|
|
|
|
echo "this is fake" >> metadata/fake.txt
|
|
|
|
echo "." >> metadata/fake.txt
|
|
|
|
|
|
|
|
# fake that no JDKs are available
|
|
|
|
echo 'java_paths = {}' > config.py
|
|
|
|
|
|
|
|
LOCAL_COPY_DIR=`create_test_dir`/fdroid
|
|
|
|
mkdir -p $LOCAL_COPY_DIR/repo
|
|
|
|
echo "local_copy_dir = '$LOCAL_COPY_DIR'" >> config.py
|
|
|
|
|
|
|
|
$fdroid checkupdates
|
|
|
|
$fdroid gpgsign
|
|
|
|
$fdroid lint
|
|
|
|
$fdroid readmeta
|
|
|
|
$fdroid rewritemeta fake
|
|
|
|
$fdroid server update
|
|
|
|
$fdroid scanner
|
|
|
|
|
|
|
|
# run these to get their output, but the are not setup, so don't fail
|
|
|
|
$fdroid build || true
|
|
|
|
$fdroid import || true
|
|
|
|
$fdroid install || true
|
|
|
|
|
|
|
|
|
2014-06-27 23:06:52 +02:00
|
|
|
#------------------------------------------------------------------------------#
|
|
|
|
echo_header "create a source tarball and use that to build a repo"
|
|
|
|
|
|
|
|
cd $WORKSPACE
|
2014-06-30 17:31:38 +02:00
|
|
|
$python setup.py sdist
|
2014-06-27 23:06:52 +02:00
|
|
|
|
|
|
|
REPOROOT=`create_test_dir`
|
|
|
|
cd $REPOROOT
|
|
|
|
tar xzf `ls -1 $WORKSPACE/dist/fdroidserver-*.tar.gz | sort -n | tail -1`
|
|
|
|
cd $REPOROOT
|
|
|
|
./fdroidserver-*/fdroid init
|
|
|
|
copy_apks_into_repo $REPOROOT
|
run-tests: verbose output for `fdroid update` to aid debugging
I'm stumped by this stacktrace, hopefully debug logging will help:
Unknown exception found!
Traceback (most recent call last):
File "./fdroidserver-0.4.0/fdroid", line 141, in <module>
main()
File "./fdroidserver-0.4.0/fdroid", line 119, in main
mod.main()
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 1146, in main
apks, cachechanged = scan_apks(apps, apkcache, repodirs[0], knownapks)
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 543, in scan_apks
thisinfo['sig'] = getsig(os.path.join(os.getcwd(), apkfile))
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 361, in getsig
with zipfile.ZipFile(apkpath, 'r') as apk:
File "/usr/lib/python2.7/zipfile.py", line 770, in __init__
self._RealGetContents()
File "/usr/lib/python2.7/zipfile.py", line 857, in _RealGetContents
x._decodeExtra()
File "/usr/lib/python2.7/zipfile.py", line 388, in _decodeExtra
tp, ln = unpack('<HH', extra[:4])
struct.error: unpack requires a string argument of length 4
2015-09-16 17:19:12 +02:00
|
|
|
./fdroidserver-*/fdroid update --create-metadata --verbose
|
2014-06-27 23:06:52 +02:00
|
|
|
|
|
|
|
|
2014-06-26 17:57:40 +02:00
|
|
|
#------------------------------------------------------------------------------#
|
|
|
|
echo_header "test config checks of local_copy_dir"
|
|
|
|
|
|
|
|
REPOROOT=`create_test_dir`
|
|
|
|
cd $REPOROOT
|
|
|
|
$fdroid init
|
run-tests: verbose output for `fdroid update` to aid debugging
I'm stumped by this stacktrace, hopefully debug logging will help:
Unknown exception found!
Traceback (most recent call last):
File "./fdroidserver-0.4.0/fdroid", line 141, in <module>
main()
File "./fdroidserver-0.4.0/fdroid", line 119, in main
mod.main()
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 1146, in main
apks, cachechanged = scan_apks(apps, apkcache, repodirs[0], knownapks)
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 543, in scan_apks
thisinfo['sig'] = getsig(os.path.join(os.getcwd(), apkfile))
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 361, in getsig
with zipfile.ZipFile(apkpath, 'r') as apk:
File "/usr/lib/python2.7/zipfile.py", line 770, in __init__
self._RealGetContents()
File "/usr/lib/python2.7/zipfile.py", line 857, in _RealGetContents
x._decodeExtra()
File "/usr/lib/python2.7/zipfile.py", line 388, in _decodeExtra
tp, ln = unpack('<HH', extra[:4])
struct.error: unpack requires a string argument of length 4
2015-09-16 17:19:12 +02:00
|
|
|
$fdroid update --create-metadata --verbose
|
2015-07-25 00:39:00 +02:00
|
|
|
$fdroid readmeta
|
2014-06-26 17:57:40 +02:00
|
|
|
$fdroid server update --local-copy-dir=/tmp/fdroid
|
|
|
|
|
|
|
|
# now test the errors work
|
|
|
|
set +e
|
|
|
|
$fdroid server update --local-copy-dir=thisisnotanabsolutepath
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
echo "This should have failed because thisisnotanabsolutepath is not an absolute path!"
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
echo "testing absolute path checker passed"
|
|
|
|
fi
|
|
|
|
$fdroid server update --local-copy-dir=/tmp/IReallyDoubtThisPathExistsasdfasdf
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
echo "This should have failed because the path does not end with 'fdroid'!"
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
echo "testing dirname exists checker passed"
|
|
|
|
fi
|
|
|
|
$fdroid server update --local-copy-dir=/tmp/IReallyDoubtThisPathExistsasdfasdf/fdroid
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
echo "This should have failed because the dirname path does not exist!"
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
echo "testing dirname exists checker passed"
|
|
|
|
fi
|
|
|
|
set -e
|
|
|
|
|
|
|
|
|
2014-04-01 22:16:24 +02:00
|
|
|
#------------------------------------------------------------------------------#
|
2014-06-26 20:18:29 +02:00
|
|
|
echo_header "setup a new repo from scratch using ANDROID_HOME and do a local sync"
|
2014-04-01 22:16:24 +02:00
|
|
|
|
2014-04-24 01:21:22 +02:00
|
|
|
REPOROOT=`create_test_dir`
|
2014-04-01 22:16:24 +02:00
|
|
|
cd $REPOROOT
|
|
|
|
$fdroid init
|
2014-04-04 04:17:52 +02:00
|
|
|
copy_apks_into_repo $REPOROOT
|
run-tests: verbose output for `fdroid update` to aid debugging
I'm stumped by this stacktrace, hopefully debug logging will help:
Unknown exception found!
Traceback (most recent call last):
File "./fdroidserver-0.4.0/fdroid", line 141, in <module>
main()
File "./fdroidserver-0.4.0/fdroid", line 119, in main
mod.main()
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 1146, in main
apks, cachechanged = scan_apks(apps, apkcache, repodirs[0], knownapks)
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 543, in scan_apks
thisinfo['sig'] = getsig(os.path.join(os.getcwd(), apkfile))
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 361, in getsig
with zipfile.ZipFile(apkpath, 'r') as apk:
File "/usr/lib/python2.7/zipfile.py", line 770, in __init__
self._RealGetContents()
File "/usr/lib/python2.7/zipfile.py", line 857, in _RealGetContents
x._decodeExtra()
File "/usr/lib/python2.7/zipfile.py", line 388, in _decodeExtra
tp, ln = unpack('<HH', extra[:4])
struct.error: unpack requires a string argument of length 4
2015-09-16 17:19:12 +02:00
|
|
|
$fdroid update --create-metadata --verbose
|
2015-07-25 00:39:00 +02:00
|
|
|
$fdroid readmeta
|
2015-04-21 03:52:41 +02:00
|
|
|
grep -F '<application id=' repo/index.xml > /dev/null
|
2014-04-01 22:16:24 +02:00
|
|
|
|
2014-06-26 20:18:29 +02:00
|
|
|
LOCALCOPYDIR=`create_test_dir`/fdroid
|
|
|
|
$fdroid server update --local-copy-dir=$LOCALCOPYDIR
|
|
|
|
NEWREPOROOT=`create_test_dir`
|
|
|
|
cd $NEWREPOROOT
|
|
|
|
$fdroid init
|
|
|
|
$fdroid server update --local-copy-dir=$LOCALCOPYDIR --sync-from-local-copy-dir
|
|
|
|
|
2014-04-01 22:16:24 +02:00
|
|
|
|
2014-04-04 04:17:52 +02:00
|
|
|
#------------------------------------------------------------------------------#
|
2014-04-24 01:21:22 +02:00
|
|
|
# check that --android-home fails when dir does not exist or is not a dir
|
|
|
|
|
|
|
|
REPOROOT=`create_test_dir`
|
|
|
|
KEYSTORE=$REPOROOT/keystore.jks
|
|
|
|
cd $REPOROOT
|
|
|
|
set +e
|
|
|
|
$fdroid init --keystore $KEYSTORE --android-home /opt/fakeandroidhome
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
echo "This should have failed because /opt/fakeandroidhome does not exist!"
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
echo "testing android-home path checker passed"
|
|
|
|
fi
|
|
|
|
TESTFILE=`create_test_file`
|
|
|
|
$fdroid init --keystore $KEYSTORE --android-home $TESTFILE
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
echo "This should have failed because $TESTFILE is a file not a dir!"
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
echo "testing android-home not-dir checker passed"
|
|
|
|
fi
|
|
|
|
set -e
|
|
|
|
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------------#
|
2014-07-01 03:37:46 +02:00
|
|
|
echo_header "check that fake android home passes 'fdroid init'"
|
2014-05-30 03:43:16 +02:00
|
|
|
|
|
|
|
REPOROOT=`create_test_dir`
|
|
|
|
FAKE_ANDROID_HOME=`create_test_dir`
|
|
|
|
create_fake_android_home $FAKE_ANDROID_HOME
|
|
|
|
KEYSTORE=$REPOROOT/keystore.jks
|
|
|
|
cd $REPOROOT
|
|
|
|
$fdroid init --keystore $KEYSTORE --android-home $FAKE_ANDROID_HOME
|
|
|
|
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------------#
|
|
|
|
echo_header "check that 'fdroid init' fails when build-tools cannot be found"
|
|
|
|
|
2014-12-09 14:12:41 +01:00
|
|
|
if [ -e /usr/bin/aapt ]; then
|
|
|
|
echo "/usr/bin/aapt exists, not running test"
|
|
|
|
else
|
|
|
|
REPOROOT=`create_test_dir`
|
|
|
|
FAKE_ANDROID_HOME=`create_test_dir`
|
|
|
|
create_fake_android_home $FAKE_ANDROID_HOME
|
|
|
|
rm -f $FAKE_ANDROID_HOME/build-tools/*/aapt
|
|
|
|
KEYSTORE=$REPOROOT/keystore.jks
|
|
|
|
cd $REPOROOT
|
|
|
|
set +e
|
|
|
|
$fdroid init --keystore $KEYSTORE --android-home $FAKE_ANDROID_HOME
|
|
|
|
[ $? -eq 0 ] && exit 1
|
|
|
|
set -e
|
|
|
|
fi
|
2014-05-30 03:43:16 +02:00
|
|
|
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------------#
|
|
|
|
echo_header "check that --android-home overrides ANDROID_HOME"
|
2014-04-24 01:21:22 +02:00
|
|
|
|
|
|
|
REPOROOT=`create_test_dir`
|
|
|
|
FAKE_ANDROID_HOME=`create_test_dir`
|
|
|
|
create_fake_android_home $FAKE_ANDROID_HOME
|
|
|
|
KEYSTORE=$REPOROOT/keystore.jks
|
|
|
|
cd $REPOROOT
|
|
|
|
$fdroid init --keystore $KEYSTORE --android-home $FAKE_ANDROID_HOME
|
|
|
|
set +e
|
|
|
|
grep $FAKE_ANDROID_HOME $REPOROOT/config.py
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
echo "the value set in --android-home '$FAKE_ANDROID_HOME' should override ANDROID_HOME '$ANDROID_HOME'"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
set -e
|
|
|
|
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------------#
|
2014-06-05 00:45:06 +02:00
|
|
|
# In this case, ANDROID_HOME is set to a fake, non-working version that will
|
|
|
|
# be detected by fdroid as an Android SDK install. It should use the path set
|
|
|
|
# by --android-home over the one in ANDROID_HOME, therefore if it uses the one
|
|
|
|
# in ANDROID_HOME, it won't work because it is a fake one. Only
|
|
|
|
# --android-home provides a working one.
|
2014-05-30 03:43:16 +02:00
|
|
|
echo_header "setup a new repo from scratch with keystore and android-home set on cmd line"
|
2014-04-24 01:21:22 +02:00
|
|
|
|
|
|
|
REPOROOT=`create_test_dir`
|
|
|
|
KEYSTORE=$REPOROOT/keystore.jks
|
|
|
|
FAKE_ANDROID_HOME=`create_test_dir`
|
|
|
|
create_fake_android_home $FAKE_ANDROID_HOME
|
|
|
|
STORED_ANDROID_HOME=$ANDROID_HOME
|
|
|
|
unset ANDROID_HOME
|
|
|
|
echo "ANDROID_HOME: $ANDROID_HOME"
|
|
|
|
cd $REPOROOT
|
2014-06-05 00:45:06 +02:00
|
|
|
$fdroid init --keystore $KEYSTORE --android-home $STORED_ANDROID_HOME --no-prompt
|
2014-04-24 01:21:22 +02:00
|
|
|
test -e $KEYSTORE
|
|
|
|
copy_apks_into_repo $REPOROOT
|
run-tests: verbose output for `fdroid update` to aid debugging
I'm stumped by this stacktrace, hopefully debug logging will help:
Unknown exception found!
Traceback (most recent call last):
File "./fdroidserver-0.4.0/fdroid", line 141, in <module>
main()
File "./fdroidserver-0.4.0/fdroid", line 119, in main
mod.main()
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 1146, in main
apks, cachechanged = scan_apks(apps, apkcache, repodirs[0], knownapks)
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 543, in scan_apks
thisinfo['sig'] = getsig(os.path.join(os.getcwd(), apkfile))
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 361, in getsig
with zipfile.ZipFile(apkpath, 'r') as apk:
File "/usr/lib/python2.7/zipfile.py", line 770, in __init__
self._RealGetContents()
File "/usr/lib/python2.7/zipfile.py", line 857, in _RealGetContents
x._decodeExtra()
File "/usr/lib/python2.7/zipfile.py", line 388, in _decodeExtra
tp, ln = unpack('<HH', extra[:4])
struct.error: unpack requires a string argument of length 4
2015-09-16 17:19:12 +02:00
|
|
|
$fdroid update --create-metadata --verbose
|
2015-07-25 00:39:00 +02:00
|
|
|
$fdroid readmeta
|
2015-04-21 03:52:41 +02:00
|
|
|
grep -F '<application id=' repo/index.xml > /dev/null
|
2014-04-24 01:21:22 +02:00
|
|
|
test -e repo/index.xml
|
|
|
|
test -e repo/index.jar
|
2016-11-28 21:09:07 +01:00
|
|
|
test -e repo/index-v1.jar
|
2014-04-24 01:21:22 +02:00
|
|
|
export ANDROID_HOME=$STORED_ANDROID_HOME
|
|
|
|
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------------#
|
2014-05-30 03:43:16 +02:00
|
|
|
echo_header "setup new repo from scratch using ANDROID_HOME, putting APKs in repo first"
|
2014-04-04 04:17:52 +02:00
|
|
|
|
2014-04-24 01:21:22 +02:00
|
|
|
REPOROOT=`create_test_dir`
|
|
|
|
cd $REPOROOT
|
|
|
|
mkdir repo
|
|
|
|
copy_apks_into_repo $REPOROOT
|
|
|
|
$fdroid init
|
run-tests: verbose output for `fdroid update` to aid debugging
I'm stumped by this stacktrace, hopefully debug logging will help:
Unknown exception found!
Traceback (most recent call last):
File "./fdroidserver-0.4.0/fdroid", line 141, in <module>
main()
File "./fdroidserver-0.4.0/fdroid", line 119, in main
mod.main()
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 1146, in main
apks, cachechanged = scan_apks(apps, apkcache, repodirs[0], knownapks)
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 543, in scan_apks
thisinfo['sig'] = getsig(os.path.join(os.getcwd(), apkfile))
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 361, in getsig
with zipfile.ZipFile(apkpath, 'r') as apk:
File "/usr/lib/python2.7/zipfile.py", line 770, in __init__
self._RealGetContents()
File "/usr/lib/python2.7/zipfile.py", line 857, in _RealGetContents
x._decodeExtra()
File "/usr/lib/python2.7/zipfile.py", line 388, in _decodeExtra
tp, ln = unpack('<HH', extra[:4])
struct.error: unpack requires a string argument of length 4
2015-09-16 17:19:12 +02:00
|
|
|
$fdroid update --create-metadata --verbose
|
2015-07-25 00:39:00 +02:00
|
|
|
$fdroid readmeta
|
2015-04-21 03:52:41 +02:00
|
|
|
grep -F '<application id=' repo/index.xml > /dev/null
|
2014-04-24 01:21:22 +02:00
|
|
|
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------------#
|
2014-05-30 03:43:16 +02:00
|
|
|
echo_header "setup a new repo from scratch and generate a keystore"
|
2014-04-24 01:21:22 +02:00
|
|
|
|
|
|
|
REPOROOT=`create_test_dir`
|
2014-04-04 04:17:52 +02:00
|
|
|
KEYSTORE=$REPOROOT/keystore.jks
|
|
|
|
cd $REPOROOT
|
|
|
|
$fdroid init --keystore $KEYSTORE
|
|
|
|
test -e $KEYSTORE
|
|
|
|
copy_apks_into_repo $REPOROOT
|
run-tests: verbose output for `fdroid update` to aid debugging
I'm stumped by this stacktrace, hopefully debug logging will help:
Unknown exception found!
Traceback (most recent call last):
File "./fdroidserver-0.4.0/fdroid", line 141, in <module>
main()
File "./fdroidserver-0.4.0/fdroid", line 119, in main
mod.main()
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 1146, in main
apks, cachechanged = scan_apks(apps, apkcache, repodirs[0], knownapks)
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 543, in scan_apks
thisinfo['sig'] = getsig(os.path.join(os.getcwd(), apkfile))
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 361, in getsig
with zipfile.ZipFile(apkpath, 'r') as apk:
File "/usr/lib/python2.7/zipfile.py", line 770, in __init__
self._RealGetContents()
File "/usr/lib/python2.7/zipfile.py", line 857, in _RealGetContents
x._decodeExtra()
File "/usr/lib/python2.7/zipfile.py", line 388, in _decodeExtra
tp, ln = unpack('<HH', extra[:4])
struct.error: unpack requires a string argument of length 4
2015-09-16 17:19:12 +02:00
|
|
|
$fdroid update --create-metadata --verbose
|
2015-07-25 00:39:00 +02:00
|
|
|
$fdroid readmeta
|
2014-04-04 04:17:52 +02:00
|
|
|
test -e repo/index.xml
|
|
|
|
test -e repo/index.jar
|
2016-11-28 21:09:07 +01:00
|
|
|
test -e repo/index-v1.jar
|
2015-04-21 03:52:41 +02:00
|
|
|
grep -F '<application id=' repo/index.xml > /dev/null
|
2014-04-04 06:05:22 +02:00
|
|
|
|
|
|
|
|
2015-04-21 03:38:52 +02:00
|
|
|
#------------------------------------------------------------------------------#
|
|
|
|
echo_header "setup a new repo manually and generate a keystore"
|
|
|
|
|
|
|
|
REPOROOT=`create_test_dir`
|
|
|
|
KEYSTORE=$REPOROOT/keystore.jks
|
|
|
|
cd $REPOROOT
|
|
|
|
touch config.py
|
|
|
|
cp $WORKSPACE/examples/fdroid-icon.png $REPOROOT/
|
|
|
|
! test -e $KEYSTORE
|
|
|
|
set +e
|
|
|
|
$fdroid update
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
echo "This should have failed because this repo has no keystore!"
|
|
|
|
exit 1
|
|
|
|
else
|
2015-08-05 13:26:35 +02:00
|
|
|
echo '`fdroid update` prompted to add keystore'
|
2015-04-21 03:38:52 +02:00
|
|
|
fi
|
|
|
|
set -e
|
|
|
|
$fdroid update --create-key
|
|
|
|
test -e $KEYSTORE
|
|
|
|
copy_apks_into_repo $REPOROOT
|
run-tests: verbose output for `fdroid update` to aid debugging
I'm stumped by this stacktrace, hopefully debug logging will help:
Unknown exception found!
Traceback (most recent call last):
File "./fdroidserver-0.4.0/fdroid", line 141, in <module>
main()
File "./fdroidserver-0.4.0/fdroid", line 119, in main
mod.main()
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 1146, in main
apks, cachechanged = scan_apks(apps, apkcache, repodirs[0], knownapks)
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 543, in scan_apks
thisinfo['sig'] = getsig(os.path.join(os.getcwd(), apkfile))
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 361, in getsig
with zipfile.ZipFile(apkpath, 'r') as apk:
File "/usr/lib/python2.7/zipfile.py", line 770, in __init__
self._RealGetContents()
File "/usr/lib/python2.7/zipfile.py", line 857, in _RealGetContents
x._decodeExtra()
File "/usr/lib/python2.7/zipfile.py", line 388, in _decodeExtra
tp, ln = unpack('<HH', extra[:4])
struct.error: unpack requires a string argument of length 4
2015-09-16 17:19:12 +02:00
|
|
|
$fdroid update --create-metadata --verbose
|
2015-07-25 00:39:00 +02:00
|
|
|
$fdroid readmeta
|
2015-04-21 03:38:52 +02:00
|
|
|
test -e repo/index.xml
|
|
|
|
test -e repo/index.jar
|
2016-11-28 21:09:07 +01:00
|
|
|
test -e repo/index-v1.jar
|
2015-04-21 03:38:52 +02:00
|
|
|
grep -F '<application id=' repo/index.xml > /dev/null
|
|
|
|
|
|
|
|
|
2014-05-30 22:50:32 +02:00
|
|
|
#------------------------------------------------------------------------------#
|
|
|
|
echo_header "setup a new repo from scratch, generate a keystore, then add APK and update"
|
|
|
|
|
|
|
|
REPOROOT=`create_test_dir`
|
|
|
|
KEYSTORE=$REPOROOT/keystore.jks
|
|
|
|
cd $REPOROOT
|
|
|
|
$fdroid init --keystore $KEYSTORE
|
|
|
|
test -e $KEYSTORE
|
|
|
|
copy_apks_into_repo $REPOROOT
|
run-tests: verbose output for `fdroid update` to aid debugging
I'm stumped by this stacktrace, hopefully debug logging will help:
Unknown exception found!
Traceback (most recent call last):
File "./fdroidserver-0.4.0/fdroid", line 141, in <module>
main()
File "./fdroidserver-0.4.0/fdroid", line 119, in main
mod.main()
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 1146, in main
apks, cachechanged = scan_apks(apps, apkcache, repodirs[0], knownapks)
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 543, in scan_apks
thisinfo['sig'] = getsig(os.path.join(os.getcwd(), apkfile))
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 361, in getsig
with zipfile.ZipFile(apkpath, 'r') as apk:
File "/usr/lib/python2.7/zipfile.py", line 770, in __init__
self._RealGetContents()
File "/usr/lib/python2.7/zipfile.py", line 857, in _RealGetContents
x._decodeExtra()
File "/usr/lib/python2.7/zipfile.py", line 388, in _decodeExtra
tp, ln = unpack('<HH', extra[:4])
struct.error: unpack requires a string argument of length 4
2015-09-16 17:19:12 +02:00
|
|
|
$fdroid update --create-metadata --verbose
|
2015-07-25 00:39:00 +02:00
|
|
|
$fdroid readmeta
|
2014-05-30 22:50:32 +02:00
|
|
|
test -e repo/index.xml
|
|
|
|
test -e repo/index.jar
|
2016-11-28 21:09:07 +01:00
|
|
|
test -e repo/index-v1.jar
|
2015-04-21 03:52:41 +02:00
|
|
|
grep -F '<application id=' repo/index.xml > /dev/null
|
2015-07-25 00:52:13 +02:00
|
|
|
test -e $REPOROOT/repo/info.guardianproject.urzip_100.apk || \
|
|
|
|
cp $WORKSPACE/tests/urzip.apk $REPOROOT/repo/
|
run-tests: verbose output for `fdroid update` to aid debugging
I'm stumped by this stacktrace, hopefully debug logging will help:
Unknown exception found!
Traceback (most recent call last):
File "./fdroidserver-0.4.0/fdroid", line 141, in <module>
main()
File "./fdroidserver-0.4.0/fdroid", line 119, in main
mod.main()
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 1146, in main
apks, cachechanged = scan_apks(apps, apkcache, repodirs[0], knownapks)
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 543, in scan_apks
thisinfo['sig'] = getsig(os.path.join(os.getcwd(), apkfile))
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 361, in getsig
with zipfile.ZipFile(apkpath, 'r') as apk:
File "/usr/lib/python2.7/zipfile.py", line 770, in __init__
self._RealGetContents()
File "/usr/lib/python2.7/zipfile.py", line 857, in _RealGetContents
x._decodeExtra()
File "/usr/lib/python2.7/zipfile.py", line 388, in _decodeExtra
tp, ln = unpack('<HH', extra[:4])
struct.error: unpack requires a string argument of length 4
2015-09-16 17:19:12 +02:00
|
|
|
$fdroid update --create-metadata --verbose
|
2015-07-25 00:39:00 +02:00
|
|
|
$fdroid readmeta
|
2014-05-30 22:50:32 +02:00
|
|
|
test -e repo/index.xml
|
|
|
|
test -e repo/index.jar
|
2016-11-28 21:09:07 +01:00
|
|
|
test -e repo/index-v1.jar
|
2015-04-21 03:52:41 +02:00
|
|
|
grep -F '<application id=' repo/index.xml > /dev/null
|
2014-05-30 22:50:32 +02:00
|
|
|
|
|
|
|
|
2014-04-04 06:05:22 +02:00
|
|
|
#------------------------------------------------------------------------------#
|
2014-05-30 03:43:16 +02:00
|
|
|
echo_header "setup a new repo from scratch with a HSM/smartcard"
|
2014-04-24 01:21:22 +02:00
|
|
|
REPOROOT=`create_test_dir`
|
2014-04-04 06:05:22 +02:00
|
|
|
cd $REPOROOT
|
|
|
|
$fdroid init --keystore NONE
|
|
|
|
test -e opensc-fdroid.cfg
|
|
|
|
test ! -e NONE
|
2014-04-24 01:21:22 +02:00
|
|
|
|
2015-04-21 01:09:50 +02:00
|
|
|
|
|
|
|
#------------------------------------------------------------------------------#
|
|
|
|
echo_header "setup a new repo with no keystore, add APK, and update"
|
|
|
|
|
|
|
|
REPOROOT=`create_test_dir`
|
|
|
|
KEYSTORE=$REPOROOT/keystore.jks
|
|
|
|
cd $REPOROOT
|
|
|
|
touch config.py
|
|
|
|
touch fdroid-icon.png
|
2015-07-25 00:52:13 +02:00
|
|
|
mkdir repo
|
|
|
|
cp $WORKSPACE/tests/urzip.apk $REPOROOT/repo/
|
2015-04-21 01:09:50 +02:00
|
|
|
set +e
|
run-tests: verbose output for `fdroid update` to aid debugging
I'm stumped by this stacktrace, hopefully debug logging will help:
Unknown exception found!
Traceback (most recent call last):
File "./fdroidserver-0.4.0/fdroid", line 141, in <module>
main()
File "./fdroidserver-0.4.0/fdroid", line 119, in main
mod.main()
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 1146, in main
apks, cachechanged = scan_apks(apps, apkcache, repodirs[0], knownapks)
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 543, in scan_apks
thisinfo['sig'] = getsig(os.path.join(os.getcwd(), apkfile))
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 361, in getsig
with zipfile.ZipFile(apkpath, 'r') as apk:
File "/usr/lib/python2.7/zipfile.py", line 770, in __init__
self._RealGetContents()
File "/usr/lib/python2.7/zipfile.py", line 857, in _RealGetContents
x._decodeExtra()
File "/usr/lib/python2.7/zipfile.py", line 388, in _decodeExtra
tp, ln = unpack('<HH', extra[:4])
struct.error: unpack requires a string argument of length 4
2015-09-16 17:19:12 +02:00
|
|
|
$fdroid update --create-metadata --verbose
|
2015-04-21 01:09:50 +02:00
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
echo "This should have failed because this repo has no keystore!"
|
|
|
|
exit 1
|
|
|
|
else
|
2015-08-05 13:26:35 +02:00
|
|
|
echo '`fdroid update` prompted to add keystore'
|
2015-04-21 01:09:50 +02:00
|
|
|
fi
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# now set up fake, non-working keystore setup
|
|
|
|
touch $KEYSTORE
|
|
|
|
echo "keystore = \"$KEYSTORE\"" >> config.py
|
|
|
|
echo 'repo_keyalias = "foo"' >> config.py
|
|
|
|
echo 'keystorepass = "foo"' >> config.py
|
|
|
|
echo 'keypass = "foo"' >> config.py
|
|
|
|
set +e
|
run-tests: verbose output for `fdroid update` to aid debugging
I'm stumped by this stacktrace, hopefully debug logging will help:
Unknown exception found!
Traceback (most recent call last):
File "./fdroidserver-0.4.0/fdroid", line 141, in <module>
main()
File "./fdroidserver-0.4.0/fdroid", line 119, in main
mod.main()
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 1146, in main
apks, cachechanged = scan_apks(apps, apkcache, repodirs[0], knownapks)
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 543, in scan_apks
thisinfo['sig'] = getsig(os.path.join(os.getcwd(), apkfile))
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 361, in getsig
with zipfile.ZipFile(apkpath, 'r') as apk:
File "/usr/lib/python2.7/zipfile.py", line 770, in __init__
self._RealGetContents()
File "/usr/lib/python2.7/zipfile.py", line 857, in _RealGetContents
x._decodeExtra()
File "/usr/lib/python2.7/zipfile.py", line 388, in _decodeExtra
tp, ln = unpack('<HH', extra[:4])
struct.error: unpack requires a string argument of length 4
2015-09-16 17:19:12 +02:00
|
|
|
$fdroid update --create-metadata --verbose
|
2015-04-21 01:09:50 +02:00
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
echo "This should have failed because this repo has a bad/fake keystore!"
|
|
|
|
exit 1
|
|
|
|
else
|
2015-08-05 13:26:35 +02:00
|
|
|
echo '`fdroid update` prompted to add keystore'
|
2015-04-21 01:09:50 +02:00
|
|
|
fi
|
|
|
|
set -e
|
|
|
|
|
|
|
|
|
2017-03-16 19:22:32 +01:00
|
|
|
#------------------------------------------------------------------------------#
|
|
|
|
echo_header "copy tests/repo, update with binary transparency log"
|
|
|
|
|
|
|
|
REPOROOT=`create_test_dir`
|
|
|
|
GNUPGHOME=$REPOROOT/gnupghome
|
|
|
|
KEYSTORE=$WORKSPACE/tests/keystore.jks
|
2017-04-03 23:16:39 +02:00
|
|
|
mkdir $REPOROOT/git_remote
|
|
|
|
cd $REPOROOT/git_remote
|
|
|
|
git init --bare
|
2017-03-16 19:22:32 +01:00
|
|
|
cd $REPOROOT
|
|
|
|
$fdroid init --keystore $KEYSTORE --repo-keyalias=sova
|
|
|
|
cp -a $WORKSPACE/tests/metadata $WORKSPACE/tests/repo $WORKSPACE/tests/stats $REPOROOT/
|
|
|
|
echo 'keystorepass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI="' >> config.py
|
|
|
|
echo 'keypass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI="' >> config.py
|
2017-04-03 23:16:39 +02:00
|
|
|
echo "binary_transparency_remote = '$REPOROOT/git_remote'" >> config.py
|
2017-03-16 19:22:32 +01:00
|
|
|
echo "accepted_formats = ['json', 'txt', 'yml']" >> config.py
|
2017-04-10 20:28:43 +02:00
|
|
|
$fdroid update --verbose
|
|
|
|
$fdroid server update --verbose
|
2017-03-16 19:22:32 +01:00
|
|
|
test -e repo/index.xml
|
|
|
|
test -e repo/index.jar
|
2016-11-28 21:09:07 +01:00
|
|
|
test -e repo/index-v1.jar
|
2017-03-16 19:22:32 +01:00
|
|
|
grep -F '<application id=' repo/index.xml > /dev/null
|
|
|
|
cd binary_transparency
|
|
|
|
[ `git rev-list --count HEAD` == "2" ]
|
2017-04-03 23:16:39 +02:00
|
|
|
cd $REPOROOT/git_remote
|
|
|
|
[ `git rev-list --count HEAD` == "2" ]
|
2017-03-16 19:22:32 +01:00
|
|
|
|
|
|
|
|
2015-04-21 01:09:50 +02:00
|
|
|
#------------------------------------------------------------------------------#
|
|
|
|
echo_header "setup a new repo with keystore with APK, update, then without key"
|
|
|
|
|
|
|
|
REPOROOT=`create_test_dir`
|
|
|
|
KEYSTORE=$REPOROOT/keystore.jks
|
|
|
|
cd $REPOROOT
|
|
|
|
$fdroid init --keystore $KEYSTORE
|
|
|
|
test -e $KEYSTORE
|
|
|
|
cp $WORKSPACE/tests/urzip.apk $REPOROOT/repo/
|
run-tests: verbose output for `fdroid update` to aid debugging
I'm stumped by this stacktrace, hopefully debug logging will help:
Unknown exception found!
Traceback (most recent call last):
File "./fdroidserver-0.4.0/fdroid", line 141, in <module>
main()
File "./fdroidserver-0.4.0/fdroid", line 119, in main
mod.main()
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 1146, in main
apks, cachechanged = scan_apks(apps, apkcache, repodirs[0], knownapks)
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 543, in scan_apks
thisinfo['sig'] = getsig(os.path.join(os.getcwd(), apkfile))
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 361, in getsig
with zipfile.ZipFile(apkpath, 'r') as apk:
File "/usr/lib/python2.7/zipfile.py", line 770, in __init__
self._RealGetContents()
File "/usr/lib/python2.7/zipfile.py", line 857, in _RealGetContents
x._decodeExtra()
File "/usr/lib/python2.7/zipfile.py", line 388, in _decodeExtra
tp, ln = unpack('<HH', extra[:4])
struct.error: unpack requires a string argument of length 4
2015-09-16 17:19:12 +02:00
|
|
|
$fdroid update --create-metadata --verbose
|
2015-07-25 00:39:00 +02:00
|
|
|
$fdroid readmeta
|
2015-04-21 01:09:50 +02:00
|
|
|
test -e repo/index.xml
|
|
|
|
test -e repo/index.jar
|
2016-11-28 21:09:07 +01:00
|
|
|
test -e repo/index-v1.jar
|
2015-04-21 03:52:41 +02:00
|
|
|
grep -F '<application id=' repo/index.xml > /dev/null
|
2015-04-21 01:09:50 +02:00
|
|
|
|
|
|
|
# now set fake repo_keyalias
|
2016-02-15 16:17:24 +01:00
|
|
|
sed -i.tmp 's,^ *repo_keyalias.*,repo_keyalias = "fake",' $REPOROOT/config.py
|
2015-04-21 01:09:50 +02:00
|
|
|
set +e
|
|
|
|
$fdroid update
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
echo "This should have failed because this repo has a bad repo_keyalias!"
|
|
|
|
exit 1
|
|
|
|
else
|
2015-08-05 13:26:35 +02:00
|
|
|
echo '`fdroid update` prompted to add keystore'
|
2015-04-21 01:09:50 +02:00
|
|
|
fi
|
|
|
|
set -e
|
|
|
|
|
2015-04-21 03:38:52 +02:00
|
|
|
# try creating a new keystore, but fail because the old one is there
|
|
|
|
test -e $KEYSTORE
|
|
|
|
set +e
|
|
|
|
$fdroid update --create-key
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
echo "This should have failed because a keystore is already there!"
|
|
|
|
exit 1
|
|
|
|
else
|
2015-08-05 13:26:35 +02:00
|
|
|
echo '`fdroid update` complained about existing keystore'
|
2015-04-21 03:38:52 +02:00
|
|
|
fi
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# now actually create the key with the existing settings
|
|
|
|
rm -f $KEYSTORE
|
|
|
|
! test -e $KEYSTORE
|
|
|
|
$fdroid update --create-key
|
|
|
|
test -e $KEYSTORE
|
|
|
|
|
2015-04-21 01:09:50 +02:00
|
|
|
|
|
|
|
#------------------------------------------------------------------------------#
|
|
|
|
|
|
|
|
# remove this to prevent git conflicts and complaining
|
2014-09-17 08:54:02 +02:00
|
|
|
rm -rf $WORKSPACE/fdroidserver.egg-info/
|
2014-04-24 01:21:22 +02:00
|
|
|
|
|
|
|
echo SUCCESS
|