File: hold_stdio.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 (29 lines) | stat: -rw-r--r-- 652 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
25
26
27
28
29
# Test#1
# If backend forks a backend that holds onto stdio, we should still be
# able to exit when the backend exits, not when stdio closes

# Test#2
# If we continue to hold onto the pipe, we should eventually get the
# output from the child on it too, even after parent exits

my $TMP = "/tmp/hold_stdio.$$";

sub adios { my $ok = shift;
    unlink($TMP);
    print ($ok ? "ok\n" : "not ok\n");
    exit;
}

print "1..2\n";
$SIG{ALRM} = sub {&adios(0)};
alarm(10);

# Test1
system("$ENV{SPEEDY} t/scripts/hold_stdio 2 >$TMP");
if (`cat $TMP` eq "ok\n") {
    print "ok\n";
    
    # Test #2
    sleep(5);
    &adios(`cat $TMP` eq "ok\nchild\n");
}