Skip to content

Commit

Permalink
Add test for missing service arguments
Browse files Browse the repository at this point in the history
The test currently fails due to QubesOS/qubes-issues#9089.
  • Loading branch information
DemiMarie committed Apr 5, 2024
1 parent afd258c commit 074a692
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions qrexec/tests/socket/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ def setUp(self):

def start_agent(self):
env = os.environ.copy()
try:
del os.environ["QREXEC_SERVICE_ARGUMENT"]
except KeyError:
pass
env["LD_LIBRARY_PATH"] = os.path.join(ROOT_PATH, "libqrexec")
env["VCHAN_DOMAIN"] = str(self.domain)
env["VCHAN_SOCKET_DIR"] = self.tempdir
Expand Down Expand Up @@ -579,6 +583,38 @@ def test_exec_broken_specific_service(self):
)
self.check_dom0(dom0)

@unittest.expectedFailure
def test_exec_null_argument_finds_service_for_empty_argument(self):
self.make_executable_service(
"local-rpc",
"qubes.Service+",
"""\
#!/bin/sh --
echo "${QREXEC_SERVICE_ARGUMENT+specific} service: $QREXEC_SERVICE_FULL_NAME"
""",
)
self.make_executable_service(
"rpc",
"qubes.Service",
"""\
#!/bin/sh
echo "general service"
""",
)
target, dom0 = self.execute_qubesrpc("qubes.Service", "domX")
target.send_message(qrexec.MSG_DATA_STDIN, b"")
messages = target.recv_all_messages()
self.assertListEqual(
util.sort_messages(messages),
[
(qrexec.MSG_DATA_STDOUT, b"specific service: qubes.Service+\n"),
(qrexec.MSG_DATA_STDOUT, b""),
(qrexec.MSG_DATA_STDERR, b""),
(qrexec.MSG_DATA_EXIT_CODE, b"\0\0\0\0"),
],
)
self.check_dom0(dom0)

def test_connect_socket_no_metadata(self):
socket_path = os.path.join(
self.tempdir, "rpc", "qubes.SocketService+arg2"
Expand Down

0 comments on commit 074a692

Please sign in to comment.