tests: setup qrexec policy instead of clicking in confirmation dialog
xdotool is unreliable so the less of it, the better.
This commit is contained in:
parent
c036a85579
commit
54eee12b51
@ -529,16 +529,14 @@ class TC_00_AppVMMixin(qubes.tests.SystemTestsMixin):
|
|||||||
self.fail("Timeout, probably deadlock")
|
self.fail("Timeout, probably deadlock")
|
||||||
self.assertEqual(result.value, 0, "Service call failed")
|
self.assertEqual(result.value, 0, "Service call failed")
|
||||||
|
|
||||||
@unittest.skipUnless(spawn.find_executable('xdotool'),
|
|
||||||
"xdotool not installed")
|
|
||||||
def test_100_qrexec_filecopy(self):
|
def test_100_qrexec_filecopy(self):
|
||||||
self.testvm1.start()
|
self.testvm1.start()
|
||||||
self.testvm2.start()
|
self.testvm2.start()
|
||||||
|
self.qrexec_policy('qubes.Filecopy', self.testvm1.name,
|
||||||
|
self.testvm2.name)
|
||||||
p = self.testvm1.run("qvm-copy-to-vm %s /etc/passwd" %
|
p = self.testvm1.run("qvm-copy-to-vm %s /etc/passwd" %
|
||||||
self.testvm2.name, passio_popen=True,
|
self.testvm2.name, passio_popen=True,
|
||||||
passio_stderr=True)
|
passio_stderr=True)
|
||||||
# Confirm transfer
|
|
||||||
self.enter_keys_in_window('Question', ['y'])
|
|
||||||
p.wait()
|
p.wait()
|
||||||
self.assertEqual(p.returncode, 0, "qvm-copy-to-vm failed: %s" %
|
self.assertEqual(p.returncode, 0, "qvm-copy-to-vm failed: %s" %
|
||||||
p.stderr.read())
|
p.stderr.read())
|
||||||
@ -548,15 +546,13 @@ class TC_00_AppVMMixin(qubes.tests.SystemTestsMixin):
|
|||||||
wait=True)
|
wait=True)
|
||||||
self.assertEqual(retcode, 0, "file differs")
|
self.assertEqual(retcode, 0, "file differs")
|
||||||
|
|
||||||
@unittest.skipUnless(spawn.find_executable('xdotool'),
|
|
||||||
"xdotool not installed")
|
|
||||||
def test_101_qrexec_filecopy_with_autostart(self):
|
def test_101_qrexec_filecopy_with_autostart(self):
|
||||||
self.testvm1.start()
|
self.testvm1.start()
|
||||||
|
self.qrexec_policy('qubes.Filecopy', self.testvm1.name,
|
||||||
|
self.testvm2.name)
|
||||||
p = self.testvm1.run("qvm-copy-to-vm %s /etc/passwd" %
|
p = self.testvm1.run("qvm-copy-to-vm %s /etc/passwd" %
|
||||||
self.testvm2.name, passio_popen=True,
|
self.testvm2.name, passio_popen=True,
|
||||||
passio_stderr=True)
|
passio_stderr=True)
|
||||||
# Confirm transfer
|
|
||||||
self.enter_keys_in_window('Question', ['y'])
|
|
||||||
p.wait()
|
p.wait()
|
||||||
self.assertEqual(p.returncode, 0, "qvm-copy-to-vm failed: %s" %
|
self.assertEqual(p.returncode, 0, "qvm-copy-to-vm failed: %s" %
|
||||||
p.stderr.read())
|
p.stderr.read())
|
||||||
@ -571,15 +567,13 @@ class TC_00_AppVMMixin(qubes.tests.SystemTestsMixin):
|
|||||||
wait=True)
|
wait=True)
|
||||||
self.assertEqual(retcode, 0, "file differs")
|
self.assertEqual(retcode, 0, "file differs")
|
||||||
|
|
||||||
@unittest.skipUnless(spawn.find_executable('xdotool'),
|
|
||||||
"xdotool not installed")
|
|
||||||
def test_110_qrexec_filecopy_deny(self):
|
def test_110_qrexec_filecopy_deny(self):
|
||||||
self.testvm1.start()
|
self.testvm1.start()
|
||||||
self.testvm2.start()
|
self.testvm2.start()
|
||||||
|
self.qrexec_policy('qubes.Filecopy', self.testvm1.name,
|
||||||
|
self.testvm2.name, allow=False)
|
||||||
p = self.testvm1.run("qvm-copy-to-vm %s /etc/passwd" %
|
p = self.testvm1.run("qvm-copy-to-vm %s /etc/passwd" %
|
||||||
self.testvm2.name, passio_popen=True)
|
self.testvm2.name, passio_popen=True)
|
||||||
# Deny transfer
|
|
||||||
self.enter_keys_in_window('Question', ['n'])
|
|
||||||
p.wait()
|
p.wait()
|
||||||
self.assertNotEqual(p.returncode, 0, "qvm-copy-to-vm unexpectedly "
|
self.assertNotEqual(p.returncode, 0, "qvm-copy-to-vm unexpectedly "
|
||||||
"succeeded")
|
"succeeded")
|
||||||
@ -591,15 +585,13 @@ class TC_00_AppVMMixin(qubes.tests.SystemTestsMixin):
|
|||||||
|
|
||||||
@unittest.skip("Xen gntalloc driver crashes when page is mapped in the "
|
@unittest.skip("Xen gntalloc driver crashes when page is mapped in the "
|
||||||
"same domain")
|
"same domain")
|
||||||
@unittest.skipUnless(spawn.find_executable('xdotool'),
|
|
||||||
"xdotool not installed")
|
|
||||||
def test_120_qrexec_filecopy_self(self):
|
def test_120_qrexec_filecopy_self(self):
|
||||||
self.testvm1.start()
|
self.testvm1.start()
|
||||||
|
self.qrexec_policy('qubes.Filecopy', self.testvm1.name,
|
||||||
|
self.testvm1.name)
|
||||||
p = self.testvm1.run("qvm-copy-to-vm %s /etc/passwd" %
|
p = self.testvm1.run("qvm-copy-to-vm %s /etc/passwd" %
|
||||||
self.testvm1.name, passio_popen=True,
|
self.testvm1.name, passio_popen=True,
|
||||||
passio_stderr=True)
|
passio_stderr=True)
|
||||||
# Confirm transfer
|
|
||||||
self.enter_keys_in_window('Question', ['y'])
|
|
||||||
p.wait()
|
p.wait()
|
||||||
self.assertEqual(p.returncode, 0, "qvm-copy-to-vm failed: %s" %
|
self.assertEqual(p.returncode, 0, "qvm-copy-to-vm failed: %s" %
|
||||||
p.stderr.read())
|
p.stderr.read())
|
||||||
@ -614,6 +606,8 @@ class TC_00_AppVMMixin(qubes.tests.SystemTestsMixin):
|
|||||||
def test_130_qrexec_filemove_disk_full(self):
|
def test_130_qrexec_filemove_disk_full(self):
|
||||||
self.testvm1.start()
|
self.testvm1.start()
|
||||||
self.testvm2.start()
|
self.testvm2.start()
|
||||||
|
self.qrexec_policy('qubes.Filecopy', self.testvm1.name,
|
||||||
|
self.testvm2.name)
|
||||||
# Prepare test file
|
# Prepare test file
|
||||||
prepare_cmd = ("yes teststring | dd of=testfile bs=1M "
|
prepare_cmd = ("yes teststring | dd of=testfile bs=1M "
|
||||||
"count=50 iflag=fullblock")
|
"count=50 iflag=fullblock")
|
||||||
@ -634,8 +628,6 @@ class TC_00_AppVMMixin(qubes.tests.SystemTestsMixin):
|
|||||||
p = self.testvm1.run("qvm-move-to-vm %s testfile" %
|
p = self.testvm1.run("qvm-move-to-vm %s testfile" %
|
||||||
self.testvm2.name, passio_popen=True,
|
self.testvm2.name, passio_popen=True,
|
||||||
passio_stderr=True)
|
passio_stderr=True)
|
||||||
# Confirm transfer
|
|
||||||
self.enter_keys_in_window('Question', ['y'])
|
|
||||||
# Close GUI error message
|
# Close GUI error message
|
||||||
self.enter_keys_in_window('Error', ['Return'])
|
self.enter_keys_in_window('Error', ['Return'])
|
||||||
p.wait()
|
p.wait()
|
||||||
@ -1319,12 +1311,11 @@ class TC_50_MimeHandlers(qubes.tests.SystemTestsMixin):
|
|||||||
passio_popen=True)
|
passio_popen=True)
|
||||||
vmpattern = "disp*"
|
vmpattern = "disp*"
|
||||||
else:
|
else:
|
||||||
|
self.qrexec_policy('qubes.Filecopy', self.source_vm.name,
|
||||||
|
self.target_vmname)
|
||||||
p = self.source_vm.run("qvm-open-in-vm {} {}".format(
|
p = self.source_vm.run("qvm-open-in-vm {} {}".format(
|
||||||
self.target_vmname, filename), passio_popen=True)
|
self.target_vmname, filename), passio_popen=True)
|
||||||
vmpattern = self.target_vmname
|
vmpattern = self.target_vmname
|
||||||
if not dispvm:
|
|
||||||
# For opening a file in DispVM default policy is set to "allow"
|
|
||||||
self.enter_keys_in_window('Question', ['y'])
|
|
||||||
wait_count = 0
|
wait_count = 0
|
||||||
winid = None
|
winid = None
|
||||||
window_title = None
|
window_title = None
|
||||||
|
Loading…
Reference in New Issue
Block a user