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#9090.  The test for
socket services will be added along with the fix, as without the fix it
hangs.
  • Loading branch information
DemiMarie committed Apr 7, 2024
1 parent c0e7f6a commit b16e0a5
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions qrexec/tests/socket/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import struct
import getpass
import itertools
import asyncio

import psutil
import pytest
Expand Down Expand Up @@ -584,6 +585,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 "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 b16e0a5

Please sign in to comment.