1 # Copyright (C) 2005-2007, The Perl Foundation.
6 languages/lua/t/harness - A harness for Parrot Lua
10 cd languages && perl -I../lib -Ilua/t lua/t/harness --files
12 cd languages && perl -I../lib -Ilua/t lua/t/harness
14 cd languages && perl -I../lib -Ilua/t lua/t/harness lua/t/examples.t
16 cd languages && perl -I../lib lua/t/harness lua/t/pmc/nil.t
20 If I'm called with a single
21 argument of "--files", I just return a list of files to process.
22 This list is one per line, and is relative to the languages dir.
24 If I'm called with no args, I run the complete suite.
26 If I'm called with "--use-lua", I run with the original C<lua>
27 in order to valid of the test suite.
29 If I'm called with "--use-luac-pl", I run with C<luac.pl> (the Lua to PIR
30 compiler written in Perl5).
32 If I'm called with "--use-lua-pbc", I run with C<lua.pbc> (the Lua interpreter
35 Otherwise I run the tests that were passed on the command line.
52 my ($use_orig_lua, $use_luac_pl, $use_lua_pbc);
54 'files' => \$opt_files,
55 'use-lua' => \$use_orig_lua,
56 'use-luac-pl' => \$use_luac_pl,
57 'use-lua-pbc' => \$use_lua_pbc,
62 # Only the Makefile in 'parrot/languages' uses --files
63 my $dir = File::Spec->catfile( $language, 't' );
64 my @files = glob( File::Spec->catfile( $dir, 'pmc', '*.t' ) );
65 push @files, glob( File::Spec->catfile( $dir, 'type', '*.t' ) );
66 push @files, glob( File::Spec->catfile( $dir, '*.t' ) );
67 print join( "\n", @files );
68 print "\n" if scalar(@files);
73 if ( scalar(@ARGV) ) {
75 # Someone specified tests for me to run.
76 @files = grep { -f $_ } @ARGV;
79 ( undef, undef, my $current_dir )
80 = File::Spec->splitpath( Cwd::getcwd() );
82 if ( $current_dir eq 'languages' ) {
83 $dir = File::Spec->catfile( $language, 't' );
85 elsif ( $current_dir eq $language ) {
89 @files = glob( File::Spec->catfile( $dir, '*.t' ) );
90 push @files, glob( File::Spec->catfile( $dir, 'pmc', '*.t' ) )
91 unless ($use_orig_lua);
92 push @files, glob( File::Spec->catfile( $dir, 'type', '*.t' ) )
93 unless ($use_orig_lua);
98 $ENV{PARROT_LUA_TEST_PROG} = 'lua';
100 elsif ($use_luac_pl) {
101 $ENV{PARROT_LUA_TEST_PROG} = 'luac.pl';
103 elsif ($use_lua_pbc) {
104 $ENV{PARROT_LUA_TEST_PROG} = 'lua.pbc';
107 Test::Harness::runtests(@files) if scalar(@files);
112 Mostly taken from F<languages/bc/t/harness>.
116 F<languages/tcl/t/harness>, F<languages/scheme/t/harness>, F<languages/m4/t/harness>, F<languages/python/t/harness>
126 # cperl-indent-level: 4
129 # vim: expandtab shiftwidth=4: