This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
threads 1.64 (repost)
[perl5.git] / ext / threads / t / exit.t
index 3e4b2c3..b005f80 100644 (file)
@@ -14,6 +14,7 @@ BEGIN {
 
     require($ENV{PERL_CORE} ? "./test.pl" : "./t/test.pl");
 }
+our $TODO;
 
 use ExtUtils::testlib;
 
@@ -56,13 +57,15 @@ my $rc = $thr->join();
 ok(! defined($rc), 'Exited: threads->exit()');
 
 
-run_perl(prog => 'use threads 1.52;' .
+run_perl(prog => 'use threads 1.64;' .
                  'threads->exit(86);' .
                  'exit(99);',
          nolib => ($ENV{PERL_CORE}) ? 0 : 1,
          switches => ($ENV{PERL_CORE}) ? [] : [ '-Mblib' ]);
-is($?>>8, 86, 'thread->exit(status) in main');
-
+{
+    local $TODO = 'VMS exit semantics not like POSIX exit semantics' if $^O eq 'VMS';
+    is($?>>8, 86, 'thread->exit(status) in main');
+}
 
 $thr = threads->create({'exit' => 'thread_only'}, sub {
                                                     exit(1);
@@ -104,40 +107,50 @@ $rc = $thr->join();
 ok(! defined($rc), 'Exited: $thr->set_thread_exit_only');
 
 
-run_perl(prog => 'use threads 1.52 qw(exit thread_only);' .
+run_perl(prog => 'use threads 1.64 qw(exit thread_only);' .
                  'threads->create(sub { exit(99); })->join();' .
                  'exit(86);',
          nolib => ($ENV{PERL_CORE}) ? 0 : 1,
          switches => ($ENV{PERL_CORE}) ? [] : [ '-Mblib' ]);
-is($?>>8, 86, "'use threads 'exit' => 'thread_only'");
-
+{
+    local $TODO = 'VMS exit semantics not like POSIX exit semantics' if $^O eq 'VMS';
+    is($?>>8, 86, "'use threads 'exit' => 'thread_only'");
+}
 
-my $out = run_perl(prog => 'use threads 1.52;' .
+my $out = run_perl(prog => 'use threads 1.64;' .
                            'threads->create(sub {' .
                            '    exit(99);' .
-                           '})->join();' .
+                           '});' .
+                           'sleep(1);' .
                            'exit(86);',
                    nolib => ($ENV{PERL_CORE}) ? 0 : 1,
                    switches => ($ENV{PERL_CORE}) ? [] : [ '-Mblib' ],
                    stderr => 1);
-is($?>>8, 99, "exit(status) in thread");
+{
+    local $TODO = 'VMS exit semantics not like POSIX exit semantics' if $^O eq 'VMS';
+    is($?>>8, 99, "exit(status) in thread");
+}
 like($out, '1 finished and unjoined', "exit(status) in thread");
 
 
-$out = run_perl(prog => 'use threads 1.52 qw(exit thread_only);' .
+$out = run_perl(prog => 'use threads 1.64 qw(exit thread_only);' .
                         'threads->create(sub {' .
                         '   threads->set_thread_exit_only(0);' .
                         '   exit(99);' .
-                        '})->join();' .
+                        '});' .
+                        'sleep(1);' .
                         'exit(86);',
                 nolib => ($ENV{PERL_CORE}) ? 0 : 1,
                 switches => ($ENV{PERL_CORE}) ? [] : [ '-Mblib' ],
                 stderr => 1);
-is($?>>8, 99, "set_thread_exit_only(0)");
+{
+    local $TODO = 'VMS exit semantics not like POSIX exit semantics' if $^O eq 'VMS';
+    is($?>>8, 99, "set_thread_exit_only(0)");
+}
 like($out, '1 finished and unjoined', "set_thread_exit_only(0)");
 
 
-run_perl(prog => 'use threads 1.52;' .
+run_perl(prog => 'use threads 1.64;' .
                  'threads->create(sub {' .
                  '   $SIG{__WARN__} = sub { exit(99); };' .
                  '   die();' .
@@ -145,8 +158,10 @@ run_perl(prog => 'use threads 1.52;' .
                  'exit(86);',
          nolib => ($ENV{PERL_CORE}) ? 0 : 1,
          switches => ($ENV{PERL_CORE}) ? [] : [ '-Mblib' ]);
-is($?>>8, 99, "exit(status) in thread warn handler");
-
+{
+    local $TODO = 'VMS exit semantics not like POSIX exit semantics' if $^O eq 'VMS';
+    is($?>>8, 99, "exit(status) in thread warn handler");
+}
 
 $thr = threads->create(sub {
     $SIG{__WARN__} = sub { threads->exit(); };