[svn-r8289] Purpose:

Feature

Description:
Added to AddTest() a generic parameters pointer argument to
allow some extra parameters for some tests.  E.g., test file
names can be customized during runtime and passed into the
test routines.

Platforms tested:
"h5committested".
Also run compat test in eirene.
This commit is contained in:
Albert Cheng 2004-03-30 18:35:16 -05:00
parent c3d9b510b4
commit d7a5f94d66
5 changed files with 44 additions and 35 deletions

View File

@ -54,20 +54,20 @@ main(int argc, char *argv[])
TestInit();
// testing file creation and opening in tfile.cpp
AddTest("file", test_file, cleanup_file, "File I/O Operations");
AddTest("file", test_file, cleanup_file, "File I/O Operations", NULL);
// testing dataspace functionalities in th5s.cpp
AddTest("h5s", test_h5s, cleanup_h5s, "Dataspaces");
AddTest("h5s", test_h5s, cleanup_h5s, "Dataspaces", NULL);
/* Comment out tests that are not done yet. - BMR, Feb 2001
AddTest("attr", test_attr, cleanup_attr, "Attributes");
AddTest("select", test_select, cleanup_select, "Selections");
AddTest("time", test_time, cleanup_time, "Time Datatypes");
AddTest("reference", test_reference, cleanup_reference, "References");
AddTest("vltypes", test_vltypes, cleanup_vltypes, "Variable-Length Datatypes");
AddTest("vlstrings", test_vlstrings, cleanup_vlstrings, "Variable-Length Strings");
AddTest("iterate", test_iterate, cleanup_iterate, "Group & Attribute Iteration");
AddTest("array", test_array, cleanup_array, "Array Datatypes");
AddTest("genprop", test_genprop, cleanup_genprop, "Generic Properties");
AddTest("attr", test_attr, cleanup_attr, "Attributes", NULL);
AddTest("select", test_select, cleanup_select, "Selections", NULL);
AddTest("time", test_time, cleanup_time, "Time Datatypes", NULL);
AddTest("reference", test_reference, cleanup_reference, "References", NULL);
AddTest("vltypes", test_vltypes, cleanup_vltypes, "Variable-Length Datatypes", NULL);
AddTest("vlstrings", test_vlstrings, cleanup_vlstrings, "Variable-Length Strings", NULL);
AddTest("iterate", test_iterate, cleanup_iterate, "Group & Attribute Iteration", NULL);
AddTest("array", test_array, cleanup_array, "Array Datatypes", NULL);
AddTest("genprop", test_genprop, cleanup_genprop, "Generic Properties", NULL);
Comment out tests that are not done yet */
/* Display testing information */

View File

@ -115,7 +115,8 @@ H5TEST_DLL int print_func(const char *format, ...);
/* Routines for operating on the list of tests (for the "all in one" tests) */
H5TEST_DLL void TestUsage(void);
H5TEST_DLL void AddTest(const char *TheName, void (*TheCall) (void),
void (*Cleanup) (void), const char *TheDescr);
void (*Cleanup) (void), const char *TheDescr,
const void *Parameters);
H5TEST_DLL void TestInfo(const char *ProgName);
H5TEST_DLL void TestParseCmdLine(int argc, char *argv[], int *Summary, int *CleanUp);
H5TEST_DLL void PerformTests(void);

View File

@ -36,6 +36,7 @@ typedef struct TestStruct {
char Name[MAXTESTNAME];
void (*Call)(void);
void (*Cleanup)(void);
void *Parameters;
} TestStruct;
@ -51,9 +52,15 @@ static int Index = 0;
/*
* Setup a test function and add it to the list of tests.
* It must have no parameters and returns void.
* TheName--short test name
* TheCall--the test routine
* Cleanup--the cleanup routine for the test
* TheDescr--Long description of the test
* Parameters--pointer to extra parameters. Use NULL if none used.
* Since only the pointer is copied, the contents should not change.
*/
void
AddTest(const char *TheName, void (*TheCall) (void), void (*Cleanup) (void), const char *TheDescr)
AddTest(const char *TheName, void (*TheCall) (void), void (*Cleanup) (void), const char *TheDescr, const void *Parameters)
{
/* Sanity checking */
if (Index >= MAXNUMOFTESTS) {
@ -79,6 +86,7 @@ AddTest(const char *TheName, void (*TheCall) (void), void (*Cleanup) (void), con
Test[Index].Cleanup = Cleanup;
Test[Index].NumErrors = -1;
Test[Index].SkipFlag = 0;
Test[Index].Parameters = Parameters;
/* Increment test count */
Index++;

View File

@ -46,24 +46,24 @@ main(int argc, char *argv[])
TestInit();
/* Tests are generally arranged from least to most complexity... */
AddTest("configure", test_configure, cleanup_configure, "Configure definitions");
AddTest("metadata", test_metadata, cleanup_metadata, "Encode/decode metadata code");
AddTest("tbbt", test_tbbt, NULL, "Threaded, Balanced, Binary Trees");
AddTest("tst", test_tst, NULL, "Ternary Search Trees");
AddTest("heap", test_heap, NULL, "Memory Heaps");
AddTest("refstr", test_refstr, NULL, "Reference Counted Strings");
AddTest("file", test_file, cleanup_file, "Low-Level File I/O");
AddTest("h5s", test_h5s, cleanup_h5s, "Dataspaces");
AddTest("attr", test_attr, cleanup_attr, "Attributes");
AddTest("select", test_select, cleanup_select, "Selections");
AddTest("time", test_time, cleanup_time, "Time Datatypes");
AddTest("reference", test_reference, cleanup_reference, "References");
AddTest("vltypes", test_vltypes, cleanup_vltypes, "Variable-Length Datatypes");
AddTest("vlstrings", test_vlstrings, cleanup_vlstrings, "Variable-Length Strings");
AddTest("iterate", test_iterate, cleanup_iterate, "Group & Attribute Iteration");
AddTest("array", test_array, cleanup_array, "Array Datatypes");
AddTest("genprop", test_genprop, cleanup_genprop, "Generic Properties");
AddTest("misc", test_misc, cleanup_misc, "Miscellaneous");
AddTest("configure", test_configure, cleanup_configure, "Configure definitions", NULL);
AddTest("metadata", test_metadata, cleanup_metadata, "Encode/decode metadata code", NULL);
AddTest("tbbt", test_tbbt, NULL, "Threaded, Balanced, Binary Trees", NULL);
AddTest("tst", test_tst, NULL, "Ternary Search Trees", NULL);
AddTest("heap", test_heap, NULL, "Memory Heaps", NULL);
AddTest("refstr", test_refstr, NULL, "Reference Counted Strings", NULL);
AddTest("file", test_file, cleanup_file, "Low-Level File I/O", NULL);
AddTest("h5s", test_h5s, cleanup_h5s, "Dataspaces", NULL);
AddTest("attr", test_attr, cleanup_attr, "Attributes", NULL);
AddTest("select", test_select, cleanup_select, "Selections", NULL);
AddTest("time", test_time, cleanup_time, "Time Datatypes", NULL);
AddTest("reference", test_reference, cleanup_reference, "References", NULL);
AddTest("vltypes", test_vltypes, cleanup_vltypes, "Variable-Length Datatypes", NULL);
AddTest("vlstrings", test_vlstrings, cleanup_vlstrings, "Variable-Length Strings", NULL);
AddTest("iterate", test_iterate, cleanup_iterate, "Group & Attribute Iteration", NULL);
AddTest("array", test_array, cleanup_array, "Array Datatypes", NULL);
AddTest("genprop", test_genprop, cleanup_genprop, "Generic Properties", NULL);
AddTest("misc", test_misc, cleanup_misc, "Miscellaneous", NULL);
/* Display testing information */
TestInfo(argv[0]);

View File

@ -91,10 +91,10 @@ int main(int argc, char *argv[])
TestInit();
/* Tests are generally arranged from least to most complexity... */
AddTest("dcreate", tts_dcreate, cleanup_dcreate, "multi-dataset creation");
AddTest("error", tts_error, cleanup_error, "per-thread error stacks");
AddTest("cancel", tts_cancel, cleanup_cancel, "thread cancellation safety test");
AddTest("acreate", tts_acreate, cleanup_acreate, "multi-attribute creation");
AddTest("dcreate", tts_dcreate, cleanup_dcreate, "multi-dataset creation", NULL);
AddTest("error", tts_error, cleanup_error, "per-thread error stacks", NULL);
AddTest("cancel", tts_cancel, cleanup_cancel, "thread cancellation safety test", NULL);
AddTest("acreate", tts_acreate, cleanup_acreate, "multi-attribute creation", NULL);
/* Display testing information */
TestInfo(argv[0]);