Skip to content

Commit

Permalink
tests: rename "screenshare" to "source"
Browse files Browse the repository at this point in the history
It better matches the function, since "screenshare" service is not used
in the webcam service anymore.
  • Loading branch information
marmarek committed Jul 19, 2024
1 parent e6dd7c7 commit 6f666cc
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions tests/qvctests/integ.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
class TC_00_QVCTest(qubes.tests.extra.ExtraTestCase):
def setUp(self):
super(TC_00_QVCTest, self).setUp()
self.screenshare, self.view = self.create_vms(
["share", "view"])
self.screenshare.start()
if self.screenshare.run('which qubes-video-companion', wait=True) != 0:
self.source, self.view = self.create_vms(
["source", "view"])
self.source.start()
if self.source.run('which qubes-video-companion', wait=True) != 0:
self.skipTest('qubes-video-companion not installed')

def wait_for_video0(self, vm):
Expand Down Expand Up @@ -74,12 +74,12 @@ def compare_images(self, img1, img2):

return sqrt(sum2/len(img1))

def test_010_screenshare(self):
def test_010_source(self):
self.view.start()
self.qrexec_policy('qvc.ScreenShare',
self.view.name,
'@default',
target=self.screenshare.name)
target=self.source.name)
p = self.view.run('qubes-video-companion screenshare',
passio_popen=True, passio_stderr=True)
# wait for device to appear, or a timeout
Expand All @@ -90,11 +90,11 @@ def test_010_screenshare(self):
p.returncode, *p.communicate()))

# capture in source:
source_image = self.capture_from_screen(self.screenshare)
source_image = self.capture_from_screen(self.source)
destination_image = self.capture_from_video(self.view)
diff = self.compare_images(source_image, destination_image)
self.assertLess(diff, 2.0)
self.click_stop(self.screenshare, 'screenshare')
self.click_stop(self.source, 'source')
# wait for device to disappear, or a timeout
self.wait_for_video0_disconnect(self.view)
stdout, stderr = p.communicate()
Expand All @@ -109,23 +109,23 @@ def test_010_screenshare(self):
def test_020_webcam(self):
"""Webcam test
screenshare -> view (webcam)
source -> view (webcam)
"""
# give a bit more memory for webcam, it runs both sender and receiver
self.loop.run_until_complete(self.wait_for_session(self.screenshare))
self.loop.run_until_complete(self.wait_for_session(self.source))
self.view.start()
self.loop.run_until_complete(self.wait_for_session(self.view))
self.qrexec_policy('qvc.Webcam',
self.view.name,
'@default',
target=self.screenshare.name)
self.screenshare.run("modprobe v4l2loopback", user="root", wait=True)
p = self.screenshare.run(
target=self.source.name)
self.source.run("modprobe v4l2loopback", user="root", wait=True)
p = self.source.run(
"gst-launch-1.0 -q testvideosrc pattern=checkers-8"
" ! v4l2sink device=/dev/video0",
passio_popen=True, passio_stderr=True)
# wait for device to appear, or a timeout
self.wait_for_video0(self.screenshare)
self.wait_for_video0(self.source)
self.loop.run_until_complete(asyncio.sleep(3))
if p.returncode is not None:
self.fail("'gst-launch-1.0 testvideosrc' exited early ({}): {} {}".format(
Expand All @@ -138,13 +138,13 @@ def test_020_webcam(self):
self.fail("'qubes-video-companion webcam' exited early ({}): {} {}".format(
p2.returncode, *p2.communicate()))

source_image = self.capture_from_video(self.screenshare)
source_image = self.capture_from_video(self.source)
destination_image = self.capture_from_video(self.view)
diff = self.compare_images(source_image, destination_image)
self.assertLess(diff, 2.5)
self.click_stop(self.screenshare, 'screenshare')
self.click_stop(self.source, 'source')
self.wait_for_video0_disconnect(self.view)
self.screenshare.run("pkill gst-launch-1.0", wait=True)
self.source.run("pkill gst-launch-1.0", wait=True)
stdout, stderr = p2.communicate()
if p2.returncode != 0:
self.fail("'qubes-video-companion webcam' failed ({}): {} {}".format(
Expand Down

0 comments on commit 6f666cc

Please sign in to comment.