Commit e7368fd3 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'linux-kselftest-kunit-fixes-6.2-rc7' of...

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()
parents 42c78a5b 254c7137
...@@ -303,7 +303,6 @@ static inline int kunit_run_all_tests(void) ...@@ -303,7 +303,6 @@ static inline int kunit_run_all_tests(void)
*/ */
#define kunit_test_init_section_suites(__suites...) \ #define kunit_test_init_section_suites(__suites...) \
__kunit_test_suites(CONCATENATE(__UNIQUE_ID(array), _probe), \ __kunit_test_suites(CONCATENATE(__UNIQUE_ID(array), _probe), \
CONCATENATE(__UNIQUE_ID(suites), _probe), \
##__suites) ##__suites)
#define kunit_test_init_section_suite(suite) \ #define kunit_test_init_section_suite(suite) \
...@@ -683,6 +682,7 @@ do { \ ...@@ -683,6 +682,7 @@ do { \
.right_text = #right, \ .right_text = #right, \
}; \ }; \
\ \
if (likely(__left && __right)) \
if (likely(memcmp(__left, __right, __size) op 0)) \ if (likely(memcmp(__left, __right, __size) op 0)) \
break; \ break; \
\ \
......
...@@ -241,6 +241,15 @@ void kunit_mem_assert_format(const struct kunit_assert *assert, ...@@ -241,6 +241,15 @@ void kunit_mem_assert_format(const struct kunit_assert *assert,
mem_assert = container_of(assert, struct kunit_mem_assert, mem_assert = container_of(assert, struct kunit_mem_assert,
assert); assert);
if (!mem_assert->left_value) {
string_stream_add(stream,
KUNIT_SUBTEST_INDENT "Expected %s is not null, but is\n",
mem_assert->text->left_text);
} else if (!mem_assert->right_value) {
string_stream_add(stream,
KUNIT_SUBTEST_INDENT "Expected %s is not null, but is\n",
mem_assert->text->right_text);
} else {
string_stream_add(stream, string_stream_add(stream,
KUNIT_SUBTEST_INDENT "Expected %s %s %s, but\n", KUNIT_SUBTEST_INDENT "Expected %s %s %s, but\n",
mem_assert->text->left_text, mem_assert->text->left_text,
...@@ -260,5 +269,6 @@ void kunit_mem_assert_format(const struct kunit_assert *assert, ...@@ -260,5 +269,6 @@ void kunit_mem_assert_format(const struct kunit_assert *assert,
mem_assert->left_value, mem_assert->size); mem_assert->left_value, mem_assert->size);
kunit_assert_print_msg(message, stream); kunit_assert_print_msg(message, stream);
}
} }
EXPORT_SYMBOL_GPL(kunit_mem_assert_format); EXPORT_SYMBOL_GPL(kunit_mem_assert_format);
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "try-catch-impl.h" #include "try-catch-impl.h"
DEFINE_STATIC_KEY_FALSE(kunit_running); DEFINE_STATIC_KEY_FALSE(kunit_running);
EXPORT_SYMBOL_GPL(kunit_running);
#if IS_BUILTIN(CONFIG_KUNIT) #if IS_BUILTIN(CONFIG_KUNIT)
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment