Commit 386a87eb authored by Benedikt Kleinmeier's avatar Benedikt Kleinmeier
Browse files

In "run_vadere_console_with_all_scenario_files.py", run ALL scenario files,...

In "run_vadere_console_with_all_scenario_files.py", run ALL scenario files, catch exceptions and log exceptions.

Exit with return code 1 if at least one test failed. Otherwise, return 0.
parent af25b04e
Pipeline #64378 failed with stages
in 44 minutes and 27 seconds
......@@ -44,7 +44,11 @@ def run_scenario_files_with_vadere_console(scenario_files, vadere_console="Vader
total_scenario_files = len(scenario_files)
passed_scenarios = []
failed_scenarios_with_exception = []
for i, scenario_file in enumerate(scenario_files):
try:
print("Running scenario file ({}/{}): {}".format(i + 1, total_scenario_files, scenario_file))
# Measure wall time and not cpu because it is the easiest.
......@@ -62,9 +66,27 @@ def run_scenario_files_with_vadere_console(scenario_files, vadere_console="Vader
print("Finished scenario file ({:.1f} s): {}".format(wall_time_delta, scenario_file))
passed_scenarios.append(scenario_file)
except subprocess.TimeoutExpired as exception:
print("Scenario file failed: {}".format(scenario_file))
print("-> Reason: timeout after {} s ({})".format(exception.timeout, exception.cmd))
failed_scenarios_with_exception.append((scenario_file, exception))
except subprocess.CalledProcessError as exception:
print("Scenario file failed: {}".format(scenario_file))
print("-> Reason: non-zero return value {} ({})".format(exception.returncode, exception.cmd))
failed_scenarios_with_exception.append((scenario_file, exception))
if os.path.exists(output_dir):
shutil.rmtree(output_dir)
return {"passed": passed_scenarios, "failed": failed_scenarios_with_exception}
if __name__ == "__main__":
scenario_files = find_scenario_files()
run_scenario_files_with_vadere_console(scenario_files)
passed_and_failed_scenarios = run_scenario_files_with_vadere_console(scenario_files)
if len(passed_and_failed_scenarios["failed"]) > 0:
exit(1)
else:
exit(0)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment