#! perl -w
# $Id: harness,v 1.17 2003/10/21 18:34:15 boemmels Exp $

use strict;
use lib 'lib';
use Test::Harness qw(runtests);

#
# Suck the switches into the TEST_PROG_ARGS evar:
#

$ENV{RUNNING_MAKE_TEST} = grep { $_ eq '--running-make-test' } @ARGV;
@ARGV = grep { $_ ne '--running-make-test' } @ARGV;

$ENV{TEST_PROG_ARGS} = join(' ', grep { /^-/ } @ARGV);
@ARGV = grep { ! /^-/ } @ARGV;

$ENV{PARROT_QUICKTEST} = grep $_ eq 'quick', @ARGV;
@ARGV = grep $_ ne 'quick', @ARGV;

# Pass in a list of tests to run on the command line, else run all the tests.
my @tests = @ARGV
            ? map { glob $_ } @ARGV
            : map { glob( "t/$_/*.t" ) } qw(src op pmc native_pbc) ;
runtests(@tests);
