Skip to content

Commit cde8ac9

Browse files
committed
Normalize iwyu return code when filtering implementation header suggestions
When iwyu output is filtered because it only suggests implementation headers, also normalize exit code 1 to 0 if expected output is empty.
1 parent dc8ebc8 commit cde8ac9

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

tests/test_hooks.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,11 @@ def run_shell_cmd(cmd_name, files, args, _, target_output, target_retcode):
572572
# If all "add" suggestions are for implementation headers, filter entire output
573573
if add_section_headers and all(b"<__" in h for h in add_section_headers):
574574
actual = b""
575+
# Normalize return code since we filtered the suggestions
576+
if sp_child.returncode == 1 and target_output.strip() == b"":
577+
sp_child = sp.CompletedProcess(
578+
sp_child.args, 0, sp_child.stdout, sp_child.stderr
579+
)
575580
retcode = sp_child.returncode
576581
utils.assert_equal(target_output, actual)
577582
assert target_retcode == retcode

0 commit comments

Comments
 (0)