| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
#!/usr/bin/perl -w |
|
2
|
|
|
|
|
|
|
# rocco // vim: ts=2 sw=2 expandtab |
|
3
|
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
4733
|
use strict; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
36
|
|
|
5
|
1
|
|
|
1
|
|
5
|
use File::Spec; |
|
|
1
|
|
|
|
|
6
|
|
|
|
1
|
|
|
|
|
24
|
|
|
6
|
1
|
|
|
1
|
|
7
|
use File::Path; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
127
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
BEGIN { |
|
9
|
1
|
|
|
1
|
|
50
|
eval "require POE::Test::Loops"; |
|
10
|
1
|
50
|
|
|
|
5320
|
if ($@) { |
|
11
|
0
|
|
|
|
|
0
|
warn "Could not load POE::Test::Loops. Skipping loop tests"; |
|
12
|
0
|
|
|
|
|
0
|
exit; |
|
13
|
|
|
|
|
|
|
} |
|
14
|
|
|
|
|
|
|
} |
|
15
|
|
|
|
|
|
|
|
|
16
|
1
|
|
|
|
|
129116
|
my $test_base = "t"; |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
### Resources, and their perl and XS implementations. |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
{ |
|
21
|
1
|
|
|
|
|
23
|
my $base_dir = File::Spec->catfile($test_base, "20_resources"); |
|
22
|
1
|
|
|
|
|
6
|
my $base_lib = File::Spec->catfile($base_dir, "00_base"); |
|
23
|
|
|
|
|
|
|
|
|
24
|
1
|
|
|
|
|
5
|
my %derived_conf = ( |
|
25
|
|
|
|
|
|
|
"10_perl" => { implementation => "perl" }, |
|
26
|
|
|
|
|
|
|
# TODO - Enable when an XS implementation arrives. |
|
27
|
|
|
|
|
|
|
# "20_xs" => { implementation => "xs" }, |
|
28
|
|
|
|
|
|
|
); |
|
29
|
|
|
|
|
|
|
|
|
30
|
1
|
|
|
|
|
1
|
my $source = ( |
|
31
|
|
|
|
|
|
|
"#!/usr/bin/perl -w\n" . |
|
32
|
|
|
|
|
|
|
"\n" . |
|
33
|
|
|
|
|
|
|
"use strict;\n" . |
|
34
|
|
|
|
|
|
|
"use lib qw(--base_lib--);\n" . |
|
35
|
|
|
|
|
|
|
"use Test::More;\n" . |
|
36
|
|
|
|
|
|
|
"\n" . |
|
37
|
|
|
|
|
|
|
"\$ENV{POE_IMPLEMENTATION} = '--implementation--';\n" . |
|
38
|
|
|
|
|
|
|
"\n" . |
|
39
|
|
|
|
|
|
|
"require '--base_file--';\n" . |
|
40
|
|
|
|
|
|
|
"\n" . |
|
41
|
|
|
|
|
|
|
"CORE::exit 0;\n" |
|
42
|
|
|
|
|
|
|
); |
|
43
|
|
|
|
|
|
|
|
|
44
|
1
|
|
|
|
|
5
|
derive_files( |
|
45
|
|
|
|
|
|
|
base_dir => $base_dir, |
|
46
|
|
|
|
|
|
|
base_lib => $base_lib, |
|
47
|
|
|
|
|
|
|
derived_conf => \%derived_conf, |
|
48
|
|
|
|
|
|
|
src_template => $source, |
|
49
|
|
|
|
|
|
|
); |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
### Event loops and the tests that love them. |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
{ |
|
55
|
1
|
|
|
|
|
3
|
my $base_dir = File::Spec->catfile($test_base, "30_loops"); |
|
|
1
|
|
|
|
|
5
|
|
|
|
1
|
|
|
|
|
20
|
|
|
56
|
|
|
|
|
|
|
|
|
57
|
1
|
|
|
|
|
3
|
my @loops = qw(Select IO::Poll); |
|
58
|
1
|
|
|
|
|
6
|
POE::Test::Loops::generate($base_dir, \@loops); |
|
59
|
|
|
|
|
|
|
} |
|
60
|
|
|
|
|
|
|
|
|
61
|
1
|
|
|
|
|
0
|
exit 0; |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub derive_files { |
|
64
|
1
|
|
|
1
|
|
5
|
my %conf = @_; |
|
65
|
|
|
|
|
|
|
|
|
66
|
1
|
|
|
|
|
3
|
my $base_dir = $conf{base_dir}; |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
# Gather the list of base files. Each will be used to generate a |
|
69
|
|
|
|
|
|
|
# real test file. |
|
70
|
|
|
|
|
|
|
|
|
71
|
1
|
50
|
|
|
|
76
|
opendir BASE, $conf{base_lib} or die $!; |
|
72
|
1
|
|
|
|
|
46
|
my @base_files = grep /\.pm$/, readdir(BASE); |
|
73
|
1
|
|
|
|
|
11
|
closedir BASE; |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
# Generate a set of test files for each configuration. |
|
76
|
|
|
|
|
|
|
|
|
77
|
1
|
|
|
|
|
2
|
foreach my $dst_dir (keys %{$conf{derived_conf}}) { |
|
|
1
|
|
|
|
|
4
|
|
|
78
|
1
|
|
|
|
|
7
|
my $full_dst = File::Spec->catfile($base_dir, $dst_dir); |
|
79
|
1
|
|
|
|
|
3
|
$full_dst =~ tr[/][/]s; |
|
80
|
1
|
|
|
|
|
5
|
$full_dst =~ s{/+$}{}; |
|
81
|
|
|
|
|
|
|
|
|
82
|
1
|
|
|
|
|
2
|
my %template_conf = %{$conf{derived_conf}{$dst_dir}}; |
|
|
1
|
|
|
|
|
3
|
|
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
# Blow away any previously generated test files. |
|
85
|
|
|
|
|
|
|
|
|
86
|
1
|
|
|
|
|
1374
|
rmtree($full_dst); |
|
87
|
1
|
|
|
|
|
226
|
mkpath($full_dst, 0, 0755); |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
# For each base file, generate a corresponding one in the |
|
90
|
|
|
|
|
|
|
# configured destination directory. Expand various bits to |
|
91
|
|
|
|
|
|
|
# customize the test. |
|
92
|
|
|
|
|
|
|
|
|
93
|
1
|
|
|
|
|
4
|
foreach my $base_file (@base_files) { |
|
94
|
9
|
|
|
|
|
92
|
my $full_file = File::Spec->catfile($full_dst, $base_file); |
|
95
|
9
|
|
|
|
|
40
|
$full_file =~ s/\.pm$/.t/; |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
# These hardcoded expansions are for the base file to be |
|
98
|
|
|
|
|
|
|
# required, and the base library directory where it'll be found. |
|
99
|
|
|
|
|
|
|
|
|
100
|
9
|
|
|
|
|
13
|
my $expanded_src = $conf{src_template}; |
|
101
|
9
|
|
|
|
|
24
|
$expanded_src =~ s/--base_file--/$base_file/g; |
|
102
|
9
|
|
|
|
|
37
|
$expanded_src =~ s/--base_lib--/$conf{base_lib}/g; |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
# The others are plugged in from the directory configuration. |
|
105
|
|
|
|
|
|
|
|
|
106
|
9
|
|
|
|
|
30
|
while (my ($key, $val) = each %template_conf) { |
|
107
|
9
|
|
|
|
|
55
|
$expanded_src =~ s/--\Q$key\E--/$val/g; |
|
108
|
|
|
|
|
|
|
} |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
# Write with lots of error checking. |
|
111
|
|
|
|
|
|
|
|
|
112
|
9
|
50
|
|
|
|
2169
|
open EXPANDED, ">$full_file" or die $!; |
|
113
|
9
|
|
|
|
|
71
|
print EXPANDED $expanded_src; |
|
114
|
9
|
50
|
|
|
|
337
|
close EXPANDED or die $!; |
|
115
|
|
|
|
|
|
|
} |
|
116
|
|
|
|
|
|
|
} |
|
117
|
|
|
|
|
|
|
} |