All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH v2 0/4] fpga: add initial KUnit tests for the subsystem
@ 2023-03-10 17:04 Marco Pagani
  2023-03-10 17:04 ` [RFC PATCH v2 1/4] fpga: add fake FPGA manager Marco Pagani
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Marco Pagani @ 2023-03-10 17:04 UTC (permalink / raw)
  To: Moritz Fischer, Wu Hao, Xu Yilun, Tom Rix
  Cc: Marco Pagani, linux-kernel, linux-fpga

This patch set introduces initial KUnit test suites for the FPGA subsystem.

Tests can be run using:
[user@localhost linux]$ ./tools/testing/kunit/kunit.py run --kunitconfig=drivers/fpga/tests

v2:
- Restructured code into multiple suites to test components in isolation
- Reduced code duplication using init and exit methods
- Using a get_bridges() method to build the list of bridges just before programming
- Regions and Bridges are organized topologically
- Changed bitstream/bit to images
- Allocate images dynamically
- Renamed fpga-tests to fpga-test
- Simplified Kconfig
- Add license info to the fpga-test module

Marco Pagani (4):
  fpga: add fake FPGA manager
  fpga: add fake FPGA bridge
  fpga: add fake FPGA region
  fpga: add initial KUnit test suites

 drivers/fpga/Kconfig                  |   2 +
 drivers/fpga/Makefile                 |   3 +
 drivers/fpga/tests/.kunitconfig       |   5 +
 drivers/fpga/tests/Kconfig            |  11 +
 drivers/fpga/tests/Makefile           |   6 +
 drivers/fpga/tests/fake-fpga-bridge.c | 228 ++++++++++++
 drivers/fpga/tests/fake-fpga-bridge.h |  36 ++
 drivers/fpga/tests/fake-fpga-mgr.c    | 369 +++++++++++++++++++
 drivers/fpga/tests/fake-fpga-mgr.h    |  42 +++
 drivers/fpga/tests/fake-fpga-region.c | 219 +++++++++++
 drivers/fpga/tests/fake-fpga-region.h |  38 ++
 drivers/fpga/tests/fpga-test.c        | 501 ++++++++++++++++++++++++++
 12 files changed, 1460 insertions(+)
 create mode 100644 drivers/fpga/tests/.kunitconfig
 create mode 100644 drivers/fpga/tests/Kconfig
 create mode 100644 drivers/fpga/tests/Makefile
 create mode 100644 drivers/fpga/tests/fake-fpga-bridge.c
 create mode 100644 drivers/fpga/tests/fake-fpga-bridge.h
 create mode 100644 drivers/fpga/tests/fake-fpga-mgr.c
 create mode 100644 drivers/fpga/tests/fake-fpga-mgr.h
 create mode 100644 drivers/fpga/tests/fake-fpga-region.c
 create mode 100644 drivers/fpga/tests/fake-fpga-region.h
 create mode 100644 drivers/fpga/tests/fpga-test.c

-- 
2.39.2


^ permalink raw reply	[flat|nested] 13+ messages in thread
* Re: [RFC PATCH v2 4/4] fpga: add initial KUnit test suites
@ 2023-03-18  9:02 kernel test robot
  0 siblings, 0 replies; 13+ messages in thread
From: kernel test robot @ 2023-03-18  9:02 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp

:::::: 
:::::: Manual check reason: "low confidence static check first_new_problem: drivers/fpga/tests/fake-fpga-region.c:146:2: warning: Undefined or garbage value returned to caller [clang-analyzer-core.uninitialized.UndefReturn]"
:::::: 

BCC: lkp@intel.com
CC: llvm@lists.linux.dev
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <20230310170412.708363-5-marpagan@redhat.com>
References: <20230310170412.708363-5-marpagan@redhat.com>
TO: Marco Pagani <marpagan@redhat.com>

Hi Marco,

[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on linus/master]
[also build test WARNING on v6.3-rc2 next-20230317]
[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#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Marco-Pagani/fpga-add-fake-FPGA-manager/20230311-010757
patch link:    https://lore.kernel.org/r/20230310170412.708363-5-marpagan%40redhat.com
patch subject: [RFC PATCH v2 4/4] fpga: add initial KUnit test suites
:::::: branch date: 8 days ago
:::::: commit date: 8 days ago
config: s390-randconfig-c005-20230312 (https://download.01.org/0day-ci/archive/20230318/202303181604.tXQ4uHom-lkp@intel.com/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project 67409911353323ca5edf2049ef0df54132fa1ca7)
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/intel-lab-lkp/linux/commit/6af16afaf84ee6f061e6953eebca1a786c5be576
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Marco-Pagani/fpga-add-fake-FPGA-manager/20230311-010757
        git checkout 6af16afaf84ee6f061e6953eebca1a786c5be576
        # save the config file
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=s390 clang-analyzer  olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=s390 clang-analyzer 

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/r/202303181604.tXQ4uHom-lkp@intel.com/

clang_analyzer warnings: (new ones prefixed by >>)
               ^~~~~~~~~~~~~~~~~~~~~~
   drivers/hwtracing/stm/core.c:633:2: note: Taking true branch
           if (!stmf->output.nr_chans) {
           ^
   drivers/hwtracing/stm/core.c:637:3: note: Taking false branch
                   get_task_comm(comm, current);
                   ^
   include/linux/sched.h:1989:2: note: expanded from macro 'get_task_comm'
           BUILD_BUG_ON(sizeof(buf) != TASK_COMM_LEN);     \
           ^
   include/linux/build_bug.h:50:2: note: expanded from macro 'BUILD_BUG_ON'
           BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
           ^
   include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG'
   #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                       ^
   include/linux/compiler_types.h:397:2: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ^
   include/linux/compiler_types.h:385:2: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:377:3: note: expanded from macro '__compiletime_assert'
                   if (!(condition))                                       \
                   ^
   drivers/hwtracing/stm/core.c:637:3: note: Loop condition is false.  Exiting loop
                   get_task_comm(comm, current);
                   ^
   include/linux/sched.h:1989:2: note: expanded from macro 'get_task_comm'
           BUILD_BUG_ON(sizeof(buf) != TASK_COMM_LEN);     \
           ^
   include/linux/build_bug.h:50:2: note: expanded from macro 'BUILD_BUG_ON'
           BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
           ^
   include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG'
   #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                       ^
   include/linux/compiler_types.h:397:2: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ^
   include/linux/compiler_types.h:385:2: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:369:2: note: expanded from macro '__compiletime_assert'
           do {                                                            \
           ^
   drivers/hwtracing/stm/core.c:637:23: note: Dereference of null pointer
                   get_task_comm(comm, current);
                                       ^
   arch/s390/include/asm/current.h:17:45: note: expanded from macro 'current'
   #define current ((struct task_struct *const)S390_lowcore.current_task)
                                               ^
   arch/s390/include/asm/lowcore.h:215:22: note: expanded from macro 'S390_lowcore'
   #define S390_lowcore (*((struct lowcore *) 0))
                        ^
   include/linux/sched.h:1990:36: note: expanded from macro 'get_task_comm'
           __get_task_comm(buf, sizeof(buf), tsk);         \
                                             ^~~
   Suppressed 9 warnings (9 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   9 warnings generated.
   Suppressed 9 warnings (9 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   21 warnings generated.
   Suppressed 21 warnings (9 in non-user code, 12 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   21 warnings generated.
   Suppressed 21 warnings (9 in non-user code, 12 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   21 warnings generated.
   Suppressed 21 warnings (9 in non-user code, 12 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   9 warnings generated.
   Suppressed 9 warnings (9 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   21 warnings generated.
   Suppressed 21 warnings (9 in non-user code, 12 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   22 warnings generated.
   drivers/fpga/altera-pr-ip-core.c:188:2: warning: Value stored to 'val' is never read [clang-analyzer-deadcode.DeadStores]
           val = readl(priv->reg_base + ALT_PR_CSR_OFST);
           ^
   drivers/fpga/altera-pr-ip-core.c:188:2: note: Value stored to 'val' is never read
   Suppressed 21 warnings (9 in non-user code, 12 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   23 warnings generated.
   drivers/fpga/altera-freeze-bridge.c:69:4: warning: Value stored to 'ctrl' is never read [clang-analyzer-deadcode.DeadStores]
                           ctrl = readl(priv->base_addr + FREEZE_CSR_CTRL_OFFSET);
                           ^
   drivers/fpga/altera-freeze-bridge.c:69:4: note: Value stored to 'ctrl' is never read
   drivers/fpga/altera-freeze-bridge.c:150:2: warning: Value stored to 'status' is never read [clang-analyzer-deadcode.DeadStores]
           status = readl(priv->base_addr + FREEZE_CSR_STATUS_OFFSET);
           ^
   drivers/fpga/altera-freeze-bridge.c:150:2: note: Value stored to 'status' is never read
   Suppressed 21 warnings (9 in non-user code, 12 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   9 warnings generated.
   Suppressed 9 warnings (9 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   10 warnings generated.
>> drivers/fpga/tests/fake-fpga-region.c:146:2: warning: Undefined or garbage value returned to caller [clang-analyzer-core.uninitialized.UndefReturn]
           return ret;
           ^      ~~~
   drivers/fpga/tests/fake-fpga-region.c:133:2: note: 'ret' declared without an initial value
           int ret;
           ^~~~~~~
   drivers/fpga/tests/fake-fpga-region.c:137:2: note: Loop condition is false. Execution continues on line 146
           list_for_each_entry_safe(bridge, tmp, &priv->bridge_list, node) {
           ^
   include/linux/list.h:776:2: note: expanded from macro 'list_for_each_entry_safe'
           for (pos = list_first_entry(head, typeof(*pos), member),        \
           ^
   drivers/fpga/tests/fake-fpga-region.c:146:2: note: Undefined or garbage value returned to caller
           return ret;
           ^      ~~~
   Suppressed 9 warnings (9 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   23 warnings generated.
   Suppressed 23 warnings (11 in non-user code, 12 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   23 warnings generated.
   Suppressed 23 warnings (11 in non-user code, 12 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   21 warnings generated.
   Suppressed 21 warnings (9 in non-user code, 12 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   10 warnings generated.
   Suppressed 10 warnings (10 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   10 warnings generated.
   Suppressed 10 warnings (10 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   21 warnings generated.
   Suppressed 21 warnings (9 in non-user code, 12 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   22 warnings generated.
   Suppressed 22 warnings (10 in non-user code, 12 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   10 warnings generated.
   Suppressed 10 warnings (10 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   10 warnings generated.
   Suppressed 10 warnings (10 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   10 warnings generated.
   Suppressed 10 warnings (10 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   22 warnings generated.
   Suppressed 22 warnings (10 in non-user code, 12 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   22 warnings generated.
   Suppressed 22 warnings (10 in non-user code, 12 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   22 warnings generated.
   Suppressed 22 warnings (10 in non-user code, 12 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   23 warnings generated.
   drivers/iio/light/ltr501.c:139:8: warning: Excessive padding in 'struct ltr501_chip_info' (16 padding bytes, where 0 is optimal). Optimal fields order: als_gain, ps_gain, channels, info, info_no_irq, als_gain_tbl_size, ps_gain_tbl_size, no_channels, partid, als_mode_active, als_gain_mask, als_gain_shift, consider reordering the fields or adding explicit padding members [clang-analyzer-optin.performance.Padding]
   struct ltr501_chip_info {
   ~~~~~~~^~~~~~~~~~~~~~~~~~
   drivers/iio/light/ltr501.c:139:8: note: Excessive padding in 'struct ltr501_chip_info' (16 padding bytes, where 0 is optimal). Optimal fields order: als_gain, ps_gain, channels, info, info_no_irq, als_gain_tbl_size, ps_gain_tbl_size, no_channels, partid, als_mode_active, als_gain_mask, als_gain_shift, consider reordering the fields or adding explicit padding members
   struct ltr501_chip_info {
   ~~~~~~~^~~~~~~~~~~~~~~~~~
   Suppressed 22 warnings (10 in non-user code, 12 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   22 warnings generated.
   drivers/parport/share.c:1124:23: warning: Dereference of null pointer [clang-analyzer-core.NullDereference]
                           if (signal_pending(current))
                                              ^
   arch/s390/include/asm/current.h:17:45: note: expanded from macro 'current'
   #define current ((struct task_struct *const)S390_lowcore.current_task)
                                               ^~~~~~~~~~~~~~~~~~~~~~~~~
   arch/s390/include/asm/lowcore.h:215:22: note: expanded from macro 'S390_lowcore'
   #define S390_lowcore (*((struct lowcore *) 0))
                        ^
   drivers/parport/share.c:1103:6: note: Assuming the condition is true
           if (r == -EAGAIN) {
               ^~~~~~~~~~~~
   drivers/parport/share.c:1103:2: note: Taking true branch
           if (r == -EAGAIN) {
           ^
   drivers/parport/share.c:1121:7: note: Assuming field 'waiting' is not equal to 0
                   if (dev->waiting) {
                       ^~~~~~~~~~~~
   drivers/parport/share.c:1121:3: note: Taking true branch
                   if (dev->waiting) {
                   ^
   drivers/parport/share.c:1122:4: note: Loop condition is false.  Exiting loop
                           wait_event_interruptible(dev->wait_q,
                           ^
   include/linux/wait.h:499:2: note: expanded from macro 'wait_event_interruptible'
           might_sleep();                                                          \
           ^
   include/linux/kernel.h:143:42: note: expanded from macro 'might_sleep'
           do { __might_sleep(__FILE__, __LINE__); might_resched(); } while (0)
                                                   ^
   include/linux/kernel.h:120:26: note: expanded from macro 'might_resched'
   # define might_resched() do { } while (0)
                            ^
   drivers/parport/share.c:1122:4: note: Loop condition is false.  Exiting loop
                           wait_event_interruptible(dev->wait_q,

vim +146 drivers/fpga/tests/fake-fpga-region.c

318b50638db45d Marco Pagani 2023-03-10  128  
318b50638db45d Marco Pagani 2023-03-10  129  static int fake_region_get_bridges(struct fpga_region *region)
318b50638db45d Marco Pagani 2023-03-10  130  {
318b50638db45d Marco Pagani 2023-03-10  131  	struct fake_region_priv *priv;
318b50638db45d Marco Pagani 2023-03-10  132  	struct fpga_bridge *bridge, *tmp;
318b50638db45d Marco Pagani 2023-03-10  133  	int ret;
318b50638db45d Marco Pagani 2023-03-10  134  
318b50638db45d Marco Pagani 2023-03-10  135  	priv = region->priv;
318b50638db45d Marco Pagani 2023-03-10  136  
318b50638db45d Marco Pagani 2023-03-10  137  	list_for_each_entry_safe(bridge, tmp, &priv->bridge_list, node) {
318b50638db45d Marco Pagani 2023-03-10  138  		list_del(&bridge->node);
318b50638db45d Marco Pagani 2023-03-10  139  		ret = fpga_bridge_get_to_list(bridge->dev.parent,
318b50638db45d Marco Pagani 2023-03-10  140  					      region->info,
318b50638db45d Marco Pagani 2023-03-10  141  					      &region->bridge_list);
318b50638db45d Marco Pagani 2023-03-10  142  		if (ret)
318b50638db45d Marco Pagani 2023-03-10  143  			break;
318b50638db45d Marco Pagani 2023-03-10  144  	}
318b50638db45d Marco Pagani 2023-03-10  145  
318b50638db45d Marco Pagani 2023-03-10 @146  	return ret;
318b50638db45d Marco Pagani 2023-03-10  147  }
318b50638db45d Marco Pagani 2023-03-10  148  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests

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

end of thread, other threads:[~2023-03-25  7:39 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-10 17:04 [RFC PATCH v2 0/4] fpga: add initial KUnit tests for the subsystem Marco Pagani
2023-03-10 17:04 ` [RFC PATCH v2 1/4] fpga: add fake FPGA manager Marco Pagani
2023-03-10 17:04 ` [RFC PATCH v2 2/4] fpga: add fake FPGA bridge Marco Pagani
2023-03-17  8:32   ` Xu Yilun
2023-03-21 17:33     ` Marco Pagani
2023-03-25  7:27       ` Xu Yilun
2023-03-10 17:04 ` [RFC PATCH v2 3/4] fpga: add fake FPGA region Marco Pagani
2023-03-17 10:40   ` Xu Yilun
2023-03-21 20:07     ` Marco Pagani
2023-03-25  7:11       ` Xu Yilun
2023-03-10 17:04 ` [RFC PATCH v2 4/4] fpga: add initial KUnit test suites Marco Pagani
2023-03-11  9:58   ` kernel test robot
2023-03-18  9:02 kernel test robot

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.