Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src Add basic tests for vlan(4)



details:   https://anonhg.NetBSD.org/src/rev/41e40ee08a2e
branches:  trunk
changeset: 819305:41e40ee08a2e
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Sat Nov 26 03:19:48 2016 +0000

description:
Add basic tests for vlan(4)

diffstat:

 distrib/sets/lists/tests/mi |    6 +-
 etc/mtree/NetBSD.dist.tests |    3 +-
 tests/net/Makefile          |    4 +-
 tests/net/if_vlan/Makefile  |   13 ++++
 tests/net/if_vlan/t_vlan.sh |  115 ++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 137 insertions(+), 4 deletions(-)

diffs (191 lines):

diff -r 76ae4ab35d83 -r 41e40ee08a2e distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi       Sat Nov 26 03:17:58 2016 +0000
+++ b/distrib/sets/lists/tests/mi       Sat Nov 26 03:19:48 2016 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.702 2016/11/18 22:50:19 kamil Exp $
+# $NetBSD: mi,v 1.703 2016/11/26 03:19:48 ozaki-r Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -3235,6 +3235,10 @@
 ./usr/tests/net/if_tun/Atffile                 tests-net-tests         atf,rump
 ./usr/tests/net/if_tun/Kyuafile                        tests-net-tests         atf,rump,kyua
 ./usr/tests/net/if_tun/t_tun                   tests-net-tests         atf,rump
+./usr/tests/net/if_vlan                                tests-net-tests         compattestfile,atf
+./usr/tests/net/if_vlan/Atffile                        tests-net-tests         atf,rump
+./usr/tests/net/if_vlan/Kyuafile               tests-net-tests         atf,rump,kyua
+./usr/tests/net/if_vlan/t_vlan                 tests-net-tests         atf,rump
 ./usr/tests/net/in_cksum                       tests-net-tests         compattestfile,atf
 ./usr/tests/net/in_cksum/Atffile               tests-net-tests         compattestfile,atf
 ./usr/tests/net/in_cksum/Kyuafile              tests-net-tests         compattestfile,atf,kyua
diff -r 76ae4ab35d83 -r 41e40ee08a2e etc/mtree/NetBSD.dist.tests
--- a/etc/mtree/NetBSD.dist.tests       Sat Nov 26 03:17:58 2016 +0000
+++ b/etc/mtree/NetBSD.dist.tests       Sat Nov 26 03:19:48 2016 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: NetBSD.dist.tests,v 1.134 2016/11/16 21:36:23 kamil Exp $
+#      $NetBSD: NetBSD.dist.tests,v 1.135 2016/11/26 03:19:48 ozaki-r Exp $
 
 ./usr/libdata/debug/usr/tests
 ./usr/libdata/debug/usr/tests/atf
@@ -335,6 +335,7 @@
 ./usr/tests/net/if_pppoe
 ./usr/tests/net/if_tap
 ./usr/tests/net/if_tun
+./usr/tests/net/if_vlan
 ./usr/tests/net/in_cksum
 ./usr/tests/net/mcast
 ./usr/tests/net/mpls
diff -r 76ae4ab35d83 -r 41e40ee08a2e tests/net/Makefile
--- a/tests/net/Makefile        Sat Nov 26 03:17:58 2016 +0000
+++ b/tests/net/Makefile        Sat Nov 26 03:19:48 2016 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.29 2016/09/05 02:26:48 ozaki-r Exp $
+# $NetBSD: Makefile,v 1.30 2016/11/26 03:19:48 ozaki-r Exp $
 
 .include <bsd.own.mk>
 
@@ -7,7 +7,7 @@
 TESTS_SUBDIRS=         fdpass in_cksum net sys
 .if (${MKRUMP} != "no") && !defined(BSD_MK_COMPAT_FILE)
 TESTS_SUBDIRS+=                arp bpf bpfilter carp icmp if if_bridge if_gif if_loop
-TESTS_SUBDIRS+=                if_pppoe if_tap if_tun mcast mpls ndp npf route
+TESTS_SUBDIRS+=                if_pppoe if_tap if_tun mcast mpls ndp npf route if_vlan
 .if (${MKSLJIT} != "no")
 TESTS_SUBDIRS+=                bpfjit
 .endif
diff -r 76ae4ab35d83 -r 41e40ee08a2e tests/net/if_vlan/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/net/if_vlan/Makefile        Sat Nov 26 03:19:48 2016 +0000
@@ -0,0 +1,13 @@
+# $NetBSD: Makefile,v 1.1 2016/11/26 03:19:49 ozaki-r Exp $
+#
+
+.include <bsd.own.mk>
+
+TESTSDIR=      ${TESTSBASE}/net/if_vlan
+
+.for name in vlan
+TESTS_SH+=             t_${name}
+TESTS_SH_SRC_t_${name}=        ../net_common.sh t_${name}.sh
+.endfor
+
+.include <bsd.test.mk>
diff -r 76ae4ab35d83 -r 41e40ee08a2e tests/net/if_vlan/t_vlan.sh
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/net/if_vlan/t_vlan.sh       Sat Nov 26 03:19:48 2016 +0000
@@ -0,0 +1,115 @@
+#      $NetBSD: t_vlan.sh,v 1.1 2016/11/26 03:19:49 ozaki-r Exp $
+#
+# Copyright (c) 2016 Internet Initiative Japan Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+BUS=bus
+SOCK_LOCAL=unix://commsock1
+SOCK_REMOTE=unix://commsock2
+IP_LOCAL=10.0.0.1
+IP_REMOTE=10.0.0.2
+
+DEBUG=${DEBUG:-false}
+
+atf_test_case vlan_create_destroy cleanup
+vlan_create_destroy_head()
+{
+
+       atf_set "descr" "tests of creation and deletion of vlan interface"
+       atf_set "require.progs" "rump_server"
+}
+
+vlan_create_destroy_body()
+{
+
+       rump_server_start $SOCK_LOCAL vlan
+
+       export RUMP_SERVER=${SOCK_LOCAL}
+
+       atf_check -s exit:0 rump.ifconfig vlan0 create
+       atf_check -s exit:0 rump.ifconfig vlan0 up
+       atf_check -s exit:0 rump.ifconfig vlan0 down
+       atf_check -s exit:0 rump.ifconfig vlan0 destroy
+}
+
+vlan_create_destroy_cleanup()
+{
+
+       $DEBUG && dump
+       cleanup
+}
+
+atf_test_case vlan_basic cleanup
+vlan_basic_head()
+{
+
+       atf_set "descr" "tests of communications over vlan interfaces"
+       atf_set "require.progs" "rump_server"
+}
+
+vlan_basic_body()
+{
+
+       rump_server_start $SOCK_LOCAL vlan
+       rump_server_add_iface $SOCK_LOCAL shmif0 $BUS
+       rump_server_start $SOCK_REMOTE vlan
+       rump_server_add_iface $SOCK_REMOTE shmif0 $BUS
+
+       export RUMP_SERVER=$SOCK_LOCAL
+       atf_check -s exit:0 rump.ifconfig shmif0 up
+       export RUMP_SERVER=$SOCK_REMOTE
+       atf_check -s exit:0 rump.ifconfig shmif0 up
+
+       export RUMP_SERVER=$SOCK_LOCAL
+       atf_check -s exit:0 rump.ifconfig vlan0 create
+       atf_check -s exit:0 rump.ifconfig vlan0 vlan 10 vlanif shmif0
+       atf_check -s exit:0 rump.ifconfig vlan0 $IP_LOCAL/24
+       atf_check -s exit:0 rump.ifconfig vlan0 up
+       atf_check -s exit:0 rump.ifconfig -w 10
+
+       export RUMP_SERVER=$SOCK_REMOTE
+       atf_check -s exit:0 rump.ifconfig vlan0 create
+       atf_check -s exit:0 rump.ifconfig vlan0 vlan 10 vlanif shmif0
+       atf_check -s exit:0 rump.ifconfig vlan0 $IP_REMOTE/24
+       atf_check -s exit:0 rump.ifconfig vlan0 up
+       atf_check -s exit:0 rump.ifconfig -w 10
+
+       export RUMP_SERVER=$SOCK_LOCAL
+       atf_check -s exit:0 -o ignore rump.ping -n -w 1 -c 1 $IP_REMOTE
+}
+
+vlan_basic_cleanup()
+{
+
+       $DEBUG && dump
+       cleanup
+}
+
+atf_init_test_cases()
+{
+
+       atf_add_test_case vlan_create_destroy
+       atf_add_test_case vlan_basic
+}



Home | Main Index | Thread Index | Old Index