All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Lars Schneider <larsxschneider@gmail.com>
Cc: git@vger.kernel.org, peff@peff.net, tboegi@web.de, e@80x24.org,
	ttaylorr@github.com, peartben@gmail.com
Subject: Re: [PATCH v6 2/6] t0021: make debug log file name configurable
Date: Sun, 25 Jun 2017 15:15:32 -0700	[thread overview]
Message-ID: <xmqqpodr7lyz.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20170625182125.6741-3-larsxschneider@gmail.com> (Lars Schneider's message of "Sun, 25 Jun 2017 20:21:21 +0200")

Lars Schneider <larsxschneider@gmail.com> writes:

> The "rot13-filter.pl" helper wrote its debug logs always to "rot13-filter.log".
> Make this configurable by defining the log file as first parameter of
> "rot13-filter.pl".
>
> This is useful if "rot13-filter.pl" is configured multiple times similar to the
> subsequent patch 'convert: add "status=delayed" to filter process protocol'.

Makes sense.  If you didn't rename the output file to "debug.log"
the patch may have been less noisy (because you do not have to touch
the test_cmp_count calls), but I am guessing that it helped you to
make sure that you covered all the existing users of rot13 filter,
so I am OK with that part of the change as well.

Looks good.  Thanks.

>
> Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
> ---
>  t/t0021-conversion.sh   | 44 ++++++++++++++++++++++----------------------
>  t/t0021/rot13-filter.pl |  8 +++++---
>  2 files changed, 27 insertions(+), 25 deletions(-)
>
> diff --git a/t/t0021-conversion.sh b/t/t0021-conversion.sh
> index ff2424225b..0139b460e7 100755
> --- a/t/t0021-conversion.sh
> +++ b/t/t0021-conversion.sh
> @@ -28,7 +28,7 @@ file_size () {
>  }
>  
>  filter_git () {
> -	rm -f rot13-filter.log &&
> +	rm -f *.log &&
>  	git "$@"
>  }
>  
> @@ -342,7 +342,7 @@ test_expect_success 'diff does not reuse worktree files that need cleaning' '
>  '
>  
>  test_expect_success PERL 'required process filter should filter data' '
> -	test_config_global filter.protocol.process "rot13-filter.pl clean smudge" &&
> +	test_config_global filter.protocol.process "rot13-filter.pl debug.log clean smudge" &&
>  	test_config_global filter.protocol.required true &&
>  	rm -rf repo &&
>  	mkdir repo &&
> @@ -375,7 +375,7 @@ test_expect_success PERL 'required process filter should filter data' '
>  			IN: clean testsubdir/test3 '\''sq'\'',\$x=.r $S3 [OK] -- OUT: $S3 . [OK]
>  			STOP
>  		EOF
> -		test_cmp_count expected.log rot13-filter.log &&
> +		test_cmp_count expected.log debug.log &&
>  
>  		git commit -m "test commit 2" &&
>  		rm -f test2.r "testsubdir/test3 '\''sq'\'',\$x=.r" &&
> @@ -388,7 +388,7 @@ test_expect_success PERL 'required process filter should filter data' '
>  			IN: smudge testsubdir/test3 '\''sq'\'',\$x=.r $S3 [OK] -- OUT: $S3 . [OK]
>  			STOP
>  		EOF
> -		test_cmp_exclude_clean expected.log rot13-filter.log &&
> +		test_cmp_exclude_clean expected.log debug.log &&
>  
>  		filter_git checkout --quiet --no-progress empty-branch &&
>  		cat >expected.log <<-EOF &&
> @@ -397,7 +397,7 @@ test_expect_success PERL 'required process filter should filter data' '
>  			IN: clean test.r $S [OK] -- OUT: $S . [OK]
>  			STOP
>  		EOF
> -		test_cmp_exclude_clean expected.log rot13-filter.log &&
> +		test_cmp_exclude_clean expected.log debug.log &&
>  
>  		filter_git checkout --quiet --no-progress master &&
>  		cat >expected.log <<-EOF &&
> @@ -409,7 +409,7 @@ test_expect_success PERL 'required process filter should filter data' '
>  			IN: smudge testsubdir/test3 '\''sq'\'',\$x=.r $S3 [OK] -- OUT: $S3 . [OK]
>  			STOP
>  		EOF
> -		test_cmp_exclude_clean expected.log rot13-filter.log &&
> +		test_cmp_exclude_clean expected.log debug.log &&
>  
>  		test_cmp_committed_rot13 "$TEST_ROOT/test.o" test.r &&
>  		test_cmp_committed_rot13 "$TEST_ROOT/test2.o" test2.r &&
> @@ -419,7 +419,7 @@ test_expect_success PERL 'required process filter should filter data' '
>  
>  test_expect_success PERL 'required process filter takes precedence' '
>  	test_config_global filter.protocol.clean false &&
> -	test_config_global filter.protocol.process "rot13-filter.pl clean" &&
> +	test_config_global filter.protocol.process "rot13-filter.pl debug.log clean" &&
>  	test_config_global filter.protocol.required true &&
>  	rm -rf repo &&
>  	mkdir repo &&
> @@ -439,12 +439,12 @@ test_expect_success PERL 'required process filter takes precedence' '
>  			IN: clean test.r $S [OK] -- OUT: $S . [OK]
>  			STOP
>  		EOF
> -		test_cmp_count expected.log rot13-filter.log
> +		test_cmp_count expected.log debug.log
>  	)
>  '
>  
>  test_expect_success PERL 'required process filter should be used only for "clean" operation only' '
> -	test_config_global filter.protocol.process "rot13-filter.pl clean" &&
> +	test_config_global filter.protocol.process "rot13-filter.pl debug.log clean" &&
>  	rm -rf repo &&
>  	mkdir repo &&
>  	(
> @@ -462,7 +462,7 @@ test_expect_success PERL 'required process filter should be used only for "clean
>  			IN: clean test.r $S [OK] -- OUT: $S . [OK]
>  			STOP
>  		EOF
> -		test_cmp_count expected.log rot13-filter.log &&
> +		test_cmp_count expected.log debug.log &&
>  
>  		rm test.r &&
>  
> @@ -474,12 +474,12 @@ test_expect_success PERL 'required process filter should be used only for "clean
>  			init handshake complete
>  			STOP
>  		EOF
> -		test_cmp_exclude_clean expected.log rot13-filter.log
> +		test_cmp_exclude_clean expected.log debug.log
>  	)
>  '
>  
>  test_expect_success PERL 'required process filter should process multiple packets' '
> -	test_config_global filter.protocol.process "rot13-filter.pl clean smudge" &&
> +	test_config_global filter.protocol.process "rot13-filter.pl debug.log clean smudge" &&
>  	test_config_global filter.protocol.required true &&
>  
>  	rm -rf repo &&
> @@ -514,7 +514,7 @@ test_expect_success PERL 'required process filter should process multiple packet
>  			IN: clean 3pkt_2+1.file $(($S*2+1)) [OK] -- OUT: $(($S*2+1)) ... [OK]
>  			STOP
>  		EOF
> -		test_cmp_count expected.log rot13-filter.log &&
> +		test_cmp_count expected.log debug.log &&
>  
>  		rm -f *.file &&
>  
> @@ -529,7 +529,7 @@ test_expect_success PERL 'required process filter should process multiple packet
>  			IN: smudge 3pkt_2+1.file $(($S*2+1)) [OK] -- OUT: $(($S*2+1)) ... [OK]
>  			STOP
>  		EOF
> -		test_cmp_exclude_clean expected.log rot13-filter.log &&
> +		test_cmp_exclude_clean expected.log debug.log &&
>  
>  		for FILE in *.file
>  		do
> @@ -539,7 +539,7 @@ test_expect_success PERL 'required process filter should process multiple packet
>  '
>  
>  test_expect_success PERL 'required process filter with clean error should fail' '
> -	test_config_global filter.protocol.process "rot13-filter.pl clean smudge" &&
> +	test_config_global filter.protocol.process "rot13-filter.pl debug.log clean smudge" &&
>  	test_config_global filter.protocol.required true &&
>  	rm -rf repo &&
>  	mkdir repo &&
> @@ -558,7 +558,7 @@ test_expect_success PERL 'required process filter with clean error should fail'
>  '
>  
>  test_expect_success PERL 'process filter should restart after unexpected write failure' '
> -	test_config_global filter.protocol.process "rot13-filter.pl clean smudge" &&
> +	test_config_global filter.protocol.process "rot13-filter.pl debug.log clean smudge" &&
>  	rm -rf repo &&
>  	mkdir repo &&
>  	(
> @@ -579,7 +579,7 @@ test_expect_success PERL 'process filter should restart after unexpected write f
>  		git add . &&
>  		rm -f *.r &&
>  
> -		rm -f rot13-filter.log &&
> +		rm -f debug.log &&
>  		git checkout --quiet --no-progress . 2>git-stderr.log &&
>  
>  		grep "smudge write error at" git-stderr.log &&
> @@ -595,7 +595,7 @@ test_expect_success PERL 'process filter should restart after unexpected write f
>  			IN: smudge test2.r $S2 [OK] -- OUT: $S2 . [OK]
>  			STOP
>  		EOF
> -		test_cmp_exclude_clean expected.log rot13-filter.log &&
> +		test_cmp_exclude_clean expected.log debug.log &&
>  
>  		test_cmp_committed_rot13 "$TEST_ROOT/test.o" test.r &&
>  		test_cmp_committed_rot13 "$TEST_ROOT/test2.o" test2.r &&
> @@ -609,7 +609,7 @@ test_expect_success PERL 'process filter should restart after unexpected write f
>  '
>  
>  test_expect_success PERL 'process filter should not be restarted if it signals an error' '
> -	test_config_global filter.protocol.process "rot13-filter.pl clean smudge" &&
> +	test_config_global filter.protocol.process "rot13-filter.pl debug.log clean smudge" &&
>  	rm -rf repo &&
>  	mkdir repo &&
>  	(
> @@ -639,7 +639,7 @@ test_expect_success PERL 'process filter should not be restarted if it signals a
>  			IN: smudge test2.r $S2 [OK] -- OUT: $S2 . [OK]
>  			STOP
>  		EOF
> -		test_cmp_exclude_clean expected.log rot13-filter.log &&
> +		test_cmp_exclude_clean expected.log debug.log &&
>  
>  		test_cmp_committed_rot13 "$TEST_ROOT/test.o" test.r &&
>  		test_cmp_committed_rot13 "$TEST_ROOT/test2.o" test2.r &&
> @@ -648,7 +648,7 @@ test_expect_success PERL 'process filter should not be restarted if it signals a
>  '
>  
>  test_expect_success PERL 'process filter abort stops processing of all further files' '
> -	test_config_global filter.protocol.process "rot13-filter.pl clean smudge" &&
> +	test_config_global filter.protocol.process "rot13-filter.pl debug.log clean smudge" &&
>  	rm -rf repo &&
>  	mkdir repo &&
>  	(
> @@ -676,7 +676,7 @@ test_expect_success PERL 'process filter abort stops processing of all further f
>  			IN: smudge abort.r $SA [OK] -- OUT: 0 [ABORT]
>  			STOP
>  		EOF
> -		test_cmp_exclude_clean expected.log rot13-filter.log &&
> +		test_cmp_exclude_clean expected.log debug.log &&
>  
>  		test_cmp "$TEST_ROOT/test.o" test.r &&
>  		test_cmp "$TEST_ROOT/test2.o" test2.r &&
> diff --git a/t/t0021/rot13-filter.pl b/t/t0021/rot13-filter.pl
> index 617f581e56..0b943bb377 100644
> --- a/t/t0021/rot13-filter.pl
> +++ b/t/t0021/rot13-filter.pl
> @@ -2,8 +2,9 @@
>  # Example implementation for the Git filter protocol version 2
>  # See Documentation/gitattributes.txt, section "Filter Protocol"
>  #
> -# The script takes the list of supported protocol capabilities as
> -# arguments ("clean", "smudge", etc).
> +# The first argument defines a debug log file that the script write to.
> +# All remaining arguments define a list of supported protocol
> +# capabilities ("clean", "smudge", etc).
>  #
>  # This implementation supports special test cases:
>  # (1) If data with the pathname "clean-write-fail.r" is processed with
> @@ -24,9 +25,10 @@ use warnings;
>  use IO::File;
>  
>  my $MAX_PACKET_CONTENT_SIZE = 65516;
> +my $log_file                = shift @ARGV;
>  my @capabilities            = @ARGV;
>  
> -open my $debug, ">>", "rot13-filter.log" or die "cannot open log file: $!";
> +open my $debug, ">>", $log_file or die "cannot open log file: $!";
>  
>  sub rot13 {
>  	my $str = shift;

  reply	other threads:[~2017-06-25 22:15 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-25 18:21 [PATCH v6 0/6] convert: add "status=delayed" to filter process protocol Lars Schneider
2017-06-25 18:21 ` [PATCH v6 1/6] t0021: keep filter log files on comparison Lars Schneider
2017-06-25 22:12   ` Junio C Hamano
2017-06-26  9:02     ` Lars Schneider
2017-06-26 17:31       ` Junio C Hamano
2017-06-25 18:21 ` [PATCH v6 2/6] t0021: make debug log file name configurable Lars Schneider
2017-06-25 22:15   ` Junio C Hamano [this message]
2017-06-25 18:21 ` [PATCH v6 3/6] t0021: write "OUT" only on success Lars Schneider
2017-06-25 22:17   ` Junio C Hamano
2017-06-26  9:26     ` Lars Schneider
2017-06-26 17:50       ` Junio C Hamano
2017-06-26 18:32         ` Lars Schneider
2017-06-25 18:21 ` [PATCH v6 4/6] convert: put the flags field before the flag itself for consistent style Lars Schneider
2017-06-25 22:19   ` Junio C Hamano
2017-06-25 18:21 ` [PATCH v6 5/6] convert: move multiple file filter error handling to separate function Lars Schneider
2017-06-26 17:56   ` Junio C Hamano
2017-06-27  2:51     ` Stefan Beller
2017-06-26 18:00   ` Junio C Hamano
2017-06-25 18:21 ` [PATCH v6 6/6] convert: add "status=delayed" to filter process protocol Lars Schneider
2017-06-26 19:02   ` Junio C Hamano
2017-06-26 21:28     ` Lars Schneider
2017-06-26 22:13       ` Junio C Hamano
2017-06-26 22:38         ` Junio C Hamano
2017-06-27 12:07         ` Lars Schneider

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqpodr7lyz.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=e@80x24.org \
    --cc=git@vger.kernel.org \
    --cc=larsxschneider@gmail.com \
    --cc=peartben@gmail.com \
    --cc=peff@peff.net \
    --cc=tboegi@web.de \
    --cc=ttaylorr@github.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.