Module Name:    src
Committed By:   ozaki-r
Date:           Sat Nov 26 03:19:49 UTC 2016

Modified Files:
        src/distrib/sets/lists/tests: mi
        src/etc/mtree: NetBSD.dist.tests
        src/tests/net: Makefile
Added Files:
        src/tests/net/if_vlan: Makefile t_vlan.sh

Log Message:
Add basic tests for vlan(4)


To generate a diff of this commit:
cvs rdiff -u -r1.702 -r1.703 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.134 -r1.135 src/etc/mtree/NetBSD.dist.tests
cvs rdiff -u -r1.29 -r1.30 src/tests/net/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/net/if_vlan/Makefile \
    src/tests/net/if_vlan/t_vlan.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.702 src/distrib/sets/lists/tests/mi:1.703
--- src/distrib/sets/lists/tests/mi:1.702	Fri Nov 18 22:50:19 2016
+++ src/distrib/sets/lists/tests/mi	Sat Nov 26 03:19:48 2016
@@ -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

Index: src/etc/mtree/NetBSD.dist.tests
diff -u src/etc/mtree/NetBSD.dist.tests:1.134 src/etc/mtree/NetBSD.dist.tests:1.135
--- src/etc/mtree/NetBSD.dist.tests:1.134	Wed Nov 16 21:36:23 2016
+++ src/etc/mtree/NetBSD.dist.tests	Sat Nov 26 03:19:48 2016
@@ -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

Index: src/tests/net/Makefile
diff -u src/tests/net/Makefile:1.29 src/tests/net/Makefile:1.30
--- src/tests/net/Makefile:1.29	Mon Sep  5 02:26:48 2016
+++ src/tests/net/Makefile	Sat Nov 26 03:19:48 2016
@@ -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 @@ TESTSDIR=	${TESTSBASE}/net
 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

Added files:

Index: src/tests/net/if_vlan/Makefile
diff -u /dev/null src/tests/net/if_vlan/Makefile:1.1
--- /dev/null	Sat Nov 26 03:19:49 2016
+++ src/tests/net/if_vlan/Makefile	Sat Nov 26 03:19:49 2016
@@ -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>
Index: src/tests/net/if_vlan/t_vlan.sh
diff -u /dev/null src/tests/net/if_vlan/t_vlan.sh:1.1
--- /dev/null	Sat Nov 26 03:19:49 2016
+++ src/tests/net/if_vlan/t_vlan.sh	Sat Nov 26 03:19:49 2016
@@ -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
+}

Reply via email to