You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by rb...@apache.org on 2004/03/13 22:49:38 UTC

cvs commit: apr/test testshm.c testshmconsumer.c testshmproducer.c

rbb         2004/03/13 13:49:38

  Modified:    test     testshm.c testshmconsumer.c testshmproducer.c
  Log:
  Finish the port of testshm(producer|consumer) to windows.  This
  Add extensions to the apr_proc_create call in testshm.  Remove the test
  that relies on apr_fork.  Cleanup some unused variables.
  
  Revision  Changes    Path
  1.12      +20 -9     apr/test/testshm.c
  
  Index: testshm.c
  ===================================================================
  RCS file: /home/cvs/apr/test/testshm.c,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- testshm.c	13 Mar 2004 21:41:04 -0000	1.11
  +++ testshm.c	13 Mar 2004 21:49:38 -0000	1.12
  @@ -23,6 +23,15 @@
   #include "apr_time.h"
   #include "testshm.h"
   
  +/* XXX I'm sure there has to be a better way to do this ... */
  +#ifdef WIN32
  +#define EXTENSION ".exe"
  +#elif NETWARE
  +#define EXTENSION ".nlm"
  +#else
  +#define EXTENSION
  +#endif
  +
   #if APR_HAS_SHARED_MEMORY
   
   static int msgwait(int sleep_sec, int first_box, int last_box)
  @@ -87,7 +96,6 @@
   {
       apr_status_t rv;
       apr_shm_t *shm = NULL;
  -    apr_size_t retsize;
   
       rv = apr_shm_create(&shm, SHARED_SIZE, NULL, p);
       apr_assert_success(tc, "Error allocating shared memory block", rv);
  @@ -100,14 +108,14 @@
       apr_assert_success(tc, "Error destroying shared memory block", rv);
   }
   
  +#if APR_HAS_FORK
   static void test_anon(CuTest *tc)
   {
       apr_proc_t proc;
       apr_status_t rv;
       apr_shm_t *shm;
       apr_size_t retsize;
  -    pid_t pid;
  -    int cnt, i, exit_int;
  +    int cnt, i;
       int recvd;
   
       rv = apr_shm_create(&shm, SHARED_SIZE, NULL, p);
  @@ -149,6 +157,7 @@
       rv = apr_shm_destroy(shm);
       apr_assert_success(tc, "Error destroying shared memory block", rv);
   }
  +#endif
   
   static void test_named(CuTest *tc)
   {
  @@ -174,18 +183,18 @@
       rv = apr_procattr_create(&attr1, p);
       CuAssertPtrNotNull(tc, attr1);
       apr_assert_success(tc, "Couldn't create attr1", rv);
  -    args[0] = apr_pstrdup(p, "testshmproducer");
  +    args[0] = apr_pstrdup(p, "testshmproducer" EXTENSION);
       args[1] = NULL;
  -    rv = apr_proc_create(&pidproducer, "./testshmproducer", args, NULL,
  -                         attr1, p);
  +    rv = apr_proc_create(&pidproducer, "./testshmproducer" EXTENSION, args,
  +                         NULL, attr1, p);
       apr_assert_success(tc, "Couldn't launch producer", rv);
   
       rv = apr_procattr_create(&attr2, p);
       CuAssertPtrNotNull(tc, attr2);
       apr_assert_success(tc, "Couldn't create attr2", rv);
  -    args[0] = apr_pstrdup(p, "testshmconsumer");
  -    rv = apr_proc_create(&pidconsumer, "./testshmconsumer", args, NULL,
  -                         attr2, p);
  +    args[0] = apr_pstrdup(p, "testshmconsumer" EXTENSION);
  +    rv = apr_proc_create(&pidconsumer, "./testshmconsumer" EXTENSION, args, 
  +                         NULL, attr2, p);
       apr_assert_success(tc, "Couldn't launch consumer", rv);
   
       rv = apr_proc_wait(&pidconsumer, &received, &why, APR_WAIT);
  @@ -216,7 +225,9 @@
       SUITE_ADD_TEST(suite, test_anon_create);
       SUITE_ADD_TEST(suite, test_check_size);
       SUITE_ADD_TEST(suite, test_shm_allocate);
  +#if APR_HAS_FORK
       SUITE_ADD_TEST(suite, test_anon);
  +#endif
       SUITE_ADD_TEST(suite, test_named);
   #endif
   
  
  
  
  1.9       +0 -1      apr/test/testshmconsumer.c
  
  Index: testshmconsumer.c
  ===================================================================
  RCS file: /home/cvs/apr/test/testshmconsumer.c,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- testshmconsumer.c	13 Mar 2004 21:41:04 -0000	1.8
  +++ testshmconsumer.c	13 Mar 2004 21:49:38 -0000	1.9
  @@ -47,7 +47,6 @@
       apr_status_t rv;
       apr_pool_t *pool;
       apr_shm_t *shm;
  -    char errmsg[200];
       int recvd;
   
       apr_initialize();
  
  
  
  1.9       +0 -1      apr/test/testshmproducer.c
  
  Index: testshmproducer.c
  ===================================================================
  RCS file: /home/cvs/apr/test/testshmproducer.c,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- testshmproducer.c	13 Mar 2004 21:41:04 -0000	1.8
  +++ testshmproducer.c	13 Mar 2004 21:49:38 -0000	1.9
  @@ -35,7 +35,6 @@
       apr_shm_t *shm;
       int i;
       int sent = 0;
  -    char errmsg[200];
   
       apr_initialize();