2 # Copyright (C) 2001-2009, Parrot Foundation.
11 # need runtests from T::H, but avoid running all our parrot invocations with -w
13 undef $Test::Harness::Switches;
15 use Parrot::Harness::DefaultTests qw(
19 use Parrot::Harness::Options qw(
24 use Parrot::Harness::Smoke qw(
25 generate_html_smoke_report
26 send_archive_to_smolder
27 collect_test_environment_data
31 (my $longopts, @ARGV) = handle_long_options(@ARGV);
33 # Suck the short options into the TEST_PROG_ARGS
34 # environmental variable.
36 getopts('wgGjPCSefbvdr?hO:D:', \%opts);
38 if ($opts{'?'} || $opts{h} || $longopts->{help}) {
43 # add -D40; merge it with any existing -D argument
44 $opts{D} = sprintf( '%x', hex(40) | (exists $opts{D} ? hex($opts{D}) : 0));
46 my $args = get_test_prog_args(
47 \%opts, $longopts->{gc_debug}, $longopts->{run_exec}
49 $ENV{TEST_PROG_ARGS} = $args;
52 if ($longopts->{code}) {
53 @tests = @developing_tests;
56 @tests = map { glob($_) } (@ARGV
58 : get_common_tests( $longopts )
63 if ($longopts->{archive}) {
64 eval { require TAP::Harness::Archive };
66 die "\n" . ('-' x 55) . "\nCould not load TAP::Harness::Archive."
67 . "\nPlease install it if you want to create TAP archives.\n"
68 . ('-' x 55) . "\n\n$@\n";
70 # for extra_properties we need TAP::Harness::Archive >= .10
71 if ($TAP::Harness::Archive::VERSION < .10) {
72 die "\n" . ('-' x 55) . "\nWe need TAP::Harness::Archive >= .10."
73 . "\nPlease install it if you want to create TAP archives.\n"
77 my %env_data = collect_test_environment_data();
78 $harness = TAP::Harness::Archive->new(
80 verbosity => $ENV{HARNESS_VERBOSE},
81 archive => 'parrot_test_run.tar.gz',
83 extra_properties => \%env_data,
84 extra_files => [ 'myconfig', 'config_lib.pir' ],
87 $harness->runtests(@tests);
88 send_archive_to_smolder(%env_data) if $longopts->{send_to_smolder};
91 elsif ($longopts->{html}) {
92 generate_html_smoke_report(
101 eval { require TAP::Harness };
103 Test::Harness::runtests(@tests);
107 $harness = TAP::Harness->new({
108 verbosity => $ENV{HARNESS_VERBOSE},
110 jobs => $ENV{TEST_JOBS} || 1,
114 my $results = $harness->runtests(@tests);
116 exit ( $results->all_passed() ? 0 : 1 );
121 t/harness - Parrot Test Harness
125 % perl t/harness [options] [testfiles]
129 The short command line options are:
139 Run the C<GCDebug> core.
143 Alias for running with the fast core.
147 Run bounds checking enabled.
151 Run with debugging enabled.
159 compile to Parrot bytecode and then run the bytecode.
163 Run optimized to the specified level.
167 Pass the specified debug bits to the parrot interpreter. Note that
168 C<-D40> (fill I, N registers with garbage) is always enabled.
169 See 'parrot --help-debug' for available flags.
173 There are also long command line options:
179 Invoke parrot with '--gc-debug'.
183 Emit a C<smoke.html> file instead of displaying results.
185 =item C<--code-tests>
187 Run only the file metadata and basic coding standards tests.
193 Mike Lambert stole F<t/harness> for F<languages/perl6/t/harness>.
195 Leo Toetsch stole F<languages/perl6/t/harness> for F<imcc/t/harness>.
197 Bernhard Schmalhofer merged F<imcc/t/harness> back into F<t/harness>.
204 # cperl-indent-level: 4
207 # vim: expandtab shiftwidth=4: