[Openvpn-devel,v2] t_server_null: persist test log files

Message ID 20241024133220.4864-1-gert@greenie.muc.de
State Accepted
Headers show
Series [Openvpn-devel,v2] t_server_null: persist test log files | expand

Commit Message

Gert Doering Oct. 24, 2024, 1:32 p.m. UTC
From: Samuli Seppänen <samuli.seppanen@gmail.com>

The goal is to help debug issues with t_server_null. The immediate goal
is to be able to debug server startup issues encountered on some of the
*BSD platforms.

Change-Id: I49f1e7d25edb62bf202ffceb45dedc213f2eafdd
Signed-off-by: Samuli Seppänen <samuli.seppanen@gmail.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
---

This change was reviewed on Gerrit and approved by at least one
developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/776
This mail reflects revision 2 of this Change.

Acked-by according to Gerrit (reflected above):
Gert Doering <gert@greenie.muc.de>

Comments

Gert Doering Oct. 24, 2024, 5:50 p.m. UTC | #1
Stared at the changes, and had a look at what the buildbots produced,
and that is now all nicely in a subdirectory (= not overwritten by
the next BB run, which made figuring out why certain runs failed 
highly annoying).

Eventually we'll need to add a cleanup job in the BB infra now... ;-)

Your patch has been applied to the master branch.

(URL is only half-useful in the commit, because mail-archive refuses to
acknowledge receipt of the mail in question - I've added the gerrit URL)

commit a3a4844a3c558eeba31f45b5a4ddcdd8b76ab897
Author: Samuli Seppänen
Date:   Thu Oct 24 15:32:17 2024 +0200

     t_server_null: persist test log files

     Signed-off-by: Samuli Seppänen <samuli.seppanen@gmail.com>
     Acked-by: Gert Doering <gert@greenie.muc.de>
     Message-Id: <20241024133220.4864-1-gert@greenie.muc.de>
     URL: https://www.mail-archive.com/search?l=mid&q=20241024133220.4864-1-gert@greenie.muc.de
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering

Patch

diff --git a/tests/t_server_null.sh b/tests/t_server_null.sh
index 7627edf..61a9cdc 100755
--- a/tests/t_server_null.sh
+++ b/tests/t_server_null.sh
@@ -56,11 +56,16 @@ 
 fi
 
 srcdir="${srcdir:-.}"
+export t_server_null_logdir=t_server_null-`hostname`-`date +%Y%m%d-%H%M%S`
+
+# Create directory for server and client logs
+mkdir $t_server_null_logdir
 
 "${srcdir}/t_server_null_server.sh" &
 "${srcdir}/t_server_null_client.sh"
 retval=$?
 
+
 # When running make jobs in parallel ("make -j<x> check") we need to ensure
 # 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 because
diff --git a/tests/t_server_null_client.sh b/tests/t_server_null_client.sh
index c1a25df..846f790 100755
--- a/tests/t_server_null_client.sh
+++ b/tests/t_server_null_client.sh
@@ -14,7 +14,7 @@ 
         $client_conf \
         --writepid "${pid}" \
         --setenv pid $pid \
-        --log "${log}" &
+        --log "${t_server_null_logdir}/${log}" &
 }
 
 wait_for_results() {
@@ -44,7 +44,7 @@ 
     should_pass=$2
     log="${test_name}.log"
 
-    grep "Initialization Sequence Completed" "${log}" > /dev/null
+    grep "Initialization Sequence Completed" "${t_server_null_logdir}/${log}" > /dev/null
     exit_code=$?
 
     if [ $exit_code -eq 0 ] && [ "${should_pass}" = "yes" ]; then
diff --git a/tests/t_server_null_server.sh b/tests/t_server_null_server.sh
index 10bb44b..f8ba3a3 100755
--- a/tests/t_server_null_server.sh
+++ b/tests/t_server_null_server.sh
@@ -4,12 +4,11 @@ 
     server_name=$1
     server_exec=$2
     server_conf=$3
-    log="${server_name}.log"
+    log="${t_server_null_logdir}/${server_name}.log"
     status="${server_name}.status"
     pid="${server_name}.pid"
 
     if [ -z "${RUN_SUDO}" ]; then
-        rm -f "${status}" "${log}" "${pid}"
         "${server_exec}" \
          $server_conf \
          --status "${status}" 1 \
@@ -17,7 +16,6 @@ 
          --writepid "${pid}" \
          --explicit-exit-notify 3
     else
-        $RUN_SUDO rm -f "${status}" "${log}" "${pid}"
         $RUN_SUDO "${server_exec}" \
                    $server_conf \
                    --status "${status}" 1 \