Code

Fix a possible segfault if using "-f follow" and the server sends a
[nagiosplug.git] / test.pl.in
1 #!/usr/bin/perl -w -I .. -I ../..
2 #
3 # Wrapper for running the test harnesses
4 #
5 # $Id$
6 #
8 use strict;
10 use Getopt::Long;
12 use NPTest qw(DetermineTestHarnessDirectory TestsFrom);
14 my $tstdir;
16 if ( ! GetOptions( "testdir:s" => \$tstdir ) )
17 {
18   print "Usage: ${0} [--testdir=<directory>] [<test_harness.t> ...]\n";
19   exit 1;
20 }
22 my @tests;
24 if ( scalar( @ARGV ) )
25 {
26   @tests = @ARGV;
27 }
28 else
29 {
30   my $directory = DetermineTestHarnessDirectory( $tstdir );
32   if ( !defined( $directory ) )
33   {
34     print STDERR "$0: Unable to determine the test harness directory - ABORTING\n";
35     exit 2;
36   }
38   @tests = TestsFrom( $directory, 1 );
39 }
41 if ( ! scalar( @tests ) )
42 {
43   print STDERR "$0: Unable to determine the test harnesses to run - ABORTING\n";
44   exit 3;
45 }
47 use Test::Harness;
49 #$Test::Harness::verbose=1;
51 runtests( @tests );