Re: [PATCH 2/2] tests: Add test for symbol resolution

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On 9/2/24 7:17 AM, Ayush Singh wrote:
A simple test for both phandle symbols and string symbols. Also tests
chaining symbol overlays.

Signed-off-by: Ayush Singh <ayush@xxxxxxxxxxxxxxx>
---
  tests/overlay_overlay_symbols1.dts     | 12 ++++++++++++
  tests/overlay_overlay_symbols2.dts     |  9 +++++++++
  tests/overlay_overlay_symbols_user.dts | 26 ++++++++++++++++++++++++++
  tests/run_tests.sh                     | 19 +++++++++++++++++++
  4 files changed, 66 insertions(+)

diff --git a/tests/overlay_overlay_symbols1.dts b/tests/overlay_overlay_symbols1.dts
new file mode 100644
index 0000000..bd74242
--- /dev/null
+++ b/tests/overlay_overlay_symbols1.dts
@@ -0,0 +1,12 @@
+/dts-v1/;
+/plugin/;
+
+&{/} {
+	__symbols__ {
+    TEST_STR = "/test-node";

Looks like you are mixing tabs and spaces. Probably need to fix your
editor to treat .dts files like .c and use tabs for indent.

Andrew

+    TEST_PHANDLE = <&test>;
+
+    SUBTEST_STR = "/test-node/sub-test-node";
+    SUBTEST_PHANDLE = <&subtest>;
+	};
+};
diff --git a/tests/overlay_overlay_symbols2.dts b/tests/overlay_overlay_symbols2.dts
new file mode 100644
index 0000000..b8da96b
--- /dev/null
+++ b/tests/overlay_overlay_symbols2.dts
@@ -0,0 +1,9 @@
+/dts-v1/;
+/plugin/;
+
+&{/} {
+	__symbols__ {
+		TEST_CHAIN = <&TEST_PHANDLE>;
+		SUBTEST_CHAIN = <&SUBTEST_PHANDLE>;
+	};
+};
diff --git a/tests/overlay_overlay_symbols_user.dts b/tests/overlay_overlay_symbols_user.dts
new file mode 100644
index 0000000..4da2136
--- /dev/null
+++ b/tests/overlay_overlay_symbols_user.dts
@@ -0,0 +1,26 @@
+/dts-v1/;
+/plugin/;
+
+&TEST_STR {
+  str-prop = "test-node";
+};
+
+&TEST_PHANDLE {
+  phandle-prop = "test-node";
+};
+
+&TEST_CHAIN {
+  chain-prop = "test-node";
+};
+
+&SUBTEST_STR {
+  str-prop = "subtest-node";
+};
+
+&SUBTEST_PHANDLE {
+  phandle-prop = "subtest-node";
+};
+
+&SUBTEST_CHAIN {
+  chain-prop = "subtest-node";
+};
diff --git a/tests/run_tests.sh b/tests/run_tests.sh
index 937b128..56f8d0d 100755
--- a/tests/run_tests.sh
+++ b/tests/run_tests.sh
@@ -1018,6 +1018,25 @@ fdtoverlay_tests() {
      # test that the new property is installed
      run_fdtoverlay_test foobar "/test-node" "test-str-property" "-ts" ${basedtb} ${targetdtb} ${overlaydtb}
+ symbol1_overlay="$SRCDIR/overlay_overlay_symbols1.dts"
+    symbol1_overlaydtbo=overlay_overlay_symbols1.fdtoverlay.test.dtb
+    symbol2_overlay="$SRCDIR/overlay_overlay_symbols2.dts"
+    symbol2_overlaydtbo=overlay_overlay_symbols2.fdtoverlay.test.dtb
+    symbol_user_overlay="$SRCDIR/overlay_overlay_symbols_user.dts"
+    symbol_user_overlaydtbo=overlay_overlay_symbols_user.fdtoverlay.test.dtb
+
+    # test overlay symbol resolution
+    run_dtc_test -@ -I dts -O dtb -o $symbol1_overlaydtbo $symbol1_overlay
+    run_dtc_test -@ -I dts -O dtb -o $symbol2_overlaydtbo $symbol2_overlay
+    run_dtc_test -@ -I dts -O dtb -o $symbol_user_overlaydtbo $symbol_user_overlay
+
+    run_fdtoverlay_test test-node "/test-node" "str-prop" "-ts" ${basedtb} ${targetdtb} ${symbol1_overlaydtbo} ${symbol2_overlaydtbo} ${symbol_user_overlaydtbo}
+    run_fdtoverlay_test test-node "/test-node" "phandle-prop" "-ts" ${basedtb} ${targetdtb} ${symbol1_overlaydtbo} ${symbol2_overlaydtbo} ${symbol_user_overlaydtbo}
+    run_fdtoverlay_test test-node "/test-node" "chain-prop" "-ts" ${basedtb} ${targetdtb} ${symbol1_overlaydtbo} ${symbol2_overlaydtbo} ${symbol_user_overlaydtbo}
+    run_fdtoverlay_test subtest-node "/test-node/sub-test-node" "str-prop" "-ts" ${basedtb} ${targetdtb} ${symbol1_overlaydtbo} ${symbol2_overlaydtbo} ${symbol_user_overlaydtbo}
+    run_fdtoverlay_test subtest-node "/test-node/sub-test-node" "phandle-prop" "-ts" ${basedtb} ${targetdtb} ${symbol1_overlaydtbo} ${symbol2_overlaydtbo} ${symbol_user_overlaydtbo}
+    run_fdtoverlay_test subtest-node "/test-node/sub-test-node" "chain-prop" "-ts" ${basedtb} ${targetdtb} ${symbol1_overlaydtbo} ${symbol2_overlaydtbo} ${symbol_user_overlaydtbo}
+
      stacked_base="$SRCDIR/stacked_overlay_base.dts"
      stacked_basedtb=stacked_overlay_base.fdtoverlay.test.dtb
      stacked_bar="$SRCDIR/stacked_overlay_bar.dts"





[Index of Archives]     [Device Tree]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux