2 # Buildfarm output for selftest
3 # Copyright (C) 2008 Jelmer Vernooij <jelmer@samba.org>
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 package output::buildfarm;
23 use FindBin qw($RealBin);
24 use lib "$RealBin/..";
26 use Subunit qw(parse_results);
43 my ($self, $time) = @_;
45 unless ($self->{start_time}) {
46 $self->{start_time} = $time;
49 $self->{last_time} = $time;
52 sub start_testsuite($$)
54 my ($self, $name) = @_;
56 $self->{NAME} = $name;
57 $self->{START_TIME} = $self->{last_time};
59 my $duration = $self->{START_TIME} - $self->{start_time};
60 BuildFarm::start_testsuite($name, $duration);
61 $self->{test_output}->{$name} = "";
66 my ($self, $output) = @_;
68 $self->{test_output}->{$self->{NAME}} .= $output;
73 my ($self, $output) = @_;
75 $self->{test_output}->{$self->{NAME}} .= $output;
78 sub end_testsuite($$$$$$)
80 my ($self, $name, $result, $unexpected, $reason) = @_;
82 BuildFarm::end_testsuite($name, ($self->{last_time} - $self->{START_TIME}),
83 (not $unexpected), $self->{test_output}->{$name},
89 my ($self, $parents, $testname) = @_;
91 if ($#$parents == -1) {
92 $self->start_testsuite($testname);
98 my ($self, $parents, $testname, $result, $unexpected, $reason) = @_;
101 $self->{test_output}->{$self->{NAME}} .= "UNEXPECTED($result): $testname\n";
104 if ($#$parents == -1) {
105 $self->end_testsuite($testname, $result, $unexpected, $reason);
113 BuildFarm::summary($self->{last_time} - $self->{start_time});
116 sub skip_testsuite($$$)
118 my ($self, $name, $reason) = @_;
120 BuildFarm::skip_testsuite($name);