You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by tr...@locus.apache.org on 2000/04/03 04:39:29 UTC

cvs commit: apache-2.0/src/lib/apr/test client.c server.c testargs.c testcontext.c testfile.c testmmap.c testsock.c

trawick     00/04/02 19:39:29

  Modified:    src/lib/apr/test client.c server.c testargs.c testcontext.c
                        testfile.c testmmap.c testsock.c
  Log:
  call ap_initialize() and ap_terminate()
  
  Revision  Changes    Path
  1.8       +15 -1     apache-2.0/src/lib/apr/test/client.c
  
  Index: client.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/test/client.c,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- client.c	2000/03/31 08:36:19	1.7
  +++ client.c	2000/04/03 02:39:27	1.8
  @@ -52,6 +52,7 @@
    * <http://www.apache.org/>.
    */
   
  +#include <stdlib.h>
   #include "apr_network_io.h"
   #include "apr_errno.h"
   #include "apr_general.h"
  @@ -68,8 +69,21 @@
       char datasend[STRLEN] = "Send data test";
       char datarecv[STRLEN];
       char *local_ipaddr, *remote_ipaddr;
  +    char *dest = "127.0.0.1";
       ap_uint32_t local_port, remote_port;
   
  +    if (argc > 1) {
  +        dest = argv[1];
  +    }
  +
  +    fprintf(stdout, "Initializing.........");
  +    if (ap_initialize() != APR_SUCCESS) {
  +        fprintf(stderr, "Something went wrong\n");
  +        exit(-1);
  +    }
  +    fprintf(stdout, "OK\n");
  +    atexit(ap_terminate);
  +
       fprintf(stdout, "Creating context.......");
       if (ap_create_context(&context, NULL) != APR_SUCCESS) {
           fprintf(stderr, "Something went wrong\n");
  @@ -103,7 +117,7 @@
       fprintf(stdout, "\tClient:  Connecting to socket.......");
   
       do {
  -      stat = ap_connect(sock, "127.0.0.1");
  +      stat = ap_connect(sock, dest);
       } while (stat == APR_ECONNREFUSED);
   
       if (stat != APR_SUCCESS) {
  
  
  
  1.10      +9 -0      apache-2.0/src/lib/apr/test/server.c
  
  Index: server.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/test/server.c,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- server.c	2000/03/31 08:36:20	1.9
  +++ server.c	2000/04/03 02:39:27	1.10
  @@ -52,6 +52,7 @@
    * <http://www.apache.org/>.
    */
   
  +#include <stdlib.h>
   #include "apr_network_io.h"
   #include "apr_errno.h"
   #include "apr_general.h"
  @@ -70,6 +71,14 @@
       char datarecv[STRLEN] = "Recv data test";
       char *local_ipaddr, *remote_ipaddr;
       ap_uint32_t local_port, remote_port;
  +
  +    fprintf(stdout, "Initializing.........");
  +    if (ap_initialize() != APR_SUCCESS) {
  +        fprintf(stderr, "Something went wrong\n");
  +        exit(-1);
  +    }
  +    fprintf(stdout, "OK\n");
  +    atexit(ap_terminate);
   
       fprintf(stdout, "Creating context.......");
       if (ap_create_context(&context, NULL) != APR_SUCCESS) {
  
  
  
  1.11      +3 -0      apache-2.0/src/lib/apr/test/testargs.c
  
  Index: testargs.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/test/testargs.c,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- testargs.c	2000/03/31 08:36:20	1.10
  +++ testargs.c	2000/04/03 02:39:27	1.11
  @@ -58,6 +58,7 @@
   #include "apr_lib.h"
   #include "apr_getopt.h"
   #include <stdio.h>
  +#include <stdlib.h>
   #ifdef BEOS
   #include <unistd.h>
   #endif
  @@ -67,6 +68,8 @@
       ap_context_t *context;
       ap_int32_t data;
   
  +    ap_initialize();
  +    atexit(ap_terminate);
       ap_create_context(&context, NULL);
   
       while (ap_getopt(argc, argv, "abc:d::", &data, context) == APR_SUCCESS) {
  
  
  
  1.7       +7 -0      apache-2.0/src/lib/apr/test/testcontext.c
  
  Index: testcontext.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/test/testcontext.c,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- testcontext.c	2000/03/31 08:36:20	1.6
  +++ testcontext.c	2000/04/03 02:39:27	1.7
  @@ -53,6 +53,7 @@
    */
   
   #include <stdio.h>
  +#include <stdlib.h>
   #include "apr_file_io.h"
   #include "apr_errno.h"
   #include "apr_general.h"
  @@ -71,6 +72,12 @@
       ap_context_t *context;
       char *testdata;
       char *retdata;
  +
  +    if (ap_initialize() != APR_SUCCESS) {
  +        fprintf(stderr, "Couldn't initialize.");
  +        exit(-1);
  +    }
  +    atexit(ap_terminate);
   
       if (ap_create_context(&context, NULL) != APR_SUCCESS) {
           fprintf(stderr, "Couldn't allocate context.");
  
  
  
  1.11      +6 -0      apache-2.0/src/lib/apr/test/testfile.c
  
  Index: testfile.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/test/testfile.c,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- testfile.c	2000/03/31 08:36:20	1.10
  +++ testfile.c	2000/04/03 02:39:27	1.11
  @@ -53,6 +53,7 @@
    */
   
   #include <stdio.h>
  +#include <stdlib.h>
   #include "apr_file_io.h"
   #include "apr_errno.h"
   #include "apr_general.h"
  @@ -78,6 +79,11 @@
       char *filename = "test.fil";
       char *teststr;
   
  +    if (ap_initialize() != APR_SUCCESS) {
  +        fprintf(stderr, "Couldn't initialize.");
  +        exit(-1);
  +    }
  +    atexit(ap_terminate);
       if (ap_create_context(&context, NULL) != APR_SUCCESS) {
           fprintf(stderr, "Couldn't allocate context.");
           exit(-1);
  
  
  
  1.10      +11 -3     apache-2.0/src/lib/apr/test/testmmap.c
  
  Index: testmmap.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/test/testmmap.c,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- testmmap.c	2000/03/31 08:36:20	1.9
  +++ testmmap.c	2000/04/03 02:39:27	1.10
  @@ -53,6 +53,7 @@
    */
   
   #include <stdio.h>
  +#include <stdlib.h>
   #include <unistd.h>
   #include <string.h>
   #include "apr_mmap.h"
  @@ -77,6 +78,14 @@
       
       fprintf (stdout,"APR MMAP Test\n*************\n\n");
       
  +    fprintf(stdout,"Initializing........................");
  +    if (ap_initialize() != APR_SUCCESS) {
  +        fprintf(stderr, "Failed.\n");
  +        exit(-1);
  +    }
  +    fprintf(stdout,"OK\n");
  +    atexit(ap_terminate);
  +
       fprintf(stdout,"Creating context....................");    
       if (ap_create_context(&context, NULL) != APR_SUCCESS) {
           fprintf(stderr, "Failed.\n");
  @@ -103,7 +112,7 @@
           exit(-1);
       }
       else {
  -        fprintf(stdout, "%d bytes\n", finfo.size);
  +        fprintf(stdout, "%d bytes\n", (int)finfo.size);
       }  
       
       fprintf(stdout,"Trying to mmap the file..............");
  @@ -120,8 +129,7 @@
       }
       fprintf(stdout,"OK\n");
       
  -    
       fprintf (stdout,"\nTest Complete\n");
  -    
  +
       return 1;
   }
  
  
  
  1.7       +10 -1     apache-2.0/src/lib/apr/test/testsock.c
  
  Index: testsock.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/test/testsock.c,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- testsock.c	2000/03/31 08:36:20	1.6
  +++ testsock.c	2000/04/03 02:39:27	1.7
  @@ -53,6 +53,7 @@
    */
   
   #include <stdio.h>
  +#include <stdlib.h>
   #include <signal.h>
   #include "apr_thread_proc.h"
   #include "apr_errno.h"
  @@ -73,6 +74,14 @@
       ap_status_t s2;
       char *args[2];
   
  +    fprintf(stdout, "Initializing.........");
  +    if (ap_initialize() != APR_SUCCESS) {
  +        fprintf(stderr, "Something went wrong\n");
  +        exit(-1);
  +    }
  +    fprintf(stdout, "OK\n");
  +    atexit(ap_terminate);
  +
       fprintf(stdout, "Creating context.......");
       if (ap_create_context(&context, NULL) != APR_SUCCESS) {
           fprintf(stderr, "Could not create context\n");
  @@ -82,7 +91,7 @@
   
       fprintf(stdout, "This test relies on the process test working.  Please\n");
       fprintf(stdout, "run that test first, and only run this test when it\n");
  -    fprintf(stdout, "completes successfully.  Alternitevly, you could run\n");
  +    fprintf(stdout, "completes successfully.  Alternatively, you could run\n");
       fprintf(stdout, "server and client by yourself.\n");
   
       fprintf(stdout, "Creating children to run network tests.......\n");