Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/net/if_pppoe functionalize rump.ifconfig and pppoectl ...
details: https://anonhg.NetBSD.org/src/rev/f528d4fc0638
branches: trunk
changeset: 961855:f528d4fc0638
user: yamaguchi <yamaguchi%NetBSD.org@localhost>
date: Fri Apr 23 03:38:19 2021 +0000
description:
functionalize rump.ifconfig and pppoectl for clearer test code
diffstat:
tests/net/if_pppoe/t_pppoe.sh | 278 ++++++++++++++++++++---------------------
1 files changed, 133 insertions(+), 145 deletions(-)
diffs (truncated from 543 to 300 lines):
diff -r 4747e54fe6d0 -r f528d4fc0638 tests/net/if_pppoe/t_pppoe.sh
--- a/tests/net/if_pppoe/t_pppoe.sh Fri Apr 23 03:36:13 2021 +0000
+++ b/tests/net/if_pppoe/t_pppoe.sh Fri Apr 23 03:38:19 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_pppoe.sh,v 1.25 2021/04/23 03:07:19 yamaguchi Exp $
+# $NetBSD: t_pppoe.sh,v 1.26 2021/04/23 03:38:19 yamaguchi Exp $
#
# Copyright (c) 2016 Internet Initiative Japan Inc.
# All rights reserved.
@@ -39,6 +39,18 @@
WAITTIME=10
DEBUG=${DEBUG:-false}
+atf_ifconfig()
+{
+
+ atf_check -s exit:0 rump.ifconfig $*
+}
+
+atf_pppoectl()
+{
+
+ atf_check -s exit:0 -x "$HIJACKING pppoectl $*"
+}
+
atf_test_case pppoe_create_destroy cleanup
pppoe_create_destroy_head()
{
@@ -71,19 +83,19 @@
rump_server_add_iface $CLIENT pppoe0
export RUMP_SERVER=$SERVER
- atf_check -s exit:0 rump.ifconfig shmif0 up
- $inet && atf_check -s exit:0 rump.ifconfig pppoe0 \
+ atf_ifconfig shmif0 up
+ $inet && atf_ifconfig pppoe0 \
inet $SERVER_IP $CLIENT_IP down
- atf_check -s exit:0 rump.ifconfig pppoe0 link0
+ atf_ifconfig pppoe0 link0
$DEBUG && rump.ifconfig
$DEBUG && $HIJACKING pppoectl -d pppoe0
unset RUMP_SERVER
export RUMP_SERVER=$CLIENT
- atf_check -s exit:0 rump.ifconfig shmif0 up
+ atf_ifconfig shmif0 up
- $inet && atf_check -s exit:0 rump.ifconfig pppoe0 \
+ $inet && atf_ifconfig pppoe0 \
inet 0.0.0.0 0.0.0.1 down
$DEBUG && rump.ifconfig
@@ -105,11 +117,11 @@
setup_ifaces
export RUMP_SERVER=$SERVER
- atf_check -s exit:0 -x "$HIJACKING pppoectl -e shmif0 pppoe0"
+ atf_pppoectl -e shmif0 pppoe0
unset RUMP_SERVER
export RUMP_SERVER=$CLIENT
- atf_check -s exit:0 -x "$HIJACKING pppoectl -e shmif0 pppoe0"
+ atf_pppoectl -e shmif0 pppoe0
unset RUMP_SERVER
}
@@ -166,22 +178,17 @@
fi
export RUMP_SERVER=$SERVER
- local setup_serverparam="pppoectl pppoe0 hisauthproto=$auth \
- 'hisauthname=$AUTHNAME' \
- 'hisauthsecret=$SECRET' \
- 'myauthproto=none' \
- $server_optparam"
- atf_check -s exit:0 -x "$HIJACKING $setup_serverparam"
- atf_check -s exit:0 rump.ifconfig pppoe0 up
+ atf_pppoectl pppoe0 "hisauthproto=$auth" \
+ "hisauthname=$AUTHNAME" "hisauthsecret=$SECRET" \
+ "myauthproto=none" $server_optparam
+ atf_ifconfig pppoe0 up
unset RUMP_SERVER
export RUMP_SERVER=$CLIENT
- local setup_clientparam="pppoectl pppoe0 myauthproto=$auth \
- 'myauthname=$AUTHNAME' \
- 'myauthsecret=$SECRET' \
- 'hisauthproto=none'"
- atf_check -s exit:0 -x "$HIJACKING $setup_clientparam"
- atf_check -s exit:0 rump.ifconfig pppoe0 up
+ atf_pppoectl pppoe0 \
+ "myauthname=$AUTHNAME" "myauthsecret=$SECRET" \
+ "myauthproto=$auth" "hisauthproto=none"
+ atf_ifconfig pppoe0 up
$DEBUG && rump.ifconfig
wait_for_opened $cp
atf_check -s exit:0 -o ignore rump.ping -c 1 -w $TIMEOUT $SERVER_IP
@@ -189,7 +196,7 @@
# test for disconnection from server
export RUMP_SERVER=$SERVER
- atf_check -s exit:0 rump.ifconfig pppoe0 down
+ atf_ifconfig pppoe0 down
wait_for_disconnected
export RUMP_SERVER=$CLIENT
wait_for_disconnected
@@ -207,7 +214,7 @@
# test for disconnection from client
export RUMP_SERVER=$CLIENT
- atf_check -s exit:0 -x rump.ifconfig pppoe0 down
+ atf_ifconfig pppoe0 down
wait_for_disconnected
export RUMP_SERVER=$SERVER
wait_for_disconnected
@@ -219,14 +226,14 @@
# test for reconnecting
export RUMP_SERVER=$CLIENT
- atf_check -s exit:0 -x rump.ifconfig pppoe0 up
+ atf_ifconfig pppoe0 up
wait_for_opened $cp
$DEBUG && rump.ifconfig pppoe0
$DEBUG && $HIJACKING pppoectl -d pppoe0
unset RUMP_SERVER
export RUMP_SERVER=$SERVER
- atf_check -s exit:0 rump.ifconfig -w 10
+ atf_ifconfig -w 10
atf_check -s exit:0 -o ignore rump.ping -c 1 -w $TIMEOUT $CLIENT_IP
atf_check -s exit:0 -o match:'session' -x "$HIJACKING pppoectl -d pppoe0"
$DEBUG && HIJACKING pppoectl -d pppoe0
@@ -234,15 +241,14 @@
# test for invalid password
export RUMP_SERVER=$CLIENT
- atf_check -s exit:0 rump.ifconfig pppoe0 down
+ atf_ifconfig pppoe0 down
wait_for_disconnected
- local setup_clientparam="pppoectl pppoe0 myauthproto=$auth \
- 'myauthname=$AUTHNAME' \
- 'myauthsecret=invalidsecret' \
- 'hisauthproto=none' \
- 'max-auth-failure=1'"
- atf_check -s exit:0 -x "$HIJACKING $setup_clientparam"
- atf_check -s exit:0 rump.ifconfig pppoe0 up
+ atf_pppoectl pppoe0 "myauthproto=$auth" \
+ "myauthname=$AUTHNAME" \
+ "myauthsecret=invalidsecret" \
+ "hisauthproto=none" \
+ "max-auth-failure=1"
+ atf_ifconfig pppoe0 up
wait_for_opened $cp dontfail
atf_check -s not-exit:0 -o ignore -e ignore \
rump.ping -c 1 -w $TIMEOUT $SERVER_IP
@@ -303,29 +309,25 @@
fi
export RUMP_SERVER=$SERVER
- local setup_serverparam="pppoectl pppoe0 hisauthproto=$auth \
- 'hisauthname=$AUTHNAME' \
- 'hisauthsecret=$SECRET' \
- 'myauthproto=none' \
- $server_optparam"
- atf_check -s exit:0 -x "$HIJACKING $setup_serverparam"
- atf_check -s exit:0 rump.ifconfig pppoe0 inet6 $SERVER_IP6/64 down
- atf_check -s exit:0 rump.ifconfig pppoe0 up
+ atf_pppoectl pppoe0 \
+ "hisauthname=$AUTHNAME" "hisauthsecret=$SECRET" \
+ "hisauthproto=$auth" "myauthproto=none" \
+ $server_optparam
+ atf_ifconfig pppoe0 inet6 $SERVER_IP6/64 down
+ atf_ifconfig pppoe0 up
unset RUMP_SERVER
export RUMP_SERVER=$CLIENT
- local setup_clientparam="pppoectl pppoe0 myauthproto=$auth \
- 'myauthname=$AUTHNAME' \
- 'myauthsecret=$SECRET' \
- 'hisauthproto=none'"
- atf_check -s exit:0 -x "$HIJACKING $setup_clientparam"
- atf_check -s exit:0 rump.ifconfig pppoe0 inet6 $CLIENT_IP6/64 down
- atf_check -s exit:0 rump.ifconfig pppoe0 up
+ atf_pppoectl pppoe0 \
+ "myauthname=$AUTHNAME" "myauthsecret=$SECRET" \
+ "myauthproto=$auth" "hisauthproto=none"
+ atf_ifconfig pppoe0 inet6 $CLIENT_IP6/64 down
+ atf_ifconfig pppoe0 up
$DEBUG && rump.ifconfig
wait_for_opened $cp
- atf_check -s exit:0 -o ignore rump.ifconfig -w 10
+ atf_ifconfig -w 10
export RUMP_SERVER=$SERVER
- atf_check -s exit:0 -o ignore rump.ifconfig -w 10
+ rump.ifconfig -w 10
export RUMP_SERVER=$CLIENT
atf_check -s exit:0 -o ignore rump.ping6 -c 1 -X $TIMEOUT $SERVER_IP6
unset RUMP_SERVER
@@ -333,7 +335,7 @@
# test for disconnection from server
export RUMP_SERVER=$SERVER
session_id=`$HIJACKING pppoectl -d pppoe0 | grep state`
- atf_check -s exit:0 rump.ifconfig pppoe0 down
+ atf_ifconfig pppoe0 down
wait_for_disconnected
export RUMP_SERVER=$CLIENT
wait_for_disconnected
@@ -344,19 +346,19 @@
# test for reconnecting
export RUMP_SERVER=$SERVER
- atf_check -s exit:0 rump.ifconfig pppoe0 up
+ atf_ifconfig pppoe0 up
wait_for_opened $cp
- atf_check -s exit:0 rump.ifconfig -w 10
+ atf_ifconfig -w 10
$DEBUG && $HIJACKING pppoectl -d pppoe0
$DEBUG && rump.ifconfig pppoe0
export RUMP_SERVER=$CLIENT
- atf_check -s exit:0 -o ignore rump.ifconfig -w 10
+ atf_ifconfig -w 10
atf_check -s exit:0 -o ignore rump.ping6 -c 1 -X $TIMEOUT $SERVER_IP6
unset RUMP_SERVER
# test for disconnection from client
export RUMP_SERVER=$CLIENT
- atf_check -s exit:0 rump.ifconfig pppoe0 down
+ atf_ifconfig pppoe0 down
wait_for_disconnected
export RUMP_SERVER=$SERVER
@@ -369,16 +371,16 @@
# test for reconnecting
export RUMP_SERVER=$CLIENT
- atf_check -s exit:0 rump.ifconfig pppoe0 up
+ atf_ifconfig pppoe0 up
wait_for_opened $cp
- atf_check -s exit:0 rump.ifconfig -w 10
+ atf_ifconfig -w 10
$DEBUG && rump.ifconfig pppoe0
$DEBUG && $HIJACKING pppoectl -d pppoe0
unset RUMP_SERVER
export RUMP_SERVER=$SERVER
- atf_check -s exit:0 rump.ifconfig -w 10
+ atf_ifconfig -w 10
atf_check -s exit:0 -o ignore rump.ping6 -c 1 -X $TIMEOUT $CLIENT_IP6
atf_check -s exit:0 -o match:'session' -x "$HIJACKING pppoectl -d pppoe0"
$DEBUG && HIJACKING pppoectl -d pppoe0
@@ -386,15 +388,13 @@
# test for invalid password
export RUMP_SERVER=$CLIENT
- atf_check -s exit:0 rump.ifconfig pppoe0 down
+ atf_ifconfig pppoe0 down
wait_for_disconnected
- local setup_clientparam="pppoectl pppoe0 myauthproto=$auth \
- 'myauthname=$AUTHNAME' \
- 'myauthsecret=invalidsecret' \
- 'hisauthproto=none' \
- 'max-auth-failure=1'"
- atf_check -s exit:0 -x "$HIJACKING $setup_clientparam"
- atf_check -s exit:0 rump.ifconfig pppoe0 up
+ atf_pppoectl pppoe0 \
+ "myauthname=$AUTHNAME" "myauthsecret=invalidsecret" \
+ "myauthproto=$auth" "hisauthproto=none" \
+ "max-auth-failure=1"
+ atf_ifconfig pppoe0 up
wait_for_opened $cp dontfail
atf_check -s not-exit:0 -o ignore -e ignore \
rump.ping6 -c 1 -X $TIMEOUT $SERVER_IP6
@@ -453,27 +453,23 @@
setup_auth_conf()
{
local auth=chap
+ local server_optparam="norechallenge"
export RUMP_SERVER=$SERVER
- local setup_serverparam="pppoectl pppoe0 hisauthproto=$auth \
- 'hisauthname=$AUTHNAME' \
- 'hisauthsecret=$SECRET' \
- 'myauthproto=none' \
- $server_optparam"
-
- atf_check -s exit:0 rump.ifconfig pppoe0 link0
- atf_check -s exit:0 -x "$HIJACKING $setup_serverparam"
+ atf_ifconfig pppoe0 link0
+ atf_pppoectl pppoe0 \
+ "hisauthname=$AUTHNAME" "hisauthsecret=$SECRET" \
+ "hisauthproto=$auth" "myauthproto=none" \
+ $server_optparam
unset RUMP_SERVER
- local setup_clientparam="pppoectl pppoe0 myauthproto=$auth \
- 'myauthname=$AUTHNAME' \
- 'myauthsecret=$SECRET' \
- 'hisauthproto=none'"
Home |
Main Index |
Thread Index |
Old Index