Skip to contentSkip to conversation

ext4: add kunit test for decoding extended timestamps

PATCH Superseded Iurii Zaikin 3 participants 4 messages Oct 16, 2019 – Oct 17, 2019

Subsystems (2)

v5 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH v5 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 derived 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..f13dde8ed92b 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 tests for ext4"
+	select 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..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 +239 -0

239 lines not on this page · raw message

--
2.23.0.866.gb869b98d4c-goog

#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 derived from the table under Documentation/filesystems/ext4/inodes.rst Inode Timestamps.

You got Reviewed-bys from both Ted and myself. Unless you make *substantial* changes you should generally include all Reviewed-bys, Tested-bys, Acked-bys, etc in all future revisions.

Cheers!

maintainer Reviewed-by on v5 1/1
#2 lore raw
In reply to Iurii Zaikin
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 derived from the table under Documentation/filesystems/ext4/inodes.rst Inode Timestamps.

Minor nit. The above commit description would look nicer when looked at in "git log" when formatted as follows:

--- cut here ---

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 and are not for inclusion into a production build.

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

--- cut here ---

- Ted

maintainer
#3 lore raw
Quoted 14 lines · Theodore Y. Ts'o

Minor nit. The above commit description would look nicer when looked at in "git log" when formatted as follows:

--- cut here ---

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 and are not for inclusion into a production build.

Quoted 4 lines

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

--- cut here ---

Upon rereading, swapping the 2nd and 3rd paragraphis would read better, I think.

- Ted