-
Notifications
You must be signed in to change notification settings - Fork 8
/
run-valgrind-all
executable file
·74 lines (67 loc) · 1.73 KB
/
run-valgrind-all
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/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 <<EOF
{
uninteresting statx problem
Memcheck:Param
statx(file_name)
fun:syscall
fun:statx
fun:_ZN3std3sys4unix2fs9try_statx*
fun:_ZN3std3sys4unix2fs4stat*
}
{
uninteresting statx problem
Memcheck:Param
statx(buf)
fun:syscall
fun:statx
fun:_ZN3std3sys4unix2fs9try_statx*
fun:_ZN3std3sys4unix2fs4stat*
}
EOF
./run-feature-combinations | while read FEATURES
do
echo === $FEATURES
# Run cargo test twice. First builds and tests. Second skips the
# build (already done) and just runs the test under valgrind. We
# only want to valgrind the test, not all the build-related code.
cargo test --lib $FEATURES >/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