Merge branch 'master' of github.com:monitoring-plugins/monitoring-plugins
[monitoring-plugins.git] / test.pl.in
blob2f2c44f226e44064d50fe79a4e1ae7b7c890287d
1 #!/usr/bin/perl -w -I .. -I ../..
3 # Wrapper for running the test harnesses
6 use strict;
8 use Getopt::Long;
10 use NPTest qw(DetermineTestHarnessDirectory TestsFrom);
12 $ENV{LC_ALL} = 'C';
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 ( @directory == 0 )
34 print STDERR "$0: Unable to determine the test harness directory - ABORTING\n";
35 exit 2;
38 for my $d ( @directory )
40 push (@tests, TestsFrom( $d, 1 ));
44 if ( ! scalar( @tests ) )
46 print STDERR "$0: Unable to determine the test harnesses to run - ABORTING\n";
47 exit 3;
50 use Test::Harness;
52 runtests( @tests );