3 # Get TEST_OUTPUT_DIRECTORY from GIT-BUILD-OPTIONS if it's there...
4 .
"$(dirname "$0")/../../GIT-BUILD-OPTIONS"
5 # ... otherwise set it to the default value.
6 : ${TEST_OUTPUT_DIRECTORY=$(dirname "$0")/..}
15 # start outputting the current valgrind error in $out_prefix.++$count,
16 # and the test case which failed in the corresponding .message file
18 test -z "$output" ||
return
21 total_count
=$
(($total_count+1))
22 test -t 2 && printf "\rFound %d errors" $total_count >&2
25 output
=$out_prefix.
$count
28 echo "*** $1 ***" > $output.message
32 test ! -z "$output" ||
return
35 # if a test case has more than one valgrind error, we need to
36 # copy the last .message file to the previous errors
37 test -z "$missing_message" ||
{
38 while test $missing_message -lt $count
40 cp $out_prefix.
$count.message \
41 $out_prefix.
$missing_message.message
42 missing_message
=$
(($missing_message+1))
48 # group the valgrind errors by backtrace
53 while test $i -le $count
55 # output <number> <backtrace-in-one-line>
56 echo "$i $(tr '\n' ' ' < $out_prefix.$i)"
59 sort -t ' ' -k 2 |
# order by <backtrace-in-one-line>
60 while read number line
62 # find duplicates, do not output backtrace twice
63 if test "$line" != "$last_line"
67 printf "\nValgrind error $j:\n\n"
68 cat $out_prefix.
$number
69 printf "\nfound in:\n"
71 # print the test case where this came from
73 cat $out_prefix.
$number.message
83 # backtrace, possibly a new one
86 # Does the current valgrind error have a message yet?
89 test -z "$missing_message" &&
90 missing_message
=$count
94 start_output $
(basename $1)
96 sed 's/==[0-9]*==/==valgrind==/' >> $output
100 test -z "$output" ||
{
101 echo "$line" >> $output
102 test $output = ${output%.message} &&
103 output
=$output.message
110 # normal line; if $output is set, print the line
112 test -z "$output" ||
echo "$line" >> $output
122 for test_script
in "$TEST_OUTPUT_DIRECTORY"/test-results
/*.out
124 handle_one
$test_script