]> git.itanic.dy.fi Git - linux-stable/commitdiff
Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux...
authorStephen Rothwell <sfr@canb.auug.org.au>
Wed, 24 Apr 2024 07:55:53 +0000 (17:55 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 24 Apr 2024 07:55:53 +0000 (17:55 +1000)
1  2 
tools/testing/selftests/kselftest.h

index 14bbab0cce13521abbcae9bbd3772a567239c77f,9bb1664bcf95e4ba2599500b82f276cb04c86aa7..3d2256885cffbb5114ea494c2004017891eda471
@@@ -292,19 -295,38 +295,40 @@@ void ksft_test_result_code(int exit_cod
        }
  
        /* Docs seem to call for double space if directive is absent */
 -      if (!directive[0] && msg[0])
 +      if (!directive[0] && msg)
                directive = " #  ";
  
 -      va_start(args, msg);
        printf("%s %u %s%s", tap_code, ksft_test_num(), test_name, directive);
        errno = saved_errno;
 -      vprintf(msg, args);
 +      if (msg) {
 +              va_start(args, msg);
 +              vprintf(msg, args);
 +              va_end(args);
 +      }
        printf("\n");
 -      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 __noreturn int ksft_exit_pass(void)
  {
        ksft_print_cnts();