Browse Source

Calm old Valgrind ...

Valgrind 3.15.0 on Ubuntu 20.04 reports a false positive [0]

```
==7922== Conditional jump or move depends on uninitialised value(s)
==7922==    at 0x461F0C: s_decode_header (pem_ssh.c:316)
[...]
```

Simply suppress this false positive.

[0] https://github.com/libtom/libtomcrypt/actions/runs/6507805191/job/17676616149?pr=587

Signed-off-by: Steffen Jaeckel <[email protected]>
Steffen Jaeckel 2 years ago
parent
commit
7b5d85d735
2 changed files with 14 additions and 1 deletions
  1. 6 0
      .ci/Valgrind-Ubuntu_focal.supp
  2. 8 1
      .ci/valgrind.sh

+ 6 - 0
.ci/Valgrind-Ubuntu_focal.supp

@@ -0,0 +1,6 @@
+{
+   <s_decode_header>
+   Memcheck:Cond
+   ...
+   fun:s_decode_header
+}

+ 8 - 1
.ci/valgrind.sh

@@ -31,7 +31,14 @@ echo "Run tests with valgrind..."
 for i in `seq 1 10` ; do sleep 300 && echo "Valgrind tests in Progress..."; done &
 alive_pid=$!
 
-valgrind --error-exitcode=666 --leak-check=full --show-leak-kinds=all --errors-for-leak-kinds=all ./test >test_std.txt 2> >(tee -a test_err.txt >&2) || { kill $alive_pid; echo "Valgrind failed"; exit 1; }
+readonly VALGRIND_OPTS="--error-exitcode=666 --leak-check=full --show-leak-kinds=all --errors-for-leak-kinds=all"
+
+readonly distro="$(lsb_release -si)_$(lsb_release -sc)"
+readonly suppfile=".ci/Valgrind-${distro}.supp"
+function get_suppfile() { [ -f "$suppfile" ] && echo "--suppressions=$suppfile" || echo ""; }
+readonly VALGRIND_EXTRA_OPTS=$(get_suppfile)
+
+valgrind $VALGRIND_OPTS $VALGRIND_EXTRA_OPTS ./test >test_std.txt 2> >(tee -a test_err.txt >&2) || { kill $alive_pid; echo "Valgrind failed"; exit 1; }
 
 kill $alive_pid