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

From: Stefano Brivio
Date: Mon Jun 08 2020 - 07:51:34 EST


On Mon, 8 Jun 2020 14:31:02 +0300
Andy Shevchenko <andy.shevchenko@xxxxxxxxx> wrote:

> On Mon, Jun 8, 2020 at 1:29 PM Stefano Brivio <sbrivio@xxxxxxxxxx> wrote:
> > On Mon, 8 Jun 2020 13:12:14 +0300
> > Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:
> > > On Mon, Jun 08, 2020 at 11:13:29AM +0200, Stefano Brivio wrote:
> > > > Based on an original patch by Yury Norov: introduce a test for
> > > > bitmap_cut() that also makes sure functionality is as described for
> > > > partially overlapping src and dst.
> > >
> > > > Co-authored-by: Yury Norov <yury.norov@xxxxxxxxx>
> > >
> > > Co-developed-by (and it requires Yury's SoB as well).
> >
> > Oops, sorry, I didn't remember this part from submitting-patches.rst
> > correctly. Thanks for pointing this out.
> >
> > Yury, let me know if I should re-post with both Co-authored-by: and
>
> Co-developed-by: :-)

Grrr. That! :)

> > Signed-off-by: you -- otherwise I'll repost without both.
>
> ...
>
> > > > + if (!bitmap_equal(out, t->expected, t->nbits)) {
> > > > + pr_err("bitmap_cut failed: expected %*pb, got %*pb\n",
> > > > + t->nbits, t->expected, t->nbits, out);
> > > > + }
> > >
> > > Perhaps
> > >
> > > if (bitmap_equal(...))
> > > continue;
> > >
> > > ...
> > >
> > > ?
> >
> > That's five lines instead of four (I can't get pr_err() on one line
> > anyway) and it looks less straightforward: "if it doesn't match we have
> > an error" vs. "if it matches go to next case. We have an error". Any
> > specific reason I'm missing?
>
> Actually, please use one of suitable expect_eq_*() macro or add your
> own. Because above has an inconsistent format with the rest.

Whoops, I see now. Yes, expect_eq_bitmap() will do, I'll change this in
v2.

--
Stefano