File: timeout.t

package info (click to toggle)
speedy-cgi-perl 2.22-4
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 1,128 kB
  • ctags: 890
  • sloc: ansic: 4,487; sh: 1,105; perl: 945; makefile: 89
file content (24 lines) | stat: -rw-r--r-- 537 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# Basic test of the timeout feature (-t)

print "1..1\n";

delete $ENV{SPEEDY_TIMEOUT};

my $scr = 't/scripts/basic.2';
my $cmd = "$ENV{SPEEDY} -- -t2 -M1 $scr";

# The script just returns 1, 2, 3 incrementing the persistent counter
# each time it runs.  If -t is working, then the third time we should
# get 1 again.

utime time, time, $scr;
sleep 2;

my $one = `$cmd`;
my $two = `$cmd`;
sleep 3;
my $three = `$cmd`;

#print STDERR "one=$one two=$two three=$three\n";

print $one == 1 && $two == 2 && $three == 1 ? "ok\n" : "not ok\n";