diff mbox series

[v3,1/4] kunit: Support skipped tests

Message ID 20210608064852.609327-1-davidgow@google.com (mailing list archive)
State Superseded
Delegated to: Brendan Higgins
Headers show
Series [v3,1/4] kunit: Support skipped tests | expand

Commit Message

David Gow June 8, 2021, 6:48 a.m. UTC
The kunit_mark_skipped() macro marks the current test as "skipped", with
the provided reason. The kunit_skip() macro will mark the test as
skipped, and abort the test.

The TAP specification supports this "SKIP directive" as a comment after
the "ok" / "not ok" for a test. See the "Directives" section of the TAP
spec for details:
https://testanything.org/tap-specification.html#directives

The 'success' field for KUnit tests is replaced with a kunit_status
enum, which can be SUCCESS, FAILURE, or SKIPPED, combined with a
'status_comment' containing information on why a test was skipped.

A new 'kunit_status' test suite is added to test this.

Signed-off-by: David Gow <davidgow@google.com>
Tested-by: Marco Elver <elver@google.com>
Reviewed-by: Daniel Latypov <dlatypov@google.com>
Reviewed-by: Brendan Higgins <brendanhiggins@google.com>
---

Changes since v2:
https://lore.kernel.org/linux-kselftest/20210528075932.347154-1-davidgow@google.com/
- Make the length of the status comment a #define
- Fixed a build issue where debugfs was still using the old
  kunit_status_to_string() function name.

Changes since v1:
https://lore.kernel.org/linux-kselftest/20210526081112.3652290-1-davidgow@google.com/
- Renamed kunit_status_to_string() to kunit_status_to_ok_not_ok
- Fixed incorrect printing of status comments on non-skipped tests.


 include/kunit/test.h   | 73 ++++++++++++++++++++++++++++++++++++++----
 lib/kunit/debugfs.c    |  2 +-
 lib/kunit/kunit-test.c | 42 +++++++++++++++++++++++-
 lib/kunit/test.c       | 51 +++++++++++++++++------------
 4 files changed, 140 insertions(+), 28 deletions(-)

Comments

kernel test robot June 8, 2021, 9:51 a.m. UTC | #1
Hi David,

I love your patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v5.13-rc5 next-20210607]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/David-Gow/kunit-Support-skipped-tests/20210608-145216
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 614124bea77e452aa6df7a8714e8bc820b489922
config: i386-randconfig-s002-20210607 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.3-341-g8af24329-dirty
        # https://github.com/0day-ci/linux/commit/616d7103da7386e89d71208b4df68453790e30ad
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review David-Gow/kunit-Support-skipped-tests/20210608-145216
        git checkout 616d7103da7386e89d71208b4df68453790e30ad
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' W=1 ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   In file included from include/linux/kernel.h:15,
                    from include/kunit/assert.h:13,
                    from include/kunit/test.h:12,
                    from lib/kunit/kunit-test.c:8:
   lib/kunit/kunit-test.c: In function 'kunit_status_mark_skipped_test':
   include/linux/minmax.h:20:28: warning: comparison of distinct pointer types lacks a cast
      20 |  (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
         |                            ^~
   include/kunit/test.h:839:9: note: in expansion of macro '__typecheck'
     839 |  ((void)__typecheck(__left, __right));           \
         |         ^~~~~~~~~~~
   include/kunit/test.h:863:2: note: in expansion of macro 'KUNIT_BASE_BINARY_ASSERTION'
     863 |  KUNIT_BASE_BINARY_ASSERTION(test,           \
         |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/kunit/test.h:952:2: note: in expansion of macro 'KUNIT_BASE_EQ_MSG_ASSERTION'
     952 |  KUNIT_BASE_EQ_MSG_ASSERTION(test,           \
         |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/kunit/test.h:962:2: note: in expansion of macro 'KUNIT_BINARY_EQ_MSG_ASSERTION'
     962 |  KUNIT_BINARY_EQ_MSG_ASSERTION(test,           \
         |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/kunit/test.h:1325:2: note: in expansion of macro 'KUNIT_BINARY_EQ_ASSERTION'
    1325 |  KUNIT_BINARY_EQ_ASSERTION(test, KUNIT_EXPECTATION, left, right)
         |  ^~~~~~~~~~~~~~~~~~~~~~~~~
   lib/kunit/kunit-test.c:458:2: note: in expansion of macro 'KUNIT_EXPECT_EQ'
     458 |  KUNIT_EXPECT_EQ(test, fake.status, KUNIT_SUCCESS);
         |  ^~~~~~~~~~~~~~~
   In file included from lib/kunit/kunit-test.c:8:
>> include/kunit/test.h:1193:24: error: invalid initializer
    1193 |  typeof(left) __left = (left);            \
         |                        ^
   include/kunit/test.h:1216:2: note: in expansion of macro 'KUNIT_BINARY_STR_ASSERTION'
    1216 |  KUNIT_BINARY_STR_ASSERTION(test,           \
         |  ^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/kunit/test.h:1223:2: note: in expansion of macro 'KUNIT_BINARY_STR_EQ_MSG_ASSERTION'
    1223 |  KUNIT_BINARY_STR_EQ_MSG_ASSERTION(test,           \
         |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/kunit/test.h:1507:2: note: in expansion of macro 'KUNIT_BINARY_STR_EQ_ASSERTION'
    1507 |  KUNIT_BINARY_STR_EQ_ASSERTION(test, KUNIT_EXPECTATION, left, right)
         |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   lib/kunit/kunit-test.c:459:2: note: in expansion of macro 'KUNIT_EXPECT_STREQ'
     459 |  KUNIT_EXPECT_STREQ(test, fake.status_comment, "");
         |  ^~~~~~~~~~~~~~~~~~
>> include/kunit/test.h:1193:24: error: invalid initializer
    1193 |  typeof(left) __left = (left);            \
         |                        ^
   include/kunit/test.h:1216:2: note: in expansion of macro 'KUNIT_BINARY_STR_ASSERTION'
    1216 |  KUNIT_BINARY_STR_ASSERTION(test,           \
         |  ^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/kunit/test.h:1223:2: note: in expansion of macro 'KUNIT_BINARY_STR_EQ_MSG_ASSERTION'
    1223 |  KUNIT_BINARY_STR_EQ_MSG_ASSERTION(test,           \
         |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/kunit/test.h:1507:2: note: in expansion of macro 'KUNIT_BINARY_STR_EQ_ASSERTION'
    1507 |  KUNIT_BINARY_STR_EQ_ASSERTION(test, KUNIT_EXPECTATION, left, right)
         |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   lib/kunit/kunit-test.c:466:2: note: in expansion of macro 'KUNIT_EXPECT_STREQ'
     466 |  KUNIT_EXPECT_STREQ(test, fake.status_comment, "Accepts format string: YES");
         |  ^~~~~~~~~~~~~~~~~~


vim +1193 include/kunit/test.h

73cda7bb8bfb1d Brendan Higgins 2019-09-23   854  
73cda7bb8bfb1d Brendan Higgins 2019-09-23   855  #define KUNIT_BASE_EQ_MSG_ASSERTION(test,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   856  				    assert_class,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   857  				    ASSERT_CLASS_INIT,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   858  				    assert_type,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   859  				    left,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   860  				    right,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   861  				    fmt,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   862  				    ...)				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   863  	KUNIT_BASE_BINARY_ASSERTION(test,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   864  				    assert_class,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   865  				    ASSERT_CLASS_INIT,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   866  				    assert_type,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   867  				    left, ==, right,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   868  				    fmt,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   869  				    ##__VA_ARGS__)
73cda7bb8bfb1d Brendan Higgins 2019-09-23   870  
73cda7bb8bfb1d Brendan Higgins 2019-09-23   871  #define KUNIT_BASE_NE_MSG_ASSERTION(test,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   872  				    assert_class,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   873  				    ASSERT_CLASS_INIT,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   874  				    assert_type,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   875  				    left,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   876  				    right,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   877  				    fmt,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   878  				    ...)				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   879  	KUNIT_BASE_BINARY_ASSERTION(test,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   880  				    assert_class,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   881  				    ASSERT_CLASS_INIT,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   882  				    assert_type,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   883  				    left, !=, right,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   884  				    fmt,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   885  				    ##__VA_ARGS__)
73cda7bb8bfb1d Brendan Higgins 2019-09-23   886  
73cda7bb8bfb1d Brendan Higgins 2019-09-23   887  #define KUNIT_BASE_LT_MSG_ASSERTION(test,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   888  				    assert_class,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   889  				    ASSERT_CLASS_INIT,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   890  				    assert_type,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   891  				    left,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   892  				    right,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   893  				    fmt,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   894  				    ...)				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   895  	KUNIT_BASE_BINARY_ASSERTION(test,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   896  				    assert_class,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   897  				    ASSERT_CLASS_INIT,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   898  				    assert_type,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   899  				    left, <, right,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   900  				    fmt,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   901  				    ##__VA_ARGS__)
73cda7bb8bfb1d Brendan Higgins 2019-09-23   902  
73cda7bb8bfb1d Brendan Higgins 2019-09-23   903  #define KUNIT_BASE_LE_MSG_ASSERTION(test,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   904  				    assert_class,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   905  				    ASSERT_CLASS_INIT,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   906  				    assert_type,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   907  				    left,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   908  				    right,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   909  				    fmt,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   910  				    ...)				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   911  	KUNIT_BASE_BINARY_ASSERTION(test,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   912  				    assert_class,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   913  				    ASSERT_CLASS_INIT,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   914  				    assert_type,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   915  				    left, <=, right,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   916  				    fmt,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   917  				    ##__VA_ARGS__)
73cda7bb8bfb1d Brendan Higgins 2019-09-23   918  
73cda7bb8bfb1d Brendan Higgins 2019-09-23   919  #define KUNIT_BASE_GT_MSG_ASSERTION(test,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   920  				    assert_class,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   921  				    ASSERT_CLASS_INIT,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   922  				    assert_type,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   923  				    left,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   924  				    right,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   925  				    fmt,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   926  				    ...)				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   927  	KUNIT_BASE_BINARY_ASSERTION(test,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   928  				    assert_class,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   929  				    ASSERT_CLASS_INIT,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   930  				    assert_type,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   931  				    left, >, right,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   932  				    fmt,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   933  				    ##__VA_ARGS__)
73cda7bb8bfb1d Brendan Higgins 2019-09-23   934  
73cda7bb8bfb1d Brendan Higgins 2019-09-23   935  #define KUNIT_BASE_GE_MSG_ASSERTION(test,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   936  				    assert_class,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   937  				    ASSERT_CLASS_INIT,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   938  				    assert_type,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   939  				    left,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   940  				    right,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   941  				    fmt,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   942  				    ...)				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   943  	KUNIT_BASE_BINARY_ASSERTION(test,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   944  				    assert_class,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   945  				    ASSERT_CLASS_INIT,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   946  				    assert_type,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   947  				    left, >=, right,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   948  				    fmt,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   949  				    ##__VA_ARGS__)
73cda7bb8bfb1d Brendan Higgins 2019-09-23   950  
73cda7bb8bfb1d Brendan Higgins 2019-09-23   951  #define KUNIT_BINARY_EQ_MSG_ASSERTION(test, assert_type, left, right, fmt, ...)\
73cda7bb8bfb1d Brendan Higgins 2019-09-23   952  	KUNIT_BASE_EQ_MSG_ASSERTION(test,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   953  				    kunit_binary_assert,		       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   954  				    KUNIT_INIT_BINARY_ASSERT_STRUCT,	       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   955  				    assert_type,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   956  				    left,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   957  				    right,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   958  				    fmt,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   959  				    ##__VA_ARGS__)
73cda7bb8bfb1d Brendan Higgins 2019-09-23   960  
73cda7bb8bfb1d Brendan Higgins 2019-09-23   961  #define KUNIT_BINARY_EQ_ASSERTION(test, assert_type, left, right)	       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   962  	KUNIT_BINARY_EQ_MSG_ASSERTION(test,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   963  				      assert_type,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   964  				      left,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   965  				      right,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   966  				      NULL)
73cda7bb8bfb1d Brendan Higgins 2019-09-23   967  
73cda7bb8bfb1d Brendan Higgins 2019-09-23   968  #define KUNIT_BINARY_PTR_EQ_MSG_ASSERTION(test,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   969  					  assert_type,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   970  					  left,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   971  					  right,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   972  					  fmt,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   973  					  ...)				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   974  	KUNIT_BASE_EQ_MSG_ASSERTION(test,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   975  				    kunit_binary_ptr_assert,		       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   976  				    KUNIT_INIT_BINARY_PTR_ASSERT_STRUCT,       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   977  				    assert_type,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   978  				    left,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   979  				    right,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   980  				    fmt,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   981  				    ##__VA_ARGS__)
73cda7bb8bfb1d Brendan Higgins 2019-09-23   982  
73cda7bb8bfb1d Brendan Higgins 2019-09-23   983  #define KUNIT_BINARY_PTR_EQ_ASSERTION(test, assert_type, left, right)	       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   984  	KUNIT_BINARY_PTR_EQ_MSG_ASSERTION(test,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   985  					  assert_type,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   986  					  left,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   987  					  right,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   988  					  NULL)
73cda7bb8bfb1d Brendan Higgins 2019-09-23   989  
73cda7bb8bfb1d Brendan Higgins 2019-09-23   990  #define KUNIT_BINARY_NE_MSG_ASSERTION(test, assert_type, left, right, fmt, ...)\
73cda7bb8bfb1d Brendan Higgins 2019-09-23   991  	KUNIT_BASE_NE_MSG_ASSERTION(test,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   992  				    kunit_binary_assert,		       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   993  				    KUNIT_INIT_BINARY_ASSERT_STRUCT,	       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   994  				    assert_type,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   995  				    left,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   996  				    right,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   997  				    fmt,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23   998  				    ##__VA_ARGS__)
73cda7bb8bfb1d Brendan Higgins 2019-09-23   999  
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1000  #define KUNIT_BINARY_NE_ASSERTION(test, assert_type, left, right)	       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1001  	KUNIT_BINARY_NE_MSG_ASSERTION(test,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1002  				      assert_type,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1003  				      left,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1004  				      right,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1005  				      NULL)
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1006  
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1007  #define KUNIT_BINARY_PTR_NE_MSG_ASSERTION(test,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1008  					  assert_type,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1009  					  left,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1010  					  right,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1011  					  fmt,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1012  					  ...)				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1013  	KUNIT_BASE_NE_MSG_ASSERTION(test,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1014  				    kunit_binary_ptr_assert,		       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1015  				    KUNIT_INIT_BINARY_PTR_ASSERT_STRUCT,       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1016  				    assert_type,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1017  				    left,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1018  				    right,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1019  				    fmt,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1020  				    ##__VA_ARGS__)
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1021  
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1022  #define KUNIT_BINARY_PTR_NE_ASSERTION(test, assert_type, left, right)	       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1023  	KUNIT_BINARY_PTR_NE_MSG_ASSERTION(test,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1024  					  assert_type,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1025  					  left,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1026  					  right,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1027  					  NULL)
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1028  
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1029  #define KUNIT_BINARY_LT_MSG_ASSERTION(test, assert_type, left, right, fmt, ...)\
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1030  	KUNIT_BASE_LT_MSG_ASSERTION(test,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1031  				    kunit_binary_assert,		       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1032  				    KUNIT_INIT_BINARY_ASSERT_STRUCT,	       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1033  				    assert_type,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1034  				    left,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1035  				    right,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1036  				    fmt,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1037  				    ##__VA_ARGS__)
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1038  
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1039  #define KUNIT_BINARY_LT_ASSERTION(test, assert_type, left, right)	       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1040  	KUNIT_BINARY_LT_MSG_ASSERTION(test,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1041  				      assert_type,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1042  				      left,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1043  				      right,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1044  				      NULL)
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1045  
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1046  #define KUNIT_BINARY_PTR_LT_MSG_ASSERTION(test,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1047  					  assert_type,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1048  					  left,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1049  					  right,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1050  					  fmt,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1051  					  ...)				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1052  	KUNIT_BASE_LT_MSG_ASSERTION(test,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1053  				    kunit_binary_ptr_assert,		       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1054  				    KUNIT_INIT_BINARY_PTR_ASSERT_STRUCT,       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1055  				    assert_type,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1056  				    left,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1057  				    right,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1058  				    fmt,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1059  				    ##__VA_ARGS__)
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1060  
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1061  #define KUNIT_BINARY_PTR_LT_ASSERTION(test, assert_type, left, right)	       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1062  	KUNIT_BINARY_PTR_LT_MSG_ASSERTION(test,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1063  					  assert_type,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1064  					  left,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1065  					  right,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1066  					  NULL)
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1067  
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1068  #define KUNIT_BINARY_LE_MSG_ASSERTION(test, assert_type, left, right, fmt, ...)\
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1069  	KUNIT_BASE_LE_MSG_ASSERTION(test,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1070  				    kunit_binary_assert,		       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1071  				    KUNIT_INIT_BINARY_ASSERT_STRUCT,	       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1072  				    assert_type,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1073  				    left,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1074  				    right,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1075  				    fmt,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1076  				    ##__VA_ARGS__)
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1077  
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1078  #define KUNIT_BINARY_LE_ASSERTION(test, assert_type, left, right)	       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1079  	KUNIT_BINARY_LE_MSG_ASSERTION(test,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1080  				      assert_type,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1081  				      left,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1082  				      right,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1083  				      NULL)
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1084  
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1085  #define KUNIT_BINARY_PTR_LE_MSG_ASSERTION(test,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1086  					  assert_type,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1087  					  left,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1088  					  right,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1089  					  fmt,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1090  					  ...)				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1091  	KUNIT_BASE_LE_MSG_ASSERTION(test,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1092  				    kunit_binary_ptr_assert,		       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1093  				    KUNIT_INIT_BINARY_PTR_ASSERT_STRUCT,       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1094  				    assert_type,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1095  				    left,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1096  				    right,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1097  				    fmt,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1098  				    ##__VA_ARGS__)
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1099  
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1100  #define KUNIT_BINARY_PTR_LE_ASSERTION(test, assert_type, left, right)	       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1101  	KUNIT_BINARY_PTR_LE_MSG_ASSERTION(test,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1102  					  assert_type,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1103  					  left,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1104  					  right,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1105  					  NULL)
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1106  
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1107  #define KUNIT_BINARY_GT_MSG_ASSERTION(test, assert_type, left, right, fmt, ...)\
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1108  	KUNIT_BASE_GT_MSG_ASSERTION(test,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1109  				    kunit_binary_assert,		       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1110  				    KUNIT_INIT_BINARY_ASSERT_STRUCT,	       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1111  				    assert_type,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1112  				    left,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1113  				    right,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1114  				    fmt,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1115  				    ##__VA_ARGS__)
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1116  
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1117  #define KUNIT_BINARY_GT_ASSERTION(test, assert_type, left, right)	       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1118  	KUNIT_BINARY_GT_MSG_ASSERTION(test,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1119  				      assert_type,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1120  				      left,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1121  				      right,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1122  				      NULL)
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1123  
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1124  #define KUNIT_BINARY_PTR_GT_MSG_ASSERTION(test,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1125  					  assert_type,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1126  					  left,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1127  					  right,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1128  					  fmt,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1129  					  ...)				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1130  	KUNIT_BASE_GT_MSG_ASSERTION(test,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1131  				    kunit_binary_ptr_assert,		       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1132  				    KUNIT_INIT_BINARY_PTR_ASSERT_STRUCT,       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1133  				    assert_type,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1134  				    left,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1135  				    right,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1136  				    fmt,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1137  				    ##__VA_ARGS__)
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1138  
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1139  #define KUNIT_BINARY_PTR_GT_ASSERTION(test, assert_type, left, right)	       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1140  	KUNIT_BINARY_PTR_GT_MSG_ASSERTION(test,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1141  					  assert_type,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1142  					  left,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1143  					  right,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1144  					  NULL)
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1145  
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1146  #define KUNIT_BINARY_GE_MSG_ASSERTION(test, assert_type, left, right, fmt, ...)\
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1147  	KUNIT_BASE_GE_MSG_ASSERTION(test,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1148  				    kunit_binary_assert,		       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1149  				    KUNIT_INIT_BINARY_ASSERT_STRUCT,	       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1150  				    assert_type,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1151  				    left,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1152  				    right,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1153  				    fmt,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1154  				    ##__VA_ARGS__)
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1155  
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1156  #define KUNIT_BINARY_GE_ASSERTION(test, assert_type, left, right)	       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1157  	KUNIT_BINARY_GE_MSG_ASSERTION(test,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1158  				      assert_type,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1159  				      left,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1160  				      right,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1161  				      NULL)
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1162  
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1163  #define KUNIT_BINARY_PTR_GE_MSG_ASSERTION(test,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1164  					  assert_type,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1165  					  left,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1166  					  right,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1167  					  fmt,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1168  					  ...)				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1169  	KUNIT_BASE_GE_MSG_ASSERTION(test,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1170  				    kunit_binary_ptr_assert,		       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1171  				    KUNIT_INIT_BINARY_PTR_ASSERT_STRUCT,       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1172  				    assert_type,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1173  				    left,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1174  				    right,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1175  				    fmt,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1176  				    ##__VA_ARGS__)
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1177  
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1178  #define KUNIT_BINARY_PTR_GE_ASSERTION(test, assert_type, left, right)	       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1179  	KUNIT_BINARY_PTR_GE_MSG_ASSERTION(test,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1180  					  assert_type,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1181  					  left,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1182  					  right,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1183  					  NULL)
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1184  
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1185  #define KUNIT_BINARY_STR_ASSERTION(test,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1186  				   assert_type,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1187  				   left,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1188  				   op,					       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1189  				   right,				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1190  				   fmt,					       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1191  				   ...)					       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1192  do {									       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23 @1193  	typeof(left) __left = (left);					       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1194  	typeof(right) __right = (right);				       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1195  									       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1196  	KUNIT_ASSERTION(test,						       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1197  			strcmp(__left, __right) op 0,			       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1198  			kunit_binary_str_assert,			       \
3084db0e0d5076 Daniel Latypov  2020-11-02  1199  			KUNIT_INIT_BINARY_STR_ASSERT_STRUCT(test,	       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1200  							assert_type,	       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1201  							#op,		       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1202  							#left,		       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1203  							__left,		       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1204  							#right,		       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1205  							__right),	       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1206  			fmt,						       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1207  			##__VA_ARGS__);					       \
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1208  } while (0)
73cda7bb8bfb1d Brendan Higgins 2019-09-23  1209  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
kernel test robot June 8, 2021, 11:01 a.m. UTC | #2
Hi David,

I love your patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v5.13-rc5 next-20210607]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/David-Gow/kunit-Support-skipped-tests/20210608-145216
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 614124bea77e452aa6df7a8714e8bc820b489922
config: s390-randconfig-r021-20210608 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project d32cc150feb72f315a5bbd34f92e7beca21a50da)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install s390 cross compiling tool for clang build
        # apt-get install binutils-s390x-linux-gnu
        # https://github.com/0day-ci/linux/commit/616d7103da7386e89d71208b4df68453790e30ad
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review David-Gow/kunit-Support-skipped-tests/20210608-145216
        git checkout 616d7103da7386e89d71208b4df68453790e30ad
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=s390 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   lib/kunit/kunit-test.c:458:2: warning: comparison of distinct pointer types ('typeof (__left) *' (aka 'enum kunit_status *') and 'typeof (__right) *' (aka 'int *')) [-Wcompare-distinct-pointer-types]
           KUNIT_EXPECT_EQ(test, fake.status, KUNIT_SUCCESS);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/kunit/test.h:1325:2: note: expanded from macro 'KUNIT_EXPECT_EQ'
           KUNIT_BINARY_EQ_ASSERTION(test, KUNIT_EXPECTATION, left, right)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/kunit/test.h:962:2: note: expanded from macro 'KUNIT_BINARY_EQ_ASSERTION'
           KUNIT_BINARY_EQ_MSG_ASSERTION(test,                                    \
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/kunit/test.h:952:2: note: expanded from macro 'KUNIT_BINARY_EQ_MSG_ASSERTION'
           KUNIT_BASE_EQ_MSG_ASSERTION(test,                                      \
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/kunit/test.h:863:2: note: expanded from macro 'KUNIT_BASE_EQ_MSG_ASSERTION'
           KUNIT_BASE_BINARY_ASSERTION(test,                                      \
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/kunit/test.h:839:9: note: expanded from macro 'KUNIT_BASE_BINARY_ASSERTION'
           ((void)__typecheck(__left, __right));                                  \
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/minmax.h:20:28: note: expanded from macro '__typecheck'
           (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
                      ~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~
>> lib/kunit/kunit-test.c:459:2: error: array initializer must be an initializer list or string literal
           KUNIT_EXPECT_STREQ(test, fake.status_comment, "");
           ^
   include/kunit/test.h:1507:2: note: expanded from macro 'KUNIT_EXPECT_STREQ'
           KUNIT_BINARY_STR_EQ_ASSERTION(test, KUNIT_EXPECTATION, left, right)
           ^
   include/kunit/test.h:1223:2: note: expanded from macro 'KUNIT_BINARY_STR_EQ_ASSERTION'
           KUNIT_BINARY_STR_EQ_MSG_ASSERTION(test,                                \
           ^
   include/kunit/test.h:1216:2: note: expanded from macro 'KUNIT_BINARY_STR_EQ_MSG_ASSERTION'
           KUNIT_BINARY_STR_ASSERTION(test,                                       \
           ^
   include/kunit/test.h:1193:15: note: expanded from macro 'KUNIT_BINARY_STR_ASSERTION'
           typeof(left) __left = (left);                                          \
                        ^
   lib/kunit/kunit-test.c:466:2: error: array initializer must be an initializer list or string literal
           KUNIT_EXPECT_STREQ(test, fake.status_comment, "Accepts format string: YES");
           ^
   include/kunit/test.h:1507:2: note: expanded from macro 'KUNIT_EXPECT_STREQ'
           KUNIT_BINARY_STR_EQ_ASSERTION(test, KUNIT_EXPECTATION, left, right)
           ^
   include/kunit/test.h:1223:2: note: expanded from macro 'KUNIT_BINARY_STR_EQ_ASSERTION'
           KUNIT_BINARY_STR_EQ_MSG_ASSERTION(test,                                \
           ^
   include/kunit/test.h:1216:2: note: expanded from macro 'KUNIT_BINARY_STR_EQ_MSG_ASSERTION'
           KUNIT_BINARY_STR_ASSERTION(test,                                       \
           ^
   include/kunit/test.h:1193:15: note: expanded from macro 'KUNIT_BINARY_STR_ASSERTION'
           typeof(left) __left = (left);                                          \
                        ^
   1 warning and 2 errors generated.


vim +459 lib/kunit/kunit-test.c

   450	
   451	static void kunit_status_mark_skipped_test(struct kunit *test)
   452	{
   453		struct kunit fake;
   454	
   455		kunit_init_test(&fake, "fake test", NULL);
   456	
   457		/* Before: Should be SUCCESS with no comment. */
   458		KUNIT_EXPECT_EQ(test, fake.status, KUNIT_SUCCESS);
 > 459		KUNIT_EXPECT_STREQ(test, fake.status_comment, "");
   460	
   461		/* Mark the test as skipped. */
   462		kunit_mark_skipped(&fake, "Accepts format string: %s", "YES");
   463	
   464		/* After: Should be SKIPPED with our comment. */
   465		KUNIT_EXPECT_EQ(test, fake.status, (enum kunit_status)KUNIT_SKIPPED);
   466		KUNIT_EXPECT_STREQ(test, fake.status_comment, "Accepts format string: YES");
   467	}
   468	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff mbox series

Patch

diff --git a/include/kunit/test.h b/include/kunit/test.h
index b68c61348121..fb481696c587 100644
--- a/include/kunit/test.h
+++ b/include/kunit/test.h
@@ -97,6 +97,9 @@  struct kunit;
 /* Maximum size of parameter description string. */
 #define KUNIT_PARAM_DESC_SIZE 128
 
+/* Maximum size of a status comment. */
+#define KUNIT_STATUS_COMMENT_SIZE 256
+
 /*
  * TAP specifies subtest stream indentation of 4 spaces, 8 spaces for a
  * sub-subtest.  See the "Subtests" section in
@@ -105,6 +108,18 @@  struct kunit;
 #define KUNIT_SUBTEST_INDENT		"    "
 #define KUNIT_SUBSUBTEST_INDENT		"        "
 
+/**
+ * enum kunit_status - Type of result for a test or test suite
+ * @KUNIT_SUCCESS: Denotes the test suite has not failed nor been skipped
+ * @KUNIT_FAILURE: Denotes the test has failed.
+ * @KUNIT_SKIPPED: Denotes the test has been skipped.
+ */
+enum kunit_status {
+	KUNIT_SUCCESS,
+	KUNIT_FAILURE,
+	KUNIT_SKIPPED,
+};
+
 /**
  * struct kunit_case - represents an individual test case.
  *
@@ -148,13 +163,20 @@  struct kunit_case {
 	const void* (*generate_params)(const void *prev, char *desc);
 
 	/* private: internal use only. */
-	bool success;
+	enum kunit_status status;
 	char *log;
 };
 
-static inline char *kunit_status_to_string(bool status)
+static inline char *kunit_status_to_ok_not_ok(enum kunit_status status)
 {
-	return status ? "ok" : "not ok";
+	switch (status) {
+	case KUNIT_SKIPPED:
+	case KUNIT_SUCCESS:
+		return "ok";
+	case KUNIT_FAILURE:
+		return "not ok";
+	}
+	return "invalid";
 }
 
 /**
@@ -212,6 +234,7 @@  struct kunit_suite {
 	struct kunit_case *test_cases;
 
 	/* private: internal use only */
+	char status_comment[KUNIT_STATUS_COMMENT_SIZE];
 	struct dentry *debugfs;
 	char *log;
 };
@@ -245,19 +268,21 @@  struct kunit {
 	 * be read after the test case finishes once all threads associated
 	 * with the test case have terminated.
 	 */
-	bool success; /* Read only after test_case finishes! */
 	spinlock_t lock; /* Guards all mutable test state. */
+	enum kunit_status status; /* Read only after test_case finishes! */
 	/*
 	 * Because resources is a list that may be updated multiple times (with
 	 * new resources) from any thread associated with a test case, we must
 	 * protect it with some type of lock.
 	 */
 	struct list_head resources; /* Protected by lock. */
+
+	char status_comment[KUNIT_STATUS_COMMENT_SIZE];
 };
 
 static inline void kunit_set_failure(struct kunit *test)
 {
-	WRITE_ONCE(test->success, false);
+	WRITE_ONCE(test->status, KUNIT_FAILURE);
 }
 
 void kunit_init_test(struct kunit *test, const char *name, char *log);
@@ -348,7 +373,7 @@  static inline int kunit_run_all_tests(void)
 #define kunit_suite_for_each_test_case(suite, test_case)		\
 	for (test_case = suite->test_cases; test_case->run_case; test_case++)
 
-bool kunit_suite_has_succeeded(struct kunit_suite *suite);
+enum kunit_status kunit_suite_has_succeeded(struct kunit_suite *suite);
 
 /*
  * Like kunit_alloc_resource() below, but returns the struct kunit_resource
@@ -612,6 +637,42 @@  void kunit_cleanup(struct kunit *test);
 
 void kunit_log_append(char *log, const char *fmt, ...);
 
+/**
+ * kunit_mark_skipped() - Marks @test_or_suite as skipped
+ *
+ * @test_or_suite: The test context object.
+ * @fmt:  A printk() style format string.
+ *
+ * Marks the test as skipped. @fmt is given output as the test status
+ * comment, typically the reason the test was skipped.
+ *
+ * Test execution continues after kunit_mark_skipped() is called.
+ */
+#define kunit_mark_skipped(test_or_suite, fmt, ...)			\
+	do {								\
+		WRITE_ONCE((test_or_suite)->status, KUNIT_SKIPPED);	\
+		scnprintf((test_or_suite)->status_comment,		\
+			  KUNIT_STATUS_COMMENT_SIZE,			\
+			  fmt, ##__VA_ARGS__);				\
+	} while (0)
+
+/**
+ * kunit_skip() - Marks @test_or_suite as skipped
+ *
+ * @test_or_suite: The test context object.
+ * @fmt:  A printk() style format string.
+ *
+ * Skips the test. @fmt is given output as the test status
+ * comment, typically the reason the test was skipped.
+ *
+ * Test execution is halted after kunit_skip() is called.
+ */
+#define kunit_skip(test_or_suite, fmt, ...)				\
+	do {								\
+		kunit_mark_skipped((test_or_suite), fmt, ##__VA_ARGS__);\
+		kunit_try_catch_throw(&((test_or_suite)->try_catch));	\
+	} while (0)
+
 /*
  * printk and log to per-test or per-suite log buffer.  Logging only done
  * if CONFIG_KUNIT_DEBUGFS is 'y'; if it is 'n', no log is allocated/used.
diff --git a/lib/kunit/debugfs.c b/lib/kunit/debugfs.c
index 9214c493d8b7..b71db0abc12b 100644
--- a/lib/kunit/debugfs.c
+++ b/lib/kunit/debugfs.c
@@ -64,7 +64,7 @@  static int debugfs_print_results(struct seq_file *seq, void *v)
 		debugfs_print_result(seq, suite, test_case);
 
 	seq_printf(seq, "%s %d - %s\n",
-		   kunit_status_to_string(success), 1, suite->name);
+		   kunit_status_to_ok_not_ok(success), 1, suite->name);
 	return 0;
 }
 
diff --git a/lib/kunit/kunit-test.c b/lib/kunit/kunit-test.c
index 69f902440a0e..d69efcbed624 100644
--- a/lib/kunit/kunit-test.c
+++ b/lib/kunit/kunit-test.c
@@ -437,7 +437,47 @@  static void kunit_log_test(struct kunit *test)
 #endif
 }
 
+static void kunit_status_set_failure_test(struct kunit *test)
+{
+	struct kunit fake;
+
+	kunit_init_test(&fake, "fake test", NULL);
+
+	KUNIT_EXPECT_EQ(test, fake.status, (enum kunit_status)KUNIT_SUCCESS);
+	kunit_set_failure(&fake);
+	KUNIT_EXPECT_EQ(test, fake.status, (enum kunit_status)KUNIT_FAILURE);
+}
+
+static void kunit_status_mark_skipped_test(struct kunit *test)
+{
+	struct kunit fake;
+
+	kunit_init_test(&fake, "fake test", NULL);
+
+	/* Before: Should be SUCCESS with no comment. */
+	KUNIT_EXPECT_EQ(test, fake.status, KUNIT_SUCCESS);
+	KUNIT_EXPECT_STREQ(test, fake.status_comment, "");
+
+	/* Mark the test as skipped. */
+	kunit_mark_skipped(&fake, "Accepts format string: %s", "YES");
+
+	/* After: Should be SKIPPED with our comment. */
+	KUNIT_EXPECT_EQ(test, fake.status, (enum kunit_status)KUNIT_SKIPPED);
+	KUNIT_EXPECT_STREQ(test, fake.status_comment, "Accepts format string: YES");
+}
+
+static struct kunit_case kunit_status_test_cases[] = {
+	KUNIT_CASE(kunit_status_set_failure_test),
+	KUNIT_CASE(kunit_status_mark_skipped_test),
+	{}
+};
+
+static struct kunit_suite kunit_status_test_suite = {
+	.name = "kunit_status",
+	.test_cases = kunit_status_test_cases,
+};
+
 kunit_test_suites(&kunit_try_catch_test_suite, &kunit_resource_test_suite,
-		  &kunit_log_test_suite);
+		  &kunit_log_test_suite, &kunit_status_test_suite);
 
 MODULE_LICENSE("GPL v2");
diff --git a/lib/kunit/test.c b/lib/kunit/test.c
index 2f6cc0123232..8ce0c8fddb96 100644
--- a/lib/kunit/test.c
+++ b/lib/kunit/test.c
@@ -98,12 +98,14 @@  static void kunit_print_subtest_start(struct kunit_suite *suite)
 
 static void kunit_print_ok_not_ok(void *test_or_suite,
 				  bool is_test,
-				  bool is_ok,
+				  enum kunit_status status,
 				  size_t test_number,
-				  const char *description)
+				  const char *description,
+				  const char *directive)
 {
 	struct kunit_suite *suite = is_test ? NULL : test_or_suite;
 	struct kunit *test = is_test ? test_or_suite : NULL;
+	const char *directive_header = (status == KUNIT_SKIPPED) ? " # SKIP " : "";
 
 	/*
 	 * We do not log the test suite results as doing so would
@@ -114,25 +116,31 @@  static void kunit_print_ok_not_ok(void *test_or_suite,
 	 * representation.
 	 */
 	if (suite)
-		pr_info("%s %zd - %s\n",
-			kunit_status_to_string(is_ok),
-			test_number, description);
+		pr_info("%s %zd - %s%s%s\n",
+			kunit_status_to_ok_not_ok(status),
+			test_number, description, directive_header,
+			(status == KUNIT_SKIPPED) ? directive : "");
 	else
-		kunit_log(KERN_INFO, test, KUNIT_SUBTEST_INDENT "%s %zd - %s",
-			  kunit_status_to_string(is_ok),
-			  test_number, description);
+		kunit_log(KERN_INFO, test,
+			  KUNIT_SUBTEST_INDENT "%s %zd - %s%s%s",
+			  kunit_status_to_ok_not_ok(status),
+			  test_number, description, directive_header,
+			  (status == KUNIT_SKIPPED) ? directive : "");
 }
 
-bool kunit_suite_has_succeeded(struct kunit_suite *suite)
+enum kunit_status kunit_suite_has_succeeded(struct kunit_suite *suite)
 {
 	const struct kunit_case *test_case;
+	enum kunit_status status = KUNIT_SKIPPED;
 
 	kunit_suite_for_each_test_case(suite, test_case) {
-		if (!test_case->success)
-			return false;
+		if (test_case->status == KUNIT_FAILURE)
+			return KUNIT_FAILURE;
+		else if (test_case->status == KUNIT_SUCCESS)
+			status = KUNIT_SUCCESS;
 	}
 
-	return true;
+	return status;
 }
 EXPORT_SYMBOL_GPL(kunit_suite_has_succeeded);
 
@@ -143,7 +151,8 @@  static void kunit_print_subtest_end(struct kunit_suite *suite)
 	kunit_print_ok_not_ok((void *)suite, false,
 			      kunit_suite_has_succeeded(suite),
 			      kunit_suite_counter++,
-			      suite->name);
+			      suite->name,
+			      suite->status_comment);
 }
 
 unsigned int kunit_test_case_num(struct kunit_suite *suite,
@@ -252,7 +261,8 @@  void kunit_init_test(struct kunit *test, const char *name, char *log)
 	test->log = log;
 	if (test->log)
 		test->log[0] = '\0';
-	test->success = true;
+	test->status = KUNIT_SUCCESS;
+	test->status_comment[0] = '\0';
 }
 EXPORT_SYMBOL_GPL(kunit_init_test);
 
@@ -376,7 +386,8 @@  static void kunit_run_case_catch_errors(struct kunit_suite *suite,
 	context.test_case = test_case;
 	kunit_try_catch_run(try_catch, &context);
 
-	test_case->success = test->success;
+	test_case->status = test->status;
+
 }
 
 int kunit_run_tests(struct kunit_suite *suite)
@@ -388,7 +399,6 @@  int kunit_run_tests(struct kunit_suite *suite)
 
 	kunit_suite_for_each_test_case(suite, test_case) {
 		struct kunit test = { .param_value = NULL, .param_index = 0 };
-		bool test_success = true;
 
 		if (test_case->generate_params) {
 			/* Get initial param. */
@@ -398,7 +408,6 @@  int kunit_run_tests(struct kunit_suite *suite)
 
 		do {
 			kunit_run_case_catch_errors(suite, test_case, &test);
-			test_success &= test_case->success;
 
 			if (test_case->generate_params) {
 				if (param_desc[0] == '\0') {
@@ -410,7 +419,7 @@  int kunit_run_tests(struct kunit_suite *suite)
 					  KUNIT_SUBTEST_INDENT
 					  "# %s: %s %d - %s",
 					  test_case->name,
-					  kunit_status_to_string(test.success),
+					  kunit_status_to_ok_not_ok(test.status),
 					  test.param_index + 1, param_desc);
 
 				/* Get next param. */
@@ -420,9 +429,10 @@  int kunit_run_tests(struct kunit_suite *suite)
 			}
 		} while (test.param_value);
 
-		kunit_print_ok_not_ok(&test, true, test_success,
+		kunit_print_ok_not_ok(&test, true, test_case->status,
 				      kunit_test_case_num(suite, test_case),
-				      test_case->name);
+				      test_case->name,
+				      test.status_comment);
 	}
 
 	kunit_print_subtest_end(suite);
@@ -434,6 +444,7 @@  EXPORT_SYMBOL_GPL(kunit_run_tests);
 static void kunit_init_suite(struct kunit_suite *suite)
 {
 	kunit_debugfs_create_suite(suite);
+	suite->status_comment[0] = '\0';
 }
 
 int __kunit_test_suites_init(struct kunit_suite * const * const suites)