3 out_prefix
=$
(dirname "$0")/..
/test-results
/valgrind.out
11 # start outputting the current valgrind error in $out_prefix.++$count,
12 # and the test case which failed in the corresponding .message file
14 test -z "$output" ||
return
17 total_count
=$
(($total_count+1))
18 test -t 2 && printf "\rFound %d errors" $total_count >&2
21 output
=$out_prefix.
$count
24 echo "*** $1 ***" > $output.message
28 test ! -z "$output" ||
return
31 # if a test case has more than one valgrind error, we need to
32 # copy the last .message file to the previous errors
33 test -z "$missing_message" ||
{
34 while test $missing_message -lt $count
36 cp $out_prefix.
$count.message \
37 $out_prefix.
$missing_message.message
38 missing_message
=$
(($missing_message+1))
44 # group the valgrind errors by backtrace
49 while test $i -le $count
51 # output <number> <backtrace-in-one-line>
52 echo "$i $(tr '\n' ' ' < $out_prefix.$i)"
55 sort -t ' ' -k 2 |
# order by <backtrace-in-one-line>
56 while read number line
58 # find duplicates, do not output backtrace twice
59 if test "$line" != "$last_line"
63 printf "\nValgrind error $j:\n\n"
64 cat $out_prefix.
$number
65 printf "\nfound in:\n"
67 # print the test case where this came from
69 cat $out_prefix.
$number.message
79 # backtrace, possibly a new one
82 # Does the current valgrind error have a message yet?
85 test -z "$missing_message" &&
86 missing_message
=$count
90 start_output $
(basename $1)
92 sed 's/==[0-9]*==/==valgrind==/' >> $output
96 test -z "$output" ||
{
97 echo "$line" >> $output
98 test $output = ${output%.message} &&
99 output
=$output.message
106 # normal line; if $output is set, print the line
108 test -z "$output" ||
echo "$line" >> $output
118 for test_script
in "$(dirname "$0")"/..
/test-results
/*.out
120 handle_one
$test_script