5 if ($ENV{'PERL_CORE'}){
7 unshift @INC, '../lib';
10 if (! $Config{'useithreads'}) {
11 print("1..0 # Skip: Perl not compiled with 'useithreads'\n");
16 use ExtUtils::testlib;
19 my ($id, $ok, $name) = @_;
21 # You have to do it this way or VMS will get confused.
23 print("ok $id - $name\n");
25 print("not ok $id - $name\n");
26 printf("# Failed test at line %d\n", (caller)[2]);
34 print("1..6\n"); ### Number of tests that will be run ###
39 $SIG{__WARN__} = sub { $warnmsg = shift; };
46 ### Start of Testing ###
48 ok(2, ($warnmsg =~ /Warning, threads::shared has already been loaded/)?1:0,
49 "threads has warned us");
53 ok(3, $test eq "bar", "Test disabled share not interfering");
56 ok(4, $test eq "bar", "Test disabled share after thread");
59 # Value should either remain unchanged or be value set by other thread
60 ok(5, $test eq "bar" || $test eq 'baz', "Test that value is an expected one");
62 ok(6, ! is_shared($test), "Check for sharing");