From 3407a9c362f9c3930c68ab0548184a8215a9f8bd Mon Sep 17 00:00:00 2001 From: SzuWei Lin Date: Tue, 28 Mar 2017 17:14:56 +0800 Subject: Fix the problem of not enough merged dtb size The dtc has suffix compression for string, ex. "a_string", "string" and "ing", these strings could share a same string in dtb string table. libufdt assumes the merged dtb size shouldn't larger than the summary size of base and overlay dtb, and doesn't apply the same compression. The patch add a test case for this case and fix the problem. Bug: 35255584 Test: tests/run_tests.sh Change-Id: I6bac1e2823ca90dbdb852452544c41ab040a5ccc --- tests/run_tests.sh | 3 +++ tests/testdata/suffix_compress-base.dts | 18 ++++++++++++++++++ tests/testdata/suffix_compress-overlay.dts | 6 ++++++ 3 files changed, 27 insertions(+) create mode 100644 tests/testdata/suffix_compress-base.dts create mode 100644 tests/testdata/suffix_compress-overlay.dts (limited to 'tests') diff --git a/tests/run_tests.sh b/tests/run_tests.sh index 4513950..ea3e5ba 100755 --- a/tests/run_tests.sh +++ b/tests/run_tests.sh @@ -69,6 +69,9 @@ main() { run_test_case \ "empty_overlay" \ "Run test about overlaying with empty base and overlay dt" + run_test_case \ + "suffix_compress" \ + "Run test about string suffix compression" ) if [ $? -ne 0 ]; then diff --git a/tests/testdata/suffix_compress-base.dts b/tests/testdata/suffix_compress-base.dts new file mode 100644 index 0000000..1c51284 --- /dev/null +++ b/tests/testdata/suffix_compress-base.dts @@ -0,0 +1,18 @@ +/dts-v1/; + +/ { + /* these name could be suffix compressed in dtb after compiled */ + longlonglonglonglonglonglonglonglonglonglonglongname: longlonglonglonglonglonglonglonglonglonglonglongname {}; + longlonglonglonglonglonglonglonglonglonglongname: longlonglonglonglonglonglonglonglonglonglongname {}; + longlonglonglonglonglonglonglonglonglongname: longlonglonglonglonglonglonglonglonglongname {}; + longlonglonglonglonglonglonglonglongname: longlonglonglonglonglonglonglonglongname {}; + longlonglonglonglonglonglonglongname: longlonglonglonglonglonglonglongname {}; + longlonglonglonglonglonglongname: longlonglonglonglonglonglongname {}; + longlonglonglonglonglongname: longlonglonglonglonglongname {}; + longlonglonglonglongname: longlonglonglonglongname {}; + longlonglonglongname: longlonglonglongname {}; + longlonglongname: longlonglongname {}; + longlongname: longlongname {}; + longname: longname {}; +}; + diff --git a/tests/testdata/suffix_compress-overlay.dts b/tests/testdata/suffix_compress-overlay.dts new file mode 100644 index 0000000..382e376 --- /dev/null +++ b/tests/testdata/suffix_compress-overlay.dts @@ -0,0 +1,6 @@ +/dts-v1/; +/plugin/; + +&longname { + x {}; +}; -- cgit v1.2.3