Skip to content

Commit

Permalink
tests: try to collect more logs in audio tests
Browse files Browse the repository at this point in the history
Especially, preserve .xsession-errors and user's journall by getting
them to the console (which is then saved in dom0 in
/var/log/xen/console).
  • Loading branch information
marmarek committed Dec 7, 2024
1 parent 6f20b83 commit dc609ca
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions qubes/tests/integ/audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,19 @@


class TC_00_AudioMixin(TC_00_AppVMMixin):
def start_extra_vm_logging(self, vm):
"""Log user journal and .xsession-errors to the console to be
preserved in logs"""
self.loop.run_until_complete(
vm.run_for_stdio("chmod a+w /dev/console", user="root"))
self.loop.run_until_complete(vm.run(
"systemd-run --no-block sh -c 'tail -F "
"/home/user/.xsession-errors >> /dev/console'",
user='root'))
self.loop.run_until_complete(vm.run(
"systemd-run --user --no-block sh -c "
"'journalctl --user -f >> /dev/console'"))

def wait_for_pulseaudio_startup(self, vm):
self.loop.run_until_complete(self.wait_for_session(self.testvm1))
try:
Expand Down Expand Up @@ -67,6 +80,7 @@ def prepare_audio_test(self, backend):
if "whonix-g" in self.template:
self.skipTest("whonix gateway have no audio")
self.loop.run_until_complete(self.testvm1.start())
self.start_extra_vm_logging(self.testvm1)
pulseaudio_units = "pulseaudio.socket pulseaudio.service"
pipewire_units = "pipewire.socket wireplumber.service pipewire.service"
if backend == "pipewire":
Expand Down Expand Up @@ -646,6 +660,7 @@ def test_228_audio_rec_unmuted_pipewire(self):
)
def test_250_audio_playback_audiovm_pipewire(self):
self.create_audio_vm("pipewire")
self.start_extra_vm_logging(self.audiovm)
self.testvm1.audiovm = self.audiovm
self.prepare_audio_test("pipewire")
self.assert_pacat_running(self.audiovm, self.testvm1, True)
Expand All @@ -663,6 +678,7 @@ def test_251_audio_playback_audiovm_pipewire_late_start(self):
self.testvm1.audiovm = self.audiovm
self.prepare_audio_test("pipewire")
self.loop.run_until_complete(self.audiovm.start())
self.start_extra_vm_logging(self.audiovm)
self.assert_pacat_running(self.audiovm, self.testvm1, True)
self.assert_pacat_running(self.app.domains[0], self.testvm1, False)
self.common_audio_playback()
Expand All @@ -676,6 +692,7 @@ def test_260_audio_mic_enabled_switch_audiovm(self):
self.testvm1.audiovm = self.audiovm
self.prepare_audio_test("pipewire")
self.loop.run_until_complete(self.audiovm.start())
self.start_extra_vm_logging(self.audiovm)

# check mic is enabled in first audiovm
self.assert_pacat_running(self.audiovm, self.testvm1, True)
Expand Down

0 comments on commit dc609ca

Please sign in to comment.