pkg-monitoring-plugins/test.pl.in

53 lines
831 B
Perl
Raw Normal View History

2013-11-26 22:53:19 +00:00
#!/usr/bin/perl -w -I .. -I ../..
#
# Wrapper for running the test harnesses
#
use strict;
use Getopt::Long;
use NPTest qw(DetermineTestHarnessDirectory TestsFrom);
2014-10-15 12:48:52 +00:00
$ENV{LC_ALL} = 'C';
2014-07-11 19:01:00 +00:00
my @tstdir;
2013-11-26 22:53:19 +00:00
2014-07-11 19:01:00 +00:00
if ( ! GetOptions( "testdir:s" => \@tstdir ) )
2013-11-26 22:53:19 +00:00
{
print "Usage: ${0} [--testdir=<directory>] [<test_harness.t> ...]\n";
exit 1;
}
my @tests;
if ( scalar( @ARGV ) )
{
@tests = @ARGV;
}
else
{
2014-07-11 19:01:00 +00:00
my @directory = DetermineTestHarnessDirectory( @tstdir );
2013-11-26 22:53:19 +00:00
2014-07-11 19:01:00 +00:00
if ( @directory == 0 )
2013-11-26 22:53:19 +00:00
{
print STDERR "$0: Unable to determine the test harness directory - ABORTING\n";
exit 2;
}
2014-07-11 19:01:00 +00:00
for my $d ( @directory )
{
push (@tests, TestsFrom( $d, 1 ));
}
2013-11-26 22:53:19 +00:00
}
if ( ! scalar( @tests ) )
{
print STDERR "$0: Unable to determine the test harnesses to run - ABORTING\n";
exit 3;
}
use Test::Harness;
runtests( @tests );