Code

Fix for regex input of '|', being output causing problems with Nagios' parsing of
[nagiosplug.git] / test.pl.in
1 #!/usr/bin/perl -w -I .. -I ../..
2 #
3 # Wrapper for running the test harnesses
4 #
6 use strict;
8 use Getopt::Long;
10 use NPTest qw(DetermineTestHarnessDirectory TestsFrom);
12 my $tstdir;
14 if ( ! GetOptions( "testdir:s" => \$tstdir ) )
15 {
16   print "Usage: ${0} [--testdir=<directory>] [<test_harness.t> ...]\n";
17   exit 1;
18 }
20 my @tests;
22 if ( scalar( @ARGV ) )
23 {
24   @tests = @ARGV;
25 }
26 else
27 {
28   my $directory = DetermineTestHarnessDirectory( $tstdir );
30   if ( !defined( $directory ) )
31   {
32     print STDERR "$0: Unable to determine the test harness directory - ABORTING\n";
33     exit 2;
34   }
36   @tests = TestsFrom( $directory, 1 );
37 }
39 if ( ! scalar( @tests ) )
40 {
41   print STDERR "$0: Unable to determine the test harnesses to run - ABORTING\n";
42   exit 3;
43 }
45 use Test::Harness;
47 $Test::Harness::verbose=1;
49 runtests( @tests );