Re: [PATCH 2/2] lib: Add test for bitmap_cut()
From: Andy Shevchenko
Date: Mon Jun 08 2020 - 07:31:17 EST
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: :-)
> 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.
--
With Best Regards,
Andy Shevchenko