diff options
Diffstat (limited to 'gnu/usr.bin/perl/t/porting/exec-bit.t')
-rw-r--r-- | gnu/usr.bin/perl/t/porting/exec-bit.t | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/gnu/usr.bin/perl/t/porting/exec-bit.t b/gnu/usr.bin/perl/t/porting/exec-bit.t index 718c81dabcf..1deb376c379 100644 --- a/gnu/usr.bin/perl/t/porting/exec-bit.t +++ b/gnu/usr.bin/perl/t/porting/exec-bit.t @@ -5,6 +5,16 @@ 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 +# and that anything with an executable bit also has a shebang + +sub has_shebang { + my $fname = shift; + open my $fh, '<', $fname or die "Can't open '$fname': $!"; + my $line = <$fh>; + close $fh; + + return $line =~ /^\#!\s*([A-Za-z0-9_\-\/\.])+\s?/ ? 1 : 0; +} require './test.pl'; if ( $^O eq "MSWin32" ) { @@ -22,9 +32,6 @@ if ( $^O eq "vos" ) { 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 @@ -43,6 +50,8 @@ my @manifest = sort keys %{ maniread("../MANIFEST") }; for my $f ( map { "../$_" } @manifest ) { next unless -x $f; + ok( has_shebang($f), "File $f has shebang" ); + ok( $exe_list{$f}, "tarball will chmod +x $f" ) or diag( "Remove the exec bit or add '$f' to Porting/exec-bit.txt" ); @@ -51,4 +60,3 @@ for my $f ( map { "../$_" } @manifest ) { 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"); - |