[Fuego] Add NEED_PROGRAM to need_check

Liu, Wenlong liuwl.fnst at cn.fujitsu.com
Fri Feb 2 09:25:47 UTC 2018


> -----Original Message-----
> From: Daniel Sangorrin [mailto:daniel.sangorrin at toshiba.co.jp]
> Sent: Friday, February 02, 2018 3:30 PM
> To: Liu, Wenlong/刘 文龙 <liuwl.fnst at cn.fujitsu.com>; Tim.Bird at sony.com;
> fuego at lists.linuxfoundation.org
> Subject: RE: [Fuego] Add NEED_PROGRAM to need_check
> 
> 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:
> - 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?

Sorry, let me say something here:-).
We really need to check something dynamically. 
Daniel, is my understanding as below the same as you said?
...
NEED_PROGRAM="foo1 foo2 foo3"            -> static check

function test_pre_check {
    if check_ROOT; then
        check_PROGRAM "foo4" || ABORT    -> dynamic check; foo4 depends on the ROOT permission.
    else
       # add "foo4" related test to skip list or fail_ok_list.
    fi
}
...

But, maybe oneday we could also use declarative dependencies to do a dynamic check.
Something like(just a draft below), 
...
NEED_PROGRAM="foo1 foo2 foo3"
NEED_PROGRAM_dynamic="foo4, check_ROOT, test4"
# if not ROOT permission, then skip test4 or add it to fail_ok_list
# if ROOT permission but "foo4" not exist; then ABORT
...
It may be more complex somewhere than the example above. But anyway, check_FOO() will be needed.

Best regards
Liu

> Thanks,
> Daniel
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 





More information about the Fuego mailing list