Skip to contentSkip to conversation

ext4: add kunit test for decoding extended timestamps

PATCH In review Iurii Zaikin 2 participants 2 messages Oct 17, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v6 1/1 ext4: add kunit test for decoding extended timestamps

KUnit tests for decoding extended 64 bit timestamps that verify the seconds part of [a/c/m] timestamps in ext4 inode structs are decoded correctly.

Test data is derived from the table in the Inode Timestamps section of Documentation/filesystems/ext4/inodes.rst.

KUnit tests run during boot and output the results to the debug log in TAP format (http://testanything.org/). Only useful for kernel devs running KUnit test harness and are not for inclusion into a production build.

---
 fs/ext4/Kconfig      |  17 +++
 fs/ext4/Makefile     |   1 +
 fs/ext4/inode-test.c | 272 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 290 insertions(+)
 create mode 100644 fs/ext4/inode-test.c
fs/ext4/Kconfig +17 -0
index cbb5ca830e57..ef42ab040905 100644
@@ -106,3 +106,20 @@ config EXT4_DEBUG
 	  If you select Y here, then you will be able to turn on debugging
 	  with a command such as:
 		echo 1 > /sys/module/ext4/parameters/mballoc_debug
+
+config EXT4_KUNIT_TESTS
+	bool "KUnit tests for ext4"
+	select EXT4_FS
+	depends on KUNIT
+	help
+	  This builds the ext4 KUnit tests.
+
+	  KUnit tests run during boot and output the results to the debug log
+	  in TAP format (http://testanything.org/). Only useful for kernel devs
+	  running KUnit test harness and are not for inclusion into a production
+	  build.
+
+	  For more information on KUnit and unit tests in general please refer
+	  to the KUnit documentation in Documentation/dev-tools/kunit/.
+
+	  If unsure, say N.
fs/ext4/Makefile +1 -0
index b17ddc229ac5..840b91d040f1 100644
@@ -13,4 +13,5 @@ ext4-y	:= balloc.o bitmap.o block_validity.o dir.o ext4_jbd2.o extents.o \
 
 ext4-$(CONFIG_EXT4_FS_POSIX_ACL)	+= acl.o
 ext4-$(CONFIG_EXT4_FS_SECURITY)		+= xattr_security.o
+ext4-$(CONFIG_EXT4_KUNIT_TESTS)		+= inode-test.o
 ext4-$(CONFIG_FS_VERITY)		+= verity.o
fs/ext4/inode-test.c new file +272 -0

272 lines not on this page · raw message

--
2.23.0.866.gb869b98d4c-goog

maintainer Reviewed-by on v6 1/1
#1 lore raw
Quoted 12 lines · Iurii Zaikin

KUnit tests for decoding extended 64 bit timestamps that verify the seconds part of [a/c/m] timestamps in ext4 inode structs are decoded correctly.

Test data is derived from the table in the Inode Timestamps section of Documentation/filesystems/ext4/inodes.rst.

KUnit tests run during boot and output the results to the debug log in TAP format (http://testanything.org/). Only useful for kernel devs running KUnit test harness and are not for inclusion into a production build.

Quoted 4 lines

Looks good.

I plan to apply this to linux-kselftest/test

thanks,
-- Shuah