All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: Re: [RFC v1 10/12] kunit: mock: add class mocking support
Date: Sat, 19 Sep 2020 04:27:28 +0800	[thread overview]
Message-ID: <202009190420.jSHO5kZZ%lkp@intel.com> (raw)
In-Reply-To: <20200918183114.2571146-11-dlatypov@google.com>

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

Hi Daniel,

[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on 10b82d5176488acee2820e5a2cf0f2ec5c3488b6]

url:    https://github.com/0day-ci/linux/commits/Daniel-Latypov/kunit-introduce-class-mocking-support/20200919-023253
base:    10b82d5176488acee2820e5a2cf0f2ec5c3488b6
config: x86_64-allyesconfig (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
        # save the attached .config to linux build tree
        make W=1 ARCH=x86_64 

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

All warnings (new ones prefixed by >>):

   In file included from lib/kunit/kunit-example-test.c:10:
>> lib/kunit/kunit-example-test.c:60:33: warning: no previous prototype for 'foo' [-Wmissing-prototypes]
      60 | DEFINE_STRUCT_CLASS_MOCK(METHOD(foo), CLASS(example),
         |                                 ^~~
   include/kunit/mock.h:328:15: note: in definition of macro 'DEFINE_MOCK_CLIENT_COMMON'
     328 |   return_type name(PARAM_LIST_FROM_TYPES(param_types))        \
         |               ^~~~
   include/kunit/mock.h:380:3: note: in expansion of macro 'DEFINE_MOCK_METHOD_CLIENT_COMMON'
     380 |   DEFINE_MOCK_METHOD_CLIENT_COMMON(name,          \
         |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/kunit/mock.h:437:3: note: in expansion of macro 'DEFINE_MOCK_METHOD_CLIENT'
     437 |   DEFINE_MOCK_METHOD_CLIENT(name,           \
         |   ^~~~~~~~~~~~~~~~~~~~~~~~~
   include/kunit/mock.h:459:3: note: in expansion of macro 'DEFINE_MOCK_COMMON'
     459 |   DEFINE_MOCK_COMMON(name,           \
         |   ^~~~~~~~~~~~~~~~~~
   include/kunit/mock.h:468:3: note: in expansion of macro 'DEFINE_STRUCT_CLASS_MOCK_HANDLE_INDEX_INTERNAL'
     468 |   DEFINE_STRUCT_CLASS_MOCK_HANDLE_INDEX_INTERNAL(name,        \
         |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/kunit/mock.h:506:3: note: in expansion of macro 'DEFINE_STRUCT_CLASS_MOCK_HANDLE_INDEX'
     506 |   DEFINE_STRUCT_CLASS_MOCK_HANDLE_INDEX(name,         \
         |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   lib/kunit/kunit-example-test.c:60:1: note: in expansion of macro 'DEFINE_STRUCT_CLASS_MOCK'
      60 | DEFINE_STRUCT_CLASS_MOCK(METHOD(foo), CLASS(example),
         | ^~~~~~~~~~~~~~~~~~~~~~~~
   lib/kunit/kunit-example-test.c:60:26: note: in expansion of macro 'METHOD'
      60 | DEFINE_STRUCT_CLASS_MOCK(METHOD(foo), CLASS(example),
         |                          ^~~~~~
>> include/kunit/mock.h:402:28: warning: no previous prototype for 'mock_master_foo' [-Wmissing-prototypes]
     402 |   struct mock_expectation *mock_master_##name(         \
         |                            ^~~~~~~~~~~~
   include/kunit/mock.h:420:3: note: in expansion of macro 'DEFINE_MOCK_MASTER_COMMON_INTERNAL'
     420 |   DEFINE_MOCK_MASTER_COMMON_INTERNAL(name,         \
         |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/kunit/mock.h:427:3: note: in expansion of macro 'DEFINE_MOCK_MASTER_COMMON'
     427 |   DEFINE_MOCK_MASTER_COMMON(name,           \
         |   ^~~~~~~~~~~~~~~~~~~~~~~~~
   include/kunit/mock.h:442:3: note: in expansion of macro 'DEFINE_MOCK_METHOD_MASTER'
     442 |   DEFINE_MOCK_METHOD_MASTER(name, handle_index, param_types)
         |   ^~~~~~~~~~~~~~~~~~~~~~~~~
   include/kunit/mock.h:459:3: note: in expansion of macro 'DEFINE_MOCK_COMMON'
     459 |   DEFINE_MOCK_COMMON(name,           \
         |   ^~~~~~~~~~~~~~~~~~
   include/kunit/mock.h:468:3: note: in expansion of macro 'DEFINE_STRUCT_CLASS_MOCK_HANDLE_INDEX_INTERNAL'
     468 |   DEFINE_STRUCT_CLASS_MOCK_HANDLE_INDEX_INTERNAL(name,        \
         |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/kunit/mock.h:506:3: note: in expansion of macro 'DEFINE_STRUCT_CLASS_MOCK_HANDLE_INDEX'
     506 |   DEFINE_STRUCT_CLASS_MOCK_HANDLE_INDEX(name,         \
         |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   lib/kunit/kunit-example-test.c:60:1: note: in expansion of macro 'DEFINE_STRUCT_CLASS_MOCK'
      60 | DEFINE_STRUCT_CLASS_MOCK(METHOD(foo), CLASS(example),
         | ^~~~~~~~~~~~~~~~~~~~~~~~
>> lib/kunit/kunit-example-test.c:85:31: warning: no previous prototype for 'examplemock_init' [-Wmissing-prototypes]
      85 | DEFINE_STRUCT_CLASS_MOCK_INIT(example, example_init);
         |                               ^~~~~~~
   include/kunit/mock.h:194:35: note: in definition of macro 'MOCK_INIT_ID'
     194 | #define MOCK_INIT_ID(struct_name) struct_name##mock_init
         |                                   ^~~~~~~~~~~
   lib/kunit/kunit-example-test.c:85:1: note: in expansion of macro 'DEFINE_STRUCT_CLASS_MOCK_INIT'
      85 | DEFINE_STRUCT_CLASS_MOCK_INIT(example, example_init);
         | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

# https://github.com/0day-ci/linux/commit/80a5526fd886c8b3d5ad6ba475b3d1087943f70a
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Daniel-Latypov/kunit-introduce-class-mocking-support/20200919-023253
git checkout 80a5526fd886c8b3d5ad6ba475b3d1087943f70a
vim +/foo +60 lib/kunit/kunit-example-test.c

    55	
    56	/*
    57	 * This macro creates a mock implementation of the specified method of the
    58	 * specified class.
    59	 */
  > 60	DEFINE_STRUCT_CLASS_MOCK(METHOD(foo), CLASS(example),
    61				 RETURNS(int),
    62				 PARAMS(struct example *, int));
    63	
    64	/*
    65	 * This tells KUnit how to initialize the parts of the mock that come from the
    66	 * parent. In this example, all we have to do is populate the member functions
    67	 * of the parent class with the mock versions we defined.
    68	 */
    69	static int example_init(struct MOCK(example) *mock_example)
    70	{
    71		/* This is how you get a pointer to the parent class of a mock. */
    72		struct example *example = mock_get_trgt(mock_example);
    73	
    74		/*
    75		 * Here we populate the member function (method) with our mock method.
    76		 */
    77		example->foo = foo;
    78		return 0;
    79	}
    80	
    81	/*
    82	 * This registers our parent init function above, allowing KUnit to create a
    83	 * constructor for the mock.
    84	 */
  > 85	DEFINE_STRUCT_CLASS_MOCK_INIT(example, example_init);
    86	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 75873 bytes --]

  reply	other threads:[~2020-09-18 20:27 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-18 18:31 [RFC v1 00/12] kunit: introduce class mocking support Daniel Latypov
2020-09-18 18:31 ` [RFC v1 01/12] Revert "kunit: move string-stream.h to lib/kunit" Daniel Latypov
2020-09-18 22:53   ` kernel test robot
2020-09-18 18:31 ` [RFC v1 02/12] kunit: test: add kunit_stream a std::stream like logger Daniel Latypov
2020-09-18 18:31 ` [RFC v1 03/12] kunit: test: add concept of post conditions Daniel Latypov
2020-09-18 18:31 ` [RFC v1 04/12] checkpatch: add support for struct MOCK(foo) syntax Daniel Latypov
2020-09-18 18:31 ` [RFC v1 05/12] kunit: mock: add parameter list manipulation macros Daniel Latypov
2020-09-18 18:31 ` [RFC v1 06/12] kunit: expose kunit_set_failure() for use by mocking Daniel Latypov
2020-09-18 18:31 ` [RFC v1 07/12] kunit: mock: add internal mock infrastructure Daniel Latypov
2020-09-18 18:31 ` [RFC v1 08/12] kunit: mock: add basic matchers and actions Daniel Latypov
2020-09-18 21:27   ` kernel test robot
2020-09-18 21:27   ` [RFC PATCH] kunit: mock: to_mock_u8_matcher can be static kernel test robot
2020-09-19  0:24   ` [RFC v1 08/12] kunit: mock: add basic matchers and actions kernel test robot
2020-09-18 18:31 ` [RFC v1 09/12] kunit: mock: add macro machinery to pick correct format args Daniel Latypov
2020-09-18 18:31 ` [RFC v1 10/12] kunit: mock: add class mocking support Daniel Latypov
2020-09-18 20:27   ` kernel test robot [this message]
2020-09-18 22:30   ` kernel test robot
2020-09-18 22:46   ` kernel test robot
2020-09-18 22:46   ` [RFC PATCH] kunit: mock: one_param can be static kernel test robot
2020-09-18 18:31 ` [RFC v1 11/12] kunit: mock: add struct param matcher Daniel Latypov
2020-09-18 18:31 ` [RFC v1 12/12] kunit: mock: implement nice, strict and naggy mock distinctions Daniel Latypov
2020-09-23  0:24 ` [RFC v1 00/12] kunit: introduce class mocking support Daniel Latypov
2020-09-28 23:24   ` Brendan Higgins
2020-10-01 21:49     ` Daniel Latypov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202009190420.jSHO5kZZ%lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild-all@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.