1
0
mirror of synced 2026-01-20 17:38:02 +00:00
Axel Beckert fc736c040d Refactoring: Massive code deduplication in hooks directory
All hooks files which were identical and had no second group of
identically named hook files have been moved to a new hooks/common
directory and now have symbolic links to the new single file at their
old locations.

Also slightly modified to make this work:

  * Makefile: copy new hooks/common directory
  * Some tests: ignore new hooks/common directory
2012-06-04 16:26:03 +02:00

55 lines
1007 B
Perl
Executable File

#!/usr/bin/perl -w
#
# Test that all the hook files we install are executable.
#
# Steve
# --
#
use strict;
use Test::More qw( no_plan );
#
# Rather than having a hardwired list of distributions to test
# against we look for subdirectories beneath hooks/ and test each
# one.
#
foreach my $dir ( glob( "hooks/*" ) )
{
next if ( $dir =~ /CVS/i );
next if ( $dir =~ /common/i );
next if ( ! -d $dir );
if ( $dir =~ /hooks\/(.*)/ )
{
my $dist = $1;
testDistroHooks( $dist );
}
}
sub testDistroHooks
{
my ( $dist ) = ( @_ );
#
# Make sure we have a distro-specific hook directory.
#
ok( -d "hooks/$dist", "There is a hook directory for distro $dist" );
#
# Now make sure we just have files, and that they are executable.
#
foreach my $file ( glob( "hooks/$dist/*" ) )
{
if ( ! -d $file )
{
ok( -e $file, "$file" );
ok( -x $file, " File is executable: $file" );
}
}
}