This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
fix O_CREAT without O_TRUNC in cpan/autodie/t/utf8_open.t
[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
0c501878
CBW
28$dist_dir_exe{lc "podselect.PL"} = "../cpan/Pod-Parser/podselect";
29$dist_dir_exe{lc "podchecker.PL"} = "../cpan/Pod-Checker/podchecker";
30$dist_dir_exe{lc "pod2usage.PL"} = "../cpan/Pod-Usage/pod2usage";
31
bab7aada 32foreach (qw (pod2man pod2text)) {
2419ffa9 33 $dist_dir_exe{lc "$_.PL"} = "../cpan/podlators/$_";
bab7aada 34};
33c64ab2 35$dist_dir_exe{'pod2html.pl'} = '../ext/Pod-Html';
cde5101a 36
ef9dbfd8
DG
37my @programs;
38
39find(
6ec233a9 40 { no_chidr => 1, wanted => sub {
ef9dbfd8
DG
41 my $name = $File::Find::name;
42 return if $name =~ /blib/;
b4836cca 43 return unless $name =~ m{/(?:bin|scripts?)/\S+\z} && $name !~ m{/t/};
ef9dbfd8
DG
44
45 push @programs, $name;
6ec233a9 46 }},
ef9dbfd8
DG
47 qw( ../cpan ../dist ../ext ),
48);
49
cde5101a
NC
50my $ext = $^O eq 'VMS' ? '.com' : '';
51
ef9dbfd8 52for my $f ( @programs ) {
01604df2 53 $f =~ s/\.\z// if $^O eq 'VMS';
7af59249 54 next if $f =~ $not_installed;
abace7e5 55 my $bn = basename($f);
629deb58 56 if(grep { /\A(?i:$bn)\z/ } keys %dist_dir_exe) {
abace7e5 57 ok( -f "$dist_dir_exe{lc $bn}$ext", "$f$ext");
cde5101a 58 } else {
abace7e5 59 ok( -f catfile('..', 'utils', "$bn$ext"), "$f$ext" );
cde5101a 60 }
ef9dbfd8
DG
61}
62