diff --git a/qubes/app.py b/qubes/app.py index 2a00355b7..ec2fb0e86 100644 --- a/qubes/app.py +++ b/qubes/app.py @@ -1593,3 +1593,14 @@ def on_property_set_default_dispvm(self, event, name, newvalue, # resetting dispvm to its default value vm.fire_event('property-reset:default_dispvm', name='default_dispvm', oldvalue=oldvalue) + + # Allow long function name over 30 characters + # Pylint: disable=C0103 + @qubes.events.handler('property-pre-set:default_kernel') + def on_property_pre_set_default_kernel(self, event, name, newvalue, + oldvalue=None): + # pylint: disable=unused-argument + kernels = [kernel.vid for kernel in self.pools['linux-kernel'].volumes] + if not newvalue in kernels: + raise qubes.exc.QubesException( + 'Invalid kernel: {} !'.format(newvalue)) diff --git a/run-tests b/run-tests index b0928686b..b084af92e 100755 --- a/run-tests +++ b/run-tests @@ -19,6 +19,12 @@ if sudo --non-interactive "$name/ci/lvm-manage" setup-lvm vg$$/pool; then CLEANUP_LVM=yes fi +CLEANUP_KERNEL_POOL= +if [ ! -d "/var/lib/qubes/vm-kernels" ]; then + mkdir --parents /var/lib/qubes/vm-kernels/dummy + CLEANUP_KERNEL_POOL=yes +fi + : "${PYTHON:=python3}" : "${TESTPYTHONPATH:=test-packages}" @@ -32,6 +38,9 @@ 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_KERNEL_POOL" ]; then + rmdir /var/lib/qubes/vm-kernels/dummy +fi if [ -n "$CLEANUP_LVM" ]; then sudo --non-interactive $(dirname "$0")/ci/lvm-manage cleanup-lvm "$DEFAULT_LVM_POOL" fi