Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Add very basic tests for tun devices
details: https://anonhg.NetBSD.org/src/rev/5e10c36e143d
branches: trunk
changeset: 347600:5e10c36e143d
user: ozaki-r <ozaki-r%NetBSD.org@localhost>
date: Mon Sep 05 02:26:48 2016 +0000
description:
Add very basic tests for tun devices
diffstat:
distrib/sets/lists/tests/mi | 6 +++-
etc/mtree/NetBSD.dist.tests | 3 +-
tests/net/Makefile | 4 +-
tests/net/if_tun/Atffile | 7 ++++
tests/net/if_tun/Makefile | 10 +++++++
tests/net/if_tun/t_tun.sh | 64 +++++++++++++++++++++++++++++++++++++++++++++
6 files changed, 90 insertions(+), 4 deletions(-)
diffs (148 lines):
diff -r f594cc68f0f3 -r 5e10c36e143d distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi Mon Sep 05 02:25:37 2016 +0000
+++ b/distrib/sets/lists/tests/mi Mon Sep 05 02:26:48 2016 +0000
@@ -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
diff -r f594cc68f0f3 -r 5e10c36e143d etc/mtree/NetBSD.dist.tests
--- a/etc/mtree/NetBSD.dist.tests Mon Sep 05 02:25:37 2016 +0000
+++ b/etc/mtree/NetBSD.dist.tests Mon Sep 05 02:26:48 2016 +0000
@@ -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
diff -r f594cc68f0f3 -r 5e10c36e143d tests/net/Makefile
--- a/tests/net/Makefile Mon Sep 05 02:25:37 2016 +0000
+++ b/tests/net/Makefile Mon Sep 05 02:26:48 2016 +0000
@@ -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 @@
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
diff -r f594cc68f0f3 -r 5e10c36e143d tests/net/if_tun/Atffile
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/net/if_tun/Atffile Mon Sep 05 02:26:48 2016 +0000
@@ -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
diff -r f594cc68f0f3 -r 5e10c36e143d tests/net/if_tun/Makefile
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/net/if_tun/Makefile Mon Sep 05 02:26:48 2016 +0000
@@ -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>
diff -r f594cc68f0f3 -r 5e10c36e143d tests/net/if_tun/t_tun.sh
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/net/if_tun/t_tun.sh Mon Sep 05 02:26:48 2016 +0000
@@ -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
+}
Home |
Main Index |
Thread Index |
Old Index