mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-13 05:28:49 +00:00
Upgrade littlecheck to print all error lines
In #7459, asan printed error output. However, because we had a failure on stdout already, littlecheck would only print the first unmatched line from stderr, leading to output like ``` additional output on stderr:1: ================================================================= ``` Which is of course entirely useless. So in that case we just let it print *all* unmatched stderr lines, so you'd get the full asan output, which presumably is of more use. This upgrades littlecheck to 5f7deafcea4e58dd3d369eae069a3781bb6ce75e.
This commit is contained in:
parent
3e3a42c127
commit
64b5a22274
1 changed files with 21 additions and 17 deletions
|
@ -156,7 +156,7 @@ class TestFailure(object):
|
|||
self.line = line
|
||||
self.check = check
|
||||
self.testrun = testrun
|
||||
self.error_annotation_line = None
|
||||
self.error_annotation_lines = None
|
||||
# The output that comes *after* the failure.
|
||||
self.after = after
|
||||
self.before = before
|
||||
|
@ -209,28 +209,29 @@ class TestFailure(object):
|
|||
" {BOLD}{output_line}{RESET}",
|
||||
"",
|
||||
]
|
||||
if self.error_annotation_line:
|
||||
fields["error_annotation"] = self.error_annotation_line.text
|
||||
fields["error_annotation_lineno"] = self.error_annotation_line.number
|
||||
if self.error_annotation_lines:
|
||||
fields["error_annotation"] = " ".join([x.text for x in self.error_annotation_lines])
|
||||
fields["error_annotation_lineno"] = str(self.error_annotation_lines[0].number)
|
||||
if len(self.error_annotation_lines) > 1:
|
||||
fields["error_annotation_lineno"] += ":" + str(self.error_annotation_lines[-1].number)
|
||||
fmtstrs += [
|
||||
" additional output on stderr:{error_annotation_lineno}:",
|
||||
" {BOLD}{error_annotation}{RESET}",
|
||||
]
|
||||
if self.before:
|
||||
fields["before_output"] = " ".join(self.before)
|
||||
fields["additional_output"] = " ".join(self.after[:afterlines])
|
||||
if self.before or self.after:
|
||||
fmtstrs += [" Context:"]
|
||||
|
||||
if self.before:
|
||||
fields["before_output"] = " ".join(self.before)[:-1]
|
||||
fmtstrs += [" {BOLD}{before_output}"]
|
||||
|
||||
fmtstrs += [
|
||||
" Context:",
|
||||
" {BOLD}{before_output} {RED}{output_line}{RESET} <= does not match '{LIGHTBLUE}{input_line}{RESET}'",
|
||||
" {BOLD}{additional_output}{RESET}",
|
||||
]
|
||||
elif self.after:
|
||||
fields["additional_output"] = " ".join(self.after[:afterlines])
|
||||
fmtstrs += [
|
||||
" Context:",
|
||||
" {RED}{output_line}{RESET} <= does not match '{LIGHTBLUE}{input_line}{RESET}'",
|
||||
" {BOLD}{additional_output}{RESET}"
|
||||
]
|
||||
|
||||
if self.after is not None:
|
||||
fields["additional_output"] = " ".join(self.after[:afterlines])
|
||||
fmtstrs += [" {BOLD}{additional_output}{RESET}"]
|
||||
fmtstrs += [" when running command:", " {subbed_command}"]
|
||||
return "\n".join(fmtstrs).format(**fields)
|
||||
|
||||
|
@ -358,7 +359,10 @@ class TestRun(object):
|
|||
# non-matching or unmatched stderr text, then annotate the outfail
|
||||
# with it.
|
||||
if outfail and errfail and errfail.line:
|
||||
outfail.error_annotation_line = errfail.line
|
||||
outfail.error_annotation_lines = errlines[errfail.line.number - 1:]
|
||||
# Trim a trailing newline
|
||||
if outfail.error_annotation_lines[-1].text == "\n":
|
||||
del outfail.error_annotation_lines[-1]
|
||||
return outfail if outfail else errfail
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue