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". > 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. > + * 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? Not going to pretend I understand FAT, but everything else in this test makes sense from a logical/testing/readability point of view. Cheers! [...]