Loading ci/collect_artifacts.py 0 → 100644 +66 −0 Original line number Diff line number Diff line import pathlib import argparse import re TEST_TYPES = ["sanitizers"] def main(args): test = args.test file = args.console_out_file if test == "sanitizers": collect_for_sanitizer_test(file) def collect_for_sanitizer_test(file): with open(file) as f: console_log = f.readlines() files_to_archive = list() pattern_line = "(Encoding|Decoding) failed .*for \/.*(CLANG.|VALGRIND)\/(.*)" pattern_file = "(.*_b[1-9]*_.*_rs|.*_b[1-9]*_.*_cbr).*" for line in console_log: m_line = re.match(pattern_line, line) if m_line is not None: _, test, filename = m_line.groups() filename = pathlib.Path(filename).name m_file = re.match(pattern_file, filename) filename_start = m_file.groups() files = [ f for f in pathlib.Path(f"{test}/logs/").iterdir() if f.name.startswith(filename_start) ] files_to_archive.extend(files) log_folder = pathlib.Path("./LOGS") log_folder.mkdir() for p in files_to_archive: source = pathlib.Path(p) target = log_folder.joinpath(source.name) source.rename(target) if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument( "test", type=str, choices=TEST_TYPES, help="for which test should artifacts be collected?", ) parser.add_argument( "console_out_file", type=str, help="file with stdout from IvasBuildAndRunChecks.py", ) args = parser.parse_args() main(args) Loading
ci/collect_artifacts.py 0 → 100644 +66 −0 Original line number Diff line number Diff line import pathlib import argparse import re TEST_TYPES = ["sanitizers"] def main(args): test = args.test file = args.console_out_file if test == "sanitizers": collect_for_sanitizer_test(file) def collect_for_sanitizer_test(file): with open(file) as f: console_log = f.readlines() files_to_archive = list() pattern_line = "(Encoding|Decoding) failed .*for \/.*(CLANG.|VALGRIND)\/(.*)" pattern_file = "(.*_b[1-9]*_.*_rs|.*_b[1-9]*_.*_cbr).*" for line in console_log: m_line = re.match(pattern_line, line) if m_line is not None: _, test, filename = m_line.groups() filename = pathlib.Path(filename).name m_file = re.match(pattern_file, filename) filename_start = m_file.groups() files = [ f for f in pathlib.Path(f"{test}/logs/").iterdir() if f.name.startswith(filename_start) ] files_to_archive.extend(files) log_folder = pathlib.Path("./LOGS") log_folder.mkdir() for p in files_to_archive: source = pathlib.Path(p) target = log_folder.joinpath(source.name) source.rename(target) if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument( "test", type=str, choices=TEST_TYPES, help="for which test should artifacts be collected?", ) parser.add_argument( "console_out_file", type=str, help="file with stdout from IvasBuildAndRunChecks.py", ) args = parser.parse_args() main(args)