File: waitpid-conflict.t

package info (click to toggle)
libparallel-forkmanager-perl 2.03-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 268 kB
  • sloc: perl: 475; xml: 291; makefile: 2
file content (38 lines) | stat: -rw-r--r-- 628 bytes parent folder | download | duplicates (3)
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
30
31
32
33
34
35
36
37
38
use strict;
use warnings;

use Test::More;

use Parallel::ForkManager;

my $pm = Parallel::ForkManager->new(4);

local $SIG{ALRM} = sub {
    fail "test hanging, forever waiting for child process";
    exit 1;
};

for ( 1 ) {
    $pm->start and next;
    sleep 2;
    $pm->finish;
}

my $pid = waitpid -1, 0;

diag "code outside of P::FM stole $pid";

TODO: {
    local $TODO = 'MacOS and FreeBDS seem to have issues with this';

    eval {
        alarm 10;
        $pm->wait_all_children;
        pass "wait_all_children terminated";
    };

    is $pm->running_procs => 0, "all children are accounted for";

}

done_testing;