test-runner: clear log dir before new log test run

The log dir was never being cleaned out prior to a new logging
test run. This could leave old stale files around. Note that this
will remove any past log files so if you need them, you want to
make a copy before running test-runner with --log again.
This commit is contained in:
James Prestwood 2021-02-18 12:19:28 -08:00 committed by Denis Kenzior
parent a0865c9010
commit c2d71fdaa5
1 changed files with 8 additions and 0 deletions

View File

@ -1249,6 +1249,14 @@ def run_tests():
if args.log:
mount('logdir', args.log, '9p', 0, 'trans=virtio,version=9p2000.L')
# Clear out any log files from other test runs
for f in glob('%s/*' % args.log):
print("removing %s" % f)
if os.path.isdir(f):
shutil.rmtree(f)
else:
os.remove(f)
elif args.monitor:
parent = os.path.abspath(os.path.join(args.monitor, os.pardir))
mount('mondir', parent, '9p', 0, 'trans=virtio,version=9p2000.L')