I have perl5.001m installed on both a HP-UX box and a machine running SunOS.
Also perl 4.036 is running on the sun. Test 2 fails on both perls on the Sun
but not the HP. I'm not asking for help with this, but you may want to
include these tests or some variation in the make test suite.
-yary
#!./perl
print "1..4\n";
# Test the alarm mechanism
sub alarm {$wentoff = 1;}
$SIG{'ALRM'}='alarm';
alarm 2;
$interval = sleep 5;
if ($interval >= 2 && $interval <= 3) {print "ok 1\n";}
else {print "not ok 1 '$interval' should be 2 or 3 seconds\n";}
if ($wentoff) {print "ok 2\n";}
else {print "not ok 2 The alarm signal handler was not called.\n";}
# Do some testing of select (and time)
$start = time;
($num, $timeleft) = select (undef, undef, undef, 1.5);
$interval = time - $start;
if ($timeleft == 1.5 || $timeleft == 0) {print "ok 3\n";}
else {print "not ok 3 '$timeleft' should be 0 or 1.5 seconds\n";}
if ($interval >= 1 && $interval <= 2) {print "ok 4\n";}
else {print "not ok 4 select should have waited between 1 and 2 seconds, not
$interval seconds\n";}
Also perl 4.036 is running on the sun. Test 2 fails on both perls on the Sun
but not the HP. I'm not asking for help with this, but you may want to
include these tests or some variation in the make test suite.
-yary
#!./perl
print "1..4\n";
# Test the alarm mechanism
sub alarm {$wentoff = 1;}
$SIG{'ALRM'}='alarm';
alarm 2;
$interval = sleep 5;
if ($interval >= 2 && $interval <= 3) {print "ok 1\n";}
else {print "not ok 1 '$interval' should be 2 or 3 seconds\n";}
if ($wentoff) {print "ok 2\n";}
else {print "not ok 2 The alarm signal handler was not called.\n";}
# Do some testing of select (and time)
$start = time;
($num, $timeleft) = select (undef, undef, undef, 1.5);
$interval = time - $start;
if ($timeleft == 1.5 || $timeleft == 0) {print "ok 3\n";}
else {print "not ok 3 '$timeleft' should be 0 or 1.5 seconds\n";}
if ($interval >= 1 && $interval <= 2) {print "ok 4\n";}
else {print "not ok 4 select should have waited between 1 and 2 seconds, not
$interval seconds\n";}