Change 33521 by [EMAIL PROTECTED] on 2008/03/13 23:17:54

        Integrate:
        [ 33154]
        Subject: [PATCH] threads::shared TODO test for outstanding bug
        From: "Jerry D. Hedden" <[EMAIL PROTECTED]>
        Date: Wed, 30 Jan 2008 09:15:25 -0500
        Message-ID: <[EMAIL PROTECTED]>
        
        [ 33387]
        Subject: [PATCH] threads::shared 1.18
        From: "Jerry D. Hedden" <[EMAIL PROTECTED]>
        Date: Tue, 26 Feb 2008 11:29:54 -0500
        Message-ID: <[EMAIL PROTECTED]>

Affected files ...

... //depot/maint-5.10/perl/ext/threads/shared/Makefile.PL#3 integrate
... //depot/maint-5.10/perl/ext/threads/shared/shared.pm#4 integrate
... //depot/maint-5.10/perl/ext/threads/shared/t/object.t#2 integrate
... //depot/maint-5.10/perl/ext/threads/shared/t/stress.t#2 integrate

Differences ...

==== //depot/maint-5.10/perl/ext/threads/shared/Makefile.PL#3 (xtext) ====
Index: perl/ext/threads/shared/Makefile.PL
--- perl/ext/threads/shared/Makefile.PL#2~33520~        2008-03-13 
15:43:35.000000000 -0700
+++ perl/ext/threads/shared/Makefile.PL 2008-03-13 16:17:54.000000000 -0700
@@ -55,7 +55,7 @@
 
     # Verify that a 'C' compiler is available
     if (! have_cc()) {
-        die("No 'C' compiler found to build 'threads::shared'\n");
+        die("OS unsupported:  ERROR: No 'C' compiler found to build 
'threads::shared'\n");
     }
 
     push(@conditional_params, 'DEFINE' => '-DHAS_PPPORT_H',

==== //depot/maint-5.10/perl/ext/threads/shared/shared.pm#4 (text) ====
Index: perl/ext/threads/shared/shared.pm
--- perl/ext/threads/shared/shared.pm#3~33520~  2008-03-13 15:43:35.000000000 
-0700
+++ perl/ext/threads/shared/shared.pm   2008-03-13 16:17:54.000000000 -0700
@@ -5,7 +5,7 @@
 use strict;
 use warnings;
 
-our $VERSION = '1.17';
+our $VERSION = '1.18';
 my $XS_VERSION = $VERSION;
 $VERSION = eval $VERSION;
 
@@ -73,7 +73,7 @@
 
 =head1 VERSION
 
-This document describes threads::shared version 1.17
+This document describes threads::shared version 1.18
 
 =head1 SYNOPSIS
 
@@ -371,7 +371,7 @@
 L<http://www.cpanforum.com/dist/threads-shared>
 
 Annotated POD for L<threads::shared>:
-L<http://annocpan.org/~JDHEDDEN/threads-shared-1.17/shared.pm>
+L<http://annocpan.org/~JDHEDDEN/threads-shared-1.18/shared.pm>
 
 Source repository:
 L<http://code.google.com/p/threads-shared/>

==== //depot/maint-5.10/perl/ext/threads/shared/t/object.t#2 (text) ====
Index: perl/ext/threads/shared/t/object.t
--- perl/ext/threads/shared/t/object.t#1~33111~ 2008-01-29 11:03:04.000000000 
-0800
+++ perl/ext/threads/shared/t/object.t  2008-03-13 16:17:54.000000000 -0700
@@ -21,7 +21,7 @@
 
 BEGIN {
     $| = 1;
-    print("1..23\n");   ### Number of tests that will be run ###
+    print("1..28\n");   ### Number of tests that will be run ###
 };
 
 use threads;
@@ -148,4 +148,34 @@
 $cookie = $jar->fetch();
 ok($cookie->{'type'}      eq $C3, 'Fetched cookie from jar');
 
+{ package Foo;
+
+    my $ID = 1;
+    threads::shared::share($ID);
+
+    sub new
+    {
+        # Anonymous scalar with an internal ID
+        my $obj = \do{ my $scalar = $ID++; };
+        threads::shared::share($obj);   # Make it shared
+        return (bless($obj, 'Foo'));    # Make it an object
+    }
+}
+
+my $obj :shared;
+$obj = Foo->new();
+ok($$obj == 1, "Main: Object ID $$obj");
+
+threads->create( sub {
+        ok($$obj == 1, "Thread: Object ID $$obj");
+
+        $$obj = 10;
+        ok($$obj == 10, "Thread: Changed object ID $$obj");
+
+        $obj = Foo->new();
+        ok($$obj == 2, "Thread: New object ID $$obj");
+    } )->join();
+
+ok($$obj == 2, "Main: New object ID $$obj  # TODO - should be 2");
+
 # EOF

==== //depot/maint-5.10/perl/ext/threads/shared/t/stress.t#2 (text) ====
Index: perl/ext/threads/shared/t/stress.t
--- perl/ext/threads/shared/t/stress.t#1~32694~ 2007-12-22 01:23:09.000000000 
-0800
+++ perl/ext/threads/shared/t/stress.t  2008-03-13 16:17:54.000000000 -0700
@@ -88,27 +88,30 @@
             $okay++;
         } else {
             $unknown++;
-            print("# Unknown error: $rc\n");
+            print(STDERR "# Unknown error: $rc\n");
         }
     }
 
     if ($failures || $unknown || (($okay + $timeouts) != $cnt)) {
-        print('not ok 1');
+        print("not ok 1\n");
         my $too_few = $cnt - ($okay + $failures + $timeouts + $unknown);
-        print(" - $too_few too few threads reported") if $too_few;
-        print(" - $failures threads failed")          if $failures;
-        print(" - $unknown unknown errors")           if $unknown;
-        print(" - $timeouts threads timed out")       if $timeouts;
-        print("\n");
+        print(STDERR "# Test failed:\n");
+        print(STDERR "#\t$too_few too few threads reported\n") if $too_few;
+        print(STDERR "#\t$failures threads failed\n")          if $failures;
+        print(STDERR "#\t$unknown unknown errors\n")           if $unknown;
+        print(STDERR "#\t$timeouts threads timed out\n")       if $timeouts;
 
     } elsif ($timeouts) {
         # Frequently fails under MSWin32 due to deadlocking bug in Windows
         # hence test is TODO under MSWin32
         #   http://rt.perl.org/rt3/Public/Bug/Display.html?id=41574
         #   http://support.microsoft.com/kb/175332
-        print('not ok 1');
-        print(' # TODO - not reliable under MSWin32') if ($^O eq 'MSWin32');
-        print(" - $timeouts threads timed out\n");
+        if ($^O eq 'MSWin32') {
+            print("not ok 1 # TODO - not reliable under MSWin32\n")
+        } else {
+            print("not ok 1\n");
+            print(STDERR "# Test failed: $timeouts threads timed out\n");
+        }
 
     } else {
         print('ok 1');
End of Patch.

Reply via email to