Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'linux-kselftest-kunit-fixes-6.2-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest

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()

+29 -18
+3 -3
include/kunit/test.h
··· 303 303 */ 304 304 #define kunit_test_init_section_suites(__suites...) \ 305 305 __kunit_test_suites(CONCATENATE(__UNIQUE_ID(array), _probe), \ 306 - CONCATENATE(__UNIQUE_ID(suites), _probe), \ 307 306 ##__suites) 308 307 309 308 #define kunit_test_init_section_suite(suite) \ ··· 682 683 .right_text = #right, \ 683 684 }; \ 684 685 \ 685 - if (likely(memcmp(__left, __right, __size) op 0)) \ 686 - break; \ 686 + if (likely(__left && __right)) \ 687 + if (likely(memcmp(__left, __right, __size) op 0)) \ 688 + break; \ 687 689 \ 688 690 _KUNIT_FAILED(test, \ 689 691 assert_type, \
+25 -15
lib/kunit/assert.c
··· 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);
+1
lib/kunit/test.c
··· 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 /*