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 2002/11/23 20:44:16 UTC

cvs commit: apr/test Makefile.in README testall.c testdir.c testfile.c testfileinfo.c testfmt.c testipsub.c testmmap.c testpools.c testrand.c testsleep.c teststr.c testtable.c testtime.c testud.c testvsn.c

rbb         2002/11/23 11:44:16

  Modified:    test     Makefile.in README testall.c testdir.c testfile.c
                        testfileinfo.c testfmt.c testipsub.c testmmap.c
                        testpools.c testrand.c testsleep.c teststr.c
                        testtable.c testtime.c testud.c testvsn.c
  Log:
  Change how individual test programs are run.  Now, testall is the driver
  for all tests.  IF you just want to run individual tests, you do that
  by passing the name of the test to testall.
  
  Revision  Changes    Path
  1.107     +8 -2      apr/test/Makefile.in
  
  Index: Makefile.in
  ===================================================================
  RCS file: /home/cvs/apr/test/Makefile.in,v
  retrieving revision 1.106
  retrieving revision 1.107
  diff -u -r1.106 -r1.107
  --- Makefile.in	23 Nov 2002 16:04:51 -0000	1.106
  +++ Makefile.in	23 Nov 2002 19:44:15 -0000	1.107
  @@ -154,8 +154,14 @@
   testmutexscope@EXEEXT@: testmutexscope.lo $(LOCAL_LIBS)
   	$(LINK) testmutexscope.lo $(LOCAL_LIBS) $(ALL_LIBS)
   
  -testall: testall.lo testtime.lo teststr.lo testvsn.lo testipsub.lo testmmap.lo testud.lo testtable.lo testsleep.lo testpools.lo testfmt.lo testfile.lo testdir.lo testfileinfo.lo testrand.lo CuTest.lo $(LOCAL_LIBS)
  -	$(LINK) testall.lo testtime.lo teststr.lo testvsn.lo testipsub.lo testmmap.lo testud.lo testtable.lo testsleep.lo testpools.lo testfmt.lo testfile.lo testdir.lo testfileinfo.lo testrand.lo CuTest.lo $(LOCAL_LIBS) $(ALL_LIBS)
  +testall: testall.lo testtime.lo teststr.lo testvsn.lo testipsub.lo \
  +         testmmap.lo testud.lo testtable.lo testsleep.lo testpools.lo \
  +         testfmt.lo testfile.lo testdir.lo testfileinfo.lo testrand.lo \
  +         testdso.lo CuTest.lo mod_test.la libmod_test.la $(LOCAL_LIBS)
  +	$(LINK) testall.lo testtime.lo teststr.lo testvsn.lo testipsub.lo \
  +	testmmap.lo testud.lo testtable.lo testsleep.lo testpools.lo      \
  +	testfmt.lo testfile.lo testdir.lo testfileinfo.lo testrand.lo     \
  +	testdso.lo CuTest.lo $(LOCAL_LIBS) $(ALL_LIBS)
   
   
   # DO NOT REMOVE
  
  
  
  1.4       +7 -34     apr/test/README
  
  Index: README
  ===================================================================
  RCS file: /home/cvs/apr/test/README,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- README	23 Oct 2002 14:34:52 -0000	1.3
  +++ README	23 Nov 2002 19:44:15 -0000	1.4
  @@ -59,43 +59,16 @@
   
       ./testall
   
  -Individual Program
  -------------------
  -
  -The second way to run a test program is as an individual program.  This is
  -done with another function, getsuite.  This function should always look like:
  -
  -#ifdef SINGLE_PROG
  -CuSuite *getsuite(void)
  -{
  -    return testtime();
  -}
  -#endif
  -
  -Notice that all this function does is return the suite that is generated
  -in the function used by the full driver.  This is very important.
  -
  -Also, notice that this function is protected by "#ifdef SINGLE_PROG".  All
  -test programs should include this function.  The individual program will
  -call this function to get the suite, and then it will run the suite and
  -print the output.
  -
  -The reason that this function must be protected, is that all test programs
  -have this function, and when they are linked into the full driver, they
  -conflict with each other.  I hope to fix this problem soon.
  -
  -Building individual test programs
  +Running individual tests
   ---------------------------------
   
  -To build individual test programs, you must do the following (for example):
  -
  -    MY_CFLAGS=-DSINGLE_PROGRAM make testtime
  -
  -To run the test, run:
  +It is not possible to build individual tests, however it is possible to
  +run individual tests.  When running the test suite, specify the name of the
  +tests that you want to run on the command line.  For example:
   
  -    ./testtime
  +	./testall teststr testrand
   
  -Most people should just build the full test driver.
  +Will run the Strings and Random generator tests.
   
   Reading the test suite output
   -----------------------------
  @@ -165,7 +138,7 @@
   To add a new Suite to the full driver, you must make a couple of modifications.
   
   1)  Edit test_apr.h, and add the prototype for the function.
  -2)  Edit testall.c, and add the function to the tests array.
  +2)  Edit testall.c, and add the function and name to the tests array.
   3)  Edit Makefile.in, and add the .lo file to the testall target.
   
   Once those four things are done, your tests will automatically be added
  
  
  
  1.18      +46 -20    apr/test/testall.c
  
  Index: testall.c
  ===================================================================
  RCS file: /home/cvs/apr/test/testall.c,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- testall.c	23 Nov 2002 16:04:51 -0000	1.17
  +++ testall.c	23 Nov 2002 19:44:15 -0000	1.18
  @@ -62,31 +62,36 @@
   /* Top-level pool which can be used by tests. */
   apr_pool_t *p;
   
  -typedef CuSuite *(testfunc)(void);
  +struct testlist {
  +    char *testname;
  +    CuSuite *(*func)(void);
  +};
  +typedef struct testlist testlist;
   
  -static testfunc *tests[NUM_TESTS] = {
  -    teststr,
  -    testtime,
  -    testvsn,
  -    testipsub,
  -    testmmap,
  -    testud,
  -    testtable,
  -    testsleep,
  -    testpool,
  -    testfmt,
  -    testfile,
  -    testdir,
  -    testfileinfo,
  -    testrand,
  -    NULL
  +static testlist tests[NUM_TESTS] = {
  +    {"teststr", teststr},
  +    {"testtime", testtime},
  +    {"testvsn", testvsn},
  +    {"testipsub", testipsub},
  +    {"testmmap", testmmap},
  +    {"testud", testud},
  +    {"testtable", testtable},
  +    {"testsleep", testsleep},
  +    {"testpool", testpool},
  +    {"testfmt", testfmt},
  +    {"testfile", testfile},
  +    {"testdir", testdir},
  +    {"testfileinfo", testfileinfo},
  +    {"testrand", testrand},
  +    {"LastTest", NULL}
   };
   
   int main(int argc, char *argv[])
   {
  -    CuSuiteList *alltests = CuSuiteListNew("All APR Tests");
  +    CuSuiteList *alltests;
       CuString *output = CuStringNew();
       int i;
  +    int partial = 0;
   
       apr_initialize();
       atexit(apr_terminate);
  @@ -95,8 +100,29 @@
   
       apr_pool_create(&p, NULL);
   
  -    for (i = 0; tests[i]; i++) {
  -        CuSuiteListAdd(alltests, tests[i]());
  +    /* build the list of tests to run */
  +    for (i = 1; i < argc; i++) {
  +        int j;
  +        if (!strcmp(argv[i], "-v")) {
  +            continue;
  +        }
  +        for (j = 0; tests[j].func != NULL; j++) {
  +            if (!strcmp(argv[i], tests[j].testname)) {
  +                if (!partial) {
  +                    alltests = CuSuiteListNew("Partial APR Tests");
  +                    partial = 1;
  +                }
  +
  +                CuSuiteListAdd(alltests, tests[j].func());
  +            }
  +        }
  +    }
  +
  +    if (!partial) {
  +        alltests = CuSuiteListNew("All APR Tests");
  +        for (i = 0; tests[i].func != NULL; i++) {
  +            CuSuiteListAdd(alltests, tests[i].func());
  +        }
       }
   
       CuSuiteListRunWithSummary(alltests);
  
  
  
  1.8       +0 -7      apr/test/testdir.c
  
  Index: testdir.c
  ===================================================================
  RCS file: /home/cvs/apr/test/testdir.c,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- testdir.c	14 Nov 2002 12:33:45 -0000	1.7
  +++ testdir.c	23 Nov 2002 19:44:15 -0000	1.8
  @@ -316,10 +316,3 @@
       return suite;
   }
   
  -#ifdef SINGLE_PROG
  -CuSuite *getsuite(void)
  -{
  -    return testdir();
  -}
  -#endif
  -
  
  
  
  1.55      +0 -8      apr/test/testfile.c
  
  Index: testfile.c
  ===================================================================
  RCS file: /home/cvs/apr/test/testfile.c,v
  retrieving revision 1.54
  retrieving revision 1.55
  diff -u -r1.54 -r1.55
  --- testfile.c	14 Nov 2002 12:41:35 -0000	1.54
  +++ testfile.c	23 Nov 2002 19:44:15 -0000	1.55
  @@ -462,11 +462,3 @@
       return suite;
   }
   
  -#ifdef SINGLE_PROG
  -CuSuite *getsuite(void)
  -{
  -    return testfile();
  -}
  -#endif
  -
  -
  
  
  
  1.3       +0 -7      apr/test/testfileinfo.c
  
  Index: testfileinfo.c
  ===================================================================
  RCS file: /home/cvs/apr/test/testfileinfo.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- testfileinfo.c	23 Nov 2002 12:37:12 -0000	1.2
  +++ testfileinfo.c	23 Nov 2002 19:44:15 -0000	1.3
  @@ -184,10 +184,3 @@
       return suite;
   }
   
  -#ifdef SINGLE_PROG
  -CuSuite *getsuite(void)
  -{
  -    return testfileinfo();
  -}
  -#endif
  -
  
  
  
  1.6       +0 -7      apr/test/testfmt.c
  
  Index: testfmt.c
  ===================================================================
  RCS file: /home/cvs/apr/test/testfmt.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- testfmt.c	24 Oct 2002 00:20:33 -0000	1.5
  +++ testfmt.c	23 Nov 2002 19:44:15 -0000	1.6
  @@ -115,10 +115,3 @@
       return suite;
   }
   
  -#ifdef SINGLE_PROG
  -CuSuite *getsuite(void)
  -{
  -    return testfmt();
  -}
  -#endif
  -
  
  
  
  1.6       +0 -7      apr/test/testipsub.c
  
  Index: testipsub.c
  ===================================================================
  RCS file: /home/cvs/apr/test/testipsub.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- testipsub.c	13 Oct 2002 03:59:52 -0000	1.5
  +++ testipsub.c	23 Nov 2002 19:44:15 -0000	1.6
  @@ -209,10 +209,3 @@
       return suite;
   }
   
  -#ifdef SINGLE_PROG
  -CuSuite *getsuite(void)
  -{
  -    return testipsub();
  -}
  -#endif
  -
  
  
  
  1.36      +0 -7      apr/test/testmmap.c
  
  Index: testmmap.c
  ===================================================================
  RCS file: /home/cvs/apr/test/testmmap.c,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- testmmap.c	14 Nov 2002 12:25:56 -0000	1.35
  +++ testmmap.c	23 Nov 2002 19:44:15 -0000	1.36
  @@ -165,10 +165,3 @@
       return suite;
   }
   
  -#ifdef SINGLE_PROG
  -CuSuite *getsuite(void)
  -{
  -    return testmmap();
  -}
  -#endif
  -
  
  
  
  1.7       +0 -8      apr/test/testpools.c
  
  Index: testpools.c
  ===================================================================
  RCS file: /home/cvs/apr/test/testpools.c,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- testpools.c	14 Nov 2002 12:25:56 -0000	1.6
  +++ testpools.c	23 Nov 2002 19:44:15 -0000	1.7
  @@ -144,11 +144,3 @@
       return suite;
   }
   
  -#ifdef SINGLE_PROG
  -CuSuite *getsuite(void)
  -{
  -    return testpool();
  -}
  -#endif
  -
  -
  
  
  
  1.5       +0 -7      apr/test/testrand.c
  
  Index: testrand.c
  ===================================================================
  RCS file: /home/cvs/apr/test/testrand.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- testrand.c	23 Nov 2002 16:04:51 -0000	1.4
  +++ testrand.c	23 Nov 2002 19:44:15 -0000	1.5
  @@ -87,10 +87,3 @@
       return suite;
   }
   
  -#ifdef SINGLE_PROG
  -CuSuite *getsuite(void)
  -{
  -    return testrand();
  -}
  -#endif
  -
  
  
  
  1.10      +0 -8      apr/test/testsleep.c
  
  Index: testsleep.c
  ===================================================================
  RCS file: /home/cvs/apr/test/testsleep.c,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- testsleep.c	22 Oct 2002 18:10:26 -0000	1.9
  +++ testsleep.c	23 Nov 2002 19:44:15 -0000	1.10
  @@ -90,11 +90,3 @@
       return suite;
   }
   
  -#ifdef SINGLE_PROG
  -CuSuite *getsuite(void)
  -{
  -    return testsleep();
  -}
  -#endif
  -
  -
  
  
  
  1.10      +0 -6      apr/test/teststr.c
  
  Index: teststr.c
  ===================================================================
  RCS file: /home/cvs/apr/test/teststr.c,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- teststr.c	16 Sep 2002 11:06:41 -0000	1.9
  +++ teststr.c	23 Nov 2002 19:44:15 -0000	1.10
  @@ -175,9 +175,3 @@
       return suite;
   }
   
  -#ifdef SINGLE_PROG
  -CuSuite *getsuite(void)
  -{
  -    return teststr();
  -}
  -#endif
  
  
  
  1.7       +0 -7      apr/test/testtable.c
  
  Index: testtable.c
  ===================================================================
  RCS file: /home/cvs/apr/test/testtable.c,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- testtable.c	14 Nov 2002 12:33:45 -0000	1.6
  +++ testtable.c	23 Nov 2002 19:44:15 -0000	1.7
  @@ -204,10 +204,3 @@
       return suite;
   }
   
  -#ifdef SINGLE_PROG
  -CuSuite *getsuite(void)
  -{
  -    return testtable();
  -}
  -#endif
  -
  
  
  
  1.41      +0 -6      apr/test/testtime.c
  
  Index: testtime.c
  ===================================================================
  RCS file: /home/cvs/apr/test/testtime.c,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- testtime.c	20 Nov 2002 03:50:22 -0000	1.40
  +++ testtime.c	23 Nov 2002 19:44:15 -0000	1.41
  @@ -304,9 +304,3 @@
       return suite;
   }
   
  -#ifdef SINGLE_PROG
  -CuSuite *getsuite(void)
  -{
  -    return testtime();
  -}
  -#endif
  
  
  
  1.7       +0 -7      apr/test/testud.c
  
  Index: testud.c
  ===================================================================
  RCS file: /home/cvs/apr/test/testud.c,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- testud.c	22 Oct 2002 13:52:16 -0000	1.6
  +++ testud.c	23 Nov 2002 19:44:15 -0000	1.7
  @@ -127,10 +127,3 @@
       return suite;
   }
   
  -#ifdef SINGLE_PROG
  -CuSuite *getsuite(void)
  -{
  -    return testud();
  -}
  -#endif
  -
  
  
  
  1.5       +0 -6      apr/test/testvsn.c
  
  Index: testvsn.c
  ===================================================================
  RCS file: /home/cvs/apr/test/testvsn.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- testvsn.c	13 Oct 2002 02:20:34 -0000	1.4
  +++ testvsn.c	23 Nov 2002 19:44:15 -0000	1.5
  @@ -85,9 +85,3 @@
       return suite;
   }
   
  -#ifdef SINGLE_PROG
  -CuSuite *getsuite(void)
  -{
  -    return testvsn();
  -}
  -#endif