From: Vincent Pit Date: Sun, 29 Jun 2008 16:37:15 +0000 (+0200) Subject: Importing IPC-MorseSignals-0.13.tar.gz X-Git-Tag: v0.13^0 X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FIPC-MorseSignals.git;a=commitdiff_plain;h=66395d4fefdc940dce749d571e5c8106f682eca4 Importing IPC-MorseSignals-0.13.tar.gz --- diff --git a/Changes b/Changes index 26d6996..986fd7c 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,15 @@ Revision history for IPC-MorseSignals +0.13 2008-03-10 15:25 UTC + + Chg : Build prerequisites are now completely separated from run-time + prerequisites. + + Doc : The usual set of POD typos. + + Tst : Changed SIGHUP handlers in the parent for SIGUSR1's. + + Tst : Changed SIGHUP handlers in the child for SIGTSTP's. + + Tst : Meaningful fork tests labels. + + Tst : More synchronization barriers. + + Tst : Safe kills. + 0.12 2008-03-09 10:20 UTC + Doc : POD tweaks. + Fix : Correct Makefile.PL die messages. diff --git a/META.yml b/META.yml index bade59b..c4bbd91 100644 --- a/META.yml +++ b/META.yml @@ -1,26 +1,22 @@ --- #YAML:1.0 name: IPC-MorseSignals -version: 0.12 +version: 0.13 abstract: Communicate between processes with Morse signals. license: perl author: - Vincent Pit -generated_by: ExtUtils::MakeMaker version 6.42 +generated_by: ExtUtils::MakeMaker version 6.44 distribution_type: module requires: Bit::MorseSignals: 0 Carp: 0 - Data::Dumper: 0 - Exporter: 0 - ExtUtils::MakeMaker: 0 POSIX: 0 - Test::More: 0 Time::HiRes: 0 - utf8: 0 meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.3.html version: 1.3 build_requires: + Config: 0 Data::Dumper: 0 Exporter: 0 ExtUtils::MakeMaker: 0 diff --git a/Makefile.PL b/Makefile.PL index a24f63f..f7ab125 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -22,6 +22,7 @@ for (qw/USR1 USR2/) { my $BUILD_REQUIRES = { 'utf8' => 0, + 'Config' => 0, 'Data::Dumper' => 0, 'Exporter' => 0, 'ExtUtils::MakeMaker' => 0, @@ -51,7 +52,6 @@ WriteMakefile( 'Carp' => 0, 'POSIX' => 0, 'Time::HiRes' => 0, - %$BUILD_REQUIRES }, dist => { PREOP => 'pod2text lib/IPC/MorseSignals.pm > $(DISTVNAME)/README; ' diff --git a/README b/README index b1ad406..215ebed 100644 --- a/README +++ b/README @@ -2,7 +2,7 @@ NAME IPC::MorseSignals - Communicate between processes with Morse signals. VERSION - Version 0.12 + Version 0.13 SYNOPSIS # In the sender process diff --git a/lib/IPC/MorseSignals.pm b/lib/IPC/MorseSignals.pm index 4433afd..7cb3928 100644 --- a/lib/IPC/MorseSignals.pm +++ b/lib/IPC/MorseSignals.pm @@ -9,11 +9,11 @@ IPC::MorseSignals - Communicate between processes with Morse signals. =head1 VERSION -Version 0.12 +Version 0.13 =cut -our $VERSION = '0.12'; +our $VERSION = '0.13'; =head1 SYNOPSIS diff --git a/lib/IPC/MorseSignals/Emitter.pm b/lib/IPC/MorseSignals/Emitter.pm index bb02ac8..940fd16 100644 --- a/lib/IPC/MorseSignals/Emitter.pm +++ b/lib/IPC/MorseSignals/Emitter.pm @@ -16,11 +16,11 @@ IPC::MorseSignals::Emitter - Base class for IPC::MorseSignals emitters. =head1 VERSION -Version 0.12 +Version 0.13 =cut -our $VERSION = '0.12'; +our $VERSION = '0.13'; =head1 SYNOPSIS diff --git a/lib/IPC/MorseSignals/Receiver.pm b/lib/IPC/MorseSignals/Receiver.pm index c6e8306..44a21b9 100644 --- a/lib/IPC/MorseSignals/Receiver.pm +++ b/lib/IPC/MorseSignals/Receiver.pm @@ -14,11 +14,11 @@ IPC::MorseSignals::Receiver - Base class for IPC::MorseSignals receivers. =head1 VERSION -Version 0.12 +Version 0.13 =cut -our $VERSION = '0.12'; +our $VERSION = '0.13'; =head1 SYNOPSIS diff --git a/t/60-fork-plain.t b/t/60-fork-plain.t index 54b73a7..a65dde8 100644 --- a/t/60-fork-plain.t +++ b/t/60-fork-plain.t @@ -19,7 +19,9 @@ my @msgs = qw/hlagh hlaghlaghlagh HLAGH HLAGHLAGHLAGH \x{0dd0}\x{00} init 6; -test 'plain' => $_ for @msgs; +for (0 .. $#msgs) { + test 'plain ' . $_ => $msgs[$_]; +} cleanup; diff --git a/t/61-fork-utf8.t b/t/61-fork-utf8.t index 8ad2011..29b1910 100644 --- a/t/61-fork-utf8.t +++ b/t/61-fork-utf8.t @@ -20,7 +20,9 @@ my @msgs = qw/€éèë 月語 x tata たTÂ/; init 6; -test 'plain' => $_ for @msgs; +for (0 .. $#msgs) { + test 'utf8 ' . $_ => $msgs[$_]; +} cleanup; diff --git a/t/62-fork-storable.t b/t/62-fork-storable.t index aeab377..6aafeeb 100644 --- a/t/62-fork-storable.t +++ b/t/62-fork-storable.t @@ -26,7 +26,9 @@ $msgs[7]->{y} = $msgs[7]; init 6; -test 'plain' => $_ for @msgs; +for (0 .. $#msgs) { + test 'storable ' . $_ => $msgs[$_]; +} cleanup; diff --git a/t/92-pod-coverage.t b/t/92-pod-coverage.t index 13665e8..b4aff52 100644 --- a/t/92-pod-coverage.t +++ b/t/92-pod-coverage.t @@ -8,16 +8,14 @@ use Test::More; # Ensure a recent version of Test::Pod::Coverage my $min_tpc = 1.08; eval "use Test::Pod::Coverage $min_tpc"; -plan skip_all => "Test::Pod::Coverage $min_tpc required for testing POD coverage" - if $@; +plan skip_all => "Test::Pod::Coverage $min_tpc required for testing POD coverage" if $@; # Test::Pod::Coverage doesn't require a minimum Pod::Coverage version, # but older versions don't recognize some common documentation styles my $min_pc = 0.18; eval "use Pod::Coverage $min_pc"; -plan skip_all => "Pod::Coverage $min_pc required for testing POD coverage" - if $@; +plan skip_all => "Pod::Coverage $min_pc required for testing POD coverage" if $@; all_pod_coverage_ok( -# also_private => [ qr/^_/ ] + { also_private => [ qr/^_/ ] } ); diff --git a/t/lib/IPC/MorseSignals/TestSuite.pm b/t/lib/IPC/MorseSignals/TestSuite.pm index e11025b..8e5900d 100644 --- a/t/lib/IPC/MorseSignals/TestSuite.pm +++ b/t/lib/IPC/MorseSignals/TestSuite.pm @@ -4,7 +4,7 @@ use strict; use warnings; use Data::Dumper; -use POSIX qw/pause SIGINT SIGTERM SIGKILL SIGHUP EXIT_FAILURE/; +use POSIX qw/pause SIGUSR1 SIGTSTP SIGKILL EXIT_FAILURE/; use IPC::MorseSignals::Emitter; use IPC::MorseSignals::Receiver; @@ -17,6 +17,9 @@ $Data::Dumper::Indent = 0; my ($lives, $pid, $rdr); +my $ready = 0; +$SIG{USR1} = sub { $ready = 1 }; + sub spawn { --$lives; die 'forked too many times' if $lives < 0; @@ -29,24 +32,30 @@ sub spawn { close $rdr or die "close() failed: $!"; select $wtr; $| = 1; - $SIG{__WARN__} = sub { print $wtr "!warn\n"; }; + my $ppid = getppid; my $rcv = new IPC::MorseSignals::Receiver \%SIG, done => sub { print $wtr Dumper($_[1]), "\n"; + kill SIGUSR1 => $ppid if $ppid; }; - my $ppid = getppid; - $SIG{ALRM} = sub { alarm 1; kill SIGHUP => $ppid }; - alarm 1; - $SIG{HUP} = sub { alarm 0; $rcv->reset }; # We can reset the alarm here. + $SIG{__WARN__} = sub { + my $warn = join '', @_; + $warn =~ s/\n\r/ /g; + print $wtr "!warn : $warn\n"; + kill SIGUSR1 => $ppid if $ppid; + }; + $SIG{TSTP} = sub { + $rcv->reset; + kill SIGUSR1 => $ppid if $ppid; + }; + print $wtr "ok\n"; pause while 1; exit EXIT_FAILURE; } - my $ready = 0; - local $SIG{HUP} = sub { $ready = 1 }; - sleep 1 until $ready; close $wtr or die "close() failed: $!"; my $oldfh = select $rdr; $| = 1; select $oldfh; + my $t = <$rdr>; } sub slaughter { @@ -54,9 +63,7 @@ sub slaughter { close $rdr or die "close() falied: $!"; undef $rdr; } - if (defined $pid) { - kill SIGINT => $pid; - kill SIGTERM => $pid; + if ($pid) { kill SIGKILL => $pid; waitpid $pid, 0; undef $pid; @@ -90,10 +97,11 @@ sub try { my $a = (int(100 * (3 * length $msg) / $speed) || 1); $a = 10 if $a > 10; alarm $a; - kill SIGHUP => $pid; $snd->post($msg); $snd->speed($speed); + $ready = 0; $snd->send($pid); + pause until $ready; $r = <$rdr>; alarm 0; }; @@ -105,7 +113,10 @@ sub try { if ($r eq $dump) { $ok = 1; } else { - kill SIGHUP => $pid; + warn $1 if $r =~ /^warn\s*:\s*(.*)/; + $ready = 0; + kill SIGTSTP => $pid if $pid; + pause until $ready; } } } @@ -133,10 +144,11 @@ TRY: my $a = (int(100 * (3 * $l) / $speed) || 1); $a = 10 if $a > 10; alarm $a; - kill SIGHUP => $pid; $snd->post($msg); $snd->speed($speed); + $ready = 0; $snd->send($pid); + pause until $ready; $r = <$rdr>; alarm 0; }; @@ -149,7 +161,9 @@ TRY: if ($r eq $dump) { ++$ok; } else { - kill SIGHUP => $pid; + $ready = 0; + kill SIGTSTP => $pid if $pid; + pause until $ready; last TRY; } }