line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Alien::Diag; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
210058
|
use strict; |
|
2
|
|
|
|
|
14
|
|
|
2
|
|
|
|
|
57
|
|
4
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
57
|
|
5
|
2
|
|
|
2
|
|
56
|
use 5.008004; |
|
2
|
|
|
|
|
6
|
|
6
|
2
|
|
|
2
|
|
12
|
use Test2::API qw( context ); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
120
|
|
7
|
2
|
|
|
2
|
|
10
|
use Exporter qw( import ); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
832
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our @EXPORT = qw( alien_diag ); |
10
|
|
|
|
|
|
|
our @EXPORT_OK = @EXPORT; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# ABSTRACT: Print out standard diagnostic for Aliens in the test step. |
13
|
|
|
|
|
|
|
our $VERSION = '2.47'; # VERSION |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub alien_diag ($@) |
17
|
|
|
|
|
|
|
{ |
18
|
2
|
|
|
2
|
1
|
51486
|
my $ctx = context(); |
19
|
|
|
|
|
|
|
|
20
|
2
|
|
|
|
|
145
|
my $max = 0; |
21
|
2
|
|
|
|
|
6
|
foreach my $alien (@_) |
22
|
|
|
|
|
|
|
{ |
23
|
2
|
|
|
|
|
7
|
foreach my $name (qw( cflags cflags_static libs libs_static version install_type dynamic_libs bin_dir )) |
24
|
|
|
|
|
|
|
{ |
25
|
16
|
|
|
|
|
27
|
my $str = "$alien->$name"; |
26
|
16
|
100
|
|
|
|
33
|
if(length($str) > $max) |
27
|
|
|
|
|
|
|
{ |
28
|
4
|
|
|
|
|
7
|
$max = length($str); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
34
|
2
|
|
|
|
|
11
|
$ctx->diag(''); |
35
|
2
|
|
|
|
|
594
|
foreach my $alien (@_) { |
36
|
2
|
|
|
|
|
15
|
$ctx->diag('') for 1..2; |
37
|
|
|
|
|
|
|
|
38
|
2
|
|
|
|
|
632
|
my $found = 0; |
39
|
|
|
|
|
|
|
|
40
|
2
|
|
|
|
|
7
|
foreach my $name (qw( cflags cflags_static libs libs_static version install_type )) |
41
|
|
|
|
|
|
|
{ |
42
|
12
|
100
|
|
|
|
482
|
if(eval { $alien->can($name) }) |
|
12
|
|
|
|
|
92
|
|
43
|
|
|
|
|
|
|
{ |
44
|
4
|
|
|
|
|
6
|
$found++; |
45
|
4
|
|
|
|
|
33
|
$ctx->diag(sprintf "%-${max}s = %s", "$alien->$name", $alien->$name); |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
2
|
|
|
|
|
153
|
foreach my $name (qw( dynamic_libs bin_dir )) |
50
|
|
|
|
|
|
|
{ |
51
|
4
|
100
|
|
|
|
464
|
if(eval { $alien->can($name) }) |
|
4
|
|
|
|
|
37
|
|
52
|
|
|
|
|
|
|
{ |
53
|
2
|
|
|
|
|
6
|
$found++; |
54
|
2
|
|
|
|
|
3
|
my @list = eval { $alien->$name }; |
|
2
|
|
|
|
|
38
|
|
55
|
2
|
50
|
|
|
|
14
|
next if $@; |
56
|
2
|
|
|
|
|
15
|
$ctx->diag(sprintf "%-${max}s = %s", "$alien->$name", $_) for @list; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
2
|
100
|
|
|
|
159
|
$ctx->diag("no diagnostics found for $alien") unless $found; |
61
|
|
|
|
|
|
|
|
62
|
2
|
|
|
|
|
188
|
$ctx->diag('') for 1..2; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
2
|
|
|
|
|
614
|
$ctx->release; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
1; |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
__END__ |