This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Get t/uni/cache.t working under minitest
[perl5.git] / t / op / waitpid.t
CommitLineData
d4c02743
TC
1#!./perl
2
3# tests for (possibly emulated) waitpid
4
5BEGIN {
6 chdir 't' if -d 't';
7 @INC = '../lib';
8 require './test.pl';
9 require Config;
10 skip_all('no Errno')
11 unless eval 'use Errno qw(EINVAL); 1';
12 skip_all('no POSIX')
13 unless eval 'use POSIX qw(WNOHANG); 1';
14}
15
16$|=1;
17
18watchdog(10);
19{
20 # [perl #85228] Broken waitpid
21 # $! = EINVAL; waitpid 0, 0; # would loop forever, even with WNOHANG
22 $! = EINVAL;
23 my $pid = waitpid(0, WNOHANG);
24
25 # depending on the platform, there's several possible values for
26 # $pid and $!, so I'm only testing that we don't loop forever.
27 #
28 # Some of the complications are:
29 #
30 # - watchdog() may be implemented with alarm() or fork, so there
31 # may or may not be children (this code doesn't use threads, so
32 # threads shouldn't be used)
33 #
34 # - the platform may or may not implement waitpid()/wait4()
35
36 pass("didn't block on waitpid(0, ...)");
37}
38
39done_testing();