lib/tst_net.sh: don't treat TWARN/TCONF as failure in tst_netload()
PATCH 1/2 lib/tst_net.sh: don't treat TWARN/TCONF as failure in tst_netload()
Report TWARN and don't stop the test in that case.
--- testcases/lib/tst_net.sh | 37 ++++++++++++++++++++++++------------- 1 files changed, 24 insertions(+), 13 deletions(-)
testcases/lib/tst_net.sh +24 -13
@@ -573,7 +573,7 @@ tst_netload() [ "$setup_srchost" = 1 ] && s_opts="${s_opts}-S $hostopt " local expect_ret=0 - [ "$expect_res" != "pass" ] && expect_ret=1 + [ "$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"
@@ -590,26 +590,37 @@ tst_netload() c_opts="${cs_opts}${c_opts}-a $c_num -r $c_requests -d $rfile -g $port" tst_res_ TINFO "run client 'netstress -l $c_opts'" - netstress -l $c_opts > tst_netload.log 2>&1 || ret=1 + netstress -l $c_opts > tst_netload.log 2>&1 || ret=$? tst_rhost_run -c "pkill -9 netstress\$" - if [ "$expect_ret" -ne "$ret" ]; then + if [ "$expect_ret" -ne 0 ]; then + if [ $((ret & expect_ret)) -ne 0 ]; then + tst_res_ TPASS "netstress failed as expected" + else + tst_res_ TFAIL "unexpected pass, ret is $ret" + fi + return $ret + fi + + if [ "$ret" -ne 0 ]; then tst_dump_rhost_cmd cat tst_netload.log - tst_brk_ TFAIL "expected '$expect_res' but ret: '$ret'" + [ $((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" fi - if [ "$ret" -eq 0 ]; then - if [ ! -f $rfile ]; then - tst_dump_rhost_cmd - cat tst_netload.log - tst_brk_ TFAIL "can't read $rfile" - fi - tst_res_ TPASS "netstress passed, time spent '$(cat $rfile)' ms" - else - tst_res_ TPASS "netstress failed as expected" + if [ ! -f $rfile ]; then + tst_dump_rhost_cmd + cat tst_netload.log + tst_brk_ TFAIL "can't read $rfile" fi + tst_res_ TPASS "netstress passed, time spent '$(cat $rfile)' ms" + return $ret }
Signature · 1 line
1.7.1
PATCH 2/2 lib/tst_net.sh: use SO_BINDTODEVICE in tst_netload()
Since we have the information about the device, enable the usage of the option, when starting netstress.
It can be disabled with TST_NETLOAD_BINDTODEVICE=0.
--- testcases/lib/tst_net.sh | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-)
testcases/lib/tst_net.sh +9 -1
@@ -537,6 +537,7 @@ tst_netload() # number of server replies after which TCP connection is closed local s_replies="${TST_NETLOAD_MAX_SRV_REPLIES:-500000}" local s_opts= + local bind_to_device=1 if [ ! "$TST_NEEDS_TMPDIR" = 1 ]; then tst_brk_ TBROK "Using tst_netload requires setting TST_NEEDS_TMPDIR=1"
@@ -564,7 +565,8 @@ tst_netload() f) cs_opts="${cs_opts}-f " ;; F) cs_opts="${cs_opts}-F " ;; e) expect_res="$OPTARG" ;; - D) cs_opts="${cs_opts}-D $OPTARG " ;; + D) cs_opts="${cs_opts}-D $OPTARG " + bind_to_device=0 ;; *) tst_brk_ TBROK "tst_netload: unknown option: $OPTARG" ;; esac done
@@ -572,6 +574,11 @@ tst_netload() [ "$setup_srchost" = 1 ] && s_opts="${s_opts}-S $hostopt " + if [ "$bind_to_device" = 1 -a "$TST_NETLOAD_BINDTODEVICE" = 1 ]; then + c_opts="${c_opts}-D $(tst_iface) " + s_opts="${s_opts}-D $(tst_iface rhost) " + fi + local expect_ret=0 [ "$expect_res" != "pass" ] && expect_ret=3
@@ -788,6 +795,7 @@ fi 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 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
1.7.1
PATCH 2/2 lib/tst_net.sh: use SO_BINDTODEVICE in tst_netload()
Hi Alexey,
Quoted 4 lines
Since we have the information about the device, enable the usage of the option, when starting netstress.
It can be disabled with TST_NETLOAD_BINDTODEVICE=0.
Kind regards,
Petr
PATCH 2/2 lib/tst_net.sh: use SO_BINDTODEVICE in tst_netload()
Hi Alexey,
Quoted 4 lines
Quoted 4 lines
Since we have the information about the device, enable the usage of the option, when starting netstress.
It can be disabled with TST_NETLOAD_BINDTODEVICE=0.
Having any reason not to push this patch?
Kind regards,
Petr
PATCH 2/2 lib/tst_net.sh: use SO_BINDTODEVICE in tst_netload()
Hi Petr,
Quoted 9 lines · Petr Vorel
Hi Alexey,
Quoted 4 lines
Quoted 4 lines
Since we have the information about the device, enable the usage of the option, when starting netstress.
It can be disabled with TST_NETLOAD_BINDTODEVICE=0.
Having any reason not to push this patch?
Yes, at least this patch breaks mpls and ipsec/vti tests.
For mpls the fix can be:
testcases/network/mpls/mpls_lib.sh +1 -1
@@ -8,7 +8,7 @@ TST_NEEDS_ROOT=1 TST_NEEDS_DRIVERS="mpls_router mpls_iptunnel mpls_gso" TST_NEEDS_CMDS="sysctl modprobe" TST_TEST_DATA="icmp tcp udp" - +TST_NETLOAD_BINDTODEVICE=0 . tst_net.sh
For ipsec/vti we have to set the vti device:
testcases/network/stress/sctp/sctp_ipsec_vti.sh +1 -1
@@ -17,7 +17,7 @@ do_test() [ "$2" != "$rand_opt" ] && opts="-A $rand_opt" tst_netload -H $ip_rmt_tun -T sctp $opts -r $IPSEC_REQUESTS \ - -S $ip_loc_tun + -S $ip_loc_tun -D $tst_vti }
Moreover, since the "-D" is rather optional, may be it would be good to control it with TST_NELOAD_BINDTODEVICE too?
testcases/lib/tst_net.sh +1 -1
@@ -565,7 +565,7 @@ tst_netload() f) cs_opts="${cs_opts}-f " ;; F) cs_opts="${cs_opts}-F " ;; e) expect_res="$OPTARG" ;; - D) cs_opts="${cs_opts}-D $OPTARG " + D) [ "$TST_NETLOAD_BINDTODEVICE" = 1 ] && cs_opts="${cs_opts}-D $OPTARG " bind_to_device=0 ;; *) tst_brk_ TBROK "tst_netload: unknown option: $OPTARG" ;; esac
Quoted 3 lines
Kind regards,
Petr
PATCH 2/2 lib/tst_net.sh: use SO_BINDTODEVICE in tst_netload()
Hi Alexey,
Quoted 9 lines
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
Since we have the information about the device, enable the usage of the option, when starting netstress.
It can be disabled with TST_NETLOAD_BINDTODEVICE=0.
Having any reason not to push this patch?
Yes, at least this patch breaks mpls and ipsec/vti tests.
Right, all but mpls01 are broken, haven't noticed this. Any idea why?
Kind regards,
Petr
PATCH 2/2 lib/tst_net.sh: use SO_BINDTODEVICE in tst_netload()
Quoted 5 lines · Petr Vorel
Hi Alexey,
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Since we have the information about the device, enable the usage of the option, when starting netstress.
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
Quoted 1 line
It can be disabled with TST_NETLOAD_BINDTODEVICE=0.
Having any reason not to push this patch?
Yes, at least this patch breaks mpls and ipsec/vti tests.
Right, all but mpls01 are broken, haven't noticed this. Any idea why?
mpls01 just creates/deletes routes, checks options - it's not using tst_netload().
Quoted 4 lines
Kind regards,
Petr
PATCH 1/2 lib/tst_net.sh: don't treat TWARN/TCONF as failure in tst_netload()
In reply to Alexey KodanevHi Alexey,
Quoted 1 line
Report TWARN and don't stop the test in that case.
With one minor comment below.
...
Quoted 15 lines
testcases/lib/tst_net.sh +1
-1@@ -573,7 +573,7 @@ tst_netload() [ "$setup_srchost" = 1 ] && s_opts="${s_opts}-S $hostopt " local expect_ret=0 - [ "$expect_res" != "pass" ] && expect_ret=1 + [ "$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"@@ -590,26 +590,37 @@ tst_netload() c_opts="${cs_opts}${c_opts}-a $c_num -r $c_requests -d $rfile -g $port" tst_res_ TINFO "run client 'netstress -l $c_opts'"
testcases/lib/tst_net.sh tst_netload() · line 600
Quoted 10 lines
testcases/lib/tst_net.sh +6
-2- netstress -l $c_opts > tst_netload.log 2>&1 || ret=1 + netstress -l $c_opts > tst_netload.log 2>&1 || ret=$? tst_rhost_run -c "pkill -9 netstress\$" - if [ "$expect_ret" -ne "$ret" ]; then + if [ "$expect_ret" -ne 0 ]; then + if [ $((ret & expect_ret)) -ne 0 ]; then + tst_res_ TPASS "netstress failed as expected" + else + tst_res_ TFAIL "unexpected pass, ret is $ret"
I like the previous one, which mentioned what was expected. maybe something like:
tst_res_ TFAIL "unexpected pass, expected '$expect_ret', but ret: $ret"
Or even mention $expect_res, which is word (not number)?
Kind regards,
Petr
PATCH 1/2 lib/tst_net.sh: don't treat TWARN/TCONF as failure in tst_netload()
On 26.02.2019 21:26, Petr Vorel wrote:
...
Quoted 11 lines
testcases/lib/tst_net.sh tst_netload() · line 600
Quoted 6 lines
testcases/lib/tst_net.sh +5
-1- if [ "$expect_ret" -ne "$ret" ]; then + if [ "$expect_ret" -ne 0 ]; then + if [ $((ret & expect_ret)) -ne 0 ]; then + tst_res_ TPASS "netstress failed as expected" + else + tst_res_ TFAIL "unexpected pass, ret is $ret"I like the previous one, which mentioned what was expected. maybe something like:
tst_res_TFAIL "unexpected pass, expected '$expect_ret', but ret: $ret"Or even mention $expect_res, which is word (not number)?
Applied with $expect_res. Thanks for review Petr!