OSDN Git Service

fat: Add KUnit tests for checksums and timestamps
authorDavid Gow <davidgow@google.com>
Fri, 16 Apr 2021 06:56:23 +0000 (23:56 -0700)
committerShuah Khan <skhan@linuxfoundation.org>
Fri, 13 Aug 2021 19:13:18 +0000 (13:13 -0600)
commitb0d4adaf3b3c4402d9c3b6186e02aa1e4f7985cd
treec1e97a559f9c54c3e33e887b23f8a774a38690fa
parent2734d6c1b1a089fb593ef6a23d4b70903526fe0c
fat: Add KUnit tests for checksums and timestamps

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 inspired by -- and serve a similar purpose to -- the
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.

Fixed minor checkpatch coding style errors and typos in commit log:
Shuah Khan <skhan@linuxfoundation.org>

[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@google.com>
Acked-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Reviewed-by: Brendan Higgins <brendanhiggins@google.com>
Tested-by: Daniel Latypov <dlatypov@google.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
fs/fat/.kunitconfig [new file with mode: 0644]
fs/fat/Kconfig
fs/fat/Makefile
fs/fat/fat_test.c [new file with mode: 0644]
fs/fat/misc.c