2020-11-28 04:20:39 +01:00
|
|
|
#!/bin/bash --
|
2016-04-19 15:57:08 +02:00
|
|
|
|
2020-11-27 02:48:43 +01:00
|
|
|
set -eu
|
2020-11-28 05:06:26 +01:00
|
|
|
unset CLEANUP_LVM name DEFAULT_LVM_POOL retcode
|
|
|
|
install_rpm_deps () {
|
|
|
|
local applications
|
|
|
|
applications=(lvm2 python3-inotify python3-sphinx python3-docutils
|
|
|
|
python3-pyyaml python3-jinja2 python3-lxml python3-pylint
|
|
|
|
python3-coverage btrfs-progs vim-common)
|
|
|
|
rpm -q --quiet -- "${applications[@]}" ||
|
|
|
|
sudo dnf -- install "${applications[@]}"
|
|
|
|
}
|
|
|
|
if { command -pv rpm && command -pv dnf; }>/dev/null; then install_rpm_deps; fi
|
2016-09-04 22:33:21 +02:00
|
|
|
CLEANUP_LVM=
|
2020-11-28 04:20:39 +01:00
|
|
|
name=$(dirname "$0")
|
|
|
|
if sudo --non-interactive "$name/ci/lvm-manage" setup-lvm vg$$/pool; then
|
2016-09-04 22:33:21 +02:00
|
|
|
export DEFAULT_LVM_POOL=vg$$/pool
|
|
|
|
CLEANUP_LVM=yes
|
|
|
|
fi
|
|
|
|
|
2017-03-16 20:36:41 +01:00
|
|
|
: "${PYTHON:=python3}"
|
2016-04-19 15:57:08 +02:00
|
|
|
: "${TESTPYTHONPATH:=test-packages}"
|
|
|
|
|
2020-11-26 05:10:43 +01:00
|
|
|
if [ -d ../core-qrexec/qrexec ] && ! $PYTHON -c 'import qrexec' 2>/dev/null; then
|
2020-11-27 23:16:20 +01:00
|
|
|
PYTHONPATH="${PYTHONPATH-}:../core-qrexec"
|
2020-11-26 05:10:43 +01:00
|
|
|
fi
|
|
|
|
|
2016-04-19 15:57:08 +02:00
|
|
|
PYTHONPATH="${TESTPYTHONPATH}:${PYTHONPATH}"
|
|
|
|
export PYTHONPATH
|
|
|
|
|
|
|
|
"${PYTHON}" setup.py egg_info --egg-base "${TESTPYTHONPATH}"
|
2017-03-16 20:35:56 +01:00
|
|
|
"${PYTHON}" -m coverage run --rcfile=ci/coveragerc -m qubes.tests.run "$@"
|
2016-09-04 22:33:21 +02:00
|
|
|
retcode=$?
|
|
|
|
if [ -n "$CLEANUP_LVM" ]; then
|
|
|
|
sudo --non-interactive $(dirname "$0")/ci/lvm-manage cleanup-lvm "$DEFAULT_LVM_POOL"
|
|
|
|
fi
|
|
|
|
exit $retcode
|