tests: encourage to release the lock after completing the setup

Many functions and especially standalone tools takes the lock itself, so
to prevent deadlocks, as a rule execute the tests with lock released.

Also reload qubes.xml before cleanup.
This commit is contained in:
Marek Marczykowski-Górecki 2015-02-22 01:26:38 +01:00
parent ae6ca5c0a3
commit 67ea5bc441
2 changed files with 7 additions and 2 deletions

View File

@ -187,8 +187,8 @@ class SystemTestsMixin(object):
.. warning:: .. warning::
This method instantiates QubesVmCollection acquires write lock for This method instantiates QubesVmCollection acquires write lock for
it. You can use is as :py:attr:`qc`. Do not release the lock it. You can use is as :py:attr:`qc`. You can (and probably
yourself. should) release the lock at the end of setUp in subclass
''' '''
super(SystemTestsMixin, self).setUp() super(SystemTestsMixin, self).setUp()
@ -205,6 +205,10 @@ class SystemTestsMixin(object):
def tearDown(self): def tearDown(self):
super(SystemTestsMixin, self).tearDown() super(SystemTestsMixin, self).tearDown()
try: self.qc.lock_db_for_writing()
except qubes.qubes.QubesException: pass
self.qc.load()
self.remove_test_vms() self.remove_test_vms()
self.qc.save() self.qc.save()

View File

@ -47,6 +47,7 @@ class TC_00_AppVM(qubes.tests.SystemTestsMixin, qubes.tests.QubesTestCase):
template=self.qc.get_default_template()) template=self.qc.get_default_template())
self.testvm2.create_on_disk(verbose=False) self.testvm2.create_on_disk(verbose=False)
self.qc.save() self.qc.save()
self.qc.unlock_db()
def test_000_start_shutdown(self): def test_000_start_shutdown(self):