Source-Changes-HG archive

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

[src/trunk]: src Add tests of interface creation/destruction



details:   https://anonhg.NetBSD.org/src/rev/175d4d33d4e3
branches:  trunk
changeset: 339170:175d4d33d4e3
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Wed Jul 01 08:33:31 2015 +0000

description:
Add tests of interface creation/destruction

diffstat:

 distrib/sets/lists/tests/mi |   3 +-
 tests/net/if/Makefile       |   3 +-
 tests/net/if/t_ifconfig.sh  |  78 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 82 insertions(+), 2 deletions(-)

diffs (116 lines):

diff -r 45833daf523e -r 175d4d33d4e3 distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi       Wed Jul 01 08:13:52 2015 +0000
+++ b/distrib/sets/lists/tests/mi       Wed Jul 01 08:33:31 2015 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.630 2015/06/24 01:39:24 matt Exp $
+# $NetBSD: mi,v 1.631 2015/07/01 08:33:31 ozaki-r Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -3138,6 +3138,7 @@
 ./usr/tests/net/if/ifconf                      tests-net-tests         atf,rump
 ./usr/tests/net/if/t_compat                    tests-net-tests         atf,rump
 ./usr/tests/net/if/t_ifconf                    tests-net-tests         atf,rump
+./usr/tests/net/if/t_ifconfig                  tests-net-tests         atf,rump
 ./usr/tests/net/if_bridge                      tests-net-tests         compattestfile,atf
 ./usr/tests/net/if_bridge/Atffile              tests-net-tests         atf,rump
 ./usr/tests/net/if_bridge/Kyuafile             tests-net-tests         atf,rump,kyua
diff -r 45833daf523e -r 175d4d33d4e3 tests/net/if/Makefile
--- a/tests/net/if/Makefile     Wed Jul 01 08:13:52 2015 +0000
+++ b/tests/net/if/Makefile     Wed Jul 01 08:33:31 2015 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.4 2014/12/08 07:34:31 ozaki-r Exp $
+# $NetBSD: Makefile,v 1.5 2015/07/01 08:33:31 ozaki-r Exp $
 #
 
 .include <bsd.own.mk>
@@ -7,6 +7,7 @@
 
 TESTS_C=       t_compat
 TESTS_SH=      t_ifconf
+TESTS_SH+=     t_ifconfig
 
 PROGS=         ifconf
 MAN.ifconf=    # empty
diff -r 45833daf523e -r 175d4d33d4e3 tests/net/if/t_ifconfig.sh
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/net/if/t_ifconfig.sh        Wed Jul 01 08:33:31 2015 +0000
@@ -0,0 +1,78 @@
+# $NetBSD: t_ifconfig.sh,v 1.1 2015/07/01 08:33:31 ozaki-r Exp $
+#
+# Copyright (c) 2015 The NetBSD Foundation, 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_SERVER1=unix://./r1
+
+RUMP_FLAGS=\
+"-lrumpnet -lrumpnet_net -lrumpnet_netinet -lrumpnet_netinet6 -lrumpnet_shmif"
+
+atf_test_case create_destroy cleanup
+create_destroy_head()
+{
+
+       atf_set "descr" "tests of ifconfig create and destroy"
+       atf_set "require.progs" "rump_server"
+}
+
+create_destroy_body()
+{
+       atf_check -s exit:0 rump_server ${RUMP_FLAGS} ${RUMP_SERVER1}
+
+       export RUMP_SERVER=${RUMP_SERVER1}
+
+       # Create and destroy (no address)
+       atf_check -s exit:0 rump.ifconfig shmif0 create
+       atf_check -s exit:0 rump.ifconfig shmif0 destroy
+
+       # Create and destroy (with an IPv4 address)
+       atf_check -s exit:0 rump.ifconfig shmif0 create
+       atf_check -s exit:0 rump.ifconfig shmif0 linkstr shmbus
+       atf_check -s exit:0 rump.ifconfig shmif0 192.168.0.1/24
+       atf_check -s exit:0 rump.ifconfig shmif0 up
+       atf_check -s exit:0 rump.ifconfig shmif0 destroy
+
+       # Create and destroy (with an IPv6 address)
+       atf_check -s exit:0 rump.ifconfig shmif0 create
+       atf_check -s exit:0 rump.ifconfig shmif0 linkstr shmbus
+       atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00::1
+       atf_check -s exit:0 rump.ifconfig shmif0 up
+       atf_check -s exit:0 rump.ifconfig shmif0 destroy
+
+       unset RUMP_SERVER
+}
+
+create_destroy_cleanup()
+{
+
+       RUMP_SERVER=${RUMP_SERVER1} rump.halt
+}
+
+atf_init_test_cases()
+{
+
+       atf_add_test_case create_destroy
+}



Home | Main Index | Thread Index | Old Index