From ea0cbe3a56b3a4a6c49e9f782e47e78214a8f04b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Wed, 21 Jun 2017 05:22:39 +0200 Subject: [PATCH] tests: improve tests for qrexe exit code handling 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 --- qubes/tests/integ/vm_qrexec_gui.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/qubes/tests/integ/vm_qrexec_gui.py b/qubes/tests/integ/vm_qrexec_gui.py index 41692b07..f4793459 100644 --- a/qubes/tests/integ/vm_qrexec_gui.py +++ b/qubes/tests/integ/vm_qrexec_gui.py @@ -326,10 +326,10 @@ class TC_00_AppVMMixin(qubes.tests.SystemTestsMixin): 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(), @@ -340,18 +340,16 @@ class TC_00_AppVMMixin(qubes.tests.SystemTestsMixin): '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):