diff options
Diffstat (limited to 'tools')
98 files changed, 2353 insertions, 1314 deletions
diff --git a/tools/COPYING b/tools/COPYING index 6903daf..6903daf 100755..100644 --- a/tools/COPYING +++ b/tools/COPYING diff --git a/tools/h5copy/CMakeLists.txt b/tools/h5copy/CMakeLists.txt index f9e7c12..94eb732 100644 --- a/tools/h5copy/CMakeLists.txt +++ b/tools/h5copy/CMakeLists.txt @@ -374,11 +374,14 @@ ENDIF (BUILD_TESTING) #-----------------------------------------------------------------------------
# Rules for Installation of tools using make Install target
#-----------------------------------------------------------------------------
+ +INSTALL_PROGRAM_PDB (h5copy ${HDF5_INSTALL_BIN_DIR} toolsapplications) + INSTALL ( TARGETS h5copy RUNTIME DESTINATION - ${HDF5_INSTALL_BIN_DIR}/tools + ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications ) diff --git a/tools/h5copy/testfiles/h5copy_ref.out.ls b/tools/h5copy/testfiles/h5copy_ref.out.ls index 0769dc8..d685af2 100644 --- a/tools/h5copy/testfiles/h5copy_ref.out.ls +++ b/tools/h5copy/testfiles/h5copy_ref.out.ls @@ -21,7 +21,7 @@ Opened "./testfiles/h5copy_ref.out.h5" with sec2 driver. Storage: <details removed for portability> Type: object reference /COPY/Dset_REGREF Dataset {2/2} - Location: 1:9400 + Location: 1:5304 Links: 1 Storage: <details removed for portability> Type: dataset region reference diff --git a/tools/h5copy/testfiles/h5copytst.out.ls b/tools/h5copy/testfiles/h5copytst.out.ls index 62c860b..4044aaf 100644 --- a/tools/h5copy/testfiles/h5copytst.out.ls +++ b/tools/h5copy/testfiles/h5copytst.out.ls @@ -3,57 +3,57 @@ Opened "./testfiles/h5copytst.out.h5" with sec2 driver. Location: 1:96 Links: 1 /A Group - Location: 1:88336 + Location: 1:84304 Links: 1 /A/B1 Group - Location: 1:89040 + Location: 1:85008 Links: 1 /A/B1/simple Dataset {6/6} - Location: 1:88208 + Location: 1:84176 Links: 1 Storage: <details removed for portability> Type: 32-bit little-endian integer /A/B2 Group - Location: 1:92576 + Location: 1:88544 Links: 1 /A/B2/simple2 Dataset {6/6} - Location: 1:92448 + Location: 1:88416 Links: 1 Storage: <details removed for portability> Type: 32-bit little-endian integer /C Group - Location: 1:95784 + Location: 1:91752 Links: 1 /C/D Group - Location: 1:96488 + Location: 1:92456 Links: 1 /C/D/simple Dataset {6/6} - Location: 1:95656 + Location: 1:91624 Links: 1 Storage: <details removed for portability> Type: 32-bit little-endian integer /E Group - Location: 1:110400 + Location: 1:106368 Links: 1 /E/F Group - Location: 1:111104 + Location: 1:107072 Links: 1 /E/F/grp_dsets Group - Location: 1:98600 + Location: 1:94568 Links: 1 /E/F/grp_dsets/chunk Dataset {6/6} - Location: 1:102784 + Location: 1:98752 Links: 1 Chunks: {2} 8 bytes Storage: <details removed for portability> Type: 32-bit little-endian integer /E/F/grp_dsets/compact Dataset {6/6} - Location: 1:103240 + Location: 1:99208 Links: 1 Storage: <details removed for portability> Type: 32-bit little-endian integer /E/F/grp_dsets/compound Dataset {2/2} - Location: 1:103376 + Location: 1:99344 Links: 1 Storage: <details removed for portability> Type: struct { @@ -61,60 +61,60 @@ Opened "./testfiles/h5copytst.out.h5" with sec2 driver. "str2" +20 20-byte null-terminated ASCII string } 40 bytes /E/F/grp_dsets/compressed Dataset {6/6} - Location: 1:105688 + Location: 1:101656 Links: 1 Chunks: {2} 8 bytes Storage: <details removed for portability> Filter-0: deflate-1 OPT {1} Type: 32-bit little-endian integer /E/F/grp_dsets/named_vl Dataset {2/2} - Location: 1:109952 + Location: 1:105920 Links: 1 Storage: <details removed for portability> - Type: shared-1:110080 variable length of + Type: shared-1:106048 variable length of 32-bit little-endian integer /E/F/grp_dsets/nested_vl Dataset {2/2} - Location: 1:110128 + Location: 1:106096 Links: 1 Storage: <details removed for portability> Type: variable length of variable length of 32-bit little-endian integer /E/F/grp_dsets/simple Dataset {6/6} - Location: 1:110272 + Location: 1:106240 Links: 1 Storage: <details removed for portability> Type: 32-bit little-endian integer /E/F/grp_dsets/vl Type - Location: 1:110080 + Location: 1:106048 Links: 2 - Type: shared-1:110080 variable length of + Type: shared-1:106048 variable length of 32-bit little-endian integer /G Group - Location: 1:126048 + Location: 1:122016 Links: 1 /G/H Group - Location: 1:126752 + Location: 1:122720 Links: 1 /G/H/grp_nested Group - Location: 1:113128 + Location: 1:109096 Links: 1 /G/H/grp_nested/grp_dsets Group - Location: 1:113920 + Location: 1:109888 Links: 1 /G/H/grp_nested/grp_dsets/chunk Dataset {6/6} - Location: 1:118104 + Location: 1:114072 Links: 1 Chunks: {2} 8 bytes Storage: <details removed for portability> Type: 32-bit little-endian integer /G/H/grp_nested/grp_dsets/compact Dataset {6/6} - Location: 1:118560 + Location: 1:114528 Links: 1 Storage: <details removed for portability> Type: 32-bit little-endian integer /G/H/grp_nested/grp_dsets/compound Dataset {2/2} - Location: 1:118696 + Location: 1:114664 Links: 1 Storage: <details removed for portability> Type: struct { @@ -122,34 +122,34 @@ Opened "./testfiles/h5copytst.out.h5" with sec2 driver. "str2" +20 20-byte null-terminated ASCII string } 40 bytes /G/H/grp_nested/grp_dsets/compressed Dataset {6/6} - Location: 1:121008 + Location: 1:116976 Links: 1 Chunks: {2} 8 bytes Storage: <details removed for portability> Filter-0: deflate-1 OPT {1} Type: 32-bit little-endian integer /G/H/grp_nested/grp_dsets/named_vl Dataset {2/2} - Location: 1:125272 + Location: 1:121240 Links: 1 Storage: <details removed for portability> - Type: shared-1:125400 variable length of + Type: shared-1:121368 variable length of 32-bit little-endian integer /G/H/grp_nested/grp_dsets/nested_vl Dataset {2/2} - Location: 1:125448 + Location: 1:121416 Links: 1 Storage: <details removed for portability> Type: variable length of variable length of 32-bit little-endian integer /G/H/grp_nested/grp_dsets/simple Dataset {6/6} - Location: 1:125592 + Location: 1:121560 Links: 1 Storage: <details removed for portability> Type: 32-bit little-endian integer /G/H/grp_nested/grp_dsets/vl Type - Location: 1:125400 + Location: 1:121368 Links: 2 - Type: shared-1:125400 variable length of + Type: shared-1:121368 variable length of 32-bit little-endian integer /chunk Dataset {6/6} Location: 1:6312 @@ -178,21 +178,21 @@ Opened "./testfiles/h5copytst.out.h5" with sec2 driver. Filter-0: deflate-1 OPT {1} Type: 32-bit little-endian integer /grp_dsets Group - Location: 1:32160 + Location: 1:28128 Links: 1 /grp_dsets/chunk Dataset {6/6} - Location: 1:36344 + Location: 1:32312 Links: 1 Chunks: {2} 8 bytes Storage: <details removed for portability> Type: 32-bit little-endian integer /grp_dsets/compact Dataset {6/6} - Location: 1:36800 + Location: 1:32768 Links: 1 Storage: <details removed for portability> Type: 32-bit little-endian integer /grp_dsets/compound Dataset {2/2} - Location: 1:36936 + Location: 1:32904 Links: 1 Storage: <details removed for portability> Type: struct { @@ -200,62 +200,62 @@ Opened "./testfiles/h5copytst.out.h5" with sec2 driver. "str2" +20 20-byte null-terminated ASCII string } 40 bytes /grp_dsets/compressed Dataset {6/6} - Location: 1:39248 + Location: 1:35216 Links: 1 Chunks: {2} 8 bytes Storage: <details removed for portability> Filter-0: deflate-1 OPT {1} Type: 32-bit little-endian integer /grp_dsets/named_vl Dataset {2/2} - Location: 1:43512 + Location: 1:39480 Links: 1 Storage: <details removed for portability> - Type: shared-1:43640 variable length of + Type: shared-1:39608 variable length of 32-bit little-endian integer /grp_dsets/nested_vl Dataset {2/2} - Location: 1:43688 + Location: 1:39656 Links: 1 Storage: <details removed for portability> Type: variable length of variable length of 32-bit little-endian integer /grp_dsets/simple Dataset {6/6} - Location: 1:43832 + Location: 1:39800 Links: 1 Storage: <details removed for portability> Type: 32-bit little-endian integer /grp_dsets/simple_group Dataset {6/6} - Location: 1:59944 + Location: 1:55912 Links: 1 Storage: <details removed for portability> Type: 32-bit little-endian integer /grp_dsets/vl Type - Location: 1:43640 + Location: 1:39608 Links: 2 - Type: shared-1:43640 variable length of + Type: shared-1:39608 variable length of 32-bit little-endian integer /grp_empty Group - Location: 1:31368 + Location: 1:27336 Links: 1 /grp_nested Group - Location: 1:44624 + Location: 1:40592 Links: 1 /grp_nested/grp_dsets Group - Location: 1:45416 + Location: 1:41384 Links: 1 /grp_nested/grp_dsets/chunk Dataset {6/6} - Location: 1:49600 + Location: 1:45568 Links: 1 Chunks: {2} 8 bytes Storage: <details removed for portability> Type: 32-bit little-endian integer /grp_nested/grp_dsets/compact Dataset {6/6} - Location: 1:50056 + Location: 1:46024 Links: 1 Storage: <details removed for portability> Type: 32-bit little-endian integer /grp_nested/grp_dsets/compound Dataset {2/2} - Location: 1:50192 + Location: 1:46160 Links: 1 Storage: <details removed for portability> Type: struct { @@ -263,51 +263,51 @@ Opened "./testfiles/h5copytst.out.h5" with sec2 driver. "str2" +20 20-byte null-terminated ASCII string } 40 bytes /grp_nested/grp_dsets/compressed Dataset {6/6} - Location: 1:52504 + Location: 1:48472 Links: 1 Chunks: {2} 8 bytes Storage: <details removed for portability> Filter-0: deflate-1 OPT {1} Type: 32-bit little-endian integer /grp_nested/grp_dsets/named_vl Dataset {2/2} - Location: 1:56768 + Location: 1:52736 Links: 1 Storage: <details removed for portability> - Type: shared-1:56896 variable length of + Type: shared-1:52864 variable length of 32-bit little-endian integer /grp_nested/grp_dsets/nested_vl Dataset {2/2} - Location: 1:56944 + Location: 1:52912 Links: 1 Storage: <details removed for portability> Type: variable length of variable length of 32-bit little-endian integer /grp_nested/grp_dsets/simple Dataset {6/6} - Location: 1:57088 + Location: 1:53056 Links: 1 Storage: <details removed for portability> Type: 32-bit little-endian integer /grp_nested/grp_dsets/vl Type - Location: 1:56896 + Location: 1:52864 Links: 2 - Type: shared-1:56896 variable length of + Type: shared-1:52864 variable length of 32-bit little-endian integer /grp_rename Group - Location: 1:61152 + Location: 1:57120 Links: 1 /grp_rename/chunk Dataset {6/6} - Location: 1:65336 + Location: 1:61304 Links: 1 Chunks: {2} 8 bytes Storage: <details removed for portability> Type: 32-bit little-endian integer /grp_rename/compact Dataset {6/6} - Location: 1:65792 + Location: 1:61760 Links: 1 Storage: <details removed for portability> Type: 32-bit little-endian integer /grp_rename/compound Dataset {2/2} - Location: 1:65928 + Location: 1:61896 Links: 1 Storage: <details removed for portability> Type: struct { @@ -315,28 +315,28 @@ Opened "./testfiles/h5copytst.out.h5" with sec2 driver. "str2" +20 20-byte null-terminated ASCII string } 40 bytes /grp_rename/compressed Dataset {6/6} - Location: 1:68240 + Location: 1:64208 Links: 1 Chunks: {2} 8 bytes Storage: <details removed for portability> Filter-0: deflate-1 OPT {1} Type: 32-bit little-endian integer /grp_rename/grp_dsets Group - Location: 1:74032 + Location: 1:70000 Links: 1 /grp_rename/grp_dsets/chunk Dataset {6/6} - Location: 1:78216 + Location: 1:74184 Links: 1 Chunks: {2} 8 bytes Storage: <details removed for portability> Type: 32-bit little-endian integer /grp_rename/grp_dsets/compact Dataset {6/6} - Location: 1:78672 + Location: 1:74640 Links: 1 Storage: <details removed for portability> Type: 32-bit little-endian integer /grp_rename/grp_dsets/compound Dataset {2/2} - Location: 1:78808 + Location: 1:74776 Links: 1 Storage: <details removed for portability> Type: struct { @@ -344,73 +344,73 @@ Opened "./testfiles/h5copytst.out.h5" with sec2 driver. "str2" +20 20-byte null-terminated ASCII string } 40 bytes /grp_rename/grp_dsets/compressed Dataset {6/6} - Location: 1:81120 + Location: 1:77088 Links: 1 Chunks: {2} 8 bytes Storage: <details removed for portability> Filter-0: deflate-1 OPT {1} Type: 32-bit little-endian integer /grp_rename/grp_dsets/named_vl Dataset {2/2} - Location: 1:85384 + Location: 1:81352 Links: 1 Storage: <details removed for portability> - Type: shared-1:85512 variable length of + Type: shared-1:81480 variable length of 32-bit little-endian integer /grp_rename/grp_dsets/nested_vl Dataset {2/2} - Location: 1:85560 + Location: 1:81528 Links: 1 Storage: <details removed for portability> Type: variable length of variable length of 32-bit little-endian integer /grp_rename/grp_dsets/simple Dataset {6/6} - Location: 1:85704 + Location: 1:81672 Links: 1 Storage: <details removed for portability> Type: 32-bit little-endian integer /grp_rename/grp_dsets/vl Type - Location: 1:85512 + Location: 1:81480 Links: 2 - Type: shared-1:85512 variable length of + Type: shared-1:81480 variable length of 32-bit little-endian integer /grp_rename/named_vl Dataset {2/2} - Location: 1:72504 + Location: 1:68472 Links: 1 Storage: <details removed for portability> - Type: shared-1:72632 variable length of + Type: shared-1:68600 variable length of 32-bit little-endian integer /grp_rename/nested_vl Dataset {2/2} - Location: 1:72680 + Location: 1:68648 Links: 1 Storage: <details removed for portability> Type: variable length of variable length of 32-bit little-endian integer /grp_rename/simple Dataset {6/6} - Location: 1:72824 + Location: 1:68792 Links: 1 Storage: <details removed for portability> Type: 32-bit little-endian integer /grp_rename/vl Type - Location: 1:72632 + Location: 1:68600 Links: 2 - Type: shared-1:72632 variable length of + Type: shared-1:68600 variable length of 32-bit little-endian integer /named_vl Dataset {2/2} - Location: 1:19296 + Location: 1:17280 Links: 1 Storage: <details removed for portability> - Type: shared-1:19424 variable length of + Type: shared-1:17408 variable length of 32-bit little-endian integer /nested_vl Dataset {2/2} - Location: 1:25792 + Location: 1:21760 Links: 1 Storage: <details removed for portability> Type: variable length of variable length of 32-bit little-endian integer /rename Dataset {2/2} - Location: 1:30160 + Location: 1:26128 Links: 1 Storage: <details removed for portability> Type: struct { @@ -423,7 +423,7 @@ Opened "./testfiles/h5copytst.out.h5" with sec2 driver. Storage: <details removed for portability> Type: 32-bit little-endian integer /simple_top Dataset {6/6} - Location: 1:27984 + Location: 1:23952 Links: 1 Storage: <details removed for portability> Type: 32-bit little-endian integer diff --git a/tools/h5diff/CMakeLists.txt b/tools/h5diff/CMakeLists.txt index dfd1800..3357b97 100644 --- a/tools/h5diff/CMakeLists.txt +++ b/tools/h5diff/CMakeLists.txt @@ -51,297 +51,278 @@ IF (BUILD_TESTING) # -------------------------------------------------------------------- # Copy all the HDF5 files from the test directory into the source directory # -------------------------------------------------------------------- - SET (HDF5_REFERENCE_FILES - h5diff_10.txt - h5diff_100.txt - #h5diff_101.txt - #h5diff_102.txt - #h5diff_103.txt - #h5diff_104.txt - h5diff_11.txt - h5diff_12.txt - h5diff_13.txt - h5diff_14.txt - h5diff_15.txt - h5diff_16_1.txt - h5diff_16_2.txt - h5diff_16_3.txt - h5diff_17.txt - h5diff_171.txt - h5diff_172.txt - h5diff_18_1.txt - h5diff_18.txt - h5diff_20.txt - h5diff_200.txt - h5diff_201.txt - h5diff_202.txt - h5diff_203.txt - h5diff_204.txt - h5diff_205.txt - h5diff_206.txt - h5diff_207.txt - h5diff_208.txt - h5diff_220.txt - h5diff_221.txt - h5diff_222.txt - h5diff_21.txt - h5diff_22.txt - h5diff_23.txt - h5diff_24.txt - h5diff_25.txt - h5diff_26.txt - h5diff_27.txt - h5diff_28.txt - h5diff_300.txt - h5diff_400.txt - h5diff_401.txt - h5diff_402.txt - h5diff_403.txt - h5diff_404.txt - h5diff_405.txt - h5diff_406.txt - h5diff_407.txt - h5diff_408.txt - h5diff_409.txt - h5diff_410.txt - h5diff_411.txt - h5diff_412.txt - h5diff_413.txt - h5diff_414.txt - h5diff_415.txt - h5diff_416.txt - h5diff_417.txt - h5diff_418.txt - h5diff_419.txt - h5diff_420.txt - h5diff_421.txt - h5diff_422.txt - h5diff_423.txt - h5diff_424.txt - h5diff_425.txt - h5diff_450.txt - h5diff_451.txt - h5diff_452.txt - h5diff_453.txt - h5diff_454.txt - h5diff_455.txt - h5diff_456.txt - h5diff_457.txt - h5diff_458.txt - h5diff_459.txt - h5diff_465.txt - h5diff_466.txt - h5diff_467.txt - h5diff_468.txt - h5diff_469.txt - h5diff_480.txt - h5diff_481.txt - h5diff_482.txt - h5diff_483.txt - h5diff_484.txt - h5diff_485.txt - h5diff_486.txt - h5diff_487.txt - h5diff_50.txt - h5diff_51.txt - h5diff_52.txt - h5diff_53.txt - h5diff_54.txt - h5diff_55.txt - h5diff_56.txt - h5diff_57.txt - h5diff_58.txt - h5diff_500.txt - h5diff_501.txt - h5diff_502.txt - h5diff_503.txt - h5diff_504.txt - h5diff_505.txt - h5diff_506.txt - h5diff_507.txt - h5diff_508.txt - h5diff_509.txt - h5diff_510.txt - h5diff_511.txt - h5diff_512.txt - h5diff_513.txt - h5diff_514.txt - h5diff_515.txt - h5diff_516.txt - h5diff_517.txt - h5diff_518.txt - h5diff_530.txt - h5diff_540.txt - h5diff_600.txt - h5diff_601.txt - h5diff_603.txt - h5diff_604.txt - h5diff_605.txt - h5diff_606.txt - h5diff_607.txt - h5diff_608.txt - h5diff_609.txt - h5diff_610.txt - h5diff_612.txt - h5diff_613.txt - h5diff_614.txt - h5diff_615.txt - h5diff_616.txt - h5diff_617.txt - h5diff_618.txt - h5diff_619.txt - h5diff_621.txt - h5diff_622.txt - h5diff_623.txt - h5diff_624.txt - h5diff_625.txt - h5diff_626.txt - h5diff_627.txt - h5diff_628.txt - h5diff_629.txt - h5diff_630.txt - h5diff_631.txt - h5diff_640.txt - h5diff_641.txt - h5diff_642.txt - h5diff_643.txt - h5diff_644.txt - h5diff_645.txt - h5diff_646.txt - h5diff_70.txt - h5diff_700.txt - h5diff_701.txt - h5diff_702.txt - h5diff_703.txt - h5diff_704.txt - h5diff_705.txt - h5diff_706.txt - h5diff_707.txt - h5diff_708.txt - h5diff_709.txt - h5diff_710.txt - h5diff_80.txt - h5diff_90.txt - ) - SET (HDF5_REFERENCE_TEST_FILES - h5diff_basic1.h5 - h5diff_basic2.h5 - h5diff_types.h5 - h5diff_dtypes.h5 - h5diff_attr1.h5 - h5diff_attr2.h5 - h5diff_dset1.h5 - h5diff_dset2.h5 - h5diff_hyper1.h5 - h5diff_hyper2.h5 - h5diff_empty.h5 - h5diff_links.h5 - h5diff_softlinks.h5 - h5diff_linked_softlink.h5 - h5diff_extlink_src.h5 - h5diff_extlink_trg.h5 - h5diff_ext2softlink_src.h5 - h5diff_ext2softlink_trg.h5 - h5diff_dset_zero_dim_size1.h5 - h5diff_dset_zero_dim_size2.h5 - h5diff_danglelinks1.h5 - h5diff_danglelinks2.h5 - h5diff_grp_recurse1.h5 - h5diff_grp_recurse2.h5 - h5diff_grp_recurse_ext1.h5 - h5diff_grp_recurse_ext2-1.h5 - h5diff_grp_recurse_ext2-2.h5 - h5diff_grp_recurse_ext2-3.h5 - h5diff_exclude1-1.h5 - h5diff_exclude1-2.h5 - h5diff_exclude2-1.h5 - h5diff_exclude2-2.h5 - h5diff_exclude3-1.h5 - h5diff_exclude3-2.h5 - h5diff_comp_vl_strs.h5 - h5diff_attr_v_level1.h5 - h5diff_attr_v_level2.h5 - compounds_array_vlen1.h5 - compounds_array_vlen2.h5 - non_comparables1.h5 - non_comparables2.h5 + SET (LIST_HDF5_TEST_FILES + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_basic1.h5 + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_basic2.h5 + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_types.h5 + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_dtypes.h5 + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_attr1.h5 + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_attr2.h5 + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_dset1.h5 + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_dset2.h5 + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_hyper1.h5 + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_hyper2.h5 + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_empty.h5 + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_links.h5 + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_softlinks.h5 + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_linked_softlink.h5 + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_extlink_src.h5 + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_extlink_trg.h5 + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_ext2softlink_src.h5 + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_ext2softlink_trg.h5 + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_dset_zero_dim_size1.h5 + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_dset_zero_dim_size2.h5 + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_danglelinks1.h5 + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_danglelinks2.h5 + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_grp_recurse1.h5 + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_grp_recurse2.h5 + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_grp_recurse_ext1.h5 + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_grp_recurse_ext2-1.h5 + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_grp_recurse_ext2-2.h5 + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_grp_recurse_ext2-3.h5 + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_exclude1-1.h5 + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_exclude1-2.h5 + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_exclude2-1.h5 + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_exclude2-2.h5 + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_exclude3-1.h5 + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_exclude3-2.h5 + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_comp_vl_strs.h5 + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_attr_v_level1.h5 + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_attr_v_level2.h5 + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/compounds_array_vlen1.h5 + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/compounds_array_vlen2.h5 + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/non_comparables1.h5 + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/non_comparables2.h5 ) - FOREACH (txt_file ${HDF5_REFERENCE_FILES}) - SET (txtdest "${PROJECT_BINARY_DIR}/${txt_file}") - #MESSAGE (STATUS " Copying ${txt_file}") - ADD_CUSTOM_COMMAND ( - TARGET h5diff - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/${txt_file} ${txtdest} - ) - ENDFOREACH (txt_file ${HDF5_REFERENCE_FILES}) + SET (LIST_OTHER_TEST_FILES + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_10.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_100.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_101.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_102.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_103.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_104.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_11.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_12.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_13.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_14.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_15.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_16_1.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_16_2.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_16_3.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_17.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_171.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_172.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_18_1.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_18.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_20.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_200.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_201.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_202.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_203.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_204.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_205.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_206.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_207.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_208.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_220.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_221.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_222.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_223.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_224.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_21.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_22.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_23.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_24.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_25.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_26.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_27.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_28.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_300.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_400.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_401.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_402.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_403.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_404.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_405.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_406.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_407.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_408.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_409.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_410.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_411.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_412.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_413.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_414.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_415.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_416.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_417.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_418.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_419.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_420.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_421.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_422.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_423.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_424.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_425.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_450.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_451.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_452.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_453.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_454.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_455.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_456.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_457.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_458.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_459.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_465.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_466.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_467.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_468.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_469.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_471.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_472.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_473.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_474.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_475.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_480.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_481.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_482.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_483.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_484.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_485.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_486.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_487.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_50.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_51.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_52.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_53.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_54.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_55.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_56.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_57.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_58.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_500.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_501.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_502.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_503.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_504.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_505.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_506.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_507.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_508.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_509.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_510.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_511.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_512.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_513.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_514.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_515.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_516.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_517.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_518.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_530.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_540.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_600.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_601.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_603.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_604.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_605.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_606.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_607.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_608.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_609.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_610.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_612.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_613.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_614.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_615.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_616.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_617.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_618.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_619.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_621.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_622.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_623.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_624.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_625.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_626.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_627.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_628.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_629.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_630.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_631.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_640.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_641.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_642.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_643.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_644.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_645.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_646.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_70.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_700.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_701.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_702.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_703.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_704.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_705.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_706.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_707.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_708.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_709.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_710.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_80.txt + ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_90.txt + ) - FOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES}) - SET (dest "${PROJECT_BINARY_DIR}/${h5_file}") - #MESSAGE (STATUS " Copying ${h5_file}") - ADD_CUSTOM_COMMAND ( - TARGET h5diff - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/${h5_file} ${dest} - ) - ENDFOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES}) + # Make testfiles dir under build dir + FILE (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - IF (WIN32 AND NOT CYGWIN) + # + # copy test files from source to build dir + # + FOREACH (h5_tstfiles ${LIST_HDF5_TEST_FILES} ${LIST_OTHER_TEST_FILES}) + GET_FILENAME_COMPONENT(fname "${h5_tstfiles}" NAME) + SET (dest "${PROJECT_BINARY_DIR}/testfiles/${fname}") + #MESSAGE (STATUS " Copying ${fname}") ADD_CUSTOM_COMMAND ( TARGET h5diff POST_BUILD COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_101w.txt ${PROJECT_BINARY_DIR}/h5diff_101.txt + ARGS -E copy_if_different ${h5_tstfiles} ${dest} ) + ENDFOREACH (h5_tstfiles ${LIST_HDF5_TEST_FILES} ${LIST_OTHER_TEST_FILES}) - ADD_CUSTOM_COMMAND ( - TARGET h5diff - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_102w.txt ${PROJECT_BINARY_DIR}/h5diff_102.txt - ) - ADD_CUSTOM_COMMAND ( - TARGET h5diff - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_103w.txt ${PROJECT_BINARY_DIR}/h5diff_103.txt - ) + # + # Overwrite system dependent files (Windows) + # + IF (WIN32 AND NOT CYGWIN) ADD_CUSTOM_COMMAND ( TARGET h5diff POST_BUILD COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_104w.txt ${PROJECT_BINARY_DIR}/h5diff_104.txt - ) - ELSE (WIN32 AND NOT CYGWIN) - ADD_CUSTOM_COMMAND ( - TARGET h5diff - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_101.txt ${PROJECT_BINARY_DIR}/h5diff_101.txt + ARGS -E copy_if_different ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_101w.txt ${PROJECT_BINARY_DIR}/testfiles/h5diff_101.txt ) ADD_CUSTOM_COMMAND ( TARGET h5diff POST_BUILD COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_102.txt ${PROJECT_BINARY_DIR}/h5diff_102.txt + ARGS -E copy_if_different ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_102w.txt ${PROJECT_BINARY_DIR}/testfiles/h5diff_102.txt ) ADD_CUSTOM_COMMAND ( TARGET h5diff POST_BUILD COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_103.txt ${PROJECT_BINARY_DIR}/h5diff_103.txt + ARGS -E copy_if_different ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_103w.txt ${PROJECT_BINARY_DIR}/testfiles/h5diff_103.txt ) ADD_CUSTOM_COMMAND ( TARGET h5diff POST_BUILD COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_104.txt ${PROJECT_BINARY_DIR}/h5diff_104.txt + ARGS -E copy_if_different ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_104w.txt ${PROJECT_BINARY_DIR}/testfiles/h5diff_104.txt ) ENDIF (WIN32 AND NOT CYGWIN) @@ -355,6 +336,7 @@ IF (BUILD_TESTING) # If using memchecker add tests without using scripts IF (HDF5_ENABLE_USING_MEMCHECKER) ADD_TEST (NAME H5DIFF-${resultfile} COMMAND $<TARGET_FILE:h5diff> ${ARGN}) + SET_TESTS_PROPERTIES (H5DIFF-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") IF (NOT ${resultcode} STREQUAL "0") SET_TESTS_PROPERTIES (H5DIFF-${resultfile} PROPERTIES WILL_FAIL "true") ENDIF (NOT ${resultcode} STREQUAL "0") @@ -366,14 +348,14 @@ IF (BUILD_TESTING) ADD_TEST ( NAME H5DIFF-clear-${resultfile}-objects COMMAND ${CMAKE_COMMAND} - -E remove ${resultfile}.out ${resultfile}.out.err + -E remove ./testfiles/${resultfile}.out ./testfiles/${resultfile}.out.err ) ADD_TEST ( NAME H5DIFF-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$<TARGET_FILE:h5diff>" -D "TEST_ARGS:STRING=${ARGN}" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${resultfile}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}.txt" @@ -391,6 +373,7 @@ IF (BUILD_TESTING) # If using memchecker add tests without using scripts IF (HDF5_ENABLE_USING_MEMCHECKER) ADD_TEST (NAME PH5DIFF-${resultfile} COMMAND $<TARGET_FILE:ph5diff> ${MPIEXEC} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_POSTFLAGS} ${ARGN}) + SET_TESTS_PROPERTIES (PH5DIFF-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") IF (NOT ${resultcode} STREQUAL "0") SET_TESTS_PROPERTIES (PH5DIFF-${resultfile} PROPERTIES WILL_FAIL "true") ENDIF (NOT ${resultcode} STREQUAL "0") @@ -402,14 +385,14 @@ IF (BUILD_TESTING) ADD_TEST ( NAME PH5DIFF-clear-${resultfile}-objects COMMAND ${CMAKE_COMMAND} - -E remove ${resultfile}_p.out ${resultfile}_p.out.err + -E remove ./testfiles/${resultfile}_p.out ./testfiles/${resultfile}_p.out.err ) ADD_TEST ( NAME PH5DIFF-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=${MPIEXEC};${MPIEXEC_PREFLAGS};${MPIEXEC_NUMPROC_FLAG};${MPIEXEC_MAX_NUMPROCS};${MPIEXEC_POSTFLAGS};$<TARGET_FILE:ph5diff>" -D "TEST_ARGS:STRING=${ARGN}" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=P_${resultfile}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}.txt" @@ -431,7 +414,7 @@ IF (BUILD_TESTING) ADD_TEST ( NAME H5DIFF-clear-${testname}-objects COMMAND ${CMAKE_COMMAND} - -E remove ${testname}.out ${testname}.out.err + -E remove ./testfiles/${testname}.out ./testfiles/${testname}.out.err ) # if there was a previous test IF (NOT "${last_test}" STREQUAL "") @@ -577,6 +560,10 @@ IF (BUILD_TESTING) h5diff_221.out.err h5diff_222.out h5diff_222.out.err + h5diff_223.out + h5diff_223.out.err + h5diff_224.out + h5diff_224.out.err h5diff_21.out h5diff_21.out.err h5diff_22.out @@ -677,6 +664,16 @@ IF (BUILD_TESTING) h5diff_468.out.err h5diff_469.out h5diff_469.out.err + h5diff_471.out + h5diff_471.out.err + h5diff_472.out + h5diff_472.out.err + h5diff_473.out + h5diff_473.out.err + h5diff_474.out + h5diff_474.out.err + h5diff_475.out + h5diff_475.out.err h5diff_480.out h5diff_480.out.err h5diff_481.out @@ -844,6 +841,7 @@ IF (BUILD_TESTING) h5diff_90.out h5diff_90.out.err ) + SET_TESTS_PROPERTIES (H5DIFF-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") IF (NOT "${last_test}" STREQUAL "") SET_TESTS_PROPERTIES (H5DIFF-clearall-objects PROPERTIES DEPENDS ${last_test}) ENDIF (NOT "${last_test}" STREQUAL "") @@ -1164,6 +1162,12 @@ ADD_H5_TEST (h5diff_221 1 -c non_comparables1.h5 non_comparables2.h5 /g2) # All the rest comparables should display differences ADD_H5_TEST (h5diff_222 1 -c non_comparables1.h5 non_comparables2.h5) +# non-comparable test for common objects (same name) with different object types +# (HDFFV-7644) +ADD_H5_TEST (h5diff_223 0 -c non_comparables1.h5 non_comparables2.h5 /diffobjtypes) +# swap files +ADD_H5_TEST (h5diff_224 0 -c non_comparables2.h5 non_comparables1.h5 /diffobjtypes) + # ############################################################################## # # Links compare without --follow-symlinks nor --no-dangling-links # ############################################################################## @@ -1297,6 +1301,18 @@ ADD_H5_TEST (h5diff_468 0 -v --follow-symlinks h5diff_danglelinks1.h5 h5diff_dan # ext link vs. ext dangling ADD_H5_TEST (h5diff_469 1 -v --follow-symlinks h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /ext_link2) +#--------------------------------------------------- +# dangling links without follow symlink +# (HDFFV-7998) +# test - soft dangle links (same and different paths), +# - external dangle links (same and different paths) +ADD_H5_TEST (h5diff_471 1 -v h5diff_danglelinks1.h5 h5diff_danglelinks2.h5) +ADD_H5_TEST (h5diff_472 0 -v h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /soft_link1) +ADD_H5_TEST (h5diff_473 1 -v h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /soft_link4) +ADD_H5_TEST (h5diff_474 0 -v h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /ext_link4) +ADD_H5_TEST (h5diff_475 1 -v h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /ext_link1) + + # ############################################################################## # # test for group diff recursivly # ############################################################################## @@ -1412,21 +1428,27 @@ ENDIF (BUILD_TESTING) #-----------------------------------------------------------------------------
# Rules for Installation of tools using make Install target
#-----------------------------------------------------------------------------
+ +INSTALL_PROGRAM_PDB (h5diff ${HDF5_INSTALL_BIN_DIR} toolsapplications) + INSTALL ( TARGETS h5diff RUNTIME DESTINATION - ${HDF5_INSTALL_BIN_DIR}/tools + ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications ) IF (H5_HAVE_PARALLEL) + + INSTALL_PROGRAM_PDB (ph5diff ${HDF5_INSTALL_BIN_DIR} toolsapplications) + INSTALL ( TARGETS ph5diff RUNTIME DESTINATION - ${HDF5_INSTALL_BIN_DIR}/tools + ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications ) diff --git a/tools/h5diff/h5diffgentest.c b/tools/h5diff/h5diffgentest.c index b57c98a..c370f79 100644 --- a/tools/h5diff/h5diffgentest.c +++ b/tools/h5diff/h5diffgentest.c @@ -155,7 +155,8 @@ static void test_comps_array (const char *fname, const char *dset, const char *a static void test_comps_vlen (const char *fname, const char *dset,const char *attr, int diff, int is_file_new); static void test_comps_array_vlen (const char *fname, const char *dset, const char *attr, int diff, int is_file_new); static void test_comps_vlen_arry (const char *fname, const char *dset,const char *attr, int diff, int is_file_new); -static void test_non_comparables (const char *fname, int diff); +static void test_data_nocomparables (const char *fname, int diff); +static void test_objs_nocomparables (const char *fname1, const char *fname2); /* called by test_attributes() and test_datasets() */ static void write_attr_in(hid_t loc_id,const char* dset_name,hid_t fid,int make_diffs); @@ -250,8 +251,11 @@ int main(void) * comparable datasets and attributes. All the comparables should display * differences. */ - test_non_comparables(NON_COMPARBLES1,0); - test_non_comparables(NON_COMPARBLES2,5); + test_data_nocomparables(NON_COMPARBLES1,0); + test_data_nocomparables(NON_COMPARBLES2,5); + + /* common objects (same name) with different object types. HDFFV-7644 */ + test_objs_nocomparables(NON_COMPARBLES1, NON_COMPARBLES2); return 0; } @@ -2177,6 +2181,14 @@ static int test_dangle_links(const char *fname1, const char *fname2) goto out; } + status = H5Lcreate_soft("no_obj1", fid1, "soft_link4", H5P_DEFAULT, H5P_DEFAULT); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); + status = FAIL; + goto out; + } + /* file 2 */ status = H5Lcreate_soft("no_obj", fid2, "soft_link1", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) @@ -2202,6 +2214,14 @@ static int test_dangle_links(const char *fname1, const char *fname2) goto out; } + status = H5Lcreate_soft("no_obj2", fid2, "soft_link4", H5P_DEFAULT, H5P_DEFAULT); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname2); + status = FAIL; + goto out; + } + /*----------------------------------------------------------------------- * External Links *------------------------------------------------------------------------*/ @@ -2230,7 +2250,7 @@ static int test_dangle_links(const char *fname1, const char *fname2) goto out; } - status = H5Lcreate_external("no_file1.h5", "no_obj", fid1, "ext_link4", H5P_DEFAULT, H5P_DEFAULT); + status = H5Lcreate_external("no_file.h5", "no_obj", fid1, "ext_link4", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); @@ -2263,7 +2283,7 @@ static int test_dangle_links(const char *fname1, const char *fname2) goto out; } - status = H5Lcreate_external("no_file2.h5", "no_obj", fid2, "ext_link4", H5P_DEFAULT, H5P_DEFAULT); + status = H5Lcreate_external("no_file.h5", "no_obj", fid2, "ext_link4", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname2); @@ -4787,7 +4807,7 @@ static void test_comps_vlen_arry (const char * fname, const char *dset, const ch /*------------------------------------------------------------------------- -* Function: test_non_comparables +* Function: test_data_nocomparables * * Purpose: * Create test files with non-comparable dataset and attributes with @@ -4796,7 +4816,7 @@ static void test_comps_vlen_arry (const char * fname, const char *dset, const ch * *-------------------------------------------------------------------------*/ #define DIM_ARRY 3 -static void test_non_comparables (const char * fname, int make_diffs) +static void test_data_nocomparables (const char * fname, int make_diffs) { hid_t fid=0; hid_t gid1=0; @@ -4998,6 +5018,155 @@ out: } /*------------------------------------------------------------------------- +* Function: test_objs_nocomparables +* +* Purpose: +* Create test files with common objects (same name) but different object +* types. +* h5diff should show non-comparable output from these common objects. +*-------------------------------------------------------------------------*/ +static void test_objs_nocomparables(const char *fname1, const char *fname2) +{ + herr_t status = SUCCEED; + hid_t fid1=0; + hid_t fid2=0; + hid_t topgid1=0; + hid_t topgid2=0; + hid_t gid1=0; + hid_t did1=0; + hid_t tid1=0; + hid_t gid2=0; + hid_t did2=0; + hid_t tid2=0; + hsize_t dims[1] = {DIM_ARRY}; + int data1[DIM_ARRY] = {1,1,1}; + int data2[DIM_ARRY] = {2,2,2}; + + /*----------------------------------------------------------------------- + * Open file(s) to add objects + *------------------------------------------------------------------------*/ + /* file1 */ + fid1 = H5Fopen (fname1, H5F_ACC_RDWR, H5P_DEFAULT); + if (fid1 < 0) + { + fprintf(stderr, "Error: %s> H5Fopen failed.\n", fname1); + status = FAIL; + goto out; + } + + /* file2 */ + fid2 = H5Fopen (fname2, H5F_ACC_RDWR, H5P_DEFAULT); + if (fid2 < 0) + { + fprintf(stderr, "Error: %s> H5Fopen failed.\n", fname2); + status = FAIL; + goto out; + } + + /*----------------------------------------------------------------------- + * in file1 : add member objects + *------------------------------------------------------------------------*/ + /* parent group */ + topgid1 = H5Gcreate2(fid1, "diffobjtypes", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + if (topgid1 < 0) + { + fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); + status = FAIL; + goto out; + } + + /* dataset */ + status = write_dset(topgid1, 1, dims,"obj1", H5T_NATIVE_INT, data1); + if (status == FAIL) + { + fprintf(stderr, "Error: %s> write_dset failed\n", fname1); + goto out; + } + + /* group */ + gid1 = H5Gcreate2(topgid1, "obj2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + if (gid1 < 0) + { + fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); + status = FAIL; + goto out; + } + + /* committed type */ + tid1 = H5Tcopy(H5T_NATIVE_INT); + status = H5Tcommit2(topgid1, "obj3", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Tcommit2 failed.\n", fname1); + goto out; + } + + /*----------------------------------------------------------------------- + * in file2 : add member objects + *------------------------------------------------------------------------*/ + /* parent group */ + topgid2 = H5Gcreate2(fid2, "diffobjtypes", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + if (topgid2 < 0) + { + fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); + status = FAIL; + goto out; + } + + /* group */ + gid2 = H5Gcreate2(topgid2, "obj1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + if (gid2 < 0) + { + fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); + status = FAIL; + goto out; + } + + /* committed type */ + tid2 = H5Tcopy(H5T_NATIVE_INT); + status = H5Tcommit2(topgid2, "obj2", tid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Tcommit2 failed.\n", fname2); + goto out; + } + + /* dataset */ + status = write_dset(topgid2, 1, dims,"obj3", H5T_NATIVE_INT, data2); + if (status == FAIL) + { + fprintf(stderr, "Error: %s> write_dset failed\n", fname2); + goto out; + } + +out: + /*----------------------------------------------------------------------- + * Close IDs + *-----------------------------------------------------------------------*/ + if(fid1) + H5Fclose(fid1); + if(fid2) + H5Fclose(fid2); + if(topgid1) + H5Gclose(topgid1); + if(topgid2) + H5Gclose(topgid2); + if(did1) + H5Dclose(did1); + if(did2) + H5Dclose(did2); + if(gid1) + H5Gclose(gid1); + if(gid2) + H5Gclose(gid2); + if(tid1) + H5Tclose(tid1); + if(tid2) + H5Tclose(tid2); + +} + +/*------------------------------------------------------------------------- * Function: write_attr_in * * Purpose: write attributes in LOC_ID (dataset, group, named datatype) diff --git a/tools/h5diff/testfiles/h5diff_101w.txt b/tools/h5diff/testfiles/h5diff_101w.txt index d1f49da..d1f49da 100755..100644 --- a/tools/h5diff/testfiles/h5diff_101w.txt +++ b/tools/h5diff/testfiles/h5diff_101w.txt diff --git a/tools/h5diff/testfiles/h5diff_102w.txt b/tools/h5diff/testfiles/h5diff_102w.txt index dda3581..dda3581 100755..100644 --- a/tools/h5diff/testfiles/h5diff_102w.txt +++ b/tools/h5diff/testfiles/h5diff_102w.txt diff --git a/tools/h5diff/testfiles/h5diff_20.txt b/tools/h5diff/testfiles/h5diff_20.txt index 3edb543..09c20cb 100644 --- a/tools/h5diff/testfiles/h5diff_20.txt +++ b/tools/h5diff/testfiles/h5diff_20.txt @@ -1,4 +1,4 @@ -</dset> is of type H5G_DATASET and </g1> is of type H5G_GROUP +Not comparable: </dset> is of type H5G_DATASET and </g1> is of type H5G_GROUP -------------------------------- Some objects are not comparable -------------------------------- diff --git a/tools/h5diff/testfiles/h5diff_21.txt b/tools/h5diff/testfiles/h5diff_21.txt index 1479457..1c625fe 100644 --- a/tools/h5diff/testfiles/h5diff_21.txt +++ b/tools/h5diff/testfiles/h5diff_21.txt @@ -1,4 +1,4 @@ -</dset> is of type H5G_DATASET and </l1> is of type H5G_LINK +Not comparable: </dset> is of type H5G_DATASET and </l1> is of type H5G_LINK -------------------------------- Some objects are not comparable -------------------------------- diff --git a/tools/h5diff/testfiles/h5diff_22.txt b/tools/h5diff/testfiles/h5diff_22.txt index 3ccb06b..2ef22d0 100644 --- a/tools/h5diff/testfiles/h5diff_22.txt +++ b/tools/h5diff/testfiles/h5diff_22.txt @@ -1,4 +1,4 @@ -</dset> is of type H5G_DATASET and </t1> is of type H5G_TYPE +Not comparable: </dset> is of type H5G_DATASET and </t1> is of type H5G_TYPE -------------------------------- Some objects are not comparable -------------------------------- diff --git a/tools/h5diff/testfiles/h5diff_222.txt b/tools/h5diff/testfiles/h5diff_222.txt index bdecb8a..53c9464 100644 --- a/tools/h5diff/testfiles/h5diff_222.txt +++ b/tools/h5diff/testfiles/h5diff_222.txt @@ -1,3 +1,6 @@ +Not comparable: </diffobjtypes/obj1> is of type H5G_DATASET and </diffobjtypes/obj1> is of type H5G_GROUP +Not comparable: </diffobjtypes/obj2> is of type H5G_GROUP and </diffobjtypes/obj2> is of type H5G_TYPE +Not comparable: </diffobjtypes/obj3> is of type H5G_TYPE and </diffobjtypes/obj3> is of type H5G_DATASET Not comparable: </g1/dset1> is of class H5T_INTEGER and </g1/dset1> is of class H5T_STRING attribute: <attr of </g1/dset1>> and <attr of </g1/dset1>> 3 differences found diff --git a/tools/h5diff/testfiles/h5diff_223.txt b/tools/h5diff/testfiles/h5diff_223.txt new file mode 100644 index 0000000..c8e0f65 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_223.txt @@ -0,0 +1,4 @@ +Not comparable: </diffobjtypes/obj1> is of type H5G_DATASET and </diffobjtypes/obj1> is of type H5G_GROUP +Not comparable: </diffobjtypes/obj2> is of type H5G_GROUP and </diffobjtypes/obj2> is of type H5G_TYPE +Not comparable: </diffobjtypes/obj3> is of type H5G_TYPE and </diffobjtypes/obj3> is of type H5G_DATASET +EXIT CODE: 0 diff --git a/tools/h5diff/testfiles/h5diff_224.txt b/tools/h5diff/testfiles/h5diff_224.txt new file mode 100644 index 0000000..a4ebedb --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_224.txt @@ -0,0 +1,4 @@ +Not comparable: </diffobjtypes/obj1> is of type H5G_GROUP and </diffobjtypes/obj1> is of type H5G_DATASET +Not comparable: </diffobjtypes/obj2> is of type H5G_TYPE and </diffobjtypes/obj2> is of type H5G_GROUP +Not comparable: </diffobjtypes/obj3> is of type H5G_DATASET and </diffobjtypes/obj3> is of type H5G_TYPE +EXIT CODE: 0 diff --git a/tools/h5diff/testfiles/h5diff_300.txt b/tools/h5diff/testfiles/h5diff_300.txt index e51643f..e51643f 100755..100644 --- a/tools/h5diff/testfiles/h5diff_300.txt +++ b/tools/h5diff/testfiles/h5diff_300.txt diff --git a/tools/h5diff/testfiles/h5diff_450.txt b/tools/h5diff/testfiles/h5diff_450.txt index bf4f6e9..a63d78f 100644 --- a/tools/h5diff/testfiles/h5diff_450.txt +++ b/tools/h5diff/testfiles/h5diff_450.txt @@ -11,6 +11,7 @@ file1 file2 x x /soft_link1 x x /soft_link2 x x /soft_link3 + x x /soft_link4 group : </> and </> 0 differences found @@ -32,4 +33,6 @@ obj2 </soft_link2> is a dangling link. 1 differences found obj1 </soft_link3> is a dangling link. 1 differences found +dangling link: </soft_link4> and </soft_link4> +0 differences found EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_451.txt b/tools/h5diff/testfiles/h5diff_451.txt index 0d30023..fd0691f 100644 --- a/tools/h5diff/testfiles/h5diff_451.txt +++ b/tools/h5diff/testfiles/h5diff_451.txt @@ -11,6 +11,7 @@ file1 file2 x x /soft_link1 x x /soft_link2 x x /soft_link3 + x x /soft_link4 group : </> and </> 0 differences found @@ -25,4 +26,5 @@ Warning: </ext_link4> is a dangling link. Warning: </soft_link1> is a dangling link. Warning: </soft_link2> is a dangling link. Warning: </soft_link3> is a dangling link. +Warning: </soft_link4> is a dangling link. EXIT CODE: 2 diff --git a/tools/h5diff/testfiles/h5diff_471.txt b/tools/h5diff/testfiles/h5diff_471.txt new file mode 100644 index 0000000..124cdd7 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_471.txt @@ -0,0 +1,38 @@ + +file1 file2 +--------------------------------------- + x x / + x x /dset1 + x x /dset2 + x x /ext_link1 + x x /ext_link2 + x x /ext_link3 + x x /ext_link4 + x x /soft_link1 + x x /soft_link2 + x x /soft_link3 + x x /soft_link4 + +group : </> and </> +0 differences found +dataset: </dset1> and </dset1> +0 differences found +dataset: </dset2> and </dset2> +0 differences found +external link: </ext_link1> and </ext_link1> +1 differences found +external link: </ext_link2> and </ext_link2> +1 differences found +external link: </ext_link3> and </ext_link3> +1 differences found +external link: </ext_link4> and </ext_link4> +0 differences found +link : </soft_link1> and </soft_link1> +0 differences found +link : </soft_link2> and </soft_link2> +1 differences found +link : </soft_link3> and </soft_link3> +1 differences found +link : </soft_link4> and </soft_link4> +1 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_472.txt b/tools/h5diff/testfiles/h5diff_472.txt new file mode 100644 index 0000000..57a8af4 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_472.txt @@ -0,0 +1,3 @@ +link : </soft_link1> and </soft_link1> +0 differences found +EXIT CODE: 0 diff --git a/tools/h5diff/testfiles/h5diff_473.txt b/tools/h5diff/testfiles/h5diff_473.txt new file mode 100644 index 0000000..4c1855d --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_473.txt @@ -0,0 +1,3 @@ +link : </soft_link4> and </soft_link4> +1 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_474.txt b/tools/h5diff/testfiles/h5diff_474.txt new file mode 100644 index 0000000..7807551 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_474.txt @@ -0,0 +1,3 @@ +external link: </ext_link4> and </ext_link4> +0 differences found +EXIT CODE: 0 diff --git a/tools/h5diff/testfiles/h5diff_475.txt b/tools/h5diff/testfiles/h5diff_475.txt new file mode 100644 index 0000000..be6110e --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_475.txt @@ -0,0 +1,3 @@ +external link: </ext_link1> and </ext_link1> +1 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_505.txt b/tools/h5diff/testfiles/h5diff_505.txt index a220730..607b99b 100644 --- a/tools/h5diff/testfiles/h5diff_505.txt +++ b/tools/h5diff/testfiles/h5diff_505.txt @@ -1,4 +1,4 @@ -</grp1> is of type H5G_GROUP and </slink_grp1> is of type H5G_LINK +Not comparable: </grp1> is of type H5G_GROUP and </slink_grp1> is of type H5G_LINK -------------------------------- Some objects are not comparable -------------------------------- diff --git a/tools/h5diff/testfiles/h5diff_507.txt b/tools/h5diff/testfiles/h5diff_507.txt index 6176f3f..06b7fe6 100644 --- a/tools/h5diff/testfiles/h5diff_507.txt +++ b/tools/h5diff/testfiles/h5diff_507.txt @@ -1,4 +1,4 @@ -</grp1> is of type H5G_GROUP and </elink_grp1> is of type H5G_UDLINK +Not comparable: </grp1> is of type H5G_GROUP and </elink_grp1> is of type H5G_UDLINK -------------------------------- Some objects are not comparable -------------------------------- diff --git a/tools/h5diff/testfiles/h5diff_509.txt b/tools/h5diff/testfiles/h5diff_509.txt index a51ab35..2e3e87a 100644 --- a/tools/h5diff/testfiles/h5diff_509.txt +++ b/tools/h5diff/testfiles/h5diff_509.txt @@ -1,4 +1,4 @@ -</slink_grp1> is of type H5G_LINK and </elink_grp1> is of type H5G_UDLINK +Not comparable: </slink_grp1> is of type H5G_LINK and </elink_grp1> is of type H5G_UDLINK -------------------------------- Some objects are not comparable -------------------------------- diff --git a/tools/h5diff/testfiles/h5diff_515.txt b/tools/h5diff/testfiles/h5diff_515.txt index 077d463..263441d 100644 --- a/tools/h5diff/testfiles/h5diff_515.txt +++ b/tools/h5diff/testfiles/h5diff_515.txt @@ -17,8 +17,11 @@ dataset: </dset1> and </dset1> 0 differences found group : </g1> and </g1> 0 differences found -group : </g1/g2> and </g1/g2> -0 differences found +Not comparable: </g1/g2> is of type H5G_GROUP and </g1/g2> is of type H5G_UDLINK link : </soft_dset1> and </soft_dset1> 0 differences found +-------------------------------- +Some objects are not comparable +-------------------------------- +Use -c for a list of objects without details of differences. EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_517.txt b/tools/h5diff/testfiles/h5diff_517.txt index 1b6e24f..91c69fb 100644 --- a/tools/h5diff/testfiles/h5diff_517.txt +++ b/tools/h5diff/testfiles/h5diff_517.txt @@ -10,6 +10,9 @@ group1 group2 group : </g1> and </g1> 0 differences found -group : </g1/g2> and </g1/g2> -0 differences found +Not comparable: </g1/g2> is of type H5G_GROUP and </g1/g2> is of type H5G_UDLINK +-------------------------------- +Some objects are not comparable +-------------------------------- +Use -c for a list of objects without details of differences. EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_danglelinks1.h5 b/tools/h5diff/testfiles/h5diff_danglelinks1.h5 Binary files differindex 8cbaac1..b8be9bc 100644 --- a/tools/h5diff/testfiles/h5diff_danglelinks1.h5 +++ b/tools/h5diff/testfiles/h5diff_danglelinks1.h5 diff --git a/tools/h5diff/testfiles/h5diff_danglelinks2.h5 b/tools/h5diff/testfiles/h5diff_danglelinks2.h5 Binary files differindex f634210..3c3907c 100644 --- a/tools/h5diff/testfiles/h5diff_danglelinks2.h5 +++ b/tools/h5diff/testfiles/h5diff_danglelinks2.h5 diff --git a/tools/h5diff/testfiles/h5diff_enum_invalid_values.h5 b/tools/h5diff/testfiles/h5diff_enum_invalid_values.h5 Binary files differindex dd02db9..dd02db9 100755..100644 --- a/tools/h5diff/testfiles/h5diff_enum_invalid_values.h5 +++ b/tools/h5diff/testfiles/h5diff_enum_invalid_values.h5 diff --git a/tools/h5diff/testfiles/h5diff_links.h5 b/tools/h5diff/testfiles/h5diff_links.h5 Binary files differindex 8af66a6..8af66a6 100755..100644 --- a/tools/h5diff/testfiles/h5diff_links.h5 +++ b/tools/h5diff/testfiles/h5diff_links.h5 diff --git a/tools/h5diff/testfiles/non_comparables1.h5 b/tools/h5diff/testfiles/non_comparables1.h5 Binary files differindex 71b65c8..7dbb45d 100644 --- a/tools/h5diff/testfiles/non_comparables1.h5 +++ b/tools/h5diff/testfiles/non_comparables1.h5 diff --git a/tools/h5diff/testfiles/non_comparables2.h5 b/tools/h5diff/testfiles/non_comparables2.h5 Binary files differindex 188ceb9..a5e7014 100644 --- a/tools/h5diff/testfiles/non_comparables2.h5 +++ b/tools/h5diff/testfiles/non_comparables2.h5 diff --git a/tools/h5diff/testh5diff.sh b/tools/h5diff/testh5diff.sh index 27fb253..cb91a19 100755 --- a/tools/h5diff/testh5diff.sh +++ b/tools/h5diff/testh5diff.sh @@ -156,6 +156,8 @@ $SRC_H5DIFF_TESTFILES/h5diff_208.txt $SRC_H5DIFF_TESTFILES/h5diff_220.txt $SRC_H5DIFF_TESTFILES/h5diff_221.txt $SRC_H5DIFF_TESTFILES/h5diff_222.txt +$SRC_H5DIFF_TESTFILES/h5diff_223.txt +$SRC_H5DIFF_TESTFILES/h5diff_224.txt $SRC_H5DIFF_TESTFILES/h5diff_21.txt $SRC_H5DIFF_TESTFILES/h5diff_22.txt $SRC_H5DIFF_TESTFILES/h5diff_23.txt @@ -207,11 +209,19 @@ $SRC_H5DIFF_TESTFILES/h5diff_466.txt $SRC_H5DIFF_TESTFILES/h5diff_467.txt $SRC_H5DIFF_TESTFILES/h5diff_468.txt $SRC_H5DIFF_TESTFILES/h5diff_469.txt +$SRC_H5DIFF_TESTFILES/h5diff_471.txt +$SRC_H5DIFF_TESTFILES/h5diff_472.txt +$SRC_H5DIFF_TESTFILES/h5diff_473.txt +$SRC_H5DIFF_TESTFILES/h5diff_474.txt +$SRC_H5DIFF_TESTFILES/h5diff_475.txt $SRC_H5DIFF_TESTFILES/h5diff_480.txt $SRC_H5DIFF_TESTFILES/h5diff_481.txt $SRC_H5DIFF_TESTFILES/h5diff_482.txt $SRC_H5DIFF_TESTFILES/h5diff_483.txt $SRC_H5DIFF_TESTFILES/h5diff_484.txt +$SRC_H5DIFF_TESTFILES/h5diff_485.txt +$SRC_H5DIFF_TESTFILES/h5diff_486.txt +$SRC_H5DIFF_TESTFILES/h5diff_487.txt $SRC_H5DIFF_TESTFILES/h5diff_50.txt $SRC_H5DIFF_TESTFILES/h5diff_51.txt $SRC_H5DIFF_TESTFILES/h5diff_52.txt @@ -817,13 +827,20 @@ TOOLTEST h5diff_221.txt -c non_comparables1.h5 non_comparables2.h5 /g2 # entire file # All the comparables should display differences. -if test -n "$pmode" -a "$mydomainname" = hdfgroup.uiuc.edu; then +if test -n "$pmode"; then # parallel mode: - # skip due to ph5diff hangs on koala (linux64-LE) randomly. + # skip due to ph5diff hangs on koala (linux64-LE) and ember intermittently. + # (HDFFV-8003 - TBD) SKIP -c non_comparables1.h5 non_comparables2.h5 else TOOLTEST h5diff_222.txt -c non_comparables1.h5 non_comparables2.h5 fi + +# non-comparable test for common objects (same name) with different object types +# (HDFFV-7644) +TOOLTEST h5diff_223.txt -c non_comparables1.h5 non_comparables2.h5 /diffobjtypes +# swap files +TOOLTEST h5diff_224.txt -c non_comparables2.h5 non_comparables1.h5 /diffobjtypes # ############################################################################## # # Links compare without --follow-symlinks nor --no-dangling-links @@ -959,6 +976,17 @@ TOOLTEST h5diff_468.txt -v --follow-symlinks h5diff_danglelinks1.h5 h5diff_dangl # ext link vs. ext dangling TOOLTEST h5diff_469.txt -v --follow-symlinks h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /ext_link2 +#---------------------------------------- +# dangling links without follow symlink +# (HDFFV-7998) +# test - soft dangle links (same and different paths), +# - external dangle links (same and different paths) +TOOLTEST h5diff_471.txt -v h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 +TOOLTEST h5diff_472.txt -v h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /soft_link1 +TOOLTEST h5diff_473.txt -v h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /soft_link4 +TOOLTEST h5diff_474.txt -v h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /ext_link4 +TOOLTEST h5diff_475.txt -v h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /ext_link1 + # ############################################################################## # # test for group diff recursivly # ############################################################################## diff --git a/tools/h5dump/CMakeLists.txt b/tools/h5dump/CMakeLists.txt index a6e452d..debbb48 100644 --- a/tools/h5dump/CMakeLists.txt +++ b/tools/h5dump/CMakeLists.txt @@ -43,6 +43,7 @@ IF (BUILD_TESTING) # Copy all the HDF5 files from the test directory into the source directory # -------------------------------------------------------------------- SET (HDF5_REFERENCE_FILES + charsets.ddl file_space.ddl filter_fail.ddl packedbits.ddl @@ -239,6 +240,7 @@ IF (BUILD_TESTING) tvlstr.h5.xml ) SET (HDF5_REFERENCE_TEST_FILES + charsets.h5 file_space.h5 filter_fail.h5 packedbits.h5 @@ -676,6 +678,8 @@ IF (BUILD_TESTING) COMMAND ${CMAKE_COMMAND} -E remove h5dump-help.out + charsets.out + charsets.out.err file_space.out file_space.out.err filter_fail.out @@ -1060,6 +1064,9 @@ IF (BUILD_TESTING) # test printing characters in ASCII instead of decimal ADD_H5_TEST (tchar1 0 --enable-error-stack -r tchar.h5) + # test datatypes in ASCII and UTF8 + ADD_H5_TEST (charsets 0 --enable-error-stack charsets.h5) + # rev. 2004 # tests for super block ADD_H5_TEST (tboot1 0 --enable-error-stack -H -B -d dset tfcontents1.h5) @@ -1750,11 +1757,14 @@ ENDIF (BUILD_TESTING) #-----------------------------------------------------------------------------
# Rules for Installation of tools using make Install target
#-----------------------------------------------------------------------------
+ +INSTALL_PROGRAM_PDB (h5dump ${HDF5_INSTALL_BIN_DIR} toolsapplications) + INSTALL ( TARGETS h5dump RUNTIME DESTINATION - ${HDF5_INSTALL_BIN_DIR}/tools + ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications ) diff --git a/tools/h5dump/Makefile.am b/tools/h5dump/Makefile.am index 97d81c2..f80d12e 100644 --- a/tools/h5dump/Makefile.am +++ b/tools/h5dump/Makefile.am @@ -25,7 +25,7 @@ INCLUDES=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib # Test programs and scripts TEST_PROG=h5dumpgentest -TEST_SCRIPT=testh5dump.sh testh5dumpxml.sh +TEST_SCRIPT=testh5dump.sh testh5dumppbits.sh testh5dumpxml.sh check_PROGRAMS=$(TEST_PROG) binread check_SCRIPTS=$(TEST_SCRIPT) @@ -46,6 +46,6 @@ h5dump_SOURCES=h5dump.c h5dump_ddl.c h5dump_xml.c # Temporary files. *.h5 are generated by h5dumpgentest. They should # copied to the testfiles/ directory if update is required. CHECK_CLEANFILES+=*.h5 *.bin -DISTCLEANFILES=testh5dump.sh +DISTCLEANFILES=testh5dump.sh testh5dumppbits.sh testh5dumpxml.sh include $(top_srcdir)/config/conclude.am diff --git a/tools/h5dump/Makefile.in b/tools/h5dump/Makefile.in index 9d46557..0c45a72 100644 --- a/tools/h5dump/Makefile.in +++ b/tools/h5dump/Makefile.in @@ -52,8 +52,8 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ - $(srcdir)/testh5dump.sh.in $(srcdir)/testh5dumpxml.sh.in \ - $(top_srcdir)/config/commence.am \ + $(srcdir)/testh5dump.sh.in $(srcdir)/testh5dumppbits.sh.in \ + $(srcdir)/testh5dumpxml.sh.in $(top_srcdir)/config/commence.am \ $(top_srcdir)/config/conclude.am check_PROGRAMS = $(am__EXEEXT_1) binread$(EXEEXT) bin_PROGRAMS = h5dump$(EXEEXT) @@ -65,7 +65,7 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/H5config.h -CONFIG_CLEAN_FILES = testh5dump.sh testh5dumpxml.sh +CONFIG_CLEAN_FILES = testh5dump.sh testh5dumppbits.sh testh5dumpxml.sh CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" am__EXEEXT_1 = h5dumpgentest$(EXEEXT) @@ -412,7 +412,7 @@ INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/tools/lib # Test programs and scripts TEST_PROG = h5dumpgentest -TEST_SCRIPT = testh5dump.sh testh5dumpxml.sh +TEST_SCRIPT = testh5dump.sh testh5dumppbits.sh testh5dumpxml.sh check_SCRIPTS = $(TEST_SCRIPT) SCRIPT_DEPEND = h5dump$(EXEEXT) @@ -424,7 +424,7 @@ LDADD = $(LIBH5TOOLS) $(LIBHDF5) # Source files for the program h5dump_SOURCES = h5dump.c h5dump_ddl.c h5dump_xml.c -DISTCLEANFILES = testh5dump.sh +DISTCLEANFILES = testh5dump.sh testh5dumppbits.sh testh5dumpxml.sh # Automake needs to be taught how to build lib, progs, and tests targets. # These will be filled in automatically for the most part (e.g., @@ -477,6 +477,8 @@ $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) $(am__aclocal_m4_deps): testh5dump.sh: $(top_builddir)/config.status $(srcdir)/testh5dump.sh.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +testh5dumppbits.sh: $(top_builddir)/config.status $(srcdir)/testh5dumppbits.sh.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ testh5dumpxml.sh: $(top_builddir)/config.status $(srcdir)/testh5dumpxml.sh.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ install-binPROGRAMS: $(bin_PROGRAMS) diff --git a/tools/h5dump/h5dump_ddl.c b/tools/h5dump/h5dump_ddl.c index b8deaf9..22d2a2b 100644 --- a/tools/h5dump/h5dump_ddl.c +++ b/tools/h5dump/h5dump_ddl.c @@ -1488,15 +1488,18 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis if(sset) { unsigned int i; + unsigned int ndims; hid_t sid = H5Dget_space(dsetid); - int ndims = H5Sget_simple_extent_ndims(sid); + int ndims_res = H5Sget_simple_extent_ndims(sid); H5Sclose(sid); - if(ndims < 0) { + if(ndims_res < 0) { error_msg("H5Sget_simple_extent_ndims failed\n"); h5tools_setstatus(EXIT_FAILURE); return; } + else + ndims = ndims_res; if(!sset->start.data || !sset->stride.data || !sset->count.data || !sset->block.data) { /* they didn't specify a ``stride'' or ``block''. default to 1 in all diff --git a/tools/h5dump/h5dump_xml.c b/tools/h5dump/h5dump_xml.c index e6f8043..1a29659 100644 --- a/tools/h5dump/h5dump_xml.c +++ b/tools/h5dump/h5dump_xml.c @@ -1781,7 +1781,6 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t UNUSED * sset, int UNU hsize_t nelmts = 1; int ndims; int i; - int depth; int status = -1; int stdindent = COL; /* should be 3 */ void *buf = NULL; @@ -1883,9 +1882,7 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t UNUSED * sset, int UNU p_type = h5tools_get_native_type(type); /* Check if we have VL data in the dataset's datatype */ - if (h5tools_detect_vlen_str(p_type) == TRUE) - vl_data = TRUE; - if (H5Tdetect_class(p_type, H5T_VLEN) == TRUE) + if (h5tools_detect_vlen(p_type) == TRUE) vl_data = TRUE; H5Tclose(type); @@ -2952,7 +2949,7 @@ xml_print_refs(hid_t did, int source) string_dataformat.do_escape = display_escape; outputformat = &string_dataformat; - for (i = 0; i < ssiz; i++) { + for (i = 0; i < (hsize_t)ssiz; i++) { const char *path = lookup_ref_path(*refbuf); ctx.indent_level++; diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c index b28f3de..4fab379 100644 --- a/tools/h5dump/h5dumpgentest.c +++ b/tools/h5dump/h5dumpgentest.c @@ -97,6 +97,7 @@ #define FILE65 "file_space.h5" #define FILE66 "packedbits.h5" #define FILE67 "zerodim.h5" +#define FILE68 "charsets.h5" @@ -7132,6 +7133,54 @@ gent_packedbits(void) } /*------------------------------------------------------------------------- + * Function: gent_charsets + * + * Purpose: Generate a file to be used in the character set test + * Contains: + * 1) a ascii datatype + * 2) a utf8 datatype + * + *------------------------------------------------------------------------- + */ +static void +gent_charsets(void) +{ + hid_t fid, did, sid; + herr_t status; + hsize_t dim[] = {1}; /* Dataspace dimensions */ + typedef struct CharSetInfo { + const char *ascii_p_; + const char *utf8_p_; + } CharSetInfo; + + sid = H5Screate_simple( 1, dim, NULL ); + fid = H5Fcreate( FILE68, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT ); + + hid_t charset_dtid = H5Tcreate( H5T_COMPOUND, sizeof( CharSetInfo ) ); + + hid_t ascii_dtid = H5Tcreate( H5T_STRING, H5T_VARIABLE ); + status = H5Tset_cset( ascii_dtid, H5T_CSET_ASCII ); + H5Tinsert( charset_dtid, "ascii", HOFFSET(CharSetInfo, ascii_p_ ), ascii_dtid ); + + hid_t utf8_dtid = H5Tcreate( H5T_STRING, H5T_VARIABLE ); + status = H5Tset_cset( utf8_dtid, H5T_CSET_UTF8 ); + H5Tinsert( charset_dtid, "utf8", HOFFSET( CharSetInfo, utf8_p_ ), utf8_dtid ); + + did = H5Dcreate2( fid, "CharSets", charset_dtid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT ); + + const char * writeData[] = { "ascii", "utf8", }; + status = H5Dwrite( did, charset_dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, writeData ); + + H5Tclose( charset_dtid ); + H5Tclose( ascii_dtid ); + H5Tclose( utf8_dtid ); + H5Sclose( sid ); + H5Dclose( did ); + H5Fclose( fid ); +} + + +/*------------------------------------------------------------------------- * Function: main * *------------------------------------------------------------------------- @@ -7207,6 +7256,7 @@ int main(void) gent_extlinks(); gent_fs_strategy_threshold(); gent_packedbits(); + gent_charsets(); return 0; } diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in index 25a30c5..016b4f1 100644 --- a/tools/h5dump/testh5dump.sh.in +++ b/tools/h5dump/testh5dump.sh.in @@ -75,6 +75,7 @@ test -d $TESTDIR || mkdir $TESTDIR # Comment '#' without space can be used. # -------------------------------------------------------------------- LIST_HDF5_TEST_FILES=" +$SRC_H5DUMP_TESTFILES/charsets.h5 $SRC_H5DUMP_TESTFILES/file_space.h5 $SRC_H5DUMP_TESTFILES/filter_fail.h5 $SRC_H5DUMP_TESTFILES/packedbits.h5 @@ -161,6 +162,7 @@ $SRC_H5DUMP_TESTFILES/tvms.h5 " LIST_OTHER_TEST_FILES=" +$SRC_H5DUMP_TESTFILES/charsets.ddl $SRC_H5DUMP_TESTFILES/file_space.ddl $SRC_H5DUMP_TESTFILES/filter_fail.ddl $SRC_H5DUMP_TESTFILES/packedbits.ddl @@ -290,152 +292,9 @@ $SRC_H5DUMP_TESTFILES/tvlstr.ddl $SRC_H5DUMP_TESTFILES/tvms.ddl $SRC_H5DUMP_TESTFILES/h5dump-help.txt $SRC_H5DUMP_TESTFILES/out3.h5import -$SRC_H5DUMP_TESTFILES/tnofilename-with-packed-bits.ddl -$SRC_H5DUMP_TESTFILES/tpbitsArray.ddl -$SRC_H5DUMP_TESTFILES/tpbitsCompound.ddl -$SRC_H5DUMP_TESTFILES/tpbitsIncomplete.ddl -$SRC_H5DUMP_TESTFILES/tpbitsLengthExceeded.ddl -$SRC_H5DUMP_TESTFILES/tpbitsCharLengthExceeded.ddl -$SRC_H5DUMP_TESTFILES/tpbitsIntLengthExceeded.ddl -$SRC_H5DUMP_TESTFILES/tpbitsLongLengthExceeded.ddl -$SRC_H5DUMP_TESTFILES/tpbitsLengthPositive.ddl -$SRC_H5DUMP_TESTFILES/tpbitsMax.ddl -$SRC_H5DUMP_TESTFILES/tpbitsMaxExceeded.ddl -$SRC_H5DUMP_TESTFILES/tpbitsOffsetExceeded.ddl -$SRC_H5DUMP_TESTFILES/tpbitsCharOffsetExceeded.ddl -$SRC_H5DUMP_TESTFILES/tpbitsIntOffsetExceeded.ddl -$SRC_H5DUMP_TESTFILES/tpbitsLongOffsetExceeded.ddl -$SRC_H5DUMP_TESTFILES/tpbitsOffsetNegative.ddl -$SRC_H5DUMP_TESTFILES/tpbitsOverlapped.ddl -$SRC_H5DUMP_TESTFILES/tpbitsSigned.ddl -$SRC_H5DUMP_TESTFILES/tpbitsUnsigned.ddl -$SRC_H5DUMP_TESTFILES/tpbitsSignedInt.ddl -$SRC_H5DUMP_TESTFILES/tpbitsUnsignedInt.ddl -$SRC_H5DUMP_TESTFILES/tpbitsSignedLong.ddl -$SRC_H5DUMP_TESTFILES/tpbitsUnsignedLong.ddl -$SRC_H5DUMP_TESTFILES/tpbitsSignedLongLong.ddl -$SRC_H5DUMP_TESTFILES/tpbitsUnsignedLongLong.ddl -$SRC_H5DUMP_TESTFILES/tpbitsSignedWhole.ddl -$SRC_H5DUMP_TESTFILES/tpbitsUnsignedWhole.ddl -$SRC_H5DUMP_TESTFILES/tpbitsSignedIntWhole.ddl -$SRC_H5DUMP_TESTFILES/tpbitsUnsignedIntWhole.ddl -$SRC_H5DUMP_TESTFILES/tpbitsSignedLongWhole.ddl -$SRC_H5DUMP_TESTFILES/tpbitsUnsignedLongWhole.ddl -$SRC_H5DUMP_TESTFILES/tpbitsSignedLongLongWhole.ddl -$SRC_H5DUMP_TESTFILES/tpbitsUnsignedLongLongWhole.ddl -$SRC_H5DUMP_TESTFILES/tpbitsSignedLongLongWhole1.ddl -$SRC_H5DUMP_TESTFILES/tpbitsUnsignedLongLongWhole1.ddl -$SRC_H5DUMP_TESTFILES/tpbitsSignedLongLongWhole63.ddl -$SRC_H5DUMP_TESTFILES/tpbitsUnsignedLongLongWhole63.ddl -$SRC_H5DUMP_TESTFILES/tpbitsSigned4.ddl -$SRC_H5DUMP_TESTFILES/tpbitsUnsigned4.ddl -$SRC_H5DUMP_TESTFILES/tpbitsSignedInt8.ddl -$SRC_H5DUMP_TESTFILES/tpbitsUnsignedInt8.ddl -$SRC_H5DUMP_TESTFILES/tpbitsSignedLong16.ddl -$SRC_H5DUMP_TESTFILES/tpbitsUnsignedLong16.ddl -$SRC_H5DUMP_TESTFILES/tpbitsSignedLongLong32.ddl -$SRC_H5DUMP_TESTFILES/tpbitsUnsignedLongLong32.ddl -$SRC_H5DUMP_TESTFILES/tpbitsSigned2.ddl -$SRC_H5DUMP_TESTFILES/tpbitsUnsigned2.ddl -$SRC_H5DUMP_TESTFILES/tpbitsSignedInt4.ddl -$SRC_H5DUMP_TESTFILES/tpbitsUnsignedInt4.ddl -$SRC_H5DUMP_TESTFILES/tpbitsSignedLong8.ddl -$SRC_H5DUMP_TESTFILES/tpbitsUnsignedLong8.ddl -$SRC_H5DUMP_TESTFILES/tpbitsSignedLongLong16.ddl -$SRC_H5DUMP_TESTFILES/tpbitsUnsignedLongLong16.ddl $SRC_H5DUMP_TESTFILES/tbinregR.exp " -LIST_HDF5_TEST_FILES_XML=" -$SRC_H5DUMP_TESTFILES/tbitfields.h5 -$SRC_H5DUMP_TESTFILES/tcompound2.h5 -$SRC_H5DUMP_TESTFILES/tdset2.h5 -$SRC_H5DUMP_TESTFILES/tenum.h5 -$SRC_H5DUMP_TESTFILES/textlink.h5 -$SRC_H5DUMP_TESTFILES/tloop2.h5 -$SRC_H5DUMP_TESTFILES/tmany.h5 -$SRC_H5DUMP_TESTFILES/tname-amp.h5 -$SRC_H5DUMP_TESTFILES/tname-apos.h5 -$SRC_H5DUMP_TESTFILES/tname-gt.h5 -$SRC_H5DUMP_TESTFILES/tname-lt.h5 -$SRC_H5DUMP_TESTFILES/tname-quot.h5 -$SRC_H5DUMP_TESTFILES/tname-sp.h5 -$SRC_H5DUMP_TESTFILES/tnodata.h5 -$SRC_H5DUMP_TESTFILES/tobjref.h5 -$SRC_H5DUMP_TESTFILES/topaque.h5 -$SRC_H5DUMP_TESTFILES/tref.h5 -$SRC_H5DUMP_TESTFILES/tref-escapes.h5 -$SRC_H5DUMP_TESTFILES/tref-escapes-at.h5 -$SRC_H5DUMP_TESTFILES/tstring.h5 -$SRC_H5DUMP_TESTFILES/tstring-at.h5 -" - -LIST_OTHER_TEST_FILES_XML=" -$SRC_H5DUMP_TESTFILES/tall.h5.xml -$SRC_H5DUMP_TESTFILES/tall-2A.h5.xml -$SRC_H5DUMP_TESTFILES/tarray1.h5.xml -$SRC_H5DUMP_TESTFILES/tarray2.h5.xml -$SRC_H5DUMP_TESTFILES/tarray3.h5.xml -$SRC_H5DUMP_TESTFILES/tarray6.h5.xml -$SRC_H5DUMP_TESTFILES/tarray7.h5.xml -$SRC_H5DUMP_TESTFILES/tattr.h5.xml -$SRC_H5DUMP_TESTFILES/tbitfields.h5.xml -$SRC_H5DUMP_TESTFILES/tcompound_complex.h5.xml -$SRC_H5DUMP_TESTFILES/tcompound.h5.xml -$SRC_H5DUMP_TESTFILES/tcompound2.h5.xml -$SRC_H5DUMP_TESTFILES/tdatareg.h5.xml -$SRC_H5DUMP_TESTFILES/tdset.h5.xml -$SRC_H5DUMP_TESTFILES/tdset2.h5.xml -$SRC_H5DUMP_TESTFILES/tempty.h5.xml -$SRC_H5DUMP_TESTFILES/tempty-dtd.h5.xml -$SRC_H5DUMP_TESTFILES/tempty-dtd-2.h5.xml -$SRC_H5DUMP_TESTFILES/tempty-dtd-uri.h5.xml -$SRC_H5DUMP_TESTFILES/tempty-nons.h5.xml -$SRC_H5DUMP_TESTFILES/tempty-nons-2.h5.xml -$SRC_H5DUMP_TESTFILES/tempty-nons-uri.h5.xml -$SRC_H5DUMP_TESTFILES/tempty-ns.h5.xml -$SRC_H5DUMP_TESTFILES/tempty-ns-2.h5.xml -$SRC_H5DUMP_TESTFILES/tenum.h5.xml -$SRC_H5DUMP_TESTFILES/textlink.h5.xml -$SRC_H5DUMP_TESTFILES/tfpformat.h5.xml -$SRC_H5DUMP_TESTFILES/tgroup.h5.xml -$SRC_H5DUMP_TESTFILES/thlink.h5.xml -$SRC_H5DUMP_TESTFILES/tloop.h5.xml -$SRC_H5DUMP_TESTFILES/tloop2.h5.xml -$SRC_H5DUMP_TESTFILES/tmany.h5.xml -$SRC_H5DUMP_TESTFILES/tname-amp.h5.xml -$SRC_H5DUMP_TESTFILES/tname-apos.h5.xml -$SRC_H5DUMP_TESTFILES/tnamed_dtype_attr.h5.xml -$SRC_H5DUMP_TESTFILES/tname-gt.h5.xml -$SRC_H5DUMP_TESTFILES/tname-lt.h5.xml -$SRC_H5DUMP_TESTFILES/tname-quot.h5.xml -$SRC_H5DUMP_TESTFILES/tname-sp.h5.xml -$SRC_H5DUMP_TESTFILES/tnestedcomp.h5.xml -$SRC_H5DUMP_TESTFILES/tnodata.h5.xml -$SRC_H5DUMP_TESTFILES/tobjref.h5.xml -$SRC_H5DUMP_TESTFILES/topaque.h5.xml -$SRC_H5DUMP_TESTFILES/torderattr1.h5.xml -$SRC_H5DUMP_TESTFILES/torderattr2.h5.xml -$SRC_H5DUMP_TESTFILES/torderattr3.h5.xml -$SRC_H5DUMP_TESTFILES/torderattr4.h5.xml -$SRC_H5DUMP_TESTFILES/tref.h5.xml -$SRC_H5DUMP_TESTFILES/tref-escapes.h5.xml -$SRC_H5DUMP_TESTFILES/tref-escapes-at.h5.xml -$SRC_H5DUMP_TESTFILES/tsaf.h5.xml -$SRC_H5DUMP_TESTFILES/tslink.h5.xml -$SRC_H5DUMP_TESTFILES/tstr.h5.xml -$SRC_H5DUMP_TESTFILES/tstr2.h5.xml -$SRC_H5DUMP_TESTFILES/tstring.h5.xml -$SRC_H5DUMP_TESTFILES/tstring-at.h5.xml -$SRC_H5DUMP_TESTFILES/tudlink.h5.xml -$SRC_H5DUMP_TESTFILES/tvldtypes1.h5.xml -$SRC_H5DUMP_TESTFILES/tvldtypes2.h5.xml -$SRC_H5DUMP_TESTFILES/tvldtypes3.h5.xml -$SRC_H5DUMP_TESTFILES/tvldtypes4.h5.xml -$SRC_H5DUMP_TESTFILES/tvldtypes5.h5.xml -$SRC_H5DUMP_TESTFILES/tvlstr.h5.xml -" - # # copy test files and expected output files from source dirs to test dir # @@ -834,6 +693,9 @@ TOOLTEST tno-subset.ddl --no-compact-subset -d "AHFINDERDIRECT::ah_centroid_t[0] # test printing characters in ASCII instead of decimal TOOLTEST tchar1.ddl --enable-error-stack -r tchar.h5 +# test datatypes in ASCII and UTF8 +TOOLTEST charsets.ddl --enable-error-stack charsets.h5 + # rev. 2004 # tests for super block @@ -1042,87 +904,6 @@ TOOLTEST3 filter_fail.ddl --enable-error-stack filter_fail.h5 # test for -o -y for dataset with attributes TOOLTEST tall-6.ddl --enable-error-stack -y -o data -d /g1/g1.1/dset1.1.1 tall.h5 -####### test for dataset packed bits ###### - -# test failure handling -# Missing file name -TOOLTEST tnofilename-with-packed-bits.ddl --enable-error-stack -# Limits: -# Maximum number of packed bits is 8 (for now). -# Maximum integer size is 64 (for now). -# Maximun Offset is 63 (Maximum size - 1). -# Maximum Offset+Length is 64 (Maximum size). -# Tests: -# Normal operation on both signed and unsigned int datasets. -# Sanity check -# Their rawdata output should be the same. -TOOLTEST tpbitsSignedWhole.ddl --enable-error-stack -d /DS08BITS -M 0,8 packedbits.h5 -TOOLTEST tpbitsUnsignedWhole.ddl --enable-error-stack -d /DU08BITS -M 0,8 packedbits.h5 -TOOLTEST tpbitsSignedIntWhole.ddl --enable-error-stack -d /DS16BITS -M 0,16 packedbits.h5 -TOOLTEST tpbitsUnsignedIntWhole.ddl --enable-error-stack -d /DU16BITS -M 0,16 packedbits.h5 -TOOLTEST tpbitsSignedLongWhole.ddl --enable-error-stack -d /DS32BITS -M 0,32 packedbits.h5 -TOOLTEST tpbitsUnsignedLongWhole.ddl --enable-error-stack -d /DU32BITS -M 0,32 packedbits.h5 -TOOLTEST tpbitsSignedLongLongWhole.ddl --enable-error-stack -d /DS64BITS -M 0,64 packedbits.h5 -TOOLTEST tpbitsUnsignedLongLongWhole.ddl --enable-error-stack -d /DU64BITS -M 0,64 packedbits.h5 -TOOLTEST tpbitsSignedLongLongWhole63.ddl --enable-error-stack -d /DS64BITS -M 0,63 packedbits.h5 -TOOLTEST tpbitsUnsignedLongLongWhole63.ddl --enable-error-stack -d /DU64BITS -M 0,63 packedbits.h5 -TOOLTEST tpbitsSignedLongLongWhole1.ddl --enable-error-stack -d /DS64BITS -M 1,63 packedbits.h5 -TOOLTEST tpbitsUnsignedLongLongWhole1.ddl --enable-error-stack -d /DU64BITS -M 1,63 packedbits.h5 -# Half sections -TOOLTEST tpbitsSigned4.ddl --enable-error-stack -d /DS08BITS -M 0,4,4,4 packedbits.h5 -TOOLTEST tpbitsUnsigned4.ddl --enable-error-stack -d /DU08BITS -M 0,4,4,4 packedbits.h5 -TOOLTEST tpbitsSignedInt8.ddl --enable-error-stack -d /DS16BITS -M 0,8,8,8 packedbits.h5 -TOOLTEST tpbitsUnsignedInt8.ddl --enable-error-stack -d /DU16BITS -M 0,8,8,8 packedbits.h5 -TOOLTEST tpbitsSignedLong16.ddl --enable-error-stack -d /DS32BITS -M 0,16,16,16 packedbits.h5 -TOOLTEST tpbitsUnsignedLong16.ddl --enable-error-stack -d /DU32BITS -M 0,16,16,16 packedbits.h5 -TOOLTEST tpbitsSignedLongLong32.ddl --enable-error-stack -d /DS64BITS -M 0,32,32,32 packedbits.h5 -TOOLTEST tpbitsUnsignedLongLong32.ddl --enable-error-stack -d /DU64BITS -M 0,32,32,32 packedbits.h5 -# Quarter sections -TOOLTEST tpbitsSigned2.ddl --enable-error-stack -d /DS08BITS -M 0,2,2,2,4,2,6,2 packedbits.h5 -TOOLTEST tpbitsUnsigned2.ddl --enable-error-stack -d /DU08BITS -M 0,2,2,2,4,2,6,2 packedbits.h5 -TOOLTEST tpbitsSignedInt4.ddl --enable-error-stack -d /DS16BITS -M 0,4,4,4,8,4,12,4 packedbits.h5 -TOOLTEST tpbitsUnsignedInt4.ddl --enable-error-stack -d /DU16BITS -M 0,4,4,4,8,4,12,4 packedbits.h5 -TOOLTEST tpbitsSignedLong8.ddl --enable-error-stack -d /DS32BITS -M 0,8,8,8,16,8,24,8 packedbits.h5 -TOOLTEST tpbitsUnsignedLong8.ddl --enable-error-stack -d /DU32BITS -M 0,8,8,8,16,8,24,8 packedbits.h5 -TOOLTEST tpbitsSignedLongLong16.ddl --enable-error-stack -d /DS64BITS -M 0,16,16,16,32,16,48,16 packedbits.h5 -TOOLTEST tpbitsUnsignedLongLong16.ddl --enable-error-stack -d /DU64BITS -M 0,16,16,16,32,16,48,16 packedbits.h5 -# Begin and End -TOOLTEST tpbitsSigned.ddl --enable-error-stack -d /DS08BITS -M 0,2,2,6 packedbits.h5 -TOOLTEST tpbitsUnsigned.ddl --enable-error-stack -d /DU08BITS -M 0,2,2,6 packedbits.h5 -TOOLTEST tpbitsSignedInt.ddl --enable-error-stack -d /DS16BITS -M 0,2,10,6 packedbits.h5 -TOOLTEST tpbitsUnsignedInt.ddl --enable-error-stack -d /DU16BITS -M 0,2,10,6 packedbits.h5 -TOOLTEST tpbitsSignedLong.ddl --enable-error-stack -d /DS32BITS -M 0,2,26,6 packedbits.h5 -TOOLTEST tpbitsUnsignedLong.ddl --enable-error-stack -d /DU32BITS -M 0,2,26,6 packedbits.h5 -TOOLTEST tpbitsSignedLongLong.ddl --enable-error-stack -d /DS64BITS -M 0,2,58,6 packedbits.h5 -TOOLTEST tpbitsUnsignedLongLong.ddl --enable-error-stack -d /DU64BITS -M 0,2,58,6 packedbits.h5 -# Overlapped packed bits. -TOOLTEST tpbitsOverlapped.ddl --enable-error-stack -d /DS08BITS -M 0,1,1,1,2,1,0,3 packedbits.h5 -# Maximum number of packed bits. -TOOLTEST tpbitsMax.ddl --enable-error-stack -d /DS08BITS -M 0,1,1,1,2,1,3,1,4,1,5,1,6,1,7,1 packedbits.h5 -# Compound type. -TOOLTEST tpbitsCompound.ddl --enable-error-stack -d /dset1 -M 0,1,1,1 tcompound.h5 -# Array type. -TOOLTEST tpbitsArray.ddl --enable-error-stack -d /Dataset1 -M 0,1,1,1 tarray1.h5 -# Test Error handling. -# Too many packed bits requested. Max is 8 for now. -TOOLTEST tpbitsMaxExceeded.ddl --enable-error-stack -d /DS08BITS -M 0,1,0,1,1,1,2,1,3,1,4,1,5,1,6,1,7,1 packedbits.h5 -# Offset too large. Max is 7 (8-1) for now. -TOOLTEST tpbitsOffsetExceeded.ddl --enable-error-stack -d /DS08BITS -M 64,1 packedbits.h5 -TOOLTEST tpbitsCharOffsetExceeded.ddl --enable-error-stack -d /DS08BITS -M 8,1 packedbits.h5 -TOOLTEST tpbitsIntOffsetExceeded.ddl --enable-error-stack -d /DS16BITS -M 16,1 packedbits.h5 -TOOLTEST tpbitsLongOffsetExceeded.ddl --enable-error-stack -d /DS32BITS -M 32,1 packedbits.h5 -# Bad offset, must not be negative. -TOOLTEST tpbitsOffsetNegative.ddl --enable-error-stack -d /DS08BITS -M -1,1 packedbits.h5 -# Bad length, must not be positive. -TOOLTEST tpbitsLengthPositive.ddl --enable-error-stack -d /DS08BITS -M 4,0 packedbits.h5 -# Offset+Length is too large. Max is 8 for now. -TOOLTEST tpbitsLengthExceeded.ddl --enable-error-stack -d /DS08BITS -M 37,28 packedbits.h5 -TOOLTEST tpbitsCharLengthExceeded.ddl --enable-error-stack -d /DS08BITS -M 2,7 packedbits.h5 -TOOLTEST tpbitsIntLengthExceeded.ddl --enable-error-stack -d /DS16BITS -M 10,7 packedbits.h5 -TOOLTEST tpbitsLongLengthExceeded.ddl --enable-error-stack -d /DS32BITS -M 26,7 packedbits.h5 -# Incomplete pair of packed bits request. -TOOLTEST tpbitsIncomplete.ddl --enable-error-stack -d /DS08BITS -M 0,2,2,1,0,2,2, packedbits.h5 - # Report test results and exit if test $nerrors -eq 0 ; then diff --git a/tools/h5dump/testh5dumppbits.sh.in b/tools/h5dump/testh5dumppbits.sh.in new file mode 100644 index 0000000..393fcc1 --- /dev/null +++ b/tools/h5dump/testh5dumppbits.sh.in @@ -0,0 +1,495 @@ +#! /bin/sh +# +# Copyright by The HDF Group. +# Copyright by the Board of Trustees of the University of Illinois. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the files COPYING and Copyright.html. COPYING can be found at the root +# of the source code distribution tree; Copyright.html can be found at the +# root level of an installed copy of the electronic HDF5 document set and +# is linked from the top-level documents page. It can also be found at +# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have +# access to either file, you may request a copy from help@hdfgroup.org. +# +# Tests for the h5dump tool with packed bits type files + +# Determine which filters are available +USE_FILTER_SZIP="@USE_FILTER_SZIP@" +USE_FILTER_DEFLATE="@USE_FILTER_DEFLATE@" +USE_FILTER_SHUFFLE="@USE_FILTER_SHUFFLE@" +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 + +H5DIFF=../h5diff/h5diff # The h5diff tool name +H5DIFF_BIN=`pwd`/$H5DIFF # The path of the h5diff tool binary + +H5IMPORT=../h5import/h5import # The h5import tool name +H5IMPORT_BIN=`pwd`/$H5IMPORT # The path of the h5import tool binary + + +CMP='cmp -s' +DIFF='diff -c' +CP='cp' + +nerrors=0 +verbose=yes + +# The build (current) directory might be different than the source directory. +if test -z "$srcdir"; then + srcdir=. +fi +# source dirs +SRC_TOOLS="$srcdir/../" + +SRC_TOOLS_TESTFILES="$SRC_TOOLS/testfiles" +# testfiles source dirs for tools +SRC_H5LS_TESTFILES="$SRC_TOOLS_TESTFILES" +SRC_H5DUMP_TESTFILES="$SRC_TOOLS_TESTFILES" +SRC_H5DIFF_TESTFILES="$SRC_TOOLS/h5diff/testfiles" +SRC_H5COPY_TESTFILES="$SRC_TOOLS/h5copy/testfiles" +SRC_H5REPACK_TESTFILES="$SRC_TOOLS/h5repack/testfiles" +SRC_H5JAM_TESTFILES="$SRC_TOOLS/h5jam/testfiles" +SRC_H5STAT_TESTFILES="$SRC_TOOLS/h5stat/testfiles" +SRC_H5IMPORT_TESTFILES="$SRC_TOOLS/h5import/testfiles" + +TESTDIR=./testfiles +test -d $TESTDIR || mkdir $TESTDIR + +###################################################################### +# test files +# -------------------------------------------------------------------- +# All the test files copy from source directory to test directory +# NOTE: Keep this framework to add/remove test files. +# Any test files from other tools can be used in this framework. +# This list are also used for checking exist. +# Comment '#' without space can be used. +# -------------------------------------------------------------------- +LIST_HDF5_TEST_FILES=" +$SRC_H5DUMP_TESTFILES/packedbits.h5 +" + +LIST_OTHER_TEST_FILES=" +$SRC_H5DUMP_TESTFILES/tnofilename-with-packed-bits.ddl +$SRC_H5DUMP_TESTFILES/tpbitsArray.ddl +$SRC_H5DUMP_TESTFILES/tpbitsCompound.ddl +$SRC_H5DUMP_TESTFILES/tpbitsIncomplete.ddl +$SRC_H5DUMP_TESTFILES/tpbitsLengthExceeded.ddl +$SRC_H5DUMP_TESTFILES/tpbitsCharLengthExceeded.ddl +$SRC_H5DUMP_TESTFILES/tpbitsIntLengthExceeded.ddl +$SRC_H5DUMP_TESTFILES/tpbitsLongLengthExceeded.ddl +$SRC_H5DUMP_TESTFILES/tpbitsLengthPositive.ddl +$SRC_H5DUMP_TESTFILES/tpbitsMax.ddl +$SRC_H5DUMP_TESTFILES/tpbitsMaxExceeded.ddl +$SRC_H5DUMP_TESTFILES/tpbitsOffsetExceeded.ddl +$SRC_H5DUMP_TESTFILES/tpbitsCharOffsetExceeded.ddl +$SRC_H5DUMP_TESTFILES/tpbitsIntOffsetExceeded.ddl +$SRC_H5DUMP_TESTFILES/tpbitsLongOffsetExceeded.ddl +$SRC_H5DUMP_TESTFILES/tpbitsOffsetNegative.ddl +$SRC_H5DUMP_TESTFILES/tpbitsOverlapped.ddl +$SRC_H5DUMP_TESTFILES/tpbitsSigned.ddl +$SRC_H5DUMP_TESTFILES/tpbitsUnsigned.ddl +$SRC_H5DUMP_TESTFILES/tpbitsSignedInt.ddl +$SRC_H5DUMP_TESTFILES/tpbitsUnsignedInt.ddl +$SRC_H5DUMP_TESTFILES/tpbitsSignedLong.ddl +$SRC_H5DUMP_TESTFILES/tpbitsUnsignedLong.ddl +$SRC_H5DUMP_TESTFILES/tpbitsSignedLongLong.ddl +$SRC_H5DUMP_TESTFILES/tpbitsUnsignedLongLong.ddl +$SRC_H5DUMP_TESTFILES/tpbitsSignedWhole.ddl +$SRC_H5DUMP_TESTFILES/tpbitsUnsignedWhole.ddl +$SRC_H5DUMP_TESTFILES/tpbitsSignedIntWhole.ddl +$SRC_H5DUMP_TESTFILES/tpbitsUnsignedIntWhole.ddl +$SRC_H5DUMP_TESTFILES/tpbitsSignedLongWhole.ddl +$SRC_H5DUMP_TESTFILES/tpbitsUnsignedLongWhole.ddl +$SRC_H5DUMP_TESTFILES/tpbitsSignedLongLongWhole.ddl +$SRC_H5DUMP_TESTFILES/tpbitsUnsignedLongLongWhole.ddl +$SRC_H5DUMP_TESTFILES/tpbitsSignedLongLongWhole1.ddl +$SRC_H5DUMP_TESTFILES/tpbitsUnsignedLongLongWhole1.ddl +$SRC_H5DUMP_TESTFILES/tpbitsSignedLongLongWhole63.ddl +$SRC_H5DUMP_TESTFILES/tpbitsUnsignedLongLongWhole63.ddl +$SRC_H5DUMP_TESTFILES/tpbitsSigned4.ddl +$SRC_H5DUMP_TESTFILES/tpbitsUnsigned4.ddl +$SRC_H5DUMP_TESTFILES/tpbitsSignedInt8.ddl +$SRC_H5DUMP_TESTFILES/tpbitsUnsignedInt8.ddl +$SRC_H5DUMP_TESTFILES/tpbitsSignedLong16.ddl +$SRC_H5DUMP_TESTFILES/tpbitsUnsignedLong16.ddl +$SRC_H5DUMP_TESTFILES/tpbitsSignedLongLong32.ddl +$SRC_H5DUMP_TESTFILES/tpbitsUnsignedLongLong32.ddl +$SRC_H5DUMP_TESTFILES/tpbitsSigned2.ddl +$SRC_H5DUMP_TESTFILES/tpbitsUnsigned2.ddl +$SRC_H5DUMP_TESTFILES/tpbitsSignedInt4.ddl +$SRC_H5DUMP_TESTFILES/tpbitsUnsignedInt4.ddl +$SRC_H5DUMP_TESTFILES/tpbitsSignedLong8.ddl +$SRC_H5DUMP_TESTFILES/tpbitsUnsignedLong8.ddl +$SRC_H5DUMP_TESTFILES/tpbitsSignedLongLong16.ddl +$SRC_H5DUMP_TESTFILES/tpbitsUnsignedLongLong16.ddl +" + +# +# copy test files and expected output files from source dirs to test dir +# +COPY_TESTFILES="$LIST_HDF5_TEST_FILES $LIST_OTHER_TEST_FILES $LIST_HDF5_TEST_FILES_XML $LIST_OTHER_TEST_FILES_XML" + +COPY_TESTFILES_TO_TESTDIR() +{ + # copy test files. Used -f to make sure get a new copy + for tstfile in $COPY_TESTFILES + do + # ignore '#' comment + echo $tstfile | tr -d ' ' | grep '^#' > /dev/null + RET=$? + if [ $RET -eq 1 ]; then + if [ -a $tstfile ]; then + $CP -f $tstfile $TESTDIR + else + echo "Error: FAILED to copy $tstfile" + echo " $tstfile doesn't exist!" + exit $EXIT_FAILURE + fi + fi + done +} + + +# Print a line-line message left justified in a field of 70 characters +# beginning with the word "Testing". +# +TESTING() { + SPACES=" " + echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012' +} + +# Source in the output filter function definitions. +. $srcdir/../../bin/output_filter.sh + +# Run a test and print PASS or *FAIL*. If a test fails then increment +# the `nerrors' global variable and (if $verbose is set) display the +# difference between the actual output and the expected output. The +# expected output is given as the first argument to this function and +# the actual output file is calculated by replacing the `.ddl' with +# `.out'. The actual output is not removed if $HDF5_NOCLEANUP has a +# non-zero value. +# +TOOLTEST() { + expect="$TESTDIR/$1" + actual="$TESTDIR/`basename $1 .ddl`.out" + actual_err="$TESTDIR/`basename $1 .ddl`.err" + actual_sav=${actual}-sav + actual_err_sav=${actual_err}-sav + shift + + # Run test. + TESTING $DUMPER $@ + ( + cd $TESTDIR + $RUNSERIAL $DUMPER_BIN "$@" + ) >$actual 2>$actual_err + + # save actual and actual_err in case they are needed later. + cp $actual $actual_sav + STDOUT_FILTER $actual + cp $actual_err $actual_err_sav + STDERR_FILTER $actual_err + cat $actual_err >> $actual + + if [ ! -f $expect ]; then + # Create the expect file if it doesn't yet exist. + echo " CREATED" + cp $actual $expect + elif $CMP $expect $actual; then + echo " PASSED" + else + echo "*FAILED*" + echo " Expected result (*.ddl) differs from actual result (*.out)" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' + fi + + # Clean up output file + if test -z "$HDF5_NOCLEANUP"; then + rm -f $actual $actual_err $actual_sav $actual_err_sav $actual_ext + fi + +} + + +# same as TOOLTEST1 but compares generated file to expected output +# and compares the generated data file to the expected data file +# used for the binary tests that expect a full path in -o without -b +TOOLTEST2() { + + expectdata="$TESTDIR/$1" + expect="$TESTDIR/`basename $1 .exp`.ddl" + actualdata="$TESTDIR/`basename $1 .exp`.txt" + actual="$TESTDIR/`basename $1 .exp`.out" + actual_err="$TESTDIR/`basename $1 .exp`.err" + shift + + # Run test. + TESTING $DUMPER $@ + ( + cd $TESTDIR + $RUNSERIAL $DUMPER_BIN "$@" + ) >$actual 2>$actual_err + cat $actual_err >> $actual + + if [ ! -f $expect ]; then + # Create the expect file if it doesn't yet exist. + echo " CREATED" + cp $actual $expect + elif $CMP $expect $actual; then + if [ ! -f $expectdata ]; then + # Create the expect data file if it doesn't yet exist. + echo " CREATED" + cp $actualdata $expectdata + elif $CMP $expectdata $actualdata; then + echo " PASSED" + else + echo "*FAILED*" + echo " Expected datafile (*.exp) differs from actual datafile (*.txt)" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF $expectdata $actualdata |sed 's/^/ /' + fi + else + echo "*FAILED*" + echo " Expected result (*.ddl) differs from actual result (*.out)" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' + fi + + # Clean up output file + if test -z "$HDF5_NOCLEANUP"; then + rm -f $actual $actualdata $actual_err + fi + +} + +# same as TOOLTEST but filters error stack outp +# Extract file name, line number, version and thread IDs because they may be different +TOOLTEST3() { + + expect="$TESTDIR/$1" + actual="$TESTDIR/`basename $1 .ddl`.out" + actual_err="$TESTDIR/`basename $1 .ddl`.err" + actual_ext="$TESTDIR/`basename $1 .ddl`.ext" + actual_sav=${actual}-sav + actual_err_sav=${actual_err}-sav + shift + + # Run test. + TESTING $DUMPER $@ + ( + cd $TESTDIR + $RUNSERIAL $DUMPER_BIN "$@" + ) >$actual 2>$actual_err + + # save actual and actual_err in case they are needed later. + cp $actual $actual_sav + STDOUT_FILTER $actual + cp $actual_err $actual_err_sav + STDERR_FILTER $actual_err + + # Extract file name, line number, version and thread IDs because they may be different + sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ + -e 's/line [0-9]*/line (number)/' \ + -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ + -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ + -e 's/H5Eget_auto[1-2]*/H5Eget_auto(1 or 2)/' \ + -e 's/H5Eset_auto[1-2]*/H5Eset_auto(1 or 2)/' \ + $actual_err > $actual_ext + cat $actual_ext >> $actual + + if [ ! -f $expect ]; then + # Create the expect file if it doesn't yet exist. + echo " CREATED" + cp $actual $expect + elif $CMP $expect $actual; then + echo " PASSED" + else + echo "*FAILED*" + echo " Expected result (*.ddl) differs from actual result (*.out)" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' + fi + + # Clean up output file + if test -z "$HDF5_NOCLEANUP"; then + rm -f $actual $actual_err $actual_sav $actual_err_sav + fi + +} + +# Print a "SKIP" message +SKIP() { + TESTING $DUMPER $@ + echo " -SKIP-" +} + +# Print a line-line message left justified in a field of 70 characters +# +PRINT_H5DIFF() { + SPACES=" " + echo " Running h5diff $* $SPACES" | cut -c1-70 | tr -d '\012' +} + + +# Call the h5diff tool +# +DIFFTEST() +{ + PRINT_H5DIFF $@ + ( + cd $TESTDIR + $RUNSERIAL $H5DIFF_BIN "$@" -q + ) + RET=$? + if [ $RET != 0 ] ; then + echo "*FAILED*" + nerrors="`expr $nerrors + 1`" + else + echo " PASSED" + fi + +} + +# Print a line-line message left justified in a field of 70 characters +# beginning with the word "Verifying". +# +PRINT_H5IMPORT() { + SPACES=" " + echo " Running h5import $* $SPACES" | cut -c1-70 | tr -d '\012' +} + +# Call the h5import tool +# +IMPORTTEST() +{ + # remove the output hdf5 file if it exists + hdf5_file="$TESTDIR/$5" + if [ -f $hdf5_file ]; then + rm -f $hdf5_file + fi + + PRINT_H5IMPORT $@ + ( + cd $TESTDIR + $RUNSERIAL $H5IMPORT_BIN "$@" + ) + RET=$? + if [ $RET != 0 ] ; then + echo "*FAILED*" + nerrors="`expr $nerrors + 1`" + else + echo " PASSED" + fi + +} + + +############################################################################## +############################################################################## +### T H E T E S T S ### +############################################################################## +############################################################################## +# prepare for test +COPY_TESTFILES_TO_TESTDIR + +####### test for dataset packed bits ###### + +# test failure handling +# Missing file name +TOOLTEST tnofilename-with-packed-bits.ddl --enable-error-stack +# Limits: +# Maximum number of packed bits is 8 (for now). +# Maximum integer size is 64 (for now). +# Maximun Offset is 63 (Maximum size - 1). +# Maximum Offset+Length is 64 (Maximum size). +# Tests: +# Normal operation on both signed and unsigned int datasets. +# Sanity check +# Their rawdata output should be the same. +TOOLTEST tpbitsSignedWhole.ddl --enable-error-stack -d /DS08BITS -M 0,8 packedbits.h5 +TOOLTEST tpbitsUnsignedWhole.ddl --enable-error-stack -d /DU08BITS -M 0,8 packedbits.h5 +TOOLTEST tpbitsSignedIntWhole.ddl --enable-error-stack -d /DS16BITS -M 0,16 packedbits.h5 +TOOLTEST tpbitsUnsignedIntWhole.ddl --enable-error-stack -d /DU16BITS -M 0,16 packedbits.h5 +TOOLTEST tpbitsSignedLongWhole.ddl --enable-error-stack -d /DS32BITS -M 0,32 packedbits.h5 +TOOLTEST tpbitsUnsignedLongWhole.ddl --enable-error-stack -d /DU32BITS -M 0,32 packedbits.h5 +TOOLTEST tpbitsSignedLongLongWhole.ddl --enable-error-stack -d /DS64BITS -M 0,64 packedbits.h5 +TOOLTEST tpbitsUnsignedLongLongWhole.ddl --enable-error-stack -d /DU64BITS -M 0,64 packedbits.h5 +TOOLTEST tpbitsSignedLongLongWhole63.ddl --enable-error-stack -d /DS64BITS -M 0,63 packedbits.h5 +TOOLTEST tpbitsUnsignedLongLongWhole63.ddl --enable-error-stack -d /DU64BITS -M 0,63 packedbits.h5 +TOOLTEST tpbitsSignedLongLongWhole1.ddl --enable-error-stack -d /DS64BITS -M 1,63 packedbits.h5 +TOOLTEST tpbitsUnsignedLongLongWhole1.ddl --enable-error-stack -d /DU64BITS -M 1,63 packedbits.h5 +# Half sections +TOOLTEST tpbitsSigned4.ddl --enable-error-stack -d /DS08BITS -M 0,4,4,4 packedbits.h5 +TOOLTEST tpbitsUnsigned4.ddl --enable-error-stack -d /DU08BITS -M 0,4,4,4 packedbits.h5 +TOOLTEST tpbitsSignedInt8.ddl --enable-error-stack -d /DS16BITS -M 0,8,8,8 packedbits.h5 +TOOLTEST tpbitsUnsignedInt8.ddl --enable-error-stack -d /DU16BITS -M 0,8,8,8 packedbits.h5 +TOOLTEST tpbitsSignedLong16.ddl --enable-error-stack -d /DS32BITS -M 0,16,16,16 packedbits.h5 +TOOLTEST tpbitsUnsignedLong16.ddl --enable-error-stack -d /DU32BITS -M 0,16,16,16 packedbits.h5 +TOOLTEST tpbitsSignedLongLong32.ddl --enable-error-stack -d /DS64BITS -M 0,32,32,32 packedbits.h5 +TOOLTEST tpbitsUnsignedLongLong32.ddl --enable-error-stack -d /DU64BITS -M 0,32,32,32 packedbits.h5 +# Quarter sections +TOOLTEST tpbitsSigned2.ddl --enable-error-stack -d /DS08BITS -M 0,2,2,2,4,2,6,2 packedbits.h5 +TOOLTEST tpbitsUnsigned2.ddl --enable-error-stack -d /DU08BITS -M 0,2,2,2,4,2,6,2 packedbits.h5 +TOOLTEST tpbitsSignedInt4.ddl --enable-error-stack -d /DS16BITS -M 0,4,4,4,8,4,12,4 packedbits.h5 +TOOLTEST tpbitsUnsignedInt4.ddl --enable-error-stack -d /DU16BITS -M 0,4,4,4,8,4,12,4 packedbits.h5 +TOOLTEST tpbitsSignedLong8.ddl --enable-error-stack -d /DS32BITS -M 0,8,8,8,16,8,24,8 packedbits.h5 +TOOLTEST tpbitsUnsignedLong8.ddl --enable-error-stack -d /DU32BITS -M 0,8,8,8,16,8,24,8 packedbits.h5 +TOOLTEST tpbitsSignedLongLong16.ddl --enable-error-stack -d /DS64BITS -M 0,16,16,16,32,16,48,16 packedbits.h5 +TOOLTEST tpbitsUnsignedLongLong16.ddl --enable-error-stack -d /DU64BITS -M 0,16,16,16,32,16,48,16 packedbits.h5 +# Begin and End +TOOLTEST tpbitsSigned.ddl --enable-error-stack -d /DS08BITS -M 0,2,2,6 packedbits.h5 +TOOLTEST tpbitsUnsigned.ddl --enable-error-stack -d /DU08BITS -M 0,2,2,6 packedbits.h5 +TOOLTEST tpbitsSignedInt.ddl --enable-error-stack -d /DS16BITS -M 0,2,10,6 packedbits.h5 +TOOLTEST tpbitsUnsignedInt.ddl --enable-error-stack -d /DU16BITS -M 0,2,10,6 packedbits.h5 +TOOLTEST tpbitsSignedLong.ddl --enable-error-stack -d /DS32BITS -M 0,2,26,6 packedbits.h5 +TOOLTEST tpbitsUnsignedLong.ddl --enable-error-stack -d /DU32BITS -M 0,2,26,6 packedbits.h5 +TOOLTEST tpbitsSignedLongLong.ddl --enable-error-stack -d /DS64BITS -M 0,2,58,6 packedbits.h5 +TOOLTEST tpbitsUnsignedLongLong.ddl --enable-error-stack -d /DU64BITS -M 0,2,58,6 packedbits.h5 +# Overlapped packed bits. +TOOLTEST tpbitsOverlapped.ddl --enable-error-stack -d /DS08BITS -M 0,1,1,1,2,1,0,3 packedbits.h5 +# Maximum number of packed bits. +TOOLTEST tpbitsMax.ddl --enable-error-stack -d /DS08BITS -M 0,1,1,1,2,1,3,1,4,1,5,1,6,1,7,1 packedbits.h5 +# Compound type. +TOOLTEST tpbitsCompound.ddl --enable-error-stack -d /dset1 -M 0,1,1,1 tcompound.h5 +# Array type. +TOOLTEST tpbitsArray.ddl --enable-error-stack -d /Dataset1 -M 0,1,1,1 tarray1.h5 +# Test Error handling. +# Too many packed bits requested. Max is 8 for now. +TOOLTEST tpbitsMaxExceeded.ddl --enable-error-stack -d /DS08BITS -M 0,1,0,1,1,1,2,1,3,1,4,1,5,1,6,1,7,1 packedbits.h5 +# Offset too large. Max is 7 (8-1) for now. +TOOLTEST tpbitsOffsetExceeded.ddl --enable-error-stack -d /DS08BITS -M 64,1 packedbits.h5 +TOOLTEST tpbitsCharOffsetExceeded.ddl --enable-error-stack -d /DS08BITS -M 8,1 packedbits.h5 +TOOLTEST tpbitsIntOffsetExceeded.ddl --enable-error-stack -d /DS16BITS -M 16,1 packedbits.h5 +TOOLTEST tpbitsLongOffsetExceeded.ddl --enable-error-stack -d /DS32BITS -M 32,1 packedbits.h5 +# Bad offset, must not be negative. +TOOLTEST tpbitsOffsetNegative.ddl --enable-error-stack -d /DS08BITS -M -1,1 packedbits.h5 +# Bad length, must not be positive. +TOOLTEST tpbitsLengthPositive.ddl --enable-error-stack -d /DS08BITS -M 4,0 packedbits.h5 +# Offset+Length is too large. Max is 8 for now. +TOOLTEST tpbitsLengthExceeded.ddl --enable-error-stack -d /DS08BITS -M 37,28 packedbits.h5 +TOOLTEST tpbitsCharLengthExceeded.ddl --enable-error-stack -d /DS08BITS -M 2,7 packedbits.h5 +TOOLTEST tpbitsIntLengthExceeded.ddl --enable-error-stack -d /DS16BITS -M 10,7 packedbits.h5 +TOOLTEST tpbitsLongLengthExceeded.ddl --enable-error-stack -d /DS32BITS -M 26,7 packedbits.h5 +# Incomplete pair of packed bits request. +TOOLTEST tpbitsIncomplete.ddl --enable-error-stack -d /DS08BITS -M 0,2,2,1,0,2,2, packedbits.h5 + + +# Report test results and exit +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 diff --git a/tools/h5dump/testh5dumpxml.sh.in b/tools/h5dump/testh5dumpxml.sh.in index 1bbf232..4e6081b 100755..100644 --- a/tools/h5dump/testh5dumpxml.sh.in +++ b/tools/h5dump/testh5dumpxml.sh.in @@ -26,6 +26,7 @@ DUMPER_BIN=`pwd`/$DUMPER # The path of the tool binary CMP='cmp -s' DIFF='diff -c' +CP='cp' nerrors=0 verbose=yes @@ -34,8 +35,176 @@ verbose=yes if test -z "$srcdir"; then srcdir=. fi +# source dirs +SRC_TOOLS="$srcdir/../" -test -d ../testfiles || mkdir ../testfiles +SRC_TOOLS_TESTFILES="$SRC_TOOLS/testfiles" +# testfiles source dirs for tools +SRC_H5LS_TESTFILES="$SRC_TOOLS_TESTFILES" +SRC_H5DUMP_TESTFILES="$SRC_TOOLS_TESTFILES" +SRC_H5DIFF_TESTFILES="$SRC_TOOLS/h5diff/testfiles" +SRC_H5COPY_TESTFILES="$SRC_TOOLS/h5copy/testfiles" +SRC_H5REPACK_TESTFILES="$SRC_TOOLS/h5repack/testfiles" +SRC_H5JAM_TESTFILES="$SRC_TOOLS/h5jam/testfiles" +SRC_H5STAT_TESTFILES="$SRC_TOOLS/h5stat/testfiles" +SRC_H5IMPORT_TESTFILES="$SRC_TOOLS/h5import/testfiles" + +TESTDIR=./testfiles +test -d $TESTDIR || mkdir $TESTDIR + +###################################################################### +# test files +# -------------------------------------------------------------------- +# All the test files copy from source directory to test directory +# NOTE: Keep this framework to add/remove test files. +# Any test files from other tools can be used in this framework. +# This list are also used for checking exist. +# Comment '#' without space can be used. +# -------------------------------------------------------------------- +LIST_HDF5_TEST_FILES_XML=" +$SRC_H5DUMP_TESTFILES/tall.h5 +$SRC_H5DUMP_TESTFILES/tarray1.h5 +$SRC_H5DUMP_TESTFILES/tarray2.h5 +$SRC_H5DUMP_TESTFILES/tarray3.h5 +$SRC_H5DUMP_TESTFILES/tarray6.h5 +$SRC_H5DUMP_TESTFILES/tarray7.h5 +$SRC_H5DUMP_TESTFILES/tattr.h5 +$SRC_H5DUMP_TESTFILES/tbitfields.h5 +$SRC_H5DUMP_TESTFILES/tcompound.h5 +$SRC_H5DUMP_TESTFILES/tcompound2.h5 +$SRC_H5DUMP_TESTFILES/tcompound_complex.h5 +$SRC_H5DUMP_TESTFILES/tdatareg.h5 +$SRC_H5DUMP_TESTFILES/tdset.h5 +$SRC_H5DUMP_TESTFILES/tdset2.h5 +$SRC_H5DUMP_TESTFILES/tempty.h5 +$SRC_H5DUMP_TESTFILES/tenum.h5 +$SRC_H5DUMP_TESTFILES/textlink.h5 +$SRC_H5DUMP_TESTFILES/tfpformat.h5 +$SRC_H5DUMP_TESTFILES/tgroup.h5 +$SRC_H5DUMP_TESTFILES/thlink.h5 +$SRC_H5DUMP_TESTFILES/tloop.h5 +$SRC_H5DUMP_TESTFILES/tloop2.h5 +$SRC_H5DUMP_TESTFILES/tmany.h5 +$SRC_H5DUMP_TESTFILES/tname-amp.h5 +$SRC_H5DUMP_TESTFILES/tname-apos.h5 +$SRC_H5DUMP_TESTFILES/tname-gt.h5 +$SRC_H5DUMP_TESTFILES/tname-lt.h5 +$SRC_H5DUMP_TESTFILES/tname-quot.h5 +$SRC_H5DUMP_TESTFILES/tname-sp.h5 +$SRC_H5DUMP_TESTFILES/tnamed_dtype_attr.h5 +$SRC_H5DUMP_TESTFILES/tnestedcomp.h5 +$SRC_H5DUMP_TESTFILES/tnodata.h5 +$SRC_H5DUMP_TESTFILES/tobjref.h5 +$SRC_H5DUMP_TESTFILES/topaque.h5 +$SRC_H5DUMP_TESTFILES/torderattr.h5 +$SRC_H5DUMP_TESTFILES/tref.h5 +$SRC_H5DUMP_TESTFILES/tref-escapes.h5 +$SRC_H5DUMP_TESTFILES/tref-escapes-at.h5 +$SRC_H5DUMP_TESTFILES/tsaf.h5 +$SRC_H5DUMP_TESTFILES/tslink.h5 +$SRC_H5DUMP_TESTFILES/tstring.h5 +$SRC_H5DUMP_TESTFILES/tstring-at.h5 +$SRC_H5DUMP_TESTFILES/tstr.h5 +$SRC_H5DUMP_TESTFILES/tstr2.h5 +$SRC_H5DUMP_TESTFILES/tudlink.h5 +$SRC_H5DUMP_TESTFILES/tvldtypes1.h5 +$SRC_H5DUMP_TESTFILES/tvldtypes2.h5 +$SRC_H5DUMP_TESTFILES/tvldtypes3.h5 +$SRC_H5DUMP_TESTFILES/tvldtypes4.h5 +$SRC_H5DUMP_TESTFILES/tvldtypes5.h5 +$SRC_H5DUMP_TESTFILES/tvlstr.h5 +" + +LIST_OTHER_TEST_FILES_XML=" +$SRC_H5DUMP_TESTFILES/tall.h5.xml +$SRC_H5DUMP_TESTFILES/tall-2A.h5.xml +$SRC_H5DUMP_TESTFILES/tarray1.h5.xml +$SRC_H5DUMP_TESTFILES/tarray2.h5.xml +$SRC_H5DUMP_TESTFILES/tarray3.h5.xml +$SRC_H5DUMP_TESTFILES/tarray6.h5.xml +$SRC_H5DUMP_TESTFILES/tarray7.h5.xml +$SRC_H5DUMP_TESTFILES/tattr.h5.xml +$SRC_H5DUMP_TESTFILES/tbitfields.h5.xml +$SRC_H5DUMP_TESTFILES/tcompound_complex.h5.xml +$SRC_H5DUMP_TESTFILES/tcompound.h5.xml +$SRC_H5DUMP_TESTFILES/tcompound2.h5.xml +$SRC_H5DUMP_TESTFILES/tdatareg.h5.xml +$SRC_H5DUMP_TESTFILES/tdset.h5.xml +$SRC_H5DUMP_TESTFILES/tdset2.h5.xml +$SRC_H5DUMP_TESTFILES/tempty.h5.xml +$SRC_H5DUMP_TESTFILES/tempty-dtd.h5.xml +$SRC_H5DUMP_TESTFILES/tempty-dtd-2.h5.xml +$SRC_H5DUMP_TESTFILES/tempty-dtd-uri.h5.xml +$SRC_H5DUMP_TESTFILES/tempty-nons.h5.xml +$SRC_H5DUMP_TESTFILES/tempty-nons-2.h5.xml +$SRC_H5DUMP_TESTFILES/tempty-nons-uri.h5.xml +$SRC_H5DUMP_TESTFILES/tempty-ns.h5.xml +$SRC_H5DUMP_TESTFILES/tempty-ns-2.h5.xml +$SRC_H5DUMP_TESTFILES/tenum.h5.xml +$SRC_H5DUMP_TESTFILES/textlink.h5.xml +$SRC_H5DUMP_TESTFILES/tfpformat.h5.xml +$SRC_H5DUMP_TESTFILES/tgroup.h5.xml +$SRC_H5DUMP_TESTFILES/thlink.h5.xml +$SRC_H5DUMP_TESTFILES/tloop.h5.xml +$SRC_H5DUMP_TESTFILES/tloop2.h5.xml +$SRC_H5DUMP_TESTFILES/tmany.h5.xml +$SRC_H5DUMP_TESTFILES/tname-amp.h5.xml +$SRC_H5DUMP_TESTFILES/tname-apos.h5.xml +$SRC_H5DUMP_TESTFILES/tnamed_dtype_attr.h5.xml +$SRC_H5DUMP_TESTFILES/tname-gt.h5.xml +$SRC_H5DUMP_TESTFILES/tname-lt.h5.xml +$SRC_H5DUMP_TESTFILES/tname-quot.h5.xml +$SRC_H5DUMP_TESTFILES/tname-sp.h5.xml +$SRC_H5DUMP_TESTFILES/tnestedcomp.h5.xml +$SRC_H5DUMP_TESTFILES/tnodata.h5.xml +$SRC_H5DUMP_TESTFILES/tobjref.h5.xml +$SRC_H5DUMP_TESTFILES/topaque.h5.xml +$SRC_H5DUMP_TESTFILES/torderattr1.h5.xml +$SRC_H5DUMP_TESTFILES/torderattr2.h5.xml +$SRC_H5DUMP_TESTFILES/torderattr3.h5.xml +$SRC_H5DUMP_TESTFILES/torderattr4.h5.xml +$SRC_H5DUMP_TESTFILES/tref.h5.xml +$SRC_H5DUMP_TESTFILES/tref-escapes.h5.xml +$SRC_H5DUMP_TESTFILES/tref-escapes-at.h5.xml +$SRC_H5DUMP_TESTFILES/tsaf.h5.xml +$SRC_H5DUMP_TESTFILES/tslink.h5.xml +$SRC_H5DUMP_TESTFILES/tstr.h5.xml +$SRC_H5DUMP_TESTFILES/tstr2.h5.xml +$SRC_H5DUMP_TESTFILES/tstring.h5.xml +$SRC_H5DUMP_TESTFILES/tstring-at.h5.xml +$SRC_H5DUMP_TESTFILES/tudlink.h5.xml +$SRC_H5DUMP_TESTFILES/tvldtypes1.h5.xml +$SRC_H5DUMP_TESTFILES/tvldtypes2.h5.xml +$SRC_H5DUMP_TESTFILES/tvldtypes3.h5.xml +$SRC_H5DUMP_TESTFILES/tvldtypes4.h5.xml +$SRC_H5DUMP_TESTFILES/tvldtypes5.h5.xml +$SRC_H5DUMP_TESTFILES/tvlstr.h5.xml +" + +# +# copy test files and expected output files from source dirs to test dir +# +COPY_TESTFILES="$LIST_HDF5_TEST_FILES_XML $LIST_OTHER_TEST_FILES_XML" + +COPY_TESTFILES_TO_TESTDIR() +{ + # copy test files. Used -f to make sure get a new copy + for tstfile in $COPY_TESTFILES + do + # ignore '#' comment + echo $tstfile | tr -d ' ' | grep '^#' > /dev/null + RET=$? + if [ $RET -eq 1 ]; then + if [ -a $tstfile ]; then + $CP -f $tstfile $TESTDIR + else + echo "Error: FAILED to copy $tstfile" + echo " $tstfile doesn't exist!" + exit $EXIT_FAILURE + fi + fi + done +} # Print a line-line message left justified in a field of 70 characters # beginning with the word "Testing". diff --git a/tools/h5import/CMakeLists.txt b/tools/h5import/CMakeLists.txt index 76dcf26..0f0cc20 100644 --- a/tools/h5import/CMakeLists.txt +++ b/tools/h5import/CMakeLists.txt @@ -261,11 +261,14 @@ ENDIF (BUILD_TESTING) #-----------------------------------------------------------------------------
# Rules for Installation of tools using make Install target
#-----------------------------------------------------------------------------
+ +INSTALL_PROGRAM_PDB (h5import ${HDF5_INSTALL_BIN_DIR} toolsapplications) + INSTALL ( TARGETS h5import RUNTIME DESTINATION - ${HDF5_INSTALL_BIN_DIR}/tools + ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications ) diff --git a/tools/h5import/Makefile.in b/tools/h5import/Makefile.in index b2a90ff..b2a90ff 100755..100644 --- a/tools/h5import/Makefile.in +++ b/tools/h5import/Makefile.in diff --git a/tools/h5import/h5import.c b/tools/h5import/h5import.c index 56dc5ab..56dc5ab 100755..100644 --- a/tools/h5import/h5import.c +++ b/tools/h5import/h5import.c diff --git a/tools/h5import/h5import.h b/tools/h5import/h5import.h index dbc6844..dbc6844 100755..100644 --- a/tools/h5import/h5import.h +++ b/tools/h5import/h5import.h diff --git a/tools/h5import/h5importtest.c b/tools/h5import/h5importtest.c index 434cba7..434cba7 100755..100644 --- a/tools/h5import/h5importtest.c +++ b/tools/h5import/h5importtest.c diff --git a/tools/h5import/testfiles/binfp64.conf b/tools/h5import/testfiles/binfp64.conf index 6b4c361..6b4c361 100755..100644 --- a/tools/h5import/testfiles/binfp64.conf +++ b/tools/h5import/testfiles/binfp64.conf diff --git a/tools/h5import/testfiles/binin16.conf b/tools/h5import/testfiles/binin16.conf index 06869cb..06869cb 100755..100644 --- a/tools/h5import/testfiles/binin16.conf +++ b/tools/h5import/testfiles/binin16.conf diff --git a/tools/h5import/testfiles/binin32.conf b/tools/h5import/testfiles/binin32.conf index 11996ef..11996ef 100755..100644 --- a/tools/h5import/testfiles/binin32.conf +++ b/tools/h5import/testfiles/binin32.conf diff --git a/tools/h5import/testfiles/binin8.conf b/tools/h5import/testfiles/binin8.conf index 1edd80a..1edd80a 100755..100644 --- a/tools/h5import/testfiles/binin8.conf +++ b/tools/h5import/testfiles/binin8.conf diff --git a/tools/h5import/testfiles/binuin16.conf b/tools/h5import/testfiles/binuin16.conf index a4603df..a4603df 100755..100644 --- a/tools/h5import/testfiles/binuin16.conf +++ b/tools/h5import/testfiles/binuin16.conf diff --git a/tools/h5import/testfiles/binuin32.conf b/tools/h5import/testfiles/binuin32.conf index a649e97..a649e97 100755..100644 --- a/tools/h5import/testfiles/binuin32.conf +++ b/tools/h5import/testfiles/binuin32.conf diff --git a/tools/h5import/testfiles/txtfp32.conf b/tools/h5import/testfiles/txtfp32.conf index 9696a7f..9696a7f 100755..100644 --- a/tools/h5import/testfiles/txtfp32.conf +++ b/tools/h5import/testfiles/txtfp32.conf diff --git a/tools/h5import/testfiles/txtfp32.txt b/tools/h5import/testfiles/txtfp32.txt index 142c94f..142c94f 100755..100644 --- a/tools/h5import/testfiles/txtfp32.txt +++ b/tools/h5import/testfiles/txtfp32.txt diff --git a/tools/h5import/testfiles/txtfp64.conf b/tools/h5import/testfiles/txtfp64.conf index fbab6a6..fbab6a6 100755..100644 --- a/tools/h5import/testfiles/txtfp64.conf +++ b/tools/h5import/testfiles/txtfp64.conf diff --git a/tools/h5import/testfiles/txtfp64.txt b/tools/h5import/testfiles/txtfp64.txt index 6c83dc3..6c83dc3 100755..100644 --- a/tools/h5import/testfiles/txtfp64.txt +++ b/tools/h5import/testfiles/txtfp64.txt diff --git a/tools/h5import/testfiles/txtin16.conf b/tools/h5import/testfiles/txtin16.conf index d2d11c3..d2d11c3 100755..100644 --- a/tools/h5import/testfiles/txtin16.conf +++ b/tools/h5import/testfiles/txtin16.conf diff --git a/tools/h5import/testfiles/txtin32.conf b/tools/h5import/testfiles/txtin32.conf index ca4802a..ca4802a 100755..100644 --- a/tools/h5import/testfiles/txtin32.conf +++ b/tools/h5import/testfiles/txtin32.conf diff --git a/tools/h5import/testfiles/txtin8.conf b/tools/h5import/testfiles/txtin8.conf index 9dbfd2b..9dbfd2b 100755..100644 --- a/tools/h5import/testfiles/txtin8.conf +++ b/tools/h5import/testfiles/txtin8.conf diff --git a/tools/h5import/testfiles/txtuin16.conf b/tools/h5import/testfiles/txtuin16.conf index 753e6e8..753e6e8 100755..100644 --- a/tools/h5import/testfiles/txtuin16.conf +++ b/tools/h5import/testfiles/txtuin16.conf diff --git a/tools/h5import/testfiles/txtuin32.conf b/tools/h5import/testfiles/txtuin32.conf index d61e1a1..d61e1a1 100755..100644 --- a/tools/h5import/testfiles/txtuin32.conf +++ b/tools/h5import/testfiles/txtuin32.conf diff --git a/tools/h5import/testfiles/txtuin32.txt b/tools/h5import/testfiles/txtuin32.txt index 0688e9b..0688e9b 100755..100644 --- a/tools/h5import/testfiles/txtuin32.txt +++ b/tools/h5import/testfiles/txtuin32.txt diff --git a/tools/h5jam/CMakeLists.txt b/tools/h5jam/CMakeLists.txt index a03d139..d0bf30f 100644 --- a/tools/h5jam/CMakeLists.txt +++ b/tools/h5jam/CMakeLists.txt @@ -534,11 +534,14 @@ ENDIF (BUILD_TESTING) #-----------------------------------------------------------------------------
# Rules for Installation of tools using make Install target
#-----------------------------------------------------------------------------
+ +INSTALL_PROGRAM_PDB (h5jam ${HDF5_INSTALL_BIN_DIR} toolsapplications) + INSTALL ( TARGETS h5jam h5unjam RUNTIME DESTINATION - ${HDF5_INSTALL_BIN_DIR}/tools + ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications ) diff --git a/tools/h5jam/h5jam.c b/tools/h5jam/h5jam.c index 981eead..52eb0aa 100644 --- a/tools/h5jam/h5jam.c +++ b/tools/h5jam/h5jam.c @@ -310,7 +310,7 @@ main (int argc, const char *argv[]) leave (EXIT_FAILURE); } - fsize = sbuf.st_size; + fsize = (off_t)sbuf.st_size; h5fid = HDopen(input_file, O_RDONLY, 0); if(h5fid < 0) { @@ -455,7 +455,7 @@ copy_some_to_file (int infid, int outfid, hsize_t startin, hsize_t startout, exit (EXIT_FAILURE); } - howmuch = sbuf.st_size; + howmuch = (ssize_t)sbuf.st_size; } else howmuch = limit; diff --git a/tools/h5jam/h5unjam.c b/tools/h5jam/h5unjam.c index 4751dad..c304045 100644 --- a/tools/h5jam/h5unjam.c +++ b/tools/h5jam/h5unjam.c @@ -243,6 +243,9 @@ main(int argc, const char *argv[]) H5Eget_auto2(H5E_DEFAULT, &func, &edata); H5Eset_auto2(H5E_DEFAULT, NULL, NULL); + /* Initialize h5tools lib */ + h5tools_init(); + parse_command_line(argc, argv); if (input_file == NULL) { diff --git a/tools/h5jam/testfiles/u10.txt b/tools/h5jam/testfiles/u10.txt index c76a964..c76a964 100755..100644 --- a/tools/h5jam/testfiles/u10.txt +++ b/tools/h5jam/testfiles/u10.txt diff --git a/tools/h5jam/testfiles/u511.txt b/tools/h5jam/testfiles/u511.txt index bff1736..bff1736 100755..100644 --- a/tools/h5jam/testfiles/u511.txt +++ b/tools/h5jam/testfiles/u511.txt diff --git a/tools/h5jam/testfiles/u512.txt b/tools/h5jam/testfiles/u512.txt index 33a36c9..33a36c9 100755..100644 --- a/tools/h5jam/testfiles/u512.txt +++ b/tools/h5jam/testfiles/u512.txt diff --git a/tools/h5jam/testfiles/u513.txt b/tools/h5jam/testfiles/u513.txt index 6b46ebf..6b46ebf 100755..100644 --- a/tools/h5jam/testfiles/u513.txt +++ b/tools/h5jam/testfiles/u513.txt diff --git a/tools/h5ls/CMakeLists.txt b/tools/h5ls/CMakeLists.txt index 0dec21c..81a6787 100644 --- a/tools/h5ls/CMakeLists.txt +++ b/tools/h5ls/CMakeLists.txt @@ -433,11 +433,14 @@ ENDIF (BUILD_TESTING) #-----------------------------------------------------------------------------
# Rules for Installation of tools using make Install target
#-----------------------------------------------------------------------------
+ +INSTALL_PROGRAM_PDB (h5ls ${HDF5_INSTALL_BIN_DIR} toolsapplications) + INSTALL ( TARGETS h5ls RUNTIME DESTINATION - ${HDF5_INSTALL_BIN_DIR}/tools + ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications ) diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c index 2171682..0fc0531 100644 --- a/tools/h5ls/h5ls.c +++ b/tools/h5ls/h5ls.c @@ -1436,13 +1436,13 @@ dump_dataset_values(hid_t dset) info = &outputformat; ctx.indent_level = 2; - ctx.cur_column = curr_pos; + ctx.cur_column = (size_t)curr_pos; /* Print all the values. */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, " Data:\n"); h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); ctx.need_prefix = TRUE; - ctx.cur_column = curr_pos; + ctx.cur_column = (size_t)curr_pos; if (h5tools_dump_dset(rawoutstream, info, &ctx, dset, -1, NULL) < 0) { h5tools_str_reset(&buffer); h5tools_str_append(&buffer, " Unable to print data."); @@ -1619,7 +1619,7 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t UNUSED *ainfo, if(H5Aread(attr, p_type, buf) >= 0) { ctx.need_prefix = TRUE; ctx.indent_level = 2; - ctx.cur_column = curr_pos; + ctx.cur_column = (size_t)curr_pos; h5tools_dump_mem(rawoutstream, info, &ctx, attr, p_type, space, buf); } @@ -1672,11 +1672,9 @@ dataset_list1(hid_t dset) H5S_class_t space_type; /* type of dataspace */ int i; hsize_t curr_pos = 0; /* total data element position */ - h5tool_link_info_t lnk_info; h5tools_str_t buffer; /* string into which to render */ h5tools_context_t ctx; /* print context */ h5tool_format_t *info = &ls_dataformat; - h5tool_format_t outputformat; HDmemset(&ctx, 0, sizeof(ctx)); HDmemset(&buffer, 0, sizeof(h5tools_str_t)); @@ -1753,7 +1751,6 @@ dataset_list2(hid_t dset, const char UNUSED *name) h5tools_str_t buffer; /* string into which to render */ h5tools_context_t ctx; /* print context */ h5tool_format_t *info = &ls_dataformat; - h5tool_format_t outputformat; HDmemset(&ctx, 0, sizeof(ctx)); HDmemset(&buffer, 0, sizeof(h5tools_str_t)); @@ -1921,7 +1918,6 @@ datatype_list2(hid_t type, const char UNUSED *name) h5tools_str_t buffer; /* string into which to render */ h5tools_context_t ctx; /* print context */ h5tool_format_t *info = &ls_dataformat; - h5tool_format_t outputformat; HDmemset(&ctx, 0, sizeof(ctx)); HDmemset(&buffer, 0, sizeof(h5tools_str_t)); @@ -1962,7 +1958,6 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void h5tools_str_t buffer; /* string into which to render */ h5tools_context_t ctx; /* print context */ h5tool_format_t *info = &ls_dataformat; - h5tool_format_t outputformat; HDmemset(&ctx, 0, sizeof(ctx)); HDmemset(&buffer, 0, sizeof(h5tools_str_t)); @@ -2121,7 +2116,6 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter) h5tools_str_t buffer; /* string into which to render */ h5tools_context_t ctx; /* print context */ h5tool_format_t *info = &ls_dataformat; - h5tool_format_t outputformat; HDmemset(&ctx, 0, sizeof(ctx)); HDmemset(&buffer, 0, sizeof(h5tools_str_t)); @@ -2309,11 +2303,9 @@ visit_obj(hid_t file, const char *oname, iter_t *iter) int retval = 0; H5O_info_t oi; /* Information for object */ hsize_t curr_pos = 0; /* total data element position */ - h5tool_link_info_t lnk_info; h5tools_str_t buffer; /* string into which to render */ h5tools_context_t ctx; /* print context */ h5tool_format_t *info = &ls_dataformat; - h5tool_format_t outputformat; HDmemset(&ctx, 0, sizeof(ctx)); HDmemset(&buffer, 0, sizeof(h5tools_str_t)); @@ -2820,11 +2812,9 @@ main(int argc, const char *argv[]) /* Check the type of link given */ if(H5Lget_info(file, oname, &li, H5P_DEFAULT) < 0) { hsize_t curr_pos = 0; /* total data element position */ - h5tool_link_info_t lnk_info; h5tools_str_t buffer; /* string into which to render */ h5tools_context_t ctx; /* print context */ h5tool_format_t *info = &ls_dataformat; - h5tool_format_t outputformat; HDmemset(&ctx, 0, sizeof(ctx)); HDmemset(&buffer, 0, sizeof(h5tools_str_t)); diff --git a/tools/h5repack/CMakeLists.txt b/tools/h5repack/CMakeLists.txt index 6460375..936559e 100644 --- a/tools/h5repack/CMakeLists.txt +++ b/tools/h5repack/CMakeLists.txt @@ -96,6 +96,7 @@ IF (BUILD_TESTING) ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/h5repack_layout.h5 ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/h5repack_layouto.h5 ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/h5repack_layout2.h5 + ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/h5repack_layout3.h5 ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/h5repack_named_dtypes.h5 ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/h5repack_nbit.h5 ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/h5repack_objs.h5 @@ -145,6 +146,31 @@ IF (BUILD_TESTING) ############################################################################## ############################################################################## + MACRO (ADD_H5_TEST_OLD testname testtype testfile) + IF (${testtype} STREQUAL "SKIP") + IF (NOT HDF5_ENABLE_USING_MEMCHECKER) + ADD_TEST ( + NAME H5REPACK-${testname}-SKIPPED + COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${ARGN} -i ${PROJECT_BINARY_DIR}/testfiles/${testfile} -o ${PROJECT_BINARY_DIR}/testfiles/out.${testfile}" + ) + ENDIF (NOT HDF5_ENABLE_USING_MEMCHECKER) + ELSE (${testtype} STREQUAL "SKIP") + ADD_TEST ( + NAME H5REPACK-${testname} + COMMAND $<TARGET_FILE:h5repack> ${ARGN} -i ${PROJECT_BINARY_DIR}/testfiles/${testfile} -o ${PROJECT_BINARY_DIR}/testfiles/out.${testfile} + ) + IF (NOT "${last_test}" STREQUAL "") + SET_TESTS_PROPERTIES (H5REPACK-${testname} PROPERTIES DEPENDS ${last_test}) + ENDIF (NOT "${last_test}" STREQUAL "") + ADD_TEST ( + NAME H5REPACK-DIFF_${testname} + COMMAND $<TARGET_FILE:h5diff> ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out.${testfile} + ) + SET_TESTS_PROPERTIES (H5REPACK-DIFF_${testname} PROPERTIES DEPENDS H5REPACK-${testname}) + SET (last_test "H5REPACK-DIFF_${testname}") + ENDIF (${testtype} STREQUAL "SKIP") + ENDMACRO (ADD_H5_TEST_OLD) + MACRO (ADD_H5_TEST testname testtype testfile) IF (${testtype} STREQUAL "SKIP") IF (NOT HDF5_ENABLE_USING_MEMCHECKER) @@ -261,6 +287,29 @@ IF (BUILD_TESTING) ENDIF (${testtype} STREQUAL "SKIP") ENDMACRO (ADD_H5_VERIFY_TEST) + MACRO (ADD_H5_TEST_META testname testfile) + ADD_TEST ( + NAME H5REPACK-${testname}_N + COMMAND $<TARGET_FILE:h5repack> ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out_N.${testname}.h5 + ) + IF (NOT "${last_test}" STREQUAL "") + SET_TESTS_PROPERTIES (H5REPACK-${testname}_N PROPERTIES DEPENDS ${last_test}) + ENDIF (NOT "${last_test}" STREQUAL "") + ADD_TEST ( + NAME H5REPACK-${testname}_M + COMMAND $<TARGET_FILE:h5repack> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out_M.${testname}.h5 + ) + IF (NOT "${last_test}" STREQUAL "") + SET_TESTS_PROPERTIES (H5REPACK-${testname}_M PROPERTIES DEPENDS ${last_test}) + ENDIF (NOT "${last_test}" STREQUAL "") + ADD_TEST (NAME H5REPACK-${testname} COMMAND ${CMAKE_COMMAND} -E compare_files ${PROJECT_BINARY_DIR}/testfiles/out_N.${testname}.h5 ${PROJECT_BINARY_DIR}/testfiles/out_M.${testname}.h5) + SET_TESTS_PROPERTIES (H5REPACK-${testname} PROPERTIES WILL_FAIL "true") + IF (NOT "${last_test}" STREQUAL "") + SET_TESTS_PROPERTIES (H5REPACK-${testname} PROPERTIES DEPENDS ${last_test}) + ENDIF (NOT "${last_test}" STREQUAL "") + SET (last_test "H5REPACK-${testname}") + ENDMACRO (ADD_H5_TEST_META) + ############################################################################## ############################################################################## ### T H E T E S T S ### @@ -274,27 +323,36 @@ IF (BUILD_TESTING) -E remove ./testfiles/h5repack_filters.h5.out ./testfiles/h5repack_filters.h5.out.err - ./testfiles/h5repack_layout2.h5-v.out - ./testfiles/h5repack_layout2.h5-v.out.err ./testfiles/h5repack_layout.h5-v.out ./testfiles/h5repack_layout.h5-v.out.err + ./testfiles/h5repack_layout2.h5-v.out + ./testfiles/h5repack_layout2.h5-v.out.err + ./testfiles/h5repack_layout3.h5-v.out + ./testfiles/h5repack_layout3.h5-v.out.err + ./testfiles/out.tfamily%05d.h5 ./testfiles/out.h5diff_attr1.h5 ./testfiles/out.h5repack_attr.h5 + ./testfiles/out.h5repack_attr_refs.h5 ./testfiles/out.h5repack_deflate.h5 ./testfiles/out.h5repack_early.h5 ./testfiles/out.h5repack_fill.h5 ./testfiles/out.h5repack_filters.h5 ./testfiles/out.h5repack_fletcher.h5 ./testfiles/out.h5repack_hlink.h5 - ./testfiles/out.h5repack_layout2.h5 ./testfiles/out.h5repack_layout.h5 ./testfiles/out.h5repack_layouto.h5 + ./testfiles/out.h5repack_layout2.h5 + ./testfiles/out.h5repack_layout3.h5 ./testfiles/out.h5repack_named_dtypes.h5 ./testfiles/out.h5repack_nbit.h5 ./testfiles/out.h5repack_objs.h5 ./testfiles/out.h5repack_refs.h5 ./testfiles/out.h5repack_shuffle.h5 ./testfiles/out.h5repack_soffset.h5 + ./testfiles/out_M.meta_short.h5 + ./testfiles/out_N.meta_short.h5 + ./testfiles/out_M.meta_long.h5 + ./testfiles/out_N.meta_long.h5 # from the h5repacktst h5repack_attr.h5 h5repack_attr_out.h5 @@ -315,9 +373,10 @@ IF (BUILD_TESTING) h5repack_fletcher_out.h5 h5repack_hlink.h5 h5repack_hlink_out.h5 - h5repack_layout2.h5 h5repack_layout.h5 h5repack_layout_out.h5 + h5repack_layout2.h5 + h5repack_layout3.h5 h5repack_named_dtypes.h5 h5repack_named_dtypes_out.h5 h5repack_nbit.h5 @@ -723,6 +782,24 @@ IF (BUILD_TESTING) ADD_H5_TEST (contig_small_fixed_compa "TEST" ${FILE18} -l chunked_small_fixed:COMPA) ADD_H5_VERIFY_TEST (contig_small_fixed_compa "TEST" 0 ${FILE18} chunked_small_fixed COMPACT) +#--------------------------------------------------------------------------- +# Test file contains chunked datasets (need multiple dsets) with +# unlimited max dims. (HDFFV-7933) +# Use first dset to test. +#--------------------------------------------------------------------------- +# chunk to chunk - specify chunk dim bigger than any current dim +ADD_H5_TEST (chunk2chunk "TEST" h5repack_layout3.h5 -l chunk_unlimit1:CHUNK=100x300) +ADD_H5_VERIFY_TEST (chunk2chunk "TEST" 0 h5repack_layout3.h5 chunk_unlimit1 CHUNK) + +# chunk to contiguous +ADD_H5_TEST (chunk2conti "TEST" h5repack_layout3.h5 -l chunk_unlimit1:CONTI) +ADD_H5_VERIFY_TEST (chunk2conti "TEST" 0 h5repack_layout3.h5 chunk_unlimit1 CONTI) + +# chunk to compact - convert big dataset (should be > 64k) for this purpose, +# should remain as original layout (chunk) +ADD_H5_TEST (chunk2compa "TEST" h5repack_layout3.h5 -l chunk_unlimit1:COMPA) +ADD_H5_VERIFY_TEST (chunk2compa "TEST" 0 h5repack_layout3.h5 chunk_unlimit1 CHUNK) + # Native option # Do not use FILE1, as the named dtype will be converted to native, and h5diff will # report a difference. @@ -762,7 +839,7 @@ IF (BUILD_TESTING) IF (NOT USE_FILTER_DEFLATE) SET (TESTTYPE "SKIP") ENDIF (NOT USE_FILTER_DEFLATE) -# ADD_H5_TEST (old_style_layout_short_switches ${TESTTYPE} ${arg}) + ADD_H5_TEST_OLD (old_style_layout_short_switches ${TESTTYPE} ${arg}) # add a userblock to file SET (arg ${FILE1} -u ${PROJECT_BINARY_DIR}/testfiles/ublock.bin -b 2048) @@ -783,16 +860,14 @@ IF (BUILD_TESTING) ADD_H5_TEST (committed_dt "TEST" ${FILE15}) # tests family driver (file is located in common testfiles folder, uses TOOLTEST1 -# ADD_H5_TEST ( family "FAMILY" ${FILE16}) + ADD_H5_TEST (family "TEST" ${FILE16}) # test various references (bug 1814 and 1726) ADD_H5_TEST (bug1814 "TEST" ${FILE_REF}) -# test attribute with various references in attribute of compund -# or vlen datatype -# (HDFFV-2605, 7513) -# TODO: include this test when code portion is completed. - ADD_H5_TEST (HDFFV-2605 "SKIP" ${FILE_ATTR_REF}) +# test attribute with various references (bug1797 / HDFFV-5932) +# the references in attribute of compund or vlen datatype + ADD_H5_TEST (HDFFV-5932 "TEST" ${FILE_ATTR_REF}) # Add test for memory leak in attirbute. This test is verified by CTEST. # 1. leak from vlen string @@ -801,6 +876,10 @@ IF (BUILD_TESTING) # Note: this test is experimental for sharing test file among tools ADD_H5_TEST (HDFFV-7840 "TEST" h5diff_attr1.h5) +# tests for metadata block size option ('-M') + ADD_H5_TEST_META (meta_short h5repack_layout.h5 -M 8192) + ADD_H5_TEST_META (meta_long h5repack_layout.h5 --metadata_block_size=8192) + IF (HDF5_TEST_VFD) # Run test with different Virtual File Driver FOREACH (vfd ${VFD_LIST}) @@ -819,11 +898,14 @@ ENDIF (BUILD_TESTING) #-----------------------------------------------------------------------------
# Rules for Installation of tools using make Install target
#-----------------------------------------------------------------------------
+ +INSTALL_PROGRAM_PDB (h5repack ${HDF5_INSTALL_BIN_DIR} toolsapplications) + INSTALL ( TARGETS h5repack RUNTIME DESTINATION - ${HDF5_INSTALL_BIN_DIR}/tools + ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications ) diff --git a/tools/h5repack/h5repack.c b/tools/h5repack/h5repack.c index 28d66c5..292f4ec 100644 --- a/tools/h5repack/h5repack.c +++ b/tools/h5repack/h5repack.c @@ -87,10 +87,12 @@ int h5repack(const char* infile, */ int -h5repack_init(pack_opt_t *options, int verbose, H5F_file_space_type_t strategy, hsize_t threshold) +h5repack_init(pack_opt_t *options, int verbose, H5F_file_space_type_t strategy, + hsize_t threshold) { int k, n; - HDmemset(options,0,sizeof(pack_opt_t)); + + HDmemset(options, 0, sizeof(pack_opt_t)); options->min_comp = 1024; options->verbose = verbose; @@ -204,10 +206,12 @@ int h5repack_addlayout(const char* str, if (obj_list==NULL) return -1; - /* set global layout option */ + /* set layout option */ + options->layout_g = pack.layout; + + /* no individual dataset specified */ if (options->all_layout==1 ) { - options->layout_g=pack.layout; if (pack.layout==H5D_CHUNKED) { /* -2 means the NONE option, remove chunking @@ -226,6 +230,7 @@ int h5repack_addlayout(const char* str, } } + /* individual dataset specified */ if (options->all_layout==0) options_add_layout(obj_list, n_objs, @@ -502,7 +507,7 @@ int copy_attr(hid_t loc_in, if (type_class == H5T_COMPOUND) { int nmembers = H5Tget_nmembers(wtype_id) ; for (j=0; j<nmembers; j++) { - hid_t mtid = H5Tget_member_type( wtype_id, j ); + hid_t mtid = H5Tget_member_type( wtype_id, (unsigned) j ); H5T_class_t mtclass = H5Tget_class(mtid); H5Tclose(mtid); diff --git a/tools/h5repack/h5repack.h b/tools/h5repack/h5repack.h index 6415d3a..69e36fc 100644 --- a/tools/h5repack/h5repack.h +++ b/tools/h5repack/h5repack.h @@ -28,6 +28,7 @@ #define MAX_VAR_DIMS 32 /* max per variable dimensions */ #define FORMAT_OBJ " %-27s %s\n" /* obj type, name */ #define FORMAT_OBJ_ATTR " %-27s %s\n" /* obj type, name */ +#define MAX_COMPACT_DSIZE 64512 /* max data size for compact layout. -1k for header size */ /*------------------------------------------------------------------------- * data structures for command line options @@ -111,6 +112,7 @@ typedef struct { datatype, fill value, filter pipleline, attribute */ const char *ublock_filename; /* user block file name */ hsize_t ublock_size; /* user block size */ + hsize_t meta_block_size; /* metadata aggregation block size (for H5Pset_meta_block_size) */ hsize_t threshold; /* alignment threshold for H5Pset_alignment */ hsize_t alignment ; /* alignment for H5Pset_alignment */ H5F_file_space_type_t fs_strategy; /* File space handling strategy */ diff --git a/tools/h5repack/h5repack.sh.in b/tools/h5repack/h5repack.sh.in index c1cbba1..e05b03f 100755..100644 --- a/tools/h5repack/h5repack.sh.in +++ b/tools/h5repack/h5repack.sh.in @@ -94,6 +94,7 @@ $SRC_H5REPACK_TESTFILES/h5repack_hlink.h5 $SRC_H5REPACK_TESTFILES/h5repack_layout.h5 $SRC_H5REPACK_TESTFILES/h5repack_layouto.h5 $SRC_H5REPACK_TESTFILES/h5repack_layout2.h5 +$SRC_H5REPACK_TESTFILES/h5repack_layout3.h5 $SRC_H5REPACK_TESTFILES/h5repack_named_dtypes.h5 $SRC_H5REPACK_TESTFILES/h5repack_nbit.h5 $SRC_H5REPACK_TESTFILES/h5repack_objs.h5 @@ -147,20 +148,25 @@ COPY_TESTFILES_TO_TESTDIR() done } +# Print a $* message left justified in a field of 70 characters +# +MESSAGE() { + SPACES=" " + echo "$* $SPACES" | cut -c1-70 | tr -d '\012' +} + # Print a line-line message left justified in a field of 70 characters # beginning with the word "Testing". # TESTING() { - SPACES=" " - echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012' + MESSAGE "Testing $*" } # Print a line-line message left justified in a field of 70 characters # beginning with the word "Verifying". # VERIFY() { - SPACES=" " - echo "Verifying h5diff output $* $SPACES" | cut -c1-70 | tr -d '\012' + MESSAGE "Verifying $*" } # Print a message that a test has been skipped (because a required filter @@ -174,7 +180,7 @@ SKIP() { # DIFFTEST() { - VERIFY $@ + VERIFY h5diff output $@ $RUNSERIAL $H5DIFF_BIN -q "$@" RET=$? if [ $RET != 0 ] ; then @@ -230,7 +236,7 @@ VERIFY_LAYOUT_DSET() #--------------------------------- # check the layout from a dataset - VERIFY "Layout" + VERIFY "a dataset layout" $RUNSERIAL $H5DUMP_BIN -d $dset -pH $outfile > $layoutfile $GREP $expectlayout $layoutfile > /dev/null if [ $? -eq 0 ]; then @@ -255,7 +261,7 @@ VERIFY_LAYOUT_ALL() #--------------------------------- # check the layout from a dataset # check if the other layouts still exsit - VERIFY "Layout " + VERIFY "layouts" # if CONTIGUOUS if [ $expectlayout = "CONTIGUOUS" ]; then $RUNSERIAL $H5DUMP_BIN -pH $outfile > $layoutfile @@ -355,7 +361,8 @@ TOOLTEST1() rm -f $outfile } -# Call h5repack and compare output to a text file for -v option +# This is same as TOOLTEST() with comparing display output +# from -v option # TOOLTESTV() { @@ -369,10 +376,20 @@ TOOLTESTV() outfile=$TESTDIR/out.$1 shift $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile >$actual 2>$actual_err - cp $actual $actual_sav + RET=$? + if [ $RET != 0 ] ; then + echo "*FAILED*" + nerrors="`expr $nerrors + 1`" + else + echo " PASSED" + DIFFTEST $infile $outfile + fi + + # display output compare STDOUT_FILTER $actual cat $actual_err >> $actual + VERIFY output from $H5REPACK $@ if cmp -s $expect $actual; then echo " PASSED" else @@ -382,7 +399,51 @@ TOOLTESTV() test yes = "$verbose" && diff -c $expect $actual |sed 's/^/ /' fi - rm -f $actual $actual_err $actual_sav + rm -f $actual $actual_err + rm -f $outfile +} + +# TOOLTEST_META: +# Test metadata block size option. +# Reason to create a function here is to localize all special steps related to +# metadata block size option in one place. This is a quick solution. More +# thought out solution needed when there is more time. +# +# $1: test input file +# $2:$: metadata options (either "-M size" or "--metadata_block_size=size") +# +# Algorithm: +# Run it once without the metadata option ($2-$); +# Save the result output file; +# Run it second time with the metadata option; +# Verify the output file of second run is larger than the one of 1st run. +TOOLTEST_META() +{ + input_file=$1 + outfile="$TESTDIR/out.$1" + + # Use TOOLTEST_MAIN to run because it does not remove the output file. + # 1st run, without metadata option + TOOLTEST_MAIN $1 + # get the size of the first output file + size1=`wc -c $outfile | cut -d' ' -f1` + + # 2nd run with metadata option + TOOLTEST_MAIN $* + # get the size of the second output file + size2=`wc -c $outfile | cut -d' ' -f1` + + # verify sizes. + MESSAGE "Verify the sizes of both output files ($size1 vs $size2)" + if [ $size1 -lt $size2 ]; then + # pass + echo " PASSED" + else + #fail + echo "*FAILED*" + fi + + rm -f $outfile } # This is different from $srcdir/../../bin/output_filter.sh @@ -511,7 +572,8 @@ arg="h5repack_filters.h5 -v -f /dset_deflate:GZIP=9" if test $USE_FILTER_DEFLATE != "yes" ; then SKIP $arg else - TOOLTEST $arg + # compare output + TOOLTESTV $arg fi ########################################################### @@ -730,6 +792,24 @@ VERIFY_LAYOUT_DSET h5repack_layout2.h5 contig_small COMPACT TOOLTEST_MAIN h5repack_layout2.h5 -l chunked_small_fixed:COMPA VERIFY_LAYOUT_DSET h5repack_layout2.h5 chunked_small_fixed COMPACT +#--------------------------------------------------------------------------- +# Test file contains chunked datasets (need multiple dsets) with +# unlimited max dims. (HDFFV-7933) +# Use first dset to test. +#--------------------------------------------------------------------------- +# chunk to chunk - specify chunk dim bigger than any current dim +TOOLTEST_MAIN h5repack_layout3.h5 -l chunk_unlimit1:CHUNK=100x300 +VERIFY_LAYOUT_DSET h5repack_layout3.h5 chunk_unlimit1 CHUNK + +# chunk to contiguous +TOOLTEST_MAIN h5repack_layout3.h5 -l chunk_unlimit1:CONTI +VERIFY_LAYOUT_DSET h5repack_layout3.h5 chunk_unlimit1 CONTI + +# chunk to compact - convert big dataset (should be > 64k) for this purpose, +# should remain as original layout (chunk) +TOOLTEST_MAIN h5repack_layout3.h5 -l chunk_unlimit1:COMPA +VERIFY_LAYOUT_DSET h5repack_layout3.h5 chunk_unlimit1 CHUNK + # Native option # Do not use FILE1, as the named dtype will be converted to native, and h5diff will # report a difference. @@ -801,7 +881,6 @@ TOOLTEST h5repack_refs.h5 # the references in attribute of compund or vlen datatype TOOLTEST h5repack_attr_refs.h5 - # Add test for memory leak in attirbute. This test is verified by CTEST. # 1. leak from vlen string # 2. leak from compound type without reference member @@ -809,6 +888,9 @@ TOOLTEST h5repack_attr_refs.h5 # Note: this test is experimental for sharing test file among tools TOOLTEST h5diff_attr1.h5 +# tests for metadata block size option +TOOLTEST_META h5repack_layout.h5 --metadata_block_size=8192 + if test $nerrors -eq 0 ; then echo "All $TESTNAME tests passed." exit $EXIT_SUCCESS diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c index 55cf932..957d3c8 100644 --- a/tools/h5repack/h5repack_copy.c +++ b/tools/h5repack/h5repack_copy.c @@ -42,7 +42,7 @@ int _err_num = 0; \ char _msg[80]; \ H5Ewalk2(H5E_DEFAULT, H5E_WALK_DOWNWARD, walk_error_callback, &_err_num); \ - H5Eget_msg(_err_num, NULL, _msg, 80); \ + H5Eget_msg(_err_num, NULL, _msg, (size_t)80); \ error_msg("%s %s -- %s\n", #_fun, "failed", _msg); \ goto error; \ } \ @@ -132,23 +132,23 @@ int copy_objects(const char* fnamein, goto out; } - if(!options->fs_strategy) - { - if(H5Pget_file_space(fcpl_in, &options->fs_strategy, NULL) < 0) - { - error_msg("failed to retrieve file space strategy\n"); - goto out; - } - } - - if(!options->fs_threshold) - { - if(H5Pget_file_space(fcpl_in, NULL, &options->fs_threshold) < 0) - { - error_msg("failed to retrieve file space threshold\n"); - goto out; - } - } + if(!options->fs_strategy) + { + if(H5Pget_file_space(fcpl_in, &options->fs_strategy, NULL) < 0) + { + error_msg("failed to retrieve file space strategy\n"); + goto out; + } + } + + if(!options->fs_threshold) + { + if(H5Pget_file_space(fcpl_in, NULL, &options->fs_threshold) < 0) + { + error_msg("failed to retrieve file space threshold\n"); + goto out; + } + } if(H5Pclose(fcpl_in) < 0) { @@ -254,135 +254,113 @@ int copy_objects(const char* fnamein, } /* end if */ } /* end if */ } /* end if */ - - - - #if defined (H5REPACK_DEBUG_USER_BLOCK) - print_user_block(fnamein,fidin); + print_user_block(fnamein, fidin); #endif - /*------------------------------------------------------------------------- * set the new user userblock options in the FCPL (before H5Fcreate ) *------------------------------------------------------------------------- */ - if ( options->ublock_size > 0 ) { /* either use the FCPL already created or create a new one */ - if(fcpl != H5P_DEFAULT) - { - /* set user block size */ - if(H5Pset_userblock(fcpl, options->ublock_size) < 0) - { - error_msg("failed to set userblock size\n"); - goto out; - } - - } - - else + if(fcpl == H5P_DEFAULT) { - /* create a file creation property list */ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) { error_msg("fail to create a file creation property list\n"); goto out; } - - /* set user block size */ - if(H5Pset_userblock(fcpl, options->ublock_size) < 0) - { - error_msg("failed to set userblock size\n"); - goto out; - } - } - - + /* set user block size */ + if(H5Pset_userblock(fcpl, options->ublock_size) < 0) + { + error_msg("failed to set userblock size\n"); + goto out; + } } - /*------------------------------------------------------------------------- * set alignment options *------------------------------------------------------------------------- */ - - if ( options->alignment > 0 ) { /* either use the FAPL already created or create a new one */ - if (fapl != H5P_DEFAULT) + if (fapl == H5P_DEFAULT) { - - if (H5Pset_alignment(fapl, options->threshold, options->alignment) < 0) + /* create a file access property list */ + if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) { - error_msg("failed to set alignment\n"); + error_msg("Could not create file access property list\n"); goto out; } - } - else + if (H5Pset_alignment(fapl, options->threshold, options->alignment) < 0) { + error_msg("failed to set alignment\n"); + goto out; + } + } + /*------------------------------------------------------------------------- + * set metadata block size option + *------------------------------------------------------------------------- + */ + if ( options->meta_block_size > 0 ) + { + /* either use the FAPL already created or create a new one */ + if (fapl == H5P_DEFAULT) + { /* create a file access property list */ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) { error_msg("Could not create file access property list\n"); goto out; } - - if (H5Pset_alignment(fapl, options->threshold, options->alignment) < 0) - { - error_msg("failed to set alignment\n"); - goto out; - } - } + if (H5Pset_meta_block_size(fapl, options->meta_block_size) < 0) + { + error_msg("failed to set metadata block size\n"); + goto out; + } } + /*------------------------------------------------------------------------- + * set free-space strategy options + *------------------------------------------------------------------------- + */ + /* either use the FCPL already created or create a new one */ - if(fcpl != H5P_DEFAULT) + if(fcpl == H5P_DEFAULT) { - /* set file space strategy and free space threshold */ - if(H5Pset_file_space(fcpl, options->fs_strategy, options->fs_threshold) < 0) - { - error_msg("failed to set file space strategy & threshold\n"); - goto out; - } + /* create a file creation property list */ + if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) + { + error_msg("fail to create a file creation property list\n"); + goto out; + } } - else + + /* set file space strategy and free space threshold */ + if(H5Pset_file_space(fcpl, options->fs_strategy, options->fs_threshold) < 0) { - /* create a file creation property list */ - if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) - { - error_msg("fail to create a file creation property list\n"); - goto out; - } - - /* set file space strategy and free space threshold */ - if(H5Pset_file_space(fcpl, options->fs_strategy, options->fs_threshold) < 0) - { - error_msg("failed to set file space strategy & threshold \n"); - goto out; - } + error_msg("failed to set file space strategy & threshold \n"); + goto out; } /*------------------------------------------------------------------------- * create the output file *------------------------------------------------------------------------- */ - - if(options->verbose) printf("Making file <%s>...\n",fnameout); - if((fidout = H5Fcreate(fnameout,H5F_ACC_TRUNC, fcpl, fapl)) < 0) { error_msg("<%s>: Could not create file\n", fnameout ); @@ -800,6 +778,8 @@ int do_copy_objects(hid_t fidin, unsigned u; int is_ref=0; htri_t is_named; + hbool_t limit_maxdims; + hsize_t size_dset; /*------------------------------------------------------------------------- @@ -816,8 +796,10 @@ int do_copy_objects(hid_t fidin, for ( i = 0; i < travt->nobjs; i++) { - + /* init variables per obj */ buf = NULL; + limit_maxdims = FALSE; + switch ( travt->objs[i].type ) { @@ -992,6 +974,9 @@ int do_copy_objects(hid_t fidin, if((msize = H5Tget_size(wtype_id)) == 0) goto error; + /* size of current dset */ + size_dset = nelmts * msize; + /*------------------------------------------------------------------------- * check if the dataset creation property list has filters that * are not registered in the current configuration @@ -1021,7 +1006,7 @@ int do_copy_objects(hid_t fidin, */ if (options->layout_g != H5D_COMPACT) { - if ( nelmts*msize < options->min_comp ) + if ( size_dset < options->min_comp ) apply_s=0; } @@ -1038,9 +1023,38 @@ int do_copy_objects(hid_t fidin, goto error; } - /* unset the unlimimted dimensions, which cannot be applied to layout other than chunked. */ - if (options->layout_g != H5D_CHUNKED) { - H5Sset_extent_simple( f_space_id, rank, dims, NULL ); + /*------------------------------------------------- + * Unset the unlimited max dims if convert to other + * than chunk layouts, because unlimited max dims + * only can be applied to chunk layout. + * Also perform only for targeted dataset + * Also check for size limit to convert to compact + *-------------------------------------------------*/ + if (options->layout_g != H5D_CHUNKED) + { + /* any dataset is specified */ + if (options->op_tbl->nelems > 0) + { + /* if current obj match specified obj */ + if (options_get_object (travt->objs[i].name, options->op_tbl)) + limit_maxdims = TRUE; + } + else /* no dataset is specified */ + { + limit_maxdims = TRUE; + } + + /* if convert to COMPACT */ + if (options->layout_g == H5D_COMPACT) + { + /* should be smaller than 64K */ + if ( size_dset > MAX_COMPACT_DSIZE ) + limit_maxdims = FALSE; + } + + /* unset unlimited max dims */ + if (limit_maxdims) + H5Sset_extent_simple( f_space_id, rank, dims, NULL ); } /*------------------------------------------------------------------------- diff --git a/tools/h5repack/h5repack_main.c b/tools/h5repack/h5repack_main.c index e1697ab..f61c961 100644 --- a/tools/h5repack/h5repack_main.c +++ b/tools/h5repack/h5repack_main.c @@ -35,7 +35,7 @@ const char *outfile = NULL; * Command-line options: The user can specify short or long-named * parameters. */ -static const char *s_opts = "hVvf:l:m:e:nLc:d:s:u:b:t:a:i:o:S:T:"; +static const char *s_opts = "hVvf:l:m:e:nLc:d:s:u:b:M:t:a:i:o:S:T:"; static struct long_options l_opts[] = { { "help", no_arg, 'h' }, { "version", no_arg, 'V' }, @@ -51,6 +51,7 @@ static struct long_options l_opts[] = { { "ssize", require_arg, 's' }, { "ublock", require_arg, 'u' }, { "block", require_arg, 'b' }, + { "metadata_block_size", require_arg, 'M' }, { "threshold", require_arg, 't' }, { "alignment", require_arg, 'a' }, { "infile", require_arg, 'i' }, /* -i for backward compability */ @@ -78,24 +79,6 @@ static struct long_options l_opts[] = { * * Comments: * - * Modifications: - * July 2004: Introduced the extra EC or NN option for SZIP - * October 2006: Added a new switch -n, that allows to write the dataset - * using a native type. The default to write is the file type. - * - * Modification: - * Peter Cao, June 13, 2007 - * Add "-L, --latest" option to pack a file with the latest file format - * PVN, November 19, 2007 - * adopted the syntax h5repack [OPTIONS] file1 file2 - * PVN, November 28, 2007 - * added support for multiple global filters - * PVN, May 16, 2008 - * added backward compatibility for -i infile -o outfile - * PVN, August 20, 2008 - * add a user block to repacked file (switches -u -b) - * PVN, August 28, 2008 - * add options to set alignment (H5Pset_alignment) (switches -t -a) *------------------------------------------------------------------------- */ int main(int argc, const char **argv) @@ -115,7 +98,7 @@ int main(int argc, const char **argv) HDexit(EXIT_FAILURE); /* initialize options */ - h5repack_init(&options, 0, 0, (hsize_t)0); + h5repack_init(&options, 0, H5F_FILE_SPACE_DEFAULT, (hsize_t)0); parse_command_line(argc, argv, &options); @@ -187,6 +170,7 @@ static void usage(const char *prog) printf(" -e E, --file=E Name of file E with the -f and -l options\n"); printf(" -u U, --ublock=U Name of file U with user block data to be added\n"); printf(" -b B, --block=B Size of user block to be added\n"); + printf(" -M A, --metadata_block_size=A Metadata block size for H5Pset_meta_block_size\n"); printf(" -t T, --threshold=T Threshold value for H5Pset_alignment\n"); printf(" -a A, --alignment=A Alignment value for H5Pset_alignment\n"); printf(" -f FILT, --filter=FILT Filter type\n"); @@ -428,7 +412,6 @@ void parse_command_line(int argc, const char **argv, pack_opt_t* options) break; - case 'u': options->ublock_filename = opt_arg; @@ -439,6 +422,11 @@ void parse_command_line(int argc, const char **argv, pack_opt_t* options) options->ublock_size = (hsize_t)HDatol( opt_arg ); break; + case 'M': + + options->meta_block_size = (hsize_t)HDatol( opt_arg ); + break; + case 't': options->threshold = (hsize_t)HDatol( opt_arg ); @@ -455,7 +443,7 @@ void parse_command_line(int argc, const char **argv, pack_opt_t* options) break; case 'S': - { + { char strategy[MAX_NC_NAME]; HDstrcpy(strategy, opt_arg); @@ -472,12 +460,14 @@ void parse_command_line(int argc, const char **argv, pack_opt_t* options) HDexit(EXIT_FAILURE); } break; - } + } case 'T': options->fs_threshold = (hsize_t)HDatol( opt_arg ); break; + default: + break; } /* switch */ diff --git a/tools/h5repack/h5repack_opttable.c b/tools/h5repack/h5repack_opttable.c index d0fcff3..4ec7fcf 100644 --- a/tools/h5repack/h5repack_opttable.c +++ b/tools/h5repack/h5repack_opttable.c @@ -388,11 +388,22 @@ pack_info_t* options_get_object( const char *path, pack_opttbl_t *table ) { unsigned int i; + const char tbl_path[MAX_NC_NAME]; + for ( i = 0; i < table->nelems; i++) { + /* make full path (start with "/") to compare correctly */ + if (HDstrncmp(table->objs[i].path, "/", 1)) + { + HDstrcpy(tbl_path, "/"); + HDstrcat(tbl_path, table->objs[i].path); + } + else + HDstrcpy(tbl_path, table->objs[i].path); + /* found it */ - if (HDstrcmp(table->objs[i].path,path)==0) + if (HDstrcmp(tbl_path, path)==0) { return (&table->objs[i]); } diff --git a/tools/h5repack/h5repacktst.c b/tools/h5repack/h5repacktst.c index 17a6190..4f1707b 100644 --- a/tools/h5repack/h5repacktst.c +++ b/tools/h5repack/h5repacktst.c @@ -78,7 +78,6 @@ #define FNAME17OUT "h5repack_named_dtypes_out.h5" #define FNAME18 "h5repack_layout2.h5" -#define FNAME18OUT "h5repack_layout2_out.h5" #define FNAME_UB "ublock.bin" @@ -125,6 +124,7 @@ static int make_hlinks(hid_t loc_id); static int make_early(void); static int make_layout(hid_t loc_id); static int make_layout2(hid_t loc_id); +static int make_layout3(hid_t loc_id); #ifdef H5_HAVE_FILTER_SZIP static int make_szip(hid_t loc_id); #endif /* H5_HAVE_FILTER_SZIP */ @@ -172,6 +172,8 @@ int main (void) diff_opt_t diff_options; hsize_t fs_size = 0; /* free space section threshold */ H5F_file_space_type_t fs_type = H5F_FILE_SPACE_DEFAULT; /* file space handling strategy */ + h5_stat_t file_stat; + h5_stat_size_t fsize1, fsize2; /* file sizes */ #if defined (H5_HAVE_FILTER_SZIP) int szip_can_encode = 0; #endif @@ -1561,6 +1563,50 @@ int main (void) PASSED(); /*------------------------------------------------------------------------- + * test --metadata_block_size option + * Also verify that output file using the metadata_block_size option is + * larger than the output file one not using it. + * FNAME4 is used because it is the same as the test file used for the + * shell script version of this test (h5repack.sh). + *------------------------------------------------------------------------- + */ + TESTING(" metadata block size option"); + /* First run without metadata option. No need to verify the correctness */ + /* since this has been verified by earlier tests. Just record the file */ + /* size of the output file. */ + if(h5repack_init(&pack_options, 0, H5F_FILE_SPACE_DEFAULT, (hsize_t)0) < 0) + GOERROR; + if(h5repack(FNAME4, FNAME4OUT, &pack_options) < 0) + GOERROR; + if(HDstat(FNAME4OUT, &file_stat) < 0) + GOERROR; + fsize1 = file_stat.st_size; + if(h5repack_end(&pack_options) < 0) + GOERROR; + + /* run it again with metadata option */ + if(h5repack_init(&pack_options, 0, H5F_FILE_SPACE_DEFAULT, (hsize_t)0) < 0) + GOERROR; + pack_options.meta_block_size = 8192; + if(h5repack(FNAME4, FNAME4OUT, &pack_options) < 0) + GOERROR; + if(h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0) + GOERROR; + if(h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0) + GOERROR; + /* record the file size of the output file */ + if(HDstat(FNAME4OUT, &file_stat) < 0) + GOERROR; + fsize2 = file_stat.st_size; + /* verify second file size is larger than the first one */ + if(fsize2 <= fsize1) + GOERROR; + if(h5repack_end(&pack_options) < 0) + GOERROR; + PASSED(); + + + /*------------------------------------------------------------------------- * clean temporary test files *------------------------------------------------------------------------- */ @@ -1667,6 +1713,19 @@ int make_testfiles(void) return -1; /*------------------------------------------------------------------------- + * for test layout conversions form chunk with unlimited max dims + *------------------------------------------------------------------------- + */ + if((fid = H5Fcreate("h5repack_layout3.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + return -1; + + if(make_layout3(fid) < 0) + goto out; + + if(H5Fclose(fid) < 0) + return -1; + + /*------------------------------------------------------------------------- * create a file for the H5D_ALLOC_TIME_EARLY test *------------------------------------------------------------------------- */ @@ -3030,6 +3089,94 @@ out: } /* make_layout2() */ /*------------------------------------------------------------------------- +* Function: make_layout3 +* +* Purpose: make chunked datasets with unlimited max dim and chunk dim is +* bigger than current dim. (HDFFV-7933) +* Test for converting chunk to chunk , chunk to conti and chunk +* to compact. +* - The chunk to chunk changes layout bigger than any current dim +* again. +* - The chunk to compact test dataset bigger than 64K, should +* remain original layout.* +* +*------------------------------------------------------------------------- +*/ +#define DIM1_L3 300 +#define DIM2_L3 200 +static +int make_layout3(hid_t loc_id) +{ + hid_t dcpl=-1; /* dataset creation property list */ + hid_t sid=-1; /* dataspace ID */ + hsize_t dims[RANK]={DIM1_L3,DIM2_L3}; + hsize_t maxdims[RANK]={H5S_UNLIMITED, H5S_UNLIMITED}; + hsize_t chunk_dims[RANK]={DIM1_L3*2,5}; + int buf[DIM1_L3][DIM2_L3]; + int i, j, n; + + for (i=n=0; i<DIM1_L3; i++) + { + for (j=0; j<DIM2_L3; j++) + { + buf[i][j]=n++; + } + } + + /*------------------------------------------------------------------------- + * make several dataset with several layout options + *------------------------------------------------------------------------- + */ + /* create a space */ + if((sid = H5Screate_simple(RANK, dims, maxdims)) < 0) + return -1; + /* create a dataset creation property list; the same DCPL is used for all dsets */ + if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + { + goto out; + } + + + /*------------------------------------------------------------------------- + * H5D_CHUNKED + *------------------------------------------------------------------------- + */ + if(H5Pset_chunk(dcpl, RANK, chunk_dims) < 0) + goto out; + if (make_dset(loc_id,"chunk_unlimit1",sid,dcpl,buf) < 0) + { + goto out; + } + + if(H5Pset_chunk(dcpl, RANK, chunk_dims) < 0) + goto out; + + if (make_dset(loc_id,"chunk_unlimit2",sid,dcpl,buf) < 0) + { + goto out; + } + + /*------------------------------------------------------------------------- + * close space and dcpl + *------------------------------------------------------------------------- + */ + if(H5Sclose(sid) < 0) + goto out; + if(H5Pclose(dcpl) < 0) + goto out; + + return 0; + +out: + H5E_BEGIN_TRY + { + H5Pclose(dcpl); + H5Sclose(sid); + } H5E_END_TRY; + return -1; +} + +/*------------------------------------------------------------------------- * Function: make a file with an integer dataset with a fill value * * Purpose: test copy of fill values @@ -3253,7 +3400,7 @@ make_userblock(void) /* Initialize userblock data */ for(u = 0; u < USERBLOCK_SIZE; u++) - ub[u] = 'a' + (u % 26); + ub[u] = 'a' + (char)(u % 26); /* Re-open HDF5 file, as "plain" file */ if((fd = HDopen(FNAME16, O_WRONLY, 0644)) < 0) @@ -3366,7 +3513,7 @@ make_userblock_file(void) /* initialize userblock data */ for(u = 0; u < USERBLOCK_SIZE; u++) - ub[u] = 'a' + (u % 26); + ub[u] = 'a' + (char)(u % 26); /* open file */ if((fd = HDopen(FNAME_UB,O_WRONLY|O_CREAT|O_TRUNC, 0644 )) < 0) @@ -3400,7 +3547,6 @@ out: * *------------------------------------------------------------------------- */ - static int write_dset_in(hid_t loc_id, const char* dset_name, /* for saving reference to dataset*/ @@ -3664,17 +3810,23 @@ int write_dset_in(hid_t loc_id, { + hsize_t TEST_BUFSIZE = (128 * 1024 * 1024); /* 128MB */ double *dbuf; /* information to write */ size_t size; hsize_t sdims[] = {1}; - hsize_t tdims[] = {H5TOOLS_MALLOCSIZE / sizeof(double) + 1}; + hsize_t tdims[] = {TEST_BUFSIZE / sizeof(double) + 1}; unsigned u; /* allocate and initialize array data to write */ - size = ( H5TOOLS_MALLOCSIZE / sizeof(double) + 1 ) * sizeof(double); + size = ( TEST_BUFSIZE / sizeof(double) + 1 ) * sizeof(double); dbuf = (double*)malloc( size ); + if (NULL == dbuf) + { + printf ("\nError: Cannot allocate memory for \"arrayd\" data buffer size %dMB.\n", (int) size / 1000000 ); + goto out; + } - for( u = 0; u < H5TOOLS_MALLOCSIZE / sizeof(double) + 1; u++) + for( u = 0; u < TEST_BUFSIZE / sizeof(double) + 1; u++) dbuf[u] = u; if (make_diffs) @@ -3683,7 +3835,7 @@ int write_dset_in(hid_t loc_id, dbuf[6] = 0; } - /* create a type larger than H5TOOLS_MALLOCSIZE */ + /* create a type larger than TEST_BUFSIZE */ if ((tid = H5Tarray_create2(H5T_NATIVE_DOUBLE, 1, tdims)) < 0) goto out; size = H5Tget_size(tid); @@ -3842,7 +3994,7 @@ int write_dset_in(hid_t loc_id, int l; buf52[i][j].p = malloc((i + 1) * sizeof(int)); - buf52[i][j].len = i + 1; + buf52[i][j].len = (size_t)(i + 1); for(l = 0; l < i + 1; l++) { if(make_diffs) @@ -4063,7 +4215,7 @@ int write_dset_in(hid_t loc_id, int l; buf53[i][j][k].p = malloc((i + 1) * sizeof(int)); - buf53[i][j][k].len = i + 1; + buf53[i][j][k].len = (size_t)(i + 1); for(l = 0; l < i + 1; l++) { if(make_diffs) @@ -4854,7 +5006,7 @@ int write_attr_in(hid_t loc_id, { int l; buf52[i][j].p = malloc((i + 1) * sizeof(int)); - buf52[i][j].len = i + 1; + buf52[i][j].len = (size_t)(i + 1); for (l = 0; l < i + 1; l++) if (make_diffs)((int *)buf52[i][j].p)[l] = 0; else ((int *)buf52[i][j].p)[l] = n++; @@ -5320,7 +5472,7 @@ int write_attr_in(hid_t loc_id, { int l; buf53[i][j][k].p = malloc((i + 1) * sizeof(int)); - buf53[i][j][k].len = i + 1; + buf53[i][j][k].len = (size_t)i + 1; for (l = 0; l < i + 1; l++) if (make_diffs) { @@ -5819,7 +5971,7 @@ static herr_t add_attr_with_regref(hid_t file_id, hid_t obj_id) } /* select elements space for reference */ - status = H5Sselect_elements (sid_regrefed_dset, H5S_SELECT_SET, 3, coords_regrefed_dset[0]); + status = H5Sselect_elements (sid_regrefed_dset, H5S_SELECT_SET, (size_t)3, coords_regrefed_dset[0]); if (status < 0) { fprintf(stderr, "Error: %s %d> H5Sselect_elements failed.\n", FUNC, __LINE__); @@ -6141,7 +6293,7 @@ static herr_t gen_region_ref(hid_t loc_id) } /* select elements space for reference */ - status = H5Sselect_elements (sid_trg, H5S_SELECT_SET, 4, coords[0]); + status = H5Sselect_elements (sid_trg, H5S_SELECT_SET, (size_t)4, coords[0]); if (status < 0) { fprintf(stderr, "Error: %s %d> H5Sselect_elements failed.\n", FUNC, __LINE__); @@ -6508,7 +6660,7 @@ static herr_t make_complex_attr_references(hid_t loc_id) /* * create the region reference */ - status = H5Sselect_elements (objsid, H5S_SELECT_SET, 4, coords[0]); + status = H5Sselect_elements (objsid, H5S_SELECT_SET, (size_t)4, coords[0]); if (status < 0) { fprintf(stderr, "Error: %s %d> H5Sselect_elements failed.\n", FUNC, __LINE__); @@ -6619,7 +6771,7 @@ static herr_t make_complex_attr_references(hid_t loc_id) /* * create region reference */ - status = H5Sselect_elements(objsid, H5S_SELECT_SET, 4, coords[0]); + status = H5Sselect_elements(objsid, H5S_SELECT_SET, (size_t)4, coords[0]); if (status < 0) { fprintf(stderr, "Error: %s %d> H5Sselect_elements failed.\n", FUNC, __LINE__); diff --git a/tools/h5repack/testfiles/h5repack_layout3.h5 b/tools/h5repack/testfiles/h5repack_layout3.h5 Binary files differnew file mode 100644 index 0000000..5319031 --- /dev/null +++ b/tools/h5repack/testfiles/h5repack_layout3.h5 diff --git a/tools/h5stat/CMakeLists.txt b/tools/h5stat/CMakeLists.txt index 8c621c9..e8d75e3 100644 --- a/tools/h5stat/CMakeLists.txt +++ b/tools/h5stat/CMakeLists.txt @@ -41,6 +41,7 @@ IF (BUILD_TESTING) SET (HDF5_REFERENCE_FILES h5stat_help1.ddl h5stat_help2.ddl + h5stat_notexist.ddl h5stat_filters.ddl h5stat_filters-file.ddl h5stat_filters-F.ddl @@ -92,6 +93,9 @@ IF (BUILD_TESTING) # If using memchecker add tests without using scripts IF (HDF5_ENABLE_USING_MEMCHECKER) ADD_TEST (NAME H5STAT-${resultfile} COMMAND $<TARGET_FILE:h5stat> ${ARGN}) + IF (NOT ${resultcode} STREQUAL "0") + SET_TESTS_PROPERTIES (H5STAT-${resultfile} PROPERTIES WILL_FAIL "true") + ENDIF (NOT ${resultcode} STREQUAL "0") IF (NOT "${last_test}" STREQUAL "") SET_TESTS_PROPERTIES (H5STAT-${resultfile} PROPERTIES DEPENDS ${last_test}) ENDIF (NOT "${last_test}" STREQUAL "") @@ -133,6 +137,8 @@ IF (BUILD_TESTING) h5stat_help1.out.err h5stat_help2.out h5stat_help2.out.err + h5stat_notexist.out + h5stat_notexist.out.err h5stat_filters.out h5stat_filters.out.err h5stat_filters-file.out @@ -168,6 +174,9 @@ IF (BUILD_TESTING) ADD_H5_TEST (h5stat_help1 0 -h) ADD_H5_TEST (h5stat_help2 0 --help) +# Test when h5stat a file that does not exist + ADD_H5_TEST (h5stat_notexist 1 notexist.h5) + # Test file with groups, compressed datasets, user-applied fileters, etc. # h5stat_filters.h5 is a copy of ../../testfiles/tfilters.h5 as of release 1.8.0-alpha4 ADD_H5_TEST (h5stat_filters 0 h5stat_filters.h5) @@ -196,11 +205,14 @@ ENDIF (BUILD_TESTING) #-----------------------------------------------------------------------------
# Rules for Installation of tools using make Install target
#-----------------------------------------------------------------------------
+ +INSTALL_PROGRAM_PDB (h5stat ${HDF5_INSTALL_BIN_DIR} toolsapplications) + INSTALL ( TARGETS h5stat RUNTIME DESTINATION - ${HDF5_INSTALL_BIN_DIR}/tools + ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications ) diff --git a/tools/h5stat/h5stat.c b/tools/h5stat/h5stat.c index e206f4f..a68760d 100644 --- a/tools/h5stat/h5stat.c +++ b/tools/h5stat/h5stat.c @@ -99,17 +99,17 @@ typedef struct iter_t { hsize_t attrs_heap_storage_size; /* fractal heap size for attributes (1.8) */ hsize_t SM_hdr_storage_size; /* header size for SOHM table (1.8) */ hsize_t SM_index_storage_size; /* index (btree & list) size for SOHM table (1.8) */ - hsize_t SM_heap_storage_size; /* fractal heap size for SOHM table (1.8) */ - hsize_t super_size; /* superblock size */ - hsize_t super_ext_size; /* superblock extension size */ - hsize_t ublk_size; /* user block size (if exists) */ - H5F_file_space_type_t fs_strategy; /* File space management strategy */ - hsize_t fs_threshold; /* Free-space section threshold */ - hsize_t free_space; /* amount of freespace in the file */ - hsize_t free_hdr; /* size of free space manager metadata in the file */ + hsize_t SM_heap_storage_size; /* fractal heap size for SOHM table (1.8) */ + hsize_t super_size; /* superblock size */ + hsize_t super_ext_size; /* superblock extension size */ + hsize_t ublk_size; /* user block size (if exists) */ + H5F_file_space_type_t fs_strategy; /* File space management strategy */ + hsize_t fs_threshold; /* Free-space section threshold */ + hsize_t free_space; /* amount of freespace in the file */ + hsize_t free_hdr; /* size of free space manager metadata in the file */ unsigned long num_small_sects[SIZE_SMALL_SECTS]; /* Size of small free-space sections */ - unsigned sect_nbins; /* Number of bins for free-space section sizes */ - unsigned long *sect_bins; /* Pointer to array of bins for free-space section sizes */ + unsigned sect_nbins; /* Number of bins for free-space section sizes */ + unsigned long *sect_bins; /* Pointer to array of bins for free-space section sizes */ hsize_t datasets_index_storage_size;/* meta size for chunked dataset's indexing type */ hsize_t datasets_heap_storage_size; /* heap size for dataset with external storage */ unsigned long nexternal; /* Number of external files for a dataset */ @@ -120,11 +120,11 @@ typedef struct iter_t { static int display_all = TRUE; /* Enable the printing of selected statistics */ -static int display_file = FALSE; /* display file information */ -static int display_group = FALSE; /* display groups information */ -static int display_dset = FALSE; /* display datasets information */ +static int display_file = FALSE; /* display file information */ +static int display_group = FALSE; /* display groups information */ +static int display_dset = FALSE; /* display datasets information */ static int display_dset_dtype_meta = FALSE; /* display datasets' datatype information */ -static int display_attr = FALSE; /* display attributes information */ +static int display_attr = FALSE; /* display attributes information */ static int display_free_sections = FALSE; /* display free space information */ static int display_summary = FALSE; /* display summary of file space information */ @@ -283,7 +283,7 @@ ceil_log10(unsigned long x) } /* end while */ return(ret); -} +} /* ceil_log10() */ /*------------------------------------------------------------------------- @@ -481,7 +481,7 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi) /* Object header's total size for H5D_COMPACT layout includes raw data size */ /* "storage" also includes H5D_COMPACT raw data size */ if(lout == H5D_COMPACT) - iter->dset_ohdr_info.total_size -= storage; + iter->dset_ohdr_info.total_size -= storage; /* Track the layout type for dataset */ (iter->dset_layouts[lout])++; @@ -495,7 +495,7 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi) iter->nexternal += (unsigned long)num_ext; iter->dset_external_storage_size += (unsigned long)storage; } else - iter->dset_storage_size += storage; + iter->dset_storage_size += storage; /* Gather dataspace statistics */ sid = H5Dget_space(did); @@ -602,6 +602,7 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi) return 0; } /* end dataset_stats() */ + /*------------------------------------------------------------------------- * Function: datatype_stats * @@ -791,11 +792,6 @@ freespace_stats(hid_t fid, iter_t *iter) * Programmer: Elena Pourmal * Saturday, August 12, 2006 * - * Modifications: - * Vailin Choi; October 2009 - * Turn on display_group_metadata, display_dset_metadata - * Add 'S' & 's' for printing free space info (previous checkin) - * *------------------------------------------------------------------------- */ static struct handler_t * @@ -812,103 +808,103 @@ parse_command_line(int argc, const char *argv[]) /* parse command line options */ while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) { - switch ((char) opt) { - case 'h': - usage(h5tools_getprogname()); - h5tools_setstatus(EXIT_SUCCESS); - if (hand) { - for (i = 0; i < argc; i++) - if(hand[i].obj) { - free(hand[i].obj); - hand[i].obj=NULL; - } - - free(hand); - hand = NULL; - } - goto done; - break; + switch ((char)opt) { + case 'h': + usage(h5tools_getprogname()); + h5tools_setstatus(EXIT_SUCCESS); + if (hand) { + for (i = 0; i < argc; i++) + if(hand[i].obj) { + free(hand[i].obj); + hand[i].obj=NULL; + } + + free(hand); + hand = NULL; + } + goto done; + break; - case 'V': - print_version(h5tools_getprogname()); - h5tools_setstatus(EXIT_SUCCESS); - if (hand) { - for (i = 0; i < argc; i++) - if(hand[i].obj) { - free(hand[i].obj); - hand[i].obj=NULL; - } - - free(hand); - hand = NULL; - } - goto done; - break; + case 'V': + print_version(h5tools_getprogname()); + h5tools_setstatus(EXIT_SUCCESS); + if (hand) { + for (i = 0; i < argc; i++) + if(hand[i].obj) { + free(hand[i].obj); + hand[i].obj=NULL; + } + + free(hand); + hand = NULL; + } + goto done; + break; - case 'F': - display_all = FALSE; - display_file_metadata = TRUE; - break; + case 'F': + display_all = FALSE; + display_file_metadata = TRUE; + break; - case 'f': - display_all = FALSE; - display_file = TRUE; - break; + case 'f': + display_all = FALSE; + display_file = TRUE; + break; - case 'G': - display_all = FALSE; - display_group_metadata = TRUE; - break; + case 'G': + display_all = FALSE; + display_group_metadata = TRUE; + break; - case 'g': - display_all = FALSE; - display_group = TRUE; - break; + case 'g': + display_all = FALSE; + display_group = TRUE; + break; - case 'D': - display_all = FALSE; - display_dset_metadata = TRUE; - break; + case 'D': + display_all = FALSE; + display_dset_metadata = TRUE; + break; - case 'd': - display_all = FALSE; - display_dset = TRUE; - break; + case 'd': + display_all = FALSE; + display_dset = TRUE; + break; - case 'T': - display_all = FALSE; - display_dset_dtype_meta = TRUE; - break; + case 'T': + display_all = FALSE; + display_dset_dtype_meta = TRUE; + break; - case 'A': - display_all = FALSE; - display_attr = TRUE; - break; + case 'A': + display_all = FALSE; + display_attr = TRUE; + break; - case 's': - display_all = FALSE; - display_free_sections = TRUE; - break; + case 's': + display_all = FALSE; + display_free_sections = TRUE; + break; - case 'S': - display_all = FALSE; - display_summary = TRUE; - break; + case 'S': + display_all = FALSE; + display_summary = TRUE; + break; - case 'O': - display_all = FALSE; - display_object = TRUE; - for (i = 0; i < argc; i++) - if (!hand[i].obj) { - hand[i].obj = HDstrdup(opt_arg); - break; - } /* end if */ - break; + case 'O': + display_all = FALSE; + display_object = TRUE; + for(i = 0; i < argc; i++) + if(!hand[i].obj) { + hand[i].obj = HDstrdup(opt_arg); + break; + } /* end if */ + break; - default: - usage(h5tools_getprogname()); - h5tools_setstatus(EXIT_FAILURE); - goto error; + default: + usage(h5tools_getprogname()); + h5tools_setstatus(EXIT_FAILURE); + goto error; } /* end switch */ } /* end while */ @@ -941,36 +937,9 @@ error: /*------------------------------------------------------------------------- - * Function: init_iter - * - * Purpose: Initialize iter structure - * - * Return: Success: 0 - * - * Failure: Never fails - * - * Programmer: Elena Pourmal - * Saturday, August 12, 2006 - * - *------------------------------------------------------------------------- - */ -static herr_t -iter_init(iter_t *iter, hid_t fid) -{ - /* Clear everything to zeros */ - HDmemset(iter, 0, sizeof(*iter)); - - /* Set the file ID for later use in callbacks */ - iter->fid = fid; - - return 0; -} - - -/*------------------------------------------------------------------------- - * Function: free_iter + * Function: iter_free * - * Purpose: Freee iter structure + * Purpose: Free iter structure * * Return: Success: 0 * @@ -1174,7 +1143,7 @@ print_group_metadata(const iter_t *iter) printf("File space information for groups' metadata (in bytes):\n"); HDfprintf(stdout, "\tObject headers (total/unused): %Hu/%Hu\n", - iter->group_ohdr_info.total_size, iter->group_ohdr_info.free_size); + iter->group_ohdr_info.total_size, iter->group_ohdr_info.free_size); HDfprintf(stdout, "\tB-tree/List: %Hu\n", iter->groups_btree_storage_size); HDfprintf(stdout, "\tHeap: %Hu\n", iter->groups_heap_storage_size); @@ -1195,8 +1164,6 @@ print_group_metadata(const iter_t *iter) * Programmer: Elena Pourmal * Saturday, August 12, 2006 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -1292,10 +1259,10 @@ print_dset_metadata(const iter_t *iter) printf("File space information for datasets' metadata (in bytes):\n"); HDfprintf(stdout, "\tObject headers (total/unused): %Hu/%Hu\n", - iter->dset_ohdr_info.total_size, iter->dset_ohdr_info.free_size); + iter->dset_ohdr_info.total_size, iter->dset_ohdr_info.free_size); HDfprintf(stdout, "\tIndex for Chunked datasets: %Hu\n", - iter->datasets_index_storage_size); + iter->datasets_index_storage_size); HDfprintf(stdout, "\tHeap: %Hu\n", iter->datasets_heap_storage_size); return 0; @@ -1311,11 +1278,7 @@ print_dset_metadata(const iter_t *iter) * * Failure: Never fails * - * Programmer: - * - * Modifications: - * Vailin Choi; October 2009 - * Moved from print_dataset_info() + * Programmer: Vailin Choi; October 2009 * *------------------------------------------------------------------------- */ @@ -1327,21 +1290,21 @@ print_dset_dtype_meta(const iter_t *iter) unsigned u; /* Local index variable */ if(iter->dset_ntypes) { - printf("Dataset datatype information:\n"); - printf("\t# of unique datatypes used by datasets: %lu\n", iter->dset_ntypes); - total = 0; - for(u = 0; u < iter->dset_ntypes; u++) { - H5Tencode(iter->dset_type_info[u].tid, NULL, &dtype_size); - printf("\tDataset datatype #%u:\n", u); - printf("\t\tCount (total/named) = (%lu/%lu)\n", - iter->dset_type_info[u].count, iter->dset_type_info[u].named); - printf("\t\tSize (desc./elmt) = (%lu/%lu)\n", (unsigned long)dtype_size, - (unsigned long)H5Tget_size(iter->dset_type_info[u].tid)); - H5Tclose(iter->dset_type_info[u].tid); - total += iter->dset_type_info[u].count; - } /* end for */ - printf("\tTotal dataset datatype count: %lu\n", total); - } + printf("Dataset datatype information:\n"); + printf("\t# of unique datatypes used by datasets: %lu\n", iter->dset_ntypes); + total = 0; + for(u = 0; u < iter->dset_ntypes; u++) { + H5Tencode(iter->dset_type_info[u].tid, NULL, &dtype_size); + printf("\tDataset datatype #%u:\n", u); + printf("\t\tCount (total/named) = (%lu/%lu)\n", + iter->dset_type_info[u].count, iter->dset_type_info[u].named); + printf("\t\tSize (desc./elmt) = (%lu/%lu)\n", (unsigned long)dtype_size, + (unsigned long)H5Tget_size(iter->dset_type_info[u].tid)); + H5Tclose(iter->dset_type_info[u].tid); + total += iter->dset_type_info[u].count; + } /* end for */ + printf("\tTotal dataset datatype count: %lu\n", total); + } /* end if */ return 0; } /* print_dset_dtype_meta() */ @@ -1446,7 +1409,7 @@ print_freespace_info(const iter_t *iter) return 0; } /* print_freespace_info() */ - + /*------------------------------------------------------------------------- * Function: print_storage_summary * @@ -1492,7 +1455,7 @@ print_storage_summary(const iter_t *iter) HDfprintf(stdout, " Amount/Percent of tracked free space: %Hu bytes/%3.1f%\n", iter->free_space, percent); - if(iter->filesize < (total_meta+iter->dset_storage_size+iter->free_space)) { + if(iter->filesize < (total_meta + iter->dset_storage_size + iter->free_space)) { unaccount = (total_meta + iter->dset_storage_size + iter->free_space) - iter->filesize; HDfprintf(stdout, " ??? File has %Hu more bytes accounted for than its size! ???\n", unaccount); } @@ -1501,12 +1464,11 @@ print_storage_summary(const iter_t *iter) HDfprintf(stdout, " Unaccounted space: %Hu bytes\n", unaccount); } - HDfprintf(stdout, "Total space: %Hu bytes\n", total_meta+iter->dset_storage_size+iter->free_space+unaccount); + HDfprintf(stdout, "Total space: %Hu bytes\n", total_meta + iter->dset_storage_size + iter->free_space + unaccount); if(iter->nexternal) HDfprintf(stdout, "External raw data: %Hu bytes\n", iter->dset_external_storage_size); - return 0; } /* print_storage_summary() */ @@ -1523,11 +1485,6 @@ print_storage_summary(const iter_t *iter) * Programmer: Elena Pourmal * Saturday, August 12, 2006 * - * Modifications: - * Vailin Choi; October 2009 - * Activate "display_group_metadata", "dislay_dset_metadata" and - * "display_dset_dtype_info". - * *------------------------------------------------------------------------- */ static void @@ -1560,7 +1517,7 @@ print_file_statistics(const iter_t *iter) if(display_attr) print_attr_info(iter); if(display_free_sections) print_freespace_info(iter); if(display_summary) print_storage_summary(iter); -} +} /* print_file_statistics() */ /*------------------------------------------------------------------------- @@ -1583,7 +1540,7 @@ static void print_object_statistics(const char *name) { printf("Object name %s\n", name); -} +} /* print_object_statistics() */ /*------------------------------------------------------------------------- @@ -1609,15 +1566,24 @@ print_statistics(const char *name, const iter_t *iter) print_object_statistics(name); else print_file_statistics(iter); -} +} /* print_statistics() */ +/*------------------------------------------------------------------------- + * Function: main + * + * Modifications: + * 2/2010; Vailin Choi + * Get the size of user block + * + *------------------------------------------------------------------------- + */ int main(int argc, const char *argv[]) { iter_t iter; const char *fname = NULL; - hid_t fid; + hid_t fid = -1; hid_t fcpl; struct handler_t *hand = NULL; H5F_info2_t finfo; @@ -1640,6 +1606,8 @@ main(int argc, const char *argv[]) printf("Filename: %s\n", fname); + HDmemset(&iter, 0, sizeof(iter)); + fid = H5Fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT); if(fid < 0) { error_msg("unable to open file \"%s\"\n", fname); @@ -1648,7 +1616,7 @@ main(int argc, const char *argv[]) } /* end if */ /* Initialize iter structure */ - iter_init(&iter, fid); + iter.fid = fid; if(H5Fget_filesize(fid, &iter.filesize) < 0) warn_msg("Unable to retrieve file size\n"); @@ -1715,7 +1683,7 @@ done: /* Free iter structure */ iter_free(&iter); - if(H5Fclose(fid) < 0) { + if(fid >= 0 && H5Fclose(fid) < 0) { error_msg("unable to close file \"%s\"\n", fname); h5tools_setstatus(EXIT_FAILURE); } diff --git a/tools/h5stat/testfiles/h5stat_notexist.ddl b/tools/h5stat/testfiles/h5stat_notexist.ddl new file mode 100644 index 0000000..ac0fce4 --- /dev/null +++ b/tools/h5stat/testfiles/h5stat_notexist.ddl @@ -0,0 +1,5 @@ +############################# +Expected output for 'h5stat notexist.h5' +############################# +Filename: notexist.h5 +h5stat error: unable to open file "notexist.h5" diff --git a/tools/h5stat/testh5stat.sh.in b/tools/h5stat/testh5stat.sh.in index c5cb3e8..c594a97 100644 --- a/tools/h5stat/testh5stat.sh.in +++ b/tools/h5stat/testh5stat.sh.in @@ -77,6 +77,7 @@ $SRC_H5STAT_TESTFILES/h5stat_newgrat.h5 LIST_OTHER_TEST_FILES=" $SRC_H5STAT_TESTFILES/h5stat_help1.ddl $SRC_H5STAT_TESTFILES/h5stat_help2.ddl +$SRC_H5STAT_TESTFILES/h5stat_notexist.ddl $SRC_H5STAT_TESTFILES/h5stat_filters.ddl $SRC_H5STAT_TESTFILES/h5stat_filters-file.ddl $SRC_H5STAT_TESTFILES/h5stat_filters-F.ddl @@ -189,6 +190,8 @@ COPY_TESTFILES_TO_TESTDIR # Test for help flag TOOLTEST h5stat_help1.ddl -h TOOLTEST h5stat_help2.ddl --help +# Test when h5stat a file that does not exist +TOOLTEST h5stat_notexist.ddl notexist.h5 # Test file with groups, compressed datasets, user-applied fileters, etc. # h5stat_filters.h5 is a copy of ../../testfiles/tfilters.h5 as of release 1.8.0-alpha4 diff --git a/tools/lib/CMakeLists.txt b/tools/lib/CMakeLists.txt index 837a14e..6d48d5f 100644 --- a/tools/lib/CMakeLists.txt +++ b/tools/lib/CMakeLists.txt @@ -79,6 +79,9 @@ ENDIF (APPLE) # Add Target(s) to CMake Install for import into other projects #----------------------------------------------------------------------------- IF (HDF5_EXPORTED_TARGETS) + + INSTALL_TARGET_PDB (${HDF5_TOOLS_LIB_TARGET} ${HDF5_INSTALL_LIB_DIR} toolslibraries) + INSTALL ( TARGETS ${HDF5_TOOLS_LIB_TARGET} diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index cef30dd..bcd63f1 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -868,8 +868,8 @@ hsize_t h5diff(const char *fname1, /* get any symbolic links info */ - l_ret1 = H5tools_get_symlink_info(file1_id, obj1fullname, &trg_linfo1, TRUE); - l_ret2 = H5tools_get_symlink_info(file2_id, obj2fullname, &trg_linfo2, TRUE); + l_ret1 = H5tools_get_symlink_info(file1_id, obj1fullname, &trg_linfo1, options->follow_links); + l_ret2 = H5tools_get_symlink_info(file2_id, obj2fullname, &trg_linfo2, options->follow_links); /*--------------------------------------------- * check for following symlinks @@ -1121,6 +1121,8 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, char * obj2_fullpath = NULL; h5trav_type_t objtype; diff_args_t argdata; + size_t idx1 = 0; + size_t idx2 = 0; /* @@ -1160,17 +1162,6 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, } } - /* objects with the same name but different HDF5 types */ - for( i = 0; i < table->nobjs; i++) - { - if ( table->objs[i].flags[0] && table->objs[i].flags[1] ) - { - if ( table->objs[i].type != table->objs[i].type ) - { - options->contents = 0; - } - } - } /*------------------------------------------------------------------------- * do the diff for common objects @@ -1205,8 +1196,18 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, HDstrcpy(obj2_fullpath, grp2_path); HDstrcat(obj2_fullpath, table->objs[i].name); + /* get index to figure out type of the object in file1 */ + while ( info1->paths[idx1].path && + (HDstrcmp (obj1_fullpath, info1->paths[idx1].path) != 0) ) + idx1++; + /* get index to figure out type of the object in file2 */ + while ( info2->paths[idx2].path && + (HDstrcmp (obj2_fullpath, info2->paths[idx2].path) != 0) ) + idx2++; + /* Set argdata to pass other args into diff() */ - argdata.type = objtype; + argdata.type[0] = info1->paths[idx1].type; + argdata.type[1] = info2->paths[idx2].type; argdata.is_same_trgobj = table->objs[i].is_same_trgobj; options->cmn_objs = 1; @@ -1242,7 +1243,8 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, HDstrcpy(args.name1, obj1_fullpath); HDstrcpy(args.name2, obj2_fullpath); args.options = *options; - args.argdata.type = objtype; + args.argdata.type[0] = info1->paths[idx1].type; + args.argdata.type[1] = info2->paths[idx2].type; args.argdata.is_same_trgobj = table->objs[i].is_same_trgobj; h5diffdebug2("busyTasks=%d\n", busyTasks); @@ -1576,176 +1578,9 @@ hsize_t diff_compare(hid_t file1_id, obj1type = info1->paths[i].type; obj2type = info2->paths[j].type; - /*----------------------------------------------------------------- - * follow link option, compare with target object - */ - if (options->follow_links) - { - /* pass how to handle printing warning to linkinfo option */ - if(print_warn(options)) - linkinfo1.opt.msg_mode = linkinfo2.opt.msg_mode = 1; - - /*------------------------------------------------------------ - * Soft links - *------------------------------------------------------------*/ - - /*-------------------------- - * if object1 soft link */ - if (obj1type == H5TRAV_TYPE_LINK) - { - /* get type of target object */ - l_ret = H5tools_get_symlink_info(file1_id, obj1name, &linkinfo1, TRUE); - /* dangling link */ - if (l_ret == 0) - { - if (options->no_dangle_links) - { - /* gangling link is error */ - if(options->m_verbose) - parallel_print("Warning: <%s> is a dangling link.\n", obj1name); - options->err_stat = 1; - goto out; - } - else - is_dangle_link1 = 1; - } - /* fail */ - else if(l_ret < 0) - { - options->err_stat = 1; - goto out; - } - else /* OK */ - { - /* target type for diff() */ - obj1type = linkinfo1.trg_type; - } - } - - /*----------------------------- - * if object2 is soft link */ - if (obj2type == H5TRAV_TYPE_LINK) - { - /* get type target object */ - l_ret = H5tools_get_symlink_info(file2_id, obj2name, &linkinfo2, TRUE); - /* dangling link */ - if (l_ret == 0) - { - if (options->no_dangle_links) - { - /* gangling link is error */ - if(options->m_verbose) - parallel_print("Warning: <%s> is a dangling link.\n", obj2name); - options->err_stat = 1; - goto out; - } - else - is_dangle_link2=1; - } - /* fail */ - else if(l_ret < 0) - { - options->err_stat = 1; - goto out; - } - else /* OK */ - { - /* target type for diff() */ - obj2type = linkinfo2.trg_type; - } - } - - /*------------------------------------------------------------ - * External links - *------------------------------------------------------------*/ - - /*-------------------------------- - * if object1 is external link */ - if (obj1type == H5TRAV_TYPE_UDLINK) - { - /* get type and name of target object */ - l_ret = H5tools_get_symlink_info(file1_id, obj1name, &linkinfo1, TRUE); - /* dangling link */ - if (l_ret == 0) - { - if (options->no_dangle_links) - { - /* gangling link is error */ - if(options->m_verbose) - parallel_print("Warning: <%s> is a dangling link.\n", obj1name); - options->err_stat = 1; - goto out; - } - else - is_dangle_link1 = 1; - } - /* fail */ - else if(l_ret < 0) - { - options->err_stat = 1; - goto out; - } - else /* OK */ - { - /* for external link */ - if(linkinfo1.linfo.type == H5L_TYPE_EXTERNAL) - obj1type = linkinfo1.trg_type; - } - } - - /*-------------------------------- - * if object2 is external link */ - if (obj2type == H5TRAV_TYPE_UDLINK) - { - /* get type and name of target object */ - l_ret = H5tools_get_symlink_info(file2_id, obj2name, &linkinfo2, TRUE); - /* dangling link */ - if (l_ret == 0) - { - if (options->no_dangle_links) - { - /* gangling link is error */ - if(options->m_verbose) - parallel_print("Warning: <%s> is a dangling link.\n", obj2name); - options->err_stat = 1; - goto out; - } - else - is_dangle_link2 = 1; - } - /* fail */ - else if(l_ret < 0) - { - options->err_stat = 1; - goto out; - } - else /* OK */ - { - /* for external link */ - if(linkinfo2.linfo.type == H5L_TYPE_EXTERNAL) - obj2type = linkinfo2.trg_type; - } - } - /* found dangling link */ - if (is_dangle_link1 || is_dangle_link2) - goto out; - } /* end of follow_links */ - - /* objects are not the same type */ - if (obj1type != obj2type) - { - if (options->m_verbose||options->m_list_not_cmp) - { - parallel_print("<%s> is of type %s and <%s> is of type %s\n", - obj1name, get_type(obj1type), - obj2name, get_type(obj2type)); - } - options->not_cmp=1; - goto out; - } - /* Set argdata to pass other args into diff() */ - argdata.type = obj1type; + argdata.type[0] = obj1type; + argdata.type[1] = obj2type; argdata.is_same_trgobj = 0; nfound = diff(file1_id, obj1name, @@ -1806,7 +1641,8 @@ out: * Return: Number of differences found * * Programmer: Jonathan Kim - * - add following links feature (Feb 11,2010) + * - Move follow symlinks code toward top. (March 2812) + * - Add following symlinks feature (Feb 11,2010) * - Change to use diff_args_t to pass the rest of args. * Passing through it instead of individual args provides smoother * extensibility through its members along with MPI code update for ph5diff @@ -1834,6 +1670,7 @@ hsize_t diff(hid_t file1_id, int is_dangle_link2 = 0; int is_hard_link = 0; hsize_t nfound = 0; + h5trav_type_t object_type; /* to get link info */ @@ -1848,52 +1685,86 @@ hsize_t diff(hid_t file1_id, if(print_warn(options)) linkinfo1.opt.msg_mode = linkinfo2.opt.msg_mode = 1; - /* - * Get target object info for obj1 and obj2 and check dangling links. - * (for hard-linked-objects, because diff() only get the obj1's type, - * so obj2's type should be check here when diff() is called from - * diff_match() for same-named objects with dangling link only one side.) - */ - - /* target object1 - get type and name */ - ret = H5tools_get_symlink_info(file1_id, path1, &linkinfo1, TRUE); - /* dangling link */ - if (ret == 0) + /* for symbolic links, take care follow symlink and no dangling link + * options */ + if (argdata->type[0] == H5TRAV_TYPE_LINK || + argdata->type[0] == H5TRAV_TYPE_UDLINK || + argdata->type[1] == H5TRAV_TYPE_LINK || + argdata->type[1] == H5TRAV_TYPE_UDLINK ) { - if (options->no_dangle_links) + /* + * check dangling links for path1 and path2 + */ + + /* target object1 - get type and name */ + ret = H5tools_get_symlink_info(file1_id, path1, &linkinfo1, options->follow_links); + /* dangling link */ + if (ret == 0) { - /* gangling link is error */ - if(options->m_verbose) - parallel_print("Warning: <%s> is a dangling link.\n", path1); - goto out; + if (options->no_dangle_links) + { + /* gangling link is error */ + if(options->m_verbose) + parallel_print("Warning: <%s> is a dangling link.\n", path1); + goto out; + } + else + is_dangle_link1 = 1; } - else - is_dangle_link1 = 1; - } - else if (ret < 0) - goto out; + else if (ret < 0) + goto out; - /* target object2 - get type and name */ - ret = H5tools_get_symlink_info(file2_id, path2, &linkinfo2, TRUE); - /* dangling link */ - if (ret == 0) - { - if (options->no_dangle_links) + /* target object2 - get type and name */ + ret = H5tools_get_symlink_info(file2_id, path2, &linkinfo2, options->follow_links ); + /* dangling link */ + if (ret == 0) { - /* gangling link is error */ - if(options->m_verbose) - parallel_print("Warning: <%s> is a dangling link.\n", path2); + if (options->no_dangle_links) + { + /* gangling link is error */ + if(options->m_verbose) + parallel_print("Warning: <%s> is a dangling link.\n", path2); + goto out; + } + else + is_dangle_link2 = 1; + } + else if (ret < 0) goto out; + + /* found dangling link */ + if (is_dangle_link1 || is_dangle_link2) + goto out2; + + /* follow symbolic link option */ + if (options->follow_links) + { + if (linkinfo1.linfo.type == H5L_TYPE_SOFT || + linkinfo1.linfo.type == H5L_TYPE_EXTERNAL) + argdata->type[0] = linkinfo1.trg_type; + + if (linkinfo2.linfo.type == H5L_TYPE_SOFT || + linkinfo2.linfo.type == H5L_TYPE_EXTERNAL) + argdata->type[1] = linkinfo2.trg_type; } - else - is_dangle_link2 = 1; } - else if (ret < 0) - goto out; - - /* found dangling link */ - if (is_dangle_link1 || is_dangle_link2) + /* if objects are not the same type */ + if (argdata->type[0] != argdata->type[1]) + { + if (options->m_verbose||options->m_list_not_cmp) + { + parallel_print("Not comparable: <%s> is of type %s and <%s> is of type %s\n", + path1, get_type(argdata->type[0]), + path2, get_type(argdata->type[1])); + } + options->not_cmp=1; + /* TODO: will need to update non-comparable is different + * options->contents = 0; + */ goto out2; + } + else /* now both object types are same */ + object_type = argdata->type[0]; /* * If both points to the same target object, skip comparing details inside @@ -1903,17 +1774,17 @@ hsize_t diff(hid_t file1_id, * * Perform this to match the outputs as bypassing. */ - is_hard_link = (argdata->type == H5TRAV_TYPE_DATASET || - argdata->type == H5TRAV_TYPE_NAMED_DATATYPE || - argdata->type == H5TRAV_TYPE_GROUP); - if (options->follow_links || is_hard_link) + if (argdata->is_same_trgobj) { - if (argdata->is_same_trgobj) + is_hard_link = (object_type == H5TRAV_TYPE_DATASET || + object_type == H5TRAV_TYPE_NAMED_DATATYPE || + object_type == H5TRAV_TYPE_GROUP); + if (options->follow_links || is_hard_link) { /* print information is only verbose option is used */ if(options->m_verbose || options->m_report) { - switch(argdata->type) + switch(object_type) { case H5TRAV_TYPE_DATASET: do_print_objname("dataset", path1, path2, options); @@ -1935,7 +1806,7 @@ hsize_t diff(hid_t file1_id, break; default: parallel_print("Comparison not supported: <%s> and <%s> are of type %s\n", - path1, path2, get_type(argdata->type) ); + path1, path2, get_type(object_type) ); options->not_cmp = 1; break; } /* switch(type)*/ @@ -1943,11 +1814,12 @@ hsize_t diff(hid_t file1_id, print_found(nfound); } /* if(options->m_verbose || options->m_report) */ + /* exact same, so comparison is done */ goto out2; } } - switch(argdata->type) + switch(object_type) { /*---------------------------------------------------------------------- * H5TRAV_TYPE_DATASET @@ -2064,30 +1936,6 @@ hsize_t diff(hid_t file1_id, if(print_objname(options, nfound)) do_print_objname("link", path1, path2, options); - if (options->follow_links) - { - /* objects are not the same type */ - if (linkinfo1.trg_type != linkinfo2.trg_type) - { - if (options->m_verbose||options->m_list_not_cmp) - { - parallel_print("<%s> is of type %s and <%s> is of type %s\n", path1, get_type(linkinfo1.trg_type), path2, get_type(linkinfo2.trg_type)); - } - options->not_cmp=1; - goto out; - } - - /* Renew type in argdata to pass into diff(). - * For recursive call, argdata.is_same_trgobj is already - * set from initial call, so don't reset here */ - argdata->type = linkinfo1.trg_type; - - /* call self to compare target object */ - nfound += diff(file1_id, path1, - file2_id, path2, - options, argdata); - } - /* always print the number of differences found in verbose mode */ if(options->m_verbose) print_found(nfound); @@ -2121,28 +1969,6 @@ hsize_t diff(hid_t file1_id, if(print_objname(options, nfound)) do_print_objname("external link", path1, path2, options); - if (options->follow_links) - { - /* objects are not the same type */ - if (linkinfo1.trg_type != linkinfo2.trg_type) - { - if (options->m_verbose||options->m_list_not_cmp) - { - parallel_print("<%s> is of type %s and <%s> is of type %s\n", path1, get_type(linkinfo1.trg_type), path2, get_type(linkinfo2.trg_type)); - } - options->not_cmp=1; - goto out; - } - - /* Renew type in argdata to pass into diff(). - * For recursive call, argdata.is_same_trgobj is already - * set from initial call, so don't reset here */ - argdata->type = linkinfo1.trg_type; - - nfound = diff(file1_id, path1, - file2_id, path2, - options, argdata); - } } /* end if */ else { @@ -2172,7 +1998,7 @@ hsize_t diff(hid_t file1_id, default: if(options->m_verbose) parallel_print("Comparison not supported: <%s> and <%s> are of type %s\n", - path1, path2, get_type(argdata->type) ); + path1, path2, get_type(object_type) ); options->not_cmp = 1; break; } diff --git a/tools/lib/h5diff.h b/tools/lib/h5diff.h index 1ff4402..6985b68 100644 --- a/tools/lib/h5diff.h +++ b/tools/lib/h5diff.h @@ -28,7 +28,7 @@ * as it doesn't require interface change. *------------------------------------------------------------------------*/ typedef struct { - h5trav_type_t type; + h5trav_type_t type[2]; hbool_t is_same_trgobj; } diff_args_t; /*------------------------------------------------------------------------- diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index 17639bc..24aa81a 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -1051,6 +1051,7 @@ void init_acc_pos(h5tools_context_t *ctx, hsize_t *dims) { int i; + unsigned j; HDassert(ctx->ndims); @@ -1058,8 +1059,8 @@ init_acc_pos(h5tools_context_t *ctx, hsize_t *dims) for (i = (ctx->ndims - 2); i >= 0; i--) { ctx->acc[i] = ctx->acc[i + 1] * dims[i + 1]; } - for (i = 0; i < ctx->ndims; i++) - ctx->pos[i] = 0; + for (j = 0; j < ctx->ndims; j++) + ctx->pos[j] = 0; } /*------------------------------------------------------------------------- @@ -1525,7 +1526,7 @@ render_bin_output_region_data_blocks(hid_t region_id, FILE *stream, if((type_size = H5Tget_size(type_id)) == 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); - if((region_buf = HDmalloc(type_size * numelem)) == NULL) + if((region_buf = HDmalloc(type_size * (size_t)numelem)) == NULL) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate region buffer"); /* Select (x , x , ..., x ) x (y , y , ..., y ) hyperslab for reading memory dataset */ @@ -1670,7 +1671,7 @@ render_bin_output_region_data_points(hid_t region_space, hid_t region_id, if((type_size = H5Tget_size(type_id)) == 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); - if((region_buf = HDmalloc(type_size * npoints)) == NULL) + if((region_buf = HDmalloc(type_size * (size_t)npoints)) == NULL) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for region"); /* Allocate space for the dimension array */ diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c index 9188225..619a413 100644 --- a/tools/lib/h5tools_dump.c +++ b/tools/lib/h5tools_dump.c @@ -261,7 +261,7 @@ h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t contai h5tools_context_t *ctx/*in,out*/, unsigned flags, hsize_t nelmts, hid_t type, void *_mem) { - HERR_INIT(int, SUCCEED) + int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */ unsigned char *mem = (unsigned char*) _mem; hsize_t i; /*element counter */ size_t size; /*size of each datum */ @@ -390,7 +390,6 @@ h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t contai h5tools_str_close(&buffer); }/* else bin */ -CATCH return ret_value; } @@ -430,7 +429,7 @@ h5tools_print_region_data_blocks(hid_t region_id, hsize_t numelem; hsize_t numindex; size_t jndx; - int indx; + unsigned indx; int type_size; int ret_value = SUCCEED; hid_t mem_space = -1; @@ -466,7 +465,7 @@ h5tools_print_region_data_blocks(hid_t region_id, if((type_size = H5Tget_size(type_id)) == 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); - if((region_buf = HDmalloc(type_size * numelem)) == NULL) + if((region_buf = HDmalloc(type_size * (size_t)numelem)) == NULL) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate region buffer"); /* Select (x , x , ..., x ) x (y , y , ..., y ) hyperslab for reading memory dataset */ @@ -781,7 +780,7 @@ h5tools_print_region_data_points(hid_t region_space, hid_t region_id, hsize_t curr_pos = 0; hsize_t total_size[H5S_MAX_RANK]; size_t jndx; - int indx; + unsigned indx; int type_size; int ret_value = SUCCEED; unsigned int region_flags; /* buffer extent flags */ @@ -808,7 +807,7 @@ h5tools_print_region_data_points(hid_t region_space, hid_t region_id, if((type_size = H5Tget_size(type_id)) == 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); - if((region_buf = HDmalloc(type_size * npoints)) == NULL) + if((region_buf = HDmalloc(type_size * (size_t)npoints)) == NULL) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for region"); curr_pos = 0; @@ -1143,9 +1142,7 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c size_row_block = sset->block.data[row_dim]; /* Check if we have VL data in the dataset's datatype */ - if (h5tools_detect_vlen_str(p_type) == TRUE) - vl_data = TRUE; - if (H5Tdetect_class(p_type, H5T_VLEN) == TRUE) + if (h5tools_detect_vlen(p_type) == TRUE) vl_data = TRUE; /* display loop */ @@ -1553,9 +1550,7 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_cont } /* Check if we have VL data in the dataset's datatype */ - if (h5tools_detect_vlen_str(p_type) == TRUE) - vl_data = TRUE; - if (H5Tdetect_class(p_type, H5T_VLEN) == TRUE) + if (h5tools_detect_vlen(p_type) == TRUE) vl_data = TRUE; /* @@ -1672,7 +1667,7 @@ h5tools_dump_simple_mem(FILE *stream, const h5tool_format_t *info, h5tools_conte hid_t type, hid_t space, void *mem) { HERR_INIT(herr_t, SUCCEED) - int i; /*counters */ + unsigned i; /*counters */ hsize_t nelmts; /*total selected elmts */ ctx->ndims = H5Sget_simple_extent_ndims(space); @@ -2123,14 +2118,38 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ h5tools_str_reset(buffer); h5tools_str_append(buffer, "%s ", STRPAD); - if (str_pad == H5T_STR_NULLTERM) - h5tools_str_append(buffer, "H5T_STR_NULLTERM;"); - else if (str_pad == H5T_STR_NULLPAD) - h5tools_str_append(buffer, "H5T_STR_NULLPAD;"); - else if (str_pad == H5T_STR_SPACEPAD) - h5tools_str_append(buffer, "H5T_STR_SPACEPAD;"); - else - h5tools_str_append(buffer, "H5T_STR_ERROR;"); + switch (str_pad) { + case H5T_STR_NULLTERM: + h5tools_str_append(buffer, "H5T_STR_NULLTERM;"); + break; + case H5T_STR_NULLPAD: + h5tools_str_append(buffer, "H5T_STR_NULLPAD;"); + break; + case H5T_STR_SPACEPAD: + h5tools_str_append(buffer, "H5T_STR_SPACEPAD;"); + break; + case H5T_STR_RESERVED_3: + case H5T_STR_RESERVED_4: + case H5T_STR_RESERVED_5: + case H5T_STR_RESERVED_6: + case H5T_STR_RESERVED_7: + case H5T_STR_RESERVED_8: + case H5T_STR_RESERVED_9: + case H5T_STR_RESERVED_10: + case H5T_STR_RESERVED_11: + case H5T_STR_RESERVED_12: + case H5T_STR_RESERVED_13: + case H5T_STR_RESERVED_14: + case H5T_STR_RESERVED_15: + h5tools_str_append(buffer, "H5T_STR_UNKNOWN;"); + break; + case H5T_STR_ERROR: + h5tools_str_append(buffer, "H5T_STR_ERROR;"); + break; + default: + h5tools_str_append(buffer, "ERROR;"); + break; + } h5tools_render_element(stream, info, ctx, buffer, &curr_pos, ncols, 0, 0); ctx->need_prefix = TRUE; @@ -2140,10 +2159,35 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ h5tools_str_append(buffer, "%s ", CSET); - if (cset == H5T_CSET_ASCII) - h5tools_str_append(buffer, "H5T_CSET_ASCII;"); - else - h5tools_str_append(buffer, "unknown_cset;"); + switch (cset) { + case H5T_CSET_ASCII: + h5tools_str_append(buffer, "H5T_CSET_ASCII;"); + break; + case H5T_CSET_UTF8: + h5tools_str_append(buffer, "H5T_CSET_UTF8;"); + break; + case H5T_CSET_RESERVED_2: + case H5T_CSET_RESERVED_3: + case H5T_CSET_RESERVED_4: + case H5T_CSET_RESERVED_5: + case H5T_CSET_RESERVED_6: + case H5T_CSET_RESERVED_7: + case H5T_CSET_RESERVED_8: + case H5T_CSET_RESERVED_9: + case H5T_CSET_RESERVED_10: + case H5T_CSET_RESERVED_11: + case H5T_CSET_RESERVED_12: + case H5T_CSET_RESERVED_13: + case H5T_CSET_RESERVED_14: + case H5T_CSET_RESERVED_15: + h5tools_str_append(buffer, "H5T_CSET_UNKNOWN;"); + case H5T_CSET_ERROR: + h5tools_str_append(buffer, "H5T_CSET_ERROR;"); + break; + default: + h5tools_str_append(buffer, "ERROR;"); + break; + } h5tools_render_element(stream, info, ctx, buffer, &curr_pos, ncols, 0, 0); ctx->need_prefix = TRUE; @@ -2849,8 +2893,6 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, hsize_t size; /* size of external file */ hsize_t storage_size; hsize_t curr_pos = 0; /* total data element position */ - hsize_t elmt_counter = 0;/* counts the # elements printed.*/ - haddr_t ioffset; h5tools_str_t buffer; /* string into which to render */ /* setup */ @@ -2860,7 +2902,6 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, storage_size = H5Dget_storage_size(obj_id); nfilters = H5Pget_nfilters(dcpl_id); - ioffset = H5Dget_offset(obj_id); HDstrcpy(f_name,"\0"); /*------------------------------------------------------------------------- @@ -3043,6 +3084,8 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); } else { + haddr_t ioffset; + ctx->indent_level++; ctx->need_prefix = TRUE; @@ -3063,6 +3106,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); h5tools_str_reset(&buffer); + ioffset = H5Dget_offset(obj_id); h5tools_str_append(&buffer,"OFFSET "H5_PRINTF_HADDR_FMT, ioffset); h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); @@ -3375,7 +3419,6 @@ h5tools_dump_comment(FILE *stream, const h5tool_format_t *info, size_t buf_size = 0; size_t ncols = 80; /* available output width */ h5tools_str_t buffer; /* string into which to render */ - hsize_t elmt_counter = 0;/* counts the # elements printed.*/ hsize_t curr_pos = ctx->sm_pos; /* total data element position */ /* pass to the prefix in h5tools_simple_prefix the total position * instead of the current stripmine position i; this is necessary @@ -3429,7 +3472,6 @@ h5tools_dump_attribute(FILE *stream, const h5tool_format_t *info, { h5tools_str_t buffer; /* string into which to render */ size_t ncols = 80; /* available output width */ - hsize_t elmt_counter = 0;/* counts the # elements printed.*/ hsize_t curr_pos = ctx->sm_pos; /* total data element position */ /* pass to the prefix in h5tools_simple_prefix the total position * instead of the current stripmine position i; this is necessary @@ -3808,9 +3850,7 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, ndims = H5Sget_simple_extent_dims(space, size, NULL); /* Check if we have VL data in the dataset's datatype */ - if (h5tools_detect_vlen_str(p_type) == TRUE) - vl_data = TRUE; - if (H5Tdetect_class(p_type, H5T_VLEN) == TRUE) + if (h5tools_detect_vlen(p_type) == TRUE) vl_data = TRUE; for (i = 0; i < ndims; i++) diff --git a/tools/misc/CMakeLists.txt b/tools/misc/CMakeLists.txt index 72930c9..0687323 100644 --- a/tools/misc/CMakeLists.txt +++ b/tools/misc/CMakeLists.txt @@ -31,6 +31,13 @@ SET (H5_DEP_EXECUTABLES h5mkgrp ) +#----------------------------------------------------------------------------- +# Generate the h5cc file containing settings needed to compile programs +#----------------------------------------------------------------------------- +#IF (NOT WIN32) +# CONFIGURE_FILE (${HDF5_TOOLS_MISC_SOURCE_DIR}/h5cc.in ${HDF5_BINARY_DIR}/h5cc @ONLY) +#ENDIF (NOT WIN32) + ############################################################################## ############################################################################## ### T E S T I N G ### @@ -311,11 +318,16 @@ ENDIF (BUILD_TESTING) #-----------------------------------------------------------------------------
# Rules for Installation of tools using make Install target
#-----------------------------------------------------------------------------
+ +INSTALL_PROGRAM_PDB (h5debug ${HDF5_INSTALL_BIN_DIR} toolsapplications) +INSTALL_PROGRAM_PDB (h5repart ${HDF5_INSTALL_BIN_DIR} toolsapplications) +INSTALL_PROGRAM_PDB (h5mkgrp ${HDF5_INSTALL_BIN_DIR} toolsapplications) + INSTALL ( TARGETS h5debug h5repart h5mkgrp RUNTIME DESTINATION - ${HDF5_INSTALL_BIN_DIR}/tools + ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications ) diff --git a/tools/misc/h5cc.in b/tools/misc/h5cc.in index a1421a2..233c80a 100755..100644 --- a/tools/misc/h5cc.in +++ b/tools/misc/h5cc.in @@ -220,7 +220,7 @@ for arg in $@ ; do get_output_file="yes" fi ;; - -E|-M) + -E|-M|-MT) allargs="$allargs $arg" compile_args="$compile_args $arg" dash_c="yes" diff --git a/tools/misc/h5debug.c b/tools/misc/h5debug.c index f24fbba..9df49cf 100644 --- a/tools/misc/h5debug.c +++ b/tools/misc/h5debug.c @@ -23,33 +23,34 @@ * *------------------------------------------------------------------------- */ -#define H5A_PACKAGE /*suppress error about including H5Apkg */ -#define H5B2_PACKAGE /*suppress error about including H5B2pkg */ +#define H5A_PACKAGE /*suppress error about including H5Apkg */ +#define H5B2_PACKAGE /*suppress error about including H5B2pkg */ #define H5B2_TESTING /*suppress warning about H5B2 testing funcs*/ -#define H5EA_PACKAGE /*suppress error about including H5EApkg */ +#define H5D_PACKAGE /*suppress error about including H5Dpkg */ +#define H5EA_PACKAGE /*suppress error about including H5EApkg */ #define H5EA_TESTING /*suppress warning about H5EA testing funcs*/ -#define H5FA_PACKAGE /*suppress error about including H5FApkg */ +#define H5FA_PACKAGE /*suppress error about including H5FApkg */ #define H5FA_TESTING /*suppress warning about H5FA testing funcs*/ -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ -#define H5G_PACKAGE /*suppress error about including H5Gpkg */ -#define H5HF_PACKAGE /*suppress error about including H5HFpkg */ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ -#define H5SM_PACKAGE /*suppress error about including H5SMpkg */ - -#include "H5private.h" /* Generic Functions */ -#include "H5Apkg.h" /* Attributes */ -#include "H5B2pkg.h" /* v2 B-trees */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5EApkg.h" /* Extensible Arrays */ -#include "H5FApkg.h" /* Fixed Arrays */ -#include "H5Fpkg.h" /* File access */ -#include "H5FSprivate.h" /* Free space manager */ -#include "H5Gpkg.h" /* Groups */ -#include "H5HFpkg.h" /* Fractal heaps */ -#include "H5HGprivate.h" /* Global Heaps */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Opkg.h" /* Object headers */ +#define H5F_PACKAGE /*suppress error about including H5Fpkg */ +#define H5G_PACKAGE /*suppress error about including H5Gpkg */ +#define H5HF_PACKAGE /*suppress error about including H5HFpkg */ +#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#define H5SM_PACKAGE /*suppress error about including H5SMpkg */ + +#include "H5private.h" /* Generic Functions */ +#include "H5Apkg.h" /* Attributes */ +#include "H5B2pkg.h" /* v2 B-trees */ +#include "H5Dpkg.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5EApkg.h" /* Extensible Arrays */ +#include "H5FApkg.h" /* Fixed Arrays */ +#include "H5Fpkg.h" /* File access */ +#include "H5FSprivate.h" /* Free space manager */ +#include "H5Gpkg.h" /* Groups */ +#include "H5HFpkg.h" /* Fractal heaps */ +#include "H5HGprivate.h" /* Global Heaps */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Opkg.h" /* Object headers */ #include "H5SMpkg.h" /* Implicitly shared messages */ /* File drivers */ diff --git a/tools/misc/h5redeploy.in b/tools/misc/h5redeploy.in index ae79b70..ae79b70 100755..100644 --- a/tools/misc/h5redeploy.in +++ b/tools/misc/h5redeploy.in diff --git a/tools/testfiles/charsets.ddl b/tools/testfiles/charsets.ddl new file mode 100644 index 0000000..c2301fb --- /dev/null +++ b/tools/testfiles/charsets.ddl @@ -0,0 +1,27 @@ +HDF5 "charsets.h5" { +GROUP "/" { + DATASET "CharSets" { + DATATYPE H5T_COMPOUND { + H5T_STRING { + STRSIZE H5T_VARIABLE; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } "ascii"; + H5T_STRING { + STRSIZE H5T_VARIABLE; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_UTF8; + CTYPE H5T_C_S1; + } "utf8"; + } + DATASPACE SIMPLE { ( 1 ) / ( 1 ) } + DATA { + (0): { + "ascii", + "utf8" + } + } + } +} +} diff --git a/tools/testfiles/charsets.h5 b/tools/testfiles/charsets.h5 Binary files differnew file mode 100644 index 0000000..2b9e735 --- /dev/null +++ b/tools/testfiles/charsets.h5 diff --git a/tools/testfiles/filter_fail.ddl b/tools/testfiles/filter_fail.ddl index 75534e2..1fc0506 100644 --- a/tools/testfiles/filter_fail.ddl +++ b/tools/testfiles/filter_fail.ddl @@ -12,13 +12,13 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Dread(): can't read data major: Dataset minor: Read failed - #001: (file name) line (number) in H5D_read(): can't read data + #001: (file name) line (number) in H5D__read(): can't read data major: Dataset minor: Read failed - #002: (file name) line (number) in H5D_chunk_read(): unable to read raw data chunk + #002: (file name) line (number) in H5D__chunk_read(): unable to read raw data chunk major: Low-level I/O minor: Read failed - #003: (file name) line (number) in H5D_chunk_lock(): data pipeline read failed + #003: (file name) line (number) in H5D__chunk_lock(): data pipeline read failed major: Data filters minor: Filter operation failed #004: (file name) line (number) in H5Z_pipeline(): required filter 'filter_fail_test' is not registered |