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