containers/netns: update netns shell test to new API
PATCH 1/1 containers/netns: update netns shell test to new API
--- .../kernel/containers/netns/netns_breakns.sh | 60 ++++----- .../kernel/containers/netns/netns_comm.sh | 95 ++++++-------- .../kernel/containers/netns/netns_helper.sh | 69 +++++----- .../kernel/containers/netns/netns_sysfs.sh | 118 +++++++----------- 4 files changed, 140 insertions(+), 202 deletions(-)
testcases/kernel/containers/netns/netns_breakns.sh +22 -38
@@ -1,21 +1,8 @@ #!/bin/sh -#============================================================================== +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) K?ry Maincent <[email protected]> 2020 # Copyright (c) 2015 Red Hat, Inc. # -# This program is free software: you can redistribute it and/or modify -# it under the terms of version 2 the GNU General Public License as -# published by the Free Software Foundation. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. -# -# Written by Matus Marhefka <[email protected]> -# #============================================================================== # # SYNOPSIS:
@@ -42,32 +29,29 @@ # 2. using ioctl (ifconfig command). #============================================================================== -TCID="netns_breakns_$1_$2_$3" -TST_TOTAL=2 +TST_POS_ARGS=3 +TST_SETUP=do_setup +TST_TESTFUNC=do_test . netns_helper.sh -# SETUP -netns_setup $1 $2 $3 "192.168.0.2" "192.168.0.3" "fd00::2" "fd00::3" -tst_resm TINFO "NS interaction: $1 | devices setup: $3" - - -# TEST CASE #1 -$NS_EXEC $NS_HANDLE0 $NS_TYPE ip address add $IP1/$NETMASK dev veth1 2>/dev/null -if [ $? -ne 0 ]; then - tst_resm TPASS "controlling device over netlink" -else - tst_resm TFAIL "controlling device over netlink" -fi +PROG=$1 +IP_VER=$2 +COM_TYPE=$3 +do_setup() +{ + netns_setup $PROG $IP_VER $COM_TYPE "192.168.0.2" "192.168.0.3" "fd00::2" "fd00::3" + tst_res TINFO "NS interaction: $PROG | devices setup: $COM_TYPE" +} -# TEST CASE #2 -tst_require_cmds ifconfig -$NS_EXEC $NS_HANDLE0 $NS_TYPE ifconfig veth1 $IFCONF_IN6_ARG $IP1/$NETMASK 2>/dev/null -if [ $? -ne 0 ]; then - tst_resm TPASS "controlling device over ioctl" -else - tst_resm TFAIL "controlling device over ioctl" -fi +do_test() +{ + # TEST CASE #1 + EXPECT_FAIL $NS_EXEC $NS_HANDLE0 $NS_TYPE ip address add $IP1/$NETMASK dev veth1 + # TEST CASE #2 + tst_require_cmds ifconfig + EXPECT_FAIL $NS_EXEC $NS_HANDLE0 $NS_TYPE ifconfig veth1 $IFCONF_IN6_ARG $IP1/$NETMASK +} -tst_exit +tst_run
testcases/kernel/containers/netns/netns_comm.sh +37 -58
112 lines not on this page · raw message
testcases/kernel/containers/netns/netns_helper.sh +34 -35
187 lines not on this page · raw message
testcases/kernel/containers/netns/netns_sysfs.sh +47 -71
140 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH 1/1 containers/netns: update netns shell test to new API
Hi Kory,
Quoted 7 lines
Signed-off-by Kory Maincent <[email protected]>--- .../kernel/containers/netns/netns_breakns.sh | 60 ++++----- .../kernel/containers/netns/netns_comm.sh | 95 ++++++-------- .../kernel/containers/netns/netns_helper.sh | 69 +++++----- .../kernel/containers/netns/netns_sysfs.sh | 118 +++++++----------- 4 files changed, 140 insertions(+), 202 deletions(-)
Generally looks good to me.
Before merge I'll drop bogus '# TEST CASE #N' and add few TINFO messages, e.g.:tst_res TINFO "controlling device over netlink"
Thanks!
Kind regards,
Petr
PATCH 1/1 containers/netns: update netns shell test to new API
Hi Kory,
Quoted 2 lines
Before merge I'll drop bogus '# TEST CASE #N' and add few TINFO messages, e.g.:
tst_resTINFO "controlling device over netlink"
Thanks for your work, merged.
In the end without tst_res TINFO messages and added one cleanup commit.
I'm going to send a patch to ML which fixes tst_check_iproute check for recent iproute2, which uses since v5.8.0 (actually since v5.7.0-77-gb687d1067169) kernel version.
Kind regards,
Petr