aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Documentation/devicetree/of_unittest.rst
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation/devicetree/of_unittest.rst')
-rw-r--r--Documentation/devicetree/of_unittest.rst45
1 files changed, 32 insertions, 13 deletions
diff --git a/Documentation/devicetree/of_unittest.rst b/Documentation/devicetree/of_unittest.rst
index dea05214f3ad..a6c05962add3 100644
--- a/Documentation/devicetree/of_unittest.rst
+++ b/Documentation/devicetree/of_unittest.rst
@@ -1,8 +1,8 @@
.. SPDX-License-Identifier: GPL-2.0
-==================================
-Open Firmware Device Tree Unittest
-==================================
+=================================
+Open Firmware Devicetree Unittest
+=================================
Author: Gaurav Minocha <gaurav.minocha.os@gmail.com>
@@ -24,20 +24,39 @@ from the unflattened device tree data structure. This interface is used by
most of the device drivers in various use cases.
-2. Test-data
+2. Verbose Output (EXPECT)
+==========================
+
+If unittest detects a problem it will print a warning or error message to
+the console. Unittest also triggers warning and error messages from other
+kernel code as a result of intentionally bad unittest data. This has led
+to confusion as to whether the triggered messages are an expected result
+of a test or whether there is a real problem that is independent of unittest.
+
+'EXPECT \ : text' (begin) and 'EXPECT / : text' (end) messages have been
+added to unittest to report that a warning or error is expected. The
+begin is printed before triggering the warning or error, and the end is
+printed after triggering the warning or error.
+
+The EXPECT messages result in very noisy console messages that are difficult
+to read. The script scripts/dtc/of_unittest_expect was created to filter
+this verbosity and highlight mismatches between triggered warnings and
+errors vs expected warnings and errors. More information is available
+from 'scripts/dtc/of_unittest_expect --help'.
+
+
+3. Test-data
============
The Device Tree Source file (drivers/of/unittest-data/testcases.dts) contains
the test data required for executing the unit tests automated in
-drivers/of/unittest.c. Currently, following Device Tree Source Include files
-(.dtsi) are included in testcases.dts::
+drivers/of/unittest.c. See the content of the folder::
+
+ drivers/of/unittest-data/tests-*.dtsi
- drivers/of/unittest-data/tests-interrupts.dtsi
- drivers/of/unittest-data/tests-platform.dtsi
- drivers/of/unittest-data/tests-phandle.dtsi
- drivers/of/unittest-data/tests-match.dtsi
+for the Device Tree Source Include files (.dtsi) included in testcases.dts.
-When the kernel is build with OF_SELFTEST enabled, then the following make
+When the kernel is build with CONFIG_OF_UNITTEST enabled, then the following make
rule::
$(obj)/%.dtb: $(src)/%.dts FORCE
@@ -56,7 +75,7 @@ The assembly file is compiled into an object file (testcases.dtb.o), and is
linked into the kernel image.
-2.1. Adding the test data
+3.1. Adding the test data
-------------------------
Un-flattened device tree structure:
@@ -191,7 +210,7 @@ properties are updated to the live tree's node by calling the function
update_node_properties().
-2.2. Removing the test data
+3.2. Removing the test data
---------------------------
Once the test case execution is complete, selftest_data_remove is called in