[LTP] [PATCH 2/2] tst_test.sh: Add public tst_test_root command

Cyril Hrubis chrubis@suse.cz
Wed Oct 9 13:39:20 CEST 2019


Hi!
> If a test requires root only under certan circumstances, TST_NEEDS_ROOT
> is not sufficient, because it always requires root.
> ---
>  testcases/lib/tst_test.sh | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh
> index c70a5abbe..07712670d 100644
> --- a/testcases/lib/tst_test.sh
> +++ b/testcases/lib/tst_test.sh
> @@ -326,6 +326,13 @@ tst_check_cmds()
>  	return 0
>  }
>  
> +tst_test_root()
> +{
> +	if [ "$(id -ru)" != 0 ]; then
> +		tst_brk TCONF "Must be super/root for this test!"
> +	fi
> +}

Can we keep the name to be tst_require_root() please?

Historically this function has been always named like this in LTP.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list