This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Pod::Parser is no longer customized in blead, since commit 534577b24e
[perl5.git] / t / porting / dual-life.t
1 #!/perl -w
2 use 5.010;
3 use strict;
4
5 # This tests properties of dual-life modules:
6 #
7 # * Are all dual-life programs being generated in utils/?
8
9 chdir 't';
10 require './test.pl';
11
12 use Config;
13 if ( $Config{usecrosscompile} ) {
14   skip_all( "Not all files are available during cross-compilation" );
15 }
16
17 plan('no_plan');
18
19 use File::Basename;
20 use File::Find;
21 use File::Spec::Functions;
22
23 # Exceptions that are found in dual-life bin dirs but aren't
24 # installed by default; some occur only during testing:
25 my $not_installed = qr{^(?:
26   \.\./cpan/Encode/bin/u(?:cm(?:2table|lint|sort)|nidump)
27    |
28   \.\./cpan/Module-(?:Metadata|Build)
29                                /MB-[\w\d]+/Simple/(?:test_install/)?bin/.*
30 )\z}ix;
31
32 my %dist_dir_exe;
33
34 $dist_dir_exe{lc "podselect.PL"} = "../cpan/Pod-Parser/podselect";
35 $dist_dir_exe{lc "podchecker.PL"} = "../cpan/Pod-Checker/podchecker";
36 $dist_dir_exe{lc "pod2usage.PL"} = "../cpan/Pod-Usage/pod2usage";
37
38 foreach (qw (pod2man pod2text)) {
39     $dist_dir_exe{lc "$_.PL"} = "../cpan/podlators/$_";
40 };
41 $dist_dir_exe{'pod2html.pl'} = '../ext/Pod-Html';
42
43 my @programs;
44
45 find(
46   { no_chdir => 1, wanted => sub {
47     my $name = $File::Find::name;
48     return if $name =~ /blib/;
49     return unless $name =~ m{/(?:bin|scripts?)/\S+\z} && $name !~ m{/t/};
50
51     push @programs, $name;
52   }},
53   qw( ../cpan ../dist ../ext ),
54 );
55
56 my $ext = $^O eq 'VMS' ? '.com' : '';
57
58 for my $f ( @programs ) {
59   $f =~ s/\.\z// if $^O eq 'VMS';
60   next if $f =~ $not_installed;
61   my $bn = basename($f);
62   if(grep { /\A(?i:$bn)\z/ } keys %dist_dir_exe) {
63     ok( -f "$dist_dir_exe{lc $bn}$ext", "$f$ext");
64   } else {
65     ok( -f catfile('..', 'utils', "$bn$ext"), "$f$ext" );
66   }
67 }
68