From c36f94a15aebb678674a20f85be9b541f68364b8 Mon Sep 17 00:00:00 2001 From: James Prestwood Date: Fri, 3 Jun 2022 10:05:54 -0700 Subject: [PATCH] test-runner: only remove /tmp files if they exist This bit of code was throwing exceptions if a test cleaned up files that test-runner was expecting to clean up. Specifically testHotspot swaps out main.conf and PSK files many times. This led to the exception being thrown, caught, and ignored but further on test-runner would print: "File _X_ not cleaned up!" Now the files will be checked if they exist before trying to remove it. --- tools/run-tests | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/run-tests b/tools/run-tests index 14e1bfd3..2b3b1f2e 100755 --- a/tools/run-tests +++ b/tools/run-tests @@ -863,7 +863,7 @@ def post_test(ctx, to_copy): for f in to_copy: if os.path.isdir('/tmp/' + f): shutil.rmtree('/tmp/' + f) - else: + elif os.path.exists('/tmp/' + f): os.remove('/tmp/' + f) Process(['ip', 'link', 'set', 'lo', 'down']).wait()