Skip to content

of: unittest: add overlay gpio test to catch gpio hog problem

[email protected] linux-devicetree lkml 2 versions – Applied

Status from this message: Applied, thanks.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 8 repliesApplied
  2. v12 patches 6 repliesSuperseded

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/2of: unittest: add overlay gpio test to catch gpio hog problemdrivers/of/unittest-data/Makefile drivers/of/unittest-data/overlay_gpio_01.dts drivers/of/unittest-data/overlay_gpio_02a.dts +5 more+370 -17 replies
2/2of: unittest: annotate warnings triggered by unittestdrivers/of/unittest.c+345 -301 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/2] of: unittest: add overlay gpio test to catch gpio hog problem

From: Frank Rowand <[email protected]>

Geert reports that gpio hog nodes are not properly processed when the gpio hog node is added via an overlay reply and provides an patch to fix the problem [1].

Add a unittest that shows the problem. Unittest will report "1 failed" test before applying Geert's patch and "0 failed" after applying Geert's patch.

I did not have a development system for which it would be easy to experiment with applying an overlay containing a gpio hog, so I instead created this unittest that uses a fake gpio node.

Some tests in the devicetree unittests result in printk messages from the code being tested. It can be difficult to determine whether the messages are the result of unittest or are potentially reporting bugs that should be fixed. The most recent example of a person asking whether to be concerned about these messages is [2].

Patch 2 adds annotations for all messages triggered by unittests, except KERN_DEBUG messages. (KERN_DEBUG is a special case due to the possible interaction of CONFIG_DYNAMIC_DEBUG.)

The annotations added in patch 2/2 add a small amount of verbosity to the console output. I have created a proof of concept tool to explore (1) how test harnesses could use the annotations and
(2) how to make the resulting console output easier to read and understand as a human being. The tool 'of_unittest_expect' is available at https://github.com/frowand/dt_tools

The format of the annotations is expected to change when unittests are converted to use the kunit infrastructure when the broader testing community has an opportunity to discuss the implementation of annotations of test triggered messages.

[1] https://lore.kernel.org/r/[email protected]
[2] https://lore.kernel.org/r/[email protected]

Frank Rowand (2):
of: unittest: add overlay gpio test to catch gpio hog problem
of: unittest: annotate warnings triggered by unittest

 drivers/of/unittest-data/Makefile             |   8 +-
 drivers/of/unittest-data/overlay_gpio_01.dts  |  23 +
 drivers/of/unittest-data/overlay_gpio_02a.dts |  16 +
 drivers/of/unittest-data/overlay_gpio_02b.dts |  16 +
 drivers/of/unittest-data/overlay_gpio_03.dts  |  23 +
 drivers/of/unittest-data/overlay_gpio_04a.dts |  16 +
 drivers/of/unittest-data/overlay_gpio_04b.dts |  16 +
 drivers/of/unittest.c                         | 628 ++++++++++++++++++++++++--
 8 files changed, 715 insertions(+), 31 deletions(-)
 create mode 100644 drivers/of/unittest-data/overlay_gpio_01.dts
 create mode 100644 drivers/of/unittest-data/overlay_gpio_02a.dts
 create mode 100644 drivers/of/unittest-data/overlay_gpio_02b.dts
 create mode 100644 drivers/of/unittest-data/overlay_gpio_03.dts
 create mode 100644 drivers/of/unittest-data/overlay_gpio_04a.dts
 create mode 100644 drivers/of/unittest-data/overlay_gpio_04b.dts
Signature · 1 line
Frank Rowand <[email protected]>