2006-06-13 13:26:00 by steve
Do the same for tests, no more literal tabs.
This commit is contained in:
parent
2b3b14a943
commit
2c23effd90
@ -5,7 +5,7 @@
|
||||
#
|
||||
# Steve
|
||||
# --
|
||||
# $Id: argument-check.t,v 1.4 2006-06-09 22:03:30 steve Exp $
|
||||
# $Id: argument-check.t,v 1.5 2006-06-13 13:26:00 steve Exp $
|
||||
#
|
||||
|
||||
use strict;
|
||||
@ -40,10 +40,10 @@ foreach my $key ( sort keys %OPTIONS )
|
||||
|
||||
foreach my $line ( @lines )
|
||||
{
|
||||
if ( $line =~ /--$key/ )
|
||||
{
|
||||
$found = 1;
|
||||
}
|
||||
if ( $line =~ /--$key/ )
|
||||
{
|
||||
$found = 1;
|
||||
}
|
||||
}
|
||||
|
||||
is( $found, 1 , " Found documentation for '$key'" );
|
||||
@ -75,38 +75,38 @@ sub parseConfigFile
|
||||
while (defined($line = <FILE>) )
|
||||
{
|
||||
chomp $line;
|
||||
if ($line =~ s/\\$//)
|
||||
{
|
||||
$line .= <FILE>;
|
||||
redo unless eof(FILE);
|
||||
}
|
||||
if ($line =~ s/\\$//)
|
||||
{
|
||||
$line .= <FILE>;
|
||||
redo unless eof(FILE);
|
||||
}
|
||||
|
||||
# Skip blank lines
|
||||
next if ( length( $line ) < 1 );
|
||||
# Skip blank lines
|
||||
next if ( length( $line ) < 1 );
|
||||
|
||||
# Find variable settings
|
||||
if ( $line =~ /([^=]+)=([^\n]+)/ )
|
||||
{
|
||||
my $key = $1;
|
||||
my $val = $2;
|
||||
# Find variable settings
|
||||
if ( $line =~ /([^=]+)=([^\n]+)/ )
|
||||
{
|
||||
my $key = $1;
|
||||
my $val = $2;
|
||||
|
||||
if ( $key =~ /([ \t#]*)(.*)/ )
|
||||
{
|
||||
$key = $2;
|
||||
}
|
||||
if ( $key =~ /([ \t#]*)(.*)/ )
|
||||
{
|
||||
$key = $2;
|
||||
}
|
||||
|
||||
|
||||
# Strip leading and trailing whitespace.
|
||||
$key =~ s/^\s+//;
|
||||
$key =~ s/\s+$//;
|
||||
$val =~ s/^\s+//;
|
||||
$val =~ s/\s+$//;
|
||||
|
||||
next if ( $key =~ /--/ );
|
||||
# Strip leading and trailing whitespace.
|
||||
$key =~ s/^\s+//;
|
||||
$key =~ s/\s+$//;
|
||||
$val =~ s/^\s+//;
|
||||
$val =~ s/\s+$//;
|
||||
|
||||
next if ( $key =~ /--/ );
|
||||
|
||||
# Store value.
|
||||
$CONFIG{ $key } = $val;
|
||||
}
|
||||
# Store value.
|
||||
$CONFIG{ $key } = $val;
|
||||
}
|
||||
}
|
||||
|
||||
close( FILE );
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
#
|
||||
# Steve
|
||||
# --
|
||||
# $Id: hook-inittab.t,v 1.2 2006-06-09 15:12:33 steve Exp $
|
||||
# $Id: hook-inittab.t,v 1.3 2006-06-13 13:26:00 steve Exp $
|
||||
#
|
||||
|
||||
use strict;
|
||||
@ -35,7 +35,7 @@ sub testHook
|
||||
#
|
||||
# Create a temporary directory, and copy our inittab into it.
|
||||
#
|
||||
my $dir = File::Temp::tempdir( CLEANUP => 1 );
|
||||
my $dir = File::Temp::tempdir( CLEANUP => 1 );
|
||||
mkdir( $dir . "/etc", 0777 );
|
||||
File::Copy::cp( "/etc/inittab", $dir . "/etc" );
|
||||
|
||||
@ -72,21 +72,21 @@ sub testHook
|
||||
my $count = 0;
|
||||
foreach my $line ( @lines )
|
||||
{
|
||||
if ( $line =~ /^([1-9])(.*) (.*)$/ )
|
||||
{
|
||||
#
|
||||
# This should be our only line:
|
||||
#
|
||||
# 1:2345:respawn:/sbin/getty 38400 console
|
||||
#
|
||||
ok( $1 eq "1", "We found the first getty line." );
|
||||
ok( $3 eq "console", "Which does use the console driver." );
|
||||
}
|
||||
if ( $line =~ /^([1-9])(.*) (.*)$/ )
|
||||
{
|
||||
#
|
||||
# This should be our only line:
|
||||
#
|
||||
# 1:2345:respawn:/sbin/getty 38400 console
|
||||
#
|
||||
ok( $1 eq "1", "We found the first getty line." );
|
||||
ok( $3 eq "console", "Which does use the console driver." );
|
||||
}
|
||||
|
||||
if ( $line =~ /^(.).*getty/ )
|
||||
{
|
||||
$count += 1 if ( $1 ne "#" );
|
||||
}
|
||||
if ( $line =~ /^(.).*getty/ )
|
||||
{
|
||||
$count += 1 if ( $1 ne "#" );
|
||||
}
|
||||
}
|
||||
|
||||
ok( $count = 1, "Only found one uncommented getty line" );
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
#
|
||||
# Steve
|
||||
# --
|
||||
# $Id: hooks.t,v 1.4 2006-06-09 15:12:33 steve Exp $
|
||||
# $Id: hooks.t,v 1.5 2006-06-13 13:26:00 steve Exp $
|
||||
#
|
||||
|
||||
use strict;
|
||||
@ -29,11 +29,11 @@ sub testDistroHooks
|
||||
#
|
||||
foreach my $file ( glob( "hooks/$dist/*" ) )
|
||||
{
|
||||
if ( ! -d $file )
|
||||
{
|
||||
ok( -e $file, "$file" );
|
||||
ok( -x $file, " File is executable: $file" );
|
||||
}
|
||||
if ( ! -d $file )
|
||||
{
|
||||
ok( -e $file, "$file" );
|
||||
ok( -x $file, " File is executable: $file" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
#
|
||||
# Steve
|
||||
# --
|
||||
# $Id: no-tabs.t,v 1.1 2006-06-13 13:21:45 steve Exp $
|
||||
# $Id: no-tabs.t,v 1.2 2006-06-13 13:26:00 steve Exp $
|
||||
|
||||
|
||||
use strict;
|
||||
@ -35,13 +35,12 @@ sub checkFile
|
||||
# Nor about backup files.
|
||||
return if ( $file =~ /~$/ );
|
||||
|
||||
# Nor about files which start with ./debian/ + ./tests/
|
||||
# Nor about files which start with ./debian/
|
||||
return if ( $file =~ /^\.\/debian\// );
|
||||
return if ( $file =~ /^\.\/tests\// );
|
||||
|
||||
# See if it is a shell/perl file.
|
||||
my $isShell = 0;
|
||||
my $isPerl = 0;
|
||||
my $isShell = 0;
|
||||
my $isPerl = 0;
|
||||
|
||||
# Read the file.
|
||||
open( INPUT, "<", $file );
|
||||
@ -51,7 +50,7 @@ sub checkFile
|
||||
( $line =~ /\/bin\/bash/ ) )
|
||||
{
|
||||
$isShell = 1;
|
||||
}
|
||||
}
|
||||
if ( $line =~ /\/usr\/bin\/perl/ )
|
||||
{
|
||||
$isPerl = 1;
|
||||
@ -64,12 +63,12 @@ sub checkFile
|
||||
#
|
||||
if ( $isShell || $isPerl )
|
||||
{
|
||||
#
|
||||
# Count TAB characters
|
||||
#
|
||||
my $count = countTabCharacters( $file );
|
||||
#
|
||||
# Count TAB characters
|
||||
#
|
||||
my $count = countTabCharacters( $file );
|
||||
|
||||
is( $count, 0, "Script has no tab characters: $file" );
|
||||
is( $count, 0, "Script has no tab characters: $file" );
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,11 +87,11 @@ sub countTabCharacters
|
||||
or die "Cannot open $file - $!";
|
||||
foreach my $line ( <FILE> )
|
||||
{
|
||||
while( $line =~ /(.*)\t(.*)/ )
|
||||
{
|
||||
$count += 1;
|
||||
$line = $1 . $2;
|
||||
}
|
||||
while( $line =~ /(.*)\t(.*)/ )
|
||||
{
|
||||
$count += 1;
|
||||
$line = $1 . $2;
|
||||
}
|
||||
}
|
||||
close( FILE );
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
#
|
||||
# Steve
|
||||
# --
|
||||
# $Id: perl-syntax.t,v 1.1 2006-06-10 20:45:10 steve Exp $
|
||||
# $Id: perl-syntax.t,v 1.2 2006-06-13 13:26:00 steve Exp $
|
||||
|
||||
|
||||
use strict;
|
||||
@ -44,10 +44,10 @@ sub checkFile
|
||||
open( INPUT, "<", $file );
|
||||
foreach my $line ( <INPUT> )
|
||||
{
|
||||
if ( $line =~ /\/usr\/bin\/perl/ )
|
||||
{
|
||||
$isPerl = 1;
|
||||
}
|
||||
if ( $line =~ /\/usr\/bin\/perl/ )
|
||||
{
|
||||
$isPerl = 1;
|
||||
}
|
||||
}
|
||||
close( INPUT );
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
#
|
||||
# Steve
|
||||
# --
|
||||
# $Id: plugin-checks.t,v 1.3 2006-06-09 15:12:33 steve Exp $
|
||||
# $Id: plugin-checks.t,v 1.4 2006-06-13 13:26:00 steve Exp $
|
||||
#
|
||||
|
||||
|
||||
@ -31,16 +31,16 @@ sub testPlugins
|
||||
#
|
||||
foreach my $file ( glob( "hooks/$dist/*" ) )
|
||||
{
|
||||
ok( -e $file, "$file" );
|
||||
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" );
|
||||
}
|
||||
if ( -f $file )
|
||||
{
|
||||
#
|
||||
# Make sure the file is OK
|
||||
#
|
||||
my $result = testFile( $file );
|
||||
is( $result, 0, " File contains no mention of the config hash" );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -58,11 +58,11 @@ sub testFile
|
||||
|
||||
foreach my $line ( <FILY> )
|
||||
{
|
||||
if ( $line =~ /\$CONFIG{[ \t'"]+(.*)[ \t'"]+}/ )
|
||||
{
|
||||
close( FILY );
|
||||
return $line;
|
||||
}
|
||||
if ( $line =~ /\$CONFIG{[ \t'"]+(.*)[ \t'"]+}/ )
|
||||
{
|
||||
close( FILY );
|
||||
return $line;
|
||||
}
|
||||
}
|
||||
close( FILY );
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
#
|
||||
# Steve
|
||||
# --
|
||||
# $Id: pod-check.t,v 1.4 2006-06-09 15:12:33 steve Exp $
|
||||
# $Id: pod-check.t,v 1.5 2006-06-13 13:26:01 steve Exp $
|
||||
#
|
||||
|
||||
use strict;
|
||||
@ -19,15 +19,15 @@ foreach my $file ( glob( "bin/*-*" ) )
|
||||
|
||||
if ( ( -x $file ) && ( ! -d $file ) )
|
||||
{
|
||||
#
|
||||
# Execute the command giving STDERR to STDOUT where we
|
||||
# can capture it.
|
||||
#
|
||||
my $cmd = "podchecker $file";
|
||||
my $output = `$cmd 2>&1`;
|
||||
chomp( $output );
|
||||
#
|
||||
# Execute the command giving STDERR to STDOUT where we
|
||||
# can capture it.
|
||||
#
|
||||
my $cmd = "podchecker $file";
|
||||
my $output = `$cmd 2>&1`;
|
||||
chomp( $output );
|
||||
|
||||
is( $output, "$file pod syntax OK.", " File has correct POD syntax: $file" );
|
||||
is( $output, "$file pod syntax OK.", " File has correct POD syntax: $file" );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
#
|
||||
# Steve
|
||||
# --
|
||||
# $Id: shell-syntax.t,v 1.1 2006-06-10 20:50:14 steve Exp $
|
||||
# $Id: shell-syntax.t,v 1.2 2006-06-13 13:26:01 steve Exp $
|
||||
|
||||
|
||||
use strict;
|
||||
@ -41,11 +41,11 @@ sub checkFile
|
||||
open( INPUT, "<", $file );
|
||||
foreach my $line ( <INPUT> )
|
||||
{
|
||||
if ( ( $line =~ /\/bin\/sh/ ) ||
|
||||
( $line =~ /\/bin\/bash/ ) )
|
||||
{
|
||||
$isShell = 1;
|
||||
}
|
||||
if ( ( $line =~ /\/bin\/sh/ ) ||
|
||||
( $line =~ /\/bin\/bash/ ) )
|
||||
{
|
||||
$isShell = 1;
|
||||
}
|
||||
}
|
||||
close( INPUT );
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
#
|
||||
# Steve
|
||||
# --
|
||||
# $Id: xen-delete-image.t,v 1.3 2006-06-09 15:12:33 steve Exp $
|
||||
# $Id: xen-delete-image.t,v 1.4 2006-06-13 13:26:01 steve Exp $
|
||||
#
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@ use File::Temp;
|
||||
#
|
||||
# Create a temporary directory.
|
||||
#
|
||||
my $dir = File::Temp::tempdir( CLEANUP => 1 );
|
||||
my $dir = File::Temp::tempdir( CLEANUP => 1 );
|
||||
my $domains = $dir . "/domains";
|
||||
|
||||
#
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
#
|
||||
# Steve
|
||||
# --
|
||||
# $Id: xen-lists-images.t,v 1.3 2006-06-09 15:12:33 steve Exp $
|
||||
# $Id: xen-lists-images.t,v 1.4 2006-06-13 13:26:01 steve Exp $
|
||||
#
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@ use File::Temp;
|
||||
#
|
||||
# Create a temporary directory.
|
||||
#
|
||||
my $dir = File::Temp::tempdir( CLEANUP => 1 );
|
||||
my $dir = File::Temp::tempdir( CLEANUP => 1 );
|
||||
my $domains = $dir . "/domains";
|
||||
|
||||
#
|
||||
@ -78,15 +78,15 @@ foreach my $line ( split( /\n/, $output ) )
|
||||
{
|
||||
if ( $line =~ /Image: $one/ )
|
||||
{
|
||||
ok( 1, "First image found" );
|
||||
ok( 1, "First image found" );
|
||||
}
|
||||
elsif ( $line =~ /Image: $two/ )
|
||||
{
|
||||
ok( 1, "Second image found" );
|
||||
ok( 1, "Second image found" );
|
||||
}
|
||||
else
|
||||
{
|
||||
ok( 0, "Unexpected output : $line " );
|
||||
ok( 0, "Unexpected output : $line " );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user