valgrind --track-fds=yes might incorrectly report an error due to the use
of inherited file descriptors in check_native_core.

Prevent this false positive by temporarily removing "--track-fds=yes" from
$VALGRIND_CMD for the duration of the testrun in check_native_core.

Signed-off-by: Aaron Merey <ame...@redhat.com>
---
 tests/backtrace-subr.sh | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/tests/backtrace-subr.sh b/tests/backtrace-subr.sh
index b63e3814..0a5b38f8 100644
--- a/tests/backtrace-subr.sh
+++ b/tests/backtrace-subr.sh
@@ -187,7 +187,9 @@ check_native_core()
   fi
 
   if [ "x$SAVED_VALGRIND_CMD" != "x" ]; then
-    VALGRIND_CMD="$SAVED_VALGRIND_CMD"
+    # Restore $VALGRIND_CMD but disable --track-fds for the following testrun.
+    # Valgrind --track-fds might complain about an inherited fd.
+    VALGRIND_CMD=$(sed 's/--track-fds=yes//g' <<< "$SAVED_VALGRIND_CMD")
     export VALGRIND_CMD
   fi
 
@@ -195,6 +197,12 @@ check_native_core()
   # - see function check_err.
   tempfiles $core{,.{bt,err}}
   (set +ex; testrun ${abs_builddir}/backtrace -e ${abs_builddir}/$child 
--core=$core 1>$core.bt 2>$core.err; true)
+
+  if [ "x$SAVED_VALGRIND_CMD" != "x" ]; then
+    VALGRIND_CMD="$SAVED_VALGRIND_CMD"
+    export VALGRIND_CMD
+  fi
+
   cat $core.{bt,err}
   check_native_unsupported $core.err $child-$core
   check_all $core.{bt,err} $child-$core
-- 
2.48.1

Reply via email to