Merge pull request #69204 from ClickHouse/vdimir/cleint-log-sanitizer-reports

Collect sanitizer report from client to `client_log`
This commit is contained in:
Nikita Mikhaylov 2024-09-04 10:44:40 +00:00 committed by GitHub
commit 6fbeca5cb8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1637,6 +1637,19 @@ class TestCase:
if args.client_log:
log_opt = " --client_logs_file=" + args.client_log + " "
client_options += log_opt
for env_name in [
"TSAN_OPTIONS",
"ASAN_OPTIONS",
"MSAN_OPTIONS",
"UBSAN_OPTIONS",
]:
current_options = os.environ.get(env_name, None)
if current_options is None:
os.environ[env_name] = f"log_path={args.client_log}"
elif "log_path=" not in current_options:
os.environ[env_name] += f":log_path={args.client_log}"
os.environ["CLICKHOUSE_CLIENT_OPT"] = (
os.environ["CLICKHOUSE_CLIENT_OPT"]
if "CLICKHOUSE_CLIENT_OPT" in os.environ
@ -3108,13 +3121,15 @@ def main(args):
print(colored("\nNo queries hung.", args, "green", attrs=["bold"]))
if args.client_log:
if os.path.exists(args.client_log):
with open(args.client_log, "rb") as stream:
for log_file in [args.client_log, *glob.glob(f"{args.client_log}.*")]:
if not os.path.exists(log_file):
continue
with open(log_file, "rb") as stream:
content = stream.read().decode()
if len(content):
print("Has fatal logs from client:\n")
print(f"Has fatal logs from client in '{log_file}':\n")
print(content)
os.remove(args.client_log)
os.remove(log_file)
if len(restarted_tests) > 0:
print("\nSome tests were restarted:\n")