line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Tapper::Reports::Web::Controller::Tapper::Testplan::Id; |
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TAPPER'; |
3
|
|
|
|
|
|
|
$Tapper::Reports::Web::Controller::Tapper::Testplan::Id::VERSION = '5.0.14'; |
4
|
10
|
|
|
10
|
|
6005
|
use parent 'Tapper::Reports::Web::Controller::Base'; |
|
10
|
|
|
|
|
33
|
|
|
10
|
|
|
|
|
70
|
|
5
|
|
|
|
|
|
|
|
6
|
10
|
|
|
10
|
|
825
|
use common::sense; |
|
10
|
|
|
|
|
30
|
|
|
10
|
|
|
|
|
107
|
|
7
|
|
|
|
|
|
|
## no critic (RequireUseStrict) |
8
|
10
|
|
|
10
|
|
594
|
use Tapper::Model 'model'; |
|
10
|
|
|
|
|
33
|
|
|
10
|
|
|
|
|
567
|
|
9
|
10
|
|
|
10
|
|
74
|
use Tapper::Reports::Web::Util::Testrun; |
|
10
|
|
|
|
|
23
|
|
|
10
|
|
|
|
|
375
|
|
10
|
|
|
|
|
|
|
|
11
|
10
|
|
|
10
|
|
83
|
use Data::DPath 'dpath'; |
|
10
|
|
|
|
|
32
|
|
|
10
|
|
|
|
|
108
|
|
12
|
10
|
|
|
10
|
|
3189
|
use File::Basename 'basename'; |
|
10
|
|
|
|
|
28
|
|
|
10
|
|
|
|
|
576
|
|
13
|
10
|
|
|
10
|
|
78
|
use YAML::Syck 'Load'; |
|
10
|
|
|
|
|
30
|
|
|
10
|
|
|
|
|
1253
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub auto :Private |
16
|
|
|
|
|
|
|
{ |
17
|
0
|
|
|
0
|
|
0
|
my ( $self, $c ) = @_; |
18
|
0
|
|
|
|
|
0
|
$c->forward('/tapper/testplan/id/prepare_navi'); |
19
|
10
|
|
|
10
|
|
94
|
} |
|
10
|
|
|
|
|
27
|
|
|
10
|
|
|
|
|
78
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub parse_testrun |
25
|
|
|
|
|
|
|
{ |
26
|
0
|
|
|
0
|
1
|
|
my ($self, $testrun) = @_; |
27
|
0
|
|
|
|
|
|
my $description = $testrun->{description}; |
28
|
0
|
|
|
|
|
|
my %testrun; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# several places for the root system |
31
|
0
|
|
|
|
|
|
push @{$testrun{image}}, dpath('/preconditions/*/mount[value eq "/"]/../image')->match($description); |
|
0
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
|
push @{$testrun{image}}, dpath('//root/precondition_type[value eq "autoinstall"]/../name')->match($description); |
|
0
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
push @{$testrun{image}}, dpath('//precondition_type[value eq "autoinstall"]/../name')->match($description); |
|
0
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
|
push @{$testrun{kernel}}, dpath('/preconditions/*/filename[ value =~ /linux-.*\d+.\d+/]')->match($description); |
|
0
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
|
push @{$testrun{test}}, |
37
|
0
|
0
|
|
|
|
|
map { $? ? basename($_) : () } |
|
0
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
dpath('/preconditions/*/precondition_type[ value eq "testprogram"]/../program')->match($description); |
39
|
0
|
|
|
|
|
|
$testrun{shortname} = $description->{shortname}; |
40
|
0
|
|
|
|
|
|
return \%testrun; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub gen_testplan_overview |
46
|
|
|
|
|
|
|
{ |
47
|
0
|
|
|
0
|
1
|
|
my ($self, $c, $yaml) = @_; |
48
|
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
|
my @plans; |
50
|
0
|
|
|
|
|
|
eval { |
51
|
0
|
|
|
|
|
|
@plans = Load($yaml); |
52
|
|
|
|
|
|
|
}; |
53
|
0
|
0
|
|
|
|
|
if ($@) { |
54
|
0
|
|
|
|
|
|
$c->stash->{error} = "Broken YAML in testplan: $@"; |
55
|
0
|
|
|
|
|
|
return []; |
56
|
|
|
|
|
|
|
} |
57
|
0
|
|
|
|
|
|
my @testplan_elements; |
58
|
|
|
|
|
|
|
|
59
|
0
|
|
|
|
|
|
foreach my $plan (@plans) { |
60
|
0
|
|
|
|
|
|
given ($plan->{type}) |
61
|
|
|
|
|
|
|
{ |
62
|
0
|
|
|
|
|
|
when(['multitest', 'testrun']) { push @testplan_elements, $self->parse_testrun($plan) } |
|
0
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
} |
65
|
0
|
|
|
|
|
|
return \@testplan_elements; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub index :Path :Args(1) |
71
|
|
|
|
|
|
|
{ |
72
|
0
|
|
|
0
|
1
|
0
|
my ( $self, $c, $instance_id ) = @_; |
73
|
|
|
|
|
|
|
|
74
|
0
|
|
|
|
|
0
|
$c->stash->{title} = "Testplan id $instance_id"; |
75
|
|
|
|
|
|
|
|
76
|
0
|
|
|
|
|
0
|
my $inst_res = model('TestrunDB')->resultset('TestplanInstance')->find($instance_id); |
77
|
0
|
0
|
|
|
|
0
|
if (not $inst_res) { |
78
|
0
|
|
|
|
|
0
|
$c->stash->{error} = "No testplan with id $instance_id"; |
79
|
0
|
|
|
|
|
0
|
return; |
80
|
|
|
|
|
|
|
} |
81
|
0
|
|
|
|
|
0
|
my $util = Tapper::Reports::Web::Util::Testrun->new(); |
82
|
0
|
|
|
|
|
0
|
my $testruns = $inst_res->testruns; |
83
|
0
|
|
|
|
|
0
|
my $testrunlist = $util->prepare_testrunlist($testruns); |
84
|
|
|
|
|
|
|
|
85
|
0
|
|
|
|
|
0
|
$c->stash->{instance}{id} = $inst_res->id; |
86
|
0
|
|
0
|
|
|
0
|
$c->stash->{instance}{name} = $inst_res->name || '[no name]'; |
87
|
0
|
|
|
|
|
0
|
$c->stash->{instance}{testruns} = $testrunlist; |
88
|
0
|
|
|
|
|
0
|
$c->stash->{instance}{plan} = $inst_res->evaluated_testplan; |
89
|
0
|
|
|
|
|
0
|
$c->stash->{instance}{plan} =~ s/^\n+//m; |
90
|
0
|
|
|
|
|
0
|
$c->stash->{instance}{plan} =~ s/\n+/\n/m; |
91
|
|
|
|
|
|
|
#$c->stash->{instance}{path} = $inst_res->path; |
92
|
|
|
|
|
|
|
#$c->stash->{instance}{overview} = $self->gen_testplan_overview($c, $c->stash->{instance}{plan}); |
93
|
0
|
|
|
|
|
0
|
$c->stash->{title} = "Testplan id $instance_id, ".$c->stash->{instance}{name}; |
94
|
0
|
|
|
|
|
0
|
return; |
95
|
10
|
|
|
10
|
|
140272
|
} |
|
10
|
|
|
|
|
29
|
|
|
10
|
|
|
|
|
61
|
|
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
sub prepare_navi :Private |
98
|
|
|
|
|
|
|
{ |
99
|
0
|
|
|
0
|
0
|
|
my ( $self, $c, $id ) = @_; |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
# When showing testplans by ID no filters are active so we |
102
|
|
|
|
|
|
|
# remove the wrong filters Testplan::prepare_navi already added |
103
|
0
|
|
|
|
|
|
my @navi = grep {$_->{title} ne "Active Filters"} @{$c->stash->{navi}}; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
104
|
0
|
|
|
|
|
|
$c->stash->{navi} = \@navi; |
105
|
|
|
|
|
|
|
|
106
|
0
|
|
|
|
|
|
push @{$c->stash->{navi}}, { title => 'Rerun this testplan', |
|
0
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
href => "/tapper/testplan/$id/rerun", |
108
|
|
|
|
|
|
|
confirm => 'Do you really want to RERUN this test plan?', |
109
|
|
|
|
|
|
|
}; |
110
|
0
|
|
|
|
|
|
push @{$c->stash->{navi}}, { title => 'Cancel this testplan', |
|
0
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
href => "/tapper/testplan/$id/cancel", |
112
|
|
|
|
|
|
|
confirm => 'Do you really want to CANCEL this testplan?', |
113
|
|
|
|
|
|
|
}; |
114
|
10
|
|
|
10
|
|
12965
|
} |
|
10
|
|
|
|
|
32
|
|
|
10
|
|
|
|
|
60
|
|
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
1; |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
__END__ |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=pod |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=encoding UTF-8 |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head1 NAME |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
Tapper::Reports::Web::Controller::Tapper::Testplan::Id |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head1 DESCRIPTION |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
Catalyst Controller. |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head2 parse_testrun |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
Generate an overview of a testplan element from testrun description. |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
@param hash ref - describes testrun |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
@return hash ref - overview of testrun |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=head2 gen_testplan_overview |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
Generate an overview from evaluated testplan. |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
@param string - plan as YAML text |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
@return array ref - overview of all testplan elements |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=head2 index |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=head1 NAME |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
Tapper::Reports::Web::Controller::Tapper::Testplan - Catalyst Controller for test plans |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=head1 METHODS |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=head2 index |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=head1 AUTHOR |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
AMD OSRC Tapper Team, C<< <tapper at amd64.org> >> |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=head1 LICENSE |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
This program is released under the following license: freebsd |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=head1 AUTHORS |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=over 4 |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=item * |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
AMD OSRC Tapper Team <tapper@amd64.org> |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=item * |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
Tapper Team <tapper-ops@amazon.com> |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=back |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
This software is Copyright (c) 2019 by Advanced Micro Devices, Inc.. |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
This is free software, licensed under: |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
The (two-clause) FreeBSD License |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
=cut |