summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGert Doering <gert@greenie.muc.de>2012-01-22 22:37:25 +0100
committerDavid Sommerseth <davids@redhat.com>2012-01-23 09:49:37 +0100
commit9c6ee9d1ecd85535c5529df1144fb02f613f5134 (patch)
treeb32aadc77296792ad0102753d7c2531089410b0b
parent06e781f885125b05de0a731743acd90d4492a435 (diff)
downloadopenvpn-9c6ee9d1ecd85535c5529df1144fb02f613f5134.tar.gz
openvpn-9c6ee9d1ecd85535c5529df1144fb02f613f5134.tar.xz
openvpn-9c6ee9d1ecd85535c5529df1144fb02f613f5134.zip
add "print test titles" and "use sudo" functionality to t_client.rc
Signed-off-by: Gert Doering <gert@greenie.muc.de> Acked-by: David Sommerseth <davids@redhat.com> Signed-off-by: David Sommerseth <davids@redhat.com>
-rw-r--r--t_client.rc-sample9
-rwxr-xr-xt_client.sh.in23
2 files changed, 23 insertions, 9 deletions
diff --git a/t_client.rc-sample b/t_client.rc-sample
index ca59c68..e766b5d 100644
--- a/t_client.rc-sample
+++ b/t_client.rc-sample
@@ -20,6 +20,12 @@ REMOTE=mytestserver
TEST_RUN_LIST="1 2"
#
+# use "sudo" (etc) to give openvpn the necessary privileges
+# if this is not active, "make check" must be run as root
+#
+#RUN_SUDO=sudo
+
+#
# base confic that is the same for all the p2mp test runs
#
OPENVPN_BASE_P2MP="--client --ca $CA_CERT \
@@ -39,6 +45,7 @@ OPENVPN_BASE_P2P="..."
#
# possible test options:
#
+# RUN_TITLE_x="what is being tested on here" (purely informational)
# OPENVPN_CONF_x = "how to call ./openvpn" [mandatory]
# EXPECT_IFCONFIG4_x = "this IPv4 address needs to show up in ifconfig"
# EXPECT_IFCONFIG6_x = "this IPv6 address needs to show up in ifconfig"
@@ -48,6 +55,7 @@ OPENVPN_BASE_P2P="..."
# Test 1: UDP / p2mp tun
# specify IPv4+IPv6 addresses expected from server and ping targets
#
+RUN_TITLE_1="testing tun/udp/ipv4+ipv6"
OPENVPN_CONF_1="$OPENVPN_BASE_P2MP --dev tun --proto udp --remote $REMOTE --port 51194"
EXPECT_IFCONFIG4_1="10.100.50.6"
EXPECT_IFCONFIG6_1="2001:dba:a050::1:0"
@@ -56,6 +64,7 @@ PING6_HOSTS_1="2001:dba::1 2001:dba:a050::1"
# Test 2: TCP / p2mp tun
#
+RUN_TITLE_2="testing tun/tcp/ipv4+ipv6"
OPENVPN_CONF_2="$OPENVPN_BASE_P2MP --dev tun --proto tcp --remote $REMOTE --port 51194"
EXPECT_IFCONFIG4_2="10.100.51.6"
EXPECT_IFCONFIG6_2="2001:dba:a051::1:0"
diff --git a/t_client.sh.in b/t_client.sh.in
index b273964..a6377db 100755
--- a/t_client.sh.in
+++ b/t_client.sh.in
@@ -50,8 +50,12 @@ ID=`id`
if expr "$ID" : "uid=0" >/dev/null
then :
else
- echo "$0: this test must run be as root. SKIP." >&2
- exit 77
+ if [ -z "$RUN_SUDO" ]
+ then
+ echo "$0: this test must run be as root, or RUN_SUDO=... " >&2
+ echo " must be set correctly in 't_client.rc'. SKIP." >&2
+ exit 77
+ fi
fi
LOGDIR=t_client-`hostname`-`date +%Y%m%d-%H%M%S`
@@ -199,19 +203,20 @@ run_ping_tests()
# ----------------------------------------------------------
for SUF in $TEST_RUN_LIST
do
- echo -e "\n### test run $SUF ###\n"
- fail_count=0
-
- echo "save pre-openvpn ifconfig + route"
- get_ifconfig_route >$LOGDIR/$SUF:ifconfig_route_pre.txt
-
# get config variables
+ eval test_run_title=\"\$RUN_TITLE_$SUF\"
eval openvpn_conf=\"\$OPENVPN_CONF_$SUF\"
eval expect_ifconfig4=\"\$EXPECT_IFCONFIG4_$SUF\"
eval expect_ifconfig6=\"\$EXPECT_IFCONFIG6_$SUF\"
eval ping4_hosts=\"\$PING4_HOSTS_$SUF\"
eval ping6_hosts=\"\$PING6_HOSTS_$SUF\"
+ echo -e "\n### test run $SUF: '$test_run_title' ###\n"
+ fail_count=0
+
+ echo "save pre-openvpn ifconfig + route"
+ get_ifconfig_route >$LOGDIR/$SUF:ifconfig_route_pre.txt
+
echo -e "\nrun pre-openvpn ping tests - targets must not be reachable..."
run_ping_tests 4 want_fail "$ping4_hosts"
run_ping_tests 6 want_fail "$ping6_hosts"
@@ -224,7 +229,7 @@ do
fi
echo " run ./openvpn $openvpn_conf"
- ./openvpn $openvpn_conf >$LOGDIR/$SUF:openvpn.log &
+ $RUN_SUDO ./openvpn $openvpn_conf >$LOGDIR/$SUF:openvpn.log &
opid=$!
# make sure openvpn client is terminated in case shell exits