[PATCH v2 0/5] More unit test for mballoc

From: Kemeng Shi
Date: Tue Jan 02 2024 - 21:51:27 EST


This series covers more function to mark on-disk bitmap. Besides, some
code which is relevant to buddy cache is also tested.
Before more work is done, I want to be sure I'm not on a wrong
direction!

v1->v2:
-Fix unused variable warning which is reported at
https://lore.kernel.org/lkml/202311260042.kMxL6DnL-lkp@xxxxxxxxx/T/

Kunit test result is as following:
# ./tools/testing/kunit/kunit.py run --kunitconfig=fs/ext4/.kunitconfig --raw_output
[18:39:42] Configuring KUnit Kernel ...
Regenerating .config ...
Populating config with:
$ make ARCH=um O=.kunit olddefconfig
[18:39:45] Building KUnit Kernel ...
Populating config with:
$ make ARCH=um O=.kunit olddefconfig
Building with:
$ make ARCH=um O=.kunit --jobs=88
[18:39:57] Starting KUnit Kernel (1/1)...
KTAP version 1
1..2
KTAP version 1
# Subtest: ext4_mballoc_test
# module: ext4
1..6
KTAP version 1
# Subtest: test_new_blocks_simple
ok 1 block_bits=10 cluster_bits=3 blocks_per_group=8192 group_count=4 desc_size=64
ok 2 block_bits=12 cluster_bits=3 blocks_per_group=8192 group_count=4 desc_size=64
ok 3 block_bits=16 cluster_bits=3 blocks_per_group=8192 group_count=4 desc_size=64
# test_new_blocks_simple: pass:3 fail:0 skip:0 total:3
ok 1 test_new_blocks_simple
KTAP version 1
# Subtest: test_free_blocks_simple
ok 1 block_bits=10 cluster_bits=3 blocks_per_group=8192 group_count=4 desc_size=64
ok 2 block_bits=12 cluster_bits=3 blocks_per_group=8192 group_count=4 desc_size=64
ok 3 block_bits=16 cluster_bits=3 blocks_per_group=8192 group_count=4 desc_size=64
# test_free_blocks_simple: pass:3 fail:0 skip:0 total:3
ok 2 test_free_blocks_simple
KTAP version 1
# Subtest: test_mb_generate_buddy
ok 1 block_bits=10 cluster_bits=3 blocks_per_group=8192 group_count=4 desc_size=64
ok 2 block_bits=12 cluster_bits=3 blocks_per_group=8192 group_count=4 desc_size=64
ok 3 block_bits=16 cluster_bits=3 blocks_per_group=8192 group_count=4 desc_size=64
# test_mb_generate_buddy: pass:3 fail:0 skip:0 total:3
ok 3 test_mb_generate_buddy
KTAP version 1
# Subtest: test_mb_mark_used
ok 1 block_bits=10 cluster_bits=3 blocks_per_group=8192 group_count=4 desc_size=64
ok 2 block_bits=12 cluster_bits=3 blocks_per_group=8192 group_count=4 desc_size=64
ok 3 block_bits=16 cluster_bits=3 blocks_per_group=8192 group_count=4 desc_size=64
# SKIP blocksize exceeds pagesize
# test_mb_mark_used: pass:2 fail:0 skip:1 total:3
ok 4 test_mb_mark_used
KTAP version 1
# Subtest: test_mb_free_blocks
ok 1 block_bits=10 cluster_bits=3 blocks_per_group=8192 group_count=4 desc_size=64
ok 2 block_bits=12 cluster_bits=3 blocks_per_group=8192 group_count=4 desc_size=64
ok 3 block_bits=16 cluster_bits=3 blocks_per_group=8192 group_count=4 desc_size=64
# SKIP blocksize exceeds pagesize
# test_mb_free_blocks: pass:2 fail:0 skip:1 total:3
ok 5 test_mb_free_blocks
KTAP version 1
# Subtest: test_mark_diskspace_used
ok 1 block_bits=10 cluster_bits=3 blocks_per_group=8192 group_count=4 desc_size=64
ok 2 block_bits=12 cluster_bits=3 blocks_per_group=8192 group_count=4 desc_size=64
ok 3 block_bits=16 cluster_bits=3 blocks_per_group=8192 group_count=4 desc_size=64
# test_mark_diskspace_used: pass:3 fail:0 skip:0 total:3
ok 6 test_mark_diskspace_used
# ext4_mballoc_test: pass:6 fail:0 skip:0 total:6
# Totals: pass:16 fail:0 skip:2 total:18
ok 1 ext4_mballoc_test
KTAP version 1
# Subtest: ext4_inode_test
# module: ext4_inode_test
1..1
KTAP version 1
# Subtest: inode_test_xtimestamp_decoding
ok 1 1901-12-13 Lower bound of 32bit < 0 timestamp, no extra bits
ok 2 1969-12-31 Upper bound of 32bit < 0 timestamp, no extra bits
ok 3 1970-01-01 Lower bound of 32bit >=0 timestamp, no extra bits
ok 4 2038-01-19 Upper bound of 32bit >=0 timestamp, no extra bits
ok 5 2038-01-19 Lower bound of 32bit <0 timestamp, lo extra sec bit on
ok 6 2106-02-07 Upper bound of 32bit <0 timestamp, lo extra sec bit on
ok 7 2106-02-07 Lower bound of 32bit >=0 timestamp, lo extra sec bit on
ok 8 2174-02-25 Upper bound of 32bit >=0 timestamp, lo extra sec bit on
ok 9 2174-02-25 Lower bound of 32bit <0 timestamp, hi extra sec bit on
ok 10 2242-03-16 Upper bound of 32bit <0 timestamp, hi extra sec bit on
ok 11 2242-03-16 Lower bound of 32bit >=0 timestamp, hi extra sec bit on
ok 12 2310-04-04 Upper bound of 32bit >=0 timestamp, hi extra sec bit on
ok 13 2310-04-04 Upper bound of 32bit>=0 timestamp, hi extra sec bit 1. 1 ns
ok 14 2378-04-22 Lower bound of 32bit>= timestamp. Extra sec bits 1. Max ns
ok 15 2378-04-22 Lower bound of 32bit >=0 timestamp. All extra sec bits on
ok 16 2446-05-10 Upper bound of 32bit >=0 timestamp. All extra sec bits on
# inode_test_xtimestamp_decoding: pass:16 fail:0 skip:0 total:16
ok 1 inode_test_xtimestamp_decoding
# Totals: pass:16 fail:0 skip:0 total:16
ok 2 ext4_inode_test
[18:39:57] Elapsed time: 14.400s total, 2.940s configuring, 11.343s building, 0.074s running

Kemeng Shi (5):
ext4: Add unit test for test_free_blocks_simple
ext4: Add unit test of ext4_mb_generate_buddy
ext4: Add unit test for mb_mark_used
ext4: Add unit test for mb_free_blocks
ext4: Add unit test for ext4_mb_mark_diskspace_used

fs/ext4/mballoc-test.c | 502 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 502 insertions(+)

--
2.30.0