Skip to content

Commit

Permalink
tests: print more details if the main process exit early
Browse files Browse the repository at this point in the history
And collect (and report) stderr too.
  • Loading branch information
marmarek committed Mar 28, 2024
1 parent f7cf09d commit 73f4219
Showing 1 changed file with 33 additions and 8 deletions.
41 changes: 33 additions & 8 deletions tests/qvctests/integ.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def test_010_screenshare(self):
'@default',
target=self.screenshare.name)
p = self.view.run('qubes-video-companion screenshare',
passio_popen=True)
passio_popen=True, passio_stderr=True)
# wait for device to appear, or a timeout
self.wait_for_video0(self.view)
self.loop.run_until_complete(self.wait_for_session(self.view))
Expand All @@ -95,7 +95,14 @@ def test_010_screenshare(self):
self.click_stop(self.screenshare, 'screenshare')
# wait for device to disappear, or a timeout
self.wait_for_video0_disconnect(self.view)
self.assertEqual(p.wait(), 0)
stdout, stderr = p.communicate()
if p.returncode != 0:
self.fail("'qubes-video-companion screenshare' failed ({}): {} {}".format(
p.returncode, stdout, stderr))
else:
# just print
print(stdout)
print(stderr)

def test_020_webcam(self):
"""Two stages test: screen share and then webcam
Expand All @@ -115,15 +122,19 @@ def test_020_webcam(self):
'@default',
target=self.proxy.name)
p = self.proxy.run('qubes-video-companion screenshare',
passio_popen=True)
passio_popen=True, passio_stderr=True)
# wait for device to appear, or a timeout
self.wait_for_video0(self.proxy)
self.loop.run_until_complete(asyncio.sleep(3))
self.assertIsNone(p.returncode)
if p.returncode is not None:
self.fail("'qubes-video-companion screenshare' exited early ({}): {} {}".format(
p.returncode, *p.communicate()))
p2 = self.view.run('qubes-video-companion webcam',
passio_popen=True)
passio_popen=True, passio_stderr=True)
self.wait_for_video0(self.view)
self.assertIsNone(p2.returncode)
if p2.returncode is not None:
self.fail("'qubes-video-companion webcam' exited early ({}): {} {}".format(
p2.returncode, *p2.communicate()))

source_image = self.capture_from_screen(self.screenshare)
destination_image = self.capture_from_video(self.view)
Expand All @@ -132,8 +143,22 @@ def test_020_webcam(self):
self.click_stop(self.proxy, 'webcam')
self.click_stop(self.screenshare, 'screenshare')
self.wait_for_video0_disconnect(self.proxy)
self.assertEqual(p2.wait(), 0)
self.assertEqual(p.wait(), 0)
stdout, stderr = p2.communicate()
if p2.returncode != 0:
self.fail("'qubes-video-companion screenshare' failed ({}): {} {}".format(
p2.returncode, stdout, stderr))
else:
# just print
print(stdout)
print(stderr)
stdout, stderr = p.communicate()
if p.returncode != 0:
self.fail("'qubes-video-companion screenshare' failed ({}): {} {}".format(
p.returncode, stdout, stderr))
else:
# just print
print(stdout)
print(stderr)


def list_tests():
Expand Down

0 comments on commit 73f4219

Please sign in to comment.