1
0
mirror of synced 2026-01-19 09:08:30 +00:00
xen-tools.xen-tools/tests/plugin-checks.t
steve 07c0b7884a 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.
2006-01-02 14:04:14 +00:00

56 lines
879 B
Perl

#!/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;
}