Skip to content

Commit

Permalink
tests: improve tests for qrexe exit code handling
Browse files Browse the repository at this point in the history
Check if exit code retrieved from dom0 is really the one expected.

Fix typo in test_065_qrexec_exit_code_vm (testvm1/testvm2), adjust for
reporing remote exit code and remove expectedFailure.

QubesOS/qubes-issues#2861
  • Loading branch information
marmarek committed Jun 21, 2017
1 parent a73dcf6 commit ea0cbe3
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions qubes/tests/integ/vm_qrexec_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,10 +326,10 @@ def test_055_qrexec_dom0_service_abort(self):
def test_060_qrexec_exit_code_dom0(self):
self.loop.run_until_complete(self.testvm1.start())
self.loop.run_until_complete(self.testvm1.run_for_stdio('exit 0'))
with self.assertRaises(subprocess.CalledProcessError):
with self.assertRaises(subprocess.CalledProcessError) as e:
self.loop.run_until_complete(self.testvm1.run_for_stdio('exit 3'))
self.assertEqual(e.exception.returncode, 3)

@unittest.expectedFailure
def test_065_qrexec_exit_code_vm(self):
self.loop.run_until_complete(asyncio.wait([
self.testvm1.start(),
Expand All @@ -340,18 +340,16 @@ def test_065_qrexec_exit_code_vm(self):
'exit 0')
(stdout, stderr) = self.loop.run_until_complete(
self.testvm1.run_for_stdio('''\
/usr/lib/qubes/qrexec-client-vm {} test.Retcode \
/bin/sh -c 'cat >/dev/null';
echo $?'''.format(self.testvm1.name)))
/usr/lib/qubes/qrexec-client-vm {} test.Retcode;
echo $?'''.format(self.testvm2.name)))
self.assertEqual(stdout, b'0\n')

self.create_remote_file(self.testvm2, '/etc/qubes-rpc/test.Retcode',
'exit 3')
(stdout, stderr) = self.loop.run_until_complete(
self.testvm1.run_for_stdio('''\
/usr/lib/qubes/qrexec-client-vm {} test.Retcode \
/bin/sh -c 'cat >/dev/null';
echo $?'''.format(self.testvm1.name)))
/usr/lib/qubes/qrexec-client-vm {} test.Retcode;
echo $?'''.format(self.testvm2.name)))
self.assertEqual(stdout, b'3\n')

def test_070_qrexec_vm_simultaneous_write(self):
Expand Down

0 comments on commit ea0cbe3

Please sign in to comment.