This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix the one remaining long line in perldiag
[perl5.git] / t / porting / exec-bit.t
1 #!/perl -w
2 use 5.010;
3 use strict;
4
5 # This test checks that anything with an executable bit is
6 # identified in Porting/exec-bit.txt to makerel will set
7 # the exe bit in the release tarball
8
9 require './test.pl';
10 if ( $^O eq "MSWin32" ) {
11   skip_all( "-x on MSWin32 only indicates file has executable suffix. Try Cygwin?" );
12 }
13
14 if ( $^O eq "VMS" ) {
15   skip_all( "Filename case may not be preserved and other porting issues." );
16 }
17
18 if ( $^O eq "vos" ) {
19   skip_all( "VOS combines the read and execute permission bits." );
20 }
21
22 plan('no_plan');
23
24 use ExtUtils::Manifest qw(maniread);
25 use File::Basename;
26 use File::Find;
27 use File::Spec::Functions;
28
29 # Copied from Porting/makerel - these will get +x in the tarball
30 # XXX refactor? -- dagolden, 2010-07-23
31 my %exe_list =
32   map   { $_ => 1 }
33   map   { my ($f) = split; glob("../$f") }
34   grep  { $_ !~ /\A#/ && $_ !~ /\A\s*\z/ }
35   map   { split "\n" }
36   do    { local (@ARGV, $/) = '../Porting/exec-bit.txt'; <> };
37
38 # Get MANIFEST
39 $ExtUtils::Manifest::Quiet = 1;
40 my @manifest = sort keys %{ maniread("../MANIFEST") };
41
42 # Check that +x files in repo get +x from makerel
43 for my $f ( map { "../$_" } @manifest ) {
44   next unless -x $f;
45
46   ok( $exe_list{$f}, "tarball will chmod +x $f" )
47     or diag( "Remove the exec bit or add '$f' to Porting/exec-bit.txt" );
48
49   delete $exe_list{$f}; # seen it
50 }
51
52 ok( ! %exe_list, "Everything in Porting/exec-bit.txt has +x in repo" )
53   or diag( "Files missing exec bit:\n  " . join("\n  ", sort keys %exe_list) . "\n");
54