[Fuego] Add NEED_PROGRAM to need_check

Daniel Sangorrin daniel.sangorrin at toshiba.co.jp
Wed Feb 7 01:57:09 UTC 2018



> -----Original Message-----
> From: Tim.Bird at sony.com [mailto:Tim.Bird at sony.com]
> Sent: Wednesday, February 07, 2018 9:42 AM
> To: daniel.sangorrin at toshiba.co.jp; liuwl.fnst at cn.fujitsu.com; fuego at lists.linuxfoundation.org
> Subject: RE: [Fuego] Add NEED_PROGRAM to need_check
> 
> 
> 
> > -----Original Message-----
> > From: Daniel Sangorrin
> >
> > Hi Tim,
> >
> > > -----Original Message-----
> > > From: fuego-bounces at lists.linuxfoundation.org [mailto:fuego-
> > bounces at lists.linuxfoundation.org] On Behalf Of Liu, Wenlong
> > > > In general, I prefer things to be done as check_needs, which means they
> > > > are declarative, rather than in test_pre_check, which, strictly speaking,
> > > > is imperative.
> > > >
> > > > Having declarative dependencies means you can do a static dependency
> > > > checker.
> >
> > But many times we want a dynamic check as well. For example, we may want
> > to
> > skip some tests if we don't have root permissions but still run the other tests.
> >
> > I was wondering if we could kill 2 birds (no pun intended) with one shot:
> Personally, I've never cared for that expression. ;-)
> 
> > - during the pre_check phase a script checks for variables that start with
> > NEED_FOO
> > - then, the script calls check_FOO() for each need.
> >
> > NEED_ROOT is currently being checked in a function called check_needs.
> > Instead,
> > we could define a functiona called "check_ROOT" and have it called
> > automatically
> > when NEED_ROOT=1 is declared on the script. The advantage of this
> > approach, is
> > that tests can still call "check_ROOT" dynamically.
> >
> > What do you think?
> 
> I don't mind restructuring the code so that some of these dependencies
> could be called both explicitly and implicitly.  However, I think the mixed
> case is a bit ugly, and I'd rather we just used:
> check_root, and NEED_ROOT.

OK. Actually, I realized that check_needs is already calling to the corresponding 
check_xxx function so both explicit and implicit calls are currently supported.
I was thinking that check_needs could be rewritten with a more object-oriented approach.
But I should rather focus on fixing more important stuff.

Thanks,
Daniel





More information about the Fuego mailing list