~ubuntu-branches/ubuntu/trusty/drizzle/trusty

« back to all changes in this revision

Viewing changes to tests/randgen/lib/GenTest/Reporter/ValgrindXMLErrors.pm

  • Committer: Package Import Robot
  • Author(s): Dmitrijs Ledkovs
  • Date: 2013-10-29 15:43:40 UTC
  • mfrom: (1.2.12) (2.1.19 trusty-proposed)
  • Revision ID: package-import@ubuntu.com-20131029154340-2gp39el6cv8bwf2o
Tags: 1:7.2.3-2ubuntu1
* Merge from debian, remaining changes:
  - Link against boost_system because of boost_thread.
  - Add required libs to message/include.am
  - Add upstart job and adjust init script to be upstart compatible.
  - Disable -floop-parallelize-all due to gcc-4.8/4.9 compiler ICE
    http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57732

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#
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.
5
 
#
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.
10
 
#
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
14
 
# USA
15
 
 
16
 
package GenTest::Reporter::ValgrindXMLErrors;
17
 
 
18
 
require Exporter;
19
 
@ISA = qw(GenTest::Reporter);
20
 
 
21
 
use strict;
22
 
use GenTest;
23
 
use GenTest::Reporter;
24
 
use GenTest::Constants;
25
 
 
26
 
sub report {
27
 
 
28
 
        my $reporter = shift;
29
 
 
30
 
        my $valgrind_xml_log = $reporter->serverVariable('datadir')."../log/valgrind.xml";
31
 
 
32
 
        open (XML , $valgrind_xml_log);
33
 
        read (XML, my $xml , -s $valgrind_xml_log);
34
 
 
35
 
        my @errors = $xml =~ m{<error>(.*?)</error>}sgio;
36
 
        my $valgrind_failure = 0;
37
 
 
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;
43
 
 
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;
50
 
        }
51
 
 
52
 
        if ($valgrind_failure) {
53
 
                return STATUS_VALGRIND_FAILURE;
54
 
        } else {
55
 
                return STATUS_OK;
56
 
        }
57
 
}
58
 
 
59
 
sub type {
60
 
        return REPORTER_TYPE_ALWAYS ;
61
 
}
62
 
 
63
 
1;