| Message ID | 20210913123935.10761-1-aleksei.kodanev@bell-sw.com |
|---|---|
| State | Accepted |
| Headers | show |
| Series | [1/2] lib/tst_net.sh: ignore errors on rhost with -i option in tst_net_run() | expand |
Hi Alexey,
good catch!
Reviewed-by: Petr Vorel <pvorel@suse.cz>
BTW are you going to send patch / report it to busybox? (I haven't find anything on ML)
Kind regards,
Petr
Hi Petr, On 14.09.2021 08:46, Petr Vorel wrote: > Hi Alexey, > > good catch! > Reviewed-by: Petr Vorel <pvorel@suse.cz> > > BTW are you going to send patch / report it to busybox? (I haven't find anything on ML) Looking at busybox history, seems expected from the beginning there: commit 64309f8669f08f2c3c16a3b5bf82d9cae84ec388 Author: Denis Vlasenko <vda.linux@googlemail.com> Date: Thu Nov 29 06:40:28 2007 +0000 sysctl: add -e: supress warnings about invalid key (Jeremy Kerr <jk@ozlabs.org>) -e option unsets FLAG_SHOW_KEY_ERRORS. busybox/sysctl: "-e Don't warn about unknown keys" (Though, -q option can be used for that, which was added later, in 2012) vs procps/sysctl: "-e, --ignore ignore unknown variables errors"
Hi Alexey, > Hi Petr, > On 14.09.2021 08:46, Petr Vorel wrote: > > Hi Alexey, > > good catch! > > Reviewed-by: Petr Vorel <pvorel@suse.cz> > > BTW are you going to send patch / report it to busybox? (I haven't find anything on ML) > Looking at busybox history, seems expected from the beginning there: > commit 64309f8669f08f2c3c16a3b5bf82d9cae84ec388 > Author: Denis Vlasenko <vda.linux@googlemail.com> > Date: Thu Nov 29 06:40:28 2007 +0000 > sysctl: add -e: supress warnings about invalid key (Jeremy Kerr <jk@ozlabs.org>) > -e option unsets FLAG_SHOW_KEY_ERRORS. > busybox/sysctl: "-e Don't warn about unknown keys" > (Though, -q option can be used for that, which was added later, in 2012) > vs > procps/sysctl: "-e, --ignore ignore unknown variables errors" Hm, IMHO it'd be good change to -e have 0 exit status. Because that's the behavior in procps-ng (tested on 3.3.17). If you do it, please let me know and/or Cc me in your patch. Otherwise I'll do it. Kind regards, Petr
diff --git a/testcases/lib/tst_net.sh b/testcases/lib/tst_net.sh index 958d71e3d..7f2a1bab3 100644 --- a/testcases/lib/tst_net.sh +++ b/testcases/lib/tst_net.sh @@ -212,6 +212,7 @@ tst_rhost_run() # -l LPARAM: parameter passed to CMD in lhost # -r RPARAM: parameter passed to CMD in rhost # -q: quiet mode (suppress failure warnings) +# -i: ignore errors on rhost # CMD: command to run (this must be binary, not shell builtin/function due # tst_rhost_run() limitation) # RETURN: 0 on success, 1 on missing CMD or exit code on lhost or rhost @@ -227,12 +228,13 @@ tst_net_run() local quiet local OPTIND - while getopts l:qr:s opt; do + while getopts l:qr:si opt; do case "$opt" in l) lparams="$OPTARG" ;; q) quiet=1 ;; r) rparams="$OPTARG" ;; s) lsafe="ROD"; rsafe="-s" ;; + i) rsafe="" ;; *) tst_brk_ TBROK "tst_net_run: unknown option: $OPTARG" ;; esac done @@ -916,9 +918,9 @@ tst_set_sysctl() [ "$3" = "safe" ] && safe="-s" local rparam= - [ "$TST_USE_NETNS" = "yes" ] && rparam="-r '-e'" + [ "$TST_USE_NETNS" = "yes" ] && rparam="-i -r '-e'" - tst_net_run $safe $rparam "sysctl" "-q -w $name=$value" + tst_net_run $safe -q $rparam "sysctl" "-q -w $name=$value" } tst_cleanup_rhost()
Unfortanetly busysbox/sysctl with -e option only suppresses the warning about unknown keys and still returns exit code 1: sysctl -h ... -e don't warn about unknown keys As a result busy_poll01 fails on this error: busy_poll01.sh busy_poll01 1 TINFO: initialize 'lhost' 'ltp_ns_veth2' interface ... busy_poll01 1 TINFO: set low latency busy poll to 50 busy_poll01 1 TBROK: 'sysctl -q -w '-e' net.core.busy_read=50' failed on '': '' So let's add a new option (-i) in tst_net_run() to ignore the error when running the command on "rhost". Signed-off-by: Alexey Kodanev <aleksei.kodanev@bell-sw.com> --- testcases/lib/tst_net.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)