diff options
Diffstat (limited to 'tools/h5ls')
-rw-r--r-- | tools/h5ls/CMakeLists.txt | 40 | ||||
-rw-r--r-- | tools/h5ls/Makefile.in | 3 | ||||
-rw-r--r-- | tools/h5ls/h5ls.c | 41 | ||||
-rw-r--r-- | tools/h5ls/testh5ls.sh.in | 9 |
4 files changed, 80 insertions, 13 deletions
diff --git a/tools/h5ls/CMakeLists.txt b/tools/h5ls/CMakeLists.txt index c81f42b..431a693 100644 --- a/tools/h5ls/CMakeLists.txt +++ b/tools/h5ls/CMakeLists.txt @@ -11,8 +11,7 @@ INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test) # Add the h5ls executable #----------------------------------------------------------------------------- ADD_EXECUTABLE (h5ls ${HDF5_TOOLS_H5LS_SOURCE_DIR}/h5ls.c) -H5_NAMING (h5ls) -TARGET_WIN_PROPERTIES (h5ls) +H5_NAMING (h5ls ${LIB_TYPE}) TARGET_LINK_LIBRARIES (h5ls ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) SET (H5_DEP_EXECUTABLES @@ -63,6 +62,7 @@ IF (BUILD_TESTING) tsoftlinks-5.ls textlinksrc-nodangle-1.ls textlinksrc-nodangle-2.ls + tgrp_comments.ls tsoftlinks-nodangle-1.ls thlinks-nodangle-1.ls tgroup.ls @@ -72,6 +72,9 @@ IF (BUILD_TESTING) thlink-1.ls tloop-1.ls tnestcomp-1.ls + tnestcomp-2.ls + tnestcomp-3.ls + tnestcomp-4.ls tsaf.ls tslink-1.ls tstr-1.ls @@ -92,6 +95,7 @@ IF (BUILD_TESTING) textlinksrc.h5 textlinktar.h5 tgroup.h5 + tgrp_comments.h5 thlink.h5 tloop.h5 tnestedcomp.h5 @@ -143,6 +147,10 @@ IF (BUILD_TESTING) -D "TEST_REFERENCE=${resultfile}.ls" -P "${HDF5_RESOURCES_DIR}/runTest.cmake" ) + IF (NOT "${last_test}" STREQUAL "") + SET_TESTS_PROPERTIES (H5LS-${resultfile} PROPERTIES DEPENDS ${last_test}) + ENDIF (NOT "${last_test}" STREQUAL "") + SET (last_test "H5LS-${resultfile}") ENDMACRO (ADD_H5_TEST file) ############################################################################## @@ -208,6 +216,8 @@ IF (BUILD_TESTING) textlinksrc-6-old.out.err textlinksrc-7-old.out textlinksrc-7-old.out.err + tgrp_comments.out + tgrp_comments.out.err tsoftlinks-1.out tsoftlinks-1.out.err tsoftlinks-2.out @@ -240,6 +250,12 @@ IF (BUILD_TESTING) tloop-1.out.err tnestcomp-1.out tnestcomp-1.out.err + tnestcomp-2.out + tnestcomp-2.out.err + tnestcomp-3.out + tnestcomp-3.out.err + tnestcomp-4.out + tnestcomp-4.out.err tsaf.out tsaf.out.err tslink-1.out @@ -255,6 +271,17 @@ IF (BUILD_TESTING) tvldtypes2be.out tvldtypes2be.out.err ) + IF (NOT "${last_test}" STREQUAL "") + SET_TESTS_PROPERTIES (H5LS-clearall-objects PROPERTIES DEPENDS ${last_test}) + ENDIF (NOT "${last_test}" STREQUAL "") + SET (last_test "H5LS-clearall-objects") + + # If using memchecker add tests without using scripts + IF (HDF5_ENABLE_USING_MEMCHECKER) + ADD_TEST (NAME H5LS-help COMMAND h5ls -w80 -h) + ADD_TEST (NAME H5LS-tall COMMAND h5ls -w80 tall.h5) + ADD_TEST (NAME H5LS-tsoftlinks COMMAND h5ls --follow-symlinks tsoftlinks.h5) + ENDIF (HDF5_ENABLE_USING_MEMCHECKER) # test the help syntax ADD_H5_TEST (help-1 0 -w80 -h) @@ -273,6 +300,9 @@ IF (BUILD_TESTING) ADD_H5_TEST (tgroup-1 1 -w80 -r -g tgroup.h5) ADD_H5_TEST (tgroup-2 0 -w80 -g tgroup.h5/g1) + # test for files with groups that have long comments + ADD_H5_TEST (tgrp_comments 0 -w80 -v -g tgrp_comments.h5/glongcomment) + # test for displaying simple space datasets ADD_H5_TEST (tdset-1 0 -w80 -r -d tdset.h5) @@ -325,6 +355,12 @@ IF (BUILD_TESTING) #test for the nested compound type ADD_H5_TEST (tnestcomp-1 0 -w80 -r -d tnestedcomp.h5) + ADD_H5_TEST (tnestcomp-2 0 -w80 -r -d -S tnestedcomp.h5) + + ADD_H5_TEST (tnestcomp-3 0 -w80 -r -d -l tnestedcomp.h5) + + ADD_H5_TEST (tnestcomp-4 0 -w80 -r -d -l -S tnestedcomp.h5) + # test for loop detection ADD_H5_TEST (tloop-1 0 -w80 -r -d tloop.h5) diff --git a/tools/h5ls/Makefile.in b/tools/h5ls/Makefile.in index 6c3a01a..3829704 100644 --- a/tools/h5ls/Makefile.in +++ b/tools/h5ls/Makefile.in @@ -140,6 +140,7 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@ DIRECT_VFD = @DIRECT_VFD@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DYNAMIC_DIRS = @DYNAMIC_DIRS@ @@ -201,6 +202,7 @@ LTLIBOBJS = @LTLIBOBJS@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MPE = @MPE@ MPI_GET_SIZE = @MPI_GET_SIZE@ @@ -257,6 +259,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c index b1d9ee9..420ff3f 100644 --- a/tools/h5ls/h5ls.c +++ b/tools/h5ls/h5ls.c @@ -1263,8 +1263,16 @@ dump_dataset_values(hid_t dset) info.arr_suf = ""; info.arr_sep = " "; - info.cmpd_pre = ""; - info.cmpd_suf = ""; + if (label_g) + { + info.cmpd_pre = "{"; + info.cmpd_suf = "}"; + } + else + { + info.cmpd_pre = ""; + info.cmpd_suf = ""; + } info.cmpd_sep = " "; if (label_g) info.cmpd_name = "%s="; @@ -1777,7 +1785,9 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void /* Show detailed information about the object, beginning with information * which is common to all objects. */ if(verbose_g > 0) { - char comment[50]; + size_t buf_size = 0; + char* comment = NULL; + ssize_t cmt_bufsize = -1; /* Display attributes */ if(obj_type >= 0) @@ -1803,14 +1813,23 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void } /* end if */ /* Object comment */ - comment[0] = '\0'; - H5Oget_comment(obj, comment, sizeof(comment)); - HDstrcpy(comment + sizeof(comment) - 4, "..."); - if(comment[0]) { - printf(" %-10s \"", "Comment:"); - display_string(stdout, comment, FALSE); - puts("\""); - } /* end if */ + cmt_bufsize = H5Oget_comment(obj, comment, buf_size); + + /* if the actual length of the comment is longer than cmt_bufsize, then call + * H5Oget_comment again with the correct value. + * If the call to H5Oget_comment returned an error, skip this block */ + if (cmt_bufsize > 0) { + comment = (char *)HDmalloc((size_t)cmt_bufsize); /* new_size including null terminator */ + if(comment) { + cmt_bufsize = H5Oget_comment(obj, comment, cmt_bufsize); + if(cmt_bufsize > 0) { + printf(" %-10s \"", "Comment:"); + display_string(stdout, comment, FALSE); + puts("\""); + } /* end if */ + HDfree(comment); + } + } } /* end if */ /* Detailed list for object */ diff --git a/tools/h5ls/testh5ls.sh.in b/tools/h5ls/testh5ls.sh.in index 34659e0..f9b68d7 100644 --- a/tools/h5ls/testh5ls.sh.in +++ b/tools/h5ls/testh5ls.sh.in @@ -135,6 +135,9 @@ TOOLTEST tgroup-3.ls 0 -w80 tgroup.h5/g1 TOOLTEST tgroup-1.ls 1 -w80 -r -g tgroup.h5 TOOLTEST tgroup-2.ls 0 -w80 -g tgroup.h5/g1 +# test for files with groups that have long comments +TOOLTEST tgrp_comments.ls 0 -w80 -v -g tgrp_comments.h5/glongcomment + # test for displaying simple space datasets TOOLTEST tdset-1.ls 0 -w80 -r -d tdset.h5 @@ -188,6 +191,12 @@ TOOLTEST tcomp-1.ls 0 -w80 -r -d tcompound.h5 #test for the nested compound type TOOLTEST tnestcomp-1.ls 0 -w80 -r -d tnestedcomp.h5 +TOOLTEST tnestcomp-2.ls 0 -w80 -r -d -S tnestedcomp.h5 + +TOOLTEST tnestcomp-3.ls 0 -w80 -r -d -l tnestedcomp.h5 + +TOOLTEST tnestcomp-4.ls 0 -w80 -r -d -l -S tnestedcomp.h5 + # test for loop detection TOOLTEST tloop-1.ls 0 -w80 -r -d tloop.h5 |