X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fop%2Fgetpid.t;h=b51b0646fcaab7c504307b1bae7e0220bfa1fe14;hb=25988e07f3c5c5717930b897625a3e6119c92879;hp=dd06f006a6df78c67b1ba8672bcd76d5a783e0d1;hpb=4d76a3443f3312704ec3416fd425698e92a208cd;p=p5sagit%2Fp5-mst-13.2.git diff --git a/t/op/getpid.t b/t/op/getpid.t index dd06f00..b51b064 100644 --- a/t/op/getpid.t +++ b/t/op/getpid.t @@ -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');