Subject: linux-next: manual merge of the kselftest tree with Linus' tree

From: Stephen Rothwell <[email-masked]>
Date: Mon, 15 Apr 2024 14:39:01 +1000

Hi all,

Today's linux-next merge of the kselftest tree got a conflict in:

  tools/testing/selftests/kselftest.h

between commit:

  f7d5bcd35d42 ("selftests: kselftest: Mark functions that unconditionally call exit() as __noreturn")

from Linus' tree and commit:

  5d3a9274f0d1 ("kselftest: Add mechanism for reporting a KSFT_ result code")
  f07041728422 ("selftests: add ksft_exit_fail_perror()")

from the kselftest tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc tools/testing/selftests/kselftest.h
index 7b89362da4bf,2cd93d220f43..000000000000
--- a/tools/testing/selftests/kselftest.h
+++ b/tools/testing/selftests/kselftest.h
@@@ -303,7 -302,28 +306,28 @@@ void ksft_test_result_code(int exit_cod
  	va_end(args);
  }
  
+ /**
+  * ksft_test_result() - Report test success based on truth of condition
+  *
+  * @condition: if true, report test success, otherwise failure.
+  */
+ #define ksft_test_result_report(result, fmt, ...) do {		\
+ 	switch (result) {					\
+ 	case KSFT_PASS:						\
+ 		ksft_test_result_pass(fmt, ##__VA_ARGS__);	\
+ 		break;						\
+ 	case KSFT_FAIL:						\
+ 		ksft_test_result_fail(fmt, ##__VA_ARGS__);	\
+ 		break;						\
+ 	case KSFT_XFAIL:					\
+ 		ksft_test_result_xfail(fmt, ##__VA_ARGS__);	\
+ 		break;						\
+ 	case KSFT_SKIP:						\
+ 		ksft_test_result_skip(fmt, ##__VA_ARGS__);	\
+ 		break;						\
+ 	} } while (0)
+ 
 -static inline int ksft_exit_pass(void)
 +static inline __noreturn int ksft_exit_pass(void)
  {
  	ksft_print_cnts();
  	exit(KSFT_PASS);
@@@ -351,7 -371,20 +375,20 @@@ static inline __noreturn __printf(1, 2
  	exit(KSFT_FAIL);
  }
  
+ static inline void ksft_exit_fail_perror(const char *msg)
+ {
+ #ifndef NOLIBC
+ 	ksft_exit_fail_msg("%s: %s (%d)\n", msg, strerror(errno), errno);
+ #else
+ 	/*
+ 	 * nolibc doesn't provide strerror() and it seems
+ 	 * inappropriate to add one, just print the errno.
+ 	 */
+ 	ksft_exit_fail_msg("%s: %d)\n", msg, errno);
+ #endif
+ }
+ 
 -static inline int ksft_exit_xfail(void)
 +static inline __noreturn int ksft_exit_xfail(void)
  {
  	ksft_print_cnts();
  	exit(KSFT_XFAIL);