| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Tapper::Reports::Web::Controller::Tapper::Reports::Id; |
|
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TAPPER'; |
|
3
|
|
|
|
|
|
|
$Tapper::Reports::Web::Controller::Tapper::Reports::Id::VERSION = '5.0.13'; |
|
4
|
10
|
|
|
10
|
|
6258
|
use 5.010; |
|
|
10
|
|
|
|
|
25
|
|
|
5
|
10
|
|
|
10
|
|
54
|
use strict; |
|
|
10
|
|
|
|
|
16
|
|
|
|
10
|
|
|
|
|
216
|
|
|
6
|
10
|
|
|
10
|
|
32
|
use warnings; |
|
|
10
|
|
|
|
|
12
|
|
|
|
10
|
|
|
|
|
253
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
10
|
|
|
10
|
|
34
|
use Tapper::Reports::Web::Util::Report; |
|
|
10
|
|
|
|
|
11
|
|
|
|
10
|
|
|
|
|
191
|
|
|
9
|
10
|
|
|
10
|
|
36
|
use File::Basename; |
|
|
10
|
|
|
|
|
13
|
|
|
|
10
|
|
|
|
|
666
|
|
|
10
|
10
|
|
|
10
|
|
41
|
use File::stat; |
|
|
10
|
|
|
|
|
15
|
|
|
|
10
|
|
|
|
|
77
|
|
|
11
|
10
|
|
|
10
|
|
462
|
use parent 'Tapper::Reports::Web::Controller::Base'; |
|
|
10
|
|
|
|
|
15
|
|
|
|
10
|
|
|
|
|
77
|
|
|
12
|
10
|
|
|
10
|
|
4557
|
use YAML; |
|
|
10
|
|
|
|
|
59355
|
|
|
|
10
|
|
|
|
|
506
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
10
|
|
|
10
|
|
61
|
use Data::Dumper; |
|
|
10
|
|
|
|
|
15
|
|
|
|
10
|
|
|
|
|
394
|
|
|
15
|
10
|
|
|
10
|
|
42
|
use Data::DPath 'dpath'; |
|
|
10
|
|
|
|
|
16
|
|
|
|
10
|
|
|
|
|
90
|
|
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub younger |
|
18
|
|
|
|
|
|
|
{ |
|
19
|
0
|
|
|
0
|
|
0
|
my $astat = stat($a); |
|
20
|
0
|
|
|
|
|
0
|
my $bstat = stat($b); |
|
21
|
0
|
|
|
|
|
0
|
return $bstat->mtime() <=> $astat->mtime(); |
|
22
|
|
|
|
|
|
|
} |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub generate_metareport_link |
|
27
|
|
|
|
|
|
|
{ |
|
28
|
0
|
|
|
0
|
|
0
|
my ( $self, $report ) = @_; |
|
29
|
0
|
|
|
|
|
0
|
my %metareport; |
|
30
|
0
|
|
|
|
|
0
|
my $path = Tapper::Config->subconfig->{paths}{config_path}; |
|
31
|
0
|
|
|
|
|
0
|
$path .= "/web/metareport_associate.yml"; |
|
32
|
|
|
|
|
|
|
|
|
33
|
0
|
0
|
|
|
|
0
|
return if not -e $path; |
|
34
|
|
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
0
|
my $config; |
|
36
|
0
|
|
|
|
|
0
|
eval { |
|
37
|
0
|
|
|
|
|
0
|
$config = YAML::LoadFile($path); |
|
38
|
|
|
|
|
|
|
}; |
|
39
|
0
|
0
|
|
|
|
0
|
if ($@) { |
|
40
|
|
|
|
|
|
|
# TODO: Enable Log4perl |
|
41
|
|
|
|
|
|
|
# $self->log->error("Can not open association config for metareports: $@"); |
|
42
|
0
|
|
|
|
|
0
|
say STDERR "Can not open association config for metareports: $@"; |
|
43
|
0
|
|
|
|
|
0
|
return (); |
|
44
|
|
|
|
|
|
|
} |
|
45
|
10
|
|
|
10
|
|
3709
|
use Data::Dumper; |
|
|
10
|
|
|
|
|
17
|
|
|
|
10
|
|
|
|
|
399
|
|
|
46
|
0
|
|
|
|
|
0
|
my $suite; |
|
47
|
10
|
|
0
|
10
|
|
41
|
{ no warnings 'uninitialized'; $suite = $config->{suite}->{$report->{suite}} || $config->{suite}->{$report->{group_suite}};} |
|
|
10
|
|
|
|
|
14
|
|
|
|
10
|
|
|
|
|
9011
|
|
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
48
|
0
|
0
|
|
|
|
0
|
if ($suite) { |
|
49
|
0
|
|
|
|
|
0
|
my $category = $suite->{category}; |
|
50
|
0
|
|
|
|
|
0
|
my $subcategory = $suite->{subcategory}; |
|
51
|
0
|
|
|
|
|
0
|
my $time_frame = $suite->{time_frame}; |
|
52
|
|
|
|
|
|
|
|
|
53
|
0
|
|
|
|
|
0
|
$path = Tapper::Config->subconfig->{paths}{metareport_path}; |
|
54
|
0
|
|
|
|
|
0
|
my ($filename) = sort younger <$path/$category/$subcategory/teaser/*.png>; |
|
55
|
0
|
0
|
|
|
|
0
|
if (not $filename) { |
|
56
|
0
|
|
|
|
|
0
|
($filename) = sort younger <$path/$category/$subcategory/$time_frame/*.png>; |
|
57
|
0
|
|
|
|
|
0
|
$filename = "/tapper/static/metareports/$category/$subcategory/$time_frame/".basename($filename); |
|
58
|
|
|
|
|
|
|
} else { |
|
59
|
0
|
|
|
|
|
0
|
$filename = "/tapper/static/metareports/$category/$subcategory/teaser/".basename($filename); |
|
60
|
|
|
|
|
|
|
} |
|
61
|
0
|
0
|
|
|
|
0
|
return () if not $filename; |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
%metareport = (url => "/tapper/metareports/$category/$subcategory/$time_frame/", |
|
64
|
|
|
|
|
|
|
img => $filename, |
|
65
|
|
|
|
|
|
|
alt => $suite->{alt}, |
|
66
|
|
|
|
|
|
|
headline => $suite->{headline}, |
|
67
|
0
|
|
|
|
|
0
|
); |
|
68
|
|
|
|
|
|
|
} |
|
69
|
0
|
|
|
|
|
0
|
return %metareport; |
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
# get array of not_ok sub tests |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub get_report_failures |
|
75
|
|
|
|
|
|
|
{ |
|
76
|
1
|
|
|
1
|
|
1143717
|
my ($self, $report) = @_; |
|
77
|
|
|
|
|
|
|
|
|
78
|
1
|
|
|
|
|
7
|
return [ dpath('//tap//lines//is_ok[value eq 0]/..')->match($report->get_cached_tapdom) ]; |
|
79
|
|
|
|
|
|
|
} |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub index :Path :Args(1) |
|
82
|
|
|
|
|
|
|
{ |
|
83
|
0
|
|
|
0
|
|
0
|
my ( $self, $c, $report_id ) = @_; |
|
84
|
|
|
|
|
|
|
|
|
85
|
0
|
|
|
|
|
0
|
$c->stash->{failures} = {}; |
|
86
|
0
|
|
|
|
|
0
|
$c->stash->{reportlist_rga} = {}; |
|
87
|
0
|
|
|
|
|
0
|
$c->stash->{reportlist_rgt} = {}; |
|
88
|
0
|
|
|
|
|
0
|
$c->stash->{overview} = undef; |
|
89
|
0
|
|
|
|
|
0
|
$c->stash->{report} = $c->model('TestrunDB')->resultset('Report')->find($report_id); |
|
90
|
|
|
|
|
|
|
|
|
91
|
0
|
0
|
|
|
|
0
|
if (not $c->stash->{report}) { |
|
92
|
0
|
|
|
|
|
0
|
$c->response->body("No such report"); |
|
93
|
0
|
|
|
|
|
0
|
$c->stash->{title} = "No such report"; |
|
94
|
0
|
|
|
|
|
0
|
return; |
|
95
|
|
|
|
|
|
|
} |
|
96
|
|
|
|
|
|
|
|
|
97
|
0
|
0
|
|
|
|
0
|
if (not $c->stash->{report}->suite) { |
|
98
|
0
|
|
0
|
|
|
0
|
$c->response->body("No such testsuite with id: ". ($c->stash->{report}->suite_id // "")); |
|
99
|
0
|
|
|
|
|
0
|
$c->stash->{title} = "No such testsuite"; |
|
100
|
0
|
|
|
|
|
0
|
return; |
|
101
|
|
|
|
|
|
|
} |
|
102
|
|
|
|
|
|
|
|
|
103
|
0
|
|
|
|
|
0
|
my $suite_name = $c->stash->{report}->suite->name; |
|
104
|
0
|
|
|
|
|
0
|
my $machine_name = $c->stash->{report}->machine_name; |
|
105
|
0
|
|
|
|
|
0
|
$c->stash->{title} = "Report $report_id: $suite_name @ $machine_name"; |
|
106
|
|
|
|
|
|
|
|
|
107
|
0
|
|
|
|
|
0
|
my $util_report = Tapper::Reports::Web::Util::Report->new(); |
|
108
|
|
|
|
|
|
|
|
|
109
|
0
|
0
|
|
|
|
0
|
if (my $rga = $c->stash->{report}->reportgrouparbitrary) { |
|
110
|
|
|
|
|
|
|
#my $rga_reports = $c->model('TestrunDB')->resultset('ReportgroupArbitrary')->search ({ arbitrary_id => $rga->arbitrary_id }); |
|
111
|
0
|
|
|
|
|
0
|
my $rga_reports = $c->model('TestrunDB')->resultset('Report')->search |
|
112
|
|
|
|
|
|
|
( |
|
113
|
|
|
|
|
|
|
{ |
|
114
|
|
|
|
|
|
|
"reportgrouparbitrary.arbitrary_id" => $rga->arbitrary_id |
|
115
|
|
|
|
|
|
|
}, |
|
116
|
|
|
|
|
|
|
{ order_by => 'me.id desc', |
|
117
|
|
|
|
|
|
|
join => [ 'reportgrouparbitrary', 'reportgrouptestrun', 'suite'], |
|
118
|
|
|
|
|
|
|
'+select' => [ 'reportgrouparbitrary.arbitrary_id', 'reportgrouparbitrary.primaryreport', 'reportgrouptestrun.testrun_id', 'reportgrouptestrun.primaryreport', 'suite.id', 'suite.name', 'suite.type', 'suite.description' ], |
|
119
|
|
|
|
|
|
|
'+as' => [ 'rga_id', 'rga_primary', 'rgt_id', 'rgt_primary', 'suite_id', 'suite_name', 'suite_type', 'suite_description' ], |
|
120
|
|
|
|
|
|
|
} |
|
121
|
|
|
|
|
|
|
); |
|
122
|
0
|
|
|
|
|
0
|
$c->stash->{reportlist_rga} = $util_report->prepare_simple_reportlist($c, $rga_reports); |
|
123
|
|
|
|
|
|
|
|
|
124
|
0
|
|
|
|
|
0
|
$rga_reports->reset; |
|
125
|
0
|
|
|
|
|
0
|
while (my $r = $rga_reports->next) { |
|
126
|
0
|
0
|
|
|
|
0
|
if (my @report_failures = @{ $self->get_report_failures($r) }) { |
|
|
0
|
|
|
|
|
0
|
|
|
127
|
0
|
|
|
|
|
0
|
$c->stash->{failures}->{$r->id}{name} = $r->suite->name; |
|
128
|
0
|
|
|
|
|
0
|
$c->stash->{failures}->{$r->id}{machine_name} = $r->machine_name; |
|
129
|
0
|
|
|
|
|
0
|
push @{$c->stash->{failures}->{$r->id}{failures}}, @report_failures; |
|
|
0
|
|
|
|
|
0
|
|
|
130
|
|
|
|
|
|
|
} |
|
131
|
|
|
|
|
|
|
} |
|
132
|
|
|
|
|
|
|
} |
|
133
|
|
|
|
|
|
|
|
|
134
|
0
|
0
|
|
|
|
0
|
if (my $rgt = $c->stash->{report}->reportgrouptestrun) { |
|
135
|
|
|
|
|
|
|
#my $rgt_reports = $c->model('TestrunDB')->resultset('ReportgroupTestrun')->search ({ testrun_id => $rgt->testrun_id }); |
|
136
|
0
|
|
|
|
|
0
|
my $rgt_reports = $c->model('TestrunDB')->resultset('Report')->search |
|
137
|
|
|
|
|
|
|
( |
|
138
|
|
|
|
|
|
|
{ |
|
139
|
|
|
|
|
|
|
"reportgrouptestrun.testrun_id" => $rgt->testrun_id |
|
140
|
|
|
|
|
|
|
}, |
|
141
|
|
|
|
|
|
|
{ order_by => 'me.id desc', |
|
142
|
|
|
|
|
|
|
join => [ 'reportgrouparbitrary', 'reportgrouptestrun', 'suite'], |
|
143
|
|
|
|
|
|
|
'+select' => [ 'reportgrouparbitrary.arbitrary_id', 'reportgrouparbitrary.primaryreport', 'reportgrouptestrun.testrun_id', 'reportgrouptestrun.primaryreport', 'suite.name', 'suite.type', 'suite.description' ], |
|
144
|
|
|
|
|
|
|
'+as' => [ 'rga_id', 'rga_primary', 'rgt_id', 'rgt_primary', 'suite_name', 'suite_type', 'suite_description' ], |
|
145
|
|
|
|
|
|
|
} |
|
146
|
|
|
|
|
|
|
); |
|
147
|
0
|
|
|
|
|
0
|
$c->stash->{reportlist_rgt} = $util_report->prepare_simple_reportlist($c, $rgt_reports); |
|
148
|
|
|
|
|
|
|
|
|
149
|
0
|
|
|
|
|
0
|
$rgt_reports->reset; |
|
150
|
0
|
|
|
|
|
0
|
while (my $r = $rgt_reports->next) { |
|
151
|
0
|
0
|
|
|
|
0
|
if (my @report_failures = @{ $self->get_report_failures($r) }) { |
|
|
0
|
|
|
|
|
0
|
|
|
152
|
0
|
|
|
|
|
0
|
$c->stash->{failures}->{$r->id}{name} = $r->suite->name; |
|
153
|
0
|
|
|
|
|
0
|
$c->stash->{failures}->{$r->id}{machine_name} = $r->machine_name; |
|
154
|
0
|
|
|
|
|
0
|
push @{$c->stash->{failures}->{$r->id}{failures}}, @report_failures; |
|
|
0
|
|
|
|
|
0
|
|
|
155
|
|
|
|
|
|
|
} |
|
156
|
|
|
|
|
|
|
} |
|
157
|
|
|
|
|
|
|
|
|
158
|
0
|
|
|
|
|
0
|
my %cols = $rgt_reports->search({}, {rows => 1})->first->get_columns; |
|
159
|
0
|
|
|
|
|
0
|
my $testrun_id = $cols{rgt_id}; |
|
160
|
0
|
|
|
|
|
0
|
my $testrun; |
|
161
|
0
|
|
|
|
|
0
|
eval { |
|
162
|
0
|
|
|
|
|
0
|
$testrun = $c->model('TestrunDB')->resultset('Testrun')->find($testrun_id); |
|
163
|
|
|
|
|
|
|
}; |
|
164
|
0
|
|
|
|
|
0
|
$c->stash->{overview} = $c->forward('/tapper/testruns/get_testrun_overview', [ $testrun ]); |
|
165
|
|
|
|
|
|
|
} |
|
166
|
|
|
|
|
|
|
|
|
167
|
0
|
0
|
|
|
|
0
|
my $tmp = [ grep {defined($_->{rgt_primary}) and $_->{rgt_primary} == 1} @{$c->stash->{reportlist_rgt}->{all_reports}} ]->[0]->{suite_name}; |
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
168
|
0
|
0
|
|
|
|
0
|
my $report_data = {suite => $c->stash->{report}->suite ? $c->stash->{report}->suite->name : 'unknownsuite' , |
|
169
|
|
|
|
|
|
|
group_suite => $tmp}; |
|
170
|
|
|
|
|
|
|
|
|
171
|
0
|
0
|
|
|
|
0
|
unless (my @report_failures = @{$c->stash->{failures}->{$c->stash->{report}->id}{failures} || []}) { |
|
|
0
|
0
|
|
|
|
0
|
|
|
172
|
0
|
|
|
|
|
0
|
$c->stash->{failures}->{$c->stash->{report}->id}{name} = $c->stash->{report}->suite->name; |
|
173
|
0
|
|
|
|
|
0
|
$c->stash->{failures}->{$c->stash->{report}->id}{machine_name} = $c->stash->{report}->machine_name; |
|
174
|
0
|
|
|
|
|
0
|
push @{$c->stash->{failures}->{$c->stash->{report}->id}{failures}}, @report_failures; |
|
|
0
|
|
|
|
|
0
|
|
|
175
|
|
|
|
|
|
|
} |
|
176
|
0
|
|
|
|
|
0
|
%{$c->stash->{metareport}} = $self->generate_metareport_link($report_data); |
|
|
0
|
|
|
|
|
0
|
|
|
177
|
|
|
|
|
|
|
|
|
178
|
10
|
|
|
10
|
|
56
|
} |
|
|
10
|
|
|
|
|
14
|
|
|
|
10
|
|
|
|
|
85
|
|
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
1; |
|
181
|
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
__END__ |
|
183
|
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=pod |
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
=encoding UTF-8 |
|
187
|
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=head1 NAME |
|
189
|
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
Tapper::Reports::Web::Controller::Tapper::Reports::Id |
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=head2 generate_metareport_link |
|
193
|
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
Generate config for showing metareport image associated to given report. |
|
195
|
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
@param hash - config describing the relevant report |
|
197
|
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
@return success - hash containing (url, img, alt, headline) |
|
199
|
|
|
|
|
|
|
@return error - empty list |
|
200
|
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
=head1 AUTHORS |
|
202
|
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
=over 4 |
|
204
|
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
=item * |
|
206
|
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
AMD OSRC Tapper Team <tapper@amd64.org> |
|
208
|
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
=item * |
|
210
|
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
Tapper Team <tapper-ops@amazon.com> |
|
212
|
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
=back |
|
214
|
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
216
|
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
This software is Copyright (c) 2017 by Advanced Micro Devices, Inc.. |
|
218
|
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
This is free software, licensed under: |
|
220
|
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
The (two-clause) FreeBSD License |
|
222
|
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
=cut |