#!/bin/bash # Filters out non-stakker-related valgrind backtrace lines filter() { perl -e ' while (<>) { if (/ at 0x/) { print $_ if /stakker/; while (<>) { last unless / by 0x/; if (/stakker/) { print $_; } } print $_; } else { print $_; } }' } cat >tmp-valgrind-suppressions.txt </dev/null 2>&1 || { # If it fails, repeat and show output, then fail cargo test --lib $FEATURES 2>&1 echo FAILED exit 1 } # --log-file=log/valgrind_%p \ # --gen-suppressions=all \ # --show-leak-kinds=definite,indirect \ valgrind \ --tool=memcheck \ --trace-children=yes \ --leak-check=full \ --suppressions=tmp-valgrind-suppressions.txt \ --show-leak-kinds=definite \ --undef-value-errors=no \ cargo test --lib $FEATURES 2>&1 | filter done 2>&1 | tee tmp-valgrind.log rm tmp-valgrind-suppressions.txt echo "" echo "SUMMARY: (see tmp-valgrind.log for details)" fgrep definitely tmp-valgrind.log