Re: [PATCH v4] pylibfdt: add FdtRo.get_path()

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



On Wed, Apr 20, 2022 at 08:19:43PM +0200, Luca Weiss wrote:
> Hi Simon and David,
> 
> On Mittwoch, 20. April 2022 04:56:15 CEST David Gibson wrote:
> > On Tue, Apr 19, 2022 at 03:54:07PM -0600, Simon Glass wrote:
> > > Hi Luca,
> > > 
> > > On Tue, 19 Apr 2022 at 13:49, Luca Weiss <luca@xxxxxxxxx> wrote:
> > > > Add a new Python method wrapping fdt_get_path() from the C API.
> > > > 
> > > > Also add a test for the new method.
> > > > 
> > > > Signed-off-by: Luca Weiss <luca@xxxxxxxxx>
> > > > ---
> > > > Changes since v3:
> > > > * add quiet parameter
> > > > * return integer error when error is quieted
> > > > 
> > > > Changes since v2:
> > > > * Remove arbitrary size limit
> > > > * Change size calculation to increase exponentially
> > > > * Add test to verify we still get exceptions with bad parameters
> > > > 
> > > >  pylibfdt/libfdt.i       | 28 ++++++++++++++++++++++++++++
> > > >  tests/pylibfdt_tests.py | 13 +++++++++++++
> > > >  2 files changed, 41 insertions(+)
> > > 
> > > Reviewed-by: Simon Glass <sjg@xxxxxxxxxxxx>
> > > 
> > > You don't check for when it is output of space, but I think that is
> > > OK.
> > 
> > Right, a testcase for that would be good, but it can be a follow up.
> 
> I don't quite understand what you mean "is output of space".
> 
> Maybe you mean a test for when the string is longer than 1024 characters 
> ("size = 1024") so the size increase gets triggered?

That's what I was thinking, yes.

> If yes, then I did test that manually before by setting the value absurdly 
> low. Not sure how to properly check that in the tests though. Add a node with 
> a super long name into the test dtb?

Not to the main "test_tree1" dtb, but you could use a different dtb
with a large property.  You could make one, or use an existing one
with a long property - look for references to 'lorem.txt` in
run_tests.sh for one example already creating and using a long
property.

Alternatively you could add an extra parameter to the Python wrapper
giving a "hint" size for the initial buffer.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

Attachment: signature.asc
Description: PGP signature


[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