Author: fperrad
Date: Thu May 31 08:06:42 2007
New Revision: 18702
Modified:
trunk/languages/lua/t/Parrot/Test/Lua.pm
trunk/languages/lua/t/alarm.t
trunk/languages/lua/t/harness
trunk/languages/lua/t/io.t
trunk/languages/lua/t/lfs.t
trunk/languages/lua/t/package.t
trunk/languages/lua/t/shootout.t
Log:
[Lua]
- update test tools for lua.pbc
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 Thu May 31 08:06:42 2007
@@ -51,7 +51,7 @@
my $params = $options{params} || q{};
# flatten filenames (don't use directories)
- my $lua_test = $ENV{PARROT_LUA_TEST_PROG} || q{};
+ my $lua_test = $ENV{PARROT_LUA_TEST_PROG} || 'luac.pl';
my $lang_fn = Parrot::Test::per_test( '.lua', $count );
my $pir_fn = Parrot::Test::per_test( '.pir', $count );
my $lua_out_fn =
@@ -59,29 +59,24 @@
my $test_prog_args = $ENV{TEST_PROG_ARGS} || q{};
my @test_prog;
if ( $lua_test eq 'lua' ) {
- @test_prog = ( "$ENV{PARROT_LUA_TEST_PROG} ${test_prog_args}
languages/${lang_fn} $params", );
- }
- elsif ( $lua_test eq 'monkey' ) {
@test_prog = (
- "monkey -o languages/${pir_fn} languages/${lang_fn}",
- "$self->{parrot} languages/${pir_fn}",
+ "$ENV{PARROT_LUA_TEST_PROG} ${test_prog_args}
languages/${lang_fn} $params",
);
}
- elsif ( $lua_test eq 'lua2pir' ) {
+ elsif ( $lua_test eq 'luac.pl' ) {
@test_prog = (
- "luac languages/${lang_fn}",
- "l2p -o languages/${pir_fn} > nul",
- "$self->{parrot} languages/${pir_fn}",
+ "perl -Ilanguages/lua languages/lua/luac.pl
languages/${lang_fn}",
+ "$self->{parrot} --no-gc languages/${pir_fn} $params",
);
}
- else {
+ elsif ( $lua_test eq 'lua.pbc' ) {
@test_prog = (
- "perl -Ilanguages/lua languages/lua/luac.pl
languages/${lang_fn}",
- "$self->{parrot} --no-gc languages/${pir_fn} $params",
-
- # "$self->{parrot} languages/lua/lua.pbc languages/${lang_fn}",
+ "$self->{parrot} --no-gc languages/lua/lua.pbc
languages/${lang_fn}",
);
}
+ else {
+ die "unknown option : $lua_test\n";
+ }
# This does not create byte code, but lua code
Parrot::Test::write_code_to_file( $code, $lang_fn );
Modified: trunk/languages/lua/t/alarm.t
==============================================================================
--- trunk/languages/lua/t/alarm.t (original)
+++ trunk/languages/lua/t/alarm.t Thu May 31 08:06:42 2007
@@ -25,7 +25,7 @@
use Parrot::Test;
use Test::More;
-if ( exists $ENV{PARROT_LUA_TEST_PROG} ) {
+if ( ($ENV{PARROT_LUA_TEST_PROG} || q{}) eq 'lua' ) {
plan skip_all => "parrot only";
}
else {
Modified: trunk/languages/lua/t/harness
==============================================================================
--- trunk/languages/lua/t/harness (original)
+++ trunk/languages/lua/t/harness Thu May 31 08:06:42 2007
@@ -26,10 +26,11 @@
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-luac-pl", I run with C<luac.pl> (the Lua to PIR
+compiler written in Perl5).
-If I'm called with "--use-lua2pir", I run with C<lua2pir> (and just after
-C<luac>).
+If I'm called with "--use-lua-pbc", I run with C<lua.pbc> (the Lua interpreter
+written in PIR).
Otherwise I run the tests that were passed on the command line.
@@ -48,12 +49,12 @@
my $language = 'lua';
my $opt_files;
-my ($use_orig_lua, $use_monkey, $use_lua2pir);
+my ($use_orig_lua, $use_luac_pl, $use_lua_pbc);
GetOptions(
'files' => \$opt_files,
'use-lua' => \$use_orig_lua,
- 'use-monkey' => \$use_monkey,
- 'use-lua2pir' => \$use_lua2pir,
+ 'use-luac-pl' => \$use_luac_pl,
+ 'use-lua-pbc' => \$use_lua_pbc,
);
if ( $opt_files ) {
@@ -96,15 +97,13 @@
if ($use_orig_lua) {
$ENV{PARROT_LUA_TEST_PROG} = 'lua';
}
- elsif ($use_monkey) {
- $ENV{PARROT_LUA_TEST_PROG} = 'monkey';
+ elsif ($use_luac_pl) {
+ $ENV{PARROT_LUA_TEST_PROG} = 'luac.pl';
}
- elsif ($use_lua2pir) {
- $ENV{PARROT_LUA_TEST_PROG} = 'lua2pir';
- }
- else {
- $ENV{PARROT_LUA_TEST_PROG} = q{};
+ elsif ($use_lua_pbc) {
+ $ENV{PARROT_LUA_TEST_PROG} = 'lua.pbc';
}
+
Test::Harness::runtests(@files) if scalar(@files);
}
Modified: trunk/languages/lua/t/io.t
==============================================================================
--- trunk/languages/lua/t/io.t (original)
+++ trunk/languages/lua/t/io.t Thu May 31 08:06:42 2007
@@ -377,7 +377,7 @@
SKIP:
{
-skip('only with Parrot', 1) if (exists $ENV{PARROT_LUA_TEST_PROG});
+skip('only with Parrot', 1) if (($ENV{PARROT_LUA_TEST_PROG} || q{}) eq 'lua');
language_output_is( 'lua', << 'CODE', << 'OUTPUT', 'file:__gc' );
function inner ()
Modified: trunk/languages/lua/t/lfs.t
==============================================================================
--- trunk/languages/lua/t/lfs.t (original)
+++ trunk/languages/lua/t/lfs.t Thu May 31 08:06:42 2007
@@ -178,7 +178,7 @@
SKIP:
{
-skip('only with Parrot', 1) if (exists $ENV{PARROT_LUA_TEST_PROG});
+skip('only with Parrot', 1) if (($ENV{PARROT_LUA_TEST_PROG} || q{}) eq 'lua');
language_output_like( 'lua', <<'CODE', <<'OUT', 'function lfs.attributes
(invalid)' );
require "lfs"
Modified: trunk/languages/lua/t/package.t
==============================================================================
--- trunk/languages/lua/t/package.t (original)
+++ trunk/languages/lua/t/package.t Thu May 31 08:06:42 2007
@@ -184,7 +184,7 @@
SKIP:
{
-skip('only with Parrot', 1) if (exists $ENV{PARROT_LUA_TEST_PROG});
+skip('only with Parrot', 1) if (($ENV{PARROT_LUA_TEST_PROG} || q{}) eq 'lua');
unlink('../mod_foo.pbc') if ( -f '../mod_foo.pbc' );
unlink('../mod_foo.pir') if ( -f '../mod_foo.pir' );
@@ -262,7 +262,7 @@
SKIP:
{
-skip('only with Parrot', 3) if (exists $ENV{PARROT_LUA_TEST_PROG});
+skip('only with Parrot', 3) if (($ENV{PARROT_LUA_TEST_PROG} || q{}) eq 'lua');
delete $ENV{LUA_PBCPATH};
language_output_is( 'lua', << 'CODE', << 'OUTPUT', 'table package.pbcpath' );
Modified: trunk/languages/lua/t/shootout.t
==============================================================================
--- trunk/languages/lua/t/shootout.t (original)
+++ trunk/languages/lua/t/shootout.t Thu May 31 08:06:42 2007
@@ -121,7 +121,7 @@
SKIP:
{
- skip('low memory', 1) unless (exists $ENV{PARROT_LUA_TEST_PROG});
+ skip('low memory', 1) unless (($ENV{PARROT_LUA_TEST_PROG} || q{}) eq
'lua');
$code = Parrot::Test::slurp_file(File::Spec->catfile( @dir, 'recursive.lua' ));
$out = Parrot::Test::slurp_file(File::Spec->catfile( @dir,
'recursive-output.txt' ));
@@ -153,7 +153,7 @@
SKIP:
{
- skip('maximum recursion depth exceeded', 1) unless (exists
$ENV{PARROT_LUA_TEST_PROG});
+ skip('maximum recursion depth exceeded', 1) unless
(($ENV{PARROT_LUA_TEST_PROG} || q{}) eq 'lua');
$code = Parrot::Test::slurp_file(File::Spec->catfile( @dir,
'message.lua-2.lua' ));
$out = Parrot::Test::slurp_file(File::Spec->catfile( @dir,
'message-output.txt' ));
@@ -190,7 +190,7 @@
SKIP:
{
- skip('maximum recursion depth exceeded', 1) unless (exists
$ENV{PARROT_LUA_TEST_PROG});
+ skip('maximum recursion depth exceeded', 1) unless
(($ENV{PARROT_LUA_TEST_PROG} || q{}) eq 'lua');
$code = Parrot::Test::slurp_file(File::Spec->catfile( @dir,
'revcomp.lua-3.lua' ));
$out = Parrot::Test::slurp_file(File::Spec->catfile( @dir,
'revcomp-output.txt' ));
@@ -205,7 +205,7 @@
SKIP:
{
- skip('low memory', 1) unless (exists $ENV{PARROT_LUA_TEST_PROG});
+ skip('low memory', 1) unless (($ENV{PARROT_LUA_TEST_PROG} || q{}) eq
'lua');
$code = Parrot::Test::slurp_file(File::Spec->catfile( @dir,
'binarytrees.lua-3.lua' ));
$out = Parrot::Test::slurp_file(File::Spec->catfile( @dir,
'binarytrees-output.txt' ));