diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2010-01-28 13:11:38 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2010-01-28 13:11:38 (GMT) |
commit | 3360c3af0c100ac4d3a2fe2865f34661da862ec5 (patch) | |
tree | 9caf7dba62679504aa39ec02ebb72d8b8b5a848d /tools | |
parent | 5b4d3279099e7e4fad6e0092c77aa93dfd35d616 (diff) | |
download | hdf5-3360c3af0c100ac4d3a2fe2865f34661da862ec5.zip hdf5-3360c3af0c100ac4d3a2fe2865f34661da862ec5.tar.gz hdf5-3360c3af0c100ac4d3a2fe2865f34661da862ec5.tar.bz2 |
[svn-r18175] Description:
Bring r17986:18172 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')
94 files changed, 1460 insertions, 494 deletions
diff --git a/tools/Makefile.in b/tools/Makefile.in index e482ea2..f403257 100644 --- a/tools/Makefile.in +++ b/tools/Makefile.in @@ -330,12 +330,12 @@ CP = cp # Some machines need a command to run executables; this is that command # so that our tests will run. -# We use RUNTESTS instead of RUNSERIAL directly because it may be that +# We use RUNEXEC instead of RUNSERIAL directly because it may be that # some tests need to be run with a different command. Older versions # of the makefiles used the command # $(LIBTOOL) --mode=execute # in some directories, for instance. -RUNTESTS = $(RUNSERIAL) +RUNEXEC = $(RUNSERIAL) # Libraries to link to while building LIBHDF5 = $(top_builddir)/src/libhdf5.la @@ -845,7 +845,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_: fi; \ echo "============================" >> $${log}; \ srcdir="$(srcdir)" \ - $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ + $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ && touch $(@:.chkexe_=.chkexe) || \ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ (cat $${log} && false) || exit 1; \ @@ -916,7 +916,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS) @for test in $(TEST_PROG_PARA) dummy; do \ if test $$test != dummy; then \ $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \ - RUNTESTS="$(RUNPARALLEL)" || exit 1; \ + RUNEXEC="$(RUNPARALLEL)" || exit 1; \ fi; \ done @for test in $(TEST_SCRIPT_PARA) dummy; do \ diff --git a/tools/h5copy/Makefile.in b/tools/h5copy/Makefile.in index d2a8e0d..113abba 100644 --- a/tools/h5copy/Makefile.in +++ b/tools/h5copy/Makefile.in @@ -322,12 +322,12 @@ CP = cp # Some machines need a command to run executables; this is that command # so that our tests will run. -# We use RUNTESTS instead of RUNSERIAL directly because it may be that +# We use RUNEXEC instead of RUNSERIAL directly because it may be that # some tests need to be run with a different command. Older versions # of the makefiles used the command # $(LIBTOOL) --mode=execute # in some directories, for instance. -RUNTESTS = $(RUNSERIAL) +RUNEXEC = $(RUNSERIAL) # Libraries to link to while building LIBHDF5 = $(top_builddir)/src/libhdf5.la @@ -839,7 +839,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_: fi; \ echo "============================" >> $${log}; \ srcdir="$(srcdir)" \ - $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ + $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ && touch $(@:.chkexe_=.chkexe) || \ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ (cat $${log} && false) || exit 1; \ @@ -910,7 +910,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS) @for test in $(TEST_PROG_PARA) dummy; do \ if test $$test != dummy; then \ $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \ - RUNTESTS="$(RUNPARALLEL)" || exit 1; \ + RUNEXEC="$(RUNPARALLEL)" || exit 1; \ fi; \ done @for test in $(TEST_SCRIPT_PARA) dummy; do \ diff --git a/tools/h5copy/h5copy.c b/tools/h5copy/h5copy.c index f2a41ae..2d5b95d 100644 --- a/tools/h5copy/h5copy.c +++ b/tools/h5copy/h5copy.c @@ -428,7 +428,7 @@ main (int argc, const char *argv[]) h5tools_close(); - return 0; + return EXIT_SUCCESS; error: printf("Error in copy...Exiting\n"); @@ -449,6 +449,6 @@ error: h5tools_close(); - return 1; + return EXIT_FAILURE; } diff --git a/tools/h5copy/testh5copy.sh b/tools/h5copy/testh5copy.sh index b513938..c330602 100644 --- a/tools/h5copy/testh5copy.sh +++ b/tools/h5copy/testh5copy.sh @@ -19,6 +19,10 @@ # Thursday, July 20, 2006 # +TESTNAME=h5copy +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + H5COPY=h5copy # The tool name H5COPY_BIN=`pwd`/$H5COPY # The path of the tool binary H5DIFF=h5diff # The h5diff tool name @@ -304,8 +308,9 @@ echo " " COPYOBJECTS h5copytst_new.h5 if test $nerrors -eq 0 ; then - echo "All h5copy tests passed." + echo "All $TESTNAME tests passed." + exit $EXIT_SUCCESS +else + echo "$TESTNAME tests failed with $nerrors errors." + exit $EXIT_FAILURE fi - -exit $nerrors - diff --git a/tools/h5diff/Makefile.in b/tools/h5diff/Makefile.in index 04a64da..e11ee1f 100644 --- a/tools/h5diff/Makefile.in +++ b/tools/h5diff/Makefile.in @@ -329,12 +329,12 @@ CP = cp # Some machines need a command to run executables; this is that command # so that our tests will run. -# We use RUNTESTS instead of RUNSERIAL directly because it may be that +# We use RUNEXEC instead of RUNSERIAL directly because it may be that # some tests need to be run with a different command. Older versions # of the makefiles used the command # $(LIBTOOL) --mode=execute # in some directories, for instance. -RUNTESTS = $(RUNSERIAL) +RUNEXEC = $(RUNSERIAL) # Libraries to link to while building LIBHDF5 = $(top_builddir)/src/libhdf5.la @@ -860,7 +860,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_: fi; \ echo "============================" >> $${log}; \ srcdir="$(srcdir)" \ - $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ + $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ && touch $(@:.chkexe_=.chkexe) || \ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ (cat $${log} && false) || exit 1; \ @@ -931,7 +931,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS) @for test in $(TEST_PROG_PARA) dummy; do \ if test $$test != dummy; then \ $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \ - RUNTESTS="$(RUNPARALLEL)" || exit 1; \ + RUNEXEC="$(RUNPARALLEL)" || exit 1; \ fi; \ done @for test in $(TEST_SCRIPT_PARA) dummy; do \ diff --git a/tools/h5diff/h5diff_common.c b/tools/h5diff/h5diff_common.c index 3403935..64b0097 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:Nc"; +static const char *s_opts = "hVrvqn:d:p:Ncl"; static struct long_options l_opts[] = { { "help", no_arg, 'h' }, { "version", no_arg, 'V' }, @@ -44,6 +44,7 @@ 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' }, { NULL, 0, '\0' } }; @@ -100,6 +101,9 @@ void parse_command_line(int argc, case 'r': options->m_report = 1; break; + case 'l': + options->linkfollow = 1; + break; case 'd': options->d=1; @@ -360,6 +364,7 @@ void usage(void) 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(" -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"); diff --git a/tools/h5diff/testfiles/h5diff_10.txt b/tools/h5diff/testfiles/h5diff_10.txt index 4788a79..a6b637a 100644 --- a/tools/h5diff/testfiles/h5diff_10.txt +++ b/tools/h5diff/testfiles/h5diff_10.txt @@ -9,6 +9,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]] -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) -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. diff --git a/tools/h5diff/testfiles/h5diff_200.txt b/tools/h5diff/testfiles/h5diff_200.txt index 5a4d02e..56d723d 100644 --- a/tools/h5diff/testfiles/h5diff_200.txt +++ b/tools/h5diff/testfiles/h5diff_200.txt @@ -1,4 +1,3 @@ -dataset: </g2/dset1> and </g2/dset2> -------------------------------- Some objects are not comparable -------------------------------- diff --git a/tools/h5diff/testfiles/h5diff_201.txt b/tools/h5diff/testfiles/h5diff_201.txt index da916ea..84d6766 100644 --- a/tools/h5diff/testfiles/h5diff_201.txt +++ b/tools/h5diff/testfiles/h5diff_201.txt @@ -1,2 +1 @@ -dataset: </g2/dset1> and </g2/dset2> Not comparable: </g2/dset1> or </g2/dset2> is an empty dataset diff --git a/tools/h5diff/testfiles/h5diff_202.txt b/tools/h5diff/testfiles/h5diff_202.txt index 8e3c7ac..fd4a191 100644 --- a/tools/h5diff/testfiles/h5diff_202.txt +++ b/tools/h5diff/testfiles/h5diff_202.txt @@ -1,3 +1,2 @@ -dataset: </g2/dset2> and </g2/dset3> 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 diff --git a/tools/h5diff/testfiles/h5diff_203.txt b/tools/h5diff/testfiles/h5diff_203.txt index 90294e3..496523c 100644 --- a/tools/h5diff/testfiles/h5diff_203.txt +++ b/tools/h5diff/testfiles/h5diff_203.txt @@ -1,3 +1,2 @@ -dataset: </g2/dset3> and </g2/dset4> Not comparable: </g2/dset3> has rank 1, dimensions [6], max dimensions [6] and </g2/dset4> has rank 2, dimensions [3x2], max dimensions [3x2] diff --git a/tools/h5diff/testfiles/h5diff_204.txt b/tools/h5diff/testfiles/h5diff_204.txt index a94091d..098a203 100644 --- a/tools/h5diff/testfiles/h5diff_204.txt +++ b/tools/h5diff/testfiles/h5diff_204.txt @@ -1,3 +1,2 @@ -dataset: </g2/dset4> and </g2/dset5> Not comparable: </g2/dset4> has rank 2, dimensions [3x2], max dimensions [3x2] and </g2/dset5> has rank 2, dimensions [2x2], max dimensions [2x2] diff --git a/tools/h5diff/testfiles/h5diff_205.txt b/tools/h5diff/testfiles/h5diff_205.txt index c3708cb..3e2d1f2 100644 --- a/tools/h5diff/testfiles/h5diff_205.txt +++ b/tools/h5diff/testfiles/h5diff_205.txt @@ -1,4 +1,3 @@ -dataset: </g2/dset5> and </g2/dset6> 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 diff --git a/tools/h5diff/testfiles/h5diff_206.txt b/tools/h5diff/testfiles/h5diff_206.txt index 3557b1e..164aed9 100644 --- a/tools/h5diff/testfiles/h5diff_206.txt +++ b/tools/h5diff/testfiles/h5diff_206.txt @@ -1,2 +1 @@ -dataset: </g2/dset7> and </g2/dset8> Not comparable: </g2/dset7> has a class H5T_FLOAT and </g2/dset8> has a class H5T_INTEGER diff --git a/tools/h5diff/testfiles/h5diff_207.txt b/tools/h5diff/testfiles/h5diff_207.txt index 4dfcbb7..bb8e23f 100644 --- a/tools/h5diff/testfiles/h5diff_207.txt +++ b/tools/h5diff/testfiles/h5diff_207.txt @@ -1,3 +1,2 @@ -dataset: </g2/dset8> and </g2/dset9> Not comparable: </g2/dset8> or </g2/dset9> is an empty dataset Not comparable: </g2/dset8> has 2 members </g2/dset9> has 1 members diff --git a/tools/h5diff/testfiles/h5diff_300.txt b/tools/h5diff/testfiles/h5diff_300.txt new file mode 100755 index 0000000..0cfc01b --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_300.txt @@ -0,0 +1,2 @@ +link : </link_g1> and </link_g2> +1 differences found diff --git a/tools/h5diff/testfiles/h5diff_400.txt b/tools/h5diff/testfiles/h5diff_400.txt new file mode 100644 index 0000000..4b910f5 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_400.txt @@ -0,0 +1,54 @@ + +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: </target_dset1> and </target_dset1> +0 differences found +0 differences found +link : </softlink_dset1_2> and </softlink_dset1_2> +dataset: </target_dset1> and </target_dset1> +0 differences found +0 differences found +link : </softlink_dset2> and </softlink_dset2> +dataset: </target_dset2> and </target_dset2> +0 differences found +0 differences found +link : </softlink_group1> and </softlink_group1> +group : </target_group> and </target_group> +0 differences found +0 differences found +link : </softlink_group2> and </softlink_group2> +group : </target_group> and </target_group> +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 +0 differences found +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 +-------------------------------- +Some objects are not comparable +-------------------------------- +Use -c for a list of objects. diff --git a/tools/h5diff/testfiles/h5diff_401.txt b/tools/h5diff/testfiles/h5diff_401.txt new file mode 100644 index 0000000..5c599e3 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_401.txt @@ -0,0 +1,12 @@ +dataset: </target_dset1> and </target_dset2> +size: [2x4] [2x4] +position target_dset1 target_dset2 difference +------------------------------------------------------------ +[ 0 1 ] 1 0 1 +[ 0 2 ] 2 0 2 +[ 0 3 ] 3 0 3 +[ 1 0 ] 1 0 1 +[ 1 1 ] 2 0 2 +[ 1 2 ] 3 0 3 +[ 1 3 ] 4 0 4 +7 differences found diff --git a/tools/h5diff/testfiles/h5diff_402.txt b/tools/h5diff/testfiles/h5diff_402.txt new file mode 100644 index 0000000..228c8cc --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_402.txt @@ -0,0 +1,12 @@ +dataset: </target_dset2> and </target_dset1> +size: [2x4] [2x4] +position target_dset2 target_dset1 difference +------------------------------------------------------------ +[ 0 1 ] 0 1 1 +[ 0 2 ] 0 2 2 +[ 0 3 ] 0 3 3 +[ 1 0 ] 0 1 1 +[ 1 1 ] 0 2 2 +[ 1 2 ] 0 3 3 +[ 1 3 ] 0 4 4 +7 differences found diff --git a/tools/h5diff/testfiles/h5diff_403.txt b/tools/h5diff/testfiles/h5diff_403.txt new file mode 100644 index 0000000..5c599e3 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_403.txt @@ -0,0 +1,12 @@ +dataset: </target_dset1> and </target_dset2> +size: [2x4] [2x4] +position target_dset1 target_dset2 difference +------------------------------------------------------------ +[ 0 1 ] 1 0 1 +[ 0 2 ] 2 0 2 +[ 0 3 ] 3 0 3 +[ 1 0 ] 1 0 1 +[ 1 1 ] 2 0 2 +[ 1 2 ] 3 0 3 +[ 1 3 ] 4 0 4 +7 differences found diff --git a/tools/h5diff/testfiles/h5diff_404.txt b/tools/h5diff/testfiles/h5diff_404.txt new file mode 100644 index 0000000..2a0b856 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_404.txt @@ -0,0 +1,36 @@ + +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: </target_group/x_dset> and </target_group/x_dset> +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> +0 differences found +0 differences found +external link: </ext_link_grp1> and </ext_link_grp1> +group : </target_group> and </target_group> +0 differences found +0 differences found +external link: </ext_link_grp2> and </ext_link_grp2> +group : </target_group2> and </target_group2> +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> +0 differences found +external link: </ext_link_noexist2> and </ext_link_noexist2> +h5diff: <no_file.h5>: unable to open file +0 differences found diff --git a/tools/h5diff/testfiles/h5diff_405.txt b/tools/h5diff/testfiles/h5diff_405.txt new file mode 100644 index 0000000..edbf22a --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_405.txt @@ -0,0 +1,12 @@ +dataset: </target_group/x_dset> and </target_group2/x_dset> +size: [2x4] [2x4] +position x_dset x_dset difference +------------------------------------------------------------ +[ 0 1 ] 1 0 1 +[ 0 2 ] 2 0 2 +[ 0 3 ] 3 0 3 +[ 1 0 ] 1 0 1 +[ 1 1 ] 2 0 2 +[ 1 2 ] 3 0 3 +[ 1 3 ] 4 0 4 +7 differences found diff --git a/tools/h5diff/testfiles/h5diff_406.txt b/tools/h5diff/testfiles/h5diff_406.txt new file mode 100644 index 0000000..7c5eb3e --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_406.txt @@ -0,0 +1,12 @@ +dataset: </target_group2/x_dset> and </target_group/x_dset> +size: [2x4] [2x4] +position x_dset x_dset difference +------------------------------------------------------------ +[ 0 1 ] 0 1 1 +[ 0 2 ] 0 2 2 +[ 0 3 ] 0 3 3 +[ 1 0 ] 0 1 1 +[ 1 1 ] 0 2 2 +[ 1 2 ] 0 3 3 +[ 1 3 ] 0 4 4 +7 differences found diff --git a/tools/h5diff/testfiles/h5diff_407.txt b/tools/h5diff/testfiles/h5diff_407.txt new file mode 100644 index 0000000..edbf22a --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_407.txt @@ -0,0 +1,12 @@ +dataset: </target_group/x_dset> and </target_group2/x_dset> +size: [2x4] [2x4] +position x_dset x_dset difference +------------------------------------------------------------ +[ 0 1 ] 1 0 1 +[ 0 2 ] 2 0 2 +[ 0 3 ] 3 0 3 +[ 1 0 ] 1 0 1 +[ 1 1 ] 2 0 2 +[ 1 2 ] 3 0 3 +[ 1 3 ] 4 0 4 +7 differences found diff --git a/tools/h5diff/testfiles/h5diff_408.txt b/tools/h5diff/testfiles/h5diff_408.txt new file mode 100644 index 0000000..11a928a --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_408.txt @@ -0,0 +1,12 @@ +dataset: </target_dset1> and </target_group2/x_dset> +size: [2x4] [2x4] +position target_dset1 x_dset difference +------------------------------------------------------------ +[ 0 1 ] 1 0 1 +[ 0 2 ] 2 0 2 +[ 0 3 ] 3 0 3 +[ 1 0 ] 1 0 1 +[ 1 1 ] 2 0 2 +[ 1 2 ] 3 0 3 +[ 1 3 ] 4 0 4 +7 differences found diff --git a/tools/h5diff/testfiles/h5diff_409.txt b/tools/h5diff/testfiles/h5diff_409.txt new file mode 100644 index 0000000..3b95e7c --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_409.txt @@ -0,0 +1,12 @@ +dataset: </target_group2/x_dset> and </target_dset1> +size: [2x4] [2x4] +position x_dset target_dset1 difference +------------------------------------------------------------ +[ 0 1 ] 0 1 1 +[ 0 2 ] 0 2 2 +[ 0 3 ] 0 3 3 +[ 1 0 ] 0 1 1 +[ 1 1 ] 0 2 2 +[ 1 2 ] 0 3 3 +[ 1 3 ] 0 4 4 +7 differences found diff --git a/tools/h5diff/testfiles/h5diff_410.txt b/tools/h5diff/testfiles/h5diff_410.txt new file mode 100644 index 0000000..8c645d2 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_410.txt @@ -0,0 +1,85 @@ + +file1 file2 +--------------------------------------- + x x / + x x /softlink1_to_dset1 + x x /softlink1_to_slink1 + x x /softlink1_to_slink2 + x x /softlink2_to_dset2 + x x /softlink2_to_slink1 + x x /softlink2_to_slink2 + x x /softlink3_to_group1 + x x /softlink3_to_slink1 + x x /softlink3_to_slink2 + x x /softlink4_to_group2 + x x /softlink4_to_slink1 + x x /softlink4_to_slink2 + x x /target_dset1 + x x /target_dset2 + x x /target_group + x x /target_group/dset + x x /target_group1 + x x /target_group2 + +group : </> and </> +0 differences found +link : </softlink1_to_dset1> and </softlink1_to_dset1> +dataset: </target_dset1> and </target_dset1> +0 differences found +0 differences found +link : </softlink1_to_slink1> and </softlink1_to_slink1> +dataset: <softlink1_to_dset1> and <softlink1_to_dset1> +0 differences found +0 differences found +link : </softlink1_to_slink2> and </softlink1_to_slink2> +dataset: <softlink1_to_slink1> and <softlink1_to_slink1> +0 differences found +0 differences found +link : </softlink2_to_dset2> and </softlink2_to_dset2> +dataset: </target_dset2> and </target_dset2> +0 differences found +0 differences found +link : </softlink2_to_slink1> and </softlink2_to_slink1> +dataset: <softlink2_to_dset2> and <softlink2_to_dset2> +0 differences found +0 differences found +link : </softlink2_to_slink2> and </softlink2_to_slink2> +dataset: <softlink2_to_slink1> and <softlink2_to_slink1> +0 differences found +0 differences found +link : </softlink3_to_group1> and </softlink3_to_group1> +group : <target_group1> and <target_group1> +0 differences found +0 differences found +link : </softlink3_to_slink1> and </softlink3_to_slink1> +group : <softlink3_to_group1> and <softlink3_to_group1> +0 differences found +0 differences found +link : </softlink3_to_slink2> and </softlink3_to_slink2> +group : <softlink3_to_slink1> and <softlink3_to_slink1> +0 differences found +0 differences found +link : </softlink4_to_group2> and </softlink4_to_group2> +group : <target_group2> and <target_group2> +0 differences found +0 differences found +link : </softlink4_to_slink1> and </softlink4_to_slink1> +group : <softlink4_to_group2> and <softlink4_to_group2> +0 differences found +0 differences found +link : </softlink4_to_slink2> and </softlink4_to_slink2> +group : <softlink4_to_slink1> and <softlink4_to_slink1> +0 differences found +0 differences found +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 +group : </target_group1> and </target_group1> +0 differences found +group : </target_group2> and </target_group2> +0 differences found diff --git a/tools/h5diff/testfiles/h5diff_411.txt b/tools/h5diff/testfiles/h5diff_411.txt new file mode 100644 index 0000000..2775677 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_411.txt @@ -0,0 +1,12 @@ +dataset: </target_dset2> and <softlink1_to_slink1> +size: [2x4] [2x4] +position target_dset2 softlink1_to_slink1 difference +------------------------------------------------------------ +[ 0 1 ] 0 1 1 +[ 0 2 ] 0 2 2 +[ 0 3 ] 0 3 3 +[ 1 0 ] 0 1 1 +[ 1 1 ] 0 2 2 +[ 1 2 ] 0 3 3 +[ 1 3 ] 0 4 4 +7 differences found diff --git a/tools/h5diff/testfiles/h5diff_412.txt b/tools/h5diff/testfiles/h5diff_412.txt new file mode 100644 index 0000000..0924099 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_412.txt @@ -0,0 +1,12 @@ +dataset: <softlink1_to_slink1> and </target_dset2> +size: [2x4] [2x4] +position softlink1_to_slink1 target_dset2 difference +------------------------------------------------------------ +[ 0 1 ] 1 0 1 +[ 0 2 ] 2 0 2 +[ 0 3 ] 3 0 3 +[ 1 0 ] 1 0 1 +[ 1 1 ] 2 0 2 +[ 1 2 ] 3 0 3 +[ 1 3 ] 4 0 4 +7 differences found diff --git a/tools/h5diff/testfiles/h5diff_413.txt b/tools/h5diff/testfiles/h5diff_413.txt new file mode 100644 index 0000000..ae6cfea --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_413.txt @@ -0,0 +1,12 @@ +dataset: <softlink1_to_slink1> and <softlink2_to_slink1> +size: [2x4] [2x4] +position softlink1_to_slink1 softlink2_to_slink1 difference +------------------------------------------------------------ +[ 0 1 ] 1 0 1 +[ 0 2 ] 2 0 2 +[ 0 3 ] 3 0 3 +[ 1 0 ] 1 0 1 +[ 1 1 ] 2 0 2 +[ 1 2 ] 3 0 3 +[ 1 3 ] 4 0 4 +7 differences found diff --git a/tools/h5diff/testfiles/h5diff_414.txt b/tools/h5diff/testfiles/h5diff_414.txt new file mode 100644 index 0000000..0f07a14 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_414.txt @@ -0,0 +1,2 @@ +group : </target_group> and <softlink3_to_slink1> +1 differences found diff --git a/tools/h5diff/testfiles/h5diff_415.txt b/tools/h5diff/testfiles/h5diff_415.txt new file mode 100644 index 0000000..3a9d863 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_415.txt @@ -0,0 +1,2 @@ +group : <softlink3_to_slink1> and </target_group> +1 differences found diff --git a/tools/h5diff/testfiles/h5diff_416.txt b/tools/h5diff/testfiles/h5diff_416.txt new file mode 100644 index 0000000..39d88bc --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_416.txt @@ -0,0 +1,2 @@ +group : <softlink3_to_slink1> and <softlink4_to_slink1> +1 differences found diff --git a/tools/h5diff/testfiles/h5diff_417.txt b/tools/h5diff/testfiles/h5diff_417.txt new file mode 100644 index 0000000..56031e9 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_417.txt @@ -0,0 +1,6 @@ +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. diff --git a/tools/h5diff/testfiles/h5diff_418.txt b/tools/h5diff/testfiles/h5diff_418.txt new file mode 100644 index 0000000..0222174 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_418.txt @@ -0,0 +1,6 @@ +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. diff --git a/tools/h5diff/testfiles/h5diff_419.txt b/tools/h5diff/testfiles/h5diff_419.txt new file mode 100644 index 0000000..836e95f --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_419.txt @@ -0,0 +1,2 @@ +error: <no_file.h5>: unable to open file +error: unable to get external link info from "/ext_link_noexist2" diff --git a/tools/h5diff/testfiles/h5diff_420.txt b/tools/h5diff/testfiles/h5diff_420.txt new file mode 100644 index 0000000..836e95f --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_420.txt @@ -0,0 +1,2 @@ +error: <no_file.h5>: unable to open file +error: unable to get external link info from "/ext_link_noexist2" diff --git a/tools/h5diff/testfiles/h5diff_421.txt b/tools/h5diff/testfiles/h5diff_421.txt new file mode 100644 index 0000000..c686b69 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_421.txt @@ -0,0 +1,2 @@ +error: "/no_obj" doesn't exist +error: unable to get external link info from "/ext_link_noexist1" diff --git a/tools/h5diff/testfiles/h5diff_422.txt b/tools/h5diff/testfiles/h5diff_422.txt new file mode 100644 index 0000000..c686b69 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_422.txt @@ -0,0 +1,2 @@ +error: "/no_obj" doesn't exist +error: unable to get external link info from "/ext_link_noexist1" diff --git a/tools/h5diff/testfiles/h5diff_423.txt b/tools/h5diff/testfiles/h5diff_423.txt new file mode 100644 index 0000000..5eb6766 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_423.txt @@ -0,0 +1,12 @@ +dataset: </dset1> and </dset2> +size: [2x4] [2x4] +position dset1 dset2 difference +------------------------------------------------------------ +[ 0 1 ] 0 1 1 +[ 0 2 ] 0 2 2 +[ 0 3 ] 0 3 3 +[ 1 0 ] 0 1 1 +[ 1 1 ] 0 2 2 +[ 1 2 ] 0 3 3 +[ 1 3 ] 0 4 4 +7 differences found diff --git a/tools/h5diff/testfiles/h5diff_424.txt b/tools/h5diff/testfiles/h5diff_424.txt new file mode 100644 index 0000000..cd240cf --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_424.txt @@ -0,0 +1,12 @@ +dataset: </dset2> and </dset1> +size: [2x4] [2x4] +position dset2 dset1 difference +------------------------------------------------------------ +[ 0 1 ] 1 0 1 +[ 0 2 ] 2 0 2 +[ 0 3 ] 3 0 3 +[ 1 0 ] 1 0 1 +[ 1 1 ] 2 0 2 +[ 1 2 ] 3 0 3 +[ 1 3 ] 4 0 4 +7 differences found diff --git a/tools/h5diff/testfiles/h5diff_425.txt b/tools/h5diff/testfiles/h5diff_425.txt new file mode 100644 index 0000000..5eb6766 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_425.txt @@ -0,0 +1,12 @@ +dataset: </dset1> and </dset2> +size: [2x4] [2x4] +position dset1 dset2 difference +------------------------------------------------------------ +[ 0 1 ] 0 1 1 +[ 0 2 ] 0 2 2 +[ 0 3 ] 0 3 3 +[ 1 0 ] 0 1 1 +[ 1 1 ] 0 2 2 +[ 1 2 ] 0 3 3 +[ 1 3 ] 0 4 4 +7 differences found diff --git a/tools/h5diff/testfiles/h5diff_600.txt b/tools/h5diff/testfiles/h5diff_600.txt index 82c5240..376e530 100644 --- a/tools/h5diff/testfiles/h5diff_600.txt +++ b/tools/h5diff/testfiles/h5diff_600.txt @@ -9,6 +9,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]] -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) -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. diff --git a/tools/h5diff/testfiles/h5diff_603.txt b/tools/h5diff/testfiles/h5diff_603.txt index e115114..f8a858d 100644 --- a/tools/h5diff/testfiles/h5diff_603.txt +++ b/tools/h5diff/testfiles/h5diff_603.txt @@ -10,6 +10,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]] -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) -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. diff --git a/tools/h5diff/testfiles/h5diff_606.txt b/tools/h5diff/testfiles/h5diff_606.txt index db361fd..ab317bd 100644 --- a/tools/h5diff/testfiles/h5diff_606.txt +++ b/tools/h5diff/testfiles/h5diff_606.txt @@ -10,6 +10,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]] -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) -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. diff --git a/tools/h5diff/testfiles/h5diff_609.txt b/tools/h5diff/testfiles/h5diff_609.txt index 9369dd9..e69de29 100644 --- a/tools/h5diff/testfiles/h5diff_609.txt +++ b/tools/h5diff/testfiles/h5diff_609.txt @@ -1,2 +0,0 @@ -dataset: </g1/dset3> and </g1/dset4> -0 differences found diff --git a/tools/h5diff/testfiles/h5diff_612.txt b/tools/h5diff/testfiles/h5diff_612.txt index bbd6b00..875e17e 100644 --- a/tools/h5diff/testfiles/h5diff_612.txt +++ b/tools/h5diff/testfiles/h5diff_612.txt @@ -10,6 +10,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]] -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) -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. diff --git a/tools/h5diff/testfiles/h5diff_615.txt b/tools/h5diff/testfiles/h5diff_615.txt index 9c8f0c7..258124a 100644 --- a/tools/h5diff/testfiles/h5diff_615.txt +++ b/tools/h5diff/testfiles/h5diff_615.txt @@ -10,6 +10,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]] -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) -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. diff --git a/tools/h5diff/testfiles/h5diff_618.txt b/tools/h5diff/testfiles/h5diff_618.txt index 9369dd9..e69de29 100644 --- a/tools/h5diff/testfiles/h5diff_618.txt +++ b/tools/h5diff/testfiles/h5diff_618.txt @@ -1,2 +0,0 @@ -dataset: </g1/dset3> and </g1/dset4> -0 differences found diff --git a/tools/h5diff/testfiles/h5diff_621.txt b/tools/h5diff/testfiles/h5diff_621.txt index 79eebed..1fd7f08 100644 --- a/tools/h5diff/testfiles/h5diff_621.txt +++ b/tools/h5diff/testfiles/h5diff_621.txt @@ -10,6 +10,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]] -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) -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. diff --git a/tools/h5diff/testfiles/h5diff_622.txt b/tools/h5diff/testfiles/h5diff_622.txt index 09de51d..bf15c2a 100644 --- a/tools/h5diff/testfiles/h5diff_622.txt +++ b/tools/h5diff/testfiles/h5diff_622.txt @@ -10,6 +10,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]] -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) -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. diff --git a/tools/h5diff/testfiles/h5diff_623.txt b/tools/h5diff/testfiles/h5diff_623.txt index dc60b94..5186dcc 100644 --- a/tools/h5diff/testfiles/h5diff_623.txt +++ b/tools/h5diff/testfiles/h5diff_623.txt @@ -10,6 +10,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]] -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) -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. diff --git a/tools/h5diff/testfiles/h5diff_624.txt b/tools/h5diff/testfiles/h5diff_624.txt index 016ab77..d646a25 100644 --- a/tools/h5diff/testfiles/h5diff_624.txt +++ b/tools/h5diff/testfiles/h5diff_624.txt @@ -10,6 +10,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]] -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) -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. diff --git a/tools/h5diff/testfiles/h5diff_ext2softlink_src.h5 b/tools/h5diff/testfiles/h5diff_ext2softlink_src.h5 Binary files differnew file mode 100644 index 0000000..50b7d2b --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_ext2softlink_src.h5 diff --git a/tools/h5diff/testfiles/h5diff_ext2softlink_trg.h5 b/tools/h5diff/testfiles/h5diff_ext2softlink_trg.h5 Binary files differnew file mode 100644 index 0000000..610e890 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_ext2softlink_trg.h5 diff --git a/tools/h5diff/testfiles/h5diff_extlink_src.h5 b/tools/h5diff/testfiles/h5diff_extlink_src.h5 Binary files differnew file mode 100644 index 0000000..cfc1066 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_extlink_src.h5 diff --git a/tools/h5diff/testfiles/h5diff_extlink_trg.h5 b/tools/h5diff/testfiles/h5diff_extlink_trg.h5 Binary files differnew file mode 100644 index 0000000..3a322c9 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_extlink_trg.h5 diff --git a/tools/h5diff/testfiles/h5diff_linked_softlink.h5 b/tools/h5diff/testfiles/h5diff_linked_softlink.h5 Binary files differnew file mode 100644 index 0000000..03c5dee --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_linked_softlink.h5 diff --git a/tools/h5diff/testfiles/h5diff_links.h5 b/tools/h5diff/testfiles/h5diff_links.h5 Binary files differnew file mode 100755 index 0000000..8af66a6 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_links.h5 diff --git a/tools/h5diff/testfiles/h5diff_softlinks.h5 b/tools/h5diff/testfiles/h5diff_softlinks.h5 Binary files differnew file mode 100644 index 0000000..67a843d --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_softlinks.h5 diff --git a/tools/h5diff/testh5diff.sh b/tools/h5diff/testh5diff.sh index f316d7c..247e3e1 100755 --- a/tools/h5diff/testh5diff.sh +++ b/tools/h5diff/testh5diff.sh @@ -29,36 +29,30 @@ ## test file names ############################################################################### -INDIR=$srcdir/testfiles - -SRCFILE1=h5diff_basic1.h5 -SRCFILE2=h5diff_basic2.h5 -SRCFILE3=h5diff_types.h5 -SRCFILE4=h5diff_dtypes.h5 -SRCFILE5=h5diff_attr1.h5 -SRCFILE6=h5diff_attr2.h5 -SRCFILE7=h5diff_dset1.h5 -SRCFILE8=h5diff_dset2.h5 -SRCFILE9=h5diff_hyper1.h5 -SRCFILE10=h5diff_hyper2.h5 -SRCFILE11=h5diff_empty.h5 -SRCFILE12=h5diff_dset_idx1.h5 -SRCFILE13=h5diff_dset_idx2.h5 - -FILE1="$INDIR/$SRCFILE1" -FILE2="$INDIR/$SRCFILE2" -FILE3="$INDIR/$SRCFILE3" -FILE4="$INDIR/$SRCFILE4" -FILE5="$INDIR/$SRCFILE5" -FILE6="$INDIR/$SRCFILE6" -FILE7="$INDIR/$SRCFILE7" -FILE8="$INDIR/$SRCFILE8" -FILE9="$INDIR/$SRCFILE9" -FILE10="$INDIR/$SRCFILE10" -FILE11="$INDIR/$SRCFILE11" -FILE12="$INDIR/$SRCFILE12" -FILE13="$INDIR/$SRCFILE13" - +FILE1=h5diff_basic1.h5 +FILE2=h5diff_basic2.h5 +FILE3=h5diff_types.h5 +FILE4=h5diff_dtypes.h5 +FILE5=h5diff_attr1.h5 +FILE6=h5diff_attr2.h5 +FILE7=h5diff_dset1.h5 +FILE8=h5diff_dset2.h5 +FILE9=h5diff_hyper1.h5 +FILE10=h5diff_hyper2.h5 +FILE11=h5diff_empty.h5 +FILE12=h5diff_links.h5 +FILE13=h5diff_softlinks.h5 +FILE14=h5diff_linked_softlink.h5 +FILE15=h5diff_extlink_src.h5 +FILE16=h5diff_extlink_trg.h5 +FILE17=h5diff_ext2softlink_src.h5 +FILE18=h5diff_ext2softlink_trg.h5 +FILE19=h5diff_dset_idx1.h5 +FILE20=h5diff_dset_idx2.h5 + +TESTNAME=h5diff +EXIT_SUCCESS=0 +EXIT_FAILURE=1 H5DIFF=h5diff # The tool name H5DIFF_BIN=`pwd`/$H5DIFF # The path of the tool binary @@ -84,6 +78,7 @@ test -d ./testfiles || mkdir ./testfiles while [ $# -gt 0 ]; do case "$1" in -p) # reset the tool name and bin to run ph5diff tests + TESTNAME=ph5diff H5DIFF=ph5diff # The tool name H5DIFF_BIN=`pwd`/$H5DIFF pmode=yes @@ -205,11 +200,12 @@ TOOLTEST() { fi # Run test. + TESTING $H5DIFF $@ ( #echo "#############################" #echo "Expected output for '$H5DIFF $@'" #echo "#############################" - #cd $srcdir/testfiles + cd $srcdir/testfiles eval $RUNCMD $H5DIFF_BIN "$@" ) >$actual 2>$actual_err # save actual and actual_err in case they are needed later. @@ -258,8 +254,8 @@ TOOLTEST() { # Clean up output file if test -z "$HDF5_NOCLEANUP"; then - rm -f $actual $actual_err $actual_sav $actual_err_sav - rm -f $actual_sorted $expect_sorted + rm -f $actual $actual_err $actual_sav $actual_err_sav + rm -f $actual_sorted $expect_sorted fi } @@ -285,55 +281,42 @@ SKIP() { # 1.0 -TESTING $H5DIFF -h TOOLTEST h5diff_10.txt -h # 1.1 normal mode -TESTING $H5DIFF $SRCFILE1 $SRCFILE2 TOOLTEST h5diff_11.txt $FILE1 $FILE2 # 1.2 normal mode with objects -TESTING $H5DIFF $SRCFILE1 $SRCFILE2 g1/dset1 g1/dset2 TOOLTEST h5diff_12.txt $FILE1 $FILE2 g1/dset1 g1/dset2 # 1.3 report mode -TESTING $H5DIFF -r $SRCFILE1 $SRCFILE2 TOOLTEST h5diff_13.txt -r $FILE1 $FILE2 # 1.4 report mode with objects -TESTING $H5DIFF -r $SRCFILE1 $SRCFILE2 g1/dset1 g1/dset2 TOOLTEST h5diff_14.txt -r $FILE1 $FILE2 g1/dset1 g1/dset2 # 1.5 with -d -TESTING $H5DIFF --report --delta=5 $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_15.txt --report --delta=5 $FILE1 $FILE2 g1/dset3 g1/dset4 # 1.6.1 with -p (int) -TESTING $H5DIFF -v -p 0.02 $SRCFILE1 $SRCFILE1 g1/dset5 g1/dset6 TOOLTEST h5diff_16_1.txt -v -p 0.02 $FILE1 $FILE1 g1/dset5 g1/dset6 # 1.6.2 with -p (unsigned long_long) -TESTING $H5DIFF --verbose --relative=0.02 $SRCFILE1 $SRCFILE1 g1/dset7 g1/dset8 TOOLTEST h5diff_16_2.txt --verbose --relative=0.02 $FILE1 $FILE1 g1/dset7 g1/dset8 # 1.6.3 with -p (double) -TESTING $H5DIFF -v -p 0.02 $SRCFILE1 $SRCFILE1 g1/dset9 g1/dset10 TOOLTEST h5diff_16_3.txt -v -p 0.02 $FILE1 $FILE1 g1/dset9 g1/dset10 # 1.7 verbose mode -TESTING $H5DIFF -v $SRCFILE1 $SRCFILE2 TOOLTEST h5diff_17.txt -v $FILE1 $FILE2 # 1.8 test 32-bit INFINITY -TESTING $H5DIFF $SRCFILE1 $SRCFILE1 /g1/fp19 -TOOLTEST h5diff_171.txt -v $SRCFILE1 $SRCFILE1 /g1/fp19 +TOOLTEST h5diff_171.txt -v $FILE1 $FILE1 /g1/fp19 # 1.8 test 64-bit INFINITY -TESTING $H5DIFF $SRCFILE1 $SRCFILE1 /g1/fp20 -TOOLTEST h5diff_172.txt -v $SRCFILE1 $SRCFILE1 /g1/fp20 +TOOLTEST h5diff_172.txt -v $FILE1 $FILE1 /g1/fp20 # 1.8 quiet mode -TESTING $H5DIFF -q $SRCFILE1 $SRCFILE2 TOOLTEST h5diff_18.txt -q $FILE1 $FILE2 @@ -343,15 +326,12 @@ TOOLTEST h5diff_18.txt -q $FILE1 $FILE2 # ############################################################################## # 2.0 -TESTING $H5DIFF -v $SRCFILE3 $SRCFILE3 dset g1 TOOLTEST h5diff_20.txt -v $FILE3 $FILE3 dset g1 # 2.1 -TESTING $H5DIFF -v $SRCFILE3 $SRCFILE3 dset l1 TOOLTEST h5diff_21.txt -v $FILE3 $FILE3 dset l1 # 2.2 -TESTING $H5DIFF -v $SRCFILE3 $SRCFILE3 dset t1 TOOLTEST h5diff_22.txt -v $FILE3 $FILE3 dset t1 # ############################################################################## @@ -359,27 +339,21 @@ TOOLTEST h5diff_22.txt -v $FILE3 $FILE3 dset t1 # ############################################################################## # 2.3 -TESTING $H5DIFF -v $SRCFILE3 $SRCFILE3 g1 g1 TOOLTEST h5diff_23.txt -v $FILE3 $FILE3 g1 g1 # 2.4 -TESTING $H5DIFF -v $SRCFILE3 $SRCFILE3 t1 t1 TOOLTEST h5diff_24.txt -v $FILE3 $FILE3 t1 t1 # 2.5 -TESTING $H5DIFF -v $SRCFILE3 $SRCFILE3 l1 l1 TOOLTEST h5diff_25.txt -v $FILE3 $FILE3 l1 l1 # 2.6 -TESTING $H5DIFF -v $SRCFILE3 $SRCFILE3 g1 g2 TOOLTEST h5diff_26.txt -v $FILE3 $FILE3 g1 g2 # 2.7 -TESTING $H5DIFF -v $SRCFILE3 $SRCFILE3 t1 t2 TOOLTEST h5diff_27.txt -v $FILE3 $FILE3 t1 t2 # 2.8 -TESTING $H5DIFF -v $SRCFILE3 $SRCFILE3 l1 l2 TOOLTEST h5diff_28.txt -v $FILE3 $FILE3 l1 l2 @@ -389,39 +363,30 @@ TOOLTEST h5diff_28.txt -v $FILE3 $FILE3 l1 l2 # ############################################################################## # 5.0 -TESTING $H5DIFF -v $SRCFILE4 $SRCFILE4 dset0a dset0b TOOLTEST h5diff_50.txt -v $FILE4 $FILE4 dset0a dset0b # 5.1 -TESTING $H5DIFF -v $SRCFILE4 $SRCFILE4 dset1a dset1b TOOLTEST h5diff_51.txt -v $FILE4 $FILE4 dset1a dset1b # 5.2 -TESTING $H5DIFF -v $SRCFILE4 $SRCFILE4 dset2a dset2b TOOLTEST h5diff_52.txt -v $FILE4 $FILE4 dset2a dset2b # 5.3 -TESTING $H5DIFF -v $SRCFILE4 $SRCFILE4 dset3a dset4b TOOLTEST h5diff_53.txt -v $FILE4 $FILE4 dset3a dset4b # 5.4 -TESTING $H5DIFF -v $SRCFILE4 $SRCFILE4 dset4a dset4b TOOLTEST h5diff_54.txt -v $FILE4 $FILE4 dset4a dset4b # 5.5 -TESTING $H5DIFF -v $SRCFILE4 $SRCFILE4 dset5a dset5b TOOLTEST h5diff_55.txt -v $FILE4 $FILE4 dset5a dset5b # 5.6 -TESTING $H5DIFF -v $SRCFILE4 $SRCFILE4 dset6a dset6b TOOLTEST h5diff_56.txt -v $FILE4 $FILE4 dset6a dset6b # 5.7 -TESTING $H5DIFF -v $SRCFILE4 $SRCFILE4 dset7a dset7b TOOLTEST h5diff_57.txt -v $FILE4 $FILE4 dset7a dset7b # 5.8 (region reference) -TESTING $H5DIFF -v $SRCFILE7 $SRCFILE8 refreg TOOLTEST h5diff_58.txt -v $FILE7 $FILE8 refreg # ############################################################################## @@ -430,7 +395,6 @@ TOOLTEST h5diff_58.txt -v $FILE7 $FILE8 refreg # 6.0: Check if the command line number of arguments is less than 3 -TESTING $H5DIFF $SRCFILE1 TOOLTEST h5diff_600.txt $FILE1 @@ -440,35 +404,27 @@ TOOLTEST h5diff_600.txt $FILE1 # 6.3: negative value -TESTING $H5DIFF -d -4 $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_603.txt -d -4 $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.4: zero -TESTING $H5DIFF -d 0 $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_604.txt -d 0 $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.5: non number -TESTING $H5DIFF -d u $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_605.txt -d u $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.6: hexadecimal -TESTING $H5DIFF -d 0x1 $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_606.txt -d 0x1 $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.7: string -TESTING $H5DIFF -d "1" $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_607.txt -d "1" $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.8: use system epsilon -TESTING $H5DIFF --use-system-epsilon $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_608.txt --use-system-epsilon $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.9: number larger than biggest difference -TESTING $H5DIFF -d 200 $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_609.txt -d 200 $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.10: number smaller than smallest difference -TESTING $H5DIFF -d 1 $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_610.txt -d 1 $FILE1 $FILE2 g1/dset3 g1/dset4 @@ -478,35 +434,27 @@ TOOLTEST h5diff_610.txt -d 1 $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.12: negative value -TESTING $H5DIFF -p -4 $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_612.txt -p -4 $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.13: zero -TESTING $H5DIFF -p 0 $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_613.txt -p 0 $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.14: non number -TESTING $H5DIFF -p u $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_614.txt -p u $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.15: hexadecimal -TESTING $H5DIFF -p 0x1 $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_615.txt -p 0x1 $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.16: string -TESTING $H5DIFF -p "0.21" $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_616.txt -p "0.21" $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.17: repeated option -TESTING $H5DIFF -p 0.21 -p 0.22 $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_617.txt -p 0.21 -p 0.22 $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.18: number larger than biggest difference -TESTING $H5DIFF -p 2 $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_618.txt -p 2 $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.19: number smaller than smallest difference -TESTING $H5DIFF -p 0.005 $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_619.txt -p 0.005 $FILE1 $FILE2 g1/dset3 g1/dset4 @@ -516,110 +464,214 @@ TOOLTEST h5diff_619.txt -p 0.005 $FILE1 $FILE2 g1/dset3 g1/dset4 # ############################################################################## # 6.21: negative value -TESTING $H5DIFF -n -4 $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_621.txt -n -4 $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.22: zero -TESTING $H5DIFF -n 0 $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_622.txt -n 0 $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.23: non number -TESTING $H5DIFF -n u $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_623.txt -n u $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.24: hexadecimal -TESTING $H5DIFF -n 0x1 $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_624.txt -n 0x1 $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.25: string -TESTING $H5DIFF -n "2" $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_625.txt -n "2" $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.26: repeated option -TESTING $H5DIFF -n 2 -n 3 $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_626.txt -n 2 -n 3 $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.27: number larger than biggest difference -TESTING $H5DIFF --count=200 $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_627.txt --count=200 $FILE1 $FILE2 g1/dset3 g1/dset4 # 6.28: number smaller than smallest difference -TESTING $H5DIFF -n 1 $SRCFILE1 $SRCFILE2 g1/dset3 g1/dset4 TOOLTEST h5diff_628.txt -n 1 $FILE1 $FILE2 g1/dset3 g1/dset4 # Disabling this test as it hangs - LRK 20090618 # 6.29 non valid files -#TESTING $H5DIFF file1.h6 file2.h6 #TOOLTEST h5diff_629.txt file1.h6 file2.h6 # ############################################################################## # 7. attributes # ############################################################################## -TESTING $H5DIFF -v $SRCFILE5 $SRCFILE6 TOOLTEST h5diff_70.txt -v $FILE5 $FILE6 # ############################################################################## # 8. all dataset datatypes # ############################################################################## -TESTING $H5DIFF -v $SRCFILE7 $SRCFILE8 TOOLTEST h5diff_80.txt -v $FILE7 $FILE8 # 9. compare a file with itself -TESTING $H5DIFF -v $SRCFILE2 $SRCFILE2 TOOLTEST h5diff_90.txt -v $FILE2 $FILE2 # 10. read by hyperslab, print indexes if test -n "$pmode" -a "$mydomainname" = hdfgroup.uiuc.edu; then # skip this test which sometimes hangs in some THG machines - SKIP -v $SRCFILE9 $SRCFILE10 + SKIP -v $FILE9 $FILE10 else - TESTING $H5DIFF -v $SRCFILE9 $SRCFILE10 TOOLTEST h5diff_100.txt -v $FILE9 $FILE10 fi # 11. floating point comparison -TESTING $H5DIFF -v $SRCFILE1 $SRCFILE1 g1/d1 g1/d2 TOOLTEST h5diff_101.txt -v $FILE1 $FILE1 g1/d1 g1/d2 -TESTING $H5DIFF -v $SRCFILE1 $SRCFILE1 g1/fp1 g1/fp2 TOOLTEST h5diff_102.txt -v $FILE1 $FILE1 g1/fp1 g1/fp2 # not comparable -c flag -TESTING $H5DIFF $SRCFILE2 $SRCFILE2 g2/dset1 g2/dset2 TOOLTEST h5diff_200.txt $FILE2 $FILE2 g2/dset1 g2/dset2 -TESTING $H5DIFF -c $SRCFILE2 $SRCFILE2 g2/dset1 g2/dset2 TOOLTEST h5diff_201.txt -c $FILE2 $FILE2 g2/dset1 g2/dset2 -TESTING $H5DIFF -c $SRCFILE2 $SRCFILE2 g2/dset2 g2/dset3 TOOLTEST h5diff_202.txt -c $FILE2 $FILE2 g2/dset2 g2/dset3 -TESTING $H5DIFF -c $SRCFILE2 $SRCFILE2 g2/dset3 g2/dset4 TOOLTEST h5diff_203.txt -c $FILE2 $FILE2 g2/dset3 g2/dset4 -TESTING $H5DIFF -c $SRCFILE2 $SRCFILE2 g2/dset4 g2/dset5 TOOLTEST h5diff_204.txt -c $FILE2 $FILE2 g2/dset4 g2/dset5 -TESTING $H5DIFF -c $SRCFILE2 $SRCFILE2 g2/dset5 g2/dset6 TOOLTEST h5diff_205.txt -c $FILE2 $FILE2 g2/dset5 g2/dset6 # not comparable in compound -TESTING $H5DIFF -c $SRCFILE2 $SRCFILE2 g2/dset7 g2/dset8 TOOLTEST h5diff_206.txt -c $FILE2 $FILE2 g2/dset7 g2/dset8 -TESTING $H5DIFF -c $SRCFILE2 $SRCFILE2 g2/dset8 g2/dset9 TOOLTEST h5diff_207.txt -c $FILE2 $FILE2 g2/dset8 g2/dset9 +# ############################################################################## +# # Links compare without -l (link follow) +# ############################################################################## +# test for bug1749 +TOOLTEST h5diff_300.txt -v $FILE12 $FILE12 /link_g1 /link_g2 # ############################################################################## -# 12. The comparision for the two datasets between the 2 files should be the same -# SRCFILE12: B-tree indexing is used for the datasets -# SRCFILE13: Fixed Array indexing is used for the datasets +# # Links compare with -l (link follow) # ############################################################################## -TESTING $H5DIFF -v $SRCFILE12 $SRCFILE13 -TOOLTEST h5diff_idx.txt -v $FILE12 $FILE13 +# soft links file to file +TOOLTEST h5diff_400.txt -l -v $FILE13 $FILE13 + +# softlink vs dset" +TOOLTEST h5diff_401.txt -l -v $FILE13 $FILE13 /softlink_dset1_1 /target_dset2 + + +# dset vs softlink" +TOOLTEST h5diff_402.txt -l -v $FILE13 $FILE13 /target_dset2 /softlink_dset1_1 + + +# softlink vs softlink" +TOOLTEST h5diff_403.txt -l -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 + + +# extlink vs dset" +TOOLTEST h5diff_405.txt -l -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 + + +# extlink vs extlink" +TOOLTEST h5diff_407.txt -l -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 + + +# extlink vs softlink " +TOOLTEST h5diff_409.txt -l -v $FILE15 $FILE13 /ext_link_dset2 /softlink_dset1_1 + + +# linked_softlink vs linked_softlink (FILE)" +TOOLTEST h5diff_410.txt -l -v $FILE14 $FILE14 + + +# dset2 vs linked_softlink_dset1" +TOOLTEST h5diff_411.txt -l -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 + + +# linked_softlink_to_dset1 vs linked_softlink_to_dset2" +TOOLTEST h5diff_413.txt -l -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 + + +# linked_softlink_group1 vs group" +TOOLTEST h5diff_415.txt -l -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 + + +# non-exist-softlink vs softlink" +TOOLTEST h5diff_417.txt -l -v $FILE13 $FILE13 /softlink_noexist /softlink_dset2 + + +# softlink vs non-exist-softlink" +TOOLTEST h5diff_418.txt -l -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 + + +# 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 + + +# extlink vs non-exist-extlink_obj" +TOOLTEST h5diff_421.txt -l -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 + + +# extlink_to_softlink_to_dset1 vs dset2" +TOOLTEST h5diff_423.txt -l -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 + + +# 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 + +# ############################################################################## +# 19. The comparision for the two datasets between the 2 files should be the same +# FILE19: B-tree indexing is used for the datasets +# FILE20: Fixed Array indexing is used for the datasets +# ############################################################################## +TOOLTEST h5diff_idx.txt -v $FILE19 $FILE20 # ############################################################################## @@ -627,7 +679,9 @@ TOOLTEST h5diff_idx.txt -v $FILE12 $FILE13 # ############################################################################## if test $nerrors -eq 0 ; then - echo "All $H5DIFF tests passed." + echo "All $TESTNAME tests passed." + exit $EXIT_SUCCESS +else + echo "$TESTNAME tests failed with $nerrors errors." + exit $EXIT_FAILURE fi - -exit $nerrors diff --git a/tools/h5diff/testph5diff.sh b/tools/h5diff/testph5diff.sh index 1375756..0734d21 100755 --- a/tools/h5diff/testph5diff.sh +++ b/tools/h5diff/testph5diff.sh @@ -19,6 +19,10 @@ if test -z "$srcdir"; then srcdir=. fi +TESTNAME=ph5diff +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + TOOL=${srcdir}/testh5diff.sh nerrors=0 @@ -53,12 +57,10 @@ TOOLTEST() { # testphdf5 test using the MPI-POSIX VFL driver TOOLTEST -p -# Emit message about testing status +# no need to print any message since this is just a shell to invoke +# testh5diff.sh which has already printed the result. Just exit. if test $nerrors -eq 0 ; then - echo "All $TEST_APP tests passed." + exit $EXIT_SUCCESS else - echo "ERROR! One or more $TOOL tests failed." + exit $EXIT_FAILURE fi - -# Propagate a useful exit code -exit $nerrors diff --git a/tools/h5dump/Makefile.in b/tools/h5dump/Makefile.in index 8ca6684..1791da5 100644 --- a/tools/h5dump/Makefile.in +++ b/tools/h5dump/Makefile.in @@ -327,12 +327,12 @@ CP = cp # Some machines need a command to run executables; this is that command # so that our tests will run. -# We use RUNTESTS instead of RUNSERIAL directly because it may be that +# We use RUNEXEC instead of RUNSERIAL directly because it may be that # some tests need to be run with a different command. Older versions # of the makefiles used the command # $(LIBTOOL) --mode=execute # in some directories, for instance. -RUNTESTS = $(RUNSERIAL) +RUNEXEC = $(RUNSERIAL) # Libraries to link to while building LIBHDF5 = $(top_builddir)/src/libhdf5.la @@ -851,7 +851,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_: fi; \ echo "============================" >> $${log}; \ srcdir="$(srcdir)" \ - $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ + $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ && touch $(@:.chkexe_=.chkexe) || \ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ (cat $${log} && false) || exit 1; \ @@ -922,7 +922,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS) @for test in $(TEST_PROG_PARA) dummy; do \ if test $$test != dummy; then \ $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \ - RUNTESTS="$(RUNPARALLEL)" || exit 1; \ + RUNEXEC="$(RUNPARALLEL)" || exit 1; \ fi; \ done @for test in $(TEST_SCRIPT_PARA) dummy; do \ diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index abe97ea..0f25efe 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -2707,14 +2707,13 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id) H5D_fill_time_t ft; hsize_t storage_size; haddr_t ioffset; - int i, next; + int i; unsigned j; - storage_size=H5Dget_storage_size(obj_id); + storage_size = H5Dget_storage_size(obj_id); nfilters = H5Pget_nfilters(dcpl_id); - ioffset=H5Dget_offset(obj_id); - next=H5Pget_external_count(dcpl_id); - strcpy(f_name,"\0"); + ioffset = H5Dget_offset(obj_id); + HDstrcpy(f_name,"\0"); /*------------------------------------------------------------------------- * STORAGE_LAYOUT @@ -2819,6 +2818,10 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id) printf("%s\n",END); } else if (H5D_CONTIGUOUS == H5Pget_layout(dcpl_id)) { + int next; + + next = H5Pget_external_count(dcpl_id); + /*------------------------------------------------------------------------- * EXTERNAL_FILE *------------------------------------------------------------------------- @@ -4531,8 +4534,7 @@ print_enum(hid_t type) size_t dst_size; /*destination value type size */ unsigned i; - nmembs = H5Tget_nmembers(type); - assert(nmembs>0); + nmembs = (unsigned)H5Tget_nmembers(type); super = H5Tget_super(type); /* @@ -4542,17 +4544,16 @@ print_enum(hid_t type) * 2. unsigned long long -- the largest native unsigned integer * 3. raw format */ - if (H5Tget_size(type) <= sizeof(long long)) { - dst_size = sizeof(long long); + if(H5Tget_size(type) <= sizeof(long long)) { + dst_size = sizeof(long long); - if (H5T_SGN_NONE == H5Tget_sign(type)) { - native = H5T_NATIVE_ULLONG; - } else { - native = H5T_NATIVE_LLONG; - } - } else { - dst_size = H5Tget_size(type); - } + if(H5T_SGN_NONE == H5Tget_sign(type)) + native = H5T_NATIVE_ULLONG; + else + native = H5T_NATIVE_LLONG; + } /* end if */ + else + dst_size = H5Tget_size(type); /* Get the names and raw values of all members */ name = calloc(nmembs, sizeof(char *)); @@ -5838,19 +5839,19 @@ xml_dump_group(hid_t gid, const char *name) t_objname, parentxid, par_name); free(t_objname); free(par_name); - } - indentation(indent + COL); - t_objname = xml_escape_the_name(found_obj->objname);/* point to the NDT by name */ - par_name = xml_escape_the_name(par); - xml_name_to_XID(found_obj->objname, ptrstr, 100, 1); - xml_name_to_XID(par, parentxid, 100, 1); - printf("<%sGroupPtr OBJ-XID=\"%s\" H5Path=\"%s\" " - "Parents=\"%s\" H5ParentPaths=\"%s\" />\n", - xmlnsprefix, - ptrstr, t_objname, parentxid, par_name); - free(t_objname); - free(par_name); + indentation(indent + COL); + t_objname = xml_escape_the_name(found_obj->objname);/* point to the NDT by name */ + par_name = xml_escape_the_name(par); + xml_name_to_XID(found_obj->objname, ptrstr, 100, 1); + xml_name_to_XID(par, parentxid, 100, 1); + printf("<%sGroupPtr OBJ-XID=\"%s\" H5Path=\"%s\" " + "Parents=\"%s\" H5ParentPaths=\"%s\" />\n", + xmlnsprefix, + ptrstr, t_objname, parentxid, par_name); + free(t_objname); + free(par_name); + } free(ptrstr); } else { @@ -6712,7 +6713,7 @@ xml_print_enum(hid_t type) unsigned i; /*miscellaneous counters */ size_t j; - nmembs = H5Tget_nmembers(type); + nmembs = (unsigned)H5Tget_nmembers(type); super = H5Tget_super(type); indentation(indent); diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in index 84274cf..55434ab 100644 --- a/tools/h5dump/testh5dump.sh.in +++ b/tools/h5dump/testh5dump.sh.in @@ -23,6 +23,10 @@ USE_FILTER_FLETCHER32="@USE_FILTER_FLETCHER32@" USE_FILTER_NBIT="@USE_FILTER_NBIT@" USE_FILTER_SCALEOFFSET="@USE_FILTER_SCALEOFFSET@" +TESTNAME=h5dump +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + DUMPER=h5dump # The tool name DUMPER_BIN=`pwd`/$DUMPER # The path of the tool binary TESTDIR=`pwd`/../testfiles @@ -512,8 +516,9 @@ TOOLTEST textlinkfar.ddl textlinkfar.h5 TOOLTEST tdset_idx.ddl -p -H tdset_idx.h5 if test $nerrors -eq 0 ; then - echo "All $DUMPER tests passed." + echo "All $TESTNAME tests passed." + exit $EXIT_SUCCESS +else + echo "$TESTNAME tests failed with $nerrors errors." + exit $EXIT_FAILURE fi - -exit $nerrors - diff --git a/tools/h5dump/testh5dumpxml.sh.in b/tools/h5dump/testh5dumpxml.sh.in index 3e81a05..c4c8657 100755 --- a/tools/h5dump/testh5dumpxml.sh.in +++ b/tools/h5dump/testh5dumpxml.sh.in @@ -15,6 +15,10 @@ # # Tests for the h5dump tool +TESTNAME=h5dumpxml +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + H5_LONE_COLON="@H5_LONE_COLON@" DUMPER=h5dump # The tool name @@ -185,10 +189,10 @@ TOOLTEST torderattr3.h5.xml --xml -H --sort_by=creation_order --sort_order=ascen TOOLTEST torderattr4.h5.xml --xml -H --sort_by=creation_order --sort_order=descending torderattr.h5 - - if test $nerrors -eq 0 ; then - echo "All $DUMPER tests passed." + echo "All $TESTNAME tests passed." + exit $EXIT_SUCCESS +else + echo "$TESTNAME tests failed with $nerrors errors." + exit $EXIT_FAILURE fi - -exit $nerrors diff --git a/tools/h5import/Makefile.in b/tools/h5import/Makefile.in index 15fcf90..620d0c0 100755 --- a/tools/h5import/Makefile.in +++ b/tools/h5import/Makefile.in @@ -322,12 +322,12 @@ CP = cp # Some machines need a command to run executables; this is that command # so that our tests will run. -# We use RUNTESTS instead of RUNSERIAL directly because it may be that +# We use RUNEXEC instead of RUNSERIAL directly because it may be that # some tests need to be run with a different command. Older versions # of the makefiles used the command # $(LIBTOOL) --mode=execute # in some directories, for instance. -RUNTESTS = $(RUNSERIAL) +RUNEXEC = $(RUNSERIAL) # Libraries to link to while building LIBHDF5 = $(top_builddir)/src/libhdf5.la @@ -833,7 +833,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_: fi; \ echo "============================" >> $${log}; \ srcdir="$(srcdir)" \ - $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ + $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ && touch $(@:.chkexe_=.chkexe) || \ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ (cat $${log} && false) || exit 1; \ @@ -904,7 +904,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS) @for test in $(TEST_PROG_PARA) dummy; do \ if test $$test != dummy; then \ $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \ - RUNTESTS="$(RUNPARALLEL)" || exit 1; \ + RUNEXEC="$(RUNPARALLEL)" || exit 1; \ fi; \ done @for test in $(TEST_SCRIPT_PARA) dummy; do \ diff --git a/tools/h5import/h5import.c b/tools/h5import/h5import.c index 60ef494..e9e7dac 100755 --- a/tools/h5import/h5import.c +++ b/tools/h5import/h5import.c @@ -116,7 +116,7 @@ int main(int argc, char *argv[]) case 6: /* -h found; help, then exit */ help(argv[0]); - exit(0); + exit(EXIT_SUCCESS); break; case 7: /* -d found; look for dimensions */ diff --git a/tools/h5import/h5importtestutil.sh b/tools/h5import/h5importtestutil.sh index ca445ed..d8b54a7 100755 --- a/tools/h5import/h5importtestutil.sh +++ b/tools/h5import/h5importtestutil.sh @@ -16,8 +16,12 @@ # HDF Utilities Test script # Usage: h5importtestutil.sh [machine-type] +TESTNAME=h5import +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + # initialize errors variable -errors=0 +nerrors=0 TESTING() { SPACES=" " @@ -37,7 +41,7 @@ cd .. cmp -s tmp_testfiles/log1 log2 || err=1 rm -f log2 tmp_testfiles/log1 if [ $err -eq 1 ]; then -errors="` expr $errors + 1 `"; +nerrors="` expr $nerrors + 1 `"; echo "*FAILED*" else echo " PASSED" @@ -120,18 +124,15 @@ rm -f *.txt *.bin *.h5 rm -rf tmp_testfiles else echo "** h5import or h5importtest not available ***" - errors="` expr $errors + 1 `"; + nerrors="` expr $nerrors + 1 `"; fi # # Check errors result -if [ $errors -eq 0 ]; then - echo "======================================" - echo " H5IMPORT Utilities tests have passed." - echo "======================================" +if test $nerrors -eq 0 ; then + echo "All $TESTNAME tests passed." + exit $EXIT_SUCCESS else - echo "*********************************************" - echo " H5IMPORT Utilities tests encountered errors" - echo "*********************************************" + echo "$TESTNAME tests failed with $nerrors errors." + exit $EXIT_FAILURE fi -exit $errors diff --git a/tools/h5jam/Makefile.in b/tools/h5jam/Makefile.in index 5509801..fe7fbd7 100644 --- a/tools/h5jam/Makefile.in +++ b/tools/h5jam/Makefile.in @@ -336,12 +336,12 @@ CP = cp # Some machines need a command to run executables; this is that command # so that our tests will run. -# We use RUNTESTS instead of RUNSERIAL directly because it may be that +# We use RUNEXEC instead of RUNSERIAL directly because it may be that # some tests need to be run with a different command. Older versions # of the makefiles used the command # $(LIBTOOL) --mode=execute # in some directories, for instance. -RUNTESTS = $(RUNSERIAL) +RUNEXEC = $(RUNSERIAL) # Libraries to link to while building LIBHDF5 = $(top_builddir)/src/libhdf5.la @@ -864,7 +864,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_: fi; \ echo "============================" >> $${log}; \ srcdir="$(srcdir)" \ - $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ + $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ && touch $(@:.chkexe_=.chkexe) || \ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ (cat $${log} && false) || exit 1; \ @@ -935,7 +935,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS) @for test in $(TEST_PROG_PARA) dummy; do \ if test $$test != dummy; then \ $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \ - RUNTESTS="$(RUNPARALLEL)" || exit 1; \ + RUNEXEC="$(RUNPARALLEL)" || exit 1; \ fi; \ done @for test in $(TEST_SCRIPT_PARA) dummy; do \ diff --git a/tools/h5jam/h5jam.c b/tools/h5jam/h5jam.c index c6fdb5c..cceed75 100644 --- a/tools/h5jam/h5jam.c +++ b/tools/h5jam/h5jam.c @@ -454,7 +454,7 @@ copy_some_to_file (int infid, int outfid, hsize_t startin, hsize_t startout, if (nchars <= 0) { printf ("huh? \n"); - exit (1); + exit (EXIT_FAILURE); } /*ncw = */ HDwrite (outfid, buf, (unsigned) nchars); diff --git a/tools/h5jam/testh5jam.sh.in b/tools/h5jam/testh5jam.sh.in index e17c860..cfefcdc 100644 --- a/tools/h5jam/testh5jam.sh.in +++ b/tools/h5jam/testh5jam.sh.in @@ -21,6 +21,10 @@ USE_FILTER_DEFLATE="@USE_FILTER_DEFLATE@" USE_FILTER_SHUFFLE="@USE_FILTER_SHUFFLE@" USE_FILTER_FLETCHER32="@USE_FILTER_FLETCHER32@" +TESTNAME=h5jam/h5unjam +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + DUMPER=h5dump # The dumper to use DUMPER_BIN=`pwd`/../$DUMPER # The path of the dumper binary JAM=h5jam # Tool to test @@ -526,7 +530,9 @@ CLEANUP tac3.h5 taj3.h5 if test $nerrors -eq 0 ; then - echo "All $JAM tests passed." + echo "All $TESTNAME tests passed." + exit $EXIT_SUCCESS +else + echo "$TESTNAME tests failed with $nerrors errors." + exit $EXIT_FAILURE fi - -exit $nerrors diff --git a/tools/h5ls/Makefile.in b/tools/h5ls/Makefile.in index c11dc43..fdd09c6 100644 --- a/tools/h5ls/Makefile.in +++ b/tools/h5ls/Makefile.in @@ -316,12 +316,12 @@ CP = cp # Some machines need a command to run executables; this is that command # so that our tests will run. -# We use RUNTESTS instead of RUNSERIAL directly because it may be that +# We use RUNEXEC instead of RUNSERIAL directly because it may be that # some tests need to be run with a different command. Older versions # of the makefiles used the command # $(LIBTOOL) --mode=execute # in some directories, for instance. -RUNTESTS = $(RUNSERIAL) +RUNEXEC = $(RUNSERIAL) # Libraries to link to while building LIBHDF5 = $(top_builddir)/src/libhdf5.la @@ -814,7 +814,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_: fi; \ echo "============================" >> $${log}; \ srcdir="$(srcdir)" \ - $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ + $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ && touch $(@:.chkexe_=.chkexe) || \ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ (cat $${log} && false) || exit 1; \ @@ -885,7 +885,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS) @for test in $(TEST_PROG_PARA) dummy; do \ if test $$test != dummy; then \ $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \ - RUNTESTS="$(RUNPARALLEL)" || exit 1; \ + RUNEXEC="$(RUNPARALLEL)" || exit 1; \ fi; \ done @for test in $(TEST_SCRIPT_PARA) dummy; do \ diff --git a/tools/h5repack/Makefile.in b/tools/h5repack/Makefile.in index dd33879..aa7781e 100644 --- a/tools/h5repack/Makefile.in +++ b/tools/h5repack/Makefile.in @@ -336,12 +336,12 @@ CP = cp # Some machines need a command to run executables; this is that command # so that our tests will run. -# We use RUNTESTS instead of RUNSERIAL directly because it may be that +# We use RUNEXEC instead of RUNSERIAL directly because it may be that # some tests need to be run with a different command. Older versions # of the makefiles used the command # $(LIBTOOL) --mode=execute # in some directories, for instance. -RUNTESTS = $(RUNSERIAL) +RUNEXEC = $(RUNSERIAL) # Libraries to link to while building LIBHDF5 = $(top_builddir)/src/libhdf5.la @@ -887,7 +887,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_: fi; \ echo "============================" >> $${log}; \ srcdir="$(srcdir)" \ - $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ + $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ && touch $(@:.chkexe_=.chkexe) || \ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ (cat $${log} && false) || exit 1; \ @@ -958,7 +958,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS) @for test in $(TEST_PROG_PARA) dummy; do \ if test $$test != dummy; then \ $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \ - RUNTESTS="$(RUNPARALLEL)" || exit 1; \ + RUNEXEC="$(RUNPARALLEL)" || exit 1; \ fi; \ done @for test in $(TEST_SCRIPT_PARA) dummy; do \ diff --git a/tools/h5repack/h5repack.sh.in b/tools/h5repack/h5repack.sh.in index e9aae81..69f5059 100755 --- a/tools/h5repack/h5repack.sh.in +++ b/tools/h5repack/h5repack.sh.in @@ -27,6 +27,10 @@ USE_FILTER_FLETCHER32="@USE_FILTER_FLETCHER32@" USE_FILTER_NBIT="@USE_FILTER_NBIT@" USE_FILTER_SCALEOFFSET="@USE_FILTER_SCALEOFFSET@" +TESTNAME=h5repack +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + H5REPACK=h5repack # The tool name H5REPACK_BIN=`pwd`/$H5REPACK # The path of the tool binary @@ -528,8 +532,10 @@ TOOLTEST $FILE15 TOOLTEST1 $FILE16 if test $nerrors -eq 0 ; then - echo "All $H5REPACK tests passed." + echo "All $TESTNAME tests passed." + exit $EXIT_SUCCESS +else + echo "$TESTNAME tests failed with $nerrors errors." + exit $EXIT_FAILURE fi -exit $nerrors - diff --git a/tools/h5stat/Makefile.in b/tools/h5stat/Makefile.in index 08de49b..a9bedaa 100644 --- a/tools/h5stat/Makefile.in +++ b/tools/h5stat/Makefile.in @@ -345,12 +345,12 @@ CP = cp # Some machines need a command to run executables; this is that command # so that our tests will run. -# We use RUNTESTS instead of RUNSERIAL directly because it may be that +# We use RUNEXEC instead of RUNSERIAL directly because it may be that # some tests need to be run with a different command. Older versions # of the makefiles used the command # $(LIBTOOL) --mode=execute # in some directories, for instance. -RUNTESTS = $(RUNSERIAL) +RUNEXEC = $(RUNSERIAL) # Libraries to link to while building LIBHDF5 = $(top_builddir)/src/libhdf5.la @@ -907,7 +907,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_: fi; \ echo "============================" >> $${log}; \ srcdir="$(srcdir)" \ - $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ + $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ && touch $(@:.chkexe_=.chkexe) || \ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ (cat $${log} && false) || exit 1; \ @@ -978,7 +978,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS) @for test in $(TEST_PROG_PARA) dummy; do \ if test $$test != dummy; then \ $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \ - RUNTESTS="$(RUNPARALLEL)" || exit 1; \ + RUNEXEC="$(RUNPARALLEL)" || exit 1; \ fi; \ done @for test in $(TEST_SCRIPT_PARA) dummy; do \ diff --git a/tools/h5stat/h5stat.c b/tools/h5stat/h5stat.c index b21e5a0..aa10eb4 100644 --- a/tools/h5stat/h5stat.c +++ b/tools/h5stat/h5stat.c @@ -580,10 +580,12 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi) iter->dset_comptype[0]++; for(u = 0; u < (unsigned)nfltr; u++) { fltr = H5Pget_filter2(dcpl, u, 0, 0, 0, 0, 0, NULL); - if(fltr < (H5_NFILTERS_IMPL - 1)) - iter->dset_comptype[fltr]++; - else - iter->dset_comptype[H5_NFILTERS_IMPL - 1]++; /*other filters*/ + if(fltr >= 0) { + if(fltr < (H5_NFILTERS_IMPL - 1)) + iter->dset_comptype[fltr]++; + else + iter->dset_comptype[H5_NFILTERS_IMPL - 1]++; /*other filters*/ + } /* end if */ } /* end for */ } /* endif nfltr */ diff --git a/tools/h5stat/testh5stat.sh.in b/tools/h5stat/testh5stat.sh.in index 28837ec..a1fff1d 100644 --- a/tools/h5stat/testh5stat.sh.in +++ b/tools/h5stat/testh5stat.sh.in @@ -23,6 +23,10 @@ USE_FILTER_FLETCHER32="@USE_FILTER_FLETCHER32@" USE_FILTER_NBIT="@USE_FILTER_NBIT@" USE_FILTER_SCALEOFFSET="@USE_FILTER_SCALEOFFSET@" +TESTNAME=h5stat +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + STAT=h5stat # The tool name STAT_BIN=`pwd`/$STAT # The path of the tool binary @@ -128,10 +132,11 @@ TOOLTEST h5stat_newgrat.ddl h5stat_newgrat.h5 TOOLTEST h5stat_idx.ddl h5stat_idx.h5 echo - if test $nerrors -eq 0 ; then - echo "All $STAT tests passed." + echo "All $TESTNAME tests passed." + exit $EXIT_SUCCESS +else + echo "$TESTNAME tests failed with $nerrors errors." + exit $EXIT_FAILURE fi -exit $nerrors - diff --git a/tools/lib/Makefile.in b/tools/lib/Makefile.in index 2b269ca..09c8edf 100644 --- a/tools/lib/Makefile.in +++ b/tools/lib/Makefile.in @@ -315,12 +315,12 @@ CP = cp # Some machines need a command to run executables; this is that command # so that our tests will run. -# We use RUNTESTS instead of RUNSERIAL directly because it may be that +# We use RUNEXEC instead of RUNSERIAL directly because it may be that # some tests need to be run with a different command. Older versions # of the makefiles used the command # $(LIBTOOL) --mode=execute # in some directories, for instance. -RUNTESTS = $(RUNSERIAL) +RUNEXEC = $(RUNSERIAL) # Libraries to link to while building LIBHDF5 = $(top_builddir)/src/libhdf5.la @@ -796,7 +796,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_: fi; \ echo "============================" >> $${log}; \ srcdir="$(srcdir)" \ - $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ + $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ && touch $(@:.chkexe_=.chkexe) || \ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ (cat $${log} && false) || exit 1; \ @@ -867,7 +867,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS) @for test in $(TEST_PROG_PARA) dummy; do \ if test $$test != dummy; then \ $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \ - RUNTESTS="$(RUNPARALLEL)" || exit 1; \ + RUNEXEC="$(RUNPARALLEL)" || exit 1; \ fi; \ done @for test in $(TEST_SCRIPT_PARA) dummy; do \ diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index 7d11f2f..4b7b796 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -20,6 +20,31 @@ #include "h5tools.h" #include "h5tools_utils.h" +/* This code is layout for common code among tools */ +typedef enum toolname_t { + TOOL_H5DIFF, TOOL_H5LS, TOOL__H5DUMP /* add as necessary */ +} h5tool_toolname_t; +/* this struct can be used to differntiate among tools if necessary */ +typedef struct { + h5tool_toolname_t toolname; + int mode; +} h5tool_opt_t; + +/* To return link's target info + * Functions: + * H5tools_get_softlink_target_info() + * H5tools_get_extlink_target_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; /* * Debug printf macros. The prefix allows output filtering by test scripts. */ @@ -168,6 +193,235 @@ static void print_incoming_data(void) #endif /*------------------------------------------------------------------------- + * Function: H5tools_get_softlink_target_info + * + * 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) + * + * 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. + * + * 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) +{ + H5O_type_t otype = H5O_TYPE_UNKNOWN; + H5O_info_t oinfo; + H5L_info_t linfo; + int ret = 0; /* init to fail */ + + + if((H5Lexists(file_id, linkpath, H5P_DEFAULT) <= 0)) + { + parallel_print("error: \"%s\" doesn't exist \n",linkpath); + goto out; + } + + if(H5Lget_info(file_id, linkpath, &linfo, H5P_DEFAULT) < 0) + { + parallel_print("error: unable to get link info from \"%s\"\n",linkpath); + 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 + { + parallel_print("warn: link target \"%s\" doesn't exist \n", s_trg_info->path); + } + + /* set target obj type to return */ + s_trg_info->type = otype; + + /* succeed */ + ret = 1; +out: + return ret; +} + +/*------------------------------------------------------------------------- + * Function: H5tools_get_extlink_target_info + * + * Purpose: Get target object's type, path, file_id and filename from + * external-link + * + * 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) + * + * 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. + * - 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. + * + * Programmer: Jonathan Kim + * + * Date: Jan 20, 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) +{ + + 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 */ + + /* 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) + { + parallel_print("error: unable to get link value from \"%s\"\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) + { + parallel_print("error: unable to unpack external link value\n"); + 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 + { + /* 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; + + /* get external file id */ + trg_info->extfile_id = extfile_id; + + /* -------------------------------------------------- + * check if target is soft link, if so allocate buffer + */ + if((H5Lexists(trg_info->extfile_id, trg_info->path, H5P_DEFAULT) <= 0)) + { + parallel_print("error: \"%s\" doesn't exist \n", trg_info->path); + goto out; + } + if(H5Lget_info(trg_info->extfile_id, trg_info->path, &slinfo, H5P_DEFAULT) < 0) + { + parallel_print("error: unable to get link info from \"%s\"\n", trg_info->path); + goto out; + } + + /* if ext-link's target is soft-link */ + if(slinfo.type == H5L_TYPE_SOFT) + { + 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); + } + + /* get target obj type */ + if(H5tools_get_softlink_target_info(trg_info->extfile_id, trg_info->path, h5li, &soft_trg_info)==0) + { + parallel_print("error: unable to get link info from \"%s\"\n", trg_info->path); + goto out; + } + + /* target obj type */ + trg_info->type = soft_trg_info.type; + + /* if ext-link's target is soft-link */ + if(slinfo.type == H5L_TYPE_SOFT) + { + 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; + } + + /* Success */ + ret=1; +out: + if(soft_trg_info.buf) + HDfree(soft_trg_info.buf); + + return ret; +} +/*------------------------------------------------------------------------- * Function: h5diff * * Purpose: public function, can be called in an application program. @@ -826,9 +1080,34 @@ hsize_t diff_compare(hid_t file1_id, int f1 = 0; int f2 = 0; hsize_t nfound = 0; + ssize_t i,j; + + /* 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; - ssize_t i = h5trav_getindex (info1, obj1_name); - ssize_t j = h5trav_getindex (info2, obj2_name); + /* 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)); + + i = h5trav_getindex (info1, obj1_name); + j = h5trav_getindex (info2, obj2_name); if (i == -1) { @@ -849,28 +1128,206 @@ hsize_t diff_compare(hid_t file1_id, } /* use the name with "/" first, as obtained by iterator function */ - obj1_name = info1->paths[i].path; - obj2_name = info2->paths[j].path; + obj1name = info1->paths[i].path; + obj2name = info2->paths[j].path; + + obj1type = info1->paths[i].type; + obj2type = info2->paths[j].type; + + /*----------------------------------------------------------------- + * follow link option, compare with target object + */ + if (options->linkfollow) + { + H5L_info_t li1, li2; + + /*------------------------------------------------------------ + * Soft links + *------------------------------------------------------------*/ + /*------------------------ + * if object1 softlink + */ + if (obj1type == H5TRAV_TYPE_LINK) + { + 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; + } + + 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) + { + parallel_print("error: unable to get softlink info from \"%s\"\n",obj1_name); + goto out; + } + + /* set target name and type to pass diff() */ + obj1type = softlinkinfo1.type; + obj1name = softlinkinfo1.path; + } + + /*------------------------ + * if object2 is softlink + */ + if (obj2type == H5TRAV_TYPE_LINK) + { + if(H5Lget_info(file2_id, obj2_name, &li2, H5P_DEFAULT) < 0) + { + parallel_print("error: unable to get link info from \"%s\"\n",obj2_name); + goto out; + } + + + 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) + { + parallel_print("error: unable to get softlink info from \"%s\"\n",obj2_name); + goto out; + } + + /* set target name and type to pass diff() */ + obj2type = softlinkinfo2.type; + obj2name = softlinkinfo2.path; + } + + /*------------------------------------------------------------ + * External links + *------------------------------------------------------------*/ + + /*------------------------------- + * 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) + { + 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) + { + parallel_print("error: unable to get external link info from \"%s\"\n",obj1_name); + 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; + } + } + + /*------------------------------- + * if object2 is external link + */ + if (obj2type == H5TRAV_TYPE_UDLINK) + { + if(H5Lget_info(file2_id, obj2_name, &li2, H5P_DEFAULT) < 0) + { + parallel_print("error: unable to get link info from \"%s\"\n",obj2_name); + goto out; + } + /* for external link */ + if(li2.type == H5L_TYPE_EXTERNAL) + { + extlinkinfo2.buf = (char*)HDcalloc(li2.u.val_size, sizeof(char)); + HDassert(extlinkinfo2.buf); + + /* 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 (options->m_verbose) + { + parallel_print("<%s> is invaild type\n", obj2_name); + } + goto out; + } + + /* set target fileid, name and type to pass diff() */ + l_fileid2 = extlinkinfo2.extfile_id; + obj2name = extlinkinfo2.path; + obj2type = extlinkinfo2.type; + } + } + } /* end of linkfollow */ + /* objects are not the same type */ - if (info1->paths[i].type != info2->paths[j].type) + if (obj1type != obj2type) { if (options->m_verbose||options->m_list_not_cmp) { parallel_print("<%s> is of type %s and <%s> is of type %s\n", - obj1_name, get_type(info1->paths[i].type), obj2_name, - get_type(info2->paths[j].type)); + obj1name, get_type(obj1type), obj2name, + get_type(obj2type)); } options->not_cmp=1; - return 0; + goto out; } - nfound = diff(file1_id, - obj1_name, - file2_id, - obj2_name, - options, - info1->paths[i].type); + nfound = diff(l_fileid1, obj1name, + l_fileid2, obj2name, + 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); + { + HDfree(extlinkinfo1.buf); + /* case for ext-link's target is soft-link */ + if(extlinkinfo1.is_path_malloced) + HDfree(extlinkinfo1.path); + } + if (extlinkinfo2.buf); + { + HDfree(extlinkinfo2.buf); + /* case for ext-link's target is soft-link */ + if(extlinkinfo2.is_path_malloced) + HDfree(extlinkinfo2.path); + } + + /* close external file */ + H5E_BEGIN_TRY + { + H5Fclose(extfile1_id); + H5Fclose(extfile2_id); + } H5E_END_TRY; return nfound; } @@ -909,6 +1366,17 @@ hsize_t diff(hid_t file1_id, int ret; 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)); + + switch(type) { /*------------------------------------------------------------------------- @@ -931,11 +1399,13 @@ hsize_t diff(hid_t file1_id, /* the rest (-c, none, ...) */ else { - do_print_objname("dataset", path1, path2); nfound = diff_dataset(file1_id, file2_id, path1, path2, options); - /* not comparable, no display the different number */ - if (!options->not_cmp) + /* print info if compatible and difference found */ + if (!options->not_cmp && nfound) + { + do_print_objname("dataset", path1, path2); print_found(nfound); + } } break; @@ -1020,35 +1490,66 @@ hsize_t diff(hid_t file1_id, case H5TRAV_TYPE_LINK: { H5L_info_t li1, li2; - char *buf1, *buf2; if(H5Lget_info(file1_id, path1, &li1, H5P_DEFAULT) < 0) + { + parallel_print("error: unable to get link info from \"%s\"\n", path1); goto out; - if(H5Lget_info(file1_id, path1, &li2, H5P_DEFAULT) < 0) + } + if(H5Lget_info(file2_id, path2, &li2, H5P_DEFAULT) < 0) + { + parallel_print("error: unable to get link info from \"%s\"\n", path2); goto out; + } - buf1 = HDmalloc(li1.u.val_size); - buf2 = HDmalloc(li2.u.val_size); + 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(H5Lget_val(file1_id, path1, buf1, li1.u.val_size, H5P_DEFAULT) < 0) + if(H5tools_get_softlink_target_info(file1_id,path1,li1,&softlinkinfo1)==0) + { + parallel_print("error: unable to get softlink info from \"%s\"\n", path1); goto out; - if(H5Lget_val(file2_id, path2, buf2, li2.u.val_size, H5P_DEFAULT) < 0) + } + if(H5tools_get_softlink_target_info(file2_id,path2,li2,&softlinkinfo2)==0) + { + parallel_print("error: unable to get softlink info from \"%s\"\n", path2); goto out; + } - ret = HDstrcmp(buf1, buf2); + ret = HDstrcmp(softlinkinfo1.path, softlinkinfo2.path); - /* if "buf1" != "buf2" then the links are "different" */ + /* if the target link name is not same then the links are "different" */ nfound = (ret != 0) ? 1 : 0; if(print_objname(options, nfound)) do_print_objname("link", path1, path2); + if (options->linkfollow) + { + /* objects are not the same type */ + if (softlinkinfo1.type != softlinkinfo2.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); + } + options->not_cmp=1; + goto out; + } + + nfound += diff(file1_id, softlinkinfo1.path, + file2_id, softlinkinfo2.path, + options, softlinkinfo1.type); + } + /* always print the number of differences found in verbose mode */ if(options->m_verbose) print_found(nfound); - HDfree(buf1); - HDfree(buf2); + HDfree(softlinkinfo1.buf); + HDfree(softlinkinfo2.buf); } break; @@ -1061,55 +1562,80 @@ hsize_t diff(hid_t file1_id, H5L_info_t li1, li2; if(H5Lget_info(file1_id, path1, &li1, H5P_DEFAULT) < 0) + { + parallel_print("error: unable to get udlink info from \"%s\"\n", path1); goto out; - if(H5Lget_info(file1_id, path1, &li2, H5P_DEFAULT) < 0) + } + if(H5Lget_info(file2_id, path2, &li2, H5P_DEFAULT) < 0) + { + parallel_print("error: unable to get udlink info from \"%s\"\n", path2); goto out; + } /* Only external links will have a query function registered */ - if(li1.type == H5L_TYPE_EXTERNAL && li2.type == H5L_TYPE_EXTERNAL) { - char *buf1, *buf2; + if(li1.type == H5L_TYPE_EXTERNAL && li2.type == H5L_TYPE_EXTERNAL) + { - buf1 = HDmalloc(li1.u.val_size); - buf2 = HDmalloc(li2.u.val_size); + 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, buf1, li1.u.val_size, H5P_DEFAULT) < 0) { - HDfree(buf1); - HDfree(buf2); + 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, buf2, li2.u.val_size, H5P_DEFAULT) < 0) { - HDfree(buf1); - HDfree(buf2); + if(H5Lget_val(file2_id, path2, extlinkbuf2, li2.u.val_size, H5P_DEFAULT) < 0) + { + parallel_print("error: unable to get link value from \"%s\"\n",path2); goto out; } /* end if */ /* If the buffers are the same size, compare them */ - if(li1.u.val_size == li2.u.val_size) { - if(H5Lget_val(file1_id, path1, buf1, li1.u.val_size, H5P_DEFAULT) < 0) { - HDfree(buf1); - HDfree(buf2); - goto out; - } /* end if */ - if(H5Lget_val(file2_id, path2, buf2, li2.u.val_size, H5P_DEFAULT) < 0) { - HDfree(buf1); - HDfree(buf2); - goto out; - } /* end if */ - ret = HDmemcmp(buf1, buf2, li1.u.val_size); + if(li1.u.val_size == li2.u.val_size) + { + ret = HDmemcmp(extlinkbuf1, extlinkbuf2, li1.u.val_size); } else ret = 1; - /* if "buf1" != "buf2" then the links are "different" */ + /* if "extlinkbuf1" != "extlinkbuf2" then the links are "different" */ nfound = (ret != 0) ? 1 : 0; if(print_objname(options, nfound)) do_print_objname("external link", path1, path2); - HDfree(buf1); - HDfree(buf2); + if (options->linkfollow) + { + 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) + { + 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"); + goto out; + } + + nfound = h5diff(extlink_file1, extlink_file2, + extlink_path1, extlink_path2, options); + } + + HDfree(extlinkbuf1); + HDfree(extlinkbuf2); } /* end if */ - else { + else + { /* If one or both of these links isn't an external link, we can only * compare information from H5Lget_info since we don't have a query * function registered for them. @@ -1145,6 +1671,18 @@ 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); + /* close */ /* disable error reporting */ H5E_BEGIN_TRY { diff --git a/tools/lib/h5diff.h b/tools/lib/h5diff.h index df264dd..090d3d9 100644 --- a/tools/lib/h5diff.h +++ b/tools/lib/h5diff.h @@ -35,6 +35,7 @@ typedef struct { double percent; /* relative error value */ int n; /* count, compare up to count */ hsize_t count; /* count value */ + int linkfollow; /* link follow*/ 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_attr.c b/tools/lib/h5diff_attr.c index 73a7ee7..2cf6539 100644 --- a/tools/lib/h5diff_attr.c +++ b/tools/lib/h5diff_attr.c @@ -242,7 +242,6 @@ hsize_t diff_attr(hid_t loc1_id, /* the rest (-c, none, ...) */ else { - do_print_objname ("attribute", np1, np2); nfound = diff_array(buf1, buf2, nelmts1, @@ -257,8 +256,11 @@ hsize_t diff_attr(hid_t loc1_id, attr2_id); /* not comparable, no display the different number */ - if (!options->not_cmp) + if (!options->not_cmp && nfound) + { + do_print_objname ("attribute", np1, np2); print_found(nfound); + } } diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c index ad9331d..2cc84ca 100644 --- a/tools/lib/h5diff_dset.c +++ b/tools/lib/h5diff_dset.c @@ -545,11 +545,6 @@ hsize_t diff_datasetid( hid_t did1, } /* elmtno */ H5Sclose(sm_space); - /* free */ - HDfree(sm_buf1); - sm_buf1 = NULL; - HDfree(sm_buf2); - sm_buf2 = NULL; } /* hyperslab read */ }/*can_compare*/ diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index 55075a0..7f1019a 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -2000,10 +2000,10 @@ 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) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); if((sm_nelmts = H5Sget_select_npoints(f_space)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_select_npoints failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_select_npoints failed"); if (sm_nelmts > 0) { /* @@ -2011,7 +2011,7 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c * a hyperslab whose size is manageable. */ if((sm_nbytes = p_type_nbytes = H5Tget_size(p_type)) == 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); if (ctx->ndims > 0) for (i = ctx->ndims; i > 0; --i) { @@ -2025,18 +2025,17 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c assert(sm_nbytes == (hsize_t) ((size_t) sm_nbytes)); /*check for overflow*/ if((sm_buf = HDmalloc((size_t) sm_nelmts * p_type_nbytes)) == NULL) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for strip-mine"); + 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) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Screate_simple failed"); + 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) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); + 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) { - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed"); - } + 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; @@ -2050,7 +2049,7 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c /* 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) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_select_bounds failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_select_bounds failed"); elmtno = 0; for (i = 0; i < (size_t) ctx->ndims - 1; i++) { @@ -2066,10 +2065,12 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c ctx->sm_pos = elmtno; h5tools_dump_simple_data(stream, info, dset, ctx, flags, sm_nelmts, p_type, sm_buf); -done: + if(H5Sclose(sm_space) < 0) - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); - HDfree(sm_buf); + H5E_THROW(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); + if(sm_buf) + HDfree(sm_buf); + sm_buf = NULL; } else H5E_THROW(SUCCEED, H5E_tools_min_id_g, "nothing to print"); @@ -2081,6 +2082,9 @@ done: } /* hyperslab_count loop */ CATCH + if(sm_buf) + HDfree(sm_buf); + return ret_value; } @@ -2272,7 +2276,8 @@ h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, hid_t dset hid_t p_type, struct subset_t *sset, int indentlevel) { HERR_INIT(herr_t, SUCCEED) - hid_t f_space; /* file data space */ + int sndims; + hid_t f_space = -1; /* file data space */ size_t i; /* counters */ hsize_t total_size[H5S_MAX_RANK];/* total size of dataset*/ h5tools_context_t ctx; /* print context */ @@ -2288,8 +2293,9 @@ h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, hid_t dset memset(&ctx, 0, sizeof(ctx)); ctx.indent_level = indentlevel; ctx.need_prefix = 1; - if((ctx.ndims = H5Sget_simple_extent_ndims(f_space)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); + if((sndims = H5Sget_simple_extent_ndims(f_space)) < 0) + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); + ctx.ndims = (unsigned)sndims; /* assume entire data space to be printed */ if (ctx.ndims > 0) @@ -2297,10 +2303,11 @@ h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, hid_t dset ctx.p_min_idx[i] = 0; if(H5Sget_simple_extent_dims(f_space, total_size, NULL) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); ctx.size_last_dim = total_size[ctx.ndims - 1]; h5tools_display_simple_subset(stream, info, &ctx, dset, p_type, sset, f_space, total_size); + /* Terminate the output */ if (ctx.cur_column) { fputs(OPT(info->line_suf, ""), stream); @@ -2308,11 +2315,10 @@ h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, hid_t dset fputs(OPT(info->line_sep, ""), stream); } -done: - if(H5Sclose(f_space) < 0) - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); - CATCH + if(f_space >= 0 && H5Sclose(f_space) < 0) + H5E_THROW(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); + return ret_value; } @@ -3283,17 +3289,19 @@ h5tools_print_enum(h5tools_str_t *buffer, hid_t type) char **name = NULL; /*member names */ unsigned char *value = NULL; /*value array */ unsigned char *copy = NULL; /*a pointer to value array */ - unsigned nmembs; /*number of members */ + unsigned nmembs = 0; /*number of members */ 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 */ size_t type_size; /*value type size */ size_t dst_size; /*destination value type size */ + int snmembs; unsigned i; - if((nmembs = H5Tget_nmembers(type)) < 0) + if((snmembs = H5Tget_nmembers(type)) < 0) H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers failed"); + nmembs = (unsigned)snmembs; assert(nmembs > 0); if((super = H5Tget_super(type)) < 0) @@ -3301,6 +3309,7 @@ h5tools_print_enum(h5tools_str_t *buffer, hid_t type) if((type_size = H5Tget_size(type)) <= 0) H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size(type) failed"); + /* * Determine what datatype to use for the native values. To simplify * things we entertain three possibilities: @@ -3308,21 +3317,18 @@ h5tools_print_enum(h5tools_str_t *buffer, hid_t type) * 2. unsigned long long -- the largest native unsigned integer * 3. raw format */ - if (type_size <= sizeof(long long)) { + if(type_size <= sizeof(long long)) { dst_size = sizeof(long long); if((sign_type = H5Tget_sign(type))<0) H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_sign failed"); - if (H5T_SGN_NONE == sign_type) { + if(H5T_SGN_NONE == sign_type) native = H5T_NATIVE_ULLONG; - } - else { + else native = H5T_NATIVE_LLONG; - } - } - else { + } /* end if */ + else dst_size = type_size; - } /* Get the names and raw values of all members */ if((name = calloc(nmembs, sizeof(char *))) == NULL) @@ -3377,10 +3383,9 @@ h5tools_print_enum(h5tools_str_t *buffer, hid_t type) } CATCH - if(name) { /* Release resources */ - for (i = 0; i < nmembs; i++) + for(i = 0; i < nmembs; i++) if(name[i]) free(name[i]); free(name); @@ -3390,9 +3395,9 @@ CATCH free(value); if(super >= 0 && H5Tclose(super) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not close datatype's super class"); - if (0 == nmembs) + if(0 == nmembs) h5tools_str_append(buffer, "\n<empty>"); return ret_value; diff --git a/tools/lib/h5tools_error.h b/tools/lib/h5tools_error.h index 9efe223..dc5f87b 100644 --- a/tools/lib/h5tools_error.h +++ b/tools/lib/h5tools_error.h @@ -71,7 +71,7 @@ extern hid_t H5E_tools_min_id_g; /* Macro for "catching" flow of control when an error occurs. Note that the * H5_LEAVE macro won't jump back here once it's past this point. */ -#define CATCH past_catch = TRUE; catch_except:; +#define CATCH catch_except:; past_catch = TRUE; /* * H5_LEAVE macro, used to facilitate control flow between a @@ -116,3 +116,4 @@ extern hid_t H5E_tools_min_id_g; #define HGOTO_DONE(ret_val) {ret_value = ret_val; goto done;} #endif /* H5TOOLS_ERROR_H_ */ + diff --git a/tools/lib/h5tools_filters.c b/tools/lib/h5tools_filters.c index 325023d..341a5c9 100644 --- a/tools/lib/h5tools_filters.c +++ b/tools/lib/h5tools_filters.c @@ -49,31 +49,6 @@ int h5tools_canreadf(const char* name, /* object name, serves also as boolean pr int nfilters; /* number of filters */ H5Z_filter_t filtn; /* filter identification number */ int i; /* index */ - int have_deflate=0; /* assume initially we do not have filters */ - int have_szip=0; - int have_shuffle=0; - int have_fletcher=0; - int have_nbit=0; - int have_scaleoffset=0; - -#ifdef H5_HAVE_FILTER_DEFLATE - have_deflate=1; -#endif -#ifdef H5_HAVE_FILTER_SZIP - have_szip=1; -#endif -#ifdef H5_HAVE_FILTER_SHUFFLE - have_shuffle=1; -#endif -#ifdef H5_HAVE_FILTER_FLETCHER32 - have_fletcher=1; -#endif -#ifdef H5_HAVE_FILTER_NBIT - have_nbit=1; -#endif -#ifdef H5_HAVE_FILTER_SCALEOFFSET - have_scaleoffset=1; -#endif /* get information about filters */ @@ -106,72 +81,66 @@ int h5tools_canreadf(const char* name, /* object name, serves also as boolean pr *------------------------------------------------------------------------- */ case H5Z_FILTER_DEFLATE: - if (!have_deflate) - { +#ifndef H5_HAVE_FILTER_DEFLATE if (name) print_warning(name,"deflate"); return 0; - } +#endif break; /*------------------------------------------------------------------------- * H5Z_FILTER_SZIP 4 , szip compression *------------------------------------------------------------------------- */ case H5Z_FILTER_SZIP: - if (!have_szip) - { +#ifndef H5_HAVE_FILTER_SZIP if (name) print_warning(name,"SZIP"); return 0; - } +#endif break; /*------------------------------------------------------------------------- * H5Z_FILTER_SHUFFLE 2 , shuffle the data *------------------------------------------------------------------------- */ case H5Z_FILTER_SHUFFLE: - if (!have_shuffle) - { +#ifndef H5_HAVE_FILTER_SHUFFLE if (name) print_warning(name,"shuffle"); return 0; - } +#endif break; /*------------------------------------------------------------------------- * H5Z_FILTER_FLETCHER32 3 , fletcher32 checksum of EDC *------------------------------------------------------------------------- */ case H5Z_FILTER_FLETCHER32: - if (!have_fletcher) - { +#ifndef H5_HAVE_FILTER_FLETCHER32 if (name) print_warning(name,"fletcher32"); return 0; - } +#endif break; /*------------------------------------------------------------------------- * H5Z_FILTER_NBIT *------------------------------------------------------------------------- */ case H5Z_FILTER_NBIT: - if (!have_nbit) - { +#ifndef H5_HAVE_FILTER_NBIT if (name) print_warning(name,"nbit"); return 0; - } +#endif break; /*------------------------------------------------------------------------- * H5Z_FILTER_SCALEOFFSET *------------------------------------------------------------------------- */ case H5Z_FILTER_SCALEOFFSET: - if (!have_scaleoffset) - { +#ifndef H5_HAVE_FILTER_SCALEOFFSET if (name) print_warning(name,"scaleoffset"); return 0; - } +#endif break; }/*switch*/ }/*for*/ @@ -197,34 +166,6 @@ int h5tools_canreadf(const char* name, /* object name, serves also as boolean pr */ int h5tools_can_encode( H5Z_filter_t filtn) { - - int have_deflate=0; /* assume initially we do not have filters */ - int have_szip=0; - int have_shuffle=0; - int have_fletcher=0; - int have_nbit=0; - int have_scaleoffset=0; - unsigned int filter_config_flags; - -#ifdef H5_HAVE_FILTER_DEFLATE - have_deflate=1; -#endif -#ifdef H5_HAVE_FILTER_SZIP - have_szip=1; -#endif -#ifdef H5_HAVE_FILTER_SHUFFLE - have_shuffle=1; -#endif -#ifdef H5_HAVE_FILTER_FLETCHER32 - have_fletcher=1; -#endif -#ifdef H5_HAVE_FILTER_NBIT - have_nbit=1; -#endif -#ifdef H5_HAVE_FILTER_SCALEOFFSET - have_scaleoffset=1; -#endif - switch (filtn) { /* user defined filter */ @@ -232,16 +173,17 @@ int h5tools_can_encode( H5Z_filter_t filtn) return 0; case H5Z_FILTER_DEFLATE: - if (!have_deflate) - { - return 0; - } +#ifndef H5_HAVE_FILTER_DEFLATE + return 0; +#endif break; case H5Z_FILTER_SZIP: - if (!have_szip) +#ifndef H5_HAVE_FILTER_SZIP + return 0; +#else { - return 0; - } + unsigned int filter_config_flags; + if(H5Zget_filter_info(filtn, &filter_config_flags)<0) return -1; if ((filter_config_flags & @@ -263,30 +205,28 @@ int h5tools_can_encode( H5Z_filter_t filtn) (H5Z_FILTER_CONFIG_ENCODE_ENABLED|H5Z_FILTER_CONFIG_DECODE_ENABLED)) { return 1; } + } +#endif break; case H5Z_FILTER_SHUFFLE: - if (!have_shuffle) - { +#ifndef H5_HAVE_FILTER_SHUFFLE return 0; - } +#endif break; case H5Z_FILTER_FLETCHER32: - if (!have_fletcher) - { +#ifndef H5_HAVE_FILTER_FLETCHER32 return 0; - } +#endif break; case H5Z_FILTER_NBIT: - if (!have_nbit) - { +#ifndef H5_HAVE_FILTER_NBIT return 0; - } +#endif break; case H5Z_FILTER_SCALEOFFSET: - if (!have_scaleoffset) - { +#ifndef H5_HAVE_FILTER_SCALEOFFSET return 0; - } +#endif break; }/*switch*/ diff --git a/tools/misc/Makefile.in b/tools/misc/Makefile.in index a3d3e23..0b8ccb6 100644 --- a/tools/misc/Makefile.in +++ b/tools/misc/Makefile.in @@ -370,12 +370,12 @@ CP = cp # Some machines need a command to run executables; this is that command # so that our tests will run. -# We use RUNTESTS instead of RUNSERIAL directly because it may be that +# We use RUNEXEC instead of RUNSERIAL directly because it may be that # some tests need to be run with a different command. Older versions # of the makefiles used the command # $(LIBTOOL) --mode=execute # in some directories, for instance. -RUNTESTS = $(RUNSERIAL) +RUNEXEC = $(RUNSERIAL) # Libraries to link to while building LIBHDF5 = $(top_builddir)/src/libhdf5.la @@ -969,7 +969,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_: fi; \ echo "============================" >> $${log}; \ srcdir="$(srcdir)" \ - $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ + $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ && touch $(@:.chkexe_=.chkexe) || \ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ (cat $${log} && false) || exit 1; \ @@ -1040,7 +1040,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS) @for test in $(TEST_PROG_PARA) dummy; do \ if test $$test != dummy; then \ $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \ - RUNTESTS="$(RUNPARALLEL)" || exit 1; \ + RUNEXEC="$(RUNPARALLEL)" || exit 1; \ fi; \ done @for test in $(TEST_SCRIPT_PARA) dummy; do \ diff --git a/tools/misc/h5cc.in b/tools/misc/h5cc.in index 28f0dee..c274f3f 100755 --- a/tools/misc/h5cc.in +++ b/tools/misc/h5cc.in @@ -38,6 +38,10 @@ HL="@HL@" ## ## ############################################################################ +# Constants definitions +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + host_os="@host_os@" prog_name="`basename $0`" @@ -95,7 +99,7 @@ usage() { echo " HDF5_USE_SHLIB=[yes|no] - use shared or static version of the HDF5 library" echo " [default: no]" echo " " - exit 1 + exit $EXIT_FAILURE } # Show the configuration summary of the library recorded in the @@ -107,7 +111,7 @@ showconfigure() } # Main -status=0 +status=$EXIT_SUCCESS if test "$#" = "0"; then # No parameters specified, issue usage statement and exit. diff --git a/tools/misc/h5mkgrp.c b/tools/misc/h5mkgrp.c index 1452a64..a6fdc56 100644 --- a/tools/misc/h5mkgrp.c +++ b/tools/misc/h5mkgrp.c @@ -319,6 +319,6 @@ main(int argc, const char *argv[]) /* Shut down h5tools lib */ h5tools_close(); - return 0; + return EXIT_SUCCESS; } /* end main() */ diff --git a/tools/misc/h5redeploy.in b/tools/misc/h5redeploy.in index 6abca62..ae79b70 100755 --- a/tools/misc/h5redeploy.in +++ b/tools/misc/h5redeploy.in @@ -18,6 +18,10 @@ ## in a new location. ## For help page, use "h5redeploy -help" +# Constants definitions +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + # Function definitions # show help page @@ -34,7 +38,7 @@ usage() { echo " directory and writable. [default: $h5tools]" echo " -show Show the commands without executing them" echo " " - exit 1 + exit $EXIT_FAILURE } # display variable values @@ -96,7 +100,7 @@ for arg in $@ ; do *) ERROR "Unknown Option($arg)" usage - exit 1 + exit $EXIT_FAILURE ;; esac done @@ -104,7 +108,7 @@ done # Sanity checks if [ ! -d $prefix ]; then ERROR "prefix($prefix) is not an existing directory" - exit 1 + exit $EXIT_FAILURE fi for x in $h5tools; do @@ -112,14 +116,14 @@ for x in $h5tools; do foundtools="$foundtools $x" if [ ! -w $x ]; then ERROR "h5tool($x) is not writable" - exit 1 + exit $EXIT_FAILURE fi fi done if [ -z "$foundtools" ]; then ERROR "found no tools to modify" - exit 1 + exit $EXIT_FAILURE fi # Show actions to be taken and get consent @@ -131,7 +135,7 @@ if [ x-$fmode = x- ]; then ans=`echo $ansx | tr "[A-Z]" "[a-z]"` if [ x-$ans != x-yes ]; then echo ABORT. No tools changed. - exit 1 + exit $EXIT_FAILURE fi fi @@ -166,7 +170,7 @@ done # Cleanup rm -f $CMDFILE -exit 0 +exit $EXIT_SUCCESS # Some possible future features to add # CCBASE - Name of the alternative C compiler diff --git a/tools/misc/h5repart.c b/tools/misc/h5repart.c index 91df7b6..d41dfc9 100644 --- a/tools/misc/h5repart.c +++ b/tools/misc/h5repart.c @@ -98,7 +98,7 @@ usage (const char *progname) "`k' for kB.\n"); fprintf(stderr, "File family names include an integer printf " "format such as `%%d'\n"); - exit (1); + exit (EXIT_FAILURE); } @@ -238,7 +238,7 @@ main (int argc, char *argv[]) } else if (!strcmp(argv[argno], "-V")) { printf("This is %s version %u.%u release %u\n", prog_name, H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE); - exit(0); + exit(EXIT_SUCCESS); } else if (!strcmp (argv[argno], "-family_to_sec2")) { family_to_sec2 = TRUE; argno++; @@ -262,12 +262,12 @@ main (int argc, char *argv[]) if ((src=HDopen(src_name, O_RDONLY,0))<0) { perror (src_name); - exit (1); + exit (EXIT_FAILURE); } if (HDfstat(src, &sb)<0) { perror ("fstat"); - exit (1); + exit (EXIT_FAILURE); } src_size = src_act_size = sb.st_size; if (verbose) fprintf (stderr, "< %s\n", src_name); @@ -282,7 +282,7 @@ main (int argc, char *argv[]) if ((dst=HDopen (dst_name, O_RDWR|O_CREAT|O_TRUNC, 0666))<0) { perror (dst_name); - exit (1); + exit (EXIT_FAILURE); } if (verbose) fprintf (stderr, "> %s\n", dst_name); @@ -308,10 +308,10 @@ main (int argc, char *argv[]) n = (size_t)MIN ((off_t)n, src_act_size-src_offset); if ((nio=HDread (src, buf, n))<0) { perror ("read"); - exit (1); + exit (EXIT_FAILURE); } else if ((size_t)nio!=n) { fprintf (stderr, "%s: short read\n", src_name); - exit (1); + exit (EXIT_FAILURE); } for (i=0; i<n; i++) { if (buf[i]) break; @@ -331,14 +331,14 @@ main (int argc, char *argv[]) if (need_write) { if (need_seek && HDlseek (dst, dst_offset, SEEK_SET)<0) { perror ("HDlseek"); - exit (1); + exit (EXIT_FAILURE); } if ((nio=HDwrite (dst, buf, n))<0) { perror ("write"); - exit (1); + exit (EXIT_FAILURE); } else if ((size_t)nio!=n) { fprintf (stderr, "%s: short write\n", dst_name); - exit (1); + exit (EXIT_FAILURE); } need_seek = FALSE; } else { @@ -366,11 +366,11 @@ main (int argc, char *argv[]) break; } else if (src<0) { perror (src_name); - exit (1); + exit (EXIT_FAILURE); } if (HDfstat (src, &sb)<0) { perror ("fstat"); - exit (1); + exit (EXIT_FAILURE); } src_act_size = sb.st_size; if (src_act_size>src_size) { @@ -391,26 +391,26 @@ main (int argc, char *argv[]) if (0==dst_membno) { if (HDlseek (dst, dst_size-1, SEEK_SET)<0) { perror ("HDHDlseek"); - exit (1); + exit (EXIT_FAILURE); } if (HDread (dst, buf, 1)<0) { perror ("read"); - exit (1); + exit (EXIT_FAILURE); } if (HDlseek (dst, dst_size-1, SEEK_SET)<0) { perror ("HDlseek"); - exit (1); + exit (EXIT_FAILURE); } if (HDwrite (dst, buf, 1)<0) { perror ("write"); - exit (1); + exit (EXIT_FAILURE); } } HDclose (dst); sprintf (dst_name, dst_gen_name, ++dst_membno); if ((dst=HDopen (dst_name, O_RDWR|O_CREAT|O_TRUNC, 0666))<0) { perror (dst_name); - exit (1); + exit (EXIT_FAILURE); } dst_offset = 0; need_seek = FALSE; @@ -426,19 +426,19 @@ main (int argc, char *argv[]) if (need_seek) { if (HDlseek (dst, dst_offset-1, SEEK_SET)<0) { perror ("HDlseek"); - exit (1); + exit (EXIT_FAILURE); } if (HDread (dst, buf, 1)<0) { perror ("read"); - exit (1); + exit (EXIT_FAILURE); } if (HDlseek (dst, dst_offset-1, SEEK_SET)<0) { perror ("HDlseek"); - exit (1); + exit (EXIT_FAILURE); } if (HDwrite (dst, buf, 1)<0) { perror ("write"); - exit (1); + exit (EXIT_FAILURE); } } HDclose (dst); @@ -447,7 +447,7 @@ main (int argc, char *argv[]) * These private properties are for this tool only. */ if ((fapl=H5Pcreate(H5P_FILE_ACCESS))<0) { perror ("H5Pcreate"); - exit (1); + exit (EXIT_FAILURE); } if(family_to_sec2) { @@ -456,7 +456,7 @@ main (int argc, char *argv[]) * driver information saved in the superblock. */ if(H5Pset(fapl, H5F_ACS_FAMILY_TO_SEC2_NAME, &family_to_sec2) < 0) { perror ("H5Pset"); - exit (1); + exit (EXIT_FAILURE); } } else { /* Modify family size saved in superblock through private property. It signals @@ -464,14 +464,14 @@ main (int argc, char *argv[]) * This private property is for this tool only. */ if(H5Pset_fapl_family(fapl, H5F_FAMILY_DEFAULT, H5P_DEFAULT) < 0) { perror ("H5Pset_fapl_family"); - exit (1); + exit (EXIT_FAILURE); } /* Set the property of the new member size as hsize_t */ hdsize = dst_size; if(H5Pset(fapl, H5F_ACS_FAMILY_NEWSIZE_NAME, &hdsize) < 0) { perror ("H5Pset"); - exit (1); + exit (EXIT_FAILURE); } } @@ -488,16 +488,16 @@ main (int argc, char *argv[]) if(file>=0) { if(H5Fclose(file)<0) { perror ("H5Fclose"); - exit (1); + exit (EXIT_FAILURE); } } if(H5Pclose(fapl)<0) { perror ("H5Pclose"); - exit (1); + exit (EXIT_FAILURE); } /* Free resources and return */ free (buf); - return 0; + return EXIT_SUCCESS; } diff --git a/tools/misc/h5repart_gentest.c b/tools/misc/h5repart_gentest.c index 9fcc9c8..8420da5 100644 --- a/tools/misc/h5repart_gentest.c +++ b/tools/misc/h5repart_gentest.c @@ -39,29 +39,29 @@ int main(void) /* Set property list and file name for FAMILY driver */ if ((fapl=H5Pcreate(H5P_FILE_ACCESS)) < 0) { perror ("H5Pcreate"); - exit (1); + exit (EXIT_FAILURE); } if(H5Pset_fapl_family(fapl, (hsize_t)FAMILY_SIZE, H5P_DEFAULT) < 0) { perror ("H5Pset_fapl_family"); - exit (1); + exit (EXIT_FAILURE); } if((file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) { perror("H5Fcreate"); - exit(1); + exit(EXIT_FAILURE); } /* Create and write dataset */ if((space = H5Screate_simple(2, dims, NULL)) < 0) { perror("H5Screate_simple"); - exit(1); + exit(EXIT_FAILURE); } if((dset = H5Dcreate2(file, dname, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) { perror("H5Dcreate2"); - exit(1); + exit(EXIT_FAILURE); } @@ -71,28 +71,28 @@ int main(void) if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) { perror("H5Dwrite"); - exit(1); + exit(EXIT_FAILURE); } if(H5Sclose(space) < 0) { perror ("H5Sclose"); - exit (1); + exit (EXIT_FAILURE); } if(H5Dclose(dset) < 0) { perror ("H5Dclose"); - exit (1); + exit (EXIT_FAILURE); } if(H5Pclose(fapl) < 0) { perror ("H5Pclose"); - exit (1); + exit (EXIT_FAILURE); } if(H5Fclose(file) < 0) { perror ("H5Fclose"); - exit (1); + exit (EXIT_FAILURE); } puts(" PASSED"); fflush(stdout); diff --git a/tools/misc/testh5mkgrp.sh b/tools/misc/testh5mkgrp.sh index 50ac23b..e6cb96e 100644 --- a/tools/misc/testh5mkgrp.sh +++ b/tools/misc/testh5mkgrp.sh @@ -19,6 +19,10 @@ # Tuesday, February 13, 2007 # +TESTNAME=h5mkgrp +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + H5MKGRP=h5mkgrp # The tool name H5MKGRP_BIN=`pwd`/$H5MKGRP # The path of the tool binary H5LS=h5ls # The h5ls tool name @@ -182,8 +186,9 @@ RUNTEST h5mkgrp_nested_mult_latest.h5 "-lp" /one/two /three/four if test $nerrors -eq 0 ; then - echo "All h5mkgrp tests passed." + echo "All $TESTNAME tests passed." + exit $EXIT_SUCCESS +else + echo "$TESTNAME tests failed with $nerrors errors." + exit $EXIT_FAILURE fi - -exit $nerrors - diff --git a/tools/misc/testh5repart.sh.in b/tools/misc/testh5repart.sh.in index 62c99d7..7d4e020 100644 --- a/tools/misc/testh5repart.sh.in +++ b/tools/misc/testh5repart.sh.in @@ -15,6 +15,10 @@ # # Tests for the h5repart tool +TESTNAME=h5repart +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + REPART=h5repart # The tool name REPART_BIN=`pwd`/$REPART # The path of the tool binary @@ -100,14 +104,16 @@ TOOLTEST -m 20000 -family_to_sec2 family_file%05d.h5 $actual_dir/family_to_sec2. OUTPUTTEST echo -if test $nerrors -eq 0 ; then - echo "All $REPART tests passed." -fi - # Clean up output file if test -z "$HDF5_NOCLEANUP"; then cd $actual_dir rm -f fst_family*.h5 scd_family*.h5 family_to_sec2.h5 fi -exit $nerrors +if test $nerrors -eq 0 ; then + echo "All $TESTNAME tests passed." + exit $EXIT_SUCCESS +else + echo "$TESTNAME tests failed with $nerrors errors." + exit $EXIT_FAILURE +fi |