Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Steal t/harness from Pipp. Prepare for smolder testing
- Loading branch information
1 parent
6162ceb
commit 60d67aa
Showing
3 changed files
with
107 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,124 @@ | ||
|
||
=head1 NAME | ||
|
||
languages/eclectus/t/harness - A harness for Eclectus | ||
t/harness - A testing harness for Eclectus | ||
|
||
=head1 SYNOPSIS | ||
|
||
cd languages/eclectus && perl t/harness | ||
|
||
cd languages && perl -I../lib eclectus/t/harness --files | ||
cd languages/eclectus && perl t/harness --verbose t/pmc/boolean.t | ||
|
||
=head1 DESCRIPTION | ||
|
||
If I'm called with a single | ||
argument of "--files", I just return a list of files to process. | ||
This list is one per line, and is relative to the languages dir. | ||
|
||
If I'm called with no args, I run the complete suite. | ||
|
||
Otherwise I run the tests that were passed on the command line. | ||
A harness based on Test::Harness and Test::Harness::Archive. | ||
|
||
=cut | ||
|
||
# pragmata | ||
use strict; | ||
use warnings; | ||
use 5.008; | ||
use lib qw( ../lib ../../lib ../../lib ); | ||
use FindBin (); | ||
use lib "$FindBin::Bin/../../../lib", "$FindBin::Bin/../lib"; | ||
|
||
use Cwd (); | ||
use File::Spec (); | ||
use TAP::Harness 3.12; # support closures for the 'exec' option | ||
use TAP::Harness::Archive 0.12; | ||
use Parrot::Config qw( %PConfig ); | ||
use Getopt::Long; | ||
use Parrot::Harness::Smoke; | ||
use Parrot::Test; | ||
|
||
my ( $send_to_smolder_flag, $archive_flag, $verbose_flag ); | ||
GetOptions( | ||
'send-to-smolder' => \$send_to_smolder_flag, | ||
'archive' => \$archive_flag, | ||
'verbose' => \$verbose_flag, | ||
); | ||
|
||
my $verbosity = $verbose_flag ? 1 : $ENV{HARNESS_VERBOSE}; | ||
$verbosity ||= 0; | ||
|
||
{ | ||
my $path_to_parrot = Parrot::Test::path_to_parrot(); | ||
|
||
my @files; | ||
if ( scalar(@ARGV) ) { | ||
# Someone specified tests for me to run. | ||
@files = grep { -f $_ } @ARGV | ||
} | ||
else { | ||
( undef, undef, my $current_dir ) = File::Spec->splitpath( Cwd::getcwd() ); | ||
@files = glob( File::Spec->catfile( 't', '*/*.t' ) ); | ||
} | ||
|
||
use Parrot::Test::Harness | ||
language => 'eclectus', | ||
exec => ($^O eq 'MSWin32') | ||
? [ 'csi', '-R', 'alexpander', '-i', '-k', 'none', '-I', 'riaxpander', | ||
'-e', '(load "chicken/prelude.scm")', '-s' ] | ||
: [ 'gosh', '-fcase-fold', '-I', '.', '-I', 'riaxpander', '-l', 'gauche/prelude.scm' ], | ||
files => [ 't/scheme/*.t' ]; | ||
my $exec_sub | ||
= sub { | ||
my ( $harness, $test_file ) = @_; | ||
|
||
|
||
# the directory t/pmc contains only PIR test files | ||
return [ "$path_to_parrot/parrot$PConfig{exe}", $test_file ] if $test_file =~ m!t/pmc/.*[.]t$!; | ||
|
||
# the directory t/scheme contains only test scripts written in scheme | ||
if ( $test_file =~ m!t/in_php/.*[.]t$! ) { | ||
if ($^O eq 'MSWin32') { | ||
return [ 'csi', '-R', 'alexpander', '-i', '-k', 'none', '-I', 'riaxpander', | ||
'-e', '(load "chicken/prelude.scm")', '-s', $test_file ]; | ||
} | ||
else { | ||
return [ 'gosh', '-fcase-fold', '-I', '.', '-I', 'riaxpander', | ||
'-l', 'gauche/prelude.scm', $test_file ]; | ||
} | ||
} | ||
|
||
# all other directories contain test scripts written in Perl | ||
return [ $PConfig{perl}, $test_file ]; | ||
}; | ||
if ( $archive_flag ) { | ||
my %env_data = Parrot::Harness::Smoke::collect_test_environment_data(); | ||
|
||
my $report_file = ['pipp_test_run.tar.gz']; | ||
my $harness = TAP::Harness::Archive->new( | ||
{ | ||
exec => $exec_sub, | ||
verbosity => $verbosity, | ||
archive => $report_file->[0], | ||
merge => 1, | ||
extra_properties => \%env_data, | ||
} | ||
); | ||
$harness->runtests(@files); | ||
|
||
if ( $send_to_smolder_flag ) { | ||
$env_data{report_file} = $report_file; | ||
$env_data{project_id} = 10; | ||
Parrot::Harness::Smoke::send_archive_to_smolder(%env_data); | ||
} | ||
} else { | ||
my $harness = TAP::Harness->new( | ||
{ | ||
exec => $exec_sub, | ||
verbosity => $verbosity, | ||
} | ||
); | ||
$harness->runtests(@files); | ||
} | ||
} | ||
|
||
=head1 SEE ALSO | ||
|
||
F<languages/perl6/t/harness> | ||
F<languages/t/harness> | ||
F<lib/Parrot/Test/Harness> | ||
F<languages/pipp/t/harness> | ||
|
||
=head1 AUTHOR | ||
|
||
Bernhard Schmalhofer - <Bernhard.Schmalhofer@gmx.de> | ||
|
||
=cut | ||
|
||
# Local Variables: | ||
# mode: cperl | ||
# cperl-indent-level: 4 | ||
# fill-column: 100 | ||
# End: | ||
# vim: expandtab shiftwidth=4: |