Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions qubes/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -921,6 +921,21 @@ def close_qdb_on_remove(self, app, event, vm, **kwargs):
vm._qdb_connection_watch.close()
vm._qdb_connection_watch = None

@staticmethod
def set_hvm(vm):
vm.virt_mode = "hvm"
# when running test in nested virt, set lower maxmem to workaround
# https://github.com/QubesOS/qubes-issues/issues/10723
qemu = False
try:
with open("/sys/firmware/dmi/entries/1-0/raw", "rb") as f:
if b"QEMU" in f.read():
qemu = True
except OSError:
pass
if qemu:
vm.maxmem = 1024

def cleanup_app(self):
self.remove_test_vms()

Expand Down
2 changes: 2 additions & 0 deletions qubes/tests/extra.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ def __getattr__(self, item):
def __setattr__(self, key, value):
if key.startswith("_"):
return super(VMWrapper, self).__setattr__(key, value)
if key == "virt_mode" and value == "hvm":
qubes.tests.SystemTestCase.set_hvm(self._vm)
return setattr(self._vm, key, value)

def __str__(self):
Expand Down
8 changes: 4 additions & 4 deletions qubes/tests/integ/audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ def test_222_audio_rec_unmuted_pulseaudio(self):
"pulseaudio-utils not installed in dom0",
)
def test_223_audio_play_hvm(self):
self.testvm1.virt_mode = "hvm"
self.set_hvm(self.testvm1)
self.testvm1.features["audio-model"] = "ich6"
self.prepare_audio_test("pulseaudio")
try:
Expand All @@ -625,7 +625,7 @@ def test_223_audio_play_hvm(self):
"pulseaudio-utils not installed in dom0",
)
def test_224_audio_rec_muted_hvm(self):
self.testvm1.virt_mode = "hvm"
self.set_hvm(self.testvm1)
self.testvm1.features["audio-model"] = "ich6"
self.prepare_audio_test("pulseaudio")
try:
Expand All @@ -647,7 +647,7 @@ def test_224_audio_rec_muted_hvm(self):
"pulseaudio-utils not installed in dom0",
)
def test_225_audio_rec_unmuted_hvm(self):
self.testvm1.virt_mode = "hvm"
self.set_hvm(self.testvm1)
self.testvm1.features["audio-model"] = "ich6"
self.prepare_audio_test("pulseaudio")
pa_info = self.loop.run_until_complete(
Expand Down Expand Up @@ -683,7 +683,7 @@ def test_225_audio_rec_unmuted_hvm(self):
def test_252_audio_playback_audiovm_switch_hvm(self):
self.create_audio_vm("pulseaudio")
self.testvm1.audiovm = self.audiovm
self.testvm1.virt_mode = "hvm"
self.set_hvm(self.testvm1)
self.testvm1.features["audio-model"] = "ich6"
self.testvm1.features["stubdom-qrexec"] = "1"
self.prepare_audio_test("pulseaudio")
Expand Down
2 changes: 2 additions & 0 deletions qubes/tests/integ/grub.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ def test_000_standalone_vm(self):
"StandaloneVM", name=self.make_vm_name("vm1"), label="red"
)
self.testvm1.virt_mode = self.virt_mode
if self.virt_mode == "hvm":
self.set_hvm(self.testvm1)
self.testvm1.features.update(self.app.domains[self.template].features)
self.testvm1.clone_properties(self.app.domains[self.template])
self.loop.run_until_complete(
Expand Down