commit c36f94a15aebb678674a20f85be9b541f68364b8
parent 0545dbcf24f52eb4d9bfbc11c46dace537025ff1
Author: James Prestwood <prestwoj@gmail.com>
Date: Fri, 3 Jun 2022 10:05:54 -0700
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.
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git 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()