diff options
| author | Ryota Sakamoto <sakamo.ryota@gmail.com> | 2026-01-27 23:23:23 +0900 |
|---|---|---|
| committer | Theodore Ts'o <tytso@mit.edu> | 2026-06-01 08:25:38 -0400 |
| commit | 4bdba812279bb1fd64450cf575f58f3546aa7e9e (patch) | |
| tree | bbab83e120956503858d6b34f5f566f0513399ed /fs/ext4 | |
| parent | 5200f5f493f79f14bbdc349e402a40dfb32f23c8 (diff) | |
| download | linux-next-4bdba812279bb1fd64450cf575f58f3546aa7e9e.tar.gz linux-next-4bdba812279bb1fd64450cf575f58f3546aa7e9e.zip | |
ext4: replace KUnit tests for memcmp() with KUNIT_ASSERT_MEMEQ()
Replace KUnit tests for memcmp() with KUNIT_ASSERT_MEMEQ() to improve
debugging that prints the hex dump of the buffers when the assertion fails,
whereas memcmp() only returns an integer difference.
Signed-off-by: Ryota Sakamoto <sakamo.ryota@gmail.com>
Link: https://patch.msgid.link/20260127-fix-fs_ext4-memcmp-v1-1-5c269ae906b6@gmail.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4')
| -rw-r--r-- | fs/ext4/mballoc-test.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/fs/ext4/mballoc-test.c b/fs/ext4/mballoc-test.c index 90ed505fa4b1..3bd8ef087b28 100644 --- a/fs/ext4/mballoc-test.c +++ b/fs/ext4/mballoc-test.c @@ -714,8 +714,7 @@ do_test_generate_buddy(struct kunit *test, struct super_block *sb, void *bitmap, ext4_mb_generate_buddy_test(sb, ext4_buddy, bitmap, TEST_GOAL_GROUP, ext4_grp); - KUNIT_ASSERT_EQ(test, memcmp(mbt_buddy, ext4_buddy, sb->s_blocksize), - 0); + KUNIT_ASSERT_MEMEQ(test, mbt_buddy, ext4_buddy, sb->s_blocksize); mbt_validate_group_info(test, mbt_grp, ext4_grp); } @@ -776,8 +775,7 @@ test_mb_mark_used_range(struct kunit *test, struct ext4_buddy *e4b, grp->bb_counters[i] = 0; ext4_mb_generate_buddy_test(sb, buddy, bitmap, 0, grp); - KUNIT_ASSERT_EQ(test, memcmp(buddy, e4b->bd_buddy, sb->s_blocksize), - 0); + KUNIT_ASSERT_MEMEQ(test, buddy, e4b->bd_buddy, sb->s_blocksize); mbt_validate_group_info(test, grp, e4b->bd_info); } @@ -841,8 +839,7 @@ test_mb_free_blocks_range(struct kunit *test, struct ext4_buddy *e4b, grp->bb_counters[i] = 0; ext4_mb_generate_buddy_test(sb, buddy, bitmap, 0, grp); - KUNIT_ASSERT_EQ(test, memcmp(buddy, e4b->bd_buddy, sb->s_blocksize), - 0); + KUNIT_ASSERT_MEMEQ(test, buddy, e4b->bd_buddy, sb->s_blocksize); mbt_validate_group_info(test, grp, e4b->bd_info); } |
