Author: fperrad
Date: Wed Jan 11 23:07:11 2006
New Revision: 11117
Modified:
trunk/languages/lua/t/Parrot/Test/Lua.pm
trunk/languages/lua/t/harness
Log:
Lua:
t/harness supports monkey and lua2pir
Modified: trunk/languages/lua/t/Parrot/Test/Lua.pm
==============================================================================
--- trunk/languages/lua/t/Parrot/Test/Lua.pm (original)
+++ trunk/languages/lua/t/Parrot/Test/Lua.pm Wed Jan 11 23:07:11 2006
@@ -46,14 +46,29 @@ foreach my $func ( keys %language_test_m
my $count = $self->{builder}->current_test + 1;
# flatten filenames (don't use directories)
+ my $lua_test = $ENV{PARROT_LUA_TEST_PROG} || '';
my $lang_fn = Parrot::Test::per_test( '.lua', $count );
my $pir_fn = Parrot::Test::per_test( '.pir', $count );
- my $lua_out_fn = Parrot::Test::per_test(
$ENV{PARROT_LUA_TEST_PROG} ? '.orig_out' : '.parrot_out', $count );
+ my $lua_out_fn = Parrot::Test::per_test( $lua_test eq "lua" ?
'.orig_out' : '.parrot_out', $count );
my $test_prog_args = $ENV{TEST_PROG_ARGS} || '';
- my @test_prog = $ENV{PARROT_LUA_TEST_PROG} ?
- ( "$ENV{PARROT_LUA_TEST_PROG} ${test_prog_args}
languages/${lang_fn}" ):
+ my @test_prog;
+ if ($lua_test eq "lua") {
+ @test_prog =
+ ( "$ENV{PARROT_LUA_TEST_PROG} ${test_prog_args}
languages/${lang_fn}" );
+ } elsif ($lua_test eq "monkey") {
+ @test_prog =
+ ( "monkey -o languages/${pir_fn} languages/${lang_fn}",
+ "$self->{parrot} languages/${pir_fn}" );
+ } elsif ($lua_test eq "lua2pir") {
+ @test_prog =
+ ( "luac languages/${lang_fn}",
+ "l2p -o languages/${pir_fn} > nul",
+ "$self->{parrot} languages/${pir_fn}" );
+ } else {
+ @test_prog =
( "perl -Ilanguages/lua languages/lua/luac.pl
languages/${lang_fn}",
"$self->{parrot} languages/${pir_fn}" );
+ }
# This does not create byte code, but lua code
my $parrotdir = dirname( $self->{parrot} );
Modified: trunk/languages/lua/t/harness
==============================================================================
--- trunk/languages/lua/t/harness (original)
+++ trunk/languages/lua/t/harness Wed Jan 11 23:07:11 2006
@@ -23,9 +23,14 @@ This list is one per line, and is relati
If I'm called with no args, I run the complete suite.
-If I'm called with "--use-lua", I run with the original lua
+If I'm called with "--use-lua", I run with the original C<lua>
in order to valid of the test suite.
+If I'm called with "--use-monkey", I run with C<monkey>.
+
+If I'm called with "--use-lua2pir", I run with C<lua2pir> (and just after
+C<luac>).
+
Otherwise I run the tests that were passed on the command line.
=cut
@@ -51,7 +56,11 @@ if ( grep { m/^--files$/ } @ARGV ) {
my @files;
# TODO: use Getopt::Long or such
my $use_orig_lua = ( grep { m/^--use-lua$/ } @ARGV ) ? 1 : 0;
+ my $use_monkey = ( grep { m/^--use-monkey$/ } @ARGV ) ? 1 : 0;
+ my $use_lua2pir = ( grep { m/^--use-lua2pir$/ } @ARGV ) ? 1 : 0;
@ARGV = grep { ! m/^--use-lua$/ } @ARGV;
+ @ARGV = grep { ! m/^--use-monkey$/ } @ARGV;
+ @ARGV = grep { ! m/^--use-lua2pir$/ } @ARGV;
if ( scalar(@ARGV) ) {
# Someone specified tests for me to run.
@files = grep { -f $_ } @ARGV
@@ -72,6 +81,12 @@ if ( grep { m/^--files$/ } @ARGV ) {
if ( $use_orig_lua ) {
$ENV{PARROT_LUA_TEST_PROG} = 'lua';
Test::Harness::runtests( @files ) if scalar( @files );
+ } elsif ( $use_monkey ) {
+ $ENV{PARROT_LUA_TEST_PROG} = 'monkey';
+ Test::Harness::runtests( @files ) if scalar( @files );
+ } elsif ( $use_lua2pir ) {
+ $ENV{PARROT_LUA_TEST_PROG} = 'lua2pir';
+ Test::Harness::runtests( @files ) if scalar( @files );
} else {
$ENV{PARROT_LUA_TEST_PROG} = '';
Test::Harness::runtests( @files ) if scalar( @files );