This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Skip the test for fork's undef return if ulimit -u doesn't work locally.
authorNicholas Clark <nick@ccl4.org>
Wed, 21 Nov 2012 15:12:57 +0000 (16:12 +0100)
committerNicholas Clark <nick@ccl4.org>
Thu, 22 Nov 2012 09:30:17 +0000 (10:30 +0100)
Commit af2fe5eb7afec48a added a test for fork returning undef on failure,
which used ulimit -u to lower the number of user processes to provoke fork
failure. Whilst the test was careful to ensure that it only attempted this
if the shell is bash or zsh, it turns out that one some platforms (at least
HP-UX and AIX), bash offers ulimit -u, but will always error if its use is
attempted. So probe that ulimit -u can be used, and skip the test if it
can't.

t/op/fork.t

index 7154bf4..e4d5904 100644 (file)
@@ -19,6 +19,12 @@ my $shell = $ENV{SHELL} || '';
 SKIP: {
     skip "This test can only be run under bash or zsh"
         unless $shell =~ m{/(?:ba|z)sh$};
+    my $probe = qx{
+        $shell -c 'ulimit -u 1 2>&1 && echo good'
+    };
+    chomp $probe;
+    skip "Can't set ulimit -u on this system: $probe"
+       unless $probe eq 'good';
 
     my $out = qx{
         $shell -c 'ulimit -u 1; exec $^X -e "