Pull KUnit fixes from Shuah Khan: "Three fixes to bugs that cause kernel crash, link error during build, and a third to fix kunit_test_init_section_suites() extra indirection issue" * tag 'linux-kselftest-kunit-fixes-6.2-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest: kunit: fix kunit_test_init_section_suites(...) kunit: fix bug in KUNIT_EXPECT_MEMEQ kunit: Export kunit_running()
Showing the changes to lib (2 of 3 files). Show all
Unified · Split
| @@ -241,24 +241,34 @@ void kunit_mem_assert_format(const struct kunit_assert *assert, · 240 unmodified lines | ||
| 241 | 241 | mem_assert = container_of(assert, struct kunit_mem_assert, |
| 242 | 242 | assert); |
| 243 | 243 | |
| 244 | − string_stream_add(stream, | |
| 245 | − KUNIT_SUBTEST_INDENT "Expected %s %s %s, but\n", | |
| 246 | − mem_assert->text->left_text, | |
| 247 | − mem_assert->text->operation, | |
| 248 | − mem_assert->text->right_text); | |
| 244 | + if (!mem_assert->left_value) { | |
| 245 | + string_stream_add(stream, | |
| 246 | + KUNIT_SUBTEST_INDENT "Expected %s is not null, but is\n", | |
| 247 | + mem_assert->text->left_text); | |
| 248 | + } else if (!mem_assert->right_value) { | |
| 249 | + string_stream_add(stream, | |
| 250 | + KUNIT_SUBTEST_INDENT "Expected %s is not null, but is\n", | |
| 251 | + mem_assert->text->right_text); | |
| 252 | + } else { | |
| 253 | + string_stream_add(stream, | |
| 254 | + KUNIT_SUBTEST_INDENT "Expected %s %s %s, but\n", | |
| 255 | + mem_assert->text->left_text, | |
| 256 | + mem_assert->text->operation, | |
| 257 | + mem_assert->text->right_text); | |
| 249 | 258 | |
| 250 | − string_stream_add(stream, KUNIT_SUBSUBTEST_INDENT "%s ==\n", | |
| 251 | − mem_assert->text->left_text); | |
| 252 | − kunit_assert_hexdump(stream, mem_assert->left_value, | |
| 253 | − mem_assert->right_value, mem_assert->size); | |
| 259 | + string_stream_add(stream, KUNIT_SUBSUBTEST_INDENT "%s ==\n", | |
| 260 | + mem_assert->text->left_text); | |
| 261 | + kunit_assert_hexdump(stream, mem_assert->left_value, | |
| 262 | + mem_assert->right_value, mem_assert->size); | |
| 254 | 263 | |
| 255 | − string_stream_add(stream, "\n"); | |
| 264 | + string_stream_add(stream, "\n"); | |
| 256 | 265 | |
| 257 | − string_stream_add(stream, KUNIT_SUBSUBTEST_INDENT "%s ==\n", | |
| 258 | − mem_assert->text->right_text); | |
| 259 | − kunit_assert_hexdump(stream, mem_assert->right_value, | |
| 260 | − mem_assert->left_value, mem_assert->size); | |
| 266 | + string_stream_add(stream, KUNIT_SUBSUBTEST_INDENT "%s ==\n", | |
| 267 | + mem_assert->text->right_text); | |
| 268 | + kunit_assert_hexdump(stream, mem_assert->right_value, | |
| 269 | + mem_assert->left_value, mem_assert->size); | |
| 261 | 270 | |
| 262 | − kunit_assert_print_msg(message, stream); | |
| 271 | + kunit_assert_print_msg(message, stream); | |
| 272 | + } | |
| 263 | 273 | } |
| 264 | 274 | EXPORT_SYMBOL_GPL(kunit_mem_assert_format); |
| @@ -21,6 +21,7 @@ · 20 unmodified lines | ||
| 21 | 21 | #include "try-catch-impl.h" |
| 22 | 22 | |
| 23 | 23 | DEFINE_STATIC_KEY_FALSE(kunit_running); |
| 24 | +EXPORT_SYMBOL_GPL(kunit_running); | |
| 24 | 25 | |
| 25 | 26 | #if IS_BUILTIN(CONFIG_KUNIT) |
| 26 | 27 | /* |