summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAlbert Cheng <acheng@hdfgroup.org>2010-01-22 21:17:48 (GMT)
committerAlbert Cheng <acheng@hdfgroup.org>2010-01-22 21:17:48 (GMT)
commit2c872f398b3824c416d42f2018c3d3ea0c40e80f (patch)
tree63b6a12e9761da108eed51954a5146fbd12942b6 /test
parent3c5dc1a808c1513632786cbf4a0a6d4b257c1953 (diff)
downloadhdf5-2c872f398b3824c416d42f2018c3d3ea0c40e80f.zip
hdf5-2c872f398b3824c416d42f2018c3d3ea0c40e80f.tar.gz
hdf5-2c872f398b3824c416d42f2018c3d3ea0c40e80f.tar.bz2
[svn-r18154] ID 1753: added macro version of GetTestVerbosity.
GetTestVerbosity() is called many times during tests. Implemented a more efficient macro version HDGetTestVerbosity. Tested: Jam (serial and parallel). Did not run h5committest since this is a trival change that is portable, I am 99% sure.
Diffstat (limited to 'test')
-rw-r--r--test/testframe.c8
-rw-r--r--test/testhdf5.h25
2 files changed, 20 insertions, 13 deletions
diff --git a/test/testframe.c b/test/testframe.c
index dd2f2f4..f0d94d8 100644
--- a/test/testframe.c
+++ b/test/testframe.c
@@ -45,7 +45,7 @@ typedef struct TestStruct {
* Variables used by testing framework.
*/
static int num_errs = 0; /* Total number of errors during testing */
-static int Verbosity = VERBO_DEF; /* Default Verbosity is Low */
+int TestVerbosity = VERBO_DEF; /* Default Verbosity is Low */
static int Summary = 0; /* Show test summary. Default is no. */
static int CleanUp = 1; /* Do cleanup or not. Default is yes. */
static int TestExpress = -1; /* Do TestExpress or not. -1 means not set yet. */
@@ -361,7 +361,7 @@ void TestCleanup(void)
*/
int GetTestVerbosity(void)
{
- return(Verbosity);
+ return(TestVerbosity);
}
/*
@@ -372,8 +372,8 @@ int SetTestVerbosity(int newval)
{
int oldval;
- oldval = Verbosity;
- Verbosity = newval;
+ oldval = TestVerbosity;
+ TestVerbosity = newval;
return(oldval);
}
diff --git a/test/testhdf5.h b/test/testhdf5.h
index f2a820f..adac3fe 100644
--- a/test/testhdf5.h
+++ b/test/testhdf5.h
@@ -29,10 +29,14 @@
/* Include generic testing header also */
#include "h5test.h"
+/* A macro version of HDGetTestVerbosity(). */
+/* Should be used internally by the libtest.a only. */
+#define HDGetTestVerbosity() (TestVerbosity)
+
/* 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()>=VERBO_HI) print_func(" Call to routine: %15s at line %4d " \
+ if (HDGetTestVerbosity()>=VERBO_HI) print_func(" Call to routine: %15s at line %4d " \
"in %s returned %ld \n", \
where, (int)__LINE__, __FILE__, \
(long)(ret)); \
@@ -44,7 +48,7 @@
} while(0)
#define CHECK_I(ret,where) { \
- if (GetTestVerbosity()>=VERBO_HI) { \
+ if (HDGetTestVerbosity()>=VERBO_HI) { \
print_func(" Call to routine: %15s at line %4d in %s returned %ld\n", \
(where), (int)__LINE__, __FILE__, (long)(ret)); \
} \
@@ -56,7 +60,7 @@
}
#define CHECK_PTR(ret,where) { \
- if (GetTestVerbosity()>=VERBO_HI) { \
+ if (HDGetTestVerbosity()>=VERBO_HI) { \
print_func(" Call to routine: %15s at line %4d in %s returned %p\n", \
(where), (int)__LINE__, __FILE__, (ret)); \
} \
@@ -70,7 +74,7 @@
/* Used to make certain a return value _is_ a value */
#define VERIFY(_x, _val, where) do { \
long __x = (long)_x, __val = (long)_val; \
- if(GetTestVerbosity() >= VERBO_HI) { \
+ if(HDGetTestVerbosity() >= VERBO_HI) { \
print_func(" Call to routine: %15s at line %4d in %s had value " \
"%ld \n", (where), (int)__LINE__, __FILE__, __x); \
} \
@@ -84,7 +88,7 @@
/* Used to make certain a (non-'long' type's) return value _is_ a value */
#define VERIFY_TYPE(_x, _val, _type, _format, where) do { \
_type __x = (_type)_x, __val = (_type)_val; \
- if(GetTestVerbosity() >= VERBO_HI) { \
+ if(HDGetTestVerbosity() >= VERBO_HI) { \
print_func(" Call to routine: %15s at line %4d in %s had value " \
_format " \n", (where), (int)__LINE__, __FILE__, __x); \
} \
@@ -97,7 +101,7 @@
/* Used to make certain a string return value _is_ a value */
#define VERIFY_STR(x, val, where) do { \
- if (GetTestVerbosity()>=VERBO_HI) { \
+ if (HDGetTestVerbosity()>=VERBO_HI) { \
print_func(" Call to routine: %15s at line %4d in %s had value " \
"%s \n", (where), (int)__LINE__, __FILE__, x); \
} \
@@ -110,11 +114,11 @@
/* Used to document process through a test and to check for errors */
#define RESULT(ret,func) do { \
- if (GetTestVerbosity()>VERBO_MED) { \
+ if (HDGetTestVerbosity()>VERBO_MED) { \
print_func(" Call to routine: %15s at line %4d in %s returned " \
"%ld\n", func, (int)__LINE__, __FILE__, (long)(ret)); \
} \
- if (GetTestVerbosity()>=VERBO_HI) \
+ if (HDGetTestVerbosity()>=VERBO_HI) \
H5Eprint2(H5E_DEFAULT, stdout); \
if ((ret) == FAIL) { \
TestErrPrintf("*** UNEXPECTED RETURN from %s is %ld at line %4d " \
@@ -124,7 +128,7 @@
} while(0)
/* Used to document process through a test */
-#define MESSAGE(V,A) {if (GetTestVerbosity()>(V)) print_func A;}
+#define MESSAGE(V,A) {if (HDGetTestVerbosity()>(V)) print_func A;}
/* definitions for command strings */
#define VERBOSITY_STR "Verbosity"
@@ -185,6 +189,9 @@ void cleanup_sohm(void);
void cleanup_misc(void);
void cleanup_unicode(void);
+/* Extern global variables */
+extern int TestVerbosity;
+
#ifdef __cplusplus
}
#endif