Re: [PATCH v2 2/2] Add label printing test

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



On 13/09/2018 13:36, Łukasz Dobrowolski wrote:
Some time ago 32b9c6130762 ("Preserve datatype markers when emitting dts
format") broke label printing this test should prevent such regression.
This should also serve as definition how labels should be printed.

Signed-off-by: Łukasz Dobrowolski <lukasz.dobrowolski@xxxxxxxxx>

I just posted an alternative implementation of patch 1/2. This test case will also succeed with that patch with a couple of minor modifications due to the naive 'cmp' method currently used for testcase compairing .dts files.

---
  tests/label-preservation.dts | 17 +++++++++++++++++
  tests/run_tests.sh           |  6 ++++++
  2 files changed, 23 insertions(+)
  create mode 100644 tests/label-preservation.dts

diff --git a/tests/label-preservation.dts b/tests/label-preservation.dts
new file mode 100644
index 000000000000..19fd5dcb24ea
--- /dev/null
+++ b/tests/label-preservation.dts
@@ -0,0 +1,17 @@
+/dts-v1/;
+
+memrsv2: /memreserve/	0x2000000000000000 0x0100000000000000;
+/ {
+
+	node: randomnode {
+		prop: string = str: "foo", str_mid: "stuffstuff\t\t\t\n\n\n" str_end:;
+		blob = byte: [ 0a 0b 0c 0d byte_mid: de ea ad be ef byte_end: ];

I had to move the ']' before 'byteend:'

+		ref = cell: < 0x01 0x00 cell_mid: 0xffffffff cell_end: >;

Same for cell_end:

+		mixed = "abc", pre: [ 12 34 ], post: gap: aligned: < 0x0a 0x0b 0x0c >;
+		tricky1 = [ 61 lt1: 62 63 00 ];
+
+		subnode: child {
+			phandle = < 0x01 >;
+		};
+	};
+};
diff --git a/tests/run_tests.sh b/tests/run_tests.sh
index adc4daebd945..3b1466188540 100755
--- a/tests/run_tests.sh
+++ b/tests/run_tests.sh
@@ -568,6 +568,12 @@ dtc_tests () {
          run_wrap_test cmp $tree $tree.test.dts
      done
+ # Check -Odts preserving label information
+    for tree in label-preservation.dts; do
+        run_dtc_test -I dts -O dts -o $tree.test.dts $tree
+        run_wrap_test cmp $tree $tree.test.dts
+    done
+
      # Check -Oyaml output
      if pkg-config --exists yaml-0.1; then
              for tree in type-preservation; do





[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