Skip to content

Commit

Permalink
Merge branch 'devel20220418'
Browse files Browse the repository at this point in the history
* devel20220418:
  tests: give zenity a bit more time to start
  Ensure device options are serialized to str in XML
  tests/extra: support qrexec target redirection for tests
  • Loading branch information
marmarek committed Apr 21, 2022
2 parents 23f6bcd + e5852f3 commit 0e7fc1f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
12 changes: 9 additions & 3 deletions qubes/tests/extra.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,20 +179,26 @@ def enable_network(self):
"""
self.init_networking()

def qrexec_policy(self, service, source, destination, allow=True):
def qrexec_policy(self, service, source, destination, allow=True,
target=None):
"""
Allow qrexec calls for duration of the test
:param service: service name
:param source: source VM name
:param destination: destination VM name
:param allow: whether allow the call
:param target: redirect call to this target
:return:
"""

def add_remove_rule(add=True):
with open('/etc/qubes-rpc/policy/{}'.format(service), 'r+') as policy:
policy_rules = policy.readlines()
rule = "{} {} {}\n".format(source, destination,
'allow' if allow else 'deny')
rule = "{} {} {}{}\n".format(
source, destination,
'allow' if allow else 'deny',
' target={}'.format(target) if target else ''
)
if add:
policy_rules.insert(0, rule)
else:
Expand Down
2 changes: 1 addition & 1 deletion qubes/tests/integ/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ def test_000_clipboard(self):
'zenity --text-info --editable --title={}'.format(window_title)))

self.wait_for_window(window_title)
time.sleep(0.5)
time.sleep(1.5)
test_string = "test{}".format(testvm1.xid)

# Type and copy some text
Expand Down
2 changes: 1 addition & 1 deletion qubes/vm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ def load_extras(self):
for node in parent.xpath('./device'):
options = {}
for option in node.xpath('./option'):
options[option.get('name')] = option.text
options[option.get('name')] = str(option.text)

try:
device_assignment = qubes.devices.DeviceAssignment(
Expand Down

0 comments on commit 0e7fc1f

Please sign in to comment.