diff --git a/geos_ats_package/geos_ats/command_line_parsers.py b/geos_ats_package/geos_ats/command_line_parsers.py index 1c3ffc7..2af931d 100644 --- a/geos_ats_package/geos_ats/command_line_parsers.py +++ b/geos_ats_package/geos_ats/command_line_parsers.py @@ -84,6 +84,8 @@ def build_command_line_parser(): parser.add_argument("-l", "--logs", type=str, default=None) + parser.add_argument("-f", "--allow-failed-tests", default=False, action='store_true') + parser.add_argument( "--failIfTestsFail", action="store_true", diff --git a/geos_ats_package/geos_ats/main.py b/geos_ats_package/geos_ats/main.py index 033d0f5..f98c372 100644 --- a/geos_ats_package/geos_ats/main.py +++ b/geos_ats_package/geos_ats/main.py @@ -5,7 +5,7 @@ import subprocess import time import logging -from geos_ats import command_line_parsers +from geos_ats import command_line_parsers, test_builder test_actions = ("run", "rerun", "check", "continue") report_actions = ("run", "rerun", "report", "continue") @@ -369,6 +369,11 @@ def main(): # Run ATS # --------------------------------- result = ats.manager.core() + if len(test_builder.test_build_failures): + tmp = ', '.join(test_builder.test_build_failures) + logger.error(f'The following ATS test failed to build: {tmp}') + if not options.allow_failed_tests: + raise Exception('Some tests failed to build') # Make sure all the testcases requested were found if testcases != "all": diff --git a/geos_ats_package/geos_ats/test_builder.py b/geos_ats_package/geos_ats/test_builder.py index fe2fb45..156a85c 100644 --- a/geos_ats_package/geos_ats/test_builder.py +++ b/geos_ats_package/geos_ats/test_builder.py @@ -7,9 +7,13 @@ from dataclasses import dataclass, asdict from ats.tests import AtsTest from lxml import etree +import logging from .test_steps import geos from .test_case import TestCase +test_build_failures = [] +logger = logging.getLogger('geos_ats') + @dataclass(frozen=True) class RestartcheckParameters: @@ -79,7 +83,7 @@ def collect_block_names(fname): return results -def generate_geos_tests(decks: Iterable[TestDeck]): +def generate_geos_tests(decks: Iterable[TestDeck], test_type='smoke'): """ """ for ii, deck in enumerate(decks): @@ -99,7 +103,18 @@ def generate_geos_tests(decks: Iterable[TestDeck]): testcase_name = "{}_{:02d}".format(deck.name, N) base_name = "0to{:d}".format(deck.check_step) - xml_file = "{}.xml".format(deck.name) + + # Search for the target xml file + xml_file = '' + for suffix in ['', f'_{test_type}']: + if os.path.isfile("{}{}.xml".format(deck.name, suffix)): + xml_file = "{}{}.xml".format(deck.name, suffix) + + if not xml_file: + logger.error(f'Could not find a matching xml file for the test: {deck.name}') + test_build_failures.append(deck.name) + continue + xml_blocks = collect_block_names(xml_file) checks = []