[LTP] [PATCH v3 3/4] shell lib: Add basic support for test setup

Li Wang liwang@redhat.com
Thu Jun 12 09:48:23 CEST 2025


PM Petr Vorel <pvorel@suse.cz> wrote:


> --- /dev/null
> +++ b/testcases/lib/tst_run.sh
> @@ -0,0 +1,16 @@
> +#!/bin/sh
> +# SPDX-License-Identifier: GPL-2.0-or-later
> +# Copyright (c) 2025 Cyril Hrubis <chrubis@suse.cz>
> +# Copyright (c) 2025 Petr Vorel <pvorel@suse.cz>
> +
> +. tst_env.sh
> +
> +if [ -n "$TST_CLEANUP" ]; then
> +       trap $TST_CLEANUP EXIT
> +fi
> +
> +if [ -n "$TST_SETUP" ]; then
> +    $TST_SETUP
> +fi
> +
>

Here maybe better to have a check before the tst_test:

if ! declare -F tst_test > /dev/null; then
    tst_brk TBROK "tst_test() function is not defined"
fi


> +tst_test
> --
> 2.49.0
>

Sorry, I should have pointed this out at the first review, but
the idea came to my mind a little bit delayed :).

-- 
Regards,
Li Wang


More information about the ltp mailing list