aboutsummaryrefslogtreecommitdiff
path: root/NPTest.pm
diff options
context:
space:
mode:
authorGravatar Thomas Guyot-Sionnest <dermoth@aei.ca> 2014-01-31 08:54:44 -0500
committerGravatar Thomas Guyot-Sionnest <dermoth@aei.ca> 2014-01-31 08:54:44 -0500
commit1dd0e4c96376f2c28590dad683161ee8c57c0508 (patch)
tree4a61176ad008db3d6c835393d6a1332453d297e1 /NPTest.pm
parent35811848da1095525e6937159f6611fc8a87261b (diff)
downloadmonitoring-plugins-1dd0e4c96376f2c28590dad683161ee8c57c0508.tar.gz
Enable tests in tests/ subdirs
Diffstat (limited to 'NPTest.pm')
-rw-r--r--NPTest.pm33
1 files changed, 21 insertions, 12 deletions
diff --git a/NPTest.pm b/NPTest.pm
index 3d6e3a28..2baed0b0 100644
--- a/NPTest.pm
+++ b/NPTest.pm
@@ -494,26 +494,35 @@ sub SetCacheFilename
sub DetermineTestHarnessDirectory
{
- my( $userSupplied ) = @_;
+ my( @userSupplied ) = @_;
+ my @dirs;
# User Supplied
- if ( defined( $userSupplied ) && $userSupplied )
+ if ( @userSupplied > 0 )
{
- if ( -d $userSupplied )
+ for my $u ( @userSupplied )
{
- return $userSupplied;
- }
- else
- {
- return undef; # userSupplied is invalid -> FAIL
+ if ( -d $u )
+ {
+ push ( @dirs, $u );
+ }
}
}
- # Simple Case : "t" is a subdirectory of the current directory
+ # Simple Cases: "t" and tests are subdirectories of the current directory
if ( -d "./t" )
{
- return "./t";
+ push ( @dirs, "./t");
}
+ if ( -d "./tests" )
+ {
+ push ( @dirs, "./tests");
+ }
+
+ if ( @dirs > 0 )
+ {
+ return @dirs;
+ }
# To be honest I don't understand which case satisfies the
# original code in test.pl : when $tstdir == `pwd` w.r.t.
@@ -526,7 +535,7 @@ sub DetermineTestHarnessDirectory
if ( $pwd =~ m|/t$| )
{
- return $pwd;
+ push ( @dirs, $pwd );
# The alternate that might work better is
# chdir( ".." );
@@ -535,7 +544,7 @@ sub DetermineTestHarnessDirectory
# to be tested is in the current directory (ie "./check_disk ....")
}
- return undef;
+ return @dirs;
}
sub TestsFrom