Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tag: RELEASE_0_3_0
Fetching contributors…

Cannot retrieve contributors at this time

193 lines (130 sloc) 3.742 kB
#! perl -w
# Copyright: 2001-2005 The Perl Foundation. All Rights Reserved.
# $Id$
=head1 NAME
t/harness - Parrot Test Harness
=head1 SYNOPSIS
% perl t/harness [options] [testfiles]
=head1 DESCRIPTION
The short command line options are:
=over 4
=item C<-w>
Turn warnings on.
=item C<-g>
Run the C<CGoto> core.
=item C<-j>
Run with JIT enabled.
=item C<-C>
Run the C<CGP> core.
=item C<-S>
Run Switched.
=item C<-b>
Run bounds checking enabled.
=item C<-d>
Run with debugging enabled.
=item C<-f>
Run fast core.
=item C<-r>
compile to Parrot bytecode and then run the bytecode.
=item C<-O[012]>
Run optimized to the specified level.
=back
There are also long command line options:
=over 4
=item C<--running-make-test>
Some test scripts run more quickly when this is set.
=item C<--gc-debug>
Invoke parrot with '--gc-debug'.
=item C<--html>
Emit a C<smoke.html> file instead of displaying results.
=back
=cut
use strict;
use lib qw(lib imcc);
use Getopt::Std;
use Test::Harness qw(runtests);
use Parrot::Config qw/%PConfig/;
# handle the long options
$ENV{RUNNING_MAKE_TEST} = grep { $_ eq '--running-make-test' } @ARGV;
@ARGV = grep { $_ ne '--running-make-test' } @ARGV;
my $gc_debug = grep { $_ eq '--gc-debug' } @ARGV;
@ARGV = grep { $_ ne '--gc-debug' } @ARGV;
my $html = grep { $_ eq '--html' } @ARGV;
@ARGV = grep { $_ ne '--html' } @ARGV;
# Suck the short options into the TEST_PROG_ARGS evar:
my %opts;
getopts('wgjPCSefbvdr?hO:', \%opts);
if ($opts{'?'} || $opts{h}) {
print <<"EOF";
perl t/harness [options] [testfiles]
-w ... warnings on
-g ... run CGoto
-j ... run JIT
-C ... run CGP
-S ... run Switched
-b ... run bounds checked
--run-exec ... run exec core
-f ... run fast core
-v ... run verbose
-d ... run debug
-r ... assemble to PBC run PBC
-O[012] ... optimize
--running-make-test
--gc-debug
--html
EOF
exit;
}
my $args = join(' ', map { "-$_" } keys %opts );
$args =~ s/-O/-O$opts{O}/ if $opts{O};
$args .= ' --gc-debug' if $gc_debug;
$ENV{TEST_PROG_ARGS} = $args;
# Pass in a list of tests to run on the command line, else run all the tests.
my @default_tests = ( ( map { glob( "t/$_/*.t" ) } qw(op pmc native_pbc) ),
glob( "imcc/t/*/*.t" ),
glob( "t/src/*.t" ),
glob( "t/library/*.t" ),
);
my @tests = @ARGV ? map { glob( $_ ) } @ARGV : @default_tests;
unless ($html) {
runtests(@tests);
} else {
my @smoke_config_vars = qw(
osname
archname
cc
build_dir
cpuarch
revision
VERSION
optimize
DEVEL
);
eval {
require Test::TAP::HTMLMatrix;
require Test::TAP::Model::Visual;
};
die "You must have Test::TAP::HTMLMatrix installed.\n\n$@" if $@;
my $start = time;
my $model = Test::TAP::Model::Visual->new_with_tests(@tests);
my $end = time;
my $duration = $end - $start;
my $v = Test::TAP::HTMLMatrix->new(
$model,
join("\n",
"duration: $duration",
"branch: unknown",
"harness_args: " . (($args) ? $args : "N/A"),
map { "$_: $PConfig{$_}" } sort @smoke_config_vars),
);
$v->has_inline_css(1); # no separate css file
open HTML, ">", "smoke.html";
print HTML $v->html;
close HTML;
print "smoke.html has been generated.\n";
}
=head1 HISTORY
Mike Lambert stole F<t/harness> for F<languages/perl6/t/harness>.
Leo Toetsch stole F<languages/perl6/t/harness> for F<imcc/t/harness>.
Bernhard Schmalhofer merged F<imcc/t/harness> back into F<t/harness>.
=cut
Jump to Line
Something went wrong with that request. Please try again.