ext4: add first unit test for ext4_mb_new_blocks_simple in mballoc
authorKemeng Shi <shikemeng@huaweicloud.com>
Thu, 28 Sep 2023 16:04:06 +0000 (00:04 +0800)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 6 Oct 2023 02:32:16 +0000 (22:32 -0400)
commit7c9fa399a369546c0e0375ea4b354d642a8fe501
tree458356110b2927bbac82c0f6e0cfb3504bdf7ce5
parentbdefd689b7ff0eadc3b29dc6c66556617bd1ed42
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>
fs/ext4/mballoc-test.c [new file with mode: 0644]
fs/ext4/mballoc.c