summaryrefslogtreecommitdiff
path: root/fs/ext4/mballoc.c
diff options
context:
space:
mode:
authorKemeng Shi <shikemeng@huaweicloud.com>2023-09-28 19:04:06 +0300
committerTheodore Ts'o <tytso@mit.edu>2023-10-06 05:32:16 +0300
commit7c9fa399a369546c0e0375ea4b354d642a8fe501 (patch)
tree458356110b2927bbac82c0f6e0cfb3504bdf7ce5 /fs/ext4/mballoc.c
parentbdefd689b7ff0eadc3b29dc6c66556617bd1ed42 (diff)
downloadlinux-7c9fa399a369546c0e0375ea4b354d642a8fe501.tar.xz
ext4: add first unit test for ext4_mb_new_blocks_simple in mballoc
Here are prepared work: 1. Include mballoc-test.c to mballoc.c to be able test static function in mballoc.c. 2. Implement static stub to avoid read IO to disk. 3. Construct fake super_block. Only partial members are set, more members will be set when more functions are tested. Then unit test for ext4_mb_new_blocks_simple is added. Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com> Reviewed-by: "Ritesh Harjani (IBM)" <ritesh.list@gmail.com> Link: https://lore.kernel.org/r/20230928160407.142069-12-shikemeng@huaweicloud.com Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/mballoc.c')
-rw-r--r--fs/ext4/mballoc.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 401b8329d1e1..454d5612641e 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -6991,3 +6991,7 @@ out_unload:
return error;
}
+
+#ifdef CONFIG_EXT4_KUNIT_TESTS
+#include "mballoc-test.c"
+#endif