diff options
Diffstat (limited to 'NPTest.pm')
| -rw-r--r-- | NPTest.pm | 33 | 
1 files changed, 21 insertions, 12 deletions
| @@ -494,26 +494,35 @@ sub SetCacheFilename | |||
| 494 | 494 | ||
| 495 | sub DetermineTestHarnessDirectory | 495 | sub 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 | ||
| 541 | sub TestsFrom | 550 | sub TestsFrom | 
