diff options
author | Albert Cheng <acheng@hdfgroup.org> | 2004-01-22 20:58:02 (GMT) |
---|---|---|
committer | Albert Cheng <acheng@hdfgroup.org> | 2004-01-22 20:58:02 (GMT) |
commit | f8cd97a833c21e21d4844ccec6a977f9f0afa64d (patch) | |
tree | 3715a3a112b4cc2e9b6e3af10f29e97081bed1d5 /test | |
parent | 0a3c3620730264cfa0f647ac47412038b9b8b4db (diff) | |
download | hdf5-f8cd97a833c21e21d4844ccec6a977f9f0afa64d.zip hdf5-f8cd97a833c21e21d4844ccec6a977f9f0afa64d.tar.gz hdf5-f8cd97a833c21e21d4844ccec6a977f9f0afa64d.tar.bz2 |
[svn-r8085] Purpose:
Improvement.
Description:
Verbosity level were specified by numbers which are not meaningful
and prone to typos.
Solution:
Adapted the Verbosity predefined level symbols from HDF4
and changed all numberic verbosity to symbolic values.
(Still need to convert some left over macros like MESSAGE.)
Platforms tested:
Eirene.
No h5committest since this is trivial.
Diffstat (limited to 'test')
-rw-r--r-- | test/h5test.h | 30 | ||||
-rw-r--r-- | test/testframe.c | 10 | ||||
-rw-r--r-- | test/testhdf5.c | 2 | ||||
-rw-r--r-- | test/testhdf5.h | 12 | ||||
-rw-r--r-- | test/ttbbt.c | 8 |
5 files changed, 43 insertions, 19 deletions
diff --git a/test/h5test.h b/test/h5test.h index 35e842e..bdbe869 100644 --- a/test/h5test.h +++ b/test/h5test.h @@ -21,17 +21,43 @@ #ifndef _H5TEST_H #define _H5TEST_H -#include <stdarg.h> - #undef NDEBUG #include "hdf5.h" #include "H5private.h" #ifdef H5_STDC_HEADERS # include <signal.h> +# include <stdarg.h> #endif /* + * Predefined test verbosity levels. + * + * Convention: + * + * The higher the verbosity value, the more information printed. + * So, output for higher verbosity also include output of all lower + * verbosity. + * + * Value Description + * 0 None: No informational message. + * 1 "All tests passed" + * 2 Header of overall test + * 3 Default: header and results of individual test + * 4 + * 5 Low: Major category of tests. + * 6 + * 7 Medium: Minor category of tests such as functions called. + * 8 + * 9 High: Highest level. All information. + */ +#define VERBO_NONE 0 /* None */ +#define VERBO_DEF 3 /* Default */ +#define VERBO_LO 5 /* Low */ +#define VERBO_MED 7 /* Medium */ +#define VERBO_HI 9 /* High */ + +/* * This contains the filename prefix specificied as command line option for * the parallel test files. */ diff --git a/test/testframe.c b/test/testframe.c index 298fe83..f138889 100644 --- a/test/testframe.c +++ b/test/testframe.c @@ -43,7 +43,7 @@ typedef struct TestStruct { * Variables used by testing framework. */ static int num_errs = 0; /* Total number of errors during testing */ -static int Verbosity = 4; /* Default Verbosity is Low */ +static int Verbosity = VERBO_DEF; /* Default Verbosity is Low */ static TestStruct Test[MAXNUMOFTESTS]; static int Index = 0; @@ -112,7 +112,7 @@ void TestUsage(void) { int i; - print_func("Usage: ttsafe [-v[erbose] (l[ow]|m[edium]|h[igh]|0-10)] \n"); + print_func("Usage: ttsafe [-v[erbose] (l[ow]|m[edium]|h[igh]|0-9)] \n"); print_func(" [-[e]x[clude] name+] \n"); print_func(" [-o[nly] name+] \n"); print_func(" [-b[egin] name] \n"); @@ -165,11 +165,11 @@ void TestParseCmdLine(int argc, char *argv[], int *Summary, int *CleanUp) if ((argc > CLLoop + 1) && ((HDstrcmp(argv[CLLoop], "-verbose") == 0) || (HDstrcmp(argv[CLLoop], "-v") == 0))) { if (argv[CLLoop + 1][0] == 'l') - Verbosity = 4; + Verbosity = VERBO_LO; else if (argv[CLLoop + 1][0] == 'm') - Verbosity = 6; + Verbosity = VERBO_MED; else if (argv[CLLoop + 1][0] == 'h') - Verbosity = 10; + Verbosity = VERBO_HI; else Verbosity = atoi(argv[CLLoop + 1]); } /* end if */ diff --git a/test/testhdf5.c b/test/testhdf5.c index 798ef7a..b368ad2 100644 --- a/test/testhdf5.c +++ b/test/testhdf5.c @@ -30,8 +30,6 @@ BUGS/LIMITATIONS - EXPORTED ROUTINES/VARIABLES: - Two variables are exported: num_errs, and Verbosity. */ diff --git a/test/testhdf5.h b/test/testhdf5.h index 1c908c9..755c96e 100644 --- a/test/testhdf5.h +++ b/test/testhdf5.h @@ -32,7 +32,7 @@ /* Use %ld to print the value because long should cover most cases. */ /* Used to make certain a return value _is_not_ a value */ #define CHECK(ret, val, where) do { \ - if (GetTestVerbosity()>9) print_func(" Call to routine: %15s at line %4d " \ + if (GetTestVerbosity()>=VERBO_HI) print_func(" Call to routine: %15s at line %4d " \ "in %s returned %ld \n", \ where, (int)__LINE__, __FILE__, \ (long)(ret)); \ @@ -44,7 +44,7 @@ } while(0) #define CHECK_I(ret,where) { \ - if (GetTestVerbosity()>9) { \ + if (GetTestVerbosity()>=VERBO_HI) { \ print_func(" Call to routine: %15s at line %4d in %s returned %ld\n", \ (where), (int)__LINE__, __FILE__, (long)(ret)); \ } \ @@ -56,7 +56,7 @@ } #define CHECK_PTR(ret,where) { \ - if (GetTestVerbosity()>9) { \ + if (GetTestVerbosity()>=VERBO_HI) { \ print_func(" Call to routine: %15s at line %4d in %s returned %p\n", \ (where), (int)__LINE__, __FILE__, (ret)); \ } \ @@ -69,7 +69,7 @@ /* Used to make certain a return value _is_ a value */ #define VERIFY(x, val, where) do { \ - if (GetTestVerbosity()>9) { \ + if (GetTestVerbosity()>=VERBO_HI) { \ print_func(" Call to routine: %15s at line %4d in %s had value " \ "%ld \n", (where), (int)__LINE__, __FILE__, (long)(x)); \ } \ @@ -82,11 +82,11 @@ /* Used to document process through a test and to check for errors */ #define RESULT(ret,func) do { \ - if (GetTestVerbosity()>8) { \ + if (GetTestVerbosity()>VERBO_MED) { \ print_func(" Call to routine: %15s at line %4d in %s returned " \ "%ld\n", func, (int)__LINE__, __FILE__, (long)(ret)); \ } \ - if (GetTestVerbosity()>9) H5Eprint(stdout); \ + if (GetTestVerbosity()>=VERBO_HI) H5Eprint(stdout); \ if ((ret) == FAIL) { \ TestErrPrintf("*** UNEXPECTED RETURN from %s is %ld at line %4d " \ "in %s\n", func, (long)(ret), (int)__LINE__, __FILE__); \ diff --git a/test/ttbbt.c b/test/ttbbt.c index 780e3d3..09f3f58 100644 --- a/test/ttbbt.c +++ b/test/ttbbt.c @@ -100,7 +100,7 @@ test_tbbt(void) swap_arr(rem_arr, i, t); } /* end for */ - if (GetTestVerbosity() > 9) + if (GetTestVerbosity() >= VERBO_HI) { printf("ins_arr: \n"); for (i = 0; i < test_size; i++) /* print the arrays */ @@ -117,12 +117,12 @@ test_tbbt(void) MESSAGE(9, ("inserting %d\n", (int) ins_arr[i])); H5TB_dins(tree, (void *) &ins_arr[i], NULL); #ifdef H5TB_DEBUG - if(GetTestVerbosity()>9) + if(GetTestVerbosity() >= VERBO_HI) H5TB_dump(tree, -1); #endif /* H5TB_DEBUG */ } #ifdef H5TB_DEBUG - if(GetTestVerbosity()>9) + if(GetTestVerbosity() >= VERBO_HI) H5TB_dump(tree, -1); #endif /* H5TB_DEBUG */ for (i = 0; i < test_size; i++) @@ -134,7 +134,7 @@ test_tbbt(void) MESSAGE(9, ("removing %d\n", (int) key)); H5TB_rem((H5TB_NODE **) tree, (H5TB_NODE *) r, NULL); #ifdef H5TB_DEBUG - if(GetTestVerbosity()>9) + if(GetTestVerbosity() >= VERBO_HI) H5TB_dump(tree, -1); #endif /* H5TB_DEBUG */ } /* end for */ |