Skip to contentSkip to conversation

lib/tst_net: add generic tst_netload_compare()

PATCH New Alexey Kodanev 2 participants 16 messages Oct 15, 2020 – Oct 30, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/5 lib/tst_net: add generic tst_netload_compare()

* Remove duplicate code for comparing time-based results in network tests (bbr, busy_poll, sctp, tcp fastopen, virt tests)

* Expand thresholds for sctp, bbr test-cases, in order to avoid false-positive failures.

* In virt_lib.sh, keep sign for VIRT_PERF_THRESHOLD.

* TWARN when the base result is too bad (threshold_hi arg is set)

---
 testcases/lib/tst_net.sh                      | 31 +++++++++++++++++++
 testcases/network/busy_poll/busy_poll01.sh    | 10 ++----
 testcases/network/busy_poll/busy_poll02.sh    |  8 +----
 testcases/network/busy_poll/busy_poll03.sh    |  8 +----
 testcases/network/dccp/dccp01.sh              | 15 ++-------
 testcases/network/sctp/sctp01.sh              |  8 +----
 testcases/network/tcp_cc/bbr01.sh             |  2 +-
 testcases/network/tcp_cc/bbr02.sh             |  2 +-
 testcases/network/tcp_cc/dctcp01.sh           |  2 +-
 testcases/network/tcp_cc/tcp_cc_lib.sh        |  8 +----
 .../network/tcp_fastopen/tcp_fastopen_run.sh  | 15 ++-------
 testcases/network/virt/virt_lib.sh            | 21 ++-----------
 12 files changed, 46 insertions(+), 84 deletions(-)
testcases/lib/tst_net.sh +31 -0
index d939a5780..b29e076c3 100644
@@ -741,6 +741,37 @@ tst_netload()
 	return $ret
 }
 
+# Compares results for netload runs.
+# tst_netload_compare TIME_BASE TIME THRESHOLD_LOW [THRESHOLD_HI]
+# TIME_BASE: time taken to run netstress load test - 100%
+# TIME: time that is compared to the base one
+# THRESHOD_LOW: lower limit for TFAIL
+# THRESHOD_HIGH: upper limit for TWARN
+tst_netload_compare()
+{
+	local base_time=$1
+	local new_time=$2
+	local threshold_low=$3
+	local threshold_hi=$4
+
+	if [ -z "$base_time" -o -z "$new_time" -o -z "$threshold_low" ]; then
+		tst_brk_ TBROK "tst_netload_compare: invalid argument(s)"
+	fi
+
+	local res=$(((base_time - new_time) * 100 / base_time))
+	local msg="performance result is ${res}%"
+
+	if [ "$res" -lt "$threshold_low" ]; then
+		tst_res_ TFAIL "$msg < threshold ${threshold_low}%"
+		return
+	fi
+
+	[ "$threshold_hi" ] && [ "$res" -gt "$threshold_hi" ] && \
+		tst_res_ TWARN "$msg > threshold ${threshold_hi}%"
+
+	tst_res_ TPASS "$msg, in range [${threshold_low}:${threshold_hi:-}]%"
+}
+
 # tst_ping [IFACE] [DST ADDR] [MESSAGE SIZE ARRAY]
 # Check icmp connectivity
 # IFACE: source interface name or IP address
testcases/network/busy_poll/busy_poll01.sh +2 -8
index 0023f6cef..d306d1be8 100755
@@ -1,6 +1,6 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2015-2018 Oracle and/or its affiliates. All Rights Reserved.
+# Copyright (c) 2015-2020 Oracle and/or its affiliates. All Rights Reserved.
 #
 # Author: Alexey Kodanev <[email protected]>
 
@@ -47,13 +47,7 @@ test()
 		tst_netload -H $(tst_ipaddr rhost) -n 10 -N 10 -d res_$x
 	done
 
-	local poll_cmp=$(( 100 - ($(cat res_50) * 100) / $(cat res_0) ))
-
-	if [ "$poll_cmp" -lt 1 ]; then
-		tst_res TFAIL "busy poll result is '$poll_cmp' %"
-	else
-		tst_res TPASS "busy poll increased performance by '$poll_cmp' %"
-	fi
+	tst_netload_compare $(cat res_0) $(cat res_50) 1
 }
 
 tst_run
testcases/network/busy_poll/busy_poll02.sh +1 -7
index 1f25b7373..abb5160f9 100755
@@ -37,13 +37,7 @@ test()
 		tst_netload -H $(tst_ipaddr rhost) -n 10 -N 10 -d res_$x -b $x
 	done
 
-	local poll_cmp=$(( 100 - ($(cat res_50) * 100) / $(cat res_0) ))
-
-	if [ "$poll_cmp" -lt 1 ]; then
-		tst_res TFAIL "busy poll result is '$poll_cmp' %"
-	else
-		tst_res TPASS "busy poll increased performance by '$poll_cmp' %"
-	fi
+	tst_netload_compare $(cat res_0) $(cat res_50) 1
 }
 
 tst_run
testcases/network/busy_poll/busy_poll03.sh +1 -7
index 3c7029927..55ffefb07 100755
@@ -40,13 +40,7 @@ test()
 			    -b $x -T $2
 	done
 
-	local poll_cmp=$(( 100 - ($(cat res_50) * 100) / $(cat res_0) ))
-
-	if [ "$poll_cmp" -lt 1 ]; then
-		tst_res TFAIL "busy poll result is '$poll_cmp' %"
-	else
-		tst_res TPASS "busy poll increased performance by '$poll_cmp' %"
-	fi
+	tst_netload_compare $(cat res_0) $(cat res_50) 1
 }
 
 tst_run
testcases/network/dccp/dccp01.sh +2 -13
index d18ac6f18..52f232591 100755
@@ -9,17 +9,6 @@ TST_NEEDS_ROOT=1
 
 . tst_net.sh
 
-compare()
-{
-	local per=$(( $res0 * 100 / $res1 - 100 ))
-
-	if [ "$per" -gt "100" -o "$per" -lt "-100" ]; then
-		tst_res TFAIL "$1 performance $per %"
-	else
-		tst_res TPASS "$1 performance $per % in range -100 ... 100 %"
-	fi
-}
-
 test1()
 {
 	tst_res TINFO "run UDP"
@@ -31,14 +20,14 @@ test2()
 	tst_res TINFO "compare UDP/DCCP performance"
 	tst_netload -H $(tst_ipaddr rhost) -T dccp
 	res1="$(cat tst_netload.res)"
-	compare DCCP
+	tst_netload_compare $res0 $res1 -100 100
 }
 test3()
 {
 	tst_res TINFO "compare UDP/UDP-Lite performance"
 	tst_netload -H $(tst_ipaddr rhost) -T udp_lite
 	res1="$(cat tst_netload.res)"
-	compare UDP-Lite
+	tst_netload_compare $res0 $res1 -100 100
 }
 
 tst_run
testcases/network/sctp/sctp01.sh +1 -7
index a66020061..a42bd4975 100755
@@ -23,13 +23,7 @@ test()
 	tst_netload -S $(tst_ipaddr) -H $(tst_ipaddr rhost) -T sctp -R 3 $opts
 	local res1="$(cat tst_netload.res)"
 
-	local per=$(( $res0 * 100 / $res1 - 100 ))
-
-	if [ "$per" -gt "100" -o "$per" -lt "-100" ]; then
-		tst_res TFAIL "sctp performance $per %"
-	else
-		tst_res TPASS "sctp performance $per % in range -100 ... 100 %"
-	fi
+	tst_netload_compare $res0 $res1 -200 200
 }
 
 tst_run
testcases/network/tcp_cc/bbr01.sh +1 -1
index a6592b32d..3b80d50e4 100755
@@ -27,7 +27,7 @@ setup()
 
 do_test()
 {
-	tcp_cc_test01 bbr -50
+	tcp_cc_test01 bbr -100
 }
 
 tst_run
testcases/network/tcp_cc/bbr02.sh +1 -1
index b04c0c173..3a61e8726 100755
@@ -34,7 +34,7 @@ setup()
 do_test()
 {
 	tcp_cc_set_qdisc $2 || return
-	tcp_cc_test01 bbr -50
+	tcp_cc_test01 bbr -100
 }
 
 tst_run
testcases/network/tcp_cc/dctcp01.sh +1 -1
index 14ee96dbf..45311c5a2 100755
@@ -33,7 +33,7 @@ setup()
 
 do_test()
 {
-	tcp_cc_test01 dctcp 10
+	tcp_cc_test01 dctcp -100
 }
 
 tst_run
testcases/network/tcp_cc/tcp_cc_lib.sh +1 -7
index 815cc9c0e..dff8cef19 100755
@@ -101,11 +101,5 @@ tcp_cc_test01()
 	tst_netload -H $(tst_ipaddr rhost) -A $TST_NET_MAX_PKT
 	local res1="$(cat tst_netload.res)"
 
-	local per=$(( $res0 * 100 / $res1 - 100 ))
-
-	if [ "$per" -lt "$threshold" ]; then
-		tst_res TFAIL "$alg performance $per %"
-	else
-		tst_res TPASS "$alg performance $per %"
-	fi
+	tst_netload_compare $res0 $res1 $threshold
 }
testcases/network/tcp_fastopen/tcp_fastopen_run.sh +2 -13
index a4b542220..fb2cb8fc2 100755
@@ -36,17 +36,6 @@ cleanup()
 	tc qdisc del dev $(tst_iface) root netem delay 100 >/dev/null
 }
 
-compare()
-{
-	tfo_cmp=$(( 100 - ($time_tfo_on * 100) / $time_tfo_off ))
-
-	if [ "$tfo_cmp" -lt 3 ]; then
-		tst_res TFAIL "$1 perf result is '$tfo_cmp' percent"
-	else
-		tst_res TPASS "$1 perf result is '$tfo_cmp' percent"
-	fi
-}
-
 setup()
 {
 	if tst_kvcmp -lt "3.16" && [ "$TST_IPV6" ]; then
@@ -66,7 +55,7 @@ test1()
 	tst_netload -H $(tst_ipaddr rhost) -f -t 3 -R $srv_replies
 	time_tfo_on=$(cat tst_netload.res)
 
-	compare
+	tst_netload_compare $time_tfo_off $time_tfo_on 3
 }
 
 test2()
@@ -78,7 +67,7 @@ test2()
 	tst_netload -H $(tst_ipaddr rhost) -F -t 3 -R $srv_replies
 	time_tfo_on=$(cat tst_netload.res)
 
-	compare
+	tst_netload_compare $time_tfo_off $time_tfo_on 3
 }
 
 tst_run
testcases/network/virt/virt_lib.sh +2 -19
index cb2b2ba97..80b9bcc90 100644
@@ -295,25 +295,8 @@ virt_compare_netperf()
 	local lt="$(cat res_lan)"
 	tst_res TINFO "time lan IPv${TST_IPVER}($lt) $virt_type IPv4($vt) and IPv6($vt6) ms"
 
-	per=$(( $vt * 100 / $lt - 100 ))
-	per6=$(( $vt6 * 100 / $lt - 100 ))
-
-	case "$virt_type" in
-	vxlan|geneve)
-		tst_res TINFO "IP4 $virt_type over IP$TST_IPVER slower by $per %"
-		tst_res TINFO "IP6 $virt_type over IP$TST_IPVER slower by $per6 %"
-	;;
-	*)
-		tst_res TINFO "IP4 $virt_type slower by $per %"
-		tst_res TINFO "IP6 $virt_type slower by $per6 %"
-	esac
-
-	if [ "$per" -ge "$VIRT_PERF_THRESHOLD" -o \
-	     "$per6" -ge "$VIRT_PERF_THRESHOLD" ]; then
-		tst_res TFAIL "Test failed, threshold: $VIRT_PERF_THRESHOLD %"
-	else
-		tst_res TPASS "Test passed, threshold: $VIRT_PERF_THRESHOLD %"
-	fi
+	tst_netload_compare $lt $vt "-$VIRT_PERF_THRESHOLD"
+	tst_netload_compare $lt $vt6 "-$VIRT_PERF_THRESHOLD"
 }
 
 virt_check_cmd()
Signature · 1 line
2.20.1
#1 lore raw

PATCH 2/5 lib/tst_net: calc mean in tst_netload()

Add TST_NETLOAD_RUN_COUNT to control how many times netstress test will be run to calculate the mean time value. Default is 5.

This value will divide the total number of requests in order not to significantly increase the time for the test after this patch.

Moreover, one of the runs can fail once, it will produce only a warning. The test will broke after the second failure. It can be useful to make sure we have reproducible results.

---
 testcases/lib/tst_net.sh | 95 ++++++++++++++++++++++++++--------------
 1 file changed, 62 insertions(+), 33 deletions(-)
testcases/lib/tst_net.sh +62 -33
index b29e076c3..1912b984d 100644
@@ -623,9 +623,11 @@ tst_wait_ipv6_dad()
 	done
 }
 
-tst_dump_rhost_cmd()
+tst_netload_brk()
 {
 	tst_rhost_run -c "cat $TST_TMPDIR/netstress.log"
+	cat tst_netload.log
+	tst_brk_ $1 $2
 }
 
 # Run network load test, see 'netstress -h' for option description
@@ -640,6 +642,7 @@ tst_netload()
 	# common options for client and server
 	local cs_opts=
 
+	local run_cnt="$TST_NETLOAD_RUN_COUNT"
 	local c_num="$TST_NETLOAD_CLN_NUMBER"
 	local c_requests="$TST_NETLOAD_CLN_REQUESTS"
 	local c_opts=
@@ -692,51 +695,76 @@ tst_netload()
 	local expect_ret=0
 	[ "$expect_res" != "pass" ] && expect_ret=3
 
-	tst_rhost_run -c "pkill -9 netstress\$"
-	s_opts="${cs_opts}${s_opts}-R $s_replies -B $TST_TMPDIR"
-	tst_res_ TINFO "run server 'netstress $s_opts'"
-	tst_rhost_run -c "netstress $s_opts" > tst_netload.log 2>&1
-	if [ $? -ne 0 ]; then
-		cat tst_netload.log
-		local ttype="TFAIL"
-		grep -e 'CONF:' tst_netload.log && ttype="TCONF"
-		tst_brk_ $ttype "server failed"
+	local was_failure=0
+	if [ "$run_cnt" -lt 2 ]; then
+		run_cnt=1
+		was_failure=1
 	fi
 
-	local port=$(tst_rhost_run -s -c "cat $TST_TMPDIR/netstress_port")
-	c_opts="${cs_opts}${c_opts}-a $c_num -r $c_requests -d $rfile -g $port"
+	s_opts="${cs_opts}${s_opts}-R $s_replies -B $TST_TMPDIR"
+	c_opts="${cs_opts}${c_opts}-a $c_num -r $((c_requests / run_cnt)) -d $rfile"
+
+	tst_res_ TINFO "run server 'netstress $s_opts'"
+	tst_res_ TINFO "run client 'netstress -l $c_opts' $run_cnt times"
 
-	tst_res_ TINFO "run client 'netstress -l $c_opts'"
-	netstress -l $c_opts > tst_netload.log 2>&1 || ret=$?
 	tst_rhost_run -c "pkill -9 netstress\$"
+	rm -f tst_netload.log
+
+	local res=0
+	local passed=0
+
+	for i in $(seq 1 $run_cnt); do
+		tst_rhost_run -c "netstress $s_opts" > tst_netload.log 2>&1
+		if [ $? -ne 0 ]; then
+			cat tst_netload.log
+			local ttype="TFAIL"
+			grep -e 'CONF:' tst_netload.log && ttype="TCONF"
+			tst_brk_ $ttype "server failed"
+		fi
 
-	if [ "$expect_ret" -ne 0 ]; then
-		if [ $((ret & expect_ret)) -ne 0 ]; then
-			tst_res_ TPASS "netstress failed as expected"
-		else
-			tst_res_ TFAIL "expected '$expect_res' but ret: '$ret'"
+		local port=$(tst_rhost_run -s -c "cat $TST_TMPDIR/netstress_port")
+		netstress -l ${c_opts} -g $port > tst_netload.log 2>&1
+		ret=$?
+		tst_rhost_run -c "pkill -9 netstress\$"
+
+		if [ "$expect_ret" -ne 0 ]; then
+			if [ $((ret & expect_ret)) -ne 0 ]; then
+				tst_res_ TPASS "netstress failed as expected"
+			else
+				tst_res_ TFAIL "expected '$expect_res' but ret: '$ret'"
+			fi
+			return $ret
+		fi
+
+		if [ "$ret" -ne 0 ]; then
+			[ $((ret & 32)) -ne 0 ] && \
+				tst_netload_brk TCONF "not supported configuration"
+
+			[ $((ret & 3)) -ne 0 -a $was_failure -gt 0 ] && \
+				tst_netload_brk TFAIL "expected '$expect_res' but ret: '$ret'"
+
+			tst_res_ TWARN "netstress failed, ret: $ret"
+			was_failure=1
+			continue
 		fi
-		return $ret
-	fi
+
+		[ ! -f $rfile ] && \
+			tst_netload_brk TFAIL "can't read $rfile"
+
+		res="$((res + $(cat $rfile)))"
+		passed=$((passed + 1))
+	done
 
 	if [ "$ret" -ne 0 ]; then
-		tst_dump_rhost_cmd
-		cat tst_netload.log
-		[ $((ret & 3)) -ne 0 ] && \
-			tst_brk_ TFAIL "expected '$expect_res' but ret: '$ret'"
-		[ $((ret & 32)) -ne 0 ] && \
-			tst_brk_ TCONF "not supported configuration"
 		[ $((ret & 4)) -ne 0 ] && \
 			tst_res_ TWARN "netstress has warnings"
+		tst_netload_brk TFAIL "expected '$expect_res' but ret: '$ret'"
 	fi
 
-	if [ ! -f $rfile ]; then
-		tst_dump_rhost_cmd
-		cat tst_netload.log
-		tst_brk_ TFAIL "can't read $rfile"
-	fi
+	res=$((res / $passed))
+	echo "$res" > $rfile
 
-	tst_res_ TPASS "netstress passed, time spent '$(cat $rfile)' ms"
+	tst_res_ TPASS "netstress passed, mean time '$res' ms"
 
 	return $ret
 }
@@ -938,6 +966,7 @@ export TST_NET_DATAROOT="$LTPROOT/testcases/bin/datafiles"
 export TST_NETLOAD_CLN_REQUESTS="${TST_NETLOAD_CLN_REQUESTS:-10000}"
 export TST_NETLOAD_CLN_NUMBER="${TST_NETLOAD_CLN_NUMBER:-2}"
 export TST_NETLOAD_BINDTODEVICE="${TST_NETLOAD_BINDTODEVICE-1}"
+export TST_NETLOAD_RUN_COUNT="${TST_NETLOAD_RUN_COUNT:-5}"
 export HTTP_DOWNLOAD_DIR="${HTTP_DOWNLOAD_DIR:-/var/www/html}"
 export FTP_DOWNLOAD_DIR="${FTP_DOWNLOAD_DIR:-/var/ftp}"
 export FTP_UPLOAD_DIR="${FTP_UPLOAD_DIR:-/var/ftp/pub}"
Signature · 1 line
2.20.1
#2 lore raw

PATCH 2/5 lib/tst_net: calc mean in tst_netload()

Quoted 45 lines

Add TST_NETLOAD_RUN_COUNT to control how many times netstress test will be run to calculate the mean time value. Default is 5.

This value will divide the total number of requests in order not to significantly increase the time for the test after this patch.

Moreover, one of the runs can fail once, it will produce only a warning. The test will broke after the second failure. It can be useful to make sure we have reproducible results.

---
 testcases/lib/tst_net.sh | 95 ++++++++++++++++++++++++++--------------
 1 file changed, 62 insertions(+), 33 deletions(-)
testcases/lib/tst_net.sh +4 -1
index b29e076c3..1912b984d 100644
@@ -623,9 +623,11 @@ tst_wait_ipv6_dad()
 	done
 }
 
-tst_dump_rhost_cmd()
+tst_netload_brk()
 {
 	tst_rhost_run -c "cat $TST_TMPDIR/netstress.log"
+	cat tst_netload.log
+	tst_brk_ $1 $2
 }
 
 # Run network load test, see 'netstress -h' for option description
@@ -640,6 +642,7 @@ tst_netload()
 	# common options for client and server
 	local cs_opts=
 
+	local run_cnt="$TST_NETLOAD_RUN_COUNT"
 	local c_num="$TST_NETLOAD_CLN_NUMBER"
 	local c_requests="$TST_NETLOAD_CLN_REQUESTS"
 	local c_opts=
@@ -692,51 +695,76 @@ tst_netload()
 	local expect_ret=0
 	[ "$expect_res" != "pass" ] && expect_ret=3
 

testcases/lib/tst_net.sh tst_netload() · line 698

Quoted 10 lines
testcases/lib/tst_net.sh +1 -9
-	tst_rhost_run -c "pkill -9 netstress\$"
-	s_opts="${cs_opts}${s_opts}-R $s_replies -B $TST_TMPDIR"
-	tst_res_ TINFO "run server 'netstress $s_opts'"
-	tst_rhost_run -c "netstress $s_opts" > tst_netload.log 2>&1
-	if [ $? -ne 0 ]; then
-		cat tst_netload.log
-		local ttype="TFAIL"
-		grep -e 'CONF:' tst_netload.log && ttype="TCONF"
-		tst_brk_ $ttype "server failed"
+	local was_failure=0

nit: I prefer have local variables at the top and boolean like variables as empty vs.
"1" (tested with [ "$foo" = 1 ] (see: if [ "$bind_to_device" = 1 -a "$TST_NETLOAD_BINDTODEVICE" = 1 ]; then few lines above).

This style is used in tst_test.sh, which is consistent, but style in tst_net.sh varies on this a lot. It's just a style and it wasn't introduced before this commit, thus feel free to ignore it, but it'd be nice to be consistent in library file.

testcases/lib/tst_net.sh tst_netload() · line 699

Quoted 1 line
testcases/lib/tst_net.sh +1 -0
+	if [ "$run_cnt" -lt 2 ]; then

maybe: if [ "$run_cnt" -lt 1 ]; then

BTW we should also check all numeric variables (TST_NETLOAD_CLN_REQUESTS, ...) with tst_is_int (but don't bother with it now).

testcases/lib/tst_net.sh tst_netload() · line 701

Quoted 2 lines
testcases/lib/tst_net.sh +2 -0
+		run_cnt=1
+		was_failure=1

Hm, $was_failure set before loop. Shouldn't it be inside for i in $(seq 1 $run_cnt); do loop? And updated on each failure (be a error counter, not boolean)?

Quoted 42 lines
testcases/lib/tst_net.sh +28 -9
 	fi
 
-	local port=$(tst_rhost_run -s -c "cat $TST_TMPDIR/netstress_port")
-	c_opts="${cs_opts}${c_opts}-a $c_num -r $c_requests -d $rfile -g $port"
+	s_opts="${cs_opts}${s_opts}-R $s_replies -B $TST_TMPDIR"
+	c_opts="${cs_opts}${c_opts}-a $c_num -r $((c_requests / run_cnt)) -d $rfile"
+
+	tst_res_ TINFO "run server 'netstress $s_opts'"
+	tst_res_ TINFO "run client 'netstress -l $c_opts' $run_cnt times"
 
-	tst_res_ TINFO "run client 'netstress -l $c_opts'"
-	netstress -l $c_opts > tst_netload.log 2>&1 || ret=$?
 	tst_rhost_run -c "pkill -9 netstress\$"
+	rm -f tst_netload.log
+
+	local res=0
+	local passed=0
+
+	for i in $(seq 1 $run_cnt); do
+		tst_rhost_run -c "netstress $s_opts" > tst_netload.log 2>&1
+		if [ $? -ne 0 ]; then
+			cat tst_netload.log
+			local ttype="TFAIL"
+			grep -e 'CONF:' tst_netload.log && ttype="TCONF"
+			tst_brk_ $ttype "server failed"
+		fi
 
-	if [ "$expect_ret" -ne 0 ]; then
-		if [ $((ret & expect_ret)) -ne 0 ]; then
-			tst_res_ TPASS "netstress failed as expected"
-		else
-			tst_res_ TFAIL "expected '$expect_res' but ret: '$ret'"
+		local port=$(tst_rhost_run -s -c "cat $TST_TMPDIR/netstress_port")
+		netstress -l ${c_opts} -g $port > tst_netload.log 2>&1
+		ret=$?
+		tst_rhost_run -c "pkill -9 netstress\$"
+
+		if [ "$expect_ret" -ne 0 ]; then
+			if [ $((ret & expect_ret)) -ne 0 ]; then
+				tst_res_ TPASS "netstress failed as expected"
+			else
+				tst_res_ TFAIL "expected '$expect_res' but ret: '$ret'"

testcases/lib/tst_net.sh tst_netload() · line 744

Quoted 10 lines
testcases/lib/tst_net.sh +10 -0
+			fi
+			return $ret
+		fi
+
+		if [ "$ret" -ne 0 ]; then
+			[ $((ret & 32)) -ne 0 ] && \
+				tst_netload_brk TCONF "not supported configuration"
+
+			[ $((ret & 3)) -ne 0 -a $was_failure -gt 0 ] && \
+				tst_netload_brk TFAIL "expected '$expect_res' but ret: '$ret'"

Instead the 2 lines above maybe this? Or am I missing something?

			if [ $((ret & 3)) -ne 0 ]; then
				was_failure=$((was_failure+1))
			fi
			[ $was_failure -gt 0 ] && \
				tst_netload_brk TFAIL "expected '$expect_res' but ret: '$ret'"

testcases/lib/tst_net.sh tst_netload() · line 720

Quoted 7 lines
testcases/lib/tst_net.sh +4 -2
+
+			tst_res_ TWARN "netstress failed, ret: $ret"
+			was_failure=1
+			continue
 		fi
-		return $ret
-	fi

...

Kind regards,
Petr

#3 lore raw

PATCH 2/5 lib/tst_net: calc mean in tst_netload()

Quoted 67 lines · Petr Vorel
Quoted 45 lines

Add TST_NETLOAD_RUN_COUNT to control how many times netstress test will be run to calculate the mean time value. Default is 5.

This value will divide the total number of requests in order not to significantly increase the time for the test after this patch.

Moreover, one of the runs can fail once, it will produce only a warning. The test will broke after the second failure. It can be useful to make sure we have reproducible results.

---
 testcases/lib/tst_net.sh | 95 ++++++++++++++++++++++++++--------------
 1 file changed, 62 insertions(+), 33 deletions(-)
testcases/lib/tst_net.sh +4 -1
index b29e076c3..1912b984d 100644
@@ -623,9 +623,11 @@ tst_wait_ipv6_dad()
 	done
 }
 
-tst_dump_rhost_cmd()
+tst_netload_brk()
 {
 	tst_rhost_run -c "cat $TST_TMPDIR/netstress.log"
+	cat tst_netload.log
+	tst_brk_ $1 $2
 }
 
 # Run network load test, see 'netstress -h' for option description
@@ -640,6 +642,7 @@ tst_netload()
 	# common options for client and server
 	local cs_opts=
 
+	local run_cnt="$TST_NETLOAD_RUN_COUNT"
 	local c_num="$TST_NETLOAD_CLN_NUMBER"
 	local c_requests="$TST_NETLOAD_CLN_REQUESTS"
 	local c_opts=
@@ -692,51 +695,76 @@ tst_netload()
 	local expect_ret=0
 	[ "$expect_res" != "pass" ] && expect_ret=3
 

testcases/lib/tst_net.sh tst_netload() · line 698

Quoted 10 lines
testcases/lib/tst_net.sh +1 -9
-	tst_rhost_run -c "pkill -9 netstress\$"
-	s_opts="${cs_opts}${s_opts}-R $s_replies -B $TST_TMPDIR"
-	tst_res_ TINFO "run server 'netstress $s_opts'"
-	tst_rhost_run -c "netstress $s_opts" > tst_netload.log 2>&1
-	if [ $? -ne 0 ]; then
-		cat tst_netload.log
-		local ttype="TFAIL"
-		grep -e 'CONF:' tst_netload.log && ttype="TCONF"
-		tst_brk_ $ttype "server failed"
+	local was_failure=0

nit: I prefer have local variables at the top and boolean like variables as empty vs.
"1" (tested with [ "$foo" = 1 ] (see: if [ "$bind_to_device" = 1 -a "$TST_NETLOAD_BINDTODEVICE" = 1 ]; then few lines above).

This style is used in tst_test.sh, which is consistent, but style in tst_net.sh varies on this a lot. It's just a style and it wasn't introduced before this commit, thus feel free to ignore it, but it'd be nice to be consistent in library file.

testcases/lib/tst_net.sh tst_netload() · line 699

Quoted 1 line
testcases/lib/tst_net.sh +1 -0
+	if [ "$run_cnt" -lt 2 ]; then

maybe: if [ "$run_cnt" -lt 1 ]; then

Quoted 7 lines

BTW we should also check all numeric variables (TST_NETLOAD_CLN_REQUESTS, ...) with tst_is_int (but don't bother with it now).

testcases/lib/tst_net.sh tst_netload() · line 701

Quoted 2 lines
testcases/lib/tst_net.sh +2 -0
+		run_cnt=1
+		was_failure=1

Hm, $was_failure set before loop. Shouldn't it be inside for i in $(seq 1 $run_cnt); do loop? And updated on each failure (be a error counter, not boolean)?

It is set to 1 for the special case, i.e. when run_cnt is 1, in that case we should tbrok the test at once. I don't see how the error counter will be better?

Quoted 54 lines
Quoted 42 lines
testcases/lib/tst_net.sh +28 -9
 	fi
 
-	local port=$(tst_rhost_run -s -c "cat $TST_TMPDIR/netstress_port")
-	c_opts="${cs_opts}${c_opts}-a $c_num -r $c_requests -d $rfile -g $port"
+	s_opts="${cs_opts}${s_opts}-R $s_replies -B $TST_TMPDIR"
+	c_opts="${cs_opts}${c_opts}-a $c_num -r $((c_requests / run_cnt)) -d $rfile"
+
+	tst_res_ TINFO "run server 'netstress $s_opts'"
+	tst_res_ TINFO "run client 'netstress -l $c_opts' $run_cnt times"
 
-	tst_res_ TINFO "run client 'netstress -l $c_opts'"
-	netstress -l $c_opts > tst_netload.log 2>&1 || ret=$?
 	tst_rhost_run -c "pkill -9 netstress\$"
+	rm -f tst_netload.log
+
+	local res=0
+	local passed=0
+
+	for i in $(seq 1 $run_cnt); do
+		tst_rhost_run -c "netstress $s_opts" > tst_netload.log 2>&1
+		if [ $? -ne 0 ]; then
+			cat tst_netload.log
+			local ttype="TFAIL"
+			grep -e 'CONF:' tst_netload.log && ttype="TCONF"
+			tst_brk_ $ttype "server failed"
+		fi
 
-	if [ "$expect_ret" -ne 0 ]; then
-		if [ $((ret & expect_ret)) -ne 0 ]; then
-			tst_res_ TPASS "netstress failed as expected"
-		else
-			tst_res_ TFAIL "expected '$expect_res' but ret: '$ret'"
+		local port=$(tst_rhost_run -s -c "cat $TST_TMPDIR/netstress_port")
+		netstress -l ${c_opts} -g $port > tst_netload.log 2>&1
+		ret=$?
+		tst_rhost_run -c "pkill -9 netstress\$"
+
+		if [ "$expect_ret" -ne 0 ]; then
+			if [ $((ret & expect_ret)) -ne 0 ]; then
+				tst_res_ TPASS "netstress failed as expected"
+			else
+				tst_res_ TFAIL "expected '$expect_res' but ret: '$ret'"

testcases/lib/tst_net.sh tst_netload() · line 744

Quoted 10 lines
testcases/lib/tst_net.sh +10 -0
+			fi
+			return $ret
+		fi
+
+		if [ "$ret" -ne 0 ]; then
+			[ $((ret & 32)) -ne 0 ] && \
+				tst_netload_brk TCONF "not supported configuration"
+
+			[ $((ret & 3)) -ne 0 -a $was_failure -gt 0 ] && \
+				tst_netload_brk TFAIL "expected '$expect_res' but ret: '$ret'"

Instead the 2 lines above maybe this? Or am I missing something?

Quoted 5 lines
			if [ $((ret & 3)) -ne 0 ]; then
				was_failure=$((was_failure+1))
			fi
			[ $was_failure -gt 0 ] && \
				tst_netload_brk TFAIL "expected '$expect_res' but ret: '$ret'"

With this, it should exit on the first error, as it was before this patch...

And I'm expecting to do this only on the second one, if run_cnt >= 2.

Quoted 12 lines

testcases/lib/tst_net.sh tst_netload() · line 720

Quoted 7 lines
testcases/lib/tst_net.sh +4 -2
+
+			tst_res_ TWARN "netstress failed, ret: $ret"
+			was_failure=1
+			continue
 		fi
-		return $ret
-	fi

...

Kind regards,
Petr

#4 lore raw

PATCH 2/5 lib/tst_net: calc mean in tst_netload()

Hi Alexey,

...

Quoted 12 lines
Quoted 10 lines

testcases/lib/tst_net.sh tst_netload() · line 699

Quoted 1 line
testcases/lib/tst_net.sh +1 -0
+	if [ "$run_cnt" -lt 2 ]; then

maybe: if [ "$run_cnt" -lt 1 ]; then

BTW we should also check all numeric variables (TST_NETLOAD_CLN_REQUESTS, ...) with tst_is_int (but don't bother with it now).

Review

Quoted 2 lines
(quoted diff) +2 -0
+		run_cnt=1
+		was_failure=1

Hm, $was_failure set before loop. Shouldn't it be inside for i in $(seq 1 $run_cnt); do loop? And updated on each failure (be a error counter, not boolean)?

Quoted 3 lines

It is set to 1 for the special case, i.e. when run_cnt is 1, in that case we should tbrok the test at once. I don't see how the error counter will be better?

I'm sorry, I just misinterpret the code, please ignore my comment.

Kind regards,
Petr

#5 lore raw

PATCH 3/5 network/virt: skip setting neighbour table if tunnel doesn't have hwaddr

In reply to Alexey Kodanev
---
 testcases/network/virt/virt_lib.sh | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
testcases/network/virt/virt_lib.sh +7 -4
index 80b9bcc90..f62120347 100644
@@ -229,10 +229,13 @@ virt_minimize_timeout()
 	local mac_loc="$(cat /sys/class/net/ltp_v0/address)"
 	local mac_rmt="$(tst_rhost_run -c 'cat /sys/class/net/ltp_v0/address')"
 
-	ROD_SILENT "ip ne replace $ip_virt_remote lladdr \
-		    $mac_rmt nud permanent dev ltp_v0"
-	tst_rhost_run -s -c "ip ne replace $ip_virt_local lladdr \
-			     $mac_loc nud permanent dev ltp_v0"
+	if [ "$mac_loc" ]; then
+		ROD_SILENT "ip ne replace $ip_virt_remote lladdr \
+			    $mac_rmt nud permanent dev ltp_v0"
+		tst_rhost_run -s -c "ip ne replace $ip_virt_local lladdr \
+				     $mac_loc nud permanent dev ltp_v0"
+	fi
+
 	virt_tcp_syn=$(sysctl -n net.ipv4.tcp_syn_retries)
 	ROD sysctl -q net.ipv4.tcp_syn_retries=1
 }
Signature · 1 line
2.20.1
#6 lore raw

PATCH 3/5 network/virt: skip setting neighbour table if tunnel doesn't have hwaddr

Hi Alexey,

good idea.

testcases/network/virt/virt_lib.sh virt_minimize_timeout() · line 232

Quoted 13 lines
testcases/network/virt/virt_lib.sh +1 -4
index 80b9bcc90..f62120347 100644
@@ -229,10 +229,13 @@ virt_minimize_timeout()
 	local mac_loc="$(cat /sys/class/net/ltp_v0/address)"
 	local mac_rmt="$(tst_rhost_run -c 'cat /sys/class/net/ltp_v0/address')"
 
-	ROD_SILENT "ip ne replace $ip_virt_remote lladdr \
-		    $mac_rmt nud permanent dev ltp_v0"
-	tst_rhost_run -s -c "ip ne replace $ip_virt_local lladdr \
-			     $mac_loc nud permanent dev ltp_v0"
+	if [ "$mac_loc" ]; then

NOTE: I guess it's safe to check only $mac_rmt (and not $mac_rmt)

testcases/network/virt/virt_lib.sh virt_minimize_timeout() · line 241

Quoted 9 lines
testcases/network/virt/virt_lib.sh +6 -0
+		ROD_SILENT "ip ne replace $ip_virt_remote lladdr \
+			    $mac_rmt nud permanent dev ltp_v0"
+		tst_rhost_run -s -c "ip ne replace $ip_virt_local lladdr \
+				     $mac_loc nud permanent dev ltp_v0"
+	fi
+
 	virt_tcp_syn=$(sysctl -n net.ipv4.tcp_syn_retries)
 	ROD sysctl -q net.ipv4.tcp_syn_retries=1
 }

Kind regards,
Petr

#7 lore raw

PATCH 4/5 network/virt: add wireguard01

In reply to Alexey Kodanev

* performance tests with TCP traffic

* invalid configuration with allowed IPs, public key

* emulation of the lossy link for the underlying interface.

---
 runtest/net.features                    |  3 ++
 testcases/network/virt/virt_lib.sh      |  4 +-
 testcases/network/virt/wireguard01.sh   | 56 ++++++++++++++++++++
 testcases/network/virt/wireguard_lib.sh | 68 +++++++++++++++++++++++++
 4 files changed, 129 insertions(+), 2 deletions(-)
 create mode 100755 testcases/network/virt/wireguard01.sh
 create mode 100755 testcases/network/virt/wireguard_lib.sh
runtest/net.features +3 -0
index 44a974563..c5a1ba714 100644
@@ -78,3 +78,6 @@ mpls03_ipv6 mpls03.sh -6
 mpls04 mpls04.sh
 
 fanout01 fanout01
+
+wireguard01 wireguard01.sh
+wireguard01_ipv6 wireguard01.sh -6
testcases/network/virt/virt_lib.sh +2 -2
index f62120347..abf331428 100644
@@ -124,7 +124,7 @@ virt_add()
 	esac
 
 	case $virt_type in
-	vxlan|geneve|sit)
+	vxlan|geneve|sit|wireguard)
 		ip li add $vname type $virt_type $opt
 	;;
 	gre|ip6gre)
@@ -145,7 +145,7 @@ virt_add_rhost()
 		[ "$vxlan_dstport" -eq 1 ] && opt="$opt dstport 0"
 		tst_rhost_run -s -c "ip li add ltp_v0 type $virt_type $@ $opt"
 	;;
-	sit)
+	sit|wireguard)
 		tst_rhost_run -s -c "ip link add ltp_v0 type $virt_type $@"
 	;;
 	gre|ip6gre)
testcases/network/virt/wireguard01.sh new file +56 -0

56 lines not on this page · raw message

testcases/network/virt/wireguard_lib.sh new file +68 -0

68 lines not on this page · raw message

Signature · 1 line
2.20.1
#8 lore raw

PATCH 4/5 network/virt: add wireguard01

Hi Alexey,

Quoted 5 lines

* performance tests with TCP traffic

* invalid configuration with allowed IPs, public key

* emulation of the lossy link for the underlying interface.

Thanks a lot for supporting wireguard!

...

Quoted 48 lines
testcases/network/virt/wireguard_lib.sh new file +48 -0
+TST_NEEDS_TMPDIR=1
+TST_NEEDS_CMDS="$TST_NEEDS_CMDS wg"
+TST_TESTFUNC=${TST_TESTFUNC:-virt_netperf_msg_sizes}
+TST_SETUP=${TST_SETUP:-wireguard_lib_setup}
+TST_CLEANUP=${TST_CLEANUP:-wireguard_lib_cleanup}
+TST_NEEDS_DRIVERS="wireguard"
+VIRT_PERF_THRESHOLD_MIN=${VIRT_PERF_THRESHOLD_MIN:-200}
+
+virt_type="wireguard"
+. virt_lib.sh
+
+# Usage: wireguard_lib_setup [TYPE]
+# TYPE: [ default | invalid_allowed_ips | invalid_pub_keys ]
+wireguard_lib_setup()
+{
+	local type="${1:-default}"
+	local pub_key0="$(wg genkey | tee wg0.key | wg pubkey)"
+	local pub_key1="$(wg genkey | tee wg1.key | wg pubkey)"
+
+	local port_loc="$(tst_get_unused_port ipv${TST_IPVER} dgram)"
+	local port_rmt=$(tst_rhost_run -c "tst_get_unused_port ipv${TST_IPVER} dgram")
+
+	# copy private key to remote host
+	tst_rhost_run -s -c "echo '$(cat wg1.key)' > wg1.key"
+
+	tst_res TINFO "setup wireguard UDPv${TST_IPVER} tunnel, port $port_loc/$port_rmt"
+	tst_res TINFO "lhost[$(tst_ipaddr)] <-> rhost[$(tst_ipaddr rhost)]"
+
+	virt_setup
+
+	local ka_opt="persistent-keepalive 1"
+	local allow_ip_loc="${ip_virt_local}/32,${ip6_virt_local}/128"
+	local allow_ip_rmt="${ip_virt_remote}/32,${ip6_virt_remote}/128"
+
+	case $type in
+	invalid_allowed_ips)
+		allow_ip_loc="${ip_virt_remote}/32,${ip6_virt_remote}/128"
+		allow_ip_rmt="${ip_virt_local}/32,${ip6_virt_local}/128"
+		tst_res TINFO "Allowed IPs are source IPs only"
+		;;
+	invalid_pub_keys)
+		pub_key0="$(wg genkey | wg pubkey)"
+		tst_res TINFO "Invalid peer public key of lhost"
+		;;
+	esac
+
+	ROD wg set ltp_v0 listen-port $port_loc private-key wg0.key
+	ROD wg set ltp_v0 peer $pub_key1 endpoint \

testcases/network/virt/wireguard_lib.sh line 62

Quoted 10 lines
testcases/network/virt/wireguard_lib.sh new file +10 -0
+		$(tst_ipaddr rhost):$port_rmt $ka_opt \
+		allowed-ips $allow_ip_rmt
+
+	tst_rhost_run -s -c \
+		"wg set ltp_v0 listen-port $port_rmt private-key wg1.key"
+	tst_rhost_run -s -c "wg set ltp_v0 peer $pub_key0 \
+		endpoint $(tst_ipaddr):$port_loc $ka_opt \
+		allowed-ips $allow_ip_loc"
+
+	tst_net_run -s "ip route add 128.0.0.0/1 dev ltp_v0"

Out of curiosity: why is IPv4 enough? (we test also IPv6)

testcases/network/virt/wireguard_lib.sh line 68

Quoted 6 lines
testcases/network/virt/wireguard_lib.sh new file +6 -0
+}
+
+wireguard_lib_cleanup()
+{
+	virt_cleanup
+}

Why not use just virt_cleanup() ?

Kind regards,
Petr

#9 lore raw

PATCH 4/5 network/virt: add wireguard01

Quoted 64 lines · Petr Vorel

Hi Alexey,

Quoted 5 lines

* performance tests with TCP traffic

* invalid configuration with allowed IPs, public key

* emulation of the lossy link for the underlying interface.

Thanks a lot for supporting wireguard!

...

Quoted 51 lines
testcases/network/virt/wireguard_lib.sh new file +51 -0
+TST_NEEDS_TMPDIR=1
+TST_NEEDS_CMDS="$TST_NEEDS_CMDS wg"
+TST_TESTFUNC=${TST_TESTFUNC:-virt_netperf_msg_sizes}
+TST_SETUP=${TST_SETUP:-wireguard_lib_setup}
+TST_CLEANUP=${TST_CLEANUP:-wireguard_lib_cleanup}
+TST_NEEDS_DRIVERS="wireguard"
+VIRT_PERF_THRESHOLD_MIN=${VIRT_PERF_THRESHOLD_MIN:-200}
+
+virt_type="wireguard"
+. virt_lib.sh
+
+# Usage: wireguard_lib_setup [TYPE]
+# TYPE: [ default | invalid_allowed_ips | invalid_pub_keys ]
+wireguard_lib_setup()
+{
+	local type="${1:-default}"
+	local pub_key0="$(wg genkey | tee wg0.key | wg pubkey)"
+	local pub_key1="$(wg genkey | tee wg1.key | wg pubkey)"
+
+	local port_loc="$(tst_get_unused_port ipv${TST_IPVER} dgram)"
+	local port_rmt=$(tst_rhost_run -c "tst_get_unused_port ipv${TST_IPVER} dgram")
+
+	# copy private key to remote host
+	tst_rhost_run -s -c "echo '$(cat wg1.key)' > wg1.key"
+
+	tst_res TINFO "setup wireguard UDPv${TST_IPVER} tunnel, port $port_loc/$port_rmt"
+	tst_res TINFO "lhost[$(tst_ipaddr)] <-> rhost[$(tst_ipaddr rhost)]"
+
+	virt_setup
+
+	local ka_opt="persistent-keepalive 1"
+	local allow_ip_loc="${ip_virt_local}/32,${ip6_virt_local}/128"
+	local allow_ip_rmt="${ip_virt_remote}/32,${ip6_virt_remote}/128"
+
+	case $type in
+	invalid_allowed_ips)
+		allow_ip_loc="${ip_virt_remote}/32,${ip6_virt_remote}/128"
+		allow_ip_rmt="${ip_virt_local}/32,${ip6_virt_local}/128"
+		tst_res TINFO "Allowed IPs are source IPs only"
+		;;
+	invalid_pub_keys)
+		pub_key0="$(wg genkey | wg pubkey)"
+		tst_res TINFO "Invalid peer public key of lhost"
+		;;
+	esac
+
+	ROD wg set ltp_v0 listen-port $port_loc private-key wg0.key
+	ROD wg set ltp_v0 peer $pub_key1 endpoint \
+		$(tst_ipaddr rhost):$port_rmt $ka_opt \
+		allowed-ips $allow_ip_rmt
+
Quoted 8 lines

testcases/network/virt/wireguard_lib.sh line 62

Quoted 7 lines
testcases/network/virt/wireguard_lib.sh new file +7 -0
+	tst_rhost_run -s -c \
+		"wg set ltp_v0 listen-port $port_rmt private-key wg1.key"
+	tst_rhost_run -s -c "wg set ltp_v0 peer $pub_key0 \
+		endpoint $(tst_ipaddr):$port_loc $ka_opt \
+		allowed-ips $allow_ip_loc"
+
+	tst_net_run -s "ip route add 128.0.0.0/1 dev ltp_v0"

Out of curiosity: why is IPv4 enough? (we test also IPv6)

Hi Petr,

Looks like no need for additional route table setup, and overriding default route... tst_netload() uses addresses of wireguard device. Will remove it.

Quoted 9 lines

testcases/network/virt/wireguard_lib.sh line 68

Quoted 7 lines
testcases/network/virt/wireguard_lib.sh new file +6 -0
+}
+
+wireguard_lib_cleanup()
+{
+	virt_cleanup
+}

Why not use just virt_cleanup() ?

Yes, it's just a wrapper, but it is used in wirguard01/02 tests. In case we need additional setup/cleanup we would have to change both tests too.

Quoted 4 lines

Kind regards,
Petr

#10 lore raw

PATCH 4/5 network/virt: add wireguard01

Hi Alexey,

...

Quoted 8 lines
Quoted 2 lines

testcases/network/virt/wireguard_lib.sh line 62

Quoted 1 line
testcases/network/virt/wireguard_lib.sh new file +1 -0
+	tst_net_run -s "ip route add 128.0.0.0/1 dev ltp_v0"

Out of curiosity: why is IPv4 enough? (we test also IPv6)

Hi Petr,

Looks like no need for additional route table setup, and overriding default route... tst_netload() uses addresses of wireguard device. Will remove it.

ack.

Quoted 9 lines
Quoted 8 lines

testcases/network/virt/wireguard_lib.sh line 68

Quoted 6 lines
testcases/network/virt/wireguard_lib.sh new file +6 -0
+}
+
+wireguard_lib_cleanup()
+{
+	virt_cleanup
+}

Why not use just virt_cleanup() ?

Quoted 3 lines

Yes, it's just a wrapper, but it is used in wirguard01/02 tests. In case we need additional setup/cleanup we would have to change both tests too.

Sure, no problem. Looking forward this patchset to be merged :). Thanks for your work!

Kind regards,
Petr

#11 lore raw

PATCH 5/5 network/virt: add wireguard02: ipsec vs wireguard

In reply to Alexey Kodanev

Compare multi-threading performance with IPSec/vti.

---
 runtest/net.features                  |  2 ++
 testcases/lib/tst_test.sh             |  2 +-
 testcases/network/virt/wireguard02.sh | 48 +++++++++++++++++++++++++++
 3 files changed, 51 insertions(+), 1 deletion(-)
 create mode 100755 testcases/network/virt/wireguard02.sh
runtest/net.features +2 -0
index c5a1ba714..617a6b91e 100644
@@ -81,3 +81,5 @@ fanout01 fanout01
 
 wireguard01 wireguard01.sh
 wireguard01_ipv6 wireguard01.sh -6
+wireguard02 wireguard02.sh
+wireguard02_ipv6 wireguard02.sh -6
testcases/lib/tst_test.sh +1 -1
index f2bd1e3ef..2417da140 100644
@@ -506,7 +506,7 @@ tst_run()
 			NEEDS_DRIVERS|FS_TYPE|MNTPOINT|MNT_PARAMS);;
 			IPV6|IPVER|TEST_DATA|TEST_DATA_IFS);;
 			RETRY_FUNC|RETRY_FN_EXP_BACKOFF|TIMEOUT);;
-			NET_DATAROOT|NET_MAX_PKT|NET_RHOST_RUN_DEBUG);;
+			NET_DATAROOT|NET_MAX_PKT|NET_RHOST_RUN_DEBUG|NETLOAD_CLN_NUMBER);;
 			*) tst_res TWARN "Reserved variable TST_$_tst_i used!";;
 			esac
 		done
testcases/network/virt/wireguard02.sh new file +48 -0

48 lines not on this page · raw message

Signature · 1 line
2.20.1
author Applied
#13 lore raw

PATCH 5/5 network/virt: add wireguard02: ipsec vs wireguard

Quoted 5 lines · Petr Vorel

Hi Alexey,

Quoted 1 line

Compare multi-threading performance with IPSec/vti.

Thank you for review Petr!

Applied.

#14 lore raw

PATCH 1/5 lib/tst_net: add generic tst_netload_compare()

In reply to Alexey Kodanev

Hi Alexey,

Quoted 5 lines

* Remove duplicate code for comparing time-based results in network tests (bbr, busy_poll, sctp, tcp fastopen, virt tests)

* Expand thresholds for sctp, bbr test-cases, in order to avoid false-positive failures.

I'm ok to keep more changes in single commit, but this change is affecting the result, thus maybe put into separate commit?
(easier if somebody wants to bisect).

Quoted 47 lines

* In virt_lib.sh, keep sign for VIRT_PERF_THRESHOLD.

* TWARN when the base result is too bad (threshold_hi arg is set)

---
 testcases/lib/tst_net.sh                      | 31 +++++++++++++++++++
 testcases/network/busy_poll/busy_poll01.sh    | 10 ++----
 testcases/network/busy_poll/busy_poll02.sh    |  8 +----
 testcases/network/busy_poll/busy_poll03.sh    |  8 +----
 testcases/network/dccp/dccp01.sh              | 15 ++-------
 testcases/network/sctp/sctp01.sh              |  8 +----
 testcases/network/tcp_cc/bbr01.sh             |  2 +-
 testcases/network/tcp_cc/bbr02.sh             |  2 +-
 testcases/network/tcp_cc/dctcp01.sh           |  2 +-
 testcases/network/tcp_cc/tcp_cc_lib.sh        |  8 +----
 .../network/tcp_fastopen/tcp_fastopen_run.sh  | 15 ++-------
 testcases/network/virt/virt_lib.sh            | 21 ++-----------
 12 files changed, 46 insertions(+), 84 deletions(-)
testcases/lib/tst_net.sh +19 -0
index d939a5780..b29e076c3 100644
@@ -741,6 +741,37 @@ tst_netload()
 	return $ret
 }
 
+# Compares results for netload runs.
+# tst_netload_compare TIME_BASE TIME THRESHOLD_LOW [THRESHOLD_HI]
+# TIME_BASE: time taken to run netstress load test - 100%
+# TIME: time that is compared to the base one
+# THRESHOD_LOW: lower limit for TFAIL
+# THRESHOD_HIGH: upper limit for TWARN
+tst_netload_compare()
+{
+	local base_time=$1
+	local new_time=$2
+	local threshold_low=$3
+	local threshold_hi=$4
+
+	if [ -z "$base_time" -o -z "$new_time" -o -z "$threshold_low" ]; then
+		tst_brk_ TBROK "tst_netload_compare: invalid argument(s)"
+	fi
+
+	local res=$(((base_time - new_time) * 100 / base_time))
+	local msg="performance result is ${res}%"

testcases/lib/tst_net.sh tst_netload() · line 772

Quoted 10 lines
testcases/lib/tst_net.sh +10 -0
+
+	if [ "$res" -lt "$threshold_low" ]; then
+		tst_res_ TFAIL "$msg < threshold ${threshold_low}%"
+		return
+	fi
+
+	[ "$threshold_hi" ] && [ "$res" -gt "$threshold_hi" ] && \
+		tst_res_ TWARN "$msg > threshold ${threshold_hi}%"
+
+	tst_res_ TPASS "$msg, in range [${threshold_low}:${threshold_hi:-}]%"

Do you mean ${threshold_hi:--} (to print "-" when $threshold_hi not set?) As ${threshold_hi:-} prints empty string when unset (equivalent of ${threshold_hi}).

testcases/lib/tst_net.sh tst_netload() · line 773

Quoted 1 line
testcases/lib/tst_net.sh +1 -0
+}

...

Kind regards,
Petr

#15 lore raw

PATCH 1/5 lib/tst_net: add generic tst_netload_compare()

Quoted 4 lines · Petr Vorel

Hi Alexey,

Quoted 9 lines
Quoted 5 lines

* Remove duplicate code for comparing time-based results in network tests (bbr, busy_poll, sctp, tcp fastopen, virt tests)

* Expand thresholds for sctp, bbr test-cases, in order to avoid false-positive failures.

I'm ok to keep more changes in single commit, but this change is affecting the result, thus maybe put into separate commit?
(easier if somebody wants to bisect).

Hi Petr,

Sure, will move it to the new one.

Quoted 52 lines
Quoted 52 lines

* In virt_lib.sh, keep sign for VIRT_PERF_THRESHOLD.

* TWARN when the base result is too bad (threshold_hi arg is set)

---
 testcases/lib/tst_net.sh                      | 31 +++++++++++++++++++
 testcases/network/busy_poll/busy_poll01.sh    | 10 ++----
 testcases/network/busy_poll/busy_poll02.sh    |  8 +----
 testcases/network/busy_poll/busy_poll03.sh    |  8 +----
 testcases/network/dccp/dccp01.sh              | 15 ++-------
 testcases/network/sctp/sctp01.sh              |  8 +----
 testcases/network/tcp_cc/bbr01.sh             |  2 +-
 testcases/network/tcp_cc/bbr02.sh             |  2 +-
 testcases/network/tcp_cc/dctcp01.sh           |  2 +-
 testcases/network/tcp_cc/tcp_cc_lib.sh        |  8 +----
 .../network/tcp_fastopen/tcp_fastopen_run.sh  | 15 ++-------
 testcases/network/virt/virt_lib.sh            | 21 ++-----------
 12 files changed, 46 insertions(+), 84 deletions(-)
testcases/lib/tst_net.sh +24 -0
index d939a5780..b29e076c3 100644
@@ -741,6 +741,37 @@ tst_netload()
 	return $ret
 }
 
+# Compares results for netload runs.
+# tst_netload_compare TIME_BASE TIME THRESHOLD_LOW [THRESHOLD_HI]
+# TIME_BASE: time taken to run netstress load test - 100%
+# TIME: time that is compared to the base one
+# THRESHOD_LOW: lower limit for TFAIL
+# THRESHOD_HIGH: upper limit for TWARN
+tst_netload_compare()
+{
+	local base_time=$1
+	local new_time=$2
+	local threshold_low=$3
+	local threshold_hi=$4
+
+	if [ -z "$base_time" -o -z "$new_time" -o -z "$threshold_low" ]; then
+		tst_brk_ TBROK "tst_netload_compare: invalid argument(s)"
+	fi
+
+	local res=$(((base_time - new_time) * 100 / base_time))
+	local msg="performance result is ${res}%"
+
+	if [ "$res" -lt "$threshold_low" ]; then
+		tst_res_ TFAIL "$msg < threshold ${threshold_low}%"
+		return
+	fi
Quoted 10 lines

testcases/lib/tst_net.sh tst_netload() · line 772

Quoted 5 lines
testcases/lib/tst_net.sh +5 -0
+
+	[ "$threshold_hi" ] && [ "$res" -gt "$threshold_hi" ] && \
+		tst_res_ TWARN "$msg > threshold ${threshold_hi}%"
+
+	tst_res_ TPASS "$msg, in range [${threshold_low}:${threshold_hi:-}]%"

Do you mean ${threshold_hi:--} (to print "-" when $threshold_hi not set?) As ${threshold_hi:-} prints empty string when unset (equivalent of ${threshold_hi}).

Yes, it's not really needed anymore. At some point I tried to use different placeholders, a white-space etc... but it fine as it is now, so will change to a simpler form.

Quoted 7 lines

testcases/lib/tst_net.sh tst_netload() · line 773

Quoted 1 line
testcases/lib/tst_net.sh +1 -0
+}

...

Kind regards,
Petr