Re: [PATCH] tests: compare the DTS generated from the tree against a model one

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Mon, 2018-10-08 at 14:45 +1100, David Gibson wrote:
> On Sun, Oct 07, 2018 at 04:46:13PM +0200, Lubomir Rintel wrote:
> > This would catch the cases, where the output DTS still parses well and
> > produces a tree that we expect, yet it contains some weirdness.
> 
> I'm really not sure what sort of thing you're trying to catch with
> this.

See:

From: Rob Herring <robh@xxxxxxxxxx>
Subject: Re: [PATCH v2] treesource: When using a dummy marker, replace
the existing ones
Date: Wed, 3 Oct 2018 14:44:43 -0500 (10/03/2018 09:44:43 PM)
Message-Id: <
CAL_JsqJ5Kffj5sepyv=gLMdeqwCWiy-zCjntwsMmzuah+2utBg@xxxxxxxxxxxxxx>

The particular problem was the string nodes found in fs trees ending up
formatted as follows:

  prop-str = """hello world";

>   The problem is that exactly how we format the dts is
> necessarily a heuristic - if we adjust or improve how we guess the
> formatting for dts output the output *will* change, but it won't be
> incorrect.

Yes. But I guess we don't want to do such things by accident and let
them go unnoticed. When it happens, it makes sense to just adjust the
test data.

> That's *why* I'm comparing dtb output to test the -I fs mode.
> 
> > Signed-off-by: Lubomir Rintel <lkundrak@xxxxx>
> > ---
> >  tests/fs_tree1.dts | 43 +++++++++++++++++++++++++++++++++++++++++++
> >  tests/run_tests.sh | 14 ++++++++++++++
> >  2 files changed, 57 insertions(+)
> >  create mode 100644 tests/fs_tree1.dts
> > 
> > diff --git a/tests/fs_tree1.dts b/tests/fs_tree1.dts
> > new file mode 100644
> > index 0000000..aeae436
> > --- /dev/null
> > +++ b/tests/fs_tree1.dts
> > @@ -0,0 +1,43 @@
> > +/dts-v1/;
> > +
> > +/ {
> > +	compatible = "test_tree1";
> > +	#address-cells = <0x01>;
> > +	#size-cells = <0x00>;
> > +	prop-str = "hello world";
> > +	prop-int = <0xdeadbeef>;
> > +	prop-int64 = <0xdeadbeef 0x1abcdef>;
> > +
> > +	subnode@2 {
> > +		#address-cells = <0x01>;
> > +		linux,phandle = <0x2000>;
> > +		#size-cells = <0x00>;
> > +		reg = <0x02>;
> > +		prop-int = <0x75bcd15>;
> > +
> > +		subsubnode@0 {
> > +			compatible = "subsubnode2\0subsubnode";
> > +			phandle = <0x2001>;
> > +			reg = <0x00>;
> > +			prop-int = <0x75bcd15>;
> > +		};
> > +
> > +		ss2 {
> > +		};
> > +	};
> > +
> > +	subnode@1 {
> > +		compatible = "subnode1";
> > +		reg = <0x01>;
> > +		prop-int = <0xdeadbeef>;
> > +
> > +		ss1 {
> > +		};
> > +
> > +		subsubnode {
> > +			compatible = "subsubnode1\0subsubnode";
> > +			placeholder = "this is a placeholder string\0string2";
> > +			prop-int = <0xdeadbeef>;
> > +		};
> > +	};
> > +};
> > diff --git a/tests/run_tests.sh b/tests/run_tests.sh
> > index bc2cc77..e6483b7 100755
> > --- a/tests/run_tests.sh
> > +++ b/tests/run_tests.sh
> > @@ -137,6 +137,19 @@ check_align () {
> >      )
> >  }
> >  
> > +# $1: first file
> > +# $2: second file
> > +files_equal () {
> > +    shorten_echo "files_equal $@:	"
> > +    (
> > +	if diff -q $1 $2; then
> > +	    PASS
> > +	else
> > +	    FAIL "File $1 differs from $2"
> > +	fi
> > +    )
> > +}
> > +
> >  run_dtc_test () {
> >      printf "dtc $*:	"
> >      base_run_test wrap_test $VALGRIND $DTC "$@"
> > @@ -460,6 +473,7 @@ libfdt_tests () {
> >      run_dtc_test -I fs -O dts -o fs.test_tree1.test.dts $FSBASE/test_tree1
> >      run_dtc_test -I fs -O dtb -o fs.test_tree1.test.dtb $FSBASE/test_tree1
> >      run_test dtbs_equal_unordered -m fs.test_tree1.test.dtb test_tree1.dtb
> > +    base_run_test files_equal fs_tree1.dts fs.test_tree1.test.dts
> >  
> >      # check full tests
> >      for good in test_tree1.dtb; do




[Index of Archives]     [Device Tree]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux