Skip to contentSkip to conversation

libfdt: Fix sw_tree1 testcase

PATCH Applied David Gibson 2 participants 4 messages Nov 5, 2007 – Nov 6, 2007

lore
Share & tools
lore
#0 lore raw

There is a bug in the sw_tree1 testcase / utility which puts two "compatible" properties in one node in the output tree. This patch fixes the bug, and also adds a new test checking that the sw_tree1 output is equal to test_tree1.dtb as its supposed to be, which should catch future errors of this type.

tests/run_tests.sh +2 -0
Index: dtc/tests/run_tests.sh
===================================================================
@@ -71,6 +71,7 @@ libfdt_tests () {
     run_test sw_tree1
     tree1_tests sw_tree1.test.dtb
     tree1_tests unfinished_tree1.test.dtb
+    run_test dtbs_equal_ordered test_tree1.dtb sw_tree1.test.dtb
 
     # fdt_move tests
     for tree in test_tree1.dtb sw_tree1.test.dtb unfinished_tree1.test.dtb; do
@@ -112,6 +113,7 @@ libfdt_tests () {
     run_test rw_tree1
     tree1_tests rw_tree1.test.dtb
     tree1_tests_rw rw_tree1.test.dtb
+    run_test dtbs_equal_ordered test_tree1.dtb rw_tree1.test.dtb
 
     # Tests for behaviour on various sorts of corrupted trees
     run_test truncated_property
tests/sw_tree1.c +0 -1
Index: dtc/tests/sw_tree1.c
===================================================================
@@ -64,7 +64,6 @@ int main(int argc, char *argv[])
 	CHECK(fdt_begin_node(fdt, "subsubnode"));
 	CHECK(fdt_property(fdt, "compatible", "subsubnode1\0subsubnode",
 			   23));
-	CHECK(fdt_property_string(fdt, "compatible", "subsubnode1\0"));
 	CHECK(fdt_property_typed(fdt, "prop-int", TEST_VALUE_1));
 	CHECK(fdt_end_node(fdt));
 	CHECK(fdt_end_node(fdt));
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
#1 lore raw

So, like, the other day David Gibson mumbled:

Quoted 7 lines

There is a bug in the sw_tree1 testcase / utility which puts two "compatible" properties in one node in the output tree. This patch fixes the bug, and also adds a new test checking that the sw_tree1 output is equal to test_tree1.dtb as its supposed to be, which should catch future errors of this type.

This change appears to cause a test to fail. I've not looked into it beyond "make check failed":

Thanks,
jdl

----------------------------------------------------------------

[ snip ]

nop_node rw_tree1.test.dtb:     PASS
setprop rw_tree1.test.dtb:      PASS
del_property rw_tree1.test.dtb: PASS
del_node rw_tree1.test.dtb:     PASS
dtbs_equal_ordered test_tree1.dtb rw_tree1.test.dtb:    FAIL    Property name mismatch "compatible" != "prop-str" at (8, 8)
truncated_property:     PASS
dtc.sh -I dts -O dtb -o dtc_tree1.test.dtb test_tree1.dts:      PASS
get_mem_rsv dtc_tree1.test.dtb: PASS
root_node dtc_tree1.test.dtb:   PASS

[ snip ]

del_node dtc_tree1.test.dtb: PASS
dtbs_equal_ordered dtc_tree1.test.dtb test_tree1.dtb: PASS
dtc.sh -I dts -O dtb -o dtc_escapes.test.dtb escapes.dts: PASS
string_escapes dtc_escapes.test.dtb: PASS
********** TEST SUMMARY

*     Total testcases:  1216
*                PASS:  1215
*                FAIL:  1
*   Bad configuration:  0
* Strange test result:  0

**********

#2 lore raw
Quoted 11 lines · Jon Loeliger

So, like, the other day David Gibson mumbled:

Quoted 7 lines

There is a bug in the sw_tree1 testcase / utility which puts two "compatible" properties in one node in the output tree. This patch fixes the bug, and also adds a new test checking that the sw_tree1 output is equal to test_tree1.dtb as its supposed to be, which should catch future errors of this type.

This change appears to cause a test to fail. I've not looked into it beyond "make check failed":

Crud, I screwed up and gave you an intermediate version of the patch which tried to do the same thing for rw_tree1. For that to work, I'll need to write a dtbs_equal_notordered test.

Corrected version below.

libfdt: Fix sw_tree1 testcase

There is a bug in the sw_tree1 testcase / utility which puts two "compatible" properties in one node in the output tree. This patch fixes the bug, and also adds a new test checking that the sw_tree1 output is equal to test_tree1.dtb as its supposed to be, which should catch future errors of this type.

tests/run_tests.sh +1 -0
Index: dtc/tests/run_tests.sh
===================================================================
@@ -71,6 +71,7 @@
     run_test sw_tree1
     tree1_tests sw_tree1.test.dtb
     tree1_tests unfinished_tree1.test.dtb
+    run_test dtbs_equal_ordered test_tree1.dtb sw_tree1.test.dtb
 
     # fdt_move tests
     for tree in test_tree1.dtb sw_tree1.test.dtb unfinished_tree1.test.dtb; do
tests/sw_tree1.c +0 -1
Index: dtc/tests/sw_tree1.c
===================================================================
@@ -64,7 +64,6 @@
 	CHECK(fdt_begin_node(fdt, "subsubnode"));
 	CHECK(fdt_property(fdt, "compatible", "subsubnode1\0subsubnode",
 			   23));
-	CHECK(fdt_property_string(fdt, "compatible", "subsubnode1\0"));
 	CHECK(fdt_property_typed(fdt, "prop-int", TEST_VALUE_1));
 	CHECK(fdt_end_node(fdt));
 	CHECK(fdt_end_node(fdt));
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
Applied
#3 lore raw

So, like, the other day David Gibson mumbled:

Quoted 8 lines

Crud, I screwed up and gave you an intermediate version of the patch which tried to do the same thing for rw_tree1. For that to work, I'll need to write a dtbs_equal_notordered test.

Corrected version below.

libfdt: Fix sw_tree1 testcase

Quoted 7 lines

There is a bug in the sw_tree1 testcase / utility which puts two "compatible" properties in one node in the output tree. This patch fixes the bug, and also adds a new test checking that the sw_tree1 output is equal to test_tree1.dtb as its supposed to be, which should catch future errors of this type.

Applied.

Thanks,
jdl