[0/7] of: unittest: new node lifecycle tests

Message ID 20230213185702.395776-1-frowand.list@gmail.com
Headers
Series of: unittest: new node lifecycle tests |

Message

Frank Rowand Feb. 13, 2023, 6:56 p.m. UTC
  Create new devicetree node lifecycle tests.

The tests introduce use of EXPECT_NOT messages, similar to EXPECT
messages.  This requires updating scripts/dtc/of_unittest_expect
to process EXPECT_NOT messages.

The new tests revealed an issue in printk formatting when using
format "%pOF" on a node with a reference count of zero.  A patch
is included to the fix the caller which revealed the issue.

Update kconfig unittest help to further explain that unittests
should only be enabled for developer kernels.  Also add info
about using scripts/dtc/of_unittest_expect to process the output
of unittests.

Add an additional consistency check to of_node_release(), which
is the function that potentially frees node related memory when
the node's reference count is decremented to zero.

Add docbook documentation to the devicetree node creation functions
about caller responsibility to call of_node_put() and how the
memory free process works.

Frank Rowand (7):
  of: prepare to add processing of EXPECT_NOT to of_unittest_expect
  of: add processing of EXPECT_NOT to of_unittest_expect
  of: update kconfig unittest help
  of: unittest: add node lifecycle tests
  of: do not use "%pOF" printk format on node with refcount of zero
  of: add consistency check to of_node_release()
  of: dynamic: add lifecycle docbook info to node creation functions

 drivers/of/Kconfig                            |  14 +-
 drivers/of/dynamic.c                          |  31 ++-
 .../of/unittest-data/testcases_common.dtsi    |   1 +
 drivers/of/unittest-data/tests-lifecycle.dtsi |   8 +
 drivers/of/unittest.c                         | 148 +++++++++++++-
 include/linux/of.h                            |  11 ++
 scripts/dtc/of_unittest_expect                | 183 +++++++++++++++---
 7 files changed, 365 insertions(+), 31 deletions(-)
 create mode 100644 drivers/of/unittest-data/tests-lifecycle.dtsi
  

Comments

Rob Herring Feb. 17, 2023, 9:44 p.m. UTC | #1
On Mon, Feb 13, 2023 at 12:56:55PM -0600, Frank Rowand wrote:
> Create new devicetree node lifecycle tests.
> 
> The tests introduce use of EXPECT_NOT messages, similar to EXPECT
> messages.  This requires updating scripts/dtc/of_unittest_expect
> to process EXPECT_NOT messages.
> 
> The new tests revealed an issue in printk formatting when using
> format "%pOF" on a node with a reference count of zero.  A patch
> is included to the fix the caller which revealed the issue.
> 
> Update kconfig unittest help to further explain that unittests
> should only be enabled for developer kernels.  Also add info
> about using scripts/dtc/of_unittest_expect to process the output
> of unittests.
> 
> Add an additional consistency check to of_node_release(), which
> is the function that potentially frees node related memory when
> the node's reference count is decremented to zero.
> 
> Add docbook documentation to the devicetree node creation functions
> about caller responsibility to call of_node_put() and how the
> memory free process works.
> 
> Frank Rowand (7):
>   of: prepare to add processing of EXPECT_NOT to of_unittest_expect
>   of: add processing of EXPECT_NOT to of_unittest_expect
>   of: update kconfig unittest help
>   of: unittest: add node lifecycle tests
>   of: do not use "%pOF" printk format on node with refcount of zero
>   of: add consistency check to of_node_release()
>   of: dynamic: add lifecycle docbook info to node creation functions

Series applied.

Rob