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
This commit is contained in:
Peter Barker 2023-07-06 16:00:47 +10:00 committed by Peter Barker
parent a497c06e83
commit 085a10a3a1

View File

@ -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: