Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 53a42093 authored by Grant Likely's avatar Grant Likely
Browse files

of: Add device tree selftests



Add some runtime test cases for the library of device tree parsing functions.

v2: - Add testcase for phandle with 0 args
    - Don't run testcases if testcase data isn't present in device tree

Signed-off-by: default avatarGrant Likely <grant.likely@secretlab.ca>
parent 15c9a0ac
Loading
Loading
Loading
Loading
+37 −0
Original line number Diff line number Diff line

/ {
	testcase-data {
		phandle-tests {
			provider0: provider0 {
				#phandle-cells = <0>;
			};

			provider1: provider1 {
				#phandle-cells = <1>;
			};

			provider2: provider2 {
				#phandle-cells = <2>;
			};

			provider3: provider3 {
				#phandle-cells = <3>;
			};

			consumer-a {
				phandle-list =	<&provider1 1>,
						<&provider2 2 0>,
						<0>,
						<&provider3 4 4 3>,
						<&provider2 5 100>,
						<&provider0>,
						<&provider1 7>;
				phandle-list-names = "first", "second", "third";

				phandle-list-bad-phandle = <12345678 0 0>;
				phandle-list-bad-args = <&provider2 1 0>,
							<&provider3 0>;
			};
		};
	};
};
+1 −0
Original line number Diff line number Diff line
/include/ "tests-phandle.dtsi"
+2 −0
Original line number Diff line number Diff line
@@ -46,3 +46,5 @@
		};
	};
};

/include/ "testcases/tests.dtsi"
+9 −0
Original line number Diff line number Diff line
@@ -15,6 +15,15 @@ config PROC_DEVICETREE
	  an image of the device tree that the kernel copies from Open
	  Firmware or other boot firmware. If unsure, say Y here.

config OF_SELFTEST
	bool "Device Tree Runtime self tests"
	help
	  This option builds in test cases for the device tree infrastructure
	  that are executed one at boot time, and the results dumped to the
	  console.

	  If unsure, say N here, but this option is safe to enable.

config OF_FLATTREE
	bool
	select DTC
+1 −0
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@ obj-$(CONFIG_OF_GPIO) += gpio.o
obj-$(CONFIG_OF_I2C)	+= of_i2c.o
obj-$(CONFIG_OF_NET)	+= of_net.o
obj-$(CONFIG_OF_SPI)	+= of_spi.o
obj-$(CONFIG_OF_SELFTEST) += selftest.o
obj-$(CONFIG_OF_MDIO)	+= of_mdio.o
obj-$(CONFIG_OF_PCI)	+= of_pci.o
obj-$(CONFIG_OF_PCI_IRQ)  += of_pci_irq.o
Loading