Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/net Move get_lladdr to net_common.sh
details: https://anonhg.NetBSD.org/src/rev/184d842a878d
branches: trunk
changeset: 349111:184d842a878d
user: ozaki-r <ozaki-r%NetBSD.org@localhost>
date: Thu Nov 24 09:06:09 2016 +0000
description:
Move get_lladdr to net_common.sh
diffstat:
tests/net/icmp/Makefile | 7 +++++--
tests/net/icmp/t_icmp6_redirect.sh | 19 ++++---------------
tests/net/net/t_ipv6address.sh | 33 +++++++++++----------------------
tests/net/net/t_ping6_opts.sh | 16 ++++------------
tests/net/net_common.sh | 13 ++++++++++++-
5 files changed, 36 insertions(+), 52 deletions(-)
diffs (204 lines):
diff -r eb5c75006496 -r 184d842a878d tests/net/icmp/Makefile
--- a/tests/net/icmp/Makefile Thu Nov 24 09:05:16 2016 +0000
+++ b/tests/net/icmp/Makefile Thu Nov 24 09:06:09 2016 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.8 2016/08/08 14:49:35 pgoyette Exp $
+# $NetBSD: Makefile,v 1.9 2016/11/24 09:06:09 ozaki-r Exp $
#
.include <bsd.own.mk>
@@ -8,7 +8,10 @@
TESTS_C= t_forward
TESTS_C+= t_ping
-TESTS_SH= t_ping2 t_icmp_redirect t_icmp6_redirect
+.for name in ping2 icmp_redirect icmp6_redirect
+TESTS_SH+= t_${name}
+TESTS_SH_SRC_t_${name}= ../net_common.sh t_${name}.sh
+.endfor
LDADD+= -lrumpnet_shmif -lrumpnet_netinet -lrumpnet_net -lrumpnet
LDADD+= -lrump -lrumpuser -lrump -lpthread -lrumpdev -lrumpvfs
diff -r eb5c75006496 -r 184d842a878d tests/net/icmp/t_icmp6_redirect.sh
--- a/tests/net/icmp/t_icmp6_redirect.sh Thu Nov 24 09:05:16 2016 +0000
+++ b/tests/net/icmp/t_icmp6_redirect.sh Thu Nov 24 09:06:09 2016 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_icmp6_redirect.sh,v 1.5 2016/11/07 05:25:36 ozaki-r Exp $
+# $NetBSD: t_icmp6_redirect.sh,v 1.6 2016/11/24 09:06:09 ozaki-r Exp $
#
# Copyright (c) 2015 Internet Initiative Japan Inc.
# All rights reserved.
@@ -46,17 +46,6 @@
DEBUG=${DEBUG:-true}
-get_lladdr()
-{
-
- export RUMP_SERVER=${1}
- rump.ifconfig ${2} inet6 |
- awk "/fe80/ {sub(/%$2/, \"\"); sub(/\\/[0-9]*/, \"\"); print \$2;}"
- unset RUMP_SERVER
-
- return 0
-}
-
atf_test_case icmp6_redirect_basic cleanup
icmp6_redirect_basic_head()
@@ -96,8 +85,8 @@
net.inet6.ip6.forwarding=1
unset RUMP_SERVER
- gw1_lladdr0=`get_lladdr ${SOCK_GW1} shmif0`
- gw1_lladdr1=`get_lladdr ${SOCK_GW1} shmif1`
+ gw1_lladdr0=`get_linklocal_addr ${SOCK_GW1} shmif0`
+ gw1_lladdr1=`get_linklocal_addr ${SOCK_GW1} shmif1`
# Setup a peer behind gateway #1
export RUMP_SERVER=${SOCK_PEER}
@@ -122,7 +111,7 @@
net.inet6.ip6.forwarding=1
unset RUMP_SERVER
- gw2_lladdr0=`get_lladdr ${SOCK_GW2} shmif0`
+ gw2_lladdr0=`get_linklocal_addr ${SOCK_GW2} shmif0`
export RUMP_SERVER=${SOCK_LOCAL}
atf_check -s exit:0 rump.ifconfig shmif0 create
diff -r eb5c75006496 -r 184d842a878d tests/net/net/t_ipv6address.sh
--- a/tests/net/net/t_ipv6address.sh Thu Nov 24 09:05:16 2016 +0000
+++ b/tests/net/net/t_ipv6address.sh Thu Nov 24 09:06:09 2016 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_ipv6address.sh,v 1.10 2016/11/07 05:25:37 ozaki-r Exp $
+# $NetBSD: t_ipv6address.sh,v 1.11 2016/11/24 09:06:09 ozaki-r Exp $
#
# Copyright (c) 2015 Internet Initiative Japan Inc.
# All rights reserved.
@@ -119,10 +119,10 @@
{
local tmp_rump_server=$RUMP_SERVER
- local src_if0_lladdr=`get_lladdr ${SOCKSRC} shmif0`
- local dst_if0_lladdr=`get_lladdr ${SOCKDST} shmif0`
- local fwd_if0_lladdr=`get_lladdr ${SOCKFWD} shmif0`
- local fwd_if1_lladdr=`get_lladdr ${SOCKFWD} shmif1`
+ local src_if0_lladdr=`get_linklocal_addr ${SOCKSRC} shmif0`
+ local dst_if0_lladdr=`get_linklocal_addr ${SOCKDST} shmif0`
+ local fwd_if0_lladdr=`get_linklocal_addr ${SOCKFWD} shmif0`
+ local fwd_if1_lladdr=`get_linklocal_addr ${SOCKFWD} shmif1`
export RUMP_SERVER=${SOCKSRC}
atf_check -s ignore -o ignore -e ignore \
@@ -198,17 +198,6 @@
export RUMP_SERVER=$tmp_rump_server
}
-
-get_lladdr()
-{
- export RUMP_SERVER=${1}
- rump.ifconfig ${2} inet6 | grep "fe80" \
- | awk '{print $2}' | sed -e "s/%$2//g" -e 's;/[0-9]*$;;'
- unset RUMP_SERVER
-
- return 0
-}
-
cleanup_rump_servers()
{
@@ -253,11 +242,11 @@
{
setup
- local src_if0_lladdr=`get_lladdr ${SOCKSRC} shmif0`
- local src_if1_lladdr=`get_lladdr ${SOCKSRC} shmif1`
- local dst_if0_lladdr=`get_lladdr ${SOCKDST} shmif0`
- local fwd_if0_lladdr=`get_lladdr ${SOCKFWD} shmif0`
- local fwd_if1_lladdr=`get_lladdr ${SOCKFWD} shmif1`
+ local src_if0_lladdr=`get_linklocal_addr ${SOCKSRC} shmif0`
+ local src_if1_lladdr=`get_linklocal_addr ${SOCKSRC} shmif1`
+ local dst_if0_lladdr=`get_linklocal_addr ${SOCKDST} shmif0`
+ local fwd_if0_lladdr=`get_linklocal_addr ${SOCKFWD} shmif0`
+ local fwd_if1_lladdr=`get_linklocal_addr ${SOCKFWD} shmif1`
export RUMP_SERVER=${SOCKSRC}
$DEBUG && rump.ifconfig
@@ -362,7 +351,7 @@
setup
- src_if0_lladdr=`get_lladdr ${SOCKSRC} shmif0`
+ src_if0_lladdr=`get_linklocal_addr ${SOCKSRC} shmif0`
export RUMP_SERVER=${SOCKSRC}
diff -r eb5c75006496 -r 184d842a878d tests/net/net/t_ping6_opts.sh
--- a/tests/net/net/t_ping6_opts.sh Thu Nov 24 09:05:16 2016 +0000
+++ b/tests/net/net/t_ping6_opts.sh Thu Nov 24 09:06:09 2016 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_ping6_opts.sh,v 1.5 2016/11/24 08:52:20 ozaki-r Exp $
+# $NetBSD: t_ping6_opts.sh,v 1.6 2016/11/24 09:06:09 ozaki-r Exp $
#
# Copyright (c) 2016 Internet Initiative Japan Inc.
# All rights reserved.
@@ -109,14 +109,6 @@
setup_forwarder
}
-get_lladdr()
-{
-
- env RUMP_SERVER=${1} \
- rump.ifconfig ${2} inet6 | grep "fe80" \
- | awk '{print $2}' | sed -e "s/%$2//g" -e 's;/[0-9]*$;;'
-}
-
get_macaddr()
{
@@ -242,8 +234,8 @@
setup6
setup_forwarding6
- shmif0_lladdr=$(get_lladdr ${SOCKSRC} shmif0)
- gw_lladdr=$(get_lladdr ${SOCKFWD} shmif0)
+ shmif0_lladdr=$(get_linklocal_addr ${SOCKSRC} shmif0)
+ gw_lladdr=$(get_linklocal_addr ${SOCKFWD} shmif0)
export RUMP_SERVER=$SOCKSRC
atf_check -s exit:0 -o ignore rump.ping6 -n -c 1 -X $TIMEOUT $gw_lladdr
@@ -253,7 +245,7 @@
atf_check -s exit:0 rump.ifconfig shmif1 linkstr $BUS_SRCGW
atf_check -s exit:0 rump.ifconfig shmif1 up
atf_check -s exit:0 rump.ifconfig -w 10
- shmif1_lladdr=$(get_lladdr ${SOCKSRC} shmif1)
+ shmif1_lladdr=$(get_linklocal_addr ${SOCKSRC} shmif1)
atf_check -s exit:0 -o ignore rump.ping6 -n -c 1 -X $TIMEOUT $gw_lladdr
check_echo_request_pkt $shmif0_lladdr $gw_lladdr
diff -r eb5c75006496 -r 184d842a878d tests/net/net_common.sh
--- a/tests/net/net_common.sh Thu Nov 24 09:05:16 2016 +0000
+++ b/tests/net/net_common.sh Thu Nov 24 09:06:09 2016 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: net_common.sh,v 1.3 2016/11/24 09:05:16 ozaki-r Exp $
+# $NetBSD: net_common.sh,v 1.4 2016/11/24 09:06:09 ozaki-r Exp $
#
# Copyright (c) 2016 Internet Initiative Japan Inc.
# All rights reserved.
@@ -85,3 +85,14 @@
atf_check -s exit:0 -e ignore -o not-match:"^$target" \
rump.netstat -rn
}
+
+get_linklocal_addr()
+{
+
+ export RUMP_SERVER=${1}
+ rump.ifconfig ${2} inet6 |
+ awk "/fe80/ {sub(/%$2/, \"\"); sub(/\\/[0-9]*/, \"\"); print \$2;}"
+ unset RUMP_SERVER
+
+ return 0
+}
Home |
Main Index |
Thread Index |
Old Index