run-tests 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/bin/bash --
  2. set -eu
  3. unset CLEANUP_LVM name DEFAULT_LVM_POOL retcode
  4. install_rpm_deps () {
  5. local applications
  6. applications=(lvm2 python3-docutils python3-pyyaml python3-jinja2
  7. python3-lxml btrfs-progs vim-common)
  8. rpm -q --quiet -- "${applications[@]}" ||
  9. sudo dnf -- install "${applications[@]}" ||
  10. : # we don’t actually care if this succeeds
  11. }
  12. if { command -pv rpm && command -pv dnf; }>/dev/null; then install_rpm_deps; fi
  13. CLEANUP_LVM=
  14. name=$(dirname "$0")
  15. if sudo --non-interactive "$name/ci/lvm-manage" setup-lvm vg$$/pool; then
  16. export DEFAULT_LVM_POOL=vg$$/pool
  17. CLEANUP_LVM=yes
  18. fi
  19. : "${PYTHON:=python3}"
  20. : "${TESTPYTHONPATH:=test-packages}"
  21. if [ -d ../core-qrexec/qrexec ] && ! $PYTHON -c 'import qrexec' 2>/dev/null; then
  22. PYTHONPATH="${PYTHONPATH-}:../core-qrexec"
  23. fi
  24. PYTHONPATH="${TESTPYTHONPATH}:${PYTHONPATH}"
  25. export PYTHONPATH
  26. "${PYTHON}" setup.py egg_info --egg-base "${TESTPYTHONPATH}"
  27. "${PYTHON}" -m coverage run --rcfile=ci/coveragerc -m qubes.tests.run "$@"
  28. retcode=$?
  29. if [ -n "$CLEANUP_LVM" ]; then
  30. sudo --non-interactive $(dirname "$0")/ci/lvm-manage cleanup-lvm "$DEFAULT_LVM_POOL"
  31. fi
  32. exit $retcode