Module Name:    src
Committed By:   ozaki-r
Date:           Mon Sep  5 02:26:48 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_tun: Atffile Makefile t_tun.sh

Log Message:
Add very basic tests for tun devices


To generate a diff of this commit:
cvs rdiff -u -r1.685 -r1.686 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.130 -r1.131 src/etc/mtree/NetBSD.dist.tests
cvs rdiff -u -r1.28 -r1.29 src/tests/net/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/net/if_tun/Atffile \
    src/tests/net/if_tun/Makefile src/tests/net/if_tun/t_tun.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.685 src/distrib/sets/lists/tests/mi:1.686
--- src/distrib/sets/lists/tests/mi:1.685	Wed Aug 31 14:05:10 2016
+++ src/distrib/sets/lists/tests/mi	Mon Sep  5 02:26:48 2016
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.685 2016/08/31 14:05:10 maya Exp $
+# $NetBSD: mi,v 1.686 2016/09/05 02:26:48 ozaki-r Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -3207,6 +3207,10 @@
 ./usr/tests/net/if_tap/Atffile			tests-net-tests		atf,rump
 ./usr/tests/net/if_tap/Kyuafile			tests-net-tests		atf,rump,kyua
 ./usr/tests/net/if_tap/t_tap			tests-net-tests		atf,rump
+./usr/tests/net/if_tun				tests-net-tests		compattestfile,atf
+./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/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.130 src/etc/mtree/NetBSD.dist.tests:1.131
--- src/etc/mtree/NetBSD.dist.tests:1.130	Sun Aug 14 14:55:42 2016
+++ src/etc/mtree/NetBSD.dist.tests	Mon Sep  5 02:26:48 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: NetBSD.dist.tests,v 1.130 2016/08/14 14:55:42 jakllsch Exp $
+#	$NetBSD: NetBSD.dist.tests,v 1.131 2016/09/05 02:26:48 ozaki-r Exp $
 
 ./usr/libdata/debug/usr/tests
 ./usr/libdata/debug/usr/tests/atf
@@ -330,6 +330,7 @@
 ./usr/tests/net/if_loop
 ./usr/tests/net/if_pppoe
 ./usr/tests/net/if_tap
+./usr/tests/net/if_tun
 ./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.28 src/tests/net/Makefile:1.29
--- src/tests/net/Makefile:1.28	Fri Apr 15 01:38:17 2016
+++ src/tests/net/Makefile	Mon Sep  5 02:26:48 2016
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.28 2016/04/15 01:38:17 ozaki-r Exp $
+# $NetBSD: Makefile,v 1.29 2016/09/05 02:26: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 mcast mpls ndp npf route
+TESTS_SUBDIRS+=		if_pppoe if_tap if_tun mcast mpls ndp npf route
 .if (${MKSLJIT} != "no")
 TESTS_SUBDIRS+=		bpfjit
 .endif

Added files:

Index: src/tests/net/if_tun/Atffile
diff -u /dev/null src/tests/net/if_tun/Atffile:1.1
--- /dev/null	Mon Sep  5 02:26:48 2016
+++ src/tests/net/if_tun/Atffile	Mon Sep  5 02:26:48 2016
@@ -0,0 +1,7 @@
+Content-Type: application/X-atf-atffile; version="1"
+
+# Automatically generated by bsd.test.mk.
+
+prop: test-suite = "NetBSD"
+
+tp: t_tun
Index: src/tests/net/if_tun/Makefile
diff -u /dev/null src/tests/net/if_tun/Makefile:1.1
--- /dev/null	Mon Sep  5 02:26:48 2016
+++ src/tests/net/if_tun/Makefile	Mon Sep  5 02:26:48 2016
@@ -0,0 +1,10 @@
+# $NetBSD: Makefile,v 1.1 2016/09/05 02:26:48 ozaki-r Exp $
+#
+
+.include <bsd.own.mk>
+
+TESTSDIR=	${TESTSBASE}/net/if_tun
+
+TESTS_SH=	t_tun
+
+.include <bsd.test.mk>
Index: src/tests/net/if_tun/t_tun.sh
diff -u /dev/null src/tests/net/if_tun/t_tun.sh:1.1
--- /dev/null	Mon Sep  5 02:26:48 2016
+++ src/tests/net/if_tun/t_tun.sh	Mon Sep  5 02:26:48 2016
@@ -0,0 +1,64 @@
+#	$NetBSD: t_tun.sh,v 1.1 2016/09/05 02:26:48 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.
+#
+
+RUMP_FLAGS="-lrumpnet -lrumpnet_net -lrumpnet_netinet -lrumpnet_netinet6"
+RUMP_FLAGS="$RUMP_FLAGS -lrumpnet_shmif -lrumpnet_tun -lrumpdev"
+
+SOCK_LOCAL=unix://commsock1
+
+atf_test_case tun_create_destroy cleanup
+tun_create_destroy_head()
+{
+
+	atf_set "descr" "tests of creation and deletion of tun interface"
+	atf_set "require.progs" "rump_server"
+}
+
+tun_create_destroy_body()
+{
+
+	atf_check -s exit:0 rump_server ${RUMP_FLAGS} ${SOCK_LOCAL}
+
+	export RUMP_SERVER=${SOCK_LOCAL}
+
+	atf_check -s exit:0 rump.ifconfig tun0 create
+	atf_check -s exit:0 rump.ifconfig tun0 up
+	atf_check -s exit:0 rump.ifconfig tun0 down
+	atf_check -s exit:0 rump.ifconfig tun0 destroy
+}
+
+tun_create_destroy_cleanup()
+{
+
+	RUMP_SERVER=${SOCK_LOCAL} rump.halt
+}
+
+atf_init_test_cases()
+{
+
+	atf_add_test_case tun_create_destroy
+}

Reply via email to