This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Tweak dual-life.t’s exceptions again
[perl5.git] / t / porting / dual-life.t
CommitLineData
ef9dbfd8 1#!/perl -w
52143fbb 2use 5.010;
ef9dbfd8
DG
3use strict;
4
5# This tests properties of dual-life modules:
6#
7# * Are all dual-life programs being generated in utils/?
8
5e515724
DG
9require './test.pl';
10
11plan('no_plan');
12
ef9dbfd8
DG
13use File::Basename;
14use File::Find;
15use File::Spec::Functions;
ef9dbfd8 16
7af59249
FC
17# Exceptions that are found in dual-life bin dirs but aren't
18# installed by default; some occur only during testing:
19my $not_installed = qr{^(?:
20 \.\./cpan/Encode/bin/u(?:cm(?:2table|lint|sort)|nidump)
21 |
374cf245 22 \.\./cpan/Module-Build/MB-[\w\d]+/Simple/bin/.*
7af59249 23)\z}ix;
52143fbb 24
cde5101a
NC
25my %dist_dir_exe;
26
27foreach (qw (podchecker podselect pod2usage)) {
28 $dist_dir_exe{lc "$_.PL"} = "../cpan/Pod-Parser/$_";
29};
bab7aada 30foreach (qw (pod2man pod2text)) {
2419ffa9 31 $dist_dir_exe{lc "$_.PL"} = "../cpan/podlators/$_";
bab7aada 32};
33c64ab2 33$dist_dir_exe{'pod2html.pl'} = '../ext/Pod-Html';
cde5101a 34
ef9dbfd8
DG
35my @programs;
36
37find(
38 sub {
39 my $name = $File::Find::name;
40 return if $name =~ /blib/;
b4836cca 41 return unless $name =~ m{/(?:bin|scripts?)/\S+\z} && $name !~ m{/t/};
ef9dbfd8
DG
42
43 push @programs, $name;
52143fbb 44 },
ef9dbfd8
DG
45 qw( ../cpan ../dist ../ext ),
46);
47
cde5101a
NC
48my $ext = $^O eq 'VMS' ? '.com' : '';
49
ef9dbfd8 50for my $f ( @programs ) {
01604df2 51 $f =~ s/\.\z// if $^O eq 'VMS';
7af59249 52 next if $f =~ $not_installed;
abace7e5
FC
53 my $bn = basename($f);
54 if(qr/\A(?i:$bn)\z/ ~~ %dist_dir_exe) {
55 ok( -f "$dist_dir_exe{lc $bn}$ext", "$f$ext");
cde5101a 56 } else {
abace7e5 57 ok( -f catfile('..', 'utils', "$bn$ext"), "$f$ext" );
cde5101a 58 }
ef9dbfd8
DG
59}
60