diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2004-01-06 17:53:13 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2004-01-06 17:53:13 (GMT) |
commit | ce2b03097bbf2fb80db60673610e707a028645d0 (patch) | |
tree | 20178d40250fff3696bfff8b6864c011e8018562 /test/h5test.c | |
parent | 68607efcd10222ed1b1d19308d3586eb65fe3644 (diff) | |
download | hdf5-ce2b03097bbf2fb80db60673610e707a028645d0.zip hdf5-ce2b03097bbf2fb80db60673610e707a028645d0.tar.gz hdf5-ce2b03097bbf2fb80db60673610e707a028645d0.tar.bz2 |
[svn-r8022] Purpose:
Code cleanup
Description:
Refactor library testing framework (used for the testhdf5 & ttsafe tests)
to remove almost all of the duplicated code, moving the common code into a
new 'testframe.c' source file.
Platforms tested:
FreeBSD 4.9 (sleipnir) w & w/o thread-safety
h5committest
Diffstat (limited to 'test/h5test.c')
-rw-r--r-- | test/h5test.c | 36 |
1 files changed, 12 insertions, 24 deletions
diff --git a/test/h5test.c b/test/h5test.c index 79c9da8..3a8e72c 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -89,14 +89,6 @@ MPI_Info h5_io_info_g=MPI_INFO_NULL;/* MPI INFO object for IO */ */ static const char *multi_letters = "msbrglo"; -/* - * Global variables used by InitTest(). - * The code should be revised so that these do not need to be - * global. - */ -struct TestStruct Test[MAXNUMOFTESTS]; -int Index = 0; - #ifdef H5_WANT_H5_V1_6_COMPAT static herr_t h5_errors(void *client_data); #else /* H5_WANT_H5_V1_6_COMPAT */ @@ -804,24 +796,20 @@ h5_get_file_size(const char *filename) return(0); } /* end get_file_size() */ - /* - * Setup a test function. It must have no parameters and returns void. + * This routine is designed to provide equivalent functionality to 'printf' + * and allow easy replacement for environments which don't have stdin/stdout + * available. (i.e. Windows & the Mac) */ -void -InitTest(const char *TheName, void (*TheCall) (void), void (*Cleanup) (void), const char *TheDescr) +int +print_func(const char *format, ...) { - if (Index >= MAXNUMOFTESTS) { - printf("Too many tests added, increase MAXNUMOFTEST(%d).\n", - MAXNUMOFTESTS); - exit(-1); - } /* end if */ - HDstrcpy(Test[Index].Description, TheDescr); - HDstrcpy(Test[Index].Name, TheName); - Test[Index].Call = TheCall; - Test[Index].Cleanup = Cleanup; - Test[Index].NumErrors = -1; - Test[Index].SkipFlag = 0; - Index++; + va_list arglist; + int ret_value; + + va_start(arglist, format); + ret_value = vprintf(format, arglist); + va_end(arglist); + return ret_value; } |