Change 35028 by [EMAIL PROTECTED] on 2008/12/06 01:23:02 Integrate: [ 34148] Subject: [PATCH] watchdog() some IO tests From: "Jerry D. Hedden" <[EMAIL PROTECTED]> Date: Fri, 11 Jul 2008 12:08:51 -0400 Message-ID: <[EMAIL PROTECTED]> [ 34155] Subject: [PATCH] Add watchdog() call to ext/IO/t/io_multihomed.t From: "Jerry D. Hedden" <[EMAIL PROTECTED]> Date: Wed, 23 Jul 2008 12:20:55 -0400 Message-ID: <[EMAIL PROTECTED]>
Affected files ... ... //depot/maint-5.10/perl/ext/IO/t/io_linenum.t#2 integrate ... //depot/maint-5.10/perl/ext/IO/t/io_multihomed.t#2 integrate ... //depot/maint-5.10/perl/ext/IO/t/io_udp.t#2 integrate Differences ... ==== //depot/maint-5.10/perl/ext/IO/t/io_linenum.t#2 (xtext) ==== Index: perl/ext/IO/t/io_linenum.t --- perl/ext/IO/t/io_linenum.t#1~32694~ 2007-12-22 01:23:09.000000000 -0800 +++ perl/ext/IO/t/io_linenum.t 2008-12-05 17:23:02.000000000 -0800 @@ -13,6 +13,13 @@ @INC = '../lib'; } require strict; import strict; + + # Import test.pl into its own package + { + package TestPL; + require($ENV{PERL_CORE} ? './test.pl' : './t/test.pl'); + TestPL::watchdog(15); + } } use Test; ==== //depot/maint-5.10/perl/ext/IO/t/io_multihomed.t#2 (text) ==== Index: perl/ext/IO/t/io_multihomed.t --- perl/ext/IO/t/io_multihomed.t#1~32694~ 2007-12-22 01:23:09.000000000 -0800 +++ perl/ext/IO/t/io_multihomed.t 2008-12-05 17:23:02.000000000 -0800 @@ -5,11 +5,10 @@ chdir 't' if -d 't'; @INC = '../lib'; } -} -use Config; + require($ENV{PERL_CORE} ? './test.pl' : './t/test.pl'); -BEGIN { + use Config; my $can_fork = $Config{d_fork} || (($^O eq 'MSWin32' || $^O eq 'NetWare') and $Config{useithreads} and @@ -25,20 +24,13 @@ elsif (!$can_fork) { $reason = 'no fork'; } - if ($reason) { - print "1..0 # Skip: $reason\n"; - exit 0; - } + skip_all($reason) if $reason; } $| = 1; print "1..8\n"; - -eval { - $SIG{ALRM} = sub { die; }; - alarm 60; -}; +watchdog(15); package Multi; require IO::Socket::INET; ==== //depot/maint-5.10/perl/ext/IO/t/io_udp.t#2 (xtext) ==== Index: perl/ext/IO/t/io_udp.t --- perl/ext/IO/t/io_udp.t#1~32694~ 2007-12-22 01:23:09.000000000 -0800 +++ perl/ext/IO/t/io_udp.t 2008-12-05 17:23:02.000000000 -0800 @@ -5,13 +5,11 @@ chdir 't' if -d 't'; @INC = '../lib'; } -} -use Config; + require($ENV{PERL_CORE} ? './test.pl' : './t/test.pl'); -BEGIN { + use Config; my $reason; - if ($ENV{PERL_CORE} and $Config{'extensions'} !~ /\bSocket\b/) { $reason = 'Socket was not built'; } @@ -22,10 +20,7 @@ $reason = "unknown *FIXME*"; } undef $reason if $^O eq 'VMS' and $Config{d_socket}; - if ($reason) { - print "1..0 # Skip: $reason\n"; - exit 0; - } + skip_all($reason) if $reason; } sub compare_addr { @@ -49,8 +44,8 @@ "$a[0]$a[1]" eq "$b[0]$b[1]"; } -$| = 1; -print "1..7\n"; +plan(7); +watchdog(15); use Socket; use IO::Socket qw(AF_INET SOCK_DGRAM INADDR_ANY); @@ -58,35 +53,32 @@ $udpa = IO::Socket::INET->new(Proto => 'udp', LocalAddr => 'localhost') || IO::Socket::INET->new(Proto => 'udp', LocalAddr => '127.0.0.1') or die "$! (maybe your system does not have a localhost at all, 'localhost' or 127.0.0.1)"; - -print "ok 1\n"; +ok(1); $udpb = IO::Socket::INET->new(Proto => 'udp', LocalAddr => 'localhost') || IO::Socket::INET->new(Proto => 'udp', LocalAddr => '127.0.0.1') or die "$! (maybe your system does not have a localhost at all, 'localhost' or 127.0.0.1)"; +ok(1); -print "ok 2\n"; +$udpa->send('BORK', 0, $udpb->sockname); -$udpa->send("ok 4\n",0,$udpb->sockname); +ok(compare_addr($udpa->peername,$udpb->sockname, 'peername', 'sockname')); -print "not " - unless compare_addr($udpa->peername,$udpb->sockname, 'peername', 'sockname'); -print "ok 3\n"; - -my $where = $udpb->recv($buf="",5); -print $buf; +my $where = $udpb->recv($buf="", 4); +is($buf, 'BORK'); my @xtra = (); -unless(compare_addr($where,$udpa->sockname, 'recv name', 'sockname')) { - print "not "; - @xtra = (0,$udpa->sockname); +if (! ok(compare_addr($where,$udpa->sockname, 'recv name', 'sockname'))) { + @xtra = (0, $udpa->sockname); } -print "ok 5\n"; -$udpb->send("ok 6\n",@xtra); -$udpa->recv($buf="",5); -print $buf; +$udpb->send('FOObar', @xtra); +$udpa->recv($buf="", 6); +is($buf, 'FOObar'); + +ok(! $udpa->connected); + +exit(0); -print "not " if $udpa->connected; -print "ok 7\n"; +# EOF End of Patch.