apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aa...@apache.org
Subject cvs commit: apr/test testshm.c
Date Wed, 16 Jan 2002 22:08:06 GMT
aaron       02/01/16 14:08:06

  Modified:    test     testshm.c
  Log:
  Fix up some of the status messages.
  
  Detect if either the producer or consumer child processes exited
  with non-zero status, which is the basis for the success of the
  name-based shm test.
  
  Revision  Changes    Path
  1.2       +11 -3     apr/test/testshm.c
  
  Index: testshm.c
  ===================================================================
  RCS file: /home/cvs/apr/test/testshm.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- testshm.c	12 Jan 2002 18:32:07 -0000	1.1
  +++ testshm.c	16 Jan 2002 22:08:06 -0000	1.2
  @@ -216,11 +216,11 @@
       }
       fprintf(stdout, "OK\n");
   
  -    printf("Non-related Processes Test\n");
  +    printf("fork()ing and exec()ing children:\n");
       pidproducer = fork();
       if (pidproducer == 0) { /* child */
           /* FIXME: exec a producer */
  -        printf("starting consumer\n");
  +        printf("starting consumer.....\n");
           if (execlp("testshmconsumer", "testshmconsumer", (char*)0) < 0) {
               return errno;
           }
  @@ -230,7 +230,7 @@
           pidconsumer = fork();
           if (pidconsumer == 0) { /* child */
               /* FIXME: exec a producer */
  -            printf("starting producer\n");
  +            printf("starting producer.....\n");
               if (execlp("testshmproducer", "testshmproducer", (char*)0) < 0) {
                   return errno;
               }
  @@ -249,9 +249,17 @@
       if (waitpid(pidconsumer, &exit_int, 0) < 0) {
           return errno;
       }
  +    if (WIFEXITED(exit_int)) {
  +        printf("Producer was unsuccessful.\n");
  +        return APR_EGENERAL;
  +    }
       printf("Waiting for consumer to exit.\n");
       if (waitpid(pidproducer, &exit_int, 0) < 0) {
           return errno;
  +    }
  +    if (WIFEXITED(exit_int)) {
  +        printf("Consumer was unsuccessful.\n");
  +        return APR_EGENERAL;
       }
   
       apr_pool_destroy(pool);
  
  
  

Mime
View raw message