[Crosstoolchain-logs] [device-tree-compiler] 10/58: tests: More thorough tests of libfdt overlay application without dtc
Vagrant Cascadian
vagrant at moszumanska.debian.org
Mon Sep 25 16:23:45 UTC 2017
This is an automated email from the git hooks/post-receive script.
vagrant pushed a commit to branch debian/master
in repository device-tree-compiler.
commit 6ea8cd944fcd09dfbda672c6bf6205ec8a5fc152
Author: David Gibson <david at gibson.dropbear.id.au>
Date: Fri Dec 9 15:56:44 2016 +1100
tests: More thorough tests of libfdt overlay application without dtc
At the moment we have some rudimentary tests of the fdt_overlay_apply()
function which don't rely on overlay generation support in dtc. This is
done by avoiding any external references in the sample overlay, in
particularly using the 'target-path' syntax instead of 'target' to avoid
needing external references in the fragment targets. Thus this test case
doesn't exercise libfdt's processing of the __fixups__ node at all.
We do test that somewhat in combination with dtc's overlay support.
However, in the interests of being able to quickly determine which side a
bug is on, it would be nice to exercise this without requiring the dtc
support.
This adds testcases to do so, by making some examples with manually
constructed __symbols__ and __fixups__ nodes. In addition we rename some
of the test data files and add some extra check_path tests to make it a bit
clearer what's going on here.
Signed-off-by: David Gibson <david at gibson.dropbear.id.au>
---
tests/overlay_base_manual_symbols.dts | 25 +++++
tests/overlay_overlay_manual_fixups.dts | 112 +++++++++++++++++++++
...lay_nodtc.dts => overlay_overlay_no_fixups.dts} | 0
tests/run_tests.sh | 26 ++++-
4 files changed, 161 insertions(+), 2 deletions(-)
diff --git a/tests/overlay_base_manual_symbols.dts b/tests/overlay_base_manual_symbols.dts
new file mode 100644
index 0000000..7e4d17d
--- /dev/null
+++ b/tests/overlay_base_manual_symbols.dts
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2016 NextThing Co
+ * Copyright (c) 2016 Free Electrons
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+/dts-v1/;
+
+/ {
+ test: test-node {
+ phandle = <&test>; /* Force phandle generation */
+ test-int-property = <42>;
+ test-str-property = "foo";
+
+ subtest: sub-test-node {
+ sub-test-property;
+ };
+ };
+ __symbols__ {
+ test = &test;
+ };
+};
+
+
diff --git a/tests/overlay_overlay_manual_fixups.dts b/tests/overlay_overlay_manual_fixups.dts
new file mode 100644
index 0000000..e34c4fc
--- /dev/null
+++ b/tests/overlay_overlay_manual_fixups.dts
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 2016 NextThing Co
+ * Copyright (c) 2016 Free Electrons
+ * Copyright (c) 2016 Konsulko Inc.
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+/dts-v1/;
+
+/* Note no /plugin/ tag - we're manually generating the metadata for
+ testing purposes */
+
+/ {
+ /* Test that we can change an int by another */
+ fragment at 0 {
+ target = <0xffffffff /*&test*/>;
+
+ __overlay__ {
+ test-int-property = <43>;
+ };
+ };
+
+ /* Test that we can replace a string by a longer one */
+ fragment at 1 {
+ target = <0xffffffff /*&test*/>;
+
+ __overlay__ {
+ test-str-property = "foobar";
+ };
+ };
+
+ /* Test that we add a new property */
+ fragment at 2 {
+ target = <0xffffffff /*&test*/>;
+
+ __overlay__ {
+ test-str-property-2 = "foobar2";
+ };
+ };
+
+ /* Test that we add a new node (by phandle) */
+ fragment at 3 {
+ target = <0xffffffff /*&test*/>;
+
+ __overlay__ {
+ new-node {
+ new-property;
+ };
+ };
+ };
+
+ fragment at 5 {
+ target = <0xffffffff /*&test*/>;
+
+ __overlay__ {
+ local: new-local-node {
+ new-property;
+ };
+ };
+ };
+
+ fragment at 6 {
+ target = <0xffffffff /*&test*/>;
+
+ __overlay__ {
+ test-phandle = <0xffffffff /*&test*/>, <&local>;
+ };
+ };
+
+ fragment at 7 {
+ target = <0xffffffff /*&test*/>;
+
+ __overlay__ {
+ test-several-phandle = <&local>, <&local>;
+ };
+ };
+
+ fragment at 8 {
+ target = <0xffffffff /*&test*/>;
+
+ __overlay__ {
+ sub-test-node {
+ new-sub-test-property;
+ };
+ };
+ };
+
+ __local_fixups__ {
+ fragment at 6 {
+ __overlay__ {
+ test-phandle = <4>;
+ };
+ };
+ fragment at 7 {
+ __overlay__ {
+ test-several-phandle = <0 4>;
+ };
+ };
+ };
+ __fixups__ {
+ test = "/fragment at 0:target:0",
+ "/fragment at 1:target:0",
+ "/fragment at 2:target:0",
+ "/fragment at 3:target:0",
+ "/fragment at 5:target:0",
+ "/fragment at 6:target:0",
+ "/fragment at 6/__overlay__:test-phandle:0",
+ "/fragment at 7:target:0",
+ "/fragment at 8:target:0";
+ };
+};
diff --git a/tests/overlay_overlay_nodtc.dts b/tests/overlay_overlay_no_fixups.dts
similarity index 100%
rename from tests/overlay_overlay_nodtc.dts
rename to tests/overlay_overlay_no_fixups.dts
diff --git a/tests/run_tests.sh b/tests/run_tests.sh
index bd94604..8ac46e6 100755
--- a/tests/run_tests.sh
+++ b/tests/run_tests.sh
@@ -171,9 +171,31 @@ BAD_FIXUP_TREES="bad_index \
# Test to exercise libfdt overlay application without dtc's overlay support
libfdt_overlay_tests () {
+ # First test a doctored overlay which requires only local fixups
run_dtc_test -I dts -O dtb -o overlay_base_no_symbols.test.dtb overlay_base.dts
- run_dtc_test -I dts -O dtb -o overlay_overlay_no_symbols.test.dtb overlay_overlay_nodtc.dts
- run_test overlay overlay_base_no_symbols.test.dtb overlay_overlay_no_symbols.test.dtb
+ run_test check_path overlay_base_no_symbols.test.dtb not-exists "/__symbols__"
+ run_test check_path overlay_base_no_symbols.test.dtb not-exists "/__fixups__"
+ run_test check_path overlay_base_no_symbols.test.dtb not-exists "/__local_fixups__"
+
+ run_dtc_test -I dts -O dtb -o overlay_overlay_no_fixups.test.dtb overlay_overlay_no_fixups.dts
+ run_test check_path overlay_overlay_no_fixups.test.dtb not-exists "/__symbols__"
+ run_test check_path overlay_overlay_no_fixups.test.dtb not-exists "/__fixups__"
+ run_test check_path overlay_overlay_no_fixups.test.dtb exists "/__local_fixups__"
+
+ run_test overlay overlay_base_no_symbols.test.dtb overlay_overlay_no_fixups.test.dtb
+
+ # Then test with manually constructed fixups
+ run_dtc_test -I dts -O dtb -o overlay_base_manual_symbols.test.dtb overlay_base_manual_symbols.dts
+ run_test check_path overlay_base_manual_symbols.test.dtb exists "/__symbols__"
+ run_test check_path overlay_base_manual_symbols.test.dtb not-exists "/__fixups__"
+ run_test check_path overlay_base_manual_symbols.test.dtb not-exists "/__local_fixups__"
+
+ run_dtc_test -I dts -O dtb -o overlay_overlay_manual_fixups.test.dtb overlay_overlay_manual_fixups.dts
+ run_test check_path overlay_overlay_manual_fixups.test.dtb not-exists "/__symbols__"
+ run_test check_path overlay_overlay_manual_fixups.test.dtb exists "/__fixups__"
+ run_test check_path overlay_overlay_manual_fixups.test.dtb exists "/__local_fixups__"
+
+ run_test overlay overlay_base_manual_symbols.test.dtb overlay_overlay_manual_fixups.test.dtb
# Bad fixup tests
for test in $BAD_FIXUP_TREES; do
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/crosstoolchain/device-tree-compiler.git
More information about the Crosstoolchain-logs
mailing list