Re: [PATCH v2 2/2] tests: Add test for append-property

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



On 8/30/24 06:36, Simon Glass wrote:

Hi Ayush,

On Thu, 29 Aug 2024 at 14:04, Ayush Singh <ayush@xxxxxxxxxxxxxxx> wrote:
- Test /append-property/ on a string and int array.
- Also test on subnode property.

Signed-off-by: Ayush Singh <ayush@xxxxxxxxxxxxxxx>
---
  tests/append_prop.dts | 21 +++++++++++++++++++++
  tests/run_tests.sh    |  7 +++++++
  2 files changed, 28 insertions(+)

diff --git a/tests/append_prop.dts b/tests/append_prop.dts
new file mode 100644
index 0000000..248d4ed
--- /dev/null
+++ b/tests/append_prop.dts
@@ -0,0 +1,21 @@
+/dts-v1/;
+
+/ {
+       str-prop = "0";
+       num-prop = <2>;
+
+       subnode{
+               str-prop = "0";
+               num-prop = <2>;
+       };
+};
+
+/ {
+       /append-property/ str-prop = "1";
+       /append-property/ num-prop = <1>;
+
+       subnode{
+               /append-property/ str-prop = "1";
+               /append-property/ num-prop = <1>;
+       };
+};
diff --git a/tests/run_tests.sh b/tests/run_tests.sh
index 937b128..571980a 100755
--- a/tests/run_tests.sh
+++ b/tests/run_tests.sh
@@ -708,6 +708,13 @@ dtc_tests () {
      run_dtc_test -I dts -O dtb -o dtc_tree1_delete.test.dtb "$SRCDIR/test_tree1_delete.dts"
      tree1_tests dtc_tree1_delete.test.dtb

+    # Check prop append functionality
+    run_dtc_test -I dts -O dtb -o append_prop.test.dtb "$SRCDIR/append_prop.dts"
+    run_fdtget_test "0 1" append_prop.test.dtb "/" "str-prop"
+    run_fdtget_test "2 1" append_prop.test.dtb "/" "num-prop"
+    run_fdtget_test "0 1" append_prop.test.dtb "/subnode" "str-prop"
+    run_fdtget_test "2 1" append_prop.test.dtb "/subnode" "num-prop"
+
      # Check omit-if-no-ref functionality
      run_dtc_test -I dts -O dtb -o omit-no-ref.test.dtb "$SRCDIR/omit-no-ref.dts"
      run_test check_path omit-no-ref.test.dtb not-exists "/node1"
I wonder what happens when you try to append but there is no existing
property? Or when you append something empty?

Regards,
Simon


Currently, it will just create a new property. I have mentioned this as an Open Item in the cover letter. We can make it fail if that makes more sense.


Ayush Singh





[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