2015-09-01 12:28:58 +02:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# this is the script run by the Jenkins and gitlab-ci continuous integration
|
|
|
|
# build services. It is a thorough set of tests that runs all the tests using
|
|
|
|
# the various methods of installing/running fdroidserver. It is separate from
|
|
|
|
# ./tests/run-tests because its too heavy for manual use.
|
|
|
|
|
|
|
|
if [ `dirname $0` != "." ]; then
|
|
|
|
echo "only run this script like ./`basename $0`"
|
2016-02-15 11:40:35 +01:00
|
|
|
exit 1
|
2015-09-01 12:28:58 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
set -e
|
|
|
|
set -x
|
|
|
|
|
|
|
|
if [ -z $WORKSPACE ]; then
|
2017-11-13 13:08:22 +01:00
|
|
|
WORKSPACE=`cd $(dirname $0)/.. && pwd`
|
|
|
|
echo "Setting Workspace to $WORKSPACE"
|
2015-09-01 12:28:58 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z $ANDROID_HOME ]; then
|
|
|
|
if [ -e ~/.android/bashrc ]; then
|
|
|
|
. ~/.android/bashrc
|
|
|
|
else
|
|
|
|
echo "ANDROID_HOME must be set!"
|
2016-02-15 11:40:35 +01:00
|
|
|
exit 1
|
2015-09-01 12:28:58 +02:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
split pip tests to run separately for Ubuntu/trusty and Debian/stretch
Trying to reuse the pip test run is now a lot more work than just
writing it cutstom for each target platform.
Ubuntu/trusty does not have androguard 3.1.x nor aapt >= 26.x, so
using trusty's aapt will always have errors scraping some names from
APKs. This continues to use Google's binary.
`apt-get update` is now disabled by default by Travis, this adds it
back so that the latest files from the PPA are used.
Here's one example of an issue with pip on trusty:
https://github.com/requests/requests/issues/4006
pip3 install --quiet -e /home/travis/build/fdroidtravis/fdroidserver
Exception:
Traceback (most recent call last):
File "/home/travis/build/fdroidtravis/fdroidserver/env/lib/python-wheels/setuptools-3.3-py2.py3-none-any.whl/pkg_resources.py", line 2482, in _dep_map
return self.__dep_map
File "/home/travis/build/fdroidtravis/fdroidserver/env/lib/python-wheels/setuptools-3.3-py2.py3-none-any.whl/pkg_resources.py", line 2344, in __getattr__
raise AttributeError(attr)
AttributeError: _DistInfoDistribution__dep_map
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/travis/build/fdroidtravis/fdroidserver/env/lib/python3.4/site-packages/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/home/travis/build/fdroidtravis/fdroidserver/env/lib/python3.4/site-packages/pip/commands/install.py", line 278, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "/home/travis/build/fdroidtravis/fdroidserver/env/lib/python3.4/site-packages/pip/req.py", line 1266, in prepare_files
req_to_install.extras):
File "/home/travis/build/fdroidtravis/fdroidserver/env/lib/python-wheels/setuptools-3.3-py2.py3-none-any.whl/pkg_resources.py", line 2291, in requires
dm = self._dep_map
File "/home/travis/build/fdroidtravis/fdroidserver/env/lib/python-wheels/setuptools-3.3-py2.py3-none-any.whl/pkg_resources.py", line 2484, in _dep_map
self.__dep_map = self._compute_dependencies()
File "/home/travis/build/fdroidtravis/fdroidserver/env/lib/python-wheels/setuptools-3.3-py2.py3-none-any.whl/pkg_resources.py", line 2517, in _compute_dependencies
common = frozenset(reqs_for_extra(None))
File "/home/travis/build/fdroidtravis/fdroidserver/env/lib/python-wheels/setuptools-3.3-py2.py3-none-any.whl/pkg_resources.py", line 2514, in reqs_for_extra
if req.marker_fn(override={'extra':extra}):
File "/home/travis/build/fdroidtravis/fdroidserver/env/lib/python-wheels/setuptools-3.3-py2.py3-none-any.whl/_markerlib/markers.py", line 113, in marker_fn
return eval(compiled_marker, environment)
File "<environment marker>", line 1, in <module>
NameError: name 'platform_system' is not defined
2018-05-11 11:05:11 +02:00
|
|
|
if ! which pyvenv; then
|
|
|
|
echo "pyvenv required to run this test suite!"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2015-09-01 12:28:58 +02:00
|
|
|
apksource=$1
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------------#
|
|
|
|
# cache pypi downloads
|
|
|
|
if [ -z $PIP_DOWNLOAD_CACHE ]; then
|
|
|
|
export PIP_DOWNLOAD_CACHE=$HOME/.pip_download_cache
|
|
|
|
fi
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------------#
|
|
|
|
# run local tests, don't scan fdroidserver/ project for APKs
|
|
|
|
|
|
|
|
cd $WORKSPACE/tests
|
|
|
|
./run-tests $apksource
|
|
|
|
|
|
|
|
|
2017-11-13 13:08:22 +01:00
|
|
|
#------------------------------------------------------------------------------#
|
|
|
|
# make sure that translations do not cause stacktraces
|
|
|
|
cd $WORKSPACE/locale
|
|
|
|
for locale in *; do
|
|
|
|
if [ ! -d $locale ]; then
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
for cmd in `sed -n 's/.*("\(.*\)", *_.*/\1/p' $WORKSPACE/fdroid`; do
|
|
|
|
LANGUAGE=$locale $WORKSPACE/fdroid $cmd --help > /dev/null
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|
|
|
|
|
2015-09-01 12:28:58 +02:00
|
|
|
#------------------------------------------------------------------------------#
|
|
|
|
# test install using install direct from git repo
|
|
|
|
cd $WORKSPACE
|
|
|
|
rm -rf $WORKSPACE/env
|
split pip tests to run separately for Ubuntu/trusty and Debian/stretch
Trying to reuse the pip test run is now a lot more work than just
writing it cutstom for each target platform.
Ubuntu/trusty does not have androguard 3.1.x nor aapt >= 26.x, so
using trusty's aapt will always have errors scraping some names from
APKs. This continues to use Google's binary.
`apt-get update` is now disabled by default by Travis, this adds it
back so that the latest files from the PPA are used.
Here's one example of an issue with pip on trusty:
https://github.com/requests/requests/issues/4006
pip3 install --quiet -e /home/travis/build/fdroidtravis/fdroidserver
Exception:
Traceback (most recent call last):
File "/home/travis/build/fdroidtravis/fdroidserver/env/lib/python-wheels/setuptools-3.3-py2.py3-none-any.whl/pkg_resources.py", line 2482, in _dep_map
return self.__dep_map
File "/home/travis/build/fdroidtravis/fdroidserver/env/lib/python-wheels/setuptools-3.3-py2.py3-none-any.whl/pkg_resources.py", line 2344, in __getattr__
raise AttributeError(attr)
AttributeError: _DistInfoDistribution__dep_map
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/travis/build/fdroidtravis/fdroidserver/env/lib/python3.4/site-packages/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/home/travis/build/fdroidtravis/fdroidserver/env/lib/python3.4/site-packages/pip/commands/install.py", line 278, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "/home/travis/build/fdroidtravis/fdroidserver/env/lib/python3.4/site-packages/pip/req.py", line 1266, in prepare_files
req_to_install.extras):
File "/home/travis/build/fdroidtravis/fdroidserver/env/lib/python-wheels/setuptools-3.3-py2.py3-none-any.whl/pkg_resources.py", line 2291, in requires
dm = self._dep_map
File "/home/travis/build/fdroidtravis/fdroidserver/env/lib/python-wheels/setuptools-3.3-py2.py3-none-any.whl/pkg_resources.py", line 2484, in _dep_map
self.__dep_map = self._compute_dependencies()
File "/home/travis/build/fdroidtravis/fdroidserver/env/lib/python-wheels/setuptools-3.3-py2.py3-none-any.whl/pkg_resources.py", line 2517, in _compute_dependencies
common = frozenset(reqs_for_extra(None))
File "/home/travis/build/fdroidtravis/fdroidserver/env/lib/python-wheels/setuptools-3.3-py2.py3-none-any.whl/pkg_resources.py", line 2514, in reqs_for_extra
if req.marker_fn(override={'extra':extra}):
File "/home/travis/build/fdroidtravis/fdroidserver/env/lib/python-wheels/setuptools-3.3-py2.py3-none-any.whl/_markerlib/markers.py", line 113, in marker_fn
return eval(compiled_marker, environment)
File "<environment marker>", line 1, in <module>
NameError: name 'platform_system' is not defined
2018-05-11 11:05:11 +02:00
|
|
|
pyvenv $WORKSPACE/env
|
2015-09-01 12:28:58 +02:00
|
|
|
. $WORKSPACE/env/bin/activate
|
2017-10-18 14:58:07 +02:00
|
|
|
pip3 install --quiet -e $WORKSPACE
|
2017-10-19 18:00:04 +02:00
|
|
|
python3 setup.py compile_catalog install
|
|
|
|
|
|
|
|
# make sure translation files were installed
|
|
|
|
test -e $WORKSPACE/env/share/locale/de/LC_MESSAGES/fdroidserver.mo
|
2015-09-01 12:28:58 +02:00
|
|
|
|
2016-04-06 19:46:21 +02:00
|
|
|
# run tests in new pip+pyvenv install
|
2015-09-01 12:28:58 +02:00
|
|
|
fdroid=$WORKSPACE/env/bin/fdroid $WORKSPACE/tests/run-tests $apksource
|