[LTP] [PATCH v2 2/4] doc: Update library API doc

Martin Doucha mdoucha@suse.cz
Tue Apr 26 13:03:28 CEST 2022


Hi,
small nit below, otherwise:

Reviewed-by: Martin Doucha <mdoucha@suse.cz>

On 22. 04. 22 16:41, Petr Vorel wrote:
> about conditional expansion for TST_{SETUP,CLEANUP}.
> 
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
> * New in v2
> 
>  doc/library-api-writing-guidelines.txt | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
> 
> diff --git a/doc/library-api-writing-guidelines.txt b/doc/library-api-writing-guidelines.txt
> index e75c838a15..9e926e9713 100644
> --- a/doc/library-api-writing-guidelines.txt
> +++ b/doc/library-api-writing-guidelines.txt
> @@ -61,3 +61,23 @@ API source code is in 'tst_test.sh', 'tst_security.sh' and 'tst_net.sh'
>  
>  Changes in the shell API should not introduce uncommon dependencies
>  (use basic commands installed everywhere by default).
> +
> +3.1 Shell libraries
> +~~~~~~~~~~~~~~~~~~~
> +
> +Besides shell API libraries in 'testcases/lib' it's worth to put common code
> +for particular tests into shell library. The filename should end '_lib.sh',
> +they should load 'tst_test.sh' or 'tst_net.sh'.

Better wording:
Aside from shell API libraries in 'testcases/lib', it's worth putting
common code for a group of tests into a shell library. The filename
should end with '_lib.sh' and the library should load 'tst_test.sh' or
'tst_net.sh'.

> +
> +Shell libraries should have conditional expansion for 'TST_SETUP' or 'TST_CLEANUP',
> +to avoid surprises when test specific setup/cleanup function is redefined by
> +shell library.
> +
> +[source,sh]
> +-------------------------------------------------------------------------------
> +# ipsec_lib.sh
> +# SPDX-License-Identifier: GPL-2.0-or-later
> +TST_SETUP=${TST_SETUP:-ipsec_lib_setup}
> +. tst_test.sh
> +...
> +-------------------------------------------------------------------------------


-- 
Martin Doucha   mdoucha@suse.cz
QA Engineer for Software Maintenance
SUSE LINUX, s.r.o.
CORSO IIa
Krizikova 148/34
186 00 Prague 8
Czech Republic


More information about the ltp mailing list