Skip to contentSkip to conversation

ext4: add kunit test for decoding extended timestamps

PATCH Superseded Iurii Zaikin 2 participants 2 messages Oct 10, 2019 – Oct 16, 2019

Subsystems (2)

v3 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 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. KUnit tests, which run on boot and output
the results to the debug log in TAP format (http://testanything.org/).
are only useful for kernel devs running KUnit test harness. Not for inclusion into a production build.
Test data is derive from the table under Documentation/filesystems/ext4/inodes.rst Inode Timestamps.

---
 fs/ext4/Kconfig      |  14 +++
 fs/ext4/Makefile     |   1 +
 fs/ext4/inode-test.c | 239 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 254 insertions(+)
 create mode 100644 fs/ext4/inode-test.c
fs/ext4/Kconfig +14 -0
index cbb5ca830e57..605c3d506934 100644
@@ -106,3 +106,17 @@ 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 test for ext4 inode"
+	depends on EXT4_FS
+	depends on KUNIT
+	help
+	  This builds the ext4 KUnit tests, which run on boot and output
+	  the results to the debug log in TAP format (http://testanything.org/).
+	  Only useful for kernel devs running KUnit test harness. 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..a0588fd2eea6 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 +239 -0

239 lines not on this page · raw message

--
2.23.0.700.g56cf767bdb-goog

maintainer Reviewed-by on v3 1/1
#1 lore raw
Quoted 11 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. KUnit tests, which run on boot and output
the results to the debug log in TAP format (http://testanything.org/).
are only useful for kernel devs running KUnit test harness. Not for inclusion into a production build.
Test data is derive from the table under Documentation/filesystems/ext4/inodes.rst Inode Timestamps.

This looks good. Thanks, Iurii!

- Ted