Browse Source
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@gibson.dropbear.id.au>main
David Gibson
8 years ago
4 changed files with 161 additions and 2 deletions
@ -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; |
||||||
|
}; |
||||||
|
}; |
||||||
|
|
||||||
|
|
@ -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@0 { |
||||||
|
target = <0xffffffff /*&test*/>; |
||||||
|
|
||||||
|
__overlay__ { |
||||||
|
test-int-property = <43>; |
||||||
|
}; |
||||||
|
}; |
||||||
|
|
||||||
|
/* Test that we can replace a string by a longer one */ |
||||||
|
fragment@1 { |
||||||
|
target = <0xffffffff /*&test*/>; |
||||||
|
|
||||||
|
__overlay__ { |
||||||
|
test-str-property = "foobar"; |
||||||
|
}; |
||||||
|
}; |
||||||
|
|
||||||
|
/* Test that we add a new property */ |
||||||
|
fragment@2 { |
||||||
|
target = <0xffffffff /*&test*/>; |
||||||
|
|
||||||
|
__overlay__ { |
||||||
|
test-str-property-2 = "foobar2"; |
||||||
|
}; |
||||||
|
}; |
||||||
|
|
||||||
|
/* Test that we add a new node (by phandle) */ |
||||||
|
fragment@3 { |
||||||
|
target = <0xffffffff /*&test*/>; |
||||||
|
|
||||||
|
__overlay__ { |
||||||
|
new-node { |
||||||
|
new-property; |
||||||
|
}; |
||||||
|
}; |
||||||
|
}; |
||||||
|
|
||||||
|
fragment@5 { |
||||||
|
target = <0xffffffff /*&test*/>; |
||||||
|
|
||||||
|
__overlay__ { |
||||||
|
local: new-local-node { |
||||||
|
new-property; |
||||||
|
}; |
||||||
|
}; |
||||||
|
}; |
||||||
|
|
||||||
|
fragment@6 { |
||||||
|
target = <0xffffffff /*&test*/>; |
||||||
|
|
||||||
|
__overlay__ { |
||||||
|
test-phandle = <0xffffffff /*&test*/>, <&local>; |
||||||
|
}; |
||||||
|
}; |
||||||
|
|
||||||
|
fragment@7 { |
||||||
|
target = <0xffffffff /*&test*/>; |
||||||
|
|
||||||
|
__overlay__ { |
||||||
|
test-several-phandle = <&local>, <&local>; |
||||||
|
}; |
||||||
|
}; |
||||||
|
|
||||||
|
fragment@8 { |
||||||
|
target = <0xffffffff /*&test*/>; |
||||||
|
|
||||||
|
__overlay__ { |
||||||
|
sub-test-node { |
||||||
|
new-sub-test-property; |
||||||
|
}; |
||||||
|
}; |
||||||
|
}; |
||||||
|
|
||||||
|
__local_fixups__ { |
||||||
|
fragment@6 { |
||||||
|
__overlay__ { |
||||||
|
test-phandle = <4>; |
||||||
|
}; |
||||||
|
}; |
||||||
|
fragment@7 { |
||||||
|
__overlay__ { |
||||||
|
test-several-phandle = <0 4>; |
||||||
|
}; |
||||||
|
}; |
||||||
|
}; |
||||||
|
__fixups__ { |
||||||
|
test = "/fragment@0:target:0", |
||||||
|
"/fragment@1:target:0", |
||||||
|
"/fragment@2:target:0", |
||||||
|
"/fragment@3:target:0", |
||||||
|
"/fragment@5:target:0", |
||||||
|
"/fragment@6:target:0", |
||||||
|
"/fragment@6/__overlay__:test-phandle:0", |
||||||
|
"/fragment@7:target:0", |
||||||
|
"/fragment@8:target:0"; |
||||||
|
}; |
||||||
|
}; |
Loading…
Reference in new issue