From: "flichtenheld (Code Review)" Date: Mon, 8 Dec 2025 17:46:16 +0000 References: Reply-To: frank@...2641..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net Message-ID: <030325468629591c14a5499ec0ce1544eeaabd0b-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="ZA3+0R/EHGU="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[release/2.6]: tests: Allow to override openvpn binary used List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos Cc: openvpn-devel --ZA3+0R/EHGU= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: cron2, plaisthos. Hello plaisthos, I'd like you to do a code review. Please visit http://gerrit.openvpn.net/c/openvpn/+/1424?usp=3Demail to review the following change. Change subject: tests: Allow to override openvpn binary used ...................................................................... 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 Acked-by: Gert Doering Message-Id: <20230511101253.369196-1-frank@...2641...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg26= 648.html Signed-off-by: Gert Doering (cherry picked from commit d623aa6c29545a7f00daaa73d87818a9c5b1e942) --- M tests/t_client.sh.in M tests/t_cltsrv.sh M tests/t_lpback.sh M tests/t_net.sh 4 files changed, 15 insertions(+), 12 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/24/1424/1 diff --git a/tests/t_client.sh.in b/tests/t_client.sh.in index 03a0dbf..f6654dd 100755 --- a/tests/t_client.sh.in +++ b/tests/t_client.sh.in @@ -18,6 +18,7 @@ srcdir=3D"${srcdir:-.}" top_builddir=3D"${top_builddir:-..}" +openvpn=3D"${openvpn:-${top_builddir}/src/openvpn/openvpn}" if [ -r "${top_builddir}"/t_client.rc ] ; then . "${top_builddir}"/t_client.rc elif [ -r "${srcdir}"/t_client.rc ] ; then @@ -49,7 +50,7 @@ exit "${TCLIENT_SKIP_RC}" fi -if [ ! -x "${top_builddir}/src/openvpn/openvpn" ] +if [ ! -x "${openvpn}" ] then echo "no (executable) openvpn binary in current build tree. FAIL." >&2 exit 1 @@ -352,9 +353,9 @@ pidfile=3D"${top_builddir}/tests/$LOGDIR/openvpn-$SUF.pid" openvpn_conf=3D"$openvpn_conf --writepid $pidfile $up" output " run openvpn $openvpn_conf" - echo "# src/openvpn/openvpn $openvpn_conf" >$LOGDIR/$SUF:openvpn.log + echo "# ${openvpn} $openvpn_conf" >$LOGDIR/$SUF:openvpn.log umask 022 - $RUN_SUDO "${top_builddir}/src/openvpn/openvpn" $openvpn_conf >>$LOGDI= R/$SUF:openvpn.log & + $RUN_SUDO "${openvpn}" $openvpn_conf >>$LOGDIR/$SUF:openvpn.log & sudopid=3D$! # Check if OpenVPN has initialized before continuing. It will check e= very 3rd second up diff --git a/tests/t_cltsrv.sh b/tests/t_cltsrv.sh index 752251e..4a8643a 100755 --- a/tests/t_cltsrv.sh +++ b/tests/t_cltsrv.sh @@ -22,6 +22,7 @@ srcdir=3D"${srcdir:-.}" top_srcdir=3D"${top_srcdir:-..}" top_builddir=3D"${top_builddir:-..}" +openvpn=3D"${openvpn:-${top_builddir}/src/openvpn/openvpn}" trap "rm -f log.$$ log.$$.signal ; trap 0 ; exit 77" 1 2 15 trap "rm -f log.$$ log.$$.signal ; exit 1" 0 3 addopts=3D @@ -55,8 +56,8 @@ for i in 1 2 3 ; do set +e ( - "${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" & - "${top_builddir}/src/openvpn/openvpn" --script-security 2 --cd "${top_sr= cdir}/sample" ${addopts} --setenv role clt --down "${downscript}" --tls-exi= t --ping-exit 180 --config "sample-config-files/loopback-client" + "${openvpn}" --script-security 2 --cd "${root}" ${addopts} --setenv role= srv --down "${downscript}" --tls-exit --ping-exit 180 --config "sample-con= fig-files/loopback-server" & + "${openvpn}" --script-security 2 --cd "${top_srcdir}/sample" ${addopts} = --setenv role clt --down "${downscript}" --tls-exit --ping-exit 180 --confi= g "sample-config-files/loopback-client" ) 3>log.$$.signal >log.$$ 2>&1 e1=3D$? wait $! diff --git a/tests/t_lpback.sh b/tests/t_lpback.sh index 5aabbd5..482016a 100755 --- a/tests/t_lpback.sh +++ b/tests/t_lpback.sh @@ -21,6 +21,7 @@ set -eu top_builddir=3D"${top_builddir:-..}" +openvpn=3D"${openvpn:-${top_builddir}/src/openvpn/openvpn}" trap "rm -f key.$$ tc-server-key.$$ tc-client-key.$$ log.$$ ; trap 0 ; exi= t 77" 1 2 15 trap "rm -f key.$$ tc-server-key.$$ tc-client-key.$$ log.$$ ; exit 1" 0 3 @@ -71,7 +72,7 @@ # Get list of supported ciphers from openvpn --show-ciphers output -CIPHERS=3D$(${top_builddir}/src/openvpn/openvpn --show-ciphers | \ +CIPHERS=3D$(${openvpn} --show-ciphers | \ sed -e '/The following/,/^$/d' -e s'/ .*//' -e '/^[[:space:]]*= $/d') # SK, 2014-06-04: currently the DES-EDE3-CFB1 implementation of OpenSSL is @@ -90,23 +91,23 @@ # Also test cipher 'none' CIPHERS=3D${CIPHERS}$(printf "\nnone") -"${top_builddir}/src/openvpn/openvpn" --genkey secret key.$$ +"${openvpn}" --genkey secret key.$$ set +e for cipher in ${CIPHERS} do test_start "Testing cipher ${cipher}... " - ( "${top_builddir}/src/openvpn/openvpn" --test-crypto --secret key.$$ = --cipher ${cipher} ) >log.$$ 2>&1 + ( "${openvpn}" --test-crypto --secret key.$$ --cipher ${cipher} ) >log= .$$ 2>&1 test_end $? log.$$ done test_start "Testing tls-crypt-v2 server key generation... " -"${top_builddir}/src/openvpn/openvpn" \ +"${openvpn}" \ --genkey tls-crypt-v2-server tc-server-key.$$ >log.$$ 2>&1 test_end $? log.$$ test_start "Testing tls-crypt-v2 key generation (no metadata)... " -"${top_builddir}/src/openvpn/openvpn" --tls-crypt-v2 tc-server-key.$$ \ +"${openvpn}" --tls-crypt-v2 tc-server-key.$$ \ --genkey tls-crypt-v2-client tc-client-key.$$ >log.$$ 2>&1 test_end $? log.$$ @@ -118,7 +119,7 @@ i=3D$(expr $i + 1) done test_start "Testing tls-crypt-v2 key generation (max length metadata)... " -"${top_builddir}/src/openvpn/openvpn" --tls-crypt-v2 tc-server-key.$$ \ +"${openvpn}" --tls-crypt-v2 tc-server-key.$$ \ --genkey tls-crypt-v2-client tc-client-key.$$ "${METADATA}" \ >log.$$ 2>&1 test_end $? log.$$ diff --git a/tests/t_net.sh b/tests/t_net.sh index bc91f82..8134832 100755 --- a/tests/t_net.sh +++ b/tests/t_net.sh @@ -7,7 +7,7 @@ srcdir=3D"${srcdir:-.}" top_builddir=3D"${top_builddir:-..}" -openvpn=3D"${top_builddir}/src/openvpn/openvpn" +openvpn=3D"${openvpn:-${top_builddir}/src/openvpn/openvpn}" # bail out right away on non-linux. NetLink (the object of this test) is o= nly -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1424?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings?usp=3Demail Gerrit-MessageType: newchange Gerrit-Project: openvpn Gerrit-Branch: release/2.6 Gerrit-Change-Id: Ida7a64a299cd5bf7ae4f0cc725756b5f5cc408f9 Gerrit-Change-Number: 1424 Gerrit-PatchSet: 1 Gerrit-Owner: flichtenheld Gerrit-Reviewer: cron2 Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-Attention: cron2 --ZA3+0R/EHGU= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is cur= rently required from: cron2, plaisthos.

flichtenheld would like plaisthos to review this change.

V= iew Change

tests: Allow to override openvpn binary use=
d

This makes it easy to test an installed binary for
example.
=
Change-Id: Ida7a64a299cd5bf7ae4f0cc725756b5f5cc408f9
Signed-off-by: = Frank Lichtenheld <frank@...2641...>
Acked-by: Gert Doering <ge= rt@...1296...>
Message-Id: <20230511101253.369196-1-frank@...2724...= ..>
URL: https://www.mail-archive.com/openvpn-devel@...282...= .net/msg26648.html
Signed-off-by: Gert Doering <gert@...1296...>(cherry picked from commit d623aa6c29545a7f00daaa73d87818a9c5b1e942)
-= --
M tests/t_client.sh.in
M tests/t_cltsrv.sh
M tests/t_lpback.sh<= br>M tests/t_net.sh
4 files changed, 15 insertions(+), 12 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn r=
efs/changes/24/1424/1
diff --git a/tests/t_client.sh.in b/tests/t_c=
lient.sh.in
index 03a0dbf..f6654dd 100755
-= -- a/tests/t_client.sh.in
+++ b/tests/t_client.sh.in=
@@ -18,6 +18,7 @@

srcdir=3D&qu= ot;${srcdir:-.}"
top_builddir=3D"${top_builddir:= -..}"
+openvpn= =3D"${openvpn:-${top_builddir}/src/openvpn/openvpn}"
if [ -r "${top_builddir}"/t_client.rc ] ; then
. "${top_builddir}"/t_client.rc
elif [ -= r "${srcdir}"/t_client.rc ] ; then
@@ -49,7 +50,7= @@
exit "${TCLIENT_SKIP_RC}"
fi

-if [ ! -x "${top_builddir}/src/openvpn/openvpn" ]
+if [ ! -x "${openvpn}" = ]
then
echo "no (executable) ope= nvpn binary in current build tree. FAIL." >&2
= exit 1
@@ -352,9 +353,9 @@
pidfile= =3D"${top_builddir}/tests/$LOGDIR/openvpn-$SUF.pid"
openvpn_conf=3D"$openvpn_conf --writepid $pidfile $up"

output " run openvpn $openvpn_conf"
= - echo "# src/openvpn/ope= nvpn $openvpn_conf" >$LOGDIR/$SUF:openvpn.log
+ echo "# ${openvpn} $openvpn_conf= " >$LOGDIR/$SUF:openvpn.log
umask 022- $RUN_SUDO "${top_buil= ddir}/src/openvpn/openvpn" $openvpn_conf >>$LOGDIR/$SUF:openvpn.= log &
+ $RUN_S= UDO "${openvpn}" $openvpn_conf >>$LOGDIR/$SUF:openvpn.log &= amp;
sudopid=3D$!

= # Check if OpenVPN has initialized before continuing. It will check eve= ry 3rd second up
diff --git a/tests/t_cltsrv.sh b/tests/t_c= ltsrv.sh
index 752251e..4a8643a 100755
--- = a/tests/t_cltsrv.sh
+++ b/tests/t_cltsrv.sh
@@ -22,6 +22,7 @@
srcdir=3D"${srcdir:-.}"

top_srcdir=3D"${top_srcdir:-..}"
top= _builddir=3D"${top_builddir:-..}"
+openvpn=3D"${openvpn:-${top_builddir}/src/open= vpn/openvpn}"
trap "rm -f log.$$ log.$$.signal ;= trap 0 ; exit 77" 1 2 15
trap "rm -f log.$$ log= .$$.signal ; exit 1" 0 3
addopts=3D
@= @ -55,8 +56,8 @@
for i in 1 2 3 ; do
se= t +e
(
- "${top_builddir}/src/openvpn/openvpn" --script-security 2 -= -cd "${root}" ${addopts} --setenv role srv --down "${downscr= ipt}" --tls-exit --ping-exit 180 --config "sample-config-files/lo= opback-server" &
- "${top_builddir}/src/openvpn/openvpn" --script-security 2 -= -cd "${top_srcdir}/sample" ${addopts} --setenv role clt --down &q= uot;${downscript}" --tls-exit --ping-exit 180 --config "sample-co= nfig-files/loopback-client"
+ "${openvpn}" --script-security 2 --cd "${root= }" ${addopts} --setenv role srv --down "${downscript}" --tls= -exit --ping-exit 180 --config "sample-config-files/loopback-server&qu= ot; &
+ "${= openvpn}" --script-security 2 --cd "${top_srcdir}/sample" ${= addopts} --setenv role clt --down "${downscript}" --tls-exit --pi= ng-exit 180 --config "sample-config-files/loopback-client"=
) 3>log.$$.signal >log.$$ 2>&1
= e1=3D$?
wait $!
diff --git a/tests/t_lp= back.sh b/tests/t_lpback.sh
index 5aabbd5..482016a 100755
--- a/tests/t_lpback.sh
+++ b/tests/t_lpback= .sh
@@ -21,6 +21,7 @@

se= t -eu
top_builddir=3D"${top_builddir:-..}"
+openvpn=3D"${openvpn= :-${top_builddir}/src/openvpn/openvpn}"
trap "rm= -f key.$$ tc-server-key.$$ tc-client-key.$$ log.$$ ; trap 0 ; exit 77"= ; 1 2 15
trap "rm -f key.$$ tc-server-key.$$ tc-clien= t-key.$$ log.$$ ; exit 1" 0 3

@@ -71= ,7 +72,7 @@


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

# SK, 2014-06-04: cu= rrently the DES-EDE3-CFB1 implementation of OpenSSL is
@@ -= 90,23 +91,23 @@
# Also test cipher 'none' CIPHERS=3D${CIPHERS}$(printf "\nnone")
=
-"${top_builddir}= /src/openvpn/openvpn" --genkey secret key.$$
+"${openvpn}" --genkey secret key.$$=
set +e

for cipher in $= {CIPHERS}
do
test_start "Testing= cipher ${cipher}... "
- ( "${top_builddir}/src/openvpn/openvpn" --test-crypto -= -secret key.$$ --cipher ${cipher} ) >log.$$ 2>&1
+ ( "${openvpn}" --test-= crypto --secret key.$$ --cipher ${cipher} ) >log.$$ 2>&1 test_end $? log.$$
done

test_start "Testing tls-crypt-v2 server key generation..= . "
-"${top_b= uilddir}/src/openvpn/openvpn" \
+"${openvpn}" \
--genkey tls= -crypt-v2-server tc-server-key.$$ >log.$$ 2>&1
t= est_end $? log.$$

test_start "Testi= ng tls-crypt-v2 key generation (no metadata)... "
-"${top_builddir}/src/openvpn/openvpn&= quot; --tls-crypt-v2 tc-server-key.$$ \
+"${openvpn}" --tls-crypt-v2 tc-server-key.$$ = \
--genkey tls-crypt-v2-client tc-client-key.$$ >lo= g.$$ 2>&1
test_end $? log.$$

@@ -118,7 +119,7 @@
i=3D$(expr $i + 1)
done
test_start "Testing tls-crypt-v2 k= ey generation (max length metadata)... "
-"${top_builddir}/src/openvpn/openvpn" --t= ls-crypt-v2 tc-server-key.$$ \
+"${openvpn}" --tls-crypt-v2 tc-server-key.$$ \<= br> --genkey tls-crypt-v2-client tc-client-key.$$ "${METADAT= A}" \
>log.$$ 2>&1
tes= t_end $? log.$$
diff --git a/tests/t_net.sh b/tests/t_net.s= h
index bc91f82..8134832 100755
--- a/tests= /t_net.sh
+++ b/tests/t_net.sh
@@ -7,7 +7,7= @@

srcdir=3D"${srcdir:-.}"
top_builddir=3D"${top_builddir:-..}"
-openvpn=3D"${top_builddir}/src= /openvpn/openvpn"

change 1424. To unsubscribe, or for help writing = mail filters, visit settings.

=
Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: release/2.6
Gerrit-Change-Id: Ida7a64a299cd5bf7ae4f0cc7257= 56b5f5cc408f9
Gerrit-Change-Number: 1424
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <frank@...2723...= .>
Gerrit-Reviewer: cron2 <gert@...1296...>=
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-Attention: plaisthos <arne-openvpn@...220...= ..1227...>
Gerrit-Attention: cron2 <gert@...1296...>= ;
= --ZA3+0R/EHGU=--