This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Take a larger margin to prevent 'X' failures in smokes
[perl5.git] / t / op / getpid.t
index dd06f00..b51b064 100644 (file)
@@ -5,6 +5,7 @@
 BEGIN {
     chdir 't' if -d 't';
     @INC = qw(../lib);
+    require './test.pl';
 }
 
 use strict;
@@ -19,17 +20,25 @@ BEGIN {
        print "1..0 # Skip: no getppid\n";
        exit;
     }
+    if ($ENV{PERL_CORE_MINITEST}) {
+        print "1..0 # Skip: no dynamic loading on miniperl, no threads\n";
+        exit 0;
+    }
+    eval 'use threads; use threads::shared';
+    plan tests => 3;
+    if ($@) {
+       fail("unable to load thread modules");
+    }
+    else {
+       pass("thread modules loaded");
+    }
 }
 
-use threads;
-use threads::shared;
-
 my ($pid, $ppid) = ($$, getppid());
 my $pid2 : shared = 0;
 my $ppid2 : shared = 0;
 
 new threads( sub { ($pid2, $ppid2) = ($$, getppid()); } ) -> join();
 
-print "1..2\n";
-print "not " if $pid  != $pid2;  print "ok 1 - pids\n";
-print "not " if $ppid != $ppid2; print "ok 2 - ppids\n";
+is($pid,  $pid2,  'pids');
+is($ppid, $ppid2, 'ppids');