From: "mattock (Code Review)" Date: Fri, 25 Oct 2024 13:00:12 +0000 References: Reply-To: samuli@...515..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="VdH33AM+W68="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: t_server_null: use wait instead of marker files List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos , flichtenheld Cc: openvpn-devel --VdH33AM+W68= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: flichtenheld, plaisthos. Hello plaisthos, flichtenheld, I'd like you to do a code review. Please visit http://gerrit.openvpn.net/c/openvpn/+/786?usp=3Demail to review the following change. Change subject: t_server_null: use wait instead of marker files ...................................................................... t_server_null: use wait instead of marker files By using wait in a more inventive way we can avoid using a marker file to detect the "server could not be killed gracefully" situation. Change-Id: Ib385080e1dd1c3046c54e6267db8aa7d5c09e2fb Signed-off-by: Samuli Sepp=C3=A4nen --- M tests/t_server_null.sh M tests/t_server_null_server.sh 2 files changed, 10 insertions(+), 8 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/86/786/1 diff --git a/tests/t_server_null.sh b/tests/t_server_null.sh index 3c0fc4b..74ffd52 100755 --- a/tests/t_server_null.sh +++ b/tests/t_server_null.sh @@ -62,6 +62,8 @@ mkdir $t_server_null_logdir "${srcdir}/t_server_null_server.sh" & +T_SERVER_NULL_SERVER_PID=3D$! + "${srcdir}/t_server_null_client.sh" retval=3D$? @@ -69,11 +71,9 @@ # that this script does not exit before all --dev null servers are dead and # their network interfaces are gone. Otherwise t_client.sh will fail becau= se # pre and post ifconfig output does not match. -wait +wait $T_SERVER_NULL_SERVER_PID -. ./t_server_null_default.rc - -if [ -e $SERVER_KILL_FAIL_FILE ]; then +if [ $? -ne 0 ]; then exit 1 else exit $retval diff --git a/tests/t_server_null_server.sh b/tests/t_server_null_server.sh index ab01dd2..acf8479 100755 --- a/tests/t_server_null_server.sh +++ b/tests/t_server_null_server.sh @@ -37,8 +37,9 @@ # Load local configuration, if any test -r ./t_server_null.rc && . ./t_server_null.rc -# Remove server kill failure marker file, if any -rm -f $SERVER_KILL_FAIL_FILE +# We can't exit immediately on the first failure as that could leave proce= sses +# lying around. +retval=3D0 # Launch test servers for SUF in $TEST_SERVER_LIST @@ -81,7 +82,6 @@ # Make sure that the server processes are truly dead before exiting. If a # server process does not exit in 15 seconds assume it never will, move on= and # hope for the best. - echo "Waiting for servers to exit" for PID_FILE in $server_pid_files do @@ -111,6 +111,8 @@ echo "ERROR: had to send SIGKILL to server ${SERVER_NAME} with pid= ${SERVER_PID}!" echo "Tail of server log:" tail -n 20 "${t_server_null_logdir}/${SERVER_NAME}.log" - touch $SERVER_KILL_FAIL_FILE + retval=3D1 fi done + +exit $retval -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/786?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: Ib385080e1dd1c3046c54e6267db8aa7d5c09e2fb Gerrit-Change-Number: 786 Gerrit-PatchSet: 1 Gerrit-Owner: mattock Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-Attention: flichtenheld Gerrit-MessageType: newchange --VdH33AM+W68= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is currently required from: flichtenheld, plaisthos.

mattock would like plaisthos and flichtenheld to review= this change.

Vi= ew Change

t_server_null: use wait instead of marker files

By usi= ng wait in a more inventive way we can avoid using a marker file
to dete= ct the "server could not be killed gracefully" situation.

= Change-Id: Ib385080e1dd1c3046c54e6267db8aa7d5c09e2fb
Signed-off-by: Samu= li Sepp=C3=A4nen <samuli.seppanen@...277...>
---
M tests/t_serv= er_null.sh
M tests/t_server_null_server.sh
2 files changed, 10 insert= ions(+), 8 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/o=
penvpn refs/changes/86/786/1
diff --git a/tests/t_server_null.sh b/=
tests/t_server_null.sh
index 3c0fc4b..74ffd52 100755=
--- a/tests/t_server_null.sh
+++ b/tests/t_server= _null.sh
@@ -62,6 +62,8 @@
mkdir $t_server= _null_logdir

"${srcdir}/t_server_nu= ll_server.sh" &
+T_SERVER_NULL_SERVER_PID=3D$!
+
"${srcdir}/t_server_null_client.sh&qu= ot;
retval=3D$?

@@ -69,1= 1 +71,9 @@
# that this script does not exit before all --d= ev null servers are dead and
# their network interfaces ar= e gone. Otherwise t_client.sh will fail because
# pre and = post ifconfig output does not match.
-wait
+= wait $T_SERVER_NULL_SERVER_PID

-. ./t_server_null_default.rc
-
-if [ -e $SERVER_KILL_FAIL_FILE ]; then
+if [ $? -ne 0 ]; then
= exit 1
else
exit $retval
= diff --git a/tests/t_server_null_server.sh b/tests/t_server_null_serv= er.sh
index ab01dd2..acf8479 100755
--- a/t= ests/t_server_null_server.sh
+++ b/tests/t_server_null_serv= er.sh
@@ -37,8 +37,9 @@
# Load local confi= guration, if any
test -r ./t_server_null.rc && . .= /t_server_null.rc

-# Remove server kill failure marker file, if any
-rm -f $SERVER_KILL_FAIL_FILE
+# We can't exit immed= iately on the first failure as that could leave processes
+# lying around.
+retval=3D0

# Launch test servers
for SUF in $TEST_SERVER_LIST

@@ -81,7 +82,6 @@
# Make sure that the serve= r processes are truly dead before exiting. If a
# server = process does not exit in 15 seconds assume it never will, move on and
# hope for the best.
-
echo "Waiting for servers to exit"
for PID_FILE in $server_pid_files
do
@@ -111,6 +111,8 @@
echo "ERROR: h= ad to send SIGKILL to server ${SERVER_NAME} with pid ${SERVER_PID}!"
echo "Tail of server log:"
tail -n 20 "${t_server_null_logdir}/${SERVER_NAME}.log"= ;

- touch $SERVE= R_KILL_FAIL_FILE
+ = retval=3D1
fi
done
+

+exit $retval

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

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib385080e1dd1c3046c54e6267db= 8aa7d5c09e2fb
Gerrit-Change-Number: 786
Gerrit-PatchSet: 1
Gerrit-Owner: mattock <samuli@...515...>=
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
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: flichtenheld <frank@...2375...= 41...>
Gerrit-MessageType: newchange
--VdH33AM+W68=--