This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add filename with spurious +x bit to diag in t/porting/exec-bit.t
[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
11 plan('no_plan');
12
13 use ExtUtils::Manifest qw(maniread);
14 use File::Basename;
15 use File::Find;
16 use File::Spec::Functions;
17
18 # Copied from Porting/makerel - these will get +x in the tarball
19 # XXX refactor? -- dagolden, 2010-07-23
20 my %exe_list = 
21   map   { $_ => 1 }
22   map   { my ($f) = split; glob($f) } 
23   grep  { $_ !~ /\A#/ && $_ !~ /\A\s*\z/ }
24   map   { split "\n" }
25   do    { local (@ARGV, $/) = '../Porting/exec-bit.txt'; <> };
26
27 # Get MANIFEST
28 $ExtUtils::Manifest::Quiet = 1;
29 my @manifest = sort keys %{ maniread("../MANIFEST") };
30
31 # Check that +x files in repo get +x from makerel
32 for my $f ( @manifest ) {
33   next unless -x "../$f";
34
35   ok( $exe_list{$f}, "tarball will chmod +x $f" )
36     or diag( "Remove the exec bit or add '$f' to Porting/exec-bit.txt" );
37
38   delete $exe_list{$f}; # seen it
39 }
40
41 ok( ! %exe_list, "Everything in Porting/exec-bit.txt has +x in repo" )
42   or diag( "Files missing exec bit:\n  " . join("\n  ", sort keys %exe_list) . "\n");
43