2006-01-02 14:04:14 by steve
Added to repository; test that each plugin avoids the $CONFIG hash, this would have caught the /etc/fstab error in the 0.6 release.
This commit is contained in:
55
tests/plugin-checks.t
Normal file
55
tests/plugin-checks.t
Normal file
@@ -0,0 +1,55 @@
|
||||
#!/usr/bin/perl -w
|
||||
#
|
||||
# Test that the plugins each refer to environmental variables,
|
||||
# not the perl config hash.
|
||||
#
|
||||
# Steve
|
||||
# --
|
||||
# $Id: plugin-checks.t,v 1.1 2006-01-02 14:04:14 steve Exp $
|
||||
#
|
||||
|
||||
|
||||
use strict;
|
||||
use Test::More qw( no_plan );
|
||||
|
||||
|
||||
foreach my $file ( glob( "etc/xen-create-image.d/*" ) )
|
||||
{
|
||||
ok( -e $file, "$file" );
|
||||
|
||||
if ( -f $file )
|
||||
{
|
||||
#
|
||||
# Make sure the file is OK
|
||||
#
|
||||
my $result = testFile( $file );
|
||||
is( $result, 0, " File contains no mention of the config hash" );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# Test that the named file contains no mention of '$CONFIG{'xx'};'
|
||||
#
|
||||
sub testFile
|
||||
{
|
||||
my ( $file ) = ( @_ );
|
||||
|
||||
open( FILY, "<", $file ) or die "Failed to open $file - $!";
|
||||
|
||||
foreach my $line ( <FILY> )
|
||||
{
|
||||
if ( $line =~ /\$CONFIG{[ \t'"]+(.*)[ \t'"]+}/ )
|
||||
{
|
||||
close( FILY );
|
||||
return $line;
|
||||
}
|
||||
}
|
||||
close( FILY );
|
||||
|
||||
#
|
||||
# Success
|
||||
#
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user