diff --git a/tests/regressions.py b/tests/regressions.py index 3248e0da..f61f3a2b 100644 --- a/tests/regressions.py +++ b/tests/regressions.py @@ -24,11 +24,14 @@ # import multiprocessing +import os import time import unittest import qubes.qubes import qubes.tests +import subprocess + class TC_00_Regressions(qubes.tests.SystemTestsMixin, qubes.tests.QubesTestCase): # Bug: #906 @@ -57,3 +60,22 @@ class TC_00_Regressions(qubes.tests.SystemTestsMixin, qubes.tests.QubesTestCase) self.assertIsNotNone(qc.get_vm_by_name(vmname1)) self.assertIsNotNone(qc.get_vm_by_name(vmname2)) + def test_bug_1389_dispvm_qubesdb_crash(self): + """ + Sometimes QubesDB instance in DispVM crashes at startup. + Unfortunately we don't have reliable way to reproduce it, so try twice + :return: + """ + self.qc.unlock_db() + for try_no in xrange(2): + p = subprocess.Popen(['/usr/lib/qubes/qfile-daemon-dvm', + 'qubes.VMShell', 'dom0', 'DEFAULT'], + stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + stderr=open(os.devnull, 'w')) + p.stdin.write("qubesdb-read /name || echo ERROR\n") + dispvm_name = p.stdout.readline() + p.stdin.close() + self.assertTrue(dispvm_name.startswith("disp"), + "Try {} failed".format(try_no)) +