Message ID | 20250205142817.42117-1-ayu.chandekar@gmail.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [GSOC,v2] t6422: avoid suppressing Git’s exit code in tests | expand |
Ayush Chandekar <ayu.chandekar@gmail.com> writes: Thanks for practicing yet another iteration. I am not going to actually replace the previous one with this one, as the previous one is just OK, but let's pretend I would to complete the "simulated" iteration. Below, pretend that we will discard the previous one and replace it with this one, and plan to merge the result to 'next', but that is only for practice. --- > Subject: Re: [GSOC][PATCH v2] t6422: avoid suppressing Git’s exit code in tests This is about 6423 ;-) I'll amend while applying the patch. > Some test in t6423 supress Git's exit code, which can cause test > failures go unnoticed. Specifically using git <subcommand> | > <other-command> masks potential failures of the Git command. > > Instead of executing a Git command as the upstream component of > a pipe, which can result in the exit status being lost, redirect > its output to a file and then process that file in two steps to > ensure the exit status is properly preserved. > > Signed-off-by: Ayush Chandekar <ayu.chandekar@gmail.com> > --- > t/t6423-merge-rename-directories.sh | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) OK. And the change to the test body to lose input redirection into "uniq" look OK, too. Thanks. Let's replace it and mark the topic for 'next'.
Thanks, Junio! Appreciate the clarification about the test script number. I’ll be more careful next time. Thanks for the review! Regards, Ayush
diff --git a/t/t6423-merge-rename-directories.sh b/t/t6423-merge-rename-directories.sh index 88d1cf2cde..a6c5b5a494 100755 --- a/t/t6423-merge-rename-directories.sh +++ b/t/t6423-merge-rename-directories.sh @@ -5071,7 +5071,8 @@ test_expect_success '12i: Directory rename causes rename-to-self' ' test_path_is_file source/bar && test_path_is_file source/baz && - git ls-files | uniq >tracked && + git ls-files >actual && + uniq actual >tracked && test_line_count = 3 tracked && git status --porcelain -uno >actual && @@ -5129,7 +5130,8 @@ test_expect_success '12j: Directory rename to root causes rename-to-self' ' test_path_is_file bar && test_path_is_file baz && - git ls-files | uniq >tracked && + git ls-files >actual && + uniq actual >tracked && test_line_count = 3 tracked && git status --porcelain -uno >actual && @@ -5187,7 +5189,8 @@ test_expect_success '12k: Directory rename with sibling causes rename-to-self' ' test_path_is_file dirA/bar && test_path_is_file dirA/baz && - git ls-files | uniq >tracked && + git ls-files >actual && + uniq actual >tracked && test_line_count = 3 tracked && git status --porcelain -uno >actual &&
Some test in t6423 supress Git's exit code, which can cause test failures go unnoticed. Specifically using git <subcommand> | <other-command> masks potential failures of the Git command. Instead of executing a Git command as the upstream component of a pipe, which can result in the exit status being lost, redirect its output to a file and then process that file in two steps to ensure the exit status is properly preserved. Signed-off-by: Ayush Chandekar <ayu.chandekar@gmail.com> --- t/t6423-merge-rename-directories.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)