#!./perl -w
BEGIN {
chdir 't' if -d 't';
}
}
$loaded = 1;
print "ok 1\n";
use strict;
use Config;
my $pid;
if ($have_fork) {
print "# Testing process $$\n";
print "# Starting the timer process\n";
print "# Timer process $$\n";
print "# Terminating the testing process\n";
print "# Timer process exiting\n";
exit(0);
}
} else {
}
} else {
print "# No timer process\n";
}
my $xdefine = '';
}
# Ideally, we'd like to test that the timers are rather precise.
# However, if the system is busy, there are no guarantees on how
# quickly we will return. This limit used to be 10%, but that
# was occasionally triggered falsely.
# Try 20%.
# Another possibility might be to print "ok" if the test completes fine
# with (say) 10% slosh, "skip - system may have been busy?" if the test
# completes fine with (say) 30% slosh, and fail otherwise. If you do that,
# consider changing over to test.pl at the same time.
# --A.D., Nov 27, 2001
}
sub ok {
print "ok $n\n";
}
else {
print "not ok $n\n";
}
}
skip 2..6;
}
else {
sleep 1;
"@two is not greater than @one";
}
skip 7..8;
}
else {
my $one = time;
my $two = time;
my $three = time;
skip 8;
}
else {
my $d = $f2 - $f;
}
}
# Two-arg tv_interval() is always available.
{
my $f = tv_interval [5, 100_000], [10, 500_000];
}
skip 10;
}
else {
my $f = tv_interval $r;
ok 10, $f < 2, $f;
}
skip 11;
}
else {
my $f = tv_interval $r;
}
skip 12..13;
}
else {
my $tick = 0;
my $three = time;
$tick = 0;
ok 13, 1;
}
# new test: did we even get close?
skip 14
} else {
my ($s, $n);
for my $i (1 .. 100) {
$n++;
}
# $s should be, at worst, equal to $n
# (time() may be rounding down, up, or closest)
print "# s = $s, n = $n, s/n = ", $s/$n, "\n";
}
my $has_ualarm = $Config{d_ualarm};
$has_ualarm ||= $xdefine =~ /-DHAS_UALARM/;
unless ( defined &Time::HiRes::gettimeofday
for (15..17) {
print "ok $_ # Skip: no gettimeofday or no ualarm or no usleep\n";
}
} else {
$f = time;
print "# time...$f\n";
print "ok 15\n";
$i = 5;
while ($i > 0)
{
# Whether select() gets restarted after signals is
# implementation dependent. If it is restarted, we
# will get about 3.3 seconds: 3 from the select, 0.3
# from the alarm. If this happens, let's just skip
# this particular test. --jhi
last;
}
# This test is more sensitive, so impose a softer limit.
last;
}
$ok = $i;
}
sub tick
{
$i--;
# This test is more sensitive, so impose a softer limit.
$i = 0;
}
}
}
&& eval 'Time::HiRes::ITIMER_VIRTUAL'
for (18..19) {
print "ok $_ # Skip: no virtual interval timers\n";
}
} else {
my $i = 3;
};
# Assume interval timer granularity of $limit * 0.5 seconds. Too bold?
print "ok 18\n";
my $j;
for (1..1000) { $j++ } # Can't be unbreakable, must test getitimer().
}
print "ok 19\n";
}
my $sleep = 1.5; # seconds
my $msg;
my $ratio = 1.0 + $a;
} else {
}
$ratio = 1.0 + $a;
} else {
}
} else {
for (20..21) {
print "ok $_ # Skip: no gettimeofday\n";
}
}
"ok 22\n" : "not ok 22\n";
"ok 23\n" : "not ok 23\n";
"ok 24\n" : "not ok 24\n";
"ok 25\n" : "not ok 25\n";
} else {
skip 24;
skip 25;
}
}