[LTP] [RFC PATCH v2 0/3] Rewritting network tests into new shell API

Alexey Kodanev alexey.kodanev@oracle.com
Mon Apr 2 11:57:03 CEST 2018


On 31.03.2018 02:59, Petr Vorel wrote:
> Hi Alexey,
> 
> thanks for your comments!
> 
>> Hi Petr,
> 
>> A few questions about the changes to the new API:
> 
>> I think, you wrote about renaming test_net.sh to tst_net.sh, and the
>> corresponded test_net_stress.sh, so why we can't keep the copy to the
>> old API during migration and make the new one with the new name?
> That's another option, but I thought, it'd be easier to have just one version of
> test_net.sh which supports both APIs, than maintain two files (test_net.sh and
> tst_net.sh). But I might be wrong.
> 
>> What is actually changing in the new API that require the changes
>> in test_net.sh except tst_resm/tst_brkm renamed to tst_res/tst_brk?
> 
>> The new variables TST_NEEDS_ROOT and TST_SETUP, TST_TESTFUNC?
> Yes (you list all or most of them in your reply below) + the need to call tst_run().
> 
> I did most of the changes with simple script using sed (manual fixes are still needed).
> 
> tst_run() is the biggest change in the behavior, which complicates migrating of
> testscripts/network.sh. I haven't figured out, what would be an elegant way to move it and
> I'd prefer to migrate it into new version. Not sure whether we'd like to add part of
> "network_settings" execution to tst_run() for tst_net.sh and thus to be run twice (once
> by testscripts/network.sh and then by test which is called by testscripts/network.sh).
> 
> Now I see the best would be move this "network_settings" stuff into new called function
> tst_net_run() which would set it and at the end call tst_run() + remove sourcing
> test_net.sh in testscripts/network.sh (only testing script would load it and call
> tst_net_run() at the end instead of tst_run()).

Hi Petr,

I think we need to add a new flag, similar to LTP C library that can
define TST_NO_DEFAULT_MAIN, i.e. we could add TST_NO_DEFAULT_RUN in
the tst_test.sh.

> 
>> Can we run a test without them temporary, without tst_run(),
>> e.g. define some stubs and old API with the new one in
>> tst_net.sh?
> Do you mean to move all network scripts to new API, using these "shim" in tst_net.sh?
> I'd prefer tests were really using new API (to benefit from it), I just don't want to
> migrate all tests at once. This can be dangerous trying to implement new API functions in
> legacy one.> That's why I implemented in tst_net.sh functions starting with underscore which choose the

It's better to place underscore in the end of a function.

> implementation via $TST_USE_LEGACY_API. I wanted to ony tst_net.sh itself using it.
> 


Thanks,
Alexey


More information about the ltp mailing list