From c2d71fdaa531cbbb4a4266a7f560e2720061d461 Mon Sep 17 00:00:00 2001 From: James Prestwood Date: Thu, 18 Feb 2021 12:19:28 -0800 Subject: [PATCH] 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. --- tools/test-runner | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/test-runner b/tools/test-runner index 70694e47..a390014b 100755 --- a/tools/test-runner +++ b/tools/test-runner @@ -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')