diff mbox series

[RFC,2/4] lib/tst_test.sh: add TST_NEEDS_DRIVERS parameter

Message ID 1533828226-24753-2-git-send-email-alexey.kodanev@oracle.com
State Superseded
Delegated to: Petr Vorel
Headers show
Series [RFC,1/4] lib/tst_test.c: add 'needs_drivers' option with tst_check_drivers cmd | expand

Commit Message

Alexey Kodanev Aug. 9, 2018, 3:23 p.m. UTC
The drivers are checked with tst_check_drivers.

Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
---
 testcases/lib/tst_test.sh |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

Comments

Petr Vorel Aug. 14, 2018, 5:11 p.m. UTC | #1
Hi Alexey,

> The drivers are checked with tst_check_drivers.

> Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
Acked-by: Petr Vorel <pvorel@suse.cz>
> ---

>  testcases/lib/tst_test.sh |   11 +++++++++++
>  1 files changed, 11 insertions(+), 0 deletions(-)

Again, some docs in doc/test-writing-guidelines.txt would be nice.


Kind regards,
Petr
Petr Vorel Aug. 16, 2018, 8:54 a.m. UTC | #2
Hi Alexey,

> The drivers are checked with tst_check_drivers.

> Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
> ---

>  	tst_test_cmds $TST_NEEDS_CMDS
> +	tst_test_drivers $TST_NEEDS_DRIVERS

I'm sorry here must be some fix:
+	if [ -n "$TST_NEEDS_DRIVERS" ]; then
+		tst_test_drivers $TST_NEEDS_DRIVERS
+	fi

Otherwise tests without $TST_NEEDS_DRIVERS TCONF:
tcp_ipsec_vti 1 TCONF: 'Please provide kernel driver list' driver not found


Kind regards,
Petr
Alexey Kodanev Aug. 16, 2018, 11:49 a.m. UTC | #3
On 08/16/2018 11:54 AM, Petr Vorel wrote:
> Hi Alexey,
> 
>> The drivers are checked with tst_check_drivers.
> 
>> Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
>> ---
> 
>>  	tst_test_cmds $TST_NEEDS_CMDS
>> +	tst_test_drivers $TST_NEEDS_DRIVERS
> 
> I'm sorry here must be some fix:
> +	if [ -n "$TST_NEEDS_DRIVERS" ]; then
> +		tst_test_drivers $TST_NEEDS_DRIVERS
> +	fi
> 
> Otherwise tests without $TST_NEEDS_DRIVERS TCONF:
> tcp_ipsec_vti 1 TCONF: 'Please provide kernel driver list' driver not found

Hi Petr,

Yeah, noticed that too, so I've added the check to tst_test_drivers(),
it should just return if there are no arguments passed.

Thanks,
Alexey
diff mbox series

Patch

diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh
index e553b49..30f75b5 100644
--- a/testcases/lib/tst_test.sh
+++ b/testcases/lib/tst_test.sh
@@ -285,6 +285,15 @@  tst_check_cmds()
 	return 0
 }
 
+tst_test_drivers()
+{
+	local drv="$(tst_check_drivers $@ 2>&1)"
+
+	if [ -n "$drv" ]; then
+		tst_brk TCONF "'$drv' driver not found"
+	fi
+}
+
 tst_is_int()
 {
 	[ "$1" -eq "$1" ] 2>/dev/null
@@ -332,6 +341,7 @@  tst_run()
 			OPTS|USAGE|PARSE_ARGS|POS_ARGS);;
 			NEEDS_ROOT|NEEDS_TMPDIR|NEEDS_DEVICE|DEVICE);;
 			NEEDS_CMDS|NEEDS_MODULE|MODPATH|DATAROOT);;
+			NEEDS_DRIVERS);;
 			IPV6|IPVER|TEST_DATA|TEST_DATA_IFS);;
 			RETRY_FUNC|RETRY_FN_EXP_BACKOFF);;
 			*) tst_res TWARN "Reserved variable TST_$_tst_i used!";;
@@ -369,6 +379,7 @@  tst_run()
 	fi
 
 	tst_test_cmds $TST_NEEDS_CMDS
+	tst_test_drivers $TST_NEEDS_DRIVERS
 
 	if [ -n "$TST_MIN_KVER" ]; then
 		tst_kvcmp -lt "$TST_MIN_KVER" && \