diff mbox series

[v3,1/3] t0021: avoid grepping for a Perl-specific string at filter output

Message ID 5ec95c7e696a49104322d243bee1d5f137bc8222.1659291025.git.matheus.bernardino@usp.br (mailing list archive)
State Superseded
Headers show
Series t0021: convert perl script to C test-tool helper | expand

Commit Message

Matheus Tavares July 31, 2022, 6:19 p.m. UTC
This test sets the t0021/rot13-filter.pl script as a long-running
process filter for a git checkout command. It then expects the filter to
fail producing a specific error message at stderr. In the following
commits we are going to replace the script with a C test-tool helper,
but the test currently expects the error message in a Perl-specific
format. That is, when you call `die <msg>` in Perl, it emits
"<msg> at - line 1." In preparation for the conversion, let's avoid the
Perl-specific part and only grep for <msg> itself.

Signed-off-by: Matheus Tavares <matheus.bernardino@usp.br>
---
 t/t0021-conversion.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Junio C Hamano Aug. 1, 2022, 8:41 p.m. UTC | #1
Matheus Tavares <matheus.bernardino@usp.br> writes:

> This test sets the t0021/rot13-filter.pl script as a long-running
> process filter for a git checkout command. It then expects the filter to
> fail producing a specific error message at stderr. In the following
> commits we are going to replace the script with a C test-tool helper,
> but the test currently expects the error message in a Perl-specific
> format. That is, when you call `die <msg>` in Perl, it emits
> "<msg> at - line 1." In preparation for the conversion, let's avoid the
> Perl-specific part and only grep for <msg> itself.

Sounds sane.  I am a bit surprised that we check for messages from
the external filter tool, actually, rather than messages we would
emit in response to an error by the filter tool, which ought to be
more stable no matter how the external tool expresses its failures.

But the posted change gets the job done perfectly fine, so it is OK.

Thanks.

> Signed-off-by: Matheus Tavares <matheus.bernardino@usp.br>
> ---
>  t/t0021-conversion.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/t/t0021-conversion.sh b/t/t0021-conversion.sh
> index 1c840348bd..963b66e08c 100755
> --- a/t/t0021-conversion.sh
> +++ b/t/t0021-conversion.sh
> @@ -735,7 +735,7 @@ test_expect_success PERL 'process filter should restart after unexpected write f
>  		rm -f debug.log &&
>  		git checkout --quiet --no-progress . 2>git-stderr.log &&
>  
> -		grep "smudge write error at" git-stderr.log &&
> +		grep "smudge write error" git-stderr.log &&
>  		test_i18ngrep "error: external filter" git-stderr.log &&
>  
>  		cat >expected.log <<-EOF &&
diff mbox series

Patch

diff --git a/t/t0021-conversion.sh b/t/t0021-conversion.sh
index 1c840348bd..963b66e08c 100755
--- a/t/t0021-conversion.sh
+++ b/t/t0021-conversion.sh
@@ -735,7 +735,7 @@  test_expect_success PERL 'process filter should restart after unexpected write f
 		rm -f debug.log &&
 		git checkout --quiet --no-progress . 2>git-stderr.log &&
 
-		grep "smudge write error at" git-stderr.log &&
+		grep "smudge write error" git-stderr.log &&
 		test_i18ngrep "error: external filter" git-stderr.log &&
 
 		cat >expected.log <<-EOF &&