The name of the initial branch for new projects is now "main" instead of "master". Existing projects remain unchanged. More information: https://doku.lrz.de/display/PUBLIC/GitLab

Commit bcf18913 authored by Benedikt Kleinmeier's avatar Benedikt Kleinmeier
Browse files

In "run_vadere_console_with_all_scenario_files.py", set timeout of...

In "run_vadere_console_with_all_scenario_files.py", set timeout of long-running scenarios to 480 seconds and added "TestSFM" to long-running scenarios.
parent 72af1aed
Pipeline #67461 failed with stages
in 49 minutes and 51 seconds
......@@ -15,26 +15,24 @@ import shutil
import subprocess
import time
# exclude output and legacy to make sure that if used locally, .scenario files in these directories are not used
def find_scenario_files(path="VadereModelTests", scenario_search_pattern = "*.scenario", exclude_patterns = ["TESTOVM","output","legacy"]):
def find_scenario_files(path="VadereModelTests", scenario_search_pattern = "*.scenario", exclude_patterns = ["TESTOVM", "output","legacy"]):
scenario_files = []
for root, dirnames, filenames in os.walk(path):
for filename in fnmatch.filter(filenames, scenario_search_pattern):
scenario_path = os.path.join(root, filename)
bool_exclude = False
scenario_path_excluded = False
for exclude_pattern in exclude_patterns:
regex_pattern = re.compile(exclude_pattern)
match = regex_pattern.search(scenario_path)
if match:
bool_exclude = True
scenario_path_excluded = True
if not(bool_exclude):
if scenario_path_excluded == False:
scenario_files.append(scenario_path)
# Surpress this output since only failed scenarios are shown
# print("Total scenario files: {}".format(len(scenario_files)))
print("Total scenario files: {}".format(len(scenario_files)))
# print("Exclude patterns: {}".format(exclude_patterns))
return sorted(scenario_files)
......@@ -52,7 +50,7 @@ def run_scenario_files_with_vadere_console(scenario_files, vadere_console="Vader
for i, scenario_file in enumerate(scenario_files):
try:
# Surpress this output to see the files that failed in the email
# Surpress this output to print only failed scenarios.
# print("Running scenario file ({}/{}): {}".format(i + 1, total_scenario_files, scenario_file))
# Measure wall time and not cpu because it is the easiest.
......@@ -69,7 +67,7 @@ def run_scenario_files_with_vadere_console(scenario_files, vadere_console="Vader
wall_time_end = time.time()
wall_time_delta = wall_time_end - wall_time_start
# Surpress this output to see the files that failed in the email
# Surpress this output to print only failed scenarios.
# print("Finished scenario file ({:.1f} s): {}".format(wall_time_delta, scenario_file))
passed_scenarios.append(scenario_file)
......@@ -78,7 +76,7 @@ def run_scenario_files_with_vadere_console(scenario_files, vadere_console="Vader
if "TestOSM" in scenario_file:
prefix = " * OSM * "
print(prefix +"Scenario file failed: {}".format(scenario_file))
print(prefix + "Scenario file failed: {}".format(scenario_file))
print("-> Reason: timeout after {} s".format(exception.timeout))
failed_scenarios_with_exception.append((scenario_file, exception))
except subprocess.CalledProcessError as exception:
......@@ -96,21 +94,19 @@ def run_scenario_files_with_vadere_console(scenario_files, vadere_console="Vader
return {"passed": passed_scenarios, "failed": failed_scenarios_with_exception}
if __name__ == "__main__":
print("Output is only shown for failed scenarios!")
print(" * Output is only shown for scenarios that fail * ")
passed_and_failed_scenarios = {"passed": [], "failed" : []}
scenarios_long = ["rimea_09", "rimea_11", "queueing"]
scenario_do_not_test = ["TESTOVM","output","legacy"]
scenario_do_not_test.extend(scenarios_long)
long_running_scenarios = ["TestSFM", "rimea_09", "rimea_11", "queueing"]
excluded_scenarios = ["TESTOVM", "output", "legacy"]
excluded_scenarios.extend(long_running_scenarios)
scenario_files_regular_length = find_scenario_files(exclude_patterns=scenario_do_not_test)
scenario_files_regular_length = find_scenario_files(exclude_patterns=excluded_scenarios)
passed_and_failed_scenarios = run_scenario_files_with_vadere_console(scenario_files_regular_length)
for scenario in scenarios_long:
for scenario in long_running_scenarios:
search_pattern = "*" + scenario + "*.scenario"
scenario_files_long = find_scenario_files(scenario_search_pattern=search_pattern)
tmp_passed_and_failed_scenarios = run_scenario_files_with_vadere_console(scenario_files_long, scenario_timeout_in_sec=240)
tmp_passed_and_failed_scenarios = run_scenario_files_with_vadere_console(scenario_files_long, scenario_timeout_in_sec=480)
passed_and_failed_scenarios["passed"].extend(tmp_passed_and_failed_scenarios["passed"])
passed_and_failed_scenarios["failed"].extend(tmp_passed_and_failed_scenarios["failed"])
......
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