-
-
Notifications
You must be signed in to change notification settings - Fork 108
/
run-tests
executable file
·38 lines (33 loc) · 1.23 KB
/
run-tests
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash --
set -eu
unset CLEANUP_LVM name DEFAULT_LVM_POOL retcode
case $0 in (/*) cd "${0%/*}/";; (*/*) cd "./${0%/*}";; esac
install_rpm_deps () {
local applications
applications=(lvm2 python3-docutils python3-pyyaml python3-jinja2
python3-lxml btrfs-progs vim-common python3-coverage python3-inotify cryptsetup)
rpm -q --quiet -- "${applications[@]}" ||
sudo dnf -- install "${applications[@]}" ||
: # we don’t actually care if this succeeds
}
if { command -pv rpm && command -pv dnf; }>/dev/null; then install_rpm_deps; fi
CLEANUP_LVM=
name=$(dirname "$0")
if sudo --non-interactive "$name/ci/lvm-manage" setup-lvm vg$$/pool; then
export DEFAULT_LVM_POOL=vg$$/pool
CLEANUP_LVM=yes
fi
: "${PYTHON:=python3}"
: "${TESTPYTHONPATH:=test-packages}"
if [ -d ../core-qrexec/qrexec ]; then
PYTHONPATH=${PYTHONPATH+"$PYTHONPATH:"}:../core-qrexec
fi
PYTHONPATH=${TESTPYTHONPATH}${PYTHONPATH+":${PYTHONPATH}"}
export PYTHONPATH
"${PYTHON}" setup.py egg_info --egg-base "${TESTPYTHONPATH}"
"${PYTHON}" -m coverage run --rcfile=ci/coveragerc -m qubes.tests.run "$@"
retcode=$?
if [ -n "$CLEANUP_LVM" ]; then
sudo --non-interactive $(dirname "$0")/ci/lvm-manage cleanup-lvm "$DEFAULT_LVM_POOL"
fi
exit $retcode