On Wed, May 5, 2021 at 2:36 AM 'Brendan Higgins' via KUnit Development kunit-dev@googlegroups.com 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.
Signed-off-by: David Gow davidgow@google.com Acked-by: OGAWA Hirofumi hirofumi@mail.parknet.co.jp
Aside from the nit above, and the *potential* nit and question below. Everything here looks good to me.
Reviewed-by: Brendan Higgins brendanhiggins@google.com
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@google.com
- */
+#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).
Not going to pretend I understand FAT, but everything else in this test makes sense from a logical/testing/readability point of view.
Cheers!
[...]
-- You received this message because you are subscribed to the Google Groups "KUnit Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to kunit-dev+unsubscribe@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/kunit-dev/YJGUFrc8PJ0LAKiF%40google.com.