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_macaddr to net_common.sh
details: https://anonhg.NetBSD.org/src/rev/8df2691c1731
branches: trunk
changeset: 349112:8df2691c1731
user: ozaki-r <ozaki-r%NetBSD.org@localhost>
date: Thu Nov 24 09:07:09 2016 +0000
description:
Move get_macaddr to net_common.sh
diffstat:
tests/net/arp/t_arp.sh | 7 +++----
tests/net/if_bridge/Makefile | 7 +++++--
tests/net/if_bridge/t_bridge.sh | 16 +++++-----------
tests/net/net/t_ping6_opts.sh | 9 +--------
tests/net/net_common.sh | 9 ++++++++-
5 files changed, 22 insertions(+), 26 deletions(-)
diffs (127 lines):
diff -r 184d842a878d -r 8df2691c1731 tests/net/arp/t_arp.sh
--- a/tests/net/arp/t_arp.sh Thu Nov 24 09:06:09 2016 +0000
+++ b/tests/net/arp/t_arp.sh Thu Nov 24 09:07:09 2016 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_arp.sh,v 1.20 2016/11/24 09:03:53 ozaki-r Exp $
+# $NetBSD: t_arp.sh,v 1.21 2016/11/24 09:07:09 ozaki-r Exp $
#
# Copyright (c) 2015 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -376,7 +376,7 @@
export RUMP_SERVER=$SOCKDST
atf_check -s exit:0 -o ignore rump.sysctl -w net.inet.ip.forwarding=1
- macaddr_dst=$(rump.ifconfig shmif0 |awk '/address/ {print $2;}')
+ macaddr_dst=$(get_macaddr $SOCKDST shmif0)
if [ "$type" = "pub" ]; then
opts="pub"
@@ -523,8 +523,7 @@
setup_dst_server
setup_src_server $arp_keep
- export RUMP_SERVER=$SOCKSRC
- macaddr_src=$(rump.ifconfig shmif0 |awk '/address/ {print $2;}')
+ macaddr_src=$(get_macaddr $SOCKSRC shmif0)
# Set a (valid) static ARP entry for the src server
export RUMP_SERVER=$SOCKDST
diff -r 184d842a878d -r 8df2691c1731 tests/net/if_bridge/Makefile
--- a/tests/net/if_bridge/Makefile Thu Nov 24 09:06:09 2016 +0000
+++ b/tests/net/if_bridge/Makefile Thu Nov 24 09:07:09 2016 +0000
@@ -1,10 +1,13 @@
-# $NetBSD: Makefile,v 1.1 2014/09/18 15:13:27 ozaki-r Exp $
+# $NetBSD: Makefile,v 1.2 2016/11/24 09:07:09 ozaki-r Exp $
#
.include <bsd.own.mk>
TESTSDIR= ${TESTSBASE}/net/if_bridge
-TESTS_SH= t_bridge
+.for name in bridge
+TESTS_SH+= t_${name}
+TESTS_SH_SRC_t_${name}= ../net_common.sh t_${name}.sh
+.endfor
.include <bsd.test.mk>
diff -r 184d842a878d -r 8df2691c1731 tests/net/if_bridge/t_bridge.sh
--- a/tests/net/if_bridge/t_bridge.sh Thu Nov 24 09:06:09 2016 +0000
+++ b/tests/net/if_bridge/t_bridge.sh Thu Nov 24 09:07:09 2016 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_bridge.sh,v 1.13 2016/08/10 22:37:07 kre Exp $
+# $NetBSD: t_bridge.sh,v 1.14 2016/11/24 09:07:09 ozaki-r Exp $
#
# Copyright (c) 2014 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -360,11 +360,8 @@
addr1= addr3= n=
# Get MAC addresses of the endpoints.
- export RUMP_SERVER=$SOCK1
- addr1=$(rump.ifconfig shmif0 |awk '/address:/ { print $2;}')
- export RUMP_SERVER=$SOCK3
- addr3=$(rump.ifconfig shmif0 |awk '/address:/ { print $2;}')
- unset RUMP_SERVER
+ addr1=$(get_macaddr $SOCK1 shmif0)
+ addr3=$(get_macaddr $SOCK3 shmif0)
# Refill the MAC addresses of the endpoints.
export RUMP_SERVER=$SOCK1
@@ -448,11 +445,8 @@
setup_bridge
# Get MAC addresses of the endpoints.
- export RUMP_SERVER=$SOCK1
- addr1=$(rump.ifconfig shmif0 |awk '/address:/ { print $2;}')
- export RUMP_SERVER=$SOCK3
- addr3=$(rump.ifconfig shmif0 |awk '/address:/ { print $2;}')
- unset RUMP_SERVER
+ addr1=$(get_macaddr $SOCK1 shmif0)
+ addr3=$(get_macaddr $SOCK3 shmif0)
# Confirm there is no MAC address caches.
export RUMP_SERVER=$SOCK2
diff -r 184d842a878d -r 8df2691c1731 tests/net/net/t_ping6_opts.sh
--- a/tests/net/net/t_ping6_opts.sh Thu Nov 24 09:06:09 2016 +0000
+++ b/tests/net/net/t_ping6_opts.sh Thu Nov 24 09:07:09 2016 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_ping6_opts.sh,v 1.6 2016/11/24 09:06:09 ozaki-r Exp $
+# $NetBSD: t_ping6_opts.sh,v 1.7 2016/11/24 09:07:09 ozaki-r Exp $
#
# Copyright (c) 2016 Internet Initiative Japan Inc.
# All rights reserved.
@@ -109,13 +109,6 @@
setup_forwarder
}
-get_macaddr()
-{
-
- env RUMP_SERVER=${1} \
- rump.ifconfig ${2} |awk '/address/ {print $2;}'
-}
-
check_echo_request_pkt()
{
local pkt="$1 > $2: .+ echo request"
diff -r 184d842a878d -r 8df2691c1731 tests/net/net_common.sh
--- a/tests/net/net_common.sh Thu Nov 24 09:06:09 2016 +0000
+++ b/tests/net/net_common.sh Thu Nov 24 09:07:09 2016 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: net_common.sh,v 1.4 2016/11/24 09:06:09 ozaki-r Exp $
+# $NetBSD: net_common.sh,v 1.5 2016/11/24 09:07:09 ozaki-r Exp $
#
# Copyright (c) 2016 Internet Initiative Japan Inc.
# All rights reserved.
@@ -96,3 +96,10 @@
return 0
}
+
+get_macaddr()
+{
+
+ env RUMP_SERVER=${1} \
+ rump.ifconfig ${2} |awk '/address/ {print $2;}'
+}
Home |
Main Index |
Thread Index |
Old Index