blob: 6ca7657d421244d12e550f8d27470e5659697a88 (
plain)
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
|
# -*- cperl -*-
use Test::More qw(no_plan);
use strict;
use_ok ("My::SafeProcess::Base");
my $count= 0;
for (1..100){
my $pid= My::SafeProcess::Base::_safe_fork();
exit unless $pid;
(waitpid($pid, 0) == $pid) and $count++;
}
ok($count == 100, "safe_fork");
# A nice little forkbomb
SKIP: {
skip("forkbomb", 1);
eval {
while(1){
my $pid= My::SafeProcess::Base::_safe_fork();
exit unless $pid;
}
};
ok($@, "forkbomb");
}
|