From 085a10a3a15d323bf0aa891abd73e7ff3bb6dba4 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Thu, 6 Jul 2023 16:00:47 +1000 Subject: [PATCH] autotest: remove binary before attempting to build it this fixes behaviour when --no-configure and --no-build are passed in, causing subsequent test steps to fail rather than proceed with an old binary --- Tools/autotest/autotest.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Tools/autotest/autotest.py b/Tools/autotest/autotest.py index 977154d99d..9716cc077d 100755 --- a/Tools/autotest/autotest.py +++ b/Tools/autotest/autotest.py @@ -485,6 +485,11 @@ def run_step(step): return util.build_replay(board='SITL') if vehicle_binary is not None: + try: + binary = binary_path(step, debug=opts.debug) + os.unlink(binary) + except (FileNotFoundError, ValueError): + pass if len(vehicle_binary.split(".")) == 1: return util.build_SITL(vehicle_binary, **build_opts) else: