[LTP] [PATCH v4 2/4] tst_test.sh: Add TST_USR_{G, U}ID variables

Cyril Hrubis chrubis@suse.cz
Wed Dec 17 16:47:34 CET 2025


Hi!
> Add TST_USR_{G,U}ID variables with the default values from tst_runas.c.
> 
> These can be used as a default values for tests which use tst_runas and
> need to know UID/GID for other commands.
> 
> It will be used in LTP IMA tests.
> 
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
>  testcases/lib/tst_runas.c | 1 +
>  testcases/lib/tst_test.sh | 6 +++++-
>  2 files changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/testcases/lib/tst_runas.c b/testcases/lib/tst_runas.c
> index e8d5d8dd9d..e937828273 100644
> --- a/testcases/lib/tst_runas.c
> +++ b/testcases/lib/tst_runas.c
> @@ -3,6 +3,7 @@
>   * Copyright (c) 2025 Petr Vorel <pvorel@suse.cz>
>   */
>  
> +/* update also tst_test.sh */
>  #define LTP_USR_UID 65534
>  #define LTP_USR_GID 65534
>  
> diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh
> index 4be10a4f94..26e6a86dcb 100644
> --- a/testcases/lib/tst_test.sh
> +++ b/testcases/lib/tst_test.sh
> @@ -17,6 +17,10 @@ export TST_ITERATIONS=1
>  export TST_TMPDIR_RHOST=0
>  export TST_LIB_LOADED=1
>  
> +# see testcases/lib/tst_runas.c
> +export TST_USR_UID="${LTP_USR_UID:-65534}"
> +export TST_USR_GID="${LTP_USR_GID:-65534}"

Do we need this? We already have the default values in the C code...

>  . tst_ansi_color.sh
>  . tst_security.sh
>  
> @@ -689,7 +693,7 @@ tst_run()
>  			CHECKPOINT_WAKE2|CHECKPOINT_WAKE_AND_WAIT);;
>  			DEV_EXTRA_OPTS|DEV_FS_OPTS|FORMAT_DEVICE|MOUNT_DEVICE);;
>  			SKIP_FILESYSTEMS|SKIP_IN_LOCKDOWN|SKIP_IN_SECUREBOOT);;
> -			DEVICE_SIZE);;
> +			DEVICE_SIZE|USR_UID|USR_GID);;
>  			*) tst_res TWARN "Reserved variable TST_$_tst_i used!";;
>  			esac
>  		done
> -- 
> 2.51.0
> 

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list