| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Test::Parser::KernelBuild; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
Test::Parser::KernelBuild - Perl module to parse output from Linux kernel builds. |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use Test::Parser::KernelBuild; |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
my $parser = new Test::Parser::KernelBuild; |
|
12
|
|
|
|
|
|
|
$parser->parse($text); |
|
13
|
|
|
|
|
|
|
printf("Num Errors: %8d\n", $parser->num_errors()); |
|
14
|
|
|
|
|
|
|
printf("Num Warnings: %8d\n", $parser->num_warnings()); |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
Additional information is available from the subroutines listed below |
|
17
|
|
|
|
|
|
|
and from the L baseclass. |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
This module provides a way to extract information out of kernel builds, |
|
22
|
|
|
|
|
|
|
suitable for use in kernel test harnesses, similar to if you did `cat |
|
23
|
|
|
|
|
|
|
build.log | grep 'errors:' | wc -l`, except that this module also checks |
|
24
|
|
|
|
|
|
|
if the system is in the 'make config' or 'make bzImage' stages and skips |
|
25
|
|
|
|
|
|
|
any false positives that might be encountered there. |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 FUNCTIONS |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
Also see L for functions available from the base class. |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=cut |
|
32
|
|
|
|
|
|
|
|
|
33
|
2
|
|
|
2
|
|
32133
|
use strict; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
86
|
|
|
34
|
2
|
|
|
2
|
|
16
|
use warnings; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
81
|
|
|
35
|
2
|
|
|
2
|
|
682
|
use Test::Parser; |
|
|
2
|
|
|
|
|
15
|
|
|
|
2
|
|
|
|
|
123
|
|
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
@Test::Parser::KernelBuild::ISA = qw(Test::Parser); |
|
38
|
2
|
|
|
2
|
|
16
|
use base 'Test::Parser'; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
578
|
|
|
39
|
|
|
|
|
|
|
|
|
40
|
2
|
|
|
|
|
35
|
use fields qw( |
|
41
|
|
|
|
|
|
|
_state |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
states |
|
44
|
|
|
|
|
|
|
make_targets |
|
45
|
|
|
|
|
|
|
config_file |
|
46
|
2
|
|
|
2
|
|
11
|
); |
|
|
2
|
|
|
|
|
3
|
|
|
47
|
|
|
|
|
|
|
|
|
48
|
2
|
|
|
2
|
|
161
|
use vars qw( %FIELDS $AUTOLOAD $VERSION ); |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
1230
|
|
|
49
|
|
|
|
|
|
|
our $VERSION = '1.7'; |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head2 new() |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Creates a new Test::Parser::KernelBuild instance. |
|
54
|
|
|
|
|
|
|
Also calls the Test::Parser base class' new() routine. |
|
55
|
|
|
|
|
|
|
Takes no arguments. |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=cut |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub new { |
|
60
|
1
|
|
|
1
|
1
|
898
|
my $class = shift; |
|
61
|
1
|
|
|
|
|
6
|
my Test::Parser::KernelBuild $self = fields::new($class); |
|
62
|
1
|
|
|
|
|
4608
|
$self->SUPER::new(); |
|
63
|
|
|
|
|
|
|
|
|
64
|
1
|
|
|
|
|
4
|
return $self; |
|
65
|
|
|
|
|
|
|
} |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head3 make_targets() |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Returns a list of the different targets that were built by make. |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=cut |
|
72
|
|
|
|
|
|
|
sub make_targets { |
|
73
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
74
|
0
|
|
|
|
|
0
|
return $self->{make_targets}; |
|
75
|
|
|
|
|
|
|
} |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head3 config_file() |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
Returns the name of the kernel .config file used, if any |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=cut |
|
82
|
|
|
|
|
|
|
sub config_file { |
|
83
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
84
|
0
|
|
|
|
|
0
|
return $self->{config_file}; |
|
85
|
|
|
|
|
|
|
} |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head3 states() |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
Returns a list of the various steps in the build process (e.g. config, |
|
90
|
|
|
|
|
|
|
make, modules_install, etc.) |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=cut |
|
93
|
|
|
|
|
|
|
sub states { |
|
94
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
95
|
0
|
|
|
|
|
0
|
return $self->{states}; |
|
96
|
|
|
|
|
|
|
} |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head3 |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
Override of Test::Parser's default parse_line() routine to make it able |
|
101
|
|
|
|
|
|
|
to parse kernel build logs. |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=cut |
|
104
|
|
|
|
|
|
|
sub parse_line { |
|
105
|
2878
|
|
|
2878
|
1
|
3575
|
my $self = shift; |
|
106
|
2878
|
|
|
|
|
3810
|
my $line = shift; |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
# Determine if we're changing states... |
|
109
|
2878
|
100
|
|
|
|
9159
|
if ($line =~ /^make .*?config/) { |
|
|
|
100
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
110
|
1
|
|
|
|
|
4
|
$self->{_state} = 'config'; |
|
111
|
1
|
|
|
|
|
2
|
push @{$self->{states}}, $self->{_state}; |
|
|
1
|
|
|
|
|
5
|
|
|
112
|
|
|
|
|
|
|
} |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
elsif ($line =~ /^make bzImage/) { |
|
115
|
1
|
|
|
|
|
3
|
$self->{_state} = 'image'; |
|
116
|
1
|
|
|
|
|
3
|
push @{$self->{states}}, $self->{_state}; |
|
|
1
|
|
|
|
|
3
|
|
|
117
|
|
|
|
|
|
|
} |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
elsif ($line =~ /^make /) { |
|
120
|
2
|
|
|
|
|
8
|
$self->{_state} = 'build'; |
|
121
|
2
|
|
|
|
|
7
|
push @{$self->{states}}, $self->{_state}; |
|
|
2
|
|
|
|
|
8
|
|
|
122
|
|
|
|
|
|
|
} |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
# Get the config file name, if one is used |
|
125
|
2878
|
100
|
66
|
|
|
11039
|
if ($line =~ /^Using default config file '(.+)'$/ && ! defined($self->{config_file})) { |
|
|
|
100
|
|
|
|
|
|
|
126
|
1
|
|
|
|
|
4
|
$self->{config_file} = $1; |
|
127
|
|
|
|
|
|
|
} |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
# Conduct the output parsing |
|
130
|
|
|
|
|
|
|
elsif ($self->{_state} eq 'build') { |
|
131
|
|
|
|
|
|
|
# Gets CC, LD, CHK, etc. |
|
132
|
1477
|
100
|
|
|
|
4425
|
if ($line =~ /^\s\s([A-Z]+) /) { |
|
|
|
50
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
133
|
1438
|
|
|
|
|
2823
|
$self->{make_targets}->{$1}++; |
|
134
|
|
|
|
|
|
|
} |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
elsif ($line =~ /error\:/) { |
|
137
|
0
|
|
|
|
|
0
|
push @{$self->{errors}}, $_; |
|
|
0
|
|
|
|
|
0
|
|
|
138
|
|
|
|
|
|
|
} |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
elsif ($line =~ /warning\:/) { |
|
141
|
19
|
|
|
|
|
21
|
push @{$self->{warnings}}, $_; |
|
|
19
|
|
|
|
|
77
|
|
|
142
|
|
|
|
|
|
|
} |
|
143
|
|
|
|
|
|
|
} |
|
144
|
|
|
|
|
|
|
|
|
145
|
2878
|
|
|
|
|
8201
|
return 1; |
|
146
|
|
|
|
|
|
|
} |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
1; |
|
149
|
|
|
|
|
|
|
__END__ |