# New Ticket Created by "Jonathan Leto" # Please include the string: [perl #75650] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=75650 >
Howdy, I have attached a small patch that adds a test for loading perl6.pbc via load_bytecode in PIR. It required making t/harness a bit smarter, so that it runs .pir files with the Parrot that was used during compilation. The Makefile passes the environment variable PARROT to the call of t/harness, so that it knows the correct binary to use. If the PARROT environment variable is not set (such as when run via prove or perl t/harness) it uses "parrot_config bindir". Duke -- Jonathan "Duke" Leto jonat...@leto.net http://leto.net
>From b45dd1f7b4a896c727500b64a2e17645b30f073b Mon Sep 17 00:00:00 2001 From: Duke Leto <jonat...@leto.net> Date: Wed, 9 Jun 2010 13:44:41 -0700 Subject: [PATCH] Add test for loading perl6.pbc bytecode --- build/Makefile.in | 2 +- t/02-embed/01-load.pir | 29 +++++++++++++++++++++++++++++ t/harness | 14 +++++++++++++- 3 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 t/02-embed/01-load.pir diff --git a/build/Makefile.in b/build/Makefile.in index 48eea9b..4424ede 100644 --- a/build/Makefile.in +++ b/build/Makefile.in @@ -395,7 +395,7 @@ test : coretest fulltest: coretest spectest coretest: Test.pir $(PERL6_EXE) - $(PERL) t/harness t/00-parrot t/01-sanity + PARROT=$(PARROT) $(PERL) t/harness t/00-parrot t/01-sanity t/02-embed/01-load.pir # Run the spectests that we know work. spectest_regression: spectest diff --git a/t/02-embed/01-load.pir b/t/02-embed/01-load.pir new file mode 100644 index 0000000..f851d98 --- /dev/null +++ b/t/02-embed/01-load.pir @@ -0,0 +1,29 @@ +=head1 NAME + +t/02-embed/01-load.pir - Tests loading of bytecode + +=head1 SYNOPSIS + + % perl t/harness t/02-embed/01-load.pir + +=head1 DESCRIPTION + +Tests the loading of perl6.pbc + +=cut + +.sub 'main' :main + .include 'test_more.pir' + + plan(1) + + test_load() +.end + +.sub test_load + lives_ok(<<'CODE',"can load_bytecode perl6.pbc") +.sub main + load_bytecode "perl6.pbc" +.end +CODE +.end diff --git a/t/harness b/t/harness index 73cd653..dcd2579 100644 --- a/t/harness +++ b/t/harness @@ -68,7 +68,19 @@ if ($archive) { if (eval "require $tap_harness_class;") { my %harness_options = ( - exec => ['./perl6'], + # We assume that .t files are Perl 6 + # and run .pir files with Parrot that we were configured with + exec => sub { + my ( $harness, $test_file ) = @_; + my $parrot = $ENV{PARROT}; + unless ($parrot) { + my $bindir = `parrot_config bindir`; + chomp $bindir; + $parrot = File::Spec->catfile($bindir, 'parrot'); + } + return ['./perl6', $test_file ] if $test_file =~ /[.]t$/; + return [ $parrot, $test_file ] if $test_file =~ /[.]pir$/; + }, verbosity => 0+$Test::Harness::verbose, jobs => $ENV{TEST_JOBS} || $jobs || 1, ignore_exit => 1, -- 1.7.0.4