* [PATCH] ext4: Replace KUnit tests for memcmp() with KUNIT_ASSERT_MEMEQ()
@ 2026-01-27 14:23 Ryota Sakamoto
2026-05-28 14:38 ` Theodore Ts'o
0 siblings, 1 reply; 2+ messages in thread
From: Ryota Sakamoto @ 2026-01-27 14:23 UTC (permalink / raw)
To: Theodore Ts'o, Andreas Dilger
Cc: linux-ext4, linux-kernel, Ryota Sakamoto
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>
---
fs/ext4/mballoc-test.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/fs/ext4/mballoc-test.c b/fs/ext4/mballoc-test.c
index a9416b20ff64c930d90fc177d01cd6a4639d8333..85613b1811cd7c7b7410acff6028f0eabf28ef2c 100644
--- a/fs/ext4/mballoc-test.c
+++ b/fs/ext4/mballoc-test.c
@@ -710,8 +710,7 @@ do_test_generate_buddy(struct kunit *test, struct super_block *sb, void *bitmap,
ext4_mb_generate_buddy(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);
}
@@ -772,8 +771,7 @@ test_mb_mark_used_range(struct kunit *test, struct ext4_buddy *e4b,
grp->bb_counters[i] = 0;
ext4_mb_generate_buddy(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);
}
@@ -837,8 +835,7 @@ test_mb_free_blocks_range(struct kunit *test, struct ext4_buddy *e4b,
grp->bb_counters[i] = 0;
ext4_mb_generate_buddy(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);
}
---
base-commit: fcb70a56f4d81450114034b2c61f48ce7444a0e2
change-id: 20260127-fix-fs_ext4-memcmp-e8014778cf73
Best regards,
--
Ryota Sakamoto <sakamo.ryota@gmail.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] ext4: Replace KUnit tests for memcmp() with KUNIT_ASSERT_MEMEQ()
2026-01-27 14:23 [PATCH] ext4: Replace KUnit tests for memcmp() with KUNIT_ASSERT_MEMEQ() Ryota Sakamoto
@ 2026-05-28 14:38 ` Theodore Ts'o
0 siblings, 0 replies; 2+ messages in thread
From: Theodore Ts'o @ 2026-05-28 14:38 UTC (permalink / raw)
To: Andreas Dilger, Ryota Sakamoto
Cc: Theodore Ts'o, linux-ext4, linux-kernel
On Tue, 27 Jan 2026 23:23:23 +0900, Ryota Sakamoto wrote:
> 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.
Applied, thanks!
[1/1] ext4: Replace KUnit tests for memcmp() with KUNIT_ASSERT_MEMEQ()
commit: eef9fb4e19bf99252232339183ee167c63457c57
Best regards,
--
Theodore Ts'o <tytso@mit.edu>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-05-28 14:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-27 14:23 [PATCH] ext4: Replace KUnit tests for memcmp() with KUNIT_ASSERT_MEMEQ() Ryota Sakamoto
2026-05-28 14:38 ` Theodore Ts'o
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®