Re: [PATCH v8] fat: Add KUnit tests for checksums and timestamps

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

 



On Tue, May 4, 2021 at 11:48 PM David Gow <davidgow@xxxxxxxxxx> wrote:
>
> On Wed, May 5, 2021 at 2:36 AM 'Brendan Higgins' via KUnit Development
> <kunit-dev@xxxxxxxxxxxxxxxx> wrote:
> >
> > On Thu, Apr 15, 2021 at 11:56:23PM -0700, David Gow wrote:
> > > Add some basic sanity-check tests for the fat_checksum() function and
> > > the fat_time_unix2fat() and fat_time_fat2unix() functions. These unit
> > > tests verify these functions return correct output for a number of test
> > > inputs.
> > >
> > > These tests were inspored by -- and serve a similar purpose to -- the
> >                    ^^^^^^^^
> >         I am guessing this is supposed to be "inspired".
> >
>
> Oops -- yup. This is a typo. I can resend a version with this fixed if
> you think that makes sense, otherwise I'll just hold it over in case I
> need to send out a new version.
>
> > > timestamp parsing KUnit tests in ext4[1].
> > >
> > > Note that, unlike fat_time_unix2fat, fat_time_fat2unix wasn't previously
> > > exported, so this patch exports it as well. This is required for the
> > > case where we're building the fat and fat_test as modules.
> > >
> > > [1]:
> > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/fs/ext4/inode-test.c
> > >
> > > Signed-off-by: David Gow <davidgow@xxxxxxxxxx>
> > > Acked-by: OGAWA Hirofumi <hirofumi@xxxxxxxxxxxxxxxxxx>
> >
> > Aside from the nit above, and the *potential* nit and question below.
> > Everything here looks good to me.
> >
> > Reviewed-by: Brendan Higgins <brendanhiggins@xxxxxxxxxx>
> >
> > > ---
> > >
> > > It's been a while, but this hopefully is a final version of the FAT KUnit
> > > patchset. It has a number of changes to keep it up-to-date with current
> > > KUnit standards, notably the use of parameterised tests and the addition
> > > of a '.kunitconfig' file to allow for easy testing. It also fixes an
> > > endianness tagging issue picked up by the kernel test robot under sparse
> > > on pa-risc.
> > >
> > > Cheers,
> > > -- David
> >
> > [...]
> >
> > > diff --git a/fs/fat/fat_test.c b/fs/fat/fat_test.c
> > > new file mode 100644
> > > index 000000000000..febd25f57d4b
> > > --- /dev/null
> > > +++ b/fs/fat/fat_test.c
> > > @@ -0,0 +1,197 @@
> > > +// SPDX-License-Identifier: GPL-2.0
> > > +/*
> > > + * KUnit tests for FAT filesystems.
> > > + *
> > > + * Copyright (C) 2020 Google LLC.
> >
> > Nit: I know you wrote this last year, but I have had other maintainers
> > tell me the Copyright date should be set to when the final version of
> > the patch is sent out.
> >
> > I personally don't care, and I don't think you should resend this patch
> > just for that, but figured I would mention.
> >
>
> Hmm... I've definitely heard this both ways, but I can easily update
> the year if I need to send a new version out.
>
> > > + * Author: David Gow <davidgow@xxxxxxxxxx>
> > > + */
> > > +
> > > +#include <kunit/test.h>
> > > +
> > > +#include "fat.h"
> > > +
> > > +static void fat_checksum_test(struct kunit *test)
> > > +{
> > > +     /* With no extension. */
> > > +     KUNIT_EXPECT_EQ(test, fat_checksum("VMLINUX    "), (u8)44);
> > > +     /* With 3-letter extension. */
> > > +     KUNIT_EXPECT_EQ(test, fat_checksum("README  TXT"), (u8)115);
> > > +     /* With short (1-letter) extension. */
> > > +     KUNIT_EXPECT_EQ(test, fat_checksum("ABCDEFGHA  "), (u8)98);
> >
> > How do you get the magic values? Or is this just supposed to be a
> > regression test?
>
> This is mainly meant to be a regression test, and the values did
> originally come from just running fat_checksum. I have, however,
> checked that Windows 98 produces the same values (on a FAT12
> filesystem).

All the above sounds good to me. Like I said before, all my comments
are pretty minor, I don't think you need to send a new revision for
those.



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux