mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [GIT PULL] KUnit fixes update for Linux 6.2-rc7
@ 2023-02-02 15:54 Shuah Khan
  2023-02-02 21:13 ` pr-tracker-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Shuah Khan @ 2023-02-02 15:54 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Shuah Khan, Brendan Higgins, David Gow, linux-kernel,
	linux-kselftest, shuah

[-- Attachment #1: Type: text/plain, Size: 1615 bytes --]

Hi Linus,

Please pull the following KUnit fixes update for Linux 6.2-rc7.

This KUnit fixes update for Linux 6.2-rc7 consists of 3 fixes to bugs
that cause kernel crash, link error during build, and a third to fix
kunit_test_init_section_suites() extra indirection issue.

diff is attached.

thanks,
-- Shuah

----------------------------------------------------------------
The following changes since commit 88603b6dc419445847923fcb7fe5080067a30f98:

   Linux 6.2-rc2 (2023-01-01 13:53:16 -0800)

are available in the Git repository at:

   git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest tags/linux-kselftest-kunit-fixes-6.2-rc7

for you to fetch changes up to 254c71374a70051a043676b67ba4f7ad392b5fe6:

   kunit: fix kunit_test_init_section_suites(...) (2023-01-31 09:10:38 -0700)

----------------------------------------------------------------
linux-kselftest-kunit-fixes-6.2-rc7

This KUnit fixes update for Linux 6.2-rc7 consists of 3 fixes to bugs
that cause kernel crash, link error during build, and a third to fix
kunit_test_init_section_suites() extra indirection issue.

----------------------------------------------------------------
Arnd Bergmann (1):
       kunit: Export kunit_running()

Brendan Higgins (1):
       kunit: fix kunit_test_init_section_suites(...)

Rae Moar (1):
       kunit: fix bug in KUNIT_EXPECT_MEMEQ

  include/kunit/test.h |  6 +++---
  lib/kunit/assert.c   | 40 +++++++++++++++++++++++++---------------
  lib/kunit/test.c     |  1 +
  3 files changed, 29 insertions(+), 18 deletions(-)
----------------------------------------------------------------

[-- Attachment #2: linux-kselftest-kunit-fixes-6.2-rc7.diff --]
[-- Type: text/x-patch, Size: 3267 bytes --]

diff --git a/include/kunit/test.h b/include/kunit/test.h
index 87ea90576b50..08d3559dd703 100644
--- a/include/kunit/test.h
+++ b/include/kunit/test.h
@@ -303,7 +303,6 @@ static inline int kunit_run_all_tests(void)
  */
 #define kunit_test_init_section_suites(__suites...)			\
 	__kunit_test_suites(CONCATENATE(__UNIQUE_ID(array), _probe),	\
-			    CONCATENATE(__UNIQUE_ID(suites), _probe),	\
 			    ##__suites)
 
 #define kunit_test_init_section_suite(suite)	\
@@ -683,8 +682,9 @@ do {									       \
 		.right_text = #right,					       \
 	};								       \
 									       \
-	if (likely(memcmp(__left, __right, __size) op 0))		       \
-		break;							       \
+	if (likely(__left && __right))					       \
+		if (likely(memcmp(__left, __right, __size) op 0))	       \
+			break;						       \
 									       \
 	_KUNIT_FAILED(test,						       \
 		      assert_type,					       \
diff --git a/lib/kunit/assert.c b/lib/kunit/assert.c
index f5b50babe38d..05a09652f5a1 100644
--- a/lib/kunit/assert.c
+++ b/lib/kunit/assert.c
@@ -241,24 +241,34 @@ void kunit_mem_assert_format(const struct kunit_assert *assert,
 	mem_assert = container_of(assert, struct kunit_mem_assert,
 				  assert);
 
-	string_stream_add(stream,
-			  KUNIT_SUBTEST_INDENT "Expected %s %s %s, but\n",
-			  mem_assert->text->left_text,
-			  mem_assert->text->operation,
-			  mem_assert->text->right_text);
+	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,
+				KUNIT_SUBTEST_INDENT "Expected %s %s %s, but\n",
+				mem_assert->text->left_text,
+				mem_assert->text->operation,
+				mem_assert->text->right_text);
 
-	string_stream_add(stream, KUNIT_SUBSUBTEST_INDENT "%s ==\n",
-			  mem_assert->text->left_text);
-	kunit_assert_hexdump(stream, mem_assert->left_value,
-			     mem_assert->right_value, mem_assert->size);
+		string_stream_add(stream, KUNIT_SUBSUBTEST_INDENT "%s ==\n",
+				mem_assert->text->left_text);
+		kunit_assert_hexdump(stream, mem_assert->left_value,
+					mem_assert->right_value, mem_assert->size);
 
-	string_stream_add(stream, "\n");
+		string_stream_add(stream, "\n");
 
-	string_stream_add(stream, KUNIT_SUBSUBTEST_INDENT "%s ==\n",
-			  mem_assert->text->right_text);
-	kunit_assert_hexdump(stream, mem_assert->right_value,
-			     mem_assert->left_value, mem_assert->size);
+		string_stream_add(stream, KUNIT_SUBSUBTEST_INDENT "%s ==\n",
+				mem_assert->text->right_text);
+		kunit_assert_hexdump(stream, mem_assert->right_value,
+					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);
diff --git a/lib/kunit/test.c b/lib/kunit/test.c
index c9ebf975e56b..890ba5b3a981 100644
--- a/lib/kunit/test.c
+++ b/lib/kunit/test.c
@@ -21,6 +21,7 @@
 #include "try-catch-impl.h"
 
 DEFINE_STATIC_KEY_FALSE(kunit_running);
+EXPORT_SYMBOL_GPL(kunit_running);
 
 #if IS_BUILTIN(CONFIG_KUNIT)
 /*

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [GIT PULL] KUnit fixes update for Linux 6.2-rc7
  2023-02-02 15:54 [GIT PULL] KUnit fixes update for Linux 6.2-rc7 Shuah Khan
@ 2023-02-02 21:13 ` pr-tracker-bot
  0 siblings, 0 replies; 2+ messages in thread
From: pr-tracker-bot @ 2023-02-02 21:13 UTC (permalink / raw)
  To: Shuah Khan
  Cc: Linus Torvalds, Shuah Khan, Brendan Higgins, David Gow,
	linux-kernel, linux-kselftest, shuah

The pull request you sent on Thu, 2 Feb 2023 08:54:45 -0700:

> git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest tags/linux-kselftest-kunit-fixes-6.2-rc7

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/e7368fd30165ced757d64da48e2091c83815ce5c

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-02-02 21:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-02 15:54 [GIT PULL] KUnit fixes update for Linux 6.2-rc7 Shuah Khan
2023-02-02 21:13 ` pr-tracker-bot

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®