Skip to content

Commit a428713

Browse files
committed
WIP - ignorable test patterns
1 parent 489b026 commit a428713

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

easybuild/easyblocks/l/llvm.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ def extra_options():
212212
'python_bindings': [False, "Install python bindings", CUSTOM],
213213
'skip_all_tests': [False, "Skip running of tests", CUSTOM],
214214
'skip_sanitizer_tests': [True, "Do not run the sanitizer tests", CUSTOM],
215+
'test_suite_ignore_patterns': [None, "List of test to ignore (if the string matches)", CUSTOM],
215216
'test_suite_max_failed': [0, "Maximum number of failing tests (does not count allowed failures)", CUSTOM],
216217
'test_suite_timeout_single': [None, "Timeout for each individual test in the test suite", CUSTOM],
217218
'test_suite_timeout_total': [None, "Timeout for total running time of the testsuite", CUSTOM],
@@ -825,6 +826,17 @@ def _para_test_step(self, parallel=1):
825826
"""Run test suite with the specified number of parallel jobs for make."""
826827
basedir = self.final_dir
827828

829+
# From grep -E "^[A-Z]+: " LOG_FILE | cut -d: -f1 | sort | uniq
830+
OUTCOMES_LOG = [
831+
'FAIL',
832+
'TIMEOUT',
833+
]
834+
# OUTCOMES_OK = [
835+
# 'PASS',
836+
# 'UNSUPPORTED',
837+
# 'XFAIL',
838+
# ]
839+
828840
change_dir(basedir)
829841
lib_path = ''
830842
if self.cfg['build_runtimes']:
@@ -852,6 +864,16 @@ def _para_test_step(self, parallel=1):
852864
setvar('CFLAGS', old_cflags)
853865
setvar('CXXFLAGS', old_cxxflags)
854866

867+
ignore_patterns = self.cfg['test_suite_ignore_patterns'] or []
868+
ignored_pattern = 0
869+
failed_pattern = 0
870+
for line in out.splitlines():
871+
if any(line.startswith(f'{x}: ') for x in OUTCOMES_LOG):
872+
if any(patt in line for patt in ignore_patterns):
873+
self.log.info("Ignoring test failure: %s", line)
874+
ignored_pattern += 1
875+
failed_pattern += 1
876+
855877
rgx_failed = re.compile(r'^ +Failed +: +([0-9]+)', flags=re.MULTILINE)
856878
mch = rgx_failed.search(out)
857879
if mch is None:
@@ -874,6 +896,15 @@ def _para_test_step(self, parallel=1):
874896
self.log.info("Tests timed out: %s", num_timed_out)
875897
num_failed += num_timed_out
876898

899+
if num_failed != failed_pattern:
900+
msg = f"Number of failed tests {num_failed} does not match "
901+
msg += f"number identified from line by line patterns {failed_pattern}"
902+
self.log.warning(msg)
903+
904+
if ignored_pattern:
905+
self.log.info("Ignored %s failed tests due to ignore patterns", ignored_pattern)
906+
num_failed -= ignored_pattern
907+
877908
return num_failed
878909

879910
def test_step(self):

0 commit comments

Comments
 (0)