diff options
author | Albert Cheng <acheng@hdfgroup.org> | 2004-01-22 20:57:34 (GMT) |
---|---|---|
committer | Albert Cheng <acheng@hdfgroup.org> | 2004-01-22 20:57:34 (GMT) |
commit | 7f5fd94b565ca3a7f0bcdf0d11100c556048ff35 (patch) | |
tree | 550895f47fe521c80aa87e754e5da5ad30e67087 | |
parent | 618e7e7fbb5d7112ba38eb680d4b2a5b5c15adc1 (diff) | |
download | hdf5-7f5fd94b565ca3a7f0bcdf0d11100c556048ff35.zip hdf5-7f5fd94b565ca3a7f0bcdf0d11100c556048ff35.tar.gz hdf5-7f5fd94b565ca3a7f0bcdf0d11100c556048ff35.tar.bz2 |
[svn-r8084] 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.
Misc. update:
-rw-r--r-- | test/h5test.h | 27 | ||||
-rw-r--r-- | test/testframe.c | 10 | ||||
-rw-r--r-- | test/testhdf5.h | 24 | ||||
-rw-r--r-- | test/ttbbt.c | 8 |
4 files changed, 48 insertions, 21 deletions
diff --git a/test/h5test.h b/test/h5test.h index 8a53f0f..9045930 100644 --- a/test/h5test.h +++ b/test/h5test.h @@ -31,6 +31,33 @@ #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 ea3be51..416ae33 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; @@ -117,7 +117,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"); @@ -170,11 +170,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.h b/test/testhdf5.h index 5a12cc1..6430b54 100644 --- a/test/testhdf5.h +++ b/test/testhdf5.h @@ -33,7 +33,7 @@ /* Used to make certain a return value _is_not_ a value */ #ifdef H5_WANT_H5_V1_6_COMPAT #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)); \ @@ -45,7 +45,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)); \ } \ @@ -57,7 +57,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)); \ } \ @@ -70,7 +70,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)); \ } \ @@ -83,11 +83,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) \ + if (GetTestVerbosity()>=VERBO_HI) \ H5Eprint(stdout); \ if ((ret) == FAIL) { \ TestErrPrintf("*** UNEXPECTED RETURN from %s is %ld at line %4d " \ @@ -98,7 +98,7 @@ #else #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)); \ @@ -110,7 +110,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)); \ } \ @@ -122,7 +122,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)); \ } \ @@ -135,7 +135,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)); \ } \ @@ -148,11 +148,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) \ + if (GetTestVerbosity()>=VERBO_HI) \ H5Eprint(H5E_DEFAULT, stdout); \ if ((ret) == FAIL) { \ TestErrPrintf("*** UNEXPECTED RETURN from %s is %ld at line %4d " \ diff --git a/test/ttbbt.c b/test/ttbbt.c index b8c00f2..fa34c84 100644 --- a/test/ttbbt.c +++ b/test/ttbbt.c @@ -98,7 +98,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 */ @@ -115,12 +115,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++) @@ -132,7 +132,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 */ |