3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-21 22:09:23 +01:00

test-runner: disallow result/monitor/log directly under /tmp

Inside the virtual environments /tmp is mounted as its own FS and not
taken from the host. This poses issues if any output files are directly
under /tmp since test-runner tries to mount the parent directory (/tmp).
The can be fixed by ensuring these output files are either not under
/tmp or at least one folder down the tree (e.g. /tmp/outputs/outfile.txt).

Now this requirement is enforced and test-runner will not start if any
output files parent directory is /tmp.
This commit is contained in:
James Prestwood 2022-05-25 12:37:26 -07:00 committed by Denis Kenzior
parent 78c918c2c1
commit 1e6773d2a7

View File

@ -311,6 +311,9 @@ class RunnerAbstract:
gid = int(os.environ.get('SUDO_GID', os.getgid()))
if self.args.log:
if self.args.log == '/tmp':
raise Exception('Log directly cannot be /tmp')
append_gid_uid = True
if not os.path.exists(self.args.log):
@ -324,12 +327,16 @@ class RunnerAbstract:
self.args.monitor_parent = os.path.abspath(
os.path.join(self.args.monitor, os.pardir))
if self.args.monitor_parent == '/tmp':
raise Exception('--monitor cannot be directly under /tmp')
if self.args.result:
append_gid_uid = True
self.args.result_parent = os.path.abspath(
os.path.join(self.args.result, os.pardir))
if self.args.result_parent == '/tmp':
raise Exception('--result cannot be directly under /tmp')
if append_gid_uid:
self.args.SUDO_UID = uid