stas        2003/08/06 15:42:44

  Modified:    t/perl   ithreads2.t ithreads.t
               t/response/TestPerl ithreads.pm
  Log:
  revert the test code to use : shared attribute, and in order to avoid
  compilation problems with perl < 5.8.x do the skipping in the client part
  (the reason for not using threads::shared::share() is that it doesn't quite
  work unless 'use threads' was loaded in the BEGIN {} block)
  
  Revision  Changes    Path
  1.2       +9 -0      modperl-2.0/t/perl/ithreads2.t
  
  Index: ithreads2.t
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/t/perl/ithreads2.t,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ithreads2.t       25 Jul 2003 08:16:58 -0000      1.1
  +++ ithreads2.t       6 Aug 2003 22:42:44 -0000       1.2
  @@ -5,9 +5,18 @@
   use strict;
   use warnings FATAL => 'all';
   
  +use Config;
  +
   use Apache::Test;
   use Apache::TestUtil;
   use Apache::TestRequest 'GET_BODY_ASSERT';
  +
  +# perl < 5.6.0 fails to compile code with 'shared' attributes, so we must skip
  +# it here.
  +unless ($] >= 5.008001 && $Config{useithreads}) {
  +    plan tests => 1, have 
  +        {"perl 5.8.1 or higher w/ithreads enabled is required" => 0};
  +}
   
   my $module = 'TestPerl::ithreads';
   my $config = Apache::Test::config();
  
  
  
  1.2       +11 -0     modperl-2.0/t/perl/ithreads.t
  
  Index: ithreads.t
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/t/perl/ithreads.t,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ithreads.t        25 Jul 2003 08:16:58 -0000      1.1
  +++ ithreads.t        6 Aug 2003 22:42:44 -0000       1.2
  @@ -1,5 +1,16 @@
   # perl/ithreads2 is a similar test but is running from within a
   # virtual host with its own perl interpreter pool (+Parent)
   
  +use Config;
  +
  +use Apache::Test;
   use Apache::TestRequest 'GET_BODY_ASSERT';
  +
  +# perl < 5.6.0 fails to compile code with 'shared' attributes, so we must skip
  +# it here.
  +unless ($] >= 5.008001 && $Config{useithreads}) {
  +    plan tests => 1, have 
  +        {"perl 5.8.1 or higher w/ithreads enabled is required" => 0};
  +}
  +
   print GET_BODY_ASSERT "/TestPerl__ithreads";
  
  
  
  1.3       +3 -3      modperl-2.0/t/response/TestPerl/ithreads.pm
  
  Index: ithreads.pm
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/t/response/TestPerl/ithreads.pm,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ithreads.pm       30 Jul 2003 12:53:16 -0000      1.2
  +++ ithreads.pm       6 Aug 2003 22:42:44 -0000       1.3
  @@ -37,7 +37,7 @@
       }
   
       {
  -        my $thr = threads->new(sub { 
  +        my $thr = threads->new(sub {
                                      my $tid = threads->self->tid; 
                                      debug "2nd TID is $tid" if defined $tid;
                                      return 2;
  @@ -52,8 +52,8 @@
           #    my $counter_shar : shared = 1;
           # but it won't compile under $] < 5.8, before it gets a chance
           # to skip this test, so using the function share() instead.
  -        my $counter_shar = 1 ; threads::shared::share(\$counter_shar);
  -        my $thr = threads->new(sub : locked { 
  +        my $counter_shar : shared = 1;
  +        my $thr = threads->new(sub : locked {
                                      my $tid = threads->self->tid; 
                                      debug "2nd TID is $tid" if defined $tid;
                                      $counter_priv += $counter_priv for 1..10;
  
  
  

Reply via email to