diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/Makefile.in | 6 | ||||
-rw-r--r-- | test/h5test.c | 16 | ||||
-rw-r--r-- | test/h5test.h | 3 | ||||
-rw-r--r-- | test/tarray.c | 253 | ||||
-rw-r--r-- | test/tattr.c | 189 | ||||
-rw-r--r-- | test/tconfig.c | 5 | ||||
-rw-r--r-- | test/testframe.c | 45 | ||||
-rw-r--r-- | test/testhdf5.c | 6 | ||||
-rw-r--r-- | test/testhdf5.h | 115 | ||||
-rw-r--r-- | test/tgenprop.c | 146 | ||||
-rw-r--r-- | test/th5s.c | 9 | ||||
-rw-r--r-- | test/theap.c | 24 | ||||
-rw-r--r-- | test/titerate.c | 110 | ||||
-rw-r--r-- | test/tmeta.c | 30 | ||||
-rw-r--r-- | test/tmisc.c | 170 | ||||
-rw-r--r-- | test/trefer.c | 8 | ||||
-rw-r--r-- | test/trefstr.c | 12 | ||||
-rw-r--r-- | test/tselect.c | 368 | ||||
-rw-r--r-- | test/ttbbt.c | 10 | ||||
-rw-r--r-- | test/ttime.c | 26 | ||||
-rw-r--r-- | test/ttsafe.c | 10 | ||||
-rw-r--r-- | test/ttsafe_acreate.c | 158 | ||||
-rw-r--r-- | test/ttsafe_cancel.c | 215 | ||||
-rw-r--r-- | test/ttsafe_dcreate.c | 8 | ||||
-rw-r--r-- | test/ttsafe_error.c | 21 | ||||
-rw-r--r-- | test/ttst.c | 30 | ||||
-rw-r--r-- | test/tvlstr.c | 85 | ||||
-rw-r--r-- | test/tvltypes.c | 184 |
28 files changed, 884 insertions, 1378 deletions
diff --git a/test/Makefile.in b/test/Makefile.in index 09701ad..cde5dde 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -44,7 +44,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= @@ -109,11 +109,11 @@ check test _test: $(PROGS) ## How to build the tests... They all depend on the test and hdf5 libraries. $(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/h5test.c b/test/h5test.c index 3a8e72c..5c21181 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -186,7 +186,7 @@ h5_cleanup(const char *base_name[], hid_t fapl) } else if (driver == H5FD_MULTI) { H5FD_mem_t mt; - assert(strlen(multi_letters)==H5FD_MEM_NTYPES); + assert(HDstrlen(multi_letters)==H5FD_MEM_NTYPES); for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,mt)) { HDsnprintf(temp, sizeof temp, "%s-%c.h5", @@ -466,9 +466,6 @@ h5_fileaccess(void) const char *name; char s[1024]; hid_t fapl = -1; - hsize_t fam_size = 100*1024*1024; /*100 MB*/ - long log_flags = H5FD_LOG_LOC_IO; - H5FD_mem_t mt; /* First use the environment variable, then the constant */ val = HDgetenv("HDF5_DRIVER"); @@ -505,6 +502,7 @@ h5_fileaccess(void) const char *memb_name[H5FD_MEM_NTYPES]; char sv[H5FD_MEM_NTYPES][1024]; haddr_t memb_addr[H5FD_MEM_NTYPES]; + H5FD_mem_t mt; HDmemset(memb_map, 0, sizeof memb_map); HDmemset(memb_fapl, 0, sizeof memb_fapl); @@ -524,12 +522,16 @@ h5_fileaccess(void) return -1; } } else if (!HDstrcmp(name, "family")) { + hsize_t fam_size = 100*1024*1024; /*100 MB*/ + /* Family of files, each 1MB and using the default driver */ - if ((val=HDstrtok(NULL, " \t\n\r"))) { + if ((val=HDstrtok(NULL, " \t\n\r"))) fam_size = (hsize_t)(HDstrtod(val, NULL) * 1024*1024); - } - if (H5Pset_fapl_family(fapl, fam_size, H5P_DEFAULT)<0) return -1; + if (H5Pset_fapl_family(fapl, fam_size, H5P_DEFAULT)<0) + return -1; } else if (!HDstrcmp(name, "log")) { + long log_flags = H5FD_LOG_LOC_IO; + /* Log file access */ if ((val = HDstrtok(NULL, " \t\n\r"))) log_flags = HDstrtol(val, NULL, 0); diff --git a/test/h5test.h b/test/h5test.h index fac6c26..8a53f0f 100644 --- a/test/h5test.h +++ b/test/h5test.h @@ -21,14 +21,13 @@ #ifndef _H5TEST_H #define _H5TEST_H -#include <stdarg.h> - #undef NDEBUG #include "hdf5.h" #include "H5private.h" #ifdef H5_STDC_HEADERS # include <signal.h> +# include <stdarg.h> #endif /* diff --git a/test/tarray.c b/test/tarray.c index 6d9fea6..3dd9137 100644 --- a/test/tarray.c +++ b/test/tarray.c @@ -12,8 +12,6 @@ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* $Id$ */ - /*********************************************************** * * Test program: tarray @@ -145,8 +143,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 +155,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 +267,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 +281,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 +405,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 +424,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 +438,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 +579,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 */ @@ -604,10 +594,8 @@ test_array_compound_atomic(void) /* Check the 1st field's name */ 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); - } /* end if */ + if(HDstrcmp(mname,"i")!=0) + TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname); free(mname); /* Check the 1st field's offset */ @@ -617,20 +605,16 @@ test_array_compound_atomic(void) /* Check the 1st field's datatype */ 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); - } /* end if */ + if((ret=H5Tequal(mtid,H5T_NATIVE_INT))<=0) + TestErrPrintf("Compound data type is incorrect!, ret=%d\n",(int)ret); ret=H5Tclose(mtid); CHECK(mtid, FAIL, "H5Tclose"); /* Check the 2nd field's name */ 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); - } /* end if */ + if(HDstrcmp(mname,"f")!=0) + TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname); free(mname); /* Check the 2nd field's offset */ @@ -640,10 +624,8 @@ test_array_compound_atomic(void) /* Check the 2nd field's datatype */ 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); - } /* end if */ + if((ret=H5Tequal(mtid,H5T_NATIVE_FLOAT))<=0) + TestErrPrintf("Compound data type is incorrect!, ret=%d\n",(int)ret); ret=H5Tclose(mtid); CHECK(mtid, FAIL, "H5Tclose"); @@ -659,13 +641,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 +793,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 */ @@ -829,10 +808,8 @@ test_array_compound_array(void) /* Check the 1st field's name */ 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); - } /* end if */ + if(HDstrcmp(mname,"i")!=0) + TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname); free(mname); /* Check the 1st field's offset */ @@ -842,20 +819,16 @@ test_array_compound_array(void) /* Check the 1st field's datatype */ 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); - } /* end if */ + if((ret=H5Tequal(mtid,H5T_NATIVE_INT))<=0) + TestErrPrintf("Compound data type is incorrect!, ret=%d\n",(int)ret); ret=H5Tclose(mtid); CHECK(mtid, FAIL, "H5Tclose"); /* Check the 2nd field's name */ 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); - } /* end if */ + if(HDstrcmp(mname,"f")!=0) + TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname); free(mname); /* Check the 2nd field's offset */ @@ -881,8 +854,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 */ @@ -890,10 +862,8 @@ test_array_compound_array(void) tid3=H5Tget_super(mtid); 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); - } /* end if */ + if((ret=H5Tequal(tid3,H5T_NATIVE_FLOAT))<=0) + TestErrPrintf("Compound data type is incorrect!, ret=%d\n",(int)ret); /* Close the array's base type datatype */ ret=H5Tclose(tid3); @@ -915,14 +885,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 +1080,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 */ @@ -1129,10 +1096,8 @@ test_array_vlen_atomic(void) tid3=H5Tget_super(tid2); 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); - } /* end if */ + if((ret=H5Tequal(tid3,H5T_NATIVE_UINT))<=0) + TestErrPrintf("VL base datatype is incorrect!, ret=%d\n",(int)ret); /* Close the array's base type datatype */ ret=H5Tclose(tid3); @@ -1172,14 +1137,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 +1300,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 +1331,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 */ @@ -1379,10 +1340,8 @@ test_array_vlen_array(void) CHECK(tid4, FAIL, "H5Tget_super"); - if((ret=H5Tequal(tid4,H5T_NATIVE_UINT))<=0) { - num_errs++; - printf("VL base datatype is incorrect!, ret=%d\n",(int)ret); - } /* end if */ + if((ret=H5Tequal(tid4,H5T_NATIVE_UINT))<=0) + TestErrPrintf("VL base datatype is incorrect!, ret=%d\n",(int)ret); /* Close the array's base type datatype */ ret=H5Tclose(tid4); @@ -1426,15 +1385,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 */ @@ -1617,20 +1574,17 @@ test_array_bkg(void) /* Verify correct data */ /* ------------------- */ for (i = 0; i < LENGTH; i++) { - for (j = 0; j < ALEN; j++) { + 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; } } @@ -1640,7 +1594,7 @@ test_array_bkg(void) /* Release memory resources */ /* ------------------------ */ for (i = 0; i < dtsinfo.nsubfields; i++) - free(dtsinfo.name[i]); + free(dtsinfo.name[i]); /* Release IDs */ @@ -1693,8 +1647,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; } @@ -1714,20 +1667,17 @@ test_array_bkg(void) /* Verify correct data */ /* ------------------- */ for (i = 0; i < LENGTH; i++) { - for (j = 0; j < ALEN; j++) { + 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; } } @@ -1766,20 +1716,17 @@ test_array_bkg(void) /* Verify correct data */ /* ------------------- */ for (i = 0; i < LENGTH; i++) { - for (j = 0; j < ALEN; j++) { + 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; } } @@ -1878,10 +1825,8 @@ test_compat(void) /* Check the 1st field's name */ 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); - } /* end if */ + if(HDstrcmp(mname,"i")!=0) + TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname); free(mname); /* Check the 1st field's offset */ @@ -1891,20 +1836,16 @@ test_compat(void) /* Check the 1st field's datatype */ 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); - } /* end if */ + if((ret=H5Tequal(mtid,H5T_STD_I16LE))<=0) + TestErrPrintf("Compound data type is incorrect!, ret=%d\n",(int)ret); ret=H5Tclose(mtid); CHECK(mtid, FAIL, "H5Tclose"); /* Check the 2nd field's name */ 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); - } /* end if */ + if(HDstrcmp(mname,"f")!=0) + TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname); free(mname); /* Check the 2nd field's offset */ @@ -1914,20 +1855,16 @@ test_compat(void) /* Check the 2nd field's datatype */ 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); - } /* end if */ + if((ret=H5Tequal(mtid,H5T_IEEE_F32LE))<=0) + TestErrPrintf("Compound data type is incorrect!, ret=%d\n",(int)ret); ret=H5Tclose(mtid); CHECK(mtid, FAIL, "H5Tclose"); /* Check the 3rd field's name */ 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); - } /* end if */ + if(HDstrcmp(mname,"l")!=0) + TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname); free(mname); /* Check the 3rd field's offset */ @@ -1937,10 +1874,8 @@ test_compat(void) /* Check the 3rd field's datatype */ 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); - } /* end if */ + if((ret=H5Tequal(mtid,H5T_STD_I32LE))<=0) + TestErrPrintf("Compound data type is incorrect!, ret=%d\n",(int)ret); ret=H5Tclose(mtid); CHECK(mtid, FAIL, "H5Tclose"); @@ -1972,10 +1907,8 @@ test_compat(void) /* Check the 1st field's name */ 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); - } /* end if */ + if(HDstrcmp(mname,"i")!=0) + TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname); free(mname); /* Check the 1st field's offset */ @@ -1985,20 +1918,16 @@ test_compat(void) /* Check the 1st field's datatype */ 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); - } /* end if */ + if((ret=H5Tequal(mtid,H5T_STD_I16LE))<=0) + TestErrPrintf("Compound data type is incorrect!, ret=%d\n",(int)ret); ret=H5Tclose(mtid); CHECK(mtid, FAIL, "H5Tclose"); /* Check the 2nd field's name */ 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); - } /* end if */ + if(HDstrcmp(mname,"f")!=0) + TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname); free(mname); /* Check the 2nd field's offset */ @@ -2024,8 +1953,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 */ @@ -2033,10 +1961,8 @@ test_compat(void) tid2=H5Tget_super(mtid); 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); - } /* end if */ + if((ret=H5Tequal(tid2,H5T_IEEE_F32LE))<=0) + TestErrPrintf("Compound data type is incorrect!, ret=%d\n",(int)ret); ret=H5Tclose(tid2); CHECK(ret, FAIL, "H5Tclose"); ret=H5Tclose(mtid); @@ -2045,10 +1971,8 @@ test_compat(void) /* Check the 3rd field's name */ 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); - } /* end if */ + if(HDstrcmp(mname,"l")!=0) + TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname); free(mname); /* Check the 3rd field's offset */ @@ -2074,8 +1998,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 */ @@ -2083,10 +2006,8 @@ test_compat(void) tid2=H5Tget_super(mtid); 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); - } /* end if */ + if((ret=H5Tequal(tid2,H5T_STD_I32LE))<=0) + TestErrPrintf("Compound data type is incorrect!, ret=%d\n",(int)ret); ret=H5Tclose(tid2); CHECK(ret, FAIL, "H5Tclose"); ret=H5Tclose(mtid); @@ -2095,10 +2016,8 @@ test_compat(void) /* Check the 4th field's name */ 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); - } /* end if */ + if(HDstrcmp(mname,"d")!=0) + TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname); free(mname); /* Check the 4th field's offset */ @@ -2108,10 +2027,8 @@ test_compat(void) /* Check the 4th field's datatype */ 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); - } /* end if */ + if((ret=H5Tequal(mtid,H5T_IEEE_F64LE))<=0) + TestErrPrintf("Compound data type is incorrect!, ret=%d\n",(int)ret); ret=H5Tclose(mtid); CHECK(mtid, FAIL, "H5Tclose"); diff --git a/test/tattr.c b/test/tattr.c index a8e604b..ded9a79 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -169,10 +169,8 @@ 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++; - } /* end if */ + if(attr_data1[i]!=read_data1[i]) + TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d, read_data1[%d]=%d\n",__LINE__,i,attr_data1[i],i,read_data1[i]); /* Close attribute */ ret=H5Aclose(attr); @@ -211,10 +209,8 @@ 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++; - } /* end if */ + if(attr_data1[i]!=read_data1[i]) + TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d, read_data1[%d]=%d\n",__LINE__,i,attr_data1[i],i,read_data1[i]); /* Close attribute */ ret=H5Aclose(attr); @@ -246,10 +242,8 @@ 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++; - } /* end if */ + if(attr_data1a[i]!=read_data1[i]) + TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d, read_data1[%d]=%d\n",__LINE__,i,attr_data1[i],i,read_data1[i]); /* Close attribute */ ret=H5Aclose(attr2); @@ -355,10 +349,8 @@ 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++; - } /* end if */ + if(attr_data1[i]!=read_data1[i]) + TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d, read_data1[%d]=%d\n",__LINE__,i,attr_data1[i],i,read_data1[i]); /* Close attribute */ ret=H5Aclose(attr); @@ -385,10 +377,8 @@ test_attr_basic_read(void) /* Verify values read in */ 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++; - } /* end if */ + if(attr_data2[i][j]!=read_data2[i][j]) + 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]); /* Close attribute */ ret=H5Aclose(attr); @@ -545,14 +535,10 @@ test_attr_compound_read(void) VERIFY(rank, ATTR4_RANK, "H5Sget_simple_extent_ndims"); 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++; - } /* 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++; - } /* end if */ + if(dims[0]!=ATTR4_DIM1) + TestErrPrintf("attribute dimensions different: dims[0]=%d, should be %d\n",(int)dims[0],ATTR4_DIM1); + if(dims[1]!=ATTR4_DIM2) + TestErrPrintf("attribute dimensions different: dims[1]=%d, should be %d\n",(int)dims[1],ATTR4_DIM2); H5Sclose(space); /* Verify Datatype */ @@ -566,10 +552,8 @@ test_attr_compound_read(void) fieldname=H5Tget_member_name(type,(unsigned)i); 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++; - } /* end if */ + HDstrcmp(fieldname,ATTR4_FIELDNAME3))) + TestErrPrintf("invalid field name for field #%d: %s\n",i,fieldname); free(fieldname); } /* end for */ offset=H5Tget_member_offset(type,0); @@ -618,17 +602,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++; - } /* end if */ + if(HDstrcmp(attr_name,ATTR4_NAME)) + TestErrPrintf("attribute name different: attr_name=%s, should be %s\n",attr_name,ATTR4_NAME); /* Close attribute datatype */ ret=H5Tclose(type); @@ -947,10 +928,8 @@ test_attr_mult_read(void) VERIFY(rank, ATTR1_RANK, "H5Sget_simple_extent_ndims"); 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++; - } /* end if */ + if(dims[0]!=ATTR1_DIM1) + TestErrPrintf("attribute dimensions different: dims[0]=%d, should be %d\n",(int)dims[0],ATTR1_DIM1); H5Sclose(space); /* Verify Datatype */ @@ -970,28 +949,22 @@ 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++; - } /* end if */ + if(attr_data1[i]!=read_data1[i]) + TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d, read_data1[%d]=%d\n",__LINE__,i,attr_data1[i],i,read_data1[i]); /* 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++; - } /* end if */ + if(HDstrcmp(attr_name,ATTR1_NAME)) + TestErrPrintf("attribute name different: attr_name=%s, should be %s\n",attr_name,ATTR1_NAME); /* Verify Name with too small of a buffer */ name_len=H5Aget_name(attr,HDstrlen(ATTR1_NAME), attr_name); VERIFY(name_len, HDstrlen(ATTR1_NAME), "H5Aget_name"); 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++; - } /* end if */ + if(HDstrcmp(attr_name,temp_name)) + TestErrPrintf("attribute name different: attr_name=%s, should be %s\n",attr_name,temp_name); /* Close attribute */ ret=H5Aclose(attr); @@ -1008,14 +981,10 @@ test_attr_mult_read(void) VERIFY(rank, ATTR2_RANK, "H5Sget_simple_extent_ndims"); 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++; - } /* 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++; - } /* end if */ + if(dims[0]!=ATTR2_DIM1) + TestErrPrintf("attribute dimensions different: dims[0]=%d, should be %d\n",(int)dims[0],ATTR2_DIM1); + if(dims[1]!=ATTR2_DIM2) + TestErrPrintf("attribute dimensions different: dims[1]=%d, should be %d\n",(int)dims[1],ATTR2_DIM2); H5Sclose(space); /* Verify Datatype */ @@ -1036,28 +1005,22 @@ test_attr_mult_read(void) /* Verify values read in */ 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++; - } /* end if */ + if(attr_data2[i][j]!=read_data2[i][j]) + 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]); /* 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++; - } /* end if */ + if(HDstrcmp(attr_name,ATTR2_NAME)) + TestErrPrintf("attribute name different: attr_name=%s, should be %s\n",attr_name,ATTR2_NAME); /* Verify Name with too small of a buffer */ name_len=H5Aget_name(attr,HDstrlen(ATTR2_NAME), attr_name); VERIFY(name_len, HDstrlen(ATTR2_NAME), "H5Aget_name"); 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++; - } /* end if */ + if(HDstrcmp(attr_name,temp_name)) + TestErrPrintf("attribute name different: attr_name=%s, should be %s\n",attr_name,temp_name); /* Close attribute */ ret=H5Aclose(attr); @@ -1074,18 +1037,12 @@ test_attr_mult_read(void) VERIFY(rank, ATTR3_RANK, "H5Sget_simple_extent_ndims"); 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++; - } /* 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++; - } /* 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++; - } /* end if */ + if(dims[0]!=ATTR3_DIM1) + TestErrPrintf("attribute dimensions different: dims[0]=%d, should be %d\n",(int)dims[0],ATTR3_DIM1); + if(dims[1]!=ATTR3_DIM2) + TestErrPrintf("attribute dimensions different: dims[1]=%d, should be %d\n",(int)dims[1],ATTR3_DIM2); + if(dims[2]!=ATTR3_DIM3) + TestErrPrintf("attribute dimensions different: dims[2]=%d, should be %d\n",(int)dims[2],ATTR3_DIM3); H5Sclose(space); /* Verify Datatype */ @@ -1107,28 +1064,22 @@ test_attr_mult_read(void) for(i=0; i<ATTR3_DIM1; i++) 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++; - } /* end if */ + if(attr_data3[i][j][k]!=read_data3[i][j][k]) + 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]); /* 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++; - } /* end if */ + if(HDstrcmp(attr_name,ATTR3_NAME)) + TestErrPrintf("attribute name different: attr_name=%s, should be %s\n",attr_name,ATTR3_NAME); /* Verify Name with too small of a buffer */ name_len=H5Aget_name(attr,HDstrlen(ATTR3_NAME), attr_name); VERIFY(name_len, HDstrlen(ATTR3_NAME), "H5Aget_name"); 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++; - } /* end if */ + if(HDstrcmp(attr_name,temp_name)) + TestErrPrintf("attribute name different: attr_name=%s, should be %s\n",attr_name,temp_name); /* Close attribute */ ret=H5Aclose(attr); @@ -1155,26 +1106,20 @@ 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++; - } /* end if */ + if(HDstrcmp(name,ATTR1_NAME)) + TestErrPrintf("attribute name different: name=%s, should be %s\n",name,ATTR1_NAME); (*count)++; break; case 1: - if(HDstrcmp(name,ATTR2_NAME)) { - printf("attribute name different: name=%s, should be %s\n",name,ATTR2_NAME); - num_errs++; - } /* end if */ + if(HDstrcmp(name,ATTR2_NAME)) + TestErrPrintf("attribute name different: name=%s, should be %s\n",name,ATTR2_NAME); (*count)++; break; case 2: - if(HDstrcmp(name,ATTR3_NAME)) { - printf("attribute name different: name=%s, should be %s\n",name,ATTR3_NAME); - num_errs++; - } /* end if */ + if(HDstrcmp(name,ATTR3_NAME)) + TestErrPrintf("attribute name different: name=%s, should be %s\n",name,ATTR3_NAME); (*count)++; break; @@ -1310,10 +1255,8 @@ test_attr_delete(void) /* 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++; - } /* end if */ + if(HDstrcmp(attr_name,ATTR1_NAME)) + TestErrPrintf("attribute name different: attr_name=%s, should be %s\n",attr_name,ATTR1_NAME); /* Close attribute */ ret=H5Aclose(attr); @@ -1326,10 +1269,8 @@ test_attr_delete(void) /* 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++; - } /* end if */ + if(HDstrcmp(attr_name,ATTR3_NAME)) + TestErrPrintf("attribute name different: attr_name=%s, should be %s\n",attr_name,ATTR3_NAME); /* Close attribute */ ret=H5Aclose(attr); @@ -1350,10 +1291,8 @@ test_attr_delete(void) /* 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++; - } /* end if */ + if(HDstrcmp(attr_name,ATTR3_NAME)) + TestErrPrintf("attribute name different: attr_name=%s, should be %s\n",attr_name,ATTR3_NAME); /* Close attribute */ ret=H5Aclose(attr); @@ -1410,10 +1349,8 @@ 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++; - } /* end if */ + if(empty_filesize==0) + TestErrPrintf("Line %d: file size wrong!\n",__LINE__); /* Re-open file */ file_id=H5Fopen(FILENAME,H5F_ACC_RDWR,H5P_DEFAULT); diff --git a/test/tconfig.c b/test/tconfig.c index 4cb3976..218c060 100644 --- a/test/tconfig.c +++ b/test/tconfig.c @@ -12,8 +12,6 @@ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* $Id$ */ - /*********************************************************** * * Test program: tconfig @@ -29,9 +27,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 550ea81..ea3be51 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; @@ -296,3 +298,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 e213b19..b368ad2 100644 --- a/test/testhdf5.c +++ b/test/testhdf5.c @@ -33,10 +33,6 @@ */ -#include "h5test.h" - -#define HDF5_TEST_MASTER - /* ANY new test needs to have a prototype in testhdf5.h */ #include "testhdf5.h" @@ -86,5 +82,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 156aa78..5a12cc1 100644 --- a/test/testhdf5.h +++ b/test/testhdf5.h @@ -29,159 +29,142 @@ /* 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 */ #ifdef H5_WANT_H5_V1_6_COMPAT #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 " \ - "in %s\n", where, (long)(ret), (int)__LINE__, __FILE__); \ - num_errs++; \ + if ((ret) == (val)) { \ + TestErrPrintf("*** UNEXPECTED RETURN from %s is %ld at line %4d " \ + "in %s\n", where, (long)(ret), (int)__LINE__, __FILE__); \ 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)); \ + "%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 " \ - "in %s\n", (where), (long)(val), (long)(x), (int)__LINE__, __FILE__); \ + 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)); \ + "%ld\n", func, (int)__LINE__, __FILE__, (long)(ret)); \ } \ - if (Verbosity>9) HEEprint(stdout); \ - if ((ret) == FAIL) { \ - print_func("*** UNEXPECTED RETURN from %s is %ld at line %4d " \ - "in %s\n", func, (long)(ret), (int)__LINE__, __FILE__); \ + if (GetTestVerbosity()>9) \ + H5Eprint(stdout); \ + if ((ret) == FAIL) { \ + 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) #else #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 " \ - "in %s\n", where, (long)(ret), (int)__LINE__, __FILE__); \ - num_errs++; \ - H5Eprint (H5E_DEFAULT, stdout); \ + if ((ret) == (val)) { \ + TestErrPrintf("*** UNEXPECTED RETURN from %s is %ld at line %4d " \ + "in %s\n", where, (long)(ret), (int)__LINE__, __FILE__); \ + H5Eprint (H5E_DEFAULT, 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 (H5E_DEFAULT, stdout); \ - num_errs++; \ + H5Eprint (H5E_DEFAULT, stdout); \ } \ } #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 (H5E_DEFAULT, stdout); \ - num_errs++; \ + H5Eprint (H5E_DEFAULT, stdout); \ } \ } /* 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)); \ + "%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 " \ - "in %s\n", (where), (long)(val), (long)(x), (int)__LINE__, __FILE__); \ - H5Eprint (H5E_DEFAULT, stdout); \ - num_errs++; \ + 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 (H5E_DEFAULT, stdout); \ } \ } 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)); \ + "%ld\n", func, (int)__LINE__, __FILE__, (long)(ret)); \ } \ - if (Verbosity>9) H5Eprint(H5E_DEFAULT, stdout); \ - if ((ret) == FAIL) { \ - print_func("*** UNEXPECTED RETURN from %s is %ld at line %4d " \ - "in %s\n", func, (long)(ret), (int)__LINE__, __FILE__); \ - H5Eprint (H5E_DEFAULT, stdout); \ - num_errs++; \ + if (GetTestVerbosity()>9) \ + H5Eprint(H5E_DEFAULT, stdout); \ + if ((ret) == FAIL) { \ + TestErrPrintf("*** UNEXPECTED RETURN from %s is %ld at line %4d " \ + "in %s\n", func, (long)(ret), (int)__LINE__, __FILE__); \ + H5Eprint (H5E_DEFAULT, stdout); \ } \ } while(0) #endif /* H5_WANT_H5_V1_6_COMPAT */ /* 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" @@ -189,6 +172,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), @@ -199,6 +186,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); @@ -238,4 +228,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 79836de..06f89ab 100644 --- a/test/tgenprop.c +++ b/test/tgenprop.c @@ -85,10 +85,8 @@ test_genprop_basic_class(void) /* Check class name */ 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); - } /* end if */ + if(HDstrcmp(name,CLASS1_NAME)!=0) + TestErrPrintf("Class names don't match!, name=%s, CLASS1_NAME=%s\n",name,CLASS1_NAME); free(name); /* Check class parent */ @@ -118,10 +116,8 @@ test_genprop_basic_class(void) /* Check class name */ 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); - } /* end if */ + if(HDstrcmp(name,CLASS2_NAME)!=0) + TestErrPrintf("Class names don't match!, name=%s, CLASS2_NAME=%s\n",name,CLASS2_NAME); free(name); /* Check class parent */ @@ -758,10 +754,8 @@ test_genprop_basic_list_prop(void) /* Check values of temporary properties (set with regular values) */ 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__); - } /* end if */ + if(HDmemcmp(&prop3_value,PROP3_DEF_VALUE,PROP3_SIZE)!=0) + TestErrPrintf("Property #3 doesn't match!, line=%d\n",__LINE__); ret = H5Pget(lid1,PROP4_NAME,&prop4_value); CHECK_I(ret, "H5Pget"); VERIFY(prop4_value, *PROP4_DEF_VALUE, "H5Pget"); @@ -1186,14 +1180,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__); - } /* 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__); - } /* end if */ + if(HDstrcmp(prop1_cb_info.crt_name,PROP1_NAME)!=0) + TestErrPrintf("Property #1 name doesn't match!, line=%d\n",__LINE__); + if(HDmemcmp(prop1_cb_info.crt_value,PROP1_DEF_VALUE,PROP1_SIZE)!=0) + TestErrPrintf("Property #1 value doesn't match!, line=%d\n",__LINE__); /* Check values of permanent properties (set with default values) */ ret = H5Pget(lid1,PROP1_NAME,&prop1_value); @@ -1206,10 +1196,8 @@ test_genprop_list_callback(void) /* Check values of temporary properties (set with regular values) */ 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__); - } /* end if */ + if(HDmemcmp(&prop3_value,PROP3_DEF_VALUE,PROP3_SIZE)!=0) + TestErrPrintf("Property #3 doesn't match!, line=%d\n",__LINE__); ret = H5Pget(lid1,PROP4_NAME,&prop4_value); CHECK_I(ret, "H5Pget"); VERIFY(prop4_value, *PROP4_DEF_VALUE, "H5Pget"); @@ -1217,14 +1205,10 @@ test_genprop_list_callback(void) /* Verify get callback information for properties tracked */ 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__); - } /* 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__); - } /* end if */ + if(HDstrcmp(prop1_cb_info.get_name,PROP1_NAME)!=0) + TestErrPrintf("Property #1 name doesn't match!, line=%d\n",__LINE__); + if(HDmemcmp(prop1_cb_info.get_value,PROP1_DEF_VALUE,PROP1_SIZE)!=0) + TestErrPrintf("Property #1 value doesn't match!, line=%d\n",__LINE__); /* Set value of property #1 to different value */ ret = H5Pset(lid1,PROP1_NAME,&prop1_new_value); @@ -1233,14 +1217,10 @@ test_genprop_list_callback(void) /* Verify set callback information for properties tracked */ 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__); - } /* 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__); - } /* end if */ + if(HDstrcmp(prop1_cb_info.set_name,PROP1_NAME)!=0) + TestErrPrintf("Property #1 name doesn't match!, line=%d\n",__LINE__); + if(HDmemcmp(prop1_cb_info.set_value,&prop1_new_value,PROP1_SIZE)!=0) + TestErrPrintf("Property #1 value doesn't match!, line=%d\n",__LINE__); /* Check new value of tracked properties */ ret = H5Pget(lid1,PROP1_NAME,&prop1_value); @@ -1250,14 +1230,10 @@ test_genprop_list_callback(void) /* Verify get callback information again for properties tracked */ 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__); - } /* 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__); - } /* end if */ + if(HDstrcmp(prop1_cb_info.get_name,PROP1_NAME)!=0) + TestErrPrintf("Property #1 name doesn't match!, line=%d\n",__LINE__); + if(HDmemcmp(prop1_cb_info.get_value,&prop1_new_value,PROP1_SIZE)!=0) + TestErrPrintf("Property #1 value doesn't match!, line=%d\n",__LINE__); /* Delete property #2 */ ret = H5Premove(lid1,PROP2_NAME); @@ -1266,14 +1242,10 @@ test_genprop_list_callback(void) /* Verify delete callback information for properties tracked */ 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__); - } /* 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__); - } /* end if */ + if(HDstrcmp(prop2_cb_info.del_name,PROP2_NAME)!=0) + TestErrPrintf("Property #2 name doesn't match!, line=%d\n",__LINE__); + if(HDmemcmp(prop2_cb_info.del_value,PROP2_DEF_VALUE,PROP2_SIZE)!=0) + TestErrPrintf("Property #2 value doesn't match!, line=%d\n",__LINE__); /* Copy first list */ lid2 = H5Pcopy(lid1); @@ -1281,14 +1253,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__); - } /* 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__); - } /* end if */ + if(HDstrcmp(prop1_cb_info.cop_name,PROP1_NAME)!=0) + TestErrPrintf("Property #1 name doesn't match!, line=%d\n",__LINE__); + if(HDmemcmp(prop1_cb_info.cop_value,&prop1_new_value,PROP1_SIZE)!=0) + TestErrPrintf("Property #1 value doesn't match!, line=%d\n",__LINE__); /* Verify that the class creation callback occurred */ VERIFY(cop_cb_struct.count, 1, "H5Pcopy"); @@ -1309,14 +1277,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__); - } /* 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__); - } /* end if */ + if(HDstrcmp(prop1_cb_info.cls_name,PROP1_NAME)!=0) + TestErrPrintf("Property #1 name doesn't match!, line=%d\n",__LINE__); + if(HDmemcmp(prop1_cb_info.cls_value,&prop1_new_value,PROP1_SIZE)!=0) + TestErrPrintf("Property #1 value doesn't match!, line=%d\n",__LINE__); /* Close second list */ ret = H5Pclose(lid2); @@ -1604,11 +1568,9 @@ test_genprop_path(void) /* Get full path for first class */ 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); - } /* end if */ - free(path); + if(HDstrcmp(path,CLASS1_PATH)!=0) + TestErrPrintf("Class names don't match!, path=%s, CLASS1_PATH=%s\n",path,CLASS1_PATH); + HDfree(path); /* Create another new generic class, derived from first class */ cid2 = H5Pcreate_class(cid1,CLASS2_NAME,NULL,NULL,NULL,NULL,NULL,NULL); @@ -1625,10 +1587,8 @@ test_genprop_path(void) /* Get full path for second class */ 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); - } /* end if */ + if(HDstrcmp(path,CLASS2_PATH)!=0) + TestErrPrintf("Class names don't match!, path=%s, CLASS2_PATH=%s\n",path,CLASS2_PATH); /* Open a copy of the class with the path name */ cid3 = H5P_open_class_path_test(path); @@ -1691,11 +1651,9 @@ test_genprop_refcount(void) /* Check class name */ 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); - } /* end if */ - free(name); + if(HDstrcmp(name,CLASS1_NAME)!=0) + TestErrPrintf("Class names don't match!, name=%s, CLASS1_NAME=%s\n",name,CLASS1_NAME); + HDfree(name); /* Close class */ ret = H5Pclose_class(cid1); @@ -1712,11 +1670,9 @@ test_genprop_refcount(void) /* Check class name */ 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); - } /* end if */ - free(name); + if(HDstrcmp(name,CLASS1_NAME)!=0) + TestErrPrintf("Class names don't match!, name=%s, CLASS1_NAME=%s\n",name,CLASS1_NAME); + HDfree(name); /* Close list */ ret = H5Pclose(lid1); @@ -1725,11 +1681,9 @@ test_genprop_refcount(void) /* Check class name */ 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); - } /* end if */ - free(name); + if(HDstrcmp(name,CLASS1_NAME)!=0) + TestErrPrintf("Class names don't match!, name=%s, CLASS1_NAME=%s\n",name,CLASS1_NAME); + HDfree(name); /* Close class */ ret = H5Pclose_class(cid1); diff --git a/test/th5s.c b/test/th5s.c index e8185db..2f8a19a 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 */ @@ -549,10 +548,8 @@ 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]); - } /* end if */ + if(chunk_data_dbl[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 for */ } /* end for */ } /* test_h5s_chunk() */ diff --git a/test/theap.c b/test/theap.c index b02055e..86e0893 100644 --- a/test/theap.c +++ b/test/theap.c @@ -593,16 +593,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); - } /* end if */ + if(val>last_val) + TestErrPrintf("Error on line %d: incorrect value from heap=%d, last_val=%d\n",__LINE__,val,last_val); } /* 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); - } /* end if */ + if(val<last_val) + TestErrPrintf("Error on line %d: incorrect value from heap=%d, last_val=%d\n",__LINE__,val,last_val); } /* end else */ /* Update last value */ @@ -640,16 +636,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); - } /* end if */ + if(val>last_val) + TestErrPrintf("Error on line %d: incorrect value from heap=%d, last_val=%d\n",__LINE__,val,last_val); } /* 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); - } /* end if */ + if(val<last_val) + TestErrPrintf("Error on line %d: incorrect value from heap=%d, last_val=%d\n",__LINE__,val,last_val); } /* end else */ /* Update last value */ diff --git a/test/titerate.c b/test/titerate.c index 1624196..7aaaf5f 100644 --- a/test/titerate.c +++ b/test/titerate.c @@ -178,7 +178,7 @@ static void test_iter_group(void) CHECK(ret, FAIL, "H5Fclose"); /* Sort the dataset names */ - qsort(dnames,NDATASETS,sizeof(char *),iter_strcmp); + HDqsort(dnames,NDATASETS,sizeof(char *),iter_strcmp); /* Iterate through the datasets in the root group in various ways */ @@ -265,10 +265,8 @@ static void test_iter_group(void) /* Test all objects in group, when callback always returns 0 */ 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++; - } + if((ret=H5Giterate(file,"/",&idx,giter_cb,&info))>0) + TestErrPrintf("Group iteration function didn't return zero correctly!\n"); /* Test all objects in group, when callback always returns 1 */ /* This also tests the "restarting" ability, because the index changes */ @@ -286,34 +284,24 @@ 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++; - } /* end if */ + if(HDstrcmp(info.name,dnames[idx-1])!=0) + TestErrPrintf("Group iteration function didn't return one correctly for dataset #%d!\n",idx); } /* 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++; - } /* end if */ + if(HDstrcmp(info.name,"dtype")!=0) + TestErrPrintf("Group iteration function didn't return one correctly for group!\n"); } /* 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++; - } /* end if */ + if(HDstrcmp(info.name,"grp")!=0) + TestErrPrintf("Group iteration function didn't return one correctly for group!\n"); } /* end if */ - else { - printf("Group iteration function walked too far!\n"); - num_errs++; - } /* end else */ + else + TestErrPrintf("Group iteration function walked too far!\n"); } VERIFY(ret,-1,"H5Giterate"); - if(i!=(NDATASETS+2)) { - printf("Group iteration function didn't perform multiple iterations correctly!\n"); - num_errs++; - } /* end if */ + if(i!=(NDATASETS+2)) + TestErrPrintf("Group iteration function didn't perform multiple iterations correctly!\n"); /* Test all objects in group, when callback changes return value */ /* This also tests the "restarting" ability, because the index changes */ @@ -331,41 +319,31 @@ 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++; - } /* end if */ + if(HDstrcmp(info.name,dnames[idx-1])!=0) + TestErrPrintf("Group iteration function didn't return one correctly for dataset #%d!\n",idx); } /* 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++; - } /* end if */ + if(HDstrcmp(info.name,"dtype")!=0) + TestErrPrintf("Group iteration function didn't return one correctly for group!\n"); } /* 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++; - } /* end if */ + if(HDstrcmp(info.name,"grp")!=0) + TestErrPrintf("Group iteration function didn't return one correctly for group!\n"); } /* end if */ - else { - printf("Group iteration function walked too far!\n"); - num_errs++; - } /* end else */ + else + TestErrPrintf("Group iteration function walked too far!\n"); } VERIFY(ret,-1,"H5Giterate"); - if(i!=42 || idx!=52) { - printf("Group iteration function didn't perform multiple iterations correctly!\n"); - num_errs++; - } /* end if */ + if(i!=42 || idx!=52) + TestErrPrintf("Group iteration function didn't perform multiple iterations correctly!\n"); ret=H5Fclose(file); CHECK(ret, FAIL, "H5Fclose"); /* Free the dataset names */ for(i=0; i< NDATASETS; i++) - free(dnames[i]); + HDfree(dnames[i]); } /* test_iter_group() */ @@ -486,10 +464,8 @@ static void test_iter_attr(void) /* Test all attributes on dataset, when callback always returns 0 */ 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++; - } + if((ret=H5Aiterate(dataset,&idx,aiter_cb,&info))>0) + TestErrPrintf("Attribute iteration function didn't return zero correctly!\n"); /* Test all attributes on dataset, when callback always returns 1 */ /* This also tests the "restarting" ability, because the index changes */ @@ -506,16 +482,12 @@ static void test_iter_attr(void) VERIFY(idx,(unsigned)i,"H5Aiterate"); /* 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++; - } /* end if */ + if(HDstrcmp(info.name,anames[idx-1])!=0) + TestErrPrintf("Attribute iteration function didn't return one correctly!\n"); } VERIFY(ret,-1,"H5Aiterate"); - if(i!=50 || idx!=50) { - printf("Group iteration function didn't perform multiple iterations correctly!\n"); - num_errs++; - } /* end if */ + if(i!=50 || idx!=50) + TestErrPrintf("Group iteration function didn't perform multiple iterations correctly!\n"); /* Test all attributes on dataset, when callback changes return value */ @@ -533,16 +505,12 @@ static void test_iter_attr(void) VERIFY(idx,(unsigned)i+10,"H5Aiterate"); /* 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++; - } /* end if */ + if(HDstrcmp(info.name,anames[idx-1])!=0) + TestErrPrintf("Attribute iteration function didn't return changing correctly!\n"); } VERIFY(ret,-1,"H5Aiterate"); - if(i!=40 || idx!=50) { - printf("Group iteration function didn't perform multiple iterations correctly!\n"); - num_errs++; - } /* end if */ + if(i!=40 || idx!=50) + TestErrPrintf("Group iteration function didn't perform multiple iterations correctly!\n"); ret=H5Fclose(file); CHECK(ret, FAIL, "H5Fclose"); @@ -552,7 +520,7 @@ static void test_iter_attr(void) /* Free the attribute names */ for(i=0; i< NATTR; i++) - free(anames[i]); + HDfree(anames[i]); } /* test_iter_attr() */ @@ -577,9 +545,8 @@ herr_t giter_cb2(hid_t loc_id, const char *name, void *opdata) herr_t ret; /* Generic return value */ H5G_stat_t statbuf; - if(strcmp(name,test_info->name)) { - num_errs++; - printf("name=%s, test_info=%s\n",name,test_info->name); + if(HDstrcmp(name,test_info->name)) { + TestErrPrintf("name=%s, test_info=%s\n",name,test_info->name); return(-1); } /* end if */ @@ -590,8 +557,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..a78859f 100644 --- a/test/tmeta.c +++ b/test/tmeta.c @@ -81,10 +81,8 @@ test_metadata(void) unsigned u; /* local counting variable */ 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++; - } /* end if */ + if (compar_buffer[u] != encode_buffer[u]) + TestErrPrintf("Error encoding meta-data at offset %u, wanted: %u, got: %u\n", (unsigned) u, (unsigned) compar_buffer[u], (unsigned) encode_buffer[u]); } /* end for */ } /* end if */ /* Test decoding macros */ @@ -95,30 +93,22 @@ test_metadata(void) UINT32DECODE(p, du32); /* Decode the uint32 value */ /* Check the values decoded */ - if (di16 != TEST_INT16_VALUE) { - print_func("Error decoding int16 meta-data wanted: %d, got: %d " + if (di16 != TEST_INT16_VALUE) + 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 " + if (du16 != TEST_UINT16_VALUE) + 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 " + if (di32 != TEST_INT32_VALUE) + 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 " + if (du32 != TEST_UINT32_VALUE) + 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 4bfbde4..519000a 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -571,14 +571,10 @@ test_misc4(void) VERIFY(stat1.fileno,stat2.fileno,"H5Gget_objinfo"); /* Verify that the fileno values are not the same between file1 & file2 */ - if(stat1.fileno==stat3.fileno) { - num_errs++; - printf("Error on line %d: stat1.fileno==stat3.fileno\n",__LINE__); - } /* end if */ - if(stat2.fileno==stat3.fileno) { - num_errs++; - printf("Error on line %d: stat1.fileno==stat3.fileno\n",__LINE__); - } /* end if */ + if(stat1.fileno==stat3.fileno) + TestErrPrintf("Error on line %d: stat1.fileno==stat3.fileno\n",__LINE__); + if(stat2.fileno==stat3.fileno) + TestErrPrintf("Error on line %d: stat1.fileno==stat3.fileno\n",__LINE__); /* Close the objects */ ret = H5Gclose(group1); @@ -1401,10 +1397,8 @@ test_misc8(void) tdata2=rdata; 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); - } + if(*tdata!=*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 */ /* Check the storage size after data is written */ @@ -1439,15 +1433,11 @@ test_misc8(void) storage_size=H5Dget_storage_size(did); 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); - } + if(storage_size>=(MISC8_DIM0*MISC8_DIM1*H5Tget_size(H5T_NATIVE_INT))) + 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); - } + if(storage_size!=(MISC8_DIM0*MISC8_DIM1*H5Tget_size(H5T_NATIVE_INT))) + TestErrPrintf("Error on line %d: wrong storage size! storage_size=%u\n",__LINE__,(unsigned)storage_size); #endif /* H5_HAVE_FILTER_DEFLATE */ /* Close dataset ID */ @@ -1475,15 +1465,11 @@ test_misc8(void) storage_size=H5Dget_storage_size(did); 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); - } + if(storage_size>=(MISC8_DIM0*MISC8_DIM1*H5Tget_size(H5T_NATIVE_INT))) + 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); - } + if(storage_size!=(MISC8_DIM0*MISC8_DIM1*H5Tget_size(H5T_NATIVE_INT))) + TestErrPrintf("Error on line %d: wrong storage size! storage_size=%u\n",__LINE__,(unsigned)storage_size); #endif /* H5_HAVE_FILTER_DEFLATE */ /* Write entire dataset */ @@ -1500,25 +1486,19 @@ test_misc8(void) tdata2=rdata; 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); - } + if(*tdata!=*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 */ /* Check the storage size after data is written */ storage_size=H5Dget_storage_size(did); 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); - } + if(storage_size>=(MISC8_DIM0*MISC8_DIM1*H5Tget_size(H5T_NATIVE_INT))) + 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); - } + if(storage_size!=(MISC8_DIM0*MISC8_DIM1*H5Tget_size(H5T_NATIVE_INT))) + TestErrPrintf("Error on line %d: wrong storage size! storage_size=%u\n",__LINE__,(unsigned)storage_size); #endif /*H5_HAVE_FILTER_DEFLATE*/ /* Close dataset ID */ @@ -1545,15 +1525,11 @@ test_misc8(void) storage_size=H5Dget_storage_size(did); 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); - } + if(storage_size>=(4*MISC8_CHUNK_DIM0*MISC8_CHUNK_DIM1*H5Tget_size(H5T_NATIVE_INT))) + 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); - } + if(storage_size!=(4*MISC8_CHUNK_DIM0*MISC8_CHUNK_DIM1*H5Tget_size(H5T_NATIVE_INT))) + TestErrPrintf("Error on line %d: wrong storage size! storage_size=%u\n",__LINE__,(unsigned)storage_size); #endif /* H5_HAVE_FILTER_DEFLATE */ /* Write entire dataset */ @@ -1570,25 +1546,19 @@ test_misc8(void) tdata2=rdata; 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); - } + if(*tdata!=*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 */ /* Check the storage size after data is written */ storage_size=H5Dget_storage_size(did); 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); - } + if(storage_size>=(MISC8_DIM0*MISC8_DIM1*H5Tget_size(H5T_NATIVE_INT))) + 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); - } + if(storage_size!=(MISC8_DIM0*MISC8_DIM1*H5Tget_size(H5T_NATIVE_INT))) + TestErrPrintf("Error on line %d: wrong storage size! storage_size=%u\n",__LINE__,(unsigned)storage_size); #endif /*H5_HAVE_FILTER_DEFLATE*/ /* Close dataset ID */ @@ -1978,15 +1948,11 @@ test_misc12(void) CHECK(ret, FAIL, "H5Dread"); 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]); - } /* end if */ + if(HDstrcmp(wdata[i],rdata[i])) + TestErrPrintf("Error on line %d: wdata[%d]=%s, rdata[%d]=%s\n",__LINE__,i,wdata[i],i,rdata[i]); 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]); - } /* end if */ + if(HDstrcmp(wdata1[i-MISC12_SPACE1_DIM1],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]); /* Reclaim VL data memory */ ret = H5Dvlen_reclaim (tid1, sid1, H5P_DEFAULT, rdata); @@ -2424,10 +2390,8 @@ test_misc14(void) /* Check data from first dataset */ 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__); - } /* end if */ + if(rdata!=data1) + TestErrPrintf("Error on line %d: data1!=rdata\n",__LINE__); /* Unlink second dataset */ ret = H5Gunlink(file_id, MISC14_DSET2_NAME); @@ -2440,10 +2404,8 @@ test_misc14(void) /* Verify the data from dataset #1 */ 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__); - } /* end if */ + if(rdata!=data1) + TestErrPrintf("Error on line %d: data1!=rdata\n",__LINE__); /* Close first dataset */ ret = H5Dclose(Dataset1); @@ -2476,10 +2438,8 @@ test_misc14(void) /* Check data from second dataset */ 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__); - } /* end if */ + if(rdata!=data2) + TestErrPrintf("Error on line %d: data2!=rdata\n",__LINE__); /* Unlink first dataset */ ret = H5Gunlink(file_id, MISC14_DSET1_NAME); @@ -2492,10 +2452,8 @@ test_misc14(void) /* Verify the data from dataset #2 */ 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__); - } /* end if */ + if(rdata!=data2) + TestErrPrintf("Error on line %d: data2!=rdata\n",__LINE__); /* Close second dataset */ ret = H5Dclose(Dataset2); @@ -2535,18 +2493,14 @@ test_misc14(void) /* Check data from first dataset */ 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__); - } /* end if */ + if(rdata!=data1) + TestErrPrintf("Error on line %d: data1!=rdata\n",__LINE__); /* 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__); - } /* end if */ + if(rdata!=data3) + TestErrPrintf("Error on line %d: data3!=rdata\n",__LINE__); /* Unlink second dataset */ ret = H5Gunlink(file_id, MISC14_DSET2_NAME); @@ -2559,18 +2513,14 @@ test_misc14(void) /* Verify the data from dataset #1 */ 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__); - } /* end if */ + if(rdata!=data1) + TestErrPrintf("Error on line %d: data1!=rdata\n",__LINE__); /* 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__); - } /* end if */ + if(rdata!=data3) + TestErrPrintf("Error on line %d: data3!=rdata\n",__LINE__); /* Close first dataset */ ret = H5Dclose(Dataset1); @@ -2696,14 +2646,12 @@ 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])); + if(HDstrlen(wdata[i])!=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]); + if( HDstrcmp(wdata[i],rdata[i]) != 0 ) { + 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 */ @@ -2774,14 +2722,12 @@ 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])); + if(HDstrlen(wdata[i])!=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]); + if( HDstrcmp(wdata[i],rdata[i]) != 0 ) { + 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 6183c88..21877ee 100644 --- a/test/trefer.c +++ b/test/trefer.c @@ -12,8 +12,6 @@ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* $Id$ */ - /*********************************************************** * * Test program: trefer @@ -242,10 +240,8 @@ test_reference_obj(void) CHECK(ret, FAIL, "H5Gget_comment"); /* 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)); - } + if(HDstrcmp(write_comment,read_comment)!=0) + TestErrPrintf("Error! Incorrect group comment, wanted: %s, got: %s\n",write_comment,read_comment); /* Close group */ ret = H5Gclose(group); diff --git a/test/trefstr.c b/test/trefstr.c index 5ba0371..a278ebc 100644 --- a/test/trefstr.c +++ b/test/trefstr.c @@ -207,10 +207,8 @@ test_refstr_cmp(void) cmp=H5RS_cmp(rs2,rs2); VERIFY(cmp, 0, "H5RS_cmp"); cmp=H5RS_cmp(rs1,rs2); - if(cmp>=0) { - num_errs++; - printf("%d: string comparison incorrect!\n",__LINE__); - } /* end if */ + if(cmp>=0) + TestErrPrintf("%d: string comparison incorrect!\n",__LINE__); /* Check the lengths of the strings also */ len=H5RS_len(rs1); @@ -270,10 +268,8 @@ test_refstr_wrap(void) CHECK(s, NULL, "H5RS_get_str"); CHECK(s, buf, "wrapping"); cmp=HDstrcmp(s,buf); - if(cmp<=0) { - num_errs++; - printf("%d: string comparison incorrect!\n",__LINE__); - } /* end if */ + if(cmp<=0) + TestErrPrintf("%d: string comparison incorrect!\n",__LINE__); /* Decrement reference count for string */ ret=H5RS_decr(rs); diff --git a/test/tselect.c b/test/tselect.c index 0d42dbb..228002c 100644 --- a/test/tselect.c +++ b/test/tselect.c @@ -858,8 +858,8 @@ test_select_combo(void) MESSAGE(5, ("Testing Combination of Hyperslab & Element Selection Functions\n")); /* Allocate write & read buffers */ - wbuf=malloc(sizeof(uint8_t)*SPACE2_DIM1*SPACE2_DIM2); - rbuf=calloc(sizeof(uint8_t),SPACE3_DIM1*SPACE3_DIM2); + wbuf=HDmalloc(sizeof(uint8_t)*SPACE2_DIM1*SPACE2_DIM2); + rbuf=HDcalloc(sizeof(uint8_t),SPACE3_DIM1*SPACE3_DIM2); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++) @@ -931,10 +931,8 @@ test_select_combo(void) for(i=0; i<POINT1_NPOINTS; i++) { tbuf=wbuf+i; tbuf2=rbuf+(i*SPACE3_DIM2); - if(*tbuf!=*tbuf2) { - num_errs++; - printf("element values don't match!, i=%d\n",i); - } /* end if */ + if(*tbuf!=*tbuf2) + TestErrPrintf("element values don't match!, i=%d\n",i); } /* end for */ /* Close memory dataspace */ @@ -954,8 +952,8 @@ test_select_combo(void) CHECK(ret, FAIL, "H5Fclose"); /* Free memory buffers */ - free(wbuf); - free(rbuf); + HDfree(wbuf); + HDfree(rbuf); } /* test_select_combo() */ int @@ -1024,8 +1022,8 @@ test_select_hyper_stride(hid_t xfer_plist) MESSAGE(5, ("Testing Hyperslabs with Strides Functionality\n")); /* Allocate write & read buffers */ - wbuf=malloc(sizeof(uint16_t)*SPACE2_DIM1*SPACE2_DIM2); - rbuf=calloc(sizeof(uint16_t),SPACE3_DIM1*SPACE3_DIM2); + wbuf=HDmalloc(sizeof(uint16_t)*SPACE2_DIM1*SPACE2_DIM2); + rbuf=HDcalloc(sizeof(uint16_t),SPACE3_DIM1*SPACE3_DIM2); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++) @@ -1097,8 +1095,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 */ @@ -1119,8 +1116,8 @@ test_select_hyper_stride(hid_t xfer_plist) CHECK(ret, FAIL, "H5Fclose"); /* Free memory buffers */ - free(wbuf); - free(rbuf); + HDfree(wbuf); + HDfree(rbuf); } /* test_select_hyper_stride() */ /**************************************************************** @@ -1150,8 +1147,8 @@ test_select_hyper_contig(hid_t dset_type, hid_t xfer_plist) MESSAGE(5, ("Testing Contiguous Hyperslabs Functionality\n")); /* Allocate write & read buffers */ - wbuf=malloc(sizeof(uint16_t)*SPACE2_DIM1*SPACE2_DIM2); - rbuf=calloc(sizeof(uint16_t),SPACE2_DIM1*SPACE2_DIM2); + wbuf=HDmalloc(sizeof(uint16_t)*SPACE2_DIM1*SPACE2_DIM2); + rbuf=HDcalloc(sizeof(uint16_t),SPACE2_DIM1*SPACE2_DIM2); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++) @@ -1223,8 +1220,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++) @@ -1249,8 +1245,8 @@ test_select_hyper_contig(hid_t dset_type, hid_t xfer_plist) CHECK(ret, FAIL, "H5Fclose"); /* Free memory buffers */ - free(wbuf); - free(rbuf); + HDfree(wbuf); + HDfree(rbuf); } /* test_select_hyper_contig() */ /**************************************************************** @@ -1278,8 +1274,8 @@ test_select_hyper_contig2(hid_t dset_type, hid_t xfer_plist) MESSAGE(5, ("Testing More Contiguous Hyperslabs Functionality\n")); /* Allocate write & read buffers */ - wbuf=malloc(sizeof(uint16_t)*SPACE8_DIM1*SPACE8_DIM2*SPACE8_DIM3*SPACE8_DIM4); - rbuf=calloc(sizeof(uint16_t),SPACE8_DIM1*SPACE8_DIM2*SPACE8_DIM3*SPACE8_DIM4); + wbuf=HDmalloc(sizeof(uint16_t)*SPACE8_DIM1*SPACE8_DIM2*SPACE8_DIM3*SPACE8_DIM4); + rbuf=HDcalloc(sizeof(uint16_t),SPACE8_DIM1*SPACE8_DIM2*SPACE8_DIM3*SPACE8_DIM4); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE8_DIM1; i++) @@ -1345,8 +1341,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++) @@ -1371,8 +1366,8 @@ test_select_hyper_contig2(hid_t dset_type, hid_t xfer_plist) CHECK(ret, FAIL, "H5Fclose"); /* Free memory buffers */ - free(wbuf); - free(rbuf); + HDfree(wbuf); + HDfree(rbuf); } /* test_select_hyper_contig2() */ /**************************************************************** @@ -1403,8 +1398,8 @@ test_select_hyper_contig3(hid_t dset_type, hid_t xfer_plist) MESSAGE(5, ("Testing Yet More Contiguous Hyperslabs Functionality\n")); /* Allocate write & read buffers */ - wbuf=malloc(sizeof(uint16_t)*SPACE8_DIM1*SPACE8_DIM2*SPACE8_DIM3*SPACE8_DIM4); - rbuf=calloc(sizeof(uint16_t),SPACE8_DIM1*SPACE8_DIM2*SPACE8_DIM3*SPACE8_DIM4); + wbuf=HDmalloc(sizeof(uint16_t)*SPACE8_DIM1*SPACE8_DIM2*SPACE8_DIM3*SPACE8_DIM4); + rbuf=HDcalloc(sizeof(uint16_t),SPACE8_DIM1*SPACE8_DIM2*SPACE8_DIM3*SPACE8_DIM4); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE8_DIM4; i++) @@ -1478,16 +1473,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 */ @@ -1508,8 +1501,8 @@ test_select_hyper_contig3(hid_t dset_type, hid_t xfer_plist) CHECK(ret, FAIL, "H5Fclose"); /* Free memory buffers */ - free(wbuf); - free(rbuf); + HDfree(wbuf); + HDfree(rbuf); } /* test_select_hyper_contig3() */ /**************************************************************** @@ -1542,9 +1535,9 @@ test_select_hyper_copy(void) MESSAGE(5, ("Testing Hyperslabs with Strides Functionality\n")); /* Allocate write & read buffers */ - wbuf=malloc(sizeof(uint16_t)*SPACE2_DIM1*SPACE2_DIM2); - rbuf=calloc(sizeof(uint16_t),SPACE3_DIM1*SPACE3_DIM2); - rbuf2=calloc(sizeof(uint16_t),SPACE3_DIM1*SPACE3_DIM2); + wbuf=HDmalloc(sizeof(uint16_t)*SPACE2_DIM1*SPACE2_DIM2); + rbuf=HDcalloc(sizeof(uint16_t),SPACE3_DIM1*SPACE3_DIM2); + rbuf2=HDcalloc(sizeof(uint16_t),SPACE3_DIM1*SPACE3_DIM2); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++) @@ -1631,8 +1624,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++) @@ -1666,9 +1658,9 @@ test_select_hyper_copy(void) CHECK(ret, FAIL, "H5Fclose"); /* Free memory buffers */ - free(wbuf); - free(rbuf); - free(rbuf2); + HDfree(wbuf); + HDfree(rbuf); + HDfree(rbuf2); } /* test_select_hyper_copy() */ /**************************************************************** @@ -1700,9 +1692,9 @@ test_select_point_copy(void) MESSAGE(5, ("Testing Hyperslabs with Strides Functionality\n")); /* Allocate write & read buffers */ - wbuf=malloc(sizeof(uint16_t)*SPACE2_DIM1*SPACE2_DIM2); - rbuf=calloc(sizeof(uint16_t),SPACE3_DIM1*SPACE3_DIM2); - rbuf2=calloc(sizeof(uint16_t),SPACE3_DIM1*SPACE3_DIM2); + wbuf=HDmalloc(sizeof(uint16_t)*SPACE2_DIM1*SPACE2_DIM2); + rbuf=HDcalloc(sizeof(uint16_t),SPACE3_DIM1*SPACE3_DIM2); + rbuf2=HDcalloc(sizeof(uint16_t),SPACE3_DIM1*SPACE3_DIM2); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++) @@ -1806,10 +1798,8 @@ test_select_point_copy(void) CHECK(ret, FAIL, "H5Dread"); /* 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++; - } /* end if */ + if(HDmemcmp(rbuf,rbuf2,sizeof(uint16_t)*SPACE3_DIM1*SPACE3_DIM2)) + TestErrPrintf("point values don't match!\n"); /* Close memory dataspace */ ret = H5Sclose(sid2); @@ -1836,9 +1826,9 @@ test_select_point_copy(void) CHECK(ret, FAIL, "H5Fclose"); /* Free memory buffers */ - free(wbuf); - free(rbuf); - free(rbuf2); + HDfree(wbuf); + HDfree(rbuf); + HDfree(rbuf2); } /* test_select_point_copy() */ /**************************************************************** @@ -1875,8 +1865,8 @@ test_select_hyper_offset(void) MESSAGE(5, ("Testing Hyperslab Selection Functions with Offsets\n")); /* Allocate write & read buffers */ - wbuf=malloc(sizeof(uint8_t)*SPACE2_DIM1*SPACE2_DIM2); - rbuf=calloc(sizeof(uint8_t),SPACE3_DIM1*SPACE3_DIM2); + wbuf=HDmalloc(sizeof(uint8_t)*SPACE2_DIM1*SPACE2_DIM2); + rbuf=HDcalloc(sizeof(uint8_t),SPACE3_DIM1*SPACE3_DIM2); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++) @@ -1975,10 +1965,8 @@ test_select_hyper_offset(void) tbuf=wbuf+((i+5)*SPACE2_DIM2); 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++; - } /* end if */ + if(*tbuf!=*tbuf2) + TestErrPrintf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%u, *tbuf2=%u\n",__LINE__,i,j,(unsigned)*tbuf,(unsigned)*tbuf2); } /* end for */ } /* end for */ @@ -1999,8 +1987,8 @@ test_select_hyper_offset(void) CHECK(ret, FAIL, "H5Fclose"); /* Free memory buffers */ - free(wbuf); - free(rbuf); + HDfree(wbuf); + HDfree(rbuf); } /* test_select_hyper_offset() */ /**************************************************************** @@ -2032,8 +2020,8 @@ test_select_hyper_offset2(void) MESSAGE(5, ("Testing More Hyperslab Selection Functions with Offsets\n")); /* Allocate write & read buffers */ - wbuf=malloc(sizeof(uint8_t)*SPACE7_DIM1*SPACE7_DIM2); - rbuf=calloc(sizeof(uint8_t),SPACE7_DIM1*SPACE7_DIM2); + wbuf=HDmalloc(sizeof(uint8_t)*SPACE7_DIM1*SPACE7_DIM2); + rbuf=HDcalloc(sizeof(uint8_t),SPACE7_DIM1*SPACE7_DIM2); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE7_DIM1; i++) @@ -2094,10 +2082,8 @@ test_select_hyper_offset2(void) tbuf=wbuf+((i+3)*SPACE7_DIM2); 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++; - } /* end if */ + if(*tbuf!=*tbuf2) + TestErrPrintf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%u, *tbuf2=%u\n",__LINE__,i,j,(unsigned)*tbuf,(unsigned)*tbuf2); } /* end for */ } /* end for */ @@ -2118,8 +2104,8 @@ test_select_hyper_offset2(void) CHECK(ret, FAIL, "H5Fclose"); /* Free memory buffers */ - free(wbuf); - free(rbuf); + HDfree(wbuf); + HDfree(rbuf); } /* test_select_hyper_offset2() */ /**************************************************************** @@ -2154,8 +2140,8 @@ test_select_point_offset(void) MESSAGE(5, ("Testing Element Selection Functions\n")); /* Allocate write & read buffers */ - wbuf=malloc(sizeof(uint8_t)*SPACE2_DIM1*SPACE2_DIM2); - rbuf=calloc(sizeof(uint8_t),SPACE3_DIM1*SPACE3_DIM2); + wbuf=HDmalloc(sizeof(uint8_t)*SPACE2_DIM1*SPACE2_DIM2); + rbuf=HDcalloc(sizeof(uint8_t),SPACE3_DIM1*SPACE3_DIM2); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++) @@ -2267,10 +2253,8 @@ test_select_point_offset(void) for(i=0; i<POINT1_NPOINTS; i++) { 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++; - } /* end if */ + if(*tbuf!=*tbuf2) + TestErrPrintf("element values don't match!, i=%d\n",i); } /* end for */ /* Close memory dataspace */ @@ -2290,8 +2274,8 @@ test_select_point_offset(void) CHECK(ret, FAIL, "H5Fclose"); /* Free memory buffers */ - free(wbuf); - free(rbuf); + HDfree(wbuf); + HDfree(rbuf); } /* test_select_point_offset() */ /**************************************************************** @@ -2333,8 +2317,8 @@ test_select_hyper_union(void) MESSAGE(5, ("Testing Hyperslab Selection Functions with unions of hyperslabs\n")); /* Allocate write & read buffers */ - wbuf=malloc(sizeof(uint8_t)*SPACE2_DIM1*SPACE2_DIM2); - rbuf=calloc(sizeof(uint8_t),SPACE3_DIM1*SPACE3_DIM2); + wbuf=HDmalloc(sizeof(uint8_t)*SPACE2_DIM1*SPACE2_DIM2); + rbuf=HDcalloc(sizeof(uint8_t),SPACE3_DIM1*SPACE3_DIM2); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++) @@ -2416,10 +2400,8 @@ test_select_hyper_union(void) tbuf=wbuf+((i+15)*SPACE2_DIM2); 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++; - } /* end if */ + if(*tbuf!=*tbuf2) + TestErrPrintf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%d, *tbuf2=%d\n",__LINE__,i,j,(int)*tbuf,(int)*tbuf2); } /* end for */ } /* end for */ @@ -2511,10 +2493,8 @@ test_select_hyper_union(void) tbuf=wbuf+((i+15)*SPACE2_DIM2); 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++; - } /* end if */ + if(*tbuf!=*tbuf2) + TestErrPrintf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%d, *tbuf2=%d\n",__LINE__,i,j,(int)*tbuf,(int)*tbuf2); } /* end for */ } /* end for */ @@ -2602,10 +2582,8 @@ test_select_hyper_union(void) tbuf=wbuf+((i+15)*SPACE2_DIM2); 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++; - } /* end if */ + if(*tbuf!=*tbuf2) + TestErrPrintf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%d, *tbuf2=%d\n",__LINE__,i,j,(int)*tbuf,(int)*tbuf2); } /* end for */ } /* end for */ @@ -2701,10 +2679,8 @@ test_select_hyper_union(void) tbuf=wbuf+((i+15)*SPACE2_DIM2); 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++; - } /* end if */ + if(*tbuf!=*tbuf2) + TestErrPrintf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%d, *tbuf2=%d\n",__LINE__,i,j,(int)*tbuf,(int)*tbuf2); } /* end for */ } /* end for */ @@ -2787,10 +2763,8 @@ test_select_hyper_union(void) for(i=0,tbuf2=rbuf; i<SPACE2_DIM1; i++) { 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++; - } /* end if */ + if(*tbuf!=*tbuf2) + TestErrPrintf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%d, *tbuf2=%d\n",__LINE__,i,j,(int)*tbuf,(int)*tbuf2); } /* end for */ } /* end for */ @@ -2811,8 +2785,8 @@ test_select_hyper_union(void) CHECK(ret, FAIL, "H5Fclose"); /* Free memory buffers */ - free(wbuf); - free(rbuf); + HDfree(wbuf); + HDfree(rbuf); } /* test_select_hyper_union() */ #ifdef NEW_HYPERSLAB_API @@ -2946,8 +2920,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 */ @@ -3055,8 +3028,8 @@ test_select_hyper_union_3d(void) MESSAGE(5, ("Testing Hyperslab Selection Functions with unions of 3-D hyperslabs\n")); /* Allocate write & read buffers */ - wbuf=malloc(sizeof(uint8_t)*SPACE4_DIM1*SPACE4_DIM2*SPACE4_DIM3); - rbuf=calloc(sizeof(uint8_t),SPACE3_DIM1*SPACE3_DIM2); + wbuf=HDmalloc(sizeof(uint8_t)*SPACE4_DIM1*SPACE4_DIM2*SPACE4_DIM3); + rbuf=HDcalloc(sizeof(uint8_t),SPACE3_DIM1*SPACE3_DIM2); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE4_DIM1; i++) @@ -3145,10 +3118,8 @@ test_select_hyper_union_3d(void) for(i=0,tbuf2=rbuf; i<(int)(sizeof(rows)/sizeof(struct row_list)); i++) { 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++; - } /* end if */ + if(*tbuf!=*tbuf2) + TestErrPrintf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%d, *tbuf2=%d\n",__LINE__,i,j,(int)*tbuf,(int)*tbuf2); } /* end for */ } /* end for */ @@ -3169,8 +3140,8 @@ test_select_hyper_union_3d(void) CHECK(ret, FAIL, "H5Fclose"); /* Free memory buffers */ - free(wbuf); - free(rbuf); + HDfree(wbuf); + HDfree(rbuf); } /* test_select_hyper_union_3d() */ #endif /* NEW_HYPERSLAB_API */ @@ -3585,8 +3556,8 @@ test_select_hyper_nota_2d(void) MESSAGE(5, ("Testing Hyperslab Selection Functions with NOTA of 2-D hyperslabs\n")); /* Allocate write & read buffers */ - wbuf=malloc(sizeof(uint8_t)*SPACE2_DIM1*SPACE2_DIM2); - rbuf=calloc(sizeof(uint8_t),SPACE2_DIM1*SPACE2_DIM2); + wbuf=HDmalloc(sizeof(uint8_t)*SPACE2_DIM1*SPACE2_DIM2); + rbuf=HDcalloc(sizeof(uint8_t),SPACE2_DIM1*SPACE2_DIM2); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++) @@ -3652,12 +3623,12 @@ test_select_hyper_nota_2d(void) if(((i>=10 && i<=14) && (j>=5 && j<=14)) || ((i>=5 && i<=9) && (j>=10 && j<=14))) { 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); + TestErrPrintf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%d, *tbuf2=%d\n",__LINE__,i,j,(int)*tbuf,(int)*tbuf2); tbuf2++; } /* end if */ else { if(*tbuf!=0) - printf("%d: hyperslab element has wrong value!, i=%d, j=%d, *tbuf=%d\n",__LINE__,i,j,(int)*tbuf); + TestErrPrintf("%d: hyperslab element has wrong value!, i=%d, j=%d, *tbuf=%d\n",__LINE__,i,j,(int)*tbuf); } /* end else */ } /* end for */ @@ -3678,8 +3649,8 @@ test_select_hyper_nota_2d(void) CHECK(ret, FAIL, "H5Fclose"); /* Free memory buffers */ - free(wbuf); - free(rbuf); + HDfree(wbuf); + HDfree(rbuf); } /* test_select_hyper_nota_2d() */ /**************************************************************** @@ -3695,8 +3666,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]); @@ -3743,8 +3713,8 @@ test_select_hyper_union_random_5d(hid_t read_plist) MESSAGE(5, ("Testing Hyperslab Selection Functions with random unions of 5-D hyperslabs\n")); /* Allocate write & read buffers */ - wbuf=malloc(sizeof(int)*SPACE5_DIM1*SPACE5_DIM2*SPACE5_DIM3*SPACE5_DIM4*SPACE5_DIM5); - rbuf=calloc(sizeof(int),SPACE5_DIM1*SPACE5_DIM2*SPACE5_DIM3*SPACE5_DIM4*SPACE5_DIM5); + wbuf=HDmalloc(sizeof(int)*SPACE5_DIM1*SPACE5_DIM2*SPACE5_DIM3*SPACE5_DIM4*SPACE5_DIM5); + rbuf=HDcalloc(sizeof(int),SPACE5_DIM1*SPACE5_DIM2*SPACE5_DIM3*SPACE5_DIM4*SPACE5_DIM5); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i<SPACE5_DIM1; i++) @@ -3866,8 +3836,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; } @@ -3892,8 +3861,8 @@ printf("random I/O, after H5Dread()\n"); CHECK(ret, FAIL, "H5Fclose"); /* Free memory buffers */ - free(wbuf); - free(rbuf); + HDfree(wbuf); + HDfree(rbuf); } /* test_select_hyper_union_random_5d() */ /**************************************************************** @@ -3934,8 +3903,8 @@ test_select_hyper_chunk(hid_t fapl_plist, hid_t xfer_plist) MESSAGE(5, ("Testing Hyperslab I/O on Large Chunks\n")); /* Allocate the transfer buffers */ - data = (short*)malloc(sizeof(short)*X*Y*Z); - data_out = (short*)calloc(NX*NY*NZ,sizeof(short)); + data = HDmalloc(sizeof(short)*X*Y*Z); + data_out = HDcalloc(NX*NY*NZ,sizeof(short)); /* * Data buffer initialization. @@ -4107,10 +4076,8 @@ test_select_hyper_chunk(hid_t fapl_plist, hid_t xfer_plist) for (j = 0; j < X; j++) 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); - } /* end if */ + if(*tmpdata!=*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 for */ /* @@ -4124,8 +4091,8 @@ test_select_hyper_chunk(hid_t fapl_plist, hid_t xfer_plist) CHECK(status, FAIL, "H5Sclose"); status=H5Fclose (file); CHECK(status, FAIL, "H5Fclose"); - free (data); - free (data_out); + HDfree (data); + HDfree (data_out); } /* test_select_hyper_chunk() */ /**************************************************************** @@ -4908,7 +4875,7 @@ test_select_fill_all(void) MESSAGE(5, ("Testing Filling 'all' Selections\n")); /* Allocate memory buffer */ - wbuf=malloc(sizeof(unsigned short)*SPACE7_DIM1*SPACE7_DIM2); + wbuf=HDmalloc(sizeof(unsigned short)*SPACE7_DIM1*SPACE7_DIM2); /* Initialize memory buffer */ for(i=0, tbuf=wbuf; i<SPACE7_DIM1; i++) @@ -4931,10 +4898,8 @@ test_select_fill_all(void) /* Verify memory buffer the hard way... */ 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); - } /* end if */ + if(*tbuf!=(unsigned short)fill_value) + TestErrPrintf("Error! j=%d, i=%d, *tbuf=%x, fill_value=%x\n",j,i,(unsigned)*tbuf,(unsigned)fill_value); /* Set the coordinates of the selection */ for(i=0; i<SPACE7_DIM1; i++) @@ -4957,7 +4922,7 @@ test_select_fill_all(void) CHECK(ret, FAIL, "H5Sclose"); /* Free memory buffers */ - free(wbuf); + HDfree(wbuf); } /* test_select_fill_all() */ /**************************************************************** @@ -4985,7 +4950,7 @@ test_select_fill_point(hssize_t *offset) MESSAGE(5, ("Testing Filling 'point' Selections\n")); /* Allocate memory buffer */ - wbuf=malloc(sizeof(unsigned short)*SPACE7_DIM1*SPACE7_DIM2); + wbuf=HDmalloc(sizeof(unsigned short)*SPACE7_DIM1*SPACE7_DIM2); /* Initialize memory buffer */ for(i=0, tbuf=wbuf; i<SPACE7_DIM1; i++) @@ -5022,17 +4987,13 @@ test_select_fill_point(hssize_t *offset) for(j=0; j<SPACE7_DIM2; j++, tbuf++) { 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); - } /* end if */ + if(*tbuf!=(unsigned short)fill_value) + TestErrPrintf("Error! j=%d, i=%d, *tbuf=%u, fill_value=%u\n",j,i,(unsigned)*tbuf,(unsigned)fill_value); 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)); - } /* end if */ + if(k==(int)num_points && *tbuf!=((unsigned short)(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 for */ /* Initialize the iterator structure */ @@ -5055,7 +5016,7 @@ test_select_fill_point(hssize_t *offset) CHECK(ret, FAIL, "H5Sclose"); /* Free memory buffers */ - free(wbuf); + HDfree(wbuf); } /* test_select_fill_point() */ /**************************************************************** @@ -5085,7 +5046,7 @@ test_select_fill_hyper_simple(hssize_t *offset) MESSAGE(5, ("Testing Filling Simple 'hyperslab' Selections\n")); /* Allocate memory buffer */ - wbuf=malloc(sizeof(unsigned short)*SPACE7_DIM1*SPACE7_DIM2); + wbuf=HDmalloc(sizeof(unsigned short)*SPACE7_DIM1*SPACE7_DIM2); /* Initialize memory buffer */ for(i=0, tbuf=wbuf; i<SPACE7_DIM1; i++) @@ -5124,16 +5085,12 @@ test_select_fill_hyper_simple(hssize_t *offset) for(j=0; j<SPACE7_DIM2; j++, tbuf++) { 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); - } /* end if */ + if(*tbuf!=(unsigned short)fill_value) + TestErrPrintf("Error! j=%d, i=%d, *tbuf=%u, fill_value=%u\n",j,i,(unsigned)*tbuf,(unsigned)fill_value); } /* 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)); - } /* end if */ + if(*tbuf!=((unsigned short)(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 else */ } /* end for */ @@ -5158,7 +5115,7 @@ test_select_fill_hyper_simple(hssize_t *offset) CHECK(ret, FAIL, "H5Sclose"); /* Free memory buffers */ - free(wbuf); + HDfree(wbuf); } /* test_select_fill_hyper_simple() */ /**************************************************************** @@ -5195,7 +5152,7 @@ test_select_fill_hyper_regular(hssize_t *offset) MESSAGE(5, ("Testing Filling Regular 'hyperslab' Selections\n")); /* Allocate memory buffer */ - wbuf=malloc(sizeof(unsigned short)*SPACE7_DIM1*SPACE7_DIM2); + wbuf=HDmalloc(sizeof(unsigned short)*SPACE7_DIM1*SPACE7_DIM2); /* Initialize memory buffer */ for(i=0, tbuf=wbuf; i<SPACE7_DIM1; i++) @@ -5236,17 +5193,13 @@ test_select_fill_hyper_regular(hssize_t *offset) for(j=0; j<SPACE7_DIM2; j++, tbuf++) { 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); - } /* end if */ + if(*tbuf!=(unsigned short)fill_value) + TestErrPrintf("Error! j=%d, i=%d, *tbuf=%u, fill_value=%u\n",j,i,(unsigned)*tbuf,(unsigned)fill_value); 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)); - } /* end if */ + if(k==(int)num_points && *tbuf!=((unsigned short)(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 for */ /* Initialize the iterator structure */ @@ -5269,7 +5222,7 @@ test_select_fill_hyper_regular(hssize_t *offset) CHECK(ret, FAIL, "H5Sclose"); /* Free memory buffers */ - free(wbuf); + HDfree(wbuf); } /* test_select_fill_hyper_regular() */ /**************************************************************** @@ -5317,7 +5270,7 @@ test_select_fill_hyper_irregular(hssize_t *offset) MESSAGE(5, ("Testing Filling Irregular 'hyperslab' Selections\n")); /* Allocate memory buffer */ - wbuf=malloc(sizeof(unsigned short)*SPACE7_DIM1*SPACE7_DIM2); + wbuf=HDmalloc(sizeof(unsigned short)*SPACE7_DIM1*SPACE7_DIM2); /* Initialize memory buffer */ for(i=0, tbuf=wbuf; i<SPACE7_DIM1; i++) @@ -5362,17 +5315,13 @@ test_select_fill_hyper_irregular(hssize_t *offset) for(j=0; j<SPACE7_DIM2; j++, tbuf++) { 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); - } /* end if */ + if(*tbuf!=(unsigned short)fill_value) + TestErrPrintf("Error! j=%d, i=%d, *tbuf=%u, fill_value=%u\n",j,i,(unsigned)*tbuf,(unsigned)fill_value); 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)); - } /* end if */ + if(k==(int)num_points && *tbuf!=((unsigned short)(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 for */ /* Initialize the iterator structure */ @@ -5395,7 +5344,7 @@ test_select_fill_hyper_irregular(hssize_t *offset) CHECK(ret, FAIL, "H5Sclose"); /* Free memory buffers */ - free(wbuf); + HDfree(wbuf); } /* test_select_fill_hyper_irregular() */ /**************************************************************** @@ -5508,8 +5457,8 @@ test_scalar_select(void) MESSAGE(5, ("Testing I/O on Selections in Scalar Dataspaces\n")); /* Allocate write & read buffers */ - wbuf_uint8=malloc(sizeof(uint8_t)*SPACE7_DIM1*SPACE7_DIM2); - wbuf_ushort=malloc(sizeof(unsigned short)*SPACE7_DIM1*SPACE7_DIM2); + wbuf_uint8=HDmalloc(sizeof(uint8_t)*SPACE7_DIM1*SPACE7_DIM2); + wbuf_ushort=HDmalloc(sizeof(unsigned short)*SPACE7_DIM1*SPACE7_DIM2); /* Initialize write buffers */ for(i=0, tbuf_uint8=wbuf_uint8, tbuf_ushort=wbuf_ushort; i<SPACE7_DIM1; i++) @@ -5548,10 +5497,8 @@ test_scalar_select(void) CHECK(ret, FAIL, "H5Dread"); /* 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++; - } /* end if */ + if(rval_uint8!=*(wbuf_uint8+2)) + TestErrPrintf("Error! rval=%u, should be: *(wbuf+2)=%u\n",(unsigned)rval_uint8,(unsigned)*(wbuf_uint8+2)); /* Write single point to disk (with a datatype conversion) */ ret=H5Dwrite(dataset,H5T_NATIVE_USHORT,sid2,sid1,H5P_DEFAULT,wbuf_ushort); @@ -5562,10 +5509,8 @@ test_scalar_select(void) CHECK(ret, FAIL, "H5Dread"); /* 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++; - } /* end if */ + if(rval_ushort!=*(wbuf_ushort+2)) + TestErrPrintf("Error! rval=%u, should be: *(wbuf+2)=%u\n",(unsigned)rval_ushort,(unsigned)*(wbuf_ushort+2)); /* Select one element in memory with a hyperslab selection */ start[0]=4; start[1]=3; @@ -5582,10 +5527,8 @@ test_scalar_select(void) CHECK(ret, FAIL, "H5Dread"); /* 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++; - } /* end if */ + if(rval_uint8!=*(wbuf_uint8+(SPACE7_DIM2*4)+3)) + TestErrPrintf("Error! rval=%u, should be: *(wbuf+(SPACE7_DIM2*4)+3)=%u\n",(unsigned)rval_uint8,(unsigned)*(wbuf_uint8+(SPACE7_DIM2*4)+3)); /* Write single hyperslab element to disk (with a datatype conversion) */ ret=H5Dwrite(dataset,H5T_NATIVE_USHORT,sid2,sid1,H5P_DEFAULT,wbuf_ushort); @@ -5596,10 +5539,8 @@ test_scalar_select(void) CHECK(ret, FAIL, "H5Dread"); /* 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++; - } /* end if */ + if(rval_ushort!=*(wbuf_ushort+(SPACE7_DIM2*4)+3)) + TestErrPrintf("Error! rval=%u, should be: *(wbuf+(SPACE7_DIM2*4)+3)=%u\n",(unsigned)rval_ushort,(unsigned)*(wbuf_ushort+(SPACE7_DIM2*4)+3)); /* Select no elements in memory & file with "none" selections */ ret = H5Sselect_none(sid1); @@ -5633,8 +5574,8 @@ test_scalar_select(void) CHECK(ret, FAIL, "H5Fclose"); /* Free memory buffers */ - free(wbuf_uint8); - free(wbuf_ushort); + HDfree(wbuf_uint8); + HDfree(wbuf_ushort); } /* test_scalar_select() */ /**************************************************************** @@ -6572,9 +6513,9 @@ test_select_hyper_chunk_offset(void) MESSAGE(6, ("Testing hyperslab selections using offsets in chunked datasets\n")); /* Allocate buffers */ - wbuf= (int*)HDmalloc(sizeof(int)*SPACE10_DIM1); + wbuf= HDmalloc(sizeof(int)*SPACE10_DIM1); CHECK(wbuf, NULL, "HDmalloc"); - rbuf= (int*)HDmalloc(sizeof(int)*SPACE10_DIM1); + rbuf= HDmalloc(sizeof(int)*SPACE10_DIM1); CHECK(rbuf, NULL, "HDmalloc"); /* Initialize the write buffer */ @@ -6664,14 +6605,10 @@ test_select_hyper_chunk_offset(void) CHECK(ret, FAIL, "H5Soffset_simple"); /* Verify the information read in */ - 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++; - } /* end if */ - } /* end for */ - } /* end for */ + 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]) + 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]); /* Check with 'OR'ed set of hyperslab selections, which makes certain the * hyperslab spanlist code gets tested. -QAK @@ -6737,17 +6674,12 @@ test_select_hyper_chunk_offset(void) CHECK(ret, FAIL, "H5Soffset_simple"); /* Verify the information read in */ - for(i=0; i<SPACE10_DIM1; i+=SPACE10_CHUNK_SIZE) { - for(j=0; j<SPACE10_CHUNK_SIZE; j++) { + for(i=0; i<SPACE10_DIM1; i+=SPACE10_CHUNK_SIZE) + for(j=0; j<SPACE10_CHUNK_SIZE; j++) /* 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++; - } /* end if */ - } /* end if */ - } /* end for */ - } /* end for */ + if(j<(SPACE10_CHUNK_SIZE/3) || j>=((2*SPACE10_CHUNK_SIZE)/3)) + if(wbuf[i+j]!=rbuf[((SPACE10_DIM1-i)-SPACE10_CHUNK_SIZE)+j]) + 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]); /* Close the memory dataspace */ ret=H5Sclose (msid); diff --git a/test/ttbbt.c b/test/ttbbt.c index dba49aa..b8c00f2 100644 --- a/test/ttbbt.c +++ b/test/ttbbt.c @@ -12,8 +12,6 @@ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* $Id$ */ - /* FILE tbbt.c @@ -100,7 +98,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 +115,12 @@ test_tbbt(void) MESSAGE(9, ("inserting %d\n", (int) ins_arr[i])); H5TB_dins(tree, (void *) &ins_arr[i], NULL); #ifdef H5TB_DEBUG - if(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 +132,7 @@ test_tbbt(void) MESSAGE(9, ("removing %d\n", (int) key)); H5TB_rem((H5TB_NODE **) tree, (H5TB_NODE *) r, NULL); #ifdef H5TB_DEBUG - if(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..5f9b5e7 100644 --- a/test/ttime.c +++ b/test/ttime.c @@ -12,8 +12,6 @@ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* $Id$ */ - /*********************************************************** * * Test program: ttime @@ -85,10 +83,8 @@ test_time_commit(void) tid = H5Topen(file_id, "Committed D32LE type"); CHECK(tid, FAIL, "H5Topen"); - if(!H5Tequal(tid, H5T_UNIX_D32LE)) { - num_errs++; - MESSAGE(0, ("H5T_UNIX_D32LE datatype not found")); - } /* end if */ + if(!H5Tequal(tid, H5T_UNIX_D32LE)) + TestErrPrintf("H5T_UNIX_D32LE datatype not found\n"); status = H5Tclose (tid); CHECK(status, FAIL, "H5Tclose"); @@ -96,10 +92,8 @@ test_time_commit(void) tid = H5Topen(file_id, "Committed D32BE type"); CHECK(tid, FAIL, "H5Topen"); - if(!H5Tequal(tid, H5T_UNIX_D32BE)) { - num_errs++; - MESSAGE(0, ("H5T_UNIX_D32BE datatype not found")); - } /* end if */ + if(!H5Tequal(tid, H5T_UNIX_D32BE)) + TestErrPrintf("H5T_UNIX_D32BE datatype not found\n"); status = H5Tclose (tid); CHECK(status, FAIL, "H5Tclose"); @@ -107,10 +101,8 @@ test_time_commit(void) tid = H5Topen(file_id, "Committed D64LE type"); CHECK(tid, FAIL, "H5Topen"); - if(!H5Tequal(tid, H5T_UNIX_D64LE)) { - num_errs++; - MESSAGE(0, ("H5T_UNIX_D64LE datatype not found")); - } /* end if */ + if(!H5Tequal(tid, H5T_UNIX_D64LE)) + TestErrPrintf("H5T_UNIX_D64LE datatype not found"); status = H5Tclose (tid); CHECK(status, FAIL, "H5Tclose"); @@ -118,10 +110,8 @@ test_time_commit(void) tid = H5Topen(file_id, "Committed D64BE type"); CHECK(tid, FAIL, "H5Topen"); - if(!H5Tequal(tid, H5T_UNIX_D64BE)) { - num_errs++; - MESSAGE(0, ("H5T_UNIX_D64BE datatype not found")); - } /* end if */ + if(!H5Tequal(tid, H5T_UNIX_D64BE)) + TestErrPrintf("H5T_UNIX_D64BE datatype not found"); status = H5Tclose (tid); CHECK(status, FAIL, "H5Tclose"); 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..7a4635b 100644 --- a/test/ttsafe_acreate.c +++ b/test/ttsafe_acreate.c @@ -41,7 +41,7 @@ * * 19 May 2000, Bill Wendling * Changed so that it creates its own HDF5 file and removes it at cleanup - * time. Added num_errs flag. + * time. * ********************************************************************/ @@ -67,88 +67,80 @@ typedef struct acreate_data_struct { void tts_acreate(void) { - /* Pthread declarations */ - pthread_t threads[NUM_THREADS]; - - /* HDF5 data declarations */ - hid_t file, dataset; - hid_t dataspace, datatype; - hid_t attribute; - hsize_t dimsf[1]; /* dataset dimensions */ - - /* data declarations */ - int data; /* data to write */ - int buffer, ret, i; - - ttsafe_name_data_t *attrib_data; - - /* - * Create an HDF5 file using H5F_ACC_TRUNC access, default file - * creation plist and default file access plist - */ - file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - - /* create a simple dataspace for the dataset */ - dimsf[0] = 1; - dataspace = H5Screate_simple(1, dimsf, NULL); - - /* define datatype for the data using native little endian integers */ - datatype = H5Tcopy(H5T_NATIVE_INT); - H5Tset_order(datatype, H5T_ORDER_LE); - - /* create a new dataset within the file */ - dataset = H5Dcreate(file, DATASETNAME, datatype, dataspace, - H5P_DEFAULT); - - /* initialize data for dataset and write value to dataset */ - data = NUM_THREADS; - H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, - H5P_DEFAULT, &data); - - /* - * Simultaneously create a large number of attributes to be associated - * with the dataset - */ - for (i = 0; i < NUM_THREADS; i++) { - attrib_data = malloc(sizeof(ttsafe_name_data_t)); - attrib_data->dataset = dataset; - attrib_data->datatype = datatype; - attrib_data->dataspace = dataspace; - attrib_data->current_index = i; - pthread_create(&threads[i], NULL, tts_acreate_thread, - attrib_data); - } - - for (i = 0; i < NUM_THREADS; i++) - pthread_join(threads[i], NULL); - - /* verify the correctness of the test */ - for (i = 0; i < NUM_THREADS; i++) { - attribute = H5Aopen_name(dataset,gen_name(i)); - - if (attribute < 0) { - fprintf(stderr, - "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++; - } - - H5Aclose(attribute); - } - } - - /* close remaining resources */ - H5Sclose(dataspace); - H5Tclose(datatype); - H5Dclose(dataset); - H5Fclose(file); + /* Pthread declarations */ + pthread_t threads[NUM_THREADS]; + + /* HDF5 data declarations */ + hid_t file, dataset; + hid_t dataspace, datatype; + hid_t attribute; + hsize_t dimsf[1]; /* dataset dimensions */ + + /* data declarations */ + int data; /* data to write */ + int buffer, ret, i; + + ttsafe_name_data_t *attrib_data; + + /* + * Create an HDF5 file using H5F_ACC_TRUNC access, default file + * creation plist and default file access plist + */ + file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + + /* create a simple dataspace for the dataset */ + dimsf[0] = 1; + dataspace = H5Screate_simple(1, dimsf, NULL); + + /* define datatype for the data using native little endian integers */ + datatype = H5Tcopy(H5T_NATIVE_INT); + H5Tset_order(datatype, H5T_ORDER_LE); + + /* create a new dataset within the file */ + dataset = H5Dcreate(file, DATASETNAME, datatype, dataspace, H5P_DEFAULT); + + /* initialize data for dataset and write value to dataset */ + data = NUM_THREADS; + H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, + H5P_DEFAULT, &data); + + /* + * Simultaneously create a large number of attributes to be associated + * with the dataset + */ + for (i = 0; i < NUM_THREADS; i++) { + attrib_data = malloc(sizeof(ttsafe_name_data_t)); + attrib_data->dataset = dataset; + attrib_data->datatype = datatype; + attrib_data->dataspace = dataspace; + attrib_data->current_index = i; + pthread_create(&threads[i], NULL, tts_acreate_thread, attrib_data); + } + + for (i = 0; i < NUM_THREADS; i++) + pthread_join(threads[i], NULL); + + /* verify the correctness of the test */ + for (i = 0; i < NUM_THREADS; i++) { + attribute = H5Aopen_name(dataset,gen_name(i)); + + if (attribute < 0) + TestErrPrintf("unable to open appropriate attribute. Test failed!\n"); + else { + ret = H5Aread(attribute, H5T_NATIVE_INT, &buffer); + + if (ret < 0 || buffer != i) + TestErrPrintf("wrong data values. Test failed!\n"); + + H5Aclose(attribute); + } + } + + /* close remaining resources */ + H5Sclose(dataspace); + H5Tclose(datatype); + H5Dclose(dataset); + H5Fclose(file); } void *tts_acreate_thread(void *client_data) diff --git a/test/ttsafe_cancel.c b/test/ttsafe_cancel.c index 4247f07..30e9bfb 100644 --- a/test/ttsafe_cancel.c +++ b/test/ttsafe_cancel.c @@ -40,7 +40,7 @@ * * 19 May 2000, Bill Wendling * Changed so that it creates its own HDF5 file and removes it at cleanup - * time. Added num_errs flag. + * time. * ********************************************************************/ #include "ttsafe.h" @@ -68,117 +68,104 @@ pthread_cond_t cond; void tts_cancel(void) { - pthread_attr_t attribute; - hid_t dataset; - int buffer; + pthread_attr_t attribute; + hid_t dataset; + int buffer; - /* make thread scheduling global */ - pthread_attr_init(&attribute); + /* make thread scheduling global */ + pthread_attr_init(&attribute); #ifdef H5_HAVE_SYSTEM_SCOPE_THREADS - pthread_attr_setscope(&attribute, PTHREAD_SCOPE_SYSTEM); + pthread_attr_setscope(&attribute, PTHREAD_SCOPE_SYSTEM); #endif /* H5_HAVE_SYSTEM_SCOPE_THREADS */ - /* - * Create a hdf5 file using H5F_ACC_TRUNC access, default file - * creation plist and default file access plist - */ - cancel_file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - pthread_create(&childthread, &attribute, tts_cancel_thread, NULL); - tts_cancel_barrier(); - pthread_cancel(childthread); - - dataset = H5Dopen(cancel_file, DATASETNAME); - H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, - &buffer); - - if (buffer != 11) { - fprintf(stderr, - "operation unsuccessful with value at %d instead of 11\n", - buffer); - num_errs++; - } - - H5Dclose(dataset); - H5Fclose(cancel_file); - - /* Destroy the thread attribute */ - pthread_attr_destroy(&attribute); + /* + * Create a hdf5 file using H5F_ACC_TRUNC access, default file + * creation plist and default file access plist + */ + cancel_file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + pthread_create(&childthread, &attribute, tts_cancel_thread, NULL); + tts_cancel_barrier(); + pthread_cancel(childthread); + + dataset = H5Dopen(cancel_file, DATASETNAME); + H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &buffer); + + if (buffer != 11) + TestErrPrintf("operation unsuccessful with value at %d instead of 11\n", buffer); + + H5Dclose(dataset); + H5Fclose(cancel_file); + + /* Destroy the thread attribute */ + pthread_attr_destroy(&attribute); } void *tts_cancel_thread(void UNUSED *arg) { - int datavalue; - int *buffer; - hid_t dataspace, datatype, dataset; - hsize_t dimsf[1]; /* dataset dimensions */ - cancel_cleanup_t *cleanup_structure; - - /* define dataspace for dataset */ - dimsf[0] = 1; - dataspace = H5Screate_simple(1,dimsf,NULL); - - /* define datatype for the data using native little endian integers */ - datatype = H5Tcopy(H5T_NATIVE_INT); - H5Tset_order(datatype, H5T_ORDER_LE); - - /* create a new dataset within the file */ - dataset = H5Dcreate(cancel_file, DATASETNAME, datatype, dataspace, - H5P_DEFAULT); - - /* If thread is cancelled, make cleanup call */ - cleanup_structure = (cancel_cleanup_t*)malloc(sizeof(cancel_cleanup_t)); - cleanup_structure->dataset = dataset; - cleanup_structure->datatype = datatype; - cleanup_structure->dataspace = dataspace; - pthread_cleanup_push(cancellation_cleanup, cleanup_structure); - - datavalue = 1; - H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, - &datavalue); - - buffer = malloc(sizeof(int)); - H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, - buffer); - H5Diterate(buffer, H5T_NATIVE_INT, dataspace, tts_cancel_callback, - &dataset); - - sleep(3); - - datavalue = 100; - H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, - &datavalue); - H5Dclose(dataset); - H5Tclose(datatype); - H5Sclose(dataspace); - - /* - * Required by pthreads. The argument 0 pops the stack but does not - * execute the cleanup routine. - */ - pthread_cleanup_pop(0); - return NULL; + int datavalue; + int *buffer; + hid_t dataspace, datatype, dataset; + hsize_t dimsf[1]; /* dataset dimensions */ + cancel_cleanup_t *cleanup_structure; + + /* define dataspace for dataset */ + dimsf[0] = 1; + dataspace = H5Screate_simple(1,dimsf,NULL); + + /* define datatype for the data using native little endian integers */ + datatype = H5Tcopy(H5T_NATIVE_INT); + H5Tset_order(datatype, H5T_ORDER_LE); + + /* create a new dataset within the file */ + dataset = H5Dcreate(cancel_file, DATASETNAME, datatype, dataspace, H5P_DEFAULT); + + /* If thread is cancelled, make cleanup call */ + cleanup_structure = (cancel_cleanup_t*)malloc(sizeof(cancel_cleanup_t)); + cleanup_structure->dataset = dataset; + cleanup_structure->datatype = datatype; + cleanup_structure->dataspace = dataspace; + pthread_cleanup_push(cancellation_cleanup, cleanup_structure); + + datavalue = 1; + H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &datavalue); + + buffer = malloc(sizeof(int)); + H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buffer); + H5Diterate(buffer, H5T_NATIVE_INT, dataspace, tts_cancel_callback, &dataset); + + sleep(3); + + datavalue = 100; + H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &datavalue); + H5Dclose(dataset); + H5Tclose(datatype); + H5Sclose(dataspace); + + /* + * Required by pthreads. The argument 0 pops the stack but does not + * execute the cleanup routine. + */ + pthread_cleanup_pop(0); + return NULL; } herr_t tts_cancel_callback(void *elem, hid_t UNUSED type_id, hsize_t UNUSED ndim, hssize_t UNUSED *point, void *operator_data) { - int value = *(int *)elem; - hid_t dataset = *(hid_t *)operator_data; - - tts_cancel_barrier(); - sleep(3); - - if (value != 1) { - fprintf(stderr, "Error! Element value should be 1 and not %d\n", - value); - num_errs++; - return -1; - } - - value += 10; - H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, - &value); - return 0; + int value = *(int *)elem; + hid_t dataset = *(hid_t *)operator_data; + + tts_cancel_barrier(); + sleep(3); + + if (value != 1) { + TestErrPrintf("Error! Element value should be 1 and not %d\n", value); + return -1; + } + + value += 10; + H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &value); + return 0; } /* @@ -187,13 +174,13 @@ herr_t tts_cancel_callback(void *elem, hid_t UNUSED type_id, hsize_t UNUSED ndim */ void cancellation_cleanup(void *arg) { - cancel_cleanup_t *cleanup_structure = (cancel_cleanup_t *)arg; - H5Dclose(cleanup_structure->dataset); - H5Tclose(cleanup_structure->datatype); - H5Sclose(cleanup_structure->dataspace); + cancel_cleanup_t *cleanup_structure = (cancel_cleanup_t *)arg; + H5Dclose(cleanup_structure->dataset); + H5Tclose(cleanup_structure->datatype); + H5Sclose(cleanup_structure->dataspace); - /* retained for debugging */ - /* print_func("cancellation noted, cleaning up ... \n"); */ + /* retained for debugging */ + /* print_func("cancellation noted, cleaning up ... \n"); */ } /* @@ -202,18 +189,18 @@ void cancellation_cleanup(void *arg) */ void tts_cancel_barrier(void) { - static int count = 2; + static int count = 2; - pthread_mutex_lock(&mutex); + pthread_mutex_lock(&mutex); - if (count != 1) { - count--; - pthread_cond_wait(&cond, &mutex); - } else { - pthread_cond_signal(&cond); - } + if (count != 1) { + count--; + pthread_cond_wait(&cond, &mutex); + } else { + pthread_cond_signal(&cond); + } - pthread_mutex_unlock(&mutex); + pthread_mutex_unlock(&mutex); } void cleanup_cancel(void) diff --git a/test/ttsafe_dcreate.c b/test/ttsafe_dcreate.c index b351994..22796a8 100644 --- a/test/ttsafe_dcreate.c +++ b/test/ttsafe_dcreate.c @@ -36,7 +36,7 @@ * * 19 May 2000, Bill Wendling * Changed so that it creates its own HDF5 file and removes it at cleanup - * time. Added num_errs flag. + * time. * ********************************************************************/ #include "ttsafe.h" @@ -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(stderr, "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 2cf5a92..8f35a84 100644 --- a/test/ttsafe_error.c +++ b/test/ttsafe_error.c @@ -39,8 +39,7 @@ * * 19 May 2000, Bill Wendling * Modified so that it creates a unique HDF5 file and removes it on - * cleanup. Also added the num_errs flag and increment it when necessary - * to report the errors. + * cleanup. * ********************************************************************/ #include "ttsafe.h" @@ -131,23 +130,17 @@ void tts_error(void) for (i = 0; i < NUM_THREAD; i++) pthread_join(threads[i],NULL); - if (error_flag) { - fprintf(stderr, "Threads reporting different error values!\n"); - num_errs++; - } + if (error_flag) + TestErrPrintf("Threads reporting different error values!\n"); - if (error_count != NUM_THREAD - 1) { - fprintf(stderr, "Error: %d threads failed instead of %d\n", error_count, NUM_THREAD-1); - num_errs++; - } + if (error_count != NUM_THREAD - 1) + TestErrPrintf("Error: %d threads failed instead of %d\n", error_count, NUM_THREAD-1); 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", value, WRITE_NUMBER); - num_errs++; - } + if (value != WRITE_NUMBER) + TestErrPrintf("Error: Successful thread wrote value %d instead of %d\n", value, WRITE_NUMBER); H5Dclose(dataset); H5Fclose(error_file); diff --git a/test/ttst.c b/test/ttst.c index 9632cb7..10eb017 100644 --- a/test/ttst.c +++ b/test/ttst.c @@ -208,18 +208,14 @@ test_tst_insert(void) found=H5ST_find(tree,uniq_words[u]); 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]); - } /* end if */ + if(HDstrcmp((const char *)found->eqkid,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]); 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]); - } /* end if */ + if(HDstrcmp((const char *)obj,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 for */ /* Verify that words not in the TST aren't found */ @@ -268,10 +264,8 @@ test_tst_iterate(void) u=0; 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]); - } /* end if */ + if(HDstrcmp((const char *)found->eqkid,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]); /* Advance to next string in TST */ found=H5ST_findnext(found); @@ -318,10 +312,8 @@ test_tst_remove(void) CHECK(obj, NULL, "H5ST_remove"); /* 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]); - } /* end if */ + if(HDstrcmp((const char *)obj,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]); /* Check that the string can't be found in the TST any longer */ check=H5ST_search(tree,rand_uniq_words[u]); @@ -341,10 +333,8 @@ test_tst_remove(void) CHECK(found, NULL, "H5ST_find"); /* 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]); - } /* end if */ + if(HDstrcmp((const char *)found->eqkid,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]); /* Remove the node */ ret=H5ST_delete(tree,found); diff --git a/test/tvlstr.c b/test/tvlstr.c index ef35267..2031865 100644 --- a/test/tvlstr.c +++ b/test/tvlstr.c @@ -12,8 +12,6 @@ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* $Id$ */ - /*********************************************************** * * Test program: tvlstr @@ -191,7 +189,7 @@ test_vlstrings_basic(void) /* Count the actual number of bytes used by the strings */ for(i=0,str_used=0; i<SPACE1_DIM1; i++) - str_used+=strlen(wdata[i])+1; + str_used+=HDstrlen(wdata[i])+1; /* Compare against the strings actually written */ VERIFY(size,(hsize_t)str_used,"H5Dvlen_get_buf_size"); @@ -205,14 +203,12 @@ 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])); + if(HDstrlen(wdata[i])!=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]); + if( HDstrcmp(wdata[i],rdata[i]) != 0 ) { + 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 */ @@ -295,12 +291,9 @@ test_vlstrings_special(void) CHECK(ret, FAIL, "H5Dread"); /* 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]); - } /* end if */ - } /* end for */ + for(i=0; i<SPACE1_DIM1; i++) + if(rdata[i]!=NULL) + TestErrPrintf("VL doesn't match!, rdata[%d]=%p\n",(int)i,rdata[i]); /* Write dataset to disk */ ret=H5Dwrite(dataset,tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata); @@ -312,14 +305,12 @@ 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])); + if(HDstrlen(wdata[i])!=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]); + if( HDstrcmp(wdata[i],rdata[i]) != 0 ) { + 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 */ @@ -353,12 +344,9 @@ test_vlstrings_special(void) CHECK(ret, FAIL, "H5Dread"); /* 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]); - } /* end if */ - } /* end for */ + for(i=0; i<SPACE1_DIM1; i++) + if(rdata[i]!=NULL) + TestErrPrintf("VL doesn't match!, rdata[%d]=%p\n",(int)i,rdata[i]); /* Try to write nil strings to disk. */ ret=H5Dwrite(dataset,tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata2); @@ -369,12 +357,9 @@ test_vlstrings_special(void) CHECK(ret, FAIL, "H5Dread"); /* 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]); - } /* end if */ - } /* end for */ + for(i=0; i<SPACE1_DIM1; i++) + if(rdata[i]!=NULL) + TestErrPrintf("VL doesn't match!, rdata[%d]=%p\n",(int)i,rdata[i]); /* Close Dataset */ ret = H5Dclose(dataset); @@ -537,14 +522,12 @@ 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])); + if(HDstrlen(wdata[i])!=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]); + if( HDstrcmp(wdata[i],rdata[i]) != 0 ) { + 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 */ @@ -614,10 +597,8 @@ static void test_write_vl_string_attribute(void) ret = H5Aread(att, type, &string_att_check); 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); - } /* end if */ + if(HDstrcmp(string_att_check,string_att)!=0) + TestErrPrintf("VL string attributes don't match!, string_att=%s, string_att_check=%s\n",string_att,string_att_check); HDfree(string_att_check); @@ -637,10 +618,8 @@ static void test_write_vl_string_attribute(void) ret = H5Aread(att, type, &string_att_check); 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); - } /* end if */ + if(HDstrcmp(string_att_check,string_att_write)!=0) + TestErrPrintf("VL string attributes don't match!, string_att_write=%s, string_att_check=%s\n",string_att_write,string_att_check); HDfree(string_att_check); /* The attribute string written is freed below, in the test_read_vl_string_attribute() test */ @@ -698,10 +677,8 @@ static void test_read_vl_string_attribute(void) ret = H5Aread(att, type, &string_att_check); 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); - } /* end if */ + if(HDstrcmp(string_att_check,string_att)!=0) + TestErrPrintf("VL string attributes don't match!, string_att=%s, string_att_check=%s\n",string_att,string_att_check); HDfree(string_att_check); @@ -715,10 +692,8 @@ static void test_read_vl_string_attribute(void) ret = H5Aread(att, type, &string_att_check); 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); - } /* end if */ + if(HDstrcmp(string_att_check,string_att_write)!=0) + TestErrPrintf("VL string attributes don't match!, string_att_write=%s, string_att_check=%s\n",string_att_write,string_att_check); HDfree(string_att_check); HDfree(string_att_write); /* Free string allocated in test_write_vl_string_attribute */ diff --git a/test/tvltypes.c b/test/tvltypes.c index 63c3c8e..bf22e24 100644 --- a/test/tvltypes.c +++ b/test/tvltypes.c @@ -12,8 +12,6 @@ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* $Id$ */ - /*********************************************************** * * Test program: tvltypes @@ -224,12 +222,9 @@ test_vltypes_vlen_atomic(void) CHECK(ret, FAIL, "H5Dread"); /* 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); - } /* end if */ - } /* end for */ + for(i=0; i<SPACE1_DIM1; i++) + if(rdata[i].len!=0 || rdata[i].p!=NULL) + 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); /* Write "nil" data to disk */ ret=H5Dwrite(dataset,tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata2); @@ -240,12 +235,9 @@ test_vltypes_vlen_atomic(void) CHECK(ret, FAIL, "H5Dread"); /* 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); - } /* end if */ - } /* end for */ + for(i=0; i<SPACE1_DIM1; i++) + if(rdata[i].len!=0 || rdata[i].p!=NULL) + 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); /* Write dataset to disk */ ret=H5Dwrite(dataset,tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata); @@ -277,12 +269,9 @@ test_vltypes_vlen_atomic(void) CHECK(ret, FAIL, "H5Dread"); /* 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); - } /* end if */ - } /* end for */ + for(i=0; i<SPACE1_DIM1; i++) + if(rdata[i].len!=0 || rdata[i].p!=NULL) + 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); /* Write "nil" data to disk */ ret=H5Dwrite(dataset,tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata2); @@ -293,12 +282,9 @@ test_vltypes_vlen_atomic(void) CHECK(ret, FAIL, "H5Dread"); /* 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); - } /* end if */ - } /* end for */ + for(i=0; i<SPACE1_DIM1; i++) + if(rdata[i].len!=0 || rdata[i].p!=NULL) + 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); /* Write data to disk */ ret=H5Dwrite(dataset,tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata); @@ -362,14 +348,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 +420,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 +575,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 +715,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 +860,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 */ @@ -958,12 +932,8 @@ test_vltypes_compound_vlen_vlen(void) hid_t dataset; /* Dataset ID */ hid_t sid1; /* Dataspace ID */ hid_t tid1, tid2, tid3; /* Datatype IDs */ - hid_t xfer_pid; /* Dataset transfer property list ID */ - hid_t dcpl_pid; /* Dataset creation property list ID */ hsize_t dims1[] = {SPACE3_DIM1}; - hsize_t size; /* Number of bytes which will be used */ unsigned i,j,k; /* counting variables */ - size_t mem_used=0; /* Memory used during allocation */ hvl_t *t1, *t2; /* Temporary pointer to VL information */ herr_t ret; /* Generic return value */ @@ -1044,32 +1014,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 +1173,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 */ @@ -1263,12 +1224,9 @@ test_vltypes_compound_vlen_atomic(void) CHECK(ret, FAIL, "H5Dread"); /* 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); - } /* end if */ - } /* end for */ + 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) + 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); /* Write dataset to disk */ ret=H5Dwrite(dataset,tid2,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata); @@ -1281,24 +1239,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 +1391,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 +1497,14 @@ test_vltypes_vlen_vlen_atomic(void) for(i=0; i<SPACE1_DIM1; i++) { wdata[i].p=HDmalloc((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=HDmalloc((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 +1604,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 +1688,14 @@ rewrite_longer_vltypes_vlen_vlen_atomic(void) for(i=0; i<SPACE1_DIM1; i++) { wdata[i].p=HDmalloc((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=HDmalloc((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 +1784,18 @@ 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++) { 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 +1865,14 @@ rewrite_shorter_vltypes_vlen_vlen_atomic(void) for(i=0; i<SPACE1_DIM1; i++) { wdata[i].p=HDmalloc((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=HDmalloc((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 +1961,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 */ |