[LTP] [PATCH v2 1/4] shell: Use conditional expansion for library setup/cleanup

Petr Vorel pvorel@suse.cz
Wed Apr 27 11:00:47 CEST 2022


Hi Martin,

> > diff --git a/testcases/network/busy_poll/busy_poll_lib.sh b/testcases/network/busy_poll/busy_poll_lib.sh
...
> > -TST_SETUP="setup"
> >  TST_TESTFUNC="test"
> > -TST_CLEANUP="cleanup"
> > +TST_SETUP="${TST_SETUP:-setup}"
> > +TST_CLEANUP="${TST_CLEANUP:-cleanup}"

> The setup() and cleanup() functions here should get a prefix, otherwise
> we're asking for duplicate definitions. But that can be added in a
> separate patchset.

Actually setup() and cleanup() are functions in the test, thus the name is correct,
This was written by Alexey, but I also had this approach to put the same
variables into library. Test defines many variables, thus I'd keep them in the
library:

TST_TESTFUNC="test"
TST_SETUP="${TST_SETUP:-setup}"
TST_CLEANUP="${TST_CLEANUP:-cleanup}"
TST_MIN_KVER="3.11"
TST_NEEDS_TMPDIR=1
TST_NEEDS_ROOT=1
TST_NEEDS_CMDS="pkill sysctl ethtool"
# for more stable results set to a single thread
TST_NETLOAD_CLN_NUMBER=1

But I'd suggest to change:

# setup and cleanup defined in the test
TST_SETUP="setup"
TST_CLEANUP="cleanup"

Kind regards,
Petr


More information about the ltp mailing list