diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2008-06-18 16:58:08 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2008-06-18 16:58:08 (GMT) |
commit | 3c3a1388df917a17e863a59675e2d4ba4606af15 (patch) | |
tree | 3ac9c3260c89124d1fc907cc89191c2b96937f1b /tools | |
parent | 5f840fac789821f1b6acf951725b148971b8ae18 (diff) | |
download | hdf5-3c3a1388df917a17e863a59675e2d4ba4606af15.zip hdf5-3c3a1388df917a17e863a59675e2d4ba4606af15.tar.gz hdf5-3c3a1388df917a17e863a59675e2d4ba4606af15.tar.bz2 |
[svn-r15231] Description:
Merge revisions 14525:14700 from trunk into metadata journaling branch
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.5.2 (amazon) in debug mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
Diffstat (limited to 'tools')
-rw-r--r-- | tools/h5diff/h5diffgentest.c | 142 | ||||
-rwxr-xr-x | tools/h5import/h5import.c | 55 | ||||
-rwxr-xr-x | tools/h5import/h5importtest.c | 439 | ||||
-rwxr-xr-x | tools/h5import/h5importtestutil.sh | 55 | ||||
-rwxr-xr-x | tools/h5import/testfiles/binfp64.conf (renamed from tools/h5import/testfiles/conbfp64) | 0 | ||||
-rw-r--r-- | tools/h5import/testfiles/binfp64.h5 (renamed from tools/h5import/testfiles/test8.h5) | bin | 10760 -> 10760 bytes | |||
-rwxr-xr-x | tools/h5import/testfiles/binin16.conf (renamed from tools/h5import/testfiles/conbin16) | 0 | ||||
-rw-r--r-- | tools/h5import/testfiles/binin16.h5 (renamed from tools/h5import/testfiles/test9.h5) | bin | 10760 -> 10760 bytes | |||
-rwxr-xr-x | tools/h5import/testfiles/binin32.conf (renamed from tools/h5import/testfiles/conbin32) | 0 | ||||
-rw-r--r-- | tools/h5import/testfiles/binin32.h5 (renamed from tools/h5import/testfiles/test11.h5) | bin | 9472 -> 9472 bytes | |||
-rwxr-xr-x | tools/h5import/testfiles/binin8.conf (renamed from tools/h5import/testfiles/conbin8) | 0 | ||||
-rw-r--r-- | tools/h5import/testfiles/binin8.h5 (renamed from tools/h5import/testfiles/test10.h5) | bin | 10760 -> 10760 bytes | |||
-rw-r--r-- | tools/h5import/testfiles/binin8w.conf | 9 | ||||
-rw-r--r-- | tools/h5import/testfiles/binin8w.h5 | bin | 0 -> 2852 bytes | |||
-rwxr-xr-x | tools/h5import/testfiles/binuin16.conf (renamed from tools/h5import/testfiles/conbuin16) | 0 | ||||
-rw-r--r-- | tools/h5import/testfiles/binuin16.h5 (renamed from tools/h5import/testfiles/test12.h5) | bin | 10760 -> 10760 bytes | |||
-rwxr-xr-x | tools/h5import/testfiles/binuin32.conf (renamed from tools/h5import/testfiles/conbuin32) | 0 | ||||
-rw-r--r-- | tools/h5import/testfiles/binuin32.h5 (renamed from tools/h5import/testfiles/test13.h5) | bin | 6384 -> 6384 bytes | |||
-rwxr-xr-x | tools/h5import/testfiles/conbfp32 | 12 | ||||
-rwxr-xr-x | tools/h5import/testfiles/txtfp32.conf (renamed from tools/h5import/testfiles/textfp32) | 0 | ||||
-rw-r--r-- | tools/h5import/testfiles/txtfp32.h5 (renamed from tools/h5import/testfiles/test6.h5) | bin | 4192 -> 4192 bytes | |||
-rwxr-xr-x | tools/h5import/testfiles/txtfp32.txt (renamed from tools/h5import/testfiles/fp1) | 0 | ||||
-rwxr-xr-x | tools/h5import/testfiles/txtfp64.conf (renamed from tools/h5import/testfiles/textfp64) | 0 | ||||
-rw-r--r-- | tools/h5import/testfiles/txtfp64.h5 (renamed from tools/h5import/testfiles/test7.h5) | bin | 9784 -> 9784 bytes | |||
-rwxr-xr-x | tools/h5import/testfiles/txtfp64.txt (renamed from tools/h5import/testfiles/fp2) | 0 | ||||
-rwxr-xr-x | tools/h5import/testfiles/txtin16.conf (renamed from tools/h5import/testfiles/textin16) | 0 | ||||
-rw-r--r-- | tools/h5import/testfiles/txtin16.h5 (renamed from tools/h5import/testfiles/test2.h5) | bin | 9784 -> 9784 bytes | |||
-rw-r--r--[-rwxr-xr-x] | tools/h5import/testfiles/txtin16.txt (renamed from tools/h5import/testfiles/in1) | 0 | ||||
-rwxr-xr-x | tools/h5import/testfiles/txtin32.conf (renamed from tools/h5import/testfiles/textin32) | 0 | ||||
-rw-r--r-- | tools/h5import/testfiles/txtin32.h5 (renamed from tools/h5import/testfiles/test1.h5) | bin | 4192 -> 4192 bytes | |||
-rw-r--r-- | tools/h5import/testfiles/txtin32.txt | 15 | ||||
-rwxr-xr-x | tools/h5import/testfiles/txtin8.conf (renamed from tools/h5import/testfiles/textin8) | 0 | ||||
-rw-r--r-- | tools/h5import/testfiles/txtin8.h5 (renamed from tools/h5import/testfiles/test3.h5) | bin | 9784 -> 9784 bytes | |||
-rw-r--r-- | tools/h5import/testfiles/txtstr.conf (renamed from tools/h5import/testfiles/textstr) | 0 | ||||
-rw-r--r-- | tools/h5import/testfiles/txtstr.h5 (renamed from tools/h5import/testfiles/teststr.h5) | bin | 10240 -> 10240 bytes | |||
-rw-r--r-- | tools/h5import/testfiles/txtstr.txt (renamed from tools/h5import/testfiles/txtstr) | 0 | ||||
-rwxr-xr-x | tools/h5import/testfiles/txtuin16.conf (renamed from tools/h5import/testfiles/textuin16) | 0 | ||||
-rw-r--r-- | tools/h5import/testfiles/txtuin16.h5 (renamed from tools/h5import/testfiles/test5.h5) | bin | 10240 -> 10240 bytes | |||
-rwxr-xr-x | tools/h5import/testfiles/txtuin32.conf (renamed from tools/h5import/testfiles/textuin32) | 0 | ||||
-rw-r--r-- | tools/h5import/testfiles/txtuin32.h5 (renamed from tools/h5import/testfiles/test4.h5) | bin | 6240 -> 6240 bytes | |||
-rwxr-xr-x | tools/h5import/testfiles/txtuin32.txt | 15 | ||||
-rw-r--r-- | tools/h5repack/h5repack.c | 2 | ||||
-rw-r--r-- | tools/h5repack/h5repack.h | 14 | ||||
-rw-r--r-- | tools/lib/h5diff_array.c | 276 | ||||
-rw-r--r-- | tools/testfiles/h5diff_58.txt | 2 | ||||
-rw-r--r-- | tools/testfiles/h5diff_70.txt | 236 | ||||
-rw-r--r-- | tools/testfiles/h5diff_80.txt | 83 | ||||
-rw-r--r-- | tools/testfiles/h5diff_attr1.h5 | bin | 19136 -> 26000 bytes | |||
-rw-r--r-- | tools/testfiles/h5diff_attr2.h5 | bin | 19136 -> 26000 bytes | |||
-rw-r--r-- | tools/testfiles/h5diff_basic2.h5 | bin | 4240 -> 5728 bytes | |||
-rw-r--r-- | tools/testfiles/h5diff_dset1.h5 | bin | 19888 -> 22752 bytes | |||
-rw-r--r-- | tools/testfiles/h5diff_dset2.h5 | bin | 19888 -> 22752 bytes |
52 files changed, 981 insertions, 374 deletions
diff --git a/tools/h5diff/h5diffgentest.c b/tools/h5diff/h5diffgentest.c index 735dc0f..2a95ce0 100644 --- a/tools/h5diff/h5diffgentest.c +++ b/tools/h5diff/h5diffgentest.c @@ -444,7 +444,7 @@ int test_types(const char *fname) */ H5Lcreate_external("filename", "objname", fid1, "ext_link", H5P_DEFAULT, H5P_DEFAULT); H5Lregister(UD_link_class); - H5Lcreate_ud(fid1, "ud_link", MY_LINKCLASS, NULL, 0, H5P_DEFAULT, H5P_DEFAULT); + H5Lcreate_ud(fid1, "ud_link", MY_LINKCLASS, NULL, (size_t)0, H5P_DEFAULT, H5P_DEFAULT); /*------------------------------------------------------------------------- * Close @@ -814,12 +814,13 @@ void write_attr_in(hid_t loc_id, hid_t sid; hid_t tid; herr_t status; - int val, i, j, k, n; + int val, i, j, k, l, n; float f; /* create 1D attributes with dimension [2], 2 elements */ hsize_t dims[1]={2}; - char buf1[2][2]= {"ab","de"}; /* string */ + char buf1[2][STR_SIZE]= {"ab","de"}; /* string */ + char *buf1a[2]; /* VL string */ char buf2[2]= {1,2}; /* bitfield, opaque */ s_t buf3[2]= {{1,2},{3,4}}; /* compound */ hobj_ref_t buf4[2]; /* reference */ @@ -832,7 +833,8 @@ void write_attr_in(hid_t loc_id, /* create 2D attributes with dimension [3][2], 6 elements */ hsize_t dims2[2]={3,2}; - char buf12[6][2]= {"ab","cd","ef","gh","ij","kl"}; /* string */ + char buf12[3][2][STR_SIZE]= {{"ab","cd"},{"ef","gh"},{"ij","kl"}}; /* string */ + char *buf12a[3][2]; /* VL string */ char buf22[3][2]= {{1,2},{3,4},{5,6}}; /* bitfield, opaque */ s_t buf32[6]= {{1,2},{3,4},{5,6},{7,8},{9,10},{11,12}}; /* compound */ hobj_ref_t buf42[3][2]; /* reference */ @@ -844,9 +846,11 @@ void write_attr_in(hid_t loc_id, /* create 3D attributes with dimension [4][3][2], 24 elements */ hsize_t dims3[3]={4,3,2}; - char buf13[24][2]= {"ab","cd","ef","gh","ij","kl","mn","pq", - "rs","tu","vw","xz","AB","CD","EF","GH", - "IJ","KL","MN","PQ","RS","TU","VW","XZ"}; /* string */ + char buf13[4][3][2][STR_SIZE]= {{{"ab","cd"},{"ef","gh"},{"ij","kl"}}, + {{"mn","pq"},{"rs","tu"},{"vw","xz"}}, + {{"AB","CD"},{"EF","GH"},{"IJ","KL"}}, + {{"MN","PQ"},{"RS","TU"},{"VW","XZ"}}}; /* string */ + char *buf13a[4][3][2]; /* VL string */ char buf23[4][3][2]; /* bitfield, opaque */ s_t buf33[4][3][2]; /* compound */ hobj_ref_t buf43[4][3][2]; /* reference */ @@ -871,9 +875,7 @@ void write_attr_in(hid_t loc_id, { for (i=0; i<2; i++) for (j=0; j<2; j++) - { buf1[i][j]='z'; - } } /* buf1[2][2]= {"ab","de"}; @@ -888,10 +890,17 @@ void write_attr_in(hid_t loc_id, [ 1 ] e z */ tid = H5Tcopy(H5T_C_S1); - status = H5Tset_size(tid, 2); + status = H5Tset_size(tid, (size_t)STR_SIZE); write_attr(loc_id,1,dims,"string",tid,buf1); status = H5Tclose(tid); + for (i=0; i<2; i++) + buf1a[i]=buf1[i]; + tid = H5Tcopy(H5T_C_S1); + status = H5Tset_size(tid, H5T_VARIABLE); + write_attr(loc_id,1,dims,"VLstring",tid,buf1a); + status = H5Tclose(tid); + /*------------------------------------------------------------------------- * H5T_BITFIELD *------------------------------------------------------------------------- @@ -935,7 +944,7 @@ void write_attr_in(hid_t loc_id, [ 1 ] 2 0 2 */ - tid = H5Tcreate(H5T_OPAQUE, 1); + tid = H5Tcreate(H5T_OPAQUE, (size_t)1); status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */ write_attr(loc_id,1,dims,"opaque",tid,buf2); status = H5Tclose(tid); @@ -1126,7 +1135,10 @@ position array of </g1> array of </g1> difference */ if (make_diffs) { - memset(buf12, 'z', sizeof buf12); + for (i=0; i<3; i++) + for (j=0; j<2; j++) + for (k=0; k<2; k++) + buf12[i][j][k]='z'; } /* @@ -1150,10 +1162,18 @@ position array of </g1> array of </g1> difference */ tid = H5Tcopy(H5T_C_S1); - status = H5Tset_size(tid, 2); + status = H5Tset_size(tid, (size_t)STR_SIZE); write_attr(loc_id,2,dims2,"string2D",tid,buf12); status = H5Tclose(tid); + for (i=0; i<3; i++) + for (j=0; j<2; j++) + buf12a[i][j]=buf12[i][j]; + tid = H5Tcopy(H5T_C_S1); + status = H5Tset_size(tid, H5T_VARIABLE); + write_attr(loc_id,2,dims2,"VLstring2D",tid,buf12a); + status = H5Tclose(tid); + /*------------------------------------------------------------------------- * H5T_BITFIELD *------------------------------------------------------------------------- @@ -1201,7 +1221,7 @@ position array of </g1> array of </g1> difference [ 2 0 ] 5 0 5 [ 2 1 ] 6 0 6 */ - tid = H5Tcreate(H5T_OPAQUE, 1); + tid = H5Tcreate(H5T_OPAQUE, (size_t)1); status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */ write_attr(loc_id,2,dims2,"opaque2D",tid,buf22); status = H5Tclose(tid); @@ -1288,7 +1308,6 @@ position enum2D of </g1> enum2D of </g1> difference n=0; for (i = 0; i < 3; i++) { for (j = 0; j < 2; j++) { - int l; buf52[i][j].p = malloc((i + 1) * sizeof(int)); buf52[i][j].len = i + 1; for (l = 0; l < i + 1; l++) @@ -1411,7 +1430,11 @@ position float2D of </g1> float2D of </g1> difference if (make_diffs) { - memset(buf13,'z',sizeof buf13); + for (i=0; i<4; i++) + for (j=0; j<3; j++) + for (k=0; k<2; k++) + for (l=0; l<2; l++) + buf13[i][j][k][l]='z'; } /* @@ -1472,10 +1495,19 @@ position string3D of </g1> string3D of </g1> difference */ tid = H5Tcopy(H5T_C_S1); - status = H5Tset_size(tid, 2); + status = H5Tset_size(tid, (size_t)STR_SIZE); write_attr(loc_id,3,dims3,"string3D",tid,buf13); status = H5Tclose(tid); + for (i=0; i<4; i++) + for (j=0; j<3; j++) + for (k=0; k<2; k++) + buf13a[i][j][k]=buf13[i][j][k]; + tid = H5Tcopy(H5T_C_S1); + status = H5Tset_size(tid, H5T_VARIABLE); + write_attr(loc_id,3,dims3,"VLstring3D",tid,buf13a); + status = H5Tclose(tid); + /*------------------------------------------------------------------------- * H5T_BITFIELD *------------------------------------------------------------------------- @@ -1528,7 +1560,7 @@ position bitfield3D of </g1> bitfield3D of </g1> difference * H5T_OPAQUE *------------------------------------------------------------------------- */ - tid = H5Tcreate(H5T_OPAQUE, 1); + tid = H5Tcreate(H5T_OPAQUE, (size_t)1); status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */ write_attr(loc_id,3,dims3,"opaque3D",tid,buf23); status = H5Tclose(tid); @@ -1686,7 +1718,6 @@ position enum3D of </g1> enum3D of </g1> difference for (i = 0; i < 4; i++) { for (j = 0; j < 3; j++) { for (k = 0; k < 2; k++) { - int l; buf53[i][j][k].p = malloc((i + 1) * sizeof(int)); buf53[i][j][k].len = i + 1; for (l = 0; l < i + 1; l++) @@ -1821,13 +1852,14 @@ void write_dset_in(hid_t loc_id, hid_t tid; hid_t dcpl; herr_t status; - int val, i, j, k, n; + int val, i, j, k, l, n; float f; int fillvalue=2; /* create 1D attributes with dimension [2], 2 elements */ hsize_t dims[1]={2}; char buf1[2][STR_SIZE]= {"ab","de"}; /* string */ + char *buf1a[2]; /* VL string */ char buf2[2]= {1,2}; /* bitfield, opaque */ s_t buf3[2]= {{1,2},{3,4}}; /* compound */ hobj_ref_t buf4[2]; /* reference */ @@ -1840,7 +1872,8 @@ void write_dset_in(hid_t loc_id, /* create 2D attributes with dimension [3][2], 6 elements */ hsize_t dims2[2]={3,2}; - char buf12[6][STR_SIZE]= {"ab","cd","ef","gh","ij","kl"}; /* string */ + char buf12[3][2][STR_SIZE]= {{"ab","cd"},{"ef","gh"},{"ij","kl"}}; /* string */ + char *buf12a[3][2]; /* VL string */ char buf22[3][2]= {{1,2},{3,4},{5,6}}; /* bitfield, opaque */ s_t buf32[6]= {{1,2},{3,4},{5,6},{7,8},{9,10},{11,12}}; /* compound */ hobj_ref_t buf42[3][2]; /* reference */ @@ -1851,9 +1884,11 @@ void write_dset_in(hid_t loc_id, /* create 3D attributes with dimension [4][3][2], 24 elements */ hsize_t dims3[3]={4,3,2}; - char buf13[24][STR_SIZE]= {"ab","cd","ef","gh","ij","kl","mn","pq", - "rs","tu","vw","xz","AB","CD","EF","GH", - "IJ","KL","MN","PQ","RS","TU","VW","XZ"}; /* string */ + char buf13[4][3][2][STR_SIZE]= {{{"ab","cd"},{"ef","gh"},{"ij","kl"}}, + {{"mn","pq"},{"rs","tu"},{"vw","xz"}}, + {{"AB","CD"},{"EF","GH"},{"IJ","KL"}}, + {{"MN","PQ"},{"RS","TU"},{"VW","XZ"}}}; /* string */ + char *buf13a[4][3][2]; /* VL string */ char buf23[4][3][2]; /* bitfield, opaque */ s_t buf33[4][3][2]; /* compound */ hobj_ref_t buf43[4][3][2]; /* reference */ @@ -1878,17 +1913,22 @@ void write_dset_in(hid_t loc_id, { for (i=0; i<2; i++) for (j=0; j<2; j++) - { buf1[i][j]='z'; - } } tid = H5Tcopy(H5T_C_S1); - status = H5Tset_size(tid,STR_SIZE); + status = H5Tset_size(tid,(size_t)STR_SIZE); write_dset(loc_id,1,dims,"string",tid,buf1); status = H5Tclose(tid); + for (i=0; i<2; i++) + buf1a[i]=buf1[i]; + tid = H5Tcopy(H5T_C_S1); + status = H5Tset_size(tid, H5T_VARIABLE); + write_dset(loc_id,1,dims,"VLstring",tid,buf1a); + status = H5Tclose(tid); + /*------------------------------------------------------------------------- * H5T_BITFIELD *------------------------------------------------------------------------- @@ -1917,7 +1957,7 @@ void write_dset_in(hid_t loc_id, } } - tid = H5Tcreate(H5T_OPAQUE, 1); + tid = H5Tcreate(H5T_OPAQUE, (size_t)1); status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */ write_dset(loc_id,1,dims,"opaque",tid,buf2); status = H5Tclose(tid); @@ -2051,15 +2091,26 @@ void write_dset_in(hid_t loc_id, if (make_diffs) { - memset(buf12, 'z', sizeof buf12); + for (i=0; i<3; i++) + for (j=0; j<2; j++) + for (k=0; k<2; k++) + buf12[i][j][k]='z'; } tid = H5Tcopy(H5T_C_S1); - status = H5Tset_size(tid,STR_SIZE); + status = H5Tset_size(tid,(size_t)STR_SIZE); write_dset(loc_id,2,dims2,"string2D",tid,buf12); status = H5Tclose(tid); + for (i=0; i<3; i++) + for (j=0; j<2; j++) + buf12a[i][j]=buf12[i][j]; + tid = H5Tcopy(H5T_C_S1); + status = H5Tset_size(tid, H5T_VARIABLE); + write_dset(loc_id,2,dims2,"VLstring2D",tid,buf12a); + status = H5Tclose(tid); + /*------------------------------------------------------------------------- * H5T_BITFIELD *------------------------------------------------------------------------- @@ -2079,7 +2130,7 @@ void write_dset_in(hid_t loc_id, * H5T_OPAQUE *------------------------------------------------------------------------- */ - tid = H5Tcreate(H5T_OPAQUE, 1); + tid = H5Tcreate(H5T_OPAQUE, (size_t)1); status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */ write_dset(loc_id,2,dims2,"opaque2D",tid,buf22); status = H5Tclose(tid); @@ -2135,8 +2186,6 @@ void write_dset_in(hid_t loc_id, n = 0; for(i = 0; i < 3; i++) for(j = 0; j < 2; j++) { - int l; - buf52[i][j].p = malloc((i + 1) * sizeof(int)); buf52[i][j].len = i + 1; for(l = 0; l < i + 1; l++) @@ -2213,14 +2262,27 @@ void write_dset_in(hid_t loc_id, if (make_diffs) { - memset(buf13,'z',sizeof buf13); + for (i=0; i<4; i++) + for (j=0; j<3; j++) + for (k=0; k<2; k++) + for (l=0; l<2; l++) + buf13[i][j][k][l]='z'; } tid = H5Tcopy(H5T_C_S1); - status = H5Tset_size(tid,STR_SIZE); + status = H5Tset_size(tid,(size_t)STR_SIZE); write_dset(loc_id,3,dims3,"string3D",tid,buf13); status = H5Tclose(tid); + for (i=0; i<4; i++) + for (j=0; j<3; j++) + for (k=0; k<2; k++) + buf13a[i][j][k]=buf13[i][j][k]; + tid = H5Tcopy(H5T_C_S1); + status = H5Tset_size(tid, H5T_VARIABLE); + write_dset(loc_id,3,dims3,"VLstring3D",tid,buf13a); + status = H5Tclose(tid); + /*------------------------------------------------------------------------- * H5T_BITFIELD *------------------------------------------------------------------------- @@ -2246,7 +2308,7 @@ void write_dset_in(hid_t loc_id, * H5T_OPAQUE *------------------------------------------------------------------------- */ - tid = H5Tcreate(H5T_OPAQUE, 1); + tid = H5Tcreate(H5T_OPAQUE, (size_t)1); status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */ write_dset(loc_id,3,dims3,"opaque3D",tid,buf23); status = H5Tclose(tid); @@ -2316,8 +2378,6 @@ void write_dset_in(hid_t loc_id, for(i = 0; i < 4; i++) for(j = 0; j < 3; j++) for(k = 0; k < 2; k++) { - int l; - buf53[i][j][k].p = malloc((i + 1) * sizeof(int)); buf53[i][j][k].len = i + 1; for(l = 0; l < i + 1; l++) @@ -2410,7 +2470,7 @@ void gen_datareg(hid_t fid, int i; /* allocate the buffer for write the references */ - rbuf = calloc(2, sizeof(hdset_reg_ref_t)); + rbuf = calloc((size_t)2, sizeof(hdset_reg_ref_t)); /* allocate the buffer for write the data dataset */ buf = malloc(10 * 10 * sizeof(int)); @@ -2455,7 +2515,7 @@ void gen_datareg(hid_t fid, coord[3][0]=2; coord[3][1]=5; coord[4][0]=1; coord[4][1]=7; } - H5Sselect_elements(sid1,H5S_SELECT_SET,5,coord); + H5Sselect_elements(sid1,H5S_SELECT_SET,(size_t)5,(const hsize_t *)coord); H5Sget_select_npoints(sid1); /* store second dataset region */ @@ -2524,7 +2584,7 @@ int test_hyperslab(const char *fname, goto out; /* create a evenly divided buffer from 0 to 127 */ - buf = (char *)HDmalloc((unsigned)(nelmts * size)); + buf = (char *)HDmalloc((size_t)(nelmts * size)); s = 1024 * 1024 / 127; for(i = 0, j = 0, c = 0; i < 1024 * 1024; j++, i++) { if(j == s) { diff --git a/tools/h5import/h5import.c b/tools/h5import/h5import.c index f8f518b..d1b15bb 100755 --- a/tools/h5import/h5import.c +++ b/tools/h5import/h5import.c @@ -45,10 +45,6 @@ int main(int argc, char *argv[]) (void)HDsetvbuf(stderr, (char *) NULL, _IOLBF, 0); (void)HDsetvbuf(stdout, (char *) NULL, _IOLBF, 0); -#if defined __MWERKS__ - argc = ccommand(&argv); -#endif - if ( argv[1] && (strcmp("-V",argv[1])==0) ) { print_version("h5import"); @@ -275,7 +271,7 @@ gtoken(char *s) * Programmer: pkmat * * Modifications: pvn - * 7/23/2007. Added support for STR type + * 7/23/2007. Added support for STR type, extra parameter FILE_ID * *------------------------------------------------------------------------- */ @@ -293,12 +289,53 @@ processDataFile(char *infile, struct Input *in, FILE **strm, hid_t file_id) const char *err10 = "Unrecognized input class type.\n"; const char *err11 = "Error in reading string data.\n"; - if ((*strm = fopen(infile, "r")) == NULL) + /*------------------------------------------------------------------------- + * special case for opening binary classes in WIN32 + * "FP" denotes a floating point binary file, + * "IN" denotes a signed integer binary file, + * "UIN" denotes an unsigned integer binary file, + *------------------------------------------------------------------------- + */ + if ( in->inputClass == 4 /* "IN" */ || + in->inputClass == 3 /* "FP" */ || + in->inputClass == 7 /* "UIN" */ + + ) + { + +#ifdef WIN32 + + if ((*strm = fopen(infile, "rb")) == NULL) + { + (void) fprintf(stderr, err1, infile); + return(-1); + } +#else + + if ((*strm = fopen(infile, "r")) == NULL) + { + (void) fprintf(stderr, err1, infile); + return(-1); + } + +#endif + + } + /*------------------------------------------------------------------------- + * if the input class is not binary, just use "r" + *------------------------------------------------------------------------- + */ + else { - (void) fprintf(stderr, err1, infile); - return(-1); + if ((*strm = fopen(infile, "r")) == NULL) + { + (void) fprintf(stderr, err1, infile); + return(-1); + } } + + switch(in->inputClass) { case 0: /* TEXTIN */ @@ -372,7 +409,7 @@ readIntegerData(FILE **strm, struct Input *in) H5DT_INT8 *in08; H5DT_INT16 *in16, temp; H5DT_INT32 *in32; -#ifndef _WIN32 +#ifndef WIN32 H5DT_INT64 *in64; char buffer[256]; #endif diff --git a/tools/h5import/h5importtest.c b/tools/h5import/h5importtest.c index 2a8c827..9272632 100755 --- a/tools/h5import/h5importtest.c +++ b/tools/h5import/h5importtest.c @@ -21,271 +21,378 @@ * h5importtest * * Description: - * This program creates files that can be + * This program creates that can be * used to test the h5import program. * */ -/* - * Define names for test files - */ int main(void) { - int nrow = 3, ncol = 4, npln = 5; - int i, j, k; - FILE *sp; - + int nrow = 3, ncol = 4, npln = 5; + int i, j, k; + FILE *sp; + float b32r3[5][3][4]; float row4[3], col4[4], pln4[5]; float rowo4 = (float)11.0e0, colo4 = (float)21.0e0, plno4 = (float)51.0e0; float rowi4 = (float)1.0e0, coli4 = (float)2.0e0, plni4 = (float)5.0e0; - - int b32i3[5][3][4]; - int row4i[3], col4i[4], pln4i[5]; - int rowo4i = (int)11 , colo4i = (int)21 , plno4i = (int)51 ; - int rowi4i = (int)1 , coli4i = (int)2 , plni4i = (int)5 ; - -#ifndef _WIN32 - long_long b64i2[3][4], b64i3[5][3][4]; - long_long row4i64[3], col4i64[4], pln4i64[5]; - long_long rowo4i64 = (long_long)11 , colo4i64 = (long_long)21 , plno4i64 = (long_long)51 ; - long_long rowi4i64 = (long_long)1 , coli4i64 = (long_long)2 , plni4i64 = (long_long)5 ; + + int b32i3[5][3][4]; + int row4i[3], col4i[4], pln4i[5]; + int rowo4i = (int)11 , colo4i = (int)21 , plno4i = (int)51 ; + int rowi4i = (int)1 , coli4i = (int)2 , plni4i = (int)5 ; + +#ifndef WIN32 + long_long b64i2[3][4], b64i3[5][3][4]; + long_long row4i64[3], col4i64[4], pln4i64[5]; + long_long rowo4i64 = (long_long)11 , colo4i64 = (long_long)21 , plno4i64 = (long_long)51 ; + long_long rowi4i64 = (long_long)1 , coli4i64 = (long_long)2 , plni4i64 = (long_long)5 ; #endif - + short b16i3[5][3][4]; short row4i16[3], col4i16[4], pln4i16[5]; short rowo4i16 = (short)11 , colo4i16 = (short)21 , plno4i16 = (short)51 ; short rowi4i16 = (short)1 , coli4i16 = (short)2 , plni4i16 = (short)5 ; - - char b8i3[5][3][4]; - char row4i8[3], col4i8[4], pln4i8[5]; - char rowo4i8 = (char)11 , colo4i8 = (char)21 , plno4i8 = (char)51 ; - char rowi4i8 = (char)1 , coli4i8 = (char)2 , plni4i8 = (char)5 ; - - double b64r3[5][3][4]; - double row8[3], col8[4], pln8[5]; - double rowo8 = 11.0e0, colo8 = 21.0e0, plno8 = 51.0e0; - double rowi8 = 1.0e0, coli8 = 2.0e0, plni8 = 5.0e0; - - + + char b8i3[5][3][4]; + char row4i8[3], col4i8[4], pln4i8[5]; + char rowo4i8 = (char)11 , colo4i8 = (char)21 , plno4i8 = (char)51 ; + char rowi4i8 = (char)1 , coli4i8 = (char)2 , plni4i8 = (char)5 ; + + double b64r3[5][3][4]; + double row8[3], col8[4], pln8[5]; + double rowo8 = 11.0e0, colo8 = 21.0e0, plno8 = 51.0e0; + double rowi8 = 1.0e0, coli8 = 2.0e0, plni8 = 5.0e0; + + /* - * initialize the row, column, and plane vectors - * - * row values start at 11 and increment by 1 => 11, 12, 13 - * column values start at 21 and increment by 2 => 21, 23, 25, 27 - * plane values start at 51 and increment by 5 => 51, 56, 61, 66, 71 - */ - - + * initialize the row, column, and plane vectors + * + * row values start at 11 and increment by 1 => 11, 12, 13 + * column values start at 21 and increment by 2 => 21, 23, 25, 27 + * plane values start at 51 and increment by 5 => 51, 56, 61, 66, 71 + */ + + /* - * build array elements - rank 2 - * - * element value = sum of row value and col values - */ - + * build array elements - rank 2 + * + * element value = sum of row value and col values + */ + row4[0] = rowo4; col4[0] = colo4; pln4[0] = plno4; - + row8[0] = rowo8; col8[0] = colo8; pln8[0] = plno8; - + row4i[0] = rowo4i; col4i[0] = colo4i; pln4i[0] = plno4i; - -#ifndef _WIN32 + +#ifndef WIN32 row4i64[0] = rowo4i64; col4i64[0] = colo4i64; pln4i64[0] = plno4i64; #endif - + row4i16[0] = rowo4i16; col4i16[0] = colo4i16; pln4i16[0] = plno4i16; - + row4i8[0] = rowo4i8; col4i8[0] = colo4i8; pln4i8[0] = plno4i8; - + for (i = 1; i < nrow; i++) { row4[i] = row4[i - 1] + rowi4; row8[i] = row8[i - 1] + rowi8; row4i[i] = row4i[i - 1] + rowi4i; -#ifndef _WIN32 - row4i64[i] = row4i64[i - 1] + rowi4i64; +#ifndef WIN32 + row4i64[i] = row4i64[i - 1] + rowi4i64; #endif - row4i16[i] = row4i16[i - 1] + rowi4i16; - row4i8[i] = row4i8[i - 1] + rowi4i8; + row4i16[i] = row4i16[i - 1] + rowi4i16; + row4i8[i] = row4i8[i - 1] + rowi4i8; } for (j = 1; j < ncol; j++) { - col4[j] = col4[j - 1] + coli4; - col8[j] = col8[j - 1] + coli8; - col4i[j] = col4i[j - 1] + coli4i; -#ifndef _WIN32 - col4i64[j] = col4i64[j - 1] + coli4i64; + col4[j] = col4[j - 1] + coli4; + col8[j] = col8[j - 1] + coli8; + col4i[j] = col4i[j - 1] + coli4i; +#ifndef WIN32 + col4i64[j] = col4i64[j - 1] + coli4i64; #endif - col4i16[j] = col4i16[j - 1] + coli4i16; - col4i8[j] = col4i8[j - 1] + coli4i8; + col4i16[j] = col4i16[j - 1] + coli4i16; + col4i8[j] = col4i8[j - 1] + coli4i8; } for (k = 1; k < npln; k++) { - pln4[k] = pln4[k - 1] + plni4; - pln8[k] = pln8[k - 1] + plni8; - pln4i[k] = pln4i[k - 1] + plni4i; -#ifndef _WIN32 - pln4i64[k] = pln4i64[k - 1] + plni4i64; + pln4[k] = pln4[k - 1] + plni4; + pln8[k] = pln8[k - 1] + plni8; + pln4i[k] = pln4i[k - 1] + plni4i; +#ifndef WIN32 + pln4i64[k] = pln4i64[k - 1] + plni4i64; #endif - pln4i16[k] = pln4i16[k - 1] + plni4i16; - pln4i8[k] = pln4i8[k - 1] + plni4i8; - } - - for (i = 0; i < nrow; i++) - { - for (j = 0; j < ncol; j++) - { -#ifndef _WIN32 - b64i2[i][j] = row4i64[i] + col4i64[j]; + pln4i16[k] = pln4i16[k - 1] + plni4i16; + pln4i8[k] = pln4i8[k - 1] + plni4i8; + } + + for (i = 0; i < nrow; i++) + { + for (j = 0; j < ncol; j++) + { +#ifndef WIN32 + b64i2[i][j] = row4i64[i] + col4i64[j]; #endif - } - } + } + } /* - * build array elements - rank 3 - * - * element value = sum of row value, col, and plane values - */ - + * build array elements - rank 3 + * + * element value = sum of row value, col, and plane values + */ + for (i = 0; i < nrow; i++) - { - for (j = 0; j < ncol; j++) + { + for (j = 0; j < ncol; j++) + { + for (k = 0; k < npln; k++) { - for (k = 0; k < npln; k++) - { - b32r3[k][i][j] = row4[i] + col4[j] + pln4[k]; - b64r3[k][i][j] = row8[i] + col8[j] + pln8[k]; - b32i3[k][i][j] = row4i[i] + col4i[j] + pln4i[k]; -#ifndef _WIN32 - b64i3[k][i][j] = row4i64[i] + col4i64[j] + pln4i64[k]; + b32r3[k][i][j] = row4[i] + col4[j] + pln4[k]; + b64r3[k][i][j] = row8[i] + col8[j] + pln8[k]; + b32i3[k][i][j] = row4i[i] + col4i[j] + pln4i[k]; +#ifndef WIN32 + b64i3[k][i][j] = row4i64[i] + col4i64[j] + pln4i64[k]; #endif - b16i3[k][i][j] = row4i16[i] + col4i16[j] + pln4i16[k]; - b8i3[k][i][j] = row4i8[i] + col4i8[j] + pln4i8[k]; - } + b16i3[k][i][j] = row4i16[i] + col4i16[j] + pln4i16[k]; + b8i3[k][i][j] = row4i8[i] + col4i8[j] + pln4i8[k]; } - } + } + } - /* - * binary 32-bit file - rank 2 & 3 - */ + #ifndef UNICOS - sp = fopen("txtin16", "w"); - for (k = 0; k < npln; k++) - for (i = 0; i < nrow; i++) + + /*------------------------------------------------------------------------- + * TOOLTEST txtin16.txt -c $srcdir/testfiles/txtin16.conf -o txtin16.h5 + *------------------------------------------------------------------------- + */ + + + sp = fopen("txtin16.txt", "w"); + for (k = 0; k < npln; k++) + { + for (i = 0; i < nrow; i++) { - for (j = 0; j < ncol; j++) - (void) fprintf(sp, "%10u", b16i3[k][i][j]); - (void) fprintf(sp, "\n"); + for (j = 0; j < ncol; j++) + (void) fprintf(sp, "%10u", b16i3[k][i][j]); + (void) fprintf(sp, "\n"); } + } (void) fclose(sp); - sp = fopen("txtin32", "w"); - for (k = 0; k < npln; k++) - for (i = 0; i < nrow; i++) + /*------------------------------------------------------------------------- + * TOOLTEST txtin32.txt -c $srcdir/testfiles/textin32.conf -o textin32.h5 + *------------------------------------------------------------------------- + */ + + sp = fopen("txtin32.txt", "w"); + for (k = 0; k < npln; k++) + { + for (i = 0; i < nrow; i++) { - for (j = 0; j < ncol; j++) - (void) fprintf(sp, "%10d", b32i3[k][i][j]); - (void) fprintf(sp, "\n"); + for (j = 0; j < ncol; j++) + (void) fprintf(sp, "%10d", b32i3[k][i][j]); + (void) fprintf(sp, "\n"); } - (void) fclose(sp); + } + (void) fclose(sp); + + /*------------------------------------------------------------------------- + * TOOLTEST binin32.bin -c $srcdir/testfiles/binin32.conf -o binin32.h5 + *------------------------------------------------------------------------- + */ - sp = fopen("bin32", "w"); +#ifdef WIN32 + sp = fopen("binin32.bin", "wb"); +#else + sp = fopen("binin32.bin", "w"); +#endif for (k = 0; k < npln; k++) - for (i = 0; i < nrow; i++) - for (j = 0; j < ncol; j++) - (void) fwrite((char *) &b32i3[k][i][j], sizeof(int), 1, sp); + { + for (i = 0; i < nrow; i++) + { + for (j = 0; j < ncol; j++) + { + (void) fwrite((char *) &b32i3[k][i][j], sizeof(int), 1, sp); + } + } + } (void) fclose(sp); + /*------------------------------------------------------------------------- + * TOOLTEST binuin32.bin -c $srcdir/testfiles/binuin32.conf -o binuin32.h5 + *------------------------------------------------------------------------- + */ - sp = fopen("buin32", "w"); +#ifdef WIN32 + sp = fopen("binuin32.bin", "wb"); +#else + sp = fopen("binuin32.bin", "w"); +#endif for (k = 0; k < npln; k++) - for (i = 0; i < nrow; i++) - for (j = 0; j < ncol; j++) - (void) fwrite((char *) &b32i3[k][i][j], sizeof(unsigned int), 1, sp); + { + for (i = 0; i < nrow; i++) + { + for (j = 0; j < ncol; j++) + { + (void) fwrite((char *) &b32i3[k][i][j], sizeof(unsigned int), 1, sp); + } + } + } (void) fclose(sp); -#ifndef _WIN32 - sp = fopen("bin64-2", "w"); - for (i = 0; i < nrow; i++) - for (j = 0; j < ncol; j++) - (void) fwrite((char *) &b64i2[i][j], sizeof(long_long), 1, sp); - (void) fclose(sp); -#endif - sp = fopen("bfp32", "w"); + + /*------------------------------------------------------------------------- + * TOOLTEST binin16.bin -c $srcdir/testfiles/binin16.conf -o binin16.h5 + *------------------------------------------------------------------------- + */ + +#ifdef WIN32 + sp = fopen("binin16.bin", "wb"); +#else + sp = fopen("binin16.bin", "w"); +#endif for (k = 0; k < npln; k++) + { for (i = 0; i < nrow; i++) + { for (j = 0; j < ncol; j++) - (void) fwrite((char *) &b32r3[k][i][j], - sizeof(float), 1, sp); + { + (void) fwrite((char *) &b16i3[k][i][j], sizeof(short), 1, sp); + } + } + } (void) fclose(sp); - sp = fopen("bin16", "w"); - for (k = 0; k < npln; k++) - for (i = 0; i < nrow; i++) - for (j = 0; j < ncol; j++) - (void) fwrite((char *) &b16i3[k][i][j], sizeof(short), 1, - sp); + /*------------------------------------------------------------------------- + * TOOLTEST binuin16.bin -c $srcdir/testfiles/binuin16.conf -o binuin16.h5 + *------------------------------------------------------------------------- + */ +#ifdef WIN32 + sp = fopen("binuin16.bin", "wb"); +#else + sp = fopen("binuin16.bin", "w"); +#endif + for (k = 0; k < npln; k++) + { + for (i = 0; i < nrow; i++) + { + for (j = 0; j < ncol; j++) + { + (void) fwrite((char *) &b16i3[k][i][j], sizeof(unsigned short), 1, sp); + } + } + } (void) fclose(sp); - sp = fopen("buin16", "w"); - for (k = 0; k < npln; k++) - for (i = 0; i < nrow; i++) - for (j = 0; j < ncol; j++) - (void) fwrite((char *) &b16i3[k][i][j], sizeof(unsigned short), 1, - sp); - (void) fclose(sp); -#ifndef _WIN32 - sp = fopen("bin64-3", "w"); - for (k = 0; k < npln; k++) - for (i = 0; i < nrow; i++) - for (j = 0; j < ncol; j++) - (void) fwrite((char *) &b64i3[k][i][j], sizeof(long_long), 1, - sp); - (void) fclose(sp); -#endif + /*------------------------------------------------------------------------- + * TOOLTEST binin8.bin -c $srcdir/testfiles/binin8.conf -o binin8.h5 + *------------------------------------------------------------------------- + */ - sp = fopen("bin8", "w"); +#ifdef WIN32 + sp = fopen("binin8.bin", "wb"); +#else + sp = fopen("binin8.bin", "w"); +#endif for (k = 0; k < npln; k++) - for (i = 0; i < nrow; i++) - for (j = 0; j < ncol; j++) - (void) fwrite((char *) &b8i3[k][i][j], sizeof(char), 1, - sp); + { + for (i = 0; i < nrow; i++) + { + for (j = 0; j < ncol; j++) + { + (void) fwrite((char *) &b8i3[k][i][j], sizeof(char), 1, sp); + } + } + } (void) fclose(sp); -#endif +#endif /* UNICOS */ - /* - * binary 64-bit file - rank 2 & 3 - */ - sp = fopen("bfp64", "w"); + + + /*------------------------------------------------------------------------- + * TOOLTEST binfp64.bin -c $srcdir/testfiles/binfp64.conf -o binfp64.h5 + *------------------------------------------------------------------------- + */ + + /* + * binary 64-bit file - rank 2 & 3 + */ + +#ifdef WIN32 + sp = fopen("binfp64.bin", "wb"); +#else + sp = fopen("binfp64.bin", "w"); +#endif for (k = 0; k < npln; k++) + { for (i = 0; i < nrow; i++) + { for (j = 0; j < ncol; j++) - (void) fwrite((char *) &b64r3[k][i][j], - sizeof(double), 1, sp); + { + (void) fwrite((char *) &b64r3[k][i][j], sizeof(double), 1, sp); + } + } + } (void) fclose(sp); + + + + /*------------------------------------------------------------------------- + * TOOLTEST binin8w.bin -c $srcdir/testfiles/binin8w.conf -o binin8w.h5 + *------------------------------------------------------------------------- + */ + + { + /* test CR+LF (13,10) and EOF (26) in windows */ + char bin8w[4] = {13,10,26,0}; + +#ifdef WIN32 + sp = fopen("binin8w.bin", "wb"); +#else + sp = fopen("binin8w.bin", "w"); +#endif + for (i = 0; i < 4; i++) + { + char c = bin8w[i]; + if ( fwrite( &c, sizeof(char), 1, sp) != 1 ) + printf("error writing file\n"); + } + fclose(sp); + + + } + + + + + return (0); } diff --git a/tools/h5import/h5importtestutil.sh b/tools/h5import/h5importtestutil.sh index 0687871..ff7dc35 100755 --- a/tools/h5import/h5importtestutil.sh +++ b/tools/h5import/h5importtestutil.sh @@ -60,49 +60,72 @@ cp $srcdir/testfiles/*.h5 tmp_testfiles/ $RUNSERIAL ./h5importtest TESTING "ASCII I32 rank 3 - Output BE " ; -TOOLTEST txtin32 -c $srcdir/testfiles/textin32 -o test1.h5 +#TOOLTEST txtin32 -c $srcdir/testfiles/textin32 -o test1.h5 +TOOLTEST $srcdir/testfiles/txtin16.txt -c $srcdir/testfiles/txtin32.conf -o txtin32.h5 TESTING "ASCII I16 rank 3 - Output LE - CHUNKED - extended" -TOOLTEST txtin16 -c $srcdir/testfiles/textin16 -o test2.h5 +#TOOLTEST txtin16 -c $srcdir/testfiles/textin16 -o test2.h5 +TOOLTEST $srcdir/testfiles/txtin16.txt -c $srcdir/testfiles/txtin16.conf -o txtin16.h5 + TESTING "ASCII I8 - rank 3 - Output I16 LE-Chunked+Extended+Compressed " -TOOLTEST txtin16 -c $srcdir/testfiles/textin8 -o test3.h5 +#TOOLTEST txtin16 -c $srcdir/testfiles/textin8 -o test3.h5 +TOOLTEST $srcdir/testfiles/txtin16.txt -c $srcdir/testfiles/txtin8.conf -o txtin8.h5 TESTING "ASCII UI32 - rank 3 - Output BE" -TOOLTEST $srcdir/testfiles/in1 -c $srcdir/testfiles/textuin32 -o test4.h5 +#TOOLTEST $srcdir/testfiles/in1 -c $srcdir/testfiles/textuin32 -o test4.h5 +TOOLTEST $srcdir/testfiles/txtuin32.txt -c $srcdir/testfiles/txtuin32.conf -o txtuin32.h5 TESTING "ASCII UI16 - rank 2 - Output LE+Chunked+Compressed " -TOOLTEST $srcdir/testfiles/in1 -c $srcdir/testfiles/textuin16 -o test5.h5 +#TOOLTEST $srcdir/testfiles/in1 -c $srcdir/testfiles/textuin16 -o test5.h5 +TOOLTEST $srcdir/testfiles/txtuin32.txt -c $srcdir/testfiles/txtuin16.conf -o txtuin16.h5 TESTING "ASCII F32 - rank 3 - Output LE " -TOOLTEST $srcdir/testfiles/fp1 -c $srcdir/testfiles/textfp32 -o test6.h5 +#TOOLTEST $srcdir/testfiles/fp1 -c $srcdir/testfiles/textfp32 -o test6.h5 +TOOLTEST $srcdir/testfiles/txtfp32.txt -c $srcdir/testfiles/txtfp32.conf -o txtfp32.h5 + TESTING "ASCII F64 - rank 3 - Output BE + CHUNKED+Extended+Compressed " -TOOLTEST $srcdir/testfiles/fp2 -c $srcdir/testfiles/textfp64 -o test7.h5 +#TOOLTEST $srcdir/testfiles/fp2 -c $srcdir/testfiles/textfp64 -o test7.h5 +TOOLTEST $srcdir/testfiles/txtfp64.txt -c $srcdir/testfiles/txtfp64.conf -o txtfp64.h5 TESTING "BINARY F64 - rank 3 - Output LE+CHUNKED+Extended+Compressed " -TOOLTEST bfp64 -c $srcdir/testfiles/conbfp64 -o test8.h5 +#TOOLTEST bfp64 -c $srcdir/testfiles/conbfp64 -o test8.h5 +TOOLTEST binfp64.bin -c $srcdir/testfiles/binfp64.conf -o binfp64.h5 + TESTING "BINARY I16 - rank 3 - Output order LE + CHUNKED + extended " -TOOLTEST bin16 -c $srcdir/testfiles/conbin16 -o test9.h5 +#TOOLTEST bin16 -c $srcdir/testfiles/conbin16 -o test9.h5 +TOOLTEST binin16.bin -c $srcdir/testfiles/binin16.conf -o binin16.h5 + TESTING "BINARY I8 - rank 3 - Output I16LE + Chunked+Extended+Compressed " -TOOLTEST bin8 -c $srcdir/testfiles/conbin8 -o test10.h5 +#TOOLTEST bin8 -c $srcdir/testfiles/conbin8 -o test10.h5 +TOOLTEST binin8.bin -c $srcdir/testfiles/binin8.conf -o binin8.h5 + TESTING "BINARY I32 - rank 3 - Output BE + CHUNKED " -TOOLTEST bin32 -c $srcdir/testfiles/conbin32 -o test11.h5 +#TOOLTEST bin32 -c $srcdir/testfiles/conbin32 -o test11.h5 +TOOLTEST binin32.bin -c $srcdir/testfiles/binin32.conf -o binin32.h5 + TESTING "BINARY UI16 - rank 3 - Output byte BE + CHUNKED " -TOOLTEST buin16 -c $srcdir/testfiles/conbuin16 -o test12.h5 +#TOOLTEST buin16 -c $srcdir/testfiles/conbuin16 -o test12.h5 +TOOLTEST binuin16.bin -c $srcdir/testfiles/binuin16.conf -o binuin16.h5 TESTING "BINARY UI32 - rank 3 - Output LE + CHUNKED " -TOOLTEST buin32 -c $srcdir/testfiles/conbuin32 -o test13.h5 +#TOOLTEST buin32 -c $srcdir/testfiles/conbuin32 -o test13.h5 +TOOLTEST binuin32.bin -c $srcdir/testfiles/binuin32.conf -o binuin32.h5 + TESTING "STR" -TOOLTEST $srcdir/testfiles/txtstr -c $srcdir/testfiles/textstr -o teststr.h5 +TOOLTEST $srcdir/testfiles/txtstr.txt -c $srcdir/testfiles/txtstr.conf -o txtstr.h5 + +TESTING "BINARY I8 CR LF EOF" +TOOLTEST binin8w.bin -c $srcdir/testfiles/binin8w.conf -o binin8w.h5 + -rm -f tx* b* *.dat -rm -f test*.h5 +rm -f *.txt *.bin *.h5 rm -rf tmp_testfiles else echo "** h5import or h5importtest not available ***" diff --git a/tools/h5import/testfiles/conbfp64 b/tools/h5import/testfiles/binfp64.conf index 6b4c361..6b4c361 100755 --- a/tools/h5import/testfiles/conbfp64 +++ b/tools/h5import/testfiles/binfp64.conf diff --git a/tools/h5import/testfiles/test8.h5 b/tools/h5import/testfiles/binfp64.h5 Binary files differindex 80e3a8a..80e3a8a 100644 --- a/tools/h5import/testfiles/test8.h5 +++ b/tools/h5import/testfiles/binfp64.h5 diff --git a/tools/h5import/testfiles/conbin16 b/tools/h5import/testfiles/binin16.conf index 06869cb..06869cb 100755 --- a/tools/h5import/testfiles/conbin16 +++ b/tools/h5import/testfiles/binin16.conf diff --git a/tools/h5import/testfiles/test9.h5 b/tools/h5import/testfiles/binin16.h5 Binary files differindex 0825bbc..0825bbc 100644 --- a/tools/h5import/testfiles/test9.h5 +++ b/tools/h5import/testfiles/binin16.h5 diff --git a/tools/h5import/testfiles/conbin32 b/tools/h5import/testfiles/binin32.conf index 11996ef..11996ef 100755 --- a/tools/h5import/testfiles/conbin32 +++ b/tools/h5import/testfiles/binin32.conf diff --git a/tools/h5import/testfiles/test11.h5 b/tools/h5import/testfiles/binin32.h5 Binary files differindex fd8faa9..fd8faa9 100644 --- a/tools/h5import/testfiles/test11.h5 +++ b/tools/h5import/testfiles/binin32.h5 diff --git a/tools/h5import/testfiles/conbin8 b/tools/h5import/testfiles/binin8.conf index 1edd80a..1edd80a 100755 --- a/tools/h5import/testfiles/conbin8 +++ b/tools/h5import/testfiles/binin8.conf diff --git a/tools/h5import/testfiles/test10.h5 b/tools/h5import/testfiles/binin8.h5 Binary files differindex a1d1a37..a1d1a37 100644 --- a/tools/h5import/testfiles/test10.h5 +++ b/tools/h5import/testfiles/binin8.h5 diff --git a/tools/h5import/testfiles/binin8w.conf b/tools/h5import/testfiles/binin8w.conf new file mode 100644 index 0000000..fccb4ac --- /dev/null +++ b/tools/h5import/testfiles/binin8w.conf @@ -0,0 +1,9 @@ + +INPUT-CLASS IN +INPUT-SIZE 8 +RANK 1 +DIMENSION-SIZES 4 +OUTPUT-BYTE-ORDER LE +OUTPUT-CLASS IN +OUTPUT-SIZE 8 +OUTPUT-ARCHITECTURE STD diff --git a/tools/h5import/testfiles/binin8w.h5 b/tools/h5import/testfiles/binin8w.h5 Binary files differnew file mode 100644 index 0000000..64acaed --- /dev/null +++ b/tools/h5import/testfiles/binin8w.h5 diff --git a/tools/h5import/testfiles/conbuin16 b/tools/h5import/testfiles/binuin16.conf index a4603df..a4603df 100755 --- a/tools/h5import/testfiles/conbuin16 +++ b/tools/h5import/testfiles/binuin16.conf diff --git a/tools/h5import/testfiles/test12.h5 b/tools/h5import/testfiles/binuin16.h5 Binary files differindex c486c89..c486c89 100644 --- a/tools/h5import/testfiles/test12.h5 +++ b/tools/h5import/testfiles/binuin16.h5 diff --git a/tools/h5import/testfiles/conbuin32 b/tools/h5import/testfiles/binuin32.conf index a649e97..a649e97 100755 --- a/tools/h5import/testfiles/conbuin32 +++ b/tools/h5import/testfiles/binuin32.conf diff --git a/tools/h5import/testfiles/test13.h5 b/tools/h5import/testfiles/binuin32.h5 Binary files differindex 41699d7..41699d7 100644 --- a/tools/h5import/testfiles/test13.h5 +++ b/tools/h5import/testfiles/binuin32.h5 diff --git a/tools/h5import/testfiles/conbfp32 b/tools/h5import/testfiles/conbfp32 deleted file mode 100755 index 66e6b35..0000000 --- a/tools/h5import/testfiles/conbfp32 +++ /dev/null @@ -1,12 +0,0 @@ -PATH /fpbin/32-bit -INPUT-CLASS FP -INPUT-SIZE 32 -RANK 3 -DIMENSION-SIZES 5 3 4 -OUTPUT-ARCHITECTURE IEEE -OUTPUT-BYTE-ORDER BE -CHUNKED-DIMENSION-SIZES 2 2 2 -COMPRESSION-PARAM 2 - - - diff --git a/tools/h5import/testfiles/textfp32 b/tools/h5import/testfiles/txtfp32.conf index 9696a7f..9696a7f 100755 --- a/tools/h5import/testfiles/textfp32 +++ b/tools/h5import/testfiles/txtfp32.conf diff --git a/tools/h5import/testfiles/test6.h5 b/tools/h5import/testfiles/txtfp32.h5 Binary files differindex f74e003..f74e003 100644 --- a/tools/h5import/testfiles/test6.h5 +++ b/tools/h5import/testfiles/txtfp32.h5 diff --git a/tools/h5import/testfiles/fp1 b/tools/h5import/testfiles/txtfp32.txt index 142c94f..142c94f 100755 --- a/tools/h5import/testfiles/fp1 +++ b/tools/h5import/testfiles/txtfp32.txt diff --git a/tools/h5import/testfiles/textfp64 b/tools/h5import/testfiles/txtfp64.conf index fbab6a6..fbab6a6 100755 --- a/tools/h5import/testfiles/textfp64 +++ b/tools/h5import/testfiles/txtfp64.conf diff --git a/tools/h5import/testfiles/test7.h5 b/tools/h5import/testfiles/txtfp64.h5 Binary files differindex b6ba4f5..b6ba4f5 100644 --- a/tools/h5import/testfiles/test7.h5 +++ b/tools/h5import/testfiles/txtfp64.h5 diff --git a/tools/h5import/testfiles/fp2 b/tools/h5import/testfiles/txtfp64.txt index 6c83dc3..6c83dc3 100755 --- a/tools/h5import/testfiles/fp2 +++ b/tools/h5import/testfiles/txtfp64.txt diff --git a/tools/h5import/testfiles/textin16 b/tools/h5import/testfiles/txtin16.conf index d2d11c3..d2d11c3 100755 --- a/tools/h5import/testfiles/textin16 +++ b/tools/h5import/testfiles/txtin16.conf diff --git a/tools/h5import/testfiles/test2.h5 b/tools/h5import/testfiles/txtin16.h5 Binary files differindex dc6c1ea..dc6c1ea 100644 --- a/tools/h5import/testfiles/test2.h5 +++ b/tools/h5import/testfiles/txtin16.h5 diff --git a/tools/h5import/testfiles/in1 b/tools/h5import/testfiles/txtin16.txt index 0688e9b..0688e9b 100755..100644 --- a/tools/h5import/testfiles/in1 +++ b/tools/h5import/testfiles/txtin16.txt diff --git a/tools/h5import/testfiles/textin32 b/tools/h5import/testfiles/txtin32.conf index ca4802a..ca4802a 100755 --- a/tools/h5import/testfiles/textin32 +++ b/tools/h5import/testfiles/txtin32.conf diff --git a/tools/h5import/testfiles/test1.h5 b/tools/h5import/testfiles/txtin32.h5 Binary files differindex 350333c..350333c 100644 --- a/tools/h5import/testfiles/test1.h5 +++ b/tools/h5import/testfiles/txtin32.h5 diff --git a/tools/h5import/testfiles/txtin32.txt b/tools/h5import/testfiles/txtin32.txt new file mode 100644 index 0000000..0688e9b --- /dev/null +++ b/tools/h5import/testfiles/txtin32.txt @@ -0,0 +1,15 @@ + 83 85 87 89 + 84 86 88 90 + 85 87 89 91 + 88 90 92 94 + 89 91 93 95 + 90 92 94 96 + 93 95 97 99 + 94 96 98 100 + 95 97 99 101 + 98 100 102 104 + 99 101 103 105 + 100 102 104 106 + 103 105 107 109 + 104 106 108 110 + 105 107 109 111 diff --git a/tools/h5import/testfiles/textin8 b/tools/h5import/testfiles/txtin8.conf index 4405338..4405338 100755 --- a/tools/h5import/testfiles/textin8 +++ b/tools/h5import/testfiles/txtin8.conf diff --git a/tools/h5import/testfiles/test3.h5 b/tools/h5import/testfiles/txtin8.h5 Binary files differindex 42e7727..42e7727 100644 --- a/tools/h5import/testfiles/test3.h5 +++ b/tools/h5import/testfiles/txtin8.h5 diff --git a/tools/h5import/testfiles/textstr b/tools/h5import/testfiles/txtstr.conf index 85079e0..85079e0 100644 --- a/tools/h5import/testfiles/textstr +++ b/tools/h5import/testfiles/txtstr.conf diff --git a/tools/h5import/testfiles/teststr.h5 b/tools/h5import/testfiles/txtstr.h5 Binary files differindex ceb0810..ceb0810 100644 --- a/tools/h5import/testfiles/teststr.h5 +++ b/tools/h5import/testfiles/txtstr.h5 diff --git a/tools/h5import/testfiles/txtstr b/tools/h5import/testfiles/txtstr.txt index 25be0a6..25be0a6 100644 --- a/tools/h5import/testfiles/txtstr +++ b/tools/h5import/testfiles/txtstr.txt diff --git a/tools/h5import/testfiles/textuin16 b/tools/h5import/testfiles/txtuin16.conf index 753e6e8..753e6e8 100755 --- a/tools/h5import/testfiles/textuin16 +++ b/tools/h5import/testfiles/txtuin16.conf diff --git a/tools/h5import/testfiles/test5.h5 b/tools/h5import/testfiles/txtuin16.h5 Binary files differindex 9ee166a..9ee166a 100644 --- a/tools/h5import/testfiles/test5.h5 +++ b/tools/h5import/testfiles/txtuin16.h5 diff --git a/tools/h5import/testfiles/textuin32 b/tools/h5import/testfiles/txtuin32.conf index d61e1a1..d61e1a1 100755 --- a/tools/h5import/testfiles/textuin32 +++ b/tools/h5import/testfiles/txtuin32.conf diff --git a/tools/h5import/testfiles/test4.h5 b/tools/h5import/testfiles/txtuin32.h5 Binary files differindex 1a4dda5..1a4dda5 100644 --- a/tools/h5import/testfiles/test4.h5 +++ b/tools/h5import/testfiles/txtuin32.h5 diff --git a/tools/h5import/testfiles/txtuin32.txt b/tools/h5import/testfiles/txtuin32.txt new file mode 100755 index 0000000..0688e9b --- /dev/null +++ b/tools/h5import/testfiles/txtuin32.txt @@ -0,0 +1,15 @@ + 83 85 87 89 + 84 86 88 90 + 85 87 89 91 + 88 90 92 94 + 89 91 93 95 + 90 92 94 96 + 93 95 97 99 + 94 96 98 100 + 95 97 99 101 + 98 100 102 104 + 99 101 103 105 + 100 102 104 106 + 103 105 107 109 + 104 106 108 110 + 105 107 109 111 diff --git a/tools/h5repack/h5repack.c b/tools/h5repack/h5repack.c index 954f3e7..febf7d7 100644 --- a/tools/h5repack/h5repack.c +++ b/tools/h5repack/h5repack.c @@ -45,7 +45,7 @@ static int have_request(pack_opt_t *options); * Purpose: locate all high-level HDF5 objects in the file * and compress/chunk them using options * - * Algorythm: 2 traversals are made to the file; the 1st builds a list of + * Algorithm: 2 traversals are made to the file; the 1st builds a list of * the objects, the 2nd makes a copy of them, using the options; * the reason for the 1st traversal is to check for invalid * object name requests diff --git a/tools/h5repack/h5repack.h b/tools/h5repack/h5repack.h index baa888e..80fb1b0 100644 --- a/tools/h5repack/h5repack.h +++ b/tools/h5repack/h5repack.h @@ -19,17 +19,12 @@ #include "hdf5.h" #include "h5trav.h" -#include "H5Zprivate.h" /* H5Z_COMMON_CD_VALUES */ - - #define H5FOPENERROR "unable to open file" - -#define PFORMAT "%-7s %-7s %-7s\n" /*chunk info, compression info, name*/ -#define PFORMAT1 "%-7s %-7s %-7s" /*chunk info, compression info, name*/ - -#define MAX_NC_NAME 256 /* max length of a name */ -#define MAX_VAR_DIMS 32 /* max per variable dimensions */ +#define PFORMAT "%-7s %-7s %-7s\n" /* chunk info, compression info, name*/ +#define PFORMAT1 "%-7s %-7s %-7s" /* chunk info, compression info, name*/ +#define MAX_NC_NAME 256 /* max length of a name */ +#define MAX_VAR_DIMS 32 /* max per variable dimensions */ /*------------------------------------------------------------------------- * data structures for command line options @@ -53,7 +48,6 @@ typedef struct { H5Z_FILTER_SCALEOFFSET 6 , scaleoffset compression */ -/* #define CD_VALUES H5Z_COMMON_CD_VALUES */ #define CD_VALUES 20 typedef struct { diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index 008b6b9..c5646ed 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -119,7 +119,7 @@ static int not_comparable; is_zero=1; \ } -# define PDIFF(a,b) ( (b>a) ? (b-a) : (a-b)) +#define PDIFF(a,b) ( (b>a) ? (b-a) : (a-b)) /*------------------------------------------------------------------------- * local prototypes @@ -127,11 +127,12 @@ static int not_comparable; */ static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id,hid_t region1_id, hid_t region2_id, diff_opt_t *options); static hbool_t all_zero(const void *_mem, size_t size); -static int ull2float(unsigned long_long ull_value, float *f_value); static hsize_t character_compare(unsigned char *mem1,unsigned char *mem2,hsize_t i,int rank,hsize_t *dims,hsize_t *acc,hsize_t *pos,diff_opt_t *options,const char *obj1,const char *obj2,int *ph); static hsize_t character_compare_opt(unsigned char *mem1,unsigned char *mem2,hsize_t i,int rank,hsize_t *dims,hsize_t *acc,hsize_t *pos,diff_opt_t *options,const char *obj1,const char *obj2,int *ph); static hbool_t equal_float(float value, float expected); static hbool_t equal_double(double value, double expected); +static int ull2float(unsigned long_long ull_value, float *f_value); + /*------------------------------------------------------------------------- * NaN detection @@ -266,8 +267,6 @@ hsize_t diff_array( void *_mem1, size_t size; /* size of datum */ unsigned char *mem1 = (unsigned char*)_mem1; unsigned char *mem2 = (unsigned char*)_mem2; - unsigned char *tmp1; - unsigned char *tmp2; hsize_t acc[32]; /* accumulator position */ hsize_t pos[32]; /* matrix position */ int ph=1; /* print header */ @@ -288,23 +287,26 @@ hsize_t diff_array( void *_mem1, if(H5Tis_variable_str(m_type)) { - tmp1 = ((unsigned char**)mem1)[0]; - tmp2 = ((unsigned char**)mem2)[0]; - nfound+=diff_datum( - tmp1, - tmp2, - m_type, - (hsize_t)0, - rank, - dims, - acc, - pos, - options, - name1, - name2, - container1_id, - container2_id, - &ph); + for ( i = 0; i < nelmts; i++) + { + nfound+=diff_datum( + ((unsigned char**)mem1)[(size_t)i], + ((unsigned char**)mem2)[(size_t)i], + m_type, + i, + rank, + dims, + acc, + pos, + options, + name1, + name2, + container1_id, + container2_id, + &ph); + if (options->n && nfound>=options->count) + return nfound; + } /* i */ } else @@ -515,42 +517,35 @@ hsize_t diff_datum(void *_mem1, case H5T_STRING: { - H5T_str_t pad; char *s; - if(H5Tis_variable_str(m_type)) - { - /* mem1 is the pointer into the struct where a `char*' is stored. So we have - * to dereference the pointer to get the `char*' to pass to HDstrlen(). */ - s = *(char**)mem1; - if(s!=NULL) - size = HDstrlen(s); - } - else - { - s = (char *)mem1; - size = H5Tget_size(m_type); - } - - pad = H5Tget_strpad(m_type); - + /* Get pointer to first string to compare */ + s = (char *)mem1; + /* check for NULL pointer for string */ if(s!=NULL) { + if(H5Tis_variable_str(m_type)) + size = HDstrlen(s); + else + size = H5Tget_size(m_type); + + pad = H5Tget_strpad(m_type); + for (u=0; u<size && (s[u] || pad!=H5T_STR_NULLTERM); u++) nfound+=character_compare( - mem1 + u, - mem2 + u, /* offset */ - i, /* index position */ - rank, - dims, - acc, - pos, - options, - obj1, - obj2, - ph); + mem1 + u, + mem2 + u, /* offset */ + i, /* index position */ + rank, + dims, + acc, + pos, + options, + obj1, + obj2, + ph); } } @@ -697,7 +692,6 @@ hsize_t diff_datum(void *_mem1, H5Tclose(memb_type); } break; - /*------------------------------------------------------------------------- @@ -2867,7 +2861,6 @@ hsize_t diff_float(unsigned char *mem1, } - /*------------------------------------------------------------------------- * Function: diff_double * @@ -2897,80 +2890,111 @@ hsize_t diff_double(unsigned char *mem1, hsize_t i; double per; int both_zero; + int isnan1; + int isnan2; - - /* -d and !-p */ + + /*------------------------------------------------------------------------- + * -d and !-p + *------------------------------------------------------------------------- + */ + if (options->d && !options->p) { - for ( i = 0; i < nelmts; i++) { memcpy(&temp1_double, mem1, sizeof(double)); memcpy(&temp2_double, mem2, sizeof(double)); - - if (ABS(temp1_double-temp2_double) > options->delta) - { - if ( print_data(options) ) + + /*------------------------------------------------------------------------- + * detect NaNs + *------------------------------------------------------------------------- + */ + isnan1 = my_isnan(FLT_DOUBLE,&temp1_double); + isnan2 = my_isnan(FLT_DOUBLE,&temp2_double); + + if ( !isnan1 && !isnan2) + { + if (ABS(temp1_double-temp2_double) > options->delta) { - print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(F_FORMAT,temp1_double,temp2_double,ABS(temp1_double-temp2_double)); + if ( print_data(options) ) + { + print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(F_FORMAT,temp1_double,temp2_double,ABS(temp1_double-temp2_double)); + } + nfound++; } - nfound++; - } + } /* NaN */ mem1+=sizeof(double); mem2+=sizeof(double); if (options->n && nfound>=options->count) return nfound; - } + } /* i */ } - - /* !-d and -p */ + + /*------------------------------------------------------------------------- + * !-d and -p + *------------------------------------------------------------------------- + */ else if (!options->d && options->p) { - for ( i = 0; i < nelmts; i++) { memcpy(&temp1_double, mem1, sizeof(double)); memcpy(&temp2_double, mem2, sizeof(double)); - PER(temp1_double,temp2_double); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(F_FORMAT_P_NOTCOMP,temp1_double,temp2_double, - ABS(temp1_double-temp2_double)); - } - options->not_cmp=1; - nfound++; - } + /*------------------------------------------------------------------------- + * detect NaNs + *------------------------------------------------------------------------- + */ + isnan1 = my_isnan(FLT_DOUBLE,&temp1_double); + isnan2 = my_isnan(FLT_DOUBLE,&temp2_double); - else + if ( !isnan1 && !isnan2) + { + + PER(temp1_double,temp2_double); - if ( per > options->percent ) + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) { print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); parallel_print(SPACES); - parallel_print(F_FORMAT_P,temp1_double,temp2_double, - ABS(temp1_double-temp2_double), - ABS(1-temp2_double/temp1_double)); + parallel_print(F_FORMAT_P_NOTCOMP,temp1_double,temp2_double, + ABS(temp1_double-temp2_double)); } + options->not_cmp=1; nfound++; } - mem1+=sizeof(double); - mem2+=sizeof(double); - if (options->n && nfound>=options->count) - return nfound; - } + + else + + if ( per > options->percent ) + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(F_FORMAT_P,temp1_double,temp2_double, + ABS(temp1_double-temp2_double), + ABS(1-temp2_double/temp1_double)); + } + nfound++; + } + } /* NaN */ + mem1+=sizeof(double); + mem2+=sizeof(double); + if (options->n && nfound>=options->count) + return nfound; + } /* i */ } - /* -d and -p */ + /*------------------------------------------------------------------------- + * -d and -p + *------------------------------------------------------------------------- + */ else if ( options->d && options->p) { @@ -2979,41 +3003,58 @@ hsize_t diff_double(unsigned char *mem1, memcpy(&temp1_double, mem1, sizeof(double)); memcpy(&temp2_double, mem2, sizeof(double)); - PER(temp1_double,temp2_double); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(F_FORMAT_P_NOTCOMP,temp1_double,temp2_double, - ABS(temp1_double-temp2_double)); - } - options->not_cmp=1; - nfound++; - } + /*------------------------------------------------------------------------- + * detect NaNs + *------------------------------------------------------------------------- + */ + isnan1 = my_isnan(FLT_DOUBLE,&temp1_double); + isnan2 = my_isnan(FLT_DOUBLE,&temp2_double); - else + if ( !isnan1 && !isnan2) + { + + PER(temp1_double,temp2_double); - if ( per > options->percent && ABS(temp1_double-temp2_double) > options->delta ) + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) { print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); parallel_print(SPACES); - parallel_print(F_FORMAT_P,temp1_double,temp2_double, - ABS(temp1_double-temp2_double), - ABS(1-temp2_double/temp1_double)); + parallel_print(F_FORMAT_P_NOTCOMP,temp1_double,temp2_double, + ABS(temp1_double-temp2_double)); } + options->not_cmp=1; nfound++; } - mem1+=sizeof(double); - mem2+=sizeof(double); - if (options->n && nfound>=options->count) - return nfound; - } + + else + + if ( per > options->percent && ABS(temp1_double-temp2_double) > options->delta ) + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(F_FORMAT_P,temp1_double,temp2_double, + ABS(temp1_double-temp2_double), + ABS(1-temp2_double/temp1_double)); + } + nfound++; + } + + } /* NaN */ + mem1+=sizeof(double); + mem2+=sizeof(double); + if (options->n && nfound>=options->count) + return nfound; + } /* i */ } + + /*------------------------------------------------------------------------- + * no -d and -p + *------------------------------------------------------------------------- + */ else { @@ -3044,6 +3085,9 @@ hsize_t diff_double(unsigned char *mem1, return nfound; } + + + /*------------------------------------------------------------------------- * Function: diff_schar * diff --git a/tools/testfiles/h5diff_58.txt b/tools/testfiles/h5diff_58.txt index 38d3177..b582c88 100644 --- a/tools/testfiles/h5diff_58.txt +++ b/tools/testfiles/h5diff_58.txt @@ -2,7 +2,7 @@ Expected output for 'h5diff -v h5diff_dset1.h5 h5diff_dset2.h5 refreg' ############################# dataset: </refreg> and </refreg> -Referenced dataset 5904 5904 +Referenced dataset 10272 10272 ------------------------------------------------------------ Region blocks block #0 (2,2)-(7,7) (0,0)-(2,2) diff --git a/tools/testfiles/h5diff_70.txt b/tools/testfiles/h5diff_70.txt index fe3e03f..bc9efbe 100644 --- a/tools/testfiles/h5diff_70.txt +++ b/tools/testfiles/h5diff_70.txt @@ -19,6 +19,15 @@ position string of </> string of </> difference [ 1 ] d z [ 1 ] e z 4 differences found +attribute: <VLstring of </>> and <VLstring of </>> +size: [2] [2] +position VLstring of </> VLstring of </> difference +------------------------------------------------------------ +[ 0 ] a z +[ 0 ] b z +[ 1 ] d z +[ 1 ] e z +4 differences found attribute: <bitfield of </>> and <bitfield of </>> size: [2] [2] position bitfield of </> bitfield of </> difference @@ -99,6 +108,23 @@ position string2D of </> string2D of </> difference [ 2 1 ] k z [ 2 1 ] l z 12 differences found +attribute: <VLstring2D of </>> and <VLstring2D of </>> +size: [3x2] [3x2] +position VLstring2D of </> VLstring2D of </> difference +------------------------------------------------------------ +[ 0 0 ] a z +[ 0 0 ] b z +[ 0 1 ] c z +[ 0 1 ] d z +[ 1 0 ] e z +[ 1 0 ] f z +[ 1 1 ] g z +[ 1 1 ] h z +[ 2 0 ] i z +[ 2 0 ] j z +[ 2 1 ] k z +[ 2 1 ] l z +12 differences found attribute: <bitfield2D of </>> and <bitfield2D of </>> size: [3x2] [3x2] position bitfield2D of </> bitfield2D of </> difference @@ -262,6 +288,58 @@ position string3D of </> string3D of </> difference [ 3 2 1 ] X z [ 3 2 1 ] Z z 47 differences found +attribute: <VLstring3D of </>> and <VLstring3D of </>> +size: [4x3x2] [4x3x2] +position VLstring3D of </> VLstring3D of </> difference +------------------------------------------------------------ +[ 0 0 0 ] a z +[ 0 0 0 ] b z +[ 0 0 1 ] c z +[ 0 0 1 ] d z +[ 0 1 0 ] e z +[ 0 1 0 ] f z +[ 0 1 1 ] g z +[ 0 1 1 ] h z +[ 0 2 0 ] i z +[ 0 2 0 ] j z +[ 0 2 1 ] k z +[ 0 2 1 ] l z +[ 1 0 0 ] m z +[ 1 0 0 ] n z +[ 1 0 1 ] p z +[ 1 0 1 ] q z +[ 1 1 0 ] r z +[ 1 1 0 ] s z +[ 1 1 1 ] t z +[ 1 1 1 ] u z +[ 1 2 0 ] v z +[ 1 2 0 ] w z +[ 1 2 1 ] x z +[ 2 0 0 ] A z +[ 2 0 0 ] B z +[ 2 0 1 ] C z +[ 2 0 1 ] D z +[ 2 1 0 ] E z +[ 2 1 0 ] F z +[ 2 1 1 ] G z +[ 2 1 1 ] H z +[ 2 2 0 ] I z +[ 2 2 0 ] J z +[ 2 2 1 ] K z +[ 2 2 1 ] L z +[ 3 0 0 ] M z +[ 3 0 0 ] N z +[ 3 0 1 ] P z +[ 3 0 1 ] Q z +[ 3 1 0 ] R z +[ 3 1 0 ] S z +[ 3 1 1 ] T z +[ 3 1 1 ] U z +[ 3 2 0 ] V z +[ 3 2 0 ] W z +[ 3 2 1 ] X z +[ 3 2 1 ] Z z +47 differences found attribute: <bitfield3D of </>> and <bitfield3D of </>> size: [4x3x2] [4x3x2] position bitfield3D of </> bitfield3D of </> difference @@ -612,6 +690,15 @@ position string of </dset> string of </dset> difference [ 1 ] d z [ 1 ] e z 4 differences found +attribute: <VLstring of </dset>> and <VLstring of </dset>> +size: [2] [2] +position VLstring of </dset> VLstring of </dset> difference +------------------------------------------------------------ +[ 0 ] a z +[ 0 ] b z +[ 1 ] d z +[ 1 ] e z +4 differences found attribute: <bitfield of </dset>> and <bitfield of </dset>> size: [2] [2] position bitfield of </dset> bitfield of </dset> difference @@ -694,6 +781,23 @@ position string2D of </dset> string2D of </dset> difference [ 2 1 ] k z [ 2 1 ] l z 12 differences found +attribute: <VLstring2D of </dset>> and <VLstring2D of </dset>> +size: [3x2] [3x2] +position VLstring2D of </dset> VLstring2D of </dset> difference +------------------------------------------------------------ +[ 0 0 ] a z +[ 0 0 ] b z +[ 0 1 ] c z +[ 0 1 ] d z +[ 1 0 ] e z +[ 1 0 ] f z +[ 1 1 ] g z +[ 1 1 ] h z +[ 2 0 ] i z +[ 2 0 ] j z +[ 2 1 ] k z +[ 2 1 ] l z +12 differences found attribute: <bitfield2D of </dset>> and <bitfield2D of </dset>> size: [3x2] [3x2] position bitfield2D of </dset> bitfield2D of </dset> difference @@ -859,6 +963,58 @@ position string3D of </dset> string3D of </dset> difference [ 3 2 1 ] X z [ 3 2 1 ] Z z 47 differences found +attribute: <VLstring3D of </dset>> and <VLstring3D of </dset>> +size: [4x3x2] [4x3x2] +position VLstring3D of </dset> VLstring3D of </dset> difference +------------------------------------------------------------ +[ 0 0 0 ] a z +[ 0 0 0 ] b z +[ 0 0 1 ] c z +[ 0 0 1 ] d z +[ 0 1 0 ] e z +[ 0 1 0 ] f z +[ 0 1 1 ] g z +[ 0 1 1 ] h z +[ 0 2 0 ] i z +[ 0 2 0 ] j z +[ 0 2 1 ] k z +[ 0 2 1 ] l z +[ 1 0 0 ] m z +[ 1 0 0 ] n z +[ 1 0 1 ] p z +[ 1 0 1 ] q z +[ 1 1 0 ] r z +[ 1 1 0 ] s z +[ 1 1 1 ] t z +[ 1 1 1 ] u z +[ 1 2 0 ] v z +[ 1 2 0 ] w z +[ 1 2 1 ] x z +[ 2 0 0 ] A z +[ 2 0 0 ] B z +[ 2 0 1 ] C z +[ 2 0 1 ] D z +[ 2 1 0 ] E z +[ 2 1 0 ] F z +[ 2 1 1 ] G z +[ 2 1 1 ] H z +[ 2 2 0 ] I z +[ 2 2 0 ] J z +[ 2 2 1 ] K z +[ 2 2 1 ] L z +[ 3 0 0 ] M z +[ 3 0 0 ] N z +[ 3 0 1 ] P z +[ 3 0 1 ] Q z +[ 3 1 0 ] R z +[ 3 1 0 ] S z +[ 3 1 1 ] T z +[ 3 1 1 ] U z +[ 3 2 0 ] V z +[ 3 2 0 ] W z +[ 3 2 1 ] X z +[ 3 2 1 ] Z z +47 differences found attribute: <bitfield3D of </dset>> and <bitfield3D of </dset>> size: [4x3x2] [4x3x2] position bitfield3D of </dset> bitfield3D of </dset> difference @@ -1200,7 +1356,7 @@ position float3D of </dset> float3D of </dset> difference [ 3 2 0 ] 23 0 23 [ 3 2 1 ] 24 0 24 24 differences found -456 differences found +519 differences found group : </g1> and </g1> 0 differences found attribute: <string of </g1>> and <string of </g1>> @@ -1212,6 +1368,15 @@ position string of </g1> string of </g1> difference [ 1 ] d z [ 1 ] e z 4 differences found +attribute: <VLstring of </g1>> and <VLstring of </g1>> +size: [2] [2] +position VLstring of </g1> VLstring of </g1> difference +------------------------------------------------------------ +[ 0 ] a z +[ 0 ] b z +[ 1 ] d z +[ 1 ] e z +4 differences found attribute: <bitfield of </g1>> and <bitfield of </g1>> size: [2] [2] position bitfield of </g1> bitfield of </g1> difference @@ -1292,6 +1457,23 @@ position string2D of </g1> string2D of </g1> difference [ 2 1 ] k z [ 2 1 ] l z 12 differences found +attribute: <VLstring2D of </g1>> and <VLstring2D of </g1>> +size: [3x2] [3x2] +position VLstring2D of </g1> VLstring2D of </g1> difference +------------------------------------------------------------ +[ 0 0 ] a z +[ 0 0 ] b z +[ 0 1 ] c z +[ 0 1 ] d z +[ 1 0 ] e z +[ 1 0 ] f z +[ 1 1 ] g z +[ 1 1 ] h z +[ 2 0 ] i z +[ 2 0 ] j z +[ 2 1 ] k z +[ 2 1 ] l z +12 differences found attribute: <bitfield2D of </g1>> and <bitfield2D of </g1>> size: [3x2] [3x2] position bitfield2D of </g1> bitfield2D of </g1> difference @@ -1455,6 +1637,58 @@ position string3D of </g1> string3D of </g1> difference [ 3 2 1 ] X z [ 3 2 1 ] Z z 47 differences found +attribute: <VLstring3D of </g1>> and <VLstring3D of </g1>> +size: [4x3x2] [4x3x2] +position VLstring3D of </g1> VLstring3D of </g1> difference +------------------------------------------------------------ +[ 0 0 0 ] a z +[ 0 0 0 ] b z +[ 0 0 1 ] c z +[ 0 0 1 ] d z +[ 0 1 0 ] e z +[ 0 1 0 ] f z +[ 0 1 1 ] g z +[ 0 1 1 ] h z +[ 0 2 0 ] i z +[ 0 2 0 ] j z +[ 0 2 1 ] k z +[ 0 2 1 ] l z +[ 1 0 0 ] m z +[ 1 0 0 ] n z +[ 1 0 1 ] p z +[ 1 0 1 ] q z +[ 1 1 0 ] r z +[ 1 1 0 ] s z +[ 1 1 1 ] t z +[ 1 1 1 ] u z +[ 1 2 0 ] v z +[ 1 2 0 ] w z +[ 1 2 1 ] x z +[ 2 0 0 ] A z +[ 2 0 0 ] B z +[ 2 0 1 ] C z +[ 2 0 1 ] D z +[ 2 1 0 ] E z +[ 2 1 0 ] F z +[ 2 1 1 ] G z +[ 2 1 1 ] H z +[ 2 2 0 ] I z +[ 2 2 0 ] J z +[ 2 2 1 ] K z +[ 2 2 1 ] L z +[ 3 0 0 ] M z +[ 3 0 0 ] N z +[ 3 0 1 ] P z +[ 3 0 1 ] Q z +[ 3 1 0 ] R z +[ 3 1 0 ] S z +[ 3 1 1 ] T z +[ 3 1 1 ] U z +[ 3 2 0 ] V z +[ 3 2 0 ] W z +[ 3 2 1 ] X z +[ 3 2 1 ] Z z +47 differences found attribute: <bitfield3D of </g1>> and <bitfield3D of </g1>> size: [4x3x2] [4x3x2] position bitfield3D of </g1> bitfield3D of </g1> difference diff --git a/tools/testfiles/h5diff_80.txt b/tools/testfiles/h5diff_80.txt index 90ee5c0..9c0bd33 100644 --- a/tools/testfiles/h5diff_80.txt +++ b/tools/testfiles/h5diff_80.txt @@ -8,6 +8,9 @@ file1 file2 x x /dset x x /dsetref x x /g1 + x x /g1/VLstring + x x /g1/VLstring2D + x x /g1/VLstring3D x x /g1/array x x /g1/array2D x x /g1/array3D @@ -53,6 +56,84 @@ dataset: </dsetref> and </dsetref> 0 differences found group : </g1> and </g1> 0 differences found +dataset: </g1/VLstring> and </g1/VLstring> +size: [2] [2] +position VLstring VLstring difference +------------------------------------------------------------ +[ 0 ] a z +[ 0 ] b z +[ 1 ] d z +[ 1 ] e z +4 differences found +dataset: </g1/VLstring2D> and </g1/VLstring2D> +size: [3x2] [3x2] +position VLstring2D VLstring2D difference +------------------------------------------------------------ +[ 0 0 ] a z +[ 0 0 ] b z +[ 0 1 ] c z +[ 0 1 ] d z +[ 1 0 ] e z +[ 1 0 ] f z +[ 1 1 ] g z +[ 1 1 ] h z +[ 2 0 ] i z +[ 2 0 ] j z +[ 2 1 ] k z +[ 2 1 ] l z +12 differences found +dataset: </g1/VLstring3D> and </g1/VLstring3D> +size: [4x3x2] [4x3x2] +position VLstring3D VLstring3D difference +------------------------------------------------------------ +[ 0 0 0 ] a z +[ 0 0 0 ] b z +[ 0 0 1 ] c z +[ 0 0 1 ] d z +[ 0 1 0 ] e z +[ 0 1 0 ] f z +[ 0 1 1 ] g z +[ 0 1 1 ] h z +[ 0 2 0 ] i z +[ 0 2 0 ] j z +[ 0 2 1 ] k z +[ 0 2 1 ] l z +[ 1 0 0 ] m z +[ 1 0 0 ] n z +[ 1 0 1 ] p z +[ 1 0 1 ] q z +[ 1 1 0 ] r z +[ 1 1 0 ] s z +[ 1 1 1 ] t z +[ 1 1 1 ] u z +[ 1 2 0 ] v z +[ 1 2 0 ] w z +[ 1 2 1 ] x z +[ 2 0 0 ] A z +[ 2 0 0 ] B z +[ 2 0 1 ] C z +[ 2 0 1 ] D z +[ 2 1 0 ] E z +[ 2 1 0 ] F z +[ 2 1 1 ] G z +[ 2 1 1 ] H z +[ 2 2 0 ] I z +[ 2 2 0 ] J z +[ 2 2 1 ] K z +[ 2 2 1 ] L z +[ 3 0 0 ] M z +[ 3 0 0 ] N z +[ 3 0 1 ] P z +[ 3 0 1 ] Q z +[ 3 1 0 ] R z +[ 3 1 0 ] S z +[ 3 1 1 ] T z +[ 3 1 1 ] U z +[ 3 2 0 ] V z +[ 3 2 0 ] W z +[ 3 2 1 ] X z +[ 3 2 1 ] Z z +47 differences found dataset: </g1/array> and </g1/array> size: [2] [2] position array array difference @@ -776,7 +857,7 @@ position vlen3D vlen3D difference [ 3 2 1 ] 59 0 59 59 differences found dataset: </refreg> and </refreg> -Referenced dataset 5904 5904 +Referenced dataset 10272 10272 ------------------------------------------------------------ Region blocks block #0 (2,2)-(7,7) (0,0)-(2,2) diff --git a/tools/testfiles/h5diff_attr1.h5 b/tools/testfiles/h5diff_attr1.h5 Binary files differindex e261486..c44066b 100644 --- a/tools/testfiles/h5diff_attr1.h5 +++ b/tools/testfiles/h5diff_attr1.h5 diff --git a/tools/testfiles/h5diff_attr2.h5 b/tools/testfiles/h5diff_attr2.h5 Binary files differindex 0a59fc5..5de3303 100644 --- a/tools/testfiles/h5diff_attr2.h5 +++ b/tools/testfiles/h5diff_attr2.h5 diff --git a/tools/testfiles/h5diff_basic2.h5 b/tools/testfiles/h5diff_basic2.h5 Binary files differindex 209485f..ad45cc0 100644 --- a/tools/testfiles/h5diff_basic2.h5 +++ b/tools/testfiles/h5diff_basic2.h5 diff --git a/tools/testfiles/h5diff_dset1.h5 b/tools/testfiles/h5diff_dset1.h5 Binary files differindex 3f853be..ab6b96f 100644 --- a/tools/testfiles/h5diff_dset1.h5 +++ b/tools/testfiles/h5diff_dset1.h5 diff --git a/tools/testfiles/h5diff_dset2.h5 b/tools/testfiles/h5diff_dset2.h5 Binary files differindex 1f14d29..3db0c8e 100644 --- a/tools/testfiles/h5diff_dset2.h5 +++ b/tools/testfiles/h5diff_dset2.h5 |