diff options
-rw-r--r-- | c++/test/Makefile.in | 8 | ||||
-rw-r--r-- | c++/test/testhdf5.cpp | 285 | ||||
-rw-r--r-- | c++/test/th5s.cpp | 5 | ||||
-rw-r--r-- | test/Makefile.in | 6 | ||||
-rw-r--r-- | test/tarray.c | 171 | ||||
-rw-r--r-- | test/tattr.c | 96 | ||||
-rw-r--r-- | test/tconfig.c | 3 | ||||
-rw-r--r-- | test/testframe.c | 45 | ||||
-rw-r--r-- | test/testhdf5.c | 6 | ||||
-rw-r--r-- | test/testhdf5.h | 48 | ||||
-rw-r--r-- | test/tgenprop.c | 69 | ||||
-rw-r--r-- | test/th5s.c | 6 | ||||
-rw-r--r-- | test/theap.c | 12 | ||||
-rw-r--r-- | test/titerate.c | 54 | ||||
-rw-r--r-- | test/tmeta.c | 15 | ||||
-rw-r--r-- | test/tmisc.c | 87 | ||||
-rw-r--r-- | test/trefer.c | 3 | ||||
-rw-r--r-- | test/trefstr.c | 6 | ||||
-rw-r--r-- | test/tselect.c | 108 | ||||
-rw-r--r-- | test/ttbbt.c | 8 | ||||
-rw-r--r-- | test/ttime.c | 12 | ||||
-rw-r--r-- | test/ttsafe.c | 10 | ||||
-rw-r--r-- | test/ttsafe_acreate.c | 7 | ||||
-rw-r--r-- | test/ttsafe_cancel.c | 7 | ||||
-rw-r--r-- | test/ttsafe_dcreate.c | 6 | ||||
-rw-r--r-- | test/ttsafe_error.c | 10 | ||||
-rw-r--r-- | test/ttst.c | 15 | ||||
-rw-r--r-- | test/tvlstr.c | 39 | ||||
-rw-r--r-- | test/tvltypes.c | 151 |
29 files changed, 404 insertions, 894 deletions
diff --git a/c++/test/Makefile.in b/c++/test/Makefile.in index 8c4fcf0..7a90f7d 100644 --- a/c++/test/Makefile.in +++ b/c++/test/Makefile.in @@ -22,6 +22,7 @@ srcdir=@srcdir@ hdf5_srcdir=$(top_srcdir)/src hdf5_builddir=$(top_builddir)/src +hdf5_testdir=$(top_builddir)/test ## Add include directory to the cpp preprocessor flags; note that the ## hdf5/test directory is needed for the use of h5test @@ -30,6 +31,7 @@ CPPFLAGS=-I. -I../src -I$(srcdir)/../src -I$(top_srcdir)/test -I$(hdf5_builddir) ## Add the C++ API library and the hdf5 library to the library lists LIB=../src/libhdf5_cpp.la LIBHDF5=$(hdf5_builddir)/libhdf5.la +LIBH5TEST=$(hdf5_testdir)/libh5test.la LT_LINK_LIB=$(LT) --mode=link $(CXX) -rpath $(libdir) @@ -49,12 +51,12 @@ TEST_SCRIPTS= DISTCLEAN=$(TEST_PROGS_SRC:.cpp=.lo) $(TEST_PROGS_SRC:.cpp=.o) -$(TEST_PROGS): $(LIB) $(LIBHDF5) +$(TEST_PROGS): $(LIB) $(LIBHDF5) $(LIBH5TEST) testhdf5: $(TEST_OBJ) - @$(LT_LINK_EXE) $(CFLAGS) -o $@ $(TESTHDF5_OBJ) $(LIB) $(LIBHDF5) $(LDFLAGS) $(LIBS) $(DEFAULT_LIBS) + @$(LT_LINK_EXE) $(CFLAGS) -o $@ $(TESTHDF5_OBJ) $(LIB) $(LIBH5TEST) $(LIBHDF5) $(LDFLAGS) $(LIBS) $(DEFAULT_LIBS) dsets: dsets.lo h5cpputil.lo - @$(LT_LINK_EXE) $(CFLAGS) -o $@ dsets.lo h5cpputil.lo $(hdf5_builddir)/../test/h5test.lo $(LIB) $(LIBHDF5) $(LDFLAGS) $(LIBS) $(DEFAULT_LIBS) + @$(LT_LINK_EXE) $(CFLAGS) -o $@ dsets.lo h5cpputil.lo $(hdf5_builddir)/../test/h5test.lo $(LIB) $(LIBH5TEST) $(LIBHDF5) $(LDFLAGS) $(LIBS) $(DEFAULT_LIBS) @CONCLUDE@ diff --git a/c++/test/testhdf5.cpp b/c++/test/testhdf5.cpp index f8aecbd..784a38b 100644 --- a/c++/test/testhdf5.cpp +++ b/c++/test/testhdf5.cpp @@ -35,284 +35,57 @@ ***************************************************************************/ -#ifdef __MWERKS__ -#include <console.h> -#endif /* __MWERKS__ */ - -#include <stdarg.h> - -#define MAXNUMOFTESTS 30 -#define HDF5_TEST_MASTER - -/* Internal Variables */ -static int Index = 0; - // Use C version of the header file testhdf5.h instead of re-coding it #include "testhdf5.h" -#ifdef OLD_HEADER_FILENAME -#include <iostream.h> -#else -#include <iostream> -#endif - #include "H5Cpp.h" #ifndef H5_NO_NAMESPACE using namespace H5; #endif /* !H5_NO_NAMESPACE */ -#include "h5cpputil.h" - -struct TestStruct { - int NumErrors; - char Description[64]; - int SkipFlag; - char Name[16]; - void (*Call) (void); - void (*Cleanup) (void); -} Test[MAXNUMOFTESTS]; - -static void InitTest(const char *, void (*) (void), void (*) (void), const char *TheDescr); -static void usage(void); - -static void InitTest(const char *TheName, void (*TheCall) (void), void (*Cleanup) (void), const char *TheDescr) -{ - if (Index >= MAXNUMOFTESTS) { - print_func("Uh-oh, too many tests added, increase MAXNUMOFTEST!\n"); - exit(-1); - } - - 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++; -} - -static void -usage(void) -{ - print_func("Usage: testhdf5 [-v[erbose] (l[ow]|m[edium]|h[igh]|0-10)] \n"); - print_func(" [-[e]x[clude] name+] \n"); - print_func(" [-o[nly] name+] \n"); - print_func(" [-b[egin] name] \n"); - print_func(" [-s[ummary]] \n"); - print_func(" [-c[leanoff]] \n"); - print_func(" [-n[ocaching]] \n"); - print_func(" [-h[elp]] \n"); - print_func("\n\n"); - print_func("verbose controls the amount of information displayed\n"); - print_func("exclude to exclude tests by name\n"); - print_func("only to name tests which should be run\n"); - print_func("begin start at the name of the test givin\n"); - print_func("summary prints a summary of test results at the end\n"); - print_func("cleanoff does not delete *.hdf files after execution of tests\n"); - print_func("nocaching do not turn on low-level DD caching\n"); - print_func("help print out this information\n"); - print_func("\n\n"); - print_func("This program currently tests the following: \n\n"); - print_func("%16s %s\n", "Name", "Description"); - print_func("%16s %s\n", "----", "-----------"); - - for (int i = 0; i < Index; i++) - print_func("%16s %s\n", Test[i].Name, Test[i].Description); - - print_func("\n\n"); -} - -/* - * 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) - */ -int -print_func(const char *format,...) -{ - va_list arglist; - int ret_value; - - va_start(arglist, format); - ret_value = vprintf(format, arglist); - va_end(arglist); - return ret_value; -} - int main(int argc, char *argv[]) { - int CLLoop; /* Command Line Loop */ - int Loop, Loop1; int Summary = 0; int CleanUp = 1; - int Cache = 1; - -#ifdef __MWERKS__ - argc = ccommand(&argv); -#endif /* __MWERKS__ */ - -#if !(defined MAC || defined __MWERKS__ || defined SYMANTEC_C) - /* Un-buffer the stdout and stderr */ - setbuf(stderr, NULL); - setbuf(stdout, NULL); -#endif /* !(MAC || __MWERKS__ || SYMANTEC_C) */ - - /* - * Turn off automatic error reporting since we do it ourselves. Besides, - * half the functions this test calls are private, so automatic error - * reporting wouldn't do much good since it's triggered at the API layer. - */ - Exception::dontPrint(); + /* Initialize testing framework */ + TestInit(); + // testing file creation and opening in tfile.cpp - InitTest("file", test_file, cleanup_file, "File I/O Operations"); + AddTest("file", test_file, cleanup_file, "File I/O Operations"); // testing dataspace functionalities in th5s.cpp - InitTest("h5s", test_h5s, cleanup_h5s, "Dataspaces"); - - /* Comment out tests that are not done yet. - BMR, Feb 2001 - InitTest("attr", test_attr, cleanup_attr, "Attributes"); - InitTest("select", test_select, cleanup_select, "Selections"); - InitTest("time", test_time, cleanup_time, "Time Datatypes"); - InitTest("reference", test_reference, cleanup_reference, "References"); - InitTest("vltypes", test_vltypes, cleanup_vltypes, "Variable-Length Datatypes"); - InitTest("vlstrings", test_vlstrings, cleanup_vlstrings, "Variable-Length Strings"); - InitTest("iterate", test_iterate, cleanup_iterate, "Group & Attribute Iteration"); - InitTest("array", test_array, cleanup_array, "Array Datatypes"); - InitTest("genprop", test_genprop, cleanup_genprop, "Generic Properties"); + AddTest("h5s", test_h5s, cleanup_h5s, "Dataspaces"); + +/* 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"); Comment out tests that are not done yet */ - Verbosity = 4; /* Default Verbosity is Low */ - unsigned major, minor, release; - H5Library::getLibVersion( major, minor, release); - - print_func("\nFor help use: testhdf5 -help\n"); - print_func("Linked with hdf5 version %u.%u release %u\n", - (unsigned)major, (unsigned)minor, (unsigned)release); - - for (CLLoop = 1; CLLoop < argc; CLLoop++) { - if ((argc > CLLoop + 1) && ((HDstrcmp(argv[CLLoop], "-verbose") == 0) || - (HDstrcmp(argv[CLLoop], "-v") == 0))) { - if (argv[CLLoop + 1][0] == 'l') - Verbosity = 4; - else if (argv[CLLoop + 1][0] == 'm') - Verbosity = 6; - else if (argv[CLLoop + 1][0] == 'h') - Verbosity = 10; - else - Verbosity = atoi(argv[CLLoop + 1]); - } - - if ((argc > CLLoop) && ((HDstrcmp(argv[CLLoop], "-summary") == 0) || - (HDstrcmp(argv[CLLoop], "-s") == 0))) - Summary = 1; - - if ((argc > CLLoop) && ((HDstrcmp(argv[CLLoop], "-help") == 0) || - (HDstrcmp(argv[CLLoop], "-h") == 0))) { - usage(); - exit(0); - } - - if ((argc > CLLoop) && ((HDstrcmp(argv[CLLoop], "-cleanoff") == 0) || - (HDstrcmp(argv[CLLoop], "-c") == 0))) - CleanUp = 0; - - if ((argc > CLLoop) && ((HDstrcmp(argv[CLLoop], "-nocache") == 0) || - (HDstrcmp(argv[CLLoop], "-n") == 0))) { - Cache = 0; - printf ("Cache = %d\n", Cache); - } - - if ((argc > CLLoop + 1) && ((HDstrcmp(argv[CLLoop], "-exclude") == 0) || - (HDstrcmp(argv[CLLoop], "-x") == 0))) { - Loop = CLLoop + 1; - - while ((Loop < argc) && (argv[Loop][0] != '-')) { - for (Loop1 = 0; Loop1 < Index; Loop1++) - if (HDstrcmp(argv[Loop], Test[Loop1].Name) == 0) - Test[Loop1].SkipFlag = 1; - - Loop++; - } - } - - if ((argc > CLLoop + 1) && ((HDstrcmp(argv[CLLoop], "-begin") == 0) || - (HDstrcmp(argv[CLLoop], "-b") == 0))) { - Loop = CLLoop + 1; - - while ((Loop < argc) && (argv[Loop][0] != '-')) { - for (Loop1 = 0; Loop1 < Index; Loop1++) { - if (HDstrcmp(argv[Loop], Test[Loop1].Name) != 0) - Test[Loop1].SkipFlag = 1; - if (HDstrcmp(argv[Loop], Test[Loop1].Name) == 0) - Loop1 = Index; - } - - Loop++; - } - } - - if ((argc > CLLoop + 1) && ((HDstrcmp(argv[CLLoop], "-only") == 0) || - (HDstrcmp(argv[CLLoop], "-o") == 0))) { - for (Loop = 0; Loop < Index; Loop++) - Test[Loop].SkipFlag = 1; - Loop = CLLoop + 1; - while ((Loop < argc) && (argv[Loop][0] != '-')) { - for (Loop1 = 0; Loop1 < Index; Loop1++) - if (HDstrcmp(argv[Loop], Test[Loop1].Name) == 0) - Test[Loop1].SkipFlag = 0; - Loop++; - } - } - } - -#ifdef NOT_YET - if (Cache) /* turn on caching, unless we were instucted not to */ - Hcache(CACHE_ALL_FILES, TRUE); -#endif /* NOT_YET */ - - for (Loop = 0; Loop < Index; Loop++) { - if (Test[Loop].SkipFlag) { - MESSAGE(2, ("Skipping -- %s \n", Test[Loop].Description)); - } else { - MESSAGE(2, ("Testing -- %s (%s) \n", Test[Loop].Description, - Test[Loop].Name)); - MESSAGE(5, ("===============================================\n")); - Test[Loop].NumErrors = num_errs; - (*Test[Loop].Call) (); - Test[Loop].NumErrors = num_errs - Test[Loop].NumErrors; - MESSAGE(5, ("===============================================\n")); - MESSAGE(5, ("There were %d errors detected.\n\n", (int) Test[Loop].NumErrors)); - } - } - - MESSAGE(2, ("\n\n")) - test_report(num_errs, string(" HDF5 Base")); - if (Summary) { - print_func("Summary of Test Results:\n"); - print_func("Name of Test Errors Description of Test\n"); - print_func("---------------- ------ --------------------------------------\n"); + /* Display testing information */ + TestInfo(argv[0]); - for (Loop = 0; Loop < Index; Loop++) { - if (Test[Loop].NumErrors == -1) - print_func("%16s %6s %s\n", Test[Loop].Name, "N/A", Test[Loop].Description); - else - print_func("%16s %6d %s\n", Test[Loop].Name, (int) Test[Loop].NumErrors, - Test[Loop].Description); - } + /* Parse command line arguments */ + TestParseCmdLine(argc,argv,&Summary,&CleanUp); - print_func("\n\n"); - } + /* Perform requested testing */ + PerformTests(); - if (CleanUp && !getenv("HDF5_NOCLEANUP")) { - MESSAGE(2, ("\nCleaning Up temp files...\n\n")); + /* Display test summary, if requested */ + if (Summary) + TestSummary(); - /* call individual cleanup routines in each source module */ - for (Loop = 0; Loop < Index; Loop++) - if (!Test[Loop].SkipFlag && Test[Loop].Cleanup!=NULL) - (*Test[Loop].Cleanup) (); - } + /* Clean up test files, if allowed */ + if (CleanUp && !getenv("HDF5_NOCLEANUP")) + TestCleanup(); - return num_errs; + return (GetTestNumErrs()); } diff --git a/c++/test/th5s.cpp b/c++/test/th5s.cpp index 443b310..695da54 100644 --- a/c++/test/th5s.cpp +++ b/c++/test/th5s.cpp @@ -474,9 +474,8 @@ test_h5s_compound_scalar_read(void) << space4_data.u << ", read_data4.u=" << rdata.u << endl; cout << "scalar data different: space4_data.f=" << space4_data.f << ", read_data4.f=" << rdata.f << endl; - cout << "scalar data different: space4_data.c1=" - << space4_data.c1 << ", read_data4.c1=" << rdata.c2 << endl; - num_errs++; + TestErrPrintf("scalar data different: space4_data.c1=%c, read_data4.c1=%c\n", + space4_data.c1, rdata.c2); } /* end if */ } // end of try block catch (Exception error) diff --git a/test/Makefile.in b/test/Makefile.in index e15b04a..ed2ad16 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -37,7 +37,7 @@ TIMINGS=testmeta ## a single shared library and libhdf5 is much bigger than libh5test. LIBHDF5=../src/libhdf5.la LIB=libh5test.la -LIB_SRC=h5test.c +LIB_SRC=h5test.c testframe.c LIB_OBJ=$(LIB_SRC:.c=.lo) PUB_LIB= @@ -102,11 +102,11 @@ timings _timings: $(TIMINGS) ## How to build the tests... They all depend on the test and hdf5 libraries. $(TEST_PROGS): $(LIB) $(LIBHDF5) -TESTHDF5_OBJ=testhdf5.lo testframe.lo tarray.lo tattr.lo tconfig.lo tfile.lo \ +TESTHDF5_OBJ=testhdf5.lo tarray.lo tattr.lo tconfig.lo tfile.lo \ tgenprop.lo th5s.lo theap.lo titerate.lo tmeta.lo ttime.lo trefer.lo \ trefstr.lo tselect.lo ttbbt.lo ttst.lo tvltypes.lo tvlstr.lo tmisc.lo -TTS_OBJ=ttsafe.lo testframe.lo ttsafe_dcreate.lo ttsafe_error.lo \ +TTS_OBJ=ttsafe.lo ttsafe_dcreate.lo ttsafe_error.lo \ ttsafe_cancel.lo ttsafe_acreate.lo testhdf5: $(TESTHDF5_OBJ) diff --git a/test/tarray.c b/test/tarray.c index 6d9fea6..8e92eb4 100644 --- a/test/tarray.c +++ b/test/tarray.c @@ -145,8 +145,7 @@ test_array_atomic_1d(void) /* Check the array dimensions */ for(i=0; i<ndims; i++) if(rdims1[i]!=tdims1[i]) { - num_errs++; - printf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n",(int)i,(int)rdims1[i],(int)i,(int)tdims1[i]); + TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n",(int)i,(int)rdims1[i],(int)i,(int)tdims1[i]); continue; } /* end if */ @@ -158,8 +157,7 @@ test_array_atomic_1d(void) for(i=0; i<SPACE1_DIM1; i++) { for(j=0; j<ARRAY1_DIM1; j++) { if(wdata[i][j]!=rdata[i][j]) { - num_errs++; - printf("Array data information doesn't match!, wdata[%d][%d]=%d, rdata[%d][%d]=%d\n",(int)i,(int)j,(int)wdata[i][j],(int)i,(int)j,(int)rdata[i][j]); + TestErrPrintf("Array data information doesn't match!, wdata[%d][%d]=%d, rdata[%d][%d]=%d\n",(int)i,(int)j,(int)wdata[i][j],(int)i,(int)j,(int)rdata[i][j]); continue; } /* end if */ } /* end for */ @@ -271,8 +269,7 @@ test_array_atomic_3d(void) /* Check the array dimensions */ for(i=0; i<ndims; i++) if(rdims2[i]!=tdims2[i]) { - num_errs++; - printf("Array dimension information doesn't match!, rdims2[%d]=%d, tdims2[%d]=%d\n",(int)i,(int)rdims2[i],(int)i,(int)tdims2[i]); + TestErrPrintf("Array dimension information doesn't match!, rdims2[%d]=%d, tdims2[%d]=%d\n",(int)i,(int)rdims2[i],(int)i,(int)tdims2[i]); continue; } /* end if */ @@ -286,8 +283,7 @@ test_array_atomic_3d(void) for(k=0; k<ARRAY2_DIM2; k++) { for(l=0; l<ARRAY2_DIM3; l++) { if(wdata[i][j][k][l]!=rdata[i][j][k][l]) { - num_errs++; - printf("Array data information doesn't match!, wdata[%d][%d][%d][%d]=%d, rdata[%d][%d][%d][%d]=%d\n",(int)i,(int)j,(int)k,(int)l,(int)wdata[i][j][k][l],(int)i,(int)j,(int)k,(int)l,(int)rdata[i][j][k][l]); + TestErrPrintf("Array data information doesn't match!, wdata[%d][%d][%d][%d]=%d, rdata[%d][%d][%d][%d]=%d\n",(int)i,(int)j,(int)k,(int)l,(int)wdata[i][j][k][l],(int)i,(int)j,(int)k,(int)l,(int)rdata[i][j][k][l]); continue; } /* end if */ } /* end for */ @@ -411,8 +407,7 @@ test_array_array_atomic(void) /* Check the array dimensions */ for(i=0; i<ndims1; i++) if(rdims1[i]!=tdims1[i]) { - num_errs++; - printf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n",(int)i,(int)rdims1[i],(int)i,(int)tdims1[i]); + TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n",(int)i,(int)rdims1[i],(int)i,(int)tdims1[i]); continue; } /* end if */ @@ -431,8 +426,7 @@ test_array_array_atomic(void) /* Check the array dimensions */ for(i=0; i<ndims2; i++) if(rdims2[i]!=tdims2[i]) { - num_errs++; - printf("Array dimension information doesn't match!, rdims2[%d]=%d, tdims2[%d]=%d\n",(int)i,(int)rdims2[i],(int)i,(int)tdims2[i]); + TestErrPrintf("Array dimension information doesn't match!, rdims2[%d]=%d, tdims2[%d]=%d\n",(int)i,(int)rdims2[i],(int)i,(int)tdims2[i]); continue; } /* end if */ @@ -446,8 +440,7 @@ test_array_array_atomic(void) for(k=0; k<ARRAY2_DIM2; k++) { for(l=0; l<ARRAY2_DIM3; l++) { if(wdata[i][j][k][l]!=rdata[i][j][k][l]) { - num_errs++; - printf("Array data information doesn't match!, wdata[%d][%d][%d][%d]=%d, rdata[%d][%d][%d][%d]=%d\n",(int)i,(int)j,(int)k,(int)l,(int)wdata[i][j][k][l],(int)i,(int)j,(int)k,(int)l,(int)rdata[i][j][k][l]); + TestErrPrintf("Array data information doesn't match!, wdata[%d][%d][%d][%d]=%d, rdata[%d][%d][%d][%d]=%d\n",(int)i,(int)j,(int)k,(int)l,(int)wdata[i][j][k][l],(int)i,(int)j,(int)k,(int)l,(int)rdata[i][j][k][l]); continue; } /* end if */ } /* end for */ @@ -588,8 +581,7 @@ test_array_compound_atomic(void) /* Check the array dimensions */ for(i=0; i<ndims; i++) if(rdims1[i]!=tdims1[i]) { - num_errs++; - printf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n",(int)i,(int)rdims1[i],(int)i,(int)tdims1[i]); + TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n",(int)i,(int)rdims1[i],(int)i,(int)tdims1[i]); continue; } /* end if */ @@ -605,8 +597,7 @@ test_array_compound_atomic(void) mname=H5Tget_member_name(tid2,0); CHECK(mname, NULL, "H5Tget_member_name"); if(HDstrcmp(mname,"i")!=0) { - num_errs++; - printf("Compound field name doesn't match!, mname=%s\n",mname); + TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname); } /* end if */ free(mname); @@ -618,8 +609,7 @@ test_array_compound_atomic(void) mtid=H5Tget_member_type(tid2,0); CHECK(mtid, FAIL, "H5Tget_member_type"); if((ret=H5Tequal(mtid,H5T_NATIVE_INT))<=0) { - num_errs++; - printf("Compound data type is incorrect!, ret=%d\n",(int)ret); + TestErrPrintf("Compound data type is incorrect!, ret=%d\n",(int)ret); } /* end if */ ret=H5Tclose(mtid); CHECK(mtid, FAIL, "H5Tclose"); @@ -628,8 +618,7 @@ test_array_compound_atomic(void) mname=H5Tget_member_name(tid2,1); CHECK(mname, NULL, "H5Tget_member_name"); if(HDstrcmp(mname,"f")!=0) { - num_errs++; - printf("Compound field name doesn't match!, mname=%s\n",mname); + TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname); } /* end if */ free(mname); @@ -641,8 +630,7 @@ test_array_compound_atomic(void) mtid=H5Tget_member_type(tid2,1); CHECK(mtid, FAIL, "H5Tget_member_type"); if((ret=H5Tequal(mtid,H5T_NATIVE_FLOAT))<=0) { - num_errs++; - printf("Compound data type is incorrect!, ret=%d\n",(int)ret); + TestErrPrintf("Compound data type is incorrect!, ret=%d\n",(int)ret); } /* end if */ ret=H5Tclose(mtid); CHECK(mtid, FAIL, "H5Tclose"); @@ -659,13 +647,11 @@ test_array_compound_atomic(void) for(i=0; i<SPACE1_DIM1; i++) { for(j=0; j<ARRAY1_DIM1; j++) { if(wdata[i][j].i!=rdata[i][j].i) { - num_errs++; - printf("Array data information doesn't match!, wdata[%d][%d].i=%d, rdata[%d][%d].i=%d\n",(int)i,(int)j,(int)wdata[i][j].i,(int)i,(int)j,(int)rdata[i][j].i); + TestErrPrintf("Array data information doesn't match!, wdata[%d][%d].i=%d, rdata[%d][%d].i=%d\n",(int)i,(int)j,(int)wdata[i][j].i,(int)i,(int)j,(int)rdata[i][j].i); continue; } /* end if */ if(wdata[i][j].f!=rdata[i][j].f) { - num_errs++; - printf("Array data information doesn't match!, wdata[%d][%d].f=%f, rdata[%d][%d].f=%f\n",(int)i,(int)j,wdata[i][j].f,(int)i,(int)j,rdata[i][j].f); + TestErrPrintf("Array data information doesn't match!, wdata[%d][%d].f=%f, rdata[%d][%d].f=%f\n",(int)i,(int)j,wdata[i][j].f,(int)i,(int)j,rdata[i][j].f); continue; } /* end if */ } /* end for */ @@ -813,8 +799,7 @@ test_array_compound_array(void) /* Check the array dimensions */ for(i=0; i<ndims; i++) if(rdims1[i]!=tdims1[i]) { - num_errs++; - printf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n",(int)i,(int)rdims1[i],(int)i,(int)tdims1[i]); + TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n",(int)i,(int)rdims1[i],(int)i,(int)tdims1[i]); continue; } /* end if */ @@ -830,8 +815,7 @@ test_array_compound_array(void) mname=H5Tget_member_name(tid2,0); CHECK(mname, NULL, "H5Tget_member_name"); if(HDstrcmp(mname,"i")!=0) { - num_errs++; - printf("Compound field name doesn't match!, mname=%s\n",mname); + TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname); } /* end if */ free(mname); @@ -843,8 +827,7 @@ test_array_compound_array(void) mtid=H5Tget_member_type(tid2,0); CHECK(mtid, FAIL, "H5Tget_member_type"); if((ret=H5Tequal(mtid,H5T_NATIVE_INT))<=0) { - num_errs++; - printf("Compound data type is incorrect!, ret=%d\n",(int)ret); + TestErrPrintf("Compound data type is incorrect!, ret=%d\n",(int)ret); } /* end if */ ret=H5Tclose(mtid); CHECK(mtid, FAIL, "H5Tclose"); @@ -853,8 +836,7 @@ test_array_compound_array(void) mname=H5Tget_member_name(tid2,1); CHECK(mname, NULL, "H5Tget_member_name"); if(HDstrcmp(mname,"f")!=0) { - num_errs++; - printf("Compound field name doesn't match!, mname=%s\n",mname); + TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname); } /* end if */ free(mname); @@ -881,8 +863,7 @@ test_array_compound_array(void) /* Check the array dimensions */ for(i=0; i<ndims; i++) if(rdims1[i]!=tdims1[i]) { - num_errs++; - printf("Nested array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n",(int)i,(int)rdims1[i],(int)i,(int)tdims1[i]); + TestErrPrintf("Nested array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n",(int)i,(int)rdims1[i],(int)i,(int)tdims1[i]); continue; } /* end if */ @@ -891,8 +872,7 @@ test_array_compound_array(void) CHECK(tid3, FAIL, "H5Tget_super"); if((ret=H5Tequal(tid3,H5T_NATIVE_FLOAT))<=0) { - num_errs++; - printf("Compound data type is incorrect!, ret=%d\n",(int)ret); + TestErrPrintf("Compound data type is incorrect!, ret=%d\n",(int)ret); } /* end if */ /* Close the array's base type datatype */ @@ -915,14 +895,12 @@ test_array_compound_array(void) for(i=0; i<SPACE1_DIM1; i++) { for(j=0; j<ARRAY1_DIM1; j++) { if(wdata[i][j].i!=rdata[i][j].i) { - num_errs++; - printf("Array data information doesn't match!, wdata[%d][%d].i=%d, rdata[%d][%d].i=%d\n",(int)i,(int)j,(int)wdata[i][j].i,(int)i,(int)j,(int)rdata[i][j].i); + TestErrPrintf("Array data information doesn't match!, wdata[%d][%d].i=%d, rdata[%d][%d].i=%d\n",(int)i,(int)j,(int)wdata[i][j].i,(int)i,(int)j,(int)rdata[i][j].i); continue; } /* end if */ for(k=0; k<ARRAY1_DIM1; k++) if(wdata[i][j].f[k]!=rdata[i][j].f[k]) { - num_errs++; - printf("Array data information doesn't match!, wdata[%d][%d].f[%d]=%f, rdata[%d][%d].f[%d]=%f\n",(int)i,(int)j,(int)k,wdata[i][j].f[k],(int)i,(int)j,(int)k,rdata[i][j].f[k]); + TestErrPrintf("Array data information doesn't match!, wdata[%d][%d].f[%d]=%f, rdata[%d][%d].f[%d]=%f\n",(int)i,(int)j,(int)k,wdata[i][j].f[k],(int)i,(int)j,(int)k,rdata[i][j].f[k]); continue; } /* end if */ } /* end for */ @@ -1112,8 +1090,7 @@ test_array_vlen_atomic(void) /* Check the array dimensions */ for(i=0; i<ndims; i++) if(rdims1[i]!=tdims1[i]) { - num_errs++; - printf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n",(int)i,(int)rdims1[i],(int)i,(int)tdims1[i]); + TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n",(int)i,(int)rdims1[i],(int)i,(int)tdims1[i]); continue; } /* end if */ @@ -1130,8 +1107,7 @@ test_array_vlen_atomic(void) CHECK(tid3, FAIL, "H5Tget_super"); if((ret=H5Tequal(tid3,H5T_NATIVE_UINT))<=0) { - num_errs++; - printf("VL base datatype is incorrect!, ret=%d\n",(int)ret); + TestErrPrintf("VL base datatype is incorrect!, ret=%d\n",(int)ret); } /* end if */ /* Close the array's base type datatype */ @@ -1172,14 +1148,12 @@ test_array_vlen_atomic(void) for(i=0; i<SPACE1_DIM1; i++) { for(j=0; j<ARRAY1_DIM1; j++) { if(wdata[i][j].len!=rdata[i][j].len) { - num_errs++; - printf("VL data length don't match!, wdata[%d][%d].len=%d, rdata[%d][%d].len=%d\n",(int)i,(int)j,(int)wdata[i][j].len,(int)i,(int)j,(int)rdata[i][j].len); + TestErrPrintf("VL data length don't match!, wdata[%d][%d].len=%d, rdata[%d][%d].len=%d\n",(int)i,(int)j,(int)wdata[i][j].len,(int)i,(int)j,(int)rdata[i][j].len); continue; } /* end if */ for(k=0; k<(int)rdata[i][j].len; k++) { if( ((unsigned int *)wdata[i][j].p)[k] != ((unsigned int *)rdata[i][j].p)[k] ) { - num_errs++; - printf("VL data values don't match!, wdata[%d][%d].p[%d]=%d, rdata[%d][%d].p[%d]=%d\n",(int)i,(int)j,(int)k, (int)((unsigned int *)wdata[i][j].p)[k], (int)i,(int)j,(int)k, (int)((unsigned int *)rdata[i][j].p)[k]); + TestErrPrintf("VL data values don't match!, wdata[%d][%d].p[%d]=%d, rdata[%d][%d].p[%d]=%d\n",(int)i,(int)j,(int)k, (int)((unsigned int *)wdata[i][j].p)[k], (int)i,(int)j,(int)k, (int)((unsigned int *)rdata[i][j].p)[k]); continue; } /* end if */ } /* end for */ @@ -1337,8 +1311,7 @@ test_array_vlen_array(void) /* Check the array dimensions */ for(i=0; i<ndims; i++) if(rdims1[i]!=tdims1[i]) { - num_errs++; - printf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n",(int)i,(int)rdims1[i],(int)i,(int)tdims1[i]); + TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n",(int)i,(int)rdims1[i],(int)i,(int)tdims1[i]); continue; } /* end if */ @@ -1369,8 +1342,7 @@ test_array_vlen_array(void) /* Check the array dimensions */ for(i=0; i<ndims; i++) if(rdims1[i]!=tdims1[i]) { - num_errs++; - printf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n",(int)i,(int)rdims1[i],(int)i,(int)tdims1[i]); + TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n",(int)i,(int)rdims1[i],(int)i,(int)tdims1[i]); continue; } /* end if */ @@ -1380,8 +1352,7 @@ test_array_vlen_array(void) if((ret=H5Tequal(tid4,H5T_NATIVE_UINT))<=0) { - num_errs++; - printf("VL base datatype is incorrect!, ret=%d\n",(int)ret); + TestErrPrintf("VL base datatype is incorrect!, ret=%d\n",(int)ret); } /* end if */ /* Close the array's base type datatype */ @@ -1426,15 +1397,13 @@ test_array_vlen_array(void) for(i=0; i<SPACE1_DIM1; i++) { for(j=0; j<ARRAY1_DIM1; j++) { if(wdata[i][j].len!=rdata[i][j].len) { - num_errs++; - printf("VL data length don't match!, wdata[%d][%d].len=%d, rdata[%d][%d].len=%d\n",(int)i,(int)j,(int)wdata[i][j].len,(int)i,(int)j,(int)rdata[i][j].len); + TestErrPrintf("VL data length don't match!, wdata[%d][%d].len=%d, rdata[%d][%d].len=%d\n",(int)i,(int)j,(int)wdata[i][j].len,(int)i,(int)j,(int)rdata[i][j].len); continue; } /* end if */ for(k=0; k<(int)rdata[i][j].len; k++) { for(l=0; l<ARRAY1_DIM1; l++) { if( ((unsigned int *)wdata[i][j].p)[k*ARRAY1_DIM1+l] != ((unsigned int *)rdata[i][j].p)[k*ARRAY1_DIM1+l] ) { - num_errs++; - printf("VL data values don't match!, wdata[%d][%d].p[%d][%d]=%d, rdata[%d][%d].p[%d][%d]=%d\n",(int)i,(int)j,(int)k,(int)l, (int)((unsigned int *)wdata[i][j].p)[k*ARRAY1_DIM1+l], (int)i,(int)j,(int)k,(int)l, (int)((unsigned int *)rdata[i][j].p)[k*ARRAY1_DIM1+l]); + TestErrPrintf("VL data values don't match!, wdata[%d][%d].p[%d][%d]=%d, rdata[%d][%d].p[%d][%d]=%d\n",(int)i,(int)j,(int)k,(int)l, (int)((unsigned int *)wdata[i][j].p)[k*ARRAY1_DIM1+l], (int)i,(int)j,(int)k,(int)l, (int)((unsigned int *)rdata[i][j].p)[k*ARRAY1_DIM1+l]); continue; } /* end if */ } /* end for */ @@ -1619,18 +1588,15 @@ test_array_bkg(void) for (i = 0; i < LENGTH; i++) { for (j = 0; j < ALEN; j++) { if(cf[i].a[j]!=cfr[i].a[j]) { - num_errs++; - printf("Field a data doesn't match, cf[%d].a[%d]=%d, cfr[%d].a[%d]=%d\n",(int)i,(int)j,(int)cf[i].a[j],(int)i,(int)j,(int)cfr[i].a[j]); + TestErrPrintf("Field a data doesn't match, cf[%d].a[%d]=%d, cfr[%d].a[%d]=%d\n",(int)i,(int)j,(int)cf[i].a[j],(int)i,(int)j,(int)cfr[i].a[j]); continue; } if(cf[i].b[j]!=cfr[i].b[j]) { - num_errs++; - printf("Field b data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n",(int)i,(int)j,(float)cf[i].b[j],(int)i,(int)j,(float)cfr[i].b[j]); + TestErrPrintf("Field b data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n",(int)i,(int)j,(float)cf[i].b[j],(int)i,(int)j,(float)cfr[i].b[j]); continue; } if(cf[i].c[j]!=cfr[i].c[j]) { - num_errs++; - printf("Field c data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n",(int)i,(int)j,(float)cf[i].c[j],(int)i,(int)j,(float)cfr[i].c[j]); + TestErrPrintf("Field c data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n",(int)i,(int)j,(float)cf[i].c[j],(int)i,(int)j,(float)cfr[i].c[j]); continue; } } @@ -1693,8 +1659,7 @@ test_array_bkg(void) for (i=0; i< LENGTH; i++) for (j = 0; j < ALEN; j++) if(fld[i].b[j]!=fldr[i].b[j]) { - num_errs++; - printf("Field data doesn't match, fld[%d].b[%d]=%f, fldr[%d].b[%d]=%f\n",(int)i,(int)j,(float)fld[i].b[j],(int)i,(int)j,(float)fldr[i].b[j]); + TestErrPrintf("Field data doesn't match, fld[%d].b[%d]=%f, fldr[%d].b[%d]=%f\n",(int)i,(int)j,(float)fld[i].b[j],(int)i,(int)j,(float)fldr[i].b[j]); continue; } @@ -1716,18 +1681,15 @@ test_array_bkg(void) for (i = 0; i < LENGTH; i++) { for (j = 0; j < ALEN; j++) { if(cf[i].a[j]!=cfr[i].a[j]) { - num_errs++; - printf("Field a data doesn't match, cf[%d].a[%d]=%d, cfr[%d].a[%d]=%d\n",(int)i,(int)j,(int)cf[i].a[j],(int)i,(int)j,(int)cfr[i].a[j]); + TestErrPrintf("Field a data doesn't match, cf[%d].a[%d]=%d, cfr[%d].a[%d]=%d\n",(int)i,(int)j,(int)cf[i].a[j],(int)i,(int)j,(int)cfr[i].a[j]); continue; } if(cf[i].b[j]!=cfr[i].b[j]) { - num_errs++; - printf("Field b data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n",(int)i,(int)j,(float)cf[i].b[j],(int)i,(int)j,(float)cfr[i].b[j]); + TestErrPrintf("Field b data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n",(int)i,(int)j,(float)cf[i].b[j],(int)i,(int)j,(float)cfr[i].b[j]); continue; } if(cf[i].c[j]!=cfr[i].c[j]) { - num_errs++; - printf("Field c data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n",(int)i,(int)j,(float)cf[i].c[j],(int)i,(int)j,(float)cfr[i].c[j]); + TestErrPrintf("Field c data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n",(int)i,(int)j,(float)cf[i].c[j],(int)i,(int)j,(float)cfr[i].c[j]); continue; } } @@ -1768,18 +1730,15 @@ test_array_bkg(void) for (i = 0; i < LENGTH; i++) { for (j = 0; j < ALEN; j++) { if(cf[i].a[j]!=cfr[i].a[j]) { - num_errs++; - printf("Field a data doesn't match, cf[%d].a[%d]=%d, cfr[%d].a[%d]=%d\n",(int)i,(int)j,(int)cf[i].a[j],(int)i,(int)j,(int)cfr[i].a[j]); + TestErrPrintf("Field a data doesn't match, cf[%d].a[%d]=%d, cfr[%d].a[%d]=%d\n",(int)i,(int)j,(int)cf[i].a[j],(int)i,(int)j,(int)cfr[i].a[j]); continue; } if(cf[i].b[j]!=cfr[i].b[j]) { - num_errs++; - printf("Field b data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n",(int)i,(int)j,(float)cf[i].b[j],(int)i,(int)j,(float)cfr[i].b[j]); + TestErrPrintf("Field b data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n",(int)i,(int)j,(float)cf[i].b[j],(int)i,(int)j,(float)cfr[i].b[j]); continue; } if(cf[i].c[j]!=cfr[i].c[j]) { - num_errs++; - printf("Field c data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n",(int)i,(int)j,(float)cf[i].c[j],(int)i,(int)j,(float)cfr[i].c[j]); + TestErrPrintf("Field c data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n",(int)i,(int)j,(float)cf[i].c[j],(int)i,(int)j,(float)cfr[i].c[j]); continue; } } @@ -1879,8 +1838,7 @@ test_compat(void) mname=H5Tget_member_name(tid1,0); CHECK(mname, NULL, "H5Tget_member_name"); if(HDstrcmp(mname,"i")!=0) { - num_errs++; - printf("Compound field name doesn't match!, mname=%s\n",mname); + TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname); } /* end if */ free(mname); @@ -1892,8 +1850,7 @@ test_compat(void) mtid=H5Tget_member_type(tid1,0); CHECK(mtid, FAIL, "H5Tget_member_type"); if((ret=H5Tequal(mtid,H5T_STD_I16LE))<=0) { - num_errs++; - printf("Compound data type is incorrect!, ret=%d\n",(int)ret); + TestErrPrintf("Compound data type is incorrect!, ret=%d\n",(int)ret); } /* end if */ ret=H5Tclose(mtid); CHECK(mtid, FAIL, "H5Tclose"); @@ -1902,8 +1859,7 @@ test_compat(void) mname=H5Tget_member_name(tid1,1); CHECK(mname, NULL, "H5Tget_member_name"); if(HDstrcmp(mname,"f")!=0) { - num_errs++; - printf("Compound field name doesn't match!, mname=%s\n",mname); + TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname); } /* end if */ free(mname); @@ -1915,8 +1871,7 @@ test_compat(void) mtid=H5Tget_member_type(tid1,1); CHECK(mtid, FAIL, "H5Tget_member_type"); if((ret=H5Tequal(mtid,H5T_IEEE_F32LE))<=0) { - num_errs++; - printf("Compound data type is incorrect!, ret=%d\n",(int)ret); + TestErrPrintf("Compound data type is incorrect!, ret=%d\n",(int)ret); } /* end if */ ret=H5Tclose(mtid); CHECK(mtid, FAIL, "H5Tclose"); @@ -1925,8 +1880,7 @@ test_compat(void) mname=H5Tget_member_name(tid1,2); CHECK(mname, NULL, "H5Tget_member_name"); if(HDstrcmp(mname,"l")!=0) { - num_errs++; - printf("Compound field name doesn't match!, mname=%s\n",mname); + TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname); } /* end if */ free(mname); @@ -1938,8 +1892,7 @@ test_compat(void) mtid=H5Tget_member_type(tid1,2); CHECK(mtid, FAIL, "H5Tget_member_type"); if((ret=H5Tequal(mtid,H5T_STD_I32LE))<=0) { - num_errs++; - printf("Compound data type is incorrect!, ret=%d\n",(int)ret); + TestErrPrintf("Compound data type is incorrect!, ret=%d\n",(int)ret); } /* end if */ ret=H5Tclose(mtid); CHECK(mtid, FAIL, "H5Tclose"); @@ -1973,8 +1926,7 @@ test_compat(void) mname=H5Tget_member_name(tid1,0); CHECK(mname, NULL, "H5Tget_member_name"); if(HDstrcmp(mname,"i")!=0) { - num_errs++; - printf("Compound field name doesn't match!, mname=%s\n",mname); + TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname); } /* end if */ free(mname); @@ -1986,8 +1938,7 @@ test_compat(void) mtid=H5Tget_member_type(tid1,0); CHECK(mtid, FAIL, "H5Tget_member_type"); if((ret=H5Tequal(mtid,H5T_STD_I16LE))<=0) { - num_errs++; - printf("Compound data type is incorrect!, ret=%d\n",(int)ret); + TestErrPrintf("Compound data type is incorrect!, ret=%d\n",(int)ret); } /* end if */ ret=H5Tclose(mtid); CHECK(mtid, FAIL, "H5Tclose"); @@ -1996,8 +1947,7 @@ test_compat(void) mname=H5Tget_member_name(tid1,1); CHECK(mname, NULL, "H5Tget_member_name"); if(HDstrcmp(mname,"f")!=0) { - num_errs++; - printf("Compound field name doesn't match!, mname=%s\n",mname); + TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname); } /* end if */ free(mname); @@ -2024,8 +1974,7 @@ test_compat(void) /* Check the array dimensions */ for(i=0; i<ndims; i++) if(rdims1[i]!=tdims1[i]) { - num_errs++; - printf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n",(int)i,(int)rdims1[i],(int)i,(int)tdims1[i]); + TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n",(int)i,(int)rdims1[i],(int)i,(int)tdims1[i]); continue; } /* end if */ @@ -2034,8 +1983,7 @@ test_compat(void) CHECK(tid2, FAIL, "H5Tget_member_type"); if((ret=H5Tequal(tid2,H5T_IEEE_F32LE))<=0) { - num_errs++; - printf("Compound data type is incorrect!, ret=%d\n",(int)ret); + TestErrPrintf("Compound data type is incorrect!, ret=%d\n",(int)ret); } /* end if */ ret=H5Tclose(tid2); CHECK(ret, FAIL, "H5Tclose"); @@ -2046,8 +1994,7 @@ test_compat(void) mname=H5Tget_member_name(tid1,2); CHECK(mname, NULL, "H5Tget_member_name"); if(HDstrcmp(mname,"l")!=0) { - num_errs++; - printf("Compound field name doesn't match!, mname=%s\n",mname); + TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname); } /* end if */ free(mname); @@ -2074,8 +2021,7 @@ test_compat(void) /* Check the array dimensions */ for(i=0; i<ndims; i++) if(rdims1[i]!=tdims1[i]) { - num_errs++; - printf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n",(int)i,(int)rdims1[i],(int)i,(int)tdims1[i]); + TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%d, tdims1[%d]=%d\n",(int)i,(int)rdims1[i],(int)i,(int)tdims1[i]); continue; } /* end if */ @@ -2084,8 +2030,7 @@ test_compat(void) CHECK(tid2, FAIL, "H5Tget_member_type"); if((ret=H5Tequal(tid2,H5T_STD_I32LE))<=0) { - num_errs++; - printf("Compound data type is incorrect!, ret=%d\n",(int)ret); + TestErrPrintf("Compound data type is incorrect!, ret=%d\n",(int)ret); } /* end if */ ret=H5Tclose(tid2); CHECK(ret, FAIL, "H5Tclose"); @@ -2096,8 +2041,7 @@ test_compat(void) mname=H5Tget_member_name(tid1,3); CHECK(mname, NULL, "H5Tget_member_name"); if(HDstrcmp(mname,"d")!=0) { - num_errs++; - printf("Compound field name doesn't match!, mname=%s\n",mname); + TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname); } /* end if */ free(mname); @@ -2109,8 +2053,7 @@ test_compat(void) mtid=H5Tget_member_type(tid1,3); CHECK(mtid, FAIL, "H5Tget_member_type"); if((ret=H5Tequal(mtid,H5T_IEEE_F64LE))<=0) { - num_errs++; - printf("Compound data type is incorrect!, ret=%d\n",(int)ret); + TestErrPrintf("Compound data type is incorrect!, ret=%d\n",(int)ret); } /* end if */ ret=H5Tclose(mtid); CHECK(mtid, FAIL, "H5Tclose"); diff --git a/test/tattr.c b/test/tattr.c index 5104366..bfb5daf 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -170,8 +170,7 @@ test_attr_basic_write(void) /* Verify values read in */ for(i=0; i<ATTR1_DIM1; i++) if(attr_data1[i]!=read_data1[i]) { - printf("%d: attribute data different: attr_data1[%d]=%d, read_data1[%d]=%d\n",__LINE__,i,attr_data1[i],i,read_data1[i]); - num_errs++; + TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d, read_data1[%d]=%d\n",__LINE__,i,attr_data1[i],i,read_data1[i]); } /* end if */ /* Close attribute */ @@ -212,8 +211,7 @@ test_attr_basic_write(void) /* Verify values read in */ for(i=0; i<ATTR1_DIM1; i++) if(attr_data1[i]!=read_data1[i]) { - printf("%d: attribute data different: attr_data1[%d]=%d, read_data1[%d]=%d\n",__LINE__,i,attr_data1[i],i,read_data1[i]); - num_errs++; + TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d, read_data1[%d]=%d\n",__LINE__,i,attr_data1[i],i,read_data1[i]); } /* end if */ /* Close attribute */ @@ -247,8 +245,7 @@ test_attr_basic_write(void) /* Verify values read in */ for(i=0; i<ATTR1_DIM1; i++) if(attr_data1a[i]!=read_data1[i]) { - printf("%d: attribute data different: attr_data1[%d]=%d, read_data1[%d]=%d\n",__LINE__,i,attr_data1[i],i,read_data1[i]); - num_errs++; + TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d, read_data1[%d]=%d\n",__LINE__,i,attr_data1[i],i,read_data1[i]); } /* end if */ /* Close attribute */ @@ -356,8 +353,7 @@ test_attr_basic_read(void) /* Verify values read in */ for(i=0; i<ATTR1_DIM1; i++) if(attr_data1[i]!=read_data1[i]) { - printf("%d: attribute data different: attr_data1[%d]=%d, read_data1[%d]=%d\n",__LINE__,i,attr_data1[i],i,read_data1[i]); - num_errs++; + TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d, read_data1[%d]=%d\n",__LINE__,i,attr_data1[i],i,read_data1[i]); } /* end if */ /* Close attribute */ @@ -386,8 +382,7 @@ test_attr_basic_read(void) for(i=0; i<ATTR2_DIM1; i++) for(j=0; j<ATTR2_DIM2; j++) if(attr_data2[i][j]!=read_data2[i][j]) { - printf("%d: attribute data different: attr_data2[%d][%d]=%d, read_data2[%d][%d]=%d\n",__LINE__, i,j,attr_data2[i][j],i,j,read_data1[i]); - num_errs++; + TestErrPrintf("%d: attribute data different: attr_data2[%d][%d]=%d, read_data2[%d][%d]=%d\n",__LINE__, i,j,attr_data2[i][j],i,j,read_data1[i]); } /* end if */ /* Close attribute */ @@ -546,12 +541,10 @@ test_attr_compound_read(void) ret=H5Sget_simple_extent_dims(space,dims, NULL); CHECK(ret, FAIL, "H5Sget_simple_extent_dims"); if(dims[0]!=ATTR4_DIM1) { - printf("attribute dimensions different: dims[0]=%d, should be %d\n",(int)dims[0],ATTR4_DIM1); - num_errs++; + TestErrPrintf("attribute dimensions different: dims[0]=%d, should be %d\n",(int)dims[0],ATTR4_DIM1); } /* end if */ if(dims[1]!=ATTR4_DIM2) { - printf("attribute dimensions different: dims[1]=%d, should be %d\n",(int)dims[1],ATTR4_DIM2); - num_errs++; + TestErrPrintf("attribute dimensions different: dims[1]=%d, should be %d\n",(int)dims[1],ATTR4_DIM2); } /* end if */ H5Sclose(space); @@ -567,8 +560,7 @@ test_attr_compound_read(void) if(!(HDstrcmp(fieldname,ATTR4_FIELDNAME1) || HDstrcmp(fieldname,ATTR4_FIELDNAME2) || HDstrcmp(fieldname,ATTR4_FIELDNAME3))) { - printf("invalid field name for field #%d: %s\n",i,fieldname); - num_errs++; + TestErrPrintf("invalid field name for field #%d: %s\n",i,fieldname); } /* end if */ free(fieldname); } /* end for */ @@ -618,16 +610,14 @@ test_attr_compound_read(void) if(HDmemcmp(&attr_data4[i][j],&read_data4[i][j],sizeof(struct attr4_struct))) { printf("%d: attribute data different: attr_data4[%d][%d].i=%d, read_data4[%d][%d].i=%d\n",__LINE__,i,j,attr_data4[i][j].i,i,j,read_data4[i][j].i); printf("%d: attribute data different: attr_data4[%d][%d].d=%f, read_data4[%d][%d].d=%f\n",__LINE__,i,j,attr_data4[i][j].d,i,j,read_data4[i][j].d); - printf("%d: attribute data different: attr_data4[%d][%d].c=%c, read_data4[%d][%d].c=%c\n",__LINE__,i,j,attr_data4[i][j].c,i,j,read_data4[i][j].c); - num_errs++; + TestErrPrintf("%d: attribute data different: attr_data4[%d][%d].c=%c, read_data4[%d][%d].c=%c\n",__LINE__,i,j,attr_data4[i][j].c,i,j,read_data4[i][j].c); } /* end if */ /* Verify Name */ name_len=H5Aget_name(attr,ATTR_NAME_LEN, attr_name); VERIFY(name_len, HDstrlen(ATTR4_NAME), "H5Aget_name"); if(HDstrcmp(attr_name,ATTR4_NAME)) { - printf("attribute name different: attr_name=%s, should be %s\n",attr_name,ATTR4_NAME); - num_errs++; + TestErrPrintf("attribute name different: attr_name=%s, should be %s\n",attr_name,ATTR4_NAME); } /* end if */ /* Close attribute datatype */ @@ -948,8 +938,7 @@ test_attr_mult_read(void) ret=H5Sget_simple_extent_dims(space,dims, NULL); CHECK(ret, FAIL, "H5Sget_simple_extent_dims"); if(dims[0]!=ATTR1_DIM1) { - printf("attribute dimensions different: dims[0]=%d, should be %d\n",(int)dims[0],ATTR1_DIM1); - num_errs++; + TestErrPrintf("attribute dimensions different: dims[0]=%d, should be %d\n",(int)dims[0],ATTR1_DIM1); } /* end if */ H5Sclose(space); @@ -971,16 +960,14 @@ test_attr_mult_read(void) /* Verify values read in */ for(i=0; i<ATTR1_DIM1; i++) if(attr_data1[i]!=read_data1[i]) { - printf("%d: attribute data different: attr_data1[%d]=%d, read_data1[%d]=%d\n",__LINE__,i,attr_data1[i],i,read_data1[i]); - num_errs++; + TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d, read_data1[%d]=%d\n",__LINE__,i,attr_data1[i],i,read_data1[i]); } /* end if */ /* Verify Name */ name_len=H5Aget_name(attr, ATTR_NAME_LEN, attr_name); VERIFY(name_len, HDstrlen(ATTR1_NAME), "H5Aget_name"); if(HDstrcmp(attr_name,ATTR1_NAME)) { - printf("attribute name different: attr_name=%s, should be %s\n",attr_name,ATTR1_NAME); - num_errs++; + TestErrPrintf("attribute name different: attr_name=%s, should be %s\n",attr_name,ATTR1_NAME); } /* end if */ /* Verify Name with too small of a buffer */ @@ -989,8 +976,7 @@ test_attr_mult_read(void) HDstrcpy(temp_name,ATTR1_NAME); /* make a copy of the name */ temp_name[HDstrlen(ATTR1_NAME)-1]='\0'; /* truncate it to match the one retrieved */ if(HDstrcmp(attr_name,temp_name)) { - printf("attribute name different: attr_name=%s, should be %s\n",attr_name,temp_name); - num_errs++; + TestErrPrintf("attribute name different: attr_name=%s, should be %s\n",attr_name,temp_name); } /* end if */ /* Close attribute */ @@ -1009,12 +995,10 @@ test_attr_mult_read(void) ret=H5Sget_simple_extent_dims(space,dims, NULL); CHECK(ret, FAIL, "H5Sget_simple_extent_dims"); if(dims[0]!=ATTR2_DIM1) { - printf("attribute dimensions different: dims[0]=%d, should be %d\n",(int)dims[0],ATTR2_DIM1); - num_errs++; + TestErrPrintf("attribute dimensions different: dims[0]=%d, should be %d\n",(int)dims[0],ATTR2_DIM1); } /* end if */ if(dims[1]!=ATTR2_DIM2) { - printf("attribute dimensions different: dims[1]=%d, should be %d\n",(int)dims[1],ATTR2_DIM2); - num_errs++; + TestErrPrintf("attribute dimensions different: dims[1]=%d, should be %d\n",(int)dims[1],ATTR2_DIM2); } /* end if */ H5Sclose(space); @@ -1037,16 +1021,14 @@ test_attr_mult_read(void) for(i=0; i<ATTR2_DIM1; i++) for(j=0; j<ATTR2_DIM2; j++) if(attr_data2[i][j]!=read_data2[i][j]) { - printf("%d: attribute data different: attr_data2[%d][%d]=%d, read_data2[%d][%d]=%d\n",__LINE__,i,j,attr_data2[i][j],i,j,read_data2[i][j]); - num_errs++; + TestErrPrintf("%d: attribute data different: attr_data2[%d][%d]=%d, read_data2[%d][%d]=%d\n",__LINE__,i,j,attr_data2[i][j],i,j,read_data2[i][j]); } /* end if */ /* Verify Name */ name_len=H5Aget_name(attr,ATTR_NAME_LEN, attr_name); VERIFY(name_len, HDstrlen(ATTR2_NAME), "H5Aget_name"); if(HDstrcmp(attr_name,ATTR2_NAME)) { - printf("attribute name different: attr_name=%s, should be %s\n",attr_name,ATTR2_NAME); - num_errs++; + TestErrPrintf("attribute name different: attr_name=%s, should be %s\n",attr_name,ATTR2_NAME); } /* end if */ /* Verify Name with too small of a buffer */ @@ -1055,8 +1037,7 @@ test_attr_mult_read(void) HDstrcpy(temp_name,ATTR2_NAME); /* make a copy of the name */ temp_name[HDstrlen(ATTR2_NAME)-1]='\0'; /* truncate it to match the one retrieved */ if(HDstrcmp(attr_name,temp_name)) { - printf("attribute name different: attr_name=%s, should be %s\n",attr_name,temp_name); - num_errs++; + TestErrPrintf("attribute name different: attr_name=%s, should be %s\n",attr_name,temp_name); } /* end if */ /* Close attribute */ @@ -1075,16 +1056,13 @@ test_attr_mult_read(void) ret=H5Sget_simple_extent_dims(space,dims, NULL); CHECK(ret, FAIL, "H5Sget_simple_extent_dims"); if(dims[0]!=ATTR3_DIM1) { - printf("attribute dimensions different: dims[0]=%d, should be %d\n",(int)dims[0],ATTR3_DIM1); - num_errs++; + TestErrPrintf("attribute dimensions different: dims[0]=%d, should be %d\n",(int)dims[0],ATTR3_DIM1); } /* end if */ if(dims[1]!=ATTR3_DIM2) { - printf("attribute dimensions different: dims[1]=%d, should be %d\n",(int)dims[1],ATTR3_DIM2); - num_errs++; + TestErrPrintf("attribute dimensions different: dims[1]=%d, should be %d\n",(int)dims[1],ATTR3_DIM2); } /* end if */ if(dims[2]!=ATTR3_DIM3) { - printf("attribute dimensions different: dims[2]=%d, should be %d\n",(int)dims[2],ATTR3_DIM3); - num_errs++; + TestErrPrintf("attribute dimensions different: dims[2]=%d, should be %d\n",(int)dims[2],ATTR3_DIM3); } /* end if */ H5Sclose(space); @@ -1108,16 +1086,14 @@ test_attr_mult_read(void) for(j=0; j<ATTR3_DIM2; j++) for(k=0; k<ATTR3_DIM3; k++) if(attr_data3[i][j][k]!=read_data3[i][j][k]) { - printf("%d: attribute data different: attr_data3[%d][%d][%d]=%f, read_data3[%d][%d][%d]=%f\n",__LINE__,i,j,k,attr_data3[i][j][k],i,j,k,read_data3[i][j][k]); - num_errs++; + TestErrPrintf("%d: attribute data different: attr_data3[%d][%d][%d]=%f, read_data3[%d][%d][%d]=%f\n",__LINE__,i,j,k,attr_data3[i][j][k],i,j,k,read_data3[i][j][k]); } /* end if */ /* Verify Name */ name_len=H5Aget_name(attr,ATTR_NAME_LEN, attr_name); VERIFY(name_len, HDstrlen(ATTR3_NAME), "H5Aget_name"); if(HDstrcmp(attr_name,ATTR3_NAME)) { - printf("attribute name different: attr_name=%s, should be %s\n",attr_name,ATTR3_NAME); - num_errs++; + TestErrPrintf("attribute name different: attr_name=%s, should be %s\n",attr_name,ATTR3_NAME); } /* end if */ /* Verify Name with too small of a buffer */ @@ -1126,8 +1102,7 @@ test_attr_mult_read(void) HDstrcpy(temp_name,ATTR3_NAME); /* make a copy of the name */ temp_name[HDstrlen(ATTR3_NAME)-1]='\0'; /* truncate it to match the one retrieved */ if(HDstrcmp(attr_name,temp_name)) { - printf("attribute name different: attr_name=%s, should be %s\n",attr_name,temp_name); - num_errs++; + TestErrPrintf("attribute name different: attr_name=%s, should be %s\n",attr_name,temp_name); } /* end if */ /* Close attribute */ @@ -1156,24 +1131,21 @@ herr_t attr_op1(hid_t UNUSED loc_id, const char *name, void *op_data) switch(*count) { case 0: if(HDstrcmp(name,ATTR1_NAME)) { - printf("attribute name different: name=%s, should be %s\n",name,ATTR1_NAME); - num_errs++; + TestErrPrintf("attribute name different: name=%s, should be %s\n",name,ATTR1_NAME); } /* end if */ (*count)++; break; case 1: if(HDstrcmp(name,ATTR2_NAME)) { - printf("attribute name different: name=%s, should be %s\n",name,ATTR2_NAME); - num_errs++; + TestErrPrintf("attribute name different: name=%s, should be %s\n",name,ATTR2_NAME); } /* end if */ (*count)++; break; case 2: if(HDstrcmp(name,ATTR3_NAME)) { - printf("attribute name different: name=%s, should be %s\n",name,ATTR3_NAME); - num_errs++; + TestErrPrintf("attribute name different: name=%s, should be %s\n",name,ATTR3_NAME); } /* end if */ (*count)++; break; @@ -1311,8 +1283,7 @@ test_attr_delete(void) name_len=H5Aget_name(attr,ATTR_NAME_LEN,attr_name); VERIFY(name_len, HDstrlen(ATTR1_NAME), "H5Aget_name"); if(HDstrcmp(attr_name,ATTR1_NAME)) { - printf("attribute name different: attr_name=%s, should be %s\n",attr_name,ATTR1_NAME); - num_errs++; + TestErrPrintf("attribute name different: attr_name=%s, should be %s\n",attr_name,ATTR1_NAME); } /* end if */ /* Close attribute */ @@ -1327,8 +1298,7 @@ test_attr_delete(void) name_len=H5Aget_name(attr,ATTR_NAME_LEN, attr_name); VERIFY(name_len, HDstrlen(ATTR3_NAME), "H5Aget_name"); if(HDstrcmp(attr_name,ATTR3_NAME)) { - printf("attribute name different: attr_name=%s, should be %s\n",attr_name,ATTR3_NAME); - num_errs++; + TestErrPrintf("attribute name different: attr_name=%s, should be %s\n",attr_name,ATTR3_NAME); } /* end if */ /* Close attribute */ @@ -1351,8 +1321,7 @@ test_attr_delete(void) name_len=H5Aget_name(attr,ATTR_NAME_LEN, attr_name); VERIFY(name_len, HDstrlen(ATTR3_NAME), "H5Aget_name"); if(HDstrcmp(attr_name,ATTR3_NAME)) { - printf("attribute name different: attr_name=%s, should be %s\n",attr_name,ATTR3_NAME); - num_errs++; + TestErrPrintf("attribute name different: attr_name=%s, should be %s\n",attr_name,ATTR3_NAME); } /* end if */ /* Close attribute */ @@ -1411,8 +1380,7 @@ test_attr_dtype_shared(void) /* Get size of file */ empty_filesize=h5_get_file_size(FILENAME); if(empty_filesize==0) { - printf("Line %d: file size wrong!\n",__LINE__); - num_errs++; + TestErrPrintf("Line %d: file size wrong!\n",__LINE__); } /* end if */ /* Re-open file */ diff --git a/test/tconfig.c b/test/tconfig.c index 4cb3976..f921af2 100644 --- a/test/tconfig.c +++ b/test/tconfig.c @@ -29,9 +29,8 @@ /* verify C type sizes */ #define vrfy_ctype(ctype, ctype_macro) \ if (sizeof(ctype) != ctype_macro){ \ - print_func("Error verifying %s expected: %d, got: %d\n", \ + TestErrPrintf("Error verifying %s expected: %d, got: %d\n", \ #ctype_macro, ctype_macro, sizeof(ctype)); \ - num_errs++; \ } /* local routine prototypes */ diff --git a/test/testframe.c b/test/testframe.c index dee0169..298fe83 100644 --- a/test/testframe.c +++ b/test/testframe.c @@ -40,8 +40,10 @@ typedef struct TestStruct { /* - * Global variables used by InitTest(). + * 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 TestStruct Test[MAXNUMOFTESTS]; static int Index = 0; @@ -291,3 +293,44 @@ void TestCleanup(void) Test[Loop].Cleanup(); } + +/* + * Retrieve the verbosity level for the testing framework + */ +int GetTestVerbosity(void) +{ + return(Verbosity); +} + + +/* + * Retrieve the number of testing errors for the testing framework + */ +int GetTestNumErrs(void) +{ + return(num_errs); +} + + +/* + * This routine is designed to provide equivalent functionality to 'printf' + * and also increment the error count for the testing framework. + */ +int +TestErrPrintf(const char *format, ...) +{ + va_list arglist; + int ret_value; + + /* Increment the error count */ + num_errs++; + + /* Print the requested information */ + va_start(arglist, format); + ret_value = vprintf(format, arglist); + va_end(arglist); + + /* Return the length of the string produced (like printf() does) */ + return ret_value; +} + diff --git a/test/testhdf5.c b/test/testhdf5.c index e7a6ff2..798ef7a 100644 --- a/test/testhdf5.c +++ b/test/testhdf5.c @@ -35,10 +35,6 @@ */ -#include "h5test.h" - -#define HDF5_TEST_MASTER - /* ANY new test needs to have a prototype in testhdf5.h */ #include "testhdf5.h" @@ -88,5 +84,5 @@ main(int argc, char *argv[]) if (CleanUp && !getenv("HDF5_NOCLEANUP")) TestCleanup(); - return (num_errs); + return (GetTestNumErrs()); } /* end main() */ diff --git a/test/testhdf5.h b/test/testhdf5.h index c860450..1c908c9 100644 --- a/test/testhdf5.h +++ b/test/testhdf5.h @@ -29,87 +29,73 @@ /* Include generic testing header also */ #include "h5test.h" -#ifdef HDF5_TEST_MASTER -/* Global variables */ -int num_errs = 0; -int Verbosity = 4; /* Default Verbosity is Low */ -#else /* HDF5_TEST_MASTER */ -extern int num_errs; -extern int Verbosity; -#endif /* HDF5_TEST_MASTER */ - /* 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 (Verbosity>9) print_func(" Call to routine: %15s at line %4d " \ + if (GetTestVerbosity()>9) print_func(" Call to routine: %15s at line %4d " \ "in %s returned %ld \n", \ where, (int)__LINE__, __FILE__, \ (long)(ret)); \ if ((ret) == (val)) { \ - print_func("*** UNEXPECTED RETURN from %s is %ld at line %4d " \ + TestErrPrintf("*** UNEXPECTED RETURN from %s is %ld at line %4d " \ "in %s\n", where, (long)(ret), (int)__LINE__, __FILE__); \ - num_errs++; \ H5Eprint (stdout); \ } \ } while(0) #define CHECK_I(ret,where) { \ - if (Verbosity>9) { \ + if (GetTestVerbosity()>9) { \ print_func(" Call to routine: %15s at line %4d in %s returned %ld\n", \ (where), (int)__LINE__, __FILE__, (long)(ret)); \ } \ if ((ret)<0) { \ - print_func ("*** UNEXPECTED RETURN from %s is %ld line %4d in %s\n", \ + TestErrPrintf ("*** UNEXPECTED RETURN from %s is %ld line %4d in %s\n", \ (where), (long)(ret), (int)__LINE__, __FILE__); \ H5Eprint (stdout); \ - num_errs++; \ } \ } #define CHECK_PTR(ret,where) { \ - if (Verbosity>9) { \ + if (GetTestVerbosity()>9) { \ print_func(" Call to routine: %15s at line %4d in %s returned %p\n", \ (where), (int)__LINE__, __FILE__, (ret)); \ } \ if (!(ret)) { \ - print_func ("*** UNEXPECTED RETURN from %s is NULL line %4d in %s\n", \ + TestErrPrintf ("*** UNEXPECTED RETURN from %s is NULL line %4d in %s\n", \ (where), (int)__LINE__, __FILE__); \ H5Eprint (stdout); \ - num_errs++; \ } \ } /* Used to make certain a return value _is_ a value */ #define VERIFY(x, val, where) do { \ - if (Verbosity>9) { \ + if (GetTestVerbosity()>9) { \ print_func(" Call to routine: %15s at line %4d in %s had value " \ "%ld \n", (where), (int)__LINE__, __FILE__, (long)(x)); \ } \ if ((x) != (val)) { \ - print_func("*** UNEXPECTED VALUE from %s should be %ld, but is %ld at line %4d " \ + TestErrPrintf("*** UNEXPECTED VALUE from %s should be %ld, but is %ld at line %4d " \ "in %s\n", (where), (long)(val), (long)(x), (int)__LINE__, __FILE__); \ H5Eprint (stdout); \ - num_errs++; \ } \ } while(0) /* Used to document process through a test and to check for errors */ #define RESULT(ret,func) do { \ - if (Verbosity>8) { \ + if (GetTestVerbosity()>8) { \ print_func(" Call to routine: %15s at line %4d in %s returned " \ "%ld\n", func, (int)__LINE__, __FILE__, (long)(ret)); \ } \ - if (Verbosity>9) H5Eprint(stdout); \ + if (GetTestVerbosity()>9) H5Eprint(stdout); \ if ((ret) == FAIL) { \ - print_func("*** UNEXPECTED RETURN from %s is %ld at line %4d " \ + TestErrPrintf("*** UNEXPECTED RETURN from %s is %ld at line %4d " \ "in %s\n", func, (long)(ret), (int)__LINE__, __FILE__); \ H5Eprint (stdout); \ - num_errs++; \ } \ } while(0) /* Used to document process through a test */ -#define MESSAGE(V,A) {if (Verbosity>(V)) print_func A;} +#define MESSAGE(V,A) {if (GetTestVerbosity()>(V)) print_func A;} /* definitions for command strings */ #define VERBOSITY_STR "Verbosity" @@ -117,6 +103,10 @@ extern int Verbosity; #define TEST_STR "Test" #define CLEAN_STR "Cleanup" +#ifdef __cplusplus +extern "C" { +#endif + /* 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), @@ -127,6 +117,9 @@ H5TEST_DLL void PerformTests(void); H5TEST_DLL void TestSummary(void); H5TEST_DLL void TestCleanup(void); H5TEST_DLL void TestInit(void); +H5TEST_DLL int GetTestVerbosity(void); +H5TEST_DLL int GetTestNumErrs(void); +H5TEST_DLL int TestErrPrintf(const char *format, ...); /* Prototypes for the test routines */ void test_metadata(void); @@ -166,4 +159,7 @@ void cleanup_genprop(void); void cleanup_configure(void); void cleanup_misc(void); +#ifdef __cplusplus +} +#endif #endif /* TESTHDF5_H */ diff --git a/test/tgenprop.c b/test/tgenprop.c index e75c9e0..4a6e99c 100644 --- a/test/tgenprop.c +++ b/test/tgenprop.c @@ -88,8 +88,7 @@ test_genprop_basic_class(void) name = H5Pget_class_name(cid1); CHECK_PTR(name, "H5Pget_class_name"); if(HDstrcmp(name,CLASS1_NAME)!=0) { - num_errs++; - printf("Class names don't match!, name=%s, CLASS1_NAME=%s\n",name,CLASS1_NAME); + TestErrPrintf("Class names don't match!, name=%s, CLASS1_NAME=%s\n",name,CLASS1_NAME); } /* end if */ free(name); @@ -121,8 +120,7 @@ test_genprop_basic_class(void) name = H5Pget_class_name(cid1); CHECK_PTR(name, "H5Pget_class_name"); if(HDstrcmp(name,CLASS2_NAME)!=0) { - num_errs++; - printf("Class names don't match!, name=%s, CLASS2_NAME=%s\n",name,CLASS2_NAME); + TestErrPrintf("Class names don't match!, name=%s, CLASS2_NAME=%s\n",name,CLASS2_NAME); } /* end if */ free(name); @@ -685,8 +683,7 @@ test_genprop_basic_list_prop(void) ret = H5Pget(lid1,PROP3_NAME,&prop3_value); CHECK_I(ret, "H5Pget"); if(memcmp(&prop3_value,PROP3_DEF_VALUE,PROP3_SIZE)!=0) { - num_errs++; - printf("Property #3 doesn't match!, line=%d\n",__LINE__); + TestErrPrintf("Property #3 doesn't match!, line=%d\n",__LINE__); } /* end if */ ret = H5Pget(lid1,PROP4_NAME,&prop4_value); CHECK_I(ret, "H5Pget"); @@ -1062,12 +1059,10 @@ test_genprop_list_callback(void) /* Verify creation callback information for properties tracked */ VERIFY(prop1_cb_info.crt_count, 1, "H5Pcreate"); if(HDstrcmp(prop1_cb_info.crt_name,PROP1_NAME)!=0) { - num_errs++; - printf("Property #1 name doesn't match!, line=%d\n",__LINE__); + TestErrPrintf("Property #1 name doesn't match!, line=%d\n",__LINE__); } /* end if */ if(HDmemcmp(prop1_cb_info.crt_value,PROP1_DEF_VALUE,PROP1_SIZE)!=0) { - num_errs++; - printf("Property #1 value doesn't match!, line=%d\n",__LINE__); + TestErrPrintf("Property #1 value doesn't match!, line=%d\n",__LINE__); } /* end if */ /* Check values of permanent properties (set with default values) */ @@ -1082,8 +1077,7 @@ test_genprop_list_callback(void) ret = H5Pget(lid1,PROP3_NAME,&prop3_value); CHECK_I(ret, "H5Pget"); if(memcmp(&prop3_value,PROP3_DEF_VALUE,PROP3_SIZE)!=0) { - num_errs++; - printf("Property #3 doesn't match!, line=%d\n",__LINE__); + TestErrPrintf("Property #3 doesn't match!, line=%d\n",__LINE__); } /* end if */ ret = H5Pget(lid1,PROP4_NAME,&prop4_value); CHECK_I(ret, "H5Pget"); @@ -1093,12 +1087,10 @@ test_genprop_list_callback(void) VERIFY(prop1_cb_info.get_count, 1, "H5Pget"); VERIFY(prop1_cb_info.get_plist_id, lid1, "H5Pget"); if(HDstrcmp(prop1_cb_info.get_name,PROP1_NAME)!=0) { - num_errs++; - printf("Property #1 name doesn't match!, line=%d\n",__LINE__); + TestErrPrintf("Property #1 name doesn't match!, line=%d\n",__LINE__); } /* end if */ if(HDmemcmp(prop1_cb_info.get_value,PROP1_DEF_VALUE,PROP1_SIZE)!=0) { - num_errs++; - printf("Property #1 value doesn't match!, line=%d\n",__LINE__); + TestErrPrintf("Property #1 value doesn't match!, line=%d\n",__LINE__); } /* end if */ /* Set value of property #1 to different value */ @@ -1109,12 +1101,10 @@ test_genprop_list_callback(void) VERIFY(prop1_cb_info.set_count, 1, "H5Pset"); VERIFY(prop1_cb_info.set_plist_id, lid1, "H5Pset"); if(HDstrcmp(prop1_cb_info.set_name,PROP1_NAME)!=0) { - num_errs++; - printf("Property #1 name doesn't match!, line=%d\n",__LINE__); + TestErrPrintf("Property #1 name doesn't match!, line=%d\n",__LINE__); } /* end if */ if(HDmemcmp(prop1_cb_info.set_value,&prop1_new_value,PROP1_SIZE)!=0) { - num_errs++; - printf("Property #1 value doesn't match!, line=%d\n",__LINE__); + TestErrPrintf("Property #1 value doesn't match!, line=%d\n",__LINE__); } /* end if */ /* Check new value of tracked properties */ @@ -1126,12 +1116,10 @@ test_genprop_list_callback(void) VERIFY(prop1_cb_info.get_count, 2, "H5Pget"); VERIFY(prop1_cb_info.get_plist_id, lid1, "H5Pget"); if(HDstrcmp(prop1_cb_info.get_name,PROP1_NAME)!=0) { - num_errs++; - printf("Property #1 name doesn't match!, line=%d\n",__LINE__); + TestErrPrintf("Property #1 name doesn't match!, line=%d\n",__LINE__); } /* end if */ if(HDmemcmp(prop1_cb_info.get_value,&prop1_new_value,PROP1_SIZE)!=0) { - num_errs++; - printf("Property #1 value doesn't match!, line=%d\n",__LINE__); + TestErrPrintf("Property #1 value doesn't match!, line=%d\n",__LINE__); } /* end if */ /* Delete property #2 */ @@ -1142,12 +1130,10 @@ test_genprop_list_callback(void) VERIFY(prop2_cb_info.del_count, 1, "H5Premove"); VERIFY(prop2_cb_info.del_plist_id, lid1, "H5Premove"); if(HDstrcmp(prop2_cb_info.del_name,PROP2_NAME)!=0) { - num_errs++; - printf("Property #2 name doesn't match!, line=%d\n",__LINE__); + TestErrPrintf("Property #2 name doesn't match!, line=%d\n",__LINE__); } /* end if */ if(HDmemcmp(prop2_cb_info.del_value,PROP2_DEF_VALUE,PROP2_SIZE)!=0) { - num_errs++; - printf("Property #2 value doesn't match!, line=%d\n",__LINE__); + TestErrPrintf("Property #2 value doesn't match!, line=%d\n",__LINE__); } /* end if */ /* Copy first list */ @@ -1157,12 +1143,10 @@ test_genprop_list_callback(void) /* Verify copy callback information for properties tracked */ VERIFY(prop1_cb_info.cop_count, 1, "H5Pcopy"); if(HDstrcmp(prop1_cb_info.cop_name,PROP1_NAME)!=0) { - num_errs++; - printf("Property #1 name doesn't match!, line=%d\n",__LINE__); + TestErrPrintf("Property #1 name doesn't match!, line=%d\n",__LINE__); } /* end if */ if(HDmemcmp(prop1_cb_info.cop_value,&prop1_new_value,PROP1_SIZE)!=0) { - num_errs++; - printf("Property #1 value doesn't match!, line=%d\n",__LINE__); + TestErrPrintf("Property #1 value doesn't match!, line=%d\n",__LINE__); } /* end if */ /* Verify that the class creation callback occurred */ @@ -1176,12 +1160,10 @@ test_genprop_list_callback(void) /* Verify close callback information for properties tracked */ VERIFY(prop1_cb_info.cls_count, 1, "H5Pclose"); if(HDstrcmp(prop1_cb_info.cls_name,PROP1_NAME)!=0) { - num_errs++; - printf("Property #1 name doesn't match!, line=%d\n",__LINE__); + TestErrPrintf("Property #1 name doesn't match!, line=%d\n",__LINE__); } /* end if */ if(HDmemcmp(prop1_cb_info.cls_value,&prop1_new_value,PROP1_SIZE)!=0) { - num_errs++; - printf("Property #1 value doesn't match!, line=%d\n",__LINE__); + TestErrPrintf("Property #1 value doesn't match!, line=%d\n",__LINE__); } /* end if */ /* Close second list */ @@ -1451,8 +1433,7 @@ test_genprop_path(void) path=H5P_get_class_path_test(cid1); CHECK_PTR(path, "H5P_get_class_path_test"); if(HDstrcmp(path,CLASS1_PATH)!=0) { - num_errs++; - printf("Class names don't match!, path=%s, CLASS1_PATH=%s\n",path,CLASS1_PATH); + TestErrPrintf("Class names don't match!, path=%s, CLASS1_PATH=%s\n",path,CLASS1_PATH); } /* end if */ free(path); @@ -1468,8 +1449,7 @@ test_genprop_path(void) path=H5P_get_class_path_test(cid2); CHECK_PTR(path, "H5P_get_class_path_test"); if(HDstrcmp(path,CLASS2_PATH)!=0) { - num_errs++; - printf("Class names don't match!, path=%s, CLASS2_PATH=%s\n",path,CLASS2_PATH); + TestErrPrintf("Class names don't match!, path=%s, CLASS2_PATH=%s\n",path,CLASS2_PATH); } /* end if */ /* Open a copy of the class with the path name */ @@ -1530,8 +1510,7 @@ test_genprop_refcount(void) name = H5Pget_class_name(cid1); CHECK_PTR(name, "H5Pget_class_name"); if(HDstrcmp(name,CLASS1_NAME)!=0) { - num_errs++; - printf("Class names don't match!, name=%s, CLASS1_NAME=%s\n",name,CLASS1_NAME); + TestErrPrintf("Class names don't match!, name=%s, CLASS1_NAME=%s\n",name,CLASS1_NAME); } /* end if */ free(name); @@ -1551,8 +1530,7 @@ test_genprop_refcount(void) name = H5Pget_class_name(cid1); CHECK_PTR(name, "H5Pget_class_name"); if(HDstrcmp(name,CLASS1_NAME)!=0) { - num_errs++; - printf("Class names don't match!, name=%s, CLASS1_NAME=%s\n",name,CLASS1_NAME); + TestErrPrintf("Class names don't match!, name=%s, CLASS1_NAME=%s\n",name,CLASS1_NAME); } /* end if */ free(name); @@ -1564,8 +1542,7 @@ test_genprop_refcount(void) name = H5Pget_class_name(cid1); CHECK_PTR(name, "H5Pget_class_name"); if(HDstrcmp(name,CLASS1_NAME)!=0) { - num_errs++; - printf("Class names don't match!, name=%s, CLASS1_NAME=%s\n",name,CLASS1_NAME); + TestErrPrintf("Class names don't match!, name=%s, CLASS1_NAME=%s\n",name,CLASS1_NAME); } /* end if */ free(name); diff --git a/test/th5s.c b/test/th5s.c index e8185db..3404d40 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -452,8 +452,7 @@ test_h5s_compound_scalar_read(void) printf("scalar data different: space4_data.c1=%c, read_data4.c1=%c\n",space4_data.c1,rdata.c1); printf("scalar data different: space4_data.u=%u, read_data4.u=%u\n",space4_data.u,rdata.u); printf("scalar data different: space4_data.f=%f, read_data4.f=%f\n",space4_data.f,rdata.f); - printf("scalar data different: space4_data.c1=%c, read_data4.c1=%c\n",space4_data.c1,rdata.c2); - num_errs++; + TestErrPrintf("scalar data different: space4_data.c1=%c, read_data4.c1=%c\n",space4_data.c1,rdata.c2); } /* end if */ /* Close Dataset */ @@ -550,8 +549,7 @@ test_h5s_chunk(void) for(i=0; i<50000; i++) { for(j=0; j<3; j++) { if(chunk_data_dbl[i][j]!=chunk_data_flt[i][j]) { - num_errs++; - printf("chunk_data_dbl[%d][%d]=%f, chunk_data_flt[%d][%d]=%f\n",i,j,chunk_data_dbl[i][j],i,j,chunk_data_flt[i][j]); + TestErrPrintf("chunk_data_dbl[%d][%d]=%f, chunk_data_flt[%d][%d]=%f\n",i,j,chunk_data_dbl[i][j],i,j,chunk_data_flt[i][j]); } /* end if */ } /* end for */ } /* end for */ diff --git a/test/theap.c b/test/theap.c index b02055e..3c134bb 100644 --- a/test/theap.c +++ b/test/theap.c @@ -594,14 +594,12 @@ static void test_heap_remove_many_core(H5HP_type_t heap_type, test_obj *arr, siz /* Check that the value is correct, based on the heap type */ if(heap_type==H5HP_MAX_HEAP) { if(val>last_val) { - num_errs++; - printf("Error on line %d: incorrect value from heap=%d, last_val=%d\n",__LINE__,val,last_val); + TestErrPrintf("Error on line %d: incorrect value from heap=%d, last_val=%d\n",__LINE__,val,last_val); } /* end if */ } /* end if */ else { if(val<last_val) { - num_errs++; - printf("Error on line %d: incorrect value from heap=%d, last_val=%d\n",__LINE__,val,last_val); + TestErrPrintf("Error on line %d: incorrect value from heap=%d, last_val=%d\n",__LINE__,val,last_val); } /* end if */ } /* end else */ @@ -641,14 +639,12 @@ static void test_heap_remove_many_core(H5HP_type_t heap_type, test_obj *arr, siz /* Check that the value is correct, based on the heap type */ if(heap_type==H5HP_MAX_HEAP) { if(val>last_val) { - num_errs++; - printf("Error on line %d: incorrect value from heap=%d, last_val=%d\n",__LINE__,val,last_val); + TestErrPrintf("Error on line %d: incorrect value from heap=%d, last_val=%d\n",__LINE__,val,last_val); } /* end if */ } /* end if */ else { if(val<last_val) { - num_errs++; - printf("Error on line %d: incorrect value from heap=%d, last_val=%d\n",__LINE__,val,last_val); + TestErrPrintf("Error on line %d: incorrect value from heap=%d, last_val=%d\n",__LINE__,val,last_val); } /* end if */ } /* end else */ diff --git a/test/titerate.c b/test/titerate.c index 5a6275e..5d93063 100644 --- a/test/titerate.c +++ b/test/titerate.c @@ -268,8 +268,7 @@ static void test_iter_group(void) info.command=RET_ZERO; idx=0; if((ret=H5Giterate(file,"/",&idx,giter_cb,&info))>0) { - printf("Group iteration function didn't return zero correctly!\n"); - num_errs++; + TestErrPrintf("Group iteration function didn't return zero correctly!\n"); } /* Test all objects in group, when callback always returns 1 */ @@ -289,32 +288,27 @@ static void test_iter_group(void) /* Verify that the correct name is retrieved */ if(idx<=NDATASETS) { if(strcmp(info.name,dnames[idx-1])!=0) { - printf("Group iteration function didn't return one correctly for dataset #%d!\n",idx); - num_errs++; + TestErrPrintf("Group iteration function didn't return one correctly for dataset #%d!\n",idx); } /* end if */ } /* end if */ else if(idx==(NDATASETS+1)) { if(strcmp(info.name,"dtype")!=0) { - printf("Group iteration function didn't return one correctly for group!\n"); - num_errs++; + TestErrPrintf("Group iteration function didn't return one correctly for group!\n"); } /* end if */ } /* end if */ else if(idx==(NDATASETS+2)) { if(strcmp(info.name,"grp")!=0) { - printf("Group iteration function didn't return one correctly for group!\n"); - num_errs++; + TestErrPrintf("Group iteration function didn't return one correctly for group!\n"); } /* end if */ } /* end if */ else { - printf("Group iteration function walked too far!\n"); - num_errs++; + TestErrPrintf("Group iteration function walked too far!\n"); } /* end else */ } VERIFY(ret,-1,"H5Giterate"); if(i!=(NDATASETS+2)) { - printf("Group iteration function didn't perform multiple iterations correctly!\n"); - num_errs++; + TestErrPrintf("Group iteration function didn't perform multiple iterations correctly!\n"); } /* end if */ /* Test all objects in group, when callback changes return value */ @@ -334,32 +328,27 @@ static void test_iter_group(void) /* Verify that the correct name is retrieved */ if(idx<=NDATASETS) { if(strcmp(info.name,dnames[idx-1])!=0) { - printf("Group iteration function didn't return one correctly for dataset #%d!\n",idx); - num_errs++; + TestErrPrintf("Group iteration function didn't return one correctly for dataset #%d!\n",idx); } /* end if */ } /* end if */ else if(idx==(NDATASETS+1)) { if(strcmp(info.name,"dtype")!=0) { - printf("Group iteration function didn't return one correctly for group!\n"); - num_errs++; + TestErrPrintf("Group iteration function didn't return one correctly for group!\n"); } /* end if */ } /* end if */ else if(idx==(NDATASETS+2)) { if(strcmp(info.name,"grp")!=0) { - printf("Group iteration function didn't return one correctly for group!\n"); - num_errs++; + TestErrPrintf("Group iteration function didn't return one correctly for group!\n"); } /* end if */ } /* end if */ else { - printf("Group iteration function walked too far!\n"); - num_errs++; + TestErrPrintf("Group iteration function walked too far!\n"); } /* end else */ } VERIFY(ret,-1,"H5Giterate"); if(i!=42 || idx!=52) { - printf("Group iteration function didn't perform multiple iterations correctly!\n"); - num_errs++; + TestErrPrintf("Group iteration function didn't perform multiple iterations correctly!\n"); } /* end if */ ret=H5Fclose(file); @@ -489,8 +478,7 @@ static void test_iter_attr(void) info.command=RET_ZERO; idx=0; if((ret=H5Aiterate(dataset,&idx,aiter_cb,&info))>0) { - printf("Attribute iteration function didn't return zero correctly!\n"); - num_errs++; + TestErrPrintf("Attribute iteration function didn't return zero correctly!\n"); } /* Test all attributes on dataset, when callback always returns 1 */ @@ -509,14 +497,12 @@ static void test_iter_attr(void) /* Verify that the correct name is retrieved */ if(strcmp(info.name,anames[idx-1])!=0) { - printf("Attribute iteration function didn't return one correctly!\n"); - num_errs++; + TestErrPrintf("Attribute iteration function didn't return one correctly!\n"); } /* end if */ } VERIFY(ret,-1,"H5Aiterate"); if(i!=50 || idx!=50) { - printf("Group iteration function didn't perform multiple iterations correctly!\n"); - num_errs++; + TestErrPrintf("Group iteration function didn't perform multiple iterations correctly!\n"); } /* end if */ @@ -536,14 +522,12 @@ static void test_iter_attr(void) /* Verify that the correct name is retrieved */ if(strcmp(info.name,anames[idx-1])!=0) { - printf("Attribute iteration function didn't return changing correctly!\n"); - num_errs++; + TestErrPrintf("Attribute iteration function didn't return changing correctly!\n"); } /* end if */ } VERIFY(ret,-1,"H5Aiterate"); if(i!=40 || idx!=50) { - printf("Group iteration function didn't perform multiple iterations correctly!\n"); - num_errs++; + TestErrPrintf("Group iteration function didn't perform multiple iterations correctly!\n"); } /* end if */ ret=H5Fclose(file); @@ -580,8 +564,7 @@ herr_t giter_cb2(hid_t loc_id, const char *name, void *opdata) H5G_stat_t statbuf; if(strcmp(name,test_info->name)) { - num_errs++; - printf("name=%s, test_info=%s\n",name,test_info->name); + TestErrPrintf("name=%s, test_info=%s\n",name,test_info->name); return(-1); } /* end if */ @@ -592,8 +575,7 @@ herr_t giter_cb2(hid_t loc_id, const char *name, void *opdata) CHECK(ret, FAIL, "H5Gget_objinfo"); if(test_info->type!=statbuf.type) { - num_errs++; - printf("test_info->type=%d, statbuf.type=%d\n",test_info->type,statbuf.type); + TestErrPrintf("test_info->type=%d, statbuf.type=%d\n",test_info->type,statbuf.type); return(-1); } /* end if */ diff --git a/test/tmeta.c b/test/tmeta.c index 5651da9..07c67bc 100644 --- a/test/tmeta.c +++ b/test/tmeta.c @@ -82,8 +82,7 @@ test_metadata(void) for (u = 0; u < sizeof(compar_buffer); u++) { if (compar_buffer[u] != encode_buffer[u]) { - print_func("Error encoding meta-data at offset %u, wanted: %u, got: %u\n", (unsigned) u, (unsigned) compar_buffer[u], (unsigned) encode_buffer[u]); - num_errs++; + TestErrPrintf("Error encoding meta-data at offset %u, wanted: %u, got: %u\n", (unsigned) u, (unsigned) compar_buffer[u], (unsigned) encode_buffer[u]); } /* end if */ } /* end for */ } /* end if */ @@ -96,28 +95,24 @@ test_metadata(void) /* Check the values decoded */ if (di16 != TEST_INT16_VALUE) { - print_func("Error decoding int16 meta-data wanted: %d, got: %d " + TestErrPrintf("Error decoding int16 meta-data wanted: %d, got: %d " "at %s:%d\n", (int) TEST_INT16_VALUE, (int) di16, __FILE__, __LINE__); - num_errs++; } /* end if */ if (du16 != TEST_UINT16_VALUE) { - print_func("Error decoding uint16 meta-data wanted: %u, got: %u " + TestErrPrintf("Error decoding uint16 meta-data wanted: %u, got: %u " "at %s:%d\n", (unsigned) TEST_UINT16_VALUE, (unsigned) du16, __FILE__, __LINE__); - num_errs++; } /* end if */ if (di32 != TEST_INT32_VALUE) { - print_func("Error decoding int32 meta-data wanted: %ld, got: %ld " + TestErrPrintf("Error decoding int32 meta-data wanted: %ld, got: %ld " "at %s:%d\n", (long) TEST_INT32_VALUE, (long) di32, __FILE__, __LINE__); - num_errs++; } /* end if */ if (du32 != TEST_UINT32_VALUE) { - print_func("Error decoding uint32 meta-data wanted: %lu, got: %lu " + TestErrPrintf("Error decoding uint32 meta-data wanted: %lu, got: %lu " "at %s:%d\n", (unsigned long) TEST_UINT32_VALUE, (unsigned long) du32, __FILE__, __LINE__); - num_errs++; } /* end if */ } /* test_metadata() */ diff --git a/test/tmisc.c b/test/tmisc.c index 8886420..05a5ccd 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -573,12 +573,10 @@ test_misc4(void) /* Verify that the fileno values are not the same between file1 & file2 */ if(stat1.fileno[0]==stat3.fileno[0] && stat1.fileno[1]==stat3.fileno[1]) { - num_errs++; - printf("Error on line %d: stat1.fileno==stat3.fileno\n",__LINE__); + TestErrPrintf("Error on line %d: stat1.fileno==stat3.fileno\n",__LINE__); } /* end if */ if(stat2.fileno[0]==stat3.fileno[0] && stat2.fileno[1]==stat3.fileno[1]) { - num_errs++; - printf("Error on line %d: stat1.fileno==stat3.fileno\n",__LINE__); + TestErrPrintf("Error on line %d: stat1.fileno==stat3.fileno\n",__LINE__); } /* end if */ /* Close the objects */ @@ -1407,8 +1405,7 @@ test_misc8(void) for(u=0; u<MISC8_DIM0; u++) for(v=0; v<MISC8_DIM1; v++,tdata++,tdata2++) if(*tdata!=*tdata2) { - num_errs++; - printf("Error on line %d: u=%u, v=%d, *tdata=%d, *tdata2=%d\n",__LINE__,(unsigned)u,(unsigned)v,(int)*tdata,(int)*tdata2); + TestErrPrintf("Error on line %d: u=%u, v=%d, *tdata=%d, *tdata2=%d\n",__LINE__,(unsigned)u,(unsigned)v,(int)*tdata,(int)*tdata2); } #endif /* VERIFY_DATA */ @@ -1445,13 +1442,11 @@ test_misc8(void) CHECK(storage_size, 0, "H5Dget_storage_size"); #ifdef H5_HAVE_FILTER_DEFLATE if(storage_size>=(MISC8_DIM0*MISC8_DIM1*H5Tget_size(H5T_NATIVE_INT))) { - num_errs++; - printf("Error on line %d: data wasn't compressed! storage_size=%u\n",__LINE__,(unsigned)storage_size); + TestErrPrintf("Error on line %d: data wasn't compressed! storage_size=%u\n",__LINE__,(unsigned)storage_size); } #else /* Compression is not configured */ if(storage_size!=(MISC8_DIM0*MISC8_DIM1*H5Tget_size(H5T_NATIVE_INT))) { - num_errs++; - printf("Error on line %d: wrong storage size! storage_size=%u\n",__LINE__,(unsigned)storage_size); + TestErrPrintf("Error on line %d: wrong storage size! storage_size=%u\n",__LINE__,(unsigned)storage_size); } #endif /* H5_HAVE_FILTER_DEFLATE */ @@ -1481,13 +1476,11 @@ test_misc8(void) CHECK(storage_size, 0, "H5Dget_storage_size"); #ifdef H5_HAVE_FILTER_DEFLATE if(storage_size>=(MISC8_DIM0*MISC8_DIM1*H5Tget_size(H5T_NATIVE_INT))) { - num_errs++; - printf("Error on line %d: data wasn't compressed! storage_size=%u\n",__LINE__,(unsigned)storage_size); + TestErrPrintf("Error on line %d: data wasn't compressed! storage_size=%u\n",__LINE__,(unsigned)storage_size); } #else /* Compression is not configured */ if(storage_size!=(MISC8_DIM0*MISC8_DIM1*H5Tget_size(H5T_NATIVE_INT))) { - num_errs++; - printf("Error on line %d: wrong storage size! storage_size=%u\n",__LINE__,(unsigned)storage_size); + TestErrPrintf("Error on line %d: wrong storage size! storage_size=%u\n",__LINE__,(unsigned)storage_size); } #endif /* H5_HAVE_FILTER_DEFLATE */ @@ -1506,8 +1499,7 @@ test_misc8(void) for(u=0; u<MISC8_DIM0; u++) for(v=0; v<MISC8_DIM1; v++,tdata++,tdata2++) if(*tdata!=*tdata2) { - num_errs++; - printf("Error on line %d: u=%u, v=%d, *tdata=%d, *tdata2=%d\n",__LINE__,(unsigned)u,(unsigned)v,(int)*tdata,(int)*tdata2); + TestErrPrintf("Error on line %d: u=%u, v=%d, *tdata=%d, *tdata2=%d\n",__LINE__,(unsigned)u,(unsigned)v,(int)*tdata,(int)*tdata2); } #endif /* VERIFY_DATA */ @@ -1516,13 +1508,11 @@ test_misc8(void) CHECK(storage_size, 0, "H5Dget_storage_size"); #ifdef H5_HAVE_FILTER_DEFLATE if(storage_size>=(MISC8_DIM0*MISC8_DIM1*H5Tget_size(H5T_NATIVE_INT))) { - num_errs++; - printf("Error on line %d: data wasn't compressed! storage_size=%u\n",__LINE__,(unsigned)storage_size); + TestErrPrintf("Error on line %d: data wasn't compressed! storage_size=%u\n",__LINE__,(unsigned)storage_size); } #else if(storage_size!=(MISC8_DIM0*MISC8_DIM1*H5Tget_size(H5T_NATIVE_INT))) { - num_errs++; - printf("Error on line %d: wrong storage size! storage_size=%u\n",__LINE__,(unsigned)storage_size); + TestErrPrintf("Error on line %d: wrong storage size! storage_size=%u\n",__LINE__,(unsigned)storage_size); } #endif /*H5_HAVE_FILTER_DEFLATE*/ @@ -1551,13 +1541,11 @@ test_misc8(void) CHECK(storage_size, 0, "H5Dget_storage_size"); #ifdef H5_HAVE_FILTER_DEFLATE if(storage_size>=(4*MISC8_CHUNK_DIM0*MISC8_CHUNK_DIM1*H5Tget_size(H5T_NATIVE_INT))) { - num_errs++; - printf("Error on line %d: data wasn't compressed! storage_size=%u\n",__LINE__,(unsigned)storage_size); + TestErrPrintf("Error on line %d: data wasn't compressed! storage_size=%u\n",__LINE__,(unsigned)storage_size); } #else /* Compression is not configured */ if(storage_size!=(4*MISC8_CHUNK_DIM0*MISC8_CHUNK_DIM1*H5Tget_size(H5T_NATIVE_INT))) { - num_errs++; - printf("Error on line %d: wrong storage size! storage_size=%u\n",__LINE__,(unsigned)storage_size); + TestErrPrintf("Error on line %d: wrong storage size! storage_size=%u\n",__LINE__,(unsigned)storage_size); } #endif /* H5_HAVE_FILTER_DEFLATE */ @@ -1576,8 +1564,7 @@ test_misc8(void) for(u=0; u<MISC8_DIM0; u++) for(v=0; v<MISC8_DIM1; v++,tdata++,tdata2++) if(*tdata!=*tdata2) { - num_errs++; - printf("Error on line %d: u=%u, v=%d, *tdata=%d, *tdata2=%d\n",__LINE__,(unsigned)u,(unsigned)v,(int)*tdata,(int)*tdata2); + TestErrPrintf("Error on line %d: u=%u, v=%d, *tdata=%d, *tdata2=%d\n",__LINE__,(unsigned)u,(unsigned)v,(int)*tdata,(int)*tdata2); } #endif /* VERIFY_DATA */ @@ -1586,13 +1573,11 @@ test_misc8(void) CHECK(storage_size, 0, "H5Dget_storage_size"); #ifdef H5_HAVE_FILTER_DEFLATE if(storage_size>=(MISC8_DIM0*MISC8_DIM1*H5Tget_size(H5T_NATIVE_INT))) { - num_errs++; - printf("Error on line %d: data wasn't compressed! storage_size=%u\n",__LINE__,(unsigned)storage_size); + TestErrPrintf("Error on line %d: data wasn't compressed! storage_size=%u\n",__LINE__,(unsigned)storage_size); } #else if(storage_size!=(MISC8_DIM0*MISC8_DIM1*H5Tget_size(H5T_NATIVE_INT))) { - num_errs++; - printf("Error on line %d: wrong storage size! storage_size=%u\n",__LINE__,(unsigned)storage_size); + TestErrPrintf("Error on line %d: wrong storage size! storage_size=%u\n",__LINE__,(unsigned)storage_size); } #endif /*H5_HAVE_FILTER_DEFLATE*/ @@ -1976,13 +1961,11 @@ test_misc12(void) for(i=0; i<MISC12_SPACE1_DIM1; i++) if(HDstrcmp(wdata[i],rdata[i])) { - num_errs++; - printf("Error on line %d: wdata[%d]=%s, rdata[%d]=%s\n",__LINE__,i,wdata[i],i,rdata[i]); + TestErrPrintf("Error on line %d: wdata[%d]=%s, rdata[%d]=%s\n",__LINE__,i,wdata[i],i,rdata[i]); } /* end if */ for(; i<(MISC12_SPACE1_DIM1+MISC12_APPEND_SIZE); i++) if(HDstrcmp(wdata1[i-MISC12_SPACE1_DIM1],rdata[i])) { - num_errs++; - printf("Error on line %d: wdata1[%d]=%s, rdata[%d]=%s\n",__LINE__,i-MISC12_SPACE1_DIM1,wdata1[i-MISC12_SPACE1_DIM1],i,rdata[i]); + TestErrPrintf("Error on line %d: wdata1[%d]=%s, rdata[%d]=%s\n",__LINE__,i-MISC12_SPACE1_DIM1,wdata1[i-MISC12_SPACE1_DIM1],i,rdata[i]); } /* end if */ /* Reclaim VL data memory */ @@ -2422,8 +2405,7 @@ test_misc14(void) ret = H5Dread(Dataset1, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata); CHECK(ret, FAIL, "H5Dread"); if(rdata!=data1) { - num_errs++; - printf("Error on line %d: data1!=rdata\n",__LINE__); + TestErrPrintf("Error on line %d: data1!=rdata\n",__LINE__); } /* end if */ /* Unlink second dataset */ @@ -2438,8 +2420,7 @@ test_misc14(void) ret = H5Dread(Dataset1, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata); CHECK(ret, FAIL, "H5Dread"); if(rdata!=data1) { - num_errs++; - printf("Error on line %d: data1!=rdata\n",__LINE__); + TestErrPrintf("Error on line %d: data1!=rdata\n",__LINE__); } /* end if */ /* Close first dataset */ @@ -2474,8 +2455,7 @@ test_misc14(void) ret = H5Dread(Dataset2, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata); CHECK(ret, FAIL, "H5Dread"); if(rdata!=data2) { - num_errs++; - printf("Error on line %d: data2!=rdata\n",__LINE__); + TestErrPrintf("Error on line %d: data2!=rdata\n",__LINE__); } /* end if */ /* Unlink first dataset */ @@ -2490,8 +2470,7 @@ test_misc14(void) ret = H5Dread(Dataset2, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata); CHECK(ret, FAIL, "H5Dread"); if(rdata!=data2) { - num_errs++; - printf("Error on line %d: data2!=rdata\n",__LINE__); + TestErrPrintf("Error on line %d: data2!=rdata\n",__LINE__); } /* end if */ /* Close second dataset */ @@ -2533,16 +2512,14 @@ test_misc14(void) ret = H5Dread(Dataset1, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata); CHECK(ret, FAIL, "H5Dread"); if(rdata!=data1) { - num_errs++; - printf("Error on line %d: data1!=rdata\n",__LINE__); + TestErrPrintf("Error on line %d: data1!=rdata\n",__LINE__); } /* end if */ /* Check data from third dataset */ ret = H5Dread(Dataset3, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata); CHECK(ret, FAIL, "H5Dread"); if(rdata!=data3) { - num_errs++; - printf("Error on line %d: data3!=rdata\n",__LINE__); + TestErrPrintf("Error on line %d: data3!=rdata\n",__LINE__); } /* end if */ /* Unlink second dataset */ @@ -2557,16 +2534,14 @@ test_misc14(void) ret = H5Dread(Dataset1, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata); CHECK(ret, FAIL, "H5Dread"); if(rdata!=data1) { - num_errs++; - printf("Error on line %d: data1!=rdata\n",__LINE__); + TestErrPrintf("Error on line %d: data1!=rdata\n",__LINE__); } /* end if */ /* Verify the data from dataset #3 */ ret = H5Dread(Dataset3, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata); CHECK(ret, FAIL, "H5Dread"); if(rdata!=data3) { - num_errs++; - printf("Error on line %d: data3!=rdata\n",__LINE__); + TestErrPrintf("Error on line %d: data3!=rdata\n",__LINE__); } /* end if */ /* Close first dataset */ @@ -2694,13 +2669,11 @@ test_misc16(void) /* Compare data read in */ for(i=0; i<MISC16_SPACE_DIM; i++) { if(strlen(wdata[i])!=strlen(rdata[i])) { - num_errs++; - printf("VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",(int)i,(int)strlen(wdata[i]),(int)i,(int)strlen(rdata[i])); + TestErrPrintf("VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",(int)i,(int)strlen(wdata[i]),(int)i,(int)strlen(rdata[i])); continue; } /* end if */ if( strcmp(wdata[i],rdata[i]) != 0 ) { - num_errs++; - printf("VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n",(int)i,wdata[i],(int)i,rdata[i]); + TestErrPrintf("VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n",(int)i,wdata[i],(int)i,rdata[i]); continue; } /* end if */ } /* end for */ @@ -2772,13 +2745,11 @@ test_misc17(void) /* Compare data in the way of strings. */ for(i=0; i<MISC17_SPACE_DIM1; i++) { if(strlen(wdata[i])!=strlen(rdata[i])) { - num_errs++; - printf("VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",(int)i,(int)strlen(wdata[i]),(int)i,(int)strlen(rdata[i])); + TestErrPrintf("VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",(int)i,(int)strlen(wdata[i]),(int)i,(int)strlen(rdata[i])); continue; } /* end if */ if( strcmp(wdata[i],rdata[i]) != 0 ) { - num_errs++; - printf("VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n",(int)i,wdata[i],(int)i,rdata[i]); + TestErrPrintf("VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n",(int)i,wdata[i],(int)i,rdata[i]); continue; } /* end if */ } /* end for */ diff --git a/test/trefer.c b/test/trefer.c index 7a94d62..f911a32 100644 --- a/test/trefer.c +++ b/test/trefer.c @@ -263,8 +263,7 @@ test_reference_obj(void) /* Check for correct comment value */ if(HDstrcmp(write_comment,read_comment)!=0) { - num_errs++; - MESSAGE(0, ("Error! Incorrect group comment, wanted: %s, got: %s",write_comment,read_comment)); + TestErrPrintf("Error! Incorrect group comment, wanted: %s, got: %s\n",write_comment,read_comment); } /* Close group */ diff --git a/test/trefstr.c b/test/trefstr.c index 5ba0371..2ca8839 100644 --- a/test/trefstr.c +++ b/test/trefstr.c @@ -208,8 +208,7 @@ test_refstr_cmp(void) VERIFY(cmp, 0, "H5RS_cmp"); cmp=H5RS_cmp(rs1,rs2); if(cmp>=0) { - num_errs++; - printf("%d: string comparison incorrect!\n",__LINE__); + TestErrPrintf("%d: string comparison incorrect!\n",__LINE__); } /* end if */ /* Check the lengths of the strings also */ @@ -271,8 +270,7 @@ test_refstr_wrap(void) CHECK(s, buf, "wrapping"); cmp=HDstrcmp(s,buf); if(cmp<=0) { - num_errs++; - printf("%d: string comparison incorrect!\n",__LINE__); + TestErrPrintf("%d: string comparison incorrect!\n",__LINE__); } /* end if */ /* Decrement reference count for string */ diff --git a/test/tselect.c b/test/tselect.c index 5c913d3..9dc4261 100644 --- a/test/tselect.c +++ b/test/tselect.c @@ -934,8 +934,7 @@ test_select_combo(void) tbuf=wbuf+i; tbuf2=rbuf+(i*SPACE3_DIM2); if(*tbuf!=*tbuf2) { - num_errs++; - printf("element values don't match!, i=%d\n",i); + TestErrPrintf("element values don't match!, i=%d\n",i); } /* end if */ } /* end for */ @@ -1099,8 +1098,7 @@ test_select_hyper_stride(hid_t xfer_plist) if(*tbuf!=*tbuf2) { printf("%d: hyperslab values don't match!, loc1[%d]=%d, loc2[%d]=%d\n",__LINE__,i,(int)loc1[i],i,(int)loc2[i]); printf("wbuf=%p, tbuf=%p, rbuf=%p, tbuf2=%p\n",(void *)wbuf,(void *)tbuf,(void *)rbuf,(void *)tbuf2); - printf("*tbuf=%u, *tbuf2=%u\n",(unsigned)*tbuf,(unsigned)*tbuf2); - num_errs++; + TestErrPrintf("*tbuf=%u, *tbuf2=%u\n",(unsigned)*tbuf,(unsigned)*tbuf2); } /* end if */ } /* end for */ @@ -1225,8 +1223,7 @@ test_select_hyper_contig(hid_t dset_type, hid_t xfer_plist) /* Compare data read with data written out */ if(HDmemcmp(rbuf,wbuf,sizeof(uint16_t)*30*12)) { - printf("hyperslab values don't match! Line=%d\n",__LINE__); - num_errs++; + TestErrPrintf("hyperslab values don't match! Line=%d\n",__LINE__); #ifdef QAK for(i=0, tbuf=wbuf; i<12; i++) for(j=0; j<30; j++) @@ -1347,8 +1344,7 @@ test_select_hyper_contig2(hid_t dset_type, hid_t xfer_plist) /* Compare data read with data written out */ if(HDmemcmp(rbuf,wbuf,sizeof(uint16_t)*2*SPACE8_DIM3*SPACE8_DIM2*SPACE8_DIM1)) { - num_errs++; - printf("Error: hyperslab values don't match!\n"); + TestErrPrintf("Error: hyperslab values don't match!\n"); #ifdef QAK for(i=0, tbuf=wbuf; i<12; i++) for(j=0; j<30; j++) @@ -1480,16 +1476,14 @@ test_select_hyper_contig3(hid_t dset_type, hid_t xfer_plist) (k>=start[2] && k<(int)(start[2]+count[2])) && (l>=start[3] && l<(int)(start[3]+count[3])) ) { if(*tbuf!=*tbuf2) { - num_errs++; printf("Error: hyperslab values don't match!\n"); - printf("Line: %d, i=%d, j=%d, k=%d, l=%d, *tbuf=%u,*tbuf2=%u\n",__LINE__,i,j,k,l,(unsigned)*tbuf,(unsigned)*tbuf2); + TestErrPrintf("Line: %d, i=%d, j=%d, k=%d, l=%d, *tbuf=%u,*tbuf2=%u\n",__LINE__,i,j,k,l,(unsigned)*tbuf,(unsigned)*tbuf2); } /* end if */ } /* end if */ else { if(*tbuf2!=0) { - num_errs++; printf("Error: invalid data in read buffer!\n"); - printf("Line: %d, i=%d, j=%d, k=%d, l=%d, *tbuf=%u,*tbuf2=%u\n",__LINE__,i,j,k,l,(unsigned)*tbuf,(unsigned)*tbuf2); + TestErrPrintf("Line: %d, i=%d, j=%d, k=%d, l=%d, *tbuf=%u,*tbuf2=%u\n",__LINE__,i,j,k,l,(unsigned)*tbuf,(unsigned)*tbuf2); } /* end if */ } /* end else */ @@ -1633,8 +1627,7 @@ test_select_hyper_copy(void) /* Compare data read with data written out */ if(HDmemcmp(rbuf,rbuf2,sizeof(uint16_t)*SPACE3_DIM1*SPACE3_DIM2)) { - printf("hyperslab values don't match! Line=%d\n",__LINE__); - num_errs++; + TestErrPrintf("hyperslab values don't match! Line=%d\n",__LINE__); #ifdef QAK for(i=0; i<SPACE3_DIM1; i++) for(j=0; j<SPACE3_DIM2; j++) @@ -1809,8 +1802,7 @@ test_select_point_copy(void) /* Compare data read with data written out */ if(HDmemcmp(rbuf,rbuf2,sizeof(uint16_t)*SPACE3_DIM1*SPACE3_DIM2)) { - printf("point values don't match!\n"); - num_errs++; + TestErrPrintf("point values don't match!\n"); } /* end if */ /* Close memory dataspace */ @@ -1978,8 +1970,7 @@ test_select_hyper_offset(void) tbuf2=rbuf+(i*SPACE3_DIM2); for(j=0; j<SPACE3_DIM2; j++, tbuf++, tbuf2++) { if(*tbuf!=*tbuf2) { - printf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%u, *tbuf2=%u\n",__LINE__,i,j,(unsigned)*tbuf,(unsigned)*tbuf2); - num_errs++; + TestErrPrintf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%u, *tbuf2=%u\n",__LINE__,i,j,(unsigned)*tbuf,(unsigned)*tbuf2); } /* end if */ } /* end for */ } /* end for */ @@ -2097,8 +2088,7 @@ test_select_hyper_offset2(void) tbuf2=rbuf+((i+3)*SPACE7_DIM2); for(j=0; j<SPACE7_DIM2; j++, tbuf++, tbuf2++) { if(*tbuf!=*tbuf2) { - printf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%u, *tbuf2=%u\n",__LINE__,i,j,(unsigned)*tbuf,(unsigned)*tbuf2); - num_errs++; + TestErrPrintf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%u, *tbuf2=%u\n",__LINE__,i,j,(unsigned)*tbuf,(unsigned)*tbuf2); } /* end if */ } /* end for */ } /* end for */ @@ -2270,8 +2260,7 @@ test_select_point_offset(void) tbuf=wbuf+((coord2[i][0]+offset[0])*SPACE2_DIM2)+coord2[i][1]+offset[1]; tbuf2=rbuf+(coord3[i][0]*SPACE3_DIM2)+coord3[i][1]; if(*tbuf!=*tbuf2) { - printf("element values don't match!, i=%d\n",i); - num_errs++; + TestErrPrintf("element values don't match!, i=%d\n",i); } /* end if */ } /* end for */ @@ -2419,8 +2408,7 @@ test_select_hyper_union(void) tbuf2=rbuf+(i*SPACE3_DIM2); for(j=0; j<SPACE3_DIM2; j++, tbuf++, tbuf2++) { if(*tbuf!=*tbuf2) { - printf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%d, *tbuf2=%d\n",__LINE__,i,j,(int)*tbuf,(int)*tbuf2); - num_errs++; + TestErrPrintf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%d, *tbuf2=%d\n",__LINE__,i,j,(int)*tbuf,(int)*tbuf2); } /* end if */ } /* end for */ } /* end for */ @@ -2514,8 +2502,7 @@ test_select_hyper_union(void) tbuf2=rbuf+(i*SPACE3_DIM2); for(j=0; j<SPACE3_DIM2; j++, tbuf++, tbuf2++) { if(*tbuf!=*tbuf2) { - printf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%d, *tbuf2=%d\n",__LINE__,i,j,(int)*tbuf,(int)*tbuf2); - num_errs++; + TestErrPrintf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%d, *tbuf2=%d\n",__LINE__,i,j,(int)*tbuf,(int)*tbuf2); } /* end if */ } /* end for */ } /* end for */ @@ -2605,8 +2592,7 @@ test_select_hyper_union(void) tbuf2=rbuf+(i*SPACE3_DIM2); for(j=0; j<SPACE3_DIM2; j++, tbuf++, tbuf2++) { if(*tbuf!=*tbuf2) { - printf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%d, *tbuf2=%d\n",__LINE__,i,j,(int)*tbuf,(int)*tbuf2); - num_errs++; + TestErrPrintf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%d, *tbuf2=%d\n",__LINE__,i,j,(int)*tbuf,(int)*tbuf2); } /* end if */ } /* end for */ } /* end for */ @@ -2709,8 +2695,7 @@ test_select_hyper_union(void) tbuf2=rbuf+(i*SPACE3_DIM2); for(j=0; j<SPACE3_DIM2; j++, tbuf++, tbuf2++) { if(*tbuf!=*tbuf2) { - printf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%d, *tbuf2=%d\n",__LINE__,i,j,(int)*tbuf,(int)*tbuf2); - num_errs++; + TestErrPrintf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%d, *tbuf2=%d\n",__LINE__,i,j,(int)*tbuf,(int)*tbuf2); } /* end if */ } /* end for */ } /* end for */ @@ -2795,8 +2780,7 @@ test_select_hyper_union(void) tbuf=wbuf+(i*SPACE2_DIM2)+begin[i]; for(j=0; j<(int)len[i]; j++, tbuf++, tbuf2++) { if(*tbuf!=*tbuf2) { - printf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%d, *tbuf2=%d\n",__LINE__,i,j,(int)*tbuf,(int)*tbuf2); - num_errs++; + TestErrPrintf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%d, *tbuf2=%d\n",__LINE__,i,j,(int)*tbuf,(int)*tbuf2); } /* end if */ } /* end for */ } /* end for */ @@ -2953,8 +2937,7 @@ test_select_hyper_union_stagger(void) printf("input_loc=[%d][%d]\n",input_loc[i][0],input_loc[i][1]); printf("output_loc=[%d][%d]\n",output_loc[i][0],output_loc[i][1]); printf("data=%d\n",data[input_loc[i][0]][input_loc[i][1]]); - printf("data_out=%d\n",data_out[output_loc[i][0]][output_loc[i][1]]); - num_errs++; + TestErrPrintf("data_out=%d\n",data_out[output_loc[i][0]][output_loc[i][1]]); } /* end if */ } /* end for */ @@ -3153,8 +3136,7 @@ test_select_hyper_union_3d(void) tbuf=wbuf+(rows[i].z*SPACE4_DIM3*SPACE4_DIM2)+(rows[i].y*SPACE4_DIM3)+rows[i].x; for(j=0; j<(int)rows[i].l; j++, tbuf++, tbuf2++) { if(*tbuf!=*tbuf2) { - printf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%d, *tbuf2=%d\n",__LINE__,i,j,(int)*tbuf,(int)*tbuf2); - num_errs++; + TestErrPrintf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%d, *tbuf2=%d\n",__LINE__,i,j,(int)*tbuf,(int)*tbuf2); } /* end if */ } /* end for */ } /* end for */ @@ -3702,8 +3684,7 @@ test_select_hyper_iter2(void *_elem, hid_t UNUSED type_id, hsize_t ndim, hssize_ unsigned u; /* Local counting variable */ if(*tbuf!=**tbuf2) { - num_errs++; - printf("Error in hyperslab iteration!\n"); + TestErrPrintf("Error in hyperslab iteration!\n"); printf("location: { "); for(u=0; u<(unsigned)ndim; u++) { printf("%2d",(int)point[u]); @@ -3873,8 +3854,7 @@ printf("random I/O, after H5Dread()\n"); tbuf=rbuf; ret = H5Diterate(wbuf,H5T_NATIVE_INT,sid1,test_select_hyper_iter2,&tbuf); if(ret<0) { - num_errs++; - printf("Random hyperslabs for seed %u failed!\n",seed); + TestErrPrintf("Random hyperslabs for seed %u failed!\n",seed); break; } @@ -4115,8 +4095,7 @@ test_select_hyper_chunk(hid_t fapl_plist, hid_t xfer_plist) for (i = 0; i < Y; i++) for (k = 0; k < Z; k++,tmpdata++,tmpdata_out++) { if(*tmpdata!=*tmpdata_out) { - num_errs++; - printf("Line %d: Error! j=%d, i=%d, k=%d, *tmpdata=%x, *tmpdata_out=%x\n",__LINE__,j,i,k,(unsigned)*tmpdata,(unsigned)*tmpdata_out); + TestErrPrintf("Line %d: Error! j=%d, i=%d, k=%d, *tmpdata=%x, *tmpdata_out=%x\n",__LINE__,j,i,k,(unsigned)*tmpdata,(unsigned)*tmpdata_out); } /* end if */ } /* end for */ @@ -4939,8 +4918,7 @@ test_select_fill_all(void) for(i=0, tbuf=wbuf; i<SPACE7_DIM1; i++) for(j=0; j<SPACE7_DIM2; j++) if(*tbuf!=(unsigned short)fill_value) { - num_errs++; - printf("Error! j=%d, i=%d, *tbuf=%x, fill_value=%x\n",j,i,(unsigned)*tbuf,(unsigned)fill_value); + TestErrPrintf("Error! j=%d, i=%d, *tbuf=%x, fill_value=%x\n",j,i,(unsigned)*tbuf,(unsigned)fill_value); } /* end if */ /* Set the coordinates of the selection */ @@ -5030,15 +5008,13 @@ test_select_fill_point(hssize_t *offset) for(k=0; k<(int)num_points; k++) { if(i==(points[k][0]+real_offset[0]) && j==(points[k][1]+real_offset[1])) { if(*tbuf!=(unsigned short)fill_value) { - num_errs++; - printf("Error! j=%d, i=%d, *tbuf=%u, fill_value=%u\n",j,i,(unsigned)*tbuf,(unsigned)fill_value); + TestErrPrintf("Error! j=%d, i=%d, *tbuf=%u, fill_value=%u\n",j,i,(unsigned)*tbuf,(unsigned)fill_value); } /* end if */ break; } /* end if */ } /* end for */ if(k==(int)num_points && *tbuf!=((unsigned short)(i*SPACE7_DIM2)+j)) { - num_errs++; - printf("Error! j=%d, i=%d, *tbuf=%u, should be: %u\n",j,i,(unsigned)*tbuf,(unsigned)((i*SPACE7_DIM2)+j)); + TestErrPrintf("Error! j=%d, i=%d, *tbuf=%u, should be: %u\n",j,i,(unsigned)*tbuf,(unsigned)((i*SPACE7_DIM2)+j)); } /* end if */ } /* end for */ @@ -5132,14 +5108,12 @@ test_select_fill_hyper_simple(hssize_t *offset) if((i>=(int)(start[0]+real_offset[0]) && i<(int)(start[0]+count[0]+real_offset[0])) && (j>=(int)(start[1]+real_offset[1]) && j<(int)(start[1]+count[1]+real_offset[1]))) { if(*tbuf!=(unsigned short)fill_value) { - num_errs++; - printf("Error! j=%d, i=%d, *tbuf=%u, fill_value=%u\n",j,i,(unsigned)*tbuf,(unsigned)fill_value); + TestErrPrintf("Error! j=%d, i=%d, *tbuf=%u, fill_value=%u\n",j,i,(unsigned)*tbuf,(unsigned)fill_value); } /* end if */ } /* end if */ else { if(*tbuf!=((unsigned short)(i*SPACE7_DIM2)+j)) { - num_errs++; - printf("Error! j=%d, i=%d, *tbuf=%u, should be: %u\n",j,i,(unsigned)*tbuf,(unsigned)((i*SPACE7_DIM2)+j)); + TestErrPrintf("Error! j=%d, i=%d, *tbuf=%u, should be: %u\n",j,i,(unsigned)*tbuf,(unsigned)((i*SPACE7_DIM2)+j)); } /* end if */ } /* end else */ } /* end for */ @@ -5244,15 +5218,13 @@ test_select_fill_hyper_regular(hssize_t *offset) for(k=0; k<(int)num_points; k++) { if(i==(points[k][0]+real_offset[0]) && j==(points[k][1]+real_offset[1])) { if(*tbuf!=(unsigned short)fill_value) { - num_errs++; - printf("Error! j=%d, i=%d, *tbuf=%u, fill_value=%u\n",j,i,(unsigned)*tbuf,(unsigned)fill_value); + TestErrPrintf("Error! j=%d, i=%d, *tbuf=%u, fill_value=%u\n",j,i,(unsigned)*tbuf,(unsigned)fill_value); } /* end if */ break; } /* end if */ } /* end for */ if(k==(int)num_points && *tbuf!=((unsigned short)(i*SPACE7_DIM2)+j)) { - num_errs++; - printf("Error! j=%d, i=%d, *tbuf=%u, should be: %u\n",j,i,(unsigned)*tbuf,(unsigned)((i*SPACE7_DIM2)+j)); + TestErrPrintf("Error! j=%d, i=%d, *tbuf=%u, should be: %u\n",j,i,(unsigned)*tbuf,(unsigned)((i*SPACE7_DIM2)+j)); } /* end if */ } /* end for */ @@ -5370,15 +5342,13 @@ test_select_fill_hyper_irregular(hssize_t *offset) for(k=0; k<(int)num_points; k++) { if(i==(points[k][0]+real_offset[0]) && j==(points[k][1]+real_offset[1])) { if(*tbuf!=(unsigned short)fill_value) { - num_errs++; - printf("Error! j=%d, i=%d, *tbuf=%u, fill_value=%u\n",j,i,(unsigned)*tbuf,(unsigned)fill_value); + TestErrPrintf("Error! j=%d, i=%d, *tbuf=%u, fill_value=%u\n",j,i,(unsigned)*tbuf,(unsigned)fill_value); } /* end if */ break; } /* end if */ } /* end for */ if(k==(int)num_points && *tbuf!=((unsigned short)(i*SPACE7_DIM2)+j)) { - num_errs++; - printf("Error! j=%d, i=%d, *tbuf=%u, should be: %u\n",j,i,(unsigned)*tbuf,(unsigned)((i*SPACE7_DIM2)+j)); + TestErrPrintf("Error! j=%d, i=%d, *tbuf=%u, should be: %u\n",j,i,(unsigned)*tbuf,(unsigned)((i*SPACE7_DIM2)+j)); } /* end if */ } /* end for */ @@ -5556,8 +5526,7 @@ test_scalar_select(void) /* Check value read back in */ if(rval_uint8!=*(wbuf_uint8+2)) { - printf("Error! rval=%u, should be: *(wbuf+2)=%u\n",(unsigned)rval_uint8,(unsigned)*(wbuf_uint8+2)); - num_errs++; + TestErrPrintf("Error! rval=%u, should be: *(wbuf+2)=%u\n",(unsigned)rval_uint8,(unsigned)*(wbuf_uint8+2)); } /* end if */ /* Write single point to disk (with a datatype conversion) */ @@ -5570,8 +5539,7 @@ test_scalar_select(void) /* Check value read back in */ if(rval_ushort!=*(wbuf_ushort+2)) { - printf("Error! rval=%u, should be: *(wbuf+2)=%u\n",(unsigned)rval_ushort,(unsigned)*(wbuf_ushort+2)); - num_errs++; + TestErrPrintf("Error! rval=%u, should be: *(wbuf+2)=%u\n",(unsigned)rval_ushort,(unsigned)*(wbuf_ushort+2)); } /* end if */ /* Select one element in memory with a hyperslab selection */ @@ -5590,8 +5558,7 @@ test_scalar_select(void) /* Check value read back in */ if(rval_uint8!=*(wbuf_uint8+(SPACE7_DIM2*4)+3)) { - printf("Error! rval=%u, should be: *(wbuf+(SPACE7_DIM2*4)+3)=%u\n",(unsigned)rval_uint8,(unsigned)*(wbuf_uint8+(SPACE7_DIM2*4)+3)); - num_errs++; + TestErrPrintf("Error! rval=%u, should be: *(wbuf+(SPACE7_DIM2*4)+3)=%u\n",(unsigned)rval_uint8,(unsigned)*(wbuf_uint8+(SPACE7_DIM2*4)+3)); } /* end if */ /* Write single hyperslab element to disk (with a datatype conversion) */ @@ -5604,8 +5571,7 @@ test_scalar_select(void) /* Check value read back in */ if(rval_ushort!=*(wbuf_ushort+(SPACE7_DIM2*4)+3)) { - printf("Error! rval=%u, should be: *(wbuf+(SPACE7_DIM2*4)+3)=%u\n",(unsigned)rval_ushort,(unsigned)*(wbuf_ushort+(SPACE7_DIM2*4)+3)); - num_errs++; + TestErrPrintf("Error! rval=%u, should be: *(wbuf+(SPACE7_DIM2*4)+3)=%u\n",(unsigned)rval_ushort,(unsigned)*(wbuf_ushort+(SPACE7_DIM2*4)+3)); } /* end if */ /* Select no elements in memory & file with "none" selections */ @@ -6674,8 +6640,7 @@ test_select_hyper_chunk_offset(void) for(i=0; i<SPACE10_DIM1; i+=SPACE10_CHUNK_SIZE) { for(j=0; j<SPACE10_CHUNK_SIZE; j++) { if(wbuf[i+j]!=rbuf[((SPACE10_DIM1-i)-SPACE10_CHUNK_SIZE)+j]) { - printf("Line: %d - Error! i=%d, j=%d, rbuf=%d, wbuf=%d\n",__LINE__,i,j,rbuf[((SPACE10_DIM1-i)-SPACE10_CHUNK_SIZE)+j],wbuf[i+j]); - num_errs++; + TestErrPrintf("Line: %d - Error! i=%d, j=%d, rbuf=%d, wbuf=%d\n",__LINE__,i,j,rbuf[((SPACE10_DIM1-i)-SPACE10_CHUNK_SIZE)+j],wbuf[i+j]); } /* end if */ } /* end for */ } /* end for */ @@ -6749,8 +6714,7 @@ test_select_hyper_chunk_offset(void) /* We're not writing out the "middle" of each chunk, so don't check that */ if(j<(SPACE10_CHUNK_SIZE/3) || j>=((2*SPACE10_CHUNK_SIZE)/3)) { if(wbuf[i+j]!=rbuf[((SPACE10_DIM1-i)-SPACE10_CHUNK_SIZE)+j]) { - printf("Line: %d - Error! i=%d, j=%d, rbuf=%d, wbuf=%d\n",__LINE__,i,j,rbuf[((SPACE10_DIM1-i)-SPACE10_CHUNK_SIZE)+j],wbuf[i+j]); - num_errs++; + TestErrPrintf("Line: %d - Error! i=%d, j=%d, rbuf=%d, wbuf=%d\n",__LINE__,i,j,rbuf[((SPACE10_DIM1-i)-SPACE10_CHUNK_SIZE)+j],wbuf[i+j]); } /* end if */ } /* end if */ } /* end for */ diff --git a/test/ttbbt.c b/test/ttbbt.c index dba49aa..780e3d3 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 (Verbosity > 9) + if (GetTestVerbosity() > 9) { 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(Verbosity>9) + if(GetTestVerbosity()>9) H5TB_dump(tree, -1); #endif /* H5TB_DEBUG */ } #ifdef H5TB_DEBUG - if(Verbosity>9) + if(GetTestVerbosity()>9) 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(Verbosity>9) + if(GetTestVerbosity()>9) H5TB_dump(tree, -1); #endif /* H5TB_DEBUG */ } /* end for */ diff --git a/test/ttime.c b/test/ttime.c index 98a0e0f..664fcdf 100644 --- a/test/ttime.c +++ b/test/ttime.c @@ -86,8 +86,7 @@ test_time_commit(void) CHECK(tid, FAIL, "H5Topen"); if(!H5Tequal(tid, H5T_UNIX_D32LE)) { - num_errs++; - MESSAGE(0, ("H5T_UNIX_D32LE datatype not found")); + TestErrPrintf("H5T_UNIX_D32LE datatype not found\n"); } /* end if */ status = H5Tclose (tid); @@ -97,8 +96,7 @@ test_time_commit(void) CHECK(tid, FAIL, "H5Topen"); if(!H5Tequal(tid, H5T_UNIX_D32BE)) { - num_errs++; - MESSAGE(0, ("H5T_UNIX_D32BE datatype not found")); + TestErrPrintf("H5T_UNIX_D32BE datatype not found\n"); } /* end if */ status = H5Tclose (tid); @@ -108,8 +106,7 @@ test_time_commit(void) CHECK(tid, FAIL, "H5Topen"); if(!H5Tequal(tid, H5T_UNIX_D64LE)) { - num_errs++; - MESSAGE(0, ("H5T_UNIX_D64LE datatype not found")); + TestErrPrintf("H5T_UNIX_D64LE datatype not found\n"); } /* end if */ status = H5Tclose (tid); @@ -119,8 +116,7 @@ test_time_commit(void) CHECK(tid, FAIL, "H5Topen"); if(!H5Tequal(tid, H5T_UNIX_D64BE)) { - num_errs++; - MESSAGE(0, ("H5T_UNIX_D64BE datatype not found")); + TestErrPrintf("H5T_UNIX_D64BE datatype not found\n"); } /* end if */ status = H5Tclose (tid); diff --git a/test/ttsafe.c b/test/ttsafe.c index afc84e6..041ceb0 100644 --- a/test/ttsafe.c +++ b/test/ttsafe.c @@ -31,17 +31,11 @@ * BUGS/LIMITATIONS * * EXPORTED ROUTINES/VARIABLES: - * Two variables are exported: num_errs, and Verbosity. + * */ -#if defined __MWERKS__ -#include <console.h> -#endif - #include "h5test.h" -#define HDF5_TEST_MASTER - /* ANY new test needs to have a prototype in ttsafe.h */ #include "ttsafe.h" @@ -119,6 +113,6 @@ int main(int argc, char *argv[]) if (CleanUp && !getenv("HDF5_NOCLEANUP")) TestCleanup(); - return num_errs; + return GetTestNumErrs(); } /* end main() */ #endif /*H5_HAVE_THREADSAFE*/ diff --git a/test/ttsafe_acreate.c b/test/ttsafe_acreate.c index ac981b0..d5ed7b7 100644 --- a/test/ttsafe_acreate.c +++ b/test/ttsafe_acreate.c @@ -127,17 +127,14 @@ void tts_acreate(void) attribute = H5Aopen_name(dataset,gen_name(i)); if (attribute < 0) { - fprintf(stderr, + TestErrPrintf( "unable to open appropriate attribute. " "Test failed!\n"); - num_errs++; } else { ret = H5Aread(attribute, H5T_NATIVE_INT, &buffer); if (ret < 0 || buffer != i) { - fprintf(stderr, - "wrong data values. Test failed!\n"); - num_errs++; + TestErrPrintf("wrong data values. Test failed!\n"); } H5Aclose(attribute); diff --git a/test/ttsafe_cancel.c b/test/ttsafe_cancel.c index 4247f07..dd1f74a 100644 --- a/test/ttsafe_cancel.c +++ b/test/ttsafe_cancel.c @@ -92,10 +92,8 @@ void tts_cancel(void) &buffer); if (buffer != 11) { - fprintf(stderr, - "operation unsuccessful with value at %d instead of 11\n", + TestErrPrintf("operation unsuccessful with value at %d instead of 11\n", buffer); - num_errs++; } H5Dclose(dataset); @@ -169,9 +167,8 @@ herr_t tts_cancel_callback(void *elem, hid_t UNUSED type_id, hsize_t UNUSED ndim sleep(3); if (value != 1) { - fprintf(stderr, "Error! Element value should be 1 and not %d\n", + TestErrPrintf("Error! Element value should be 1 and not %d\n", value); - num_errs++; return -1; } diff --git a/test/ttsafe_dcreate.c b/test/ttsafe_dcreate.c index b351994..f7552c6 100644 --- a/test/ttsafe_dcreate.c +++ b/test/ttsafe_dcreate.c @@ -129,20 +129,18 @@ void tts_dcreate(void) for (i = 0; i < NUM_THREAD; i++) { if ((dataset = H5Dopen(file,dsetname[i])) < 0) { - fprintf(stderr, "Dataset name not found - test failed\n"); + TestErrPrintf("Dataset name not found - test failed\n"); H5Fclose(file); - num_errs++; return; } else { ret=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &datavalue); assert(ret>=0); if (datavalue != i) { - fprintf(stderr, "Wrong value read %d for dataset name %s - test failed\n", + TestErrPrintf("Wrong value read %d for dataset name %s - test failed\n", datavalue, dsetname[i]); H5Dclose(dataset); H5Fclose(file); - num_errs++; return; } diff --git a/test/ttsafe_error.c b/test/ttsafe_error.c index ba1a394..4b3444e 100644 --- a/test/ttsafe_error.c +++ b/test/ttsafe_error.c @@ -119,24 +119,20 @@ void tts_error(void) pthread_join(threads[i],NULL); if (error_flag) { - fprintf(stderr, "Threads reporting different error values!\n"); - num_errs++; + TestErrPrintf("Threads reporting different error values!\n"); } if (error_count != NUM_THREAD - 1) { - fprintf(stderr, "Error: %d threads failed instead of %d\n", + TestErrPrintf("Error: %d threads failed instead of %d\n", error_count, NUM_THREAD-1); - num_errs++; } dataset = H5Dopen(error_file, DATASETNAME); H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &value); if (value != WRITE_NUMBER) { - fprintf(stderr, - "Error: Successful thread wrote value %d instead of %d\n", + TestErrPrintf("Error: Successful thread wrote value %d instead of %d\n", value, WRITE_NUMBER); - num_errs++; } H5Dclose(dataset); diff --git a/test/ttst.c b/test/ttst.c index 9632cb7..ca45d9b 100644 --- a/test/ttst.c +++ b/test/ttst.c @@ -209,16 +209,14 @@ test_tst_insert(void) CHECK(found, NULL, "H5ST_find"); if(HDstrcmp((const char *)found->eqkid,uniq_words[u])) { - num_errs++; - printf("%d: TST node values don't match!, found->eqkid=%s, uniq_words[%u]=%s\n",__LINE__,(char *)found->eqkid,(unsigned)u,uniq_words[u]); + TestErrPrintf("%d: TST node values don't match!, found->eqkid=%s, uniq_words[%u]=%s\n",__LINE__,(char *)found->eqkid,(unsigned)u,uniq_words[u]); } /* end if */ obj=H5ST_locate(tree,uniq_words[u]); CHECK(obj, NULL, "H5ST_locate"); if(HDstrcmp((const char *)obj,uniq_words[u])) { - num_errs++; - printf("%d: TST objects don't match!, obj=%s, uniq_words[%u]=%s\n",__LINE__,(char *)obj,(unsigned)u,uniq_words[u]); + TestErrPrintf("%d: TST objects don't match!, obj=%s, uniq_words[%u]=%s\n",__LINE__,(char *)obj,(unsigned)u,uniq_words[u]); } /* end if */ } /* end for */ @@ -269,8 +267,7 @@ test_tst_iterate(void) do { /* Check that the strings in the TST are in the correct order */ if(HDstrcmp((const char *)found->eqkid,sort_uniq_words[u])) { - num_errs++; - printf("%d: TST node values don't match!, found->eqkid=%s, sort_uniq_words[%u]=%s\n",__LINE__,(char *)found->eqkid,(unsigned)u,sort_uniq_words[u]); + TestErrPrintf("%d: TST node values don't match!, found->eqkid=%s, sort_uniq_words[%u]=%s\n",__LINE__,(char *)found->eqkid,(unsigned)u,sort_uniq_words[u]); } /* end if */ /* Advance to next string in TST */ @@ -319,8 +316,7 @@ test_tst_remove(void) /* Check that the correct string was removed from TST */ if(HDstrcmp((const char *)obj,rand_uniq_words[u])) { - num_errs++; - printf("%d: TST node values don't match!, obj=%s, rand_uniq_words[%u]=%s\n",__LINE__,(char *)obj,(unsigned)u,rand_uniq_words[u]); + TestErrPrintf("%d: TST node values don't match!, obj=%s, rand_uniq_words[%u]=%s\n",__LINE__,(char *)obj,(unsigned)u,rand_uniq_words[u]); } /* end if */ /* Check that the string can't be found in the TST any longer */ @@ -342,8 +338,7 @@ test_tst_remove(void) /* Check that the correct object will be removed from TST */ if(HDstrcmp((const char *)found->eqkid,rand_uniq_words[u])) { - num_errs++; - printf("%d: TST node values don't match!, found->eqkid=%s, rand_uniq_words[%u]=%s\n",__LINE__,(char *)found->eqkid,(unsigned)u,rand_uniq_words[u]); + TestErrPrintf("%d: TST node values don't match!, found->eqkid=%s, rand_uniq_words[%u]=%s\n",__LINE__,(char *)found->eqkid,(unsigned)u,rand_uniq_words[u]); } /* end if */ /* Remove the node */ diff --git a/test/tvlstr.c b/test/tvlstr.c index ef35267..f22f04d 100644 --- a/test/tvlstr.c +++ b/test/tvlstr.c @@ -206,13 +206,11 @@ test_vlstrings_basic(void) /* Compare data read in */ for(i=0; i<SPACE1_DIM1; i++) { if(strlen(wdata[i])!=strlen(rdata[i])) { - num_errs++; - printf("VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",(int)i,(int)strlen(wdata[i]),(int)i,(int)strlen(rdata[i])); + TestErrPrintf("VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",(int)i,(int)strlen(wdata[i]),(int)i,(int)strlen(rdata[i])); continue; } /* end if */ if( strcmp(wdata[i],rdata[i]) != 0 ) { - num_errs++; - printf("VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n",(int)i,wdata[i],(int)i,rdata[i]); + TestErrPrintf("VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n",(int)i,wdata[i],(int)i,rdata[i]); continue; } /* end if */ } /* end for */ @@ -297,8 +295,7 @@ test_vlstrings_special(void) /* Check data read in */ for(i=0; i<SPACE1_DIM1; i++) { if(rdata[i]!=NULL) { - num_errs++; - printf("VL doesn't match!, rdata[%d]=%p\n",(int)i,rdata[i]); + TestErrPrintf("VL doesn't match!, rdata[%d]=%p\n",(int)i,rdata[i]); } /* end if */ } /* end for */ @@ -313,13 +310,11 @@ test_vlstrings_special(void) /* Compare data read in */ for(i=0; i<SPACE1_DIM1; i++) { if(strlen(wdata[i])!=strlen(rdata[i])) { - num_errs++; - printf("VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",(int)i,(int)strlen(wdata[i]),(int)i,(int)strlen(rdata[i])); + TestErrPrintf("VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",(int)i,(int)strlen(wdata[i]),(int)i,(int)strlen(rdata[i])); continue; } /* end if */ if( strcmp(wdata[i],rdata[i]) != 0 ) { - num_errs++; - printf("VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n",(int)i,wdata[i],(int)i,rdata[i]); + TestErrPrintf("VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n",(int)i,wdata[i],(int)i,rdata[i]); continue; } /* end if */ } /* end for */ @@ -355,8 +350,7 @@ test_vlstrings_special(void) /* Check data read in */ for(i=0; i<SPACE1_DIM1; i++) { if(rdata[i]!=NULL) { - num_errs++; - printf("VL doesn't match!, rdata[%d]=%p\n",(int)i,rdata[i]); + TestErrPrintf("VL doesn't match!, rdata[%d]=%p\n",(int)i,rdata[i]); } /* end if */ } /* end for */ @@ -371,8 +365,7 @@ test_vlstrings_special(void) /* Check data read in */ for(i=0; i<SPACE1_DIM1; i++) { if(rdata[i]!=NULL) { - num_errs++; - printf("VL doesn't match!, rdata[%d]=%p\n",(int)i,rdata[i]); + TestErrPrintf("VL doesn't match!, rdata[%d]=%p\n",(int)i,rdata[i]); } /* end if */ } /* end for */ @@ -538,13 +531,11 @@ test_compact_vlstring(void) /* Compare data read in */ for(i=0; i<SPACE1_DIM1; i++) { if(strlen(wdata[i])!=strlen(rdata[i])) { - num_errs++; - printf("VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",(int)i,(int)strlen(wdata[i]),(int)i,(int)strlen(rdata[i])); + TestErrPrintf("VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",(int)i,(int)strlen(wdata[i]),(int)i,(int)strlen(rdata[i])); continue; } /* end if */ if( strcmp(wdata[i],rdata[i]) != 0 ) { - num_errs++; - printf("VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n",(int)i,wdata[i],(int)i,rdata[i]); + TestErrPrintf("VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n",(int)i,wdata[i],(int)i,rdata[i]); continue; } /* end if */ } /* end for */ @@ -615,8 +606,7 @@ static void test_write_vl_string_attribute(void) CHECK(ret, FAIL, "H5Aread"); if(HDstrcmp(string_att_check,string_att)!=0) { - num_errs++; - printf("VL string attributes don't match!, string_att=%s, string_att_check=%s\n",string_att,string_att_check); + TestErrPrintf("VL string attributes don't match!, string_att=%s, string_att_check=%s\n",string_att,string_att_check); } /* end if */ HDfree(string_att_check); @@ -638,8 +628,7 @@ static void test_write_vl_string_attribute(void) CHECK(ret, FAIL, "H5Aread"); if(HDstrcmp(string_att_check,string_att_write)!=0) { - num_errs++; - printf("VL string attributes don't match!, string_att_write=%s, string_att_check=%s\n",string_att_write,string_att_check); + TestErrPrintf("VL string attributes don't match!, string_att_write=%s, string_att_check=%s\n",string_att_write,string_att_check); } /* end if */ HDfree(string_att_check); @@ -699,8 +688,7 @@ static void test_read_vl_string_attribute(void) CHECK(ret, FAIL, "H5Aread"); if(HDstrcmp(string_att_check,string_att)!=0) { - num_errs++; - printf("VL string attributes don't match!, string_att=%s, string_att_check=%s\n",string_att,string_att_check); + TestErrPrintf("VL string attributes don't match!, string_att=%s, string_att_check=%s\n",string_att,string_att_check); } /* end if */ HDfree(string_att_check); @@ -716,8 +704,7 @@ static void test_read_vl_string_attribute(void) CHECK(ret, FAIL, "H5Aread"); if(HDstrcmp(string_att_check,string_att_write)!=0) { - num_errs++; - printf("VL string attributes don't match!, string_att_write=%s, string_att_check=%s\n",string_att_write,string_att_check); + TestErrPrintf("VL string attributes don't match!, string_att_write=%s, string_att_check=%s\n",string_att_write,string_att_check); } /* end if */ HDfree(string_att_check); diff --git a/test/tvltypes.c b/test/tvltypes.c index 36fa524..7a0aee2 100644 --- a/test/tvltypes.c +++ b/test/tvltypes.c @@ -226,8 +226,7 @@ test_vltypes_vlen_atomic(void) /* Check data read in */ for(i=0; i<SPACE1_DIM1; i++) { if(rdata[i].len!=0 || rdata[i].p!=NULL) { - num_errs++; - printf("VL doesn't match!, rdata[%d].len=%u, rdata[%d].p=%p\n",(int)i,(unsigned)rdata[i].len,(int)i,rdata[i].p); + TestErrPrintf("VL doesn't match!, rdata[%d].len=%u, rdata[%d].p=%p\n",(int)i,(unsigned)rdata[i].len,(int)i,rdata[i].p); } /* end if */ } /* end for */ @@ -242,8 +241,7 @@ test_vltypes_vlen_atomic(void) /* Check data read in */ for(i=0; i<SPACE1_DIM1; i++) { if(rdata[i].len!=0 || rdata[i].p!=NULL) { - num_errs++; - printf("VL doesn't match!, rdata[%d].len=%u, rdata[%d].p=%p\n",(int)i,(unsigned)rdata[i].len,(int)i,rdata[i].p); + TestErrPrintf("VL doesn't match!, rdata[%d].len=%u, rdata[%d].p=%p\n",(int)i,(unsigned)rdata[i].len,(int)i,rdata[i].p); } /* end if */ } /* end for */ @@ -279,8 +277,7 @@ test_vltypes_vlen_atomic(void) /* Check data read in */ for(i=0; i<SPACE1_DIM1; i++) { if(rdata[i].len!=0 || rdata[i].p!=NULL) { - num_errs++; - printf("VL doesn't match!, rdata[%d].len=%u, rdata[%d].p=%p\n",(int)i,(unsigned)rdata[i].len,(int)i,rdata[i].p); + TestErrPrintf("VL doesn't match!, rdata[%d].len=%u, rdata[%d].p=%p\n",(int)i,(unsigned)rdata[i].len,(int)i,rdata[i].p); } /* end if */ } /* end for */ @@ -295,8 +292,7 @@ test_vltypes_vlen_atomic(void) /* Check data read in */ for(i=0; i<SPACE1_DIM1; i++) { if(rdata[i].len!=0 || rdata[i].p!=NULL) { - num_errs++; - printf("VL doesn't match!, rdata[%d].len=%u, rdata[%d].p=%p\n",(int)i,(unsigned)rdata[i].len,(int)i,rdata[i].p); + TestErrPrintf("VL doesn't match!, rdata[%d].len=%u, rdata[%d].p=%p\n",(int)i,(unsigned)rdata[i].len,(int)i,rdata[i].p); } /* end if */ } /* end for */ @@ -362,14 +358,12 @@ test_vltypes_vlen_atomic(void) /* Compare data read in */ for(i=0; i<SPACE1_DIM1; i++) { if(wdata[i].len!=rdata[i].len) { - num_errs++; - printf("%d: VL data lengths don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n",__LINE__,(int)i,(int)wdata[i].len,(int)i,(int)rdata[i].len); + TestErrPrintf("%d: VL data lengths don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n",__LINE__,(int)i,(int)wdata[i].len,(int)i,(int)rdata[i].len); continue; } /* end if */ for(j=0; j<rdata[i].len; j++) { if( ((unsigned int *)wdata[i].p)[j] != ((unsigned int *)rdata[i].p)[j] ) { - num_errs++; - printf("VL data values don't match!, wdata[%d].p[%d]=%d, rdata[%d].p[%d]=%d\n",(int)i,(int)j, (int)((unsigned int *)wdata[i].p)[j], (int)i,(int)j, (int)((unsigned int *)rdata[i].p)[j]); + TestErrPrintf("VL data values don't match!, wdata[%d].p[%d]=%d, rdata[%d].p[%d]=%d\n",(int)i,(int)j, (int)((unsigned int *)wdata[i].p)[j], (int)i,(int)j, (int)((unsigned int *)rdata[i].p)[j]); continue; } /* end if */ } /* end for */ @@ -436,14 +430,12 @@ test_vltypes_vlen_atomic(void) /* Compare data read in */ for(i=0; i<SPACE1_DIM1; i++) { if(wdata[i].len!=rdata[i].len) { - num_errs++; - printf("%d: VL data lengths don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n",__LINE__,(int)i,(int)wdata[i].len,(int)i,(int)rdata[i].len); + TestErrPrintf("%d: VL data lengths don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n",__LINE__,(int)i,(int)wdata[i].len,(int)i,(int)rdata[i].len); continue; } /* end if */ for(j=0; j<rdata[i].len; j++) { if( ((unsigned int *)wdata[i].p)[j] != ((unsigned int *)rdata[i].p)[j] ) { - num_errs++; - printf("VL data values don't match!, wdata[%d].p[%d]=%d, rdata[%d].p[%d]=%d\n",(int)i,(int)j, (int)((unsigned int *)wdata[i].p)[j], (int)i,(int)j, (int)((unsigned int *)rdata[i].p)[j]); + TestErrPrintf("VL data values don't match!, wdata[%d].p[%d]=%d, rdata[%d].p[%d]=%d\n",(int)i,(int)j, (int)((unsigned int *)wdata[i].p)[j], (int)i,(int)j, (int)((unsigned int *)rdata[i].p)[j]); continue; } /* end if */ } /* end for */ @@ -593,14 +585,12 @@ rewrite_vltypes_vlen_atomic(void) /* Compare data read in */ for(i=0; i<SPACE1_DIM1; i++) { if(wdata[i].len!=rdata[i].len) { - num_errs++; - printf("%d: VL data lengths don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n",__LINE__,(int)i,(int)wdata[i].len,(int)i,(int)rdata[i].len); + TestErrPrintf("%d: VL data lengths don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n",__LINE__,(int)i,(int)wdata[i].len,(int)i,(int)rdata[i].len); continue; } /* end if */ for(j=0; j<rdata[i].len; j++) { if( ((unsigned int *)wdata[i].p)[j] != ((unsigned int *)rdata[i].p)[j] ) { - num_errs++; - printf("VL data values don't match!, wdata[%d].p[%d]=%d, rdata[%d].p[%d]=%d\n",(int)i,(int)j, (int)((unsigned int *)wdata[i].p)[j], (int)i,(int)j, (int)((unsigned int *)rdata[i].p)[j]); + TestErrPrintf("VL data values don't match!, wdata[%d].p[%d]=%d, rdata[%d].p[%d]=%d\n",(int)i,(int)j, (int)((unsigned int *)wdata[i].p)[j], (int)i,(int)j, (int)((unsigned int *)rdata[i].p)[j]); continue; } /* end if */ } /* end for */ @@ -735,19 +725,16 @@ test_vltypes_vlen_compound(void) /* Compare data read in */ for(i=0; i<SPACE1_DIM1; i++) { if(wdata[i].len!=rdata[i].len) { - num_errs++; - printf("%d: VL data length don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n",__LINE__,(int)i,(int)wdata[i].len,(int)i,(int)rdata[i].len); + TestErrPrintf("%d: VL data length don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n",__LINE__,(int)i,(int)wdata[i].len,(int)i,(int)rdata[i].len); continue; } /* end if */ for(j=0; j<rdata[i].len; j++) { if( ((s1 *)wdata[i].p)[j].i != ((s1 *)rdata[i].p)[j].i ) { - num_errs++; - printf("VL data values don't match!, wdata[%d].p[%d].i=%d, rdata[%d].p[%d].i=%d\n",(int)i,(int)j, (int)((s1 *)wdata[i].p)[j].i, (int)i,(int)j, (int)((s1 *)rdata[i].p)[j].i); + TestErrPrintf("VL data values don't match!, wdata[%d].p[%d].i=%d, rdata[%d].p[%d].i=%d\n",(int)i,(int)j, (int)((s1 *)wdata[i].p)[j].i, (int)i,(int)j, (int)((s1 *)rdata[i].p)[j].i); continue; } /* end if */ if( ((s1 *)wdata[i].p)[j].f != ((s1 *)rdata[i].p)[j].f ) { - num_errs++; - printf("VL data values don't match!, wdata[%d].p[%d].f=%f, rdata[%d].p[%d].f=%f\n",(int)i,(int)j, (double)((s1 *)wdata[i].p)[j].f, (int)i,(int)j, (double)((s1 *)rdata[i].p)[j].f); + TestErrPrintf("VL data values don't match!, wdata[%d].p[%d].f=%f, rdata[%d].p[%d].f=%f\n",(int)i,(int)j, (double)((s1 *)wdata[i].p)[j].f, (int)i,(int)j, (double)((s1 *)rdata[i].p)[j].f); continue; } /* end if */ } /* end for */ @@ -883,19 +870,16 @@ rewrite_vltypes_vlen_compound(void) /* Compare data read in */ for(i=0; i<SPACE1_DIM1; i++) { if(wdata[i].len!=rdata[i].len) { - num_errs++; - printf("%d: VL data length don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n",__LINE__,(int)i,(int)wdata[i].len,(int)i,(int)rdata[i].len); + TestErrPrintf("%d: VL data length don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n",__LINE__,(int)i,(int)wdata[i].len,(int)i,(int)rdata[i].len); continue; } /* end if */ for(j=0; j<rdata[i].len; j++) { if( ((s1 *)wdata[i].p)[j].i != ((s1 *)rdata[i].p)[j].i ) { - num_errs++; - printf("VL data values don't match!, wdata[%d].p[%d].i=%d, rdata[%d].p[%d].i=%d\n",(int)i,(int)j, (int)((s1 *)wdata[i].p)[j].i, (int)i,(int)j, (int)((s1 *)rdata[i].p)[j].i); + TestErrPrintf("VL data values don't match!, wdata[%d].p[%d].i=%d, rdata[%d].p[%d].i=%d\n",(int)i,(int)j, (int)((s1 *)wdata[i].p)[j].i, (int)i,(int)j, (int)((s1 *)rdata[i].p)[j].i); continue; } /* end if */ if( ((s1 *)wdata[i].p)[j].f != ((s1 *)rdata[i].p)[j].f ) { - num_errs++; - printf("VL data values don't match!, wdata[%d].p[%d].f=%f, rdata[%d].p[%d].f=%f\n",(int)i,(int)j, (double)((s1 *)wdata[i].p)[j].f, (int)i,(int)j, (double)((s1 *)rdata[i].p)[j].f); + TestErrPrintf("VL data values don't match!, wdata[%d].p[%d].f=%f, rdata[%d].p[%d].f=%f\n",(int)i,(int)j, (double)((s1 *)wdata[i].p)[j].f, (int)i,(int)j, (double)((s1 *)rdata[i].p)[j].f); continue; } /* end if */ } /* end for */ @@ -1044,32 +1028,27 @@ test_vltypes_compound_vlen_vlen(void) /* Compare data read in */ for(i=0; i<SPACE3_DIM1; i++) { if(wdata[i].i!=rdata[i].i) { - num_errs++; - printf("Integer components don't match!, wdata[%d].i=%d, rdata[%d].i=%d\n",(int)i,(int)wdata[i].i,(int)i,(int)rdata[i].i); + TestErrPrintf("Integer components don't match!, wdata[%d].i=%d, rdata[%d].i=%d\n",(int)i,(int)wdata[i].i,(int)i,(int)rdata[i].i); continue; } /* end if */ if(wdata[i].f!=rdata[i].f) { - num_errs++; - printf("Float components don't match!, wdata[%d].f=%f, rdata[%d].f=%f\n",(int)i,(double)wdata[i].f,(int)i,(double)rdata[i].f); + TestErrPrintf("Float components don't match!, wdata[%d].f=%f, rdata[%d].f=%f\n",(int)i,(double)wdata[i].f,(int)i,(double)rdata[i].f); continue; } /* end if */ if(wdata[i].v.len!=rdata[i].v.len) { - num_errs++; - printf("%d: VL data length don't match!, wdata[%d].v.len=%d, rdata[%d].v.len=%d\n",__LINE__,(int)i,(int)wdata[i].v.len,(int)i,(int)rdata[i].v.len); + TestErrPrintf("%d: VL data length don't match!, wdata[%d].v.len=%d, rdata[%d].v.len=%d\n",__LINE__,(int)i,(int)wdata[i].v.len,(int)i,(int)rdata[i].v.len); continue; } /* end if */ for(t1=wdata[i].v.p, t2=rdata[i].v.p, j=0; j<rdata[i].v.len; j++, t1++, t2++) { if(t1->len!=t2->len) { - num_errs++; - printf("%d: VL data length don't match!, i=%d, j=%d, t1->len=%d, t2->len=%d\n",__LINE__,(int)i,(int)j,(int)t1->len,(int)t2->len); + TestErrPrintf("%d: VL data length don't match!, i=%d, j=%d, t1->len=%d, t2->len=%d\n",__LINE__,(int)i,(int)j,(int)t1->len,(int)t2->len); continue; } /* end if */ for(k=0; k<t2->len; k++) { if( ((unsigned int *)t1->p)[k] != ((unsigned int *)t2->p)[k] ) { - num_errs++; - printf("VL data values don't match!, t1->p[%d]=%d, t2->p[%d]=%d\n",(int)k, (int)((unsigned int *)t1->p)[k], (int)k, (int)((unsigned int *)t2->p)[k]); + TestErrPrintf("VL data values don't match!, t1->p[%d]=%d, t2->p[%d]=%d\n",(int)k, (int)((unsigned int *)t1->p)[k], (int)k, (int)((unsigned int *)t2->p)[k]); continue; } /* end if */ } /* end for */ @@ -1208,24 +1187,20 @@ test_vltypes_compound_vlen_atomic(void) /* Compare data read in */ for(i=0; i<SPACE1_DIM1; i++) { if(wdata[i].i!=rdata[i].i) { - num_errs++; - printf("Integer components don't match!, wdata[%d].i=%d, rdata[%d].i=%d\n",(int)i,(int)wdata[i].i,(int)i,(int)rdata[i].i); + TestErrPrintf("Integer components don't match!, wdata[%d].i=%d, rdata[%d].i=%d\n",(int)i,(int)wdata[i].i,(int)i,(int)rdata[i].i); continue; } /* end if */ if(wdata[i].f!=rdata[i].f) { - num_errs++; - printf("Float components don't match!, wdata[%d].f=%f, rdata[%d].f=%f\n",(int)i,(double)wdata[i].f,(int)i,(double)rdata[i].f); + TestErrPrintf("Float components don't match!, wdata[%d].f=%f, rdata[%d].f=%f\n",(int)i,(double)wdata[i].f,(int)i,(double)rdata[i].f); continue; } /* end if */ if(wdata[i].v.len!=rdata[i].v.len) { - num_errs++; - printf("%d: VL data length don't match!, wdata[%d].v.len=%d, rdata[%d].v.len=%d\n",__LINE__,(int)i,(int)wdata[i].v.len,(int)i,(int)rdata[i].v.len); + TestErrPrintf("%d: VL data length don't match!, wdata[%d].v.len=%d, rdata[%d].v.len=%d\n",__LINE__,(int)i,(int)wdata[i].v.len,(int)i,(int)rdata[i].v.len); continue; } /* end if */ for(j=0; j<rdata[i].v.len; j++) { if( ((unsigned int *)wdata[i].v.p)[j] != ((unsigned int *)rdata[i].v.p)[j] ) { - num_errs++; - printf("VL data values don't match!, wdata[%d].v.p[%d]=%d, rdata[%d].v.p[%d]=%d\n",(int)i,(int)j, (int)((unsigned int *)wdata[i].v.p)[j], (int)i,(int)j, (int)((unsigned int *)rdata[i].v.p)[j]); + TestErrPrintf("VL data values don't match!, wdata[%d].v.p[%d]=%d, rdata[%d].v.p[%d]=%d\n",(int)i,(int)j, (int)((unsigned int *)wdata[i].v.p)[j], (int)i,(int)j, (int)((unsigned int *)rdata[i].v.p)[j]); continue; } /* end if */ } /* end for */ @@ -1265,8 +1240,7 @@ test_vltypes_compound_vlen_atomic(void) /* Check data read in */ for(i=0; i<SPACE1_DIM1; i++) { if(rdata[i].i!=0 || rdata[i].f!=0.0 || rdata[i].v.len!=0 || rdata[i].v.p!=NULL) { - num_errs++; - printf("VL doesn't match!, rdata[%d].i=%d, rdata[%d].f=%f, rdata[%d].v.len=%u, rdata[%d].v.p=%p\n",(int)i,rdata[i].i,(int)i,rdata[i].f,(int)i,(unsigned)rdata[i].v.len,(int)i,rdata[i].v.p); + TestErrPrintf("VL doesn't match!, rdata[%d].i=%d, rdata[%d].f=%f, rdata[%d].v.len=%u, rdata[%d].v.p=%p\n",(int)i,rdata[i].i,(int)i,rdata[i].f,(int)i,(unsigned)rdata[i].v.len,(int)i,rdata[i].v.p); } /* end if */ } /* end for */ @@ -1281,24 +1255,20 @@ test_vltypes_compound_vlen_atomic(void) /* Compare data read in */ for(i=0; i<SPACE1_DIM1; i++) { if(wdata[i].i!=rdata[i].i) { - num_errs++; - printf("Integer components don't match!, wdata[%d].i=%d, rdata[%d].i=%d\n",(int)i,(int)wdata[i].i,(int)i,(int)rdata[i].i); + TestErrPrintf("Integer components don't match!, wdata[%d].i=%d, rdata[%d].i=%d\n",(int)i,(int)wdata[i].i,(int)i,(int)rdata[i].i); continue; } /* end if */ if(wdata[i].f!=rdata[i].f) { - num_errs++; - printf("Float components don't match!, wdata[%d].f=%f, rdata[%d].f=%f\n",(int)i,(double)wdata[i].f,(int)i,(double)rdata[i].f); + TestErrPrintf("Float components don't match!, wdata[%d].f=%f, rdata[%d].f=%f\n",(int)i,(double)wdata[i].f,(int)i,(double)rdata[i].f); continue; } /* end if */ if(wdata[i].v.len!=rdata[i].v.len) { - num_errs++; - printf("%d: VL data length don't match!, wdata[%d].v.len=%d, rdata[%d].v.len=%d\n",__LINE__,(int)i,(int)wdata[i].v.len,(int)i,(int)rdata[i].v.len); + TestErrPrintf("%d: VL data length don't match!, wdata[%d].v.len=%d, rdata[%d].v.len=%d\n",__LINE__,(int)i,(int)wdata[i].v.len,(int)i,(int)rdata[i].v.len); continue; } /* end if */ for(j=0; j<rdata[i].v.len; j++) { if( ((unsigned int *)wdata[i].v.p)[j] != ((unsigned int *)rdata[i].v.p)[j] ) { - num_errs++; - printf("VL data values don't match!, wdata[%d].v.p[%d]=%d, rdata[%d].v.p[%d]=%d\n",(int)i,(int)j, (int)((unsigned int *)wdata[i].v.p)[j], (int)i,(int)j, (int)((unsigned int *)rdata[i].v.p)[j]); + TestErrPrintf("VL data values don't match!, wdata[%d].v.p[%d]=%d, rdata[%d].v.p[%d]=%d\n",(int)i,(int)j, (int)((unsigned int *)wdata[i].v.p)[j], (int)i,(int)j, (int)((unsigned int *)rdata[i].v.p)[j]); continue; } /* end if */ } /* end for */ @@ -1437,24 +1407,20 @@ rewrite_vltypes_compound_vlen_atomic(void) /* Compare data read in */ for(i=0; i<SPACE1_DIM1; i++) { if(wdata[i].i!=rdata[i].i) { - num_errs++; - printf("Integer components don't match!, wdata[%d].i=%d, rdata[%d].i=%d\n",(int)i,(int)wdata[i].i,(int)i,(int)rdata[i].i); + TestErrPrintf("Integer components don't match!, wdata[%d].i=%d, rdata[%d].i=%d\n",(int)i,(int)wdata[i].i,(int)i,(int)rdata[i].i); continue; } /* end if */ if(wdata[i].f!=rdata[i].f) { - num_errs++; - printf("Float components don't match!, wdata[%d].f=%f, rdata[%d].f=%f\n",(int)i,(double)wdata[i].f,(int)i,(double)rdata[i].f); + TestErrPrintf("Float components don't match!, wdata[%d].f=%f, rdata[%d].f=%f\n",(int)i,(double)wdata[i].f,(int)i,(double)rdata[i].f); continue; } /* end if */ if(wdata[i].v.len!=rdata[i].v.len) { - num_errs++; - printf("%d: VL data length don't match!, wdata[%d].v.len=%d, rdata[%d].v.len=%d\n",__LINE__,(int)i,(int)wdata[i].v.len,(int)i,(int)rdata[i].v.len); + TestErrPrintf("%d: VL data length don't match!, wdata[%d].v.len=%d, rdata[%d].v.len=%d\n",__LINE__,(int)i,(int)wdata[i].v.len,(int)i,(int)rdata[i].v.len); continue; } /* end if */ for(j=0; j<rdata[i].v.len; j++) { if( ((unsigned int *)wdata[i].v.p)[j] != ((unsigned int *)rdata[i].v.p)[j] ) { - num_errs++; - printf("VL data values don't match!, wdata[%d].v.p[%d]=%d, rdata[%d].v.p[%d]=%d\n",(int)i,(int)j, (int)((unsigned int *)wdata[i].v.p)[j], (int)i,(int)j, (int)((unsigned int *)rdata[i].v.p)[j]); + TestErrPrintf("VL data values don't match!, wdata[%d].v.p[%d]=%d, rdata[%d].v.p[%d]=%d\n",(int)i,(int)j, (int)((unsigned int *)wdata[i].v.p)[j], (int)i,(int)j, (int)((unsigned int *)rdata[i].v.p)[j]); continue; } /* end if */ } /* end for */ @@ -1547,16 +1513,14 @@ test_vltypes_vlen_vlen_atomic(void) for(i=0; i<SPACE1_DIM1; i++) { wdata[i].p=malloc((i+1)*sizeof(hvl_t)); if(wdata[i].p==NULL) { - printf("Cannot allocate memory for VL data! i=%u\n",i); - num_errs++; + TestErrPrintf("Cannot allocate memory for VL data! i=%u\n",i); return; } /* end if */ wdata[i].len=i+1; for(t1=wdata[i].p,j=0; j<(i+1); j++, t1++) { t1->p=malloc((j+1)*sizeof(unsigned int)); if(t1->p==NULL) { - printf("Cannot allocate memory for VL data! i=%u, j=%u\n",i,j); - num_errs++; + TestErrPrintf("Cannot allocate memory for VL data! i=%u, j=%u\n",i,j); return; } /* end if */ t1->len=j+1; @@ -1656,20 +1620,17 @@ test_vltypes_vlen_vlen_atomic(void) /* Compare data read in */ for(i=0; i<SPACE1_DIM1; i++) { if(wdata[i].len!=rdata[i].len) { - num_errs++; - printf("%d: VL data length don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n",__LINE__,(int)i,(int)wdata[i].len,(int)i,(int)rdata[i].len); + TestErrPrintf("%d: VL data length don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n",__LINE__,(int)i,(int)wdata[i].len,(int)i,(int)rdata[i].len); continue; } /* end if */ for(t1=wdata[i].p, t2=rdata[i].p, j=0; j<rdata[i].len; j++, t1++, t2++) { if(t1->len!=t2->len) { - num_errs++; - printf("%d: VL data length don't match!, i=%d, j=%d, t1->len=%d, t2->len=%d\n",__LINE__,(int)i,(int)j,(int)t1->len,(int)t2->len); + TestErrPrintf("%d: VL data length don't match!, i=%d, j=%d, t1->len=%d, t2->len=%d\n",__LINE__,(int)i,(int)j,(int)t1->len,(int)t2->len); continue; } /* end if */ for(k=0; k<t2->len; k++) { if( ((unsigned int *)t1->p)[k] != ((unsigned int *)t2->p)[k] ) { - num_errs++; - printf("VL data values don't match!, t1->p[%d]=%d, t2->p[%d]=%d\n",(int)k, (int)((unsigned int *)t1->p)[k], (int)k, (int)((unsigned int *)t2->p)[k]); + TestErrPrintf("VL data values don't match!, t1->p[%d]=%d, t2->p[%d]=%d\n",(int)k, (int)((unsigned int *)t1->p)[k], (int)k, (int)((unsigned int *)t2->p)[k]); continue; } /* end if */ } /* end for */ @@ -1743,16 +1704,14 @@ rewrite_longer_vltypes_vlen_vlen_atomic(void) for(i=0; i<SPACE1_DIM1; i++) { wdata[i].p=malloc((i+increment)*sizeof(hvl_t)); if(wdata[i].p==NULL) { - printf("Cannot allocate memory for VL data! i=%u\n",i); - num_errs++; + TestErrPrintf("Cannot allocate memory for VL data! i=%u\n",i); return; } /* end if */ wdata[i].len=i+increment; for(t1=wdata[i].p,j=0; j<(i+increment); j++, t1++) { t1->p=malloc((j+1)*sizeof(unsigned int)); if(t1->p==NULL) { - printf("Cannot allocate memory for VL data! i=%u, j=%u\n",i,j); - num_errs++; + TestErrPrintf("Cannot allocate memory for VL data! i=%u, j=%u\n",i,j); return; } /* end if */ t1->len=j+1; @@ -1841,20 +1800,17 @@ rewrite_longer_vltypes_vlen_vlen_atomic(void) /* Compare data read in */ for(i=0; i<SPACE1_DIM1; i++) { if(wdata[i].len!=rdata[i].len) { - num_errs++; - printf("%d: VL data length don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n",__LINE__,(int)i,(int)wdata[i].len,(int)i,(int)rdata[i].len); + TestErrPrintf("%d: VL data length don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n",__LINE__,(int)i,(int)wdata[i].len,(int)i,(int)rdata[i].len); continue; } /* end if */ - for(t1=wdata[i].p, t2=rdata[i].p, j=0; j<rdata[i].len; j++, t1++, t2++) -{ + for(t1=wdata[i].p, t2=rdata[i].p, j=0; j<rdata[i].len; j++, t1++, t2++) { if(t1->len!=t2->len) { - num_errs++; - printf("%d: VL data length don't match!, i=%d, j=%d, t1->len=%d, t2->len=%d\n",__LINE__,(int)i,(int)j,(int)t1->len,(int)t2->len); + TestErrPrintf("%d: VL data length don't match!, i=%d, j=%d, t1->len=%d, t2->len=%d\n",__LINE__,(int)i,(int)j,(int)t1->len,(int)t2->len); continue; } /* end if */ for(k=0; k<t2->len; k++) { - if( ((unsigned int *)t1->p)[k] != ((unsigned int *)t2->p)[k] ) { num_errs++; - printf("VL data values don't match!, t1->p[%d]=%d, t2->p[%d]=%d\n",(int)k, (int)((unsigned int *)t1->p)[k], (int)k, (int)((unsigned int *)t2->p)[k]); + if( ((unsigned int *)t1->p)[k] != ((unsigned int *)t2->p)[k] ) { + TestErrPrintf("VL data values don't match!, t1->p[%d]=%d, t2->p[%d]=%d\n",(int)k, (int)((unsigned int *)t1->p)[k], (int)k, (int)((unsigned int *)t2->p)[k]); continue; } /* end if */ } /* end for */ @@ -1924,16 +1880,14 @@ rewrite_shorter_vltypes_vlen_vlen_atomic(void) for(i=0; i<SPACE1_DIM1; i++) { wdata[i].p=malloc((i+increment)*sizeof(hvl_t)); if(wdata[i].p==NULL) { - printf("Cannot allocate memory for VL data! i=%u\n",i); - num_errs++; + TestErrPrintf("Cannot allocate memory for VL data! i=%u\n",i); return; } /* end if */ wdata[i].len=i+increment; for(t1=wdata[i].p,j=0; j<(i+increment); j++, t1++) { t1->p=malloc((j+1)*sizeof(unsigned int)); if(t1->p==NULL) { - printf("Cannot allocate memory for VL data! i=%u, j=%u\n",i,j); - num_errs++; + TestErrPrintf("Cannot allocate memory for VL data! i=%u, j=%u\n",i,j); return; } /* end if */ t1->len=j+1; @@ -2022,20 +1976,17 @@ rewrite_shorter_vltypes_vlen_vlen_atomic(void) /* Compare data read in */ for(i=0; i<SPACE1_DIM1; i++) { if(wdata[i].len!=rdata[i].len) { - num_errs++; - printf("%d: VL data length don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n",__LINE__,(int)i,(int)wdata[i].len,(int)i,(int)rdata[i].len); + TestErrPrintf("%d: VL data length don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n",__LINE__,(int)i,(int)wdata[i].len,(int)i,(int)rdata[i].len); continue; } /* end if */ for(t1=wdata[i].p, t2=rdata[i].p, j=0; j<rdata[i].len; j++, t1++, t2++) { if(t1->len!=t2->len) { - num_errs++; - printf("%d: VL data length don't match!, i=%d, j=%d, t1->len=%d, t2->len=%d\n",__LINE__,(int)i,(int)j,(int)t1->len,(int)t2->len); + TestErrPrintf("%d: VL data length don't match!, i=%d, j=%d, t1->len=%d, t2->len=%d\n",__LINE__,(int)i,(int)j,(int)t1->len,(int)t2->len); continue; } /* end if */ for(k=0; k<t2->len; k++) { if( ((unsigned int *)t1->p)[k] != ((unsigned int *)t2->p)[k] ) { - num_errs++; - printf("VL data values don't match!, t1->p[%d]=%d, t2->p[%d]=%d\n",(int)k, (int)((unsigned int *)t1->p)[k], (int)k, (int)((unsigned int *)t2->p)[k]); + TestErrPrintf("VL data values don't match!, t1->p[%d]=%d, t2->p[%d]=%d\n",(int)k, (int)((unsigned int *)t1->p)[k], (int)k, (int)((unsigned int *)t2->p)[k]); continue; } /* end if */ } /* end for */ |