mbox series

[-next,00/14] Implement a ligth weight device driver test framework

Message ID 20231118104040.386381-1-zhangxiaoxu@huaweicloud.com (mailing list archive)
Headers show
Series Implement a ligth weight device driver test framework | expand

Message

huaweicloud Nov. 18, 2023, 10:40 a.m. UTC
From: Zhang Xiaoxu <zhangxiaoxu@huawei.com>

Implement a ligth weight device driver test framework, KDDV(Kernel
Device Driver Verification). Which using eBPF based bus controllers
to mockup device chipsets.

The kddv already discover the following issues:
  fc92d9e3de0b iio: health: afe4404: Fix oob read in afe4404_[read|write]_raw
  58143c1ed588 iio: health: afe4403: Fix oob read in afe4403_read_raw
  3f4033a811bc iio: filter: admv8818: close potential out-of-bounds read in __admv8818_read_[h|l]pf_freq()
  8c9a59939deb Input: raydium_ts_i2c - fix memory leak in raydium_i2c_send()
  7485edb2b6ca media: i2c: ov772x: Fix memleak in ov772x_probe()
  bab76514aca3 regulator: da9121: Fix uninit-value in da9121_assign_chip_model()
  9d47e01b9d80 power: supply: adp5061: fix out-of-bounds read in adp5061_get_chg_type()
  ...

Zhang Xiaoxu (14):
  kddv/core: Implement a ligth weight device driver test framework
  kddv/core: Allow test case config bpf program
  kddv/core: Add io fault support to bpf program
  kddv/core: Check kmsg before return from test case
  kddv/core: Support kernel memory leak detector
  kddv/core: Add page and slab fault inject support
  kddv/cmd: Add command to create/remove mockup device
  kddv/cmd: Add command to run testcases
  kddv/core: Add test support for SPI driver
  kddv/tests: Add support for testing hwmon driver
  kddv/tests/hwmon: Add test cases for max31722 driver
  kddv/tests: Add support for testing mtd driver
  kddv/tests/mtd: Add test cases for mchp23k256 driver
  kddv: Add document for kddv

 Documentation/dev-tools/index.rst             |   1 +
 Documentation/dev-tools/kddv.rst              | 183 ++++++++
 tools/testing/kddv/.gitignore                 |   3 +
 tools/testing/kddv/Makefile                   |  25 ++
 tools/testing/kddv/kddv/Makefile              |  28 ++
 tools/testing/kddv/kddv/__init__.py           |   0
 tools/testing/kddv/kddv/cmds/__init__.py      |   0
 tools/testing/kddv/kddv/cmds/mock.py          | 105 +++++
 tools/testing/kddv/kddv/cmds/test.py          |  75 ++++
 tools/testing/kddv/kddv/cmds/utils.py         |  28 ++
 tools/testing/kddv/kddv/core/__init__.py      |  13 +
 .../testing/kddv/kddv/core/buses/__init__.py  |  13 +
 tools/testing/kddv/kddv/core/buses/spi.py     |  74 +++
 tools/testing/kddv/kddv/core/consts.py        |  13 +
 tools/testing/kddv/kddv/core/ddunit.py        |  83 ++++
 tools/testing/kddv/kddv/core/device.py        |  78 ++++
 tools/testing/kddv/kddv/core/dmesg.py         |  41 ++
 tools/testing/kddv/kddv/core/driver.py        |  82 ++++
 tools/testing/kddv/kddv/core/environ.py       |  65 +++
 tools/testing/kddv/kddv/core/failnth.py       |  57 +++
 tools/testing/kddv/kddv/core/faulter.py       |  48 ++
 .../testing/kddv/kddv/core/faults/__init__.py |  13 +
 tools/testing/kddv/kddv/core/faults/fail.py   |  86 ++++
 tools/testing/kddv/kddv/core/faults/page.py   |  40 ++
 tools/testing/kddv/kddv/core/faults/slab.py   |  36 ++
 tools/testing/kddv/kddv/core/memleak.py       |  39 ++
 tools/testing/kddv/kddv/core/mockup.py        | 193 ++++++++
 tools/testing/kddv/kddv/core/model.py         |  95 ++++
 tools/testing/kddv/kddv/data/Makefile         |  21 +
 tools/testing/kddv/kddv/data/bpf/Makefile     |  22 +
 .../kddv/data/bpf/include/bpf-xfer-conf.h     | 124 +++++
 .../kddv/kddv/data/bpf/mtd/mtd-mchp23k256.c   |  72 +++
 .../kddv/kddv/data/bpf/spi/spi-xfer-base.h    |  99 ++++
 .../kddv/kddv/data/bpf/spi/spi-xfer-r1v1.c    |  51 +++
 .../kddv/kddv/data/bpf/spi/spi-xfer-r1v2.c    |  51 +++
 .../kddv/kddv/data/bpf/spi/spi-xfer-r1v3.c    |  86 ++++
 .../kddv/kddv/data/bpf/spi/spi-xfer-r2v1.c    |  51 +++
 .../kddv/kddv/data/bpf/spi/spi-xfer-r2v2.c    |  51 +++
 .../kddv/kddv/data/bpf/spi/spi-xfer-r3v1.c    |  52 +++
 .../kddv/kddv/data/bpf/spi/spi-xfer-r4v4.c    |  89 ++++
 tools/testing/kddv/kddv/tests/__init__.py     |   0
 .../testing/kddv/kddv/tests/hwmon/__init__.py | 425 ++++++++++++++++++
 .../kddv/kddv/tests/hwmon/test_max31722.py    |  40 ++
 tools/testing/kddv/kddv/tests/mtd/__init__.py |  63 +++
 .../kddv/kddv/tests/mtd/test_mchp23k256.py    |  41 ++
 45 files changed, 2855 insertions(+)
 create mode 100755 Documentation/dev-tools/kddv.rst
 create mode 100644 tools/testing/kddv/.gitignore
 create mode 100644 tools/testing/kddv/Makefile
 create mode 100644 tools/testing/kddv/kddv/Makefile
 create mode 100755 tools/testing/kddv/kddv/__init__.py
 create mode 100755 tools/testing/kddv/kddv/cmds/__init__.py
 create mode 100755 tools/testing/kddv/kddv/cmds/mock.py
 create mode 100755 tools/testing/kddv/kddv/cmds/test.py
 create mode 100755 tools/testing/kddv/kddv/cmds/utils.py
 create mode 100755 tools/testing/kddv/kddv/core/__init__.py
 create mode 100755 tools/testing/kddv/kddv/core/buses/__init__.py
 create mode 100755 tools/testing/kddv/kddv/core/buses/spi.py
 create mode 100755 tools/testing/kddv/kddv/core/consts.py
 create mode 100755 tools/testing/kddv/kddv/core/ddunit.py
 create mode 100755 tools/testing/kddv/kddv/core/device.py
 create mode 100755 tools/testing/kddv/kddv/core/dmesg.py
 create mode 100755 tools/testing/kddv/kddv/core/driver.py
 create mode 100755 tools/testing/kddv/kddv/core/environ.py
 create mode 100755 tools/testing/kddv/kddv/core/failnth.py
 create mode 100755 tools/testing/kddv/kddv/core/faulter.py
 create mode 100755 tools/testing/kddv/kddv/core/faults/__init__.py
 create mode 100755 tools/testing/kddv/kddv/core/faults/fail.py
 create mode 100755 tools/testing/kddv/kddv/core/faults/page.py
 create mode 100755 tools/testing/kddv/kddv/core/faults/slab.py
 create mode 100755 tools/testing/kddv/kddv/core/memleak.py
 create mode 100755 tools/testing/kddv/kddv/core/mockup.py
 create mode 100755 tools/testing/kddv/kddv/core/model.py
 create mode 100644 tools/testing/kddv/kddv/data/Makefile
 create mode 100644 tools/testing/kddv/kddv/data/bpf/Makefile
 create mode 100644 tools/testing/kddv/kddv/data/bpf/include/bpf-xfer-conf.h
 create mode 100644 tools/testing/kddv/kddv/data/bpf/mtd/mtd-mchp23k256.c
 create mode 100644 tools/testing/kddv/kddv/data/bpf/spi/spi-xfer-base.h
 create mode 100644 tools/testing/kddv/kddv/data/bpf/spi/spi-xfer-r1v1.c
 create mode 100644 tools/testing/kddv/kddv/data/bpf/spi/spi-xfer-r1v2.c
 create mode 100644 tools/testing/kddv/kddv/data/bpf/spi/spi-xfer-r1v3.c
 create mode 100644 tools/testing/kddv/kddv/data/bpf/spi/spi-xfer-r2v1.c
 create mode 100644 tools/testing/kddv/kddv/data/bpf/spi/spi-xfer-r2v2.c
 create mode 100644 tools/testing/kddv/kddv/data/bpf/spi/spi-xfer-r3v1.c
 create mode 100644 tools/testing/kddv/kddv/data/bpf/spi/spi-xfer-r4v4.c
 create mode 100755 tools/testing/kddv/kddv/tests/__init__.py
 create mode 100755 tools/testing/kddv/kddv/tests/hwmon/__init__.py
 create mode 100755 tools/testing/kddv/kddv/tests/hwmon/test_max31722.py
 create mode 100644 tools/testing/kddv/kddv/tests/mtd/__init__.py
 create mode 100755 tools/testing/kddv/kddv/tests/mtd/test_mchp23k256.py