Message ID | 20240417164554.3651321-3-jiri@resnulli.us (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | selftests: virtio_net: introduce initial testing infrastructure | expand |
On 2024-04-17 18:45 +0200, Jiri Pirko wrote: > From: Jiri Pirko <jiri@nvidia.com> > > These two check can be done at he very beginning of the script. > As the follow up patch needs to add early code that needs to be executed > after the checks, move them. > > Signed-off-by: Jiri Pirko <jiri@nvidia.com> > --- > tools/testing/selftests/net/forwarding/lib.sh | 15 ++++++++++----- > 1 file changed, 10 insertions(+), 5 deletions(-) > > diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh > index 7913c6ee418d..2e7695b94b6b 100644 > --- a/tools/testing/selftests/net/forwarding/lib.sh > +++ b/tools/testing/selftests/net/forwarding/lib.sh > @@ -84,6 +84,16 @@ declare -A NETIFS=( > # e.g. a low-power board. > : "${KSFT_MACHINE_SLOW:=no}" > > +if [[ "$(id -u)" -ne 0 ]]; then > + echo "SKIP: need root privileges" > + exit $ksft_skip > +fi > + > +if [[ ! -v NUM_NETIFS ]]; then > + echo "SKIP: importer does not define \"NUM_NETIFS\"" > + exit $ksft_skip > +fi > + I noticed that this part conflicts with the recently merged commit 2291752fae3d ("selftests: forwarding: lib.sh: Validate NETIFS"). Can you please verify that the conflict was fixed correctly? The above check is now duplicated in the file.
Wed, Apr 17, 2024 at 08:58:27PM CEST, benjamin.poirier@gmail.com wrote: >On 2024-04-17 18:45 +0200, Jiri Pirko wrote: >> From: Jiri Pirko <jiri@nvidia.com> >> >> These two check can be done at he very beginning of the script. >> As the follow up patch needs to add early code that needs to be executed >> after the checks, move them. >> >> Signed-off-by: Jiri Pirko <jiri@nvidia.com> >> --- >> tools/testing/selftests/net/forwarding/lib.sh | 15 ++++++++++----- >> 1 file changed, 10 insertions(+), 5 deletions(-) >> >> diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh >> index 7913c6ee418d..2e7695b94b6b 100644 >> --- a/tools/testing/selftests/net/forwarding/lib.sh >> +++ b/tools/testing/selftests/net/forwarding/lib.sh >> @@ -84,6 +84,16 @@ declare -A NETIFS=( >> # e.g. a low-power board. >> : "${KSFT_MACHINE_SLOW:=no}" >> >> +if [[ "$(id -u)" -ne 0 ]]; then >> + echo "SKIP: need root privileges" >> + exit $ksft_skip >> +fi >> + >> +if [[ ! -v NUM_NETIFS ]]; then >> + echo "SKIP: importer does not define \"NUM_NETIFS\"" >> + exit $ksft_skip >> +fi >> + > >I noticed that this part conflicts with the recently merged commit >2291752fae3d ("selftests: forwarding: lib.sh: Validate NETIFS"). Can you >please verify that the conflict was fixed correctly? The above check is >now duplicated in the file. Right, will remove the duplicate. Thanks!
diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh index 7913c6ee418d..2e7695b94b6b 100644 --- a/tools/testing/selftests/net/forwarding/lib.sh +++ b/tools/testing/selftests/net/forwarding/lib.sh @@ -84,6 +84,16 @@ declare -A NETIFS=( # e.g. a low-power board. : "${KSFT_MACHINE_SLOW:=no}" +if [[ "$(id -u)" -ne 0 ]]; then + echo "SKIP: need root privileges" + exit $ksft_skip +fi + +if [[ ! -v NUM_NETIFS ]]; then + echo "SKIP: importer does not define \"NUM_NETIFS\"" + exit $ksft_skip +fi + net_forwarding_dir=$(dirname "$(readlink -e "${BASH_SOURCE[0]}")") if [[ -f $net_forwarding_dir/forwarding.config ]]; then @@ -241,11 +251,6 @@ check_port_mab_support() fi } -if [[ "$(id -u)" -ne 0 ]]; then - echo "SKIP: need root privileges" - exit $ksft_skip -fi - if [[ "$CHECK_TC" = "yes" ]]; then check_tc_version fi