Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests/net: convert gre_gso.sh to run it in unique namespace

Here is the test result after conversion.

# ./gre_gso.sh
TEST: GREv6/v4 - copy file w/ TSO [ OK ]
TEST: GREv6/v4 - copy file w/ GSO [ OK ]
TEST: GREv6/v6 - copy file w/ TSO [ OK ]
TEST: GREv6/v6 - copy file w/ GSO [ OK ]

Tests passed: 4
Tests failed: 0

Acked-by: David Ahern <dsahern@kernel.org>
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Hangbin Liu and committed by
David S. Miller
b84c2fae 6530b29f

+7 -11
+7 -11
tools/testing/selftests/net/gre_gso.sh
··· 2 2 # SPDX-License-Identifier: GPL-2.0 3 3 4 4 # This test is for checking GRE GSO. 5 - 5 + source lib.sh 6 6 ret=0 7 - # Kselftest framework requirement - SKIP code is 4. 8 - ksft_skip=4 9 7 10 8 # all tests in this script. Can be overridden with -t option 11 9 TESTS="gre_gso" ··· 11 13 VERBOSE=0 12 14 PAUSE_ON_FAIL=no 13 15 PAUSE=no 14 - IP="ip -netns ns1" 15 - NS_EXEC="ip netns exec ns1" 16 16 TMPFILE=`mktemp` 17 17 PID= 18 18 ··· 46 50 setup() 47 51 { 48 52 set -e 49 - ip netns add ns1 50 - ip netns set ns1 auto 51 - $IP link set dev lo up 53 + setup_ns ns1 54 + IP="ip -netns $ns1" 55 + NS_EXEC="ip netns exec $ns1" 52 56 53 57 ip link add veth0 type veth peer name veth1 54 58 ip link set veth0 up 55 - ip link set veth1 netns ns1 59 + ip link set veth1 netns $ns1 56 60 $IP link set veth1 name veth0 57 61 $IP link set veth0 up 58 62 ··· 66 70 [ -n "$PID" ] && kill $PID 67 71 ip link del dev gre1 &> /dev/null 68 72 ip link del dev veth0 &> /dev/null 69 - ip netns del ns1 73 + cleanup_ns $ns1 70 74 } 71 75 72 76 get_linklocal() ··· 141 145 setup 142 146 143 147 a1=$(get_linklocal veth0) 144 - a2=$(get_linklocal veth0 ns1) 148 + a2=$(get_linklocal veth0 $ns1) 145 149 146 150 gre_create_tun $a1 $a2 147 151