From ffa83be4f0397ee957fbf8dd22ee5d9a01bcc0dd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martti=20Rannanj=C3=A4rvi?=
 <martti.rannanjarvi@open-xchange.com>
Date: Tue, 1 Mar 2022 12:51:29 +0200
Subject: [PATCH] build-aux: run-test.sh.in - Capture exit codes before set -e
 ends the script

With set -e, the script ends on any nonzero exit code and that would
leave the valgrind output unchecked. Fix the exit code capture so
valgrind output is correctly shown.
---
 build-aux/run-test.sh.in | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/build-aux/run-test.sh.in b/build-aux/run-test.sh.in
index 3b58806e3..325bb4819 100644
--- a/build-aux/run-test.sh.in
+++ b/build-aux/run-test.sh.in
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-## serial 1
+## serial 2
 
 set -eu
 
@@ -36,12 +36,12 @@ else
   test_out="test.out~$$"
   trap "rm -f $test_out" 0 1 2 3 15
   supp_path="$top_srcdir/run-test-valgrind.supp"
+  ret=0
   if test -r "$supp_path"; then
-    $VALGRIND -q $trace_children --error-exitcode=213 --leak-check=full --gen-suppressions=all --suppressions="$supp_path" --log-file=$test_out $noundef "$@"
+    $VALGRIND -q $trace_children --error-exitcode=213 --leak-check=full --gen-suppressions=all --suppressions="$supp_path" --log-file=$test_out $noundef "$@" || ret=$?
   else
-    $VALGRIND -q $trace_children --error-exitcode=213 --leak-check=full --gen-suppressions=all --log-file=$test_out $noundef "$@"
+    $VALGRIND -q $trace_children --error-exitcode=213 --leak-check=full --gen-suppressions=all --log-file=$test_out $noundef "$@" || ret=$?
   fi
-  ret=$?
   if test -s $test_out; then
     cat $test_out
     ret=1
-- 
GitLab