All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH RFC 1/4] lib/tst_test.c: add 'needs_drivers' option with tst_check_drivers cmd
@ 2018-08-09 15:23 Alexey Kodanev
  2018-08-09 15:23 ` [LTP] [PATCH RFC 2/4] lib/tst_test.sh: add TST_NEEDS_DRIVERS parameter Alexey Kodanev
                   ` (4 more replies)
  0 siblings, 5 replies; 18+ messages in thread
From: Alexey Kodanev @ 2018-08-09 15:23 UTC (permalink / raw)
  To: ltp

The drivers are checked with modprobe. If modrpobe is not available
on the system, the checks are silently skipped.

Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
---
 include/tst_test.h                |    5 +++++
 lib/tst_test.c                    |   26 ++++++++++++++++++++++++++
 testcases/lib/.gitignore          |    1 +
 testcases/lib/Makefile            |    2 +-
 testcases/lib/tst_check_drivers.c |   24 ++++++++++++++++++++++++
 5 files changed, 57 insertions(+), 1 deletions(-)
 create mode 100644 testcases/lib/tst_check_drivers.c

diff --git a/include/tst_test.h b/include/tst_test.h
index 98dacf3..221796d 100644
--- a/include/tst_test.h
+++ b/include/tst_test.h
@@ -170,6 +170,9 @@ struct tst_test {
 
 	/* NULL terminated array of resource file names */
 	const char *const *resource_files;
+
+	/* NULL terminated array of needed kernel drivers */
+	const char * const *needs_drivers;
 };
 
 /*
@@ -219,6 +222,8 @@ const char *tst_strstatus(int status);
 
 void tst_set_timeout(int timeout);
 
+int tst_check_drivers(void);
+
 #ifndef TST_NO_DEFAULT_MAIN
 
 static struct tst_test test;
diff --git a/lib/tst_test.c b/lib/tst_test.c
index 2f3d357..6cb74cf 100644
--- a/lib/tst_test.c
+++ b/lib/tst_test.c
@@ -645,6 +645,29 @@ static int needs_tmpdir(void)
 	       tst_test->needs_checkpoints;
 }
 
+int tst_check_drivers(void)
+{
+	const char *name;
+	int i, res;
+
+	for (i = 0; (name = tst_test->needs_drivers[i]); ++i) {
+		const char * const argv[] = { "modprobe", name, NULL };
+
+		res = tst_run_cmd_(NULL, argv, "/dev/null", "/dev/null", 1);
+		if (res == 255)
+			return res; /* it looks like modprobe not available */
+		if (res) {
+			if (tst_test->test || tst_test->test_all) {
+				tst_brk(TCONF, "%s driver not available", name);
+			} else {
+				fprintf(stderr, "%s", name);
+				return res;
+			}
+		}
+	}
+	return 0;
+}
+
 static void copy_resources(void)
 {
 	unsigned int i;
@@ -767,6 +790,9 @@ static void do_setup(int argc, char *argv[])
 	if (tst_test->min_kver)
 		check_kver();
 
+	if (tst_test->needs_drivers)
+		tst_check_drivers();
+
 	if (tst_test->format_device)
 		tst_test->needs_device = 1;
 
diff --git a/testcases/lib/.gitignore b/testcases/lib/.gitignore
index a9034e4..d83a48e 100644
--- a/testcases/lib/.gitignore
+++ b/testcases/lib/.gitignore
@@ -1,5 +1,6 @@
 /tst_sleep
 /tst_random
+/tst_check_drivers
 /tst_checkpoint
 /tst_rod
 /tst_kvcmp
diff --git a/testcases/lib/Makefile b/testcases/lib/Makefile
index 3547e16..e1dea3b 100644
--- a/testcases/lib/Makefile
+++ b/testcases/lib/Makefile
@@ -28,6 +28,6 @@ INSTALL_TARGETS		:= *.sh
 
 MAKE_TARGETS		:= tst_sleep tst_random tst_checkpoint tst_rod tst_kvcmp\
 			   tst_device tst_net_iface_prefix tst_net_ip_prefix tst_net_vars\
-			   tst_getconf tst_supported_fs
+			   tst_getconf tst_supported_fs tst_check_drivers
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/lib/tst_check_drivers.c b/testcases/lib/tst_check_drivers.c
new file mode 100644
index 0000000..3f722f2
--- /dev/null
+++ b/testcases/lib/tst_check_drivers.c
@@ -0,0 +1,24 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later
+ * Copyright (c) 2018 Oracle and/or its affiliates. All Rights Reserved.
+ */
+
+#include <stdio.h>
+#define TST_NO_DEFAULT_MAIN
+#include "tst_test.h"
+
+struct tst_test *tst_test;
+
+int main(int argc, const char *argv[])
+{
+	if (argc < 2) {
+		fprintf(stderr, "Please provide kernel driver list\n");
+		return 1;
+	}
+
+	struct tst_test test = {
+		.needs_drivers = &argv[1]
+	};
+
+	tst_test = &test;
+	return tst_check_drivers();
+}
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [LTP] [PATCH RFC 2/4] lib/tst_test.sh: add TST_NEEDS_DRIVERS parameter
  2018-08-09 15:23 [LTP] [PATCH RFC 1/4] lib/tst_test.c: add 'needs_drivers' option with tst_check_drivers cmd Alexey Kodanev
@ 2018-08-09 15:23 ` Alexey Kodanev
  2018-08-14 17:11   ` Petr Vorel
  2018-08-16  8:54   ` Petr Vorel
  2018-08-09 15:23 ` [LTP] [PATCH RFC 3/4] lib/tst_test.sh: add TST_RTNL_CHK() helper function Alexey Kodanev
                   ` (3 subsequent siblings)
  4 siblings, 2 replies; 18+ messages in thread
From: Alexey Kodanev @ 2018-08-09 15:23 UTC (permalink / raw)
  To: ltp

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(-)

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" && \
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [LTP] [PATCH RFC 3/4] lib/tst_test.sh: add TST_RTNL_CHK() helper function
  2018-08-09 15:23 [LTP] [PATCH RFC 1/4] lib/tst_test.c: add 'needs_drivers' option with tst_check_drivers cmd Alexey Kodanev
  2018-08-09 15:23 ` [LTP] [PATCH RFC 2/4] lib/tst_test.sh: add TST_NEEDS_DRIVERS parameter Alexey Kodanev
@ 2018-08-09 15:23 ` Alexey Kodanev
  2018-08-14 18:39   ` Petr Vorel
  2018-08-09 15:23 ` [LTP] [PATCH RFC 4/4] network/ipsec: replace ipsec_try() with TST_RTNL_CHK() Alexey Kodanev
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 18+ messages in thread
From: Alexey Kodanev @ 2018-08-09 15:23 UTC (permalink / raw)
  To: ltp

It should parse iproute commands output and exit the test with TCONF
if there are certain messages returned from iproute/RTNETLINK.

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

diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh
index 30f75b5..73dcdfb 100644
--- a/testcases/lib/tst_test.sh
+++ b/testcases/lib/tst_test.sh
@@ -202,6 +202,22 @@ TST_RETRY_FUNC()
 	return $2
 }
 
+TST_RTNL_CHK()
+{
+	local msg1="RTNETLINK answers: Function not implemented"
+	local msg2="RTNETLINK answers: Operation not supported"
+	local output="$($@ 2>&1 || echo 'LTP_ERR')"
+	local msg
+
+	echo "$output" | grep -q "LTP_ERR" || return 0
+
+	for msg in "$msg1" "$msg2"; do
+		echo "$output" | grep -q "$msg" && tst_brk TCONF "'$@': $msg"
+	done
+
+	tst_brk TBROK "$@ failed: $output"
+}
+
 tst_umount()
 {
 	local device="$1"
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [LTP] [PATCH RFC 4/4] network/ipsec: replace ipsec_try() with TST_RTNL_CHK()
  2018-08-09 15:23 [LTP] [PATCH RFC 1/4] lib/tst_test.c: add 'needs_drivers' option with tst_check_drivers cmd Alexey Kodanev
  2018-08-09 15:23 ` [LTP] [PATCH RFC 2/4] lib/tst_test.sh: add TST_NEEDS_DRIVERS parameter Alexey Kodanev
  2018-08-09 15:23 ` [LTP] [PATCH RFC 3/4] lib/tst_test.sh: add TST_RTNL_CHK() helper function Alexey Kodanev
@ 2018-08-09 15:23 ` Alexey Kodanev
  2018-08-14 18:40   ` Petr Vorel
                     ` (2 more replies)
  2018-08-14 17:06 ` [LTP] [PATCH RFC 1/4] lib/tst_test.c: add 'needs_drivers' option with tst_check_drivers cmd Petr Vorel
  2018-08-16 10:59 ` Cyril Hrubis
  4 siblings, 3 replies; 18+ messages in thread
From: Alexey Kodanev @ 2018-08-09 15:23 UTC (permalink / raw)
  To: ltp

Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
---
 testcases/network/stress/ipsec/ipsec_lib.sh |   21 +++------------------
 1 files changed, 3 insertions(+), 18 deletions(-)

diff --git a/testcases/network/stress/ipsec/ipsec_lib.sh b/testcases/network/stress/ipsec/ipsec_lib.sh
index aedba9b..f850166 100644
--- a/testcases/network/stress/ipsec/ipsec_lib.sh
+++ b/testcases/network/stress/ipsec/ipsec_lib.sh
@@ -157,21 +157,6 @@ ipsec_set_algoline()
 	esac
 }
 
-ipsec_try()
-{
-	local output="$($@ 2>&1 || echo 'TERR')"
-
-	if echo "$output" | grep -q "TERR"; then
-		echo "$output" | grep -q \
-			'RTNETLINK answers: Function not implemented' && \
-			tst_brk TCONF "'$@': not implemented"
-		echo "$output" | grep -q \
-			'RTNETLINK answers: Operation not supported' && \
-			tst_brk TCONF "'$@': not supported (maybe missing 'ip${TST_IPV6}_vti' kernel module)"
-		tst_brk TBROK "$@ failed: $output"
-	fi
-}
-
 # tst_ipsec target src_addr dst_addr: config ipsec
 #
 # target: target of the configuration host ( lhost / rhost )
@@ -195,7 +180,7 @@ tst_ipsec()
 	if [ $target = lhost ]; then
 		local spi_1="0x$SPI"
 		local spi_2="0x$(( $SPI + 1 ))"
-		ipsec_try ip xfrm state add src $src dst $dst spi $spi_1 \
+		TST_RTNL_CHK xfrm state add src $src dst $dst spi $spi_1 \
 			$p $ALG mode $mode sel src $src dst $dst
 		ROD ip xfrm state add src $dst dst $src spi $spi_2 \
 			$p $ALG mode $mode sel src $dst dst $src
@@ -257,12 +242,12 @@ tst_ipsec_vti()
 	cleanup_vti=$vti
 
 	if [ $target = lhost ]; then
-		ipsec_try ip li add $vti $type local $src remote $dst $key $d
+		TST_RTNL_CHK ip li add $vti $type local $src remote $dst $key $d
 		ROD ip li set $vti up
 
 		local spi_1="spi 0x$SPI"
 		local spi_2="spi 0x$(( $SPI + 1 ))"
-		ipsec_try $ipx st add $o_dir $p $spi_1 $ALG $m
+		TST_RTNL_CHK $ipx st add $o_dir $p $spi_1 $ALG $m
 		ROD $ipx st add $i_dir $p $spi_2 $ALG $m
 		ROD $ipx po add dir out tmpl $o_dir $p $m $mrk
 		ROD $ipx po add dir in tmpl $i_dir $p $m $mrk
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [LTP] [PATCH RFC 1/4] lib/tst_test.c: add 'needs_drivers' option with tst_check_drivers cmd
  2018-08-09 15:23 [LTP] [PATCH RFC 1/4] lib/tst_test.c: add 'needs_drivers' option with tst_check_drivers cmd Alexey Kodanev
                   ` (2 preceding siblings ...)
  2018-08-09 15:23 ` [LTP] [PATCH RFC 4/4] network/ipsec: replace ipsec_try() with TST_RTNL_CHK() Alexey Kodanev
@ 2018-08-14 17:06 ` Petr Vorel
  2018-08-15 15:22   ` Alexey Kodanev
  2018-08-16 10:59 ` Cyril Hrubis
  4 siblings, 1 reply; 18+ messages in thread
From: Petr Vorel @ 2018-08-14 17:06 UTC (permalink / raw)
  To: ltp

Hi Alexey,

> The drivers are checked with modprobe. If modrpobe is not available
                                            ^ typo modrpobe
> on the system, the checks are silently skipped.

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

> ---
>  include/tst_test.h                |    5 +++++
>  lib/tst_test.c                    |   26 ++++++++++++++++++++++++++
>  testcases/lib/.gitignore          |    1 +
>  testcases/lib/Makefile            |    2 +-
>  testcases/lib/tst_check_drivers.c |   24 ++++++++++++++++++++++++
>  5 files changed, 57 insertions(+), 1 deletions(-)
>  create mode 100644 testcases/lib/tst_check_drivers.c

It'd be nice to add some docs into doc/test-writing-guidelines.txt.


Kind regards,
Petr

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [LTP] [PATCH RFC 2/4] lib/tst_test.sh: add TST_NEEDS_DRIVERS parameter
  2018-08-09 15:23 ` [LTP] [PATCH RFC 2/4] lib/tst_test.sh: add TST_NEEDS_DRIVERS parameter Alexey Kodanev
@ 2018-08-14 17:11   ` Petr Vorel
  2018-08-16  8:54   ` Petr Vorel
  1 sibling, 0 replies; 18+ messages in thread
From: Petr Vorel @ 2018-08-14 17:11 UTC (permalink / raw)
  To: ltp

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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [LTP] [PATCH RFC 3/4] lib/tst_test.sh: add TST_RTNL_CHK() helper function
  2018-08-09 15:23 ` [LTP] [PATCH RFC 3/4] lib/tst_test.sh: add TST_RTNL_CHK() helper function Alexey Kodanev
@ 2018-08-14 18:39   ` Petr Vorel
  0 siblings, 0 replies; 18+ messages in thread
From: Petr Vorel @ 2018-08-14 18:39 UTC (permalink / raw)
  To: ltp

Hi Alexey,

> It should parse iproute commands output and exit the test with TCONF
> if there are certain messages returned from iproute/RTNETLINK.

> Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
Acked-by: Petr Vorel <pvorel@suse.cz>
> ---
>  testcases/lib/tst_test.sh |   16 ++++++++++++++++
>  1 files changed, 16 insertions(+), 0 deletions(-)


Kind regards,
Petr

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [LTP] [PATCH RFC 4/4] network/ipsec: replace ipsec_try() with TST_RTNL_CHK()
  2018-08-09 15:23 ` [LTP] [PATCH RFC 4/4] network/ipsec: replace ipsec_try() with TST_RTNL_CHK() Alexey Kodanev
@ 2018-08-14 18:40   ` Petr Vorel
  2018-08-16 11:16   ` [LTP] [RFC PATCH 2/2] netstress: Update help for -m behavior Petr Vorel
  2018-08-16 11:42   ` [LTP] [PATCH v2 1/1] network/route: Rewrite route-change-dst into new API Petr Vorel
  2 siblings, 0 replies; 18+ messages in thread
From: Petr Vorel @ 2018-08-14 18:40 UTC (permalink / raw)
  To: ltp

Hi Alexey,

> Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
Acked-by: Petr Vorel <pvorel@suse.cz>
> ---
>  testcases/network/stress/ipsec/ipsec_lib.sh |   21 +++------------------
>  1 files changed, 3 insertions(+), 18 deletions(-)


Kind regards,
Petr

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [LTP] [PATCH RFC 1/4] lib/tst_test.c: add 'needs_drivers' option with tst_check_drivers cmd
  2018-08-14 17:06 ` [LTP] [PATCH RFC 1/4] lib/tst_test.c: add 'needs_drivers' option with tst_check_drivers cmd Petr Vorel
@ 2018-08-15 15:22   ` Alexey Kodanev
  0 siblings, 0 replies; 18+ messages in thread
From: Alexey Kodanev @ 2018-08-15 15:22 UTC (permalink / raw)
  To: ltp

On 08/14/2018 08:06 PM, Petr Vorel wrote:
> Hi Alexey,
> 
>> The drivers are checked with modprobe. If modrpobe is not available
>                                             ^ typo modrpobe>> on the system, the checks are silently skipped.
> 
>> Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
> Acked-by: Petr Vorel <pvorel@suse.cz>
> 
>> ---
>>  include/tst_test.h                |    5 +++++
>>  lib/tst_test.c                    |   26 ++++++++++++++++++++++++++
>>  testcases/lib/.gitignore          |    1 +
>>  testcases/lib/Makefile            |    2 +-
>>  testcases/lib/tst_check_drivers.c |   24 ++++++++++++++++++++++++
>>  5 files changed, 57 insertions(+), 1 deletions(-)
>>  create mode 100644 testcases/lib/tst_check_drivers.c
> 
> It'd be nice to add some docs into doc/test-writing-guidelines.txt.
> 

Hi Petr,

Sure, thanks for review!

BTW, it feels like tst_kernel.h is the better place for tst_check_drivers().

Thanks,
Alexey

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [LTP] [PATCH RFC 2/4] lib/tst_test.sh: add TST_NEEDS_DRIVERS parameter
  2018-08-09 15:23 ` [LTP] [PATCH RFC 2/4] lib/tst_test.sh: add TST_NEEDS_DRIVERS parameter Alexey Kodanev
  2018-08-14 17:11   ` Petr Vorel
@ 2018-08-16  8:54   ` Petr Vorel
  2018-08-16 11:49     ` Alexey Kodanev
  1 sibling, 1 reply; 18+ messages in thread
From: Petr Vorel @ 2018-08-16  8:54 UTC (permalink / raw)
  To: ltp

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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [LTP] [PATCH RFC 1/4] lib/tst_test.c: add 'needs_drivers' option with tst_check_drivers cmd
  2018-08-09 15:23 [LTP] [PATCH RFC 1/4] lib/tst_test.c: add 'needs_drivers' option with tst_check_drivers cmd Alexey Kodanev
                   ` (3 preceding siblings ...)
  2018-08-14 17:06 ` [LTP] [PATCH RFC 1/4] lib/tst_test.c: add 'needs_drivers' option with tst_check_drivers cmd Petr Vorel
@ 2018-08-16 10:59 ` Cyril Hrubis
  2018-08-16 11:54   ` Alexey Kodanev
  4 siblings, 1 reply; 18+ messages in thread
From: Cyril Hrubis @ 2018-08-16 10:59 UTC (permalink / raw)
  To: ltp

Hi!
> diff --git a/include/tst_test.h b/include/tst_test.h
> index 98dacf3..221796d 100644
> --- a/include/tst_test.h
> +++ b/include/tst_test.h
> @@ -170,6 +170,9 @@ struct tst_test {
>  
>  	/* NULL terminated array of resource file names */
>  	const char *const *resource_files;
> +
> +	/* NULL terminated array of needed kernel drivers */
> +	const char * const *needs_drivers;
>  };
>  
>  /*
> @@ -219,6 +222,8 @@ const char *tst_strstatus(int status);
>  
>  void tst_set_timeout(int timeout);
>  
> +int tst_check_drivers(void);
> +
>  #ifndef TST_NO_DEFAULT_MAIN
>  
>  static struct tst_test test;
> diff --git a/lib/tst_test.c b/lib/tst_test.c
> index 2f3d357..6cb74cf 100644
> --- a/lib/tst_test.c
> +++ b/lib/tst_test.c
> @@ -645,6 +645,29 @@ static int needs_tmpdir(void)
>  	       tst_test->needs_checkpoints;
>  }
>  
> +int tst_check_drivers(void)
> +{
> +	const char *name;
> +	int i, res;
> +
> +	for (i = 0; (name = tst_test->needs_drivers[i]); ++i) {
> +		const char * const argv[] = { "modprobe", name, NULL };
> +
> +		res = tst_run_cmd_(NULL, argv, "/dev/null", "/dev/null", 1);
> +		if (res == 255)
> +			return res; /* it looks like modprobe not available */
> +		if (res) {
> +			if (tst_test->test || tst_test->test_all) {
> +				tst_brk(TCONF, "%s driver not available", name);
> +			} else {
> +				fprintf(stderr, "%s", name);
> +				return res;
> +			}
> +		}
> +	}
> +	return 0;
> +}

I do not like much that we change the behavir based on tst_test content.
Maybe it would be cleaner to define a tst_check_driver(const char *name),
then we can do the loop over tst_test->needs_drivers in the tst_test.c
library and loop over argv in the shell helper.

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [LTP] [RFC PATCH 2/2] netstress: Update help for -m behavior
  2018-08-09 15:23 ` [LTP] [PATCH RFC 4/4] network/ipsec: replace ipsec_try() with TST_RTNL_CHK() Alexey Kodanev
  2018-08-14 18:40   ` Petr Vorel
@ 2018-08-16 11:16   ` Petr Vorel
  2018-08-16 12:01     ` Alexey Kodanev
  2018-08-16 11:42   ` [LTP] [PATCH v2 1/1] network/route: Rewrite route-change-dst into new API Petr Vorel
  2 siblings, 1 reply; 18+ messages in thread
From: Petr Vorel @ 2018-08-16 11:16 UTC (permalink / raw)
  To: ltp

Hi Alexey,

> >> Hi Petr,

> >> Since the server waits for requests from the client, the timeout
> >> value for UDP/DCCP is the same as for the other protocols. Also the
> >> server starts earlier than the client, so it should wait some time
> >> to get the client requests.

> >> I've changed the client side only because either request from the
> >> client or reply from the server might be lost.

> > Thanks for your explanation.
> > I mean: UDP itself is the only protocol which don't support listen() so
> > netstress server using UDP timeouts after some time. The default is 100ms.

> Hmm, for the server the default should be 60 sec. Does it timeout earlier?
Yes. The timeout is affected by value of -m. Thats' what I meant by my previous:
$ date +"%T.%3N"; testcases/network/netstress/netstress -m 1 -T udp; date +"%T.%3N"
15:52:34.501
tst_test.c:1015: INFO: Timeout per run is 0h 05m 00s
The timeout is actually 1ms. Try it with -m 1000 and it'll be indeed 1s
netstress.c:917: INFO: max requests '3'
netstress.c:944: INFO: using UDP
netstress.c:676: INFO: assigning a name to the server socket...
netstress.c:683: INFO: bind to port 47728
netstress.c:575: FAIL: recv failed, sock '3'
netstress.c:642: BROK: Server closed
...
15:52:34.516


This is caused by udp/udp_lite not using listen(), but maybe is should be at
least mentioned in help (if wanted behavior).

Kind regards,
Petr

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [LTP] [PATCH v2 1/1] network/route: Rewrite route-change-dst into new API
  2018-08-09 15:23 ` [LTP] [PATCH RFC 4/4] network/ipsec: replace ipsec_try() with TST_RTNL_CHK() Alexey Kodanev
  2018-08-14 18:40   ` Petr Vorel
  2018-08-16 11:16   ` [LTP] [RFC PATCH 2/2] netstress: Update help for -m behavior Petr Vorel
@ 2018-08-16 11:42   ` Petr Vorel
  2 siblings, 0 replies; 18+ messages in thread
From: Petr Vorel @ 2018-08-16 11:42 UTC (permalink / raw)
  To: ltp

Hi Alexey,

> On 07/27/2018 04:01 PM, Alexey Kodanev wrote:
> ...
> >> +	tst_netload -T udp -r 1 -a 1 -H $addr

> > Unfortunately, it won't work this way. tst_netload is using requests/response
> > model for UDP. You have to make sure the server can send responses.

> > Also, netstress UDP/DCCP client allows to pass 'max_etime_cnt' (12) failed
> > requests after which it will double receive timeout, starting from 100ms up to
> > 3.2s. This is about 30 sec if there is no connection. With a single request or
> > below max_etime_cnt + 1 value it will always pass. I guess we need to set the
> > proper request parameter limit for UDP/DCCP protocol or check whether the
> > number of timeout errors is equal or greater than the number of requests.

> Applied the fix for this bug:
> 4ceb442b56ad ("netstress: handle timeout errors for a small number of requests")

Thanks for your explanation and netstress fix.

I'll try to implement it in C, using rtnetlink as we've been talking about in
the past. That should stress the system more than using user space tools.
Maybe for the start with just changing interfaces (without checking by sending
packets).


Kind regards,
Petr

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [LTP] [PATCH RFC 2/4] lib/tst_test.sh: add TST_NEEDS_DRIVERS parameter
  2018-08-16  8:54   ` Petr Vorel
@ 2018-08-16 11:49     ` Alexey Kodanev
  0 siblings, 0 replies; 18+ messages in thread
From: Alexey Kodanev @ 2018-08-16 11:49 UTC (permalink / raw)
  To: ltp

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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [LTP] [PATCH RFC 1/4] lib/tst_test.c: add 'needs_drivers' option with tst_check_drivers cmd
  2018-08-16 11:54   ` Alexey Kodanev
@ 2018-08-16 11:53     ` Petr Vorel
  2018-08-16 12:21       ` Alexey Kodanev
  0 siblings, 1 reply; 18+ messages in thread
From: Petr Vorel @ 2018-08-16 11:53 UTC (permalink / raw)
  To: ltp

Hi,

> On 08/16/2018 01:59 PM, Cyril Hrubis wrote:
> > Hi... 
> > I do not like much that we change the behavir based on tst_test content.
> > Maybe it would be cleaner to define a tst_check_driver(const char *name),
> > then we can do the loop over tst_test->needs_drivers in the tst_test.c
> > library and loop over argv in the shell helper.
+1 it makes sense.

> Hi Cyril,

> OK, will send the 2nd version.

BTW it'd be nice to have support to load module with parameters.

> Thanks,
> Alexey


Kind regards,
Petr

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [LTP] [PATCH RFC 1/4] lib/tst_test.c: add 'needs_drivers' option with tst_check_drivers cmd
  2018-08-16 10:59 ` Cyril Hrubis
@ 2018-08-16 11:54   ` Alexey Kodanev
  2018-08-16 11:53     ` Petr Vorel
  0 siblings, 1 reply; 18+ messages in thread
From: Alexey Kodanev @ 2018-08-16 11:54 UTC (permalink / raw)
  To: ltp

On 08/16/2018 01:59 PM, Cyril Hrubis wrote:
> Hi... 
> I do not like much that we change the behavir based on tst_test content.
> Maybe it would be cleaner to define a tst_check_driver(const char *name),
> then we can do the loop over tst_test->needs_drivers in the tst_test.c
> library and loop over argv in the shell helper.
> 
Hi Cyril,

OK, will send the 2nd version.

Thanks,
Alexey


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [LTP] [RFC PATCH 2/2] netstress: Update help for -m behavior
  2018-08-16 11:16   ` [LTP] [RFC PATCH 2/2] netstress: Update help for -m behavior Petr Vorel
@ 2018-08-16 12:01     ` Alexey Kodanev
  0 siblings, 0 replies; 18+ messages in thread
From: Alexey Kodanev @ 2018-08-16 12:01 UTC (permalink / raw)
  To: ltp

On 08/16/2018 02:16 PM, Petr Vorel wrote:
> Hi Alexey,
> 
>>>> Hi Petr,
> 
>>>> Since the server waits for requests from the client, the timeout
>>>> value for UDP/DCCP is the same as for the other protocols. Also the
>>>> server starts earlier than the client, so it should wait some time
>>>> to get the client requests.
> 
>>>> I've changed the client side only because either request from the
>>>> client or reply from the server might be lost.
> 
>>> Thanks for your explanation.
>>> I mean: UDP itself is the only protocol which don't support listen() so
>>> netstress server using UDP timeouts after some time. The default is 100ms.
> 
>> Hmm, for the server the default should be 60 sec. Does it timeout earlier?
> Yes. The timeout is affected by value of -m. Thats' what I meant by my previous:
> $ date +"%T.%3N"; testcases/network/netstress/netstress -m 1 -T udp; date +"%T.%3N"
> 15:52:34.501
> tst_test.c:1015: INFO: Timeout per run is 0h 05m 00s
> The timeout is actually 1ms. Try it with -m 1000 and it'll be indeed 1s
> netstress.c:917: INFO: max requests '3'
> netstress.c:944: INFO: using UDP
> netstress.c:676: INFO: assigning a name to the server socket...
> netstress.c:683: INFO: bind to port 47728
> netstress.c:575: FAIL: recv failed, sock '3'
> netstress.c:642: BROK: Server closed
> ...
> 15:52:34.516
> 
> 
> This is caused by udp/udp_lite not using listen(), but maybe is should be at
> least mentioned in help (if wanted behavior).

Agree.


Thanks,
Alexey

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [LTP] [PATCH RFC 1/4] lib/tst_test.c: add 'needs_drivers' option with tst_check_drivers cmd
  2018-08-16 11:53     ` Petr Vorel
@ 2018-08-16 12:21       ` Alexey Kodanev
  0 siblings, 0 replies; 18+ messages in thread
From: Alexey Kodanev @ 2018-08-16 12:21 UTC (permalink / raw)
  To: ltp

On 08/16/2018 02:53 PM, Petr Vorel wrote:
> Hi,
> 
>> On 08/16/2018 01:59 PM, Cyril Hrubis wrote:
>>> Hi... 
>>> I do not like much that we change the behavir based on tst_test content.
>>> Maybe it would be cleaner to define a tst_check_driver(const char *name),
>>> then we can do the loop over tst_test->needs_drivers in the tst_test.c
>>> library and loop over argv in the shell helper.
> +1 it makes sense.
> 
>> Hi Cyril,
> 
>> OK, will send the 2nd version.
> 
> BTW it'd be nice to have support to load module with parameters.

Hmm, is it really worth to do, have any examples?

Thanks,
Alexey

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2018-08-16 12:21 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-09 15:23 [LTP] [PATCH RFC 1/4] lib/tst_test.c: add 'needs_drivers' option with tst_check_drivers cmd Alexey Kodanev
2018-08-09 15:23 ` [LTP] [PATCH RFC 2/4] lib/tst_test.sh: add TST_NEEDS_DRIVERS parameter Alexey Kodanev
2018-08-14 17:11   ` Petr Vorel
2018-08-16  8:54   ` Petr Vorel
2018-08-16 11:49     ` Alexey Kodanev
2018-08-09 15:23 ` [LTP] [PATCH RFC 3/4] lib/tst_test.sh: add TST_RTNL_CHK() helper function Alexey Kodanev
2018-08-14 18:39   ` Petr Vorel
2018-08-09 15:23 ` [LTP] [PATCH RFC 4/4] network/ipsec: replace ipsec_try() with TST_RTNL_CHK() Alexey Kodanev
2018-08-14 18:40   ` Petr Vorel
2018-08-16 11:16   ` [LTP] [RFC PATCH 2/2] netstress: Update help for -m behavior Petr Vorel
2018-08-16 12:01     ` Alexey Kodanev
2018-08-16 11:42   ` [LTP] [PATCH v2 1/1] network/route: Rewrite route-change-dst into new API Petr Vorel
2018-08-14 17:06 ` [LTP] [PATCH RFC 1/4] lib/tst_test.c: add 'needs_drivers' option with tst_check_drivers cmd Petr Vorel
2018-08-15 15:22   ` Alexey Kodanev
2018-08-16 10:59 ` Cyril Hrubis
2018-08-16 11:54   ` Alexey Kodanev
2018-08-16 11:53     ` Petr Vorel
2018-08-16 12:21       ` Alexey Kodanev

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.