[PATCH v3] dm: core: Do not stop uclass iteration on error

Michal Suchánek msuchanek at suse.de
Sun Sep 25 18:38:35 CEST 2022


On Sun, Sep 25, 2022 at 08:15:31AM -0600, Simon Glass wrote:
> Hi Michal,
> 
> On Sat, 24 Sept 2022 at 14:10, Michal Suchánek <msuchanek at suse.de> wrote:
> >
> > Hello,
> >
> > On Sat, Sep 17, 2022 at 07:04:25PM +0200, Michal Suchánek wrote:
> > > Hello,
> > >
> > > On Sat, Sep 17, 2022 at 09:02:53AM -0600, Simon Glass wrote:
> > > > Hi Michal,
> > > >
> > > > On Wed, 31 Aug 2022 at 11:44, Simon Glass <sjg at chromium.org> wrote:
> > > > >
> > > > > Hi Michal,
> > > > >
> > > > > On Wed, 31 Aug 2022 at 01:39, Michal Suchánek <msuchanek at suse.de> wrote:
> > > > > >
> > > > > > Hello,
> > > > > >
> > > > > > On Tue, Aug 30, 2022 at 09:15:12PM -0600, Simon Glass wrote:
> > > > > > > Hi Michal,
> > > > > > >
> > > > > > > On Tue, 30 Aug 2022 at 10:48, Michal Suchánek <msuchanek at suse.de> wrote:
> > > > > > > >
> > > > > > > > On Tue, Aug 30, 2022 at 09:56:52AM -0600, Simon Glass wrote:
> > > > > > > > > Hi Michal,
> > > > > > > > >
> > > > > > > > > On Tue, 30 Aug 2022 at 04:23, Michal Suchánek <msuchanek at suse.de> wrote:
> > > > > > > > > >
> > > > > > > > > > On Sat, Aug 27, 2022 at 07:52:27PM -0600, Simon Glass wrote:
> > > > > > > > > > > Hi Michal,
> > > > > > > > > > >
> > > > > > > > > > > On Fri, 19 Aug 2022 at 14:23, Michal Suchanek <msuchanek at suse.de> wrote:
> > > > > > > > > > > >
> > > > > > > > > > > > When probing a device fails NULL pointer is returned, and other devices
> > > > > > > > > > > > cannot be iterated. Skip to next device on error instead.
> > > > > > > > > > > >
> > > > > > > > > > > > Fixes: 6494d708bf ("dm: Add base driver model support")
> > > > > > > > > > >
> > > > > > > > > > > I think you should drop this as you are doing a change of behaviour,
> > > > > > > > > > > not fixing a bug!
> > > > > > > > > >
> > > > > > > > > > You can hardly fix a bug without a change in behavior.
> > > > > > > > > >
> > > > > > > > > > These functions are used for iterating devices, and are not iterating
> > > > > > > > > > devices. That's clearly a bug.
> > > > > > > > >
> > > > > > > > > If it were clear I would have changed this long ago. The new way you
> > > > > > > > > have this function ignores errors, so they cannot be reported.
> > > > > > > > >
> > > > > > > > > We should almost always report errors, which is why I think your
> > > > > > > > > methods should be named differently.
> > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > > > Signed-off-by: Michal Suchanek <msuchanek at suse.de>
> > > > > > > > > > > > ---
> > > > > > > > > > > > v2: - Fix up tests
> > > > > > > > > > > > v3: - Fix up API doc
> > > > > > > > > > > >     - Correctly forward error from uclass_get
> > > > > > > > > > > >     - Do not return an error when last device fails to probe
> > > > > > > > > > > >     - Drop redundant initialization
> > > > > > > > > > > >     - Wrap at 80 columns
> > > > > > > > > > > > ---
> > > > > > > > > > > >  drivers/core/uclass.c | 32 ++++++++++++++++++++++++--------
> > > > > > > > > > > >  include/dm/uclass.h   | 13 ++++++++-----
> > > > > > > > > > > >  test/dm/test-fdt.c    | 20 ++++++++++++++++----
> > > > > > > > > > > >  3 files changed, 48 insertions(+), 17 deletions(-)
> > > > > > > > > > >
> > > > > > > > > > > Unfortunately this still fails one test. Try 'make qcheck' to see it -
> > > > > > > > > > > it is ethernet.
> > > > > > > > > >
> > > > > > > > > > I will look at that.
> >
> > How do you debug test failures?
> >
> > There is indeed a test that regresses.
> >
> > However, when I run
> >
> > ping 1.1.1.1
> >
> > I get to see the printfs that I added to net_loop
> >
> > when I run
> >
> > ut dm dm_test_eth_act
> >
> > u-boot crashes, and no printf output is seen, not even the print that
> > should report entering net_loop.
> > Given that the assert that is reported as failing is
> > test/dm/eth.c:133, dm_test_eth_act(): -ENODEV == net_loop(PING): Expected 0xffffffed (-19), got 0x0 (0)
> > it should run the net_loop to get that error.
> >
> > It's nice that we have tests but if they cannot be debugged they are not
> > all that useful.
> 
> Why don't you try gdb?

That's certainly an option for sandbox.

However, I wonder what's the utility of hiding test output by default?

I can run non-test commands in the sandbox, and they produce output as
normal, and the tests don't.

I even found that this default is disabled by the automatedte tests.
Whent running qcheck the debug prints would be shown in the qcheck
output for the failing test.

So the question is who and when would want to hide the test output?

Thanks

Michal


More information about the U-Boot mailing list