diff mbox series

[RFC,9/9] testcases: cpuset: Check if "getconf" is available

Message ID 20180423094639.14612-10-mylene.josserand@bootlin.com
State Changes Requested
Delegated to: Cyril Hrubis
Headers show
Series testcases: small improvements with TCONF | expand

Commit Message

Mylène Josserand April 23, 2018, 9:46 a.m. UTC
The "getconf" binary is used by cpuset_regression_test.sh
and may not be installed in the system. The test will fail
but it is a misconfiguration so let's use "tst_check_cmds"
to check if this binary is available and return a TCONF error
if not.

Signed-off-by: Mylène Josserand <mylene.josserand@bootlin.com>
---
 testcases/kernel/controllers/cpuset/cpuset_regression_test.sh | 2 ++
 1 file changed, 2 insertions(+)

Comments

Cyril Hrubis April 23, 2018, 10:19 a.m. UTC | #1
Hi!
> The "getconf" binary is used by cpuset_regression_test.sh
> and may not be installed in the system. The test will fail
> but it is a misconfiguration so let's use "tst_check_cmds"
> to check if this binary is available and return a TCONF error
> if not.
> 
> Signed-off-by: Myl??ne Josserand <mylene.josserand@bootlin.com>
> ---
>  testcases/kernel/controllers/cpuset/cpuset_regression_test.sh | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/testcases/kernel/controllers/cpuset/cpuset_regression_test.sh b/testcases/kernel/controllers/cpuset/cpuset_regression_test.sh
> index 4a104a3ad..96a57955c 100755
> --- a/testcases/kernel/controllers/cpuset/cpuset_regression_test.sh
> +++ b/testcases/kernel/controllers/cpuset/cpuset_regression_test.sh
> @@ -34,6 +34,8 @@ setup()
>  		tst_brkm TCONF "Test must be run with kernel 3.18.0 or newer"
>  	fi
>  
> +	tst_check_cmds "getconf"
> +
>  	local cpu_num=$(getconf _NPROCESSORS_ONLN)
>  	if [ $cpu_num -lt 2 ]; then
>  		tst_brkm TCONF "We need 2 cpus at least to have test"

Hmm, or we may put something as tst_getconf.c into the
testcases/lib/ directory and implement subset of variables needed for
the tests there.
diff mbox series

Patch

diff --git a/testcases/kernel/controllers/cpuset/cpuset_regression_test.sh b/testcases/kernel/controllers/cpuset/cpuset_regression_test.sh
index 4a104a3ad..96a57955c 100755
--- a/testcases/kernel/controllers/cpuset/cpuset_regression_test.sh
+++ b/testcases/kernel/controllers/cpuset/cpuset_regression_test.sh
@@ -34,6 +34,8 @@  setup()
 		tst_brkm TCONF "Test must be run with kernel 3.18.0 or newer"
 	fi
 
+	tst_check_cmds "getconf"
+
 	local cpu_num=$(getconf _NPROCESSORS_ONLN)
 	if [ $cpu_num -lt 2 ]; then
 		tst_brkm TCONF "We need 2 cpus at least to have test"