+++ /dev/null
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Test device tree file for dtoc
- *
- * Copyright 2017 Google, Inc
- */
-
- /dts-v1/;
-
-/ {
-};
+++ /dev/null
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Test device tree file for dtoc
- *
- * Copyright 2018 Google, Inc
- */
-
-/dts-v1/;
-
-/ {
- #address-cells = <1>;
- #size-cells = <1>;
- spl-test {
- u-boot,dm-pre-reloc;
- compatible = "sandbox,spl-test";
- intval = <1>;
- };
-
- spl-test2 {
- u-boot,dm-pre-reloc;
- compatible = "sandbox,spl-test";
- intarray = <5>;
- };
-};
+++ /dev/null
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Test device tree file for dtoc
- *
- * Copyright 2017 Google, Inc
- */
-
- /dts-v1/;
-
-/ {
- #address-cells = <1>;
- #size-cells = <1>;
-
- test1 {
- u-boot,dm-pre-reloc;
- compatible = "test1";
- reg = <0x1234 0x5678>;
- };
-
- test2 {
- u-boot,dm-pre-reloc;
- compatible = "test2";
- reg = <0x12345678 0x98765432 2 3>;
- };
-
-};
+++ /dev/null
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Test device tree file for dtoc
- *
- * Copyright 2017 Google, Inc
- */
-
-/dts-v1/;
-
-/ {
- #address-cells = <1>;
- #size-cells = <2>;
-
- test1 {
- u-boot,dm-pre-reloc;
- compatible = "test1";
- reg = <0x1234 0x5678 0x0>;
- };
-
- test2 {
- u-boot,dm-pre-reloc;
- compatible = "test2";
- reg = <0x12345678 0x98765432 0x10987654>;
- };
-
- test3 {
- u-boot,dm-pre-reloc;
- compatible = "test3";
- reg = <0x12345678 0x98765432 0x10987654 2 0 3>;
- };
-
-};
+++ /dev/null
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Test device tree file for dtoc
- *
- * Copyright 2017 Google, Inc
- */
-
- /dts-v1/;
-
-/ {
- #address-cells = <2>;
- #size-cells = <2>;
-
- test1 {
- u-boot,dm-pre-reloc;
- compatible = "test1";
- reg = /bits/ 64 <0x1234 0x5678>;
- };
-
- test2 {
- u-boot,dm-pre-reloc;
- compatible = "test2";
- reg = /bits/ 64 <0x1234567890123456 0x9876543210987654>;
- };
-
- test3 {
- u-boot,dm-pre-reloc;
- compatible = "test3";
- reg = /bits/ 64 <0x1234567890123456 0x9876543210987654 2 3>;
- };
-
-};
+++ /dev/null
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Test device tree file for dtoc
- *
- * Copyright 2017 Google, Inc
- */
-
-/dts-v1/;
-
-/ {
- #address-cells = <2>;
- #size-cells = <1>;
-
- test1 {
- u-boot,dm-pre-reloc;
- compatible = "test1";
- reg = <0x1234 0x0 0x5678>;
- };
-
- test2 {
- u-boot,dm-pre-reloc;
- compatible = "test2";
- reg = <0x12345678 0x90123456 0x98765432>;
- };
-
- test3 {
- u-boot,dm-pre-reloc;
- compatible = "test3";
- reg = <0x12345678 0x90123456 0x98765432 0 2 3>;
- };
-
-};
+++ /dev/null
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Test device tree file for dtoc
- *
- * Copyright 2017 Google, Inc
- */
-
- /dts-v1/;
-
-/ {
- spl-test {
- u-boot,dm-pre-reloc;
- compatible = "compat1", "compat2.1-fred", "compat3";
- intval = <1>;
- };
-
- spl-test2 {
- u-boot,dm-pre-reloc;
- compatible = "compat1", "simple_bus";
- intval = <1>;
- };
-};
+++ /dev/null
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Test device tree file for dtoc
- *
- * Copyright 2018 Google, Inc
- */
-
-/dts-v1/;
-
-/ {
- #address-cells = <1>;
- #size-cells = <1>;
- spl-test {
- compatible = "test";
- reg = "fre";
- };
-};
+++ /dev/null
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Test device tree file for dtoc
- *
- * Copyright 2018 Google, Inc
- */
-
-/dts-v1/;
-
-/ {
- #address-cells = <1>;
- #size-cells = <1>;
- spl-test {
- compatible = "test";
- reg = <1 2 3>;
- };
-};
+++ /dev/null
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Test device tree file for dtoc
- *
- * Copyright 2020 Collabora Ltd.
- */
-
-/dts-v1/;
-
-/ {
- gpio_a: gpios@0 {
- u-boot,dm-pre-reloc;
- gpio-controller;
- compatible = "sandbox_gpio_alias";
- #gpio-cells = <1>;
- gpio-bank-name = "a";
- sandbox,gpio-count = <20>;
- };
-
-};
+++ /dev/null
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Test device tree file for dtoc
- *
- * Copyright 2017 Google, Inc
- */
-
- /dts-v1/;
-
-/ {
-};
+++ /dev/null
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Test device tree file for dtoc
- *
- * Copyright 2017 Google, Inc
- */
-
-/dts-v1/;
-
-/ {
- spl-test {
- u-boot,dm-pre-reloc;
- compatible = "invalid";
- };
-};
+++ /dev/null
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Test device tree file for dtoc
- *
- * Copyright 2017 Google, Inc
- */
-
- /dts-v1/;
-
-/ {
- phandle: phandle-target {
- u-boot,dm-pre-reloc;
- compatible = "target";
- intval = <0>;
- #clock-cells = <0>;
- };
-
- phandle_1: phandle2-target {
- u-boot,dm-pre-reloc;
- compatible = "target";
- intval = <1>;
- #clock-cells = <1>;
- };
- phandle_2: phandle3-target {
- u-boot,dm-pre-reloc;
- compatible = "target";
- intval = <2>;
- #clock-cells = <2>;
- };
-
- phandle-source {
- u-boot,dm-pre-reloc;
- compatible = "source";
- clocks = <&phandle &phandle_1 11 &phandle_2 12 13 &phandle>;
- };
-
- phandle-source2 {
- u-boot,dm-pre-reloc;
- compatible = "source";
- clocks = <&phandle>;
- };
-};
+++ /dev/null
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Test device tree file for dtoc
- *
- * Copyright 2018 Google, Inc
- */
-
-/dts-v1/;
-
-/ {
- phandle-source {
- u-boot,dm-pre-reloc;
- compatible = "source";
- clocks = <20>; /* Invalid phandle */
- };
-};
+++ /dev/null
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Test device tree file for dtoc
- *
- * Copyright 2018 Google, Inc
- */
-
-/dts-v1/;
-
-/ {
- phandle: phandle-target {
- u-boot,dm-pre-reloc;
- compatible = "target";
- intval = <0>;
- };
-
- phandle-source2 {
- u-boot,dm-pre-reloc;
- compatible = "source";
- clocks = <&phandle>;
- };
-};
+++ /dev/null
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Test device tree file for dtoc
- *
- * Copyright 2020 Collabora Ltd.
- */
-
-/dts-v1/;
-
-/ {
- phandle: phandle-target {
- u-boot,dm-pre-reloc;
- compatible = "target";
- intval = <0>;
- #gpio-cells = <0>;
- };
-
- phandle_1: phandle2-target {
- u-boot,dm-pre-reloc;
- compatible = "target";
- intval = <1>;
- #gpio-cells = <1>;
- };
- phandle_2: phandle3-target {
- u-boot,dm-pre-reloc;
- compatible = "target";
- intval = <2>;
- #gpio-cells = <2>;
- };
-
- phandle-source {
- u-boot,dm-pre-reloc;
- compatible = "source";
- cd-gpios = <&phandle &phandle_1 11 &phandle_2 12 13 &phandle>;
- };
-
- phandle-source2 {
- u-boot,dm-pre-reloc;
- compatible = "source";
- cd-gpios = <&phandle>;
- };
-};
+++ /dev/null
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Test device tree file for dtoc
- *
- * Copyright 2018 Google, Inc
- */
-
-/dts-v1/;
-
-/ {
-
- phandle-source2 {
- u-boot,dm-pre-reloc;
- compatible = "source";
- clocks = <&phandle>;
- };
-
- phandle: phandle-target {
- u-boot,dm-pre-reloc;
- compatible = "target";
- #clock-cells = <0>;
- };
-};
+++ /dev/null
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Test device tree file for dtoc
- *
- * Copyright 2018 Google, Inc
- */
-
-/dts-v1/;
-
-/ {
- phandle: phandle-target {
- u-boot,dm-pre-reloc;
- compatible = "target";
- intval = <0>;
- #clock-cells = <0>;
- };
-
- phandle-source2 {
- u-boot,dm-pre-reloc;
- compatible = "source";
- clocks = <&phandle>;
- };
-};
+++ /dev/null
-DM_DRIVER_ALIAS(sandbox_gpio, sandbox_gpio_alias2)
+++ /dev/null
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Test device tree file for dtoc
- *
- * Copyright 2017 Google, Inc
- */
-
- /dts-v1/;
-
-/ {
- #address-cells = <1>;
- #size-cells = <1>;
- spl-test {
- u-boot,dm-pre-reloc;
- compatible = "sandbox,spl-test";
- boolval;
- intval = <1>;
- intarray = <2 3 4>;
- byteval = [05];
- bytearray = [06];
- longbytearray = [09 0a 0b 0c 0d 0e 0f 10 11];
- stringval = "message";
- stringarray = "multi-word", "message";
- notstring = [20 21 22 10 00];
- };
-
- spl-test2 {
- u-boot,dm-pre-reloc;
- compatible = "sandbox,spl-test";
- intval = <3>;
- intarray = <5>;
- byteval = [08];
- bytearray = [01 23 34];
- longbytearray = [09 0a 0b 0c];
- stringval = "message2";
- stringarray = "another", "multi-word", "message";
- acpi-name = "\\_SB.GPO0";
- };
-
- spl-test3 {
- u-boot,dm-pre-reloc;
- compatible = "sandbox,spl-test";
- stringarray = "one";
- longbytearray = [09 0a 0b 0c 0d 0e 0f 10];
- };
-
- i2c@0 {
- compatible = "sandbox,i2c-test";
- u-boot,dm-pre-reloc;
- #address-cells = <1>;
- #size-cells = <0>;
- pmic@9 {
- compatible = "sandbox,pmic-test";
- u-boot,dm-pre-reloc;
- reg = <9>;
- low-power;
- };
- };
-};
--- /dev/null
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Test device tree file for dtoc
+ *
+ * Copyright 2017 Google, Inc
+ */
+
+ /dts-v1/;
+
+/ {
+};
--- /dev/null
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Test device tree file for dtoc
+ *
+ * Copyright 2018 Google, Inc
+ */
+
+/dts-v1/;
+
+/ {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ spl-test {
+ u-boot,dm-pre-reloc;
+ compatible = "sandbox,spl-test";
+ intval = <1>;
+ };
+
+ spl-test2 {
+ u-boot,dm-pre-reloc;
+ compatible = "sandbox,spl-test";
+ intarray = <5>;
+ };
+};
--- /dev/null
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Test device tree file for dtoc
+ *
+ * Copyright 2017 Google, Inc
+ */
+
+ /dts-v1/;
+
+/ {
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ test1 {
+ u-boot,dm-pre-reloc;
+ compatible = "test1";
+ reg = <0x1234 0x5678>;
+ };
+
+ test2 {
+ u-boot,dm-pre-reloc;
+ compatible = "test2";
+ reg = <0x12345678 0x98765432 2 3>;
+ };
+
+};
--- /dev/null
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Test device tree file for dtoc
+ *
+ * Copyright 2017 Google, Inc
+ */
+
+/dts-v1/;
+
+/ {
+ #address-cells = <1>;
+ #size-cells = <2>;
+
+ test1 {
+ u-boot,dm-pre-reloc;
+ compatible = "test1";
+ reg = <0x1234 0x5678 0x0>;
+ };
+
+ test2 {
+ u-boot,dm-pre-reloc;
+ compatible = "test2";
+ reg = <0x12345678 0x98765432 0x10987654>;
+ };
+
+ test3 {
+ u-boot,dm-pre-reloc;
+ compatible = "test3";
+ reg = <0x12345678 0x98765432 0x10987654 2 0 3>;
+ };
+
+};
--- /dev/null
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Test device tree file for dtoc
+ *
+ * Copyright 2017 Google, Inc
+ */
+
+ /dts-v1/;
+
+/ {
+ #address-cells = <2>;
+ #size-cells = <2>;
+
+ test1 {
+ u-boot,dm-pre-reloc;
+ compatible = "test1";
+ reg = /bits/ 64 <0x1234 0x5678>;
+ };
+
+ test2 {
+ u-boot,dm-pre-reloc;
+ compatible = "test2";
+ reg = /bits/ 64 <0x1234567890123456 0x9876543210987654>;
+ };
+
+ test3 {
+ u-boot,dm-pre-reloc;
+ compatible = "test3";
+ reg = /bits/ 64 <0x1234567890123456 0x9876543210987654 2 3>;
+ };
+
+};
--- /dev/null
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Test device tree file for dtoc
+ *
+ * Copyright 2017 Google, Inc
+ */
+
+/dts-v1/;
+
+/ {
+ #address-cells = <2>;
+ #size-cells = <1>;
+
+ test1 {
+ u-boot,dm-pre-reloc;
+ compatible = "test1";
+ reg = <0x1234 0x0 0x5678>;
+ };
+
+ test2 {
+ u-boot,dm-pre-reloc;
+ compatible = "test2";
+ reg = <0x12345678 0x90123456 0x98765432>;
+ };
+
+ test3 {
+ u-boot,dm-pre-reloc;
+ compatible = "test3";
+ reg = <0x12345678 0x90123456 0x98765432 0 2 3>;
+ };
+
+};
--- /dev/null
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Test device tree file for dtoc
+ *
+ * Copyright 2017 Google, Inc
+ */
+
+ /dts-v1/;
+
+/ {
+ spl-test {
+ u-boot,dm-pre-reloc;
+ compatible = "compat1", "compat2.1-fred", "compat3";
+ intval = <1>;
+ };
+
+ spl-test2 {
+ u-boot,dm-pre-reloc;
+ compatible = "compat1", "simple_bus";
+ intval = <1>;
+ };
+};
--- /dev/null
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Test device tree file for dtoc
+ *
+ * Copyright 2018 Google, Inc
+ */
+
+/dts-v1/;
+
+/ {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ spl-test {
+ compatible = "test";
+ reg = "fre";
+ };
+};
--- /dev/null
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Test device tree file for dtoc
+ *
+ * Copyright 2018 Google, Inc
+ */
+
+/dts-v1/;
+
+/ {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ spl-test {
+ compatible = "test";
+ reg = <1 2 3>;
+ };
+};
--- /dev/null
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Test device tree file for dtoc
+ *
+ * Copyright 2020 Collabora Ltd.
+ */
+
+/dts-v1/;
+
+/ {
+ gpio_a: gpios@0 {
+ u-boot,dm-pre-reloc;
+ gpio-controller;
+ compatible = "sandbox_gpio_alias";
+ #gpio-cells = <1>;
+ gpio-bank-name = "a";
+ sandbox,gpio-count = <20>;
+ };
+
+};
--- /dev/null
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Test device tree file for dtoc
+ *
+ * Copyright 2017 Google, Inc
+ */
+
+ /dts-v1/;
+
+/ {
+};
--- /dev/null
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Test device tree file for dtoc
+ *
+ * Copyright 2017 Google, Inc
+ */
+
+/dts-v1/;
+
+/ {
+ spl-test {
+ u-boot,dm-pre-reloc;
+ compatible = "invalid";
+ };
+};
--- /dev/null
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Test device tree file for dtoc
+ *
+ * Copyright 2017 Google, Inc
+ */
+
+ /dts-v1/;
+
+/ {
+ phandle: phandle-target {
+ u-boot,dm-pre-reloc;
+ compatible = "target";
+ intval = <0>;
+ #clock-cells = <0>;
+ };
+
+ phandle_1: phandle2-target {
+ u-boot,dm-pre-reloc;
+ compatible = "target";
+ intval = <1>;
+ #clock-cells = <1>;
+ };
+ phandle_2: phandle3-target {
+ u-boot,dm-pre-reloc;
+ compatible = "target";
+ intval = <2>;
+ #clock-cells = <2>;
+ };
+
+ phandle-source {
+ u-boot,dm-pre-reloc;
+ compatible = "source";
+ clocks = <&phandle &phandle_1 11 &phandle_2 12 13 &phandle>;
+ };
+
+ phandle-source2 {
+ u-boot,dm-pre-reloc;
+ compatible = "source";
+ clocks = <&phandle>;
+ };
+};
--- /dev/null
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Test device tree file for dtoc
+ *
+ * Copyright 2018 Google, Inc
+ */
+
+/dts-v1/;
+
+/ {
+ phandle-source {
+ u-boot,dm-pre-reloc;
+ compatible = "source";
+ clocks = <20>; /* Invalid phandle */
+ };
+};
--- /dev/null
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Test device tree file for dtoc
+ *
+ * Copyright 2018 Google, Inc
+ */
+
+/dts-v1/;
+
+/ {
+ phandle: phandle-target {
+ u-boot,dm-pre-reloc;
+ compatible = "target";
+ intval = <0>;
+ };
+
+ phandle-source2 {
+ u-boot,dm-pre-reloc;
+ compatible = "source";
+ clocks = <&phandle>;
+ };
+};
--- /dev/null
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Test device tree file for dtoc
+ *
+ * Copyright 2020 Collabora Ltd.
+ */
+
+/dts-v1/;
+
+/ {
+ phandle: phandle-target {
+ u-boot,dm-pre-reloc;
+ compatible = "target";
+ intval = <0>;
+ #gpio-cells = <0>;
+ };
+
+ phandle_1: phandle2-target {
+ u-boot,dm-pre-reloc;
+ compatible = "target";
+ intval = <1>;
+ #gpio-cells = <1>;
+ };
+ phandle_2: phandle3-target {
+ u-boot,dm-pre-reloc;
+ compatible = "target";
+ intval = <2>;
+ #gpio-cells = <2>;
+ };
+
+ phandle-source {
+ u-boot,dm-pre-reloc;
+ compatible = "source";
+ cd-gpios = <&phandle &phandle_1 11 &phandle_2 12 13 &phandle>;
+ };
+
+ phandle-source2 {
+ u-boot,dm-pre-reloc;
+ compatible = "source";
+ cd-gpios = <&phandle>;
+ };
+};
--- /dev/null
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Test device tree file for dtoc
+ *
+ * Copyright 2018 Google, Inc
+ */
+
+/dts-v1/;
+
+/ {
+
+ phandle-source2 {
+ u-boot,dm-pre-reloc;
+ compatible = "source";
+ clocks = <&phandle>;
+ };
+
+ phandle: phandle-target {
+ u-boot,dm-pre-reloc;
+ compatible = "target";
+ #clock-cells = <0>;
+ };
+};
--- /dev/null
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Test device tree file for dtoc
+ *
+ * Copyright 2018 Google, Inc
+ */
+
+/dts-v1/;
+
+/ {
+ phandle: phandle-target {
+ u-boot,dm-pre-reloc;
+ compatible = "target";
+ intval = <0>;
+ #clock-cells = <0>;
+ };
+
+ phandle-source2 {
+ u-boot,dm-pre-reloc;
+ compatible = "source";
+ clocks = <&phandle>;
+ };
+};
--- /dev/null
+DM_DRIVER_ALIAS(sandbox_gpio, sandbox_gpio_alias2)
--- /dev/null
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Test device tree file for dtoc
+ *
+ * Copyright 2017 Google, Inc
+ */
+
+ /dts-v1/;
+
+/ {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ spl-test {
+ u-boot,dm-pre-reloc;
+ compatible = "sandbox,spl-test";
+ boolval;
+ intval = <1>;
+ intarray = <2 3 4>;
+ byteval = [05];
+ bytearray = [06];
+ longbytearray = [09 0a 0b 0c 0d 0e 0f 10 11];
+ stringval = "message";
+ stringarray = "multi-word", "message";
+ notstring = [20 21 22 10 00];
+ };
+
+ spl-test2 {
+ u-boot,dm-pre-reloc;
+ compatible = "sandbox,spl-test";
+ intval = <3>;
+ intarray = <5>;
+ byteval = [08];
+ bytearray = [01 23 34];
+ longbytearray = [09 0a 0b 0c];
+ stringval = "message2";
+ stringarray = "another", "multi-word", "message";
+ acpi-name = "\\_SB.GPO0";
+ };
+
+ spl-test3 {
+ u-boot,dm-pre-reloc;
+ compatible = "sandbox,spl-test";
+ stringarray = "one";
+ longbytearray = [09 0a 0b 0c 0d 0e 0f 10];
+ };
+
+ i2c@0 {
+ compatible = "sandbox,i2c-test";
+ u-boot,dm-pre-reloc;
+ #address-cells = <1>;
+ #size-cells = <0>;
+ pmic@9 {
+ compatible = "sandbox,pmic-test";
+ u-boot,dm-pre-reloc;
+ reg = <9>;
+ low-power;
+ };
+ };
+};
Returns:
str: Filename of compiled file in output directory
"""
- return fdt_util.EnsureCompiled(os.path.join(OUR_PATH, dts_fname),
+ return fdt_util.EnsureCompiled(os.path.join(OUR_PATH, 'test', dts_fname),
capture_stderr=capture_stderr)
data = dtb.GetContents()[offset:offset + len(prop.value)]
return prop, [chr(x) for x in data]
+def find_dtb_file(dts_fname):
+ """Locate a test file in the test/ directory
+
+ Args:
+ dts_fname (str): Filename to find, e.g. 'dtoc_test_simple.dts]
+
+ Returns:
+ str: Path to the test filename
+ """
+ return os.path.join('tools/dtoc/test', dts_fname)
+
class TestFdt(unittest.TestCase):
"""Tests for the Fdt module
tools.FinaliseOutputDir()
def setUp(self):
- self.dtb = fdt.FdtScan('tools/dtoc/dtoc_test_simple.dts')
+ self.dtb = fdt.FdtScan(find_dtb_file('dtoc_test_simple.dts'))
def testFdt(self):
"""Test that we can open an Fdt"""
tools.FinaliseOutputDir()
def setUp(self):
- self.dtb = fdt.FdtScan('tools/dtoc/dtoc_test_simple.dts')
+ self.dtb = fdt.FdtScan(find_dtb_file('dtoc_test_simple.dts'))
self.node = self.dtb.GetNode('/spl-test')
def testOffset(self):
def testLookupPhandle(self):
"""Test looking up a single phandle"""
- dtb = fdt.FdtScan('tools/dtoc/dtoc_test_phandle.dts')
+ dtb = fdt.FdtScan(find_dtb_file('dtoc_test_phandle.dts'))
node = dtb.GetNode('/phandle-source2')
prop = node.props['clocks']
target = dtb.GetNode('/phandle-target')
tools.FinaliseOutputDir()
def setUp(self):
- self.dtb = fdt.FdtScan('tools/dtoc/dtoc_test_simple.dts')
+ self.dtb = fdt.FdtScan(find_dtb_file('dtoc_test_simple.dts'))
self.node = self.dtb.GetNode('/spl-test')
self.fdt = self.dtb.GetFdtObj()
self.assertEqual(None, self.dtb.GetNode('missing'))
def testPhandle(self):
- dtb = fdt.FdtScan('tools/dtoc/dtoc_test_phandle.dts')
+ dtb = fdt.FdtScan(find_dtb_file('dtoc_test_phandle.dts'))
node = dtb.GetNode('/phandle-source2')
prop = node.props['clocks']
self.assertTrue(fdt32_to_cpu(prop.value) > 0)
tools.FinaliseOutputDir()
def setUp(self):
- self.dtb = fdt.FdtScan('tools/dtoc/dtoc_test_simple.dts')
+ self.dtb = fdt.FdtScan(find_dtb_file('dtoc_test_simple.dts'))
self.node = self.dtb.GetNode('/spl-test')
def testGetInt(self):
str(e.exception))
def testGetPhandleList(self):
- dtb = fdt.FdtScan('tools/dtoc/dtoc_test_phandle.dts')
+ dtb = fdt.FdtScan(find_dtb_file('dtoc_test_phandle.dts'))
node = dtb.GetNode('/phandle-source2')
self.assertEqual([1], fdt_util.GetPhandleList(node, 'clocks'))
node = dtb.GetNode('/phandle-source')
self.assertEqual(0, fdt_util.fdt_cells_to_cpu(val, 0))
self.assertEqual(2, fdt_util.fdt_cells_to_cpu(val, 1))
- dtb2 = fdt.FdtScan('tools/dtoc/dtoc_test_addr64.dts')
+ dtb2 = fdt.FdtScan(find_dtb_file('dtoc_test_addr64.dts'))
node1 = dtb2.GetNode('/test1')
val = node1.props['reg'].value
self.assertEqual(0x1234, fdt_util.fdt_cells_to_cpu(val, 2))
def testEnsureCompiled(self):
"""Test a degenerate case of this function (file already compiled)"""
- dtb = fdt_util.EnsureCompiled('tools/dtoc/dtoc_test_simple.dts')
+ dtb = fdt_util.EnsureCompiled(find_dtb_file('dtoc_test_simple.dts'))
self.assertEqual(dtb, fdt_util.EnsureCompiled(dtb))
def testEnsureCompiledTmpdir(self):
old_outdir = tools.outdir
tools.outdir= None
tmpdir = tempfile.mkdtemp(prefix='test_fdt.')
- dtb = fdt_util.EnsureCompiled('tools/dtoc/dtoc_test_simple.dts',
+ dtb = fdt_util.EnsureCompiled(find_dtb_file('dtoc_test_simple.dts'),
tmpdir)
self.assertEqual(tmpdir, os.path.dirname(dtb))
shutil.rmtree(tmpdir)
def test_additional(self):
"""Test with additional drivers to scan"""
scan = src_scan.Scanner(
- None, True, [None, '', 'tools/dtoc/dtoc_test_scan_drivers.cxx'])
+ None, True,
+ [None, '', 'tools/dtoc/test/dtoc_test_scan_drivers.cxx'])
scan.scan_drivers()
self.assertIn('sandbox_gpio_alias2', scan._driver_aliases)
self.assertEqual('sandbox_gpio',