2
# This program is free software; you can redistribute it and/or modify
3
# it under the terms of the GNU General Public License as published by
4
# the Free Software Foundation; version 2 of the License.
6
# This program is distributed in the hope that it will be useful, but
7
# WITHOUT ANY WARRANTY; without even the implied warranty of
8
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
9
# General Public License for more details.
11
# You should have received a copy of the GNU General Public License
12
# along with this program; if not, write to the Free Software
13
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
16
package GenTest::Reporter::ValgrindXMLErrors;
19
@ISA = qw(GenTest::Reporter);
23
use GenTest::Reporter;
24
use GenTest::Constants;
30
my $valgrind_xml_log = $reporter->serverVariable('datadir')."../log/valgrind.xml";
32
open (XML , $valgrind_xml_log);
33
read (XML, my $xml , -s $valgrind_xml_log);
35
my @errors = $xml =~ m{<error>(.*?)</error>}sgio;
36
my $valgrind_failure = 0;
38
foreach my $error (@errors) {
39
# We discard all failures that are mostly in InnoDB
40
# This allows ordinary debug builds that are compiled with valgrind suppressions to run RQG --valgrind-xml
41
my $innodb_mentions =~ m{(innodb|xtradb|plugin)}siog;
42
next if $innodb_mentions > 3;
44
my ($what) = $error =~ m{<what>(.*?)</what>}sio;
45
my ($top_file) = $error =~ m{<file>(.*?)</file>}sio;
46
my ($top_fn) = $error =~ m{<fn>(.*?)</fn>}sio;
47
my ($top_line) = $error =~ m{<line>(.*?)</line>}sio;
48
say("Valgrind: $what at $top_file:$top_line, function '$top_fn' . See log/valgrind.xml for further details.");
49
$valgrind_failure = 1;
52
if ($valgrind_failure) {
53
return STATUS_VALGRIND_FAILURE;
60
return REPORTER_TYPE_ALWAYS ;