Re: [PATCH] t5310-pack-bitmaps: fix bogus 'pack-objects to file can use bitmap' test

2018-08-27 Thread Kirill Smelkov
On Mon, Aug 27, 2018 at 07:04:52PM -0400, Jeff King wrote: > On Mon, Aug 27, 2018 at 10:22:46AM +, Kirill Smelkov wrote: > > > A minor comment from outside observer: running tests under something > > like > > > > -e and -o pipefail > > > > would automatically catch the mistake in the fir

Re: [PATCH] t5310-pack-bitmaps: fix bogus 'pack-objects to file can use bitmap' test

2018-08-27 Thread Jeff King
On Mon, Aug 27, 2018 at 10:22:46AM +, Kirill Smelkov wrote: > A minor comment from outside observer: running tests under something > like > > -e and -o pipefail > > would automatically catch the mistake in the first place. Maybe `-o > pipefail` is bashism (I had not checked), but `git

Re: [PATCH] t5310-pack-bitmaps: fix bogus 'pack-objects to file can use bitmap' test

2018-08-27 Thread Kirill Smelkov
On Tue, Aug 14, 2018 at 01:47:21PM +0200, SZEDER Gábor wrote: > The test 'pack-objects to file can use bitmap' added in 645c432d61 > (pack-objects: use reachability bitmap index when generating > non-stdout pack, 2016-09-10) is silently buggy and doesn't check what > it's supposed to. > > In 't5310

Re: [PATCH] t5310-pack-bitmaps: fix bogus 'pack-objects to file can use bitmap' test

2018-08-22 Thread Matthew DeVore
I would encourage use of an existing function to check for emptiness, but require a particular argument for it to be considered "the right way:" test_cmp /dev/null actual This means less vocabulary to memorize for test writers. It's usually a code smell to have special logic for a specific value

Re: [PATCH] t5310-pack-bitmaps: fix bogus 'pack-objects to file can use bitmap' test

2018-08-21 Thread Junio C Hamano
Jeff King writes: >> > If we assume that "expect" is first (which is our convention but not >> > necessarily guaranteed), then I think the best logic is something like: >> > >> > if $1 is empty; then >> > bug in the test script >> > elif test_cmp_allow_empty "$@" >> > test failure >>

Re: [PATCH] t5310-pack-bitmaps: fix bogus 'pack-objects to file can use bitmap' test

2018-08-19 Thread Jeff King
On Sun, Aug 19, 2018 at 11:37:59PM +0200, Andrei Rybak wrote: > On 19/08/18 22:32, Jeff King wrote: > > On Sun, Aug 19, 2018 at 07:50:42PM +0200, Andrei Rybak wrote: > > > >> 1. Check both files at the same time (combination with Gábor's > >> function): > >> > >>test_cmp () { > >>

Re: [PATCH] t5310-pack-bitmaps: fix bogus 'pack-objects to file can use bitmap' test

2018-08-19 Thread Andrei Rybak
On 19/08/18 22:32, Jeff King wrote: > On Sun, Aug 19, 2018 at 07:50:42PM +0200, Andrei Rybak wrote: > >> 1. Check both files at the same time (combination with Gábor's >> function): >> >> test_cmp () { >> if test "$1" != - && >> test "$2" != - && >>

Re: [PATCH] t5310-pack-bitmaps: fix bogus 'pack-objects to file can use bitmap' test

2018-08-19 Thread Jeff King
On Sun, Aug 19, 2018 at 07:50:42PM +0200, Andrei Rybak wrote: > > I actually think the above gives way too confusing output, when the > > actual output is empty and we are expecting some output. > > > > The tester wants to hear from test_cmp "your 'git cmd' produced some > > output when we are ex

Re: [PATCH] t5310-pack-bitmaps: fix bogus 'pack-objects to file can use bitmap' test

2018-08-19 Thread Andrei Rybak
On 17/08/18 22:09, Junio C Hamano wrote: > Andrei Rybak writes: >> >> I'll try something like the following on the weekend: >> >> test_cmp () { >> if test "$1" != - && ! test -s "$1" >> then >> echo >&4 "error: trying to compare empty file '$1'"

Re: [PATCH] t5310-pack-bitmaps: fix bogus 'pack-objects to file can use bitmap' test

2018-08-17 Thread SZEDER Gábor
On Fri, Aug 17, 2018 at 9:27 PM Andrei Rybak wrote: > > On 17/08/18 19:39, SZEDER Gábor wrote: > > > > See, we have quite a few tests that extract repetitive common tasks > > into helper functions, which sometimes includes preparing the expected > > results and running 'test_cmp', e.g. something l

Re: [PATCH] t5310-pack-bitmaps: fix bogus 'pack-objects to file can use bitmap' test

2018-08-17 Thread Junio C Hamano
Andrei Rybak writes: > I think it would be a good trade-off to allow these helper functions to skip > checking emptiness of arguments for test_cmp. Such patch will require only > s/test_cmp/&_allow_empty/ for these helper functions and it will help catch > cases as bogus test in t5310. > > I'll t

Re: [PATCH] t5310-pack-bitmaps: fix bogus 'pack-objects to file can use bitmap' test

2018-08-17 Thread Andrei Rybak
On 17/08/18 19:39, SZEDER Gábor wrote: > > See, we have quite a few tests that extract repetitive common tasks > into helper functions, which sometimes includes preparing the expected > results and running 'test_cmp', e.g. something like this > (oversimplified) example: > > check_cmd () { >

Re: [PATCH] t5310-pack-bitmaps: fix bogus 'pack-objects to file can use bitmap' test

2018-08-17 Thread SZEDER Gábor
On Fri, Aug 17, 2018 at 12:36 AM Junio C Hamano wrote: > > Andrei Rybak writes: > > > On 14/08/18 13:47, SZEDER Gábor wrote: > >> ... both > >> invocations produce empty 'pack{a,b}.objects' files, and the > >> subsequent 'test_cmp' happily finds those two empty files identical. > > > > Is test_cm

Re: [PATCH] t5310-pack-bitmaps: fix bogus 'pack-objects to file can use bitmap' test

2018-08-16 Thread Junio C Hamano
Andrei Rybak writes: > On 14/08/18 13:47, SZEDER Gábor wrote: >> ... both >> invocations produce empty 'pack{a,b}.objects' files, and the >> subsequent 'test_cmp' happily finds those two empty files identical. > > Is test_cmp ever used for empty files? Would it make sense for > test_cmp to issue

Re: [PATCH] t5310-pack-bitmaps: fix bogus 'pack-objects to file can use bitmap' test

2018-08-16 Thread Andrei Rybak
On 14/08/18 13:47, SZEDER Gábor wrote: > ... both > invocations produce empty 'pack{a,b}.objects' files, and the > subsequent 'test_cmp' happily finds those two empty files identical. Is test_cmp ever used for empty files? Would it make sense for test_cmp to issue warning when an empty file is bei

Re: [PATCH] t5310-pack-bitmaps: fix bogus 'pack-objects to file can use bitmap' test

2018-08-14 Thread Jeff King
On Tue, Aug 14, 2018 at 01:47:21PM +0200, SZEDER Gábor wrote: > The test 'pack-objects to file can use bitmap' added in 645c432d61 > (pack-objects: use reachability bitmap index when generating > non-stdout pack, 2016-09-10) is silently buggy and doesn't check what > it's supposed to. > > In 't53

[PATCH] t5310-pack-bitmaps: fix bogus 'pack-objects to file can use bitmap' test

2018-08-14 Thread SZEDER Gábor
The test 'pack-objects to file can use bitmap' added in 645c432d61 (pack-objects: use reachability bitmap index when generating non-stdout pack, 2016-09-10) is silently buggy and doesn't check what it's supposed to. In 't5310-pack-bitmaps.sh', the 'list_packed_objects' helper function does what it