line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Parser::lhcs_regression; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
Test::Parser::lhcs_regression - Perl module to parse output from runs of the |
6
|
|
|
|
|
|
|
Linux Hotplug CPU Support (lhcs_regression) testsuite. |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 SYNOPSIS |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
use Test::Parser::lhcs_regression; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
my $parser = new Test::Parser::LTP; |
13
|
|
|
|
|
|
|
$parser->parse($text); |
14
|
|
|
|
|
|
|
printf("Num Executed: %8d\n", $parser->num_executed()); |
15
|
|
|
|
|
|
|
printf("Num Passed: %8d\n", $parser->num_passed()); |
16
|
|
|
|
|
|
|
printf("Num Failed: %8d\n", $parser->num_failed()); |
17
|
|
|
|
|
|
|
printf("Num Skipped: %8d\n", $parser->num_skipped()); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
Additional information is available from the subroutines listed below |
20
|
|
|
|
|
|
|
and from the L baseclass. |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 DESCRIPTION |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
This module provides a way to extract information out of lhcs_regression test run |
25
|
|
|
|
|
|
|
output. |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 FUNCTIONS |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
Also see L for functions available from the base class. |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=cut |
32
|
|
|
|
|
|
|
|
33
|
1
|
|
|
1
|
|
19844
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
34
|
|
34
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
23
|
|
35
|
1
|
|
|
1
|
|
534
|
use Test::Parser; |
|
1
|
|
|
|
|
12
|
|
|
1
|
|
|
|
|
39
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
@Test::Parser::lhcs_regression::ISA = qw(Test::Parser); |
38
|
1
|
|
|
1
|
|
7
|
use base 'Test::Parser'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
205
|
|
39
|
|
|
|
|
|
|
|
40
|
1
|
|
|
|
|
5
|
use fields qw( |
41
|
|
|
|
|
|
|
_state |
42
|
1
|
|
|
1
|
|
5
|
); |
|
1
|
|
|
|
|
2
|
|
43
|
|
|
|
|
|
|
|
44
|
1
|
|
|
1
|
|
112
|
use vars qw( %FIELDS $AUTOLOAD $VERSION ); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
1045
|
|
45
|
|
|
|
|
|
|
our $VERSION = '1.7'; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head2 new() |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
Creates a new Test::Parser::lhcs_regression instance. |
50
|
|
|
|
|
|
|
Also calls the Test::Parser base class' new() routine. |
51
|
|
|
|
|
|
|
Takes no arguments. |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=cut |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub new { |
56
|
1
|
|
|
1
|
1
|
835
|
my $class = shift; |
57
|
1
|
|
|
|
|
6
|
my Test::Parser::lhcs_regression $self = fields::new($class); |
58
|
1
|
|
|
|
|
4064
|
$self->SUPER::new(); |
59
|
|
|
|
|
|
|
|
60
|
1
|
|
|
|
|
7
|
$self->name('lhcs_regression'); |
61
|
1
|
|
|
|
|
6
|
$self->type('standards'); |
62
|
|
|
|
|
|
|
|
63
|
1
|
|
|
|
|
2
|
$self->{num_passed} = 0; |
64
|
1
|
|
|
|
|
2
|
$self->{num_failed} = 0; |
65
|
1
|
|
|
|
|
2
|
$self->{num_skipped} = 0; |
66
|
|
|
|
|
|
|
|
67
|
1
|
|
|
|
|
4
|
return $self; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head3 |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Override of Test::Parser's default parse_line() routine to make it able |
73
|
|
|
|
|
|
|
to parse LTP output. |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
The lhcs_regression format is simple, with each test case issuing a status line of |
76
|
|
|
|
|
|
|
the form "foobar.42 PASS: Blah blah". A regular expression in this |
77
|
|
|
|
|
|
|
subroutine matches lines that look like that, increments the |
78
|
|
|
|
|
|
|
passed/failed/skipped count accordingly, puts the info in a hash and |
79
|
|
|
|
|
|
|
adds it to the testcases array. |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=cut |
82
|
|
|
|
|
|
|
sub parse_line { |
83
|
64
|
|
|
64
|
1
|
83
|
my $self = shift; |
84
|
64
|
|
|
|
|
80
|
my $line = shift; |
85
|
|
|
|
|
|
|
|
86
|
64
|
100
|
|
|
|
199
|
if ($line =~ /^([\w\.]+)\s+([A-Z]+):(.*)$/) { |
87
|
6
|
|
|
|
|
7
|
my $test; |
88
|
6
|
|
|
|
|
16
|
$test->{name} = $1; |
89
|
6
|
|
|
|
|
15
|
$test->{result} = $2; |
90
|
|
|
|
|
|
|
|
91
|
6
|
100
|
|
|
|
22
|
if ($test->{result} eq 'PASS') { |
|
|
50
|
|
|
|
|
|
92
|
1
|
|
|
|
|
1
|
$self->{num_passed}++; |
93
|
|
|
|
|
|
|
} elsif ($test->{result} eq 'FAIL') { |
94
|
5
|
|
|
|
|
10
|
$self->{num_failed}++; |
95
|
|
|
|
|
|
|
} else { |
96
|
0
|
|
|
|
|
0
|
$self->{num_skipped}++; |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
6
|
|
|
|
|
8
|
push @{$self->{testcases}}, $test; |
|
6
|
|
|
|
|
13
|
|
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
64
|
|
|
|
|
181
|
return 1; |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
1; |
106
|
|
|
|
|
|
|
__END__ |