Skip to contentSkip to conversation

network/netstress: fix -D option description

PATCH New Alexey Kodanev 2 participants 5 messages Nov 12, 2019 – Nov 13, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 network/netstress: fix -D option description

---
 testcases/network/netstress/netstress.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/network/netstress/netstress.c +1 -1
index 413f20a9d..a5cc9a532 100644
@@ -999,7 +999,7 @@ static struct tst_option options[] = {
 	{"T:", &type, "-T x     tcp (default), udp, udp_lite, dccp, sctp"},
 	{"z", &zcopy, "-z       enable SO_ZEROCOPY"},
 	{"P:", &reuse_port, "-P       enable SO_REUSEPORT"},
-	{"D:", &dev, "-d x     bind to device x\n"},
+	{"D:", &dev, "-D x     bind to device x\n"},
 
 	{"H:", &server_addr, "Client:\n-H x     Server name or IP address"},
 	{"l", &client_mode, "-l       Become client, default is server"},
Signature · 1 line
2.20.1
#1 lore raw

PATCH 2/2 network/netstress: set default options value after arg parsing

It fixes misleading warnings about multiple options being set:

$ netstress -H 127.0.0.1
tst_test.c:500: WARN: Option -H passed multiple times
tst_test.c:1217: INFO: Timeout per run is 0h 05m 00s
...

But for the result path 'rpath', don't create a file if the option is not set.

---
 testcases/network/netstress/netstress.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
testcases/network/netstress/netstress.c +7 -3
index a5cc9a532..76d2fdb04 100644
@@ -70,7 +70,7 @@ static int server_max_requests	= 3;
 static int client_max_requests	= 10;
 static int clients_num;
 static char *tcp_port;
-static char *server_addr	= "localhost";
+static char *server_addr;
 static char *source_addr;
 static char *server_bg;
 static int busy_poll		= -1;
@@ -101,7 +101,7 @@ static int sfd;
 static int wait_timeout = 60000;
 
 /* in the end test will save time result in this file */
-static char *rpath = "tfo_result";
+static char *rpath;
 static char *port_path = "netstress_port";
 static char *log_path = "netstress.log";
 
@@ -517,7 +517,8 @@ static void client_run(void)
 		SAFE_CLOSE(cfd);
 	}
 	/* the script tcp_fastopen_run.sh will remove it */
-	SAFE_FILE_PRINTF(rpath, "%ld", clnt_time);
+	if (rpath)
+		SAFE_FILE_PRINTF(rpath, "%ld", clnt_time);
 
 	tst_res(TPASS, "test completed");
 }
@@ -867,6 +868,9 @@ static void setup(void)
 	if (tst_parse_int(Aarg, &max_rand_msg_len, 10, max_msg_len))
 		tst_brk(TBROK, "Invalid max random payload size '%s'", Aarg);
 
+	if (!server_addr)
+		server_addr = "localhost";
+
 	if (max_rand_msg_len) {
 		max_rand_msg_len -= min_msg_len;
 		unsigned int seed = max_rand_msg_len ^ client_max_requests;
Signature · 1 line
2.20.1
#2 lore raw

PATCH 2/2 network/netstress: set default options value after arg parsing

Hi Alexey,

Quoted 11 lines

It fixes misleading warnings about multiple options being set:

$ netstress -H 127.0.0.1
tst_test.c:500: WARN: Option -H passed multiple times
tst_test.c:1217: INFO: Timeout per run is 0h 05m 00s
...

But for the result path 'rpath', don't create a file if the option is not set.

Good catch :).

Kind regards,
Petr

#3 lore raw

PATCH 2/2 network/netstress: set default options value after arg parsing

Quoted 12 lines · Petr Vorel

Hi Alexey,

Quoted 9 lines

It fixes misleading warnings about multiple options being set:

$ netstress -H 127.0.0.1
tst_test.c:500: WARN: Option -H passed multiple times
tst_test.c:1217: INFO: Timeout per run is 0h 05m 00s
...

But for the result path 'rpath', don't create a file if the option is not set.

Quoted 7 lines
Quoted 1 line

Good catch :).

Thanks for review Petr, both patches applied.