diff --git a/.github/workflows/check_compilable_percentage.yml b/.github/workflows/check_compilable_percentage.yml index 001205e2c..5228c52eb 100644 --- a/.github/workflows/check_compilable_percentage.yml +++ b/.github/workflows/check_compilable_percentage.yml @@ -98,19 +98,22 @@ jobs: $(pwd)/CI_repository_list.csv \ $(pwd)/ASHE/CI_REPO_CLONE_SPACE \ $(pwd)/ASHE/src/main/resources/config.properties + - name: De-Interleave Multithreaded Log + run: | + python3 ashe_scripts/de-interleave-ashe-log.py ASHE/logs/app.log - name: Translate results run: | - python3 ashe_scripts/specimin_get_run_results.py ASHE/logs/app.log - cat ASHE/logs/app.log + python3 ashe_scripts/specimin_get_run_results.py ASHE/logs/deinterleaved-log.txt + cat ASHE/logs/deinterleaved-log.log - name: Show only successful minimizations run: | - grep 'full_success' ASHE/logs/specimin_run_results.txt + grep 'full_success' ASHE/logs/specimin_run_results.txt | sort - name: Show only failed minimizations run: | - grep 'failed_minimization' ASHE/logs/specimin_run_results.txt + grep 'failed_minimization' ASHE/logs/specimin_run_results.txt | sort - name: Show only failed compilations run: | - grep 'failed_compilation' ASHE/logs/specimin_run_results.txt + grep 'failed_compilation' ASHE/logs/specimin_run_results.txt | sort - name: Parse accuracy percentage id: parse_accuracy_percentage run: | diff --git a/ashe_scripts/de-interleave-ashe-log.py b/ashe_scripts/de-interleave-ashe-log.py new file mode 100755 index 000000000..4433dcb53 --- /dev/null +++ b/ashe_scripts/de-interleave-ashe-log.py @@ -0,0 +1,41 @@ +#!/sbin/python +from collections import defaultdict +import re +import os +import sys + +def deinterleave(file_path: str): + thread_logs = defaultdict(list) + + with open(file_path, "r") as infile: + for line in infile: + #log format is like this: + #13:40:26.262 [ForkJoinPool-1-worker-9] + #\[ForkJoinPool-1-worker-\([0-9]\+\)] + pattern = re.compile(r"\[ForkJoinPool-1-worker-([0-9]+)]") + #pattern = re.compile(r"ForkJoinPool") + with open(file_path, "r") as infile: + for line in infile: + match = pattern.search(line) + if match: + thread = match.group(1) + thread_logs[thread].append(line.strip()) + break + + with open(output_file, "w") as outfile: + for thread_id, messages in thread_logs.items(): + outfile.write(f"Logs for {thread_id}:\n") + for message in messages: + outfile.write(f"{thread_id}: {message}\n") + outfile.write("\n") + + +if __name__ == '__main__': + if len(sys.argv) < 2: + print("Usage: python3 specimin_repo_specifics.py ") + sys.exit(1) + log_file_path = sys.argv[1] + directory: str = os.path.dirname(log_file_path) + output_file = os.path.join(directory, 'deinterleaved-log.txt') + deinterleave(log_file_path) + print(f"De-interleaved log written to: {output_file}")