test-runner: require root user to run with --monitor

Since the monitor file requires touching the host file
system, root access is required.
This commit is contained in:
James Prestwood 2021-02-18 12:19:29 -08:00 committed by Denis Kenzior
parent c2d71fdaa5
commit 272a60a478
1 changed files with 4 additions and 0 deletions

View File

@ -1434,6 +1434,10 @@ class Main:
options += ' --log-uid %u' % uid
if self.args.monitor:
if os.environ.get('SUDO_GID', None) is None:
print("--monitor can only be used as root user")
quit()
self.args.monitor = os.path.abspath(self.args.monitor)
mon_parent_dir = os.path.abspath(os.path.join(self.args.monitor, os.pardir))