line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Tapper::Schema::TestrunDB::Result::ReportgroupTestrunStats; |
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TAPPER'; |
3
|
|
|
|
|
|
|
$Tapper::Schema::TestrunDB::Result::ReportgroupTestrunStats::VERSION = '5.0.9'; |
4
|
|
|
|
|
|
|
# ABSTRACT: Tapper - Containing additional aggregated data to testruns |
5
|
|
|
|
|
|
|
|
6
|
7
|
|
|
7
|
|
3119
|
use 5.010; |
|
7
|
|
|
|
|
19
|
|
7
|
7
|
|
|
7
|
|
24
|
use strict; |
|
7
|
|
|
|
|
9
|
|
|
7
|
|
|
|
|
116
|
|
8
|
7
|
|
|
7
|
|
21
|
use warnings; |
|
7
|
|
|
|
|
7
|
|
|
7
|
|
|
|
|
142
|
|
9
|
|
|
|
|
|
|
|
10
|
7
|
|
|
7
|
|
21
|
use parent 'DBIx::Class'; |
|
7
|
|
|
|
|
6
|
|
|
7
|
|
|
|
|
27
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
__PACKAGE__->load_components('Core'); |
13
|
|
|
|
|
|
|
__PACKAGE__->table('reportgrouptestrunstats'); |
14
|
|
|
|
|
|
|
__PACKAGE__->add_columns( |
15
|
|
|
|
|
|
|
'testrun_id', { |
16
|
|
|
|
|
|
|
data_type => 'INT', |
17
|
|
|
|
|
|
|
default_value => undef, |
18
|
|
|
|
|
|
|
is_nullable => 0, |
19
|
|
|
|
|
|
|
size => 11, |
20
|
|
|
|
|
|
|
is_foreign_key => 1, |
21
|
|
|
|
|
|
|
}, |
22
|
|
|
|
|
|
|
'total', { |
23
|
|
|
|
|
|
|
data_type => 'INT', |
24
|
|
|
|
|
|
|
default_value => undef, |
25
|
|
|
|
|
|
|
is_nullable => 1, |
26
|
|
|
|
|
|
|
size => 10, |
27
|
|
|
|
|
|
|
}, |
28
|
|
|
|
|
|
|
'failed', { |
29
|
|
|
|
|
|
|
data_type => 'INT', |
30
|
|
|
|
|
|
|
default_value => undef, |
31
|
|
|
|
|
|
|
is_nullable => 1, |
32
|
|
|
|
|
|
|
size => 10, |
33
|
|
|
|
|
|
|
}, |
34
|
|
|
|
|
|
|
'passed', { |
35
|
|
|
|
|
|
|
data_type => 'INT', |
36
|
|
|
|
|
|
|
default_value => undef, |
37
|
|
|
|
|
|
|
is_nullable => 1, |
38
|
|
|
|
|
|
|
size => 10, |
39
|
|
|
|
|
|
|
}, |
40
|
|
|
|
|
|
|
'parse_errors', { |
41
|
|
|
|
|
|
|
data_type => 'INT', |
42
|
|
|
|
|
|
|
default_value => undef, |
43
|
|
|
|
|
|
|
is_nullable => 1, |
44
|
|
|
|
|
|
|
size => 10, |
45
|
|
|
|
|
|
|
}, |
46
|
|
|
|
|
|
|
'skipped', { |
47
|
|
|
|
|
|
|
data_type => 'INT', |
48
|
|
|
|
|
|
|
default_value => undef, |
49
|
|
|
|
|
|
|
is_nullable => 1, |
50
|
|
|
|
|
|
|
size => 10, |
51
|
|
|
|
|
|
|
}, |
52
|
|
|
|
|
|
|
'todo', { |
53
|
|
|
|
|
|
|
data_type => 'INT', |
54
|
|
|
|
|
|
|
default_value => undef, |
55
|
|
|
|
|
|
|
is_nullable => 1, |
56
|
|
|
|
|
|
|
size => 10, |
57
|
|
|
|
|
|
|
}, |
58
|
|
|
|
|
|
|
'todo_passed', { |
59
|
|
|
|
|
|
|
data_type => 'INT', |
60
|
|
|
|
|
|
|
default_value => undef, |
61
|
|
|
|
|
|
|
is_nullable => 1, |
62
|
|
|
|
|
|
|
size => 10, |
63
|
|
|
|
|
|
|
}, |
64
|
|
|
|
|
|
|
'success_ratio', { |
65
|
|
|
|
|
|
|
data_type => 'VARCHAR', |
66
|
|
|
|
|
|
|
default_value => undef, |
67
|
|
|
|
|
|
|
is_nullable => 1, |
68
|
|
|
|
|
|
|
size => 20, |
69
|
|
|
|
|
|
|
}, |
70
|
|
|
|
|
|
|
); |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
__PACKAGE__->set_primary_key(qw/testrun_id/); |
73
|
|
|
|
|
|
|
__PACKAGE__->has_many( |
74
|
|
|
|
|
|
|
reportgrouptestruns => 'Tapper::Schema::TestrunDB::Result::ReportgroupTestrun', |
75
|
|
|
|
|
|
|
{ 'foreign.testrun_id' => 'self.testrun_id' }, |
76
|
|
|
|
|
|
|
{ cascade_delete => 0, cascade_copy => 0 }, |
77
|
|
|
|
|
|
|
); |
78
|
|
|
|
|
|
|
__PACKAGE__->has_one( |
79
|
|
|
|
|
|
|
testrun => 'Tapper::Schema::TestrunDB::Result::Testrun', |
80
|
|
|
|
|
|
|
{ 'foreign.id' => 'self.testrun_id' }, |
81
|
|
|
|
|
|
|
); |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
sub groupreports { |
86
|
1
|
|
|
1
|
1
|
4480
|
my ($self) = @_; |
87
|
|
|
|
|
|
|
|
88
|
1
|
|
|
|
|
21
|
$self->reportgrouptestruns->groupreports; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub _success_ratio |
93
|
|
|
|
|
|
|
{ |
94
|
0
|
|
|
0
|
|
|
my ($self) = @_; |
95
|
|
|
|
|
|
|
|
96
|
0
|
0
|
|
|
|
|
my $ratio = sprintf("%02.2f", $self->total ? ($self->passed / $self->total * 100) : 100 ); |
97
|
0
|
|
|
|
|
|
return $ratio; |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
sub success_word |
102
|
|
|
|
|
|
|
{ |
103
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
104
|
0
|
0
|
|
|
|
|
$self->success_ratio == 100 ? 'pass' : 'fail'; |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
sub update_failed_passed |
110
|
|
|
|
|
|
|
{ |
111
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
112
|
|
|
|
|
|
|
|
113
|
0
|
|
|
|
|
|
my $failed = 0; |
114
|
0
|
|
|
|
|
|
my $passed = 0; |
115
|
0
|
|
|
|
|
|
my $total = 0; |
116
|
0
|
|
|
|
|
|
my $parse_errors = 0; |
117
|
0
|
|
|
|
|
|
my $skipped = 0; |
118
|
0
|
|
|
|
|
|
my $todo = 0; |
119
|
0
|
|
|
|
|
|
my $todo_passed = 0; |
120
|
0
|
|
|
|
|
|
my $wait = 0; |
121
|
0
|
|
|
|
|
|
my $exit = 0; |
122
|
|
|
|
|
|
|
|
123
|
0
|
|
|
|
|
|
my $reports_rs = $self->groupreports; |
124
|
7
|
|
|
7
|
|
1997
|
no strict 'refs'; ## no critic (ProhibitNoStrict) |
|
7
|
|
|
|
|
10
|
|
|
7
|
|
|
|
|
750
|
|
125
|
0
|
|
|
|
|
|
my %sums = (); |
126
|
0
|
|
|
|
|
|
my @stat_fields = (qw/failed passed total parse_errors skipped todo todo_passed /); # no "exit" or "wait", that would create wrong SQL |
127
|
0
|
|
|
|
|
|
while (my $r = $reports_rs->next) { |
128
|
0
|
|
0
|
|
|
|
$sums{$_} += ($r->$_ // 0) foreach @stat_fields; |
129
|
|
|
|
|
|
|
} |
130
|
0
|
|
|
|
|
|
$self->$_($sums{$_}) foreach @stat_fields; |
131
|
0
|
|
|
|
|
|
$self->success_ratio( $self->_success_ratio ); |
132
|
0
|
|
|
|
|
|
return $self; |
133
|
|
|
|
|
|
|
} |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
1; |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
__END__ |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=pod |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=encoding UTF-8 |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=head1 NAME |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
Tapper::Schema::TestrunDB::Result::ReportgroupTestrunStats - Tapper - Containing additional aggregated data to testruns |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=head2 groupreports |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
Return all reports of this testrun report group. |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=head2 _success_ratio |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
Return this reports success ratio of passed vs. total. |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=head2 success_word |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
Reports overall success as a word - fail or pass. This word is always all |
158
|
|
|
|
|
|
|
lowercase. |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=head2 update_failed_passed |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
Update reportgroup details, eg. on incoming new reports of this group. |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=head1 AUTHORS |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=over 4 |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=item * |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
AMD OSRC Tapper Team <tapper@amd64.org> |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=item * |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
Tapper Team <tapper-ops@amazon.com> |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=back |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
This software is Copyright (c) 2017 by Advanced Micro Devices, Inc.. |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
This is free software, licensed under: |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
The (two-clause) FreeBSD License |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
=cut |