| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Tapper::Reports::Web::Util::Testrun; |
|
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TAPPER'; |
|
3
|
|
|
|
|
|
|
$Tapper::Reports::Web::Util::Testrun::VERSION = '5.0.15'; |
|
4
|
11
|
|
|
11
|
|
81
|
use Moose; |
|
|
11
|
|
|
|
|
25
|
|
|
|
11
|
|
|
|
|
85
|
|
|
5
|
11
|
|
|
11
|
|
67110
|
use Tapper::Model 'model'; |
|
|
11
|
|
|
|
|
29
|
|
|
|
11
|
|
|
|
|
546
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
11
|
|
|
11
|
|
72
|
use common::sense; |
|
|
11
|
|
|
|
|
25
|
|
|
|
11
|
|
|
|
|
109
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
extends 'Tapper::Reports::Web::Util'; |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub prepare_testrunlist |
|
14
|
|
|
|
|
|
|
{ |
|
15
|
0
|
|
|
0
|
1
|
|
my ( $self, $testruns ) = @_; |
|
16
|
|
|
|
|
|
|
|
|
17
|
0
|
|
|
|
|
|
my @testruns; |
|
18
|
0
|
|
|
|
|
|
foreach my $testrun ($testruns->all) |
|
19
|
|
|
|
|
|
|
{ |
|
20
|
0
|
|
|
|
|
|
my $testrun_report = model('ReportsDB')->resultset('ReportgroupTestrunStats')->search({testrun_id => $testrun->id}, {rows => 1})->first; |
|
21
|
0
|
|
|
|
|
|
my ($primary_report, $suite_name, $updated_at, $primary_report_id); |
|
22
|
|
|
|
|
|
|
|
|
23
|
0
|
0
|
|
|
|
|
if ($testrun_report) { |
|
24
|
0
|
|
|
|
|
|
$primary_report = $testrun_report->reportgrouptestruns->search({primaryreport => 1}, {rows => 1})->first; |
|
25
|
0
|
0
|
|
|
|
|
$primary_report = $testrun_report->reportgrouptestruns->search({}, {rows => 1})->first unless $primary_report; # link to any report if no primary |
|
26
|
|
|
|
|
|
|
|
|
27
|
0
|
|
|
|
|
|
eval{ # prevent dereferencing to undefined db links |
|
28
|
0
|
0
|
|
|
|
|
if ($primary_report) { |
|
29
|
0
|
|
|
|
|
|
$suite_name = $primary_report->report->suite->name; |
|
30
|
0
|
|
0
|
|
|
|
$updated_at = $primary_report->report->updated_at || $primary_report->created_at; |
|
31
|
0
|
|
|
|
|
|
$primary_report_id = $primary_report->report->id; |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
}; |
|
34
|
|
|
|
|
|
|
} |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
|
37
|
0
|
|
|
|
|
|
my ($hostname, $status); |
|
38
|
0
|
0
|
|
|
|
|
if ($testrun->testrun_scheduling) { |
|
39
|
0
|
0
|
|
|
|
|
if ($testrun->testrun_scheduling->host) { |
|
40
|
0
|
|
|
|
|
|
$hostname = $testrun->testrun_scheduling->host->name; |
|
41
|
|
|
|
|
|
|
} else { |
|
42
|
0
|
0
|
|
|
|
|
$hostname = $testrun->testrun_scheduling->status eq 'finished' ? |
|
43
|
|
|
|
|
|
|
'Host deleted' : |
|
44
|
|
|
|
|
|
|
'No host assigned'; |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
} |
|
47
|
0
|
|
|
|
|
|
$status = $testrun->testrun_scheduling->status; |
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
|
|
50
|
0
|
0
|
0
|
|
|
|
my $tr = { |
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
51
|
|
|
|
|
|
|
testrun_id => $testrun->id, |
|
52
|
|
|
|
|
|
|
success_ratio => $testrun_report ? $testrun_report->success_ratio : 0, |
|
53
|
|
|
|
|
|
|
primary_report_id => $primary_report_id, |
|
54
|
|
|
|
|
|
|
topic_name => $testrun->topic_name, |
|
55
|
|
|
|
|
|
|
machine_name => $hostname || 'unknownmachine', |
|
56
|
|
|
|
|
|
|
status => $status || 'unknown status', |
|
57
|
|
|
|
|
|
|
started_at => $testrun->starttime_testrun, |
|
58
|
|
|
|
|
|
|
created_at => $testrun->created_at, |
|
59
|
|
|
|
|
|
|
updated_at => $updated_at || $testrun->updated_at, |
|
60
|
|
|
|
|
|
|
owner => $testrun->owner->login || 'unknown user' , |
|
61
|
|
|
|
|
|
|
}; |
|
62
|
0
|
|
|
|
|
|
push @testruns, $tr; |
|
63
|
|
|
|
|
|
|
} |
|
64
|
0
|
|
|
|
|
|
return \@testruns; |
|
65
|
|
|
|
|
|
|
} |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
1; |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
__END__ |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=pod |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=encoding UTF-8 |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 NAME |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Tapper::Reports::Web::Util::Testrun |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head2 prepare_testrunlist |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
For each of the given testruns generate a hash describing the |
|
83
|
|
|
|
|
|
|
testrun. This hash is used to display the testrun in the template. |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
hash contains: |
|
86
|
|
|
|
|
|
|
* primary_report_id |
|
87
|
|
|
|
|
|
|
* success_ratio |
|
88
|
|
|
|
|
|
|
* testrun_id |
|
89
|
|
|
|
|
|
|
* suite_name |
|
90
|
|
|
|
|
|
|
* host_name |
|
91
|
|
|
|
|
|
|
* status |
|
92
|
|
|
|
|
|
|
* created_at |
|
93
|
|
|
|
|
|
|
* updated_at |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
@param DBIC resultset - testruns |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
@return array ref - list of hash refs describing the testruns |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 AUTHORS |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=over 4 |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=item * |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
AMD OSRC Tapper Team <tapper@amd64.org> |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=item * |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
Tapper Team <tapper-ops@amazon.com> |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=back |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
This software is Copyright (c) 2020 by Advanced Micro Devices, Inc.. |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
This is free software, licensed under: |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
The (two-clause) FreeBSD License |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=cut |