1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-09 17:00:12 +01:00
fdroidserver/tests/complete-ci-tests

77 lines
2.1 KiB
Plaintext
Raw Normal View History

#!/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`"
exit 1
fi
set -e
set -x
if [ -z $WORKSPACE ]; then
WORKSPACE=`cd $(dirname $0)/.. && pwd`
echo "Setting Workspace to $WORKSPACE"
fi
if [ -z $ANDROID_HOME ]; then
if [ -e ~/.android/bashrc ]; then
. ~/.android/bashrc
else
echo "ANDROID_HOME must be set!"
exit 1
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
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
#------------------------------------------------------------------------------#
# 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
#------------------------------------------------------------------------------#
# 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
. $WORKSPACE/env/bin/activate
pip3 install --quiet -e $WORKSPACE
python3 setup.py compile_catalog install
# make sure translation files were installed
test -e $WORKSPACE/env/share/locale/de/LC_MESSAGES/fdroidserver.mo
# run tests in new pip+pyvenv install
fdroid=$WORKSPACE/env/bin/fdroid $WORKSPACE/tests/run-tests $apksource