Merge remote-tracking branch 'marmarek/core3-devel-mm' into core3-devel
This commit is contained in:
commit
2a9752716c
@ -223,7 +223,7 @@ class QubesTestCase(unittest.TestCase):
|
|||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return '{}/{}/{}'.format(
|
return '{}/{}/{}'.format(
|
||||||
'.'.join(self.__class__.__module__.split('.')[2:]),
|
self.__class__.__module__,
|
||||||
self.__class__.__name__,
|
self.__class__.__name__,
|
||||||
self._testMethodName)
|
self._testMethodName)
|
||||||
|
|
||||||
@ -971,6 +971,8 @@ def load_tests(loader, tests, pattern): # pylint: disable=unused-argument
|
|||||||
'qubes.tests.int.tools.qubes_create',
|
'qubes.tests.int.tools.qubes_create',
|
||||||
'qubes.tests.int.tools.qvm_prefs',
|
'qubes.tests.int.tools.qvm_prefs',
|
||||||
'qubes.tests.int.tools.qvm_run',
|
'qubes.tests.int.tools.qvm_run',
|
||||||
|
# external modules
|
||||||
|
'qubes.tests.extra',
|
||||||
):
|
):
|
||||||
tests.addTests(loader.loadTestsFromName(modname))
|
tests.addTests(loader.loadTestsFromName(modname))
|
||||||
|
|
||||||
|
@ -32,6 +32,10 @@ class ExtraTestCase(qubes.tests.SystemTestsMixin, qubes.tests.QubesTestCase):
|
|||||||
|
|
||||||
template = None
|
template = None
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
super(ExtraTestCase, self).setUp()
|
||||||
|
self.init_default_template(self.template)
|
||||||
|
|
||||||
def create_vms(self, names):
|
def create_vms(self, names):
|
||||||
"""
|
"""
|
||||||
Create AppVMs for the duration of the test. Will be automatically
|
Create AppVMs for the duration of the test. Will be automatically
|
||||||
@ -47,14 +51,15 @@ class ExtraTestCase(qubes.tests.SystemTestsMixin, qubes.tests.QubesTestCase):
|
|||||||
for vmname in names:
|
for vmname in names:
|
||||||
vm = self.app.add_new_vm(qubes.vm.appvm.AppVM,
|
vm = self.app.add_new_vm(qubes.vm.appvm.AppVM,
|
||||||
name=self.make_vm_name(vmname),
|
name=self.make_vm_name(vmname),
|
||||||
template=template)
|
template=template,
|
||||||
vm.create_on_disk(verbose=False)
|
label='red')
|
||||||
|
vm.create_on_disk()
|
||||||
self.save_and_reload_db()
|
self.save_and_reload_db()
|
||||||
|
|
||||||
# get objects after reload
|
# get objects after reload
|
||||||
vms = []
|
vms = []
|
||||||
for vmname in names:
|
for vmname in names:
|
||||||
vms.append(self.app.domains[self.make_vm_name])
|
vms.append(self.app.domains[self.make_vm_name(vmname)])
|
||||||
return vms
|
return vms
|
||||||
|
|
||||||
def enable_network(self):
|
def enable_network(self):
|
||||||
@ -66,7 +71,7 @@ class ExtraTestCase(qubes.tests.SystemTestsMixin, qubes.tests.QubesTestCase):
|
|||||||
|
|
||||||
def load_tests(loader, tests, pattern):
|
def load_tests(loader, tests, pattern):
|
||||||
for entry in pkg_resources.iter_entry_points('qubes.tests.extra'):
|
for entry in pkg_resources.iter_entry_points('qubes.tests.extra'):
|
||||||
for test_case in entry():
|
for test_case in entry.load()():
|
||||||
tests.addTests(loader.loadTestsFromTestCase(test_case))
|
tests.addTests(loader.loadTestsFromTestCase(test_case))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -226,7 +226,7 @@ Test package
|
|||||||
|
|
||||||
logpath = os.path.join(self.tmpdir, 'dom0-update-output.txt')
|
logpath = os.path.join(self.tmpdir, 'dom0-update-output.txt')
|
||||||
try:
|
try:
|
||||||
subprocess.check_call(['sudo', 'qubes-dom0-update', '-y'] +
|
subprocess.check_call(['sudo', '-E', 'qubes-dom0-update', '-y'] +
|
||||||
self.dom0_update_common_opts,
|
self.dom0_update_common_opts,
|
||||||
stdout=open(logpath, 'w'),
|
stdout=open(logpath, 'w'),
|
||||||
stderr=subprocess.STDOUT)
|
stderr=subprocess.STDOUT)
|
||||||
@ -256,7 +256,7 @@ Test package
|
|||||||
shutil.rmtree('/var/lib/qubes/updates/repodata')
|
shutil.rmtree('/var/lib/qubes/updates/repodata')
|
||||||
logpath = os.path.join(self.tmpdir, 'dom0-update-output.txt')
|
logpath = os.path.join(self.tmpdir, 'dom0-update-output.txt')
|
||||||
try:
|
try:
|
||||||
subprocess.check_call(['sudo', 'qubes-dom0-update', '-y',
|
subprocess.check_call(['sudo', '-E', 'qubes-dom0-update', '-y',
|
||||||
'--clean'] +
|
'--clean'] +
|
||||||
self.dom0_update_common_opts,
|
self.dom0_update_common_opts,
|
||||||
stdout=open(logpath, 'w'),
|
stdout=open(logpath, 'w'),
|
||||||
|
@ -15,6 +15,11 @@ class TemplateVM(qubes.vm.qubesvm.QubesVM):
|
|||||||
'''COW image'''
|
'''COW image'''
|
||||||
return self.storage.rootcow_img
|
return self.storage.rootcow_img
|
||||||
|
|
||||||
|
@property
|
||||||
|
def appvms(self):
|
||||||
|
for vm in self.app.domains:
|
||||||
|
if hasattr(vm, 'template') and vm.template is self:
|
||||||
|
yield vm
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(TemplateVM, self).__init__(*args, **kwargs)
|
super(TemplateVM, self).__init__(*args, **kwargs)
|
||||||
|
Loading…
Reference in New Issue
Block a user