xref: /openbsd/gnu/usr.bin/perl/t/porting/dual-life.t (revision 91f110e0)
1#!/perl -w
2use 5.010;
3use strict;
4
5# This tests properties of dual-life modules:
6#
7# * Are all dual-life programs being generated in utils/?
8
9chdir 't';
10require './test.pl';
11
12plan('no_plan');
13
14use File::Basename;
15use File::Find;
16use File::Spec::Functions;
17
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   |
23  \.\./cpan/Module-Build/MB-[\w\d]+/Simple/(?:test_install/)?bin/.*
24   |
25  \.\./cpan/Archive-Tar/bin/ptar.*
26)\z}ix;
27
28my %dist_dir_exe;
29
30foreach (qw (podchecker podselect pod2usage)) {
31    $dist_dir_exe{lc "$_.PL"} = "../cpan/Pod-Parser/$_";
32};
33foreach (qw (pod2man pod2text)) {
34    $dist_dir_exe{lc "$_.PL"} = "../cpan/podlators/$_";
35};
36$dist_dir_exe{'pod2html.pl'} = '../ext/Pod-Html';
37
38my @programs;
39
40find(
41  sub {
42    my $name = $File::Find::name;
43    return if $name =~ /blib/;
44    return unless $name =~ m{/(?:bin|scripts?)/\S+\z} && $name !~ m{/t/};
45
46    push @programs, $name;
47  },
48  qw( ../cpan ../dist ../ext ),
49);
50
51my $ext = $^O eq 'VMS' ? '.com' : '';
52
53for my $f ( @programs ) {
54  $f =~ s/\.\z// if $^O eq 'VMS';
55  next if $f =~ $not_installed;
56  my $bn = basename($f);
57  if(qr/\A(?i:$bn)\z/ ~~ %dist_dir_exe) {
58    ok( -f "$dist_dir_exe{lc $bn}$ext", "$f$ext");
59  } else {
60    ok( -f catfile('..', 'utils', "$bn$ext"), "$f$ext" );
61  }
62}
63
64