cvsuser 04/10/12 02:35:14
Modified: lib/Parrot Test.pm
t/pmc signal.t
Log:
[perl #31930] [PATCH] Use shared libparrot in src tests, if available
This patch causes src tests to use the shared libparrot, if it exists.
This speeds them up on my system by almost a factor of 3 (due to less
copying, since the .a is so large).
[perl #31932] [PATCH] t/pmc/signal.t (more accuracy finding process to HUP)
Just a slight improvement in the logic used to find the PID of the
process to signal. (For me, it killed t/harness once, rather than the
test process.)
[ converted to a sub and used twice --leo ]
Courtesy of Jeff Clites <[EMAIL PROTECTED]>
Revision Changes Path
1.59 +13 -3 parrot/lib/Parrot/Test.pm
Index: Test.pm
===================================================================
RCS file: /cvs/public/parrot/lib/Parrot/Test.pm,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -w -r1.58 -r1.59
--- Test.pm 3 Jun 2004 07:35:37 -0000 1.58
+++ Test.pm 12 Oct 2004 09:35:12 -0000 1.59
@@ -1,5 +1,5 @@
# Copyright: 2004 The Perl Foundation. All Rights Reserved.
-# $Id: Test.pm,v 1.58 2004/06/03 07:35:37 leo Exp $
+# $Id: Test.pm,v 1.59 2004/10/12 09:35:12 leo Exp $
=head1 NAME
@@ -328,8 +328,18 @@
print SOURCE $source;
close SOURCE;
- my $libparrot = $PConfig{blib_lib_libparrot_a};
- $libparrot =~ s/\$\(A\)/$PConfig{a}/;
+ (my $libparrot_root = $PConfig{blib_lib_libparrot_a}) =~ s/\$\(A\)//;
+ my $libparrot_dynamic = $libparrot_root.$PConfig{share_ext};
+
+ my $libparrot;
+
+ # use shared library version if available
+ if( -e $libparrot_dynamic ) {
+ $libparrot = '-Lblib/lib -lparrot';
+ } else {
+ $libparrot = $libparrot_root.$PConfig{a};
+ }
+
my $iculibs = $PConfig{blib_lib_libsicuuc_a}."
".$PConfig{blib_lib_libsicudata_a};
$iculibs =~ s/\$\(A\)/$PConfig{a}/g;
1.13 +8 -4 parrot/t/pmc/signal.t
Index: signal.t
===================================================================
RCS file: /cvs/public/parrot/t/pmc/signal.t,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -w -r1.12 -r1.13
--- signal.t 7 Oct 2004 07:26:34 -0000 1.12
+++ signal.t 12 Oct 2004 09:35:14 -0000 1.13
@@ -1,6 +1,6 @@
#! perl -w
# Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
-# $Id: signal.t,v 1.12 2004/10/07 07:26:34 leo Exp $
+# $Id: signal.t,v 1.13 2004/10/12 09:35:14 leo Exp $
=head1 NAME
@@ -12,7 +12,7 @@
=head1 DESCRIPTION
-Tests signal handling. All test are skipped unless running on Linux.
+Tests signal handling.
=cut
@@ -45,10 +45,14 @@
my $pid;
+sub parrot_pids {
+ grep { !/harness/ && !/sh -c/ } `ps axw | grep '[p]arrot'`;
+}
+
sub send_SIGHUP {
$SIG{ALRM} = sub {
# get PID of parrot
- my @ps = `ps axw | grep [p]arrot`;
+ my @ps = parrot_pids;
die 'no output from ps' unless @ps;
# the IO thread parrot process
# on linux 2.2.x there are 4 processes, last is the IO thread
@@ -68,7 +72,7 @@
sub check_running {
select undef, undef, undef, 0.1;
- my @ps = `ps axw | grep [p]arrot`;
+ my @ps = parrot_pids;
my $thread = pop @ps;
if ($thread =~ /^\s*(\d+)/ && $1 == $pid) {
ok(0, "parrot $pid still running");