tests: adjust SystemTestCase.create_remote_file to create executables
The main use case for this function is to create qrexec services in VMs. Since qrexec now require service scripts to be executable, make create_remote_file() adjust permissions.
This commit is contained in:
parent
27e8d9ef4d
commit
3ce4e5eaa5
@ -1260,9 +1260,9 @@ class SystemTestCase(QubesTestCase):
|
||||
file.write(content)
|
||||
self.addCleanup(os.unlink, filename)
|
||||
|
||||
def create_remote_file(self, vm, filename, content):
|
||||
def create_remote_file(self, vm, filename, content, mode=0o755):
|
||||
self.loop.run_until_complete(vm.run_for_stdio(
|
||||
'cat > {}'.format(shlex.quote(filename)),
|
||||
'cat > {0}; chmod {1:o} {0}'.format(shlex.quote(filename), mode),
|
||||
user='root', input=content.encode('utf-8')))
|
||||
|
||||
@asyncio.coroutine
|
||||
|
@ -239,10 +239,9 @@ class TC_00_AppVMMixin(object):
|
||||
self.loop.run_until_complete(asyncio.wait([
|
||||
self.wait_for_session(self.testvm1),
|
||||
self.wait_for_session(self.testvm2)]))
|
||||
self.loop.run_until_complete(self.testvm2.run_for_stdio(
|
||||
'cat > /etc/qubes-rpc/test.EOF',
|
||||
user='root',
|
||||
input=b'/bin/cat'))
|
||||
self.create_remote_file(self.testvm2,
|
||||
'/etc/qubes-rpc/test.EOF',
|
||||
'#!/bin/sh\n/bin/cat\n')
|
||||
|
||||
with self.qrexec_policy('test.EOF', self.testvm1, self.testvm2):
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user