Imported Upstream version 1.4.16+git20130919
This commit is contained in:
parent
01ca3b324f
commit
57371046fd
50 changed files with 3885 additions and 500 deletions
61
NPTest.pm
61
NPTest.pm
|
@ -422,6 +422,7 @@ sub LoadCache
|
|||
{
|
||||
return if exists( $CACHE{'_cache_loaded_'} );
|
||||
|
||||
my $fileContents = "";
|
||||
if ( -f $CACHEFILENAME )
|
||||
{
|
||||
my( $fileHandle ) = new IO::File;
|
||||
|
@ -432,41 +433,45 @@ sub LoadCache
|
|||
return;
|
||||
}
|
||||
|
||||
my( $fileContents ) = join( "\n", <$fileHandle> );
|
||||
|
||||
$fileContents = join("", <$fileHandle>);
|
||||
$fileHandle->close();
|
||||
|
||||
chomp($fileContents);
|
||||
my( $contentsRef ) = eval $fileContents;
|
||||
%CACHE = %{$contentsRef};
|
||||
|
||||
}
|
||||
|
||||
$CACHE{'_cache_loaded_'} = 1;
|
||||
$CACHE{'_cache_loaded_'} = 1;
|
||||
$CACHE{'_original_cache'} = $fileContents;
|
||||
}
|
||||
|
||||
|
||||
sub SaveCache
|
||||
{
|
||||
delete $CACHE{'_cache_loaded_'};
|
||||
my $oldFileContents = delete $CACHE{'_original_cache'};
|
||||
|
||||
my( $fileHandle ) = new IO::File;
|
||||
|
||||
if ( ! $fileHandle->open( "> ${CACHEFILENAME}" ) )
|
||||
{
|
||||
print STDERR "NPTest::LoadCache() : Problem saving ${CACHEFILENAME} : $!\n";
|
||||
return;
|
||||
}
|
||||
|
||||
my( $dataDumper ) = new Data::Dumper( [ \%CACHE ] );
|
||||
|
||||
my($dataDumper) = new Data::Dumper([\%CACHE]);
|
||||
$dataDumper->Terse(1);
|
||||
$dataDumper->Sortkeys(1);
|
||||
my $data = $dataDumper->Dump();
|
||||
$data =~ s/^\s+/ /gmx; # make sure all systems use same amount of whitespace
|
||||
$data =~ s/^\s+}/}/gmx;
|
||||
chomp($data);
|
||||
|
||||
print $fileHandle $dataDumper->Dump();
|
||||
if($oldFileContents ne $data) {
|
||||
my($fileHandle) = new IO::File;
|
||||
if (!$fileHandle->open( "> ${CACHEFILENAME}")) {
|
||||
print STDERR "NPTest::LoadCache() : Problem saving ${CACHEFILENAME} : $!\n";
|
||||
return;
|
||||
}
|
||||
print $fileHandle $data;
|
||||
$fileHandle->close();
|
||||
}
|
||||
|
||||
$fileHandle->close();
|
||||
|
||||
$CACHE{'_cache_loaded_'} = 1;
|
||||
$CACHE{'_cache_loaded_'} = 1;
|
||||
$CACHE{'_original_cache'} = $data;
|
||||
}
|
||||
|
||||
#
|
||||
|
@ -556,12 +561,12 @@ sub TestsFrom
|
|||
{
|
||||
if ( $excludeIfAppMissing )
|
||||
{
|
||||
$application = basename( $filename, ".t" );
|
||||
if ( ! -e $application )
|
||||
{
|
||||
print STDERR "No application (${application}) found for test harness (${filename})\n";
|
||||
next;
|
||||
}
|
||||
$application = basename( $filename, ".t" );
|
||||
if ( ! -e $application and ! -e $application.'.pm' )
|
||||
{
|
||||
print STDERR "No application (${application}) found for test harness (${filename})\n";
|
||||
next;
|
||||
}
|
||||
}
|
||||
push @tests, "${directory}/${filename}";
|
||||
}
|
||||
|
@ -642,6 +647,16 @@ sub testCmd {
|
|||
return $object;
|
||||
}
|
||||
|
||||
# do we have ipv6
|
||||
sub has_ipv6 {
|
||||
# assume ipv6 if a ping6 to labs.consol.de works
|
||||
`ping6 -c 1 2a03:3680:0:2::21 2>&1`;
|
||||
if($? == 0) {
|
||||
return 1;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
1;
|
||||
#
|
||||
# End of File
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue