#!/usr/bin/perl -w
#$Id: driver,v 1.1 2004/02/25 11:07:00 rockyb Exp $
use strict;

use File::Basename;
my $program = basename($0); # Who am I today, anyway? 

sub usage {
  print "
usage: 

   $program [--setup] [test1 ... ] 
   $program --help

Runs regresion tests (via Test::Harness). 

If no tests are specified all tests that match *.t in the
test directory are run. 

If --setup is given, the test isn't run but the log files are
set up for the regression test.

$program --help prints this help.
";

  exit 100;
}

use Test::Harness qw(&runtests $verbose);
#use File::Copy;
# require 'driver-init.pl';

my $setup = 0;
process_options();

@ARGV = glob("*.t") if !@ARGV;
# copy_from_orig(@ARGV);

if ($setup) {
  print "Log file(s) created for manual debugging.\n";
} else {
  runtests @ARGV;
}

exit 0;

# The bane of programming.
sub process_options {
  use Getopt::Long;
  $Getopt::Long::autoabbrev = 1;
  my $help = 0;
  
  my $result = &GetOptions
    (
     'help'           => \$help,
     'setup'          => \$setup, 
    );
  usage unless $result;
  usage if $help;
}

