Re: [PATCH 2/2] bitmap: Add test for bitmap_cut()

From: Andy Shevchenko
Date: Mon Jun 15 2020 - 07:43:55 EST


On Mon, Jun 15, 2020 at 01:08:25PM +0200, Stefano Brivio wrote:
> On Mon, 15 Jun 2020 12:46:16 +0300
> Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:
>
> > On Mon, Jun 15, 2020 at 12:41:55PM +0300, Andy Shevchenko wrote:
> > > On Sun, Jun 14, 2020 at 07:40:54PM +0200, Stefano Brivio wrote:
> > > > Inspired by an original patch from Yury Norov: introduce a test for
> > > > bitmap_cut() that also makes sure functionality is as described for
> > > > partially overlapping src and dst.
> > >
> > > Taking into account recent fixes for BE 64-bit, do we have test cases for a such?
> >
> > It might be enough to have only these, but perhaps s390 guys can help?
>
> There's no behaviour difference due to endianness in this test itself --
> just word size was a topic, hence that BITS_PER_LONG usage with
> redundant values (checked on i686).
>
> That is, if you have:
> { 0x0000ffffUL, 0x5a5a5a5aUL, 0x5a5a5a5aUL, 0x5a5a5a5aUL },
>
> then 1 as array subscript always denotes the second item (from the left)
> there, it doesn't matter how and where different architectures store it.
>
> Indeed, if bitmap_cut() directly addressed single bytes within the
> words, I would need to pay special attention there. The values I picked
> for these tests are also meant to show any issue in that sense.
>
> > Alexander, can you apply this patch (w/o the first one, which is suppose to
> > fix) and confirm that you have test case failure, followed by applying first
> > one and confirm a fix?
>
> I did that already on s390x (of course, I thought :)), I can confirm
> that. Without patch 1/2 the test also fails there:
>
> [ 20.917848] test_bitmap: [lib/test_bitmap.c:666] bitmaps contents differ: expected "0-16,18-19,21,24,26-27,29", got "1,3-4,6,9,11-12,14,16,18-19,21,24,26-27,29"

Thanks!
Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>


> If Alexander wants to test this on a z14 or z15, sure, it won't harm.

Sure.

> By the way, tests for 'parse', 'parse_user' and 'parselist' report
> issues:

I believe this [1] will fix it.

[1]: 81c4f4d924d5 ("lib: fix bitmap_parse() on 64-bit big endian archs")

--
With Best Regards,
Andy Shevchenko