Re: [PATCH 2/4] Make t1300-repo-config resilient to being run via 'sh -x'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Johannes Schindelin <johannes.schindelin@xxxxxx> writes:

> One of this developer's primary tools to diagnose broken regression
> tests is to run the test script using 'sh -x t... -i -v' to find out
> *which* call *actually* demonstrates the symptom.
>
> Hence it is pretty counterproductive if the test script behaves
> differently when being run via 'sh -x', in particular when using
> test_cmp or test_i18ncmp on redirected stderr.
>
> So let's use grep instead of test_cmp/test_i18ncmp to verify that stderr
> looks as expected.

In the modern world, I would probably described the problem as
"tXXXX -i -v -x", though, not "sh -x tXXXX", but they both exhibit
the same symptom.

I wonder if "tXXXX -i -v -x" can be made not to contaminate the
standard error stream of the test, but that would be a larger change
we probably would not have time for 2.8 final anyway.

Will queue.  Thanks.

>
> Signed-off-by: Johannes Schindelin <johannes.schindelin@xxxxxx>
> ---
>  t/t1300-repo-config.sh | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh
> index 8867ce1..0236fe2 100755
> --- a/t/t1300-repo-config.sh
> +++ b/t/t1300-repo-config.sh
> @@ -699,17 +699,13 @@ test_expect_success 'invalid unit' '
>  	echo 1auto >expect &&
>  	git config aninvalid.unit >actual &&
>  	test_cmp expect actual &&
> -	cat >expect <<-\EOF &&
> -	fatal: bad numeric config value '\''1auto'\'' for '\''aninvalid.unit'\'' in file .git/config: invalid unit
> -	EOF
>  	test_must_fail git config --int --get aninvalid.unit 2>actual &&
> -	test_i18ncmp expect actual
> +	grep "^fatal: bad numeric config value .1auto. for .aninvalid.unit. in file .git/config: invalid unit$" actual
>  '
>  
>  test_expect_success 'invalid stdin config' '
> -	echo "fatal: bad config line 1 in standard input " >expect &&
>  	echo "[broken" | test_must_fail git config --list --file - >output 2>&1 &&
> -	test_cmp expect output
> +	grep "^fatal: bad config line 1 in standard input $" output
>  '
>  
>  cat > expect << EOF
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]