aboutsummaryrefslogtreecommitdiff
path: root/test.pl.in
blob: 85ac19dae2e2d0fbfd1705f1adb821fb6822caa5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/perl -w -I .. -I ../..
#
# Wrapper for running the test harnesses
#

use strict;

use Getopt::Long;

use NPTest qw(DetermineTestHarnessDirectory TestsFrom);

my $tstdir;

if ( ! GetOptions( "testdir:s" => \$tstdir ) )
{
  print "Usage: ${0} [--testdir=<directory>] [<test_harness.t> ...]\n";
  exit 1;
}

my @tests;

if ( scalar( @ARGV ) )
{
  @tests = @ARGV;
}
else
{
  my $directory = DetermineTestHarnessDirectory( $tstdir );

  if ( !defined( $directory ) )
  {
    print STDERR "$0: Unable to determine the test harness directory - ABORTING\n";
    exit 2;
  }

  @tests = TestsFrom( $directory, 1 );
}

if ( ! scalar( @tests ) )
{
  print STDERR "$0: Unable to determine the test harnesses to run - ABORTING\n";
  exit 3;
}

use Test::Harness;

runtests( @tests );