Fixed test so works on MacOSX (use /bin/sh instead of /bin/grep).
[monitoring-plugins.git] / test.pl.in
blob22d0576d23594c084f06974c4df04c886ce553f0
1 #!/usr/bin/perl -w -I .. -I ../..
3 # Wrapper for running the test harnesses
5 # $Id$
8 use strict;
10 use Getopt::Long;
12 use NPTest qw(DetermineTestHarnessDirectory TestsFrom);
14 my $tstdir;
16 if ( ! GetOptions( "testdir:s" => \$tstdir ) )
18 print "Usage: ${0} [--testdir=<directory>] [<test_harness.t> ...]\n";
19 exit 1;
22 my @tests;
24 if ( scalar( @ARGV ) )
26 @tests = @ARGV;
28 else
30 my $directory = DetermineTestHarnessDirectory( $tstdir );
32 if ( !defined( $directory ) )
34 print STDERR "$0: Unable to determine the test harness directory - ABORTING\n";
35 exit 2;
38 @tests = TestsFrom( $directory, 1 );
41 if ( ! scalar( @tests ) )
43 print STDERR "$0: Unable to determine the test harnesses to run - ABORTING\n";
44 exit 3;
47 use Test::Harness;
49 #$Test::Harness::verbose=1;
51 runtests( @tests );