summaryrefslogtreecommitdiffstats
path: root/NPTest.pm
diff options
context:
space:
mode:
authorThomas Guyot-Sionnest <dermoth@aei.ca>2014-01-31 13:54:44 (GMT)
committerThomas Guyot-Sionnest <dermoth@aei.ca>2014-01-31 13:54:44 (GMT)
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 3d6e3a2..2baed0b 100644
--- a/NPTest.pm
+++ b/NPTest.pm
@@ -494,26 +494,35 @@ sub SetCacheFilename
494 494
495sub DetermineTestHarnessDirectory 495sub DetermineTestHarnessDirectory
496{ 496{
497 my( $userSupplied ) = @_; 497 my( @userSupplied ) = @_;
498 my @dirs;
498 499
499 # User Supplied 500 # User Supplied
500 if ( defined( $userSupplied ) && $userSupplied ) 501 if ( @userSupplied > 0 )
501 { 502 {
502 if ( -d $userSupplied ) 503 for my $u ( @userSupplied )
503 { 504 {
504 return $userSupplied; 505 if ( -d $u )
505 } 506 {
506 else 507 push ( @dirs, $u );
507 { 508 }
508 return undef; # userSupplied is invalid -> FAIL
509 } 509 }
510 } 510 }
511 511
512 # Simple Case : "t" is a subdirectory of the current directory 512 # Simple Cases: "t" and tests are subdirectories of the current directory
513 if ( -d "./t" ) 513 if ( -d "./t" )
514 { 514 {
515 return "./t"; 515 push ( @dirs, "./t");
516 } 516 }
517 if ( -d "./tests" )
518 {
519 push ( @dirs, "./tests");
520 }
521
522 if ( @dirs > 0 )
523 {
524 return @dirs;
525 }
517 526
518 # To be honest I don't understand which case satisfies the 527 # To be honest I don't understand which case satisfies the
519 # original code in test.pl : when $tstdir == `pwd` w.r.t. 528 # original code in test.pl : when $tstdir == `pwd` w.r.t.
@@ -526,7 +535,7 @@ sub DetermineTestHarnessDirectory
526 535
527 if ( $pwd =~ m|/t$| ) 536 if ( $pwd =~ m|/t$| )
528 { 537 {
529 return $pwd; 538 push ( @dirs, $pwd );
530 539
531 # The alternate that might work better is 540 # The alternate that might work better is
532 # chdir( ".." ); 541 # chdir( ".." );
@@ -535,7 +544,7 @@ sub DetermineTestHarnessDirectory
535 # to be tested is in the current directory (ie "./check_disk ....") 544 # to be tested is in the current directory (ie "./check_disk ....")
536 } 545 }
537 546
538 return undef; 547 return @dirs;
539} 548}
540 549
541sub TestsFrom 550sub TestsFrom