From 381cc7c6cfb42a5295b6bd2da7bfe2e9e2245625 Mon Sep 17 00:00:00 2001
From: Timo Wilken
Date: Wed, 16 Mar 2022 13:29:41 +0100
Subject: [PATCH] Deduplicate warning messages
For compiler warnings, we don't need the context lines, and compiler warning
messages might be repeated many times, so filter out duplicates.
---
report-pr-errors | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
diff --git a/report-pr-errors b/report-pr-errors
index e513c310..59c16630 100755
--- a/report-pr-errors
+++ b/report-pr-errors
@@ -35,8 +35,9 @@ ERRORS_RE = re.compile(
' !!! \x1b\\[[0-9;]+mError - |'
r'ninja: build stopped: |make.*: \*\*\*|\[(ERROR|FATAL)\]')
WARNINGS_RE = re.compile(
- ': warning:|^Warning: (?!Unused direct dependencies:$)|'
+ '^Warning: (?!Unused direct dependencies:$)|'
' ! \x1b\\[[0-9;]+mWarning - ')
+COMPILER_WARNINGS_RE = re.compile(': warning:')
FAILED_UNIT_TEST_RE = re.compile(
r'Test *#[0-9]*: .*\*\*\*(Failed|Timeout|Exception)|% tests passed')
KILLED_RE = re.compile(r'fatal error: Killed signal terminated program')
@@ -288,6 +289,11 @@ class Logs(object):
ERRORS_RE, ignore_log_files=['*/o2checkcode-latest*/log'])
self.warnings_log = self.grep_logs(
WARNINGS_RE, main_packages_only=True)
+ # Filter out duplicate warnings, as e.g. warnings in headers might be
+ # repeated many times.
+ self.compiler_warnings_log = '\n'.join(sorted(set(self.grep_logs(
+ COMPILER_WARNINGS_RE, main_packages_only=True,
+ context_before=0, context_after=0).split('\n'))))
self.o2checkcode_messages = self.grep_logs(
O2CHECKCODE_RE, context_before=0, context_after=float('inf'))
self.failed_unit_tests = self.grep_logs(
@@ -327,6 +333,8 @@ class Logs(object):
'err_display': display(self.errors_log),
'warnings': htmlescape(self.warnings_log),
'warn_display': display(self.warnings_log),
+ 'compiler_warnings': htmlescape(self.compiler_warnings_log),
+ 'cmpwarn_display': display(self.compiler_warnings_log),
'cmake': htmlescape(self.cmake_errors),
'cmake_display': display(self.cmake_errors),
'killed_display': display(self.compiler_killed),
@@ -545,6 +553,7 @@ PRETTY_LOG_TEMPLATE = '''\
#tests, #tests-toc { display: %(unit_display)s; }
#errors, #errors-toc { display: %(err_display)s; }
#warnings, #warnings-toc { display: %(warn_display)s; }
+ #compiler-warnings, #compiler-warnings-toc { display: %(cmpwarn_display)s; }
#cmake, #cmake-toc { display: %(cmake_display)s; }
#fullsystest, #fullsystest-toc { display: %(fst_display)s; }
@@ -575,7 +584,8 @@ PRETTY_LOG_TEMPLATE = '''\
Unit test results
O2 full system test
Error messages
- Compiler warnings
+ CMake and other warnings
+ Compiler warnings
No errors found
@@ -610,10 +620,15 @@ PRETTY_LOG_TEMPLATE = '''\
%(errors)s
- Compiler warnings
+ CMake and other warnings
Note that the following list may include false positives! Check the sections above first.
%(warnings)s
+
+ Compiler warnings
+ Note that the following list may include false positives! Check the sections above first.
+ %(compiler_warnings)s
+