summaryrefslogtreecommitdiff
path: root/t/porting/exec-bit.t
blob: 02506c7c367d3c614d109e10678b44743cb71ac9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/perl -w
use 5.010;
use strict;

# This test checks that anything with an executable bit is
# identified in Porting/exec-bit.txt to makerel will set
# the exe bit in the release tarball

require './test.pl';
if ( $^O eq "MSWin32" ) {
  skip_all( "-x on MSWin32 only indicates file has executable suffix. Try Cygwin?" );
}

if ( $^O eq "VMS" ) {
  skip_all( "Filename case may not be preserved and other porting issues." );
}

plan('no_plan');

use ExtUtils::Manifest qw(maniread);
use File::Basename;
use File::Find;
use File::Spec::Functions;

# Copied from Porting/makerel - these will get +x in the tarball
# XXX refactor? -- dagolden, 2010-07-23
my %exe_list =
  map   { $_ => 1 }
  map   { my ($f) = split; glob("../$f") }
  grep  { $_ !~ /\A#/ && $_ !~ /\A\s*\z/ }
  map   { split "\n" }
  do    { local (@ARGV, $/) = '../Porting/exec-bit.txt'; <> };

# Get MANIFEST
$ExtUtils::Manifest::Quiet = 1;
my @manifest = sort keys %{ maniread("../MANIFEST") };

# Check that +x files in repo get +x from makerel
for my $f ( map { "../$_" } @manifest ) {
  next unless -x $f;

  ok( $exe_list{$f}, "tarball will chmod +x $f" )
    or diag( "Remove the exec bit or add '$f' to Porting/exec-bit.txt" );

  delete $exe_list{$f}; # seen it
}

ok( ! %exe_list, "Everything in Porting/exec-bit.txt has +x in repo" )
  or diag( "Files missing exec bit:\n  " . join("\n  ", sort keys %exe_list) . "\n");