From c9d2ce03adb96f42bd86e8ca93276ae378fe3a16 Mon Sep 17 00:00:00 2001 From: steve Date: Sun, 25 Jun 2006 20:02:33 +0000 Subject: [PATCH] 2006-06-25 20:02:33 by steve Updated the tests to read the list of distributions we support by searching for directories beneath hooks/ rather than having a set list. This is in preference to updating them to include fedora now, and more in the future .. --- tests/hook-inittab.t | 26 ++++++++++++++++++-------- tests/hook-tls.t | 26 +++++++++++++++++++++----- tests/hooks.t | 23 ++++++++++++++++++----- tests/plugin-checks.t | 29 ++++++++++++++++++++++++----- 4 files changed, 81 insertions(+), 23 deletions(-) diff --git a/tests/hook-inittab.t b/tests/hook-inittab.t index 2b06fa5..18b366d 100644 --- a/tests/hook-inittab.t +++ b/tests/hook-inittab.t @@ -4,7 +4,7 @@ # # Steve # -- -# $Id: hook-inittab.t,v 1.4 2006-06-24 20:17:09 steve Exp $ +# $Id: hook-inittab.t,v 1.5 2006-06-25 20:02:33 steve Exp $ # use strict; @@ -20,14 +20,24 @@ ok( -e "/etc/inittab", "/etc/inittab exists." ); +# +# 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 ( ! -d $dir ); + + if ( $dir =~ /hooks\/(.*)/ ) + { + my $dist = $1; + testHook( $dist ); + } +} + -# -# Test the inittab hooks -# -testHook( "centos4" ); -testHook( "debian" ); -testHook( "gentoo" ); -testHook( "ubuntu" ); sub testHook diff --git a/tests/hook-tls.t b/tests/hook-tls.t index 3ab5206..49e7806 100644 --- a/tests/hook-tls.t +++ b/tests/hook-tls.t @@ -4,7 +4,7 @@ # # Steve # -- -# $Id: hook-tls.t,v 1.3 2006-06-24 20:18:27 steve Exp $ +# $Id: hook-tls.t,v 1.4 2006-06-25 20:02:33 steve Exp $ # use strict; @@ -12,10 +12,26 @@ use Test::More qw( no_plan ); use File::Temp; -testTLSDisabling( "centos4" ); -testTLSDisabling( "debian" ); -testTLSDisabling( "gentoo" ); -testTLSDisabling( "ubuntu" ); + + +# +# 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 ( ! -d $dir ); + + if ( $dir =~ /hooks\/(.*)/ ) + { + my $dist = $1; + testTLSDisabling( $dist ); + } +} + + # diff --git a/tests/hooks.t b/tests/hooks.t index c0a4f6c..cd27554 100644 --- a/tests/hooks.t +++ b/tests/hooks.t @@ -4,17 +4,30 @@ # # Steve # -- -# $Id: hooks.t,v 1.6 2006-06-24 20:18:27 steve Exp $ +# $Id: hooks.t,v 1.7 2006-06-25 20:02:33 steve Exp $ # use strict; use Test::More qw( no_plan ); -testDistroHooks( "centos4" ); -testDistroHooks( "debian" ); -testDistroHooks( "gentoo" ); -testDistroHooks( "ubuntu" ); +# +# 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 ( ! -d $dir ); + + if ( $dir =~ /hooks\/(.*)/ ) + { + my $dist = $1; + testDistroHooks( $dist ); + } +} + sub testDistroHooks diff --git a/tests/plugin-checks.t b/tests/plugin-checks.t index cc91329..cc6a8dd 100644 --- a/tests/plugin-checks.t +++ b/tests/plugin-checks.t @@ -5,7 +5,7 @@ # # Steve # -- -# $Id: plugin-checks.t,v 1.6 2006-06-24 20:19:17 steve Exp $ +# $Id: plugin-checks.t,v 1.7 2006-06-25 20:02:33 steve Exp $ # @@ -13,11 +13,30 @@ use strict; use Test::More qw( no_plan ); -testPlugins( "centos4" ); -testPlugins( "debian" ); -testPlugins( "gentoo" ); -testPlugins( "ubuntu" ); +# +# 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 ( ! -d $dir ); + if ( $dir =~ /hooks\/(.*)/ ) + { + my $dist = $1; + testPlugins( $dist ); + } +} + + + +=head2 testPlugins + + Test each plugin associated with the given directory. + +=cut sub testPlugins {