2 # Copyright (C) 2001-2009, Parrot Foundation.
7 use Data::Dumper;$Data::Dumper::Indent=1;
12 # need runtests from T::H, but avoid running all our parrot invocations with -w
14 undef $Test::Harness::Switches;
16 use Parrot::Harness::DefaultTests qw(
20 use Parrot::Harness::Options qw(
25 use Parrot::Harness::Smoke qw(
26 generate_html_smoke_report
27 send_archive_to_smolder
28 collect_test_environment_data
32 (my $longopts, @ARGV) = handle_long_options(@ARGV);
34 $ENV{RUNNING_MAKE_TEST} = $longopts->{running_make_test};
36 # Suck the short options into the TEST_PROG_ARGS
37 # environmental variable.
39 getopts('wgjPCSefbvdr?hO:D:', \%opts);
41 if ($opts{'?'} || $opts{h} || $longopts->{help}) {
46 # add -D40; merge it with any existing -D argument
47 $opts{D} = sprintf( '%x', hex(40) | (exists $opts{D} ? hex($opts{D}) : 0));
49 my $args = get_test_prog_args(
50 \%opts, $longopts->{gc_debug}, $longopts->{run_exec}
52 $ENV{TEST_PROG_ARGS} = $args;
55 if ($longopts->{code}) {
56 @tests = @developing_tests;
59 @tests = map { glob($_) } (@ARGV
61 : get_common_tests( $longopts )
66 if ($longopts->{archive}) {
67 eval { require TAP::Harness::Archive };
69 die "\n" . ('-' x 55) . "\nCould not load TAP::Harness::Archive."
70 . "\nPlease install it if you want to create TAP archives.\n"
71 . ('-' x 55) . "\n\n$@\n";
73 # for extra_properties we need TAP::Harness::Archive >= .10
74 if ($TAP::Harness::Archive::VERSION < .10) {
75 die "\n" . ('-' x 55) . "\nWe need TAP::Harness::Archive >= .10."
76 . "\nPlease install it if you want to create TAP archives.\n"
80 my %env_data = collect_test_environment_data();
81 $harness = TAP::Harness::Archive->new(
83 verbosity => $ENV{HARNESS_VERBOSE},
84 archive => 'parrot_test_run.tar.gz',
86 extra_properties => \%env_data,
87 extra_files => [ 'myconfig', 'config_lib.pasm' ],
90 $harness->runtests(@tests);
91 send_archive_to_smolder(%env_data) if $longopts->{send_to_smolder};
94 elsif ($longopts->{html}) {
95 generate_html_smoke_report(
104 eval { require TAP::Harness };
106 Test::Harness::runtests(@tests);
110 $harness = TAP::Harness->new({
111 verbosity => $ENV{HARNESS_VERBOSE},
113 jobs => $ENV{TEST_JOBS} || 1,
117 my $results = $harness->runtests(@tests);
119 # a non-zero code stops make after test failures (RT #60116)
120 exit ( $results->all_passed() ? 0 : 1 );
125 t/harness - Parrot Test Harness
129 % perl t/harness [options] [testfiles]
133 The short command line options are:
143 Run the C<CGoto> core.
147 Alias for running with the fast core.
159 Run bounds checking enabled.
163 Run with debugging enabled.
171 compile to Parrot bytecode and then run the bytecode.
175 Run optimized to the specified level.
179 Pass the specified debug bits to the parrot interpreter. Note that
180 C<-D40> (fill I, N registers with garbage) is always enabled.
181 See 'parrot --help-debug' for available flags.
185 There are also long command line options:
189 =item C<--running-make-test>
191 Some test scripts run more quickly when this is set.
195 Invoke parrot with '--gc-debug'.
199 Emit a C<smoke.html> file instead of displaying results.
201 =item C<--code-tests>
203 Run only the file metadata and basic coding standards tests.
209 Mike Lambert stole F<t/harness> for F<languages/perl6/t/harness>.
211 Leo Toetsch stole F<languages/perl6/t/harness> for F<imcc/t/harness>.
213 Bernhard Schmalhofer merged F<imcc/t/harness> back into F<t/harness>.
220 # cperl-indent-level: 4
223 # vim: expandtab shiftwidth=4: