aboutsummaryrefslogtreecommitdiffstats
path: root/.github
diff options
context:
space:
mode:
authornkozlovskiy <nmk@ydb.tech>2023-08-31 17:21:15 +0300
committernkozlovskiy <nmk@ydb.tech>2023-08-31 17:40:56 +0300
commitc4a7009cfefdddcc6860cb09469984246ad39750 (patch)
tree0f22895b1cbc24ea9059be135e51a9b5fd7f33ef /.github
parent294ac8703830421d1e940c702e3a2876471a1a84 (diff)
downloadydb-c4a7009cfefdddcc6860cb09469984246ad39750.tar.gz
ci: check failed ctests shard runs for yunit or gtest logs
Diffstat (limited to '.github')
-rwxr-xr-x.github/scripts/tests/attach-logs.py6
-rwxr-xr-x.github/scripts/tests/ctest-postprocess.py13
-rw-r--r--.github/scripts/tests/log_parser.py4
3 files changed, 18 insertions, 5 deletions
diff --git a/.github/scripts/tests/attach-logs.py b/.github/scripts/tests/attach-logs.py
index 7889464ff3..686af28d64 100755
--- a/.github/scripts/tests/attach-logs.py
+++ b/.github/scripts/tests/attach-logs.py
@@ -7,7 +7,7 @@ import re
from xml.etree import ElementTree as ET
from pathlib import Path
from typing import List
-from log_parser import ctest_log_parser, parse_yunit_fails, parse_gtest_fails, log_reader
+from log_parser import ctest_log_parser, parse_yunit_fails, parse_gtest_fails, log_reader, GTEST_MARK, YUNIT_MARK
from junit_utils import add_junit_log_property, create_error_testcase, create_error_testsuite, suite_case_iterator
from ctest_utils import CTestLog
@@ -58,12 +58,12 @@ def extract_logs(log_fp: io.StringIO, out_path: Path, url_prefix):
first_line = ctest_buf[0]
- if first_line.startswith("[==========]"):
+ if first_line.startswith(GTEST_MARK):
for classname, method, err_lines in parse_gtest_fails(ctest_buf):
fn, path = save_log(err_lines, out_path, classname, method)
log_url = f"{url_prefix}{fn}"
shard.add_testcase(classname, method, path, log_url)
- elif first_line.startswith("<-----"):
+ elif first_line.startswith(YUNIT_MARK):
for classname, method, err_lines in parse_yunit_fails(ctest_buf):
fn, path = save_log(err_lines, out_path, classname, method)
log_url = f"{url_prefix}{fn}"
diff --git a/.github/scripts/tests/ctest-postprocess.py b/.github/scripts/tests/ctest-postprocess.py
index 8d3df91f6c..dafda4d9ba 100755
--- a/.github/scripts/tests/ctest-postprocess.py
+++ b/.github/scripts/tests/ctest-postprocess.py
@@ -4,12 +4,21 @@ import re
from typing import TextIO
import xml.etree.ElementTree as ET
-from log_parser import ctest_log_parser, log_reader
+from log_parser import ctest_log_parser, log_reader, GTEST_MARK, YUNIT_MARK
from mute_utils import mute_target, remove_failure, update_suite_info, MuteTestCheck
def find_targets_to_remove(log_fp):
- return {target for target, reason, _ in ctest_log_parser(log_fp) if reason == "Failed"}
+ target_with_tests = set()
+ for target, reason, buf in ctest_log_parser(log_fp):
+ if reason != "Failed":
+ continue
+
+ for line in buf:
+ if line.startswith((GTEST_MARK, YUNIT_MARK)):
+ target_with_tests.add(target)
+ break
+ return target_with_tests
shard_suffix_re = re.compile(r"_\d+$")
diff --git a/.github/scripts/tests/log_parser.py b/.github/scripts/tests/log_parser.py
index 0e4be2ee2d..2a7f744f93 100644
--- a/.github/scripts/tests/log_parser.py
+++ b/.github/scripts/tests/log_parser.py
@@ -10,6 +10,10 @@ def log_reader(fn, decompress, errors="backslashreplace"):
return open(fn, "rt", errors=errors)
+GTEST_MARK = "[==========]"
+YUNIT_MARK = "<-----"
+
+
def parse_gtest_fails(log):
ilog = iter(log)
while 1: