wrowe       01/01/28 15:23:25

  Modified:    test     MakeWin32Make.pl Makefile.in testfile.c testoc.c
                        testsockopt.c
  Log:
    Get tests building, and actually checking for libapr.la revisions to
    save debugging agrivation.  Shout if I broke it.  Win32 users should
    find the aprtest.dsw DevStudio workspace a lovely little place to get
    work done.  [No help from MS - notice the .pl Makefile.in rewriter :-]
  
  Revision  Changes    Path
  1.6       +1 -0      apr/test/MakeWin32Make.pl
  
  Index: MakeWin32Make.pl
  ===================================================================
  RCS file: /home/cvs/apr/test/MakeWin32Make.pl,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- MakeWin32Make.pl  2001/01/23 19:51:43     1.5
  +++ MakeWin32Make.pl  2001/01/28 23:23:20     1.6
  @@ -19,6 +19,7 @@
           $t =~ s|-g ||;
       }
       $t =~ s|[EMAIL PROTECTED]@||;
  +    $t =~ s|\.\./libapr\.la|../LibD/apr.lib|;
   
       $t =~ s|[EMAIL PROTECTED]@|del|;
       if ($t =~ s|(\$\(RM\)) -f|$1|) {
  
  
  
  1.40      +21 -21    apr/test/Makefile.in
  
  Index: Makefile.in
  ===================================================================
  RCS file: /home/cvs/apr/test/Makefile.in,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- Makefile.in       2001/01/25 12:19:37     1.39
  +++ Makefile.in       2001/01/28 23:23:21     1.40
  @@ -34,65 +34,65 @@
   INCLUDES=-I$(INCDIR)
   
   
  [EMAIL PROTECTED]@: testfile.lo
  [EMAIL PROTECTED]@: testfile.lo ../libapr.la
        $(LINK) testfile.lo $(ALL_LIBS)
   
  [EMAIL PROTECTED]@: testflock.lo
  [EMAIL PROTECTED]@: testflock.lo ../libapr.la
        $(LINK) testflock.lo $(ALL_LIBS)
   
   ### why the export-dynamic?
  [EMAIL PROTECTED]@: testdso.lo
  [EMAIL PROTECTED]@: testdso.lo ../libapr.la
        $(LINK) --export-dynamic testdso.lo $(ALL_LIBS)
   
  [EMAIL PROTECTED]@: testoc.lo
  [EMAIL PROTECTED]@: testoc.lo ../libapr.la
        $(LINK) testoc.lo $(ALL_LIBS)
   
  [EMAIL PROTECTED]@: occhild.lo
  [EMAIL PROTECTED]@: occhild.lo ../libapr.la
        $(LINK) occhild.lo $(ALL_LIBS)
   
  -mod_test.so: mod_test.lo
  -     $(LINK) --module mod_test.lo
  +mod_test.so: mod_test.lo ../libapr.la
  +     $(LINK) --module mod_test.lo $(ALL_LIBS)
   
  [EMAIL PROTECTED]@: testargs.lo
  [EMAIL PROTECTED]@: testargs.lo ../libapr.la
        $(LINK) testargs.lo $(ALL_LIBS)
   
  [EMAIL PROTECTED]@: testcontext.lo
  [EMAIL PROTECTED]@: testcontext.lo ../libapr.la
        $(LINK) testcontext.lo $(ALL_LIBS)
   
  [EMAIL PROTECTED]@: testproc.lo
  [EMAIL PROTECTED]@: testproc.lo ../libapr.la
        $(LINK) testproc.lo $(ALL_LIBS)
   
  [EMAIL PROTECTED]@: testthread.lo
  [EMAIL PROTECTED]@: testthread.lo ../libapr.la
        $(LINK) testthread.lo $(ALL_LIBS)
   
  [EMAIL PROTECTED]@: testsock.lo [EMAIL PROTECTED]@ [EMAIL PROTECTED]@ [EMAIL 
PROTECTED]@
  [EMAIL PROTECTED]@: testsock.lo [EMAIL PROTECTED]@ [EMAIL PROTECTED]@ [EMAIL 
PROTECTED]@ ../libapr.la
        $(LINK) testsock.lo $(ALL_LIBS)
   
  [EMAIL PROTECTED]@: client.lo
  [EMAIL PROTECTED]@: client.lo ../libapr.la
        $(LINK) client.lo $(ALL_LIBS)
   
  [EMAIL PROTECTED]@: server.lo sendfile.lo
  [EMAIL PROTECTED]@: server.lo sendfile.lo ../libapr.la
        $(LINK) server.lo $(ALL_LIBS)
   
  [EMAIL PROTECTED]@: sendfile.lo
  [EMAIL PROTECTED]@: sendfile.lo ../libapr.la
        $(LINK) sendfile.lo $(ALL_LIBS)
   
  [EMAIL PROTECTED]@: testtime.lo
  [EMAIL PROTECTED]@: testtime.lo ../libapr.la
        $(LINK) testtime.lo $(ALL_LIBS)
   
  [EMAIL PROTECTED]@: testmmap.lo
  [EMAIL PROTECTED]@: testmmap.lo ../libapr.la
        $(LINK) testmmap.lo $(ALL_LIBS)
   
  [EMAIL PROTECTED]@: testshmem.lo
  [EMAIL PROTECTED]@: testshmem.lo ../libapr.la
        $(LINK) testshmem.lo $(ALL_LIBS)
   
  [EMAIL PROTECTED]@: testpipe.lo
  [EMAIL PROTECTED]@: testpipe.lo ../libapr.la
        $(LINK) testpipe.lo $(ALL_LIBS)
   
  [EMAIL PROTECTED]@: testuuid.lo
  [EMAIL PROTECTED]@: testuuid.lo ../libapr.la
        $(LINK) testuuid.lo $(ALL_LIBS)
   
  [EMAIL PROTECTED]@: testsockopt.lo
  [EMAIL PROTECTED]@: testsockopt.lo ../libapr.la
        $(LINK) testsockopt.lo $(ALL_LIBS)
   
   # DO NOT REMOVE
  
  
  
  1.28      +93 -1     apr/test/testfile.c
  
  Index: testfile.c
  ===================================================================
  RCS file: /home/cvs/apr/test/testfile.c,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- testfile.c        2001/01/23 19:56:26     1.27
  +++ testfile.c        2001/01/28 23:23:21     1.28
  @@ -57,6 +57,7 @@
   #include <stdlib.h>
   #include <string.h>
   #include "apr_file_io.h"
  +#include "apr_file_info.h"
   #include "apr_network_io.h"
   #include "apr_errno.h"
   #include "apr_general.h"
  @@ -65,6 +66,27 @@
   #include <unistd.h>
   #endif
   
  +struct view_fileinfo
  +{
  +    apr_int32_t bits;
  +    char *description;
  +} vfi[] = {
  +    APR_FINFO_MTIME,  "MTIME",
  +    APR_FINFO_CTIME,  "CTIME",
  +    APR_FINFO_ATIME,  "ATIME",
  +    APR_FINFO_SIZE,   "SIZE",
  +    APR_FINFO_DEV,    "DEV",
  +    APR_FINFO_INODE,  "INODE",
  +    APR_FINFO_NLINK,  "NLINK",
  +    APR_FINFO_TYPE,   "TYPE",
  +    APR_FINFO_USER,   "USER", 
  +    APR_FINFO_GROUP,  "GROUP", 
  +    APR_FINFO_UPROT,  "UPROT", 
  +    APR_FINFO_GPROT,  "GPROT",
  +    APR_FINFO_WPROT,  "WPROT",
  +    0,                NULL
  +}; 
  +
   int test_filedel(apr_pool_t *);
   int testdirs(apr_pool_t *);
   static void test_read(apr_pool_t *);
  @@ -79,6 +101,7 @@
       apr_pool_t *context;
       apr_pool_t *cont2;
       apr_file_t *thefile = NULL;
  +    apr_finfo_t finfo;
       apr_socket_t *testsock = NULL;
       apr_pollfd_t *sdset = NULL;
       apr_status_t status;
  @@ -90,6 +113,8 @@
       const char *str;
       char *filename = "test.fil";
       char *teststr;
  +    apr_uid_t uid;
  +    apr_gid_t gid;
   #if APR_FILES_AS_SOCKETS
       apr_int32_t num;
   #endif
  @@ -227,6 +252,25 @@
           fprintf(stdout, "OK\n");
       }
   
  +    fprintf(stdout, "\tGetting fileinfo.......");
  +    status = apr_getfileinfo(&finfo, APR_FINFO_NORM, thefile);
  +    if (status  == APR_INCOMPLETE) {
  +     int i;
  +        fprintf(stdout, "INCOMPLETE\n");
  +        for (i = 0; vfi[i].bits; ++i)
  +            if (vfi[i].bits & ~finfo.valid)
  +                fprintf(stdout, "\t    Missing %s\n", vfi[i].description);
  +    }
  +    else if (status  != APR_SUCCESS) {
  +        fprintf(stderr, "Couldn't get the fileinfo\n");
  +        exit(-1); 
  +    }
  +    else {
  +        fprintf(stdout, "OK\n");
  +    }
  +    gid = finfo.group;
  +    uid = finfo.user;
  +
       fprintf(stdout, "\tClosing File.......");
       status = apr_close(thefile);
       if (status  != APR_SUCCESS) {
  @@ -236,7 +280,54 @@
       else {
           fprintf(stdout, "OK\n");
       }
  -    
  +
  +    fprintf(stdout, "\tStat'ing file.......");
  +    status = apr_stat(&finfo, filename, APR_FINFO_NORM, context);
  +    if (status  == APR_INCOMPLETE) {
  +     int i;
  +        fprintf(stdout, "INCOMPLETE\n");
  +        for (i = 0; vfi[i].bits; ++i)
  +            if (vfi[i].bits & ~finfo.valid)
  +                fprintf(stdout, "\t    Missing %s\n", vfi[i].description);
  +    }
  +    else if (status  != APR_SUCCESS) {
  +        fprintf(stderr, "Couldn't stat the file\n");
  +        exit(-1); 
  +    }
  +    else {
  +        fprintf(stdout, "OK\n");
  +    }    
  +
  +    if (finfo.valid & APR_FINFO_GROUP) {
  +        fprintf(stdout, "\tComparing group ids.......");
  +        status = apr_get_groupname(&buf, finfo.group, context);
  +        if (status  != APR_SUCCESS) {
  +            fprintf(stderr, "Couldn't retrieve the group name\n");
  +            exit(-1); 
  +        }
  +        status = apr_compare_groups(finfo.group, gid);
  +        if (status  != APR_SUCCESS) {
  +            fprintf(stderr, "gid's for %s don't match\n", buf);
  +            exit(-1); 
  +        }
  +        fprintf(stdout, "gid's for %s match\n", buf);
  +    }
  +
  +    if (finfo.valid & APR_FINFO_USER) {
  +        fprintf(stdout, "\tComparing user ids.......");
  +        status = apr_get_username(&buf, finfo.user, context);
  +        if (status  != APR_SUCCESS) {
  +            fprintf(stderr, "Couldn't retrieve the user name\n");
  +            exit(-1); 
  +        }
  +        status = apr_compare_users(finfo.user, uid);
  +        if (status  != APR_SUCCESS) {
  +            fprintf(stderr, "uid's for %s don't match\n", buf);
  +            exit(-1); 
  +        }
  +        fprintf(stdout, "uid's for %s match\n", buf);
  +    }
  +
       fprintf(stdout, "\tDeleting file.......");
       status = apr_remove_file(filename, context);
       if (status  != APR_SUCCESS) {
  @@ -261,6 +352,7 @@
       test_filedel(context);
       test_read(context);
   
  +    apr_destroy_pool(context);
       return 1;
   }
   
  
  
  
  1.16      +2 -2      apr/test/testoc.c
  
  Index: testoc.c
  ===================================================================
  RCS file: /home/cvs/apr/test/testoc.c,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- testoc.c  2000/12/05 00:14:11     1.15
  +++ testoc.c  2001/01/28 23:23:22     1.16
  @@ -151,11 +151,11 @@
       
       fprintf(stdout, "[PARENT] Checking on children..........\n");
       apr_check_other_child();
  -    
  -    return 1;
   #else
       fprintf(stdout, "OC failed!\n");
       fprintf(stdout, "Other_child is not supported on this platform\n");
   #endif
  +
  +    return 1;
   }    
   
  
  
  
  1.2       +6 -1      apr/test/testsockopt.c
  
  Index: testsockopt.c
  ===================================================================
  RCS file: /home/cvs/apr/test/testsockopt.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- testsockopt.c     2001/01/25 12:19:38     1.1
  +++ testsockopt.c     2001/01/28 23:23:22     1.2
  @@ -78,6 +78,11 @@
       exit(-1);
   }
   
  +static void closeapr(void)
  +{
  +    apr_terminate();
  +}
  +
   int main(void)
   {
       apr_pool_t *context;
  @@ -90,7 +95,7 @@
           fprintf(stderr, "Couldn't initialize.");
           exit(-1);
       }
  -    atexit(apr_terminate);
  +    atexit(closeapr);
       if (apr_create_pool(&context, NULL) != APR_SUCCESS) {
           fprintf(stderr, "Couldn't allocate context.");
           exit(-1);
  
  
  

Reply via email to