summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2010-03-25 03:51:41 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2010-03-25 03:51:41 (GMT)
commit42efc1c2b591e4cd45ec6cb3bdf32044343118d2 (patch)
tree0ab542871c32246199479e8933ff26286aaf629a /tools
parent3360c3af0c100ac4d3a2fe2865f34661da862ec5 (diff)
downloadhdf5-42efc1c2b591e4cd45ec6cb3bdf32044343118d2.zip
hdf5-42efc1c2b591e4cd45ec6cb3bdf32044343118d2.tar.gz
hdf5-42efc1c2b591e4cd45ec6cb3bdf32044343118d2.tar.bz2
[svn-r18451] Description:
Bring r18172:18446 from trunk to revise_chunks branch. Tested on: FreeBSD/32 6.3 (duty) in debug mode FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (amani) w/Intel compilers, w/default API=1.6.x, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in debug mode Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
Diffstat (limited to 'tools')
-rw-r--r--tools/h5copy/h5copygentest.c537
-rw-r--r--tools/h5copy/testfiles/h5copy_extlinks_src.h5bin0 -> 2184 bytes
-rw-r--r--tools/h5copy/testfiles/h5copy_extlinks_src.out.ls42
-rw-r--r--tools/h5copy/testfiles/h5copy_extlinks_trg.h5bin0 -> 2168 bytes
-rw-r--r--tools/h5copy/testfiles/h5copy_ref.h5bin0 -> 9104 bytes
-rw-r--r--tools/h5copy/testfiles/h5copy_ref.out.ls34
-rw-r--r--tools/h5copy/testfiles/h5copytst.out.ls4
-rw-r--r--tools/h5copy/testh5copy.sh109
-rw-r--r--tools/h5diff/h5diff_common.c124
-rw-r--r--tools/h5diff/h5diff_main.c1
-rw-r--r--tools/h5diff/h5diffgentest.c968
-rw-r--r--tools/h5diff/testfiles/h5diff_10.txt99
-rw-r--r--tools/h5diff/testfiles/h5diff_100.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_101.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_102.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_11.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_12.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_13.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_14.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_15.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_16_1.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_16_2.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_16_3.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_17.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_171.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_172.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_18.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_18_1.txt2
-rw-r--r--tools/h5diff/testfiles/h5diff_19.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_20.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_200.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_201.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_202.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_203.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_204.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_205.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_206.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_207.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_21.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_22.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_23.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_24.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_25.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_26.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_27.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_28.txt1
-rwxr-xr-xtools/h5diff/testfiles/h5diff_300.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_400.txt20
-rw-r--r--tools/h5diff/testfiles/h5diff_401.txt5
-rw-r--r--tools/h5diff/testfiles/h5diff_402.txt5
-rw-r--r--tools/h5diff/testfiles/h5diff_403.txt5
-rw-r--r--tools/h5diff/testfiles/h5diff_404.txt16
-rw-r--r--tools/h5diff/testfiles/h5diff_405.txt5
-rw-r--r--tools/h5diff/testfiles/h5diff_406.txt5
-rw-r--r--tools/h5diff/testfiles/h5diff_407.txt5
-rw-r--r--tools/h5diff/testfiles/h5diff_408.txt5
-rw-r--r--tools/h5diff/testfiles/h5diff_409.txt5
-rw-r--r--tools/h5diff/testfiles/h5diff_410.txt25
-rw-r--r--tools/h5diff/testfiles/h5diff_411.txt5
-rw-r--r--tools/h5diff/testfiles/h5diff_412.txt5
-rw-r--r--tools/h5diff/testfiles/h5diff_413.txt5
-rw-r--r--tools/h5diff/testfiles/h5diff_414.txt3
-rw-r--r--tools/h5diff/testfiles/h5diff_415.txt3
-rw-r--r--tools/h5diff/testfiles/h5diff_416.txt3
-rw-r--r--tools/h5diff/testfiles/h5diff_417.txt9
-rw-r--r--tools/h5diff/testfiles/h5diff_418.txt9
-rw-r--r--tools/h5diff/testfiles/h5diff_419.txt5
-rw-r--r--tools/h5diff/testfiles/h5diff_420.txt5
-rw-r--r--tools/h5diff/testfiles/h5diff_421.txt5
-rw-r--r--tools/h5diff/testfiles/h5diff_422.txt5
-rw-r--r--tools/h5diff/testfiles/h5diff_423.txt5
-rw-r--r--tools/h5diff/testfiles/h5diff_424.txt5
-rw-r--r--tools/h5diff/testfiles/h5diff_425.txt5
-rw-r--r--tools/h5diff/testfiles/h5diff_450.txt35
-rw-r--r--tools/h5diff/testfiles/h5diff_451.txt28
-rw-r--r--tools/h5diff/testfiles/h5diff_452.txt2
-rw-r--r--tools/h5diff/testfiles/h5diff_453.txt47
-rw-r--r--tools/h5diff/testfiles/h5diff_454.txt2
-rw-r--r--tools/h5diff/testfiles/h5diff_455.txt2
-rw-r--r--tools/h5diff/testfiles/h5diff_456.txt32
-rw-r--r--tools/h5diff/testfiles/h5diff_457.txt2
-rw-r--r--tools/h5diff/testfiles/h5diff_458.txt2
-rw-r--r--tools/h5diff/testfiles/h5diff_459.txt2
-rw-r--r--tools/h5diff/testfiles/h5diff_50.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_51.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_52.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_53.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_54.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_55.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_56.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_57.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_58.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_600.txt99
-rw-r--r--tools/h5diff/testfiles/h5diff_603.txt99
-rw-r--r--tools/h5diff/testfiles/h5diff_604.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_605.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_606.txt99
-rw-r--r--tools/h5diff/testfiles/h5diff_607.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_608.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_609.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_610.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_612.txt99
-rw-r--r--tools/h5diff/testfiles/h5diff_613.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_614.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_615.txt99
-rw-r--r--tools/h5diff/testfiles/h5diff_616.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_617.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_618.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_619.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_621.txt99
-rw-r--r--tools/h5diff/testfiles/h5diff_622.txt99
-rw-r--r--tools/h5diff/testfiles/h5diff_623.txt99
-rw-r--r--tools/h5diff/testfiles/h5diff_624.txt99
-rw-r--r--tools/h5diff/testfiles/h5diff_625.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_626.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_627.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_628.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_629.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_70.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_80.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_90.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_danglelinks1.h5bin0 -> 5012 bytes
-rw-r--r--tools/h5diff/testfiles/h5diff_danglelinks2.h5bin0 -> 5012 bytes
-rw-r--r--tools/h5diff/testfiles/h5diff_idx.txt1
-rwxr-xr-xtools/h5diff/testh5diff.sh189
-rw-r--r--tools/h5dump/h5dump.c132
-rw-r--r--tools/h5dump/h5dumpgentest.c2
-rwxr-xr-xtools/h5import/h5import.c20
-rwxr-xr-xtools/h5import/h5import.h2
-rw-r--r--tools/h5jam/h5jamgentest.c2
-rw-r--r--tools/h5jam/h5unjam.c59
-rw-r--r--tools/h5ls/h5ls.c18
-rw-r--r--tools/h5repack/h5repack.c22
-rw-r--r--tools/h5repack/h5repack.h8
-rwxr-xr-xtools/h5repack/h5repack.sh.in6
-rw-r--r--tools/h5repack/h5repack_copy.c234
-rw-r--r--tools/h5repack/h5repack_filters.c25
-rw-r--r--tools/h5repack/h5repack_main.c36
-rw-r--r--tools/h5repack/h5repack_parse.c2
-rw-r--r--tools/h5repack/h5repack_refs.c60
-rw-r--r--tools/h5repack/h5repack_verify.c28
-rw-r--r--tools/h5repack/h5repacktst.c472
-rw-r--r--tools/h5repack/testfiles/h5repack_refs.h5bin0 -> 9280 bytes
-rw-r--r--tools/h5repack/testh5repack_detect_szip.c2
-rw-r--r--tools/h5stat/h5stat.c160
-rw-r--r--tools/h5stat/testfiles/h5stat_filters-UD.ddl8
-rw-r--r--tools/h5stat/testfiles/h5stat_filters-UT.ddl13
-rw-r--r--tools/h5stat/testfiles/h5stat_help1.ddl12
-rw-r--r--tools/h5stat/testfiles/h5stat_help2.ddl12
-rw-r--r--tools/h5stat/testfiles/h5stat_newgrat-UA.ddl10
-rw-r--r--tools/h5stat/testfiles/h5stat_newgrat-UG.ddl8
-rw-r--r--tools/h5stat/testh5stat.sh.in6
-rw-r--r--tools/lib/h5diff.c1005
-rw-r--r--tools/lib/h5diff.h3
-rw-r--r--tools/lib/h5diff_array.c81
-rw-r--r--tools/lib/h5diff_dset.c250
-rw-r--r--tools/lib/h5diff_util.c4
-rw-r--r--tools/lib/h5tools.c314
-rw-r--r--tools/lib/h5tools.h18
-rw-r--r--tools/lib/h5tools_error.h6
-rw-r--r--tools/lib/h5tools_str.c36
-rw-r--r--tools/lib/h5tools_str.h2
-rw-r--r--tools/lib/h5tools_utils.c12
-rw-r--r--tools/lib/h5trav.c2
-rw-r--r--tools/misc/h5debug.c4
165 files changed, 4602 insertions, 1890 deletions
diff --git a/tools/h5copy/h5copygentest.c b/tools/h5copy/h5copygentest.c
index cd4c234..e52b700 100644
--- a/tools/h5copy/h5copygentest.c
+++ b/tools/h5copy/h5copygentest.c
@@ -18,9 +18,17 @@
*/
#include <stdlib.h>
#include "hdf5.h"
+#include "H5private.h"
+#include "h5tools.h"
-#define FILENAME "h5copytst.h5"
-#define FILENAME_NEW "h5copytst_new.h5"
+/* HDF file names */
+#define HDF_FILE1 "h5copytst.h5"
+#define HDF_FILE1_NEW "h5copytst_new.h5"
+#define HDF_FILE2 "h5copy_ref.h5"
+#define HDF_EXT_SRC_FILE "h5copy_extlinks_src.h5"
+#define HDF_EXT_TRG_FILE "h5copy_extlinks_trg.h5"
+
+/* objects in HDF_FILE1 */
#define DATASET_SIMPLE "simple"
#define DATASET_CHUNK "chunk"
#define DATASET_COMPACT "compact"
@@ -34,6 +42,13 @@
#define TRUE 1
#define FALSE 0
+/* Obj reference */
+#define OBJ_REF_DS "Dset1"
+#define OBJ_REF_GRP "Group"
+/* Region reference */
+#define REG_REF_DS1 "Dset_REGREF"
+#define REG_REF_DS2 "Dset2"
+
/*-------------------------------------------------------------------------
* Function: gent_simple
@@ -213,7 +228,8 @@ static void gent_compressed(hid_t loc_id)
/*-------------------------------------------------------------------------
* Function: gent_named_vl
*
- * Purpose: Generate a variable lenght named datatype for a dataset in LOC_ID
+ * Purpose: Generate a variable lenght named datatype for a dataset in
+ LOC_ID
*
*-------------------------------------------------------------------------
*/
@@ -389,37 +405,518 @@ static void gent_nested_group(hid_t loc_id)
H5Gclose(gid);
}
+
/*-------------------------------------------------------------------------
- * Function: main
+ * Function: gen_obj_ref
*
- *-------------------------------------------------------------------------
- */
+ * Purpose: Generate object references to dataset and group
+ *
+ * Programmer: Jonathan Kim (Feb 23, 2010)
+ *------------------------------------------------------------------------*/
+static herr_t gen_obj_ref(hid_t loc_id)
+{
+ hid_t sid=0, oid=0;
+ hsize_t dims1[1]={3};
+ hsize_t dims2[1]={2};
+ int data[3] = {10,20,30};
+ int status;
+ herr_t ret = SUCCEED;
+
+ /*--------------
+ * add dataset */
+ sid = H5Screate_simple(1, dims1, NULL);
+ if (sid < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", __FUNCTION__, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
-int main(void)
+ oid = H5Dcreate2 (loc_id, OBJ_REF_DS, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (oid < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", __FUNCTION__, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ status = H5Dwrite(oid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", __FUNCTION__, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ H5Dclose(oid);
+ H5Sclose(sid);
+
+ /*--------------
+ * add group */
+ oid = H5Gcreate2 (loc_id, OBJ_REF_GRP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (oid < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Gcreate2 failed.\n", __FUNCTION__, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+ H5Gclose(oid);
+
+ /*---------------------
+ * create obj references to the previously created objects.
+ * Passing -1 as reference is an object.*/
+ hobj_ref_t or_data[2]; /* write buffer */
+
+ status = H5Rcreate (&or_data[0], loc_id, OBJ_REF_DS, H5R_OBJECT, -1);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", __FUNCTION__, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+ status = H5Rcreate (&or_data[1], loc_id, OBJ_REF_GRP, H5R_OBJECT, -1);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", __FUNCTION__, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ sid = H5Screate_simple (1, dims2, NULL);
+ if (sid < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", __FUNCTION__, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ oid = H5Dcreate2 (loc_id, "Dset_OBJREF", H5T_STD_REF_OBJ, sid, H5P_DEFAULT,H5P_DEFAULT,H5P_DEFAULT);
+ if (oid < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", __FUNCTION__, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ status = H5Dwrite(oid, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, or_data);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", __FUNCTION__, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+out:
+ if(oid > 0)
+ H5Dclose(oid);
+ if(sid > 0)
+ H5Sclose(sid);
+
+ return ret;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: gen_region_ref
+ *
+ * Purpose: Generate dataset region references
+ *
+ * Programmer: Jonathan Kim (Feb 23, 2010)
+ *------------------------------------------------------------------------*/
+static herr_t gen_region_ref(hid_t loc_id)
+{
+ hid_t sid=0, oid1=0, oid2=0;
+ int status;
+ herr_t ret = SUCCEED;
+ char data[3][16] = {"The quick brown", "fox jumps over ", "the 5 lazy dogs"};
+ hsize_t dims2[2] = {3,16};
+ hsize_t coords[4][2] = { {0,1}, {2,11}, {1,0}, {2,4} };
+ hdset_reg_ref_t rr_data[2];
+ hsize_t start[2] = {0,0};
+ hsize_t stride[2] = {2,11};
+ hsize_t count[2] = {2,2};
+ hsize_t block[2] = {1,3};
+ hsize_t dims1[1] = {2};
+
+ sid = H5Screate_simple (2, dims2, NULL);
+ if (sid < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", __FUNCTION__, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* create normal dataset which is refered */
+ oid2 = H5Dcreate2 (loc_id, REG_REF_DS2, H5T_STD_I8LE, sid, H5P_DEFAULT,H5P_DEFAULT,H5P_DEFAULT);
+ if (oid2 < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", __FUNCTION__, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* write values to dataset */
+ status = H5Dwrite (oid2, H5T_NATIVE_CHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, data);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", __FUNCTION__, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* select elements space for reference */
+ status = H5Sselect_elements (sid, H5S_SELECT_SET, 4, coords[0]);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Sselect_elements failed.\n", __FUNCTION__, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* create region reference from elements space */
+ status = H5Rcreate (&rr_data[0], loc_id, REG_REF_DS2, H5R_DATASET_REGION, sid);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", __FUNCTION__, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* select hyperslab space for reference */
+ status = H5Sselect_hyperslab (sid, H5S_SELECT_SET, start, stride, count, block);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Sselect_hyperslab failed.\n", __FUNCTION__, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* create region reference from hyperslab space */
+ status = H5Rcreate (&rr_data[1], loc_id, REG_REF_DS2, H5R_DATASET_REGION, sid);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", __FUNCTION__, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ H5Sclose (sid);
+
+ /* Create dataspace. */
+ sid = H5Screate_simple (1, dims1, NULL);
+ if (sid < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", __FUNCTION__, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* create region reference dataset */
+ oid1 = H5Dcreate2 (loc_id, REG_REF_DS1, H5T_STD_REF_DSETREG, sid, H5P_DEFAULT,H5P_DEFAULT,H5P_DEFAULT);
+ if (oid1 < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", __FUNCTION__, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* write data as region references */
+ status = H5Dwrite (oid1, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, rr_data);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", __FUNCTION__, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+out:
+ if (oid1 > 0)
+ H5Dclose (oid1);
+ if (oid2 > 0)
+ H5Dclose (oid2);
+ if (sid > 0)
+ H5Sclose (sid);
+
+ return ret;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: Test_Obj_Copy
+ *
+ * Purpose: Testing with various objects
+ *
+ *------------------------------------------------------------------------*/
+static void Test_Obj_Copy()
{
- hid_t fid; /* File id */
- hid_t fapl_new; /* File access property id */
- hbool_t new_format; /* New format or old format */
+ hid_t fid = (-1); /* File id */
+ hid_t fapl_new = (-1); /* File access property id */
+ hbool_t new_format; /* New format or old format */
- fapl_new = H5Pcreate(H5P_FILE_ACCESS);
- H5Pset_libver_bounds(fapl_new, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST);
+ if((fapl_new = H5Pcreate(H5P_FILE_ACCESS)) < 0) {
+ fprintf(stderr, "Error: H5Pcreate failed.\n");
+ goto out;
+ }
+ if(H5Pset_libver_bounds(fapl_new, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) {
+ fprintf(stderr, "Error: H5Pset_libver_bounds failed.\n");
+ goto out;
+ }
/* Test with old & new format groups */
for(new_format = FALSE; new_format <= TRUE; new_format++) {
/* Set the FAPL for the type of format */
+ /* Create source file */
if(new_format)
- fid = H5Fcreate(FILENAME_NEW, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_new);
+ fid = H5Fcreate(HDF_FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_new);
else
- fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ fid = H5Fcreate(HDF_FILE1_NEW, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ if(fid < 0) {
+ fprintf(stderr, "Error: H5Fcreate failed.\n");
+ goto out;
+ }
+
+ gent_datasets(fid);
+ gent_empty_group(fid);
+ gent_nested_datasets(fid);
+ gent_nested_group(fid);
+
+ H5Fclose(fid);
+ fid = (-1);
+ } /* end for */
+
+out:
+ /*-----------------------------------------------------------------------
+ * Close
+ *------------------------------------------------------------------------*/
+ if(fid > 0)
+ H5Fclose(fid);
+ if(fapl_new > 0)
+ H5Pclose(fapl_new);
+}
- gent_datasets(fid);
- gent_empty_group(fid);
- gent_nested_datasets(fid);
- gent_nested_group(fid);
- H5Fclose(fid);
+/*-------------------------------------------------------------------------
+ * Function: Test_Ref_Copy
+ *
+ * Purpose: Testing with various references
+ *
+ *------------------------------------------------------------------------*/
+static void Test_Ref_Copy()
+{
+ hid_t fid=0;
+ herr_t status;
+
+ fid = H5Fcreate (HDF_FILE2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ if (fid < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Fcreate failed.\n", HDF_FILE2);
+ goto out;
}
- H5Pclose(fapl_new);
+
+ /* add object reference */
+ status = gen_obj_ref(fid);
+ if (status < 0)
+ fprintf(stderr, "Failed to generate object reference.\n");
+
+ /* add region reference */
+ status = gen_region_ref(fid);
+ if (status < 0)
+ fprintf(stderr, "Failed to generate region reference.\n");
+
+out:
+ /*-----------------------------------------------------------------------
+ * Close
+ *------------------------------------------------------------------------*/
+ if(fid > 0)
+ H5Fclose(fid);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: gen_extlink_trg
+ *
+ * Purpose: generate target external link objs
+ *
+ * Programmer: Jonathan Kim (March 03, 2010)
+ *------------------------------------------------------------------------*/
+static herr_t gen_extlink_trg(hid_t loc_id)
+{
+ hid_t gid=0, tid=0;
+ int status;
+ herr_t ret = SUCCEED;
+
+ /*-----------------------------------------------------------------------
+ * Groups
+ *------------------------------------------------------------------------*/
+ /*--------------
+ * target file */
+ gid = H5Gcreate2(loc_id, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (gid < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Gcreate2 failed.\n", __FUNCTION__, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /*--------------
+ * add dataset */
+ gent_simple(loc_id);
+
+ /*--------------------
+ * add named datatype
+ */
+ tid = H5Tcopy(H5T_NATIVE_INT);
+ status = H5Tcommit2(loc_id, "datatype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Tcommit2 failed.\n", __FUNCTION__, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+out:
+ if(gid > 0)
+ H5Gclose(gid);
+ if(tid > 0)
+ H5Tclose(tid);
+
+ return ret;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: gen_extlink_src
+ *
+ * Purpose: generate source external link objs
+ *
+ * Programmer: Jonathan Kim (March 03, 2010)
+ *------------------------------------------------------------------------*/
+static herr_t gen_extlink_src(hid_t loc_id)
+{
+ hid_t gid=0;
+ int status;
+ herr_t ret = SUCCEED;
+
+ /*-----------------------------------------------------------------------
+ * Groups
+ *------------------------------------------------------------------------*/
+ gid = H5Gcreate2(loc_id, "/group_ext", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (gid < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Gcreate2 failed.\n", __FUNCTION__, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /*-----------------------------------------------------------------------
+ * External links
+ *------------------------------------------------------------------------*/
+ /* link to dataset */
+ status = H5Lcreate_external(HDF_EXT_TRG_FILE, "/simple", gid, "extlink_dset", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Lcreate_external failed.\n", __FUNCTION__, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* link to group */
+ status = H5Lcreate_external(HDF_EXT_TRG_FILE, "/group", gid, "extlink_grp", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Lcreate_external failed.\n", __FUNCTION__, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* link to datatype */
+ status = H5Lcreate_external(HDF_EXT_TRG_FILE, "/datatype", gid, "extlink_datatype", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Lcreate_external failed.\n", __FUNCTION__, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* dangling link - no obj*/
+ status = H5Lcreate_external(HDF_EXT_TRG_FILE, "notyet", gid, "extlink_notyet1", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Lcreate_external failed.\n", __FUNCTION__, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* dangling link - no file */
+ status = H5Lcreate_external("notyet_file.h5", "notyet", gid, "extlink_notyet2", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Lcreate_external failed.\n", __FUNCTION__, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+out:
+ if(gid > 0)
+ H5Gclose(gid);
+
+ return ret;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: Test_Extlink_Copy
+ *
+ * Purpose: gerenate external link files
+ *
+ *------------------------------------------------------------------------*/
+static void Test_Extlink_Copy()
+{
+ hid_t fid1=0;
+ hid_t fid2=0;
+ herr_t status;
+
+ fid1 = H5Fcreate (HDF_EXT_SRC_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ if (fid1 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Fcreate failed.\n", HDF_EXT_SRC_FILE);
+ goto out;
+ }
+
+ fid2 = H5Fcreate (HDF_EXT_TRG_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ if (fid2 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Fcreate failed.\n", HDF_EXT_TRG_FILE);
+ goto out;
+ }
+
+ /* add links to source external link file */
+ status = gen_extlink_src(fid1);
+ if (status < 0)
+ fprintf(stderr, "Error: %s> gen_extlink_src failed.\n", HDF_EXT_SRC_FILE);
+
+ /* add objs to target external link file */
+ status = gen_extlink_trg(fid2);
+ if (status < 0)
+ fprintf(stderr, "Error: %s> gen_extlink_trg failed.\n", HDF_EXT_TRG_FILE);
+
+out:
+ /*-----------------------------------------------------------------------
+ * Close
+ *------------------------------------------------------------------------*/
+ if(fid1 > 0)
+ H5Fclose(fid1);
+ if(fid2 > 0)
+ H5Fclose(fid2);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: main
+ *
+ *-------------------------------------------------------------------------
+ */
+
+int main(void)
+{
+ Test_Obj_Copy();
+ Test_Ref_Copy();
+ Test_Extlink_Copy();
return 0;
}
diff --git a/tools/h5copy/testfiles/h5copy_extlinks_src.h5 b/tools/h5copy/testfiles/h5copy_extlinks_src.h5
new file mode 100644
index 0000000..7b8621e
--- /dev/null
+++ b/tools/h5copy/testfiles/h5copy_extlinks_src.h5
Binary files differ
diff --git a/tools/h5copy/testfiles/h5copy_extlinks_src.out.ls b/tools/h5copy/testfiles/h5copy_extlinks_src.out.ls
new file mode 100644
index 0000000..a9927f8
--- /dev/null
+++ b/tools/h5copy/testfiles/h5copy_extlinks_src.out.ls
@@ -0,0 +1,42 @@
+#############################
+Expected output for 'h5ls ./testfiles/h5copy_extlinks_src.out.h5'
+#############################
+Opened "./testfiles/h5copy_extlinks_src.out.h5" with sec2 driver.
+/ Group
+ Location: 1:96
+ Links: 1
+/copy1_dset Dataset {6/6}
+ Location: 1:800
+ Links: 1
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/copy1_group Group
+ Location: 1:4344
+ Links: 1
+/copy1_group/extlink_datatype External Link {h5copy_extlinks_trg.h5//datatype}
+/copy1_group/extlink_dset External Link {h5copy_extlinks_trg.h5//simple}
+/copy1_group/extlink_grp External Link {h5copy_extlinks_trg.h5//group}
+/copy1_group/extlink_notyet1 External Link {h5copy_extlinks_trg.h5//notyet}
+/copy1_group/extlink_notyet2 External Link {notyet_file.h5//notyet}
+/copy2_dset Dataset {6/6}
+ Location: 1:4216
+ Links: 1
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/copy2_group Group
+ Location: 1:4712
+ Links: 1
+/copy2_group/extlink_datatype Type
+ Location: 1:5912
+ Links: 1
+ Type: shared-1:5912 32-bit little-endian integer
+/copy2_group/extlink_dset Dataset {6/6}
+ Location: 1:5080
+ Links: 1
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/copy2_group/extlink_grp Group
+ Location: 1:5872
+ Links: 1
+/copy2_group/extlink_notyet1 External Link {h5copy_extlinks_trg.h5//notyet}
+/copy2_group/extlink_notyet2 External Link {notyet_file.h5//notyet}
diff --git a/tools/h5copy/testfiles/h5copy_extlinks_trg.h5 b/tools/h5copy/testfiles/h5copy_extlinks_trg.h5
new file mode 100644
index 0000000..3a0242d
--- /dev/null
+++ b/tools/h5copy/testfiles/h5copy_extlinks_trg.h5
Binary files differ
diff --git a/tools/h5copy/testfiles/h5copy_ref.h5 b/tools/h5copy/testfiles/h5copy_ref.h5
new file mode 100644
index 0000000..bd727e6
--- /dev/null
+++ b/tools/h5copy/testfiles/h5copy_ref.h5
Binary files differ
diff --git a/tools/h5copy/testfiles/h5copy_ref.out.ls b/tools/h5copy/testfiles/h5copy_ref.out.ls
new file mode 100644
index 0000000..8549842
--- /dev/null
+++ b/tools/h5copy/testfiles/h5copy_ref.out.ls
@@ -0,0 +1,34 @@
+#############################
+Expected output for 'h5ls ./testfiles/h5copy_ref.out.h5'
+#############################
+Opened "./testfiles/h5copy_ref.out.h5" with sec2 driver.
+/ Group
+ Location: 1:96
+ Links: 1
+/COPY Group
+ Location: 1:1464
+ Links: 1
+/COPY/Dset1 Dataset {3/3}
+ Location: 1:1504
+ Links: 2
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/COPY/Dset2 Dataset {3/3, 16/16}
+ Location: 1:1960
+ Links: 3
+ Storage: <details removed for portability>
+ Type: 8-bit integer
+/COPY/Dset_OBJREF Dataset {2/2}
+ Location: 1:5184
+ Links: 1
+ Storage: <details removed for portability>
+ Type: object reference
+/COPY/Dset_REGREF Dataset {2/2}
+ Location: 1:9400
+ Links: 1
+ Storage: <details removed for portability>
+ Type: dataset region reference
+/COPY/Group Group
+ Location: 1:2096
+ Links: 3
+/~obj_pointed_by_2096 Group, same as /COPY/Group
diff --git a/tools/h5copy/testfiles/h5copytst.out.ls b/tools/h5copy/testfiles/h5copytst.out.ls
index 5ff1e90..af6cd8f 100644
--- a/tools/h5copy/testfiles/h5copytst.out.ls
+++ b/tools/h5copy/testfiles/h5copytst.out.ls
@@ -1,7 +1,7 @@
#############################
-Expected output for 'h5ls ../testfiles/h5copytst.out.h5'
+Expected output for 'h5ls ./testfiles/h5copytst.out.h5'
#############################
-Opened "../testfiles/h5copytst.out.h5" with sec2 driver.
+Opened "./testfiles/h5copytst.out.h5" with sec2 driver.
/ Group
Location: 1:96
Links: 1
diff --git a/tools/h5copy/testh5copy.sh b/tools/h5copy/testh5copy.sh
index c330602..4292757 100644
--- a/tools/h5copy/testh5copy.sh
+++ b/tools/h5copy/testh5copy.sh
@@ -23,6 +23,12 @@ TESTNAME=h5copy
EXIT_SUCCESS=0
EXIT_FAILURE=1
+# Test files
+HDF_FILE1=h5copytst.h5
+HDF_FILE2=h5copy_ref.h5
+HDF_EXT_SRC_FILE=h5copy_extlinks_src.h5
+HDF_EXT_TRG_FILE=h5copy_extlinks_trg.h5
+
H5COPY=h5copy # The tool name
H5COPY_BIN=`pwd`/$H5COPY # The path of the tool binary
H5DIFF=h5diff # The h5diff tool name
@@ -30,21 +36,27 @@ H5DIFF_BIN=`pwd`/../h5diff/$H5DIFF # The path of the h5diff tool binary
H5LS=h5ls # The h5ls tool name
H5LS_ARGS=-Svr # Arguments to the h5ls tool
H5LS_BIN=`pwd`/../h5ls/$H5LS # The path of the h5ls tool binary
+CMP='cmp -s'
+DIFF='diff -c'
nerrors=0
verbose=yes
-INDIR=$srcdir/testfiles
-OUTDIR=../testfiles
-CMP='cmp -s'
-DIFF='diff -c'
-
# The build (current) directory might be different than the source directory.
if test -z "$srcdir"; then
srcdir=.
fi
+INDIR=$srcdir/testfiles
+OUTDIR=./testfiles
+
test -d $OUTDIR || mkdir $OUTDIR
+# Print a "SKIP" message
+SKIP() {
+ TESTING $H5COPY $@
+ echo " -SKIP-"
+}
+
# Print a line-line message left justified in a field of 70 characters
# beginning with the word "Testing".
TESTING()
@@ -241,10 +253,10 @@ H5LSTEST()
#
# Assumed arguments:
# <none>
-COPYOBJECTS()
+COPY_OBJECTS()
{
- TESTFILE="$INDIR/$1"
- FILEOUT="$OUTDIR/`basename $1 .h5`.out.h5"
+ TESTFILE="$INDIR/$HDF_FILE1"
+ FILEOUT="$OUTDIR/`basename $HDF_FILE1 .h5`.out.h5"
# Remove any output file left over from previous test run
rm -f $FILEOUT
@@ -296,11 +308,90 @@ COPYOBJECTS()
fi
}
+# Copy references in various way.
+# adding to the destination file each time compare the result
+#
+# Assumed arguments:
+# <none>
+COPY_REFERENCES()
+{
+ TESTFILE="$INDIR/$HDF_FILE2"
+ FILEOUT="$OUTDIR/`basename $HDF_FILE2 .h5`.out.h5"
+
+ # Remove any output file left over from previous test run
+ rm -f $FILEOUT
+
+ echo "Test copying object and region references"
+ TOOLTEST -f ref -i $TESTFILE -o $FILEOUT -v -s / -d /COPY
+
+ # Verify that the file created above is correct
+ H5LSTEST $FILEOUT
+
+ # Remove output file created, if the "no cleanup" environment variable is
+ # not defined
+ if test -z "$HDF5_NOCLEANUP"; then
+ rm -f $FILEOUT
+ fi
+}
+
+# Copy external links.
+# adding to the destination file each time compare the result
+#
+# Assumed arguments:
+# <none>
+COPY_EXT_LINKS()
+{
+ TESTFILE="$INDIR/$HDF_EXT_SRC_FILE"
+ FILEOUT="$OUTDIR/`basename $HDF_EXT_SRC_FILE .h5`.out.h5"
+
+ # Remove any output file left over from previous test run
+ rm -f $FILEOUT
+
+ echo "Test copying external link directly without -f ext"
+ TOOLTEST -v -i $TESTFILE -o $FILEOUT -s /group_ext/extlink_dset -d /copy1_dset
+
+ echo "Test copying external link directly with -f ext"
+ TOOLTEST -f ext -i $TESTFILE -o $FILEOUT -v -s /group_ext/extlink_dset -d /copy2_dset
+
+ echo "Test copying dangling external link (no obj) directly without -f ext"
+ #TOOLTEST -i $TESTFILE -o $FILEOUT -v -s /copy2_group/extlink_notyet1 -d /copy2_dangle1
+ SKIP -s /copy2_group/extlink_notyet1 -d /copy2_dangle1
+
+ echo "Test copying dangling external link (no obj) directly with -f ext"
+ #TOOLTEST -f ext -i $TESTFILE -o $FILEOUT -v -s /copy2_group/extlink_notyet1 -d /copy2_dangle1
+ SKIP -f ext -s /copy2_group/extlink_notyet1 -d /copy2_dangle1
+
+ echo "Test copying dangling external link (no file) directly without -f ext"
+ #TOOLTEST -i $TESTFILE -o $FILEOUT -v -s /copy2_group/extlink_notyet2 -d /copy2_dangle2
+ SKIP -s /copy2_group/extlink_notyet2 -d /copy2_dangle2
+
+ echo "Test copying dangling external link (no file) directly with -f ext"
+ #TOOLTEST -f ext -i $TESTFILE -o $FILEOUT -v -s /copy2_group/extlink_notyet2 -d /copy2_dangle2
+ SKIP -f ext -s /copy2_group/extlink_notyet2 -d /copy2_dangle2
+
+ echo "Test copying a group contains external links without -f ext"
+ TOOLTEST -v -i $TESTFILE -o $FILEOUT -s /group_ext -d /copy1_group
+
+ echo "Test copying a group contains external links with -f ext"
+ TOOLTEST -f ext -i $TESTFILE -o $FILEOUT -v -f ext -s /group_ext -d /copy2_group
+
+ # Verify that the file created above is correct
+ H5LSTEST $FILEOUT
+
+ # Remove output file created, if the "no cleanup" environment variable is
+ # not defined
+ if test -z "$HDF5_NOCLEANUP"; then
+ rm -f $FILEOUT
+ fi
+}
+
##############################################################################
### T H E T E S T S ###
##############################################################################
-COPYOBJECTS h5copytst.h5
+COPY_OBJECTS
+COPY_REFERENCES
+COPY_EXT_LINKS
# Add newline for nicer formatting
echo " "
diff --git a/tools/h5diff/h5diff_common.c b/tools/h5diff/h5diff_common.c
index 64b0097..75e1774 100644
--- a/tools/h5diff/h5diff_common.c
+++ b/tools/h5diff/h5diff_common.c
@@ -31,7 +31,7 @@ const char *progname = "h5diff";
* Command-line options: The user can specify short or long-named
* parameters.
*/
-static const char *s_opts = "hVrvqn:d:p:Ncl";
+static const char *s_opts = "hVrvqn:d:p:Nc";
static struct long_options l_opts[] = {
{ "help", no_arg, 'h' },
{ "version", no_arg, 'V' },
@@ -44,7 +44,8 @@ static struct long_options l_opts[] = {
{ "nan", no_arg, 'N' },
{ "compare", no_arg, 'c' },
{ "use-system-epsilon", no_arg, 'e' },
- { "link-follow", no_arg, 'l' },
+ { "follow-links", no_arg, 'l' },
+ { "no-dangling-links", no_arg, 'x' },
{ NULL, 0, '\0' }
};
@@ -102,7 +103,10 @@ void parse_command_line(int argc,
options->m_report = 1;
break;
case 'l':
- options->linkfollow = 1;
+ options->follow_links = 1;
+ break;
+ case 'x':
+ options->no_dangle_links = 1;
break;
case 'd':
options->d=1;
@@ -114,7 +118,7 @@ void parse_command_line(int argc,
h5diff_exit(EXIT_FAILURE);
}
options->delta = atof( opt_arg );
-
+
/* -d 0 is the same as default */
if (options->delta == 0)
options->d=0;
@@ -227,8 +231,8 @@ void parse_command_line(int argc,
printf("--------------------------------\n");
printf("Use -c for a list of objects.\n");
}
-
-
+
+
}
}
@@ -356,33 +360,68 @@ void usage(void)
printf(" file2 File name of the second HDF5 file\n");
printf(" [obj1] Name of an HDF5 object, in absolute path\n");
printf(" [obj2] Name of an HDF5 object, in absolute path\n");
-
+ printf("\n");
printf(" OPTIONS\n");
-
- printf(" -h, --help Print a usage message and exit\n");
- printf(" -V, --version Print version number and exit\n");
- printf(" -r, --report Report mode. Print differences\n");
- printf(" -v, --verbose Verbose mode. Print differences, list of objects\n");
- printf(" -q, --quiet Quiet mode. Do not do output\n");
- printf(" -l, --link-follow Follow link(s)\n");
+ printf(" -h, --help Print a usage message and exit.\n");
+ printf(" -V, --version Print version number and exit.\n");
+ printf(" -r, --report Report mode. Print differences.\n");
+ printf(" -v, --verbose Verbose mode. Print differences, list of objects.\n");
+ printf(" -q, --quiet Quiet mode. Do not produce output.\n");
+ printf(" --follow-links Follow symbolic links (soft links and external links)\n");
+ printf(" and compare the links' target objects.\n");
+ printf(" If symbolic link(s) with the same name exist in the\n");
+ printf(" files being compared, then determine whether the \n");
+ printf(" target of each link is an existing object (dataset,\n");
+ printf(" group, or named datatype) or the link is a dangling\n");
+ printf(" link (a soft or external link pointing to a target\n");
+ printf(" object that does not yet exist).\n");
+ printf(" - If both symbolic links are dangling links, they\n");
+ printf(" are treated as being the same; by default, h5diff\n");
+ printf(" returns an exit code of 0. If, however, \n");
+ printf(" --no-dangling-links is used with --follow-links, \n");
+ printf(" this situation is treated as an error and h5diff \n");
+ printf(" returns an exit code of 2.\n");
+ printf(" - If only one of the two links is a dangling link,\n");
+ printf(" they are treated as being different and h5diff \n");
+ printf(" returns an exit code of 1. If, however, \n");
+ printf(" --no-dangling-links is used with --follow-links, \n");
+ printf(" this situation is treated as an error and h5diff \n");
+ printf(" returns an exit code of 2.\n");
+ printf(" - If both symbolic links point to existing objects,\n");
+ printf(" h5diff compares the two objects.\n");
+ printf(" If any symbolic link specified in the call to h5diff\n");
+ printf(" does not exist, h5diff treats it as an error and\n");
+ printf(" returns an exit code of 2.\n");
+ printf(" --no-dangling-links Must be used with --follow-links option;\n");
+ printf(" otherwise, h5diff shows error message and returns\n");
+ printf(" an exit code of 2.\n");
+ printf(" Check for any symbolic links (soft links or external\n");
+ printf(" links) that do not resolve to an existing object\n");
+ printf(" (dataset, group, or named datatype). If any\n");
+ printf(" dangling link is found, this situation is treated as\n");
+ printf(" an error and h5diff returns an exit code of 2.\n");
printf(" -c, --compare List objects that are not comparable\n");
printf(" -N, --nan Avoid NaNs detection\n");
- printf(" -n C, --count=C Print differences up to C number, C is a positive integer.\n");
-
- printf(" -d D, --delta=D Print difference if (|a-b| > D), D is a positive number.\n");
- printf(" -p R, --relative=R Print difference if (|(a-b)/b| > R), R is a positive number.\n");
+ printf(" -n C, --count=C Print differences up to C number, C is a positive\n");
+ printf(" integer.\n");
+ printf(" -d D, --delta=D Print difference if (|a-b| > D), D is a positive\n");
+ printf(" number.\n");
+ printf(" -p R, --relative=R Print difference if (|(a-b)/b| > R), R is a positive\n");
+ printf(" number.\n");
printf(" --use-system-epsilon Print difference if (|a-b| > EPSILON),\n");
- printf(" where EPSILON (FLT_EPSILON or FLT_EPSILON) is the system epsilon value. \n");
- printf(" If the system epsilon is not defined, use the value below:\n");
+ printf(" where EPSILON (FLT_EPSILON or FLT_EPSILON) is the\n");
+ printf(" system epsilon value. \n");
+ printf(" If the system epsilon is not defined, use the value\n");
+ printf(" below:\n");
printf(" FLT_EPSILON = 1.19209E-07 for float\n");
printf(" DBL_EPSILON = 2.22045E-16 for double\n");
-
- printf(" -d, -p, and --use-system-epsilon options are used for comparing floating point values.\n");
- printf(" By default, strict equality is used. Use -p or -d to set specific tolerance.\n");
+ printf(" -d, -p, and --use-system-epsilon options are used for\n");
+ printf(" comparing floating point values.\n");
+ printf(" By default, strict equality is used. Use -p or -d to\n");
+ printf(" set specific tolerance.\n");
printf("\n");
printf(" Modes of output:\n");
- printf("\n");
printf(" Default mode: print the number of differences found and where they occured\n");
printf(" -r Report mode: print the above plus the differences\n");
printf(" -v Verbose mode: print the above plus a list of objects and warnings\n");
@@ -391,46 +430,35 @@ void usage(void)
printf("\n");
printf(" Compare criteria\n");
- printf("\n");
- printf(" If no objects [obj1[obj2]] are specified, h5diff only compares objects\n");
- printf(" with the same absolute path in both files\n");
+ printf(" If no objects [obj1[obj2]] are specified, h5diff only compares objects\n");
+ printf(" with the same absolute path in both files\n");
printf("\n");
printf(" The compare criteria is:\n");
- printf(" 1) datasets: numerical array differences 2) groups: name string difference\n");
- printf(" 3) datatypes: the return value of H5Tequal 4) links: name string difference\n");
- printf(" of the linked value\n");
-
+ printf(" 1) datasets: numerical array differences\n");
+ printf(" 2) groups: name string difference\n");
+ printf(" 3) datatypes: the return value of H5Tequal\n");
+ printf(" 4) links: name string difference of the linked value as default\n");
+ printf(" (refer to --follow-links option).\n");
printf("\n");
-
- printf(" Return exit code:\n");
- printf("\n");
- printf(" 1 if differences found, 0 if no differences, 2 if error\n");
-
+ printf(" Exit code:\n");
+ printf(" 0 if no differences, 1 if differences found, 2 if error\n");
printf("\n");
-
printf(" Examples of use:\n");
- printf("\n");
printf(" 1) h5diff file1 file2 /g1/dset1 /g1/dset2\n");
- printf("\n");
printf(" Compares object '/g1/dset1' in file1 with '/g1/dset2' in file2\n");
printf("\n");
printf(" 2) h5diff file1 file2 /g1/dset1\n");
- printf("\n");
printf(" Compares object '/g1/dset1' in both files\n");
printf("\n");
printf(" 3) h5diff file1 file2\n");
- printf("\n");
printf(" Compares all objects in both files\n");
printf("\n");
- printf(" Note) file1 and file2 can be the same file. Use\n");
- printf("\n");
- printf(" h5diff file1 file1 /g1/dset1 /g1/dset2\n");
+ printf(" Notes:\n");
+ printf(" file1 and file2 can be the same file.\n");
+ printf(" Use h5diff file1 file1 /g1/dset1 /g1/dset2 to compare\n");
+ printf(" '/g1/dset1' and '/g1/dset2' in the same file\n");
printf("\n");
- printf(" to compare '/g1/dset1' and '/g1/dset2' in the same file\n");
- printf("\n");
-
-
}
diff --git a/tools/h5diff/h5diff_main.c b/tools/h5diff/h5diff_main.c
index 1cb8f2f..8089161 100644
--- a/tools/h5diff/h5diff_main.c
+++ b/tools/h5diff/h5diff_main.c
@@ -97,6 +97,7 @@ int main(int argc, const char *argv[])
print_info(&options);
+out:
/*-------------------------------------------------------------------------
* exit code
* 1 if differences, 0 if no differences, 2 if error
diff --git a/tools/h5diff/h5diffgentest.c b/tools/h5diff/h5diffgentest.c
index 1bfea17..60d7f94 100644
--- a/tools/h5diff/h5diffgentest.c
+++ b/tools/h5diff/h5diffgentest.c
@@ -43,8 +43,18 @@
#define FILE9 "h5diff_hyper1.h5"
#define FILE10 "h5diff_hyper2.h5"
#define FILE11 "h5diff_empty.h5"
-#define FILE12 "h5diff_dset_idx1.h5"
-#define FILE13 "h5diff_dset_idx2.h5"
+#define FILE12 "h5diff_links.h5"
+#define FILE13 "h5diff_softlinks.h5"
+#define FILE14 "h5diff_linked_softlink.h5"
+#define FILE15 "h5diff_extlink_src.h5"
+#define FILE16 "h5diff_extlink_trg.h5"
+#define FILE17 "h5diff_ext2softlink_src.h5"
+#define FILE18 "h5diff_ext2softlink_trg.h5"
+#define FILE19 "h5diff_dset_idx1.h5"
+#define FILE20 "h5diff_dset_idx2.h5"
+#define DANGLE_LINK_FILE1 "h5diff_danglelinks1.h5"
+#define DANGLE_LINK_FILE2 "h5diff_danglelinks2.h5"
+
#define UIMAX 4294967295u /*Maximum value for a variable of type unsigned int */
#define STR_SIZE 3
#define GBLL ((unsigned long long) 1024 * 1024 *1024 )
@@ -82,6 +92,13 @@ static int test_datatypes(const char *fname);
static int test_attributes(const char *fname,int make_diffs);
static int test_datasets(const char *fname,int make_diffs);
static int test_hyperslab(const char *fname,int make_diffs);
+static int test_link_name(const char *fname1);
+static int test_soft_links(const char *fname1);
+static int test_linked_softlinks(const char *fname1);
+static int test_external_links(const char *fname1, const char *fname2);
+static int test_ext2soft_links(const char *fname1, const char *fname2);
+static int test_dangle_links(const char *fname1, const char *fname2);
+
/* called by test_attributes() and test_datasets() */
static void write_attr_in(hid_t loc_id,const char* dset_name,hid_t fid,int make_diffs);
static void write_dset_in(hid_t loc_id,const char* dset_name,hid_t fid,int make_diffs);
@@ -122,14 +139,26 @@ int main(void)
test_hyperslab(FILE9,0);
test_hyperslab(FILE10,1);
+ test_link_name(FILE12);
+
+ test_soft_links(FILE13);
+
+ test_linked_softlinks(FILE14);
+
+ test_external_links(FILE15, FILE16);
+
+ test_ext2soft_links(FILE17, FILE18);
+
/*
* Generate 2 files: FILE12 with old format; FILE13 with new format
* Create 2 datasets in each file:
* One dataset: chunked layout, w/o filters, fixed dimension
* One dataset: chunked layout, w/ filters, fixed dimension
*/
- gen_dataset_idx(FILE12, 0);
- gen_dataset_idx(FILE13, 1);
+ gen_dataset_idx(FILE19, 0);
+ gen_dataset_idx(FILE20, 1);
+
+ test_dangle_links(DANGLE_LINK_FILE1, DANGLE_LINK_FILE2);
return 0;
}
@@ -346,7 +375,7 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3)
}
/*------------------------------------------------------------------------
- * INFINITY values
+ * INFINITY values
*------------------------------------------------------------------------
*/
{
@@ -905,6 +934,707 @@ int test_datasets(const char *file,
}
/*-------------------------------------------------------------------------
+*
+* Purpose: Create test files to compare links, one has longer name than
+* the other and short name is subset of long name.
+*
+* Programmer: Jonathan Kim (Feb 17, 2010)
+*
+*-------------------------------------------------------------------------*/
+static int test_link_name(const char *fname1)
+{
+ hid_t fid1=0;
+ hid_t gid1=0;
+ hid_t gid2=0;
+ herr_t status = SUCCEED;
+
+ /*-----------------------------------------------------------------------
+ * Create file(s)
+ *------------------------------------------------------------------------*/
+ fid1 = H5Fcreate (fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ if (fid1 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ /*-----------------------------------------------------------------------
+ * Groups
+ *------------------------------------------------------------------------*/
+ gid1 = H5Gcreate2(fid1, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (gid1 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+ gid2 = H5Gcreate2(fid1, "group_longname", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ if (gid2 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ /*-----------------------------------------------------------------------
+ * Soft Links
+ *------------------------------------------------------------------------*/
+ status = H5Lcreate_soft("group", fid1, "link_g1", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_soft("group_longname", fid1, "link_g2", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+out:
+ /*-----------------------------------------------------------------------
+ * Close
+ *------------------------------------------------------------------------*/
+ if(fid1)
+ H5Fclose(fid1);
+ if(gid1)
+ H5Gclose(gid1);
+ if(gid2)
+ H5Gclose(gid2);
+
+ return status;
+}
+
+/*-------------------------------------------------------------------------
+*
+* Purpose: Create test files to compare soft links in various way
+*
+* Programmer: Jonathan Kim (Feb 17, 2010)
+*
+*-------------------------------------------------------------------------*/
+static int test_soft_links(const char *fname1)
+{
+ hid_t fid1=0;
+ hid_t gid1=0;
+ hsize_t dims2[2] = {2,4};
+ int data1[4][2] = {{0,1},{2,3},{1,2},{3,4}};
+ int data2[4][2] = {{0,0},{0,0},{0,0},{0,0}};
+ herr_t status = SUCCEED;
+
+ /*-----------------------------------------------------------------------
+ * Create file(s)
+ *------------------------------------------------------------------------*/
+ fid1 = H5Fcreate (fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ if (fid1 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ /*-----------------------------------------------------------------------
+ * Groups
+ *------------------------------------------------------------------------*/
+ gid1 = H5Gcreate2(fid1, "target_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (gid1 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ /*-----------------------------------------------------------------------
+ * Datasets
+ *------------------------------------------------------------------------*/
+ /* file1 */
+ status = write_dset(fid1,2,dims2,"target_dset1",H5T_NATIVE_INT,data1);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = write_dset(fid1,2,dims2,"target_dset2",H5T_NATIVE_INT,data2);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = write_dset(gid1,2,dims2,"dset",H5T_NATIVE_INT,data1);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ /*-----------------------------------------------------------------------
+ * Soft Links
+ *------------------------------------------------------------------------*/
+ /* file 1 */
+ status = H5Lcreate_soft("/target_dset1", fid1, "softlink_dset1_1", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_soft("/target_dset1", fid1, "softlink_dset1_2", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_soft("/target_dset2", fid1, "softlink_dset2", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_soft("/target_group", fid1, "softlink_group1", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_soft("/target_group", fid1, "softlink_group2", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_soft("/no_obj", fid1, "softlink_noexist", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+out:
+ /*-----------------------------------------------------------------------
+ * Close
+ *-----------------------------------------------------------------------*/
+ if(fid1)
+ H5Fclose(fid1);
+ if(gid1)
+ H5Gclose(gid1);
+
+ return status;
+}
+
+/*-------------------------------------------------------------------------
+*
+* Purpose: Create test files to compare linked soft links in various way
+*
+* Programmer: Jonathan Kim (Feb 17, 2010)
+*
+*-------------------------------------------------------------------------*/
+static int test_linked_softlinks(const char *fname1)
+{
+ hid_t fid1=0;
+ hid_t gid1=0;
+ hid_t gid2=0;
+ hid_t gid3=0;
+ hsize_t dims2[2] = {2,4};
+ int data1[4][2] = {{0,1},{2,3},{1,2},{3,4}};
+ int data2[4][2] = {{0,0},{0,0},{0,0},{0,0}};
+ herr_t status = SUCCEED;
+
+ /*-----------------------------------------------------------------------
+ * Create file(s)
+ *------------------------------------------------------------------------*/
+ fid1 = H5Fcreate (fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ if (fid1 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ /*-----------------------------------------------------------------------
+ * Groups
+ *------------------------------------------------------------------------*/
+ gid1 = H5Gcreate2(fid1, "target_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (gid1 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ gid2 = H5Gcreate2(fid1, "target_group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (gid2 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ gid3 = H5Gcreate2(fid1, "target_group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (gid3 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ /*-----------------------------------------------------------------------
+ * Datasets
+ *------------------------------------------------------------------------*/
+ /* file1 */
+ status = write_dset(fid1,2,dims2,"target_dset1",H5T_NATIVE_INT,data1);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = write_dset(fid1,2,dims2,"target_dset2",H5T_NATIVE_INT,data2);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+ status = write_dset(gid1,2,dims2,"dset",H5T_NATIVE_INT,data1);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ /*-----------------------------------------------------------------------
+ * Soft Links (Linked)
+ *------------------------------------------------------------------------*/
+ /*---------
+ * file 1 */
+ status = H5Lcreate_soft("/target_dset1", fid1, "softlink1_to_dset1", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_soft("softlink1_to_dset1", fid1, "softlink1_to_slink1", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_soft("softlink1_to_slink1", fid1, "softlink1_to_slink2", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_soft("/target_dset2", fid1, "softlink2_to_dset2", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_soft("softlink2_to_dset2", fid1, "softlink2_to_slink1", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_soft("softlink2_to_slink1", fid1, "softlink2_to_slink2", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_soft("target_group1", fid1, "softlink3_to_group1", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_soft("softlink3_to_group1", fid1, "softlink3_to_slink1", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_soft("softlink3_to_slink1", fid1, "softlink3_to_slink2", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_soft("target_group2", fid1, "softlink4_to_group2", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_soft("softlink4_to_group2", fid1, "softlink4_to_slink1", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_soft("softlink4_to_slink1", fid1, "softlink4_to_slink2", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+out:
+ /*-----------------------------------------------------------------------
+ * Close
+ *-----------------------------------------------------------------------*/
+ if(fid1)
+ H5Fclose(fid1);
+ if(gid1)
+ H5Gclose(gid1);
+ if(gid2)
+ H5Gclose(gid2);
+ if(gid3)
+ H5Gclose(gid3);
+
+ return status;
+}
+
+/*-------------------------------------------------------------------------
+*
+* Purpose: Create test files to compare external links in various way
+*
+* Programmer: Jonathan Kim (Feb 17, 2010)
+*
+*-------------------------------------------------------------------------*/
+static int test_external_links(const char *fname1, const char *fname2)
+{
+ hid_t fid1=0;
+ hid_t fid2=0;
+ hid_t gid1=0;
+ hid_t gid2=0;
+ hsize_t dims2[2] = {2,4};
+ int data1[4][2] = {{0,1},{2,3},{1,2},{3,4}};
+ int data2[4][2] = {{0,0},{0,0},{0,0},{0,0}};
+ herr_t status = SUCCEED;
+
+ /*-----------------------------------------------------------------------
+ * Create file(s)
+ *------------------------------------------------------------------------*/
+ /* source file */
+ fid1 = H5Fcreate (fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ if (fid1 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ /* target file */
+ fid2 = H5Fcreate (fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ if (fid2 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ /*-----------------------------------------------------------------------
+ * Groups
+ *------------------------------------------------------------------------*/
+ /*--------------
+ * target file */
+ gid1 = H5Gcreate2(fid2, "target_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (gid1 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ gid2 = H5Gcreate2(fid2, "target_group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (gid2 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+ /*-----------------------------------------------------------------------
+ * Datasets
+ *------------------------------------------------------------------------*/
+ /*--------------
+ * target file */
+ status = write_dset(fid2,2,dims2,"target_dset1",H5T_NATIVE_INT,data1);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ status = write_dset(gid1,2,dims2,"x_dset",H5T_NATIVE_INT,data1);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ status = write_dset(gid2,2,dims2,"x_dset",H5T_NATIVE_INT,data2);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ /*-----------------------------------------------------------------------
+ * External Links
+ *------------------------------------------------------------------------*/
+ /*--------------
+ /* source file */
+ status = H5Lcreate_external(fname2, "/target_group/x_dset", fid1, "ext_link_dset1", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_external(fname2, "/target_group2/x_dset", fid1, "ext_link_dset2", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_external(fname2, "/target_group", fid1, "/ext_link_grp1", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_external(fname2, "/target_group2", fid1, "/ext_link_grp2", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_external(fname2, "no_obj", fid1, "ext_link_noexist1", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_external("no_file.h5", "no_obj", fid1, "ext_link_noexist2", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+out:
+ /*-----------------------------------------------------------------------
+ * Close
+ *-----------------------------------------------------------------------*/
+ if(fid1)
+ H5Fclose(fid1);
+ if(fid2)
+ H5Fclose(fid2);
+ if(gid1)
+ H5Gclose(gid1);
+ if(gid2)
+ H5Gclose(gid2);
+
+ return status;
+}
+
+/*-------------------------------------------------------------------------
+*
+* Purpose: Create test files to compare external links which point to
+* soft link in various way
+*
+* Programmer: Jonathan Kim (Feb 17, 2010)
+*
+*-------------------------------------------------------------------------*/
+static int test_ext2soft_links(const char *fname1, const char *fname2)
+{
+ hid_t fid1=0;
+ hid_t fid2=0;
+ hid_t gid2=0;
+ hsize_t dims2[2] = {2,4};
+ int data1[4][2] = {{0,1},{2,3},{1,2},{3,4}};
+ int data2[4][2] = {{0,0},{0,0},{0,0},{0,0}};
+ herr_t status = SUCCEED;
+
+ /*-----------------------------------------------------------------------
+ * Create file(s)
+ *------------------------------------------------------------------------*/
+ /* source file */
+ fid1 = H5Fcreate (fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ if (fid1 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ /* target file */
+ fid2 = H5Fcreate (fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ if (fid2 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ /*-----------------------------------------------------------------------
+ * Groups
+ *------------------------------------------------------------------------*/
+ /* target file */
+ gid2 = H5Gcreate2(fid2, "target_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (gid2 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ /*-----------------------------------------------------------------------
+ * Datasets
+ *------------------------------------------------------------------------*/
+ /*--------------
+ * target file */
+ status = write_dset(fid2,2,dims2,"dset1",H5T_NATIVE_INT,data2);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ status = write_dset(fid2,2,dims2,"dset2",H5T_NATIVE_INT,data1);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ /*-----------------------------------------------------------------------
+ * Soft Links (Linked)
+ *------------------------------------------------------------------------*/
+ /*---------------
+ * target file */
+ status = H5Lcreate_soft("/dset1", fid2, "softlink_to_dset1", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_soft("/dset2", fid2, "softlink_to_dset2", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ /*-----------------------------------------------------------------------
+ * External Links
+ *------------------------------------------------------------------------*/
+ /*---------------
+ * source file */
+ status = H5Lcreate_external(fname2, "/target_group", fid1, "ext_link", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_external(fname2, "/softlink_to_dset1", fid1, "ext_link_to_slink1", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_external(fname2, "/softlink_to_dset2", fid1, "ext_link_to_slink2", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+out:
+ /*-----------------------------------------------------------------------
+ * Close
+ *-----------------------------------------------------------------------*/
+ if(fid1)
+ H5Fclose(fid1);
+ if(fid2)
+ H5Fclose(fid2);
+ if(gid2)
+ H5Gclose(gid2);
+
+ return status;
+}
+
+/*-------------------------------------------------------------------------
* Function: gen_dataset_idx
*
* Purpose: Create a file with either the new or old format
@@ -994,6 +1724,212 @@ int gen_dataset_idx(const char *file, int format)
}
/*-------------------------------------------------------------------------
+*
+* Purpose: Create test files to compare dangling links in various way
+*
+* Programmer: Jonathan Kim (Feb 17, 2010)
+*
+*-------------------------------------------------------------------------*/
+static int test_dangle_links(const char *fname1, const char *fname2)
+{
+ hid_t fid1=0;
+ hid_t fid2=0;
+ hsize_t dims2[2] = {2,4};
+ int data1[4][2] = {{0,1},{2,3},{1,2},{3,4}};
+ int data2[4][2] = {{0,0},{0,0},{0,0},{0,0}};
+ herr_t status = SUCCEED;
+
+ /*-----------------------------------------------------------------------
+ * Create file(s)
+ *------------------------------------------------------------------------*/
+ fid1 = H5Fcreate (fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ if (fid1 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ fid2 = H5Fcreate (fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ if (fid2 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ /*-----------------------------------------------------------------------
+ * Datasets
+ *------------------------------------------------------------------------*/
+ /* file1 */
+ status = write_dset(fid1,2,dims2,"dset1",H5T_NATIVE_INT,data1);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = write_dset(fid1,2,dims2,"dset2",H5T_NATIVE_INT,data2);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ /* file2 */
+ status = write_dset(fid2,2,dims2,"dset1",H5T_NATIVE_INT,data1);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ status = write_dset(fid2,2,dims2,"dset2",H5T_NATIVE_INT,data2);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ /*-----------------------------------------------------------------------
+ * Soft Links
+ *------------------------------------------------------------------------*/
+ /* file 1 */
+ status = H5Lcreate_soft("no_obj", fid1, "soft_link1", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_soft("/dset1", fid1, "soft_link2", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_soft("no_obj", fid1, "soft_link3", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ /* file 2 */
+ status = H5Lcreate_soft("no_obj", fid2, "soft_link1", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_soft("no_obj", fid2, "soft_link2", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_soft("/dset2", fid2, "soft_link3", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ /*-----------------------------------------------------------------------
+ * External Links
+ *------------------------------------------------------------------------*/
+ /* file1 */
+ status = H5Lcreate_external(fname2, "no_obj", fid1, "ext_link1", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_external(fname2, "/dset1", fid1, "ext_link2", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_external(fname2, "no_obj", fid1, "ext_link3", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_external("no_file1.h5", "no_obj", fid1, "ext_link4", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ /* file2 */
+ status = H5Lcreate_external(fname1, "no_obj", fid2, "ext_link1", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_external(fname1, "no_obj", fid2, "ext_link2", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_external(fname1, "/dset2", fid2, "ext_link3", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_external("no_file2.h5", "no_obj", fid2, "ext_link4", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+out:
+ /*-----------------------------------------------------------------------
+ * Close
+ *-----------------------------------------------------------------------*/
+ if(fid1)
+ H5Fclose(fid1);
+ if(fid2)
+ H5Fclose(fid2);
+
+ return status;
+}
+
+/*-------------------------------------------------------------------------
* Function: write_attr_in
*
* Purpose: write attributes in LOC_ID (dataset, group, named datatype)
@@ -2486,7 +3422,7 @@ void write_dset_in(hid_t loc_id,
n = 0;
for(i = 0; i < 3; i++)
{
- for(j = 0; j < 2; j++)
+ for(j = 0; j < 2; j++)
{
buf52[i][j].p = malloc((i + 1) * sizeof(int));
buf52[i][j].len = i + 1;
@@ -2532,7 +3468,7 @@ void write_dset_in(hid_t loc_id,
*/
- if (make_diffs)
+ if (make_diffs)
{
memset(buf72, 0, sizeof buf72);
memset(buf82, 0, sizeof buf82);
@@ -2602,13 +3538,13 @@ void write_dset_in(hid_t loc_id,
n=1;
- for (i = 0; i < 4; i++)
+ for (i = 0; i < 4; i++)
{
- for (j = 0; j < 3; j++)
+ for (j = 0; j < 3; j++)
{
- for (k = 0; k < 2; k++)
+ for (k = 0; k < 2; k++)
{
- if (make_diffs)
+ if (make_diffs)
buf23[i][j][k]=0;
else buf23[i][j][k]=n++;
}
@@ -2635,13 +3571,13 @@ void write_dset_in(hid_t loc_id,
*/
n=1;
- for (i = 0; i < 4; i++)
+ for (i = 0; i < 4; i++)
{
- for (j = 0; j < 3; j++)
+ for (j = 0; j < 3; j++)
{
- for (k = 0; k < 2; k++)
+ for (k = 0; k < 2; k++)
{
- if (make_diffs)
+ if (make_diffs)
{
buf33[i][j][k].a=0;
buf33[i][j][k].b=0;
@@ -2699,7 +3635,7 @@ void write_dset_in(hid_t loc_id,
{
for(j = 0; j < 3; j++)
{
- for(k = 0; k < 2; k++)
+ for(k = 0; k < 2; k++)
{
buf53[i][j][k].p = malloc((i + 1) * sizeof(int));
buf53[i][j][k].len = i + 1;
diff --git a/tools/h5diff/testfiles/h5diff_10.txt b/tools/h5diff/testfiles/h5diff_10.txt
index a6b637a..aeba845 100644
--- a/tools/h5diff/testfiles/h5diff_10.txt
+++ b/tools/h5diff/testfiles/h5diff_10.txt
@@ -3,64 +3,99 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
file2 File name of the second HDF5 file
[obj1] Name of an HDF5 object, in absolute path
[obj2] Name of an HDF5 object, in absolute path
+
OPTIONS
- -h, --help Print a usage message and exit
- -V, --version Print version number and exit
- -r, --report Report mode. Print differences
- -v, --verbose Verbose mode. Print differences, list of objects
- -q, --quiet Quiet mode. Do not do output
- -l, --link-follow Follow link(s)
+ -h, --help Print a usage message and exit.
+ -V, --version Print version number and exit.
+ -r, --report Report mode. Print differences.
+ -v, --verbose Verbose mode. Print differences, list of objects.
+ -q, --quiet Quiet mode. Do not produce output.
+ --follow-links Follow symbolic links (soft links and external links)
+ and compare the links' target objects.
+ If symbolic link(s) with the same name exist in the
+ files being compared, then determine whether the
+ target of each link is an existing object (dataset,
+ group, or named datatype) or the link is a dangling
+ link (a soft or external link pointing to a target
+ object that does not yet exist).
+ - If both symbolic links are dangling links, they
+ are treated as being the same; by default, h5diff
+ returns an exit code of 0. If, however,
+ --no-dangling-links is used with --follow-links,
+ this situation is treated as an error and h5diff
+ returns an exit code of 2.
+ - If only one of the two links is a dangling link,
+ they are treated as being different and h5diff
+ returns an exit code of 1. If, however,
+ --no-dangling-links is used with --follow-links,
+ this situation is treated as an error and h5diff
+ returns an exit code of 2.
+ - If both symbolic links point to existing objects,
+ h5diff compares the two objects.
+ If any symbolic link specified in the call to h5diff
+ does not exist, h5diff treats it as an error and
+ returns an exit code of 2.
+ --no-dangling-links Must be used with --follow-links option;
+ otherwise, h5diff shows error message and returns
+ an exit code of 2.
+ Check for any symbolic links (soft links or external
+ links) that do not resolve to an existing object
+ (dataset, group, or named datatype). If any
+ dangling link is found, this situation is treated as
+ an error and h5diff returns an exit code of 2.
-c, --compare List objects that are not comparable
-N, --nan Avoid NaNs detection
- -n C, --count=C Print differences up to C number, C is a positive integer.
- -d D, --delta=D Print difference if (|a-b| > D), D is a positive number.
- -p R, --relative=R Print difference if (|(a-b)/b| > R), R is a positive number.
+ -n C, --count=C Print differences up to C number, C is a positive
+ integer.
+ -d D, --delta=D Print difference if (|a-b| > D), D is a positive
+ number.
+ -p R, --relative=R Print difference if (|(a-b)/b| > R), R is a positive
+ number.
--use-system-epsilon Print difference if (|a-b| > EPSILON),
- where EPSILON (FLT_EPSILON or FLT_EPSILON) is the system epsilon value.
- If the system epsilon is not defined, use the value below:
+ where EPSILON (FLT_EPSILON or FLT_EPSILON) is the
+ system epsilon value.
+ If the system epsilon is not defined, use the value
+ below:
FLT_EPSILON = 1.19209E-07 for float
DBL_EPSILON = 2.22045E-16 for double
- -d, -p, and --use-system-epsilon options are used for comparing floating point values.
- By default, strict equality is used. Use -p or -d to set specific tolerance.
+ -d, -p, and --use-system-epsilon options are used for
+ comparing floating point values.
+ By default, strict equality is used. Use -p or -d to
+ set specific tolerance.
Modes of output:
-
Default mode: print the number of differences found and where they occured
-r Report mode: print the above plus the differences
-v Verbose mode: print the above plus a list of objects and warnings
-q Quiet mode: do not print output
Compare criteria
-
- If no objects [obj1[obj2]] are specified, h5diff only compares objects
- with the same absolute path in both files
+ If no objects [obj1[obj2]] are specified, h5diff only compares objects
+ with the same absolute path in both files
The compare criteria is:
- 1) datasets: numerical array differences 2) groups: name string difference
- 3) datatypes: the return value of H5Tequal 4) links: name string difference
- of the linked value
+ 1) datasets: numerical array differences
+ 2) groups: name string difference
+ 3) datatypes: the return value of H5Tequal
+ 4) links: name string difference of the linked value as default
+ (refer to --follow-links option).
- Return exit code:
-
- 1 if differences found, 0 if no differences, 2 if error
+ Exit code:
+ 0 if no differences, 1 if differences found, 2 if error
Examples of use:
-
1) h5diff file1 file2 /g1/dset1 /g1/dset2
-
Compares object '/g1/dset1' in file1 with '/g1/dset2' in file2
2) h5diff file1 file2 /g1/dset1
-
Compares object '/g1/dset1' in both files
3) h5diff file1 file2
-
Compares all objects in both files
- Note) file1 and file2 can be the same file. Use
-
- h5diff file1 file1 /g1/dset1 /g1/dset2
-
- to compare '/g1/dset1' and '/g1/dset2' in the same file
+ Notes:
+ file1 and file2 can be the same file.
+ Use h5diff file1 file1 /g1/dset1 /g1/dset2 to compare
+ '/g1/dset1' and '/g1/dset2' in the same file
+EXIT CODE: 0
diff --git a/tools/h5diff/testfiles/h5diff_100.txt b/tools/h5diff/testfiles/h5diff_100.txt
index 32ff7ab..363daa3 100644
--- a/tools/h5diff/testfiles/h5diff_100.txt
+++ b/tools/h5diff/testfiles/h5diff_100.txt
@@ -1035,3 +1035,4 @@ position big big difference
[ 268436478 ] 31 0 31
[ 268436479 ] 31 0 31
1024 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_101.txt b/tools/h5diff/testfiles/h5diff_101.txt
index 03875b7..1d0f38d 100644
--- a/tools/h5diff/testfiles/h5diff_101.txt
+++ b/tools/h5diff/testfiles/h5diff_101.txt
@@ -7,3 +7,4 @@ position d1 d2 difference
[ 1 1 ] 0 1e-09 1e-09
[ 2 0 ] 1e-09 0 1e-09
4 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_102.txt b/tools/h5diff/testfiles/h5diff_102.txt
index 3d91a36..30a2491 100644
--- a/tools/h5diff/testfiles/h5diff_102.txt
+++ b/tools/h5diff/testfiles/h5diff_102.txt
@@ -7,3 +7,4 @@ position fp1 fp2 difference
[ 1 1 ] 0 1e-05 1e-05
[ 2 0 ] 1e-05 0 1e-05
4 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_11.txt b/tools/h5diff/testfiles/h5diff_11.txt
index e2e33fb..c06305c 100644
--- a/tools/h5diff/testfiles/h5diff_11.txt
+++ b/tools/h5diff/testfiles/h5diff_11.txt
@@ -1,2 +1,3 @@
dataset: </g1/dset1> and </g1/dset1>
5 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_12.txt b/tools/h5diff/testfiles/h5diff_12.txt
index 6b4c747..371df79 100644
--- a/tools/h5diff/testfiles/h5diff_12.txt
+++ b/tools/h5diff/testfiles/h5diff_12.txt
@@ -1,2 +1,3 @@
dataset: </g1/dset1> and </g1/dset2>
5 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_13.txt b/tools/h5diff/testfiles/h5diff_13.txt
index 36676e9..729859b 100644
--- a/tools/h5diff/testfiles/h5diff_13.txt
+++ b/tools/h5diff/testfiles/h5diff_13.txt
@@ -8,3 +8,4 @@ position dset1 dset1 difference
[ 1 1 ] 1 1.001 0.001
[ 2 1 ] 0 1 1
5 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_14.txt b/tools/h5diff/testfiles/h5diff_14.txt
index 3fac3af..454463a 100644
--- a/tools/h5diff/testfiles/h5diff_14.txt
+++ b/tools/h5diff/testfiles/h5diff_14.txt
@@ -8,3 +8,4 @@ position dset1 dset2 difference
[ 1 1 ] 1 1.001 0.001
[ 2 1 ] 0 1 1
5 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_15.txt b/tools/h5diff/testfiles/h5diff_15.txt
index 386c6e1..7685f75 100644
--- a/tools/h5diff/testfiles/h5diff_15.txt
+++ b/tools/h5diff/testfiles/h5diff_15.txt
@@ -7,3 +7,4 @@ position dset3 dset4 difference
[ 2 0 ] 100 80 20
[ 2 1 ] 100 40 60
4 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_16_1.txt b/tools/h5diff/testfiles/h5diff_16_1.txt
index 519f695..482a42f 100644
--- a/tools/h5diff/testfiles/h5diff_16_1.txt
+++ b/tools/h5diff/testfiles/h5diff_16_1.txt
@@ -8,3 +8,4 @@ position dset5 dset6 difference relative
[ 1 1 ] 0 100 100 not comparable
[ 2 1 ] 100 50 50 0.500000
5 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_16_2.txt b/tools/h5diff/testfiles/h5diff_16_2.txt
index 233b133..34c1afb 100644
--- a/tools/h5diff/testfiles/h5diff_16_2.txt
+++ b/tools/h5diff/testfiles/h5diff_16_2.txt
@@ -8,3 +8,4 @@ position dset7 dset8 difference relative
[ 1 1 ] 0 100 100 not comparable
[ 2 1 ] 100 50 50 0.500000
5 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_16_3.txt b/tools/h5diff/testfiles/h5diff_16_3.txt
index b96c8a4..173a39b 100644
--- a/tools/h5diff/testfiles/h5diff_16_3.txt
+++ b/tools/h5diff/testfiles/h5diff_16_3.txt
@@ -8,3 +8,4 @@ position dset9 dset10 difference relative
[ 1 1 ] 0 100 100 not comparable
[ 2 1 ] 100 50 50 0.5
5 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_17.txt b/tools/h5diff/testfiles/h5diff_17.txt
index dce5ef5..5cb604d 100644
--- a/tools/h5diff/testfiles/h5diff_17.txt
+++ b/tools/h5diff/testfiles/h5diff_17.txt
@@ -51,3 +51,4 @@ position dset1 dset1 difference
[ 1 1 ] 1 1.001 0.001
[ 2 1 ] 0 1 1
5 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_171.txt b/tools/h5diff/testfiles/h5diff_171.txt
index 7ee0711..5314a79 100644
--- a/tools/h5diff/testfiles/h5diff_171.txt
+++ b/tools/h5diff/testfiles/h5diff_171.txt
@@ -1,2 +1,3 @@
dataset: </g1/fp19> and </g1/fp19>
0 differences found
+EXIT CODE: 0
diff --git a/tools/h5diff/testfiles/h5diff_172.txt b/tools/h5diff/testfiles/h5diff_172.txt
index e2d1b7d..0269194 100644
--- a/tools/h5diff/testfiles/h5diff_172.txt
+++ b/tools/h5diff/testfiles/h5diff_172.txt
@@ -1,2 +1,3 @@
dataset: </g1/fp20> and </g1/fp20>
0 differences found
+EXIT CODE: 0
diff --git a/tools/h5diff/testfiles/h5diff_18.txt b/tools/h5diff/testfiles/h5diff_18.txt
index e69de29..1255241 100644
--- a/tools/h5diff/testfiles/h5diff_18.txt
+++ b/tools/h5diff/testfiles/h5diff_18.txt
@@ -0,0 +1 @@
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_18_1.txt b/tools/h5diff/testfiles/h5diff_18_1.txt
new file mode 100644
index 0000000..0067075
--- /dev/null
+++ b/tools/h5diff/testfiles/h5diff_18_1.txt
@@ -0,0 +1,2 @@
+Error: -q (quiet mode) cannot be added to verbose or report modes
+EXIT CODE: 2
diff --git a/tools/h5diff/testfiles/h5diff_19.txt b/tools/h5diff/testfiles/h5diff_19.txt
index 9e84fe8..1155d55 100644
--- a/tools/h5diff/testfiles/h5diff_19.txt
+++ b/tools/h5diff/testfiles/h5diff_19.txt
@@ -23,3 +23,4 @@ file1 file2
group : </> and </>
0 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_20.txt b/tools/h5diff/testfiles/h5diff_20.txt
index b2fda7c..6eba851 100644
--- a/tools/h5diff/testfiles/h5diff_20.txt
+++ b/tools/h5diff/testfiles/h5diff_20.txt
@@ -3,3 +3,4 @@
Some objects are not comparable
--------------------------------
Use -c for a list of objects.
+EXIT CODE: 0
diff --git a/tools/h5diff/testfiles/h5diff_200.txt b/tools/h5diff/testfiles/h5diff_200.txt
index 56d723d..40e3fb6 100644
--- a/tools/h5diff/testfiles/h5diff_200.txt
+++ b/tools/h5diff/testfiles/h5diff_200.txt
@@ -2,3 +2,4 @@
Some objects are not comparable
--------------------------------
Use -c for a list of objects.
+EXIT CODE: 0
diff --git a/tools/h5diff/testfiles/h5diff_201.txt b/tools/h5diff/testfiles/h5diff_201.txt
index 84d6766..ede94e1 100644
--- a/tools/h5diff/testfiles/h5diff_201.txt
+++ b/tools/h5diff/testfiles/h5diff_201.txt
@@ -1 +1,2 @@
Not comparable: </g2/dset1> or </g2/dset2> is an empty dataset
+EXIT CODE: 0
diff --git a/tools/h5diff/testfiles/h5diff_202.txt b/tools/h5diff/testfiles/h5diff_202.txt
index fd4a191..53657d3 100644
--- a/tools/h5diff/testfiles/h5diff_202.txt
+++ b/tools/h5diff/testfiles/h5diff_202.txt
@@ -1,2 +1,3 @@
Not comparable: </g2/dset2> is of class H5T_FLOAT and </g2/dset3> is of class H5T_INTEGER
Not comparable: </g2/dset2> has sign H5T_SGN_ERROR and </g2/dset3> has sign H5T_SGN_2
+EXIT CODE: 0
diff --git a/tools/h5diff/testfiles/h5diff_203.txt b/tools/h5diff/testfiles/h5diff_203.txt
index 496523c..61a773a 100644
--- a/tools/h5diff/testfiles/h5diff_203.txt
+++ b/tools/h5diff/testfiles/h5diff_203.txt
@@ -1,2 +1,3 @@
Not comparable: </g2/dset3> has rank 1, dimensions [6], max dimensions [6]
and </g2/dset4> has rank 2, dimensions [3x2], max dimensions [3x2]
+EXIT CODE: 0
diff --git a/tools/h5diff/testfiles/h5diff_204.txt b/tools/h5diff/testfiles/h5diff_204.txt
index 098a203..e02e831 100644
--- a/tools/h5diff/testfiles/h5diff_204.txt
+++ b/tools/h5diff/testfiles/h5diff_204.txt
@@ -1,2 +1,3 @@
Not comparable: </g2/dset4> has rank 2, dimensions [3x2], max dimensions [3x2]
and </g2/dset5> has rank 2, dimensions [2x2], max dimensions [2x2]
+EXIT CODE: 0
diff --git a/tools/h5diff/testfiles/h5diff_205.txt b/tools/h5diff/testfiles/h5diff_205.txt
index 3e2d1f2..d72797b 100644
--- a/tools/h5diff/testfiles/h5diff_205.txt
+++ b/tools/h5diff/testfiles/h5diff_205.txt
@@ -1,3 +1,4 @@
Not comparable: </g2/dset5> has rank 2, dimensions [2x2], max dimensions [2x2]
and </g2/dset6> has rank 2, dimensions [3x2], max dimensions [3x2]
Not comparable: </g2/dset5> has sign H5T_SGN_2 and </g2/dset6> has sign H5T_SGN_NONE
+EXIT CODE: 0
diff --git a/tools/h5diff/testfiles/h5diff_206.txt b/tools/h5diff/testfiles/h5diff_206.txt
index 164aed9..659321f 100644
--- a/tools/h5diff/testfiles/h5diff_206.txt
+++ b/tools/h5diff/testfiles/h5diff_206.txt
@@ -1 +1,2 @@
Not comparable: </g2/dset7> has a class H5T_FLOAT and </g2/dset8> has a class H5T_INTEGER
+EXIT CODE: 0
diff --git a/tools/h5diff/testfiles/h5diff_207.txt b/tools/h5diff/testfiles/h5diff_207.txt
index bb8e23f..1ef3dbe 100644
--- a/tools/h5diff/testfiles/h5diff_207.txt
+++ b/tools/h5diff/testfiles/h5diff_207.txt
@@ -1,2 +1,3 @@
Not comparable: </g2/dset8> or </g2/dset9> is an empty dataset
Not comparable: </g2/dset8> has 2 members </g2/dset9> has 1 members
+EXIT CODE: 0
diff --git a/tools/h5diff/testfiles/h5diff_21.txt b/tools/h5diff/testfiles/h5diff_21.txt
index 5518e0c..238c8b8 100644
--- a/tools/h5diff/testfiles/h5diff_21.txt
+++ b/tools/h5diff/testfiles/h5diff_21.txt
@@ -3,3 +3,4 @@
Some objects are not comparable
--------------------------------
Use -c for a list of objects.
+EXIT CODE: 0
diff --git a/tools/h5diff/testfiles/h5diff_22.txt b/tools/h5diff/testfiles/h5diff_22.txt
index 0f9493b..33c3a3d 100644
--- a/tools/h5diff/testfiles/h5diff_22.txt
+++ b/tools/h5diff/testfiles/h5diff_22.txt
@@ -3,3 +3,4 @@
Some objects are not comparable
--------------------------------
Use -c for a list of objects.
+EXIT CODE: 0
diff --git a/tools/h5diff/testfiles/h5diff_23.txt b/tools/h5diff/testfiles/h5diff_23.txt
index 1342765..5a46ea2 100644
--- a/tools/h5diff/testfiles/h5diff_23.txt
+++ b/tools/h5diff/testfiles/h5diff_23.txt
@@ -1,2 +1,3 @@
group : </g1> and </g1>
0 differences found
+EXIT CODE: 0
diff --git a/tools/h5diff/testfiles/h5diff_24.txt b/tools/h5diff/testfiles/h5diff_24.txt
index cc4f0d0..fa5723a 100644
--- a/tools/h5diff/testfiles/h5diff_24.txt
+++ b/tools/h5diff/testfiles/h5diff_24.txt
@@ -1,2 +1,3 @@
datatype: </t1> and </t1>
0 differences found
+EXIT CODE: 0
diff --git a/tools/h5diff/testfiles/h5diff_25.txt b/tools/h5diff/testfiles/h5diff_25.txt
index 288c4da..e463ba1 100644
--- a/tools/h5diff/testfiles/h5diff_25.txt
+++ b/tools/h5diff/testfiles/h5diff_25.txt
@@ -1,2 +1,3 @@
link : </l1> and </l1>
0 differences found
+EXIT CODE: 0
diff --git a/tools/h5diff/testfiles/h5diff_26.txt b/tools/h5diff/testfiles/h5diff_26.txt
index 916cf63..8e1fcc3 100644
--- a/tools/h5diff/testfiles/h5diff_26.txt
+++ b/tools/h5diff/testfiles/h5diff_26.txt
@@ -1,2 +1,3 @@
group : </g1> and </g2>
1 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_27.txt b/tools/h5diff/testfiles/h5diff_27.txt
index 335119a..cbc128e 100644
--- a/tools/h5diff/testfiles/h5diff_27.txt
+++ b/tools/h5diff/testfiles/h5diff_27.txt
@@ -1,2 +1,3 @@
datatype: </t1> and </t2>
1 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_28.txt b/tools/h5diff/testfiles/h5diff_28.txt
index 5845fa9..07d01fe 100644
--- a/tools/h5diff/testfiles/h5diff_28.txt
+++ b/tools/h5diff/testfiles/h5diff_28.txt
@@ -1,2 +1,3 @@
link : </l1> and </l2>
1 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_300.txt b/tools/h5diff/testfiles/h5diff_300.txt
index 0cfc01b..e51643f 100755
--- a/tools/h5diff/testfiles/h5diff_300.txt
+++ b/tools/h5diff/testfiles/h5diff_300.txt
@@ -1,2 +1,3 @@
link : </link_g1> and </link_g2>
1 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_400.txt b/tools/h5diff/testfiles/h5diff_400.txt
index 4b910f5..97db70d 100644
--- a/tools/h5diff/testfiles/h5diff_400.txt
+++ b/tools/h5diff/testfiles/h5diff_400.txt
@@ -16,29 +16,26 @@ file1 file2
group : </> and </>
0 differences found
link : </softlink_dset1_1> and </softlink_dset1_1>
-dataset: </target_dset1> and </target_dset1>
+dataset: </softlink_dset1_1> and </softlink_dset1_1>
0 differences found
0 differences found
link : </softlink_dset1_2> and </softlink_dset1_2>
-dataset: </target_dset1> and </target_dset1>
+dataset: </softlink_dset1_2> and </softlink_dset1_2>
0 differences found
0 differences found
link : </softlink_dset2> and </softlink_dset2>
-dataset: </target_dset2> and </target_dset2>
+dataset: </softlink_dset2> and </softlink_dset2>
0 differences found
0 differences found
link : </softlink_group1> and </softlink_group1>
-group : </target_group> and </target_group>
+group : </softlink_group1> and </softlink_group1>
0 differences found
0 differences found
link : </softlink_group2> and </softlink_group2>
-group : </target_group> and </target_group>
+group : </softlink_group2> and </softlink_group2>
0 differences found
0 differences found
-warn: link target "/no_obj" doesn't exist
-warn: link target "/no_obj" doesn't exist
-link : </softlink_noexist> and </softlink_noexist>
-Comparison not supported: </no_obj> and </no_obj> are of type unknown type
+dangling link: </softlink_noexist> and </softlink_noexist>
0 differences found
dataset: </target_dset1> and </target_dset1>
0 differences found
@@ -48,7 +45,4 @@ group : </target_group> and </target_group>
0 differences found
dataset: </target_group/dset> and </target_group/dset>
0 differences found
---------------------------------
-Some objects are not comparable
---------------------------------
-Use -c for a list of objects.
+EXIT CODE: 0
diff --git a/tools/h5diff/testfiles/h5diff_401.txt b/tools/h5diff/testfiles/h5diff_401.txt
index 5c599e3..278729e 100644
--- a/tools/h5diff/testfiles/h5diff_401.txt
+++ b/tools/h5diff/testfiles/h5diff_401.txt
@@ -1,6 +1,6 @@
-dataset: </target_dset1> and </target_dset2>
+dataset: </softlink_dset1_1> and </target_dset2>
size: [2x4] [2x4]
-position target_dset1 target_dset2 difference
+position softlink_dset1_1 target_dset2 difference
------------------------------------------------------------
[ 0 1 ] 1 0 1
[ 0 2 ] 2 0 2
@@ -10,3 +10,4 @@ position target_dset1 target_dset2 difference
[ 1 2 ] 3 0 3
[ 1 3 ] 4 0 4
7 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_402.txt b/tools/h5diff/testfiles/h5diff_402.txt
index 228c8cc..b0f30ca 100644
--- a/tools/h5diff/testfiles/h5diff_402.txt
+++ b/tools/h5diff/testfiles/h5diff_402.txt
@@ -1,6 +1,6 @@
-dataset: </target_dset2> and </target_dset1>
+dataset: </target_dset2> and </softlink_dset1_1>
size: [2x4] [2x4]
-position target_dset2 target_dset1 difference
+position target_dset2 softlink_dset1_1 difference
------------------------------------------------------------
[ 0 1 ] 0 1 1
[ 0 2 ] 0 2 2
@@ -10,3 +10,4 @@ position target_dset2 target_dset1 difference
[ 1 2 ] 0 3 3
[ 1 3 ] 0 4 4
7 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_403.txt b/tools/h5diff/testfiles/h5diff_403.txt
index 5c599e3..068d01d 100644
--- a/tools/h5diff/testfiles/h5diff_403.txt
+++ b/tools/h5diff/testfiles/h5diff_403.txt
@@ -1,6 +1,6 @@
-dataset: </target_dset1> and </target_dset2>
+dataset: </softlink_dset1_1> and </softlink_dset2>
size: [2x4] [2x4]
-position target_dset1 target_dset2 difference
+position softlink_dset1_1 softlink_dset2 difference
------------------------------------------------------------
[ 0 1 ] 1 0 1
[ 0 2 ] 2 0 2
@@ -10,3 +10,4 @@ position target_dset1 target_dset2 difference
[ 1 2 ] 3 0 3
[ 1 3 ] 4 0 4
7 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_404.txt b/tools/h5diff/testfiles/h5diff_404.txt
index 2a0b856..c9a476d 100644
--- a/tools/h5diff/testfiles/h5diff_404.txt
+++ b/tools/h5diff/testfiles/h5diff_404.txt
@@ -12,25 +12,23 @@ file1 file2
group : </> and </>
0 differences found
external link: </ext_link_dset1> and </ext_link_dset1>
-dataset: </target_group/x_dset> and </target_group/x_dset>
+dataset: </ext_link_dset1> and </ext_link_dset1>
0 differences found
0 differences found
external link: </ext_link_dset2> and </ext_link_dset2>
-dataset: </target_group2/x_dset> and </target_group2/x_dset>
+dataset: </ext_link_dset2> and </ext_link_dset2>
0 differences found
0 differences found
external link: </ext_link_grp1> and </ext_link_grp1>
-group : </target_group> and </target_group>
+group : </ext_link_grp1> and </ext_link_grp1>
0 differences found
0 differences found
external link: </ext_link_grp2> and </ext_link_grp2>
-group : </target_group2> and </target_group2>
+group : </ext_link_grp2> and </ext_link_grp2>
0 differences found
0 differences found
-external link: </ext_link_noexist1> and </ext_link_noexist1>
-Object </no_obj> could not be found in <h5diff_extlink_trg.h5>
-Object </no_obj> could not be found in <h5diff_extlink_trg.h5>
+dangling link: </ext_link_noexist1> and </ext_link_noexist1>
0 differences found
-external link: </ext_link_noexist2> and </ext_link_noexist2>
-h5diff: <no_file.h5>: unable to open file
+dangling link: </ext_link_noexist2> and </ext_link_noexist2>
0 differences found
+EXIT CODE: 0
diff --git a/tools/h5diff/testfiles/h5diff_405.txt b/tools/h5diff/testfiles/h5diff_405.txt
index edbf22a..890dd33 100644
--- a/tools/h5diff/testfiles/h5diff_405.txt
+++ b/tools/h5diff/testfiles/h5diff_405.txt
@@ -1,6 +1,6 @@
-dataset: </target_group/x_dset> and </target_group2/x_dset>
+dataset: </ext_link_dset1> and </target_group2/x_dset>
size: [2x4] [2x4]
-position x_dset x_dset difference
+position ext_link_dset1 x_dset difference
------------------------------------------------------------
[ 0 1 ] 1 0 1
[ 0 2 ] 2 0 2
@@ -10,3 +10,4 @@ position x_dset x_dset difference
[ 1 2 ] 3 0 3
[ 1 3 ] 4 0 4
7 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_406.txt b/tools/h5diff/testfiles/h5diff_406.txt
index 7c5eb3e..7fa442a 100644
--- a/tools/h5diff/testfiles/h5diff_406.txt
+++ b/tools/h5diff/testfiles/h5diff_406.txt
@@ -1,6 +1,6 @@
-dataset: </target_group2/x_dset> and </target_group/x_dset>
+dataset: </target_group2/x_dset> and </ext_link_dset1>
size: [2x4] [2x4]
-position x_dset x_dset difference
+position x_dset ext_link_dset1 difference
------------------------------------------------------------
[ 0 1 ] 0 1 1
[ 0 2 ] 0 2 2
@@ -10,3 +10,4 @@ position x_dset x_dset difference
[ 1 2 ] 0 3 3
[ 1 3 ] 0 4 4
7 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_407.txt b/tools/h5diff/testfiles/h5diff_407.txt
index edbf22a..3693ab9 100644
--- a/tools/h5diff/testfiles/h5diff_407.txt
+++ b/tools/h5diff/testfiles/h5diff_407.txt
@@ -1,6 +1,6 @@
-dataset: </target_group/x_dset> and </target_group2/x_dset>
+dataset: </ext_link_dset1> and </ext_link_dset2>
size: [2x4] [2x4]
-position x_dset x_dset difference
+position ext_link_dset1 ext_link_dset2 difference
------------------------------------------------------------
[ 0 1 ] 1 0 1
[ 0 2 ] 2 0 2
@@ -10,3 +10,4 @@ position x_dset x_dset difference
[ 1 2 ] 3 0 3
[ 1 3 ] 4 0 4
7 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_408.txt b/tools/h5diff/testfiles/h5diff_408.txt
index 11a928a..e941f9b 100644
--- a/tools/h5diff/testfiles/h5diff_408.txt
+++ b/tools/h5diff/testfiles/h5diff_408.txt
@@ -1,6 +1,6 @@
-dataset: </target_dset1> and </target_group2/x_dset>
+dataset: </softlink_dset1_1> and </ext_link_dset2>
size: [2x4] [2x4]
-position target_dset1 x_dset difference
+position softlink_dset1_1 ext_link_dset2 difference
------------------------------------------------------------
[ 0 1 ] 1 0 1
[ 0 2 ] 2 0 2
@@ -10,3 +10,4 @@ position target_dset1 x_dset difference
[ 1 2 ] 3 0 3
[ 1 3 ] 4 0 4
7 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_409.txt b/tools/h5diff/testfiles/h5diff_409.txt
index 3b95e7c..007da7d 100644
--- a/tools/h5diff/testfiles/h5diff_409.txt
+++ b/tools/h5diff/testfiles/h5diff_409.txt
@@ -1,6 +1,6 @@
-dataset: </target_group2/x_dset> and </target_dset1>
+dataset: </ext_link_dset2> and </softlink_dset1_1>
size: [2x4] [2x4]
-position x_dset target_dset1 difference
+position ext_link_dset2 softlink_dset1_1 difference
------------------------------------------------------------
[ 0 1 ] 0 1 1
[ 0 2 ] 0 2 2
@@ -10,3 +10,4 @@ position x_dset target_dset1 difference
[ 1 2 ] 0 3 3
[ 1 3 ] 0 4 4
7 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_410.txt b/tools/h5diff/testfiles/h5diff_410.txt
index 8c645d2..b0924f6 100644
--- a/tools/h5diff/testfiles/h5diff_410.txt
+++ b/tools/h5diff/testfiles/h5diff_410.txt
@@ -24,51 +24,51 @@ file1 file2
group : </> and </>
0 differences found
link : </softlink1_to_dset1> and </softlink1_to_dset1>
-dataset: </target_dset1> and </target_dset1>
+dataset: </softlink1_to_dset1> and </softlink1_to_dset1>
0 differences found
0 differences found
link : </softlink1_to_slink1> and </softlink1_to_slink1>
-dataset: <softlink1_to_dset1> and <softlink1_to_dset1>
+dataset: </softlink1_to_slink1> and </softlink1_to_slink1>
0 differences found
0 differences found
link : </softlink1_to_slink2> and </softlink1_to_slink2>
-dataset: <softlink1_to_slink1> and <softlink1_to_slink1>
+dataset: </softlink1_to_slink2> and </softlink1_to_slink2>
0 differences found
0 differences found
link : </softlink2_to_dset2> and </softlink2_to_dset2>
-dataset: </target_dset2> and </target_dset2>
+dataset: </softlink2_to_dset2> and </softlink2_to_dset2>
0 differences found
0 differences found
link : </softlink2_to_slink1> and </softlink2_to_slink1>
-dataset: <softlink2_to_dset2> and <softlink2_to_dset2>
+dataset: </softlink2_to_slink1> and </softlink2_to_slink1>
0 differences found
0 differences found
link : </softlink2_to_slink2> and </softlink2_to_slink2>
-dataset: <softlink2_to_slink1> and <softlink2_to_slink1>
+dataset: </softlink2_to_slink2> and </softlink2_to_slink2>
0 differences found
0 differences found
link : </softlink3_to_group1> and </softlink3_to_group1>
-group : <target_group1> and <target_group1>
+group : </softlink3_to_group1> and </softlink3_to_group1>
0 differences found
0 differences found
link : </softlink3_to_slink1> and </softlink3_to_slink1>
-group : <softlink3_to_group1> and <softlink3_to_group1>
+group : </softlink3_to_slink1> and </softlink3_to_slink1>
0 differences found
0 differences found
link : </softlink3_to_slink2> and </softlink3_to_slink2>
-group : <softlink3_to_slink1> and <softlink3_to_slink1>
+group : </softlink3_to_slink2> and </softlink3_to_slink2>
0 differences found
0 differences found
link : </softlink4_to_group2> and </softlink4_to_group2>
-group : <target_group2> and <target_group2>
+group : </softlink4_to_group2> and </softlink4_to_group2>
0 differences found
0 differences found
link : </softlink4_to_slink1> and </softlink4_to_slink1>
-group : <softlink4_to_group2> and <softlink4_to_group2>
+group : </softlink4_to_slink1> and </softlink4_to_slink1>
0 differences found
0 differences found
link : </softlink4_to_slink2> and </softlink4_to_slink2>
-group : <softlink4_to_slink1> and <softlink4_to_slink1>
+group : </softlink4_to_slink2> and </softlink4_to_slink2>
0 differences found
0 differences found
dataset: </target_dset1> and </target_dset1>
@@ -83,3 +83,4 @@ group : </target_group1> and </target_group1>
0 differences found
group : </target_group2> and </target_group2>
0 differences found
+EXIT CODE: 0
diff --git a/tools/h5diff/testfiles/h5diff_411.txt b/tools/h5diff/testfiles/h5diff_411.txt
index 2775677..161ab34 100644
--- a/tools/h5diff/testfiles/h5diff_411.txt
+++ b/tools/h5diff/testfiles/h5diff_411.txt
@@ -1,6 +1,6 @@
-dataset: </target_dset2> and <softlink1_to_slink1>
+dataset: </target_dset2> and </softlink1_to_slink2>
size: [2x4] [2x4]
-position target_dset2 softlink1_to_slink1 difference
+position target_dset2 softlink1_to_slink2 difference
------------------------------------------------------------
[ 0 1 ] 0 1 1
[ 0 2 ] 0 2 2
@@ -10,3 +10,4 @@ position target_dset2 softlink1_to_slink1 difference
[ 1 2 ] 0 3 3
[ 1 3 ] 0 4 4
7 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_412.txt b/tools/h5diff/testfiles/h5diff_412.txt
index 0924099..bb8209c 100644
--- a/tools/h5diff/testfiles/h5diff_412.txt
+++ b/tools/h5diff/testfiles/h5diff_412.txt
@@ -1,6 +1,6 @@
-dataset: <softlink1_to_slink1> and </target_dset2>
+dataset: </softlink1_to_slink2> and </target_dset2>
size: [2x4] [2x4]
-position softlink1_to_slink1 target_dset2 difference
+position softlink1_to_slink2 target_dset2 difference
------------------------------------------------------------
[ 0 1 ] 1 0 1
[ 0 2 ] 2 0 2
@@ -10,3 +10,4 @@ position softlink1_to_slink1 target_dset2 difference
[ 1 2 ] 3 0 3
[ 1 3 ] 4 0 4
7 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_413.txt b/tools/h5diff/testfiles/h5diff_413.txt
index ae6cfea..8df3d51 100644
--- a/tools/h5diff/testfiles/h5diff_413.txt
+++ b/tools/h5diff/testfiles/h5diff_413.txt
@@ -1,6 +1,6 @@
-dataset: <softlink1_to_slink1> and <softlink2_to_slink1>
+dataset: </softlink1_to_slink2> and </softlink2_to_slink2>
size: [2x4] [2x4]
-position softlink1_to_slink1 softlink2_to_slink1 difference
+position softlink1_to_slink2 softlink2_to_slink2 difference
------------------------------------------------------------
[ 0 1 ] 1 0 1
[ 0 2 ] 2 0 2
@@ -10,3 +10,4 @@ position softlink1_to_slink1 softlink2_to_slink1 difference
[ 1 2 ] 3 0 3
[ 1 3 ] 4 0 4
7 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_414.txt b/tools/h5diff/testfiles/h5diff_414.txt
index 0f07a14..e7a991a 100644
--- a/tools/h5diff/testfiles/h5diff_414.txt
+++ b/tools/h5diff/testfiles/h5diff_414.txt
@@ -1,2 +1,3 @@
-group : </target_group> and <softlink3_to_slink1>
+group : </target_group> and </softlink3_to_slink2>
1 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_415.txt b/tools/h5diff/testfiles/h5diff_415.txt
index 3a9d863..1e97319 100644
--- a/tools/h5diff/testfiles/h5diff_415.txt
+++ b/tools/h5diff/testfiles/h5diff_415.txt
@@ -1,2 +1,3 @@
-group : <softlink3_to_slink1> and </target_group>
+group : </softlink3_to_slink2> and </target_group>
1 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_416.txt b/tools/h5diff/testfiles/h5diff_416.txt
index 39d88bc..e4e98b0 100644
--- a/tools/h5diff/testfiles/h5diff_416.txt
+++ b/tools/h5diff/testfiles/h5diff_416.txt
@@ -1,2 +1,3 @@
-group : <softlink3_to_slink1> and <softlink4_to_slink1>
+group : </softlink3_to_slink2> and </softlink4_to_slink2>
1 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_417.txt b/tools/h5diff/testfiles/h5diff_417.txt
index 56031e9..0ea2542 100644
--- a/tools/h5diff/testfiles/h5diff_417.txt
+++ b/tools/h5diff/testfiles/h5diff_417.txt
@@ -1,6 +1,3 @@
-warn: link target "/no_obj" doesn't exist
-</no_obj> is of type unknown type and </target_dset2> is of type H5G_DATASET
---------------------------------
-Some objects are not comparable
---------------------------------
-Use -c for a list of objects.
+obj1 </softlink_noexist> is a dangling link.
+1 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_418.txt b/tools/h5diff/testfiles/h5diff_418.txt
index 0222174..46222bb 100644
--- a/tools/h5diff/testfiles/h5diff_418.txt
+++ b/tools/h5diff/testfiles/h5diff_418.txt
@@ -1,6 +1,3 @@
-warn: link target "/no_obj" doesn't exist
-</target_dset2> is of type H5G_DATASET and </no_obj> is of type unknown type
---------------------------------
-Some objects are not comparable
---------------------------------
-Use -c for a list of objects.
+obj2 </softlink_noexist> is a dangling link.
+1 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_419.txt b/tools/h5diff/testfiles/h5diff_419.txt
index 836e95f..387c600 100644
--- a/tools/h5diff/testfiles/h5diff_419.txt
+++ b/tools/h5diff/testfiles/h5diff_419.txt
@@ -1,2 +1,3 @@
-error: <no_file.h5>: unable to open file
-error: unable to get external link info from "/ext_link_noexist2"
+obj1 </ext_link_noexist2> is a dangling link.
+1 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_420.txt b/tools/h5diff/testfiles/h5diff_420.txt
index 836e95f..f3e65d9 100644
--- a/tools/h5diff/testfiles/h5diff_420.txt
+++ b/tools/h5diff/testfiles/h5diff_420.txt
@@ -1,2 +1,3 @@
-error: <no_file.h5>: unable to open file
-error: unable to get external link info from "/ext_link_noexist2"
+obj2 </ext_link_noexist2> is a dangling link.
+1 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_421.txt b/tools/h5diff/testfiles/h5diff_421.txt
index c686b69..833c60c 100644
--- a/tools/h5diff/testfiles/h5diff_421.txt
+++ b/tools/h5diff/testfiles/h5diff_421.txt
@@ -1,2 +1,3 @@
-error: "/no_obj" doesn't exist
-error: unable to get external link info from "/ext_link_noexist1"
+obj2 </ext_link_noexist1> is a dangling link.
+1 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_422.txt b/tools/h5diff/testfiles/h5diff_422.txt
index c686b69..3e675d5 100644
--- a/tools/h5diff/testfiles/h5diff_422.txt
+++ b/tools/h5diff/testfiles/h5diff_422.txt
@@ -1,2 +1,3 @@
-error: "/no_obj" doesn't exist
-error: unable to get external link info from "/ext_link_noexist1"
+obj1 </ext_link_noexist1> is a dangling link.
+1 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_423.txt b/tools/h5diff/testfiles/h5diff_423.txt
index 5eb6766..1ebc157 100644
--- a/tools/h5diff/testfiles/h5diff_423.txt
+++ b/tools/h5diff/testfiles/h5diff_423.txt
@@ -1,6 +1,6 @@
-dataset: </dset1> and </dset2>
+dataset: </ext_link_to_slink1> and </dset2>
size: [2x4] [2x4]
-position dset1 dset2 difference
+position ext_link_to_slink1 dset2 difference
------------------------------------------------------------
[ 0 1 ] 0 1 1
[ 0 2 ] 0 2 2
@@ -10,3 +10,4 @@ position dset1 dset2 difference
[ 1 2 ] 0 3 3
[ 1 3 ] 0 4 4
7 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_424.txt b/tools/h5diff/testfiles/h5diff_424.txt
index cd240cf..9099c41 100644
--- a/tools/h5diff/testfiles/h5diff_424.txt
+++ b/tools/h5diff/testfiles/h5diff_424.txt
@@ -1,6 +1,6 @@
-dataset: </dset2> and </dset1>
+dataset: </dset2> and </ext_link_to_slink1>
size: [2x4] [2x4]
-position dset2 dset1 difference
+position dset2 ext_link_to_slink1 difference
------------------------------------------------------------
[ 0 1 ] 1 0 1
[ 0 2 ] 2 0 2
@@ -10,3 +10,4 @@ position dset2 dset1 difference
[ 1 2 ] 3 0 3
[ 1 3 ] 4 0 4
7 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_425.txt b/tools/h5diff/testfiles/h5diff_425.txt
index 5eb6766..03ceb78 100644
--- a/tools/h5diff/testfiles/h5diff_425.txt
+++ b/tools/h5diff/testfiles/h5diff_425.txt
@@ -1,6 +1,6 @@
-dataset: </dset1> and </dset2>
+dataset: </ext_link_to_slink1> and </ext_link_to_slink2>
size: [2x4] [2x4]
-position dset1 dset2 difference
+position ext_link_to_slink1 ext_link_to_slink2 difference
------------------------------------------------------------
[ 0 1 ] 0 1 1
[ 0 2 ] 0 2 2
@@ -10,3 +10,4 @@ position dset1 dset2 difference
[ 1 2 ] 0 3 3
[ 1 3 ] 0 4 4
7 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_450.txt b/tools/h5diff/testfiles/h5diff_450.txt
new file mode 100644
index 0000000..bf4f6e9
--- /dev/null
+++ b/tools/h5diff/testfiles/h5diff_450.txt
@@ -0,0 +1,35 @@
+
+file1 file2
+---------------------------------------
+ x x /
+ x x /dset1
+ x x /dset2
+ x x /ext_link1
+ x x /ext_link2
+ x x /ext_link3
+ x x /ext_link4
+ x x /soft_link1
+ x x /soft_link2
+ x x /soft_link3
+
+group : </> and </>
+0 differences found
+dataset: </dset1> and </dset1>
+0 differences found
+dataset: </dset2> and </dset2>
+0 differences found
+dangling link: </ext_link1> and </ext_link1>
+0 differences found
+obj2 </ext_link2> is a dangling link.
+1 differences found
+obj1 </ext_link3> is a dangling link.
+1 differences found
+dangling link: </ext_link4> and </ext_link4>
+0 differences found
+dangling link: </soft_link1> and </soft_link1>
+0 differences found
+obj2 </soft_link2> is a dangling link.
+1 differences found
+obj1 </soft_link3> is a dangling link.
+1 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_451.txt b/tools/h5diff/testfiles/h5diff_451.txt
new file mode 100644
index 0000000..0d30023
--- /dev/null
+++ b/tools/h5diff/testfiles/h5diff_451.txt
@@ -0,0 +1,28 @@
+
+file1 file2
+---------------------------------------
+ x x /
+ x x /dset1
+ x x /dset2
+ x x /ext_link1
+ x x /ext_link2
+ x x /ext_link3
+ x x /ext_link4
+ x x /soft_link1
+ x x /soft_link2
+ x x /soft_link3
+
+group : </> and </>
+0 differences found
+dataset: </dset1> and </dset1>
+0 differences found
+dataset: </dset2> and </dset2>
+0 differences found
+Warning: </ext_link1> is a dangling link.
+Warning: </ext_link2> is a dangling link.
+Warning: </ext_link3> is a dangling link.
+Warning: </ext_link4> is a dangling link.
+Warning: </soft_link1> is a dangling link.
+Warning: </soft_link2> is a dangling link.
+Warning: </soft_link3> is a dangling link.
+EXIT CODE: 2
diff --git a/tools/h5diff/testfiles/h5diff_452.txt b/tools/h5diff/testfiles/h5diff_452.txt
new file mode 100644
index 0000000..76e4457
--- /dev/null
+++ b/tools/h5diff/testfiles/h5diff_452.txt
@@ -0,0 +1,2 @@
+Error: --no-dangling-links must be used along with --follow-links option.
+EXIT CODE: 2
diff --git a/tools/h5diff/testfiles/h5diff_453.txt b/tools/h5diff/testfiles/h5diff_453.txt
new file mode 100644
index 0000000..9c4d61b
--- /dev/null
+++ b/tools/h5diff/testfiles/h5diff_453.txt
@@ -0,0 +1,47 @@
+
+file1 file2
+---------------------------------------
+ x x /
+ x x /softlink_dset1_1
+ x x /softlink_dset1_2
+ x x /softlink_dset2
+ x x /softlink_group1
+ x x /softlink_group2
+ x x /softlink_noexist
+ x x /target_dset1
+ x x /target_dset2
+ x x /target_group
+ x x /target_group/dset
+
+group : </> and </>
+0 differences found
+link : </softlink_dset1_1> and </softlink_dset1_1>
+dataset: </softlink_dset1_1> and </softlink_dset1_1>
+0 differences found
+0 differences found
+link : </softlink_dset1_2> and </softlink_dset1_2>
+dataset: </softlink_dset1_2> and </softlink_dset1_2>
+0 differences found
+0 differences found
+link : </softlink_dset2> and </softlink_dset2>
+dataset: </softlink_dset2> and </softlink_dset2>
+0 differences found
+0 differences found
+link : </softlink_group1> and </softlink_group1>
+group : </softlink_group1> and </softlink_group1>
+0 differences found
+0 differences found
+link : </softlink_group2> and </softlink_group2>
+group : </softlink_group2> and </softlink_group2>
+0 differences found
+0 differences found
+Warning: </softlink_noexist> is a dangling link.
+dataset: </target_dset1> and </target_dset1>
+0 differences found
+dataset: </target_dset2> and </target_dset2>
+0 differences found
+group : </target_group> and </target_group>
+0 differences found
+dataset: </target_group/dset> and </target_group/dset>
+0 differences found
+EXIT CODE: 2
diff --git a/tools/h5diff/testfiles/h5diff_454.txt b/tools/h5diff/testfiles/h5diff_454.txt
new file mode 100644
index 0000000..dcc2e9c
--- /dev/null
+++ b/tools/h5diff/testfiles/h5diff_454.txt
@@ -0,0 +1,2 @@
+Warning: </softlink_noexist> is a dangling link.
+EXIT CODE: 2
diff --git a/tools/h5diff/testfiles/h5diff_455.txt b/tools/h5diff/testfiles/h5diff_455.txt
new file mode 100644
index 0000000..dcc2e9c
--- /dev/null
+++ b/tools/h5diff/testfiles/h5diff_455.txt
@@ -0,0 +1,2 @@
+Warning: </softlink_noexist> is a dangling link.
+EXIT CODE: 2
diff --git a/tools/h5diff/testfiles/h5diff_456.txt b/tools/h5diff/testfiles/h5diff_456.txt
new file mode 100644
index 0000000..f20e403
--- /dev/null
+++ b/tools/h5diff/testfiles/h5diff_456.txt
@@ -0,0 +1,32 @@
+
+file1 file2
+---------------------------------------
+ x x /
+ x x /ext_link_dset1
+ x x /ext_link_dset2
+ x x /ext_link_grp1
+ x x /ext_link_grp2
+ x x /ext_link_noexist1
+ x x /ext_link_noexist2
+
+group : </> and </>
+0 differences found
+external link: </ext_link_dset1> and </ext_link_dset1>
+dataset: </ext_link_dset1> and </ext_link_dset1>
+0 differences found
+0 differences found
+external link: </ext_link_dset2> and </ext_link_dset2>
+dataset: </ext_link_dset2> and </ext_link_dset2>
+0 differences found
+0 differences found
+external link: </ext_link_grp1> and </ext_link_grp1>
+group : </ext_link_grp1> and </ext_link_grp1>
+0 differences found
+0 differences found
+external link: </ext_link_grp2> and </ext_link_grp2>
+group : </ext_link_grp2> and </ext_link_grp2>
+0 differences found
+0 differences found
+Warning: </ext_link_noexist1> is a dangling link.
+Warning: </ext_link_noexist2> is a dangling link.
+EXIT CODE: 2
diff --git a/tools/h5diff/testfiles/h5diff_457.txt b/tools/h5diff/testfiles/h5diff_457.txt
new file mode 100644
index 0000000..762ccdc
--- /dev/null
+++ b/tools/h5diff/testfiles/h5diff_457.txt
@@ -0,0 +1,2 @@
+Warning: </ext_link_noexist1> is a dangling link.
+EXIT CODE: 2
diff --git a/tools/h5diff/testfiles/h5diff_458.txt b/tools/h5diff/testfiles/h5diff_458.txt
new file mode 100644
index 0000000..067d665
--- /dev/null
+++ b/tools/h5diff/testfiles/h5diff_458.txt
@@ -0,0 +1,2 @@
+Warning: </ext_link_noexist2> is a dangling link.
+EXIT CODE: 2
diff --git a/tools/h5diff/testfiles/h5diff_459.txt b/tools/h5diff/testfiles/h5diff_459.txt
new file mode 100644
index 0000000..762ccdc
--- /dev/null
+++ b/tools/h5diff/testfiles/h5diff_459.txt
@@ -0,0 +1,2 @@
+Warning: </ext_link_noexist1> is a dangling link.
+EXIT CODE: 2
diff --git a/tools/h5diff/testfiles/h5diff_50.txt b/tools/h5diff/testfiles/h5diff_50.txt
index 65b563c..434b458 100644
--- a/tools/h5diff/testfiles/h5diff_50.txt
+++ b/tools/h5diff/testfiles/h5diff_50.txt
@@ -10,3 +10,4 @@ position dset0a dset0b difference
[ 2 0 ] 1 5 4
[ 2 1 ] 1 6 5
4 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_51.txt b/tools/h5diff/testfiles/h5diff_51.txt
index e6402cc..621ba2a 100644
--- a/tools/h5diff/testfiles/h5diff_51.txt
+++ b/tools/h5diff/testfiles/h5diff_51.txt
@@ -7,3 +7,4 @@ position dset1a dset1b difference
[ 2 0 ] 1 5 4
[ 2 1 ] 1 6 5
4 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_52.txt b/tools/h5diff/testfiles/h5diff_52.txt
index 88febb9..6667659 100644
--- a/tools/h5diff/testfiles/h5diff_52.txt
+++ b/tools/h5diff/testfiles/h5diff_52.txt
@@ -7,3 +7,4 @@ position dset2a dset2b difference
[ 2 0 ] 1 5 4
[ 2 1 ] 1 6 5
4 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_53.txt b/tools/h5diff/testfiles/h5diff_53.txt
index 554d71a..458d166 100644
--- a/tools/h5diff/testfiles/h5diff_53.txt
+++ b/tools/h5diff/testfiles/h5diff_53.txt
@@ -7,3 +7,4 @@ position dset3a dset4b difference
[ 2 0 ] 1 5 4
[ 2 1 ] 1 6 5
4 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_54.txt b/tools/h5diff/testfiles/h5diff_54.txt
index 1e8adfd..2ca60f8 100644
--- a/tools/h5diff/testfiles/h5diff_54.txt
+++ b/tools/h5diff/testfiles/h5diff_54.txt
@@ -7,3 +7,4 @@ position dset4a dset4b difference
[ 2 0 ] 1 5 4
[ 2 1 ] 1 6 5
4 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_55.txt b/tools/h5diff/testfiles/h5diff_55.txt
index f895955..1288887 100644
--- a/tools/h5diff/testfiles/h5diff_55.txt
+++ b/tools/h5diff/testfiles/h5diff_55.txt
@@ -7,3 +7,4 @@ position dset5a dset5b difference
[ 2 0 ] 1 5 4
[ 2 1 ] 1 6 5
4 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_56.txt b/tools/h5diff/testfiles/h5diff_56.txt
index 402db43..0e82860 100644
--- a/tools/h5diff/testfiles/h5diff_56.txt
+++ b/tools/h5diff/testfiles/h5diff_56.txt
@@ -7,3 +7,4 @@ position dset6a dset6b difference
[ 2 0 ] 1 5 4
[ 2 1 ] 1 6 5
4 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_57.txt b/tools/h5diff/testfiles/h5diff_57.txt
index a026077..61aaa57 100644
--- a/tools/h5diff/testfiles/h5diff_57.txt
+++ b/tools/h5diff/testfiles/h5diff_57.txt
@@ -8,3 +8,4 @@ Not comparable: </dset7a> has sign H5T_SGN_2 and </dset7b> has sign H5T_SGN_NONE
Some objects are not comparable
--------------------------------
Use -c for a list of objects.
+EXIT CODE: 0
diff --git a/tools/h5diff/testfiles/h5diff_58.txt b/tools/h5diff/testfiles/h5diff_58.txt
index c46cad3..768dd97 100644
--- a/tools/h5diff/testfiles/h5diff_58.txt
+++ b/tools/h5diff/testfiles/h5diff_58.txt
@@ -8,3 +8,4 @@ point #1 (2,2) (3,3)
point #3 (1,6) (2,5)
point #4 (2,8) (1,7)
4 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_600.txt b/tools/h5diff/testfiles/h5diff_600.txt
index 376e530..f76d4d5 100644
--- a/tools/h5diff/testfiles/h5diff_600.txt
+++ b/tools/h5diff/testfiles/h5diff_600.txt
@@ -3,65 +3,100 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
file2 File name of the second HDF5 file
[obj1] Name of an HDF5 object, in absolute path
[obj2] Name of an HDF5 object, in absolute path
+
OPTIONS
- -h, --help Print a usage message and exit
- -V, --version Print version number and exit
- -r, --report Report mode. Print differences
- -v, --verbose Verbose mode. Print differences, list of objects
- -q, --quiet Quiet mode. Do not do output
- -l, --link-follow Follow link(s)
+ -h, --help Print a usage message and exit.
+ -V, --version Print version number and exit.
+ -r, --report Report mode. Print differences.
+ -v, --verbose Verbose mode. Print differences, list of objects.
+ -q, --quiet Quiet mode. Do not produce output.
+ --follow-links Follow symbolic links (soft links and external links)
+ and compare the links' target objects.
+ If symbolic link(s) with the same name exist in the
+ files being compared, then determine whether the
+ target of each link is an existing object (dataset,
+ group, or named datatype) or the link is a dangling
+ link (a soft or external link pointing to a target
+ object that does not yet exist).
+ - If both symbolic links are dangling links, they
+ are treated as being the same; by default, h5diff
+ returns an exit code of 0. If, however,
+ --no-dangling-links is used with --follow-links,
+ this situation is treated as an error and h5diff
+ returns an exit code of 2.
+ - If only one of the two links is a dangling link,
+ they are treated as being different and h5diff
+ returns an exit code of 1. If, however,
+ --no-dangling-links is used with --follow-links,
+ this situation is treated as an error and h5diff
+ returns an exit code of 2.
+ - If both symbolic links point to existing objects,
+ h5diff compares the two objects.
+ If any symbolic link specified in the call to h5diff
+ does not exist, h5diff treats it as an error and
+ returns an exit code of 2.
+ --no-dangling-links Must be used with --follow-links option;
+ otherwise, h5diff shows error message and returns
+ an exit code of 2.
+ Check for any symbolic links (soft links or external
+ links) that do not resolve to an existing object
+ (dataset, group, or named datatype). If any
+ dangling link is found, this situation is treated as
+ an error and h5diff returns an exit code of 2.
-c, --compare List objects that are not comparable
-N, --nan Avoid NaNs detection
- -n C, --count=C Print differences up to C number, C is a positive integer.
- -d D, --delta=D Print difference if (|a-b| > D), D is a positive number.
- -p R, --relative=R Print difference if (|(a-b)/b| > R), R is a positive number.
+ -n C, --count=C Print differences up to C number, C is a positive
+ integer.
+ -d D, --delta=D Print difference if (|a-b| > D), D is a positive
+ number.
+ -p R, --relative=R Print difference if (|(a-b)/b| > R), R is a positive
+ number.
--use-system-epsilon Print difference if (|a-b| > EPSILON),
- where EPSILON (FLT_EPSILON or FLT_EPSILON) is the system epsilon value.
- If the system epsilon is not defined, use the value below:
+ where EPSILON (FLT_EPSILON or FLT_EPSILON) is the
+ system epsilon value.
+ If the system epsilon is not defined, use the value
+ below:
FLT_EPSILON = 1.19209E-07 for float
DBL_EPSILON = 2.22045E-16 for double
- -d, -p, and --use-system-epsilon options are used for comparing floating point values.
- By default, strict equality is used. Use -p or -d to set specific tolerance.
+ -d, -p, and --use-system-epsilon options are used for
+ comparing floating point values.
+ By default, strict equality is used. Use -p or -d to
+ set specific tolerance.
Modes of output:
-
Default mode: print the number of differences found and where they occured
-r Report mode: print the above plus the differences
-v Verbose mode: print the above plus a list of objects and warnings
-q Quiet mode: do not print output
Compare criteria
-
- If no objects [obj1[obj2]] are specified, h5diff only compares objects
- with the same absolute path in both files
+ If no objects [obj1[obj2]] are specified, h5diff only compares objects
+ with the same absolute path in both files
The compare criteria is:
- 1) datasets: numerical array differences 2) groups: name string difference
- 3) datatypes: the return value of H5Tequal 4) links: name string difference
- of the linked value
+ 1) datasets: numerical array differences
+ 2) groups: name string difference
+ 3) datatypes: the return value of H5Tequal
+ 4) links: name string difference of the linked value as default
+ (refer to --follow-links option).
- Return exit code:
-
- 1 if differences found, 0 if no differences, 2 if error
+ Exit code:
+ 0 if no differences, 1 if differences found, 2 if error
Examples of use:
-
1) h5diff file1 file2 /g1/dset1 /g1/dset2
-
Compares object '/g1/dset1' in file1 with '/g1/dset2' in file2
2) h5diff file1 file2 /g1/dset1
-
Compares object '/g1/dset1' in both files
3) h5diff file1 file2
-
Compares all objects in both files
- Note) file1 and file2 can be the same file. Use
-
- h5diff file1 file1 /g1/dset1 /g1/dset2
-
- to compare '/g1/dset1' and '/g1/dset2' in the same file
+ Notes:
+ file1 and file2 can be the same file.
+ Use h5diff file1 file1 /g1/dset1 /g1/dset2 to compare
+ '/g1/dset1' and '/g1/dset2' in the same file
h5diff error: missing file names
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_603.txt b/tools/h5diff/testfiles/h5diff_603.txt
index f8a858d..a5286df 100644
--- a/tools/h5diff/testfiles/h5diff_603.txt
+++ b/tools/h5diff/testfiles/h5diff_603.txt
@@ -4,64 +4,99 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
file2 File name of the second HDF5 file
[obj1] Name of an HDF5 object, in absolute path
[obj2] Name of an HDF5 object, in absolute path
+
OPTIONS
- -h, --help Print a usage message and exit
- -V, --version Print version number and exit
- -r, --report Report mode. Print differences
- -v, --verbose Verbose mode. Print differences, list of objects
- -q, --quiet Quiet mode. Do not do output
- -l, --link-follow Follow link(s)
+ -h, --help Print a usage message and exit.
+ -V, --version Print version number and exit.
+ -r, --report Report mode. Print differences.
+ -v, --verbose Verbose mode. Print differences, list of objects.
+ -q, --quiet Quiet mode. Do not produce output.
+ --follow-links Follow symbolic links (soft links and external links)
+ and compare the links' target objects.
+ If symbolic link(s) with the same name exist in the
+ files being compared, then determine whether the
+ target of each link is an existing object (dataset,
+ group, or named datatype) or the link is a dangling
+ link (a soft or external link pointing to a target
+ object that does not yet exist).
+ - If both symbolic links are dangling links, they
+ are treated as being the same; by default, h5diff
+ returns an exit code of 0. If, however,
+ --no-dangling-links is used with --follow-links,
+ this situation is treated as an error and h5diff
+ returns an exit code of 2.
+ - If only one of the two links is a dangling link,
+ they are treated as being different and h5diff
+ returns an exit code of 1. If, however,
+ --no-dangling-links is used with --follow-links,
+ this situation is treated as an error and h5diff
+ returns an exit code of 2.
+ - If both symbolic links point to existing objects,
+ h5diff compares the two objects.
+ If any symbolic link specified in the call to h5diff
+ does not exist, h5diff treats it as an error and
+ returns an exit code of 2.
+ --no-dangling-links Must be used with --follow-links option;
+ otherwise, h5diff shows error message and returns
+ an exit code of 2.
+ Check for any symbolic links (soft links or external
+ links) that do not resolve to an existing object
+ (dataset, group, or named datatype). If any
+ dangling link is found, this situation is treated as
+ an error and h5diff returns an exit code of 2.
-c, --compare List objects that are not comparable
-N, --nan Avoid NaNs detection
- -n C, --count=C Print differences up to C number, C is a positive integer.
- -d D, --delta=D Print difference if (|a-b| > D), D is a positive number.
- -p R, --relative=R Print difference if (|(a-b)/b| > R), R is a positive number.
+ -n C, --count=C Print differences up to C number, C is a positive
+ integer.
+ -d D, --delta=D Print difference if (|a-b| > D), D is a positive
+ number.
+ -p R, --relative=R Print difference if (|(a-b)/b| > R), R is a positive
+ number.
--use-system-epsilon Print difference if (|a-b| > EPSILON),
- where EPSILON (FLT_EPSILON or FLT_EPSILON) is the system epsilon value.
- If the system epsilon is not defined, use the value below:
+ where EPSILON (FLT_EPSILON or FLT_EPSILON) is the
+ system epsilon value.
+ If the system epsilon is not defined, use the value
+ below:
FLT_EPSILON = 1.19209E-07 for float
DBL_EPSILON = 2.22045E-16 for double
- -d, -p, and --use-system-epsilon options are used for comparing floating point values.
- By default, strict equality is used. Use -p or -d to set specific tolerance.
+ -d, -p, and --use-system-epsilon options are used for
+ comparing floating point values.
+ By default, strict equality is used. Use -p or -d to
+ set specific tolerance.
Modes of output:
-
Default mode: print the number of differences found and where they occured
-r Report mode: print the above plus the differences
-v Verbose mode: print the above plus a list of objects and warnings
-q Quiet mode: do not print output
Compare criteria
-
- If no objects [obj1[obj2]] are specified, h5diff only compares objects
- with the same absolute path in both files
+ If no objects [obj1[obj2]] are specified, h5diff only compares objects
+ with the same absolute path in both files
The compare criteria is:
- 1) datasets: numerical array differences 2) groups: name string difference
- 3) datatypes: the return value of H5Tequal 4) links: name string difference
- of the linked value
+ 1) datasets: numerical array differences
+ 2) groups: name string difference
+ 3) datatypes: the return value of H5Tequal
+ 4) links: name string difference of the linked value as default
+ (refer to --follow-links option).
- Return exit code:
-
- 1 if differences found, 0 if no differences, 2 if error
+ Exit code:
+ 0 if no differences, 1 if differences found, 2 if error
Examples of use:
-
1) h5diff file1 file2 /g1/dset1 /g1/dset2
-
Compares object '/g1/dset1' in file1 with '/g1/dset2' in file2
2) h5diff file1 file2 /g1/dset1
-
Compares object '/g1/dset1' in both files
3) h5diff file1 file2
-
Compares all objects in both files
- Note) file1 and file2 can be the same file. Use
-
- h5diff file1 file1 /g1/dset1 /g1/dset2
-
- to compare '/g1/dset1' and '/g1/dset2' in the same file
+ Notes:
+ file1 and file2 can be the same file.
+ Use h5diff file1 file1 /g1/dset1 /g1/dset2 to compare
+ '/g1/dset1' and '/g1/dset2' in the same file
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_604.txt b/tools/h5diff/testfiles/h5diff_604.txt
index 554f2ed..db14532 100644
--- a/tools/h5diff/testfiles/h5diff_604.txt
+++ b/tools/h5diff/testfiles/h5diff_604.txt
@@ -1,2 +1,3 @@
dataset: </g1/dset3> and </g1/dset4>
6 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_605.txt b/tools/h5diff/testfiles/h5diff_605.txt
index 554f2ed..db14532 100644
--- a/tools/h5diff/testfiles/h5diff_605.txt
+++ b/tools/h5diff/testfiles/h5diff_605.txt
@@ -1,2 +1,3 @@
dataset: </g1/dset3> and </g1/dset4>
6 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_606.txt b/tools/h5diff/testfiles/h5diff_606.txt
index ab317bd..ab8039e 100644
--- a/tools/h5diff/testfiles/h5diff_606.txt
+++ b/tools/h5diff/testfiles/h5diff_606.txt
@@ -4,64 +4,99 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
file2 File name of the second HDF5 file
[obj1] Name of an HDF5 object, in absolute path
[obj2] Name of an HDF5 object, in absolute path
+
OPTIONS
- -h, --help Print a usage message and exit
- -V, --version Print version number and exit
- -r, --report Report mode. Print differences
- -v, --verbose Verbose mode. Print differences, list of objects
- -q, --quiet Quiet mode. Do not do output
- -l, --link-follow Follow link(s)
+ -h, --help Print a usage message and exit.
+ -V, --version Print version number and exit.
+ -r, --report Report mode. Print differences.
+ -v, --verbose Verbose mode. Print differences, list of objects.
+ -q, --quiet Quiet mode. Do not produce output.
+ --follow-links Follow symbolic links (soft links and external links)
+ and compare the links' target objects.
+ If symbolic link(s) with the same name exist in the
+ files being compared, then determine whether the
+ target of each link is an existing object (dataset,
+ group, or named datatype) or the link is a dangling
+ link (a soft or external link pointing to a target
+ object that does not yet exist).
+ - If both symbolic links are dangling links, they
+ are treated as being the same; by default, h5diff
+ returns an exit code of 0. If, however,
+ --no-dangling-links is used with --follow-links,
+ this situation is treated as an error and h5diff
+ returns an exit code of 2.
+ - If only one of the two links is a dangling link,
+ they are treated as being different and h5diff
+ returns an exit code of 1. If, however,
+ --no-dangling-links is used with --follow-links,
+ this situation is treated as an error and h5diff
+ returns an exit code of 2.
+ - If both symbolic links point to existing objects,
+ h5diff compares the two objects.
+ If any symbolic link specified in the call to h5diff
+ does not exist, h5diff treats it as an error and
+ returns an exit code of 2.
+ --no-dangling-links Must be used with --follow-links option;
+ otherwise, h5diff shows error message and returns
+ an exit code of 2.
+ Check for any symbolic links (soft links or external
+ links) that do not resolve to an existing object
+ (dataset, group, or named datatype). If any
+ dangling link is found, this situation is treated as
+ an error and h5diff returns an exit code of 2.
-c, --compare List objects that are not comparable
-N, --nan Avoid NaNs detection
- -n C, --count=C Print differences up to C number, C is a positive integer.
- -d D, --delta=D Print difference if (|a-b| > D), D is a positive number.
- -p R, --relative=R Print difference if (|(a-b)/b| > R), R is a positive number.
+ -n C, --count=C Print differences up to C number, C is a positive
+ integer.
+ -d D, --delta=D Print difference if (|a-b| > D), D is a positive
+ number.
+ -p R, --relative=R Print difference if (|(a-b)/b| > R), R is a positive
+ number.
--use-system-epsilon Print difference if (|a-b| > EPSILON),
- where EPSILON (FLT_EPSILON or FLT_EPSILON) is the system epsilon value.
- If the system epsilon is not defined, use the value below:
+ where EPSILON (FLT_EPSILON or FLT_EPSILON) is the
+ system epsilon value.
+ If the system epsilon is not defined, use the value
+ below:
FLT_EPSILON = 1.19209E-07 for float
DBL_EPSILON = 2.22045E-16 for double
- -d, -p, and --use-system-epsilon options are used for comparing floating point values.
- By default, strict equality is used. Use -p or -d to set specific tolerance.
+ -d, -p, and --use-system-epsilon options are used for
+ comparing floating point values.
+ By default, strict equality is used. Use -p or -d to
+ set specific tolerance.
Modes of output:
-
Default mode: print the number of differences found and where they occured
-r Report mode: print the above plus the differences
-v Verbose mode: print the above plus a list of objects and warnings
-q Quiet mode: do not print output
Compare criteria
-
- If no objects [obj1[obj2]] are specified, h5diff only compares objects
- with the same absolute path in both files
+ If no objects [obj1[obj2]] are specified, h5diff only compares objects
+ with the same absolute path in both files
The compare criteria is:
- 1) datasets: numerical array differences 2) groups: name string difference
- 3) datatypes: the return value of H5Tequal 4) links: name string difference
- of the linked value
+ 1) datasets: numerical array differences
+ 2) groups: name string difference
+ 3) datatypes: the return value of H5Tequal
+ 4) links: name string difference of the linked value as default
+ (refer to --follow-links option).
- Return exit code:
-
- 1 if differences found, 0 if no differences, 2 if error
+ Exit code:
+ 0 if no differences, 1 if differences found, 2 if error
Examples of use:
-
1) h5diff file1 file2 /g1/dset1 /g1/dset2
-
Compares object '/g1/dset1' in file1 with '/g1/dset2' in file2
2) h5diff file1 file2 /g1/dset1
-
Compares object '/g1/dset1' in both files
3) h5diff file1 file2
-
Compares all objects in both files
- Note) file1 and file2 can be the same file. Use
-
- h5diff file1 file1 /g1/dset1 /g1/dset2
-
- to compare '/g1/dset1' and '/g1/dset2' in the same file
+ Notes:
+ file1 and file2 can be the same file.
+ Use h5diff file1 file1 /g1/dset1 /g1/dset2 to compare
+ '/g1/dset1' and '/g1/dset2' in the same file
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_607.txt b/tools/h5diff/testfiles/h5diff_607.txt
index 554f2ed..db14532 100644
--- a/tools/h5diff/testfiles/h5diff_607.txt
+++ b/tools/h5diff/testfiles/h5diff_607.txt
@@ -1,2 +1,3 @@
dataset: </g1/dset3> and </g1/dset4>
6 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_608.txt b/tools/h5diff/testfiles/h5diff_608.txt
index 554f2ed..db14532 100644
--- a/tools/h5diff/testfiles/h5diff_608.txt
+++ b/tools/h5diff/testfiles/h5diff_608.txt
@@ -1,2 +1,3 @@
dataset: </g1/dset3> and </g1/dset4>
6 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_609.txt b/tools/h5diff/testfiles/h5diff_609.txt
index e69de29..eca5994 100644
--- a/tools/h5diff/testfiles/h5diff_609.txt
+++ b/tools/h5diff/testfiles/h5diff_609.txt
@@ -0,0 +1 @@
+EXIT CODE: 0
diff --git a/tools/h5diff/testfiles/h5diff_610.txt b/tools/h5diff/testfiles/h5diff_610.txt
index 554f2ed..db14532 100644
--- a/tools/h5diff/testfiles/h5diff_610.txt
+++ b/tools/h5diff/testfiles/h5diff_610.txt
@@ -1,2 +1,3 @@
dataset: </g1/dset3> and </g1/dset4>
6 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_612.txt b/tools/h5diff/testfiles/h5diff_612.txt
index 875e17e..686ff15 100644
--- a/tools/h5diff/testfiles/h5diff_612.txt
+++ b/tools/h5diff/testfiles/h5diff_612.txt
@@ -4,64 +4,99 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
file2 File name of the second HDF5 file
[obj1] Name of an HDF5 object, in absolute path
[obj2] Name of an HDF5 object, in absolute path
+
OPTIONS
- -h, --help Print a usage message and exit
- -V, --version Print version number and exit
- -r, --report Report mode. Print differences
- -v, --verbose Verbose mode. Print differences, list of objects
- -q, --quiet Quiet mode. Do not do output
- -l, --link-follow Follow link(s)
+ -h, --help Print a usage message and exit.
+ -V, --version Print version number and exit.
+ -r, --report Report mode. Print differences.
+ -v, --verbose Verbose mode. Print differences, list of objects.
+ -q, --quiet Quiet mode. Do not produce output.
+ --follow-links Follow symbolic links (soft links and external links)
+ and compare the links' target objects.
+ If symbolic link(s) with the same name exist in the
+ files being compared, then determine whether the
+ target of each link is an existing object (dataset,
+ group, or named datatype) or the link is a dangling
+ link (a soft or external link pointing to a target
+ object that does not yet exist).
+ - If both symbolic links are dangling links, they
+ are treated as being the same; by default, h5diff
+ returns an exit code of 0. If, however,
+ --no-dangling-links is used with --follow-links,
+ this situation is treated as an error and h5diff
+ returns an exit code of 2.
+ - If only one of the two links is a dangling link,
+ they are treated as being different and h5diff
+ returns an exit code of 1. If, however,
+ --no-dangling-links is used with --follow-links,
+ this situation is treated as an error and h5diff
+ returns an exit code of 2.
+ - If both symbolic links point to existing objects,
+ h5diff compares the two objects.
+ If any symbolic link specified in the call to h5diff
+ does not exist, h5diff treats it as an error and
+ returns an exit code of 2.
+ --no-dangling-links Must be used with --follow-links option;
+ otherwise, h5diff shows error message and returns
+ an exit code of 2.
+ Check for any symbolic links (soft links or external
+ links) that do not resolve to an existing object
+ (dataset, group, or named datatype). If any
+ dangling link is found, this situation is treated as
+ an error and h5diff returns an exit code of 2.
-c, --compare List objects that are not comparable
-N, --nan Avoid NaNs detection
- -n C, --count=C Print differences up to C number, C is a positive integer.
- -d D, --delta=D Print difference if (|a-b| > D), D is a positive number.
- -p R, --relative=R Print difference if (|(a-b)/b| > R), R is a positive number.
+ -n C, --count=C Print differences up to C number, C is a positive
+ integer.
+ -d D, --delta=D Print difference if (|a-b| > D), D is a positive
+ number.
+ -p R, --relative=R Print difference if (|(a-b)/b| > R), R is a positive
+ number.
--use-system-epsilon Print difference if (|a-b| > EPSILON),
- where EPSILON (FLT_EPSILON or FLT_EPSILON) is the system epsilon value.
- If the system epsilon is not defined, use the value below:
+ where EPSILON (FLT_EPSILON or FLT_EPSILON) is the
+ system epsilon value.
+ If the system epsilon is not defined, use the value
+ below:
FLT_EPSILON = 1.19209E-07 for float
DBL_EPSILON = 2.22045E-16 for double
- -d, -p, and --use-system-epsilon options are used for comparing floating point values.
- By default, strict equality is used. Use -p or -d to set specific tolerance.
+ -d, -p, and --use-system-epsilon options are used for
+ comparing floating point values.
+ By default, strict equality is used. Use -p or -d to
+ set specific tolerance.
Modes of output:
-
Default mode: print the number of differences found and where they occured
-r Report mode: print the above plus the differences
-v Verbose mode: print the above plus a list of objects and warnings
-q Quiet mode: do not print output
Compare criteria
-
- If no objects [obj1[obj2]] are specified, h5diff only compares objects
- with the same absolute path in both files
+ If no objects [obj1[obj2]] are specified, h5diff only compares objects
+ with the same absolute path in both files
The compare criteria is:
- 1) datasets: numerical array differences 2) groups: name string difference
- 3) datatypes: the return value of H5Tequal 4) links: name string difference
- of the linked value
+ 1) datasets: numerical array differences
+ 2) groups: name string difference
+ 3) datatypes: the return value of H5Tequal
+ 4) links: name string difference of the linked value as default
+ (refer to --follow-links option).
- Return exit code:
-
- 1 if differences found, 0 if no differences, 2 if error
+ Exit code:
+ 0 if no differences, 1 if differences found, 2 if error
Examples of use:
-
1) h5diff file1 file2 /g1/dset1 /g1/dset2
-
Compares object '/g1/dset1' in file1 with '/g1/dset2' in file2
2) h5diff file1 file2 /g1/dset1
-
Compares object '/g1/dset1' in both files
3) h5diff file1 file2
-
Compares all objects in both files
- Note) file1 and file2 can be the same file. Use
-
- h5diff file1 file1 /g1/dset1 /g1/dset2
-
- to compare '/g1/dset1' and '/g1/dset2' in the same file
+ Notes:
+ file1 and file2 can be the same file.
+ Use h5diff file1 file1 /g1/dset1 /g1/dset2 to compare
+ '/g1/dset1' and '/g1/dset2' in the same file
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_613.txt b/tools/h5diff/testfiles/h5diff_613.txt
index 554f2ed..db14532 100644
--- a/tools/h5diff/testfiles/h5diff_613.txt
+++ b/tools/h5diff/testfiles/h5diff_613.txt
@@ -1,2 +1,3 @@
dataset: </g1/dset3> and </g1/dset4>
6 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_614.txt b/tools/h5diff/testfiles/h5diff_614.txt
index 554f2ed..db14532 100644
--- a/tools/h5diff/testfiles/h5diff_614.txt
+++ b/tools/h5diff/testfiles/h5diff_614.txt
@@ -1,2 +1,3 @@
dataset: </g1/dset3> and </g1/dset4>
6 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_615.txt b/tools/h5diff/testfiles/h5diff_615.txt
index 258124a..cf779c5 100644
--- a/tools/h5diff/testfiles/h5diff_615.txt
+++ b/tools/h5diff/testfiles/h5diff_615.txt
@@ -4,64 +4,99 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
file2 File name of the second HDF5 file
[obj1] Name of an HDF5 object, in absolute path
[obj2] Name of an HDF5 object, in absolute path
+
OPTIONS
- -h, --help Print a usage message and exit
- -V, --version Print version number and exit
- -r, --report Report mode. Print differences
- -v, --verbose Verbose mode. Print differences, list of objects
- -q, --quiet Quiet mode. Do not do output
- -l, --link-follow Follow link(s)
+ -h, --help Print a usage message and exit.
+ -V, --version Print version number and exit.
+ -r, --report Report mode. Print differences.
+ -v, --verbose Verbose mode. Print differences, list of objects.
+ -q, --quiet Quiet mode. Do not produce output.
+ --follow-links Follow symbolic links (soft links and external links)
+ and compare the links' target objects.
+ If symbolic link(s) with the same name exist in the
+ files being compared, then determine whether the
+ target of each link is an existing object (dataset,
+ group, or named datatype) or the link is a dangling
+ link (a soft or external link pointing to a target
+ object that does not yet exist).
+ - If both symbolic links are dangling links, they
+ are treated as being the same; by default, h5diff
+ returns an exit code of 0. If, however,
+ --no-dangling-links is used with --follow-links,
+ this situation is treated as an error and h5diff
+ returns an exit code of 2.
+ - If only one of the two links is a dangling link,
+ they are treated as being different and h5diff
+ returns an exit code of 1. If, however,
+ --no-dangling-links is used with --follow-links,
+ this situation is treated as an error and h5diff
+ returns an exit code of 2.
+ - If both symbolic links point to existing objects,
+ h5diff compares the two objects.
+ If any symbolic link specified in the call to h5diff
+ does not exist, h5diff treats it as an error and
+ returns an exit code of 2.
+ --no-dangling-links Must be used with --follow-links option;
+ otherwise, h5diff shows error message and returns
+ an exit code of 2.
+ Check for any symbolic links (soft links or external
+ links) that do not resolve to an existing object
+ (dataset, group, or named datatype). If any
+ dangling link is found, this situation is treated as
+ an error and h5diff returns an exit code of 2.
-c, --compare List objects that are not comparable
-N, --nan Avoid NaNs detection
- -n C, --count=C Print differences up to C number, C is a positive integer.
- -d D, --delta=D Print difference if (|a-b| > D), D is a positive number.
- -p R, --relative=R Print difference if (|(a-b)/b| > R), R is a positive number.
+ -n C, --count=C Print differences up to C number, C is a positive
+ integer.
+ -d D, --delta=D Print difference if (|a-b| > D), D is a positive
+ number.
+ -p R, --relative=R Print difference if (|(a-b)/b| > R), R is a positive
+ number.
--use-system-epsilon Print difference if (|a-b| > EPSILON),
- where EPSILON (FLT_EPSILON or FLT_EPSILON) is the system epsilon value.
- If the system epsilon is not defined, use the value below:
+ where EPSILON (FLT_EPSILON or FLT_EPSILON) is the
+ system epsilon value.
+ If the system epsilon is not defined, use the value
+ below:
FLT_EPSILON = 1.19209E-07 for float
DBL_EPSILON = 2.22045E-16 for double
- -d, -p, and --use-system-epsilon options are used for comparing floating point values.
- By default, strict equality is used. Use -p or -d to set specific tolerance.
+ -d, -p, and --use-system-epsilon options are used for
+ comparing floating point values.
+ By default, strict equality is used. Use -p or -d to
+ set specific tolerance.
Modes of output:
-
Default mode: print the number of differences found and where they occured
-r Report mode: print the above plus the differences
-v Verbose mode: print the above plus a list of objects and warnings
-q Quiet mode: do not print output
Compare criteria
-
- If no objects [obj1[obj2]] are specified, h5diff only compares objects
- with the same absolute path in both files
+ If no objects [obj1[obj2]] are specified, h5diff only compares objects
+ with the same absolute path in both files
The compare criteria is:
- 1) datasets: numerical array differences 2) groups: name string difference
- 3) datatypes: the return value of H5Tequal 4) links: name string difference
- of the linked value
+ 1) datasets: numerical array differences
+ 2) groups: name string difference
+ 3) datatypes: the return value of H5Tequal
+ 4) links: name string difference of the linked value as default
+ (refer to --follow-links option).
- Return exit code:
-
- 1 if differences found, 0 if no differences, 2 if error
+ Exit code:
+ 0 if no differences, 1 if differences found, 2 if error
Examples of use:
-
1) h5diff file1 file2 /g1/dset1 /g1/dset2
-
Compares object '/g1/dset1' in file1 with '/g1/dset2' in file2
2) h5diff file1 file2 /g1/dset1
-
Compares object '/g1/dset1' in both files
3) h5diff file1 file2
-
Compares all objects in both files
- Note) file1 and file2 can be the same file. Use
-
- h5diff file1 file1 /g1/dset1 /g1/dset2
-
- to compare '/g1/dset1' and '/g1/dset2' in the same file
+ Notes:
+ file1 and file2 can be the same file.
+ Use h5diff file1 file1 /g1/dset1 /g1/dset2 to compare
+ '/g1/dset1' and '/g1/dset2' in the same file
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_616.txt b/tools/h5diff/testfiles/h5diff_616.txt
index 47a1364..3bc194a 100644
--- a/tools/h5diff/testfiles/h5diff_616.txt
+++ b/tools/h5diff/testfiles/h5diff_616.txt
@@ -1,2 +1,3 @@
dataset: </g1/dset3> and </g1/dset4>
2 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_617.txt b/tools/h5diff/testfiles/h5diff_617.txt
index 47a1364..3bc194a 100644
--- a/tools/h5diff/testfiles/h5diff_617.txt
+++ b/tools/h5diff/testfiles/h5diff_617.txt
@@ -1,2 +1,3 @@
dataset: </g1/dset3> and </g1/dset4>
2 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_618.txt b/tools/h5diff/testfiles/h5diff_618.txt
index e69de29..eca5994 100644
--- a/tools/h5diff/testfiles/h5diff_618.txt
+++ b/tools/h5diff/testfiles/h5diff_618.txt
@@ -0,0 +1 @@
+EXIT CODE: 0
diff --git a/tools/h5diff/testfiles/h5diff_619.txt b/tools/h5diff/testfiles/h5diff_619.txt
index 554f2ed..db14532 100644
--- a/tools/h5diff/testfiles/h5diff_619.txt
+++ b/tools/h5diff/testfiles/h5diff_619.txt
@@ -1,2 +1,3 @@
dataset: </g1/dset3> and </g1/dset4>
6 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_621.txt b/tools/h5diff/testfiles/h5diff_621.txt
index 1fd7f08..041bb7b 100644
--- a/tools/h5diff/testfiles/h5diff_621.txt
+++ b/tools/h5diff/testfiles/h5diff_621.txt
@@ -4,64 +4,99 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
file2 File name of the second HDF5 file
[obj1] Name of an HDF5 object, in absolute path
[obj2] Name of an HDF5 object, in absolute path
+
OPTIONS
- -h, --help Print a usage message and exit
- -V, --version Print version number and exit
- -r, --report Report mode. Print differences
- -v, --verbose Verbose mode. Print differences, list of objects
- -q, --quiet Quiet mode. Do not do output
- -l, --link-follow Follow link(s)
+ -h, --help Print a usage message and exit.
+ -V, --version Print version number and exit.
+ -r, --report Report mode. Print differences.
+ -v, --verbose Verbose mode. Print differences, list of objects.
+ -q, --quiet Quiet mode. Do not produce output.
+ --follow-links Follow symbolic links (soft links and external links)
+ and compare the links' target objects.
+ If symbolic link(s) with the same name exist in the
+ files being compared, then determine whether the
+ target of each link is an existing object (dataset,
+ group, or named datatype) or the link is a dangling
+ link (a soft or external link pointing to a target
+ object that does not yet exist).
+ - If both symbolic links are dangling links, they
+ are treated as being the same; by default, h5diff
+ returns an exit code of 0. If, however,
+ --no-dangling-links is used with --follow-links,
+ this situation is treated as an error and h5diff
+ returns an exit code of 2.
+ - If only one of the two links is a dangling link,
+ they are treated as being different and h5diff
+ returns an exit code of 1. If, however,
+ --no-dangling-links is used with --follow-links,
+ this situation is treated as an error and h5diff
+ returns an exit code of 2.
+ - If both symbolic links point to existing objects,
+ h5diff compares the two objects.
+ If any symbolic link specified in the call to h5diff
+ does not exist, h5diff treats it as an error and
+ returns an exit code of 2.
+ --no-dangling-links Must be used with --follow-links option;
+ otherwise, h5diff shows error message and returns
+ an exit code of 2.
+ Check for any symbolic links (soft links or external
+ links) that do not resolve to an existing object
+ (dataset, group, or named datatype). If any
+ dangling link is found, this situation is treated as
+ an error and h5diff returns an exit code of 2.
-c, --compare List objects that are not comparable
-N, --nan Avoid NaNs detection
- -n C, --count=C Print differences up to C number, C is a positive integer.
- -d D, --delta=D Print difference if (|a-b| > D), D is a positive number.
- -p R, --relative=R Print difference if (|(a-b)/b| > R), R is a positive number.
+ -n C, --count=C Print differences up to C number, C is a positive
+ integer.
+ -d D, --delta=D Print difference if (|a-b| > D), D is a positive
+ number.
+ -p R, --relative=R Print difference if (|(a-b)/b| > R), R is a positive
+ number.
--use-system-epsilon Print difference if (|a-b| > EPSILON),
- where EPSILON (FLT_EPSILON or FLT_EPSILON) is the system epsilon value.
- If the system epsilon is not defined, use the value below:
+ where EPSILON (FLT_EPSILON or FLT_EPSILON) is the
+ system epsilon value.
+ If the system epsilon is not defined, use the value
+ below:
FLT_EPSILON = 1.19209E-07 for float
DBL_EPSILON = 2.22045E-16 for double
- -d, -p, and --use-system-epsilon options are used for comparing floating point values.
- By default, strict equality is used. Use -p or -d to set specific tolerance.
+ -d, -p, and --use-system-epsilon options are used for
+ comparing floating point values.
+ By default, strict equality is used. Use -p or -d to
+ set specific tolerance.
Modes of output:
-
Default mode: print the number of differences found and where they occured
-r Report mode: print the above plus the differences
-v Verbose mode: print the above plus a list of objects and warnings
-q Quiet mode: do not print output
Compare criteria
-
- If no objects [obj1[obj2]] are specified, h5diff only compares objects
- with the same absolute path in both files
+ If no objects [obj1[obj2]] are specified, h5diff only compares objects
+ with the same absolute path in both files
The compare criteria is:
- 1) datasets: numerical array differences 2) groups: name string difference
- 3) datatypes: the return value of H5Tequal 4) links: name string difference
- of the linked value
+ 1) datasets: numerical array differences
+ 2) groups: name string difference
+ 3) datatypes: the return value of H5Tequal
+ 4) links: name string difference of the linked value as default
+ (refer to --follow-links option).
- Return exit code:
-
- 1 if differences found, 0 if no differences, 2 if error
+ Exit code:
+ 0 if no differences, 1 if differences found, 2 if error
Examples of use:
-
1) h5diff file1 file2 /g1/dset1 /g1/dset2
-
Compares object '/g1/dset1' in file1 with '/g1/dset2' in file2
2) h5diff file1 file2 /g1/dset1
-
Compares object '/g1/dset1' in both files
3) h5diff file1 file2
-
Compares all objects in both files
- Note) file1 and file2 can be the same file. Use
-
- h5diff file1 file1 /g1/dset1 /g1/dset2
-
- to compare '/g1/dset1' and '/g1/dset2' in the same file
+ Notes:
+ file1 and file2 can be the same file.
+ Use h5diff file1 file1 /g1/dset1 /g1/dset2 to compare
+ '/g1/dset1' and '/g1/dset2' in the same file
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_622.txt b/tools/h5diff/testfiles/h5diff_622.txt
index bf15c2a..923bab5 100644
--- a/tools/h5diff/testfiles/h5diff_622.txt
+++ b/tools/h5diff/testfiles/h5diff_622.txt
@@ -4,64 +4,99 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
file2 File name of the second HDF5 file
[obj1] Name of an HDF5 object, in absolute path
[obj2] Name of an HDF5 object, in absolute path
+
OPTIONS
- -h, --help Print a usage message and exit
- -V, --version Print version number and exit
- -r, --report Report mode. Print differences
- -v, --verbose Verbose mode. Print differences, list of objects
- -q, --quiet Quiet mode. Do not do output
- -l, --link-follow Follow link(s)
+ -h, --help Print a usage message and exit.
+ -V, --version Print version number and exit.
+ -r, --report Report mode. Print differences.
+ -v, --verbose Verbose mode. Print differences, list of objects.
+ -q, --quiet Quiet mode. Do not produce output.
+ --follow-links Follow symbolic links (soft links and external links)
+ and compare the links' target objects.
+ If symbolic link(s) with the same name exist in the
+ files being compared, then determine whether the
+ target of each link is an existing object (dataset,
+ group, or named datatype) or the link is a dangling
+ link (a soft or external link pointing to a target
+ object that does not yet exist).
+ - If both symbolic links are dangling links, they
+ are treated as being the same; by default, h5diff
+ returns an exit code of 0. If, however,
+ --no-dangling-links is used with --follow-links,
+ this situation is treated as an error and h5diff
+ returns an exit code of 2.
+ - If only one of the two links is a dangling link,
+ they are treated as being different and h5diff
+ returns an exit code of 1. If, however,
+ --no-dangling-links is used with --follow-links,
+ this situation is treated as an error and h5diff
+ returns an exit code of 2.
+ - If both symbolic links point to existing objects,
+ h5diff compares the two objects.
+ If any symbolic link specified in the call to h5diff
+ does not exist, h5diff treats it as an error and
+ returns an exit code of 2.
+ --no-dangling-links Must be used with --follow-links option;
+ otherwise, h5diff shows error message and returns
+ an exit code of 2.
+ Check for any symbolic links (soft links or external
+ links) that do not resolve to an existing object
+ (dataset, group, or named datatype). If any
+ dangling link is found, this situation is treated as
+ an error and h5diff returns an exit code of 2.
-c, --compare List objects that are not comparable
-N, --nan Avoid NaNs detection
- -n C, --count=C Print differences up to C number, C is a positive integer.
- -d D, --delta=D Print difference if (|a-b| > D), D is a positive number.
- -p R, --relative=R Print difference if (|(a-b)/b| > R), R is a positive number.
+ -n C, --count=C Print differences up to C number, C is a positive
+ integer.
+ -d D, --delta=D Print difference if (|a-b| > D), D is a positive
+ number.
+ -p R, --relative=R Print difference if (|(a-b)/b| > R), R is a positive
+ number.
--use-system-epsilon Print difference if (|a-b| > EPSILON),
- where EPSILON (FLT_EPSILON or FLT_EPSILON) is the system epsilon value.
- If the system epsilon is not defined, use the value below:
+ where EPSILON (FLT_EPSILON or FLT_EPSILON) is the
+ system epsilon value.
+ If the system epsilon is not defined, use the value
+ below:
FLT_EPSILON = 1.19209E-07 for float
DBL_EPSILON = 2.22045E-16 for double
- -d, -p, and --use-system-epsilon options are used for comparing floating point values.
- By default, strict equality is used. Use -p or -d to set specific tolerance.
+ -d, -p, and --use-system-epsilon options are used for
+ comparing floating point values.
+ By default, strict equality is used. Use -p or -d to
+ set specific tolerance.
Modes of output:
-
Default mode: print the number of differences found and where they occured
-r Report mode: print the above plus the differences
-v Verbose mode: print the above plus a list of objects and warnings
-q Quiet mode: do not print output
Compare criteria
-
- If no objects [obj1[obj2]] are specified, h5diff only compares objects
- with the same absolute path in both files
+ If no objects [obj1[obj2]] are specified, h5diff only compares objects
+ with the same absolute path in both files
The compare criteria is:
- 1) datasets: numerical array differences 2) groups: name string difference
- 3) datatypes: the return value of H5Tequal 4) links: name string difference
- of the linked value
+ 1) datasets: numerical array differences
+ 2) groups: name string difference
+ 3) datatypes: the return value of H5Tequal
+ 4) links: name string difference of the linked value as default
+ (refer to --follow-links option).
- Return exit code:
-
- 1 if differences found, 0 if no differences, 2 if error
+ Exit code:
+ 0 if no differences, 1 if differences found, 2 if error
Examples of use:
-
1) h5diff file1 file2 /g1/dset1 /g1/dset2
-
Compares object '/g1/dset1' in file1 with '/g1/dset2' in file2
2) h5diff file1 file2 /g1/dset1
-
Compares object '/g1/dset1' in both files
3) h5diff file1 file2
-
Compares all objects in both files
- Note) file1 and file2 can be the same file. Use
-
- h5diff file1 file1 /g1/dset1 /g1/dset2
-
- to compare '/g1/dset1' and '/g1/dset2' in the same file
+ Notes:
+ file1 and file2 can be the same file.
+ Use h5diff file1 file1 /g1/dset1 /g1/dset2 to compare
+ '/g1/dset1' and '/g1/dset2' in the same file
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_623.txt b/tools/h5diff/testfiles/h5diff_623.txt
index 5186dcc..405a211 100644
--- a/tools/h5diff/testfiles/h5diff_623.txt
+++ b/tools/h5diff/testfiles/h5diff_623.txt
@@ -4,64 +4,99 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
file2 File name of the second HDF5 file
[obj1] Name of an HDF5 object, in absolute path
[obj2] Name of an HDF5 object, in absolute path
+
OPTIONS
- -h, --help Print a usage message and exit
- -V, --version Print version number and exit
- -r, --report Report mode. Print differences
- -v, --verbose Verbose mode. Print differences, list of objects
- -q, --quiet Quiet mode. Do not do output
- -l, --link-follow Follow link(s)
+ -h, --help Print a usage message and exit.
+ -V, --version Print version number and exit.
+ -r, --report Report mode. Print differences.
+ -v, --verbose Verbose mode. Print differences, list of objects.
+ -q, --quiet Quiet mode. Do not produce output.
+ --follow-links Follow symbolic links (soft links and external links)
+ and compare the links' target objects.
+ If symbolic link(s) with the same name exist in the
+ files being compared, then determine whether the
+ target of each link is an existing object (dataset,
+ group, or named datatype) or the link is a dangling
+ link (a soft or external link pointing to a target
+ object that does not yet exist).
+ - If both symbolic links are dangling links, they
+ are treated as being the same; by default, h5diff
+ returns an exit code of 0. If, however,
+ --no-dangling-links is used with --follow-links,
+ this situation is treated as an error and h5diff
+ returns an exit code of 2.
+ - If only one of the two links is a dangling link,
+ they are treated as being different and h5diff
+ returns an exit code of 1. If, however,
+ --no-dangling-links is used with --follow-links,
+ this situation is treated as an error and h5diff
+ returns an exit code of 2.
+ - If both symbolic links point to existing objects,
+ h5diff compares the two objects.
+ If any symbolic link specified in the call to h5diff
+ does not exist, h5diff treats it as an error and
+ returns an exit code of 2.
+ --no-dangling-links Must be used with --follow-links option;
+ otherwise, h5diff shows error message and returns
+ an exit code of 2.
+ Check for any symbolic links (soft links or external
+ links) that do not resolve to an existing object
+ (dataset, group, or named datatype). If any
+ dangling link is found, this situation is treated as
+ an error and h5diff returns an exit code of 2.
-c, --compare List objects that are not comparable
-N, --nan Avoid NaNs detection
- -n C, --count=C Print differences up to C number, C is a positive integer.
- -d D, --delta=D Print difference if (|a-b| > D), D is a positive number.
- -p R, --relative=R Print difference if (|(a-b)/b| > R), R is a positive number.
+ -n C, --count=C Print differences up to C number, C is a positive
+ integer.
+ -d D, --delta=D Print difference if (|a-b| > D), D is a positive
+ number.
+ -p R, --relative=R Print difference if (|(a-b)/b| > R), R is a positive
+ number.
--use-system-epsilon Print difference if (|a-b| > EPSILON),
- where EPSILON (FLT_EPSILON or FLT_EPSILON) is the system epsilon value.
- If the system epsilon is not defined, use the value below:
+ where EPSILON (FLT_EPSILON or FLT_EPSILON) is the
+ system epsilon value.
+ If the system epsilon is not defined, use the value
+ below:
FLT_EPSILON = 1.19209E-07 for float
DBL_EPSILON = 2.22045E-16 for double
- -d, -p, and --use-system-epsilon options are used for comparing floating point values.
- By default, strict equality is used. Use -p or -d to set specific tolerance.
+ -d, -p, and --use-system-epsilon options are used for
+ comparing floating point values.
+ By default, strict equality is used. Use -p or -d to
+ set specific tolerance.
Modes of output:
-
Default mode: print the number of differences found and where they occured
-r Report mode: print the above plus the differences
-v Verbose mode: print the above plus a list of objects and warnings
-q Quiet mode: do not print output
Compare criteria
-
- If no objects [obj1[obj2]] are specified, h5diff only compares objects
- with the same absolute path in both files
+ If no objects [obj1[obj2]] are specified, h5diff only compares objects
+ with the same absolute path in both files
The compare criteria is:
- 1) datasets: numerical array differences 2) groups: name string difference
- 3) datatypes: the return value of H5Tequal 4) links: name string difference
- of the linked value
+ 1) datasets: numerical array differences
+ 2) groups: name string difference
+ 3) datatypes: the return value of H5Tequal
+ 4) links: name string difference of the linked value as default
+ (refer to --follow-links option).
- Return exit code:
-
- 1 if differences found, 0 if no differences, 2 if error
+ Exit code:
+ 0 if no differences, 1 if differences found, 2 if error
Examples of use:
-
1) h5diff file1 file2 /g1/dset1 /g1/dset2
-
Compares object '/g1/dset1' in file1 with '/g1/dset2' in file2
2) h5diff file1 file2 /g1/dset1
-
Compares object '/g1/dset1' in both files
3) h5diff file1 file2
-
Compares all objects in both files
- Note) file1 and file2 can be the same file. Use
-
- h5diff file1 file1 /g1/dset1 /g1/dset2
-
- to compare '/g1/dset1' and '/g1/dset2' in the same file
+ Notes:
+ file1 and file2 can be the same file.
+ Use h5diff file1 file1 /g1/dset1 /g1/dset2 to compare
+ '/g1/dset1' and '/g1/dset2' in the same file
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_624.txt b/tools/h5diff/testfiles/h5diff_624.txt
index d646a25..dc7c83b 100644
--- a/tools/h5diff/testfiles/h5diff_624.txt
+++ b/tools/h5diff/testfiles/h5diff_624.txt
@@ -4,64 +4,99 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
file2 File name of the second HDF5 file
[obj1] Name of an HDF5 object, in absolute path
[obj2] Name of an HDF5 object, in absolute path
+
OPTIONS
- -h, --help Print a usage message and exit
- -V, --version Print version number and exit
- -r, --report Report mode. Print differences
- -v, --verbose Verbose mode. Print differences, list of objects
- -q, --quiet Quiet mode. Do not do output
- -l, --link-follow Follow link(s)
+ -h, --help Print a usage message and exit.
+ -V, --version Print version number and exit.
+ -r, --report Report mode. Print differences.
+ -v, --verbose Verbose mode. Print differences, list of objects.
+ -q, --quiet Quiet mode. Do not produce output.
+ --follow-links Follow symbolic links (soft links and external links)
+ and compare the links' target objects.
+ If symbolic link(s) with the same name exist in the
+ files being compared, then determine whether the
+ target of each link is an existing object (dataset,
+ group, or named datatype) or the link is a dangling
+ link (a soft or external link pointing to a target
+ object that does not yet exist).
+ - If both symbolic links are dangling links, they
+ are treated as being the same; by default, h5diff
+ returns an exit code of 0. If, however,
+ --no-dangling-links is used with --follow-links,
+ this situation is treated as an error and h5diff
+ returns an exit code of 2.
+ - If only one of the two links is a dangling link,
+ they are treated as being different and h5diff
+ returns an exit code of 1. If, however,
+ --no-dangling-links is used with --follow-links,
+ this situation is treated as an error and h5diff
+ returns an exit code of 2.
+ - If both symbolic links point to existing objects,
+ h5diff compares the two objects.
+ If any symbolic link specified in the call to h5diff
+ does not exist, h5diff treats it as an error and
+ returns an exit code of 2.
+ --no-dangling-links Must be used with --follow-links option;
+ otherwise, h5diff shows error message and returns
+ an exit code of 2.
+ Check for any symbolic links (soft links or external
+ links) that do not resolve to an existing object
+ (dataset, group, or named datatype). If any
+ dangling link is found, this situation is treated as
+ an error and h5diff returns an exit code of 2.
-c, --compare List objects that are not comparable
-N, --nan Avoid NaNs detection
- -n C, --count=C Print differences up to C number, C is a positive integer.
- -d D, --delta=D Print difference if (|a-b| > D), D is a positive number.
- -p R, --relative=R Print difference if (|(a-b)/b| > R), R is a positive number.
+ -n C, --count=C Print differences up to C number, C is a positive
+ integer.
+ -d D, --delta=D Print difference if (|a-b| > D), D is a positive
+ number.
+ -p R, --relative=R Print difference if (|(a-b)/b| > R), R is a positive
+ number.
--use-system-epsilon Print difference if (|a-b| > EPSILON),
- where EPSILON (FLT_EPSILON or FLT_EPSILON) is the system epsilon value.
- If the system epsilon is not defined, use the value below:
+ where EPSILON (FLT_EPSILON or FLT_EPSILON) is the
+ system epsilon value.
+ If the system epsilon is not defined, use the value
+ below:
FLT_EPSILON = 1.19209E-07 for float
DBL_EPSILON = 2.22045E-16 for double
- -d, -p, and --use-system-epsilon options are used for comparing floating point values.
- By default, strict equality is used. Use -p or -d to set specific tolerance.
+ -d, -p, and --use-system-epsilon options are used for
+ comparing floating point values.
+ By default, strict equality is used. Use -p or -d to
+ set specific tolerance.
Modes of output:
-
Default mode: print the number of differences found and where they occured
-r Report mode: print the above plus the differences
-v Verbose mode: print the above plus a list of objects and warnings
-q Quiet mode: do not print output
Compare criteria
-
- If no objects [obj1[obj2]] are specified, h5diff only compares objects
- with the same absolute path in both files
+ If no objects [obj1[obj2]] are specified, h5diff only compares objects
+ with the same absolute path in both files
The compare criteria is:
- 1) datasets: numerical array differences 2) groups: name string difference
- 3) datatypes: the return value of H5Tequal 4) links: name string difference
- of the linked value
+ 1) datasets: numerical array differences
+ 2) groups: name string difference
+ 3) datatypes: the return value of H5Tequal
+ 4) links: name string difference of the linked value as default
+ (refer to --follow-links option).
- Return exit code:
-
- 1 if differences found, 0 if no differences, 2 if error
+ Exit code:
+ 0 if no differences, 1 if differences found, 2 if error
Examples of use:
-
1) h5diff file1 file2 /g1/dset1 /g1/dset2
-
Compares object '/g1/dset1' in file1 with '/g1/dset2' in file2
2) h5diff file1 file2 /g1/dset1
-
Compares object '/g1/dset1' in both files
3) h5diff file1 file2
-
Compares all objects in both files
- Note) file1 and file2 can be the same file. Use
-
- h5diff file1 file1 /g1/dset1 /g1/dset2
-
- to compare '/g1/dset1' and '/g1/dset2' in the same file
+ Notes:
+ file1 and file2 can be the same file.
+ Use h5diff file1 file1 /g1/dset1 /g1/dset2 to compare
+ '/g1/dset1' and '/g1/dset2' in the same file
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_625.txt b/tools/h5diff/testfiles/h5diff_625.txt
index 47a1364..3bc194a 100644
--- a/tools/h5diff/testfiles/h5diff_625.txt
+++ b/tools/h5diff/testfiles/h5diff_625.txt
@@ -1,2 +1,3 @@
dataset: </g1/dset3> and </g1/dset4>
2 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_626.txt b/tools/h5diff/testfiles/h5diff_626.txt
index be392ae..6494066 100644
--- a/tools/h5diff/testfiles/h5diff_626.txt
+++ b/tools/h5diff/testfiles/h5diff_626.txt
@@ -1,2 +1,3 @@
dataset: </g1/dset3> and </g1/dset4>
3 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_627.txt b/tools/h5diff/testfiles/h5diff_627.txt
index 554f2ed..db14532 100644
--- a/tools/h5diff/testfiles/h5diff_627.txt
+++ b/tools/h5diff/testfiles/h5diff_627.txt
@@ -1,2 +1,3 @@
dataset: </g1/dset3> and </g1/dset4>
6 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_628.txt b/tools/h5diff/testfiles/h5diff_628.txt
index 74decda..e11d8ee 100644
--- a/tools/h5diff/testfiles/h5diff_628.txt
+++ b/tools/h5diff/testfiles/h5diff_628.txt
@@ -1,2 +1,3 @@
dataset: </g1/dset3> and </g1/dset4>
1 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_629.txt b/tools/h5diff/testfiles/h5diff_629.txt
index 4e67f57..962c2b0 100644
--- a/tools/h5diff/testfiles/h5diff_629.txt
+++ b/tools/h5diff/testfiles/h5diff_629.txt
@@ -1 +1,2 @@
h5diff: <file1.h6>: unable to open file
+EXIT CODE: 2
diff --git a/tools/h5diff/testfiles/h5diff_70.txt b/tools/h5diff/testfiles/h5diff_70.txt
index 30dbefe..7abcddd 100644
--- a/tools/h5diff/testfiles/h5diff_70.txt
+++ b/tools/h5diff/testfiles/h5diff_70.txt
@@ -2029,3 +2029,4 @@ position float3D of </g1> float3D of </g1> difference
Some objects are not comparable
--------------------------------
Use -c for a list of objects.
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_80.txt b/tools/h5diff/testfiles/h5diff_80.txt
index 33090df..1c55b1a 100644
--- a/tools/h5diff/testfiles/h5diff_80.txt
+++ b/tools/h5diff/testfiles/h5diff_80.txt
@@ -878,3 +878,4 @@ point #4 (2,8) (1,7)
Some objects are not comparable
--------------------------------
Use -c for a list of objects.
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_90.txt b/tools/h5diff/testfiles/h5diff_90.txt
index e6bfa14..fb23843 100644
--- a/tools/h5diff/testfiles/h5diff_90.txt
+++ b/tools/h5diff/testfiles/h5diff_90.txt
@@ -53,3 +53,4 @@ Not comparable: </g2/dset9> or </g2/dset9> is an empty dataset
Some objects are not comparable
--------------------------------
Use -c for a list of objects.
+EXIT CODE: 0
diff --git a/tools/h5diff/testfiles/h5diff_danglelinks1.h5 b/tools/h5diff/testfiles/h5diff_danglelinks1.h5
new file mode 100644
index 0000000..8cbaac1
--- /dev/null
+++ b/tools/h5diff/testfiles/h5diff_danglelinks1.h5
Binary files differ
diff --git a/tools/h5diff/testfiles/h5diff_danglelinks2.h5 b/tools/h5diff/testfiles/h5diff_danglelinks2.h5
new file mode 100644
index 0000000..f634210
--- /dev/null
+++ b/tools/h5diff/testfiles/h5diff_danglelinks2.h5
Binary files differ
diff --git a/tools/h5diff/testfiles/h5diff_idx.txt b/tools/h5diff/testfiles/h5diff_idx.txt
index 4169afb..754d3ea 100644
--- a/tools/h5diff/testfiles/h5diff_idx.txt
+++ b/tools/h5diff/testfiles/h5diff_idx.txt
@@ -11,3 +11,4 @@ dataset: </dset> and </dset>
0 differences found
dataset: </dset_filter> and </dset_filter>
0 differences found
+EXIT CODE: 0
diff --git a/tools/h5diff/testh5diff.sh b/tools/h5diff/testh5diff.sh
index 247e3e1..1ed6f88 100755
--- a/tools/h5diff/testh5diff.sh
+++ b/tools/h5diff/testh5diff.sh
@@ -23,6 +23,11 @@
# Pedro Vicente Nunes:
# 10/25/2005: Added test #9
# 11/27/2006: Added test #10, #11
+# Jonathan Kim:
+# Improved to use single line
+# Improved to check exit code (only serial mode, not necessary for parallel)
+# Added test 400 - 425 (links with --follow-links option)
+# Added test 450 - 459 (dangling links)
###############################################################################
@@ -49,6 +54,8 @@ FILE17=h5diff_ext2softlink_src.h5
FILE18=h5diff_ext2softlink_trg.h5
FILE19=h5diff_dset_idx1.h5
FILE20=h5diff_dset_idx2.h5
+DANGLE_LINK_FILE1=h5diff_danglelinks1.h5
+DANGLE_LINK_FILE2=h5diff_danglelinks2.h5
TESTNAME=h5diff
EXIT_SUCCESS=0
@@ -194,9 +201,9 @@ TOOLTEST() {
actual_err_sav=${actual_err}-sav
shift
if test -n "$pmode"; then
- RUNCMD=$RUNPARALLEL
+ RUNCMD=$RUNPARALLEL
else
- RUNCMD=$RUNSERIAL
+ RUNCMD=$RUNSERIAL
fi
# Run test.
@@ -208,32 +215,44 @@ TOOLTEST() {
cd $srcdir/testfiles
eval $RUNCMD $H5DIFF_BIN "$@"
) >$actual 2>$actual_err
+ EXIT_CODE=$?
# save actual and actual_err in case they are needed later.
cp $actual $actual_sav
STDOUT_FILTER $actual
cp $actual_err $actual_err_sav
STDERR_FILTER $actual_err
cat $actual_err >> $actual
+ # don't add exit code check in pmode, as it causes failure. (exit code
+ # is from mpirun not tool)
+ # if any problem occurs relate to an exit code, it will be caught in
+ # serial mode, so the test is fullfilled.
+ if test -z "$pmode"; then
+ echo "EXIT CODE: $EXIT_CODE" >> $actual
+ fi
if [ ! -f $expect ]; then
- # Create the expect file if it doesn't yet exist.
+ # Create the expect file if it doesn't yet exist.
echo " CREATED"
- cp $actual $expect
+ cp $actual $expect
elif $CMP $expect $actual; then
- echo " PASSED"
+ echo " PASSED"
elif test -z "$pmode"; then
- echo "*FAILED*"
- echo " Expected result ($expect) differs from actual result ($actual)"
- nerrors="`expr $nerrors + 1`"
- test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /'
+ echo "*FAILED*"
+ echo " Expected result ($expect) differs from actual result ($actual)"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /'
else
- # parallel mode output are often of different ordering from serial
- # output. If the sorted expected and actual files compare the same,
- # it is safe to assume the actual output match the expected file.
- expect_sorted=expect_sorted
- actual_sorted=actual_sorted
- sort $expect -o $expect_sorted
- sort $actual -o $actual_sorted
+ # parallel mode output are often of different ordering from serial
+ # output. If the sorted expected and actual files compare the same,
+ # it is safe to assume the actual output match the expected file.
+ expect_sorted=expect_sorted
+ actual_sorted=actual_sorted
+ sort $expect -o $expect_sorted
+ sort $actual -o $actual_sorted
+ # remove "EXIT CODE:" line from expect file. test for exit code
+ # is done by serial mode.
+ grep -v "EXIT CODE:" $expect_sorted > $expect_sorted.noexit
+ mv $expect_sorted.noexit $expect_sorted
if $CMP $expect_sorted $actual_sorted; then
echo " PASSED"
else
@@ -267,6 +286,7 @@ SKIP() {
}
+
##############################################################################
# The tests
# To avoid the printing of the complete full path of the test file, that hides
@@ -310,15 +330,17 @@ TOOLTEST h5diff_16_3.txt -v -p 0.02 $FILE1 $FILE1 g1/dset9 g1/dset10
# 1.7 verbose mode
TOOLTEST h5diff_17.txt -v $FILE1 $FILE2
-# 1.8 test 32-bit INFINITY
+# 1.7 test 32-bit INFINITY
TOOLTEST h5diff_171.txt -v $FILE1 $FILE1 /g1/fp19
-# 1.8 test 64-bit INFINITY
+# 1.7 test 64-bit INFINITY
TOOLTEST h5diff_172.txt -v $FILE1 $FILE1 /g1/fp20
# 1.8 quiet mode
TOOLTEST h5diff_18.txt -q $FILE1 $FILE2
+# 1.8 -v and -q
+TOOLTEST h5diff_18_1.txt -v -q $FILE1 $FILE2
# ##############################################################################
@@ -538,133 +560,91 @@ TOOLTEST h5diff_206.txt -c $FILE2 $FILE2 g2/dset7 g2/dset8
TOOLTEST h5diff_207.txt -c $FILE2 $FILE2 g2/dset8 g2/dset9
# ##############################################################################
-# # Links compare without -l (link follow)
+# # Links compare without --follow-links nor --no-dangling-links
# ##############################################################################
# test for bug1749
TOOLTEST h5diff_300.txt -v $FILE12 $FILE12 /link_g1 /link_g2
# ##############################################################################
-# # Links compare with -l (link follow)
+# # Links compare with --follow-links Only
# ##############################################################################
# soft links file to file
-TOOLTEST h5diff_400.txt -l -v $FILE13 $FILE13
+TOOLTEST h5diff_400.txt --follow-links -v $FILE13 $FILE13
# softlink vs dset"
-TOOLTEST h5diff_401.txt -l -v $FILE13 $FILE13 /softlink_dset1_1 /target_dset2
-
+TOOLTEST h5diff_401.txt --follow-links -v $FILE13 $FILE13 /softlink_dset1_1 /target_dset2
# dset vs softlink"
-TOOLTEST h5diff_402.txt -l -v $FILE13 $FILE13 /target_dset2 /softlink_dset1_1
-
+TOOLTEST h5diff_402.txt --follow-links -v $FILE13 $FILE13 /target_dset2 /softlink_dset1_1
# softlink vs softlink"
-TOOLTEST h5diff_403.txt -l -v $FILE13 $FILE13 /softlink_dset1_1 /softlink_dset2
-
+TOOLTEST h5diff_403.txt --follow-links -v $FILE13 $FILE13 /softlink_dset1_1 /softlink_dset2
# extlink vs extlink (FILE)"
-if test -n "$pmode"; then
- # TODO: Skip below test due to hang in prarllel mode
- echo "Skip below test due to hang in prarllel mode"
- SKIP -l -v $FILE15 $FILE15
-else
- TOOLTEST h5diff_404.txt -l -v $FILE15 $FILE15
-fi
-
+TOOLTEST h5diff_404.txt --follow-links -v $FILE15 $FILE15
# extlink vs dset"
-TOOLTEST h5diff_405.txt -l -v $FILE15 $FILE16 /ext_link_dset1 /target_group2/x_dset
-
+TOOLTEST h5diff_405.txt --follow-links -v $FILE15 $FILE16 /ext_link_dset1 /target_group2/x_dset
# dset vs extlink"
-TOOLTEST h5diff_406.txt -l -v $FILE16 $FILE15 /target_group2/x_dset /ext_link_dset1
-
+TOOLTEST h5diff_406.txt --follow-links -v $FILE16 $FILE15 /target_group2/x_dset /ext_link_dset1
# extlink vs extlink"
-TOOLTEST h5diff_407.txt -l -v $FILE15 $FILE15 /ext_link_dset1 /ext_link_dset2
-
+TOOLTEST h5diff_407.txt --follow-links -v $FILE15 $FILE15 /ext_link_dset1 /ext_link_dset2
# softlink vs extlink"
-TOOLTEST h5diff_408.txt -l -v $FILE13 $FILE15 /softlink_dset1_1 /ext_link_dset2
-
+TOOLTEST h5diff_408.txt --follow-links -v $FILE13 $FILE15 /softlink_dset1_1 /ext_link_dset2
# extlink vs softlink "
-TOOLTEST h5diff_409.txt -l -v $FILE15 $FILE13 /ext_link_dset2 /softlink_dset1_1
-
+TOOLTEST h5diff_409.txt --follow-links -v $FILE15 $FILE13 /ext_link_dset2 /softlink_dset1_1
# linked_softlink vs linked_softlink (FILE)"
-TOOLTEST h5diff_410.txt -l -v $FILE14 $FILE14
-
+TOOLTEST h5diff_410.txt --follow-links -v $FILE14 $FILE14
# dset2 vs linked_softlink_dset1"
-TOOLTEST h5diff_411.txt -l -v $FILE14 $FILE14 /target_dset2 /softlink1_to_slink2
-
+TOOLTEST h5diff_411.txt --follow-links -v $FILE14 $FILE14 /target_dset2 /softlink1_to_slink2
# linked_softlink_dset1 vs dset2"
-TOOLTEST h5diff_412.txt -l -v $FILE14 $FILE14 /softlink1_to_slink2 /target_dset2
-
+TOOLTEST h5diff_412.txt --follow-links -v $FILE14 $FILE14 /softlink1_to_slink2 /target_dset2
# linked_softlink_to_dset1 vs linked_softlink_to_dset2"
-TOOLTEST h5diff_413.txt -l -v $FILE14 $FILE14 /softlink1_to_slink2 /softlink2_to_slink2
-
+TOOLTEST h5diff_413.txt --follow-links -v $FILE14 $FILE14 /softlink1_to_slink2 /softlink2_to_slink2
# group vs linked_softlink_group1"
-TOOLTEST h5diff_414.txt -l -v $FILE14 $FILE14 /target_group /softlink3_to_slink2
-
+TOOLTEST h5diff_414.txt --follow-links -v $FILE14 $FILE14 /target_group /softlink3_to_slink2
# linked_softlink_group1 vs group"
-TOOLTEST h5diff_415.txt -l -v $FILE14 $FILE14 /softlink3_to_slink2 /target_group
-
+TOOLTEST h5diff_415.txt --follow-links -v $FILE14 $FILE14 /softlink3_to_slink2 /target_group
# linked_softlink_to_group1 vs linked_softlink_to_group2"
-TOOLTEST h5diff_416.txt -l -v $FILE14 $FILE14 /softlink3_to_slink2 /softlink4_to_slink2
-
+TOOLTEST h5diff_416.txt --follow-links -v $FILE14 $FILE14 /softlink3_to_slink2 /softlink4_to_slink2
# non-exist-softlink vs softlink"
-TOOLTEST h5diff_417.txt -l -v $FILE13 $FILE13 /softlink_noexist /softlink_dset2
-
+TOOLTEST h5diff_417.txt --follow-links -v $FILE13 $FILE13 /softlink_noexist /softlink_dset2
# softlink vs non-exist-softlink"
-TOOLTEST h5diff_418.txt -l -v $FILE13 $FILE13 /softlink_dset2 /softlink_noexist
-
+TOOLTEST h5diff_418.txt --follow-links -v $FILE13 $FILE13 /softlink_dset2 /softlink_noexist
# non-exist-extlink_file vs extlink"
-if test -n "$pmode"; then
- # TODO: Skip below test due to hang in prarllel mode
- echo "Skip below test due to hang in prarllel mode"
- SKIP -l -v $FILE15 $FILE15 /ext_link_noexist2 /ext_link_dset2
-else
- TOOLTEST h5diff_419.txt -l -v $FILE15 $FILE15 /ext_link_noexist2 /ext_link_dset2
-fi
-
+TOOLTEST h5diff_419.txt --follow-links -v $FILE15 $FILE15 /ext_link_noexist2 /ext_link_dset2
# exlink vs non-exist-extlink_file"
-if test -n "$pmode"; then
- # TODO: Skip below test due to hang in prarllel mode
- echo "Skip below test due to hang in prarllel mode"
- SKIP -l -v $FILE15 $FILE15 /ext_link_dset2 /ext_link_noexist2
-else
- TOOLTEST h5diff_420.txt -l -v $FILE15 $FILE15 /ext_link_dset2 /ext_link_noexist2
-fi
-
+TOOLTEST h5diff_420.txt --follow-links -v $FILE15 $FILE15 /ext_link_dset2 /ext_link_noexist2
# extlink vs non-exist-extlink_obj"
-TOOLTEST h5diff_421.txt -l -v $FILE15 $FILE15 /ext_link_dset2 /ext_link_noexist1
-
+TOOLTEST h5diff_421.txt --follow-links -v $FILE15 $FILE15 /ext_link_dset2 /ext_link_noexist1
# non-exist-extlink_obj vs extlink"
-TOOLTEST h5diff_422.txt -l -v $FILE15 $FILE15 /ext_link_noexist1 /ext_link_dset2
-
+TOOLTEST h5diff_422.txt --follow-links -v $FILE15 $FILE15 /ext_link_noexist1 /ext_link_dset2
# extlink_to_softlink_to_dset1 vs dset2"
-TOOLTEST h5diff_423.txt -l -v $FILE17 $FILE18 /ext_link_to_slink1 /dset2
-
+TOOLTEST h5diff_423.txt --follow-links -v $FILE17 $FILE18 /ext_link_to_slink1 /dset2
# dset2 vs extlink_to_softlink_to_dset1"
-TOOLTEST h5diff_424.txt -l -v $FILE18 $FILE17 /dset2 /ext_link_to_slink1
-
+TOOLTEST h5diff_424.txt --follow-links -v $FILE18 $FILE17 /dset2 /ext_link_to_slink1
# extlink_to_softlink_to_dset1 vs extlink_to_softlink_to_dset2"
-TOOLTEST h5diff_425.txt -l -v $FILE17 $FILE17 /ext_link_to_slink1 /ext_link_to_slink2
+TOOLTEST h5diff_425.txt --follow-links -v $FILE17 $FILE17 /ext_link_to_slink1 /ext_link_to_slink2
# ##############################################################################
# 19. The comparision for the two datasets between the 2 files should be the same
@@ -673,6 +653,39 @@ TOOLTEST h5diff_425.txt -l -v $FILE17 $FILE17 /ext_link_to_slink1 /ext_link_to_s
# ##############################################################################
TOOLTEST h5diff_idx.txt -v $FILE19 $FILE20
+# ##############################################################################
+# # Dangling links compare (--follow-links and --no-dangling-links)
+# ##############################################################################
+# dangling links --follow-links (FILE to FILE)
+TOOLTEST h5diff_450.txt --follow-links -v $DANGLE_LINK_FILE1 $DANGLE_LINK_FILE2
+
+# dangling links --follow-links and --no-dangling-links (FILE to FILE)
+TOOLTEST h5diff_451.txt --follow-links -v --no-dangling-links $DANGLE_LINK_FILE1 $DANGLE_LINK_FILE2
+
+# try --no-dangling-links without --follow-links options
+TOOLTEST h5diff_452.txt --no-dangling-links $FILE13 $FILE13
+
+# dangling link found for soft links (FILE to FILE)
+TOOLTEST h5diff_453.txt --follow-links -v --no-dangling-links $FILE13 $FILE13
+
+# dangling link found for soft links (obj to obj)
+TOOLTEST h5diff_454.txt --follow-links -v --no-dangling-links $FILE13 $FILE13 /softlink_dset2 /softlink_noexist
+
+# dangling link found for soft links (obj to obj) Both dangle links
+TOOLTEST h5diff_455.txt --follow-links -v --no-dangling-links $FILE13 $FILE13 /softlink_noexist /softlink_noexist
+
+# dangling link found for ext links (FILE to FILE)
+TOOLTEST h5diff_456.txt --follow-links -v --no-dangling-links $FILE15 $FILE15
+
+# dangling link found for ext links (obj to obj). target file exist
+TOOLTEST h5diff_457.txt --follow-links -v --no-dangling-links $FILE15 $FILE15 /ext_link_dset1 /ext_link_noexist1
+
+# dangling link found for ext links (obj to obj). target file NOT exist
+TOOLTEST h5diff_458.txt --follow-links -v --no-dangling-links $FILE15 $FILE15 /ext_link_dset1 /ext_link_noexist2
+
+# dangling link found for ext links (obj to obj). Both dangle links
+TOOLTEST h5diff_459.txt --follow-links -v --no-dangling-links $FILE15 $FILE15 /ext_link_noexist1 /ext_link_noexist2
+
# ##############################################################################
# # END
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c
index 0f25efe..3156ba6 100644
--- a/tools/h5dump/h5dump.c
+++ b/tools/h5dump/h5dump.c
@@ -717,7 +717,7 @@ usage(const char *prog)
/*-------------------------------------------------------------------------
* Function: table_list_add
*
- * Purpose: Add a new set of tables
+ * Purpose: Add a new set of tables
*
* Return: index of added table on success, -1 on failure
*
@@ -1191,17 +1191,17 @@ print_datatype(hid_t type,unsigned in_group)
case H5T_REFERENCE:
printf("H5T_REFERENCE");
- /* The BNF document states that the type of reference should be
- * displayed after "H5T_REFERENCE". Therefore add the missing
- * reference type if the region command line option is used. This
+ /* The BNF document states that the type of reference should be
+ * displayed after "H5T_REFERENCE". Therefore add the missing
+ * reference type if the region command line option is used. This
* reference type will not be displayed if the region option is not used. */
if(display_region) {
if (H5Tequal(type, H5T_STD_REF_DSETREG)==TRUE) {
printf(" { H5T_STD_REF_DSETREG }");
- }
+ }
else {
printf(" { H5T_STD_REF_OBJECT }");
- }
+ }
}
break;
@@ -2005,10 +2005,18 @@ dump_named_datatype(hid_t tid, const char *name)
/* attribute iteration: if there is a request to do H5_INDEX_CRT_ORDER and tracking order is set
in the datatype's create property list for attributes, then, sort by creation order, otherwise by name */
- if( (sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED))
- H5Aiterate2(tid, sort_by, sort_order, NULL, dump_attr_cb, NULL);
- else
- H5Aiterate2(tid, H5_INDEX_NAME, sort_order, NULL, dump_attr_cb, NULL);
+ if( (sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) {
+ if(H5Aiterate2(tid, sort_by, sort_order, NULL, dump_attr_cb, NULL) < 0) {
+ error_msg(progname, "error getting attribute information\n");
+ d_status = EXIT_FAILURE;
+ } /* end if */
+ } /* end if */
+ else {
+ if(H5Aiterate2(tid, H5_INDEX_NAME, sort_order, NULL, dump_attr_cb, NULL) < 0) {
+ error_msg(progname, "error getting attribute information\n");
+ d_status = EXIT_FAILURE;
+ } /* end if */
+ } /* end else */
indent -= COL;
@@ -2123,10 +2131,18 @@ dump_group(hid_t gid, const char *name)
/* attribute iteration: if there is a request to do H5_INDEX_CRT_ORDER and tracking order is set
in the group for attributes, then, sort by creation order, otherwise by name */
- if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED))
- H5Aiterate2(gid, sort_by, sort_order, NULL, dump_attr_cb, NULL);
- else
- H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_attr_cb, NULL);
+ if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) {
+ if(H5Aiterate2(gid, sort_by, sort_order, NULL, dump_attr_cb, NULL) < 0) {
+ error_msg(progname, "error getting attribute information\n");
+ d_status = EXIT_FAILURE;
+ } /* end if */
+ } /* end if */
+ else {
+ if(H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_attr_cb, NULL) < 0) {
+ error_msg(progname, "error getting attribute information\n");
+ d_status = EXIT_FAILURE;
+ } /* end if */
+ } /* end else */
/* if there is a request to do H5_INDEX_CRT_ORDER and tracking order is set
in the group, then, sort by creation order, otherwise by name */
@@ -2146,10 +2162,18 @@ dump_group(hid_t gid, const char *name)
/* attribute iteration: if there is a request to do H5_INDEX_CRT_ORDER and tracking order is set
in the group for attributes, then, sort by creation order, otherwise by name */
- if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED))
- H5Aiterate2(gid, sort_by, sort_order, NULL, dump_attr_cb, NULL);
- else
- H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_attr_cb, NULL);
+ if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) {
+ if(H5Aiterate2(gid, sort_by, sort_order, NULL, dump_attr_cb, NULL) < 0) {
+ error_msg(progname, "error getting attribute information\n");
+ d_status = EXIT_FAILURE;
+ } /* end if */
+ } /* end if */
+ else {
+ if(H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_attr_cb, NULL) < 0) {
+ error_msg(progname, "error getting attribute information\n");
+ d_status = EXIT_FAILURE;
+ } /* end if */
+ } /* end else */
/* if there is a request to do H5_INDEX_CRT_ORDER and tracking order is set
in the group, then, sort by creation order, otherwise by name */
@@ -2254,10 +2278,18 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset)
/* attribute iteration: if there is a request to do H5_INDEX_CRT_ORDER and tracking order is set
in the group for attributes, then, sort by creation order, otherwise by name */
- if( (sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED))
- H5Aiterate2(did, sort_by, sort_order, NULL, dump_attr_cb, NULL);
- else
- H5Aiterate2(did, H5_INDEX_NAME, sort_order, NULL, dump_attr_cb, NULL);
+ if( (sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) {
+ if(H5Aiterate2(did, sort_by, sort_order, NULL, dump_attr_cb, NULL) < 0) {
+ error_msg(progname, "error getting attribute information\n");
+ d_status = EXIT_FAILURE;
+ } /* end if */
+ } /* end if */
+ else {
+ if(H5Aiterate2(did, H5_INDEX_NAME, sort_order, NULL, dump_attr_cb, NULL) < 0) {
+ error_msg(progname, "error getting attribute information\n");
+ d_status = EXIT_FAILURE;
+ } /* end if */
+ } /* end else */
}
@@ -2500,14 +2532,14 @@ dump_data(hid_t obj_id, int obj_data, struct subset_t *sset, int display_index)
status = h5tools_dump_dset(stdout, outputformat, obj_id, -1, sset, depth);
H5Tclose(f_type);
- }
+ }
else {
/* need to call h5tools_dump_mem for the attribute data */
space = H5Aget_space(obj_id);
space_type = H5Sget_simple_extent_type(space);
if(space_type == H5S_NULL || space_type == H5S_NO_CLASS) {
status = SUCCEED;
- }
+ }
else {
char string_prefix[64];
h5tool_format_t string_dataformat;
@@ -3278,7 +3310,7 @@ set_binary_form(const char *form)
int bform=-1;
if (strcmp(form,"NATIVE")==0 ||
- strcmp(form,"MEMORY")==0)
+ strcmp(form,"MEMORY")==0)
{/* native form */
bform = 0;
}
@@ -4384,7 +4416,7 @@ main(int argc, const char *argv[])
d_status = EXIT_FAILURE;
goto done;
}
-
+
/* Initialize object tables */
if(table_list_add(fid, oi.fileno) < 0) {
error_msg(progname, "internal error (file %s:line %d)\n", __FILE__, __LINE__);
@@ -5876,10 +5908,18 @@ xml_dump_group(hid_t gid, const char *name)
/* 1. do all the attributes of the group */
- if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED))
- H5Aiterate2(gid, sort_by, sort_order, NULL, dump_function_table->dump_attribute_function, NULL);
- else
- H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_function_table->dump_attribute_function, NULL);
+ if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) {
+ if(H5Aiterate2(gid, sort_by, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) {
+ error_msg(progname, "error getting attribute information\n");
+ d_status = EXIT_FAILURE;
+ } /* end if */
+ } /* end if */
+ else {
+ if(H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) {
+ error_msg(progname, "error getting attribute information\n");
+ d_status = EXIT_FAILURE;
+ } /* end if */
+ } /* end else */
if(isRoot && unamedtype) {
unsigned u;
@@ -5940,10 +5980,18 @@ xml_dump_group(hid_t gid, const char *name)
/* 1. do all the attributes of the group */
- if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED))
- H5Aiterate2(gid, sort_by, sort_order, NULL, dump_function_table->dump_attribute_function, NULL);
- else
- H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_function_table->dump_attribute_function, NULL);
+ if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) {
+ if(H5Aiterate2(gid, sort_by, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) {
+ error_msg(progname, "error getting attribute information\n");
+ d_status = EXIT_FAILURE;
+ } /* end if */
+ } /* end if */
+ else {
+ if(H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) {
+ error_msg(progname, "error getting attribute information\n");
+ d_status = EXIT_FAILURE;
+ } /* end if */
+ } /* end else */
if(isRoot && unamedtype) {
@@ -6598,10 +6646,18 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset)
indent += COL;
- if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED))
- H5Aiterate2(did, sort_by, sort_order, NULL, dump_function_table->dump_attribute_function, NULL);
- else
- H5Aiterate2(did, H5_INDEX_NAME, sort_order, NULL, dump_function_table->dump_attribute_function, NULL);
+ if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) {
+ if(H5Aiterate2(did, sort_by, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) {
+ error_msg(progname, "error getting attribute information\n");
+ d_status = EXIT_FAILURE;
+ } /* end if */
+ } /* end if */
+ else {
+ if(H5Aiterate2(did, H5_INDEX_NAME, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) {
+ error_msg(progname, "error getting attribute information\n");
+ d_status = EXIT_FAILURE;
+ } /* end if */
+ } /* end else */
indent -= COL;
tempi = H5Dget_storage_size(did);
diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c
index ab60807..ccc0f22 100644
--- a/tools/h5dump/h5dumpgentest.c
+++ b/tools/h5dump/h5dumpgentest.c
@@ -250,7 +250,7 @@ typedef struct s1_t {
/* File 65 macros */
#define STRATEGY H5F_FILE_SPACE_AGGR_VFD /* File space handling strategy */
-#define THRESHOLD10 10 /* Free space section threshold */
+#define THRESHOLD10 10 /* Free space section threshold */
/* Declarations for gent_dataset_idx() for "FILE66" */
#define DSET_FIXED "dset_fixed"
diff --git a/tools/h5import/h5import.c b/tools/h5import/h5import.c
index e9e7dac..24428cb 100755
--- a/tools/h5import/h5import.c
+++ b/tools/h5import/h5import.c
@@ -766,7 +766,7 @@ readFloatData(FILE **strm, struct Input *in)
/* same as TEXTFP */
case 2: /*TEXTFPE */
-
+
for (i = 0; i < len; i++, fp32++)
{
if (fscanf(*strm, "%f", fp32) != 1)
@@ -775,7 +775,7 @@ readFloatData(FILE **strm, struct Input *in)
return (-1);
}
}
-
+
fp32 = (H5DT_FLOAT32 *) in->data;
break;
@@ -815,7 +815,7 @@ readFloatData(FILE **strm, struct Input *in)
/* same as TEXTFP */
case 2: /*TEXTFPE */
-
+
for (i = 0; i < len; i++, fp64++)
{
if (fscanf(*strm, "%lf", fp64) != 1)
@@ -824,7 +824,7 @@ readFloatData(FILE **strm, struct Input *in)
return (-1);
}
}
-
+
fp64 = (H5DT_FLOAT64 *) in->data;
break;
@@ -1437,7 +1437,7 @@ processConfigurationFile(char *infile, struct Input *in, FILE **strm)
if (in->configOptionVector[COMPRESS] == 0)
in->compressionType = 0;
-
+
break;
case 12: /* EXTERNAL-STORAGE */
@@ -1587,16 +1587,16 @@ static int
parsePathInfo(struct path_info *path, char *temp)
{
const char delimiter[] = "/";
- char *token;
+ char *token;
int i=0;
const char *err1 = "Path string larger than MAX_PATH_NAME_LENGTH.\n";
token = HDstrtok (temp, delimiter);
- if (HDstrlen(token) >= MAX_PATH_NAME_LENGTH)
+ if (HDstrlen(token) >= MAX_PATH_NAME_LENGTH)
{
(void) fprintf(stderr, err1);
return (-1);
- }
+ }
HDstrcpy(path->group[i++],token);
@@ -1609,7 +1609,7 @@ parsePathInfo(struct path_info *path, char *temp)
{
(void) fprintf(stderr, err1);
return (-1);
- }
+ }
HDstrcpy(path->group[i++],token);
}
path->count = i;
@@ -1621,7 +1621,7 @@ parseDimensions(struct Input *in, char *strm)
{
const char delimiter[] = ",";
char temp[255];
- char *token;
+ char *token;
int i=0;
const char *err1 = "Unable to allocate dynamic memory.\n";
diff --git a/tools/h5import/h5import.h b/tools/h5import/h5import.h
index cbc6bf2..9e4f6e8 100755
--- a/tools/h5import/h5import.h
+++ b/tools/h5import/h5import.h
@@ -38,7 +38,7 @@
#define ERR 20 /* invalid token */
#define MAX_GROUPS_IN_PATH 20
-#define MAX_PATH_NAME_LENGTH 255
+#define MAX_PATH_NAME_LENGTH 255
#define NUM_KEYS 14
#define MIN_NUM_DIMENSION 1
#define MAX_NUM_DIMENSION 32
diff --git a/tools/h5jam/h5jamgentest.c b/tools/h5jam/h5jamgentest.c
index 96d113e..ec79215 100644
--- a/tools/h5jam/h5jamgentest.c
+++ b/tools/h5jam/h5jamgentest.c
@@ -345,7 +345,7 @@ create_textfile(const char *name, size_t size)
HDwrite(fd, buf, size);
- free(buf);
+ free(buf);
HDclose(fd);
}
diff --git a/tools/h5jam/h5unjam.c b/tools/h5jam/h5unjam.c
index 3ab2202..5e4d864 100644
--- a/tools/h5jam/h5unjam.c
+++ b/tools/h5jam/h5unjam.c
@@ -28,10 +28,11 @@
#define TRUE 1
#define FALSE 0
+#define COPY_BUF_SIZE 1024
hsize_t write_pad( int , hsize_t );
hsize_t compute_pad( hsize_t );
-hsize_t copy_to_file( int , int , ssize_t, ssize_t );
+herr_t copy_to_file( int , int , ssize_t, ssize_t );
const char *progname = "h5unjam";
int d_status = EXIT_SUCCESS;
@@ -268,13 +269,19 @@ main(int argc, const char *argv[])
/* copy from 0 to 'usize - 1' into ufid */
if (!do_delete) {
- copy_to_file( ifid, ufid, 0, (ssize_t) usize);
+ if(copy_to_file(ifid, ufid, 0, (ssize_t) usize) < 0) {
+ error_msg(progname, "unable to copy user block to output file \"%s\"\n", ub_file);
+ exit(EXIT_FAILURE);
+ }
}
/* copy from usize to end of file into h5fid,
* starting at end of user block if present
*/
- copy_to_file( ifid, h5fid, (ssize_t) usize, (ssize_t)(fsize - (ssize_t)usize) );
+ if(copy_to_file(ifid, h5fid, (ssize_t) usize, (ssize_t)(fsize - (ssize_t)usize)) < 0) {
+ error_msg(progname, "unable to copy hdf5 data to output file \"%s\"\n", output_file);
+ exit(EXIT_FAILURE);
+ }
HDclose(ufid);
@@ -288,36 +295,60 @@ main(int argc, const char *argv[])
* Copy 'how_much' bytes from the input file to the output file,
* starting at byte 'where' in the input file.
*
- * Returns the size of the output file.
+ * Returns 0 on success, -1 on failure.
*/
-hsize_t
+herr_t
copy_to_file( int infid, int ofid, ssize_t where, ssize_t how_much )
{
- char buf[1024];
+ static char buf[COPY_BUF_SIZE];
off_t to;
off_t from;
ssize_t nchars = -1;
+ ssize_t wnchars = -1;
+ herr_t ret_value = 0;
/* nothing to copy */
if(how_much <= 0)
- return(where);
+ goto done;
from = where;
to = 0;
- while( how_much > 0) {
+ while(how_much > 0) {
+ /* Seek to correct position in input file */
HDlseek(infid,from,SEEK_SET);
- if (how_much > 512)
- nchars = HDread(infid,buf,(unsigned)512);
+
+ /* Read data to buffer */
+ if (how_much > COPY_BUF_SIZE)
+ nchars = HDread(infid,buf,(unsigned)COPY_BUF_SIZE);
else
nchars = HDread(infid,buf,(unsigned)how_much);
+ if(nchars < 0) {
+ ret_value = -1;
+ goto done;
+ } /* end if */
+
+ /* Seek to correct position in output file */
HDlseek(ofid,to,SEEK_SET);
- HDwrite(ofid,buf,(unsigned)nchars);
+
+ /* Update positions/size */
how_much -= nchars;
from += nchars;
to += nchars;
- }
- return (where + how_much);
-}
+ /* Write nchars bytes to output file */
+ wnchars = nchars;
+ while(nchars > 0) {
+ wnchars = HDwrite(ofid,buf,(unsigned)nchars);
+ if(wnchars < 0) {
+ ret_value = -1;
+ goto done;
+ } /* end if */
+ nchars -= wnchars;
+ } /* end while */
+ } /* end while */
+
+done:
+ return ret_value;
+} /* end copy_to_file */
diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c
index 9bc0448..c969670 100644
--- a/tools/h5ls/h5ls.c
+++ b/tools/h5ls/h5ls.c
@@ -1544,7 +1544,7 @@ dataset_list2(hid_t dset, const char UNUSED *name)
printf(" %-10s ", "Storage:");
switch (tclass)
{
-
+
case H5T_VLEN:
printf("information not available");
break;
@@ -1555,20 +1555,20 @@ dataset_list2(hid_t dset, const char UNUSED *name)
printf("information not available");
}
break;
-
+
default:
printf("%lu logical byte%s, %lu allocated byte%s",
(unsigned long)total, 1==total?"":"s",
(unsigned long)used, 1==used?"":"s");
- if (used>0)
+ if (used>0)
{
utilization = (total*100.0)/used;
printf(", %1.2f%% utilization", utilization);
}
-
+
}
-
-
+
+
putchar('\n');
/* Print information about external strorage */
@@ -1937,7 +1937,7 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter)
hbool_t orig_grp_literal = grp_literal_g;
HDfputc(' ', stdout);
-
+
/* Check if we have already seen this elink */
if(elink_trav_visited(iter->elink_list, filename, path)) {
HDfputs("{Already Visited}\n", stdout);
@@ -2028,7 +2028,7 @@ visit_obj(hid_t file, const char *oname, iter_t *iter)
} /* end if */
/* Delay specifying the name start point so the original object name is
- * displayed if it is a link or non-group object */
+ * displayed if it is a link or non-group object */
iter->name_start = iter->base_len;
/* Specified name is a group. List the complete contents of the group. */
@@ -2420,7 +2420,7 @@ main(int argc, const char *argv[])
}
*x = '\0';
/* Delay specifying the name start point so the original object name
- * is displayed if it is a link or non-group object */
+ * is displayed if it is a link or non-group object */
iter.name_start = 1;
}
if(!oname || !*oname) {
diff --git a/tools/h5repack/h5repack.c b/tools/h5repack/h5repack.c
index addcea3..a82f9b1 100644
--- a/tools/h5repack/h5repack.c
+++ b/tools/h5repack/h5repack.c
@@ -90,7 +90,7 @@ int h5repack(const char* infile,
*-------------------------------------------------------------------------
*/
-int
+int
h5repack_init(pack_opt_t *options, int verbose, int latest,
H5F_file_space_type_t strategy, hsize_t threshold)
{
@@ -273,7 +273,7 @@ static int check_options(pack_opt_t *options)
if (options->verbose && have_request(options) /* only print if requested */)
{
printf("Objects to modify layout are...\n");
- if (options->all_layout==1)
+ if (options->all_layout==1)
{
switch (options->layout_g)
{
@@ -295,7 +295,7 @@ static int check_options(pack_opt_t *options)
return -1;
}
printf(" Apply %s layout to all\n", slayout);
- if (H5D_CHUNKED==options->layout_g)
+ if (H5D_CHUNKED==options->layout_g)
{
printf("with dimension [");
for ( j = 0; j < options->chunk_g.rank; j++)
@@ -401,24 +401,24 @@ static int check_options(pack_opt_t *options)
*-------------------------------------------------------------------------
*/
- if (options->grp_compact < 0)
+ if (options->grp_compact < 0)
{
error_msg(progname, "invalid maximum number of links to store as header messages\n");
return -1;
}
- if (options->grp_indexed < 0)
+ if (options->grp_indexed < 0)
{
error_msg(progname, "invalid minimum number of links to store in the indexed format\n");
return -1;
}
- if (options->grp_indexed > options->grp_compact)
+ if (options->grp_indexed > options->grp_compact)
{
error_msg(progname, "minimum indexed size is greater than the maximum compact size\n");
return -1;
}
- for (i=0; i<8; i++)
+ for (i=0; i<8; i++)
{
- if (options->msg_size[i]<0)
+ if (options->msg_size[i]<0)
{
error_msg(progname, "invalid shared message size\n");
return -1;
@@ -518,14 +518,14 @@ static int check_objects(const char* fname,
if(options->verbose)
printf("Opening file <%s>. Searching for objects to modify...\n", fname);
- for(i = 0; i < options->op_tbl->nelems; i++)
+ for(i = 0; i < options->op_tbl->nelems; i++)
{
char* name=options->op_tbl->objs[i].path;
if(options->verbose)
printf(" <%s>",name);
/* the input object names are present in the file and are valid */
- if(h5trav_getindext(name, travt) < 0)
+ if(h5trav_getindext(name, travt) < 0)
{
error_msg(progname, "%s Could not find <%s> in file <%s>. Exiting...\n",
(options->verbose?"\n":""),name,fname);
@@ -535,7 +535,7 @@ static int check_objects(const char* fname,
printf("...Found\n");
/* check for extra filter conditions */
- switch(options->op_tbl->objs[i].filter->filtn)
+ switch(options->op_tbl->objs[i].filter->filtn)
{
/* chunk size must be smaller than pixels per block */
case H5Z_FILTER_SZIP:
diff --git a/tools/h5repack/h5repack.h b/tools/h5repack/h5repack.h
index 38ce9e4..d02d41c 100644
--- a/tools/h5repack/h5repack.h
+++ b/tools/h5repack/h5repack.h
@@ -17,6 +17,8 @@
#ifndef H5REPACK_H__
#define H5REPACK_H__
+#include <assert.h>
+#include <string.h>
#include "hdf5.h"
#include "h5trav.h"
@@ -102,11 +104,11 @@ typedef struct {
H5D_layout_t layout_g; /*global layout information for the ALL case */
int verbose; /*verbose mode */
hsize_t min_comp; /*minimum size to compress, in bytes */
- int use_native; /*use a native type in write */
+ int use_native; /*use a native type in write */
int latest; /*pack file with the latest file format */
int grp_compact; /* Set the maximum number of links to store as header messages in the group */
int grp_indexed; /* Set the minimum number of links to store in the indexed format */
- int msg_size[8]; /* Minimum size of shared messages: dataspace,
+ int msg_size[8]; /* Minimum size of shared messages: dataspace,
datatype, fill value, filter pipleline, attribute */
const char *ublock_filename; /* user block file name */
hsize_t ublock_size; /* user block size */
@@ -161,7 +163,7 @@ int copy_objects (const char* fnamein,
int do_copy_refobjs(hid_t fidin,
hid_t fidout,
trav_table_t *travt,
- pack_opt_t *options);
+ pack_opt_t *options);
/*-------------------------------------------------------------------------
* filters and verify module
diff --git a/tools/h5repack/h5repack.sh.in b/tools/h5repack/h5repack.sh.in
index 69f5059..35fc5fd 100755
--- a/tools/h5repack/h5repack.sh.in
+++ b/tools/h5repack/h5repack.sh.in
@@ -59,6 +59,7 @@ FILE14=h5repack_layouto.h5 # A file with an older version of the layout mes
# (copy of test/tlayouto.h5)
FILE15=h5repack_named_dtypes.h5
FILE16=tfamily%05d.h5 # located in common testfiles folder
+FILE_REF=h5repack_refs.h5
nerrors=0
@@ -435,7 +436,7 @@ else
fi
#file
-arg="$FILE4 -e $INFO_FILE"
+arg="$FILE4 -e $srcdir/$INFO_FILE"
if test $USE_FILTER_DEFLATE != "yes" ; then
SKIP $arg
else
@@ -531,6 +532,9 @@ TOOLTEST $FILE15
# tests family driver (file is located in common testfiles folder, uses TOOLTEST1
TOOLTEST1 $FILE16
+# test various references (bug 1814)
+TOOLTEST $FILE_REF
+
if test $nerrors -eq 0 ; then
echo "All $TESTNAME tests passed."
exit $EXIT_SUCCESS
diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c
index 77c03d2..f95db63 100644
--- a/tools/h5repack/h5repack_copy.c
+++ b/tools/h5repack/h5repack_copy.c
@@ -55,7 +55,7 @@ static hid_t copy_named_datatype(hid_t type_in, hid_t fidout, named_dt_t **named
trav_table_t *travt, pack_opt_t *options);
static int named_datatype_free(named_dt_t **named_dt_head_p, int ignore_err);
static int copy_user_block(const char *infile, const char *outfile, hsize_t size);
-#if defined (H5REPACK_DEBUG_USER_BLOCK)
+#if defined (H5REPACK_DEBUG_USER_BLOCK)
static void print_user_block(const char *filename, hid_t fid);
#endif
@@ -98,7 +98,7 @@ int copy_objects(const char* fnamein,
* open input file
*-------------------------------------------------------------------------
*/
- if((fidin = h5tools_fopen(fnamein, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, (size_t)0)) < 0)
+ if((fidin = h5tools_fopen(fnamein, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, (size_t)0)) < 0)
{
error_msg(progname, "<%s>: %s\n", fnamein, H5FOPENERROR );
goto out;
@@ -108,17 +108,17 @@ int copy_objects(const char* fnamein,
{
hid_t fcpl_in; /* file creation property list ID for input file */
- if((fcpl_in = H5Fget_create_plist(fidin)) < 0)
+ if((fcpl_in = H5Fget_create_plist(fidin)) < 0)
{
error_msg(progname, "failed to retrieve file creation property list\n");
goto out;
- }
+ }
- if(H5Pget_userblock(fcpl_in, &ub_size) < 0)
+ if(H5Pget_userblock(fcpl_in, &ub_size) < 0)
{
error_msg(progname, "failed to retrieve userblock size\n");
goto out;
- }
+ }
if(!options->fs_strategy)
{
@@ -138,49 +138,49 @@ int copy_objects(const char* fnamein,
}
}
- if(H5Pclose(fcpl_in) < 0)
+ if(H5Pclose(fcpl_in) < 0)
{
error_msg(progname, "failed to close property list\n");
goto out;
- }
- }
+ }
+ }
/* Check if we need to create a non-default file creation property list */
- if(options->latest || ub_size > 0)
+ if(options->latest || ub_size > 0)
{
/* Create file creation property list */
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
{
error_msg(progname, "fail to create a file creation property list\n");
goto out;
- }
+ }
if(ub_size > 0)
{
- if(H5Pset_userblock(fcpl, ub_size) < 0)
+ if(H5Pset_userblock(fcpl, ub_size) < 0)
{
error_msg(progname, "failed to set non-default userblock size\n");
goto out;
- }
+ }
}
- if(options->latest)
+ if(options->latest)
{
unsigned i = 0, nindex = 0, mesg_type_flags[5], min_mesg_sizes[5];
/* Adjust group creation parameters for root group */
/* (So that it is created in "dense storage" form) */
- if(H5Pset_link_phase_change(fcpl, (unsigned)options->grp_compact, (unsigned)options->grp_indexed) < 0)
+ if(H5Pset_link_phase_change(fcpl, (unsigned)options->grp_compact, (unsigned)options->grp_indexed) < 0)
{
error_msg(progname, "fail to adjust group creation parameters for root group\n");
goto out;
- }
+ }
- for(i = 0; i < 5; i++)
+ for(i = 0; i < 5; i++)
{
- if(options->msg_size[i] > 0)
+ if(options->msg_size[i] > 0)
{
- switch(i)
+ switch(i)
{
case 0:
mesg_type_flags[nindex] = H5O_SHMESG_SDSPACE_FLAG;
@@ -210,16 +210,16 @@ int copy_objects(const char* fnamein,
} /* end if */
} /* end for */
- if(nindex > 0)
+ if(nindex > 0)
{
- if(H5Pset_shared_mesg_nindexes(fcpl, nindex) < 0)
+ if(H5Pset_shared_mesg_nindexes(fcpl, nindex) < 0)
{
error_msg(progname, "fail to set the number of shared object header message indexes\n");
goto out;
- }
+ }
/* msg_size[0]=dataspace, 1=datatype, 2=file value, 3=filter pipleline, 4=attribute */
- for(i = 0; i < (nindex - 1); i++)
+ for(i = 0; i < (nindex - 1); i++)
{
if(H5Pset_shared_mesg_index(fcpl, i, mesg_type_flags[i], min_mesg_sizes[i]) < 0) {
error_msg(progname, "fail to configure the specified shared object header message index\n");
@@ -229,13 +229,13 @@ int copy_objects(const char* fnamein,
} /* if (nindex>0) */
/* Create file access property list */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
{
error_msg(progname, "Could not create file access property list\n");
goto out;
} /* end if */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
{
error_msg(progname, "Could not set property for using latest version of the format\n");
goto out;
@@ -246,7 +246,7 @@ int copy_objects(const char* fnamein,
-#if defined (H5REPACK_DEBUG_USER_BLOCK)
+#if defined (H5REPACK_DEBUG_USER_BLOCK)
print_user_block(fnamein,fidin);
#endif
@@ -262,11 +262,11 @@ int copy_objects(const char* fnamein,
if(fcpl != H5P_DEFAULT)
{
/* set user block size */
- if(H5Pset_userblock(fcpl, options->ublock_size) < 0)
+ if(H5Pset_userblock(fcpl, options->ublock_size) < 0)
{
error_msg(progname, "failed to set userblock size\n");
goto out;
- }
+ }
}
@@ -274,18 +274,18 @@ int copy_objects(const char* fnamein,
{
/* create a file creation property list */
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
{
error_msg(progname, "fail to create a file creation property list\n");
goto out;
- }
+ }
/* set user block size */
- if(H5Pset_userblock(fcpl, options->ublock_size) < 0)
+ if(H5Pset_userblock(fcpl, options->ublock_size) < 0)
{
error_msg(progname, "failed to set userblock size\n");
goto out;
- }
+ }
}
@@ -318,11 +318,11 @@ int copy_objects(const char* fnamein,
{
/* create a file access property list */
- if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
{
error_msg(progname, "Could not create file access property list\n");
goto out;
- }
+ }
if (H5Pset_alignment(fapl, options->threshold, options->alignment) < 0)
{
@@ -330,7 +330,7 @@ int copy_objects(const char* fnamein,
goto out;
}
- }
+ }
}
@@ -338,27 +338,27 @@ int copy_objects(const char* fnamein,
if(fcpl != H5P_DEFAULT)
{
/* set file space strategy and free space threshold */
- if(H5Pset_file_space(fcpl, options->fs_strategy, options->fs_threshold) < 0)
+ if(H5Pset_file_space(fcpl, options->fs_strategy, options->fs_threshold) < 0)
{
error_msg(progname, "failed to set file space strategy & threshold\n");
goto out;
- }
+ }
}
else
{
/* create a file creation property list */
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
{
error_msg(progname, "fail to create a file creation property list\n");
goto out;
- }
+ }
/* set file space strategy and free space threshold */
- if(H5Pset_file_space(fcpl, options->fs_strategy, options->fs_threshold) < 0)
+ if(H5Pset_file_space(fcpl, options->fs_strategy, options->fs_threshold) < 0)
{
error_msg(progname, "failed to set file space strategy & threshold \n");
goto out;
- }
+ }
}
/*-------------------------------------------------------------------------
@@ -371,11 +371,11 @@ int copy_objects(const char* fnamein,
printf("Making file <%s>...\n",fnameout);
- if((fidout = H5Fcreate(fnameout,H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ if((fidout = H5Fcreate(fnameout,H5F_ACC_TRUNC, fcpl, fapl)) < 0)
{
error_msg(progname, "<%s>: Could not create file\n", fnameout );
goto out;
- }
+ }
/*-------------------------------------------------------------------------
@@ -383,7 +383,7 @@ int copy_objects(const char* fnamein,
*-------------------------------------------------------------------------
*/
if ( options->ublock_size > 0 )
- {
+ {
if ( copy_user_block( options->ublock_filename, fnameout, options->ublock_size) < 0 )
{
error_msg(progname, "Could not copy user block. Exiting...\n");
@@ -408,7 +408,7 @@ int copy_objects(const char* fnamein,
* do the copy
*-------------------------------------------------------------------------
*/
- if(do_copy_objects(fidin, fidout, travt, options) < 0)
+ if(do_copy_objects(fidin, fidout, travt, options) < 0)
{
error_msg(progname, "<%s>: Could not copy data to: %s\n", fnamein, fnameout);
goto out;
@@ -419,11 +419,11 @@ int copy_objects(const char* fnamein,
* and create hard links
*-------------------------------------------------------------------------
*/
- if ( do_copy_refobjs(fidin, fidout, travt, options) < 0 )
+ if ( do_copy_refobjs(fidin, fidout, travt, options) < 0 )
{
printf("h5repack: <%s>: Could not copy data to: %s\n", fnamein, fnameout);
goto out;
- }
+ }
/*-------------------------------------------------------------------------
* close
@@ -466,7 +466,7 @@ int copy_objects(const char* fnamein,
*/
out:
- H5E_BEGIN_TRY
+ H5E_BEGIN_TRY
{
H5Pclose(fapl);
H5Pclose(fcpl);
@@ -490,7 +490,7 @@ out:
*
* Date: October, 23, 2003
*
-* Modifications:
+* Modifications:
*
* July 2004: Introduced the extra EC or NN option for SZIP
*
@@ -502,47 +502,47 @@ out:
* October 2006: Read by hyperslabs for big datasets.
*
* A threshold of H5TOOLS_MALLOCSIZE (128 MB) is the limit upon which I/O hyperslab is done
-* i.e., if the memory needed to read a dataset is greater than this limit,
-* then hyperslab I/O is done instead of one operation I/O
+* i.e., if the memory needed to read a dataset is greater than this limit,
+* then hyperslab I/O is done instead of one operation I/O
* For each dataset, the memory needed is calculated according to
*
* memory needed = number of elements * size of each element
*
-* if the memory needed is lower than H5TOOLS_MALLOCSIZE, then the following operations
+* if the memory needed is lower than H5TOOLS_MALLOCSIZE, then the following operations
* are done
*
* H5Dread( input_dataset1 )
* H5Dread( input_dataset2 )
*
-* with all elements in the datasets selected. If the memory needed is greater than
+* with all elements in the datasets selected. If the memory needed is greater than
* H5TOOLS_MALLOCSIZE, then the following operations are done instead:
*
-* a strip mine is defined for each dimension k (a strip mine is defined as a
+* a strip mine is defined for each dimension k (a strip mine is defined as a
* hyperslab whose size is memory manageable) according to the formula
*
* (1) strip_mine_size[k ] = MIN(dimension[k ], H5TOOLS_BUFSIZE / size of memory type)
*
-* where H5TOOLS_BUFSIZE is a constant currently defined as 1MB. This formula assures
-* that for small datasets (small relative to the H5TOOLS_BUFSIZE constant), the strip
-* mine size k is simply defined as its dimension k, but for larger datasets the
+* where H5TOOLS_BUFSIZE is a constant currently defined as 1MB. This formula assures
+* that for small datasets (small relative to the H5TOOLS_BUFSIZE constant), the strip
+* mine size k is simply defined as its dimension k, but for larger datasets the
* hyperslab size is still memory manageable.
-* a cycle is done until the number of elements in the dataset is reached. In each
-* iteration, two parameters are defined for the function H5Sselect_hyperslab,
+* a cycle is done until the number of elements in the dataset is reached. In each
+* iteration, two parameters are defined for the function H5Sselect_hyperslab,
* the start and size of each hyperslab, according to
*
* (2) hyperslab_size [k] = MIN(dimension[k] - hyperslab_offset[k], strip_mine_size [k])
*
-* where hyperslab_offset [k] is initially set to zero, and later incremented in
-* hyperslab_size[k] offsets. The reason for the operation
+* where hyperslab_offset [k] is initially set to zero, and later incremented in
+* hyperslab_size[k] offsets. The reason for the operation
*
* dimension[k] - hyperslab_offset[k]
*
-* in (2) is that, when using the strip mine size, it assures that the "remaining" part
+* in (2) is that, when using the strip mine size, it assures that the "remaining" part
* of the dataset that does not fill an entire strip mine is processed.
*
-* November 2006: Use H5Ocopy in the copy of objects. The logic for using
-* H5Ocopy or not is if a change of filters or layout is requested by the user
-* then use read/write else use H5Ocopy.
+* November 2006: Use H5Ocopy in the copy of objects. The logic for using
+* H5Ocopy or not is if a change of filters or layout is requested by the user
+* then use read/write else use H5Ocopy.
*
* May, 1, 2008: Add a printing of the compression ratio of old size / new size
*
@@ -591,18 +591,18 @@ int do_copy_objects(hid_t fidin,
*-------------------------------------------------------------------------
*/
- if (options->verbose)
+ if (options->verbose)
{
printf("-----------------------------------------\n");
printf(" Type Filter (Compression) Name\n");
printf("-----------------------------------------\n");
}
- for ( i = 0; i < travt->nobjs; i++)
+ for ( i = 0; i < travt->nobjs; i++)
{
buf = NULL;
- switch ( travt->objs[i].type )
+ switch ( travt->objs[i].type )
{
case H5TRAV_TYPE_UNKNOWN:
@@ -644,7 +644,7 @@ int do_copy_objects(hid_t fidin,
* and copy its attributes using that ID
*-------------------------------------------------------------------------
*/
- if(HDstrcmp(travt->objs[i].name, "/") == 0)
+ if(HDstrcmp(travt->objs[i].name, "/") == 0)
{
if ((grp_out = H5Gopen2(fidout, "/", H5P_DEFAULT)) < 0)
goto error;
@@ -653,7 +653,7 @@ int do_copy_objects(hid_t fidin,
else
{
- if (options->grp_compact>0 || options->grp_indexed>0)
+ if (options->grp_compact>0 || options->grp_indexed>0)
{
if(H5Pset_link_phase_change(gcpl_out, (unsigned)options->grp_compact, (unsigned)options->grp_indexed) < 0)
goto error;
@@ -699,7 +699,7 @@ int do_copy_objects(hid_t fidin,
/* check if filters were requested for individual objects */
for( u = 0; u < options->op_tbl->nelems; u++)
{
- int k;
+ int k;
for( k = 0; k < options->op_tbl->objs[u].nfilters; k++)
{
@@ -740,11 +740,11 @@ int do_copy_objects(hid_t fidin,
* otherwise we do a copy using H5Ocopy
*-------------------------------------------------------------------------
*/
- if ( options->op_tbl->nelems ||
- options->all_filter == 1 ||
- options->all_layout == 1 ||
+ if ( options->op_tbl->nelems ||
+ options->all_filter == 1 ||
+ options->all_layout == 1 ||
is_ref ||
- is_named)
+ is_named)
{
int j;
@@ -809,7 +809,7 @@ int do_copy_objects(hid_t fidin,
apply_s=0;
/* apply the filter */
- if (apply_s)
+ if (apply_s)
{
if (apply_filters(travt->objs[i].name,
rank,
@@ -831,7 +831,7 @@ int do_copy_objects(hid_t fidin,
dset_out = H5Dcreate2(fidout, travt->objs[i].name, wtype_id, f_space_id, H5P_DEFAULT, dcpl_out, H5P_DEFAULT);
} H5E_END_TRY;
- if(dset_out == FAIL)
+ if(dset_out == FAIL)
{
if(options->verbose)
printf(" warning: could not create dataset <%s>. Applying original settings\n",
@@ -858,7 +858,7 @@ int do_copy_objects(hid_t fidin,
goto error;
if (H5Dwrite(dset_out,wtype_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf) < 0)
goto error;
- }
+ }
else /* possibly not enough memory, read/write by hyperslabs */
{
@@ -879,7 +879,7 @@ int do_copy_objects(hid_t fidin,
hsize_t hs_size[H5S_MAX_RANK]; /*size this pass */
hsize_t hs_nelmts; /*elements in request */
hsize_t zero[8]; /*vector of zeros */
- int k;
+ int k;
/* check if we have VL data in the dataset's datatype */
if (H5Tdetect_class(wtype_id, H5T_VLEN) == TRUE)
@@ -891,7 +891,7 @@ int do_copy_objects(hid_t fidin,
*/
sm_nbytes = p_type_nbytes;
- for (k = rank; k > 0; --k)
+ for (k = rank; k > 0; --k)
{
hsize_t size = H5TOOLS_BUFSIZE / sm_nbytes;
if ( size == 0) /* datum size > H5TOOLS_BUFSIZE */
@@ -909,12 +909,12 @@ int do_copy_objects(hid_t fidin,
memset(hs_offset, 0, sizeof hs_offset);
memset(zero, 0, sizeof zero);
- for (elmtno = 0; elmtno < p_nelmts; elmtno += hs_nelmts)
+ for (elmtno = 0; elmtno < p_nelmts; elmtno += hs_nelmts)
{
/* calculate the hyperslab size */
- if (rank > 0)
+ if (rank > 0)
{
- for (k = 0, hs_nelmts = 1; k < rank; k++)
+ for (k = 0, hs_nelmts = 1; k < rank; k++)
{
hs_size[k] = MIN(dims[k] - hs_offset[k], sm_size[k]);
hs_nelmts *= hs_size[k];
@@ -924,8 +924,8 @@ int do_copy_objects(hid_t fidin,
goto error;
if (H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, zero, NULL, &hs_nelmts, NULL) < 0)
goto error;
- }
- else
+ }
+ else
{
H5Sselect_all(f_space_id);
H5Sselect_all(sm_space);
@@ -933,9 +933,9 @@ int do_copy_objects(hid_t fidin,
} /* rank */
/* read/write */
- if (H5Dread(dset_in, wtype_id, sm_space, f_space_id, H5P_DEFAULT, sm_buf) < 0)
+ if (H5Dread(dset_in, wtype_id, sm_space, f_space_id, H5P_DEFAULT, sm_buf) < 0)
goto error;
- if (H5Dwrite(dset_out, wtype_id, sm_space, f_space_id, H5P_DEFAULT, sm_buf) < 0)
+ if (H5Dwrite(dset_out, wtype_id, sm_space, f_space_id, H5P_DEFAULT, sm_buf) < 0)
goto error;
/* reclaim any VL memory, if necessary */
@@ -943,7 +943,7 @@ int do_copy_objects(hid_t fidin,
H5Dvlen_reclaim(wtype_id, sm_space, H5P_DEFAULT, sm_buf);
/* calculate the next hyperslab offset */
- for (k = rank, carry = 1; k > 0 && carry; --k)
+ for (k = rank, carry = 1; k > 0 && carry; --k)
{
hs_offset[k - 1] += hs_size[k - 1];
if (hs_offset[k - 1] == dims[k - 1])
@@ -967,7 +967,7 @@ int do_copy_objects(hid_t fidin,
* amount of compression used
*-------------------------------------------------------------------------
*/
- if (options->verbose)
+ if (options->verbose)
{
double ratio=0;
@@ -986,7 +986,7 @@ int do_copy_objects(hid_t fidin,
else
print_dataset_info(dcpl_id,travt->objs[i].name,ratio,0);
- /* print a message that the filter was not applied
+ /* print a message that the filter was not applied
(in case there was a filter)
*/
if ( has_filter && apply_s == 0 )
@@ -1037,16 +1037,16 @@ int do_copy_objects(hid_t fidin,
* we do not have request for filter/chunking use H5Ocopy instead
*-------------------------------------------------------------------------
*/
- else
+ else
{
hid_t pid;
/* create property to pass copy options */
- if ( (pid = H5Pcreate(H5P_OBJECT_COPY)) < 0)
+ if ( (pid = H5Pcreate(H5P_OBJECT_COPY)) < 0)
goto error;
/* set options for object copy */
- if(H5Pset_copy_object(pid, H5O_COPY_WITHOUT_ATTR_FLAG) < 0)
+ if(H5Pset_copy_object(pid, H5O_COPY_WITHOUT_ATTR_FLAG) < 0)
goto error;
/*-------------------------------------------------------------------------
@@ -1059,7 +1059,7 @@ int do_copy_objects(hid_t fidin,
fidout, /* Destination file or group identifier */
travt->objs[i].name, /* Name of the destination object */
pid, /* Properties which apply to the copy */
- H5P_DEFAULT) < 0) /* Properties which apply to the new hard link */
+ H5P_DEFAULT) < 0) /* Properties which apply to the new hard link */
goto error;
/* close property */
@@ -1320,7 +1320,7 @@ int copy_attr(hid_t loc_in,
{
;
}
- else
+ else
{
/*-------------------------------------------------------------------------
* read to memory
@@ -1626,13 +1626,13 @@ error:
/*-------------------------------------------------------------------------
-* Function: copy_user_block
+* Function: copy_user_block
*
* Purpose: copy user block from one file to another
*
* Return: 0, ok, -1 no
*
-* Programmer: Peter Cao
+* Programmer: Peter Cao
*
* Date: October, 25, 2007
*
@@ -1706,26 +1706,26 @@ done:
if(outfid > 0)
HDclose(outfid);
- return status;
+ return status;
}
/*-------------------------------------------------------------------------
-* Function: print_user_block
+* Function: print_user_block
*
* Purpose: print user block
*
* Return: 0, ok, -1 no
*
-* Programmer: Pedro Vicente
+* Programmer: Pedro Vicente
*
* Date: August, 20, 2008
*
*-------------------------------------------------------------------------
*/
-#if defined (H5REPACK_DEBUG_USER_BLOCK)
-static
+#if defined (H5REPACK_DEBUG_USER_BLOCK)
+static
void print_user_block(const char *filename, hid_t fid)
{
int fh; /* file handle */
@@ -1734,27 +1734,27 @@ void print_user_block(const char *filename, hid_t fid)
hid_t fcpl; /* file creation property list ID for HDF5 file */
int i;
- /* get user block size */
- if(( fcpl = H5Fget_create_plist(fid)) < 0)
+ /* get user block size */
+ if(( fcpl = H5Fget_create_plist(fid)) < 0)
{
error_msg(progname, "failed to retrieve file creation property list\n");
goto done;
- }
+ }
- if(H5Pget_userblock(fcpl, &ub_size) < 0)
+ if(H5Pget_userblock(fcpl, &ub_size) < 0)
{
error_msg(progname, "failed to retrieve userblock size\n");
goto done;
- }
+ }
- if(H5Pclose(fcpl) < 0)
+ if(H5Pclose(fcpl) < 0)
{
error_msg(progname, "failed to close property list\n");
goto done;
- }
+ }
/* open file */
- if((fh = HDopen(filename, O_RDONLY, 0)) < 0)
+ if((fh = HDopen(filename, O_RDONLY, 0)) < 0)
{
goto done;
}
@@ -1762,7 +1762,7 @@ void print_user_block(const char *filename, hid_t fid)
size = ub_size;
/* read file */
- while(size > 0)
+ while(size > 0)
{
ssize_t nread; /* # of bytes read */
char rbuf[USERBLOCK_XFER_SIZE]; /* buffer for reading */
@@ -1773,7 +1773,7 @@ void print_user_block(const char *filename, hid_t fid)
else
nread = HDread(fh, rbuf, (size_t)size);
- for(i = 0; i < nread; i++)
+ for(i = 0; i < nread; i++)
{
printf("%c ", rbuf[i]);
@@ -1781,22 +1781,22 @@ void print_user_block(const char *filename, hid_t fid)
}
printf("\n");
- if(nread < 0)
+ if(nread < 0)
{
goto done;
- }
+ }
/* update size of userblock left to transfer */
size -= nread;
- }
+ }
done:
if(fh > 0)
HDclose(fh);
- return;
+ return;
}
#endif
diff --git a/tools/h5repack/h5repack_filters.c b/tools/h5repack/h5repack_filters.c
index 92b263b..c7d8b1e 100644
--- a/tools/h5repack/h5repack_filters.c
+++ b/tools/h5repack/h5repack_filters.c
@@ -14,9 +14,16 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "h5repack.h"
-#include "h5test.h"
#include "h5tools.h"
+/* number of members in an array */
+#ifndef NELMTS
+# define NELMTS(X) (sizeof(X)/sizeof(X[0]))
+#endif
+
+/* minimum of two values */
+#undef MIN
+#define MIN(a,b) (((a)<(b)) ? (a) : (b))
/*-------------------------------------------------------------------------
* Function: aux_find_obj
@@ -300,7 +307,7 @@ int apply_filters(const char* name, /* object name from traverse list */
*/
if (obj.layout==-1)
{
-
+
/* stripmine info */
hsize_t sm_size[H5S_MAX_RANK]; /*stripmine size */
hsize_t sm_nbytes; /*bytes per stripmine */
@@ -312,10 +319,10 @@ int apply_filters(const char* name, /* object name from traverse list */
* a hyperslab whose size is manageable.
*/
-
-
+
+
sm_nbytes = msize;
- for ( i = rank; i > 0; --i)
+ for ( i = rank; i > 0; --i)
{
hsize_t size = H5TOOLS_BUFSIZE / sm_nbytes;
if ( size == 0) /* datum size > H5TOOLS_BUFSIZE */
@@ -445,18 +452,18 @@ int apply_filters(const char* name, /* object name from traverse list */
if (H5Pset_layout(dcpl_id, obj.layout)<0)
return -1;
- if (H5D_CHUNKED == obj.layout)
- {
+ if (H5D_CHUNKED == obj.layout)
+ {
if(H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths)<0)
return -1;
}
- else if (H5D_COMPACT == obj.layout)
+ else if (H5D_COMPACT == obj.layout)
{
if (H5Pset_alloc_time(dcpl_id, H5D_ALLOC_TIME_EARLY)<0)
return -1;
}
/* remove filters for the H5D_CONTIGUOUS case */
- else if (H5D_CONTIGUOUS == obj.layout)
+ else if (H5D_CONTIGUOUS == obj.layout)
{
if (H5Premove_filter(dcpl_id,H5Z_FILTER_ALL)<0)
return -1;
diff --git a/tools/h5repack/h5repack_main.c b/tools/h5repack/h5repack_main.c
index acbd8ee..8208c0e 100644
--- a/tools/h5repack/h5repack_main.c
+++ b/tools/h5repack/h5repack_main.c
@@ -103,33 +103,33 @@ static struct long_options l_opts[] = {
*/
int main(int argc, const char **argv)
{
-
+
pack_opt_t options; /*the global options */
int ret=-1;
-
+
/* initialize options */
h5repack_init (&options, 0, 0, 0, (hsize_t)0);
parse_command_line(argc, argv, &options);
-
+
/* get file names if they were not yet got */
if ( has_i_o == 0 )
{
-
+
if ( argv[ opt_ind ] != NULL && argv[ opt_ind + 1 ] != NULL )
{
infile = argv[ opt_ind ];
outfile = argv[ opt_ind + 1 ];
-
+
if ( strcmp( infile, outfile ) == 0 )
{
error_msg(progname, "file names cannot be the same\n");
usage(progname);
exit(EXIT_FAILURE);
-
+
}
}
-
+
else
{
error_msg(progname, "file names missing\n");
@@ -137,14 +137,14 @@ int main(int argc, const char **argv)
exit(EXIT_FAILURE);
}
}
-
-
+
+
/* pack it */
ret=h5repack(infile,outfile,&options);
-
+
/* free tables */
h5repack_end(&options);
-
+
if (ret==-1)
return 1;
else
@@ -291,7 +291,7 @@ static void usage(const char *prog)
*-------------------------------------------------------------------------
*/
-static
+static
void parse_command_line(int argc, const char **argv, pack_opt_t* options)
{
@@ -513,18 +513,8 @@ void read_info(const char *filename,
FILE *fp;
char c;
int i, rc=1;
- char *srcdir = getenv("srcdir"); /* the source directory */
- char data_file[512]=""; /* buffer to hold name of existing file */
-
- /* compose the name of the file to open, using the srcdir, if appropriate */
- if (srcdir){
- strcpy(data_file,srcdir);
- strcat(data_file,"/");
- }
- strcat(data_file,filename);
-
- if ((fp = fopen(data_file, "r")) == (FILE *)NULL) {
+ if ((fp = fopen(filename, "r")) == (FILE *)NULL) {
error_msg(progname, "cannot open options file %s\n", filename);
exit(EXIT_FAILURE);
}
diff --git a/tools/h5repack/h5repack_parse.c b/tools/h5repack/h5repack_parse.c
index 15dc812..2d8f040 100644
--- a/tools/h5repack/h5repack_parse.c
+++ b/tools/h5repack/h5repack_parse.c
@@ -449,7 +449,7 @@ obj_list_t* parse_filter(const char *str,
default:
break;
-
+
};
return obj_list;
diff --git a/tools/h5repack/h5repack_refs.c b/tools/h5repack/h5repack_refs.c
index cd725cd..9945f49 100644
--- a/tools/h5repack/h5repack_refs.c
+++ b/tools/h5repack/h5repack_refs.c
@@ -74,7 +74,7 @@ int do_copy_refobjs(hid_t fidin,
*-------------------------------------------------------------------------
*/
for(i = 0; i < travt->nobjs; i++) {
- switch(travt->objs[i].type)
+ switch(travt->objs[i].type)
{
/*-------------------------------------------------------------------------
* H5TRAV_TYPE_GROUP
@@ -194,8 +194,8 @@ int do_copy_refobjs(hid_t fidin,
goto error;
if(options->verbose)
{
-
-
+
+
printf(FORMAT_OBJ,"dset",travt->objs[i].name );
printf("object <%s> object reference created to <%s>\n",
travt->objs[i].name,
@@ -278,9 +278,9 @@ int do_copy_refobjs(hid_t fidin,
goto error;
if(options->verbose)
{
-
-
-
+
+
+
printf(FORMAT_OBJ,"dset",travt->objs[i].name );
printf("object <%s> region reference created to <%s>\n",
travt->objs[i].name,
@@ -441,7 +441,7 @@ static int copy_refs_attr(hid_t loc_in,
if(H5Oget_info(loc_in, &oinfo) < 0)
goto error;
- for(u = 0; u < (unsigned)oinfo.num_attrs; u++)
+ for(u = 0; u < (unsigned)oinfo.num_attrs; u++)
{
/*-------------------------------------------------------------------------
* open
@@ -488,7 +488,7 @@ static int copy_refs_attr(hid_t loc_in,
* we cannot just copy the buffers, but instead we recreate the reference
*-------------------------------------------------------------------------
*/
- if(H5Tequal(mtype_id, H5T_STD_REF_OBJ))
+ if(H5Tequal(mtype_id, H5T_STD_REF_OBJ))
{
hid_t refobj_id;
hobj_ref_t *refbuf = NULL;
@@ -501,10 +501,10 @@ static int copy_refs_attr(hid_t loc_in,
*-------------------------------------------------------------------------
*/
- if (nelmts)
+ if (nelmts)
{
buf = (hobj_ref_t *)HDmalloc((unsigned)(nelmts * msize));
- if(buf == NULL)
+ if(buf == NULL)
{
printf("cannot read into memory\n");
goto error;
@@ -513,15 +513,15 @@ static int copy_refs_attr(hid_t loc_in,
goto error;
refbuf = (hobj_ref_t *)HDcalloc((unsigned)nelmts, msize);
- if(refbuf == NULL)
+ if(refbuf == NULL)
{
printf( "cannot allocate memory\n" );
goto error;
} /* end if */
- for(k = 0; k < nelmts; k++)
+ for(k = 0; k < nelmts; k++)
{
- H5E_BEGIN_TRY
+ H5E_BEGIN_TRY
{
if((refobj_id = H5Rdereference(attr_id, H5R_OBJECT, &buf[k])) < 0)
goto error;
@@ -530,7 +530,7 @@ static int copy_refs_attr(hid_t loc_in,
/* get the name. a valid name could only occur in the
* second traversal of the file
*/
- if((refname = MapIdToName(refobj_id, travt)) != NULL)
+ if((refname = MapIdToName(refobj_id, travt)) != NULL)
{
/* create the reference */
if(H5Rcreate(&refbuf[k], fidout, refname, H5R_OBJECT, -1) < 0)
@@ -565,7 +565,7 @@ static int copy_refs_attr(hid_t loc_in,
* dataset region references
*-------------------------------------------------------------------------
*/
- else if(H5Tequal(mtype_id, H5T_STD_REF_DSETREG))
+ else if(H5Tequal(mtype_id, H5T_STD_REF_DSETREG))
{
hid_t refobj_id;
hdset_reg_ref_t *refbuf = NULL; /* input buffer for region references */
@@ -577,10 +577,10 @@ static int copy_refs_attr(hid_t loc_in,
* read input to memory
*-------------------------------------------------------------------------
*/
- if(nelmts)
+ if(nelmts)
{
buf = (hdset_reg_ref_t *)HDmalloc((unsigned)(nelmts * msize));
- if(buf == NULL)
+ if(buf == NULL)
{
printf( "cannot read into memory\n" );
goto error;
@@ -593,15 +593,15 @@ static int copy_refs_attr(hid_t loc_in,
*-------------------------------------------------------------------------
*/
refbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)nelmts); /*init to zero */
- if(refbuf == NULL)
+ if(refbuf == NULL)
{
printf( "cannot allocate memory\n" );
goto error;
} /* end if */
- for(k = 0; k < nelmts; k++)
+ for(k = 0; k < nelmts; k++)
{
- H5E_BEGIN_TRY
+ H5E_BEGIN_TRY
{
if((refobj_id = H5Rdereference(attr_id, H5R_DATASET_REGION, &buf[k])) < 0)
continue;
@@ -610,7 +610,7 @@ static int copy_refs_attr(hid_t loc_in,
/* get the name. a valid name could only occur in the
* second traversal of the file
*/
- if((refname = MapIdToName(refobj_id, travt)) != NULL)
+ if((refname = MapIdToName(refobj_id, travt)) != NULL)
{
hid_t region_id; /* region id of the referenced dataset */
@@ -690,23 +690,31 @@ static const char* MapIdToName(hid_t refobj_id,
trav_table_t *travt)
{
unsigned int i;
+ const char* ret = NULL;
+ H5O_info_t ref_oinfo; /* Stat for the refobj id */
/* linear search */
- for(i = 0; i < travt->nobjs; i++)
+ for(i = 0; i < travt->nobjs; i++)
{
- if(travt->objs[i].type == H5O_TYPE_DATASET)
+ if(travt->objs[i].type == H5O_TYPE_DATASET ||
+ travt->objs[i].type == H5O_TYPE_GROUP ||
+ travt->objs[i].type == H5O_TYPE_NAMED_DATATYPE)
{
H5O_info_t ref_oinfo; /* Stat for the refobj id */
/* obtain information to identify the referenced object uniquely */
if(H5Oget_info(refobj_id, &ref_oinfo) < 0)
- return NULL;
+ goto out;
if(ref_oinfo.addr == travt->objs[i].objno)
- return(travt->objs[i].name);
+ {
+ ret = travt->objs[i].name;
+ goto out;
+ }
} /* end if */
} /* i */
- return NULL;
+out:
+ return ret;
}
diff --git a/tools/h5repack/h5repack_verify.c b/tools/h5repack/h5repack_verify.c
index fe94148..ac4570b 100644
--- a/tools/h5repack/h5repack_verify.c
+++ b/tools/h5repack/h5repack_verify.c
@@ -14,13 +14,17 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "h5repack.h"
-#include "h5test.h"
#include "h5tools_utils.h"
extern char *progname;
static int verify_layout(hid_t pid, pack_info_t *obj);
static int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *filter);
+/* number of members in an array */
+#ifndef NELMTS
+# define NELMTS(X) (sizeof(X)/sizeof(X[0]))
+#endif
+
/*-------------------------------------------------------------------------
* Function: h5repack_verify
@@ -230,13 +234,13 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
goto error;
}
- /*
- * If the strategy option is not set,
- * file space handling strategy should be the same for both
+ /*
+ * If the strategy option is not set,
+ * file space handling strategy should be the same for both
* input & output files.
- * If the strategy option is set,
+ * If the strategy option is set,
* the output file's file space handling strategy should be the same
- * as what is set via the strategy option
+ * as what is set via the strategy option
*/
if(!options->fs_strategy && out_strat != in_strat) {
error_msg(progname, "file space strategy not set as unexpected\n");
@@ -247,11 +251,11 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
goto error;
}
- /*
- * If the threshold option is not set,
- * the free space section threshold should be the same for both
+ /*
+ * If the threshold option is not set,
+ * the free space section threshold should be the same for both
* input & output files.
- * If the threshold option is set,
+ * If the threshold option is set,
* the output file's free space section threshold should be the same
* as what is set via the threshold option.
*/
@@ -411,7 +415,7 @@ int h5repack_cmp_pl(const char *fname1,
trav_table_init(&trav);
if(h5trav_gettable(fid1, trav) < 0)
goto error;
-
+
/*-------------------------------------------------------------------------
* traverse the suppplied object list
*-------------------------------------------------------------------------
@@ -551,7 +555,7 @@ error:
*-------------------------------------------------------------------------
*/
-static
+static
int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *filter)
{
int nfilters_dcpl; /* number of filters in DCPL*/
diff --git a/tools/h5repack/h5repacktst.c b/tools/h5repack/h5repacktst.c
index aad3df4..50e4cfe 100644
--- a/tools/h5repack/h5repacktst.c
+++ b/tools/h5repack/h5repacktst.c
@@ -78,6 +78,8 @@
#define FNAME_UB "ublock.bin"
+/* obj and region references */
+#define FNAME_REF "h5repack_refs.h5"
const char *H5REPACK_FILENAMES[] = {
"h5repack_big_out",
@@ -100,6 +102,13 @@ int d_status = EXIT_SUCCESS;
/* Size of userblock (for userblock test) */
#define USERBLOCK_SIZE 2048
+/* obj and region references */
+#define NAME_OBJ_DS "Dset1"
+#define NAME_OBJ_GRP "Group"
+#define NAME_OBJ_NDTYPE "NamedDatatype"
+#define REG_REF_DS1 "Dset_REGREF"
+#define REG_REF_DS2 "Dset2"
+
/*-------------------------------------------------------------------------
* prototypes
*-------------------------------------------------------------------------
@@ -132,6 +141,7 @@ static int make_userblock(void);
static int verify_userblock( const char* filename);
static int make_userblock_file(void);
static int make_named_dtype(hid_t loc_id);
+static int make_references(hid_t loc_id);
/*-------------------------------------------------------------------------
@@ -1618,10 +1628,10 @@ error:
*
*-------------------------------------------------------------------------
*/
-static
+static
int make_testfiles(void)
{
- hid_t fid;
+ hid_t fid;
/*-------------------------------------------------------------------------
* create a file for general copy test
@@ -1812,6 +1822,16 @@ int make_testfiles(void)
if(H5Fclose(fid) < 0)
return -1;
+ /*-------------------------------------------------------------------------
+ * create a file with obj and region references
+ *-------------------------------------------------------------------------*/
+ if((fid = H5Fcreate(FNAME_REF,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0)
+ return -1;
+ if (make_references(fid) < 0)
+ goto out;
+ if(H5Fclose(fid) < 0)
+ return -1;
+
return 0;
out:
@@ -1828,7 +1848,7 @@ out:
*
*-------------------------------------------------------------------------
*/
-static
+static
int make_all_objects(hid_t loc_id)
{
hid_t did=-1;
@@ -1836,7 +1856,7 @@ int make_all_objects(hid_t loc_id)
hid_t tid=-1;
hid_t rid=-1;
hid_t sid=-1;
- hid_t gcplid=-1;
+ hid_t gcplid=-1;
hsize_t dims[1]={2};
/* compound datatype */
typedef struct s_t
@@ -1853,7 +1873,7 @@ int make_all_objects(hid_t loc_id)
goto out;
if ((did = H5Dcreate2(loc_id, "dset_referenced", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
-
+
/*-------------------------------------------------------------------------
* H5G_GROUP
@@ -1862,7 +1882,7 @@ int make_all_objects(hid_t loc_id)
if ((gid = H5Gcreate2(loc_id, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
if (H5Gclose(gid) < 0)
- goto out;
+ goto out;
/* create a group "g2" with H5P_CRT_ORDER_TRACKED set */
if ((gcplid = H5Pcreate(H5P_GROUP_CREATE)) < 0)
@@ -1930,7 +1950,7 @@ int make_all_objects(hid_t loc_id)
return 0;
out:
- H5E_BEGIN_TRY
+ H5E_BEGIN_TRY
{
H5Dclose(did);
H5Gclose(gid);
@@ -1950,7 +1970,7 @@ out:
*
*-------------------------------------------------------------------------
*/
-static
+static
int make_attributes(hid_t loc_id)
{
hid_t did=-1;
@@ -1966,7 +1986,7 @@ int make_attributes(hid_t loc_id)
if ((sid = H5Screate_simple(1, dims, NULL)) < 0)
goto out;
if ((did = H5Dcreate2(loc_id, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto out;
+ goto out;
/*-------------------------------------------------------------------------
* H5G_GROUP
@@ -1998,11 +2018,11 @@ int make_attributes(hid_t loc_id)
goto out;
if (H5Sclose(sid) < 0)
goto out;
-
+
return 0;
out:
- H5E_BEGIN_TRY
+ H5E_BEGIN_TRY
{
H5Dclose(did);
H5Gclose(gid);
@@ -2020,7 +2040,7 @@ out:
*
*-------------------------------------------------------------------------
*/
-static
+static
int make_hlinks(hid_t loc_id)
{
hid_t g1id=-1;
@@ -2068,11 +2088,11 @@ int make_hlinks(hid_t loc_id)
goto out;
if (H5Gclose(g3id) < 0)
goto out;
-
+
return 0;
out:
- H5E_BEGIN_TRY
+ H5E_BEGIN_TRY
{
H5Gclose(g1id);
H5Gclose(g2id);
@@ -2091,7 +2111,7 @@ out:
*-------------------------------------------------------------------------
*/
#ifdef H5_HAVE_FILTER_SZIP
-static
+static
int make_szip(hid_t loc_id)
{
hid_t dcpl; /* dataset creation property list */
@@ -2126,19 +2146,19 @@ int make_szip(hid_t loc_id)
*-------------------------------------------------------------------------
*/
/* Make sure encoding is enabled */
- if (h5tools_can_encode(H5Z_FILTER_SZIP) == 1)
+ if (h5tools_can_encode(H5Z_FILTER_SZIP) == 1)
{
szip_can_encode = 1;
}
- if (szip_can_encode)
+ if (szip_can_encode)
{
/* set szip data */
if(H5Pset_szip (dcpl,szip_options_mask,szip_pixels_per_block) < 0)
goto out;
if (make_dset(loc_id,"dset_szip",sid,dcpl,buf) < 0)
goto out;
- }
- else
+ }
+ else
{
/* WARNING? SZIP is decoder only, can't generate test files */
}
@@ -2168,7 +2188,7 @@ out:
*
*-------------------------------------------------------------------------
*/
-static
+static
int make_deflate(hid_t loc_id)
{
hid_t dcpl; /* dataset creation property list */
@@ -2245,7 +2265,7 @@ out:
*
*-------------------------------------------------------------------------
*/
-static
+static
int make_shuffle(hid_t loc_id)
{
hid_t dcpl; /* dataset creation property list */
@@ -2311,7 +2331,7 @@ out:
*
*-------------------------------------------------------------------------
*/
-static
+static
int make_fletcher32(hid_t loc_id)
{
hid_t dcpl; /* dataset creation property list */
@@ -2381,7 +2401,7 @@ out:
*
*-------------------------------------------------------------------------
*/
-static
+static
int make_nbit(hid_t loc_id)
{
hid_t dcpl; /* dataset creation property list */
@@ -2622,11 +2642,11 @@ int make_all_filters(hid_t loc_id)
#endif
#if defined (H5_HAVE_FILTER_SZIP)
- if (h5tools_can_encode(H5Z_FILTER_SZIP) == 1)
+ if (h5tools_can_encode(H5Z_FILTER_SZIP) == 1)
{
szip_can_encode = 1;
}
- if (szip_can_encode)
+ if (szip_can_encode)
{
/* set szip data */
if(H5Pset_szip (dcpl,szip_options_mask,szip_pixels_per_block) < 0)
@@ -2659,7 +2679,7 @@ int make_all_filters(hid_t loc_id)
/* Make sure encoding is enabled */
#if defined (H5_HAVE_FILTER_SZIP)
- if (szip_can_encode)
+ if (szip_can_encode)
{
/* remove the filters from the dcpl */
if (H5Premove_filter(dcpl,H5Z_FILTER_ALL) < 0)
@@ -2669,7 +2689,7 @@ int make_all_filters(hid_t loc_id)
goto out;
if (make_dset(loc_id,"dset_szip",sid,dcpl,buf) < 0)
goto out;
- } else
+ } else
{
/* WARNING? SZIP is decoder only, can't generate test dataset */
}
@@ -2733,7 +2753,7 @@ int make_all_filters(hid_t loc_id)
return 0;
out:
- H5E_BEGIN_TRY
+ H5E_BEGIN_TRY
{
H5Pclose(dcpl);
H5Sclose(sid);
@@ -2778,7 +2798,7 @@ int make_early(void)
if (H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY) < 0)
goto out;
- for(i = 0; i < iter; i++)
+ for(i = 0; i < iter; i++)
{
if ((fid = H5Fopen(FNAME5, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
goto out;
@@ -2807,7 +2827,7 @@ int make_early(void)
if ((fid = H5Fcreate(FNAME6, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
- for(i = 0; i < iter; i++)
+ for(i = 0; i < iter; i++)
{
if ((tid = H5Tcopy(H5T_NATIVE_DOUBLE)) < 0)
goto out;
@@ -2828,7 +2848,7 @@ int make_early(void)
return 0;
out:
- H5E_BEGIN_TRY
+ H5E_BEGIN_TRY
{
H5Tclose(tid);
H5Pclose(dcpl);
@@ -2937,7 +2957,7 @@ int make_layout(hid_t loc_id)
return 0;
out:
- H5E_BEGIN_TRY
+ H5E_BEGIN_TRY
{
H5Pclose(dcpl);
H5Sclose(sid);
@@ -3123,7 +3143,7 @@ int make_external(hid_t loc_id)
return 0;
out:
- H5E_BEGIN_TRY
+ H5E_BEGIN_TRY
{
H5Pclose(dcpl);
H5Sclose(sid);
@@ -3677,9 +3697,9 @@ int write_dset_in(hid_t loc_id,
if ((tid = H5Tcopy(H5T_STD_B8LE)) < 0)
goto out;
if (write_dset(loc_id,2,dims2,"bitfield2D",tid,buf22) < 0)
- goto out;
+ goto out;
if (H5Tclose(tid) < 0)
- goto out;
+ goto out;
/*-------------------------------------------------------------------------
* H5T_OPAQUE
@@ -3688,7 +3708,7 @@ int write_dset_in(hid_t loc_id,
if ((tid = H5Tcreate(H5T_OPAQUE, (size_t)1)) < 0)
goto out;
if (H5Tset_tag(tid, "1-byte opaque type") < 0)
- goto out;
+ goto out;
if (write_dset(loc_id,2,dims2,"opaque2D",tid,buf22) < 0)
goto out;
if (H5Tclose(tid) < 0)
@@ -3753,7 +3773,7 @@ int write_dset_in(hid_t loc_id,
n = 0;
for(i = 0; i < 3; i++)
{
- for(j = 0; j < 2; j++)
+ for(j = 0; j < 2; j++)
{
int l;
@@ -3974,7 +3994,7 @@ int write_dset_in(hid_t loc_id,
{
for(j = 0; j < 3; j++)
{
- for(k = 0; k < 2; k++)
+ for(k = 0; k < 2; k++)
{
int l;
@@ -4002,7 +4022,7 @@ int write_dset_in(hid_t loc_id,
if (H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf53) < 0)
goto out;
-
+
if (H5Dclose(did) < 0)
goto out;
if (H5Tclose(tid) < 0)
@@ -4064,7 +4084,7 @@ int write_dset_in(hid_t loc_id,
out:
- H5E_BEGIN_TRY
+ H5E_BEGIN_TRY
{
H5Pclose(pid);
H5Sclose(sid);
@@ -4074,7 +4094,7 @@ out:
return -1;
}
-
+
/*-------------------------------------------------------------------------
* Function: make_dset_reg_ref
@@ -4169,7 +4189,7 @@ out:
if(dwbuf)
free(dwbuf);
- H5E_BEGIN_TRY
+ H5E_BEGIN_TRY
{
H5Sclose(sid1);
H5Sclose(sid2);
@@ -4534,7 +4554,7 @@ int write_attr_in(hid_t loc_id,
if(make_diffs)
{
- for(i = 0; i < 2; i++)
+ for(i = 0; i < 2; i++)
{
buf7[i]=0;
buf8[i]=0;
@@ -4709,9 +4729,9 @@ int write_attr_in(hid_t loc_id,
/* Create references to dataset */
if (dset_name)
{
- for (i = 0; i < 3; i++)
+ for (i = 0; i < 3; i++)
{
- for (j = 0; j < 2; j++)
+ for (j = 0; j < 2; j++)
{
if (H5Rcreate(&buf42[i][j],fid,dset_name,H5R_OBJECT,-1) < 0)
goto out;
@@ -4764,9 +4784,9 @@ int write_attr_in(hid_t loc_id,
/* Allocate and initialize VL dataset to write */
n=0;
- for (i = 0; i < 3; i++)
+ for (i = 0; i < 3; i++)
{
- for (j = 0; j < 2; j++)
+ for (j = 0; j < 2; j++)
{
int l;
buf52[i][j].p = malloc((i + 1) * sizeof(int));
@@ -4861,7 +4881,7 @@ int write_attr_in(hid_t loc_id,
*-------------------------------------------------------------------------
*/
- if(make_diffs)
+ if(make_diffs)
{
HDmemset(buf72, 0, sizeof buf72);
HDmemset(buf82, 0, sizeof buf82);
@@ -4982,11 +5002,11 @@ int write_attr_in(hid_t loc_id,
*/
n=1;
- for (i = 0; i < 4; i++)
+ for (i = 0; i < 4; i++)
{
- for (j = 0; j < 3; j++)
+ for (j = 0; j < 3; j++)
{
- for (k = 0; k < 2; k++)
+ for (k = 0; k < 2; k++)
{
if (make_diffs) buf23[i][j][k]=0;
else buf23[i][j][k]=n++;
@@ -5051,18 +5071,18 @@ int write_attr_in(hid_t loc_id,
*/
n=1;
- for (i = 0; i < 4; i++)
+ for (i = 0; i < 4; i++)
{
- for (j = 0; j < 3; j++)
+ for (j = 0; j < 3; j++)
{
- for (k = 0; k < 2; k++)
+ for (k = 0; k < 2; k++)
{
- if (make_diffs)
+ if (make_diffs)
{
buf33[i][j][k].a=0;
buf33[i][j][k].b=0;
}
- else
+ else
{
buf33[i][j][k].a=n++;
buf33[i][j][k].b=n++;
@@ -5143,9 +5163,9 @@ int write_attr_in(hid_t loc_id,
/* Create references to dataset */
if (dset_name)
{
- for (i = 0; i < 4; i++)
+ for (i = 0; i < 4; i++)
{
- for (j = 0; j < 3; j++)
+ for (j = 0; j < 3; j++)
{
for (k = 0; k < 2; k++)
if (H5Rcreate(&buf43[i][j][k],fid,dset_name,H5R_OBJECT,-1) < 0)
@@ -5161,17 +5181,17 @@ int write_attr_in(hid_t loc_id,
*-------------------------------------------------------------------------
*/
- for (i = 0; i < 4; i++)
+ for (i = 0; i < 4; i++)
{
- for (j = 0; j < 3; j++)
+ for (j = 0; j < 3; j++)
{
- for (k = 0; k < 2; k++)
+ for (k = 0; k < 2; k++)
{
- if (make_diffs)
+ if (make_diffs)
{
- buf453[i][j][k]=RED;
+ buf453[i][j][k]=RED;
}
- else
+ else
{
buf453[i][j][k]=GREEN;
}
@@ -5228,11 +5248,11 @@ int write_attr_in(hid_t loc_id,
/* Allocate and initialize VL dataset to write */
n=0;
- for (i = 0; i < 4; i++)
+ for (i = 0; i < 4; i++)
{
- for (j = 0; j < 3; j++)
+ for (j = 0; j < 3; j++)
{
- for (k = 0; k < 2; k++)
+ for (k = 0; k < 2; k++)
{
int l;
buf53[i][j][k].p = malloc((i + 1) * sizeof(int));
@@ -5242,7 +5262,7 @@ int write_attr_in(hid_t loc_id,
{
((int *)buf53[i][j][k].p)[l] = 0;
}
- else
+ else
((int *)buf53[i][j][k].p)[l] = n++;
}
}
@@ -5287,9 +5307,9 @@ int write_attr_in(hid_t loc_id,
*-------------------------------------------------------------------------
*/
n=1;
- for (i = 0; i < 24; i++)
+ for (i = 0; i < 24; i++)
{
- for (j = 0; j < (int)dimarray[0]; j++)
+ for (j = 0; j < (int)dimarray[0]; j++)
{
if (make_diffs) buf63[i][j]=0;
else buf63[i][j]=n++;
@@ -5327,12 +5347,12 @@ int write_attr_in(hid_t loc_id,
{
for(k = 0; k < 2; k++)
{
- if(make_diffs)
+ if(make_diffs)
{
buf73[i][j][k] = 0;
buf83[i][j][k] = 0;
}
- else
+ else
{
buf73[i][j][k] = n++;
buf83[i][j][k] = f++;
@@ -5365,7 +5385,7 @@ int write_attr_in(hid_t loc_id,
return 0;
out:
- H5E_BEGIN_TRY
+ H5E_BEGIN_TRY
{
H5Aclose(aid);
H5Sclose(sid);
@@ -5621,7 +5641,7 @@ int make_named_dtype(hid_t loc_id)
return 0;
out:
- H5E_BEGIN_TRY
+ H5E_BEGIN_TRY
{
H5Tclose(tid);
H5Aclose(aid);
@@ -5632,3 +5652,307 @@ out:
return -1;
} /* end make_named_dtype() */
+/*-------------------------------------------------------------------------
+ * Function: gen_obj_ref
+ *
+ * Purpose:
+ * Generate object references to objects (dataset,group and named datatype)
+ *
+ * Note:
+ * copied from h5copygentest.c and upate to create named datatype
+ *
+ * Programmer: Jonathan Kim (March 18, 2010)
+ *------------------------------------------------------------------------*/
+static herr_t gen_obj_ref(hid_t loc_id)
+{
+ hid_t sid=0, oid=0, tid=0;
+ hsize_t dims1[1]={3};
+ hsize_t dims2[1]={3};
+ int data[3] = {10,20,30};
+ hobj_ref_t objref_buf[3]; /* write buffer for obj reference */
+
+ int status;
+ herr_t ret = SUCCEED;
+
+ /*--------------
+ * add dataset */
+ sid = H5Screate_simple(1, dims1, NULL);
+ if (sid < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ oid = H5Dcreate2 (loc_id, NAME_OBJ_DS, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (oid < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ status = H5Dwrite(oid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ H5Dclose(oid);
+ H5Sclose(sid);
+
+ /*--------------
+ * add group */
+ oid = H5Gcreate2 (loc_id, NAME_OBJ_GRP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (oid < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Gcreate2 failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+ H5Gclose(oid);
+
+ /*----------------------
+ * add named datatype
+ */
+ tid = H5Tcopy(H5T_NATIVE_INT);
+ status = H5Tcommit2(loc_id, NAME_OBJ_NDTYPE, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Tcommit2 failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /*---------------------------------------------------------
+ * create obj references to the previously created objects.
+ * Passing -1 as reference is an object.*/
+
+ /* obj ref to dataset */
+ status = H5Rcreate (&objref_buf[0], loc_id, NAME_OBJ_DS, H5R_OBJECT, -1);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* obj ref to group */
+ status = H5Rcreate (&objref_buf[1], loc_id, NAME_OBJ_GRP, H5R_OBJECT, -1);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* obj ref to named-datatype */
+ status = H5Rcreate (&objref_buf[2], loc_id, NAME_OBJ_NDTYPE, H5R_OBJECT, -1);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /*---------------------------------------------------------
+ * create dataset contain references
+ */
+ sid = H5Screate_simple (1, dims2, NULL);
+ if (sid < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ oid = H5Dcreate2 (loc_id, "Dset_OBJREF", H5T_STD_REF_OBJ, sid, H5P_DEFAULT,H5P_DEFAULT,H5P_DEFAULT);
+ if (oid < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ status = H5Dwrite(oid, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, objref_buf);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+out:
+ if(oid > 0)
+ H5Dclose(oid);
+ if(tid > 0)
+ H5Tclose(tid);
+ if(sid > 0)
+ H5Sclose(sid);
+
+ return ret;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: gen_region_ref
+ *
+ * Purpose: Generate dataset region references
+ *
+ * Note:
+ * copied from h5copygentest.c
+ *
+ * Programmer: Jonathan Kim (March 18, 2010)
+ *------------------------------------------------------------------------*/
+static herr_t gen_region_ref(hid_t loc_id)
+{
+ hid_t sid=0, oid1=0, oid2=0;
+ int status;
+ herr_t ret = SUCCEED;
+ char data[3][16] = {"The quick brown", "fox jumps over ", "the 5 lazy dogs"};
+ hsize_t dims2[2] = {3,16};
+ hsize_t coords[4][2] = { {0,1}, {2,11}, {1,0}, {2,4} };
+
+ hdset_reg_ref_t rr_data[2];
+ hsize_t start[2] = {0,0};
+ hsize_t stride[2] = {2,11};
+ hsize_t count[2] = {2,2};
+ hsize_t block[2] = {1,3};
+ hsize_t dims1[1] = {2};
+
+ sid = H5Screate_simple (2, dims2, NULL);
+ if (sid < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* create normal dataset which is refered */
+ oid2 = H5Dcreate2 (loc_id, REG_REF_DS2, H5T_STD_I8LE, sid, H5P_DEFAULT,H5P_DEFAULT,H5P_DEFAULT);
+ if (oid2 < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* write values to dataset */
+ status = H5Dwrite (oid2, H5T_NATIVE_CHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, data);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* select elements space for reference */
+ status = H5Sselect_elements (sid, H5S_SELECT_SET, 4, coords[0]);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Sselect_elements failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* create region reference from elements space */
+ status = H5Rcreate (&rr_data[0], loc_id, REG_REF_DS2, H5R_DATASET_REGION, sid);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* select hyperslab space for reference */
+ status = H5Sselect_hyperslab (sid, H5S_SELECT_SET, start, stride, count, block);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Sselect_hyperslab failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* create region reference from hyperslab space */
+ status = H5Rcreate (&rr_data[1], loc_id, REG_REF_DS2, H5R_DATASET_REGION, sid);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ H5Sclose (sid);
+
+ /* Create dataspace. */
+ sid = H5Screate_simple (1, dims1, NULL);
+ if (sid < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* create region reference dataset */
+ oid1 = H5Dcreate2 (loc_id, REG_REF_DS1, H5T_STD_REF_DSETREG, sid, H5P_DEFAULT,H5P_DEFAULT,H5P_DEFAULT);
+ if (oid1 < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* write data as region references */
+ status = H5Dwrite (oid1, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, rr_data);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+out:
+ if (oid1 > 0)
+ H5Dclose (oid1);
+ if (oid2 > 0)
+ H5Dclose (oid2);
+ if (sid > 0)
+ H5Sclose (sid);
+
+ return ret;
+}
+
+/*-------------------------------------------------------------------------
+* Function: make_references
+*
+* Purpose: create a file with obj and region references
+*
+* Programmer: Jonathan Kim (March 18, 2010)
+*-------------------------------------------------------------------------
+*/
+static herr_t make_references(hid_t loc_id)
+{
+ herr_t ret = SUCCEED;
+ herr_t status;
+
+ /* add object reference */
+ status = gen_obj_ref(loc_id);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Failed to generate object reference.\n");
+ ret = FAIL;
+ }
+
+ /* add region reference */
+ status = gen_region_ref(loc_id);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Failed to generate region reference.\n");
+ ret = FAIL;
+ }
+
+ return ret;
+}
+
diff --git a/tools/h5repack/testfiles/h5repack_refs.h5 b/tools/h5repack/testfiles/h5repack_refs.h5
new file mode 100644
index 0000000..23d53e6
--- /dev/null
+++ b/tools/h5repack/testfiles/h5repack_refs.h5
Binary files differ
diff --git a/tools/h5repack/testh5repack_detect_szip.c b/tools/h5repack/testh5repack_detect_szip.c
index 906996a..b16e0d4 100644
--- a/tools/h5repack/testh5repack_detect_szip.c
+++ b/tools/h5repack/testh5repack_detect_szip.c
@@ -16,8 +16,6 @@
#include <stdio.h>
#include "h5repack.h"
#include "h5tools.h"
-#include "h5test.h"
-
/*-------------------------------------------------------------------------
diff --git a/tools/h5stat/h5stat.c b/tools/h5stat/h5stat.c
index aa10eb4..be74d21 100644
--- a/tools/h5stat/h5stat.c
+++ b/tools/h5stat/h5stat.c
@@ -34,7 +34,7 @@
/* File space management strategies: see H5Fpublic.h for declarations */
const char *FS_STRATEGY_NAME[] = {
- "unknown",
+ "unknown",
"H5F_FILE_SPACE_ALL_PERSIST",
"H5F_FILE_SPACE_ALL",
"H5F_FILE_SPACE_AGGR_VFD",
@@ -124,7 +124,7 @@ static int display_all = TRUE;
static int display_file = FALSE; /* display file information */
static int display_group = FALSE; /* display groups information */
static int display_dset = FALSE; /* display datasets information */
-static int display_dset_dtype_info = FALSE; /* display datasets' datatype information */
+static int display_dset_dtype_meta = FALSE; /* display datasets' datatype information */
static int display_attr = FALSE; /* display attributes information */
static int display_free_sections = FALSE; /* display free space information */
static int display_summary = FALSE; /* display summary of file space information */
@@ -141,72 +141,77 @@ struct handler_t {
};
-static const char *s_opts ="aDdFfhGgsSTO:v";
+static const char *s_opts ="ADdFfhGgsSTO:V";
+/* e.g. "filemetadata" has to precedue "file"; "groupmetadata" has to precede "group" etc. */
static struct long_options l_opts[] = {
{"help", no_arg, 'h'},
{"hel", no_arg, 'h'},
{"he", no_arg, 'h'},
+ {"filemetadata", no_arg, 'F'},
+ {"filemetadat", no_arg, 'F'},
+ {"filemetada", no_arg, 'F'},
+ {"filemetad", no_arg, 'F'},
+ {"filemeta", no_arg, 'F'},
+ {"filemet", no_arg, 'F'},
+ {"fileme", no_arg, 'F'},
+ {"filem", no_arg, 'F'},
{"file", no_arg, 'f'},
{"fil", no_arg, 'f'},
{"fi", no_arg, 'f'},
- {"FILEmetadata", no_arg, 'F'},
- {"FILEmetadat", no_arg, 'F'},
- {"FILEmetada", no_arg, 'F'},
- {"FILEmetad", no_arg, 'F'},
- {"FILEmeta", no_arg, 'F'},
- {"FILEmet", no_arg, 'F'},
- {"FILEme", no_arg, 'F'},
- {"FILEm", no_arg, 'F'},
+ {"groupmetadata", no_arg, 'G'},
+ {"groupmetadat", no_arg, 'G'},
+ {"groupmetada", no_arg, 'G'},
+ {"groupmetad", no_arg, 'G'},
+ {"groupmeta", no_arg, 'G'},
+ {"groupmet", no_arg, 'G'},
+ {"groupme", no_arg, 'G'},
+ {"groupm", no_arg, 'G'},
{"group", no_arg, 'g'},
{"grou", no_arg, 'g'},
{"gro", no_arg, 'g'},
{"gr", no_arg, 'g'},
- {"GROUPmetadata", no_arg, 'G'},
- {"GROUPmetadat", no_arg, 'G'},
- {"GROUPmetada", no_arg, 'G'},
- {"GROUPmetad", no_arg, 'G'},
- {"GROUPmeta", no_arg, 'G'},
- {"GROUPmet", no_arg, 'G'},
- {"GROUPme", no_arg, 'G'},
- {"GROUPm", no_arg, 'G'},
+ {"dsetmetadata", no_arg, 'D'},
+ {"dsetmetadat", no_arg, 'D'},
+ {"dsetmetada", no_arg, 'D'},
+ {"dsetmetad", no_arg, 'D'},
+ {"dsetmeta", no_arg, 'D'},
+ {"dsetmet", no_arg, 'D'},
+ {"dsetme", no_arg, 'D'},
+ {"dsetm", no_arg, 'D'},
{"dset", no_arg, 'd'},
{"dse", no_arg, 'd'},
{"ds", no_arg, 'd'},
- {"DSETmetadata", no_arg, 'D'},
- {"DSETmetadat", no_arg, 'D'},
- {"DSETmetada", no_arg, 'D'},
- {"DSETmetad", no_arg, 'D'},
- {"DSETmeta", no_arg, 'D'},
- {"DSETmet", no_arg, 'D'},
- {"DSETme", no_arg, 'D'},
- {"DSETm", no_arg, 'D'},
- {"DSETtypeinfo", no_arg, 'T'},
- {"DSETtypeinf", no_arg, 'T'},
- {"DSETtypein", no_arg, 'T'},
- {"DSETtypei", no_arg, 'T'},
- {"DSETtype", no_arg, 'T'},
- {"DSETtyp", no_arg, 'T'},
- {"DSETty", no_arg, 'T'},
- {"DSETt", no_arg, 'T'},
+ {"dtypemetadata", no_arg, 'T'},
+ {"dtypemetadat", no_arg, 'T'},
+ {"dtypemetada", no_arg, 'T'},
+ {"dtypemetad", no_arg, 'T'},
+ {"dtypemeta", no_arg, 'T'},
+ {"dtypemet", no_arg, 'T'},
+ {"dtypeme", no_arg, 'T'},
+ {"dtypem", no_arg, 'T'},
+ {"dtype", no_arg, 'T'},
+ {"dtyp", no_arg, 'T'},
+ {"dty", no_arg, 'T'},
+ {"dt", no_arg, 'T'},
{ "object", require_arg, 'O' },
{ "objec", require_arg, 'O' },
{ "obje", require_arg, 'O' },
{ "obj", require_arg, 'O' },
{ "ob", require_arg, 'O' },
- { "version", no_arg, 'v' },
- { "versio", no_arg, 'v' },
- { "versi", no_arg, 'v' },
- { "vers", no_arg, 'v' },
- { "ver", no_arg, 'v' },
- { "ve", no_arg, 'v' },
- { "attribute", no_arg, 'a' },
- { "attribut", no_arg, 'a' },
- { "attribu", no_arg, 'a' },
- { "attrib", no_arg, 'a' },
- { "attri", no_arg, 'a' },
- { "attr", no_arg, 'a' },
- { "att", no_arg, 'a' },
- { "at", no_arg, 'a' },
+ { "version", no_arg, 'V' },
+ { "versio", no_arg, 'V' },
+ { "versi", no_arg, 'V' },
+ { "vers", no_arg, 'V' },
+ { "ver", no_arg, 'V' },
+ { "ve", no_arg, 'V' },
+ { "attribute", no_arg, 'A' },
+ { "attribut", no_arg, 'A' },
+ { "attribu", no_arg, 'A' },
+ { "attrib", no_arg, 'A' },
+ { "attri", no_arg, 'A' },
+ { "attr", no_arg, 'A' },
+ { "att", no_arg, 'A' },
+ { "at", no_arg, 'A' },
{ "freespace", no_arg, 's' },
{ "freespac", no_arg, 's' },
{ "freespa", no_arg, 's' },
@@ -239,15 +244,15 @@ static void usage(const char *prog)
fprintf(stdout, "\n");
fprintf(stdout, " OPTIONS\n");
fprintf(stdout, " -h, --help Print a usage message and exit\n");
- fprintf(stdout, " -v, --version Print version number and exit\n");
+ fprintf(stdout, " -V, --version Print version number and exit\n");
fprintf(stdout, " -f, --file Print file information\n");
- fprintf(stdout, " -F, --FILEmetadata Print file space information for file's metadata\n");
+ fprintf(stdout, " -F, --filemetadata Print file space information for file's metadata\n");
fprintf(stdout, " -g, --group Print group information\n");
- fprintf(stdout, " -G, --GROUPmetadata Print file space information for groups' metadata\n");
+ fprintf(stdout, " -G, --groupmetadata Print file space information for groups' metadata\n");
fprintf(stdout, " -d, --dset Print dataset information\n");
- fprintf(stdout, " -D, --DSETmetadata Print file space information for datasets' metadata\n");
- fprintf(stdout, " -T, --DSETtypeinfo Print datasets' datatype information\n");
- fprintf(stdout, " -a, --attribute Print attribute information\n");
+ fprintf(stdout, " -D, --dsetmetadata Print file space information for datasets' metadata\n");
+ fprintf(stdout, " -T, --dtypemetadata Print datasets' datatype information\n");
+ fprintf(stdout, " -A, --attribute Print attribute information\n");
fprintf(stdout, " -s, --freespace Print free space information\n");
fprintf(stdout, " -S, --summary Print summary of file space information\n");
}
@@ -613,6 +618,8 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
static herr_t
datatype_stats(iter_t *iter, const H5O_info_t *oi)
{
+ herr_t ret;
+
/* Gather statistics about this type of object */
iter->uniq_dtypes++;
@@ -620,6 +627,10 @@ datatype_stats(iter_t *iter, const H5O_info_t *oi)
iter->dtype_ohdr_info.total_size += oi->hdr.space.total;
iter->dtype_ohdr_info.free_size += oi->hdr.space.free;
+ /* Update attribute metadata info */
+ ret = attribute_stats(iter, oi);
+ assert(ret >= 0);
+
return 0;
} /* end datatype_stats() */
@@ -781,7 +792,7 @@ freespace_stats(hid_t fid, iter_t *iter)
* Programmer: Elena Pourmal
* Saturday, August 12, 2006
*
- * Modifications:
+ * Modifications:
* Vailin Choi; October 2009
* Turn on display_group_metadata, display_dset_metadata
* Add 'S' & 's' for printing free space info (previous checkin)
@@ -804,12 +815,11 @@ parse_command_line(int argc, const char *argv[])
usage(progname);
leave(EXIT_SUCCESS);
- case 'v':
+ case 'V':
print_version(progname);
leave(EXIT_SUCCESS);
break;
-
case 'F':
display_all = FALSE;
display_file_metadata = TRUE;
@@ -842,10 +852,10 @@ parse_command_line(int argc, const char *argv[])
case 'T':
display_all = FALSE;
- display_dset_dtype_info = TRUE;
+ display_dset_dtype_meta = TRUE;
break;
- case 'a':
+ case 'A':
display_all = FALSE;
display_attr = TRUE;
break;
@@ -1145,15 +1155,15 @@ print_dataset_info(const iter_t *iter)
/*-------------------------------------------------------------------------
- * Function: print_dset_dtype_info
+ * Function: print_dset_dtype_meta
*
- * Purpose: Prints datasets' datatype information
+ * Purpose: Prints datasets' datatype information
*
* Return: Success: 0
*
* Failure: Never fails
*
- * Programmer:
+ * Programmer:
*
* Modifications:
* Vailin Choi; October 2009
@@ -1162,7 +1172,7 @@ print_dataset_info(const iter_t *iter)
*-------------------------------------------------------------------------
*/
static herr_t
-print_dset_dtype_info(const iter_t *iter)
+print_dset_dtype_meta(const iter_t *iter)
{
unsigned long total; /* Total count for various statistics */
size_t dtype_size; /* Size of encoded datatype */
@@ -1175,7 +1185,7 @@ print_dset_dtype_info(const iter_t *iter)
for(u = 0; u < iter->dset_ntypes; u++) {
H5Tencode(iter->dset_type_info[u].tid, NULL, &dtype_size);
printf("\tDataset datatype #%u:\n", u);
- printf("\t\tCount (total/named) = (%lu/%lu)\n",
+ printf("\t\tCount (total/named) = (%lu/%lu)\n",
iter->dset_type_info[u].count, iter->dset_type_info[u].named);
printf("\t\tSize (desc./elmt) = (%lu/%lu)\n", (unsigned long)dtype_size,
(unsigned long)H5Tget_size(iter->dset_type_info[u].tid));
@@ -1186,7 +1196,7 @@ print_dset_dtype_info(const iter_t *iter)
}
return 0;
-} /* print_dset_dtype_info() */
+} /* print_dset_dtype_meta() */
/*-------------------------------------------------------------------------
@@ -1281,7 +1291,7 @@ print_storage_summary(const iter_t *iter)
percent = ((float)iter->free_space / (float)iter->filesize) * 100;
HDfprintf(stdout, " Amount/Percent of tracked free space: %Hu bytes/%3.1f%\n",
- iter->free_space, percent);
+ iter->free_space, percent);
if(iter->filesize < (total_meta+iter->dset_storage_size+iter->free_space)) {
unaccount = (total_meta + iter->dset_storage_size + iter->free_space) - iter->filesize;
@@ -1292,7 +1302,7 @@ print_storage_summary(const iter_t *iter)
HDfprintf(stdout, " Unaccounted space: %Hu bytes\n", unaccount);
}
- HDfprintf(stdout, "Total space: %Hu bytes\n",
+ HDfprintf(stdout, "Total space: %Hu bytes\n",
total_meta+iter->dset_storage_size+iter->free_space+unaccount);
if(iter->nexternal)
@@ -1329,7 +1339,7 @@ print_file_metadata(const iter_t *iter)
HDfprintf(stdout, "\t\tGroups: %Hu/%Hu\n",
iter->group_ohdr_info.total_size,
iter->group_ohdr_info.free_size);
- HDfprintf(stdout, "\t\tDatasets(exclude compact data): %Hu/%Hu\n",
+ HDfprintf(stdout, "\t\tDatasets(exclude compact data): %Hu/%Hu\n",
iter->dset_ohdr_info.total_size,
iter->dset_ohdr_info.free_size);
HDfprintf(stdout, "\t\tDatatypes: %Hu/%Hu\n",
@@ -1366,7 +1376,7 @@ print_file_metadata(const iter_t *iter)
/*-------------------------------------------------------------------------
* Function: print_group_metadata
*
- * Purpose: Prints file space information for groups' metadata
+ * Purpose: Prints file space information for groups' metadata
*
* Return: Success: 0
*
@@ -1394,7 +1404,7 @@ print_group_metadata(const iter_t *iter)
/*-------------------------------------------------------------------------
* Function: print_dataset_metadata
*
- * Purpose: Prints file space information for datasets' metadata
+ * Purpose: Prints file space information for datasets' metadata
*
* Return: Success: 0
*
@@ -1446,7 +1456,7 @@ print_file_statistics(const iter_t *iter)
display_file = TRUE;
display_group = TRUE;
display_dset = TRUE;
- display_dset_dtype_info = TRUE;
+ display_dset_dtype_meta = TRUE;
display_attr = TRUE;
display_free_sections = TRUE;
display_summary = TRUE;
@@ -1463,7 +1473,7 @@ print_file_statistics(const iter_t *iter)
if(!display_all && display_group_metadata) print_group_metadata(iter);
if(display_dset) print_dataset_info(iter);
- if(display_dset_dtype_info) print_dset_dtype_info(iter);
+ if(display_dset_dtype_meta) print_dset_dtype_meta(iter);
if(!display_all && display_dset_metadata) print_dset_metadata(iter);
if(display_attr) print_attr_info(iter);
@@ -1558,7 +1568,7 @@ main(int argc, const char *argv[])
if(H5Fget_filesize(fid, &iter.filesize) < 0)
warn_msg(progname, "Unable to retrieve file size\n");
assert(iter.filesize != 0);
-
+
/* Get storge info for file-level structures */
if(H5Fget_info2(fid, &finfo) < 0)
warn_msg(progname, "Unable to retrieve file info\n");
@@ -1592,7 +1602,7 @@ main(int argc, const char *argv[])
u = 0;
while(hand[u].obj) {
- if (h5trav_visit(fid, hand[u].obj, TRUE, TRUE, obj_stats, lnk_stats, &iter) < 0)
+ if (h5trav_visit(fid, hand[u].obj, TRUE, TRUE, obj_stats, lnk_stats, &iter) < 0)
warn_msg(progname, "Unable to traverse object \"%s\"\n", hand[u].obj);
else
print_statistics(hand[u].obj, &iter);
diff --git a/tools/h5stat/testfiles/h5stat_filters-UD.ddl b/tools/h5stat/testfiles/h5stat_filters-UD.ddl
new file mode 100644
index 0000000..decfb81
--- /dev/null
+++ b/tools/h5stat/testfiles/h5stat_filters-UD.ddl
@@ -0,0 +1,8 @@
+#############################
+Expected output for 'h5stat -D h5stat_filters.h5'
+#############################
+Filename: h5stat_filters.h5
+File space information for datasets' metadata (in bytes):
+ Object headers (total/unused): 4136/1344
+ Index for Chunked datasets: 31392
+ Heap: 72
diff --git a/tools/h5stat/testfiles/h5stat_filters-UT.ddl b/tools/h5stat/testfiles/h5stat_filters-UT.ddl
new file mode 100644
index 0000000..189eaa6
--- /dev/null
+++ b/tools/h5stat/testfiles/h5stat_filters-UT.ddl
@@ -0,0 +1,13 @@
+#############################
+Expected output for 'h5stat -T h5stat_filters.h5'
+#############################
+Filename: h5stat_filters.h5
+Dataset datatype information:
+ # of unique datatypes used by datasets: 2
+ Dataset datatype #0:
+ Count (total/named) = (14/0)
+ Size (desc./elmt) = (14/4)
+ Dataset datatype #1:
+ Count (total/named) = (1/0)
+ Size (desc./elmt) = (14/4)
+ Total dataset datatype count: 15
diff --git a/tools/h5stat/testfiles/h5stat_help1.ddl b/tools/h5stat/testfiles/h5stat_help1.ddl
index e70fef1..5665b35 100644
--- a/tools/h5stat/testfiles/h5stat_help1.ddl
+++ b/tools/h5stat/testfiles/h5stat_help1.ddl
@@ -5,14 +5,14 @@ Usage: h5stat [OPTIONS] file
OPTIONS
-h, --help Print a usage message and exit
- -v, --version Print version number and exit
+ -V, --version Print version number and exit
-f, --file Print file information
- -F, --FILEmetadata Print file space information for file's metadata
+ -F, --filemetadata Print file space information for file's metadata
-g, --group Print group information
- -G, --GROUPmetadata Print file space information for groups' metadata
+ -G, --groupmetadata Print file space information for groups' metadata
-d, --dset Print dataset information
- -D, --DSETmetadata Print file space information for datasets' metadata
- -T, --DSETtypeinfo Print datasets' datatype information
- -a, --attribute Print attribute information
+ -D, --dsetmetadata Print file space information for datasets' metadata
+ -T, --dtypemetadata Print datasets' datatype information
+ -A, --attribute Print attribute information
-s, --freespace Print free space information
-S, --summary Print summary of file space information
diff --git a/tools/h5stat/testfiles/h5stat_help2.ddl b/tools/h5stat/testfiles/h5stat_help2.ddl
index fbfdd14..3fb303a 100644
--- a/tools/h5stat/testfiles/h5stat_help2.ddl
+++ b/tools/h5stat/testfiles/h5stat_help2.ddl
@@ -5,14 +5,14 @@ Usage: h5stat [OPTIONS] file
OPTIONS
-h, --help Print a usage message and exit
- -v, --version Print version number and exit
+ -V, --version Print version number and exit
-f, --file Print file information
- -F, --FILEmetadata Print file space information for file's metadata
+ -F, --filemetadata Print file space information for file's metadata
-g, --group Print group information
- -G, --GROUPmetadata Print file space information for groups' metadata
+ -G, --groupmetadata Print file space information for groups' metadata
-d, --dset Print dataset information
- -D, --DSETmetadata Print file space information for datasets' metadata
- -T, --DSETtypeinfo Print datasets' datatype information
- -a, --attribute Print attribute information
+ -D, --dsetmetadata Print file space information for datasets' metadata
+ -T, --dtypemetadata Print datasets' datatype information
+ -A, --attribute Print attribute information
-s, --freespace Print free space information
-S, --summary Print summary of file space information
diff --git a/tools/h5stat/testfiles/h5stat_newgrat-UA.ddl b/tools/h5stat/testfiles/h5stat_newgrat-UA.ddl
new file mode 100644
index 0000000..70f9a82
--- /dev/null
+++ b/tools/h5stat/testfiles/h5stat_newgrat-UA.ddl
@@ -0,0 +1,10 @@
+#############################
+Expected output for 'h5stat -A h5stat_newgrat.h5'
+#############################
+Filename: h5stat_newgrat.h5
+Small # of attributes:
+ Total # of objects with small # of attributes: 0
+Attribute bins:
+ # of objects with 100 - 999 attributes: 1
+ Total # of objects with attributes: 1
+ Max. # of attributes to objects: 100
diff --git a/tools/h5stat/testfiles/h5stat_newgrat-UG.ddl b/tools/h5stat/testfiles/h5stat_newgrat-UG.ddl
new file mode 100644
index 0000000..ecebdef
--- /dev/null
+++ b/tools/h5stat/testfiles/h5stat_newgrat-UG.ddl
@@ -0,0 +1,8 @@
+#############################
+Expected output for 'h5stat -G h5stat_newgrat.h5'
+#############################
+Filename: h5stat_newgrat.h5
+File space information for groups' metadata (in bytes):
+ Object headers (total/unused): 5145147/3220092
+ B-tree/List: 470054
+ Heap: 739045
diff --git a/tools/h5stat/testh5stat.sh.in b/tools/h5stat/testh5stat.sh.in
index a1fff1d..2a09f9f 100644
--- a/tools/h5stat/testh5stat.sh.in
+++ b/tools/h5stat/testh5stat.sh.in
@@ -123,14 +123,18 @@ TOOLTEST h5stat_filters-F.ddl -F h5stat_filters.h5
TOOLTEST h5stat_filters-d.ddl -d h5stat_filters.h5
TOOLTEST h5stat_filters-g.ddl -g h5stat_filters.h5
TOOLTEST h5stat_filters-dT.ddl -dT h5stat_filters.h5
+TOOLTEST h5stat_filters-UD.ddl -D h5stat_filters.h5
+TOOLTEST h5stat_filters-UT.ddl -T h5stat_filters.h5
+#
# h5stat_tsohm.h5 is a copy of ../../../test/tsohm.h5 generated by tsohm.c
# as of release 1.8.0-alpha4
TOOLTEST h5stat_tsohm.ddl h5stat_tsohm.h5
# h5stat_newgrat.h5 is generated by h5stat_gentest.c
TOOLTEST h5stat_newgrat.ddl h5stat_newgrat.h5
+TOOLTEST h5stat_newgrat-UG.ddl -G h5stat_newgrat.h5
+TOOLTEST h5stat_newgrat-UA.ddl -A h5stat_newgrat.h5
# h5stat_idx.h5 is generated by h5stat_gentest.c
TOOLTEST h5stat_idx.ddl h5stat_idx.h5
-echo
if test $nerrors -eq 0 ; then
echo "All $TESTNAME tests passed."
diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c
index 4b7b796..9e753fe 100644
--- a/tools/lib/h5diff.c
+++ b/tools/lib/h5diff.c
@@ -27,24 +27,21 @@ typedef enum toolname_t {
/* this struct can be used to differntiate among tools if necessary */
typedef struct {
h5tool_toolname_t toolname;
- int mode;
+ int msg_mode;
} h5tool_opt_t;
-/* To return link's target info
+/* To return link info
* Functions:
- * H5tools_get_softlink_target_info()
- * H5tools_get_extlink_target_info()
+ * H5tools_get_link_info()
* Note: this may be move to h5tools code if used by other tools
*/
typedef struct {
- const char *buf; /* IN: must be allocated along with H5Lget_info[li.u.val_size] */
- H5O_type_t type; /* OUT: target type */
- const char *path; /* OUT: target name */
- int is_path_malloced; /* VAR: Set to TRUE if path is malloced, so can be freed by checking this later. Needed when ext-link's target is soft-link */
- const char *extfile; /* OUT: if external link, external filename */
- hid_t extfile_id; /* OUT: if external link, external file id */
- h5tool_opt_t opt; /* IN: options */
-} h5tool_link_trg_info_t;
+ H5O_type_t trg_type; /* OUT: target type */
+ const char *trg_path; /* OUT: target obj path. This must be freed
+ * when used with H5tools_get_link_info() */
+ H5L_info_t linfo; /* OUT: link info */
+ h5tool_opt_t opt; /* IN: options */
+} h5tool_link_info_t;
/*
* Debug printf macros. The prefix allows output filtering by test scripts.
*/
@@ -90,6 +87,21 @@ do_print_objname (const char *OBJ, const char *path1, const char *path2)
parallel_print("%-7s: <%s> and <%s>\n", OBJ, path1, path2);
}
+/*-------------------------------------------------------------------------
+ * Function: print_warn
+ *
+ * Purpose: check print warning condition.
+ * Return:
+ * 1 if verbose mode
+ * 0 if not verbos mode
+ * Programmer: Jonathan Kim
+ * Date: Feb 4, 2010
+ *-------------------------------------------------------------------------
+ */
+static int print_warn(diff_opt_t *options)
+{
+ return ((options->m_verbose))?1:0;
+}
#ifdef H5_HAVE_PARALLEL
@@ -108,9 +120,9 @@ do_print_objname (const char *OBJ, const char *path1, const char *path2)
*/
void phdiff_dismiss_workers(void)
{
- int i;
- for(i=1; i<g_nTasks; i++)
- MPI_Send(NULL, 0, MPI_BYTE, i, MPI_TAG_END, MPI_COMM_WORLD);
+ int i;
+ for(i=1; i<g_nTasks; i++)
+ MPI_Send(NULL, 0, MPI_BYTE, i, MPI_TAG_END, MPI_COMM_WORLD);
}
@@ -130,31 +142,29 @@ void phdiff_dismiss_workers(void)
*/
void print_manager_output(void)
{
- /* If there was something we buffered, let's print it now */
- if( (outBuffOffset>0) && g_Parallel)
- {
- printf("%s", outBuff);
-
- if(overflow_file)
- {
- int tmp;
-
- rewind(overflow_file);
- while((tmp = getc(overflow_file)) >= 0)
- putchar(tmp);
-
- fclose(overflow_file);
- overflow_file = NULL;
- }
-
- fflush(stdout);
- memset(outBuff, 0, OUTBUFF_SIZE);
- outBuffOffset = 0;
- }
- else if( (outBuffOffset>0) && !g_Parallel)
- {
- fprintf(stderr, "h5diff error: outBuffOffset>0, but we're not in parallel!\n");
- }
+ /* If there was something we buffered, let's print it now */
+ if( (outBuffOffset>0) && g_Parallel)
+ {
+ printf("%s", outBuff);
+
+ if(overflow_file)
+ {
+ int tmp;
+ rewind(overflow_file);
+ while((tmp = getc(overflow_file)) >= 0)
+ putchar(tmp);
+ fclose(overflow_file);
+ overflow_file = NULL;
+ }
+
+ fflush(stdout);
+ memset(outBuff, 0, OUTBUFF_SIZE);
+ outBuffOffset = 0;
+ }
+ else if( (outBuffOffset>0) && !g_Parallel)
+ {
+ fprintf(stderr, "h5diff error: outBuffOffset>0, but we're not in parallel!\n");
+ }
}
/*-------------------------------------------------------------------------
@@ -174,253 +184,200 @@ void print_manager_output(void)
static void print_incoming_data(void)
{
- char data[PRINT_DATA_MAX_SIZE+1];
- int incomingMessage;
- MPI_Status Status;
-
- do
- {
- MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_PRINT_DATA, MPI_COMM_WORLD, &incomingMessage, &Status);
- if(incomingMessage)
- {
- memset(data, 0, PRINT_DATA_MAX_SIZE+1);
- MPI_Recv(data, PRINT_DATA_MAX_SIZE, MPI_CHAR, Status.MPI_SOURCE, MPI_TAG_PRINT_DATA, MPI_COMM_WORLD, &Status);
-
- printf("%s", data);
- }
- } while(incomingMessage);
+ char data[PRINT_DATA_MAX_SIZE+1];
+ int incomingMessage;
+ MPI_Status Status;
+
+ do
+ {
+ MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_PRINT_DATA, MPI_COMM_WORLD, &incomingMessage, &Status);
+ if(incomingMessage)
+ {
+ memset(data, 0, PRINT_DATA_MAX_SIZE+1);
+ MPI_Recv(data, PRINT_DATA_MAX_SIZE, MPI_CHAR, Status.MPI_SOURCE, MPI_TAG_PRINT_DATA, MPI_COMM_WORLD, &Status);
+
+ printf("%s", data);
+ }
+ } while(incomingMessage);
}
#endif
/*-------------------------------------------------------------------------
- * Function: H5tools_get_softlink_target_info
+ * Function: is_valid_options
*
- * Purpose: Get target object's type and path from soft-link path
- *
- * Patameters:
- * - [IN] fileid : soft-link file id
- * - [IN] linkpath : soft-link's source path
- * - [IN] h5li : soft-link's source H5L_info_t
- * - [OUT] trg_info: returning target info (refer to struct)
+ * Purpose: check if options are valid
*
* Return:
- * Success - 1 and return data via trg_info struct
- * Fail - 0
- *
- * Note:
- * trg_info->buf must be allocated along with H5Lget_info[li.u.val_size]
- * before passing to this function.
+ * 1 : Valid
+ * 0 : Not valid
*
* Programmer: Jonathan Kim
*
- * Date: Jan 20, 2010
- *-------------------------------------------------------------------------*/
-static int H5tools_get_softlink_target_info(hid_t file_id, const char * linkpath, H5L_info_t h5li, h5tool_link_trg_info_t *s_trg_info)
+ * Date: Feb 17, 2010
+ *
+ *------------------------------------------------------------------------*/
+static int is_valid_options(diff_opt_t *options)
{
- H5O_type_t otype = H5O_TYPE_UNKNOWN;
- H5O_info_t oinfo;
- H5L_info_t linfo;
- int ret = 0; /* init to fail */
-
+ int ret=1; /* init to valid */
- if((H5Lexists(file_id, linkpath, H5P_DEFAULT) <= 0))
+ /*-----------------------------------------------
+ * no -q(quiet) with -v (verbose) or -r (report) */
+ if(options->m_quiet && (options->m_verbose || options->m_report))
{
- parallel_print("error: \"%s\" doesn't exist \n",linkpath);
+ parallel_print("Error: -q (quiet mode) cannot be added to verbose or report modes\n");
+ options->err_stat=1;
+ ret = 0;
goto out;
}
- if(H5Lget_info(file_id, linkpath, &linfo, H5P_DEFAULT) < 0)
+ /* -------------------------------------------------------
+ * only allow --no-dangling-links along with --follow-links */
+ if(options->no_dangle_links && !options->follow_links)
{
- parallel_print("error: unable to get link info from \"%s\"\n",linkpath);
+ parallel_print("Error: --no-dangling-links must be used along with --follow-links option.\n");
+ options->err_stat=1;
+ ret = 0;
goto out;
}
- /* get target name for softlink */
- if(linfo.type == H5L_TYPE_SOFT)
- {
- /* s_trg_info->buf should be already allocated out of
- * this function and free when done */
- if(H5Lget_val(file_id, linkpath, s_trg_info->buf, h5li.u.val_size, H5P_DEFAULT) < 0)
- {
- parallel_print("error: unable to get link value from \"%s\"\n",s_trg_info->path);
- goto out;
- }
- /* target path */
- s_trg_info->path = s_trg_info->buf;
- }
- /* if obj is hard link, will still get the type */
- else if (linfo.type == H5L_TYPE_HARD)
- {
- s_trg_info->path = linkpath;
- }
-
- /*--------------------------------------------------------------
- * if link target or object exit, get type
- */
- if((H5Lexists(file_id, s_trg_info->path, H5P_DEFAULT) == TRUE))
- {
-
- if(H5Oget_info_by_name(file_id, s_trg_info->path, &oinfo, H5P_DEFAULT) < 0)
- {
- parallel_print("error: unable to get object information for \"%s\"\n", s_trg_info->path);
- goto out;
- }
-
- otype = oinfo.type;
-
-
- /* check unknown type */
- if (otype < H5O_TYPE_GROUP || otype >=H5O_TYPE_NTYPES)
- {
- parallel_print("<%s> is unknown type\n", s_trg_info->path);
- goto out;
- }
- }
- else
+out:
+ if (!ret)
{
- parallel_print("warn: link target \"%s\" doesn't exist \n", s_trg_info->path);
+#ifdef H5_HAVE_PARALLEL
+ if(g_Parallel)
+ /* Let tasks know that they won't be needed */
+ phdiff_dismiss_workers();
+#endif
}
- /* set target obj type to return */
- s_trg_info->type = otype;
-
- /* succeed */
- ret = 1;
-out:
return ret;
}
+
/*-------------------------------------------------------------------------
- * Function: H5tools_get_extlink_target_info
+ * Function: H5tools_get_link_info
*
- * Purpose: Get target object's type, path, file_id and filename from
- * external-link
+ * Purpose: Get link (soft, external) info and its target object type
+ (dataset, group, named datatype) and path, if exist
*
* Patameters:
- * - [IN] fileid : external-link source file-id
- * - [IN] linkpath : external-link source path
- * - [IN] h5li : external-link source H5L_info_t
- * - [OUT] trg_info : returning target info (refer to struct)
+ * - [IN] fileid : link file id
+ * - [IN] linkpath : link path
+ * - [OUT] h5li : link's info (H5L_info_t)
+ * - [OUT] link_info: returning target object info (h5tool_link_info_t)
*
* Return:
- * Success - 1 and return data via trg_info struct
- * Fail - 0
+ * 1 : Succed to get link info.
+ * 0 : Detected as a dangling link
+ * -1 : H5 API failed.
*
- * Note:
- * - trg_info->buf must be allocated along with H5Lget_info[li.u.val_size]
- * before passing to this function.
- * - if target is soft-link, trg_info->path will be malloced. so check if
- * trg_info->is_path_malloced==TRUE, then free trg_info->path along with freeing
- * trg_info->buf outside of this function.
+ * NOTE:
+ * link_info->trg_path must be freed out of this function
*
* Programmer: Jonathan Kim
*
- * Date: Jan 20, 2010
+ * Date: Feb 8, 2010
*-------------------------------------------------------------------------*/
-static int H5tools_get_extlink_target_info(hid_t fileid, const char *linkpath, H5L_info_t h5li, h5tool_link_trg_info_t *trg_info)
+static int H5tools_get_link_info(hid_t file_id, const char * linkpath, h5tool_link_info_t *link_info)
{
-
- hid_t extfile_id;
- const char *extlink_file;
- const char *extlink_path;
- h5tool_link_trg_info_t soft_trg_info;
- H5L_info_t slinfo;
- int ret=0; /* init to Fail */
+ int Ret = -1; /* init to fail */
+ htri_t l_ret;
+ H5O_info_t trg_oinfo;
+ hid_t fapl;
+ hid_t lapl = H5P_DEFAULT;
/* init */
- HDmemset(&soft_trg_info, 0, sizeof(h5tool_link_trg_info_t));
- trg_info->type = H5O_TYPE_UNKNOWN;
-
- if(H5Lget_val(fileid, linkpath, trg_info->buf, h5li.u.val_size, H5P_DEFAULT) < 0)
+ link_info->trg_type = H5O_TYPE_UNKNOWN;
+
+ /* check if link itself exist */
+ if((H5Lexists(file_id, linkpath, H5P_DEFAULT) <= 0))
{
- parallel_print("error: unable to get link value from \"%s\"\n",linkpath);
+ if(link_info->opt.msg_mode==1)
+ parallel_print("Warning: link <%s> doesn't exist \n",linkpath);
goto out;
}
- /*---------------------------------------
- * get target filename and object path
- */
- if(H5Lunpack_elink_val(trg_info->buf, h5li.u.val_size, NULL, &extlink_file, &extlink_path)<0)
+
+ /* get info from link */
+ if(H5Lget_info(file_id, linkpath, &(link_info->linfo), H5P_DEFAULT) < 0)
{
- parallel_print("error: unable to unpack external link value\n");
+ if(link_info->opt.msg_mode==1)
+ parallel_print("Warning: unable to get link info from <%s>\n",linkpath);
goto out;
}
- /* return target filename and obj path */
- trg_info->path = extlink_path;
- trg_info->extfile = extlink_file;
-
- /* ---------------------------------
- * get file id from external file
- * mimicked from h5diff() for Parallel code
- * , but not sure if it's needed
- */
- H5E_BEGIN_TRY
+ /* trg_path must be freed out of this function when finished using */
+ link_info->trg_path = (char*)HDcalloc(link_info->linfo.u.val_size, sizeof(char));
+ HDassert(link_info->trg_path);
+
+ /* get link value */
+ if(H5Lget_val(file_id, linkpath, link_info->trg_path, link_info->linfo.u.val_size, H5P_DEFAULT) < 0)
{
- /* open file */
- if((extfile_id = h5tools_fopen(extlink_file, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, (size_t)0)) < 0)
- {
- parallel_print("error: <%s>: unable to open file\n", extlink_file);
-#ifdef H5_HAVE_PARALLEL
- if(g_Parallel)
- /* Let tasks know that they won't be needed */
- phdiff_dismiss_workers();
-#endif
- goto out;
- } /* end if */
- } H5E_END_TRY;
+ if(link_info->opt.msg_mode==1)
+ parallel_print("Warning: unable to get link value from <%s>\n",linkpath);
+ goto out;
+ }
- /* get external file id */
- trg_info->extfile_id = extfile_id;
+ /*-----------------------------------------------------
+ * if link type is external link use different lapl to
+ * follow object in other file
+ */
+ if (link_info->linfo.type == H5L_TYPE_EXTERNAL)
+ {
+ fapl = H5Pcreate(H5P_FILE_ACCESS);
+ H5Pset_fapl_sec2(fapl);
+ lapl = H5Pcreate(H5P_LINK_ACCESS);
+ H5Pset_elink_fapl(lapl, fapl);
+ }
- /* --------------------------------------------------
- * check if target is soft link, if so allocate buffer
+ /*--------------------------------------------------------------
+ * if link's target object exist, get type
*/
- if((H5Lexists(trg_info->extfile_id, trg_info->path, H5P_DEFAULT) <= 0))
+ /* check if target object exist */
+ l_ret = H5Oexists_by_name(file_id, linkpath, lapl);
+
+ /* detect dangling link */
+ if(l_ret == FALSE)
{
- parallel_print("error: \"%s\" doesn't exist \n", trg_info->path);
- goto out;
+ Ret = 0;
+ goto out;
}
- if(H5Lget_info(trg_info->extfile_id, trg_info->path, &slinfo, H5P_DEFAULT) < 0)
+ /* function failed */
+ else if (l_ret < 0)
{
- parallel_print("error: unable to get link info from \"%s\"\n", trg_info->path);
- goto out;
+ goto out;
}
- /* if ext-link's target is soft-link */
- if(slinfo.type == H5L_TYPE_SOFT)
+ /* get target object info */
+ if(H5Oget_info_by_name(file_id, linkpath, &trg_oinfo, lapl) < 0)
{
- size_t bufsize = (h5li.u.val_size > slinfo.u.val_size)?h5li.u.val_size:slinfo.u.val_size;
- soft_trg_info.buf = (char*)HDcalloc(bufsize, sizeof(char));
- HDassert(trg_info->path);
+ if(link_info->opt.msg_mode==1)
+ parallel_print("Warning: unable to get object information for <%s>\n", linkpath);
+ goto out;
}
- /* get target obj type */
- if(H5tools_get_softlink_target_info(trg_info->extfile_id, trg_info->path, h5li, &soft_trg_info)==0)
+ /* check unknown type */
+ if (trg_oinfo.type < H5O_TYPE_GROUP || trg_oinfo.type >=H5O_TYPE_NTYPES)
{
- parallel_print("error: unable to get link info from \"%s\"\n", trg_info->path);
+ if(link_info->opt.msg_mode==1)
+ parallel_print("Warning: target object of <%s> is unknown type\n", linkpath);
goto out;
- }
+ }
- /* target obj type */
- trg_info->type = soft_trg_info.type;
+ /* set target obj type to return */
+ link_info->trg_type = trg_oinfo.type;
- /* if ext-link's target is soft-link */
- if(slinfo.type == H5L_TYPE_SOFT)
+ /* succeed */
+ Ret = 1;
+out:
+ if (link_info->linfo.type == H5L_TYPE_EXTERNAL)
{
- trg_info->path = HDstrdup(soft_trg_info.buf);
- HDassert(trg_info->path);
- /* set TRUE so this can be freed later */
- trg_info->is_path_malloced = TRUE;
+ H5Pclose(fapl);
+ H5Pclose(lapl);
}
- /* Success */
- ret=1;
-out:
- if(soft_trg_info.buf)
- HDfree(soft_trg_info.buf);
-
- return ret;
+ return Ret;
}
+
/*-------------------------------------------------------------------------
* Function: h5diff
*
@@ -435,7 +392,6 @@ out:
*
*-------------------------------------------------------------------------
*/
-
hsize_t h5diff(const char *fname1,
const char *fname2,
const char *objname1,
@@ -451,12 +407,11 @@ hsize_t h5diff(const char *fname1,
HDmemset(filenames, 0, 1024 * 2);
- if(options->m_quiet && (options->m_verbose || options->m_report))
- {
- parallel_print("Error: -q (quiet mode) cannot be added to verbose or report modes\n");
- options->err_stat=1;
- return 0;
- } /* end if */
+ /*-------------------------------------------------------------------------
+ * check invalid combination of options
+ *-----------------------------------------------------------------------*/
+ if(!is_valid_options(options))
+ goto out;
/*-------------------------------------------------------------------------
* open the files first; if they are not valid, no point in continuing
@@ -546,12 +501,10 @@ hsize_t h5diff(const char *fname1,
info2,
options);
} /* end if */
-
/*-------------------------------------------------------------------------
* compare all
*-------------------------------------------------------------------------
*/
-
else
{
#ifdef H5_HAVE_PARALLEL
@@ -751,8 +704,8 @@ hsize_t diff_match(hid_t file1_id,
*-------------------------------------------------------------------------
*/
#ifdef H5_HAVE_PARALLEL
-{
- char *workerTasks = HDmalloc((g_nTasks - 1) * sizeof(char));
+ {
+ char *workerTasks = (char*)HDmalloc((g_nTasks - 1) * sizeof(char));
int n;
int busyTasks = 0;
struct diffs_found nFoundbyWorker;
@@ -1043,7 +996,7 @@ hsize_t diff_match(hid_t file1_id,
h5diffdebug("done with if block\n");
free(workerTasks);
-}
+ }
#endif /* H5_HAVE_PARALLEL */
/* free table */
@@ -1061,9 +1014,10 @@ hsize_t diff_match(hid_t file1_id,
* Return: Number of differences found
*
* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
* Date: May 9, 2003
*
+ * Programmer: Jonathan Kim
+ * - add following links feature (Feb 11,2010)
*-------------------------------------------------------------------------
*/
@@ -1081,30 +1035,20 @@ hsize_t diff_compare(hid_t file1_id,
int f2 = 0;
hsize_t nfound = 0;
ssize_t i,j;
+ int l_ret;
+ int is_dangle_link1 = 0;
+ int is_dangle_link2 = 0;
/* local variables for diff() */
- hid_t l_fileid1=file1_id;
- hid_t l_fileid2=file2_id;
h5trav_type_t obj1type, obj2type;
- const char *obj1name, *obj2name;
-
- /* softlink info to get target name and type */
- h5tool_link_trg_info_t softlinkinfo1;
- h5tool_link_trg_info_t softlinkinfo2;
- /* external link file id */
- hid_t extfile1_id = (-1);
- hid_t extfile2_id = (-1);
- h5tool_link_trg_info_t extlinkinfo1;
- h5tool_link_trg_info_t extlinkinfo2;
+ /* to get link info */
+ h5tool_link_info_t linkinfo1;
+ h5tool_link_info_t linkinfo2;
- /* init softlink info */
- HDmemset(&softlinkinfo1, 0, sizeof(h5tool_link_trg_info_t));
- HDmemset(&softlinkinfo2, 0, sizeof(h5tool_link_trg_info_t));
-
- /* init external link info */
- HDmemset(&extlinkinfo1, 0, sizeof(h5tool_link_trg_info_t));
- HDmemset(&extlinkinfo2, 0, sizeof(h5tool_link_trg_info_t));
+ /* init link info struct */
+ HDmemset(&linkinfo1, 0, sizeof(h5tool_link_info_t));
+ HDmemset(&linkinfo2, 0, sizeof(h5tool_link_info_t));
i = h5trav_getindex (info1, obj1_name);
j = h5trav_getindex (info2, obj2_name);
@@ -1128,8 +1072,8 @@ hsize_t diff_compare(hid_t file1_id,
}
/* use the name with "/" first, as obtained by iterator function */
- obj1name = info1->paths[i].path;
- obj2name = info2->paths[j].path;
+ obj1_name = info1->paths[i].path;
+ obj2_name = info2->paths[j].path;
obj1type = info1->paths[i].type;
obj2type = info2->paths[j].type;
@@ -1137,151 +1081,157 @@ hsize_t diff_compare(hid_t file1_id,
/*-----------------------------------------------------------------
* follow link option, compare with target object
*/
- if (options->linkfollow)
+ if (options->follow_links)
{
- H5L_info_t li1, li2;
+ /* pass how to handle printing warning to linkinfo option */
+ if(print_warn(options))
+ linkinfo1.opt.msg_mode = linkinfo2.opt.msg_mode = 1;
/*------------------------------------------------------------
* Soft links
*------------------------------------------------------------*/
- /*------------------------
- * if object1 softlink
- */
+ /*--------------------------
+ * if object1 soft link */
if (obj1type == H5TRAV_TYPE_LINK)
{
- if(H5Lget_info(file1_id, obj1_name, &li1, H5P_DEFAULT) < 0)
+ /* get type of target object */
+ l_ret = H5tools_get_link_info(file1_id, obj1_name, &linkinfo1);
+ /* dangling link */
+ if (l_ret == 0)
{
- parallel_print("error: unable to get link info from \"%s\"\n",obj1_name);
- goto out;
+ if (options->no_dangle_links)
+ {
+ /* gangling link is error */
+ if(options->m_verbose)
+ parallel_print("Warning: <%s> is a dangling link.\n", obj1_name);
+ options->err_stat = 1;
+ goto out;
+ }
+ else
+ is_dangle_link1 = 1;
}
-
- softlinkinfo1.buf = (char*)HDcalloc(li1.u.val_size, sizeof(char));
- HDassert(softlinkinfo1.buf);
-
- /* get type and name of target object */
- if(H5tools_get_softlink_target_info(file1_id, obj1_name, li1, &softlinkinfo1)==0)
+ /* fail */
+ else if(l_ret < 0)
{
- parallel_print("error: unable to get softlink info from \"%s\"\n",obj1_name);
+ options->err_stat = 1;
goto out;
}
-
- /* set target name and type to pass diff() */
- obj1type = softlinkinfo1.type;
- obj1name = softlinkinfo1.path;
+ else /* OK */
+ {
+ /* target type for diff() */
+ obj1type = linkinfo1.trg_type;
+ }
}
- /*------------------------
- * if object2 is softlink
- */
+ /*-----------------------------
+ * if object2 is soft link */
if (obj2type == H5TRAV_TYPE_LINK)
{
- if(H5Lget_info(file2_id, obj2_name, &li2, H5P_DEFAULT) < 0)
+ /* get type target object */
+ l_ret = H5tools_get_link_info(file2_id, obj2_name, &linkinfo2);
+ /* dangling link */
+ if (l_ret == 0)
{
- parallel_print("error: unable to get link info from \"%s\"\n",obj2_name);
- goto out;
+ if (options->no_dangle_links)
+ {
+ /* gangling link is error */
+ if(options->m_verbose)
+ parallel_print("Warning: <%s> is a dangling link.\n", obj2_name);
+ options->err_stat = 1;
+ goto out;
+ }
+ else
+ is_dangle_link2=1;
}
-
-
- softlinkinfo2.buf = (char*)HDcalloc(li2.u.val_size, sizeof(char));
- HDassert(softlinkinfo2.buf);
-
- /* get type and name of target object */
- if(H5tools_get_softlink_target_info(file2_id, obj2_name, li2, &softlinkinfo2)==0)
+ /* fail */
+ else if(l_ret < 0)
{
- parallel_print("error: unable to get softlink info from \"%s\"\n",obj2_name);
+ options->err_stat = 1;
goto out;
}
-
- /* set target name and type to pass diff() */
- obj2type = softlinkinfo2.type;
- obj2name = softlinkinfo2.path;
+ else /* OK */
+ {
+ /* target type for diff() */
+ obj2type = linkinfo2.trg_type;
+ }
}
/*------------------------------------------------------------
* External links
*------------------------------------------------------------*/
- /*-------------------------------
- * if object1 is external link
- */
+ /*--------------------------------
+ * if object1 is external link */
if (obj1type == H5TRAV_TYPE_UDLINK)
{
- if(H5Lget_info(file1_id, obj1_name, &li1, H5P_DEFAULT) < 0)
- {
- parallel_print("error: unable to get link info from \"%s\"\n",obj1_name);
- goto out;
- }
-
- /* for external link */
- if(li1.type == H5L_TYPE_EXTERNAL)
+ /* get type and name of target object */
+ l_ret = H5tools_get_link_info(file1_id, obj1_name, &linkinfo1);
+ /* dangling link */
+ if (l_ret == 0)
{
- extlinkinfo1.buf = (char*)HDcalloc(li1.u.val_size, sizeof(char));
- HDassert(extlinkinfo1.buf);
-
- /* get type and name of target object */
- if(H5tools_get_extlink_target_info(file1_id, obj1_name, li1, &extlinkinfo1)==0)
+ if (options->no_dangle_links)
{
- parallel_print("error: unable to get external link info from \"%s\"\n",obj1_name);
+ /* gangling link is error */
+ if(options->m_verbose)
+ parallel_print("Warning: <%s> is a dangling link.\n", obj1_name);
+ options->err_stat = 1;
goto out;
}
-
- /* if valid actual object */
- if (extlinkinfo1.type < H5O_TYPE_GROUP || extlinkinfo1.type >= H5O_TYPE_NTYPES)
- {
- if (options->m_verbose)
- {
- parallel_print("<%s> is invaild type\n", obj1_name);
- }
- goto out;
- }
-
- /* set target fileid, name and type to pass diff() */
- l_fileid1 = extlinkinfo1.extfile_id;
- obj1name = extlinkinfo1.path;
- obj1type = extlinkinfo1.type;
+ else
+ is_dangle_link1 = 1;
}
- }
-
- /*-------------------------------
- * if object2 is external link
- */
- if (obj2type == H5TRAV_TYPE_UDLINK)
- {
- if(H5Lget_info(file2_id, obj2_name, &li2, H5P_DEFAULT) < 0)
+ /* fail */
+ else if(l_ret < 0)
{
- parallel_print("error: unable to get link info from \"%s\"\n",obj2_name);
+ options->err_stat = 1;
goto out;
}
- /* for external link */
- if(li2.type == H5L_TYPE_EXTERNAL)
+ else /* OK */
{
- extlinkinfo2.buf = (char*)HDcalloc(li2.u.val_size, sizeof(char));
- HDassert(extlinkinfo2.buf);
+ /* for external link */
+ if(linkinfo1.linfo.type == H5L_TYPE_EXTERNAL)
+ obj1type = linkinfo1.trg_type;
+ }
+ }
- /* get type and name of target object */
- if(H5tools_get_extlink_target_info(file2_id, obj2_name, li2, &extlinkinfo2)==0)
- {
- parallel_print("error: unable to get external link info from \"%s\"\n",obj2_name);
- goto out;
- }
- /* if valid actual object */
- if (extlinkinfo2.type < H5O_TYPE_GROUP || extlinkinfo2.type >= H5O_TYPE_NTYPES)
+ /*--------------------------------
+ * if object2 is external link */
+ if (obj2type == H5TRAV_TYPE_UDLINK)
+ {
+ /* get type and name of target object */
+ l_ret = H5tools_get_link_info(file2_id, obj2_name, &linkinfo2);
+ /* dangling link */
+ if (l_ret == 0)
+ {
+ if (options->no_dangle_links)
{
- if (options->m_verbose)
- {
- parallel_print("<%s> is invaild type\n", obj2_name);
- }
+ /* gangling link is error */
+ if(options->m_verbose)
+ parallel_print("Warning: <%s> is a dangling link.\n", obj2_name);
+ options->err_stat = 1;
goto out;
}
-
- /* set target fileid, name and type to pass diff() */
- l_fileid2 = extlinkinfo2.extfile_id;
- obj2name = extlinkinfo2.path;
- obj2type = extlinkinfo2.type;
+ else
+ is_dangle_link2 = 1;
+ }
+ /* fail */
+ else if(l_ret < 0)
+ {
+ options->err_stat = 1;
+ goto out;
+ }
+ else /* OK */
+ {
+ /* for external link */
+ if(linkinfo2.linfo.type == H5L_TYPE_EXTERNAL)
+ obj2type = linkinfo2.trg_type;
}
}
- } /* end of linkfollow */
+ /* found dangling link */
+ if (is_dangle_link1 || is_dangle_link2)
+ goto out;
+ } /* end of follow_links */
/* objects are not the same type */
if (obj1type != obj2type)
@@ -1289,45 +1239,53 @@ hsize_t diff_compare(hid_t file1_id,
if (options->m_verbose||options->m_list_not_cmp)
{
parallel_print("<%s> is of type %s and <%s> is of type %s\n",
- obj1name, get_type(obj1type), obj2name,
- get_type(obj2type));
+ obj1_name, get_type(obj1type),
+ obj2_name, get_type(obj2type));
}
options->not_cmp=1;
goto out;
}
- nfound = diff(l_fileid1, obj1name,
- l_fileid2, obj2name,
+ nfound = diff(file1_id, obj1_name,
+ file2_id, obj2_name,
options, obj1type);
out:
- /* free soft link buffer */
- if (softlinkinfo1.buf)
- HDfree(softlinkinfo1.buf);
- if (softlinkinfo2.buf)
- HDfree(softlinkinfo2.buf);
- /* free external link buffer */
- if (extlinkinfo1.buf);
+ /*-------------------------------
+ * handle dangling link(s) */
+ /* both obj1 and obj2 are dangling links */
+ if(is_dangle_link1 && is_dangle_link2)
{
- HDfree(extlinkinfo1.buf);
- /* case for ext-link's target is soft-link */
- if(extlinkinfo1.is_path_malloced)
- HDfree(extlinkinfo1.path);
+ if(print_objname(options, nfound))
+ {
+ do_print_objname("dangling link", obj1_name, obj2_name);
+ print_found(nfound);
+ }
}
- if (extlinkinfo2.buf);
+ /* obj1 is dangling link */
+ else if (is_dangle_link1)
{
- HDfree(extlinkinfo2.buf);
- /* case for ext-link's target is soft-link */
- if(extlinkinfo2.is_path_malloced)
- HDfree(extlinkinfo2.path);
+ if(options->m_verbose)
+ parallel_print("obj1 <%s> is a dangling link.\n", obj1_name);
+ nfound++;
+ if(print_objname(options, nfound))
+ print_found(nfound);
}
-
- /* close external file */
- H5E_BEGIN_TRY
+ /* obj2 is dangling link */
+ else if (is_dangle_link2)
{
- H5Fclose(extfile1_id);
- H5Fclose(extfile2_id);
- } H5E_END_TRY;
+ if(options->m_verbose)
+ parallel_print("obj2 <%s> is a dangling link.\n", obj2_name);
+ nfound++;
+ if(print_objname(options, nfound))
+ print_found(nfound);
+ }
+
+ /* free link info buffer */
+ if (linkinfo1.trg_path)
+ HDfree(linkinfo1.trg_path);
+ if (linkinfo2.trg_path)
+ HDfree(linkinfo2.trg_path);
return nfound;
}
@@ -1346,9 +1304,10 @@ out:
* Return: Number of differences found
*
* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
* Date: May 9, 2003
*
+ * Programmer: Jonathan Kim
+ * - add following links feature (Feb 11,2010)
*-------------------------------------------------------------------------
*/
@@ -1364,24 +1323,28 @@ hsize_t diff(hid_t file1_id,
hid_t grp1_id = (-1);
hid_t grp2_id = (-1);
int ret;
+ int is_dangle_link1 = 0;
+ int is_dangle_link2 = 0;
hsize_t nfound = 0;
- char *extlinkbuf1=NULL;
- char *extlinkbuf2=NULL;
- /* used in soft link case (H5TRAV_TYPE_LINK) */
- h5tool_link_trg_info_t softlinkinfo1;
- h5tool_link_trg_info_t softlinkinfo2;
- /*init */
- HDmemset(&softlinkinfo1,0,sizeof(h5tool_link_trg_info_t));
- HDmemset(&softlinkinfo2,0,sizeof(h5tool_link_trg_info_t));
-
+ /* to get link info */
+ h5tool_link_info_t linkinfo1;
+ h5tool_link_info_t linkinfo2;
+
+ /*init link info struct */
+ HDmemset(&linkinfo1,0,sizeof(h5tool_link_info_t));
+ HDmemset(&linkinfo2,0,sizeof(h5tool_link_info_t));
+
+ /* pass how to handle printing warnings to linkinfo option */
+ if(print_warn(options))
+ linkinfo1.opt.msg_mode = linkinfo2.opt.msg_mode = 1;
switch(type)
{
- /*-------------------------------------------------------------------------
+ /*----------------------------------------------------------------------
* H5TRAV_TYPE_DATASET
- *-------------------------------------------------------------------------
+ *----------------------------------------------------------------------
*/
case H5TRAV_TYPE_DATASET:
/* verbose (-v) and report (-r) mode */
@@ -1409,9 +1372,9 @@ hsize_t diff(hid_t file1_id,
}
break;
- /*-------------------------------------------------------------------------
+ /*----------------------------------------------------------------------
* H5TRAV_TYPE_NAMED_DATATYPE
- *-------------------------------------------------------------------------
+ *----------------------------------------------------------------------
*/
case H5TRAV_TYPE_NAMED_DATATYPE:
if((type1_id = H5Topen2(file1_id, path1, H5P_DEFAULT)) < 0)
@@ -1432,10 +1395,11 @@ hsize_t diff(hid_t file1_id,
if(options->m_verbose)
print_found(nfound);
- /*-------------------------------------------------------------------------
+ /*-----------------------------------------------------------------
* compare attributes
- * the if condition refers to cases when the dataset is a referenced object
- *-------------------------------------------------------------------------
+ * the if condition refers to cases when the dataset is a
+ * referenced object
+ *-----------------------------------------------------------------
*/
if(path1)
nfound += diff_attr(type1_id, type2_id, path1, path2, options);
@@ -1446,9 +1410,9 @@ hsize_t diff(hid_t file1_id,
goto out;
break;
- /*-------------------------------------------------------------------------
+ /*----------------------------------------------------------------------
* H5TRAV_TYPE_GROUP
- *-------------------------------------------------------------------------
+ *----------------------------------------------------------------------
*/
case H5TRAV_TYPE_GROUP:
ret = HDstrcmp(path1, path2);
@@ -1468,10 +1432,11 @@ hsize_t diff(hid_t file1_id,
if((grp2_id = H5Gopen2(file2_id, path2, H5P_DEFAULT)) < 0)
goto out;
- /*-------------------------------------------------------------------------
+ /*-----------------------------------------------------------------
* compare attributes
- * the if condition refers to cases when the dataset is a referenced object
- *-------------------------------------------------------------------------
+ * the if condition refers to cases when the dataset is a
+ * referenced object
+ *-----------------------------------------------------------------
*/
if(path1)
nfound += diff_attr(grp1_id, grp2_id, path1, path2, options);
@@ -1483,42 +1448,54 @@ hsize_t diff(hid_t file1_id,
break;
- /*-------------------------------------------------------------------------
+ /*----------------------------------------------------------------------
* H5TRAV_TYPE_LINK
- *-------------------------------------------------------------------------
+ *----------------------------------------------------------------------
*/
case H5TRAV_TYPE_LINK:
{
- H5L_info_t li1, li2;
-
- if(H5Lget_info(file1_id, path1, &li1, H5P_DEFAULT) < 0)
+ /* get type and name of target object */
+ ret = H5tools_get_link_info(file1_id, path1, &linkinfo1);
+ /* dangling link */
+ if (ret == 0)
{
- parallel_print("error: unable to get link info from \"%s\"\n", path1);
- goto out;
+ if (options->no_dangle_links)
+ {
+ /* gangling link is error */
+ if(options->m_verbose)
+ parallel_print("Warning: <%s> is a dangling link.\n", path1);
+ goto out;
+ }
+ else
+ is_dangle_link1 = 1;
}
- if(H5Lget_info(file2_id, path2, &li2, H5P_DEFAULT) < 0)
- {
- parallel_print("error: unable to get link info from \"%s\"\n", path2);
+ else if (ret < 0)
goto out;
- }
-
- softlinkinfo1.buf = (char*)HDcalloc(li1.u.val_size, sizeof(char));
- HDassert(softlinkinfo1.buf);
- softlinkinfo2.buf = (char*)HDcalloc(li2.u.val_size, sizeof(char));
- HDassert(softlinkinfo2.buf);
- if(H5tools_get_softlink_target_info(file1_id,path1,li1,&softlinkinfo1)==0)
+ /* get type and name of target object */
+ ret = H5tools_get_link_info(file2_id, path2, &linkinfo2);
+ /* dangling link */
+ if (ret == 0)
{
- parallel_print("error: unable to get softlink info from \"%s\"\n", path1);
- goto out;
+ if (options->no_dangle_links)
+ {
+ /* gangling link is error */
+ if(options->m_verbose)
+ parallel_print("Warning: <%s> is a dangling link.\n", path2);
+ goto out;
+ }
+ else
+ is_dangle_link2 = 1;
}
- if(H5tools_get_softlink_target_info(file2_id,path2,li2,&softlinkinfo2)==0)
- {
- parallel_print("error: unable to get softlink info from \"%s\"\n", path2);
+ else if (ret < 0)
goto out;
- }
+
+
+ /* found dangling link */
+ if (is_dangle_link1 || is_dangle_link2)
+ goto out2;
- ret = HDstrcmp(softlinkinfo1.path, softlinkinfo2.path);
+ ret = HDstrcmp(linkinfo1.trg_path, linkinfo2.trg_path);
/* if the target link name is not same then the links are "different" */
nfound = (ret != 0) ? 1 : 0;
@@ -1526,113 +1503,122 @@ hsize_t diff(hid_t file1_id,
if(print_objname(options, nfound))
do_print_objname("link", path1, path2);
- if (options->linkfollow)
+ if (options->follow_links)
{
/* objects are not the same type */
- if (softlinkinfo1.type != softlinkinfo2.type)
+ if (linkinfo1.trg_type != linkinfo2.trg_type)
{
if (options->m_verbose||options->m_list_not_cmp)
{
- parallel_print("<%s> is of type %d and <%s> is of type %d\n", softlinkinfo1.path, softlinkinfo1.type, softlinkinfo2.path, softlinkinfo2.type);
+ parallel_print("<%s> is of type %s and <%s> is of type %s\n", path1, get_type(linkinfo1.trg_type), path2, get_type(linkinfo2.trg_type));
}
options->not_cmp=1;
goto out;
}
- nfound += diff(file1_id, softlinkinfo1.path,
- file2_id, softlinkinfo2.path,
- options, softlinkinfo1.type);
+ /* call self to compare target object */
+ nfound += diff(file1_id, path1,
+ file2_id, path2,
+ options, linkinfo1.trg_type);
}
/* always print the number of differences found in verbose mode */
if(options->m_verbose)
print_found(nfound);
- HDfree(softlinkinfo1.buf);
- HDfree(softlinkinfo2.buf);
+ /* free link info buffer */
+ HDfree(linkinfo1.trg_path);
+ HDfree(linkinfo2.trg_path);
}
break;
- /*-------------------------------------------------------------------------
+ /*----------------------------------------------------------------------
* H5TRAV_TYPE_UDLINK
- *-------------------------------------------------------------------------
+ *----------------------------------------------------------------------
*/
case H5TRAV_TYPE_UDLINK:
{
- H5L_info_t li1, li2;
-
- if(H5Lget_info(file1_id, path1, &li1, H5P_DEFAULT) < 0)
+ /* get type and name of target object */
+ ret = H5tools_get_link_info(file1_id, path1, &linkinfo1);
+ /* dangling link */
+ if (ret == 0)
{
- parallel_print("error: unable to get udlink info from \"%s\"\n", path1);
- goto out;
+ if (options->no_dangle_links)
+ {
+ /* gangling link is error */
+ if(options->m_verbose)
+ parallel_print("Warning: <%s> is a dangling link.\n", path1);
+ goto out;
+ }
+ else
+ is_dangle_link1=1;
}
- if(H5Lget_info(file2_id, path2, &li2, H5P_DEFAULT) < 0)
- {
- parallel_print("error: unable to get udlink info from \"%s\"\n", path2);
+ else if (ret < 0)
goto out;
- }
- /* Only external links will have a query function registered */
- if(li1.type == H5L_TYPE_EXTERNAL && li2.type == H5L_TYPE_EXTERNAL)
+ /* get type and name of target object */
+ ret = H5tools_get_link_info(file2_id, path2, &linkinfo2);
+ /* dangling link */
+ if (ret == 0)
{
-
- extlinkbuf1 = (char*)HDcalloc(li1.u.val_size, sizeof(char));
- HDassert(extlinkbuf1);
- extlinkbuf2 = (char*)HDcalloc(li2.u.val_size, sizeof(char));
- HDassert(extlinkbuf2);
-
- if(H5Lget_val(file1_id, path1, extlinkbuf1, li1.u.val_size, H5P_DEFAULT) < 0)
- {
- parallel_print("error: unable to get link value from \"%s\"\n",path1);
- goto out;
- } /* end if */
- if(H5Lget_val(file2_id, path2, extlinkbuf2, li2.u.val_size, H5P_DEFAULT) < 0)
+ if (options->no_dangle_links)
{
- parallel_print("error: unable to get link value from \"%s\"\n",path2);
+ /* gangling link is error */
+ if(options->m_verbose)
+ parallel_print("Warning: <%s> is a dangling link.\n", path2);
goto out;
- } /* end if */
+ }
+ else
+ is_dangle_link2=1;
+ }
+ else if (ret < 0)
+ goto out;
+
+ /* found dangling link */
+ if (is_dangle_link1 || is_dangle_link2)
+ goto out2;
+ /* Only external links will have a query function registered */
+ if(linkinfo1.linfo.type == H5L_TYPE_EXTERNAL && linkinfo2.linfo.type == H5L_TYPE_EXTERNAL)
+ {
/* If the buffers are the same size, compare them */
- if(li1.u.val_size == li2.u.val_size)
+ if(linkinfo1.linfo.u.val_size == linkinfo2.linfo.u.val_size)
{
- ret = HDmemcmp(extlinkbuf1, extlinkbuf2, li1.u.val_size);
+ ret = HDmemcmp(linkinfo1.trg_path, linkinfo2.trg_path, linkinfo1.linfo.u.val_size);
}
else
ret = 1;
- /* if "extlinkbuf1" != "extlinkbuf2" then the links are "different" */
+ /* if "linkinfo1.trg_path" != "linkinfo2.trg_path" then the links
+ * are "different" extlinkinfo#.path is combination string of
+ * file_name and obj_name
+ */
nfound = (ret != 0) ? 1 : 0;
if(print_objname(options, nfound))
do_print_objname("external link", path1, path2);
- if (options->linkfollow)
+ if (options->follow_links)
{
- const char *extlink_file1;
- const char *extlink_path1;
- const char *extlink_file2;
- const char *extlink_path2;
-
- /* get file name and obj path */
- if(H5Lunpack_elink_val(extlinkbuf1, li1.u.val_size, NULL, &extlink_file1, &extlink_path1)<0)
+ /* objects are not the same type */
+ if (linkinfo1.trg_type != linkinfo2.trg_type)
{
- parallel_print("error: unable to unpack external link value of obj1\n");
- goto out;
- }
-
- /* get file name and obj path */
- if(H5Lunpack_elink_val(extlinkbuf2, li2.u.val_size, NULL, &extlink_file2, &extlink_path2)<0)
- {
- parallel_print("error: unable to unpack external link value of obj2\n");
+ if (options->m_verbose||options->m_list_not_cmp)
+ {
+ parallel_print("<%s> is of type %s and <%s> is of type %s\n", path1, get_type(linkinfo1.trg_type), path2, get_type(linkinfo2.trg_type));
+ }
+ options->not_cmp=1;
goto out;
}
- nfound = h5diff(extlink_file1, extlink_file2,
- extlink_path1, extlink_path2, options);
+ nfound = diff(file1_id, path1,
+ file2_id, path2,
+ options, linkinfo1.trg_type);
}
- HDfree(extlinkbuf1);
- HDfree(extlinkbuf2);
+ /* free link info buffer */
+ HDfree(linkinfo1.trg_path);
+ HDfree(linkinfo2.trg_path);
} /* end if */
else
{
@@ -1643,7 +1629,8 @@ hsize_t diff(hid_t file1_id,
* If the link classes or the buffer length are not the
* same, the links are "different"
*/
- if((li1.type != li2.type) || (li1.u.val_size != li2.u.val_size))
+ if((linkinfo1.linfo.type != linkinfo2.linfo.type) ||
+ (linkinfo1.linfo.u.val_size != linkinfo2.linfo.u.val_size))
nfound = 1;
else
nfound = 0;
@@ -1671,17 +1658,43 @@ hsize_t diff(hid_t file1_id,
out:
options->err_stat = 1;
- /* free buf used for softlink */
- if (softlinkinfo1.buf)
- HDfree(softlinkinfo1.buf);
- if (softlinkinfo2.buf)
- HDfree(softlinkinfo2.buf);
-
- /* free buf used for softlink */
- if (extlinkbuf1)
- HDfree(extlinkbuf1);
- if (extlinkbuf2)
- HDfree(extlinkbuf2);
+out2:
+ /*-----------------------------------
+ * handle dangling link(s)
+ */
+ /* both path1 and path2 are dangling links */
+ if(is_dangle_link1 && is_dangle_link2)
+ {
+ if(print_objname(options, nfound))
+ {
+ do_print_objname("dangling link", path1, path2);
+ print_found(nfound);
+ }
+ }
+ /* path1 is dangling link */
+ else if (is_dangle_link1)
+ {
+ if(options->m_verbose)
+ parallel_print("obj1 <%s> is a dangling link.\n", path1);
+ nfound++;
+ if(print_objname(options, nfound))
+ print_found(nfound);
+ }
+ /* path2 is dangling link */
+ else if (is_dangle_link2)
+ {
+ if(options->m_verbose)
+ parallel_print("obj2 <%s> is a dangling link.\n", path2);
+ nfound++;
+ if(print_objname(options, nfound))
+ print_found(nfound);
+ }
+
+ /* free link info buffer */
+ if (linkinfo1.trg_path)
+ HDfree(linkinfo1.trg_path);
+ if (linkinfo2.trg_path)
+ HDfree(linkinfo2.trg_path);
/* close */
/* disable error reporting */
diff --git a/tools/lib/h5diff.h b/tools/lib/h5diff.h
index 090d3d9..6718d9a 100644
--- a/tools/lib/h5diff.h
+++ b/tools/lib/h5diff.h
@@ -35,7 +35,8 @@ typedef struct {
double percent; /* relative error value */
int n; /* count, compare up to count */
hsize_t count; /* count value */
- int linkfollow; /* link follow*/
+ int follow_links; /* follow symbolic links */
+ int no_dangle_links; /* return error when find dangling link */
int err_stat; /* an error ocurred (1, error, 0, no error) */
int cmn_objs; /* do we have common objects */
int not_cmp; /* are the objects comparable */
diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c
index 91acb10..48e08a5 100644
--- a/tools/lib/h5diff_array.c
+++ b/tools/lib/h5diff_array.c
@@ -74,7 +74,7 @@
#define ULLI_FORMAT_P_NOTCOMP "%-15"H5_PRINTF_LL_WIDTH"u %-15"H5_PRINTF_LL_WIDTH"u %-15"H5_PRINTF_LL_WIDTH"d not comparable\n"
-/* if system EPSILON is defined, use the system EPSILON; otherwise, use
+/* if system EPSILON is defined, use the system EPSILON; otherwise, use
constants that are close to most EPSILON values */
#ifndef FLT_EPSILON
@@ -167,7 +167,7 @@ static void h5diff_print_char(char ch);
#if H5_SIZEOF_LONG_DOUBLE !=0
typedef enum dtype_t
{
- FLT_FLOAT,
+ FLT_FLOAT,
FLT_DOUBLE,
FLT_LDOUBLE
} dtype_t;
@@ -175,7 +175,7 @@ typedef enum dtype_t
typedef enum dtype_t
{
- FLT_FLOAT,
+ FLT_FLOAT,
FLT_DOUBLE
} dtype_t;
#endif
@@ -227,7 +227,7 @@ hsize_t diff_array( void *_mem1,
if ( rank > 0 )
{
-
+
acc[rank-1]=1;
for(j=(rank-2); j>=0; j--)
{
@@ -275,7 +275,7 @@ hsize_t diff_array( void *_mem1,
*/
case H5T_FLOAT:
-
+
if (H5Tequal(m_type, H5T_NATIVE_FLOAT))
nfound=diff_float(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph);
else if (H5Tequal(m_type, H5T_NATIVE_DOUBLE))
@@ -283,7 +283,7 @@ hsize_t diff_array( void *_mem1,
#if H5_SIZEOF_LONG_DOUBLE !=0
else if (H5Tequal(m_type, H5T_NATIVE_LDOUBLE))
nfound=diff_ldouble(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph);
-#endif
+#endif
break;
case H5T_INTEGER:
@@ -747,7 +747,8 @@ hsize_t diff_datum(void *_mem1,
NULL,
options);
else {
- parallel_print("Warning: Comparison not possible of object types referenced: <%s> and <%s>",
+ if(options->m_verbose)
+ parallel_print("Warning: Comparison not possible of object types referenced: <%s> and <%s>\n",
obj1, obj2);
options->not_cmp = 1;
}
@@ -1862,7 +1863,7 @@ hsize_t diff_datum(void *_mem1,
nfound++;
}
- }
+ }
/* one is NaN, assume difference */
else if ( isnan1==1 || isnan2==1)
{
@@ -1925,7 +1926,7 @@ hsize_t diff_datum(void *_mem1,
nfound++;
}
- }
+ }
/* one is NaN, assume difference */
else if ( isnan1==1 || isnan2==1)
{
@@ -1991,7 +1992,7 @@ hsize_t diff_datum(void *_mem1,
nfound++;
}
- }
+ }
/* one is NaN, assume difference */
else if ( isnan1==1 || isnan2==1)
{
@@ -2074,7 +2075,7 @@ hsize_t diff_datum(void *_mem1,
nfound++;
}
- }
+ }
/* one is NaN, assume difference */
else if ( isnan1==1 || isnan2==1)
{
@@ -2139,7 +2140,7 @@ hsize_t diff_datum(void *_mem1,
nfound++;
}
- }
+ }
/* one is NaN, assume difference */
else if ( isnan1==1 || isnan2==1)
{
@@ -2205,7 +2206,7 @@ hsize_t diff_datum(void *_mem1,
nfound++;
}
- }
+ }
/* one is NaN, assume difference */
else if ( isnan1==1 || isnan2==1)
{
@@ -2889,7 +2890,7 @@ hsize_t diff_float(unsigned char *mem1,
}
nfound++;
}
- }
+ }
/* one is NaN, assume difference */
else if ( isnan1==1 || isnan2==1)
{
@@ -2961,7 +2962,7 @@ hsize_t diff_float(unsigned char *mem1,
}
nfound++;
}
- }
+ }
/* one is NaN, assume difference */
else if ( isnan1==1 || isnan2==1)
{
@@ -3036,7 +3037,7 @@ hsize_t diff_float(unsigned char *mem1,
nfound++;
}
- }
+ }
/* one is NaN, assume difference */
else if ( isnan1==1 || isnan2==1)
{
@@ -3163,7 +3164,7 @@ hsize_t diff_double(unsigned char *mem1,
}
nfound++;
}
- }
+ }
/* one is NaN, assume difference */
else if ( isnan1==1 || isnan2==1)
{
@@ -3235,7 +3236,7 @@ hsize_t diff_double(unsigned char *mem1,
}
nfound++;
}
- }
+ }
/* one is NaN, assume difference */
else if ( isnan1==1 || isnan2==1)
{
@@ -3310,7 +3311,7 @@ hsize_t diff_double(unsigned char *mem1,
nfound++;
}
- }
+ }
/* one is NaN, assume difference */
else if ( isnan1==1 || isnan2==1)
{
@@ -3446,7 +3447,7 @@ hsize_t diff_ldouble(unsigned char *mem1,
}
nfound++;
}
- }
+ }
/* one is NaN, assume difference */
else if ( isnan1==1 || isnan2==1)
{
@@ -3518,7 +3519,7 @@ hsize_t diff_ldouble(unsigned char *mem1,
}
nfound++;
}
- }
+ }
/* one is NaN, assume difference */
else if ( isnan1==1 || isnan2==1)
{
@@ -3593,7 +3594,7 @@ hsize_t diff_ldouble(unsigned char *mem1,
nfound++;
}
- }
+ }
/* one is NaN, assume difference */
else if ( isnan1==1 || isnan2==1)
{
@@ -5511,14 +5512,14 @@ hbool_t equal_double(double value, double expected, diff_opt_t *options)
{
if ( options->do_nans )
{
-
+
/*-------------------------------------------------------------------------
* detect NaNs
*-------------------------------------------------------------------------
*/
int isnan1 = my_isnan(FLT_DOUBLE,&value);
int isnan2 = my_isnan(FLT_DOUBLE,&expected);
-
+
/*-------------------------------------------------------------------------
* we consider NaN == NaN to be true
*-------------------------------------------------------------------------
@@ -5527,7 +5528,7 @@ hbool_t equal_double(double value, double expected, diff_opt_t *options)
{
return TRUE;
}
-
+
/*-------------------------------------------------------------------------
* one is a NaN, do not compare but assume difference
*-------------------------------------------------------------------------
@@ -5535,7 +5536,7 @@ hbool_t equal_double(double value, double expected, diff_opt_t *options)
if ( (isnan1 && !isnan2) || ( !isnan1 && isnan2 ) )
{
return FALSE;
- }
+ }
}
if (value == expected)
@@ -5564,14 +5565,14 @@ hbool_t equal_ldouble(long double value, long double expected, diff_opt_t *optio
{
if ( options->do_nans )
{
-
+
/*-------------------------------------------------------------------------
* detect NaNs
*-------------------------------------------------------------------------
*/
int isnan1 = my_isnan(FLT_LDOUBLE,&value);
int isnan2 = my_isnan(FLT_LDOUBLE,&expected);
-
+
/*-------------------------------------------------------------------------
* we consider NaN == NaN to be true
*-------------------------------------------------------------------------
@@ -5580,7 +5581,7 @@ hbool_t equal_ldouble(long double value, long double expected, diff_opt_t *optio
{
return TRUE;
}
-
+
/*-------------------------------------------------------------------------
* one is a NaN, do not compare but assume difference
*-------------------------------------------------------------------------
@@ -5588,7 +5589,7 @@ hbool_t equal_ldouble(long double value, long double expected, diff_opt_t *optio
if ( (isnan1 && !isnan2) || ( !isnan1 && isnan2 ) )
{
return FALSE;
- }
+ }
}
if (value == expected)
@@ -5603,7 +5604,7 @@ hbool_t equal_ldouble(long double value, long double expected, diff_opt_t *optio
}
#endif /* #if H5_SIZEOF_LONG_DOUBLE !=0 */
-
+
/*-------------------------------------------------------------------------
* Function: equal_float
@@ -5621,14 +5622,14 @@ hbool_t equal_float(float value, float expected, diff_opt_t *options)
{
if ( options->do_nans )
{
-
+
/*-------------------------------------------------------------------------
* detect NaNs
*-------------------------------------------------------------------------
*/
int isnan1 = my_isnan(FLT_FLOAT,&value);
int isnan2 = my_isnan(FLT_FLOAT,&expected);
-
+
/*-------------------------------------------------------------------------
* we consider NaN == NaN to be true
*-------------------------------------------------------------------------
@@ -5637,7 +5638,7 @@ hbool_t equal_float(float value, float expected, diff_opt_t *options)
{
return TRUE;
}
-
+
/*-------------------------------------------------------------------------
* one is a NaN, do not compare but assume difference
*-------------------------------------------------------------------------
@@ -5645,7 +5646,7 @@ hbool_t equal_float(float value, float expected, diff_opt_t *options)
if ( (isnan1 && !isnan2) || ( !isnan1 && isnan2 ) )
{
return FALSE;
- }
+ }
}
if (value == expected)
@@ -5946,13 +5947,13 @@ void print_char_pos( int *ph, /* print header */
parallel_print("[ " );
if ( rank > 0 )
{
-
+
for ( i = 0; i < rank; i++)
{
parallel_print(HSIZE_T_FORMAT, (unsigned long long)pos[i]);
parallel_print(" ");
}
-
+
}
else
{
@@ -5970,8 +5971,8 @@ void print_char_pos( int *ph, /* print header */
*/
static void h5diff_print_char(char ch)
{
-
- switch (ch)
+
+ switch (ch)
{
case '"':
parallel_print("\\\"");
@@ -5999,7 +6000,7 @@ static void h5diff_print_char(char ch)
parallel_print( "%c", ch);
else
parallel_print( "\\%03o", ch);
-
+
break;
}
}
diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c
index 2cc84ca..8e25b6d 100644
--- a/tools/lib/h5diff_dset.c
+++ b/tools/lib/h5diff_dset.c
@@ -44,36 +44,36 @@ hsize_t diff_dataset( hid_t file1_id,
hid_t dcpl1 = -1;
hid_t dcpl2 = -1;
hsize_t nfound = 0;
-
+
/*-------------------------------------------------------------------------
* open the handles
*-------------------------------------------------------------------------
*/
/* disable error reporting */
- H5E_BEGIN_TRY
+ H5E_BEGIN_TRY
{
/* Open the datasets */
- if((did1 = H5Dopen2(file1_id, obj1_name, H5P_DEFAULT)) < 0)
+ if((did1 = H5Dopen2(file1_id, obj1_name, H5P_DEFAULT)) < 0)
{
parallel_print("Cannot open dataset <%s>\n", obj1_name);
goto error;
}
- if((did2 = H5Dopen2(file2_id, obj2_name, H5P_DEFAULT)) < 0)
+ if((did2 = H5Dopen2(file2_id, obj2_name, H5P_DEFAULT)) < 0)
{
parallel_print("Cannot open dataset <%s>\n", obj2_name);
goto error;
}
/* enable error reporting */
} H5E_END_TRY;
-
-
+
+
if((dcpl1 = H5Dget_create_plist(did1)) < 0)
goto error;
if((dcpl2 = H5Dget_create_plist(did2)) < 0)
{
goto error;
}
-
+
/*-------------------------------------------------------------------------
* check if the dataset creation property list has filters that
* are not registered in the current configuration
@@ -103,9 +103,9 @@ hsize_t diff_dataset( hid_t file1_id,
/* enable error reporting */
} H5E_END_TRY;
-
+
return nfound;
-
+
error:
options->err_stat=1;
/* disable error reporting */
@@ -116,7 +116,7 @@ error:
H5Dclose(did2);
/* enable error reporting */
} H5E_END_TRY;
-
+
return nfound;
}
@@ -214,56 +214,56 @@ hsize_t diff_datasetid( hid_t did1,
void *sm_buf2=NULL;
size_t need; /* bytes needed for malloc */
int i;
-
+
/* Get the dataspace handle */
if ( (sid1 = H5Dget_space(did1)) < 0 )
goto error;
-
+
/* Get rank */
if ( (rank1 = H5Sget_simple_extent_ndims(sid1)) < 0 )
goto error;
-
+
/* Get the dataspace handle */
if ( (sid2 = H5Dget_space(did2)) < 0 )
goto error;
-
+
/* Get rank */
if ( (rank2 = H5Sget_simple_extent_ndims(sid2)) < 0 )
goto error;
-
+
/* Get dimensions */
if ( H5Sget_simple_extent_dims(sid1,dims1,maxdim1) < 0 )
goto error;
-
+
/* Get dimensions */
if ( H5Sget_simple_extent_dims(sid2,dims2,maxdim2) < 0 )
{
goto error;
}
-
+
/*-------------------------------------------------------------------------
* get the file data type
*-------------------------------------------------------------------------
*/
-
+
/* Get the data type */
if ( (f_tid1 = H5Dget_type(did1)) < 0 )
goto error;
-
+
/* Get the data type */
if ( (f_tid2 = H5Dget_type(did2)) < 0 )
{
goto error;
}
-
+
/*-------------------------------------------------------------------------
* check for empty datasets
*-------------------------------------------------------------------------
*/
-
+
storage_size1=H5Dget_storage_size(did1);
storage_size2=H5Dget_storage_size(did2);
-
+
if (storage_size1==0 || storage_size2==0)
{
if ( (options->m_verbose||options->m_list_not_cmp) && obj1_name && obj2_name)
@@ -271,12 +271,12 @@ hsize_t diff_datasetid( hid_t did1,
can_compare=0;
options->not_cmp=1;
}
-
+
/*-------------------------------------------------------------------------
* check for comparable TYPE and SPACE
*-------------------------------------------------------------------------
*/
-
+
if (diff_can_type(f_tid1,
f_tid2,
rank1,
@@ -292,46 +292,46 @@ hsize_t diff_datasetid( hid_t did1,
{
can_compare=0;
}
-
+
/*-------------------------------------------------------------------------
* memory type and sizes
*-------------------------------------------------------------------------
*/
if ((m_tid1=h5tools_get_native_type(f_tid1)) < 0)
goto error;
-
+
if ((m_tid2=h5tools_get_native_type(f_tid2)) < 0)
goto error;
-
+
m_size1 = H5Tget_size( m_tid1 );
m_size2 = H5Tget_size( m_tid2 );
-
+
/*-------------------------------------------------------------------------
* check for different signed/unsigned types
*-------------------------------------------------------------------------
*/
-
+
sign1=H5Tget_sign(m_tid1);
sign2=H5Tget_sign(m_tid2);
if ( sign1 != sign2 )
{
- if ((options->m_verbose||options->m_list_not_cmp) && obj1_name && obj2_name)
+ if ((options->m_verbose||options->m_list_not_cmp) && obj1_name && obj2_name)
{
parallel_print("Not comparable: <%s> has sign %s ", obj1_name, get_sign(sign1));
parallel_print("and <%s> has sign %s\n", obj2_name, get_sign(sign2));
}
-
+
can_compare=0;
options->not_cmp=1;
}
-
+
/*-------------------------------------------------------------------------
* only attempt to compare if possible
*-------------------------------------------------------------------------
*/
if (can_compare ) /* it is possible to compare */
{
-
+
/*-------------------------------------------------------------------------
* get number of elements
*-------------------------------------------------------------------------
@@ -341,43 +341,43 @@ hsize_t diff_datasetid( hid_t did1,
{
nelmts1 *= dims1[i];
}
-
+
nelmts2 = 1;
for (i = 0; i < rank2; i++)
{
nelmts2 *= dims2[i];
}
-
+
assert(nelmts1==nelmts2);
-
+
/*-------------------------------------------------------------------------
* "upgrade" the smaller memory size
*-------------------------------------------------------------------------
*/
-
+
if ( m_size1 != m_size2 )
{
if ( m_size1 < m_size2 )
{
H5Tclose(m_tid1);
-
+
if ((m_tid1=h5tools_get_native_type(f_tid2)) < 0)
goto error;
-
+
m_size1 = H5Tget_size( m_tid1 );
}
else
{
H5Tclose(m_tid2);
-
+
if ((m_tid2=h5tools_get_native_type(f_tid1)) < 0)
goto error;
-
+
m_size2 = H5Tget_size( m_tid2 );
}
}
assert(m_size1==m_size2);
-
+
/* print names */
if (obj1_name) {
name1=diff_basename(obj1_name);
@@ -385,27 +385,27 @@ hsize_t diff_datasetid( hid_t did1,
if (obj2_name) {
name2=diff_basename(obj2_name);
}
-
-
+
+
/*-------------------------------------------------------------------------
* read/compare
*-------------------------------------------------------------------------
*/
-
+
need = (size_t)(nelmts1*m_size1); /* bytes needed */
if ( need < H5TOOLS_MALLOCSIZE)
{
buf1 = HDmalloc(need);
buf2 = HDmalloc(need);
}
-
+
if ( buf1!=NULL && buf2!=NULL)
{
if ( H5Dread(did1,m_tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf1) < 0 )
goto error;
if ( H5Dread(did2,m_tid2,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf2) < 0 )
goto error;
-
+
/* array diff */
nfound = diff_array(buf1,
buf2,
@@ -420,39 +420,39 @@ hsize_t diff_datasetid( hid_t did1,
did1,
did2);
}
-
+
else /* possibly not enough memory, read/compare by hyperslabs */
-
+
{
size_t p_type_nbytes = m_size1; /*size of memory type */
hsize_t p_nelmts = nelmts1; /*total selected elmts */
hsize_t elmtno; /*counter */
int carry; /*counter carry value */
unsigned int vl_data = 0; /*contains VL datatypes */
-
+
/* stripmine info */
hsize_t sm_size[H5S_MAX_RANK]; /*stripmine size */
hsize_t sm_nbytes; /*bytes per stripmine */
hsize_t sm_nelmts; /*elements per stripmine*/
hid_t sm_space; /*stripmine data space */
-
+
/* hyperslab info */
hsize_t hs_offset[H5S_MAX_RANK]; /*starting offset */
hsize_t hs_size[H5S_MAX_RANK]; /*size this pass */
hsize_t hs_nelmts; /*elements in request */
hsize_t zero[8]; /*vector of zeros */
-
+
/* check if we have VL data in the dataset's datatype */
if (H5Tdetect_class(m_tid1, H5T_VLEN) == TRUE)
vl_data = TRUE;
-
+
/*
* determine the strip mine size and allocate a buffer. The strip mine is
* a hyperslab whose size is manageable.
*/
sm_nbytes = p_type_nbytes;
-
- for (i = rank1; i > 0; --i)
+
+ for (i = rank1; i > 0; --i)
{
hsize_t size = H5TOOLS_BUFSIZE / sm_nbytes;
if ( size == 0) /* datum size > H5TOOLS_BUFSIZE */
@@ -461,7 +461,7 @@ hsize_t diff_datasetid( hid_t did1,
sm_nbytes *= sm_size[i - 1];
assert(sm_nbytes > 0);
}
-
+
/* malloc return code should be verified.
* If fail, need to handle the error.
* This else branch should be recoded as a separate function.
@@ -473,14 +473,14 @@ hsize_t diff_datasetid( hid_t did1,
assert(sm_buf1);
sm_buf2 = malloc((size_t)sm_nbytes);
assert(sm_buf2);
-
+
sm_nelmts = sm_nbytes / p_type_nbytes;
sm_space = H5Screate_simple(1, &sm_nelmts, NULL);
-
+
/* the stripmine loop */
memset(hs_offset, 0, sizeof hs_offset);
memset(zero, 0, sizeof zero);
-
+
for (elmtno = 0; elmtno < p_nelmts; elmtno += hs_nelmts)
{
/* calculate the hyperslab size */
@@ -505,12 +505,12 @@ hsize_t diff_datasetid( hid_t did1,
H5Sselect_all(sm_space);
hs_nelmts = 1;
} /* rank */
-
+
if ( H5Dread(did1,m_tid1,sm_space,sid1,H5P_DEFAULT,sm_buf1) < 0 )
goto error;
if ( H5Dread(did2,m_tid2,sm_space,sid2,H5P_DEFAULT,sm_buf2) < 0 )
goto error;
-
+
/* get array differences. in the case of hyperslab read, increment the number of differences
found in each hyperslab and pass the position at the beggining for printing */
nfound += diff_array(sm_buf1,
@@ -525,14 +525,14 @@ hsize_t diff_datasetid( hid_t did1,
m_tid1,
did1,
did2);
-
+
/* reclaim any VL memory, if necessary */
if(vl_data)
{
H5Dvlen_reclaim(m_tid1, sm_space, H5P_DEFAULT, sm_buf1);
H5Dvlen_reclaim(m_tid1, sm_space, H5P_DEFAULT, sm_buf2);
}
-
+
/* calculate the next hyperslab offset */
for (i = rank1, carry = 1; i > 0 && carry; --i)
{
@@ -543,27 +543,27 @@ hsize_t diff_datasetid( hid_t did1,
carry = 0;
} /* i */
} /* elmtno */
-
+
H5Sclose(sm_space);
} /* hyperslab read */
}/*can_compare*/
-
+
/*-------------------------------------------------------------------------
* compare attributes
* the if condition refers to cases when the dataset is a referenced object
*-------------------------------------------------------------------------
*/
-
+
if (obj1_name)
{
nfound += diff_attr(did1,did2,obj1_name,obj2_name,options);
}
-
+
/*-------------------------------------------------------------------------
* close
*-------------------------------------------------------------------------
*/
-
+
/* free */
if (buf1!=NULL)
{
@@ -585,7 +585,7 @@ hsize_t diff_datasetid( hid_t did1,
free(sm_buf2);
sm_buf2=NULL;
}
-
+
H5E_BEGIN_TRY {
H5Sclose(sid1);
H5Sclose(sid2);
@@ -594,12 +594,12 @@ hsize_t diff_datasetid( hid_t did1,
H5Tclose(m_tid1);
H5Tclose(m_tid2);
} H5E_END_TRY;
-
+
return nfound;
-
+
error:
options->err_stat=1;
-
+
/* free */
if (buf1!=NULL)
{
@@ -621,7 +621,7 @@ error:
free(sm_buf2);
sm_buf2=NULL;
}
-
+
/* disable error reporting */
H5E_BEGIN_TRY {
H5Sclose(sid1);
@@ -632,7 +632,7 @@ error:
H5Tclose(m_tid2);
/* enable error reporting */
} H5E_END_TRY;
-
+
return nfound;
}
@@ -666,64 +666,64 @@ int diff_can_type( hid_t f_tid1, /* file data type */
diff_opt_t *options,
int is_compound)
{
-
-
+
+
H5T_class_t tclass1;
H5T_class_t tclass2;
int maxdim_diff=0; /* maximum dimensions are different */
int dim_diff=0; /* current dimensions are different */
int i;
int can_compare = 1; /* return value */
-
+
/*-------------------------------------------------------------------------
* check for the same class
*-------------------------------------------------------------------------
*/
-
+
if ((tclass1=H5Tget_class(f_tid1)) < 0)
return -1;
-
+
if ((tclass2=H5Tget_class(f_tid2)) < 0)
return -1;
-
+
if ( tclass1 != tclass2 )
{
if ( (options->m_verbose||options->m_list_not_cmp) && obj1_name && obj2_name)
{
-
+
if ( is_compound )
{
-
+
parallel_print("Not comparable: <%s> has a class %s and <%s> has a class %s\n",
obj1_name, get_class(tclass1),
obj2_name, get_class(tclass2) );
-
+
}
-
+
else
-
+
{
-
+
parallel_print("Not comparable: <%s> is of class %s and <%s> is of class %s\n",
obj1_name, get_class(tclass1),
obj2_name, get_class(tclass2) );
-
+
}
}
-
+
can_compare = 0;
options->not_cmp = 1;
return can_compare;
}
-
+
/*-------------------------------------------------------------------------
* check for non supported classes
*-------------------------------------------------------------------------
*/
-
+
assert(tclass1==tclass2);
switch (tclass1)
{
@@ -737,11 +737,11 @@ int diff_can_type( hid_t f_tid1, /* file data type */
case H5T_ENUM:
case H5T_VLEN:
case H5T_REFERENCE:
-
+
break;
-
+
default: /*H5T_TIME */
-
+
if ( (options->m_verbose||options->m_list_not_cmp) && obj1_name && obj2_name)
{
@@ -752,18 +752,18 @@ int diff_can_type( hid_t f_tid1, /* file data type */
options->not_cmp = 1;
return can_compare;
}
-
+
/*-------------------------------------------------------------------------
* check for equal file datatype; warning only
*-------------------------------------------------------------------------
*/
-
+
if ( (H5Tequal(f_tid1, f_tid2)==0) &&
(options->m_verbose) && obj1_name && obj2_name)
{
-
+
H5T_class_t cl = H5Tget_class(f_tid1);
-
+
parallel_print("Warning: different storage datatype\n");
if ( cl == H5T_INTEGER || cl == H5T_FLOAT )
@@ -777,14 +777,14 @@ int diff_can_type( hid_t f_tid1, /* file data type */
}
-
+
}
-
+
/*-------------------------------------------------------------------------
* check for the same rank
*-------------------------------------------------------------------------
*/
-
+
if ( rank1 != rank2 )
{
@@ -807,12 +807,12 @@ int diff_can_type( hid_t f_tid1, /* file data type */
options->not_cmp = 1;
return can_compare;
}
-
+
/*-------------------------------------------------------------------------
* check for different dimensions
*-------------------------------------------------------------------------
*/
-
+
assert(rank1==rank2);
for ( i=0; i<rank1; i++)
{
@@ -824,19 +824,19 @@ int diff_can_type( hid_t f_tid1, /* file data type */
if ( dims1[i] != dims2[i] )
dim_diff=1;
}
-
+
/*-------------------------------------------------------------------------
* current dimensions
*-------------------------------------------------------------------------
*/
-
+
if (dim_diff==1)
{
if ( (options->m_verbose||options->m_list_not_cmp) && obj1_name && obj2_name)
{
parallel_print("Not comparable: <%s> has rank %d, dimensions ", obj1_name, rank1);
print_dimensions(rank1,dims1);
- if (maxdim1 && maxdim2)
+ if (maxdim1 && maxdim2)
{
parallel_print(", max dimensions ");
print_dimensions(rank1,maxdim1);
@@ -848,7 +848,7 @@ int diff_can_type( hid_t f_tid1, /* file data type */
parallel_print("\n");
}
}
-
+
can_compare = 0;
options->not_cmp = 1;
@@ -857,7 +857,7 @@ int diff_can_type( hid_t f_tid1, /* file data type */
}
-
+
/*-------------------------------------------------------------------------
* maximum dimensions; just give a warning
*-------------------------------------------------------------------------
@@ -878,7 +878,7 @@ int diff_can_type( hid_t f_tid1, /* file data type */
if ( tclass1 == H5T_COMPOUND )
{
-
+
int nmembs1;
int nmembs2;
int j;
@@ -890,7 +890,7 @@ int diff_can_type( hid_t f_tid1, /* file data type */
if ( nmembs1 != nmembs2 )
{
-
+
if ( (options->m_verbose||options->m_list_not_cmp) && obj1_name && obj2_name)
{
parallel_print("Not comparable: <%s> has %d members ", obj1_name, nmembs1);
@@ -902,7 +902,7 @@ int diff_can_type( hid_t f_tid1, /* file data type */
options->not_cmp = 1;
return can_compare;
}
-
+
for (j = 0; j < nmembs1; j++)
{
memb_type1 = H5Tget_member_type(f_tid1, (unsigned)j);
@@ -927,22 +927,22 @@ int diff_can_type( hid_t f_tid1, /* file data type */
H5Tclose(memb_type2);
return can_compare;
}
-
+
H5Tclose(memb_type1);
H5Tclose(memb_type2);
-
+
}
-
-
-
-
-
+
+
+
+
+
}
-
-
-
+
+
+
return can_compare;
}
@@ -966,12 +966,12 @@ void print_sizes( const char *obj1,
{
size_t f_size1, f_size2; /* size of type in file */
size_t m_size1, m_size2; /* size of type in memory */
-
+
f_size1 = H5Tget_size( f_tid1 );
f_size2 = H5Tget_size( f_tid2 );
m_size1 = H5Tget_size( m_tid1 );
m_size2 = H5Tget_size( m_tid2 );
-
+
parallel_print("\n");
parallel_print("------------------\n");
parallel_print("sizeof(char) %u\n", sizeof(char) );
@@ -983,18 +983,18 @@ void print_sizes( const char *obj1,
print_type(f_tid1);
parallel_print("\n");
parallel_print("size on file %u\n", f_size1 );
-
+
parallel_print("type on memory ");
print_type(m_tid1);
parallel_print("\n");
parallel_print("size on memory %u\n", m_size1 );
-
+
parallel_print("<%s> ------------------\n", obj2);
parallel_print("type on file ");
print_type(f_tid2);
parallel_print("\n");
parallel_print("size on file %u\n", f_size2 );
-
+
parallel_print("type on memory ");
print_type(m_tid2);
parallel_print("\n");
diff --git a/tools/lib/h5diff_util.c b/tools/lib/h5diff_util.c
index 1acc493..721c3d7 100644
--- a/tools/lib/h5diff_util.c
+++ b/tools/lib/h5diff_util.c
@@ -106,14 +106,14 @@ print_dimensions (int rank, hsize_t *dims)
if ( rank > 0 )
{
-
+
parallel_print("[" );
for ( i = 0; i < rank-1; i++)
{
parallel_print(HSIZE_T_FORMAT, dims[i]);
parallel_print("x");
}
-
+
parallel_print(HSIZE_T_FORMAT, dims[rank-1]);
parallel_print("]" );
}
diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c
index 7f1019a..e997d03 100644
--- a/tools/lib/h5tools.c
+++ b/tools/lib/h5tools.c
@@ -43,7 +43,7 @@ int bin_output; /* binary output */
int bin_form; /* binary form */
int region_output; /* region output */
-static h5tool_format_t h5tools_dataformat = {
+static h5tool_format_t h5tools_dataformat = {
0, /*raw */
"", /*fmt_raw */
@@ -112,7 +112,7 @@ NULL, /*fmt_ullong */
1 /*escape non printable characters */
};
-static const h5tools_dump_header_t h5tools_standardformat = {
+static const h5tools_dump_header_t h5tools_standardformat = {
"standardformat", /*name */
"HDF5", /*fileebgin */
"", /*fileend */
@@ -217,8 +217,8 @@ hbool_t h5tools_render_region_element(FILE *stream, const h5tool_format_t *info,
hsize_t elmt_counter);
int h5tools_print_region_data_blocks(hid_t region_space, hid_t region_id,
- FILE *stream, const h5tool_format_t *info, h5tools_context_t ctx,
- h5tools_str_t *buffer/*string into which to render */, size_t ncols,
+ FILE *stream, const h5tool_format_t *info, h5tools_context_t ctx,
+ h5tools_str_t *buffer/*string into which to render */, size_t ncols,
int ndims, hid_t type_id, hssize_t nblocks, hsize_t *ptdata);
hbool_t h5tools_dump_region_data_points(hid_t region_space, hid_t region_id,
@@ -230,8 +230,8 @@ hbool_t h5tools_dump_region_data_points(hid_t region_space, hid_t region_id,
hsize_t elmt_counter);
int h5tools_print_region_data_points(hid_t region_space, hid_t region_id,
- FILE *stream, const h5tool_format_t *info, h5tools_context_t ctx,
- h5tools_str_t *buffer, size_t ncols,
+ FILE *stream, const h5tool_format_t *info, h5tools_context_t ctx,
+ h5tools_str_t *buffer, size_t ncols,
int ndims, hid_t type_id, hssize_t npoints, hsize_t *ptdata);
hbool_t h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id,
@@ -299,13 +299,13 @@ void
h5tools_init(void)
{
char lib_str[256];
-
+
if (!h5tools_init_g) {
/* register the error class */
sprintf(lib_str, "%d.%d.%d",H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE);
-
+
H5TOOLS_INIT_ERROR()
-
+
if (!rawdatastream)
rawdatastream = stdout;
@@ -346,7 +346,7 @@ h5tools_close(void)
term_ref_path_table();
H5TOOLS_CLOSE_ERROR()
-
+
/* Shut down the library */
H5close();
@@ -445,7 +445,7 @@ h5tools_get_fapl(hid_t fapl, const char *driver, unsigned *drivernum)
if(drivernum)
*drivernum = MPIO_IDX;
} /* end if */
- }
+ }
else if (!strcmp(driver, drivernames[MPIPOSIX_IDX])) {
/* MPI-I/O Driver */
/* check if MPI has been initialized. */
@@ -727,9 +727,9 @@ h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info,
* None
*-------------------------------------------------------------------------
*/
-static void
+static void
h5tools_region_simple_prefix(FILE *stream, const h5tool_format_t *info,
- h5tools_context_t *ctx, hsize_t elmtno, hsize_t *ptdata, int secnum)
+ h5tools_context_t *ctx, hsize_t elmtno, hsize_t *ptdata, int secnum)
{
h5tools_str_t prefix;
h5tools_str_t str; /*temporary for indentation */
@@ -841,7 +841,7 @@ h5tools_region_simple_prefix(FILE *stream, const h5tool_format_t *info,
* new field sm_pos in h5tools_context_t, the current stripmine element position
*-------------------------------------------------------------------------
*/
-void
+void
h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t container,
h5tools_context_t *ctx/*in,out*/, unsigned flags,
hsize_t nelmts, hid_t type, void *_mem)
@@ -928,13 +928,13 @@ h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t contai
if(H5Sclose(region_space) < 0)
HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed");
} /* end if (region_space >= 0) */
- else
+ else
HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rget_region failed");
if(H5Dclose(region_id) < 0)
HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dclose failed");
} /* if (region_id >= 0) */
- else
+ else
HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rdereference failed");
ctx->need_prefix = TRUE;
@@ -966,17 +966,17 @@ h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t contai
* Purpose: Render an element to output STREAM.
* Description:
* Prints the string buffer to the output STREAM. The string is
- * printed according to the format described in INFO. The CTX struct
- * contains context information shared between calls to this function.
- *
+ * printed according to the format described in INFO. The CTX struct
+ * contains context information shared between calls to this function.
+ *
* Return:
* False if a dimension end is reached, otherwise true
- *
- * In/Out:
+ *
+ * In/Out:
* h5tools_context_t *ctx
* h5tools_str_t *buffer
* hsize_t *curr_pos
- *
+ *
* Parameters Description:
* h5tools_str_t *buffer is the string into which to render
* hsize_t curr_pos is the total data element position
@@ -985,10 +985,10 @@ h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t contai
* hsize_t elmt_count is the data element loop counter
*-------------------------------------------------------------------------
*/
-hbool_t
+hbool_t
h5tools_render_element(FILE *stream, const h5tool_format_t *info,
h5tools_context_t *ctx, h5tools_str_t *buffer, hsize_t *curr_pos,
- size_t ncols, hsize_t local_elmt_counter, hsize_t elmt_counter)
+ size_t ncols, hsize_t local_elmt_counter, hsize_t elmt_counter)
{
hbool_t dimension_break = TRUE;
char *s;
@@ -1002,9 +1002,9 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info,
* If the element would split on multiple lines if printed at our
* current location...
*/
- if (info->line_multi_new == 1 &&
- (ctx->cur_column + h5tools_ncols(s) +
- strlen(OPT(info->elmt_suf2, " ")) +
+ if (info->line_multi_new == 1 &&
+ (ctx->cur_column + h5tools_ncols(s) +
+ strlen(OPT(info->elmt_suf2, " ")) +
strlen(OPT(info->line_suf, ""))) > ncols) {
if (ctx->prev_multiline) {
/*
@@ -1013,8 +1013,8 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info,
*/
ctx->need_prefix = TRUE;
}
- else if ((ctx->prev_prefix_len + h5tools_ncols(s) +
- strlen(OPT(info->elmt_suf2, " ")) +
+ else if ((ctx->prev_prefix_len + h5tools_ncols(s) +
+ strlen(OPT(info->elmt_suf2, " ")) +
strlen(OPT(info->line_suf, ""))) <= ncols) {
/*
* ...but *could* fit on one line otherwise, then we
@@ -1045,11 +1045,11 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info,
* is too long to fit on a line then start this element at the
* beginning of the line.
*/
- if (info->line_multi_new == 1 &&
- ctx->prev_multiline &&
- (ctx->cur_column +
- h5tools_ncols(s) +
- strlen(OPT(info->elmt_suf2, " ")) +
+ if (info->line_multi_new == 1 &&
+ ctx->prev_multiline &&
+ (ctx->cur_column +
+ h5tools_ncols(s) +
+ strlen(OPT(info->elmt_suf2, " ")) +
strlen(OPT(info->line_suf, ""))) > ncols)
ctx->need_prefix = TRUE;
@@ -1066,8 +1066,8 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info,
* one-at a time.
*/
multiline = 0;
- for (secnum = 0, multiline = 0;
- (section = strtok(secnum ? NULL : s, OPTIONAL_LINE_BREAK));
+ for (secnum = 0, multiline = 0;
+ (section = strtok(secnum ? NULL : s, OPTIONAL_LINE_BREAK));
secnum++) {
/*
* If the current section plus possible suffix and end-of-line
@@ -1079,10 +1079,10 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info,
* Added the info->skip_first because the dumper does not want
* this check to happen for the first line
*/
- if ((!info->skip_first || local_elmt_counter) &&
- (ctx->cur_column +
- strlen(section) +
- strlen(OPT(info->elmt_suf2, " ")) +
+ if ((!info->skip_first || local_elmt_counter) &&
+ (ctx->cur_column +
+ strlen(section) +
+ strlen(OPT(info->elmt_suf2, " ")) +
strlen(OPT(info->line_suf, ""))) > ncols)
ctx->need_prefix = 1;
@@ -1122,17 +1122,17 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info,
* Purpose: Render a region element to output STREAM.
* Description:
* Prints the string buffer to the output STREAM. The string is
- * printed according to the format described in INFO. The CTX struct
- * contains context information shared between calls to this function.
- *
+ * printed according to the format described in INFO. The CTX struct
+ * contains context information shared between calls to this function.
+ *
* Return:
* False if a dimension end is reached, otherwise true
- *
- * In/Out:
+ *
+ * In/Out:
* h5tools_context_t *ctx
* h5tools_str_t *buffer
* hsize_t *curr_pos
- *
+ *
* Parameters Description:
* h5tools_str_t *buffer is the string into which to render
* hsize_t curr_pos is the total data element position
@@ -1142,10 +1142,10 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info,
* hsize_t elmt_count is the data element loop counter
*-------------------------------------------------------------------------
*/
-hbool_t
+hbool_t
h5tools_render_region_element(FILE *stream, const h5tool_format_t *info,
h5tools_context_t *ctx, h5tools_str_t *buffer, hsize_t *curr_pos,
- size_t ncols, hsize_t *ptdata, hsize_t local_elmt_counter, hsize_t elmt_counter)
+ size_t ncols, hsize_t *ptdata, hsize_t local_elmt_counter, hsize_t elmt_counter)
{
hbool_t dimension_break = TRUE;
char *s;
@@ -1159,9 +1159,9 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info,
* If the element would split on multiple lines if printed at our
* current location...
*/
- if (info->line_multi_new == 1 &&
- (ctx->cur_column + h5tools_ncols(s) +
- strlen(OPT(info->elmt_suf2, " ")) +
+ if (info->line_multi_new == 1 &&
+ (ctx->cur_column + h5tools_ncols(s) +
+ strlen(OPT(info->elmt_suf2, " ")) +
strlen(OPT(info->line_suf, ""))) > ncols) {
if (ctx->prev_multiline) {
/*
@@ -1170,8 +1170,8 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info,
*/
ctx->need_prefix = TRUE;
}
- else if ((ctx->prev_prefix_len + h5tools_ncols(s) +
- strlen(OPT(info->elmt_suf2, " ")) +
+ else if ((ctx->prev_prefix_len + h5tools_ncols(s) +
+ strlen(OPT(info->elmt_suf2, " ")) +
strlen(OPT(info->line_suf, ""))) <= ncols) {
/*
* ...but *could* fit on one line otherwise, then we
@@ -1202,11 +1202,11 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info,
* is too long to fit on a line then start this element at the
* beginning of the line.
*/
- if (info->line_multi_new == 1 &&
- ctx->prev_multiline &&
- (ctx->cur_column +
- h5tools_ncols(s) +
- strlen(OPT(info->elmt_suf2, " ")) +
+ if (info->line_multi_new == 1 &&
+ ctx->prev_multiline &&
+ (ctx->cur_column +
+ h5tools_ncols(s) +
+ strlen(OPT(info->elmt_suf2, " ")) +
strlen(OPT(info->line_suf, ""))) > ncols)
ctx->need_prefix = TRUE;
@@ -1235,10 +1235,10 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info,
* Added the info->skip_first because the dumper does not want
* this check to happen for the first line
*/
- if ((!info->skip_first || local_elmt_counter) &&
- (ctx->cur_column +
- strlen(section) +
- strlen(OPT(info->elmt_suf2, " ")) +
+ if ((!info->skip_first || local_elmt_counter) &&
+ (ctx->cur_column +
+ strlen(section) +
+ strlen(OPT(info->elmt_suf2, " ")) +
strlen(OPT(info->line_suf, ""))) > ncols)
ctx->need_prefix = 1;
@@ -1276,13 +1276,13 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info,
* Audience: Public
* Chapter: H5Tools Library
* Purpose: Print the data values from a dataset referenced by region blocks.
- *
+ *
* Description:
* This is a special case subfunction to print the data in a region reference of type blocks.
- *
+ *
* Return:
* The function returns FAIL if there was an error, otherwise SUCEED
- *
+ *
* Parameters Description:
* h5tools_str_t *buffer is the string into which to render
* size_t ncols
@@ -1290,10 +1290,10 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info,
* hssize_t nblocks is the number of blocks in the region
*-------------------------------------------------------------------------
*/
-int
+int
h5tools_print_region_data_blocks(hid_t region_space, hid_t region_id,
- FILE *stream, const h5tool_format_t *info, h5tools_context_t ctx,
- h5tools_str_t *buffer/*string into which to render */, size_t ncols,
+ FILE *stream, const h5tool_format_t *info, h5tools_context_t ctx,
+ h5tools_str_t *buffer/*string into which to render */, size_t ncols,
int ndims, hid_t type_id, hssize_t nblocks, hsize_t *ptdata) {
HERR_INIT(int, SUCCEED)
hbool_t dimension_break = TRUE;
@@ -1364,12 +1364,12 @@ h5tools_print_region_data_blocks(hid_t region_space, hid_t region_id,
ctx.indent_level++;
if(H5Sget_simple_extent_dims(mem_space, total_size, NULL) < 0)
HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed");
-
+
/* assume entire data space to be printed */
for (jndx = 0; jndx < (size_t) ctx.ndims; jndx++)
ctx.p_min_idx[jndx] = start[jndx];
init_acc_pos(&ctx, total_size);
-
+
/* print the data */
region_flags = START_OF_DATA;
if (blkndx == nblocks - 1)
@@ -1390,7 +1390,7 @@ h5tools_print_region_data_blocks(hid_t region_space, hid_t region_id,
h5tools_str_reset(buffer);
h5tools_str_append(buffer, "%s", jndx ? OPTIONAL_LINE_BREAK "" : "");
- h5tools_str_sprint(buffer, info, region_id, type_id,
+ h5tools_str_sprint(buffer, info, region_id, type_id,
((char*)region_buf + jndx * type_size), &ctx);
if (jndx + 1 < numelem || (region_flags & END_OF_DATA) == 0)
@@ -1399,7 +1399,7 @@ h5tools_print_region_data_blocks(hid_t region_space, hid_t region_id,
dimension_break = h5tools_render_region_element(stream, info, &ctx, buffer, &curr_pos,
ncols, ptdata, jndx, elmtno);
/* Render the region data element end */
-
+
if(FALSE == dimension_break)
elmtno = 0;
} /* end for (jndx = 0; jndx < numelem; jndx++, region_elmtno++, ctx.cur_elmt++) */
@@ -1412,12 +1412,12 @@ h5tools_print_region_data_blocks(hid_t region_space, hid_t region_id,
HDfree(count);
HDfree(region_buf);
HDfree(dims1);
-
+
if(H5Sclose(mem_space) < 0)
HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed");
if(H5Sclose(sid1) < 0)
HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed");
-
+
CATCH
return ret_value;
}
@@ -1426,17 +1426,17 @@ CATCH
* Audience: Public
* Chapter: H5Tools Library
* Purpose: Print some values from a dataset referenced by region blocks.
- *
+ *
* Description:
* This is a special case subfunction to dump a region reference using blocks.
- *
+ *
* Return:
* The function returns False if the last dimension has been reached, otherwise True
- *
- * In/Out:
+ *
+ * In/Out:
* h5tools_context_t *ctx
* hsize_t *curr_pos
- *
+ *
* Parameters Description:
* h5tools_str_t *buffer is the string into which to render
* hsize_t curr_pos is the total data element position
@@ -1445,7 +1445,7 @@ CATCH
* hsize_t elmt_count is the data element loop counter
*-------------------------------------------------------------------------
*/
-hbool_t
+hbool_t
h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id,
FILE *stream, const h5tool_format_t *info,
h5tools_context_t *ctx/*in,out*/,
@@ -1469,7 +1469,7 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id,
/* Print block information */
if((ndims = H5Sget_simple_extent_ndims(region_space)) < 0)
H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed");
-
+
/* Render the region { element begin */
h5tools_str_reset(buffer);
@@ -1483,7 +1483,7 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id,
ctx->indent_level++;
ctx->need_prefix = TRUE;
h5tools_str_append(buffer, "REGION_TYPE BLOCK ");
-
+
alloc_size = nblocks * ndims * 2 * sizeof(ptdata[0]);
assert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/
if((ptdata = (hsize_t*) malloc((size_t) alloc_size)) == NULL)
@@ -1580,10 +1580,10 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id,
done:
free(ptdata);
-
+
if(H5Tclose(type_id) < 0)
HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed");
-
+
if(H5Tclose(dtype) < 0)
HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed");
@@ -1594,7 +1594,7 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id,
h5tools_str_append(buffer, "%s %s ",
h5tools_dump_header_format->dataend,
h5tools_dump_header_format->datablockend);
- dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos,
+ dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos,
ncols, region_elmt_counter, elmt_counter);
/* Render the dataend element end */
@@ -1604,7 +1604,7 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id,
/* Render the region } element begin */
h5tools_str_reset(buffer);
h5tools_str_append(buffer, "}");
- dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos,
+ dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos,
ncols, region_elmt_counter, elmt_counter);
/* Render the region } element end */
@@ -1618,13 +1618,13 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id,
* Audience: Public
* Chapter: H5Tools Library
* Purpose: Print the data values from a dataset referenced by region points.
- *
+ *
* Description:
* This is a special case subfunction to print the data in a region reference of type points.
- *
+ *
* Return:
* The function returns FAIL on error, otherwise SUCCEED
- *
+ *
* Parameters Description:
* h5tools_str_t *buffer is the string into which to render
* size_t ncols
@@ -1632,10 +1632,10 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id,
* hssize_t npoints is the number of points in the region
*-------------------------------------------------------------------------
*/
-int
+int
h5tools_print_region_data_points(hid_t region_space, hid_t region_id,
- FILE *stream, const h5tool_format_t *info, h5tools_context_t ctx,
- h5tools_str_t *buffer, size_t ncols,
+ FILE *stream, const h5tool_format_t *info, h5tools_context_t ctx,
+ h5tools_str_t *buffer, size_t ncols,
int ndims, hid_t type_id, hssize_t npoints, hsize_t *ptdata) {
HERR_INIT(int, SUCCEED)
hbool_t dimension_break = TRUE;
@@ -1688,7 +1688,7 @@ h5tools_print_region_data_points(hid_t region_space, hid_t region_id,
if (ctx.ndims > 0) {
ctx.size_last_dim = (int) (ctx.p_max_idx[ctx.ndims - 1]);
- }
+ }
else
ctx.size_last_dim = 0;
@@ -1702,17 +1702,17 @@ h5tools_print_region_data_points(hid_t region_space, hid_t region_id,
curr_pos = 0; /* points requires constant 0 */
ctx.sm_pos = jndx * ndims;
-
+
h5tools_region_simple_prefix(stream, info, &ctx, curr_pos, ptdata, 0);
- h5tools_str_sprint(buffer, info, region_id, type_id,
+ h5tools_str_sprint(buffer, info, region_id, type_id,
((char*)region_buf + jndx * type_size), &ctx);
if (jndx + 1 < npoints || (region_flags & END_OF_DATA) == 0)
h5tools_str_append(buffer, "%s", OPT(info->elmt_suf1, ","));
- dimension_break =
- h5tools_render_region_element(stream, info, &ctx, buffer, &curr_pos,
+ dimension_break =
+ h5tools_render_region_element(stream, info, &ctx, buffer, &curr_pos,
ncols, ptdata, 0, elmtno);
/* Render the point element end */
@@ -1724,7 +1724,7 @@ h5tools_print_region_data_points(hid_t region_space, hid_t region_id,
done:
HDfree(region_buf);
HDfree(dims1);
-
+
if(H5Sclose(mem_space) < 0)
HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed");
CATCH
@@ -1735,17 +1735,17 @@ CATCH
* Audience: Public
* Chapter: H5Tools Library
* Purpose: Print some values from a dataset referenced by region points.
- *
+ *
* Description:
* This is a special case subfunction to dump a region reference using points.
- *
+ *
* Return:
* The function returns False if the last dimension has been reached, otherwise True
- *
- * In/Out:
+ *
+ * In/Out:
* h5tools_context_t *ctx
* hsize_t *curr_pos
- *
+ *
* Parameters Description:
* h5tools_str_t *buffer is the string into which to render
* hsize_t curr_pos is the total data element position
@@ -1754,9 +1754,9 @@ CATCH
* hsize_t elmt_count is the data element loop counter
*-------------------------------------------------------------------------
*/
-hbool_t
+hbool_t
h5tools_dump_region_data_points(hid_t region_space, hid_t region_id,
- FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx,
+ FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx,
h5tools_str_t *buffer, hsize_t *curr_pos, size_t ncols, hsize_t region_elmt_counter,
hsize_t elmt_counter) {
HERR_INIT(hbool_t, TRUE)
@@ -1819,7 +1819,7 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id,
if((dtype = H5Dget_type(region_id)) < 0)
HGOTO_ERROR(dimension_break, H5E_tools_min_id_g, "H5Dget_type failed");
-
+
if((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0)
HGOTO_ERROR(dimension_break, H5E_tools_min_id_g, "H5Tget_native_type failed");
@@ -1882,7 +1882,7 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id,
done:
free(ptdata);
-
+
if(H5Tclose(type_id) < 0)
HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed");
@@ -1896,7 +1896,7 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id,
h5tools_str_append(buffer, "%s %s ",
h5tools_dump_header_format->dataend,
h5tools_dump_header_format->datablockend);
- dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos,
+ dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos,
ncols, region_elmt_counter, elmt_counter);
/* Render the dataend element end*/
@@ -1906,7 +1906,7 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id,
/* Render the region } element begin */
h5tools_str_reset(buffer);
h5tools_str_append(buffer, "}");
- dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos,
+ dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos,
ncols, region_elmt_counter, elmt_counter);
/* Render the region } element end */
@@ -1948,7 +1948,7 @@ CATCH
*-------------------------------------------------------------------------
*/
static herr_t
-h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx,
+h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx,
hid_t dset, hid_t p_type, struct subset_t *sset,
hid_t f_space, hsize_t hyperslab_count,
hsize_t *temp_start,/* start inside offset count loop */
@@ -1987,7 +1987,7 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c
for (; hyperslab_count > 0; temp_start[row_dim] += temp_stride[row_dim], hyperslab_count--) {
/* jump rows if size of block exceeded
cases where block > 1 only and stride > block */
- if (size_row_block > 1
+ if (size_row_block > 1
&& row_counter == size_row_block
&& sset->stride[row_dim] > sset->block[row_dim]) {
@@ -2001,7 +2001,7 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c
/* calculate the potential number of elements we're going to print */
if(H5Sselect_hyperslab(f_space, H5S_SELECT_SET, temp_start, temp_stride, temp_count, temp_block) < 0)
H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed");
-
+
if((sm_nelmts = H5Sget_select_npoints(f_space)) < 0)
H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_select_npoints failed");
@@ -2012,7 +2012,7 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c
*/
if((sm_nbytes = p_type_nbytes = H5Tget_size(p_type)) == 0)
H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size failed");
-
+
if (ctx->ndims > 0)
for (i = ctx->ndims; i > 0; --i) {
hsize_t size = H5TOOLS_BUFSIZE / sm_nbytes;
@@ -2022,35 +2022,35 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c
sm_nbytes *= sm_size[i - 1];
assert(sm_nbytes > 0);
}
-
+
assert(sm_nbytes == (hsize_t) ((size_t) sm_nbytes)); /*check for overflow*/
if((sm_buf = HDmalloc((size_t) sm_nelmts * p_type_nbytes)) == NULL)
H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for strip-mine");
-
+
if((sm_space = H5Screate_simple(1, &sm_nelmts, NULL)) < 0)
H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Screate_simple failed");
-
+
if(H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, &zero, NULL, &sm_nelmts, NULL) < 0)
H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed");
-
+
/* read the data */
if(H5Dread(dset, p_type, sm_space, f_space, H5P_DEFAULT, sm_buf) < 0)
H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dread failed");
-
+
/* print the data */
flags = START_OF_DATA;
-
+
if (hyperslab_count == 1)
flags |= END_OF_DATA;
-
+
for (i = 0; i < ctx->ndims; i++)
ctx->p_max_idx[i] = ctx->p_min_idx[i] + MIN(total_size[i], sm_size[i]);
-
+
/* print array indices. get the lower bound of the hyperslab and calulate
the element position at the start of hyperslab */
if(H5Sget_select_bounds(f_space, low, high) < 0)
H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_select_bounds failed");
-
+
elmtno = 0;
for (i = 0; i < (size_t) ctx->ndims - 1; i++) {
hsize_t offset = 1; /* accumulation of the previous dimensions */
@@ -2059,11 +2059,11 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c
elmtno += low[i] * offset;
}
elmtno += low[ctx->ndims - 1];
-
+
/* initialize the current stripmine position; this is necessary to print the array
indices */
ctx->sm_pos = elmtno;
-
+
h5tools_dump_simple_data(stream, info, dset, ctx, flags, sm_nelmts, p_type, sm_buf);
if(H5Sclose(sm_space) < 0)
@@ -2121,7 +2121,7 @@ CATCH
*-------------------------------------------------------------------------
*/
static herr_t
-h5tools_display_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx,
+h5tools_display_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx,
hid_t dset, hid_t p_type, struct subset_t *sset,
hid_t f_space, hsize_t *total_size)
{
@@ -2192,11 +2192,11 @@ h5tools_display_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools
else {
count = 1;
}
-
+
h5tools_print_simple_subset(stream, info, ctx, dset, p_type, sset,
- f_space, count, temp_start, temp_count,
+ f_space, count, temp_start, temp_count,
temp_block, temp_stride, total_size, row_dim);
-
+
if (ctx->ndims > 2) {
/* dimension for start */
current_outer_dim = (ctx->ndims - 2) - 1;
@@ -2337,9 +2337,9 @@ CATCH
* returns FAIL.
*-------------------------------------------------------------------------
*/
-static int
+static int
h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info,
- hid_t dset, hid_t p_type, int indentlevel)
+ hid_t dset, hid_t p_type, int indentlevel)
{
hid_t f_space; /* file data space */
hsize_t elmtno; /* counter */
@@ -2612,9 +2612,9 @@ h5tools_dump_simple_mem(FILE *stream, const h5tool_format_t *info, hid_t obj_id,
*
*-------------------------------------------------------------------------
*/
-int
+int
h5tools_dump_dset(FILE *stream, const h5tool_format_t *info, hid_t dset,
- hid_t _p_type, struct subset_t *sset, int indentlevel)
+ hid_t _p_type, struct subset_t *sset, int indentlevel)
{
hid_t f_space;
hid_t p_type = _p_type;
@@ -2727,9 +2727,9 @@ CATCH
*
*-------------------------------------------------------------------------
*/
-int
-h5tools_print_datatype(h5tools_str_t *buffer, const h5tool_format_t *info,
- h5tools_context_t *ctx, hid_t type)
+int
+h5tools_print_datatype(h5tools_str_t *buffer, const h5tool_format_t *info,
+ h5tools_context_t *ctx, hid_t type)
{
HERR_INIT(int, FAIL)
char *mname;
@@ -3081,7 +3081,7 @@ h5tools_print_datatype(h5tools_str_t *buffer, const h5tool_format_t *info,
case H5T_COMPOUND:
if((nmembers = H5Tget_nmembers(type)) < 0)
H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers failed");
-
+
h5tools_str_append(buffer, "H5T_COMPOUND %s\n", h5tools_dump_header_format->structblockbegin);
for (i = 0; i < nmembers; i++) {
@@ -3089,12 +3089,12 @@ h5tools_print_datatype(h5tools_str_t *buffer, const h5tool_format_t *info,
if((mtype = H5Tget_member_type(type, i))>=0) {
if (H5Tget_class(mtype) == H5T_COMPOUND)
ctx->indent_level++;
-
+
h5tools_print_datatype(buffer, info, ctx, mtype);
-
+
if (H5Tget_class(mtype) == H5T_COMPOUND)
ctx->indent_level--;
-
+
h5tools_str_append(buffer, " \"%s\";\n", mname);
if(H5Tclose(mtype) < 0)
HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed");
@@ -3129,10 +3129,10 @@ h5tools_print_datatype(h5tools_str_t *buffer, const h5tool_format_t *info,
h5tools_print_datatype(buffer, info, ctx, super);
if(H5Tclose(super) < 0)
HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed");
-
+
h5tools_str_append(buffer, ";\n");
h5tools_print_enum(buffer, type);
-
+
ctx->indent_level--;
h5tools_str_append(buffer, "%s", h5tools_dump_header_format->enumblockend);
@@ -3161,7 +3161,7 @@ h5tools_print_datatype(h5tools_str_t *buffer, const h5tool_format_t *info,
/* Print array dimensions */
for (i = 0; i < ndims; i++)
h5tools_str_append(buffer, "[%d]", (int) dims[i]);
-
+
h5tools_str_append(buffer, " ");
}
else
@@ -3206,8 +3206,8 @@ CATCH
*
*-------------------------------------------------------------------------
*/
-int
-h5tools_print_dataspace(h5tools_str_t *buffer, hid_t space)
+int
+h5tools_print_dataspace(h5tools_str_t *buffer, hid_t space)
{
HERR_INIT(int, SUCCEED)
hsize_t size[H5TOOLS_DUMP_MAX_RANK];
@@ -3282,8 +3282,8 @@ CATCH
* h5tools_context_t *ctx
*
*-----------------------------------------------------------------------*/
-int
-h5tools_print_enum(h5tools_str_t *buffer, hid_t type)
+int
+h5tools_print_enum(h5tools_str_t *buffer, hid_t type)
{
HERR_INIT(int, SUCCEED)
char **name = NULL; /*member names */
@@ -3293,7 +3293,7 @@ h5tools_print_enum(h5tools_str_t *buffer, hid_t type)
int nchars; /*number of output characters */
hid_t super = -1; /*enum base integer type */
hid_t native = -1; /*native integer datatype */
- H5T_sign_t sign_type; /*sign of value type */
+ H5T_sign_t sign_type; /*sign of value type */
size_t type_size; /*value type size */
size_t dst_size; /*destination value type size */
int snmembs;
@@ -3303,10 +3303,10 @@ h5tools_print_enum(h5tools_str_t *buffer, hid_t type)
H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers failed");
nmembs = (unsigned)snmembs;
assert(nmembs > 0);
-
+
if((super = H5Tget_super(type)) < 0)
H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_super failed");
-
+
if((type_size = H5Tget_size(type)) <= 0)
H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size(type) failed");
@@ -3410,13 +3410,13 @@ CATCH
* atomic datatype or committed/transient datatype.
*
* Return: void
- *
+ *
* In/Out: h5tools_context_t *ctx
*-------------------------------------------------------------------------
*/
-void
+void
h5tools_dump_datatype(FILE *stream, const h5tool_format_t *info,
- h5tools_context_t *ctx, hid_t type)
+ h5tools_context_t *ctx, hid_t type)
{
size_t ncols = 80; /* available output width */
h5tools_str_t buffer; /* string into which to render */
@@ -3470,8 +3470,8 @@ h5tools_dump_datatype(FILE *stream, const h5tool_format_t *info,
* Return: void
*-------------------------------------------------------------------------
*/
-void
-init_acc_pos(h5tools_context_t *ctx, hsize_t *dims)
+void
+init_acc_pos(h5tools_context_t *ctx, hsize_t *dims)
{
int i;
@@ -3525,7 +3525,7 @@ CATCH
* Failure: FAIL
*-------------------------------------------------------------------------
*/
-static int
+static int
render_bin_output(FILE *stream, hid_t tid, void *_mem)
{
HERR_INIT(int, SUCCEED)
@@ -3880,8 +3880,8 @@ CATCH
* Return: TRUE if all bytes are zero; FALSE otherwise
*-------------------------------------------------------------------------
*/
-static
-hbool_t h5tools_is_zero(const void *_mem, size_t size)
+static
+hbool_t h5tools_is_zero(const void *_mem, size_t size)
{
const unsigned char *mem = (const unsigned char *) _mem;
diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h
index 2b1e4bf..7d207ba 100644
--- a/tools/lib/h5tools.h
+++ b/tools/lib/h5tools.h
@@ -53,9 +53,9 @@
#define H5TOOLS_DUMP_MAX_RANK H5S_MAX_RANK
-/*
- * Strings for output - these were duplicated from the h5dump.h
- * file in order to support region reference data display
+/*
+ * Strings for output - these were duplicated from the h5dump.h
+ * file in order to support region reference data display
*/
#define ATTRIBUTE "ATTRIBUTE"
#define BLOCK "BLOCK"
@@ -105,9 +105,9 @@
#define BEGIN "{"
#define END "}"
-/*
- * dump structure for output - this was duplicated from the h5dump.h
- * file in order to support region reference data display
+/*
+ * dump structure for output - this was duplicated from the h5dump.h
+ * file in order to support region reference data display
*/
typedef struct h5tools_dump_header_t {
const char *name;
@@ -515,7 +515,7 @@ struct subset_t {
hsize_t *block;
};
-/* The following include, h5tools_str.h, must be after the
+/* The following include, h5tools_str.h, must be after the
* above stucts are defined. There is a dependency in the following
* include that hasn't been identified yet. */
@@ -554,11 +554,11 @@ extern int h5tools_canreadf(const char* name,
extern int h5tools_can_encode(H5Z_filter_t filtn);
void init_acc_pos(h5tools_context_t *ctx, hsize_t *dims);
-/*
+/*
* new functions needed to display region reference data
*/
void h5tools_dump_datatype(FILE *stream, const h5tool_format_t *info,
- h5tools_context_t *ctx/*in,out*/, hid_t type);
+ h5tools_context_t *ctx/*in,out*/, hid_t type);
int h5tools_print_dataspace(h5tools_str_t *buffer/*in,out*/, hid_t space);
int h5tools_print_datatype(h5tools_str_t *buffer/*in,out*/,
const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/,
diff --git a/tools/lib/h5tools_error.h b/tools/lib/h5tools_error.h
index dc5f87b..a7c0d3c 100644
--- a/tools/lib/h5tools_error.h
+++ b/tools/lib/h5tools_error.h
@@ -87,7 +87,7 @@ extern hid_t H5E_tools_min_id_g;
}
/*
- * H5E_THROW macro, used to facilitate error reporting within a function body.
+ * H5E_THROW macro, used to facilitate error reporting within a function body.
* The arguments are the minor error number, and an error string.
* The return value is assigned to a variable `ret_value' and control branches
* to the `catch_except' label, if we're not already past it.
@@ -109,8 +109,8 @@ extern hid_t H5E_tools_min_id_g;
}
/*
- * HGOTO_DONE macro, used to facilitate normal return within a function body.
- * The argument is the return value which is assigned to the `ret_value'
+ * HGOTO_DONE macro, used to facilitate normal return within a function body.
+ * The argument is the return value which is assigned to the `ret_value'
* variable. Control branches to the `done' label.
*/
#define HGOTO_DONE(ret_val) {ret_value = ret_val; goto done;}
diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c
index 3567975..55596cd 100644
--- a/tools/lib/h5tools_str.c
+++ b/tools/lib/h5tools_str.c
@@ -350,8 +350,8 @@ h5tools_str_prefix(h5tools_str_t *str/*in,out*/, const h5tool_format_t *info,
*
* Return: Success: Pointer to the prefix.
* Failure: NULL
- *
- * In/Out:
+ *
+ * In/Out:
* h5tools_context_t *ctx
* h5tools_str_t *str
*-------------------------------------------------------------------------
@@ -359,7 +359,7 @@ h5tools_str_prefix(h5tools_str_t *str/*in,out*/, const h5tool_format_t *info,
char *
h5tools_str_region_prefix(h5tools_str_t *str, const h5tool_format_t *info,
hsize_t elmtno, hsize_t *ptdata, unsigned ndims, hsize_t min_idx[], hsize_t max_idx[],
- h5tools_context_t *ctx)
+ h5tools_context_t *ctx)
{
hsize_t p_prod[H5S_MAX_RANK];
size_t i = 0;
@@ -406,15 +406,15 @@ h5tools_str_region_prefix(h5tools_str_t *str, const h5tool_format_t *info,
* the information to the specified string.
*
* Return: none
- *
- * In/Out:
+ *
+ * In/Out:
* h5tools_context_t *ctx
* h5tools_str_t *str
*-------------------------------------------------------------------------
*/
-void
+void
h5tools_str_dump_region_blocks(h5tools_str_t *str, hid_t region,
- const h5tool_format_t *info, h5tools_context_t *ctx)
+ const h5tool_format_t *info, h5tools_context_t *ctx)
{
hssize_t nblocks;
hsize_t alloc_size;
@@ -422,7 +422,7 @@ h5tools_str_dump_region_blocks(h5tools_str_t *str, hid_t region,
int ndims = H5Sget_simple_extent_ndims(region);
/*
- * This function fails if the region does not have blocks.
+ * This function fails if the region does not have blocks.
*/
H5E_BEGIN_TRY {
nblocks = H5Sget_select_hyper_nblocks(region);
@@ -467,15 +467,15 @@ h5tools_str_dump_region_blocks(h5tools_str_t *str, hid_t region,
* the information to the specified string.
*
* Return: none
- *
- * In/Out:
+ *
+ * In/Out:
* h5tools_context_t *ctx
* h5tools_str_t *str
*-------------------------------------------------------------------------
*/
-void
+void
h5tools_str_dump_region_points(h5tools_str_t *str, hid_t region,
- const h5tool_format_t *info, h5tools_context_t *ctx)
+ const h5tool_format_t *info, h5tools_context_t *ctx)
{
hssize_t npoints;
hsize_t alloc_size;
@@ -699,7 +699,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
h5tools_str_append(str, "%Lf", templdouble);
#endif
}
- else if (info->ascii && (H5Tequal(type, H5T_NATIVE_SCHAR) ||
+ else if (info->ascii && (H5Tequal(type, H5T_NATIVE_SCHAR) ||
H5Tequal(type, H5T_NATIVE_UCHAR))) {
h5tools_print_char(str, info, (char) (*ucp_vp));
}
@@ -788,13 +788,13 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
else if (H5Tequal(type, H5T_NATIVE_UINT)) {
HDmemcpy(&tempuint, vp, sizeof(unsigned int));
h5tools_str_append(str, OPT(info->fmt_uint, "%u"), tempuint);
- }
+ }
else if (H5Tequal(type, H5T_NATIVE_SCHAR)) {
h5tools_str_append(str, OPT(info->fmt_schar, "%d"), *cp_vp);
- }
+ }
else if (H5Tequal(type, H5T_NATIVE_UCHAR)) {
h5tools_str_append(str, OPT(info->fmt_uchar, "%u"), *ucp_vp);
- }
+ }
else if (H5Tequal(type, H5T_NATIVE_SHORT)) {
short tempshort;
@@ -1110,9 +1110,9 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
* Return: Nothing
*-------------------------------------------------------------------------
*/
-void
+void
h5tools_str_sprint_region(h5tools_str_t *str, const h5tool_format_t *info,
- hid_t container, void *vp, h5tools_context_t *ctx)
+ hid_t container, void *vp, h5tools_context_t *ctx)
{
hid_t obj, region;
char ref_name[1024];
diff --git a/tools/lib/h5tools_str.h b/tools/lib/h5tools_str.h
index 61b7905..98dd065 100644
--- a/tools/lib/h5tools_str.h
+++ b/tools/lib/h5tools_str.h
@@ -35,7 +35,7 @@ extern char *h5tools_str_fmt(h5tools_str_t *str, size_t start, const char *fm
extern char *h5tools_str_prefix(h5tools_str_t *str, const h5tool_format_t *info,
hsize_t elmtno, unsigned ndims, hsize_t min_idx[],
hsize_t max_idx[], h5tools_context_t *ctx);
-/*
+/*
* new functions needed to display region reference data
*/
extern char *h5tools_str_region_prefix(h5tools_str_t *str, const h5tool_format_t *info,
diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c
index 46b425b..82e9ab9 100644
--- a/tools/lib/h5tools_utils.c
+++ b/tools/lib/h5tools_utils.c
@@ -232,8 +232,8 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti
}
sp = 1;
- }
-
+ }
+
/* wildcard argument */
else if (*cp == '*')
{
@@ -249,16 +249,16 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti
opt_arg = NULL;
}
}
-
- else
+
+ else
{
/* set up to look at next char in token, next time */
if (argv[opt_ind][++sp] == '\0') {
/* no more in current token, so setup next token */
opt_ind++;
sp = 1;
-
-
+
+
}
opt_arg = NULL;
diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c
index 69b4512..287af29 100644
--- a/tools/lib/h5trav.c
+++ b/tools/lib/h5trav.c
@@ -150,7 +150,7 @@ traverse_cb(hid_t loc_id, const char *path, const H5L_info_t *linfo,
if(udata->is_absolute) {
size_t base_len = HDstrlen(udata->base_grp_name);
size_t add_slash = base_len ? ((udata->base_grp_name)[base_len-1] != '/') : 1;
-
+
if(NULL == (new_name = HDmalloc(base_len + add_slash + HDstrlen(path) + 1)))
return(H5_ITER_ERROR);
HDstrcpy(new_name, udata->base_grp_name);
diff --git a/tools/misc/h5debug.c b/tools/misc/h5debug.c
index 27e9741..d79a66a 100644
--- a/tools/misc/h5debug.c
+++ b/tools/misc/h5debug.c
@@ -548,9 +548,9 @@ main(int argc, char *argv[])
HDassert(cls);
/* Check for enough valid parameters */
- if(extra == 0) {
+ if(extra == 0) {
fprintf(stderr, "ERROR: Need object header address containing the layout messagein order to dump header\n");
- fprintf(stderr, "Fixed array header block usage:\n");
+ fprintf(stderr, "Fixed array header block usage:\n");
fprintf(stderr, "\th5debug <filename> <Fixed Array header address> <object header address>\n");
HDexit(4);
} /* end if */