summaryrefslogtreecommitdiff
path: root/drivers/of/unittest-data
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@linaro.org>2014-11-04 13:24:45 +0000
committerGrant Likely <grant.likely@linaro.org>2014-11-04 16:43:07 +0000
commit19fd74879a32fb10357e0cda9c8050f01bb3eeb8 (patch)
treedaa661511b4a8c9f4e7a6d87f18429850c903fa2 /drivers/of/unittest-data
parent851da976dc1d72becc03e144b38c4efab9e7b361 (diff)
of/unittest: Rename selftest.c to unittest.c
This is unit testing code. It should use that name because it makes more sense than 'selftest'. Rename the files to match and rename the config variable. Signed-off-by: Grant Likely <grant.likely@linaro.org>
Diffstat (limited to 'drivers/of/unittest-data')
-rw-r--r--drivers/of/unittest-data/testcases.dts50
-rw-r--r--drivers/of/unittest-data/tests-interrupts.dtsi71
-rw-r--r--drivers/of/unittest-data/tests-match.dtsi19
-rw-r--r--drivers/of/unittest-data/tests-phandle.dtsi48
-rw-r--r--drivers/of/unittest-data/tests-platform.dtsi35
5 files changed, 223 insertions, 0 deletions
diff --git a/drivers/of/unittest-data/testcases.dts b/drivers/of/unittest-data/testcases.dts
new file mode 100644
index 000000000000..6994e15c24bf
--- /dev/null
+++ b/drivers/of/unittest-data/testcases.dts
@@ -0,0 +1,50 @@
+/dts-v1/;
+/ {
+ testcase-data {
+ changeset {
+ prop-update = "hello";
+ prop-remove = "world";
+ node-remove {
+ };
+ };
+ };
+};
+#include "tests-phandle.dtsi"
+#include "tests-interrupts.dtsi"
+#include "tests-match.dtsi"
+#include "tests-platform.dtsi"
+
+/*
+ * phandle fixup data - generated by dtc patches that aren't upstream.
+ * This data must be regenerated whenever phandle references are modified in
+ * the testdata tree.
+ *
+ * The format of this data may be subject to change. For the time being consider
+ * this a kernel-internal data format.
+ */
+/ { __local_fixups__ {
+ fixup = "/testcase-data/testcase-device2:interrupt-parent:0",
+ "/testcase-data/testcase-device1:interrupt-parent:0",
+ "/testcase-data/interrupts/interrupts-extended0:interrupts-extended:60",
+ "/testcase-data/interrupts/interrupts-extended0:interrupts-extended:52",
+ "/testcase-data/interrupts/interrupts-extended0:interrupts-extended:44",
+ "/testcase-data/interrupts/interrupts-extended0:interrupts-extended:36",
+ "/testcase-data/interrupts/interrupts-extended0:interrupts-extended:24",
+ "/testcase-data/interrupts/interrupts-extended0:interrupts-extended:8",
+ "/testcase-data/interrupts/interrupts-extended0:interrupts-extended:0",
+ "/testcase-data/interrupts/interrupts1:interrupt-parent:0",
+ "/testcase-data/interrupts/interrupts0:interrupt-parent:0",
+ "/testcase-data/interrupts/intmap1:interrupt-map:12",
+ "/testcase-data/interrupts/intmap0:interrupt-map:52",
+ "/testcase-data/interrupts/intmap0:interrupt-map:36",
+ "/testcase-data/interrupts/intmap0:interrupt-map:16",
+ "/testcase-data/interrupts/intmap0:interrupt-map:4",
+ "/testcase-data/phandle-tests/consumer-a:phandle-list-bad-args:12",
+ "/testcase-data/phandle-tests/consumer-a:phandle-list-bad-args:0",
+ "/testcase-data/phandle-tests/consumer-a:phandle-list:56",
+ "/testcase-data/phandle-tests/consumer-a:phandle-list:52",
+ "/testcase-data/phandle-tests/consumer-a:phandle-list:40",
+ "/testcase-data/phandle-tests/consumer-a:phandle-list:24",
+ "/testcase-data/phandle-tests/consumer-a:phandle-list:8",
+ "/testcase-data/phandle-tests/consumer-a:phandle-list:0";
+}; };
diff --git a/drivers/of/unittest-data/tests-interrupts.dtsi b/drivers/of/unittest-data/tests-interrupts.dtsi
new file mode 100644
index 000000000000..da4695f60351
--- /dev/null
+++ b/drivers/of/unittest-data/tests-interrupts.dtsi
@@ -0,0 +1,71 @@
+
+/ {
+ testcase-data {
+ interrupts {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ test_intc0: intc0 {
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+
+ test_intc1: intc1 {
+ interrupt-controller;
+ #interrupt-cells = <3>;
+ };
+
+ test_intc2: intc2 {
+ interrupt-controller;
+ #interrupt-cells = <2>;
+ };
+
+ test_intmap0: intmap0 {
+ #interrupt-cells = <1>;
+ #address-cells = <0>;
+ interrupt-map = <1 &test_intc0 9>,
+ <2 &test_intc1 10 11 12>,
+ <3 &test_intc2 13 14>,
+ <4 &test_intc2 15 16>;
+ };
+
+ test_intmap1: intmap1 {
+ #interrupt-cells = <2>;
+ interrupt-map = <0x5000 1 2 &test_intc0 15>;
+ };
+
+ interrupts0 {
+ interrupt-parent = <&test_intc0>;
+ interrupts = <1>, <2>, <3>, <4>;
+ };
+
+ interrupts1 {
+ interrupt-parent = <&test_intmap0>;
+ interrupts = <1>, <2>, <3>, <4>;
+ };
+
+ interrupts-extended0 {
+ reg = <0x5000 0x100>;
+ interrupts-extended = <&test_intc0 1>,
+ <&test_intc1 2 3 4>,
+ <&test_intc2 5 6>,
+ <&test_intmap0 1>,
+ <&test_intmap0 2>,
+ <&test_intmap0 3>,
+ <&test_intmap1 1 2>;
+ };
+ };
+
+ testcase-device1 {
+ compatible = "testcase-device";
+ interrupt-parent = <&test_intc0>;
+ interrupts = <1>;
+ };
+
+ testcase-device2 {
+ compatible = "testcase-device";
+ interrupt-parent = <&test_intc2>;
+ interrupts = <1>; /* invalid specifier - too short */
+ };
+ };
+
+};
diff --git a/drivers/of/unittest-data/tests-match.dtsi b/drivers/of/unittest-data/tests-match.dtsi
new file mode 100644
index 000000000000..c9e541129534
--- /dev/null
+++ b/drivers/of/unittest-data/tests-match.dtsi
@@ -0,0 +1,19 @@
+
+/ {
+ testcase-data {
+ match-node {
+ name0 { };
+ name1 { device_type = "type1"; };
+ a { name2 { device_type = "type1"; }; };
+ b { name2 { }; };
+ c { name2 { device_type = "type2"; }; };
+ name3 { compatible = "compat3"; };
+ name4 { compatible = "compat2", "compat3"; };
+ name5 { compatible = "compat2", "compat3"; };
+ name6 { compatible = "compat1", "compat2", "compat3"; };
+ name7 { compatible = "compat2"; device_type = "type1"; };
+ name8 { compatible = "compat2"; device_type = "type1"; };
+ name9 { compatible = "compat2"; };
+ };
+ };
+};
diff --git a/drivers/of/unittest-data/tests-phandle.dtsi b/drivers/of/unittest-data/tests-phandle.dtsi
new file mode 100644
index 000000000000..5b1527e8a7fb
--- /dev/null
+++ b/drivers/of/unittest-data/tests-phandle.dtsi
@@ -0,0 +1,48 @@
+
+/ {
+ aliases {
+ testcase-alias = &testcase;
+ };
+
+ testcase: testcase-data {
+ security-password = "password";
+ duplicate-name = "duplicate";
+ duplicate-name { };
+ 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>;
+ empty-property;
+ string-property = "foobar";
+ unterminated-string = [40 41 42 43];
+ unterminated-string-list = "first", "second", [40 41 42 43];
+ };
+ };
+ };
+};
diff --git a/drivers/of/unittest-data/tests-platform.dtsi b/drivers/of/unittest-data/tests-platform.dtsi
new file mode 100644
index 000000000000..eb20eeb2b062
--- /dev/null
+++ b/drivers/of/unittest-data/tests-platform.dtsi
@@ -0,0 +1,35 @@
+
+/ {
+ testcase-data {
+ platform-tests {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ test-device@0 {
+ compatible = "test-device";
+ reg = <0x0>;
+
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ dev@100 {
+ compatible = "test-sub-device";
+ reg = <0x100>;
+ };
+ };
+
+ test-device@1 {
+ compatible = "test-device";
+ reg = <0x1>;
+
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ dev@100 {
+ compatible = "test-sub-device";
+ reg = <0x100>;
+ };
+ };
+ };
+ };
+};