Skip to content

Commit 966cdeb

Browse files
flichtenheldcron2
authored andcommitted
tests: Allow to override openvpn binary used
This makes it easy to test an installed binary for example. Change-Id: Ida7a64a299cd5bf7ae4f0cc725756b5f5cc408f9 Signed-off-by: Frank Lichtenheld <[email protected]> Acked-by: Gert Doering <[email protected]> Message-Id: <[email protected]> URL: https://www.mail-archive.com/[email protected]/msg26648.html Signed-off-by: Gert Doering <[email protected]> Acked-by: Gert Doering <[email protected]> Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1424 (cherry picked from commit d623aa6) Message-Id: <[email protected]> URL: https://www.mail-archive.com/[email protected]/msg34907.html Signed-off-by: Gert Doering <[email protected]>
1 parent 3118c42 commit 966cdeb

File tree

4 files changed

+15
-12
lines changed

4 files changed

+15
-12
lines changed

tests/t_client.sh.in

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ TCLIENT_SKIP_RC="${TCLIENT_SKIP_RC:-77}"
1818

1919
srcdir="${srcdir:-.}"
2020
top_builddir="${top_builddir:-..}"
21+
openvpn="${openvpn:-${top_builddir}/src/openvpn/openvpn}"
2122
if [ -r "${top_builddir}"/t_client.rc ] ; then
2223
. "${top_builddir}"/t_client.rc
2324
elif [ -r "${srcdir}"/t_client.rc ] ; then
@@ -49,7 +50,7 @@ if [ $? -ne 0 ]; then
4950
exit "${TCLIENT_SKIP_RC}"
5051
fi
5152

52-
if [ ! -x "${top_builddir}/src/openvpn/openvpn" ]
53+
if [ ! -x "${openvpn}" ]
5354
then
5455
echo "no (executable) openvpn binary in current build tree. FAIL." >&2
5556
exit 1
@@ -352,9 +353,9 @@ do
352353
pidfile="${top_builddir}/tests/$LOGDIR/openvpn-$SUF.pid"
353354
openvpn_conf="$openvpn_conf --writepid $pidfile $up"
354355
output " run openvpn $openvpn_conf"
355-
echo "# src/openvpn/openvpn $openvpn_conf" >$LOGDIR/$SUF:openvpn.log
356+
echo "# ${openvpn} $openvpn_conf" >$LOGDIR/$SUF:openvpn.log
356357
umask 022
357-
$RUN_SUDO "${top_builddir}/src/openvpn/openvpn" $openvpn_conf >>$LOGDIR/$SUF:openvpn.log &
358+
$RUN_SUDO "${openvpn}" $openvpn_conf >>$LOGDIR/$SUF:openvpn.log &
358359
sudopid=$!
359360

360361
# Check if OpenVPN has initialized before continuing. It will check every 3rd second up

tests/t_cltsrv.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ set -e
2222
srcdir="${srcdir:-.}"
2323
top_srcdir="${top_srcdir:-..}"
2424
top_builddir="${top_builddir:-..}"
25+
openvpn="${openvpn:-${top_builddir}/src/openvpn/openvpn}"
2526
trap "rm -f log.$$ log.$$.signal ; trap 0 ; exit 77" 1 2 15
2627
trap "rm -f log.$$ log.$$.signal ; exit 1" 0 3
2728
addopts=
@@ -55,8 +56,8 @@ success=0
5556
for i in 1 2 3 ; do
5657
set +e
5758
(
58-
"${top_builddir}/src/openvpn/openvpn" --script-security 2 --cd "${root}" ${addopts} --setenv role srv --down "${downscript}" --tls-exit --ping-exit 180 --config "sample-config-files/loopback-server" &
59-
"${top_builddir}/src/openvpn/openvpn" --script-security 2 --cd "${top_srcdir}/sample" ${addopts} --setenv role clt --down "${downscript}" --tls-exit --ping-exit 180 --config "sample-config-files/loopback-client"
59+
"${openvpn}" --script-security 2 --cd "${root}" ${addopts} --setenv role srv --down "${downscript}" --tls-exit --ping-exit 180 --config "sample-config-files/loopback-server" &
60+
"${openvpn}" --script-security 2 --cd "${top_srcdir}/sample" ${addopts} --setenv role clt --down "${downscript}" --tls-exit --ping-exit 180 --config "sample-config-files/loopback-client"
6061
) 3>log.$$.signal >log.$$ 2>&1
6162
e1=$?
6263
wait $!

tests/t_lpback.sh

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
set -eu
2323
top_builddir="${top_builddir:-..}"
24+
openvpn="${openvpn:-${top_builddir}/src/openvpn/openvpn}"
2425
trap "rm -f key.$$ tc-server-key.$$ tc-client-key.$$ log.$$ ; trap 0 ; exit 77" 1 2 15
2526
trap "rm -f key.$$ tc-server-key.$$ tc-client-key.$$ log.$$ ; exit 1" 0 3
2627

@@ -71,7 +72,7 @@ fi
7172

7273

7374
# Get list of supported ciphers from openvpn --show-ciphers output
74-
CIPHERS=$(${top_builddir}/src/openvpn/openvpn --show-ciphers | \
75+
CIPHERS=$(${openvpn} --show-ciphers | \
7576
sed -e '/The following/,/^$/d' -e s'/ .*//' -e '/^[[:space:]]*$/d')
7677

7778
# SK, 2014-06-04: currently the DES-EDE3-CFB1 implementation of OpenSSL is
@@ -90,23 +91,23 @@ fi
9091
# Also test cipher 'none'
9192
CIPHERS=${CIPHERS}$(printf "\nnone")
9293

93-
"${top_builddir}/src/openvpn/openvpn" --genkey secret key.$$
94+
"${openvpn}" --genkey secret key.$$
9495
set +e
9596

9697
for cipher in ${CIPHERS}
9798
do
9899
test_start "Testing cipher ${cipher}... "
99-
( "${top_builddir}/src/openvpn/openvpn" --test-crypto --secret key.$$ --cipher ${cipher} ) >log.$$ 2>&1
100+
( "${openvpn}" --test-crypto --secret key.$$ --cipher ${cipher} ) >log.$$ 2>&1
100101
test_end $? log.$$
101102
done
102103

103104
test_start "Testing tls-crypt-v2 server key generation... "
104-
"${top_builddir}/src/openvpn/openvpn" \
105+
"${openvpn}" \
105106
--genkey tls-crypt-v2-server tc-server-key.$$ >log.$$ 2>&1
106107
test_end $? log.$$
107108

108109
test_start "Testing tls-crypt-v2 key generation (no metadata)... "
109-
"${top_builddir}/src/openvpn/openvpn" --tls-crypt-v2 tc-server-key.$$ \
110+
"${openvpn}" --tls-crypt-v2 tc-server-key.$$ \
110111
--genkey tls-crypt-v2-client tc-client-key.$$ >log.$$ 2>&1
111112
test_end $? log.$$
112113

@@ -118,7 +119,7 @@ while [ $i -lt 732 ]; do
118119
i=$(expr $i + 1)
119120
done
120121
test_start "Testing tls-crypt-v2 key generation (max length metadata)... "
121-
"${top_builddir}/src/openvpn/openvpn" --tls-crypt-v2 tc-server-key.$$ \
122+
"${openvpn}" --tls-crypt-v2 tc-server-key.$$ \
122123
--genkey tls-crypt-v2-client tc-client-key.$$ "${METADATA}" \
123124
>log.$$ 2>&1
124125
test_end $? log.$$

tests/t_net.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LAST_TEST=8
77

88
srcdir="${srcdir:-.}"
99
top_builddir="${top_builddir:-..}"
10-
openvpn="${top_builddir}/src/openvpn/openvpn"
10+
openvpn="${openvpn:-${top_builddir}/src/openvpn/openvpn}"
1111

1212

1313
# bail out right away on non-linux. NetLink (the object of this test) is only

0 commit comments

Comments
 (0)