summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSrinivas Kandagatla <srinivas.kandagatla@st.com>2013-05-29 12:47:38 +1000
committerDavid Gibson <david@gibson.dropbear.id.au>2013-05-29 12:48:16 +1000
commitd214655904b49938dafcb83797de3f6a0dc725c8 (patch)
treeab98204a1ce8244d34d0b610e4a7dce38b4b908b /tests
parenta58afe2eb28645641367f4eacdea2c124d291f6e (diff)
downloaddtc-d214655904b49938dafcb83797de3f6a0dc725c8.tar.gz
fdtput: expand fdt if value does not fit
If you try to insert a new node or extend a property with large value, using fdtput you will notice that it always fails. example: fdtput -v -p -ts ./tst.dtb "/node-1" "property-1" "value-1 Error at 'node-1': FDT_ERR_NOSPACE or fdtput -v -c ./tst.dtb "/node-1" Error at 'node-1': FDT_ERR_NOSPACE or fdtput -v -ts ./tst.dtb "/node" "property" "very big value" Decoding value: string: 'very big value' Value size 15 Error at 'property': FDT_ERR_NOSPACE All these error are returned from libfdt, as the size of the fdt passed has no space to accomdate these new properties. This patch adds realloc functions in fdtput to allocate new space in fdt when it detects a shortage in space for new value or node. With this patch, fdtput can insert a new node or property or extend a property with new value greater than original size. Also it packs the final blob to clean up any extra padding. Without this patch fdtput tool complains with FDT_ERR_NOSPACE when we try to add a node/property or extend the value of a property. Testcases for the new behaviour added by David Gibson. Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'tests')
-rwxr-xr-xtests/run_tests.sh6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/run_tests.sh b/tests/run_tests.sh
index d0a7f02..c0a136b 100755
--- a/tests/run_tests.sh
+++ b/tests/run_tests.sh
@@ -549,6 +549,9 @@ fdtput_tests () {
-tx "a0b0c0d deeaae ef000000"
run_fdtput_test "$(cat $text)" $dtb /randomnode blob -ts "$(cat $text)"
+ # Test expansion of the blob when insufficient room for property
+ run_fdtput_test "$(cat $text $text)" $dtb /randomnode blob -ts "$(cat $text $text)"
+
# Start again with a fresh dtb
run_dtc_test -O dtb -p $(stat -c %s $text) -o $dtb $dts
@@ -570,6 +573,9 @@ fdtput_tests () {
"-ts" "fine wine"
run_wrap_test $DTPUT $dtb -p /you/are/drunk/sir/winston slurp -ts twice
+ # Test expansion of the blob when insufficent room for a new node
+ run_wrap_test $DTPUT $dtb -cp "$(cat $text $text)/longish"
+
# Allowed to create an existing node with -p
run_wrap_test $DTPUT $dtb -cp /chosen
run_wrap_test $DTPUT $dtb -cp /chosen/son