You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by tr...@apache.org on 2002/10/11 14:21:42 UTC

cvs commit: apr/test testproc.c

trawick     2002/10/11 05:21:42

  Modified:    test     testproc.c
  Log:
  don't tell apr_file_write() to write 256 bytes when we only give it
  13 or so bytes of valid storage (got EFAULT)
  
  before that change, we relied on filling up the child process's
  buffer so that fgets() would return even though no '\n' was written...
  but that no longer happens so add '\n' to end of message so that
  fgets() returns in the child
  
  this showed up when I moved an ElectricFence regression test from
  RH 6.1 to RH 8.0
  
  Revision  Changes    Path
  1.37      +9 -6      apr/test/testproc.c
  
  Index: testproc.c
  ===================================================================
  RCS file: /home/cvs/apr/test/testproc.c,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- testproc.c	4 Jul 2002 13:56:16 -0000	1.36
  +++ testproc.c	11 Oct 2002 12:21:42 -0000	1.37
  @@ -108,11 +108,11 @@
               fprintf(stderr, "%s", teststr);
           exit(1);
       }
  -    teststr = apr_pstrdup(pool, "Whooo Hoooo\0");
  +    teststr = apr_pstrdup(pool, "Whooo Hoooo\n");
       
       printf("APR Process Test\n================\n\n");
       
  -    STD_TEST_NEQ("Creating directory for later use", 
  +    STD_TEST_NEQ("Creating directory \"proctest\" for later use", 
                    apr_dir_make("proctest", APR_UREAD | APR_UWRITE | APR_UEXECUTE, pool))
   
       /* =================================================================== */
  @@ -136,12 +136,15 @@
       testfile = newproc.in;
       printf("OK\n");
   
  -    length = 256;
  +    length = strlen(teststr);
       printf("%-60s", "Writing the data to child");
  -    if (apr_file_write(testfile, teststr, &length) == APR_SUCCESS) {
  +    if ((rv = apr_file_write(testfile, teststr, &length)) == APR_SUCCESS) {
           printf("OK\n");
       }
  -    else printf("Write failed.\n");
  +    else {
  +        printf("Write failed: (%d) %s.\n",
  +               rv, apr_strerror(rv, msgbuf, sizeof msgbuf));
  +    }
   
       printf("%-60s", "Grabbing child's stdout");
       testfile = newproc.out;
  @@ -155,7 +158,7 @@
               printf("OK\n");
           else {
               printf( "Uh-Oh\n");
  -            printf("  (I actually got %s_\n", buf);
  +            printf("  (I actually got %s)\n", buf);
           }
       }
       else {