Browse code

repair t_client.sh test after build system revolution

- run t_client.sh at "make check" time
- in t_client.sh, read t_client.rc from source *or* build dir (as before)
- @IP@ evaluates to "" now (not "ip") if iproute2 not found - adapt script
- introduce $SETUP_TIME_WAIT to delay "waiting for openvpn startup" longer
than the default delay of 10 seconds - this is needed for test servers
with a high network RTT

Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: David Sommerseth <davids@redhat.com>
Message-Id: 20120527202737.GV1161@greenie.muc.de
URL: http://article.gmane.org/gmane.network.openvpn.devel/6616
Signed-off-by: David Sommerseth <davids@redhat.com>

Gert Doering authored on 2012/05/28 05:19:11
Showing 2 changed files
... ...
@@ -12,13 +12,12 @@
12 12
 MAINTAINERCLEANFILES = \
13 13
 	$(srcdir)/Makefile.in
14 14
 
15
-test_scripts = t_lpback.sh t_cltsrv.sh
15
+test_scripts = t_client.sh t_lpback.sh t_cltsrv.sh
16 16
 
17 17
 TESTS_ENVIRONMENT = top_srcdir="$(top_srcdir)"
18 18
 TESTS = $(test_scripts)
19 19
 
20 20
 dist_noinst_SCRIPTS = \
21 21
 	$(test_scripts) \
22
-	t_cltsrv-down.sh \
23
-	t_client.sh
22
+	t_cltsrv-down.sh
24 23
 
... ...
@@ -14,16 +14,19 @@
14 14
 
15 15
 srcdir="${srcdir:-.}"
16 16
 top_builddir="${top_builddir:-..}"
17
-if [ -r "${srcdir}"/t_client.rc ] ; then
17
+if [ -r "${top_builddir}"/t_client.rc ] ; then
18
+    . "${top_builddir}"/t_client.rc
19
+elif [ -r "${srcdir}"/t_client.rc ] ; then
18 20
     . "${srcdir}"/t_client.rc
19 21
 else
20
-    echo "$0: cannot find 't_client.rc' in ('${srcdir}'). SKIPPING TEST." >&2
22
+    echo "$0: cannot find 't_client.rc' in build dir ('${top_builddir}')" >&2
23
+    echo "$0: or source directory ('${srcdir}'). SKIPPING TEST." >&2
21 24
     exit 77
22 25
 fi
23 26
 
24 27
 if [ ! -x "${top_builddir}/src/openvpn/openvpn" ]
25 28
 then
26
-    echo "no (executable) openvpn binary in current directory. FAIL." >&2
29
+    echo "no (executable) openvpn binary in current build tree. FAIL." >&2
27 30
     exit 1
28 31
 fi
29 32
 
... ...
@@ -83,7 +86,7 @@ fail()
83 83
 get_ifconfig_route()
84 84
 {
85 85
     # linux / iproute2? (-> if configure got a path)
86
-    if [ "@IPROUTE@" != "ip" ]
86
+    if [ "@IPROUTE@" != "" ]
87 87
     then
88 88
 	echo "-- linux iproute2 --"
89 89
 	@IPROUTE@ addr show     | grep -v valid_lft
... ...
@@ -236,7 +239,7 @@ do
236 236
     trap "$RUN_SUDO kill $opid ; trap - 0 ; exit 1" 1 2 3 15
237 237
 
238 238
     echo "wait for connection to establish..."
239
-    sleep 10
239
+    sleep ${SETUP_TIME_WAIT:-10}
240 240
 
241 241
     # test whether OpenVPN process is still there
242 242
     if $RUN_SUDO kill -0 $opid