Re: [PATCH 26/29] pack-objects & index-pack: add test for --threads warning

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

 



On 05/11, Ævar Arnfjörð Bjarmason wrote:
> Add a test for the warning that's emitted when --threads or
> pack.threads is provided under NO_PTHREADS=YesPlease. This uses the
> new PTHREADS prerequisite.
> 
> The assertion for C_LOCALE_OUTPUT in the latter test is currently
> redundant, since unlike index-pack the pack-objects warnings aren't
> i18n'd. However they might be changed to be i18n'd in the future, and
> there's no harm in future-proofing the test.
> 
> There's an existing bug in the implementation of pack-objects which
> this test currently tests for as-is. Details about the bug & the fix
> are included in a follow-up change.
> 
> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx>
> ---
>  t/t5300-pack-object.sh | 34 ++++++++++++++++++++++++++++++++++
>  1 file changed, 34 insertions(+)
> 
> diff --git a/t/t5300-pack-object.sh b/t/t5300-pack-object.sh
> index 43a672c345..1629fa80b0 100755
> --- a/t/t5300-pack-object.sh
> +++ b/t/t5300-pack-object.sh
> @@ -421,6 +421,40 @@ test_expect_success 'index-pack <pack> works in non-repo' '
>  	test_path_is_file foo.idx
>  '
>  
> +test_expect_success !PTHREADS,C_LOCALE_OUTPUT 'index-pack --threads=N or pack.threads=N warns when no pthreads' '
> +	test_must_fail git index-pack --threads=2 2>err &&
> +	grep ^warning: err >warnings &&
> +	test_line_count = 1 warnings &&
> +	grep -F "no threads support, ignoring --threads=2" err &&
> +	test_must_fail git -c pack.threads=2 index-pack 2>err &&
> +	grep ^warning: err >warnings &&
> +	test_line_count = 1 warnings &&
> +	grep -F "no threads support, ignoring pack.threads" err &&
> +	test_must_fail git -c pack.threads=2 index-pack --threads=4 2>err &&
> +	grep ^warning: err >warnings &&
> +	test_line_count = 2 warnings &&
> +	grep -F "no threads support, ignoring --threads=4" err &&
> +	grep -F "no threads support, ignoring pack.threads" err
> +'
> +
> +test_expect_success !PTHREADS,C_LOCALE_OUTPUT 'pack-objects --threads=N or pack.threads=N warns when no pthreads' '
> +	git pack-objects --threads=2 --stdout --all </dev/null >/dev/null 2>err &&
> +	grep ^warning: err >warnings &&
> +	test_line_count = 1 warnings &&
> +	grep -F "no threads support, ignoring --threads" err &&
> +	git -c pack.threads=2 pack-objects --stdout --all </dev/null >/dev/null 2>err &&
> +	cat err &&
> +	grep ^warning: err >warnings &&
> +	test_line_count = 2 warnings &&
> +	grep -F "no threads support, ignoring --threads" err &&
> +	grep -F "no threads support, ignoring pack.threads" err &&
> +	git -c pack.threads=2 pack-objects --threads=4 --stdout --all </dev/null >/dev/null 2>err &&
> +	grep ^warning: err >warnings &&
> +	test_line_count = 2 warnings &&
> +	grep -F "no threads support, ignoring --threads" err &&
> +	grep -F "no threads support, ignoring pack.threads" err
> +'
> +

Some of these tests you might want to rewrite using test_i18ncmp to
ensure that the messages match in other languages.  That is assuming
this error message is translated (which it should be).

>  #
>  # WARNING!
>  #
> -- 
> 2.11.0
> 

-- 
Brandon Williams



[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]