Commonalize and add tests of creating/destroying interfaces
This commit is contained in:
parent
af5b018293
commit
95dd9007db
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: t_bridge.sh,v 1.17 2017/03/11 04:24:52 ozaki-r Exp $
|
||||
# $NetBSD: t_bridge.sh,v 1.18 2018/02/01 05:22:01 ozaki-r Exp $
|
||||
#
|
||||
# Copyright (c) 2014 The NetBSD Foundation, Inc.
|
||||
# All rights reserved.
|
||||
|
@ -40,11 +40,19 @@ IP6BR2=fc00::12
|
|||
DEBUG=${DEBUG:-false}
|
||||
TIMEOUT=5
|
||||
|
||||
atf_test_case bridge_create_destroy cleanup
|
||||
atf_test_case bridge_ipv4 cleanup
|
||||
atf_test_case bridge_ipv6 cleanup
|
||||
atf_test_case bridge_member_ipv4 cleanup
|
||||
atf_test_case bridge_member_ipv6 cleanup
|
||||
|
||||
bridge_create_destroy_head()
|
||||
{
|
||||
|
||||
atf_set "descr" "Test creating/destroying bridge interfaces"
|
||||
atf_set "require.progs" "rump_server"
|
||||
}
|
||||
|
||||
bridge_ipv4_head()
|
||||
{
|
||||
atf_set "descr" "Does simple if_bridge tests"
|
||||
|
@ -312,6 +320,14 @@ test_ping6_member()
|
|||
rump.ifconfig -v shmif0
|
||||
}
|
||||
|
||||
bridge_create_destroy_body()
|
||||
{
|
||||
|
||||
rump_server_start $SOCK1 bridge
|
||||
|
||||
test_create_destroy_common $SOCK1 bridge0
|
||||
}
|
||||
|
||||
bridge_ipv4_body()
|
||||
{
|
||||
setup
|
||||
|
@ -392,6 +408,13 @@ bridge_member_ipv6_body()
|
|||
rump_server_destroy_ifaces
|
||||
}
|
||||
|
||||
bridge_create_destroy_cleanup()
|
||||
{
|
||||
|
||||
$DEBUG && dump
|
||||
cleanup
|
||||
}
|
||||
|
||||
bridge_ipv4_cleanup()
|
||||
{
|
||||
|
||||
|
@ -422,6 +445,8 @@ bridge_member_ipv6_cleanup()
|
|||
|
||||
atf_init_test_cases()
|
||||
{
|
||||
|
||||
atf_add_test_case bridge_create_destroy
|
||||
atf_add_test_case bridge_ipv4
|
||||
atf_add_test_case bridge_ipv6
|
||||
atf_add_test_case bridge_member_ipv4
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: t_gif.sh,v 1.11 2017/08/03 03:16:26 ozaki-r Exp $
|
||||
# $NetBSD: t_gif.sh,v 1.12 2018/02/01 05:22:01 ozaki-r Exp $
|
||||
#
|
||||
# Copyright (c) 2015 Internet Initiative Japan Inc.
|
||||
# All rights reserved.
|
||||
|
@ -64,6 +64,29 @@ ROUTER2_GIFIP6_RECURSIVE2=fc00:204::1
|
|||
DEBUG=${DEBUG:-false}
|
||||
TIMEOUT=5
|
||||
|
||||
atf_test_case gif_create_destroy cleanup
|
||||
gif_create_destroy_head()
|
||||
{
|
||||
|
||||
atf_set "descr" "Test creating/destroying gif interfaces"
|
||||
atf_set "require.progs" "rump_server"
|
||||
}
|
||||
|
||||
gif_create_destroy_body()
|
||||
{
|
||||
|
||||
rump_server_start $SOCK1 netinet6 gif
|
||||
|
||||
test_create_destroy_common $SOCK1 gif0 true
|
||||
}
|
||||
|
||||
gif_create_destroy_cleanup()
|
||||
{
|
||||
|
||||
$DEBUG && dump
|
||||
cleanup
|
||||
}
|
||||
|
||||
setup_router()
|
||||
{
|
||||
sock=${1}
|
||||
|
@ -757,6 +780,9 @@ add_test_allproto()
|
|||
|
||||
atf_init_test_cases()
|
||||
{
|
||||
|
||||
atf_add_test_case gif_create_destroy
|
||||
|
||||
add_test_allproto basic "basic tests"
|
||||
add_test_allproto ioctl "ioctl tests"
|
||||
add_test_allproto recursive "recursive check tests"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: t_ipsec.sh,v 1.2 2018/01/11 07:58:22 ozaki-r Exp $
|
||||
# $NetBSD: t_ipsec.sh,v 1.3 2018/02/01 05:22:01 ozaki-r Exp $
|
||||
#
|
||||
# Copyright (c) 2017 Internet Initiative Japan Inc.
|
||||
# All rights reserved.
|
||||
|
@ -64,6 +64,29 @@ ROUTER2_IPSECIP6_RECURSIVE2=fc00:204::1
|
|||
DEBUG=${DEBUG:-false}
|
||||
TIMEOUT=7
|
||||
|
||||
atf_test_case ipsecif_create_destroy cleanup
|
||||
ipsecif_create_destroy_head()
|
||||
{
|
||||
|
||||
atf_set "descr" "Test creating/destroying gif interfaces"
|
||||
atf_set "require.progs" "rump_server"
|
||||
}
|
||||
|
||||
ipsecif_create_destroy_body()
|
||||
{
|
||||
|
||||
rump_server_start $SOCK1 ipsec
|
||||
|
||||
test_create_destroy_common $SOCK1 ipsec0
|
||||
}
|
||||
|
||||
ipsecif_create_destroy_cleanup()
|
||||
{
|
||||
|
||||
$DEBUG && dump
|
||||
cleanup
|
||||
}
|
||||
|
||||
setup_router()
|
||||
{
|
||||
local sock=${1}
|
||||
|
@ -919,6 +942,9 @@ add_test_allproto()
|
|||
|
||||
atf_init_test_cases()
|
||||
{
|
||||
|
||||
atf_add_test_case ipsecif_create_destroy
|
||||
|
||||
add_test_allproto basic "basic tests"
|
||||
add_test_allproto ioctl "ioctl tests"
|
||||
add_test_allproto recursive "recursive check tests"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: t_l2tp.sh,v 1.3 2017/08/03 03:16:26 ozaki-r Exp $
|
||||
# $NetBSD: t_l2tp.sh,v 1.4 2018/02/01 05:22:01 ozaki-r Exp $
|
||||
#
|
||||
# Copyright (c) 2017 Internet Initiative Japan Inc.
|
||||
# All rights reserved.
|
||||
|
@ -49,6 +49,29 @@ CLIENT2_LANIP6=fc00:1::2
|
|||
TIMEOUT=5
|
||||
DEBUG=${DEBUG:-false}
|
||||
|
||||
atf_test_case l2tp_create_destroy cleanup
|
||||
l2tp_create_destroy_head()
|
||||
{
|
||||
|
||||
atf_set "descr" "Test creating/destroying l2tp interfaces"
|
||||
atf_set "require.progs" "rump_server"
|
||||
}
|
||||
|
||||
l2tp_create_destroy_body()
|
||||
{
|
||||
|
||||
rump_server_start $LAC1SOCK l2tp
|
||||
|
||||
test_create_destroy_common $LAC1SOCK l2tp0
|
||||
}
|
||||
|
||||
l2tp_create_destroy_cleanup()
|
||||
{
|
||||
|
||||
$DEBUG && dump
|
||||
cleanup
|
||||
}
|
||||
|
||||
setup_lac()
|
||||
{
|
||||
sock=${1}
|
||||
|
@ -435,6 +458,9 @@ add_test_allproto()
|
|||
|
||||
atf_init_test_cases()
|
||||
{
|
||||
|
||||
atf_add_test_case l2tp_create_destroy
|
||||
|
||||
add_test_allproto basic "basic tests"
|
||||
# add_test_allproto recursive "recursive check tests"
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: t_basic.sh,v 1.1 2017/02/28 03:32:11 ozaki-r Exp $
|
||||
# $NetBSD: t_basic.sh,v 1.2 2018/02/01 05:22:01 ozaki-r Exp $
|
||||
#
|
||||
# Copyright (c) 2017 Internet Initiative Japan Inc.
|
||||
# All rights reserved.
|
||||
|
@ -41,12 +41,7 @@ loop_create_destroy_body()
|
|||
|
||||
rump_server_start $SOCK_LOCAL netinet6
|
||||
|
||||
export RUMP_SERVER=${SOCK_LOCAL}
|
||||
|
||||
atf_check -s exit:0 rump.ifconfig lo1 create
|
||||
atf_check -s exit:0 rump.ifconfig lo1 up
|
||||
atf_check -s exit:0 rump.ifconfig lo1 down
|
||||
atf_check -s exit:0 rump.ifconfig lo1 destroy
|
||||
test_create_destroy_common $SOCK_LOCAL lo1 true
|
||||
}
|
||||
|
||||
loop_create_destroy_cleanup()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: t_pppoe.sh,v 1.17 2017/03/28 01:27:46 ozaki-r Exp $
|
||||
# $NetBSD: t_pppoe.sh,v 1.18 2018/02/01 05:22:01 ozaki-r Exp $
|
||||
#
|
||||
# Copyright (c) 2016 Internet Initiative Japan Inc.
|
||||
# All rights reserved.
|
||||
|
@ -39,6 +39,29 @@ TIMEOUT=3
|
|||
WAITTIME=10
|
||||
DEBUG=${DEBUG:-false}
|
||||
|
||||
atf_test_case pppoe_create_destroy cleanup
|
||||
pppoe_create_destroy_head()
|
||||
{
|
||||
|
||||
atf_set "descr" "Test creating/destroying pppoe interfaces"
|
||||
atf_set "require.progs" "rump_server"
|
||||
}
|
||||
|
||||
pppoe_create_destroy_body()
|
||||
{
|
||||
|
||||
rump_server_start $CLIENT netinet6 pppoe
|
||||
|
||||
test_create_destroy_common $CLIENT pppoe0 true
|
||||
}
|
||||
|
||||
pppoe_create_destroy_cleanup()
|
||||
{
|
||||
|
||||
$DEBUG && dump
|
||||
cleanup
|
||||
}
|
||||
|
||||
setup()
|
||||
{
|
||||
inet=true
|
||||
|
@ -403,6 +426,8 @@ pppoe6_chap_cleanup()
|
|||
|
||||
atf_init_test_cases()
|
||||
{
|
||||
|
||||
atf_add_test_case pppoe_create_destroy
|
||||
atf_add_test_case pppoe_pap
|
||||
atf_add_test_case pppoe_chap
|
||||
atf_add_test_case pppoe6_pap
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: t_tap.sh,v 1.6 2016/11/25 08:51:16 ozaki-r Exp $
|
||||
# $NetBSD: t_tap.sh,v 1.7 2018/02/01 05:22:02 ozaki-r Exp $
|
||||
#
|
||||
# Copyright (c) 2016 Internet Initiative Japan Inc.
|
||||
# All rights reserved.
|
||||
|
@ -51,23 +51,7 @@ tap_create_destroy_body()
|
|||
|
||||
rump_server_start $SOCK_LOCAL netinet6 tap
|
||||
|
||||
export RUMP_SERVER=${SOCK_LOCAL}
|
||||
|
||||
# Create and destroy (no address)
|
||||
atf_check -s exit:0 rump.ifconfig tap0 create
|
||||
atf_check -s exit:0 rump.ifconfig tap0 destroy
|
||||
|
||||
# Create and destroy (with an IPv4 address)
|
||||
atf_check -s exit:0 rump.ifconfig tap0 create
|
||||
atf_check -s exit:0 rump.ifconfig tap0 $IP4_TAP
|
||||
atf_check -s exit:0 rump.ifconfig tap0 up
|
||||
atf_check -s exit:0 rump.ifconfig tap0 destroy
|
||||
|
||||
# Create and destroy (with an IPv6 address)
|
||||
atf_check -s exit:0 rump.ifconfig tap0 create
|
||||
atf_check -s exit:0 rump.ifconfig tap0 inet6 $IP6_TAP
|
||||
atf_check -s exit:0 rump.ifconfig tap0 up
|
||||
atf_check -s exit:0 rump.ifconfig tap0 destroy
|
||||
test_create_destroy_common $SOCK_LOCAL tap0 true
|
||||
}
|
||||
|
||||
tap_create_destroy_cleanup()
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
# $NetBSD: Makefile,v 1.1 2016/09/05 02:26:48 ozaki-r Exp $
|
||||
# $NetBSD: Makefile,v 1.2 2018/02/01 05:22:02 ozaki-r Exp $
|
||||
#
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
||||
TESTSDIR= ${TESTSBASE}/net/if_tun
|
||||
|
||||
TESTS_SH= t_tun
|
||||
.for name in tun
|
||||
TESTS_SH+= t_${name}
|
||||
TESTS_SH_SRC_t_${name}= ../net_common.sh t_${name}.sh
|
||||
.endfor
|
||||
|
||||
.include <bsd.test.mk>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: t_tun.sh,v 1.4 2016/11/07 05:25:37 ozaki-r Exp $
|
||||
# $NetBSD: t_tun.sh,v 1.5 2018/02/01 05:22:02 ozaki-r Exp $
|
||||
#
|
||||
# Copyright (c) 2016 Internet Initiative Japan Inc.
|
||||
# All rights reserved.
|
||||
|
@ -49,12 +49,7 @@ 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
|
||||
test_create_destroy_common $SOCK_LOCAL tun0
|
||||
}
|
||||
|
||||
tun_create_destroy_cleanup()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: t_vlan.sh,v 1.7 2017/11/23 04:59:49 kre Exp $
|
||||
# $NetBSD: t_vlan.sh,v 1.8 2018/02/01 05:22:02 ozaki-r Exp $
|
||||
#
|
||||
# Copyright (c) 2016 Internet Initiative Japan Inc.
|
||||
# All rights reserved.
|
||||
|
@ -43,6 +43,9 @@ vlan_create_destroy_body_common()
|
|||
{
|
||||
export RUMP_SERVER=${SOCK_LOCAL}
|
||||
|
||||
atf_check -s exit:0 rump.ifconfig vlan0 create
|
||||
atf_check -s exit:0 rump.ifconfig vlan0 destroy
|
||||
|
||||
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
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: net_common.sh,v 1.25 2017/11/24 03:28:49 kre Exp $
|
||||
# $NetBSD: net_common.sh,v 1.26 2018/02/01 05:22:01 ozaki-r Exp $
|
||||
#
|
||||
# Copyright (c) 2016 Internet Initiative Japan Inc.
|
||||
# All rights reserved.
|
||||
|
@ -422,3 +422,45 @@ skip_if_qemu()
|
|||
atf_skip "unreliable under qemu, skip until PR kern/43997 fixed"
|
||||
fi
|
||||
}
|
||||
|
||||
test_create_destroy_common()
|
||||
{
|
||||
local sock=$1
|
||||
local ifname=$2
|
||||
local test_address=${3:-false}
|
||||
local ipv4="10.0.0.1/24"
|
||||
local ipv6="fc00::1"
|
||||
|
||||
export RUMP_SERVER=$sock
|
||||
|
||||
atf_check -s exit:0 rump.ifconfig $ifname create
|
||||
atf_check -s exit:0 rump.ifconfig $ifname destroy
|
||||
|
||||
atf_check -s exit:0 rump.ifconfig $ifname create
|
||||
atf_check -s exit:0 rump.ifconfig $ifname up
|
||||
atf_check -s exit:0 rump.ifconfig $ifname down
|
||||
atf_check -s exit:0 rump.ifconfig $ifname destroy
|
||||
|
||||
# Destroy while UP
|
||||
atf_check -s exit:0 rump.ifconfig $ifname create
|
||||
atf_check -s exit:0 rump.ifconfig $ifname up
|
||||
atf_check -s exit:0 rump.ifconfig $ifname destroy
|
||||
|
||||
if ! $test_address; then
|
||||
return
|
||||
fi
|
||||
|
||||
# With an IPv4 address
|
||||
atf_check -s exit:0 rump.ifconfig $ifname create
|
||||
atf_check -s exit:0 rump.ifconfig $ifname inet $ipv4
|
||||
atf_check -s exit:0 rump.ifconfig $ifname up
|
||||
atf_check -s exit:0 rump.ifconfig $ifname destroy
|
||||
|
||||
# With an IPv6 address
|
||||
atf_check -s exit:0 rump.ifconfig $ifname create
|
||||
atf_check -s exit:0 rump.ifconfig $ifname inet6 $ipv6
|
||||
atf_check -s exit:0 rump.ifconfig $ifname up
|
||||
atf_check -s exit:0 rump.ifconfig $ifname destroy
|
||||
|
||||
unset RUMP_SERVER
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue