Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Allow building and pass some tests with '--gen-parrot'
  • Loading branch information
bschmalhofer committed Mar 1, 2009
1 parent fa3dd9f commit de1ee10
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 32 deletions.
2 changes: 1 addition & 1 deletion lib/Parrot/Test/Pipp/PCT.pm
Expand Up @@ -27,7 +27,7 @@ sub get_test_prog {
my $lang_fn = Parrot::Test::per_test( '.php', $count );
$lang_fn =~ s!^pipp/!!; # fix for unified languages testing

return "$self->{relpath}/parrot $self->{relpath}/languages/pipp/pipp.pbc ${lang_fn}";
return "parrot/parrot pipp.pbc $lang_fn";
}

# never skip the reference implementation
Expand Down
3 changes: 1 addition & 2 deletions lib/Parrot/Test/Pipp/Phc.pm
Expand Up @@ -25,9 +25,8 @@ sub get_test_prog {
my ( $count, $options ) = @_;

my $lang_fn = Parrot::Test::per_test( '.php', $count );
$lang_fn =~ s!^pipp/!!; # fix for unified languages testing

return "$self->{relpath}/parrot $self->{relpath}/languages/pipp/pipp.pbc --variant=phc $lang_fn";
return "parrot/parrot pipp.pbc --variant=phc $lang_fn";
}

# never skip the reference implementation
Expand Down
14 changes: 3 additions & 11 deletions pipp.pir
Expand Up @@ -5,8 +5,6 @@ pipp.pir - driver program for Pipp, PCT and PHC variants

=head1 SYNOPSIS

cd languages/pipp

make pipp

./pipp t/in_php/01_sea_only.t
Expand Down Expand Up @@ -80,12 +78,8 @@ Bernhard Schmalhofer - L<Bernhard.Schmalhofer@gmx.de>
load_bytecode 'P6object.pbc'

# determine location of libs from the Parrot config
.local pmc cfg
$P0 = get_root_global ['parrot'], '_config'
cfg = $P0()
.local string lib_dir, pbc_fn
lib_dir = cfg['build_dir']
lib_dir .= '/languages/pipp/library'
lib_dir = 'library'

pbc_fn = concat lib_dir, '/pipplib.pbc'
load_bytecode pbc_fn
Expand Down Expand Up @@ -205,7 +199,7 @@ VARIANT_PCT:

VARIANT_PHC:
.local string phc_src_dir
phc_src_dir = concat build_dir, '/languages/pipp/src/phc'
phc_src_dir = 'src/phc'

# work with the XML generated by PHC, the PHP Compiler
err_msg = 'Creating XML-AST with phc failed'
Expand Down Expand Up @@ -257,9 +251,7 @@ ERROR:
# compile NQP to PIR
.local string pir_fn, cmd
.local int ret
pir_fn = build_dir
pir_fn .= '/languages/pipp/'
pir_fn .= nqp_source_fn
pir_fn = nqp_source_fn
substr pir_fn, -3, 3, 'pir' # change extension from '.nqp' to '.pir'
cmd = build_dir
cmd .= '/parrot '
Expand Down
26 changes: 8 additions & 18 deletions t/harness
Expand Up @@ -6,22 +6,16 @@ languages/pipp/t/harness - A harness for Pipp
=head1 SYNOPSIS
cd languages && perl pipp/t/harness --files --master
perl t/harness
cd languages/pipp && perl t/harness
perl t/harness --with-phc
cd languages/pipp && perl t/harness --with-phc
perl t/harness --with-pct
cd languages/pipp && perl t/harness --with-pct
cd languages/pipp && perl t/harness --verbose t/hello.t
perl t/harness --verbose t/hello.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.
Expand All @@ -35,7 +29,7 @@ Parrot Compiler Toolkit.
use strict;
use warnings;
use FindBin ();
use lib "$FindBin::Bin/../../../lib", "$FindBin::Bin/../lib";
use lib "$FindBin::Bin/../../../lib", "$FindBin::Bin/../lib", "$FindBin::Bin/../parrot/lib";

use Cwd ();
use File::Spec ();
Expand All @@ -46,11 +40,10 @@ use Getopt::Long;
use Parrot::Harness::Smoke;
use Parrot::Test;

my ( $files_flag, $master_flag, $send_to_smolder_flag, $archive_flag, $verbose_flag );
my ( $files_flag, $send_to_smolder_flag, $archive_flag, $verbose_flag );
my ( $php_flag, $pct_flag, $phc_flag);
GetOptions(
'files' => \$files_flag,
'master' => \$master_flag, # unused, but passed by languages/t/harness
'send-to-smolder' => \$send_to_smolder_flag,
'archive' => \$archive_flag,
'verbose' => \$verbose_flag,
Expand All @@ -73,7 +66,7 @@ if ( $files_flag ) {
}
else {
my $path_to_parrot = Parrot::Test::path_to_parrot();
my @cmd = ( "$path_to_parrot/parrot$PConfig{exe}", "$path_to_parrot/languages/pipp/pipp.pbc" );
my @cmd = ( "$path_to_parrot/parrot$PConfig{exe}", 'pipp.pbc' );
$ENV{PARROT_PIPP_TEST_MODULE} = 'Parrot::Test::Pipp::PCT';

if ( $php_flag ) {
Expand All @@ -95,10 +88,7 @@ else {
}
else {
( undef, undef, my $current_dir ) = File::Spec->splitpath( Cwd::getcwd() );
if ( $current_dir eq 'languages' ) {
@files = glob( File::Spec->catfile( $hll, 't', '*/*.t' ) );
}
elsif ( $current_dir eq $hll ) {
if ( $current_dir eq $hll ) {
@files = glob( File::Spec->catfile( 't', '*/*.t' ) );
}
else {
Expand Down

0 comments on commit de1ee10

Please sign in to comment.