Skip to content

Commit

Permalink
Separate errors by newline and ident next line
Browse files Browse the repository at this point in the history
  • Loading branch information
Flamefire committed Jan 6, 2020
1 parent 322d512 commit e19374f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions easybuild/tools/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ def parse_cmd_output(cmd, stdouterr, ec, simple, log_all, log_ok, regexp):
if use_regexp or regexp:
res = parse_log_for_error(stdouterr, regexp, msg="Command used: %s" % cmd)
if len(res) > 0:
message = "Found %s errors in command output (output: %s)" % (len(res), ", ".join([r[0] for r in res]))
message = "Found %s errors in command output (output: %s)" % (len(res), "\n\t".join([r[0] for r in res]))
if use_regexp:
raise EasyBuildError(message)
else:
Expand Down Expand Up @@ -643,7 +643,7 @@ def check_log_for_errors(log_txt, reg_exps):
errors_found_in_log += len(warnings) + len(errors)
if warnings:
_log.warning("Found %s potential error(s) in command output (output: %s)",
len(warnings), ", ".join(warnings))
len(warnings), "\n\t".join(warnings))
if errors:
raise EasyBuildError("Found %s error(s) in command output (output: %s)",
len(errors), ", ".join(errors))
len(errors), "\n\t".join(errors))
6 changes: 3 additions & 3 deletions test/framework/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ def test_check_log_for_errors(self):
"enabling -Werror",
"the process crashed with 0"
])
expected_error_msg = r"Found 2 error\(s\) in command output \(output: error found, the process crashed with 0\)"
expected_error_msg = r"Found 2 error\(s\) in command output \(output: error found\n\tthe process crashed with 0\)"

# String promoted to list
self.assertErrorRegex(EasyBuildError, expected_error_msg, check_log_for_errors, input_text,
Expand All @@ -551,13 +551,13 @@ def test_check_log_for_errors(self):
[(r"\b(error|crashed)\b", ERROR)])

expected_error_msg = "Found 2 potential error(s) in command output " \
"(output: error found, the process crashed with 0)"
"(output: error found\n\tthe process crashed with 0)"
init_logging(logfile, silent=True)
check_log_for_errors(input_text, [(r"\b(error|crashed)\b", WARN)])
stop_logging(logfile)
self.assertTrue(expected_error_msg in read_file(logfile))

expected_error_msg = r"Found 2 error\(s\) in command output \(output: error found, test failed\)"
expected_error_msg = r"Found 2 error\(s\) in command output \(output: error found\n\ttest failed\)"
write_file(logfile, '')
init_logging(logfile, silent=True)
self.assertErrorRegex(EasyBuildError, expected_error_msg, check_log_for_errors, input_text, [
Expand Down

0 comments on commit e19374f

Please sign in to comment.