You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl-cvs@perl.apache.org by ra...@apache.org on 2004/07/15 17:30:24 UTC

cvs commit: modperl-2.0/t/response/TestAPR threadmutex.pm

randyk      2004/07/15 08:30:24

  Modified:    t/response/TestAPR threadmutex.pm
  Added:       t/apr-ext threadmutex.t
               t/lib/TestAPRlib threadmutex.pm
  Log:
  Reviewed by:	stas
  put common threadmutex tests under t/lib/TestAPRlib/, and call
  them from both t/apr/ and t/apr-ext/.
  
  Revision  Changes    Path
  1.1                  modperl-2.0/t/apr-ext/threadmutex.t
  
  Index: threadmutex.t
  ===================================================================
  use strict;
  use warnings FATAL => 'all';
  use Apache::Test;
  
  use TestAPRlib::threadmutex;
  
  plan tests => TestAPRlib::threadmutex::num_of_tests();
  
  TestAPRlib::threadmutex::test();
  
  
  
  1.1                  modperl-2.0/t/lib/TestAPRlib/threadmutex.pm
  
  Index: threadmutex.pm
  ===================================================================
  package TestAPRlib::threadmutex;
  
  use strict;
  use warnings FATAL => 'all';
  
  use Apache::Test;
  use Apache::TestUtil;
  
  use APR::Const -compile => qw(EBUSY SUCCESS);
  use APR::Pool();
  
  sub num_of_tests {
      return 3;
  }
  
  sub test {
  
      require APR::ThreadMutex;
  
      my $pool = APR::Pool->new();
      my $mutex = APR::ThreadMutex->new($pool);
  
      ok $mutex;
  
      ok t_cmp($mutex->lock, APR::SUCCESS,
               'lock == APR::SUCCESS');
  
  #XXX: don't get what we expect on win23
  #need to use APR_STATUS_IS_EBUSY ?
  #    ok t_cmp($mutex->trylock, APR::EBUSY,
  #             'trylock == APR::EBUSY');
  
      ok t_cmp($mutex->unlock, APR::SUCCESS,
               'unlock == APR::SUCCESS');
  
  }
  
  1;
  
  
  
  1.5       +5 -18     modperl-2.0/t/response/TestAPR/threadmutex.pm
  
  Index: threadmutex.pm
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/t/response/TestAPR/threadmutex.pm,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- threadmutex.pm	22 Jan 2003 06:54:03 -0000	1.4
  +++ threadmutex.pm	15 Jul 2004 15:30:24 -0000	1.5
  @@ -7,29 +7,16 @@
   use Apache::TestUtil;
   
   use Apache::Const -compile => 'OK';
  -use APR::Const -compile => qw(EBUSY SUCCESS);
  +
  +use TestAPRlib::threadmutex;
   
   sub handler {
       my $r = shift;
   
  -    plan $r, tests => 3, have_threads;
  -
  -    require APR::ThreadMutex;
  -
  -    my $mutex = APR::ThreadMutex->new($r->pool);
  -
  -    ok $mutex;
  -
  -    ok t_cmp($mutex->lock, APR::SUCCESS,
  -             'lock == APR::SUCCESS');
  -
  -#XXX: don't get what we expect on win23
  -#need to use APR_STATUS_IS_EBUSY ?
  -#    ok t_cmp($mutex->trylock, APR::EBUSY,
  -#             'trylock == APR::EBUSY');
  +    my $tests = TestAPRlib::threadmutex::num_of_tests();
  +    plan $r, tests => $tests, have_threads;
   
  -    ok t_cmp($mutex->unlock, APR::SUCCESS,
  -             'unlock == APR::SUCCESS');
  +    TestAPRlib::threadmutex::test();
   
       Apache::OK;
   }