Skip to content

Commit 0915a99

Browse files
committed
Deduplicate warnings&errors found in logs and add initial newline in output
It isn't useful to report duplicate errors multiple times. And e.g. configure may report a wrong option at the start and end. Hence deduplicate it. Also change the logged warning/error to include a newline & tab in front of each element which makes it nicer to read. E.g.: > build failed (first 300 chars): Found 1 error(s) in command output: > configure: WARNING: unrecognized options: --with-foo, --with-bar (took 2 mins 39 secs)
1 parent 2dc4707 commit 0915a99

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

easybuild/tools/run.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
from easybuild.tools.config import ERROR, IGNORE, WARN, build_option
5353
from easybuild.tools.hooks import RUN_SHELL_CMD, load_hooks, run_hook
5454
from easybuild.tools.py2vs3 import string_type
55-
from easybuild.tools.utilities import trace_msg
55+
from easybuild.tools.utilities import nub, trace_msg
5656

5757

5858
_log = fancylogger.getLogger('run', fname=False)
@@ -790,7 +790,7 @@ def extract_errors_from_log(log_txt, reg_exps):
790790
elif action == WARN:
791791
warnings.append(line)
792792
break
793-
return warnings, errors
793+
return nub(warnings), nub(errors)
794794

795795

796796
def check_log_for_errors(log_txt, reg_exps):
@@ -805,8 +805,8 @@ def check_log_for_errors(log_txt, reg_exps):
805805

806806
errors_found_in_log += len(warnings) + len(errors)
807807
if warnings:
808-
_log.warning("Found %s potential error(s) in command output (output: %s)",
808+
_log.warning("Found %s potential error(s) in command output:\n\t%s",
809809
len(warnings), "\n\t".join(warnings))
810810
if errors:
811-
raise EasyBuildError("Found %s error(s) in command output (output: %s)",
811+
raise EasyBuildError("Found %s error(s) in command output:\n\t%s",
812812
len(errors), "\n\t".join(errors))

0 commit comments

Comments
 (0)