Added check for correct building

This commit is contained in:
dario 2024-01-09 00:35:11 +01:00
parent 9dc48e1271
commit 84b7ce4a1a

11
run.py
View File

@ -28,8 +28,17 @@ for case in os.listdir(path):
with open('Tasty/include/sta/tasty/config.hpp', 'w') as f:
f.write(cfg_template.format(number))
print(colored(f'Building case { number }...', 'blue'))
# Build the new project and upload it to the STM32.
subprocess.call(f'Tasty/flash.bat {case}', stdout=sys.stdout)
out = subprocess.run([r'Tasty\flash.bat', case])
# Check if the bash script was successfully executed.
if out.returncode != 0:
print('Building\t' + colored('[FAILED]', 'red'))
continue
else:
print('Building\t' + colored('[PASSED]', 'red'))
print(colored(f'Running case { number }...', 'blue'))