[LTP] [RFC PATCH 8/9] testcases: test.sh: Check if "getconf" is available

Cyril Hrubis chrubis@suse.cz
Mon Apr 23 12:17:53 CEST 2018


Hi!
> In case TST_NEEDS_CHECKPOINTS is set to 1, the "getconf"
> binary is used. This binary may not be installed in the system
> and it will return a FAIL. Instead, add a check on this binary
> to return "TCONF" in that case.
> 
> Signed-off-by: Myl??ne Josserand <mylene.josserand@bootlin.com>
> ---
>  testcases/lib/test.sh | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/testcases/lib/test.sh b/testcases/lib/test.sh
> index bce9893a9..b27dbf4ab 100644
> --- a/testcases/lib/test.sh
> +++ b/testcases/lib/test.sh
> @@ -421,6 +421,8 @@ fi
>  if [ "$TST_NEEDS_CHECKPOINTS" = "1" ]; then
>  	LTP_IPC_PATH="/dev/shm/ltp_${TCID}_$$"
>  
> +	tst_check_cmds "getconf"
> +
>  	LTP_IPC_SIZE=$(getconf PAGESIZE)
>  	if [ $? -ne 0 ]; then
>  		tst_brkm TBROK "getconf PAGESIZE failed"

This would be better fixed by creating a binary helper in testcases/lib/
same as we did for example for sub-second sleep with tst_sleep.c. We can
create tst_pagesize.c that would just print the result of getpagesize().

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list