Source-Changes-HG archive

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

[src/trunk]: src/tests/net/route Add test cases for PR kern/52077



details:   https://anonhg.NetBSD.org/src/rev/0410825ae9d6
branches:  trunk
changeset: 822531:0410825ae9d6
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Fri Mar 24 03:47:25 2017 +0000

description:
Add test cases for PR kern/52077

>From s-yamaguchi@IIJ

diffstat:

 tests/net/route/t_route.sh |  106 ++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 105 insertions(+), 1 deletions(-)

diffs (132 lines):

diff -r 9a44b7a737d1 -r 0410825ae9d6 tests/net/route/t_route.sh
--- a/tests/net/route/t_route.sh        Fri Mar 24 03:45:02 2017 +0000
+++ b/tests/net/route/t_route.sh        Fri Mar 24 03:47:25 2017 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: t_route.sh,v 1.11 2017/03/21 04:03:17 ozaki-r Exp $
+#      $NetBSD: t_route.sh,v 1.12 2017/03/24 03:47:25 ozaki-r Exp $
 #
 # Copyright (c) 2016 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -45,6 +45,8 @@
 IP6DST=fc00:0:0:2::2
 BUS_SRCGW=bus1
 BUS_DSTGW=bus2
+# command_add
+SOCKHOST=unix://commsock1
 
 DEBUG=${DEBUG:-false}
 TIMEOUT=1
@@ -437,6 +439,106 @@
        cleanup
 }
 
+atf_test_case route_command_add cleanup
+route_command_add_head()
+{
+
+       atf_set "descr" "tests of route add command"
+       atf_set "require.progs" "rump_server"
+}
+
+route_command_add_body()
+{
+
+       rump_server_start $SOCKHOST
+
+       export RUMP_SERVER=${SOCKHOST}
+       rump_server_add_iface $SOCKHOST shmif0 $BUS
+       atf_check -s exit:0 rump.ifconfig shmif0 10.0.0.1/24
+
+       # Accept the route whose gateway is in a subnet of interface address
+       atf_check -s exit:0 -o ignore rump.route add \
+           -net 10.0.1.0/24 10.0.0.2
+       atf_check -s exit:0 -o ignore rump.route add \
+           -host 10.0.2.1 10.0.0.3
+
+       # Accept the route whose gateway is an interface
+       atf_check -s exit:0 -o ignore rump.route add \
+           -net 10.0.3.0/24 -connected -link -iface shmif0
+
+       # Accept the route whose gateway is reachable and not RTF_GATEWAY
+       atf_check -s exit:0 -o ignore rump.route add \
+           -net 10.0.4.0/24 10.0.3.1
+
+       # Don't accept the route whose destination is reachable and
+       # gateway is unreachable
+       atf_check -s not-exit:0 -o ignore -e match:'unreachable' rump.route add \
+           -net 10.0.1.0/26 10.0.5.1
+
+       # Don't accept the route whose gateway is reachable and RTF_GATEWAY
+       atf_check -s not-exit:0 -o ignore -e ignore rump.route add \
+           -net 10.0.6.0/24 10.0.1.1
+
+       rump_server_destroy_ifaces
+}
+
+route_command_add_cleanup()
+{
+
+       $DEBUG && dump
+       cleanup
+}
+
+atf_test_case route_command_add6 cleanup
+route_command_add6_head()
+{
+
+       atf_set "descr" "tests of route add command (IPv6)"
+       atf_set "require.progs" "rump_server"
+}
+
+route_command_add6_body()
+{
+
+       rump_server_start $SOCKHOST netinet6
+
+       export RUMP_SERVER=${SOCKHOST}
+       rump_server_add_iface $SOCKHOST shmif0 $BUS
+       atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00::1/64
+
+       # Accept the route whose gateway is in a subnet of interface address
+       atf_check -s exit:0 -o ignore rump.route add -inet6\
+           -net fc00:1::0/64 fc00::2
+       atf_check -s exit:0 -o ignore rump.route add -inet6\
+           -host fc00:2::1 fc00::3
+
+       # Accept the route whose gateway is an interface
+       atf_check -s exit:0 -o ignore rump.route add -inet6\
+           -net fc00:3::0/64 -connected -link -iface shmif0
+
+       # Accept the route whose gateway is reachable and not RTF_GATEWAY
+       atf_check -s exit:0 -o ignore rump.route add -inet6\
+           -net fc00:4::0/64 fc00:3::1
+
+       # Don't accept the route whose destination is reachable and
+       # gateway is unreachable
+       atf_check -s not-exit:0 -o ignore -e match:'unreachable' rump.route add \
+           -inet6 -net fc00::4/128 fc00:5::1
+
+       # Don't accept the route whose gateway is reachable and RTF_GATEWAY
+       atf_check -s not-exit:0 -o ignore -e match:'unreachable' rump.route add \
+           -inet6 -net fc00:6::0/64 fc00:1::1
+
+       rump_server_destroy_ifaces
+}
+
+route_command_add6_cleanup()
+{
+
+       $DEBUG && dump
+       cleanup
+}
+
 atf_init_test_cases()
 {
 
@@ -444,4 +546,6 @@
        atf_add_test_case route_command_get
        atf_add_test_case route_command_get6
        atf_add_test_case route_default_reject
+       atf_add_test_case route_command_add
+       atf_add_test_case route_command_add6
 }



Home | Main Index | Thread Index | Old Index