summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/src/CMakeLists.txt37
-rw-r--r--tools/src/Makefile.am29
-rw-r--r--tools/src/h5copy/CMakeLists.txt39
-rw-r--r--tools/src/h5copy/Makefile.am40
-rw-r--r--tools/src/h5copy/h5copy.c534
-rw-r--r--tools/src/h5diff/CMakeLists.txt67
-rw-r--r--tools/src/h5diff/Makefile.am46
-rw-r--r--tools/src/h5diff/h5diff_common.c607
-rw-r--r--tools/src/h5diff/h5diff_common.h36
-rw-r--r--tools/src/h5diff/h5diff_main.c145
-rw-r--r--tools/src/h5diff/ph5diff_main.c329
-rw-r--r--tools/src/h5dump/CMakeLists.txt43
-rw-r--r--tools/src/h5dump/Makefile.am38
-rw-r--r--tools/src/h5dump/h5dump.c1802
-rw-r--r--tools/src/h5dump/h5dump.h115
-rw-r--r--tools/src/h5dump/h5dump_ddl.c2178
-rw-r--r--tools/src/h5dump/h5dump_ddl.h52
-rw-r--r--tools/src/h5dump/h5dump_defines.h56
-rw-r--r--tools/src/h5dump/h5dump_extern.h114
-rw-r--r--tools/src/h5dump/h5dump_xml.c4567
-rw-r--r--tools/src/h5dump/h5dump_xml.h39
-rw-r--r--tools/src/h5format_convert/CMakeLists.txt39
-rw-r--r--tools/src/h5format_convert/Makefile.am35
-rw-r--r--tools/src/h5format_convert/h5format_convert.c474
-rw-r--r--tools/src/h5import/CMakeLists.txt40
-rw-r--r--tools/src/h5import/Makefile.am35
-rw-r--r--tools/src/h5import/h5import.c4393
-rw-r--r--tools/src/h5import/h5import.h198
-rw-r--r--tools/src/h5jam/CMakeLists.txt49
-rw-r--r--tools/src/h5jam/Makefile.am35
-rw-r--r--tools/src/h5jam/h5jam.c571
-rw-r--r--tools/src/h5jam/h5unjam.c411
-rw-r--r--tools/src/h5ls/CMakeLists.txt41
-rw-r--r--tools/src/h5ls/Makefile.am35
-rw-r--r--tools/src/h5ls/h5ls.c2939
-rw-r--r--tools/src/h5repack/CMakeLists.txt50
-rw-r--r--tools/src/h5repack/Makefile.am42
-rw-r--r--tools/src/h5repack/h5repack.c942
-rw-r--r--tools/src/h5repack/h5repack.h243
-rw-r--r--tools/src/h5repack/h5repack_copy.c1581
-rw-r--r--tools/src/h5repack/h5repack_filters.c493
-rw-r--r--tools/src/h5repack/h5repack_main.c664
-rw-r--r--tools/src/h5repack/h5repack_opttable.c367
-rw-r--r--tools/src/h5repack/h5repack_parse.c616
-rw-r--r--tools/src/h5repack/h5repack_refs.c877
-rw-r--r--tools/src/h5repack/h5repack_verify.c675
-rw-r--r--tools/src/h5stat/CMakeLists.txt39
-rw-r--r--tools/src/h5stat/Makefile.am39
-rw-r--r--tools/src/h5stat/h5stat.c1815
-rw-r--r--tools/src/h5stat/testh5stat.sh.in318
-rw-r--r--tools/src/misc/CMakeLists.txt67
-rw-r--r--tools/src/misc/Makefile.am61
-rw-r--r--tools/src/misc/h5cc.in401
-rw-r--r--tools/src/misc/h5debug.c723
-rw-r--r--tools/src/misc/h5mkgrp.c336
-rw-r--r--tools/src/misc/h5redeploy.in218
-rw-r--r--tools/src/misc/h5repart.c510
-rw-r--r--tools/test/CMakeLists.txt40
-rw-r--r--tools/test/Makefile.am30
-rw-r--r--tools/test/h5copy/CMakeLists.txt23
-rw-r--r--tools/test/h5copy/CMakeTests.cmake373
-rw-r--r--tools/test/h5copy/Makefile.am46
-rw-r--r--tools/test/h5copy/h5copygentest.c1004
-rw-r--r--tools/test/h5copy/testfiles/h5copy_extlinks_src.h5bin0 -> 2184 bytes
-rw-r--r--tools/test/h5copy/testfiles/h5copy_extlinks_src.out.ls43
-rw-r--r--tools/test/h5copy/testfiles/h5copy_extlinks_trg.h5bin0 -> 2168 bytes
-rw-r--r--tools/test/h5copy/testfiles/h5copy_misc1.out3
-rw-r--r--tools/test/h5copy/testfiles/h5copy_ref.h5bin0 -> 9104 bytes
-rw-r--r--tools/test/h5copy/testfiles/h5copy_ref.out.ls31
-rw-r--r--tools/test/h5copy/testfiles/h5copytst.h5bin0 -> 15900 bytes
-rw-r--r--tools/test/h5copy/testfiles/h5copytst.out.ls429
-rw-r--r--tools/test/h5copy/testfiles/h5copytst_new.h5bin0 -> 31856 bytes
-rw-r--r--tools/test/h5copy/testfiles/h5copytst_new.out.ls502
-rw-r--r--tools/test/h5copy/testh5copy.sh.in607
-rw-r--r--tools/test/h5diff/CMakeLists.txt22
-rw-r--r--tools/test/h5diff/CMakeTests.cmake1362
-rw-r--r--tools/test/h5diff/Makefile.am53
-rw-r--r--tools/test/h5diff/h5diffgentest.c7385
-rw-r--r--tools/test/h5diff/testfiles/compounds_array_vlen1.h5bin0 -> 26912 bytes
-rw-r--r--tools/test/h5diff/testfiles/compounds_array_vlen2.h5bin0 -> 26912 bytes
-rw-r--r--tools/test/h5diff/testfiles/h5diff_10.txt140
-rw-r--r--tools/test/h5diff/testfiles/h5diff_100.txt1038
-rw-r--r--tools/test/h5diff/testfiles/h5diff_101.txt11
-rw-r--r--tools/test/h5diff/testfiles/h5diff_101w.txt11
-rw-r--r--tools/test/h5diff/testfiles/h5diff_102.txt10
-rw-r--r--tools/test/h5diff/testfiles/h5diff_102w.txt10
-rw-r--r--tools/test/h5diff/testfiles/h5diff_103.txt8
-rw-r--r--tools/test/h5diff/testfiles/h5diff_103w.txt8
-rw-r--r--tools/test/h5diff/testfiles/h5diff_104.txt8
-rw-r--r--tools/test/h5diff/testfiles/h5diff_104w.txt8
-rw-r--r--tools/test/h5diff/testfiles/h5diff_11.txt3
-rw-r--r--tools/test/h5diff/testfiles/h5diff_12.txt3
-rw-r--r--tools/test/h5diff/testfiles/h5diff_13.txt11
-rw-r--r--tools/test/h5diff/testfiles/h5diff_14.txt11
-rw-r--r--tools/test/h5diff/testfiles/h5diff_15.txt10
-rw-r--r--tools/test/h5diff/testfiles/h5diff_16_1.txt11
-rw-r--r--tools/test/h5diff/testfiles/h5diff_16_2.txt11
-rw-r--r--tools/test/h5diff/testfiles/h5diff_16_3.txt11
-rw-r--r--tools/test/h5diff/testfiles/h5diff_17.txt57
-rw-r--r--tools/test/h5diff/testfiles/h5diff_171.txt3
-rw-r--r--tools/test/h5diff/testfiles/h5diff_172.txt3
-rw-r--r--tools/test/h5diff/testfiles/h5diff_18.txt1
-rw-r--r--tools/test/h5diff/testfiles/h5diff_18_1.txt2
-rw-r--r--tools/test/h5diff/testfiles/h5diff_19.txt26
-rw-r--r--tools/test/h5diff/testfiles/h5diff_20.txt6
-rw-r--r--tools/test/h5diff/testfiles/h5diff_200.txt5
-rw-r--r--tools/test/h5diff/testfiles/h5diff_201.txt2
-rw-r--r--tools/test/h5diff/testfiles/h5diff_202.txt2
-rw-r--r--tools/test/h5diff/testfiles/h5diff_203.txt3
-rw-r--r--tools/test/h5diff/testfiles/h5diff_204.txt3
-rw-r--r--tools/test/h5diff/testfiles/h5diff_205.txt3
-rw-r--r--tools/test/h5diff/testfiles/h5diff_206.txt2
-rw-r--r--tools/test/h5diff/testfiles/h5diff_207.txt3
-rw-r--r--tools/test/h5diff/testfiles/h5diff_208.txt5
-rw-r--r--tools/test/h5diff/testfiles/h5diff_21.txt6
-rw-r--r--tools/test/h5diff/testfiles/h5diff_22.txt6
-rw-r--r--tools/test/h5diff/testfiles/h5diff_220.txt6
-rw-r--r--tools/test/h5diff/testfiles/h5diff_221.txt12
-rw-r--r--tools/test/h5diff/testfiles/h5diff_222.txt20
-rw-r--r--tools/test/h5diff/testfiles/h5diff_223.txt4
-rw-r--r--tools/test/h5diff/testfiles/h5diff_224.txt4
-rw-r--r--tools/test/h5diff/testfiles/h5diff_23.txt8
-rw-r--r--tools/test/h5diff/testfiles/h5diff_24.txt3
-rw-r--r--tools/test/h5diff/testfiles/h5diff_25.txt3
-rw-r--r--tools/test/h5diff/testfiles/h5diff_26.txt8
-rw-r--r--tools/test/h5diff/testfiles/h5diff_27.txt3
-rw-r--r--tools/test/h5diff/testfiles/h5diff_28.txt3
-rw-r--r--tools/test/h5diff/testfiles/h5diff_30.txt9
-rw-r--r--tools/test/h5diff/testfiles/h5diff_300.txt3
-rw-r--r--tools/test/h5diff/testfiles/h5diff_400.txt35
-rw-r--r--tools/test/h5diff/testfiles/h5diff_401.txt13
-rw-r--r--tools/test/h5diff/testfiles/h5diff_402.txt13
-rw-r--r--tools/test/h5diff/testfiles/h5diff_403.txt13
-rw-r--r--tools/test/h5diff/testfiles/h5diff_404.txt32
-rw-r--r--tools/test/h5diff/testfiles/h5diff_405.txt13
-rw-r--r--tools/test/h5diff/testfiles/h5diff_406.txt13
-rw-r--r--tools/test/h5diff/testfiles/h5diff_407.txt13
-rw-r--r--tools/test/h5diff/testfiles/h5diff_408.txt13
-rw-r--r--tools/test/h5diff/testfiles/h5diff_409.txt13
-rw-r--r--tools/test/h5diff/testfiles/h5diff_410.txt62
-rw-r--r--tools/test/h5diff/testfiles/h5diff_411.txt13
-rw-r--r--tools/test/h5diff/testfiles/h5diff_412.txt13
-rw-r--r--tools/test/h5diff/testfiles/h5diff_413.txt13
-rw-r--r--tools/test/h5diff/testfiles/h5diff_414.txt9
-rw-r--r--tools/test/h5diff/testfiles/h5diff_415.txt9
-rw-r--r--tools/test/h5diff/testfiles/h5diff_416.txt8
-rw-r--r--tools/test/h5diff/testfiles/h5diff_417.txt3
-rw-r--r--tools/test/h5diff/testfiles/h5diff_418.txt3
-rw-r--r--tools/test/h5diff/testfiles/h5diff_419.txt3
-rw-r--r--tools/test/h5diff/testfiles/h5diff_420.txt3
-rw-r--r--tools/test/h5diff/testfiles/h5diff_421.txt3
-rw-r--r--tools/test/h5diff/testfiles/h5diff_422.txt3
-rw-r--r--tools/test/h5diff/testfiles/h5diff_423.txt13
-rw-r--r--tools/test/h5diff/testfiles/h5diff_424.txt13
-rw-r--r--tools/test/h5diff/testfiles/h5diff_425.txt13
-rw-r--r--tools/test/h5diff/testfiles/h5diff_450.txt38
-rw-r--r--tools/test/h5diff/testfiles/h5diff_451.txt30
-rw-r--r--tools/test/h5diff/testfiles/h5diff_452.txt2
-rw-r--r--tools/test/h5diff/testfiles/h5diff_453.txt34
-rw-r--r--tools/test/h5diff/testfiles/h5diff_454.txt2
-rw-r--r--tools/test/h5diff/testfiles/h5diff_455.txt2
-rw-r--r--tools/test/h5diff/testfiles/h5diff_456.txt30
-rw-r--r--tools/test/h5diff/testfiles/h5diff_457.txt2
-rw-r--r--tools/test/h5diff/testfiles/h5diff_458.txt2
-rw-r--r--tools/test/h5diff/testfiles/h5diff_459.txt2
-rw-r--r--tools/test/h5diff/testfiles/h5diff_465.txt1
-rw-r--r--tools/test/h5diff/testfiles/h5diff_466.txt5
-rw-r--r--tools/test/h5diff/testfiles/h5diff_467.txt3
-rw-r--r--tools/test/h5diff/testfiles/h5diff_468.txt5
-rw-r--r--tools/test/h5diff/testfiles/h5diff_469.txt3
-rw-r--r--tools/test/h5diff/testfiles/h5diff_471.txt38
-rw-r--r--tools/test/h5diff/testfiles/h5diff_472.txt3
-rw-r--r--tools/test/h5diff/testfiles/h5diff_473.txt3
-rw-r--r--tools/test/h5diff/testfiles/h5diff_474.txt3
-rw-r--r--tools/test/h5diff/testfiles/h5diff_475.txt3
-rw-r--r--tools/test/h5diff/testfiles/h5diff_480.txt17
-rw-r--r--tools/test/h5diff/testfiles/h5diff_481.txt30
-rw-r--r--tools/test/h5diff/testfiles/h5diff_482.txt17
-rw-r--r--tools/test/h5diff/testfiles/h5diff_483.txt18
-rw-r--r--tools/test/h5diff/testfiles/h5diff_484.txt11
-rw-r--r--tools/test/h5diff/testfiles/h5diff_485.txt11
-rw-r--r--tools/test/h5diff/testfiles/h5diff_486.txt11
-rw-r--r--tools/test/h5diff/testfiles/h5diff_487.txt12
-rw-r--r--tools/test/h5diff/testfiles/h5diff_50.txt13
-rw-r--r--tools/test/h5diff/testfiles/h5diff_500.txt72
-rw-r--r--tools/test/h5diff/testfiles/h5diff_501.txt188
-rw-r--r--tools/test/h5diff/testfiles/h5diff_502.txt36
-rw-r--r--tools/test/h5diff/testfiles/h5diff_503.txt32
-rw-r--r--tools/test/h5diff/testfiles/h5diff_504.txt19
-rw-r--r--tools/test/h5diff/testfiles/h5diff_505.txt6
-rw-r--r--tools/test/h5diff/testfiles/h5diff_506.txt26
-rw-r--r--tools/test/h5diff/testfiles/h5diff_507.txt6
-rw-r--r--tools/test/h5diff/testfiles/h5diff_508.txt32
-rw-r--r--tools/test/h5diff/testfiles/h5diff_509.txt6
-rw-r--r--tools/test/h5diff/testfiles/h5diff_51.txt10
-rw-r--r--tools/test/h5diff/testfiles/h5diff_510.txt32
-rw-r--r--tools/test/h5diff/testfiles/h5diff_511.txt24
-rw-r--r--tools/test/h5diff/testfiles/h5diff_512.txt53
-rw-r--r--tools/test/h5diff/testfiles/h5diff_513.txt3
-rw-r--r--tools/test/h5diff/testfiles/h5diff_514.txt53
-rw-r--r--tools/test/h5diff/testfiles/h5diff_515.txt27
-rw-r--r--tools/test/h5diff/testfiles/h5diff_516.txt32
-rw-r--r--tools/test/h5diff/testfiles/h5diff_517.txt18
-rw-r--r--tools/test/h5diff/testfiles/h5diff_518.txt23
-rw-r--r--tools/test/h5diff/testfiles/h5diff_52.txt10
-rw-r--r--tools/test/h5diff/testfiles/h5diff_53.txt10
-rw-r--r--tools/test/h5diff/testfiles/h5diff_530.txt35
-rw-r--r--tools/test/h5diff/testfiles/h5diff_54.txt10
-rw-r--r--tools/test/h5diff/testfiles/h5diff_540.txt86
-rw-r--r--tools/test/h5diff/testfiles/h5diff_55.txt10
-rw-r--r--tools/test/h5diff/testfiles/h5diff_56.txt10
-rw-r--r--tools/test/h5diff/testfiles/h5diff_57.txt11
-rw-r--r--tools/test/h5diff/testfiles/h5diff_58.txt11
-rw-r--r--tools/test/h5diff/testfiles/h5diff_59.txt11
-rw-r--r--tools/test/h5diff/testfiles/h5diff_600.txt141
-rw-r--r--tools/test/h5diff/testfiles/h5diff_601.txt2
-rw-r--r--tools/test/h5diff/testfiles/h5diff_603.txt141
-rw-r--r--tools/test/h5diff/testfiles/h5diff_604.txt3
-rw-r--r--tools/test/h5diff/testfiles/h5diff_605.txt3
-rw-r--r--tools/test/h5diff/testfiles/h5diff_606.txt141
-rw-r--r--tools/test/h5diff/testfiles/h5diff_607.txt3
-rw-r--r--tools/test/h5diff/testfiles/h5diff_608.txt3
-rw-r--r--tools/test/h5diff/testfiles/h5diff_609.txt1
-rw-r--r--tools/test/h5diff/testfiles/h5diff_610.txt3
-rw-r--r--tools/test/h5diff/testfiles/h5diff_612.txt141
-rw-r--r--tools/test/h5diff/testfiles/h5diff_613.txt3
-rw-r--r--tools/test/h5diff/testfiles/h5diff_614.txt3
-rw-r--r--tools/test/h5diff/testfiles/h5diff_615.txt141
-rw-r--r--tools/test/h5diff/testfiles/h5diff_616.txt3
-rw-r--r--tools/test/h5diff/testfiles/h5diff_617.txt3
-rw-r--r--tools/test/h5diff/testfiles/h5diff_618.txt1
-rw-r--r--tools/test/h5diff/testfiles/h5diff_619.txt3
-rw-r--r--tools/test/h5diff/testfiles/h5diff_621.txt141
-rw-r--r--tools/test/h5diff/testfiles/h5diff_622.txt141
-rw-r--r--tools/test/h5diff/testfiles/h5diff_623.txt141
-rw-r--r--tools/test/h5diff/testfiles/h5diff_624.txt141
-rw-r--r--tools/test/h5diff/testfiles/h5diff_625.txt3
-rw-r--r--tools/test/h5diff/testfiles/h5diff_626.txt3
-rw-r--r--tools/test/h5diff/testfiles/h5diff_627.txt3
-rw-r--r--tools/test/h5diff/testfiles/h5diff_628.txt3
-rw-r--r--tools/test/h5diff/testfiles/h5diff_629.txt2
-rw-r--r--tools/test/h5diff/testfiles/h5diff_630.txt3
-rw-r--r--tools/test/h5diff/testfiles/h5diff_631.txt3
-rw-r--r--tools/test/h5diff/testfiles/h5diff_640.txt4
-rw-r--r--tools/test/h5diff/testfiles/h5diff_641.txt4
-rw-r--r--tools/test/h5diff/testfiles/h5diff_642.txt4
-rw-r--r--tools/test/h5diff/testfiles/h5diff_643.txt4
-rw-r--r--tools/test/h5diff/testfiles/h5diff_644.txt4
-rw-r--r--tools/test/h5diff/testfiles/h5diff_645.txt4
-rw-r--r--tools/test/h5diff/testfiles/h5diff_646.txt4
-rw-r--r--tools/test/h5diff/testfiles/h5diff_70.txt2032
-rw-r--r--tools/test/h5diff/testfiles/h5diff_700.txt2038
-rw-r--r--tools/test/h5diff/testfiles/h5diff_701.txt2137
-rw-r--r--tools/test/h5diff/testfiles/h5diff_702.txt2038
-rw-r--r--tools/test/h5diff/testfiles/h5diff_703.txt2137
-rw-r--r--tools/test/h5diff/testfiles/h5diff_704.txt28
-rw-r--r--tools/test/h5diff/testfiles/h5diff_705.txt17
-rw-r--r--tools/test/h5diff/testfiles/h5diff_706.txt13
-rw-r--r--tools/test/h5diff/testfiles/h5diff_707.txt29
-rw-r--r--tools/test/h5diff/testfiles/h5diff_708.txt17
-rw-r--r--tools/test/h5diff/testfiles/h5diff_709.txt12
-rw-r--r--tools/test/h5diff/testfiles/h5diff_710.txt108
-rw-r--r--tools/test/h5diff/testfiles/h5diff_80.txt881
-rw-r--r--tools/test/h5diff/testfiles/h5diff_90.txt50
-rw-r--r--tools/test/h5diff/testfiles/h5diff_attr1.h5bin0 -> 26000 bytes
-rw-r--r--tools/test/h5diff/testfiles/h5diff_attr2.h5bin0 -> 26000 bytes
-rw-r--r--tools/test/h5diff/testfiles/h5diff_attr_v_level1.h5bin0 -> 7192 bytes
-rw-r--r--tools/test/h5diff/testfiles/h5diff_attr_v_level2.h5bin0 -> 7048 bytes
-rw-r--r--tools/test/h5diff/testfiles/h5diff_basic1.h5bin0 -> 12248 bytes
-rw-r--r--tools/test/h5diff/testfiles/h5diff_basic2.h5bin0 -> 9008 bytes
-rw-r--r--tools/test/h5diff/testfiles/h5diff_comp_vl_strs.h5bin0 -> 37952 bytes
-rw-r--r--tools/test/h5diff/testfiles/h5diff_danglelinks1.h5bin0 -> 4970 bytes
-rw-r--r--tools/test/h5diff/testfiles/h5diff_danglelinks2.h5bin0 -> 4970 bytes
-rw-r--r--tools/test/h5diff/testfiles/h5diff_dset1.h5bin0 -> 23624 bytes
-rw-r--r--tools/test/h5diff/testfiles/h5diff_dset2.h5bin0 -> 23624 bytes
-rw-r--r--tools/test/h5diff/testfiles/h5diff_dset_zero_dim_size1.h5bin0 -> 1672 bytes
-rw-r--r--tools/test/h5diff/testfiles/h5diff_dset_zero_dim_size2.h5bin0 -> 1672 bytes
-rw-r--r--tools/test/h5diff/testfiles/h5diff_dtypes.h5bin0 -> 11416 bytes
-rw-r--r--tools/test/h5diff/testfiles/h5diff_empty.h5bin0 -> 800 bytes
-rw-r--r--tools/test/h5diff/testfiles/h5diff_enum_invalid_values.h5bin0 -> 2192 bytes
-rw-r--r--tools/test/h5diff/testfiles/h5diff_exclude1-1.h5bin0 -> 5064 bytes
-rw-r--r--tools/test/h5diff/testfiles/h5diff_exclude1-2.h5bin0 -> 5064 bytes
-rw-r--r--tools/test/h5diff/testfiles/h5diff_exclude2-1.h5bin0 -> 5064 bytes
-rw-r--r--tools/test/h5diff/testfiles/h5diff_exclude2-2.h5bin0 -> 6056 bytes
-rw-r--r--tools/test/h5diff/testfiles/h5diff_exclude3-1.h5bin0 -> 4792 bytes
-rw-r--r--tools/test/h5diff/testfiles/h5diff_exclude3-2.h5bin0 -> 2176 bytes
-rw-r--r--tools/test/h5diff/testfiles/h5diff_ext2softlink_src.h5bin0 -> 1072 bytes
-rw-r--r--tools/test/h5diff/testfiles/h5diff_ext2softlink_trg.h5bin0 -> 4640 bytes
-rw-r--r--tools/test/h5diff/testfiles/h5diff_extlink_src.h5bin0 -> 1256 bytes
-rw-r--r--tools/test/h5diff/testfiles/h5diff_extlink_trg.h5bin0 -> 6056 bytes
-rw-r--r--tools/test/h5diff/testfiles/h5diff_grp_recurse1.h5bin0 -> 11826 bytes
-rw-r--r--tools/test/h5diff/testfiles/h5diff_grp_recurse2.h5bin0 -> 11826 bytes
-rw-r--r--tools/test/h5diff/testfiles/h5diff_grp_recurse_ext1.h5bin0 -> 8120 bytes
-rw-r--r--tools/test/h5diff/testfiles/h5diff_grp_recurse_ext2-1.h5bin0 -> 4296 bytes
-rw-r--r--tools/test/h5diff/testfiles/h5diff_grp_recurse_ext2-2.h5bin0 -> 5640 bytes
-rw-r--r--tools/test/h5diff/testfiles/h5diff_grp_recurse_ext2-3.h5bin0 -> 2464 bytes
-rw-r--r--tools/test/h5diff/testfiles/h5diff_hyper1.h5bin0 -> 1052720 bytes
-rw-r--r--tools/test/h5diff/testfiles/h5diff_hyper2.h5bin0 -> 1052720 bytes
-rw-r--r--tools/test/h5diff/testfiles/h5diff_linked_softlink.h5bin0 -> 8144 bytes
-rw-r--r--tools/test/h5diff/testfiles/h5diff_links.h5bin0 -> 2536 bytes
-rw-r--r--tools/test/h5diff/testfiles/h5diff_softlinks.h5bin0 -> 5744 bytes
-rw-r--r--tools/test/h5diff/testfiles/h5diff_tmp1.txt5
-rw-r--r--tools/test/h5diff/testfiles/h5diff_tmp2.txt13
-rw-r--r--tools/test/h5diff/testfiles/h5diff_types.h5bin0 -> 4778 bytes
-rw-r--r--tools/test/h5diff/testfiles/h5diff_v1.txt18
-rw-r--r--tools/test/h5diff/testfiles/h5diff_v2.txt7
-rw-r--r--tools/test/h5diff/testfiles/h5diff_v3.txt4
-rw-r--r--tools/test/h5diff/testfiles/non_comparables1.h5bin0 -> 8628 bytes
-rw-r--r--tools/test/h5diff/testfiles/non_comparables2.h5bin0 -> 8644 bytes
-rw-r--r--tools/test/h5diff/testfiles/tmpSingleSiteBethe.output.h5bin0 -> 124440 bytes
-rw-r--r--tools/test/h5diff/testfiles/tmpSingleSiteBethe.reference.h5bin0 -> 119464 bytes
-rw-r--r--tools/test/h5diff/testfiles/tmptest.he5bin0 -> 4740424 bytes
-rw-r--r--tools/test/h5diff/testfiles/tmptest2.he5bin0 -> 4734280 bytes
-rw-r--r--tools/test/h5diff/testh5diff.sh.in1160
-rw-r--r--tools/test/h5diff/testph5diff.sh.in64
-rw-r--r--tools/test/h5dump/CMakeLists.txt28
-rw-r--r--tools/test/h5dump/CMakeTests.cmake1412
-rw-r--r--tools/test/h5dump/CMakeTestsPBITS.cmake340
-rw-r--r--tools/test/h5dump/CMakeTestsVDS.cmake233
-rw-r--r--tools/test/h5dump/CMakeTestsXML.cmake414
-rw-r--r--tools/test/h5dump/Makefile.am42
-rw-r--r--tools/test/h5dump/binread.c97
-rw-r--r--tools/test/h5dump/errfiles/filter_fail.err24
-rw-r--r--tools/test/h5dump/errfiles/non_existing.err1
-rw-r--r--tools/test/h5dump/errfiles/tall-1.err25
-rw-r--r--tools/test/h5dump/errfiles/tall-2A.err25
-rw-r--r--tools/test/h5dump/errfiles/tall-2A0.err25
-rw-r--r--tools/test/h5dump/errfiles/tall-2B.err25
-rw-r--r--tools/test/h5dump/errfiles/tarray1_big.err31
-rw-r--r--tools/test/h5dump/errfiles/tattr-3.err8
-rw-r--r--tools/test/h5dump/errfiles/tattrregR.err21
-rw-r--r--tools/test/h5dump/errfiles/tcomp-3.err16
-rw-r--r--tools/test/h5dump/errfiles/tdataregR.err21
-rw-r--r--tools/test/h5dump/errfiles/tdset-2.err36
-rw-r--r--tools/test/h5dump/errfiles/texceedsubblock.err1
-rw-r--r--tools/test/h5dump/errfiles/texceedsubcount.err1
-rw-r--r--tools/test/h5dump/errfiles/texceedsubstart.err1
-rw-r--r--tools/test/h5dump/errfiles/texceedsubstride.err1
-rw-r--r--tools/test/h5dump/errfiles/textlink.err50
-rw-r--r--tools/test/h5dump/errfiles/textlinkfar.err243
-rw-r--r--tools/test/h5dump/errfiles/textlinksrc.err243
-rw-r--r--tools/test/h5dump/errfiles/tgroup-2.err20
-rw-r--r--tools/test/h5dump/errfiles/tnofilename-with-packed-bits.err1
-rw-r--r--tools/test/h5dump/errfiles/torderlinks1.err25
-rw-r--r--tools/test/h5dump/errfiles/torderlinks2.err25
-rw-r--r--tools/test/h5dump/errfiles/tpbitsCharLengthExceeded.err1
-rw-r--r--tools/test/h5dump/errfiles/tpbitsCharOffsetExceeded.err1
-rw-r--r--tools/test/h5dump/errfiles/tpbitsIncomplete.err1
-rw-r--r--tools/test/h5dump/errfiles/tpbitsIntLengthExceeded.err1
-rw-r--r--tools/test/h5dump/errfiles/tpbitsIntOffsetExceeded.err1
-rw-r--r--tools/test/h5dump/errfiles/tpbitsLengthExceeded.err1
-rw-r--r--tools/test/h5dump/errfiles/tpbitsLengthPositive.err1
-rw-r--r--tools/test/h5dump/errfiles/tpbitsLongLengthExceeded.err1
-rw-r--r--tools/test/h5dump/errfiles/tpbitsLongOffsetExceeded.err1
-rw-r--r--tools/test/h5dump/errfiles/tpbitsMaxExceeded.err1
-rw-r--r--tools/test/h5dump/errfiles/tpbitsOffsetExceeded.err1
-rw-r--r--tools/test/h5dump/errfiles/tpbitsOffsetNegative.err1
-rw-r--r--tools/test/h5dump/errfiles/tperror.err36
-rw-r--r--tools/test/h5dump/errfiles/tqmarkfile.err33
-rw-r--r--tools/test/h5dump/errfiles/tslink-D.err28
-rw-r--r--tools/test/h5dump/h5dumpgentest.c10388
-rw-r--r--tools/test/h5dump/testh5dump.sh.in1345
-rw-r--r--tools/test/h5dump/testh5dumppbits.sh.in598
-rw-r--r--tools/test/h5dump/testh5dumpvds.sh.in523
-rw-r--r--tools/test/h5dump/testh5dumpxml.sh.in388
-rw-r--r--tools/test/h5format_convert/CMakeLists.txt28
-rw-r--r--tools/test/h5format_convert/CMakeTests.cmake460
-rw-r--r--tools/test/h5format_convert/Makefile.am43
-rw-r--r--tools/test/h5format_convert/h5fc_chk_idx.c103
-rw-r--r--tools/test/h5format_convert/h5fc_gentest.c812
-rw-r--r--tools/test/h5format_convert/testfiles/h5fc_d_file.ddl26
-rw-r--r--tools/test/h5format_convert/testfiles/h5fc_dname.ddl26
-rw-r--r--tools/test/h5format_convert/testfiles/h5fc_edge_v3.h5bin0 -> 2526 bytes
-rw-r--r--tools/test/h5format_convert/testfiles/h5fc_err_level.h5bin0 -> 7294 bytes
-rw-r--r--tools/test/h5format_convert/testfiles/h5fc_ext1_f.ddl58
-rw-r--r--tools/test/h5format_convert/testfiles/h5fc_ext1_f.h5bin0 -> 8296 bytes
-rw-r--r--tools/test/h5format_convert/testfiles/h5fc_ext1_i.ddl58
-rw-r--r--tools/test/h5format_convert/testfiles/h5fc_ext1_i.h5bin0 -> 8062 bytes
-rw-r--r--tools/test/h5format_convert/testfiles/h5fc_ext1_s.ddl58
-rw-r--r--tools/test/h5format_convert/testfiles/h5fc_ext1_s.h5bin0 -> 8128 bytes
-rw-r--r--tools/test/h5format_convert/testfiles/h5fc_ext2_if.ddl58
-rw-r--r--tools/test/h5format_convert/testfiles/h5fc_ext2_if.h5bin0 -> 8062 bytes
-rw-r--r--tools/test/h5format_convert/testfiles/h5fc_ext2_is.ddl58
-rw-r--r--tools/test/h5format_convert/testfiles/h5fc_ext2_is.h5bin0 -> 8178 bytes
-rw-r--r--tools/test/h5format_convert/testfiles/h5fc_ext2_sf.ddl58
-rw-r--r--tools/test/h5format_convert/testfiles/h5fc_ext2_sf.h5bin0 -> 6612 bytes
-rw-r--r--tools/test/h5format_convert/testfiles/h5fc_ext3_isf.ddl58
-rw-r--r--tools/test/h5format_convert/testfiles/h5fc_ext3_isf.h5bin0 -> 8215 bytes
-rw-r--r--tools/test/h5format_convert/testfiles/h5fc_ext_none.h5bin0 -> 8010 bytes
-rw-r--r--tools/test/h5format_convert/testfiles/h5fc_help.ddl25
-rw-r--r--tools/test/h5format_convert/testfiles/h5fc_non_v3.h5bin0 -> 6818 bytes
-rw-r--r--tools/test/h5format_convert/testfiles/h5fc_nonexistdset_file.ddl1
-rw-r--r--tools/test/h5format_convert/testfiles/h5fc_nonexistfile.ddl1
-rw-r--r--tools/test/h5format_convert/testfiles/h5fc_nooption.ddl25
-rw-r--r--tools/test/h5format_convert/testfiles/h5fc_v_all.ddl77
-rw-r--r--tools/test/h5format_convert/testfiles/h5fc_v_bt1.ddl12
-rw-r--r--tools/test/h5format_convert/testfiles/h5fc_v_err.ddl13
-rw-r--r--tools/test/h5format_convert/testfiles/h5fc_v_n_1d.ddl14
-rw-r--r--tools/test/h5format_convert/testfiles/h5fc_v_n_all.ddl56
-rw-r--r--tools/test/h5format_convert/testfiles/h5fc_v_ndata_bt1.ddl13
-rw-r--r--tools/test/h5format_convert/testfiles/h5fc_v_non_chunked.ddl12
-rw-r--r--tools/test/h5format_convert/testfiles/old_h5fc_ext1_f.ddl58
-rw-r--r--tools/test/h5format_convert/testfiles/old_h5fc_ext1_f.h5bin0 -> 19987 bytes
-rw-r--r--tools/test/h5format_convert/testfiles/old_h5fc_ext1_i.ddl58
-rw-r--r--tools/test/h5format_convert/testfiles/old_h5fc_ext1_i.h5bin0 -> 32716 bytes
-rw-r--r--tools/test/h5format_convert/testfiles/old_h5fc_ext1_s.ddl58
-rw-r--r--tools/test/h5format_convert/testfiles/old_h5fc_ext1_s.h5bin0 -> 20032 bytes
-rw-r--r--tools/test/h5format_convert/testfiles/old_h5fc_ext2_if.ddl58
-rw-r--r--tools/test/h5format_convert/testfiles/old_h5fc_ext2_if.h5bin0 -> 32720 bytes
-rw-r--r--tools/test/h5format_convert/testfiles/old_h5fc_ext2_is.ddl58
-rw-r--r--tools/test/h5format_convert/testfiles/old_h5fc_ext2_is.h5bin0 -> 32872 bytes
-rw-r--r--tools/test/h5format_convert/testfiles/old_h5fc_ext2_sf.ddl58
-rw-r--r--tools/test/h5format_convert/testfiles/old_h5fc_ext2_sf.h5bin0 -> 18512 bytes
-rw-r--r--tools/test/h5format_convert/testfiles/old_h5fc_ext3_isf.ddl58
-rw-r--r--tools/test/h5format_convert/testfiles/old_h5fc_ext3_isf.h5bin0 -> 32896 bytes
-rw-r--r--tools/test/h5format_convert/testfiles/old_h5fc_ext_none.h5bin0 -> 19912 bytes
-rw-r--r--tools/test/h5format_convert/testh5fc.sh.in505
-rw-r--r--tools/test/h5import/CMakeLists.txt18
-rw-r--r--tools/test/h5import/CMakeTests.cmake465
-rw-r--r--tools/test/h5import/Makefile.am40
-rw-r--r--tools/test/h5import/h5importtest.c371
-rw-r--r--tools/test/h5import/h5importtestutil.sh.in384
-rw-r--r--tools/test/h5import/testfiles/binfp64.conf13
-rw-r--r--tools/test/h5import/testfiles/binfp64.h5bin0 -> 10760 bytes
-rw-r--r--tools/test/h5import/testfiles/binin16.conf12
-rw-r--r--tools/test/h5import/testfiles/binin16.h5bin0 -> 10760 bytes
-rw-r--r--tools/test/h5import/testfiles/binin32.conf12
-rw-r--r--tools/test/h5import/testfiles/binin32.h5bin0 -> 9472 bytes
-rw-r--r--tools/test/h5import/testfiles/binin8.conf16
-rw-r--r--tools/test/h5import/testfiles/binin8.h5bin0 -> 10760 bytes
-rw-r--r--tools/test/h5import/testfiles/binin8w.conf9
-rw-r--r--tools/test/h5import/testfiles/binin8w.h5bin0 -> 2852 bytes
-rw-r--r--tools/test/h5import/testfiles/binuin16.conf12
-rw-r--r--tools/test/h5import/testfiles/binuin16.h5bin0 -> 10760 bytes
-rw-r--r--tools/test/h5import/testfiles/binuin32.conf12
-rw-r--r--tools/test/h5import/testfiles/binuin32.h5bin0 -> 6384 bytes
-rw-r--r--tools/test/h5import/testfiles/dbinfp64.h5.txt2
-rw-r--r--tools/test/h5import/testfiles/dbinin16.h5.txt2
-rw-r--r--tools/test/h5import/testfiles/dbinin32.h5.txt2
-rw-r--r--tools/test/h5import/testfiles/dbinin8.h5.txt2
-rw-r--r--tools/test/h5import/testfiles/dbinin8w.h5.txt2
-rw-r--r--tools/test/h5import/testfiles/dbinuin16.h5.txt2
-rw-r--r--tools/test/h5import/testfiles/dbinuin32.h5.txt2
-rw-r--r--tools/test/h5import/testfiles/dtxtstr.h5.txt2
-rw-r--r--tools/test/h5import/testfiles/textpfe.conf12
-rw-r--r--tools/test/h5import/testfiles/textpfe.h5bin0 -> 2064 bytes
-rw-r--r--tools/test/h5import/testfiles/textpfe64.txt2
-rw-r--r--tools/test/h5import/testfiles/txtfp32.conf10
-rw-r--r--tools/test/h5import/testfiles/txtfp32.h5bin0 -> 4192 bytes
-rw-r--r--tools/test/h5import/testfiles/txtfp32.txt9
-rw-r--r--tools/test/h5import/testfiles/txtfp64.conf13
-rw-r--r--tools/test/h5import/testfiles/txtfp64.h5bin0 -> 9784 bytes
-rw-r--r--tools/test/h5import/testfiles/txtfp64.txt19
-rw-r--r--tools/test/h5import/testfiles/txtin16.conf12
-rw-r--r--tools/test/h5import/testfiles/txtin16.h5bin0 -> 9784 bytes
-rw-r--r--tools/test/h5import/testfiles/txtin16.txt15
-rw-r--r--tools/test/h5import/testfiles/txtin32.conf11
-rw-r--r--tools/test/h5import/testfiles/txtin32.h5bin0 -> 4192 bytes
-rw-r--r--tools/test/h5import/testfiles/txtin32.txt15
-rw-r--r--tools/test/h5import/testfiles/txtin8.conf18
-rw-r--r--tools/test/h5import/testfiles/txtin8.h5bin0 -> 9784 bytes
-rw-r--r--tools/test/h5import/testfiles/txtin8.txt15
-rw-r--r--tools/test/h5import/testfiles/txtstr.conf6
-rw-r--r--tools/test/h5import/testfiles/txtstr.h5bin0 -> 10240 bytes
-rw-r--r--tools/test/h5import/testfiles/txtstr.txt2
-rw-r--r--tools/test/h5import/testfiles/txtuin16.conf12
-rw-r--r--tools/test/h5import/testfiles/txtuin16.h5bin0 -> 10240 bytes
-rw-r--r--tools/test/h5import/testfiles/txtuin16.txt15
-rw-r--r--tools/test/h5import/testfiles/txtuin32.conf11
-rw-r--r--tools/test/h5import/testfiles/txtuin32.h5bin0 -> 6240 bytes
-rw-r--r--tools/test/h5import/testfiles/txtuin32.txt15
-rw-r--r--tools/test/h5jam/CMakeLists.txt34
-rw-r--r--tools/test/h5jam/CMakeTests.cmake384
-rw-r--r--tools/test/h5jam/Makefile.am40
-rw-r--r--tools/test/h5jam/getub.c157
-rw-r--r--tools/test/h5jam/h5jamgentest.c389
-rw-r--r--tools/test/h5jam/tellub.c196
-rw-r--r--tools/test/h5jam/testfiles/h5jam-help.txt24
-rw-r--r--tools/test/h5jam/testfiles/h5jam-ub-nohdf5.txt2
-rw-r--r--tools/test/h5jam/testfiles/h5unjam-help.txt27
-rw-r--r--tools/test/h5jam/testfiles/tall.h5bin0 -> 9968 bytes
-rw-r--r--tools/test/h5jam/testfiles/twithub.h5bin0 -> 10592 bytes
-rw-r--r--tools/test/h5jam/testfiles/twithub513.h5bin0 -> 11056 bytes
-rw-r--r--tools/test/h5jam/testfiles/u10.txt1
-rw-r--r--tools/test/h5jam/testfiles/u511.txt1
-rw-r--r--tools/test/h5jam/testfiles/u512.txt1
-rw-r--r--tools/test/h5jam/testfiles/u513.txt1
-rw-r--r--tools/test/h5jam/testh5jam.sh.in699
-rw-r--r--tools/test/h5ls/CMakeLists.txt11
-rw-r--r--tools/test/h5ls/CMakeTests.cmake390
-rw-r--r--tools/test/h5ls/CMakeTestsVDS.cmake137
-rw-r--r--tools/test/h5ls/Makefile.am34
-rw-r--r--tools/test/h5ls/testh5ls.sh.in436
-rw-r--r--tools/test/h5ls/testh5lsvds.sh.in258
-rw-r--r--tools/test/h5repack/CMakeLists.txt79
-rw-r--r--tools/test/h5repack/CMakeTests.cmake1153
-rw-r--r--tools/test/h5repack/Makefile.am67
-rw-r--r--tools/test/h5repack/dynlib_rpk.c97
-rw-r--r--tools/test/h5repack/dynlib_vrpk.c104
-rw-r--r--tools/test/h5repack/h5repack.sh.in1265
-rw-r--r--tools/test/h5repack/h5repack_plugin.sh.in275
-rw-r--r--tools/test/h5repack/h5repacktst.c6856
-rw-r--r--tools/test/h5repack/testfiles/1_vds.h5-vds_dset_chunk20x10x5-v.ddl112
-rw-r--r--tools/test/h5repack/testfiles/2_vds.h5-vds_chunk3x6x9-v.ddl70
-rw-r--r--tools/test/h5repack/testfiles/3_1_vds.h5-vds_chunk2x5x8-v.ddl147
-rw-r--r--tools/test/h5repack/testfiles/4_vds.h5-vds_compa-v.ddl58
-rw-r--r--tools/test/h5repack/testfiles/4_vds.h5-vds_conti-v.ddl59
-rw-r--r--tools/test/h5repack/testfiles/README5
-rw-r--r--tools/test/h5repack/testfiles/deflate_limit.h5repack_layout.h5.ddl130
-rw-r--r--tools/test/h5repack/testfiles/h5repack-help.txt125
-rw-r--r--tools/test/h5repack/testfiles/h5repack.info1
-rw-r--r--tools/test/h5repack/testfiles/h5repack_attr.h5bin0 -> 21856 bytes
-rw-r--r--tools/test/h5repack/testfiles/h5repack_attr_refs.h5bin0 -> 10336 bytes
-rw-r--r--tools/test/h5repack/testfiles/h5repack_deflate.h5bin0 -> 6336 bytes
-rw-r--r--tools/test/h5repack/testfiles/h5repack_early.h5bin0 -> 3074224 bytes
-rw-r--r--tools/test/h5repack/testfiles/h5repack_ext.binbin0 -> 8 bytes
-rw-r--r--tools/test/h5repack/testfiles/h5repack_ext.h5bin0 -> 1464 bytes
-rw-r--r--tools/test/h5repack/testfiles/h5repack_fill.h5bin0 -> 2168 bytes
-rw-r--r--tools/test/h5repack/testfiles/h5repack_filters.h5bin0 -> 27604 bytes
-rw-r--r--tools/test/h5repack/testfiles/h5repack_filters.h5-gzip_verbose_filters.tst13
-rw-r--r--tools/test/h5repack/testfiles/h5repack_fletcher.h5bin0 -> 7232 bytes
-rw-r--r--tools/test/h5repack/testfiles/h5repack_hlink.h5bin0 -> 6544 bytes
-rw-r--r--tools/test/h5repack/testfiles/h5repack_layout.UD.h5bin0 -> 43744 bytes
-rw-r--r--tools/test/h5repack/testfiles/h5repack_layout.UD.h5-plugin_none.ddl130
-rw-r--r--tools/test/h5repack/testfiles/h5repack_layout.h5bin0 -> 29480 bytes
-rw-r--r--tools/test/h5repack/testfiles/h5repack_layout.h5-dset2_chunk_20x10-errstk.tst38
-rw-r--r--tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_test.ddl158
-rw-r--r--tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl158
-rw-r--r--tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_zero.tst9
-rw-r--r--tools/test/h5repack/testfiles/h5repack_layout.h5.ddl606
-rw-r--r--tools/test/h5repack/testfiles/h5repack_layout2.h5bin0 -> 6808 bytes
-rw-r--r--tools/test/h5repack/testfiles/h5repack_layout3.h5bin0 -> 491840 bytes
-rw-r--r--tools/test/h5repack/testfiles/h5repack_layouto.h5bin0 -> 1576 bytes
-rw-r--r--tools/test/h5repack/testfiles/h5repack_named_dtypes.h5bin0 -> 4320 bytes
-rw-r--r--tools/test/h5repack/testfiles/h5repack_nbit.h5bin0 -> 13208 bytes
-rw-r--r--tools/test/h5repack/testfiles/h5repack_nested_8bit_enum.h5bin0 -> 273992 bytes
-rw-r--r--tools/test/h5repack/testfiles/h5repack_nested_8bit_enum_deflated.h5bin0 -> 120630 bytes
-rw-r--r--tools/test/h5repack/testfiles/h5repack_objs.h5bin0 -> 19738 bytes
-rw-r--r--tools/test/h5repack/testfiles/h5repack_refs.h5bin0 -> 10336 bytes
-rw-r--r--tools/test/h5repack/testfiles/h5repack_shuffle.h5bin0 -> 7216 bytes
-rw-r--r--tools/test/h5repack/testfiles/h5repack_soffset.h5bin0 -> 12452 bytes
-rw-r--r--tools/test/h5repack/testfiles/h5repack_szip.h5bin0 -> 5588 bytes
-rw-r--r--tools/test/h5repack/testfiles/plugin_none.h5repack_layout.UD.h5.tst14
-rw-r--r--tools/test/h5repack/testfiles/plugin_test.h5repack_layout.h5.tst14
-rw-r--r--tools/test/h5repack/testfiles/plugin_version_test.h5repack_layout.h5.tst14
-rw-r--r--tools/test/h5repack/testfiles/ublock.bin1
-rw-r--r--tools/test/h5repack/testh5repack_detect_szip.c62
-rw-r--r--tools/test/h5stat/CMakeLists.txt22
-rw-r--r--tools/test/h5stat/CMakeTests.cmake237
-rw-r--r--tools/test/h5stat/Makefile.am48
-rw-r--r--tools/test/h5stat/h5stat_gentest.c449
-rw-r--r--tools/test/h5stat/testfiles/h5stat_dims1.ddl45
-rw-r--r--tools/test/h5stat/testfiles/h5stat_dims2.ddl36
-rw-r--r--tools/test/h5stat/testfiles/h5stat_err1_dims.ddl1
-rw-r--r--tools/test/h5stat/testfiles/h5stat_err1_links.ddl1
-rw-r--r--tools/test/h5stat/testfiles/h5stat_err1_numattrs.ddl1
-rw-r--r--tools/test/h5stat/testfiles/h5stat_err2_numattrs.ddl1
-rw-r--r--tools/test/h5stat/testfiles/h5stat_filters-F.ddl26
-rw-r--r--tools/test/h5stat/testfiles/h5stat_filters-UD.ddl5
-rw-r--r--tools/test/h5stat/testfiles/h5stat_filters-UT.ddl10
-rw-r--r--tools/test/h5stat/testfiles/h5stat_filters-d.ddl32
-rw-r--r--tools/test/h5stat/testfiles/h5stat_filters-dT.ddl41
-rw-r--r--tools/test/h5stat/testfiles/h5stat_filters-file.ddl9
-rw-r--r--tools/test/h5stat/testfiles/h5stat_filters-g.ddl6
-rw-r--r--tools/test/h5stat/testfiles/h5stat_filters.ddl97
-rw-r--r--tools/test/h5stat/testfiles/h5stat_filters.h5bin0 -> 46272 bytes
-rw-r--r--tools/test/h5stat/testfiles/h5stat_help1.ddl24
-rw-r--r--tools/test/h5stat/testfiles/h5stat_help2.ddl24
-rw-r--r--tools/test/h5stat/testfiles/h5stat_idx.ddl93
-rw-r--r--tools/test/h5stat/testfiles/h5stat_idx.h5bin0 -> 2206 bytes
-rw-r--r--tools/test/h5stat/testfiles/h5stat_links1.ddl10
-rw-r--r--tools/test/h5stat/testfiles/h5stat_links2.ddl105
-rw-r--r--tools/test/h5stat/testfiles/h5stat_links3.ddl12
-rw-r--r--tools/test/h5stat/testfiles/h5stat_links4.ddl8
-rw-r--r--tools/test/h5stat/testfiles/h5stat_links5.ddl9
-rw-r--r--tools/test/h5stat/testfiles/h5stat_newgrat-UA.ddl7
-rw-r--r--tools/test/h5stat/testfiles/h5stat_newgrat-UG.ddl5
-rw-r--r--tools/test/h5stat/testfiles/h5stat_newgrat.ddl95
-rw-r--r--tools/test/h5stat/testfiles/h5stat_newgrat.h5bin0 -> 6362168 bytes
-rw-r--r--tools/test/h5stat/testfiles/h5stat_nofile.ddl25
-rw-r--r--tools/test/h5stat/testfiles/h5stat_notexist.ddl2
-rw-r--r--tools/test/h5stat/testfiles/h5stat_numattrs1.ddl17
-rw-r--r--tools/test/h5stat/testfiles/h5stat_numattrs2.ddl105
-rw-r--r--tools/test/h5stat/testfiles/h5stat_numattrs3.ddl12
-rw-r--r--tools/test/h5stat/testfiles/h5stat_numattrs4.ddl8
-rw-r--r--tools/test/h5stat/testfiles/h5stat_threshold.h5bin0 -> 16312 bytes
-rw-r--r--tools/test/h5stat/testfiles/h5stat_tsohm.ddl90
-rw-r--r--tools/test/h5stat/testfiles/h5stat_tsohm.h5bin0 -> 3850 bytes
-rw-r--r--tools/test/h5stat/testh5stat.sh.in318
-rw-r--r--tools/test/misc/CMakeLists.txt30
-rw-r--r--tools/test/misc/CMakeTests.cmake253
-rw-r--r--tools/test/misc/Makefile.am47
-rw-r--r--tools/test/misc/h5perf_gentest.c598
-rw-r--r--tools/test/misc/h5repart_gentest.c101
-rw-r--r--tools/test/misc/repart_test.c165
-rw-r--r--tools/test/misc/talign.c244
-rw-r--r--tools/test/misc/testfiles/h5mkgrp_help.txt7
-rw-r--r--tools/test/misc/testfiles/h5mkgrp_version.txt.in1
-rw-r--r--tools/test/misc/testh5mkgrp.sh.in325
-rw-r--r--tools/test/misc/testh5repart.sh.in116
-rw-r--r--tools/test/misc/vds/CMakeLists.txt28
-rw-r--r--tools/test/misc/vds/Makefile.am38
-rw-r--r--tools/test/misc/vds/UC_1.h121
-rw-r--r--tools/test/misc/vds/UC_1_one_dim_gen.c269
-rw-r--r--tools/test/misc/vds/UC_2.h110
-rw-r--r--tools/test/misc/vds/UC_2_two_dims_gen.c270
-rw-r--r--tools/test/misc/vds/UC_3.h74
-rw-r--r--tools/test/misc/vds/UC_3_gaps_gen.c255
-rw-r--r--tools/test/misc/vds/UC_4.h86
-rw-r--r--tools/test/misc/vds/UC_4_printf_gen.c219
-rw-r--r--tools/test/misc/vds/UC_5.h83
-rw-r--r--tools/test/misc/vds/UC_5_stride_gen.c243
-rw-r--r--tools/test/misc/vds/UC_common.h41
-rw-r--r--tools/test/perform/CMakeLists.txt124
-rw-r--r--tools/test/perform/CMakeTests.cmake54
-rw-r--r--tools/test/perform/COPYING16
-rw-r--r--tools/test/perform/Makefile.am79
-rw-r--r--tools/test/perform/build_h5perf_alone.sh28
-rw-r--r--tools/test/perform/build_h5perf_serial_alone.sh28
-rw-r--r--tools/test/perform/chunk.c550
-rw-r--r--tools/test/perform/gen_report.pl527
-rw-r--r--tools/test/perform/iopipe.c508
-rw-r--r--tools/test/perform/overhead.c408
-rw-r--r--tools/test/perform/perf.c494
-rw-r--r--tools/test/perform/perf_meta.c850
-rw-r--r--tools/test/perform/pio_engine.c2683
-rw-r--r--tools/test/perform/pio_perf.c1695
-rw-r--r--tools/test/perform/pio_perf.h105
-rw-r--r--tools/test/perform/pio_standalone.c282
-rw-r--r--tools/test/perform/pio_standalone.h157
-rw-r--r--tools/test/perform/sio_engine.c1313
-rw-r--r--tools/test/perform/sio_perf.c1412
-rw-r--r--tools/test/perform/sio_perf.h104
-rw-r--r--tools/test/perform/sio_standalone.c285
-rw-r--r--tools/test/perform/sio_standalone.h541
-rw-r--r--tools/test/perform/zip_perf.c644
636 files changed, 115683 insertions, 0 deletions
diff --git a/tools/src/CMakeLists.txt b/tools/src/CMakeLists.txt
new file mode 100644
index 0000000..5001b26
--- /dev/null
+++ b/tools/src/CMakeLists.txt
@@ -0,0 +1,37 @@
+cmake_minimum_required (VERSION 3.1.0)
+PROJECT (HDF5_TOOLS_SRC)
+
+#-----------------------------------------------------------------------------
+# Apply Definitions to compiler in this directory and below
+#-----------------------------------------------------------------------------
+add_definitions (${HDF_EXTRA_C_FLAGS})
+
+#-- Add the h5diff and test executables
+add_subdirectory (${HDF5_TOOLS_SRC_SOURCE_DIR}/h5diff)
+
+#-- Add the h5ls executable
+add_subdirectory (${HDF5_TOOLS_SRC_SOURCE_DIR}/h5ls)
+
+#-- Misc Executables
+add_subdirectory (${HDF5_TOOLS_SRC_SOURCE_DIR}/misc)
+
+#-- Add the h5import and test executables
+add_subdirectory (${HDF5_TOOLS_SRC_SOURCE_DIR}/h5import)
+
+#-- h5Repack executables
+add_subdirectory (${HDF5_TOOLS_SRC_SOURCE_DIR}/h5repack)
+
+#-- Add the h5dump and test executables
+add_subdirectory (${HDF5_TOOLS_SRC_SOURCE_DIR}/h5jam)
+
+#-- Add the h5copy and test executables
+add_subdirectory (${HDF5_TOOLS_SRC_SOURCE_DIR}/h5copy)
+
+#-- Add the h5stat and test executables
+add_subdirectory (${HDF5_TOOLS_SRC_SOURCE_DIR}/h5stat)
+
+#-- Add the h5dump and test executables
+add_subdirectory (${HDF5_TOOLS_SRC_SOURCE_DIR}/h5dump)
+
+#-- Add the h5format_convert and test executables
+add_subdirectory (${HDF5_TOOLS_SRC_SOURCE_DIR}/h5format_convert)
diff --git a/tools/src/Makefile.am b/tools/src/Makefile.am
new file mode 100644
index 0000000..0cea969
--- /dev/null
+++ b/tools/src/Makefile.am
@@ -0,0 +1,29 @@
+#
+# 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.
+##
+## Makefile.am
+## Run automake to generate a Makefile.in from this file.
+##
+#
+# Tools HDF5 Makefile(.in)
+#
+
+include $(top_srcdir)/config/commence.am
+
+CONFIG=ordered
+
+# All subdirectories
+SUBDIRS=h5diff h5ls h5dump misc h5import h5repack h5jam h5copy h5stat
+
+include $(top_srcdir)/config/conclude.am
diff --git a/tools/src/h5copy/CMakeLists.txt b/tools/src/h5copy/CMakeLists.txt
new file mode 100644
index 0000000..2a33c9e
--- /dev/null
+++ b/tools/src/h5copy/CMakeLists.txt
@@ -0,0 +1,39 @@
+cmake_minimum_required (VERSION 3.1.0)
+PROJECT (HDF5_TOOLS_SRC_H5COPY)
+
+#-----------------------------------------------------------------------------
+# Setup include Directories
+#-----------------------------------------------------------------------------
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib)
+
+# --------------------------------------------------------------------
+# Add the h5copy and test executables
+# --------------------------------------------------------------------
+add_executable (h5copy ${HDF5_TOOLS_SRC_H5COPY_SOURCE_DIR}/h5copy.c)
+TARGET_NAMING (h5copy STATIC)
+TARGET_C_PROPERTIES (h5copy STATIC " " " ")
+target_link_libraries (h5copy ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+set_target_properties (h5copy PROPERTIES FOLDER tools)
+set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5copy")
+
+set (H5_DEP_EXECUTABLES h5copy)
+
+##############################################################################
+##############################################################################
+### I N S T A L L A T I O N ###
+##############################################################################
+##############################################################################
+
+#-----------------------------------------------------------------------------
+# Rules for Installation of tools using make Install target
+#-----------------------------------------------------------------------------
+
+#INSTALL_PROGRAM_PDB (h5copy ${HDF5_INSTALL_BIN_DIR} toolsapplications)
+
+install (
+ TARGETS
+ h5copy
+ EXPORT
+ ${HDF5_EXPORTED_TARGETS}
+ RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications
+)
diff --git a/tools/src/h5copy/Makefile.am b/tools/src/h5copy/Makefile.am
new file mode 100644
index 0000000..b2cdf92
--- /dev/null
+++ b/tools/src/h5copy/Makefile.am
@@ -0,0 +1,40 @@
+#
+# 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.
+##
+## Makefile.am
+## Run automake to generate a Makefile.in from this file.
+#
+# HDF5 Library Makefile(.in)
+#
+
+include $(top_srcdir)/config/commence.am
+
+# Include src and tools/lib directories
+AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib
+
+# This is our main target, the h5copy tool
+bin_PROGRAMS=h5copy
+check_PROGRAMS=$(TEST_PROG)
+
+# Add h5copy specific linker flags here
+h5copy_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+
+# All programs depend on the hdf5 and h5tools libraries
+LDADD=$(LIBH5TOOLS) $(LIBHDF5)
+
+# Temporary files. *.h5 are generated by h5dumpgentest. They should
+# copied to the testfiles/ directory if update is required.
+CHECK_CLEANFILES+=*.h5
+
+include $(top_srcdir)/config/conclude.am
diff --git a/tools/src/h5copy/h5copy.c b/tools/src/h5copy/h5copy.c
new file mode 100644
index 0000000..5371a21
--- /dev/null
+++ b/tools/src/h5copy/h5copy.c
@@ -0,0 +1,534 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include "H5private.h"
+#include "h5tools.h"
+#include "h5tools_utils.h"
+#include <string.h>
+#include <stdlib.h>
+
+/* Name of tool */
+#define PROGRAMNAME "h5copy"
+
+/* command-line options: short and long-named parameters */
+static const char *s_opts = "d:f:hi:o:ps:vVE";
+static struct long_options l_opts[] = {
+ { "destination", require_arg, 'd' },
+ { "flag", require_arg, 'f' },
+ { "help", no_arg, 'h' },
+ { "input", require_arg, 'i' },
+ { "output", require_arg, 'o' },
+ { "parents", no_arg, 'p' },
+ { "source", require_arg, 's' },
+ { "verbose", no_arg, 'v' },
+ { "version", no_arg, 'V' },
+ { "enable-error-stack", no_arg, 'E' },
+ { NULL, 0, '\0' }
+};
+char *fname_src = NULL;
+char *fname_dst = NULL;
+char *oname_src = NULL;
+char *oname_dst = NULL;
+char *str_flag = NULL;
+
+/*-------------------------------------------------------------------------
+ * Function: leave
+ *
+ * Purpose: Shutdown MPI & HDF5 and call exit()
+ *
+ * Return: Does not return
+ *
+ * Programmer: Quincey Koziol
+ * Saturday, 31. January 2004
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+leave(int ret)
+{
+ if (fname_src)
+ HDfree(fname_src);
+ if (fname_dst)
+ HDfree(fname_dst);
+ if (oname_dst)
+ HDfree(oname_dst);
+ if (oname_src)
+ HDfree(oname_src);
+ if (str_flag)
+ HDfree(str_flag);
+
+ h5tools_close();
+ HDexit(ret);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: usage
+ *
+ * Purpose: Prints a usage message on stderr and then returns.
+ *
+ * Return: void
+ *
+ * Programmer: Pedro Vicente Nunes, 7/8/2006
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+usage (void)
+{
+ FLUSHSTREAM(rawoutstream);
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, "usage: h5copy [OPTIONS] [OBJECTS...]\n");
+ PRINTVALSTREAM(rawoutstream, " OBJECTS\n");
+ PRINTVALSTREAM(rawoutstream, " -i, --input input file name\n");
+ PRINTVALSTREAM(rawoutstream, " -o, --output output file name\n");
+ PRINTVALSTREAM(rawoutstream, " -s, --source source object name\n");
+ PRINTVALSTREAM(rawoutstream, " -d, --destination destination object name\n");
+ PRINTVALSTREAM(rawoutstream, " OPTIONS\n");
+ PRINTVALSTREAM(rawoutstream, " -h, --help Print a usage message and exit\n");
+ PRINTVALSTREAM(rawoutstream, " -p, --parents No error if existing, make parent groups as needed\n");
+ PRINTVALSTREAM(rawoutstream, " -v, --verbose Print information about OBJECTS and OPTIONS\n");
+ PRINTVALSTREAM(rawoutstream, " -V, --version Print version number and exit\n");
+ PRINTVALSTREAM(rawoutstream, " -f, --flag Flag type\n\n");
+ PRINTVALSTREAM(rawoutstream, " Flag type is one of the following strings:\n\n");
+ PRINTVALSTREAM(rawoutstream, " shallow Copy only immediate members for groups\n\n");
+ PRINTVALSTREAM(rawoutstream, " soft Expand soft links into new objects\n\n");
+ PRINTVALSTREAM(rawoutstream, " ext Expand external links into new objects\n\n");
+ PRINTVALSTREAM(rawoutstream, " ref Copy references and any referenced objects, i.e., objects\n");
+ PRINTVALSTREAM(rawoutstream, " that the references point to.\n");
+ PRINTVALSTREAM(rawoutstream, " Referenced objects are copied in addition to the objects\n");
+ PRINTVALSTREAM(rawoutstream, " specified on the command line and reference datasets are\n");
+ PRINTVALSTREAM(rawoutstream, " populated with correct reference values. Copies of referenced\n");
+ PRINTVALSTREAM(rawoutstream, " datasets outside the copy range specified on the command line\n");
+ PRINTVALSTREAM(rawoutstream, " will normally have a different name from the original.\n");
+ PRINTVALSTREAM(rawoutstream, " (Default:Without this option, reference value(s) in any\n");
+ PRINTVALSTREAM(rawoutstream, " reference datasets are set to NULL and referenced objects are\n");
+ PRINTVALSTREAM(rawoutstream, " not copied unless they are otherwise within the copy range\n");
+ PRINTVALSTREAM(rawoutstream, " specified on the command line.)\n\n");
+ PRINTVALSTREAM(rawoutstream, " noattr Copy object without copying attributes\n\n");
+ PRINTVALSTREAM(rawoutstream, " allflags Switches all flags from the default to the non-default setting\n\n");
+ PRINTVALSTREAM(rawoutstream, " These flag types correspond to the following API symbols\n\n");
+ PRINTVALSTREAM(rawoutstream, " H5O_COPY_SHALLOW_HIERARCHY_FLAG\n");
+ PRINTVALSTREAM(rawoutstream, " H5O_COPY_EXPAND_SOFT_LINK_FLAG\n");
+ PRINTVALSTREAM(rawoutstream, " H5O_COPY_EXPAND_EXT_LINK_FLAG\n");
+ PRINTVALSTREAM(rawoutstream, " H5O_COPY_EXPAND_REFERENCE_FLAG\n");
+ PRINTVALSTREAM(rawoutstream, " H5O_COPY_WITHOUT_ATTR_FLAG\n");
+ PRINTVALSTREAM(rawoutstream, " H5O_COPY_ALL\n");
+}
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: parse_flag
+ *
+ * Purpose: read the flag -f STRING
+ *
+ * STRING is one of the following (API symbol and description)
+ *
+ * shallow H5O_COPY_SHALLOW_HIERARCHY_FLAG: Copy only immediate members for groups
+ * soft H5O_COPY_EXPAND_SOFT_LINK_FLAG: Expand soft links into new objects
+ * ext H5O_COPY_EXPAND_EXT_LINK_FLAG: Expand external links into new objects
+ * ref H5O_COPY_EXPAND_OBJ_REFERENCE_FLAG: Copy objects that are pointed by references
+ * noattr H5O_COPY_WITHOUT_ATTR_FLAG Copy object without copying attributes
+ * allflags Switches all flags from the default to the non-default setting
+ *
+ * Return: Success: SUCCEED
+ * Failure: FAIL
+ *
+ * Programmer: Pedro Vicente Nunes, 7/8/2006
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+
+
+static int parse_flag(const char* s_flag, unsigned *flag)
+{
+ unsigned fla=0;
+
+ if (HDstrcmp(s_flag,"shallow")==0)
+ {
+ fla = H5O_COPY_SHALLOW_HIERARCHY_FLAG;
+ }
+ else if (HDstrcmp(s_flag,"soft")==0)
+ {
+ fla = H5O_COPY_EXPAND_SOFT_LINK_FLAG;
+ }
+ else if (HDstrcmp(s_flag,"ext")==0)
+ {
+ fla = H5O_COPY_EXPAND_EXT_LINK_FLAG;
+ }
+ else if (HDstrcmp(s_flag,"ref")==0)
+ {
+ fla = H5O_COPY_EXPAND_REFERENCE_FLAG;
+ }
+ else if (HDstrcmp(s_flag,"noattr")==0)
+ {
+ fla = H5O_COPY_WITHOUT_ATTR_FLAG;
+ }
+ else if (HDstrcmp(s_flag,"allflags")==0)
+ {
+ fla = H5O_COPY_ALL;
+ }
+ else if (HDstrcmp(s_flag,"nullmsg")==0)
+ {
+ fla = H5O_COPY_PRESERVE_NULL_FLAG;
+ }
+ else
+ {
+ error_msg("Error in input flag\n");
+ return -1;
+ }
+
+ *flag = (*flag) | fla;
+
+ return 0;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: main
+ *
+ * Purpose: main program
+ *
+ * Programmer: Pedro Vicente Nunes
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+
+int
+main (int argc, const char *argv[])
+{
+ int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
+ H5E_auto2_t func;
+ H5E_auto2_t tools_func;
+ void *edata;
+ void *tools_edata;
+ hid_t fid_src = -1;
+ hid_t fid_dst = -1;
+ unsigned flag = 0;
+ unsigned verbose = 0;
+ unsigned parents = 0;
+ hid_t ocpl_id = (-1); /* Object copy property list */
+ hid_t lcpl_id = (-1); /* Link creation property list */
+ int opt;
+ int li_ret;
+ h5tool_link_info_t linkinfo;
+
+ h5tools_setprogname(PROGRAMNAME);
+ h5tools_setstatus(EXIT_SUCCESS);
+
+ /* Disable error reporting */
+ H5Eget_auto2(H5E_DEFAULT, &func, &edata);
+ H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
+
+ /* Initialize h5tools lib */
+ h5tools_init();
+
+ /* Disable tools error reporting */
+ H5Eget_auto2(H5tools_ERR_STACK_g, &tools_func, &tools_edata);
+ H5Eset_auto2(H5tools_ERR_STACK_g, NULL, NULL);
+
+ /* init linkinfo struct */
+ HDmemset(&linkinfo, 0, sizeof(h5tool_link_info_t));
+
+ /* Check for no command line parameters */
+ if(argc == 1)
+ {
+ usage();
+ leave(EXIT_FAILURE);
+ } /* end if */
+
+ /* parse command line options */
+ while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF)
+ {
+ switch ((char)opt)
+ {
+ case 'd':
+ oname_dst = HDstrdup(opt_arg);
+ break;
+
+ case 'f':
+ /* validate flag */
+ if (parse_flag(opt_arg,&flag)<0)
+ {
+ usage();
+ leave(EXIT_FAILURE);
+ }
+ str_flag = HDstrdup(opt_arg);
+ break;
+
+ case 'h':
+ usage();
+ leave(EXIT_SUCCESS);
+ break;
+
+ case 'i':
+ fname_src = HDstrdup(opt_arg);
+ break;
+
+ case 'o':
+ fname_dst = HDstrdup(opt_arg);
+ break;
+
+ case 'p':
+ parents = 1;
+ break;
+
+ case 's':
+ oname_src = HDstrdup(opt_arg);
+ break;
+
+ case 'V':
+ print_version(h5tools_getprogname());
+ leave(EXIT_SUCCESS);
+ break;
+
+ case 'v':
+ verbose = 1;
+ break;
+
+ case 'E':
+ enable_error_stack = TRUE;
+ break;
+
+ default:
+ usage();
+ leave(EXIT_FAILURE);
+ }
+ } /* end of while */
+
+/*-------------------------------------------------------------------------
+ * check for missing file/object names
+ *-------------------------------------------------------------------------*/
+
+ if (fname_src==NULL)
+ {
+ error_msg("Input file name missing\n");
+ usage();
+ leave(EXIT_FAILURE);
+ }
+
+ if (fname_dst==NULL)
+ {
+ error_msg("Output file name missing\n");
+ usage();
+ leave(EXIT_FAILURE);
+ }
+
+ if (oname_src==NULL)
+ {
+ error_msg("Source object name missing\n");
+ usage();
+ leave(EXIT_FAILURE);
+ }
+
+ if (oname_dst==NULL)
+ {
+ error_msg("Destination object name missing\n");
+ usage();
+ leave(EXIT_FAILURE);
+ }
+
+ if (enable_error_stack) {
+ H5Eset_auto2(H5E_DEFAULT, func, edata);
+ H5Eset_auto2(H5tools_ERR_STACK_g, tools_func, tools_edata);
+ }
+
+ /*-------------------------------------------------------------------------
+ * open output file
+ *-------------------------------------------------------------------------*/
+
+ /* Attempt to open an existing HDF5 file first. Need to open the dst file
+ before the src file just in case that the dst and src are the same file
+ */
+ fid_dst = h5tools_fopen(fname_dst, H5F_ACC_RDWR, H5P_DEFAULT, NULL, NULL, 0);
+
+ /*-------------------------------------------------------------------------
+ * open input file
+ *-------------------------------------------------------------------------*/
+
+ fid_src = h5tools_fopen(fname_src, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, 0);
+
+ /*-------------------------------------------------------------------------
+ * test for error in opening input file
+ *-------------------------------------------------------------------------*/
+ if (fid_src==-1)
+ {
+ error_msg("Could not open input file <%s>...Exiting\n", fname_src);
+ leave(EXIT_FAILURE);
+ }
+
+
+ /*-------------------------------------------------------------------------
+ * create an output file when failed to open it
+ *-------------------------------------------------------------------------*/
+
+ /* If we couldn't open an existing file, try creating file */
+ /* (use "EXCL" instead of "TRUNC", so we don't blow away existing non-HDF5 file) */
+ if(fid_dst < 0)
+ fid_dst = H5Fcreate(fname_dst, H5F_ACC_EXCL, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*-------------------------------------------------------------------------
+ * test for error in opening output file
+ *-------------------------------------------------------------------------*/
+ if (fid_dst==-1)
+ {
+ error_msg("Could not open output file <%s>...Exiting\n", fname_dst);
+ leave(EXIT_FAILURE);
+ }
+
+ /*-------------------------------------------------------------------------
+ * print some info
+ *-------------------------------------------------------------------------*/
+
+ if (verbose)
+ {
+ printf("Copying file <%s> and object <%s> to file <%s> and object <%s>\n",
+ fname_src, oname_src, fname_dst, oname_dst);
+ if (flag) {
+ HDassert(str_flag);
+ printf("Using %s flag\n", str_flag);
+ }
+ }
+
+
+ /*-------------------------------------------------------------------------
+ * create property lists for copy
+ *-------------------------------------------------------------------------*/
+
+ /* create property to pass copy options */
+ if ( (ocpl_id = H5Pcreate(H5P_OBJECT_COPY)) < 0)
+ HGOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Pcreate failed");
+
+ /* set options for object copy */
+ if (flag)
+ {
+ if ( H5Pset_copy_object(ocpl_id, flag) < 0)
+ HGOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Pset_copy_object failed");
+ }
+
+ /* Create link creation property list */
+ if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) {
+ error_msg("Could not create link creation property list\n");
+ HGOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Pcreate failed");
+ } /* end if */
+
+ /* Check for creating intermediate groups */
+ if(parents) {
+ /* Set the intermediate group creation property */
+ if(H5Pset_create_intermediate_group(lcpl_id, 1) < 0) {
+ error_msg("Could not set property for creating parent groups\n");
+ HGOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Pset_create_intermediate_group failed");
+ } /* end if */
+
+ /* Display some output if requested */
+ if(verbose)
+ printf("%s: Creating parent groups\n", h5tools_getprogname());
+ } /* end if */
+ else /* error, if parent groups doesn't already exist in destination file */
+ {
+ size_t i, len;
+
+ len = HDstrlen(oname_dst);
+
+ /* check if all the parents groups exist. skip root group */
+ for (i = 1; i < len; i++)
+ {
+ if ('/'==oname_dst[i])
+ {
+ char *str_ptr;
+
+ str_ptr = (char *)HDcalloc(i + 1, sizeof(char));
+ HDstrncpy(str_ptr, oname_dst, i);
+ str_ptr[i]='\0';
+ if (H5Lexists(fid_dst, str_ptr, H5P_DEFAULT) <= 0)
+ {
+ error_msg("group <%s> doesn't exist. Use -p to create parent groups.\n", str_ptr);
+ HDfree(str_ptr);
+ HGOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Lexists failed");
+ }
+ HDfree(str_ptr);
+ }
+ }
+ }
+
+ /*-------------------------------------------------------------------------
+ * do the copy
+ *-------------------------------------------------------------------------*/
+
+ if(verbose)
+ linkinfo.opt.msg_mode = 1;
+
+ li_ret = H5tools_get_symlink_info(fid_src, oname_src, &linkinfo, 1);
+ if (li_ret == 0) /* dangling link */
+ {
+ if(H5Lcopy(fid_src, oname_src,
+ fid_dst, oname_dst,
+ H5P_DEFAULT, H5P_DEFAULT) < 0)
+ HGOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Lcopy failed");
+ }
+ else /* valid link */
+ {
+ if (H5Ocopy(fid_src, /* Source file or group identifier */
+ oname_src, /* Name of the source object to be copied */
+ fid_dst, /* Destination file or group identifier */
+ oname_dst, /* Name of the destination object */
+ ocpl_id, /* Object copy property list */
+ lcpl_id)<0) /* Link creation property list */
+ HGOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Ocopy failed");
+ }
+
+ /* free link info path */
+ if (linkinfo.trg_path)
+ HDfree(linkinfo.trg_path);
+
+ /* close propertis */
+ if(H5Pclose(ocpl_id)<0)
+ HGOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Pclose failed");
+ if(H5Pclose(lcpl_id)<0)
+ HGOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Pclose failed");
+
+ /* close files */
+ if (H5Fclose(fid_src)<0)
+ HGOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Fclose failed");
+ if (H5Fclose(fid_dst)<0)
+ HGOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Fclose failed");
+
+ leave(EXIT_SUCCESS);
+
+done:
+ printf("Error in copy...Exiting\n");
+
+ /* free link info path */
+ if (linkinfo.trg_path)
+ HDfree(linkinfo.trg_path);
+
+ H5E_BEGIN_TRY {
+ H5Pclose(ocpl_id);
+ H5Pclose(lcpl_id);
+ H5Fclose(fid_src);
+ H5Fclose(fid_dst);
+ } H5E_END_TRY;
+
+ leave(ret_value);
+}
+
diff --git a/tools/src/h5diff/CMakeLists.txt b/tools/src/h5diff/CMakeLists.txt
new file mode 100644
index 0000000..85a24ef
--- /dev/null
+++ b/tools/src/h5diff/CMakeLists.txt
@@ -0,0 +1,67 @@
+cmake_minimum_required (VERSION 3.1.0)
+PROJECT (HDF5_TOOLS_SRC_H5DIFF)
+
+#-----------------------------------------------------------------------------
+# Setup include Directories
+#-----------------------------------------------------------------------------
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib)
+
+# --------------------------------------------------------------------
+# Add the h5diff executables
+# --------------------------------------------------------------------
+add_executable (h5diff
+ ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_common.c
+ ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_main.c
+)
+TARGET_NAMING (h5diff STATIC)
+TARGET_C_PROPERTIES (h5diff STATIC " " " ")
+target_link_libraries (h5diff ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+set_target_properties (h5diff PROPERTIES FOLDER tools)
+set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5diff")
+
+set (H5_DEP_EXECUTABLES h5diff)
+
+if (H5_HAVE_PARALLEL)
+ add_executable (ph5diff
+ ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_common.c
+ ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/ph5diff_main.c
+ )
+ TARGET_NAMING (ph5diff STATIC)
+ TARGET_C_PROPERTIES (ph5diff STATIC " " " ")
+ target_link_libraries (ph5diff ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+ set_target_properties (ph5diff PROPERTIES FOLDER tools)
+ set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};ph5diff")
+endif (H5_HAVE_PARALLEL)
+
+##############################################################################
+##############################################################################
+### I N S T A L L A T I O N ###
+##############################################################################
+##############################################################################
+
+#-----------------------------------------------------------------------------
+# Rules for Installation of tools using make Install target
+#-----------------------------------------------------------------------------
+
+#INSTALL_PROGRAM_PDB (h5diff ${HDF5_INSTALL_BIN_DIR} toolsapplications)
+
+install (
+ TARGETS
+ h5diff
+ EXPORT
+ ${HDF5_EXPORTED_TARGETS}
+ RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications
+)
+
+if (H5_HAVE_PARALLEL)
+
+ #INSTALL_PROGRAM_PDB (ph5diff ${HDF5_INSTALL_BIN_DIR} toolsapplications)
+
+ install (
+ TARGETS
+ ph5diff
+ EXPORT
+ ${HDF5_EXPORTED_TARGETS}
+ RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications
+ )
+endif (H5_HAVE_PARALLEL)
diff --git a/tools/src/h5diff/Makefile.am b/tools/src/h5diff/Makefile.am
new file mode 100644
index 0000000..a5af3f2
--- /dev/null
+++ b/tools/src/h5diff/Makefile.am
@@ -0,0 +1,46 @@
+#
+# 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.
+##
+## Makefile.am
+## Run automake to generate a Makefile.in from this file.
+#
+# HDF5 Library Makefile(.in)
+#
+
+include $(top_srcdir)/config/commence.am
+
+# Include src and tools/lib directories
+AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib
+
+# Always build and test h5diff but build and test ph5diff only if parallel
+# is enabled.
+if BUILD_PARALLEL_CONDITIONAL
+ H5PDIFF=ph5diff
+endif
+
+# Our main target, h5diff
+bin_PROGRAMS=h5diff $(H5PDIFF)
+
+# Add h5diff specific linker flags here
+h5diff_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+
+# Source files for the program
+h5diff_SOURCES=h5diff_main.c h5diff_common.c
+ph5diff_SOURCES=ph5diff_main.c h5diff_common.c
+
+# Programs depend on the main HDF5 library and tools library
+LDADD=$(LIBH5TOOLS) $(LIBHDF5)
+
+include $(top_srcdir)/config/conclude.am
+
diff --git a/tools/src/h5diff/h5diff_common.c b/tools/src/h5diff/h5diff_common.c
new file mode 100644
index 0000000..2453ffc
--- /dev/null
+++ b/tools/src/h5diff/h5diff_common.c
@@ -0,0 +1,607 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include <stdlib.h>
+#include <string.h>
+#include "H5private.h"
+#include "h5diff.h"
+#include "h5diff_common.h"
+#include "h5tools.h"
+#include "h5tools_utils.h"
+
+static int check_n_input( const char* );
+static int check_p_input( const char* );
+static int check_d_input( const char* );
+
+/*
+ * Command-line options: The user can specify short or long-named
+ * parameters.
+ */
+static const char *s_opts = "hVrv:qn:d:p:Nc";
+static struct long_options l_opts[] = {
+ { "help", no_arg, 'h' },
+ { "version", no_arg, 'V' },
+ { "report", no_arg, 'r' },
+ { "verbose", optional_arg, 'v' },
+ { "quiet", no_arg, 'q' },
+ { "count", require_arg, 'n' },
+ { "delta", require_arg, 'd' },
+ { "relative", require_arg, 'p' },
+ { "nan", no_arg, 'N' },
+ { "compare", no_arg, 'c' },
+ { "use-system-epsilon", no_arg, 'e' },
+ { "follow-symlinks", no_arg, 'l' },
+ { "no-dangling-links", no_arg, 'x' },
+ { "exclude-path", require_arg, 'E' },
+ { NULL, 0, '\0' }
+};
+
+/*-------------------------------------------------------------------------
+ * Function: check_options
+ *
+ * Purpose: parse command line input
+ *
+ *-------------------------------------------------------------------------
+ */
+static void check_options(diff_opt_t* options)
+{
+ /*--------------------------------------------------------------
+ * check for mutually exclusive options
+ *--------------------------------------------------------------*/
+
+ /* check between -d , -p, --use-system-epsilon.
+ * These options are mutually exclusive.
+ */
+ if ((options->d + options->p + options->use_system_epsilon) > 1)
+ {
+ printf("%s error: -d, -p and --use-system-epsilon options are mutually-exclusive;\n", PROGRAMNAME);
+ printf("use no more than one.\n");
+ printf("Try '-h' or '--help' option for more information or see the %s entry in the 'HDF5 Reference Manual'.\n", PROGRAMNAME);
+ h5diff_exit(EXIT_FAILURE);
+ }
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: parse_command_line
+ *
+ * Purpose: parse command line input
+ *
+ *-------------------------------------------------------------------------
+ */
+
+void parse_command_line(int argc,
+ const char* argv[],
+ const char** fname1,
+ const char** fname2,
+ const char** objname1,
+ const char** objname2,
+ diff_opt_t* options)
+{
+ int i;
+ int opt;
+ struct exclude_path_list *exclude_head, *exclude_prev, *exclude_node;
+
+ /* process the command-line */
+ memset(options, 0, sizeof (diff_opt_t));
+
+ /* assume equal contents initially */
+ options->contents = 1;
+
+ /* NaNs are handled by default */
+ options->do_nans = 1;
+
+ /* not Listing objects that are not comparable */
+ options->m_list_not_cmp = 0;
+
+ /* initially no not-comparable. */
+ /**this is bad in mixing option with results**/
+ options->not_cmp=0;
+
+ /* init for exclude-path option */
+ exclude_head = NULL;
+
+ /* parse command line options */
+ while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF)
+ {
+ switch ((char)opt)
+ {
+ default:
+ usage();
+ h5diff_exit(EXIT_FAILURE);
+ case 'h':
+ usage();
+ h5diff_exit(EXIT_SUCCESS);
+ case 'V':
+ print_version(h5tools_getprogname());
+ h5diff_exit(EXIT_SUCCESS);
+ case 'v':
+ options->m_verbose = 1;
+ /* This for loop is for handling style like
+ * -v, -v1, --verbose, --verbose=1.
+ */
+ for (i = 1; i < argc; i++)
+ {
+ /*
+ * short opt
+ */
+ if (!strcmp (argv[i], "-v")) /* no arg */
+ {
+ opt_ind--;
+ options->m_verbose_level = 0;
+ break;
+ }
+ else if (!strncmp (argv[i], "-v", (size_t)2))
+ {
+ options->m_verbose_level = atoi(&argv[i][2]);
+ break;
+ }
+
+ /*
+ * long opt
+ */
+ if (!strcmp (argv[i], "--verbose")) /* no arg */
+ {
+ options->m_verbose_level = 0;
+ break;
+ }
+ else if ( !strncmp (argv[i], "--verbose", (size_t)9) && argv[i][9]=='=')
+ {
+ options->m_verbose_level = atoi(&argv[i][10]);
+ break;
+ }
+ }
+ break;
+ case 'q':
+ /* use quiet mode; supress the message "0 differences found" */
+ options->m_quiet = 1;
+ break;
+ case 'r':
+ options->m_report = 1;
+ break;
+ case 'l':
+ options->follow_links = TRUE;
+ break;
+ case 'x':
+ options->no_dangle_links = 1;
+ break;
+ case 'E':
+ options->exclude_path = 1;
+
+ /* create linked list of excluding objects */
+ if( (exclude_node = (struct exclude_path_list*) HDmalloc(sizeof(struct exclude_path_list))) == NULL)
+ {
+ printf("Error: lack of memory!\n");
+ h5diff_exit(EXIT_FAILURE);
+ }
+
+ /* init */
+ exclude_node->obj_path = (char*)opt_arg;
+ exclude_node->obj_type = H5TRAV_TYPE_UNKNOWN;
+ exclude_prev = exclude_head;
+
+ if (NULL == exclude_head)
+ {
+ exclude_head = exclude_node;
+ exclude_head->next = NULL;
+ }
+ else
+ {
+ while(NULL != exclude_prev->next)
+ exclude_prev=exclude_prev->next;
+
+ exclude_node->next = NULL;
+ exclude_prev->next = exclude_node;
+ }
+ break;
+ case 'd':
+ options->d=1;
+
+ if ( check_d_input( opt_arg )==-1)
+ {
+ printf("<-d %s> is not a valid option\n", opt_arg );
+ usage();
+ h5diff_exit(EXIT_FAILURE);
+ }
+ options->delta = atof( opt_arg );
+
+ /* -d 0 is the same as default */
+ if (H5_DBL_ABS_EQUAL(options->delta, (double)0.0F))
+ options->d=0;
+
+ break;
+
+ case 'p':
+
+ options->p=1;
+ if ( check_p_input( opt_arg )==-1)
+ {
+ printf("<-p %s> is not a valid option\n", opt_arg );
+ usage();
+ h5diff_exit(EXIT_FAILURE);
+ }
+ options->percent = atof( opt_arg );
+
+ /* -p 0 is the same as default */
+ if (H5_DBL_ABS_EQUAL(options->percent, (double)0.0F))
+ options->p = 0;
+
+ break;
+
+ case 'n':
+
+ options->n=1;
+ if ( check_n_input( opt_arg )==-1)
+ {
+ printf("<-n %s> is not a valid option\n", opt_arg );
+ usage();
+ h5diff_exit(EXIT_FAILURE);
+ }
+ options->count = HDstrtoull(opt_arg, NULL, 0);
+ break;
+
+ case 'N':
+ options->do_nans = 0;
+ break;
+
+ case 'c':
+ options->m_list_not_cmp = 1;
+ break;
+
+ case 'e':
+ options->use_system_epsilon = 1;
+ break;
+ }
+ }
+
+ /* check options */
+ check_options(options);
+
+ /* if exclude-path option is used, keep the exclude path list */
+ if (options->exclude_path)
+ options->exclude = exclude_head;
+
+ /* check for file names to be processed */
+ if (argc <= opt_ind || argv[ opt_ind + 1 ] == NULL)
+ {
+ error_msg("missing file names\n");
+ usage();
+ h5diff_exit(EXIT_FAILURE);
+ }
+
+ *fname1 = argv[ opt_ind ];
+ *fname2 = argv[ opt_ind + 1 ];
+ *objname1 = argv[ opt_ind + 2 ];
+
+ if ( *objname1 == NULL )
+ {
+ *objname2 = NULL;
+ return;
+ }
+
+ if ( argv[ opt_ind + 3 ] != NULL)
+ {
+ *objname2 = argv[ opt_ind + 3 ];
+ }
+ else
+ {
+ *objname2 = *objname1;
+ }
+
+
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: print_info
+ *
+ * Purpose: print several information messages after h5diff call
+ *
+ *-------------------------------------------------------------------------
+ */
+
+ void print_info(diff_opt_t* options)
+ {
+ if (options->m_quiet || options->err_stat )
+ return;
+
+ if (options->cmn_objs==0)
+ {
+ printf("No common objects found. Files are not comparable.\n");
+ if (!options->m_verbose)
+ printf("Use -v for a list of objects.\n");
+ }
+
+ if (options->not_cmp==1)
+ {
+ if ( options->m_list_not_cmp == 0 )
+ {
+ printf("--------------------------------\n");
+ printf("Some objects are not comparable\n");
+ printf("--------------------------------\n");
+ if (options->m_verbose)
+ printf("Use -c for a list of objects without details of differences.\n");
+ else
+ printf("Use -c for a list of objects.\n");
+ }
+
+
+ }
+
+ }
+
+/*-------------------------------------------------------------------------
+ * Function: check_n_input
+ *
+ * Purpose: check for valid input
+ *
+ * Return: 1 for ok, -1 for fail
+ *
+ * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ *
+ * Date: May 9, 2003
+ *
+ * Comments:
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+H5_ATTR_PURE static int
+check_n_input( const char *str )
+{
+ unsigned i;
+ char c;
+
+ for ( i = 0; i < strlen(str); i++)
+ {
+ c = str[i];
+ if ( i==0 )
+ {
+ if ( c < 49 || c > 57 ) /* ascii values between 1 and 9 */
+ return -1;
+ }
+ else
+ if ( c < 48 || c > 57 ) /* 0 also */
+ return -1;
+ }
+ return 1;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: check_p_input
+ *
+ * Purpose: check for a valid p option input
+ *
+ * Return: 1 for ok, -1 for fail
+ *
+ * Date: May 9, 2003
+ *
+ * Comments:
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+check_p_input( const char *str )
+{
+ double x;
+
+ /*
+ the atof return value on a hexadecimal input is different
+ on some systems; we do a character check for this
+ */
+ if (strlen(str)>2 && str[0]=='0' && str[1]=='x')
+ return -1;
+
+ x=atof(str);
+ if (x<0)
+ return -1;
+
+ return 1;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: check_d_input
+ *
+ * Purpose: check for a valid d option input
+ *
+ * Return: 1 for ok, -1 for fail
+ *
+ * Date: November 11, 2007
+ *
+ * Comments:
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+check_d_input( const char *str )
+{
+ double x;
+
+ /*
+ the atof return value on a hexadecimal input is different
+ on some systems; we do a character check for this
+ */
+ if (strlen(str)>2 && str[0]=='0' && str[1]=='x')
+ return -1;
+
+ x=atof(str);
+ if (x <0)
+ return -1;
+
+ return 1;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: usage
+ *
+ * Purpose: print a usage message
+ *
+ * Return: void
+ *
+ *-------------------------------------------------------------------------
+ */
+
+void usage(void)
+{
+ printf("usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] \n");
+ printf(" file1 File name of the first HDF5 file\n");
+ printf(" file2 File name of the second HDF5 file\n");
+ printf(" [obj1] Name of an HDF5 object, in absolute path\n");
+ printf(" [obj2] Name of an HDF5 object, in absolute path\n");
+ printf("\n");
+ printf(" OPTIONS\n");
+ printf(" -h, --help\n");
+ printf(" Print a usage message and exit.\n");
+ printf(" -V, --version\n");
+ printf(" Print version number and exit.\n");
+ printf(" -r, --report\n");
+ printf(" Report mode. Print differences.\n");
+ printf(" -v --verbose\n");
+ printf(" Verbose mode. Print differences information and list of objects.\n");
+ printf(" -vN --verbose=N\n");
+ printf(" Verbose mode with level. Print differences and list of objects.\n");
+ printf(" Level of detail depends on value of N:\n");
+ printf(" 0 : Identical to '-v' or '--verbose'.\n");
+ printf(" 1 : All level 0 information plus one-line attribute\n");
+ printf(" status summary.\n");
+ printf(" 2 : All level 1 information plus extended attribute\n");
+ printf(" status report.\n");
+ printf(" -q, --quiet\n");
+ printf(" Quiet mode. Do not produce output.\n");
+ printf(" --follow-symlinks\n");
+ printf(" Follow symbolic links (soft links and external links and compare the)\n");
+ printf(" links' target objects.\n");
+ printf(" If symbolic link(s) with the same name exist in the files being\n");
+ printf(" compared, then determine whether the target of each link is an existing\n");
+ printf(" object (dataset, group, or named datatype) or the link is a dangling\n");
+ printf(" link (a soft or external link pointing to a target object that does\n");
+ printf(" not yet exist).\n");
+ printf(" - If both symbolic links are dangling links, they are treated as being\n");
+ printf(" the same; by default, h5diff returns an exit code of 0.\n");
+ printf(" If, however, --no-dangling-links is used with --follow-symlinks,\n");
+ printf(" this situation is treated as an error and h5diff returns an\n");
+ printf(" exit code of 2.\n");
+ printf(" - If only one of the two links is a dangling link,they are treated as\n");
+ printf(" being different and h5diff returns an exit code of 1.\n");
+ printf(" If, however, --no-dangling-links is used with --follow-symlinks,\n");
+ printf(" this situation is treated as an error and h5diff returns an\n");
+ printf(" exit code of 2.\n");
+ printf(" - If both symbolic links point to existing objects, h5diff compares the\n");
+ printf(" two objects.\n");
+ printf(" If any symbolic link specified in the call to h5diff does not exist,\n");
+ printf(" h5diff treats it as an error and returns an exit code of 2.\n");
+ printf(" --no-dangling-links\n");
+ printf(" Must be used with --follow-symlinks option; otherwise, h5diff shows\n");
+ printf(" error message and returns an exit code of 2.\n");
+ printf(" Check for any symbolic links (soft links or external links) that do not\n");
+ printf(" resolve to an existing object (dataset, group, or named datatype).\n");
+ printf(" If any dangling link is found, this situation is treated as an error\n");
+ printf(" and h5diff returns an exit code of 2.\n");
+ printf(" -c, --compare\n");
+ printf(" List objects that are not comparable\n");
+ printf(" -N, --nan\n");
+ printf(" Avoid NaNs detection\n");
+ printf(" -n C, --count=C\n");
+ printf(" Print differences up to C. C must be a positive integer.\n");
+ printf(" -d D, --delta=D\n");
+ printf(" Print difference if (|a-b| > D). D must be a positive number.\n");
+ printf(" Can not use with '-p' or '--use-system-epsilon'.\n");
+ printf(" -p R, --relative=R\n");
+ printf(" Print difference if (|(a-b)/b| > R). R must be a positive number.\n");
+ printf(" Can not use with '-d' or '--use-system-epsilon'.\n");
+ printf(" --use-system-epsilon\n");
+ printf(" Print difference if (|a-b| > EPSILON), EPSILON is system defined value.\n");
+ printf(" If the system epsilon is not defined,one of the following predefined\n");
+ printf(" values will be used:\n");
+ printf(" FLT_EPSILON = 1.19209E-07 for floating-point type\n");
+ printf(" DBL_EPSILON = 2.22045E-16 for double precision type\n");
+ printf(" Can not use with '-p' or '-d'.\n");
+ printf(" --exclude-path \"path\" \n");
+ printf(" Exclude the specified path to an object when comparing files or groups.\n");
+ printf(" If a group is excluded, all member objects will also be excluded.\n");
+ printf(" The specified path is excluded wherever it occurs.\n");
+ printf(" This flexibility enables the same option to exclude either objects that\n");
+ printf(" exist only in one file or common objects that are known to differ.\n");
+ printf("\n");
+ printf(" When comparing files, \"path\" is the absolute path to the excluded;\n");
+ printf(" object; when comparing groups, \"path\" is similar to the relative\n");
+ printf(" path from the group to the excluded object. This \"path\" can be\n");
+ printf(" taken from the first section of the output of the --verbose option.\n");
+ printf(" For example, if you are comparing the group /groupA in two files and\n");
+ printf(" you want to exclude /groupA/groupB/groupC in both files, the exclude\n");
+ printf(" option would read as follows:\n");
+ printf(" --exclude-path \"/groupB/groupC\"\n");
+ printf("\n");
+ printf(" If there are multiple paths to an object, only the specified path(s)\n");
+ printf(" will be excluded; the comparison will include any path not explicitly\n");
+ printf(" excluded.\n");
+ printf(" This option can be used repeatedly to exclude multiple paths.\n");
+ printf("\n");
+
+ printf(" Modes of output:\n");
+ printf(" Default mode: print the number of differences found and where they occured\n");
+ printf(" -r Report mode: print the above plus the differences\n");
+ printf(" -v Verbose mode: print the above plus a list of objects and warnings\n");
+ printf(" -q Quiet mode: do not print output\n");
+
+ printf("\n");
+
+ printf(" File comparison:\n");
+ printf(" If no objects [obj1[ obj2]] are specified, the h5diff comparison proceeds as\n");
+ printf(" a comparison of the two files' root groups. That is, h5diff first compares\n");
+ printf(" the names of root group members, generates a report of root group objects\n");
+ printf(" that appear in only one file or in both files, and recursively compares\n");
+ printf(" common objects.\n");
+ printf("\n");
+
+ printf(" Object comparison:\n");
+ printf(" 1) Groups \n");
+ printf(" First compares the names of member objects (relative path, from the\n");
+ printf(" specified group) and generates a report of objects that appear in only\n");
+ printf(" one group or in both groups. Common objects are then compared recursively.\n");
+ printf(" 2) Datasets \n");
+ printf(" Array rank and dimensions, datatypes, and data values are compared.\n");
+ printf(" 3) Datatypes \n");
+ printf(" The comparison is based on the return value of H5Tequal.\n");
+ printf(" 4) Symbolic links \n");
+ printf(" The paths to the target objects are compared.\n");
+ printf(" (The option --follow-symlinks overrides the default behavior when\n");
+ printf(" symbolic links are compared.).\n");
+ printf("\n");
+
+ printf(" Exit code:\n");
+ printf(" 0 if no differences, 1 if differences found, 2 if error\n");
+ printf("\n");
+ printf(" Examples of use:\n");
+ printf(" 1) h5diff file1 file2 /g1/dset1 /g1/dset2\n");
+ printf(" Compares object '/g1/dset1' in file1 with '/g1/dset2' in file2\n");
+ printf("\n");
+ printf(" 2) h5diff file1 file2 /g1/dset1\n");
+ printf(" Compares object '/g1/dset1' in both files\n");
+ printf("\n");
+ printf(" 3) h5diff file1 file2\n");
+ printf(" Compares all objects in both files\n");
+ printf("\n");
+ printf(" Notes:\n");
+ printf(" file1 and file2 can be the same file.\n");
+ printf(" Use h5diff file1 file1 /g1/dset1 /g1/dset2 to compare\n");
+ printf(" '/g1/dset1' and '/g1/dset2' in the same file\n");
+ printf("\n");
+}
diff --git a/tools/src/h5diff/h5diff_common.h b/tools/src/h5diff/h5diff_common.h
new file mode 100644
index 0000000..5b1317f
--- /dev/null
+++ b/tools/src/h5diff/h5diff_common.h
@@ -0,0 +1,36 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifndef H5DIFFCOMMON_H__
+#define H5DIFFCOMMON_H__
+
+#include "h5tools.h"
+/* Name of tool */
+#define PROGRAMNAME "h5diff"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void usage(void);
+void parse_command_line(int argc, const char* argv[], const char** fname1, const char** fname2, const char** objname1, const char** objname2, diff_opt_t* options);
+void h5diff_exit(int status);
+void print_info(diff_opt_t* options);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* H5DIFFCOMMON_H__ */
diff --git a/tools/src/h5diff/h5diff_main.c b/tools/src/h5diff/h5diff_main.c
new file mode 100644
index 0000000..cdaca29
--- /dev/null
+++ b/tools/src/h5diff/h5diff_main.c
@@ -0,0 +1,145 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include <stdlib.h>
+#include <assert.h>
+#include <memory.h>
+#include "H5private.h"
+#include "h5diff.h"
+#include "h5diff_common.h"
+#include "h5tools.h"
+#include "h5tools_utils.h"
+
+
+/*-------------------------------------------------------------------------
+ * Function: main
+ *
+ * Purpose: h5diff main program
+ *
+ * Return: An exit status of 0 means no differences were found, 1 means some
+ * differences were found.
+ *
+ * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ *
+ * Date: May 9, 2003
+ *
+ * Comments:
+ *
+ * Modifications: July 2004
+ * Introduced the four modes:
+ * Normal mode: print the number of differences found and where they occured
+ * Report mode: print the above plus the differences
+ * Verbose mode: print the above plus a list of objects and warnings
+ * Quiet mode: do not print output
+ *
+ * November 2004: Leon Arber (larber@uiuc.edu)
+ * Additions that allow h5diff to be run in parallel
+ *
+ * February 2005: Leon Arber (larber@uiuc.edu)
+ * h5diff and ph5diff split into two files, one that is used
+ * to build a serial h5diff and one used to build a parallel h5diff
+ * Common functions have been moved to h5diff_common.c
+ *
+ * October 2005
+ * Introduced a new field 'not_cmp' to 'diff_opt_t' that detects
+ * if some objects are not comparable and prints the message
+ * "Some objects are not comparable"
+ *
+ * February 2007
+ * Added comparison for dataset regions.
+ * Added support for reading and comparing by hyperslabs for large files.
+ * Inclusion of a relative error formula to compare floating
+ * point numbers in order to deal with floating point uncertainty.
+ * Printing of dataset dimensions along with dataset name
+ *
+ * November 19, 2007
+ * adopted the syntax h5diff [OPTIONS] file1 file2 [obj1[obj2]]
+ *
+ *-------------------------------------------------------------------------
+ */
+
+
+int main(int argc, const char *argv[])
+{
+ int ret;
+ const char *fname1 = NULL;
+ const char *fname2 = NULL;
+ const char *objname1 = NULL;
+ const char *objname2 = NULL;
+ hsize_t nfound=0;
+ diff_opt_t options;
+
+ h5tools_setprogname(PROGRAMNAME);
+ h5tools_setstatus(EXIT_SUCCESS);
+
+ /* Initialize h5tools lib */
+ h5tools_init();
+
+ /*-------------------------------------------------------------------------
+ * process the command-line
+ *-------------------------------------------------------------------------
+ */
+ parse_command_line(argc, argv, &fname1, &fname2, &objname1, &objname2, &options);
+
+ /*-------------------------------------------------------------------------
+ * do the diff
+ *-------------------------------------------------------------------------
+ */
+
+ nfound = h5diff(fname1,fname2,objname1,objname2,&options);
+
+ print_info(&options);
+
+ /*-------------------------------------------------------------------------
+ * exit code
+ * 1 if differences, 0 if no differences, 2 if error
+ *-------------------------------------------------------------------------
+ */
+
+ ret = (nfound == 0 ? 0 : 1 );
+
+ /* if graph difference return 1 for differences */
+ if ( options.contents == 0 )
+ ret = 1;
+
+ /* and return 2 for error */
+ if (options.err_stat)
+ ret = 2;
+
+ return ret;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: h5diff_exit
+ *
+ * Purpose: dismiss phdiff worker processes and exit
+ *
+ * Return: none
+ *
+ * Programmer: Albert Cheng
+ * Date: Feb 6, 2005
+ *
+ * Comments:
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+H5_ATTR_NORETURN void
+h5diff_exit(int status)
+{
+ HDexit(status);
+}
+
diff --git a/tools/src/h5diff/ph5diff_main.c b/tools/src/h5diff/ph5diff_main.c
new file mode 100644
index 0000000..a26b6e9
--- /dev/null
+++ b/tools/src/h5diff/ph5diff_main.c
@@ -0,0 +1,329 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+#include "H5private.h"
+#include "h5diff.h"
+#include "ph5diff.h"
+#include "h5diff_common.h"
+#include "h5tools.h"
+#include "h5tools_utils.h"
+
+/* Name of tool */
+#define PROGRAMNAME "h5diff"
+
+static void ph5diff_worker(int );
+
+/*-------------------------------------------------------------------------
+ * Function: main
+ *
+ * Purpose: ph5diff main program
+ *
+ * Return: An exit status of 0 means no differences were found, 1 means some
+ * differences were found.
+ *
+ * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ *
+ * Date: May 9, 2003
+ *
+ * Comments:
+ *
+ * This function drives the diff process and will do a serial or parallel diff depending
+ * on the value of the global variable g_Parallel (default is 0), set to 1 when the program
+ * is run as "ph5diff"
+ *-------------------------------------------------------------------------
+ */
+
+int main(int argc, const char *argv[])
+{
+ int nID = 0;
+ const char *fname1 = NULL;
+ const char *fname2 = NULL;
+ const char *objname1 = NULL;
+ const char *objname2 = NULL;
+ diff_opt_t options;
+
+ h5tools_setprogname(PROGRAMNAME);
+ h5tools_setstatus(EXIT_SUCCESS);
+
+ /* Initialize h5tools lib */
+ h5tools_init();
+
+ outBuffOffset = 0;
+ g_Parallel = 1;
+
+ MPI_Init(&argc, (char***) &argv);
+
+ MPI_Comm_rank(MPI_COMM_WORLD, &nID);
+ MPI_Comm_size(MPI_COMM_WORLD, &g_nTasks);
+
+ if(g_nTasks == 1)
+ {
+ printf("Only 1 task available...doing serial diff\n");
+
+ g_Parallel = 0;
+
+ parse_command_line(argc, argv, &fname1, &fname2, &objname1, &objname2, &options);
+
+ h5diff(fname1, fname2, objname1, objname2, &options);
+
+ print_info(&options);
+ }
+ /* Parallel h5diff */
+ else {
+
+ /* Have the manager process the command-line */
+ if(nID == 0)
+ {
+ parse_command_line(argc, argv, &fname1, &fname2, &objname1, &objname2, &options);
+
+ h5diff(fname1, fname2, objname1, objname2, &options);
+
+ MPI_Barrier(MPI_COMM_WORLD);
+
+ print_info(&options);
+ print_manager_output();
+ }
+ /* All other tasks become workers and wait for assignments. */
+ else {
+ ph5diff_worker(nID);
+
+ MPI_Barrier(MPI_COMM_WORLD);
+ } /* end else */
+
+ } /* end else */
+
+ MPI_Finalize();
+
+ return 0;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: ph5diff_worker
+ *
+ * Purpose: worker process of ph5diff
+ *
+ * Return: none
+ *
+ * Programmer: Leon Arber
+ * Date: January 2005
+ *
+ * Comments:
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+ph5diff_worker(int nID)
+{
+ hid_t file1_id = -1, file2_id = -1;
+
+ while(1)
+ {
+ MPI_Status Status;
+
+ MPI_Probe(0, MPI_ANY_TAG, MPI_COMM_WORLD, &Status);
+
+ /* Check for filenames */
+ if(Status.MPI_TAG == MPI_TAG_PARALLEL)
+ {
+ char filenames[2][MAX_FILENAME];
+
+ /* Retrieve filenames */
+ MPI_Recv(filenames, MAX_FILENAME*2, MPI_CHAR, 0, MPI_ANY_TAG, MPI_COMM_WORLD, &Status);
+
+ /* disable error reporting */
+ H5E_BEGIN_TRY
+ {
+ /* Open the files */
+ if ((file1_id = H5Fopen (filenames[0], H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ {
+ printf ("h5diff Task [%d]: <%s>: unable to open file\n", nID, filenames[0]);
+ MPI_Abort(MPI_COMM_WORLD, 0);
+ }
+ if ((file2_id = H5Fopen (filenames[1], H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ {
+ printf ("h5diff Task [%d]: <%s>: unable to open file\n", nID, filenames[1]);
+ MPI_Abort(MPI_COMM_WORLD, 0);
+ }
+ /* enable error reporting */
+ }
+ H5E_END_TRY;
+ }
+ /* Check for work */
+ else if(Status.MPI_TAG == MPI_TAG_ARGS)
+ {
+ struct diff_mpi_args args;
+ struct diffs_found diffs;
+ int i;
+
+ /* Make certain we've received the filenames and opened the files already */
+ if(file1_id < 0 || file2_id < 0)
+ {
+ printf("ph5diff_worker: ERROR: work received before/without filenames\n");
+ break;
+ }
+
+ /* Recv parameters for diff from manager task */
+ MPI_Recv(&args, sizeof(args), MPI_BYTE, 0, MPI_TAG_ARGS, MPI_COMM_WORLD, &Status);
+
+ /* Do the diff */
+ diffs.nfound = diff(file1_id, args.name1, file2_id, args.name2, &(args.options), &(args.argdata));
+ diffs.not_cmp = args.options.not_cmp;
+
+ /* If print buffer has something in it, request print token.*/
+ if(outBuffOffset>0)
+ {
+ MPI_Send(NULL, 0, MPI_BYTE, 0, MPI_TAG_TOK_REQUEST, MPI_COMM_WORLD);
+
+ /* Wait for print token. */
+ MPI_Recv(NULL, 0, MPI_BYTE, 0, MPI_TAG_PRINT_TOK, MPI_COMM_WORLD, &Status);
+
+ /* When get token, send all of our output to the manager task and then return the token */
+ for(i=0; i<outBuffOffset; i+=PRINT_DATA_MAX_SIZE)
+ MPI_Send(outBuff+i, PRINT_DATA_MAX_SIZE, MPI_BYTE, 0, MPI_TAG_PRINT_DATA, MPI_COMM_WORLD);
+
+ /* An overflow file exists, so we send it's output to the manager too and then delete it */
+ if(overflow_file)
+ {
+ char out_data[PRINT_DATA_MAX_SIZE];
+ int tmp;
+
+ memset(out_data, 0, PRINT_DATA_MAX_SIZE);
+ i=0;
+
+ rewind(overflow_file);
+ while((tmp = getc(overflow_file)) >= 0)
+ {
+ *(out_data + i++) = (char)tmp;
+ if(i==PRINT_DATA_MAX_SIZE)
+ {
+ MPI_Send(out_data, PRINT_DATA_MAX_SIZE, MPI_BYTE, 0, MPI_TAG_PRINT_DATA, MPI_COMM_WORLD);
+ i=0;
+ memset(out_data, 0, PRINT_DATA_MAX_SIZE);
+ }
+ }
+
+ if(i>0)
+ MPI_Send(out_data, PRINT_DATA_MAX_SIZE, MPI_BYTE, 0, MPI_TAG_PRINT_DATA, MPI_COMM_WORLD);
+
+ fclose(overflow_file);
+ overflow_file = NULL;
+ }
+
+ fflush(stdout);
+ memset(outBuff, 0, OUTBUFF_SIZE);
+ outBuffOffset = 0;
+
+ MPI_Send(&diffs, sizeof(diffs), MPI_BYTE, 0, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD);
+ }
+ else
+ MPI_Send(&diffs, sizeof(diffs), MPI_BYTE, 0, MPI_TAG_DONE, MPI_COMM_WORLD);
+ }
+ /* Check for leaving */
+ else if(Status.MPI_TAG == MPI_TAG_END)
+ {
+ MPI_Recv(NULL, 0, MPI_BYTE, 0, MPI_TAG_END, MPI_COMM_WORLD, &Status);
+ break;
+ }
+ else
+ {
+ printf("ph5diff_worker: ERROR: invalid tag (%d) received\n", Status.MPI_TAG);
+ break;
+ }
+
+ }
+
+ return;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: print_manager_output
+ *
+ * Purpose: special function that prints any output accumulated by the
+ * manager task.
+ *
+ * Return: none
+ *
+ * Programmer: Leon Arber
+ *
+ * Date: Feb 7, 2005
+ *
+ *-------------------------------------------------------------------------
+ */
+void print_manager_output(void)
+{
+ /* If there was something we buffered, let's print it now */
+ if( (outBuffOffset>0) && g_Parallel)
+ {
+ printf("%s", outBuff);
+
+ if(overflow_file)
+ {
+ int tmp;
+ rewind(overflow_file);
+ while((tmp = getc(overflow_file)) >= 0)
+ putchar(tmp);
+ fclose(overflow_file);
+ overflow_file = NULL;
+ }
+
+ HDfflush(stdout);
+ HDmemset(outBuff, 0, OUTBUFF_SIZE);
+ outBuffOffset = 0;
+ }
+ else if( (outBuffOffset>0) && !g_Parallel)
+ {
+ HDfprintf(stderr, "h5diff error: outBuffOffset>0, but we're not in parallel!\n");
+ }
+}
+
+/*-------------------------------------------------------------------------
+ * Function: h5diff_exit
+ *
+ * Purpose: dismiss phdiff worker processes and exit
+ *
+ * Return: none
+ *
+ * Programmer: Albert Cheng
+ * Date: Feb 6, 2005
+ *
+ * Comments:
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+void h5diff_exit(int status)
+{
+ /* if in parallel mode, dismiss workers, close down MPI, then exit */
+ if(g_Parallel) {
+ if(g_nTasks > 1) {
+ phdiff_dismiss_workers();
+ MPI_Barrier(MPI_COMM_WORLD);
+ }
+ MPI_Finalize();
+ status = EXIT_SUCCESS; /* Reset exit status, since some mpiexec commands generate output on failure status */
+ }
+
+ /* Always exit(0), since MPI implementations do weird stuff when they
+ * receive a non-zero exit value. - QAK
+ */
+ exit(0);
+}
+
diff --git a/tools/src/h5dump/CMakeLists.txt b/tools/src/h5dump/CMakeLists.txt
new file mode 100644
index 0000000..ab310db
--- /dev/null
+++ b/tools/src/h5dump/CMakeLists.txt
@@ -0,0 +1,43 @@
+cmake_minimum_required (VERSION 3.1.0)
+PROJECT (HDF5_TOOLS_SRC_H5DUMP)
+
+#-----------------------------------------------------------------------------
+# Setup include Directories
+#-----------------------------------------------------------------------------
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib)
+
+# --------------------------------------------------------------------
+# Add the h5dump executables
+# --------------------------------------------------------------------
+add_executable (h5dump
+ ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump.c
+ ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_ddl.c
+ ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_xml.c
+)
+TARGET_NAMING (h5dump STATIC)
+TARGET_C_PROPERTIES (h5dump STATIC " " " ")
+target_link_libraries (h5dump ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+set_target_properties (h5dump PROPERTIES FOLDER tools)
+set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5dump")
+
+set (H5_DEP_EXECUTABLES h5dump)
+
+##############################################################################
+##############################################################################
+### I N S T A L L A T I O N ###
+##############################################################################
+##############################################################################
+
+#-----------------------------------------------------------------------------
+# Rules for Installation of tools using make Install target
+#-----------------------------------------------------------------------------
+
+#INSTALL_PROGRAM_PDB (h5dump ${HDF5_INSTALL_BIN_DIR} toolsapplications)
+
+install (
+ TARGETS
+ h5dump
+ EXPORT
+ ${HDF5_EXPORTED_TARGETS}
+ RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications
+)
diff --git a/tools/src/h5dump/Makefile.am b/tools/src/h5dump/Makefile.am
new file mode 100644
index 0000000..dc43065
--- /dev/null
+++ b/tools/src/h5dump/Makefile.am
@@ -0,0 +1,38 @@
+#
+# 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.
+##
+## Makefile.am
+## Run automake to generate a Makefile.in from this file.
+#
+# HDF5 Library Makefile(.in)
+#
+
+include $(top_srcdir)/config/commence.am
+
+# Include files in /src directory and /tools/lib directory
+AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib
+
+# Our main target, the h5dump tool.
+bin_PROGRAMS=h5dump
+
+# Add h5dump specific linker flags here
+h5dump_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+
+# All the programs depend on the hdf5 and h5tools libraries
+LDADD=$(LIBH5TOOLS) $(LIBHDF5)
+
+# Source files for the program
+h5dump_SOURCES=h5dump.c h5dump_ddl.c h5dump_xml.c
+
+include $(top_srcdir)/config/conclude.am
diff --git a/tools/src/h5dump/h5dump.c b/tools/src/h5dump/h5dump.c
new file mode 100644
index 0000000..562cfd5
--- /dev/null
+++ b/tools/src/h5dump/h5dump.c
@@ -0,0 +1,1802 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "h5dump.h"
+#include "h5dump_ddl.h"
+#include "h5dump_xml.h"
+
+/* Name of tool */
+#define PROGRAMNAME "h5dump"
+
+static const char *driver = NULL; /* The driver to open the file with. */
+const char *outfname=NULL;
+static int doxml = 0;
+static int useschema = 1;
+static const char *xml_dtd_uri = NULL;
+
+/* module-scoped variables for XML option */
+#define DEFAULT_XSD "http://www.hdfgroup.org/HDF5/XML/schema/HDF5-File.xsd"
+#define DEFAULT_DTD "http://www.hdfgroup.org/HDF5/XML/DTD/HDF5-File.dtd"
+
+/* Standard DDL output */
+static const dump_functions ddl_function_table = {
+ dump_group,
+ dump_named_datatype,
+ dump_dataset,
+ dump_dataspace,
+ dump_datatype,
+ dump_attr_cb,
+ dump_data
+};
+
+/* XML output */
+static const dump_functions xml_function_table = {
+ xml_dump_group,
+ xml_dump_named_datatype,
+ xml_dump_dataset,
+ xml_dump_dataspace,
+ xml_dump_datatype,
+ xml_dump_attr,
+ xml_dump_data
+};
+
+/* internal functions */
+static void init_prefix(char **prfx, size_t prfx_len);
+
+/* a structure for handling the order command-line parameters come in */
+struct handler_t {
+ void (*func)(hid_t, const char *, void *, int, const char *);
+ char *obj;
+ struct subset_t *subset_info;
+};
+
+/*
+ * Command-line options: The user can specify short or long-named
+ * parameters. The long-named ones can be partially spelled. When
+ * adding more, make sure that they don't clash with each other.
+ */
+/* The following initialization makes use of C language cancatenating */
+/* "xxx" "yyy" into "xxxyyy". */
+static const char *s_opts = "hn*peyBHirVa:c:d:f:g:k:l:t:w:xD:uX:o*b*F:s:S:A*q:z:m:RECM:O*N:vG:";
+static struct long_options l_opts[] = {
+ { "help", no_arg, 'h' },
+ { "hel", no_arg, 'h' },
+ { "contents", optional_arg, 'n' },
+ { "properties", no_arg, 'p' },
+ { "superblock", no_arg, 'B' },
+ { "boot-block", no_arg, 'B' },
+ { "boot-bloc", no_arg, 'B' },
+ { "boot-blo", no_arg, 'B' },
+ { "boot-bl", no_arg, 'B' },
+ { "boot-b", no_arg, 'B' },
+ { "boot", no_arg, 'B' },
+ { "boo", no_arg, 'B' },
+ { "bo", no_arg, 'B' },
+ { "header", no_arg, 'H' },
+ { "heade", no_arg, 'H' },
+ { "head", no_arg, 'H' },
+ { "hea", no_arg, 'H' },
+ { "object-ids", no_arg, 'i' },
+ { "object-id", no_arg, 'i' },
+ { "object-i", no_arg, 'i' },
+ { "object", no_arg, 'i' },
+ { "objec", no_arg, 'i' },
+ { "obje", no_arg, 'i' },
+ { "obj", no_arg, 'i' },
+ { "ob", no_arg, 'i' },
+ { "version", no_arg, 'V' },
+ { "versio", no_arg, 'V' },
+ { "versi", no_arg, 'V' },
+ { "vers", no_arg, 'V' },
+ { "ver", no_arg, 'V' },
+ { "ve", no_arg, 'V' },
+ { "attribute", require_arg, 'a' },
+ { "attribut", require_arg, 'a' },
+ { "attribu", require_arg, 'a' },
+ { "attrib", require_arg, 'a' },
+ { "attri", require_arg, 'a' },
+ { "attr", require_arg, 'a' },
+ { "att", require_arg, 'a' },
+ { "at", require_arg, 'a' },
+ { "block", require_arg, 'k' },
+ { "bloc", require_arg, 'k' },
+ { "blo", require_arg, 'k' },
+ { "bl", require_arg, 'k' },
+ { "count", require_arg, 'c' },
+ { "coun", require_arg, 'c' },
+ { "cou", require_arg, 'c' },
+ { "co", require_arg, 'c' },
+ { "dataset", require_arg, 'd' },
+ { "datase", require_arg, 'd' },
+ { "datas", require_arg, 'd' },
+ { "datatype", require_arg, 't' },
+ { "datatyp", require_arg, 't' },
+ { "dataty", require_arg, 't' },
+ { "datat", require_arg, 't' },
+ { "filedriver", require_arg, 'f' },
+ { "filedrive", require_arg, 'f' },
+ { "filedriv", require_arg, 'f' },
+ { "filedri", require_arg, 'f' },
+ { "filedr", require_arg, 'f' },
+ { "filed", require_arg, 'f' },
+ { "file", require_arg, 'f' },
+ { "fil", require_arg, 'f' },
+ { "fi", require_arg, 'f' },
+ { "group", require_arg, 'g' },
+ { "grou", require_arg, 'g' },
+ { "gro", require_arg, 'g' },
+ { "gr", require_arg, 'g' },
+ { "output", optional_arg, 'o' },
+ { "outpu", optional_arg, 'o' },
+ { "outp", optional_arg, 'o' },
+ { "out", optional_arg, 'o' },
+ { "ou", optional_arg, 'o' },
+ { "soft-link", require_arg, 'l' },
+ { "soft-lin", require_arg, 'l' },
+ { "soft-li", require_arg, 'l' },
+ { "soft-l", require_arg, 'l' },
+ { "soft", require_arg, 'l' },
+ { "sof", require_arg, 'l' },
+ { "start", require_arg, 's' },
+ { "star", require_arg, 's' },
+ { "sta", require_arg, 's' },
+ { "stride", require_arg, 'S' },
+ { "strid", require_arg, 'S' },
+ { "string", no_arg, 'r' },
+ { "strin", no_arg, 'r' },
+ { "use-dtd", no_arg, 'u' },
+ { "use-dt", no_arg, 'u' },
+ { "use-d", no_arg, 'u' },
+ { "use-", no_arg, 'u' },
+ { "use", no_arg, 'u' },
+ { "us", no_arg, 'u' },
+ { "u", no_arg, 'u' },
+ { "width", require_arg, 'w' },
+ { "widt", require_arg, 'w' },
+ { "wid", require_arg, 'w' },
+ { "wi", require_arg, 'w' },
+ { "xml-dtd", require_arg, 'D' },
+ { "xml-dt", require_arg, 'D' },
+ { "xml-d", require_arg, 'D' },
+ { "xml-ns", require_arg, 'X' },
+ { "xml-n", require_arg, 'X' },
+ { "xml", no_arg, 'x' },
+ { "xm", no_arg, 'x' },
+ { "onlyattr", optional_arg, 'A' },
+ { "escape", no_arg, 'e' },
+ { "noindex", no_arg, 'y' },
+ { "binary", optional_arg, 'b' },
+ { "form", require_arg, 'F' },
+ { "sort_by", require_arg, 'q' },
+ { "sort_order", require_arg, 'z' },
+ { "format", require_arg, 'm' },
+ { "region", no_arg, 'R' },
+ { "enable-error-stack", no_arg, 'E' },
+ { "packed-bits", require_arg, 'M' },
+ { "no-compact-subset", no_arg, 'C' },
+ { "ddl", optional_arg, 'O' },
+ { "any_path", require_arg, 'N' },
+ { "vds-view-first-missing", no_arg, 'v' },
+ { "vds-gap-size", require_arg, 'G' },
+ { NULL, 0, '\0' }
+};
+
+
+/*-------------------------------------------------------------------------
+ * Function: leave
+ *
+ * Purpose: Shutdown MPI & HDF5 and call exit()
+ *
+ * Return: Does not return
+ *
+ * Programmer: Quincey Koziol
+ * Saturday, 31. January 2004
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+leave(int ret)
+{
+ h5tools_close();
+
+ HDexit(ret);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: usage
+ *
+ * Purpose: Print the usage message about dumper
+ *
+ * Return: void
+ *-------------------------------------------------------------------------
+ */
+static void
+usage(const char *prog)
+{
+ FLUSHSTREAM(rawoutstream);
+ PRINTSTREAM(rawoutstream, "usage: %s [OPTIONS] files\n", prog);
+ PRINTVALSTREAM(rawoutstream, " OPTIONS\n");
+ PRINTVALSTREAM(rawoutstream, " -h, --help Print a usage message and exit\n");
+ PRINTVALSTREAM(rawoutstream, " -V, --version Print version number and exit\n");
+ PRINTVALSTREAM(rawoutstream, "--------------- File Options ---------------\n");
+ PRINTVALSTREAM(rawoutstream, " -n, --contents Print a list of the file contents and exit\n");
+ PRINTVALSTREAM(rawoutstream, " Optional value 1 also prints attributes.\n");
+ PRINTVALSTREAM(rawoutstream, " -B, --superblock Print the content of the super block\n");
+ PRINTVALSTREAM(rawoutstream, " -H, --header Print the header only; no data is displayed\n");
+ PRINTVALSTREAM(rawoutstream, " -f D, --filedriver=D Specify which driver to open the file with\n");
+ PRINTVALSTREAM(rawoutstream, " -o F, --output=F Output raw data into file F\n");
+ PRINTVALSTREAM(rawoutstream, " -b B, --binary=B Binary file output, of form B\n");
+ PRINTVALSTREAM(rawoutstream, " -O F, --ddl=F Output ddl text into file F\n");
+ PRINTVALSTREAM(rawoutstream, " Use blank(empty) filename F to suppress ddl display\n");
+ PRINTVALSTREAM(rawoutstream, "--------------- Object Options ---------------\n");
+ PRINTVALSTREAM(rawoutstream, " -a P, --attribute=P Print the specified attribute\n");
+ PRINTVALSTREAM(rawoutstream, " If an attribute name contains a slash (/), escape the\n");
+ PRINTVALSTREAM(rawoutstream, " slash with a preceding backslash (\\).\n");
+ PRINTVALSTREAM(rawoutstream, " (See example section below.)\n");
+ PRINTVALSTREAM(rawoutstream, " -d P, --dataset=P Print the specified dataset\n");
+ PRINTVALSTREAM(rawoutstream, " -g P, --group=P Print the specified group and all members\n");
+ PRINTVALSTREAM(rawoutstream, " -l P, --soft-link=P Print the value(s) of the specified soft link\n");
+ PRINTVALSTREAM(rawoutstream, " -t P, --datatype=P Print the specified named datatype\n");
+ PRINTVALSTREAM(rawoutstream, " -N P, --any_path=P Print any attribute, dataset, group, datatype, or link that matches P\n");
+ PRINTVALSTREAM(rawoutstream, " P can be the absolute path or just a relative path.\n");
+ PRINTVALSTREAM(rawoutstream, " -A, --onlyattr Print the header and value of attributes\n");
+ PRINTVALSTREAM(rawoutstream, " Optional value 0 suppresses printing attributes.\n");
+ PRINTVALSTREAM(rawoutstream, " --vds-view-first-missing Set the VDS bounds to first missing mapped elements.\n");
+ PRINTVALSTREAM(rawoutstream, " --vds-gap-size=N Set the missing file gap size, N=non-negative integers\n");
+ PRINTVALSTREAM(rawoutstream, "--------------- Object Property Options ---------------\n");
+ PRINTVALSTREAM(rawoutstream, " -i, --object-ids Print the object ids\n");
+ PRINTVALSTREAM(rawoutstream, " -p, --properties Print dataset filters, storage layout and fill value\n");
+ PRINTVALSTREAM(rawoutstream, " -M L, --packedbits=L Print packed bits as unsigned integers, using mask\n");
+ PRINTVALSTREAM(rawoutstream, " format L for an integer dataset specified with\n");
+ PRINTVALSTREAM(rawoutstream, " option -d. L is a list of offset,length values,\n");
+ PRINTVALSTREAM(rawoutstream, " separated by commas. Offset is the beginning bit in\n");
+ PRINTVALSTREAM(rawoutstream, " the data value and length is the number of bits of\n");
+ PRINTVALSTREAM(rawoutstream, " the mask.\n");
+ PRINTVALSTREAM(rawoutstream, " -R, --region Print dataset pointed by region references\n");
+ PRINTVALSTREAM(rawoutstream, "--------------- Formatting Options ---------------\n");
+ PRINTVALSTREAM(rawoutstream, " -e, --escape Escape non printing characters\n");
+ PRINTVALSTREAM(rawoutstream, " -r, --string Print 1-byte integer datasets as ASCII\n");
+ PRINTVALSTREAM(rawoutstream, " -y, --noindex Do not print array indices with the data\n");
+ PRINTVALSTREAM(rawoutstream, " -m T, --format=T Set the floating point output format\n");
+ PRINTVALSTREAM(rawoutstream, " -q Q, --sort_by=Q Sort groups and attributes by index Q\n");
+ PRINTVALSTREAM(rawoutstream, " -z Z, --sort_order=Z Sort groups and attributes by order Z\n");
+ PRINTVALSTREAM(rawoutstream, " --enable-error-stack Prints messages from the HDF5 error stack as they\n");
+ PRINTVALSTREAM(rawoutstream, " occur.\n");
+ PRINTVALSTREAM(rawoutstream, " --no-compact-subset Disable compact form of subsetting and allow the use\n");
+ PRINTVALSTREAM(rawoutstream, " of \"[\" in dataset names.\n");
+ PRINTVALSTREAM(rawoutstream, " -w N, --width=N Set the number of columns of output. A value of 0 (zero)\n");
+ PRINTVALSTREAM(rawoutstream, " sets the number of columns to the maximum (65535).\n");
+ PRINTVALSTREAM(rawoutstream, " Default width is 80 columns.\n");
+ PRINTVALSTREAM(rawoutstream, "--------------- XML Options ---------------\n");
+ PRINTVALSTREAM(rawoutstream, " -x, --xml Output in XML using Schema\n");
+ PRINTVALSTREAM(rawoutstream, " -u, --use-dtd Output in XML using DTD\n");
+ PRINTVALSTREAM(rawoutstream, " -D U, --xml-dtd=U Use the DTD or schema at U\n");
+ PRINTVALSTREAM(rawoutstream, " -X S, --xml-ns=S (XML Schema) Use qualified names n the XML\n");
+ PRINTVALSTREAM(rawoutstream, " \":\": no namespace, default: \"hdf5:\"\n");
+ PRINTVALSTREAM(rawoutstream, " E.g., to dump a file called `-f', use h5dump -- -f\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, "--------------- Subsetting Options ---------------\n");
+ PRINTVALSTREAM(rawoutstream, " Subsetting is available by using the following options with a dataset\n");
+ PRINTVALSTREAM(rawoutstream, " option. Subsetting is done by selecting a hyperslab from the data.\n");
+ PRINTVALSTREAM(rawoutstream, " Thus, the options mirror those for performing a hyperslab selection.\n");
+ PRINTVALSTREAM(rawoutstream, " One of the START, COUNT, STRIDE, or BLOCK parameters are mandatory if you do subsetting.\n");
+ PRINTVALSTREAM(rawoutstream, " The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 in\n");
+ PRINTVALSTREAM(rawoutstream, " each dimension. START is optional and will default to 0 in each dimension.\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, " -s START, --start=START Offset of start of subsetting selection\n");
+ PRINTVALSTREAM(rawoutstream, " -S STRIDE, --stride=STRIDE Hyperslab stride\n");
+ PRINTVALSTREAM(rawoutstream, " -c COUNT, --count=COUNT Number of blocks to include in selection\n");
+ PRINTVALSTREAM(rawoutstream, " -k BLOCK, --block=BLOCK Size of block in hyperslab\n");
+ PRINTVALSTREAM(rawoutstream, " START, COUNT, STRIDE, and BLOCK - is a list of integers the number of which are equal to the\n");
+ PRINTVALSTREAM(rawoutstream, " number of dimensions in the dataspace being queried\n");
+ PRINTVALSTREAM(rawoutstream, " (Alternate compact form of subsetting is described in the Reference Manual)\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, "--------------- Option Argument Conventions ---------------\n");
+ PRINTVALSTREAM(rawoutstream, " D - is the file driver to use in opening the file. Acceptable values\n");
+ PRINTVALSTREAM(rawoutstream, " are \"sec2\", \"family\", \"split\", \"multi\", \"direct\", and \"stream\". Without\n");
+ PRINTVALSTREAM(rawoutstream, " the file driver flag, the file will be opened with each driver in\n");
+ PRINTVALSTREAM(rawoutstream, " turn and in the order specified above until one driver succeeds\n");
+ PRINTVALSTREAM(rawoutstream, " in opening the file.\n");
+ PRINTVALSTREAM(rawoutstream, " See examples below for family, split, and multi driver special file name usage.\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, " F - is a filename.\n");
+ PRINTVALSTREAM(rawoutstream, " P - is the full path from the root group to the object.\n");
+ PRINTVALSTREAM(rawoutstream, " N - is an integer greater than 1.\n");
+ PRINTVALSTREAM(rawoutstream, " T - is a string containing the floating point format, e.g '%%.3f'\n");
+ PRINTVALSTREAM(rawoutstream, " U - is a URI reference (as defined in [IETF RFC 2396],\n");
+ PRINTVALSTREAM(rawoutstream, " updated by [IETF RFC 2732])\n");
+ PRINTVALSTREAM(rawoutstream, " B - is the form of binary output: NATIVE for a memory type, FILE for the\n");
+ PRINTVALSTREAM(rawoutstream, " file type, LE or BE for pre-existing little or big endian types.\n");
+ PRINTVALSTREAM(rawoutstream, " Must be used with -o (output file) and it is recommended that\n");
+ PRINTVALSTREAM(rawoutstream, " -d (dataset) is used. B is an optional argument, defaults to NATIVE\n");
+ PRINTVALSTREAM(rawoutstream, " Q - is the sort index type. It can be \"creation_order\" or \"name\" (default)\n");
+ PRINTVALSTREAM(rawoutstream, " Z - is the sort order type. It can be \"descending\" or \"ascending\" (default)\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, "--------------- Examples ---------------\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, " 1) Attribute foo of the group /bar_none in file quux.h5\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, " h5dump -a /bar_none/foo quux.h5\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, " Attribute \"high/low\" of the group /bar_none in the file quux.h5\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, " h5dump -a \"/bar_none/high\\/low\" quux.h5\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, " 2) Selecting a subset from dataset /foo in file quux.h5\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, " h5dump -d /foo -s \"0,1\" -S \"1,1\" -c \"2,3\" -k \"2,2\" quux.h5\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, " 3) Saving dataset 'dset' in file quux.h5 to binary file 'out.bin'\n");
+ PRINTVALSTREAM(rawoutstream, " using a little-endian type\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, " h5dump -d /dset -b LE -o out.bin quux.h5\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, " 4) Display two packed bits (bits 0-1 and bits 4-6) in the dataset /dset\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, " h5dump -d /dset -M 0,1,4,3 quux.h5\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, " 5) Dataset foo in files file1.h5 file2.h5 file3.h5\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, " h5dump -d /foo file1.h5 file2.h5 file3.h5\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, " 6) Dataset foo in split files splitfile-m.h5 splitfile-r.h5\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, " h5dump -d /foo -f split splitfile\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, " 7) Dataset foo in multi files mf-s.h5, mf-b.h5, mf-r.h5, mf-g.h5, mf-l.h5 and mf-o.h5\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, " h5dump -d /foo -f multi mf\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, " 8) Dataset foo in family files fam00000.h5 fam00001.h5 and fam00002.h5\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, " h5dump -d /foo -f family fam%%05d.h5\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: table_list_add
+ *
+ * Purpose: Add a new set of tables
+ *
+ * Return: index of added table on success, -1 on failure
+ *
+ * Programmer: Neil Fortner, nfortne2@hdfgroup.org
+ * Adapted from trav_addr_add in h5trav.c by Quincey Koziol
+ *
+ * Date: October 13, 2008
+ *
+ *-------------------------------------------------------------------------
+ */
+ssize_t
+table_list_add(hid_t oid, unsigned long file_no)
+{
+ size_t idx; /* Index of table to use */
+ find_objs_t info;
+
+ /* Allocate space if necessary */
+ if(table_list.nused == table_list.nalloc) {
+ h5dump_table_items_t *tmp_ptr;
+
+ table_list.nalloc = MAX(1, table_list.nalloc * 2);
+ if(NULL == (tmp_ptr = (h5dump_table_items_t *)HDrealloc(table_list.tables, table_list.nalloc * sizeof(table_list.tables[0]))))
+ return -1;
+ table_list.tables = tmp_ptr;
+ } /* end if */
+
+ /* Append it */
+ idx = table_list.nused++;
+ table_list.tables[idx].fileno = file_no;
+ table_list.tables[idx].oid = oid;
+ if(H5Iinc_ref(oid) < 0) {
+ table_list.nused--;
+ return -1;
+ }
+ if(init_objs(oid, &info, &table_list.tables[idx].group_table,
+ &table_list.tables[idx].dset_table, &table_list.tables[idx].type_table) < 0) {
+ H5Idec_ref(oid);
+ table_list.nused--;
+ return -1;
+ }
+
+#ifdef H5DUMP_DEBUG
+ dump_tables(&info);
+#endif /* H5DUMP_DEBUG */
+
+ return((ssize_t) idx);
+} /* end table_list_add() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: table_list_visited
+ *
+ * Purpose: Check if a table already exists for the specified fileno
+ *
+ * Return: The index of the matching table, or -1 if no matches found
+ *
+ * Programmer: Neil Fortner, nfortne2@hdfgroup.org
+ * Adapted from trav_addr_visited in h5trav.c by Quincey Koziol
+ *
+ * Date: October 13, 2008
+ *
+ *-------------------------------------------------------------------------
+ */
+H5_ATTR_PURE ssize_t
+table_list_visited(unsigned long file_no)
+{
+ size_t u; /* Local index variable */
+
+ /* Look for table */
+ for(u = 0; u < table_list.nused; u++)
+ /* Check for fileno value already in array */
+ if(table_list.tables[u].fileno == file_no)
+ return((ssize_t) u);
+
+ /* Didn't find table */
+ return(-1);
+} /* end table_list_visited() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: table_list_free
+ *
+ * Purpose: Frees the table list
+ *
+ * Return: void
+ *
+ * Programmer: Neil Fortner, nfortne2@hdfgroup.org
+ *
+ * Date: October 13, 2008
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+table_list_free(void)
+{
+ size_t u; /* Local index variable */
+
+ /* Iterate over tables */
+ for(u = 0; u < table_list.nused; u++) {
+ /* Release object id */
+ if(H5Idec_ref(table_list.tables[u].oid) < 0)
+ h5tools_setstatus(EXIT_FAILURE);
+
+ /* Free each table */
+ free_table(table_list.tables[u].group_table);
+ HDfree(table_list.tables[u].group_table);
+ free_table(table_list.tables[u].dset_table);
+ HDfree(table_list.tables[u].dset_table);
+ free_table(table_list.tables[u].type_table);
+ HDfree(table_list.tables[u].type_table);
+ }
+
+ /* Free the table list */
+ HDfree(table_list.tables);
+ table_list.tables = NULL;
+ table_list.nalloc = table_list.nused = 0;
+} /* end table_list_free() */
+
+/*-------------------------------------------------------------------------
+ * Function: set_binary_form
+ *
+ * Purpose: set the binary form of output by translating from a string input
+ * parameter to a integer return value
+ *
+ * Return: integer form of binary output or -1 if none found
+ *
+ * Programmer: Pedro Vicente Nunes
+ * June 28, 2006
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+set_binary_form(const char *form)
+{
+ int bform = -1;
+
+ if (HDstrcmp(form,"NATIVE") == 0 || HDstrcmp(form,"MEMORY") == 0) {
+ /* native form */
+ bform = 0;
+ }
+ else if (HDstrcmp(form,"FILE") == 0) /* file type form */
+ bform = 1;
+ else if (HDstrcmp(form,"LE") == 0) /* convert to little endian */
+ bform = 2;
+ else if (HDstrcmp(form,"BE") == 0) /* convert to big endian */
+ bform = 3;
+
+ return bform;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: set_sort_by
+ *
+ * Purpose: set the "by" form of sorting by translating from a string input
+ * parameter to a H5_index_t return value
+ * current sort values are [creation_order | name]
+ *
+ * Return: H5_index_t form of sort or H5_INDEX_UNKNOWN if none found
+ *
+ * Programmer: Pedro Vicente Nunes
+ * October 1, 2007
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static H5_index_t
+set_sort_by(const char *form)
+{
+ H5_index_t idx_type = H5_INDEX_UNKNOWN;
+
+ if (HDstrcmp(form,"name")==0) /* H5_INDEX_NAME */
+ idx_type = H5_INDEX_NAME;
+ else if (HDstrcmp(form,"creation_order")==0) /* H5_INDEX_CRT_ORDER */
+ idx_type = H5_INDEX_CRT_ORDER;
+
+ return idx_type;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: set_sort_order
+ *
+ * Purpose: set the order of sorting by translating from a string input
+ * parameter to a H5_iter_order_t return value
+ * current order values are [ascending | descending ]
+ *
+ * Return: H5_iter_order_t form of order or H5_ITER_UNKNOWN if none found
+ *
+ * Programmer: Pedro Vicente Nunes
+ * October 1, 2007
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static H5_iter_order_t
+set_sort_order(const char *form)
+{
+ H5_iter_order_t iter_order = H5_ITER_UNKNOWN;
+
+ if (HDstrcmp(form,"ascending")==0) /* H5_ITER_INC */
+ iter_order = H5_ITER_INC;
+ else if (HDstrcmp(form,"descending")==0) /* H5_ITER_DEC */
+ iter_order = H5_ITER_DEC;
+
+ return iter_order;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: parse_hsize_list
+ *
+ * Purpose: Parse a list of comma or space separated integers and return
+ * them in a list. The string being passed into this function
+ * should be at the start of the list you want to parse. You are
+ * responsible for freeing the array returned from here.
+ *
+ * Lists in the so-called "terse" syntax are separated by
+ * semicolons (;). The lists themselves can be separated by
+ * either commas (,) or white spaces.
+ *
+ * Return: <none>
+ *
+ * Programmer: Bill Wendling
+ * Tuesday, 6. February 2001
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+parse_hsize_list(const char *h_list, subset_d *d)
+{
+ hsize_t *p_list;
+ const char *ptr;
+ unsigned int size_count = 0;
+ unsigned int i = 0;
+ unsigned int last_digit = 0;
+
+ if (!h_list || !*h_list || *h_list == ';')
+ return;
+
+ /* count how many integers do we have */
+ for (ptr = h_list; ptr && *ptr && *ptr != ';' && *ptr != ']'; ptr++)
+ if (HDisdigit(*ptr)) {
+ if (!last_digit)
+ /* the last read character wasn't a digit */
+ size_count++;
+
+ last_digit = 1;
+ }
+ else
+ last_digit = 0;
+
+ if (size_count == 0)
+ /* there aren't any integers to read */
+ return;
+
+ /* allocate an array for the integers in the list */
+ p_list = (hsize_t *)HDcalloc(size_count, sizeof(hsize_t));
+
+ for (ptr = h_list; i < size_count && ptr && *ptr && *ptr != ';' && *ptr != ']'; ptr++)
+ if(HDisdigit(*ptr)) {
+ /* we should have an integer now */
+ p_list[i++] = (hsize_t)HDstrtoull(ptr, NULL, 0);
+
+ while (HDisdigit(*ptr))
+ /* scroll to end of integer */
+ ptr++;
+ }
+ d->data = p_list;
+ d->len = size_count;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: parse_subset_params
+ *
+ * Purpose: Parse the so-called "terse" syntax for specifying subsetting
+ * parameters.
+ *
+ * Return: Success: struct subset_t object
+ * Failure: NULL
+ *
+ * Programmer: Bill Wendling
+ * Tuesday, 6. February 2001
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static struct subset_t *
+parse_subset_params(char *dset)
+{
+ struct subset_t *s = NULL;
+ char *brace;
+
+ if (!disable_compact_subset && ((brace = HDstrrchr(dset, '[')) != NULL)) {
+ *brace++ = '\0';
+
+ s = (struct subset_t *)HDcalloc(1, sizeof(struct subset_t));
+ parse_hsize_list(brace, &s->start);
+
+ while (*brace && *brace != ';')
+ brace++;
+
+ if (*brace) brace++;
+
+ parse_hsize_list(brace, &s->stride);
+
+ while (*brace && *brace != ';')
+ brace++;
+
+ if (*brace) brace++;
+
+ parse_hsize_list(brace, &s->count);
+
+ while (*brace && *brace != ';')
+ brace++;
+
+ if (*brace) brace++;
+
+ parse_hsize_list(brace, &s->block);
+ }
+
+ return s;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: parse_mask_list
+ *
+ * Purpose: Parse a list of comma or space separated integers and fill
+ * the packed_bits list and counter. The string being passed into this function
+ * should be at the start of the list you want to parse.
+ *
+ * Return: Success: SUCCEED
+ *
+ * Failure: FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+parse_mask_list(const char *h_list)
+{
+ int soffset_value;
+ unsigned offset_value;
+ int slength_value;
+ unsigned length_value;
+ unsigned long long temp_mask;
+ const char *ptr = NULL;
+
+ /* sanity check */
+ HDassert(h_list);
+
+ HDmemset(packed_mask,0,sizeof(packed_mask));
+
+ packed_bits_num = 0;
+ /* scan in pair of offset,length separated by commas. */
+ ptr = h_list;
+ while (*ptr) {
+ /* scan for an offset which is an unsigned int */
+ if (!HDisdigit(*ptr)) {
+ error_msg("Bad mask list(%s)\n", h_list);
+ return FAIL;
+ }
+ soffset_value = HDatoi(ptr);
+ offset_value = (unsigned)soffset_value;
+ if (soffset_value < 0 || offset_value >= PACKED_BITS_SIZE_MAX) {
+ error_msg("Packed Bit offset value(%d) must be between 0 and %u\n",
+ soffset_value, (unsigned)(PACKED_BITS_SIZE_MAX - 1));
+ return FAIL;
+ }
+
+ /* skip to end of integer */
+ while (HDisdigit(*++ptr))
+ ;
+ /* Look for the common separator */
+ if (*ptr++ != ',') {
+ error_msg("Bad mask list(%s), missing expected comma separator.\n", h_list);
+ return FAIL;
+ }
+
+ /* scan for a length which is a positive int */
+ if (!HDisdigit(*ptr)) {
+ error_msg("Bad mask list(%s)\n", h_list);
+ return FAIL;
+ }
+ slength_value = HDatoi(ptr);
+ if (slength_value <= 0) {
+ error_msg("Packed Bit length value(%d) must be positive.\n", slength_value);
+ return FAIL;
+ }
+ length_value = (unsigned)slength_value;
+ if ((offset_value + length_value) > PACKED_BITS_SIZE_MAX) {
+ error_msg("Packed Bit offset+length value(%u) too large. Max is %u\n",
+ offset_value+length_value, (unsigned)PACKED_BITS_SIZE_MAX);
+ return FAIL;
+ }
+
+ /* skip to end of int */
+ while (HDisdigit(*++ptr))
+ ;
+
+ /* store the offset,length pair */
+ if (packed_bits_num >= PACKED_BITS_MAX) {
+ /* too many requests */
+ error_msg("Too many masks requested (max. %d). Mask list(%s)\n", PACKED_BITS_MAX, h_list);
+ return FAIL;
+ }
+ packed_offset[packed_bits_num] = offset_value;
+ packed_length[packed_bits_num] = length_value;
+ /* create the bit mask by left shift 1's by length, then negate it. */
+ /* After packed_mask is calculated, packed_length is not needed but */
+ /* keep it for debug purpose. */
+ temp_mask = ~0ULL;
+ if(length_value < (int)(8 *sizeof(unsigned long long))) {
+ temp_mask = temp_mask << length_value;
+ packed_mask[packed_bits_num] = ~temp_mask;
+ }
+ else
+ packed_mask[packed_bits_num] = temp_mask;
+ packed_bits_num++;
+
+ /* skip a possible comma separator */
+ if (*ptr == ',') {
+ if (!(*++ptr)) {
+ /* unexpected end of string */
+ error_msg("Bad mask list(%s), unexpected end of string.\n", h_list);
+ return FAIL;
+ }
+ }
+ }
+ HDassert(packed_bits_num <= PACKED_BITS_MAX);
+ if (packed_bits_num == 0) {
+ /* got no masks! */
+ error_msg("Bad mask list(%s)\n", h_list);
+ return FAIL;
+ }
+ return SUCCEED;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: free_handler
+ *
+ * Purpose: Convenience function to free the handler_t structures. Needs a
+ * length variable (LEN) to know how many in the array it needs
+ * to free
+ *
+ * Return: Nothing
+ *
+ * Programmer: Bill Wendling
+ * Tuesday, 20. February 2001
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+free_handler(struct handler_t *hand, int len)
+{
+ int i;
+
+ if(hand) {
+ for (i = 0; i < len; i++) {
+ if(hand[i].obj) {
+ HDfree(hand[i].obj);
+ hand[i].obj=NULL;
+ }
+
+ if (hand[i].subset_info) {
+ if(hand[i].subset_info->start.data)
+ HDfree(hand[i].subset_info->start.data);
+ if(hand[i].subset_info->stride.data)
+ HDfree(hand[i].subset_info->stride.data);
+ if(hand[i].subset_info->count.data)
+ HDfree(hand[i].subset_info->count.data);
+ if(hand[i].subset_info->block.data)
+ HDfree(hand[i].subset_info->block.data);
+
+ HDfree(hand[i].subset_info);
+ hand[i].subset_info=NULL;
+ }
+ }
+
+ HDfree(hand);
+ }
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: parse_command_line
+ *
+ * Purpose: Parse the command line for the h5dumper.
+ *
+ * Return: Success: A pointer to an array of handler_t structures.
+ * These contain all the information needed to dump
+ * the necessary object.
+ *
+ * Failure: Exits program with EXIT_FAILURE value.
+ *
+ * Programmer: Bill Wendling
+ * Tuesday, 20. February 2001
+ *
+ * Modifications:
+ * pvn June, 1, 2006. Add a switch for binary output
+ *
+ *-------------------------------------------------------------------------
+ */
+static struct handler_t *
+parse_command_line(int argc, const char *argv[])
+{
+ struct handler_t *hand = NULL;
+ struct handler_t *last_dset = NULL;
+ int i;
+ int opt;
+ int last_was_dset = FALSE;
+
+ /* no arguments */
+ if (argc == 1) {
+ usage(h5tools_getprogname());
+ goto error;
+ }
+
+ /* this will be plenty big enough to hold the info */
+ if((hand = (struct handler_t *)HDcalloc((size_t)argc, sizeof(struct handler_t)))==NULL) {
+ goto error;
+ }
+
+ /* parse command line options */
+ while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) {
+parse_start:
+ switch ((char)opt) {
+ case 'R':
+ display_region = TRUE;
+ region_output = TRUE;
+ break;
+ case 'B':
+ display_bb = TRUE;
+ last_was_dset = FALSE;
+ break;
+ case 'n':
+ display_fi = TRUE;
+ last_was_dset = FALSE;
+ if ( opt_arg != NULL) {
+ h5trav_set_verbose(HDatoi(opt_arg));
+ }
+ break;
+ case 'p':
+ display_dcpl = TRUE;
+ break;
+ case 'y':
+ display_ai = FALSE;
+ break;
+ case 'e':
+ display_escape = TRUE;
+ break;
+ case 'H':
+ display_data = FALSE;
+ display_attr_data = FALSE;
+ last_was_dset = FALSE;
+ break;
+ case 'A':
+ if ( opt_arg != NULL) {
+ if(0 == HDatoi(opt_arg)) include_attrs = FALSE;
+ }
+ else {
+ display_data = FALSE;
+ display_attr_data = TRUE;
+ last_was_dset = FALSE;
+ }
+ break;
+ case 'i':
+ display_oid = TRUE;
+ last_was_dset = FALSE;
+ break;
+ case 'r':
+ display_char = TRUE;
+ break;
+ case 'V':
+ print_version(h5tools_getprogname());
+ free_handler(hand, argc);
+ hand = NULL;
+ h5tools_setstatus(EXIT_SUCCESS);
+ goto done;
+ break;
+ case 'w':
+ {
+ int sh5tools_nCols = HDatoi(opt_arg);
+
+ if (sh5tools_nCols <= 0)
+ h5tools_nCols = 65535;
+ else
+ h5tools_nCols = (unsigned)sh5tools_nCols;
+ last_was_dset = FALSE;
+ }
+ break;
+ case 'N':
+ display_all = 0;
+
+ for (i = 0; i < argc; i++)
+ if (!hand[i].func) {
+ hand[i].func = handle_paths;
+ hand[i].obj = HDstrdup(opt_arg);
+ break;
+ }
+
+ last_was_dset = FALSE;
+ break;
+ case 'a':
+ display_all = 0;
+
+ for (i = 0; i < argc; i++)
+ if (!hand[i].func) {
+ hand[i].func = handle_attributes;
+ hand[i].obj = HDstrdup(opt_arg);
+ break;
+ }
+
+ last_was_dset = FALSE;
+ break;
+ case 'd':
+ display_all = 0;
+
+ for (i = 0; i < argc; i++)
+ if (!hand[i].func) {
+ hand[i].func = handle_datasets;
+ hand[i].obj = HDstrdup(opt_arg);
+ hand[i].subset_info = parse_subset_params(hand[i].obj);
+ last_dset = &hand[i];
+ break;
+ }
+
+ last_was_dset = TRUE;
+ break;
+ case 'f':
+ driver = opt_arg;
+ break;
+ case 'g':
+ display_all = 0;
+
+ for (i = 0; i < argc; i++)
+ if (!hand[i].func) {
+ hand[i].func = handle_groups;
+ hand[i].obj = HDstrdup(opt_arg);
+ break;
+ }
+
+ last_was_dset = FALSE;
+ break;
+ case 'l':
+ display_all = 0;
+
+ for (i = 0; i < argc; i++)
+ if (!hand[i].func) {
+ hand[i].func = handle_links;
+ hand[i].obj = HDstrdup(opt_arg);
+ break;
+ }
+
+ last_was_dset = FALSE;
+ break;
+ case 't':
+ display_all = 0;
+
+ for (i = 0; i < argc; i++)
+ if (!hand[i].func) {
+ hand[i].func = handle_datatypes;
+ hand[i].obj = HDstrdup(opt_arg);
+ break;
+ }
+
+ last_was_dset = FALSE;
+ break;
+
+ case 'O':
+ if (h5tools_set_output_file(opt_arg, 0) < 0) {
+ usage(h5tools_getprogname());
+ goto error;
+ }
+ break;
+
+ case 'o':
+ if ( bin_output ) {
+ if (h5tools_set_data_output_file(opt_arg, 1) < 0) {
+ usage(h5tools_getprogname());
+ goto error;
+ }
+ }
+ else {
+ if(display_attr_data && !display_data) {
+ if (h5tools_set_attr_output_file(opt_arg, 0) < 0) {
+ usage(h5tools_getprogname());
+ goto error;
+ }
+ }
+ if(display_data || display_all) {
+ if (h5tools_set_data_output_file(opt_arg, 0) < 0) {
+ usage(h5tools_getprogname());
+ goto error;
+ }
+ }
+ }
+
+ usingdasho = TRUE;
+ last_was_dset = FALSE;
+ outfname = opt_arg;
+ break;
+
+ case 'b':
+ if ( opt_arg != NULL) {
+ if ( ( bin_form = set_binary_form(opt_arg)) < 0) {
+ /* failed to set binary form */
+ usage(h5tools_getprogname());
+ goto error;
+ }
+ }
+ bin_output = TRUE;
+ if (outfname!=NULL) {
+ if (h5tools_set_data_output_file(outfname, 1) < 0) {
+ /* failed to set output file */
+ usage(h5tools_getprogname());
+ goto error;
+ }
+
+ last_was_dset = FALSE;
+ }
+ break;
+
+ case 'q':
+ if ( ( sort_by = set_sort_by(opt_arg)) < 0) {
+ /* failed to set "sort by" form */
+ usage(h5tools_getprogname());
+ goto error;
+ }
+ break;
+
+ case 'z':
+ if ( ( sort_order = set_sort_order(opt_arg)) < 0) {
+ /* failed to set "sort order" form */
+ usage(h5tools_getprogname());
+ goto error;
+ }
+ break;
+
+ case 'M':
+ if (!last_was_dset) {
+ error_msg("option `-%c' can only be used after --dataset option\n", opt);
+ goto error;
+ }
+ if (parse_mask_list(opt_arg) != SUCCEED){
+ usage(h5tools_getprogname());
+ goto error;
+ }
+ display_packed_bits = TRUE;
+ break;
+ case 'v':
+ display_vds_first = TRUE;
+ break;
+ case 'G':
+ vds_gap_size = HDatoi(opt_arg);
+ if (vds_gap_size < 0) {
+ usage(h5tools_getprogname());
+ goto error;
+ }
+ break;
+
+ /** begin XML parameters **/
+ case 'x':
+ /* select XML output */
+ doxml = TRUE;
+ useschema = TRUE;
+ h5tools_dump_header_format = NULL;
+ dump_function_table = &xml_function_table;
+ h5tools_nCols = 0;
+ break;
+ case 'u':
+ doxml = TRUE;
+ useschema = FALSE;
+ xmlnsprefix = "";
+ h5tools_dump_header_format = NULL;
+ dump_function_table = &xml_function_table;
+ h5tools_nCols = 0;
+ break;
+ case 'D':
+ /* specify alternative XML DTD or schema */
+ /* To Do: check format of this value? */
+ xml_dtd_uri = opt_arg;
+ h5tools_nCols = 0;
+ break;
+
+ case 'm':
+ /* specify alternative floating point printing format */
+ fp_format = opt_arg;
+ h5tools_nCols = 0;
+ break;
+
+ case 'X':
+ /* specify XML namespace (default="hdf5:"), or none */
+ /* To Do: check format of this value? */
+ if (!useschema) {
+ usage(h5tools_getprogname());
+ goto error;
+ }
+ if (HDstrcmp(opt_arg,":") == 0)
+ xmlnsprefix = "";
+ else
+ xmlnsprefix = opt_arg;
+ h5tools_nCols = 0;
+ break;
+ /** end XML parameters **/
+
+ /** begin subsetting parameters **/
+ case 's':
+ case 'S':
+ case 'c':
+ case 'k': {
+ struct subset_t *s;
+
+ if (!last_was_dset) {
+ error_msg("option `-%c' can only be used after --dataset option\n", opt);
+ goto error;
+ }
+
+ if (last_dset->subset_info) {
+ /*
+ * This overrides the "terse" syntax if they actually mixed
+ * the two.
+ */
+ s = last_dset->subset_info;
+ }
+ else {
+ last_dset->subset_info = s = (struct subset_t *)HDcalloc(1, sizeof(struct subset_t));
+ }
+
+ /*
+ * slightly convoluted, but...we are only interested in options
+ * for subsetting: "--start", "--stride", "--count", and "--block"
+ * which can come in any order. If we run out of parameters (EOF)
+ * or run into one which isn't a subsetting parameter (NOT s, S,
+ * c, or K), then we exit the do-while look, set the subset_info
+ * to the structure we've been filling. If we've reached the end
+ * of the options, we exit the parsing (goto parse_end) otherwise,
+ * since we've "read" the next option, we need to parse it. So we
+ * jump to the beginning of the switch statement (goto parse_start).
+ */
+ do {
+ switch ((char)opt) {
+ case 's':
+ if (s->start.data) {
+ HDfree(s->start.data);
+ s->start.data = NULL;
+ }
+ parse_hsize_list(opt_arg, &s->start);
+ break;
+ case 'S':
+ if (s->stride.data) {
+ HDfree(s->stride.data);
+ s->stride.data = NULL;
+ }
+ parse_hsize_list(opt_arg, &s->stride);
+ break;
+ case 'c':
+ if (s->count.data) {
+ HDfree(s->count.data);
+ s->count.data = NULL;
+ }
+ parse_hsize_list(opt_arg, &s->count);
+ break;
+ case 'k':
+ if (s->block.data) {
+ HDfree(s->block.data);
+ s->block.data = NULL;
+ }
+ parse_hsize_list(opt_arg, &s->block);
+ break;
+ default:
+ goto end_collect;
+ }
+ } while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF);
+
+end_collect:
+ last_was_dset = FALSE;
+
+ if (opt != EOF)
+ goto parse_start;
+ else
+ goto parse_end;
+ }
+ /** end subsetting parameters **/
+
+ case 'E':
+ enable_error_stack = TRUE;
+ break;
+ case 'C':
+ disable_compact_subset = TRUE;
+ break;
+ case 'h':
+ usage(h5tools_getprogname());
+ free_handler(hand, argc);
+ hand = NULL;
+ h5tools_setstatus(EXIT_SUCCESS);
+ goto done;
+ case '?':
+ default:
+ usage(h5tools_getprogname());
+ goto error;
+ }
+ }
+
+parse_end:
+ /* check for file name to be processed */
+ if (argc <= opt_ind) {
+ error_msg("missing file name\n");
+ usage(h5tools_getprogname());
+ goto error;
+ }
+done:
+ return hand;
+
+error:
+ if (hand) {
+ free_handler(hand, argc);
+ hand = NULL;
+ }
+ h5tools_setstatus(EXIT_FAILURE);
+
+ return hand;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: main
+ *
+ * Purpose: HDF5 dumper
+ *
+ * Return: Success: 0
+ * Failure: 1
+ *
+ * Programmer: Ruey-Hsia Li
+ *
+ * Modifications:
+ * Albert Cheng
+ * 30. September 2000
+ * Add the -o option--output file for datasets raw data
+ *
+ * REMcG
+ * November 2000
+ * Changes to support XML.
+ *
+ * Bill Wendling
+ * Wednesday, 10. January 2001
+ * Modified the way command line parameters are interpreted. They go
+ * through one function call now (get_option).
+ *
+ * Bill Wendling
+ * Tuesday, 20. February 2001
+ * Moved command line parsing to separate function. Made various
+ * "display_*" flags global.
+ *
+ * REMcG
+ * August 2003
+ * Major upgrade to XML support.
+ *
+ * Pedro Vicente
+ * September 2007
+ * list objects in requested order (creation order or alphabetically)
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+main(int argc, const char *argv[])
+{
+ hid_t fid = -1;
+ hid_t gid = -1;
+ H5E_auto2_t func;
+ H5E_auto2_t tools_func;
+ H5O_info_t oi;
+ struct handler_t *hand = NULL;
+ int i;
+ unsigned u;
+ void *edata;
+ void *tools_edata;
+ char *fname = NULL;
+
+ h5tools_setprogname(PROGRAMNAME);
+ h5tools_setstatus(EXIT_SUCCESS);
+ h5tools_dump_header_format = &h5tools_standardformat;
+ dump_function_table = &ddl_function_table;
+ dump_indent = 0;
+
+ /* Disable error reporting */
+ H5Eget_auto2(H5E_DEFAULT, &func, &edata);
+ H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
+
+ /* Initialize h5tools lib */
+ h5tools_init();
+
+ /* Disable tools error reporting */
+ H5Eget_auto2(H5tools_ERR_STACK_g, &tools_func, &tools_edata);
+ H5Eset_auto2(H5tools_ERR_STACK_g, NULL, NULL);
+
+ if((hand = parse_command_line(argc, argv))==NULL) {
+ goto done;
+ }
+
+ if (bin_output && outfname == NULL) {
+ error_msg("binary output requires a file name, use -o <filename>\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
+ }
+
+ if (enable_error_stack) {
+ H5Eset_auto2(H5E_DEFAULT, func, edata);
+ H5Eset_auto2(H5tools_ERR_STACK_g, tools_func, tools_edata);
+ }
+
+ /* Check for conflicting options */
+ if (doxml) {
+ if (!display_all) {
+ error_msg("option \"%s\" not available for XML\n",
+ "to display selected objects");
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
+ }
+ else if (display_bb) {
+ error_msg("option \"%s\" not available for XML\n", "--boot-block");
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
+ }
+ else if (display_oid == 1) {
+ error_msg("option \"%s\" not available for XML\n", "--object-ids");
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
+ }
+ else if (display_char == TRUE) {
+ error_msg("option \"%s\" not available for XML\n", "--string");
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
+ }
+ else if (usingdasho) {
+ error_msg("option \"%s\" not available for XML\n", "--output");
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
+ }
+ }
+ else {
+ if (xml_dtd_uri) {
+ warn_msg("option \"%s\" only applies with XML: %s\n", "--xml-dtd", xml_dtd_uri);
+ }
+ }
+
+ if (argc <= opt_ind) {
+ error_msg("missing file name\n");
+ usage(h5tools_getprogname());
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
+ }
+ /* Initialize indexing options */
+ h5trav_set_index(sort_by, sort_order);
+
+ while(opt_ind < argc) {
+ fname = HDstrdup(argv[opt_ind++]);
+
+ fid = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, driver, NULL, 0);
+
+ if (fid < 0) {
+ error_msg("unable to open file \"%s\"\n", fname);
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
+ }
+
+ /* allocate and initialize internal data structure */
+ init_prefix(&prefix, prefix_len);
+
+ /* Prepare to find objects that might be targets of a reference */
+ fill_ref_path_table(fid);
+
+ if(doxml) {
+ /* initialize XML */
+ /* reset prefix! */
+ HDstrcpy(prefix, "");
+
+ /* make sure the URI is initialized to something */
+ if (xml_dtd_uri == NULL) {
+ if (useschema) {
+ xml_dtd_uri = DEFAULT_XSD;
+ }
+ else {
+ xml_dtd_uri = DEFAULT_DTD;
+ xmlnsprefix = "";
+ }
+ }
+ else {
+ if (useschema && HDstrcmp(xmlnsprefix,"")) {
+ error_msg("Cannot set Schema URL for a qualified namespace--use -X or -U option with -D \n");
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
+ }
+ }
+ }
+
+ /* Get object info for root group */
+ if(H5Oget_info_by_name(fid, "/", &oi, H5P_DEFAULT) < 0) {
+ error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__);
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
+ }
+
+ /* Initialize object tables */
+ if(table_list_add(fid, oi.fileno) < 0) {
+ error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__);
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
+ }
+ group_table = table_list.tables[0].group_table;
+ dset_table = table_list.tables[0].dset_table;
+ type_table = table_list.tables[0].type_table;
+
+ /* does there exist unamed committed datatype */
+ for (u = 0; u < type_table->nobjs; u++)
+ if (!type_table->objs[u].recorded) {
+ unamedtype = 1;
+ break;
+ } /* end if */
+
+ /* start to dump - display file header information */
+ if (!doxml) {
+ begin_obj(h5tools_dump_header_format->filebegin, fname, h5tools_dump_header_format->fileblockbegin);
+ }
+ else {
+ PRINTVALSTREAM(rawoutstream, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
+
+ /* alternative first element, depending on schema or DTD. */
+ if (useschema) {
+ if (HDstrcmp(xmlnsprefix,"") == 0) {
+ PRINTSTREAM(rawoutstream, "<HDF5-File xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"%s\">\n",
+ xml_dtd_uri);
+ }
+ else {
+ /* TO DO: make -url option work in this case (may need new option) */
+ char *ns;
+ char *indx;
+
+ ns = HDstrdup(xmlnsprefix);
+ indx = HDstrrchr(ns,(int)':');
+ if (indx) *indx = '\0';
+
+ PRINTSTREAM(rawoutstream, "<%sHDF5-File xmlns:%s=\"http://hdfgroup.org/HDF5/XML/schema/HDF5-File.xsd\" "
+ "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "
+ "xsi:schemaLocation=\"http://hdfgroup.org/HDF5/XML/schema/HDF5-File "
+ "http://www.hdfgroup.org/HDF5/XML/schema/HDF5-File.xsd\">\n",xmlnsprefix,ns);
+ HDfree(ns);
+ }
+ }
+ else {
+ PRINTSTREAM(rawoutstream, "<!DOCTYPE HDF5-File PUBLIC \"HDF5-File.dtd\" \"%s\">\n", xml_dtd_uri);
+ PRINTVALSTREAM(rawoutstream, "<HDF5-File>\n");
+ }
+ }
+
+ if (!doxml) {
+ if (display_fi) {
+ PRINTVALSTREAM(rawoutstream, "\n");
+ dump_fcontents(fid);
+ end_obj(h5tools_dump_header_format->fileend,h5tools_dump_header_format->fileblockend);
+ PRINTVALSTREAM(rawoutstream, "\n");
+ goto done;
+ }
+
+ if (display_bb)
+ dump_fcpl(fid);
+ }
+
+ if(display_all) {
+ if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) {
+ error_msg("unable to open root group\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ }
+ else {
+ if (!doxml)
+ dump_indent += COL;
+ dump_function_table->dump_group_function(gid, "/" );
+ if (!doxml)
+ dump_indent -= COL;
+ PRINTVALSTREAM(rawoutstream, "\n");
+ }
+
+ if(H5Gclose(gid) < 0) {
+ error_msg("unable to close root group\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ }
+
+ }
+ else {
+ /* Note: this option is not supported for XML */
+ if(doxml) {
+ error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__);
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
+ } /* end if */
+
+ for(i = 0; i < argc; i++) {
+ if(hand[i].func) {
+ hand[i].func(fid, hand[i].obj, hand[i].subset_info, 1, NULL);
+ }
+ }
+ PRINTVALSTREAM(rawoutstream, "\n");
+ }
+
+ if (!doxml) {
+ end_obj(h5tools_dump_header_format->fileend, h5tools_dump_header_format->fileblockend);
+ PRINTVALSTREAM(rawoutstream, "\n");
+ }
+ else {
+ PRINTSTREAM(rawoutstream, "</%sHDF5-File>\n", xmlnsprefix);
+ }
+ /* Free tables for objects */
+ table_list_free();
+
+ if(fid >=0)
+ if (H5Fclose(fid) < 0)
+ h5tools_setstatus(EXIT_FAILURE);
+
+ if(prefix) {
+ HDfree(prefix);
+ prefix = NULL;
+ }
+ if(fname) {
+ HDfree(fname);
+ fname = NULL;
+ }
+ } /* end while */
+
+ if(hand)
+ free_handler(hand, argc);
+
+ /* To Do: clean up XML table */
+
+ leave(h5tools_getstatus());
+
+done:
+ /* Free tables for objects */
+ table_list_free();
+
+ if(fid >=0)
+ if (H5Fclose(fid) < 0)
+ h5tools_setstatus(EXIT_FAILURE);
+
+ if(prefix) {
+ HDfree(prefix);
+ prefix = NULL;
+ }
+ if(fname) {
+ HDfree(fname);
+ fname = NULL;
+ }
+
+ if(hand)
+ free_handler(hand, argc);
+
+ /* To Do: clean up XML table */
+
+ H5Eset_auto2(H5E_DEFAULT, func, edata);
+
+ leave(h5tools_getstatus());
+}
+
+/*-------------------------------------------------------------------------
+ * Function: h5_fileaccess
+ *
+ * Purpose: Returns a file access template which is the default template
+ * but with a file driver set according to the constant or
+ * environment variable HDF5_DRIVER
+ *
+ * Return: Success: A file access property list
+ *
+ * Failure: -1
+ *
+ * Programmer: Robb Matzke
+ * Thursday, November 19, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+h5_fileaccess(void)
+{
+ static const char *multi_letters = "msbrglo";
+ const char *val = NULL;
+ const char *name;
+ char s[1024];
+ hid_t fapl = -1;
+
+ /* First use the environment variable, then the constant */
+ val = HDgetenv("HDF5_DRIVER");
+#ifdef HDF5_DRIVER
+ if (!val) val = HDF5_DRIVER;
+#endif
+
+ if ((fapl=H5Pcreate(H5P_FILE_ACCESS))<0) return -1;
+ if (!val || !*val) return fapl; /*use default*/
+
+ HDstrncpy(s, val, sizeof s);
+ s[sizeof(s)-1] = '\0';
+ if (NULL==(name=HDstrtok(s, " \t\n\r"))) return fapl;
+
+ if (!HDstrcmp(name, "sec2")) {
+ /* Unix read() and write() system calls */
+ if (H5Pset_fapl_sec2(fapl)<0) return -1;
+ }
+ else if (!HDstrcmp(name, "stdio")) {
+ /* Standard C fread() and fwrite() system calls */
+ if (H5Pset_fapl_stdio(fapl)<0) return -1;
+ }
+ else if (!HDstrcmp(name, "core")) {
+ /* In-core temporary file with 1MB increment */
+ if (H5Pset_fapl_core(fapl, 1024*1024, FALSE)<0) return -1;
+ }
+ else if (!HDstrcmp(name, "split")) {
+ /* Split meta data and raw data each using default driver */
+ if (H5Pset_fapl_split(fapl, "-m.h5", H5P_DEFAULT, "-r.h5", H5P_DEFAULT) < 0)
+ return -1;
+ }
+ else if (!HDstrcmp(name, "multi")) {
+ /* Multi-file driver, general case of the split driver */
+ H5FD_mem_t memb_map[H5FD_MEM_NTYPES];
+ hid_t memb_fapl[H5FD_MEM_NTYPES];
+ const char *memb_name[H5FD_MEM_NTYPES];
+ char sv[H5FD_MEM_NTYPES][1024];
+ haddr_t memb_addr[H5FD_MEM_NTYPES];
+ H5FD_mem_t mt;
+
+ HDmemset(memb_map, 0, sizeof memb_map);
+ HDmemset(memb_fapl, 0, sizeof memb_fapl);
+ HDmemset(memb_name, 0, sizeof memb_name);
+ HDmemset(memb_addr, 0, sizeof memb_addr);
+
+ HDassert(HDstrlen(multi_letters)==H5FD_MEM_NTYPES);
+ for (mt=H5FD_MEM_DEFAULT; mt<H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,mt)) {
+ memb_fapl[mt] = H5P_DEFAULT;
+ memb_map[mt] = mt;
+ sprintf(sv[mt], "%%s-%c.h5", multi_letters[mt]);
+ memb_name[mt] = sv[mt];
+ memb_addr[mt] = (haddr_t)MAX(mt - 1, 0) * (HADDR_MAX / 10);
+ }
+
+ if (H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name, memb_addr, FALSE) < 0)
+ return -1;
+ }
+ else if (!HDstrcmp(name, "family")) {
+ hsize_t fam_size = 100*1024*1024; /*100 MB*/
+
+ /* Family of files, each 1MB and using the default driver */
+ if ((val=HDstrtok(NULL, " \t\n\r")))
+ fam_size = (hsize_t)(HDstrtod(val, NULL) * 1024*1024);
+ if (H5Pset_fapl_family(fapl, fam_size, H5P_DEFAULT)<0)
+ return -1;
+ }
+ else if (!HDstrcmp(name, "log")) {
+ long log_flags = H5FD_LOG_LOC_IO;
+
+ /* Log file access */
+ if ((val = HDstrtok(NULL, " \t\n\r")))
+ log_flags = HDstrtol(val, NULL, 0);
+
+ if (H5Pset_fapl_log(fapl, NULL, (unsigned)log_flags, 0) < 0)
+ return -1;
+ }
+ else if (!HDstrcmp(name, "direct")) {
+ /* Substitute Direct I/O driver with sec2 driver temporarily because
+ * some output has sec2 driver as the standard. */
+ if (H5Pset_fapl_sec2(fapl)<0) return -1;
+ }
+ else {
+ /* Unknown driver */
+ return -1;
+ }
+
+ return fapl;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: init_prefix
+ *
+ * Purpose: allocate and initialize prefix
+ *
+ * Return: void
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+init_prefix(char **prfx, size_t prfx_len)
+{
+ HDassert(prfx_len > 0);
+ *prfx = (char *)HDcalloc(prfx_len, 1);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: add_prefix
+ *
+ * Purpose: Add object to prefix
+ *
+ * Return: void
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+add_prefix(char **prfx, size_t *prfx_len, const char *name)
+{
+ size_t new_len = HDstrlen(*prfx) + HDstrlen(name) + 2;
+
+ /* Check if we need more space */
+ if(*prfx_len <= new_len) {
+ *prfx_len = new_len + 1;
+ *prfx = (char *)HDrealloc(*prfx, *prfx_len);
+ }
+
+ /* Append object name to prefix */
+ HDstrcat(HDstrcat(*prfx, "/"), name);
+} /* end add_prefix */
+
diff --git a/tools/src/h5dump/h5dump.h b/tools/src/h5dump/h5dump.h
new file mode 100644
index 0000000..8224c02
--- /dev/null
+++ b/tools/src/h5dump/h5dump.h
@@ -0,0 +1,115 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#ifndef H5DUMP_H__
+#define H5DUMP_H__
+
+#include "hdf5.h"
+#include "H5private.h"
+#include "h5tools.h"
+#include "h5tools_utils.h"
+#include "h5tools_ref.h"
+#include "h5trav.h"
+#include "h5dump_defines.h"
+
+/**
+ ** This is the global dispatch table for the dump functions.
+ **/
+/* the table of dump functions */
+typedef struct dump_functions_t {
+ void (*dump_group_function) (hid_t, const char *);
+ void (*dump_named_datatype_function) (hid_t, const char *);
+ void (*dump_dataset_function) (hid_t, const char *, struct subset_t *);
+ void (*dump_dataspace_function) (hid_t);
+ void (*dump_datatype_function) (hid_t);
+ herr_t (*dump_attribute_function) (hid_t, const char *, const H5A_info_t *, void *);
+ void (*dump_data_function) (hid_t, int, struct subset_t *, int);
+} dump_functions;
+
+/* List of table structures. There is one table structure for each file */
+typedef struct h5dump_table_items_t {
+ unsigned long fileno; /* File number that these tables refer to */
+ hid_t oid; /* ID of an object in this file, held open so fileno is consistent */
+ table_t *group_table; /* Table of groups */
+ table_t *dset_table; /* Table of datasets */
+ table_t *type_table; /* Table of datatypes */
+} h5dump_table_items_t;
+typedef struct h5dump_table_list_t {
+ size_t nalloc;
+ size_t nused;
+ h5dump_table_items_t *tables;
+} h5dump_table_list_t;
+
+h5dump_table_list_t table_list = {0, 0, NULL};
+table_t *group_table = NULL, *dset_table = NULL, *type_table = NULL;
+unsigned dump_indent = 0; /*how far in to indent the line */
+
+int unamedtype = 0; /* shared datatype with no name */
+hbool_t hit_elink = FALSE; /* whether we have traversed an external link */
+size_t prefix_len = 1024;
+char *prefix = NULL;
+const char *fp_format = NULL;
+
+/* things to display or which are set via command line parameters */
+int display_all = TRUE;
+int display_oid = FALSE;
+int display_data = TRUE;
+int display_attr_data = TRUE;
+int display_char = FALSE; /*print 1-byte numbers as ASCII */
+int usingdasho = FALSE;
+int display_bb = FALSE; /*superblock */
+int display_dcpl = FALSE; /*dcpl */
+int display_fi = FALSE; /*file index */
+int display_ai = TRUE; /*array index */
+int display_escape = FALSE; /*escape non printable characters */
+int display_region = FALSE; /*print region reference data */
+int disable_compact_subset= FALSE; /* disable compact form of subset notation */
+int display_packed_bits = FALSE; /*print 1-8 byte numbers as packed bits*/
+int include_attrs = TRUE; /* Display attributes */
+int display_vds_first = FALSE; /* vds display to all by default*/
+int vds_gap_size = 0; /* vds skip missing files default is none */
+
+/* sort parameters */
+H5_index_t sort_by = H5_INDEX_NAME; /*sort_by [creation_order | name] */
+H5_iter_order_t sort_order = H5_ITER_INC; /*sort_order [ascending | descending] */
+
+#define PACKED_BITS_MAX 8 /* Maximum number of packed-bits to display */
+#define PACKED_BITS_SIZE_MAX (8*sizeof(long long)) /* Maximum bits size of integer types of packed-bits */
+/* mask list for packed bits */
+unsigned long long packed_mask[PACKED_BITS_MAX]; /* packed bits are restricted to 8*sizeof(llong) bytes */
+
+/* packed bits display parameters */
+unsigned packed_offset[PACKED_BITS_MAX];
+unsigned packed_length[PACKED_BITS_MAX];
+
+/*
+ * The global table is set to either ddl_function_table or
+ * xml_function_table in the initialization.
+ */
+const dump_functions *dump_function_table;
+
+#ifdef __cplusplus
+"C" {
+#endif
+
+void add_prefix(char **prfx, size_t *prfx_len, const char *name);
+hid_t h5_fileaccess(void);
+ssize_t table_list_add(hid_t oid, unsigned long file_no);
+ssize_t table_list_visited(unsigned long file_no);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !H5DUMP_H__ */
diff --git a/tools/src/h5dump/h5dump_ddl.c b/tools/src/h5dump/h5dump_ddl.c
new file mode 100644
index 0000000..182d570
--- /dev/null
+++ b/tools/src/h5dump/h5dump_ddl.c
@@ -0,0 +1,2178 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "H5private.h"
+#include "h5tools.h"
+#include "h5tools_dump.h"
+#include "h5tools_utils.h"
+#include "h5tools_ref.h"
+#include "h5trav.h"
+#include "h5dump_extern.h"
+#include "h5dump_ddl.h"
+
+typedef struct {
+ hid_t fid; /* File ID being traversed */
+ const char *op_name; /* Object name wanted */
+} trav_handle_udata_t;
+
+typedef struct {
+ const char *path; /* Path of object being searched */
+ const char *op_name; /* Object name wanted */
+} trav_attr_udata_t;
+
+/* callback function used by H5Literate() */
+static herr_t dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void *op_data);
+static int dump_extlink(hid_t group, const char *linkname, const char *objname);
+
+/*-------------------------------------------------------------------------
+ * Function: dump_datatype
+ *
+ * Purpose: Dump the datatype. Datatype can be HDF5 predefined
+ * atomic datatype or committed/transient datatype.
+ *
+ * Return: void
+ *
+ * Programmer: Ruey-Hsia Li
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+dump_datatype(hid_t type)
+{
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t *outputformat = &h5tools_dataformat;
+
+ HDmemset(&ctx, 0, sizeof(ctx));
+ ctx.indent_level = dump_indent / COL;
+ ctx.cur_column = dump_indent;
+
+ h5dump_type_table = type_table;
+ h5tools_dump_datatype(rawoutstream, outputformat, &ctx, type);
+ h5dump_type_table = NULL;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: dump_dataspace
+ *
+ * Purpose: Dump the dataspace. Dataspace can be named dataspace,
+ * array, or others.
+ *
+ * Return: void
+ *
+ * Programmer: Ruey-Hsia Li
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+dump_dataspace(hid_t space)
+{
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t *outputformat = &h5tools_dataformat;
+
+ HDmemset(&ctx, 0, sizeof(ctx));
+ ctx.indent_level = dump_indent / COL;
+ ctx.cur_column = dump_indent;
+
+ h5tools_dump_dataspace(rawoutstream, outputformat, &ctx, space);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: dump_attr_cb
+ *
+ * Purpose: attribute function callback called by H5Aiterate2, displays the attribute
+ *
+ * Return: Success: SUCCEED
+ *
+ * Failure: FAIL
+ *
+ * Programmer: Ruey-Hsia Li
+ *
+ * Modifications: Pedro Vicente, October 4, 2007
+ * Added H5A_info_t parameter to conform with H5Aiterate2
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+dump_attr_cb(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *info, void H5_ATTR_UNUSED *_op_data)
+{
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t *outputformat = &h5tools_dataformat;
+ h5tool_format_t string_dataformat;
+
+ hid_t attr_id;
+ herr_t ret = SUCCEED;
+
+ HDmemset(&ctx, 0, sizeof(ctx));
+ ctx.indent_level = dump_indent / COL;
+ ctx.cur_column = dump_indent;
+
+ attr_id = H5Aopen(oid, attr_name, H5P_DEFAULT);
+ oid_output = display_oid;
+ data_output = display_data;
+ attr_data_output = display_attr_data;
+
+ string_dataformat = *outputformat;
+
+ if (fp_format) {
+ string_dataformat.fmt_double = fp_format;
+ string_dataformat.fmt_float = fp_format;
+ }
+
+ if (h5tools_nCols == 0) {
+ string_dataformat.line_ncols = 65535;
+ string_dataformat.line_per_line = 1;
+ }
+ else
+ string_dataformat.line_ncols = h5tools_nCols;
+
+ string_dataformat.do_escape = display_escape;
+ outputformat = &string_dataformat;
+
+ h5dump_type_table = type_table;
+ h5tools_dump_attribute(rawoutstream, outputformat, &ctx, attr_name, attr_id, display_ai, display_char);
+ h5dump_type_table = NULL;
+
+ if(attr_id < 0) {
+ h5tools_setstatus(EXIT_FAILURE);
+ ret = FAIL;
+ }
+
+ return ret;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: dump_all_cb
+ *
+ * Purpose: function callback called by H5Literate,
+ * displays everything in the specified object
+ *
+ * Return: Success: SUCCEED
+ *
+ * Failure: FAIL
+ *
+ * Programmer: Ruey-Hsia Li
+ *
+ * Modifications:
+ * RMcG, November 2000
+ * Added XML support. Also, optionally checks the op_data argument
+ *
+ * PVN, May 2008
+ * Dump external links
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR_UNUSED *op_data)
+{
+ hid_t obj;
+ hid_t dapl_id = H5P_DEFAULT; /* dataset access property list ID */
+ herr_t ret = SUCCEED;
+ char *obj_path = NULL; /* Full path of object */
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t *outputformat = &h5tools_dataformat;
+ h5tool_format_t string_dataformat;
+ hsize_t curr_pos = 0; /* total data element position */
+
+ /* setup */
+ HDmemset(&buffer, 0, sizeof(h5tools_str_t));
+
+ HDmemset(&ctx, 0, sizeof(ctx));
+ ctx.indent_level = dump_indent / COL;
+ ctx.cur_column = dump_indent;
+
+ string_dataformat = *outputformat;
+
+ if (fp_format) {
+ string_dataformat.fmt_double = fp_format;
+ string_dataformat.fmt_float = fp_format;
+ }
+
+ if (h5tools_nCols == 0) {
+ string_dataformat.line_ncols = 65535;
+ string_dataformat.line_per_line = 1;
+ }
+ else
+ string_dataformat.line_ncols = h5tools_nCols;
+
+ string_dataformat.do_escape = display_escape;
+ outputformat = &string_dataformat;
+
+ /* Build the object's path name */
+ obj_path = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2);
+ if(!obj_path) {
+ ret = FAIL;
+ goto done;
+ }
+
+ HDstrcpy(obj_path, prefix);
+ HDstrcat(obj_path, "/");
+ HDstrcat(obj_path, name);
+
+ if(linfo->type == H5L_TYPE_HARD) {
+ H5O_info_t oinfo;
+
+ /* Stat the object */
+ if(H5Oget_info_by_name(group, name, &oinfo, H5P_DEFAULT) < 0) {
+ error_msg("unable to get object information for \"%s\"\n", name);
+ h5tools_setstatus(EXIT_FAILURE);
+ ret = FAIL;
+ goto done;
+ } /* end if */
+
+ switch(oinfo.type) {
+ case H5O_TYPE_GROUP:
+ if((obj = H5Gopen2(group, name, H5P_DEFAULT)) < 0) {
+ error_msg("unable to dump group \"%s\"\n", name);
+ h5tools_setstatus(EXIT_FAILURE);
+ ret = FAIL;
+ }
+ else {
+ char *old_prefix; /* Pointer to previous prefix */
+
+ /* Keep copy of prefix before iterating into group */
+ old_prefix = HDstrdup(prefix);
+ HDassert(old_prefix);
+
+ /* Append group name to prefix */
+ add_prefix(&prefix, &prefix_len, name);
+
+ /* Iterate into group */
+ dump_function_table->dump_group_function(obj, name);
+
+ /* Restore old prefix name */
+ HDstrcpy(prefix, old_prefix);
+ HDfree(old_prefix);
+
+ /* Close group */
+ H5Gclose(obj);
+ }
+ break;
+
+ case H5O_TYPE_DATASET:
+ if(display_data) {
+ if ((dapl_id = H5Pcreate(H5P_DATASET_ACCESS)) < 0) {
+ error_msg("error in creating default access property list ID\n");
+ }
+ if (display_vds_first) {
+ if(H5Pset_virtual_view(dapl_id, H5D_VDS_FIRST_MISSING) < 0)
+ error_msg("error in setting access property list ID, virtual_view\n");
+ }
+ if (vds_gap_size > 0) {
+ if(H5Pset_virtual_printf_gap(dapl_id, (hsize_t)vds_gap_size) < 0)
+ error_msg("error in setting access property list ID, virtual_printf_gap\n");
+ }
+ }
+ if((obj = H5Dopen2(group, name, dapl_id)) >= 0) {
+ if(oinfo.rc > 1 || hit_elink) {
+ obj_t *found_obj; /* Found object */
+
+ found_obj = search_obj(dset_table, oinfo.addr);
+
+ if(found_obj == NULL) {
+ ctx.indent_level++;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "%s \"%s\" %s",
+ h5tools_dump_header_format->datasetbegin, name,
+ h5tools_dump_header_format->datasetblockbegin);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ if(HDstrlen(h5tools_dump_header_format->datasetblockend)) {
+ h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetblockend);
+ if(HDstrlen(h5tools_dump_header_format->datasetend))
+ h5tools_str_append(&buffer, " ");
+ }
+ if(HDstrlen(h5tools_dump_header_format->datasetend))
+ h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetend);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.indent_level--;
+
+ h5tools_setstatus(EXIT_FAILURE);
+ ret = FAIL;
+ if (dapl_id != H5P_DEFAULT)
+ H5Pclose(dapl_id);
+ H5Dclose(obj);
+ goto done;
+ }
+ else if(found_obj->displayed) {
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "%s \"%s\" %s",
+ h5tools_dump_header_format->datasetbegin, name,
+ h5tools_dump_header_format->datasetblockbegin);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.indent_level++;
+
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "%s \"%s\"", HARDLINK, found_obj->objname);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.indent_level--;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ if(HDstrlen(h5tools_dump_header_format->datasetblockend)) {
+ h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetblockend);
+ if(HDstrlen(h5tools_dump_header_format->datasetend))
+ h5tools_str_append(&buffer, " ");
+ }
+ if(HDstrlen(h5tools_dump_header_format->datasetend))
+ h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetend);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ if (dapl_id != H5P_DEFAULT)
+ H5Pclose(dapl_id);
+ H5Dclose(obj);
+ goto done;
+ }
+ else {
+ found_obj->displayed = TRUE;
+ }
+ } /* end if */
+
+ dump_function_table->dump_dataset_function(obj, name, NULL);
+ if (dapl_id != H5P_DEFAULT)
+ H5Pclose(dapl_id);
+ H5Dclose(obj);
+ }
+ else {
+ if (dapl_id != H5P_DEFAULT)
+ H5Pclose(dapl_id);
+ error_msg("unable to dump dataset \"%s\"\n", name);
+ h5tools_setstatus(EXIT_FAILURE);
+ ret = FAIL;
+ }
+ break;
+
+ case H5O_TYPE_NAMED_DATATYPE:
+ if((obj = H5Topen2(group, name, H5P_DEFAULT)) < 0) {
+ error_msg("unable to dump datatype \"%s\"\n", name);
+ h5tools_setstatus(EXIT_FAILURE);
+ ret = FAIL;
+ }
+ else {
+ dump_function_table->dump_named_datatype_function(obj, name);
+ H5Tclose(obj);
+ }
+ break;
+
+ case H5O_TYPE_UNKNOWN:
+ case H5O_TYPE_NTYPES:
+ default:
+ error_msg("unknown object \"%s\"\n", name);
+ h5tools_setstatus(EXIT_FAILURE);
+ ret = FAIL;
+ }
+ } /* end if */
+ else {
+ char *targbuf;
+
+ switch(linfo->type) {
+ case H5L_TYPE_SOFT:
+ targbuf = (char *)HDmalloc(linfo->u.val_size);
+ HDassert(targbuf);
+
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "%s \"%s\" %s",
+ h5tools_dump_header_format->softlinkbegin, name,
+ h5tools_dump_header_format->softlinkblockbegin);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.indent_level++;
+
+ if(H5Lget_val(group, name, targbuf, linfo->u.val_size, H5P_DEFAULT) < 0) {
+ error_msg("unable to get link value\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ ret = FAIL;
+ }
+ else {
+ /* print the value of a soft link */
+ /* Standard DDL: no modification */
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "LINKTARGET \"%s\"", targbuf);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
+
+ ctx.indent_level--;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ if(HDstrlen(h5tools_dump_header_format->softlinkblockend)) {
+ h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->softlinkblockend);
+ if(HDstrlen(h5tools_dump_header_format->softlinkend))
+ h5tools_str_append(&buffer, " ");
+ }
+ if(HDstrlen(h5tools_dump_header_format->softlinkend))
+ h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->softlinkend);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ HDfree(targbuf);
+ break;
+
+ case H5L_TYPE_EXTERNAL:
+ targbuf = (char *)HDmalloc(linfo->u.val_size);
+ HDassert(targbuf);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "%s \"%s\" %s",
+ h5tools_dump_header_format->extlinkbegin, name,
+ h5tools_dump_header_format->extlinkblockbegin);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ if(H5Lget_val(group, name, targbuf, linfo->u.val_size, H5P_DEFAULT) < 0) {
+ indentation(dump_indent);
+ error_msg("unable to get external link value\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ ret = FAIL;
+ } /* end if */
+ else {
+ const char *filename;
+ const char *targname;
+
+ if(H5Lunpack_elink_val(targbuf, linfo->u.val_size, NULL, &filename, &targname) < 0) {
+ indentation(dump_indent);
+ error_msg("unable to unpack external link value\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ ret = FAIL;
+ } /* end if */
+ else {
+ ctx.indent_level++;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "TARGETFILE \"%s\"", filename);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "TARGETPATH \"%s\"", targname);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ /* dump the external link */
+ dump_extlink(group, name, targname);
+ ctx.indent_level--;
+ } /* end else */
+ } /* end else */
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ if(HDstrlen(h5tools_dump_header_format->extlinkblockend)) {
+ h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->extlinkblockend);
+ if(HDstrlen(h5tools_dump_header_format->extlinkend))
+ h5tools_str_append(&buffer, " ");
+ }
+ if(HDstrlen(h5tools_dump_header_format->extlinkend))
+ h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->extlinkend);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ HDfree(targbuf);
+ break;
+
+ case H5L_TYPE_ERROR:
+ case H5L_TYPE_MAX:
+ HDassert(0);
+ /* fall through */
+ case H5L_TYPE_HARD:
+ default:
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "%s \"%s\" %s",
+ h5tools_dump_header_format->udlinkbegin, name,
+ h5tools_dump_header_format->udlinkblockbegin);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.indent_level++;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "LINKCLASS %d", linfo->type);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.indent_level--;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ if(HDstrlen(h5tools_dump_header_format->udlinkblockend)) {
+ h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->udlinkblockend);
+ if(HDstrlen(h5tools_dump_header_format->udlinkend))
+ h5tools_str_append(&buffer, " ");
+ }
+ if(HDstrlen(h5tools_dump_header_format->udlinkend))
+ h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->udlinkend);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ break;
+ } /* end switch */
+ } /* end else */
+
+done:
+
+ h5tools_str_close(&buffer);
+
+ if(obj_path)
+ HDfree(obj_path);
+ return ret;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: attr_iteration
+ *
+ * Purpose: Iterate and display attributes within the specified group
+ *
+ * Return: void
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+attr_iteration(hid_t gid, unsigned attr_crt_order_flags)
+{
+ /* attribute iteration: if there is a request to do H5_INDEX_CRT_ORDER and tracking order is set
+ in the group for attributes, then, sort by creation order, otherwise by name */
+ if(include_attrs) {
+ if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) {
+ if(H5Aiterate2(gid, sort_by, sort_order, NULL, dump_attr_cb, NULL) < 0) {
+ error_msg("error getting attribute information\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ } /* end if */
+ } /* end if */
+ else {
+ if(H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_attr_cb, NULL) < 0) {
+ error_msg("error getting attribute information\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ } /* end if */
+ } /* end else */
+ }
+}
+
+/*-------------------------------------------------------------------------
+ * Function: link_iteration
+ *
+ * Purpose: Iterate and display links within the specified group
+ *
+ * Return: void
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+link_iteration(hid_t gid, unsigned crt_order_flags)
+{
+
+ /* if there is a request to do H5_INDEX_CRT_ORDER and tracking order is set
+ in the group, then, sort by creation order, otherwise by name */
+ if((sort_by == H5_INDEX_CRT_ORDER) && (crt_order_flags & H5P_CRT_ORDER_TRACKED))
+ H5Literate(gid, sort_by, sort_order, NULL, dump_all_cb, NULL);
+ else
+ H5Literate(gid, H5_INDEX_NAME, sort_order, NULL, dump_all_cb, NULL);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: dump_named_datatype
+ *
+ * Purpose: Dump named datatype
+ *
+ * Return: void
+ *
+ * Programmer: Ruey-Hsia Li
+ *
+ * Modifications:
+ * Pedro Vicente, March 27, 2006
+ * added display of attributes
+ * Pedro Vicente, October 4, 2007, added parameters to H5Aiterate2() to allow for
+ * other iteration orders
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+dump_named_datatype(hid_t tid, const char *name)
+{
+ H5O_info_t oinfo;
+ unsigned attr_crt_order_flags;
+ hid_t tcpl_id = -1; /* datatype creation property list ID */
+ hsize_t curr_pos = 0; /* total data element position */
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t *outputformat = &h5tools_dataformat;
+ h5tool_format_t string_dataformat;
+
+ /* setup */
+ HDmemset(&buffer, 0, sizeof(h5tools_str_t));
+
+ HDmemset(&ctx, 0, sizeof(ctx));
+ ctx.indent_level = dump_indent / COL;
+ ctx.cur_column = dump_indent;
+
+ string_dataformat = *outputformat;
+
+ if (fp_format) {
+ string_dataformat.fmt_double = fp_format;
+ string_dataformat.fmt_float = fp_format;
+ }
+
+ if (h5tools_nCols == 0) {
+ string_dataformat.line_ncols = 65535;
+ string_dataformat.line_per_line = 1;
+ }
+ else
+ string_dataformat.line_ncols = h5tools_nCols;
+
+ string_dataformat.do_escape = display_escape;
+ outputformat = &string_dataformat;
+
+ if ((tcpl_id = H5Tget_create_plist(tid)) < 0) {
+ error_msg("error in getting creation property list ID\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ }
+
+ /* query the creation properties for attributes */
+ if (H5Pget_attr_creation_order(tcpl_id, &attr_crt_order_flags) < 0) {
+ error_msg("error in getting creation properties\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ }
+
+ if(H5Pclose(tcpl_id) < 0) {
+ error_msg("error in closing creation property list ID\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ }
+
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "%s \"%s\" %s",
+ h5tools_dump_header_format->datatypebegin, name,
+ h5tools_dump_header_format->datatypeblockbegin);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ H5Oget_info(tid, &oinfo);
+
+ /* Must check for uniqueness of all objects if we've traversed an elink,
+ * otherwise only check if the reference count > 1.
+ */
+ if(oinfo.rc > 1 || hit_elink) {
+ obj_t *found_obj; /* Found object */
+
+ found_obj = search_obj(type_table, oinfo.addr);
+
+ if (found_obj == NULL) {
+ error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__);
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
+ }
+ else if (found_obj->displayed) {
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "%s \"%s\"", HARDLINK, found_obj->objname);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ goto done;
+ }
+ else
+ found_obj->displayed = TRUE;
+ } /* end if */
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_print_datatype(rawoutstream, &buffer, outputformat, &ctx, tid, FALSE);
+
+ if(H5Tget_class(tid) != H5T_COMPOUND) {
+ h5tools_str_append(&buffer, ";");
+ }
+
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ /* print attributes */
+ dump_indent += COL;
+
+ attr_iteration(tid, attr_crt_order_flags);
+
+ dump_indent -= COL;
+
+done:
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ if(HDstrlen(h5tools_dump_header_format->datatypeblockend)) {
+ h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datatypeblockend);
+ if(HDstrlen(h5tools_dump_header_format->datatypeend))
+ h5tools_str_append(&buffer, " ");
+ }
+ if(HDstrlen(h5tools_dump_header_format->datatypeend))
+ h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datatypeend);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ h5tools_str_close(&buffer);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: dump_group
+ *
+ * Purpose: Dump everything within the specified group
+ *
+ * Return: void
+ *
+ * Programmer: Ruey-Hsia Li
+ *
+ * Modifications:
+ *
+ * Call to dump_all_cb -- add parameter to select everything.
+ *
+ * Pedro Vicente, October 1, 2007
+ * handle several iteration orders for attributes and groups
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+dump_group(hid_t gid, const char *name)
+{
+ H5O_info_t oinfo;
+ hid_t dset;
+ hid_t type;
+ hid_t gcpl_id;
+ unsigned crt_order_flags;
+ unsigned attr_crt_order_flags;
+ char type_name[1024];
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t *outputformat = &h5tools_dataformat;
+ h5tool_format_t string_dataformat;
+ hsize_t curr_pos = 0; /* total data element position */
+
+ if ((gcpl_id = H5Gget_create_plist(gid)) < 0) {
+ error_msg("error in getting group creation property list ID\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ }
+
+ /* query the group creation properties for attributes */
+ if (H5Pget_attr_creation_order(gcpl_id, &attr_crt_order_flags) < 0) {
+ error_msg("error in getting group creation properties\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ }
+
+ /* query the group creation properties */
+ if(H5Pget_link_creation_order(gcpl_id, &crt_order_flags) < 0) {
+ error_msg("error in getting group creation properties\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ }
+
+ if(H5Pclose(gcpl_id) < 0) {
+ error_msg("error in closing group creation property list ID\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ }
+
+ /* setup */
+ HDmemset(&buffer, 0, sizeof(h5tools_str_t));
+
+ HDmemset(&ctx, 0, sizeof(ctx));
+ ctx.indent_level = dump_indent / COL;
+ ctx.cur_column = dump_indent;
+
+ string_dataformat = *outputformat;
+
+ if (fp_format) {
+ string_dataformat.fmt_double = fp_format;
+ string_dataformat.fmt_float = fp_format;
+ }
+
+ if (h5tools_nCols == 0) {
+ string_dataformat.line_ncols = 65535;
+ string_dataformat.line_per_line = 1;
+ }
+ else
+ string_dataformat.line_ncols = h5tools_nCols;
+
+ string_dataformat.do_escape = display_escape;
+ outputformat = &string_dataformat;
+
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "%s \"%s\" %s",
+ h5tools_dump_header_format->groupbegin, name,
+ h5tools_dump_header_format->groupblockbegin);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.indent_level++;
+ dump_indent += COL;
+
+ if(!HDstrcmp(name, "/") && unamedtype) {
+ unsigned u; /* Local index variable */
+
+ /* dump unamed type in root group */
+ for(u = 0; u < type_table->nobjs; u++)
+ if(!type_table->objs[u].recorded) {
+ dset = H5Dopen2(gid, type_table->objs[u].objname, H5P_DEFAULT);
+ type = H5Dget_type(dset);
+ sprintf(type_name, "#"H5_PRINTF_HADDR_FMT, type_table->objs[u].objno);
+ dump_function_table->dump_named_datatype_function(type, type_name);
+ H5Tclose(type);
+ H5Dclose(dset);
+ }
+ } /* end if */
+
+ if(display_oid)
+ h5tools_dump_oid(rawoutstream, outputformat, &ctx, gid);
+
+ h5tools_dump_comment(rawoutstream, outputformat, &ctx, gid);
+
+ H5Oget_info(gid, &oinfo);
+
+ /* Must check for uniqueness of all objects if we've traversed an elink,
+ * otherwise only check if the reference count > 1.
+ */
+ if(oinfo.rc > 1 || hit_elink) {
+ obj_t *found_obj; /* Found object */
+
+ found_obj = search_obj(group_table, oinfo.addr);
+
+ if (found_obj == NULL) {
+ error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__);
+ h5tools_setstatus(EXIT_FAILURE);
+ }
+ else if (found_obj->displayed) {
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "%s \"%s\"", HARDLINK, found_obj->objname);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
+ else {
+ found_obj->displayed = TRUE;
+ attr_iteration(gid, attr_crt_order_flags);
+ link_iteration(gid, crt_order_flags);
+ }
+ }
+ else {
+ attr_iteration(gid, attr_crt_order_flags);
+ link_iteration(gid, crt_order_flags);
+ }
+
+ dump_indent -= COL;
+ ctx.indent_level--;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ if(HDstrlen(h5tools_dump_header_format->groupblockend)) {
+ h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->groupblockend);
+ if(HDstrlen(h5tools_dump_header_format->groupend))
+ h5tools_str_append(&buffer, " ");
+ }
+ if(HDstrlen(h5tools_dump_header_format->groupend))
+ h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->groupend);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ h5tools_str_close(&buffer);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: dump_dataset
+ *
+ * Purpose: Dump the specified data set
+ *
+ * Return: void
+ *
+ * Programmer: Ruey-Hsia Li
+ *
+ * Modifications:
+ * Pedro Vicente, 2004, added dataset creation property list display
+ * Pedro Vicente, October 4, 2007, added parameters to H5Aiterate2() to allow for
+ * other iteration orders
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+dump_dataset(hid_t did, const char *name, struct subset_t *sset)
+{
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t *outputformat = &h5tools_dataformat;
+ h5tool_format_t string_dataformat;
+ hid_t type, space;
+ unsigned attr_crt_order_flags;
+ hid_t dcpl_id; /* dataset creation property list ID */
+ h5tools_str_t buffer; /* string into which to render */
+ hsize_t curr_pos = 0; /* total data element position */
+
+ HDmemset(&ctx, 0, sizeof(ctx));
+ ctx.indent_level = dump_indent / COL;
+ ctx.cur_column = dump_indent;
+
+ string_dataformat = *outputformat;
+
+ if (fp_format) {
+ string_dataformat.fmt_double = fp_format;
+ string_dataformat.fmt_float = fp_format;
+ }
+
+ if (h5tools_nCols == 0) {
+ string_dataformat.line_ncols = 65535;
+ string_dataformat.line_per_line = 1;
+ }
+ else
+ string_dataformat.line_ncols = h5tools_nCols;
+
+ string_dataformat.do_escape = display_escape;
+ outputformat = &string_dataformat;
+
+ if ((dcpl_id = H5Dget_create_plist(did)) < 0) {
+ error_msg("error in getting creation property list ID\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ }
+
+ /* query the creation properties for attributes */
+ if (H5Pget_attr_creation_order(dcpl_id, &attr_crt_order_flags) < 0) {
+ error_msg("error in getting creation properties\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ }
+
+ /* setup */
+ HDmemset(&buffer, 0, sizeof(h5tools_str_t));
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "%s \"%s\" %s",
+ h5tools_dump_header_format->datasetbegin, name,
+ h5tools_dump_header_format->datasetblockbegin);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ h5tools_dump_comment(rawoutstream, outputformat, &ctx, did);
+
+ dump_indent += COL;
+ ctx.indent_level++;
+
+ type = H5Dget_type(did);
+ h5dump_type_table = type_table;
+ h5tools_dump_datatype(rawoutstream, outputformat, &ctx, type);
+ h5dump_type_table = NULL;
+
+ space = H5Dget_space(did);
+ h5tools_dump_dataspace(rawoutstream, outputformat, &ctx, space);
+ H5Sclose(space);
+
+ if(display_oid) {
+ h5tools_dump_oid(rawoutstream, outputformat, &ctx, did);
+ }
+
+ if(display_dcpl) {
+ h5dump_type_table = type_table;
+ h5tools_dump_dcpl(rawoutstream, outputformat, &ctx, dcpl_id, type, did);
+ h5dump_type_table = NULL;
+ }
+ H5Pclose(dcpl_id);
+
+ if(display_data) {
+ unsigned data_loop = 1;
+ unsigned u;
+
+ if(display_packed_bits)
+ data_loop = packed_bits_num;
+ for(u = 0; u < data_loop; u++) {
+ if(display_packed_bits) {
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ packed_data_mask = packed_mask[u];
+ packed_data_offset = packed_offset[u];
+ packed_data_length = packed_length[u];
+ h5tools_print_packed_bits(&buffer, type);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
+ switch(H5Tget_class(type)) {
+ case H5T_TIME:
+ ctx.indent_level++;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "DATA{ not yet implemented.}");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.indent_level--;
+ break;
+
+ case H5T_INTEGER:
+ case H5T_FLOAT:
+ case H5T_STRING:
+ case H5T_BITFIELD:
+ case H5T_OPAQUE:
+ case H5T_COMPOUND:
+ case H5T_REFERENCE:
+ case H5T_ENUM:
+ case H5T_VLEN:
+ case H5T_ARRAY:
+ {
+ h5tools_dump_data(rawoutstream, outputformat, &ctx, did, TRUE, sset, display_ai, display_char);
+ }
+ break;
+
+ case H5T_NO_CLASS:
+ case H5T_NCLASSES:
+ default:
+ HDassert(0);
+ break;
+ } /* end switch */
+ } /* for(u=0; u<data_loop; u++) */
+ }
+ H5Tclose(type);
+
+ if (!bin_output) {
+ attr_iteration(did, attr_crt_order_flags);
+ }
+ ctx.indent_level--;
+ dump_indent -= COL;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ if(HDstrlen(h5tools_dump_header_format->datasetblockend)) {
+ h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetblockend);
+ if(HDstrlen(h5tools_dump_header_format->datasetend))
+ h5tools_str_append(&buffer, " ");
+ }
+ if(HDstrlen(h5tools_dump_header_format->datasetend))
+ h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetend);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ h5tools_str_close(&buffer);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: dump_data
+ *
+ * Purpose: Dump attribute or dataset data
+ *
+ * Return: void
+ *
+ * Programmer: Ruey-Hsia Li
+ *
+ * Modifications: pvn, print the matrix indices
+ * Albert Cheng, 2004/11/18
+ * Add --string printing for attributes too.
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+dump_data(hid_t obj_id, int obj_data, struct subset_t *sset, int display_index)
+{
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t *outputformat = &h5tools_dataformat;
+ h5tool_format_t string_dataformat;
+ int print_dataset = FALSE;
+
+ string_dataformat = *outputformat;
+
+ if (fp_format) {
+ string_dataformat.fmt_double = fp_format;
+ string_dataformat.fmt_float = fp_format;
+ }
+
+ if (h5tools_nCols == 0) {
+ string_dataformat.line_ncols = 65535;
+ string_dataformat.line_per_line = 1;
+ }
+ else
+ string_dataformat.line_ncols = h5tools_nCols;
+
+ string_dataformat.do_escape = display_escape;
+ outputformat = &string_dataformat;
+
+ HDmemset(&ctx, 0, sizeof(ctx));
+ ctx.indent_level = dump_indent / COL;
+ ctx.cur_column = dump_indent;
+
+ if(obj_data == DATASET_DATA)
+ print_dataset = TRUE;
+ h5tools_dump_data(rawoutstream, outputformat, &ctx, obj_id, print_dataset, sset, display_index, display_char);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: dump_fcpl
+ *
+ * Purpose: prints file creation property list information
+ *
+ * Return: void
+ *
+ * Programmer: pvn
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+dump_fcpl(hid_t fid)
+{
+ hid_t fcpl; /* file creation property list ID */
+ hsize_t userblock; /* userblock size retrieved from FCPL */
+ size_t off_size; /* size of offsets in the file */
+ size_t len_size; /* size of lengths in the file */
+ H5F_file_space_type_t fs_strategy; /* file space strategy */
+ hsize_t fs_threshold; /* free-space section threshold */
+ H5F_info2_t finfo; /* file information */
+#ifdef SHOW_FILE_DRIVER
+ hid_t fapl; /* file access property list ID */
+ hid_t fdriver; /* file driver */
+ char dname[32]; /* buffer to store driver name */
+#endif
+ unsigned sym_lk; /* symbol table B-tree leaf 'K' value */
+ unsigned sym_ik; /* symbol table B-tree internal 'K' value */
+ unsigned istore_ik; /* indexed storage B-tree internal 'K' value */
+
+ fcpl=H5Fget_create_plist(fid);
+ H5Fget_info2(fid, &finfo);
+ H5Pget_userblock(fcpl,&userblock);
+ H5Pget_sizes(fcpl,&off_size,&len_size);
+ H5Pget_sym_k(fcpl,&sym_ik,&sym_lk);
+ H5Pget_istore_k(fcpl,&istore_ik);
+ H5Pget_file_space(fcpl, &fs_strategy, &fs_threshold);
+ H5Pclose(fcpl);
+#ifdef SHOW_FILE_DRIVER
+ fapl=h5_fileaccess();
+ fdriver=H5Pget_driver(fapl);
+ H5Pclose(fapl);
+#endif
+
+ /*-------------------------------------------------------------------------
+ * SUPER_BLOCK
+ *-------------------------------------------------------------------------
+ */
+ PRINTSTREAM(rawoutstream, "\n%s %s\n",SUPER_BLOCK, BEGIN);
+ indentation(dump_indent + COL);
+ PRINTSTREAM(rawoutstream, "%s %u\n","SUPERBLOCK_VERSION", finfo.super.version);
+ indentation(dump_indent + COL);
+ PRINTSTREAM(rawoutstream, "%s %u\n","FREELIST_VERSION", finfo.free.version);
+ indentation(dump_indent + COL);
+ PRINTSTREAM(rawoutstream, "%s %u\n","SYMBOLTABLE_VERSION", 0); /* Retain this for backward compatibility, for now (QAK) */
+ indentation(dump_indent + COL);
+ PRINTSTREAM(rawoutstream, "%s %u\n","OBJECTHEADER_VERSION", finfo.sohm.version);
+ indentation(dump_indent + COL);
+ PRINTSTREAM(rawoutstream,"%s %zu\n","OFFSET_SIZE", off_size);
+ indentation(dump_indent + COL);
+ PRINTSTREAM(rawoutstream,"%s %zu\n","LENGTH_SIZE", len_size);
+ indentation(dump_indent + COL);
+ PRINTSTREAM(rawoutstream, "%s %u\n","BTREE_RANK", sym_ik);
+ indentation(dump_indent + COL);
+ PRINTSTREAM(rawoutstream, "%s %d\n","BTREE_LEAF", sym_lk);
+
+#ifdef SHOW_FILE_DRIVER
+ if(H5FD_CORE==fdriver)
+ HDstrcpy(dname,"H5FD_CORE");
+#ifdef H5_HAVE_DIRECT
+ else if(H5FD_DIRECT==fdriver)
+ HDstrcpy(dname,"H5FD_DIRECT");
+#endif
+ else if(H5FD_FAMILY==fdriver)
+ HDstrcpy(dname,"H5FD_FAMILY");
+ else if(H5FD_LOG==fdriver)
+ HDstrcpy(dname,"H5FD_LOG");
+ else if(H5FD_MPIO==fdriver)
+ HDstrcpy(dname,"H5FD_MPIO");
+ else if(H5FD_MULTI==fdriver)
+ HDstrcpy(dname,"H5FD_MULTI");
+ else if(H5FD_SEC2==fdriver)
+ HDstrcpy(dname,"H5FD_SEC2");
+ else if(H5FD_STDIO==fdriver)
+ HDstrcpy(dname,"H5FD_STDIO");
+ else
+ HDstrcpy(dname,"Unknown driver");
+
+ /* Take out this because the driver used can be different from the
+ * standard output. */
+ /*indentation(dump_indent + COL);
+ PRINTSTREAM(rawoutstream, "%s %s\n","FILE_DRIVER", dname);*/
+#endif
+ indentation(dump_indent + COL);
+ PRINTSTREAM(rawoutstream, "%s %u\n","ISTORE_K", istore_ik);
+
+ indentation(dump_indent + COL);
+ if(fs_strategy == H5F_FILE_SPACE_ALL_PERSIST) {
+ PRINTSTREAM(rawoutstream, "%s %s\n", "FILE_SPACE_STRATEGY", "H5F_FILE_SPACE_ALL_PERSIST");
+ } else if(fs_strategy == H5F_FILE_SPACE_ALL) {
+ PRINTSTREAM(rawoutstream, "%s %s\n", "FILE_SPACE_STRATEGY", "H5F_FILE_SPACE_ALL");
+ } else if(fs_strategy == H5F_FILE_SPACE_AGGR_VFD) {
+ PRINTSTREAM(rawoutstream, "%s %s\n", "FILE_SPACE_STRATEGY", "H5F_FILE_SPACE_AGGR_VFD");
+ } else if(fs_strategy == H5F_FILE_SPACE_VFD) {
+ PRINTSTREAM(rawoutstream, "%s %s\n", "FILE_SPACE_STRATEGY", "H5F_FILE_SPACE_VFD");
+ } else
+ PRINTSTREAM(rawoutstream, "%s %s\n", "FILE_SPACE_STRATEGY", "Unknown strategy");
+ indentation(dump_indent + COL);
+ PRINTSTREAM(rawoutstream, "%s %Hu\n","FREE_SPACE_THRESHOLD", fs_threshold);
+
+ /*-------------------------------------------------------------------------
+ * USER_BLOCK
+ *-------------------------------------------------------------------------
+ */
+ indentation(dump_indent + COL);
+ PRINTSTREAM(rawoutstream, "USER_BLOCK %s\n",BEGIN);
+ indentation(dump_indent + COL + COL);
+ PRINTSTREAM(rawoutstream,"%s %Hu\n","USERBLOCK_SIZE", userblock);
+ indentation(dump_indent + COL);
+ PRINTSTREAM(rawoutstream, "%s\n",END);
+
+ PRINTSTREAM(rawoutstream, "%s",END);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: dump_fcontents
+ *
+ * Purpose: prints all objects
+ *
+ * Return: void
+ *
+ * Programmer: pvn
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+dump_fcontents(hid_t fid)
+{
+ PRINTSTREAM(rawoutstream, "%s %s\n",FILE_CONTENTS, BEGIN);
+
+ /* special case of unamed types in root group */
+ if (unamedtype) {
+ unsigned u;
+
+ for (u = 0; u < type_table->nobjs; u++) {
+ if (!type_table->objs[u].recorded)
+ PRINTSTREAM(rawoutstream, " %-10s /#"H5_PRINTF_HADDR_FMT"\n", "datatype", type_table->objs[u].objno);
+ }
+ }
+
+ /* print objects in the files */
+ h5trav_print(fid);
+
+ PRINTSTREAM(rawoutstream, " %s\n",END);
+}
+
+static herr_t
+attr_search(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ainfo, void *_op_data)
+{
+ herr_t ret = SUCCEED;
+ int j;
+ char *obj_op_name;
+ char *obj_name;
+ trav_attr_udata_t *attr_data = (trav_attr_udata_t*)_op_data;
+ const char *buf = attr_data->path;
+ const char *op_name = attr_data->op_name;
+
+ j = (int)HDstrlen(op_name) - 1;
+ /* find the last / */
+ while(j >= 0) {
+ if(op_name[j] == '/' && (j == 0 || (j > 0 && op_name[j - 1] != '\\')))
+ break;
+ j--;
+ }
+
+ obj_op_name = h5tools_str_replace(op_name + j + 1, "\\/", "/");
+
+ if(obj_op_name == NULL) {
+ h5tools_setstatus(EXIT_FAILURE);
+ ret = FAIL;
+ }
+ else {
+ if(HDstrcmp(attr_name, obj_op_name)==0) {
+ size_t u, v, w;
+
+ /* object name */
+ u = HDstrlen(buf);
+ v = HDstrlen(op_name);
+ w = u + 1 + v + 1 + 2;
+ obj_name = (char *)HDmalloc(w);
+ if(obj_name == NULL) {
+ h5tools_setstatus(EXIT_FAILURE);
+ ret = FAIL;
+ }
+ else {
+ HDmemset(obj_name, '\0', w);
+ if(op_name[0] != '/') {
+ HDstrncat(obj_name, buf, u + 1);
+ if(buf[u - 1] != '/')
+ HDstrncat(obj_name, "/", (size_t)2);
+ }
+ HDstrncat(obj_name, op_name, v + 1);
+
+ handle_attributes(oid, obj_name, NULL, 0, NULL);
+ HDfree(obj_name);
+ }
+ }
+ HDfree(obj_op_name);
+ }
+ return ret;
+} /* end attr_search() */
+
+static herr_t
+obj_search(const char *path, const H5O_info_t *oi, const char H5_ATTR_UNUSED *already_visited, void *_op_data)
+{
+ trav_handle_udata_t *handle_data = (trav_handle_udata_t*)_op_data;
+ const char *op_name = handle_data->op_name;
+ trav_attr_udata_t attr_data;
+
+ attr_data.path = path;
+ attr_data.op_name = op_name;
+ H5Aiterate_by_name(handle_data->fid, path, H5_INDEX_NAME, H5_ITER_INC, NULL, attr_search, (void*)&attr_data, H5P_DEFAULT);
+
+ if(HDstrcmp(path, op_name) == 0) {
+ switch(oi->type) {
+ case H5O_TYPE_GROUP:
+ handle_groups(handle_data->fid, path, NULL, 0, NULL);
+ break;
+
+ case H5O_TYPE_DATASET:
+ handle_datasets(handle_data->fid, path, NULL, 0, NULL);
+ break;
+
+ case H5O_TYPE_NAMED_DATATYPE:
+ handle_datatypes(handle_data->fid, path, NULL, 0, NULL);
+ break;
+
+ case H5O_TYPE_UNKNOWN:
+ case H5O_TYPE_NTYPES:
+ default:
+ error_msg("unknown object type value\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ } /* end switch */
+ }
+
+ return 0;
+} /* end obj_search() */
+
+static herr_t
+lnk_search(const char *path, const H5L_info_t *li, void *_op_data)
+{
+ size_t search_len;
+ size_t k;
+ char *search_name;
+ trav_handle_udata_t *handle_data = (trav_handle_udata_t*)_op_data;
+ const char *op_name = handle_data->op_name;
+
+ search_len = HDstrlen(op_name);
+ if(search_len > 0 && op_name[0] != '/')
+ k = 2;
+ else
+ k = 1;
+ search_name = (char *)HDmalloc(search_len + k);
+ if(search_name == NULL) {
+ error_msg("creating temporary link\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ }
+ else {
+ if (k == 2) {
+ HDstrcpy(search_name, "/");
+ HDstrncat(search_name, op_name, search_len + 1);
+ }
+ else
+ HDstrncpy(search_name, op_name, search_len + 1);
+ search_name[search_len + k - 1] = '\0';
+
+ if(HDstrcmp(path, search_name) == 0) {
+ switch(li->type) {
+ case H5L_TYPE_SOFT:
+ case H5L_TYPE_EXTERNAL:
+ handle_links(handle_data->fid, op_name, NULL, 0, NULL);
+ break;
+
+ case H5L_TYPE_HARD:
+ case H5L_TYPE_MAX:
+ case H5L_TYPE_ERROR:
+ default:
+ error_msg("unknown link type value\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ break;
+ } /* end switch() */
+ }
+ HDfree(search_name);
+ }
+ return 0;
+} /* end lnk_search() */
+
+/*-------------------------------------------------------------------------
+ * Function: handle_paths
+ *
+ * Purpose: Handle objects from the command.
+ *
+ * Return: void
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+handle_paths(hid_t fid, const char *path_name, void H5_ATTR_UNUSED * data, int H5_ATTR_UNUSED pe, const char H5_ATTR_UNUSED *display_name)
+{
+ hid_t gid = -1;
+
+ if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) {
+ error_msg("unable to open root group\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ }
+ else {
+ hid_t gcpl_id;
+ unsigned crt_order_flags;
+ unsigned attr_crt_order_flags;
+ trav_handle_udata_t handle_udata; /* User data for traversal */
+
+ if ((gcpl_id = H5Gget_create_plist(gid)) < 0) {
+ error_msg("error in getting group creation property list ID\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ }
+
+ /* query the group creation properties for attributes */
+ if (H5Pget_attr_creation_order(gcpl_id, &attr_crt_order_flags) < 0) {
+ error_msg("error in getting group creation properties\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ }
+
+ /* query the group creation properties */
+ if(H5Pget_link_creation_order(gcpl_id, &crt_order_flags) < 0) {
+ error_msg("error in getting group creation properties\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ }
+
+ if(H5Pclose(gcpl_id) < 0) {
+ error_msg("error in closing group creation property list ID\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ }
+
+ handle_udata.fid = fid;
+ handle_udata.op_name = path_name;
+ if(h5trav_visit(fid, "/", TRUE, TRUE, obj_search, lnk_search, &handle_udata) < 0) {
+ error_msg("error traversing information\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ }
+ }
+}
+
+/*-------------------------------------------------------------------------
+ * Function: handle_attributes
+ *
+ * Purpose: Handle the attributes from the command.
+ *
+ * Return: void
+ *
+ * Programmer: Bill Wendling
+ * Tuesday, 9. January 2001
+ *
+ * Modifications:
+ *
+ * PVN, May 2008
+ * add an extra parameter PE, to allow printing/not printing of error messages
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+handle_attributes(hid_t fid, const char *attr, void H5_ATTR_UNUSED * data, int H5_ATTR_UNUSED pe, const char H5_ATTR_UNUSED *display_name)
+{
+ hid_t oid = -1;
+ hid_t attr_id = -1;
+ char *obj_name = NULL;
+ char *attr_name = NULL;
+ int j;
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t *outputformat = &h5tools_dataformat;
+ h5tool_format_t string_dataformat;
+ hsize_t curr_pos = 0; /* total data element position */
+
+ j = (int)HDstrlen(attr) - 1;
+ obj_name = (char *)HDmalloc((size_t)j + 2);
+ if(obj_name == NULL)
+ goto error;
+
+ /* find the last / */
+ while(j >= 0) {
+ if (attr[j] == '/' && (j==0 || (j>0 && attr[j-1]!='\\')))
+ break;
+ j--;
+ }
+
+ /* object name */
+ if(j == -1)
+ HDstrcpy(obj_name, "/");
+ else {
+ HDstrncpy(obj_name, attr, (size_t)j + 1);
+ obj_name[j + 1] = '\0';
+ } /* end else */
+
+ dump_indent += COL;
+ HDmemset(&ctx, 0, sizeof(ctx));
+ ctx.indent_level = dump_indent / COL;
+ ctx.cur_column = dump_indent;
+
+ string_dataformat = *outputformat;
+
+ if (fp_format) {
+ string_dataformat.fmt_double = fp_format;
+ string_dataformat.fmt_float = fp_format;
+ }
+
+ if (h5tools_nCols == 0) {
+ string_dataformat.line_ncols = 65535;
+ string_dataformat.line_per_line = 1;
+ }
+ else
+ string_dataformat.line_ncols = h5tools_nCols;
+
+ string_dataformat.do_escape = display_escape;
+ outputformat = &string_dataformat;
+
+ attr_name = h5tools_str_replace(attr + j + 1, "\\/", "/");
+
+ /* handle error case: cannot open the object with the attribute */
+ if((oid = H5Oopen(fid, obj_name, H5P_DEFAULT)) < 0) {
+ /* setup */
+ HDmemset(&buffer, 0, sizeof(h5tools_str_t));
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "%s \"%s\" %s",
+ h5tools_dump_header_format->attributebegin, attr,
+ h5tools_dump_header_format->attributeblockbegin);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ error_msg("unable to open object \"%s\"\n", obj_name);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ if(HDstrlen(h5tools_dump_header_format->attributeblockend)) {
+ h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->attributeblockend);
+ if(HDstrlen(h5tools_dump_header_format->attributeend))
+ h5tools_str_append(&buffer, " ");
+ }
+ if(HDstrlen(h5tools_dump_header_format->attributeend))
+ h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->attributeend);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ h5tools_str_close(&buffer);
+
+ goto error;
+ } /* end if */
+
+ attr_id = H5Aopen(oid, attr_name, H5P_DEFAULT);
+ oid_output = display_oid;
+ data_output = display_data;
+ attr_data_output = display_attr_data;
+
+ h5dump_type_table = type_table;
+ h5tools_dump_attribute(rawoutstream, outputformat, &ctx, attr_name, attr_id, display_ai, display_char);
+ h5dump_type_table = NULL;
+
+ if(attr_id < 0) {
+ goto error;
+ }
+
+ /* Close object */
+ if(H5Oclose(oid) < 0) {
+ goto error;
+ } /* end if */
+
+ HDfree(obj_name);
+ HDfree(attr_name);
+ dump_indent -= COL;
+ return;
+
+error:
+ h5tools_setstatus(EXIT_FAILURE);
+ if(obj_name)
+ HDfree(obj_name);
+
+ if (attr_name)
+ HDfree(attr_name);
+
+ H5E_BEGIN_TRY {
+ H5Oclose(oid);
+ H5Aclose(attr_id);
+ } H5E_END_TRY;
+ dump_indent -= COL;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: handle_datasets
+ *
+ * Purpose: Handle the datasets from the command.
+ *
+ * Return: void
+ *
+ * Programmer: Bill Wendling
+ * Tuesday, 9. January 2001
+ *
+ * Modifications:
+ * Pedro Vicente, Tuesday, January 15, 2008
+ * check for block overlap\
+ *
+ * Pedro Vicente, May 8, 2008
+ * added a flag PE that prints/not prints error messages
+ * added for cases of external links not found, to avoid printing of
+ * objects not found, since external links are dumped on a trial error basis
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *display_name)
+{
+ H5O_info_t oinfo;
+ hid_t dsetid;
+ hid_t dapl_id = H5P_DEFAULT; /* dataset access property list ID */
+ struct subset_t *sset = (struct subset_t *)data;
+ const char *real_name = display_name ? display_name : dset;
+
+ if(display_data) {
+ if ((dapl_id = H5Pcreate(H5P_DATASET_ACCESS)) < 0) {
+ error_msg("error in creating default access property list ID\n");
+ }
+ if (display_vds_first) {
+ if(H5Pset_virtual_view(dapl_id, H5D_VDS_FIRST_MISSING) < 0)
+ error_msg("error in setting access property list ID, virtual_view\n");
+ }
+ if (vds_gap_size > 0) {
+ if(H5Pset_virtual_printf_gap(dapl_id, (hsize_t)vds_gap_size) < 0)
+ error_msg("error in setting access property list ID, virtual_printf_gap\n");
+ }
+ }
+ if((dsetid = H5Dopen2(fid, dset, dapl_id)) < 0) {
+ if (pe)
+ handle_links(fid, dset, data, pe, display_name);
+ return;
+ } /* end if */
+
+ if(sset) {
+ unsigned int i;
+ unsigned int ndims;
+ hid_t sid = H5Dget_space(dsetid);
+ int ndims_res = H5Sget_simple_extent_ndims(sid);
+
+ H5Sclose(sid);
+ if(ndims_res < 0) {
+ error_msg("H5Sget_simple_extent_ndims failed\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ return;
+ }
+ ndims = (unsigned)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
+ * dimensions */
+ if(!sset->start.data) {
+ /* default to (0, 0, ...) for the start coord */
+ sset->start.data = (hsize_t *)HDcalloc((size_t)ndims, sizeof(hsize_t));
+ sset->start.len = ndims;
+ }
+
+ if(!sset->stride.data) {
+ sset->stride.data = (hsize_t *)HDcalloc((size_t)ndims, sizeof(hsize_t));
+ sset->stride.len = ndims;
+ for (i = 0; i < ndims; i++)
+ sset->stride.data[i] = 1;
+ }
+
+ if(!sset->count.data) {
+ sset->count.data = (hsize_t *)HDcalloc((size_t)ndims, sizeof(hsize_t));
+ sset->count.len = ndims;
+ for (i = 0; i < ndims; i++)
+ sset->count.data[i] = 1;
+ }
+
+ if(!sset->block.data) {
+ sset->block.data = (hsize_t *)HDcalloc((size_t)ndims, sizeof(hsize_t));
+ sset->block.len = ndims;
+ for (i = 0; i < ndims; i++)
+ sset->block.data[i] = 1;
+ }
+ }
+
+ /*-------------------------------------------------------------------------
+ * check for dimension overflow
+ *-------------------------------------------------------------------------
+ */
+ if(sset->start.len > ndims) {
+ error_msg("number of start dims (%u) exceed dataset dims (%u)\n", sset->start.len, ndims);
+ h5tools_setstatus(EXIT_FAILURE);
+ return;
+ }
+ if(sset->stride.len > ndims) {
+ error_msg("number of stride dims (%u) exceed dataset dims (%u)\n", sset->stride.len, ndims);
+ h5tools_setstatus(EXIT_FAILURE);
+ return;
+ }
+ if(sset->count.len > ndims) {
+ error_msg("number of count dims (%u) exceed dataset dims (%u)\n", sset->count.len, ndims);
+ h5tools_setstatus(EXIT_FAILURE);
+ return;
+ }
+ if(sset->block.len > ndims) {
+ error_msg("number of block dims (%u) exceed dataset dims (%u)\n", sset->block.len, ndims);
+ h5tools_setstatus(EXIT_FAILURE);
+ return;
+ }
+
+ /*-------------------------------------------------------------------------
+ * check for block overlap
+ *-------------------------------------------------------------------------
+ */
+ for(i = 0; i < ndims; i++) {
+ if(sset->count.data[i] > 1) {
+ if(sset->stride.data[i] < sset->block.data[i]) {
+ error_msg("wrong subset selection; blocks overlap\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ return;
+ } /* end if */
+ } /* end if */
+ } /* end for */
+ } /* end if */
+
+
+ H5Oget_info(dsetid, &oinfo);
+ if(oinfo.rc > 1 || hit_elink) {
+ obj_t *found_obj; /* Found object */
+
+ found_obj = search_obj(dset_table, oinfo.addr);
+
+ if(found_obj) {
+ if (found_obj->displayed) {
+ PRINTVALSTREAM(rawoutstream, "\n");
+ indentation(dump_indent);
+ begin_obj(h5tools_dump_header_format->datasetbegin, real_name, h5tools_dump_header_format->datasetblockbegin);
+ PRINTVALSTREAM(rawoutstream, "\n");
+ indentation(dump_indent + COL);
+ PRINTSTREAM(rawoutstream, "%s \"%s\"\n", HARDLINK, found_obj->objname);
+ indentation(dump_indent);
+ end_obj(h5tools_dump_header_format->datasetend, h5tools_dump_header_format->datasetblockend);
+ }
+ else {
+ found_obj->displayed = TRUE;
+ dump_indent += COL;
+ dump_dataset(dsetid, real_name, sset);
+ dump_indent -= COL;
+ }
+ }
+ else
+ h5tools_setstatus(EXIT_FAILURE);
+ }
+ else {
+ dump_indent += COL;
+ dump_dataset(dsetid, real_name, sset);
+ dump_indent -= COL;
+ }
+ if (dapl_id != H5P_DEFAULT)
+ H5Pclose(dapl_id);
+ if(H5Dclose(dsetid) < 0)
+ h5tools_setstatus(EXIT_FAILURE);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: handle_groups
+ *
+ * Purpose: Handle the groups from the command.
+ *
+ * Return: void
+ *
+ * Programmer: Bill Wendling
+ * Tuesday, 9. January 2001
+ *
+ * Modifications: Pedro Vicente, September 26, 2007
+ * handle creation order
+ *
+ * Pedro Vicente, May 8, 2008
+ * added a flag PE that prints/not prints error messages
+ * added for cases of external links not found, to avoid printing of
+ * objects not found, since external links are dumped on a trial error basis
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+handle_groups(hid_t fid, const char *group, void H5_ATTR_UNUSED *data, int pe, const char *display_name)
+{
+ hid_t gid;
+ const char *real_name = display_name ? display_name : group;
+
+ if((gid = H5Gopen2(fid, group, H5P_DEFAULT)) < 0) {
+ if (pe) {
+ PRINTVALSTREAM(rawoutstream, "\n");
+ begin_obj(h5tools_dump_header_format->groupbegin, real_name, h5tools_dump_header_format->groupblockbegin);
+ PRINTVALSTREAM(rawoutstream, "\n");
+ indentation(COL);
+ error_msg("unable to open group \"%s\"\n", real_name);
+ end_obj(h5tools_dump_header_format->groupend, h5tools_dump_header_format->groupblockend);
+ h5tools_setstatus(EXIT_FAILURE);
+ }
+ }
+ else {
+ size_t new_len = HDstrlen(group) + 1;
+
+ if(prefix_len <= new_len) {
+ prefix_len = new_len;
+ prefix = (char *)HDrealloc(prefix, prefix_len);
+ } /* end if */
+
+ HDstrcpy(prefix, group);
+
+ dump_indent += COL;
+ dump_group(gid, real_name);
+ dump_indent -= COL;
+
+ if(H5Gclose(gid) < 0)
+ h5tools_setstatus(EXIT_FAILURE);
+ } /* end else */
+} /* end handle_groups() */
+
+/*-------------------------------------------------------------------------
+ * Function: handle_links
+ *
+ * Purpose: Handle soft or UD links from the command.
+ *
+ * Return: void
+ *
+ * Programmer: Bill Wendling
+ * Tuesday, 9. January 2001
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+handle_links(hid_t fid, const char *links, void H5_ATTR_UNUSED * data, int H5_ATTR_UNUSED pe, const char H5_ATTR_UNUSED *display_name)
+{
+ H5L_info_t linfo;
+
+ if(H5Lget_info(fid, links, &linfo, H5P_DEFAULT) < 0) {
+ error_msg("unable to get link info from \"%s\"\n", links);
+ h5tools_setstatus(EXIT_FAILURE);
+ }
+ else if(linfo.type == H5L_TYPE_HARD) {
+ error_msg("\"%s\" is a hard link\n", links);
+ h5tools_setstatus(EXIT_FAILURE);
+ }
+ else {
+ char *buf = (char *)HDmalloc(linfo.u.val_size);
+ PRINTVALSTREAM(rawoutstream, "\n");
+
+ switch(linfo.type) {
+ case H5L_TYPE_SOFT: /* Soft link */
+ begin_obj(h5tools_dump_header_format->softlinkbegin, links, h5tools_dump_header_format->softlinkblockbegin);
+ PRINTVALSTREAM(rawoutstream, "\n");
+ indentation(COL);
+ if(H5Lget_val(fid, links, buf, linfo.u.val_size, H5P_DEFAULT) >= 0) {
+ PRINTSTREAM(rawoutstream, "LINKTARGET \"%s\"\n", buf);
+ }
+ else {
+ error_msg("h5dump error: unable to get link value for \"%s\"\n", links);
+ h5tools_setstatus(EXIT_FAILURE);
+ }
+ end_obj(h5tools_dump_header_format->softlinkend, h5tools_dump_header_format->softlinkblockend);
+ break;
+
+ case H5L_TYPE_EXTERNAL:
+ begin_obj(h5tools_dump_header_format->udlinkbegin, links, h5tools_dump_header_format->udlinkblockbegin);
+ PRINTVALSTREAM(rawoutstream, "\n");
+ indentation(COL);
+ begin_obj(h5tools_dump_header_format->extlinkbegin, links, h5tools_dump_header_format->extlinkblockbegin);
+ PRINTVALSTREAM(rawoutstream, "\n");
+ if(H5Lget_val(fid, links, buf, linfo.u.val_size, H5P_DEFAULT) >= 0) {
+ const char *elink_file;
+ const char *elink_path;
+
+ if(H5Lunpack_elink_val(buf, linfo.u.val_size, NULL, &elink_file, &elink_path)>=0) {
+ indentation(COL);
+ PRINTSTREAM(rawoutstream, "LINKCLASS %d\n", linfo.type);
+ indentation(COL);
+ PRINTSTREAM(rawoutstream, "TARGETFILE \"%s\"\n", elink_file);
+ indentation(COL);
+ PRINTSTREAM(rawoutstream, "TARGETPATH \"%s\"\n", elink_path);
+ }
+ else {
+ error_msg("h5dump error: unable to unpack external link value for \"%s\"\n", links);
+ h5tools_setstatus(EXIT_FAILURE);
+ }
+ }
+ else {
+ error_msg("h5dump error: unable to get external link value for \"%s\"\n", links);
+ h5tools_setstatus(EXIT_FAILURE);
+ }
+ end_obj(h5tools_dump_header_format->extlinkend, h5tools_dump_header_format->extlinkblockend);
+ break;
+
+ case H5L_TYPE_ERROR:
+ case H5L_TYPE_MAX:
+ HDassert(0);
+ /* fall through */
+ case H5L_TYPE_HARD:
+ default:
+ begin_obj(h5tools_dump_header_format->udlinkbegin, links, h5tools_dump_header_format->udlinkblockbegin);
+ PRINTVALSTREAM(rawoutstream, "\n");
+ indentation(COL);
+ begin_obj(h5tools_dump_header_format->udlinkbegin, links, h5tools_dump_header_format->udlinkblockbegin);
+ PRINTVALSTREAM(rawoutstream, "\n");
+ indentation(COL);
+ PRINTSTREAM(rawoutstream, "LINKCLASS %d\n", linfo.type);
+ end_obj(h5tools_dump_header_format->udlinkend, h5tools_dump_header_format->udlinkblockend);
+ break;
+ } /* end switch */
+ HDfree(buf);
+ } /* end else */
+}
+
+/*-------------------------------------------------------------------------
+ * Function: handle_datatypes
+ *
+ * Purpose: Handle the datatypes from the command.
+ *
+ * Return: void
+ *
+ * Programmer: Bill Wendling
+ * Tuesday, 9. January 2001
+ *
+ * Modifications:
+ *
+ * Pedro Vicente, May 8, 2008
+ * added a flag PE that prints/not prints error messages
+ * added for cases of external links not found, to avoid printing of
+ * objects not found, since external links are dumped on a trial error basis
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+handle_datatypes(hid_t fid, const char *type, void H5_ATTR_UNUSED * data, int pe, const char *display_name)
+{
+ hid_t type_id;
+ const char *real_name = display_name ? display_name : type;
+
+ if((type_id = H5Topen2(fid, type, H5P_DEFAULT)) < 0) {
+ /* check if type is unamed datatype */
+ unsigned idx = 0;
+
+ while(idx < type_table->nobjs ) {
+ char name[128];
+
+ if(!type_table->objs[idx].recorded) {
+ /* unamed datatype */
+ sprintf(name, "/#"H5_PRINTF_HADDR_FMT, type_table->objs[idx].objno);
+
+ if(!HDstrcmp(name, real_name))
+ break;
+ } /* end if */
+
+ idx++;
+ } /* end while */
+
+ if(idx == type_table->nobjs) {
+ if (pe) {
+ /* unknown type */
+ PRINTVALSTREAM(rawoutstream, "\n");
+ begin_obj(h5tools_dump_header_format->datatypebegin, real_name, h5tools_dump_header_format->datatypeblockbegin);
+ PRINTVALSTREAM(rawoutstream, "\n");
+ indentation(COL);
+ error_msg("unable to open datatype \"%s\"\n", real_name);
+ end_obj(h5tools_dump_header_format->datatypeend, h5tools_dump_header_format->datatypeblockend);
+ h5tools_setstatus(EXIT_FAILURE);
+ }
+ }
+ else {
+ hid_t dsetid = H5Dopen2(fid, type_table->objs[idx].objname, H5P_DEFAULT);
+ type_id = H5Dget_type(dsetid);
+
+ dump_indent += COL;
+ dump_named_datatype(type_id, real_name);
+ dump_indent -= COL;
+
+ H5Tclose(type_id);
+ H5Dclose(dsetid);
+ }
+ }
+ else {
+ dump_indent += COL;
+ dump_named_datatype(type_id, real_name);
+ dump_indent -= COL;
+
+ if(H5Tclose(type_id) < 0)
+ h5tools_setstatus(EXIT_FAILURE);
+ }
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: dump_extlink
+ *
+ * made by: PVN
+ *
+ * Purpose: Dump an external link
+ * Since external links are soft links, they are dumped on a trial error
+ * basis, attempting to dump as a dataset, as a group and as a named datatype
+ * Error messages are supressed
+ *
+ * Modifications:
+ * Neil Fortner
+ * 13 October 2008
+ * Function basically rewritten. No longer directly opens the target file,
+ * now initializes a new set of tables for the external file. No longer
+ * dumps on a trial and error basis, but errors are still suppressed.
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+dump_extlink(hid_t group, const char *linkname, const char *objname)
+{
+ hid_t oid;
+ H5O_info_t oi;
+ table_t *old_group_table = group_table;
+ table_t *old_dset_table = dset_table;
+ table_t *old_type_table = type_table;
+ hbool_t old_hit_elink;
+ ssize_t idx;
+
+ /* Open target object */
+ if ((oid = H5Oopen(group, linkname, H5P_DEFAULT)) < 0)
+ goto fail;
+
+ /* Get object info */
+ if (H5Oget_info(oid, &oi) < 0) {
+ H5Oclose(oid);
+ goto fail;
+ }
+
+ /* Check if we have visited this file already */
+ if ((idx = table_list_visited(oi.fileno)) < 0) {
+ /* We have not visited this file, build object tables */
+ if ((idx = table_list_add(oid, oi.fileno)) < 0) {
+ H5Oclose(oid);
+ goto fail;
+ }
+ }
+
+ /* Do not recurse through an external link into the original file (idx=0) */
+ if (idx) {
+ /* Update table pointers */
+ group_table = table_list.tables[idx].group_table;
+ dset_table = table_list.tables[idx].dset_table;
+ type_table = table_list.tables[idx].type_table;
+
+ /* We will now traverse the external link, set this global to indicate this */
+ old_hit_elink = hit_elink;
+ hit_elink = TRUE;
+
+ /* add some indentation to distinguish that these objects are external */
+ dump_indent += COL;
+
+ /* Recurse into the external file */
+ switch (oi.type) {
+ case H5O_TYPE_GROUP:
+ handle_groups(group, linkname, NULL, 0, objname);
+ break;
+
+ case H5O_TYPE_DATASET:
+ handle_datasets(group, linkname, NULL, 0, objname);
+ break;
+
+ case H5O_TYPE_NAMED_DATATYPE:
+ handle_datatypes(group, linkname, NULL, 0, objname);
+ break;
+
+ case H5O_TYPE_UNKNOWN:
+ case H5O_TYPE_NTYPES:
+ default:
+ h5tools_setstatus(EXIT_FAILURE);
+ }
+
+ dump_indent -= COL;
+
+ /* Reset table pointers */
+ group_table = old_group_table;
+ dset_table = old_dset_table;
+ type_table = old_type_table;
+
+ /* Reset hit_elink */
+ hit_elink = old_hit_elink;
+ } /* end if */
+
+ if (H5Idec_ref(oid) < 0)
+ h5tools_setstatus(EXIT_FAILURE);
+
+ return SUCCEED;
+
+fail:
+ return FAIL;
+}
+
diff --git a/tools/src/h5dump/h5dump_ddl.h b/tools/src/h5dump/h5dump_ddl.h
new file mode 100644
index 0000000..2b3f61e
--- /dev/null
+++ b/tools/src/h5dump/h5dump_ddl.h
@@ -0,0 +1,52 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifndef H5DUMP_DDL_H__
+#define H5DUMP_DDL_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* The dump functions of the dump_function_table */
+/* standard format: no change */
+void dump_group(hid_t, const char *);
+void dump_named_datatype(hid_t, const char *);
+void dump_dataset(hid_t, const char *, struct subset_t *);
+void dump_dataspace(hid_t space);
+void dump_datatype(hid_t type);
+void dump_data(hid_t, int, struct subset_t *, int);
+void dump_fcpl(hid_t fid);
+void dump_fcontents(hid_t fid);
+
+/* callback function used by H5Aiterate2() */
+herr_t dump_attr_cb(hid_t loc_id, const char *attr_name, const H5A_info_t *info, void *_op_data);
+
+/* other iteration functions */
+void link_iteration(hid_t gid, unsigned crt_order_flags);
+void attr_iteration(hid_t gid, unsigned attr_crt_order_flags);
+
+void handle_paths(hid_t fid, const char *path_name, void *data, int pe, const char *display_name);
+void handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *display_name);
+void handle_attributes(hid_t fid, const char *attr, void H5_ATTR_UNUSED * data, int H5_ATTR_UNUSED pe, const char H5_ATTR_UNUSED *display_name);
+void handle_groups(hid_t fid, const char *group, void H5_ATTR_UNUSED *data, int pe, const char *display_name);
+void handle_links(hid_t fid, const char *links, void H5_ATTR_UNUSED * data, int H5_ATTR_UNUSED pe, const char H5_ATTR_UNUSED *display_name);
+void handle_datatypes(hid_t fid, const char *type, void H5_ATTR_UNUSED * data, int pe, const char *display_name);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !H5DUMP_DDL_H__ */
diff --git a/tools/src/h5dump/h5dump_defines.h b/tools/src/h5dump/h5dump_defines.h
new file mode 100644
index 0000000..2be2dcc
--- /dev/null
+++ b/tools/src/h5dump/h5dump_defines.h
@@ -0,0 +1,56 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#ifndef H5DUMP_DEFINES_H__
+#define H5DUMP_DEFINES_H__
+
+#define H5DUMP_MAX_RANK H5S_MAX_RANK
+
+#define ATTRIBUTE_DATA 0
+#define DATASET_DATA 1
+#define ENUM_DATA 2
+#define COL 3
+
+/* Macros for displaying objects */
+#define begin_obj(obj,name,begin) \
+ do { \
+ if ((name)) { \
+ PRINTSTREAM(rawoutstream, "%s \"%s\" %s", (obj), (name), (begin)); \
+ } \
+ else { \
+ PRINTSTREAM(rawoutstream, "%s %s", (obj), (begin)); \
+ } \
+ } while(0);
+
+#define end_obj(obj,end) \
+ do { \
+ if(HDstrlen(end)) { \
+ PRINTSTREAM(rawoutstream, "%s", end); \
+ if(HDstrlen(obj)) \
+ PRINTVALSTREAM(rawoutstream, " "); \
+ } \
+ if(HDstrlen(obj)) \
+ PRINTSTREAM(rawoutstream, "%s", obj); \
+ } while(0);
+
+
+/* 3 private values: can't be set, but can be read.
+ Note: these are defined in H5Zprivate, they are
+ duplicated here.
+ */
+#define H5_SZIP_LSB_OPTION_MASK 8
+#define H5_SZIP_MSB_OPTION_MASK 16
+#define H5_SZIP_RAW_OPTION_MASK 128
+
+#endif /* !H5DUMP_DEFINES_H__ */
diff --git a/tools/src/h5dump/h5dump_extern.h b/tools/src/h5dump/h5dump_extern.h
new file mode 100644
index 0000000..8fef1b9
--- /dev/null
+++ b/tools/src/h5dump/h5dump_extern.h
@@ -0,0 +1,114 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#ifndef H5DUMP_EXTERN_H__
+#define H5DUMP_EXTERN_H__
+
+#include "hdf5.h"
+#include "H5private.h"
+#include "h5tools.h"
+#include "h5tools_utils.h"
+#include "h5tools_ref.h"
+#include "h5trav.h"
+#include "h5dump_defines.h"
+
+/**
+ ** This is the global dispatch table for the dump functions.
+ **/
+/* the table of dump functions */
+typedef struct dump_functions_t {
+ void (*dump_group_function) (hid_t, const char *);
+ void (*dump_named_datatype_function) (hid_t, const char *);
+ void (*dump_dataset_function) (hid_t, const char *, struct subset_t *);
+ void (*dump_dataspace_function) (hid_t);
+ void (*dump_datatype_function) (hid_t);
+ herr_t (*dump_attribute_function) (hid_t, const char *, const H5A_info_t *, void *);
+ void (*dump_data_function) (hid_t, int, struct subset_t *, int);
+} dump_functions;
+
+/* List of table structures. There is one table structure for each file */
+typedef struct h5dump_table_list_t {
+ size_t nalloc;
+ size_t nused;
+ struct {
+ unsigned long fileno; /* File number that these tables refer to */
+ hid_t oid; /* ID of an object in this file, held open so fileno is consistent */
+ table_t *group_table; /* Table of groups */
+ table_t *dset_table; /* Table of datasets */
+ table_t *type_table; /* Table of datatypes */
+ } *tables;
+} h5dump_table_list_t;
+
+extern h5dump_table_list_t table_list;
+extern table_t *group_table, *dset_table, *type_table;
+extern unsigned dump_indent; /*how far in to indent the line */
+
+extern int unamedtype; /* shared datatype with no name */
+extern hbool_t hit_elink; /* whether we have traversed an external link */
+extern size_t prefix_len;
+extern char *prefix;
+extern const char *fp_format;
+
+/* things to display or which are set via command line parameters */
+extern int display_all;
+extern int display_oid;
+extern int display_data;
+extern int display_attr_data;
+extern int display_char; /*print 1-byte numbers as ASCII */
+extern int usingdasho;
+extern int display_bb; /*superblock */
+extern int display_dcpl; /*dcpl */
+extern int display_fi; /*file index */
+extern int display_ai; /*array index */
+extern int display_escape; /*escape non printable characters */
+extern int display_region; /*print region reference data */
+extern int disable_compact_subset; /* disable compact form of subset notation */
+extern int display_packed_bits; /*print 1-8 byte numbers as packed bits*/
+extern int include_attrs; /* Display attributes */
+extern int display_vds_first; /* vds display to first missing */
+extern int vds_gap_size; /* vds skip missing files */
+
+/* sort parameters */
+extern H5_index_t sort_by; /*sort_by [creation_order | name] */
+extern H5_iter_order_t sort_order; /*sort_order [ascending | descending] */
+
+#define PACKED_BITS_MAX 8 /* Maximum number of packed-bits to display */
+#define PACKED_BITS_SIZE_MAX 8*sizeof(long long) /* Maximum bits size of integer types of packed-bits */
+/* mask list for packed bits */
+extern unsigned long long packed_mask[PACKED_BITS_MAX]; /* packed bits are restricted to 8*sizeof(llong) bytes */
+
+/* packed bits display parameters */
+extern unsigned packed_offset[PACKED_BITS_MAX];
+extern unsigned packed_length[PACKED_BITS_MAX];
+
+/*
+ * The global table is set to either ddl_function_table or
+ * xml_function_table in the initialization.
+ */
+extern const dump_functions *dump_function_table;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void add_prefix(char **prfx, size_t *prfx_len, const char *name);
+hid_t h5_fileaccess(void);
+ssize_t table_list_add(hid_t oid, unsigned long file_no);
+ssize_t table_list_visited(unsigned long file_no);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !H5DUMP_EXTERN_H__ */
diff --git a/tools/src/h5dump/h5dump_xml.c b/tools/src/h5dump/h5dump_xml.c
new file mode 100644
index 0000000..41f3914
--- /dev/null
+++ b/tools/src/h5dump/h5dump_xml.c
@@ -0,0 +1,4567 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "H5private.h"
+#include "h5tools.h"
+#include "h5tools_dump.h"
+#include "h5tools_utils.h"
+#include "h5tools_ref.h"
+#include "h5trav.h"
+#include "h5dump_extern.h"
+#include "h5dump_xml.h"
+
+const char *xmlnsprefix="hdf5:";
+
+/*
+ * Alternative formating for data dumped to XML
+ * In general, the numbers are the same, but separators
+ * except spaces are not used.
+ *
+ * Some of these are not used, as some kinds of data are
+ * dumped in completely new subroutines.
+ *
+ * Some of this formatting may yet need to change.
+ *
+ * This table only affects XML output.
+ */
+static h5tool_format_t xml_dataformat = {
+ 0, /*raw */
+
+ "", /*fmt_raw */
+ "%d", /*fmt_int */
+ "%u", /*fmt_uint */
+ "%hhd", /*fmt_schar */
+ "%u", /*fmt_uchar */
+ "%d", /*fmt_short */
+ "%u", /*fmt_ushort */
+ "%ld", /*fmt_long */
+ "%lu", /*fmt_ulong */
+ NULL, /*fmt_llong */
+ NULL, /*fmt_ullong */
+ "%g", /*fmt_double */
+ "%g", /*fmt_float */
+
+ 0, /*ascii */
+ 0, /*str_locale */
+ 0, /*str_repeat */
+
+ "", /*arr_pre */
+ "", /*arr_sep */
+ "", /*arr_suf */
+ 1, /*arr_linebreak */
+
+ "", /*cmpd_name */
+ "", /*cmpd_sep */
+ "", /*cmpd_pre */
+ "", /*cmpd_suf */
+ "", /*cmpd_end */
+
+ " ", /*vlen_sep */
+ " ", /*vlen_pre */
+ "", /*vlen_suf */
+ "", /*vlen_end */
+
+ "%s", /*elmt_fmt */
+ "", /*elmt_suf1 */
+ " ", /*elmt_suf2 */
+
+ "", /*idx_n_fmt */
+ "", /*idx_sep */
+ "", /*idx_fmt */
+
+ 80, /*line_ncols *//*standard default columns */
+ 0, /*line_per_line */
+ "", /*line_pre */
+ "%s", /*line_1st */
+ "%s", /*line_cont */
+ "", /*line_suf */
+ "", /*line_sep */
+ 1, /*line_multi_new */
+ " ", /*line_indent */
+
+ 1, /*skip_first */
+
+ 1, /*obj_hidefileno */
+ " "H5_PRINTF_HADDR_FMT, /*obj_format */
+
+ 1, /*dset_hidefileno */
+ "DATASET %s ", /*dset_format */
+ "%s", /*dset_blockformat_pre */
+ "%s", /*dset_ptformat_pre */
+ "%s", /*dset_ptformat */
+ 0, /*array indices */
+ 0 /*escape non printable characters */
+};
+
+
+/* internal functions */
+static int xml_name_to_XID(const char *, char *, int , int );
+
+/* internal functions used by XML option */
+static void xml_print_datatype(hid_t, unsigned);
+static void xml_print_enum(hid_t);
+static int xml_print_refs(hid_t, int);
+static int xml_print_strs(hid_t, int);
+static char *xml_escape_the_string(const char *, int);
+static char *xml_escape_the_name(const char *);
+
+/*-------------------------------------------------------------------------
+ * Function: xml_dump_all_cb
+ *
+ * Purpose: function callback called by H5Literate,
+ * displays everything in the specified object
+ *
+ * Return: Success: SUCCEED
+ *
+ * Failure: FAIL
+ *
+ * Programmer: Ruey-Hsia Li
+ *
+ * Modifications:
+ * RMcG, November 2000
+ * Added XML support. Also, optionally checks the op_data argument
+ *
+ * PVN, May 2008
+ * Dump external links
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR_UNUSED *op_data)
+{
+ hid_t obj;
+ herr_t ret = SUCCEED;
+ char *obj_path = NULL; /* Full path of object */
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t *outputformat = &xml_dataformat;
+ h5tool_format_t string_dataformat;
+ hsize_t curr_pos = 0; /* total data element position */
+
+ /* setup */
+ HDmemset(&buffer, 0, sizeof(h5tools_str_t));
+
+ HDmemset(&ctx, 0, sizeof(ctx));
+ ctx.indent_level = dump_indent / COL;
+ ctx.cur_column = dump_indent;
+
+ string_dataformat = *outputformat;
+
+ if (fp_format) {
+ string_dataformat.fmt_double = fp_format;
+ string_dataformat.fmt_float = fp_format;
+ }
+
+ if (h5tools_nCols==0) {
+ string_dataformat.line_ncols = 65535;
+ string_dataformat.line_per_line = 1;
+ }
+ else
+ string_dataformat.line_ncols = h5tools_nCols;
+
+ string_dataformat.do_escape = display_escape;
+ outputformat = &string_dataformat;
+
+ /* Build the object's path name */
+ obj_path = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2);
+ if(!obj_path) {
+ ret = FAIL;
+ goto done;
+ }
+
+ HDstrcpy(obj_path, prefix);
+ HDstrcat(obj_path, "/");
+ HDstrcat(obj_path, name);
+
+ if(linfo->type == H5L_TYPE_HARD) {
+ H5O_info_t oinfo;
+
+ /* Stat the object */
+ if(H5Oget_info_by_name(group, name, &oinfo, H5P_DEFAULT) < 0) {
+ error_msg("unable to get object information for \"%s\"\n", name);
+ h5tools_setstatus(EXIT_FAILURE);
+ ret = FAIL;
+ goto done;
+ } /* end if */
+
+ switch(oinfo.type) {
+ case H5O_TYPE_GROUP:
+ if((obj = H5Gopen2(group, name, H5P_DEFAULT)) < 0) {
+ error_msg("unable to dump group \"%s\"\n", name);
+ h5tools_setstatus(EXIT_FAILURE);
+ ret = FAIL;
+ }
+ else {
+ char *old_prefix; /* Pointer to previous prefix */
+
+ /* Keep copy of prefix before iterating into group */
+ old_prefix = HDstrdup(prefix);
+ HDassert(old_prefix);
+
+ /* Append group name to prefix */
+ add_prefix(&prefix, &prefix_len, name);
+
+ /* Iterate into group */
+ dump_function_table->dump_group_function(obj, name);
+
+ /* Restore old prefix name */
+ HDstrcpy(prefix, old_prefix);
+ HDfree(old_prefix);
+
+ /* Close group */
+ H5Gclose(obj);
+ }
+ break;
+
+ case H5O_TYPE_DATASET:
+ if((obj = H5Dopen2(group, name, H5P_DEFAULT)) >= 0) {
+ if(oinfo.rc > 1 || hit_elink) {
+ obj_t *found_obj; /* Found object */
+
+ found_obj = search_obj(dset_table, oinfo.addr);
+
+ if(found_obj == NULL) {
+ ctx.indent_level++;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "%s \"%s\" %s",
+ h5tools_dump_header_format->datasetbegin, name,
+ h5tools_dump_header_format->datasetblockbegin);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ if(HDstrlen(h5tools_dump_header_format->datasetblockend)) {
+ h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetblockend);
+ if(HDstrlen(h5tools_dump_header_format->datasetend))
+ h5tools_str_append(&buffer, " ");
+ }
+ if(HDstrlen(h5tools_dump_header_format->datasetend))
+ h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetend);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.indent_level--;
+
+ h5tools_setstatus(EXIT_FAILURE);
+ ret = FAIL;
+ H5Dclose(obj);
+ goto done;
+ }
+ else if(found_obj->displayed) {
+ /* the XML version */
+ char *t_obj_path = xml_escape_the_name(obj_path);
+ char *t_prefix = xml_escape_the_name(HDstrcmp(prefix,"") ? prefix : "/");
+ char *t_name = xml_escape_the_name(name);
+ char *t_objname = xml_escape_the_name(found_obj->objname);
+ char dsetxid[100];
+ char parentxid[100];
+ char pointerxid[100];
+
+ /* Create OBJ-XIDs for the parent and object */
+ xml_name_to_XID(obj_path, dsetxid, (int)sizeof(dsetxid), 1);
+ xml_name_to_XID(prefix, parentxid, (int)sizeof(parentxid), 1);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sDataset Name=\"%s\" OBJ-XID=\"%s-%d\" "
+ "H5Path=\"%s\" Parents=\"%s\" "
+ "H5ParentPaths=\"%s\">",
+ xmlnsprefix,
+ t_name, /* Dataset Name */
+ dsetxid, get_next_xid(), /* OBJ-XID */
+ t_obj_path, /* H5Path */
+ parentxid, /* Parents */
+ t_prefix); /* H5ParentPaths */
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ xml_name_to_XID(found_obj->objname, pointerxid, (int)sizeof(pointerxid), 1);
+
+ ctx.indent_level++;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sDatasetPtr OBJ-XID=\"%s\" H5Path=\"%s\"/>",
+ xmlnsprefix,
+ pointerxid,t_objname);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.indent_level--;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sDataset>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ HDfree(t_name);
+ HDfree(t_obj_path);
+ HDfree(t_prefix);
+ HDfree(t_objname);
+
+ H5Dclose(obj);
+ goto done;
+ }
+ else
+ found_obj->displayed = TRUE;
+ } /* end if */
+
+ dump_function_table->dump_dataset_function(obj, name, NULL);
+ H5Dclose(obj);
+ }
+ else {
+ error_msg("unable to dump dataset \"%s\"\n", name);
+ h5tools_setstatus(EXIT_FAILURE);
+ ret = FAIL;
+ }
+ break;
+
+ case H5O_TYPE_NAMED_DATATYPE:
+ if((obj = H5Topen2(group, name, H5P_DEFAULT)) < 0) {
+ error_msg("unable to dump datatype \"%s\"\n", name);
+ h5tools_setstatus(EXIT_FAILURE);
+ ret = FAIL;
+ }
+ else {
+ dump_function_table->dump_named_datatype_function(obj, name);
+ H5Tclose(obj);
+ }
+ break;
+
+ case H5O_TYPE_UNKNOWN:
+ case H5O_TYPE_NTYPES:
+ default:
+ error_msg("unknown object \"%s\"\n", name);
+ h5tools_setstatus(EXIT_FAILURE);
+ ret = FAIL;
+ }
+ } /* end if */
+ else {
+ char *targbuf;
+
+ switch(linfo->type) {
+ case H5L_TYPE_SOFT:
+ targbuf = (char *)HDmalloc(linfo->u.val_size);
+ HDassert(targbuf);
+
+ if(H5Lget_val(group, name, targbuf, linfo->u.val_size, H5P_DEFAULT) < 0) {
+ error_msg("unable to get link value\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ ret = FAIL;
+ }
+ else {
+ /* print the value of a soft link */
+ /* XML */
+ char linkxid[100];
+ char parentxid[100];
+ char targetxid[100];
+ char *t_prefix = xml_escape_the_name(HDstrcmp(prefix,"") ? prefix : "/");
+ char *t_name = xml_escape_the_name(name);
+ char *t_targbuf = xml_escape_the_name(targbuf);
+ char *t_obj_path = xml_escape_the_name(obj_path);
+ char *t_link_path;
+ int res;
+
+ t_link_path = (char *)HDmalloc(HDstrlen(prefix) + linfo->u.val_size + 1);
+ if(targbuf[0] == '/')
+ HDstrcpy(t_link_path, targbuf);
+ else {
+ HDstrcpy(t_link_path, prefix);
+ HDstrcat(HDstrcat(t_link_path, "/"), targbuf);
+ } /* end else */
+
+ /* Create OBJ-XIDs for the parent and object */
+ xml_name_to_XID(t_obj_path, linkxid, (int)sizeof(linkxid), 1);
+ xml_name_to_XID(prefix, parentxid, (int)sizeof(parentxid), 1);
+
+ /* Try to create an OBJ-XID for the object pointed to */
+ res = xml_name_to_XID(t_link_path, targetxid, (int)sizeof(targetxid), 0);
+ if (res == 0) {
+ /* target obj found */
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sSoftLink LinkName=\"%s\" "
+ "OBJ-XID=\"%s\" "
+ "H5SourcePath=\"%s\" "
+ "TargetPath=\"%s\" TargetObj=\"%s\" "
+ "Parents=\"%s\" H5ParentPaths=\"%s\" />",
+ xmlnsprefix,
+ t_name, /* LinkName */
+ linkxid, /* OBJ-XID */
+ t_obj_path, /* H5SourcePath */
+ t_targbuf, /* TargetPath */
+ targetxid, /* TargetObj */
+ parentxid, /* Parents */
+ t_prefix); /* H5ParentPaths */
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
+ else {
+ /* dangling link -- omit from xml attributes */
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sSoftLink LinkName=\"%s\" "
+ "OBJ-XID=\"%s\" "
+ "H5SourcePath=\"%s\" "
+ "TargetPath=\"%s\" "
+ "Parents=\"%s\" H5ParentPaths=\"%s\" />",
+ xmlnsprefix,
+ t_name, /* LinkName */
+ linkxid, /* OBJ-XID */
+ t_obj_path, /* H5SourcePath */
+ t_targbuf, /* TargetPath */
+ parentxid, /* Parents */
+ t_prefix); /* H5ParentPaths */
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
+
+ HDfree(t_prefix);
+ HDfree(t_name);
+ HDfree(t_targbuf);
+ HDfree(t_obj_path);
+ HDfree(t_link_path);
+ }
+
+ HDfree(targbuf);
+ break;
+
+ case H5L_TYPE_EXTERNAL:
+ targbuf = (char *)HDmalloc(linfo->u.val_size);
+ HDassert(targbuf);
+
+ if(H5Lget_val(group, name, targbuf, linfo->u.val_size, H5P_DEFAULT) < 0) {
+ error_msg("unable to get external link value\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ ret = FAIL;
+ } /* end if */
+ else {
+ const char *filename;
+ const char *targname;
+
+ if(H5Lunpack_elink_val(targbuf, linfo->u.val_size, NULL, &filename, &targname) < 0) {
+ error_msg("unable to unpack external link value\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ ret = FAIL;
+ } /* end if */
+ else {
+ char linkxid[100];
+ char parentxid[100];
+ char *t_name = xml_escape_the_name(name);
+ char *t_prefix = xml_escape_the_name(HDstrcmp(prefix,"") ? prefix : "/");
+ char *t_obj_path = xml_escape_the_name(obj_path);
+ char *t_filename = xml_escape_the_name(filename);
+ char *t_targname = xml_escape_the_name(targname);
+
+ /* Create OBJ-XIDs for the parent and object */
+ xml_name_to_XID(t_obj_path, linkxid, (int)sizeof(linkxid), 1);
+ xml_name_to_XID(prefix, parentxid, (int)sizeof(parentxid), 1);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sExternalLink LinkName=\"%s\" "
+ "OBJ-XID=\"%s\" "
+ "H5SourcePath=\"%s\" "
+ "TargetFilename=\"%s\" "
+ "TargetPath=\"%s\" "
+ "Parents=\"%s\" H5ParentPaths=\"%s\" />",
+ xmlnsprefix,
+ t_name, /* LinkName */
+ linkxid, /* OBJ-XID */
+ t_obj_path, /* H5SourcePath */
+ filename, /* TargetFilename */
+ targname, /* TargetPath*/
+ parentxid, /* Parents */
+ t_prefix); /* H5ParentPaths */
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ HDfree(t_prefix);
+ HDfree(t_name);
+ HDfree(t_filename);
+ HDfree(t_targname);
+ HDfree(t_obj_path);
+ } /* end else */
+ } /* end else */
+ HDfree(targbuf);
+ break;
+
+ case H5L_TYPE_ERROR:
+ case H5L_TYPE_MAX:
+ HDassert(0);
+ /* fall through */
+ case H5L_TYPE_HARD:
+ default:
+ {
+ char linkxid[100];
+ char parentxid[100];
+ char *t_name = xml_escape_the_name(name);
+ char *t_prefix = xml_escape_the_name(HDstrcmp(prefix,"") ? prefix : "/");
+ char *t_obj_path = xml_escape_the_name(obj_path);
+
+ /* Create OBJ-XIDs for the parent and object */
+ xml_name_to_XID(t_obj_path, linkxid, (int)sizeof(linkxid), 1);
+ xml_name_to_XID(prefix, parentxid, (int)sizeof(parentxid), 1);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sUserDefined LinkName=\"%s\" "
+ "OBJ-XID=\"%s\" "
+ "H5SourcePath=\"%s\" "
+ "LinkClass=\"%d\" "
+ "Parents=\"%s\" H5ParentPaths=\"%s\" />",
+ xmlnsprefix,
+ t_name, /* LinkName */
+ linkxid, /* OBJ-XID */
+ t_obj_path, /* H5SourcePath */
+ linfo->type, /* LinkClass */
+ parentxid, /* Parents */
+ t_prefix); /* H5ParentPaths */
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ HDfree(t_prefix);
+ HDfree(t_name);
+ HDfree(t_obj_path);
+ }
+ break;
+
+ } /* end switch */
+ } /* end else */
+
+done:
+
+ h5tools_str_close(&buffer);
+
+ if(obj_path)
+ HDfree(obj_path);
+ return ret;
+}
+
+/*
+ * create a string suitable for and XML NCNAME. Uses the
+ * object reference to create the string.
+ *
+ * 'gen'; 0 - return null if not found
+ * 1 - generate a fake entry and return fake id.
+ */
+int
+xml_name_to_XID(const char *str , char *outstr, int outlen, int gen)
+{
+ haddr_t objno; /* Object ID for object at path */
+
+ if (outlen < 22) return 1;
+
+ objno = ref_path_table_lookup(str);
+ if (objno == HADDR_UNDEF) {
+ if (HDstrlen(str) == 0) {
+ objno = ref_path_table_lookup("/");
+ if (objno == HADDR_UNDEF) {
+ if (gen) {
+ objno = ref_path_table_gen_fake(str);
+ sprintf(outstr, "xid_"H5_PRINTF_HADDR_FMT, objno);
+ return 0;
+ }
+ else {
+ return 1;
+ }
+ }
+ }
+ else {
+ if (gen) {
+ objno = ref_path_table_gen_fake(str);
+ sprintf(outstr, "xid_"H5_PRINTF_HADDR_FMT, objno);
+ return 0;
+ }
+ else {
+ return 1;
+ }
+ }
+ }
+
+ sprintf(outstr, "xid_"H5_PRINTF_HADDR_FMT, objno);
+
+ return(0);
+}
+
+static const char *quote = "&quot;";
+static const char *amp = "&amp;";
+static const char *lt = "&lt;";
+static const char *gt = "&gt;";
+static const char *apos = "&apos;";
+
+/*-------------------------------------------------------------------------
+ * Function: xml_escape_the_name
+ *
+ * Purpose: Escape XML reserved chars in a name, so HDF5 strings
+ * and paths can be correctly read back in XML element.
+ *
+ * Return: The revised string.
+ *
+ * Programmer: REMcG
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static char *
+xml_escape_the_name(const char *str)
+{
+ size_t extra;
+ size_t len;
+ size_t i;
+ const char *cp;
+ char *ncp;
+ char *rcp;
+ size_t ncp_len;
+
+ if (!str)
+ return NULL;
+
+ cp = str;
+ len = HDstrlen(str);
+ extra = 0;
+
+ for (i = 0; i < len; i++) {
+ if (*cp == '\"')
+ extra += (HDstrlen(quote) - 1);
+ else if (*cp == '\'')
+ extra += (HDstrlen(apos) - 1);
+ else if (*cp == '<')
+ extra += (HDstrlen(lt) - 1);
+ else if (*cp == '>')
+ extra += (HDstrlen(gt) - 1);
+ else if (*cp == '&')
+ extra += (HDstrlen(amp) - 1);
+
+ cp++;
+ }
+
+ if (extra == 0)
+ return HDstrdup(str);
+
+ cp = str;
+ ncp_len = len + extra + 1;
+ rcp = ncp = (char *)HDmalloc(ncp_len);
+
+ if (!ncp)
+ return NULL; /* ?? */
+
+ for (i = 0; i < len; i++) {
+ size_t esc_len;
+
+ HDassert(ncp_len);
+ if (*cp == '\'') {
+ HDstrncpy(ncp, apos, ncp_len);
+ esc_len = HDstrlen(apos);
+ }
+ else if (*cp == '<') {
+ HDstrncpy(ncp, lt, ncp_len);
+ esc_len = HDstrlen(lt);
+ }
+ else if (*cp == '>') {
+ HDstrncpy(ncp, gt, ncp_len);
+ esc_len = HDstrlen(gt);
+ }
+ else if (*cp == '\"') {
+ HDstrncpy(ncp, quote, ncp_len);
+ esc_len = HDstrlen(quote);
+ }
+ else if (*cp == '&') {
+ HDstrncpy(ncp, amp, ncp_len);
+ esc_len = HDstrlen(amp);
+ }
+ else {
+ *ncp = *cp;
+ esc_len = 1;
+ }
+ ncp += esc_len;
+ ncp_len -= esc_len;
+ cp++;
+ }
+
+ *ncp = '\0';
+ return rcp;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: xml_escape_the_string
+ *
+ * Purpose: Escape XML reserved chars in a string, so HDF5 strings
+ * and paths can be correctly read back in XML CDATA.
+ *
+ * Return: The revised string.
+ *
+ * Programmer: REMcG
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static char *
+xml_escape_the_string(const char *str, int slen)
+{
+ size_t extra;
+ size_t len;
+ size_t i;
+ const char *cp;
+ char *ncp;
+ char *rcp;
+ size_t ncp_len;
+
+ if (!str)
+ return NULL;
+
+ cp = str;
+
+ if (slen < 0)
+ len = HDstrlen(str);
+ else
+ len = (size_t)slen;
+
+ extra = 0;
+
+ for (i = 0; i < len; i++) {
+ if (*cp == '\\')
+ extra++;
+ else if (*cp == '\"')
+ extra++;
+ else if (*cp == '\'')
+ extra += (HDstrlen(apos) - 1);
+ else if (*cp == '<')
+ extra += (HDstrlen(lt) - 1);
+ else if (*cp == '>')
+ extra += (HDstrlen(gt) - 1);
+ else if (*cp == '&')
+ extra += (HDstrlen(amp) - 1);
+ cp++;
+ }
+
+ cp = str;
+ ncp_len = len + extra + 1;
+ rcp = ncp = (char *) HDcalloc(ncp_len, sizeof(char));
+
+ if (ncp == NULL)
+ return NULL; /* ?? */
+
+ for (i = 0; i < len; i++) {
+ size_t esc_len;
+
+ HDassert(ncp_len);
+ if (*cp == '\\') {
+ *ncp++ = '\\';
+ *ncp = *cp;
+ esc_len = 1;
+ }
+ else if (*cp == '\"') {
+ *ncp++ = '\\';
+ *ncp = *cp;
+ esc_len = 1;
+ }
+ else if (*cp == '\'') {
+ HDstrncpy(ncp, apos, ncp_len);
+ esc_len = HDstrlen(apos);
+ }
+ else if (*cp == '<') {
+ HDstrncpy(ncp, lt, ncp_len);
+ esc_len = HDstrlen(lt);
+ }
+ else if (*cp == '>') {
+ HDstrncpy(ncp, gt, ncp_len);
+ esc_len = HDstrlen(gt);
+ }
+ else if (*cp == '&') {
+ HDstrncpy(ncp, amp, ncp_len);
+ esc_len = HDstrlen(amp);
+ }
+ else {
+ *ncp = *cp;
+ esc_len = 1;
+ }
+ ncp += esc_len;
+ ncp_len -= esc_len;
+ cp++;
+ }
+
+ *ncp = '\0';
+ return rcp;
+}
+
+/**
+ ** XML print functions--these replace some functions in the
+ ** h5tools.c suite.
+ **/
+
+/*-------------------------------------------------------------------------
+ * Function: xml_print_datatype
+ *
+ * Purpose: Print description of a datatype in XML.
+ * Note: this is called inside a <DataType> element.
+ *
+ * Return: void
+ *
+ * Programmer: REMcG
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+xml_print_datatype(hid_t type, unsigned in_group)
+{
+ char *mname;
+ hid_t mtype;
+ unsigned nmembers;
+ unsigned ndims;
+ unsigned i;
+ size_t size;
+ hsize_t dims[H5DUMP_MAX_RANK];
+ H5T_str_t str_pad;
+ H5T_cset_t cset;
+ hid_t super;
+ H5T_order_t ord;
+ H5T_sign_t sgn;
+ size_t sz;
+ size_t spos;
+ size_t epos;
+ size_t esize;
+ size_t mpos;
+ size_t msize;
+ int nmembs;
+ htri_t is_vlstr=FALSE;
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t *outputformat = &xml_dataformat;
+ h5tool_format_t string_dataformat;
+ hsize_t curr_pos = 0; /* total data element position */
+
+ /* setup */
+ HDmemset(&buffer, 0, sizeof(h5tools_str_t));
+
+ HDmemset(&ctx, 0, sizeof(ctx));
+ ctx.indent_level = dump_indent / COL;
+ ctx.cur_column = dump_indent;
+
+ string_dataformat = *outputformat;
+
+ if (fp_format) {
+ string_dataformat.fmt_double = fp_format;
+ string_dataformat.fmt_float = fp_format;
+ }
+
+ if (h5tools_nCols==0) {
+ string_dataformat.line_ncols = 65535;
+ string_dataformat.line_per_line = 1;
+ }
+ else
+ string_dataformat.line_ncols = h5tools_nCols;
+
+ string_dataformat.do_escape = display_escape;
+ outputformat = &string_dataformat;
+
+ if(!in_group && H5Tcommitted(type) > 0) {
+ H5O_info_t oinfo;
+ obj_t *found_obj; /* Found object */
+
+ /* detect a shared datatype, output only once */
+ H5Oget_info(type, &oinfo);
+ found_obj = search_obj(type_table, oinfo.addr);
+
+ if(found_obj) {
+ /* This should be defined somewhere else */
+ /* These 2 cases are handled the same right now, but
+ probably will have something different eventually */
+ char * dtxid = (char *)HDmalloc((size_t)100);
+
+ xml_name_to_XID(found_obj->objname, dtxid, 100, 1);
+ if (!found_obj->recorded) {
+ /* 'anonymous' NDT. Use it's object num.
+ as it's name. */
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sNamedDataTypePtr OBJ-XID=\"/%s\"/>",
+ xmlnsprefix, dtxid);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
+ else {
+ /* point to the NDT by name */
+ char *t_objname = xml_escape_the_name(found_obj->objname);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sNamedDataTypePtr OBJ-XID=\"%s\" H5Path=\"%s\"/>",
+ xmlnsprefix, dtxid, t_objname);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ HDfree(t_objname);
+ }
+ HDfree(dtxid);
+ }
+ else {
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<!-- h5dump error: unknown committed type. -->");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_setstatus(EXIT_FAILURE);
+ }
+ }
+ else {
+ switch (H5Tget_class(type)) {
+ case H5T_INTEGER:
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.indent_level++;
+
+ /* <hdf5:IntegerType ByteOrder="bo" Sign="torf" Size="bytes"/> */
+ ord = H5Tget_order(type);
+ sgn = H5Tget_sign(type);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sIntegerType ByteOrder=\"",xmlnsprefix);
+ switch (ord) {
+ case H5T_ORDER_LE:
+ h5tools_str_append(&buffer, "LE");
+ break;
+ case H5T_ORDER_BE:
+ h5tools_str_append(&buffer, "BE");
+ break;
+ case H5T_ORDER_VAX:
+ case H5T_ORDER_MIXED:
+ case H5T_ORDER_NONE:
+ case H5T_ORDER_ERROR:
+ default:
+ h5tools_str_append(&buffer, "ERROR_UNKNOWN");
+ break;
+ } /* end switch */
+
+ h5tools_str_append(&buffer, "\" Sign=\"");
+
+ switch (sgn) {
+ case H5T_SGN_NONE:
+ h5tools_str_append(&buffer, "false");
+ break;
+ case H5T_SGN_2:
+ h5tools_str_append(&buffer, "true");
+ break;
+ case H5T_SGN_ERROR:
+ case H5T_NSGN:
+ default:
+ h5tools_str_append(&buffer, "ERROR_UNKNOWN");
+ break;
+ } /* end switch */
+
+ h5tools_str_append(&buffer, "\" Size=\"");
+ sz = H5Tget_size(type);
+ h5tools_str_append(&buffer, "%lu", (unsigned long)sz);
+ h5tools_str_append(&buffer, "\" />");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.indent_level--;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
+
+ case H5T_FLOAT:
+ /* <hdf5:FloatType ByteOrder="bo" Size="bytes"
+ SignBitLocation="bytes"
+ ExponentBits="eb" ExponentLocation="el"
+ MantissaBits="mb" MantissaLocation="ml" /> */
+ ord = H5Tget_order(type);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.indent_level++;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sFloatType ByteOrder=\"",xmlnsprefix);
+
+ switch (ord) {
+ case H5T_ORDER_LE:
+ h5tools_str_append(&buffer, "LE");
+ break;
+ case H5T_ORDER_BE:
+ h5tools_str_append(&buffer, "BE");
+ break;
+ case H5T_ORDER_VAX:
+ h5tools_str_append(&buffer, "VAX");
+ break;
+ case H5T_ORDER_MIXED:
+ case H5T_ORDER_NONE:
+ case H5T_ORDER_ERROR:
+ default:
+ h5tools_str_append(&buffer, "ERROR_UNKNOWN");
+ } /* end switch */
+
+ h5tools_str_append(&buffer, "\" Size=\"");
+ sz = H5Tget_size(type);
+ h5tools_str_append(&buffer, "%lu", (unsigned long)sz);
+ H5Tget_fields(type, &spos, &epos, &esize, &mpos, &msize);
+ h5tools_str_append(&buffer, "\" SignBitLocation=\"%lu\" ", (unsigned long)spos);
+ h5tools_str_append(&buffer, "ExponentBits=\"%lu\" ExponentLocation=\"%lu\" ", (unsigned long)esize, (unsigned long)epos);
+ h5tools_str_append(&buffer, "MantissaBits=\"%lu\" MantissaLocation=\"%lu\" />", (unsigned long)msize, (unsigned long)mpos);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.indent_level--;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
+
+ case H5T_TIME:
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.indent_level++;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sTimeType />",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<!-- H5T_TIME: not yet implemented -->");
+ ctx.indent_level--;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
+
+ case H5T_STRING:
+ /* <hdf5:StringType Cset="cs" StrSize="chars" StrPad="pad" /> */
+ size = H5Tget_size(type);
+ str_pad = H5Tget_strpad(type);
+ cset = H5Tget_cset(type);
+ is_vlstr = H5Tis_variable_str(type);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.indent_level++;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sStringType Cset=\"",xmlnsprefix);
+
+ if (cset == H5T_CSET_ASCII)
+ h5tools_str_append(&buffer, "H5T_CSET_ASCII\" ");
+ else
+ h5tools_str_append(&buffer, "unknown_cset\" ");
+
+ if(is_vlstr)
+ h5tools_str_append(&buffer, "StrSize=\"H5T_VARIABLE\" StrPad=\"");
+ else
+ h5tools_str_append(&buffer, "StrSize=\"%d\" StrPad=\"", (int) size);
+
+ 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\"/>");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.indent_level--;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
+
+ case H5T_BITFIELD:
+ /* <hdf5:BitfieldType ByteOrder="bo" Size="bytes"/> */
+ ord = H5Tget_order(type);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.indent_level++;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sBitfieldType ByteOrder=\"",xmlnsprefix);
+
+ switch (ord) {
+ case H5T_ORDER_LE:
+ h5tools_str_append(&buffer, "LE");
+ break;
+ case H5T_ORDER_BE:
+ h5tools_str_append(&buffer, "BE");
+ break;
+ case H5T_ORDER_VAX:
+ case H5T_ORDER_MIXED:
+ case H5T_ORDER_NONE:
+ case H5T_ORDER_ERROR:
+ default:
+ h5tools_str_append(&buffer, "ERROR_UNKNOWN");
+ } /* end switch */
+
+ size = H5Tget_size(type);
+ h5tools_str_append(&buffer, "\" Size=\"%lu\"/>", (unsigned long)size);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.indent_level--;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
+
+ case H5T_OPAQUE:
+ /* <hdf5:OpaqueType Tag="tag" Size="bytes" /> */
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.indent_level++;
+ mname = H5Tget_tag(type);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sOpaqueType Tag=\"%s\" ",xmlnsprefix, mname);
+ H5free_memory(mname);
+ size = H5Tget_size(type);
+ h5tools_str_append(&buffer, "Size=\"%lu\"/>", (unsigned long)size);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.indent_level--;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
+
+ case H5T_COMPOUND:
+ /* recursively describe the components of a compound datatype */
+
+ /* type of a dataset */
+ nmembers = (unsigned)H5Tget_nmembers(type);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sCompoundType>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ /* List each member Field of the type */
+ /* <hdf5:Field FieldName="name" > */
+ /* <hdf5:DataType > */
+ ctx.indent_level++;
+ dump_indent += COL;
+ for (i = 0; i < nmembers; i++) {
+ char *t_fname;
+
+ mname = H5Tget_member_name(type, i);
+ mtype = H5Tget_member_type(type, i);
+ t_fname = xml_escape_the_name(mname);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sField FieldName=\"%s\">",xmlnsprefix, t_fname);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ H5free_memory(mname);
+ HDfree(t_fname);
+ dump_indent += COL;
+ ctx.indent_level++;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sDataType>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.indent_level++;
+ dump_indent += COL;
+ xml_print_datatype(mtype,0);
+ dump_indent -= COL;
+ ctx.indent_level--;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sDataType>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ dump_indent -= COL;
+ ctx.indent_level--;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sField>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
+ dump_indent -= COL;
+ ctx.indent_level--;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sCompoundType>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
+
+ case H5T_REFERENCE:
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.indent_level++;
+ /* Only Object references supported at this time */
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sReferenceType>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.indent_level++;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sObjectReferenceType />",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.indent_level--;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sReferenceType>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.indent_level--;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
+
+ case H5T_ENUM:
+ /* <hdf5:EnumType Nelems="ne" > list Name, values of enum */
+ nmembs = H5Tget_nmembers(type);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ dump_indent += COL;
+ ctx.indent_level++;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sEnumType Nelems=\"%d\">",xmlnsprefix, nmembs);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ xml_print_enum(type);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sEnumType>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ dump_indent -= COL;
+ ctx.indent_level--;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
+
+ case H5T_VLEN:
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sVLType>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ super = H5Tget_super(type);
+ dump_indent += COL;
+ ctx.indent_level++;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sDataType>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ dump_indent += COL;
+ ctx.indent_level++;
+ xml_print_datatype(super,0);
+ dump_indent -= COL;
+ ctx.indent_level--;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sDataType>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ dump_indent -= COL;
+ ctx.indent_level--;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sVLType>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ H5Tclose(super);
+
+ break;
+
+ case H5T_ARRAY:
+ /* Get array base type */
+ super = H5Tget_super(type);
+
+ /* Print lead-in */
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sArrayType Ndims=\"",xmlnsprefix);
+ ndims = (unsigned)H5Tget_array_ndims(type);
+ h5tools_str_append(&buffer, "%u\">", ndims);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ /* Get array information */
+ H5Tget_array_dims2(type, dims);
+
+ /* list of dimensions */
+ ctx.indent_level++;
+ for (i = 0; i < ndims; i++) {
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sArrayDimension DimSize=\"%u\"/>", xmlnsprefix, (int) dims[i]);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
+ ctx.indent_level--;
+
+ dump_indent += COL;
+ ctx.indent_level++;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sDataType>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ dump_indent += COL;
+ ctx.indent_level++;
+ xml_print_datatype(super,0);
+ dump_indent -= COL;
+ ctx.indent_level--;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sDataType>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ dump_indent -= COL;
+ ctx.indent_level--;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sArrayType>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ /* Close array base type */
+ H5Tclose(super);
+ break;
+
+ case H5T_NO_CLASS:
+ case H5T_NCLASSES:
+ HDassert(0);
+ /* fall through */
+ default:
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<!-- unknown datatype -->");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_setstatus(EXIT_FAILURE);
+ break;
+ }
+ } /* end else */
+
+ h5tools_str_close(&buffer);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: xml_dump_datatype
+ *
+ * Purpose: Dump description of a datatype in XML.
+ *
+ * Return: void
+ *
+ * Programmer: REMcG
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+xml_dump_datatype(hid_t type)
+{
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t *outputformat = &xml_dataformat;
+ h5tool_format_t string_dataformat;
+ hsize_t curr_pos = 0; /* total data element position */
+
+ /* setup */
+ HDmemset(&buffer, 0, sizeof(h5tools_str_t));
+
+ HDmemset(&ctx, 0, sizeof(ctx));
+ ctx.indent_level = dump_indent / COL;
+ ctx.cur_column = dump_indent;
+
+ string_dataformat = *outputformat;
+
+ if (fp_format) {
+ string_dataformat.fmt_double = fp_format;
+ string_dataformat.fmt_float = fp_format;
+ }
+
+ if (h5tools_nCols == 0) {
+ string_dataformat.line_ncols = 65535;
+ string_dataformat.line_per_line = 1;
+ }
+ else
+ string_dataformat.line_ncols = h5tools_nCols;
+
+ string_dataformat.do_escape = display_escape;
+ outputformat = &string_dataformat;
+
+ ctx.indent_level++;
+ dump_indent += COL;
+
+ if(H5Tcommitted(type) > 0) {
+ H5O_info_t oinfo;
+ obj_t *found_obj; /* Found object */
+
+ /* Datatype is a shared or named datatype */
+ H5Oget_info(type, &oinfo);
+ found_obj = search_obj(type_table, oinfo.addr);
+
+ if(found_obj) {
+ /* Shared datatype, must be entered as an object */
+ /* These 2 cases are the same now, but may change */
+ char *dtxid = (char *)HDmalloc((size_t)100);
+
+ xml_name_to_XID(found_obj->objname, dtxid, 100, 1);
+ if (!found_obj->recorded) {
+ /* anonymous stored datatype:
+ following the dumper's current
+ practice:
+ use it's object ref as its name
+ */
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sNamedDataTypePtr OBJ-XID=\"%s\"/>",
+ xmlnsprefix, dtxid);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
+ else {
+ /* pointer to a named datatype already in XML */
+ char *t_objname = xml_escape_the_name(found_obj->objname);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sNamedDataTypePtr OBJ-XID=\"%s\" H5Path=\"%s\" />",
+ xmlnsprefix, dtxid, t_objname);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ HDfree(t_objname);
+ }
+ HDfree(dtxid);
+ }
+ else {
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<!-- h5dump error: unknown committed type. -->");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
+ }
+ else {
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sDataType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.indent_level++;
+ dump_indent += COL;
+ xml_print_datatype(type, 0);
+ ctx.indent_level--;
+ dump_indent -= COL;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sDataType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
+ ctx.indent_level--;
+ dump_indent -= COL;
+
+ h5tools_str_close(&buffer);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: xml_dump_dataspace
+ *
+ * Purpose: Dump description of a dataspace in XML.
+ *
+ * Return: void
+ *
+ * Programmer: REMcG
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+xml_dump_dataspace(hid_t space)
+{
+ hsize_t size[H5DUMP_MAX_RANK];
+ hsize_t maxsize[H5DUMP_MAX_RANK];
+ int i;
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t *outputformat = &xml_dataformat;
+ h5tool_format_t string_dataformat;
+ hsize_t curr_pos = 0; /* total data element position */
+
+ int ndims = H5Sget_simple_extent_dims(space, size, maxsize);
+ H5S_class_t space_type = H5Sget_simple_extent_type(space);
+
+ /* setup */
+ HDmemset(&buffer, 0, sizeof(h5tools_str_t));
+
+ HDmemset(&ctx, 0, sizeof(ctx));
+ ctx.indent_level = dump_indent / COL;
+ ctx.cur_column = dump_indent;
+
+ string_dataformat = *outputformat;
+
+ if (fp_format) {
+ string_dataformat.fmt_double = fp_format;
+ string_dataformat.fmt_float = fp_format;
+ }
+
+ if (h5tools_nCols == 0) {
+ string_dataformat.line_ncols = 65535;
+ string_dataformat.line_per_line = 1;
+ }
+ else
+ string_dataformat.line_ncols = h5tools_nCols;
+
+ string_dataformat.do_escape = display_escape;
+ outputformat = &string_dataformat;
+
+ ctx.indent_level++;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sDataspace>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.indent_level++;
+
+ switch (space_type) {
+ case H5S_SCALAR:
+ /* scalar dataspace (just a tag, no XML attrs. defined */
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sScalarDataspace />",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
+
+ case H5S_SIMPLE:
+ /* simple dataspace */
+ /* <hdf5:SimpleDataspace Ndims="nd"> */
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sSimpleDataspace Ndims=\"%d\">",xmlnsprefix, ndims);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ /* print the <hdf5:Dimension> elements */
+ ctx.indent_level++;
+ for (i = 0; i < ndims; i++) {
+ if (maxsize[i] == H5S_UNLIMITED) {
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sDimension DimSize=\"%" H5_PRINTF_LL_WIDTH "u\" MaxDimSize=\"UNLIMITED\"/>",
+ xmlnsprefix,size[i]);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
+ else if (maxsize[i] == (hsize_t) 0) {
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sDimension DimSize=\"%" H5_PRINTF_LL_WIDTH "u\" MaxDimSize=\"%" H5_PRINTF_LL_WIDTH "u\"/>",
+ xmlnsprefix,size[i], size[i]);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
+ else {
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sDimension DimSize=\"%" H5_PRINTF_LL_WIDTH "u\" MaxDimSize=\"%" H5_PRINTF_LL_WIDTH "u\"/>",
+ xmlnsprefix, size[i], maxsize[i]);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
+ }
+ ctx.indent_level--;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sSimpleDataspace>", xmlnsprefix );
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
+
+#ifdef TMP
+ /* Commented out: wait until the schema is updated first */
+ case H5S_NULL:
+ /* null dataspace (just a tag, no XML attrs. defined */
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sNullDataspace />",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
+#endif /* TMP */
+
+ case H5S_NULL:
+ case H5S_NO_CLASS:
+ default:
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<!-- unknown dataspace -->");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
+
+ ctx.indent_level--;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sDataspace>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.indent_level--;
+
+ h5tools_str_close(&buffer);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: xml_dump_data
+ *
+ * Purpose: Dump description of data in XML.
+ * Note that this calls the h5dump_xxx calls in
+ * the h5tools library.
+ *
+ * Return: void
+ *
+ * Programmer: REMcG
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED * sset, int H5_ATTR_UNUSED pindex)
+{
+ hid_t space = -1;
+ hid_t type = -1;
+ hid_t p_type = -1;
+ hsize_t size[64];
+ hsize_t nelmts = 1;
+ int ndims;
+ int i;
+ int status = -1;
+ void *buf = NULL;
+ hsize_t curr_pos = 0; /* total data element position */
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t *outputformat = &xml_dataformat;
+ h5tool_format_t string_dataformat;
+
+ HDmemset(&ctx, 0, sizeof(ctx));
+ ctx.indent_level = dump_indent / COL;
+ ctx.cur_column = dump_indent;
+
+ /* Print all the values. */
+ /* setup */
+ HDmemset(&buffer, 0, sizeof(h5tools_str_t));
+
+ string_dataformat = *outputformat;
+
+ if (fp_format) {
+ string_dataformat.fmt_double = fp_format;
+ string_dataformat.fmt_float = fp_format;
+ }
+
+ if (h5tools_nCols == 0) {
+ string_dataformat.line_ncols = 65535;
+ string_dataformat.line_per_line = 1;
+ }
+ else
+ string_dataformat.line_ncols = h5tools_nCols;
+ string_dataformat.cmpd_sep = " ";
+ string_dataformat.cmpd_pre = "";
+ string_dataformat.cmpd_suf = "";
+ string_dataformat.cmpd_end = "";
+ string_dataformat.arr_linebreak = 0;
+ string_dataformat.arr_pre = "";
+ outputformat = &string_dataformat;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.indent_level++;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.indent_level--;
+
+ dump_indent += COL;
+ ctx.indent_level++;
+
+ if (obj_data == DATASET_DATA) {
+ type = H5Dget_type(obj_id);
+ if (H5Tget_class(type) == H5T_REFERENCE)
+ status = xml_print_refs(obj_id, DATASET_DATA);
+ else if (H5Tget_class(type) == H5T_STRING)
+ status = xml_print_strs(obj_id, DATASET_DATA);
+ else {
+ h5tools_context_t datactx;
+ HDmemset(&datactx, 0, sizeof(datactx));
+ datactx.need_prefix = TRUE;
+ datactx.indent_level = ctx.indent_level;
+ datactx.cur_column = ctx.cur_column;
+ status = h5tools_dump_dset(rawoutstream, outputformat, &datactx, obj_id, NULL);
+ }
+ }
+ else {
+ /* Attribute data */
+ type = H5Aget_type(obj_id);
+
+ if (H5Tget_class(type) == H5T_REFERENCE) {
+ /* references are done differently than
+ the standard output:
+ XML dumps a path to the object
+ referenced.
+ */
+ status = xml_print_refs(obj_id, ATTRIBUTE_DATA);
+ H5Tclose(type);
+ }
+ else if (H5Tget_class(type) == H5T_STRING) {
+ status = xml_print_strs(obj_id, ATTRIBUTE_DATA);
+ }
+ else { /* all other data */
+ /* VL data special information */
+ unsigned int vl_data = 0; /* contains VL datatypes */
+
+ p_type = h5tools_get_native_type(type);
+
+ /* Check if we have VL data in the dataset's datatype */
+ if (h5tools_detect_vlen(p_type) == TRUE)
+ vl_data = TRUE;
+
+ H5Tclose(type);
+
+ space = H5Aget_space(obj_id);
+
+ ndims = H5Sget_simple_extent_dims(space, size, NULL);
+
+ for (i = 0; i < ndims; i++)
+ nelmts *= size[i];
+
+ buf = HDmalloc((size_t)(nelmts * MAX(H5Tget_size(type), H5Tget_size(p_type))));
+ HDassert(buf);
+
+ if (H5Aread(obj_id, p_type, buf) >= 0) {
+ h5tools_context_t datactx;
+ HDmemset(&datactx, 0, sizeof(datactx));
+ datactx.need_prefix = TRUE;
+ datactx.indent_level = ctx.indent_level;
+ datactx.cur_column = ctx.cur_column;
+ status = h5tools_dump_mem(rawoutstream, outputformat, &datactx, obj_id, p_type, space, buf);
+ }
+ /* Reclaim any VL memory, if necessary */
+ if (vl_data)
+ H5Dvlen_reclaim(p_type, space, H5P_DEFAULT, buf);
+
+ HDfree(buf);
+ H5Tclose(p_type);
+ H5Sclose(space);
+ H5Tclose(type);
+ }
+ }
+
+ if (status == FAIL) {
+ ctx.indent_level++;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "Unable to print data.");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.indent_level--;
+
+ status = 1;
+ }
+ ctx.indent_level--;
+ dump_indent -= COL;
+
+ ctx.indent_level++;
+
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sDataFromFile>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.indent_level--;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sData>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ h5tools_str_close(&buffer);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: xml_dump_attr
+ *
+ * Purpose: Dump a description of an HDF5 attribute in XML.
+ *
+ * Return: herr_t
+ *
+ * Programmer: REMcG
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *info,
+ void H5_ATTR_UNUSED * op_data)
+{
+ hid_t attr_id = -1;
+ hid_t type = -1;
+ hid_t space = -1;
+ H5S_class_t space_type;
+ hsize_t curr_pos = 0; /* total data element position */
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t *outputformat = &xml_dataformat;
+ h5tool_format_t string_dataformat;
+
+ char *t_aname = xml_escape_the_name(attr_name);
+
+ /* setup */
+ HDmemset(&buffer, 0, sizeof(h5tools_str_t));
+
+ HDmemset(&ctx, 0, sizeof(ctx));
+ ctx.indent_level = dump_indent / COL;
+ ctx.cur_column = dump_indent;
+
+ string_dataformat = *outputformat;
+
+ if (fp_format) {
+ string_dataformat.fmt_double = fp_format;
+ string_dataformat.fmt_float = fp_format;
+ }
+
+ if (h5tools_nCols == 0) {
+ string_dataformat.line_ncols = 65535;
+ string_dataformat.line_per_line = 1;
+ }
+ else
+ string_dataformat.line_ncols = h5tools_nCols;
+
+ string_dataformat.do_escape = display_escape;
+ outputformat = &string_dataformat;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sAttribute Name=\"%s\">", xmlnsprefix, t_aname);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ HDfree(t_aname);
+
+ if ((attr_id = H5Aopen(attr, attr_name, H5P_DEFAULT)) >= 0) {
+ type = H5Aget_type(attr_id);
+ space = H5Aget_space(attr_id);
+ space_type = H5Sget_simple_extent_type(space);
+
+ dump_function_table->dump_dataspace_function(space);
+ dump_function_table->dump_datatype_function(type);
+
+ ctx.indent_level++;
+ dump_indent += COL;
+
+ if (display_attr_data && space_type != H5S_NULL) {
+ switch (H5Tget_class(type)) {
+ case H5T_INTEGER:
+ case H5T_FLOAT:
+ case H5T_STRING:
+ case H5T_BITFIELD:
+ case H5T_OPAQUE:
+ case H5T_ENUM:
+ case H5T_ARRAY:
+ dump_function_table->dump_data_function(attr_id, ATTRIBUTE_DATA, NULL, 0);
+ break;
+
+ case H5T_TIME:
+ ctx.indent_level++;
+ dump_indent += COL;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<!-- Time data not yet implemented. -->");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<hdf5:Data>");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sData>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.indent_level--;
+ dump_indent -= COL;
+ break;
+
+ case H5T_COMPOUND:
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<!-- Note: format of compound data not specified -->");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ dump_function_table->dump_data_function(attr_id, ATTRIBUTE_DATA, NULL, 0);
+ break;
+
+ case H5T_REFERENCE:
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ if (!H5Tequal(type, H5T_STD_REF_OBJ)) {
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<!-- Note: Region references not supported -->");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
+ else {
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ xml_print_refs(attr_id, ATTRIBUTE_DATA);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sData>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
+
+ case H5T_VLEN:
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<!-- Note: format of VL data not specified -->");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ dump_function_table->dump_data_function(attr_id, ATTRIBUTE_DATA, NULL, 0);
+ break;
+ case H5T_NO_CLASS:
+ case H5T_NCLASSES:
+ HDassert(0);
+ /* fall through */
+ default:
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<!-- Unknown datatype: %d -->", H5Tget_class(type));
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sData>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
+ }
+ }
+ else {
+ /* The case of an attribute never yet written ??
+ * Or dataspace is H5S_NULL. */
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.indent_level++;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.indent_level--;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sData>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
+ ctx.indent_level--;
+ dump_indent -= COL;
+
+ H5Tclose(type);
+ H5Sclose(space);
+ H5Aclose(attr_id);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sAttribute>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ h5tools_str_close(&buffer);
+ return SUCCEED;
+ }
+ else {
+ /* ?? failed */
+ ctx.indent_level++;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<!-- h5dump error: unable to open attribute. -->");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.indent_level--;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sAttribute>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ h5tools_str_close(&buffer);
+
+ h5tools_setstatus(EXIT_FAILURE);
+ return FAIL;
+ }
+}
+
+/*-------------------------------------------------------------------------
+ * Function: xml_dump_named_datatype
+ *
+ * Purpose: Dump a description of an HDF5 NDT in XML.
+ *
+ * Return: herr_t
+ *
+ * Programmer: REMcG
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+xml_dump_named_datatype(hid_t type, const char *name)
+{
+ hsize_t curr_pos = 0; /* total data element position */
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t *outputformat = &xml_dataformat;
+ h5tool_format_t string_dataformat;
+ char *tmp;
+ char *dtxid;
+ char *parentxid;
+ char *t_tmp;
+ char *t_prefix;
+ char *t_name;
+
+ tmp = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2);
+ HDstrcpy(tmp, prefix);
+ HDstrcat(tmp, "/");
+ HDstrcat(tmp, name);
+
+ /* setup */
+ HDmemset(&buffer, 0, sizeof(h5tools_str_t));
+
+ HDmemset(&ctx, 0, sizeof(ctx));
+ ctx.indent_level = dump_indent / COL;
+ ctx.cur_column = dump_indent;
+
+ string_dataformat = *outputformat;
+
+ if (fp_format) {
+ string_dataformat.fmt_double = fp_format;
+ string_dataformat.fmt_float = fp_format;
+ }
+
+ if (h5tools_nCols == 0) {
+ string_dataformat.line_ncols = 65535;
+ string_dataformat.line_per_line = 1;
+ }
+ else
+ string_dataformat.line_ncols = h5tools_nCols;
+
+ string_dataformat.do_escape = display_escape;
+ outputformat = &string_dataformat;
+
+ dtxid = (char *)HDmalloc((size_t)100);
+ parentxid = (char *)HDmalloc((size_t)100);
+ t_tmp = xml_escape_the_name(tmp);
+ t_prefix = xml_escape_the_name(prefix);
+ t_name = xml_escape_the_name(name);
+
+ xml_name_to_XID(tmp, dtxid, 100, 1);
+ xml_name_to_XID(prefix, parentxid, 100, 1);
+ if(HDstrncmp(name, "#", (size_t)1) == 0) {
+ /* Special: this is an 'anonymous' NDT, deleted but
+ still in use.
+ We follow the dumper's undocumented practice, and
+ use its object id as its name.
+ Exactly the same as normal, but a separate case
+ in the event we want to do something else in
+ the future.
+ */
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sNamedDataType Name=\"%s\" OBJ-XID=\"%s\" "
+ "Parents=\"%s\" H5ParentPaths=\"%s\">",
+ xmlnsprefix,
+ name, dtxid,
+ parentxid, HDstrcmp(prefix,"") ? t_prefix : "/");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
+ else {
+ H5O_info_t oinfo; /* Object info */
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sNamedDataType Name=\"%s\" OBJ-XID=\"%s\" "
+ "H5Path=\"%s\" Parents=\"%s\" H5ParentPaths=\"%s\">",
+ xmlnsprefix,
+ t_name, dtxid,
+ t_tmp, parentxid, (HDstrcmp(prefix, "") ? t_prefix : "/"));
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ /* Check uniqueness of named datatype */
+ H5Oget_info(type, &oinfo);
+ if(oinfo.rc > 1) {
+ obj_t *found_obj; /* Found object */
+
+ /* Group with more than one link to it... */
+ found_obj = search_obj(type_table, oinfo.addr);
+
+ if (found_obj == NULL) {
+ indentation(dump_indent);
+ error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__);
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
+ }
+ else if(found_obj->displayed) {
+ /* We have already printed this named datatype, print it as a
+ * NamedDatatypePtr
+ */
+ char pointerxid[100];
+ char *t_objname = xml_escape_the_name(found_obj->objname);
+
+ ctx.indent_level++;
+
+ xml_name_to_XID(found_obj->objname, pointerxid, (int)sizeof(pointerxid), 1);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sNamedDatatypePtr OBJ-XID=\"%s\" H5Path=\"%s\"/>", xmlnsprefix, pointerxid, t_objname);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.indent_level--;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sNamedDataType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ HDfree(t_objname);
+ goto done;
+ }
+ else
+ found_obj->displayed = TRUE;
+ }
+ }
+
+ ctx.indent_level++;
+ dump_indent += COL;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sDataType>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.indent_level++;
+ dump_indent += COL;
+ xml_print_datatype(type,1);
+ ctx.indent_level--;
+ dump_indent -= COL;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sDataType>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.indent_level--;
+ dump_indent -= COL;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sNamedDataType>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+done:
+
+ h5tools_str_close(&buffer);
+
+ HDfree(dtxid);
+ HDfree(parentxid);
+ HDfree(t_tmp);
+ HDfree(t_prefix);
+ HDfree(t_name);
+ HDfree(tmp);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: xml_dump_group
+ *
+ * Purpose: Dump a description of an HDF5 Group (and its members) in XML.
+ *
+ * Return: void
+ *
+ * Programmer: REMcG
+ *
+ * Modifications:
+ * Pedro Vicente, October 9, 2007
+ * added parameters to H5A(L)iterate to allow for other iteration orders
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+xml_dump_group(hid_t gid, const char *name)
+{
+ H5O_info_t oinfo;
+ hid_t gcpl_id;
+ hid_t dset, type;
+ unsigned crt_order_flags;
+ unsigned attr_crt_order_flags;
+ int isRoot = 0;
+ char type_name[1024];
+ char *t_objname = NULL;
+ char *par_name = NULL;
+ char *cp = NULL;
+ char *tmp = NULL;
+ char *par = NULL;
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t *outputformat = &xml_dataformat;
+ h5tool_format_t string_dataformat;
+ hsize_t curr_pos = 0; /* total data element position */
+
+ if ((gcpl_id = H5Gget_create_plist(gid)) < 0) {
+ error_msg("error in getting group creation property list ID\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ }
+
+ /* query the group creation properties for attributes */
+ if (H5Pget_attr_creation_order(gcpl_id, &attr_crt_order_flags) < 0) {
+ error_msg("error in getting group creation properties\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ }
+
+ /* query the group creation properties */
+ if(H5Pget_link_creation_order(gcpl_id, &crt_order_flags) < 0) {
+ error_msg("error in getting group creation properties\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ }
+
+ if(H5Pclose(gcpl_id) < 0) {
+ error_msg("error in closing group creation property list ID\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ }
+
+ /* setup */
+ HDmemset(&buffer, 0, sizeof(h5tools_str_t));
+
+ HDmemset(&ctx, 0, sizeof(ctx));
+ ctx.indent_level = dump_indent / COL;
+ ctx.cur_column = dump_indent;
+
+ string_dataformat = *outputformat;
+
+ if (fp_format) {
+ string_dataformat.fmt_double = fp_format;
+ string_dataformat.fmt_float = fp_format;
+ }
+
+ if (h5tools_nCols == 0) {
+ string_dataformat.line_ncols = 65535;
+ string_dataformat.line_per_line = 1;
+ }
+ else
+ string_dataformat.line_ncols = h5tools_nCols;
+
+ string_dataformat.do_escape = display_escape;
+ outputformat = &string_dataformat;
+
+ if(HDstrcmp(name, "/") == 0) {
+ isRoot = 1;
+ tmp = HDstrdup("/");
+ }
+ else {
+ tmp = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2);
+ HDstrcpy(tmp, prefix);
+ par = HDstrdup(tmp);
+ cp = HDstrrchr(par, '/');
+ if(cp) {
+ if((cp == par) && HDstrlen(par) > 1)
+ *(cp + 1) = '\0';
+ else
+ *cp = '\0';
+ }
+ }
+
+ H5Oget_info(gid, &oinfo);
+
+ if(oinfo.rc > 1) {
+ obj_t *found_obj; /* Found object */
+
+ /* Group with more than one link to it... */
+ found_obj = search_obj(group_table, oinfo.addr);
+
+ if (found_obj == NULL) {
+ indentation(dump_indent);
+ error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__);
+ h5tools_setstatus(EXIT_FAILURE);
+ }
+ else {
+ char *t_name = xml_escape_the_name(name);
+ char *grpxid = (char *)HDmalloc((size_t)100);
+ char *parentxid = (char *)HDmalloc((size_t)100);
+
+ if(found_obj->displayed) {
+ char *ptrstr = (char *)HDmalloc((size_t)100);
+
+ /* already seen: enter a groupptr */
+ if(isRoot) {
+ /* probably can't happen! */
+ xml_name_to_XID("/", grpxid, 100, 1);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sRootGroup OBJ-XID=\"%s\" H5Path=\"%s\">",
+ xmlnsprefix, grpxid, "/");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
+ else {
+ t_objname = xml_escape_the_name(found_obj->objname);
+ par_name = xml_escape_the_name(par);
+ xml_name_to_XID(tmp, grpxid, 100, 1);
+ xml_name_to_XID(par, parentxid, 100, 1);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sGroup Name=\"%s\" OBJ-XID=\"%s-%d\" H5Path=\"%s\" "
+ "Parents=\"%s\" H5ParentPaths=\"%s\">",
+ xmlnsprefix,t_name, grpxid, get_next_xid(),
+ t_objname, parentxid, par_name);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ HDfree(t_objname);
+ HDfree(par_name);
+
+ ctx.indent_level++;
+
+ t_objname = xml_escape_the_name(found_obj->objname);/* point to the NDT by name */
+ par_name = xml_escape_the_name(par);
+ xml_name_to_XID(found_obj->objname, ptrstr, 100, 1);
+ xml_name_to_XID(par, parentxid, 100, 1);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sGroupPtr OBJ-XID=\"%s\" H5Path=\"%s\" "
+ "Parents=\"%s\" H5ParentPaths=\"%s\" />",
+ xmlnsprefix,
+ ptrstr, t_objname, parentxid, par_name);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.indent_level--;
+
+ HDfree(t_objname);
+ HDfree(par_name);
+ }
+ HDfree(ptrstr);
+ }
+ else {
+
+ /* first time this group has been seen -- describe it */
+ if(isRoot) {
+ xml_name_to_XID("/", grpxid, 100, 1);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sRootGroup OBJ-XID=\"%s\" H5Path=\"%s\">",
+ xmlnsprefix, grpxid, "/");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
+ else {
+ char *t_tmp = xml_escape_the_name(tmp);
+
+ par_name = xml_escape_the_name(par);
+ xml_name_to_XID(tmp, grpxid, 100, 1);
+ xml_name_to_XID(par, parentxid, 100, 1);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sGroup Name=\"%s\" OBJ-XID=\"%s\" H5Path=\"%s\" "
+ "Parents=\"%s\" H5ParentPaths=\"%s\" >",
+ xmlnsprefix,t_name, grpxid, t_tmp, parentxid, par_name);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ HDfree(t_tmp);
+ HDfree(par_name);
+ }
+ found_obj->displayed = TRUE;
+
+ /* 1. do all the attributes of the group */
+
+ ctx.indent_level++;
+ dump_indent += COL;
+
+ if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) {
+ if(H5Aiterate2(gid, sort_by, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) {
+ error_msg("error getting attribute information\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ } /* end if */
+ } /* end if */
+ else {
+ if(H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) {
+ error_msg("error getting attribute information\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ } /* end if */
+ } /* end else */
+
+ if(isRoot && unamedtype) {
+ unsigned u;
+
+ /* Very special case: dump unamed type in root group */
+ for(u = 0; u < type_table->nobjs; u++) {
+ if(!type_table->objs[u].recorded) {
+ dset = H5Dopen2(gid, type_table->objs[u].objname, H5P_DEFAULT);
+ type = H5Dget_type(dset);
+ sprintf(type_name, "#"H5_PRINTF_HADDR_FMT, type_table->objs[u].objno);
+ dump_function_table->dump_named_datatype_function(type, type_name);
+ H5Tclose(type);
+ H5Dclose(dset);
+ }
+ }
+ }
+
+ /* iterate through all the links */
+
+ if((sort_by == H5_INDEX_CRT_ORDER) && (crt_order_flags & H5P_CRT_ORDER_TRACKED))
+ H5Literate(gid, sort_by, sort_order, NULL, xml_dump_all_cb, NULL);
+ else
+ H5Literate(gid, H5_INDEX_NAME, sort_order, NULL, xml_dump_all_cb, NULL);
+
+ dump_indent -= COL;
+ ctx.indent_level--;
+ }
+ HDfree(t_name);
+ HDfree(grpxid);
+ HDfree(parentxid);
+ }
+ }
+ else {
+ /* only link -- must be first time! */
+ char *t_name = xml_escape_the_name(name);
+ char *grpxid = (char *)HDmalloc((size_t)100);
+ char *parentxid = (char *)HDmalloc((size_t)100);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+
+ if(isRoot) {
+ xml_name_to_XID("/", grpxid, 100, 1);
+ h5tools_str_append(&buffer, "<%sRootGroup OBJ-XID=\"%s\" H5Path=\"%s\">", xmlnsprefix, grpxid, "/");
+ }
+ else {
+ char *t_tmp = xml_escape_the_name(tmp);
+
+ par_name = xml_escape_the_name(par);
+ xml_name_to_XID(tmp, grpxid, 100, 1);
+ xml_name_to_XID(par, parentxid, 100, 1);
+ h5tools_str_append(&buffer, "<%sGroup Name=\"%s\" OBJ-XID=\"%s\" H5Path=\"%s\" "
+ "Parents=\"%s\" H5ParentPaths=\"%s\" >",
+ xmlnsprefix, t_name, grpxid, t_tmp, parentxid, par_name);
+ HDfree(t_tmp);
+ HDfree(par_name);
+ }
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ HDfree(t_name);
+ HDfree(grpxid);
+ HDfree(parentxid);
+
+ /* 1. do all the attributes of the group */
+
+ ctx.indent_level++;
+ dump_indent += COL;
+
+ if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) {
+ if(H5Aiterate2(gid, sort_by, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) {
+ error_msg("error getting attribute information\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ } /* end if */
+ } /* end if */
+ else {
+ if(H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) {
+ error_msg("error getting attribute information\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ } /* end if */
+ } /* end else */
+
+ if(isRoot && unamedtype) {
+ unsigned u;
+
+ /* Very special case: dump unamed type in root group */
+ for(u = 0; u < type_table->nobjs; u++) {
+ if(!type_table->objs[u].recorded) {
+ dset = H5Dopen2(gid, type_table->objs[u].objname, H5P_DEFAULT);
+ type = H5Dget_type(dset);
+ sprintf(type_name, "#"H5_PRINTF_HADDR_FMT, type_table->objs[u].objno);
+ dump_function_table->dump_named_datatype_function(type, type_name);
+ H5Tclose(type);
+ H5Dclose(dset);
+ }
+ }
+ }
+
+ /* iterate through all the links */
+
+ if((sort_by == H5_INDEX_CRT_ORDER) && (crt_order_flags & H5P_CRT_ORDER_TRACKED))
+ H5Literate(gid, sort_by, sort_order, NULL, xml_dump_all_cb, NULL);
+ else
+ H5Literate(gid, H5_INDEX_NAME, sort_order, NULL, xml_dump_all_cb, NULL);
+
+ dump_indent -= COL;
+ ctx.indent_level--;
+ }
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ if(isRoot)
+ h5tools_str_append(&buffer, "</%sRootGroup>", xmlnsprefix);
+ else
+ h5tools_str_append(&buffer, "</%sGroup>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ h5tools_str_close(&buffer);
+
+ if(par)
+ HDfree(par);
+ if(tmp)
+ HDfree(tmp);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: xml_print_refs
+ *
+ * Purpose: Print a path to the objects referenced by HDF5 Referneces.
+ *
+ * Return: void
+ *
+ * Programmer: REMcG
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+xml_print_refs(hid_t did, int source)
+{
+ herr_t e;
+ hid_t type = -1;
+ hid_t space = -1;
+ hssize_t ssiz = -1;
+ hsize_t i;
+ size_t tsiz;
+ hobj_ref_t *refbuf = NULL;
+ char *buf = NULL;
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t *outputformat = &xml_dataformat;
+ h5tool_format_t string_dataformat;
+ hsize_t curr_pos = 0; /* total data element position */
+
+ if (source == DATASET_DATA) {
+ type = H5Dget_type(did);
+ }
+ else if (source == ATTRIBUTE_DATA) {
+ type = H5Aget_type(did);
+ }
+ else {
+ /* return an error */
+ return FAIL;
+ }
+ if (H5Tget_class(type) != H5T_REFERENCE) {
+ /* return an error */
+ goto error;
+ }
+ if (!H5Tequal(type, H5T_STD_REF_OBJ)) {
+ /* region ref not supported yet... */
+ /* return an error */
+ goto error;
+ }
+ if (source == DATASET_DATA) {
+ space = H5Dget_space(did);
+ if ((ssiz = H5Sget_simple_extent_npoints(space)) < 0)
+ goto error;
+ if ((tsiz = H5Tget_size(type)) == 0)
+ goto error;
+
+ buf = (char *) HDcalloc((size_t)ssiz, tsiz);
+ if (buf == NULL)
+ goto error;
+ e = H5Dread(did, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
+ /* need to check result here */
+ if (e < 0)
+ goto error;
+ }
+ else if (source == ATTRIBUTE_DATA) {
+ space = H5Aget_space(did);
+ if ((ssiz = H5Sget_simple_extent_npoints(space)) < 0)
+ goto error;
+ if ((tsiz = H5Tget_size(type)) == 0)
+ goto error;
+
+ buf = (char *) HDcalloc((size_t)ssiz, tsiz);
+ if (buf == NULL)
+ goto error;
+ e = H5Aread(did, H5T_STD_REF_OBJ, buf);
+ /* need to check the result here */
+ if (e < 0)
+ goto error;
+ }
+
+ refbuf = (hobj_ref_t *) buf;
+
+ /* setup */
+ HDmemset(&buffer, 0, sizeof(h5tools_str_t));
+
+ HDmemset(&ctx, 0, sizeof(ctx));
+ ctx.indent_level = dump_indent / COL;
+ ctx.cur_column = dump_indent;
+
+ string_dataformat = *outputformat;
+
+ if (fp_format) {
+ string_dataformat.fmt_double = fp_format;
+ string_dataformat.fmt_float = fp_format;
+ }
+
+ if (h5tools_nCols == 0) {
+ string_dataformat.line_ncols = 65535;
+ string_dataformat.line_per_line = 1;
+ }
+ else
+ string_dataformat.line_ncols = h5tools_nCols;
+
+ string_dataformat.do_escape = display_escape;
+ outputformat = &string_dataformat;
+
+ for (i = 0; i < (hsize_t)ssiz; i++) {
+ const char *path = lookup_ref_path(*refbuf);
+ ctx.indent_level++;
+
+ if (!path) {
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "\"%s\"", "NULL");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
+ else {
+ char *t_path = xml_escape_the_string(path, -1);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "\"%s\"", t_path);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ HDfree(t_path);
+ }
+ ctx.indent_level--;
+
+ refbuf++;
+ }
+
+ h5tools_str_close(&buffer);
+
+ HDfree(buf);
+ H5Tclose(type);
+ H5Sclose(space);
+ return SUCCEED;
+
+error:
+ if(buf)
+ HDfree(buf);
+
+ H5E_BEGIN_TRY {
+ H5Tclose(type);
+ H5Sclose(space);
+ } H5E_END_TRY;
+ return FAIL;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: xml_print_strs
+ *
+ * Purpose: Print strings.
+ *
+ * Return: void
+ *
+ * Programmer: REMcG
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+xml_print_strs(hid_t did, int source)
+{
+ herr_t e;
+ hid_t type = -1;
+ hid_t space = -1;
+ hssize_t ssiz = -1;
+ htri_t is_vlstr = FALSE;
+ size_t tsiz = 0;
+ hsize_t i;
+ size_t str_size = 0;
+ char *bp = NULL;
+ char *onestring = NULL;
+ void *buf = NULL;
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t *outputformat = &xml_dataformat;
+ h5tool_format_t string_dataformat;
+ hsize_t curr_pos = 0; /* total data element position */
+
+ if (source == DATASET_DATA)
+ type = H5Dget_type(did);
+ else if (source == ATTRIBUTE_DATA)
+ type = H5Aget_type(did);
+ else
+ /* return an error */
+ return FAIL;
+ if (H5Tget_class(type) != H5T_STRING)
+ /* return an error */
+ goto error;
+ /* Check if we have VL data in the dataset's datatype */
+ is_vlstr = H5Tis_variable_str(type);
+
+ if (source == DATASET_DATA) {
+ space = H5Dget_space(did);
+ if((ssiz = H5Sget_simple_extent_npoints(space)) < 0)
+ goto error;
+ if((tsiz = H5Tget_size(type)) == 0)
+ goto error;
+
+ buf = HDmalloc((size_t)ssiz * tsiz);
+ if (buf == NULL)
+ goto error;
+
+ e = H5Dread(did, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
+ if (e < 0)
+ goto error;
+ }
+ else if (source == ATTRIBUTE_DATA) {
+ space = H5Aget_space(did);
+ if((ssiz = H5Sget_simple_extent_npoints(space)) < 0)
+ goto error;
+ if((tsiz = H5Tget_size(type)) == 0)
+ goto error;
+
+ buf = HDmalloc((size_t)ssiz * tsiz);
+ if (buf == NULL)
+ goto error;
+
+ e = H5Aread(did, type, buf);
+ if (e < 0)
+ goto error;
+ }
+
+ bp = (char*) buf;
+ if (!is_vlstr)
+ onestring = (char *) HDcalloc(tsiz, sizeof(char));
+
+ /* setup */
+ HDmemset(&buffer, 0, sizeof(h5tools_str_t));
+
+ HDmemset(&ctx, 0, sizeof(ctx));
+ ctx.indent_level = dump_indent / COL;
+ ctx.cur_column = dump_indent;
+
+ string_dataformat = *outputformat;
+
+ if (fp_format) {
+ string_dataformat.fmt_double = fp_format;
+ string_dataformat.fmt_float = fp_format;
+ }
+
+ if (h5tools_nCols == 0) {
+ string_dataformat.line_ncols = 65535;
+ string_dataformat.line_per_line = 1;
+ }
+ else
+ string_dataformat.line_ncols = h5tools_nCols;
+
+ string_dataformat.do_escape = display_escape;
+ outputformat = &string_dataformat;
+
+ for (i = 0; i < (hsize_t)ssiz; i++) {
+ if (is_vlstr) {
+ onestring = *(char **) bp;
+ if (onestring)
+ str_size = HDstrlen(onestring);
+ }
+ else {
+ HDstrncpy(onestring, bp, tsiz);
+ str_size = tsiz;
+ }
+
+ if (!onestring) {
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "NULL");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
+ else {
+ char *t_onestring = xml_escape_the_string(onestring, (int)str_size);
+ if (t_onestring) {
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "\"%s\"", t_onestring);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ HDfree(t_onestring);
+ }
+ }
+ bp += tsiz;
+ }
+
+ h5tools_str_close(&buffer);
+
+ /* Reclaim any VL memory, if necessary */
+ if (!is_vlstr)
+ if (onestring)
+ HDfree(onestring);
+ if (buf) {
+ if (is_vlstr)
+ H5Dvlen_reclaim(type, space, H5P_DEFAULT, buf);
+ HDfree(buf);
+ }
+ H5Tclose(type);
+ H5Sclose(space);
+ return SUCCEED;
+
+error:
+ if(buf)
+ HDfree(buf);
+
+ H5E_BEGIN_TRY {
+ H5Tclose(type);
+ H5Sclose(space);
+ } H5E_END_TRY;
+ return FAIL;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: check_filters
+ *
+ * Purpose: private function to check for the filters and
+ * put tags in the XML.
+ *
+ * Return: void
+ *
+ * Programmer: REMcG
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+check_filters(hid_t dcpl)
+{
+ int nfilt;
+ int i;
+ H5Z_filter_t filter;
+ char namebuf[120];
+ size_t cd_nelmts = 20;
+ unsigned int cd_values[20];
+ unsigned int flags;
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t *outputformat = &xml_dataformat;
+ h5tool_format_t string_dataformat;
+ hsize_t curr_pos = 0; /* total data element position */
+
+ /* setup */
+ HDmemset(&buffer, 0, sizeof(h5tools_str_t));
+
+ HDmemset(&ctx, 0, sizeof(ctx));
+ ctx.indent_level = dump_indent / COL;
+ ctx.cur_column = dump_indent;
+
+ string_dataformat = *outputformat;
+
+ if (fp_format) {
+ string_dataformat.fmt_double = fp_format;
+ string_dataformat.fmt_float = fp_format;
+ }
+
+ if (h5tools_nCols == 0) {
+ string_dataformat.line_ncols = 65535;
+ string_dataformat.line_per_line = 1;
+ }
+ else
+ string_dataformat.line_ncols = h5tools_nCols;
+
+ string_dataformat.do_escape = display_escape;
+ outputformat = &string_dataformat;
+
+ nfilt = H5Pget_nfilters(dcpl);
+ if (nfilt <= 0)
+ return;
+ for (i = 0; i < nfilt; i++) {
+ filter = H5Pget_filter2(dcpl, (unsigned) i, &flags, (size_t *) &cd_nelmts, cd_values, (size_t)120, namebuf, NULL);
+ if (filter == H5Z_FILTER_DEFLATE) {
+ ctx.indent_level++;
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sDeflate Level=\"", xmlnsprefix);
+ if (cd_nelmts < 1) {
+ /* not sure what this means? */
+ h5tools_str_append(&buffer, "6");
+ }
+ else {
+ h5tools_str_append(&buffer, "%d", cd_values[0]);
+ }
+ h5tools_str_append(&buffer, "\"/>");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.indent_level--;
+ }
+ else if (filter == H5Z_FILTER_FLETCHER32) {
+ ctx.indent_level++;
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sFletcher32 />", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.indent_level--;
+ }
+ else if (filter == H5Z_FILTER_SHUFFLE) {
+ ctx.indent_level++;
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sShuffle />", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.indent_level--;
+ }
+ else if (filter == H5Z_FILTER_SZIP) {
+ ctx.indent_level++;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sSZIP ", xmlnsprefix);
+ if (cd_nelmts < 2) {
+ /* no pixels ? */
+ h5tools_str_append(&buffer, "Pixels_per_block=\"-1\" ");
+ }
+ else {
+ h5tools_str_append(&buffer, "Pixels_per_block=\"%d\" ", cd_values[1]);
+ }
+ /* analyse the options mask */
+ if (cd_values[0] & H5_SZIP_CHIP_OPTION_MASK) {
+ h5tools_str_append(&buffer, "Mode =\"Hardware\" ");
+ }
+ else if (cd_values[0] & H5_SZIP_ALLOW_K13_OPTION_MASK) {
+ h5tools_str_append(&buffer, "Mode =\"K13\" ");
+ }
+ h5tools_str_append(&buffer, "Coding=\"");
+ if (cd_values[0] & H5_SZIP_EC_OPTION_MASK) {
+ h5tools_str_append(&buffer, "Entropy");
+ }
+ else if (cd_values[0] & H5_SZIP_NN_OPTION_MASK) {
+ h5tools_str_append(&buffer, "NN");
+ }
+ h5tools_str_append(&buffer, "\" ");
+
+ h5tools_str_append(&buffer, "ByteOrder=\"");
+ if (cd_values[0] & H5_SZIP_LSB_OPTION_MASK) {
+ h5tools_str_append(&buffer, "LSB");
+ }
+ else if (cd_values[0] & H5_SZIP_MSB_OPTION_MASK) {
+ h5tools_str_append(&buffer, "MSB");
+ }
+ h5tools_str_append(&buffer, "\" ");
+
+ if (cd_values[0] & H5_SZIP_RAW_OPTION_MASK) {
+ h5tools_str_append(&buffer, "Header=\"Raw\"");
+ }
+ h5tools_str_append(&buffer, "/>");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.indent_level--;
+ }
+ else {
+ /* unknown option */
+ }
+ }
+
+ h5tools_str_close(&buffer);
+}
+
+static void
+xml_dump_fill_value(hid_t dcpl, hid_t type)
+{
+ size_t sz;
+ size_t i;
+ hsize_t space;
+ void *buf;
+ char *name;
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t *outputformat = &xml_dataformat;
+ h5tool_format_t string_dataformat;
+ hsize_t curr_pos = 0; /* total data element position */
+
+ /* setup */
+ HDmemset(&buffer, 0, sizeof(h5tools_str_t));
+
+ HDmemset(&ctx, 0, sizeof(ctx));
+ ctx.indent_level = dump_indent / COL;
+ ctx.cur_column = dump_indent;
+
+ string_dataformat = *outputformat;
+
+ if (fp_format) {
+ string_dataformat.fmt_double = fp_format;
+ string_dataformat.fmt_float = fp_format;
+ }
+
+ if (h5tools_nCols == 0) {
+ string_dataformat.line_ncols = 65535;
+ string_dataformat.line_per_line = 1;
+ }
+ else
+ string_dataformat.line_ncols = h5tools_nCols;
+
+ string_dataformat.do_escape = display_escape;
+ outputformat = &string_dataformat;
+
+ ctx.indent_level++;
+ dump_indent += COL;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.indent_level++;
+ dump_indent += COL;
+
+ space = H5Tget_size(type);
+ buf = HDmalloc((size_t) space);
+
+ H5Pget_fill_value(dcpl, type, buf);
+
+ if (H5Tget_class(type) == H5T_REFERENCE) {
+ const char * path = lookup_ref_path(*(hobj_ref_t *) buf);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ if (!path) {
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "\"%s\"", "NULL");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
+ else {
+ char *t_path = xml_escape_the_string(path, -1);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "\"%s\"", t_path);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ HDfree(t_path);
+ }
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
+ else if (H5Tget_class(type) == H5T_STRING) {
+ /* ????? */
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<!-- String fill values not yet implemented. -->");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
+ else {
+ /* all other data */
+ switch (H5Tget_class(type)) {
+ case H5T_INTEGER:
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "\"%d\"", *(int *) buf);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
+ case H5T_FLOAT:
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "\"%f\"", (double)*(float *)buf);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
+ case H5T_BITFIELD:
+ case H5T_OPAQUE:
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ sz = H5Tget_size(type);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "\"");
+ for (i = 0; i < sz; i++) {
+ h5tools_str_append(&buffer, "%x ", *(unsigned int *) buf);
+ buf = (char *) buf + sizeof(unsigned int);
+ }
+ h5tools_str_append(&buffer, "\"");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
+ case H5T_ENUM:
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ name = H5Tget_member_name(type, *(unsigned *) buf);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "\"%s\"", name);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ if(name)
+ H5free_memory(name);
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
+ case H5T_ARRAY:
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<!-- Array fill values not yet implemented. -->");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
+ case H5T_TIME:
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<!-- Time fill not yet implemented. -->");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
+ case H5T_COMPOUND:
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<!-- Compound fill not yet implemented. -->");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
+ case H5T_VLEN:
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<!-- VL fill not yet implemented. -->");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
+ case H5T_NO_CLASS:
+ case H5T_NCLASSES:
+ HDassert(0);
+ /* fall through */
+ case H5T_STRING:
+ case H5T_REFERENCE:
+ default:
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<!-- Unknown fill datatype: %d -->", H5Tget_class(type));
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
+ }
+ }
+ HDfree(buf);
+ ctx.indent_level--;
+ dump_indent -= COL;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sData>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.indent_level--;
+ dump_indent -= COL;
+
+ h5tools_str_close(&buffer);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: xml_dump_dataset
+ *
+ * Purpose: Dump a description of an HDF5 dataset in XML.
+ *
+ * Return: void
+ *
+ * Programmer: REMcG
+ *
+ * Modifications:
+ * Pedro Vicente, October 9, 2007
+ * added parameters to H5Aiterate2 to allow for other iteration orders
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * sset)
+{
+ hid_t type;
+ hid_t space;
+ hid_t dcpl;
+ H5D_fill_value_t fvstatus;
+ int maxdims;
+ hsize_t *chsize;
+ int ndims;
+ int i;
+ H5D_alloc_time_t at;
+ H5D_fill_time_t ft;
+ hsize_t tempi;
+ char *tmp;
+ char *t_name;
+ char *t_tmp;
+ char *t_prefix;
+ unsigned attr_crt_order_flags;
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t *outputformat = &xml_dataformat;
+ h5tool_format_t string_dataformat;
+ hsize_t curr_pos = 0; /* total data element position */
+
+ char *rstr = (char*) HDmalloc((size_t)100);
+ char *pstr = (char*) HDmalloc((size_t)100);
+
+ tmp = (char*) HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2);
+ HDstrcpy(tmp, prefix);
+ HDstrcat(tmp, "/");
+ HDstrcat(tmp, name);
+
+ /* setup */
+ HDmemset(&buffer, 0, sizeof(h5tools_str_t));
+
+ HDmemset(&ctx, 0, sizeof(ctx));
+ ctx.indent_level = dump_indent / COL;
+ ctx.cur_column = dump_indent;
+
+ t_name = xml_escape_the_name(name);
+ t_tmp = xml_escape_the_name(tmp);
+ t_prefix = xml_escape_the_name(prefix);
+
+ string_dataformat = *outputformat;
+
+ if (fp_format) {
+ string_dataformat.fmt_double = fp_format;
+ string_dataformat.fmt_float = fp_format;
+ }
+
+ if (h5tools_nCols == 0) {
+ string_dataformat.line_ncols = 65535;
+ string_dataformat.line_per_line = 1;
+ }
+ else
+ string_dataformat.line_ncols = h5tools_nCols;
+
+ string_dataformat.do_escape = display_escape;
+ outputformat = &string_dataformat;
+
+ xml_name_to_XID(tmp, rstr, 100, 1);
+ xml_name_to_XID(prefix, pstr, 100, 1);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sDataset Name=\"%s\" OBJ-XID=\"%s\" H5Path= \"%s\" Parents=\"%s\" H5ParentPaths=\"%s\">",
+ xmlnsprefix, t_name, rstr, t_tmp, pstr,
+ strcmp(prefix, "") ? t_prefix : "/");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ HDfree(t_name);
+ HDfree(t_tmp);
+ HDfree(t_prefix);
+ HDfree(rstr);
+ HDfree(pstr);
+ HDfree(tmp);
+
+ dcpl = H5Dget_create_plist(did);
+ type = H5Dget_type(did);
+ space = H5Dget_space(did);
+
+ /* query the creation properties for attributes */
+ H5Pget_attr_creation_order(dcpl, &attr_crt_order_flags);
+
+ /* Print information about storage layout */
+ if (H5D_CHUNKED == H5Pget_layout(dcpl)) {
+ maxdims = H5Sget_simple_extent_ndims(space);
+ HDassert(maxdims >= 0);
+ chsize = (hsize_t *)HDmalloc((size_t)maxdims * sizeof(hsize_t));
+ ctx.indent_level++;
+ dump_indent += COL;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sStorageLayout>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.indent_level++;
+ dump_indent += COL;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sChunkedLayout ", xmlnsprefix);
+ ndims = H5Pget_chunk(dcpl, maxdims, chsize);
+ h5tools_str_append(&buffer, "Ndims=\"%d\">", ndims);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.indent_level++;
+ dump_indent += COL;
+
+ for (i = 0; i < ndims; i++) {
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sChunkDimension DimSize=\"%" H5_PRINTF_LL_WIDTH "u\" />", xmlnsprefix, chsize[i]);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sRequiredFilter>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.indent_level++;
+ dump_indent += COL;
+ check_filters(dcpl);
+ ctx.indent_level--;
+ dump_indent -= COL;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sRequiredFilter>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.indent_level--;
+ dump_indent -= COL;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sChunkedLayout>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.indent_level--;
+ dump_indent -= COL;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sStorageLayout>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.indent_level--;
+ dump_indent -= COL;
+ HDfree(chsize);
+ }
+ else if (H5D_CONTIGUOUS == H5Pget_layout(dcpl)) {
+ ctx.indent_level++;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sStorageLayout>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.indent_level++;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sContiguousLayout/>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.indent_level--;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sStorageLayout>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.indent_level--;
+ }
+ else if (H5D_COMPACT == H5Pget_layout(dcpl)) {
+ ctx.indent_level++;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sStorageLayout>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.indent_level++;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sCompactLayout/>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.indent_level--;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sStorageLayout>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.indent_level--;
+ }
+ /* and check for external.... ?? */
+
+ /* fill value */
+
+ ctx.indent_level++;
+ dump_indent += COL;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sFillValueInfo ", xmlnsprefix);
+ H5Pget_fill_time(dcpl, &ft);
+ h5tools_str_append(&buffer, "FillTime=\"");
+ switch (ft) {
+ case H5D_FILL_TIME_ALLOC:
+ h5tools_str_append(&buffer, "FillOnAlloc");
+ break;
+ case H5D_FILL_TIME_NEVER:
+ h5tools_str_append(&buffer, "FillNever");
+ break;
+ case H5D_FILL_TIME_IFSET:
+ h5tools_str_append(&buffer, "FillIfSet");
+ break;
+ case H5D_FILL_TIME_ERROR:
+ HDassert(0);
+ /* fall through */
+ default:
+ h5tools_str_append(&buffer, "?");
+ break;
+ } /* end switch */
+ h5tools_str_append(&buffer, "\" ");
+ H5Pget_alloc_time(dcpl, &at);
+ h5tools_str_append(&buffer, "AllocationTime=\"");
+ switch (at) {
+ case H5D_ALLOC_TIME_EARLY:
+ h5tools_str_append(&buffer, "Early");
+ break;
+ case H5D_ALLOC_TIME_INCR:
+ h5tools_str_append(&buffer, "Incremental");
+ break;
+ case H5D_ALLOC_TIME_LATE:
+ h5tools_str_append(&buffer, "Late");
+ break;
+ case H5D_ALLOC_TIME_DEFAULT:
+ case H5D_ALLOC_TIME_ERROR:
+ HDassert(0);
+ /* fall through */
+ default:
+ h5tools_str_append(&buffer, "?");
+ break;
+ } /* end switch */
+ h5tools_str_append(&buffer, "\"");
+ h5tools_str_append(&buffer, ">");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.indent_level++;
+ dump_indent += COL;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sFillValue>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ H5Pfill_value_defined(dcpl, &fvstatus);
+ if (fvstatus == H5D_FILL_VALUE_UNDEFINED || (fvstatus == H5D_FILL_VALUE_DEFAULT && ft == H5D_FILL_TIME_IFSET)) {
+ ctx.indent_level++;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sNoFill/>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.indent_level--;
+ }
+ else {
+ xml_dump_fill_value(dcpl, type);
+ }
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sFillValue>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.indent_level--;
+ dump_indent -= COL;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sFillValueInfo>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.indent_level--;
+ dump_indent -= COL;
+
+ dump_function_table->dump_dataspace_function(space);
+ dump_function_table->dump_datatype_function(type);
+
+ ctx.indent_level++;
+ dump_indent += COL;
+
+ if ((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) {
+ if (H5Aiterate2(did, sort_by, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) {
+ error_msg("error getting attribute information\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ } /* end if */
+ } /* end if */
+ else {
+ if (H5Aiterate2(did, H5_INDEX_NAME, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) {
+ error_msg("error getting attribute information\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ } /* end if */
+ } /* end else */
+
+ ctx.indent_level--;
+ dump_indent -= COL;
+ tempi = H5Dget_storage_size(did);
+
+ if (display_data && (tempi > 0)) {
+ switch (H5Tget_class(type)) {
+ case H5T_INTEGER:
+ case H5T_FLOAT:
+ case H5T_STRING:
+ case H5T_BITFIELD:
+ case H5T_OPAQUE:
+ case H5T_ENUM:
+ case H5T_ARRAY:
+ ctx.indent_level++;
+ dump_indent += COL;
+ dump_function_table->dump_data_function(did, DATASET_DATA, NULL, 0);
+ ctx.indent_level--;
+ dump_indent -= COL;
+ break;
+
+ case H5T_TIME:
+ ctx.indent_level++;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<!-- Time data not yet implemented. -->");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.indent_level--;
+ break;
+
+ case H5T_COMPOUND:
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<!-- Note: format of compound data not specified -->");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.indent_level++;
+ dump_indent += COL;
+ dump_function_table->dump_data_function(did, DATASET_DATA, NULL, 0);
+ ctx.indent_level--;
+ dump_indent -= COL;
+ break;
+
+ case H5T_REFERENCE:
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ if (!H5Tequal(type, H5T_STD_REF_OBJ)) {
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<!-- Note: Region references not supported -->");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
+ else {
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ xml_print_refs(did, DATASET_DATA);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sData>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
+
+ case H5T_VLEN:
+ ctx.indent_level--;
+ dump_indent -= COL;
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<!-- Note: format of VL data not specified -->");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.indent_level++;
+ dump_indent += COL;
+
+ ctx.indent_level++;
+ dump_indent += COL;
+ dump_function_table->dump_data_function(did, DATASET_DATA, NULL, 0);
+ ctx.indent_level--;
+ dump_indent -= COL;
+ break;
+ case H5T_NO_CLASS:
+ case H5T_NCLASSES:
+ HDassert(0);
+ /* fall through */
+
+ default:
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<!-- Unknown datatype: %d -->", H5Tget_class(type));
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sData>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
+ }
+ }
+ else {
+ /* no data written */
+ ctx.indent_level++;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.indent_level++;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.indent_level--;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sData>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.indent_level--;
+ }
+
+ H5Tclose(type);
+ H5Sclose(space);
+ H5Pclose(dcpl);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sDataset>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ h5tools_str_close(&buffer);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: xml_print_enum
+ *
+ * Purpose: Print the values of an HDF5 ENUM in XML.
+ * Very similar to regular DDL output.
+ *
+ * Return: void
+ *
+ * Programmer: REMcG
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+xml_print_enum(hid_t type)
+{
+ char **name = NULL; /*member names */
+ unsigned char *value = NULL; /*value array */
+ unsigned nmembs; /*number of members */
+ hid_t super; /*enum base integer type */
+ hid_t native = -1; /*native integer datatype */
+ size_t dst_size; /*destination value type size */
+ unsigned i; /*miscellaneous counters */
+ size_t j;
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t *outputformat = &xml_dataformat;
+ h5tool_format_t string_dataformat;
+ hsize_t curr_pos = 0; /* total data element position */
+
+ /* setup */
+ HDmemset(&buffer, 0, sizeof(h5tools_str_t));
+
+ HDmemset(&ctx, 0, sizeof(ctx));
+ ctx.indent_level = dump_indent / COL;
+ ctx.cur_column = dump_indent;
+
+ string_dataformat = *outputformat;
+
+ if (fp_format) {
+ string_dataformat.fmt_double = fp_format;
+ string_dataformat.fmt_float = fp_format;
+ }
+
+ if (h5tools_nCols == 0) {
+ string_dataformat.line_ncols = 65535;
+ string_dataformat.line_per_line = 1;
+ }
+ else
+ string_dataformat.line_ncols = h5tools_nCols;
+
+ string_dataformat.do_escape = display_escape;
+ outputformat = &string_dataformat;
+
+ nmembs = (unsigned)H5Tget_nmembers(type);
+ super = H5Tget_super(type);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sDataType>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ xml_print_datatype(super,0);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sDataType>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ /*
+ * Determine what datatype to use for the native values. To simplify
+ * things we entertain three possibilities:
+ * 1. long long -- the largest native signed integer
+ * 2. unsigned long long -- the largest native unsigned integer
+ * 3. raw format
+ */
+ if (H5Tget_size(type) <= sizeof(long long)) {
+ dst_size = sizeof(long long);
+
+ if (H5T_SGN_NONE == H5Tget_sign(type)) {
+ native = H5T_NATIVE_ULLONG;
+ }
+ else {
+ native = H5T_NATIVE_LLONG;
+ }
+ }
+ else {
+ dst_size = H5Tget_size(type);
+ }
+
+ /* Get the names and raw values of all members */
+ name = (char **)HDcalloc((size_t)nmembs, sizeof(char *));
+ value = (unsigned char *)HDcalloc((size_t)nmembs, MAX(H5Tget_size(type), dst_size));
+
+ for (i = 0; i < nmembs; i++) {
+ name[i] = H5Tget_member_name(type, i);
+ H5Tget_member_value(type, i, value + i * H5Tget_size(type));
+ }
+
+ /* Convert values to native datatype */
+ if (native > 0)
+ H5Tconvert(super, native, (size_t)nmembs, value, NULL, H5P_DEFAULT);
+
+ /* Sort members by increasing value */
+ /*not implemented yet */
+
+ /* Print members */
+ ctx.indent_level++;
+ dump_indent += COL;
+ for (i = 0; i < nmembs; i++) {
+ char *t_name = xml_escape_the_name(name[i]);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sEnumElement>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.indent_level++;
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "%s", t_name);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ HDfree(t_name);
+ ctx.indent_level--;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sEnumElement>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sEnumValue>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.indent_level++;
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ if (native < 0) {
+ h5tools_str_append(&buffer, "0x");
+
+ for (j = 0; j < dst_size; j++)
+ h5tools_str_append(&buffer, "%02x", value[i * dst_size + j]);
+ }
+ else if (H5T_SGN_NONE == H5Tget_sign(native)) {
+ h5tools_str_append(&buffer,"%" H5_PRINTF_LL_WIDTH "u", *((unsigned long long *)
+ ((void *) (value + i * dst_size))));
+ }
+ else {
+ h5tools_str_append(&buffer,"%" H5_PRINTF_LL_WIDTH "d",
+ *((long long *) ((void *) (value + i * dst_size))));
+ }
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.indent_level--;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sEnumValue>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
+ ctx.indent_level--;
+ dump_indent -= COL;
+
+ h5tools_str_close(&buffer);
+
+ /* Release resources */
+ for (i = 0; i < nmembs; i++)
+ H5free_memory(name[i]);
+
+ HDfree(name);
+ HDfree(value);
+ H5Tclose(super);
+}
+
diff --git a/tools/src/h5dump/h5dump_xml.h b/tools/src/h5dump/h5dump_xml.h
new file mode 100644
index 0000000..c1d6c62
--- /dev/null
+++ b/tools/src/h5dump/h5dump_xml.h
@@ -0,0 +1,39 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#ifndef H5DUMP_XML_H__
+#define H5DUMP_XML_H__
+
+extern const char *xmlnsprefix;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* The dump functions of the dump_function_table */
+/* XML format: same interface, alternative output */
+
+void xml_dump_group(hid_t, const char *);
+void xml_dump_named_datatype(hid_t, const char *);
+void xml_dump_dataset(hid_t, const char *, struct subset_t *);
+void xml_dump_dataspace(hid_t space);
+void xml_dump_datatype(hid_t type);
+herr_t xml_dump_attr(hid_t, const char *, const H5A_info_t *, void *);
+void xml_dump_data(hid_t, int, struct subset_t *, int);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !H5DUMP_XML_H__ */
diff --git a/tools/src/h5format_convert/CMakeLists.txt b/tools/src/h5format_convert/CMakeLists.txt
new file mode 100644
index 0000000..957055d
--- /dev/null
+++ b/tools/src/h5format_convert/CMakeLists.txt
@@ -0,0 +1,39 @@
+cmake_minimum_required (VERSION 3.1.0)
+PROJECT (HDF5_TOOLS_SRC_H5FC)
+
+#-----------------------------------------------------------------------------
+# Setup include Directories
+#-----------------------------------------------------------------------------
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib)
+
+# --------------------------------------------------------------------
+# Add the h5format_convert executables
+# --------------------------------------------------------------------
+add_executable (h5format_convert ${HDF5_TOOLS_SRC_H5FC_SOURCE_DIR}/h5format_convert.c)
+TARGET_NAMING (h5format_convert STATIC)
+TARGET_C_PROPERTIES (h5format_convert STATIC " " " ")
+target_link_libraries (h5format_convert ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+set_target_properties (h5format_convert PROPERTIES FOLDER tools)
+set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5format_convert")
+
+set (H5_DEP_EXECUTABLES h5format_convert)
+
+##############################################################################
+##############################################################################
+### I N S T A L L A T I O N ###
+##############################################################################
+##############################################################################
+
+#-----------------------------------------------------------------------------
+# Rules for Installation of tools using make Install target
+#-----------------------------------------------------------------------------
+
+#INSTALL_PROGRAM_PDB (h5format_convert ${HDF5_INSTALL_BIN_DIR} toolsapplications)
+
+install (
+ TARGETS
+ h5format_convert
+ EXPORT
+ ${HDF5_EXPORTED_TARGETS}
+ RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications
+)
diff --git a/tools/src/h5format_convert/Makefile.am b/tools/src/h5format_convert/Makefile.am
new file mode 100644
index 0000000..e2d1acf
--- /dev/null
+++ b/tools/src/h5format_convert/Makefile.am
@@ -0,0 +1,35 @@
+#
+# 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.
+##
+## Makefile.am
+## Run automake to generate a Makefile.in from this file.
+#
+# HDF5 Library Makefile(.in)
+#
+
+include $(top_srcdir)/config/commence.am
+
+# Include src directory
+AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib
+
+# These are our main targets, the tools
+bin_PROGRAMS=h5format_convert
+
+# Add h5format_convert specific linker flags here
+h5format_convert_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+
+# All programs rely on hdf5 library and h5tools library
+LDADD=$(LIBH5TOOLS) $(LIBHDF5)
+
+include $(top_srcdir)/config/conclude.am
diff --git a/tools/src/h5format_convert/h5format_convert.c b/tools/src/h5format_convert/h5format_convert.c
new file mode 100644
index 0000000..8ce28dd
--- /dev/null
+++ b/tools/src/h5format_convert/h5format_convert.c
@@ -0,0 +1,474 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Programmer: Vailin Choi; Feb 2015
+ */
+
+
+/*
+ * We include the private header file so we can get to the uniform
+ * programming environment it declares.
+ * HDF5 API functions (except for H5G_basename())
+ */
+#include "H5private.h"
+#include "h5tools.h"
+#include "h5tools_utils.h"
+#include "h5trav.h"
+
+/* Name of tool */
+#define PROGRAMNAME "h5format_convert"
+
+static char *fname_g = NULL;
+static char *dname_g = NULL;
+static int dset_g = FALSE;
+static int noop_g = FALSE;
+static int verbose_g = 0;
+
+/*
+ * Command-line options: The user can specify short or long-named
+ * parameters.
+ */
+static const char *s_opts = "hVvd:n";
+static struct long_options l_opts[] = {
+ { "help", no_arg, 'h' },
+ { "hel", no_arg, 'h'},
+ { "he", no_arg, 'h'},
+ { "version", no_arg, 'V' },
+ { "version", no_arg, 'V' },
+ { "versio", no_arg, 'V' },
+ { "versi", no_arg, 'V' },
+ { "vers", no_arg, 'V' },
+ { "verbose", no_arg, 'v' },
+ { "verbos", no_arg, 'v' },
+ { "verbo", no_arg, 'v' },
+ { "verb", no_arg, 'v' },
+ { "dname", require_arg, 'd' },
+ { "dnam", require_arg, 'd' },
+ { "dna", require_arg, 'd' },
+ { "dn", require_arg, 'd' },
+ { "noop", no_arg, 'n' },
+ { "noo", no_arg, 'n' },
+ { "no", no_arg, 'n' },
+ { NULL, 0, '\0' }
+};
+
+
+/*-------------------------------------------------------------------------
+ * Function: usage
+ *
+ * Purpose: print usage
+ *
+ * Return: void
+ *
+ *-------------------------------------------------------------------------
+ */
+static void usage(const char *prog)
+{
+ HDfprintf(stdout, "usage: %s [OPTIONS] file_name\n", prog);
+ HDfprintf(stdout, " OPTIONS\n");
+ HDfprintf(stdout, " -h, --help Print a usage message and exit\n");
+ HDfprintf(stdout, " -V, --version Print version number and exit\n");
+ HDfprintf(stdout, " -v, --verbose Turn on verbose mode\n");
+ HDfprintf(stdout, " -d dname, --dname=dataset_name Pathname for the dataset\n");
+ HDfprintf(stdout, " -n, --noop Perform all the steps except the actual conversion\n");
+ HDfprintf(stdout, "\n");
+ HDfprintf(stdout, "Examples of use:\n");
+ HDfprintf(stdout, "\n");
+ HDfprintf(stdout, "h5format_convert -d /group/dataset file_name\n");
+ HDfprintf(stdout, " Convert the dataset </group/dataset> in the HDF5 file <file_name>:\n");
+ HDfprintf(stdout, " a. chunked dataset: convert the chunk indexing type to version 1 B-tree\n");
+ HDfprintf(stdout, " b. compact/contiguous dataset: downgrade the layout version to 3\n");
+ HDfprintf(stdout, " c. virtual dataset: no action\n");
+ HDfprintf(stdout, "\n");
+ HDfprintf(stdout, "h5format_convert file_name\n");
+ HDfprintf(stdout, " Convert all datasets in the HDF5 file <file_name>:\n");
+ HDfprintf(stdout, " a. chunked dataset: convert the chunk indexing type to version 1 B-tree\n");
+ HDfprintf(stdout, " b. compact/contiguous dataset: downgrade the layout version to 3\n");
+ HDfprintf(stdout, " c. virtual dataset: no action\n");
+ HDfprintf(stdout, "\n");
+ HDfprintf(stdout, "h5format_convert -n -d /group/dataset file_name\n");
+ HDfprintf(stdout, " Go through all the steps except the actual conversion when \n");
+ HDfprintf(stdout, " converting the dataset </group/dataset> in the HDF5 file <file_name>.\n");
+} /* usage() */
+
+/*-------------------------------------------------------------------------
+ * Function: parse_command_line
+ *
+ * Purpose: parse command line input
+ *
+ * Return: Success: 0
+ * Failure: 1
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+parse_command_line(int argc, const char **argv)
+{
+ int opt;
+
+ /* no arguments */
+ if (argc == 1) {
+ usage(h5tools_getprogname());
+ h5tools_setstatus(EXIT_FAILURE);
+ goto error;
+ }
+
+ /* 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);
+ goto error;
+
+ case 'V':
+ print_version(h5tools_getprogname());
+ h5tools_setstatus(EXIT_SUCCESS);
+ goto error;
+
+ case 'v':
+ verbose_g = TRUE;
+ break;
+
+ case 'd': /* -d dname */
+ if(opt_arg != NULL && *opt_arg)
+ dname_g = HDstrdup(opt_arg);
+ if(dname_g == NULL) {
+ h5tools_setstatus(EXIT_FAILURE);
+ error_msg("No dataset name\n", opt_arg);
+ usage(h5tools_getprogname());
+ goto error;
+ }
+ dset_g = TRUE;
+ break;
+
+ case 'n': /* -n */
+ noop_g = TRUE;
+ break;
+
+ default:
+ h5tools_setstatus(EXIT_FAILURE);
+ usage(h5tools_getprogname());
+ goto error;
+ break;
+ } /* switch */
+ } /* while */
+
+ if (argc <= opt_ind) {
+ error_msg("missing file name\n");
+ usage(h5tools_getprogname());
+ h5tools_setstatus(EXIT_FAILURE);
+ goto error;
+ }
+
+ fname_g = HDstrdup(argv[opt_ind]);
+
+ return(0);
+
+error:
+ return(-1); ;
+} /* parse_command_line() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: leave
+ *
+ * Purpose: Close HDF5
+ *
+ * Return: Does not return
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+leave(int ret)
+{
+ h5tools_close();
+
+ HDexit(ret);
+} /* leave() */
+
+/*-------------------------------------------------------------------------
+ * Function: convert()
+ *
+ * Purpose: To downgrade a dataset's indexing type or layout version:
+ * For chunked:
+ * Downgrade the chunk indexing type to version 1 B-tree
+ * If type is already version 1 B-tree, no further action
+ * For compact/contiguous:
+ * Downgrade the layout version from 4 to 3
+ * If version is already <= 3, no further action
+ * For virtual:
+ * No further action
+ *
+ * Return: Success: 0
+ * Failure: 1
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+convert(hid_t fid, const char *dname)
+{
+ hid_t dcpl = -1;
+ hid_t did = -1;
+ H5D_layout_t layout_type;
+ H5D_chunk_index_t idx_type;
+
+ /* Open the dataset */
+ if((did = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0) {
+ error_msg("unable to open dataset \"%s\"\n", dname);
+ h5tools_setstatus(EXIT_FAILURE);
+ goto error;
+
+ } else if(verbose_g)
+ HDfprintf(stdout, "Open the dataset\n");
+
+ /* Get the dataset's creation property list */
+ if((dcpl = H5Dget_create_plist(did)) < 0) {
+ error_msg("unable to get the dataset creation property list\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ goto error;
+ }
+
+ /* Get the dataset's layout */
+ if((layout_type = H5Pget_layout(dcpl)) < 0) {
+ error_msg("unable to get the dataset layout type\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ goto error;
+
+ } else if(verbose_g)
+ HDfprintf(stdout, "Retrieve the dataset's layout\n");
+
+ switch(layout_type) {
+ case H5D_CHUNKED:
+ if(verbose_g)
+ HDfprintf(stdout, "Dataset is a chunked dataset\n");
+
+ /* Get the dataset's chunk indexing type */
+ if(H5Dget_chunk_index_type(did, &idx_type) < 0) {
+ error_msg("unable to get the chunk indexing type for \"%s\"\n", dname);
+ h5tools_setstatus(EXIT_FAILURE);
+ goto error;
+ } else if(verbose_g)
+ HDfprintf(stdout, "Retrieve the dataset's chunk indexing type\n");
+
+ if(idx_type == H5D_CHUNK_IDX_BTREE) {
+ if(verbose_g)
+ HDfprintf(stdout, "Dataset's chunk indexing type is already version 1 B-tree: no further action\n");
+ h5tools_setstatus(EXIT_SUCCESS);
+ goto done;
+ } else if (verbose_g)
+ HDfprintf(stdout, "Dataset's chunk indexing type is not version 1 B-tree\n");
+ break;
+
+ case H5D_CONTIGUOUS:
+ if(verbose_g)
+ HDfprintf(stdout, "Dataset is a contiguous dataset: downgrade layout version as needed\n");
+ break;
+
+ case H5D_COMPACT:
+ if(verbose_g)
+ HDfprintf(stdout, "Dataset is a compact dataset: downgrade layout version as needed\n");
+ break;
+
+ case H5D_VIRTUAL:
+ if(verbose_g)
+ HDfprintf(stdout, "No further action for virtual dataset\n");
+ goto done;
+
+ case H5D_NLAYOUTS:
+ case H5D_LAYOUT_ERROR:
+ default:
+ error_msg("unknown layout type for \"%s\"\n", dname);
+ h5tools_setstatus(EXIT_FAILURE);
+ goto error;
+
+ } /* end switch */
+
+ /* No further action if it is a noop */
+ if(noop_g) {
+ if(verbose_g)
+ HDfprintf(stdout, "Not converting the dataset\n");
+ h5tools_setstatus(EXIT_SUCCESS);
+ goto done;
+ }
+
+ if(verbose_g)
+ HDfprintf(stdout, "Converting the dataset...\n");
+
+ /* Downgrade the dataset */
+ if(H5Dformat_convert(did) < 0) {
+ error_msg("unable to downgrade dataset \"%s\"\n", dname);
+ h5tools_setstatus(EXIT_FAILURE);
+ goto error;
+ } else if(verbose_g)
+ HDfprintf(stdout, "Done\n");
+
+done:
+ /* Close the dataset */
+ if(H5Dclose(did) < 0) {
+ error_msg("unable to close dataset \"%s\"\n", dname);
+ h5tools_setstatus(EXIT_FAILURE);
+ goto error;
+ } else if(verbose_g)
+ HDfprintf(stdout, "Close the dataset\n");
+
+ /* Close the dataset creation property list */
+ if(H5Pclose(dcpl) < 0) {
+ error_msg("unable to close dataset creation property list\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ goto error;
+ } else if(verbose_g)
+ printf("Close the dataset creation property list\n");
+
+ return(0);
+
+error:
+ if(verbose_g)
+ HDfprintf(stdout, "Error encountered\n");
+
+ H5E_BEGIN_TRY {
+ H5Pclose(dcpl);
+ H5Dclose(did);
+ } H5E_END_TRY;
+
+ return(-1);
+} /* convert() */
+
+/*-------------------------------------------------------------------------
+ * Function: convert_dsets_cb()
+ *
+ * Purpose: The callback routine from the traversal to convert the
+ * chunk indexing type of the dataset object.
+ *
+ * Return: Success: 0
+ * Failure: 1
+ *-------------------------------------------------------------------------
+ */
+static int
+convert_dsets_cb(const char *path, const H5O_info_t *oi, const char *already_visited, void *_fid)
+{
+ hid_t fid = *(hid_t *)_fid;
+
+ /* If the object has already been seen then just return */
+ if(NULL == already_visited) {
+ if(oi->type == H5O_TYPE_DATASET) {
+ if(verbose_g)
+ HDfprintf(stdout, "Going to process dataset:%s...\n", path);
+ if(convert(fid, path) < 0)
+ goto error;
+ } /* end if */
+ } /* end if */
+
+ return 0;
+
+error:
+ return -1;
+} /* end convert_dsets_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: main
+ *
+ * Purpose: To convert the chunk indexing type of a dataset in a file to
+ * version 1 B-tree.
+ *
+ * Return: Success: 0
+ * Failure: 1
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+main(int argc, const char *argv[])
+{
+ H5E_auto2_t func;
+ void *edata;
+ hid_t fid = -1;
+
+ h5tools_setprogname(PROGRAMNAME);
+ h5tools_setstatus(EXIT_SUCCESS);
+
+ /* Disable error reporting */
+ H5Eget_auto2(H5E_DEFAULT, &func, &edata);
+ H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
+
+ /* Initialize h5tools lib */
+ h5tools_init();
+
+ /* Parse command line options */
+ if(parse_command_line(argc, argv) < 0)
+ goto done;
+ else if(verbose_g)
+ HDfprintf(stdout, "Process command line options\n");
+
+ if(noop_g && verbose_g)
+ HDfprintf(stdout, "It is noop...\n");
+
+ /* Open the HDF5 file */
+ if((fid = h5tools_fopen(fname_g, H5F_ACC_RDWR, H5P_DEFAULT, NULL, NULL, 0)) < 0) {
+ error_msg("unable to open file \"%s\"\n", fname_g);
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
+ } else if(verbose_g)
+ HDfprintf(stdout, "Open the file %s\n", fname_g);
+
+ if(dset_g) { /* Convert a specified dataset in the file */
+ if(verbose_g)
+ HDfprintf(stdout, "Going to process dataset: %s...\n", dname_g);
+ if(convert(fid, dname_g) < 0)
+ goto done;
+ } else { /* Convert all datasets in the file */
+ if(verbose_g)
+ HDfprintf(stdout, "Processing all datasets in the file...\n");
+ if(h5trav_visit(fid, "/", TRUE, TRUE, convert_dsets_cb, NULL, &fid) < 0)
+ goto done;
+ } /* end else */
+
+ if(verbose_g) {
+ if(noop_g) {
+ HDfprintf(stdout, "Not processing the file's superblock...\n");
+ h5tools_setstatus(EXIT_SUCCESS);
+ goto done;
+ } /* end if */
+ HDfprintf(stdout, "Processing the file's superblock...\n");
+ } /* end if */
+
+ /* Process superblock */
+ if(H5Fformat_convert(fid) < 0) {
+ error_msg("unable to convert file's superblock\"%s\"\n", fname_g);
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
+ } /* end if */
+
+done:
+ /* Close the file */
+ if(fid >= 0) {
+ if(H5Fclose(fid) < 0) {
+ error_msg("unable to close file \"%s\"\n", fname_g);
+ h5tools_setstatus(EXIT_FAILURE);
+ } else if(verbose_g)
+ HDfprintf(stdout, "Close the file\n");
+ } /* end if */
+
+ if(fname_g)
+ HDfree(fname_g);
+ if(dname_g)
+ HDfree(dname_g);
+
+ H5Eset_auto2(H5E_DEFAULT, func, edata);
+ leave(h5tools_getstatus());
+
+} /* end main() */
+
diff --git a/tools/src/h5import/CMakeLists.txt b/tools/src/h5import/CMakeLists.txt
new file mode 100644
index 0000000..97ab4ec
--- /dev/null
+++ b/tools/src/h5import/CMakeLists.txt
@@ -0,0 +1,40 @@
+cmake_minimum_required (VERSION 3.1.0)
+PROJECT (HDF5_TOOLS_SRC_H5IMPORT)
+
+#-----------------------------------------------------------------------------
+# Setup include Directories
+#-----------------------------------------------------------------------------
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib)
+
+# --------------------------------------------------------------------
+# Add the h5import executables
+# --------------------------------------------------------------------
+add_executable (h5import ${HDF5_TOOLS_SRC_H5IMPORT_SOURCE_DIR}/h5import.c)
+TARGET_NAMING (h5import STATIC)
+TARGET_C_PROPERTIES (h5import STATIC " " " ")
+target_link_libraries (h5import ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+#set_target_properties (h5import PROPERTIES COMPILE_DEFINITIONS H5DEBUGIMPORT)
+set_target_properties (h5import PROPERTIES FOLDER tools)
+set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5import")
+
+set (H5_DEP_EXECUTABLES h5import)
+
+##############################################################################
+##############################################################################
+### I N S T A L L A T I O N ###
+##############################################################################
+##############################################################################
+
+#-----------------------------------------------------------------------------
+# Rules for Installation of tools using make Install target
+#-----------------------------------------------------------------------------
+
+#INSTALL_PROGRAM_PDB (h5import ${HDF5_INSTALL_BIN_DIR} toolsapplications)
+
+install (
+ TARGETS
+ h5import
+ EXPORT
+ ${HDF5_EXPORTED_TARGETS}
+ RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications
+)
diff --git a/tools/src/h5import/Makefile.am b/tools/src/h5import/Makefile.am
new file mode 100644
index 0000000..2eae9ec
--- /dev/null
+++ b/tools/src/h5import/Makefile.am
@@ -0,0 +1,35 @@
+#
+# 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.
+##
+## Makefile.am
+## Run automake to generate a Makefile.in from this file.
+#
+# HDF5 Library Makefile(.in)
+#
+
+include $(top_srcdir)/config/commence.am
+
+# Include src and tools/lib directories
+AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib
+
+# Our main targets
+bin_PROGRAMS=h5import
+
+# Add h5import specific linker flags here
+h5import_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+
+# All programs depend on the main hdf5 library and the tools library
+LDADD=$(LIBH5TOOLS) $(LIBHDF5)
+
+include $(top_srcdir)/config/conclude.am
diff --git a/tools/src/h5import/h5import.c b/tools/src/h5import/h5import.c
new file mode 100644
index 0000000..d1aab0c
--- /dev/null
+++ b/tools/src/h5import/h5import.c
@@ -0,0 +1,4393 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include "hdf5.h"
+#include "H5private.h"
+#include <stdio.h>
+#include <math.h>
+#include <string.h>
+#include <ctype.h>
+#include "h5import.h"
+#include "h5tools.h"
+#include "h5tools_utils.h"
+
+/* Name of tool */
+#define PROGRAMNAME "h5import"
+
+#ifdef H5_HAVE_WIN32_API
+#define READ_OPEN_FLAGS "rb"
+#else
+#define READ_OPEN_FLAGS "r"
+#endif
+
+/* Local function declarations */
+static int gtoken(char *s);
+static int process(struct Options *opt);
+static int processConfigurationFile(char *infile, struct Input *in);
+static int mapKeywordToIndex(char *key);
+static int parsePathInfo(struct path_info *path, char *strm);
+static int parseDimensions(struct Input *in, char *strm);
+static int getInputSize(struct Input *in, int ival);
+static int getInputClass(struct Input *in, char * strm);
+static int getInputClassType(struct Input *in, char * strm);
+static int InputClassStrToInt(char *temp);
+static int getRank(struct Input *in, FILE *strm);
+static int getDimensionSizes(struct Input *in, FILE *strm);
+static int getOutputSize(struct Input *in, FILE *strm);
+static int getOutputClass(struct Input *in, FILE *strm);
+static int OutputClassStrToInt(char *temp);
+static int getOutputArchitecture(struct Input *in, FILE *strm);
+static int OutputArchStrToInt(const char *temp);
+static int getOutputByteOrder(struct Input *in, FILE *strm);
+static int OutputByteOrderStrToInt(const char *temp);
+static int getChunkedDimensionSizes(struct Input *in, FILE *strm);
+static int getCompressionType(struct Input *in, FILE *strm);
+static int CompressionTypeStrToInt(char *temp);
+static int getCompressionParameter(struct Input *in, FILE *strm);
+static int getExternalFilename(struct Input *in, FILE *strm);
+static int getMaximumDimensionSizes(struct Input *in, FILE *strm);
+static int processDataFile(char *infile, struct Input *in, hid_t file_id);
+static int readIntegerData(FILE *strm, struct Input *in);
+static int readFloatData(FILE *strm, struct Input *in);
+static int allocateIntegerStorage(struct Input *in);
+static int allocateFloatStorage(struct Input *in);
+static int readUIntegerData(FILE *strm, struct Input *in);
+static int allocateUIntegerStorage(struct Input *in);
+static int validateConfigurationParameters(struct Input *in);
+static int processStrData(FILE *strm, struct Input *in, hid_t file_id);
+static int processStrHDFData(FILE *strm, struct Input *in, hid_t file_id);
+
+int main(int argc, char *argv[])
+{
+ struct Options opt;
+ int outfile_named = FALSE;
+ int token;
+ int i;
+ int state = 0;
+ struct Input *in = NULL;
+
+ const char *err1 = "Invalid number of arguments: %d.\n";
+ const char *err2 = "Error in state table.\n";
+ const char *err3 = "No output file given.\n";
+ const char *err4 = "Program aborted.\n";
+ const char *err5 = "Invalid path %s.\n";
+ const char *err6 = "Invalid dimensions - %s.\n";
+ const char *err7 = "Invalid type of data - %s.\n";
+ const char *err8 = "Invalid size of data - %s.\n";
+ const char *err9 = "Cannot specify more than 30 input files in one call to h5import.\n";
+
+ h5tools_setprogname(PROGRAMNAME);
+ h5tools_setstatus(EXIT_SUCCESS);
+
+ /* Initialize h5tools lib */
+ h5tools_init();
+
+ (void) HDsetvbuf(stderr, (char *) NULL, _IOLBF, 0);
+ (void) HDsetvbuf(stdout, (char *) NULL, _IOLBF, 0);
+
+ if (argv[1] && (HDstrcmp("-V", argv[1]) == 0)) {
+ print_version(PROGRAMNAME);
+ HDexit(EXIT_SUCCESS);
+ }
+
+ /*
+ * validate the number of command line arguments
+ */
+ if (argc < 2) {
+ (void) HDfprintf(stderr, err1, argc);
+ usage(argv[0]);
+ goto err;
+ }
+
+ /* Initialize the file structure to 0 */
+ HDmemset(&opt, 0, sizeof(struct Options));
+
+ /*
+ * parse the command line
+ */
+ for (i = 1; i < argc; i++) {
+ if ((token = gtoken(argv[i])) == ERR) {
+ usage(argv[0]);
+ goto err;
+ }
+
+ state = state_table[state][token];
+
+ switch (state) {
+
+ case 1: /* counting input files */
+ if (opt.fcount < 29) {
+ (void) HDstrcpy(opt.infiles[opt.fcount].datafile, argv[i]);
+ in = &(opt.infiles[opt.fcount].in);
+ opt.infiles[opt.fcount].config = 0;
+ setDefaultValues(in, opt.fcount);
+ opt.fcount++;
+ }
+ else {
+ (void) HDfprintf(stderr, err9, argv[i]);
+ goto err;
+ }
+
+ break;
+
+ case 2: /* -c found; look for configfile */
+ break;
+
+ case 3: /* get configfile name */
+ (void) HDstrcpy(opt.infiles[opt.fcount-1].configfile, argv[i]);
+ opt.infiles[opt.fcount - 1].config = 1;
+ break;
+
+ case 4: /* -o found; look for outfile */
+ break;
+
+ case 5: /* get outfile found */
+ (void) HDstrcpy(opt.outfile, argv[i]);
+ outfile_named = TRUE;
+ break;
+
+ case 6: /* -h found; help, then exit */
+ help(argv[0]);
+ HDexit(EXIT_SUCCESS);
+ break;
+
+ case 7: /* -d found; look for dimensions */
+ break;
+
+ case 8: /* read dimensions */
+ if (parseDimensions(in, argv[i]) == -1) {
+ (void) HDfprintf(stderr, err6, argv[i]);
+ goto err;
+ }
+ break;
+
+ case 9: /* -p found; look for path name */
+ break;
+
+ case 10: /* read path name */
+ if (parsePathInfo(&in->path, argv[i]) == -1) {
+ (void) HDfprintf(stderr, err5, argv[i]);
+ goto err;
+ }
+ break;
+
+ case 11: /* -t found; look for data type */
+ break;
+
+ case 12: /* read data type */
+ if (getInputClass(in, argv[i]) == -1) {
+ (void) HDfprintf(stderr, err7, argv[i]);
+ goto err;
+ }
+
+ if (in->inputClass == 0 || in->inputClass == 4)
+ in->outputClass = 0;
+ if (in->inputClass == 1 || in->inputClass == 2 || in->inputClass == 3)
+ in->outputClass = 1;
+ if (in->inputClass == 6 || in->inputClass == 7)
+ in->outputClass = 2;
+ break;
+
+ case 13: /* -s found; look for data size */
+ break;
+
+ case 14: /* read data size */
+ if (getInputSize(in, (int) HDstrtol(argv[i], NULL, BASE_10)) == -1) {
+ (void) HDfprintf(stderr, err8, argv[i]);
+ goto err;
+ }
+ /*set default value for output-size */
+ in->outputSize = in->inputSize;
+ break;
+
+ case ERR: /* command syntax error */
+ default:
+ (void) HDfprintf(stderr, "%s", err2);
+ usage(argv[0]);
+ goto err;
+ }
+ }
+
+ if (FALSE == outfile_named) {
+ (void) HDfprintf(stderr, "%s", err3);
+ usage(argv[0]);
+ goto err;
+ }
+
+ if (process(&opt) == -1)
+ goto err;
+
+ for (i = 0; i < opt.fcount; i++) {
+ in = &(opt.infiles[i].in);
+ if (in->sizeOfDimension)
+ HDfree(in->sizeOfDimension);
+ if (in->sizeOfChunk)
+ HDfree(in->sizeOfChunk);
+ if (in->maxsizeOfDimension)
+ HDfree(in->maxsizeOfDimension);
+ if (in->externFilename)
+ HDfree(in->externFilename);
+ if (in->data)
+ HDfree(in->data);
+ }
+
+ return (EXIT_SUCCESS);
+err:
+ (void) HDfprintf(stderr, "%s", err4);
+ for (i = 0; i < opt.fcount; i++) {
+ in = &(opt.infiles[i].in);
+ if (in->sizeOfDimension)
+ HDfree(in->sizeOfDimension);
+ if (in->sizeOfChunk)
+ HDfree(in->sizeOfChunk);
+ if (in->maxsizeOfDimension)
+ HDfree(in->maxsizeOfDimension);
+ if (in->externFilename)
+ HDfree(in->externFilename);
+ if (in->data)
+ HDfree(in->data);
+ }
+ return (EXIT_FAILURE);
+}
+
+static int gtoken(char *s)
+{
+ size_t len;
+ int token = ERR;
+
+ const char *err1 = "Illegal argument: %s.\n";
+
+ /*
+ * identify the token type
+ */
+ if (s[0] == '-') { /* option name (or negative number) */
+ len = HDstrlen(&s[1]);
+ switch (s[1]) {
+ case 'o':
+ if (!HDstrncmp("outfile", &s[1], len))
+ token = OPT_o;
+ break;
+
+ case 'c':
+ if (!HDstrncmp("config", &s[1], len))
+ token = OPT_c;
+ break;
+
+ case 'h':
+ if (!HDstrncmp("help", &s[1], len))
+ token = OPT_h;
+ break;
+
+ case 'd':
+ if (!HDstrncmp("dims", &s[1], len))
+ token = OPT_d;
+ break;
+
+ case 'p':
+ if (!HDstrncmp("path", &s[1], len))
+ token = OPT_p;
+ break;
+
+ case 't':
+ if (!HDstrncmp("type", &s[1], len))
+ token = OPT_t;
+ break;
+
+ case 's':
+ if (!HDstrncmp("size", &s[1], len))
+ token = OPT_s;
+ break;
+ default:
+ token = ERR; /* not a supported option tag */
+ break;
+ }
+
+ if (token == ERR)
+ (void) HDfprintf(stderr, err1, s);
+ }
+ else { /* filename */
+ token = FILNAME;
+ }
+ return (token);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: processDataFile
+ *
+ * Purpose: allocate memory and read data file
+ *
+ * Return: 0, success, -1, error
+ *
+ * Programmer: pkmat
+ *
+ * Modifications: pvn
+ * 7/23/2007. Added support for STR type, extra parameter FILE_ID
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static int processDataFile(char *infile, struct Input *in, hid_t file_id)
+{
+ FILE *strm = NULL;
+ const char *err1 = "Unable to open the input file %s for reading.\n";
+ const char *err2 = "Error in allocating integer data storage.\n";
+ const char *err3 = "Error in allocating floating-point data storage.\n";
+ const char *err4 = "Error in reading integer data.\n";
+ const char *err5 = "Error in reading floating-point data.\n";
+ const char *err6 = "Error in allocating unsigned integer data storage.\n";
+ const char *err7 = "Error in reading unsigned integer data.\n";
+ const char *err10 = "Unrecognized input class type.\n";
+ const char *err11 = "Error in reading string data.\n";
+ int retval = -1;
+
+ /*-------------------------------------------------------------------------
+ * special case for opening binary classes in H5_HAVE_WIN32_API
+ * "FP" denotes a floating point binary file,
+ * "IN" denotes a signed integer binary file,
+ * "UIN" denotes an unsigned integer binary file,
+ *-------------------------------------------------------------------------
+ */
+ if (in->inputClass == 4 /* "IN" */|| in->inputClass == 3 /* "FP" */|| in->inputClass == 7 /* "UIN" */) {
+
+ if ((strm = HDfopen(infile, READ_OPEN_FLAGS)) == NULL) {
+ (void) HDfprintf(stderr, err1, infile);
+ goto error;
+ }
+ }
+ /*-------------------------------------------------------------------------
+ * if the input class is not binary, just use "r"
+ *-------------------------------------------------------------------------
+ */
+ else {
+ if ((strm = HDfopen(infile, "r")) == NULL) {
+ (void) HDfprintf(stderr, err1, infile);
+ goto error;
+ }
+ }
+
+ switch (in->inputClass) {
+ case 0: /* TEXTIN */
+ case 4: /* IN */
+ if (allocateIntegerStorage(in) == -1) {
+ (void) HDfprintf(stderr, err2, infile);
+ goto error;
+ }
+
+ if (readIntegerData(strm, in) == -1) {
+ (void) HDfprintf(stderr, err4, infile);
+ goto error;
+ }
+ break;
+
+ case 1: /* TEXTFP */
+ case 2: /* TEXTFPE */
+ case 3: /* FP */
+ if (allocateFloatStorage(in) == -1) {
+ (void) HDfprintf(stderr, err3, infile);
+ goto error;
+
+ }
+
+ if (readFloatData(strm, in) == -1) {
+ (void) HDfprintf(stderr, err5, infile);
+ goto error;
+ }
+ break;
+
+ case 5: /* STR */
+ if (in->h5dumpInput) {
+ if (processStrHDFData(strm, in, file_id) == -1) {
+ (void) HDfprintf(stderr, err11, infile);
+ goto error;
+ }
+ }
+ else {
+ if (processStrData(strm, in, file_id) == -1) {
+ (void) HDfprintf(stderr, err11, infile);
+ goto error;
+ }
+ }
+
+ break;
+
+ case 6: /* TEXTUIN */
+ case 7: /* UIN */
+ if (allocateUIntegerStorage(in) == -1) {
+ (void) HDfprintf(stderr, err6, infile);
+ goto error;
+ }
+ if (readUIntegerData(strm, in) == -1) {
+ (void) HDfprintf(stderr, err7, infile);
+ goto error;
+ }
+ break;
+
+ default:
+ (void) HDfprintf(stderr, "%s", err10);
+ goto error;
+ }
+
+ /* Set success return value */
+ retval = 0;
+
+error:
+ if(strm)
+ HDfclose(strm);
+ return(retval);
+}
+
+static int readIntegerData(FILE *strm, struct Input *in)
+{
+ H5DT_INT8 *in08;
+ H5DT_INT16 *in16;
+ H5DT_INT16 temp;
+ H5DT_INT32 *in32;
+#ifdef H5_SIZEOF_LONG_LONG
+ H5DT_INT64 *in64;
+ char buffer[256];
+#endif
+ hsize_t len = 1;
+ hsize_t i;
+ int j;
+
+ const char *err1 = "Unable to get integer value from file.\n";
+ const char *err2 = "Unrecognized input class type.\n";
+ const char *err3 = "Invalid input size.\n";
+
+ for (j = 0; j < in->rank; j++)
+ len *= in->sizeOfDimension[j];
+
+ switch (in->inputSize) {
+ case 8:
+ switch (in->inputClass) {
+ case 0: /* TEXTIN */
+ in08 = (H5DT_INT8 *) in->data;
+ for (i = 0; i < len; i++, in08++) {
+ if (fscanf(strm, "%hd", &temp) != 1) {
+ (void) HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ (*in08) = (H5DT_INT8) temp;
+ }
+ break;
+
+ case 4: /* IN */
+ in08 = (H5DT_INT8 *) in->data;
+ for (i = 0; i < len; i++, in08++) {
+ if (HDfread((char *) in08, sizeof(H5DT_INT8), 1, strm) != 1) {
+ (void) HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ }
+ break;
+
+ default:
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ break;
+
+ case 16:
+ in16 = (H5DT_INT16 *) in->data;
+ switch (in->inputClass) {
+ case 0: /* TEXTIN */
+ for (i = 0; i < len; i++, in16++) {
+ if (fscanf(strm, "%hd", in16) != 1) {
+ (void) HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ }
+ in16 = (H5DT_INT16 *) in->data;
+ break;
+
+ case 4: /* IN */
+ for (i = 0; i < len; i++, in16++) {
+ if (HDfread((char *) in16, sizeof(H5DT_INT16), 1, strm) != 1) {
+ (void) HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ }
+ break;
+
+ default:
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ break;
+
+ case 32:
+ in32 = (H5DT_INT32 *) in->data;
+ switch (in->inputClass) {
+ case 0: /* TEXTIN */
+ for (i = 0; i < len; i++, in32++) {
+ if (fscanf(strm, "%d", in32) != 1) {
+ (void) HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ }
+ break;
+
+ case 4: /* IN */
+ for (i = 0; i < len; i++, in32++) {
+ if (HDfread((char *) in32, sizeof(H5DT_INT32), 1, strm) != 1) {
+ (void) HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ }
+ break;
+
+ default:
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ break;
+
+#ifdef H5_SIZEOF_LONG_LONG
+ case 64:
+ in64 = (H5DT_INT64 *) in->data;
+ switch (in->inputClass) {
+ case 0: /* TEXTIN */
+ for (i = 0; i < len; i++, in64++) {
+ if (fscanf(strm, "%s", buffer) < 1) {
+ (void) HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ *in64 = (H5DT_INT64) HDstrtoll(buffer, NULL, 10);
+ }
+ break;
+
+ case 4: /* IN */
+ for (i = 0; i < len; i++, in64++) {
+ if (HDfread((char *) in64, sizeof(H5DT_INT64), 1, strm) != 1) {
+ (void) HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ }
+ break;
+
+ default:
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ break;
+#endif /* ifdef H5_SIZEOF_LONG_LONG */
+
+ default:
+ (void) HDfprintf(stderr, "%s", err3);
+ break;
+ }
+ return (0);
+}
+
+static int readUIntegerData(FILE *strm, struct Input *in)
+{
+ H5DT_UINT8 *in08;
+ H5DT_UINT16 *in16;
+ H5DT_UINT16 temp;
+ H5DT_UINT32 *in32;
+#ifdef H5_SIZEOF_LONG_LONG
+ H5DT_UINT64 *in64;
+ char buffer[256];
+#endif
+ hsize_t len = 1;
+ hsize_t i;
+ int j;
+ const char *err1 = "Unable to get unsigned integer value from file.\n";
+ const char *err2 = "Unrecognized input class type.\n";
+ const char *err3 = "Invalid input size.\n";
+
+ for (j = 0; j < in->rank; j++)
+ len *= in->sizeOfDimension[j];
+
+ switch (in->inputSize) {
+ case 8:
+ switch (in->inputClass) {
+ case 6: /* TEXTUIN */
+ in08 = (H5DT_UINT8 *) in->data;
+ for (i = 0; i < len; i++, in08++) {
+ if (fscanf(strm, "%hu", &temp) != 1) {
+ (void) HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ (*in08) = (H5DT_UINT8) temp;
+ }
+ break;
+
+ case 7: /* UIN */
+ in08 = (H5DT_UINT8 *) in->data;
+ for (i = 0; i < len; i++, in08++) {
+ if (HDfread((char *) in08, sizeof(H5DT_UINT8), 1, strm) != 1) {
+ (void) HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ }
+ break;
+
+ default:
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ break;
+
+ case 16:
+ in16 = (H5DT_UINT16 *) in->data;
+ switch (in->inputClass) {
+ case 6: /* TEXTUIN */
+ for (i = 0; i < len; i++, in16++) {
+ if (fscanf(strm, "%hu", in16) != 1) {
+ (void) HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ }
+ break;
+
+ case 7: /* UIN */
+ for (i = 0; i < len; i++, in16++) {
+ if (HDfread((char *) in16, sizeof(H5DT_UINT16), 1, strm) != 1) {
+ (void) HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ }
+ break;
+
+ default:
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ break;
+
+ case 32:
+ in32 = (H5DT_UINT32 *) in->data;
+ switch (in->inputClass) {
+ case 6: /* TEXTUIN */
+ for (i = 0; i < len; i++, in32++) {
+ if (fscanf(strm, "%u", in32) != 1) {
+ (void) HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ }
+ break;
+
+ case 7: /* UIN */
+ for (i = 0; i < len; i++, in32++) {
+ if (HDfread((char *) in32, sizeof(H5DT_UINT32), 1, strm) != 1) {
+ (void) HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ }
+ break;
+
+ default:
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ break;
+
+#ifdef H5_SIZEOF_LONG_LONG
+ case 64:
+ in64 = (H5DT_UINT64 *) in->data;
+ switch (in->inputClass) {
+ case 6: /* TEXTUIN */
+ for (i = 0; i < len; i++, in64++) {
+ if (fscanf(strm, "%s", buffer) < 1) {
+ (void) HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ *in64 = (H5DT_UINT64) HDstrtoll(buffer, NULL, 10);
+ }
+ break;
+
+ case 7: /* UIN */
+ for (i = 0; i < len; i++, in64++) {
+ if (HDfread((char *) in64, sizeof(H5DT_UINT64), 1, strm) != 1) {
+ (void) HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ }
+ break;
+
+ default:
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ break;
+#endif /* ifdef H5_SIZEOF_LONG_LONG */
+
+ default:
+ (void) HDfprintf(stderr, "%s", err3);
+ break;
+ }
+ return (0);
+}
+
+static int readFloatData(FILE *strm, struct Input *in)
+{
+ H5DT_FLOAT32 *fp32;
+ H5DT_FLOAT64 *fp64;
+
+ hsize_t len = 1;
+ hsize_t i;
+ int j;
+ const char *err1 = "Unable to get integer value from file.\n";
+ const char *err2 = "Unrecognized input class type.\n";
+ const char *err3 = "Invalid input size type.\n";
+
+ for (j = 0; j < in->rank; j++)
+ len *= in->sizeOfDimension[j];
+
+ switch (in->inputSize) {
+ case 32:
+ fp32 = (H5DT_FLOAT32 *) in->data;
+ switch (in->inputClass) {
+ case 1: /* TEXTFP */
+ for (i = 0; i < len; i++, fp32++) {
+ if (fscanf(strm, "%f", fp32) != 1) {
+ (void) HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ }
+
+ fp32 = (H5DT_FLOAT32 *) in->data;
+ break;
+
+ /* same as TEXTFP */
+ case 2: /*TEXTFPE */
+
+ for (i = 0; i < len; i++, fp32++) {
+ if (fscanf(strm, "%f", fp32) != 1) {
+ (void) HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ }
+
+ fp32 = (H5DT_FLOAT32 *) in->data;
+ break;
+
+ case 3: /* FP */
+ for (i = 0; i < len; i++, fp32++) {
+ if (HDfread((char *) fp32, sizeof(H5DT_FLOAT32), 1, strm) != 1) {
+ (void) HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ }
+ break;
+
+ default:
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ break;
+
+ case 64:
+ fp64 = (H5DT_FLOAT64 *) in->data;
+ switch (in->inputClass) {
+ case 1: /* TEXTFP */
+ for (i = 0; i < len; i++, fp64++) {
+ if (fscanf(strm, "%lf", fp64) != 1) {
+ (void) HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ }
+
+ fp64 = (H5DT_FLOAT64 *) in->data;
+ break;
+
+ /* same as TEXTFP */
+ case 2: /*TEXTFPE */
+
+ for (i = 0; i < len; i++, fp64++) {
+ if (fscanf(strm, "%lf", fp64) != 1) {
+ (void) HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ }
+
+ fp64 = (H5DT_FLOAT64 *) in->data;
+ break;
+
+ case 3: /* FP */
+ for (i = 0; i < len; i++, fp64++) {
+ if (HDfread((char *) fp64, sizeof(H5DT_FLOAT64), 1, strm) != 1) {
+ (void) HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ }
+ break;
+
+ default:
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ break;
+
+ default:
+ (void) HDfprintf(stderr, "%s", err3);
+ break;
+ }
+ return (0);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: processStrData
+ *
+ * Purpose: read an ASCII file with string data and generate an HDF5 dataset
+ * with a variable length type
+ *
+ * Return: 0, ok, -1 no
+ *
+ * Programmer: Pedro Vicente, pvn@hdfgroup.org
+ *
+ * Date: July, 26, 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+static int processStrData(FILE *strm, struct Input *in, hid_t file_id)
+{
+ hid_t group_id;
+ hid_t dset_id;
+ hid_t space_id;
+ hid_t mspace_id;
+ hid_t type_id;
+ hid_t handle;
+ hsize_t dims[1];
+ char str[1024];
+ int c;
+ int i = 0;
+ int j;
+ hsize_t nlines = 0;
+ hsize_t line;
+
+ /*-------------------------------------------------------------------------
+ * get number of lines in the input file
+ *-------------------------------------------------------------------------
+ */
+
+ while(EOF != (c = HDfgetc(strm)))
+ if (c == 10) /* eol */
+ nlines++;
+
+ if (!nlines)
+ return 0;
+
+ /* number of records */
+ dims[0] = nlines;
+
+ /* rewind */
+ HDfseek(strm, 0L, 0);
+
+ /*-------------------------------------------------------------------------
+ * read file again and generate an HDF5 dataset
+ *-------------------------------------------------------------------------
+ */
+
+ if ((type_id = H5Tcopy(H5T_C_S1)) < 0)
+ goto out;
+
+ if (H5Tset_size(type_id, H5T_VARIABLE) < 0)
+ goto out;
+
+ /* disable error reporting */
+ H5E_BEGIN_TRY
+ {
+ /* create parent groups */
+ if (in->path.count > 1) {
+ j = 0;
+ handle = file_id;
+ while (j < in->path.count - 1) {
+ if ((group_id = H5Gopen2(handle, in->path.group[j], H5P_DEFAULT)) < 0) {
+ group_id = H5Gcreate2(handle, in->path.group[j++], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ for (; j < in->path.count - 1; j++)
+ group_id = H5Gcreate2(group_id, in->path.group[j], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ handle = group_id;
+ break;
+ }
+ handle = group_id;
+ j++;
+ }
+ }
+ else {
+ handle = file_id;
+ j = 0;
+ }
+
+ /*enable error reporting */
+ }
+ H5E_END_TRY;
+
+ if ((space_id = H5Screate_simple(1, dims, NULL)) < 0)
+ goto out;
+
+ if ((mspace_id = H5Screate(H5S_SCALAR)) < 0)
+ goto out;
+
+ if ((dset_id = H5Dcreate2(handle, in->path.group[j], type_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
+
+ line = 0;
+
+ while(EOF != (c = HDfgetc(strm))) {
+ str[i] = (char)c;
+
+ i++;
+
+ if (c == 10) { /* eol */
+ char *str2 = str;
+ hid_t fspace_id;
+ hsize_t start[1];
+ hsize_t count[1] = { 1 };
+
+ str[i - 1] = '\0'; /* terminate string */
+
+ if ((fspace_id = H5Dget_space(dset_id)) < 0)
+ goto out;
+
+ start[0] = line++;
+
+ if (H5Sselect_hyperslab(fspace_id, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ goto out;
+
+ if (H5Dwrite(dset_id, type_id, mspace_id, fspace_id, H5P_DEFAULT, &str2) < 0)
+ goto out;
+
+ if (H5Sclose(fspace_id) < 0)
+ goto out;
+
+ i = 0;
+ str[0] = '\0';
+
+ }
+ }
+
+ /* close */
+ H5Dclose(dset_id);
+ H5Sclose(space_id);
+ H5Sclose(mspace_id);
+ H5Tclose(type_id);
+
+ return (0);
+
+out:
+
+ return (-1);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: processStrData
+ *
+ * Purpose: read an ASCII file with string data and generate an HDF5 dataset
+ * with a variable length type
+ *
+ * Return: 0, ok, -1 no
+ *
+ *-------------------------------------------------------------------------
+ */
+static int processStrHDFData(FILE *strm, struct Input *in, hid_t file_id)
+{
+ hid_t group_id = -1;
+ hid_t dset_id = -1;
+ hid_t space_id = -1;
+ hid_t mspace_id = -1;
+ hid_t type_id = -1;
+ hid_t handle = -1;
+ char *str1 = NULL;
+ char *str2 = NULL;
+ char *str3 = NULL;
+ char str[1024] = "";
+ int j;
+ hsize_t line;
+
+ /*-------------------------------------------------------------------------
+ * read file and generate an HDF5 dataset
+ *-------------------------------------------------------------------------
+ */
+#ifdef H5DEBUGIMPORT
+ printf("processStrHDFData DATATYPE STRING\n");
+#endif
+
+ if ((type_id = H5Tcopy(H5T_C_S1)) < 0)
+ goto out;
+
+ if (H5Tset_size(type_id, H5T_VARIABLE) < 0)
+ goto out;
+
+ /* disable error reporting */
+ H5E_BEGIN_TRY
+ {
+ /* create parent groups */
+ if (in->path.count > 1) {
+ j = 0;
+ handle = file_id;
+ while (j < in->path.count - 1) {
+ if ((group_id = H5Gopen2(handle, in->path.group[j], H5P_DEFAULT)) < 0) {
+ group_id = H5Gcreate2(handle, in->path.group[j++], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ for (; j < in->path.count - 1; j++)
+ group_id = H5Gcreate2(group_id, in->path.group[j], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ handle = group_id;
+ break;
+ }
+ handle = group_id;
+ j++;
+ }
+ }
+ else {
+ handle = file_id;
+ j = 0;
+ }
+
+ /*enable error reporting */
+ }
+ H5E_END_TRY;
+#ifdef H5DEBUGIMPORT
+ printf("processStrHDFData DATATYPE STRING groups created\n");
+#endif
+
+ if ((space_id = H5Screate_simple(in->rank, in->sizeOfDimension, NULL)) < 0)
+ goto out;
+
+ if ((mspace_id = H5Screate(H5S_SCALAR)) < 0)
+ goto out;
+
+ if ((dset_id = H5Dcreate2(handle, in->path.group[j], type_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
+
+#ifdef H5DEBUGIMPORT
+ printf("processStrHDFData DATATYPE STRING ready to process strings\n");
+#endif
+ line = 0;
+ j = 0;
+
+ while (HDfgets(str,sizeof(str),strm)) {
+ str1 = str;
+ str2 = NULL;
+ str3 = NULL;
+#ifdef H5DEBUGIMPORT
+ printf("processStrHDFData DATATYPE STRING[%llu]={%s}\n", (unsigned long long)line, str1);
+#endif
+ /* process string to remove the first and last quote char */
+ str2 = strchr(str1, '"');
+ if (str2 != NULL) {
+#ifdef H5DEBUGIMPORT
+ printf("processStrHDFData DATATYPE STRING len:%d for {%s}\n", strlen(str2), str2);
+#endif
+ str2++;
+#ifdef H5DEBUGIMPORT
+ printf("processStrHDFData DATATYPE STRING len:%d for {%s}\n", strlen(str2), str2);
+#endif
+ str3 = strrchr(str2, '"');
+ if (str3 != NULL) {
+#ifdef H5DEBUGIMPORT
+ printf("processStrHDFData DATATYPE STRING len:%d for {%s}\n", strlen(str3), str3);
+#endif
+ *str3 = '\0';
+
+#ifdef H5DEBUGIMPORT
+ printf("processStrHDFData DATATYPE STRING len:%d for {%s}\n", strlen(str2), str2);
+#endif
+
+ if(strlen(str2) > 0) {
+ hid_t fspace_id;
+ hsize_t start[1];
+ hsize_t count[1] = { 1 };
+
+#ifdef H5DEBUGIMPORT
+ printf("processStrHDFData DATATYPE STRING[%llu] store %s\n", (unsigned long long)line, str2);
+#endif
+ if ((fspace_id = H5Dget_space(dset_id)) < 0)
+ goto out;
+
+ start[0] = line++;
+
+ if (H5Sselect_hyperslab(fspace_id, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ goto out;
+
+ if (H5Dwrite(dset_id, type_id, mspace_id, fspace_id, H5P_DEFAULT, &str2) < 0)
+ goto out;
+
+ if (H5Sclose(fspace_id) < 0)
+ goto out;
+ }
+ }
+ }
+ str[0] = '\0';
+ j++;
+ }
+#ifdef H5DEBUGIMPORT
+ printf("processStrHDFData DATATYPE STRING eof reached\n");
+#endif
+
+ /* close */
+ H5Dclose(dset_id);
+ H5Sclose(space_id);
+ H5Sclose(mspace_id);
+ H5Tclose(type_id);
+
+ return (0);
+
+out:
+#ifdef H5DEBUGIMPORT
+ printf("processStrHDFData DATATYPE STRING error exit\n");
+#endif
+/* disable error reporting */
+H5E_BEGIN_TRY
+{
+ /* close */
+ H5Dclose(dset_id);
+ H5Sclose(space_id);
+ H5Sclose(mspace_id);
+ H5Tclose(type_id);
+}
+H5E_END_TRY;
+
+ return (-1);
+}
+
+static int allocateIntegerStorage(struct Input *in)
+{
+ hsize_t len = 1;
+ int j;
+ const char *err1 = "Unable to allocate dynamic memory.\n";
+ const char *err2 = "Invalid storage size for integer input data.\n";
+
+ for (j = 0; j < in->rank; j++)
+ len *= in->sizeOfDimension[j];
+
+ switch (in->inputSize) {
+ case 8:
+ if ((in->data = (VOIDP) HDmalloc((size_t) len * sizeof(H5DT_INT8))) == NULL) {
+ (void) HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ break;
+
+ case 16:
+ if ((in->data = (VOIDP) HDmalloc((size_t) len * sizeof(H5DT_INT16))) == NULL) {
+ (void) HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ break;
+
+ case 32:
+ if ((in->data = (VOIDP) HDmalloc((size_t) len * sizeof(H5DT_INT32))) == NULL) {
+ (void) HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ break;
+
+ case 64:
+ if ((in->data = (VOIDP) HDmalloc((size_t) len * sizeof(H5DT_INT64))) == NULL) {
+ (void) HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ break;
+
+ default:
+ (void) HDfprintf(stderr, "%s", err2);
+ break;
+ }
+ return (0);
+}
+
+static int allocateUIntegerStorage(struct Input *in)
+{
+ hsize_t len = 1;
+ const char *err1 = "Unable to allocate dynamic memory.\n";
+ const char *err2 = "Invalid storage size for unsigned integer input data.\n";
+ int j;
+
+ for (j = 0; j < in->rank; j++)
+ len *= in->sizeOfDimension[j];
+
+ switch (in->inputSize) {
+ case 8:
+ if ((in->data = (VOIDP) HDmalloc((size_t) len * sizeof(H5DT_UINT8))) == NULL) {
+ (void) HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ break;
+
+ case 16:
+ if ((in->data = (VOIDP) HDmalloc((size_t) len * sizeof(H5DT_UINT16))) == NULL) {
+ (void) HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ break;
+
+ case 32:
+ if ((in->data = (VOIDP) HDmalloc((size_t) len * sizeof(H5DT_UINT32))) == NULL) {
+ (void) HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ break;
+
+ case 64:
+ if ((in->data = (VOIDP) HDmalloc((size_t) len * sizeof(H5DT_UINT64))) == NULL) {
+ (void) HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ break;
+
+ default:
+ (void) HDfprintf(stderr, "%s", err2);
+ break;
+ }
+ return (0);
+}
+
+static int allocateFloatStorage(struct Input *in)
+{
+ hsize_t len = 1;
+ int j;
+ const char *err1 = "Unable to allocate dynamic memory.\n";
+ const char *err2 = "Invalid storage size for float input data.\n";
+
+ for (j = 0; j < in->rank; j++)
+ len *= in->sizeOfDimension[j];
+
+ switch (in->inputSize) {
+ case 32:
+ if ((in->data = (VOIDP) HDmalloc((size_t) len * sizeof(H5DT_FLOAT32))) == NULL) {
+ (void) HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ break;
+
+ case 64:
+ if ((in->data = (VOIDP) HDmalloc((size_t) len * sizeof(H5DT_FLOAT64))) == NULL) {
+ (void) HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ break;
+
+ default:
+ (void) HDfprintf(stderr, "%s", err2);
+ break;
+ }
+ return (0);
+}
+
+static int processConfigurationFile(char *infile, struct Input *in)
+{
+ FILE *strm = NULL;
+ char key[255];
+ int kindex;
+ char temp[255];
+ int ival;
+ int scanret;
+ int retval = -1;
+
+ const char *err1 = "Unable to open the configuration file: %s for reading.\n";
+ const char *err2 = "Unknown keyword in configuration file: %s\n";
+ const char *err3a = "PATH keyword appears twice in %s.\n";
+ const char *err3b = "Error in parsing the path information from %s.\n";
+ const char *err4a = "INPUT-CLASS keyword appears twice in %s.\n";
+ const char *err4b = "Error in retrieving the input class from %s.\n";
+ const char *err5a = "INPUT-SIZE keyword appears twice in %s.\n";
+ const char *err5b = "Error in retrieving the input size from %s.\n";
+ const char *err6a = "RANK keyword appears twice in %s.\n";
+ const char *err6b = "Error in retrieving the rank from %s.\n";
+ const char *err7a = "DIMENSION-SIZES keyword appears twice in %s.\n";
+ const char *err7b = "DIMENSION-SIZES cannot appear before RANK is provided.\n";
+ const char *err7c = "Error in retrieving the dimension sizes from %s.\n";
+ const char *err8a = "OUTPUT-CLASS keyword appears twice in %s.\n";
+ const char *err8b = "Error in retrieving the output class from %s.\n";
+ const char *err9a = "OUTPUT-SIZE keyword appears twice in %s.\n";
+ const char *err9b = "Error in retrieving the output size from %s.\n";
+ const char *err10a = "OUTPUT-ARCHITECTURE keyword appears twice in %s.\n";
+ const char *err10b = "Error in retrieving the output architecture from %s.\n";
+ const char *err11a = "OUTPUT-BYTE-ORDER keyword appears twice in %s.\n";
+ const char *err11b = "Error in retrieving the output byte order from %s.\n";
+ const char *err12a = "CHUNKED-DIMENSION-SIZES keyword appears twice in %s.\n";
+ const char *err12b = "CHUNKED-DIMENSION-SIZES cannot appear before DIMENSION-SIZES are provided.\n";
+ const char *err12c = "Error in retrieving the chunked dimension sizes from %s.\n";
+ const char *err13a = "COMPRESSION-TYPE keyword appears twice in %s.\n";
+ const char *err13b = "Error in retrieving the compression type from %s.\n";
+ const char *err14a = "COMPRESSION-PARAM keyword appears twice in %s.\n";
+ const char *err14b = "Error in retrieving the compression parameter from %s.\n";
+ const char *err15a = "EXTERNAL-STORAGE keyword appears twice in %s.\n";
+ const char *err15b = "Error in retrieving the external storage paramters from %s.\n";
+ const char *err16a = "MAXIMUM-DIMENSIONS keyword appears twice in %s.\n";
+ const char *err16b = "MAXIMUM-DIMENSIONS cannot appear before DIMENSION-SIZES are provided.\n";
+ const char *err16c = "Error in retrieving the maximum dimension sizes from %s.\n";
+ const char *err17 = "Configuration parameters are invalid in %s.\n";
+ const char *err18 = "Unable to get string value.\n";
+ const char *err19 = "Unable to get integer value.\n";
+
+ /* create vector to map which keywords have been found
+ check vector after each keyword to check for violation
+ at the end check vector to see if required fields have been provided
+ process the output file according to the options
+ */
+
+ if ((strm = HDfopen(infile, "r")) == NULL) {
+ (void) HDfprintf(stderr, err1, infile);
+ goto error;
+ }
+
+ scanret = fscanf(strm, "%s", key);
+ if((scanret == 1) && !HDstrcmp("HDF5", key)) {
+#ifdef H5DEBUGIMPORT
+ int pndx;
+ printf("\nh5dump file\n");
+#endif
+ in->h5dumpInput = 1;
+ scanret = fscanf(strm, "%s", temp); /* filename */
+ scanret = fscanf(strm, "%s", temp); /* start bracket */
+ scanret = fscanf(strm, "%s", key); /* DATASET */
+ while (scanret == 1) {
+ if(!HDstrcmp("DATASET", key)) { /* PATH */
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATASET key\n");
+#endif
+ if (in->configOptionVector[PATH] == 1) {
+ (void) HDfprintf(stderr, err3a, infile);
+ goto error;
+ }
+ if (fscanf(strm, "%s", temp) != 1) {
+ (void) HDfprintf(stderr, "%s", err18);
+ goto error;
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATASET %s found\n", temp);
+#endif
+ if (parsePathInfo(&in->path, temp) == -1) {
+ (void) HDfprintf(stderr, err3b, infile);
+ goto error;
+ }
+ in->configOptionVector[PATH] = 1;
+ scanret = fscanf(strm, "%s", temp); /* start bracket */
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATASET %s found\n", temp);
+#endif
+ } /* if(!HDstrcmp("DATASET", key)) PATH */
+ else if(!HDstrcmp("DATATYPE", key)) { /* INPUT-CLASS */
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATATYPE key\n");
+#endif
+ if (in->configOptionVector[INPUT_CLASS] == 1) {
+ (void) HDfprintf(stderr, err4a, infile);
+ goto error;
+ }
+
+ if (fscanf(strm, "%s", temp) != 1) {
+ (void) HDfprintf(stderr, "%s", err18);
+ goto error;
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATATYPE %s found\n", temp);
+#endif
+ if ((kindex = getInputClassType(in, temp)) == -1) {
+ (void) HDfprintf(stderr, err4b, infile);
+ goto error;
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATATYPE type %d inputClass\n", in->inputClass);
+#endif
+
+ in->configOptionVector[INPUT_CLASS] = 1;
+
+ /*set default value for output-class */
+ if (in->configOptionVector[OUTPUT_CLASS] == 0) {
+ if (in->inputClass == 0 || in->inputClass == 4)
+ in->outputClass = 0;
+ if (in->inputClass == 1 || in->inputClass == 2
+ || in->inputClass == 3)
+ in->outputClass = 1;
+ if (in->inputClass == 6 || in->inputClass == 7)
+ in->outputClass = 2;
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATATYPE type %d outputClass\n", in->outputClass);
+#endif
+
+ if(in->inputClass == 5) { /* STRING */
+ int get_next_prop = 1;
+ in->outputClass = -1;
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATATYPE STRING found\n");
+#endif
+ if (fscanf(strm, "%s", temp) != 1) { /* start bracket */
+ (void) HDfprintf(stderr, "%s", err18);
+ goto error;
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATATYPE STRING %s found\n", temp);
+#endif
+ if (fscanf(strm, "%s", temp) != 1) { /* string properties */
+ (void) HDfprintf(stderr, "%s", err18);
+ goto error;
+ }
+ while (get_next_prop) {
+ if(!HDstrcmp("STRSIZE", temp)) { /* STRSIZE */
+ if (fscanf(strm, "%s", temp) != 1) {
+ (void) HDfprintf(stderr, "%s", err19);
+ goto error;
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATATYPE STRING STRSIZE %s found\n", temp);
+#endif
+ if (HDstrcmp("H5T_VARIABLE;", temp)) {
+ char *more = temp;
+ ival = (int)HDstrtol(more, &more, 10);
+ if (getInputSize(in, ival) == -1) {
+ (void) HDfprintf(stderr, err5b, infile);
+ goto error;
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATATYPE STRING %d InputSize\n", in->inputSize);
+#endif
+ }
+ }
+ else if(!HDstrcmp("STRPAD", temp)) { /* STRPAD */
+ if (fscanf(strm, "%s", temp) != 1) { /* STRPAD type */
+ (void) HDfprintf(stderr, "%s", err18);
+ goto error;
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATATYPE STRING STRPAD %s found\n", temp);
+#endif
+ }
+ else if(!HDstrcmp("CSET", key)) { /* CSET */
+ if (fscanf(strm, "%s", temp) != 1) { /* CSET type */
+ (void) HDfprintf(stderr, "%s", err18);
+ goto error;
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATATYPE STRING CSET %s found\n", temp);
+#endif
+
+ }
+ else if(!HDstrcmp("CTYPE", temp)) { /* CTYPE */
+ if (fscanf(strm, "%s", temp) != 1) { /* CTYPE type */
+ (void) HDfprintf(stderr, "%s", err18);
+ goto error;
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATATYPE STRING CTYPE %s found\n", temp);
+#endif
+ } /* if(!HDstrcmp("CSET", key)) */
+ if (fscanf(strm, "%s", temp) != 1) {
+ (void) HDfprintf(stderr, "%s", err18);
+ goto error;
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATATYPE STRING %s found\n", temp);
+#endif
+ if(!HDstrcmp("}", temp)) { /* end bracket */
+ get_next_prop = 0;
+ }
+ } /* while (get_next_prop) */
+ } /* if(kindex == 5) STRING */
+ } /* else if(!HDstrcmp("DATATYPE", key)) INPUT-CLASS */
+ else if(!HDstrcmp("DATASPACE", key)) { /* RANK and DIMENSIONS */
+ hsize_t temp_dims[MAX_NUM_DIMENSION];
+
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATASPACE key\n");
+#endif
+ if (fscanf(strm, "%s", temp) != 1) {
+ (void) HDfprintf(stderr, "%s", err18);
+ goto error;
+ }
+ if(!HDstrcmp("SCALAR", temp)) { /* SCALAR */
+ in->rank = 0;
+ } /* if(!HDstrcmp("SCALAR", key)) */
+ else if(!HDstrcmp("NULL", temp)) { /* NULL */
+ (void) HDfprintf(stderr, err6b, infile);
+ goto error;
+ } /* else if(!HDstrcmp("NULL", key)) */
+ else if(!HDstrcmp("SIMPLE", temp)) { /* SIMPLE */
+ int icount = 0;
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATASPACE SIMPLE found\n");
+#endif
+ if (fscanf(strm, "%s", temp) != 1) { /* start bracket */
+ (void) HDfprintf(stderr, err6b, infile);
+ goto error;
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATASPACE SIMPLE %s found\n", temp);
+#endif
+ if (fscanf(strm, "%s", temp) != 1) { /* start paren */
+ (void) HDfprintf(stderr, err6b, infile);
+ goto error;
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATASPACE SIMPLE %s found\n", temp);
+#endif
+ if(!HDstrcmp("(", temp)) { /* start paren */
+ int get_next_dim = 1;
+ int i = 0;
+
+ if (fscanf(strm, "%s", temp) != 1) { /* Dimension with optional comma */
+ (void) HDfprintf(stderr, err16c, infile);
+ goto error;
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATASPACE SIMPLE %s found\n", temp);
+#endif
+ while (get_next_dim) {
+ char *more = temp;
+ temp_dims[icount] = HDstrtoull(more, &more, 10);
+ if (fscanf(strm, "%s", temp) != 1) { /* Dimension or end paren */
+ (void) HDfprintf(stderr, err6b, infile);
+ goto error;
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATASPACE SIMPLE %s found\n", temp);
+#endif
+ if(!HDstrcmp(")", temp)) { /* end paren */
+ in->rank = ++icount;
+ in->configOptionVector[RANK] = 1;
+ get_next_dim = 0;
+ }
+ else { /* Dimension */
+ icount++;
+ if (icount > MAX_NUM_DIMENSION) {
+ (void) HDfprintf(stderr, "Invalid value for rank.\n");
+ goto error;
+ }
+ }
+ } /* while (get_next_dim) */
+
+ if ((in->sizeOfDimension = (hsize_t *) HDmalloc ((size_t) in->rank * sizeof(hsize_t))) == NULL) {
+ goto error;
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATASPACE SIMPLE %d rank\n", in->rank);
+#endif
+ for (i = 0; i < in->rank; i++) {
+ in->sizeOfDimension[i] = temp_dims[i];
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATASPACE SIMPLE dims:", in->rank);
+ for (pndx = 0; pndx < in->rank; pndx++) {
+ printf(" %d", in->sizeOfDimension[pndx]);
+ }
+ printf("\n");
+#endif
+ in->configOptionVector[DIM] = 1;
+ } /* if(!HDstrcmp("(", key)) start paren */
+ else {
+ (void) HDfprintf(stderr, err5b, infile);
+ goto error;
+ }
+ if (fscanf(strm, "%s", temp) != 1) {
+ (void) HDfprintf(stderr, "%s", err18);
+ goto error;
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATASPACE SIMPLE %s found\n", temp);
+#endif
+ if(!HDstrcmp("/", temp)) { /* / max dims */
+ if ((in->maxsizeOfDimension = (hsize_t *) HDmalloc ((size_t) in->rank * sizeof(hsize_t))) == NULL) {
+ goto error;
+ }
+ if (fscanf(strm, "%s", temp) != 1) { /* start paren */
+ (void) HDfprintf(stderr, err6b, infile);
+ goto error;
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATASPACE SIMPLE %s found\n", temp);
+#endif
+ if(!HDstrcmp("(", temp)) { /* start paren */
+ int get_next_dim = 1;
+ int i = 0;
+
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATASPACE SIMPLE process max dim values\n");
+#endif
+ if (fscanf(strm, "%s", temp) != 1) { /* max dim with optional comma */
+ (void) HDfprintf(stderr, err16c, infile);
+ goto error;
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATASPACE SIMPLE %s found\n", temp);
+#endif
+ while (get_next_dim) {
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATASPACE SIMPLE get max dim value\n");
+#endif
+ if(!HDstrcmp("H5S_UNLIMITED", temp) || !HDstrcmp("H5S_UNLIMITED,", temp)) { /* unlimited */
+ in->maxsizeOfDimension[i] = H5S_UNLIMITED;
+ in->configOptionVector[EXTEND] = 1;
+ }
+ else {
+ char *more = temp;
+ in->maxsizeOfDimension[i] = HDstrtoull(more, &more, 10);
+ }
+ if (fscanf(strm, "%s", temp) != 1) { /* max dim or end paren */
+ (void) HDfprintf(stderr, err16c, infile);
+ goto error;
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATASPACE SIMPLE %s found\n", temp);
+#endif
+ if(!HDstrcmp(")", temp)) { /* end paren */
+ get_next_dim = 0;
+ }
+ else { /* comma */
+ i++;
+ if (i > MAX_NUM_DIMENSION) {
+ (void) HDfprintf(stderr, "Invalid value for rank.\n");
+ goto error;
+ }
+ }
+ } /* while (get_next_dim) */
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATASPACE SIMPLE maxdims:", in->rank);
+ for (pndx = 0; pndx < in->rank; pndx++) {
+ printf(" %d", in->maxsizeOfDimension[pndx]);
+ }
+ printf("\n");
+ printf("h5dump DATASPACE SIMPLE get max dim finished\n");
+#endif
+ } /* if(!HDstrcmp("(", key)) start paren */
+ else {
+ (void) HDfprintf(stderr, err16c, infile);
+ goto error;
+ }
+ scanret = fscanf(strm, "%s", temp); /* end bracket */
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATASPACE SIMPLE %s found\n", temp);
+#endif
+ } /* if(!HDstrcmp("/", key)) max dims separator */
+ } /* else if(!HDstrcmp("SIMPLE", key)) */
+ else {
+ (void) HDfprintf(stderr, err5b, infile);
+ goto error;
+ }
+ } /* else if(!HDstrcmp("DATASPACE", key)) RANK and DIMENSIONS */
+ else if(!HDstrcmp("STORAGE_LAYOUT", key)) { /* CHUNKED-DIMENSION-SIZES */
+#ifdef H5DEBUGIMPORT
+ printf("h5dump STORAGE_LAYOUT key\n");
+#endif
+ if (fscanf(strm, "%s", temp) != 1) { /* start bracket */
+ (void) HDfprintf(stderr, err6b, infile);
+ goto error;
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump STORAGE_LAYOUT %s found\n", temp);
+#endif
+ if (fscanf(strm, "%s", temp) != 1) { /* CHUNKED */
+ (void) HDfprintf(stderr, err6b, infile);
+ goto error;
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump STORAGE_LAYOUT %s found\n", temp);
+#endif
+ if(!HDstrcmp("CHUNKED", temp)) { /* CHUNKED */
+ if ((in->sizeOfChunk = (hsize_t *) HDmalloc ((size_t) in->rank * sizeof(hsize_t))) == NULL) {
+ (void) HDfprintf(stderr, "Unable to allocate dynamic memory.\n");
+ goto error;
+ }
+ if (fscanf(strm, "%s", temp) != 1) { /* start paren */
+ (void) HDfprintf(stderr, err6b, infile);
+ goto error;
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump STORAGE_LAYOUT CHUNKED %s found\n", temp);
+#endif
+ if(!HDstrcmp("(", temp)) { /* start paren */
+ int get_next_dim = 1;
+ int icount = 0;
+
+ if (fscanf(strm, "%s", temp) != 1) { /* Dimension with optional comma */
+ (void) HDfprintf(stderr, err16c, infile);
+ goto error;
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump STORAGE_LAYOUT CHUNKED %s found\n", temp);
+#endif
+ while (get_next_dim) {
+ char *more = temp;
+ in->sizeOfChunk[icount] = HDstrtoull(more, &more, 10);
+ if (fscanf(strm, "%s", temp) != 1) { /* Dimension or end paren */
+ (void) HDfprintf(stderr, err6b, infile);
+ goto error;
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump STORAGE_LAYOUT CHUNKED %s found\n", temp);
+#endif
+ if(!HDstrcmp(")", temp)) { /* end paren */
+ in->configOptionVector[RANK] = 1;
+ get_next_dim = 0;
+ }
+ else { /* Dimension */
+ icount++;
+ if (icount > MAX_NUM_DIMENSION) {
+ (void) HDfprintf(stderr, "Invalid value for rank.\n");
+ goto error;
+ }
+ }
+ } /* while (get_next_dim) */
+#ifdef H5DEBUGIMPORT
+ printf("h5dump STORAGE_LAYOUT CHUNKED dims:", in->rank);
+ for (pndx = 0; pndx < in->rank; pndx++) {
+ printf(" %d", in->sizeOfChunk[pndx]);
+ }
+ printf("\n");
+#endif
+ in->configOptionVector[DIM] = 1;
+ } /* if(!HDstrcmp("(", key)) start paren */
+ else {
+ (void) HDfprintf(stderr, err5b, infile);
+ goto error;
+ }
+ if (fscanf(strm, "%s", temp) != 1) { /* SIZE */
+ (void) HDfprintf(stderr, err6b, infile);
+ goto error;
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump STORAGE_LAYOUT CHUNKED %s found\n", temp);
+#endif
+ if(!HDstrcmp("SIZE", temp)) { /* SIZE */
+ if (fscanf(strm, "%d", (&ival)) != 1) {
+ (void) HDfprintf(stderr, "%s", err19);
+ goto error;
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump STORAGE_LAYOUT CHUNKED SIZE %d found\n", ival);
+#endif
+ }
+ while (HDstrcmp("}", temp)) {
+ if (fscanf(strm, "%s", temp) != 1) { /* end bracket */
+ (void) HDfprintf(stderr, "%s", err18);
+ goto error;
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump STORAGE_LAYOUT CHUNKED %s found\n", temp);
+#endif
+ }
+ in->configOptionVector[CHUNK] = 1;
+ } /* if(!HDstrcmp("CHUNKED", key)) CHUNKED */
+ } /* else if(!HDstrcmp("STORAGE_LAYOUT", key)) CHUNKED-DIMENSION-SIZES */
+ else if(!HDstrcmp("FILTERS", key)) { /* FILTERS */
+#ifdef H5DEBUGIMPORT
+ printf("h5dump FILTERS key\n");
+#endif
+ if (fscanf(strm, "%s", temp) != 1) { /* start bracket */
+ (void) HDfprintf(stderr, err6b, infile);
+ goto error;
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump FILTERS %s found\n", temp);
+#endif
+ if (fscanf(strm, "%s", temp) != 1) {
+ (void) HDfprintf(stderr, err6b, infile);
+ goto error;
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump FILTERS %s found\n", temp);
+#endif
+ if(!HDstrcmp("COMPRESSION", temp)) { /* COMPRESSION */
+#ifdef H5DEBUGIMPORT
+ printf("h5dump FILTERS COMPRESSION found\n");
+#endif
+ if (fscanf(strm, "%s", temp) != 1) { /* DEFLATE */
+ (void) HDfprintf(stderr, "%s", err18);
+ goto error;
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump FILTERS COMPRESSION %s found\n", temp);
+#endif
+ if (fscanf(strm, "%s", temp) != 1) { /* bgin bracket */
+ (void) HDfprintf(stderr, "%s", err18);
+ goto error;
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump FILTERS COMPRESSION %s found\n", temp);
+#endif
+ if (fscanf(strm, "%s", temp) != 1) { /* LEVEL */
+ (void) HDfprintf(stderr, "%s", err18);
+ goto error;
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump FILTERS COMPRESSION %s found\n", temp);
+#endif
+ if (fscanf(strm, "%d", (&ival)) != 1) {
+ (void) HDfprintf(stderr, "%s", err19);
+ goto error;
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump FILTERS COMPRESSION LEVEL %d found\n", ival);
+#endif
+ in->compressionParam = ival;
+ if (fscanf(strm, "%s", temp) != 1) { /* end bracket */
+ (void) HDfprintf(stderr, "%s", err18);
+ goto error;
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump FILTERS COMPRESSION %s found\n", temp);
+#endif
+ in->compressionType = 0; /* ONLY GZIP supported */
+ in->configOptionVector[COMPRESS] = 1;
+ }
+ else if(!HDstrcmp("CONTIGUOUS", temp)) { /* CONTIGUOUS */
+#ifdef H5DEBUGIMPORT
+ printf("h5dump FILTERS CONTIGUOUS found\n");
+#endif
+ in->configOptionVector[COMPRESS] = 0;
+ }
+ else if(!HDstrcmp("NONE", temp)) { /* NONE */
+#ifdef H5DEBUGIMPORT
+ printf("h5dump FILTERS NONE found\n");
+#endif
+ in->configOptionVector[COMPRESS] = 0;
+ }
+ if (fscanf(strm, "%s", temp) != 1) { /* end bracket */
+ (void) HDfprintf(stderr, "%s", err18);
+ goto error;
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump FILTERS %s found\n", temp);
+#endif
+ }
+ else if(!HDstrcmp("DATA", key)) { /* FINSHED */
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATA key\n");
+#endif
+ scanret = 0;
+ break;
+ }
+ scanret = fscanf(strm, "%s", key);
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump path");
+ for (pndx = 0; pndx < in->path.count; pndx++) {
+ printf(" : %s", in->path.group[pndx]);
+ }
+ printf("\n");
+ printf("h5dump inputClass=%d\n", in->inputClass);
+ printf("h5dump inputSize=%d\n", in->inputSize);
+ printf("h5dump rank=%d\n", in->rank);
+ printf("h5dump outputClass=%d\n", in->outputClass);
+ printf("h5dump outputSize=%d\n", in->outputSize);
+ printf("h5dump outputArchitecture=%d\n", in->outputArchitecture);
+ printf("h5dump outputByteOrder=%d\n", in->outputByteOrder);
+ printf("h5dump compressionType=%d\n", in->compressionType);
+ printf("h5dump compressionParam=%d\n", in->compressionParam);
+ printf("h5dump externFilename=%s\n", in->externFilename);
+ printf("h5dump configOptionVector:\n");
+ for (pndx = 0; pndx < NUM_KEYS; pndx++) {
+ printf(" %s=%d\n", keytable[pndx], in->configOptionVector[pndx]);
+ }
+#endif
+ }
+ else {
+ while (scanret == 1) {
+ if ((kindex = mapKeywordToIndex(key)) == -1) {
+ (void) HDfprintf(stderr, err2, infile);
+ goto error;
+ }
+ switch (kindex) {
+ case 0: /* PATH */
+ if (in->configOptionVector[PATH] == 1) {
+ (void) HDfprintf(stderr, err3a, infile);
+ goto error;
+ }
+ if (fscanf(strm, "%s", temp) != 1) {
+ (void) HDfprintf(stderr, "%s", err18);
+ goto error;
+ }
+ if (parsePathInfo(&in->path, temp) == -1) {
+ (void) HDfprintf(stderr, err3b, infile);
+ goto error;
+ }
+ in->configOptionVector[PATH] = 1;
+ break;
+
+ case 1: /* INPUT-CLASS */
+ if (in->configOptionVector[INPUT_CLASS] == 1) {
+ (void) HDfprintf(stderr, err4a, infile);
+ goto error;
+ }
+
+ if (fscanf(strm, "%s", temp) != 1) {
+ (void) HDfprintf(stderr, "%s", err18);
+ goto error;
+ }
+ if (getInputClass(in, temp) == -1) {
+ (void) HDfprintf(stderr, err4b, infile);
+ goto error;
+ }
+
+ in->configOptionVector[INPUT_CLASS] = 1;
+
+ /*set default value for output-class */
+ if (in->configOptionVector[OUTPUT_CLASS] == 0) {
+ if (in->inputClass == 0 || in->inputClass == 4)
+ in->outputClass = 0;
+ if (in->inputClass == 1 || in->inputClass == 2
+ || in->inputClass == 3)
+ in->outputClass = 1;
+ if (in->inputClass == 6 || in->inputClass == 7)
+ in->outputClass = 2;
+ }
+ break;
+
+ case 2: /* INPUT-SIZE */
+ if (in->configOptionVector[INPUT_SIZE] == 1) {
+ (void) HDfprintf(stderr, err5a, infile);
+ goto error;
+ }
+ if (fscanf(strm, "%d", (&ival)) != 1) {
+ (void) HDfprintf(stderr, "%s", err19);
+ goto error;
+ }
+ if (getInputSize(in, ival) == -1) {
+ (void) HDfprintf(stderr, err5b, infile);
+ goto error;
+ }
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ /*set default value for output-size */
+ if (in->configOptionVector[OUTPUT_SIZE] == 0)
+ in->outputSize = in->inputSize;
+ break;
+
+ case 3: /* RANK */
+ if (in->configOptionVector[RANK] == 1) {
+ (void) HDfprintf(stderr, err6a, infile);
+ goto error;
+ }
+
+ if (getRank(in, strm) == -1) {
+ (void) HDfprintf(stderr, err6b, infile);
+ goto error;
+ }
+ in->configOptionVector[RANK] = 1;
+ break;
+
+ case 4: /* DIMENSION-SIZES */
+ if (in->configOptionVector[DIM] == 1) {
+ (void) HDfprintf(stderr, err7a, infile);
+ goto error;
+ }
+
+ if (in->configOptionVector[RANK] == 0) {
+ (void) HDfprintf(stderr, err7b, infile);
+ goto error;
+ }
+ if (getDimensionSizes(in, strm) == -1) {
+ (void) HDfprintf(stderr, err7c, infile);
+ goto error;
+ }
+ in->configOptionVector[DIM] = 1;
+ break;
+
+ case 5: /* OUTPUT-CLASS */
+ if (in->configOptionVector[OUTPUT_CLASS] == 1) {
+ (void) HDfprintf(stderr, err8a, infile);
+ goto error;
+ }
+
+ if (getOutputClass(in, strm) == -1) {
+ (void) HDfprintf(stderr, err8b, infile);
+ goto error;
+ }
+ in->configOptionVector[OUTPUT_CLASS] = 1;
+ break;
+
+ case 6: /* OUTPUT-SIZE */
+ if (in->configOptionVector[OUTPUT_SIZE] == 1) {
+ (void) HDfprintf(stderr, err9a, infile);
+ goto error;
+ }
+
+ if (getOutputSize(in, strm) == -1) {
+ (void) HDfprintf(stderr, err9b, infile);
+ goto error;
+ }
+ in->configOptionVector[OUTPUT_SIZE] = 1;
+ break;
+
+ case 7: /* OUTPUT-ARCHITECTURE */
+ if (in->configOptionVector[OUTPUT_ARCH] == 1) {
+ (void) HDfprintf(stderr, err10a, infile);
+ goto error;
+ }
+
+ if (getOutputArchitecture(in, strm) == -1) {
+ (void) HDfprintf(stderr, err10b, infile);
+ goto error;
+ }
+ in->configOptionVector[OUTPUT_ARCH] = 1;
+ break;
+
+ case 8: /* OUTPUT-BYTE-ORDER */
+ if (in->configOptionVector[OUTPUT_B_ORDER] == 1) {
+ (void) HDfprintf(stderr, err11a, infile);
+ goto error;
+ }
+
+ if (getOutputByteOrder(in, strm) == -1) {
+ (void) HDfprintf(stderr, err11b, infile);
+ goto error;
+ }
+ in->configOptionVector[OUTPUT_B_ORDER] = 1;
+ break;
+
+ case 9: /* CHUNKED-DIMENSION-SIZES */
+ if (in->configOptionVector[CHUNK] == 1) {
+ (void) HDfprintf(stderr, err12a, infile);
+ goto error;
+ }
+ /* cant appear before dimension sizes have been provided */
+ if (in->configOptionVector[DIM] == 0) {
+ (void) HDfprintf(stderr, err12b, infile);
+ goto error;
+ }
+
+ if (getChunkedDimensionSizes(in, strm) == -1) {
+ (void) HDfprintf(stderr, err12c, infile);
+ goto error;
+ }
+ in->configOptionVector[CHUNK] = 1;
+ break;
+
+ case 10: /* COMPRESSION-TYPE */
+ if (in->configOptionVector[COMPRESS] == 1) {
+ (void) HDfprintf(stderr, err13a, infile);
+ goto error;
+ }
+
+ if (getCompressionType(in, strm) == -1) {
+ (void) HDfprintf(stderr, err13b, infile);
+ goto error;
+ }
+ in->configOptionVector[COMPRESS] = 1;
+
+ if (in->configOptionVector[COMPRESS_PARAM] == 0) {
+ if (in->compressionType == 0)
+ in->compressionParam = 6; /* default value if compressionType is GZIP */
+ }
+ break;
+
+ case 11: /* COMPRESSION-PARAM */
+ if (in->configOptionVector[COMPRESS_PARAM] == 1) {
+ (void) HDfprintf(stderr, err14a, infile);
+ goto error;
+ }
+
+ if (getCompressionParameter(in, strm) == -1) {
+ (void) HDfprintf(stderr, err14b, infile);
+ goto error;
+ }
+
+ in->configOptionVector[COMPRESS_PARAM] = 1;
+
+ if (in->configOptionVector[COMPRESS] == 0)
+ in->compressionType = 0;
+
+ break;
+
+ case 12: /* EXTERNAL-STORAGE */
+ if (in->configOptionVector[EXTERNALSTORE] == 1) {
+ (void) HDfprintf(stderr, err15a, infile);
+ goto error;
+ }
+
+ if (getExternalFilename(in, strm) == -1) {
+ (void) HDfprintf(stderr, err15b, infile);
+ goto error;
+ }
+ in->configOptionVector[EXTERNALSTORE] = 1;
+ break;
+
+ case 13: /* MAXIMUM-DIMENSIONS */
+ if (in->configOptionVector[EXTEND] == 1) {
+ (void) HDfprintf(stderr, err16a, infile);
+ goto error;
+ }
+ /* cant appear before dimension sizes have been provided */
+ if (in->configOptionVector[DIM] == 0) {
+ (void) HDfprintf(stderr, err16b, infile);
+ goto error;
+ }
+ if (getMaximumDimensionSizes(in, strm) == -1) {
+ (void) HDfprintf(stderr, err16c, infile);
+ goto error;
+ }
+ in->configOptionVector[EXTEND] = 1;
+ break;
+
+ default:
+ break;
+ }
+ scanret = fscanf(strm, "%s", key);
+ }
+ }
+
+ /*
+ check if keywords obtained are valid
+ if yes, return 0 else error
+ */
+
+ if (validateConfigurationParameters(in) == -1) {
+ (void) HDfprintf(stderr, err17, infile);
+ goto error;
+ }
+
+ /* Set success return value */
+ retval = 0;
+
+error:
+ if(strm)
+ HDfclose(strm);
+ return(retval);
+}
+
+static int validateConfigurationParameters(struct Input *in)
+{
+ const char *err1 = "One or more of the required fields (RANK, DIMENSION-SIZES) missing.\n";
+ const char *err2 = "Cannot specify chunking or compression or extendible data sets with the external file option.\n";
+ const char *err3 = "Cannot specify the compression or the extendible data sets without the chunking option.\n";
+ const char *err4a = "OUTPUT-ARCHITECTURE cannot be STD if OUTPUT-CLASS is floating point (FP).\n";
+ const char *err4b = "OUTPUT-ARCHITECTURE cannot be IEEE if OUTPUT-CLASS is integer (IN).\n";
+ const char *err5 = "For OUTPUT-CLASS FP, valid values for OUTPUT-SIZE are (32, 64) .\n";
+#ifndef H5_SIZEOF_LONG_LONG
+ const char *err6 = "No support for reading 64-bit integer (INPUT-CLASS: IN, TEXTIN, UIN, TEXTUIN files\n";
+#endif
+
+ /* for class STR other parameters are ignored */
+ if (in->inputClass == 5) /* STR */
+ return (0);
+
+ if ((in->configOptionVector[DIM] != 1) || (in->configOptionVector[RANK] != 1)) {
+ (void) HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+
+ if (in->configOptionVector[EXTERNALSTORE] == 1) {
+ if ((in->configOptionVector[COMPRESS] == 1) || (in->configOptionVector[CHUNK] == 1) || (in->configOptionVector[EXTEND] == 1)) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ }
+
+ if ((in->configOptionVector[COMPRESS] == 1) || (in->configOptionVector[EXTEND] == 1)) {
+ if (in->configOptionVector[CHUNK] != 1) {
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ }
+
+ /* Arch cant be STD if O/p class is FP */
+ if (in->outputArchitecture == 1)
+ if (in->outputClass == 1) {
+ (void) HDfprintf(stderr, "%s", err4a);
+ return (-1);
+ }
+
+ /* Arch cant be IEEE if O/p class is IN */
+ if (in->outputArchitecture == 2)
+ if (in->outputClass == 0) {
+ (void) HDfprintf(stderr, "%s", err4b);
+ return (-1);
+ }
+
+ if (in->outputClass == 1)
+ if (in->outputSize != 32 && in->outputSize != 64) {
+ (void) HDfprintf(stderr, "%s", err5);
+ return (-1);
+ }
+
+#ifndef H5_SIZEOF_LONG_LONG
+ if (in->inputSize == 64 && (in->inputClass == 0 || in->inputClass == 4 || in->inputClass == 6 || in->inputClass == 7) ) {
+ (void) HDfprintf(stderr, "%s", err6);
+ return -1;
+ }
+#endif
+ return (0);
+}
+
+static int mapKeywordToIndex(char *key)
+{
+ int i;
+
+ for (i = 0; i < NUM_KEYS; i++)
+ if (!HDstrcmp(keytable[i], key))
+ return i;
+ return -1;
+}
+
+static int parsePathInfo(struct path_info *path, char *temp)
+{
+ const char delimiter[] = "/\"";
+ char *token;
+ int i = 0;
+ const char *err1 = "Path string larger than MAX_PATH_NAME_LENGTH.\n";
+
+ token = HDstrtok (temp, delimiter);
+ if (HDstrlen(token) >= MAX_PATH_NAME_LENGTH) {
+ (void) HDfprintf(stderr, err1);
+ return (-1);
+ }
+ HDstrcpy(path->group[i++],token);
+
+ while (1) {
+ token = HDstrtok (NULL, delimiter);
+ if (token == NULL)
+ break;
+ if (HDstrlen(token) >= MAX_PATH_NAME_LENGTH) {
+ (void) HDfprintf(stderr, err1);
+ return (-1);
+ }
+ HDstrcpy(path->group[i++],token);
+ }
+ path->count = i;
+ return (0);
+}
+
+static int parseDimensions(struct Input *in, char *strm)
+{
+ const char delimiter[] = ",";
+ char temp[255];
+ char *token;
+ int i = 0;
+ const char *err1 = "Unable to allocate dynamic memory.\n";
+
+ HDstrncpy(temp, strm, sizeof(temp));
+ temp[sizeof(temp) - 1] = '\0';
+ HDstrtok (temp, delimiter);
+
+ while (1) {
+ token = HDstrtok (NULL, delimiter);
+ if (token == NULL)
+ break;
+ i++;
+ }
+ in->rank = i + 1;
+ if ((in->sizeOfDimension = (hsize_t *) HDmalloc ((size_t) in->rank * sizeof(hsize_t))) == NULL) {
+ (void) HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+
+ i = 0;
+ HDstrncpy(temp, strm, sizeof(temp));
+ temp[sizeof(temp) - 1] = '\0';
+ in->sizeOfDimension[i++]
+ = HDstrtoull(HDstrtok (temp, delimiter), NULL, BASE_10);
+
+ while (1) {
+ token = HDstrtok (NULL, delimiter);
+ if (token == NULL)
+ break;
+ in->sizeOfDimension[i++] = HDstrtoull(token, NULL, BASE_10);
+ }
+ return (0);
+}
+
+static int getOutputClass(struct Input *in, FILE *strm)
+{
+ char temp[255];
+ int kindex;
+ const char *err1 = "Unable to get 'string' value.\n";
+ const char *err2 = "Invalid value for output class.\n";
+
+ if (fscanf(strm, "%s", temp) != 1) {
+ (void) HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+
+ if ((kindex = OutputClassStrToInt(temp)) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+
+ in->outputClass = kindex;
+ return (0);
+}
+
+static int OutputClassStrToInt(char *temp)
+{
+ int i;
+ char classKeywordTable[3][15] = { "IN", "FP", "UIN" };
+ for (i = 0; i < 3; i++)
+ if (!HDstrcmp(classKeywordTable[i], temp))
+ return i;
+
+ return -1;
+}
+/* same as getInputSize. But defined separately for extensibility */
+static int getOutputSize(struct Input *in, FILE *strm)
+{
+ int ival;
+ int i;
+ int outputSizeValidValues[4] = { 8, 16, 32, 64 };
+ const char *err1 = "Unable to get integer value.\n";
+ const char *err2 = "Invalid value for output size.\n";
+
+ if (fscanf(strm, "%d", (&ival)) != 1) {
+ (void) HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+
+ for (i = 0; i < 4; i++)
+ if (outputSizeValidValues[i] == ival) {
+ in->outputSize = ival;
+ return (0);
+ }
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+}
+
+static int getInputClass(struct Input *in, char * temp)
+{
+ int kindex;
+ const char *err1 = "Invalid value for input class.\n";
+
+ if ((kindex = InputClassStrToInt(temp)) == -1) {
+ (void) HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+
+ in->inputClass = kindex;
+ return (0);
+}
+
+static int getInputClassType(struct Input *in, char * buffer)
+{
+ int kindex = -1;
+ const char *err1 = "Invalid value for input class.\n";
+ const char *err2 = "Invalid value for output architecture.\n";
+ const char *err3 = "Invalid value for output byte-order.\n";
+
+ if (!HDstrcmp(buffer, "H5T_STD_I8BE")) {
+ in->inputSize = 8;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("STD")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ if ((kindex = OutputByteOrderStrToInt("BE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ in->outputByteOrder = kindex;
+
+ kindex = 4;
+ }
+ else if (!HDstrcmp(buffer, "H5T_STD_I8LE")) {
+ in->inputSize = 8;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("STD")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ if ((kindex = OutputByteOrderStrToInt("LE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ in->outputByteOrder = kindex;
+
+ kindex = 4;
+ }
+ else if (!HDstrcmp(buffer, "H5T_STD_I16BE")) {
+ in->inputSize = 16;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("STD")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ if ((kindex = OutputByteOrderStrToInt("BE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ in->outputByteOrder = kindex;
+
+ kindex = 4;
+ }
+ else if (!HDstrcmp(buffer, "H5T_STD_I16LE")) {
+ in->inputSize = 16;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("STD")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ if ((kindex = OutputByteOrderStrToInt("LE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ in->outputByteOrder = kindex;
+
+ kindex = 4;
+ }
+ else if (!HDstrcmp(buffer, "H5T_STD_I32BE")) {
+ in->inputSize = 32;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("STD")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ if ((kindex = OutputByteOrderStrToInt("BE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ in->outputByteOrder = kindex;
+
+ kindex = 4;
+ }
+ else if (!HDstrcmp(buffer, "H5T_STD_I32LE")) {
+ in->inputSize = 32;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("STD")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ if ((kindex = OutputByteOrderStrToInt("LE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ in->outputByteOrder = kindex;
+
+ kindex = 4;
+ }
+ else if (!HDstrcmp(buffer, "H5T_STD_I64BE")) {
+ in->inputSize = 64;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("STD")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ if ((kindex = OutputByteOrderStrToInt("BE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ in->outputByteOrder = kindex;
+
+ kindex = 4;
+ }
+ else if (!HDstrcmp(buffer, "H5T_STD_I64LE")) {
+ in->inputSize = 64;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("STD")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ if ((kindex = OutputByteOrderStrToInt("LE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ in->outputByteOrder = kindex;
+
+ kindex = 4;
+ }
+ else if (!HDstrcmp(buffer, "H5T_STD_U8BE")) {
+ in->inputSize = 8;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("STD")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ if ((kindex = OutputByteOrderStrToInt("BE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ in->outputByteOrder = kindex;
+
+ kindex = 7;
+ }
+ else if (!HDstrcmp(buffer, "H5T_STD_U8LE")) {
+ in->inputSize = 8;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("STD")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ if ((kindex = OutputByteOrderStrToInt("LE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ in->outputByteOrder = kindex;
+
+ kindex = 7;
+ }
+ else if (!HDstrcmp(buffer, "H5T_STD_U16BE")) {
+ in->inputSize = 16;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("STD")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ if ((kindex = OutputByteOrderStrToInt("BE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ in->outputByteOrder = kindex;
+
+ kindex = 7;
+ }
+ else if (!HDstrcmp(buffer, "H5T_STD_U16LE")) {
+ in->inputSize = 16;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("STD")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ if ((kindex = OutputByteOrderStrToInt("LE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ in->outputByteOrder = kindex;
+
+ kindex = 7;
+ }
+ else if (!HDstrcmp(buffer, "H5T_STD_U32BE")) {
+ in->inputSize = 32;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("STD")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ if ((kindex = OutputByteOrderStrToInt("BE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ in->outputByteOrder = kindex;
+
+ kindex = 7;
+ }
+ else if (!HDstrcmp(buffer, "H5T_STD_U32LE")) {
+ in->inputSize = 32;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("STD")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ if ((kindex = OutputByteOrderStrToInt("LE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ in->outputByteOrder = kindex;
+
+ kindex = 7;
+ }
+ else if (!HDstrcmp(buffer, "H5T_STD_U64BE")) {
+ in->inputSize = 64;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("STD")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ if ((kindex = OutputByteOrderStrToInt("BE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ in->outputByteOrder = kindex;
+
+ kindex = 7;
+ }
+ else if (!HDstrcmp(buffer, "H5T_STD_U64LE")) {
+ in->inputSize = 64;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("STD")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ if ((kindex = OutputByteOrderStrToInt("LE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ in->outputByteOrder = kindex;
+
+ kindex = 7;
+ }
+ else if (!HDstrcmp(buffer, "H5T_NATIVE_SCHAR")) {
+ in->inputSize = 8;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("NATIVE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ kindex = 4;
+ }
+ else if (!HDstrcmp(buffer, "H5T_NATIVE_UCHAR")) {
+ in->inputSize = 8;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("NATIVE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ kindex = 7;
+ }
+ else if (!HDstrcmp(buffer, "H5T_NATIVE_SHORT")) {
+ in->inputSize = 16;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("NATIVE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ kindex = 4;
+ }
+ else if (!HDstrcmp(buffer, "H5T_NATIVE_USHORT")) {
+ in->inputSize = 16;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("NATIVE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ kindex = 7;
+ }
+ else if (!HDstrcmp(buffer, "H5T_NATIVE_INT")) {
+ in->inputSize = 32;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("NATIVE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ kindex = 4;
+ }
+ else if (!HDstrcmp(buffer, "H5T_NATIVE_UINT")) {
+ in->inputSize = 32;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("NATIVE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ kindex = 7;
+ }
+ else if (!HDstrcmp(buffer, "H5T_NATIVE_LONG")) {
+ in->inputSize = 32;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("NATIVE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ kindex = 4;
+ }
+ else if (!HDstrcmp(buffer, "H5T_NATIVE_ULONG")) {
+ in->inputSize = 32;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("NATIVE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ kindex = 7;
+ }
+ else if (!HDstrcmp(buffer, "H5T_NATIVE_LLONG")) {
+ in->inputSize = 64;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("NATIVE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ kindex = 4;
+ }
+ else if (!HDstrcmp(buffer, "H5T_NATIVE_ULLONG")) {
+ in->inputSize = 64;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("NATIVE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ kindex = 7;
+ }
+ else if (!HDstrcmp(buffer, "H5T_IEEE_F32BE")) {
+ in->inputSize = 32;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("IEEE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ if ((kindex = OutputByteOrderStrToInt("BE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ in->outputByteOrder = kindex;
+
+ kindex = 3;
+ }
+ else if (!HDstrcmp(buffer, "H5T_IEEE_F32LE")) {
+ in->inputSize = 32;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("IEEE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ if ((kindex = OutputByteOrderStrToInt("LE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ in->outputByteOrder = kindex;
+
+ kindex = 3;
+ }
+ else if (!HDstrcmp(buffer, "H5T_IEEE_F64BE")) {
+ in->inputSize = 64;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("IEEE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ if ((kindex = OutputByteOrderStrToInt("BE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ in->outputByteOrder = kindex;
+
+ kindex = 3;
+ }
+ else if (!HDstrcmp(buffer, "H5T_IEEE_F64LE")) {
+ in->inputSize = 64;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("IEEE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ if ((kindex = OutputByteOrderStrToInt("LE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ in->outputByteOrder = kindex;
+
+ kindex = 3;
+ }
+ else if (!HDstrcmp(buffer, "H5T_VAX_F32")) {
+ in->inputSize = 32;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ kindex = 3;
+ }
+ else if (!HDstrcmp(buffer, "H5T_VAX_F64")) {
+ in->inputSize = 64;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ kindex = 3;
+ }
+ else if (!HDstrcmp(buffer, "H5T_NATIVE_FLOAT")) {
+ in->inputSize = 32;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("NATIVE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ kindex = 3;
+ }
+ else if (!HDstrcmp(buffer, "H5T_NATIVE_DOUBLE")) {
+ in->inputSize = 64;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("NATIVE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ kindex = 3;
+ }
+#if H5_SIZEOF_LONG_DOUBLE !=0
+ else if (!HDstrcmp(buffer, "H5T_NATIVE_LDOUBLE")) {
+ in->inputSize = H5_SIZEOF_LONG_DOUBLE;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("NATIVE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ kindex = 3;
+ }
+#endif
+ else if(!HDstrcmp(buffer, "H5T_TIME: not yet implemented")) {
+ kindex = -1;
+ }
+ else if(!HDstrcmp(buffer, "H5T_STRING")) {
+ kindex = 5;
+ }
+ /* case H5T_BITFIELD: */
+ else if (!HDstrcmp(buffer, "H5T_STD_B8BE")) {
+
+ if ((kindex = OutputArchStrToInt("STD")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ if ((kindex = OutputByteOrderStrToInt("BE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ in->outputByteOrder = kindex;
+
+ kindex = -1;
+ }
+ else if (!HDstrcmp(buffer, "H5T_STD_B8LE")) {
+
+ if ((kindex = OutputArchStrToInt("STD")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ if ((kindex = OutputByteOrderStrToInt("LE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ in->outputByteOrder = kindex;
+
+ kindex = -1;
+ }
+ else if (!HDstrcmp(buffer, "H5T_STD_B16BE")) {
+
+ if ((kindex = OutputArchStrToInt("STD")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ if ((kindex = OutputByteOrderStrToInt("BE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ in->outputByteOrder = kindex;
+
+ kindex = -1;
+ }
+ else if (!HDstrcmp(buffer, "H5T_STD_B16LE")) {
+
+ if ((kindex = OutputArchStrToInt("STD")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ if ((kindex = OutputByteOrderStrToInt("LE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ in->outputByteOrder = kindex;
+
+ kindex = -1;
+ }
+ else if (!HDstrcmp(buffer, "H5T_STD_B32BE")) {
+
+ if ((kindex = OutputArchStrToInt("STD")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ if ((kindex = OutputByteOrderStrToInt("BE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ in->outputByteOrder = kindex;
+
+ kindex = -1;
+ }
+ else if (!HDstrcmp(buffer, "H5T_STD_B32LE")) {
+
+ if ((kindex = OutputArchStrToInt("STD")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ if ((kindex = OutputByteOrderStrToInt("LE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ in->outputByteOrder = kindex;
+
+ kindex = -1;
+ }
+ else if (!HDstrcmp(buffer, "H5T_STD_B64BE")) {
+
+ if ((kindex = OutputArchStrToInt("STD")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ if ((kindex = OutputByteOrderStrToInt("BE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ in->outputByteOrder = kindex;
+
+ kindex = -1;
+ }
+ else if (!HDstrcmp(buffer, "H5T_STD_B64LE")) {
+
+ if ((kindex = OutputArchStrToInt("STD")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ if ((kindex = OutputByteOrderStrToInt("LE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ in->outputByteOrder = kindex;
+
+ kindex = -1;
+ }
+ /* case H5T_OPAQUE: */
+ else if(!HDstrcmp(buffer, "H5T_OPAQUE")) {
+ kindex = -1;
+ }
+ /* case H5T_COMPOUND: */
+ else if(!HDstrcmp(buffer, "H5T_COMPOUND")) {
+ kindex = -1;
+ }
+ /* case H5T_REFERENCE: */
+ else if(!HDstrcmp(buffer, "H5T_REFERENCE")) {
+ kindex = -1;
+ }
+ /* case H5T_ENUM: */
+ else if(!HDstrcmp(buffer, "H5T_ENUM")) {
+ kindex = -1;
+ }
+ /* case H5T_VLEN: */
+ else if(!HDstrcmp(buffer, "H5T_VLEN")) {
+ kindex = -1;
+ }
+ /* case H5T_ARRAY: */
+ else if(!HDstrcmp(buffer, "H5T_ARRAY")) {
+ kindex = -1;
+ }
+
+ if (kindex == -1) {
+ (void) HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+
+ /*set default value for output-size */
+ if (in->configOptionVector[OUTPUT_SIZE] == 0)
+ in->outputSize = in->inputSize;
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATATYPE STRING %d inputSize\n", in->inputSize);
+ printf("h5dump DATATYPE STRING %d outputSize\n", in->outputSize);
+#endif
+
+ in->inputClass = kindex;
+ return (0);
+}
+
+static int InputClassStrToInt(char *temp)
+{
+ int i;
+ char classKeywordTable[8][15] = { "TEXTIN", "TEXTFP", "TEXTFPE", "FP", "IN", "STR", "TEXTUIN", "UIN" };
+ for (i = 0; i < 8; i++)
+ if (!HDstrcmp(classKeywordTable[i], temp))
+ return i;
+ return -1;
+}
+
+/* same as getOutputSize. But defined separately for extensibility */
+static int getInputSize(struct Input *in, int ival)
+{
+ int i;
+ int inputSizeValidValues[4] = { 8, 16, 32, 64 };
+ const char *err1 = "Invalid value for input size.\n";
+
+ for (i = 0; i < 4; i++)
+ if (inputSizeValidValues[i] == ival) {
+ in->inputSize = ival;
+ return (0);
+ }
+ (void) HDfprintf(stderr, "%s", err1);
+ return (-1);
+}
+
+static int getRank(struct Input *in, FILE *strm)
+{
+ int ival;
+
+ const char *err1 = "Unable to get integer value.\n";
+ const char *err2 = "Invalid value for rank.\n";
+
+ if (fscanf(strm, "%d", (&ival)) != 1) {
+ (void) HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ if (ival >= MIN_NUM_DIMENSION && ival <= MAX_NUM_DIMENSION) {
+ in->rank = ival;
+ return (0);
+ }
+
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+}
+
+/* same as getChunkedDimensionSizes. But defined separately for extensibility */
+static int getDimensionSizes(struct Input *in, FILE *strm)
+{
+ unsigned long long ullval;
+ int i = 0;
+
+ const char *err1 = "Unable to allocate dynamic memory.\n";
+ const char *err2 = "No. of dimensions for which dimension sizes provided is not equal to provided rank.\n";
+
+ if ((in->sizeOfDimension = (hsize_t *) HDmalloc ((size_t) in->rank * sizeof(hsize_t))) == NULL) {
+ (void) HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+
+ while (fscanf(strm, "%llu", (&ullval)) == 1)
+ in->sizeOfDimension[i++] = ullval;
+
+ if (in->rank != i) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ return (0);
+}
+/* same as getDimensionSizes. But defined separately for extensibility */
+static int getChunkedDimensionSizes(struct Input *in, FILE *strm)
+{
+ unsigned long long ullval;
+ int i = 0;
+
+ const char *err1 = "Unable to allocate dynamic memory.\n";
+ const char *err2 = "No. of dimensions for which chunked dimension sizes provided is not equal to provided rank.\n";
+ const char *err3 = "The CHUNKED-DIMENSION-SIZES cannot exceed the sizes of DIMENSION-SIZES\n";
+
+ if ((in->sizeOfChunk = (hsize_t *) HDmalloc ((size_t) in->rank * sizeof(hsize_t))) == NULL) {
+ (void) HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+
+ while (fscanf(strm, "%llu", (&ullval)) == 1)
+ in->sizeOfChunk[i++] = ullval;
+
+ if (in->rank != i) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+
+ for (i = 0; i < in->rank; i++)
+ if (in->sizeOfChunk[i] > in->sizeOfDimension[i]) {
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ return (0);
+}
+
+static int getMaximumDimensionSizes(struct Input *in, FILE *strm)
+{
+ long long llval;
+ int i = 0;
+
+ const char *err1 = "Unable to allocate dynamic memory.\n";
+ const char *err2 = "No. of dimensions for which maximum dimension sizes provided is not equal to provided rank.\n";
+ const char *err3 = "The MAXIMUM-DIMENSIONS cannot be less than the sizes of DIMENSION-SIZES. Exception: can be -1 to indicate unlimited size\n";
+
+ if ((in->maxsizeOfDimension = (hsize_t *) HDmalloc ((size_t) in->rank * sizeof(hsize_t))) == NULL) {
+ (void) HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+
+ while (fscanf(strm, "%lld", (&llval)) == 1) {
+ if (llval == -1)
+ in->maxsizeOfDimension[i++] = H5S_UNLIMITED;
+ else
+ in->maxsizeOfDimension[i++] = (hsize_t)llval;
+ }
+
+ if (in->rank != i) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+
+ for (i = 0; i < in->rank; i++) {
+ if (in->maxsizeOfDimension[i] != H5S_UNLIMITED)
+ if (in->maxsizeOfDimension[i] < in->sizeOfDimension[i]) {
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ }
+ return (0);
+}
+
+static int getOutputArchitecture(struct Input *in, FILE *strm)
+{
+ char temp[255];
+ int kindex;
+ const char *err1 = "Unable to get 'string' value.\n";
+ const char *err2 = "Invalid value for output architecture.\n";
+
+ if (fscanf(strm, "%s", temp) != 1) {
+ (void) HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+
+ if ((kindex = OutputArchStrToInt(temp)) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+
+ in->outputArchitecture = kindex;
+ return (0);
+}
+
+static int OutputArchStrToInt(const char *temp)
+{
+ int i;
+ char outputArchKeywordTable[8][15] = { "NATIVE", "STD", "IEEE", "INTEL",
+ "CRAY", "MIPS", "ALPHA", "UNIX" };
+ for (i = 0; i < 8; i++)
+ if (!HDstrcmp(outputArchKeywordTable[i], temp))
+ return i;
+ return -1;
+}
+
+static int getOutputByteOrder(struct Input *in, FILE *strm)
+{
+ char temp[255];
+ int kindex;
+ const char *err1 = "Unable to get 'string' value.\n";
+ const char *err2 = "Invalid value for output byte-order.\n";
+
+ if (fscanf(strm, "%s", temp) != 1) {
+ (void) HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+
+ if ((kindex = OutputByteOrderStrToInt(temp)) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+
+ in->outputByteOrder = kindex;
+ return (0);
+}
+
+static int OutputByteOrderStrToInt(const char *temp)
+{
+ int i;
+ char outputByteOrderKeywordTable[2][15] = { "BE", "LE" };
+ for (i = 0; i < 2; i++)
+ if (!HDstrcmp(outputByteOrderKeywordTable[i], temp))
+ return i;
+ return -1;
+}
+
+static int getCompressionType(struct Input *in, FILE *strm)
+{
+ char temp[255];
+ int kindex;
+ const char *err1 = "Unable to get 'string' value.\n";
+ const char *err2 = "Invalid value for compression.\n";
+
+ if (fscanf(strm, "%s", temp) != 1) {
+ (void) HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+
+ if ((kindex = CompressionTypeStrToInt(temp)) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+
+ in->compressionType = kindex;
+ return (0);
+
+}
+
+static int CompressionTypeStrToInt(char *temp)
+{
+ /* currently supports only GZIP */
+ /* can be extended by adding fields to the table */
+
+ int i;
+ char CompressionTypeKeywordTable[1][15] = { "GZIP" };
+ for (i = 0; i < 1; i++)
+ if (!HDstrcmp(CompressionTypeKeywordTable[i], temp))
+ return i;
+ return -1;
+}
+
+static int getCompressionParameter(struct Input *in, FILE *strm)
+{
+ /* currently supports only GZIP */
+ /* can be extended by adding more values to COMPRESSION-TYPE and */
+ /* handling the paramters here by adding more cases */
+
+ int ival;
+ const char *err1 = "Unable to get integer value.\n";
+ const char *err2 = "Invalid value for compression paramter.\n";
+ const char *err3 = "Unsupported Compression Type.\n";
+
+ switch (in->compressionType) {
+ case 0: /* GZIP */
+ if (fscanf(strm, "%d", (&ival)) != 1) {
+ (void) HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+
+ if (ival < 0 || ival > 9) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->compressionParam = ival;
+ return (0);
+
+ default:
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+}
+
+static int getExternalFilename(struct Input *in, FILE *strm)
+{
+ char temp[255];
+ const char *err1 = "Unable to get 'string' value.\n";
+
+ if (fscanf(strm, "%s", temp) != 1) {
+ (void) HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+
+ in->externFilename = (char *) HDmalloc ((size_t) (HDstrlen(temp)) * sizeof(char));
+ (void) HDstrcpy(in->externFilename, temp);
+ return (0);
+}
+
+void setDefaultValues(struct Input *in, int count)
+{
+ int i;
+ char temp[255];
+ char num[255];
+
+ in->h5dumpInput = 0;
+ in->inputClass = 3; /* FP */
+ in->inputSize = 32;
+ in->outputClass = 1; /* FP */
+ in->outputSize = 32;
+ in->rank = 0;
+ in->path.count = 1;
+
+ HDstrcpy(temp, "dataset");
+ sprintf(num, "%d", count);
+ HDstrcat(temp, num);
+ HDstrcpy(in->path.group[0], temp);
+
+ in->outputArchitecture = 0; /* NATIVE */
+ in->outputByteOrder = -1; /* use default */
+ in->compressionType = 0; /* GZIP */
+ for (i = 0; i < NUM_KEYS; i++)
+ in->configOptionVector[i] = 0;
+}
+
+hid_t createOutputDataType(struct Input *in)
+{
+ hid_t new_type = (-1);
+ const char *err1 = "Invalid value for output class.\n";
+ const char *err2 = "Invalid value for output size.\n";
+ const char *err3 = "Invalid value for output byte order.\n";
+ const char *err4 = "Invalid value for output architecture.\n";
+ const char *err5 = "STD not supported for float.\n";
+ const char *err6 = "IEEE not supported for INT.\n";
+
+ switch (in->outputClass) {
+ case 0:
+ switch (in->outputArchitecture) {
+ case 0: /* NATIVE */
+ switch (in->outputSize) {
+ case 8:
+ new_type = H5Tcopy(H5T_NATIVE_CHAR);
+ break;
+
+ case 16:
+ new_type = H5Tcopy(H5T_NATIVE_SHORT);
+ break;
+
+ case 32:
+ new_type = H5Tcopy(H5T_NATIVE_INT);
+ break;
+
+ case 64:
+ new_type = H5Tcopy(H5T_NATIVE_LLONG);
+ break;
+
+ default:
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ switch (in->outputByteOrder) {
+ case -1: /* default */
+ break;
+ case 0:
+ H5Tset_order(new_type, H5T_ORDER_BE);
+ break;
+
+ case 1:
+ H5Tset_order(new_type, H5T_ORDER_LE);
+ break;
+
+ default:
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ break;
+
+ case 1: /* STD */
+ switch (in->outputSize) {
+ case 8:
+ switch (in->outputByteOrder) {
+ case -1:
+ case 0:
+ new_type = H5Tcopy(H5T_STD_I8BE);
+ break;
+
+ case 1:
+ new_type = H5Tcopy(H5T_STD_I8LE);
+ break;
+
+ default:
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ break;
+
+ case 16:
+ switch (in->outputByteOrder) {
+ case -1:
+ case 0:
+ new_type = H5Tcopy(H5T_STD_I16BE);
+ break;
+
+ case 1:
+ new_type = H5Tcopy(H5T_STD_I16LE);
+ break;
+
+ default:
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ break;
+
+ case 32:
+ switch (in->outputByteOrder) {
+ case -1:
+ case 0:
+ new_type = H5Tcopy(H5T_STD_I32BE);
+ break;
+
+ case 1:
+ new_type = H5Tcopy(H5T_STD_I32LE);
+ break;
+
+ default:
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ break;
+
+ case 64:
+ switch (in->outputByteOrder) {
+ case -1:
+ case 0:
+ new_type = H5Tcopy(H5T_STD_I64BE);
+ break;
+
+ case 1:
+ new_type = H5Tcopy(H5T_STD_I64LE);
+ break;
+
+ default:
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ break;
+
+ default:
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ break;
+
+ default:
+ (void) HDfprintf(stderr, "%s", err4);
+ return (-1);
+ }
+ break;
+
+ case 1:
+ switch (in->outputArchitecture) {
+ case 0:
+ switch (in->outputSize) {
+ case 32:
+ new_type = H5Tcopy(H5T_NATIVE_FLOAT);
+ break;
+
+ case 64:
+ new_type = H5Tcopy(H5T_NATIVE_DOUBLE);
+ break;
+
+ default:
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ switch (in->outputByteOrder) {
+ case -1: /* DEFAULT */
+ break;
+ case 0:
+ H5Tset_order(new_type, H5T_ORDER_BE);
+ break;
+
+ case 1:
+ H5Tset_order(new_type, H5T_ORDER_LE);
+ break;
+
+ default:
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ break;
+
+ case 1:
+ (void) HDfprintf(stderr, "%s", err5);
+ return (-1);
+
+ case 2:
+ switch (in->outputSize) {
+ case 32:
+ switch (in->outputByteOrder) {
+ case -1:
+ case 0:
+ new_type = H5Tcopy(H5T_IEEE_F32BE);
+ break;
+
+ case 1:
+ new_type = H5Tcopy(H5T_IEEE_F32LE);
+ break;
+
+ default:
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ break;
+
+ case 64:
+ switch (in->outputByteOrder) {
+ case -1:
+ case 0:
+ new_type = H5Tcopy(H5T_IEEE_F64BE);
+ break;
+
+ case 1:
+ new_type = H5Tcopy(H5T_IEEE_F64LE);
+ break;
+
+ default:
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ break;
+
+ default:
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ break;
+
+ default:
+ (void) HDfprintf(stderr, "%s", err4);
+ return (-1);
+ }
+ break;
+
+ case 2:
+ switch (in->outputArchitecture) {
+ case 0:
+ switch (in->outputSize) {
+ case 8:
+ new_type = H5Tcopy(H5T_NATIVE_UCHAR);
+ break;
+
+ case 16:
+ new_type = H5Tcopy(H5T_NATIVE_USHORT);
+ break;
+
+ case 32:
+ new_type = H5Tcopy(H5T_NATIVE_UINT);
+ break;
+
+ case 64:
+ new_type = H5Tcopy(H5T_NATIVE_ULLONG);
+ break;
+
+ default:
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ switch (in->outputByteOrder) {
+ case -1: /* Default */
+ break;
+ case 0:
+ H5Tset_order(new_type, H5T_ORDER_BE);
+ break;
+
+ case 1:
+ H5Tset_order(new_type, H5T_ORDER_LE);
+ break;
+
+ default:
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ break;
+
+ case 1:
+ switch (in->outputSize) {
+ case 8:
+ switch (in->outputByteOrder) {
+ case -1:
+ case 0:
+ new_type = H5Tcopy(H5T_STD_U8BE);
+ break;
+
+ case 1:
+ new_type = H5Tcopy(H5T_STD_U8LE);
+ break;
+
+ default:
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ break;
+
+ case 16:
+ switch (in->outputByteOrder) {
+ case -1:
+ case 0:
+ new_type = H5Tcopy(H5T_STD_U16BE);
+ break;
+
+ case 1:
+ new_type = H5Tcopy(H5T_STD_U16LE);
+ break;
+
+ default:
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ break;
+
+ case 32:
+ switch (in->outputByteOrder) {
+ case -1:
+ case 0:
+ new_type = H5Tcopy(H5T_STD_U32BE);
+ break;
+
+ case 1:
+ new_type = H5Tcopy(H5T_STD_U32LE);
+ break;
+
+ default:
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ break;
+
+ case 64:
+ switch (in->outputByteOrder) {
+ case -1:
+ case 0:
+ new_type = H5Tcopy(H5T_STD_U64BE);
+ break;
+
+ case 1:
+ new_type = H5Tcopy(H5T_STD_U64LE);
+ break;
+
+ default:
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ break;
+
+ default:
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ break;
+
+ case 2:
+ (void) HDfprintf(stderr, "%s", err6);
+ return (-1);
+
+ default:
+ (void) HDfprintf(stderr, "%s", err4);
+ return (-1);
+ }
+ break;
+
+ default:
+ (void) HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ return new_type;
+}
+
+hid_t createInputDataType(struct Input *in)
+{
+ hid_t new_type = (-1);
+ const char *err1 = "Invalid value for input class.\n";
+ const char *err2 = "Invalid value for output size.\n";
+
+ switch (in->inputClass) {
+ case 0:
+ case 4:
+ switch (in->inputSize) {
+ case 8:
+ new_type = H5Tcopy(H5T_NATIVE_CHAR);
+ break;
+
+ case 16:
+ new_type = H5Tcopy(H5T_NATIVE_SHORT);
+ break;
+
+ case 32:
+ new_type = H5Tcopy(H5T_NATIVE_INT);
+ break;
+
+ case 64:
+ new_type = H5Tcopy(H5T_NATIVE_LLONG);
+ break;
+
+ default:
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ break;
+
+ case 1:
+ case 2:
+ case 3:
+ switch (in->inputSize) {
+ case 32:
+ new_type = H5Tcopy(H5T_NATIVE_FLOAT);
+ break;
+
+ case 64:
+ new_type = H5Tcopy(H5T_NATIVE_DOUBLE);
+ break;
+
+ default:
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ break;
+
+ case 5:
+ (void) HDfprintf(stderr, "%s", err1);
+ return (-1);
+ break;
+
+ case 6:
+ case 7:
+ switch (in->inputSize) {
+ case 8:
+ new_type = H5Tcopy(H5T_NATIVE_UCHAR);
+ break;
+
+ case 16:
+ new_type = H5Tcopy(H5T_NATIVE_USHORT);
+ break;
+
+ case 32:
+ new_type = H5Tcopy(H5T_NATIVE_UINT);
+ break;
+
+ case 64:
+ new_type = H5Tcopy(H5T_NATIVE_ULLONG);
+ break;
+
+ default:
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ break;
+
+ default:
+ (void) HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ return new_type;
+}
+
+static int process(struct Options *opt)
+{
+ struct Input *in;
+ FILE *extfile;
+ hid_t file_id;
+ hid_t group_id;
+ hid_t handle;
+ hid_t dataset;
+ hid_t dataspace = (-1);
+ hid_t intype;
+ hid_t outtype;
+ hid_t proplist;
+ hsize_t numOfElements = 1;
+ int j;
+ int k;
+
+ const char *err1 = "Error creating HDF output file: %s.\n";
+ const char *err2 = "Error in processing the configuration file: %s.\n";
+ const char *err3 = "Error in reading the input file: %s.\n";
+ const char *err4 = "Error in creating or opening external file.\n";
+ const char *err5 = "Error in creating the output data set. Dataset with the same name may exist at the specified path\n";
+ const char *err6 = "Error in writing the output data set.\n";
+
+ H5E_BEGIN_TRY
+ {
+ if ((file_id = H5Fopen(opt->outfile, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) {
+ if ((file_id = H5Fcreate(opt->outfile, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) == FAIL) {
+ (void) HDfprintf(stderr, err1, opt->outfile);
+ return (-1);
+ }
+ }
+ }
+ H5E_END_TRY;
+
+ for (k = 0; k < opt->fcount; k++) {
+ in = &(opt->infiles[k].in);
+ if (opt->infiles[k].config == 1) {
+ if (processConfigurationFile(opt->infiles[k].configfile, in) == -1) {
+ (void) HDfprintf(stderr, err2, opt->infiles[k].configfile);
+ return (-1);
+ }
+ }
+
+ if (processDataFile(opt->infiles[k].datafile, in, file_id) == -1) {
+ (void) HDfprintf(stderr, err3, opt->infiles[k].datafile);
+ return (-1);
+ }
+
+ if (in->inputClass != 5) { /* STR */
+ for (j = 0; j < in->rank; j++)
+ numOfElements *= in->sizeOfDimension[j];
+
+ /* disable error reporting */
+ H5E_BEGIN_TRY
+ {
+ /* create parent groups */
+ if (in->path.count > 1) {
+ j = 0;
+ handle = file_id;
+ while (j < in->path.count - 1) {
+ if ((group_id = H5Gopen2(handle, in->path.group[j], H5P_DEFAULT)) < 0) {
+ group_id = H5Gcreate2(handle, in->path.group[j++], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ for (; j < in->path.count - 1; j++)
+ group_id = H5Gcreate2(group_id, in->path.group[j], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ handle = group_id;
+ break;
+ }
+ handle = group_id;
+ j++;
+ }
+ }
+ else {
+ handle = file_id;
+ j = 0;
+ }
+
+ /*enable error reporting */
+ }
+ H5E_END_TRY;
+
+ /*create data type */
+ intype = createInputDataType(in);
+ outtype = createOutputDataType(in);
+#ifdef H5DEBUGIMPORT
+ printf("process intype %d outtype %d\n", intype, outtype);
+#endif
+
+ /* create property list */
+ proplist = H5Pcreate(H5P_DATASET_CREATE);
+ if (in->configOptionVector[CHUNK] == 1) {
+ H5Pset_layout(proplist, H5D_CHUNKED);
+ /* not reqd chunking is implied if set_chunk is used */
+ H5Pset_chunk(proplist, in->rank, in->sizeOfChunk);
+ }
+
+ if (in->configOptionVector[COMPRESS] == 1) {
+ H5Pset_deflate(proplist, (unsigned) in->compressionParam);
+ }
+
+ if (in->configOptionVector[EXTERNALSTORE] == 1) {
+ /* creating the external file if it doesnt exist */
+ if ((extfile = HDfopen(in->externFilename, "ab")) == NULL) {
+ (void) HDfprintf(stderr, "%s", err4);
+ H5Pclose(proplist);
+ H5Sclose(dataspace);
+ H5Fclose(file_id);
+ return (-1);
+ }
+ HDfclose(extfile);
+ H5Pset_external(proplist, in->externFilename, (off_t)0, numOfElements * (hsize_t)in->inputSize / 8);
+ }
+
+ /* create dataspace */
+ if (in->configOptionVector[EXTEND] == 1)
+ dataspace = H5Screate_simple(in->rank, in->sizeOfDimension, in->maxsizeOfDimension);
+ else
+ dataspace = H5Screate_simple(in->rank, in->sizeOfDimension, NULL);
+
+ /* disable error reporting */
+ H5E_BEGIN_TRY
+ {
+ /* create data set */
+ if ((dataset = H5Dcreate2(handle, in->path.group[j], outtype, dataspace, H5P_DEFAULT, proplist, H5P_DEFAULT)) < 0) {
+ (void) HDfprintf(stderr, "%s", err5);
+ H5Pclose(proplist);
+ H5Sclose(dataspace);
+ H5Fclose(file_id);
+ return (-1);
+ }
+
+ /*enable error reporting */
+ }
+ H5E_END_TRY;
+
+ /* write dataset */
+ if (H5Dwrite(dataset, intype, H5S_ALL, H5S_ALL, H5P_DEFAULT, (VOIDP) in->data) < 0) {
+ (void) HDfprintf(stderr, "%s", err6);
+ H5Dclose(dataset);
+ H5Pclose(proplist);
+ H5Sclose(dataspace);
+ H5Fclose(file_id);
+ return (-1);
+ }
+
+ H5Dclose(dataset);
+ H5Pclose(proplist);
+ H5Sclose(dataspace);
+ }
+
+ } /* STR */
+
+ H5Fclose(file_id);
+ return (0);
+}
+
+/*
+ * Name:
+ * help
+ *
+ * Purpose:
+ * Print a helpful summary of command usage and features.
+ */
+
+void help(char *name)
+{
+ (void) HDfprintf(stdout, "Name:\n\n");
+ (void) HDfprintf(stdout, "\t%s\n\n", name);
+ (void) HDfprintf(stdout, "\t TOOL NAME:\n");
+ (void) HDfprintf(stdout, "\t %s\n", name);
+ (void) HDfprintf(stdout, "\t SYNTAX:\n");
+ (void) HDfprintf(stdout, "\t %s -h[elp], OR\n", name);
+ (void) HDfprintf(stdout,
+ "\t %s <infile> -c[onfig] <configfile> [<infile> -c[config] <configfile>...]", name);
+ (void) HDfprintf(stdout, "\t\t\t\t -o[utfile] <outfile>\n\n");
+ (void) HDfprintf(stdout, "\t PURPOSE:\n");
+ (void) HDfprintf(stdout,
+ "\t To convert data stored in one or more ASCII or binary files\n");
+ (void) HDfprintf(stdout,
+ "\t into one or more datasets (in accordance with the \n");
+ (void) HDfprintf(stdout,
+ "\t user-specified type and storage properties) in an existing \n");
+ (void) HDfprintf(stdout, "\t or new HDF5 file.\n\n");
+ (void) HDfprintf(stdout, "\t DESCRIPTION:\n");
+ (void) HDfprintf(stdout,
+ "\t The primary objective of the utility is to convert floating\n");
+ (void) HDfprintf(stdout,
+ "\t point or integer data stored in ASCII text or binary form \n");
+ (void) HDfprintf(stdout,
+ "\t into a data-set according to the type and storage properties\n");
+ (void) HDfprintf(stdout,
+ "\t specified by the user. The utility can also accept ASCII\n");
+ (void) HDfprintf(stdout,
+ "\t text files and store the contents in a compact form as an\n");
+ (void) HDfprintf(stdout, "\t array of one-dimensional strings.\n\n");
+ (void) HDfprintf(stdout,
+ "\t The input data to be written as a data-set can be provided\n");
+ (void) HDfprintf(stdout, "\t to the utility in one of the following forms:\n");
+ (void) HDfprintf(stdout,
+ "\t 1. ASCII text file with numeric data (floating point or \n");
+ (void) HDfprintf(stdout, "\t integer data). \n");
+ (void) HDfprintf(stdout,
+ "\t 2. Binary file with native floating point data (32-bit or \n");
+ (void) HDfprintf(stdout, "\t 64-bit) \n");
+ (void) HDfprintf(stdout,
+ "\t 3. Binary file with native integer (signed or unsigned)\n");
+ (void) HDfprintf(stdout, "\t data (8-bit or 16-bit or 32-bit or 64-bit). \n");
+ (void) HDfprintf(stdout,
+ "\t 4. ASCII text file containing strings (text data).\n");
+ (void) HDfprintf(stdout, "\t \n");
+ (void) HDfprintf(stdout,
+ "\t Every input file is associated with a configuration file \n");
+ (void) HDfprintf(stdout,
+ "\t also provided as an input to the utility. (See Section \n");
+ (void) HDfprintf(stdout,
+ "\t \"CONFIGURATION FILE\" to know how it is to be organized).\n");
+ (void) HDfprintf(stdout,
+ "\t The class, size and dimensions of the input data is \n");
+ (void) HDfprintf(stdout,
+ "\t specified in this configuration file. A point to note is\n");
+ (void) HDfprintf(stdout,
+ "\t that the floating point data in the ASCII text file may be\n");
+ (void) HDfprintf(stdout,
+ "\t organized in the fixed floating form (for example 323.56)\n");
+ (void) HDfprintf(stdout,
+ "\t or in a scientific notation (for example 3.23E+02). A \n");
+ (void) HDfprintf(stdout,
+ "\t different input-class specification is to be used for both\n");
+ (void) HDfprintf(stdout, "\t forms.\n\n");
+ (void) HDfprintf(stdout,
+ "\t The utility extracts the input data from the input file \n");
+ (void) HDfprintf(stdout,
+ "\t according to the specified parameters and saves it into \n");
+ (void) HDfprintf(stdout, "\t an H5 dataset. \n\n");
+ (void) HDfprintf(stdout,
+ "\t The user can specify output type and storage properties in \n");
+ (void) HDfprintf(stdout,
+ "\t the configuration file. The user is required to specify the \n");
+ (void) HDfprintf(stdout,
+ "\t path of the dataset. If the groups in the path leading to \n");
+ (void) HDfprintf(stdout,
+ "\t the data-set do not exist, the groups will be created by the\n");
+ (void) HDfprintf(stdout,
+ "\t utility. If no group is specified, the dataset will be\n");
+ (void) HDfprintf(stdout, "\t created under the root group.\n\n");
+ (void) HDfprintf(stdout,
+ "\t In addition to the name, the user is also required to \n");
+ (void) HDfprintf(stdout,
+ "\t provide the class and size of output data to be written to \n");
+ (void) HDfprintf(stdout,
+ "\t the dataset and may optionally specify the output-architecture,\n");
+ (void) HDfprintf(stdout,
+ "\t and the output-byte-order. If output-architecture is not \n");
+ (void) HDfprintf(stdout,
+ "\t specified the default is NATIVE. Output-byte-orders are fixed\n");
+ (void) HDfprintf(stdout,
+ "\t for some architectures and may be specified only if output-\n");
+ (void) HDfprintf(stdout, "\t architecture is IEEE, UNIX or STD.\n\n");
+ (void) HDfprintf(stdout,
+ "\t Also, layout and other storage properties such as \n");
+ (void) HDfprintf(stdout,
+ "\t compression, external storage and extendible data-sets may be\n");
+ (void) HDfprintf(stdout,
+ "\t optionally specified. The layout and storage properties \n");
+ (void) HDfprintf(stdout,
+ "\t denote how raw data is to be organized on the disk. If these \n");
+ (void) HDfprintf(stdout,
+ "\t options are not specified the default is Contiguous layout \n");
+ (void) HDfprintf(stdout, "\t and storage.\n\n");
+ (void) HDfprintf(stdout,
+ "\t The dataset can be organized in any of the following ways:\n");
+ (void) HDfprintf(stdout, "\t 1. Contiguous.\n");
+ (void) HDfprintf(stdout, "\t 2. Chunked.\n");
+ (void) HDfprintf(stdout,
+ "\t 3. External Storage File (has to be contiguous)\n");
+ (void) HDfprintf(stdout,
+ "\t 4. Extendible data sets (has to be chunked)\n");
+ (void) HDfprintf(stdout, "\t 5. Compressed. (has to be chunked)\n");
+ (void) HDfprintf(stdout,
+ "\t 6. Compressed & Extendible (has to be chunked)\n\n");
+ (void) HDfprintf(stdout,
+ "\t If the user wants to store raw data in a non-HDF file then \n");
+ (void) HDfprintf(stdout,
+ "\t the external storage file option is to be used and the name \n");
+ (void) HDfprintf(stdout, "\t of the file is to be specified. \n\n");
+ (void) HDfprintf(stdout,
+ "\t If the user wants the dimensions of the data-set to be\n");
+ (void) HDfprintf(stdout,
+ "\t unlimited, the extendible data set option can be chosen. \n\n");
+ (void) HDfprintf(stdout,
+ "\t The user may also specify the type of compression and the \n");
+ (void) HDfprintf(stdout,
+ "\t level to which the data set must be compresses by setting \n");
+ (void) HDfprintf(stdout, "\t the compressed option.\n\n");
+ (void) HDfprintf(stdout, "\t SYNOPSIS:\n");
+ (void) HDfprintf(stdout, "\t h5import -h[elp], OR\n");
+ (void) HDfprintf( stdout,
+ "\t h5import <infile> -c[onfig] <configfile> \
+ [<infile> -c[config] <confile2>...] -o[utfile] <outfile>\n\n");
+ (void) HDfprintf(stdout, "\t -h[elp]:\n");
+ (void) HDfprintf(stdout,
+ "\t Prints this summary of usage, and exits.\n\n");
+ (void) HDfprintf(stdout, "\t <infile(s)>:\n");
+ (void) HDfprintf(stdout,
+ "\t Name of the Input file(s), containing a \n");
+ (void) HDfprintf(stdout,
+ "\t single n-dimensional floating point or integer array \n");
+ (void) HDfprintf(stdout,
+ "\t in either ASCII text, native floating point(32-bit \n");
+ (void) HDfprintf(stdout,
+ "\t or 64-bit) or native integer(8-bit or 16-bit or \n");
+ (void) HDfprintf(stdout,
+ "\t 32-bit or 64-bit). Data to be specified in the order\n");
+ (void) HDfprintf(stdout, "\t of fastest changing dimensions first.\n\n");
+ (void) HDfprintf(stdout, "\t -c[config] <configfile>:\n");
+ (void) HDfprintf(stdout,
+ "\t Every input file should be associated with a \n");
+ (void) HDfprintf(stdout,
+ "\t configuration file and this is done by the -c option.\n");
+ (void) HDfprintf(stdout,
+ "\t <configfile> is the name of the configuration file.\n");
+ (void) HDfprintf(stdout, "\t (See Section \"CONFIGURATION FILE\")\n\n");
+ (void) HDfprintf(stdout, "\t -o[utfile] <outfile>:\n");
+ (void) HDfprintf(stdout,
+ "\t Name of the HDF5 output file. Data from one or more \n");
+ (void) HDfprintf(stdout,
+ "\t input files are stored as one or more data sets in \n");
+ (void) HDfprintf(stdout,
+ "\t <outfile>. The output file may be an existing file or \n");
+ (void) HDfprintf(stdout,
+ "\t it maybe new in which case it will be created.\n\n\n");
+ (void) HDfprintf(stdout, "\t CONFIGURATION FILE:\n");
+ (void) HDfprintf(stdout,
+ "\t The configuration file is an ASCII text file and must be \n");
+ (void) HDfprintf(stdout,
+ "\t the ddl formatted file (without data values) produced by h5dump \n");
+ (void) HDfprintf(stdout,
+ "\t when used with the options '-o outfilename -b' of a single dataset (-d) \n");
+ (void) HDfprintf(stdout,
+ "\t OR organized as \"CONFIG-KEYWORD VALUE\" pairs, one pair on each \n");
+ (void) HDfprintf(stdout, "\t line.\n\n");
+ (void) HDfprintf(stdout,
+ "\t The configuration file may have the following keywords each \n");
+ (void) HDfprintf(stdout, "\t followed by an acceptable value.\n\n");
+ (void) HDfprintf(stdout, "\t Required KEYWORDS:\n");
+ (void) HDfprintf(stdout, "\t PATH\n");
+ (void) HDfprintf(stdout, "\t INPUT-CLASS\n");
+ (void) HDfprintf(stdout, "\t INPUT-SIZE\n");
+ (void) HDfprintf(stdout, "\t RANK\n");
+ (void) HDfprintf(stdout, "\t DIMENSION-SIZES\n");
+ (void) HDfprintf(stdout, "\t OUTPUT-CLASS\n");
+ (void) HDfprintf(stdout, "\t OUTPUT-SIZE\n\n");
+ (void) HDfprintf(stdout, "\t Optional KEYWORDS:\n");
+ (void) HDfprintf(stdout, "\t OUTPUT-ARCHITECTURE\n");
+ (void) HDfprintf(stdout, "\t OUTPUT-BYTE-ORDER\n");
+ (void) HDfprintf(stdout, "\t CHUNKED-DIMENSION-SIZES\n");
+ (void) HDfprintf(stdout, "\t COMPRESSION-TYPE\n");
+ (void) HDfprintf(stdout, "\t COMPRESSION-PARAM\n");
+ (void) HDfprintf(stdout, "\t EXTERNAL-STORAGE\n");
+ (void) HDfprintf(stdout, "\t MAXIMUM-DIMENSIONS\n\n\n");
+ (void) HDfprintf(stdout, "\t Values for keywords:\n");
+ (void) HDfprintf(stdout, "\t PATH:\n");
+ (void) HDfprintf(stdout, "\t Strings separated by spaces to represent\n");
+ (void) HDfprintf(stdout, "\t the path of the data-set. If the groups in\n");
+ (void) HDfprintf(stdout,
+ "\t the path do not exist, they will be created. \n");
+ (void) HDfprintf(stdout, "\t For example,\n");
+ (void) HDfprintf(stdout, "\t PATH grp1/grp2/dataset1\n");
+ (void) HDfprintf(stdout, "\t PATH: keyword\n");
+ (void) HDfprintf(stdout, "\t grp1: group under the root. If\n");
+ (void) HDfprintf(stdout, "\t non-existent will be created.\n");
+ (void) HDfprintf(stdout, "\t grp2: group under grp1. If \n");
+ (void) HDfprintf(stdout, "\t non-existent will be created \n");
+ (void) HDfprintf(stdout, "\t under grp1.\n");
+ (void) HDfprintf(stdout, "\t dataset1: the name of the data-set \n");
+ (void) HDfprintf(stdout, "\t to be created.\n\n");
+ (void) HDfprintf(stdout, "\t INPUT-CLASS:\n");
+ (void) HDfprintf(stdout, "\t String denoting the type of input data.\n");
+ (void) HDfprintf(stdout, "\t (\"TEXTIN\", \"TEXTFP\", \"FP\", \"IN\", \n");
+ (void) HDfprintf(stdout, "\t \"STR\", \"TEXTUIN\", \"UIN\"). \n");
+ (void) HDfprintf(stdout,
+ "\t INPUT-CLASS \"TEXTIN\" denotes an ASCII text \n");
+ (void) HDfprintf(stdout,
+ "\t file with signed integer data in ASCII form,\n");
+ (void) HDfprintf(stdout,
+ "\t INPUT-CLASS \"TEXTUIN\" denotes an ASCII text \n");
+ (void) HDfprintf(stdout,
+ "\t file with unsigned integer data in ASCII form,\n");
+ (void) HDfprintf(stdout,
+ "\t \"TEXTFP\" denotes an ASCII text file containing\n");
+ (void) HDfprintf(stdout, "\t floating point data in the fixed notation\n");
+ (void) HDfprintf(stdout, "\t (325.34),\n");
+ (void) HDfprintf(stdout,
+ "\t \"FP\" denotes a floating point binary file,\n");
+ (void) HDfprintf(stdout,
+ "\t \"IN\" denotes a signed integer binary file,\n");
+ (void) HDfprintf(stdout,
+ "\t \"UIN\" denotes an unsigned integer binary file,\n");
+ (void) HDfprintf(stdout, "\t & \"STR\" denotes an ASCII text file the \n");
+ (void) HDfprintf(stdout,
+ "\t contents of which should be stored as an 1-D \n");
+ (void) HDfprintf(stdout, "\t array of strings.\n");
+ (void) HDfprintf(stdout, "\t If INPUT-CLASS is \"STR\", then RANK, \n");
+ (void) HDfprintf(stdout,
+ "\t DIMENSION-SIZES, OUTPUT-CLASS, OUTPUT-SIZE, \n");
+ (void) HDfprintf(stdout, "\t OUTPUT-ARCHITECTURE and OUTPUT-BYTE-ORDER \n");
+ (void) HDfprintf(stdout, "\t will be ignored.\n\n\n");
+ (void) HDfprintf(stdout, "\t INPUT-SIZE:\n");
+ (void) HDfprintf(stdout,
+ "\t Integer denoting the size of the input data \n");
+ (void) HDfprintf(stdout, "\t (8, 16, 32, 64). \n\n");
+ (void) HDfprintf(stdout, "\t For floating point,\n");
+ (void) HDfprintf(stdout, "\t INPUT-SIZE can be 32 or 64.\n");
+ (void) HDfprintf(stdout, "\t For integers (signed and unsigned)\n");
+ (void) HDfprintf(stdout, "\t INPUT-SIZE can be 8, 16, 32 or 64.\n\n");
+ (void) HDfprintf(stdout, "\t RANK:\n");
+ (void) HDfprintf(stdout,
+ "\t Integer denoting the number of dimensions.\n\n");
+ (void) HDfprintf(stdout, "\t DIMENSION-SIZES:\n");
+ (void) HDfprintf(stdout,
+ "\t Integers separated by spaces to denote the \n");
+ (void) HDfprintf(stdout, "\t dimension sizes for the no. of dimensions \n");
+ (void) HDfprintf(stdout, "\t determined by rank.\n\n");
+ (void) HDfprintf(stdout, "\t OUTPUT-CLASS:\n");
+ (void) HDfprintf(stdout,
+ "\t String dentoting data type of the dataset to \n");
+ (void) HDfprintf(stdout, "\t be written (\"IN\",\"FP\", \"UIN\")\n\n");
+ (void) HDfprintf(stdout, "\t OUTPUT-SIZE:\n");
+ (void) HDfprintf(stdout,
+ "\t Integer denoting the size of the data in the \n");
+ (void) HDfprintf(stdout, "\t output dataset to be written.\n");
+ (void) HDfprintf(stdout,
+ "\t If OUTPUT-CLASS is \"FP\", OUTPUT-SIZE can be \n");
+ (void) HDfprintf(stdout, "\t 32 or 64.\n");
+ (void) HDfprintf(stdout,
+ "\t If OUTPUT-CLASS is \"IN\" or \"UIN\", OUTPUT-SIZE\n");
+ (void) HDfprintf(stdout, "\t can be 8, 16, 32 or 64.\n\n");
+ (void) HDfprintf(stdout, "\t OUTPUT-ARCHITECTURE:\n");
+ (void) HDfprintf(stdout, "\t STRING denoting the type of output \n");
+ (void) HDfprintf(stdout,
+ "\t architecture. Can accept the following values\n");
+ (void) HDfprintf(stdout, "\t STD\n");
+ (void) HDfprintf(stdout, "\t IEEE\n");
+ (void) HDfprintf(stdout, "\t INTEL\n");
+ (void) HDfprintf(stdout, "\t CRAY\n");
+ (void) HDfprintf(stdout, "\t MIPS\n");
+ (void) HDfprintf(stdout, "\t ALPHA\n");
+ (void) HDfprintf(stdout, "\t NATIVE (default)\n");
+ (void) HDfprintf(stdout, "\t UNIX\n\n");
+ (void) HDfprintf(stdout, "\t OUTPUT-BYTE-ORDER:\n");
+ (void) HDfprintf(stdout,
+ "\t String denoting the output-byte-order. Ignored\n");
+ (void) HDfprintf(stdout,
+ "\t if the OUTPUT-ARCHITECTURE is not specified or\n");
+ (void) HDfprintf(stdout, "\t if it is IEEE, UNIX or STD. Can accept the \n");
+ (void) HDfprintf(stdout, "\t following values.\n");
+ (void) HDfprintf(stdout, "\t BE (default)\n");
+ (void) HDfprintf(stdout, "\t LE\n\n");
+ (void) HDfprintf(stdout, "\t CHUNKED-DIMENSION-SIZES:\n");
+ (void) HDfprintf(stdout, "\t Integers separated by spaces to denote the \n");
+ (void) HDfprintf(stdout,
+ "\t dimension sizes of the chunk for the no. of \n");
+ (void) HDfprintf(stdout,
+ "\t dimensions determined by rank. Required field\n");
+ (void) HDfprintf(stdout,
+ "\t to denote that the dataset will be stored with\n");
+ (void) HDfprintf(stdout,
+ "\t chunked storage. If this field is absent the\n");
+ (void) HDfprintf(stdout,
+ "\t dataset will be stored with contiguous storage.\n\n");
+ (void) HDfprintf(stdout, "\t COMPRESSION-TYPE:\n");
+ (void) HDfprintf(stdout,
+ "\t String denoting the type of compression to be\n");
+ (void) HDfprintf(stdout, "\t used with the chunked storage. Requires the\n");
+ (void) HDfprintf(stdout,
+ "\t CHUNKED-DIMENSION-SIZES to be specified. The only \n");
+ (void) HDfprintf(stdout,
+ "\t currently supported compression method is GZIP. \n");
+ (void) HDfprintf(stdout, "\t Will accept the following value\n");
+ (void) HDfprintf(stdout, "\t GZIP\n\n");
+ (void) HDfprintf(stdout, "\t COMPRESSION-PARAM:\n");
+ (void) HDfprintf(stdout,
+ "\t Integer used to denote compression level and \n");
+ (void) HDfprintf(stdout, "\t this option is to be always specified when \n");
+ (void) HDfprintf(stdout,
+ "\t the COMPRESSION-TYPE option is specified. The\n");
+ (void) HDfprintf(stdout, "\t values are applicable only to GZIP \n");
+ (void) HDfprintf(stdout, "\t compression.\n");
+ (void) HDfprintf(stdout, "\t Value 1-9: The level of Compression. \n");
+ (void) HDfprintf(stdout, "\t 1 will result in the fastest \n");
+ (void) HDfprintf(stdout, "\t compression while 9 will result in \n");
+ (void) HDfprintf(stdout, "\t the best compression ratio. The default\n");
+ (void) HDfprintf(stdout, "\t level of compression is 6.\n\n");
+ (void) HDfprintf(stdout, "\t EXTERNAL-STORAGE:\n");
+ (void) HDfprintf(stdout,
+ "\t String to denote the name of the non-HDF5 file \n");
+ (void) HDfprintf(stdout,
+ "\t to store data to. Cannot be used if CHUNKED-\n");
+ (void) HDfprintf(stdout,
+ "\t DIMENSIONS or COMPRESSION-TYPE or EXTENDIBLE-\n");
+ (void) HDfprintf(stdout, "\t DATASET is specified.\n");
+ (void) HDfprintf(stdout, "\t Value <external-filename>: the name of the \n");
+ (void) HDfprintf(stdout, "\t external file as a string to be used.\n\n");
+ (void) HDfprintf(stdout, "\t MAXIMUM-DIMENSIONS:\n");
+ (void) HDfprintf(stdout, "\t Integers separated by spaces to denote the \n");
+ (void) HDfprintf(stdout, "\t maximum dimension sizes of all the \n");
+ (void) HDfprintf(stdout, "\t dimensions determined by rank. Requires the\n");
+ (void) HDfprintf(stdout,
+ "\t CHUNKED-DIMENSION-SIZES to be specified. A value of \n");
+ (void) HDfprintf(stdout, "\t -1 for any dimension implies UNLIMITED \n");
+ (void) HDfprintf(stdout,
+ "\t DIMENSION size for that particular dimension.\n\n");
+ (void) HDfprintf(stdout, "\t EXAMPLES:\n");
+ (void) HDfprintf(stdout, "\t 1. Configuration File may look like:\n\n");
+ (void) HDfprintf(stdout, "\t PATH work h5 pkamat First-set\n");
+ (void) HDfprintf(stdout, "\t INPUT-CLASS TEXTFP\n");
+ (void) HDfprintf(stdout, "\t RANK 3\n");
+ (void) HDfprintf(stdout, "\t DIMENSION-SIZES 5 2 4\n");
+ (void) HDfprintf(stdout, "\t OUTPUT-CLASS FP\n");
+ (void) HDfprintf(stdout, "\t OUTPUT-SIZE 64\n");
+ (void) HDfprintf(stdout, "\t OUTPUT-ARCHITECTURE IEEE\n");
+ (void) HDfprintf(stdout, "\t OUTPUT-BYTE-ORDER LE\n");
+ (void) HDfprintf(stdout, "\t CHUNKED-DIMENSION-SIZES 2 2 2 \n\n");
+ (void) HDfprintf(stdout,
+ "\t The above configuration will accept a floating point array \n");
+ (void) HDfprintf(stdout,
+ "\t (5 x 2 x 4) in an ASCII file with the rank and dimension sizes \n");
+ (void) HDfprintf(stdout,
+ "\t specified and will save it in a chunked data-set (of pattern \n");
+ (void) HDfprintf(stdout,
+ "\t 2 X 2 X 2) of 64-bit floating point in the little-endian order \n");
+ (void) HDfprintf(stdout,
+ "\t and IEEE architecture. The dataset will be stored at\n");
+ (void) HDfprintf(stdout, "\t \"/work/h5/pkamat/First-set\"\n\n");
+ (void) HDfprintf(stdout, "\t 2. Another configuration could be:\n\n");
+ (void) HDfprintf(stdout, "\t PATH Second-set\n");
+ (void) HDfprintf(stdout, "\t INPUT-CLASS IN \n");
+ (void) HDfprintf(stdout, "\t RANK 5\n");
+ (void) HDfprintf(stdout, "\t DIMENSION-SIZES 6 3 5 2 4\n");
+ (void) HDfprintf(stdout, "\t OUTPUT-CLASS IN\n");
+ (void) HDfprintf(stdout, "\t OUTPUT-SIZE 32\n");
+ (void) HDfprintf(stdout, "\t CHUNKED-DIMENSION-SIZES 2 2 2 2 2\n");
+ (void) HDfprintf(stdout, "\t EXTENDIBLE-DATASET 1 3 \n");
+ (void) HDfprintf(stdout, "\t COMPRESSION-TYPE GZIP\n");
+ (void) HDfprintf(stdout, "\t COMPRESSION-PARAM 7\n\n\n");
+ (void) HDfprintf(stdout,
+ "\t The above configuration will accept an integer array \n");
+ (void) HDfprintf(stdout,
+ "\t (6 X 3 X 5 x 2 x 4) in a binary file with the rank and \n");
+ (void) HDfprintf(stdout,
+ "\t dimension sizes specified and will save it in a chunked data-set\n");
+ (void) HDfprintf(stdout,
+ "\t (of pattern 2 X 2 X 2 X 2 X 2) of 32-bit floating point in \n");
+ (void) HDfprintf(stdout,
+ "\t native format (as output-architecture is not specified). The \n");
+ (void) HDfprintf(stdout,
+ "\t first and the third dimension will be defined as unlimited. The \n");
+ (void) HDfprintf(stdout,
+ "\t data-set will be compressed using GZIP and a compression level \n");
+ (void) HDfprintf(stdout, "\t of 7.\n");
+ (void) HDfprintf(stdout,
+ "\t The dataset will be stored at \"/Second-set\"\n\n");
+ return;
+}
+
+void usage(char *name)
+{
+ (void) HDfprintf(stdout, "\nUsage:\t%s -h[elp], OR\n", name);
+ (void) HDfprintf(stdout,
+ "\t%s <infile> -c[onfig] <configfile> \
+ [<infile> -c[config] <configfile>...] -o[utfile] <outfile> \n\n", name);
+ return;
+}
+
diff --git a/tools/src/h5import/h5import.h b/tools/src/h5import/h5import.h
new file mode 100644
index 0000000..c242483
--- /dev/null
+++ b/tools/src/h5import/h5import.h
@@ -0,0 +1,198 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ *
+ * Data and structure definitions for h5import
+ *
+ */
+
+#ifndef H5IMPORT_H__
+#define H5IMPORT_H__
+
+/*
+ * state table tokens
+ */
+#define FILNAME 0
+/* filename */
+#define OPT_o 1
+/* output filename */
+#define OPT_c 2 /* configuration filename */
+#define OPT_h 3 /* request for explanation */
+#define OPT_d 4 /* dimensions */
+#define OPT_p 5 /* pathname */
+#define OPT_t 6 /* data type */
+#define OPT_s 7 /* data size */
+#define ERR 20 /* invalid token */
+
+#define MAX_GROUPS_IN_PATH 20
+#define MAX_PATH_NAME_LENGTH 255
+#define NUM_KEYS 14
+#define MIN_NUM_DIMENSION 1
+#define MAX_NUM_DIMENSION 32
+#define BASE_10 10
+
+#define PATH 0
+#define INPUT_CLASS 1
+#define INPUT_SIZE 2
+#define RANK 3
+#define DIM 4
+#define OUTPUT_CLASS 5
+#define OUTPUT_SIZE 6
+#define OUTPUT_ARCH 7
+#define OUTPUT_B_ORDER 8
+#define CHUNK 9
+#define COMPRESS 10
+#define COMPRESS_PARAM 11
+#define EXTERNALSTORE 12
+#define EXTEND 13
+
+/* data types */
+#define H5DT_INT8 signed char
+#define H5DT_INT16 short
+#define H5DT_INT32 int
+#define H5DT_FLOAT32 float
+#define H5DT_FLOAT64 double
+#define VOIDP void*
+#define H5DT_UINT8 unsigned char
+#define H5DT_UINT16 unsigned short
+#define H5DT_UINT32 unsigned int
+#define H5DT_INT64 long long
+#define H5DT_UINT64 unsigned H5DT_INT64
+
+struct path_info
+{
+ char group[MAX_GROUPS_IN_PATH][MAX_PATH_NAME_LENGTH];
+ int count;
+};
+
+struct Input
+{
+ int h5dumpInput;
+ struct path_info path;
+ int inputClass;
+ int inputSize;
+ int rank;
+ hsize_t* sizeOfDimension;
+ int outputClass;
+ int outputSize;
+ int outputArchitecture;
+ int outputByteOrder;
+ hsize_t* sizeOfChunk;
+ hsize_t* maxsizeOfDimension;
+ int compressionType;
+ int compressionParam;
+ char *externFilename;
+ VOIDP data;
+ int configOptionVector[NUM_KEYS];
+};
+
+struct infilesformat
+{
+ char datafile[255];
+ char configfile[255];
+ struct Input in;
+ int config; /* Configfile present? No - 0. Yes - 1 */
+};
+
+struct Options
+{
+ struct infilesformat infiles[30]; /* structure to hold the list of input file names. Limited to 30*/
+ char outfile[256]; /* output file name */
+ int fcount; /* number of input files */
+};
+
+char keytable[NUM_KEYS][30] = {
+ "PATH",
+ "INPUT-CLASS",
+ "INPUT-SIZE",
+ "RANK",
+ "DIMENSION-SIZES",
+ "OUTPUT-CLASS",
+ "OUTPUT-SIZE",
+ "OUTPUT-ARCHITECTURE",
+ "OUTPUT-BYTE-ORDER",
+ "CHUNKED-DIMENSION-SIZES",
+ "COMPRESSION-TYPE",
+ "COMPRESSION-PARAM",
+ "EXTERNAL-STORAGE",
+ "MAXIMUM-DIMENSIONS"
+};
+
+static int state_table[15][8] =
+{
+ /* token ordering: FILNAME OPT_o OPT_c OPT_h OPT_d OPT_p OPT_t OPT_s */
+
+ /* state 0: start */
+ {1, ERR, ERR, 6, ERR, ERR, ERR, ERR},
+
+ /* state 1: input files */
+ {ERR, ERR, 2, ERR, 7, ERR, ERR, ERR},
+
+ /* state 2: -c[onfigfile] */
+ {3, ERR, ERR, ERR, ERR, ERR, ERR, ERR},
+
+ /* state 3: configfile */
+ {1, 4, ERR, ERR, ERR, ERR, ERR, ERR},
+
+ /* state 4: -o[utfile] */
+ {5, ERR, ERR, ERR, ERR, ERR, ERR, ERR},
+
+ /* state 5: outfile */
+ {ERR, ERR, ERR, ERR, ERR, ERR, ERR, ERR},
+
+ /* state 6: -h[elp] */
+ {ERR, ERR, ERR, ERR, ERR, ERR, ERR, ERR},
+
+ /* state 7: -d[ims] */
+ {8, ERR, ERR, ERR, ERR, ERR, ERR, ERR},
+
+ /* state 8: dimensions */
+ {1, 4, ERR, ERR, ERR, 9, 11, 13},
+
+ /* state 9: -p[ath] */
+ {10, ERR, ERR, ERR, ERR, ERR, ERR, ERR},
+
+ /* state 10: path name */
+ {1, 4, ERR, ERR, ERR, ERR, 11, 13},
+
+ /* state 11: -t[ype] */
+ {12, ERR, ERR, ERR, ERR, ERR, ERR, ERR},
+
+ /* state 12: data type */
+ {1, 4, ERR, ERR, ERR, ERR, ERR, 13},
+
+ /* state 13: -s[ize] */
+ {14, ERR, ERR, ERR, ERR, ERR, ERR, ERR},
+
+ /* state 14: data size */
+ {1, 4, ERR, ERR, ERR, ERR, ERR, ERR}
+
+};
+
+/*
+ *
+ * Function declarations for h5import
+ *
+ */
+void usage(char *);
+void setDefaultValues(struct Input *in, int count);
+void help(char *);
+
+hid_t createOutputDataType(struct Input *in);
+hid_t createInputDataType(struct Input *in);
+
+#endif /* H5IMPORT_H__ */
+
diff --git a/tools/src/h5jam/CMakeLists.txt b/tools/src/h5jam/CMakeLists.txt
new file mode 100644
index 0000000..cef54c2
--- /dev/null
+++ b/tools/src/h5jam/CMakeLists.txt
@@ -0,0 +1,49 @@
+cmake_minimum_required (VERSION 3.1.0)
+PROJECT (HDF5_TOOLS_SRC_H5JAM)
+
+#-----------------------------------------------------------------------------
+# Setup include Directories
+#-----------------------------------------------------------------------------
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib)
+
+# --------------------------------------------------------------------
+# Add the h5jam executables
+# --------------------------------------------------------------------
+add_executable (h5jam ${HDF5_TOOLS_SRC_H5JAM_SOURCE_DIR}/h5jam.c)
+TARGET_NAMING (h5jam STATIC)
+TARGET_C_PROPERTIES (h5jam STATIC " " " ")
+target_link_libraries (h5jam ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+set_target_properties (h5jam PROPERTIES FOLDER tools)
+set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5jam")
+
+add_executable (h5unjam ${HDF5_TOOLS_SRC_H5JAM_SOURCE_DIR}/h5unjam.c)
+TARGET_NAMING (h5unjam STATIC)
+TARGET_C_PROPERTIES (h5unjam STATIC " " " ")
+target_link_libraries (h5unjam ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+set_target_properties (h5unjam PROPERTIES FOLDER tools)
+set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5unjam")
+
+set (H5_DEP_EXECUTABLES
+ h5jam
+ h5unjam
+)
+
+##############################################################################
+##############################################################################
+### I N S T A L L A T I O N ###
+##############################################################################
+##############################################################################
+
+#-----------------------------------------------------------------------------
+# Rules for Installation of tools using make Install target
+#-----------------------------------------------------------------------------
+
+#INSTALL_PROGRAM_PDB (h5jam ${HDF5_INSTALL_BIN_DIR} toolsapplications)
+
+install (
+ TARGETS
+ h5jam h5unjam
+ EXPORT
+ ${HDF5_EXPORTED_TARGETS}
+ RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications
+)
diff --git a/tools/src/h5jam/Makefile.am b/tools/src/h5jam/Makefile.am
new file mode 100644
index 0000000..e244625
--- /dev/null
+++ b/tools/src/h5jam/Makefile.am
@@ -0,0 +1,35 @@
+#
+# 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.
+##
+## Makefile.am
+## Run automake to generate a Makefile.in from this file.
+#
+# HDF5 Library Makefile(.in)
+#
+
+include $(top_srcdir)/config/commence.am
+
+# Include src and tools/lib directories
+AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib
+
+bin_PROGRAMS=h5jam h5unjam
+
+# Add h5jam and h5unjam specific linker flags here
+h5jam_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+h5unjam_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+
+# Link against the main HDF5 library and tools library
+LDADD=$(LIBH5TOOLS) $(LIBHDF5)
+
+include $(top_srcdir)/config/conclude.am
diff --git a/tools/src/h5jam/h5jam.c b/tools/src/h5jam/h5jam.c
new file mode 100644
index 0000000..ae45714
--- /dev/null
+++ b/tools/src/h5jam/h5jam.c
@@ -0,0 +1,571 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include "hdf5.h"
+#include "H5private.h"
+#include "h5tools.h"
+#include "h5tools_utils.h"
+
+/* Name of tool */
+#define PROGRAMNAME "h5jam"
+
+herr_t write_pad(int ofile, hsize_t old_where, hsize_t *new_where);
+hsize_t compute_user_block_size (hsize_t);
+hsize_t copy_some_to_file (int, int, hsize_t, hsize_t, ssize_t);
+void parse_command_line (int, const char *[]);
+
+int do_clobber = FALSE;
+char *output_file = NULL;
+char *input_file = NULL;
+char *ub_file = NULL;
+
+/*
+ * Command-line options: The user can specify short or long-named
+ * parameters. The long-named ones can be partially spelled. When
+ * adding more, make sure that they don't clash with each other.
+ */
+static const char *s_opts = "hi:u:o:c:V"; /* add more later ? */
+static struct long_options l_opts[] = {
+ {"help", no_arg, 'h'},
+ {"hel", no_arg, 'h'},
+ {"i", require_arg, 'i'}, /* input file */
+ {"u", require_arg, 'u'}, /* user block file */
+ {"o", require_arg, 'o'}, /* output file */
+ {"clobber", no_arg, 'c'}, /* clobber existing UB */
+ {"clobbe", no_arg, 'c'},
+ {"clobb", no_arg, 'c'},
+ {"clob", no_arg, 'c'},
+ {"clo", no_arg, 'c'},
+ {"cl", no_arg, 'c'},
+ {NULL, 0, '\0'}
+};
+
+/*-------------------------------------------------------------------------
+ * Function: usage
+ *
+ * Purpose: Print the usage message
+ *
+ * Return: void
+ *
+ * Programmer:
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+usage (const char *prog)
+{
+ HDfflush (stdout);
+ HDfprintf (stdout,
+ "usage: %s -i <in_file.h5> -u <in_user_file> [-o <out_file.h5>] [--clobber]\n", prog);
+ HDfprintf (stdout, "\n");
+ HDfprintf (stdout,
+ "Adds user block to front of an HDF5 file and creates a new concatenated file.\n");
+ HDfprintf (stdout, "\n");
+ HDfprintf (stdout,
+ "OPTIONS\n");
+ HDfprintf (stdout,
+ " -i in_file.h5 Specifies the input HDF5 file.\n");
+ HDfprintf (stdout,
+ " -u in_user_file Specifies the file to be inserted into the user block.\n");
+ HDfprintf (stdout,
+ " Can be any file format except an HDF5 format.\n");
+ HDfprintf (stdout,
+ " -o out_file.h5 Specifies the output HDF5 file.\n");
+ HDfprintf (stdout,
+ " If not specified, the user block will be concatenated in\n");
+ HDfprintf (stdout,
+ " place to the input HDF5 file.\n");
+ HDfprintf (stdout,
+ " --clobber Wipes out any existing user block before concatenating\n");
+ HDfprintf (stdout,
+ " the given user block.\n");
+ HDfprintf (stdout,
+ " The size of the new user block will be the larger of;\n");
+ HDfprintf (stdout,
+ " - the size of existing user block in the input HDF5 file\n");
+ HDfprintf (stdout,
+ " - the size of user block required by new input user file\n");
+ HDfprintf (stdout,
+ " (size = 512 x 2N, N is positive integer.)\n");
+ HDfprintf (stdout, "\n");
+ HDfprintf (stdout,
+ " -h Prints a usage message and exits.\n");
+ HDfprintf (stdout,
+ " -V Prints the HDF5 library version and exits.\n");
+ HDfprintf (stdout, "\n");
+ HDfprintf (stdout,
+ "Exit Status:\n");
+ HDfprintf (stdout,
+ " 0 Succeeded.\n");
+ HDfprintf (stdout,
+ " >0 An error occurred.\n");
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: leave
+ *
+ * Purpose: Shutdown and call exit()
+ *
+ * Return: Does not return
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+leave(int ret)
+{
+ if (ub_file)
+ HDfree (ub_file);
+ if (input_file)
+ HDfree (input_file);
+ if (output_file)
+ HDfree (output_file);
+
+ h5tools_close();
+
+ HDexit(ret);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: parse_command_line
+ *
+ * Purpose: Parse the command line for the h5dumper.
+ *
+ * Return: Success:
+ *
+ * Failure: Exits program with EXIT_FAILURE value.
+ *
+ * Programmer:
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+
+void
+parse_command_line (int argc, const char *argv[])
+{
+ int opt = FALSE;
+
+ /* parse command line options */
+ while ((opt = get_option (argc, argv, s_opts, l_opts)) != EOF)
+ {
+ switch ((char) opt)
+ {
+ case 'o':
+ output_file = HDstrdup (opt_arg);
+ break;
+ case 'i':
+ input_file = HDstrdup (opt_arg);
+ break;
+ case 'u':
+ ub_file = HDstrdup (opt_arg);
+ break;
+ case 'c':
+ do_clobber = TRUE;
+ break;
+ case 'h':
+ usage (h5tools_getprogname());
+ leave (EXIT_SUCCESS);
+ case 'V':
+ print_version (h5tools_getprogname());
+ leave (EXIT_SUCCESS);
+ case '?':
+ default:
+ usage (h5tools_getprogname());
+ leave (EXIT_FAILURE);
+ }
+ }
+}
+
+/*-------------------------------------------------------------------------
+ * Function: main
+ *
+ * Purpose: HDF5 user block jammer
+ *
+ * Return: Success: 0
+ * Failure: 1
+ *
+ * Programmer:
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+main (int argc, const char *argv[])
+{
+ int ufid = -1;
+ int h5fid = -1;
+ int ofid = -1;
+ void *edata;
+ H5E_auto2_t func;
+ hid_t ifile = -1;
+ hid_t plist = -1;
+ herr_t status;
+ htri_t testval;
+ hsize_t usize;
+ hsize_t h5fsize;
+ hsize_t startub;
+ hsize_t where;
+ hsize_t newubsize;
+ off_t fsize;
+ h5_stat_t sbuf;
+ h5_stat_t sbuf2;
+ int res;
+
+ h5tools_setprogname(PROGRAMNAME);
+ h5tools_setstatus(EXIT_SUCCESS);
+
+ /* Disable error reporting */
+ H5Eget_auto2(H5E_DEFAULT, &func, &edata);
+ H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
+
+ /* Initialize h5tools lib */
+ h5tools_init();
+
+ parse_command_line (argc, argv);
+
+ if (ub_file == NULL) {
+ /* no user block */
+ error_msg("missing arguemnt for -u <user_file>.\n");
+ help_ref_msg(stderr);
+ leave (EXIT_FAILURE);
+ }
+
+ testval = H5Fis_hdf5 (ub_file);
+
+ if (testval > 0) {
+ error_msg("-u <user_file> cannot be HDF5 file, but it appears to be an HDF5 file.\n");
+ help_ref_msg(stderr);
+ leave (EXIT_FAILURE);
+ }
+
+ if (input_file == NULL) {
+ error_msg("missing arguemnt for -i <HDF5 file>.\n");
+ help_ref_msg(stderr);
+ leave (EXIT_FAILURE);
+ }
+
+ testval = H5Fis_hdf5 (input_file);
+
+ if (testval <= 0) {
+ error_msg("Input HDF5 file \"%s\" is not HDF5 format.\n", input_file);
+ help_ref_msg(stderr);
+ leave (EXIT_FAILURE);
+ }
+
+ ifile = H5Fopen (input_file, H5F_ACC_RDONLY, H5P_DEFAULT);
+
+ if (ifile < 0) {
+ error_msg("Can't open input HDF5 file \"%s\"\n", input_file);
+ leave (EXIT_FAILURE);
+ }
+
+ plist = H5Fget_create_plist (ifile);
+ if (plist < 0) {
+ error_msg("Can't get file creation plist for file \"%s\"\n", input_file);
+ H5Fclose(ifile);
+ leave (EXIT_FAILURE);
+ }
+
+ status = H5Pget_userblock (plist, &usize);
+ if (status < 0) {
+ error_msg("Can't get user block for file \"%s\"\n", input_file);
+ H5Pclose(plist);
+ H5Fclose(ifile);
+ leave (EXIT_FAILURE);
+ }
+
+ H5Pclose(plist);
+ H5Fclose(ifile);
+
+ ufid = HDopen(ub_file, O_RDONLY, 0);
+ if(ufid < 0) {
+ error_msg("unable to open user block file \"%s\"\n", ub_file);
+ leave (EXIT_FAILURE);
+ }
+
+ res = HDfstat(ufid, &sbuf);
+ if(res < 0) {
+ error_msg("Can't stat file \"%s\"\n", ub_file);
+ HDclose (ufid);
+ leave (EXIT_FAILURE);
+ }
+
+ fsize = (off_t)sbuf.st_size;
+
+ h5fid = HDopen(input_file, O_RDONLY, 0);
+ if(h5fid < 0) {
+ error_msg("unable to open HDF5 file for read \"%s\"\n", input_file);
+ HDclose (ufid);
+ leave (EXIT_FAILURE);
+ }
+
+ res = HDfstat(h5fid, &sbuf2);
+ if(res < 0) {
+ error_msg("Can't stat file \"%s\"\n", input_file);
+ HDclose (h5fid);
+ HDclose (ufid);
+ leave (EXIT_FAILURE);
+ }
+
+ h5fsize = (hsize_t)sbuf2.st_size;
+
+ if (output_file == NULL) {
+ ofid = HDopen (input_file, O_WRONLY, 0);
+
+ if (ofid < 0) {
+ error_msg("unable to open output file \"%s\"\n", output_file);
+ HDclose (h5fid);
+ HDclose (ufid);
+ leave (EXIT_FAILURE);
+ }
+ }
+ else {
+ ofid = HDopen (output_file, O_WRONLY | O_CREAT | O_TRUNC, 0644);
+
+ if (ofid < 0) {
+ error_msg("unable to create output file \"%s\"\n", output_file);
+ HDclose (h5fid);
+ HDclose (ufid);
+ leave (EXIT_FAILURE);
+ }
+ }
+
+ newubsize = compute_user_block_size ((hsize_t) fsize);
+
+ startub = usize;
+
+ if (usize > 0) {
+ if (do_clobber == TRUE) {
+ /* where is max of the current size or the new UB */
+ if (usize > newubsize) {
+ newubsize = usize;
+ }
+ startub = 0; /*blast the old */
+ }
+ else {
+ /* add new ub to current ublock, pad to new offset */
+ newubsize += usize;
+ newubsize = compute_user_block_size ((hsize_t) newubsize);
+ }
+ }
+
+ /* copy the HDF5 from starting at usize to starting at newubsize:
+ * makes room at 'from' for new ub */
+ /* if no current ub, usize is 0 */
+ copy_some_to_file (h5fid, ofid, usize, newubsize, (ssize_t) (h5fsize - usize));
+
+ /* copy the old ub to the beginning of the new file */
+ if (!do_clobber) {
+ where = copy_some_to_file (h5fid, ofid, (hsize_t) 0, (hsize_t) 0, (ssize_t) usize);
+ }
+
+ /* copy the new ub to the end of the ub */
+ where = copy_some_to_file (ufid, ofid, (hsize_t) 0, startub, (ssize_t) - 1);
+
+ /* pad the ub */
+ if(write_pad(ofid, where, &where) < 0) {
+ error_msg("Can't pad file \"%s\"\n", output_file);
+ HDclose (h5fid);
+ HDclose (ufid);
+ HDclose (ofid);
+ leave (EXIT_FAILURE);
+ } /* end if */
+
+ if(ub_file)
+ HDfree (ub_file);
+ if(input_file)
+ HDfree (input_file);
+ if(output_file)
+ HDfree (output_file);
+
+ if(ufid >= 0)
+ HDclose (ufid);
+ if(h5fid >= 0)
+ HDclose (h5fid);
+ if(ofid >= 0)
+ HDclose (ofid);
+
+ return h5tools_getstatus();
+}
+
+/*-------------------------------------------------------------------------
+ * Function: copy_some_to_file
+ *
+ * Purpose: Copy part of the input file to output.
+ * infid: fd of file to read
+ * outfid: fd of file to write
+ * startin: offset of where to read from infid
+ * startout: offset of where to write to outfid
+ * limit: bytes to read/write
+ *
+ * If limit is < 0, the entire input file is copied.
+ *
+ * Note: this routine can be used to copy within
+ * the same file, i.e., infid and outfid can be the
+ * same file.
+ *
+ * Return: Success: last byte written in the output.
+ * Failure: Exits program with EXIT_FAILURE value.
+ *
+ *-------------------------------------------------------------------------
+ */
+hsize_t
+copy_some_to_file(int infid, int outfid, hsize_t startin, hsize_t startout,
+ ssize_t limit)
+{
+ char buf[1024];
+ h5_stat_t sbuf;
+ int res;
+ ssize_t tot = 0;
+ ssize_t howmuch = 0;
+ ssize_t nchars = -1;
+ ssize_t to;
+ ssize_t from;
+ ssize_t toend;
+ ssize_t fromend;
+
+ if(startin > startout) {
+ /* this case is prohibited */
+ error_msg("copy_some_to_file: panic: startin > startout?\n");
+ exit (EXIT_FAILURE);
+ } /* end if */
+
+ if(limit < 0) {
+ res = HDfstat(infid, &sbuf);
+ if(res < 0) {
+ error_msg("Can't stat file \n");
+ HDexit(EXIT_FAILURE);
+ } /* end if */
+
+ howmuch = (ssize_t)sbuf.st_size;
+ } else {
+ howmuch = limit;
+ } /* end if */
+
+ if(0 == howmuch)
+ return 0;
+
+ toend = (ssize_t) startout + howmuch;
+ fromend = (ssize_t) startin + howmuch;
+
+ if (howmuch > 512) {
+ to = toend - 512;
+ from = fromend - 512;
+ } else {
+ to = toend - howmuch;
+ from = fromend - howmuch;
+ } /* end if */
+
+ while (howmuch > 0) {
+ HDlseek(outfid, (off_t) to, SEEK_SET);
+ HDlseek(infid, (off_t) from, SEEK_SET);
+
+ if (howmuch > 512) {
+ nchars = HDread(infid, buf, (unsigned) 512);
+ } else {
+ nchars = HDread(infid, buf, (unsigned)howmuch);
+ } /* end if */
+
+ if (nchars <= 0) {
+ error_msg("Read error \n");
+ HDexit(EXIT_FAILURE);
+ } /* end if */
+
+ if(HDwrite (outfid, buf, (unsigned) nchars) < 0) {
+ error_msg("Write error \n");
+ HDexit(EXIT_FAILURE);
+ }
+
+ tot += nchars;
+ howmuch -= nchars;
+ if(howmuch > 512) {
+ to -= nchars;
+ from -= nchars;
+ } else {
+ to -= howmuch;
+ from -= howmuch;
+ } /* end if */
+ } /* end while */
+
+ return (hsize_t)tot + (hsize_t)startout;
+} /* end copy_some_to_file() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: compute_user_block_size
+ *
+ * Purpose: Find the offset of the HDF5 header after the user block:
+ * align at 0, 512, 1024, etc.
+ * ublock_size: the size of the user block (bytes).
+ *
+ * Return: Success: the location of the header == the size of the
+ * padded user block.
+ * Failure: none
+ *
+ * Return: Success: last byte written in the output.
+ * Failure: Exits program with EXIT_FAILURE value.
+ *-------------------------------------------------------------------------
+ */
+H5_ATTR_CONST hsize_t
+compute_user_block_size(hsize_t ublock_size)
+{
+ hsize_t where = 512;
+
+ if(0 == ublock_size)
+ return 0;
+
+ while(where < ublock_size)
+ where *= 2;
+
+ return where;
+} /* end compute_user_block_size() */
+
+/*
+ * Write zeroes to fill the file from 'where' to 512, 1024, etc. bytes.
+ *
+ * Sets new_where to the size of the padded file and
+ * returns SUCCEED/FAIL.
+ */
+herr_t
+write_pad(int ofile, hsize_t old_where, hsize_t *new_where)
+{
+ unsigned int i;
+ char buf[1];
+ hsize_t psize;
+
+ HDassert(new_where);
+
+ buf[0] = '\0';
+
+ HDlseek(ofile, (off_t)old_where, SEEK_SET);
+
+ psize = compute_user_block_size(old_where);
+ psize -= old_where;
+
+ for(i = 0; i < psize; i++)
+ if(HDwrite(ofile, buf, 1) < 0)
+ return FAIL;
+
+ /* Set the new size of the file. */
+ *new_where = old_where + psize;
+
+ return SUCCEED;
+} /* end write_pad() */
+
diff --git a/tools/src/h5jam/h5unjam.c b/tools/src/h5jam/h5unjam.c
new file mode 100644
index 0000000..8f88398
--- /dev/null
+++ b/tools/src/h5jam/h5unjam.c
@@ -0,0 +1,411 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include "hdf5.h"
+#include "H5private.h"
+#include "h5tools.h"
+#include "h5tools_utils.h"
+
+/* Name of tool */
+#define PROGRAMNAME "h5unjam"
+
+#define COPY_BUF_SIZE 1024
+
+hsize_t write_pad( int , hsize_t );
+hsize_t compute_pad( hsize_t );
+herr_t copy_to_file( FILE *, FILE * , ssize_t, ssize_t );
+
+int do_delete = FALSE;
+char *output_file = NULL;
+char *input_file = NULL;
+char *ub_file = NULL;
+
+/*
+ * Command-line options: The user can specify short or long-named
+ * parameters. The long-named ones can be partially spelled. When
+ * adding more, make sure that they don't clash with each other.
+ */
+static const char *s_opts = "hu:i:o:d:V";
+static struct long_options l_opts[] = {
+ { "help", no_arg, 'h' },
+ { "hel", no_arg, 'h' },
+ {"i", require_arg, 'i'}, /* input file */
+ {"u", require_arg, 'u'}, /* user block file */
+ {"o", require_arg, 'o'}, /* output file */
+ {"delete", no_arg, 'd'}, /* delete ub */
+ {"delet", no_arg, 'd'},
+ {"dele", no_arg, 'd'},
+ {"del", no_arg, 'd'},
+ {"de", no_arg, 'd'},
+ { NULL, 0, '\0' }
+};
+
+/*-------------------------------------------------------------------------
+ * Function: usage
+ *
+ * Purpose: Print the usage message
+ *
+ * Return: void
+ *
+ * Programmer:
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+usage(const char *prog)
+{
+ HDfflush(stdout);
+ HDfprintf(stdout,
+ "usage: %s -i <in_file.h5> [-o <out_file.h5> ] [-u <out_user_file> | --delete]\n", prog);
+ HDfprintf(stdout, "\n");
+ HDfprintf(stdout,
+ "Splits user file and HDF5 file into two files: user block data and HDF5 data.\n");
+ HDfprintf(stdout, "\n");
+ HDfprintf(stdout,
+ "OPTIONS\n");
+ HDfprintf(stdout,
+ " -i in_file.h5 Specifies the HDF5 as input. If the input HDF5 file\n");
+ HDfprintf(stdout,
+ " contains no user block, exit with an error message.\n");
+ HDfprintf(stdout,
+ " -o out_file.h5 Specifies output HDF5 file without a user block.\n");
+ HDfprintf(stdout,
+ " If not specified, the user block will be removed from the\n");
+ HDfprintf(stdout,
+ " input HDF5 file.\n");
+ HDfprintf(stdout,
+ " -u out_user_file\n");
+ HDfprintf(stdout,
+ " Specifies the output file containing the data from the\n");
+ HDfprintf(stdout,
+ " user block.\n");
+ HDfprintf(stdout,
+ " Cannot be used with --delete option.\n");
+ HDfprintf(stdout,
+ " --delete Remove the user block from the input HDF5 file. The content\n");
+ HDfprintf(stdout,
+ " of the user block is discarded.\n");
+ HDfprintf(stdout,
+ " Cannot be used with the -u option.\n");
+ HDfprintf(stdout, "\n");
+ HDfprintf(stdout,
+ " -h Prints a usage message and exits.\n");
+ HDfprintf(stdout,
+ " -V Prints the HDF5 library version and exits.\n");
+ HDfprintf(stdout, "\n");
+ HDfprintf(stdout,
+ " If neither --delete nor -u is specified, the user block from the input file\n");
+ HDfprintf(stdout,
+ " will be displayed to stdout.\n");
+ HDfprintf(stdout, "\n");
+ HDfprintf(stdout,
+ "Exit Status:\n");
+ HDfprintf(stdout,
+ " 0 Succeeded.\n");
+ HDfprintf(stdout,
+ " >0 An error occurred.\n");
+}
+
+/*-------------------------------------------------------------------------
+ * Function: parse_command_line
+ *
+ * Purpose: Parse the command line for the h5dumper.
+ *
+ * Return: Success: EXIT_SUCCESS;
+ *
+ * Failure: Exits function with EXIT_FAILURE value.
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+parse_command_line(int argc, const char *argv[])
+{
+ int opt = FALSE;
+
+ /* parse command line options */
+ while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) {
+ switch((char)opt) {
+ case 'o':
+ output_file = HDstrdup(opt_arg);
+ if (output_file)
+ h5tools_set_data_output_file(output_file, 1);
+ break;
+
+ case 'i':
+ input_file = HDstrdup(opt_arg);
+ if (input_file)
+ h5tools_set_input_file(input_file, 1);
+ break;;
+
+ case 'u':
+ ub_file = HDstrdup(opt_arg);
+ if (ub_file)
+ h5tools_set_output_file(ub_file, 1);
+ else
+ rawoutstream = stdout;
+ break;
+
+ case 'd':
+ do_delete = TRUE;
+ break;
+
+ case 'h':
+ usage(h5tools_getprogname());
+ h5tools_setstatus(EXIT_SUCCESS);
+ goto done;
+
+ case 'V':
+ print_version (h5tools_getprogname());
+ h5tools_setstatus(EXIT_SUCCESS);
+ goto done;
+
+ case '?':
+ default:
+ usage(h5tools_getprogname());
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
+ }
+ }
+
+ return EXIT_SUCCESS;
+
+done:
+ if(input_file)
+ HDfree(input_file);
+ if(output_file)
+ HDfree(output_file);
+ if(ub_file)
+ HDfree(ub_file);
+
+ return EXIT_FAILURE;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: main
+ *
+ * Purpose: HDF5 user block unjammer
+ *
+ * Return: Success: 0
+ * Failure: 1
+ *
+ * Programmer:
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+main(int argc, const char *argv[])
+{
+ void *edata;
+ H5E_auto2_t func;
+ hid_t ifile = -1;
+ hid_t plist = -1;
+ off_t fsize;
+ hsize_t usize;
+ htri_t testval;
+ herr_t status;
+ int res;
+ h5_stat_t sbuf;
+
+ h5tools_setprogname(PROGRAMNAME);
+ h5tools_setstatus(EXIT_SUCCESS);
+
+ /* Disable error reporting */
+ H5Eget_auto2(H5E_DEFAULT, &func, &edata);
+ H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
+
+ /* Initialize h5tools lib */
+ h5tools_init();
+
+ if(EXIT_FAILURE == parse_command_line(argc, argv))
+ goto done;
+
+ if (input_file == NULL) {
+ /* no user block */
+ error_msg("missing arguemnt for HDF5 file input.\n");
+ help_ref_msg(stderr);
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
+ }
+
+ testval = H5Fis_hdf5(input_file);
+
+ if (testval <= 0) {
+ error_msg("Input HDF5 file \"%s\" is not HDF\n", input_file);
+ help_ref_msg (stderr);
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
+ }
+
+ ifile = H5Fopen(input_file, H5F_ACC_RDONLY , H5P_DEFAULT);
+
+ if (ifile < 0) {
+ error_msg("Can't open input HDF5 file \"%s\"\n", input_file);
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
+ }
+
+ plist = H5Fget_create_plist(ifile);
+ if (plist < 0) {
+ error_msg("Can't get file creation plist for file \"%s\"\n", input_file);
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
+ }
+
+ status = H5Pget_userblock(plist, & usize);
+ if (status < 0) {
+ error_msg("Can't get user block for file \"%s\"\n", input_file);
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
+ }
+
+ status = H5Pclose(plist);
+ HDassert(status >= 0);
+ status = H5Fclose(ifile);
+ HDassert(status >= 0);
+
+ if (usize == 0) {
+ /* no user block to remove: message? */
+ error_msg("\"%s\" has no user block: no change to file\n", input_file);
+ h5tools_setstatus(EXIT_SUCCESS);
+ goto done;
+ }
+
+ res = HDfstat(HDfileno(rawinstream), &sbuf);
+ if(res < 0) {
+ error_msg("Can't stat file \"%s\"\n", input_file);
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
+ }
+
+ fsize = sbuf.st_size;
+
+ if (do_delete && (ub_file != NULL)) {
+ error_msg("??\"%s\"\n", ub_file);
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
+ }
+
+ if (output_file == NULL) {
+ error_msg("unable to open output HDF5 file \"%s\"\n", input_file);
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
+ }
+
+ /* copy from 0 to 'usize - 1' into ufid */
+ if (!do_delete) {
+ if(copy_to_file(rawinstream, rawoutstream, 0, (ssize_t) usize) < 0) {
+ error_msg("unable to copy user block to output file \"%s\"\n", ub_file);
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
+ }
+ }
+
+ /* copy from usize to end of file into h5fid,
+ * starting at end of user block if present */
+ if(copy_to_file(rawinstream, rawdatastream, (ssize_t) usize, (ssize_t)(fsize - (ssize_t)usize)) < 0) {
+ error_msg("unable to copy hdf5 data to output file \"%s\"\n", output_file);
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
+ }
+
+done:
+ if(input_file)
+ HDfree(input_file);
+
+ if(output_file)
+ HDfree(output_file);
+
+ if(ub_file) {
+ HDfree(ub_file);
+ }
+
+ h5tools_close();
+
+ return h5tools_getstatus();
+}
+
+/*
+ * Copy 'how_much' bytes from the input file to the output file,
+ * starting at byte 'where' in the input file.
+ *
+ * Returns 0 on success, -1 on failure.
+ */
+herr_t
+copy_to_file( FILE *infid, FILE *ofid, ssize_t _where, ssize_t show_much )
+{
+ static char buf[COPY_BUF_SIZE];
+ size_t how_much;
+ off_t where = (off_t)_where;
+ off_t to;
+ off_t from;
+ herr_t ret_value = 0;
+
+ /* nothing to copy */
+ if(show_much <= 0)
+ goto done;
+ how_much = (size_t)show_much;
+
+ /* rewind */
+ HDfseek(infid, 0L, 0);
+
+ from = where;
+ to = 0;
+ while(how_much > 0) {
+ size_t bytes_in = 0; /* # of bytes to read */
+ size_t bytes_read = 0; /* # of bytes actually read */
+ size_t bytes_wrote = 0; /* # of bytes written */
+
+ if (how_much > COPY_BUF_SIZE)
+ bytes_in = COPY_BUF_SIZE;
+ else
+ bytes_in = how_much;
+
+ /* Seek to correct position in input file */
+ HDfseek(infid, from, SEEK_SET);
+
+ /* Read data to buffer */
+ bytes_read = HDfread(buf, (size_t)1, bytes_in, infid);
+ if(0 == bytes_read && HDferror(infid)) {
+ ret_value = -1;
+ goto done;
+ } /* end if */
+ if(0 == bytes_read && HDfeof(infid)) {
+ goto done;
+ } /* end if */
+
+ /* Seek to correct position in output file */
+ HDfseek(ofid, to, SEEK_SET);
+
+ /* Update positions/size */
+ how_much -= bytes_read;
+ from += (off_t)bytes_read;
+ to += (off_t)bytes_read;
+
+ /* Write nchars bytes to output file */
+ bytes_wrote = HDfwrite(buf, (size_t)1, bytes_read, ofid);
+ if(bytes_wrote != bytes_read || (0 == bytes_wrote && HDferror(ofid))) { /* error */
+ ret_value = -1;
+ goto done;
+ } /* end if */
+ } /* end while */
+
+done:
+ return ret_value;
+} /* end copy_to_file */
+
diff --git a/tools/src/h5ls/CMakeLists.txt b/tools/src/h5ls/CMakeLists.txt
new file mode 100644
index 0000000..24e11cc
--- /dev/null
+++ b/tools/src/h5ls/CMakeLists.txt
@@ -0,0 +1,41 @@
+cmake_minimum_required (VERSION 3.1.0)
+PROJECT (HDF5_TOOLS_SRC_H5LS)
+
+#-----------------------------------------------------------------------------
+# Setup include Directories
+#-----------------------------------------------------------------------------
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib)
+
+#-----------------------------------------------------------------------------
+# Add the h5ls executable
+#-----------------------------------------------------------------------------
+add_executable (h5ls ${HDF5_TOOLS_SRC_H5LS_SOURCE_DIR}/h5ls.c)
+TARGET_NAMING (h5ls STATIC)
+TARGET_C_PROPERTIES (h5ls STATIC " " " ")
+target_link_libraries (h5ls ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+set_target_properties (h5ls PROPERTIES FOLDER tools)
+set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5ls")
+
+set (H5_DEP_EXECUTABLES
+ h5ls
+)
+
+##############################################################################
+##############################################################################
+### I N S T A L L A T I O N ###
+##############################################################################
+##############################################################################
+
+#-----------------------------------------------------------------------------
+# Rules for Installation of tools using make Install target
+#-----------------------------------------------------------------------------
+
+#INSTALL_PROGRAM_PDB (h5ls ${HDF5_INSTALL_BIN_DIR} toolsapplications)
+
+install (
+ TARGETS
+ h5ls
+ EXPORT
+ ${HDF5_EXPORTED_TARGETS}
+ RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications
+)
diff --git a/tools/src/h5ls/Makefile.am b/tools/src/h5ls/Makefile.am
new file mode 100644
index 0000000..dfa8bb6
--- /dev/null
+++ b/tools/src/h5ls/Makefile.am
@@ -0,0 +1,35 @@
+#
+# 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.
+##
+## Makefile.am
+## Run automake to generate a Makefile.in from this file.
+#
+# HDF5 Library Makefile(.in)
+#
+
+include $(top_srcdir)/config/commence.am
+
+# Include src and tools/lib directories
+AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib
+
+# This is our main target, the h5ls tool
+bin_PROGRAMS=h5ls
+
+# Add h5ls specific linker flags here
+h5ls_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+
+# All programs depend on the hdf5 and h5tools libraries
+LDADD=$(LIBH5TOOLS) $(LIBHDF5)
+
+include $(top_srcdir)/config/conclude.am
diff --git a/tools/src/h5ls/h5ls.c b/tools/src/h5ls/h5ls.c
new file mode 100644
index 0000000..a032f08
--- /dev/null
+++ b/tools/src/h5ls/h5ls.c
@@ -0,0 +1,2939 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Programmer: Robb Matzke <matzke@llnl.gov>
+ * Monday, March 23, 1998
+ */
+
+
+/*
+ * We include the private header file so we can get to the uniform
+ * programming environment it declares. Other than that, h5ls only calls
+ * HDF5 API functions (except for H5G_basename())
+ */
+#include "H5private.h"
+#include "h5tools.h"
+#include "h5tools_utils.h"
+#include "h5tools_dump.h"
+#include "h5trav.h"
+
+/* Name of tool */
+#define PROGRAMNAME "h5ls"
+
+#define NAME_BUF_SIZE 2048
+/*
+ * Alternative formating for data dumped by H5LS
+ *
+ * This table only affects H5LS output.
+ */
+static h5tool_format_t ls_dataformat = {
+ 0, /*raw */
+
+ "", /*fmt_raw */
+ "%d", /*fmt_int */
+ "%u", /*fmt_uint */
+ "%hhd", /*fmt_schar */
+ "%u", /*fmt_uchar */
+ "%d", /*fmt_short */
+ "%u", /*fmt_ushort */
+ "%ld", /*fmt_long */
+ "%lu", /*fmt_ulong */
+ NULL, /*fmt_llong */
+ NULL, /*fmt_ullong */
+ "%g", /*fmt_double */
+ "%g", /*fmt_float */
+
+ 0, /*ascii */
+ 0, /*str_locale */
+ 0, /*str_repeat */
+
+ "[", /*arr_pre */
+ ",", /*arr_sep */
+ "]", /*arr_suf */
+ 1, /*arr_linebreak */
+
+ "", /*cmpd_name */
+ ",", /*cmpd_sep */
+ "{", /*cmpd_pre */
+ "}", /*cmpd_suf */
+ "", /*cmpd_end */
+
+ ",", /*vlen_sep */
+ "(", /*vlen_pre */
+ ")", /*vlen_suf */
+ "", /*vlen_end */
+
+ "%s", /*elmt_fmt */
+ ",", /*elmt_suf1 */
+ " ", /*elmt_suf2 */
+
+ HSIZE_T_FORMAT, /*idx_n_fmt */
+ ",", /*idx_sep */
+ "(%s)", /*idx_fmt */
+
+ 65535, /*line_ncols *//*standard default columns */
+ 0, /*line_per_line */
+ "", /*line_pre */
+ "%s", /*line_1st */
+ "%s", /*line_cont */
+ "", /*line_suf */
+ "", /*line_sep */
+ 1, /*line_multi_new */
+ "", /*line_indent */
+
+ 0, /*skip_first */
+
+ 0, /*obj_hidefileno */
+ "-%lu:"H5_PRINTF_HADDR_FMT, /*obj_format */
+
+ 0, /*dset_hidefileno */
+ "DSET-%s ", /*dset_format */
+ "%sBlk%lu: ", /*dset_blockformat_pre */
+ "%sPt%lu: ", /*dset_ptformat_pre */
+ "%s", /*dset_ptformat */
+ 1, /*array indices */
+ 1 /*escape non printable characters */
+};
+
+/* Struct to pass through to visitors */
+typedef struct {
+ const char *fname; /* Filename */
+ hid_t fid; /* File ID */
+ hid_t gid; /* Group ID */
+ hbool_t symlink_target; /* Whether this is the target of an symbolic link */
+ symlink_trav_t *symlink_list; /* List of visited symbolic links */
+ size_t base_len; /* Length of base path name, if not root */
+ size_t name_start; /* # of leading characters to strip off path names on output */
+}iter_t;
+
+/* Command-line switches */
+static int verbose_g = 0; /* lots of extra output */
+static int width_g = 80; /* output width in characters */
+static hbool_t address_g = FALSE; /* print raw data addresses */
+static hbool_t data_g = FALSE; /* display dataset values? */
+static hbool_t label_g = FALSE; /* label compound values? */
+static hbool_t string_g = FALSE; /* print 1-byte numbers as ASCII? */
+static hbool_t fullname_g = FALSE; /* print full path names */
+static hbool_t recursive_g = FALSE; /* recursive descent listing */
+static hbool_t follow_symlink_g = FALSE; /* follow symbolic links */
+static hbool_t no_dangling_link_g = FALSE; /* treat dangling link is error */
+static hbool_t follow_elink_g = FALSE; /* follow external links */
+static hbool_t grp_literal_g = FALSE; /* list group, not contents */
+static hbool_t hexdump_g = FALSE; /* show data as raw hexadecimal */
+static hbool_t show_errors_g = FALSE; /* print HDF5 error messages */
+static hbool_t simple_output_g = FALSE; /* make output more machine-readable */
+static hbool_t show_file_name_g = FALSE; /* show file name for full names */
+static hbool_t no_line_wrap_g = FALSE; /* show data content without line wrap */
+static hbool_t display_root_g = FALSE; /* show root group in output? */
+
+/* Information about how to display each type of object */
+static struct dispatch_t {
+ const char *name;
+ hid_t (*open)(hid_t loc, const char *name, hid_t apl_id);
+ herr_t (*close)(hid_t obj);
+ herr_t (*list1)(hid_t obj);
+ herr_t (*list2)(hid_t obj, const char *name);
+} dispatch_g[H5O_TYPE_NTYPES];
+
+#define DISPATCH(TYPE, NAME, LIST1, LIST2) { \
+ dispatch_g[TYPE].name = (NAME); \
+ dispatch_g[TYPE].list1 = (LIST1); \
+ dispatch_g[TYPE].list2 = (LIST2); \
+}
+
+static void print_type(h5tools_str_t *buffer, hid_t type, int ind);
+static hbool_t print_int_type(h5tools_str_t *buffer, hid_t type, int ind);
+static hbool_t print_float_type(h5tools_str_t *buffer, hid_t type, int ind);
+static herr_t visit_obj(hid_t file, const char *oname, iter_t *iter);
+
+
+/*-------------------------------------------------------------------------
+ * Function: usage
+ *
+ * Purpose: Prints a usage message on stderr and then returns.
+ *
+ * Return: void
+ *
+ * Programmer: Robb Matzke
+ * Thursday, July 16, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+usage (void)
+{
+ FLUSHSTREAM(rawoutstream);
+ PRINTVALSTREAM(rawoutstream, "usage: h5ls [OPTIONS] file[/OBJECT] [file[/[OBJECT]...]\n");
+ PRINTVALSTREAM(rawoutstream, " OPTIONS\n");
+ PRINTVALSTREAM(rawoutstream, " -h, -?, --help Print a usage message and exit\n");
+ PRINTVALSTREAM(rawoutstream, " -a, --address Print raw data address. If dataset is contiguous, address\n");
+ PRINTVALSTREAM(rawoutstream, " is offset in file of beginning of raw data. If chunked,\n");
+ PRINTVALSTREAM(rawoutstream, " returned list of addresses indicates offset of each chunk.\n");
+ PRINTVALSTREAM(rawoutstream, " Must be used with -v, --verbose option.\n");
+ PRINTVALSTREAM(rawoutstream, " Provides no information for non-dataset objects.\n");
+ PRINTVALSTREAM(rawoutstream, " -d, --data Print the values of datasets\n");
+ PRINTVALSTREAM(rawoutstream, " --enable-error-stack\n");
+ PRINTVALSTREAM(rawoutstream, " Prints messages from the HDF5 error stack as they occur.\n");
+ PRINTVALSTREAM(rawoutstream, " --follow-symlinks\n");
+ PRINTVALSTREAM(rawoutstream, " Follow symbolic links (soft links and external links)\n");
+ PRINTVALSTREAM(rawoutstream, " to display target object information.\n");
+ PRINTVALSTREAM(rawoutstream, " Without this option, h5ls identifies a symbolic link\n");
+ PRINTVALSTREAM(rawoutstream, " as a soft link or external link and prints the value\n");
+ PRINTVALSTREAM(rawoutstream, " assigned to the symbolic link; it does not provide any\n");
+ PRINTVALSTREAM(rawoutstream, " information regarding the target object or determine\n");
+ PRINTVALSTREAM(rawoutstream, " whether the link is a dangling link.\n");
+ PRINTVALSTREAM(rawoutstream, " --no-dangling-links\n");
+ PRINTVALSTREAM(rawoutstream, " Must be used with --follow-symlinks option;\n");
+ PRINTVALSTREAM(rawoutstream, " otherwise, h5ls shows error message and returns an exit\n");
+ PRINTVALSTREAM(rawoutstream, " code of 1. \n");
+ PRINTVALSTREAM(rawoutstream, " Check for any symbolic links (soft links or external links)\n");
+ PRINTVALSTREAM(rawoutstream, " that do not resolve to an existing object (dataset, group,\n");
+ PRINTVALSTREAM(rawoutstream, " or named datatype).\n");
+ PRINTVALSTREAM(rawoutstream, " If any dangling link is found, this situation is treated\n");
+ PRINTVALSTREAM(rawoutstream, " as an error and h5ls returns an exit code of 1.\n");
+ PRINTVALSTREAM(rawoutstream, " -f, --full Print full path names instead of base names\n");
+ PRINTVALSTREAM(rawoutstream, " -g, --group Show information about a group, not its contents\n");
+ PRINTVALSTREAM(rawoutstream, " -l, --label Label members of compound datasets\n");
+ PRINTVALSTREAM(rawoutstream, " -r, --recursive List all groups recursively, avoiding cycles\n");
+ PRINTVALSTREAM(rawoutstream, " -s, --string Print 1-byte integer datasets as ASCII\n");
+ PRINTVALSTREAM(rawoutstream, " -S, --simple Use a machine-readable output format\n");
+ PRINTVALSTREAM(rawoutstream, " -wN, --width=N Set the number of columns of output\n");
+ PRINTVALSTREAM(rawoutstream, " -v, --verbose Generate more verbose output\n");
+ PRINTVALSTREAM(rawoutstream, " -V, --version Print version number and exit\n");
+ PRINTVALSTREAM(rawoutstream, " --vfd=DRIVER Use the specified virtual file driver\n");
+ PRINTVALSTREAM(rawoutstream, " -x, --hexdump Show raw data in hexadecimal format\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, " file/OBJECT\n");
+ PRINTVALSTREAM(rawoutstream, " Each object consists of an HDF5 file name optionally followed by a\n");
+ PRINTVALSTREAM(rawoutstream, " slash and an object name within the file (if no object is specified\n");
+ PRINTVALSTREAM(rawoutstream, " within the file then the contents of the root group are displayed).\n");
+ PRINTVALSTREAM(rawoutstream, " The file name may include a printf(3C) integer format such as\n");
+ PRINTVALSTREAM(rawoutstream, " \"%%05d\" to open a file family.\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, " Deprecated Options\n");
+ PRINTVALSTREAM(rawoutstream, " The following options have been deprecated in HDF5. While they remain\n");
+ PRINTVALSTREAM(rawoutstream, " available, they have been superseded as indicated and may be removed\n");
+ PRINTVALSTREAM(rawoutstream, " from HDF5 in the future. Use the indicated replacement option in all\n");
+ PRINTVALSTREAM(rawoutstream, " new work; where possible, existing scripts, et cetera, should also be\n");
+ PRINTVALSTREAM(rawoutstream, " updated to use the replacement option.\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, " -E or --external Follow external links.\n");
+ PRINTVALSTREAM(rawoutstream, " Replaced by --follow-symlinks.\n");
+ PRINTVALSTREAM(rawoutstream, " -e, --errors Show all HDF5 error reporting\n");
+ PRINTVALSTREAM(rawoutstream, " Replaced by --enable-error-stack.\n");
+}
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: print_string
+ *
+ * Purpose: Print a string value by escaping unusual characters. If
+ * STREAM is null then we only count how large the output would
+ * be.
+ *
+ * Return: Number of characters printed.
+ *
+ * Programmer: Robb Matzke
+ * Thursday, November 5, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+print_string(h5tools_str_t *buffer, const char *s, hbool_t escape_spaces)
+{
+ int nprint=0;
+
+ for (/*void*/; s && *s; s++) {
+ switch (*s) {
+ case '"':
+ if (buffer) h5tools_str_append(buffer, "\\\"");
+ nprint += 2;
+ break;
+ case '\\':
+ if (buffer) h5tools_str_append(buffer, "\\\\");
+ nprint += 2;
+ break;
+ case '\b':
+ if (buffer) h5tools_str_append(buffer, "\\b");
+ nprint += 2;
+ break;
+ case '\f':
+ if (buffer) h5tools_str_append(buffer, "\\f");
+ nprint += 2;
+ break;
+ case '\n':
+ if (buffer) h5tools_str_append(buffer, "\\n");
+ nprint += 2;
+ break;
+ case '\r':
+ if (buffer) h5tools_str_append(buffer, "\\r");
+ nprint += 2;
+ break;
+ case '\t':
+ if (buffer) h5tools_str_append(buffer, "\\t");
+ nprint += 2;
+ break;
+ case ' ':
+ if (escape_spaces) {
+ if (buffer) h5tools_str_append(buffer, "\\ ");
+ nprint += 2;
+ }
+ else {
+ if (buffer) h5tools_str_append(buffer, " ");
+ nprint++;
+ }
+ break;
+ default:
+ if (isprint((int)*s)) {
+ if (buffer) h5tools_str_append(buffer, "%c", *s);
+ nprint++;
+ }
+ else {
+ if (buffer) h5tools_str_append(buffer, "\\%03o", *((const unsigned char*)s));
+ nprint += 4;
+ }
+ break;
+ }
+ }
+ return nprint;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: print_obj_name
+ *
+ * Purpose: Print an object name and another string.
+ *
+ * Return: Success: TRUE
+ *
+ * Failure: FALSE, nothing printed
+ *
+ * Programmer: Quincey Koziol
+ * Tuesday, November 6, 2007
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+print_obj_name(h5tools_str_t *buffer, const iter_t *iter, const char *oname,
+ const char *s)
+{
+ static char fullname[NAME_BUF_SIZE]; /* Buffer for file and/or object name */
+ const char *name = fullname; /* Pointer to buffer for printing */
+ int n;
+
+ if(show_file_name_g)
+ HDsnprintf(fullname, sizeof(fullname), "%s/%s", iter->fname, oname + iter->name_start);
+ else
+ name = oname + iter->name_start;
+
+ /* Print the object name, either full name or base name */
+ if(fullname_g)
+ n = print_string(buffer, name, TRUE);
+ else {
+ const char *last_sep; /* The location of the last group separator */
+
+ /* Find the last component of the path name */
+ if(NULL == (last_sep = HDstrrchr(name, '/')))
+ last_sep = name;
+ else {
+ last_sep++;
+ } /* end else */
+ n = print_string(buffer, last_sep, TRUE);
+ } /* end else */
+ h5tools_str_append(buffer, "%*s ", MAX(0, (24 - n)), s);
+
+ return TRUE;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: print_native_type
+ *
+ * Purpose: Prints the name of a native C data type.
+ *
+ * Return: Success: TRUE
+ *
+ * Failure: FALSE, nothing printed.
+ *
+ * Programmer: Robb Matzke
+ * Thursday, November 5, 1998
+ *
+ * Modifications:
+ * Robb Matzke, 1999-06-11
+ * Added the C9x types, but we still prefer to display the types
+ * from the C language itself (like `int' vs. `int32_t').
+ *
+ *-------------------------------------------------------------------------
+ */
+static hbool_t
+print_native_type(h5tools_str_t *buffer, hid_t type, int ind)
+{
+ if(!simple_output_g) {
+ if (H5Tequal(type, H5T_NATIVE_SCHAR)==TRUE) {
+ h5tools_str_append(buffer, "native signed char");
+ } else if (H5Tequal(type, H5T_NATIVE_UCHAR)==TRUE) {
+ h5tools_str_append(buffer, "native unsigned char");
+ } else if (H5Tequal(type, H5T_NATIVE_INT)==TRUE) {
+ h5tools_str_append(buffer, "native int");
+ } else if (H5Tequal(type, H5T_NATIVE_UINT)==TRUE) {
+ h5tools_str_append(buffer, "native unsigned int");
+ } else if (H5Tequal(type, H5T_NATIVE_SHORT)==TRUE) {
+ h5tools_str_append(buffer, "native short");
+ } else if (H5Tequal(type, H5T_NATIVE_USHORT)==TRUE) {
+ h5tools_str_append(buffer, "native unsigned short");
+ } else if (H5Tequal(type, H5T_NATIVE_LONG)==TRUE) {
+ h5tools_str_append(buffer, "native long");
+ } else if (H5Tequal(type, H5T_NATIVE_ULONG)==TRUE) {
+ h5tools_str_append(buffer, "native unsigned long");
+ } else if (H5Tequal(type, H5T_NATIVE_LLONG)==TRUE) {
+ h5tools_str_append(buffer, "native long long");
+ } else if (H5Tequal(type, H5T_NATIVE_ULLONG)==TRUE) {
+ h5tools_str_append(buffer, "native unsigned long long");
+ } else if (H5Tequal(type, H5T_NATIVE_FLOAT)==TRUE) {
+ h5tools_str_append(buffer, "native float");
+ } else if (H5Tequal(type, H5T_NATIVE_DOUBLE)==TRUE) {
+ h5tools_str_append(buffer, "native double");
+#if H5_SIZEOF_LONG_DOUBLE !=0
+ } else if (H5Tequal(type, H5T_NATIVE_LDOUBLE)==TRUE) {
+ h5tools_str_append(buffer, "native long double");
+#endif
+ } else if (H5Tequal(type, H5T_NATIVE_INT8)==TRUE) {
+ h5tools_str_append(buffer, "native int8_t");
+ } else if (H5Tequal(type, H5T_NATIVE_UINT8)==TRUE) {
+ h5tools_str_append(buffer, "native uint8_t");
+ } else if (H5Tequal(type, H5T_NATIVE_INT16)==TRUE) {
+ h5tools_str_append(buffer, "native int16_t");
+ } else if (H5Tequal(type, H5T_NATIVE_UINT16)==TRUE) {
+ h5tools_str_append(buffer, "native uint16_t");
+ } else if (H5Tequal(type, H5T_NATIVE_INT32)==TRUE) {
+ h5tools_str_append(buffer, "native int32_t");
+ } else if (H5Tequal(type, H5T_NATIVE_UINT32)==TRUE) {
+ h5tools_str_append(buffer, "native uint32_t");
+ } else if (H5Tequal(type, H5T_NATIVE_INT64)==TRUE) {
+ h5tools_str_append(buffer, "native int64_t");
+ } else if (H5Tequal(type, H5T_NATIVE_UINT64)==TRUE) {
+ h5tools_str_append(buffer, "native uint64_t");
+ } else if (H5Tequal(type, H5T_NATIVE_INT_LEAST8)==TRUE) {
+ h5tools_str_append(buffer, "native int_least8_t");
+ } else if (H5Tequal(type, H5T_NATIVE_UINT_LEAST8)==TRUE) {
+ h5tools_str_append(buffer, "native uint_least8_t");
+ } else if (H5Tequal(type, H5T_NATIVE_INT_LEAST16)==TRUE) {
+ h5tools_str_append(buffer, "native int_least16_t");
+ } else if (H5Tequal(type, H5T_NATIVE_UINT_LEAST16)==TRUE) {
+ h5tools_str_append(buffer, "native uint_least16_t");
+ } else if (H5Tequal(type, H5T_NATIVE_INT_LEAST32)==TRUE) {
+ h5tools_str_append(buffer, "native int_least32_t");
+ } else if (H5Tequal(type, H5T_NATIVE_UINT_LEAST32)==TRUE) {
+ h5tools_str_append(buffer, "native uint_least32_t");
+ } else if (H5Tequal(type, H5T_NATIVE_INT_LEAST64)==TRUE) {
+ h5tools_str_append(buffer, "native int_least64_t");
+ } else if (H5Tequal(type, H5T_NATIVE_UINT_LEAST64)==TRUE) {
+ h5tools_str_append(buffer, "native uint_least64_t");
+ } else if (H5Tequal(type, H5T_NATIVE_INT_FAST8)==TRUE) {
+ h5tools_str_append(buffer, "native int_fast8_t");
+ } else if (H5Tequal(type, H5T_NATIVE_UINT_FAST8)==TRUE) {
+ h5tools_str_append(buffer, "native uint_fast8_t");
+ } else if (H5Tequal(type, H5T_NATIVE_INT_FAST16)==TRUE) {
+ h5tools_str_append(buffer, "native int_fast16_t");
+ } else if (H5Tequal(type, H5T_NATIVE_UINT_FAST16)==TRUE) {
+ h5tools_str_append(buffer, "native uint_fast16_t");
+ } else if (H5Tequal(type, H5T_NATIVE_INT_FAST32)==TRUE) {
+ h5tools_str_append(buffer, "native int_fast32_t");
+ } else if (H5Tequal(type, H5T_NATIVE_UINT_FAST32)==TRUE) {
+ h5tools_str_append(buffer, "native uint_fast32_t");
+ } else if (H5Tequal(type, H5T_NATIVE_INT_FAST64)==TRUE) {
+ h5tools_str_append(buffer, "native int_fast64_t");
+ } else if (H5Tequal(type, H5T_NATIVE_UINT_FAST64)==TRUE) {
+ h5tools_str_append(buffer, "native uint_fast64_t");
+ } else if (H5Tequal(type, H5T_NATIVE_B8)==TRUE) {
+ h5tools_str_append(buffer, "native 8-bit field");
+ } else if (H5Tequal(type, H5T_NATIVE_B16)==TRUE) {
+ h5tools_str_append(buffer, "native 16-bit field");
+ } else if (H5Tequal(type, H5T_NATIVE_B32)==TRUE) {
+ h5tools_str_append(buffer, "native 32-bit field");
+ } else if (H5Tequal(type, H5T_NATIVE_B64)==TRUE) {
+ h5tools_str_append(buffer, "native 64-bit field");
+ } else if (H5Tequal(type, H5T_NATIVE_HSIZE)==TRUE) {
+ h5tools_str_append(buffer, "native hsize_t");
+ } else if (H5Tequal(type, H5T_NATIVE_HSSIZE)==TRUE) {
+ h5tools_str_append(buffer, "native hssize_t");
+ } else if (H5Tequal(type, H5T_NATIVE_HERR)==TRUE) {
+ h5tools_str_append(buffer, "native herr_t");
+ } else if (H5Tequal(type, H5T_NATIVE_HBOOL)==TRUE) {
+ h5tools_str_append(buffer, "native hbool_t");
+ } else {
+ return print_int_type(buffer, type, ind);
+ }
+ } else {
+ return print_int_type(buffer, type, ind);
+ }
+ return TRUE;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: print_ieee_type
+ *
+ * Purpose: Print the name of an IEEE floating-point data type.
+ *
+ * Return: Success: TRUE
+ *
+ * Failure: FALSE, nothing printed
+ *
+ * Programmer: Robb Matzke
+ * Thursday, November 5, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static hbool_t
+print_ieee_type(h5tools_str_t *buffer, hid_t type, int ind)
+{
+ if (H5Tequal(type, H5T_IEEE_F32BE)==TRUE) {
+ h5tools_str_append(buffer, "IEEE 32-bit big-endian float");
+ }
+ else if (H5Tequal(type, H5T_IEEE_F32LE)==TRUE) {
+ h5tools_str_append(buffer, "IEEE 32-bit little-endian float");
+ }
+ else if (H5Tequal(type, H5T_IEEE_F64BE)==TRUE) {
+ h5tools_str_append(buffer, "IEEE 64-bit big-endian float");
+ }
+ else if (H5Tequal(type, H5T_IEEE_F64LE)==TRUE) {
+ h5tools_str_append(buffer, "IEEE 64-bit little-endian float");
+ }
+ else {
+ return print_float_type(buffer, type, ind);
+ }
+ return TRUE;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: print_precision
+ *
+ * Purpose: Prints information on the next line about precision and
+ * padding if the precision is less than the total data type
+ * size.
+ *
+ * Return: void
+ *
+ * Programmer: Robb Matzke
+ * Thursday, November 5, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+print_precision(h5tools_str_t *buffer, hid_t type, int ind)
+{
+ size_t prec; /* precision */
+ H5T_pad_t plsb, pmsb; /* lsb and msb padding */
+ const char *plsb_s=NULL; /* lsb padding string */
+ const char *pmsb_s=NULL; /* msb padding string */
+ size_t nbits; /* number of bits */
+
+ /* If the precision is less than the total size then show the precision
+ * and offset on the following line. Also display the padding
+ * information. */
+ if(8 * H5Tget_size(type) != (prec = H5Tget_precision(type))) {
+ h5tools_str_append(buffer, "\n%*s(%lu bit%s of precision beginning at bit %lu)",
+ ind, "", (unsigned long)prec, 1 == prec ? "" : "s",
+ (unsigned long)H5Tget_offset(type));
+
+ H5Tget_pad(type, &plsb, &pmsb);
+ if(H5Tget_offset(type) > 0) {
+ switch(plsb) {
+ case H5T_PAD_ZERO:
+ plsb_s = "zero";
+ break;
+ case H5T_PAD_ONE:
+ plsb_s = "one";
+ break;
+ case H5T_PAD_BACKGROUND:
+ plsb_s = "bkg";
+ break;
+ case H5T_PAD_ERROR:
+ case H5T_NPAD:
+ plsb_s = "unknown";
+ break;
+ default:
+ break;
+ }
+ }
+ if((unsigned)H5Tget_offset(type) + prec < 8 * H5Tget_size(type)) {
+ switch(pmsb) {
+ case H5T_PAD_ZERO:
+ pmsb_s = "zero";
+ break;
+ case H5T_PAD_ONE:
+ pmsb_s = "one";
+ break;
+ case H5T_PAD_BACKGROUND:
+ pmsb_s = "bkg";
+ break;
+ case H5T_PAD_ERROR:
+ case H5T_NPAD:
+ pmsb_s = "unknown";
+ break;
+ default:
+ break;
+ }
+ }
+ if (plsb_s || pmsb_s) {
+ h5tools_str_append(buffer, "\n%*s(", ind, "");
+ if (plsb_s) {
+ nbits = (unsigned)H5Tget_offset(type);
+ h5tools_str_append(buffer, "%lu %s bit%s at bit 0",
+ (unsigned long)nbits, plsb_s, 1 == nbits ? "" : "s");
+ }
+ if (plsb_s && pmsb_s) h5tools_str_append(buffer, ", ");
+ if (pmsb_s) {
+ nbits = (8 * H5Tget_size(type)) - ((unsigned)H5Tget_offset(type) + prec);
+ h5tools_str_append(buffer, "%lu %s bit%s at bit %lu",
+ (unsigned long)nbits, pmsb_s, 1 == nbits ? "" : "s",
+ (unsigned long)(8 * H5Tget_size(type) - nbits));
+ }
+ h5tools_str_append(buffer, ")");
+ }
+ }
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: print_int_type
+ *
+ * Purpose: Print the name of an integer data type. Common information
+ * like number of bits, byte order, and sign scheme appear on
+ * the first line. Additional information might appear in
+ * parentheses on the following lines.
+ *
+ * Return: Success: TRUE
+ *
+ * Failure: FALSE, nothing printed
+ *
+ * Programmer: Robb Matzke
+ * Thursday, November 5, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static hbool_t
+print_int_type(h5tools_str_t *buffer, hid_t type, int ind)
+{
+ H5T_order_t order; /* byte order value */
+ const char *order_s=NULL; /* byte order string */
+ H5T_sign_t sign; /* sign scheme value */
+ const char *sign_s=NULL; /* sign scheme string */
+
+ if (H5T_INTEGER!=H5Tget_class(type)) return FALSE;
+
+ /* Byte order */
+ if (H5Tget_size(type)>1) {
+ order = H5Tget_order(type);
+ if (H5T_ORDER_LE==order) {
+ order_s = " little-endian";
+ }
+ else if (H5T_ORDER_BE==order) {
+ order_s = " big-endian";
+ }
+ else if (H5T_ORDER_VAX==order) {
+ order_s = " mixed-endian";
+ }
+ else {
+ order_s = " unknown-byte-order";
+ }
+ }
+ else {
+ order_s = "";
+ }
+
+ /* Sign */
+ if ((sign=H5Tget_sign(type))>=0) {
+ if (H5T_SGN_NONE==sign) {
+ sign_s = " unsigned";
+ }
+ else if (H5T_SGN_2==sign) {
+ sign_s = "";
+ }
+ else {
+ sign_s = " unknown-sign";
+ }
+ }
+ else {
+ sign_s = " unknown-sign";
+ }
+
+ /* Print size, order, and sign on first line, precision and padding
+ * information on the subsequent lines */
+ h5tools_str_append(buffer, "%lu-bit%s%s integer",
+ (unsigned long)(8*H5Tget_size(type)), order_s, sign_s);
+ print_precision(buffer, type, ind);
+ return TRUE;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: print_float_type
+ *
+ * Purpose: Print info about a floating point data type.
+ *
+ * Return: Success: TRUE
+ *
+ * Failure: FALSE, nothing printed
+ *
+ * Programmer: Robb Matzke
+ * Thursday, November 5, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static hbool_t
+print_float_type(h5tools_str_t *buffer, hid_t type, int ind)
+{
+ H5T_order_t order; /* byte order value */
+ const char *order_s=NULL; /* byte order string */
+ size_t spos; /* sign bit position */
+ size_t esize, epos; /* exponent size and position */
+ size_t msize, mpos; /* significand size and position */
+ size_t ebias; /* exponent bias */
+ H5T_norm_t norm; /* significand normalization */
+ const char *norm_s=NULL; /* normalization string */
+ H5T_pad_t pad; /* internal padding value */
+ const char *pad_s=NULL; /* internal padding string */
+
+ if (H5T_FLOAT!=H5Tget_class(type)) return FALSE;
+
+ /* Byte order */
+ if (H5Tget_size(type)>1) {
+ order = H5Tget_order(type);
+ if (H5T_ORDER_LE==order) {
+ order_s = " little-endian";
+ }
+ else if (H5T_ORDER_BE==order) {
+ order_s = " big-endian";
+ }
+ else if (H5T_ORDER_VAX==order) {
+ order_s = " mixed-endian";
+ }
+ else {
+ order_s = " unknown-byte-order";
+ }
+ }
+ else {
+ order_s = "";
+ }
+
+ /* Print size and byte order on first line, precision and padding on
+ * subsequent lines. */
+ h5tools_str_append(buffer, "%lu-bit%s floating-point",
+ (unsigned long)(8*H5Tget_size(type)), order_s);
+ print_precision(buffer, type, ind);
+
+ /* Print sizes, locations, and other information about each field */
+ H5Tget_fields (type, &spos, &epos, &esize, &mpos, &msize);
+ ebias = H5Tget_ebias(type);
+ norm = H5Tget_norm(type);
+ switch (norm) {
+ case H5T_NORM_IMPLIED:
+ norm_s = ", msb implied";
+ break;
+ case H5T_NORM_MSBSET:
+ norm_s = ", msb always set";
+ break;
+ case H5T_NORM_NONE:
+ norm_s = ", no normalization";
+ break;
+ case H5T_NORM_ERROR:
+ norm_s = ", unknown normalization";
+ break;
+ default:
+ ;
+ break;
+ }
+ h5tools_str_append(buffer, "\n%*s(significant for %lu bit%s at bit %lu%s)", ind, "",
+ (unsigned long)msize, 1==msize?"":"s", (unsigned long)mpos,
+ norm_s);
+ h5tools_str_append(buffer, "\n%*s(exponent for %lu bit%s at bit %lu, bias is 0x%lx)",
+ ind, "", (unsigned long)esize, 1==esize?"":"s",
+ (unsigned long)epos, (unsigned long)ebias);
+ h5tools_str_append(buffer, "\n%*s(sign bit at %lu)", ind, "", (unsigned long)spos);
+
+ /* Display internal padding */
+ if (1+esize+msize<H5Tget_precision(type)) {
+ pad = H5Tget_inpad(type);
+ switch (pad) {
+ case H5T_PAD_ZERO:
+ pad_s = "zero";
+ break;
+ case H5T_PAD_ONE:
+ pad_s = "one";
+ break;
+ case H5T_PAD_BACKGROUND:
+ pad_s = "bkg";
+ break;
+ case H5T_PAD_ERROR:
+ case H5T_NPAD:
+ pad_s = "unknown";
+ break;
+ default:
+ ;
+ break;
+ }
+ h5tools_str_append(buffer, "\n%*s(internal padding bits are %s)", ind, "", pad_s);
+ }
+ return TRUE;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: print_cmpd_type
+ *
+ * Purpose: Print info about a compound data type.
+ *
+ * Return: Success: TRUE
+ *
+ * Failure: FALSE, nothing printed
+ *
+ * Programmer: Robb Matzke
+ * Thursday, November 5, 1998
+ *
+ *-------------------------------------------------------------------------
+ */
+static hbool_t
+print_cmpd_type(h5tools_str_t *buffer, hid_t type, int ind)
+{
+ char *name=NULL; /* member name */
+ size_t size; /* total size of type in bytes */
+ hid_t subtype; /* member data type */
+ int nmembs; /* number of members */
+ int n; /* miscellaneous counters */
+ unsigned i; /* miscellaneous counters */
+
+ if(H5T_COMPOUND != H5Tget_class(type))
+ return FALSE;
+ if((nmembs = H5Tget_nmembers(type)) < 0)
+ return FALSE;
+
+ h5tools_str_append(buffer, "struct {");
+ for(i = 0; i < (unsigned)nmembs; i++) {
+
+ /* Name and offset */
+ name = H5Tget_member_name(type, i);
+ h5tools_str_append(buffer, "\n%*s\"", ind+4, "");
+ n = print_string(buffer, name, FALSE);
+ h5tools_str_append(buffer, "\"%*s +%-4lu ", MAX(0, 16-n), "",
+ (unsigned long)H5Tget_member_offset(type, i));
+ H5free_memory(name);
+
+ /* Member's type */
+ subtype = H5Tget_member_type(type, i);
+ print_type(buffer, subtype, ind+4);
+ H5Tclose(subtype);
+ }
+ size = H5Tget_size(type);
+ h5tools_str_append(buffer, "\n%*s} %lu byte%s",
+ ind, "", (unsigned long)size, 1==size?"":"s");
+
+ return TRUE;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: print_enum_type
+ *
+ * Purpose: Print info about an enumeration data type.
+ *
+ * Return: Success: TRUE
+ *
+ * Failure: FALSE, nothing printed
+ *
+ * Programmer: Robb Matzke
+ * Wednesday, December 23, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static hbool_t
+print_enum_type(h5tools_str_t *buffer, hid_t type, int ind)
+{
+ int nmembs; /* number of members */
+ hid_t super; /* enum base integer type */
+
+ if(H5T_ENUM != H5Tget_class(type))
+ return FALSE;
+ if((nmembs = H5Tget_nmembers(type)) < 0)
+ return FALSE;
+
+ super = H5Tget_super(type);
+ h5tools_str_append(buffer, "enum ");
+ print_type(buffer, super, ind + 4);
+ h5tools_str_append(buffer, " {");
+
+ if(nmembs > 0) {
+ char **name; /* member names */
+ unsigned char *value; /* value array */
+ hid_t native = -1; /* native integer data type */
+ size_t dst_size; /* destination value type size */
+ unsigned i; /* miscellaneous counters */
+
+ /* Determine what data type to use for the native values. To simplify
+ * things we entertain three possibilities:
+ * 1. long long -- the largest native signed integer
+ * 2. unsigned long long -- the largest native unsigned integer
+ * 3. raw format */
+ if(H5Tget_size(type) <= sizeof(long long)) {
+ dst_size = sizeof(long long);
+ if(H5T_SGN_NONE == H5Tget_sign(type))
+ native = H5T_NATIVE_ULLONG;
+ else
+ native = H5T_NATIVE_LLONG;
+ } /* end if */
+ else
+ dst_size = H5Tget_size(type);
+
+ /* Get the names and raw values of all members */
+ name = (char **)HDcalloc((size_t)nmembs, sizeof(char *));
+ value = (unsigned char *)HDcalloc((size_t)nmembs, MAX(H5Tget_size(type), dst_size));
+ for(i = 0; i < (unsigned)nmembs; i++) {
+ name[i] = H5Tget_member_name(type, i);
+ H5Tget_member_value(type, i, value + i * H5Tget_size(type));
+ }
+
+ /* Convert values to native data type */
+ if(native > 0)
+ if(H5Tconvert(super, native, (size_t)nmembs, value, NULL, H5P_DEFAULT) < 0) {
+ /* Release resources */
+ for(i = 0; i < (unsigned)nmembs; i++)
+ H5free_memory(name[i]);
+ HDfree(name);
+ HDfree(value);
+
+ return FALSE;
+ }
+
+ /* Sort members by increasing value */
+ /*not implemented yet*/
+
+ /* Print members */
+ for(i = 0; i < (unsigned)nmembs; i++) {
+ unsigned char *copy; /* a pointer to value array */
+ int nchars; /* number of output characters */
+
+ h5tools_str_append(buffer, "\n%*s", ind+4, "");
+ nchars = print_string(buffer, name[i], TRUE);
+ h5tools_str_append(buffer, "%*s = ", MAX(0, 16 - nchars), "");
+
+ if(native < 0) {
+ size_t j;
+
+ h5tools_str_append(buffer, "0x");
+ for(j = 0; j < dst_size; j++)
+ h5tools_str_append(buffer, "%02x", value[i*dst_size+j]);
+ }
+ else if(H5T_SGN_NONE == H5Tget_sign(native)) {
+ /*On SGI Altix(cobalt), wrong values were printed out with "value+i*dst_size"
+ *strangely, unless use another pointer "copy".*/
+ copy = value + i * dst_size;
+ h5tools_str_append(buffer, HSIZE_T_FORMAT, *((unsigned long long*)((void*)copy)));
+ }
+ else {
+ /*On SGI Altix(cobalt), wrong values were printed out with "value+i*dst_size"
+ *strangely, unless use another pointer "copy".*/
+ copy = value + i * dst_size;
+ h5tools_str_append(buffer, "%"H5_PRINTF_LL_WIDTH"d",
+ *((long long*)((void*)copy)));
+ }
+ }
+
+ /* Release resources */
+ for(i = 0; i < (unsigned)nmembs; i++)
+ H5free_memory(name[i]);
+ HDfree(name);
+ HDfree(value);
+ }
+ else
+ h5tools_str_append(buffer, "\n%*s <empty>", ind+4, "");
+
+ h5tools_str_append(buffer, "\n%*s}", ind, "");
+
+ H5Tclose(super);
+
+ return TRUE;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: print_string_type
+ *
+ * Purpose: Print information about a string data type.
+ *
+ * Return: Success: TRUE
+ *
+ * Failure: FALSE, nothing printed
+ *
+ * Programmer: Robb Matzke
+ * Thursday, November 5, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static hbool_t
+print_string_type(h5tools_str_t *buffer, hid_t type, int H5_ATTR_UNUSED ind)
+{
+ H5T_str_t pad;
+ const char *pad_s=NULL;
+ H5T_cset_t cset;
+ const char *cset_s=NULL;
+
+ if (H5T_STRING!=H5Tget_class(type)) return FALSE;
+
+ /* Padding */
+ pad = H5Tget_strpad(type);
+ switch (pad) {
+ case H5T_STR_NULLTERM:
+ pad_s = "null-terminated";
+ break;
+ case H5T_STR_NULLPAD:
+ pad_s = "null-padded";
+ break;
+ case H5T_STR_SPACEPAD:
+ pad_s = "space-padded";
+ 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:
+ case H5T_STR_ERROR:
+ pad_s = "unknown-format";
+ break;
+ default:
+ ;
+ break;
+ }
+
+ /* Character set */
+ cset = H5Tget_cset(type);
+ switch (cset) {
+ case H5T_CSET_ASCII:
+ cset_s = "ASCII";
+ break;
+ case H5T_CSET_UTF8:
+ cset_s = "UTF-8";
+ 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:
+ case H5T_CSET_ERROR:
+ cset_s = "unknown-character-set";
+ break;
+ default:
+ ;
+ break;
+ }
+
+ if (H5Tis_variable_str(type)) {
+ h5tools_str_append(buffer, "variable-length");
+ }
+ else {
+ h5tools_str_append(buffer, "%lu-byte", (unsigned long)H5Tget_size(type));
+ }
+ h5tools_str_append(buffer, " %s %s string", pad_s, cset_s);
+ return TRUE;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: print_reference_type
+ *
+ * Purpose: Prints information about a reference data type.
+ *
+ * Return: Success: TRUE
+ *
+ * Failure: FALSE, nothing printed
+ *
+ * Programmer: Robb Matzke
+ * Thursday, November 5, 1998
+ *
+ * Modifications:
+ * Robb Matzke, 1999-06-04
+ * Knows about object and dataset region references.
+ *
+ *-------------------------------------------------------------------------
+ */
+static hbool_t
+print_reference_type(h5tools_str_t *buffer, hid_t type, int H5_ATTR_UNUSED ind)
+{
+ if (H5T_REFERENCE!=H5Tget_class(type)) return FALSE;
+
+ if (H5Tequal(type, H5T_STD_REF_OBJ)==TRUE) {
+ h5tools_str_append(buffer, "object reference");
+ }
+ else if (H5Tequal(type, H5T_STD_REF_DSETREG)==TRUE) {
+ h5tools_str_append(buffer, "dataset region reference");
+ }
+ else {
+ h5tools_str_append(buffer, "%lu-byte unknown reference",
+ (unsigned long)H5Tget_size(type));
+ }
+
+ return TRUE;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: print_opaque_type
+ *
+ * Purpose: Prints information about an opaque data type.
+ *
+ * Return: Success: TRUE
+ *
+ * Failure: FALSE, nothing printed
+ *
+ * Programmer: Robb Matzke
+ * Monday, June 7, 1999
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static hbool_t
+print_opaque_type(h5tools_str_t *buffer, hid_t type, int ind)
+{
+ char *tag;
+ size_t size;
+
+ if (H5T_OPAQUE!=H5Tget_class(type)) return FALSE;
+
+ size = H5Tget_size(type);
+ h5tools_str_append(buffer, "%lu-byte opaque type", (unsigned long)size);
+ if ((tag=H5Tget_tag(type))) {
+ h5tools_str_append(buffer, "\n%*s(tag = \"", ind, "");
+ print_string(buffer, tag, FALSE);
+ h5tools_str_append(buffer, "\")");
+ H5free_memory(tag);
+ }
+ return TRUE;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: print_vlen_type
+ *
+ * Purpose: Print information about a variable-length type
+ *
+ * Return: Success: TRUE
+ *
+ * Failure: FALSE
+ *
+ * Programmer: Robb Matzke
+ * Friday, December 1, 2000
+ *
+ * Modifications:
+ *-------------------------------------------------------------------------
+ */
+static hbool_t
+print_vlen_type(h5tools_str_t *buffer, hid_t type, int ind)
+{
+ hid_t super;
+
+ if (H5T_VLEN!=H5Tget_class(type)) return FALSE;
+
+ h5tools_str_append(buffer, "variable length of\n%*s", ind+4, "");
+ super = H5Tget_super(type);
+ print_type(buffer, super, ind+4);
+ H5Tclose(super);
+ return TRUE;
+}
+
+
+/*---------------------------------------------------------------------------
+ * Purpose: Print information about an array type
+ *
+ * Return: Success: TRUE
+ *
+ * Failure: FALSE
+ *
+ * Programmer: Robb Matzke
+ * Thursday, January 31, 2002
+ *
+ * Modifications:
+ *---------------------------------------------------------------------------
+ */
+static hbool_t
+print_array_type(h5tools_str_t *buffer, hid_t type, int ind)
+{
+ hid_t super;
+ int ndims, i;
+ hsize_t *dims=NULL;
+
+ if (H5T_ARRAY!=H5Tget_class(type))
+ return FALSE;
+ ndims = H5Tget_array_ndims(type);
+ if (ndims) {
+ dims = (hsize_t *)HDmalloc((unsigned)ndims * sizeof(dims[0]));
+ H5Tget_array_dims2(type, dims);
+
+ /* Print dimensions */
+ for (i=0; i<ndims; i++)
+ h5tools_str_append(buffer, "%s" HSIZE_T_FORMAT , i?",":"[", dims[i]);
+ h5tools_str_append(buffer, "]");
+
+ HDfree(dims);
+ }
+ else
+ h5tools_str_append(buffer, " [SCALAR]\n", rawoutstream);
+
+
+ /* Print parent type */
+ h5tools_str_append(buffer, " ");
+ super = H5Tget_super(type);
+ print_type(buffer, super, ind+4);
+ H5Tclose(super);
+ return TRUE;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: print_bitfield_type
+ *
+ * Purpose: Print information about a bitfield type.
+ *
+ * Return: Success: TRUE
+ *
+ * Failure: FALSE, nothing printed
+ *
+ * Programmer: Pedro Vicente
+ * Tuesday, May 20, 2003
+ *
+ * Modifications:
+ * Robb Matzke, LLNL 2003-06-05
+ * Generalized Pedro's original if/then/else. Also display
+ * precision/offset information.
+ *-------------------------------------------------------------------------
+ */
+static hbool_t
+print_bitfield_type(h5tools_str_t *buffer, hid_t type, int ind)
+{
+ H5T_order_t order; /* byte order value */
+ const char *order_s=NULL; /* byte order string */
+
+ if (H5T_BITFIELD!=H5Tget_class(type)) return FALSE;
+ if (H5Tget_size(type)>1) {
+ order = H5Tget_order(type);
+ if (H5T_ORDER_LE==order) {
+ order_s = " little-endian";
+ } else if (H5T_ORDER_BE==order) {
+ order_s = " big-endian";
+ } else if (H5T_ORDER_VAX==order) {
+ order_s = " mixed-endian";
+ } else {
+ order_s = "unknown-byte-order";
+ }
+ } else {
+ order_s = "";
+ }
+
+ h5tools_str_append(buffer, "%lu-bit%s bitfield",
+ (unsigned long)(8*H5Tget_size(type)), order_s);
+ print_precision(buffer, type, ind);
+ return TRUE;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: print_type
+ *
+ * Purpose: Prints a data type definition. The definition is printed
+ * without any leading space or trailing line-feed (although
+ * there might be line-feeds inside the type definition). The
+ * first line is assumed to have IND characters before it on
+ * the same line (printed by the caller).
+ *
+ * Return: void
+ *
+ * Programmer: Robb Matzke
+ * Thursday, November 5, 1998
+ *
+ * Modifications:
+ * Robb Matzke, 1999-06-11
+ * Prints the OID of shared data types.
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+print_type(h5tools_str_t *buffer, hid_t type, int ind)
+{
+ H5T_class_t data_class = H5Tget_class(type);
+
+ /* Bad data type */
+ if (type<0) {
+ h5tools_str_append(buffer,"<ERROR>");
+ return;
+ }
+
+ /* Shared? If so then print the type's OID */
+ if(H5Tcommitted(type)) {
+ H5O_info_t oi;
+
+ if(H5Oget_info(type, &oi) >= 0)
+ h5tools_str_append(buffer,"shared-%lu:"H5_PRINTF_HADDR_FMT" ",
+ oi.fileno, oi.addr);
+ else
+ h5tools_str_append(buffer,"shared ");
+ } /* end if */
+
+ /* Print the type */
+ if(print_native_type(buffer, type, ind) ||
+ print_ieee_type(buffer, type, ind) ||
+ print_cmpd_type(buffer, type, ind) ||
+ print_enum_type(buffer, type, ind) ||
+ print_string_type(buffer, type, ind) ||
+ print_reference_type(buffer, type, ind) ||
+ print_vlen_type(buffer, type, ind) ||
+ print_array_type(buffer, type, ind) ||
+ print_opaque_type(buffer, type, ind) ||
+ print_bitfield_type(buffer, type, ind))
+ return;
+
+ /* Unknown type */
+ h5tools_str_append(buffer,"%lu-byte class-%u unknown",
+ (unsigned long)H5Tget_size(type), (unsigned)data_class);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: dump_dataset_values
+ *
+ * Purpose: Prints all values of a dataset.
+ *
+ * Return: void
+ *
+ * Programmer: Robb Matzke
+ * Tuesday, July 21, 1998
+ *
+ * Modifications:
+ * Robb Matzke, 1999-09-27
+ * Understands the simple_output_g switch which causes data to
+ * be displayed in a more machine-readable format.
+ *-------------------------------------------------------------------------
+ */
+static void
+dump_dataset_values(hid_t dset)
+{
+ char string_prefix[64];
+ static char fmt_double[16];
+ static char fmt_float[16];
+ hsize_t curr_pos = 0; /* total data element position */
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t outputformat;
+ h5tool_format_t *info = &ls_dataformat;
+
+ hid_t f_type = H5Dget_type(dset);
+ size_t size = H5Tget_size(f_type);
+
+ HDmemset(&ctx, 0, sizeof(ctx));
+ HDmemset(&buffer, 0, sizeof(h5tools_str_t));
+
+ outputformat = *info;
+ outputformat.line_1st = NULL;
+ if (simple_output_g) {
+ outputformat.idx_fmt = "";
+ outputformat.line_per_line = 1;
+ outputformat.line_multi_new = 0;
+ outputformat.line_pre = " ";
+ outputformat.line_cont = " ";
+
+ outputformat.arr_pre = "";
+ outputformat.arr_suf = "";
+ outputformat.arr_sep = " ";
+
+ if (!label_g) {
+ outputformat.cmpd_pre = "";
+ outputformat.cmpd_suf = "";
+ }
+ outputformat.cmpd_sep = " ";
+
+ if (label_g) outputformat.cmpd_name = "%s=";
+
+ outputformat.elmt_suf1 = " ";
+ outputformat.str_locale = ESCAPE_HTML;
+
+ }
+ else {
+ if (no_line_wrap_g) {
+ outputformat.line_per_line = 1;
+ }
+ else {
+ outputformat.line_ncols = (unsigned)width_g;
+ }
+ if (label_g) outputformat.cmpd_name = "%s=";
+ outputformat.line_pre = " %s ";
+ outputformat.line_cont = " %s ";
+ outputformat.str_repeat = 8;
+
+ outputformat.arr_pre = NULL;
+ outputformat.arr_suf = NULL;
+ outputformat.arr_sep = NULL;
+
+ outputformat.cmpd_pre = NULL;
+ outputformat.cmpd_suf = NULL;
+ outputformat.cmpd_sep = NULL;
+
+ outputformat.vlen_sep = NULL;
+ outputformat.vlen_pre = NULL;
+ outputformat.vlen_suf = NULL;
+ outputformat.vlen_end = NULL;
+ }
+ outputformat.arr_linebreak = 0;
+ /* Floating point types should display full precision */
+ HDsnprintf(fmt_float, sizeof(fmt_float), "%%1.%dg", FLT_DIG);
+ outputformat.fmt_float = fmt_float;
+ HDsnprintf(fmt_double, sizeof(fmt_double), "%%1.%dg", DBL_DIG);
+ outputformat.fmt_double = fmt_double;
+
+ if (hexdump_g) {
+ /* Print all data in hexadecimal format if the `-x' or `--hexdump'
+ * command line switch was given. */
+ outputformat.raw = TRUE;
+ }
+ else if (string_g && 1==size && H5T_INTEGER==H5Tget_class(f_type)) {
+ /* Print 1-byte integer data as an ASCI character string instead of
+ * integers if the `-s' or `--string' command-line option was given. */
+ outputformat.ascii = TRUE;
+ outputformat.elmt_suf1 = "";
+ outputformat.elmt_suf2 = "";
+ HDsnprintf(string_prefix, sizeof(string_prefix), "%s\"", outputformat.line_pre);
+ outputformat.line_pre = string_prefix;
+ outputformat.line_suf = "\"";
+ }
+ info = &outputformat;
+
+ ctx.indent_level = 2;
+ 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, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.need_prefix = TRUE;
+ ctx.cur_column = (size_t)curr_pos;
+ if (h5tools_dump_dset(rawoutstream, info, &ctx, dset, NULL) < 0) {
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, " Unable to print data.");
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
+
+ H5Tclose(f_type);
+
+ h5tools_str_close(&buffer);
+
+ PRINTVALSTREAM(rawoutstream, "\n");
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: list_attr
+ *
+ * Purpose: Prints information about attributes.
+ *
+ * Return: Success: 0
+ *
+ * Failure: -1
+ *
+ * Programmer: Robb Matzke
+ * Friday, June 5, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+list_attr(hid_t obj, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ainfo,
+ void H5_ATTR_UNUSED *op_data)
+{
+ hid_t attr = -1;
+ hid_t space = -1;
+ hid_t type = -1;
+ hid_t p_type = -1;
+ hsize_t size[H5S_MAX_RANK];
+ hsize_t nelmts = 1;
+ hsize_t temp_need;
+ size_t need;
+ int ndims;
+ int i;
+ void *buf;
+ H5S_class_t space_type;
+ hsize_t curr_pos = 0; /* total data element position */
+ 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));
+
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, " Attribute: ");
+
+ print_string(&buffer, attr_name, TRUE);
+
+ if((attr = H5Aopen(obj, attr_name, H5P_DEFAULT))) {
+ space = H5Aget_space(attr);
+ type = H5Aget_type(attr);
+
+ /* Data space */
+ ndims = H5Sget_simple_extent_dims(space, size, NULL);
+ space_type = H5Sget_simple_extent_type(space);
+ switch(space_type) {
+ case H5S_SCALAR:
+ /* scalar dataspace */
+ h5tools_str_append(&buffer, " scalar\n");
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
+
+ case H5S_SIMPLE:
+ /* simple dataspace */
+ h5tools_str_append(&buffer, " {");
+ for (i=0; i<ndims; i++) {
+ h5tools_str_append(&buffer, "%s" HSIZE_T_FORMAT, i?", ":"", size[i]);
+ nelmts *= size[i];
+ }
+ h5tools_str_append(&buffer, "}\n");
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
+
+ case H5S_NULL:
+ /* null dataspace */
+ h5tools_str_append(&buffer, " null\n");
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
+
+ case H5S_NO_CLASS:
+ default:
+ /* Unknown dataspace type */
+ h5tools_str_append(&buffer, " unknown\n");
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
+ } /* end switch */
+
+ /* Data type */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, " Type: ");
+ print_type(&buffer, type, 15);
+ h5tools_str_append(&buffer, "\n");
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ /* Data */
+ outputformat = *info;
+
+ if(nelmts < 5) {
+ outputformat.idx_fmt = "";
+ outputformat.line_1st = " Data: ";
+ outputformat.line_pre = " ";
+ outputformat.line_cont = " ";
+ outputformat.str_repeat = 8;
+
+ }
+ else {
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, " Data:\n");
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ outputformat.line_1st = NULL;
+ outputformat.line_pre = " %s ";
+ outputformat.line_cont = " %s ";
+ outputformat.str_repeat = 8;
+ }
+
+ outputformat.line_ncols = (unsigned)width_g;
+ if(label_g)
+ outputformat.cmpd_name = "%s=";
+ if(string_g && 1==H5Tget_size(type) &&
+ H5T_INTEGER==H5Tget_class(type)) {
+ outputformat.ascii = TRUE;
+ outputformat.elmt_suf1 = "";
+ outputformat.elmt_suf2 = "";
+ outputformat.line_pre = " %s \"";
+ outputformat.line_suf = "\"";
+ } /* end if */
+
+
+ outputformat.arr_pre = NULL;
+ outputformat.arr_suf = NULL;
+ outputformat.arr_sep = NULL;
+
+ outputformat.cmpd_pre = NULL;
+ outputformat.cmpd_suf = NULL;
+ outputformat.cmpd_sep = NULL;
+
+ outputformat.vlen_sep = NULL;
+ outputformat.vlen_pre = NULL;
+ outputformat.vlen_suf = NULL;
+ outputformat.vlen_end = NULL;
+
+ info = &outputformat;
+
+ if(hexdump_g)
+ p_type = H5Tcopy(type);
+ else
+ p_type = h5tools_get_native_type(type);
+
+ if(p_type >= 0) {
+ /* VL data special information */
+ unsigned int vl_data = 0; /* contains VL datatypes */
+
+ /* Check if we have VL data in the dataset's datatype */
+ if (h5tools_detect_vlen(p_type) == TRUE)
+ vl_data = TRUE;
+
+ temp_need= nelmts * MAX(H5Tget_size(type), H5Tget_size(p_type));
+ HDassert(temp_need == (hsize_t)((size_t)temp_need));
+ need = (size_t)temp_need;
+ buf = HDmalloc(need);
+ HDassert(buf);
+ if(H5Aread(attr, p_type, buf) >= 0) {
+ ctx.need_prefix = TRUE;
+ ctx.indent_level = 2;
+ ctx.cur_column = (size_t)curr_pos;
+ h5tools_dump_mem(rawoutstream, info, &ctx, attr, p_type, space, buf);
+ }
+
+ /* Reclaim any VL memory, if necessary */
+ if (vl_data)
+ H5Dvlen_reclaim(p_type, space, H5P_DEFAULT, buf);
+
+ HDfree(buf);
+ H5Tclose(p_type);
+ } /* end if */
+
+ H5Sclose(space);
+ H5Tclose(type);
+ H5Aclose(attr);
+ }
+ h5tools_str_close(&buffer);
+
+ PRINTVALSTREAM(rawoutstream, "\n");
+
+ return 0;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: dataset_list1
+ *
+ * Purpose: List information about a dataset which should appear on the
+ * same line as the dataset name. This information will precede
+ * information which is applicable to all objects which will be
+ * printed by the caller.
+ *
+ * Return: Success: 0
+ *
+ * Failure: -1
+ *
+ * Programmer: Robb Matzke
+ * Thursday, August 27, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+dataset_list1(hid_t dset)
+{
+ hsize_t cur_size[H5S_MAX_RANK]; /* current dataset dimensions */
+ hsize_t max_size[H5S_MAX_RANK]; /* maximum dataset dimensions */
+ hid_t space; /* data space */
+ int ndims; /* dimensionality */
+ H5S_class_t space_type; /* type of dataspace */
+ int i;
+ hsize_t curr_pos = 0; /* total data element position */
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t *info = &ls_dataformat;
+
+ HDmemset(&ctx, 0, sizeof(ctx));
+ HDmemset(&buffer, 0, sizeof(h5tools_str_t));
+
+ h5tools_str_reset(&buffer);
+
+ /* Information that goes on the same row as the name. The name has
+ * already been printed. */
+ space = H5Dget_space(dset);
+ space_type = H5Sget_simple_extent_type(space);
+ ndims = H5Sget_simple_extent_dims(space, cur_size, max_size);
+ h5tools_str_append(&buffer, " {");
+ for (i=0; i<ndims; i++) {
+ h5tools_str_append(&buffer, "%s"HSIZE_T_FORMAT, i?", ":"", cur_size[i]);
+ if (max_size[i]==H5S_UNLIMITED) {
+ h5tools_str_append(&buffer, "/%s", "Inf");
+ }
+ else if (max_size[i]!=cur_size[i] || verbose_g>0) {
+ h5tools_str_append(&buffer, "/"HSIZE_T_FORMAT, max_size[i]);
+ }
+ }
+ if (space_type==H5S_SCALAR) h5tools_str_append(&buffer, "SCALAR");
+ else if (space_type==H5S_NULL) h5tools_str_append(&buffer, "NULL");
+ h5tools_str_append(&buffer, "}");
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ H5Sclose (space);
+
+ h5tools_str_close(&buffer);
+
+ return 0;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: dataset_list2
+ *
+ * Purpose: List information about a dataset which should appear after
+ * information which is general to all objects.
+ *
+ * Return: Success: 0
+ *
+ * Failure: -1
+ *
+ * Programmer: Robb Matzke
+ * Thursday, August 27, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+dataset_list2(hid_t dset, const char H5_ATTR_UNUSED *name)
+{
+ hid_t dcpl; /* dataset creation property list */
+ hid_t type; /* data type of dataset */
+ hid_t space; /* data space of dataset */
+ int nf; /* number of filters */
+ unsigned filt_flags; /* filter flags */
+ H5Z_filter_t filt_id; /* filter identification number */
+ unsigned cd_values[20]; /* filter client data values */
+ size_t cd_nelmts; /* filter client number of values */
+ size_t cd_num; /* filter client data counter */
+ char f_name[256]; /* filter/file name */
+ char s[64]; /* temporary string buffer */
+ off_t f_offset; /* offset in external file */
+ hsize_t f_size; /* bytes used in external file */
+ hsize_t total, used; /* total size or offset */
+ int ndims; /* dimensionality */
+ int n, max_len; /* max extern file name length */
+ double utilization; /* percent utilization of storage */
+ H5T_class_t tclass; /* datatype class identifier */
+ int i;
+ H5D_layout_t stl;
+ hsize_t curr_pos = 0; /* total data element position */
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t *info = &ls_dataformat;
+
+ HDmemset(&ctx, 0, sizeof(ctx));
+ HDmemset(&buffer, 0, sizeof(h5tools_str_t));
+
+ h5tools_str_reset(&buffer);
+
+ if(verbose_g > 0) {
+ dcpl = H5Dget_create_plist(dset);
+ space = H5Dget_space(dset);
+ type = H5Dget_type(dset);
+
+ stl = H5Pget_layout(dcpl);
+ switch (stl) {
+ case H5D_CHUNKED:
+ {
+ hsize_t chsize[64]; /* chunk size in elements */
+
+ ndims = H5Pget_chunk(dcpl, (int)NELMTS(chsize), chsize/*out*/);
+ h5tools_str_append(&buffer, " %-10s {", "Chunks:");
+ total = H5Tget_size(type);
+ for (i=0; i<ndims; i++) {
+ h5tools_str_append(&buffer, "%s"HSIZE_T_FORMAT, i?", ":"", chsize[i]);
+ total *= chsize[i];
+ }
+ h5tools_str_append(&buffer, "} "HSIZE_T_FORMAT" bytes\n", total);
+ }
+ break;
+ case H5D_COMPACT:
+ break;
+ case H5D_CONTIGUOUS:
+ /* Print information about external storage */
+ if((nf = H5Pget_external_count(dcpl)) > 0) {
+ for(i = 0, max_len = 0; i < nf; i++) {
+ if(H5Pget_external(dcpl, (unsigned)i, sizeof(f_name), f_name, NULL, NULL) < 0)
+ continue;
+ n = print_string(NULL, f_name, TRUE);
+ max_len = MAX(max_len, n);
+ } /* end for */
+ h5tools_str_append(&buffer, " %-10s %d external file%s\n",
+ "Extern:", nf, 1==nf?"":"s");
+ h5tools_str_append(&buffer, " %4s %10s %10s %10s %s\n",
+ "ID", "DSet-Addr", "File-Addr", "Bytes", "File");
+ h5tools_str_append(&buffer, " %4s %10s %10s %10s ",
+ "----", "----------", "----------", "----------");
+ for (i=0; i<max_len; i++) h5tools_str_append(&buffer, "-");
+ h5tools_str_append(&buffer, "\n");
+ for (i=0, total=0; i<nf; i++) {
+ if (H5Pget_external(dcpl, (unsigned)i, sizeof(f_name), f_name, &f_offset, &f_size)<0) {
+ h5tools_str_append(&buffer,
+ " #%03d %10"H5_PRINTF_LL_WIDTH"u %10s %10s ***ERROR*** %s\n",
+ i, total, "", "",
+ i+1<nf?"Following addresses are incorrect":"");
+ }
+ else if (H5S_UNLIMITED==f_size) {
+ h5tools_str_append(&buffer, " #%03d %10"H5_PRINTF_LL_WIDTH"u %10"H5_PRINTF_LL_WIDTH"u %10s ",
+ i, total, (hsize_t)f_offset, "INF");
+ print_string(&buffer, f_name, TRUE);
+ }
+ else {
+ h5tools_str_append(&buffer, " #%03d %10"H5_PRINTF_LL_WIDTH"u %10"H5_PRINTF_LL_WIDTH"u %10"H5_PRINTF_LL_WIDTH"u ",
+ i, total, (hsize_t)f_offset, f_size);
+ print_string(&buffer, f_name, TRUE);
+ }
+ h5tools_str_append(&buffer, "\n");
+ total += f_size;
+ }
+ h5tools_str_append(&buffer, " %4s %10s %10s %10s ",
+ "----", "----------", "----------", "----------");
+ for (i=0; i<max_len; i++)
+ h5tools_str_append(&buffer, "-");
+ h5tools_str_append(&buffer, "\n");
+ } /* end if */
+ break;
+
+ case H5D_VIRTUAL:
+ {
+ char dset_name[256]; /* Dataset name */
+ size_t vmaps;
+
+ H5Pget_virtual_count(dcpl, &vmaps);
+
+ if (vmaps) {
+ size_t next;
+
+ h5tools_str_append(&buffer, " %-10s {%ld} Source {\n", "Maps:", vmaps);
+ for (next = 0; next < (unsigned) vmaps; next++) {
+ H5Pget_virtual_filename(dcpl, next, f_name, sizeof(f_name));
+ H5Pget_virtual_dsetname(dcpl, next, dset_name, sizeof(dset_name));
+ h5tools_str_append(&buffer, " %-10s ", " ");
+ print_string(&buffer, f_name, TRUE);
+ h5tools_str_append(&buffer, " ");
+ print_string(&buffer, dset_name, TRUE);
+ h5tools_str_append(&buffer, "\n");
+ }
+ h5tools_str_append(&buffer, " %-10s}\n", " ");
+ }
+ }
+ break;
+
+ case H5D_LAYOUT_ERROR:
+ case H5D_NLAYOUTS:
+ default:
+ HDassert(0);
+ break;
+ }
+ /* Print total raw storage size */
+ total = (hsize_t)H5Sget_simple_extent_npoints(space) * H5Tget_size(type);
+ used = H5Dget_storage_size(dset);
+ tclass = H5Tget_class(type);
+ h5tools_str_append(&buffer, " %-10s ", "Storage:");
+ switch (tclass)
+ {
+
+ case H5T_VLEN:
+ h5tools_str_append(&buffer, "information not available");
+ break;
+
+ case H5T_REFERENCE:
+ if ( H5Tequal(type, H5T_STD_REF_DSETREG))
+ {
+ h5tools_str_append(&buffer, "information not available");
+ }
+ break;
+
+ case H5T_NO_CLASS:
+ case H5T_INTEGER:
+ case H5T_FLOAT:
+ case H5T_TIME:
+ case H5T_STRING:
+ case H5T_BITFIELD:
+ case H5T_OPAQUE:
+ case H5T_COMPOUND:
+ case H5T_ENUM:
+ case H5T_ARRAY:
+ case H5T_NCLASSES:
+ default:
+ h5tools_str_append(&buffer, HSIZE_T_FORMAT" logical byte%s, "HSIZE_T_FORMAT" allocated byte%s",
+ total, 1==total?"":"s",
+ used, 1==used?"":"s");
+ if (used>0)
+ {
+ utilization = ((double)total * (double)100.0f) / (double)used;
+ h5tools_str_append(&buffer, ", %1.2f%% utilization", utilization);
+ }
+ }
+
+ h5tools_str_append(&buffer, "\n");
+
+ /* Print information about raw data filters */
+ if((nf = H5Pget_nfilters(dcpl)) > 0) {
+ for(i = 0; i < nf; i++) {
+ cd_nelmts = NELMTS(cd_values);
+ filt_id = H5Pget_filter2(dcpl, (unsigned)i, &filt_flags, &cd_nelmts,
+ cd_values, sizeof(f_name), f_name, NULL);
+ f_name[sizeof(f_name) - 1] = '\0';
+ HDsnprintf(s, sizeof(s), "Filter-%d:", i);
+ h5tools_str_append(&buffer, " %-10s %s-%u %s {", s,
+ (f_name[0] ? f_name : "method"),
+ (unsigned)filt_id,
+ ((filt_flags & H5Z_FLAG_OPTIONAL) ? "OPT" : ""));
+ for(cd_num = 0; cd_num < cd_nelmts; cd_num++)
+ h5tools_str_append(&buffer, "%s%u", (cd_num ? ", " : ""), cd_values[cd_num]);
+ h5tools_str_append(&buffer, "}\n");
+ } /* end for */
+ } /* end if */
+
+ /* Print data type */
+ h5tools_str_append(&buffer, " %-10s ", "Type:");
+ print_type(&buffer, type, 15);
+ h5tools_str_append(&buffer, "\n");
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ /* Print address information */
+ if(address_g)
+ H5Ddebug(dset);
+
+ /* Close stuff */
+ H5Tclose(type);
+ H5Sclose(space);
+ H5Pclose(dcpl);
+ } /* end if */
+
+ h5tools_str_close(&buffer);
+
+ if(data_g)
+ dump_dataset_values(dset);
+
+ return 0;
+} /* end dataset_list2() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: datatype_list2
+ *
+ * Purpose: List information about a datatype which should appear after
+ * information which is general to all objects.
+ *
+ * Return: Success: 0
+ *
+ * Failure: -1
+ *
+ * Programmer: Robb Matzke
+ * Thursday, November 5, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+datatype_list2(hid_t type, const char H5_ATTR_UNUSED *name)
+{
+ if (verbose_g>0) {
+ hsize_t curr_pos = 0; /* total data element position */
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t *info = &ls_dataformat;
+
+ HDmemset(&ctx, 0, sizeof(ctx));
+ HDmemset(&buffer, 0, sizeof(h5tools_str_t));
+
+ h5tools_str_reset(&buffer);
+
+ h5tools_str_append(&buffer, " %-10s ", "Type:");
+ print_type(&buffer, type, 15);
+ h5tools_str_append(&buffer, "\n");
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ h5tools_str_close(&buffer);
+ }
+ return 0;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: list_obj
+ *
+ * Purpose: Prints information about an object
+ *
+ * Return: Success: 0
+ *
+ * Failure: -1
+ *
+ * Programmer: Quincey Koziol
+ * Tuesday, November 6, 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void *_iter)
+{
+ H5O_type_t obj_type = oinfo->type; /* Type of the object */
+ iter_t *iter = (iter_t*)_iter;
+ hsize_t curr_pos = 0; /* total data element position */
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t *info = &ls_dataformat;
+
+ HDmemset(&ctx, 0, sizeof(ctx));
+ HDmemset(&buffer, 0, sizeof(h5tools_str_t));
+
+ h5tools_str_reset(&buffer);
+
+ /* Print the link's name, either full name or base name */
+ if(!iter->symlink_target)
+ print_obj_name(&buffer, iter, name, "");
+
+ /* Check object information */
+ if(oinfo->type < 0 || oinfo->type >= H5O_TYPE_NTYPES) {
+ h5tools_str_append(&buffer, "Unknown type(%d)", (int)oinfo->type);
+ obj_type = H5O_TYPE_UNKNOWN;
+ }
+ if(iter->symlink_target)
+ h5tools_str_append(&buffer, "{");
+ if(obj_type >= 0 && dispatch_g[obj_type].name)
+ h5tools_str_append(&buffer, "%s", dispatch_g[obj_type].name);
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ /* Check if we've seen this object before */
+ if(first_seen) {
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, ", same as ");
+ print_string(&buffer, first_seen, TRUE);
+ if(!iter->symlink_target) {
+ h5tools_str_append(&buffer, "\n");
+ }
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ } /* end if */
+ else {
+ hid_t obj = (-1); /* ID of object opened */
+
+ /* Open the object. Not all objects can be opened. If this is the case
+ * then return right away.
+ */
+ if(obj_type >= 0 && (obj = H5Oopen(iter->fid, name, H5P_DEFAULT)) < 0) {
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, " *ERROR*\n");
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ goto done;
+ } /* end if */
+
+ /* List the first line of information for the object. */
+ if(obj_type >= 0 && dispatch_g[obj_type].list1)
+ (dispatch_g[obj_type].list1)(obj);
+ if(!iter->symlink_target || (verbose_g > 0)) {
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "\n");
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
+
+ /* Show detailed information about the object, beginning with information
+ * which is common to all objects. */
+ if(verbose_g > 0) {
+ size_t buf_size = 0;
+ char* comment = NULL;
+ ssize_t cmt_bufsize = -1;
+
+ /* Display attributes */
+ if(obj_type >= 0)
+ H5Aiterate2(obj, H5_INDEX_NAME, H5_ITER_INC, NULL, list_attr, NULL);
+
+ /* Object location & reference count */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, " %-10s %lu:"H5_PRINTF_HADDR_FMT"\n", "Location:", oinfo->fileno, oinfo->addr);
+ h5tools_str_append(&buffer, " %-10s %u\n", "Links:", (unsigned)oinfo->rc);
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ /* Modification time */
+ if(oinfo->mtime > 0) {
+ char buf[256];
+ struct tm *tm;
+
+ if(simple_output_g)
+ tm = HDgmtime(&(oinfo->mtime));
+ else
+ tm = HDlocaltime(&(oinfo->mtime));
+ if(tm) {
+ HDstrftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S %Z", tm);
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, " %-10s %s\n", "Modified:", buf);
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ } /* end if */
+ } /* end if */
+
+ /* Object comment */
+ cmt_bufsize = H5Oget_comment(obj, comment, buf_size);
+
+ /* if the actual length of the comment is longer than cmt_bufsize, then call
+ * H5Oget_comment again with the correct value.
+ * If the call to H5Oget_comment returned an error, skip this block */
+ if (cmt_bufsize > 0) {
+ comment = (char *)HDmalloc((size_t)cmt_bufsize + 1); /* new_size including null terminator */
+ if(comment) {
+ cmt_bufsize = H5Oget_comment(obj, comment, (size_t)cmt_bufsize);
+ if(cmt_bufsize > 0) {
+ comment[cmt_bufsize] = 0;
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, " %-10s \"", "Comment:");
+ print_string(&buffer, comment, FALSE);
+ h5tools_str_append(&buffer, "\"\n");
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ } /* end if */
+ HDfree(comment);
+ }
+ }
+ } /* end if */
+
+ /* Detailed list for object */
+ if(obj_type >= 0 && dispatch_g[obj_type].list2)
+ (dispatch_g[obj_type].list2)(obj, name);
+
+ /* Close the object. */
+ if(obj_type >= 0)
+ H5Oclose(obj);
+ } /* end else */
+
+done:
+ if(iter->symlink_target) {
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "}\n");
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ iter->symlink_target = FALSE;
+ }
+ h5tools_str_close(&buffer);
+
+ return 0;
+} /* end list_obj() */
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: list_lnk
+ *
+ * Purpose: Prints information about a link
+ *
+ * Return: Success: 0
+ *
+ * Failure: -1
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, November 8, 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+list_lnk(const char *name, const H5L_info_t *linfo, void *_iter)
+{
+ char *buf=NULL;
+ iter_t *iter = (iter_t*)_iter;
+ int ret;
+ 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;
+
+ HDmemset(&ctx, 0, sizeof(ctx));
+ HDmemset(&buffer, 0, sizeof(h5tools_str_t));
+
+ h5tools_str_reset(&buffer);
+
+ /* init linkinfo struct */
+ HDmemset(&lnk_info, 0, sizeof(h5tool_link_info_t));
+
+ /* if verbose, make H5tools_get_symlink_info() display more */
+ if (verbose_g)
+ lnk_info.opt.msg_mode=1;
+
+ /* Print the link's name, either full name or base name */
+ print_obj_name(&buffer, iter, name, "");
+
+ switch(linfo->type) {
+ case H5L_TYPE_SOFT:
+ ret = H5tools_get_symlink_info(iter->fid, name, &lnk_info, follow_symlink_g);
+ /* lnk_info.trg_path is malloced in H5tools_get_symlink_info()
+ * so it will be freed via buf later */
+ buf = (char*)lnk_info.trg_path;
+ /* error */
+ if (ret < 0)
+ goto done;
+ /* no dangling link option given and detect dangling link */
+ else if (no_dangling_link_g && ret == 0)
+ iter->symlink_list->dangle_link = TRUE;
+
+ h5tools_str_append(&buffer, "Soft Link {");
+ h5tools_str_append(&buffer, buf);
+ h5tools_str_append(&buffer, "}");
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ if(follow_symlink_g)
+ {
+ hbool_t orig_grp_literal = grp_literal_g;
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, " ");
+
+ /* Check if we have already seen this softlink */
+ if(symlink_is_visited(iter->symlink_list, linfo->type, NULL, buf))
+ {
+ h5tools_str_append(&buffer, "{Already Visited}\n");
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ goto done;
+ }
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ /* Add this link to the list of seen softlinks */
+ if(symlink_visit_add(iter->symlink_list, linfo->type, NULL, buf) < 0)
+ goto done;
+
+ /* Adjust user data to specify that we are operating on the
+ * target of an soft link */
+ iter->symlink_target = TRUE;
+
+ /* Prevent recursive listing of soft link target if
+ * recursive_g is off */
+ if(!recursive_g)
+ grp_literal_g = TRUE;
+ /* Recurse through the soft link */
+ if(visit_obj(iter->fid, name, iter) < 0)
+ {
+ grp_literal_g = orig_grp_literal;
+ goto done;
+ }
+
+ grp_literal_g = orig_grp_literal;
+ }
+ else {
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "\n");
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
+
+ break;
+
+ case H5L_TYPE_EXTERNAL:
+ {
+ const char *filename;
+ const char *path;
+ hbool_t follow_link = follow_symlink_g || follow_elink_g;
+
+ ret = H5tools_get_symlink_info(iter->fid, name, &lnk_info, follow_link);
+ /* lnk_info.trg_path is malloced in H5tools_get_symlink_info()
+ * so it will be freed via buf later */
+ buf = (char*)lnk_info.trg_path;
+ /* error */
+ if (ret < 0)
+ goto done;
+ /* no dangling link option given and detect dangling link */
+ else if (no_dangling_link_g && ret == 0)
+ iter->symlink_list->dangle_link = TRUE;
+
+ if(H5Lunpack_elink_val(buf, linfo->u.val_size, NULL, &filename, &path) < 0)
+ goto done;
+
+ h5tools_str_append(&buffer, "External Link {");
+ h5tools_str_append(&buffer, filename);
+ h5tools_str_append(&buffer, "/");
+ if(*path != '/')
+ h5tools_str_append(&buffer, "/");
+ h5tools_str_append(&buffer, path);
+ h5tools_str_append(&buffer, "}");
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ /* Recurse through the external link */
+ /* keep the follow_elink_g for backward compatibility with -E */
+ if(follow_link)
+ {
+ hbool_t orig_grp_literal = grp_literal_g;
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, " ");
+
+ /* Check if we have already seen this elink */
+ if(symlink_is_visited(iter->symlink_list, linfo->type, filename, path))
+ {
+ h5tools_str_append(&buffer, "{Already Visited}\n");
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ goto done;
+ }
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ /* Add this link to the list of seen elinks */
+ if(symlink_visit_add(iter->symlink_list, linfo->type, filename, path) < 0)
+ {
+ goto done;
+ }
+
+ /* Adjust user data to specify that we are operating on the
+ * target of an external link */
+ iter->symlink_target = TRUE;
+
+ /* Prevent recursive listing of external link target if
+ * recursive_g is off */
+ if(!recursive_g)
+ grp_literal_g = TRUE;
+
+ /* Recurse through the external link */
+ if(visit_obj(iter->fid, name, iter) < 0) {
+ grp_literal_g = orig_grp_literal;
+ goto done;
+ }
+
+ grp_literal_g = orig_grp_literal;
+ }
+ else
+ PRINTVALSTREAM(rawoutstream, "\n");
+ }
+ break;
+
+ case H5L_TYPE_ERROR:
+ case H5L_TYPE_HARD:
+ case H5L_TYPE_MAX:
+ default:
+ h5tools_str_append(&buffer, "UD Link {cannot follow UD links}\n");
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
+ } /* end switch */
+
+done:
+ h5tools_str_close(&buffer);
+
+ if (buf)
+ HDfree(buf);
+ return 0;
+} /* end list_lnk() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: visit_obj
+ *
+ * Purpose: Begins iteration on an object
+ *
+ * Return:
+ * Success: 0
+ * Failure: -1
+ *
+ * Programmer: Neil Fortner
+ * Wednesday, August 21, 2008
+ * Mostly copied from main()
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+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 */
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t *info = &ls_dataformat;
+
+ HDmemset(&ctx, 0, sizeof(ctx));
+ HDmemset(&buffer, 0, sizeof(h5tools_str_t));
+
+ h5tools_str_reset(&buffer);
+
+ /* Retrieve info for object to list */
+ if(H5Oget_info_by_name(file, oname, &oi, H5P_DEFAULT) < 0) {
+ if(iter->symlink_target) {
+ h5tools_str_append(&buffer, "{**NOT FOUND**}\n");
+ iter->symlink_target = FALSE;
+ }
+ else
+ print_obj_name(&buffer, iter, oname, "**NOT FOUND**");
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ retval = -1;
+ goto done;
+ } /* end if */
+
+ /* Check for group iteration */
+ if(H5O_TYPE_GROUP == oi.type && !grp_literal_g) {
+ /* Get ID for group */
+ if(!iter->symlink_target && (iter->gid = H5Gopen2(file, oname, H5P_DEFAULT)) < 0) {
+ h5tools_str_append(&buffer, "%s: unable to open '%s' as group\n", iter->fname, oname);
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ goto done; /* Previously "continue", when this code was in main().
+ * We don't "continue" here in order to close the file
+ * and free the file name properly. */
+ } /* end if */
+
+ /* Delay specifying the name start point so the original object name is
+ * displayed if it is a link or non-group object */
+ iter->name_start = iter->base_len;
+
+ /* Specified name is a group. List the complete contents of the group. */
+ h5trav_visit(file, oname, (hbool_t) (display_root_g || iter->symlink_target), recursive_g, list_obj, list_lnk, iter);
+
+ /* Close group */
+ if(!iter->symlink_target)
+ H5Gclose(iter->gid);
+ } /* end if */
+ else {
+ /* Use file ID for root group ID */
+ iter->gid = file;
+
+ /* Specified name is a non-group object -- list that object */
+ list_obj(oname, &oi, NULL, iter);
+ } /* end else */
+
+done:
+ h5tools_str_close(&buffer);
+
+ return retval;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: get_width
+ *
+ * Purpose: Figure out how wide the screen is. This is highly
+ * unportable, but the user can always override the width we
+ * detect by giving a command-line option. These code snippets
+ * were borrowed from the GNU less(1).
+ *
+ * Return: Success: Number of columns.
+ *
+ * Failure: Some default number of columms.
+ *
+ * Programmer: Robb Matzke
+ * Friday, November 6, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+get_width(void)
+{
+ int width = 80; /*the default */
+ char *s;
+
+ /* Try to get it from the COLUMNS environment variable first since it's
+ * value is sometimes wrong. */
+ if ((s=HDgetenv("COLUMNS")) && *s && isdigit((int)*s))
+ width = (int)HDstrtol(s, NULL, 0);
+
+#if defined(H5_HAVE_STRUCT_VIDEOCONFIG) && defined(H5_HAVE__GETVIDEOCONFIG)
+ {
+ /* Microsoft C */
+ struct videoconfig w;
+ _getvideoconfig(&w);
+ width = w.numtextcols;
+ }
+#elif defined(H5_HAVE_STRUCT_TEXT_INFO) && defined(H5_HAVE_GETTEXTINFO)
+ {
+ /* Borland C or DJGPPC */
+ struct text_info w;
+ gettextinfo(&w);
+ width = w.screenwidth;
+ }
+#elif defined(H5_HAVE_GETCONSOLESCREENBUFFERINFO)
+ {
+ /* Win32 C */
+ CONSOLE_SCREEN_BUFFER_INFO scr;
+ GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &scr);
+ width = scr.srWindow.Right - scr.srWindow.Left + 1;
+ }
+#elif defined(H5_HAVE__SCRSIZE)
+ {
+ /* OS/2 */
+ int w[2];
+ _scrsize(w);
+ width = w[0];
+ }
+#elif defined(H5_HAVE_TIOCGWINSZ) && defined(H5_HAVE_IOCTL)
+ {
+ /* Unix with ioctl(TIOCGWINSZ) */
+ struct winsize w;
+ if (ioctl(2, (int)TIOCGWINSZ, &w)>=0 && w.ws_col>0)
+ width = w.ws_col;
+ }
+#elif defined(H5_HAVE_TIOCGETD) && defined(H5_HAVE_IOCTL)
+ {
+ /* Unix with ioctl(TIOCGETD) */
+ struct uwdata w;
+ if (ioctl(2, WIOCGETD, &w)>=0 && w.uw_width>0)
+ width = w.uw_width / w.uw_hs;
+ }
+#endif
+
+ /* Set to at least 1 */
+ if (width<1) width = 1;
+ return width;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: is_valid_args
+ *
+ * Purpose: check if command line arguments are valid
+ *
+ * Return:
+ * Success: TRUE (1)
+ * Failure: FALSE (0)
+ *
+ * Programmer:
+ * Jonathan Kim (06/15/2010)
+ *
+ *-------------------------------------------------------------------------*/
+static hbool_t
+is_valid_args(void)
+{
+ hbool_t ret = TRUE;
+
+ if(recursive_g && grp_literal_g)
+ {
+ HDfprintf(rawerrorstream, "Error: 'recursive' option not compatible with 'group info' option!\n\n");
+ ret = FALSE;
+ goto out;
+ }
+
+ if(no_dangling_link_g && !follow_symlink_g)
+ {
+ HDfprintf(rawerrorstream, "Error: --no-dangling-links must be used along with --follow-symlinks option!\n\n");
+ ret = FALSE;
+ goto out;
+ }
+
+out:
+ return ret;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: leave
+ *
+ * Purpose: Close HDF5 and MPI and call exit()
+ *
+ * Return: Does not return
+ *
+ * Programmer: Quincey Koziol
+ * Saturday, January 31, 2004
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+leave(int ret)
+{
+ h5tools_close();
+
+ HDexit(ret);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: main
+ *
+ * Purpose: Opens a file and lists the specified group
+ *
+ * Return: Success: 0
+ *
+ * Failure: 1
+ *
+ * Programmer: Robb Matzke
+ * Monday, March 23, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+main(int argc, const char *argv[])
+{
+ hid_t file = -1;
+ char *fname = NULL, *oname = NULL, *x;
+ const char *s = NULL;
+ char *rest;
+ int argno;
+ static char root_name[] = "/";
+ char drivername[50];
+ const char *preferred_driver = NULL;
+ int err_exit = 0;
+
+ h5tools_setprogname(PROGRAMNAME);
+ h5tools_setstatus(EXIT_SUCCESS);
+
+ /* Initialize h5tools lib */
+ h5tools_init();
+
+ /* Build object display table */
+ DISPATCH(H5O_TYPE_GROUP, "Group", NULL, NULL);
+ DISPATCH(H5O_TYPE_DATASET, "Dataset", dataset_list1, dataset_list2);
+ DISPATCH(H5O_TYPE_NAMED_DATATYPE, "Type", NULL, datatype_list2);
+
+ /* Default output width */
+ width_g = get_width();
+
+ /* Switches come before non-switch arguments */
+ for(argno = 1; argno < argc && '-' == argv[argno][0]; argno++) {
+ if(!HDstrcmp(argv[argno], "--")) {
+ /* Last switch */
+ argno++;
+ break;
+ } else if(!HDstrcmp(argv[argno], "--help")) {
+ usage();
+ leave(EXIT_SUCCESS);
+ } else if(!HDstrcmp(argv[argno], "--address")) {
+ address_g = TRUE;
+ } else if(!HDstrcmp(argv[argno], "--data")) {
+ data_g = TRUE;
+ } else if(!HDstrcmp(argv[argno], "--enable-error-stack")) {
+ show_errors_g = TRUE;
+ /* deprecated --errors */
+ } else if(!HDstrcmp(argv[argno], "--errors")) {
+ show_errors_g = TRUE;
+ } else if(!HDstrcmp(argv[argno], "--follow-symlinks")) {
+ follow_symlink_g = TRUE;
+ } else if(!HDstrcmp(argv[argno], "--no-dangling-links")) {
+ no_dangling_link_g = TRUE;
+ } else if(!HDstrcmp(argv[argno], "--external")) {
+ follow_elink_g = TRUE;
+ } else if(!HDstrcmp(argv[argno], "--full")) {
+ fullname_g = TRUE;
+ } else if(!HDstrcmp(argv[argno], "--group")) {
+ grp_literal_g = TRUE;
+ } else if(!HDstrcmp(argv[argno], "--label")) {
+ label_g = TRUE;
+ } else if(!HDstrcmp(argv[argno], "--recursive")) {
+ recursive_g = TRUE;
+ fullname_g = TRUE;
+ } else if(!HDstrcmp(argv[argno], "--simple")) {
+ simple_output_g = TRUE;
+ } else if(!HDstrcmp(argv[argno], "--string")) {
+ string_g = TRUE;
+ } else if(!HDstrncmp(argv[argno], "--vfd=", (size_t)6)) {
+ preferred_driver = argv[argno]+6;
+ } else if(!HDstrncmp(argv[argno], "--width=", (size_t)8)) {
+ width_g = (int)HDstrtol(argv[argno]+8, &rest, 0);
+
+ if(0 == width_g)
+ no_line_wrap_g = TRUE;
+ else if(width_g < 0 || *rest) {
+ usage();
+ leave(EXIT_FAILURE);
+ }
+ } else if(!HDstrcmp(argv[argno], "--width")) {
+ if((argno + 1) >= argc) {
+ usage();
+ leave(EXIT_FAILURE);
+ } else {
+ s = argv[++argno];
+ }
+ width_g = (int)HDstrtol(s, &rest, 0);
+ if(width_g <= 0 || *rest) {
+ usage();
+ leave(EXIT_FAILURE);
+ }
+ } else if(!HDstrcmp(argv[argno], "--verbose")) {
+ verbose_g++;
+ } else if(!HDstrcmp(argv[argno], "--version")) {
+ print_version(h5tools_getprogname());
+ leave(EXIT_SUCCESS);
+ } else if(!HDstrcmp(argv[argno], "--hexdump")) {
+ hexdump_g = TRUE;
+ } else if(!HDstrncmp(argv[argno], "-w", (size_t)2)) {
+ if(argv[argno][2]) {
+ s = argv[argno] + 2;
+ } else if((argno + 1) >= argc) {
+ usage();
+ leave(EXIT_FAILURE);
+ } else {
+ s = argv[++argno];
+ }
+ width_g = (int)HDstrtol(s, &rest, 0);
+
+ if(0 == width_g)
+ no_line_wrap_g = TRUE;
+ else if(width_g < 0 || *rest) {
+ usage();
+ leave(EXIT_FAILURE);
+ }
+ } else if('-'!=argv[argno][1]) {
+ /* Single-letter switches */
+ for(s = argv[argno] + 1; *s; s++) {
+ switch(*s) {
+ case '?':
+ case 'h': /* --help */
+ usage();
+ leave(EXIT_SUCCESS);
+
+ case 'a': /* --address */
+ address_g = TRUE;
+ break;
+
+ case 'd': /* --data */
+ data_g = TRUE;
+ break;
+
+ /* deprecated -e */
+ case 'e': /* --errors */
+ show_errors_g = TRUE;
+ break;
+
+ case 'E': /* --external */
+ follow_elink_g = TRUE;
+ break;
+
+ case 'f': /* --full */
+ fullname_g = TRUE;
+ break;
+
+ case 'g': /* --group */
+ grp_literal_g = TRUE;
+ break;
+
+ case 'l': /* --label */
+ label_g = TRUE;
+ break;
+
+ case 'r': /* --recursive */
+ recursive_g = TRUE;
+ fullname_g = TRUE;
+ break;
+
+ case 'S': /* --simple */
+ simple_output_g = TRUE;
+ break;
+
+ case 's': /* --string */
+ string_g = TRUE;
+ break;
+
+ case 'v': /* --verbose */
+ verbose_g++;
+ break;
+
+ case 'V': /* --version */
+ print_version(h5tools_getprogname());
+ leave(EXIT_SUCCESS);
+
+ case 'x': /* --hexdump */
+ hexdump_g = TRUE;
+ break;
+
+ default:
+ usage();
+ leave(EXIT_FAILURE);
+ } /* end switch */
+ } /* end for */
+ } else {
+ usage();
+ leave(EXIT_FAILURE);
+ }
+ } /* end for */
+
+ /* If no arguments remain then print a usage message (instead of doing
+ * absolutely nothing ;-) */
+ if(argno >= argc) {
+ usage();
+ leave(EXIT_FAILURE);
+ } /* end if */
+
+ /* Check for conflicting arguments */
+ if (!is_valid_args())
+ {
+ usage();
+ leave(EXIT_FAILURE);
+ }
+
+ /* Turn off HDF5's automatic error printing unless you're debugging h5ls */
+ if(!show_errors_g)
+ H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
+
+
+ /* Each remaining argument is an hdf5 file followed by an optional slash
+ * and object name.
+ *
+ * Example: ../dir1/foo/bar/baz
+ * \_________/\______/
+ * file obj
+ *
+ * The dichotomy is determined by calling H5Fopen() repeatedly until it
+ * succeeds. The first call uses the entire name and each subsequent call
+ * chops off the last component. If we reach the beginning of the name
+ * then there must have been something wrong with the file (perhaps it
+ * doesn't exist). */
+ show_file_name_g = (argc-argno > 1); /*show file names if more than one*/
+ while(argno < argc) {
+ H5L_info_t li;
+ iter_t iter;
+ symlink_trav_t symlink_list;
+ size_t u;
+
+ fname = HDstrdup(argv[argno++]);
+ oname = NULL;
+ file = -1;
+
+ while(fname && *fname) {
+ file = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, preferred_driver, drivername, sizeof drivername);
+
+ if(file >= 0) {
+ if(verbose_g)
+ PRINTSTREAM(rawoutstream, "Opened \"%s\" with %s driver.\n", fname, drivername);
+ break; /*success*/
+ } /* end if */
+
+ /* Shorten the file name; lengthen the object name */
+ x = oname;
+ oname = HDstrrchr(fname, '/');
+ if(x)
+ *x = '/';
+ if(!oname)
+ break;
+ *oname = '\0';
+ } /* end while */
+
+ if(file < 0) {
+ HDfprintf(rawerrorstream, "%s: unable to open file\n", argv[argno-1]);
+ HDfree(fname);
+ err_exit = 1;
+ continue;
+ } /* end if */
+ if(oname) {
+ /* Always use absolute paths to avoid confusion, keep track of where
+ * to begin path name output */
+ *oname = '/';
+ iter.base_len = HDstrlen(oname);
+ iter.base_len -= oname[iter.base_len-1] == '/';
+ x = oname;
+ if(NULL == (oname = HDstrdup(oname))) {
+ HDfprintf(rawerrorstream, "memory allocation failed\n");
+ leave(EXIT_FAILURE);
+ }
+ *x = '\0';
+ /* Delay specifying the name start point so the original object name
+ * is displayed if it is a link or non-group object */
+ iter.name_start = 1;
+ }
+ if(!oname || !*oname) {
+ oname = root_name;
+ if(recursive_g)
+ display_root_g = TRUE;
+ iter.base_len = 0;
+ iter.name_start = 0;
+ /* Use x to remember if we have allocated space in oname */
+ x = NULL;
+ } /* end if */
+
+ /* Remember the file information for later */
+ iter.fname = fname;
+ iter.fid = file;
+ iter.gid = -1;
+ iter.symlink_target = FALSE;
+ iter.symlink_list = &symlink_list;
+ iter.symlink_list->dangle_link = FALSE;
+
+ /* Initialize list of visited symbolic links */
+ symlink_list.nused = symlink_list.nalloc = 0;
+ symlink_list.objs = NULL;
+
+ /* Check for root group as object name */
+ if(HDstrcmp(oname, root_name)) {
+ /* Check the type of link given */
+ if(H5Lget_info(file, oname, &li, H5P_DEFAULT) < 0) {
+ hsize_t curr_pos = 0; /* total data element position */
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t *info = &ls_dataformat;
+
+ HDmemset(&ctx, 0, sizeof(ctx));
+ HDmemset(&buffer, 0, sizeof(h5tools_str_t));
+
+ h5tools_str_reset(&buffer);
+ print_obj_name(&buffer, &iter, oname, "**NOT FOUND**");
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ leave(EXIT_FAILURE);
+ } /* end if */
+ } /* end if */
+ else
+ li.type = H5L_TYPE_HARD;
+
+ /* Open the object and display it's information */
+ if(li.type == H5L_TYPE_HARD) {
+ if(visit_obj(file, oname, &iter) < 0)
+ leave(EXIT_FAILURE);
+ } /* end if(li.type == H5L_TYPE_HARD) */
+ else {
+ /* Specified name is not for object -- list that link */
+ /* Use file ID for root group ID */
+ iter.gid = file;
+ list_lnk(oname, &li, &iter);
+ }
+ H5Fclose(file);
+ HDfree(fname);
+ if(x)
+ HDfree(oname);
+
+ for(u=0; u < symlink_list.nused; u++)
+ {
+ if (symlink_list.objs[u].type == H5L_TYPE_EXTERNAL)
+ HDfree(symlink_list.objs[u].file);
+
+ HDfree(symlink_list.objs[u].path);
+ }
+ HDfree(symlink_list.objs);
+
+ /* if no-dangling-links option specified and dangling link found */
+ if (no_dangling_link_g && iter.symlink_list->dangle_link)
+ err_exit = 1;
+ } /* end while */
+
+ if (err_exit)
+ leave(EXIT_FAILURE);
+ else
+ leave(EXIT_SUCCESS);
+} /* end main() */
+
diff --git a/tools/src/h5repack/CMakeLists.txt b/tools/src/h5repack/CMakeLists.txt
new file mode 100644
index 0000000..cb7f5f6
--- /dev/null
+++ b/tools/src/h5repack/CMakeLists.txt
@@ -0,0 +1,50 @@
+cmake_minimum_required (VERSION 3.1.0)
+PROJECT (HDF5_TOOLS_SRC_H5REPACK)
+
+#-----------------------------------------------------------------------------
+# Setup include Directories
+#-----------------------------------------------------------------------------
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib)
+INCLUDE_DIRECTORIES (${HDF5_TEST_SRC_DIR})
+
+# --------------------------------------------------------------------
+# Add h5Repack executables
+# --------------------------------------------------------------------
+set (REPACK_COMMON_SOURCES
+ ${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack_copy.c
+ ${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack_filters.c
+ ${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack_opttable.c
+ ${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack_parse.c
+ ${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack_refs.c
+ ${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack_verify.c
+ ${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack.c
+)
+
+add_executable (h5repack ${REPACK_COMMON_SOURCES} ${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack_main.c)
+TARGET_NAMING (h5repack STATIC)
+TARGET_C_PROPERTIES (h5repack STATIC " " " ")
+target_link_libraries (h5repack ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+set_target_properties (h5repack PROPERTIES FOLDER tools)
+set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5repack")
+
+set (H5_DEP_EXECUTABLES h5repack)
+
+##############################################################################
+##############################################################################
+### I N S T A L L A T I O N ###
+##############################################################################
+##############################################################################
+
+#-----------------------------------------------------------------------------
+# Rules for Installation of tools using make Install target
+#-----------------------------------------------------------------------------
+
+#INSTALL_PROGRAM_PDB (h5repack ${HDF5_INSTALL_BIN_DIR} toolsapplications)
+
+install (
+ TARGETS
+ h5repack
+ EXPORT
+ ${HDF5_EXPORTED_TARGETS}
+ RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications
+)
diff --git a/tools/src/h5repack/Makefile.am b/tools/src/h5repack/Makefile.am
new file mode 100644
index 0000000..e6e5a56
--- /dev/null
+++ b/tools/src/h5repack/Makefile.am
@@ -0,0 +1,42 @@
+#
+# 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.
+##
+## Makefile.am
+## Run automake to generate a Makefile.in from this file.
+#
+# HDF5 Library Makefile(.in)
+#
+
+include $(top_srcdir)/config/commence.am
+
+# Include src, test, and tools/lib directories
+AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/test -I$(top_srcdir)/tools/lib
+
+# Our main target, h5repack tool
+bin_PROGRAMS=h5repack
+
+# Add h5repack specific linker flags here
+h5repack_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+
+# Depend on the hdf5 library, the tools library, the test library
+LDADD=$(LIBH5TOOLS) $(LIBH5TEST) $(LIBHDF5)
+
+# Source files
+COMMON_SOURCES=h5repack.c h5repack_copy.c h5repack_filters.c \
+ h5repack_opttable.c h5repack_parse.c h5repack_refs.c \
+ h5repack_verify.c
+
+h5repack_SOURCES=$(COMMON_SOURCES) h5repack_main.c
+
+include $(top_srcdir)/config/conclude.am
diff --git a/tools/src/h5repack/h5repack.c b/tools/src/h5repack/h5repack.c
new file mode 100644
index 0000000..ef2085c
--- /dev/null
+++ b/tools/src/h5repack/h5repack.c
@@ -0,0 +1,942 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+
+#include "H5private.h"
+#include "h5repack.h"
+#include "h5tools.h"
+#include "h5tools_utils.h"
+
+/*-------------------------------------------------------------------------
+ * File: h5repack.c
+ * Purpose: Public API functions
+ *-------------------------------------------------------------------------
+ */
+
+static int check_options(pack_opt_t *options);
+static int check_objects(const char* fname, pack_opt_t *options);
+static const char* get_sfilter(H5Z_filter_t filtn);
+static int have_request(pack_opt_t *options);
+
+/*-------------------------------------------------------------------------
+ * Function: h5repack
+ *
+ * Purpose: locate all high-level HDF5 objects in the file
+ * and compress/chunk them using options
+ *
+ * Algorithm: 2 traversals are made to the file; the 1st builds a list of
+ * the objects, the 2nd makes a copy of them, using the options;
+ * the reason for the 1st traversal is to check for invalid
+ * object name requests
+ *
+ * Return: 0, ok, -1, fail
+ *
+ * Programmer: pvn@ncsa.uiuc.edu
+ *
+ * Date: September, 22, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+int h5repack(const char* infile, const char* outfile, pack_opt_t *options) {
+ /* check input */
+ if (check_options(options) < 0)
+ return -1;
+
+ /* check for objects in input that are in the file */
+ if (check_objects(infile, options) < 0)
+ return -1;
+
+ /* copy the objects */
+ if (copy_objects(infile, outfile, options) < 0)
+ return -1;
+
+ return 0;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: h5repack_init
+ *
+ * Purpose: initialize options
+ *
+ * Return: 0, ok, -1, fail
+ *
+ *-------------------------------------------------------------------------
+ */
+int h5repack_init(pack_opt_t *options, int verbose, hbool_t latest,
+ H5F_file_space_type_t strategy, hsize_t threshold) {
+ int k, n;
+
+ HDmemset(options, 0, sizeof(pack_opt_t));
+ options->min_comp = 0;
+ options->verbose = verbose;
+ options->latest = latest;
+ options->layout_g = H5D_LAYOUT_ERROR;
+
+ for (n = 0; n < H5_REPACK_MAX_NFILTERS; n++) {
+ options->filter_g[n].filtn = -1;
+ options->filter_g[n].cd_nelmts = 0;
+ for (k = 0; k < CD_VALUES; k++)
+ options->filter_g[n].cd_values[k] = 0;
+ }
+
+ options->fs_strategy = strategy;
+ options->fs_threshold = threshold;
+
+ return (options_table_init(&(options->op_tbl)));
+}
+
+/*-------------------------------------------------------------------------
+ * Function: h5repack_end
+ *
+ * Purpose: free options table
+ *
+ *-------------------------------------------------------------------------
+ */
+
+int h5repack_end(pack_opt_t *options) {
+ return options_table_free(options->op_tbl);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: h5repack_addfilter
+ *
+ * Purpose: add a compression -f option to table
+ * Example: -f dset:GZIP=6
+ *
+ * Return: 0, ok, -1, fail
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+h5repack_addfilter(const char* str, pack_opt_t *options)
+{
+ obj_list_t *obj_list = NULL; /* one object list for the -f and -l option entry */
+ filter_info_t filter; /* filter info for the current -f option entry */
+ unsigned n_objs; /* number of objects in the current -f or -l option entry */
+ int is_glb; /* is the filter global */
+
+ /* parse the -f option */
+ if (NULL == (obj_list = parse_filter(str, &n_objs, &filter, options, &is_glb)))
+ return -1;
+
+ /* if it applies to all objects */
+ if (is_glb) {
+ int n;
+
+ n = options->n_filter_g++; /* increase # of global filters */
+ if (options->n_filter_g > H5_REPACK_MAX_NFILTERS) {
+ error_msg("maximum number of filters exceeded for <%s>\n", str);
+ HDfree(obj_list);
+ return -1;
+ }
+
+ options->filter_g[n] = filter;
+ }
+ else
+ options_add_filter(obj_list, n_objs, filter, options->op_tbl);
+
+ HDfree(obj_list);
+ return 0;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: h5repack_addlayout
+ *
+ * Purpose: add a layout option
+ *
+ * Return: 0, ok, -1, fail
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+h5repack_addlayout(const char* str, pack_opt_t *options)
+{
+ obj_list_t *obj_list = NULL; /*one object list for the -t and -c option entry */
+ unsigned n_objs; /*number of objects in the current -t or -c option entry */
+ pack_info_t pack; /*info about layout to extract from parse */
+ int j;
+ int ret_value = -1;
+
+ init_packobject(&pack);
+
+ if (options->all_layout == 1) {
+ error_msg( "invalid layout input: 'all' option is present with other objects <%s>\n", str);
+ return ret_value;
+ }
+
+ /* parse the layout option */
+ obj_list = parse_layout(str, &n_objs, &pack, options);
+ if (obj_list) {
+ /* set layout option */
+ options->layout_g = pack.layout;
+
+ /* no individual dataset specified */
+ if (options->all_layout == 1) {
+ if (pack.layout == H5D_CHUNKED) {
+ /* -2 means the NONE option, remove chunking
+ and set the global layout to contiguous */
+ if (pack.chunk.rank == -2)
+ options->layout_g = H5D_CONTIGUOUS;
+ /* otherwise set the global chunking type */
+ else {
+ options->chunk_g.rank = pack.chunk.rank;
+ for (j = 0; j < pack.chunk.rank; j++)
+ options->chunk_g.chunk_lengths[j] = pack.chunk.chunk_lengths[j];
+ }
+ }
+ }
+
+ /* individual dataset specified */
+ if (options->all_layout == 0)
+ ret_value = options_add_layout(obj_list, n_objs, &pack, options->op_tbl);
+
+ HDfree(obj_list);
+ ret_value = 0;
+ }
+
+ return ret_value;
+}
+
+/* Note: The below copy_named_datatype(), named_datatype_free(), copy_attr()
+ * were located in h5repack_copy.c as static prior to bugfix1726.
+ * Made shared functions as copy_attr() was needed in h5repack_refs.c.
+ * However copy_attr() may be obsoleted when H5Acopy is available and put back
+ * others to static in h5repack_copy.c.
+ */
+/*-------------------------------------------------------------------------
+ * Function: copy_named_datatype
+ *
+ * Purpose: Copies the specified datatype anonymously, and returns an open
+ * id for that datatype in the output file. The first time this
+ * is called it scans every named datatype in travt into a
+ * private stack, afterwards it simply scans that stack. The id
+ * returned must be closed after it is no longer needed.
+ * named_datatype_free must be called before the program exits
+ * to free the stack.
+ *
+ * Programmer: Neil Fortner
+ *
+ * Date: April 14, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t copy_named_datatype(hid_t type_in, hid_t fidout,
+ named_dt_t **named_dt_head_p, trav_table_t *travt, pack_opt_t *options) {
+ named_dt_t *dt = *named_dt_head_p; /* Stack pointer */
+ named_dt_t *dt_ret = NULL; /* Datatype to return */
+ H5O_info_t oinfo; /* Object info of input dtype */
+ hid_t ret_value = -1; /* The identifier of the named dtype in the out file */
+
+ if (H5Oget_info(type_in, &oinfo) < 0)
+ goto done;
+
+ if (*named_dt_head_p) {
+ /* Stack already exists, search for the datatype */
+ while (dt && dt->addr_in != oinfo.addr)
+ dt = dt->next;
+
+ dt_ret = dt;
+ }
+ else {
+ /* Create the stack */
+ size_t i;
+
+ for (i = 0; i < travt->nobjs; i++) {
+ if (travt->objs[i].type == H5TRAV_TYPE_NAMED_DATATYPE) {
+ /* Push onto the stack */
+ if (NULL == (dt = (named_dt_t *) HDmalloc(sizeof(named_dt_t)))) {
+ goto done;
+ }
+ dt->next = *named_dt_head_p;
+ *named_dt_head_p = dt;
+
+ /* Update the address and id */
+ dt->addr_in = travt->objs[i].objno;
+ dt->id_out = -1;
+
+ /* Check if this type is the one requested */
+ if (oinfo.addr == dt->addr_in) {
+ HDassert(!dt_ret);
+ dt_ret = dt;
+ } /* end if */
+ } /* end if */
+ } /* end for */
+ } /* end else */
+
+ /* Handle the case that the requested datatype was not found. This is
+ * possible if the datatype was committed anonymously in the input file. */
+ if (!dt_ret) {
+ /* Push the new datatype onto the stack */
+ if (NULL == (dt_ret = (named_dt_t *) HDmalloc(sizeof(named_dt_t)))) {
+ goto done;
+ }
+ dt_ret->next = *named_dt_head_p;
+ *named_dt_head_p = dt_ret;
+
+ /* Update the address and id */
+ dt_ret->addr_in = oinfo.addr;
+ dt_ret->id_out = -1;
+ } /* end if */
+
+ /* If the requested datatype does not yet exist in the output file, copy it
+ * anonymously */
+ if (dt_ret->id_out < 0) {
+ if (options->use_native == 1)
+ dt_ret->id_out = h5tools_get_native_type(type_in);
+ else
+ dt_ret->id_out = H5Tcopy(type_in);
+ if (dt_ret->id_out < 0)
+ goto done;
+ if (H5Tcommit_anon(fidout, dt_ret->id_out, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ goto done;
+ } /* end if */
+
+ /* Set return value */
+ ret_value = dt_ret->id_out;
+
+ /* Increment the ref count on id_out, because the calling function will try
+ * to close it */
+ if(H5Iinc_ref(ret_value) < 0) {
+ ret_value = -1;
+ }
+
+done:
+ return (ret_value);
+} /* end copy_named_datatype */
+
+/*-------------------------------------------------------------------------
+ * Function: named_datatype_free
+ *
+ * Purpose: Frees the stack of named datatypes.
+ *
+ * Programmer: Neil Fortner
+ *
+ * Date: April 14, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+int named_datatype_free(named_dt_t **named_dt_head_p, int ignore_err) {
+ named_dt_t *dt = *named_dt_head_p;
+ int ret_value = -1;
+
+ while (dt) {
+ /* Pop the datatype off the stack and free it */
+ if (H5Tclose(dt->id_out) < 0 && !ignore_err)
+ goto done;
+ dt = dt->next;
+ HDfree(*named_dt_head_p);
+ *named_dt_head_p = dt;
+ } /* end while */
+
+ ret_value = 0;
+
+done:
+ return (ret_value);
+} /* end named_datatype_free */
+
+/*-------------------------------------------------------------------------
+ * Function: copy_attr
+ *
+ * Purpose: copy attributes located in LOC_IN, which is obtained either from
+ * loc_id = H5Gopen2( fid, name);
+ * loc_id = H5Dopen2( fid, name);
+ * loc_id = H5Topen2( fid, name);
+ *
+ * Return: 0, ok, -1 no
+ *
+ * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ *
+ * Date: October, 28, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p,
+ trav_table_t *travt, pack_opt_t *options)
+{
+ int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
+ hid_t attr_id = -1; /* attr ID */
+ hid_t attr_out = -1; /* attr ID */
+ hid_t space_id = -1; /* space ID */
+ hid_t ftype_id = -1; /* file type ID */
+ hid_t wtype_id = -1; /* read/write type ID */
+ size_t msize; /* size of type */
+ void *buf = NULL; /* data buffer */
+ hsize_t nelmts; /* number of elements in dataset */
+ int rank; /* rank of dataset */
+ htri_t is_named; /* Whether the datatype is named */
+ hsize_t dims[H5S_MAX_RANK];/* dimensions of dataset */
+ char name[255];
+ H5O_info_t oinfo; /* object info */
+ int j;
+ unsigned u;
+ hbool_t is_ref = 0;
+ H5T_class_t type_class = -1;
+
+ if (H5Oget_info(loc_in, &oinfo) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Oget_info failed");
+
+ /*-------------------------------------------------------------------------
+ * copy all attributes
+ *-------------------------------------------------------------------------
+ */
+ for (u = 0; u < (unsigned) oinfo.num_attrs; u++) {
+ /* open attribute */
+ if ((attr_id = H5Aopen_by_idx(loc_in, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t) u, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aopen_by_idx failed");
+
+ /* get name */
+ if (H5Aget_name(attr_id, (size_t) 255, name) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+
+ /* get the file datatype */
+ if ((ftype_id = H5Aget_type(attr_id)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_type failed");
+
+ /* Check if the datatype is committed */
+ if ((is_named = H5Tcommitted(ftype_id)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tcommitted failed");
+ if (is_named && travt) {
+ hid_t fidout;
+
+ /* Create out file id */
+ if ((fidout = H5Iget_file_id(loc_out)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Iget_file_id failed");
+
+ /* Copy named dt */
+ if ((wtype_id = copy_named_datatype(ftype_id, fidout, named_dt_head_p, travt, options)) < 0) {
+ H5Fclose(fidout);
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_named_datatype failed");
+ } /* end if */
+
+ if (H5Fclose(fidout) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fclose failed");
+ } /* end if */
+ else {
+ if (options->use_native == 1)
+ wtype_id = h5tools_get_native_type(ftype_id);
+ else
+ wtype_id = H5Tcopy(ftype_id);
+ } /* end else */
+
+ /* get the dataspace handle */
+ if ((space_id = H5Aget_space(attr_id)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_space failed");
+
+ /* get dimensions */
+ if ((rank = H5Sget_simple_extent_dims(space_id, dims, NULL)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed");
+
+ nelmts = 1;
+ for (j = 0; j < rank; j++)
+ nelmts *= dims[j];
+
+ if ((msize = H5Tget_size(wtype_id)) == 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_size failed");
+
+ /*-------------------------------------------------------------------------
+ * object references are a special case. We cannot just copy the buffers,
+ * but instead we recreate the reference.
+ * This is done on a second sweep of the file that just copies the referenced
+ * objects at copy_refs_attr()
+ *-------------------------------------------------------------------------
+ */
+ type_class = H5Tget_class(wtype_id);
+ is_ref = (type_class == H5T_REFERENCE);
+ if (type_class == H5T_VLEN || type_class == H5T_ARRAY) {
+ hid_t base_type = -1;
+
+ base_type = H5Tget_super(ftype_id);
+ is_ref = (is_ref || (H5Tget_class(base_type) == H5T_REFERENCE));
+ H5Tclose(base_type);
+ }
+
+ 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, (unsigned) j);
+ H5T_class_t mtclass = H5Tget_class(mtid);
+ H5Tclose(mtid);
+
+ if (mtclass == H5T_REFERENCE) {
+ is_ref = 1;
+ break;
+ }
+ } /* for (j=0; i<nmembers; j++) */
+ } /* if (type_class == H5T_COMPOUND) */
+
+ if (is_ref) {
+ ; /* handled by copy_refs_attr() */
+ }
+ else {
+ /*-------------------------------------------------------------------------
+ * read to memory
+ *-------------------------------------------------------------------------
+ */
+
+ buf = (void *) HDmalloc((size_t)(nelmts * msize));
+ if (buf == NULL) {
+ error_msg("h5repack", "cannot read into memory\n");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDmalloc failed");
+ } /* end if */
+ if (H5Aread(attr_id, wtype_id, buf) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aread failed");
+
+ /*-------------------------------------------------------------------------
+ * copy
+ *-------------------------------------------------------------------------
+ */
+
+ if ((attr_out = H5Acreate2(loc_out, name, wtype_id, space_id, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Acreate2 failed");
+ if (H5Awrite(attr_out, wtype_id, buf) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Awrite failed");
+
+ /*close*/
+ if (H5Aclose(attr_out) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aclose failed");
+
+ /* Check if we have VL data and string in the attribute's datatype that must
+ * be reclaimed */
+ if (TRUE == h5tools_detect_vlen(wtype_id))
+ H5Dvlen_reclaim(wtype_id, space_id, H5P_DEFAULT, buf);
+ HDfree(buf);
+ buf = NULL;
+ } /*H5T_REFERENCE*/
+
+ if (options->verbose)
+ printf(FORMAT_OBJ_ATTR, "attr", name);
+
+ /*-------------------------------------------------------------------------
+ * close
+ *-------------------------------------------------------------------------
+ */
+
+ if (H5Tclose(ftype_id) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed");
+ if (H5Tclose(wtype_id) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed");
+ if (H5Sclose(space_id) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose failed");
+ if (H5Aclose(attr_id) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aclose failed");
+ } /* u */
+
+ return 0;
+
+done:
+ H5E_BEGIN_TRY {
+ if (buf) {
+ /* Check if we have VL data and string in the attribute's datatype that must
+ * be reclaimed */
+ if (TRUE == h5tools_detect_vlen(wtype_id))
+ H5Dvlen_reclaim(wtype_id, space_id, H5P_DEFAULT, buf);
+
+ /* Free buf */
+ HDfree(buf);
+ } /* end if */
+
+ H5Tclose(ftype_id);
+ H5Tclose(wtype_id);
+ H5Sclose(space_id);
+ H5Aclose(attr_id);
+ H5Aclose(attr_out);
+ } H5E_END_TRY;
+
+ return ret_value;
+} /* end copy_attr() */
+
+/*-------------------------------------------------------------------------
+ * Function: check_options
+ *
+ * Purpose: print options, checks for invalid options
+ *
+ * Return: void, return -1 on error
+ *
+ * Programmer: pvn@ncsa.uiuc.edu
+ *
+ * Date: September, 22, 2003
+ *
+ * Modification:
+ * Peter Cao, July 9, 2007
+ * Add "-L, --latest" and other options to pack a file with the latest file format
+ *
+ *-------------------------------------------------------------------------
+ */
+static int check_options(pack_opt_t *options) {
+ unsigned int i;
+ int k, j, has_cp = 0, has_ck = 0;
+ char slayout[30];
+
+ /*-------------------------------------------------------------------------
+ * objects to layout
+ *-------------------------------------------------------------------------
+ */
+ if (options->verbose && have_request(options) /* only print if requested */) {
+ printf("Objects to modify layout are...\n");
+ if (options->all_layout == 1) {
+ switch (options->layout_g) {
+ case H5D_COMPACT:
+ strcpy(slayout, "compact");
+ break;
+ case H5D_CONTIGUOUS:
+ strcpy(slayout, "contiguous");
+ break;
+ case H5D_CHUNKED:
+ strcpy(slayout, "chunked");
+ break;
+ case H5D_VIRTUAL:
+ strcpy(slayout, "virtual");
+ break;
+ case H5D_LAYOUT_ERROR:
+ case H5D_NLAYOUTS:
+ error_msg("invalid layout\n");
+ return -1;
+ default:
+ strcpy(slayout, "invalid layout\n");
+ return -1;
+ }
+ printf(" Apply %s layout to all\n", slayout);
+ if (H5D_CHUNKED == options->layout_g) {
+ printf("with dimension [");
+ for (j = 0; j < options->chunk_g.rank; j++)
+ printf("%d ", (int) options->chunk_g.chunk_lengths[j]);
+ printf("]\n");
+ }
+ }
+ }/* verbose */
+
+ for (i = 0; i < options->op_tbl->nelems; i++) {
+ char* name = options->op_tbl->objs[i].path;
+
+ if (options->op_tbl->objs[i].chunk.rank > 0) {
+ if (options->verbose) {
+ printf(" <%s> with chunk size ", name);
+ for (k = 0; k < options->op_tbl->objs[i].chunk.rank; k++)
+ printf("%d ",
+ (int) options->op_tbl->objs[i].chunk.chunk_lengths[k]);
+ printf("\n");
+ }
+ has_ck = 1;
+ }
+ else if (options->op_tbl->objs[i].chunk.rank == -2) {
+ if (options->verbose)
+ printf(" <%s> %s\n", name, "NONE (contigous)");
+ has_ck = 1;
+ }
+ }
+
+ if (options->all_layout == 1 && has_ck) {
+ error_msg(
+ "invalid chunking input: 'all' option\
+ is present with other objects\n");
+ return -1;
+ }
+
+ /*-------------------------------------------------------------------------
+ * objects to filter
+ *-------------------------------------------------------------------------
+ */
+
+ if (options->verbose && have_request(options) /* only print if requested */) {
+ printf("Objects to apply filter are...\n");
+ if (options->all_filter == 1) {
+ for (k = 0; k < options->n_filter_g; k++) {
+ H5Z_filter_t filtn = options->filter_g[k].filtn;
+ switch (filtn) {
+ case H5Z_FILTER_NONE:
+ printf(" Uncompress all\n");
+ break;
+ case H5Z_FILTER_SHUFFLE:
+ case H5Z_FILTER_FLETCHER32:
+ printf(" All with %s\n", get_sfilter(filtn));
+ break;
+ case H5Z_FILTER_SZIP:
+ case H5Z_FILTER_DEFLATE:
+ printf(" All with %s, parameter %d\n", get_sfilter(filtn),
+ options->filter_g[k].cd_values[0]);
+ break;
+ default:
+ printf(" User Defined %d\n", filtn);
+ break;
+ } /* k */
+ };
+ }
+ } /* verbose */
+
+ for (i = 0; i < options->op_tbl->nelems; i++) {
+ pack_info_t pack = options->op_tbl->objs[i];
+ char* name = pack.path;
+
+ for (j = 0; j < pack.nfilters; j++) {
+ if (options->verbose) {
+ printf(" <%s> with %s filter\n", name,
+ get_sfilter(pack.filter[j].filtn));
+ }
+
+ has_cp = 1;
+
+ } /* j */
+ } /* i */
+
+ if (options->all_filter == 1 && has_cp) {
+ error_msg(
+ "invalid compression input: 'all' option\
+ is present with other objects\n");
+ return -1;
+ }
+
+ /*-------------------------------------------------------------------------
+ * check options for the latest format
+ *-------------------------------------------------------------------------
+ */
+
+ if (options->grp_compact < 0) {
+ error_msg(
+ "invalid maximum number of links to store as header messages\n");
+ return -1;
+ }
+ if (options->grp_indexed < 0) {
+ error_msg(
+ "invalid minimum number of links to store in the indexed format\n");
+ return -1;
+ }
+ if (options->grp_indexed > options->grp_compact) {
+ error_msg(
+ "minimum indexed size is greater than the maximum compact size\n");
+ return -1;
+ }
+ for (i = 0; i < 8; i++) {
+ if (options->msg_size[i] < 0) {
+ error_msg("invalid shared message size\n");
+ return -1;
+ }
+ }
+
+ /*--------------------------------------------------------------------------------
+ * verify new user userblock options; file name must be present
+ *---------------------------------------------------------------------------------
+ */
+ if (options->ublock_filename != NULL && options->ublock_size == 0) {
+ if (options->verbose) {
+ printf(
+ "Warning: user block size missing for file %s. Assigning a default size of 1024...\n",
+ options->ublock_filename);
+ options->ublock_size = 1024;
+ }
+ }
+
+ if (options->ublock_filename == NULL && options->ublock_size != 0) {
+ error_msg("file name missing for user block\n",
+ options->ublock_filename);
+ return -1;
+ }
+
+ /*--------------------------------------------------------------------------------
+ * verify alignment options; threshold is zero default but alignment not
+ *---------------------------------------------------------------------------------
+ */
+
+ if (options->alignment == 0 && options->threshold != 0) {
+ error_msg("alignment for H5Pset_alignment missing\n");
+ return -1;
+ }
+
+ return 0;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: check_objects
+ *
+ * Purpose: locate all HDF5 objects in the file and compare with user
+ * supplied list
+ *
+ * Return: 0, ok, -1 no
+ *
+ * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ *
+ * Date: September, 23, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+static int check_objects(const char* fname, pack_opt_t *options) {
+ hid_t fid;
+ unsigned int i;
+ trav_table_t *travt = NULL;
+
+ /* nothing to do */
+ if (options->op_tbl->nelems == 0)
+ return 0;
+
+ /*-------------------------------------------------------------------------
+ * open the file
+ *-------------------------------------------------------------------------
+ */
+ if ((fid = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, 0))
+ < 0) {
+ printf("<%s>: %s\n", fname, H5FOPENERROR);
+ return -1;
+ }
+
+ /*-------------------------------------------------------------------------
+ * get the list of objects in the file
+ *-------------------------------------------------------------------------
+ */
+
+ /* init table */
+ trav_table_init(&travt);
+
+ /* get the list of objects in the file */
+ if (h5trav_gettable(fid, travt) < 0)
+ goto out;
+
+ /*-------------------------------------------------------------------------
+ * compare with user supplied list
+ *-------------------------------------------------------------------------
+ */
+
+ if (options->verbose)
+ printf("Opening file <%s>. Searching for objects to modify...\n",
+ fname);
+
+ for (i = 0; i < options->op_tbl->nelems; i++) {
+ char* name = options->op_tbl->objs[i].path;
+ if (options->verbose)
+ printf(" <%s>", name);
+
+ /* the input object names are present in the file and are valid */
+ if (h5trav_getindext(name, travt) < 0) {
+ error_msg("%s Could not find <%s> in file <%s>. Exiting...\n",
+ (options->verbose ? "\n" : ""), name, fname);
+ goto out;
+ }
+ if (options->verbose)
+ printf("...Found\n");
+
+ /* check for extra filter conditions */
+ switch (options->op_tbl->objs[i].filter->filtn) {
+ /* chunk size must be smaller than pixels per block */
+ case H5Z_FILTER_SZIP:
+ {
+ int j;
+ hsize_t csize = 1;
+ unsigned ppb = options->op_tbl->objs[i].filter->cd_values[0];
+ hsize_t dims[H5S_MAX_RANK];
+ int rank;
+ hid_t did;
+ hid_t sid;
+
+ if (options->op_tbl->objs[i].chunk.rank > 0) {
+ rank = options->op_tbl->objs[i].chunk.rank;
+ for (j = 0; j < rank; j++)
+ csize *= options->op_tbl->objs[i].chunk.chunk_lengths[j];
+ }
+ else {
+ if ((did = H5Dopen2(fid, name, H5P_DEFAULT)) < 0)
+ goto out;
+ if ((sid = H5Dget_space(did)) < 0)
+ goto out;
+ if ((rank = H5Sget_simple_extent_ndims(sid)) < 0)
+ goto out;
+ HDmemset(dims, 0, sizeof dims);
+ if (H5Sget_simple_extent_dims(sid, dims, NULL) < 0)
+ goto out;
+ for (j = 0; j < rank; j++)
+ csize *= dims[j];
+ if (H5Sclose(sid) < 0)
+ goto out;
+ if (H5Dclose(did) < 0)
+ goto out;
+ }
+
+ if (csize < ppb) {
+ printf(
+ " <warning: SZIP settins, chunk size is smaller than pixels per block>\n");
+ goto out;
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ } /* i */
+
+ /*-------------------------------------------------------------------------
+ * close
+ *-------------------------------------------------------------------------
+ */
+ H5Fclose(fid);
+ trav_table_free(travt);
+ return 0;
+
+out:
+ H5Fclose(fid);
+ trav_table_free(travt);
+ return -1;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: have_request
+ *
+ * Purpose: check if a filter or layout was requested
+ *
+ * Return: 1 yes, 0 no
+ *
+ * Date: May, 24, 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+static int have_request(pack_opt_t *options) {
+
+ if (options->all_filter || options->all_layout || options->op_tbl->nelems)
+ return 1;
+
+ return 0;
+
+}
+
+/*-------------------------------------------------------------------------
+ * Function: get_sfilter
+ *
+ * Purpose: return the filter as a string name
+ *
+ * Return: name of filter, exit on error
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static const char* get_sfilter(H5Z_filter_t filtn) {
+ if (filtn == H5Z_FILTER_NONE)
+ return "NONE";
+ else if (filtn == H5Z_FILTER_DEFLATE)
+ return "GZIP";
+ else if (filtn == H5Z_FILTER_SZIP)
+ return "SZIP";
+ else if (filtn == H5Z_FILTER_SHUFFLE)
+ return "SHUFFLE";
+ else if (filtn == H5Z_FILTER_FLETCHER32)
+ return "FLETCHER32";
+ else if (filtn == H5Z_FILTER_NBIT)
+ return "NBIT";
+ else if (filtn == H5Z_FILTER_SCALEOFFSET)
+ return "SOFF";
+ else
+ return "UD";
+}
+
diff --git a/tools/src/h5repack/h5repack.h b/tools/src/h5repack/h5repack.h
new file mode 100644
index 0000000..d2ab923
--- /dev/null
+++ b/tools/src/h5repack/h5repack.h
@@ -0,0 +1,243 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+
+#ifndef H5REPACK_H__
+#define H5REPACK_H__
+
+#include "H5private.h"
+#include "hdf5.h"
+#include "h5trav.h"
+
+#define H5FOPENERROR "unable to open file"
+#define PFORMAT "%-7s %-7s %-7s\n" /* chunk info, compression info, name*/
+#define PFORMAT1 "%-7s %-7s %-7s" /* chunk info, compression info, name*/
+#define MAX_NC_NAME 256 /* max length of a name */
+#define MAX_VAR_DIMS 32 /* max per variable dimensions */
+#define 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
+ *-------------------------------------------------------------------------
+ */
+
+/* a list of names */
+typedef struct {
+ char obj[MAX_NC_NAME];
+} obj_list_t;
+
+/*
+ the type of filter and additional parameter
+ type can be one of the filters
+ H5Z_FILTER_NONE 0, uncompress if compressed
+ H5Z_FILTER_DEFLATE 1 , deflation like gzip
+ H5Z_FILTER_SHUFFLE 2 , shuffle the data
+ H5Z_FILTER_FLETCHER32 3 , letcher32 checksum of EDC
+ H5Z_FILTER_SZIP 4 , szip compression
+ H5Z_FILTER_NBIT 5 , nbit compression
+ H5Z_FILTER_SCALEOFFSET 6 , scaleoffset compression
+*/
+
+#define CD_VALUES 20
+
+typedef struct {
+ H5Z_filter_t filtn; /* filter identification number */
+ unsigned cd_values[CD_VALUES]; /* filter client data values */
+ size_t cd_nelmts; /* filter client number of values */
+} filter_info_t;
+
+/* chunk lengths along each dimension and rank */
+typedef struct {
+ hsize_t chunk_lengths[MAX_VAR_DIMS];
+ int rank;
+} chunk_info_t;
+
+/* we currently define a maximum value for the filters array,
+ that corresponds to the current library filters */
+#define H5_REPACK_MAX_NFILTERS 6
+
+/* information for one object, contains PATH, CHUNK info and FILTER info */
+typedef struct {
+ char path[MAX_NC_NAME]; /* name of object */
+ filter_info_t filter[H5_REPACK_MAX_NFILTERS]; /* filter array */
+ int nfilters; /* current number of filters */
+ H5D_layout_t layout; /* layout information */
+ chunk_info_t chunk; /* chunk information */
+ hid_t refobj_id; /* object ID, references */
+} pack_info_t;
+
+/* store a table of all objects */
+typedef struct {
+ unsigned int size;
+ unsigned int nelems;
+ pack_info_t *objs;
+} pack_opttbl_t;
+
+
+/*-------------------------------------------------------------------------
+ * command line options
+ *-------------------------------------------------------------------------
+ */
+
+/* all the above, ready to go to the hrepack call */
+typedef struct {
+ pack_opttbl_t *op_tbl; /*table with all -c and -f options */
+ int all_layout; /*apply the layout to all objects */
+ int all_filter; /*apply the filter to all objects */
+ filter_info_t filter_g[H5_REPACK_MAX_NFILTERS]; /*global filter array for the ALL case */
+ int n_filter_g; /*number of global filters */
+ chunk_info_t chunk_g; /*global chunk INFO for the ALL case */
+ H5D_layout_t layout_g; /*global layout information for the ALL case */
+ int verbose; /*verbose mode */
+ hsize_t min_comp; /*minimum size to compress, in bytes */
+ int use_native; /*use a native type in write */
+ hbool_t latest; /*pack file with the latest file format */
+ int grp_compact; /* Set the maximum number of links to store as header messages in the group */
+ int grp_indexed; /* Set the minimum number of links to store in the indexed format */
+ int msg_size[8]; /* Minimum size of shared messages: dataspace,
+ 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 */
+ hsize_t fs_threshold; /* Free space section threshold */
+} pack_opt_t;
+
+
+typedef struct named_dt_t {
+ haddr_t addr_in; /* Address of the named dtype in the in file */
+ hid_t id_out; /* Open identifier for the dtype in the out file */
+ struct named_dt_t *next; /* Next dtype */
+} named_dt_t;
+
+/*-------------------------------------------------------------------------
+ * public functions
+ *-------------------------------------------------------------------------
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int h5repack(const char* infile, const char* outfile, pack_opt_t *options);
+int h5repack_addfilter(const char* str, pack_opt_t *options);
+int h5repack_addlayout(const char* str, pack_opt_t *options);
+int h5repack_init(pack_opt_t *options, int verbose, hbool_t latest,
+ H5F_file_space_type_t strategy, hsize_t threshold);
+int h5repack_end(pack_opt_t *options);
+int h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options);
+int h5repack_cmp_pl(const char *fname1, const char *fname2);
+
+/* Note: The below copy_named_datatype(), named_datatype_free(), copy_attr()
+ * and struct named_dt_t were located in h5repack_copy.c as static prior to
+ * bugfix1726.
+ * Made shared functions as copy_attr() was needed in h5repack_refs.c.
+ * However copy_attr() may be obsoleted when H5Acopy is available and put back
+ * others to static in h5repack_copy.c.
+ */
+hid_t copy_named_datatype(hid_t type_in, hid_t fidout, named_dt_t **named_dt_head_p, trav_table_t *travt, pack_opt_t *options);
+int named_datatype_free(named_dt_t **named_dt_head_p, int ignore_err);
+int copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p,
+ trav_table_t *travt, pack_opt_t *options);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+
+/*-------------------------------------------------------------------------
+ * private functions
+ *-------------------------------------------------------------------------
+ */
+
+
+/*-------------------------------------------------------------------------
+ * copy module
+ *-------------------------------------------------------------------------
+ */
+
+int copy_objects (const char* fnamein,
+ const char* fnameout,
+ pack_opt_t *options);
+
+int do_copy_refobjs(hid_t fidin,
+ hid_t fidout,
+ trav_table_t *travt,
+ pack_opt_t *options);
+
+/*-------------------------------------------------------------------------
+ * filters and verify module
+ *-------------------------------------------------------------------------
+ */
+void init_packobject(pack_info_t *obj);
+
+
+/*-------------------------------------------------------------------------
+ * filters and copy module
+ *-------------------------------------------------------------------------
+ */
+
+int apply_filters(const char* name, /* object name from traverse list */
+ int rank, /* rank of dataset */
+ hsize_t *dims, /* dimensions of dataset */
+ size_t msize, /* size of type */
+ hid_t dcpl_id, /* dataset creation property list */
+ pack_opt_t *options, /* repack options */
+ int *has_filter); /* (OUT) object NAME has a filter */
+
+
+/*-------------------------------------------------------------------------
+ * options table
+ *-------------------------------------------------------------------------
+ */
+int options_table_init( pack_opttbl_t **tbl );
+int options_table_free( pack_opttbl_t *table );
+int options_add_layout( obj_list_t *obj_list,
+ unsigned n_objs,
+ pack_info_t *pack,
+ pack_opttbl_t *table );
+int options_add_filter ( obj_list_t *obj_list,
+ unsigned n_objs,
+ filter_info_t filt,
+ pack_opttbl_t *table );
+pack_info_t* options_get_object( const char *path,
+ pack_opttbl_t *table);
+
+/*-------------------------------------------------------------------------
+ * parse functions
+ *-------------------------------------------------------------------------
+ */
+
+obj_list_t* parse_filter(const char *str,
+ unsigned *n_objs,
+ filter_info_t *filt,
+ pack_opt_t *options,
+ int *is_glb);
+
+obj_list_t* parse_layout(const char *str,
+ unsigned *n_objs,
+ pack_info_t *pack, /* info about object */
+ pack_opt_t *options);
+
+
+
+
+#endif /* H5REPACK_H__ */
+
diff --git a/tools/src/h5repack/h5repack_copy.c b/tools/src/h5repack/h5repack_copy.c
new file mode 100644
index 0000000..547f61a
--- /dev/null
+++ b/tools/src/h5repack/h5repack_copy.c
@@ -0,0 +1,1581 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include "h5repack.h"
+#include "h5tools.h"
+#include "h5tools_utils.h"
+
+/*-------------------------------------------------------------------------
+ * typedefs
+ *-------------------------------------------------------------------------
+ */
+
+/*-------------------------------------------------------------------------
+ * globals
+ *-------------------------------------------------------------------------
+ */
+
+/*-------------------------------------------------------------------------
+ * macros
+ *-------------------------------------------------------------------------
+ */
+
+/* size of buffer/# of bytes to xfer at a time when copying userblock */
+#define USERBLOCK_XFER_SIZE 512
+
+/* check H5Dread()/H5Dwrite() error, e.g. memory allocation error inside the library. */
+#define CHECK_H5DRW_ERROR(_fun, _fail, _did, _mtid, _msid, _fsid, _pid, _buf) { \
+ H5E_BEGIN_TRY { \
+ if(_fun(_did, _mtid, _msid, _fsid, _pid, _buf) < 0) { \
+ hid_t _err_num = 0; \
+ char _msg[80]; \
+ H5Ewalk2(H5E_DEFAULT, H5E_WALK_DOWNWARD, walk_error_callback, &_err_num); \
+ H5Eget_msg(_err_num, NULL, _msg, (size_t)80); \
+ error_msg("%s %s -- %s\n", #_fun, "failed", _msg); \
+ HGOTO_DONE(_fail) \
+ } \
+ } H5E_END_TRY; \
+}
+
+/*-------------------------------------------------------------------------
+ * local functions
+ *-------------------------------------------------------------------------
+ */
+static int Get_hyperslab(hid_t dcpl_id, int rank_dset, hsize_t dims_dset[],
+ size_t size_datum, hsize_t dims_hslab[], hsize_t * hslab_nbytes_p);
+static void print_dataset_info(hid_t dcpl_id, char *objname, double per, int pr);
+static int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt,
+ pack_opt_t *options);
+static int copy_user_block(const char *infile, const char *outfile,
+ hsize_t size);
+#if defined (H5REPACK_DEBUG_USER_BLOCK)
+static void print_user_block(const char *filename, hid_t fid);
+#endif
+static herr_t walk_error_callback(unsigned n, const H5E_error2_t *err_desc, void *udata);
+
+/* get the major number from the error stack. */
+static herr_t walk_error_callback(H5_ATTR_UNUSED unsigned n, const H5E_error2_t *err_desc, void *udata) {
+ if (err_desc)
+ *((hid_t *) udata) = err_desc->maj_num;
+
+ return 0;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: copy_objects
+ *
+ * Purpose: duplicate all HDF5 objects in the file
+ *
+ * Return: 0, ok, -1 no
+ *
+ * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ *
+ * Date: October, 23, 2003
+ *
+ * Modification:
+ * Peter Cao, June 13, 2007
+ * Add "-L, --latest" and other options to pack a file with the latest file format
+ *
+ * Peter Cao, September 25, 2007
+ * Copy user block when repacking a file
+ *
+ * Pedro Vicente, August 20, 2008
+ * Add a user block to file if requested
+ *
+ *-------------------------------------------------------------------------
+ */
+
+int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options)
+{
+ int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
+ hid_t fidin;
+ hid_t fidout = -1;
+ trav_table_t *travt = NULL;
+ hsize_t ub_size = 0; /* size of user block */
+ hid_t fcpl = H5P_DEFAULT; /* file creation property list ID */
+ hid_t fapl = H5P_DEFAULT; /* file access property list ID */
+
+ /*-------------------------------------------------------------------------
+ * open input file
+ *-------------------------------------------------------------------------
+ */
+ if ((fidin = h5tools_fopen(fnamein, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, (size_t) 0)) < 0) {
+ error_msg("<%s>: %s\n", fnamein, H5FOPENERROR);
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ }
+
+ /* get user block size and file space strategy/threshold */
+ {
+ hid_t fcpl_in; /* file creation property list ID for input file */
+
+ if ((fcpl_in = H5Fget_create_plist(fidin)) < 0) {
+ error_msg("failed to retrieve file creation property list\n");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ }
+
+ if (H5Pget_userblock(fcpl_in, &ub_size) < 0) {
+ error_msg("failed to retrieve userblock size\n");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ }
+
+ if (!options->fs_strategy) {
+ if (H5Pget_file_space(fcpl_in, &options->fs_strategy, NULL) < 0) {
+ error_msg("failed to retrieve file space strategy\n");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ }
+ }
+
+ if (!options->fs_threshold) {
+ if (H5Pget_file_space(fcpl_in, NULL, &options->fs_threshold) < 0) {
+ error_msg("failed to retrieve file space threshold\n");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ }
+ }
+
+ if (H5Pclose(fcpl_in) < 0) {
+ error_msg("failed to close property list\n");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ }
+ }
+
+ /* Check if we need to create a non-default file creation property list */
+ if (options->latest || ub_size > 0) {
+ /* Create file creation property list */
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) {
+ error_msg("fail to create a file creation property list\n");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ }
+
+ if (ub_size > 0) {
+ if (H5Pset_userblock(fcpl, ub_size) < 0) {
+ error_msg("failed to set non-default userblock size\n");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ }
+ }
+
+ if (options->latest) {
+ unsigned i = 0, nindex = 0, mesg_type_flags[5], min_mesg_sizes[5];
+
+ /* Adjust group creation parameters for root group */
+ /* (So that it is created in "dense storage" form) */
+ if (H5Pset_link_phase_change(fcpl, (unsigned) options->grp_compact,
+ (unsigned) options->grp_indexed) < 0) {
+ error_msg("fail to adjust group creation parameters for root group\n");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ }
+
+ for (i = 0; i < 5; i++) {
+ if (options->msg_size[i] > 0) {
+ switch (i) {
+ case 0:
+ mesg_type_flags[nindex] = H5O_SHMESG_SDSPACE_FLAG;
+ break;
+
+ case 1:
+ mesg_type_flags[nindex] = H5O_SHMESG_DTYPE_FLAG;
+ break;
+
+ case 2:
+ mesg_type_flags[nindex] = H5O_SHMESG_FILL_FLAG;
+ break;
+
+ case 3:
+ mesg_type_flags[nindex] = H5O_SHMESG_PLINE_FLAG;
+ break;
+
+ case 4:
+ mesg_type_flags[nindex] = H5O_SHMESG_ATTR_FLAG;
+ break;
+
+ default:
+ break;
+ } /* end switch */
+ min_mesg_sizes[nindex] = (unsigned) options->msg_size[i];
+
+ nindex++;
+ } /* end if */
+ } /* end for */
+
+ if (nindex > 0) {
+ if (H5Pset_shared_mesg_nindexes(fcpl, nindex) < 0) {
+ error_msg("fail to set the number of shared object header message indexes\n");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ }
+
+ /* msg_size[0]=dataspace, 1=datatype, 2=file value, 3=filter pipleline, 4=attribute */
+ for (i = 0; i < (nindex - 1); i++) {
+ if (H5Pset_shared_mesg_index(fcpl, i, mesg_type_flags[i], min_mesg_sizes[i]) < 0) {
+ error_msg("fail to configure the specified shared object header message index\n");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ } /* end if */
+ } /* end for */
+ } /* if (nindex>0) */
+
+ /* Create file access property list */
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) {
+ error_msg("Could not create file access property list\n");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ } /* end if */
+
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) {
+ error_msg("Could not set property for using latest version of the format\n");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ } /* end if */
+ } /* end if */
+ } /* end if */
+#if defined (H5REPACK_DEBUG_USER_BLOCK)
+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) {
+ /* create a file creation property list */
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) {
+ error_msg("fail to create a file creation property list\n");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ }
+ }
+
+ /* set user block size */
+ if (H5Pset_userblock(fcpl, options->ublock_size) < 0) {
+ error_msg("failed to set userblock size\n");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ }
+ }
+
+ /*-------------------------------------------------------------------------
+ * set alignment options
+ *-------------------------------------------------------------------------
+ */
+ if (options->alignment > 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");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ }
+ }
+
+ if (H5Pset_alignment(fapl, options->threshold, options->alignment) < 0) {
+ error_msg("failed to set alignment\n");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ }
+ }
+
+ /*-------------------------------------------------------------------------
+ * 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");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ }
+ }
+
+ if (H5Pset_meta_block_size(fapl, options->meta_block_size) < 0) {
+ error_msg("failed to set metadata block size\n");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ }
+ }
+
+ /*-------------------------------------------------------------------------
+ * set free-space strategy options
+ *-------------------------------------------------------------------------
+ */
+
+ /* either use the FCPL already created or create a new one */
+ 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");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ }
+ }
+
+ /* 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");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ }
+
+ /*-------------------------------------------------------------------------
+ * 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);
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ }
+
+ /*-------------------------------------------------------------------------
+ * write a new user block if requested
+ *-------------------------------------------------------------------------
+ */
+ if (options->ublock_size > 0) {
+ if (copy_user_block(options->ublock_filename, fnameout, options->ublock_size) < 0) {
+ error_msg("Could not copy user block. Exiting...\n");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ }
+ }
+
+ /*-------------------------------------------------------------------------
+ * get list of objects
+ *-------------------------------------------------------------------------
+ */
+
+ /* init table */
+ trav_table_init(&travt);
+
+ /* get the list of objects in the file */
+ if (h5trav_gettable(fidin, travt) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+
+ /*-------------------------------------------------------------------------
+ * do the copy
+ *-------------------------------------------------------------------------
+ */
+ if (do_copy_objects(fidin, fidout, travt, options) < 0) {
+ error_msg("<%s>: Could not copy data to: %s\n", fnamein, fnameout);
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ } /* end if */
+
+ /*-------------------------------------------------------------------------
+ * do the copy of referenced objects
+ * and create hard links
+ *-------------------------------------------------------------------------
+ */
+ if (do_copy_refobjs(fidin, fidout, travt, options) < 0) {
+ printf("h5repack: <%s>: Could not copy data to: %s\n", fnamein, fnameout);
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ }
+
+ /*-------------------------------------------------------------------------
+ * close
+ *-------------------------------------------------------------------------
+ */
+
+ if (fapl > 0)
+ H5Pclose(fapl);
+
+ if (fcpl > 0)
+ H5Pclose(fcpl);
+
+ H5Fclose(fidin);
+ H5Fclose(fidout);
+
+ /* free table */
+ trav_table_free(travt);
+ travt = NULL;
+
+ /*-------------------------------------------------------------------------
+ * write only the input file user block if there is no user block file input
+ *-------------------------------------------------------------------------
+ */
+
+ if (ub_size > 0 && options->ublock_size == 0) {
+ if (copy_user_block(fnamein, fnameout, ub_size) < 0) {
+ error_msg("Could not copy user block. Exiting...\n");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ }
+ }
+
+ return 0;
+
+ /*-------------------------------------------------------------------------
+ * out
+ *-------------------------------------------------------------------------
+ */
+
+done:
+ H5E_BEGIN_TRY {
+ H5Pclose(fapl);
+ H5Pclose(fcpl);
+ H5Fclose(fidin);
+ H5Fclose(fidout);
+ } H5E_END_TRY;
+ if (travt)
+ trav_table_free(travt);
+
+ return ret_value;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: Get_hyperslab
+ *
+ * Purpose: Calulate a hyperslab from a dataset for higher performance.
+ * The size of hyperslab is limitted by H5TOOLS_BUFSIZE.
+ * Return the hyperslab dimentions and size in byte.
+ *
+ * Return: 0 - SUCCEED, -1 FAILED
+ *
+ * Parameters:
+ * dcpl_id : [IN] dataset creation property.
+ * rank_dset : [IN] dataset rank
+ * dims_dset[] : [IN] dataset dimentions
+ * size_datum : [IN] size of a data element in byte
+ * dims_hslab[] : [OUT] calculated hyperslab dimentions
+ * * hslab_nbytes_p : [OUT] total byte of the hyperslab
+ *
+ * Programmer: Jonathan Kim
+ * Date: Feburary, 2012
+ * Update:
+ * The hyperslab calucation would be depend on if the dataset is chunked
+ * or not.
+ *
+ * There care 3 conditions to cover:
+ * 1. If chunked and a chunk fits in buffer, each chunk would be a unit of
+ * collection and the boundary would be dataset's dims.
+ * 2. If chunked but a chunk doesn't fit in buffer, each data element would
+ * be a unit of collection and the boundary would be the chunk itself.
+ * 3. If not chunked, each data element would be a unit of collection and
+ * the boundary would be dataset's dims.
+ *
+ * The calulation starts from the last dimention (h5dump dims output).
+ *
+ * Note:
+ * Added for JIRA HDFFV-7862.
+ *-----------------------------------------*/
+
+int Get_hyperslab(hid_t dcpl_id, int rank_dset, hsize_t dims_dset[],
+ size_t size_datum, hsize_t dims_hslab[], hsize_t * hslab_nbytes_p)
+{
+ int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
+ int k;
+ H5D_layout_t dset_layout;
+ int rank_chunk;
+ hsize_t dims_chunk[H5S_MAX_RANK];
+ hsize_t size_chunk = 1;
+ hsize_t nchunk_fit; /* number of chunks that fits in hyperslab buffer (H5TOOLS_BUFSIZE) */
+ hsize_t ndatum_fit; /* number of dataum that fits in hyperslab buffer (H5TOOLS_BUFSIZE) */
+ hsize_t chunk_dims_map[H5S_MAX_RANK]; /* mapped chunk dimentions */
+ hsize_t hs_dims_map[H5S_MAX_RANK]; /* mapped hyperslab dimentions */
+ hsize_t hslab_nbytes; /* size of hyperslab in byte */
+
+ /* init to set as size of a data element */
+ hslab_nbytes = size_datum;
+
+ /* get layout of dataset */
+ dset_layout = H5Pget_layout(dcpl_id);
+
+ /* if dataset is chunked */
+ if (dset_layout == H5D_CHUNKED) {
+ /* get chunk dims */
+ rank_chunk = H5Pget_chunk(dcpl_id, rank_dset, dims_chunk);
+ if (rank_chunk < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+
+ for (k = rank_dset; k > 0; --k)
+ size_chunk *= dims_chunk[k - 1];
+
+ /* figure out how many chunks can fit in the hyperslab buffer */
+ nchunk_fit = (H5TOOLS_BUFSIZE / size_datum) / size_chunk;
+
+ /* 1. if a chunk fit in hyperslab buffer */
+ if (nchunk_fit >= 1) {
+ /* Calulate a hyperslab that contains as many chunks that can fit
+ * in hyperslab buffer. Hyperslab will be increased starting from
+ * the last dimention of the dataset (see h5dump's dims output).
+ * The calculation boundary is dataset dims.
+ * In the loop, used mapping from a datum to a chunk to figure out
+ * chunk based hyperslab.
+ */
+ for (k = rank_dset; k > 0; --k) {
+ /* map dataset dimentions with a chunk dims */
+ chunk_dims_map[k - 1] = dims_dset[k - 1] / dims_chunk[k - 1];
+
+ /* if reminder exist, increse by 1 to cover partial edge chunks */
+ if (dims_dset[k - 1] % dims_chunk[k - 1] > 0)
+ chunk_dims_map[k - 1]++;
+
+ /* get mapped hyperslab dims */
+ hs_dims_map[k - 1] = MIN (nchunk_fit, chunk_dims_map[k-1]);
+
+ /* prepare next round */
+ nchunk_fit = nchunk_fit / chunk_dims_map[k - 1];
+ /* if a chunk is bigger than the rest of buffer */
+ if (nchunk_fit == 0)
+ nchunk_fit = 1;
+
+ /* get hyperslab dimentions as unmapping to actual size */
+ dims_hslab[k - 1] = MIN( (hs_dims_map[k-1] * dims_chunk[k-1]), dims_dset[k-1]);
+
+ /* calculate total size for the hyperslab */
+ hslab_nbytes *= dims_hslab[k - 1];
+ }
+ }
+ /* 2. if a chunk is bigger than hyperslab buffer */
+ else {
+ /* Calulate a hyperslab that contains as many data elements that
+ * can fit in hyperslab buffer. Hyperslab will be increased
+ * starting from the last dimention of the chunk (see h5dump's dims
+ * output).
+ * The calculation boundary is a chunk dims.
+ */
+ for (k = rank_dset; k > 0; --k) {
+ ndatum_fit = H5TOOLS_BUFSIZE / hslab_nbytes;
+
+ /* if a datum is bigger than rest of buffer */
+ if (ndatum_fit == 0)
+ ndatum_fit = 1;
+ /* get hyperslab dimentions within a chunk boundary */
+ dims_hslab[k - 1] = MIN (dims_chunk[k-1], ndatum_fit);
+
+ /* calculate total size for the hyperslab */
+ hslab_nbytes *= dims_hslab[k - 1];
+
+ if (hslab_nbytes <= 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ }
+ }
+ }
+ /* 3. if dataset is not chunked */
+ else {
+ /* Calulate a hyperslab that contains as many data elements that can
+ * fit in hyperslab buffer. Hyperslab will be increased starting from
+ * the last dimention of the dataset (see h5dump's dims output).
+ * The calculation boundary is dataset dims.
+ */
+ for (k = rank_dset; k > 0; --k) {
+ ndatum_fit = H5TOOLS_BUFSIZE / hslab_nbytes;
+
+ /* if a datum is bigger than rest of buffer */
+ if (ndatum_fit == 0)
+ ndatum_fit = 1;
+ /* get hyperslab dimentions within dataset boundary */
+ dims_hslab[k - 1] = MIN(dims_dset[k - 1], ndatum_fit);
+
+ /* calculate total size for the hyperslab */
+ hslab_nbytes *= dims_hslab[k - 1];
+
+ if (hslab_nbytes <= 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ }
+ }
+
+ /* pass out the hyperslab size*/
+ *hslab_nbytes_p = hslab_nbytes;
+
+done:
+ return ret_value;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: do_copy_objects
+ *
+ * Purpose: duplicate all HDF5 objects in the file
+ *
+ * Return: 0, ok, -1 no
+ *
+ * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ *
+ * Date: October, 23, 2003
+ *
+ * Modifications:
+ *
+ * July 2004: Introduced the extra EC or NN option for SZIP
+ *
+ * December 2004: Added a check for H5Dcreate; if the dataset cannot be created
+ * with the requested filter, use the input one
+ *
+ * October 2006: Read/write using the file type by default.
+ *
+ * October 2006: Read by hyperslabs for big datasets.
+ *
+ * A threshold of H5TOOLS_MALLOCSIZE (128 MB) is the limit upon which I/O hyperslab is done
+ * i.e., if the memory needed to read a dataset is greater than this limit,
+ * then hyperslab I/O is done instead of one operation I/O
+ * For each dataset, the memory needed is calculated according to
+ *
+ * memory needed = number of elements * size of each element
+ *
+ * if the memory needed is lower than H5TOOLS_MALLOCSIZE, then the following operations
+ * are done
+ *
+ * H5Dread( input_dataset1 )
+ * H5Dread( input_dataset2 )
+ *
+ * with all elements in the datasets selected. If the memory needed is greater than
+ * H5TOOLS_MALLOCSIZE, then the following operations are done instead:
+ *
+ * a strip mine is defined for each dimension k (a strip mine is defined as a
+ * hyperslab whose size is memory manageable) according to the formula
+ *
+ * (1) strip_mine_size[k ] = MIN(dimension[k ], H5TOOLS_BUFSIZE / size of memory type)
+ *
+ * where H5TOOLS_BUFSIZE is a constant currently defined as 1MB. This formula assures
+ * that for small datasets (small relative to the H5TOOLS_BUFSIZE constant), the strip
+ * mine size k is simply defined as its dimension k, but for larger datasets the
+ * hyperslab size is still memory manageable.
+ * a cycle is done until the number of elements in the dataset is reached. In each
+ * iteration, two parameters are defined for the function H5Sselect_hyperslab,
+ * the start and size of each hyperslab, according to
+ *
+ * (2) hyperslab_size [k] = MIN(dimension[k] - hyperslab_offset[k], strip_mine_size [k])
+ *
+ * where hyperslab_offset [k] is initially set to zero, and later incremented in
+ * hyperslab_size[k] offsets. The reason for the operation
+ *
+ * dimension[k] - hyperslab_offset[k]
+ *
+ * in (2) is that, when using the strip mine size, it assures that the "remaining" part
+ * of the dataset that does not fill an entire strip mine is processed.
+ *
+ * November 2006: Use H5Ocopy in the copy of objects. The logic for using
+ * H5Ocopy or not is if a change of filters or layout is requested by the user
+ * then use read/write else use H5Ocopy.
+ *
+ * May, 1, 2008: Add a printing of the compression ratio of old size / new size
+ *
+ * Feburary 2012: improve Read/Write by hyperslabs for big datasets.
+ * Programmer: Jonathan Kim
+ *
+ * A threshold of H5TOOLS_MALLOCSIZE is the limit upon which I/O hyperslab is done
+ * i.e., if the memory needed to read a dataset is greater than this limit,
+ * then hyperslab I/O is done instead of one operation I/O
+ * For each dataset, the memory needed is calculated according to
+ *
+ * memory needed = number of elements * size of each element
+ *
+ * if the memory needed is lower than H5TOOLS_MALLOCSIZE, then the following operations
+ * are done
+ *
+ * H5Dread( input_dataset )
+ * H5Dwrite( output_dataset )
+ *
+ * with all elements in the datasets selected. If the memory needed is greater than
+ * H5TOOLS_MALLOCSIZE, then the following operations are done instead:
+ *
+ * 1. figure out a hyperslab (dimentions) and size (refer to Get_hyperslab()).
+ * 2. Calculate the hyperslab selections as the selection is moving forward.
+ * Selection would be same as the hyperslab except for the remaining edge portion
+ * of the dataset. The code take care of the remaining portion if exist.
+ *
+ *-------------------------------------------------------------------------
+ */
+
+int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt,
+ pack_opt_t *options) /* repack options */
+{
+ int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
+ hid_t grp_in = -1; /* group ID */
+ hid_t grp_out = -1; /* group ID */
+ hid_t dset_in = -1; /* read dataset ID */
+ hid_t dset_out = -1; /* write dataset ID */
+ hid_t gcpl_in = -1; /* group creation property list */
+ hid_t gcpl_out = -1; /* group creation property list */
+ hid_t type_in = -1; /* named type ID */
+ hid_t type_out = -1; /* named type ID */
+ hid_t dcpl_in = -1; /* dataset creation property list ID */
+ hid_t dcpl_out = -1; /* dataset creation property list ID */
+ hid_t f_space_id = -1; /* file space ID */
+ hid_t ftype_id = -1; /* file type ID */
+ hid_t wtype_id = -1; /* read/write type ID */
+ named_dt_t *named_dt_head = NULL; /* Pointer to the stack of named datatypes copied */
+ size_t msize; /* size of type */
+ hsize_t nelmts; /* number of elements in dataset */
+ H5D_space_status_t space_status; /* determines whether space has been allocated for the dataset */
+ int rank; /* rank of dataset */
+ hsize_t dims[H5S_MAX_RANK];/* dimensions of dataset */
+ hsize_t dsize_in; /* input dataset size before filter */
+ hsize_t dsize_out; /* output dataset size after filter */
+ int apply_s; /* flag for apply filter to small dataset sizes */
+ int apply_f; /* flag for apply filter to return error on H5Dcreate */
+ void *buf = NULL; /* buffer for raw data */
+ void *hslab_buf = NULL; /* hyperslab buffer for raw data */
+ int has_filter; /* current object has a filter */
+ int req_filter; /* there was a request for a filter */
+ int req_obj_layout = 0; /* request layout to current object */
+ unsigned crt_order_flags; /* group creation order flag */
+ unsigned i;
+ unsigned u;
+ int is_ref = 0;
+ htri_t is_named;
+ hbool_t limit_maxdims;
+ hsize_t size_dset;
+
+ /*-------------------------------------------------------------------------
+ * copy the suppplied object list
+ *-------------------------------------------------------------------------
+ */
+
+ if (options->verbose) {
+ printf("-----------------------------------------\n");
+ printf(" Type Filter (Compression) Name\n");
+ printf("-----------------------------------------\n");
+ }
+
+ for (i = 0; i < travt->nobjs; i++) {
+ /* init variables per obj */
+ buf = NULL;
+ limit_maxdims = FALSE;
+
+ switch (travt->objs[i].type) {
+ case H5TRAV_TYPE_UNKNOWN:
+ HDassert(0);
+ break;
+
+ /*-------------------------------------------------------------------------
+ * H5TRAV_TYPE_GROUP
+ *-------------------------------------------------------------------------
+ */
+ case H5TRAV_TYPE_GROUP:
+ if (options->verbose)
+ printf(FORMAT_OBJ, "group", travt->objs[i].name);
+
+ /* open input group */
+ if ((grp_in = H5Gopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gopen2 failed");
+
+ /* get input group creation property list */
+ if ((gcpl_in = H5Gget_create_plist(grp_in)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gget_create_plist failed");
+
+ /* query and set the group creation properties */
+ if (H5Pget_link_creation_order(gcpl_in, &crt_order_flags) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_link_creation_order failed");
+
+ /* set up group creation property list */
+ if ((gcpl_out = H5Pcreate(H5P_GROUP_CREATE)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed");
+
+ if (H5Pset_link_creation_order(gcpl_out, crt_order_flags) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_link_creation_order failed");
+
+ /*-------------------------------------------------------------------------
+ * the root is a special case, we get an ID for the root group
+ * and copy its attributes using that ID
+ *-------------------------------------------------------------------------
+ */
+ if (HDstrcmp(travt->objs[i].name, "/") == 0) {
+ if ((grp_out = H5Gopen2(fidout, "/", H5P_DEFAULT)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gopen2 failed");
+ }
+ else {
+ if (options->grp_compact > 0 || options->grp_indexed > 0)
+ if (H5Pset_link_phase_change(gcpl_out, (unsigned) options->grp_compact, (unsigned) options->grp_indexed) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_link_phase_change failed");
+
+ if ((grp_out = H5Gcreate2(fidout, travt->objs[i].name, H5P_DEFAULT, gcpl_out, H5P_DEFAULT)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gcreate2 failed");
+ }
+
+ /*-------------------------------------------------------------------------
+ * copy attrs
+ *-------------------------------------------------------------------------
+ */
+ if (copy_attr(grp_in, grp_out, &named_dt_head, travt, options) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_attr failed");
+
+ if (H5Pclose(gcpl_out) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ if (H5Pclose(gcpl_in) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ if (H5Gclose(grp_out) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gclose failed");
+ if (H5Gclose(grp_in) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gclose failed");
+
+ break;
+
+ /*-------------------------------------------------------------------------
+ * H5TRAV_TYPE_DATASET
+ *-------------------------------------------------------------------------
+ */
+ case H5TRAV_TYPE_DATASET:
+ has_filter = 0;
+ req_filter = 0;
+
+ /* check if global filters were requested */
+ if (options->n_filter_g)
+ req_filter = 1;
+
+ /* check if filters were requested for individual objects */
+ for (u = 0; u < options->op_tbl->nelems; u++)
+ if (HDstrcmp(travt->objs[i].name, options->op_tbl->objs[u].path) == 0)
+ if (options->op_tbl->objs[u].filter->filtn > 0)
+ req_filter = 1;
+
+ /* check if layout change requested individual object */
+ if (options->layout_g != H5D_LAYOUT_ERROR) {
+ pack_info_t *pckinfo;
+
+ /* any dataset is specified */
+ if (options->op_tbl->nelems > 0) {
+ /* check if object exist */
+ pckinfo = options_get_object(travt->objs[i].name, options->op_tbl);
+ if (pckinfo)
+ req_obj_layout = 1;
+ }
+ }
+
+ /* early detection of references */
+ if ((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed");
+ if ((ftype_id = H5Dget_type(dset_in)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_type failed");
+ if (H5T_REFERENCE == H5Tget_class(ftype_id))
+ is_ref = 1;
+
+ /* Check if the datatype is committed */
+ if ((is_named = H5Tcommitted(ftype_id)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tcommitted failed");
+ if (is_named)
+ if ((wtype_id = copy_named_datatype(ftype_id, fidout, &named_dt_head, travt, options)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_named_datatype failed");
+
+ if (H5Tclose(ftype_id) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed");
+ if (H5Dclose(dset_in) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed");
+
+ /*-------------------------------------------------------------------------
+ * check if we should use H5Ocopy or not
+ * if there is a request for filters/layout, we read/write the object
+ * otherwise we do a copy using H5Ocopy
+ *-------------------------------------------------------------------------
+ */
+ if (options->op_tbl->nelems || options->all_filter == 1
+ || options->all_layout == 1 || is_ref || is_named) {
+
+ int j;
+
+ if ((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed");
+ if ((f_space_id = H5Dget_space(dset_in)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed");
+ if ((ftype_id = H5Dget_type(dset_in)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_type failed");
+ if ((dcpl_in = H5Dget_create_plist(dset_in)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_create_plist failed");
+ if ((dcpl_out = H5Pcopy(dcpl_in)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcopy failed");
+ if ((rank = H5Sget_simple_extent_ndims(f_space_id)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed");
+ HDmemset(dims, 0, sizeof dims);
+ if (H5Sget_simple_extent_dims(f_space_id, dims, NULL) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed");
+ if (H5Dget_space_status(dset_in, &space_status) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space_status failed");
+
+ nelmts = 1;
+ for (j = 0; j < rank; j++)
+ nelmts *= dims[j];
+
+ /* wtype_id will have already been set if using a named dtype */
+ if (!is_named) {
+ if (options->use_native == 1)
+ wtype_id = h5tools_get_native_type(ftype_id);
+ else
+ wtype_id = H5Tcopy(ftype_id);
+ } /* end if */
+
+ if ((msize = H5Tget_size(wtype_id)) == 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_size failed");
+
+ /* 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
+ * 1) the external filters GZIP and SZIP might not be available
+ * 2) the internal filters might be turned off
+ *-------------------------------------------------------------------------
+ */
+ if (h5tools_canreadf((travt->objs[i].name), dcpl_in) == 1) {
+ apply_s = 1;
+ apply_f = 1;
+
+ /*-------------------------------------------------------------------------
+ * references are a special case
+ * we cannot just copy the buffers, but instead we recreate the reference
+ * in a second traversal of the output file
+ *-------------------------------------------------------------------------
+ */
+ if (H5T_REFERENCE != H5Tget_class(wtype_id)) {
+ /* get the storage size of the input dataset */
+ dsize_in = H5Dget_storage_size(dset_in);
+
+ /* check for small size datasets (less than 1k) except
+ * changing to COMPACT. For the reference, COMPACT is limited
+ * by size 64K by library.
+ */
+ if (options->layout_g != H5D_COMPACT)
+ if (size_dset < options->min_comp)
+ apply_s = 0;
+
+ /* apply the filter */
+ if (apply_s)
+ if (apply_filters(travt->objs[i].name, rank, dims, msize, dcpl_out, options, &has_filter) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "apply_filters failed");
+
+ /* only if layout change requested for entire file or
+ * individual obj */
+ if (options->all_layout > 0 || req_obj_layout == 1)
+ /*-------------------------------------------------
+ * 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);
+ }
+
+ /*-------------------------------------------------------------------------
+ * create the output dataset;
+ * disable error checking in case the dataset cannot be created with the
+ * modified dcpl; in that case use the original instead
+ *-------------------------------------------------------------------------
+ */
+ dset_out = H5Dcreate2(fidout, travt->objs[i].name, wtype_id, f_space_id, H5P_DEFAULT, dcpl_out, H5P_DEFAULT);
+ if (dset_out == FAIL) {
+ H5Epush2(H5tools_ERR_STACK_g, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, H5E_tools_g, H5E_tools_min_id_g, "H5Dcreate2 failed");
+ if (options->verbose)
+ printf(" warning: could not create dataset <%s>. Applying original settings\n", travt->objs[i].name);
+
+ if ((dset_out = H5Dcreate2(fidout, travt->objs[i].name, wtype_id, f_space_id, H5P_DEFAULT, dcpl_in, H5P_DEFAULT)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dcreate2 failed");
+ apply_f = 0;
+ }
+
+ /*-------------------------------------------------------------------------
+ * read/write
+ *-------------------------------------------------------------------------
+ */
+ if (nelmts > 0 && space_status != H5D_SPACE_STATUS_NOT_ALLOCATED) {
+ size_t need = (size_t)(nelmts * msize); /* bytes needed */
+
+ /* have to read the whole dataset if there is only one element in the dataset */
+ if (need < H5TOOLS_MALLOCSIZE)
+ buf = HDmalloc(need);
+
+ if (buf != NULL) {
+ /* read/write: use the macro to check error, e.g. memory allocation error inside the library. */
+ CHECK_H5DRW_ERROR(H5Dread, FAIL, dset_in, wtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
+ CHECK_H5DRW_ERROR(H5Dwrite, FAIL, dset_out, wtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
+
+ /* Check if we have VL data in the dataset's
+ * datatype that must be reclaimed */
+ if (TRUE == H5Tdetect_class(wtype_id, H5T_VLEN))
+ if (H5Dvlen_reclaim(wtype_id, f_space_id, H5P_DEFAULT, buf) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dvlen_reclaim failed");
+ }
+ else { /* possibly not enough memory, read/write by hyperslabs */
+ size_t p_type_nbytes = msize; /*size of memory type */
+ hsize_t p_nelmts = nelmts; /*total elements */
+ hsize_t elmtno; /*counter */
+ int carry; /*counter carry value */
+ unsigned int vl_data = 0; /*contains VL datatypes */
+
+ /* hyperslab info */
+ hsize_t hslab_dims[H5S_MAX_RANK]; /*hyperslab dims */
+ hsize_t hslab_nbytes; /*bytes per hyperslab */
+ hsize_t hslab_nelmts; /*elements per hyperslab*/
+ hid_t hslab_space; /*hyperslab data space */
+
+ /* hyperslab selection info */
+ hsize_t hs_sel_offset[H5S_MAX_RANK];/* selection offset */
+ hsize_t hs_sel_count[H5S_MAX_RANK]; /* selection count */
+ hsize_t hs_select_nelmts; /* selected elements */
+ hsize_t zero[8]; /*vector of zeros */
+ int k;
+ H5D_layout_t dset_layout;
+ hid_t dcpl_tmp = -1; /* dataset creation property list ID */
+
+ /* check if we have VL data in the dataset's datatype */
+ if (H5Tdetect_class(wtype_id, H5T_VLEN) == TRUE)
+ vl_data = TRUE;
+
+ /* check first if writing dataset is chunked,
+ * if so use its chunk layout for better performance. */
+ dset_layout = H5Pget_layout(dcpl_out);
+ if (dset_layout == H5D_CHUNKED)
+ dcpl_tmp = dcpl_out; /* writing dataset */
+ else { /* if reading dataset is chunked */
+ dset_layout = H5Pget_layout(dcpl_in);
+ if (dset_layout == H5D_CHUNKED)
+ dcpl_tmp = dcpl_in; /* reading dataset */
+ }
+
+ /* get hyperslab dims and size in byte */
+ if (Get_hyperslab(dcpl_tmp, rank, dims, p_type_nbytes, hslab_dims, &hslab_nbytes) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Get_hyperslab failed");
+
+ hslab_buf = HDmalloc((size_t)hslab_nbytes);
+
+ hslab_nelmts = hslab_nbytes / p_type_nbytes;
+ hslab_space = H5Screate_simple(1, &hslab_nelmts, NULL);
+
+ /* the hyperslab selection loop */
+ HDmemset(hs_sel_offset, 0, sizeof hs_sel_offset);
+ HDmemset(zero, 0, sizeof zero);
+
+ for (elmtno = 0; elmtno < p_nelmts; elmtno += hs_select_nelmts) {
+ if (rank > 0) {
+ /* calculate the hyperslab selections.
+ * The selection would be same as the hyperslab
+ * except for remaining edge portion of the dataset
+ * which is smaller then the hyperslab.
+ */
+ for (k = 0, hs_select_nelmts = 1; k < rank; k++) {
+ /* MIN() is used to get the remaining edge portion if exist.
+ * "dims[k] - hs_sel_offset[k]" is remaining edge portion that is smaller then the hyperslab.*/
+ hs_sel_count[k] = MIN(dims[k] - hs_sel_offset[k], hslab_dims[k]);
+ hs_select_nelmts *= hs_sel_count[k];
+ }
+
+ if (H5Sselect_hyperslab(f_space_id, H5S_SELECT_SET, hs_sel_offset, NULL, hs_sel_count, NULL) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed");
+ if (H5Sselect_hyperslab(hslab_space, H5S_SELECT_SET, zero, NULL, &hs_select_nelmts, NULL) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed");
+ }
+ else {
+ H5Sselect_all(f_space_id);
+ H5Sselect_all(hslab_space);
+ hs_select_nelmts = 1;
+ } /* rank */
+
+ /* read/write: use the macro to check error, e.g. memory allocation error inside the library. */
+ CHECK_H5DRW_ERROR(H5Dread, FAIL, dset_in, wtype_id, hslab_space, f_space_id, H5P_DEFAULT, hslab_buf);
+ CHECK_H5DRW_ERROR(H5Dwrite, FAIL, dset_out, wtype_id, hslab_space, f_space_id, H5P_DEFAULT, hslab_buf);
+
+ /* reclaim any VL memory, if necessary */
+ if (vl_data)
+ H5Dvlen_reclaim(wtype_id, hslab_space, H5P_DEFAULT, hslab_buf);
+
+ /* calculate the next hyperslab offset */
+ for (k = rank, carry = 1; k > 0 && carry; --k) {
+ hs_sel_offset[k - 1] += hs_sel_count[k - 1];
+ /* if reached the end of a dim */
+ if (hs_sel_offset[k - 1] == dims[k - 1])
+ hs_sel_offset[k - 1] = 0;
+ else
+ carry = 0;
+ } /* k */
+ } /* elmtno */
+
+ H5Sclose(hslab_space);
+ /* free */
+ if (hslab_buf != NULL) {
+ HDfree(hslab_buf);
+ hslab_buf = NULL;
+ }
+ } /* hyperslab read */
+ } /* if (nelmts>0 && space_status==H5D_SPACE_STATUS_NOT_ALLOCATED) */
+
+ /*-------------------------------------------------------------------------
+ * amount of compression used
+ *-------------------------------------------------------------------------
+ */
+ if (options->verbose) {
+ double ratio = 0;
+
+ /* only print the compression ration if there was a filter request */
+ if (apply_s && apply_f && req_filter) {
+ /* get the storage size of the output dataset */
+ dsize_out = H5Dget_storage_size(dset_out);
+
+ /* compression ratio = uncompressed size / compressed size */
+ if (dsize_out != 0)
+ ratio = (double) dsize_in / (double) dsize_out;
+ print_dataset_info(dcpl_out, travt->objs[i].name, ratio, 1);
+ }
+ else
+ print_dataset_info(dcpl_in, travt->objs[i].name, ratio, 0);
+
+ /* print a message that the filter was not applied
+ (in case there was a filter)
+ */
+ if (has_filter && apply_s == 0)
+ printf(" <warning: filter not applied to %s. dataset smaller than %d bytes>\n", travt->objs[i].name, (int) options->min_comp);
+
+ if (has_filter && apply_f == 0)
+ printf(" <warning: could not apply the filter to %s>\n", travt->objs[i].name);
+ } /* verbose */
+
+ /*-------------------------------------------------------------------------
+ * copy attrs
+ *-------------------------------------------------------------------------
+ */
+ if (copy_attr(dset_in, dset_out, &named_dt_head, travt, options) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_attr failed");
+
+ /*close */
+ if (H5Dclose(dset_out) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed");
+ }/*!H5T_REFERENCE*/
+ }/*h5tools_canreadf*/
+
+ /*-------------------------------------------------------------------------
+ * close
+ *-------------------------------------------------------------------------
+ */
+ if (H5Tclose(ftype_id) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed");
+ if (H5Tclose(wtype_id) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed");
+ if (H5Pclose(dcpl_in) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ if (H5Pclose(dcpl_out) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ if (H5Sclose(f_space_id) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose failed");
+ if (H5Dclose(dset_in) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed");
+ }
+ /*-------------------------------------------------------------------------
+ * we do not have request for filter/chunking use H5Ocopy instead
+ *-------------------------------------------------------------------------
+ */
+ else {
+ hid_t pid;
+
+ /* create property to pass copy options */
+ if ((pid = H5Pcreate(H5P_OBJECT_COPY)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed");
+
+ /* set options for object copy */
+ if (H5Pset_copy_object(pid, H5O_COPY_WITHOUT_ATTR_FLAG) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_copy_object failed");
+
+ /*-------------------------------------------------------------------------
+ * do the copy
+ *-------------------------------------------------------------------------
+ */
+
+ if (H5Ocopy(fidin, /* Source file or group identifier */
+ travt->objs[i].name, /* Name of the source object to be copied */
+ fidout, /* Destination file or group identifier */
+ travt->objs[i].name, /* Name of the destination object */
+ pid, /* Properties which apply to the copy */
+ H5P_DEFAULT) < 0) /* Properties which apply to the new hard link */
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Ocopy failed");
+
+ /* close property */
+ if (H5Pclose(pid) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+
+ /*-------------------------------------------------------------------------
+ * copy attrs manually
+ *-------------------------------------------------------------------------
+ */
+ if ((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed");
+ if ((dset_out = H5Dopen2(fidout, travt->objs[i].name, H5P_DEFAULT)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed");
+ if (copy_attr(dset_in, dset_out, &named_dt_head, travt, options) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_attr failed");
+ if (H5Dclose(dset_in) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed");
+ if (H5Dclose(dset_out) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed");
+
+ if (options->verbose)
+ printf(FORMAT_OBJ, "dset", travt->objs[i].name);
+
+ } /* end do we have request for filter/chunking */
+ break;
+
+ /*-------------------------------------------------------------------------
+ * H5TRAV_TYPE_NAMED_DATATYPE
+ *-------------------------------------------------------------------------
+ */
+ case H5TRAV_TYPE_NAMED_DATATYPE:
+ if (options->verbose)
+ printf(FORMAT_OBJ, "type", travt->objs[i].name);
+
+ if ((type_in = H5Topen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Topen2 failed");
+
+ /* Copy the datatype anonymously */
+ if ((type_out = copy_named_datatype(type_in, fidout, &named_dt_head, travt, options)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_named_datatype failed");
+
+ /* Link in to group structure */
+ if (H5Lcreate_hard(type_out, ".", fidout, travt->objs[i].name, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Lcreate_hard failed");
+
+ /*-------------------------------------------------------------------------
+ * copy attrs
+ *-------------------------------------------------------------------------
+ */
+ if (copy_attr(type_in, type_out, &named_dt_head, travt, options) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_attr failed");
+
+ if (H5Tclose(type_in) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed");
+ if (H5Tclose(type_out) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed");
+
+ break;
+
+ /*-------------------------------------------------------------------------
+ * H5TRAV_TYPE_LINK
+ * H5TRAV_TYPE_UDLINK
+ *
+ * Only handles external links; H5Lcopy will fail for other UD link types
+ * since we don't have creation or copy callbacks for them.
+ *-------------------------------------------------------------------------
+ */
+ case H5TRAV_TYPE_LINK:
+ case H5TRAV_TYPE_UDLINK:
+ if (options->verbose)
+ printf(FORMAT_OBJ, "link", travt->objs[i].name);
+
+ if (H5Lcopy(fidin, travt->objs[i].name, fidout, travt->objs[i].name, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Lcopy failed");
+
+ if (options->verbose)
+ printf(FORMAT_OBJ, "link", travt->objs[i].name);
+ break;
+
+ default:
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Object type not found");
+ } /* switch */
+
+ /* free */
+ if (buf != NULL) {
+ HDfree(buf);
+ buf = NULL;
+ }
+ } /* i */
+
+ /* Finalize (link) the stack of named datatypes (if any) */
+ named_datatype_free(&named_dt_head, 0);
+
+ return ret_value;
+
+done:
+ H5E_BEGIN_TRY
+ {
+ H5Gclose(grp_in);
+ H5Gclose(grp_out);
+ H5Pclose(dcpl_in);
+ H5Pclose(gcpl_in);
+ H5Pclose(gcpl_out);
+ H5Sclose(f_space_id);
+ H5Dclose(dset_in);
+ H5Dclose(dset_out);
+ H5Tclose(ftype_id);
+ H5Tclose(wtype_id);
+ H5Tclose(type_in);
+ H5Tclose(type_out);
+ named_datatype_free(&named_dt_head, 1);
+ }H5E_END_TRY;
+
+ /* free */
+ if (buf != NULL)
+ HDfree(buf);
+ if (hslab_buf != NULL)
+ HDfree(hslab_buf);
+
+ return ret_value;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: print_dataset_info
+ *
+ * Purpose: print name, filters, percentage compression of a dataset
+ *
+ *-------------------------------------------------------------------------
+ */
+static void print_dataset_info(hid_t dcpl_id, char *objname, double ratio,
+ int pr)
+{
+ char strfilter[255];
+#if defined (PRINT_DEBUG )
+ char temp[255];
+#endif
+ int nfilters; /* number of filters */
+ unsigned filt_flags; /* filter flags */
+ H5Z_filter_t filtn; /* filter identification number */
+ unsigned cd_values[20]; /* filter client data values */
+ size_t cd_nelmts; /* filter client number of values */
+ char f_objname[256]; /* filter objname */
+ int i;
+
+ HDstrcpy(strfilter, "\0");
+
+ /* get information about input filters */
+ if ((nfilters = H5Pget_nfilters(dcpl_id)) < 0)
+ return;
+
+ for (i = 0; i < nfilters; i++) {
+ cd_nelmts = NELMTS(cd_values);
+
+ filtn = H5Pget_filter2(dcpl_id, (unsigned) i, &filt_flags, &cd_nelmts,
+ cd_values, sizeof(f_objname), f_objname, NULL);
+
+ switch (filtn) {
+ case H5Z_FILTER_NONE:
+ HDstrcat(strfilter, "NONE ");
+ break;
+
+ case H5Z_FILTER_DEFLATE:
+ HDstrcat(strfilter, "GZIP ");
+
+#if defined (PRINT_DEBUG)
+ {
+ unsigned level = cd_values[0];
+
+ sprintf(temp,"(%d)", level);
+ HDstrcat(strfilter, temp);
+ }
+#endif
+ break;
+
+ case H5Z_FILTER_SZIP:
+ HDstrcat(strfilter, "SZIP ");
+
+#if defined (PRINT_DEBUG)
+ {
+ unsigned options_mask = cd_values[0]; /* from dcpl, not filt*/
+ unsigned ppb = cd_values[1];
+
+ sprintf(temp,"(%d,", ppb);
+ HDstrcat(strfilter, temp);
+ if (options_mask & H5_SZIP_EC_OPTION_MASK)
+ HDstrcpy(temp, "EC) ");
+ else if (options_mask & H5_SZIP_NN_OPTION_MASK)
+ HDstrcpy(temp, "NN) ");
+ }
+ HDstrcat(strfilter, temp);
+#endif
+ break;
+
+ case H5Z_FILTER_SHUFFLE:
+ HDstrcat(strfilter, "SHUF ");
+ break;
+
+ case H5Z_FILTER_FLETCHER32:
+ HDstrcat(strfilter, "FLET ");
+ break;
+
+ case H5Z_FILTER_NBIT:
+ HDstrcat(strfilter, "NBIT ");
+ break;
+
+ case H5Z_FILTER_SCALEOFFSET:
+ HDstrcat(strfilter, "SCALEOFFSET ");
+ break;
+
+ default:
+ HDstrcat(strfilter, "UD ");
+ break;
+ } /* switch */
+ }/*i*/
+
+ if (!pr)
+ printf(FORMAT_OBJ, "dset", objname);
+ else {
+ char str[255], temp[28];
+
+ HDstrcpy(str, "dset ");
+ HDstrcat(str, strfilter);
+ sprintf(temp, " (%.3f:1)", ratio);
+ HDstrcat(str, temp);
+ printf(FORMAT_OBJ, str, objname);
+ }
+}
+
+/*-------------------------------------------------------------------------
+ * Function: copy_user_block
+ *
+ * Purpose: copy user block from one file to another
+ *
+ * Return: 0, ok, -1 no
+ *
+ * Programmer: Peter Cao
+ *
+ * Date: October, 25, 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+static int copy_user_block(const char *infile, const char *outfile,
+ hsize_t size)
+{
+ int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
+ int infid = -1, outfid = -1; /* File descriptors */
+
+ /* User block must be any power of 2 equal to 512 or greater (512, 1024, 2048, etc.) */
+ HDassert(size > 0);
+
+ /* Open files */
+ if ((infid = HDopen(infile, O_RDONLY, 0)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDopen failed");
+ if ((outfid = HDopen(outfile, O_WRONLY, 0644)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDopen failed");
+
+ /* Copy the userblock from the input file to the output file */
+ while (size > 0) {
+ ssize_t nread, nbytes; /* # of bytes transfered, etc. */
+ char rbuf[USERBLOCK_XFER_SIZE]; /* Buffer for reading */
+ const char *wbuf; /* Pointer into buffer, for writing */
+
+ /* Read buffer from source file */
+ if (size > USERBLOCK_XFER_SIZE)
+ nread = HDread(infid, rbuf, (size_t)USERBLOCK_XFER_SIZE);
+ else
+ nread = HDread(infid, rbuf, (size_t)size);
+ if (nread < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDread failed");
+
+ /* Write buffer to destination file */
+ /* (compensating for interrupted writes & checking for errors, etc.) */
+ nbytes = nread;
+ wbuf = rbuf;
+ while (nbytes > 0) {
+ ssize_t nwritten; /* # of bytes written */
+
+ do {
+ nwritten = HDwrite(outfid, wbuf, (size_t)nbytes);
+ } while (-1 == nwritten && EINTR == errno);
+ if (-1 == nwritten) /* error */
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDwrite failed");
+ HDassert(nwritten > 0);
+ HDassert(nwritten <= nbytes);
+
+ /* Update # of bytes left & offset in buffer */
+ nbytes -= nwritten;
+ wbuf += nwritten;
+ HDassert(nbytes == 0 || wbuf < (rbuf + USERBLOCK_XFER_SIZE));
+ } /* end while */
+
+ /* Update size of userblock left to transfer */
+ size = size - (hsize_t) nread;
+ } /* end while */
+
+done:
+ if (infid > 0)
+ HDclose(infid);
+ if (outfid > 0)
+ HDclose(outfid);
+
+ return ret_value;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: print_user_block
+ *
+ * Purpose: print user block
+ *
+ * Return: 0, ok, -1 no
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: August, 20, 2008
+ *
+ *-------------------------------------------------------------------------
+ */
+#if defined (H5REPACK_DEBUG_USER_BLOCK)
+static
+void print_user_block(const char *filename, hid_t fid)
+{
+ int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
+ int fh; /* file handle */
+ hsize_t ub_size; /* user block size */
+ hsize_t size; /* size read */
+ hid_t fcpl; /* file creation property list ID for HDF5 file */
+ int i;
+
+ /* get user block size */
+ if(( fcpl = H5Fget_create_plist(fid)) < 0) {
+ error_msg("failed to retrieve file creation property list\n");
+ HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Fget_create_plist failed");
+ }
+
+ if(H5Pget_userblock(fcpl, &ub_size) < 0) {
+ error_msg("failed to retrieve userblock size\n");
+ HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pget_userblock failed");
+ }
+
+ if(H5Pclose(fcpl) < 0) {
+ error_msg("failed to close property list\n");
+ HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed");
+ }
+
+ /* open file */
+ if((fh = HDopen(filename, O_RDONLY, 0)) < 0) {
+ HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "HDopen failed");
+ }
+
+ size = ub_size;
+
+ /* read file */
+ while(size > 0) {
+ ssize_t nread; /* # of bytes read */
+ char rbuf[USERBLOCK_XFER_SIZE]; /* buffer for reading */
+
+ /* read buffer */
+ if(size > USERBLOCK_XFER_SIZE)
+ nread = HDread(fh, rbuf, (size_t)USERBLOCK_XFER_SIZE);
+ else
+ nread = HDread(fh, rbuf, (size_t)size);
+
+ for(i = 0; i < nread; i++) {
+
+ printf("%c ", rbuf[i]);
+
+ }
+ printf("\n");
+
+ if(nread < 0) {
+ HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "nread < 0");
+ }
+
+ /* update size of userblock left to transfer */
+ size -= nread;
+ }
+
+done:
+ if(fh > 0)
+ HDclose(fh);
+
+ return;
+}
+#endif
+
diff --git a/tools/src/h5repack/h5repack_filters.c b/tools/src/h5repack/h5repack_filters.c
new file mode 100644
index 0000000..e21b829
--- /dev/null
+++ b/tools/src/h5repack/h5repack_filters.c
@@ -0,0 +1,493 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include "h5repack.h"
+#include "h5tools.h"
+#include "h5tools_utils.h"
+
+/* number of members in an array */
+#ifndef NELMTS
+# define NELMTS(X) (sizeof(X)/sizeof(X[0]))
+#endif
+
+/* minimum of two values */
+#undef MIN
+#define MIN(a,b) (((a)<(b)) ? (a) : (b))
+
+/*-------------------------------------------------------------------------
+ * Function: aux_find_obj
+ *
+ * Purpose: find the object name NAME (got from the traverse list)
+ * in the repack options list
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+aux_find_obj(const char* name, /* object name from traverse list */
+ pack_opt_t *options, /* repack options */
+ pack_info_t *obj /*OUT*/) /* info about object to filter */
+{
+ char *pdest;
+ int result;
+ unsigned int i;
+
+ for ( i=0; i<options->op_tbl->nelems; i++)
+ {
+ if (HDstrcmp(options->op_tbl->objs[i].path,name)==0)
+ {
+ *obj = options->op_tbl->objs[i];
+ return (int)i;
+ }
+
+ pdest = HDstrstr(name,options->op_tbl->objs[i].path);
+ result = (int)(pdest - name);
+
+ /* found at position 1, meaning without '/' */
+ if( pdest != NULL && result==1 )
+ {
+ *obj = options->op_tbl->objs[i];
+ return (int)i;
+ }
+ }/*i*/
+
+ return -1;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: aux_assign_obj
+ *
+ * Purpose: find the object name NAME (got from the traverse list)
+ * in the repack options list; assign the filter information OBJ
+ *
+ * Return: 0 not found, 1 found
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+aux_assign_obj(const char* name, /* object name from traverse list */
+ pack_opt_t *options, /* repack options */
+ pack_info_t *obj /*OUT*/) /* info about object to filter */
+{
+
+ int idx, i;
+ pack_info_t tmp;
+
+ init_packobject(&tmp);
+
+ idx = aux_find_obj(name,options,&tmp);
+
+ /* name was on input */
+ if (idx>=0)
+ {
+
+
+ /* applying to all objects */
+ if (options->all_layout)
+ {
+ /* assign the global layout info to the OBJ info */
+ tmp.layout=options->layout_g;
+ switch (options->layout_g)
+ {
+ case H5D_CHUNKED:
+ tmp.chunk.rank=options->chunk_g.rank;
+ for ( i=0; i<tmp.chunk.rank; i++)
+ tmp.chunk.chunk_lengths[i]=options->chunk_g.chunk_lengths[i];
+ break;
+ case H5D_LAYOUT_ERROR:
+ case H5D_COMPACT:
+ case H5D_CONTIGUOUS:
+ case H5D_VIRTUAL:
+ case H5D_NLAYOUTS:
+ break;
+ default:
+ break;
+ }/*switch*/
+ }
+ else
+ {
+ tmp.layout = options->op_tbl->objs[idx].layout;
+ switch (tmp.layout)
+ {
+ case H5D_CHUNKED:
+ tmp.chunk.rank = options->op_tbl->objs[idx].chunk.rank;
+ for ( i=0; i<tmp.chunk.rank; i++)
+ tmp.chunk.chunk_lengths[i]=options->op_tbl->objs[idx].chunk.chunk_lengths[i];
+ break;
+ case H5D_LAYOUT_ERROR:
+ case H5D_COMPACT:
+ case H5D_CONTIGUOUS:
+ case H5D_VIRTUAL:
+ case H5D_NLAYOUTS:
+ break;
+ default:
+ break;
+ }/*switch*/
+
+ }
+
+ /* applying to all objects */
+ if (options->all_filter)
+ {
+ /* assign the global filter */
+ tmp.nfilters=1;
+ tmp.filter[0]=options->filter_g[0];
+ } /* if all */
+ else
+ {
+ tmp.nfilters=options->op_tbl->objs[idx].nfilters;
+ for ( i=0; i<tmp.nfilters; i++)
+ {
+ tmp.filter[i] = options->op_tbl->objs[idx].filter[i];
+ }
+ }
+
+
+ } /* if idx */
+
+
+ /* no input name */
+
+ else
+ {
+
+ if (options->all_filter)
+ {
+ int k;
+
+ /* assign the global filters */
+ tmp.nfilters=options->n_filter_g;
+ for ( k = 0; k < options->n_filter_g; k++)
+ tmp.filter[k]=options->filter_g[k];
+ }
+ if (options->all_layout)
+ {
+ /* assign the global layout info to the OBJ info */
+ tmp.layout=options->layout_g;
+ switch (options->layout_g)
+ {
+ case H5D_CHUNKED:
+ tmp.chunk.rank=options->chunk_g.rank;
+ for ( i=0; i<tmp.chunk.rank; i++)
+ tmp.chunk.chunk_lengths[i]=options->chunk_g.chunk_lengths[i];
+ break;
+ case H5D_LAYOUT_ERROR:
+ case H5D_COMPACT:
+ case H5D_CONTIGUOUS:
+ case H5D_VIRTUAL:
+ case H5D_NLAYOUTS:
+ break;
+ default:
+ break;
+ }/*switch*/
+ }
+ }
+
+ *obj = tmp;
+ return 1;
+
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: apply_filters
+ *
+ * Purpose: apply the filters in the object to the property list;
+ * do extra checking in the case of SZIP; delete all filters in the case
+ * of H5Z_FILTER_NONE present in the PACK_INFO_T filter array
+ *
+ * Return: 0 success, -1 an error occured
+ *
+ * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ *
+ * Date: December 19, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+int apply_filters(const char* name, /* object name from traverse list */
+ int rank, /* rank of dataset */
+ hsize_t *dims, /* dimensions of dataset */
+ size_t msize, /* size of type */
+ hid_t dcpl_id, /* dataset creation property list */
+ pack_opt_t *options, /* repack options */
+ int *has_filter) /* (OUT) object NAME has a filter */
+
+
+{
+ int nfilters; /* number of filters in DCPL */
+ hsize_t chsize[64]; /* chunk size in elements */
+ H5D_layout_t layout;
+ int i;
+ pack_info_t obj;
+
+ *has_filter = 0;
+
+ if (rank==0) /* scalar dataset, do not apply */
+ return 0;
+
+ /*-------------------------------------------------------------------------
+ * initialize the assigment object
+ *-------------------------------------------------------------------------
+ */
+ init_packobject(&obj);
+
+ /*-------------------------------------------------------------------------
+ * find options
+ *-------------------------------------------------------------------------
+ */
+ if (aux_assign_obj(name,options,&obj)==0)
+ return 0;
+
+ /* get information about input filters */
+ if ((nfilters = H5Pget_nfilters(dcpl_id))<0)
+ return -1;
+
+ /*-------------------------------------------------------------------------
+ * check if we have filters in the pipeline
+ * we want to replace them with the input filters
+ * only remove if we are inserting new ones
+ *-------------------------------------------------------------------------
+ */
+ if (nfilters && obj.nfilters )
+ {
+ *has_filter = 1;
+ if (H5Premove_filter(dcpl_id,H5Z_FILTER_ALL)<0)
+ return -1;
+ }
+
+ /*-------------------------------------------------------------------------
+ * check if there is an existent chunk
+ * read it only if there is not a requested layout
+ *-------------------------------------------------------------------------
+ */
+ if (obj.layout == -1 )
+ {
+ if ((layout = H5Pget_layout(dcpl_id))<0)
+ return -1;
+
+ if (layout == H5D_CHUNKED)
+ {
+ if ((rank = H5Pget_chunk(dcpl_id,NELMTS(chsize),chsize/*out*/))<0)
+ return -1;
+ obj.layout = H5D_CHUNKED;
+ obj.chunk.rank = rank;
+ for ( i = 0; i < rank; i++)
+ obj.chunk.chunk_lengths[i] = chsize[i];
+ }
+ }
+
+ /*-------------------------------------------------------------------------
+ * the type of filter and additional parameter
+ * type can be one of the filters
+ * H5Z_FILTER_NONE 0 , uncompress if compressed
+ * H5Z_FILTER_DEFLATE 1 , deflation like gzip
+ * H5Z_FILTER_SHUFFLE 2 , shuffle the data
+ * H5Z_FILTER_FLETCHER32 3 , fletcher32 checksum of EDC
+ * H5Z_FILTER_SZIP 4 , szip compression
+ * H5Z_FILTER_NBIT 5 , nbit compression
+ * H5Z_FILTER_SCALEOFFSET 6 , scaleoffset compression
+ *-------------------------------------------------------------------------
+ */
+
+ if (obj.nfilters)
+ {
+
+ /*-------------------------------------------------------------------------
+ * filters require CHUNK layout; if we do not have one define a default
+ *-------------------------------------------------------------------------
+ */
+ if (obj.layout==-1)
+ {
+
+ /* stripmine info */
+ hsize_t sm_size[H5S_MAX_RANK]; /*stripmine size */
+ hsize_t sm_nbytes; /*bytes per stripmine */
+
+ obj.chunk.rank = rank;
+
+ /*
+ * determine the strip mine size. The strip mine is
+ * a hyperslab whose size is manageable.
+ */
+
+
+
+ sm_nbytes = msize;
+ for ( i = rank; i > 0; --i)
+ {
+ hsize_t size = H5TOOLS_BUFSIZE / sm_nbytes;
+ if ( size == 0) /* datum size > H5TOOLS_BUFSIZE */
+ size = 1;
+ sm_size[i - 1] = MIN(dims[i - 1], size);
+ sm_nbytes *= sm_size[i - 1];
+ HDassert(sm_nbytes > 0);
+
+ }
+
+ for ( i = 0; i < rank; i++)
+ {
+ obj.chunk.chunk_lengths[i] = sm_size[i];
+ }
+
+ }
+
+ for ( i=0; i<obj.nfilters; i++)
+ {
+ switch (obj.filter[i].filtn)
+ {
+
+ /*-------------------------------------------------------------------------
+ * H5Z_FILTER_NONE 0 , uncompress if compressed
+ *-------------------------------------------------------------------------
+ */
+ case H5Z_FILTER_NONE:
+ break;
+
+ /*-------------------------------------------------------------------------
+ * H5Z_FILTER_DEFLATE 1 , deflation like gzip
+ *-------------------------------------------------------------------------
+ */
+ case H5Z_FILTER_DEFLATE:
+ {
+ unsigned aggression; /* the deflate level */
+
+ aggression = obj.filter[i].cd_values[0];
+ /* set up for deflated data */
+ if(H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths)<0)
+ return -1;
+ if(H5Pset_deflate(dcpl_id,aggression)<0)
+ return -1;
+ }
+ break;
+
+ /*-------------------------------------------------------------------------
+ * H5Z_FILTER_SZIP 4 , szip compression
+ *-------------------------------------------------------------------------
+ */
+ case H5Z_FILTER_SZIP:
+ {
+ unsigned options_mask;
+ unsigned pixels_per_block;
+
+ options_mask = obj.filter[i].cd_values[0];
+ pixels_per_block = obj.filter[i].cd_values[1];
+
+ /* set up for szip data */
+ if(H5Pset_chunk(dcpl_id,obj.chunk.rank,obj.chunk.chunk_lengths)<0)
+ return -1;
+ if (H5Pset_szip(dcpl_id,options_mask,pixels_per_block)<0)
+ return -1;
+
+ }
+ break;
+
+ /*-------------------------------------------------------------------------
+ * H5Z_FILTER_SHUFFLE 2 , shuffle the data
+ *-------------------------------------------------------------------------
+ */
+ case H5Z_FILTER_SHUFFLE:
+ if(H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths)<0)
+ return -1;
+ if (H5Pset_shuffle(dcpl_id)<0)
+ return -1;
+ break;
+
+ /*-------------------------------------------------------------------------
+ * H5Z_FILTER_FLETCHER32 3 , fletcher32 checksum of EDC
+ *-------------------------------------------------------------------------
+ */
+ case H5Z_FILTER_FLETCHER32:
+ if(H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths)<0)
+ return -1;
+ if (H5Pset_fletcher32(dcpl_id)<0)
+ return -1;
+ break;
+ /*----------- -------------------------------------------------------------
+ * H5Z_FILTER_NBIT , NBIT compression
+ *-------------------------------------------------------------------------
+ */
+ case H5Z_FILTER_NBIT:
+ if(H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths)<0)
+ return -1;
+ if (H5Pset_nbit(dcpl_id)<0)
+ return -1;
+ break;
+ /*----------- -------------------------------------------------------------
+ * H5Z_FILTER_SCALEOFFSET , scale+offset compression
+ *-------------------------------------------------------------------------
+ */
+
+ case H5Z_FILTER_SCALEOFFSET:
+ {
+ H5Z_SO_scale_type_t scale_type;
+ int scale_factor;
+
+ scale_type = (H5Z_SO_scale_type_t)obj.filter[i].cd_values[0];
+ scale_factor = (int)obj.filter[i].cd_values[1];
+
+ if(H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths)<0)
+ return -1;
+ if (H5Pset_scaleoffset(dcpl_id,scale_type,scale_factor)<0)
+ return -1;
+ }
+ break;
+ default:
+ {
+ if (H5Pset_filter (dcpl_id, obj.filter[i].filtn, H5Z_FLAG_MANDATORY, obj.filter[i].cd_nelmts, obj.filter[i].cd_values)<0)
+ return -1;
+ if(H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths)<0)
+ return -1;
+ }
+ break;
+ } /* switch */
+ }/*i*/
+
+ }
+ /*obj.nfilters*/
+
+ /*-------------------------------------------------------------------------
+ * layout
+ *-------------------------------------------------------------------------
+ */
+
+ if (obj.layout>=0)
+ {
+ /* a layout was defined */
+ if (H5Pset_layout(dcpl_id, obj.layout)<0)
+ return -1;
+
+ if (H5D_CHUNKED == obj.layout)
+ {
+ if(H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths)<0)
+ return -1;
+ }
+ else if (H5D_COMPACT == obj.layout)
+ {
+ if (H5Pset_alloc_time(dcpl_id, H5D_ALLOC_TIME_EARLY)<0)
+ return -1;
+ }
+ /* remove filters for the H5D_CONTIGUOUS case */
+ else if (H5D_CONTIGUOUS == obj.layout)
+ {
+ if (H5Premove_filter(dcpl_id,H5Z_FILTER_ALL)<0)
+ return -1;
+ }
+
+ }
+
+ return 0;
+}
+
diff --git a/tools/src/h5repack/h5repack_main.c b/tools/src/h5repack/h5repack_main.c
new file mode 100644
index 0000000..2d48a04
--- /dev/null
+++ b/tools/src/h5repack/h5repack_main.c
@@ -0,0 +1,664 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include "h5tools.h"
+#include "h5tools_utils.h"
+#include "h5repack.h"
+
+/* Name of tool */
+#define PROGRAMNAME "h5repack"
+
+static int parse_command_line(int argc, const char **argv, pack_opt_t* options);
+static void leave(int ret) H5_ATTR_NORETURN;
+
+
+/* module-scoped variables */
+static int has_i_o = 0;
+const char *infile = NULL;
+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:M:t:a:i:o:S:T:E";
+static struct long_options l_opts[] = {
+ { "help", no_arg, 'h' },
+ { "version", no_arg, 'V' },
+ { "verbose", no_arg, 'v' },
+ { "filter", require_arg, 'f' },
+ { "layout", require_arg, 'l' },
+ { "minimum", require_arg, 'm' },
+ { "file", require_arg, 'e' },
+ { "native", no_arg, 'n' },
+ { "latest", no_arg, 'L' },
+ { "compact", require_arg, 'c' },
+ { "indexed", require_arg, 'd' },
+ { "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 */
+ { "outfile", require_arg, 'o' }, /* -o for backward compability */
+ { "fs_strategy", require_arg, 'S' },
+ { "fs_threshold", require_arg, 'T' },
+ { "enable-error-stack", no_arg, 'E' },
+ { NULL, 0, '\0' }
+};
+
+/*-------------------------------------------------------------------------
+ * Function: usage
+ *
+ * Purpose: print usage
+ *
+ * Return: void
+ *
+ *-------------------------------------------------------------------------
+ */
+static void usage(const char *prog) {
+ FLUSHSTREAM(rawoutstream);
+ PRINTSTREAM(rawoutstream, "usage: %s [OPTIONS] file1 file2\n", prog);
+ PRINTVALSTREAM(rawoutstream, " file1 Input HDF5 File\n");
+ PRINTVALSTREAM(rawoutstream, " file2 Output HDF5 File\n");
+ PRINTVALSTREAM(rawoutstream, " OPTIONS\n");
+ PRINTVALSTREAM(rawoutstream, " -h, --help Print a usage message and exit\n");
+ PRINTVALSTREAM(rawoutstream, " -v, --verbose Verbose mode, print object information\n");
+ PRINTVALSTREAM(rawoutstream, " -V, --version Print version number and exit\n");
+ PRINTVALSTREAM(rawoutstream, " -n, --native Use a native HDF5 type when repacking\n");
+ PRINTVALSTREAM(rawoutstream, " -L, --latest Use latest version of file format\n");
+ PRINTVALSTREAM(rawoutstream, " -c L1, --compact=L1 Maximum number of links in header messages\n");
+ PRINTVALSTREAM(rawoutstream, " -d L2, --indexed=L2 Minimum number of links in the indexed format\n");
+ PRINTVALSTREAM(rawoutstream, " -s S[:F], --ssize=S[:F] Shared object header message minimum size\n");
+ PRINTVALSTREAM(rawoutstream, " -m M, --minimum=M Do not apply the filter to datasets smaller than M\n");
+ PRINTVALSTREAM(rawoutstream, " -e E, --file=E Name of file E with the -f and -l options\n");
+ PRINTVALSTREAM(rawoutstream, " -u U, --ublock=U Name of file U with user block data to be added\n");
+ PRINTVALSTREAM(rawoutstream, " -b B, --block=B Size of user block to be added\n");
+ PRINTVALSTREAM(rawoutstream, " -M A, --metadata_block_size=A Metadata block size for H5Pset_meta_block_size\n");
+ PRINTVALSTREAM(rawoutstream, " -t T, --threshold=T Threshold value for H5Pset_alignment\n");
+ PRINTVALSTREAM(rawoutstream, " -a A, --alignment=A Alignment value for H5Pset_alignment\n");
+ PRINTVALSTREAM(rawoutstream, " -f FILT, --filter=FILT Filter type\n");
+ PRINTVALSTREAM(rawoutstream, " -l LAYT, --layout=LAYT Layout type\n");
+ PRINTVALSTREAM(rawoutstream, " -S FS_STRGY, --fs_strategy=FS_STRGY File space management strategy\n");
+ PRINTVALSTREAM(rawoutstream, " -T FS_THRD, --fs_threshold=FS_THRD Free-space section threshold\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, " M - is an integer greater than 1, size of dataset in bytes (default is 0) \n");
+ PRINTVALSTREAM(rawoutstream, " E - is a filename.\n");
+ PRINTVALSTREAM(rawoutstream, " S - is an integer\n");
+ PRINTVALSTREAM(rawoutstream, " U - is a filename.\n");
+ PRINTVALSTREAM(rawoutstream, " T - is an integer\n");
+ PRINTVALSTREAM(rawoutstream, " A - is an integer greater than zero\n");
+ PRINTVALSTREAM(rawoutstream, " B - is the user block size, any value that is 512 or greater and is\n");
+ PRINTVALSTREAM(rawoutstream, " a power of 2 (1024 default)\n");
+ PRINTVALSTREAM(rawoutstream, " F - is the shared object header message type, any of <dspace|dtype|fill|\n");
+ PRINTVALSTREAM(rawoutstream, " pline|attr>. If F is not specified, S applies to all messages\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, " --enable-error-stack Prints messages from the HDF5 error stack as they\n");
+ PRINTVALSTREAM(rawoutstream, " occur.\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, " FS_STRGY is the file space management strategy to use for the output file.\n");
+ PRINTVALSTREAM(rawoutstream, " It is a string as listed below:\n");
+ PRINTVALSTREAM(rawoutstream, " ALL_PERSIST - Use persistent free-space managers, aggregators and virtual file driver\n");
+ PRINTVALSTREAM(rawoutstream, " for file space allocation\n");
+ PRINTVALSTREAM(rawoutstream, " ALL - Use non-persistent free-space managers, aggregators and virtual file driver\n");
+ PRINTVALSTREAM(rawoutstream, " for file space allocation\n");
+ PRINTVALSTREAM(rawoutstream, " AGGR_VFD - Use aggregators and virtual file driver for file space allocation\n");
+ PRINTVALSTREAM(rawoutstream, " VFD - Use virtual file driver for file space allocation\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, " FS_THRD is the free-space section threshold to use for the output file.\n");
+ PRINTVALSTREAM(rawoutstream, " It is the minimum size (in bytes) of free-space sections to be tracked\n");
+ PRINTVALSTREAM(rawoutstream, " by the the library's free-space managers.\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, " FILT - is a string with the format:\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, " <list of objects>:<name of filter>=<filter parameters>\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, " <list of objects> is a comma separated list of object names, meaning apply\n");
+ PRINTVALSTREAM(rawoutstream, " compression only to those objects. If no names are specified, the filter\n");
+ PRINTVALSTREAM(rawoutstream, " is applied to all objects\n");
+ PRINTVALSTREAM(rawoutstream, " <name of filter> can be:\n");
+ PRINTVALSTREAM(rawoutstream, " GZIP, to apply the HDF5 GZIP filter (GZIP compression)\n");
+ PRINTVALSTREAM(rawoutstream, " SZIP, to apply the HDF5 SZIP filter (SZIP compression)\n");
+ PRINTVALSTREAM(rawoutstream, " SHUF, to apply the HDF5 shuffle filter\n");
+ PRINTVALSTREAM(rawoutstream, " FLET, to apply the HDF5 checksum filter\n");
+ PRINTVALSTREAM(rawoutstream, " NBIT, to apply the HDF5 NBIT filter (NBIT compression)\n");
+ PRINTVALSTREAM(rawoutstream, " SOFF, to apply the HDF5 Scale/Offset filter\n");
+ PRINTVALSTREAM(rawoutstream, " UD, to apply a user defined filter\n");
+ PRINTVALSTREAM(rawoutstream, " NONE, to remove all filters\n");
+ PRINTVALSTREAM(rawoutstream, " <filter parameters> is optional filter parameter information\n");
+ PRINTVALSTREAM(rawoutstream, " GZIP=<deflation level> from 1-9\n");
+ PRINTVALSTREAM(rawoutstream, " SZIP=<pixels per block,coding> pixels per block is a even number in\n");
+ PRINTVALSTREAM(rawoutstream, " 2-32 and coding method is either EC or NN\n");
+ PRINTVALSTREAM(rawoutstream, " SHUF (no parameter)\n");
+ PRINTVALSTREAM(rawoutstream, " FLET (no parameter)\n");
+ PRINTVALSTREAM(rawoutstream, " NBIT (no parameter)\n");
+ PRINTVALSTREAM(rawoutstream, " SOFF=<scale_factor,scale_type> scale_factor is an integer and scale_type\n");
+ PRINTVALSTREAM(rawoutstream, " is either IN or DS\n");
+ PRINTVALSTREAM(rawoutstream, " UD=<filter_number,cd_value_count,value_1[,value_2,...,value_N]>\n");
+ PRINTVALSTREAM(rawoutstream, " required values for filter_number,cd_value_count,value_1\n");
+ PRINTVALSTREAM(rawoutstream, " optional values for value_2 to value_N\n");
+ PRINTVALSTREAM(rawoutstream, " NONE (no parameter)\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, " LAYT - is a string with the format:\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, " <list of objects>:<layout type>=<layout parameters>\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, " <list of objects> is a comma separated list of object names, meaning that\n");
+ PRINTVALSTREAM(rawoutstream, " layout information is supplied for those objects. If no names are\n");
+ PRINTVALSTREAM(rawoutstream, " specified, the layout type is applied to all objects\n");
+ PRINTVALSTREAM(rawoutstream, " <layout type> can be:\n");
+ PRINTVALSTREAM(rawoutstream, " CHUNK, to apply chunking layout\n");
+ PRINTVALSTREAM(rawoutstream, " COMPA, to apply compact layout\n");
+ PRINTVALSTREAM(rawoutstream, " CONTI, to apply contiguous layout\n");
+ PRINTVALSTREAM(rawoutstream, " <layout parameters> is optional layout information\n");
+ PRINTVALSTREAM(rawoutstream, " CHUNK=DIM[xDIM...xDIM], the chunk size of each dimension\n");
+ PRINTVALSTREAM(rawoutstream, " COMPA (no parameter)\n");
+ PRINTVALSTREAM(rawoutstream, " CONTI (no parameter)\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, "Examples of use:\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, "1) h5repack -v -f GZIP=1 file1 file2\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, " GZIP compression with level 1 to all objects\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, "2) h5repack -v -f dset1:SZIP=8,NN file1 file2\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, " SZIP compression with 8 pixels per block and NN coding method to object dset1\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, "3) h5repack -v -l dset1,dset2:CHUNK=20x10 -f dset3,dset4,dset5:NONE file1 file2\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, " Chunked layout, with a layout size of 20x10, to objects dset1 and dset2\n");
+ PRINTVALSTREAM(rawoutstream, " and remove filters to objects dset3, dset4, dset5\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, "4) h5repack -L -c 10 -s 20:dtype file1 file2 \n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, " Using latest file format with maximum compact group size of 10 and\n");
+ PRINTVALSTREAM(rawoutstream, " and minimum shared datatype size of 20\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, "5) h5repack -f SHUF -f GZIP=1 file1 file2 \n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, " Add both filters SHUF and GZIP in this order to all datasets\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, "6) h5repack -f UD=307,1,9 file1 file2 \n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, " Add bzip2 filter to all datasets\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+}
+
+/*-------------------------------------------------------------------------
+ * Function: leave
+ *
+ * Purpose: Shutdown MPI & HDF5 and call exit()
+ *
+ * Return: Does not return
+ *
+ * Programmer: Quincey Koziol
+ * Saturday, 31. January 2004
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static void leave(int ret) {
+ h5tools_close();
+
+ HDexit(ret);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: read_info
+ *
+ * Purpose: read comp and chunk options from a file
+ *
+ * Return: void, exit on error
+ *
+ * Programmer: pvn@ncsa.uiuc.edu
+ *
+ * Date: September, 22, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static
+int read_info(const char *filename, pack_opt_t *options) {
+
+ char stype[10];
+ char comp_info[1024];
+ FILE *fp = NULL;
+ char c;
+ int i, rc = 1;
+ int ret_value = EXIT_SUCCESS;
+
+ if ((fp = HDfopen(filename, "r")) == (FILE *) NULL) {
+ error_msg("cannot open options file %s\n", filename);
+ h5tools_setstatus(EXIT_FAILURE);
+ ret_value = EXIT_FAILURE;
+ goto done;
+ }
+
+ /* cycle until end of file reached */
+ while (1) {
+ rc = fscanf(fp, "%s", stype);
+ if (rc == -1)
+ break;
+
+ /*-------------------------------------------------------------------------
+ * filter
+ *-------------------------------------------------------------------------
+ */
+ if (HDstrcmp(stype,"-f") == 0) {
+ /* find begining of info */
+ i = 0;
+ c = '0';
+ while (c != ' ') {
+ if(fscanf(fp, "%c", &c) < 0 && HDferror(fp)) {
+ error_msg("fscanf error\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ ret_value = EXIT_FAILURE;
+ goto done;
+ } /* end if */
+ if (HDfeof(fp))
+ break;
+ }
+ c = '0';
+ /* go until end */
+ while (c != ' ') {
+ if(fscanf(fp, "%c", &c) < 0 && HDferror(fp)) {
+ error_msg("fscanf error\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ ret_value = EXIT_FAILURE;
+ goto done;
+ } /* end if */
+ comp_info[i] = c;
+ i++;
+ if (HDfeof(fp))
+ break;
+ if (c == 10 /*eol*/)
+ break;
+ }
+ comp_info[i - 1] = '\0'; /*cut the last " */
+
+ if (h5repack_addfilter(comp_info, options) == -1) {
+ error_msg("could not add compression option\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ ret_value = EXIT_FAILURE;
+ goto done;
+ }
+ }
+ /*-------------------------------------------------------------------------
+ * layout
+ *-------------------------------------------------------------------------
+ */
+ else if (HDstrcmp(stype,"-l") == 0) {
+
+ /* find begining of info */
+ i = 0;
+ c = '0';
+ while (c != ' ') {
+ if(fscanf(fp, "%c", &c) < 0 && HDferror(fp)) {
+ error_msg("fscanf error\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ ret_value = EXIT_FAILURE;
+ goto done;
+ } /* end if */
+ if (HDfeof(fp))
+ break;
+ }
+ c = '0';
+ /* go until end */
+ while (c != ' ') {
+ if(fscanf(fp, "%c", &c) < 0 && HDferror(fp)) {
+ error_msg("fscanf error\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ ret_value = EXIT_FAILURE;
+ goto done;
+ } /* end if */
+ comp_info[i] = c;
+ i++;
+ if (HDfeof(fp))
+ break;
+ if (c == 10 /*eol*/)
+ break;
+ }
+ comp_info[i - 1] = '\0'; /*cut the last " */
+
+ if (h5repack_addlayout(comp_info, options) == -1) {
+ error_msg("could not add chunck option\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ ret_value = EXIT_FAILURE;
+ goto done;
+ }
+ }
+ /*-------------------------------------------------------------------------
+ * not valid
+ *-------------------------------------------------------------------------
+ */
+ else {
+ error_msg("bad file format for %s", filename);
+ h5tools_setstatus(EXIT_FAILURE);
+ ret_value = EXIT_FAILURE;
+ goto done;
+ }
+ }
+
+done:
+ if (fp)
+ HDfclose(fp);
+
+ return ret_value;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: parse_command_line
+ *
+ * Purpose: parse command line input
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static
+int parse_command_line(int argc, const char **argv, pack_opt_t* options) {
+
+ int opt;
+ int ret_value = 0;
+
+ /* parse command line options */
+ while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) {
+ switch ((char) opt) {
+
+ /* -i for backward compability */
+ case 'i':
+ infile = opt_arg;
+ has_i_o = 1;
+ break;
+
+ /* -o for backward compability */
+ case 'o':
+ outfile = opt_arg;
+ has_i_o = 1;
+ break;
+
+ case 'h':
+ usage(h5tools_getprogname());
+ h5tools_setstatus(EXIT_SUCCESS);
+ ret_value = -1;
+ goto done;
+
+ case 'V':
+ print_version(h5tools_getprogname());
+ h5tools_setstatus(EXIT_SUCCESS);
+ ret_value = -1;
+ goto done;
+
+ case 'v':
+ options->verbose = 1;
+ break;
+
+ case 'f':
+ /* parse the -f filter option */
+ if (h5repack_addfilter(opt_arg, options) < 0) {
+ error_msg("in parsing filter\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ ret_value = -1;
+ goto done;
+ }
+ break;
+
+ case 'l':
+ /* parse the -l layout option */
+ if (h5repack_addlayout(opt_arg, options) < 0) {
+ error_msg("in parsing layout\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ ret_value = -1;
+ goto done;
+ }
+ break;
+
+ case 'm':
+ options->min_comp = HDstrtoull(opt_arg , NULL, 0);
+ if ((int) options->min_comp <= 0) {
+ error_msg("invalid minimum compress size <%s>\n", opt_arg);
+ h5tools_setstatus(EXIT_FAILURE);
+ ret_value = -1;
+ goto done;
+ }
+ break;
+
+ case 'e':
+ ret_value = read_info(opt_arg, options);
+ if (ret_value < 0)
+ goto done;
+ break;
+
+ case 'n':
+ options->use_native = 1;
+ break;
+
+ case 'L':
+ options->latest = TRUE;
+ break;
+
+ case 'c':
+ options->grp_compact = HDatoi( opt_arg );
+ if (options->grp_compact > 0)
+ options->latest = TRUE; /* must use latest format */
+ break;
+
+ case 'd':
+ options->grp_indexed = HDatoi( opt_arg );
+ if (options->grp_indexed > 0)
+ options->latest = TRUE; /* must use latest format */
+ break;
+
+ case 's':
+ {
+ int idx = 0;
+ int ssize = 0;
+ char *msgPtr = HDstrchr( opt_arg, ':');
+ options->latest = TRUE; /* must use latest format */
+ if (msgPtr == NULL) {
+ ssize = HDatoi( opt_arg );
+ for (idx = 0; idx < 5; idx++)
+ options->msg_size[idx] = ssize;
+ }
+ else {
+ char msgType[10];
+ HDstrcpy(msgType, msgPtr + 1);
+ msgPtr[0] = '\0';
+ ssize = HDatoi( opt_arg );
+ if (HDstrncmp(msgType, "dspace",6) == 0) {
+ options->msg_size[0] = ssize;
+ }
+ else if (HDstrncmp(msgType, "dtype", 5) == 0) {
+ options->msg_size[1] = ssize;
+ }
+ else if (HDstrncmp(msgType, "fill", 4) == 0) {
+ options->msg_size[2] = ssize;
+ }
+ else if (HDstrncmp(msgType, "pline", 5) == 0) {
+ options->msg_size[3] = ssize;
+ }
+ else if (HDstrncmp(msgType, "attr", 4) == 0) {
+ options->msg_size[4] = ssize;
+ }
+ }
+ }
+ break;
+
+ case 'u':
+ options->ublock_filename = opt_arg;
+ break;
+
+ case 'b':
+ 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 );
+ break;
+
+ case 'a':
+ options->alignment = HDstrtoull(opt_arg , NULL, 0);
+ if (options->alignment < 1) {
+ error_msg("invalid alignment size\n", opt_arg);
+ h5tools_setstatus(EXIT_FAILURE);
+ ret_value = -1;
+ goto done;
+ }
+ break;
+
+ case 'S':
+ {
+ char strategy[MAX_NC_NAME];
+
+ HDstrcpy(strategy, opt_arg);
+ if (!HDstrcmp(strategy, "ALL_PERSIST"))
+ options->fs_strategy = H5F_FILE_SPACE_ALL_PERSIST;
+ else if (!HDstrcmp(strategy, "ALL"))
+ options->fs_strategy = H5F_FILE_SPACE_ALL;
+ else if (!HDstrcmp(strategy, "AGGR_VFD"))
+ options->fs_strategy = H5F_FILE_SPACE_AGGR_VFD;
+ else if (!HDstrcmp(strategy, "VFD"))
+ options->fs_strategy = H5F_FILE_SPACE_VFD;
+ else {
+ error_msg("invalid file space management strategy\n", opt_arg);
+ h5tools_setstatus(EXIT_FAILURE);
+ ret_value = -1;
+ goto done;
+ }
+ }
+ break;
+
+ case 'T':
+ options->fs_threshold = (hsize_t) HDatol( opt_arg );
+ break;
+
+ case 'E':
+ enable_error_stack = TRUE;
+ break;
+
+ default:
+ break;
+ } /* switch */
+
+ } /* while */
+
+ if (has_i_o == 0) {
+ /* check for file names to be processed */
+ if (argc <= opt_ind || argv[opt_ind + 1] == NULL) {
+ error_msg("missing file names\n");
+ usage(h5tools_getprogname());
+ h5tools_setstatus(EXIT_FAILURE);
+ ret_value = -1;
+ }
+ }
+
+done:
+ return ret_value;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: main
+ *
+ * Purpose: h5repack main program
+ *
+ * Return: Success: EXIT_SUCCESS(0)
+ *
+ * Failure: EXIT_FAILURE(1)
+ *
+ * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ *
+ * Date: May 9, 2003
+ *
+ * Comments:
+ *
+ *-------------------------------------------------------------------------
+ */
+int main(int argc, const char **argv) {
+ H5E_auto2_t func;
+ H5E_auto2_t tools_func;
+ void *edata;
+ void *tools_edata;
+
+ pack_opt_t options; /*the global options */
+
+ h5tools_setprogname(PROGRAMNAME);
+ h5tools_setstatus(EXIT_SUCCESS);
+
+ /* Disable error reporting */
+ H5Eget_auto2(H5E_DEFAULT, &func, &edata);
+ H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
+
+ /* Initialize h5tools lib */
+ h5tools_init();
+
+ /* Disable tools error reporting */
+ H5Eget_auto2(H5tools_ERR_STACK_g, &tools_func, &tools_edata);
+ H5Eset_auto2(H5tools_ERR_STACK_g, NULL, NULL);
+
+ /* update hyperslab buffer size from H5TOOLS_BUFSIZE env if exist */
+ if (h5tools_getenv_update_hyperslab_bufsize() < 0) {
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
+ }
+
+ /* initialize options */
+ h5repack_init(&options, 0, FALSE, H5F_FILE_SPACE_DEFAULT, (hsize_t) 0);
+
+ if (parse_command_line(argc, argv, &options) < 0)
+ goto done;
+
+ /* get file names if they were not yet got */
+ if (has_i_o == 0) {
+
+ if (argv[opt_ind] != NULL && argv[opt_ind + 1] != NULL) {
+ infile = argv[opt_ind];
+ outfile = argv[opt_ind + 1];
+
+ if ( HDstrcmp( infile, outfile ) == 0) {
+ error_msg("file names cannot be the same\n");
+ usage(h5tools_getprogname());
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
+ }
+ }
+ else {
+ error_msg("file names missing\n");
+ usage(h5tools_getprogname());
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
+ }
+ }
+
+ if (enable_error_stack) {
+ H5Eset_auto2(H5E_DEFAULT, func, edata);
+ H5Eset_auto2(H5tools_ERR_STACK_g, tools_func, tools_edata);
+ }
+
+ /* pack it */
+ h5tools_setstatus(h5repack(infile, outfile, &options));
+
+done:
+ /* free tables */
+ h5repack_end(&options);
+
+ leave(h5tools_getstatus());
+}
+
diff --git a/tools/src/h5repack/h5repack_opttable.c b/tools/src/h5repack/h5repack_opttable.c
new file mode 100644
index 0000000..8c98b76
--- /dev/null
+++ b/tools/src/h5repack/h5repack_opttable.c
@@ -0,0 +1,367 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include "h5repack.h"
+#include "h5tools.h"
+#include "h5tools_utils.h"
+
+/*-------------------------------------------------------------------------
+ * Function: init_packobject
+ *
+ * Purpose: initialize a pack_info_t structure
+ *
+ * Return: void
+ *
+ *-------------------------------------------------------------------------
+ */
+
+void init_packobject(pack_info_t *obj) {
+ int j, k;
+
+ HDstrcpy(obj->path, "\0");
+ for (j = 0; j < H5_REPACK_MAX_NFILTERS; j++) {
+ obj->filter[j].filtn = -1;
+ for (k = 0; k < CD_VALUES; k++)
+ obj->filter[j].cd_values[k] = 0;
+ }
+ obj->chunk.rank = -1;
+ obj->refobj_id = -1;
+ obj->layout = H5D_LAYOUT_ERROR;
+ obj->nfilters = 0;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: aux_tblinsert_filter
+ *
+ * Purpose: auxiliary function, inserts the filter in object OBJS[ I ]
+ *
+ * Return: void
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static void aux_tblinsert_filter(pack_opttbl_t *table, unsigned int I,
+ filter_info_t filt) {
+ if (table->objs[I].nfilters < H5_REPACK_MAX_NFILTERS) {
+ table->objs[I].filter[table->objs[I].nfilters++] = filt;
+ }
+ else {
+ error_msg(
+ "cannot insert the filter in this object.\
+ Maximum capacity exceeded\n");
+ }
+}
+
+/*-------------------------------------------------------------------------
+ * Function: aux_tblinsert_layout
+ *
+ * Purpose: auxiliary function, inserts the layout in object OBJS[ I ]
+ *
+ * Return: void
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static void aux_tblinsert_layout(pack_opttbl_t *table, unsigned int I,
+ pack_info_t *pack) {
+ int k;
+
+ table->objs[I].layout = pack->layout;
+ if (H5D_CHUNKED == pack->layout) {
+ /* -2 means the NONE option, remove chunking
+ and set the layout to contiguous */
+ if (pack->chunk.rank == -2) {
+ table->objs[I].layout = H5D_CONTIGUOUS;
+ table->objs[I].chunk.rank = -2;
+ }
+ /* otherwise set the chunking type */
+ else {
+ table->objs[I].chunk.rank = pack->chunk.rank;
+ for (k = 0; k < pack->chunk.rank; k++)
+ table->objs[I].chunk.chunk_lengths[k] =
+ pack->chunk.chunk_lengths[k];
+ }
+ }
+}
+
+/*-------------------------------------------------------------------------
+ * Function: aux_inctable
+ *
+ * Purpose: auxiliary function, increases the size of the collection by N_OBJS
+ *
+ * Return: 0, ok, -1, fail
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+aux_inctable(pack_opttbl_t *table, unsigned n_objs)
+{
+ unsigned u;
+
+ table->size += n_objs;
+ table->objs = (pack_info_t*) HDrealloc(table->objs, table->size * sizeof(pack_info_t));
+ if (table->objs == NULL) {
+ error_msg("not enough memory for options table\n");
+ return -1;
+ }
+
+ for (u = table->nelems; u < table->size; u++)
+ init_packobject(&table->objs[u]);
+
+ return 0;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: options_table_init
+ *
+ * Purpose: init options table
+ *
+ * Return: 0, ok, -1, fail
+ *
+ *-------------------------------------------------------------------------
+ */
+int options_table_init(pack_opttbl_t **tbl) {
+ unsigned int i;
+ pack_opttbl_t *table;
+
+ if (NULL == (table = (pack_opttbl_t *) HDmalloc(sizeof(pack_opttbl_t)))) {
+ error_msg("not enough memory for options table\n");
+ return -1;
+ }
+
+ table->size = 30;
+ table->nelems = 0;
+ if (NULL == (table->objs =
+ (pack_info_t*) HDmalloc(table->size * sizeof(pack_info_t)))) {
+ error_msg("not enough memory for options table\n");
+ HDfree(table);
+ return -1;
+ }
+
+ for (i = 0; i < table->size; i++)
+ init_packobject(&table->objs[i]);
+
+ *tbl = table;
+ return 0;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: options_table_free
+ *
+ * Purpose: free table memory
+ *
+ * Return: 0
+ *
+ *-------------------------------------------------------------------------
+ */
+
+int options_table_free(pack_opttbl_t *table) {
+ HDfree(table->objs);
+ HDfree(table);
+ return 0;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: options_add_layout
+ *
+ * Purpose: add a layout option to the option list
+ *
+ * Return: 0, ok, -1, fail
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+options_add_layout(obj_list_t *obj_list, unsigned n_objs, pack_info_t *pack,
+ pack_opttbl_t *table)
+{
+ unsigned i, j, I;
+ unsigned added = 0;
+ hbool_t found = FALSE;
+
+ /* increase the size of the collection by N_OBJS if necessary */
+ if (table->nelems + n_objs >= table->size)
+ if (aux_inctable(table, n_objs) < 0)
+ return -1;
+
+ /* search if this object is already in the table; "path" is the key */
+ if (table->nelems > 0) {
+ /* go tru the supplied list of names */
+ for (j = 0; j < n_objs; j++) {
+ /* linear table search */
+ for (i = 0; i < table->nelems; i++) {
+ /*already on the table */
+ if (HDstrcmp(obj_list[j].obj,table->objs[i].path) == 0) {
+ /* already chunk info inserted for this one; exit */
+ if (table->objs[i].chunk.rank > 0) {
+ error_msg("chunk information already inserted for <%s>\n", obj_list[j].obj);
+ HDexit(EXIT_FAILURE);
+ }
+ /* insert the layout info */
+ else {
+ aux_tblinsert_layout(table, i, pack);
+ found = TRUE;
+ break;
+ }
+ } /* if */
+ } /* i */
+
+ if (!found) {
+ /* keep the grow in a temp var */
+ I = table->nelems + added;
+ added++;
+ HDstrcpy(table->objs[I].path, obj_list[j].obj);
+ aux_tblinsert_layout(table, I, pack);
+ }
+ /* cases where we have an already inserted name but there is a new name also
+ example:
+ -f dset1:GZIP=1 -l dset1,dset2:CHUNK=20x20
+ dset1 is already inserted, but dset2 must also be
+ */
+ else
+ if(found && HDstrcmp(obj_list[j].obj,table->objs[i].path) != 0) {
+ /* keep the grow in a temp var */
+ I = table->nelems + added;
+ added++;
+ HDstrcpy(table->objs[I].path, obj_list[j].obj);
+ aux_tblinsert_layout(table, I, pack);
+ }
+ } /* j */
+ }
+ /* first time insertion */
+ else {
+ /* go tru the supplied list of names */
+ for (j = 0; j < n_objs; j++) {
+ I = table->nelems + added;
+ added++;
+ HDstrcpy(table->objs[I].path, obj_list[j].obj);
+ aux_tblinsert_layout(table, I, pack);
+ }
+ }
+
+ table->nelems += added;
+
+ return 0;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: options_add_filter
+ *
+ * Purpose: add a compression -f option to the option list
+ *
+ * Return: 0, ok, -1, fail
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+options_add_filter(obj_list_t *obj_list, unsigned n_objs, filter_info_t filt,
+ pack_opttbl_t *table)
+{
+ unsigned int i, j, I;
+ unsigned added = 0;
+ hbool_t found = FALSE;
+
+ /* increase the size of the collection by N_OBJS if necessary */
+ if (table->nelems + n_objs >= table->size)
+ if (aux_inctable(table, n_objs) < 0)
+ return -1;
+
+ /* search if this object is already in the table; "path" is the key */
+ if (table->nelems > 0) {
+ /* go tru the supplied list of names */
+ for (j = 0; j < n_objs; j++) {
+ /* linear table search */
+ for (i = 0; i < table->nelems; i++) {
+ /*already on the table */
+ if (HDstrcmp(obj_list[j].obj, table->objs[i].path) == 0) {
+ /* insert */
+ aux_tblinsert_filter(table, i, filt);
+ found = TRUE;
+ break;
+ } /* if */
+ } /* i */
+
+ if (!found) {
+ /* keep the grow in a temp var */
+ I = table->nelems + added;
+ added++;
+ HDstrcpy(table->objs[I].path, obj_list[j].obj);
+ aux_tblinsert_filter(table, I, filt);
+ }
+ /* cases where we have an already inserted name but there is a new name also
+ example:
+ -l dset1:CHUNK=20x20 -f dset1,dset2:GZIP=1
+ dset1 is already inserted, but dset2 must also be
+ */
+ else
+ if(found && HDstrcmp(obj_list[j].obj,table->objs[i].path) != 0) {
+ /* keep the grow in a temp var */
+ I = table->nelems + added;
+ added++;
+ HDstrcpy(table->objs[I].path, obj_list[j].obj);
+ aux_tblinsert_filter(table, I, filt);
+ }
+ } /* j */
+ }
+
+ /* first time insertion */
+ else {
+ /* go tru the supplied list of names */
+ for (j = 0; j < n_objs; j++) {
+ I = table->nelems + added;
+ added++;
+ HDstrcpy(table->objs[I].path, obj_list[j].obj);
+ aux_tblinsert_filter(table, I, filt);
+ }
+ }
+
+ table->nelems += added;
+
+ return 0;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: options_get_object
+ *
+ * Purpose: get object from table; "path" is the key
+ *
+ * Return: pack_info_t* OBJECT or NULL if not found; PATH is the key
+ *
+ *-------------------------------------------------------------------------
+ */
+
+pack_info_t* options_get_object(const char *path, pack_opttbl_t *table) {
+ unsigned int i;
+ char tbl_path[MAX_NC_NAME + 1]; /* +1 for start with "/" case */
+
+ 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(tbl_path, path) == 0) {
+ return (&table->objs[i]);
+ }
+ }
+
+ return NULL;
+}
+
diff --git a/tools/src/h5repack/h5repack_parse.c b/tools/src/h5repack/h5repack_parse.c
new file mode 100644
index 0000000..004b9e4
--- /dev/null
+++ b/tools/src/h5repack/h5repack_parse.c
@@ -0,0 +1,616 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include "h5repack.h"
+#include "h5tools.h"
+#include "h5tools_utils.h"
+
+/*-------------------------------------------------------------------------
+ * Function: parse_filter
+ *
+ * Purpose: read filter information
+ *
+ * Return: a list of names, the number of names and its compression type
+ *
+ * <name of filter> can be:
+ * GZIP, to apply the HDF5 GZIP filter (GZIP compression)
+ * SZIP, to apply the HDF5 SZIP filter (SZIP compression)
+ * SHUF, to apply the HDF5 shuffle filter
+ * FLET, to apply the HDF5 checksum filter
+ * NBIT, to apply the HDF5 NBIT filter (NBIT compression)
+ * SOFF, to apply the HDF5 scale+offset filter (compression)
+ * UD, to apply a User Defined filter k,m,n1[,…,nm]
+ * NONE, to remove the filter
+ *
+ * Examples:
+ * "GZIP=6"
+ * "A,B:NONE"
+ *-------------------------------------------------------------------------
+ */
+obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt,
+ pack_opt_t *options, int *is_glb) {
+ size_t i, m, u;
+ char c;
+ size_t len = HDstrlen(str);
+ int k, l, p, q, end_obj = -1, no_param = 0;
+ unsigned j, n;
+ char sobj[MAX_NC_NAME];
+ char scomp[10];
+ char stype[6];
+ char smask[3];
+ obj_list_t* obj_list = NULL;
+ unsigned pixels_per_block;
+
+ /* initialize compression info */
+ HDmemset(filt, 0, sizeof(filter_info_t));
+ *is_glb = 0;
+
+ /* check for the end of object list and number of objects */
+ for (i = 0, n = 0; i < len; i++) {
+ c = str[i];
+ if (c == ':')
+ end_obj = (int) i;
+ if (c == ',')
+ n++;
+ }
+
+ /* Check for missing : */
+ if (end_obj == -1) {
+ /* apply to all objects */
+ options->all_filter = 1;
+ *is_glb = 1;
+ }
+
+ n++;
+ obj_list = (obj_list_t *) HDmalloc(n * sizeof(obj_list_t));
+ if (obj_list == NULL) {
+ error_msg("could not allocate object list\n");
+ return NULL;
+ }
+ *n_objs = n;
+
+ /* get object list */
+ if (end_obj > 0)
+ for (j = 0, k = 0, n = 0; j < (unsigned) end_obj; j++, k++) {
+ c = str[j];
+ sobj[k] = c;
+ if (c == ',' || j == (unsigned) (end_obj - 1)) {
+ if (c == ',')
+ sobj[k] = '\0';
+ else
+ sobj[k + 1] = '\0';
+ HDstrcpy(obj_list[n].obj, sobj);
+ HDmemset(sobj, 0, sizeof(sobj));
+ n++;
+ k = -1;
+ }
+ }
+ /* nothing after : */
+ if (end_obj + 1 == (int) len) {
+ if (obj_list)
+ HDfree(obj_list);
+ error_msg("input Error: Invalid compression type in <%s>\n", str);
+ HDexit(EXIT_FAILURE);
+ }
+
+ /* get filter additional parameters */
+ m = 0;
+ for (i = (size_t)(end_obj + 1), k = 0, j = 0; i < len; i++, k++) {
+ c = str[i];
+ scomp[k] = c;
+ if (c == '=' || i == len - 1) {
+ if (c == '=') { /*one more parameter */
+ scomp[k] = '\0'; /*cut space */
+
+ /*-------------------------------------------------------------------------
+ * H5Z_FILTER_SZIP
+ * szip has the format SZIP=<pixels per block,coding>
+ * pixels per block is a even number in 2-32 and coding method is 'EC' or 'NN'
+ * example SZIP=8,NN
+ *-------------------------------------------------------------------------
+ */
+ if (HDstrcmp(scomp, "SZIP") == 0) {
+ l = -1; /* mask index check */
+ for (m = 0, u = i + 1; u < len; u++, m++) {
+ if (str[u] == ',') {
+ stype[m] = '\0'; /* end digit of szip */
+ l = 0; /* start EC or NN search */
+ u++; /* skip ',' */
+ }
+ c = str[u];
+ if (!HDisdigit(c) && l == -1) {
+ if (obj_list)
+ HDfree(obj_list);
+ error_msg("compression parameter not digit in <%s>\n", str);
+ HDexit(EXIT_FAILURE);
+ }
+ if (l == -1)
+ stype[m] = c;
+ else {
+ smask[l] = c;
+ l++;
+ if (l == 2) {
+ smask[l] = '\0';
+ i = len - 1; /* end */
+ (*n_objs)--; /* we counted an extra ',' */
+ if (HDstrcmp(smask,"NN") == 0)
+ filt->cd_values[j++] = H5_SZIP_NN_OPTION_MASK;
+ else if (HDstrcmp(smask,"EC") == 0)
+ filt->cd_values[j++] = H5_SZIP_EC_OPTION_MASK;
+ else {
+ error_msg("szip mask must be 'NN' or 'EC' \n");
+ HDexit(EXIT_FAILURE);
+ }
+ }
+ }
+ } /* u */
+ } /*if */
+
+ /*-------------------------------------------------------------------------
+ * H5Z_FILTER_SCALEOFFSET
+ * scaleoffset has the format SOFF=<scale_factor,scale_type>
+ * scale_type can be
+ * integer datatype, H5Z_SO_INT (IN)
+ * float datatype using D-scaling method, H5Z_SO_FLOAT_DSCALE (DS)
+ * float datatype using E-scaling method, H5Z_SO_FLOAT_ESCALE (ES) , not yet implemented
+ * for integer datatypes, scale_factor denotes Minimum Bits
+ * for float datatypes, scale_factor denotes decimal scale factor
+ * examples
+ * SOFF=31,IN
+ * SOFF=3,DF
+ *-------------------------------------------------------------------------
+ */
+ else if (HDstrcmp(scomp, "SOFF") == 0) {
+ l = -1; /* mask index check */
+ for (m = 0, u = i + 1; u < len; u++, m++) {
+ if (str[u] == ',') {
+ stype[m] = '\0'; /* end digit */
+ l = 0; /* start 'IN' , 'DS', or 'ES' search */
+ u++; /* skip ',' */
+ }
+ c = str[u];
+ if (!HDisdigit(c) && l == -1) {
+ if (obj_list)
+ HDfree(obj_list);
+ error_msg("compression parameter is not a digit in <%s>\n", str);
+ HDexit(EXIT_FAILURE);
+ }
+ if (l == -1)
+ stype[m] = c;
+ else {
+ smask[l] = c;
+ l++;
+ if (l == 2) {
+ smask[l] = '\0';
+ i = len - 1; /* end */
+ (*n_objs)--; /* we counted an extra ',' */
+ if (HDstrcmp(smask,"IN") == 0)
+ filt->cd_values[j++] = H5Z_SO_INT;
+ else if (HDstrcmp(smask, "DS") == H5Z_SO_FLOAT_DSCALE)
+ filt->cd_values[j++] = H5Z_SO_FLOAT_DSCALE;
+ else {
+ error_msg("scale type must be 'IN' or 'DS' \n");
+ HDexit(EXIT_FAILURE);
+ }
+ }
+ }
+ } /* u */
+ } /*if */
+
+ /*-------------------------------------------------------------------------
+ * User Defined
+ * has the format UD=<filter_number,cd_value_count,value_1[,value_2,...,value_N]>
+ * BZIP2 example
+ * UD=307,1,9
+ *-------------------------------------------------------------------------
+ */
+ else if (HDstrcmp(scomp, "UD") == 0) {
+ l = -1; /* filter number index check */
+ p = -1; /* CD_VAL count check */
+ for (m = 0, q = 0, u = i + 1; u < len; u++, m++, q++) {
+ if (str[u] == ',') {
+ stype[q] = '\0'; /* end digit */
+ if (l == -1) {
+ filt->filtn = HDatoi(stype);
+ l = 0;
+ }
+ else if (p == -1) {
+ filt->cd_nelmts = HDstrtoull(stype, NULL, 0);
+ p = 0;
+ }
+ else
+ filt->cd_values[j++] = (unsigned)HDstrtoul(stype, NULL, 0);
+ q = 0;
+ u++; /* skip ',' */
+ }
+ c = str[u];
+ if (!HDisdigit(c) && l == -1) {
+ if (obj_list)
+ HDfree(obj_list);
+ error_msg("filter number parameter is not a digit in <%s>\n", str);
+ HDexit(EXIT_FAILURE);
+ }
+ stype[q] = c;
+ } /* for u */
+ stype[q] = '\0';
+ } /*if */
+
+ /*-------------------------------------------------------------------------
+ * all other filters
+ *-------------------------------------------------------------------------
+ */
+ else {
+ /* here we could have 1 or 2 digits */
+ for (m = 0, u = i + 1; u < len; u++, m++) {
+ c = str[u];
+ if (!HDisdigit(c)) {
+ if (obj_list)
+ HDfree(obj_list);
+ error_msg("compression parameter is not a digit in <%s>\n", str);
+ HDexit(EXIT_FAILURE);
+ }
+ stype[m] = c;
+ } /* u */
+
+ stype[m] = '\0';
+ } /*if */
+
+ filt->cd_values[j++] = (unsigned) HDstrtoul(stype, NULL, 0);
+ if(filt->cd_nelmts == 0)
+ j = 0;
+ i += m; /* jump */
+ }
+ else if (i == len - 1) { /*no more parameters */
+ scomp[k + 1] = '\0';
+ no_param = 1;
+ }
+
+ /*-------------------------------------------------------------------------
+ * translate from string to filter symbol
+ *-------------------------------------------------------------------------
+ */
+
+ /*-------------------------------------------------------------------------
+ * H5Z_FILTER_NONE
+ *-------------------------------------------------------------------------
+ */
+ if (HDstrcmp(scomp, "NONE") == 0) {
+ filt->filtn = H5Z_FILTER_NONE;
+ filt->cd_nelmts = 0;
+ }
+
+ /*-------------------------------------------------------------------------
+ * H5Z_FILTER_DEFLATE
+ *-------------------------------------------------------------------------
+ */
+ else if (HDstrcmp(scomp, "GZIP") == 0) {
+ filt->filtn = H5Z_FILTER_DEFLATE;
+ filt->cd_nelmts = 1;
+ if (no_param) { /*no more parameters, GZIP must have parameter */
+ if (obj_list)
+ HDfree(obj_list);
+ error_msg("missing compression parameter in <%s>\n", str);
+ HDexit(EXIT_FAILURE);
+ }
+ }
+
+ /*-------------------------------------------------------------------------
+ * H5Z_FILTER_SZIP
+ *-------------------------------------------------------------------------
+ */
+ else if (HDstrcmp(scomp, "SZIP") == 0) {
+ filt->filtn = H5Z_FILTER_SZIP;
+ filt->cd_nelmts = 2;
+ if (no_param) { /*no more parameters, SZIP must have parameter */
+ if (obj_list)
+ HDfree(obj_list);
+ error_msg("missing compression parameter in <%s>\n", str);
+ HDexit(EXIT_FAILURE);
+ }
+ }
+
+ /*-------------------------------------------------------------------------
+ * H5Z_FILTER_SHUFFLE
+ *-------------------------------------------------------------------------
+ */
+ else if (HDstrcmp(scomp, "SHUF") == 0) {
+ filt->filtn = H5Z_FILTER_SHUFFLE;
+ filt->cd_nelmts = 0;
+ if (m > 0) { /*shuffle does not have parameter */
+ if (obj_list)
+ HDfree(obj_list);
+ error_msg("extra parameter in SHUF <%s>\n", str);
+ HDexit(EXIT_FAILURE);
+ }
+ }
+ /*-------------------------------------------------------------------------
+ * H5Z_FILTER_FLETCHER32
+ *-------------------------------------------------------------------------
+ */
+ else if (HDstrcmp(scomp, "FLET") == 0) {
+ filt->filtn = H5Z_FILTER_FLETCHER32;
+ filt->cd_nelmts = 0;
+ if (m > 0) { /*shuffle does not have parameter */
+ if (obj_list)
+ HDfree(obj_list);
+ error_msg("extra parameter in FLET <%s>\n", str);
+ HDexit(EXIT_FAILURE);
+ }
+ }
+ /*-------------------------------------------------------------------------
+ * H5Z_FILTER_NBIT
+ *-------------------------------------------------------------------------
+ */
+ else if (HDstrcmp(scomp, "NBIT") == 0) {
+ filt->filtn = H5Z_FILTER_NBIT;
+ filt->cd_nelmts = 0;
+ if (m > 0) { /*nbit does not have parameter */
+ if (obj_list)
+ HDfree(obj_list);
+ error_msg("extra parameter in NBIT <%s>\n", str);
+ HDexit(EXIT_FAILURE);
+ }
+ }
+ /*-------------------------------------------------------------------------
+ * H5Z_FILTER_SCALEOFFSET
+ *-------------------------------------------------------------------------
+ */
+ else if (HDstrcmp(scomp, "SOFF") == 0) {
+ filt->filtn = H5Z_FILTER_SCALEOFFSET;
+ filt->cd_nelmts = 2;
+ if (no_param) { /*no more parameters, SOFF must have parameter */
+ if (obj_list)
+ HDfree(obj_list);
+ error_msg("missing compression parameter in <%s>\n", str);
+ HDexit(EXIT_FAILURE);
+ }
+ }
+ /*-------------------------------------------------------------------------
+ * User Defined Filter
+ *-------------------------------------------------------------------------
+ */
+ else if (HDstrcmp(scomp, "UD") == 0) {
+ /* parameters does not match count */
+ if (filt->cd_nelmts != j) {
+ if (obj_list)
+ HDfree(obj_list);
+ error_msg("incorrect number of compression parameters in <%s>\n", str);
+ HDexit(EXIT_FAILURE);
+ }
+ }
+ else {
+ if (obj_list)
+ HDfree(obj_list);
+ error_msg("invalid filter type in <%s>\n", str);
+ HDexit(EXIT_FAILURE);
+ }
+ }
+ } /*i*/
+
+ /*-------------------------------------------------------------------------
+ * check valid parameters
+ *-------------------------------------------------------------------------
+ */
+
+ switch (filt->filtn) {
+ /*-------------------------------------------------------------------------
+ * H5Z_FILTER_DEFLATE
+ *-------------------------------------------------------------------------
+ */
+ case H5Z_FILTER_DEFLATE:
+ if (filt->cd_values[0] > 9) {
+ if (obj_list)
+ HDfree(obj_list);
+ error_msg("invalid compression parameter in <%s>\n", str);
+ HDexit(EXIT_FAILURE);
+ }
+ break;
+ /*-------------------------------------------------------------------------
+ * H5Z_FILTER_SZIP
+ *-------------------------------------------------------------------------
+ */
+ case H5Z_FILTER_SZIP:
+ pixels_per_block = filt->cd_values[0];
+ if ((pixels_per_block % 2) == 1) {
+ if (obj_list)
+ HDfree(obj_list);
+ error_msg("pixels_per_block is not even in <%s>\n", str);
+ HDexit(EXIT_FAILURE);
+ }
+ if (pixels_per_block > H5_SZIP_MAX_PIXELS_PER_BLOCK) {
+ if (obj_list)
+ HDfree(obj_list);
+ error_msg("pixels_per_block is too large in <%s>\n", str);
+ HDexit(EXIT_FAILURE);
+ }
+ if ((HDstrcmp(smask,"NN") != 0) && (HDstrcmp(smask,"EC") != 0)) {
+ if (obj_list)
+ HDfree(obj_list);
+ error_msg("szip mask must be 'NN' or 'EC' \n");
+ HDexit(EXIT_FAILURE);
+ }
+ break;
+ default:
+ break;
+ };
+
+ return obj_list;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: parse_layout
+ *
+ * Purpose: read layout info
+ *
+ * Return: a list of names, the number of names and its chunking info for
+ * chunked. NULL, on error
+ * the layout type can be:
+ * CHUNK, to apply chunking layout
+ * CONTI, to apply contiguous layout
+ * COMPA, to apply compact layout
+ *
+ * Example:
+ * "AA,B,CDE:CHUNK=10X10"
+ *
+ * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ *
+ * Date: December 30, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+obj_list_t* parse_layout(const char *str, unsigned *n_objs, pack_info_t *pack, /* info about layout needed */
+pack_opt_t *options) {
+ obj_list_t* obj_list = NULL;
+ unsigned i, j, n;
+ char c;
+ size_t len = HDstrlen(str);
+ int k, end_obj = -1, c_index;
+ char sobj[MAX_NC_NAME];
+ char sdim[10];
+ char slayout[10];
+
+ HDmemset(sdim, '\0', sizeof(sdim));
+ HDmemset(sobj, '\0', sizeof(sobj));
+ HDmemset(slayout, '\0', sizeof(slayout));
+
+ /* check for the end of object list and number of objects */
+ for (i = 0, n = 0; i < len; i++) {
+ c = str[i];
+ if (c == ':')
+ end_obj = (int) i;
+ if (c == ',')
+ n++;
+ }
+
+ if (end_obj == -1) { /* missing : chunk all */
+ options->all_layout = 1;
+ }
+
+ n++;
+ obj_list = (obj_list_t*) HDmalloc(n * sizeof(obj_list_t));
+ if (obj_list == NULL) {
+ error_msg("could not allocate object list\n");
+ return NULL;
+ }
+ *n_objs = n;
+
+ /* get object list */
+ if (end_obj > 0)
+ for (j = 0, k = 0, n = 0; j < (unsigned) end_obj; j++, k++) {
+ c = str[j];
+ sobj[k] = c;
+ if (c == ',' || j == (unsigned) (end_obj - 1)) {
+ if (c == ',')
+ sobj[k] = '\0';
+ else
+ sobj[k + 1] = '\0';
+ HDstrcpy(obj_list[n].obj, sobj);
+ HDmemset(sobj, 0, sizeof(sobj));
+ n++;
+ k = -1;
+ }
+ }
+
+ /* nothing after : */
+ if (end_obj + 1 == (int) len) {
+ if (obj_list)
+ HDfree(obj_list);
+ error_msg("in parse layout, no characters after : in <%s>\n", str);
+ HDexit(EXIT_FAILURE);
+ }
+
+ /* get layout info */
+ for (j = (unsigned) (end_obj + 1), n = 0; n <= 5; j++, n++) {
+ if (n == 5) {
+ slayout[n] = '\0'; /*cut string */
+ if (HDstrcmp(slayout, "COMPA") == 0)
+ pack->layout = H5D_COMPACT;
+ else if (HDstrcmp(slayout, "CONTI") == 0)
+ pack->layout = H5D_CONTIGUOUS;
+ else if (HDstrcmp(slayout, "CHUNK") == 0)
+ pack->layout = H5D_CHUNKED;
+ else {
+ error_msg("in parse layout, not a valid layout in <%s>\n", str);
+ HDexit(EXIT_FAILURE);
+ }
+ }
+ else {
+ c = str[j];
+ slayout[n] = c;
+ }
+ } /* j */
+
+ if (pack->layout == H5D_CHUNKED) {
+ /*-------------------------------------------------------------------------
+ * get chunk info
+ *-------------------------------------------------------------------------
+ */
+ k = 0;
+ if (j > len) {
+ if (obj_list)
+ HDfree(obj_list);
+ error_msg("in parse layout, <%s> Chunk dimensions missing\n", str);
+ HDexit(EXIT_FAILURE);
+ }
+
+ for (i = j, c_index = 0; i < len; i++) {
+ c = str[i];
+ sdim[k] = c;
+ k++; /*increment sdim index */
+
+ if (!HDisdigit(c) && c != 'x' && c != 'N' && c != 'O' && c != 'N' && c != 'E') {
+ if (obj_list)
+ HDfree(obj_list);
+ error_msg("in parse layout, <%s> Not a valid character in <%s>\n", sdim, str);
+ HDexit(EXIT_FAILURE);
+ }
+
+ if (c == 'x' || i == len - 1) {
+ if (c == 'x') {
+ sdim[k - 1] = '\0';
+ k = 0;
+ pack->chunk.chunk_lengths[c_index] = HDstrtoull(sdim, NULL, 0);
+ if (pack->chunk.chunk_lengths[c_index] == 0) {
+ if (obj_list)
+ HDfree(obj_list);
+ error_msg("in parse layout, <%s> conversion to number in <%s>\n", sdim, str);
+ HDexit(EXIT_FAILURE);
+ }
+ c_index++;
+ }
+ else if (i == len - 1) { /*no more parameters */
+ sdim[k] = '\0';
+ k = 0;
+ if (HDstrcmp(sdim,"NONE") == 0) {
+ pack->chunk.rank = -2;
+ }
+ else {
+ pack->chunk.chunk_lengths[c_index] = HDstrtoull(sdim, NULL, 0);
+ if (pack->chunk.chunk_lengths[c_index] == 0) {
+ if (obj_list)
+ HDfree(obj_list);
+ error_msg("in parse layout, <%s> conversion to number in <%s>\n", sdim, str);
+ HDexit(EXIT_FAILURE);
+ }
+ pack->chunk.rank = c_index + 1;
+ }
+ } /*if */
+ } /*if c=='x' || i==len-1 */
+ } /*i*/
+ } /*H5D_CHUNKED*/
+
+ return obj_list;
+}
diff --git a/tools/src/h5repack/h5repack_refs.c b/tools/src/h5repack/h5repack_refs.c
new file mode 100644
index 0000000..f0f32c3
--- /dev/null
+++ b/tools/src/h5repack/h5repack_refs.c
@@ -0,0 +1,877 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include "h5repack.h"
+#include "h5diff.h"
+#include "h5tools.h"
+
+
+/*-------------------------------------------------------------------------
+ * local functions
+ *-------------------------------------------------------------------------
+ */
+
+static const char* MapIdToName(hid_t refobj_id,trav_table_t *travt);
+static int copy_refs_attr(hid_t loc_in, hid_t loc_out, pack_opt_t *options,
+ trav_table_t *travt, hid_t fidout);
+static herr_t update_ref_value(hid_t obj_id, H5R_type_t ref_type, void *ref_in,
+ hid_t fid_out, void *ref_out, trav_table_t *travt);
+
+/*-------------------------------------------------------------------------
+ * Function: do_copy_refobjs
+ *
+ * Purpose: duplicate all referenced HDF5 objects in the file
+ * and create hard links
+ *
+ * Return: 0, ok, -1 no
+ *
+ * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ *
+ * Date: December, 10, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+int do_copy_refobjs(hid_t fidin,
+ hid_t fidout,
+ trav_table_t *travt,
+ pack_opt_t *options) /* repack options */
+{
+ int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
+ hid_t grp_in = (-1); /* read group ID */
+ hid_t grp_out = (-1); /* write group ID */
+ hid_t dset_in = (-1); /* read dataset ID */
+ hid_t dset_out = (-1); /* write dataset ID */
+ hid_t type_in = (-1); /* named type ID */
+ hid_t dcpl_id = (-1); /* dataset creation property list ID */
+ hid_t space_id = (-1); /* space ID */
+ hid_t ftype_id = (-1); /* file data type ID */
+ hid_t mtype_id = (-1); /* memory data type ID */
+ size_t msize; /* memory size of memory type */
+ hsize_t nelmts; /* number of elements in dataset */
+ int rank; /* rank of dataset */
+ hsize_t dims[H5S_MAX_RANK]; /* dimensions of dataset */
+ unsigned int i, j;
+ int k;
+ named_dt_t *named_dt_head=NULL; /* Pointer to the stack of named datatypes
+ copied */
+
+ /*-------------------------------------------------------------------------
+ * browse
+ *-------------------------------------------------------------------------
+ */
+ for(i = 0; i < travt->nobjs; i++) {
+ switch(travt->objs[i].type)
+ {
+ /*-------------------------------------------------------------------------
+ * H5TRAV_TYPE_GROUP
+ *-------------------------------------------------------------------------
+ */
+ case H5TRAV_TYPE_GROUP:
+ /*-------------------------------------------------------------------------
+ * copy referenced objects in attributes
+ *-------------------------------------------------------------------------
+ */
+ if((grp_out = H5Gopen2(fidout, travt->objs[i].name, H5P_DEFAULT)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gopen2 failed");
+
+ if((grp_in = H5Gopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gopen2 failed");
+
+ if(copy_refs_attr(grp_in, grp_out, options, travt, fidout) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_refs_attr failed");
+
+ if(H5Gclose(grp_out) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gclose failed");
+ if(H5Gclose(grp_in) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gclose failed");
+
+ /*-------------------------------------------------------------------------
+ * check for hard links
+ *-------------------------------------------------------------------------
+ */
+ if(travt->objs[i].nlinks)
+ for(j = 0; j < travt->objs[i].nlinks; j++)
+ H5Lcreate_hard(fidout, travt->objs[i].name, H5L_SAME_LOC, travt->objs[i].links[j].new_name, H5P_DEFAULT, H5P_DEFAULT);
+ break;
+
+ /*-------------------------------------------------------------------------
+ * H5TRAV_TYPE_DATASET
+ *-------------------------------------------------------------------------
+ */
+ case H5TRAV_TYPE_DATASET:
+ if((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed");
+ if((space_id = H5Dget_space(dset_in)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed");
+ if((ftype_id = H5Dget_type(dset_in)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_type failed");
+ if((dcpl_id = H5Dget_create_plist(dset_in)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_create_plist failed");
+ if((rank = H5Sget_simple_extent_ndims(space_id)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed");
+ if(H5Sget_simple_extent_dims(space_id, dims, NULL) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed");
+ nelmts = 1;
+ for(k = 0; k < rank; k++)
+ nelmts *= dims[k];
+
+ if((mtype_id = h5tools_get_native_type(ftype_id)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "h5tools_get_native_type failed");
+
+ if((msize = H5Tget_size(mtype_id)) == 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_size failed");
+
+ /*-------------------------------------------------------------------------
+ * check if the dataset creation property list has filters that
+ * are not registered in the current configuration
+ * 1) the external filters GZIP and SZIP might not be available
+ * 2) the internal filters might be turned off
+ *-------------------------------------------------------------------------
+ */
+ if(h5tools_canreadf(NULL, dcpl_id) == 1) {
+ /*-------------------------------------------------------------------------
+ * test for a valid output dataset
+ *-------------------------------------------------------------------------
+ */
+ dset_out = FAIL;
+
+ /*-------------------------------------------------------------------------
+ * object references are a special case
+ * we cannot just copy the buffers, but instead we recreate the reference
+ *-------------------------------------------------------------------------
+ */
+ if(H5Tequal(mtype_id, H5T_STD_REF_OBJ)) {
+ hid_t refobj_id;
+ hobj_ref_t *refbuf = NULL; /* buffer for object references */
+ hobj_ref_t *buf = NULL;
+ const char* refname;
+ unsigned u;
+
+ /*-------------------------------------------------------------------------
+ * read to memory
+ *-------------------------------------------------------------------------
+ */
+ if(nelmts) {
+ buf = (hobj_ref_t *)HDmalloc((unsigned)(nelmts * msize));
+ if(buf==NULL) {
+ printf("cannot read into memory\n" );
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDmalloc failed");
+ } /* end if */
+ if(H5Dread(dset_in, mtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed");
+
+ refbuf = (hobj_ref_t*) HDcalloc((unsigned)nelmts, msize);
+ if(refbuf == NULL){
+ printf("cannot allocate memory\n" );
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDcalloc failed");
+ } /* end if */
+ for(u = 0; u < nelmts; u++) {
+ H5E_BEGIN_TRY {
+ if((refobj_id = H5Rdereference2(dset_in, H5P_DEFAULT, H5R_OBJECT, &buf[u])) < 0)
+ continue;
+ } H5E_END_TRY;
+
+ /* get the name. a valid name could only occur
+ * in the second traversal of the file
+ */
+ if((refname = MapIdToName(refobj_id, travt)) != NULL) {
+ /* create the reference, -1 parameter for objects */
+ if(H5Rcreate(&refbuf[u], fidout, refname, H5R_OBJECT, (hid_t)-1) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Rcreate failed");
+ if(options->verbose)
+ {
+ printf(FORMAT_OBJ,"dset",travt->objs[i].name );
+ printf("object <%s> object reference created to <%s>\n",
+ travt->objs[i].name,
+ refname);
+ }
+ } /*refname*/
+ H5Oclose(refobj_id);
+ } /* u */
+ } /*nelmts*/
+
+ /*-------------------------------------------------------------------------
+ * create/write dataset/close
+ *-------------------------------------------------------------------------
+ */
+ if((dset_out = H5Dcreate2(fidout, travt->objs[i].name, mtype_id, space_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dcreate2 failed");
+ if(nelmts)
+ if(H5Dwrite(dset_out, mtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, refbuf) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dwrite failed");
+
+ if(buf)
+ HDfree(buf);
+ if(refbuf)
+ HDfree(refbuf);
+
+ /*------------------------------------------------------
+ * copy attrs
+ *----------------------------------------------------*/
+ if(copy_attr(dset_in, dset_out, &named_dt_head, travt, options) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_attr failed");
+ } /*H5T_STD_REF_OBJ*/
+
+ /*-------------------------------------------------------------------------
+ * dataset region references
+ *-------------------------------------------------------------------------
+ */
+ else if(H5Tequal(mtype_id, H5T_STD_REF_DSETREG))
+ {
+ hid_t refobj_id;
+ hdset_reg_ref_t *refbuf = NULL; /* input buffer for region references */
+ hdset_reg_ref_t *buf = NULL; /* output buffer */
+ const char* refname;
+ unsigned u;
+
+ /*-------------------------------------------------------------------------
+ * read input to memory
+ *-------------------------------------------------------------------------
+ */
+ if(nelmts) {
+ buf = (hdset_reg_ref_t *)HDmalloc((unsigned)(nelmts * msize));
+ if(buf == NULL) {
+ printf("cannot read into memory\n");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDmalloc failed");
+ } /* end if */
+ if(H5Dread(dset_in, mtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed");
+
+ /*-------------------------------------------------------------------------
+ * create output
+ *-------------------------------------------------------------------------
+ */
+ refbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)nelmts); /*init to zero */
+ if(refbuf == NULL) {
+ printf("cannot allocate memory\n");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDcalloc failed");
+ } /* end if */
+
+ for(u = 0; u < nelmts; u++) {
+ H5E_BEGIN_TRY {
+ if((refobj_id = H5Rdereference2(dset_in, H5P_DEFAULT, H5R_DATASET_REGION, &buf[u])) < 0)
+ continue;
+ } H5E_END_TRY;
+
+ /* get the name. a valid name could only occur
+ * in the second traversal of the file
+ */
+ if((refname = MapIdToName(refobj_id, travt)) != NULL) {
+ hid_t region_id; /* region id of the referenced dataset */
+
+ if((region_id = H5Rget_region(dset_in, H5R_DATASET_REGION, &buf[u])) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Rget_region failed");
+
+ /* create the reference, we need the space_id */
+ if(H5Rcreate(&refbuf[u], fidout, refname, H5R_DATASET_REGION, region_id) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Rcreate failed");
+ if(H5Sclose(region_id) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose failed");
+ if(options->verbose)
+ {
+ printf(FORMAT_OBJ,"dset",travt->objs[i].name );
+ printf("object <%s> region reference created to <%s>\n",
+ travt->objs[i].name,
+ refname);
+ }
+ } /*refname*/
+ H5Oclose(refobj_id);
+ } /* u */
+ } /*nelmts*/
+
+ /*-------------------------------------------------------------------------
+ * create/write dataset/close
+ *-------------------------------------------------------------------------
+ */
+ if((dset_out = H5Dcreate2(fidout, travt->objs[i].name, mtype_id, space_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dcreate2 failed");
+ if(nelmts)
+ if(H5Dwrite(dset_out, mtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, refbuf) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dwrite failed");
+
+ if(buf)
+ HDfree(buf);
+ if(refbuf)
+ HDfree(refbuf);
+
+ /*-----------------------------------------------------
+ * copy attrs
+ *----------------------------------------------------*/
+ if(copy_attr(dset_in, dset_out, &named_dt_head, travt, options) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_attr failed");
+ } /* H5T_STD_REF_DSETREG */
+ /*-------------------------------------------------------------------------
+ * not references, open previously created object in 1st traversal
+ *-------------------------------------------------------------------------
+ */
+ else {
+ if((dset_out = H5Dopen2(fidout, travt->objs[i].name, H5P_DEFAULT)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed");
+ } /* end else */
+
+ HDassert(dset_out != FAIL);
+
+ /*-------------------------------------------------------------------------
+ * copy referenced objects in attributes
+ *-------------------------------------------------------------------------
+ */
+ if(copy_refs_attr(dset_in, dset_out, options, travt, fidout) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_refs_attr failed");
+
+ /*-------------------------------------------------------------------------
+ * check for hard links
+ *-------------------------------------------------------------------------
+ */
+ if(travt->objs[i].nlinks)
+ for(j = 0; j < travt->objs[i].nlinks; j++)
+ H5Lcreate_hard(fidout, travt->objs[i].name, H5L_SAME_LOC, travt->objs[i].links[j].new_name, H5P_DEFAULT, H5P_DEFAULT);
+
+ if(H5Dclose(dset_out) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed");
+ } /*can_read*/
+
+ /*-------------------------------------------------------------------------
+ * close
+ *-------------------------------------------------------------------------
+ */
+ if(H5Tclose(ftype_id) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed");
+ if(H5Tclose(mtype_id) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed");
+ if(H5Pclose(dcpl_id) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ if(H5Sclose(space_id) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose failed");
+ if(H5Dclose(dset_in) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed");
+ break;
+
+ /*-------------------------------------------------------------------------
+ * H5TRAV_TYPE_NAMED_DATATYPE
+ *-------------------------------------------------------------------------
+ */
+ case H5TRAV_TYPE_NAMED_DATATYPE:
+ if((type_in = H5Topen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Topen2 failed");
+ if(H5Tclose(type_in) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed");
+ break;
+
+ /*-------------------------------------------------------------------------
+ * H5TRAV_TYPE_LINK
+ *-------------------------------------------------------------------------
+ */
+ case H5TRAV_TYPE_LINK:
+ /*nothing to do */
+ break;
+
+ case H5TRAV_TYPE_UNKNOWN:
+ case H5TRAV_TYPE_UDLINK:
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5TRAV invalid type");
+
+ default:
+ break;
+ } /* end switch */
+ } /* end for */
+
+ /* Finalize (link) the stack of named datatypes (if any)
+ * This function is paired with copy_named_datatype() which is called
+ * in copy_attr(), so need to free.
+ */
+ named_datatype_free(&named_dt_head, 0);
+
+ return ret_value;
+
+done:
+ H5E_BEGIN_TRY {
+ H5Gclose(grp_in);
+ H5Gclose(grp_out);
+ H5Pclose(dcpl_id);
+ H5Sclose(space_id);
+ H5Dclose(dset_in);
+ H5Dclose(dset_out);
+ H5Tclose(ftype_id);
+ H5Tclose(mtype_id);
+ H5Tclose(type_in);
+ named_datatype_free(&named_dt_head, 0);
+ } H5E_END_TRY;
+
+ return ret_value;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: copy_refs_attr
+ *
+ * Purpose: duplicate all referenced HDF5 located in attributes
+ * relative to LOC_IN, which is obtained either from
+ * loc_id = H5Gopen2(fid, name, H5P_DEFAULT);
+ * loc_id = H5Dopen2(fid, name, H5P_DEFAULT);
+ * loc_id = H5Topen2(fid, name, H5P_DEFAULT);
+ *
+ * Return: 0, ok, -1 no
+ *
+ * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ *
+ * Modifier: xcao@hdfgroup.org, 9/12/2011
+ * Update values of references(object and region) for the following types:
+ * 1) References,
+ * 2) ARRAY of reference,
+ * 3) VLEN of references.
+ * 4) COMPOUND of references.
+ * This function does not handle references in other complicated structures,
+ * such as references in nested compound datatypes.
+ *
+ * Date: October, 28, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static int copy_refs_attr(hid_t loc_in,
+ hid_t loc_out,
+ pack_opt_t *options,
+ trav_table_t *travt,
+ hid_t fidout /* for saving references */
+ )
+{
+ int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
+ hid_t attr_id = -1; /* attr ID */
+ hid_t attr_out = -1; /* attr ID */
+ hid_t space_id = -1; /* space ID */
+ hid_t ftype_id = -1; /* file data type ID */
+ hid_t mtype_id = -1; /* memory data type ID */
+ size_t msize; /* memory size of type */
+ hsize_t nelmts; /* number of elements in dataset */
+ hsize_t dims[H5S_MAX_RANK];/* dimensions of dataset */
+ char name[255];
+ H5O_info_t oinfo; /* Object info */
+ unsigned u, i, j;
+ int rank;
+ H5T_class_t type_class = -1;
+ hbool_t is_ref=0, is_ref_vlen=0, is_ref_array=0, is_ref_comp=0;
+ void *refbuf = NULL;
+ void *buf = NULL;
+ const char* refname = NULL;
+ unsigned *ref_comp_index = NULL;
+ size_t *ref_comp_size = NULL;
+ int ref_comp_field_n = 0;
+
+
+ if(H5Oget_info(loc_in, &oinfo) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Oget_info failed");
+
+ for(u = 0; u < (unsigned)oinfo.num_attrs; u++) {
+ is_ref = is_ref_vlen = is_ref_array = is_ref_comp = 0;
+
+ /* open attribute */
+ if((attr_id = H5Aopen_by_idx(loc_in, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aopen_by_idx failed");
+
+ /* get the file datatype */
+ if((ftype_id = H5Aget_type(attr_id)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_type failed");
+
+ type_class = H5Tget_class(ftype_id);
+
+ if((mtype_id = h5tools_get_native_type(ftype_id)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "h5tools_get_native_type failed");
+
+ if((msize = H5Tget_size(mtype_id)) == 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_size failed");
+
+ is_ref = (type_class == H5T_REFERENCE);
+
+ if(type_class == H5T_VLEN ) {
+ hid_t base_type;
+
+ base_type = H5Tget_super(ftype_id);
+ is_ref_vlen = (H5Tget_class(base_type)==H5T_REFERENCE);
+ msize = H5Tget_size(base_type);
+ H5Tclose(base_type);
+ }
+ else if(type_class == H5T_ARRAY ) {
+ hid_t base_type;
+
+ base_type = H5Tget_super(ftype_id);
+ is_ref_array = (H5Tget_class(base_type)==H5T_REFERENCE);
+ msize = H5Tget_size(base_type);
+ H5Tclose(base_type);
+ }
+ else if(type_class == H5T_COMPOUND) {
+ int nmembers = H5Tget_nmembers(ftype_id) ;
+
+ if (nmembers < 1)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers failed");
+
+ ref_comp_index = (unsigned *)HDmalloc((size_t)nmembers*sizeof(unsigned));
+ ref_comp_size = (size_t *)HDmalloc((size_t)nmembers*sizeof(ref_comp_size));
+ ref_comp_field_n = 0;
+
+ for (i=0; i<(unsigned)nmembers; i++) {
+ hid_t mtid = H5Tget_member_type( ftype_id, i );
+
+ if ((H5Tget_class(mtid)==H5T_REFERENCE)) {
+ ref_comp_index[ref_comp_field_n] = i;
+ ref_comp_size[ref_comp_field_n] = H5Tget_size(mtid);
+ ref_comp_field_n++;
+ }
+ H5Tclose(mtid);
+ }
+
+ /* if compound don't contain reference type member, free the above
+ * mallocs. Otherwise there can be memory leaks by the 'continue'
+ * statement below. */
+ if (!ref_comp_field_n) {
+ if (ref_comp_index) {
+ HDfree(ref_comp_index);
+ ref_comp_index = NULL;
+ }
+
+ if (ref_comp_size) {
+ HDfree(ref_comp_size);
+ ref_comp_size = NULL;
+ }
+ }
+ }
+
+ is_ref_comp = (ref_comp_field_n > 0);
+
+ if (!(is_ref || is_ref_vlen || is_ref_array || is_ref_comp)) {
+ H5Tclose(mtype_id);
+ H5Tclose(ftype_id);
+ H5Aclose(attr_id);
+ continue;
+ }
+
+ /* get name */
+ if(H5Aget_name(attr_id, 255, name) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_name failed");
+
+ /* get the dataspace handle */
+ if((space_id = H5Aget_space(attr_id)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_space failed");
+
+ /* get dimensions */
+ if((rank = H5Sget_simple_extent_dims(space_id, dims, NULL)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed");
+
+
+ /*-------------------------------------------------------------------------
+ * elements
+ *-------------------------------------------------------------------------
+ */
+ nelmts = 1;
+ for(j = 0; j < (unsigned)rank; j++)
+ nelmts *= dims[j];
+
+ if (is_ref_array) {
+ unsigned array_rank = 0;
+ hsize_t array_size = 1;
+ hsize_t array_dims[H5S_MAX_RANK];
+ hid_t base_type;
+
+ base_type = H5Tget_super(ftype_id);
+ msize = H5Tget_size(base_type);
+ H5Tclose(base_type);
+
+ array_rank = (unsigned)H5Tget_array_ndims(mtype_id);
+ H5Tget_array_dims2(mtype_id, array_dims);
+ for(j = 0; j <array_rank; j++)
+ array_size *= array_dims[j];
+ nelmts *= array_size;
+ }
+
+ if((attr_out = H5Acreate2(loc_out, name, ftype_id, space_id, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Acreate2 failed");
+
+ if (nelmts>0) {
+ /* handle object references */
+ if((is_ref || is_ref_array) && (H5R_OBJ_REF_BUF_SIZE==msize)) {
+ buf = (hobj_ref_t *)HDmalloc((unsigned)(nelmts * msize));
+ if(buf == NULL) {
+ printf("cannot read into memory\n");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDmalloc failed");
+ } /* end if */
+ if(H5Aread(attr_id, mtype_id, buf) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aread failed");
+
+ refbuf = (hobj_ref_t *)HDcalloc((unsigned)nelmts, msize);
+ if(refbuf == NULL) {
+ printf("cannot allocate memory\n");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDcalloc failed");
+ } /* end if */
+
+ for(i = 0; i < (unsigned)nelmts; i++) {
+ if (update_ref_value(attr_id, H5R_OBJECT, &((hobj_ref_t *)buf)[i], fidout, &((hobj_ref_t *)refbuf)[i], travt)<0)
+ continue;
+ if(options->verbose)
+ printf("object <%s> reference created to <%s>\n", name, refname);
+ } /* i */
+ } /* H5T_STD_REF_OBJ */
+ /* handle region references */
+ else if((is_ref || is_ref_array) && (H5R_DSET_REG_REF_BUF_SIZE == msize)) {
+ buf = (hdset_reg_ref_t *)HDmalloc((unsigned)(nelmts * msize));
+
+ if(buf == NULL) {
+ printf( "cannot read into memory\n" );
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDmalloc failed");
+ } /* end if */
+ if(H5Aread(attr_id, mtype_id, buf) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aread failed");
+
+ /*-------------------------------------------------------------------------
+ * create output
+ *-------------------------------------------------------------------------
+ */
+ refbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)nelmts); /*init to zero */
+ if(refbuf == NULL) {
+ printf( "cannot allocate memory\n" );
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDcalloc failed");
+ } /* end if */
+
+ for(i = 0; i < (unsigned)nelmts; i++) {
+ if (update_ref_value(attr_id, H5R_DATASET_REGION, &((hdset_reg_ref_t *)buf)[i], fidout, &((hdset_reg_ref_t *)refbuf)[i], travt)<0)
+ continue;
+ if(options->verbose)
+ printf("object <%s> region reference created to <%s>\n", name, refname);
+ }
+ } /* H5T_STD_REF_DSETREG */
+ else if (is_ref_vlen) {
+ /* handle VLEN of references */
+
+ buf = (hvl_t *)HDmalloc((unsigned)(nelmts * sizeof(hvl_t)));
+ refbuf = buf; /* reuse the read buffer for write */
+
+ if(buf == NULL) {
+ printf( "cannot read into memory\n" );
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDmalloc failed");
+ } /* end if */
+
+ if(H5Aread(attr_id, mtype_id, buf) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aread failed");
+
+ if (H5R_OBJ_REF_BUF_SIZE==msize) {
+ hobj_ref_t ref_out;
+
+ for (i=0; i<(unsigned)nelmts; i++) {
+ hobj_ref_t *ptr = (hobj_ref_t *)((hvl_t *)buf)[i].p;
+
+ for (j=0; j<((hvl_t *)buf)[i].len; j++ ) {
+ if (update_ref_value(attr_id, H5R_OBJECT, &(ptr[j]), fidout, &ref_out, travt)<0)
+ continue;
+ HDmemcpy(&(ptr[j]), &ref_out, msize);
+ }
+ } /* for (i=0; i<nelems; i++) */
+ } else if (H5R_DSET_REG_REF_BUF_SIZE == msize) {
+ hdset_reg_ref_t ref_out;
+
+ for (i=0; i<(unsigned)nelmts; i++) {
+ hdset_reg_ref_t *ptr = (hdset_reg_ref_t *)((hvl_t *)buf)[i].p;
+
+ for (j=0; j<((hvl_t *)buf)[i].len; j++ ) {
+ if (update_ref_value(attr_id, H5R_DATASET_REGION, &(ptr[j]), fidout, &ref_out, travt)<0)
+ continue;
+ HDmemcpy(&(ptr[j]), &ref_out, msize);
+ }
+ } /* for (i=0; i<nelems; i++) */
+ }
+ } /* else if (is_ref_vlen) */
+ else if (is_ref_comp) {
+ /* handle ref fields in a compound */
+
+ buf = HDmalloc((unsigned)(nelmts * msize));
+ refbuf = buf; /* reuse the read buffer for write */
+
+ if(buf == NULL)
+ {
+ printf( "cannot read into memory\n" );
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDmalloc failed");
+ } /* end if */
+
+ if(H5Aread(attr_id, mtype_id, buf) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aread failed");
+
+ for (i=0; i<(unsigned)nelmts; i++) {
+ for (j=0; j<(unsigned)ref_comp_field_n; j++) {
+ if (ref_comp_size[j] == H5R_OBJ_REF_BUF_SIZE) {
+ size_t idx = (i * msize) + H5Tget_member_offset(mtype_id, ref_comp_index[j]);
+ hobj_ref_t ref_out;
+
+ if (update_ref_value(attr_id, H5R_OBJECT, (hobj_ref_t *)(((char *)buf)+idx), fidout, &ref_out, travt)<0)
+ continue;
+ HDmemcpy(((char *)buf)+idx, &ref_out, ref_comp_size[j]);
+ } /* if */
+ else if (ref_comp_size[j] == H5R_DSET_REG_REF_BUF_SIZE) {
+ size_t idx = i * msize + H5Tget_member_offset(mtype_id, ref_comp_index[j]);
+ hdset_reg_ref_t ref_out;
+
+ if (update_ref_value(attr_id, H5R_DATASET_REGION, (hdset_reg_ref_t *)(((char *)buf)+idx), fidout, &ref_out, travt)<0)
+ continue;
+ HDmemcpy(((char *)buf)+idx, &ref_out, ref_comp_size[j]);
+ } /* else if */
+ } /* j */
+ } /* i */
+ } /* else if (is_ref_comp) */
+
+ if(H5Awrite(attr_out, mtype_id, refbuf) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Awrite failed");
+
+ if (is_ref_vlen && buf)
+ H5Dvlen_reclaim (mtype_id, space_id, H5P_DEFAULT, buf);
+ } /* if (nelmts) */
+
+ if (refbuf == buf)
+ refbuf = NULL; /* set it to NULL to avoid double free since buf and refbuf are the same. */
+
+ if(buf) {
+ HDfree(buf);
+ buf = NULL;
+ }
+
+ if(refbuf) {
+ HDfree(refbuf);
+ refbuf = NULL;
+ }
+
+ if (ref_comp_index) {
+ HDfree(ref_comp_index);
+ ref_comp_index = NULL;
+ }
+
+ if (ref_comp_size) {
+ HDfree(ref_comp_size);
+ ref_comp_size = NULL;
+ }
+
+ if(H5Aclose(attr_out) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aclose failed");
+
+ /*-------------------------------------------------------------------------
+ * close
+ *-------------------------------------------------------------------------
+ */
+ if(H5Tclose(ftype_id) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed");
+ if(H5Tclose(mtype_id) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed");
+ if(H5Sclose(space_id) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose failed");
+ if(H5Aclose(attr_id) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aclose failed");
+ } /* for(u = 0; u < (unsigned)oinfo.num_attrs; u++) */
+
+ return ret_value;
+
+done:
+ if(refbuf)
+ HDfree(refbuf);
+ if(buf)
+ HDfree(buf);
+
+ if (ref_comp_index)
+ HDfree(ref_comp_index);
+
+ if (ref_comp_size)
+ HDfree(ref_comp_size);
+
+ H5E_BEGIN_TRY {
+ H5Tclose(ftype_id);
+ H5Tclose(mtype_id);
+ H5Sclose(space_id);
+ H5Aclose(attr_id);
+ H5Aclose(attr_out);
+ } H5E_END_TRY;
+
+ return ret_value;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: MapIdToName
+ *
+ * Purpose: map a ID from a reference to a dataset name
+ *
+ *-------------------------------------------------------------------------
+ */
+static const char*
+MapIdToName(hid_t refobj_id, trav_table_t *travt)
+{
+ unsigned int u;
+ const char* ret = NULL;
+
+ /* linear search */
+ for(u = 0; u < travt->nobjs; u++) {
+ if(travt->objs[u].type == (h5trav_type_t)H5O_TYPE_DATASET ||
+ travt->objs[u].type == (h5trav_type_t)H5O_TYPE_GROUP ||
+ travt->objs[u].type == (h5trav_type_t)H5O_TYPE_NAMED_DATATYPE) {
+ H5O_info_t ref_oinfo; /* Stat for the refobj id */
+
+ /* obtain information to identify the referenced object uniquely */
+ if(H5Oget_info(refobj_id, &ref_oinfo) < 0)
+ goto out;
+
+ if(ref_oinfo.addr == travt->objs[u].objno) {
+ ret = travt->objs[u].name;
+ goto out;
+ } /* end if */
+ } /* end if */
+ } /* u */
+
+out:
+ return ret;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: Update_Ref_value
+ *
+ * Purpose: Update a reference value
+ *
+ * Programmer: xcao@hdfgroup.org 9/12/2011
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t update_ref_value(hid_t obj_id, H5R_type_t ref_type, void *ref_in,
+ hid_t fid_out, void *ref_out, trav_table_t *travt)
+{
+ int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
+ const char* ref_obj_name;
+ hid_t space_id=-1, ref_obj_id=-1;
+
+ ref_obj_id = H5Rdereference2(obj_id, H5P_DEFAULT, ref_type, ref_in);
+ if (ref_obj_id < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Rdereference2 failed");
+
+ ref_obj_name = MapIdToName(ref_obj_id, travt);
+ if (ref_obj_name == NULL)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "MapIdToName failed");
+
+ if (ref_type == H5R_DATASET_REGION) {
+ space_id = H5Rget_region(obj_id, H5R_DATASET_REGION, ref_in);
+ if (space_id < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Rget_region failed");
+ }
+
+ if(H5Rcreate(ref_out, fid_out, ref_obj_name, ref_type, space_id) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Rcreate failed");
+
+done:
+ H5E_BEGIN_TRY {
+ H5Sclose(space_id);
+ H5Oclose(ref_obj_id);
+ } H5E_END_TRY;
+
+ return ret_value;
+}
+
diff --git a/tools/src/h5repack/h5repack_verify.c b/tools/src/h5repack/h5repack_verify.c
new file mode 100644
index 0000000..6765c49
--- /dev/null
+++ b/tools/src/h5repack/h5repack_verify.c
@@ -0,0 +1,675 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include "h5repack.h"
+#include "h5tools.h"
+#include "h5tools_utils.h"
+
+/* number of members in an array */
+#ifndef NELMTS
+# define NELMTS(X) (sizeof(X)/sizeof(X[0]))
+#endif
+
+static int verify_layout(hid_t pid, pack_info_t *obj);
+static int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *filter);
+
+
+/*-------------------------------------------------------------------------
+ * Function: h5repack_verify
+ *
+ * Purpose: verify if filters and layout in the input file match the output file
+ *
+ * Return:
+ * 1 match
+ * 0 do not match
+ * -1 error
+ *
+ * Programmer: Pedro Vicente, pvn@hdfgroup.org
+ *
+ * Date: December 19, 2003
+ * Modified: December, 19, 2007 (exactly 4 years later :-) )
+ * Separate into 3 cases
+ * 1) no filter input, get all datasets and compare DCPLs. TO DO
+ * 2) filter input on selected datasets, get each one trough OBJ and match
+ * 3) filter input on all datasets, get all objects and match
+ *
+ *-------------------------------------------------------------------------
+ */
+
+int
+h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options)
+{
+ int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
+ hid_t fidin = -1; /* file ID for input file*/
+ hid_t fidout = -1; /* file ID for output file*/
+ hid_t did = -1; /* dataset ID */
+ hid_t pid = -1; /* dataset creation property list ID */
+ hid_t sid = -1; /* space ID */
+ hid_t tid = -1; /* type ID */
+ unsigned int i;
+ trav_table_t *travt = NULL;
+ int ok = 1;
+ hid_t fcpl_in = -1; /* file creation property for input file */
+ hid_t fcpl_out = -1; /* file creation property for output file */
+ H5F_file_space_type_t in_strat, out_strat; /* file space handling strategy for in/output file */
+ hsize_t in_thresh, out_thresh; /* free space section threshold for in/output file */
+
+ /* open the output file */
+ if((fidout = H5Fopen(out_fname, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0 )
+ return -1;
+
+ for(i = 0; i < options->op_tbl->nelems; i++)
+ {
+ char* name = options->op_tbl->objs[i].path;
+ pack_info_t *obj = &options->op_tbl->objs[i];
+
+ /*-------------------------------------------------------------------------
+ * open
+ *-------------------------------------------------------------------------
+ */
+ if((did = H5Dopen2(fidout, name, H5P_DEFAULT)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed");
+ if((sid = H5Dget_space(did)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed");
+ if((pid = H5Dget_create_plist(did)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_create_plist failed");
+ if((tid = H5Dget_type(did)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_type failed");
+
+ /*-------------------------------------------------------------------------
+ * filter check
+ *-------------------------------------------------------------------------
+ */
+ if(verify_filters(pid, tid, obj->nfilters, obj->filter) <= 0)
+ ok = 0;
+
+
+ /*-------------------------------------------------------------------------
+ * layout check
+ *-------------------------------------------------------------------------
+ */
+ if((obj->layout != -1) && (verify_layout(pid, obj) == 0))
+ ok = 0;
+
+ /*-------------------------------------------------------------------------
+ * close
+ *-------------------------------------------------------------------------
+ */
+ if(H5Pclose(pid) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ if (H5Sclose(sid) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose failed");
+ if (H5Dclose(did) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed");
+ if (H5Tclose(tid) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed");
+
+ }
+
+
+ /*-------------------------------------------------------------------------
+ * check for the "all" objects option
+ *-------------------------------------------------------------------------
+ */
+
+ if(options->all_filter == 1 || options->all_layout == 1)
+ {
+
+ /* init table */
+ trav_table_init(&travt);
+
+ /* get the list of objects in the file */
+ if(h5trav_gettable(fidout, travt) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "h5trav_gettable failed");
+
+ for(i = 0; i < travt->nobjs; i++)
+ {
+ char *name = travt->objs[i].name;
+
+ if(travt->objs[i].type == H5TRAV_TYPE_DATASET)
+ {
+
+ /*-------------------------------------------------------------------------
+ * open
+ *-------------------------------------------------------------------------
+ */
+ if((did = H5Dopen2(fidout, name, H5P_DEFAULT)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed");
+ if((sid = H5Dget_space(did)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed");
+ if((pid = H5Dget_create_plist(did)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_create_plist failed");
+ if((tid = H5Dget_type(did)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_type failed");
+
+ /*-------------------------------------------------------------------------
+ * filter check
+ *-------------------------------------------------------------------------
+ */
+ if(options->all_filter == 1)
+ {
+ if(verify_filters(pid, tid, options->n_filter_g, options->filter_g) <= 0)
+ ok = 0;
+ }
+
+ /*-------------------------------------------------------------------------
+ * layout check
+ *-------------------------------------------------------------------------
+ */
+ if(options->all_layout == 1)
+ {
+ pack_info_t pack;
+
+ init_packobject(&pack);
+ pack.layout = options->layout_g;
+ pack.chunk = options->chunk_g;
+ if(verify_layout(pid, &pack) == 0)
+ ok = 0;
+ }
+
+
+ /*-------------------------------------------------------------------------
+ * close
+ *-------------------------------------------------------------------------
+ */
+ if (H5Pclose(pid) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ if (H5Sclose(sid) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose failed");
+ if (H5Dclose(did) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed");
+ if (H5Tclose(tid) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed");
+ } /* if */
+
+ } /* i */
+
+ /* free table */
+ trav_table_free(travt);
+ }
+
+ /*-------------------------------------------------------------------------
+ * Verify that file space strategy and free space threshold
+ * are set as expected
+ *-------------------------------------------------------------------------
+ */
+
+ /* open the input file */
+ if((fidin = H5Fopen(in_fname, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0 )
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fopen failed");
+
+ /* Get file creation property list for input file */
+ if((fcpl_in = H5Fget_create_plist(fidin)) < 0) {
+ error_msg("failed to retrieve file creation property list\n");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fget_create_plist failed");
+ }
+
+ /* Get file space management info for input file */
+ if(H5Pget_file_space(fcpl_in, &in_strat, &in_thresh) < 0) {
+ error_msg("failed to retrieve file space strategy & threshold\n");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_file_space failed");
+ }
+
+ /* Output file is already opened */
+ /* Get file creation property list for output file */
+ if((fcpl_out = H5Fget_create_plist(fidout)) < 0) {
+ error_msg("failed to retrieve file creation property list\n");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fget_create_plist failed");
+ }
+
+ /* Get file space management info for output file */
+ if(H5Pget_file_space(fcpl_out, &out_strat, &out_thresh) < 0) {
+ error_msg("failed to retrieve file space strategy & threshold\n");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_file_space failed");
+ }
+
+ /*
+ * If the strategy option is not set,
+ * file space handling strategy should be the same for both
+ * input & output files.
+ * If the strategy option is set,
+ * the output file's file space handling strategy should be the same
+ * as what is set via the strategy option
+ */
+ if(!options->fs_strategy && out_strat != in_strat) {
+ error_msg("file space strategy not set as unexpected\n");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "file space strategy not set as unexpected");
+
+ }
+ else if(options->fs_strategy && out_strat!= options->fs_strategy) {
+ error_msg("file space strategy not set as unexpected\n");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "file space strategy not set as unexpected");
+ }
+
+ /*
+ * If the threshold option is not set,
+ * the free space section threshold should be the same for both
+ * input & output files.
+ * If the threshold option is set,
+ * the output file's free space section threshold should be the same
+ * as what is set via the threshold option.
+ */
+ if(!options->fs_threshold && out_thresh != in_thresh) {
+ error_msg("free space threshold not set as unexpected\n");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "free space threshold not set as unexpected");
+ }
+ else if(options->fs_threshold && out_thresh != options->fs_threshold) {
+ error_msg("free space threshold not set as unexpected\n");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "free space threshold not set as unexpected");
+ }
+
+ /* Closing */
+ if (H5Pclose(fcpl_in) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ if (H5Pclose(fcpl_out) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ if (H5Fclose(fidin) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fclose failed");
+ if (H5Fclose(fidout) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fclose failed");
+
+ return ok;
+
+done:
+ H5E_BEGIN_TRY {
+ H5Pclose(fcpl_in);
+ H5Pclose(fcpl_out);
+ H5Pclose(pid);
+ H5Sclose(sid);
+ H5Dclose(did);
+ H5Fclose(fidin);
+ H5Fclose(fidout);
+ if (travt)
+ trav_table_free(travt);
+ } H5E_END_TRY;
+
+ return ret_value;
+} /* h5repack_verify() */
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: verify_layout
+ *
+ * Purpose: verify which layout is present in the property list DCPL_ID
+ *
+ * H5D_COMPACT = 0
+ * H5D_CONTIGUOUS = 1
+ * H5D_CHUNKED = 2
+ *
+ * Return: 1 has, 0 does not, -1 error
+ *
+ * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ *
+ * Date: December 30, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+int verify_layout(hid_t pid,
+ pack_info_t *obj)
+{
+ hsize_t chsize[64]; /* chunk size in elements */
+ H5D_layout_t layout; /* layout */
+ int nfilters; /* number of filters */
+ int rank; /* rank */
+ int i; /* index */
+
+ /* check if we have filters in the input object */
+ if ((nfilters = H5Pget_nfilters(pid)) < 0)
+ return -1;
+
+ /* a non chunked layout was requested on a filtered object */
+ if (nfilters && obj->layout!=H5D_CHUNKED)
+ return 0;
+
+ /* get layout */
+ if ((layout = H5Pget_layout(pid)) < 0)
+ return -1;
+
+ if (obj->layout != layout)
+ return 0;
+
+ if (layout==H5D_CHUNKED)
+ {
+ if ((rank = H5Pget_chunk(pid,NELMTS(chsize),chsize/*out*/)) < 0)
+ return -1;
+ if (obj->chunk.rank != rank)
+ return 0;
+ for ( i=0; i<rank; i++)
+ if (chsize[i] != obj->chunk.chunk_lengths[i])
+ return 0;
+ }
+
+ return 1;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: h5repack_cmp_pl
+ *
+ * Purpose: compare 2 files for identical property lists of all objects
+ *
+ * Return: 1=identical, 0=not identical, -1=error
+ *
+ * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ *
+ * Date: December 31, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+int h5repack_cmp_pl(const char *fname1,
+ const char *fname2)
+{
+ int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
+ hid_t fid1=-1; /* file ID */
+ hid_t fid2=-1; /* file ID */
+ hid_t dset1=-1; /* dataset ID */
+ hid_t dset2=-1; /* dataset ID */
+ hid_t gid=-1; /* group ID */
+ hid_t dcpl1=-1; /* dataset creation property list ID */
+ hid_t dcpl2=-1; /* dataset creation property list ID */
+ hid_t gcplid=-1; /* group creation property list */
+ unsigned crt_order_flag1; /* group creation order flag */
+ unsigned crt_order_flag2; /* group creation order flag */
+ trav_table_t *trav=NULL;
+ int ret=1;
+ unsigned int i;
+
+ /*-------------------------------------------------------------------------
+ * open the files
+ *-------------------------------------------------------------------------
+ */
+
+ /* disable error reporting */
+ H5E_BEGIN_TRY
+ {
+
+ /* Open the files */
+ if ((fid1 = H5Fopen(fname1,H5F_ACC_RDONLY,H5P_DEFAULT)) < 0 )
+ {
+ error_msg("<%s>: %s\n", fname1, H5FOPENERROR );
+ return -1;
+ }
+ if ((fid2 = H5Fopen(fname2,H5F_ACC_RDONLY,H5P_DEFAULT)) < 0 )
+ {
+ error_msg("<%s>: %s\n", fname2, H5FOPENERROR );
+ H5Fclose(fid1);
+ return -1;
+ }
+ /* enable error reporting */
+ } H5E_END_TRY;
+
+ /*-------------------------------------------------------------------------
+ * get file table list of objects
+ *-------------------------------------------------------------------------
+ */
+ trav_table_init(&trav);
+ if(h5trav_gettable(fid1, trav) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "h5trav_gettable failed");
+
+ /*-------------------------------------------------------------------------
+ * traverse the suppplied object list
+ *-------------------------------------------------------------------------
+ */
+ for(i = 0; i < trav->nobjs; i++)
+ {
+
+ if(trav->objs[i].type == H5TRAV_TYPE_GROUP)
+ {
+
+ if ((gid = H5Gopen2(fid1, trav->objs[i].name, H5P_DEFAULT)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gopen2 failed");
+ if ((gcplid = H5Gget_create_plist(gid)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gget_create_plist failed");
+ if (H5Pget_link_creation_order(gcplid, &crt_order_flag1) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_link_creation_order failed");
+ if (H5Pclose(gcplid) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ if (H5Gclose(gid) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gclose failed");
+
+ if ((gid = H5Gopen2(fid2, trav->objs[i].name, H5P_DEFAULT)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gopen2 failed");
+ if ((gcplid = H5Gget_create_plist(gid)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gget_create_plist failed");
+ if (H5Pget_link_creation_order(gcplid, &crt_order_flag2) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_link_creation_order failed");
+ if (H5Pclose(gcplid) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ if (H5Gclose(gid) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gclose failed");
+
+ if (crt_order_flag1 != crt_order_flag2) {
+ error_msg("property lists for <%s> are different\n",trav->objs[i].name);
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "property lists failed");
+ }
+
+ }
+
+
+
+ else if(trav->objs[i].type == H5TRAV_TYPE_DATASET)
+ {
+ if((dset1 = H5Dopen2(fid1, trav->objs[i].name, H5P_DEFAULT)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed");
+ if((dset2 = H5Dopen2(fid2, trav->objs[i].name, H5P_DEFAULT)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed");
+ if((dcpl1 = H5Dget_create_plist(dset1)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_create_plist failed");
+ if((dcpl2 = H5Dget_create_plist(dset2)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_create_plist failed");
+
+ /*-------------------------------------------------------------------------
+ * compare the property lists
+ *-------------------------------------------------------------------------
+ */
+ if((ret = H5Pequal(dcpl1, dcpl2)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pequal failed");
+
+ if(ret == 0) {
+ error_msg("property lists for <%s> are different\n",trav->objs[i].name);
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "property lists failed");
+ }
+
+ /*-------------------------------------------------------------------------
+ * close
+ *-------------------------------------------------------------------------
+ */
+ if(H5Pclose(dcpl1) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ if(H5Pclose(dcpl2) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ if(H5Dclose(dset1) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed");
+ if(H5Dclose(dset2) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed");
+ } /*if*/
+ } /*i*/
+
+ /*-------------------------------------------------------------------------
+ * free
+ *-------------------------------------------------------------------------
+ */
+
+ trav_table_free(trav);
+
+ /*-------------------------------------------------------------------------
+ * close
+ *-------------------------------------------------------------------------
+ */
+
+ H5Fclose(fid1);
+ H5Fclose(fid2);
+
+ return ret;
+
+/*-------------------------------------------------------------------------
+* error
+*-------------------------------------------------------------------------
+*/
+done:
+ H5E_BEGIN_TRY
+ {
+ H5Pclose(dcpl1);
+ H5Pclose(dcpl2);
+ H5Dclose(dset1);
+ H5Dclose(dset2);
+ H5Fclose(fid1);
+ H5Fclose(fid2);
+ H5Pclose(gcplid);
+ H5Gclose(gid);
+ trav_table_free(trav);
+ } H5E_END_TRY;
+
+ return ret_value;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: verify_filters
+ *
+ * Purpose: verify if all requested filters in the array FILTER obtained
+ * from user input are present in the property list PID obtained from
+ * the output file
+ *
+ * Return:
+ * 1 match
+ * 0 do not match
+ * -1 error
+ *
+ * Programmer: Pedro Vicente, pvn@hdfgroup.org
+ *
+ * Date: December 21, 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static
+int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *filter)
+{
+ int nfilters_dcpl; /* number of filters in DCPL*/
+ unsigned filt_flags; /* filter flags */
+ H5Z_filter_t filtn; /* filter identification number */
+ unsigned cd_values[20]; /* filter client data values */
+ size_t cd_nelmts; /* filter client number of values */
+ char f_name[256]; /* filter name */
+ size_t size; /* type size */
+ int i; /* index */
+ unsigned j; /* index */
+
+ /* get information about filters */
+ if((nfilters_dcpl = H5Pget_nfilters(pid)) < 0)
+ return -1;
+
+ /* if we do not have filters and the requested filter is NONE, return 1 */
+ if(!nfilters_dcpl &&
+ nfilters == 1 &&
+ filter[0].filtn == H5Z_FILTER_NONE )
+ return 1;
+
+ /* else the numbers of filters must match */
+ if (nfilters_dcpl != nfilters )
+ return 0;
+
+ /*-------------------------------------------------------------------------
+ * build a list with DCPL filters
+ *-------------------------------------------------------------------------
+ */
+
+ for( i = 0; i < nfilters_dcpl; i++)
+ {
+ cd_nelmts = NELMTS(cd_values);
+ filtn = H5Pget_filter2(pid, (unsigned)i, &filt_flags, &cd_nelmts,
+ cd_values, sizeof(f_name), f_name, NULL);
+
+ /* filter ID */
+ if (filtn != filter[i].filtn)
+ return 0;
+
+ /* compare client data values. some filters do return local values */
+ switch (filtn)
+ {
+
+ case H5Z_FILTER_NONE:
+ break;
+
+ case H5Z_FILTER_SHUFFLE:
+ /* 1 private client value is returned by DCPL */
+ if ( cd_nelmts != H5Z_SHUFFLE_TOTAL_NPARMS && filter[i].cd_nelmts != H5Z_SHUFFLE_USER_NPARMS )
+ return 0;
+
+ /* get dataset's type size */
+ if((size = H5Tget_size(tid)) <= 0)
+ return -1;
+
+ /* the private client value holds the dataset's type size */
+ if ( size != cd_values[0] )
+ return 0;
+
+ break;
+
+ case H5Z_FILTER_SZIP:
+ /* 4 private client values are returned by DCPL */
+ if ( cd_nelmts != H5Z_SZIP_TOTAL_NPARMS && filter[i].cd_nelmts != H5Z_SZIP_USER_NPARMS )
+ return 0;
+
+ /* "User" parameter for pixels-per-block (index 1) */
+ if ( cd_values[H5Z_SZIP_PARM_PPB] != filter[i].cd_values[H5Z_SZIP_PARM_PPB] )
+ return 0;
+
+ break;
+
+ case H5Z_FILTER_NBIT:
+ /* only client data values number of values checked */
+ if ( H5Z_NBIT_USER_NPARMS != filter[i].cd_nelmts)
+ return 0;
+ break;
+
+ case H5Z_FILTER_SCALEOFFSET:
+ /* only client data values checked */
+ for( j = 0; j < H5Z_SCALEOFFSET_USER_NPARMS; j++)
+ if (cd_values[j] != filter[i].cd_values[j])
+ return 0;
+ break;
+
+ /* for these filters values must match, no local values set in DCPL */
+ case H5Z_FILTER_FLETCHER32:
+ case H5Z_FILTER_DEFLATE:
+
+ if ( cd_nelmts != filter[i].cd_nelmts)
+ return 0;
+
+ for( j = 0; j < cd_nelmts; j++)
+ if (cd_values[j] != filter[i].cd_values[j])
+ return 0;
+
+ break;
+
+ default:
+ if ( cd_nelmts != filter[i].cd_nelmts)
+ return 0;
+
+ for( j = 0; j < cd_nelmts; j++)
+ if (cd_values[j] != filter[i].cd_values[j])
+ return 0;
+ break;
+
+ } /* switch */
+ }
+
+ return 1;
+}
+
diff --git a/tools/src/h5stat/CMakeLists.txt b/tools/src/h5stat/CMakeLists.txt
new file mode 100644
index 0000000..d4e14cb
--- /dev/null
+++ b/tools/src/h5stat/CMakeLists.txt
@@ -0,0 +1,39 @@
+cmake_minimum_required (VERSION 3.1.0)
+PROJECT (HDF5_TOOLS_SRC_H5STAT)
+
+#-----------------------------------------------------------------------------
+# Setup include Directories
+#-----------------------------------------------------------------------------
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib)
+
+# --------------------------------------------------------------------
+# Add the h5stat executables
+# --------------------------------------------------------------------
+add_executable (h5stat ${HDF5_TOOLS_SRC_H5STAT_SOURCE_DIR}/h5stat.c)
+TARGET_NAMING (h5stat STATIC)
+TARGET_C_PROPERTIES (h5stat STATIC " " " ")
+target_link_libraries (h5stat ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+set_target_properties (h5stat PROPERTIES FOLDER tools)
+set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5stat")
+
+set (H5_DEP_EXECUTABLES h5stat)
+
+##############################################################################
+##############################################################################
+### I N S T A L L A T I O N ###
+##############################################################################
+##############################################################################
+
+#-----------------------------------------------------------------------------
+# Rules for Installation of tools using make Install target
+#-----------------------------------------------------------------------------
+
+#INSTALL_PROGRAM_PDB (h5stat ${HDF5_INSTALL_BIN_DIR} toolsapplications)
+
+install (
+ TARGETS
+ h5stat
+ EXPORT
+ ${HDF5_EXPORTED_TARGETS}
+ RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications
+)
diff --git a/tools/src/h5stat/Makefile.am b/tools/src/h5stat/Makefile.am
new file mode 100644
index 0000000..b4d81de
--- /dev/null
+++ b/tools/src/h5stat/Makefile.am
@@ -0,0 +1,39 @@
+#
+# 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.
+##
+## Makefile.am
+## Run automake to generate a Makefile.in from this file.
+#
+# HDF5 Library Makefile(.in)
+#
+
+include $(top_srcdir)/config/commence.am
+
+# Include src directory
+AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib
+
+# These are our main targets, the tools
+bin_PROGRAMS=h5stat
+bin_SCRIPTS=
+
+# Add h5stat specific linker flags here
+h5stat_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+
+# Tell automake to clean h5redeploy script
+CLEANFILES=
+
+# All programs rely on hdf5 library and h5tools library
+LDADD=$(LIBH5TOOLS) $(LIBHDF5)
+
+include $(top_srcdir)/config/conclude.am
diff --git a/tools/src/h5stat/h5stat.c b/tools/src/h5stat/h5stat.c
new file mode 100644
index 0000000..a331014
--- /dev/null
+++ b/tools/src/h5stat/h5stat.c
@@ -0,0 +1,1815 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include <stdlib.h>
+#include <string.h>
+#include "H5private.h" /* Generic Functions */
+#include "h5tools.h"
+#include "h5tools_utils.h"
+#include "h5tools_ref.h"
+#include "h5trav.h"
+#include "hdf5.h"
+
+/* Name of tool */
+#define PROGRAMNAME "h5stat"
+
+/* Parameters to control statistics gathered */
+
+/* Default threshold for small groups/datasets/attributes */
+#define DEF_SIZE_SMALL_GROUPS 10
+#define DEF_SIZE_SMALL_DSETS 10
+#define DEF_SIZE_SMALL_ATTRS 10
+
+#define SIZE_SMALL_SECTS 10
+
+#define H5_NFILTERS_IMPL 8 /* Number of currently implemented filters + one to
+ accommodate for user-define filters + one
+ to accomodate datasets whithout any filters */
+
+/* File space management strategies: see H5Fpublic.h for declarations */
+const char *FS_STRATEGY_NAME[] = {
+ "unknown",
+ "H5F_FILE_SPACE_ALL_PERSIST",
+ "H5F_FILE_SPACE_ALL",
+ "H5F_FILE_SPACE_AGGR_VFD",
+ "H5F_FILE_SPACE_VFD",
+ NULL
+};
+
+/* Datatype statistics for datasets */
+typedef struct dtype_info_t {
+ hid_t tid; /* ID of datatype */
+ unsigned long count; /* Number of types found */
+ unsigned long named; /* Number of types that are named */
+} dtype_info_t;
+
+typedef struct ohdr_info_t {
+ hsize_t total_size; /* Total size of object headers */
+ hsize_t free_size; /* Total free space in object headers */
+} ohdr_info_t;
+
+/* Info to pass to the iteration functions */
+typedef struct iter_t {
+ hid_t fid; /* File ID */
+ hsize_t filesize; /* Size of the file */
+ unsigned long uniq_groups; /* Number of unique groups */
+ unsigned long uniq_dsets; /* Number of unique datasets */
+ unsigned long uniq_dtypes; /* Number of unique named datatypes */
+ unsigned long uniq_links; /* Number of unique links */
+ unsigned long uniq_others; /* Number of other unique objects */
+
+ unsigned long max_links; /* Maximum # of links to an object */
+ hsize_t max_fanout; /* Maximum fanout from a group */
+ unsigned long *num_small_groups; /* Size of small groups tracked */
+ unsigned group_nbins; /* Number of bins for group counts */
+ unsigned long *group_bins; /* Pointer to array of bins for group counts */
+ ohdr_info_t group_ohdr_info; /* Object header information for groups */
+
+ hsize_t max_attrs; /* Maximum attributes from a group */
+ unsigned long *num_small_attrs; /* Size of small attributes tracked */
+ unsigned attr_nbins; /* Number of bins for attribute counts */
+ unsigned long *attr_bins; /* Pointer to array of bins for attribute counts */
+
+ unsigned max_dset_rank; /* Maximum rank of dataset */
+ unsigned long dset_rank_count[H5S_MAX_RANK]; /* Number of datasets of each rank */
+ hsize_t max_dset_dims; /* Maximum dimension size of dataset */
+ unsigned long *small_dset_dims; /* Size of dimensions of small datasets tracked */
+ unsigned long dset_layouts[H5D_NLAYOUTS]; /* Type of storage for each dataset */
+ unsigned long dset_comptype[H5_NFILTERS_IMPL]; /* Number of currently implemented filters */
+ unsigned long dset_ntypes; /* Number of diff. dataset datatypes found */
+ dtype_info_t *dset_type_info; /* Pointer to dataset datatype information found */
+ unsigned dset_dim_nbins; /* Number of bins for dataset dimensions */
+ unsigned long *dset_dim_bins; /* Pointer to array of bins for dataset dimensions */
+ ohdr_info_t dset_ohdr_info; /* Object header information for datasets */
+ hsize_t dset_storage_size; /* Size of raw data for datasets */
+ hsize_t dset_external_storage_size; /* Size of raw data for datasets with external storage */
+ ohdr_info_t dtype_ohdr_info; /* Object header information for datatypes */
+ hsize_t groups_btree_storage_size; /* btree size for group */
+ hsize_t groups_heap_storage_size; /* heap size for group */
+ hsize_t attrs_btree_storage_size; /* btree size for attributes (1.8) */
+ 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 */
+ 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 */
+ 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 */
+ int local; /* Flag to indicate iteration over the object*/
+} 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_dset_dtype_meta = FALSE; /* display datasets' datatype information */
+static int display_attr = FALSE; /* display attributes information */
+static int display_free_sections = FALSE; /* display free space information */
+static int display_summary = FALSE; /* display summary of file space information */
+
+static int display_file_metadata = FALSE; /* display file space info for file's metadata */
+static int display_group_metadata = FALSE; /* display file space info for groups' metadata */
+static int display_dset_metadata = FALSE; /* display file space info for datasets' metadata */
+
+static int display_object = FALSE; /* not implemented yet */
+
+/* Initialize threshold for small groups/datasets/attributes */
+static int sgroups_threshold = DEF_SIZE_SMALL_GROUPS;
+static int sdsets_threshold = DEF_SIZE_SMALL_DSETS;
+static int sattrs_threshold = DEF_SIZE_SMALL_ATTRS;
+
+/* a structure for handling the order command-line parameters come in */
+struct handler_t {
+ size_t obj_count;
+ char **obj;
+};
+
+static const char *s_opts ="Aa:Ddm:FfhGgl:sSTO:V";
+/* e.g. "filemetadata" has to precede "file"; "groupmetadata" has to precede "group" etc. */
+static struct long_options l_opts[] = {
+ {"help", no_arg, 'h'},
+ {"hel", no_arg, 'h'},
+ {"he", no_arg, 'h'},
+ {"filemetadata", no_arg, 'F'},
+ {"filemetadat", no_arg, 'F'},
+ {"filemetada", no_arg, 'F'},
+ {"filemetad", no_arg, 'F'},
+ {"filemeta", no_arg, 'F'},
+ {"filemet", no_arg, 'F'},
+ {"fileme", no_arg, 'F'},
+ {"filem", no_arg, 'F'},
+ {"file", no_arg, 'f'},
+ {"fil", no_arg, 'f'},
+ {"fi", no_arg, 'f'},
+ {"groupmetadata", no_arg, 'G'},
+ {"groupmetadat", no_arg, 'G'},
+ {"groupmetada", no_arg, 'G'},
+ {"groupmetad", no_arg, 'G'},
+ {"groupmeta", no_arg, 'G'},
+ {"groupmet", no_arg, 'G'},
+ {"groupme", no_arg, 'G'},
+ {"groupm", no_arg, 'G'},
+ {"group", no_arg, 'g'},
+ {"grou", no_arg, 'g'},
+ {"gro", no_arg, 'g'},
+ {"gr", no_arg, 'g'},
+ { "links", require_arg, 'l' },
+ { "link", require_arg, 'l' },
+ { "lin", require_arg, 'l' },
+ { "li", require_arg, 'l' },
+ {"dsetmetadata", no_arg, 'D'},
+ {"dsetmetadat", no_arg, 'D'},
+ {"dsetmetada", no_arg, 'D'},
+ {"dsetmetad", no_arg, 'D'},
+ {"dsetmeta", no_arg, 'D'},
+ {"dsetmet", no_arg, 'D'},
+ {"dsetme", no_arg, 'D'},
+ {"dsetm", no_arg, 'D'},
+ {"dset", no_arg, 'd'},
+ {"dse", no_arg, 'd'},
+ {"ds", no_arg, 'd'},
+ {"dims", require_arg, 'm'},
+ {"dim", require_arg, 'm'},
+ {"di", require_arg, 'm'},
+ {"dtypemetadata", no_arg, 'T'},
+ {"dtypemetadat", no_arg, 'T'},
+ {"dtypemetada", no_arg, 'T'},
+ {"dtypemetad", no_arg, 'T'},
+ {"dtypemeta", no_arg, 'T'},
+ {"dtypemet", no_arg, 'T'},
+ {"dtypeme", no_arg, 'T'},
+ {"dtypem", no_arg, 'T'},
+ {"dtype", no_arg, 'T'},
+ {"dtyp", no_arg, 'T'},
+ {"dty", no_arg, 'T'},
+ {"dt", no_arg, 'T'},
+ { "object", require_arg, 'O' },
+ { "objec", require_arg, 'O' },
+ { "obje", require_arg, 'O' },
+ { "obj", require_arg, 'O' },
+ { "ob", require_arg, 'O' },
+ { "version", no_arg, 'V' },
+ { "versio", no_arg, 'V' },
+ { "versi", no_arg, 'V' },
+ { "vers", no_arg, 'V' },
+ { "ver", no_arg, 'V' },
+ { "ve", no_arg, 'V' },
+ { "attribute", no_arg, 'A' },
+ { "attribut", no_arg, 'A' },
+ { "attribu", no_arg, 'A' },
+ { "attrib", no_arg, 'A' },
+ { "attri", no_arg, 'A' },
+ { "attr", no_arg, 'A' },
+ { "att", no_arg, 'A' },
+ { "at", no_arg, 'A' },
+ { "numattrs", require_arg, 'a' },
+ { "numattr", require_arg, 'a' },
+ { "numatt", require_arg, 'a' },
+ { "numat", require_arg, 'a' },
+ { "numa", require_arg, 'a' },
+ { "num", require_arg, 'a' },
+ { "nu", require_arg, 'a' },
+ { "freespace", no_arg, 's' },
+ { "freespac", no_arg, 's' },
+ { "freespa", no_arg, 's' },
+ { "freesp", no_arg, 's' },
+ { "frees", no_arg, 's' },
+ { "free", no_arg, 's' },
+ { "fre", no_arg, 's' },
+ { "fr", no_arg, 's' },
+ { "summary", no_arg, 'S' },
+ { "summar", no_arg, 'S' },
+ { "summa", no_arg, 'S' },
+ { "summ", no_arg, 'S' },
+ { "sum", no_arg, 'S' },
+ { "su", no_arg, 'S' },
+ { NULL, 0, '\0' }
+};
+
+static void
+leave(int ret)
+{
+ h5tools_close();
+ HDexit(ret);
+}
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: usage
+ *
+ * Purpose: Compute the ceiling of log_10(x)
+ *
+ * Return: >0 on success, 0 on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+static void usage(const char *prog)
+{
+ HDfflush(stdout);
+ HDfprintf(stdout, "Usage: %s [OPTIONS] file\n", prog);
+ HDfprintf(stdout, "\n");
+ HDfprintf(stdout, " OPTIONS\n");
+ HDfprintf(stdout, " -h, --help Print a usage message and exit\n");
+ HDfprintf(stdout, " -V, --version Print version number and exit\n");
+ HDfprintf(stdout, " -f, --file Print file information\n");
+ HDfprintf(stdout, " -F, --filemetadata Print file space information for file's metadata\n");
+ HDfprintf(stdout, " -g, --group Print group information\n");
+ HDfprintf(stdout, " -l N, --links=N Set the threshold for the # of links when printing\n");
+ HDfprintf(stdout, " information for small groups. N is an integer greater\n");
+ HDfprintf(stdout, " than 0. The default threshold is 10.\n");
+ HDfprintf(stdout, " -G, --groupmetadata Print file space information for groups' metadata\n");
+ HDfprintf(stdout, " -d, --dset Print dataset information\n");
+ HDfprintf(stdout, " -m N, --dims=N Set the threshold for the dimension sizes when printing\n");
+ HDfprintf(stdout, " information for small datasets. N is an integer greater\n");
+ HDfprintf(stdout, " than 0. The default threshold is 10.\n");
+ HDfprintf(stdout, " -D, --dsetmetadata Print file space information for datasets' metadata\n");
+ HDfprintf(stdout, " -T, --dtypemetadata Print datasets' datatype information\n");
+ HDfprintf(stdout, " -A, --attribute Print attribute information\n");
+ HDfprintf(stdout, " -a N, --numattrs=N Set the threshold for the # of attributes when printing\n");
+ HDfprintf(stdout, " information for small # of attributes. N is an integer greater\n");
+ HDfprintf(stdout, " than 0. The default threshold is 10.\n");
+ HDfprintf(stdout, " -s, --freespace Print free space information\n");
+ HDfprintf(stdout, " -S, --summary Print summary of file space information\n");
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: ceil_log10
+ *
+ * Purpose: Compute the ceiling of log_10(x)
+ *
+ * Return: >0 on success, 0 on failure
+ *
+ * Programmer: Quincey Koziol
+ * Monday, August 22, 2005
+ *
+ *-------------------------------------------------------------------------
+ */
+H5_ATTR_CONST static unsigned
+ceil_log10(unsigned long x)
+{
+ unsigned long pow10 = 1;
+ unsigned ret = 0;
+
+ while(x >= pow10) {
+ pow10 *= 10;
+ ret++;
+ } /* end while */
+
+ return ret;
+} /* ceil_log10() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: attribute_stats
+ *
+ * Purpose: Gather statistics about attributes on an object
+ *
+ * Return: Success: 0
+ *
+ * Failure: -1
+ *
+ * Programmer: Quincey Koziol
+ * Tuesday, July 17, 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+attribute_stats(iter_t *iter, const H5O_info_t *oi)
+{
+ unsigned bin; /* "bin" the number of objects falls in */
+
+ /* Update dataset & attribute metadata info */
+ iter->attrs_btree_storage_size += oi->meta_size.attr.index_size;
+ iter->attrs_heap_storage_size += oi->meta_size.attr.heap_size;
+
+ /* Update small # of attribute count & limits */
+ if(oi->num_attrs <= (hsize_t)sattrs_threshold)
+ (iter->num_small_attrs[(size_t)oi->num_attrs])++;
+ if(oi->num_attrs > iter->max_attrs)
+ iter->max_attrs = oi->num_attrs;
+
+ /* Add attribute count to proper bin */
+ bin = ceil_log10((unsigned long)oi->num_attrs);
+ if((bin + 1) > iter->attr_nbins) {
+ iter->attr_bins = (unsigned long *)HDrealloc(iter->attr_bins, (bin + 1) * sizeof(unsigned long));
+ HDassert(iter->attr_bins);
+
+ /* Initialize counts for intermediate bins */
+ while(iter->attr_nbins < bin)
+ iter->attr_bins[iter->attr_nbins++] = 0;
+ iter->attr_nbins++;
+
+ /* Initialize count for new bin */
+ iter->attr_bins[bin] = 1;
+ } /* end if */
+ else
+ (iter->attr_bins[bin])++;
+
+ return 0;
+} /* end attribute_stats() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: group_stats
+ *
+ * Purpose: Gather statistics about the group
+ *
+ * Return: Success: 0
+ *
+ * Failure: -1
+ *
+ * Programmer: Quincey Koziol
+ * Tuesday, August 16, 2005
+ *
+ * Modifications: Refactored code from the walk_function
+ * EIP, Wednesday, August 16, 2006
+ *
+ * Vailin Choi 12 July 2007
+ * 1. Gathered storage info for btree and heap
+ * (groups and attributes)
+ * 2. Gathered info for attributes
+ *
+ * Vailin Choi 14 July 2007
+ * Cast "num_objs" and "num_attrs" to size_t
+ * Due to the -Mbounds problem for the pgi-32 bit compiler on indexing
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+group_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
+{
+ H5G_info_t ginfo; /* Group information */
+ unsigned bin; /* "bin" the number of objects falls in */
+ herr_t ret;
+
+ /* Gather statistics about this type of object */
+ iter->uniq_groups++;
+
+ /* Get object header information */
+ iter->group_ohdr_info.total_size += oi->hdr.space.total;
+ iter->group_ohdr_info.free_size += oi->hdr.space.free;
+
+ /* Get group information */
+ ret = H5Gget_info_by_name(iter->fid, name, &ginfo, H5P_DEFAULT);
+ HDassert(ret >= 0);
+
+ /* Update link stats */
+ /* Collect statistics for small groups */
+ if(ginfo.nlinks < (hsize_t)sgroups_threshold)
+ (iter->num_small_groups[(size_t)ginfo.nlinks])++;
+ /* Determine maximum link count */
+ if(ginfo.nlinks > iter->max_fanout)
+ iter->max_fanout = ginfo.nlinks;
+
+ /* Add group count to proper bin */
+ bin = ceil_log10((unsigned long)ginfo.nlinks);
+ if((bin + 1) > iter->group_nbins) {
+ /* Allocate more storage for info about dataset's datatype */
+ iter->group_bins = (unsigned long *)HDrealloc(iter->group_bins, (bin + 1) * sizeof(unsigned long));
+ HDassert(iter->group_bins);
+
+ /* Initialize counts for intermediate bins */
+ while(iter->group_nbins < bin)
+ iter->group_bins[iter->group_nbins++] = 0;
+ iter->group_nbins++;
+
+ /* Initialize count for new bin */
+ iter->group_bins[bin] = 1;
+ } /* end if */
+ else
+ (iter->group_bins[bin])++;
+
+ /* Update group metadata info */
+ iter->groups_btree_storage_size += oi->meta_size.obj.index_size;
+ iter->groups_heap_storage_size += oi->meta_size.obj.heap_size;
+
+ /* Update attribute metadata info */
+ ret = attribute_stats(iter, oi);
+ HDassert(ret >= 0);
+
+ return 0;
+} /* end group_stats() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: dataset_stats
+ *
+ * Purpose: Gather statistics about the dataset
+ *
+ * Return: Success: 0
+ *
+ * Failure: -1
+ *
+ * Programmer: Quincey Koziol
+ * Tuesday, August 16, 2005
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
+{
+ unsigned bin; /* "bin" the number of objects falls in */
+ hid_t did; /* Dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t tid; /* Datatype ID */
+ hid_t dcpl; /* Dataset creation property list ID */
+ hsize_t dims[H5S_MAX_RANK];/* Dimensions of dataset */
+ H5D_layout_t lout; /* Layout of dataset */
+ unsigned type_found; /* Whether the dataset's datatype was */
+ /* already found */
+ int ndims; /* Number of dimensions of dataset */
+ hsize_t storage; /* Size of dataset storage */
+ unsigned u; /* Local index variable */
+ int num_ext; /* Number of external files for a dataset */
+ int nfltr; /* Number of filters for a dataset */
+ H5Z_filter_t fltr; /* Filter identifier */
+ herr_t ret;
+
+ /* Gather statistics about this type of object */
+ iter->uniq_dsets++;
+
+ /* Get object header information */
+ iter->dset_ohdr_info.total_size += oi->hdr.space.total;
+ iter->dset_ohdr_info.free_size += oi->hdr.space.free;
+
+ did = H5Dopen2(iter->fid, name, H5P_DEFAULT);
+ HDassert(did > 0);
+
+ /* Update dataset metadata info */
+ iter->datasets_index_storage_size += oi->meta_size.obj.index_size;
+ iter->datasets_heap_storage_size += oi->meta_size.obj.heap_size;
+
+ /* Update attribute metadata info */
+ ret = attribute_stats(iter, oi);
+ HDassert(ret >= 0);
+
+ /* Get storage info */
+ storage = H5Dget_storage_size(did);
+
+ /* Gather layout statistics */
+ dcpl = H5Dget_create_plist(did);
+ HDassert(dcpl > 0);
+
+ lout = H5Pget_layout(dcpl);
+ HDassert(lout >= 0);
+
+ /* 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;
+
+ /* Track the layout type for dataset */
+ (iter->dset_layouts[lout])++;
+
+ /* Get the number of external files for the dataset */
+ num_ext = H5Pget_external_count(dcpl);
+ assert (num_ext >= 0);
+
+ /* Accumulate raw data size accordingly */
+ if(num_ext) {
+ iter->nexternal += (unsigned long)num_ext;
+ iter->dset_external_storage_size += (unsigned long)storage;
+ } else
+ iter->dset_storage_size += storage;
+
+ /* Gather dataspace statistics */
+ sid = H5Dget_space(did);
+ HDassert(sid > 0);
+
+ ndims = H5Sget_simple_extent_dims(sid, dims, NULL);
+ HDassert(ndims >= 0);
+
+ /* Check for larger rank of dataset */
+ if((unsigned)ndims > iter->max_dset_rank)
+ iter->max_dset_rank = (unsigned)ndims;
+
+ /* Track the number of datasets with each rank */
+ (iter->dset_rank_count[ndims])++;
+
+ /* Only gather dim size statistics on 1-D datasets */
+ if(ndims == 1) {
+ /* Determine maximum dimension size */
+ if(dims[0] > iter->max_dset_dims)
+ iter->max_dset_dims = dims[0];
+ /* Collect statistics for small datasets */
+ if(dims[0] < (hsize_t)sdsets_threshold)
+ (iter->small_dset_dims[(size_t)dims[0]])++;
+
+ /* Add dim count to proper bin */
+ bin = ceil_log10((unsigned long)dims[0]);
+ if((bin + 1) > iter->dset_dim_nbins) {
+ /* Allocate more storage for info about dataset's datatype */
+ iter->dset_dim_bins = (unsigned long *)HDrealloc(iter->dset_dim_bins, (bin + 1) * sizeof(unsigned long));
+ HDassert(iter->dset_dim_bins);
+
+ /* Initialize counts for intermediate bins */
+ while(iter->dset_dim_nbins < bin)
+ iter->dset_dim_bins[iter->dset_dim_nbins++] = 0;
+ iter->dset_dim_nbins++;
+
+ /* Initialize count for this bin */
+ iter->dset_dim_bins[bin] = 1;
+ } /* end if */
+ else
+ (iter->dset_dim_bins[bin])++;
+ } /* end if */
+
+ ret = H5Sclose(sid);
+ HDassert(ret >= 0);
+
+ /* Gather datatype statistics */
+ tid = H5Dget_type(did);
+ HDassert(tid > 0);
+
+ type_found = FALSE;
+ for(u = 0; u < iter->dset_ntypes; u++)
+ if(H5Tequal(iter->dset_type_info[u].tid, tid) > 0) {
+ type_found = TRUE;
+ break;
+ } /* end for */
+ if(type_found)
+ (iter->dset_type_info[u].count)++;
+ else {
+ unsigned curr_ntype = (unsigned)iter->dset_ntypes;
+
+ /* Increment # of datatypes seen for datasets */
+ iter->dset_ntypes++;
+
+ /* Allocate more storage for info about dataset's datatype */
+ iter->dset_type_info = (dtype_info_t *)HDrealloc(iter->dset_type_info, iter->dset_ntypes * sizeof(dtype_info_t));
+ HDassert(iter->dset_type_info);
+
+ /* Initialize information about datatype */
+ iter->dset_type_info[curr_ntype].tid = H5Tcopy(tid);
+ HDassert(iter->dset_type_info[curr_ntype].tid > 0);
+ iter->dset_type_info[curr_ntype].count = 1;
+ iter->dset_type_info[curr_ntype].named = 0;
+
+ /* Set index for later */
+ u = curr_ntype;
+ } /* end else */
+
+ /* Check if the datatype is a named datatype */
+ if(H5Tcommitted(tid) > 0)
+ (iter->dset_type_info[u].named)++;
+
+ ret = H5Tclose(tid);
+ HDassert(ret >= 0);
+
+ /* Track different filters */
+ if((nfltr = H5Pget_nfilters(dcpl)) >= 0) {
+ if(nfltr == 0)
+ iter->dset_comptype[0]++;
+ for(u = 0; u < (unsigned)nfltr; u++) {
+ fltr = H5Pget_filter2(dcpl, u, 0, 0, 0, 0, 0, NULL);
+ if(fltr >= 0) {
+ if(fltr < (H5_NFILTERS_IMPL - 1))
+ iter->dset_comptype[fltr]++;
+ else
+ iter->dset_comptype[H5_NFILTERS_IMPL - 1]++; /*other filters*/
+ } /* end if */
+ } /* end for */
+ } /* endif nfltr */
+
+ ret = H5Pclose(dcpl);
+ HDassert(ret >= 0);
+
+ ret = H5Dclose(did);
+ HDassert(ret >= 0);
+
+ return 0;
+} /* end dataset_stats() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: datatype_stats
+ *
+ * Purpose: Gather statistics about the datatype
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Vailin Choi; July 7th, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+datatype_stats(iter_t *iter, const H5O_info_t *oi)
+{
+ herr_t ret;
+
+ /* Gather statistics about this type of object */
+ iter->uniq_dtypes++;
+
+ /* Get object header information */
+ iter->dtype_ohdr_info.total_size += oi->hdr.space.total;
+ iter->dtype_ohdr_info.free_size += oi->hdr.space.free;
+
+ /* Update attribute metadata info */
+ ret = attribute_stats(iter, oi);
+ HDassert(ret >= 0);
+
+ return 0;
+} /* end datatype_stats() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: obj_stats
+ *
+ * Purpose: Gather statistics about an object
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Quincey Koziol
+ * Tuesday, November 6, 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+obj_stats(const char *path, const H5O_info_t *oi, const char *already_visited,
+ void *_iter)
+{
+ iter_t *iter = (iter_t *)_iter;
+
+ /* If the object has already been seen then just return */
+ if(NULL == already_visited) {
+ /* Gather some general statistics about the object */
+ if(oi->rc > iter->max_links)
+ iter->max_links = oi->rc;
+
+ switch(oi->type) {
+ case H5O_TYPE_GROUP:
+ group_stats(iter, path, oi);
+ break;
+
+ case H5O_TYPE_DATASET:
+ dataset_stats(iter, path, oi);
+ break;
+
+ case H5O_TYPE_NAMED_DATATYPE:
+ datatype_stats(iter, oi);
+ break;
+
+ case H5O_TYPE_UNKNOWN:
+ case H5O_TYPE_NTYPES:
+ default:
+ /* Gather statistics about this type of object */
+ iter->uniq_others++;
+ break;
+ } /* end switch */
+ } /* end if */
+
+ return 0;
+} /* end obj_stats() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: lnk_stats
+ *
+ * Purpose: Gather statistics about a link
+ *
+ * Return: Success: 0
+ *
+ * Failure: -1
+ *
+ * Programmer: Quincey Koziol
+ * Tuesday, November 6, 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+lnk_stats(const char H5_ATTR_UNUSED *path, const H5L_info_t *li, void *_iter)
+{
+ iter_t *iter = (iter_t *)_iter;
+
+ switch(li->type) {
+ case H5L_TYPE_SOFT:
+ case H5L_TYPE_EXTERNAL:
+ /* Gather statistics about links and UD links */
+ iter->uniq_links++;
+ break;
+
+ case H5L_TYPE_HARD:
+ case H5L_TYPE_MAX:
+ case H5L_TYPE_ERROR:
+ default:
+ /* Gather statistics about this type of object */
+ iter->uniq_others++;
+ break;
+ } /* end switch() */
+
+ return 0;
+} /* end lnk_stats() */
+
+/*-------------------------------------------------------------------------
+ * Function: freespace_stats
+ *
+ * Purpose: Gather statistics for free space sections in the file
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Vailin Choi; July 7th, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+freespace_stats(hid_t fid, iter_t *iter)
+{
+ H5F_sect_info_t *sect_info = NULL; /* Free space sections */
+ ssize_t nsects; /* Number of free space sections */
+ size_t u; /* Local index variable */
+
+ /* Query section information */
+ if((nsects = H5Fget_free_sections(fid, H5FD_MEM_DEFAULT, 0, NULL)) < 0)
+ return(FAIL);
+ else if(nsects) {
+ if(NULL == (sect_info = (H5F_sect_info_t *)HDcalloc((size_t)nsects, sizeof(H5F_sect_info_t))))
+ return(FAIL);
+ nsects = H5Fget_free_sections(fid, H5FD_MEM_DEFAULT, (size_t)nsects, sect_info);
+ HDassert(nsects);
+ } /* end else-if */
+
+ for(u = 0; u < (size_t)nsects; u++) {
+ unsigned bin; /* "bin" the number of objects falls in */
+
+ if(sect_info[u].size < SIZE_SMALL_SECTS)
+ (iter->num_small_sects[(size_t)sect_info[u].size])++;
+
+ /* Add section size to proper bin */
+ bin = ceil_log10((unsigned long)sect_info[u].size);
+ if(bin >= iter->sect_nbins) {
+ /* Allocate more storage for section info */
+ iter->sect_bins = (unsigned long *)HDrealloc(iter->sect_bins, (bin + 1) * sizeof(unsigned long));
+ HDassert(iter->sect_bins);
+
+ /* Initialize counts for intermediate bins */
+ while(iter->sect_nbins < bin)
+ iter->sect_bins[iter->sect_nbins++] = 0;
+ iter->sect_nbins++;
+
+ /* Initialize count for this bin */
+ iter->sect_bins[bin] = 1;
+ } /* end if */
+ else
+ (iter->sect_bins[bin])++;
+ } /* end for */
+
+ if(sect_info)
+ HDfree(sect_info);
+
+ return 0;
+} /* end freespace_stats() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: hand_free
+ *
+ * Purpose: Free handler structure
+ *
+ * Return: Success: 0
+ *
+ * Failure: Never fails
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+hand_free(struct handler_t *hand)
+{
+ if(hand) {
+ unsigned u;
+
+ for(u = 0; u < hand->obj_count; u++)
+ if(hand->obj[u]) {
+ HDfree(hand->obj[u]);
+ hand->obj[u] = NULL;
+ } /* end if */
+ hand->obj_count = 0;
+ HDfree(hand->obj);
+ HDfree(hand);
+ } /* end if */
+} /* end hand_free() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: parse_command_line
+ *
+ * Purpose: Parses command line and sets up global variable to control output
+ *
+ * Return: Success: 0
+ *
+ * Failure: -1
+ *
+ * Programmer: Elena Pourmal
+ * Saturday, August 12, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+parse_command_line(int argc, const char *argv[], struct handler_t **hand_ret)
+{
+ int opt;
+ unsigned u;
+ struct handler_t *hand = NULL;
+
+ /* 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);
+ goto done;
+ break;
+
+ case 'V':
+ print_version(h5tools_getprogname());
+ h5tools_setstatus(EXIT_SUCCESS);
+ goto done;
+ break;
+
+ case 'F':
+ display_all = FALSE;
+ display_file_metadata = 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 = TRUE;
+ break;
+
+ case 'l':
+ if(opt_arg) {
+ sgroups_threshold = HDatoi(opt_arg);
+ if(sgroups_threshold < 1) {
+ error_msg("Invalid threshold for small groups\n");
+ goto error;
+ }
+ } else
+ error_msg("Missing threshold for small groups\n");
+
+ break;
+
+ case 'D':
+ display_all = FALSE;
+ display_dset_metadata = TRUE;
+ break;
+
+ case 'd':
+ display_all = FALSE;
+ display_dset = TRUE;
+ break;
+
+ case 'm':
+ if(opt_arg) {
+ sdsets_threshold = HDatoi(opt_arg);
+ if(sdsets_threshold < 1) {
+ error_msg("Invalid threshold for small datasets\n");
+ goto error;
+ }
+ } else
+ error_msg("Missing threshold for small datasets\n");
+
+ break;
+
+ case 'T':
+ display_all = FALSE;
+ display_dset_dtype_meta = TRUE;
+ break;
+
+ case 'A':
+ display_all = FALSE;
+ display_attr = TRUE;
+ break;
+
+ case 'a':
+ if(opt_arg) {
+ sattrs_threshold = HDatoi(opt_arg);
+ if(sattrs_threshold < 1) {
+ error_msg("Invalid threshold for small # of attributes\n");
+ goto error;
+ }
+ } else
+ error_msg("Missing threshold for small # of attributes\n");
+
+ break;
+
+ case 's':
+ display_all = FALSE;
+ display_free_sections = TRUE;
+ break;
+
+ case 'S':
+ display_all = FALSE;
+ display_summary = TRUE;
+ break;
+
+ case 'O':
+ display_all = FALSE;
+ display_object = TRUE;
+
+ /* Allocate space to hold the command line info */
+ if(NULL == (hand = (struct handler_t *)HDcalloc((size_t)1, sizeof(struct handler_t)))) {
+ error_msg("unable to allocate memory for object struct\n");
+ goto error;
+ } /* end if */
+
+ /* Allocate space to hold the object strings */
+ hand->obj_count = (size_t)argc;
+ if(NULL == (hand->obj = (char **)HDcalloc((size_t)argc, sizeof(char *)))) {
+ error_msg("unable to allocate memory for object array\n");
+ goto error;
+ } /* end if */
+
+ /* Store object names */
+ for(u = 0; u < hand->obj_count; u++)
+ if(NULL == (hand->obj[u] = HDstrdup(opt_arg))) {
+ error_msg("unable to allocate memory for object name\n");
+ goto error;
+ } /* end if */
+ break;
+
+ default:
+ usage(h5tools_getprogname());
+ goto error;
+ } /* end switch */
+ } /* end while */
+
+ /* check for file name to be processed */
+ if(argc <= opt_ind) {
+ error_msg("missing file name\n");
+ usage(h5tools_getprogname());
+ goto error;
+ } /* end if */
+
+ /* Set handler structure */
+ *hand_ret = hand;
+
+done:
+ return 0;
+
+error:
+ hand_free(hand);
+ h5tools_setstatus(EXIT_FAILURE);
+
+ return -1;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: iter_free
+ *
+ * Purpose: Free iter structure
+ *
+ * Return: Success: 0
+ *
+ * Failure: Never fails
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+iter_free(iter_t *iter)
+{
+
+ /* Clear array of bins for group counts */
+ if(iter->group_bins) {
+ HDfree(iter->group_bins);
+ iter->group_bins = NULL;
+ } /* end if */
+
+ /* Clear array for tracking small groups */
+ if(iter->num_small_groups) {
+ HDfree(iter->num_small_groups);
+ iter->num_small_groups = NULL;
+ } /* end if */
+
+ /* Clear array of bins for attribute counts */
+ if(iter->attr_bins) {
+ HDfree(iter->attr_bins);
+ iter->attr_bins = NULL;
+ } /* end if */
+
+ /* Clear array for tracking small attributes */
+ if(iter->num_small_attrs) {
+ HDfree(iter->num_small_attrs);
+ iter->num_small_attrs= NULL;
+ } /* end if */
+
+ /* Clear dataset datatype information found */
+ if(iter->dset_type_info) {
+ HDfree(iter->dset_type_info);
+ iter->dset_type_info = NULL;
+ } /* end if */
+
+ /* Clear array of bins for dataset dimensions */
+ if(iter->dset_dim_bins) {
+ HDfree(iter->dset_dim_bins);
+ iter->dset_dim_bins = NULL;
+ } /* end if */
+
+ /* Clear array of tracking 1-D small datasets */
+ if(iter->small_dset_dims) {
+ HDfree(iter->small_dset_dims);
+ iter->small_dset_dims = NULL;
+ } /* end if */
+
+ /* Clear array of bins for free-space section sizes */
+ if(iter->sect_bins) {
+ HDfree(iter->sect_bins);
+ iter->sect_bins = NULL;
+ } /* end if */
+} /* end iter_free() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: print_file_info
+ *
+ * Purpose: Prints information about file
+ *
+ * Return: Success: 0
+ *
+ * Failure: Never fails
+ *
+ * Programmer: Elena Pourmal
+ * Saturday, August 12, 2006
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+print_file_info(const iter_t *iter)
+{
+ printf("File information\n");
+ printf("\t# of unique groups: %lu\n", iter->uniq_groups);
+ printf("\t# of unique datasets: %lu\n", iter->uniq_dsets);
+ printf("\t# of unique named datatypes: %lu\n", iter->uniq_dtypes);
+ printf("\t# of unique links: %lu\n", iter->uniq_links);
+ printf("\t# of unique other: %lu\n", iter->uniq_others);
+ printf("\tMax. # of links to object: %lu\n", iter->max_links);
+ HDfprintf(stdout, "\tMax. # of objects in group: %Hu\n", iter->max_fanout);
+
+ return 0;
+} /* print_file_info() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: print_file_metadata
+ *
+ * Purpose: Prints file space information for file's metadata
+ *
+ * Return: Success: 0
+ *
+ * Failure: Never fails
+ *
+ * Programmer: Elena Pourmal
+ * Saturday, August 12, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+print_file_metadata(const iter_t *iter)
+{
+ HDfprintf(stdout, "File space information for file metadata (in bytes):\n");
+ HDfprintf(stdout, "\tSuperblock: %Hu\n", iter->super_size);
+ HDfprintf(stdout, "\tSuperblock extension: %Hu\n", iter->super_ext_size);
+ HDfprintf(stdout, "\tUser block: %Hu\n", iter->ublk_size);
+
+ HDfprintf(stdout, "\tObject headers: (total/unused)\n");
+ HDfprintf(stdout, "\t\tGroups: %Hu/%Hu\n",
+ iter->group_ohdr_info.total_size,
+ iter->group_ohdr_info.free_size);
+ HDfprintf(stdout, "\t\tDatasets(exclude compact data): %Hu/%Hu\n",
+ iter->dset_ohdr_info.total_size,
+ iter->dset_ohdr_info.free_size);
+ HDfprintf(stdout, "\t\tDatatypes: %Hu/%Hu\n",
+ iter->dtype_ohdr_info.total_size,
+ iter->dtype_ohdr_info.free_size);
+
+ HDfprintf(stdout, "\tGroups:\n");
+ HDfprintf(stdout, "\t\tB-tree/List: %Hu\n", iter->groups_btree_storage_size);
+ HDfprintf(stdout, "\t\tHeap: %Hu\n", iter->groups_heap_storage_size);
+
+ HDfprintf(stdout, "\tAttributes:\n");
+ HDfprintf(stdout, "\t\tB-tree/List: %Hu\n", iter->attrs_btree_storage_size);
+ HDfprintf(stdout, "\t\tHeap: %Hu\n", iter->attrs_heap_storage_size);
+
+ HDfprintf(stdout, "\tChunked datasets:\n");
+ HDfprintf(stdout, "\t\tIndex: %Hu\n", iter->datasets_index_storage_size);
+
+ HDfprintf(stdout, "\tDatasets:\n");
+ HDfprintf(stdout, "\t\tHeap: %Hu\n", iter->datasets_heap_storage_size);
+
+ HDfprintf(stdout, "\tShared Messages:\n");
+ HDfprintf(stdout, "\t\tHeader: %Hu\n", iter->SM_hdr_storage_size);
+ HDfprintf(stdout, "\t\tB-tree/List: %Hu\n", iter->SM_index_storage_size);
+ HDfprintf(stdout, "\t\tHeap: %Hu\n", iter->SM_heap_storage_size);
+
+ HDfprintf(stdout, "\tFree-space managers:\n");
+ HDfprintf(stdout, "\t\tHeader: %Hu\n", iter->free_hdr);
+ HDfprintf(stdout, "\t\tAmount of free space: %Hu\n", iter->free_space);
+
+ return 0;
+} /* print_file_metadata() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: print_group_info
+ *
+ * Purpose: Prints information about groups in the file
+ *
+ * Return: Success: 0
+ *
+ * Failure: Never fails
+ *
+ * Programmer: Elena Pourmal
+ * Saturday, August 12, 2006
+ *
+ * Modifications:
+ * bug #1253; Oct 6th 2008; Vailin Choi
+ * Fixed segmentation fault: print iter->group_bins[0] when
+ * there is iter->group_nbins
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+print_group_info(const iter_t *iter)
+{
+ unsigned long power; /* Temporary "power" for bins */
+ unsigned long total; /* Total count for various statistics */
+ unsigned u; /* Local index variable */
+
+ printf("Small groups (with 0 to %u links):\n", sgroups_threshold-1);
+ total = 0;
+ for(u = 0; u < (unsigned)sgroups_threshold; u++) {
+ if(iter->num_small_groups[u] > 0) {
+ printf("\t# of groups with %u link(s): %lu\n", u, iter->num_small_groups[u]);
+ total += iter->num_small_groups[u];
+ } /* end if */
+ } /* end for */
+ printf("\tTotal # of small groups: %lu\n", total);
+
+ printf("Group bins:\n");
+ total = 0;
+ if((iter->group_nbins > 0) && (iter->group_bins[0] > 0)) {
+ printf("\t# of groups with 0 link: %lu\n", iter->group_bins[0]);
+ total = iter->group_bins[0];
+ } /* end if */
+ power = 1;
+ for(u = 1; u < iter->group_nbins; u++) {
+ if(iter->group_bins[u] > 0) {
+ printf("\t# of groups with %lu - %lu links: %lu\n", power, (power * 10) - 1,
+ iter->group_bins[u]);
+ total += iter->group_bins[u];
+ } /* end if */
+ power *= 10;
+ } /* end for */
+ printf("\tTotal # of groups: %lu\n", total);
+
+ return 0;
+} /* print_group_info() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: print_group_metadata
+ *
+ * Purpose: Prints file space information for groups' metadata
+ *
+ * Return: Success: 0
+ *
+ * Failure: Never fails
+ *
+ * Programmer: Vailin Choi; October 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+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);
+
+ HDfprintf(stdout, "\tB-tree/List: %Hu\n", iter->groups_btree_storage_size);
+ HDfprintf(stdout, "\tHeap: %Hu\n", iter->groups_heap_storage_size);
+
+ return 0;
+} /* print_group_metadata() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: print_dataset_info
+ *
+ * Purpose: Prints information about datasets in the file
+ *
+ * Return: Success: 0
+ *
+ * Failure: Never fails
+ *
+ * Programmer: Elena Pourmal
+ * Saturday, August 12, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+print_dataset_info(const iter_t *iter)
+{
+ unsigned long power; /* Temporary "power" for bins */
+ unsigned long total; /* Total count for various statistics */
+ unsigned u; /* Local index variable */
+
+ if(iter->uniq_dsets > 0) {
+ printf("Dataset dimension information:\n");
+ printf("\tMax. rank of datasets: %u\n", iter->max_dset_rank);
+ printf("\tDataset ranks:\n");
+ for(u = 0; u < H5S_MAX_RANK; u++)
+ if(iter->dset_rank_count[u] > 0)
+ printf("\t\t# of dataset with rank %u: %lu\n", u, iter->dset_rank_count[u]);
+
+ printf("1-D Dataset information:\n");
+ HDfprintf(stdout, "\tMax. dimension size of 1-D datasets: %Hu\n", iter->max_dset_dims);
+ printf("\tSmall 1-D datasets (with dimension sizes 0 to %u):\n", sdsets_threshold - 1);
+ total = 0;
+ for(u = 0; u < (unsigned)sdsets_threshold; u++) {
+ if(iter->small_dset_dims[u] > 0) {
+ printf("\t\t# of datasets with dimension sizes %u: %lu\n", u,
+ iter->small_dset_dims[u]);
+ total += iter->small_dset_dims[u];
+ } /* end if */
+ } /* end for */
+ printf("\t\tTotal # of small datasets: %lu\n", total);
+
+ /* Protect against no datasets in file */
+ if(iter->dset_dim_nbins > 0) {
+ printf("\t1-D Dataset dimension bins:\n");
+ total = 0;
+ if(iter->dset_dim_bins[0] > 0) {
+ printf("\t\t# of datasets with dimension size 0: %lu\n", iter->dset_dim_bins[0]);
+ total = iter->dset_dim_bins[0];
+ } /* end if */
+ power = 1;
+ for(u = 1; u < iter->dset_dim_nbins; u++) {
+ if(iter->dset_dim_bins[u] > 0) {
+ printf("\t\t# of datasets with dimension size %lu - %lu: %lu\n", power, (power * 10) - 1,
+ iter->dset_dim_bins[u]);
+ total += iter->dset_dim_bins[u];
+ } /* end if */
+ power *= 10;
+ } /* end for */
+ printf("\t\tTotal # of datasets: %lu\n", total);
+ } /* end if */
+
+ printf("Dataset storage information:\n");
+ HDfprintf(stdout, "\tTotal raw data size: %Hu\n", iter->dset_storage_size);
+ HDfprintf(stdout, "\tTotal external raw data size: %Hu\n", iter->dset_external_storage_size);
+
+ printf("Dataset layout information:\n");
+ for(u = 0; u < H5D_NLAYOUTS; u++)
+ printf("\tDataset layout counts[%s]: %lu\n", (u == H5D_COMPACT ? "COMPACT" :
+ (u == H5D_CONTIGUOUS ? "CONTIG" : (u == H5D_CHUNKED ? "CHUNKED" : "VIRTUAL"))), iter->dset_layouts[u]);
+ printf("\tNumber of external files : %lu\n", iter->nexternal);
+
+ printf("Dataset filters information:\n");
+ printf("\tNumber of datasets with:\n");
+ printf("\t\tNO filter: %lu\n", iter->dset_comptype[H5Z_FILTER_ERROR+1]);
+ printf("\t\tGZIP filter: %lu\n", iter->dset_comptype[H5Z_FILTER_DEFLATE]);
+ printf("\t\tSHUFFLE filter: %lu\n", iter->dset_comptype[H5Z_FILTER_SHUFFLE]);
+ printf("\t\tFLETCHER32 filter: %lu\n", iter->dset_comptype[H5Z_FILTER_FLETCHER32]);
+ printf("\t\tSZIP filter: %lu\n", iter->dset_comptype[H5Z_FILTER_SZIP]);
+ printf("\t\tNBIT filter: %lu\n", iter->dset_comptype[H5Z_FILTER_NBIT]);
+ printf("\t\tSCALEOFFSET filter: %lu\n", iter->dset_comptype[H5Z_FILTER_SCALEOFFSET]);
+ printf("\t\tUSER-DEFINED filter: %lu\n", iter->dset_comptype[H5_NFILTERS_IMPL-1]);
+ } /* end if */
+
+ return 0;
+} /* print_dataset_info() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: print_dataset_metadata
+ *
+ * Purpose: Prints file space information for datasets' metadata
+ *
+ * Return: Success: 0
+ *
+ * Failure: Never fails
+ *
+ * Programmer: Vailin Choi; October 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+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);
+
+ HDfprintf(stdout, "\tIndex for Chunked datasets: %Hu\n",
+ iter->datasets_index_storage_size);
+ HDfprintf(stdout, "\tHeap: %Hu\n", iter->datasets_heap_storage_size);
+
+ return 0;
+} /* print_dset_metadata() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: print_dset_dtype_meta
+ *
+ * Purpose: Prints datasets' datatype information
+ *
+ * Return: Success: 0
+ *
+ * Failure: Never fails
+ *
+ * Programmer: Vailin Choi; October 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+print_dset_dtype_meta(const iter_t *iter)
+{
+ unsigned long total; /* Total count for various statistics */
+ size_t dtype_size; /* Size of encoded datatype */
+ 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);
+ } /* end if */
+
+ return 0;
+} /* print_dset_dtype_meta() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: print_attr_info
+ *
+ * Purpose: Prints information about attributes in the file
+ *
+ * Return: Success: 0
+ *
+ * Failure: Never fails
+ *
+ * Programmer: Vailin Choi
+ * July 12, 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+print_attr_info(const iter_t *iter)
+{
+ unsigned long power; /* Temporary "power" for bins */
+ unsigned long total; /* Total count for various statistics */
+ unsigned u; /* Local index variable */
+
+ printf("Small # of attributes (objects with 1 to %u attributes):\n", sattrs_threshold);
+ total = 0;
+ for(u = 1; u <= (unsigned)sattrs_threshold; u++) {
+ if(iter->num_small_attrs[u] > 0) {
+ printf("\t# of objects with %u attributes: %lu\n", u, iter->num_small_attrs[u]);
+ total += iter->num_small_attrs[u];
+ } /* end if */
+ } /* end for */
+ printf("\tTotal # of objects with small # of attributes: %lu\n", total);
+
+ printf("Attribute bins:\n");
+ total = 0;
+ power = 1;
+ for(u = 1; u < iter->attr_nbins; u++) {
+ if(iter->attr_bins[u] > 0) {
+ printf("\t# of objects with %lu - %lu attributes: %lu\n", power, (power * 10) - 1,
+ iter->attr_bins[u]);
+ total += iter->attr_bins[u];
+ } /* end if */
+ power *= 10;
+ } /* end for */
+ printf("\tTotal # of objects with attributes: %lu\n", total);
+ printf("\tMax. # of attributes to objects: %lu\n", (unsigned long)iter->max_attrs);
+
+ return 0;
+} /* print_attr_info() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: print_freespace_info
+ *
+ * Purpose: Prints information about free space in the file
+ *
+ * Return: Success: 0
+ *
+ * Failure: Never fails
+ *
+ * Programmer: Vailin Choi; July 7th, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+print_freespace_info(const iter_t *iter)
+{
+ unsigned long power; /* Temporary "power" for bins */
+ unsigned long total; /* Total count for various statistics */
+ unsigned u; /* Local index variable */
+
+ HDfprintf(stdout, "Free-space section threshold: %Hu bytes\n", iter->fs_threshold);
+ printf("Small size free-space sections (< %u bytes):\n", (unsigned)SIZE_SMALL_SECTS);
+ total = 0;
+ for(u = 0; u < SIZE_SMALL_SECTS; u++) {
+ if(iter->num_small_sects[u] > 0) {
+ printf("\t# of sections of size %u: %lu\n", u, iter->num_small_sects[u]);
+ total += iter->num_small_sects[u];
+ } /* end if */
+ } /* end for */
+ printf("\tTotal # of small size sections: %lu\n", total);
+
+ printf("Free-space section bins:\n");
+
+ total = 0;
+ power = 1;
+ for(u = 1; u < iter->sect_nbins; u++) {
+ if(iter->sect_bins[u] > 0) {
+ printf("\t# of sections of size %lu - %lu: %lu\n", power, (power * 10) - 1,
+ iter->sect_bins[u]);
+ total += iter->sect_bins[u];
+ } /* end if */
+ power *= 10;
+ } /* end for */
+ printf("\tTotal # of sections: %lu\n", total);
+
+ return 0;
+} /* print_freespace_info() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: print_storage_summary
+ *
+ * Purpose: Prints file space information for the file
+ *
+ * Return: Success: 0
+ *
+ * Failure: Never fails
+ *
+ * Programmer: Vailin Choi; August 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+print_storage_summary(const iter_t *iter)
+{
+ hsize_t total_meta = 0;
+ hsize_t unaccount = 0;
+ double percent = 0.0f;
+
+ HDfprintf(stdout, "File space management strategy: %s\n", FS_STRATEGY_NAME[iter->fs_strategy]);
+ printf("Summary of file space information:\n");
+ total_meta =
+ iter->super_size + iter->super_ext_size + iter->ublk_size +
+ iter->group_ohdr_info.total_size +
+ iter->dset_ohdr_info.total_size +
+ iter->dtype_ohdr_info.total_size +
+ iter->groups_btree_storage_size +
+ iter->groups_heap_storage_size +
+ iter->attrs_btree_storage_size +
+ iter->attrs_heap_storage_size +
+ iter->datasets_index_storage_size +
+ iter->datasets_heap_storage_size +
+ iter->SM_hdr_storage_size +
+ iter->SM_index_storage_size +
+ iter->SM_heap_storage_size +
+ iter->free_hdr;
+
+ HDfprintf(stdout, " File metadata: %Hu bytes\n", total_meta);
+ HDfprintf(stdout, " Raw data: %Hu bytes\n", iter->dset_storage_size);
+
+ percent = ((double)iter->free_space / (double)iter->filesize) * (double)100.0f;
+ 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)) {
+ 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);
+ }
+ else {
+ unaccount = iter->filesize - (total_meta + iter->dset_storage_size + iter->free_space);
+ 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);
+
+ if(iter->nexternal)
+ HDfprintf(stdout, "External raw data: %Hu bytes\n", iter->dset_external_storage_size);
+
+ return 0;
+} /* print_storage_summary() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: print_file_statistics
+ *
+ * Purpose: Prints file statistics
+ *
+ * Return: Success: 0
+ *
+ * Failure: Never fails
+ *
+ * Programmer: Elena Pourmal
+ * Saturday, August 12, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+print_file_statistics(const iter_t *iter)
+{
+ if(display_all) {
+ display_file = TRUE;
+ display_group = TRUE;
+ display_dset = TRUE;
+ display_dset_dtype_meta = TRUE;
+ display_attr = TRUE;
+ display_free_sections = TRUE;
+ display_summary = TRUE;
+
+ display_file_metadata = TRUE;
+ display_group_metadata = TRUE;
+ display_dset_metadata = TRUE;
+ }
+
+ if(display_file) print_file_info(iter);
+ if(display_file_metadata) print_file_metadata(iter);
+
+ if(display_group) print_group_info(iter);
+ if(!display_all && display_group_metadata) print_group_metadata(iter);
+
+ if(display_dset) print_dataset_info(iter);
+ if(display_dset_dtype_meta) print_dset_dtype_meta(iter);
+ if(!display_all && display_dset_metadata) print_dset_metadata(iter);
+
+ if(display_attr) print_attr_info(iter);
+ if(display_free_sections) print_freespace_info(iter);
+ if(display_summary) print_storage_summary(iter);
+} /* print_file_statistics() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: print_object_statistics
+ *
+ * Purpose: Prints object statistics
+ *
+ * Return: Success: 0
+ *
+ * Failure: Never fails
+ *
+ * Programmer: Elena Pourmal
+ * Thursday, August 17, 2006
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+print_object_statistics(const char *name)
+{
+ printf("Object name %s\n", name);
+} /* print_object_statistics() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: print_statistics
+ *
+ * Purpose: Prints statistics
+ *
+ * Return: Success: 0
+ *
+ * Failure: Never fails
+ *
+ * Programmer: Elena Pourmal
+ * Thursday, August 17, 2006
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+print_statistics(const char *name, const iter_t *iter)
+{
+ if(display_object)
+ 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 = -1;
+ struct handler_t *hand = NULL;
+
+ h5tools_setprogname(PROGRAMNAME);
+ h5tools_setstatus(EXIT_SUCCESS);
+
+ /* Disable error reporting */
+ H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
+
+ /* Initialize h5tools lib */
+ h5tools_init();
+
+ HDmemset(&iter, 0, sizeof(iter));
+
+ if(parse_command_line(argc, argv, &hand) < 0)
+ goto done;
+
+ fname = argv[opt_ind];
+
+ /* Check for filename given */
+ if(fname) {
+ hid_t fcpl;
+ H5F_info2_t finfo;
+
+ printf("Filename: %s\n", fname);
+
+ fid = H5Fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT);
+ if(fid < 0) {
+ error_msg("unable to open file \"%s\"\n", fname);
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
+ } /* end if */
+
+ /* Initialize iter structure */
+ iter.fid = fid;
+
+ if(H5Fget_filesize(fid, &iter.filesize) < 0)
+ warn_msg("Unable to retrieve file size\n");
+ HDassert(iter.filesize != 0);
+
+ /* Get storge info for file-level structures */
+ if(H5Fget_info2(fid, &finfo) < 0)
+ warn_msg("Unable to retrieve file info\n");
+ else {
+ iter.super_size = finfo.super.super_size;
+ iter.super_ext_size = finfo.super.super_ext_size;
+ iter.SM_hdr_storage_size = finfo.sohm.hdr_size;
+ iter.SM_index_storage_size = finfo.sohm.msgs_info.index_size;
+ iter.SM_heap_storage_size = finfo.sohm.msgs_info.heap_size;
+ iter.free_space = finfo.free.tot_space;
+ iter.free_hdr = finfo.free.meta_size;
+ } /* end else */
+
+ iter.num_small_groups = (unsigned long *)HDcalloc((size_t)sgroups_threshold, sizeof(unsigned long));
+ iter.num_small_attrs = (unsigned long *)HDcalloc((size_t)(sattrs_threshold+1), sizeof(unsigned long));
+ iter.small_dset_dims = (unsigned long *)HDcalloc((size_t)sdsets_threshold, sizeof(unsigned long));
+
+ if(iter.num_small_groups == NULL || iter.num_small_attrs == NULL || iter.small_dset_dims == NULL) {
+ error_msg("Unable to allocate memory for tracking small groups/datasets/attributes\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
+ }
+
+ if((fcpl = H5Fget_create_plist(fid)) < 0)
+ warn_msg("Unable to retrieve file creation property\n");
+
+ if(H5Pget_userblock(fcpl, &iter.ublk_size) < 0)
+ warn_msg("Unable to retrieve userblock size\n");
+
+ if(H5Pget_file_space(fcpl, &iter.fs_strategy, &iter.fs_threshold) < 0)
+ warn_msg("Unable to retrieve file space information\n");
+ HDassert(iter.fs_strategy != 0 && iter.fs_strategy < H5F_FILE_SPACE_NTYPES);
+
+ /* get information for free-space sections */
+ if(freespace_stats(fid, &iter) < 0)
+ warn_msg("Unable to retrieve freespace info\n");
+
+ /* Walk the objects or all file */
+ if(display_object) {
+ unsigned u;
+
+ for(u = 0; u < hand->obj_count; u++) {
+ if(h5trav_visit(fid, hand->obj[u], TRUE, TRUE, obj_stats, lnk_stats, &iter) < 0)
+ warn_msg("Unable to traverse object \"%s\"\n", hand->obj[u]);
+ else
+ print_statistics(hand->obj[u], &iter);
+ } /* end for */
+ } /* end if */
+ else {
+ if(h5trav_visit(fid, "/", TRUE, TRUE, obj_stats, lnk_stats, &iter) < 0)
+ warn_msg("Unable to traverse objects/links in file \"%s\"\n", fname);
+ else
+ print_statistics("/", &iter);
+ } /* end else */
+ } /* end if */
+
+done:
+ hand_free(hand);
+
+ /* Free iter structure */
+ iter_free(&iter);
+
+ if(fid >= 0 && H5Fclose(fid) < 0) {
+ error_msg("unable to close file \"%s\"\n", fname);
+ h5tools_setstatus(EXIT_FAILURE);
+ } /* end if */
+
+ leave(h5tools_getstatus());
+} /* end main() */
+
diff --git a/tools/src/h5stat/testh5stat.sh.in b/tools/src/h5stat/testh5stat.sh.in
new file mode 100644
index 0000000..cbb732c
--- /dev/null
+++ b/tools/src/h5stat/testh5stat.sh.in
@@ -0,0 +1,318 @@
+#! /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 h5stat tool
+#
+# Modifcations:
+# Vailin Choi; July 2013
+# Add tests for -l, -m, -a options
+#
+
+srcdir=@srcdir@
+
+# Determine which filters are available
+USE_FILTER_SZIP="@USE_FILTER_SZIP@"
+USE_FILTER_DEFLATE="@USE_FILTER_DEFLATE@"
+
+TESTNAME=h5stat
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+
+STAT=h5stat # The tool name
+STAT_BIN=`pwd`/$STAT # The path of the tool binary
+
+RM='rm -rf'
+CMP='cmp -s'
+DIFF='diff -c'
+CP='cp'
+DIRNAME='dirname'
+LS='ls'
+AWK='awk'
+
+nerrors=0
+verbose=yes
+
+# 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_H5STAT_TESTFILES/h5stat_filters.h5
+$SRC_H5STAT_TESTFILES/h5stat_tsohm.h5
+$SRC_H5STAT_TESTFILES/h5stat_newgrat.h5
+$SRC_H5STAT_TESTFILES/h5stat_idx.h5
+$SRC_H5STAT_TESTFILES/h5stat_threshold.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_nofile.ddl
+$SRC_H5STAT_TESTFILES/h5stat_filters.ddl
+$SRC_H5STAT_TESTFILES/h5stat_filters-file.ddl
+$SRC_H5STAT_TESTFILES/h5stat_filters-F.ddl
+$SRC_H5STAT_TESTFILES/h5stat_filters-d.ddl
+$SRC_H5STAT_TESTFILES/h5stat_filters-g.ddl
+$SRC_H5STAT_TESTFILES/h5stat_filters-dT.ddl
+$SRC_H5STAT_TESTFILES/h5stat_filters-UD.ddl
+$SRC_H5STAT_TESTFILES/h5stat_filters-UT.ddl
+$SRC_H5STAT_TESTFILES/h5stat_tsohm.ddl
+$SRC_H5STAT_TESTFILES/h5stat_newgrat.ddl
+$SRC_H5STAT_TESTFILES/h5stat_newgrat-UG.ddl
+$SRC_H5STAT_TESTFILES/h5stat_newgrat-UA.ddl
+$SRC_H5STAT_TESTFILES/h5stat_idx.ddl
+$SRC_H5STAT_TESTFILES/h5stat_err1_links.ddl
+$SRC_H5STAT_TESTFILES/h5stat_links1.ddl
+$SRC_H5STAT_TESTFILES/h5stat_links2.ddl
+$SRC_H5STAT_TESTFILES/h5stat_links3.ddl
+$SRC_H5STAT_TESTFILES/h5stat_links4.ddl
+$SRC_H5STAT_TESTFILES/h5stat_links5.ddl
+$SRC_H5STAT_TESTFILES/h5stat_err1_dims.ddl
+$SRC_H5STAT_TESTFILES/h5stat_dims1.ddl
+$SRC_H5STAT_TESTFILES/h5stat_dims2.ddl
+$SRC_H5STAT_TESTFILES/h5stat_err1_numattrs.ddl
+$SRC_H5STAT_TESTFILES/h5stat_err2_numattrs.ddl
+$SRC_H5STAT_TESTFILES/h5stat_numattrs1.ddl
+$SRC_H5STAT_TESTFILES/h5stat_numattrs2.ddl
+$SRC_H5STAT_TESTFILES/h5stat_numattrs3.ddl
+$SRC_H5STAT_TESTFILES/h5stat_numattrs4.ddl
+"
+
+#
+# copy test files and expected output files from source dirs to test dir
+#
+COPY_TESTFILES="$LIST_HDF5_TEST_FILES $LIST_OTHER_TEST_FILES"
+
+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
+ # skip cp if srcdir is same as destdir
+ # this occurs when build/test performed in source dir and
+ # make cp fail
+ SDIR=`$DIRNAME $tstfile`
+ INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
+ INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
+ if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
+ $CP -f $tstfile $TESTDIR
+ if [ $? -ne 0 ]; then
+ echo "Error: FAILED to copy $tstfile ."
+
+ # Comment out this to CREATE expected file
+ exit $EXIT_FAILURE
+ fi
+ fi
+ fi
+ done
+}
+
+CLEAN_TESTFILES_AND_TESTDIR()
+{
+ # skip rm if srcdir is same as destdir
+ # this occurs when build/test performed in source dir and
+ # make cp fail
+ SDIR=$SRC_H5STAT_TESTFILES
+ INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
+ INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
+ if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
+ $RM $TESTDIR
+ fi
+}
+
+# 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 $STAT $@
+ (
+ cd $TESTDIR
+ $RUNSERIAL $STAT_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
+ fi
+}
+
+
+# Print a "SKIP" message
+SKIP() {
+ TESTING $STAT $@
+ echo " -SKIP-"
+}
+
+
+
+##############################################################################
+##############################################################################
+### T H E T E S T S ###
+##############################################################################
+##############################################################################
+# prepare for test
+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
+TOOLTEST h5stat_nofile.ddl ''
+
+# 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
+TOOLTEST h5stat_filters.ddl h5stat_filters.h5
+TOOLTEST h5stat_filters-file.ddl -f h5stat_filters.h5
+TOOLTEST h5stat_filters-F.ddl -F h5stat_filters.h5
+TOOLTEST h5stat_filters-d.ddl -d h5stat_filters.h5
+TOOLTEST h5stat_filters-g.ddl -g h5stat_filters.h5
+TOOLTEST h5stat_filters-dT.ddl -dT h5stat_filters.h5
+TOOLTEST h5stat_filters-UD.ddl -D h5stat_filters.h5
+TOOLTEST h5stat_filters-UT.ddl -T h5stat_filters.h5
+#
+# h5stat_tsohm.h5 is a copy of ../../../test/tsohm.h5 generated by tsohm.c
+# as of release 1.8.7-snap0 (on a 64-bit machine)
+TOOLTEST h5stat_tsohm.ddl h5stat_tsohm.h5
+# h5stat_newgrat.h5 is generated by h5stat_gentest.c
+TOOLTEST h5stat_newgrat.ddl h5stat_newgrat.h5
+TOOLTEST h5stat_newgrat-UG.ddl -G h5stat_newgrat.h5
+TOOLTEST h5stat_newgrat-UA.ddl -A h5stat_newgrat.h5
+# h5stat_idx.h5 is generated by h5stat_gentest.c
+TOOLTEST h5stat_idx.ddl h5stat_idx.h5
+#
+# Tests for -l (--links) option on h5stat_threshold.h5:
+# -l 0 (incorrect threshold value)
+# -g -l 8
+# --links=8
+# --links=20 -g
+TOOLTEST h5stat_err1_links.ddl -l 0 h5stat_threshold.h5
+TOOLTEST h5stat_links1.ddl -g -l 8 h5stat_threshold.h5
+TOOLTEST h5stat_links2.ddl --links=8 h5stat_threshold.h5
+TOOLTEST h5stat_links3.ddl --links=20 -g h5stat_threshold.h5
+#
+# Tests for -l (--links) option on h5stat_newgrat.h5:
+# -g
+# -g -l 40000
+TOOLTEST h5stat_links4.ddl -g h5stat_newgrat.h5
+TOOLTEST h5stat_links5.ddl -g -l 40000 h5stat_newgrat.h5
+#
+# Tests for -m (--dims) option on h5stat_threshold.h5
+# -d --dims=-1 (incorrect threshold value)
+# -gd -m 5
+# -d --di=15
+TOOLTEST h5stat_err1_dims.ddl -d --dims=-1 h5stat_threshold.h5
+TOOLTEST h5stat_dims1.ddl -gd -m 5 h5stat_threshold.h5
+TOOLTEST h5stat_dims2.ddl -d --di=15 h5stat_threshold.h5
+#
+# Tests for -a option on h5stat_threshold.h5
+# -a -2 (incorrect threshold value)
+# --numattrs (without threshold value)
+# -AS -a 10
+# -a 1
+# -A --numattrs=25
+TOOLTEST h5stat_err1_numattrs.ddl -a -2 h5stat_threshold.h5
+TOOLTEST h5stat_err2_numattrs.ddl --numattrs h5stat_threshold.h5
+TOOLTEST h5stat_numattrs1.ddl -AS -a 10 h5stat_threshold.h5
+TOOLTEST h5stat_numattrs2.ddl -a 1 h5stat_threshold.h5
+TOOLTEST h5stat_numattrs3.ddl -A --numattrs=25 h5stat_threshold.h5
+#
+# Tests for -a option on h5stat_newgrat.h5
+# -A -a 100
+TOOLTEST h5stat_numattrs4.ddl -A -a 100 h5stat_newgrat.h5
+#
+
+# Clean up temporary files/directories
+CLEAN_TESTFILES_AND_TESTDIR
+
+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/src/misc/CMakeLists.txt b/tools/src/misc/CMakeLists.txt
new file mode 100644
index 0000000..6fcff9c
--- /dev/null
+++ b/tools/src/misc/CMakeLists.txt
@@ -0,0 +1,67 @@
+cmake_minimum_required (VERSION 3.1.0)
+PROJECT (HDF5_TOOLS_SRC_MISC)
+
+#-----------------------------------------------------------------------------
+# Setup include Directories
+#-----------------------------------------------------------------------------
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib)
+
+# --------------------------------------------------------------------
+# Add the misc executables
+# --------------------------------------------------------------------
+#-- Misc Executables
+add_executable (h5debug ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5debug.c)
+TARGET_NAMING (h5debug STATIC)
+TARGET_C_PROPERTIES (h5debug STATIC " " " ")
+target_link_libraries (h5debug ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+set_target_properties (h5debug PROPERTIES FOLDER tools)
+set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5debug")
+
+add_executable (h5repart ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5repart.c)
+TARGET_NAMING (h5repart STATIC)
+TARGET_C_PROPERTIES (h5repart STATIC " " " ")
+target_link_libraries (h5repart ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+set_target_properties (h5repart PROPERTIES FOLDER tools)
+set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5repart")
+
+add_executable (h5mkgrp ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5mkgrp.c)
+TARGET_NAMING (h5mkgrp STATIC)
+TARGET_C_PROPERTIES (h5mkgrp STATIC " " " ")
+target_link_libraries (h5mkgrp ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+set_target_properties (h5mkgrp PROPERTIES FOLDER tools)
+set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5mkgrp")
+
+set (H5_DEP_EXECUTABLES
+ h5debug
+ h5repart
+ h5mkgrp
+)
+
+#-----------------------------------------------------------------------------
+# Generate the h5cc file containing settings needed to compile programs
+#-----------------------------------------------------------------------------
+#if (NOT WIN32)
+# configure_file (${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5cc.in ${HDF5_BINARY_DIR}/h5cc @ONLY)
+#endif (NOT WIN32)
+
+##############################################################################
+##############################################################################
+### I N S T A L L A T I O N ###
+##############################################################################
+##############################################################################
+
+#-----------------------------------------------------------------------------
+# 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
+ EXPORT
+ ${HDF5_EXPORTED_TARGETS}
+ RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications
+)
diff --git a/tools/src/misc/Makefile.am b/tools/src/misc/Makefile.am
new file mode 100644
index 0000000..c069e9a
--- /dev/null
+++ b/tools/src/misc/Makefile.am
@@ -0,0 +1,61 @@
+#
+# 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.
+##
+## Makefile.am
+## Run automake to generate a Makefile.in from this file.
+#
+# HDF5 Library Makefile(.in)
+#
+
+include $(top_srcdir)/config/commence.am
+
+# Include src directory
+AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib
+
+# These are our main targets, the tools
+bin_PROGRAMS=h5debug h5repart h5mkgrp
+bin_SCRIPTS=h5redeploy
+
+# Add h5debug, h5repart, and h5mkgrp specific linker flags here
+h5debug_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+h5repart_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+h5mkgrp_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+
+# Tell automake to clean h5redeploy script
+CLEANFILES=h5redeploy
+
+# These were generated by configure. Remove them only when distclean.
+DISTCLEANFILES=h5cc
+
+# All programs rely on hdf5 library and h5tools library
+LDADD=$(LIBH5TOOLS) $(LIBHDF5)
+
+# h5cc needs custom install and uninstall rules, since it may be
+# named h5pcc if hdf5 is being built in parallel mode.
+if BUILD_PARALLEL_CONDITIONAL
+ H5CC_NAME=h5pcc
+else
+ H5CC_NAME=h5cc
+endif
+
+install-exec-local:
+ @$(INSTALL) h5cc $(DESTDIR)$(bindir)/$(H5CC_NAME)
+uninstall-local:
+ @$(RM) $(DESTDIR)$(bindir)/$(H5CC_NAME)
+
+# How to build h5redeploy script
+h5redeploy: h5redeploy.in
+ @cp $(srcdir)/$@.in $@
+
+include $(top_srcdir)/config/conclude.am
diff --git a/tools/src/misc/h5cc.in b/tools/src/misc/h5cc.in
new file mode 100644
index 0000000..1645855
--- /dev/null
+++ b/tools/src/misc/h5cc.in
@@ -0,0 +1,401 @@
+#! /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.
+##
+
+# This tool is adapted from the mpicc command of the MPICH Software.
+
+############################################################################
+## ##
+## Things You May Have to Modify: ##
+## ##
+## If the following paths don't point to the place were HDF5 is installed ##
+## on your system (i.e., you received a binary distribution or moved the ##
+## files from the originally installed directory to another directory) ##
+## then modify them accordingly to represent the new paths. ##
+## ##
+############################################################################
+prefix="@prefix@"
+exec_prefix="@exec_prefix@"
+libdir="@libdir@"
+includedir="@includedir@"
+HL="@HL@"
+
+############################################################################
+## ##
+## Things You Can Modify to Override HDF5 Library Build Components: ##
+## ##
+## (Advanced usage - know what you're doing - you're on your own here.) ##
+## The four variables below can be used to insert paths and flags in ##
+## CPPFLAGS, CFLAGS, LDFLAGS, or LIBS in the h5cc compile line: ##
+## $CLINKER $H5BLD_CPPFLAGS $CPPFLAGS $H5BLD_CFLAGS $CFLAGS $LDFLAGS ##
+## $LIBS $clibpath $link_objs $link_args $shared_link ##
+## ##
+## These settings can be overriden by setting HDF5_CFLAGS, ##
+## HDF5_CPPFLAGS, HDF5_LDFLAGS, or HDF5_LIBS in the environment. ##
+## ##
+############################################################################
+CFLAGSBASE=""
+CPPFLAGSBASE=""
+LDFLAGSBASE=""
+LIBSBASE=""
+
+############################################################################
+## ##
+## You shouldn't have to modify anything below this line. ##
+## ##
+############################################################################
+
+# Constants definitions
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+
+host_os="@host_os@"
+
+prog_name="`basename $0`"
+
+allargs=""
+compile_args=""
+libraries=""
+link_args=""
+link_objs=""
+clibpath=""
+
+do_link="yes"
+do_compile="no"
+dash_o="no"
+dash_c="no"
+get_output_file="no"
+
+SHOW="eval"
+CCBASE="@CC@"
+CLINKERBASE="@CC@"
+
+# CFLAGS, CPPFLAGS and LDFLAGS are reserved for use by the script user.
+# FLAGS brought from the hdf5 build are put in H5BLD_*FLAGS.
+
+# User's CPPFLAGS and CFLAGS come after their H5BLD counterparts. User's
+# LDFLAGS come just before clibpath, user's LIBS come after $link_objs and
+# before the hdf5 libraries in $link_args, followed by any external library
+# paths and libraries from AM_LDFLAGS, LDFLAGS, AM_LIBS or LIBS carried in
+# from the hdf5 build. The order of the flags is intended to give precedence
+# to the user's flags.
+H5BLD_CFLAGS="@AM_CFLAGS@ @CFLAGS@"
+H5BLD_CPPFLAGS="@AM_CPPFLAGS@ @CPPFLAGS@"
+H5BLD_LDFLAGS="@AM_LDFLAGS@ @LDFLAGS@"
+H5BLD_LIBS="@LIBS@"
+
+CC="${HDF5_CC:-$CCBASE}"
+CLINKER="${HDF5_CLINKER:-$CLINKERBASE}"
+CFLAGS="${HDF5_CFLAGS:-$CFLAGSBASE}"
+CPPFLAGS="${HDF5_CPPFLAGS:-$CPPFLAGSBASE}"
+LDFLAGS="${HDF5_LDFLAGS:-$LDFLAGSBASE}"
+LIBS="${HDF5_LIBS:-$LIBSBASE}"
+
+# If a static library is available, the default will be to use it. If the only
+# available library is shared, it will be used by default. The user can
+# override either default, although choosing an unavailable library will result
+# in link errors.
+STATIC_AVAILABLE="@enable_static@"
+if test "${STATIC_AVAILABLE}" = "yes"; then
+ USE_SHARED_LIB="${HDF5_USE_SHLIB:-no}"
+else
+ USE_SHARED_LIB="${HDF5_USE_SHLIB:-yes}"
+fi
+
+
+usage() {
+ # A wonderfully informative "usage" message.
+ echo "usage: $prog_name [OPTIONS] <compile line>"
+ echo " OPTIONS:"
+ echo " -help This help message."
+ echo " -echo Show all the shell commands executed"
+ echo " -prefix=DIR Prefix directory to find HDF5 lib/ and include/"
+ echo " subdirectories [default: $prefix]"
+ # A wonderfully informative "usage" message.
+ echo "usage: $prog_name [OPTIONS] <compile line>"
+ echo " OPTIONS:"
+ echo " -help This help message."
+ echo " -echo Show all the shell commands executed"
+ echo " -prefix=DIR Prefix directory to find HDF5 lib/ and include/"
+ echo " subdirectories [default: $prefix]"
+ echo " -show Show the commands without executing them"
+ echo " -showconfig Show the HDF5 library configuration summary"
+ echo " -shlib Compile with shared HDF5 libraries [default for hdf5 built"
+ echo " without static libraries]"
+ echo " -noshlib Compile with static HDF5 libraries [default for hdf5 built"
+ echo " with static libraries]"
+ echo " "
+ echo " <compile line> - the normal compile line options for your compiler."
+ echo " $prog_name uses the same compiler you used to compile"
+ echo " HDF5. Check with your compiler's man pages for more"
+ echo " information on which options are needed."
+ echo " "
+ echo " You can override the compiler, linker, and whether or not to use static"
+ echo " or shared libraries to compile your program by setting the following"
+ echo " environment variables accordingly:"
+ echo " "
+ echo " HDF5_CC - use a different C compiler"
+ echo " HDF5_CLINKER - use a different linker"
+ echo " HDF5_USE_SHLIB=[yes|no] - use shared or static version of the HDF5 library"
+ echo " [default: no except when built with only"
+ echo " shared libraries]"
+ echo " "
+ echo " You can also add or change paths and flags to the compile line using"
+ echo " the following environment varibles or by assigning them to their counterparts"
+ echo " in the 'Things You Can Modify to Override...'" section of $prog_name
+ echo " "
+ echo " Variable Current value to be replaced"
+ echo " HDF5_CPPFLAGS \"$CPPFLAGSBASE\""
+ echo " HDF5_CFLAGS \"$CFLAGSBASE\""
+ echo " HDF5_LDFLAGS \"$LDFLAGSBASE\""
+ echo " HDF5_LIBS \"$LIBSBASE\""
+ echo " "
+ echo " Note that adding library paths to HDF5_LDFLAGS where another hdf5 version"
+ echo " is located may link your program with that other hdf5 library version."
+ echo " "
+ exit $EXIT_FAILURE
+}
+
+# Show the configuration summary of the library recorded in the
+# libhdf5.settings file reside in the lib directory.
+showconfigure()
+{
+ cat ${libdir}/libhdf5.settings
+ status=$?
+}
+
+# Main
+status=$EXIT_SUCCESS
+
+if test "$#" = "0"; then
+ # No parameters specified, issue usage statement and exit.
+ usage
+fi
+
+case "$CC" in
+ gcc)
+ kind="gcc"
+ ;;
+ mpicc|mpcc|mpicc_r)
+ # Is this gcc masquarading as an MPI compiler?
+ if test "`${CC} -v 2>&1 | sed -n 2p | cut -c1-3`" = "gcc"; then
+ kind="gcc"
+ else
+ # Nope
+ kind="$host_os"
+ fi
+ ;;
+ *)
+ kind="$host_os"
+ ;;
+esac
+
+for arg in $@ ; do
+ if test "x$get_output_file" = "xyes"; then
+ link_args="$link_args $arg"
+ output_file="$arg"
+ get_output_file="no"
+ continue
+ fi
+
+ case "$arg" in
+ -c)
+ allargs="$allargs $arg"
+ compile_args="$compile_args $arg"
+
+ if test "x$do_link" = "xyes" -a -n "$output_file"; then
+ compile_args="$compile_args -o $output_file"
+ fi
+
+ do_link="no"
+ dash_c="yes"
+ ;;
+ -o)
+ allargs="$allargs $arg"
+ dash_o="yes"
+
+ if test "x$dash_c" = "xyes"; then
+ compile_args="$compile_args $arg"
+ else
+ link_args="$link_args $arg"
+ do_link="yes"
+ get_output_file="yes"
+ fi
+ ;;
+ -E|-M|-MT)
+ allargs="$allargs $arg"
+ compile_args="$compile_args $arg"
+ dash_c="yes"
+ do_link="no"
+ ;;
+ -l*)
+ libraries=" $libraries $arg "
+ allargs="$allargs $arg"
+ ;;
+ -prefix=*)
+ prefix="`expr "$arg" : '-prefix=\(.*\)'`"
+ ;;
+ -echo)
+ set -x
+ ;;
+ -show)
+ SHOW="echo"
+ ;;
+ -showconfig)
+ showconfigure
+ exit $status
+ ;;
+ -shlib)
+ USE_SHARED_LIB="yes"
+ ;;
+ -noshlib)
+ USE_SHARED_LIB="no"
+ ;;
+ -help)
+ usage
+ ;;
+ *\"*)
+ qarg="'"$arg"'"
+ allargs="$allargs $qarg"
+ ;;
+ *\'*)
+ qarg='\"'"$arg"'\"'
+ allargs="$allargs $qarg"
+ ;;
+ *)
+ allargs="$allargs $qarg"
+
+ if test -s "$arg"; then
+ ext=`expr "$arg" : '.*\(\..*\)'`
+
+ if test "x$ext" = "x.c"; then
+ do_compile="yes"
+ compile_args="$compile_args $arg"
+ fname=`basename $arg .c`
+ link_objs="$link_objs $fname.o"
+ elif test "x$ext" = "x.o"; then
+ if test "x$dash_c" = "xyes"; then
+ compile_args="$compile_args $arg"
+ else
+ do_link="yes"
+ link_objs="$link_objs $arg"
+ fi
+ elif test "x$ext" = "x.a"; then
+ # This is an archive that we're linking in
+ libraries=" $libraries $arg "
+ else
+ compile_args="$compile_args $arg"
+ link_args="$link_args $arg"
+ fi
+ else
+ compile_args="$compile_args $arg"
+ link_args="$link_args $arg"
+ fi
+ ;;
+ esac
+done
+
+if test "$dash_c" = "yes" -a "$do_compile" = no -a "$do_link" = no ; then
+ # -c was specified. Force do_compile on.
+ do_compile=yes
+fi
+
+if test "x$do_compile" = "xyes"; then
+ if test "x$dash_c" != "xyes"; then
+ compile_args="-c $compile_args"
+ fi
+
+ $SHOW $CC -I$includedir $H5BLD_CPPFLAGS $CPPFLAGS $H5BLD_CFLAGS $CFLAGS $compile_args
+ status=$?
+
+ if test "$status" != "0"; then
+ exit $status
+ fi
+fi
+
+if test "x$do_link" = "xyes"; then
+ shared_link=""
+# conditionnaly link with the hl library
+ if test "X$HL" = "Xhl"; then
+ libraries=" $libraries -lhdf5_hl -lhdf5 "
+ else
+ libraries=" $libraries -lhdf5 "
+ fi
+ link_args="$link_args -L${libdir}"
+
+ case "$kind" in
+ gcc|linux*)
+ # MacOS X doesn't support the "-Wl,-rpath -Wl," style of linker flags.
+ # It appears to want none of them specified.
+ case "$host_os" in
+ darwin*) flag="" ;;
+ *) flag="-Wl,-rpath -Wl," ;;
+ esac
+ ;;
+ hpux*) flag="-Wl,+b -Wl," ;;
+ freebsd*|solaris*) flag="-R" ;;
+ rs6000*|aix*) flag="-L" ;;
+ sgi) flag="-rpath " ;;
+ *) flag="" ;;
+ esac
+
+ if test -n "$flag"; then
+ shared_link="${flag}${libdir}"
+ fi
+
+ if test "x$USE_SHARED_LIB" != "xyes"; then
+ # The "-lhdf5" & "-lhdf5_hl" flags are in here already...This is a static
+ # compile though, so change it to the static version (.a) of the library.
+ new_libraries=""
+ for lib in $libraries; do
+ case "$lib" in
+ -lhdf5)
+ new_libraries="$new_libraries ${libdir}/libhdf5.a"
+ ;;
+ -lhdf5_hl)
+ new_libraries="$new_libraries ${libdir}/libhdf5_hl.a"
+ ;;
+ *)
+ new_libraries="$new_libraries $lib"
+ ;;
+ esac
+ done
+ libraries="$new_libraries"
+ fi
+
+ for lib in $libraries; do
+ if echo $link_args | grep " $lib " > /dev/null ||
+ echo $link_args | grep " $lib$" > /dev/null; then
+ :
+ else
+ link_args="$link_args $lib "
+ fi
+ done
+
+ # The LIBS are just a bunch of -l* libraries necessary for the HDF5
+ # module. It's okay if they're included twice in the compile line.
+ link_args="$link_args $H5BLD_LDFLAGS $H5BLD_LIBS"
+
+ # User's CPPFLAGS and CFLAGS come after their H5BLD counterparts. User's
+ # LDFLAGS come just before clibpath, user's LIBS come after $link_objs and
+ # before the hdf5 libraries in $link_args, followed by any external library
+ # paths and libraries from AM_LDFLAGS, LDFLAGS, AM_LIBS or LIBS carried in
+ # from the hdf5 build. The order of the flags is intended to give precedence
+ # to the user's flags.
+ $SHOW $CLINKER $H5BLD_CPPFLAGS $CPPFLAGS $H5BLD_CFLAGS $CFLAGS $LDFLAGS $clibpath $link_objs $LIBS $link_args $shared_link
+ status=$?
+fi
+
+exit $status
diff --git a/tools/src/misc/h5debug.c b/tools/src/misc/h5debug.c
new file mode 100644
index 0000000..ae64952
--- /dev/null
+++ b/tools/src/misc/h5debug.c
@@ -0,0 +1,723 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*-------------------------------------------------------------------------
+ *
+ * Created: debug.c
+ * Jul 18 1997
+ * Robb Matzke <matzke@llnl.gov>
+ *
+ * Purpose: Debugs an existing HDF5 file at a low level.
+ *
+ *-------------------------------------------------------------------------
+ */
+#define H5A_FRIEND /*suppress error about including H5Apkg */
+#define H5B2_FRIEND /*suppress error about including H5B2pkg */
+#define H5B2_TESTING /*suppress warning about H5B2 testing funcs*/
+#define H5D_FRIEND /*suppress error about including H5Dpkg */
+#define H5EA_FRIEND /*suppress error about including H5EApkg */
+#define H5EA_TESTING /*suppress warning about H5EA testing funcs*/
+#define H5FA_FRIEND /*suppress error about including H5FApkg */
+#define H5FA_TESTING /*suppress warning about H5FA testing funcs*/
+#define H5F_FRIEND /*suppress error about including H5Fpkg */
+#define H5G_FRIEND /*suppress error about including H5Gpkg */
+#define H5HF_FRIEND /*suppress error about including H5HFpkg */
+#define H5O_FRIEND /*suppress error about including H5Opkg */
+#define H5SM_FRIEND /*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 */
+#include "H5FDfamily.h"
+
+#define VCOL 50
+
+
+/*-------------------------------------------------------------------------
+ * Function: get_H5B2_class
+ *
+ * Purpose: Determine the v2 B-tree class from the buffer read in.
+ * B-trees are debugged through the B-tree subclass. The subclass
+ * identifier is two bytes after the B-tree signature.
+ *
+ * Return: Non-NULL on success/NULL on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Sep 11 2008
+ *
+ *-------------------------------------------------------------------------
+ */
+static const H5B2_class_t *
+get_H5B2_class(const uint8_t *sig)
+{
+ H5B2_subid_t subtype = (H5B2_subid_t)sig[H5_SIZEOF_MAGIC + 1];
+ const H5B2_class_t *cls;
+
+ switch(subtype) {
+ case H5B2_TEST_ID:
+ cls = H5B2_TEST;
+ break;
+
+ case H5B2_FHEAP_HUGE_INDIR_ID:
+ cls = H5HF_HUGE_BT2_INDIR;
+ break;
+
+ case H5B2_FHEAP_HUGE_FILT_INDIR_ID:
+ cls = H5HF_HUGE_BT2_FILT_INDIR;
+ break;
+
+ case H5B2_FHEAP_HUGE_DIR_ID:
+ cls = H5HF_HUGE_BT2_DIR;
+ break;
+
+ case H5B2_FHEAP_HUGE_FILT_DIR_ID:
+ cls = H5HF_HUGE_BT2_FILT_DIR;
+ break;
+
+ case H5B2_GRP_DENSE_NAME_ID:
+ cls = H5G_BT2_NAME;
+ break;
+
+ case H5B2_GRP_DENSE_CORDER_ID:
+ cls = H5G_BT2_CORDER;
+ break;
+
+ case H5B2_SOHM_INDEX_ID:
+ cls = H5SM_INDEX;
+ break;
+
+ case H5B2_ATTR_DENSE_NAME_ID:
+ cls = H5A_BT2_NAME;
+ break;
+
+ case H5B2_ATTR_DENSE_CORDER_ID:
+ cls = H5A_BT2_CORDER;
+ break;
+
+ case H5B2_CDSET_ID:
+ cls = H5D_BT2;
+ break;
+
+ case H5B2_CDSET_FILT_ID:
+ cls = H5D_BT2_FILT;
+ break;
+
+ case H5B2_TEST2_ID:
+ cls = H5B2_TEST2;
+ break;
+
+ case H5B2_NUM_BTREE_ID:
+ default:
+ HDfprintf(stderr, "Unknown v2 B-tree subtype %u\n", (unsigned)(subtype));
+ HDexit(4);
+ } /* end switch */
+
+ return(cls);
+} /* end get_H5B2_class() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: get_H5EA_class
+ *
+ * Purpose: Determine the extensible array class from the buffer read in.
+ * Extensible arrays are debugged through the array subclass.
+ * The subclass identifier is two bytes after the signature.
+ *
+ * Return: Non-NULL on success/NULL on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Sep 11 2008
+ *
+ *-------------------------------------------------------------------------
+ */
+static const H5EA_class_t *
+get_H5EA_class(const uint8_t *sig)
+{
+ H5EA_cls_id_t clsid = (H5EA_cls_id_t)sig[H5_SIZEOF_MAGIC + 1];
+ const H5EA_class_t *cls;
+
+ switch(clsid) {
+ case H5EA_CLS_TEST_ID:
+ cls = H5EA_CLS_TEST;
+ break;
+
+ case H5EA_CLS_CHUNK_ID:
+ cls = H5EA_CLS_CHUNK;
+ break;
+
+ case H5EA_CLS_FILT_CHUNK_ID:
+ cls = H5EA_CLS_FILT_CHUNK;
+ break;
+
+ case H5EA_NUM_CLS_ID:
+ default:
+ HDfprintf(stderr, "Unknown extensible array class %u\n", (unsigned)(clsid));
+ HDexit(4);
+ } /* end switch */
+
+ return(cls);
+} /* end get_H5EA_class() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: get_H5FA_class
+ *
+ * Purpose: Determine the fixed array class from the buffer read in.
+ * Extensible arrays are debugged through the array subclass.
+ * The subclass identifier is two bytes after the signature.
+ *
+ * Return: Non-NULL on success/NULL on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Sep 11 2008
+ *
+ *-------------------------------------------------------------------------
+ */
+static const H5FA_class_t *
+get_H5FA_class(const uint8_t *sig)
+{
+ H5FA_cls_id_t clsid = (H5FA_cls_id_t)sig[H5_SIZEOF_MAGIC + 1];
+ const H5FA_class_t *cls;
+
+ switch(clsid) {
+ case H5FA_CLS_TEST_ID:
+ cls = H5FA_CLS_TEST;
+ break;
+
+ case H5FA_CLS_CHUNK_ID:
+ cls = H5FA_CLS_CHUNK;
+ break;
+
+ case H5FA_CLS_FILT_CHUNK_ID:
+ cls = H5FA_CLS_FILT_CHUNK;
+ break;
+
+ case H5FA_NUM_CLS_ID:
+ default:
+ HDfprintf(stderr, "Unknown fixed array class %u\n", (unsigned)(clsid));
+ HDexit(4);
+ } /* end switch */
+
+ return(cls);
+} /* end get_H5FA_class() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: main
+ *
+ * Usage: debug FILENAME [OFFSET]
+ *
+ * Return: Success: exit (0)
+ *
+ * Failure: exit (non-zero)
+ *
+ * Programmer: Robb Matzke
+ * matzke@llnl.gov
+ * Jul 18 1997
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+main(int argc, char *argv[])
+{
+ hid_t fid, fapl, dxpl;
+ H5F_t *f;
+ haddr_t addr = 0, extra = 0, extra2 = 0, extra3 = 0, extra4 = 0;
+ uint8_t sig[H5F_SIGNATURE_LEN];
+ size_t u;
+ H5E_auto2_t func;
+ void *edata;
+ herr_t status = SUCCEED;
+
+ if(argc == 1) {
+ HDfprintf(stderr, "Usage: %s filename [signature-addr [extra]]\n", argv[0]);
+ HDexit(1);
+ } /* end if */
+
+ /* Initialize the library */
+ if(H5open() < 0) {
+ HDfprintf(stderr, "cannot initialize the library\n");
+ HDexit(1);
+ } /* end if */
+
+ /* Disable error reporting */
+ H5Eget_auto2(H5E_DEFAULT, &func, &edata);
+ H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
+
+ /*
+ * Open the file and get the file descriptor.
+ */
+ dxpl = H5AC_ind_read_dxpl_id;
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) {
+ HDfprintf(stderr, "cannot create file access property list\n");
+ HDexit(1);
+ } /* end if */
+ if(HDstrchr(argv[1], '%'))
+ if(H5Pset_fapl_family (fapl, (hsize_t)0, H5P_DEFAULT) < 0) {
+ fprintf(stderr, "cannot set file access property list\n");
+ HDexit(1);
+ }
+ if((fid = H5Fopen(argv[1], H5F_ACC_RDONLY, fapl)) < 0) {
+ HDfprintf(stderr, "cannot open file\n");
+ HDexit(1);
+ } /* end if */
+ if(NULL == (f = (H5F_t *)H5I_object(fid))) {
+ HDfprintf(stderr, "cannot obtain H5F_t pointer\n");
+ HDexit(2);
+ } /* end if */
+
+ /* Ignore metadata tags while using h5debug */
+ if(H5AC_ignore_tags(f) < 0) {
+ HDfprintf(stderr, "cannot ignore metadata tags\n");
+ HDexit(1);
+ }
+
+ /*
+ * Parse command arguments.
+ */
+ if(argc > 2)
+ addr = (haddr_t)HDstrtoll(argv[2], NULL, 0);
+ if(argc > 3)
+ extra = (haddr_t)HDstrtoll(argv[3], NULL, 0);
+ if(argc > 4)
+ extra2 = (haddr_t)HDstrtoll(argv[4], NULL, 0);
+ if(argc > 5)
+ extra3 = (haddr_t)HDstrtoll(argv[5], NULL, 0);
+ if(argc > 6)
+ extra4 = (haddr_t)HDstrtoll(argv[6], NULL, 0);
+
+ /*
+ * Read the signature at the specified file position.
+ */
+ HDfprintf(stdout, "Reading signature at address %a (rel)\n", addr);
+ if(H5F_block_read(f, H5FD_MEM_SUPER, addr, sizeof(sig), dxpl, sig) < 0) {
+ HDfprintf(stderr, "cannot read signature\n");
+ HDexit(3);
+ }
+ if(!HDmemcmp(sig, H5F_SIGNATURE, (size_t)H5F_SIGNATURE_LEN)) {
+ /*
+ * Debug the file's super block.
+ */
+ status = H5F_debug(f, stdout, 0, VCOL);
+
+ } else if(!HDmemcmp(sig, H5HL_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
+ /*
+ * Debug a local heap.
+ */
+ status = H5HL_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL);
+
+ } else if(!HDmemcmp (sig, H5HG_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
+ /*
+ * Debug a global heap collection.
+ */
+ status = H5HG_debug (f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL);
+
+ } else if(!HDmemcmp(sig, H5G_NODE_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
+ /*
+ * Debug a symbol table node.
+ */
+
+ /* Check for extra parameters */
+ if(extra == 0) {
+ HDfprintf(stderr, "\nWarning: Providing the group's local heap address will give more information\n");
+ HDfprintf(stderr, "Symbol table node usage:\n");
+ HDfprintf(stderr, "\th5debug <filename> <Symbol table node address> <address of local heap>\n\n");
+ } /* end if */
+
+ status = H5G_node_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL, extra);
+
+ } else if(!HDmemcmp(sig, H5B_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
+ /*
+ * Debug a B-tree. B-trees are debugged through the B-tree
+ * subclass. The subclass identifier is the byte immediately
+ * after the B-tree signature.
+ */
+ H5B_subid_t subtype = (H5B_subid_t)sig[H5_SIZEOF_MAGIC];
+ unsigned ndims;
+ uint32_t dim[H5O_LAYOUT_NDIMS];
+
+ switch(subtype) {
+ case H5B_SNODE_ID:
+ /* Check for extra parameters */
+ if(extra == 0) {
+ HDfprintf(stderr, "\nWarning: Providing the group's local heap address will give more information\n");
+ HDfprintf(stderr, "B-tree symbol table node usage:\n");
+ HDfprintf(stderr, "\th5debug <filename> <B-tree node address> <address of local heap>\n\n");
+ HDexit(4);
+ } /* end if */
+
+ status = H5G_node_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL, extra);
+ break;
+
+ case H5B_CHUNK_ID:
+ /* Check for extra parameters */
+ if(extra == 0) {
+ HDfprintf(stderr, "ERROR: Need number of dimensions of chunk in order to dump chunk B-tree node\n");
+ HDfprintf(stderr, "B-tree chunked storage node usage:\n");
+ HDfprintf(stderr, "\th5debug <filename> <B-tree node address> <# of dimensions> <slowest chunk dim>...<fastest chunk dim>\n");
+ HDexit(4);
+ } /* end if */
+
+ /* Build array of chunk dimensions */
+ ndims = (unsigned)extra;
+ dim[0] = (uint32_t)extra2;
+ if(ndims > 1)
+ dim[1] = (uint32_t)extra3;
+ if(ndims > 2)
+ dim[2] = (uint32_t)extra4;
+
+ /* Check for dimension error */
+ if(ndims > 3) {
+ HDfprintf(stderr, "ERROR: Only 3 dimensions support currently (fix h5debug)\n");
+ HDfprintf(stderr, "B-tree chunked storage node usage:\n");
+ HDfprintf(stderr, "\th5debug <filename> <B-tree node address> <# of dimensions> <slowest chunk dim>...<fastest chunk dim>\n");
+ HDexit(4);
+ } /* end for */
+ for(u = 0; u < ndims; u++)
+ if(0 == dim[u]) {
+ HDfprintf(stderr, "ERROR: Chunk dimensions should be >0\n");
+ HDfprintf(stderr, "B-tree chunked storage node usage:\n");
+ HDfprintf(stderr, "\th5debug <filename> <B-tree node address> <# of dimensions> <slowest chunk dim>...<fastest chunk dim>\n");
+ HDexit(4);
+ } /* end if */
+
+ /* Set the last dimension (the element size) to zero */
+ dim[ndims] = 0;
+
+ status = H5D_btree_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL, ndims, dim);
+ break;
+
+ case H5B_NUM_BTREE_ID:
+ default:
+ HDfprintf(stderr, "Unknown v1 B-tree subtype %u\n", (unsigned)(subtype));
+ HDexit(4);
+ }
+
+ } else if(!HDmemcmp(sig, H5B2_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
+ /*
+ * Debug a v2 B-tree header.
+ */
+ const H5B2_class_t *cls = get_H5B2_class(sig);
+ HDassert(cls);
+
+ if((cls == H5D_BT2 || cls == H5D_BT2_FILT) && extra == 0) {
+ HDfprintf(stderr, "ERROR: Need v2 B-tree header address and object header address containing the layout message in order to dump header\n");
+ HDfprintf(stderr, "v2 B-tree hdr usage:\n");
+ HDfprintf(stderr, "\th5debug <filename> <v2 B-tree header address> <object header address>\n");
+ HDexit(4);
+ } /* end if */
+
+ status = H5B2__hdr_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL, cls, (haddr_t)extra);
+
+ } else if(!HDmemcmp(sig, H5B2_INT_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
+ /*
+ * Debug a v2 B-tree internal node.
+ */
+ const H5B2_class_t *cls = get_H5B2_class(sig);
+ HDassert(cls);
+
+ /* Check for enough valid parameters */
+ if((cls == H5D_BT2 || cls == H5D_BT2_FILT) &&
+ (extra == 0 || extra2 == 0 || extra3 == 0 || extra4 == 0)) {
+
+ fprintf(stderr, "ERROR: Need v2 B-tree header address, the node's number of records, depth, and object header address containing the layout message in order to dump internal node\n");
+ fprintf(stderr, "NOTE: Leaf nodes are depth 0, the internal nodes above them are depth 1, etc.\n");
+ fprintf(stderr, "v2 B-tree internal node usage:\n");
+ fprintf(stderr, "\th5debug <filename> <internal node address> <v2 B-tree header address> <number of records> <depth> <object header address>\n");
+ HDexit(4);
+
+ } else if(extra == 0 || extra2 == 0 || extra3 == 0) {
+ HDfprintf(stderr, "ERROR: Need v2 B-tree header address and the node's number of records and depth in order to dump internal node\n");
+ HDfprintf(stderr, "NOTE: Leaf nodes are depth 0, the internal nodes above them are depth 1, etc.\n");
+ HDfprintf(stderr, "v2 B-tree internal node usage:\n");
+ HDfprintf(stderr, "\th5debug <filename> <internal node address> <v2 B-tree header address> <number of records> <depth>\n");
+ HDexit(4);
+ } /* end if */
+
+ status = H5B2__int_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL, cls, extra, (unsigned)extra2, (unsigned)extra3, (haddr_t)extra4);
+
+ } else if(!HDmemcmp(sig, H5B2_LEAF_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
+ /*
+ * Debug a v2 B-tree leaf node.
+ */
+ const H5B2_class_t *cls = get_H5B2_class(sig);
+ HDassert(cls);
+
+ /* Check for enough valid parameters */
+ if((cls == H5D_BT2 || cls == H5D_BT2_FILT) &&
+ (extra == 0 || extra2 == 0 || extra3 == 0 )) {
+
+ fprintf(stderr, "ERROR: Need v2 B-tree header address, number of records, and object header address containing the layout message in order to dump leaf node\n");
+ fprintf(stderr, "v2 B-tree leaf node usage:\n");
+ fprintf(stderr, "\th5debug <filename> <leaf node address> <v2 B-tree header address> <number of records> <object header address>\n");
+ HDexit(4);
+
+ } else if(extra == 0 || extra2 == 0) {
+ HDfprintf(stderr, "ERROR: Need v2 B-tree header address and number of records in order to dump leaf node\n");
+ HDfprintf(stderr, "v2 B-tree leaf node usage:\n");
+ HDfprintf(stderr, "\th5debug <filename> <leaf node address> <v2 B-tree header address> <number of records>\n");
+ HDexit(4);
+ } /* end if */
+
+ status = H5B2__leaf_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL, cls, extra, (unsigned)extra2, (haddr_t)extra3);
+
+ } else if(!HDmemcmp(sig, H5HF_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
+ /*
+ * Debug a fractal heap header.
+ */
+ status = H5HF_hdr_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL);
+
+ } else if(!HDmemcmp(sig, H5HF_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
+ /*
+ * Debug a fractal heap direct block.
+ */
+
+ /* Check for enough valid parameters */
+ if(extra == 0 || extra2 == 0) {
+ HDfprintf(stderr, "ERROR: Need fractal heap header address and size of direct block in order to dump direct block\n");
+ HDfprintf(stderr, "Fractal heap direct block usage:\n");
+ HDfprintf(stderr, "\th5debug <filename> <direct block address> <heap header address> <size of direct block>\n");
+ HDexit(4);
+ } /* end if */
+
+ status = H5HF_dblock_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL, extra, (size_t)extra2);
+
+ } else if(!HDmemcmp(sig, H5HF_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
+ /*
+ * Debug a fractal heap indirect block.
+ */
+
+ /* Check for enough valid parameters */
+ if(extra == 0 || extra2 == 0) {
+ HDfprintf(stderr, "ERROR: Need fractal heap header address and number of rows in order to dump indirect block\n");
+ HDfprintf(stderr, "Fractal heap indirect block usage:\n");
+ HDfprintf(stderr, "\th5debug <filename> <indirect block address> <heap header address> <number of rows>\n");
+ HDexit(4);
+ } /* end if */
+
+ status = H5HF_iblock_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL, extra, (unsigned)extra2);
+
+ } else if(!HDmemcmp(sig, H5FS_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
+ /*
+ * Debug a free space header.
+ */
+
+ status = H5FS_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL);
+
+ } else if(!HDmemcmp(sig, H5FS_SINFO_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
+ /*
+ * Debug free space serialized sections.
+ */
+
+ /* Check for enough valid parameters */
+ if(extra == 0 || extra2 == 0) {
+ HDfprintf(stderr, "ERROR: Need free space header address and client address in order to dump serialized sections\n");
+ HDfprintf(stderr, "Free space serialized sections usage:\n");
+ HDfprintf(stderr, "\th5debug <filename> <serialized sections address> <free space header address> <client address>\n");
+ HDexit(4);
+ } /* end if */
+
+ status = H5FS_sects_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL, extra, extra2);
+
+ } else if(!HDmemcmp(sig, H5SM_TABLE_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
+ /*
+ * Debug shared message master table.
+ */
+
+ status = H5SM_table_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL, (unsigned) UFAIL, (unsigned) UFAIL);
+
+ } else if(!HDmemcmp(sig, H5SM_LIST_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
+ /*
+ * Debug shared message list index.
+ */
+
+ /* Check for enough valid parameters */
+ if(extra == 0) {
+ HDfprintf(stderr, "ERROR: Need shared message header address in order to shared message list\n");
+ HDfprintf(stderr, "Shared message list usage:\n");
+ HDfprintf(stderr, "\th5debug <filename> <shared message list address> <shared message header address>\n");
+ HDexit(4);
+ } /* end if */
+
+ status = H5SM_list_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL, (haddr_t)extra);
+
+ } else if(!HDmemcmp(sig, H5EA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
+ /*
+ * Debug an extensible aray header.
+ */
+ const H5EA_class_t *cls = get_H5EA_class(sig);
+ HDassert(cls);
+
+ /* Check for enough valid parameters */
+ if(extra == 0) {
+ HDfprintf(stderr, "ERROR: Need object header address containing the layout message in order to dump header\n");
+ HDfprintf(stderr, "Extensible array header block usage:\n");
+ HDfprintf(stderr, "\th5debug <filename> <Extensible Array header address> <object header address>\n");
+ HDexit(4);
+ } /* end if */
+
+ status = H5EA__hdr_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL, cls, extra);
+
+ } else if(!HDmemcmp(sig, H5EA_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
+ /*
+ * Debug an extensible aray index block.
+ */
+ const H5EA_class_t *cls = get_H5EA_class(sig);
+ HDassert(cls);
+
+ /* Check for enough valid parameters */
+ if(extra == 0 || extra2 == 0) {
+ HDfprintf(stderr, "ERROR: Need extensible array header address and object header address containing the layout message in order to dump index block\n");
+ HDfprintf(stderr, "Extensible array index block usage:\n");
+ HDfprintf(stderr, "\th5debug <filename> <index block address> <array header address> <object header address\n");
+ HDexit(4);
+ } /* end if */
+
+ status = H5EA__iblock_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL, cls, extra, extra2);
+
+ } else if(!HDmemcmp(sig, H5EA_SBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
+ /*
+ * Debug an extensible aray super block.
+ */
+ const H5EA_class_t *cls = get_H5EA_class(sig);
+ HDassert(cls);
+
+ /* Check for enough valid parameters */
+ if(extra == 0 || extra2 == 0 || extra3 == 0) {
+ HDfprintf(stderr, "ERROR: Need extensible array header address, super block index and object header address containing the layout message in order to dump super block\n");
+ HDfprintf(stderr, "Extensible array super block usage:\n");
+ HDfprintf(stderr, "\th5debug <filename> <super block address> <array header address> <super block index> <object header address>\n");
+ HDexit(4);
+ } /* end if */
+
+ status = H5EA__sblock_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL, cls, extra, (unsigned)extra2, extra3);
+
+ } else if(!HDmemcmp(sig, H5EA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
+ /*
+ * Debug an extensible aray data block.
+ */
+ const H5EA_class_t *cls = get_H5EA_class(sig);
+ HDassert(cls);
+
+ /* Check for enough valid parameters */
+ if(extra == 0 || extra2 == 0 || extra3 == 0) {
+ HDfprintf(stderr, "ERROR: Need extensible array header address, # of elements in data block and object header address containing the layout message in order to dump data block\n");
+ HDfprintf(stderr, "Extensible array data block usage:\n");
+ HDfprintf(stderr, "\th5debug <filename> <data block address> <array header address> <# of elements in data block> <object header address\n");
+ HDexit(4);
+ } /* end if */
+
+ status = H5EA__dblock_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL, cls, extra, (size_t)extra2, extra3);
+
+ } else if(!HDmemcmp(sig, H5FA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
+ /*
+ * Debug a fixed array header.
+ */
+ const H5FA_class_t *cls = get_H5FA_class(sig);
+ HDassert(cls);
+
+ /* Check for enough valid parameters */
+ if(extra == 0) {
+ HDfprintf(stderr, "ERROR: Need object header address containing the layout message in order to dump header\n");
+ HDfprintf(stderr, "Fixed array header block usage:\n");
+ HDfprintf(stderr, "\th5debug <filename> <Fixed Array header address> <object header address>\n");
+ HDexit(4);
+ } /* end if */
+
+ status = H5FA__hdr_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL, cls, extra);
+
+ } else if(!HDmemcmp(sig, H5FA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
+ /*
+ * Debug a fixed array data block.
+ */
+ const H5FA_class_t *cls = get_H5FA_class(sig);
+ HDassert(cls);
+
+ /* Check for enough valid parameters */
+ if(extra == 0 || extra2 == 0) {
+ HDfprintf(stderr, "ERROR: Need fixed array header address and object header address containing the layout message in order to dump data block\n");
+ HDfprintf(stderr, "fixed array data block usage:\n");
+ HDfprintf(stderr, "\th5debug <filename> <data block address> <array header address> <object header address>\n");
+ HDexit(4);
+ } /* end if */
+
+ status = H5FA__dblock_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL, cls, extra, extra2);
+
+ } else if(!HDmemcmp(sig, H5O_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
+ /*
+ * Debug v2 object header (which have signatures).
+ */
+
+ status = H5O_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL);
+
+ } else if(sig[0] == H5O_VERSION_1) {
+ /*
+ * This could be a v1 object header. Since they don't have a signature
+ * it's a somewhat "ify" detection.
+ */
+ status = H5O_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL);
+
+ } else {
+ /*
+ * Got some other unrecognized signature.
+ */
+ printf("%-*s ", VCOL, "Signature:");
+ for (u = 0; u < sizeof(sig); u++) {
+ if (sig[u] > ' ' && sig[u] <= '~' && '\\' != sig[u])
+ HDputchar(sig[u]);
+ else if ('\\' == sig[u]) {
+ HDputchar('\\');
+ HDputchar('\\');
+ } else
+ printf("\\%03o", sig[u]);
+ }
+ HDputchar('\n');
+
+ HDfprintf(stderr, "unknown signature\n");
+ HDexit(4);
+ } /* end else */
+
+ /* Check for an error when dumping information */
+ if(status < 0) {
+ HDfprintf(stderr, "An error occurred!\n");
+ H5Eprint2(H5E_DEFAULT, stderr);
+ HDexit(5);
+ } /* end if */
+
+ H5Pclose(fapl);
+ H5Fclose(fid);
+
+ H5Eset_auto2(H5E_DEFAULT, func, edata);
+
+ return 0;
+} /* main() */
+
diff --git a/tools/src/misc/h5mkgrp.c b/tools/src/misc/h5mkgrp.c
new file mode 100644
index 0000000..ad2d306
--- /dev/null
+++ b/tools/src/misc/h5mkgrp.c
@@ -0,0 +1,336 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+
+#include "H5private.h"
+#include "h5tools.h"
+#include "h5tools_utils.h"
+#include <string.h>
+#include <stdlib.h>
+
+/* Name of tool */
+#define PROGRAMNAME "h5mkgrp"
+
+/* Exit status for tools library routines */
+int d_status = EXIT_SUCCESS;
+
+/* command-line options: short and long-named parameters */
+static const char *s_opts = "hlpvV";
+static struct long_options l_opts[] = {
+ { "help", no_arg, 'h' },
+ { "latest", no_arg, 'l' },
+ { "parents", no_arg, 'p' },
+ { "verbose", no_arg, 'v' },
+ { "version", no_arg, 'V' },
+ { NULL, 0, '\0' }
+};
+
+/* Command line parameter settings */
+typedef struct {
+ char *fname; /* File name to operate on */
+ hbool_t latest; /* Whether file should use latest format versions */
+ hbool_t verbose; /* Whether output should be verbose */
+ hbool_t parents; /* Whether to create intermediate groups */
+ size_t ngroups; /* Number of groups to create */
+ char **groups; /* Pointer to array of group names */
+} param_t;
+param_t params; /* Command line parameter settings */
+
+
+/*-------------------------------------------------------------------------
+ * Function: leave
+ *
+ * Purpose: Shutdown MPI and/or HDF5 and call exit()
+ *
+ * Return: Does not return
+ *
+ * Programmer: Quincey Koziol, 2/13/2007
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+leave(int ret)
+{
+ size_t curr_group;
+
+ if (params.fname)
+ HDfree (params.fname);
+ if (params.ngroups) {
+ for(curr_group = 0; curr_group < params.ngroups; curr_group++)
+ HDfree (params.groups[curr_group]);
+ HDfree (params.groups);
+ }
+ h5tools_close();
+ HDexit(ret);
+} /* end leave() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: usage
+ *
+ * Purpose: Prints a usage message on stderr and then returns.
+ *
+ * Return: void
+ *
+ * Programmer: Quincey Koziol, 2/13/2007
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+usage(void)
+{
+ HDfprintf(stdout, "\
+usage: h5mkgrp [OPTIONS] FILE GROUP...\n\
+ OPTIONS\n\
+ -h, --help Print a usage message and exit\n\
+ -l, --latest Use latest version of file format to create groups\n\
+ -p, --parents No error if existing, make parent groups as needed\n\
+ -v, --verbose Print information about OBJECTS and OPTIONS\n\
+ -V, --version Print version number and exit\n");
+} /* end usage() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: parse_command_line
+ *
+ * Purpose: Parses command line and sets up global variable to control output
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Quincey Koziol, 2/13/2007
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+parse_command_line(int argc, const char *argv[], param_t *parms)
+{
+ int opt; /* Option from command line */
+ size_t curr_group; /* Current group name to copy */
+
+ /* Check for empty command line */
+ if(argc == 1) {
+ usage();
+ leave(EXIT_SUCCESS);
+ } /* end if */
+
+ /* Parse command line options */
+ while((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) {
+ switch((char)opt) {
+ /* Display 'help' */
+ case 'h':
+ usage();
+ leave(EXIT_SUCCESS);
+
+ /* Create objects with the latest version of the format */
+ case 'l':
+ parms->latest = TRUE;
+ break;
+
+ /* Create parent groups */
+ case 'p':
+ parms->parents = TRUE;
+ break;
+
+ /* Verbose output */
+ case 'v':
+ parms->verbose = TRUE;
+ break;
+
+ /* Display version */
+ case 'V':
+ print_version(h5tools_getprogname());
+ leave(EXIT_SUCCESS);
+
+ /* Bad command line argument */
+ default:
+ usage();
+ leave(EXIT_FAILURE);
+ } /* end switch */
+ } /* end while */
+
+ /* Check for file name to be processed */
+ if(argc <= opt_ind) {
+ error_msg("missing file name\n");
+ usage();
+ leave(EXIT_FAILURE);
+ } /* end if */
+
+ /* Retrieve file name */
+ parms->fname = HDstrdup(argv[opt_ind]);
+ opt_ind++;
+
+ /* Check for group(s) to be created */
+ if(argc <= opt_ind) {
+ error_msg("missing group name(s)\n");
+ usage();
+ leave(EXIT_FAILURE);
+ } /* end if */
+
+ /* Allocate space for the group name pointers */
+ parms->ngroups = (size_t)(argc - opt_ind);
+ parms->groups = (char **)HDmalloc(parms->ngroups * sizeof(char *));
+
+ /* Retrieve the group names */
+ curr_group = 0;
+ while(opt_ind < argc) {
+ parms->groups[curr_group] = HDstrdup(argv[opt_ind]);
+ curr_group++;
+ opt_ind++;
+ } /* end while */
+
+#ifdef QAK
+HDfprintf(stderr, "parms->parents = %t\n", parms->parents);
+HDfprintf(stderr, "parms->verbose = %t\n", parms->verbose);
+HDfprintf(stderr, "parms->fname = '%s'\n", parms->fname);
+HDfprintf(stderr, "parms->ngroups = %Zu\n", parms->ngroups);
+for(curr_group = 0; curr_group < parms->ngroups; curr_group++)
+ HDfprintf(stderr, "parms->group[%Zu] = '%s'\n", curr_group, parms->groups[curr_group]);
+#endif /* QAK */
+
+ return(0);
+} /* parse_command_line() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: main
+ *
+ * Purpose: Create group(s) in an HDF5 file
+ *
+ * Programmer: Quincey Koziol, 2/13/2007
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+main(int argc, const char *argv[])
+{
+ hid_t fid; /* HDF5 file ID */
+ hid_t fapl_id; /* File access property list ID */
+ hid_t lcpl_id; /* Link creation property list ID */
+ size_t curr_group; /* Current group to create */
+
+ h5tools_setprogname(PROGRAMNAME);
+ h5tools_setstatus(EXIT_SUCCESS);
+
+ /* Disable the HDF5 library's error reporting */
+ H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
+
+ /* Initialize h5tools lib */
+ h5tools_init();
+
+ /* Parse command line */
+ HDmemset(&params, 0, sizeof(params));
+ if(parse_command_line(argc, argv, &params) < 0) {
+ error_msg("unable to parse command line arguments\n");
+ leave(EXIT_FAILURE);
+ } /* end if */
+
+ /* Create file access property list */
+ if((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) {
+ error_msg("Could not create file access property list\n");
+ leave(EXIT_FAILURE);
+ } /* end if */
+
+ /* Check for creating groups with new format version */
+ if(params.latest) {
+ /* Set the "use the latest version of the format" bounds */
+ if(H5Pset_libver_bounds(fapl_id, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) {
+ error_msg("Could not set property for using latest version of the format\n");
+ leave(EXIT_FAILURE);
+ } /* end if */
+
+ /* Display some output if requested */
+ if(params.verbose)
+ printf("%s: Creating groups with latest version of the format\n", h5tools_getprogname());
+ } /* end if */
+
+ /* Attempt to open an existing HDF5 file first */
+ fid = h5tools_fopen(params.fname, H5F_ACC_RDWR, fapl_id, NULL, NULL, 0);
+
+ /* If we couldn't open an existing file, try creating file */
+ /* (use "EXCL" instead of "TRUNC", so we don't blow away existing non-HDF5 file) */
+ if(fid < 0)
+ fid = H5Fcreate(params.fname, H5F_ACC_EXCL, H5P_DEFAULT, fapl_id);
+
+ /* Test for error in opening file */
+ if(fid < 0) {
+ error_msg("Could not open output file '%s'\n", params.fname);
+ leave(EXIT_FAILURE);
+ } /* end if */
+
+ /* Create link creation property list */
+ if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) {
+ error_msg("Could not create link creation property list\n");
+ leave(EXIT_FAILURE);
+ } /* end if */
+
+ /* Check for creating intermediate groups */
+ if(params.parents) {
+ /* Set the intermediate group creation property */
+ if(H5Pset_create_intermediate_group(lcpl_id, TRUE) < 0) {
+ error_msg("Could not set property for creating parent groups\n");
+ leave(EXIT_FAILURE);
+ } /* end if */
+
+ /* Display some output if requested */
+ if(params.verbose)
+ printf("%s: Creating parent groups\n", h5tools_getprogname());
+ } /* end if */
+
+ /* Loop over creating requested groups */
+ for(curr_group = 0; curr_group < params.ngroups; curr_group++) {
+ hid_t gid; /* Group ID */
+
+ /* Attempt to create a group */
+ if((gid = H5Gcreate2(fid, params.groups[curr_group], lcpl_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
+ error_msg("Could not create group '%s'\n", params.groups[curr_group]);
+ leave(EXIT_FAILURE);
+ } /* end if */
+
+ /* Close the group */
+ if(H5Gclose(gid) < 0) {
+ error_msg("Could not close group '%s'??\n", params.groups[curr_group]);
+ leave(EXIT_FAILURE);
+ } /* end if */
+
+ /* Display some output if requested */
+ if(params.verbose)
+ printf("%s: created group '%s'\n", h5tools_getprogname(), params.groups[curr_group]);
+ } /* end for */
+
+ /* Close link creation property list */
+ if(H5Pclose(lcpl_id) < 0) {
+ error_msg("Could not close link creation property list\n");
+ leave(EXIT_FAILURE);
+ } /* end if */
+
+ /* Close file */
+ if(H5Fclose(fid) < 0) {
+ error_msg("Could not close output file '%s'??\n", params.fname);
+ leave(EXIT_FAILURE);
+ } /* end if */
+
+ /* Close file access property list */
+ if(H5Pclose(fapl_id) < 0) {
+ error_msg("Could not close file access property list\n");
+ leave(EXIT_FAILURE);
+ } /* end if */
+
+ /* Shut down h5tools lib */
+ h5tools_close();
+
+ leave(EXIT_SUCCESS);
+} /* end main() */
+
diff --git a/tools/src/misc/h5redeploy.in b/tools/src/misc/h5redeploy.in
new file mode 100644
index 0000000..6b6ef87
--- /dev/null
+++ b/tools/src/misc/h5redeploy.in
@@ -0,0 +1,218 @@
+#! /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.
+#
+
+## Update HDF5 compiler tools after the HDF5 software has been installed ##
+## in a new location. ##
+## For help page, use "h5redeploy -help" ##
+## ##
+
+# Constants definitions
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+
+# Function definitions
+
+# show help page
+usage() {
+ # A wonderfully informative "usage" message.
+ echo "usage: $prog_name [OPTIONS]"
+ echo " OPTIONS:"
+ echo " -help|help This help message"
+ echo " -echo Show all the shell commands executed"
+ echo " -force No prompt, just do it"
+ echo " -prefix=DIR New directory to find HDF5 lib/ and include/"
+ echo " subdirectories [default: current directory]"
+ echo " -exec-prefix=DIR New directory to find HDF5 lib/"
+ echo " subdirectory [default: <prefix>]"
+ echo " -libdir=DIR New directory for the HDF5 lib directory"
+ echo " [default: <exec-prefix>/lib]"
+ echo " -includedir=DIR New directory for the HDF5 header files"
+ echo " [default: <prefix>/include]"
+ echo " -tool=TOOL Tool to update. TOOL must be in the current"
+ echo " directory and writable. [default: $h5tools]"
+ echo " -show Show the commands without executing them"
+ echo " "
+ exit $EXIT_FAILURE
+}
+
+# display variable values
+dump_vars(){
+ echo "====Showing all variable values====="
+ echo prefix=$prefix
+ echo h5tools=$h5tools
+ echo "====End Showing====="
+}
+
+# show actions to be taken
+show_action()
+{
+ echo "Update the following tools because they are now installed at a new directory"
+ for t in $foundtools; do
+ echo "${t}:"
+ echo " current setting=`sed -e '/^prefix=/s/prefix=//p' -e d $t`"
+ echo " new setting="\""$prefix"\"
+ done
+}
+
+
+# Report Error message
+ERROR()
+{
+ echo "***ERROR***"
+ echo "$1"
+}
+
+# Main
+#
+############################################################################
+## Installation directories: ##
+## prefix architecture-independent files. ##
+## exec_prefix architecture-dependent files, default is <prefix>. ##
+## libdir libraries, default is <exec_prefix>/lib. ##
+## includedir header files, default is <prefix/include>. ##
+## Not used here: ##
+## bindir executables, <exec_prefix/bin>. ##
+############################################################################
+# Initialization
+h5tools="h5cc h5pcc h5fc h5pfc h5c++" # possible hdf5 tools
+foundtools= # tools found and will be modified
+fmode= # force mode, default is off
+prefix=
+exec_prefix=
+libdir=
+includedir=
+
+# Parse options
+for arg in $@ ; do
+ case "$arg" in
+ -prefix=*)
+ prefix="`echo $arg | cut -f2 -d=`"
+ ;;
+ -exec-prefix=*)
+ exec_prefix="`echo $arg | cut -f2 -d=`"
+ ;;
+ -libdir=*)
+ libdir="`echo $arg | cut -f2 -d=`"
+ ;;
+ -includedir=*)
+ includedir="`echo $arg | cut -f2 -d=`"
+ ;;
+ -echo)
+ set -x
+ ;;
+ -show)
+ SHOW="echo"
+ ;;
+ -tool=*)
+ h5tools="`echo $arg | cut -f2 -d=`"
+ ;;
+ -help|help)
+ usage
+ ;;
+ -force)
+ fmode=yes
+ ;;
+ *)
+ ERROR "Unknown Option($arg)"
+ usage
+ exit $EXIT_FAILURE
+ ;;
+ esac
+done
+
+# Set to default value, one above where i am, if not given by user
+if [ -z "$prefix" ]; then
+ prefix=`(cd ..;pwd)`
+fi
+if [ -z "$exec_prefix" ]; then
+ exec_prefix='${prefix}' # use single quotes to prevent expansion of $
+fi
+if [ -z "$libdir" ]; then
+ libdir='${exec_prefix}'/lib # use single quotes to prevent expansion of $
+fi
+if [ -z "$includedir" ]; then
+ includedir='${prefix}'/include # use single quotes to prevent expansion of $
+fi
+
+for x in $h5tools; do
+ if [ -f $x ]; then
+ foundtools="$foundtools $x"
+ if [ ! -w $x ]; then
+ ERROR "h5tool($x) is not writable"
+ exit $EXIT_FAILURE
+ fi
+ fi
+done
+
+if [ -z "$foundtools" ]; then
+ ERROR "found no tools to modify"
+ exit $EXIT_FAILURE
+fi
+
+# Show actions to be taken and get consent
+show_action
+# Ask confirmation unless fmode is on
+if [ x-$fmode = x- ]; then
+ echo "Continue? (yes/no)"
+ read ansx
+ ans=`echo $ansx | tr "[A-Z]" "[a-z]"`
+ if [ x-$ans != x-yes ]; then
+ echo ABORT. No tools changed.
+ exit $EXIT_FAILURE
+ fi
+fi
+
+
+# Create the update commands
+CMDFILE=/tmp/h5redeploy.$$
+touch $CMDFILE
+chmod 0600 $CMDFILE
+echo "/^prefix=/c" >> $CMDFILE
+echo prefix=\""$prefix"\" >> $CMDFILE
+echo . >> $CMDFILE
+echo "/^exec_prefix=/c" >> $CMDFILE
+echo exec_prefix=\""$exec_prefix"\" >> $CMDFILE
+echo . >> $CMDFILE
+echo "/^libdir=/c" >> $CMDFILE
+echo libdir=\""$libdir"\" >> $CMDFILE
+echo . >> $CMDFILE
+echo "/^includedir=/c" >> $CMDFILE
+echo includedir=\""$includedir"\" >> $CMDFILE
+echo . >> $CMDFILE
+(echo w; echo q) >> $CMDFILE
+
+
+# Update them
+if [ "$SHOW" = "echo" ]; then
+ echo "===Update commands are:===="
+ cat $CMDFILE
+ echo "===End Update commands====="
+fi
+
+for t in $foundtools; do
+ echo Update $t ...
+ COMMAND="ed - $t"
+ if [ "$SHOW" = "echo" ]; then
+ echo $COMMAND
+ else
+ $COMMAND < $CMDFILE
+ fi
+done
+
+
+# Cleanup
+rm -f $CMDFILE
+exit $EXIT_SUCCESS
diff --git a/tools/src/misc/h5repart.c b/tools/src/misc/h5repart.c
new file mode 100644
index 0000000..e44c957
--- /dev/null
+++ b/tools/src/misc/h5repart.c
@@ -0,0 +1,510 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Programmer: Robb Matzke <matzke@llnl.gov>
+ * Wednesday, May 13, 1998
+ *
+ * Purpose: Repartitions a file family. This program can be used to
+ * split a single file into a family of files, join a family of
+ * files into a single file, or copy one family to another while
+ * changing the size of the family members. It can also be used
+ * to copy a single file to a single file with holes.
+ */
+
+/* See H5private.h for how to include system headers */
+#include "hdf5.h"
+#include "H5private.h"
+#ifdef H5_STDC_HEADERS
+# include <ctype.h>
+# include <errno.h>
+# include <fcntl.h>
+# include <stdio.h>
+# include <stdlib.h>
+# include <string.h>
+#endif
+
+#ifdef H5_HAVE_UNISTD_H
+# include <sys/types.h>
+# include <unistd.h>
+#endif
+
+#ifdef H5_HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#ifndef FALSE
+# define FALSE 0
+#endif
+#ifndef TRUE
+# define TRUE 1
+#endif
+# define NAMELEN 4096
+#define GB *1024*1024*1024
+
+#ifndef MIN
+# define MIN(X,Y) ((X)<(Y)?(X):(Y))
+#endif
+#ifndef MIN3
+# define MIN3(X,Y,Z) MIN(MIN(X,Y),Z)
+#endif
+
+/*Make these 2 private properties(defined in H5Fprivate.h) available to h5repart.
+ *The first one updates the member file size in the superblock. The second one
+ *change file driver from family to sec2. */
+#define H5F_ACS_FAMILY_NEWSIZE_NAME "family_newsize"
+#define H5F_ACS_FAMILY_TO_SEC2_NAME "family_to_sec2"
+
+
+/*-------------------------------------------------------------------------
+ * Function: usage
+ *
+ * Purpose: Prints a usage message.
+ *
+ * Return: void
+ *
+ * Programmer: Robb Matzke
+ * Wednesday, May 13, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+usage (const char *progname)
+{
+ fprintf(stderr, "usage: %s [-v] [-V] [-[b|m] N[g|m|k]] [-family_to_sec2] SRC DST\n",
+ progname);
+ fprintf(stderr, " -v Produce verbose output\n");
+ fprintf(stderr, " -V Print a version number and exit\n");
+ fprintf(stderr, " -b N The I/O block size, defaults to 1kB\n");
+ fprintf(stderr, " -m N The destination member size or 1GB\n");
+ fprintf(stderr, " -family_to_sec2 Change file driver from family to sec2\n");
+ fprintf(stderr, " SRC The name of the source file\n");
+ fprintf(stderr, " DST The name of the destination files\n");
+ fprintf(stderr, "Sizes may be suffixed with `g' for GB, `m' for MB or "
+ "`k' for kB.\n");
+ fprintf(stderr, "File family names include an integer printf "
+ "format such as `%%d'\n");
+ exit (EXIT_FAILURE);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: get_size
+ *
+ * Purpose: Reads a size option of the form `-XNS' where `X' is any
+ * letter, `N' is a multi-character positive decimal number, and
+ * `S' is an optional suffix letter in the set [GgMmk]. The
+ * option may also be split among two arguments as: `-X NS'.
+ * The input value of ARGNO is the argument number for the
+ * switch in the ARGV vector and ARGC is the number of entries
+ * in that vector.
+ *
+ * Return: Success: The value N multiplied according to the
+ * suffix S. On return ARGNO will be the number
+ * of the next argument to process.
+ *
+ * Failure: Calls usage() which exits with a non-zero
+ * status.
+ *
+ * Programmer: Robb Matzke
+ * Wednesday, May 13, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static off_t
+get_size (const char *progname, int *argno, int argc, char *argv[])
+{
+ off_t retval=-1;
+ char *suffix;
+
+ if (isdigit ((int)(argv[*argno][2]))) {
+ retval = strtol (argv[*argno]+2, &suffix, 10);
+ (*argno)++;
+ } else if (argv[*argno][2] || *argno+1>=argc) {
+ usage (progname);
+ } else {
+ retval = strtol (argv[*argno+1], &suffix, 0);
+ if (suffix==argv[*argno+1]) usage (progname);
+ *argno += 2;
+ }
+ if (suffix && suffix[0] && !suffix[1]) {
+ switch (*suffix) {
+ case 'G':
+ case 'g':
+ retval *= 1024 * 1024 * 1024;
+ break;
+ case 'M':
+ case 'm':
+ retval *= 1024 * 1024;
+ break;
+ case 'k':
+ retval *= 1024;
+ break;
+ default:
+ usage (progname);
+ }
+ } else if (suffix && suffix[0]) {
+ usage (progname);
+ }
+ return retval;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: main
+ *
+ * Purpose: Split an hdf5 file
+ *
+ * Return: Success:
+ *
+ * Failure:
+ *
+ * Programmer: Robb Matzke
+ * Wednesday, May 13, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+main (int argc, char *argv[])
+{
+ const char *prog_name; /*program name */
+ size_t blk_size=1024; /*size of each I/O block */
+ char *buf=NULL; /*I/O block buffer */
+ size_t n, i; /*counters */
+ ssize_t nio; /*I/O return value */
+ int argno=1; /*program argument number */
+ int src, dst=-1; /*source & destination files */
+ int need_seek=FALSE; /*destination needs to seek? */
+ int need_write; /*data needs to be written? */
+ h5_stat_t sb; /*temporary file stat buffer */
+
+ int verbose=FALSE; /*display file names? */
+
+ const char *src_gen_name; /*general source name */
+ char *src_name=NULL; /*source member name */
+
+ int src_is_family; /*is source name a family name? */
+ int src_membno=0; /*source member number */
+
+ const char *dst_gen_name; /*general destination name */
+ char *dst_name=NULL; /*destination member name */
+ int dst_is_family; /*is dst name a family name? */
+ int dst_membno=0; /*destination member number */
+
+ off_t left_overs=0; /*amount of zeros left over */
+ off_t src_offset=0; /*offset in source member */
+ off_t dst_offset=0; /*offset in destination member */
+ off_t src_size; /*source logical member size */
+ off_t src_act_size; /*source actual member size */
+ off_t dst_size=1 GB; /*destination logical memb size */
+ hid_t fapl; /*file access property list */
+ hid_t file;
+ hsize_t hdsize; /*destination logical memb size */
+ hbool_t family_to_sec2=FALSE; /*change family to sec2 driver? */
+
+ /*
+ * Get the program name from argv[0]. Use only the last component.
+ */
+ if ((prog_name=strrchr (argv[0], '/'))) prog_name++;
+ else prog_name = argv[0];
+
+ /*
+ * Parse switches.
+ */
+ while (argno<argc && '-'==argv[argno][0]) {
+ if (!strcmp (argv[argno], "-v")) {
+ verbose = TRUE;
+ argno++;
+ } else if (!strcmp(argv[argno], "-V")) {
+ printf("This is %s version %u.%u release %u\n",
+ prog_name, H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE);
+ exit(EXIT_SUCCESS);
+ } else if (!strcmp (argv[argno], "-family_to_sec2")) {
+ family_to_sec2 = TRUE;
+ argno++;
+ } else if ('b'==argv[argno][1]) {
+ blk_size = (size_t)get_size (prog_name, &argno, argc, argv);
+ } else if ('m'==argv[argno][1]) {
+ dst_size = get_size (prog_name, &argno, argc, argv);
+ } else {
+ usage (prog_name);
+ } /* end if */
+ } /* end while */
+
+ /* allocate names */
+ if(NULL == (src_name = (char *)HDcalloc((size_t)NAMELEN, sizeof(char))))
+ exit(EXIT_FAILURE);
+ if(NULL == (dst_name = (char *)HDcalloc((size_t)NAMELEN, sizeof(char))))
+ exit(EXIT_FAILURE);
+
+ /*
+ * Get the name for the source file and open the first member. The size
+ * of the first member determines the logical size of all the members.
+ */
+ if (argno>=argc) usage (prog_name);
+ src_gen_name = argv[argno++];
+ sprintf (src_name, src_gen_name, src_membno);
+ src_is_family = strcmp (src_name, src_gen_name);
+
+ if ((src=HDopen(src_name, O_RDONLY,0))<0) {
+ perror (src_name);
+ exit (EXIT_FAILURE);
+ }
+
+ if (HDfstat(src, &sb)<0) {
+ perror ("fstat");
+ exit (EXIT_FAILURE);
+ }
+ src_size = src_act_size = sb.st_size;
+ if (verbose) fprintf (stderr, "< %s\n", src_name);
+
+ /*
+ * Get the name for the destination file and open the first member.
+ */
+ if (argno>=argc) usage (prog_name);
+ dst_gen_name = argv[argno++];
+ sprintf (dst_name, dst_gen_name, dst_membno);
+ dst_is_family = strcmp (dst_name, dst_gen_name);
+
+ if ((dst=HDopen (dst_name, O_RDWR|O_CREAT|O_TRUNC, 0666))<0) {
+ perror (dst_name);
+ exit (EXIT_FAILURE);
+ }
+ if (verbose) fprintf (stderr, "> %s\n", dst_name);
+
+ /* No more arguments */
+ if (argno<argc) usage (prog_name);
+
+ /* Now the real work, split the file */
+ buf = (char *)HDmalloc(blk_size);
+ while (src_offset<src_size) {
+
+ /* Read a block. The amount to read is the minimum of:
+ * 1. The I/O block size
+ * 2. What's left to write in the destination member
+ * 3. Left over zeros or what's left in the source member.
+ */
+ n = blk_size;
+ if (dst_is_family) n = (size_t)MIN((off_t)n, dst_size-dst_offset);
+ if (left_overs) {
+ n = (size_t)MIN ((off_t)n, left_overs);
+ left_overs = left_overs - (off_t)n;
+ need_write = FALSE;
+ } else if (src_offset<src_act_size) {
+ n = (size_t)MIN ((off_t)n, src_act_size-src_offset);
+ if ((nio=HDread (src, buf, n))<0) {
+ perror ("read");
+ exit (EXIT_FAILURE);
+ } else if ((size_t)nio!=n) {
+ fprintf (stderr, "%s: short read\n", src_name);
+ exit (EXIT_FAILURE);
+ }
+ for (i=0; i<n; i++) {
+ if (buf[i]) break;
+ }
+ need_write = (i<n);
+ } else {
+ n = 0;
+ left_overs = src_size - src_act_size;
+ need_write = FALSE;
+ }
+
+ /*
+ * If the block contains non-zero data then write it to the
+ * destination, otherwise just remember that we'll have to do a seek
+ * later in the destination when we finally get non-zero data.
+ */
+ if (need_write) {
+ if (need_seek && HDlseek (dst, dst_offset, SEEK_SET)<0) {
+ perror ("HDlseek");
+ exit (EXIT_FAILURE);
+ }
+ if ((nio=HDwrite (dst, buf, n))<0) {
+ perror ("write");
+ exit (EXIT_FAILURE);
+ } else if ((size_t)nio!=n) {
+ fprintf (stderr, "%s: short write\n", dst_name);
+ exit (EXIT_FAILURE);
+ }
+ need_seek = FALSE;
+ } else {
+ need_seek = TRUE;
+ }
+
+ /*
+ * Update the source offset and open the next source family member if
+ * necessary. The source stream ends at the first member which
+ * cannot be opened because it doesn't exist. At the end of the
+ * source stream, update the destination offset and break out of the
+ * loop. The destination offset must be updated so we can fix
+ * trailing holes.
+ */
+ src_offset = src_offset + (off_t)n;
+ if (src_offset==src_act_size) {
+ HDclose (src);
+ if (!src_is_family) {
+ dst_offset = dst_offset + (off_t)n;
+ break;
+ }
+ sprintf (src_name, src_gen_name, ++src_membno);
+ if ((src=HDopen (src_name, O_RDONLY,0))<0 && ENOENT==errno) {
+ dst_offset = dst_offset + (off_t)n;
+ break;
+ } else if (src<0) {
+ perror (src_name);
+ exit (EXIT_FAILURE);
+ }
+ if (HDfstat (src, &sb)<0) {
+ perror ("fstat");
+ exit (EXIT_FAILURE);
+ }
+ src_act_size = sb.st_size;
+ if (src_act_size>src_size) {
+ fprintf (stderr, "%s: member truncated to %lu bytes\n",
+ src_name, (unsigned long)src_size);
+ }
+ src_offset = 0;
+ if (verbose) fprintf (stderr, "< %s\n", src_name);
+ }
+
+ /*
+ * Update the destination offset, opening a new member if one will be
+ * needed. The first member is extended to the logical member size
+ * but other members might be smaller if they end with a hole.
+ */
+ dst_offset = dst_offset + (off_t)n;
+ if (dst_is_family && dst_offset==dst_size) {
+ if (0==dst_membno) {
+ if (HDlseek (dst, dst_size-1, SEEK_SET)<0) {
+ perror ("HDHDlseek");
+ exit (EXIT_FAILURE);
+ }
+ if (HDread (dst, buf, 1)<0) {
+ perror ("read");
+ exit (EXIT_FAILURE);
+ }
+ if (HDlseek (dst, dst_size-1, SEEK_SET)<0) {
+ perror ("HDlseek");
+ exit (EXIT_FAILURE);
+ }
+ if (HDwrite (dst, buf, 1)<0) {
+ perror ("write");
+ exit (EXIT_FAILURE);
+ }
+ }
+ HDclose (dst);
+ sprintf (dst_name, dst_gen_name, ++dst_membno);
+ if ((dst=HDopen (dst_name, O_RDWR|O_CREAT|O_TRUNC, 0666))<0) {
+ perror (dst_name);
+ exit (EXIT_FAILURE);
+ }
+ dst_offset = 0;
+ need_seek = FALSE;
+ if (verbose) fprintf (stderr, "> %s\n", dst_name);
+ }
+ }
+
+ /*
+ * Make sure the last family member is the right size and then close it.
+ * The last member can't end with a hole or hdf5 will think that the
+ * family has been truncated.
+ */
+ if (need_seek) {
+ if (HDlseek (dst, dst_offset-1, SEEK_SET)<0) {
+ perror ("HDlseek");
+ exit (EXIT_FAILURE);
+ }
+ if (HDread (dst, buf, 1)<0) {
+ perror ("read");
+ exit (EXIT_FAILURE);
+ }
+ if (HDlseek (dst, dst_offset-1, SEEK_SET)<0) {
+ perror ("HDlseek");
+ exit (EXIT_FAILURE);
+ }
+ if (HDwrite (dst, buf, 1)<0) {
+ perror ("write");
+ exit (EXIT_FAILURE);
+ }
+ }
+ HDclose (dst);
+
+ /* Modify family driver information saved in superblock through private property.
+ * These private properties are for this tool only. */
+ if ((fapl=H5Pcreate(H5P_FILE_ACCESS))<0) {
+ perror ("H5Pcreate");
+ exit (EXIT_FAILURE);
+ }
+
+ if(family_to_sec2) {
+ /* The user wants to change file driver from family to sec2. Open the file
+ * with sec2 driver. This property signals the library to ignore the family
+ * driver information saved in the superblock. */
+ if(H5Pset(fapl, H5F_ACS_FAMILY_TO_SEC2_NAME, &family_to_sec2) < 0) {
+ perror ("H5Pset");
+ exit (EXIT_FAILURE);
+ }
+ } else {
+ /* Modify family size saved in superblock through private property. It signals
+ * library to save the new member size(specified in command line) in superblock.
+ * This private property is for this tool only. */
+ if(H5Pset_fapl_family(fapl, H5F_FAMILY_DEFAULT, H5P_DEFAULT) < 0) {
+ perror ("H5Pset_fapl_family");
+ exit (EXIT_FAILURE);
+ }
+
+ /* Set the property of the new member size as hsize_t */
+ hdsize = (hsize_t)dst_size;
+ if(H5Pset(fapl, H5F_ACS_FAMILY_NEWSIZE_NAME, &hdsize) < 0) {
+ perror ("H5Pset");
+ exit (EXIT_FAILURE);
+ }
+ }
+
+ /* If the new file is a family file, try to open file for "read and write" to
+ * flush metadata. Flushing metadata will update the superblock to the new
+ * member size. If the original file is a family file and the new file is a sec2
+ * file, the property FAMILY_TO_SEC2 will signal the library to switch to sec2
+ * driver when the new file is opened. If the original file is a sec2 file and the
+ * new file can only be a sec2 file, reopen the new file should fail. There's
+ * nothing to do in this case. */
+ H5E_BEGIN_TRY {
+ file=H5Fopen(dst_gen_name, H5F_ACC_RDWR, fapl);
+ } H5E_END_TRY;
+
+ if(file>=0) {
+ if(H5Fclose(file)<0) {
+ perror ("H5Fclose");
+ exit (EXIT_FAILURE);
+ } /* end if */
+ } /* end if */
+
+ if(H5Pclose(fapl)<0) {
+ perror ("H5Pclose");
+ exit (EXIT_FAILURE);
+ } /* end if */
+
+ /* Free resources and return */
+ HDfree(src_name);
+ HDfree(dst_name);
+ HDfree(buf);
+ return EXIT_SUCCESS;
+} /* end main */
diff --git a/tools/test/CMakeLists.txt b/tools/test/CMakeLists.txt
new file mode 100644
index 0000000..608dd6e
--- /dev/null
+++ b/tools/test/CMakeLists.txt
@@ -0,0 +1,40 @@
+cmake_minimum_required (VERSION 3.1.0)
+PROJECT (HDF5_TOOLS_TEST)
+
+#-----------------------------------------------------------------------------
+# Apply Definitions to compiler in this directory and below
+#-----------------------------------------------------------------------------
+add_definitions (${HDF_EXTRA_C_FLAGS})
+
+#-- Add the h5diff tests
+add_subdirectory (${HDF5_TOOLS_TEST_SOURCE_DIR}/h5diff)
+
+#-- Add the h5ls tests
+add_subdirectory (${HDF5_TOOLS_TEST_SOURCE_DIR}/h5ls)
+
+#-- Misc tests
+add_subdirectory (${HDF5_TOOLS_TEST_SOURCE_DIR}/misc)
+
+#-- Add the h5import tests
+add_subdirectory (${HDF5_TOOLS_TEST_SOURCE_DIR}/h5import)
+
+#-- h5Repack tests
+add_subdirectory (${HDF5_TOOLS_TEST_SOURCE_DIR}/h5repack)
+
+#-- Add the h5jam tests
+add_subdirectory (${HDF5_TOOLS_TEST_SOURCE_DIR}/h5jam)
+
+#-- Add the h5copy tests
+add_subdirectory (${HDF5_TOOLS_TEST_SOURCE_DIR}/h5copy)
+
+#-- Add the h5stat tests
+add_subdirectory (${HDF5_TOOLS_TEST_SOURCE_DIR}/h5stat)
+
+#-- Add the h5dump tests
+add_subdirectory (${HDF5_TOOLS_TEST_SOURCE_DIR}/h5dump)
+
+#-- Add the h5format_convert and test executables
+add_subdirectory (${HDF5_TOOLS_TEST_SOURCE_DIR}/h5format_convert)
+
+#-- Add the perform tests
+add_subdirectory (${HDF5_TOOLS_TEST_SOURCE_DIR}/perform)
diff --git a/tools/test/Makefile.am b/tools/test/Makefile.am
new file mode 100644
index 0000000..62193ba
--- /dev/null
+++ b/tools/test/Makefile.am
@@ -0,0 +1,30 @@
+#
+# 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.
+##
+## Makefile.am
+## Run automake to generate a Makefile.in from this file.
+##
+#
+# Tools HDF5 Makefile(.in)
+#
+
+include $(top_srcdir)/config/commence.am
+
+CONFIG=ordered
+
+# All subdirectories
+SUBDIRS=h5diff h5ls h5dump misc h5import h5repack h5jam h5copy h5stat \
+ perform
+
+include $(top_srcdir)/config/conclude.am
diff --git a/tools/test/h5copy/CMakeLists.txt b/tools/test/h5copy/CMakeLists.txt
new file mode 100644
index 0000000..5bab57b
--- /dev/null
+++ b/tools/test/h5copy/CMakeLists.txt
@@ -0,0 +1,23 @@
+cmake_minimum_required (VERSION 3.1.0)
+PROJECT (HDF5_TOOLS_TEST_H5COPY)
+
+#-----------------------------------------------------------------------------
+# Setup include Directories
+#-----------------------------------------------------------------------------
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib)
+
+# --------------------------------------------------------------------
+# Add the h5copy test executables
+# --------------------------------------------------------------------
+
+ if (HDF5_BUILD_GENERATORS)
+ add_executable (h5copygentest ${HDF5_TOOLS_TEST_H5COPY_SOURCE_DIR}/h5copygentest.c)
+ TARGET_NAMING (h5copygentest STATIC)
+ TARGET_C_PROPERTIES (h5copygentest STATIC " " " ")
+ target_link_libraries (h5copygentest ${HDF5_LIB_TARGET})
+ set_target_properties (h5copygentest PROPERTIES FOLDER generator/tools)
+
+ #add_test (NAME h5copygentest COMMAND $<TARGET_FILE:h5copygentest>)
+ endif (HDF5_BUILD_GENERATORS)
+
+ include (CMakeTests.cmake)
diff --git a/tools/test/h5copy/CMakeTests.cmake b/tools/test/h5copy/CMakeTests.cmake
new file mode 100644
index 0000000..fe36ca9
--- /dev/null
+++ b/tools/test/h5copy/CMakeTests.cmake
@@ -0,0 +1,373 @@
+
+##############################################################################
+##############################################################################
+### T E S T I N G ###
+##############################################################################
+##############################################################################
+
+ # --------------------------------------------------------------------
+ # Copy all the HDF5 files from the source directory into the test directory
+ # --------------------------------------------------------------------
+ set (LIST_HDF5_TEST_FILES
+ ${HDF5_TOOLS_TEST_H5COPY_SOURCE_DIR}/testfiles/h5copy_extlinks_src.h5
+ ${HDF5_TOOLS_TEST_H5COPY_SOURCE_DIR}/testfiles/h5copy_extlinks_trg.h5
+ ${HDF5_TOOLS_TEST_H5COPY_SOURCE_DIR}/testfiles/h5copy_ref.h5
+ ${HDF5_TOOLS_TEST_H5COPY_SOURCE_DIR}/testfiles/h5copytst.h5
+ )
+
+ set (LIST_OTHER_TEST_FILES
+ ${HDF5_TOOLS_TEST_H5COPY_SOURCE_DIR}/testfiles/h5copy_misc1.out
+ )
+
+ file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
+
+ foreach (listfiles ${LIST_HDF5_TEST_FILES} ${LIST_OTHER_TEST_FILES})
+ get_filename_component(fname "${listfiles}" NAME)
+ HDFTEST_COPY_FILE("${listfiles}" "${PROJECT_BINARY_DIR}/testfiles/${fname}" "h5copy_files")
+ endforeach (listfiles ${LIST_HDF5_TEST_FILES} ${LIST_OTHER_TEST_FILES})
+ add_custom_target(h5copy_files ALL COMMENT "Copying files needed by h5copy tests" DEPENDS ${h5copy_files_list})
+
+##############################################################################
+##############################################################################
+### T H E T E S T S M A C R O S ###
+##############################################################################
+##############################################################################
+
+ #
+ # Perform h5copy according to passing parmeters
+ #
+ MACRO (ADD_H5_F_TEST testname resultcode infile fparam vparam sparam srcname dparam dstname)
+ if (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ # Remove any output file left over from previous test run
+ add_test (
+ NAME H5COPY_F-${testname}-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ ./testfiles/${testname}.out.h5
+ )
+ endif (NOT HDF5_ENABLE_USING_MEMCHECKER)
+
+ add_test (
+ NAME H5COPY_F-${testname}
+ COMMAND $<TARGET_FILE:h5copy> -f ${fparam} -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN}
+ )
+ if (HDF5_ENABLE_USING_MEMCHECKER)
+ if (NOT "${last_test}" STREQUAL "")
+ set_tests_properties (H5COPY_F-${testname} PROPERTIES DEPENDS ${last_test})
+ endif (NOT "${last_test}" STREQUAL "")
+ else (HDF5_ENABLE_USING_MEMCHECKER)
+ set_tests_properties (H5COPY_F-${testname} PROPERTIES DEPENDS H5COPY_F-${testname}-clear-objects)
+ endif (HDF5_ENABLE_USING_MEMCHECKER)
+
+ # resultcode=2 will cause the test to skip the diff test
+ if (NOT ${resultcode} STREQUAL "2")
+ add_test (
+ NAME H5COPY_F-${testname}-DIFF
+ COMMAND $<TARGET_FILE:h5diff> -q ./testfiles/${infile} ./testfiles/${testname}.out.h5 ${srcname} ${dstname}
+ )
+ SET_TESTS_PROPERTIES(H5COPY_F-${testname}-DIFF PROPERTIES DEPENDS H5COPY_F-${testname})
+ if (${resultcode} STREQUAL "1")
+ set_tests_properties (H5COPY_F-${testname}-DIFF PROPERTIES WILL_FAIL "true")
+ endif (${resultcode} STREQUAL "1")
+ endif (NOT ${resultcode} STREQUAL "2")
+ ENDMACRO (ADD_H5_F_TEST)
+
+ MACRO (ADD_H5_TEST testname resultcode infile vparam sparam srcname dparam dstname)
+ if (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ # Remove any output file left over from previous test run
+ add_test (
+ NAME H5COPY-${testname}-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ ./testfiles/${testname}.out.h5
+ )
+ endif (NOT HDF5_ENABLE_USING_MEMCHECKER)
+
+ add_test (
+ NAME H5COPY-${testname}
+ COMMAND $<TARGET_FILE:h5copy> -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN}
+ )
+ if (HDF5_ENABLE_USING_MEMCHECKER)
+ if (NOT "${last_test}" STREQUAL "")
+ set_tests_properties (H5COPY-${testname} PROPERTIES DEPENDS ${last_test})
+ endif (NOT "${last_test}" STREQUAL "")
+ else (HDF5_ENABLE_USING_MEMCHECKER)
+ set_tests_properties (H5COPY-${testname} PROPERTIES DEPENDS H5COPY-${testname}-clear-objects)
+ endif (HDF5_ENABLE_USING_MEMCHECKER)
+
+ # resultcode=2 will cause the test to skip the diff test
+ if (NOT ${resultcode} STREQUAL "2")
+ add_test (
+ NAME H5COPY-${testname}-DIFF
+ COMMAND $<TARGET_FILE:h5diff> -q ./testfiles/${infile} ./testfiles/${testname}.out.h5 ${srcname} ${dstname}
+ )
+ SET_TESTS_PROPERTIES(H5COPY-${testname}-DIFF PROPERTIES DEPENDS H5COPY-${testname})
+ if (${resultcode} STREQUAL "1")
+ set_tests_properties (H5COPY-${testname}-DIFF PROPERTIES WILL_FAIL "true")
+ endif (${resultcode} STREQUAL "1")
+ endif (NOT ${resultcode} STREQUAL "2")
+ ENDMACRO (ADD_H5_TEST)
+
+ MACRO (ADD_H5_TEST2 testname resultcode infile psparam pdparam vparam sparam srcname dparam dstname)
+ if (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ # Remove any output file left over from previous test run
+ add_test (
+ NAME H5COPY-${testname}-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ ./testfiles/${testname}.out.h5
+ )
+ endif (NOT HDF5_ENABLE_USING_MEMCHECKER)
+
+ add_test (
+ NAME H5COPY-${testname}-prefill
+ COMMAND $<TARGET_FILE:h5copy> -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 -v -s ${psparam} -d ${pdparam}
+ )
+ if (HDF5_ENABLE_USING_MEMCHECKER)
+ if (NOT "${last_test}" STREQUAL "")
+ set_tests_properties (H5COPY-${testname}-prefill PROPERTIES DEPENDS ${last_test})
+ endif (NOT "${last_test}" STREQUAL "")
+ else (HDF5_ENABLE_USING_MEMCHECKER)
+ set_tests_properties (H5COPY-${testname}-prefill PROPERTIES DEPENDS H5COPY-${testname}-clear-objects)
+ endif (HDF5_ENABLE_USING_MEMCHECKER)
+
+ add_test (
+ NAME H5COPY-${testname}
+ COMMAND $<TARGET_FILE:h5copy> -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN}
+ )
+ set_tests_properties (H5COPY-${testname} PROPERTIES DEPENDS H5COPY-${testname}-prefill)
+ # resultcode=2 will cause the test to skip the diff test
+ if (NOT ${resultcode} STREQUAL "2")
+ add_test (
+ NAME H5COPY-${testname}-DIFF
+ COMMAND $<TARGET_FILE:h5diff> -q ./testfiles/${infile} ./testfiles/${testname}.out.h5 ${srcname} ${dstname}
+ )
+ SET_TESTS_PROPERTIES(H5COPY-${testname}-DIFF PROPERTIES DEPENDS H5COPY-${testname})
+ if (${resultcode} STREQUAL "1")
+ set_tests_properties (H5COPY-${testname}-DIFF PROPERTIES WILL_FAIL "true")
+ endif (${resultcode} STREQUAL "1")
+ endif (NOT ${resultcode} STREQUAL "2")
+ ENDMACRO (ADD_H5_TEST2)
+
+ MACRO (ADD_H5_TEST_SAME testname resultcode pfile psparam pdparam vparam sparam srcname dparam dstname)
+ if (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ # Remove any output file left over from previous test run
+ add_test (
+ NAME H5COPY_SAME-${testname}-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ ./testfiles/${testname}.out.h5
+ )
+ endif (NOT HDF5_ENABLE_USING_MEMCHECKER)
+
+ add_test (
+ NAME H5COPY_SAME-${testname}-prefill
+ COMMAND $<TARGET_FILE:h5copy> -i ./testfiles/${pfile} -o ./testfiles/${testname}.out.h5 -v -s ${psparam} -d ${pdparam}
+ )
+ if (HDF5_ENABLE_USING_MEMCHECKER)
+ if (NOT "${last_test}" STREQUAL "")
+ set_tests_properties (H5COPY_SAME-${testname}-prefill PROPERTIES DEPENDS ${last_test})
+ endif (NOT "${last_test}" STREQUAL "")
+ else (HDF5_ENABLE_USING_MEMCHECKER)
+ set_tests_properties (H5COPY_SAME-${testname}-prefill PROPERTIES DEPENDS H5COPY_SAME-${testname}-clear-objects)
+ endif (HDF5_ENABLE_USING_MEMCHECKER)
+
+ add_test (
+ NAME H5COPY_SAME-${testname}
+ COMMAND $<TARGET_FILE:h5copy> -i ./testfiles/${testname}.out.h5 -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN}
+ )
+ set_tests_properties (H5COPY_SAME-${testname} PROPERTIES DEPENDS H5COPY_SAME-${testname}-prefill)
+ # resultcode=2 will cause the test to skip the diff test
+ if (NOT ${resultcode} STREQUAL "2")
+ add_test (
+ NAME H5COPY_SAME-${testname}-DIFF
+ COMMAND $<TARGET_FILE:h5diff> -q ./testfiles/${testname}.out.h5 ./testfiles/${testname}.out.h5 ${srcname} ${dstname}
+ )
+ SET_TESTS_PROPERTIES(H5COPY_SAME-${testname}-DIFF PROPERTIES DEPENDS H5COPY_SAME-${testname})
+ if (${resultcode} STREQUAL "1")
+ set_tests_properties (H5COPY_SAME-${testname}-DIFF PROPERTIES WILL_FAIL "true")
+ endif (${resultcode} STREQUAL "1")
+ endif (NOT ${resultcode} STREQUAL "2")
+ ENDMACRO (ADD_H5_TEST_SAME)
+
+ #
+ # Similiar to ADD_H5_TEST macro. Compare to outputs from source & target
+ # files instead of checking with h5ls.
+ #
+ MACRO (ADD_H5_CMP_TEST testname resultcode infile vparam sparam srcname dparam dstname)
+ # If using memchecker add tests without using scripts
+ if (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (NAME H5COPY-CMP-${testname} COMMAND $<TARGET_FILE:h5copy> -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN})
+ if (${resultcode} STREQUAL "1")
+ set_tests_properties (H5COPY-CMP-${testname} PROPERTIES WILL_FAIL "true")
+ endif (${resultcode} STREQUAL "1")
+ if (NOT "${last_test}" STREQUAL "")
+ set_tests_properties (H5COPY-CMP-${testname} PROPERTIES DEPENDS ${last_test})
+ endif (NOT "${last_test}" STREQUAL "")
+ else (HDF5_ENABLE_USING_MEMCHECKER)
+ # Remove any output file left over from previous test run
+ add_test (
+ NAME H5COPY-CMP-${testname}-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ ./testfiles/${testname}.out.h5
+ )
+ add_test (
+ NAME H5COPY-CMP-${testname}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5copy>"
+ -D "TEST_ARGS=-i;./testfiles/${infile};-o;./testfiles/${testname}.out.h5;${vparam};${sparam};${srcname};${dparam};${dstname}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_OUTPUT=./testfiles/${testname}.out.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=./testfiles/${testname}.out"
+ -D "TEST_MASK=true"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ set_tests_properties (H5COPY-CMP-${testname} PROPERTIES DEPENDS H5COPY-CMP-${testname}-clear-objects)
+ endif (HDF5_ENABLE_USING_MEMCHECKER)
+ ENDMACRO (ADD_H5_CMP_TEST)
+
+##############################################################################
+##############################################################################
+### T H E T E S T S ###
+##############################################################################
+##############################################################################
+
+ # --------------------------------------------------------------------
+ # test file names
+ # --------------------------------------------------------------------
+ set (HDF_FILE1 h5copytst)
+ set (HDF_FILE2 h5copy_ref)
+ set (HDF_EXT_SRC_FILE h5copy_extlinks_src)
+ set (HDF_EXT_TRG_FILE h5copy_extlinks_trg)
+
+ if (HDF5_ENABLE_USING_MEMCHECKER)
+ # Remove any output file left over from previous test run
+ add_test (
+ NAME H5COPY-clearall-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ simple.out.h5
+ chunk.out.h5
+ compact.out.h5
+ compound.out.h5
+ compressed.out.h5
+ named_vl.out.h5
+ nested_vl.out.h5
+ simple_top.out.h5
+ dsrename.out.h5
+ grp_empty.out.h5
+ grp_dsets.out.h5
+ grp_nested.out.h5
+ simple_group.out.h5
+ grp_rename.out.h5
+ grp_dsets_rename.out.h5
+ A_B1_simple.out.h5
+ A_B2_simple2.out.h5
+ C_D_simple.out.h5
+ E_F_grp_dsets.out.h5
+ G_H_grp_nested.out.h5
+ region_ref.out.h5
+ ext_link.out.h5
+ ext_link_f.out.h5
+ ext_dangle_noobj.out.h5
+ ext_dangle_noobj_f.out.h5
+ ext_dangle_nofile.out.h5
+ ext_dangle_nofile_f.out.h5
+ ext_link_group.out.h5
+ ext_link_group_f.out.h5
+ samefile1.out.h5
+ samefile2.out.h5
+ h5copy_misc1.out.h5
+ h5copy_misc1.out.out
+ h5copy_misc1.out.out.err
+ )
+ set_tests_properties (H5COPY-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
+ if (NOT "${last_test}" STREQUAL "")
+ set_tests_properties (H5COPY-clearall-objects PROPERTIES DEPENDS ${last_test})
+ endif (NOT "${last_test}" STREQUAL "")
+ set (last_test "H5COPY-clearall-objects")
+ endif (HDF5_ENABLE_USING_MEMCHECKER)
+
+ # "Test copying various forms of datasets"
+ ADD_H5_TEST (simple 0 ${HDF_FILE1}.h5 -v -s simple -d simple)
+ ADD_H5_TEST (chunk 0 ${HDF_FILE1}.h5 -v -s chunk -d chunk)
+ ADD_H5_TEST (compact 0 ${HDF_FILE1}.h5 -v -s compact -d compact)
+ ADD_H5_TEST (compound 0 ${HDF_FILE1}.h5 -v -s compound -d compound)
+ ADD_H5_TEST (compressed 0 ${HDF_FILE1}.h5 -v -s compressed -d compressed)
+ ADD_H5_TEST (named_vl 0 ${HDF_FILE1}.h5 -v -s named_vl -d named_vl)
+ ADD_H5_TEST (nested_vl 0 ${HDF_FILE1}.h5 -v -s nested_vl -d nested_vl)
+
+ # "Test copying dataset within group in source file to root of destination"
+ ADD_H5_TEST (simple_top 0 ${HDF_FILE1}.h5 -v -s grp_dsets/simple -d simple_top)
+
+ # "Test copying & renaming dataset"
+ ADD_H5_TEST (dsrename 0 ${HDF_FILE1}.h5 -v -s compound -d rename)
+
+ # "Test copying empty, 'full' & 'nested' groups"
+ ADD_H5_TEST (grp_empty 0 ${HDF_FILE1}.h5 -v -s grp_empty -d grp_empty)
+ ADD_H5_TEST (grp_dsets 0 ${HDF_FILE1}.h5 -v -s grp_dsets -d grp_dsets)
+ ADD_H5_TEST (grp_nested 0 ${HDF_FILE1}.h5 -v -s grp_nested -d grp_nested)
+
+ # "Test copying dataset within group in source file to group in destination"
+ ADD_H5_TEST2 (simple_group 0 ${HDF_FILE1}.h5 grp_dsets grp_dsets -v -s /grp_dsets/simple -d /grp_dsets/simple_group)
+
+ # "Test copying & renaming group"
+ ADD_H5_TEST (grp_rename 0 ${HDF_FILE1}.h5 -v -s grp_dsets -d grp_rename)
+
+ # "Test copying 'full' group hierarchy into group in destination file"
+ ADD_H5_TEST2 (grp_dsets_rename 0 ${HDF_FILE1}.h5 grp_dsets grp_rename -v -s grp_dsets -d /grp_rename/grp_dsets)
+
+ # "Test copying objects into group hier. that doesn't exist yet in destination file"
+ ADD_H5_TEST (A_B1_simple 0 ${HDF_FILE1}.h5 -vp -s simple -d /A/B1/simple)
+ ADD_H5_TEST (A_B2_simple2 0 ${HDF_FILE1}.h5 -vp -s simple -d /A/B2/simple2)
+ ADD_H5_TEST (C_D_simple 0 ${HDF_FILE1}.h5 -vp -s /grp_dsets/simple -d /C/D/simple)
+ ADD_H5_TEST (E_F_grp_dsets 0 ${HDF_FILE1}.h5 -vp -s /grp_dsets -d /E/F/grp_dsets)
+ ADD_H5_TEST (G_H_grp_nested 0 ${HDF_FILE1}.h5 -vp -s /grp_nested -d /G/H/grp_nested)
+
+############# COPY REFERENCES ##############
+
+ # "Test copying object and region references"
+ ADD_H5_F_TEST (region_ref 2 ${HDF_FILE2}.h5 ref -v -s / -d /COPY)
+
+############# COPY EXT LINKS ##############
+
+ # "Test copying external link directly without -f ext"
+ ADD_H5_TEST (ext_link 2 ${HDF_EXT_SRC_FILE}.h5 -v -s /group_ext/extlink_dset -d /copy1_dset)
+
+ # "Test copying external link directly with -f ext"
+ ADD_H5_F_TEST (ext_link_f 2 ${HDF_EXT_SRC_FILE}.h5 ext -v -s /group_ext/extlink_dset -d /copy2_dset)
+
+ # "Test copying dangling external link (no obj) directly without -f ext"
+ ADD_H5_TEST (ext_dangle_noobj 2 ${HDF_EXT_SRC_FILE}.h5 -v -s /group_ext/extlink_notyet1 -d /copy_dangle1_1)
+
+ # "Test copying dangling external link (no obj) directly with -f ext"
+ ADD_H5_F_TEST (ext_dangle_noobj_f 2 ${HDF_EXT_SRC_FILE}.h5 ext -v -s /group_ext/extlink_notyet1 -d /copy_dangle1_2)
+
+ # "Test copying dangling external link (no file) directly without -f ext"
+ ADD_H5_TEST (ext_dangle_nofile 2 ${HDF_EXT_SRC_FILE}.h5 -v -s /group_ext/extlink_notyet2 -d /copy_dangle2_1)
+
+ # "Test copying dangling external link (no file) directly with -f ext"
+ ADD_H5_F_TEST (ext_dangle_nofile_f 2 ${HDF_EXT_SRC_FILE}.h5 ext -v -s /group_ext/extlink_notyet2 -d /copy_dangle2_2)
+
+ # "Test copying a group contains external links without -f ext"
+ ADD_H5_TEST (ext_link_group 2 ${HDF_EXT_SRC_FILE}.h5 -v -s /group_ext -d /copy1_group)
+
+ # "Test copying a group contains external links with -f ext"
+ ADD_H5_F_TEST (ext_link_group_f 2 ${HDF_EXT_SRC_FILE}.h5 ext -v -s /group_ext -d /copy2_group)
+
+############# Test misc. ##############
+
+ #-----------------------------------------------------------------
+ # "Test copying object into group which doesn't exist, without -p"
+ #
+ ADD_H5_CMP_TEST (h5copy_misc1 1 ${HDF_FILE1}.h5 -v -s /simple -d /g1/g2/simple)
+
+ #-------------------------------------------
+ # "Test copying objects to the same file "
+ #
+ # - dataset
+ ADD_H5_TEST_SAME (samefile1 0 ${HDF_FILE1}.h5 /simple /simple -v -s /simple -d /simple_cp)
+ # - group with some datasets
+ ADD_H5_TEST_SAME (samefile2 0 ${HDF_FILE1}.h5 /grp_dsets /grp_dsets -v -s /grp_dsets -d /grp_dsets_cp)
diff --git a/tools/test/h5copy/Makefile.am b/tools/test/h5copy/Makefile.am
new file mode 100644
index 0000000..becb55f
--- /dev/null
+++ b/tools/test/h5copy/Makefile.am
@@ -0,0 +1,46 @@
+#
+# 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.
+##
+## Makefile.am
+## Run automake to generate a Makefile.in from this file.
+#
+# HDF5 Library Makefile(.in)
+#
+
+include $(top_srcdir)/config/commence.am
+
+# Include src and tools/lib directories
+AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib
+
+# Test programs and scripts
+TEST_PROG=h5copygentest
+TEST_SCRIPT=testh5copy.sh
+
+check_SCRIPTS=$(TEST_SCRIPT)
+SCRIPT_DEPEND=../../src/h5copy/h5copy$(EXEEXT)
+
+# This is our main target, the h5copy tool
+check_PROGRAMS=$(TEST_PROG)
+
+# source file for the test file generator
+h5copygentest_SOURCES=h5copygentest.c
+
+# All programs depend on the hdf5 and h5tools libraries
+LDADD=$(LIBH5TOOLS) $(LIBHDF5)
+
+# Temporary files. *.h5 are generated by h5dumpgentest. They should
+# copied to the testfiles/ directory if update is required.
+CHECK_CLEANFILES+=*.h5
+
+include $(top_srcdir)/config/conclude.am
diff --git a/tools/test/h5copy/h5copygentest.c b/tools/test/h5copy/h5copygentest.c
new file mode 100644
index 0000000..7669702
--- /dev/null
+++ b/tools/test/h5copy/h5copygentest.c
@@ -0,0 +1,1004 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Generate the binary hdf5 file for the h5copy tests
+ */
+#include <stdlib.h>
+#include "hdf5.h"
+#include "H5private.h"
+
+/* HDF file names */
+#define HDF_FILE1 "h5copytst.h5"
+#define HDF_FILE1_NEW "h5copytst_new.h5"
+#define HDF_FILE2 "h5copy_ref.h5"
+#define HDF_EXT_SRC_FILE "h5copy_extlinks_src.h5"
+#define HDF_EXT_TRG_FILE "h5copy_extlinks_trg.h5"
+
+/* objects in HDF_FILE1 */
+#define DATASET_SIMPLE "simple"
+#define DATASET_CHUNK "chunk"
+#define DATASET_COMPACT "compact"
+#define DATASET_COMPOUND "compound"
+#define DATASET_COMPRESSED "compressed"
+#define DATASET_NAMED_VL "named_vl"
+#define DATASET_NESTED_VL "nested_vl"
+#define DATASET_ATTR "dset_attr"
+#define ATTR "attr"
+#define GROUP_EMPTY "grp_empty"
+#define GROUP_DATASETS "grp_dsets"
+#define GROUP_NESTED "grp_nested"
+#define GROUP_ATTR "grp_attr"
+
+/* Obj reference */
+#define OBJ_REF_DS "Dset1"
+#define OBJ_REF_GRP "Group"
+/* Region reference */
+#define REG_REF_DS1 "Dset_REGREF"
+#define REG_REF_DS2 "Dset2"
+
+
+/*-------------------------------------------------------------------------
+ * Function: gent_simple
+ *
+ * Purpose: Generate a simple dataset in LOC_ID
+ *
+ *-------------------------------------------------------------------------
+ */
+static void gent_simple(hid_t loc_id)
+{
+ hid_t sid, did;
+ hsize_t dims[1] = {6};
+ int buf[6] = {1,2,3,4,5,6};
+
+ /* create dataspace */
+ sid = H5Screate_simple(1, dims, NULL);
+
+ /* create dataset */
+ did = H5Dcreate2(loc_id, DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* write */
+ H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
+
+ /* close */
+ H5Sclose(sid);
+ H5Dclose(did);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: gent_chunked
+ *
+ * Purpose: Generate a chunked dataset in LOC_ID
+ *
+ *-------------------------------------------------------------------------
+ */
+static void gent_chunked(hid_t loc_id)
+{
+ hid_t sid, did, pid;
+ hsize_t dims[1] = {6};
+ hsize_t chunk_dims[1] = {2};
+ int buf[6] = {1,2,3,4,5,6};
+
+ /* create dataspace */
+ sid = H5Screate_simple(1, dims, NULL);
+
+ /* create property plist */
+ pid = H5Pcreate(H5P_DATASET_CREATE);
+ H5Pset_chunk(pid, 1, chunk_dims);
+
+ /* create dataset */
+ did = H5Dcreate2(loc_id, DATASET_CHUNK, H5T_NATIVE_INT, sid, H5P_DEFAULT, pid, H5P_DEFAULT);
+
+ /* write */
+ H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
+
+ /* close */
+ H5Sclose(sid);
+ H5Dclose(did);
+ H5Pclose(pid);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: gent_compact
+ *
+ * Purpose: Generate a compact dataset in LOC_ID
+ *
+ *-------------------------------------------------------------------------
+ */
+static void gent_compact(hid_t loc_id)
+{
+ hid_t sid, did, pid;
+ hsize_t dims[1] = {6};
+ int buf[6] = {1,2,3,4,5,6};
+
+ /* create dataspace */
+ sid = H5Screate_simple(1, dims, NULL);
+
+ /* create property plist */
+ pid = H5Pcreate(H5P_DATASET_CREATE);
+ H5Pset_layout (pid,H5D_COMPACT);
+
+ /* create dataset */
+ did = H5Dcreate2(loc_id, DATASET_COMPACT, H5T_NATIVE_INT, sid, H5P_DEFAULT, pid, H5P_DEFAULT);
+
+ /* write */
+ H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
+
+ /* close */
+ H5Sclose(sid);
+ H5Dclose(did);
+ H5Pclose(pid);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: gent_compound
+ *
+ * Purpose: Generate a compound dataset in LOC_ID
+ *
+ *-------------------------------------------------------------------------
+ */
+static void gent_compound(hid_t loc_id)
+{
+ typedef struct s_t
+ {
+ char str1[20];
+ char str2[20];
+ } s_t;
+ hid_t sid, did, tid_c, tid_s;
+ hsize_t dims[1] = {2};
+ s_t buf[2] = {{"str1", "str2"}, {"str3", "str4"}};
+
+ /* create dataspace */
+ sid = H5Screate_simple(1, dims, NULL);
+
+ /* create a compound type */
+ tid_c = H5Tcreate(H5T_COMPOUND, sizeof(s_t));
+ tid_s = H5Tcopy(H5T_C_S1);
+ H5Tset_size(tid_s, 20);
+
+ H5Tinsert(tid_c, "str1", HOFFSET(s_t,str1), tid_s);
+ H5Tinsert(tid_c, "str2", HOFFSET(s_t,str2), tid_s);
+
+ /* create dataset */
+ did = H5Dcreate2(loc_id, DATASET_COMPOUND, tid_c, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* write */
+ H5Dwrite(did, tid_c, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
+
+ /* close */
+ H5Sclose(sid);
+ H5Dclose(did);
+ H5Tclose(tid_c);
+ H5Tclose(tid_s);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: gent_compressed
+ *
+ * Purpose: Generate a compressed dataset in LOC_ID
+ *
+ *-------------------------------------------------------------------------
+ */
+static void gent_compressed(hid_t loc_id)
+{
+ hid_t sid, did, pid;
+ hsize_t dims[1] = {6};
+ hsize_t chunk_dims[1] = {2};
+ int buf[6] = {1,2,3,4,5,6};
+
+ /* create dataspace */
+ sid = H5Screate_simple(1, dims, NULL);
+
+ /* create property plist for chunk*/
+ pid = H5Pcreate(H5P_DATASET_CREATE);
+ H5Pset_chunk(pid, 1, chunk_dims);
+
+ /* set the deflate filter */
+#if defined (H5_HAVE_FILTER_DEFLATE)
+ H5Pset_deflate(pid, 1);
+#endif
+
+ /* create dataset */
+ did = H5Dcreate2(loc_id, DATASET_COMPRESSED, H5T_NATIVE_INT, sid, H5P_DEFAULT, pid, H5P_DEFAULT);
+
+ /* write */
+ H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
+
+ /* close */
+ H5Sclose(sid);
+ H5Dclose(did);
+ H5Pclose(pid);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: gent_named_vl
+ *
+ * Purpose: Generate a variable lenght named datatype for a dataset in
+ LOC_ID
+ *
+ *-------------------------------------------------------------------------
+ */
+static void gent_named_vl(hid_t loc_id)
+{
+ hid_t sid, did, tid;
+ hsize_t dims[1] = {2};
+ hvl_t buf[2];
+
+ /* allocate and initialize VL dataset to write */
+ buf[0].len = 1;
+ buf[0].p = HDmalloc( 1 * sizeof(int));
+ ((int *)buf[0].p)[0]=1;
+ buf[1].len = 2;
+ buf[1].p = HDmalloc( 2 * sizeof(int));
+ ((int *)buf[1].p)[0]=2;
+ ((int *)buf[1].p)[1]=3;
+
+ /* create dataspace */
+ sid = H5Screate_simple(1, dims, NULL);
+
+ /* create datatype */
+ tid = H5Tvlen_create(H5T_NATIVE_INT);
+
+ /* create named datatype */
+ H5Tcommit2(loc_id, "vl", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* create dataset */
+ did = H5Dcreate2(loc_id, DATASET_NAMED_VL, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* write */
+ H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
+
+ /* close */
+ H5Dvlen_reclaim(tid,sid,H5P_DEFAULT,buf);
+ H5Sclose(sid);
+ H5Dclose(did);
+ H5Tclose(tid);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: gent_nested_vl
+ *
+ * Purpose: Generate a nested variable length dataset in LOC_ID
+ *
+ *-------------------------------------------------------------------------
+ */
+static void gent_nested_vl(hid_t loc_id)
+{
+ hid_t sid, did, tid1, tid2;
+ hsize_t dims[1] = {2};
+ hvl_t buf[2];
+ hvl_t *tvl;
+
+ /* allocate and initialize VL dataset to write */
+ buf[0].len = 1;
+ buf[0].p = HDmalloc( 1 * sizeof(hvl_t));
+ tvl = (hvl_t *)buf[0].p;
+ tvl->p = HDmalloc( 1 * sizeof(int) );
+ tvl->len = 1;
+ ((int *)tvl->p)[0]=1;
+
+ buf[1].len = 1;
+ buf[1].p = HDmalloc( 1 * sizeof(hvl_t));
+ tvl = (hvl_t *)buf[1].p;
+ tvl->p = HDmalloc( 2 * sizeof(int) );
+ tvl->len = 2;
+ ((int *)tvl->p)[0]=2;
+ ((int *)tvl->p)[1]=3;
+
+ /* create dataspace */
+ sid = H5Screate_simple(1, dims, NULL);
+
+ /* create datatype */
+ tid1 = H5Tvlen_create(H5T_NATIVE_INT);
+
+ /* create nested VL datatype */
+ tid2 = H5Tvlen_create(tid1);
+
+ /* create dataset */
+ did = H5Dcreate2(loc_id, DATASET_NESTED_VL, tid2, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* write */
+ H5Dwrite(did, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
+
+ /* close */
+ H5Dvlen_reclaim(tid2,sid,H5P_DEFAULT,buf);
+ H5Sclose(sid);
+ H5Dclose(did);
+ H5Tclose(tid1);
+ H5Tclose(tid2);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: gent_att_compound_vlstr
+ *
+ * Purpose: Generate a dataset and a group.
+ * Both has an attribute with a compound datatype consisting
+ * of a variable length string
+ *
+ *-------------------------------------------------------------------------
+ */
+static void gent_att_compound_vlstr(hid_t loc_id)
+{
+ typedef struct { /* Compound structure for the attribute */
+ int i;
+ char *v;
+ } s1;
+ hsize_t dim[1] = {1}; /* Dimension size */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t tid = -1; /* Datatype ID */
+ hid_t aid = -1; /* Attribute ID */
+ hid_t did = -1; /* Dataset ID */
+ hid_t gid = -1; /* Group ID */
+ hid_t vl_str_tid = -1; /* Variable length datatype ID */
+ hid_t cmpd_tid = -1; /* Compound datatype ID */
+ hid_t null_sid = -1; /* Null dataspace ID */
+ s1 buf; /* Buffer */
+
+ buf.i = 9;
+ buf.v = "ThisIsAString";
+
+ /* Create an integer datatype */
+ tid = H5Tcopy(H5T_NATIVE_INT);
+
+ /* Create a variable length string */
+ vl_str_tid = H5Tcopy(H5T_C_S1);
+ H5Tset_size(vl_str_tid, H5T_VARIABLE);
+
+ /* Create a compound datatype with a variable length string and an integer */
+ cmpd_tid = H5Tcreate(H5T_COMPOUND, sizeof(s1));
+ H5Tinsert(cmpd_tid, "i", HOFFSET(s1, i), tid);
+ H5Tinsert(cmpd_tid, "v", HOFFSET(s1, v), vl_str_tid);
+
+ /* Create a dataset */
+ null_sid = H5Screate(H5S_NULL);
+ did = H5Dcreate2(loc_id, DATASET_ATTR, H5T_NATIVE_INT, null_sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Attach an attribute with the compound datatype to the dataset */
+ sid = H5Screate_simple(1, dim, dim);
+ aid = H5Acreate2(did, ATTR, cmpd_tid, sid, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Write the attribute */
+ buf.i = 9;
+ buf.v = "ThisIsAString";
+ H5Awrite(aid, cmpd_tid, &buf);
+
+ /* Close the dataset and its attribute */
+ H5Dclose(did);
+ H5Aclose(aid);
+
+ /* Create a group */
+ gid = H5Gcreate2(loc_id, GROUP_ATTR, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Attach an attribute with the compound datatype to the group */
+ aid = H5Acreate2(gid, ATTR, cmpd_tid, sid, H5P_DEFAULT, H5P_DEFAULT);
+ H5Awrite(aid, cmpd_tid, &buf);
+
+ /* Close the group and its attribute */
+ H5Aclose(aid);
+ H5Gclose(gid);
+
+ /* Close dataspaces */
+ H5Sclose(sid);
+ H5Sclose(null_sid);
+
+ /* Close datatypes */
+ H5Tclose(tid);
+ H5Tclose(vl_str_tid);
+ H5Tclose(cmpd_tid);
+
+} /* gen_att_compound_vlstr() */
+
+/*-------------------------------------------------------------------------
+ * Function: gent_datasets
+ *
+ * Purpose: Generate all datasets in a particular location
+ *
+ *-------------------------------------------------------------------------
+ */
+static void gent_datasets(hid_t loc_id)
+{
+ gent_simple(loc_id);
+ gent_chunked(loc_id);
+ gent_compact(loc_id);
+ gent_compound(loc_id);
+ gent_compressed(loc_id);
+ gent_named_vl(loc_id);
+ gent_nested_vl(loc_id);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: gent_empty_group
+ *
+ * Purpose: Generate an empty group in a location
+ *
+ *-------------------------------------------------------------------------
+ */
+static void gent_empty_group(hid_t loc_id)
+{
+ hid_t gid;
+
+ /* Create group in location */
+ gid = H5Gcreate2(loc_id, GROUP_EMPTY, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Release resources */
+ H5Gclose(gid);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: gent_nested_datasets
+ *
+ * Purpose: Generate a group in a location and populate it with the "standard"
+ * datasets
+ *
+ *-------------------------------------------------------------------------
+ */
+static void gent_nested_datasets(hid_t loc_id)
+{
+ hid_t gid;
+
+ /* Create group in location */
+ gid = H5Gcreate2(loc_id, GROUP_DATASETS, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Add datasets to group created */
+ gent_datasets(gid);
+
+ /* Release resources */
+ H5Gclose(gid);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: gent_nested_group
+ *
+ * Purpose: Generate a group in a location and populate it with another group
+ * containing the "standard" datasets
+ *
+ *-------------------------------------------------------------------------
+ */
+static void gent_nested_group(hid_t loc_id)
+{
+ hid_t gid;
+
+ /* Create group in location */
+ gid = H5Gcreate2(loc_id, GROUP_NESTED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Add datasets to group created */
+ gent_nested_datasets(gid);
+
+ /* Release resources */
+ H5Gclose(gid);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: gen_obj_ref
+ *
+ * Purpose: Generate object references to dataset and group
+ *
+ * Programmer: Jonathan Kim (Feb 23, 2010)
+ *------------------------------------------------------------------------*/
+static herr_t gen_obj_ref(hid_t loc_id)
+{
+ hid_t sid=0, oid=0;
+ hsize_t dims1[1]={3};
+ hsize_t dims2[1]={2};
+ int data[3] = {10,20,30};
+ int status;
+
+ /*---------------------
+ * create obj references to the previously created objects.
+ * Passing -1 as reference is an object.*/
+ hobj_ref_t or_data[2]; /* write buffer */
+ herr_t ret = SUCCEED;
+
+ /*--------------
+ * add dataset */
+ sid = H5Screate_simple(1, dims1, NULL);
+ if (sid < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ oid = H5Dcreate2 (loc_id, OBJ_REF_DS, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (oid < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ status = H5Dwrite(oid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ H5Dclose(oid);
+ H5Sclose(sid);
+
+ /*--------------
+ * add group */
+ oid = H5Gcreate2 (loc_id, OBJ_REF_GRP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (oid < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Gcreate2 failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+ H5Gclose(oid);
+
+ status = H5Rcreate (&or_data[0], loc_id, OBJ_REF_DS, H5R_OBJECT, (hid_t)-1);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+ status = H5Rcreate (&or_data[1], loc_id, OBJ_REF_GRP, H5R_OBJECT, (hid_t)-1);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ sid = H5Screate_simple (1, dims2, NULL);
+ if (sid < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ oid = H5Dcreate2 (loc_id, "Dset_OBJREF", H5T_STD_REF_OBJ, sid, H5P_DEFAULT,H5P_DEFAULT,H5P_DEFAULT);
+ if (oid < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ status = H5Dwrite(oid, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, or_data);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+out:
+ if(oid > 0)
+ H5Dclose(oid);
+ if(sid > 0)
+ H5Sclose(sid);
+
+ return ret;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: gen_region_ref
+ *
+ * Purpose: Generate dataset region references
+ *
+ * Programmer: Jonathan Kim (Feb 23, 2010)
+ *------------------------------------------------------------------------*/
+static herr_t gen_region_ref(hid_t loc_id)
+{
+ hid_t sid=0, oid1=0, oid2=0;
+ int status;
+ herr_t ret = SUCCEED;
+ char data[3][16] = {"The quick brown", "fox jumps over ", "the 5 lazy dogs"};
+ hsize_t dims2[2] = {3,16};
+ hsize_t coords[4][2] = { {0,1}, {2,11}, {1,0}, {2,4} };
+ hdset_reg_ref_t rr_data[2];
+ hsize_t start[2] = {0,0};
+ hsize_t stride[2] = {2,11};
+ hsize_t count[2] = {2,2};
+ hsize_t block[2] = {1,3};
+ hsize_t dims1[1] = {2};
+
+ sid = H5Screate_simple (2, dims2, NULL);
+ if (sid < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* create normal dataset which is refered */
+ oid2 = H5Dcreate2 (loc_id, REG_REF_DS2, H5T_STD_I8LE, sid, H5P_DEFAULT,H5P_DEFAULT,H5P_DEFAULT);
+ if (oid2 < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* write values to dataset */
+ status = H5Dwrite (oid2, H5T_NATIVE_CHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, data);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* select elements space for reference */
+ status = H5Sselect_elements (sid, H5S_SELECT_SET, 4, coords[0]);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Sselect_elements failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* create region reference from elements space */
+ status = H5Rcreate (&rr_data[0], loc_id, REG_REF_DS2, H5R_DATASET_REGION, sid);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* select hyperslab space for reference */
+ status = H5Sselect_hyperslab (sid, H5S_SELECT_SET, start, stride, count, block);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Sselect_hyperslab failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* create region reference from hyperslab space */
+ status = H5Rcreate (&rr_data[1], loc_id, REG_REF_DS2, H5R_DATASET_REGION, sid);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ H5Sclose (sid);
+
+ /* Create dataspace. */
+ sid = H5Screate_simple (1, dims1, NULL);
+ if (sid < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* create region reference dataset */
+ oid1 = H5Dcreate2 (loc_id, REG_REF_DS1, H5T_STD_REF_DSETREG, sid, H5P_DEFAULT,H5P_DEFAULT,H5P_DEFAULT);
+ if (oid1 < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* write data as region references */
+ status = H5Dwrite (oid1, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, rr_data);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+out:
+ if (oid1 > 0)
+ H5Dclose (oid1);
+ if (oid2 > 0)
+ H5Dclose (oid2);
+ if (sid > 0)
+ H5Sclose (sid);
+
+ return ret;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: Test_Obj_Copy
+ *
+ * Purpose: Testing with various objects
+ *
+ *------------------------------------------------------------------------*/
+static void Test_Obj_Copy(void)
+{
+ hid_t fid = -1; /* File id */
+ hid_t fapl_new = (-1); /* File access property id */
+ unsigned new_format; /* New format or old format */
+
+ if((fapl_new = H5Pcreate(H5P_FILE_ACCESS)) < 0) {
+ fprintf(stderr, "Error: H5Pcreate failed.\n");
+ goto out;
+ }
+ if(H5Pset_libver_bounds(fapl_new, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) {
+ fprintf(stderr, "Error: H5Pset_libver_bounds failed.\n");
+ goto out;
+ }
+
+ /* Test with old & new format groups */
+ for(new_format = FALSE; new_format <= TRUE; new_format++) {
+
+ /* Set the FAPL for the type of format */
+ /* Create source file */
+ if(new_format)
+ fid = H5Fcreate(HDF_FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_new);
+ else
+ fid = H5Fcreate(HDF_FILE1_NEW, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ if(fid < 0) {
+ fprintf(stderr, "Error: H5Fcreate failed.\n");
+ goto out;
+ }
+
+ gent_datasets(fid);
+ gent_empty_group(fid);
+ gent_nested_datasets(fid);
+ gent_nested_group(fid);
+ gent_att_compound_vlstr(fid);
+
+ H5Fclose(fid);
+ fid = (-1);
+ } /* end for */
+
+out:
+ /*-----------------------------------------------------------------------
+ * Close
+ *------------------------------------------------------------------------*/
+ if(fid > 0)
+ H5Fclose(fid);
+ if(fapl_new > 0)
+ H5Pclose(fapl_new);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: Test_Ref_Copy
+ *
+ * Purpose: Testing with various references
+ *
+ *------------------------------------------------------------------------*/
+static void Test_Ref_Copy(void)
+{
+ hid_t fid=0;
+ herr_t status;
+
+ fid = H5Fcreate (HDF_FILE2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ if (fid < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Fcreate failed.\n", HDF_FILE2);
+ goto out;
+ }
+
+ /* add object reference */
+ status = gen_obj_ref(fid);
+ if (status < 0)
+ fprintf(stderr, "Failed to generate object reference.\n");
+
+ /* add region reference */
+ status = gen_region_ref(fid);
+ if (status < 0)
+ fprintf(stderr, "Failed to generate region reference.\n");
+
+out:
+ /*-----------------------------------------------------------------------
+ * Close
+ *------------------------------------------------------------------------*/
+ if(fid > 0)
+ H5Fclose(fid);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: gen_extlink_trg
+ *
+ * Purpose: generate target external link objs
+ *
+ * Programmer: Jonathan Kim (March 03, 2010)
+ *------------------------------------------------------------------------*/
+static herr_t gen_extlink_trg(hid_t loc_id)
+{
+ hid_t gid=0, tid=0;
+ int status;
+ herr_t ret = SUCCEED;
+
+ /*-----------------------------------------------------------------------
+ * Groups
+ *------------------------------------------------------------------------*/
+ /*--------------
+ * target file */
+ gid = H5Gcreate2(loc_id, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (gid < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Gcreate2 failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /*--------------
+ * add dataset */
+ gent_simple(loc_id);
+
+ /*--------------------
+ * add named datatype
+ */
+ tid = H5Tcopy(H5T_NATIVE_INT);
+ status = H5Tcommit2(loc_id, "datatype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Tcommit2 failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+out:
+ if(gid > 0)
+ H5Gclose(gid);
+ if(tid > 0)
+ H5Tclose(tid);
+
+ return ret;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: gen_extlink_src
+ *
+ * Purpose: generate source external link objs
+ *
+ * Programmer: Jonathan Kim (March 03, 2010)
+ *------------------------------------------------------------------------*/
+static herr_t gen_extlink_src(hid_t loc_id)
+{
+ hid_t gid=0;
+ int status;
+ herr_t ret = SUCCEED;
+
+ /*-----------------------------------------------------------------------
+ * Groups
+ *------------------------------------------------------------------------*/
+ gid = H5Gcreate2(loc_id, "/group_ext", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (gid < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Gcreate2 failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /*-----------------------------------------------------------------------
+ * External links
+ *------------------------------------------------------------------------*/
+ /* link to dataset */
+ status = H5Lcreate_external(HDF_EXT_TRG_FILE, "/simple", gid, "extlink_dset", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Lcreate_external failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* link to group */
+ status = H5Lcreate_external(HDF_EXT_TRG_FILE, "/group", gid, "extlink_grp", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Lcreate_external failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* link to datatype */
+ status = H5Lcreate_external(HDF_EXT_TRG_FILE, "/datatype", gid, "extlink_datatype", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Lcreate_external failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* dangling link - no obj*/
+ status = H5Lcreate_external(HDF_EXT_TRG_FILE, "notyet", gid, "extlink_notyet1", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Lcreate_external failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* dangling link - no file */
+ status = H5Lcreate_external("notyet_file.h5", "notyet", gid, "extlink_notyet2", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Lcreate_external failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+out:
+ if(gid > 0)
+ H5Gclose(gid);
+
+ return ret;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: Test_Extlink_Copy
+ *
+ * Purpose: gerenate external link files
+ *
+ *------------------------------------------------------------------------*/
+static void Test_Extlink_Copy(void)
+{
+ hid_t fid1=0;
+ hid_t fid2=0;
+ herr_t status;
+
+ fid1 = H5Fcreate (HDF_EXT_SRC_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ if (fid1 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Fcreate failed.\n", HDF_EXT_SRC_FILE);
+ goto out;
+ }
+
+ fid2 = H5Fcreate (HDF_EXT_TRG_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ if (fid2 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Fcreate failed.\n", HDF_EXT_TRG_FILE);
+ goto out;
+ }
+
+ /* add links to source external link file */
+ status = gen_extlink_src(fid1);
+ if (status < 0)
+ fprintf(stderr, "Error: %s> gen_extlink_src failed.\n", HDF_EXT_SRC_FILE);
+
+ /* add objs to target external link file */
+ status = gen_extlink_trg(fid2);
+ if (status < 0)
+ fprintf(stderr, "Error: %s> gen_extlink_trg failed.\n", HDF_EXT_TRG_FILE);
+
+out:
+ /*-----------------------------------------------------------------------
+ * Close
+ *------------------------------------------------------------------------*/
+ if(fid1 > 0)
+ H5Fclose(fid1);
+ if(fid2 > 0)
+ H5Fclose(fid2);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: main
+ *
+ *-------------------------------------------------------------------------
+ */
+
+int main(void)
+{
+ Test_Obj_Copy();
+ Test_Ref_Copy();
+ Test_Extlink_Copy();
+
+ return 0;
+}
+
diff --git a/tools/test/h5copy/testfiles/h5copy_extlinks_src.h5 b/tools/test/h5copy/testfiles/h5copy_extlinks_src.h5
new file mode 100644
index 0000000..7b8621e
--- /dev/null
+++ b/tools/test/h5copy/testfiles/h5copy_extlinks_src.h5
Binary files differ
diff --git a/tools/test/h5copy/testfiles/h5copy_extlinks_src.out.ls b/tools/test/h5copy/testfiles/h5copy_extlinks_src.out.ls
new file mode 100644
index 0000000..0134714
--- /dev/null
+++ b/tools/test/h5copy/testfiles/h5copy_extlinks_src.out.ls
@@ -0,0 +1,43 @@
+Opened "./testfiles/h5copy_extlinks_src.out.h5" with sec2 driver.
+/ Group
+ Location: 1:96
+ Links: 1
+/copy1_dset Dataset {6/6}
+ Location: 1:800
+ Links: 1
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/copy1_group Group
+ Location: 1:4696
+ Links: 1
+/copy1_group/extlink_datatype External Link {h5copy_extlinks_trg.h5//datatype}
+/copy1_group/extlink_dset External Link {h5copy_extlinks_trg.h5//simple}
+/copy1_group/extlink_grp External Link {h5copy_extlinks_trg.h5//group}
+/copy1_group/extlink_notyet1 External Link {h5copy_extlinks_trg.h5//notyet}
+/copy1_group/extlink_notyet2 External Link {notyet_file.h5//notyet}
+/copy2_dset Dataset {6/6}
+ Location: 1:4216
+ Links: 1
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/copy2_group Group
+ Location: 1:5128
+ Links: 1
+/copy2_group/extlink_datatype Type
+ Location: 1:6328
+ Links: 1
+ Type: shared-1:6328 32-bit little-endian integer
+/copy2_group/extlink_dset Dataset {6/6}
+ Location: 1:5496
+ Links: 1
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/copy2_group/extlink_grp Group
+ Location: 1:6288
+ Links: 1
+/copy2_group/extlink_notyet1 External Link {h5copy_extlinks_trg.h5//notyet}
+/copy2_group/extlink_notyet2 External Link {notyet_file.h5//notyet}
+/copy_dangle1_1 External Link {h5copy_extlinks_trg.h5//notyet}
+/copy_dangle1_2 External Link {h5copy_extlinks_trg.h5//notyet}
+/copy_dangle2_1 External Link {notyet_file.h5//notyet}
+/copy_dangle2_2 External Link {notyet_file.h5//notyet}
diff --git a/tools/test/h5copy/testfiles/h5copy_extlinks_trg.h5 b/tools/test/h5copy/testfiles/h5copy_extlinks_trg.h5
new file mode 100644
index 0000000..3a0242d
--- /dev/null
+++ b/tools/test/h5copy/testfiles/h5copy_extlinks_trg.h5
Binary files differ
diff --git a/tools/test/h5copy/testfiles/h5copy_misc1.out b/tools/test/h5copy/testfiles/h5copy_misc1.out
new file mode 100644
index 0000000..1624f2b
--- /dev/null
+++ b/tools/test/h5copy/testfiles/h5copy_misc1.out
@@ -0,0 +1,3 @@
+Copying file <./testfiles/h5copytst.h5> and object </simple> to file <./testfiles/h5copy_misc1.out.h5> and object </g1/g2/simple>
+Error in copy...Exiting
+h5copy error: group </g1> doesn't exist. Use -p to create parent groups.
diff --git a/tools/test/h5copy/testfiles/h5copy_ref.h5 b/tools/test/h5copy/testfiles/h5copy_ref.h5
new file mode 100644
index 0000000..bd727e6
--- /dev/null
+++ b/tools/test/h5copy/testfiles/h5copy_ref.h5
Binary files differ
diff --git a/tools/test/h5copy/testfiles/h5copy_ref.out.ls b/tools/test/h5copy/testfiles/h5copy_ref.out.ls
new file mode 100644
index 0000000..d685af2
--- /dev/null
+++ b/tools/test/h5copy/testfiles/h5copy_ref.out.ls
@@ -0,0 +1,31 @@
+Opened "./testfiles/h5copy_ref.out.h5" with sec2 driver.
+/ Group
+ Location: 1:96
+ Links: 1
+/COPY Group
+ Location: 1:1464
+ Links: 1
+/COPY/Dset1 Dataset {3/3}
+ Location: 1:1504
+ Links: 2
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/COPY/Dset2 Dataset {3/3, 16/16}
+ Location: 1:1960
+ Links: 3
+ Storage: <details removed for portability>
+ Type: 8-bit integer
+/COPY/Dset_OBJREF Dataset {2/2}
+ Location: 1:5184
+ Links: 1
+ Storage: <details removed for portability>
+ Type: object reference
+/COPY/Dset_REGREF Dataset {2/2}
+ Location: 1:5304
+ Links: 1
+ Storage: <details removed for portability>
+ Type: dataset region reference
+/COPY/Group Group
+ Location: 1:2096
+ Links: 3
+/~obj_pointed_by_2096 Group, same as /COPY/Group
diff --git a/tools/test/h5copy/testfiles/h5copytst.h5 b/tools/test/h5copy/testfiles/h5copytst.h5
new file mode 100644
index 0000000..1d1cbf1
--- /dev/null
+++ b/tools/test/h5copy/testfiles/h5copytst.h5
Binary files differ
diff --git a/tools/test/h5copy/testfiles/h5copytst.out.ls b/tools/test/h5copy/testfiles/h5copytst.out.ls
new file mode 100644
index 0000000..4044aaf
--- /dev/null
+++ b/tools/test/h5copy/testfiles/h5copytst.out.ls
@@ -0,0 +1,429 @@
+Opened "./testfiles/h5copytst.out.h5" with sec2 driver.
+/ Group
+ Location: 1:96
+ Links: 1
+/A Group
+ Location: 1:84304
+ Links: 1
+/A/B1 Group
+ Location: 1:85008
+ Links: 1
+/A/B1/simple Dataset {6/6}
+ Location: 1:84176
+ Links: 1
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/A/B2 Group
+ Location: 1:88544
+ Links: 1
+/A/B2/simple2 Dataset {6/6}
+ Location: 1:88416
+ Links: 1
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/C Group
+ Location: 1:91752
+ Links: 1
+/C/D Group
+ Location: 1:92456
+ Links: 1
+/C/D/simple Dataset {6/6}
+ Location: 1:91624
+ Links: 1
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/E Group
+ Location: 1:106368
+ Links: 1
+/E/F Group
+ Location: 1:107072
+ Links: 1
+/E/F/grp_dsets Group
+ Location: 1:94568
+ Links: 1
+/E/F/grp_dsets/chunk Dataset {6/6}
+ 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:99208
+ Links: 1
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/E/F/grp_dsets/compound Dataset {2/2}
+ Location: 1:99344
+ Links: 1
+ Storage: <details removed for portability>
+ Type: struct {
+ "str1" +0 20-byte null-terminated ASCII string
+ "str2" +20 20-byte null-terminated ASCII string
+ } 40 bytes
+/E/F/grp_dsets/compressed Dataset {6/6}
+ 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:105920
+ Links: 1
+ Storage: <details removed for portability>
+ Type: shared-1:106048 variable length of
+ 32-bit little-endian integer
+/E/F/grp_dsets/nested_vl Dataset {2/2}
+ 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:106240
+ Links: 1
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/E/F/grp_dsets/vl Type
+ Location: 1:106048
+ Links: 2
+ Type: shared-1:106048 variable length of
+ 32-bit little-endian integer
+/G Group
+ Location: 1:122016
+ Links: 1
+/G/H Group
+ Location: 1:122720
+ Links: 1
+/G/H/grp_nested Group
+ Location: 1:109096
+ Links: 1
+/G/H/grp_nested/grp_dsets Group
+ Location: 1:109888
+ Links: 1
+/G/H/grp_nested/grp_dsets/chunk Dataset {6/6}
+ 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: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:114664
+ Links: 1
+ Storage: <details removed for portability>
+ Type: struct {
+ "str1" +0 20-byte null-terminated ASCII string
+ "str2" +20 20-byte null-terminated ASCII string
+ } 40 bytes
+/G/H/grp_nested/grp_dsets/compressed Dataset {6/6}
+ 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:121240
+ Links: 1
+ Storage: <details removed for portability>
+ 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: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:121560
+ Links: 1
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/G/H/grp_nested/grp_dsets/vl Type
+ Location: 1:121368
+ Links: 2
+ Type: shared-1:121368 variable length of
+ 32-bit little-endian integer
+/chunk Dataset {6/6}
+ Location: 1:6312
+ Links: 1
+ Chunks: {2} 8 bytes
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/compact Dataset {6/6}
+ Location: 1:6440
+ Links: 1
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/compound Dataset {2/2}
+ Location: 1:8624
+ Links: 1
+ Storage: <details removed for portability>
+ Type: struct {
+ "str1" +0 20-byte null-terminated ASCII string
+ "str2" +20 20-byte null-terminated ASCII string
+ } 40 bytes
+/compressed Dataset {6/6}
+ Location: 1:12984
+ 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 Group
+ Location: 1:28128
+ Links: 1
+/grp_dsets/chunk Dataset {6/6}
+ 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:32768
+ Links: 1
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/grp_dsets/compound Dataset {2/2}
+ Location: 1:32904
+ Links: 1
+ Storage: <details removed for portability>
+ Type: struct {
+ "str1" +0 20-byte null-terminated ASCII string
+ "str2" +20 20-byte null-terminated ASCII string
+ } 40 bytes
+/grp_dsets/compressed Dataset {6/6}
+ 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:39480
+ Links: 1
+ Storage: <details removed for portability>
+ Type: shared-1:39608 variable length of
+ 32-bit little-endian integer
+/grp_dsets/nested_vl Dataset {2/2}
+ 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:39800
+ Links: 1
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/grp_dsets/simple_group Dataset {6/6}
+ Location: 1:55912
+ Links: 1
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/grp_dsets/vl Type
+ Location: 1:39608
+ Links: 2
+ Type: shared-1:39608 variable length of
+ 32-bit little-endian integer
+/grp_empty Group
+ Location: 1:27336
+ Links: 1
+/grp_nested Group
+ Location: 1:40592
+ Links: 1
+/grp_nested/grp_dsets Group
+ Location: 1:41384
+ Links: 1
+/grp_nested/grp_dsets/chunk Dataset {6/6}
+ 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:46024
+ Links: 1
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/grp_nested/grp_dsets/compound Dataset {2/2}
+ Location: 1:46160
+ Links: 1
+ Storage: <details removed for portability>
+ Type: struct {
+ "str1" +0 20-byte null-terminated ASCII string
+ "str2" +20 20-byte null-terminated ASCII string
+ } 40 bytes
+/grp_nested/grp_dsets/compressed Dataset {6/6}
+ 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:52736
+ Links: 1
+ Storage: <details removed for portability>
+ Type: shared-1:52864 variable length of
+ 32-bit little-endian integer
+/grp_nested/grp_dsets/nested_vl Dataset {2/2}
+ 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:53056
+ Links: 1
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/grp_nested/grp_dsets/vl Type
+ Location: 1:52864
+ Links: 2
+ Type: shared-1:52864 variable length of
+ 32-bit little-endian integer
+/grp_rename Group
+ Location: 1:57120
+ Links: 1
+/grp_rename/chunk Dataset {6/6}
+ 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:61760
+ Links: 1
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/grp_rename/compound Dataset {2/2}
+ Location: 1:61896
+ Links: 1
+ Storage: <details removed for portability>
+ Type: struct {
+ "str1" +0 20-byte null-terminated ASCII string
+ "str2" +20 20-byte null-terminated ASCII string
+ } 40 bytes
+/grp_rename/compressed Dataset {6/6}
+ 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:70000
+ Links: 1
+/grp_rename/grp_dsets/chunk Dataset {6/6}
+ 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:74640
+ Links: 1
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/grp_rename/grp_dsets/compound Dataset {2/2}
+ Location: 1:74776
+ Links: 1
+ Storage: <details removed for portability>
+ Type: struct {
+ "str1" +0 20-byte null-terminated ASCII string
+ "str2" +20 20-byte null-terminated ASCII string
+ } 40 bytes
+/grp_rename/grp_dsets/compressed Dataset {6/6}
+ 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:81352
+ Links: 1
+ Storage: <details removed for portability>
+ Type: shared-1:81480 variable length of
+ 32-bit little-endian integer
+/grp_rename/grp_dsets/nested_vl Dataset {2/2}
+ 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:81672
+ Links: 1
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/grp_rename/grp_dsets/vl Type
+ Location: 1:81480
+ Links: 2
+ Type: shared-1:81480 variable length of
+ 32-bit little-endian integer
+/grp_rename/named_vl Dataset {2/2}
+ Location: 1:68472
+ Links: 1
+ Storage: <details removed for portability>
+ Type: shared-1:68600 variable length of
+ 32-bit little-endian integer
+/grp_rename/nested_vl Dataset {2/2}
+ 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:68792
+ Links: 1
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/grp_rename/vl Type
+ Location: 1:68600
+ Links: 2
+ Type: shared-1:68600 variable length of
+ 32-bit little-endian integer
+/named_vl Dataset {2/2}
+ Location: 1:17280
+ Links: 1
+ Storage: <details removed for portability>
+ Type: shared-1:17408 variable length of
+ 32-bit little-endian integer
+/nested_vl Dataset {2/2}
+ 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:26128
+ Links: 1
+ Storage: <details removed for portability>
+ Type: struct {
+ "str1" +0 20-byte null-terminated ASCII string
+ "str2" +20 20-byte null-terminated ASCII string
+ } 40 bytes
+/simple Dataset {6/6}
+ Location: 1:800
+ Links: 1
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/simple_top Dataset {6/6}
+ Location: 1:23952
+ Links: 1
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
diff --git a/tools/test/h5copy/testfiles/h5copytst_new.h5 b/tools/test/h5copy/testfiles/h5copytst_new.h5
new file mode 100644
index 0000000..fd820ca
--- /dev/null
+++ b/tools/test/h5copy/testfiles/h5copytst_new.h5
Binary files differ
diff --git a/tools/test/h5copy/testfiles/h5copytst_new.out.ls b/tools/test/h5copy/testfiles/h5copytst_new.out.ls
new file mode 100644
index 0000000..9df6b2e
--- /dev/null
+++ b/tools/test/h5copy/testfiles/h5copytst_new.out.ls
@@ -0,0 +1,502 @@
+#############################
+Expected output for 'h5ls ../testfiles/h5copytst_new.out.h5'
+#############################
+Opened "../testfiles/h5copytst_new.out.h5" with sec2 driver.
+/ Group
+ Location: 1:96
+ Links: 1
+/A Group
+ Location: 1:65602
+ Links: 1
+/A/B1 Group
+ Location: 1:66306
+ Links: 1
+/A/B1/simple Dataset {6/6}
+ Location: 1:65509
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/A/B2 Group
+ Location: 1:69807
+ Links: 1
+/A/B2/simple2 Dataset {6/6}
+ Location: 1:69714
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/C Group
+ Location: 1:72980
+ Links: 1
+/C/D Group
+ Location: 1:73684
+ Links: 1
+/C/D/simple Dataset {6/6}
+ Location: 1:72887
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/E Group
+ Location: 1:76217
+ Links: 1
+/E/F Group
+ Location: 1:76921
+ Links: 1
+/E/F/grp_dsets Group
+ Location: 1:75044
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+/E/F/grp_dsets/chunk Dataset {6/6}
+ Location: 1:76014
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ 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:75367
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/E/F/grp_dsets/compound Dataset {2/2}
+ Location: 1:75470
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: struct {
+ "str1" +0 20-byte null-terminated ASCII string
+ "str2" +20 20-byte null-terminated ASCII string
+ } 40 bytes
+/E/F/grp_dsets/compressed Dataset {6/6}
+ Location: 1:75683
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ 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:75853
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: shared-1:75793 variable length of
+ 32-bit little-endian integer
+/E/F/grp_dsets/nested_vl Dataset {2/2}
+ Location: 1:76108
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ 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:75274
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/E/F/grp_dsets/vl Type
+ Location: 1:75793
+ Links: 2
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Type: shared-1:75793 variable length of
+ 32-bit little-endian integer
+/G Group
+ Location: 1:85688
+ Links: 1
+/G/H Group
+ Location: 1:86392
+ Links: 1
+/G/H/grp_nested Group
+ Location: 1:84436
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+/G/H/grp_nested/grp_dsets Group
+ Location: 1:84515
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+/G/H/grp_nested/grp_dsets/chunk Dataset {6/6}
+ Location: 1:85485
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ 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:84838
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/G/H/grp_nested/grp_dsets/compound Dataset {2/2}
+ Location: 1:84941
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: struct {
+ "str1" +0 20-byte null-terminated ASCII string
+ "str2" +20 20-byte null-terminated ASCII string
+ } 40 bytes
+/G/H/grp_nested/grp_dsets/compressed Dataset {6/6}
+ Location: 1:85154
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ 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:85324
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: shared-1:85264 variable length of
+ 32-bit little-endian integer
+/G/H/grp_nested/grp_dsets/nested_vl Dataset {2/2}
+ Location: 1:85579
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ 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:84745
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/G/H/grp_nested/grp_dsets/vl Type
+ Location: 1:85264
+ Links: 2
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Type: shared-1:85264 variable length of
+ 32-bit little-endian integer
+/chunk Dataset {6/6}
+ Location: 1:2238
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Chunks: {2} 8 bytes
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/compact Dataset {6/6}
+ Location: 1:4240
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/compound Dataset {2/2}
+ Location: 1:6391
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: struct {
+ "str1" +0 20-byte null-terminated ASCII string
+ "str2" +20 20-byte null-terminated ASCII string
+ } 40 bytes
+/compressed Dataset {6/6}
+ Location: 1:6604
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Chunks: {2} 8 bytes
+ Storage: <details removed for portability>
+ Filter-0: deflate-1 OPT {1}
+ Type: 32-bit little-endian integer
+/grp_dsets Group
+ Location: 1:27748
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+/grp_dsets/chunk Dataset {6/6}
+ Location: 1:28718
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Chunks: {2} 8 bytes
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/grp_dsets/compact Dataset {6/6}
+ Location: 1:28071
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/grp_dsets/compound Dataset {2/2}
+ Location: 1:28174
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: struct {
+ "str1" +0 20-byte null-terminated ASCII string
+ "str2" +20 20-byte null-terminated ASCII string
+ } 40 bytes
+/grp_dsets/compressed Dataset {6/6}
+ Location: 1:28387
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ 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:28557
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: shared-1:28497 variable length of
+ 32-bit little-endian integer
+/grp_dsets/nested_vl Dataset {2/2}
+ Location: 1:28812
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ 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:27978
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/grp_dsets/simple_group Dataset {6/6}
+ Location: 1:46180
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/grp_dsets/vl Type
+ Location: 1:28497
+ Links: 2
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Type: shared-1:28497 variable length of
+ 32-bit little-endian integer
+/grp_empty Group
+ Location: 1:27693
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+/grp_nested Group
+ Location: 1:35940
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+/grp_nested/grp_dsets Group
+ Location: 1:36019
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+/grp_nested/grp_dsets/chunk Dataset {6/6}
+ Location: 1:36989
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ 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:36342
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/grp_nested/grp_dsets/compound Dataset {2/2}
+ Location: 1:36445
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: struct {
+ "str1" +0 20-byte null-terminated ASCII string
+ "str2" +20 20-byte null-terminated ASCII string
+ } 40 bytes
+/grp_nested/grp_dsets/compressed Dataset {6/6}
+ Location: 1:36658
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ 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:36828
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: shared-1:36768 variable length of
+ 32-bit little-endian integer
+/grp_nested/grp_dsets/nested_vl Dataset {2/2}
+ Location: 1:37083
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ 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:36249
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/grp_nested/grp_dsets/vl Type
+ Location: 1:36768
+ Links: 2
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Type: shared-1:36768 variable length of
+ 32-bit little-endian integer
+/grp_rename Group
+ Location: 1:47077
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+/grp_rename/chunk Dataset {6/6}
+ Location: 1:48047
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Chunks: {2} 8 bytes
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/grp_rename/compact Dataset {6/6}
+ Location: 1:47400
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/grp_rename/compound Dataset {2/2}
+ Location: 1:47503
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: struct {
+ "str1" +0 20-byte null-terminated ASCII string
+ "str2" +20 20-byte null-terminated ASCII string
+ } 40 bytes
+/grp_rename/compressed Dataset {6/6}
+ Location: 1:47716
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ 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:55269
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+/grp_rename/grp_dsets/chunk Dataset {6/6}
+ Location: 1:56239
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ 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:55592
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/grp_rename/grp_dsets/compound Dataset {2/2}
+ Location: 1:55695
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: struct {
+ "str1" +0 20-byte null-terminated ASCII string
+ "str2" +20 20-byte null-terminated ASCII string
+ } 40 bytes
+/grp_rename/grp_dsets/compressed Dataset {6/6}
+ Location: 1:55908
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ 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:56078
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: shared-1:56018 variable length of
+ 32-bit little-endian integer
+/grp_rename/grp_dsets/nested_vl Dataset {2/2}
+ Location: 1:56333
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ 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:55499
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/grp_rename/grp_dsets/vl Type
+ Location: 1:56018
+ Links: 2
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Type: shared-1:56018 variable length of
+ 32-bit little-endian integer
+/grp_rename/named_vl Dataset {2/2}
+ Location: 1:47886
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: shared-1:47826 variable length of
+ 32-bit little-endian integer
+/grp_rename/nested_vl Dataset {2/2}
+ Location: 1:48141
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ 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:47307
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/grp_rename/vl Type
+ Location: 1:47826
+ Links: 2
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Type: shared-1:47826 variable length of
+ 32-bit little-endian integer
+/named_vl Dataset {2/2}
+ Location: 1:8657
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: shared-1:8606 variable length of
+ 32-bit little-endian integer
+/nested_vl Dataset {2/2}
+ Location: 1:22942
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: variable length of
+ variable length of
+ 32-bit little-endian integer
+/rename Dataset {2/2}
+ Location: 1:27240
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: struct {
+ "str1" +0 20-byte null-terminated ASCII string
+ "str2" +20 20-byte null-terminated ASCII string
+ } 40 bytes
+/simple Dataset {6/6}
+ Location: 1:800
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/simple_top Dataset {6/6}
+ Location: 1:25099
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
diff --git a/tools/test/h5copy/testh5copy.sh.in b/tools/test/h5copy/testh5copy.sh.in
new file mode 100644
index 0000000..6d1478a
--- /dev/null
+++ b/tools/test/h5copy/testh5copy.sh.in
@@ -0,0 +1,607 @@
+#! /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 h5copy tool
+#
+# Pedro Vicente Nunes (pvn@hdfgroup.org), Albert Cheng (acheng@hdfgroup.org)
+# Thursday, July 20, 2006
+#
+
+srcdir=@srcdir@
+
+# 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/test/h5diff/testfiles"
+SRC_H5COPY_TESTFILES="$SRC_TOOLS/test/h5copy/testfiles"
+SRC_H5REPACK_TESTFILES="$SRC_TOOLS/test/h5repack/testfiles"
+SRC_H5JAM_TESTFILES="$SRC_TOOLS/test/h5jam/testfiles"
+SRC_H5STAT_TESTFILES="$SRC_TOOLS/test/h5stat/testfiles"
+SRC_H5IMPORT_TESTFILES="$SRC_TOOLS/test/h5import/testfiles"
+
+TESTNAME=h5copy
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+
+######################################################################
+# 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 of files that will be copied over to local test dir
+LIST_HDF5_TEST_FILES="
+$SRC_H5COPY_TESTFILES/h5copytst.h5
+$SRC_H5COPY_TESTFILES/h5copy_ref.h5
+$SRC_H5COPY_TESTFILES/h5copy_extlinks_src.h5
+$SRC_H5COPY_TESTFILES/h5copy_extlinks_trg.h5
+"
+
+# List of expect files that will be copied over to local test dir
+LIST_OTHER_TEST_FILES="
+$SRC_H5COPY_TESTFILES/h5copy_misc1.out
+"
+
+H5COPY=../../src/h5copy/h5copy # The tool name
+H5COPY_BIN=`pwd`/$H5COPY # The path of the tool binary
+H5DIFF=../../src/h5diff/h5diff # The h5diff tool name
+H5DIFF_BIN=`pwd`/$H5DIFF # The path of the h5diff tool binary
+H5LS=../../src/h5ls/h5ls # The h5ls tool name
+H5LS_ARGS=-Svr # Arguments to the h5ls tool
+H5LS_BIN=`pwd`/$H5LS # The path of the h5ls tool binary
+
+RM='rm -rf'
+CMP='cmp -s'
+DIFF='diff -c'
+CP='cp'
+DIRNAME='dirname'
+LS='ls'
+AWK='awk'
+
+nerrors=0
+verbose=yes
+h5haveexitcode=yes # default is yes
+
+TESTDIR=./testfiles
+test -d $TESTDIR || mkdir $TESTDIR
+
+# RUNSERIAL is used. Check if it can return exit code from executalbe correctly.
+if [ -n "$RUNSERIAL_NOEXITCODE" ]; then
+ echo "***Warning*** Serial Exit Code is not passed back to shell corretly."
+ echo "***Warning*** Exit code checking is skipped."
+ h5haveexitcode=no
+fi
+
+#
+# copy test files and expected output files from source dirs to test dir
+#
+COPY_TESTFILES="$LIST_HDF5_TEST_FILES $LIST_OTHER_TEST_FILES"
+
+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
+ # skip cp if srcdir is same as destdir
+ # this occurs when build/test performed in source dir and
+ # make cp fail
+ SDIR=`$DIRNAME $tstfile`
+ INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
+ INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
+ if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
+ $CP -f $tstfile $TESTDIR
+ if [ $? -ne 0 ]; then
+ echo "Error: FAILED to copy $tstfile ."
+
+ # Comment out this to CREATE expected file
+ exit $EXIT_FAILURE
+ fi
+ fi
+ fi
+ done
+}
+
+CLEAN_TESTFILES_AND_TESTDIR()
+{
+ # skip rm if srcdir is same as destdir
+ # this occurs when build/test performed in source dir and
+ # make cp fail
+ SDIR=$SRC_H5COPY_TESTFILES
+ INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
+ INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
+ if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
+ $RM $TESTDIR
+ fi
+}
+
+
+# Print a "SKIP" message
+SKIP() {
+ TESTING $H5COPY $@
+ echo " -SKIP-"
+}
+
+# Print a line-line message left justified in a field of 70 characters
+# beginning with the word "Testing".
+TESTING()
+{
+ SPACES=" "
+ echo "Testing $* $SPACES" |cut -c1-70 |tr -d '\012'
+}
+
+# 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'
+}
+
+# Print a line-line message left justified in a field of 70 characters
+# beginning with the word "Verifying".
+#
+VERIFY_OUTPUT()
+{
+ SPACES=" "
+ echo "Verifying output files $* $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 h5copy can complete
+# with exit status 0, consider it pass. If a test fails then increment
+# the `nerrors' global variable.
+# Assumed arguments:
+# $1 is -i
+# $2 is input file
+# $3 is -o
+# $4 is output file
+# $* everything else arguments for h5copy.
+
+TOOLTEST()
+{
+ actualout="$TESTDIR/tooltest.actualout"
+ actualerr="$TESTDIR/tooltest.actualerr"
+ runh5diff=yes
+ if [ "$1" = -i ]; then
+ inputfile=$2
+ else
+ if [ "$1" = -f ]; then
+ inputfile=$4
+ else
+ inputfile=$3
+ fi
+ runh5diff=no
+ fi
+ if [ "$3" = -o ]; then
+ outputfile=$4
+ else
+ if [ "$1" = -f ]; then
+ outputfile=$6
+ else
+ outputfile=$5
+ fi
+ runh5diff=no
+ fi
+
+ TESTING $H5COPY $@
+ (
+ echo "#############################"
+ echo " output for '$H5COPY $@'"
+ echo "#############################"
+ $RUNSERIAL $H5COPY_BIN $@
+ ) > $actualout 2> $actualerr
+ RET=$?
+ if [ $RET != 0 ]; then
+ echo "*FAILED*"
+ echo "failed result is:"
+ cat $actualout
+ nerrors="`expr $nerrors + 1`"
+ else
+ echo " PASSED"
+
+ if [ $runh5diff != no ]; then
+ H5DIFFTEST $inputfile $outputfile $7 $9
+ fi
+
+ # Clean up output file
+ if test -z "$HDF5_NOCLEANUP"; then
+ rm -f $actualout $actualerr $outputfile
+ fi
+ fi
+}
+
+# TOOLTEST back-to-back
+TOOLTEST_PREFILL()
+{
+ actualout="$TESTDIR/tooltest.actualout"
+ actualerr="$TESTDIR/tooltest.actualerr"
+ runh5diff=yes
+ if [ "$1" = -i ]; then
+ inputfile=$2
+ else
+ runh5diff=no
+ fi
+ if [ "$3" = -o ]; then
+ outputfile=$4
+ else
+ runh5diff=no
+ fi
+
+ grp_name=$5
+ grp_name2=$6
+ obj_name=$7
+ obj_name2=$8
+
+ TESTING $H5COPY $@
+ (
+ echo "#############################"
+ echo " output for '$H5COPY $@'"
+ echo "#############################"
+ $RUNSERIAL $H5COPY_BIN -i $inputfile -o $outputfile -v -s $grp_name -d $grp_name2
+ ) > $actualout 2> $actualerr
+ RET=$?
+ if [ $RET != 0 ]; then
+ echo "*FAILED*"
+ echo "failed result is:"
+ cat $actualout
+ nerrors="`expr $nerrors + 1`"
+ else
+ TESTING $H5COPY $@
+ (
+ echo "#############################"
+ echo " output for '$H5COPY $@'"
+ echo "#############################"
+ $RUNSERIAL $H5COPY_BIN -i $inputfile -o $outputfile -v -s $obj_name -d $obj_name2
+ ) > $actualout 2> $actualerr
+ RET=$?
+ if [ $RET != 0 ]; then
+ echo "*FAILED*"
+ echo "failed result is:"
+ cat $actualout
+ nerrors="`expr $nerrors + 1`"
+ else
+ echo " PASSED"
+
+ if [ $runh5diff != no ]; then
+ H5DIFFTEST $inputfile $outputfile $obj_name $obj_name2
+ fi
+
+ # Clean up output file
+ if test -z "$HDF5_NOCLEANUP"; then
+ rm -f $actualout $actualerr $outputfile
+ fi
+ fi
+ fi
+}
+
+# TOOLTEST back-to-back
+TOOLTEST_SAME()
+{
+ actualout="$TESTDIR/tooltest.actualout"
+ actualerr="$TESTDIR/tooltest.actualerr"
+ runh5diff=yes
+ if [ "$1" = -i ]; then
+ inputfile=$2
+ else
+ runh5diff=no
+ fi
+ if [ "$3" = -o ]; then
+ outputfile=$4
+ else
+ runh5diff=no
+ fi
+
+ grp_name=$5
+ grp_name2=$6
+
+ TESTING $H5COPY $@
+ (
+ echo "#############################"
+ echo " output for '$H5COPY $@'"
+ echo "#############################"
+ $RUNSERIAL $H5COPY_BIN -i $inputfile -o $outputfile -v -s $grp_name -d $grp_name
+ ) > $actualout 2> $actualerr
+ RET=$?
+ if [ $RET != 0 ]; then
+ echo "*FAILED*"
+ echo "failed result is:"
+ cat $actualout
+ nerrors="`expr $nerrors + 1`"
+ else
+ TESTING $H5COPY $@
+ (
+ echo "#############################"
+ echo " output for '$H5COPY $@'"
+ echo "#############################"
+ $RUNSERIAL $H5COPY_BIN -i $outputfile -o $outputfile -v -s $grp_name -d $grp_name2
+ ) > $actualout 2> $actualerr
+ RET=$?
+ if [ $RET != 0 ]; then
+ echo "*FAILED*"
+ echo "failed result is:"
+ cat $actualout
+ nerrors="`expr $nerrors + 1`"
+ else
+ echo " PASSED"
+
+ if [ $runh5diff != no ]; then
+ H5DIFFTEST $outputfile $outputfile $grp_name $grp_name2
+ fi
+
+ # Clean up output file
+ if test -z "$HDF5_NOCLEANUP"; then
+ rm -f $actualout $actualerr $outputfile
+ fi
+ fi
+ fi
+}
+
+
+# Compare the two text files
+# PASS if same
+# FAIL if different, and show the diff
+#
+# Assumed arguments:
+# $1 is text file1 (expected output)
+# $2 is text file2 (actual output)
+CMP_OUTPUT()
+{
+ expect=$1
+ actual=$2
+
+ VERIFY_OUTPUT $@
+ 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 output differs from actual output"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /'
+ fi
+}
+
+TOOLTEST_FAIL()
+{
+ expectout="$TESTDIR/$1"
+ actualout="$TESTDIR/$1.actualout"
+ actualerr="$TESTDIR/$1.actualerr"
+ actualout_sav=${actualout}-sav
+ actualerr_sav=${actualerr}-sav
+ shift
+ if [ "$1" = -i ]; then
+ inputfile=$2
+ fi
+ if [ "$3" = -o ]; then
+ outputfile=$4
+ fi
+
+ TESTING $H5COPY $@
+ (
+ #echo "#############################"
+ #echo " output for '$H5COPY $@'"
+ #echo "#############################"
+ $RUNSERIAL $H5COPY_BIN $@
+ ) > $actualout 2> $actualerr
+
+ RET=$?
+ # save actualout and actualerr in case they are needed later.
+ cp $actualout $actualout_sav
+ STDOUT_FILTER $actualout
+ cp $actualerr $actualerr_sav
+ STDERR_FILTER $actualerr
+ if [ $RET != 0 ]; then
+ echo " PASSED"
+ # Verifying output text from h5copy
+ if [ "$expectout" != "SKIP" ]; then
+ # combine stderr to stdout to compare the output at once.
+ # We may seperate stdout and stderr later.
+ cat $actualerr >> $actualout
+ CMP_OUTPUT $expectout $actualout
+ fi
+ else
+ echo "*FAILED*"
+ echo "failed result is:"
+ cat $actualout
+ nerrors="`expr $nerrors + 1`"
+ fi
+
+
+ # Clean up output file
+ if test -z "$HDF5_NOCLEANUP"; then
+ rm -f $actualout $actualerr $actualout_sav $actualerr_sav $outputfile
+ fi
+}
+
+
+# Call the h5diff tool
+#
+H5DIFFTEST()
+{
+ VERIFY $@
+ $RUNSERIAL $H5DIFF_BIN -q "$@"
+ RET=$?
+ if [ $RET != 0 ] ; then
+ echo "*FAILED*"
+ nerrors="`expr $nerrors + 1`"
+ else
+ echo " PASSED"
+ fi
+}
+
+# Call the h5diff tool with a call that is expected to fail
+#
+H5DIFFTEST_FAIL()
+{
+ VERIFY $@
+ $RUNSERIAL $H5DIFF_BIN -q "$@"
+ RET=$?
+
+ if [ $h5haveexitcode = 'yes' -a $RET != 1 ] ; then
+ echo "*FAILED*"
+ nerrors="`expr $nerrors + 1`"
+ else
+ echo " PASSED"
+ fi
+}
+
+# Copy single datasets of various forms from one group to another,
+# adding object copied to the destination file each time
+#
+# Assumed arguments:
+# <none>
+COPY_OBJECTS()
+{
+ TESTFILE="$TESTDIR/h5copytst.h5"
+
+ echo "Test copying various forms of datasets"
+ TOOLTEST -i $TESTFILE -o $TESTDIR/simple.out.h5 -v -s simple -d simple
+ TOOLTEST -i $TESTFILE -o $TESTDIR/chunk.out.h5 -v -s chunk -d chunk
+ TOOLTEST -i $TESTFILE -o $TESTDIR/compact.out.h5 -v -s compact -d compact
+ TOOLTEST -i $TESTFILE -o $TESTDIR/compound.out.h5 -v -s compound -d compound
+ TOOLTEST -i $TESTFILE -o $TESTDIR/compressed.out.h5 -v -s compressed -d compressed
+ TOOLTEST -i $TESTFILE -o $TESTDIR/named_vl.out.h5 -v -s named_vl -d named_vl
+ TOOLTEST -i $TESTFILE -o $TESTDIR/nested_vl.out.h5 -v -s nested_vl -d nested_vl
+ TOOLTEST -i $TESTFILE -o $TESTDIR/dset_attr.out.h5 -v -s /dset_attr -d /dset_attr
+
+ echo "Test copying dataset within group in source file to root of destination"
+ TOOLTEST -i $TESTFILE -o $TESTDIR/simple_top.out.h5 -v -s grp_dsets/simple -d simple_top
+
+ echo "Test copying & renaming dataset"
+ TOOLTEST -i $TESTFILE -o $TESTDIR/dsrename.out.h5 -v -s compound -d rename
+
+ echo "Test copying empty, 'full' & 'nested' groups"
+ TOOLTEST -i $TESTFILE -o $TESTDIR/grp_empty.out.h5 -v -s grp_empty -d grp_empty
+ TOOLTEST -i $TESTFILE -o $TESTDIR/grp_dsets.out.h5 -v -s grp_dsets -d grp_dsets
+ TOOLTEST -i $TESTFILE -o $TESTDIR/grp_nested.out.h5 -v -s grp_nested -d grp_nested
+ TOOLTEST -i $TESTFILE -o $TESTDIR/grp_attr.out.h5 -v -s grp_attr -d grp_attr
+
+ echo "Test copying dataset within group in source file to group in destination"
+ TOOLTEST_PREFILL -i $TESTFILE -o $TESTDIR/simple_group.out.h5 grp_dsets grp_dsets /grp_dsets/simple /grp_dsets/simple_group
+
+ echo "Test copying & renaming group"
+ TOOLTEST -i $TESTFILE -o $TESTDIR/grp_rename.out.h5 -v -s grp_dsets -d grp_rename
+
+ echo "Test copying 'full' group hierarchy into group in destination file"
+ TOOLTEST_PREFILL -i $TESTFILE -o $TESTDIR/grp_dsets_rename.out.h5 grp_dsets grp_rename grp_dsets /grp_rename/grp_dsets
+
+ echo "Test copying objects into group hier. that doesn't exist yet in destination file"
+ TOOLTEST -i $TESTFILE -o $TESTDIR/A_B1_simple.out.h5 -vp -s simple -d /A/B1/simple
+ TOOLTEST -i $TESTFILE -o $TESTDIR/A_B2_simple2.out.h5 -vp -s simple -d /A/B2/simple2
+ TOOLTEST -i $TESTFILE -o $TESTDIR/C_D_simple.out.h5 -vp -s /grp_dsets/simple -d /C/D/simple
+ TOOLTEST -i $TESTFILE -o $TESTDIR/E_F_grp_dsets.out.h5 -vp -s /grp_dsets -d /E/F/grp_dsets
+ TOOLTEST -i $TESTFILE -o $TESTDIR/G_H_grp_nested.out.h5 -vp -s /grp_nested -d /G/H/grp_nested
+}
+
+# Copy references in various way.
+#
+# Assumed arguments:
+# <none>
+COPY_REFERENCES()
+{
+ TESTFILE="$TESTDIR/h5copy_ref.h5"
+
+ echo "Test copying object and region references"
+ TOOLTEST -f ref -i $TESTFILE -o $TESTDIR/region_ref.out.h5 -v -s / -d /COPY
+}
+
+# Copy external links.
+# adding to the destination file each time compare the result
+#
+# Assumed arguments:
+# <none>
+COPY_EXT_LINKS()
+{
+ TESTFILE="$TESTDIR/h5copy_extlinks_src.h5"
+
+ echo "Test copying external link directly without -f ext"
+ TOOLTEST -v -i $TESTFILE -o $TESTDIR/ext_link.out.h5 -s /group_ext/extlink_dset -d /copy1_dset
+
+ echo "Test copying external link directly with -f ext"
+ TOOLTEST -f ext -i $TESTFILE -o $TESTDIR/ext_link_f.out.h5 -v -s /group_ext/extlink_dset -d /copy2_dset
+
+ echo "Test copying dangling external link (no obj) directly without -f ext"
+ TOOLTEST -v -i $TESTFILE -o $TESTDIR/ext_dangle_noobj.out.h5 -s /group_ext/extlink_notyet1 -d /copy_dangle1_1
+
+ echo "Test copying dangling external link (no obj) directly with -f ext"
+ TOOLTEST -f ext -i $TESTFILE -o $TESTDIR/ext_dangle_noobj_f.out.h5 -v -s /group_ext/extlink_notyet1 -d /copy_dangle1_2
+
+ echo "Test copying dangling external link (no file) directly without -f ext"
+ TOOLTEST -v -i $TESTFILE -o $TESTDIR/ext_dangle_nofile.out.h5 -s /group_ext/extlink_notyet2 -d /copy_dangle2_1
+
+ echo "Test copying dangling external link (no file) directly with -f ext"
+ TOOLTEST -f ext -i $TESTFILE -o $TESTDIR/ext_dangle_nofile_f.out.h5 -v -s /group_ext/extlink_notyet2 -d /copy_dangle2_2
+
+ echo "Test copying a group contains external links without -f ext"
+ TOOLTEST -v -i $TESTFILE -o $TESTDIR/ext_link_group.out.h5 -s /group_ext -d /copy1_group
+
+ echo "Test copying a group contains external links with -f ext"
+ TOOLTEST -f ext -i $TESTFILE -o $TESTDIR/ext_link_group_f.out.h5 -v -s /group_ext -d /copy2_group
+}
+
+# Test misc.
+#
+# Assumed arguments:
+# <none>
+TEST_MISC()
+{
+ TESTFILE="$TESTDIR/h5copytst.h5"
+
+ echo "Test copying object into group which doesn't exist, without -p"
+ TOOLTEST_FAIL h5copy_misc1.out -i $TESTFILE -o $TESTDIR/h5copy_misc1.out.h5 -v -s /simple -d /g1/g2/simple
+
+ echo "Test copying objects to the same file "
+ TOOLTEST_SAME -i $TESTFILE -o $TESTDIR/samefile1.out.h5 /simple /simple_cp
+ TOOLTEST_SAME -i $TESTFILE -o $TESTDIR/samefile2.out.h5 /grp_dsets /grp_dsets_cp
+}
+
+##############################################################################
+### T H E T E S T S ###
+##############################################################################
+# prepare for test
+COPY_TESTFILES_TO_TESTDIR
+
+# Start tests
+COPY_OBJECTS
+COPY_REFERENCES
+COPY_EXT_LINKS
+TEST_MISC
+
+# Clean up temporary files/directories
+CLEAN_TESTFILES_AND_TESTDIR
+
+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/test/h5diff/CMakeLists.txt b/tools/test/h5diff/CMakeLists.txt
new file mode 100644
index 0000000..2507664
--- /dev/null
+++ b/tools/test/h5diff/CMakeLists.txt
@@ -0,0 +1,22 @@
+cmake_minimum_required (VERSION 3.1.0)
+PROJECT (HDF5_TOOLS_TEST_H5DIFF)
+
+#-----------------------------------------------------------------------------
+# Setup include Directories
+#-----------------------------------------------------------------------------
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib)
+
+ # --------------------------------------------------------------------
+ # Add the h5diff and test executables
+ # --------------------------------------------------------------------
+ if (HDF5_BUILD_GENERATORS)
+ add_executable (h5diffgentest ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/h5diffgentest.c)
+ TARGET_NAMING (h5diffgentest STATIC)
+ TARGET_C_PROPERTIES (h5diffgentest STATIC " " " ")
+ target_link_libraries (h5diffgentest ${HDF5_LIB_TARGET})
+ set_target_properties (h5diffgentest PROPERTIES FOLDER generator/tools)
+
+ #add_test (NAME h5diffgentest COMMAND $<TARGET_FILE:h5diffgentest>)
+ endif (HDF5_BUILD_GENERATORS)
+
+ include (CMakeTests.cmake)
diff --git a/tools/test/h5diff/CMakeTests.cmake b/tools/test/h5diff/CMakeTests.cmake
new file mode 100644
index 0000000..7bbff61
--- /dev/null
+++ b/tools/test/h5diff/CMakeTests.cmake
@@ -0,0 +1,1362 @@
+
+##############################################################################
+##############################################################################
+### T E S T I N G ###
+##############################################################################
+##############################################################################
+
+ # --------------------------------------------------------------------
+ # Copy all the HDF5 files from the test directory into the source directory
+ # --------------------------------------------------------------------
+ set (LIST_HDF5_TEST_FILES
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_basic1.h5
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_basic2.h5
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_types.h5
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_dtypes.h5
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_attr1.h5
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_attr2.h5
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_dset1.h5
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_dset2.h5
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_hyper1.h5
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_hyper2.h5
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_empty.h5
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_links.h5
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_softlinks.h5
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_linked_softlink.h5
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_extlink_src.h5
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_extlink_trg.h5
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_ext2softlink_src.h5
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_ext2softlink_trg.h5
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_dset_zero_dim_size1.h5
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_dset_zero_dim_size2.h5
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_danglelinks1.h5
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_danglelinks2.h5
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_grp_recurse1.h5
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_grp_recurse2.h5
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_grp_recurse_ext1.h5
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_grp_recurse_ext2-1.h5
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_grp_recurse_ext2-2.h5
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_grp_recurse_ext2-3.h5
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_exclude1-1.h5
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_exclude1-2.h5
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_exclude2-1.h5
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_exclude2-2.h5
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_exclude3-1.h5
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_exclude3-2.h5
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_comp_vl_strs.h5
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_attr_v_level1.h5
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_attr_v_level2.h5
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/compounds_array_vlen1.h5
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/compounds_array_vlen2.h5
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/non_comparables1.h5
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/non_comparables2.h5
+ # tools/testfiles/vds
+ ${HDF5_TOOLS_DIR}/testfiles/vds/1_a.h5
+ ${HDF5_TOOLS_DIR}/testfiles/vds/1_b.h5
+ ${HDF5_TOOLS_DIR}/testfiles/vds/1_c.h5
+ ${HDF5_TOOLS_DIR}/testfiles/vds/1_d.h5
+ ${HDF5_TOOLS_DIR}/testfiles/vds/1_e.h5
+ ${HDF5_TOOLS_DIR}/testfiles/vds/1_f.h5
+ ${HDF5_TOOLS_DIR}/testfiles/vds/1_vds.h5
+ ${HDF5_TOOLS_DIR}/testfiles/vds/2_a.h5
+ ${HDF5_TOOLS_DIR}/testfiles/vds/2_b.h5
+ ${HDF5_TOOLS_DIR}/testfiles/vds/2_c.h5
+ ${HDF5_TOOLS_DIR}/testfiles/vds/2_d.h5
+ ${HDF5_TOOLS_DIR}/testfiles/vds/2_e.h5
+ ${HDF5_TOOLS_DIR}/testfiles/vds/2_vds.h5
+ ${HDF5_TOOLS_DIR}/testfiles/vds/3_1_vds.h5
+ ${HDF5_TOOLS_DIR}/testfiles/vds/3_2_vds.h5
+ ${HDF5_TOOLS_DIR}/testfiles/vds/4_0.h5
+ ${HDF5_TOOLS_DIR}/testfiles/vds/4_1.h5
+ ${HDF5_TOOLS_DIR}/testfiles/vds/4_2.h5
+ ${HDF5_TOOLS_DIR}/testfiles/vds/4_vds.h5
+ ${HDF5_TOOLS_DIR}/testfiles/vds/5_a.h5
+ ${HDF5_TOOLS_DIR}/testfiles/vds/5_b.h5
+ ${HDF5_TOOLS_DIR}/testfiles/vds/5_c.h5
+ ${HDF5_TOOLS_DIR}/testfiles/vds/5_vds.h5
+ )
+
+ set (LIST_OTHER_TEST_FILES
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_10.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_100.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_11.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_12.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_13.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_14.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_15.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_16_1.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_16_2.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_16_3.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_17.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_171.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_172.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_18_1.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_18.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_20.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_200.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_201.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_202.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_203.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_204.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_205.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_206.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_207.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_208.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_220.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_221.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_222.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_223.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_224.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_21.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_22.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_23.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_24.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_25.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_26.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_27.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_28.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_300.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_400.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_401.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_402.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_403.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_404.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_405.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_406.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_407.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_408.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_409.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_410.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_411.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_412.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_413.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_414.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_415.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_416.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_417.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_418.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_419.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_420.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_421.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_422.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_423.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_424.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_425.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_450.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_451.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_452.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_453.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_454.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_455.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_456.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_457.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_458.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_459.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_465.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_466.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_467.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_468.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_469.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_471.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_472.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_473.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_474.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_475.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_480.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_481.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_482.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_483.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_484.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_485.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_486.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_487.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_50.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_51.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_52.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_53.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_54.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_55.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_56.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_57.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_58.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_59.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_500.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_501.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_502.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_503.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_504.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_505.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_506.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_507.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_508.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_509.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_510.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_511.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_512.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_513.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_514.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_515.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_516.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_517.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_518.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_530.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_540.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_600.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_601.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_603.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_604.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_605.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_606.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_607.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_608.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_609.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_610.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_612.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_613.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_614.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_615.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_616.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_617.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_618.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_619.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_621.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_622.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_623.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_624.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_625.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_626.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_627.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_628.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_629.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_630.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_631.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_640.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_641.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_642.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_643.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_644.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_645.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_646.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_70.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_700.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_701.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_702.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_703.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_704.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_705.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_706.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_707.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_708.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_709.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_710.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_80.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_90.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_v1.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_v2.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_v3.txt
+ )
+
+ set (LIST_WIN_TEST_FILES
+ h5diff_101
+ h5diff_102
+ h5diff_103
+ h5diff_104
+ )
+
+ # Make testfiles dir under build dir
+ file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
+
+ #
+ # 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)
+ HDFTEST_COPY_FILE("${h5_tstfiles}" "${PROJECT_BINARY_DIR}/testfiles/${fname}" "h5diff_files")
+ endforeach ()
+
+
+ #
+ # Overwrite system dependent files (Windows) and not VS2015
+ #
+ if (WIN32 AND MSVC_VERSION LESS 1900)
+ foreach (h5_tstfiles ${LIST_WIN_TEST_FILES})
+ get_filename_component(fname "${h5_tstfiles}" NAME)
+ HDFTEST_COPY_FILE("${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/${h5_tstfiles}w.txt" "${PROJECT_BINARY_DIR}/testfiles/${fname}.txt" "h5diff_files")
+ endforeach ()
+ else ()
+ foreach (h5_tstfiles ${LIST_WIN_TEST_FILES})
+ get_filename_component(fname "${h5_tstfiles}" NAME)
+ HDFTEST_COPY_FILE("${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/${h5_tstfiles}.txt" "${PROJECT_BINARY_DIR}/testfiles/${fname}.txt" "h5diff_files")
+ endforeach ()
+ endif ()
+ add_custom_target(h5diff_files ALL COMMENT "Copying files needed by h5diff tests" DEPENDS ${h5diff_files_list})
+
+##############################################################################
+##############################################################################
+### T H E T E S T S M A C R O S ###
+##############################################################################
+##############################################################################
+
+ MACRO (ADD_H5_TEST resultfile resultcode)
+ # 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 ()
+ if (NOT "${last_test}" STREQUAL "")
+ set_tests_properties (H5DIFF-${resultfile} PROPERTIES DEPENDS ${last_test})
+ endif ()
+ else (HDF5_ENABLE_USING_MEMCHECKER)
+ 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}/testfiles"
+ -D "TEST_OUTPUT=${resultfile}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=${resultfile}.txt"
+ -D "TEST_APPEND=EXIT CODE:"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ endif (HDF5_ENABLE_USING_MEMCHECKER)
+ if (H5_HAVE_PARALLEL)
+ ADD_PH5_TEST (${resultfile} ${resultcode} ${ARGN})
+ endif ()
+ ENDMACRO (ADD_H5_TEST file)
+
+ MACRO (ADD_PH5_TEST resultfile resultcode)
+ # 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 ()
+ if (NOT "${last_test}" STREQUAL "")
+ set_tests_properties (PH5DIFF-${resultfile} PROPERTIES DEPENDS ${last_test})
+ endif ()
+ else (HDF5_ENABLE_USING_MEMCHECKER)
+ 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}/testfiles"
+ -D "TEST_OUTPUT=P_${resultfile}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=${resultfile}.txt"
+# -D "TEST_APPEND=EXIT CODE: [0-9]"
+# -D "TEST_REF_FILTER=EXIT CODE: 0"
+ -D "TEST_SKIP_COMPARE=TRUE"
+ -P "${HDF_RESOURCES_EXT_DIR}/prunTest.cmake"
+ )
+ endif (HDF5_ENABLE_USING_MEMCHECKER)
+ ENDMACRO (ADD_PH5_TEST file)
+
+##############################################################################
+##############################################################################
+### T H E T E S T S ###
+##############################################################################
+##############################################################################
+
+ # --------------------------------------------------------------------
+ # test file names
+ # --------------------------------------------------------------------
+ set (FILE1 h5diff_basic1.h5)
+ set (FILE2 h5diff_basic2.h5)
+ set (FILE3 h5diff_types.h5)
+ set (FILE4 h5diff_dtypes.h5)
+ set (FILE5 h5diff_attr1.h5)
+ set (FILE6 h5diff_attr2.h5)
+ set (FILE7 h5diff_dset1.h5)
+ set (FILE8 h5diff_dset2.h5)
+ set (FILE9 h5diff_hyper1.h5)
+ set (FILE10 h5diff_hyper2.h5)
+ set (FILE11 h5diff_empty.h5)
+ set (FILE12 h5diff_links.h5)
+ set (FILE13 h5diff_softlinks.h5)
+ set (FILE14 h5diff_linked_softlink.h5)
+ set (FILE15 h5diff_extlink_src.h5)
+ set (FILE16 h5diff_extlink_trg.h5)
+ set (FILE17 h5diff_ext2softlink_src.h5)
+ set (FILE18 h5diff_ext2softlink_trg.h5)
+ set (FILE19 h5diff_dset_zero_dim_size1.h5)
+ set (FILE20 h5diff_dset_zero_dim_size2.h5)
+ set (DANGLE_LINK_FILE1 h5diff_danglelinks1.h5)
+ set (DANGLE_LINK_FILE2 h5diff_danglelinks2.h5)
+ set (GRP_RECURSE_FILE1 h5diff_grp_recurse1.h5)
+ set (GRP_RECURSE_FILE2 h5diff_grp_recurse2.h5)
+ # group recursive - same structure via external links through files
+ set (GRP_RECURSE1_EXT h5diff_grp_recurse_ext1.h5)
+ set (GRP_RECURSE2_EXT1 h5diff_grp_recurse_ext2-1.h5)
+ set (GRP_RECURSE2_EXT2 h5diff_grp_recurse_ext2-2.h5)
+ set (GRP_RECURSE2_EXT3 h5diff_grp_recurse_ext2-3.h5)
+ # same structure, same obj name with different value
+ set (EXCLUDE_FILE1_1 h5diff_exclude1-1.h5)
+ set (EXCLUDE_FILE1_2 h5diff_exclude1-2.h5)
+ # different structure and obj names
+ set (EXCLUDE_FILE2_1 h5diff_exclude2-1.h5)
+ set (EXCLUDE_FILE2_2 h5diff_exclude2-2.h5)
+ # Only one file contains unique objs. Common objs are same.
+ set (EXCLUDE_FILE3_1 h5diff_exclude3-1.h5)
+ set (EXCLUDE_FILE3_2 h5diff_exclude3-2.h5)
+ # compound type with multiple vlen string types
+ set (COMP_VL_STRS_FILE h5diff_comp_vl_strs.h5)
+ # container types (array,vlen) with multiple nested compound types
+ set (COMPS_ARRAY_VLEN_FILE1 compounds_array_vlen1.h5)
+ set (COMPS_ARRAY_VLEN_FILE2 compounds_array_vlen2.h5)
+ # attrs with verbose option level
+ set (ATTR_VERBOSE_LEVEL_FILE1 h5diff_attr_v_level1.h5)
+ set (ATTR_VERBOSE_LEVEL_FILE2 h5diff_attr_v_level2.h5)
+# VDS tests
+ set (FILEV1 1_vds.h5)
+ set (FILEV2 2_vds.h5)
+ set (FILEV3_1 3_1_vds.h5)
+ set (FILEV3_2 3_2_vds.h5)
+ set (FILEV4 4_vds.h5)
+ set (FILEV5 5_vds.h5)
+
+ if (HDF5_ENABLE_USING_MEMCHECKER)
+ # Remove any output file left over from previous test run
+ add_test (
+ NAME H5DIFF-clearall-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ h5diff_10.out
+ h5diff_10.out.err
+ h5diff_100.out
+ h5diff_100.out.err
+ h5diff_101.out
+ h5diff_101.out.err
+ h5diff_102.out
+ h5diff_102.out.err
+ h5diff_103.out
+ h5diff_103.out.err
+ h5diff_104.out
+ h5diff_104.out.err
+ h5diff_11.out
+ h5diff_11.out.err
+ h5diff_12.out
+ h5diff_12.out.err
+ h5diff_13.out
+ h5diff_13.out.err
+ h5diff_14.out
+ h5diff_14.out.err
+ h5diff_15.out
+ h5diff_15.out.err
+ h5diff_16_1.out
+ h5diff_16_1.out.err
+ h5diff_16_2.out
+ h5diff_16_2.out.err
+ h5diff_16_3.out
+ h5diff_16_3.out.err
+ h5diff_17.out
+ h5diff_17.out.err
+ h5diff_171.out
+ h5diff_171.out.err
+ h5diff_172.out
+ h5diff_172.out.err
+ h5diff_18_1.out
+ h5diff_18_1.out.err
+ h5diff_18.out
+ h5diff_18.out.err
+ h5diff_20.out
+ h5diff_20.out.err
+ h5diff_200.out
+ h5diff_200.out.err
+ h5diff_201.out
+ h5diff_201.out.err
+ h5diff_202.out
+ h5diff_202.out.err
+ h5diff_203.out
+ h5diff_203.out.err
+ h5diff_204.out
+ h5diff_204.out.err
+ h5diff_205.out
+ h5diff_205.out.err
+ h5diff_206.out
+ h5diff_206.out.err
+ h5diff_207.out
+ h5diff_207.out.err
+ h5diff_208.out
+ h5diff_208.out.err
+ h5diff_220.out
+ h5diff_220.out.err
+ h5diff_221.out
+ 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
+ h5diff_22.out.err
+ h5diff_23.out
+ h5diff_23.out.err
+ h5diff_24.out
+ h5diff_24.out.err
+ h5diff_25.out
+ h5diff_25.out.err
+ h5diff_26.out
+ h5diff_26.out.err
+ h5diff_27.out
+ h5diff_27.out.err
+ h5diff_28.out
+ h5diff_28.out.err
+ h5diff_300.out
+ h5diff_300.out.err
+ h5diff_400.out
+ h5diff_400.out.err
+ h5diff_401.out
+ h5diff_401.out.err
+ h5diff_402.out
+ h5diff_402.out.err
+ h5diff_403.out
+ h5diff_403.out.err
+ h5diff_404.out
+ h5diff_404.out.err
+ h5diff_405.out
+ h5diff_405.out.err
+ h5diff_406.out
+ h5diff_406.out.err
+ h5diff_407.out
+ h5diff_407.out.err
+ h5diff_408.out
+ h5diff_408.out.err
+ h5diff_409.out
+ h5diff_409.out.err
+ h5diff_410.out
+ h5diff_410.out.err
+ h5diff_411.out
+ h5diff_411.out.err
+ h5diff_412.out
+ h5diff_412.out.err
+ h5diff_413.out
+ h5diff_413.out.err
+ h5diff_414.out
+ h5diff_414.out.err
+ h5diff_415.out
+ h5diff_415.out.err
+ h5diff_416.out
+ h5diff_416.out.err
+ h5diff_417.out
+ h5diff_417.out.err
+ h5diff_418.out
+ h5diff_418.out.err
+ h5diff_419.out
+ h5diff_419.out.err
+ h5diff_420.out
+ h5diff_420.out.err
+ h5diff_421.out
+ h5diff_421.out.err
+ h5diff_422.out
+ h5diff_422.out.err
+ h5diff_423.out
+ h5diff_423.out.err
+ h5diff_424.out
+ h5diff_424.out.err
+ h5diff_425.out
+ h5diff_425.out.err
+ h5diff_450.out
+ h5diff_450.out.err
+ h5diff_451.out
+ h5diff_451.out.err
+ h5diff_452.out
+ h5diff_452.out.err
+ h5diff_453.out
+ h5diff_453.out.err
+ h5diff_454.out
+ h5diff_454.out.err
+ h5diff_455.out
+ h5diff_455.out.err
+ h5diff_456.out
+ h5diff_456.out.err
+ h5diff_457.out
+ h5diff_457.out.err
+ h5diff_458.out
+ h5diff_458.out.err
+ h5diff_459.out
+ h5diff_459.out.err
+ h5diff_465.out
+ h5diff_465.out.err
+ h5diff_466.out
+ h5diff_466.out.err
+ h5diff_467.out
+ h5diff_467.out.err
+ h5diff_468.out
+ 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
+ h5diff_481.out.err
+ h5diff_482.out
+ h5diff_482.out.err
+ h5diff_483.out
+ h5diff_483.out.err
+ h5diff_484.out
+ h5diff_484.out.err
+ h5diff_50.out
+ h5diff_50.out.err
+ h5diff_51.out
+ h5diff_51.out.err
+ h5diff_52.out
+ h5diff_52.out.err
+ h5diff_53.out
+ h5diff_53.out.err
+ h5diff_54.out
+ h5diff_54.out.err
+ h5diff_55.out
+ h5diff_55.out.err
+ h5diff_56.out
+ h5diff_56.out.err
+ h5diff_57.out
+ h5diff_57.out.err
+ h5diff_58.out
+ h5diff_58.out.err
+ h5diff_59.out
+ h5diff_59.out.err
+ h5diff_500.out
+ h5diff_500.out.err
+ h5diff_501.out
+ h5diff_501.out.err
+ h5diff_502.out
+ h5diff_502.out.err
+ h5diff_503.out
+ h5diff_503.out.err
+ h5diff_504.out
+ h5diff_504.out.err
+ h5diff_505.out
+ h5diff_505.out.err
+ h5diff_506.out
+ h5diff_506.out.err
+ h5diff_507.out
+ h5diff_507.out.err
+ h5diff_508.out
+ h5diff_508.out.err
+ h5diff_509.out
+ h5diff_509.out.err
+ h5diff_510.out
+ h5diff_510.out.err
+ h5diff_511.out
+ h5diff_511.out.err
+ h5diff_512.out
+ h5diff_512.out.err
+ h5diff_513.out
+ h5diff_513.out.err
+ h5diff_514.out
+ h5diff_514.out.err
+ h5diff_515.out
+ h5diff_515.out.err
+ h5diff_516.out
+ h5diff_516.out.err
+ h5diff_517.out
+ h5diff_517.out.err
+ h5diff_518.out
+ h5diff_518.out.err
+ h5diff_530.out
+ h5diff_530.out.err
+ h5diff_540.out
+ h5diff_540.out.err
+ h5diff_600.out
+ h5diff_600.out.err
+ h5diff_601.out
+ h5diff_601.out.err
+ h5diff_603.out
+ h5diff_603.out.err
+ h5diff_604.out
+ h5diff_604.out.err
+ h5diff_605.out
+ h5diff_605.out.err
+ h5diff_606.out
+ h5diff_606.out.err
+ h5diff_607.out
+ h5diff_607.out.err
+ h5diff_608.out
+ h5diff_608.out.err
+ h5diff_609.out
+ h5diff_609.out.err
+ h5diff_610.out
+ h5diff_610.out.err
+ h5diff_612.out
+ h5diff_612.out.err
+ h5diff_613.out
+ h5diff_613.out.err
+ h5diff_614.out
+ h5diff_614.out.err
+ h5diff_615.out
+ h5diff_615.out.err
+ h5diff_616.out
+ h5diff_616.out.err
+ h5diff_617.out
+ h5diff_617.out.err
+ h5diff_618.out
+ h5diff_618.out.err
+ h5diff_619.out
+ h5diff_619.out.err
+ h5diff_621.out
+ h5diff_621.out.err
+ h5diff_622.out
+ h5diff_622.out.err
+ h5diff_623.out
+ h5diff_623.out.err
+ h5diff_624.out
+ h5diff_624.out.err
+ h5diff_625.out
+ h5diff_625.out.err
+ h5diff_626.out
+ h5diff_626.out.err
+ h5diff_627.out
+ h5diff_627.out.err
+ h5diff_628.out
+ h5diff_628.out.err
+ h5diff_629.out
+ h5diff_629.out.err
+ h5diff_640.out
+ h5diff_640.out.err
+ h5diff_641.out
+ h5diff_641.out.err
+ h5diff_642.out
+ h5diff_642.out.err
+ h5diff_643.out
+ h5diff_643.out.err
+ h5diff_644.out
+ h5diff_644.out.err
+ h5diff_645.out
+ h5diff_645.out.err
+ h5diff_646.out
+ h5diff_646.out.err
+ h5diff_70.out
+ h5diff_70.out.err
+ h5diff_700.out
+ h5diff_700.out.err
+ h5diff_701.out
+ h5diff_701.out.err
+ h5diff_702.out
+ h5diff_702.out.err
+ h5diff_703.out
+ h5diff_703.out.err
+ h5diff_704.out
+ h5diff_704.out.err
+ h5diff_705.out
+ h5diff_705.out.err
+ h5diff_706.out
+ h5diff_706.out.err
+ h5diff_707.out
+ h5diff_707.out.err
+ h5diff_708.out
+ h5diff_708.out.err
+ h5diff_709.out
+ h5diff_709.out.err
+ h5diff_710.out
+ h5diff_710.out.err
+ h5diff_80.out
+ h5diff_80.out.err
+ h5diff_90.out
+ h5diff_90.out.err
+ h5diff_v1.out
+ h5diff_v1.out.err
+ h5diff_v2.out
+ h5diff_v2.out.err
+ h5diff_v3.out
+ h5diff_v3.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 "")
+ set (last_test "H5DIFF-clearall-objects")
+ endif (HDF5_ENABLE_USING_MEMCHECKER)
+
+# ############################################################################
+# # Common usage
+# ############################################################################
+
+# 1.0
+ADD_H5_TEST (h5diff_10 0 -h)
+
+# 1.1 normal mode
+ADD_H5_TEST (h5diff_11 1 ${FILE1} ${FILE2})
+
+# 1.2 normal mode with objects
+ADD_H5_TEST (h5diff_12 1 ${FILE1} ${FILE2} g1/dset1 g1/dset2)
+
+# 1.3 report mode
+ADD_H5_TEST (h5diff_13 1 -r ${FILE1} ${FILE2})
+
+# 1.4 report mode with objects
+ADD_H5_TEST (h5diff_14 1 -r ${FILE1} ${FILE2} g1/dset1 g1/dset2)
+
+# 1.5 with -d
+ADD_H5_TEST (h5diff_15 1 --report --delta=5 ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 1.6.1 with -p (int)
+ADD_H5_TEST (h5diff_16_1 1 -v -p 0.02 ${FILE1} ${FILE1} g1/dset5 g1/dset6)
+
+# 1.6.2 with -p (unsigned long_long)
+ADD_H5_TEST (h5diff_16_2 1 --verbose --relative=0.02 ${FILE1} ${FILE1} g1/dset7 g1/dset8)
+
+# 1.6.3 with -p (double)
+ADD_H5_TEST (h5diff_16_3 1 -v -p 0.02 ${FILE1} ${FILE1} g1/dset9 g1/dset10)
+
+# 1.7 verbose mode
+ADD_H5_TEST (h5diff_17 1 -v ${FILE1} ${FILE2})
+
+# 1.7 test 32-bit INFINITY
+ADD_H5_TEST (h5diff_171 0 -v ${FILE1} ${FILE1} /g1/fp19 /g1/fp19_COPY)
+
+# 1.7 test 64-bit INFINITY
+ADD_H5_TEST (h5diff_172 0 -v ${FILE1} ${FILE1} /g1/fp20 /g1/fp20_COPY)
+
+# 1.8 quiet mode
+ADD_H5_TEST (h5diff_18 1 -q ${FILE1} ${FILE2})
+
+# 1.8 -v and -q
+ADD_H5_TEST (h5diff_18_1 2 -v -q ${FILE1} ${FILE2})
+
+# ##############################################################################
+# # not comparable types
+# ##############################################################################
+
+# 2.0
+ADD_H5_TEST (h5diff_20 0 -v ${FILE3} ${FILE3} dset g1)
+
+# 2.1
+ADD_H5_TEST (h5diff_21 0 -v ${FILE3} ${FILE3} dset l1)
+
+# 2.2
+ADD_H5_TEST (h5diff_22 0 -v ${FILE3} ${FILE3} dset t1)
+
+# ##############################################################################
+# # compare groups, types, links (no differences and differences)
+# ##############################################################################
+
+# 2.3
+ADD_H5_TEST (h5diff_23 0 -v ${FILE3} ${FILE3} g1 g1)
+
+# 2.4
+ADD_H5_TEST (h5diff_24 0 -v ${FILE3} ${FILE3} t1 t1)
+
+# 2.5
+ADD_H5_TEST (h5diff_25 0 -v ${FILE3} ${FILE3} l1 l1)
+
+# 2.6
+ADD_H5_TEST (h5diff_26 0 -v ${FILE3} ${FILE3} g1 g2)
+
+# 2.7
+ADD_H5_TEST (h5diff_27 1 -v ${FILE3} ${FILE3} t1 t2)
+
+# 2.8
+ADD_H5_TEST (h5diff_28 1 -v ${FILE3} ${FILE3} l1 l2)
+
+# ##############################################################################
+# # Dataset datatypes
+# ##############################################################################
+
+# 5.0
+ADD_H5_TEST (h5diff_50 1 -v ${FILE4} ${FILE4} dset0a dset0b)
+
+# 5.1
+ADD_H5_TEST (h5diff_51 1 -v ${FILE4} ${FILE4} dset1a dset1b)
+
+# 5.2
+ADD_H5_TEST (h5diff_52 1 -v ${FILE4} ${FILE4} dset2a dset2b)
+
+# 5.3
+ADD_H5_TEST (h5diff_53 1 -v ${FILE4} ${FILE4} dset3a dset4b)
+
+# 5.4
+ADD_H5_TEST (h5diff_54 1 -v ${FILE4} ${FILE4} dset4a dset4b)
+
+# 5.5
+ADD_H5_TEST (h5diff_55 1 -v ${FILE4} ${FILE4} dset5a dset5b)
+
+# 5.6
+ADD_H5_TEST (h5diff_56 1 -v ${FILE4} ${FILE4} dset6a dset6b)
+
+# 5.7
+ADD_H5_TEST (h5diff_57 0 -v ${FILE4} ${FILE4} dset7a dset7b)
+
+# 5.8 (region reference)
+ADD_H5_TEST (h5diff_58 1 -v ${FILE7} ${FILE8} refreg)
+
+# test for both dset and attr with same type but with different size
+# ( HDDFV-7942 )
+ADD_H5_TEST (h5diff_59 0 -v ${FILE4} ${FILE4} dset11a dset11b)
+
+# ##############################################################################
+# # Error messages
+# ##############################################################################
+
+# 6.0: Check if the command line number of arguments is less than 3
+ADD_H5_TEST (h5diff_600 1 ${FILE1})
+
+# 6.1: Check if non-exist object name is specified
+ADD_H5_TEST (h5diff_601 2 ${FILE1} ${FILE1} nono_obj)
+
+# ##############################################################################
+# # -d
+# ##############################################################################
+
+# 6.3: negative value
+ADD_H5_TEST (h5diff_603 1 -d -4 ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 6.4: zero
+ADD_H5_TEST (h5diff_604 1 -d 0 ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 6.5: non number
+ADD_H5_TEST (h5diff_605 1 -d u ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 6.6: hexadecimal
+ADD_H5_TEST (h5diff_606 1 -d 0x1 ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 6.7: string
+ADD_H5_TEST (h5diff_607 1 -d "1" ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 6.8: use system epsilon
+ADD_H5_TEST (h5diff_608 1 --use-system-epsilon ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 6.9: number larger than biggest difference
+ADD_H5_TEST (h5diff_609 0 -d 200 ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 6.10: number smaller than smallest difference
+ADD_H5_TEST (h5diff_610 1 -d 1 ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# ##############################################################################
+# # -p
+# ##############################################################################
+
+# 6.12: negative value
+ADD_H5_TEST (h5diff_612 1 -p -4 ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 6.13: zero
+ADD_H5_TEST (h5diff_613 1 -p 0 ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 6.14: non number
+ADD_H5_TEST (h5diff_614 1 -p u ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 6.15: hexadecimal
+ADD_H5_TEST (h5diff_615 1 -p 0x1 ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 6.16: string
+ADD_H5_TEST (h5diff_616 1 -p "0.21" ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 6.17: repeated option
+ADD_H5_TEST (h5diff_617 1 -p 0.21 -p 0.22 ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 6.18: number larger than biggest difference
+ADD_H5_TEST (h5diff_618 0 -p 2 ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 6.19: number smaller than smallest difference
+ADD_H5_TEST (h5diff_619 1 -p 0.005 ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# ##############################################################################
+# # -n
+# ##############################################################################
+
+# 6.21: negative value
+ADD_H5_TEST (h5diff_621 1 -n -4 ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 6.22: zero
+ADD_H5_TEST (h5diff_622 1 -n 0 ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 6.23: non number
+ADD_H5_TEST (h5diff_623 1 -n u ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 6.24: hexadecimal
+ADD_H5_TEST (h5diff_624 1 -n 0x1 ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 6.25: string
+ADD_H5_TEST (h5diff_625 1 -n "2" ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 6.26: repeated option
+ADD_H5_TEST (h5diff_626 1 -n 2 -n 3 ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 6.27: number larger than biggest difference
+ADD_H5_TEST (h5diff_627 1 --count=200 ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 6.28: number smaller than smallest difference
+ADD_H5_TEST (h5diff_628 1 -n 1 ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# Disabling this test as it hangs - LRK 20090618
+# 6.29 non valid files
+#ADD_H5_TEST (h5diff_629 2 file1.h6 file2.h6)
+
+# ##############################################################################
+# # NaN
+# ##############################################################################
+# 6.30: test (NaN == NaN) must be true based on our documentation -- XCAO
+ADD_H5_TEST (h5diff_630 0 -v -d "0.0001" ${FILE1} ${FILE1} g1/fp18 g1/fp18_COPY)
+ADD_H5_TEST (h5diff_631 0 -v --use-system-epsilon ${FILE1} ${FILE1} g1/fp18 g1/fp18_COPY)
+
+# ##############################################################################
+# 7. attributes
+# ##############################################################################
+ADD_H5_TEST (h5diff_70 1 -v ${FILE5} ${FILE6})
+
+# ##################################################
+# attrs with verbose option level
+# ##################################################
+ADD_H5_TEST (h5diff_700 1 -v1 ${FILE5} ${FILE6})
+ADD_H5_TEST (h5diff_701 1 -v2 ${FILE5} ${FILE6})
+ADD_H5_TEST (h5diff_702 1 --verbose=1 ${FILE5} ${FILE6})
+ADD_H5_TEST (h5diff_703 1 --verbose=2 ${FILE5} ${FILE6})
+
+# same attr number , all same attr name
+ADD_H5_TEST (h5diff_704 1 -v2 ${ATTR_VERBOSE_LEVEL_FILE1} ${ATTR_VERBOSE_LEVEL_FILE2} /g)
+
+# same attr number , some same attr name
+ADD_H5_TEST (h5diff_705 1 -v2 ${ATTR_VERBOSE_LEVEL_FILE1} ${ATTR_VERBOSE_LEVEL_FILE2} /dset)
+
+# same attr number , all different attr name
+ADD_H5_TEST (h5diff_706 1 -v2 ${ATTR_VERBOSE_LEVEL_FILE1} ${ATTR_VERBOSE_LEVEL_FILE2} /ntype)
+
+# different attr number , same attr name (intersected)
+ADD_H5_TEST (h5diff_707 1 -v2 ${ATTR_VERBOSE_LEVEL_FILE1} ${ATTR_VERBOSE_LEVEL_FILE2} /g2)
+
+# different attr number , all different attr name
+ADD_H5_TEST (h5diff_708 1 -v2 ${ATTR_VERBOSE_LEVEL_FILE1} ${ATTR_VERBOSE_LEVEL_FILE2} /g3)
+
+# when no attributes exist in both objects
+ADD_H5_TEST (h5diff_709 0 -v2 ${ATTR_VERBOSE_LEVEL_FILE1} ${ATTR_VERBOSE_LEVEL_FILE2} /g4)
+
+# file vs file
+ADD_H5_TEST (h5diff_710 1 -v2 ${ATTR_VERBOSE_LEVEL_FILE1} ${ATTR_VERBOSE_LEVEL_FILE2})
+
+# ##############################################################################
+# 8. all dataset datatypes
+# ##############################################################################
+ADD_H5_TEST (h5diff_80 1 -v ${FILE7} ${FILE8})
+
+# 9. compare a file with itself
+ADD_H5_TEST (h5diff_90 0 -v ${FILE2} ${FILE2})
+
+# 10. read by hyperslab, print indexes
+ADD_H5_TEST (h5diff_100 1 -v ${FILE9} ${FILE10})
+
+# 11. floating point comparison
+# double value
+ADD_H5_TEST (h5diff_101 1 -v ${FILE1} ${FILE1} g1/d1 g1/d2)
+
+# float value
+ADD_H5_TEST (h5diff_102 1 -v ${FILE1} ${FILE1} g1/fp1 g1/fp2)
+
+# with --use-system-epsilon for double value. expect less differences
+ADD_H5_TEST (h5diff_103 1 -v --use-system-epsilon ${FILE1} ${FILE1} g1/d1
+g1/d2)
+
+# with --use-system-epsilon for float value. expect less differences
+ADD_H5_TEST (h5diff_104 1 -v --use-system-epsilon ${FILE1} ${FILE1} g1/fp1
+g1/fp2)
+
+# not comparable -c flag
+ADD_H5_TEST (h5diff_200 0 ${FILE2} ${FILE2} g2/dset1 g2/dset2)
+
+ADD_H5_TEST (h5diff_201 0 -c ${FILE2} ${FILE2} g2/dset1 g2/dset2)
+
+ADD_H5_TEST (h5diff_202 0 -c ${FILE2} ${FILE2} g2/dset2 g2/dset3)
+
+ADD_H5_TEST (h5diff_203 0 -c ${FILE2} ${FILE2} g2/dset3 g2/dset4)
+
+ADD_H5_TEST (h5diff_204 0 -c ${FILE2} ${FILE2} g2/dset4 g2/dset5)
+
+ADD_H5_TEST (h5diff_205 0 -c ${FILE2} ${FILE2} g2/dset5 g2/dset6)
+
+# not comparable in compound
+ADD_H5_TEST (h5diff_206 0 -c ${FILE2} ${FILE2} g2/dset7 g2/dset8)
+
+ADD_H5_TEST (h5diff_207 0 -c ${FILE2} ${FILE2} g2/dset8 g2/dset9)
+
+# not comparable in dataspace of zero dimension size
+ADD_H5_TEST (h5diff_208 0 -c ${FILE19} ${FILE20})
+
+# non-comparable dataset with comparable attribute, and other comparable datasets.
+# All the rest comparables should display differences.
+ADD_H5_TEST (h5diff_220 1 -c non_comparables1.h5 non_comparables2.h5 /g1)
+
+# comparable dataset with non-comparable attribute and other comparable attributes.
+# Also test non-compatible attributes with different type, dimention, rank.
+# All the rest comparables should display differences.
+ADD_H5_TEST (h5diff_221 1 -c non_comparables1.h5 non_comparables2.h5 /g2)
+
+# entire file
+# 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
+# ##############################################################################
+# test for bug1749
+ADD_H5_TEST (h5diff_300 1 -v ${FILE12} ${FILE12} /link_g1 /link_g2)
+
+# ##############################################################################
+# # Links compare with --follow-symlinks Only
+# ##############################################################################
+# soft links file to file
+ADD_H5_TEST (h5diff_400 0 --follow-symlinks -v ${FILE13} ${FILE13})
+
+# softlink vs dset"
+ADD_H5_TEST (h5diff_401 1 --follow-symlinks -v ${FILE13} ${FILE13} /softlink_dset1_1 /target_dset2)
+
+# dset vs softlink"
+ADD_H5_TEST (h5diff_402 1 --follow-symlinks -v ${FILE13} ${FILE13} /target_dset2 /softlink_dset1_1)
+
+# softlink vs softlink"
+ADD_H5_TEST (h5diff_403 1 --follow-symlinks -v ${FILE13} ${FILE13} /softlink_dset1_1 /softlink_dset2)
+
+# extlink vs extlink (FILE)"
+ADD_H5_TEST (h5diff_404 0 --follow-symlinks -v ${FILE15} ${FILE15})
+
+# extlink vs dset"
+ADD_H5_TEST (h5diff_405 1 --follow-symlinks -v ${FILE15} ${FILE16} /ext_link_dset1 /target_group2/x_dset)
+
+# dset vs extlink"
+ADD_H5_TEST (h5diff_406 1 --follow-symlinks -v ${FILE16} ${FILE15} /target_group2/x_dset /ext_link_dset1)
+
+# extlink vs extlink"
+ADD_H5_TEST (h5diff_407 1 --follow-symlinks -v ${FILE15} ${FILE15} /ext_link_dset1 /ext_link_dset2)
+
+# softlink vs extlink"
+ADD_H5_TEST (h5diff_408 1 --follow-symlinks -v ${FILE13} ${FILE15} /softlink_dset1_1 /ext_link_dset2)
+
+# extlink vs softlink "
+ADD_H5_TEST (h5diff_409 1 --follow-symlinks -v ${FILE15} ${FILE13} /ext_link_dset2 /softlink_dset1_1)
+
+# linked_softlink vs linked_softlink (FILE)"
+ADD_H5_TEST (h5diff_410 0 --follow-symlinks -v ${FILE14} ${FILE14})
+
+# dset2 vs linked_softlink_dset1"
+ADD_H5_TEST (h5diff_411 1 --follow-symlinks -v ${FILE14} ${FILE14} /target_dset2 /softlink1_to_slink2)
+
+# linked_softlink_dset1 vs dset2"
+ADD_H5_TEST (h5diff_412 1 --follow-symlinks -v ${FILE14} ${FILE14} /softlink1_to_slink2 /target_dset2)
+
+# linked_softlink_to_dset1 vs linked_softlink_to_dset2"
+ADD_H5_TEST (h5diff_413 1 --follow-symlinks -v ${FILE14} ${FILE14} /softlink1_to_slink2 /softlink2_to_slink2)
+
+# group vs linked_softlink_group1"
+ADD_H5_TEST (h5diff_414 1 --follow-symlinks -v ${FILE14} ${FILE14} /target_group /softlink3_to_slink2)
+
+# linked_softlink_group1 vs group"
+ADD_H5_TEST (h5diff_415 1 --follow-symlinks -v ${FILE14} ${FILE14} /softlink3_to_slink2 /target_group)
+
+# linked_softlink_to_group1 vs linked_softlink_to_group2"
+ADD_H5_TEST (h5diff_416 0 --follow-symlinks -v ${FILE14} ${FILE14} /softlink3_to_slink2 /softlink4_to_slink2)
+
+# non-exist-softlink vs softlink"
+ADD_H5_TEST (h5diff_417 1 --follow-symlinks -v ${FILE13} ${FILE13} /softlink_noexist /softlink_dset2)
+
+# softlink vs non-exist-softlink"
+ADD_H5_TEST (h5diff_418 1 --follow-symlinks -v ${FILE13} ${FILE13} /softlink_dset2 /softlink_noexist)
+
+# non-exist-extlink_file vs extlink"
+ADD_H5_TEST (h5diff_419 1 --follow-symlinks -v ${FILE15} ${FILE15} /ext_link_noexist2 /ext_link_dset2)
+
+# exlink vs non-exist-extlink_file"
+ADD_H5_TEST (h5diff_420 1 --follow-symlinks -v ${FILE15} ${FILE15} /ext_link_dset2 /ext_link_noexist2)
+
+# extlink vs non-exist-extlink_obj"
+ADD_H5_TEST (h5diff_421 1 --follow-symlinks -v ${FILE15} ${FILE15} /ext_link_dset2 /ext_link_noexist1)
+
+# non-exist-extlink_obj vs extlink"
+ADD_H5_TEST (h5diff_422 1 --follow-symlinks -v ${FILE15} ${FILE15} /ext_link_noexist1 /ext_link_dset2)
+
+# extlink_to_softlink_to_dset1 vs dset2"
+ADD_H5_TEST (h5diff_423 1 --follow-symlinks -v ${FILE17} ${FILE18} /ext_link_to_slink1 /dset2)
+
+# dset2 vs extlink_to_softlink_to_dset1"
+ADD_H5_TEST (h5diff_424 1 --follow-symlinks -v ${FILE18} ${FILE17} /dset2 /ext_link_to_slink1)
+
+# extlink_to_softlink_to_dset1 vs extlink_to_softlink_to_dset2"
+ADD_H5_TEST (h5diff_425 1 --follow-symlinks -v ${FILE17} ${FILE17} /ext_link_to_slink1 /ext_link_to_slink2)
+
+# ##############################################################################
+# # Dangling links compare (--follow-symlinks and --no-dangling-links)
+# ##############################################################################
+# dangling links --follow-symlinks (FILE to FILE)
+ADD_H5_TEST (h5diff_450 1 --follow-symlinks -v ${DANGLE_LINK_FILE1} ${DANGLE_LINK_FILE2})
+
+# dangling links --follow-symlinks and --no-dangling-links (FILE to FILE)
+ADD_H5_TEST (h5diff_451 2 --follow-symlinks -v --no-dangling-links ${DANGLE_LINK_FILE1} ${DANGLE_LINK_FILE2})
+
+# try --no-dangling-links without --follow-symlinks options
+ADD_H5_TEST (h5diff_452 2 --no-dangling-links ${FILE13} ${FILE13})
+
+# dangling link found for soft links (FILE to FILE)
+ADD_H5_TEST (h5diff_453 2 --follow-symlinks -v --no-dangling-links ${FILE13} ${FILE13})
+
+# dangling link found for soft links (obj to obj)
+ADD_H5_TEST (h5diff_454 2 --follow-symlinks -v --no-dangling-links ${FILE13} ${FILE13} /softlink_dset2 /softlink_noexist)
+
+# dangling link found for soft links (obj to obj) Both dangle links
+ADD_H5_TEST (h5diff_455 2 --follow-symlinks -v --no-dangling-links ${FILE13} ${FILE13} /softlink_noexist /softlink_noexist)
+
+# dangling link found for ext links (FILE to FILE)
+ADD_H5_TEST (h5diff_456 2 --follow-symlinks -v --no-dangling-links ${FILE15} ${FILE15})
+
+# dangling link found for ext links (obj to obj). target file exist
+ADD_H5_TEST (h5diff_457 2 --follow-symlinks -v --no-dangling-links ${FILE15} ${FILE15} /ext_link_dset1 /ext_link_noexist1)
+
+# dangling link found for ext links (obj to obj). target file NOT exist
+ADD_H5_TEST (h5diff_458 2 --follow-symlinks -v --no-dangling-links ${FILE15} ${FILE15} /ext_link_dset1 /ext_link_noexist2)
+
+# dangling link found for ext links (obj to obj). Both dangle links
+ADD_H5_TEST (h5diff_459 2 --follow-symlinks -v --no-dangling-links ${FILE15} ${FILE15} /ext_link_noexist1 /ext_link_noexist2)
+
+# dangling link --follow-symlinks (obj vs obj)
+# (HDFFV-7836)
+ADD_H5_TEST (h5diff_465 0 --follow-symlinks h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /soft_link1)
+# (HDFFV-7835)
+# soft dangling vs. soft dangling
+ADD_H5_TEST (h5diff_466 0 -v --follow-symlinks h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /soft_link1)
+# soft link vs. soft dangling
+ADD_H5_TEST (h5diff_467 1 -v --follow-symlinks h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /soft_link2)
+# ext dangling vs. ext dangling
+ADD_H5_TEST (h5diff_468 0 -v --follow-symlinks h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /ext_link4)
+# 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
+# ##############################################################################
+# root
+ADD_H5_TEST (h5diff_500 1 -v ${GRP_RECURSE_FILE1} ${GRP_RECURSE_FILE2} / /)
+ADD_H5_TEST (h5diff_501 1 -v --follow-symlinks ${GRP_RECURSE_FILE1} ${GRP_RECURSE_FILE2} / /)
+
+# root vs group
+ADD_H5_TEST (h5diff_502 1 -v ${GRP_RECURSE_FILE1} ${GRP_RECURSE_FILE2} / /grp1/grp2/grp3)
+
+# group vs group (same name and structure)
+ADD_H5_TEST (h5diff_503 0 -v ${GRP_RECURSE_FILE1} ${GRP_RECURSE_FILE2} /grp1 /grp1)
+
+# group vs group (different name and structure)
+ADD_H5_TEST (h5diff_504 1 -v ${GRP_RECURSE_FILE1} ${GRP_RECURSE_FILE2} /grp1/grp2 /grp1/grp2/grp3)
+
+# groups vs soft-link
+ADD_H5_TEST (h5diff_505 0 -v ${GRP_RECURSE_FILE1} ${GRP_RECURSE_FILE2} /grp1 /slink_grp1)
+ADD_H5_TEST (h5diff_506 0 -v --follow-symlinks ${GRP_RECURSE_FILE1} ${GRP_RECURSE_FILE2} /grp1/grp2 /slink_grp2)
+
+# groups vs ext-link
+ADD_H5_TEST (h5diff_507 0 -v ${GRP_RECURSE_FILE1} ${GRP_RECURSE_FILE2} /grp1 /elink_grp1)
+ADD_H5_TEST (h5diff_508 0 -v --follow-symlinks ${GRP_RECURSE_FILE1} ${GRP_RECURSE_FILE2} /grp1 /elink_grp1)
+
+# soft-link vs ext-link
+ADD_H5_TEST (h5diff_509 0 -v ${GRP_RECURSE_FILE1} ${GRP_RECURSE_FILE2} /slink_grp1 /elink_grp1)
+ADD_H5_TEST (h5diff_510 0 -v --follow-symlinks ${GRP_RECURSE_FILE1} ${GRP_RECURSE_FILE2} /slink_grp1 /elink_grp1)
+
+# circled ext links
+ADD_H5_TEST (h5diff_511 1 -v ${GRP_RECURSE_FILE1} ${GRP_RECURSE_FILE2} /grp10 /grp11)
+ADD_H5_TEST (h5diff_512 1 -v --follow-symlinks ${GRP_RECURSE_FILE1} ${GRP_RECURSE_FILE2} /grp10 /grp11)
+
+# circled soft2ext-link vs soft2ext-link
+ADD_H5_TEST (h5diff_513 1 -v ${GRP_RECURSE_FILE1} ${GRP_RECURSE_FILE2} /slink_grp10 /slink_grp11)
+ADD_H5_TEST (h5diff_514 1 -v --follow-symlinks ${GRP_RECURSE_FILE1} ${GRP_RECURSE_FILE2} /slink_grp10 /slink_grp11)
+
+###############################################################################
+# Test for group recursive diff via multi-linked external links
+# With follow-symlinks, file $GRP_RECURSE1_EXT and $GRP_RECURSE2_EXT1 should
+# be same with the external links.
+###############################################################################
+# file vs file
+ADD_H5_TEST (h5diff_515 1 -v ${GRP_RECURSE1_EXT} ${GRP_RECURSE2_EXT1})
+ADD_H5_TEST (h5diff_516 0 -v --follow-symlinks ${GRP_RECURSE1_EXT} ${GRP_RECURSE2_EXT1})
+# group vs group
+ADD_H5_TEST (h5diff_517 1 -v ${GRP_RECURSE1_EXT} ${GRP_RECURSE2_EXT1} /g1)
+ADD_H5_TEST (h5diff_518 0 -v --follow-symlinks ${GRP_RECURSE1_EXT} ${GRP_RECURSE2_EXT1} /g1)
+
+# ##############################################################################
+# # Exclude objects (--exclude-path)
+# ##############################################################################
+#
+# Same structure, same names and different value.
+#
+# Exclude the object with different value. Expect return - same
+ADD_H5_TEST (h5diff_480 0 -v --exclude-path /group1/dset3 ${EXCLUDE_FILE1_1} ${EXCLUDE_FILE1_2})
+# Verify different by not excluding. Expect return - diff
+ADD_H5_TEST (h5diff_481 1 -v ${EXCLUDE_FILE1_1} ${EXCLUDE_FILE1_2})
+
+#
+# Different structure, different names.
+#
+# Exclude all the different objects. Expect return - same
+ADD_H5_TEST (h5diff_482 0 -v --exclude-path "/group1" --exclude-path "/dset1" ${EXCLUDE_FILE2_1} ${EXCLUDE_FILE2_2})
+# Exclude only some different objects. Expect return - diff
+ADD_H5_TEST (h5diff_483 1 -v --exclude-path "/group1" ${EXCLUDE_FILE2_1} ${EXCLUDE_FILE2_2})
+
+# Exclude from group compare
+ADD_H5_TEST (h5diff_484 0 -v --exclude-path "/dset3" ${EXCLUDE_FILE1_1} ${EXCLUDE_FILE1_2} /group1)
+
+#
+# Only one file contains unique objs. Common objs are same.
+# (HDFFV-7837)
+#
+ADD_H5_TEST (h5diff_485 0 -v --exclude-path "/group1" h5diff_exclude3-1.h5 h5diff_exclude3-2.h5)
+ADD_H5_TEST (h5diff_486 0 -v --exclude-path "/group1" h5diff_exclude3-2.h5 h5diff_exclude3-1.h5)
+ADD_H5_TEST (h5diff_487 1 -v --exclude-path "/group1/dset" h5diff_exclude3-1.h5 h5diff_exclude3-2.h5)
+
+
+
+# ##############################################################################
+# # diff various multiple vlen and fixed strings in a compound type dataset
+# ##############################################################################
+ADD_H5_TEST (h5diff_530 0 -v ${COMP_VL_STRS_FILE} ${COMP_VL_STRS_FILE} /group /group_copy)
+
+# ##############################################################################
+# # Test container types (array,vlen) with multiple nested compound types
+# # Complex compound types in dataset and attribute
+# ##############################################################################
+ADD_H5_TEST (h5diff_540 1 -v ${COMPS_ARRAY_VLEN_FILE1} ${COMPS_ARRAY_VLEN_FILE2})
+
+# ##############################################################################
+# # Test mutually exclusive options
+# ##############################################################################
+#
+# Test with -d , -p and --use-system-epsilon.
+ADD_H5_TEST (h5diff_640 1 -v -d 5 -p 0.05 --use-system-epsilon ${FILE1} ${FILE2} /g1/dset3 /g1/dset4)
+ADD_H5_TEST (h5diff_641 1 -v -d 5 -p 0.05 ${FILE1} ${FILE2} /g1/dset3 /g1/dset4)
+ADD_H5_TEST (h5diff_642 1 -v -p 0.05 -d 5 ${FILE1} ${FILE2} /g1/dset3 /g1/dset4)
+ADD_H5_TEST (h5diff_643 1 -v -d 5 --use-system-epsilon ${FILE1} ${FILE2} /g1/dset3 /g1/dset4)
+ADD_H5_TEST (h5diff_644 1 -v --use-system-epsilon -d 5 ${FILE1} ${FILE2} /g1/dset3 /g1/dset4)
+ADD_H5_TEST (h5diff_645 1 -v -p 0.05 --use-system-epsilon ${FILE1} ${FILE2} /g1/dset3 /g1/dset4)
+ADD_H5_TEST (h5diff_646 1 -v --use-system-epsilon -p 0.05 ${FILE1} ${FILE2} /g1/dset3 /g1/dset4)
+
+# VDS
+ADD_H5_TEST (h5diff_v1 0 -v ${FILEV1} ${FILEV2})
+ADD_H5_TEST (h5diff_v2 0 -r ${FILEV1} ${FILEV2})
+ADD_H5_TEST (h5diff_v3 0 -c ${FILEV1} ${FILEV2})
+
diff --git a/tools/test/h5diff/Makefile.am b/tools/test/h5diff/Makefile.am
new file mode 100644
index 0000000..c366199
--- /dev/null
+++ b/tools/test/h5diff/Makefile.am
@@ -0,0 +1,53 @@
+#
+# 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.
+##
+## Makefile.am
+## Run automake to generate a Makefile.in from this file.
+#
+# HDF5 Library Makefile(.in)
+#
+
+include $(top_srcdir)/config/commence.am
+
+# Include src and tools/lib directories
+AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib
+
+# Always build and test h5diff but build and test ph5diff only if parallel
+# is enabled.
+if BUILD_PARALLEL_CONDITIONAL
+ H5PDIFF=../../src/h5diff/ph5diff
+ TEST_SCRIPT_PARA=testph5diff.sh
+endif
+
+# Test programs and scripts
+TEST_PROG=h5diffgentest
+TEST_SCRIPT=testh5diff.sh
+
+check_PROGRAMS=$(TEST_PROG)
+check_SCRIPTS=$(TEST_SCRIPT) $(TEST_SCRIPT_PARA)
+# The parallel test script testph5diff.sh actually depends on testh5diff.sh.
+SCRIPT_DEPEND=../../src/h5diff/h5diff$(EXEEXT) $(H5PDIFF) ../../src/h5diff/testh5diff.sh
+
+# Source files for the program
+h5diffgentest_SOURCES=h5diffgentest.c
+
+# Programs depend on the main HDF5 library and tools library
+LDADD=$(LIBH5TOOLS) $(LIBHDF5)
+
+# Temporary files. *.h5 are generated by h5diff. They should
+# be copied to the testfiles/ directory if update is required
+CHECK_CLEANFILES+=*.h5 expect_sorted actual_sorted
+
+include $(top_srcdir)/config/conclude.am
+
diff --git a/tools/test/h5diff/h5diffgentest.c b/tools/test/h5diff/h5diffgentest.c
new file mode 100644
index 0000000..339ff6c
--- /dev/null
+++ b/tools/test/h5diff/h5diffgentest.c
@@ -0,0 +1,7385 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+* 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. *
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "hdf5.h"
+#include "H5private.h"
+
+/*
+ * The output functions need a temporary buffer to hold a piece of the
+ * dataset while it's being printed. This constant sets the limit on the
+ * size of that temporary buffer in bytes. For efficiency's sake, choose the
+ * largest value suitable for your machine (for testing use a small value).
+ */
+/* Maximum size used in a call to malloc for a dataset
+ * NOTE: this value should stay in sync with the value defined in the tools
+ * library file: h5tools_utils.h
+ */
+size_t H5TOOLS_MALLOCSIZE = (128 * 1024 * 1024);
+
+/*-------------------------------------------------------------------------
+* Program: h5diffgentest
+*
+* Purpose: generate files for h5diff testing
+*
+* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+*
+* Date: November 12, 2003
+*
+*-------------------------------------------------------------------------
+*/
+
+#define FILE1 "h5diff_basic1.h5"
+#define FILE2 "h5diff_basic2.h5"
+#define FILE3 "h5diff_types.h5"
+#define FILE4 "h5diff_dtypes.h5"
+#define FILE5 "h5diff_attr1.h5"
+#define FILE6 "h5diff_attr2.h5"
+#define FILE7 "h5diff_dset1.h5"
+#define FILE8 "h5diff_dset2.h5"
+#define FILE9 "h5diff_hyper1.h5"
+#define FILE10 "h5diff_hyper2.h5"
+#define FILE11 "h5diff_empty.h5"
+#define FILE12 "h5diff_links.h5"
+#define FILE13 "h5diff_softlinks.h5"
+#define FILE14 "h5diff_linked_softlink.h5"
+#define FILE15 "h5diff_extlink_src.h5"
+#define FILE16 "h5diff_extlink_trg.h5"
+#define FILE17 "h5diff_ext2softlink_src.h5"
+#define FILE18 "h5diff_ext2softlink_trg.h5"
+#define FILE19 "h5diff_dset_zero_dim_size1.h5"
+#define FILE20 "h5diff_dset_zero_dim_size2.h5"
+#define FILE21 "h5diff_dset_idx1.h5"
+#define FILE22 "h5diff_dset_idx2.h5"
+#define DANGLE_LINK_FILE1 "h5diff_danglelinks1.h5"
+#define DANGLE_LINK_FILE2 "h5diff_danglelinks2.h5"
+#define GRP_RECURSE_FILE1 "h5diff_grp_recurse1.h5"
+#define GRP_RECURSE_FILE2 "h5diff_grp_recurse2.h5"
+/* same structure via external links through files */
+#define GRP_RECURSE1_EXT "h5diff_grp_recurse_ext1.h5"
+#define GRP_RECURSE2_EXT1 "h5diff_grp_recurse_ext2-1.h5"
+#define GRP_RECURSE2_EXT2 "h5diff_grp_recurse_ext2-2.h5"
+#define GRP_RECURSE2_EXT3 "h5diff_grp_recurse_ext2-3.h5"
+/* same structure, same obj name with different value */
+#define EXCLUDE_FILE1_1 "h5diff_exclude1-1.h5"
+#define EXCLUDE_FILE1_2 "h5diff_exclude1-2.h5"
+/* different structure and obj names */
+#define EXCLUDE_FILE2_1 "h5diff_exclude2-1.h5"
+#define EXCLUDE_FILE2_2 "h5diff_exclude2-2.h5"
+/* only one file has unique objs */
+#define EXCLUDE_FILE3_1 "h5diff_exclude3-1.h5"
+#define EXCLUDE_FILE3_2 "h5diff_exclude3-2.h5"
+/* compound type with multiple vlen string types */
+#define COMP_VL_STRS_FILE "h5diff_comp_vl_strs.h5"
+/* attribute compre with verbose level */
+#define ATTR_VERBOSE_LEVEL_FILE1 "h5diff_attr_v_level1.h5"
+#define ATTR_VERBOSE_LEVEL_FILE2 "h5diff_attr_v_level2.h5"
+/* file containing valid/invalid enum value mix */
+#define ENUM_INVALID_VALUES "h5diff_enum_invalid_values.h5"
+/* file with container types (array,vlen) with multiple compounds */
+#define COMPS_COMPLEX1 "compounds_array_vlen1.h5"
+#define COMPS_COMPLEX2 "compounds_array_vlen2.h5"
+/* non-comparable dataset and attribute */
+#define NON_COMPARBLES1 "non_comparables1.h5"
+#define NON_COMPARBLES2 "non_comparables2.h5"
+
+#define UIMAX 4294967295u /*Maximum value for a variable of type unsigned int */
+#define STR_SIZE 3
+#define GBLL ((unsigned long long) 1024 * 1024 *1024 )
+
+#define MY_LINKCLASS 187
+
+/* Dataspace of 0 dimension size */
+#define SPACE1_RANK 2
+#define SPACE1_DIM1 0
+#define SPACE1_DIM2 0
+
+/* A UD link traversal function. Shouldn't actually be called. */
+static hid_t UD_traverse(H5_ATTR_UNUSED const char * link_name, H5_ATTR_UNUSED hid_t cur_group,
+ H5_ATTR_UNUSED const void * udata, H5_ATTR_UNUSED size_t udata_size, H5_ATTR_UNUSED hid_t lapl_id)
+{
+ return -1;
+}
+const H5L_class_t UD_link_class[1] = {{
+ H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */
+ (H5L_type_t)MY_LINKCLASS, /* Link type id number */
+ "UD link class", /* name for debugging */
+ NULL, /* Creation callback */
+ NULL, /* Move/rename callback */
+ NULL, /* Copy callback */
+ UD_traverse, /* The actual traversal function */
+ NULL, /* Deletion callback */
+ NULL /* Query callback */
+}};
+
+
+/*-------------------------------------------------------------------------
+* prototypes
+*-------------------------------------------------------------------------
+*/
+
+/* tests called in main() */
+static int test_basic(const char *fname1, const char *fname2, const char *fname3);
+static int test_types(const char *fname);
+static int test_datatypes(const char *fname);
+static int test_attributes(const char *fname,int make_diffs);
+static int test_datasets(const char *fname,int make_diffs);
+static int test_special_datasets(const char *fname,int make_diffs);
+static int test_hyperslab(const char *fname,int make_diffs);
+static int test_link_name(const char *fname1);
+static int test_soft_links(const char *fname1);
+static int test_linked_softlinks(const char *fname1);
+static int test_external_links(const char *fname1, const char *fname2);
+static int test_ext2soft_links(const char *fname1, const char *fname2);
+static int test_dangle_links(const char *fname1, const char *fname2);
+static int test_group_recurse(const char *fname1, const char *fname2);
+static int test_group_recurse2(void);
+static int test_exclude_obj1(const char *fname1, const char *fname2);
+static int test_exclude_obj2(const char *fname1, const char *fname2);
+static int test_exclude_obj3(const char *fname1, const char *fname2);
+static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int is_file_new);
+static int test_attributes_verbose_level(const char *fname1, const char *fname2);
+static int test_enums(const char *fname);
+static void test_comps_array (const char *fname, const char *dset, const char *attr,int diff, int is_file_new);
+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_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);
+static void write_dset_in(hid_t loc_id,const char* dset_name,hid_t fid,int make_diffs);
+static void gen_datareg(hid_t fid,int make_diffs);
+/* utilities */
+static int write_attr(hid_t loc_id,int rank,hsize_t *dims,const char *name,hid_t tid,void *buf);
+static int write_dset(hid_t loc_id,int rank,hsize_t *dims,const char *name,hid_t tid,void *buf);
+static int gen_dataset_idx(const char *file, int format);
+
+
+/*-------------------------------------------------------------------------
+* Function: main
+*
+* Purpose: main program
+*
+*-------------------------------------------------------------------------
+*/
+
+int main(void)
+{
+ test_basic(FILE1, FILE2, FILE11);
+
+ test_types (FILE3);
+ test_datatypes(FILE4);
+
+ /* generate 2 files, the second call creates a similar file with differences */
+ test_attributes(FILE5,0);
+ test_attributes(FILE6,1);
+
+ /* test attributes with verbose level */
+ test_attributes_verbose_level(ATTR_VERBOSE_LEVEL_FILE1, ATTR_VERBOSE_LEVEL_FILE2);
+
+ /* generate 2 files, the second call creates a similar file with differences */
+ test_datasets(FILE7,0);
+ test_datasets(FILE8,1);
+
+ /* generate 2 files, the second call creates a similar file with differences */
+ test_hyperslab(FILE9,0);
+ test_hyperslab(FILE10,1);
+
+ test_link_name(FILE12);
+
+ test_soft_links(FILE13);
+
+ test_linked_softlinks(FILE14);
+
+ test_external_links(FILE15, FILE16);
+
+ test_ext2soft_links(FILE17, FILE18);
+
+ /* generate 2 files, the second call creates a similar file with differences */
+ test_special_datasets(FILE19,0);
+ test_special_datasets(FILE20,1);
+
+ /*
+ * Generate 2 files: FILE21 with old format; FILE22 with new format
+ * Create 2 datasets in each file:
+ * One dataset: chunked layout, w/o filters, fixed dimension
+ * One dataset: chunked layout, w/ filters, fixed dimension
+ */
+ gen_dataset_idx(FILE21, 0);
+ gen_dataset_idx(FILE22, 1);
+
+ test_dangle_links(DANGLE_LINK_FILE1, DANGLE_LINK_FILE2);
+
+ test_group_recurse(GRP_RECURSE_FILE1, GRP_RECURSE_FILE2);
+ test_group_recurse2();
+
+ test_exclude_obj1(EXCLUDE_FILE1_1, EXCLUDE_FILE1_2);
+ test_exclude_obj2(EXCLUDE_FILE2_1, EXCLUDE_FILE2_2);
+ test_exclude_obj3(EXCLUDE_FILE3_1, EXCLUDE_FILE3_2);
+
+ /* diff various multiple vlen and fixlen string types in a compound dataset */
+ test_comp_vlen_strings(COMP_VL_STRS_FILE, "group", 1);
+ test_comp_vlen_strings(COMP_VL_STRS_FILE, "group_copy", 0);
+
+ /* diff when invalid enum values are present.
+ * This will probably grow to involve more extensive testing of
+ * enums so it has been given its own test file and test (apart
+ * from the basic type testing).
+ */
+ test_enums(ENUM_INVALID_VALUES);
+
+ /* -------------------------------------------------
+ * Create test files with dataset and attribute with container types
+ * (array, vlen) with multiple nested compound types.
+ */
+ /* file1 */
+ test_comps_array(COMPS_COMPLEX1,"dset1", "attr1", 0, 1);
+ test_comps_vlen(COMPS_COMPLEX1,"dset2", "attr2", 0, 0);
+ test_comps_array_vlen(COMPS_COMPLEX1,"dset3", "attr3", 0, 0);
+ test_comps_vlen_arry(COMPS_COMPLEX1,"dset4", "attr4", 0, 0);
+ /* file2 */
+ test_comps_array(COMPS_COMPLEX2,"dset1", "attr1", 5, 1);
+ test_comps_vlen(COMPS_COMPLEX2,"dset2", "attr2",5, 0);
+ test_comps_array_vlen(COMPS_COMPLEX2,"dset3", "attr3", 5, 0);
+ test_comps_vlen_arry(COMPS_COMPLEX2,"dset4", "attr4", 5, 0);
+
+ /*-------------------------------------------------
+ * Create test files with non-comparable dataset and attributes with
+ * comparable datasets and attributes. All the comparables should display
+ * differences.
+ */
+ 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;
+}
+
+/*-------------------------------------------------------------------------
+* Function: test_basic
+*
+* Purpose: Create basic test files, first two contains different data, the
+* third one is just an empty file.
+*
+*-------------------------------------------------------------------------
+*/
+
+static
+int test_basic(const char *fname1, const char *fname2, const char *fname3)
+{
+ hid_t fid1, fid2;
+ hid_t gid1, gid2, gid3;
+ hsize_t dims1[1] = { 6 };
+ hsize_t dims2[2] = { 3,2 };
+
+ /* create the empty file */
+ if ((fid1=H5Fcreate(fname3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0){
+ fprintf(stderr, "empty file (%s) creation failed.\n", fname3);
+ goto out;
+ }
+ if (H5Fclose(fid1) < 0){
+ fprintf(stderr, "empty file (%s) close failed.\n", fname3);
+ goto out;
+ }
+
+ /*-------------------------------------------------------------------------
+ * create two files
+ *-------------------------------------------------------------------------
+ */
+
+ if (( fid1 = H5Fcreate (fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0 )
+ goto out;
+ if (( fid2 = H5Fcreate (fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0 )
+ goto out;
+
+ /*-------------------------------------------------------------------------
+ * create groups
+ *-------------------------------------------------------------------------
+ */
+
+ gid1 = H5Gcreate2(fid1, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ gid2 = H5Gcreate2(fid2, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ gid3 = H5Gcreate2(fid2, "g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*-------------------------------------------------------------------------
+ * tests:
+ * # 1.1 normal mode
+ * # 1.2 normal mode with objects
+ * # 1.3 report mode
+ * # 1.4 report mode with objects
+ * # 1.5 with -d
+ *-------------------------------------------------------------------------
+ */
+
+ {
+ double data1[3][2] = {{ 1.0F, 1.0F}, { 1.00F, 1.000F}, { 0.0F, 0.0F}};
+ double data2[3][2] = {{ 0.0F, 1.1F}, { 1.01F, 1.001F}, { 0.0F, 1.0F}};
+ double data3[3][2] = {{100.0F, 100.0F}, {100.00F, 100.000F}, {100.0F, 100.0F}};
+ double data4[3][2] = {{105.0F, 120.0F}, {160.00F, 95.000F}, { 80.0F, 40.0F}};
+
+ write_dset(gid1,2,dims2,"dset1",H5T_NATIVE_DOUBLE,data1);
+ write_dset(gid2,2,dims2,"dset2",H5T_NATIVE_DOUBLE,data2);
+ write_dset(gid1,2,dims2,"dset3",H5T_NATIVE_DOUBLE,data3);
+ write_dset(gid2,2,dims2,"dset4",H5T_NATIVE_DOUBLE,data4);
+ write_dset(gid2,2,dims2,"dset1",H5T_NATIVE_DOUBLE,data2);
+
+ }
+ /*-------------------------------------------------------------------------
+ * relative error, compare divide by zero, both zero
+ * # 1.6.1 with -p (int)
+ *-------------------------------------------------------------------------
+ */
+ {
+ int data5[3][2] = {{100,100},{100,0},{0,100}};
+ int data6[3][2] = {{120,80}, {0,100},{0,50}};
+
+ write_dset(gid1,2,dims2,"dset5",H5T_NATIVE_INT,data5);
+ write_dset(gid1,2,dims2,"dset6",H5T_NATIVE_INT,data6);
+
+ }
+
+ /*-------------------------------------------------------------------------
+ * relative error, compare divide by zero, both zero
+ * # 1.6.2 with -p (unsigned long long)
+ *-------------------------------------------------------------------------
+ */
+ {
+ unsigned long long data7[3][2] = {{100,100},{100,0},{0,100}};
+ unsigned long long data8[3][2] = {{120,80}, {0,100},{0,50}};
+
+ write_dset(gid1,2,dims2,"dset7",H5T_NATIVE_ULLONG,data7);
+ write_dset(gid1,2,dims2,"dset8",H5T_NATIVE_ULLONG,data8);
+
+ }
+
+ /*-------------------------------------------------------------------------
+ * relative error, compare divide by zero, both zero
+ * # 1.6.3 with -p (double)
+ *
+ * A B 1-B/A %
+ * 100 120 0.2 20
+ * 100 80 0.2 20
+ * 100 0 1 100
+ * 0 100 #DIV/0! #DIV/0!
+ * 0 0 #DIV/0! #DIV/0!
+ * 100 50 0.5 50
+ *-------------------------------------------------------------------------
+ */
+ {
+ double data9[3][2] = {{100.0F, 100.0F}, {100.0F, 0.0F}, {0.0F, 100.0F}};
+ double data10[3][2] ={{120.0F, 80.0F}, { 0.0F, 100.0F}, {0.0F, 50.0F}};
+
+ write_dset(gid1,2,dims2,"dset9",H5T_NATIVE_DOUBLE,data9);
+ write_dset(gid1,2,dims2,"dset10",H5T_NATIVE_DOUBLE,data10);
+
+ }
+
+
+ /*-------------------------------------------------------------------------
+ * test floating point comparison
+ *-------------------------------------------------------------------------
+ */
+ {
+ /* epsilon = 0.0000001 = 1e-7
+ * system epsilon for float : FLT_EPSILON = 1.19209E-07
+ */
+ float data11[3][2] ={{0.000000f,0.0000001f},{0.0000001f, 0.00000022f},{0.0000001f,0.0000001f}};
+ float data12[3][2] ={{0.000000f,0.0000002f},{0.0000003f,0.0000001f},{0.000000f,0.0000001f}};
+ /* epsilon = 0.0000000000000001 = 1e-16
+ * system epsilon for double : DBL_EPSILON = 2.22045E-16
+ */
+ double data13[3][2] ={
+ {H5_DOUBLE(0.0000000000000000), H5_DOUBLE(0.0000000000000001)},
+ {H5_DOUBLE(0.0000000000000001), H5_DOUBLE(0.0000000000000000)},
+ {H5_DOUBLE(0.00000000000000033), H5_DOUBLE(0.0000000000000001)}};
+ double data14[3][2] ={
+ {H5_DOUBLE(0.0000000000000000), H5_DOUBLE(0.0000000000000004)},
+ {H5_DOUBLE(0.0000000000000002), H5_DOUBLE(0.0000000000000001)},
+ {H5_DOUBLE(0.0000000000000001), H5_DOUBLE(0.00000000000000000)}};
+
+ write_dset(gid1,2,dims2,"fp1",H5T_NATIVE_FLOAT,data11);
+ write_dset(gid1,2,dims2,"fp2",H5T_NATIVE_FLOAT,data12);
+ write_dset(gid1,2,dims2,"d1",H5T_NATIVE_DOUBLE,data13);
+ write_dset(gid1,2,dims2,"d2",H5T_NATIVE_DOUBLE,data14);
+
+ }
+
+
+#if H5_SIZEOF_LONG_DOUBLE !=0
+ {
+
+ /*-------------------------------------------------------------------------
+ * H5T_NATIVE_LDOUBLE
+ *-------------------------------------------------------------------------
+ */
+
+ long double data15[3][2] ={{1.0L,1.0L},{1.0L,1.0L},{1.0L,1.0L}};
+
+ write_dset(gid1,2,dims2,"ld",H5T_NATIVE_LDOUBLE,data15);
+
+ }
+#endif
+
+
+
+ /*-------------------------------------------------------------------------
+ * NaNs in H5T_NATIVE_FLOAT
+ *-------------------------------------------------------------------------
+ */
+ {
+
+ float data15[6];
+ float data16[6];
+
+ data15[0] = (float)HDsqrt(-1.0F);
+ data15[1] = 1.0F;
+ data15[2] = (float)HDsqrt(-1.0F);
+ data15[3] = 1.0F;
+ data15[4] = 1.0F;
+ data15[5] = 1.0F;
+
+ data16[0] = (float)HDsqrt(-1.0F);
+ data16[1] = (float)HDsqrt(-1.0F);
+ data16[2] = 1.0F;
+ data16[3] = 1.0F;
+ data16[4] = 1.0F;
+ data16[5] = 1.0F;
+
+ write_dset(gid1,1,dims1,"fp15",H5T_NATIVE_FLOAT,data15);
+ write_dset(gid1,1,dims1,"fp16",H5T_NATIVE_FLOAT,data16);
+
+ }
+
+ /*-------------------------------------------------------------------------
+ * NaNs in H5T_NATIVE_DOUBLE
+ *-------------------------------------------------------------------------
+ */
+ {
+
+ double data17[6];
+ double data18[6];
+
+ data17[0] = HDsqrt(-1.0F);
+ data17[1] = 1.0F;
+ data17[2] = HDsqrt(-1.0F);
+ data17[3] = 1.0F;
+ data17[4] = 1.0F;
+ data17[5] = 1.0F;
+
+ data18[0] = HDsqrt(-1.0F);
+ data18[1] = HDsqrt(-10000.0F);
+ data18[2] = 1.0F;
+ data18[3] = 1.0F;
+ data18[4] = 1.0F;
+ data18[5] = 1.0F;
+
+ write_dset(gid1,1,dims1,"fp17",H5T_NATIVE_DOUBLE,data17);
+ write_dset(gid1,1,dims1,"fp18",H5T_NATIVE_DOUBLE,data18);
+ write_dset(gid1,1,dims1,"fp18_COPY",H5T_NATIVE_DOUBLE,data18);
+ }
+
+ /*------------------------------------------------------------------------
+ * INFINITY values
+ *------------------------------------------------------------------------
+ */
+ {
+ float data19[6];
+ double data20[6];
+
+ data19[0] = data19[1] = data19[2] = (float)HDlog(0.0F);
+ data19[3] = data19[4] = data19[5] = (float)-HDlog(0.0F);
+
+ data20[0] = data20[1] = data20[2] = HDlog(0.0F);
+ data20[3] = data20[4] = data20[5] = -HDlog(0.0F);
+
+ write_dset(gid1,1,dims1,"fp19",H5T_NATIVE_FLOAT,data19);
+ write_dset(gid1,1,dims1,"fp19_COPY",H5T_NATIVE_FLOAT,data19);
+ write_dset(gid1,1,dims1,"fp20",H5T_NATIVE_DOUBLE,data20);
+ write_dset(gid1,1,dims1,"fp20_COPY",H5T_NATIVE_DOUBLE,data20);
+ }
+
+ /*-------------------------------------------------------------------------
+ * NaNs in H5T_NATIVE_DOUBLE and H5T_NATIVE_FLOAT inside H5T_COMPOUND
+ *-------------------------------------------------------------------------
+ */
+ {
+ typedef struct cmp1_t
+ {
+ double d;
+ float f;
+ } cmp1_t;
+
+ cmp1_t buf1[2];
+ cmp1_t buf2[2];
+ hsize_t dims[1] = {2};
+ size_t type_size;
+ hid_t tid;
+
+ buf1[0].d = HDsqrt(-1.0F);
+ buf1[0].f = (float)HDsqrt(-1.0F);
+ buf2[0].d = HDsqrt(-1.0F);
+ buf2[0].f = (float)HDsqrt(-1.0F);
+
+ buf1[1].d = HDsqrt(-1.0F);
+ buf1[1].f = (float)HDsqrt(-1.0F);
+ buf2[1].d = 0.0F;
+ buf2[1].f = 0.0F;
+
+ type_size = sizeof( cmp1_t );
+ tid = H5Tcreate (H5T_COMPOUND, type_size );
+ H5Tinsert(tid, "d", HOFFSET( cmp1_t, d ), H5T_NATIVE_DOUBLE );
+ H5Tinsert(tid, "f", HOFFSET( cmp1_t, f ), H5T_NATIVE_FLOAT );
+ write_dset(gid1,1,dims,"dset11",tid,buf1);
+ write_dset(gid1,1,dims,"dset12",tid,buf2);
+ H5Tclose(tid);
+
+
+ }
+
+ /* not comparable objects */
+ {
+
+ typedef struct cmp1_t
+ {
+ double d;
+ int i;
+ } cmp1_t;
+
+ typedef struct cmp2_t
+ {
+ int i;
+ double d;
+ } cmp2_t;
+
+ typedef struct cmp3_t
+ {
+ int i;
+ } cmp3_t;
+
+ double data2[6] = {0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F};
+ int data3[6] = {0,0,0,0,0,0};
+ int data4[3][2] = {{0,0},{0,0},{0,0}};
+ int data5[2][2] = {{0,0},{0,0}};
+ unsigned int data6[3][2] = {{0,0},{0,0},{0,0}};
+ cmp1_t data7[1] = {{1.0f, 2}};
+ cmp2_t data8[1] = {{1, 2.0f}};
+ hsize_t dims3[2] = {2, 2};
+ hsize_t dims4[1] = {1};
+ size_t type_size;
+ hid_t tid;
+
+
+
+ write_dset(gid3,1,dims1,"dset1",H5T_NATIVE_DOUBLE,NULL);
+ write_dset(gid3,1,dims1,"dset2",H5T_NATIVE_DOUBLE,data2);
+ write_dset(gid3,1,dims1,"dset3",H5T_NATIVE_INT,data3);
+ write_dset(gid3,2,dims2,"dset4",H5T_NATIVE_INT,data4);
+ write_dset(gid3,2,dims3,"dset5",H5T_NATIVE_INT,data5);
+ write_dset(gid3,2,dims2,"dset6",H5T_NATIVE_UINT,data6);
+
+ /* case of compound with different type members */
+ type_size = sizeof( cmp1_t );
+ tid = H5Tcreate (H5T_COMPOUND, type_size );
+ H5Tinsert(tid, "d", HOFFSET( cmp1_t, d ), H5T_NATIVE_DOUBLE );
+ H5Tinsert(tid, "i", HOFFSET( cmp1_t, i ), H5T_NATIVE_INT );
+ write_dset(gid3,1,dims4,"dset7",tid,data7);
+ H5Tclose(tid);
+
+ type_size = sizeof( cmp2_t );
+ tid = H5Tcreate (H5T_COMPOUND, type_size );
+ H5Tinsert(tid, "i", HOFFSET( cmp2_t, i ), H5T_NATIVE_INT );
+ H5Tinsert(tid, "d", HOFFSET( cmp2_t, d ), H5T_NATIVE_DOUBLE );
+ write_dset(gid3,1,dims4,"dset8",tid,data8);
+ H5Tclose(tid);
+
+ /* case of compound with different number of members */
+ type_size = sizeof( cmp3_t );
+ tid = H5Tcreate (H5T_COMPOUND, type_size );
+ H5Tinsert(tid, "i", HOFFSET( cmp2_t, i ), H5T_NATIVE_INT );
+ write_dset(gid3,1,dims4,"dset9",tid,NULL);
+ H5Tclose(tid);
+
+ }
+
+
+ /*-------------------------------------------------------------------------
+ * close
+ *-------------------------------------------------------------------------
+ */
+ H5Gclose(gid1);
+ H5Gclose(gid2);
+ H5Gclose(gid3);
+ H5Fclose(fid1);
+ H5Fclose(fid2);
+ return SUCCEED;
+
+out:
+
+ return FAIL;
+}
+
+
+/*-------------------------------------------------------------------------
+* Function: test_types
+*
+* Purpose: Compare different HDF5 object & link types:
+* H5G_DATASET, H5G_TYPE, H5G_GROUP, H5G_LINK, H5G_UDLINK
+*
+*-------------------------------------------------------------------------
+*/
+static
+int test_types(const char *fname)
+{
+ hid_t fid1;
+ hid_t gid1;
+ hid_t gid2;
+ hid_t tid1;
+ hid_t tid2;
+ herr_t status;
+ hsize_t dims[1]={1};
+ typedef struct s1_t
+ {
+ int a;
+ float b;
+ } s1_t;
+ typedef struct s2_t
+ {
+ int a;
+ } s2_t;
+
+ /*-------------------------------------------------------------------------
+ * Create one file
+ *-------------------------------------------------------------------------
+ */
+ fid1 = H5Fcreate (fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*-------------------------------------------------------------------------
+ * H5G_DATASET
+ *-------------------------------------------------------------------------
+ */
+ write_dset(fid1,1,dims,"dset",H5T_NATIVE_INT,0);
+
+ /*-------------------------------------------------------------------------
+ * H5G_GROUP
+ *-------------------------------------------------------------------------
+ */
+ gid1 = H5Gcreate2(fid1, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Gclose(gid1);
+ gid2 = H5Gcreate2(fid1, "g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Gclose(gid2);
+
+ /*-------------------------------------------------------------------------
+ * H5G_TYPE
+ *-------------------------------------------------------------------------
+ */
+
+ /* create and commit datatype 1 */
+ tid1 = H5Tcreate(H5T_COMPOUND, sizeof(s1_t));
+ H5Tinsert(tid1, "a", HOFFSET(s1_t, a), H5T_NATIVE_INT);
+ H5Tinsert(tid1, "b", HOFFSET(s1_t, b), H5T_NATIVE_FLOAT);
+ H5Tcommit2(fid1, "t1", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Tclose(tid1);
+ /* create and commit datatype 2 */
+ tid2 = H5Tcreate(H5T_COMPOUND, sizeof(s2_t));
+ H5Tinsert(tid2, "a", HOFFSET(s2_t, a), H5T_NATIVE_INT);
+ H5Tcommit2(fid1, "t2", tid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Tclose(tid2);
+
+ /*-------------------------------------------------------------------------
+ * H5G_LINK
+ *-------------------------------------------------------------------------
+ */
+
+ status = H5Lcreate_soft("g1", fid1, "l1", H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Lcreate_soft("g2", fid1, "l2", H5P_DEFAULT, H5P_DEFAULT);
+
+ /*-------------------------------------------------------------------------
+ * H5G_UDLINK
+ *-------------------------------------------------------------------------
+ */
+ H5Lcreate_external("filename", "objname", fid1, "ext_link", H5P_DEFAULT, H5P_DEFAULT);
+ H5Lregister(UD_link_class);
+ H5Lcreate_ud(fid1, "ud_link", (H5L_type_t)MY_LINKCLASS, NULL, (size_t)0, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*-------------------------------------------------------------------------
+ * Close
+ *-------------------------------------------------------------------------
+ */
+ status = H5Fclose(fid1);
+ return status;
+}
+
+
+/*
+
+# ##############################################################################
+# # not comparable types
+# ##############################################################################
+
+# 2.0
+TOOLTEST h5diff_20.txt file3.h5 file3.h5 -v dset g1
+
+# 2.1
+TOOLTEST h5diff_21.txt file3.h5 file3.h5 -v dset l1
+
+# 2.2
+TOOLTEST h5diff_22.txt file3.h5 file3.h5 -v dset t1
+
+# ##############################################################################
+# # compare groups, types, links (no differences and differences)
+# ##############################################################################
+
+# 2.3
+TOOLTEST h5diff_23.txt file3.h5 file3.h5 -v g1 g1
+
+# 2.4
+TOOLTEST h5diff_24.txt file3.h5 file3.h5 -v t1 t1
+
+# 2.5
+TOOLTEST h5diff_25.txt file3.h5 file3.h5 -v l1 l1
+
+# 2.6
+TOOLTEST h5diff_26.txt file3.h5 file3.h5 -v g1 g2
+
+# 2.7
+TOOLTEST h5diff_27.txt file3.h5 file3.h5 -v t1 t2
+
+# 2.8
+TOOLTEST h5diff_28.txt file3.h5 file3.h5 -v l1 l2
+*/
+
+/*-------------------------------------------------------------------------
+* Function: test_datatypes
+*
+* Purpose: test dataset datatypes
+*
+*-------------------------------------------------------------------------
+*/
+static
+int test_datatypes(const char *fname)
+{
+
+ hid_t fid1;
+ hid_t dset;
+ hsize_t dims[2]={3,2};
+ herr_t status;
+ char buf1a[3][2] = {{1,1},{1,1},{1,1}};
+ char buf1b[3][2] = {{1,1},{3,4},{5,6}};
+ short buf2a[3][2] = {{1,1},{1,1},{1,1}};
+ short buf2b[3][2] = {{1,1},{3,4},{5,6}};
+ int buf3a[3][2] = {{1,1},{1,1},{1,1}};
+ int buf3b[3][2] = {{1,1},{3,4},{5,6}};
+ long buf4a[3][2] = {{1,1},{1,1},{1,1}};
+ long buf4b[3][2] = {{1,1},{3,4},{5,6}};
+ float buf5a[3][2] = {{1.0F, 1.0F}, {1.0F, 1.0F}, {1.0F, 1.0F}};
+ float buf5b[3][2] = {{1.0F, 1.0F}, {3.0F, 4.0F}, {5.0F, 6.0F}};
+ double buf6a[3][2] = {{1.0F, 1.0F}, {1.0F, 1.0F}, {1.0F, 1.0F}};
+ double buf6b[3][2] = {{1.0F, 1.0F}, {3.0F, 4.0F}, {5.0F, 6.0F}};
+
+ /*unsigned/signed test
+ signed char -128 to 127
+ unsigned char 0 to 255
+ */
+ char buf7a[3][2] = {{-1,-128},{-1,-1},{-1,-1}};
+ unsigned char buf7b[3][2] = {{1,128},{1,1},{1,1}};
+
+ /* long long test */
+ long long buf8a[3][2] = {{1,1},{1,1},{1,1}};
+ long long buf8b[3][2] = {{1,1},{3,4},{5,6}};
+ unsigned long long buf9a[3][2] = {{1,1},{1,1},{1,1}};
+ unsigned long long buf9b[3][2] = {{1,1},{3,4},{5,6}};
+
+ unsigned int buf10a[3][2] = {{UIMAX,1},{1,1},{1,1}};
+ unsigned int buf10b[3][2] = {{UIMAX-1,1},{3,4},{5,6}};
+
+ unsigned short buf11a[3][2] = {{204,205},{2,3},{1,1}};
+ unsigned int buf11b[3][2] = {{204,205},{2,3},{1,1}};
+
+
+ /*-------------------------------------------------------------------------
+ * Create a file
+ *-------------------------------------------------------------------------
+ */
+ fid1 = H5Fcreate (fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*-------------------------------------------------------------------------
+ * Check for different storage order. Give a warning if they are different
+ *-------------------------------------------------------------------------
+ */
+
+ write_dset(fid1,2,dims,"dset0a",H5T_STD_I16LE,buf2a);
+ write_dset(fid1,2,dims,"dset0b",H5T_STD_I32LE,buf3b);
+
+ /*-------------------------------------------------------------------------
+ * H5T_NATIVE_CHAR
+ *-------------------------------------------------------------------------
+ */
+ write_dset(fid1,2,dims,"dset1a",H5T_NATIVE_CHAR,buf1a);
+ write_dset(fid1,2,dims,"dset1b",H5T_NATIVE_CHAR,buf1b);
+
+ /*-------------------------------------------------------------------------
+ * H5T_NATIVE_SHORT
+ *-------------------------------------------------------------------------
+ */
+ write_dset(fid1,2,dims,"dset2a",H5T_NATIVE_SHORT,buf2a);
+ write_dset(fid1,2,dims,"dset2b",H5T_NATIVE_SHORT,buf2b);
+
+ /*-------------------------------------------------------------------------
+ * H5T_NATIVE_INT
+ *-------------------------------------------------------------------------
+ */
+ write_dset(fid1,2,dims,"dset3a",H5T_NATIVE_INT,buf3a);
+ write_dset(fid1,2,dims,"dset3b",H5T_NATIVE_INT,buf3b);
+
+ /*-------------------------------------------------------------------------
+ * H5T_NATIVE_LONG
+ *-------------------------------------------------------------------------
+ */
+ write_dset(fid1,2,dims,"dset4a",H5T_NATIVE_LONG,buf4a);
+ write_dset(fid1,2,dims,"dset4b",H5T_NATIVE_LONG,buf4b);
+
+ /*-------------------------------------------------------------------------
+ * H5T_NATIVE_FLOAT
+ *-------------------------------------------------------------------------
+ */
+ write_dset(fid1,2,dims,"dset5a",H5T_NATIVE_FLOAT,buf5a);
+ write_dset(fid1,2,dims,"dset5b",H5T_NATIVE_FLOAT,buf5b);
+
+ /*-------------------------------------------------------------------------
+ * H5T_NATIVE_DOUBLE
+ *-------------------------------------------------------------------------
+ */
+
+ write_dset(fid1,2,dims,"dset6a",H5T_NATIVE_DOUBLE,buf6a);
+ write_dset(fid1,2,dims,"dset6b",H5T_NATIVE_DOUBLE,buf6b);
+
+ /*-------------------------------------------------------------------------
+ * H5T_NATIVE_CHAR and H5T_NATIVE_UCHAR
+ *-------------------------------------------------------------------------
+ */
+
+ write_dset(fid1,2,dims,"dset7a",H5T_NATIVE_CHAR,buf7a);
+ write_dset(fid1,2,dims,"dset7b",H5T_NATIVE_UCHAR,buf7b);
+
+ /*-------------------------------------------------------------------------
+ * H5T_NATIVE_LLONG
+ *-------------------------------------------------------------------------
+ */
+
+ write_dset(fid1,2,dims,"dset8a",H5T_NATIVE_LLONG,buf8a);
+ write_dset(fid1,2,dims,"dset8b",H5T_NATIVE_LLONG,buf8b);
+
+ /*-------------------------------------------------------------------------
+ * H5T_NATIVE_ULLONG
+ *-------------------------------------------------------------------------
+ */
+
+ write_dset(fid1,2,dims,"dset9a",H5T_NATIVE_ULLONG,buf9a);
+ write_dset(fid1,2,dims,"dset9b",H5T_NATIVE_ULLONG,buf9b);
+
+ /*-------------------------------------------------------------------------
+ * H5T_NATIVE_INT
+ *-------------------------------------------------------------------------
+ */
+
+ write_dset(fid1,2,dims,"dset10a",H5T_NATIVE_UINT,buf10a);
+ write_dset(fid1,2,dims,"dset10b",H5T_NATIVE_UINT,buf10b);
+
+ /*-------------------------------------------------------------------------
+ * Same type class, different size
+ *-------------------------------------------------------------------------
+ */
+ write_dset(fid1,2,dims,"dset11a",H5T_STD_U16LE,buf11a);
+ dset=H5Dopen2 (fid1, "dset11a", H5P_DEFAULT);
+ write_attr(dset,2,dims,"attr",H5T_STD_U16LE,buf11a);
+ H5Dclose (dset);
+
+ write_dset(fid1,2,dims,"dset11b",H5T_STD_U32LE,buf11b);
+ dset=H5Dopen2 (fid1, "dset11b", H5P_DEFAULT);
+ write_attr(dset,2,dims,"attr",H5T_STD_U32LE,buf11b);
+ H5Dclose (dset);
+
+ /*-------------------------------------------------------------------------
+ * Close
+ *-------------------------------------------------------------------------
+ */
+ status = H5Fclose(fid1);
+ return status;
+}
+
+/*
+# ##############################################################################
+# # Dataset datatypes
+# ##############################################################################
+
+# 5.0
+TOOLTEST h5diff_50.txt file4.h5 file4.h5 -v dset0a dset0b
+
+# 5.1
+TOOLTEST h5diff_51.txt file4.h5 file4.h5 -v dset1a dset1b
+
+# 5.2
+TOOLTEST h5diff_52.txt file4.h5 file4.h5 -v dset2a dset2b
+
+# 5.3
+TOOLTEST h5diff_53.txt file4.h5 file4.h5 -v dset3a dset4b
+
+# 5.4
+TOOLTEST h5diff_54.txt file4.h5 file4.h5 -v dset4a dset4b
+
+# 5.5
+TOOLTEST h5diff_55.txt file4.h5 file4.h5 -v dset5a dset5b
+
+# 5.6
+TOOLTEST h5diff_56.txt file4.h5 file4.h5 -v dset6a dset6b
+
+# 5.7
+TOOLTEST h5diff_57.txt file4.h5 file4.h5 -v dset7a dset7b
+
+# 5.8 (region reference)
+TOOLTEST h5diff_58.txt file7.h5 file8.h5 -v refreg
+*/
+
+/*-------------------------------------------------------------------------
+* Function: test_attributes
+*
+* Purpose: test attributes
+*
+*-------------------------------------------------------------------------
+*/
+static
+int test_attributes(const char *file,
+ int make_diffs /* flag to modify data buffers */)
+{
+ hid_t fid;
+ hid_t did;
+ hid_t gid;
+ hid_t root_id;
+ hid_t sid;
+ hsize_t dims[1]={2};
+ herr_t status;
+
+ /* Create a file */
+ if((fid = H5Fcreate(file, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ return -1;
+
+ /* Create a 1D dataset */
+ sid = H5Screate_simple(1, dims, NULL);
+ did = H5Dcreate2(fid, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Sclose(sid);
+ assert(status >= 0);
+
+ /* Create groups */
+ gid = H5Gcreate2(fid, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ root_id = H5Gopen2(fid, "/", H5P_DEFAULT);
+
+ /*-------------------------------------------------------------------------
+ * write a series of attributes on the dataset, group, and root group
+ *-------------------------------------------------------------------------
+ */
+
+ write_attr_in(did,"dset",fid,make_diffs);
+ write_attr_in(gid,NULL,(hid_t)0,make_diffs);
+ write_attr_in(root_id,NULL,(hid_t)0,make_diffs);
+
+
+ /* Close */
+ status = H5Dclose(did);
+ assert(status >= 0);
+ status = H5Gclose(gid);
+ assert(status >= 0);
+ status = H5Gclose(root_id);
+ assert(status >= 0);
+
+ /* Close file */
+ status = H5Fclose(fid);
+ assert(status >= 0);
+ return status;
+}
+
+
+/*-------------------------------------------------------------------------
+* Function: test_attributes_verbose_level
+*
+* Purpose: Cresting test files for testing attributes along with
+* levels of verbos option
+*
+*-------------------------------------------------------------------------
+*/
+static int test_attributes_verbose_level(const char *fname1, const char *fname2)
+{
+ herr_t status = SUCCEED;
+ hid_t fid1 = -1, fid2 = -1;
+ hid_t f1_gid = -1, f2_gid = -1;
+ hid_t f1_gid2 = -1, f2_gid2 = -1;
+ hid_t f1_gid3 = -1, f2_gid3 = -1;
+ hid_t f1_gid4 = -1, f2_gid4 = -1;
+ hid_t f1_did = -1, f2_did = -1;
+ hid_t f1_sid = -1, f2_sid = -1;
+ hid_t f1_tid = -1, f2_tid = -1;
+ /* dset */
+ hsize_t dset_dims[1]={3};
+ int dset_data[3] = {0,1,2};
+
+ /* common attrs dim */
+ hsize_t attr_dims[1]={2};
+
+ /* file1 attr */
+ int f1_attr_idata[2]= {1,2}; /* integer */
+ float f1_attr_fdata[2]= {1.1F,2.2F}; /* float */
+ /* file2 attr */
+ int f2_attr_idata[2]= {2,3}; /* integer */
+ float f2_attr_fdata[2]= {2.1F,3.2F}; /* float */
+
+
+ /*----------------------------------------------------------------------
+ * Create file1
+ *-----------------------------------------------------------------------*/
+ if((fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ /*----------------------------------
+ * Groups
+ */
+ f1_gid = H5Gcreate2(fid1, "g", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (f1_gid < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ f1_gid2 = H5Gcreate2(fid1, "g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (f1_gid2 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ f1_gid3 = H5Gcreate2(fid1, "g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (f1_gid3 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ f1_gid4 = H5Gcreate2(fid1, "g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (f1_gid4 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ /*----------------------------------
+ * Datasets
+ */
+ f1_sid = H5Screate_simple(1, dset_dims, NULL);
+ f1_did = H5Dcreate2(fid1, "dset", H5T_NATIVE_INT, f1_sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (f1_did == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+ status = H5Dwrite(f1_did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset_data);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ /*----------------------------------
+ * Named Datatype
+ */
+ f1_tid = H5Tcopy(H5T_NATIVE_INT);
+ status = H5Tcommit2(fid1, "ntype", f1_tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Tcommit2 failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+
+
+
+ /*----------------------------------------------------------------------
+ * Create file2
+ *-----------------------------------------------------------------------*/
+ if((fid2 = H5Fcreate(fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ /*----------------------------------
+ * Groups
+ */
+ f2_gid = H5Gcreate2(fid2, "g", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (f2_gid < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ f2_gid2 = H5Gcreate2(fid2, "g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (f2_gid2 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ f2_gid3 = H5Gcreate2(fid2, "g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (f2_gid3 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ f2_gid4 = H5Gcreate2(fid2, "g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (f2_gid4 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ /*----------------------------------
+ * Datasets
+ */
+ f2_sid = H5Screate_simple(1, dset_dims, NULL);
+ f2_did = H5Dcreate2(fid2, "dset", H5T_NATIVE_INT, f2_sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (f2_did == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+ status = H5Dwrite(f2_did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset_data);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ /*----------------------------------
+ * Named Datatype
+ */
+ f2_tid = H5Tcopy(H5T_NATIVE_INT);
+ status = H5Tcommit2(fid2, "ntype", f2_tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Tcommit2 failed.\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ /*----------------------------------
+ * CASE1 - Same attr number, all Same attr name
+ * add attr to group
+ */
+ write_attr(f1_gid,1,attr_dims,"integer1",H5T_NATIVE_INT,f1_attr_idata);
+ write_attr(f1_gid,1,attr_dims,"float1",H5T_NATIVE_FLOAT,f1_attr_fdata);
+
+ write_attr(f2_gid,1,attr_dims,"integer1",H5T_NATIVE_INT,f2_attr_idata);
+ write_attr(f2_gid,1,attr_dims,"float1",H5T_NATIVE_FLOAT,f2_attr_fdata);
+
+ /*----------------------------------
+ * CASE2 - Same attr number, some Same attr name
+ * add attr to dset
+ */
+ write_attr(f1_did,1,attr_dims,"integer1",H5T_NATIVE_INT,f1_attr_idata);
+ write_attr(f1_did,1,attr_dims,"float2",H5T_NATIVE_FLOAT,f1_attr_fdata);
+
+ write_attr(f2_did,1,attr_dims,"integer1",H5T_NATIVE_INT,f2_attr_idata);
+ write_attr(f2_did,1,attr_dims,"float3",H5T_NATIVE_FLOAT,f2_attr_fdata);
+
+ /*----------------------------------
+ * CASE3 - Same attr number, all different attr name
+ * add attr to ntype
+ */
+ write_attr(f1_tid,1,attr_dims,"integer1",H5T_NATIVE_INT,f1_attr_idata);
+ write_attr(f1_tid,1,attr_dims,"float2",H5T_NATIVE_FLOAT,f1_attr_fdata);
+ write_attr(f1_tid,1,attr_dims,"float3",H5T_NATIVE_FLOAT,f1_attr_fdata);
+
+ write_attr(f2_tid,1,attr_dims,"integer4",H5T_NATIVE_INT,f2_attr_idata);
+ write_attr(f2_tid,1,attr_dims,"float5",H5T_NATIVE_FLOAT,f2_attr_fdata);
+ write_attr(f2_tid,1,attr_dims,"float6",H5T_NATIVE_FLOAT,f2_attr_fdata);
+
+ /*----------------------------------
+ * CASE4 - Different attr number, some same attr name (vs file2-g2)
+ * add attr to g2
+ */
+ write_attr(f1_gid2,1,attr_dims,"integer1",H5T_NATIVE_INT,f1_attr_idata);
+ write_attr(f1_gid2,1,attr_dims,"float2",H5T_NATIVE_FLOAT,f1_attr_fdata);
+ write_attr(f1_gid2,1,attr_dims,"float3",H5T_NATIVE_FLOAT,f1_attr_fdata);
+
+ write_attr(f2_gid2,1,attr_dims,"integer1",H5T_NATIVE_INT,f2_attr_idata);
+ write_attr(f2_gid2,1,attr_dims,"float2",H5T_NATIVE_FLOAT,f2_attr_fdata);
+
+
+ /*----------------------------------
+ * CASE5 - Different attr number, all different attr name
+ * add attr to g3
+ */
+ write_attr(f1_gid3,1,attr_dims,"integer10",H5T_NATIVE_INT,f1_attr_idata);
+ write_attr(f1_gid3,1,attr_dims,"float11",H5T_NATIVE_FLOAT,f1_attr_fdata);
+ write_attr(f1_gid3,1,attr_dims,"float12",H5T_NATIVE_FLOAT,f1_attr_fdata);
+
+ write_attr(f2_gid3,1,attr_dims,"integer3",H5T_NATIVE_INT,f2_attr_idata);
+ write_attr(f2_gid3,1,attr_dims,"float4",H5T_NATIVE_FLOAT,f2_attr_fdata);
+
+
+out:
+ /*-----------------------------------------------------------------------
+ * Close
+ *-----------------------------------------------------------------------*/
+ if(fid1 > 0)
+ H5Fclose(fid1);
+ if(fid2 > 0)
+ H5Fclose(fid2);
+ if(f1_gid > 0)
+ H5Gclose(f1_gid);
+ if(f2_gid > 0)
+ H5Gclose(f2_gid);
+ if(f1_gid2 > 0)
+ H5Gclose(f1_gid2);
+ if(f2_gid2 > 0)
+ H5Gclose(f2_gid2);
+ if(f1_gid3 > 0)
+ H5Gclose(f1_gid3);
+ if(f2_gid3 > 0)
+ H5Gclose(f2_gid3);
+ if(f1_gid4 > 0)
+ H5Gclose(f1_gid4);
+ if(f2_gid4 > 0)
+ H5Gclose(f2_gid4);
+ if(f1_did > 0)
+ H5Dclose(f1_did);
+ if(f2_did > 0)
+ H5Dclose(f2_did);
+ if(f1_sid > 0)
+ H5Sclose(f1_sid);
+ if(f2_sid > 0)
+ H5Sclose(f2_sid);
+ if(f1_tid > 0)
+ H5Tclose(f1_tid);
+ if(f2_tid > 0)
+ H5Tclose(f2_tid);
+
+ return status;
+}
+
+
+/*-------------------------------------------------------------------------
+* Function: test_datasets
+*
+* Purpose: Check all HDF5 classes
+* H5T_INTEGER, H5T_FLOAT
+* H5T_TIME, H5T_STRING, H5T_BITFIELD, H5T_OPAQUE, H5T_COMPOUND, H5T_REFERENCE,
+* H5T_ENUM, H5T_VLEN, H5T_ARRAY
+*
+*-------------------------------------------------------------------------
+*/
+static
+int test_datasets(const char *file,
+ int make_diffs /* flag to modify data buffers */)
+{
+ hid_t fid;
+ hid_t did;
+ hid_t gid;
+ hid_t sid;
+ hsize_t dims[1]={2};
+ herr_t status;
+ int buf[2]={1,2};
+
+ if(make_diffs)
+ memset(buf, 0, sizeof buf);
+
+ /* Create a file */
+ if((fid = H5Fcreate(file, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ return -1;
+
+ /* Create a 1D dataset */
+ sid = H5Screate_simple(1, dims, NULL);
+ did = H5Dcreate2(fid, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
+ status = H5Sclose(sid);
+ assert(status >= 0);
+
+ /* Create a group */
+ gid = H5Gcreate2(fid, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*-------------------------------------------------------------------------
+ * write a series of datasets on the group
+ *-------------------------------------------------------------------------
+ */
+
+ write_dset_in(gid,"/dset",fid,make_diffs);
+
+ /* close */
+ status = H5Dclose(did);
+ assert(status >= 0);
+ status = H5Gclose(gid);
+ assert(status >= 0);
+
+ /* close file */
+ status = H5Fclose(fid);
+ assert(status >= 0);
+ return status;
+}
+
+/*-------------------------------------------------------------------------
+* Function: test_special_datasets
+*
+* Purpose: Check datasets with datasapce of zero dimension size.
+*-------------------------------------------------------------------------
+*/
+static
+int test_special_datasets(const char *file,
+ int make_diffs /* flag to modify data buffers */)
+{
+ hid_t fid;
+ hid_t did;
+ hid_t sid0, sid;
+ hsize_t dims0[SPACE1_RANK]={SPACE1_DIM1, SPACE1_DIM2};
+ hsize_t dims[SPACE1_RANK]={SPACE1_DIM1, SPACE1_DIM2};
+ herr_t status;
+
+ /* Create a file */
+ if((fid = H5Fcreate(file, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ return -1;
+
+ /* Create a dataset with zero dimension size */
+ sid0 = H5Screate_simple(SPACE1_RANK, dims0, NULL);
+ did = H5Dcreate2(fid, "dset1", H5T_NATIVE_INT, sid0, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* close dataset */
+ status = H5Dclose(did);
+ assert(status >= 0);
+
+ /* close dataspace */
+ status = H5Sclose(sid0);
+ assert(status >= 0);
+
+ /* Create a dataset with zero dimension size in one file but the other one
+ * has a dataset with a non-zero dimension size */
+ if(make_diffs) {
+ dims[1] = SPACE1_DIM2 + 4;
+ }
+
+ sid = H5Screate_simple(SPACE1_RANK, dims, NULL);
+ did = H5Dcreate2(fid, "dset2", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* close dataspace */
+ status = H5Sclose(sid);
+ assert(status >= 0);
+
+ /* close dataset */
+ status = H5Dclose(did);
+ assert(status >= 0);
+
+ /* close file */
+ status = H5Fclose(fid);
+ assert(status >= 0);
+ return status;
+}
+
+/*-------------------------------------------------------------------------
+*
+* Purpose: Create test files to compare links, one has longer name than
+* the other and short name is subset of long name.
+*
+* Programmer: Jonathan Kim (Feb 17, 2010)
+*
+*-------------------------------------------------------------------------*/
+static int test_link_name(const char *fname1)
+{
+ hid_t fid1=0;
+ hid_t gid1=0;
+ hid_t gid2=0;
+ herr_t status = SUCCEED;
+
+ /*-----------------------------------------------------------------------
+ * Create file(s)
+ *------------------------------------------------------------------------*/
+ fid1 = H5Fcreate (fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ if (fid1 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ /*-----------------------------------------------------------------------
+ * Groups
+ *------------------------------------------------------------------------*/
+ gid1 = H5Gcreate2(fid1, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (gid1 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+ gid2 = H5Gcreate2(fid1, "group_longname", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ if (gid2 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ /*-----------------------------------------------------------------------
+ * Soft Links
+ *------------------------------------------------------------------------*/
+ status = H5Lcreate_soft("group", fid1, "link_g1", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_soft("group_longname", fid1, "link_g2", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+out:
+ /*-----------------------------------------------------------------------
+ * Close
+ *------------------------------------------------------------------------*/
+ if(fid1)
+ H5Fclose(fid1);
+ if(gid1)
+ H5Gclose(gid1);
+ if(gid2)
+ H5Gclose(gid2);
+
+ return status;
+}
+
+/*-------------------------------------------------------------------------
+*
+* Purpose: Create test files to compare soft links in various way
+*
+* Programmer: Jonathan Kim (Feb 17, 2010)
+*
+*-------------------------------------------------------------------------*/
+static int test_soft_links(const char *fname1)
+{
+ hid_t fid1=0;
+ hid_t gid1=0;
+ hsize_t dims2[2] = {2,4};
+ int data1[4][2] = {{0,1},{2,3},{1,2},{3,4}};
+ int data2[4][2] = {{0,0},{0,0},{0,0},{0,0}};
+ herr_t status = SUCCEED;
+
+ /*-----------------------------------------------------------------------
+ * Create file(s)
+ *------------------------------------------------------------------------*/
+ fid1 = H5Fcreate (fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ if (fid1 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ /*-----------------------------------------------------------------------
+ * Groups
+ *------------------------------------------------------------------------*/
+ gid1 = H5Gcreate2(fid1, "target_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (gid1 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ /*-----------------------------------------------------------------------
+ * Datasets
+ *------------------------------------------------------------------------*/
+ /* file1 */
+ status = write_dset(fid1,2,dims2,"target_dset1",H5T_NATIVE_INT,data1);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = write_dset(fid1,2,dims2,"target_dset2",H5T_NATIVE_INT,data2);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = write_dset(gid1,2,dims2,"dset",H5T_NATIVE_INT,data1);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ /*-----------------------------------------------------------------------
+ * Soft Links
+ *------------------------------------------------------------------------*/
+ /* file 1 */
+ status = H5Lcreate_soft("/target_dset1", fid1, "softlink_dset1_1", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_soft("/target_dset1", fid1, "softlink_dset1_2", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_soft("/target_dset2", fid1, "softlink_dset2", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_soft("/target_group", fid1, "softlink_group1", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_soft("/target_group", fid1, "softlink_group2", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_soft("/no_obj", fid1, "softlink_noexist", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+out:
+ /*-----------------------------------------------------------------------
+ * Close
+ *-----------------------------------------------------------------------*/
+ if(fid1)
+ H5Fclose(fid1);
+ if(gid1)
+ H5Gclose(gid1);
+
+ return status;
+}
+
+/*-------------------------------------------------------------------------
+*
+* Purpose: Create test files to compare linked soft links in various way
+*
+* Programmer: Jonathan Kim (Feb 17, 2010)
+*
+*-------------------------------------------------------------------------*/
+static int test_linked_softlinks(const char *fname1)
+{
+ hid_t fid1=0;
+ hid_t gid1=0;
+ hid_t gid2=0;
+ hid_t gid3=0;
+ hsize_t dims2[2] = {2,4};
+ int data1[4][2] = {{0,1},{2,3},{1,2},{3,4}};
+ int data2[4][2] = {{0,0},{0,0},{0,0},{0,0}};
+ herr_t status = SUCCEED;
+
+ /*-----------------------------------------------------------------------
+ * Create file(s)
+ *------------------------------------------------------------------------*/
+ fid1 = H5Fcreate (fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ if (fid1 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ /*-----------------------------------------------------------------------
+ * Groups
+ *------------------------------------------------------------------------*/
+ gid1 = H5Gcreate2(fid1, "target_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (gid1 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ gid2 = H5Gcreate2(fid1, "target_group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (gid2 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ gid3 = H5Gcreate2(fid1, "target_group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (gid3 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ /*-----------------------------------------------------------------------
+ * Datasets
+ *------------------------------------------------------------------------*/
+ /* file1 */
+ status = write_dset(fid1,2,dims2,"target_dset1",H5T_NATIVE_INT,data1);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = write_dset(fid1,2,dims2,"target_dset2",H5T_NATIVE_INT,data2);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+ status = write_dset(gid1,2,dims2,"dset",H5T_NATIVE_INT,data1);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ /*-----------------------------------------------------------------------
+ * Soft Links (Linked)
+ *------------------------------------------------------------------------*/
+ /*---------
+ * file 1 */
+ status = H5Lcreate_soft("/target_dset1", fid1, "softlink1_to_dset1", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_soft("softlink1_to_dset1", fid1, "softlink1_to_slink1", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_soft("softlink1_to_slink1", fid1, "softlink1_to_slink2", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_soft("/target_dset2", fid1, "softlink2_to_dset2", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_soft("softlink2_to_dset2", fid1, "softlink2_to_slink1", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_soft("softlink2_to_slink1", fid1, "softlink2_to_slink2", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_soft("target_group1", fid1, "softlink3_to_group1", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_soft("softlink3_to_group1", fid1, "softlink3_to_slink1", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_soft("softlink3_to_slink1", fid1, "softlink3_to_slink2", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_soft("target_group2", fid1, "softlink4_to_group2", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_soft("softlink4_to_group2", fid1, "softlink4_to_slink1", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_soft("softlink4_to_slink1", fid1, "softlink4_to_slink2", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+out:
+ /*-----------------------------------------------------------------------
+ * Close
+ *-----------------------------------------------------------------------*/
+ if(fid1)
+ H5Fclose(fid1);
+ if(gid1)
+ H5Gclose(gid1);
+ if(gid2)
+ H5Gclose(gid2);
+ if(gid3)
+ H5Gclose(gid3);
+
+ return status;
+}
+
+/*-------------------------------------------------------------------------
+*
+* Purpose: Create test files to compare external links in various way
+*
+* Programmer: Jonathan Kim (Feb 17, 2010)
+*
+*-------------------------------------------------------------------------*/
+static int test_external_links(const char *fname1, const char *fname2)
+{
+ hid_t fid1=0;
+ hid_t fid2=0;
+ hid_t gid1=0;
+ hid_t gid2=0;
+ hsize_t dims2[2] = {2,4};
+ int data1[4][2] = {{0,1},{2,3},{1,2},{3,4}};
+ int data2[4][2] = {{0,0},{0,0},{0,0},{0,0}};
+ herr_t status = SUCCEED;
+
+ /*-----------------------------------------------------------------------
+ * Create file(s)
+ *------------------------------------------------------------------------*/
+ /* source file */
+ fid1 = H5Fcreate (fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ if (fid1 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ /* target file */
+ fid2 = H5Fcreate (fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ if (fid2 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ /*-----------------------------------------------------------------------
+ * Groups
+ *------------------------------------------------------------------------*/
+ /*--------------
+ * target file */
+ gid1 = H5Gcreate2(fid2, "target_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (gid1 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ gid2 = H5Gcreate2(fid2, "target_group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (gid2 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+ /*-----------------------------------------------------------------------
+ * Datasets
+ *------------------------------------------------------------------------*/
+ /*--------------
+ * target file */
+ status = write_dset(fid2,2,dims2,"target_dset1",H5T_NATIVE_INT,data1);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ status = write_dset(gid1,2,dims2,"x_dset",H5T_NATIVE_INT,data1);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ status = write_dset(gid2,2,dims2,"x_dset",H5T_NATIVE_INT,data2);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ /*-----------------------------------------------------------------------
+ * External Links
+ *------------------------------------------------------------------------*/
+ /*--------------*/
+ /* source file */
+ status = H5Lcreate_external(fname2, "/target_group/x_dset", fid1, "ext_link_dset1", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_external(fname2, "/target_group2/x_dset", fid1, "ext_link_dset2", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_external(fname2, "/target_group", fid1, "/ext_link_grp1", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_external(fname2, "/target_group2", fid1, "/ext_link_grp2", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_external(fname2, "no_obj", fid1, "ext_link_noexist1", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_external("no_file.h5", "no_obj", fid1, "ext_link_noexist2", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+out:
+ /*-----------------------------------------------------------------------
+ * Close
+ *-----------------------------------------------------------------------*/
+ if(fid1)
+ H5Fclose(fid1);
+ if(fid2)
+ H5Fclose(fid2);
+ if(gid1)
+ H5Gclose(gid1);
+ if(gid2)
+ H5Gclose(gid2);
+
+ return status;
+}
+
+/*-------------------------------------------------------------------------
+*
+* Purpose: Create test files to compare external links which point to
+* soft link in various way
+*
+* Programmer: Jonathan Kim (Feb 17, 2010)
+*
+*-------------------------------------------------------------------------*/
+static int test_ext2soft_links(const char *fname1, const char *fname2)
+{
+ hid_t fid1=0;
+ hid_t fid2=0;
+ hid_t gid2=0;
+ hsize_t dims2[2] = {2,4};
+ int data1[4][2] = {{0,1},{2,3},{1,2},{3,4}};
+ int data2[4][2] = {{0,0},{0,0},{0,0},{0,0}};
+ herr_t status = SUCCEED;
+
+ /*-----------------------------------------------------------------------
+ * Create file(s)
+ *------------------------------------------------------------------------*/
+ /* source file */
+ fid1 = H5Fcreate (fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ if (fid1 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ /* target file */
+ fid2 = H5Fcreate (fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ if (fid2 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ /*-----------------------------------------------------------------------
+ * Groups
+ *------------------------------------------------------------------------*/
+ /* target file */
+ gid2 = H5Gcreate2(fid2, "target_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (gid2 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ /*-----------------------------------------------------------------------
+ * Datasets
+ *------------------------------------------------------------------------*/
+ /*--------------
+ * target file */
+ status = write_dset(fid2,2,dims2,"dset1",H5T_NATIVE_INT,data2);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ status = write_dset(fid2,2,dims2,"dset2",H5T_NATIVE_INT,data1);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ /*-----------------------------------------------------------------------
+ * Soft Links (Linked)
+ *------------------------------------------------------------------------*/
+ /*---------------
+ * target file */
+ status = H5Lcreate_soft("/dset1", fid2, "softlink_to_dset1", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_soft("/dset2", fid2, "softlink_to_dset2", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ /*-----------------------------------------------------------------------
+ * External Links
+ *------------------------------------------------------------------------*/
+ /*---------------
+ * source file */
+ status = H5Lcreate_external(fname2, "/target_group", fid1, "ext_link", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_external(fname2, "/softlink_to_dset1", fid1, "ext_link_to_slink1", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_external(fname2, "/softlink_to_dset2", fid1, "ext_link_to_slink2", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+out:
+ /*-----------------------------------------------------------------------
+ * Close
+ *-----------------------------------------------------------------------*/
+ if(fid1)
+ H5Fclose(fid1);
+ if(fid2)
+ H5Fclose(fid2);
+ if(gid2)
+ H5Gclose(gid2);
+
+ return status;
+}
+
+/*-------------------------------------------------------------------------
+* Function: gen_dataset_idx
+*
+* Purpose: Create a file with either the new or old format
+* Create two datasets in the file:
+* one dataset: fixed dimension, chunked layout, w/o filters
+* one dataset: fixed dimension, chunked layout, w/ filters
+*
+*-------------------------------------------------------------------------
+*/
+static
+int gen_dataset_idx(const char *file, int format)
+{
+ hid_t fid; /* file id */
+ hid_t did, did2; /* dataset id */
+ hid_t sid; /* space id */
+ hid_t fapl; /* file access property id */
+ hid_t dcpl; /* dataset creation property id */
+ hsize_t dims[1] = {10}; /* dataset dimension */
+ hsize_t c_dims[1] = {2}; /* chunk dimension */
+ herr_t status; /* return status */
+ int buf[10]; /* data buffer */
+ int i; /* local index variable */
+
+ /* Get a copy of the file aaccess property */
+ fapl = H5Pcreate(H5P_FILE_ACCESS);
+
+ /* Set the "use the latest format" bounds for creating objects in the file */
+ if(format) {
+ status = H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST);
+ assert(status >= 0);
+ }
+
+ /* Create a file */
+ if((fid = H5Fcreate(file, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ return -1;
+
+ /* Create data */
+ for(i = 0; i < 10; i++)
+ buf[i] = i;
+
+ /* Set chunk */
+ dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ status = H5Pset_chunk(dcpl, 1, c_dims);
+ assert(status >= 0);
+
+ /* Create a 1D dataset */
+ sid = H5Screate_simple(1, dims, NULL);
+ did = H5Dcreate2(fid, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+
+ /* Write to the dataset */
+ status = H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
+ assert(status >= 0);
+
+#if defined (H5_HAVE_FILTER_DEFLATE)
+ /* set deflate data */
+ status = H5Pset_deflate(dcpl, 9);
+ assert(status >= 0);
+
+ /* Create and write the dataset */
+ did2 = H5Dcreate2(fid, "dset_filter", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ status = H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
+ assert(status >= 0);
+
+ /* Close the dataset */
+ status = H5Dclose(did2);
+ assert(status >= 0);
+
+#endif
+
+ /* closing: dataspace, dataset, file */
+ status = H5Sclose(sid);
+ assert(status >= 0);
+
+ status = H5Dclose(did);
+ assert(status >= 0);
+
+ status = H5Fclose(fid);
+ assert(status >= 0);
+
+ status = H5Pclose(dcpl);
+ assert(status >= 0);
+
+ status = H5Pclose(fapl);
+ assert(status >= 0);
+
+ return status;
+}
+
+/*-------------------------------------------------------------------------
+*
+* Purpose: Create test files to compare dangling links in various way
+*
+* Programmer: Jonathan Kim (Feb 17, 2010)
+*
+*-------------------------------------------------------------------------*/
+static int test_dangle_links(const char *fname1, const char *fname2)
+{
+ hid_t fid1=0;
+ hid_t fid2=0;
+ hsize_t dims2[2] = {2,4};
+ int data1[4][2] = {{0,1},{2,3},{1,2},{3,4}};
+ int data2[4][2] = {{0,0},{0,0},{0,0},{0,0}};
+ herr_t status = SUCCEED;
+
+ /*-----------------------------------------------------------------------
+ * Create file(s)
+ *------------------------------------------------------------------------*/
+ fid1 = H5Fcreate (fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ if (fid1 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ fid2 = H5Fcreate (fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ if (fid2 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ /*-----------------------------------------------------------------------
+ * Datasets
+ *------------------------------------------------------------------------*/
+ /* file1 */
+ status = write_dset(fid1,2,dims2,"dset1",H5T_NATIVE_INT,data1);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = write_dset(fid1,2,dims2,"dset2",H5T_NATIVE_INT,data2);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ /* file2 */
+ status = write_dset(fid2,2,dims2,"dset1",H5T_NATIVE_INT,data1);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ status = write_dset(fid2,2,dims2,"dset2",H5T_NATIVE_INT,data2);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ /*-----------------------------------------------------------------------
+ * Soft Links
+ *------------------------------------------------------------------------*/
+ /* file 1 */
+ status = H5Lcreate_soft("no_obj", fid1, "soft_link1", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_soft("/dset1", fid1, "soft_link2", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_soft("no_obj", fid1, "soft_link3", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ 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)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_soft("no_obj", fid2, "soft_link2", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_soft("/dset2", fid2, "soft_link3", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ 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
+ *------------------------------------------------------------------------*/
+ /* file1 */
+ status = H5Lcreate_external(fname2, "no_obj", fid1, "ext_link1", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_external(fname2, "/dset1", fid1, "ext_link2", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_external(fname2, "no_obj", fid1, "ext_link3", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_external("no_file.h5", "no_obj", fid1, "ext_link4", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ /* file2 */
+ status = H5Lcreate_external(fname1, "no_obj", fid2, "ext_link1", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_external(fname1, "no_obj", fid2, "ext_link2", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_external(fname1, "/dset2", fid2, "ext_link3", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_external("no_file.h5", "no_obj", fid2, "ext_link4", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+out:
+ /*-----------------------------------------------------------------------
+ * Close
+ *-----------------------------------------------------------------------*/
+ if(fid1)
+ H5Fclose(fid1);
+ if(fid2)
+ H5Fclose(fid2);
+
+ return status;
+}
+
+/*-------------------------------------------------------------------------
+*
+* Purpose: For testing comparing group member objects recursively
+*
+* Programmer: Jonathan Kim (Aug 19, 2010)
+*
+*-------------------------------------------------------------------------*/
+static int test_group_recurse(const char *fname1, const char *fname2)
+{
+ hid_t fid1=0;
+ hid_t fid2=0;
+ hid_t gid1_f1=0, gid2_f1=0, gid3_f1=0, gid10_f1=0;
+ hid_t gid1_f2=0, gid2_f2=0, gid3_f2=0, gid11_f2=0;
+ hsize_t dims2[2] = {2,4};
+ int data1[4][2] = {{0,1},{0,1},{1,0},{1,0}};
+ int data2[4][2] = {{0,2},{0,2},{2,0},{2,0}};
+ int data3[4][2] = {{0,3},{0,3},{3,0},{3,0}};
+ herr_t status = SUCCEED;
+
+ /*-----------------------------------------------------------------------
+ * Create file(s)
+ *------------------------------------------------------------------------*/
+ fid1 = H5Fcreate (fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ if (fid1 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ fid2 = H5Fcreate (fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ if (fid2 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ /*-----------------------------------------------------------------------
+ * Groups
+ *------------------------------------------------------------------------*/
+ /* file1 */
+ gid1_f1 = H5Gcreate2(fid1, "/grp1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (gid1_f1 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ gid2_f1 = H5Gcreate2(fid1, "/grp1/grp2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (gid2_f1 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ gid3_f1 = H5Gcreate2(fid1, "/grp1/grp2/grp3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (gid3_f1 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ gid10_f1 = H5Gcreate2(fid1, "/grp10", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (gid10_f1 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ /* file2 */
+ gid1_f2 = H5Gcreate2(fid2, "/grp1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (gid1_f2 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ gid2_f2 = H5Gcreate2(fid2, "/grp1/grp2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (gid2_f2 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ gid3_f2 = H5Gcreate2(fid2, "/grp1/grp2/grp3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (gid3_f2 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ gid11_f2 = H5Gcreate2(fid2, "/grp11", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (gid11_f2 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ /*-----------------------------------------------------------------------
+ * Datasets under root
+ *------------------------------------------------------------------------*/
+ /* file1 */
+ status = write_dset(fid1,2,dims2,"dset1",H5T_NATIVE_INT,data1);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = write_dset(fid1,2,dims2,"dset2",H5T_NATIVE_INT,data2);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = write_dset(fid1,2,dims2,"dset3",H5T_NATIVE_INT,data3);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ /* file2 */
+ status = write_dset(fid2,2,dims2,"dset1",H5T_NATIVE_INT,data1);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ status = write_dset(fid2,2,dims2,"dset2",H5T_NATIVE_INT,data2);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ status = write_dset(fid2,2,dims2,"dset3",H5T_NATIVE_INT,data3);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ /*-----------------------------------------------------------------------
+ * Datasets under group
+ *------------------------------------------------------------------------*/
+ /* file1 */
+ status = write_dset(gid1_f1,2,dims2,"dset1",H5T_NATIVE_INT,data1);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = write_dset(gid2_f1,2,dims2,"dset1",H5T_NATIVE_INT,data1);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+ status = write_dset(gid2_f1,2,dims2,"dset2",H5T_NATIVE_INT,data2);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = write_dset(gid3_f1,2,dims2,"dset1",H5T_NATIVE_INT,data1);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+ status = write_dset(gid3_f1,2,dims2,"dset2",H5T_NATIVE_INT,data2);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = write_dset(gid3_f1,2,dims2,"dset3",H5T_NATIVE_INT,data3);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = write_dset(gid10_f1,2,dims2,"dset4",H5T_NATIVE_INT,data1);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = write_dset(gid10_f1,2,dims2,"dset5",H5T_NATIVE_INT,data3);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ /* file2 */
+ status = write_dset(gid1_f2,2,dims2,"dset1",H5T_NATIVE_INT,data1);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ status = write_dset(gid2_f2,2,dims2,"dset1",H5T_NATIVE_INT,data1);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+ status = write_dset(gid2_f2,2,dims2,"dset2",H5T_NATIVE_INT,data2);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ status = write_dset(gid3_f2,2,dims2,"dset1",H5T_NATIVE_INT,data1);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+ status = write_dset(gid3_f2,2,dims2,"dset2",H5T_NATIVE_INT,data2);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ status = write_dset(gid3_f2,2,dims2,"dset3",H5T_NATIVE_INT,data3);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ status = write_dset(gid11_f2,2,dims2,"dset4",H5T_NATIVE_INT,data1);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ status = write_dset(gid11_f2,2,dims2,"dset5",H5T_NATIVE_INT,data2);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+
+ /*-----------------------------------------------------------------------
+ * Soft Links
+ *------------------------------------------------------------------------*/
+ /* file 1 */
+ status = H5Lcreate_soft("/grp1", fid1, "slink_grp1", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_soft("/grp1/grp2", fid1, "slink_grp2", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_soft("/grp1/grp2/grp3", fid1, "slink_grp3", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_soft("/grp10", fid1, "slink_grp10", 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("/grp1", fid2, "slink_grp1", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_soft("/grp1/grp2", fid2, "slink_grp2", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_soft("/grp1/grp2/grp3", fid2, "slink_grp3", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_soft("/grp11", fid2, "slink_grp11", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ /*-----------------------------------------------------------------------
+ * External Links
+ *------------------------------------------------------------------------*/
+ /* file1 */
+ status = H5Lcreate_external(fname2, "/grp1", fid1, "elink_grp1", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_external(fname2, "/grp1/grp2", fid1, "elink_grp2", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_external(fname2, "/grp1/grp2/grp3", fid1, "elink_grp3", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ /* file2 */
+ status = H5Lcreate_external(fname1, "/grp1", fid2, "elink_grp1", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_external(fname1, "/grp1/grp2", fid2, "elink_grp2", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Lcreate_external(fname1, "/grp1/grp2/grp3", fid2, "elink_grp3", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ /*------------------------------
+ * external circle route test
+ * file1/grp11 <-> file2/grp10 via elink_grp_circle link
+ */
+ /* file1 */
+ status = H5Lcreate_external(fname2, "/grp11", gid10_f1, "elink_grp_circle", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+ /* file2 */
+ status = H5Lcreate_external(fname1, "/grp10", gid11_f2, "elink_grp_circle", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+
+out:
+ /*-----------------------------------------------------------------------
+ * Close
+ *-----------------------------------------------------------------------*/
+ if(fid1)
+ H5Fclose(fid1);
+ if(fid2)
+ H5Fclose(fid2);
+ if(gid1_f1)
+ H5Gclose(gid1_f1);
+ if(gid2_f1)
+ H5Gclose(gid2_f1);
+ if(gid3_f1)
+ H5Gclose(gid3_f1);
+ if(gid1_f2)
+ H5Gclose(gid1_f2);
+ if(gid2_f2)
+ H5Gclose(gid2_f2);
+ if(gid3_f2)
+ H5Gclose(gid3_f2);
+
+ return status;
+}
+
+/*-------------------------------------------------------------------------
+*
+* Purpose:
+* For testing comparing group member objects recursively via multiple
+* linked external links
+*
+* Programmer: Jonathan Kim (Sep 16, 2010)
+*
+*-------------------------------------------------------------------------*/
+#define GRP_R_DSETNAME1 "dset1"
+#define GRP_R_DSETNAME2 "dset2"
+static int test_group_recurse2(void)
+{
+ hid_t fileid1 = -1;
+ hid_t grp1 = -1;
+ hid_t grp2 = -1;
+ hid_t grp3 = -1;
+ hid_t grp4 = -1;
+ hid_t dset1 = -1;
+ hid_t dset2 = -1;
+ hid_t datatype = -1;
+ hid_t dataspace = -1;
+ hid_t fileid2 = -1;
+ hid_t fileid3 = -1;
+ hid_t fileid4 = -1;
+ hsize_t dimsf[2]; /* dataset dimensions */
+ herr_t status=0;
+ int data1[4][2] = {{0,0},{1,1},{2,2},{3,3}};
+ int data2[4][2] = {{0,0},{0,1},{0,2},{3,3}};
+
+ /*-----------------------------------------------------------------------
+ * FILE 1
+ *------------------------------------------------------------------------*/
+ /*
+ * Create a new file using H5F_ACC_TRUNC access,
+ * default file creation properties, and default file
+ * access properties.
+ */
+ fileid1 = H5Fcreate(GRP_RECURSE1_EXT, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*-----------------------------------------------------------------------
+ * Groups
+ *------------------------------------------------------------------------*/
+ grp1 = H5Gcreate2(fileid1, "/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (grp1 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", GRP_RECURSE1_EXT);
+ status = FAIL;
+ goto out;
+ }
+
+ grp2 = H5Gcreate2(grp1, "g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (grp2 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", GRP_RECURSE1_EXT);
+ status = FAIL;
+ goto out;
+ }
+
+ grp3 = H5Gcreate2(grp2, "g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (grp3 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", GRP_RECURSE1_EXT);
+ status = FAIL;
+ goto out;
+ }
+
+ grp4 = H5Gcreate2(grp3, "g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (grp4 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", GRP_RECURSE1_EXT);
+ status = FAIL;
+ goto out;
+ }
+
+
+ /*-----------------------------------------------------------------------
+ * Datasets
+ *------------------------------------------------------------------------*/
+ /*
+ * Describe the size of the array and create the data space for fixed
+ * size dataset.
+ */
+ dimsf[0] = 4;
+ dimsf[1] = 2;
+ dataspace = H5Screate_simple(2, dimsf, NULL);
+
+ /*
+ * Define datatype for the data in the file.
+ * We will store little endian INT numbers.
+ */
+ datatype = H5Tcopy(H5T_NATIVE_INT);
+ status = H5Tset_order(datatype, H5T_ORDER_LE);
+
+ /*---------------
+ * dset1
+ */
+ /*
+ * Create a new dataset within the file using defined dataspace and
+ * datatype and default dataset creation properties.
+ */
+ dset1 = H5Dcreate2(fileid1, GRP_R_DSETNAME1, datatype, dataspace,
+ H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Write the data to the dataset using default transfer properties.
+ */
+ status = H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data1);
+ H5Dclose(dset1);
+
+ /*---------------
+ * dset1
+ */
+ /*
+ * Create a new dataset within the file using defined dataspace and
+ * datatype and default dataset creation properties.
+ */
+ dset1 = H5Dcreate2(grp3, GRP_R_DSETNAME1, datatype, dataspace,
+ H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Write the data to the dataset using default transfer properties.
+ */
+ status = H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data1);
+
+ /*---------------
+ * dset2
+ */
+ /*
+ * Create a new dataset within the fileid1 using defined dataspace and
+ * datatype and default dataset creation properties.
+ */
+ dset2 = H5Dcreate2(grp4, GRP_R_DSETNAME2, datatype, dataspace,
+ H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Write the data to the dataset using default transfer properties.
+ */
+ status = H5Dwrite(dset2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data2);
+
+ /*-----------------------------------------------------------------------
+ * Soft links
+ *------------------------------------------------------------------------*/
+ /*
+ * under '/' root
+ */
+ /* link to dset1 */
+ status = H5Lcreate_soft(GRP_R_DSETNAME1, fileid1, "soft_dset1", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", GRP_RECURSE1_EXT);
+ status = FAIL;
+ goto out;
+ }
+
+ H5Dclose(dset1);
+ H5Dclose(dset2);
+ H5Gclose(grp1);
+ H5Gclose(grp2);
+ H5Gclose(grp3);
+ H5Gclose(grp4);
+
+ /*-----------------------------------------------------------------------
+ * FILE 2-3
+ *------------------------------------------------------------------------*/
+
+ /* crate target file */
+ fileid4 = H5Fcreate(GRP_RECURSE2_EXT3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*-----------------------------------------------
+ * Groups
+ */
+ grp4 = H5Gcreate2(fileid4, "/g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (grp4 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", GRP_RECURSE2_EXT3);
+ status = FAIL;
+ goto out;
+ }
+
+ /*---------------
+ * dset2
+ */
+ /*
+ * Create a new dataset within the fileid1 using defined dataspace and
+ * datatype and default dataset creation properties.
+ */
+ dset2 = H5Dcreate2(grp4, GRP_R_DSETNAME2, datatype, dataspace,
+ H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Write the data to the dataset using default transfer properties.
+ */
+ status = H5Dwrite(dset2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data2);
+
+ H5Gclose(grp4);
+ H5Dclose(dset2);
+
+
+ /*-----------------------------------------------------------------------
+ * FILE 2-2
+ *------------------------------------------------------------------------*/
+
+ /* crate target file */
+ fileid3 = H5Fcreate(GRP_RECURSE2_EXT2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*-----------------------------------------------
+ * Groups
+ */
+ grp2 = H5Gcreate2(fileid3, "g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (grp2 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", GRP_RECURSE2_EXT2);
+ status = FAIL;
+ goto out;
+ }
+
+ grp3 = H5Gcreate2(grp2, "g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (grp3 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", GRP_RECURSE2_EXT2);
+ status = FAIL;
+ goto out;
+ }
+
+ /*---------------
+ * dset1
+ */
+ /*
+ * Create a new dataset within the fileid1 using defined dataspace and
+ * datatype and default dataset creation properties.
+ */
+ dset1 = H5Dcreate2(grp3, GRP_R_DSETNAME1, datatype, dataspace,
+ H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Write the data to the dataset using default transfer properties.
+ */
+ status = H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data1);
+
+ /*-----------------------------------------------
+ * extlink to $GRP_RECURSE2_EXT3/g4
+ */
+ status = H5Lcreate_external(GRP_RECURSE2_EXT3, "/g4", fileid3, "/g2/g3/g4", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", GRP_RECURSE2_EXT2);
+ status = FAIL;
+ goto out;
+ }
+
+ H5Dclose(dset1);
+ H5Gclose(grp2);
+ H5Gclose(grp3);
+
+ /*-----------------------------------------------------------------------
+ * FILE 2-1
+ *------------------------------------------------------------------------*/
+
+ /* crate target file */
+ fileid2 = H5Fcreate(GRP_RECURSE2_EXT1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*-----------------------------------------------
+ * Groups
+ */
+ grp1 = H5Gcreate2(fileid2, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (grp1 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", GRP_RECURSE1_EXT);
+ status = FAIL;
+ goto out;
+ }
+
+ /*---------------
+ * dset1
+ */
+ dset1 = H5Dcreate2(fileid2, GRP_R_DSETNAME1, datatype, dataspace,
+ H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Write the data to the dataset using default transfer properties.
+ */
+ status = H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data1);
+
+ /*-----------------------------------------------------------------------
+ * Soft links
+ *------------------------------------------------------------------------*/
+ /*
+ * under '/' root
+ */
+ /* link to dset1 */
+ status = H5Lcreate_soft(GRP_R_DSETNAME1, fileid2, "soft_dset1", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", GRP_RECURSE2_EXT1);
+ status = FAIL;
+ goto out;
+ }
+
+ /*-----------------------------------------------
+ * extlink to $GRP_RECURSE2_EXT2/g2
+ */
+ status = H5Lcreate_external(GRP_RECURSE2_EXT2, "/g2", fileid2, "/g1/g2", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", GRP_RECURSE2_EXT1);
+ status = FAIL;
+ goto out;
+ }
+
+ H5Gclose(grp1);
+ H5Dclose(dset1);
+
+out:
+ /*
+ * Close/release resources.
+ */
+ if(dataspace > 0)
+ H5Sclose(dataspace);
+ if(datatype > 0)
+ H5Tclose(datatype);
+ if(fileid1 > 0)
+ H5Fclose(fileid1);
+ if(fileid2 > 0)
+ H5Fclose(fileid2);
+ if(fileid3 > 0)
+ H5Fclose(fileid3);
+ if(fileid4 > 0)
+ H5Fclose(fileid4);
+
+ return status;
+}
+
+
+/*-------------------------------------------------------------------------
+*
+* Purpose: Create test files for excluding obj.
+* Same structure, same obj names
+* Test : exclude obj with different value to verify the rest are same
+*
+* Programmer: Jonathan Kim (July, 21, 2010)
+*
+*-------------------------------------------------------------------------*/
+static int test_exclude_obj1(const char *fname1, const char *fname2)
+{
+ hid_t fid1=0;
+ hid_t fid2=0;
+ hid_t gid1=0;
+ hid_t gid2=0;
+ hsize_t dims2[2] = {2,4};
+ int data1[4][2] = {{0,0},{0,0},{0,0},{0,0}};
+ int data2[4][2] = {{0,1},{2,3},{1,2},{3,4}};
+ herr_t status = SUCCEED;
+
+ /*-----------------------------------------------------------------------
+ * Create file(s)
+ *------------------------------------------------------------------------*/
+ fid1 = H5Fcreate (fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ if (fid1 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ fid2 = H5Fcreate (fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ if (fid2 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+
+ /*-----------------------------------------------------------------------
+ * Group
+ *------------------------------------------------------------------------*/
+ /* file1 */
+ gid1 = H5Gcreate2(fid1, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (gid1 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ /* file2 */
+ gid2 = H5Gcreate2(fid2, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ if (gid2 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+
+ /*-----------------------------------------------------------------------
+ * Datasets
+ *------------------------------------------------------------------------*/
+ /* file1 */
+ status = write_dset(fid1,2,dims2,"dset1",H5T_NATIVE_INT,data1);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = write_dset(gid1,2,dims2,"dset2",H5T_NATIVE_INT,data1);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = write_dset(gid1,2,dims2,"dset3",H5T_NATIVE_INT,data1);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+
+ /* file2 */
+ status = write_dset(fid2,2,dims2,"dset1",H5T_NATIVE_INT,data1);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ status = write_dset(gid2,2,dims2,"dset2",H5T_NATIVE_INT,data1);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ status = write_dset(gid2,2,dims2,"dset3",H5T_NATIVE_INT,data2);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+
+out:
+ /*-----------------------------------------------------------------------
+ * Close
+ *-----------------------------------------------------------------------*/
+ if(fid1)
+ H5Fclose(fid1);
+ if(fid2)
+ H5Fclose(fid2);
+ if(gid1)
+ H5Gclose(gid1);
+ if(gid2)
+ H5Gclose(gid2);
+
+ return status;
+}
+
+/*-------------------------------------------------------------------------
+*
+* Purpose: Create test files for excluding obj.
+* different structure and name
+* Test : exclude different objs to verify the rest are same
+*
+* Programmer: Jonathan Kim (July, 21, 2010)
+*
+*-------------------------------------------------------------------------*/
+static int test_exclude_obj2(const char *fname1, const char *fname2)
+{
+ hid_t fid1=0;
+ hid_t fid2=0;
+ hid_t gid1=0;
+ hid_t gid2=0;
+ hid_t gid3=0;
+ hsize_t dims2[2] = {2,4};
+ int data1[4][2] = {{0,0},{0,0},{0,0},{0,0}};
+ int data2[4][2] = {{0,1},{2,3},{1,2},{3,4}};
+ herr_t status = SUCCEED;
+
+ /*-----------------------------------------------------------------------
+ * Create file(s)
+ *------------------------------------------------------------------------*/
+ fid1 = H5Fcreate (fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ if (fid1 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ fid2 = H5Fcreate (fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ if (fid2 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+
+ /*-----------------------------------------------------------------------
+ * Group
+ *------------------------------------------------------------------------*/
+ /* file1 */
+ gid1 = H5Gcreate2(fid1, "group10", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (gid1 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ /* file2 */
+ gid2 = H5Gcreate2(fid2, "group10", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ if (gid2 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ /* subset name from group10 */
+ gid3 = H5Gcreate2(fid2, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ if (gid3 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+
+ /*-----------------------------------------------------------------------
+ * Datasets
+ *------------------------------------------------------------------------*/
+ /* file1 */
+ status = write_dset(fid1,2,dims2,"dset10",H5T_NATIVE_INT,data1);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = write_dset(fid1,2,dims2,"dset1",H5T_NATIVE_INT,data1);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = write_dset(gid1,2,dims2,"dset2",H5T_NATIVE_INT,data1);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+
+ /* file2 */
+ status = write_dset(fid2,2,dims2,"dset10",H5T_NATIVE_INT,data1);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ status = write_dset(gid2,2,dims2,"dset2",H5T_NATIVE_INT,data1);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+ status = write_dset(gid3,2,dims2,"dset3",H5T_NATIVE_INT,data2);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+
+out:
+ /*-----------------------------------------------------------------------
+ * Close
+ *-----------------------------------------------------------------------*/
+ if(fid1)
+ H5Fclose(fid1);
+ if(fid2)
+ H5Fclose(fid2);
+ if(gid1)
+ H5Gclose(gid1);
+ if(gid2)
+ H5Gclose(gid2);
+ if(gid3)
+ H5Gclose(gid3);
+
+ return status;
+}
+
+/*-------------------------------------------------------------------------
+*
+* Purpose: Create test files for excluding obj.
+* Only one file contains unique objs. Common objs are same.
+* Test : exclude unique objs to verify the rest are same
+* - HDFFV-7837
+*
+* Programmer: Jonathan Kim (Mar, 19, 2012)
+*
+*-------------------------------------------------------------------------*/
+static int test_exclude_obj3(const char *fname1, const char *fname2)
+{
+ hid_t fid1=0;
+ hid_t fid2=0;
+ hid_t gid1=0;
+ hsize_t dims2[2] = {2,4};
+ int data1[4][2] = {{0,0},{0,0},{0,0},{0,0}};
+ herr_t status = SUCCEED;
+
+ /*-----------------------------------------------------------------------
+ * Create file(s)
+ *------------------------------------------------------------------------*/
+ fid1 = H5Fcreate (fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ if (fid1 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ fid2 = H5Fcreate (fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ if (fid2 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+
+ /*-----------------------------------------------------------------------
+ * Group
+ *------------------------------------------------------------------------*/
+ /* file1 */
+ gid1 = H5Gcreate2(fid1, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (gid1 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ /*-----------------------------------------------------------------------
+ * Datasets
+ *------------------------------------------------------------------------*/
+ /* file1 */
+ status = write_dset(fid1,2,dims2,"dset1",H5T_NATIVE_INT,data1);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = write_dset(gid1,2,dims2,"dset",H5T_NATIVE_INT,data1);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ /* file2 */
+ status = write_dset(fid2,2,dims2,"dset1",H5T_NATIVE_INT,data1);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+out:
+ /*-----------------------------------------------------------------------
+ * Close
+ *-----------------------------------------------------------------------*/
+ if(fid1)
+ H5Fclose(fid1);
+ if(fid2)
+ H5Fclose(fid2);
+ if(gid1)
+ H5Gclose(gid1);
+
+ return status;
+}
+
+/*-------------------------------------------------------------------------
+*
+* Purpose: Create test files for multiple variable length string/string array
+* along with fixed length string/string array types in
+* a compound type dataset.
+*
+* Programmer: Jonathan Kim (Oct, 26, 2010)
+*
+*-------------------------------------------------------------------------*/
+#define STR_RANK 1
+#define VLEN_STR_DIM 1
+#define FIXLEN_STR_SIZE 21
+#define FIXLEN_STR_DIM 1
+#define VLEN_STR_ARRY_DIM 3
+#define FIXLEN_STR_ARRY_DIM 3
+#define FIXLEN_STR_ARRY_SIZE 30
+#define COMP_RANK 1
+#define COMP_DIM 1
+static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int is_file_new)
+{
+ int i;
+
+ hid_t fid1 = -1; /* file id */
+ hid_t gid = -1;
+
+ /* compound1 datatype */
+ typedef struct comp1_t
+ {
+ char *str_vlen; /* vlen string */
+ char *str_vlen_repeat; /* vlen string */
+ char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */
+ char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */
+ char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */
+ char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */
+ char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
+ char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
+ } comp1_t;
+
+ /* compound2 datatype */
+ typedef struct comp2_t
+ {
+ char *str_vlen; /* vlen string */
+ char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */
+ char *str_vlen_repeat; /* vlen string */
+ char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */
+ char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */
+ char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
+ char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */
+ char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
+ } comp2_t;
+
+ /* compound3 datatype */
+ typedef struct comp3_t
+ {
+ char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */
+ char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */
+ char *str_vlen; /* vlen string */
+ char *str_vlen_repeat; /* vlen string */
+ char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
+ char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
+ char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */
+ char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */
+ } comp3_t;
+
+ /* compound4 datatype */
+ typedef struct comp4_t
+ {
+ char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */
+ char *str_vlen; /* vlen string */
+ char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */
+ char *str_vlen_repeat; /* vlen string */
+ char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
+ char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */
+ char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
+ char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */
+ } comp4_t;
+
+ /* compound5 datatype */
+ typedef struct comp5_t
+ {
+ char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */
+ char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */
+ char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
+ char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
+ char *str_vlen; /* vlen string */
+ char *str_vlen_repeat; /* vlen string */
+ char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */
+ char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */
+ } comp5_t;
+
+ /* compound6 datatype */
+ typedef struct comp6_t
+ {
+ char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */
+ char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
+ char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */
+ char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
+ char *str_vlen; /* vlen string */
+ char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */
+ char *str_vlen_repeat; /* vlen string */
+ char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */
+ } comp6_t;
+
+ /* compound7 datatype */
+ typedef struct comp7_t
+ {
+ char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
+ char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
+ char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */
+ char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */
+ char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */
+ char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */
+ char *str_vlen; /* vlen string */
+ char *str_vlen_repeat; /* vlen string */
+ } comp7_t;
+
+ /* compound8 datatype */
+ typedef struct comp8_t
+ {
+ char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
+ char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */
+ char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
+ char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */
+ char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */
+ char *str_vlen; /* vlen string */
+ char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */
+ char *str_vlen_repeat; /* vlen string */
+ } comp8_t;
+
+ /* compound9 datatype */
+ typedef struct comp9_t
+ {
+ char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
+ char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
+ char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */
+ char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */
+ char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */
+ int int_data1;
+ hobj_ref_t objref1; /* reference */
+ char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */
+ hobj_ref_t objref2; /* reference */
+ char *str_vlen; /* vlen string */
+ int int_data2;
+ char *str_vlen_repeat; /* vlen string */
+ hobj_ref_t objref3; /* reference */
+ int int_data3;
+ } comp9_t;
+
+ /* vlen string */
+ hid_t sid_vlen_str=0; /* dataspace ID */
+ hid_t tid_vlen_str=0; /* datatype ID */
+ char vlen_str_buf[]= {
+ "Variable length string"
+ };
+ hsize_t dims_vlen_str[] = {VLEN_STR_DIM};
+
+ /* fixlen string */
+ hid_t sid_fixlen_str=0; /* dataspace ID */
+ hid_t tid_fixlen_str=0; /* datatype ID */
+ const char fixlen_str_buf[FIXLEN_STR_SIZE]= {
+ "Fixed length string"
+ };
+ hsize_t dims_fixlen_str[] = {FIXLEN_STR_DIM};
+
+ /* vlen string array */
+ hid_t sid_vlen_str_array=0; /* dataspace ID */
+ hid_t tid_vlen_str_array_pre=0; /* datatype ID */
+ hid_t tid_vlen_str_array=0; /* datatype ID */
+ char *vlen_str_array_buf[VLEN_STR_ARRY_DIM]= {
+ "1 - Variable length string Array",
+ "2 - Testing variable length string array in compound type",
+ "3 - Four score and seven\n years ago our forefathers brought forth on this continent a new nation,"
+ };
+ hsize_t dims_vlen_str_array[] = {VLEN_STR_ARRY_DIM};
+
+ /* fixlen string array */
+ hid_t sid_fixlen_str_array=0; /* dataspace ID */
+ hid_t tid_fixlen_str_array_pre=0; /* datatype ID */
+ hid_t tid_fixlen_str_array=0; /* datatype ID */
+ const char *fixlen_str_array_buf[FIXLEN_STR_ARRY_DIM]= {
+ "1 - Fixed length string Array",
+ "2 - Fixed length string Array",
+ "3 - Fixed length string Array"
+ };
+ hsize_t dims_fixlen_str_array[] = {FIXLEN_STR_ARRY_DIM};
+
+ /*------------------------------------------
+ * compound dataset
+ *------------------------------------------*/
+ hid_t sid_comp=0; /* dataspace ID */
+ hid_t tid1_comp=0; /* datatype ID */
+ hid_t tid2_comp=0; /* datatype ID */
+ hid_t tid3_comp=0; /* datatype ID */
+ hid_t tid4_comp=0; /* datatype ID */
+ hid_t tid5_comp=0; /* datatype ID */
+ hid_t tid6_comp=0; /* datatype ID */
+ hid_t tid7_comp=0; /* datatype ID */
+ hid_t tid8_comp=0; /* datatype ID */
+ hid_t tid9_comp=0; /* datatype ID */
+ hid_t did_comp=0; /* dataset ID */
+ hsize_t dims_comp[] = {COMP_DIM};
+ herr_t status = SUCCEED;
+
+ /* make compound strings data */
+ comp1_t comp1_buf;
+ comp2_t comp2_buf;
+ comp3_t comp3_buf;
+ comp4_t comp4_buf;
+ comp5_t comp5_buf;
+ comp6_t comp6_buf;
+ comp7_t comp7_buf;
+ comp8_t comp8_buf;
+ comp9_t comp9_buf;
+
+ /* copy vlen string data to compound buffers */
+ comp1_buf.str_vlen = comp1_buf.str_vlen_repeat = vlen_str_buf;
+ comp2_buf.str_vlen = comp2_buf.str_vlen_repeat = vlen_str_buf;
+ comp3_buf.str_vlen = comp3_buf.str_vlen_repeat = vlen_str_buf;
+ comp4_buf.str_vlen = comp4_buf.str_vlen_repeat = vlen_str_buf;
+ comp5_buf.str_vlen = comp5_buf.str_vlen_repeat = vlen_str_buf;
+ comp6_buf.str_vlen = comp6_buf.str_vlen_repeat = vlen_str_buf;
+ comp7_buf.str_vlen = comp7_buf.str_vlen_repeat = vlen_str_buf;
+ comp8_buf.str_vlen = comp8_buf.str_vlen_repeat = vlen_str_buf;
+ comp9_buf.str_vlen = comp9_buf.str_vlen_repeat = vlen_str_buf;
+
+ /* copy fixlen string data to compound buffers */
+ HDstrcpy(comp1_buf.str_fixlen, fixlen_str_buf);
+ HDstrcpy(comp1_buf.str_fixlen_repeat, fixlen_str_buf);
+
+ HDstrcpy(comp2_buf.str_fixlen, fixlen_str_buf);
+ HDstrcpy(comp2_buf.str_fixlen_repeat, fixlen_str_buf);
+
+ HDstrcpy(comp3_buf.str_fixlen, fixlen_str_buf);
+ HDstrcpy(comp3_buf.str_fixlen_repeat, fixlen_str_buf);
+
+ HDstrcpy(comp3_buf.str_fixlen, fixlen_str_buf);
+ HDstrcpy(comp3_buf.str_fixlen_repeat, fixlen_str_buf);
+
+ HDstrcpy(comp4_buf.str_fixlen, fixlen_str_buf);
+ HDstrcpy(comp4_buf.str_fixlen_repeat, fixlen_str_buf);
+
+ HDstrcpy(comp5_buf.str_fixlen, fixlen_str_buf);
+ HDstrcpy(comp5_buf.str_fixlen_repeat, fixlen_str_buf);
+
+ HDstrcpy(comp6_buf.str_fixlen, fixlen_str_buf);
+ HDstrcpy(comp6_buf.str_fixlen_repeat, fixlen_str_buf);
+
+ HDstrcpy(comp7_buf.str_fixlen, fixlen_str_buf);
+ HDstrcpy(comp7_buf.str_fixlen_repeat, fixlen_str_buf);
+
+ HDstrcpy(comp8_buf.str_fixlen, fixlen_str_buf);
+ HDstrcpy(comp8_buf.str_fixlen_repeat, fixlen_str_buf);
+
+ HDstrcpy(comp9_buf.str_fixlen, fixlen_str_buf);
+ HDstrcpy(comp9_buf.str_fixlen_repeat, fixlen_str_buf);
+
+ /* copy vlen string array data to compound buffers */
+ for (i=0; i < VLEN_STR_ARRY_DIM; i++)
+ {
+ comp1_buf.str_array_vlen[i] = comp1_buf.str_vlen_array_again[i] = vlen_str_array_buf[i];
+ comp2_buf.str_array_vlen[i] = comp2_buf.str_vlen_array_again[i] = vlen_str_array_buf[i];
+ comp3_buf.str_array_vlen[i] = comp3_buf.str_vlen_array_again[i] = vlen_str_array_buf[i];
+ comp4_buf.str_array_vlen[i] = comp4_buf.str_vlen_array_again[i] = vlen_str_array_buf[i];
+ comp5_buf.str_array_vlen[i] = comp5_buf.str_vlen_array_again[i] = vlen_str_array_buf[i];
+ comp6_buf.str_array_vlen[i] = comp6_buf.str_vlen_array_again[i] = vlen_str_array_buf[i];
+ comp7_buf.str_array_vlen[i] = comp7_buf.str_vlen_array_again[i] = vlen_str_array_buf[i];
+ comp8_buf.str_array_vlen[i] = comp8_buf.str_vlen_array_again[i] = vlen_str_array_buf[i];
+ comp9_buf.str_array_vlen[i] = comp9_buf.str_vlen_array_again[i] = vlen_str_array_buf[i];
+
+ }
+
+ /* copy fixlen string attay data to compound buffers */
+ for (i=0; i < FIXLEN_STR_ARRY_DIM; i++)
+ {
+ HDstrcpy(comp1_buf.str_array_fixlen[i], fixlen_str_array_buf[i]);
+ HDstrcpy(comp1_buf.str_fixlen_array_again[i], fixlen_str_array_buf[i]);
+
+ HDstrcpy(comp2_buf.str_array_fixlen[i], fixlen_str_array_buf[i]);
+ HDstrcpy(comp2_buf.str_fixlen_array_again[i], fixlen_str_array_buf[i]);
+
+ HDstrcpy(comp3_buf.str_array_fixlen[i], fixlen_str_array_buf[i]);
+ HDstrcpy(comp3_buf.str_fixlen_array_again[i], fixlen_str_array_buf[i]);
+
+ HDstrcpy(comp4_buf.str_array_fixlen[i], fixlen_str_array_buf[i]);
+ HDstrcpy(comp4_buf.str_fixlen_array_again[i], fixlen_str_array_buf[i]);
+
+ HDstrcpy(comp5_buf.str_array_fixlen[i], fixlen_str_array_buf[i]);
+ HDstrcpy(comp5_buf.str_fixlen_array_again[i], fixlen_str_array_buf[i]);
+
+ HDstrcpy(comp6_buf.str_array_fixlen[i], fixlen_str_array_buf[i]);
+ HDstrcpy(comp6_buf.str_fixlen_array_again[i], fixlen_str_array_buf[i]);
+
+ HDstrcpy(comp7_buf.str_array_fixlen[i], fixlen_str_array_buf[i]);
+ HDstrcpy(comp7_buf.str_fixlen_array_again[i], fixlen_str_array_buf[i]);
+
+ HDstrcpy(comp8_buf.str_array_fixlen[i], fixlen_str_array_buf[i]);
+ HDstrcpy(comp8_buf.str_fixlen_array_again[i], fixlen_str_array_buf[i]);
+
+ HDstrcpy(comp9_buf.str_array_fixlen[i], fixlen_str_array_buf[i]);
+ HDstrcpy(comp9_buf.str_fixlen_array_again[i], fixlen_str_array_buf[i]);
+ }
+
+ /* int data */
+ comp9_buf.int_data1 = 10;
+ comp9_buf.int_data2 = 20;
+ comp9_buf.int_data3 = 30;
+
+
+ /*-----------------------------------------------------------------------
+ * Create file(s)
+ *------------------------------------------------------------------------*/
+ if (is_file_new == 1)
+ {
+ fid1 = H5Fcreate (fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ if (fid1 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+ }
+ else
+ {
+ fid1 = H5Fopen (fname1, H5F_ACC_RDWR, H5P_DEFAULT);
+ if (fid1 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Fopen failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+ }
+
+ /*-----------------------------------------------------------------------
+ * Create group
+ *------------------------------------------------------------------------*/
+ gid = H5Gcreate2(fid1, grp_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (gid < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ /*-----------------------------------------------------------------------
+ * Variable length String1 - Create space and type
+ *------------------------------------------------------------------------*/
+ sid_vlen_str = H5Screate_simple(STR_RANK, dims_vlen_str, NULL);
+ if (sid_vlen_str < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Screate_simple failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ tid_vlen_str = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(tid_vlen_str, H5T_VARIABLE);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Tset_size failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ /*-----------------------------------------------------------------------
+ * Fixed length String2 - Create space and type
+ *------------------------------------------------------------------------*/
+ sid_fixlen_str = H5Screate_simple(STR_RANK, dims_fixlen_str, NULL);
+ if (sid_fixlen_str < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Screate_simple failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ tid_fixlen_str = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(tid_fixlen_str, FIXLEN_STR_SIZE);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Tset_size failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ /*-----------------------------------------------------------------------
+ * Fixed length String3 array - Create space and type
+ *------------------------------------------------------------------------*/
+ sid_vlen_str_array = H5Screate_simple(STR_RANK, dims_vlen_str_array, NULL);
+ if (sid_vlen_str_array < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Screate_simple failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ tid_vlen_str_array_pre = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(tid_vlen_str_array_pre, H5T_VARIABLE);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Tset_size failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ /* Create the array data type for the string array */
+ tid_vlen_str_array = H5Tarray_create2(tid_vlen_str_array_pre, COMP_RANK, dims_vlen_str_array);
+ if (tid_vlen_str_array < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Tarray_create2 failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ /*-----------------------------------------------------------------------
+ * Variable length String4 array - Create space and type
+ *------------------------------------------------------------------------*/
+ sid_fixlen_str_array = H5Screate_simple(STR_RANK, dims_fixlen_str_array, NULL);
+ if (sid_fixlen_str_array < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Screate_simple failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ tid_fixlen_str_array_pre = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(tid_fixlen_str_array_pre, FIXLEN_STR_ARRY_SIZE);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Tset_size failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+ /* Create the array data type for the string array */
+ tid_fixlen_str_array = H5Tarray_create2(tid_fixlen_str_array_pre, COMP_RANK, dims_fixlen_str_array);
+ if (tid_fixlen_str_array < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Tarray_create2 failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ /*-------------------------------------------------------------------------
+ * Compound dataset
+ *------------------------------------------------------------------------*/
+ sid_comp = H5Screate_simple(COMP_RANK, dims_comp, NULL);
+ if (sid_comp < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Screate_simple failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+ tid1_comp = H5Tcreate (H5T_COMPOUND, sizeof(comp1_t));
+ tid2_comp = H5Tcreate (H5T_COMPOUND, sizeof(comp2_t));
+ tid3_comp = H5Tcreate (H5T_COMPOUND, sizeof(comp3_t));
+ tid4_comp = H5Tcreate (H5T_COMPOUND, sizeof(comp4_t));
+ tid5_comp = H5Tcreate (H5T_COMPOUND, sizeof(comp5_t));
+ tid6_comp = H5Tcreate (H5T_COMPOUND, sizeof(comp6_t));
+ tid7_comp = H5Tcreate (H5T_COMPOUND, sizeof(comp7_t));
+ tid8_comp = H5Tcreate (H5T_COMPOUND, sizeof(comp8_t));
+ tid9_comp = H5Tcreate (H5T_COMPOUND, sizeof(comp9_t));
+
+ /* compound 1 */
+ H5Tinsert(tid1_comp, "VLEN_STR1", HOFFSET(comp1_t, str_vlen), tid_vlen_str );
+ H5Tinsert(tid1_comp, "VLEN_STR2", HOFFSET(comp1_t, str_vlen_repeat), tid_vlen_str );
+ H5Tinsert(tid1_comp, "FIXLEN_STR1", HOFFSET(comp1_t, str_fixlen), tid_fixlen_str );
+ H5Tinsert(tid1_comp, "FIXLEN_STR2", HOFFSET(comp1_t, str_fixlen_repeat), tid_fixlen_str );
+ H5Tinsert(tid1_comp, "VLEN_STR_ARRAY1", HOFFSET(comp1_t, str_array_vlen), tid_vlen_str_array);
+ H5Tinsert(tid1_comp, "VLEN_STR_ARRAY2", HOFFSET(comp1_t, str_vlen_array_again), tid_vlen_str_array);
+ H5Tinsert(tid1_comp, "FIXLEN_STR_ARRAY1", HOFFSET(comp1_t, str_array_fixlen), tid_fixlen_str_array);
+ H5Tinsert(tid1_comp, "FIXLEN_STR_ARRAY2", HOFFSET(comp1_t, str_fixlen_array_again), tid_fixlen_str_array);
+
+ /* compound 2 */
+ H5Tinsert(tid2_comp, "VLEN_STR1", HOFFSET(comp2_t, str_vlen), tid_vlen_str );
+ H5Tinsert(tid2_comp, "VLEN_STR2", HOFFSET(comp2_t, str_vlen_repeat), tid_vlen_str );
+ H5Tinsert(tid2_comp, "FIXLEN_STR1", HOFFSET(comp2_t, str_fixlen), tid_fixlen_str );
+ H5Tinsert(tid2_comp, "FIXLEN_STR2", HOFFSET(comp2_t, str_fixlen_repeat), tid_fixlen_str );
+ H5Tinsert(tid2_comp, "VLEN_STR_ARRAY1", HOFFSET(comp2_t, str_array_vlen), tid_vlen_str_array);
+ H5Tinsert(tid2_comp, "VLEN_STR_ARRAY2", HOFFSET(comp2_t, str_vlen_array_again), tid_vlen_str_array);
+ H5Tinsert(tid2_comp, "FIXLEN_STR_ARRAY1", HOFFSET(comp2_t, str_array_fixlen), tid_fixlen_str_array);
+ H5Tinsert(tid2_comp, "FIXLEN_STR_ARRAY2", HOFFSET(comp2_t, str_fixlen_array_again), tid_fixlen_str_array);
+
+ /* compound 3 */
+ H5Tinsert(tid3_comp, "VLEN_STR1", HOFFSET(comp3_t, str_vlen), tid_vlen_str );
+ H5Tinsert(tid3_comp, "VLEN_STR2", HOFFSET(comp3_t, str_vlen_repeat), tid_vlen_str );
+ H5Tinsert(tid3_comp, "FIXLEN_STR1", HOFFSET(comp3_t, str_fixlen), tid_fixlen_str );
+ H5Tinsert(tid3_comp, "FIXLEN_STR2", HOFFSET(comp3_t, str_fixlen_repeat), tid_fixlen_str );
+ H5Tinsert(tid3_comp, "VLEN_STR_ARRAY1", HOFFSET(comp3_t, str_array_vlen), tid_vlen_str_array);
+ H5Tinsert(tid3_comp, "VLEN_STR_ARRAY2", HOFFSET(comp3_t, str_vlen_array_again), tid_vlen_str_array);
+ H5Tinsert(tid3_comp, "FIXLEN_STR_ARRAY1", HOFFSET(comp3_t, str_array_fixlen), tid_fixlen_str_array);
+ H5Tinsert(tid3_comp, "FIXLEN_STR_ARRAY2", HOFFSET(comp3_t, str_fixlen_array_again), tid_fixlen_str_array);
+
+ /* compound 4 */
+ H5Tinsert(tid4_comp, "VLEN_STR1", HOFFSET(comp4_t, str_vlen), tid_vlen_str );
+ H5Tinsert(tid4_comp, "VLEN_STR2", HOFFSET(comp4_t, str_vlen_repeat), tid_vlen_str );
+ H5Tinsert(tid4_comp, "FIXLEN_STR1", HOFFSET(comp4_t, str_fixlen), tid_fixlen_str );
+ H5Tinsert(tid4_comp, "FIXLEN_STR2", HOFFSET(comp4_t, str_fixlen_repeat), tid_fixlen_str );
+ H5Tinsert(tid4_comp, "VLEN_STR_ARRAY1", HOFFSET(comp4_t, str_array_vlen), tid_vlen_str_array);
+ H5Tinsert(tid4_comp, "VLEN_STR_ARRAY2", HOFFSET(comp4_t, str_vlen_array_again), tid_vlen_str_array);
+ H5Tinsert(tid4_comp, "FIXLEN_STR_ARRAY1", HOFFSET(comp4_t, str_array_fixlen), tid_fixlen_str_array);
+ H5Tinsert(tid4_comp, "FIXLEN_STR_ARRAY2", HOFFSET(comp4_t, str_fixlen_array_again), tid_fixlen_str_array);
+
+ /* compound 5 */
+ H5Tinsert(tid5_comp, "VLEN_STR1", HOFFSET(comp5_t, str_vlen), tid_vlen_str );
+ H5Tinsert(tid5_comp, "VLEN_STR2", HOFFSET(comp5_t, str_vlen_repeat), tid_vlen_str );
+ H5Tinsert(tid5_comp, "FIXLEN_STR1", HOFFSET(comp5_t, str_fixlen), tid_fixlen_str );
+ H5Tinsert(tid5_comp, "FIXLEN_STR2", HOFFSET(comp5_t, str_fixlen_repeat), tid_fixlen_str );
+ H5Tinsert(tid5_comp, "VLEN_STR_ARRAY1", HOFFSET(comp5_t, str_array_vlen), tid_vlen_str_array);
+ H5Tinsert(tid5_comp, "VLEN_STR_ARRAY2", HOFFSET(comp5_t, str_vlen_array_again), tid_vlen_str_array);
+ H5Tinsert(tid5_comp, "FIXLEN_STR_ARRAY1", HOFFSET(comp5_t, str_array_fixlen), tid_fixlen_str_array);
+ H5Tinsert(tid5_comp, "FIXLEN_STR_ARRAY2", HOFFSET(comp5_t, str_fixlen_array_again), tid_fixlen_str_array);
+
+ /* compound 6 */
+ H5Tinsert(tid6_comp, "VLEN_STR1", HOFFSET(comp6_t, str_vlen), tid_vlen_str );
+ H5Tinsert(tid6_comp, "VLEN_STR2", HOFFSET(comp6_t, str_vlen_repeat), tid_vlen_str );
+ H5Tinsert(tid6_comp, "FIXLEN_STR1", HOFFSET(comp6_t, str_fixlen), tid_fixlen_str );
+ H5Tinsert(tid6_comp, "FIXLEN_STR2", HOFFSET(comp6_t, str_fixlen_repeat), tid_fixlen_str );
+ H5Tinsert(tid6_comp, "VLEN_STR_ARRAY1", HOFFSET(comp6_t, str_array_vlen), tid_vlen_str_array);
+ H5Tinsert(tid6_comp, "VLEN_STR_ARRAY2", HOFFSET(comp6_t, str_vlen_array_again), tid_vlen_str_array);
+ H5Tinsert(tid6_comp, "FIXLEN_STR_ARRAY1", HOFFSET(comp6_t, str_array_fixlen), tid_fixlen_str_array);
+ H5Tinsert(tid6_comp, "FIXLEN_STR_ARRAY2", HOFFSET(comp6_t, str_fixlen_array_again), tid_fixlen_str_array);
+
+ /* compound 7 */
+ H5Tinsert(tid7_comp, "VLEN_STR1", HOFFSET(comp7_t, str_vlen), tid_vlen_str );
+ H5Tinsert(tid7_comp, "VLEN_STR2", HOFFSET(comp7_t, str_vlen_repeat), tid_vlen_str );
+ H5Tinsert(tid7_comp, "FIXLEN_STR1", HOFFSET(comp7_t, str_fixlen), tid_fixlen_str );
+ H5Tinsert(tid7_comp, "FIXLEN_STR2", HOFFSET(comp7_t, str_fixlen_repeat), tid_fixlen_str );
+ H5Tinsert(tid7_comp, "VLEN_STR_ARRAY1", HOFFSET(comp7_t, str_array_vlen), tid_vlen_str_array);
+ H5Tinsert(tid7_comp, "VLEN_STR_ARRAY2", HOFFSET(comp7_t, str_vlen_array_again), tid_vlen_str_array);
+ H5Tinsert(tid7_comp, "FIXLEN_STR_ARRAY1", HOFFSET(comp7_t, str_array_fixlen), tid_fixlen_str_array);
+ H5Tinsert(tid7_comp, "FIXLEN_STR_ARRAY2", HOFFSET(comp7_t, str_fixlen_array_again), tid_fixlen_str_array);
+
+ /* compound 8 */
+ H5Tinsert(tid8_comp, "VLEN_STR1", HOFFSET(comp8_t, str_vlen), tid_vlen_str );
+ H5Tinsert(tid8_comp, "VLEN_STR2", HOFFSET(comp8_t, str_vlen_repeat), tid_vlen_str );
+ H5Tinsert(tid8_comp, "FIXLEN_STR1", HOFFSET(comp8_t, str_fixlen), tid_fixlen_str );
+ H5Tinsert(tid8_comp, "FIXLEN_STR2", HOFFSET(comp8_t, str_fixlen_repeat), tid_fixlen_str );
+ H5Tinsert(tid8_comp, "VLEN_STR_ARRAY1", HOFFSET(comp8_t, str_array_vlen), tid_vlen_str_array);
+ H5Tinsert(tid8_comp, "VLEN_STR_ARRAY2", HOFFSET(comp8_t, str_vlen_array_again), tid_vlen_str_array);
+ H5Tinsert(tid8_comp, "FIXLEN_STR_ARRAY1", HOFFSET(comp8_t, str_array_fixlen), tid_fixlen_str_array);
+ H5Tinsert(tid8_comp, "FIXLEN_STR_ARRAY2", HOFFSET(comp8_t, str_fixlen_array_again), tid_fixlen_str_array);
+
+ /* compound 9 */
+ H5Tinsert(tid9_comp, "VLEN_STR1", HOFFSET(comp9_t, str_vlen), tid_vlen_str );
+ H5Tinsert(tid9_comp, "VLEN_STR2", HOFFSET(comp9_t, str_vlen_repeat), tid_vlen_str );
+ H5Tinsert(tid9_comp, "FIXLEN_STR1", HOFFSET(comp9_t, str_fixlen), tid_fixlen_str );
+ H5Tinsert(tid9_comp, "FIXLEN_STR2", HOFFSET(comp9_t, str_fixlen_repeat), tid_fixlen_str );
+ H5Tinsert(tid9_comp, "VLEN_STR_ARRAY1", HOFFSET(comp9_t, str_array_vlen), tid_vlen_str_array);
+ H5Tinsert(tid9_comp, "VLEN_STR_ARRAY2", HOFFSET(comp9_t, str_vlen_array_again), tid_vlen_str_array);
+ H5Tinsert(tid9_comp, "FIXLEN_STR_ARRAY1", HOFFSET(comp9_t, str_array_fixlen), tid_fixlen_str_array);
+ H5Tinsert(tid9_comp, "FIXLEN_STR_ARRAY2", HOFFSET(comp9_t, str_fixlen_array_again), tid_fixlen_str_array);
+ H5Tinsert(tid9_comp, "INT_DATA1", HOFFSET(comp9_t, int_data1), H5T_STD_I32LE);
+ H5Tinsert(tid9_comp, "INT_DATA2", HOFFSET(comp9_t, int_data2), H5T_STD_I32BE);
+ H5Tinsert(tid9_comp, "INT_DATA3", HOFFSET(comp9_t, int_data3), H5T_STD_I32LE);
+ H5Tinsert(tid9_comp, "OBJREF1", HOFFSET(comp9_t, objref1), H5T_STD_REF_OBJ);
+ H5Tinsert(tid9_comp, "OBJREF2", HOFFSET(comp9_t, objref2), H5T_STD_REF_OBJ);
+ H5Tinsert(tid9_comp, "OBJREF3", HOFFSET(comp9_t, objref3), H5T_STD_REF_OBJ);
+
+
+ /* Write data to compound 1 dataset buffer */
+ did_comp = H5Dcreate2(gid, "Compound_dset1", tid1_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Dwrite(did_comp, tid1_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp1_buf);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+ H5Dclose(did_comp);
+
+ /* Write data to compound 2 dataset buffer */
+ did_comp = H5Dcreate2(gid, "Compound_dset2", tid2_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Dwrite(did_comp, tid2_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp2_buf);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+ H5Dclose(did_comp);
+
+ /* Write data to compound 3 dataset buffer */
+ did_comp = H5Dcreate2(gid, "Compound_dset3", tid3_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Dwrite(did_comp, tid3_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp3_buf);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+ H5Dclose(did_comp);
+
+ /* Write data to compound 4 dataset buffer */
+ did_comp = H5Dcreate2(gid, "Compound_dset4", tid4_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Dwrite(did_comp, tid4_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp4_buf);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+ H5Dclose(did_comp);
+
+ /* Write data to compound 5 dataset buffer */
+ did_comp = H5Dcreate2(gid, "Compound_dset5", tid5_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Dwrite(did_comp, tid5_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp5_buf);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+ H5Dclose(did_comp);
+
+ /* Write data to compound 6 dataset buffer */
+ did_comp = H5Dcreate2(gid, "Compound_dset6", tid6_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Dwrite(did_comp, tid6_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp6_buf);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+ H5Dclose(did_comp);
+
+ /* Write data to compound 7 dataset buffer */
+ did_comp = H5Dcreate2(gid, "Compound_dset7", tid7_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Dwrite(did_comp, tid7_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp7_buf);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+ H5Dclose(did_comp);
+
+ /* Write data to compound 8 dataset buffer */
+ did_comp = H5Dcreate2(gid, "Compound_dset8", tid8_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Dwrite(did_comp, tid8_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp8_buf);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+ H5Dclose(did_comp);
+
+ /* Write data to compound 9 dataset buffer */
+ did_comp = H5Dcreate2(gid, "Compound_dset9", tid9_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* obj references */
+ status=H5Rcreate(&(comp9_buf.objref1),gid,"Compound_dset2",H5R_OBJECT,(hid_t)-1);
+ status=H5Rcreate(&(comp9_buf.objref2),gid,"Compound_dset3",H5R_OBJECT,(hid_t)-1);
+ status=H5Rcreate(&(comp9_buf.objref3),gid,"Compound_dset4",H5R_OBJECT,(hid_t)-1);
+
+ status = H5Dwrite(did_comp, tid9_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp9_buf);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+
+ H5Dclose(did_comp);
+
+ did_comp=0;
+out:
+ /*-----------------------------------------------------------------------
+ * Close
+ *-----------------------------------------------------------------------*/
+ if(fid1 > 0)
+ H5Fclose(fid1);
+ if(gid > 0)
+ H5Gclose(gid);
+ /* vlen string */
+ if(tid_vlen_str > 0)
+ H5Tclose(tid_vlen_str);
+ if(sid_vlen_str > 0)
+ H5Sclose(sid_vlen_str);
+ /* fixed len string */
+ if(tid_fixlen_str > 0)
+ H5Tclose(tid_fixlen_str);
+ if(sid_fixlen_str > 0)
+ H5Sclose(sid_fixlen_str);
+ /* vlen string array */
+ if(tid_vlen_str_array_pre > 0)
+ H5Tclose(tid_vlen_str_array_pre);
+ if(tid_vlen_str_array > 0)
+ H5Tclose(tid_vlen_str_array);
+ if(sid_vlen_str_array > 0)
+ H5Sclose(sid_vlen_str_array);
+ /* fixed len string array */
+ if(tid_fixlen_str_array_pre > 0)
+ H5Tclose(tid_fixlen_str_array_pre);
+ if(tid_fixlen_str_array > 0)
+ H5Tclose(tid_fixlen_str_array);
+ if(sid_fixlen_str_array > 0)
+ H5Sclose(sid_fixlen_str_array);
+ /* compound */
+ if(tid1_comp > 0)
+ H5Tclose(tid1_comp);
+ if(tid2_comp > 0)
+ H5Tclose(tid2_comp);
+ if(tid3_comp > 0)
+ H5Tclose(tid3_comp);
+ if(tid4_comp > 0)
+ H5Tclose(tid4_comp);
+ if(tid5_comp > 0)
+ H5Tclose(tid5_comp);
+ if(tid6_comp > 0)
+ H5Tclose(tid6_comp);
+ if(tid7_comp > 0)
+ H5Tclose(tid7_comp);
+ if(tid8_comp > 0)
+ H5Tclose(tid8_comp);
+ if(tid9_comp > 0)
+ H5Tclose(tid9_comp);
+ if(did_comp > 0)
+ H5Dclose(did_comp);
+ if(sid_comp > 0)
+ H5Sclose(sid_comp);
+
+ return status;
+} /* end test_comp_vlen_strings() */
+
+
+/*-------------------------------------------------------------------------
+*
+* Purpose: Test diffs of enum values which may include invalid values.
+*
+* Programmer: Dana Robinson
+*
+*-------------------------------------------------------------------------*/
+
+static int
+test_enums(const char *fname)
+{
+ hid_t fid = -1;
+
+ hid_t tid = -1;
+ int enum_val = -1;
+
+ /* The data in the two arrays cover the following cases:
+ *
+ * V = valid enum value, I = invalid enum value
+ *
+ * 0: I-I (same value)
+ * 1: V-I
+ * 2: I-V
+ * 3: V-V (same value)
+ * 4: I-I (different values) SKIPPED FOR NOW
+ * 5: V-V (different values)
+ */
+ /* *** NOTE ***
+ *
+ * There is a bug in H5Dread() where invalid enum values are always
+ * returned as -1 so two different invalid enum values cannot be
+ * properly compared. Test 4 has been adjusted to pass here
+ * while we fix the issue.
+ */
+ int data1[6] = {9, 0, 9, 0, 9, 0};
+ /*int data1[6] = {9, 0, 9, 0, 8, 0}; */
+ int data2[6] = {9, 9, 0, 0, 9, 1};
+
+ hsize_t dims = 6;
+
+ herr_t status = SUCCEED;
+
+ /*-----------------------------------------------------------------------
+ * Create the file
+ *---------------------------------------------------------------------*/
+
+ fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*-----------------------------------------------------------------------
+ * Create enum types
+ *---------------------------------------------------------------------*/
+
+ tid = H5Tenum_create(H5T_NATIVE_INT);
+ enum_val = 0;
+ status = H5Tenum_insert(tid, "YIN", &enum_val);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Tenum_insert failed.\n", fname);
+ status = FAIL;
+ goto out;
+ }
+ enum_val = 1;
+ status = H5Tenum_insert(tid, "YANG", &enum_val);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Tenum_insert failed.\n", fname);
+ status = FAIL;
+ goto out;
+ }
+
+ /*-----------------------------------------------------------------------
+ * Create datasets containing enum data.
+ *---------------------------------------------------------------------*/
+
+ status = write_dset(fid, 1, &dims, "dset1", tid, data1);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed.\n", fname);
+ status = FAIL;
+ goto out;
+ }
+ status = write_dset(fid, 1, &dims, "dset2", tid, data2);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed.\n", fname);
+ status = FAIL;
+ goto out;
+ }
+
+out:
+ /*-----------------------------------------------------------------------
+ * Close
+ *---------------------------------------------------------------------*/
+ if(fid)
+ H5Fclose(fid);
+ if(tid)
+ H5Tclose(tid);
+
+ return status;
+}
+
+/*-------------------------------------------------------------------------
+*
+* Purpose:
+* Create test files with dataset and attribute with container types
+* (array, vlen) with multiple nested compound types.
+*
+* Function: test_comps_array()
+* - type: compound->array->compound
+*
+* Function: test_comps_vlen()
+* - type: compound->vlen->compound
+*
+* Function: test_comps_array_vlen()
+* - type: compound->array->compound->vlen->compound
+*
+* Function: test_comps_vlen_arry()
+* - type: compound->vlen->compound->array->compound
+*
+* Programmer: Jonathan Kim (Sep, 1, 2011)
+*
+*-------------------------------------------------------------------------*/
+#define SDIM_DSET 2
+#define SDIM_CMPD_ARRAY 2
+
+static void test_comps_array (const char *fname, const char *dset, const char *attr,int diff, int is_file_new)
+{
+ /* sub compound 2 */
+ typedef struct {
+ int i2;
+ float f2;
+ } cmpd2_t;
+
+ /* top compound 1 */
+ typedef struct {
+ int i1;
+ cmpd2_t cmpd2[SDIM_CMPD_ARRAY];
+ } cmpd1_t;
+
+ cmpd1_t wdata[SDIM_DSET]; /* dataset with compound1 */
+
+ hid_t fid; /* HDF5 File IDs */
+ hid_t did_dset; /* Dataset ID */
+ hid_t sid_dset; /* Dataset space ID */
+ hid_t tid_cmpd1; /* Compound1 type ID */
+ hid_t tid_arry1; /* Array type ID in compound1 */
+ hid_t tid_cmpd2; /* Compound2 type ID */
+ hid_t tid_attr;
+ hsize_t sdims_dset[] = {SDIM_DSET};
+ hsize_t sdims_cmpd_arry[] = {SDIM_CMPD_ARRAY};
+ int i,j;
+ herr_t ret; /* Generic return value */
+
+ /* Initialize array data to write */
+ for(i=0; i < SDIM_DSET; i++)
+ {
+ wdata[i].i1 = i;
+ for(j=0; j < SDIM_CMPD_ARRAY; j++)
+ {
+ wdata[i].cmpd2[j].i2 = i * 10 + diff;
+ wdata[i].cmpd2[j].f2 = (float)i * 10.5F + (float)diff;
+ } /* end for */
+ }
+
+ /*-----------------------------------------------------------------------
+ * Create file(s)
+ *------------------------------------------------------------------------*/
+ if (is_file_new == 1)
+ fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ else
+ fid = H5Fopen (fname, H5F_ACC_RDWR, H5P_DEFAULT);
+
+
+ /* -------------------------------
+ * Create a sub compound2 datatype */
+ tid_cmpd2 = H5Tcreate(H5T_COMPOUND, sizeof(cmpd2_t));
+
+ /* Insert integer field */
+ ret = H5Tinsert(tid_cmpd2, "int2", HOFFSET(cmpd2_t, i2), H5T_NATIVE_INT);
+ assert(ret >= 0);
+
+ /* Insert float field */
+ ret = H5Tinsert(tid_cmpd2, "float2", HOFFSET(cmpd2_t, f2), H5T_NATIVE_FLOAT);
+ assert(ret >= 0);
+
+ /*-----------------------------------
+ * Create a top compound1.
+ */
+ tid_cmpd1 = H5Tcreate (H5T_COMPOUND, sizeof(cmpd1_t));
+
+ ret = H5Tinsert(tid_cmpd1, "int1", HOFFSET(cmpd1_t, i1), H5T_NATIVE_INT);
+ assert(ret >= 0);
+
+ /* Create an array datatype */
+ tid_arry1 = H5Tarray_create2(tid_cmpd2, 1, sdims_cmpd_arry);
+ /* insert the array */
+ ret = H5Tinsert(tid_cmpd1, "array_cmpd1", HOFFSET(cmpd1_t, cmpd2), tid_arry1);
+ assert(ret >= 0);
+
+
+ /* -------------------
+ * Create a dataset
+ */
+ /* Create dataspace for datasets */
+ sid_dset = H5Screate_simple(1, sdims_dset, NULL);
+
+ did_dset = H5Dcreate2(fid, dset, tid_cmpd1, sid_dset, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Write dataset to disk */
+ ret = H5Dwrite(did_dset, tid_cmpd1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
+ assert(ret >= 0);
+
+ /*-----------------------------------
+ * Create an attribute in root group
+ */
+ tid_attr = H5Acreate2(fid, attr, tid_cmpd1, sid_dset, H5P_DEFAULT, H5P_DEFAULT);
+ assert(tid_attr > 0);
+ ret = H5Awrite(tid_attr, tid_cmpd1, wdata);
+ assert(ret >= 0);
+
+ /* ----------------
+ * Close Dataset */
+ ret = H5Aclose(tid_attr);
+ assert(ret >= 0);
+ ret = H5Tclose(tid_arry1);
+ assert(ret >= 0);
+ ret = H5Dclose(did_dset);
+ assert(ret >= 0);
+ ret = H5Tclose(tid_cmpd1);
+ assert(ret >= 0);
+ ret = H5Tclose(tid_cmpd2);
+ assert(ret >= 0);
+ ret = H5Sclose(sid_dset);
+ assert(ret >= 0);
+ ret = H5Fclose(fid);
+ assert(ret >= 0);
+}
+
+
+
+static void test_comps_vlen (const char * fname, const char *dset, const char *attr, int diff, int is_file_new)
+{
+ /* sub compound 2 */
+ typedef struct {
+ int i2;
+ float f2;
+ } cmpd2_t;
+
+ /* top compound 1 */
+ typedef struct {
+ int i1;
+ hvl_t vl; /* VL information for compound2 */
+ } cmpd1_t;
+
+ cmpd1_t wdata[SDIM_DSET]; /* Dataset for compound1 */
+
+ hid_t fid; /* HDF5 File ID */
+ hid_t did_dset; /* dataset ID */
+ hid_t sid_dset; /* dataset space ID */
+ hid_t tid_attr;
+ hid_t tid_cmpd2; /* compound2 type ID */
+ hid_t tid_cmpd1; /* compound1 type ID */
+ hid_t tid_cmpd1_vlen;
+ hsize_t sdims_dset[] = {SDIM_DSET};
+
+ unsigned i,j; /* counting variables */
+ herr_t ret; /* Generic return value */
+
+ /* Allocate and initialize VL data to write */
+ for(i = 0; i < SDIM_DSET; i++) {
+ wdata[i].i1 = (int)i;
+ wdata[i].vl.p = HDmalloc((i + 1) * sizeof(cmpd2_t));
+ wdata[i].vl.len = i + 1;
+ for(j = 0; j < (i + 1); j++) {
+ ((cmpd2_t *)wdata[i].vl.p)[j].i2 = (int)(i * 10 + (unsigned)diff);
+ ((cmpd2_t *)wdata[i].vl.p)[j].f2 = (float)i * 10.5F + (float)diff;
+ } /* end for */
+ } /* end for */
+
+ /*-----------------------------------------------------------------------
+ * Create file(s)
+ *------------------------------------------------------------------------*/
+ if (is_file_new == 1)
+ fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ else
+ fid = H5Fopen (fname, H5F_ACC_RDWR, H5P_DEFAULT);
+
+ /* -----------------------------
+ * Create sub compound2 type */
+ tid_cmpd2 = H5Tcreate(H5T_COMPOUND, sizeof(cmpd2_t));
+
+ /* Insert fields */
+ ret = H5Tinsert(tid_cmpd2, "int2", HOFFSET(cmpd2_t, i2), H5T_NATIVE_INT);
+ assert(ret >= 0);
+ ret = H5Tinsert(tid_cmpd2, "float2", HOFFSET(cmpd2_t, f2), H5T_NATIVE_FLOAT);
+ assert(ret >= 0);
+
+ /* ---------------------------
+ * Create top compound1 type */
+ tid_cmpd1 = H5Tcreate(H5T_COMPOUND, sizeof(cmpd1_t));
+ /* Insert fields */
+ ret = H5Tinsert(tid_cmpd1, "int1", HOFFSET(cmpd1_t, i1), H5T_NATIVE_INT);
+ assert(ret >= 0);
+ /* Create a VL datatype */
+ tid_cmpd1_vlen = H5Tvlen_create(tid_cmpd2);
+
+ ret = H5Tinsert(tid_cmpd1, "vlen_cmpd1", HOFFSET(cmpd1_t, vl), tid_cmpd1_vlen);
+ assert(ret >= 0);
+
+ /* -------------------------------
+ * Create dataset with compound1
+ */
+ /* Create dataspace for dataset */
+ sid_dset = H5Screate_simple(1, sdims_dset, NULL);
+
+ /* Create a dataset */
+ did_dset = H5Dcreate2(fid, dset, tid_cmpd1, sid_dset, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Write dataset to disk */
+ ret = H5Dwrite(did_dset, tid_cmpd1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
+ assert(ret >= 0);
+
+ /*-----------------------------------
+ * Create an attribute in root group
+ */
+ tid_attr = H5Acreate2(fid, attr, tid_cmpd1, sid_dset, H5P_DEFAULT, H5P_DEFAULT);
+ assert(tid_attr > 0);
+ ret = H5Awrite(tid_attr, tid_cmpd1, wdata);
+ assert(ret >= 0);
+
+ /* Reclaim the write VL data */
+ ret = H5Dvlen_reclaim(tid_cmpd1, sid_dset, H5P_DEFAULT, wdata);
+ assert(ret >= 0);
+
+ /* ----------------
+ * Close IDs */
+ ret = H5Aclose(tid_attr);
+ assert(ret >= 0);
+ ret = H5Dclose(did_dset);
+ assert(ret >= 0);
+ ret = H5Tclose(tid_cmpd2);
+ assert(ret >= 0);
+ ret = H5Tclose(tid_cmpd1);
+ assert(ret >= 0);
+ ret = H5Sclose(sid_dset);
+ assert(ret >= 0);
+ ret = H5Tclose(tid_cmpd1_vlen);
+ assert(ret >= 0);
+ ret = H5Fclose(fid);
+ assert(ret >= 0);
+}
+
+
+static void test_comps_array_vlen (const char * fname, const char *dset,const char *attr, int diff, int is_file_new)
+{
+ typedef struct {
+ int i3;
+ float f3;
+ } cmpd3_t;
+
+ typedef struct { /* Typedef for compound datatype */
+ int i2;
+ hvl_t vl; /* VL information to write */
+ } cmpd2_t;
+
+ typedef struct {
+ int i1;
+ cmpd2_t cmpd2[SDIM_CMPD_ARRAY];
+ } cmpd1_t;
+
+ cmpd1_t wdata[SDIM_DSET]; /* Information to write */
+ hid_t fid; /* HDF5 File IDs */
+ hid_t did_dset; /* Dataset ID */
+ hid_t sid_dset; /* Dataspace ID */
+ hid_t tid_attr;
+ hid_t tid_cmpd1; /* Compound1 Datatype ID */
+ hid_t tid_arry1; /* Array Datatype ID */
+ hid_t tid_cmpd2; /* Compound2 Datatype ID */
+ hid_t tid_cmpd2_vlen;
+ hid_t tid_cmpd3; /* Compound3 Datatype ID */
+ hsize_t sdims_dset[] = {SDIM_DSET};
+ hsize_t sdims_arry[] = {SDIM_CMPD_ARRAY};
+ unsigned i, j, k; /* counting variables */
+ herr_t ret; /* Generic return value */
+
+
+
+ /* Initialize array data to write in compound1 */
+ for(i = 0; i < SDIM_DSET; i++) {
+ wdata[i].i1 = (int)i;
+
+ /* Allocate and initialize VL data to write in compound2 */
+ for(j = 0; j < SDIM_CMPD_ARRAY; j++) {
+ wdata[i].cmpd2[j].i2 = (int)(j * 10);
+ wdata[i].cmpd2[j].vl.p = HDmalloc((j + 1) * sizeof(cmpd3_t));
+ wdata[i].cmpd2[j].vl.len = j + 1;
+ for(k = 0; k < (j + 1); k++) {
+ /* Initialize data of compound3 */
+ ((cmpd3_t *)wdata[i].cmpd2[j].vl.p)[k].i3 = (int)j * 10 + diff;
+ ((cmpd3_t *)wdata[i].cmpd2[j].vl.p)[k].f3 = (float)j * 10.5F + (float)diff;
+ } /* end for */
+ } /* end for */
+ }
+
+ /*-----------------------------------------------------------------------
+ * Create file(s)
+ *------------------------------------------------------------------------*/
+ if (is_file_new == 1)
+ fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ else
+ fid = H5Fopen (fname, H5F_ACC_RDWR, H5P_DEFAULT);
+
+ /* Create dataspace for datasets */
+ sid_dset = H5Screate_simple(1, sdims_dset, NULL);
+
+ /*-------------------------------------
+ * Create a sub compound3 datatype */
+ tid_cmpd3 = H5Tcreate(H5T_COMPOUND, sizeof(cmpd3_t));
+
+ /* Insert integer field */
+ ret = H5Tinsert(tid_cmpd3, "int", HOFFSET(cmpd3_t, i3), H5T_NATIVE_INT);
+ assert(ret >= 0);
+
+ /* Insert float field */
+ ret = H5Tinsert(tid_cmpd3, "float", HOFFSET(cmpd3_t, f3), H5T_NATIVE_FLOAT);
+ assert(ret >= 0);
+
+
+ /*-------------------------------------
+ * Create a sub compound2 datatype */
+ tid_cmpd2 = H5Tcreate(H5T_COMPOUND, sizeof(cmpd2_t));
+
+ /* Insert integer field */
+ ret = H5Tinsert(tid_cmpd2, "int", HOFFSET(cmpd2_t, i2), H5T_NATIVE_INT);
+ assert(ret >= 0);
+ /* Create a VL datatype */
+ tid_cmpd2_vlen = H5Tvlen_create(tid_cmpd3);
+ ret = H5Tinsert(tid_cmpd2, "vlen", HOFFSET(cmpd2_t, vl), tid_cmpd2_vlen);
+ assert(ret >= 0);
+
+
+ /*-----------------------------------
+ * Create a top compound1 datatype for dataset.
+ */
+ tid_cmpd1 = H5Tcreate (H5T_COMPOUND, sizeof(cmpd1_t));
+
+ /* Create an array datatype */
+ tid_arry1 = H5Tarray_create2(tid_cmpd2, 1, sdims_arry);
+ /* insert the array */
+ H5Tinsert(tid_cmpd1, "array_comp", HOFFSET(cmpd1_t, cmpd2), tid_arry1);
+
+
+ /* ----------------------
+ * Create a dataset */
+ did_dset = H5Dcreate2(fid, dset, tid_cmpd1, sid_dset, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Write dataset to disk */
+ ret = H5Dwrite(did_dset, tid_cmpd1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
+ assert(ret >= 0);
+
+ /*-----------------------------------
+ * Create an attribute in root group
+ */
+ tid_attr = H5Acreate2(fid, attr, tid_cmpd1, sid_dset, H5P_DEFAULT, H5P_DEFAULT);
+ assert(tid_attr > 0);
+ ret = H5Awrite(tid_attr, tid_cmpd1, wdata);
+ assert(ret >= 0);
+
+ /* Reclaim the write VL data */
+ ret = H5Dvlen_reclaim(tid_cmpd1, sid_dset, H5P_DEFAULT, wdata);
+ assert(ret >= 0);
+
+ /*-------------------
+ * Close IDs */
+ ret = H5Aclose(tid_attr);
+ assert(ret >= 0);
+ ret = H5Tclose(tid_arry1);
+ assert(ret >= 0);
+ ret = H5Dclose(did_dset);
+ assert(ret >= 0);
+ ret = H5Sclose(sid_dset);
+ assert(ret >= 0);
+ ret = H5Tclose(tid_cmpd3);
+ assert(ret >= 0);
+ ret = H5Tclose(tid_cmpd2);
+ assert(ret >= 0);
+ ret = H5Tclose(tid_cmpd2_vlen);
+ assert(ret >= 0);
+ ret = H5Tclose(tid_cmpd1);
+ assert(ret >= 0);
+ ret = H5Fclose(fid);
+ assert(ret >= 0);
+}
+
+
+static void test_comps_vlen_arry (const char * fname, const char *dset, const char *attr, int diff, int is_file_new)
+{
+ /* sub compound 3 */
+ typedef struct {
+ int i3;
+ float f3;
+ } cmpd3_t;
+
+ /* sub compound 2 */
+ typedef struct {
+ int i2;
+ cmpd3_t cmpd3[SDIM_CMPD_ARRAY];
+ } cmpd2_t;
+
+ /* top compound 1 */
+ typedef struct {
+ int i1;
+ hvl_t vl; /* VL information for compound2 */
+ } cmpd1_t;
+
+ cmpd1_t wdata[SDIM_DSET]; /* Dataset for compound1 */
+
+ hid_t fid; /* HDF5 File ID */
+ hid_t did_dset; /* dataset ID */
+ hid_t sid_dset; /* dataset space ID */
+ hid_t tid_attr;
+ hid_t tid_cmpd3; /* compound3 type ID */
+ hid_t tid_cmpd2; /* compound2 type ID */
+ hid_t tid_cmpd2_arry;
+ hid_t tid_cmpd1; /* compound1 type ID */
+ hid_t tid_cmpd1_vlen;
+ hsize_t sdims_dset[] = {SDIM_DSET};
+ hsize_t sdims_cmpd_arry[] = {SDIM_CMPD_ARRAY};
+
+ unsigned i,j,k; /* counting variables */
+ herr_t ret; /* Generic return value */
+
+ /* Allocate and initialize VL data to write */
+ for(i = 0; i < SDIM_DSET; i++) {
+ /* compound 1 data */
+ wdata[i].i1 = (int)i;
+ wdata[i].vl.p = HDmalloc((i + 1) * sizeof(cmpd2_t));
+ wdata[i].vl.len = i + 1;
+ for(j = 0; j < (i + 1); j++) {
+ /* compound2 data */
+ ((cmpd2_t *)wdata[i].vl.p)[j].i2 = (int)i * 10 + diff;
+ for(k = 0; k < SDIM_CMPD_ARRAY; k++) {
+ /* compound 3 data */
+ ((cmpd2_t *)(wdata[i].vl.p))[j].cmpd3[k].i3 = (int)((float)k * 10.5F) + diff;
+ ((cmpd2_t *)(wdata[i].vl.p))[j].cmpd3[k].f3 = (float)k * 10.5F + (float)diff;
+ } /* end for */
+ } /* end for */
+ } /* end for */
+
+ /*-----------------------------------------------------------------------
+ * Create file(s)
+ *------------------------------------------------------------------------*/
+ if (is_file_new == 1)
+ fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ else
+ fid = H5Fopen (fname, H5F_ACC_RDWR, H5P_DEFAULT);
+
+ /* -----------------------------
+ * Create sub compound3 type */
+ tid_cmpd3 = H5Tcreate(H5T_COMPOUND, sizeof(cmpd3_t));
+
+ /* Insert fields */
+ ret = H5Tinsert(tid_cmpd3, "int3", HOFFSET(cmpd3_t, i3), H5T_NATIVE_INT);
+ assert(ret >= 0);
+ ret = H5Tinsert(tid_cmpd3, "float3", HOFFSET(cmpd3_t, f3), H5T_NATIVE_FLOAT);
+ assert(ret >= 0);
+
+ /* -----------------------------
+ * Create sub compound2 type */
+ tid_cmpd2 = H5Tcreate(H5T_COMPOUND, sizeof(cmpd2_t));
+
+ ret = H5Tinsert(tid_cmpd2, "int2", HOFFSET(cmpd2_t, i2), H5T_NATIVE_INT);
+ assert(ret >= 0);
+
+ tid_cmpd2_arry = H5Tarray_create2(tid_cmpd3, 1, sdims_cmpd_arry);
+ ret = H5Tinsert(tid_cmpd2, "array_cmpd2", HOFFSET(cmpd2_t, cmpd3), tid_cmpd2_arry);
+ assert(ret >= 0);
+
+ /* ---------------------------
+ * Create top compound1 type
+ */
+ /* Create a VL datatype */
+ tid_cmpd1 = H5Tcreate(H5T_COMPOUND, sizeof(cmpd1_t));
+ /* Insert fields */
+ ret = H5Tinsert(tid_cmpd1, "int1", HOFFSET(cmpd1_t, i1), H5T_NATIVE_INT);
+ assert(ret >= 0);
+ tid_cmpd1_vlen = H5Tvlen_create(tid_cmpd2);
+ ret = H5Tinsert(tid_cmpd1, "vlen_cmpd1", HOFFSET(cmpd1_t, vl), tid_cmpd1_vlen);
+ assert(ret >= 0);
+
+ /* -------------------------------
+ * Create dataset with compound1
+ */
+ /* Create dataspace for dataset */
+ sid_dset = H5Screate_simple(1, sdims_dset, NULL);
+
+ /* Create a dataset */
+ did_dset = H5Dcreate2(fid, dset, tid_cmpd1, sid_dset, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Write dataset to disk */
+ ret = H5Dwrite(did_dset, tid_cmpd1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
+ assert(ret >= 0);
+
+ /*-----------------------------------
+ * Create an attribute in root group
+ */
+ tid_attr = H5Acreate2(fid, attr, tid_cmpd1, sid_dset, H5P_DEFAULT, H5P_DEFAULT);
+ assert(tid_attr > 0);
+ ret = H5Awrite(tid_attr, tid_cmpd1, wdata);
+ assert(ret >= 0);
+
+ /* Reclaim the write VL data */
+ ret = H5Dvlen_reclaim(tid_cmpd1, sid_dset, H5P_DEFAULT, wdata);
+ assert(ret >= 0);
+
+ /* ----------------
+ * Close IDs */
+ ret = H5Aclose(tid_attr);
+ assert(ret >= 0);
+ ret = H5Dclose(did_dset);
+ assert(ret >= 0);
+ ret = H5Sclose(sid_dset);
+ assert(ret >= 0);
+ ret = H5Tclose(tid_cmpd3);
+ assert(ret >= 0);
+ ret = H5Tclose(tid_cmpd2_arry);
+ assert(ret >= 0);
+ ret = H5Tclose(tid_cmpd2);
+ assert(ret >= 0);
+ ret = H5Tclose(tid_cmpd1_vlen);
+ assert(ret >= 0);
+ ret = H5Tclose(tid_cmpd1);
+ assert(ret >= 0);
+ ret = H5Fclose(fid);
+ assert(ret >= 0);
+}
+
+
+/*-------------------------------------------------------------------------
+* Function: test_data_nocomparables
+*
+* Purpose:
+* Create test files with non-comparable dataset and attributes with
+* comparable datasets and attributes. All the comparables should display
+* differences.
+*
+*-------------------------------------------------------------------------*/
+#define DIM_ARRY 3
+static void test_data_nocomparables (const char * fname, int make_diffs)
+{
+ hid_t fid=0;
+ hid_t gid1=0;
+ hid_t gid2=0;
+ hid_t did1=0;
+ hid_t did2=0;
+ hid_t sid1=0;
+ hid_t tid_dset1=0;
+ hid_t tid_attr1=0;
+ hsize_t dims1_1[1] = {DIM_ARRY};
+ hsize_t dims1_2[1] = {DIM_ARRY+1};
+ hsize_t dims2[2] = {DIM_ARRY, 1};
+ int data1[DIM_ARRY] = {0,0,0};
+ int data2[DIM_ARRY] = {1,1,1};
+ int data3[DIM_ARRY+1] = {1,1,1,1};
+ int data1_dim2[DIM_ARRY][1] = {{0},{0},{0}};
+ int rank_attr;
+ char data1_str[DIM_ARRY][STR_SIZE]= {"ab","cd","ef"};
+ herr_t status = SUCCEED;
+ void *dset_data_ptr1=NULL;
+ void *dset_data_ptr2=NULL;
+ void *dset_data_ptr3=NULL;
+ void *attr_data_ptr1=NULL;
+ void *attr_data_ptr2=NULL;
+ void *attr_data_ptr3=NULL;
+ void *attr_data_ptr4=NULL;
+ void *attr2_dim_ptr=NULL;
+ void *attr3_dim_ptr=NULL;
+
+ /* init */
+ tid_dset1=H5Tcopy(H5T_NATIVE_INT);
+ dset_data_ptr1=(int*)&data1;
+ dset_data_ptr2=(int*)&data1;
+ dset_data_ptr3=(int*)&data1;
+ tid_attr1=H5Tcopy(H5T_NATIVE_INT);
+ attr_data_ptr1=(int*)&data1;
+ attr_data_ptr3=(int*)&data1;
+ attr_data_ptr4=(int*)&data1;
+ attr2_dim_ptr=(hsize_t*)&dims1_1;
+ attr3_dim_ptr=(hsize_t*)&dims1_1;
+ rank_attr=1;
+
+ if (make_diffs)
+ {
+ /* ------------
+ * group1 */
+ tid_dset1=H5Tcopy(H5T_C_S1);
+ H5Tset_size(tid_dset1, (size_t)STR_SIZE);
+ dset_data_ptr1=(char*)&data1_str;
+ dset_data_ptr2=(int*)&data2;
+ attr_data_ptr1=(int*)&data2;
+
+ /* -----------
+ * group2
+ */
+ dset_data_ptr3=(int*)&data2;
+ /* dset1/attr1 */
+ tid_attr1=H5Tcopy(H5T_C_S1);
+ H5Tset_size(tid_attr1, (size_t)STR_SIZE);
+ attr_data_ptr2=(char*)&data1_str;
+
+ /* dset1/attr2 */
+ attr2_dim_ptr=(hsize_t*)&dims1_2;
+
+ /* dset1/attr3 */
+ attr_data_ptr3=(int*)&data1_dim2;
+ attr3_dim_ptr=(hsize_t*)&dims2;
+ rank_attr=2;
+
+ /* dset1/attr4 */
+ attr_data_ptr4=(int*)&data2;
+
+ }
+
+
+ /*-----------------------------------------------------------------------
+ * Create file(s)
+ *------------------------------------------------------------------------*/
+ fid = H5Fcreate (fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ if (fid < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname);
+ status = FAIL;
+ goto out;
+ }
+
+ /*-----------------------------------------------------------------------
+ * Groups
+ *------------------------------------------------------------------------*/
+ gid1 = H5Gcreate2(fid, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (gid1 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname);
+ status = FAIL;
+ goto out;
+ }
+
+ gid2 = H5Gcreate2(fid, "g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (gid2 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname);
+ status = FAIL;
+ goto out;
+ }
+
+ /*-----------------------------------------------------------------------
+ * Datasets in /g1
+ *------------------------------------------------------------------------*/
+ if((sid1 = H5Screate_simple(1, dims1_1, NULL)) < 0)
+ goto out;
+
+ /* dset1 */
+ if((did1 = H5Dcreate2(gid1, "dset1", tid_dset1, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Dcreate2 failed.\n", "dset1");
+ status = FAIL;
+ goto out;
+ }
+
+ if(H5Dwrite(did1, tid_dset1, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset_data_ptr1) < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Dwrite failed.\n", "dset1");
+ status = FAIL;
+ goto out;
+ }
+ write_attr(did1,1,dims1_1,"attr", H5T_NATIVE_INT, attr_data_ptr1);
+
+ /* dset2 */
+ status = write_dset(gid1, 1, dims1_1,"dset2", H5T_NATIVE_INT, dset_data_ptr2);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname);
+ goto out;
+ }
+
+ /*-----------------------------------------------------------------------
+ * Datasets in /g2
+ *------------------------------------------------------------------------*/
+ /* ---------
+ * dset1 */
+ if((did2 = H5Dcreate2(gid2, "dset1", H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Dcreate2 failed.\n", "dset1");
+ status = FAIL;
+ goto out;
+ }
+
+ if(H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset_data_ptr3) < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Dwrite failed.\n", "dset1");
+ status = FAIL;
+ goto out;
+ }
+ /* attr1 - non-compatible : different type */
+ write_attr(did2,1,dims1_1,"attr1", tid_attr1, attr_data_ptr2);
+
+
+ /* attr2 - non-compatible : same rank, different dimention */
+ write_attr(did2,1,(hsize_t *)attr2_dim_ptr,"attr2", H5T_NATIVE_INT, data3);
+
+ /* attr3 - non-compatible : different rank */
+ write_attr(did2, rank_attr,(hsize_t *)attr3_dim_ptr,"attr3", H5T_NATIVE_INT, attr_data_ptr3);
+
+ /* attr4 - compatible : different data values */
+ write_attr(did2,1,dims1_1,"attr4", H5T_NATIVE_INT, attr_data_ptr4);
+
+ /*----------
+ * dset2 */
+ status = write_dset(gid2, 1, dims1_1,"dset2", H5T_NATIVE_INT, dset_data_ptr3);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname);
+ goto out;
+ }
+
+
+
+out:
+
+ /*-----------------------------------------------------------------------
+ * Close IDs
+ *-----------------------------------------------------------------------*/
+ if(fid)
+ H5Fclose(fid);
+ if(gid1)
+ H5Gclose(gid1);
+ if(gid2)
+ H5Gclose(gid2);
+ if(did1)
+ H5Dclose(did1);
+ if(did2)
+ H5Dclose(did2);
+ if(sid1)
+ H5Sclose(sid1);
+ if(tid_dset1)
+ H5Tclose(tid_dset1);
+ if(tid_attr1)
+ H5Tclose(tid_attr1);
+}
+
+/*-------------------------------------------------------------------------
+* 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)
+*
+*-------------------------------------------------------------------------
+*/
+static
+void write_attr_in(hid_t loc_id,
+ const char* dset_name, /* for saving reference to dataset*/
+ hid_t fid,
+ int make_diffs /* flag to modify data buffers */)
+{
+ /* Compound datatype */
+ typedef struct s_t
+ {
+ char a;
+ double b;
+ } s_t;
+
+ typedef enum
+ {
+ RED,
+ GREEN
+ } e_t;
+
+ hid_t aid;
+ hid_t sid;
+ hid_t tid;
+ herr_t status;
+ int val, i, j, k, l, n;
+ float f;
+
+ /* create 1D attributes with dimension [2], 2 elements */
+ hsize_t dims[1]={2};
+ char buf1[2][STR_SIZE]= {"ab","de"}; /* string */
+ char *buf1a[2]; /* VL string */
+ char buf2[2]= {1,2}; /* bitfield, opaque */
+ s_t buf3[2]= {{1,2.0F},{3,4.0F}}; /* compound */
+ hobj_ref_t buf4[2]; /* reference */
+ e_t buf45[2]= {RED,RED}; /* enum */
+ hvl_t buf5[2]; /* vlen */
+ hsize_t dimarray[1]={3}; /* array dimension */
+ int buf6[2][3]= {{1,2,3},{4,5,6}}; /* array */
+ int buf7[2]= {1,2}; /* integer */
+ float buf8[2]= {1.0F, 2.0F}; /* float */
+
+ /* create 2D attributes with dimension [3][2], 6 elements */
+ hsize_t dims2[2]={3,2};
+ char buf12[3][2][STR_SIZE]= {{"ab","cd"},{"ef","gh"},{"ij","kl"}}; /* string */
+ char *buf12a[3][2]; /* VL string */
+ char buf22[3][2]= {{1,2},{3,4},{5,6}}; /* bitfield, opaque */
+ s_t buf32[6]= {{1,2.0F},{3,4.0F},{5,6.0F},{7,8.0F},{9,10.0F},{11,12.0F}}; /* compound */
+ hobj_ref_t buf42[3][2]; /* reference */
+ e_t buf452[3][2]; /* enum */
+ hvl_t buf52[3][2]; /* vlen */
+ int buf62[6][3]= {{1,2,3},{4,5,6},{7,8,9},{10,11,12},{13,14,15},{16,17,18}}; /* array */
+ int buf72[3][2]= {{1,2},{3,4},{5,6}}; /* integer */
+ float buf82[3][2]= {{1.0F,2.0F},{3.0F,4.0F},{5.0F,6.0F}}; /* float */
+
+ /* create 3D attributes with dimension [4][3][2], 24 elements */
+ hsize_t dims3[3]={4,3,2};
+ char buf13[4][3][2][STR_SIZE]= {{{"ab","cd"},{"ef","gh"},{"ij","kl"}},
+ {{"mn","pq"},{"rs","tu"},{"vw","xz"}},
+ {{"AB","CD"},{"EF","GH"},{"IJ","KL"}},
+ {{"MN","PQ"},{"RS","TU"},{"VW","XZ"}}}; /* string */
+ char *buf13a[4][3][2]; /* VL string */
+ char buf23[4][3][2]; /* bitfield, opaque */
+ s_t buf33[4][3][2]; /* compound */
+ hobj_ref_t buf43[4][3][2]; /* reference */
+ e_t buf453[4][3][2]; /* enum */
+ hvl_t buf53[4][3][2]; /* vlen */
+ int buf63[24][3]; /* array */
+ int buf73[4][3][2]; /* integer */
+ float buf83[4][3][2]; /* float */
+
+
+ /*-------------------------------------------------------------------------
+ * 1D attributes
+ *-------------------------------------------------------------------------
+ */
+
+ /*-------------------------------------------------------------------------
+ * H5T_STRING
+ *-------------------------------------------------------------------------
+ */
+
+ if (make_diffs)
+ {
+ for (i=0; i<2; i++)
+ {
+ for (j=0; j<2; j++)
+ {
+ buf1[i][j]='z';
+ }
+ }
+ }
+ /*
+ buf1[2][2]= {"ab","de"};
+ $h5diff file7.h5 file6.h5 g1 g1 -v
+ Group: </g1> and </g1>
+ Attribute: <string> and <string>
+ position string of </g1> string of </g1> difference
+ ------------------------------------------------------------
+ [ 0 ] a z
+ [ 0 ] b z
+ [ 1 ] d z
+ [ 1 ] e z
+ */
+ tid = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(tid, (size_t)STR_SIZE);
+ write_attr(loc_id,1,dims,"string",tid,buf1);
+ status = H5Tclose(tid);
+
+ for (i=0; i<2; i++)
+ buf1a[i]=buf1[i];
+ tid = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(tid, H5T_VARIABLE);
+ write_attr(loc_id,1,dims,"VLstring",tid,buf1a);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_BITFIELD
+ *-------------------------------------------------------------------------
+ */
+
+ if (make_diffs)
+ {
+ for (i=0; i<2; i++)
+ buf2[i]=buf2[1]=0;
+ }
+ /*
+ buf2[2]= {1,2};
+ $h5diff file7.h5 file6.h5 g1 g1 -v
+ Group: </g1> and </g1>
+ Attribute: <bitfield> and <bitfield>
+ position bitfield of </g1> bitfield of </g1> difference
+ position opaque of </g1> opaque of </g1> difference
+ ------------------------------------------------------------
+ [ 0 ] 1 0 1
+ [ 1 ] 2 0 2
+ */
+
+ tid = H5Tcopy(H5T_STD_B8LE);
+ write_attr(loc_id,1,dims,"bitfield",tid,buf2);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_OPAQUE
+ *-------------------------------------------------------------------------
+ */
+
+ /*
+ buf2[2]= {1,2};
+ $h5diff file7.h5 file6.h5 g1 g1 -v
+ Group: </g1> and </g1>
+ Attribute: <opaque> and <opaque>
+ position opaque of </g1> opaque of </g1> difference
+ position opaque of </g1> opaque of </g1> difference
+ ------------------------------------------------------------
+ [ 0 ] 1 0 1
+ [ 1 ] 2 0 2
+ */
+
+ tid = H5Tcreate(H5T_OPAQUE, (size_t)1);
+ status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */
+ write_attr(loc_id,1,dims,"opaque",tid,buf2);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_COMPOUND
+ *-------------------------------------------------------------------------
+ */
+
+ if (make_diffs)
+ {
+ for (i=0; i<2; i++)
+ {
+ buf3[i].a=0; buf3[i].b=0;
+ }
+ }
+
+ /*
+ buf3[2]= {{1,2},{3,4}};
+ $h5diff file7.h5 file6.h5 g1 g1 -v
+ Group: </g1> and </g1>
+ Attribute: <compound> and <compound>
+ position compound of </g1> compound of </g1> difference
+ ------------------------------------------------------------
+ [ 0 ] 1 5 4
+ [ 0 ] 2 5 3
+ [ 1 ] 3 5 2
+ [ 1 ] 4 5 1
+ */
+
+ tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t));
+ H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR);
+ H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE);
+ write_attr(loc_id,1,dims,"compound",tid,buf3);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_REFERENCE (H5R_OBJECT object reference)
+ *-------------------------------------------------------------------------
+ */
+ /* Create references to dataset */
+ if (dset_name)
+ {
+ status=H5Rcreate(&buf4[0],fid,dset_name,H5R_OBJECT,(hid_t)-1);
+ status=H5Rcreate(&buf4[1],fid,dset_name,H5R_OBJECT,(hid_t)-1);
+ write_attr(loc_id,1,dims,"reference",H5T_STD_REF_OBJ,buf4);
+ }
+
+ /*-------------------------------------------------------------------------
+ * H5T_ENUM
+ *-------------------------------------------------------------------------
+ */
+ if (make_diffs)
+ {
+ for (i=0; i<2; i++)
+ {
+ buf45[i]=GREEN;
+ }
+ }
+ /*
+ buf45[2]= {RED,RED};
+ $h5diff file7.h5 file6.h5 g1 g1 -v
+ Group: </g1> and </g1>
+ Attribute: <enum> and <enum>
+ position enum of </g1> enum of </g1> difference
+ ------------------------------------------------------------
+ [ 0 ] RED GREEN
+ [ 1 ] RED GREEN
+ */
+ tid = H5Tcreate(H5T_ENUM, sizeof(e_t));
+ H5Tenum_insert(tid, "RED", (val = 0, &val));
+ H5Tenum_insert(tid, "GREEN", (val = 1, &val));
+ write_attr(loc_id,1,dims,"enum",tid,buf45);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_VLEN
+ *-------------------------------------------------------------------------
+ */
+
+ /* Allocate and initialize VL dataset to write */
+
+ buf5[0].len = 1;
+ buf5[0].p = HDmalloc( 1 * sizeof(int));
+ ((int *)buf5[0].p)[0]=1;
+ buf5[1].len = 2;
+ buf5[1].p = HDmalloc( 2 * sizeof(int));
+ ((int *)buf5[1].p)[0]=2;
+ ((int *)buf5[1].p)[1]=3;
+
+ if (make_diffs)
+ {
+ ((int *)buf5[0].p)[0]=0;
+ ((int *)buf5[1].p)[0]=0;
+ ((int *)buf5[1].p)[1]=0;
+ }
+ /*
+ $h5diff file7.h5 file6.h5 g1 g1 -v
+ Group: </g1> and </g1>
+ position vlen of </g1> vlen of </g1> difference
+ ------------------------------------------------------------
+ [ 0 ] 1 0 1
+ [ 1 ] 2 0 2
+ [ 1 ] 3 0 3
+ */
+
+ sid = H5Screate_simple(1, dims, NULL);
+ tid = H5Tvlen_create(H5T_NATIVE_INT);
+ aid = H5Acreate2(loc_id, "vlen", tid, sid, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Awrite(aid, tid, buf5);
+ assert(status >= 0);
+ status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf5);
+ assert(status >= 0);
+ status = H5Aclose(aid);
+ status = H5Tclose(tid);
+ status = H5Sclose(sid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_ARRAY
+ *-------------------------------------------------------------------------
+ */
+
+ if (make_diffs)
+ {
+ for (i=0; i<2; i++)
+ for (j=0; j<3; j++)
+ {
+ buf6[i][j]=0;
+ }
+ }
+ /*
+ buf6[2][3]= {{1,2,3},{4,5,6}};
+ $h5diff file7.h5 file6.h5 g1 g1 -v
+ Group: </g1> and </g1>
+ Attribute: <array> and <array>
+ position array of </g1> array of </g1> difference
+ ------------------------------------------------------------
+ [ 0 ] 1 0 1
+ [ 0 ] 2 0 2
+ [ 0 ] 3 0 3
+ [ 1 ] 4 0 4
+ [ 1 ] 5 0 5
+ [ 1 ] 6 0 6
+ */
+ tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray);
+ write_attr(loc_id, 1, dims, "array", tid, buf6);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_INTEGER and H5T_FLOAT
+ *-------------------------------------------------------------------------
+ */
+
+ if (make_diffs)
+ {
+ for (i=0; i<2; i++)
+ {
+ buf7[i]=0;
+ buf8[i]=0;
+ }
+ }
+ /*
+ buf7[2]= {1,2};
+ buf8[2]= {1,2};
+ $h5diff file7.h5 file6.h5 g1 g1 -v
+ Group: </g1> and </g1>
+ position integer of </g1> integer of </g1> difference
+ ------------------------------------------------------------
+ [ 0 ] 1 0 1
+ [ 1 ] 2 0 2
+ position float of </g1> float of </g1> difference
+ ------------------------------------------------------------
+ [ 0 ] 1 0 1
+ [ 1 ] 2 0 2
+ */
+ write_attr(loc_id,1,dims,"integer",H5T_NATIVE_INT,buf7);
+ write_attr(loc_id,1,dims,"float",H5T_NATIVE_FLOAT,buf8);
+
+
+ /*-------------------------------------------------------------------------
+ * 2D attributes
+ *-------------------------------------------------------------------------
+ */
+
+ /*-------------------------------------------------------------------------
+ * H5T_STRING
+ *-------------------------------------------------------------------------
+ */
+ if (make_diffs)
+ {
+ for (i=0; i<3; i++)
+ for (j=0; j<2; j++)
+ for (k=0; k<2; k++)
+ buf12[i][j][k]='z';
+ }
+
+ /*
+ buf12[6][2]= {"ab","cd","ef","gh","ij","kl"};
+ $h5diff file7.h5 file6.h5 g1 g1 -v
+ Attribute: <string2D> and <string2D>
+ position string2D of </g1> string2D of </g1> difference
+ ------------------------------------------------------------
+ [ 0 0 ] a z
+ [ 0 0 ] b z
+ [ 0 1 ] c z
+ [ 0 1 ] d z
+ [ 1 0 ] e z
+ [ 1 0 ] f z
+ [ 1 1 ] g z
+ [ 1 1 ] h z
+ [ 2 0 ] i z
+ [ 2 0 ] j z
+ [ 2 1 ] k z
+ [ 2 1 ] l z
+ */
+
+ tid = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(tid, (size_t)STR_SIZE);
+ write_attr(loc_id,2,dims2,"string2D",tid,buf12);
+ status = H5Tclose(tid);
+
+ for (i=0; i<3; i++)
+ {
+ for (j=0; j<2; j++)
+ {
+
+ buf12a[i][j]=buf12[i][j];
+ }
+ }
+ tid = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(tid, H5T_VARIABLE);
+ write_attr(loc_id,2,dims2,"VLstring2D",tid,buf12a);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_BITFIELD
+ *-------------------------------------------------------------------------
+ */
+
+ if (make_diffs)
+ {
+ memset(buf22,0,sizeof buf22);
+ }
+
+ /*
+ buf22[3][2]= {{1,2},{3,4},{5,6}};
+ $h5diff file7.h5 file6.h5 g1 g1 -v
+ Attribute: <bitfield2D> and <bitfield2D>
+ position bitfield2D of </g1> bitfield2D of </g1> difference
+ ------------------------------------------------------------
+ [ 0 0 ] 1 0 1
+ [ 0 1 ] 2 0 2
+ [ 1 0 ] 3 0 3
+ [ 1 1 ] 4 0 4
+ [ 2 0 ] 5 0 5
+ [ 2 1 ] 6 0 6
+ */
+
+
+ tid = H5Tcopy(H5T_STD_B8LE);
+ write_attr(loc_id,2,dims2,"bitfield2D",tid,buf22);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_OPAQUE
+ *-------------------------------------------------------------------------
+ */
+
+ /*
+ buf22[3][2]= {{1,2},{3,4},{5,6}};
+ $h5diff file7.h5 file6.h5 g1 g1 -v
+ Attribute: <opaque2D> and <opaque2D>
+ position opaque2D of </g1> opaque2D of </g1> difference
+ ------------------------------------------------------------
+ [ 0 0 ] 1 0 1
+ [ 0 1 ] 2 0 2
+ [ 1 0 ] 3 0 3
+ [ 1 1 ] 4 0 4
+ [ 2 0 ] 5 0 5
+ [ 2 1 ] 6 0 6
+ */
+ tid = H5Tcreate(H5T_OPAQUE, (size_t)1);
+ status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */
+ write_attr(loc_id,2,dims2,"opaque2D",tid,buf22);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_COMPOUND
+ *-------------------------------------------------------------------------
+ */
+ if (make_diffs)
+ {
+ memset(buf32,0,sizeof buf32);
+ }
+
+ /*
+ buf32[6]= {{1,2},{3,4},{5,6},{7,8},{9,10},{11,12}};
+ $h5diff file7.h5 file6.h5 g1 g1 -v
+ Attribute: <opaque2D> and <opaque2D>
+ position opaque2D of </g1> opaque2D of </g1> difference
+ ------------------------------------------------------------
+ [ 0 0 ] 1 0 1
+ [ 0 1 ] 2 0 2
+ [ 1 0 ] 3 0 3
+ [ 1 1 ] 4 0 4
+ [ 2 0 ] 5 0 5
+ [ 2 1 ] 6 0 6
+ */
+
+
+ tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t));
+ H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR);
+ H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE);
+ write_attr(loc_id,2,dims2,"compound2D",tid,buf32);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_REFERENCE (H5R_OBJECT object reference)
+ *-------------------------------------------------------------------------
+ */
+ /* Create references to dataset */
+ if (dset_name)
+ {
+ for (i = 0; i < 3; i++) {
+ for (j = 0; j < 2; j++) {
+ status=H5Rcreate(&buf42[i][j],fid,dset_name,H5R_OBJECT,(hid_t)-1);
+ }
+ }
+ write_attr(loc_id,2,dims2,"reference2D",H5T_STD_REF_OBJ,buf42);
+ }
+
+ /*-------------------------------------------------------------------------
+ * H5T_ENUM
+ *-------------------------------------------------------------------------
+ */
+ for (i=0; i<3; i++)
+ {
+ for (j=0; j<2; j++)
+ {
+ if (make_diffs) buf452[i][j]=GREEN; else buf452[i][j]=RED;
+ }
+ }
+
+ /*
+ Attribute: <enum2D> and <enum2D>
+ position enum2D of </g1> enum2D of </g1> difference
+ ------------------------------------------------------------
+ [ 0 0 ] RED GREEN
+ [ 0 1 ] RED GREEN
+ [ 1 0 ] RED GREEN
+ [ 1 1 ] RED GREEN
+ [ 2 0 ] RED GREEN
+ [ 2 1 ] RED GREEN
+ */
+
+ tid = H5Tcreate(H5T_ENUM, sizeof(e_t));
+ H5Tenum_insert(tid, "RED", (val = 0, &val));
+ H5Tenum_insert(tid, "GREEN", (val = 1, &val));
+ write_attr(loc_id,2,dims2,"enum2D",tid,buf452);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_VLEN
+ *-------------------------------------------------------------------------
+ */
+
+ /* Allocate and initialize VL dataset to write */
+ n=0;
+ for(i = 0; i < 3; i++) {
+ for(j = 0; j < 2; j++) {
+ buf52[i][j].p = HDmalloc((size_t)(i + 1) * sizeof(int));
+ 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++;
+ }
+ }
+
+ /*
+ position vlen2D of </g1> vlen2D of </g1> difference
+ ------------------------------------------------------------
+ [ 0 1 ] 1 0 1
+ [ 1 0 ] 2 0 2
+ [ 1 0 ] 3 0 3
+ [ 1 1 ] 4 0 4
+ [ 1 1 ] 5 0 5
+ [ 2 0 ] 6 0 6
+ [ 2 0 ] 7 0 7
+ [ 2 0 ] 8 0 8
+ [ 2 1 ] 9 0 9
+ [ 2 1 ] 10 0 10
+ [ 2 1 ] 11 0 11
+ */
+
+ sid = H5Screate_simple(2, dims2, NULL);
+ tid = H5Tvlen_create(H5T_NATIVE_INT);
+ aid = H5Acreate2(loc_id, "vlen2D", tid, sid, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Awrite(aid, tid, buf52);
+ assert(status >= 0);
+ status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf52);
+ assert(status >= 0);
+ status = H5Aclose(aid);
+ status = H5Tclose(tid);
+ status = H5Sclose(sid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_ARRAY
+ *-------------------------------------------------------------------------
+ */
+
+ if (make_diffs)
+ {
+ memset(buf62,0,sizeof buf62);
+ }
+ /*
+ buf62[6][3]= {{1,2,3},{4,5,6},{7,8,9},{10,11,12},{13,14,15},{16,17,18}};
+ $h5diff file7.h5 file6.h5 g1 g1 -v
+ Group: </g1> and </g1>
+ Attribute: <array2D> and <array2D>
+ position array2D of </g1> array2D of </g1> difference
+ ------------------------------------------------------------
+ [ 0 0 ] 1 0 1
+ [ 0 0 ] 2 0 2
+ [ 0 0 ] 3 0 3
+ [ 0 1 ] 4 0 4
+ [ 0 1 ] 5 0 5
+ [ 0 1 ] 6 0 6
+ [ 1 0 ] 7 0 7
+ [ 1 0 ] 8 0 8
+ [ 1 0 ] 9 0 9
+ [ 1 1 ] 10 0 10
+ [ 1 1 ] 11 0 11
+ [ 1 1 ] 12 0 12
+ [ 2 0 ] 13 0 13
+ [ 2 0 ] 14 0 14
+ [ 2 0 ] 15 0 15
+ [ 2 1 ] 16 0 16
+ [ 2 1 ] 17 0 17
+ [ 2 1 ] 18 0 18
+ */
+ tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray);
+ write_attr(loc_id, 2, dims2, "array2D", tid, buf62);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_INTEGER and H5T_FLOAT
+ *-------------------------------------------------------------------------
+ */
+
+ if (make_diffs)
+ {
+ memset(buf72,0,sizeof buf72);
+ memset(buf82,0,sizeof buf82);
+ }
+ /*
+ Attribute: <integer2D> and <integer2D>
+ position integer2D of </g1> integer2D of </g1> difference
+ ------------------------------------------------------------
+ [ 0 0 ] 1 0 1
+ [ 0 1 ] 2 0 2
+ [ 1 0 ] 3 0 3
+ [ 1 1 ] 4 0 4
+ [ 2 0 ] 5 0 5
+ [ 2 1 ] 6 0 6
+ 6 differences found
+ Attribute: <float2D> and <float2D>
+ position float2D of </g1> float2D of </g1> difference
+ ------------------------------------------------------------
+ [ 0 0 ] 1 0 1
+ [ 0 1 ] 2 0 2
+ [ 1 0 ] 3 0 3
+ [ 1 1 ] 4 0 4
+ [ 2 0 ] 5 0 5
+ [ 2 1 ] 6 0 6
+ */
+
+ write_attr(loc_id,2,dims2,"integer2D",H5T_NATIVE_INT,buf72);
+ write_attr(loc_id,2,dims2,"float2D",H5T_NATIVE_FLOAT,buf82);
+
+
+ /*-------------------------------------------------------------------------
+ * 3D attributes
+ *-------------------------------------------------------------------------
+ */
+
+ /*-------------------------------------------------------------------------
+ * H5T_STRING
+ *-------------------------------------------------------------------------
+ */
+
+ if (make_diffs)
+ {
+ for (i=0; i<4; i++)
+ for (j=0; j<3; j++)
+ for (k=0; k<2; k++)
+ for (l=0; l<2; l++)
+ buf13[i][j][k][l]='z';
+ }
+
+ /*
+ buf13[24][2]= {"ab","cd","ef","gh","ij","kl","mn","pq",
+ "rs","tu","vw","xz","AB","CD","EF","GH",
+ "IJ","KL","MN","PQ","RS","TU","VW","XZ"};
+
+ Attribute: <string3D> and <string3D>
+ position string3D of </g1> string3D of </g1> difference
+ ------------------------------------------------------------
+ [ 0 0 0 ] a z
+ [ 0 0 0 ] b z
+ [ 0 0 1 ] c z
+ [ 0 0 1 ] d z
+ [ 0 1 0 ] e z
+ [ 0 1 0 ] f z
+ [ 0 1 1 ] g z
+ [ 0 1 1 ] h z
+ [ 0 2 0 ] i z
+ [ 0 2 0 ] j z
+ [ 0 2 1 ] k z
+ [ 0 2 1 ] l z
+ [ 1 0 0 ] m z
+ [ 1 0 0 ] n z
+ [ 1 0 1 ] p z
+ [ 1 0 1 ] q z
+ [ 1 1 0 ] r z
+ [ 1 1 0 ] s z
+ [ 1 1 1 ] t z
+ [ 1 1 1 ] u z
+ [ 1 2 0 ] v z
+ [ 1 2 0 ] w z
+ [ 1 2 1 ] x z
+ [ 2 0 0 ] A z
+ [ 2 0 0 ] B z
+ [ 2 0 1 ] C z
+ [ 2 0 1 ] D z
+ [ 2 1 0 ] E z
+ [ 2 1 0 ] F z
+ [ 2 1 1 ] G z
+ [ 2 1 1 ] H z
+ [ 2 2 0 ] I z
+ [ 2 2 0 ] J z
+ [ 2 2 1 ] K z
+ [ 2 2 1 ] L z
+ [ 3 0 0 ] M z
+ [ 3 0 0 ] N z
+ [ 3 0 1 ] P z
+ [ 3 0 1 ] Q z
+ [ 3 1 0 ] R z
+ [ 3 1 0 ] S z
+ [ 3 1 1 ] T z
+ [ 3 1 1 ] U z
+ [ 3 2 0 ] V z
+ [ 3 2 0 ] W z
+ [ 3 2 1 ] X z
+ [ 3 2 1 ] Z z
+ */
+
+ tid = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(tid, (size_t)STR_SIZE);
+ write_attr(loc_id,3,dims3,"string3D",tid,buf13);
+ status = H5Tclose(tid);
+
+ for (i=0; i<4; i++)
+ {
+ for (j=0; j<3; j++)
+ {
+ for (k=0; k<2; k++)
+ {
+ buf13a[i][j][k]=buf13[i][j][k];
+ }
+ }
+ }
+ tid = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(tid, H5T_VARIABLE);
+ write_attr(loc_id,3,dims3,"VLstring3D",tid,buf13a);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_BITFIELD
+ *-------------------------------------------------------------------------
+ */
+
+ n=1;
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < 3; j++) {
+ for (k = 0; k < 2; k++) {
+ if(make_diffs)
+ buf23[i][j][k] = 0;
+ else
+ buf23[i][j][k] = (char)n++;
+ }
+ }
+ }
+
+ /*
+ position bitfield3D of </g1> bitfield3D of </g1> difference
+ ------------------------------------------------------------
+ [ 0 0 0 ] 1 0 1
+ [ 0 0 1 ] 2 0 2
+ [ 0 1 0 ] 3 0 3
+ [ 0 1 1 ] 4 0 4
+ [ 0 2 0 ] 5 0 5
+ [ 0 2 1 ] 6 0 6
+ [ 1 0 0 ] 7 0 7
+ [ 1 0 1 ] 8 0 8
+ [ 1 1 0 ] 9 0 9
+ [ 1 1 1 ] 10 0 10
+ [ 1 2 0 ] 11 0 11
+ [ 1 2 1 ] 12 0 12
+ [ 2 0 0 ] 13 0 13
+ [ 2 0 1 ] 14 0 14
+ [ 2 1 0 ] 15 0 15
+ [ 2 1 1 ] 16 0 16
+ [ 2 2 0 ] 17 0 17
+ [ 2 2 1 ] 18 0 18
+ [ 3 0 0 ] 19 0 19
+ [ 3 0 1 ] 20 0 20
+ [ 3 1 0 ] 21 0 21
+ [ 3 1 1 ] 22 0 22
+ [ 3 2 0 ] 23 0 23
+ [ 3 2 1 ] 24 0 24
+ */
+
+ tid = H5Tcopy(H5T_STD_B8LE);
+ write_attr(loc_id,3,dims3,"bitfield3D",tid,buf23);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_OPAQUE
+ *-------------------------------------------------------------------------
+ */
+ tid = H5Tcreate(H5T_OPAQUE, (size_t)1);
+ status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */
+ write_attr(loc_id,3,dims3,"opaque3D",tid,buf23);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_COMPOUND
+ *-------------------------------------------------------------------------
+ */
+
+ n=1;
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < 3; j++) {
+ for (k = 0; k < 2; k++) {
+ if (make_diffs) {
+ buf33[i][j][k].a = 0;
+ buf33[i][j][k].b = 0.0F;
+ }
+ else {
+ buf33[i][j][k].a = (char)n++;
+ buf33[i][j][k].b = n++;
+ }
+ }
+ }
+ }
+ /*position compound3D of </g1> compound3D of </g1> difference
+ ------------------------------------------------------------
+ [ 0 0 0 ] 1 0 1
+ [ 0 0 0 ] 2 0 2
+ [ 0 0 1 ] 3 0 3
+ [ 0 0 1 ] 4 0 4
+ [ 0 1 0 ] 5 0 5
+ [ 0 1 0 ] 6 0 6
+ [ 0 1 1 ] 7 0 7
+ [ 0 1 1 ] 8 0 8
+ [ 0 2 0 ] 9 0 9
+ [ 0 2 0 ] 10 0 10
+ [ 0 2 1 ] 11 0 11
+ [ 0 2 1 ] 12 0 12
+ [ 1 0 0 ] 13 0 13
+ [ 1 0 0 ] 14 0 14
+ [ 1 0 1 ] 15 0 15
+ [ 1 0 1 ] 16 0 16
+ [ 1 1 0 ] 17 0 17
+ [ 1 1 0 ] 18 0 18
+ [ 1 1 1 ] 19 0 19
+ [ 1 1 1 ] 20 0 20
+ [ 1 2 0 ] 21 0 21
+ [ 1 2 0 ] 22 0 22
+ [ 1 2 1 ] 23 0 23
+ [ 1 2 1 ] 24 0 24
+ [ 2 0 0 ] 25 0 25
+ [ 2 0 0 ] 26 0 26
+ [ 2 0 1 ] 27 0 27
+ [ 2 0 1 ] 28 0 28
+ [ 2 1 0 ] 29 0 29
+ [ 2 1 0 ] 30 0 30
+ [ 2 1 1 ] 31 0 31
+ [ 2 1 1 ] 32 0 32
+ [ 2 2 0 ] 33 0 33
+ [ 2 2 0 ] 34 0 34
+ [ 2 2 1 ] 35 0 35
+ [ 2 2 1 ] 36 0 36
+ [ 3 0 0 ] 37 0 37
+ [ 3 0 0 ] 38 0 38
+ [ 3 0 1 ] 39 0 39
+ [ 3 0 1 ] 40 0 40
+ [ 3 1 0 ] 41 0 41
+ [ 3 1 0 ] 42 0 42
+ [ 3 1 1 ] 43 0 43
+ [ 3 1 1 ] 44 0 44
+ [ 3 2 0 ] 45 0 45
+ [ 3 2 0 ] 46 0 46
+ [ 3 2 1 ] 47 0 47
+ [ 3 2 1 ] 48 0 48
+ */
+
+ tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t));
+ H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR);
+ H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE);
+ write_attr(loc_id,3,dims3,"compound3D",tid,buf33);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_REFERENCE (H5R_OBJECT object reference)
+ *-------------------------------------------------------------------------
+ */
+ /* Create references to dataset */
+ if (dset_name)
+ {
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < 3; j++) {
+ for (k = 0; k < 2; k++)
+ status=H5Rcreate(&buf43[i][j][k],fid,dset_name,H5R_OBJECT,(hid_t)-1);
+ }
+ }
+ write_attr(loc_id,3,dims3,"reference3D",H5T_STD_REF_OBJ,buf43);
+ }
+
+ /*-------------------------------------------------------------------------
+ * H5T_ENUM
+ *-------------------------------------------------------------------------
+ */
+
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < 3; j++) {
+ for (k = 0; k < 2; k++) {
+ if (make_diffs) buf453[i][j][k]=RED; else buf453[i][j][k]=GREEN;
+ }
+ }
+ }
+
+ /*
+ position enum3D of </g1> enum3D of </g1> difference
+ ------------------------------------------------------------
+ [ 0 0 0 ] GREEN RED
+ [ 0 0 1 ] GREEN RED
+ [ 0 1 0 ] GREEN RED
+ [ 0 1 1 ] GREEN RED
+ [ 0 2 0 ] GREEN RED
+ [ 0 2 1 ] GREEN RED
+ [ 1 0 0 ] GREEN RED
+ [ 1 0 1 ] GREEN RED
+ [ 1 1 0 ] GREEN RED
+ [ 1 1 1 ] GREEN RED
+ [ 1 2 0 ] GREEN RED
+ [ 1 2 1 ] GREEN RED
+ [ 2 0 0 ] GREEN RED
+ [ 2 0 1 ] GREEN RED
+ [ 2 1 0 ] GREEN RED
+ [ 2 1 1 ] GREEN RED
+ [ 2 2 0 ] GREEN RED
+ [ 2 2 1 ] GREEN RED
+ [ 3 0 0 ] GREEN RED
+ [ 3 0 1 ] GREEN RED
+ [ 3 1 0 ] GREEN RED
+ [ 3 1 1 ] GREEN RED
+ [ 3 2 0 ] GREEN RED
+ [ 3 2 1 ] GREEN RED
+ */
+
+
+ tid = H5Tcreate(H5T_ENUM, sizeof(e_t));
+ H5Tenum_insert(tid, "RED", (val = 0, &val));
+ H5Tenum_insert(tid, "GREEN", (val = 1, &val));
+ write_attr(loc_id,3,dims3,"enum3D",tid,buf453);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_VLEN
+ *-------------------------------------------------------------------------
+ */
+
+ /* Allocate and initialize VL dataset to write */
+ n=0;
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < 3; j++) {
+ for (k = 0; k < 2; k++) {
+ buf53[i][j][k].p = HDmalloc((size_t)(i + 1) * sizeof(int));
+ buf53[i][j][k].len = (size_t)(i + 1);
+ for (l = 0; l < i + 1; l++)
+ if(make_diffs)
+ ((int *)buf53[i][j][k].p)[l] = 0;
+ else
+ ((int *)buf53[i][j][k].p)[l] = n++;
+ }
+ }
+ }
+ /*
+ position vlen3D of </g1> vlen3D of </g1> difference
+ ------------------------------------------------------------
+ [ 0 0 1 ] 1 0 1
+ [ 0 1 0 ] 2 0 2
+ [ 0 1 1 ] 3 0 3
+ [ 0 2 0 ] 4 0 4
+ [ 0 2 1 ] 5 0 5
+ [ 1 0 0 ] 6 0 6
+ [ 1 0 0 ] 7 0 7
+ [ 1 0 1 ] 8 0 8
+ [ 1 0 1 ] 9 0 9
+ [ 1 1 0 ] 10 0 10
+ etc
+ */
+ sid = H5Screate_simple(3, dims3, NULL);
+ tid = H5Tvlen_create(H5T_NATIVE_INT);
+ aid = H5Acreate2(loc_id, "vlen3D", tid, sid, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Awrite(aid, tid, buf53);
+ assert(status >= 0);
+ status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf53);
+ assert(status >= 0);
+ status = H5Aclose(aid);
+ status = H5Tclose(tid);
+ status = H5Sclose(sid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_ARRAY
+ *-------------------------------------------------------------------------
+ */
+ n=1;
+ for (i = 0; i < 24; i++) {
+ for (j = 0; j < (int)dimarray[0]; j++) {
+ if (make_diffs) buf63[i][j]=0;
+ else buf63[i][j]=n++;
+ }
+ }
+ /*
+ position array3D of </g1> array3D of </g1> difference
+ ------------------------------------------------------------
+ [ 0 0 0 ] 1 0 1
+ [ 0 0 0 ] 2 0 2
+ [ 0 0 0 ] 3 0 3
+ [ 0 0 1 ] 4 0 4
+ [ 0 0 1 ] 5 0 5
+ [ 0 0 1 ] 6 0 6
+ [ 0 1 0 ] 7 0 7
+ etc
+ */
+
+ tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray);
+ write_attr(loc_id, 3, dims3, "array3D", tid, buf63);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_INTEGER and H5T_FLOAT
+ *-------------------------------------------------------------------------
+ */
+ n=1; f=1;
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < 3; j++) {
+ for (k = 0; k < 2; k++) {
+ if (make_diffs) {
+ buf73[i][j][k]=0;
+ buf83[i][j][k]=0.0F;
+ }
+ else {
+ buf73[i][j][k]=n++;
+ buf83[i][j][k]=f++;
+ }
+ }
+ }
+ }
+
+ /*
+ position integer3D of </g1> integer3D of </g1> difference
+ ------------------------------------------------------------
+ [ 0 0 0 ] 1 0 1
+ [ 0 0 1 ] 2 0 2
+ [ 0 1 0 ] 3 0 3
+ [ 0 1 1 ] 4 0 4
+ [ 0 2 0 ] 5 0 5
+ [ 0 2 1 ] 6 0 6
+ [ 1 0 0 ] 7 0 7
+ [ 1 0 1 ] 8 0 8
+ [ 1 1 0 ] 9 0 9
+ [ 1 1 1 ] 10 0 10
+ etc
+ */
+ write_attr(loc_id,3,dims3,"integer3D",H5T_NATIVE_INT,buf73);
+ write_attr(loc_id,3,dims3,"float3D",H5T_NATIVE_FLOAT,buf83);
+}
+
+
+
+/*-------------------------------------------------------------------------
+* Function: write_dset_in
+*
+* Purpose: write datasets in LOC_ID
+*
+*-------------------------------------------------------------------------
+*/
+static
+void write_dset_in(hid_t loc_id,
+ const char* dset_name, /* for saving reference to dataset*/
+ hid_t fid,
+ int make_diffs /* flag to modify data buffers */)
+{
+ /* Compound datatype */
+ typedef struct s_t
+ {
+ char a;
+ double b;
+ } s_t;
+
+ typedef enum
+ {
+ RED,
+ GREEN
+ } e_t;
+
+ hid_t did;
+ hid_t sid;
+ hid_t tid;
+ hid_t dcpl;
+ herr_t status;
+ int val, i, j, k, l, n;
+ float f;
+ int fillvalue=2;
+ int scalar_data = 2;
+
+ /* create 1D attributes with dimension [2], 2 elements */
+ hsize_t dims[1]={2};
+ char buf1[2][STR_SIZE]= {"ab","de"}; /* string */
+ char *buf1a[2]; /* VL string */
+ char buf2[2]= {1,2}; /* bitfield, opaque */
+ s_t buf3[2]= {{1,2.0F},{3,4.0F}}; /* compound */
+ hobj_ref_t buf4[2]; /* reference */
+ e_t buf45[2]= {RED,GREEN}; /* enum */
+ hvl_t buf5[2]; /* vlen */
+ hsize_t dimarray[1]={3}; /* array dimension */
+ int buf6[2][3]= {{1,2,3},{4,5,6}}; /* array */
+ int buf7[2]= {1,2}; /* integer */
+ float buf8[2]= {1.0F,2.0F}; /* float */
+
+ /* create 2D attributes with dimension [3][2], 6 elements */
+ hsize_t dims2[2]={3,2};
+ char buf12[3][2][STR_SIZE]= {{"ab","cd"},{"ef","gh"},{"ij","kl"}}; /* string */
+ char *buf12a[3][2]; /* VL string */
+ char buf22[3][2]= {{1,2},{3,4},{5,6}}; /* bitfield, opaque */
+ s_t buf32[6]= {{1,2.0F},{3,4.0F},{5,6.0F},{7,8.0F},{9,10.0F},{11,12.0F}}; /* compound */
+ hobj_ref_t buf42[3][2]; /* reference */
+ hvl_t buf52[3][2]; /* vlen */
+ int buf62[6][3]= {{1,2,3},{4,5,6},{7,8,9},{10,11,12},{13,14,15},{16,17,18}}; /* array */
+ int buf72[3][2]= {{1,2},{3,4},{5,6}}; /* integer */
+ float buf82[3][2]= {{1.0F,2.0F},{3.0F,4.0F},{5.0F,6.0F}}; /* float */
+
+ /* create 3D attributes with dimension [4][3][2], 24 elements */
+ hsize_t dims3[3]={4,3,2};
+ char buf13[4][3][2][STR_SIZE]= {{{"ab","cd"},{"ef","gh"},{"ij","kl"}},
+ {{"mn","pq"},{"rs","tu"},{"vw","xz"}},
+ {{"AB","CD"},{"EF","GH"},{"IJ","KL"}},
+ {{"MN","PQ"},{"RS","TU"},{"VW","XZ"}}}; /* string */
+ char *buf13a[4][3][2]; /* VL string */
+ char buf23[4][3][2]; /* bitfield, opaque */
+ s_t buf33[4][3][2]; /* compound */
+ hobj_ref_t buf43[4][3][2]; /* reference */
+ hvl_t buf53[4][3][2]; /* vlen */
+ int buf63[24][3]; /* array */
+ int buf73[4][3][2]; /* integer */
+ float buf83[4][3][2]; /* float */
+
+
+ /*-------------------------------------------------------------------------
+ * H5S_SCALAR
+ *-------------------------------------------------------------------------
+ */
+
+
+
+ if ( make_diffs )
+ {
+
+ scalar_data = 1;
+ }
+
+ /* create a space */
+ sid = H5Screate(H5S_SCALAR);
+
+ /* create a dataset */
+ did = H5Dcreate2(loc_id, "scalar", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* write */
+ H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &scalar_data);
+
+ /* close */
+ H5Dclose(did);
+ H5Sclose(sid);
+
+
+ /*-------------------------------------------------------------------------
+ * 1D
+ *-------------------------------------------------------------------------
+ */
+
+ /*-------------------------------------------------------------------------
+ * H5T_STRING
+ *-------------------------------------------------------------------------
+ */
+
+
+ if (make_diffs)
+ {
+ for (i=0; i<2; i++)
+ for (j=0; j<2; j++)
+ buf1[i][j]='z';
+ }
+
+
+ tid = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(tid,(size_t)STR_SIZE);
+ write_dset(loc_id,1,dims,"string",tid,buf1);
+ status = H5Tclose(tid);
+
+ for (i=0; i<2; i++)
+ {
+ buf1a[i]=buf1[i];
+ }
+ tid = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(tid, H5T_VARIABLE);
+ write_dset(loc_id,1,dims,"VLstring",tid,buf1a);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_BITFIELD
+ *-------------------------------------------------------------------------
+ */
+
+ if (make_diffs)
+ {
+ for (i=0; i<2; i++)
+ buf2[i]=buf2[1]=0;
+ }
+
+ tid = H5Tcopy(H5T_STD_B8LE);
+ write_dset(loc_id,1,dims,"bitfield",tid,buf2);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_OPAQUE
+ *-------------------------------------------------------------------------
+ */
+
+ if (make_diffs)
+ {
+ for (i=0; i<2; i++)
+ {
+ buf3[i].a=0; buf3[i].b=0;
+ }
+ }
+
+ tid = H5Tcreate(H5T_OPAQUE, (size_t)1);
+ status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */
+ write_dset(loc_id,1,dims,"opaque",tid,buf2);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_COMPOUND
+ *-------------------------------------------------------------------------
+ */
+
+
+ if (make_diffs)
+ {
+ for (i=0; i<2; i++)
+ {
+ buf45[i]=GREEN;
+ }
+ }
+
+ tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t));
+ H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR);
+ H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE);
+ write_dset(loc_id,1,dims,"compound",tid,buf3);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_REFERENCE (H5R_OBJECT object reference)
+ *-------------------------------------------------------------------------
+ */
+ /* Create references to dataset */
+ if (dset_name)
+ {
+ status=H5Rcreate(&buf4[0],fid,dset_name,H5R_OBJECT,(hid_t)-1);
+ status=H5Rcreate(&buf4[1],fid,dset_name,H5R_OBJECT,(hid_t)-1);
+ write_dset(loc_id,1,dims,"reference",H5T_STD_REF_OBJ,buf4);
+ }
+
+ /*-------------------------------------------------------------------------
+ * H5T_REFERENCE (H5R_DATASET_REGION dataset region reference)
+ *-------------------------------------------------------------------------
+ */
+
+ gen_datareg(fid,make_diffs);
+
+ /*-------------------------------------------------------------------------
+ * H5T_ENUM
+ *-------------------------------------------------------------------------
+ */
+ tid = H5Tcreate(H5T_ENUM, sizeof(e_t));
+ H5Tenum_insert(tid, "RED", (val = 0, &val));
+ H5Tenum_insert(tid, "GREEN", (val = 1, &val));
+ write_dset(loc_id,1,dims,"enum",tid,buf45);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_VLEN
+ *-------------------------------------------------------------------------
+ */
+
+ /* Allocate and initialize VL dataset to write */
+
+ buf5[0].len = 1;
+ buf5[0].p = HDmalloc( 1 * sizeof(int));
+ ((int *)buf5[0].p)[0]=1;
+ buf5[1].len = 2;
+ buf5[1].p = HDmalloc( 2 * sizeof(int));
+ ((int *)buf5[1].p)[0]=2;
+ ((int *)buf5[1].p)[1]=3;
+
+ if(make_diffs) {
+ ((int *)buf5[0].p)[0] = 0;
+ ((int *)buf5[1].p)[0] = 0;
+ ((int *)buf5[1].p)[1]=0;
+ }
+
+ sid = H5Screate_simple(1, dims, NULL);
+ tid = H5Tvlen_create(H5T_NATIVE_INT);
+ did = H5Dcreate2(loc_id, "vlen", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf5);
+ HDassert(status >= 0);
+ status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf5);
+ HDassert(status >= 0);
+ status = H5Dclose(did);
+ status = H5Tclose(tid);
+ status = H5Sclose(sid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_ARRAY
+ *-------------------------------------------------------------------------
+ */
+
+ if (make_diffs)
+ {
+ for (i=0; i<2; i++)
+ for (j=0; j<3; j++)
+ {
+ buf6[i][j]=0;
+ }
+ }
+
+ tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray);
+ write_dset(loc_id, 1, dims, "array", tid, buf6);
+ status = H5Tclose(tid);
+
+ {
+ double *dbuf; /* information to write */
+ hid_t ldid; /* dataset ID */
+ hid_t lsid; /* dataspace ID */
+ hid_t ltid; /* datatype ID */
+ size_t size;
+ hsize_t sdims[] = {1};
+ hsize_t tdims[] = {H5TOOLS_MALLOCSIZE / sizeof(double) + 1};
+ size_t jj;
+
+ /* allocate and initialize array data to write */
+ size = ( H5TOOLS_MALLOCSIZE / sizeof(double) + 1 ) * sizeof(double);
+ dbuf = (double *)HDmalloc(size);
+
+ for(jj = 0; jj < (H5TOOLS_MALLOCSIZE / sizeof(double) + 1); jj++)
+ dbuf[jj] = (double)jj;
+
+ if (make_diffs)
+ {
+ dbuf[5] = 0;
+ dbuf[6] = 0;
+ }
+
+ /* create a type larger than H5TOOLS_MALLOCSIZE */
+ ltid = H5Tarray_create2(H5T_NATIVE_DOUBLE, 1, tdims);
+ size = H5Tget_size(ltid);
+ lsid = H5Screate_simple(1, sdims, NULL);
+ ldid = H5Dcreate2(loc_id, "arrayd", ltid, lsid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+#if defined(WRITE_ARRAY)
+ H5Dwrite(ldid, ltid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dbuf);
+#endif
+
+ /* close */
+ H5Dclose(ldid);
+ H5Tclose(ltid);
+ H5Sclose(lsid);
+ HDfree(dbuf);
+ }
+
+ /*-------------------------------------------------------------------------
+ * H5T_INTEGER and H5T_FLOAT
+ *-------------------------------------------------------------------------
+ */
+
+ if (make_diffs)
+ {
+ for (i=0; i<2; i++)
+ {
+ buf7[i]=0;
+ buf8[i]=0;
+ }
+ }
+
+ write_dset(loc_id,1,dims,"integer",H5T_NATIVE_INT,buf7);
+ write_dset(loc_id,1,dims,"float",H5T_NATIVE_FLOAT,buf8);
+
+
+ /*-------------------------------------------------------------------------
+ * 2D
+ *-------------------------------------------------------------------------
+ */
+
+ /*-------------------------------------------------------------------------
+ * H5T_STRING
+ *-------------------------------------------------------------------------
+ */
+
+ if (make_diffs)
+ {
+ for (i=0; i<3; i++)
+ for (j=0; j<2; j++)
+ for (k=0; k<2; k++)
+ buf12[i][j][k]='z';
+ }
+
+
+ tid = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(tid,(size_t)STR_SIZE);
+ write_dset(loc_id,2,dims2,"string2D",tid,buf12);
+ status = H5Tclose(tid);
+
+ for (i=0; i<3; i++)
+ {
+ for (j=0; j<2; j++)
+ {
+ buf12a[i][j]=buf12[i][j];
+ }
+ }
+ tid = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(tid, H5T_VARIABLE);
+ write_dset(loc_id,2,dims2,"VLstring2D",tid,buf12a);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_BITFIELD
+ *-------------------------------------------------------------------------
+ */
+
+
+ if (make_diffs)
+ {
+ memset(buf22,0,sizeof buf22);
+ }
+
+ tid = H5Tcopy(H5T_STD_B8LE);
+ write_dset(loc_id,2,dims2,"bitfield2D",tid,buf22);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_OPAQUE
+ *-------------------------------------------------------------------------
+ */
+ tid = H5Tcreate(H5T_OPAQUE, (size_t)1);
+ status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */
+ write_dset(loc_id,2,dims2,"opaque2D",tid,buf22);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_COMPOUND
+ *-------------------------------------------------------------------------
+ */
+
+ if (make_diffs)
+ {
+ memset(buf32,0,sizeof buf32);
+ }
+
+ tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t));
+ H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR);
+ H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE);
+ write_dset(loc_id,2,dims2,"compound2D",tid,buf32);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_REFERENCE (H5R_OBJECT object reference)
+ *-------------------------------------------------------------------------
+ */
+ /* Create references to dataset */
+ if (dset_name)
+ {
+ for (i = 0; i < 3; i++) {
+ for (j = 0; j < 2; j++) {
+ status=H5Rcreate(&buf42[i][j],fid,dset_name,H5R_OBJECT,(hid_t)-1);
+ }
+ }
+ write_dset(loc_id,2,dims2,"reference2D",H5T_STD_REF_OBJ,buf42);
+ }
+
+ /*-------------------------------------------------------------------------
+ * H5T_ENUM
+ *-------------------------------------------------------------------------
+ */
+
+ tid = H5Tcreate(H5T_ENUM, sizeof(e_t));
+ H5Tenum_insert(tid, "RED", (val = 0, &val));
+ H5Tenum_insert(tid, "GREEN", (val = 1, &val));
+ write_dset(loc_id,2,dims2,"enum2D",tid,0);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_VLEN
+ *-------------------------------------------------------------------------
+ */
+
+ /* Allocate and initialize VL dataset to write */
+ n = 0;
+ for(i = 0; i < 3; i++) {
+ for(j = 0; j < 2; j++) {
+ buf52[i][j].p = HDmalloc((size_t)(i + 1) * sizeof(int));
+ 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++;
+ }
+ }
+ }
+
+ sid = H5Screate_simple(2, dims2, NULL);
+ tid = H5Tvlen_create(H5T_NATIVE_INT);
+ did = H5Dcreate2(loc_id, "vlen2D", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf52);
+ assert(status >= 0);
+ status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf52);
+ assert(status >= 0);
+ status = H5Dclose(did);
+ status = H5Tclose(tid);
+ status = H5Sclose(sid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_ARRAY
+ *-------------------------------------------------------------------------
+ */
+
+ if (make_diffs)
+ {
+ memset(buf62,0,sizeof buf62);
+ }
+
+
+ tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray);
+ write_dset(loc_id, 2, dims2, "array2D", tid, buf62);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_INTEGER, write a fill value
+ *-------------------------------------------------------------------------
+ */
+
+
+ if (make_diffs)
+ {
+ memset(buf72, 0, sizeof buf72);
+ memset(buf82, 0, sizeof buf82);
+ }
+
+
+ dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ status = H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillvalue);
+ sid = H5Screate_simple(2, dims2, NULL);
+ did = H5Dcreate2(loc_id, "integer2D", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ status = H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf72);
+ status = H5Pclose(dcpl);
+ status = H5Dclose(did);
+ status = H5Sclose(sid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_FLOAT
+ *-------------------------------------------------------------------------
+ */
+
+ write_dset(loc_id,2,dims2,"float2D",H5T_NATIVE_FLOAT,buf82);
+
+
+ /*-------------------------------------------------------------------------
+ * 3D
+ *-------------------------------------------------------------------------
+ */
+
+ /*-------------------------------------------------------------------------
+ * H5T_STRING
+ *-------------------------------------------------------------------------
+ */
+
+ if (make_diffs)
+ {
+ for (i=0; i<4; i++)
+ for (j=0; j<3; j++)
+ for (k=0; k<2; k++)
+ for (l=0; l<2; l++)
+ buf13[i][j][k][l]='z';
+ }
+
+ tid = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(tid,(size_t)STR_SIZE);
+ write_dset(loc_id,3,dims3,"string3D",tid,buf13);
+ status = H5Tclose(tid);
+
+ for (i=0; i<4; i++)
+ {
+ for (j=0; j<3; j++)
+ {
+ for (k=0; k<2; k++)
+ {
+ buf13a[i][j][k]=buf13[i][j][k];
+ }
+ }
+ }
+ tid = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(tid, H5T_VARIABLE);
+ write_dset(loc_id,3,dims3,"VLstring3D",tid,buf13a);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_BITFIELD
+ *-------------------------------------------------------------------------
+ */
+
+
+ n=1;
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < 3; j++) {
+ for (k = 0; k < 2; k++) {
+ if(make_diffs)
+ buf23[i][j][k] = 0;
+ else
+ buf23[i][j][k] = (char)n++;
+ }
+ }
+ }
+
+
+ tid = H5Tcopy(H5T_STD_B8LE);
+ write_dset(loc_id,3,dims3,"bitfield3D",tid,buf23);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_OPAQUE
+ *-------------------------------------------------------------------------
+ */
+ tid = H5Tcreate(H5T_OPAQUE, (size_t)1);
+ status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */
+ write_dset(loc_id,3,dims3,"opaque3D",tid,buf23);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_COMPOUND
+ *-------------------------------------------------------------------------
+ */
+
+ n=1;
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < 3; j++) {
+ for (k = 0; k < 2; k++) {
+ if (make_diffs) {
+ buf33[i][j][k].a = 0;
+ buf33[i][j][k].b = 0.0F;
+ }
+ else {
+ buf33[i][j][k].a = (char)n++;
+ buf33[i][j][k].b = n++;
+ }
+ }
+ }
+ }
+
+
+ tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t));
+ H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR);
+ H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE);
+ write_dset(loc_id,3,dims3,"compound3D",tid,buf33);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_REFERENCE (H5R_OBJECT object reference)
+ *-------------------------------------------------------------------------
+ */
+ /* Create references to dataset */
+ if (dset_name)
+ {
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < 3; j++) {
+ for (k = 0; k < 2; k++)
+ status=H5Rcreate(&buf43[i][j][k],fid,dset_name,H5R_OBJECT,(hid_t)-1);
+ }
+ }
+ write_dset(loc_id,3,dims3,"reference3D",H5T_STD_REF_OBJ,buf43);
+ }
+
+ /*-------------------------------------------------------------------------
+ * H5T_ENUM
+ *-------------------------------------------------------------------------
+ */
+
+ tid = H5Tcreate(H5T_ENUM, sizeof(e_t));
+ H5Tenum_insert(tid, "RED", (val = 0, &val));
+ H5Tenum_insert(tid, "GREEN", (val = 1, &val));
+ write_dset(loc_id,3,dims3,"enum3D",tid,0);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_VLEN
+ *-------------------------------------------------------------------------
+ */
+
+ /* Allocate and initialize VL dataset to write */
+ n=0;
+ for(i = 0; i < 4; i++) {
+ for(j = 0; j < 3; j++) {
+ for(k = 0; k < 2; k++) {
+ buf53[i][j][k].p = HDmalloc((size_t)(i + 1) * sizeof(int));
+ buf53[i][j][k].len = (size_t)(i + 1);
+ for(l = 0; l < i + 1; l++) {
+ if(make_diffs)
+ ((int *)buf53[i][j][k].p)[l] = 0;
+ else
+ ((int *)buf53[i][j][k].p)[l] = n++;
+ }
+ }
+ }
+ }
+
+ sid = H5Screate_simple(3, dims3, NULL);
+ tid = H5Tvlen_create(H5T_NATIVE_INT);
+ did = H5Dcreate2(loc_id, "vlen3D", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf53);
+ assert(status >= 0);
+ status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf53);
+ assert(status >= 0);
+ status = H5Dclose(did);
+ status = H5Tclose(tid);
+ status = H5Sclose(sid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_ARRAY
+ *-------------------------------------------------------------------------
+ */
+
+
+ n=1;
+ for (i = 0; i < 24; i++) {
+ for (j = 0; j < (int)dimarray[0]; j++) {
+ if (make_diffs) buf63[i][j]=0;
+ else buf63[i][j]=n++;
+ }
+ }
+
+ tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray);
+ write_dset(loc_id, 3, dims3, "array3D", tid, buf63);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_INTEGER and H5T_FLOAT
+ *-------------------------------------------------------------------------
+ */
+ n=1; f=1;
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < 3; j++) {
+ for (k = 0; k < 2; k++) {
+ if (make_diffs) {
+ buf73[i][j][k]=0;
+ buf83[i][j][k]=0.0F;
+ }
+ else {
+ buf73[i][j][k]=n++;
+ buf83[i][j][k]=f++;
+ }
+ }
+ }
+ }
+ write_dset(loc_id,3,dims3,"integer3D",H5T_NATIVE_INT,buf73);
+ write_dset(loc_id,3,dims3,"float3D",H5T_NATIVE_FLOAT,buf83);
+}
+
+/*-------------------------------------------------------------------------
+* Function: gen_datareg
+*
+* Purpose: generate a dataset region and its reference
+*
+* Date: April 19, 2006
+*
+*-------------------------------------------------------------------------
+*/
+
+static
+void gen_datareg(hid_t fid,
+ int make_diffs /* flag to modify data buffers */)
+{
+ /* data dataset */
+ hid_t did1; /* dataset ID */
+ hid_t sid1; /* dataspace ID */
+ hsize_t dims1[2] = {10,10};/* dimensions */
+ int *buf; /* dataset buffer */
+ /* reference dataset */
+ hid_t did2; /* dataset ID */
+ hid_t sid2; /* dataspace ID */
+ hsize_t dims2[] = {2}; /* 2 references */
+ hdset_reg_ref_t *rbuf; /* buffer for write the references */
+ hsize_t start[10]; /* starting location of hyperslab */
+ hsize_t count[10]; /* element count of hyperslab */
+ hsize_t coord[5][2]; /* coordinates for point selection */
+ herr_t status;
+ int i;
+
+ /* allocate the buffer for write the references */
+ rbuf = (hdset_reg_ref_t *)HDcalloc((size_t)2, sizeof(hdset_reg_ref_t));
+
+ /* allocate the buffer for write the data dataset */
+ buf = (int *)HDmalloc(10 * 10 * sizeof(int));
+
+ for(i = 0; i < 10 * 10; i++)
+ buf[i] = i;
+
+ /* create the data dataset */
+ sid1 = H5Screate_simple(2, dims1, NULL);
+ did1 = H5Dcreate2(fid, "dsetref", H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
+ HDassert(status >= 0);
+
+ /* create the reference dataset */
+ sid2 = H5Screate_simple(1, dims2, NULL);
+ did2 = H5Dcreate2(fid, "refreg", H5T_STD_REF_DSETREG, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* create the references */
+ /* select hyperslab for first reference */
+
+ start[0] = 2; start[1] = 2;
+ count[0] = 6; count[1] = 6;
+ if(make_diffs) {
+ start[0] = 0; start[1] = 0;
+ count[0] = 3; count[1] = 3;
+ }
+
+ status = H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, NULL, count, NULL);
+ HDassert(status >= 0);
+ H5Sget_select_npoints(sid1);
+
+ /* store first dataset region */
+ status = H5Rcreate(&rbuf[0], fid, "dsetref", H5R_DATASET_REGION, sid1);
+ HDassert(status >= 0);
+
+ /* select sequence of five points for second reference */
+ coord[0][0]=6; coord[0][1]=9;
+ coord[1][0]=2; coord[1][1]=2;
+ coord[2][0]=8; coord[2][1]=4;
+ coord[3][0]=1; coord[3][1]=6;
+ coord[4][0]=2; coord[4][1]=8;
+ if (make_diffs)
+ {
+ coord[1][0]=3; coord[1][1]=3;
+ coord[3][0]=2; coord[3][1]=5;
+ coord[4][0]=1; coord[4][1]=7;
+ }
+ H5Sselect_elements(sid1,H5S_SELECT_SET,(size_t)5,(const hsize_t *)coord);
+ H5Sget_select_npoints(sid1);
+
+ /* store second dataset region */
+ H5Rcreate(&rbuf[1],fid,"dsetref",H5R_DATASET_REGION,sid1);
+
+ /* write */
+ status = H5Dwrite(did2,H5T_STD_REF_DSETREG,H5S_ALL,H5S_ALL,H5P_DEFAULT,rbuf);
+ HDassert(status >= 0);
+
+ /* close, free memory buffers */
+ status = H5Dclose(did1);
+ HDassert(status >= 0);
+ status = H5Sclose(sid1);
+ HDassert(status >= 0);
+ status = H5Dclose(did2);
+ HDassert(status >= 0);
+ status = H5Sclose(sid2);
+ HDassert(status >= 0);
+
+ HDfree(rbuf);
+ HDfree(buf);
+}
+
+
+/*-------------------------------------------------------------------------
+* Function: test_hyperslab
+*
+* Purpose: test diff by hyperslabs. create a dataset with 1GB dimensions
+* by iterating trough 1KB hyperslabs
+*
+*-------------------------------------------------------------------------
+*/
+static
+int test_hyperslab(const char *fname,
+ int make_diffs /* flag to modify data buffers */)
+{
+ hid_t did=-1;
+ hid_t fid=-1;
+ hid_t f_sid=-1;
+ hid_t m_sid=-1;
+ hid_t tid=-1;
+ hid_t dcpl=-1;
+ hsize_t dims[1]={GBLL}; /* dataset dimensions */
+ hsize_t hs_size[1]={GBLL/(1024*1024)}; /* hyperslab dimensions */
+ hsize_t chunk_dims[1]={GBLL/1024}; /* chunk dimensions */
+ hsize_t hs_start[1];
+ size_t size;
+ size_t nelmts=(size_t)GBLL/(1024*1024); /* elements in each hyperslab */
+ char fillvalue=-1;
+ char *buf=NULL;
+ int i, j, s;
+ char c;
+
+ /* create */
+ fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto out;
+ if(H5Pset_fill_value(dcpl, H5T_NATIVE_CHAR, &fillvalue) < 0)
+ goto out;
+ if(H5Pset_chunk(dcpl, 1, chunk_dims) < 0)
+ goto out;
+ if((f_sid = H5Screate_simple(1, dims, NULL)) < 0)
+ goto out;
+ if((did = H5Dcreate2(fid, "big", H5T_NATIVE_CHAR, f_sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto out;
+ if((m_sid = H5Screate_simple(1, hs_size, hs_size)) < 0)
+ goto out;
+ if((tid = H5Dget_type(did)) < 0)
+ goto out;
+ if((size = H5Tget_size(tid)) <= 0)
+ goto out;
+
+ /* create a evenly divided buffer from 0 to 127 */
+ buf = (char *)HDmalloc((size_t)(nelmts * size));
+ s = 1024 * 1024 / 127;
+ for(i = 0, j = 0, c = 0; i < 1024 * 1024; j++, i++) {
+ if(j == s) {
+ c++;
+ j = 0;
+ }
+
+ /* set the hyperslab values */
+ HDmemset(buf, c, nelmts);
+
+ /* make a different hyperslab at this position */
+ if(make_diffs && i == 512 * 512)
+ HDmemset(buf, 0, nelmts);
+
+ hs_start[0] = (unsigned long long)i * GBLL / (1024 * 1024);
+ if (H5Sselect_hyperslab (f_sid,H5S_SELECT_SET,hs_start,NULL,hs_size, NULL) < 0)
+ goto out;
+
+ /* write only one hyperslab */
+ if ( i==512*512)
+ {
+ if (H5Dwrite (did,H5T_NATIVE_CHAR,m_sid,f_sid,H5P_DEFAULT,buf) < 0)
+ goto out;
+ }
+
+ }
+ HDfree(buf);
+ buf=NULL;
+
+ /* close */
+ if(H5Sclose(f_sid) < 0)
+ goto out;
+ if(H5Sclose(m_sid) < 0)
+ goto out;
+ if(H5Pclose(dcpl) < 0)
+ goto out;
+ if(H5Dclose(did) < 0)
+ goto out;
+ H5Fclose(fid);
+
+ return 0;
+
+out:
+ H5E_BEGIN_TRY {
+ H5Pclose(dcpl);
+ H5Sclose(f_sid);
+ H5Sclose(m_sid);
+ H5Dclose(did);
+ H5Fclose(fid);
+ } H5E_END_TRY;
+ return -1;
+
+}
+
+
+/*-------------------------------------------------------------------------
+* Function: write_attr
+*
+* Purpose: utility function to write an attribute in LOC_ID
+*
+*-------------------------------------------------------------------------
+*/
+static
+int write_attr(hid_t loc_id,
+ int rank,
+ hsize_t *dims,
+ const char *name,
+ hid_t tid,
+ void *buf)
+{
+ hid_t aid=-1;
+ hid_t sid=-1;
+
+ /* create a space */
+ if((sid = H5Screate_simple(rank, dims, NULL)) < 0)
+ goto out;
+
+ /* create the attribute */
+ if((aid = H5Acreate2(loc_id, name, tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
+
+ /* write */
+ if(buf)
+ {
+ if(H5Awrite(aid, tid, buf) < 0)
+ goto out;
+ }
+
+ /* close */
+ H5Aclose(aid);
+ H5Sclose(sid);
+
+ return SUCCEED;
+
+out:
+
+ H5Aclose(aid);
+ H5Sclose(sid);
+ return FAIL;
+}
+
+/*-------------------------------------------------------------------------
+* Function: write_dset
+*
+* Purpose: utility function to create and write a dataset in LOC_ID
+*
+*-------------------------------------------------------------------------
+*/
+static
+int write_dset( hid_t loc_id,
+ int rank,
+ hsize_t *dims,
+ const char *name,
+ hid_t tid,
+ void *buf )
+{
+ hid_t did=-1;
+ hid_t sid=-1;
+
+ /* create a space */
+ if((sid = H5Screate_simple(rank, dims, NULL)) < 0)
+ goto out;
+
+ /* create the dataset */
+ if((did = H5Dcreate2(loc_id, name, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
+
+ /* write */
+ if(buf)
+ {
+ if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ goto out;
+ }
+
+ /* close */
+ H5Dclose(did);
+ H5Sclose(sid);
+
+ return SUCCEED;
+
+out:
+
+ H5Dclose(did);
+ H5Sclose(sid);
+ return FAIL;
+}
+
diff --git a/tools/test/h5diff/testfiles/compounds_array_vlen1.h5 b/tools/test/h5diff/testfiles/compounds_array_vlen1.h5
new file mode 100644
index 0000000..398026c
--- /dev/null
+++ b/tools/test/h5diff/testfiles/compounds_array_vlen1.h5
Binary files differ
diff --git a/tools/test/h5diff/testfiles/compounds_array_vlen2.h5 b/tools/test/h5diff/testfiles/compounds_array_vlen2.h5
new file mode 100644
index 0000000..f6f0868
--- /dev/null
+++ b/tools/test/h5diff/testfiles/compounds_array_vlen2.h5
Binary files differ
diff --git a/tools/test/h5diff/testfiles/h5diff_10.txt b/tools/test/h5diff/testfiles/h5diff_10.txt
new file mode 100644
index 0000000..a699f00
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_10.txt
@@ -0,0 +1,140 @@
+usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
+ file1 File name of the first HDF5 file
+ file2 File name of the second HDF5 file
+ [obj1] Name of an HDF5 object, in absolute path
+ [obj2] Name of an HDF5 object, in absolute path
+
+ OPTIONS
+ -h, --help
+ Print a usage message and exit.
+ -V, --version
+ Print version number and exit.
+ -r, --report
+ Report mode. Print differences.
+ -v --verbose
+ Verbose mode. Print differences information and list of objects.
+ -vN --verbose=N
+ Verbose mode with level. Print differences and list of objects.
+ Level of detail depends on value of N:
+ 0 : Identical to '-v' or '--verbose'.
+ 1 : All level 0 information plus one-line attribute
+ status summary.
+ 2 : All level 1 information plus extended attribute
+ status report.
+ -q, --quiet
+ Quiet mode. Do not produce output.
+ --follow-symlinks
+ Follow symbolic links (soft links and external links and compare the)
+ links' target objects.
+ If symbolic link(s) with the same name exist in the files being
+ compared, then determine whether the target of each link is an existing
+ object (dataset, group, or named datatype) or the link is a dangling
+ link (a soft or external link pointing to a target object that does
+ not yet exist).
+ - If both symbolic links are dangling links, they are treated as being
+ the same; by default, h5diff returns an exit code of 0.
+ If, however, --no-dangling-links is used with --follow-symlinks,
+ this situation is treated as an error and h5diff returns an
+ exit code of 2.
+ - If only one of the two links is a dangling link,they are treated as
+ being different and h5diff returns an exit code of 1.
+ If, however, --no-dangling-links is used with --follow-symlinks,
+ this situation is treated as an error and h5diff returns an
+ exit code of 2.
+ - If both symbolic links point to existing objects, h5diff compares the
+ two objects.
+ If any symbolic link specified in the call to h5diff does not exist,
+ h5diff treats it as an error and returns an exit code of 2.
+ --no-dangling-links
+ Must be used with --follow-symlinks option; otherwise, h5diff shows
+ error message and returns an exit code of 2.
+ Check for any symbolic links (soft links or external links) that do not
+ resolve to an existing object (dataset, group, or named datatype).
+ If any dangling link is found, this situation is treated as an error
+ and h5diff returns an exit code of 2.
+ -c, --compare
+ List objects that are not comparable
+ -N, --nan
+ Avoid NaNs detection
+ -n C, --count=C
+ Print differences up to C. C must be a positive integer.
+ -d D, --delta=D
+ Print difference if (|a-b| > D). D must be a positive number.
+ Can not use with '-p' or '--use-system-epsilon'.
+ -p R, --relative=R
+ Print difference if (|(a-b)/b| > R). R must be a positive number.
+ Can not use with '-d' or '--use-system-epsilon'.
+ --use-system-epsilon
+ Print difference if (|a-b| > EPSILON), EPSILON is system defined value.
+ If the system epsilon is not defined,one of the following predefined
+ values will be used:
+ FLT_EPSILON = 1.19209E-07 for floating-point type
+ DBL_EPSILON = 2.22045E-16 for double precision type
+ Can not use with '-p' or '-d'.
+ --exclude-path "path"
+ Exclude the specified path to an object when comparing files or groups.
+ If a group is excluded, all member objects will also be excluded.
+ The specified path is excluded wherever it occurs.
+ This flexibility enables the same option to exclude either objects that
+ exist only in one file or common objects that are known to differ.
+
+ When comparing files, "path" is the absolute path to the excluded;
+ object; when comparing groups, "path" is similar to the relative
+ path from the group to the excluded object. This "path" can be
+ taken from the first section of the output of the --verbose option.
+ For example, if you are comparing the group /groupA in two files and
+ you want to exclude /groupA/groupB/groupC in both files, the exclude
+ option would read as follows:
+ --exclude-path "/groupB/groupC"
+
+ If there are multiple paths to an object, only the specified path(s)
+ will be excluded; the comparison will include any path not explicitly
+ excluded.
+ This option can be used repeatedly to exclude multiple paths.
+
+ Modes of output:
+ Default mode: print the number of differences found and where they occured
+ -r Report mode: print the above plus the differences
+ -v Verbose mode: print the above plus a list of objects and warnings
+ -q Quiet mode: do not print output
+
+ File comparison:
+ If no objects [obj1[ obj2]] are specified, the h5diff comparison proceeds as
+ a comparison of the two files' root groups. That is, h5diff first compares
+ the names of root group members, generates a report of root group objects
+ that appear in only one file or in both files, and recursively compares
+ common objects.
+
+ Object comparison:
+ 1) Groups
+ First compares the names of member objects (relative path, from the
+ specified group) and generates a report of objects that appear in only
+ one group or in both groups. Common objects are then compared recursively.
+ 2) Datasets
+ Array rank and dimensions, datatypes, and data values are compared.
+ 3) Datatypes
+ The comparison is based on the return value of H5Tequal.
+ 4) Symbolic links
+ The paths to the target objects are compared.
+ (The option --follow-symlinks overrides the default behavior when
+ symbolic links are compared.).
+
+ Exit code:
+ 0 if no differences, 1 if differences found, 2 if error
+
+ Examples of use:
+ 1) h5diff file1 file2 /g1/dset1 /g1/dset2
+ Compares object '/g1/dset1' in file1 with '/g1/dset2' in file2
+
+ 2) h5diff file1 file2 /g1/dset1
+ Compares object '/g1/dset1' in both files
+
+ 3) h5diff file1 file2
+ Compares all objects in both files
+
+ Notes:
+ file1 and file2 can be the same file.
+ Use h5diff file1 file1 /g1/dset1 /g1/dset2 to compare
+ '/g1/dset1' and '/g1/dset2' in the same file
+
+EXIT CODE: 0
diff --git a/tools/test/h5diff/testfiles/h5diff_100.txt b/tools/test/h5diff/testfiles/h5diff_100.txt
new file mode 100644
index 0000000..363daa3
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_100.txt
@@ -0,0 +1,1038 @@
+
+file1 file2
+---------------------------------------
+ x x /
+ x x /big
+
+group : </> and </>
+0 differences found
+dataset: </big> and </big>
+size: [1073741824] [1073741824]
+position big big difference
+------------------------------------------------------------
+[ 268435456 ] 31 0 31
+[ 268435457 ] 31 0 31
+[ 268435458 ] 31 0 31
+[ 268435459 ] 31 0 31
+[ 268435460 ] 31 0 31
+[ 268435461 ] 31 0 31
+[ 268435462 ] 31 0 31
+[ 268435463 ] 31 0 31
+[ 268435464 ] 31 0 31
+[ 268435465 ] 31 0 31
+[ 268435466 ] 31 0 31
+[ 268435467 ] 31 0 31
+[ 268435468 ] 31 0 31
+[ 268435469 ] 31 0 31
+[ 268435470 ] 31 0 31
+[ 268435471 ] 31 0 31
+[ 268435472 ] 31 0 31
+[ 268435473 ] 31 0 31
+[ 268435474 ] 31 0 31
+[ 268435475 ] 31 0 31
+[ 268435476 ] 31 0 31
+[ 268435477 ] 31 0 31
+[ 268435478 ] 31 0 31
+[ 268435479 ] 31 0 31
+[ 268435480 ] 31 0 31
+[ 268435481 ] 31 0 31
+[ 268435482 ] 31 0 31
+[ 268435483 ] 31 0 31
+[ 268435484 ] 31 0 31
+[ 268435485 ] 31 0 31
+[ 268435486 ] 31 0 31
+[ 268435487 ] 31 0 31
+[ 268435488 ] 31 0 31
+[ 268435489 ] 31 0 31
+[ 268435490 ] 31 0 31
+[ 268435491 ] 31 0 31
+[ 268435492 ] 31 0 31
+[ 268435493 ] 31 0 31
+[ 268435494 ] 31 0 31
+[ 268435495 ] 31 0 31
+[ 268435496 ] 31 0 31
+[ 268435497 ] 31 0 31
+[ 268435498 ] 31 0 31
+[ 268435499 ] 31 0 31
+[ 268435500 ] 31 0 31
+[ 268435501 ] 31 0 31
+[ 268435502 ] 31 0 31
+[ 268435503 ] 31 0 31
+[ 268435504 ] 31 0 31
+[ 268435505 ] 31 0 31
+[ 268435506 ] 31 0 31
+[ 268435507 ] 31 0 31
+[ 268435508 ] 31 0 31
+[ 268435509 ] 31 0 31
+[ 268435510 ] 31 0 31
+[ 268435511 ] 31 0 31
+[ 268435512 ] 31 0 31
+[ 268435513 ] 31 0 31
+[ 268435514 ] 31 0 31
+[ 268435515 ] 31 0 31
+[ 268435516 ] 31 0 31
+[ 268435517 ] 31 0 31
+[ 268435518 ] 31 0 31
+[ 268435519 ] 31 0 31
+[ 268435520 ] 31 0 31
+[ 268435521 ] 31 0 31
+[ 268435522 ] 31 0 31
+[ 268435523 ] 31 0 31
+[ 268435524 ] 31 0 31
+[ 268435525 ] 31 0 31
+[ 268435526 ] 31 0 31
+[ 268435527 ] 31 0 31
+[ 268435528 ] 31 0 31
+[ 268435529 ] 31 0 31
+[ 268435530 ] 31 0 31
+[ 268435531 ] 31 0 31
+[ 268435532 ] 31 0 31
+[ 268435533 ] 31 0 31
+[ 268435534 ] 31 0 31
+[ 268435535 ] 31 0 31
+[ 268435536 ] 31 0 31
+[ 268435537 ] 31 0 31
+[ 268435538 ] 31 0 31
+[ 268435539 ] 31 0 31
+[ 268435540 ] 31 0 31
+[ 268435541 ] 31 0 31
+[ 268435542 ] 31 0 31
+[ 268435543 ] 31 0 31
+[ 268435544 ] 31 0 31
+[ 268435545 ] 31 0 31
+[ 268435546 ] 31 0 31
+[ 268435547 ] 31 0 31
+[ 268435548 ] 31 0 31
+[ 268435549 ] 31 0 31
+[ 268435550 ] 31 0 31
+[ 268435551 ] 31 0 31
+[ 268435552 ] 31 0 31
+[ 268435553 ] 31 0 31
+[ 268435554 ] 31 0 31
+[ 268435555 ] 31 0 31
+[ 268435556 ] 31 0 31
+[ 268435557 ] 31 0 31
+[ 268435558 ] 31 0 31
+[ 268435559 ] 31 0 31
+[ 268435560 ] 31 0 31
+[ 268435561 ] 31 0 31
+[ 268435562 ] 31 0 31
+[ 268435563 ] 31 0 31
+[ 268435564 ] 31 0 31
+[ 268435565 ] 31 0 31
+[ 268435566 ] 31 0 31
+[ 268435567 ] 31 0 31
+[ 268435568 ] 31 0 31
+[ 268435569 ] 31 0 31
+[ 268435570 ] 31 0 31
+[ 268435571 ] 31 0 31
+[ 268435572 ] 31 0 31
+[ 268435573 ] 31 0 31
+[ 268435574 ] 31 0 31
+[ 268435575 ] 31 0 31
+[ 268435576 ] 31 0 31
+[ 268435577 ] 31 0 31
+[ 268435578 ] 31 0 31
+[ 268435579 ] 31 0 31
+[ 268435580 ] 31 0 31
+[ 268435581 ] 31 0 31
+[ 268435582 ] 31 0 31
+[ 268435583 ] 31 0 31
+[ 268435584 ] 31 0 31
+[ 268435585 ] 31 0 31
+[ 268435586 ] 31 0 31
+[ 268435587 ] 31 0 31
+[ 268435588 ] 31 0 31
+[ 268435589 ] 31 0 31
+[ 268435590 ] 31 0 31
+[ 268435591 ] 31 0 31
+[ 268435592 ] 31 0 31
+[ 268435593 ] 31 0 31
+[ 268435594 ] 31 0 31
+[ 268435595 ] 31 0 31
+[ 268435596 ] 31 0 31
+[ 268435597 ] 31 0 31
+[ 268435598 ] 31 0 31
+[ 268435599 ] 31 0 31
+[ 268435600 ] 31 0 31
+[ 268435601 ] 31 0 31
+[ 268435602 ] 31 0 31
+[ 268435603 ] 31 0 31
+[ 268435604 ] 31 0 31
+[ 268435605 ] 31 0 31
+[ 268435606 ] 31 0 31
+[ 268435607 ] 31 0 31
+[ 268435608 ] 31 0 31
+[ 268435609 ] 31 0 31
+[ 268435610 ] 31 0 31
+[ 268435611 ] 31 0 31
+[ 268435612 ] 31 0 31
+[ 268435613 ] 31 0 31
+[ 268435614 ] 31 0 31
+[ 268435615 ] 31 0 31
+[ 268435616 ] 31 0 31
+[ 268435617 ] 31 0 31
+[ 268435618 ] 31 0 31
+[ 268435619 ] 31 0 31
+[ 268435620 ] 31 0 31
+[ 268435621 ] 31 0 31
+[ 268435622 ] 31 0 31
+[ 268435623 ] 31 0 31
+[ 268435624 ] 31 0 31
+[ 268435625 ] 31 0 31
+[ 268435626 ] 31 0 31
+[ 268435627 ] 31 0 31
+[ 268435628 ] 31 0 31
+[ 268435629 ] 31 0 31
+[ 268435630 ] 31 0 31
+[ 268435631 ] 31 0 31
+[ 268435632 ] 31 0 31
+[ 268435633 ] 31 0 31
+[ 268435634 ] 31 0 31
+[ 268435635 ] 31 0 31
+[ 268435636 ] 31 0 31
+[ 268435637 ] 31 0 31
+[ 268435638 ] 31 0 31
+[ 268435639 ] 31 0 31
+[ 268435640 ] 31 0 31
+[ 268435641 ] 31 0 31
+[ 268435642 ] 31 0 31
+[ 268435643 ] 31 0 31
+[ 268435644 ] 31 0 31
+[ 268435645 ] 31 0 31
+[ 268435646 ] 31 0 31
+[ 268435647 ] 31 0 31
+[ 268435648 ] 31 0 31
+[ 268435649 ] 31 0 31
+[ 268435650 ] 31 0 31
+[ 268435651 ] 31 0 31
+[ 268435652 ] 31 0 31
+[ 268435653 ] 31 0 31
+[ 268435654 ] 31 0 31
+[ 268435655 ] 31 0 31
+[ 268435656 ] 31 0 31
+[ 268435657 ] 31 0 31
+[ 268435658 ] 31 0 31
+[ 268435659 ] 31 0 31
+[ 268435660 ] 31 0 31
+[ 268435661 ] 31 0 31
+[ 268435662 ] 31 0 31
+[ 268435663 ] 31 0 31
+[ 268435664 ] 31 0 31
+[ 268435665 ] 31 0 31
+[ 268435666 ] 31 0 31
+[ 268435667 ] 31 0 31
+[ 268435668 ] 31 0 31
+[ 268435669 ] 31 0 31
+[ 268435670 ] 31 0 31
+[ 268435671 ] 31 0 31
+[ 268435672 ] 31 0 31
+[ 268435673 ] 31 0 31
+[ 268435674 ] 31 0 31
+[ 268435675 ] 31 0 31
+[ 268435676 ] 31 0 31
+[ 268435677 ] 31 0 31
+[ 268435678 ] 31 0 31
+[ 268435679 ] 31 0 31
+[ 268435680 ] 31 0 31
+[ 268435681 ] 31 0 31
+[ 268435682 ] 31 0 31
+[ 268435683 ] 31 0 31
+[ 268435684 ] 31 0 31
+[ 268435685 ] 31 0 31
+[ 268435686 ] 31 0 31
+[ 268435687 ] 31 0 31
+[ 268435688 ] 31 0 31
+[ 268435689 ] 31 0 31
+[ 268435690 ] 31 0 31
+[ 268435691 ] 31 0 31
+[ 268435692 ] 31 0 31
+[ 268435693 ] 31 0 31
+[ 268435694 ] 31 0 31
+[ 268435695 ] 31 0 31
+[ 268435696 ] 31 0 31
+[ 268435697 ] 31 0 31
+[ 268435698 ] 31 0 31
+[ 268435699 ] 31 0 31
+[ 268435700 ] 31 0 31
+[ 268435701 ] 31 0 31
+[ 268435702 ] 31 0 31
+[ 268435703 ] 31 0 31
+[ 268435704 ] 31 0 31
+[ 268435705 ] 31 0 31
+[ 268435706 ] 31 0 31
+[ 268435707 ] 31 0 31
+[ 268435708 ] 31 0 31
+[ 268435709 ] 31 0 31
+[ 268435710 ] 31 0 31
+[ 268435711 ] 31 0 31
+[ 268435712 ] 31 0 31
+[ 268435713 ] 31 0 31
+[ 268435714 ] 31 0 31
+[ 268435715 ] 31 0 31
+[ 268435716 ] 31 0 31
+[ 268435717 ] 31 0 31
+[ 268435718 ] 31 0 31
+[ 268435719 ] 31 0 31
+[ 268435720 ] 31 0 31
+[ 268435721 ] 31 0 31
+[ 268435722 ] 31 0 31
+[ 268435723 ] 31 0 31
+[ 268435724 ] 31 0 31
+[ 268435725 ] 31 0 31
+[ 268435726 ] 31 0 31
+[ 268435727 ] 31 0 31
+[ 268435728 ] 31 0 31
+[ 268435729 ] 31 0 31
+[ 268435730 ] 31 0 31
+[ 268435731 ] 31 0 31
+[ 268435732 ] 31 0 31
+[ 268435733 ] 31 0 31
+[ 268435734 ] 31 0 31
+[ 268435735 ] 31 0 31
+[ 268435736 ] 31 0 31
+[ 268435737 ] 31 0 31
+[ 268435738 ] 31 0 31
+[ 268435739 ] 31 0 31
+[ 268435740 ] 31 0 31
+[ 268435741 ] 31 0 31
+[ 268435742 ] 31 0 31
+[ 268435743 ] 31 0 31
+[ 268435744 ] 31 0 31
+[ 268435745 ] 31 0 31
+[ 268435746 ] 31 0 31
+[ 268435747 ] 31 0 31
+[ 268435748 ] 31 0 31
+[ 268435749 ] 31 0 31
+[ 268435750 ] 31 0 31
+[ 268435751 ] 31 0 31
+[ 268435752 ] 31 0 31
+[ 268435753 ] 31 0 31
+[ 268435754 ] 31 0 31
+[ 268435755 ] 31 0 31
+[ 268435756 ] 31 0 31
+[ 268435757 ] 31 0 31
+[ 268435758 ] 31 0 31
+[ 268435759 ] 31 0 31
+[ 268435760 ] 31 0 31
+[ 268435761 ] 31 0 31
+[ 268435762 ] 31 0 31
+[ 268435763 ] 31 0 31
+[ 268435764 ] 31 0 31
+[ 268435765 ] 31 0 31
+[ 268435766 ] 31 0 31
+[ 268435767 ] 31 0 31
+[ 268435768 ] 31 0 31
+[ 268435769 ] 31 0 31
+[ 268435770 ] 31 0 31
+[ 268435771 ] 31 0 31
+[ 268435772 ] 31 0 31
+[ 268435773 ] 31 0 31
+[ 268435774 ] 31 0 31
+[ 268435775 ] 31 0 31
+[ 268435776 ] 31 0 31
+[ 268435777 ] 31 0 31
+[ 268435778 ] 31 0 31
+[ 268435779 ] 31 0 31
+[ 268435780 ] 31 0 31
+[ 268435781 ] 31 0 31
+[ 268435782 ] 31 0 31
+[ 268435783 ] 31 0 31
+[ 268435784 ] 31 0 31
+[ 268435785 ] 31 0 31
+[ 268435786 ] 31 0 31
+[ 268435787 ] 31 0 31
+[ 268435788 ] 31 0 31
+[ 268435789 ] 31 0 31
+[ 268435790 ] 31 0 31
+[ 268435791 ] 31 0 31
+[ 268435792 ] 31 0 31
+[ 268435793 ] 31 0 31
+[ 268435794 ] 31 0 31
+[ 268435795 ] 31 0 31
+[ 268435796 ] 31 0 31
+[ 268435797 ] 31 0 31
+[ 268435798 ] 31 0 31
+[ 268435799 ] 31 0 31
+[ 268435800 ] 31 0 31
+[ 268435801 ] 31 0 31
+[ 268435802 ] 31 0 31
+[ 268435803 ] 31 0 31
+[ 268435804 ] 31 0 31
+[ 268435805 ] 31 0 31
+[ 268435806 ] 31 0 31
+[ 268435807 ] 31 0 31
+[ 268435808 ] 31 0 31
+[ 268435809 ] 31 0 31
+[ 268435810 ] 31 0 31
+[ 268435811 ] 31 0 31
+[ 268435812 ] 31 0 31
+[ 268435813 ] 31 0 31
+[ 268435814 ] 31 0 31
+[ 268435815 ] 31 0 31
+[ 268435816 ] 31 0 31
+[ 268435817 ] 31 0 31
+[ 268435818 ] 31 0 31
+[ 268435819 ] 31 0 31
+[ 268435820 ] 31 0 31
+[ 268435821 ] 31 0 31
+[ 268435822 ] 31 0 31
+[ 268435823 ] 31 0 31
+[ 268435824 ] 31 0 31
+[ 268435825 ] 31 0 31
+[ 268435826 ] 31 0 31
+[ 268435827 ] 31 0 31
+[ 268435828 ] 31 0 31
+[ 268435829 ] 31 0 31
+[ 268435830 ] 31 0 31
+[ 268435831 ] 31 0 31
+[ 268435832 ] 31 0 31
+[ 268435833 ] 31 0 31
+[ 268435834 ] 31 0 31
+[ 268435835 ] 31 0 31
+[ 268435836 ] 31 0 31
+[ 268435837 ] 31 0 31
+[ 268435838 ] 31 0 31
+[ 268435839 ] 31 0 31
+[ 268435840 ] 31 0 31
+[ 268435841 ] 31 0 31
+[ 268435842 ] 31 0 31
+[ 268435843 ] 31 0 31
+[ 268435844 ] 31 0 31
+[ 268435845 ] 31 0 31
+[ 268435846 ] 31 0 31
+[ 268435847 ] 31 0 31
+[ 268435848 ] 31 0 31
+[ 268435849 ] 31 0 31
+[ 268435850 ] 31 0 31
+[ 268435851 ] 31 0 31
+[ 268435852 ] 31 0 31
+[ 268435853 ] 31 0 31
+[ 268435854 ] 31 0 31
+[ 268435855 ] 31 0 31
+[ 268435856 ] 31 0 31
+[ 268435857 ] 31 0 31
+[ 268435858 ] 31 0 31
+[ 268435859 ] 31 0 31
+[ 268435860 ] 31 0 31
+[ 268435861 ] 31 0 31
+[ 268435862 ] 31 0 31
+[ 268435863 ] 31 0 31
+[ 268435864 ] 31 0 31
+[ 268435865 ] 31 0 31
+[ 268435866 ] 31 0 31
+[ 268435867 ] 31 0 31
+[ 268435868 ] 31 0 31
+[ 268435869 ] 31 0 31
+[ 268435870 ] 31 0 31
+[ 268435871 ] 31 0 31
+[ 268435872 ] 31 0 31
+[ 268435873 ] 31 0 31
+[ 268435874 ] 31 0 31
+[ 268435875 ] 31 0 31
+[ 268435876 ] 31 0 31
+[ 268435877 ] 31 0 31
+[ 268435878 ] 31 0 31
+[ 268435879 ] 31 0 31
+[ 268435880 ] 31 0 31
+[ 268435881 ] 31 0 31
+[ 268435882 ] 31 0 31
+[ 268435883 ] 31 0 31
+[ 268435884 ] 31 0 31
+[ 268435885 ] 31 0 31
+[ 268435886 ] 31 0 31
+[ 268435887 ] 31 0 31
+[ 268435888 ] 31 0 31
+[ 268435889 ] 31 0 31
+[ 268435890 ] 31 0 31
+[ 268435891 ] 31 0 31
+[ 268435892 ] 31 0 31
+[ 268435893 ] 31 0 31
+[ 268435894 ] 31 0 31
+[ 268435895 ] 31 0 31
+[ 268435896 ] 31 0 31
+[ 268435897 ] 31 0 31
+[ 268435898 ] 31 0 31
+[ 268435899 ] 31 0 31
+[ 268435900 ] 31 0 31
+[ 268435901 ] 31 0 31
+[ 268435902 ] 31 0 31
+[ 268435903 ] 31 0 31
+[ 268435904 ] 31 0 31
+[ 268435905 ] 31 0 31
+[ 268435906 ] 31 0 31
+[ 268435907 ] 31 0 31
+[ 268435908 ] 31 0 31
+[ 268435909 ] 31 0 31
+[ 268435910 ] 31 0 31
+[ 268435911 ] 31 0 31
+[ 268435912 ] 31 0 31
+[ 268435913 ] 31 0 31
+[ 268435914 ] 31 0 31
+[ 268435915 ] 31 0 31
+[ 268435916 ] 31 0 31
+[ 268435917 ] 31 0 31
+[ 268435918 ] 31 0 31
+[ 268435919 ] 31 0 31
+[ 268435920 ] 31 0 31
+[ 268435921 ] 31 0 31
+[ 268435922 ] 31 0 31
+[ 268435923 ] 31 0 31
+[ 268435924 ] 31 0 31
+[ 268435925 ] 31 0 31
+[ 268435926 ] 31 0 31
+[ 268435927 ] 31 0 31
+[ 268435928 ] 31 0 31
+[ 268435929 ] 31 0 31
+[ 268435930 ] 31 0 31
+[ 268435931 ] 31 0 31
+[ 268435932 ] 31 0 31
+[ 268435933 ] 31 0 31
+[ 268435934 ] 31 0 31
+[ 268435935 ] 31 0 31
+[ 268435936 ] 31 0 31
+[ 268435937 ] 31 0 31
+[ 268435938 ] 31 0 31
+[ 268435939 ] 31 0 31
+[ 268435940 ] 31 0 31
+[ 268435941 ] 31 0 31
+[ 268435942 ] 31 0 31
+[ 268435943 ] 31 0 31
+[ 268435944 ] 31 0 31
+[ 268435945 ] 31 0 31
+[ 268435946 ] 31 0 31
+[ 268435947 ] 31 0 31
+[ 268435948 ] 31 0 31
+[ 268435949 ] 31 0 31
+[ 268435950 ] 31 0 31
+[ 268435951 ] 31 0 31
+[ 268435952 ] 31 0 31
+[ 268435953 ] 31 0 31
+[ 268435954 ] 31 0 31
+[ 268435955 ] 31 0 31
+[ 268435956 ] 31 0 31
+[ 268435957 ] 31 0 31
+[ 268435958 ] 31 0 31
+[ 268435959 ] 31 0 31
+[ 268435960 ] 31 0 31
+[ 268435961 ] 31 0 31
+[ 268435962 ] 31 0 31
+[ 268435963 ] 31 0 31
+[ 268435964 ] 31 0 31
+[ 268435965 ] 31 0 31
+[ 268435966 ] 31 0 31
+[ 268435967 ] 31 0 31
+[ 268435968 ] 31 0 31
+[ 268435969 ] 31 0 31
+[ 268435970 ] 31 0 31
+[ 268435971 ] 31 0 31
+[ 268435972 ] 31 0 31
+[ 268435973 ] 31 0 31
+[ 268435974 ] 31 0 31
+[ 268435975 ] 31 0 31
+[ 268435976 ] 31 0 31
+[ 268435977 ] 31 0 31
+[ 268435978 ] 31 0 31
+[ 268435979 ] 31 0 31
+[ 268435980 ] 31 0 31
+[ 268435981 ] 31 0 31
+[ 268435982 ] 31 0 31
+[ 268435983 ] 31 0 31
+[ 268435984 ] 31 0 31
+[ 268435985 ] 31 0 31
+[ 268435986 ] 31 0 31
+[ 268435987 ] 31 0 31
+[ 268435988 ] 31 0 31
+[ 268435989 ] 31 0 31
+[ 268435990 ] 31 0 31
+[ 268435991 ] 31 0 31
+[ 268435992 ] 31 0 31
+[ 268435993 ] 31 0 31
+[ 268435994 ] 31 0 31
+[ 268435995 ] 31 0 31
+[ 268435996 ] 31 0 31
+[ 268435997 ] 31 0 31
+[ 268435998 ] 31 0 31
+[ 268435999 ] 31 0 31
+[ 268436000 ] 31 0 31
+[ 268436001 ] 31 0 31
+[ 268436002 ] 31 0 31
+[ 268436003 ] 31 0 31
+[ 268436004 ] 31 0 31
+[ 268436005 ] 31 0 31
+[ 268436006 ] 31 0 31
+[ 268436007 ] 31 0 31
+[ 268436008 ] 31 0 31
+[ 268436009 ] 31 0 31
+[ 268436010 ] 31 0 31
+[ 268436011 ] 31 0 31
+[ 268436012 ] 31 0 31
+[ 268436013 ] 31 0 31
+[ 268436014 ] 31 0 31
+[ 268436015 ] 31 0 31
+[ 268436016 ] 31 0 31
+[ 268436017 ] 31 0 31
+[ 268436018 ] 31 0 31
+[ 268436019 ] 31 0 31
+[ 268436020 ] 31 0 31
+[ 268436021 ] 31 0 31
+[ 268436022 ] 31 0 31
+[ 268436023 ] 31 0 31
+[ 268436024 ] 31 0 31
+[ 268436025 ] 31 0 31
+[ 268436026 ] 31 0 31
+[ 268436027 ] 31 0 31
+[ 268436028 ] 31 0 31
+[ 268436029 ] 31 0 31
+[ 268436030 ] 31 0 31
+[ 268436031 ] 31 0 31
+[ 268436032 ] 31 0 31
+[ 268436033 ] 31 0 31
+[ 268436034 ] 31 0 31
+[ 268436035 ] 31 0 31
+[ 268436036 ] 31 0 31
+[ 268436037 ] 31 0 31
+[ 268436038 ] 31 0 31
+[ 268436039 ] 31 0 31
+[ 268436040 ] 31 0 31
+[ 268436041 ] 31 0 31
+[ 268436042 ] 31 0 31
+[ 268436043 ] 31 0 31
+[ 268436044 ] 31 0 31
+[ 268436045 ] 31 0 31
+[ 268436046 ] 31 0 31
+[ 268436047 ] 31 0 31
+[ 268436048 ] 31 0 31
+[ 268436049 ] 31 0 31
+[ 268436050 ] 31 0 31
+[ 268436051 ] 31 0 31
+[ 268436052 ] 31 0 31
+[ 268436053 ] 31 0 31
+[ 268436054 ] 31 0 31
+[ 268436055 ] 31 0 31
+[ 268436056 ] 31 0 31
+[ 268436057 ] 31 0 31
+[ 268436058 ] 31 0 31
+[ 268436059 ] 31 0 31
+[ 268436060 ] 31 0 31
+[ 268436061 ] 31 0 31
+[ 268436062 ] 31 0 31
+[ 268436063 ] 31 0 31
+[ 268436064 ] 31 0 31
+[ 268436065 ] 31 0 31
+[ 268436066 ] 31 0 31
+[ 268436067 ] 31 0 31
+[ 268436068 ] 31 0 31
+[ 268436069 ] 31 0 31
+[ 268436070 ] 31 0 31
+[ 268436071 ] 31 0 31
+[ 268436072 ] 31 0 31
+[ 268436073 ] 31 0 31
+[ 268436074 ] 31 0 31
+[ 268436075 ] 31 0 31
+[ 268436076 ] 31 0 31
+[ 268436077 ] 31 0 31
+[ 268436078 ] 31 0 31
+[ 268436079 ] 31 0 31
+[ 268436080 ] 31 0 31
+[ 268436081 ] 31 0 31
+[ 268436082 ] 31 0 31
+[ 268436083 ] 31 0 31
+[ 268436084 ] 31 0 31
+[ 268436085 ] 31 0 31
+[ 268436086 ] 31 0 31
+[ 268436087 ] 31 0 31
+[ 268436088 ] 31 0 31
+[ 268436089 ] 31 0 31
+[ 268436090 ] 31 0 31
+[ 268436091 ] 31 0 31
+[ 268436092 ] 31 0 31
+[ 268436093 ] 31 0 31
+[ 268436094 ] 31 0 31
+[ 268436095 ] 31 0 31
+[ 268436096 ] 31 0 31
+[ 268436097 ] 31 0 31
+[ 268436098 ] 31 0 31
+[ 268436099 ] 31 0 31
+[ 268436100 ] 31 0 31
+[ 268436101 ] 31 0 31
+[ 268436102 ] 31 0 31
+[ 268436103 ] 31 0 31
+[ 268436104 ] 31 0 31
+[ 268436105 ] 31 0 31
+[ 268436106 ] 31 0 31
+[ 268436107 ] 31 0 31
+[ 268436108 ] 31 0 31
+[ 268436109 ] 31 0 31
+[ 268436110 ] 31 0 31
+[ 268436111 ] 31 0 31
+[ 268436112 ] 31 0 31
+[ 268436113 ] 31 0 31
+[ 268436114 ] 31 0 31
+[ 268436115 ] 31 0 31
+[ 268436116 ] 31 0 31
+[ 268436117 ] 31 0 31
+[ 268436118 ] 31 0 31
+[ 268436119 ] 31 0 31
+[ 268436120 ] 31 0 31
+[ 268436121 ] 31 0 31
+[ 268436122 ] 31 0 31
+[ 268436123 ] 31 0 31
+[ 268436124 ] 31 0 31
+[ 268436125 ] 31 0 31
+[ 268436126 ] 31 0 31
+[ 268436127 ] 31 0 31
+[ 268436128 ] 31 0 31
+[ 268436129 ] 31 0 31
+[ 268436130 ] 31 0 31
+[ 268436131 ] 31 0 31
+[ 268436132 ] 31 0 31
+[ 268436133 ] 31 0 31
+[ 268436134 ] 31 0 31
+[ 268436135 ] 31 0 31
+[ 268436136 ] 31 0 31
+[ 268436137 ] 31 0 31
+[ 268436138 ] 31 0 31
+[ 268436139 ] 31 0 31
+[ 268436140 ] 31 0 31
+[ 268436141 ] 31 0 31
+[ 268436142 ] 31 0 31
+[ 268436143 ] 31 0 31
+[ 268436144 ] 31 0 31
+[ 268436145 ] 31 0 31
+[ 268436146 ] 31 0 31
+[ 268436147 ] 31 0 31
+[ 268436148 ] 31 0 31
+[ 268436149 ] 31 0 31
+[ 268436150 ] 31 0 31
+[ 268436151 ] 31 0 31
+[ 268436152 ] 31 0 31
+[ 268436153 ] 31 0 31
+[ 268436154 ] 31 0 31
+[ 268436155 ] 31 0 31
+[ 268436156 ] 31 0 31
+[ 268436157 ] 31 0 31
+[ 268436158 ] 31 0 31
+[ 268436159 ] 31 0 31
+[ 268436160 ] 31 0 31
+[ 268436161 ] 31 0 31
+[ 268436162 ] 31 0 31
+[ 268436163 ] 31 0 31
+[ 268436164 ] 31 0 31
+[ 268436165 ] 31 0 31
+[ 268436166 ] 31 0 31
+[ 268436167 ] 31 0 31
+[ 268436168 ] 31 0 31
+[ 268436169 ] 31 0 31
+[ 268436170 ] 31 0 31
+[ 268436171 ] 31 0 31
+[ 268436172 ] 31 0 31
+[ 268436173 ] 31 0 31
+[ 268436174 ] 31 0 31
+[ 268436175 ] 31 0 31
+[ 268436176 ] 31 0 31
+[ 268436177 ] 31 0 31
+[ 268436178 ] 31 0 31
+[ 268436179 ] 31 0 31
+[ 268436180 ] 31 0 31
+[ 268436181 ] 31 0 31
+[ 268436182 ] 31 0 31
+[ 268436183 ] 31 0 31
+[ 268436184 ] 31 0 31
+[ 268436185 ] 31 0 31
+[ 268436186 ] 31 0 31
+[ 268436187 ] 31 0 31
+[ 268436188 ] 31 0 31
+[ 268436189 ] 31 0 31
+[ 268436190 ] 31 0 31
+[ 268436191 ] 31 0 31
+[ 268436192 ] 31 0 31
+[ 268436193 ] 31 0 31
+[ 268436194 ] 31 0 31
+[ 268436195 ] 31 0 31
+[ 268436196 ] 31 0 31
+[ 268436197 ] 31 0 31
+[ 268436198 ] 31 0 31
+[ 268436199 ] 31 0 31
+[ 268436200 ] 31 0 31
+[ 268436201 ] 31 0 31
+[ 268436202 ] 31 0 31
+[ 268436203 ] 31 0 31
+[ 268436204 ] 31 0 31
+[ 268436205 ] 31 0 31
+[ 268436206 ] 31 0 31
+[ 268436207 ] 31 0 31
+[ 268436208 ] 31 0 31
+[ 268436209 ] 31 0 31
+[ 268436210 ] 31 0 31
+[ 268436211 ] 31 0 31
+[ 268436212 ] 31 0 31
+[ 268436213 ] 31 0 31
+[ 268436214 ] 31 0 31
+[ 268436215 ] 31 0 31
+[ 268436216 ] 31 0 31
+[ 268436217 ] 31 0 31
+[ 268436218 ] 31 0 31
+[ 268436219 ] 31 0 31
+[ 268436220 ] 31 0 31
+[ 268436221 ] 31 0 31
+[ 268436222 ] 31 0 31
+[ 268436223 ] 31 0 31
+[ 268436224 ] 31 0 31
+[ 268436225 ] 31 0 31
+[ 268436226 ] 31 0 31
+[ 268436227 ] 31 0 31
+[ 268436228 ] 31 0 31
+[ 268436229 ] 31 0 31
+[ 268436230 ] 31 0 31
+[ 268436231 ] 31 0 31
+[ 268436232 ] 31 0 31
+[ 268436233 ] 31 0 31
+[ 268436234 ] 31 0 31
+[ 268436235 ] 31 0 31
+[ 268436236 ] 31 0 31
+[ 268436237 ] 31 0 31
+[ 268436238 ] 31 0 31
+[ 268436239 ] 31 0 31
+[ 268436240 ] 31 0 31
+[ 268436241 ] 31 0 31
+[ 268436242 ] 31 0 31
+[ 268436243 ] 31 0 31
+[ 268436244 ] 31 0 31
+[ 268436245 ] 31 0 31
+[ 268436246 ] 31 0 31
+[ 268436247 ] 31 0 31
+[ 268436248 ] 31 0 31
+[ 268436249 ] 31 0 31
+[ 268436250 ] 31 0 31
+[ 268436251 ] 31 0 31
+[ 268436252 ] 31 0 31
+[ 268436253 ] 31 0 31
+[ 268436254 ] 31 0 31
+[ 268436255 ] 31 0 31
+[ 268436256 ] 31 0 31
+[ 268436257 ] 31 0 31
+[ 268436258 ] 31 0 31
+[ 268436259 ] 31 0 31
+[ 268436260 ] 31 0 31
+[ 268436261 ] 31 0 31
+[ 268436262 ] 31 0 31
+[ 268436263 ] 31 0 31
+[ 268436264 ] 31 0 31
+[ 268436265 ] 31 0 31
+[ 268436266 ] 31 0 31
+[ 268436267 ] 31 0 31
+[ 268436268 ] 31 0 31
+[ 268436269 ] 31 0 31
+[ 268436270 ] 31 0 31
+[ 268436271 ] 31 0 31
+[ 268436272 ] 31 0 31
+[ 268436273 ] 31 0 31
+[ 268436274 ] 31 0 31
+[ 268436275 ] 31 0 31
+[ 268436276 ] 31 0 31
+[ 268436277 ] 31 0 31
+[ 268436278 ] 31 0 31
+[ 268436279 ] 31 0 31
+[ 268436280 ] 31 0 31
+[ 268436281 ] 31 0 31
+[ 268436282 ] 31 0 31
+[ 268436283 ] 31 0 31
+[ 268436284 ] 31 0 31
+[ 268436285 ] 31 0 31
+[ 268436286 ] 31 0 31
+[ 268436287 ] 31 0 31
+[ 268436288 ] 31 0 31
+[ 268436289 ] 31 0 31
+[ 268436290 ] 31 0 31
+[ 268436291 ] 31 0 31
+[ 268436292 ] 31 0 31
+[ 268436293 ] 31 0 31
+[ 268436294 ] 31 0 31
+[ 268436295 ] 31 0 31
+[ 268436296 ] 31 0 31
+[ 268436297 ] 31 0 31
+[ 268436298 ] 31 0 31
+[ 268436299 ] 31 0 31
+[ 268436300 ] 31 0 31
+[ 268436301 ] 31 0 31
+[ 268436302 ] 31 0 31
+[ 268436303 ] 31 0 31
+[ 268436304 ] 31 0 31
+[ 268436305 ] 31 0 31
+[ 268436306 ] 31 0 31
+[ 268436307 ] 31 0 31
+[ 268436308 ] 31 0 31
+[ 268436309 ] 31 0 31
+[ 268436310 ] 31 0 31
+[ 268436311 ] 31 0 31
+[ 268436312 ] 31 0 31
+[ 268436313 ] 31 0 31
+[ 268436314 ] 31 0 31
+[ 268436315 ] 31 0 31
+[ 268436316 ] 31 0 31
+[ 268436317 ] 31 0 31
+[ 268436318 ] 31 0 31
+[ 268436319 ] 31 0 31
+[ 268436320 ] 31 0 31
+[ 268436321 ] 31 0 31
+[ 268436322 ] 31 0 31
+[ 268436323 ] 31 0 31
+[ 268436324 ] 31 0 31
+[ 268436325 ] 31 0 31
+[ 268436326 ] 31 0 31
+[ 268436327 ] 31 0 31
+[ 268436328 ] 31 0 31
+[ 268436329 ] 31 0 31
+[ 268436330 ] 31 0 31
+[ 268436331 ] 31 0 31
+[ 268436332 ] 31 0 31
+[ 268436333 ] 31 0 31
+[ 268436334 ] 31 0 31
+[ 268436335 ] 31 0 31
+[ 268436336 ] 31 0 31
+[ 268436337 ] 31 0 31
+[ 268436338 ] 31 0 31
+[ 268436339 ] 31 0 31
+[ 268436340 ] 31 0 31
+[ 268436341 ] 31 0 31
+[ 268436342 ] 31 0 31
+[ 268436343 ] 31 0 31
+[ 268436344 ] 31 0 31
+[ 268436345 ] 31 0 31
+[ 268436346 ] 31 0 31
+[ 268436347 ] 31 0 31
+[ 268436348 ] 31 0 31
+[ 268436349 ] 31 0 31
+[ 268436350 ] 31 0 31
+[ 268436351 ] 31 0 31
+[ 268436352 ] 31 0 31
+[ 268436353 ] 31 0 31
+[ 268436354 ] 31 0 31
+[ 268436355 ] 31 0 31
+[ 268436356 ] 31 0 31
+[ 268436357 ] 31 0 31
+[ 268436358 ] 31 0 31
+[ 268436359 ] 31 0 31
+[ 268436360 ] 31 0 31
+[ 268436361 ] 31 0 31
+[ 268436362 ] 31 0 31
+[ 268436363 ] 31 0 31
+[ 268436364 ] 31 0 31
+[ 268436365 ] 31 0 31
+[ 268436366 ] 31 0 31
+[ 268436367 ] 31 0 31
+[ 268436368 ] 31 0 31
+[ 268436369 ] 31 0 31
+[ 268436370 ] 31 0 31
+[ 268436371 ] 31 0 31
+[ 268436372 ] 31 0 31
+[ 268436373 ] 31 0 31
+[ 268436374 ] 31 0 31
+[ 268436375 ] 31 0 31
+[ 268436376 ] 31 0 31
+[ 268436377 ] 31 0 31
+[ 268436378 ] 31 0 31
+[ 268436379 ] 31 0 31
+[ 268436380 ] 31 0 31
+[ 268436381 ] 31 0 31
+[ 268436382 ] 31 0 31
+[ 268436383 ] 31 0 31
+[ 268436384 ] 31 0 31
+[ 268436385 ] 31 0 31
+[ 268436386 ] 31 0 31
+[ 268436387 ] 31 0 31
+[ 268436388 ] 31 0 31
+[ 268436389 ] 31 0 31
+[ 268436390 ] 31 0 31
+[ 268436391 ] 31 0 31
+[ 268436392 ] 31 0 31
+[ 268436393 ] 31 0 31
+[ 268436394 ] 31 0 31
+[ 268436395 ] 31 0 31
+[ 268436396 ] 31 0 31
+[ 268436397 ] 31 0 31
+[ 268436398 ] 31 0 31
+[ 268436399 ] 31 0 31
+[ 268436400 ] 31 0 31
+[ 268436401 ] 31 0 31
+[ 268436402 ] 31 0 31
+[ 268436403 ] 31 0 31
+[ 268436404 ] 31 0 31
+[ 268436405 ] 31 0 31
+[ 268436406 ] 31 0 31
+[ 268436407 ] 31 0 31
+[ 268436408 ] 31 0 31
+[ 268436409 ] 31 0 31
+[ 268436410 ] 31 0 31
+[ 268436411 ] 31 0 31
+[ 268436412 ] 31 0 31
+[ 268436413 ] 31 0 31
+[ 268436414 ] 31 0 31
+[ 268436415 ] 31 0 31
+[ 268436416 ] 31 0 31
+[ 268436417 ] 31 0 31
+[ 268436418 ] 31 0 31
+[ 268436419 ] 31 0 31
+[ 268436420 ] 31 0 31
+[ 268436421 ] 31 0 31
+[ 268436422 ] 31 0 31
+[ 268436423 ] 31 0 31
+[ 268436424 ] 31 0 31
+[ 268436425 ] 31 0 31
+[ 268436426 ] 31 0 31
+[ 268436427 ] 31 0 31
+[ 268436428 ] 31 0 31
+[ 268436429 ] 31 0 31
+[ 268436430 ] 31 0 31
+[ 268436431 ] 31 0 31
+[ 268436432 ] 31 0 31
+[ 268436433 ] 31 0 31
+[ 268436434 ] 31 0 31
+[ 268436435 ] 31 0 31
+[ 268436436 ] 31 0 31
+[ 268436437 ] 31 0 31
+[ 268436438 ] 31 0 31
+[ 268436439 ] 31 0 31
+[ 268436440 ] 31 0 31
+[ 268436441 ] 31 0 31
+[ 268436442 ] 31 0 31
+[ 268436443 ] 31 0 31
+[ 268436444 ] 31 0 31
+[ 268436445 ] 31 0 31
+[ 268436446 ] 31 0 31
+[ 268436447 ] 31 0 31
+[ 268436448 ] 31 0 31
+[ 268436449 ] 31 0 31
+[ 268436450 ] 31 0 31
+[ 268436451 ] 31 0 31
+[ 268436452 ] 31 0 31
+[ 268436453 ] 31 0 31
+[ 268436454 ] 31 0 31
+[ 268436455 ] 31 0 31
+[ 268436456 ] 31 0 31
+[ 268436457 ] 31 0 31
+[ 268436458 ] 31 0 31
+[ 268436459 ] 31 0 31
+[ 268436460 ] 31 0 31
+[ 268436461 ] 31 0 31
+[ 268436462 ] 31 0 31
+[ 268436463 ] 31 0 31
+[ 268436464 ] 31 0 31
+[ 268436465 ] 31 0 31
+[ 268436466 ] 31 0 31
+[ 268436467 ] 31 0 31
+[ 268436468 ] 31 0 31
+[ 268436469 ] 31 0 31
+[ 268436470 ] 31 0 31
+[ 268436471 ] 31 0 31
+[ 268436472 ] 31 0 31
+[ 268436473 ] 31 0 31
+[ 268436474 ] 31 0 31
+[ 268436475 ] 31 0 31
+[ 268436476 ] 31 0 31
+[ 268436477 ] 31 0 31
+[ 268436478 ] 31 0 31
+[ 268436479 ] 31 0 31
+1024 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_101.txt b/tools/test/h5diff/testfiles/h5diff_101.txt
new file mode 100644
index 0000000..f915439
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_101.txt
@@ -0,0 +1,11 @@
+dataset: </g1/d1> and </g1/d2>
+size: [3x2] [3x2]
+position d1 d2 difference
+------------------------------------------------------------
+[ 0 1 ] 1e-16 4e-16 3e-16
+[ 1 0 ] 1e-16 2e-16 1e-16
+[ 1 1 ] 0 1e-16 1e-16
+[ 2 0 ] 3.3e-16 1e-16 2.3e-16
+[ 2 1 ] 1e-16 0 1e-16
+5 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_101w.txt b/tools/test/h5diff/testfiles/h5diff_101w.txt
new file mode 100644
index 0000000..71f4e87
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_101w.txt
@@ -0,0 +1,11 @@
+dataset: </g1/d1> and </g1/d2>
+size: [3x2] [3x2]
+position d1 d2 difference
+------------------------------------------------------------
+[ 0 1 ] 1e-016 4e-016 3e-016
+[ 1 0 ] 1e-016 2e-016 1e-016
+[ 1 1 ] 0 1e-016 1e-016
+[ 2 0 ] 3.3e-016 1e-016 2.3e-016
+[ 2 1 ] 1e-016 0 1e-016
+5 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_102.txt b/tools/test/h5diff/testfiles/h5diff_102.txt
new file mode 100644
index 0000000..476067b
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_102.txt
@@ -0,0 +1,10 @@
+dataset: </g1/fp1> and </g1/fp2>
+size: [3x2] [3x2]
+position fp1 fp2 difference
+------------------------------------------------------------
+[ 0 1 ] 1e-07 2e-07 1e-07
+[ 1 0 ] 1e-07 3e-07 2e-07
+[ 1 1 ] 2.2e-07 1e-07 1.2e-07
+[ 2 0 ] 1e-07 0 1e-07
+4 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_102w.txt b/tools/test/h5diff/testfiles/h5diff_102w.txt
new file mode 100644
index 0000000..19a097c
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_102w.txt
@@ -0,0 +1,10 @@
+dataset: </g1/fp1> and </g1/fp2>
+size: [3x2] [3x2]
+position fp1 fp2 difference
+------------------------------------------------------------
+[ 0 1 ] 1e-007 2e-007 1e-007
+[ 1 0 ] 1e-007 3e-007 2e-007
+[ 1 1 ] 2.2e-007 1e-007 1.2e-007
+[ 2 0 ] 1e-007 0 1e-007
+4 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_103.txt b/tools/test/h5diff/testfiles/h5diff_103.txt
new file mode 100644
index 0000000..5700459
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_103.txt
@@ -0,0 +1,8 @@
+dataset: </g1/d1> and </g1/d2>
+size: [3x2] [3x2]
+position d1 d2 difference
+------------------------------------------------------------
+[ 0 1 ] 1e-16 4e-16 3e-16
+[ 2 0 ] 3.3e-16 1e-16 2.3e-16
+2 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_103w.txt b/tools/test/h5diff/testfiles/h5diff_103w.txt
new file mode 100644
index 0000000..b1abea2
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_103w.txt
@@ -0,0 +1,8 @@
+dataset: </g1/d1> and </g1/d2>
+size: [3x2] [3x2]
+position d1 d2 difference
+------------------------------------------------------------
+[ 0 1 ] 1e-016 4e-016 3e-016
+[ 2 0 ] 3.3e-016 1e-016 2.3e-016
+2 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_104.txt b/tools/test/h5diff/testfiles/h5diff_104.txt
new file mode 100644
index 0000000..2997f10
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_104.txt
@@ -0,0 +1,8 @@
+dataset: </g1/fp1> and </g1/fp2>
+size: [3x2] [3x2]
+position fp1 fp2 difference
+------------------------------------------------------------
+[ 1 0 ] 1e-07 3e-07 2e-07
+[ 1 1 ] 2.2e-07 1e-07 1.2e-07
+2 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_104w.txt b/tools/test/h5diff/testfiles/h5diff_104w.txt
new file mode 100644
index 0000000..28ef705
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_104w.txt
@@ -0,0 +1,8 @@
+dataset: </g1/fp1> and </g1/fp2>
+size: [3x2] [3x2]
+position fp1 fp2 difference
+------------------------------------------------------------
+[ 1 0 ] 1e-007 3e-007 2e-007
+[ 1 1 ] 2.2e-007 1e-007 1.2e-007
+2 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_11.txt b/tools/test/h5diff/testfiles/h5diff_11.txt
new file mode 100644
index 0000000..c06305c
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_11.txt
@@ -0,0 +1,3 @@
+dataset: </g1/dset1> and </g1/dset1>
+5 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_12.txt b/tools/test/h5diff/testfiles/h5diff_12.txt
new file mode 100644
index 0000000..371df79
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_12.txt
@@ -0,0 +1,3 @@
+dataset: </g1/dset1> and </g1/dset2>
+5 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_13.txt b/tools/test/h5diff/testfiles/h5diff_13.txt
new file mode 100644
index 0000000..729859b
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_13.txt
@@ -0,0 +1,11 @@
+dataset: </g1/dset1> and </g1/dset1>
+size: [3x2] [3x2]
+position dset1 dset1 difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 1 1.1 0.1
+[ 1 0 ] 1 1.01 0.01
+[ 1 1 ] 1 1.001 0.001
+[ 2 1 ] 0 1 1
+5 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_14.txt b/tools/test/h5diff/testfiles/h5diff_14.txt
new file mode 100644
index 0000000..454463a
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_14.txt
@@ -0,0 +1,11 @@
+dataset: </g1/dset1> and </g1/dset2>
+size: [3x2] [3x2]
+position dset1 dset2 difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 1 1.1 0.1
+[ 1 0 ] 1 1.01 0.01
+[ 1 1 ] 1 1.001 0.001
+[ 2 1 ] 0 1 1
+5 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_15.txt b/tools/test/h5diff/testfiles/h5diff_15.txt
new file mode 100644
index 0000000..7685f75
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_15.txt
@@ -0,0 +1,10 @@
+dataset: </g1/dset3> and </g1/dset4>
+size: [3x2] [3x2]
+position dset3 dset4 difference
+------------------------------------------------------------
+[ 0 1 ] 100 120 20
+[ 1 0 ] 100 160 60
+[ 2 0 ] 100 80 20
+[ 2 1 ] 100 40 60
+4 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_16_1.txt b/tools/test/h5diff/testfiles/h5diff_16_1.txt
new file mode 100644
index 0000000..482a42f
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_16_1.txt
@@ -0,0 +1,11 @@
+dataset: </g1/dset5> and </g1/dset6>
+size: [3x2] [3x2]
+position dset5 dset6 difference relative
+------------------------------------------------------------------------
+[ 0 0 ] 100 120 20 0.200000
+[ 0 1 ] 100 80 20 0.200000
+[ 1 0 ] 100 0 100 1.000000
+[ 1 1 ] 0 100 100 not comparable
+[ 2 1 ] 100 50 50 0.500000
+5 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_16_2.txt b/tools/test/h5diff/testfiles/h5diff_16_2.txt
new file mode 100644
index 0000000..34c1afb
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_16_2.txt
@@ -0,0 +1,11 @@
+dataset: </g1/dset7> and </g1/dset8>
+size: [3x2] [3x2]
+position dset7 dset8 difference relative
+------------------------------------------------------------------------
+[ 0 0 ] 100 120 20 0.200000
+[ 0 1 ] 100 80 20 0.200000
+[ 1 0 ] 100 0 100 1.000000
+[ 1 1 ] 0 100 100 not comparable
+[ 2 1 ] 100 50 50 0.500000
+5 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_16_3.txt b/tools/test/h5diff/testfiles/h5diff_16_3.txt
new file mode 100644
index 0000000..173a39b
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_16_3.txt
@@ -0,0 +1,11 @@
+dataset: </g1/dset9> and </g1/dset10>
+size: [3x2] [3x2]
+position dset9 dset10 difference relative
+------------------------------------------------------------------------
+[ 0 0 ] 100 120 20 0.2
+[ 0 1 ] 100 80 20 0.2
+[ 1 0 ] 100 0 100 1
+[ 1 1 ] 0 100 100 not comparable
+[ 2 1 ] 100 50 50 0.5
+5 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_17.txt b/tools/test/h5diff/testfiles/h5diff_17.txt
new file mode 100644
index 0000000..4906a2a
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_17.txt
@@ -0,0 +1,57 @@
+
+file1 file2
+---------------------------------------
+ x x /
+ x x /g1
+ x /g1/d1
+ x /g1/d2
+ x x /g1/dset1
+ x /g1/dset10
+ x /g1/dset11
+ x /g1/dset12
+ x /g1/dset2
+ x /g1/dset3
+ x /g1/dset4
+ x /g1/dset5
+ x /g1/dset6
+ x /g1/dset7
+ x /g1/dset8
+ x /g1/dset9
+ x /g1/fp1
+ x /g1/fp15
+ x /g1/fp16
+ x /g1/fp17
+ x /g1/fp18
+ x /g1/fp18_COPY
+ x /g1/fp19
+ x /g1/fp19_COPY
+ x /g1/fp2
+ x /g1/fp20
+ x /g1/fp20_COPY
+ x /g1/ld
+ x /g2
+ x /g2/dset1
+ x /g2/dset2
+ x /g2/dset3
+ x /g2/dset4
+ x /g2/dset5
+ x /g2/dset6
+ x /g2/dset7
+ x /g2/dset8
+ x /g2/dset9
+
+group : </> and </>
+0 differences found
+group : </g1> and </g1>
+0 differences found
+dataset: </g1/dset1> and </g1/dset1>
+size: [3x2] [3x2]
+position dset1 dset1 difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 1 1.1 0.1
+[ 1 0 ] 1 1.01 0.01
+[ 1 1 ] 1 1.001 0.001
+[ 2 1 ] 0 1 1
+5 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_171.txt b/tools/test/h5diff/testfiles/h5diff_171.txt
new file mode 100644
index 0000000..aabe16a
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_171.txt
@@ -0,0 +1,3 @@
+dataset: </g1/fp19> and </g1/fp19_COPY>
+0 differences found
+EXIT CODE: 0
diff --git a/tools/test/h5diff/testfiles/h5diff_172.txt b/tools/test/h5diff/testfiles/h5diff_172.txt
new file mode 100644
index 0000000..852f7b5
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_172.txt
@@ -0,0 +1,3 @@
+dataset: </g1/fp20> and </g1/fp20_COPY>
+0 differences found
+EXIT CODE: 0
diff --git a/tools/test/h5diff/testfiles/h5diff_18.txt b/tools/test/h5diff/testfiles/h5diff_18.txt
new file mode 100644
index 0000000..1255241
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_18.txt
@@ -0,0 +1 @@
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_18_1.txt b/tools/test/h5diff/testfiles/h5diff_18_1.txt
new file mode 100644
index 0000000..0067075
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_18_1.txt
@@ -0,0 +1,2 @@
+Error: -q (quiet mode) cannot be added to verbose or report modes
+EXIT CODE: 2
diff --git a/tools/test/h5diff/testfiles/h5diff_19.txt b/tools/test/h5diff/testfiles/h5diff_19.txt
new file mode 100644
index 0000000..1155d55
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_19.txt
@@ -0,0 +1,26 @@
+
+file1 file2
+---------------------------------------
+ x x /
+ x /g1
+ x /g1/d1
+ x /g1/d2
+ x /g1/dset1
+ x /g1/dset10
+ x /g1/dset3
+ x /g1/dset5
+ x /g1/dset6
+ x /g1/dset7
+ x /g1/dset8
+ x /g1/dset9
+ x /g1/fp1
+ x /g1/fp15
+ x /g1/fp16
+ x /g1/fp17
+ x /g1/fp18
+ x /g1/fp2
+ x /g1/ld
+
+group : </> and </>
+0 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_20.txt b/tools/test/h5diff/testfiles/h5diff_20.txt
new file mode 100644
index 0000000..09c20cb
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_20.txt
@@ -0,0 +1,6 @@
+Not comparable: </dset> is of type H5G_DATASET and </g1> is of type H5G_GROUP
+--------------------------------
+Some objects are not comparable
+--------------------------------
+Use -c for a list of objects without details of differences.
+EXIT CODE: 0
diff --git a/tools/test/h5diff/testfiles/h5diff_200.txt b/tools/test/h5diff/testfiles/h5diff_200.txt
new file mode 100644
index 0000000..40e3fb6
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_200.txt
@@ -0,0 +1,5 @@
+--------------------------------
+Some objects are not comparable
+--------------------------------
+Use -c for a list of objects.
+EXIT CODE: 0
diff --git a/tools/test/h5diff/testfiles/h5diff_201.txt b/tools/test/h5diff/testfiles/h5diff_201.txt
new file mode 100644
index 0000000..ede94e1
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_201.txt
@@ -0,0 +1,2 @@
+Not comparable: </g2/dset1> or </g2/dset2> is an empty dataset
+EXIT CODE: 0
diff --git a/tools/test/h5diff/testfiles/h5diff_202.txt b/tools/test/h5diff/testfiles/h5diff_202.txt
new file mode 100644
index 0000000..95ef1da
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_202.txt
@@ -0,0 +1,2 @@
+Not comparable: </g2/dset2> is of class H5T_FLOAT and </g2/dset3> is of class H5T_INTEGER
+EXIT CODE: 0
diff --git a/tools/test/h5diff/testfiles/h5diff_203.txt b/tools/test/h5diff/testfiles/h5diff_203.txt
new file mode 100644
index 0000000..61a773a
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_203.txt
@@ -0,0 +1,3 @@
+Not comparable: </g2/dset3> has rank 1, dimensions [6], max dimensions [6]
+and </g2/dset4> has rank 2, dimensions [3x2], max dimensions [3x2]
+EXIT CODE: 0
diff --git a/tools/test/h5diff/testfiles/h5diff_204.txt b/tools/test/h5diff/testfiles/h5diff_204.txt
new file mode 100644
index 0000000..e02e831
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_204.txt
@@ -0,0 +1,3 @@
+Not comparable: </g2/dset4> has rank 2, dimensions [3x2], max dimensions [3x2]
+and </g2/dset5> has rank 2, dimensions [2x2], max dimensions [2x2]
+EXIT CODE: 0
diff --git a/tools/test/h5diff/testfiles/h5diff_205.txt b/tools/test/h5diff/testfiles/h5diff_205.txt
new file mode 100644
index 0000000..bf5650f
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_205.txt
@@ -0,0 +1,3 @@
+Not comparable: </g2/dset5> has rank 2, dimensions [2x2], max dimensions [2x2]
+and </g2/dset6> has rank 2, dimensions [3x2], max dimensions [3x2]
+EXIT CODE: 0
diff --git a/tools/test/h5diff/testfiles/h5diff_206.txt b/tools/test/h5diff/testfiles/h5diff_206.txt
new file mode 100644
index 0000000..659321f
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_206.txt
@@ -0,0 +1,2 @@
+Not comparable: </g2/dset7> has a class H5T_FLOAT and </g2/dset8> has a class H5T_INTEGER
+EXIT CODE: 0
diff --git a/tools/test/h5diff/testfiles/h5diff_207.txt b/tools/test/h5diff/testfiles/h5diff_207.txt
new file mode 100644
index 0000000..1ef3dbe
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_207.txt
@@ -0,0 +1,3 @@
+Not comparable: </g2/dset8> or </g2/dset9> is an empty dataset
+Not comparable: </g2/dset8> has 2 members </g2/dset9> has 1 members
+EXIT CODE: 0
diff --git a/tools/test/h5diff/testfiles/h5diff_208.txt b/tools/test/h5diff/testfiles/h5diff_208.txt
new file mode 100644
index 0000000..783be90
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_208.txt
@@ -0,0 +1,5 @@
+Not comparable: </dset1> or </dset1> is an empty dataset
+Not comparable: </dset2> or </dset2> is an empty dataset
+Not comparable: </dset2> has rank 2, dimensions [0x0], max dimensions [0x0]
+and </dset2> has rank 2, dimensions [0x4], max dimensions [0x4]
+EXIT CODE: 0
diff --git a/tools/test/h5diff/testfiles/h5diff_21.txt b/tools/test/h5diff/testfiles/h5diff_21.txt
new file mode 100644
index 0000000..1c625fe
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_21.txt
@@ -0,0 +1,6 @@
+Not comparable: </dset> is of type H5G_DATASET and </l1> is of type H5G_LINK
+--------------------------------
+Some objects are not comparable
+--------------------------------
+Use -c for a list of objects without details of differences.
+EXIT CODE: 0
diff --git a/tools/test/h5diff/testfiles/h5diff_22.txt b/tools/test/h5diff/testfiles/h5diff_22.txt
new file mode 100644
index 0000000..2ef22d0
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_22.txt
@@ -0,0 +1,6 @@
+Not comparable: </dset> is of type H5G_DATASET and </t1> is of type H5G_TYPE
+--------------------------------
+Some objects are not comparable
+--------------------------------
+Use -c for a list of objects without details of differences.
+EXIT CODE: 0
diff --git a/tools/test/h5diff/testfiles/h5diff_220.txt b/tools/test/h5diff/testfiles/h5diff_220.txt
new file mode 100644
index 0000000..0092fc1
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_220.txt
@@ -0,0 +1,6 @@
+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
+dataset: </g1/dset2> and </g1/dset2>
+3 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_221.txt b/tools/test/h5diff/testfiles/h5diff_221.txt
new file mode 100644
index 0000000..5f10860
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_221.txt
@@ -0,0 +1,12 @@
+dataset: </g2/dset1> and </g2/dset1>
+3 differences found
+Not comparable: <attr1> is of class H5T_INTEGER and <attr1> is of class H5T_STRING
+Not comparable: <attr2> has rank 1, dimensions [3], max dimensions [3]
+and <attr2> has rank 1, dimensions [4], max dimensions [4]
+Not comparable: <attr3> has rank 1, dimensions [3], max dimensions [3]
+and <attr3> has rank 2, dimensions [3x1], max dimensions [3x1]
+attribute: <attr4 of </g2/dset1>> and <attr4 of </g2/dset1>>
+3 differences found
+dataset: </g2/dset2> and </g2/dset2>
+3 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_222.txt b/tools/test/h5diff/testfiles/h5diff_222.txt
new file mode 100644
index 0000000..77447da
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_222.txt
@@ -0,0 +1,20 @@
+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
+dataset: </g1/dset2> and </g1/dset2>
+3 differences found
+dataset: </g2/dset1> and </g2/dset1>
+3 differences found
+Not comparable: <attr1> is of class H5T_INTEGER and <attr1> is of class H5T_STRING
+Not comparable: <attr2> has rank 1, dimensions [3], max dimensions [3]
+and <attr2> has rank 1, dimensions [4], max dimensions [4]
+Not comparable: <attr3> has rank 1, dimensions [3], max dimensions [3]
+and <attr3> has rank 2, dimensions [3x1], max dimensions [3x1]
+attribute: <attr4 of </g2/dset1>> and <attr4 of </g2/dset1>>
+3 differences found
+dataset: </g2/dset2> and </g2/dset2>
+3 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_223.txt b/tools/test/h5diff/testfiles/h5diff_223.txt
new file mode 100644
index 0000000..c8e0f65
--- /dev/null
+++ b/tools/test/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/test/h5diff/testfiles/h5diff_224.txt b/tools/test/h5diff/testfiles/h5diff_224.txt
new file mode 100644
index 0000000..a4ebedb
--- /dev/null
+++ b/tools/test/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/test/h5diff/testfiles/h5diff_23.txt b/tools/test/h5diff/testfiles/h5diff_23.txt
new file mode 100644
index 0000000..bd1cadb
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_23.txt
@@ -0,0 +1,8 @@
+
+group1 group2
+---------------------------------------
+ x x
+
+group : </g1> and </g1>
+0 differences found
+EXIT CODE: 0
diff --git a/tools/test/h5diff/testfiles/h5diff_24.txt b/tools/test/h5diff/testfiles/h5diff_24.txt
new file mode 100644
index 0000000..fa5723a
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_24.txt
@@ -0,0 +1,3 @@
+datatype: </t1> and </t1>
+0 differences found
+EXIT CODE: 0
diff --git a/tools/test/h5diff/testfiles/h5diff_25.txt b/tools/test/h5diff/testfiles/h5diff_25.txt
new file mode 100644
index 0000000..e463ba1
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_25.txt
@@ -0,0 +1,3 @@
+link : </l1> and </l1>
+0 differences found
+EXIT CODE: 0
diff --git a/tools/test/h5diff/testfiles/h5diff_26.txt b/tools/test/h5diff/testfiles/h5diff_26.txt
new file mode 100644
index 0000000..54a5121
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_26.txt
@@ -0,0 +1,8 @@
+
+group1 group2
+---------------------------------------
+ x x
+
+group : </g1> and </g2>
+0 differences found
+EXIT CODE: 0
diff --git a/tools/test/h5diff/testfiles/h5diff_27.txt b/tools/test/h5diff/testfiles/h5diff_27.txt
new file mode 100644
index 0000000..cbc128e
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_27.txt
@@ -0,0 +1,3 @@
+datatype: </t1> and </t2>
+1 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_28.txt b/tools/test/h5diff/testfiles/h5diff_28.txt
new file mode 100644
index 0000000..07d01fe
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_28.txt
@@ -0,0 +1,3 @@
+link : </l1> and </l2>
+1 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_30.txt b/tools/test/h5diff/testfiles/h5diff_30.txt
new file mode 100644
index 0000000..187589a
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_30.txt
@@ -0,0 +1,9 @@
+dataset: </dset1> and </dset2>
+size: [6] [6]
+position dset1 dset2 difference
+------------------------------------------------------------
+[ 1 ] YIN **INVALID VALUE**
+[ 2 ] **INVALID VALUE** YIN
+[ 5 ] YIN YANG
+3 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_300.txt b/tools/test/h5diff/testfiles/h5diff_300.txt
new file mode 100644
index 0000000..e51643f
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_300.txt
@@ -0,0 +1,3 @@
+link : </link_g1> and </link_g2>
+1 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_400.txt b/tools/test/h5diff/testfiles/h5diff_400.txt
new file mode 100644
index 0000000..8b3c03c
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_400.txt
@@ -0,0 +1,35 @@
+
+file1 file2
+---------------------------------------
+ x x /
+ x x /softlink_dset1_1
+ x x /softlink_dset2
+ x x /softlink_group1
+ x x /softlink_group1/dset
+ x x /softlink_noexist
+ x x /target_dset1
+ x x /target_dset2
+ x x /target_group
+ x x /target_group/dset
+
+group : </> and </>
+0 differences found
+dataset: </softlink_dset1_1> and </softlink_dset1_1>
+0 differences found
+dataset: </softlink_dset2> and </softlink_dset2>
+0 differences found
+group : </softlink_group1> and </softlink_group1>
+0 differences found
+dataset: </softlink_group1/dset> and </softlink_group1/dset>
+0 differences found
+dangling link: </softlink_noexist> and </softlink_noexist>
+0 differences found
+dataset: </target_dset1> and </target_dset1>
+0 differences found
+dataset: </target_dset2> and </target_dset2>
+0 differences found
+group : </target_group> and </target_group>
+0 differences found
+dataset: </target_group/dset> and </target_group/dset>
+0 differences found
+EXIT CODE: 0
diff --git a/tools/test/h5diff/testfiles/h5diff_401.txt b/tools/test/h5diff/testfiles/h5diff_401.txt
new file mode 100644
index 0000000..278729e
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_401.txt
@@ -0,0 +1,13 @@
+dataset: </softlink_dset1_1> and </target_dset2>
+size: [2x4] [2x4]
+position softlink_dset1_1 target_dset2 difference
+------------------------------------------------------------
+[ 0 1 ] 1 0 1
+[ 0 2 ] 2 0 2
+[ 0 3 ] 3 0 3
+[ 1 0 ] 1 0 1
+[ 1 1 ] 2 0 2
+[ 1 2 ] 3 0 3
+[ 1 3 ] 4 0 4
+7 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_402.txt b/tools/test/h5diff/testfiles/h5diff_402.txt
new file mode 100644
index 0000000..b0f30ca
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_402.txt
@@ -0,0 +1,13 @@
+dataset: </target_dset2> and </softlink_dset1_1>
+size: [2x4] [2x4]
+position target_dset2 softlink_dset1_1 difference
+------------------------------------------------------------
+[ 0 1 ] 0 1 1
+[ 0 2 ] 0 2 2
+[ 0 3 ] 0 3 3
+[ 1 0 ] 0 1 1
+[ 1 1 ] 0 2 2
+[ 1 2 ] 0 3 3
+[ 1 3 ] 0 4 4
+7 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_403.txt b/tools/test/h5diff/testfiles/h5diff_403.txt
new file mode 100644
index 0000000..068d01d
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_403.txt
@@ -0,0 +1,13 @@
+dataset: </softlink_dset1_1> and </softlink_dset2>
+size: [2x4] [2x4]
+position softlink_dset1_1 softlink_dset2 difference
+------------------------------------------------------------
+[ 0 1 ] 1 0 1
+[ 0 2 ] 2 0 2
+[ 0 3 ] 3 0 3
+[ 1 0 ] 1 0 1
+[ 1 1 ] 2 0 2
+[ 1 2 ] 3 0 3
+[ 1 3 ] 4 0 4
+7 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_404.txt b/tools/test/h5diff/testfiles/h5diff_404.txt
new file mode 100644
index 0000000..db317d1
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_404.txt
@@ -0,0 +1,32 @@
+
+file1 file2
+---------------------------------------
+ x x /
+ x x /ext_link_dset1
+ x x /ext_link_dset2
+ x x /ext_link_grp1
+ x x /ext_link_grp1/x_dset
+ x x /ext_link_grp2
+ x x /ext_link_grp2/x_dset
+ x x /ext_link_noexist1
+ x x /ext_link_noexist2
+
+group : </> and </>
+0 differences found
+dataset: </ext_link_dset1> and </ext_link_dset1>
+0 differences found
+dataset: </ext_link_dset2> and </ext_link_dset2>
+0 differences found
+group : </ext_link_grp1> and </ext_link_grp1>
+0 differences found
+dataset: </ext_link_grp1/x_dset> and </ext_link_grp1/x_dset>
+0 differences found
+group : </ext_link_grp2> and </ext_link_grp2>
+0 differences found
+dataset: </ext_link_grp2/x_dset> and </ext_link_grp2/x_dset>
+0 differences found
+dangling link: </ext_link_noexist1> and </ext_link_noexist1>
+0 differences found
+dangling link: </ext_link_noexist2> and </ext_link_noexist2>
+0 differences found
+EXIT CODE: 0
diff --git a/tools/test/h5diff/testfiles/h5diff_405.txt b/tools/test/h5diff/testfiles/h5diff_405.txt
new file mode 100644
index 0000000..890dd33
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_405.txt
@@ -0,0 +1,13 @@
+dataset: </ext_link_dset1> and </target_group2/x_dset>
+size: [2x4] [2x4]
+position ext_link_dset1 x_dset difference
+------------------------------------------------------------
+[ 0 1 ] 1 0 1
+[ 0 2 ] 2 0 2
+[ 0 3 ] 3 0 3
+[ 1 0 ] 1 0 1
+[ 1 1 ] 2 0 2
+[ 1 2 ] 3 0 3
+[ 1 3 ] 4 0 4
+7 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_406.txt b/tools/test/h5diff/testfiles/h5diff_406.txt
new file mode 100644
index 0000000..7fa442a
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_406.txt
@@ -0,0 +1,13 @@
+dataset: </target_group2/x_dset> and </ext_link_dset1>
+size: [2x4] [2x4]
+position x_dset ext_link_dset1 difference
+------------------------------------------------------------
+[ 0 1 ] 0 1 1
+[ 0 2 ] 0 2 2
+[ 0 3 ] 0 3 3
+[ 1 0 ] 0 1 1
+[ 1 1 ] 0 2 2
+[ 1 2 ] 0 3 3
+[ 1 3 ] 0 4 4
+7 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_407.txt b/tools/test/h5diff/testfiles/h5diff_407.txt
new file mode 100644
index 0000000..3693ab9
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_407.txt
@@ -0,0 +1,13 @@
+dataset: </ext_link_dset1> and </ext_link_dset2>
+size: [2x4] [2x4]
+position ext_link_dset1 ext_link_dset2 difference
+------------------------------------------------------------
+[ 0 1 ] 1 0 1
+[ 0 2 ] 2 0 2
+[ 0 3 ] 3 0 3
+[ 1 0 ] 1 0 1
+[ 1 1 ] 2 0 2
+[ 1 2 ] 3 0 3
+[ 1 3 ] 4 0 4
+7 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_408.txt b/tools/test/h5diff/testfiles/h5diff_408.txt
new file mode 100644
index 0000000..e941f9b
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_408.txt
@@ -0,0 +1,13 @@
+dataset: </softlink_dset1_1> and </ext_link_dset2>
+size: [2x4] [2x4]
+position softlink_dset1_1 ext_link_dset2 difference
+------------------------------------------------------------
+[ 0 1 ] 1 0 1
+[ 0 2 ] 2 0 2
+[ 0 3 ] 3 0 3
+[ 1 0 ] 1 0 1
+[ 1 1 ] 2 0 2
+[ 1 2 ] 3 0 3
+[ 1 3 ] 4 0 4
+7 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_409.txt b/tools/test/h5diff/testfiles/h5diff_409.txt
new file mode 100644
index 0000000..007da7d
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_409.txt
@@ -0,0 +1,13 @@
+dataset: </ext_link_dset2> and </softlink_dset1_1>
+size: [2x4] [2x4]
+position ext_link_dset2 softlink_dset1_1 difference
+------------------------------------------------------------
+[ 0 1 ] 0 1 1
+[ 0 2 ] 0 2 2
+[ 0 3 ] 0 3 3
+[ 1 0 ] 0 1 1
+[ 1 1 ] 0 2 2
+[ 1 2 ] 0 3 3
+[ 1 3 ] 0 4 4
+7 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_410.txt b/tools/test/h5diff/testfiles/h5diff_410.txt
new file mode 100644
index 0000000..6087bb8
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_410.txt
@@ -0,0 +1,62 @@
+
+file1 file2
+---------------------------------------
+ x x /
+ x x /softlink1_to_dset1
+ x x /softlink1_to_slink1
+ x x /softlink1_to_slink2
+ x x /softlink2_to_dset2
+ x x /softlink2_to_slink1
+ x x /softlink2_to_slink2
+ x x /softlink3_to_group1
+ x x /softlink3_to_slink1
+ x x /softlink3_to_slink2
+ x x /softlink4_to_group2
+ x x /softlink4_to_slink1
+ x x /softlink4_to_slink2
+ x x /target_dset1
+ x x /target_dset2
+ x x /target_group
+ x x /target_group/dset
+ x x /target_group1
+ x x /target_group2
+
+group : </> and </>
+0 differences found
+dataset: </softlink1_to_dset1> and </softlink1_to_dset1>
+0 differences found
+dataset: </softlink1_to_slink1> and </softlink1_to_slink1>
+0 differences found
+dataset: </softlink1_to_slink2> and </softlink1_to_slink2>
+0 differences found
+dataset: </softlink2_to_dset2> and </softlink2_to_dset2>
+0 differences found
+dataset: </softlink2_to_slink1> and </softlink2_to_slink1>
+0 differences found
+dataset: </softlink2_to_slink2> and </softlink2_to_slink2>
+0 differences found
+group : </softlink3_to_group1> and </softlink3_to_group1>
+0 differences found
+group : </softlink3_to_slink1> and </softlink3_to_slink1>
+0 differences found
+group : </softlink3_to_slink2> and </softlink3_to_slink2>
+0 differences found
+group : </softlink4_to_group2> and </softlink4_to_group2>
+0 differences found
+group : </softlink4_to_slink1> and </softlink4_to_slink1>
+0 differences found
+group : </softlink4_to_slink2> and </softlink4_to_slink2>
+0 differences found
+dataset: </target_dset1> and </target_dset1>
+0 differences found
+dataset: </target_dset2> and </target_dset2>
+0 differences found
+group : </target_group> and </target_group>
+0 differences found
+dataset: </target_group/dset> and </target_group/dset>
+0 differences found
+group : </target_group1> and </target_group1>
+0 differences found
+group : </target_group2> and </target_group2>
+0 differences found
+EXIT CODE: 0
diff --git a/tools/test/h5diff/testfiles/h5diff_411.txt b/tools/test/h5diff/testfiles/h5diff_411.txt
new file mode 100644
index 0000000..161ab34
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_411.txt
@@ -0,0 +1,13 @@
+dataset: </target_dset2> and </softlink1_to_slink2>
+size: [2x4] [2x4]
+position target_dset2 softlink1_to_slink2 difference
+------------------------------------------------------------
+[ 0 1 ] 0 1 1
+[ 0 2 ] 0 2 2
+[ 0 3 ] 0 3 3
+[ 1 0 ] 0 1 1
+[ 1 1 ] 0 2 2
+[ 1 2 ] 0 3 3
+[ 1 3 ] 0 4 4
+7 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_412.txt b/tools/test/h5diff/testfiles/h5diff_412.txt
new file mode 100644
index 0000000..bb8209c
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_412.txt
@@ -0,0 +1,13 @@
+dataset: </softlink1_to_slink2> and </target_dset2>
+size: [2x4] [2x4]
+position softlink1_to_slink2 target_dset2 difference
+------------------------------------------------------------
+[ 0 1 ] 1 0 1
+[ 0 2 ] 2 0 2
+[ 0 3 ] 3 0 3
+[ 1 0 ] 1 0 1
+[ 1 1 ] 2 0 2
+[ 1 2 ] 3 0 3
+[ 1 3 ] 4 0 4
+7 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_413.txt b/tools/test/h5diff/testfiles/h5diff_413.txt
new file mode 100644
index 0000000..8df3d51
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_413.txt
@@ -0,0 +1,13 @@
+dataset: </softlink1_to_slink2> and </softlink2_to_slink2>
+size: [2x4] [2x4]
+position softlink1_to_slink2 softlink2_to_slink2 difference
+------------------------------------------------------------
+[ 0 1 ] 1 0 1
+[ 0 2 ] 2 0 2
+[ 0 3 ] 3 0 3
+[ 1 0 ] 1 0 1
+[ 1 1 ] 2 0 2
+[ 1 2 ] 3 0 3
+[ 1 3 ] 4 0 4
+7 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_414.txt b/tools/test/h5diff/testfiles/h5diff_414.txt
new file mode 100644
index 0000000..a47349e
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_414.txt
@@ -0,0 +1,9 @@
+
+group1 group2
+---------------------------------------
+ x x
+ x /dset
+
+group : </target_group> and </softlink3_to_slink2>
+0 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_415.txt b/tools/test/h5diff/testfiles/h5diff_415.txt
new file mode 100644
index 0000000..30cc947
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_415.txt
@@ -0,0 +1,9 @@
+
+group1 group2
+---------------------------------------
+ x x
+ x /dset
+
+group : </softlink3_to_slink2> and </target_group>
+0 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_416.txt b/tools/test/h5diff/testfiles/h5diff_416.txt
new file mode 100644
index 0000000..551a6c3
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_416.txt
@@ -0,0 +1,8 @@
+
+group1 group2
+---------------------------------------
+ x x
+
+group : </softlink3_to_slink2> and </softlink4_to_slink2>
+0 differences found
+EXIT CODE: 0
diff --git a/tools/test/h5diff/testfiles/h5diff_417.txt b/tools/test/h5diff/testfiles/h5diff_417.txt
new file mode 100644
index 0000000..0ea2542
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_417.txt
@@ -0,0 +1,3 @@
+obj1 </softlink_noexist> is a dangling link.
+1 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_418.txt b/tools/test/h5diff/testfiles/h5diff_418.txt
new file mode 100644
index 0000000..46222bb
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_418.txt
@@ -0,0 +1,3 @@
+obj2 </softlink_noexist> is a dangling link.
+1 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_419.txt b/tools/test/h5diff/testfiles/h5diff_419.txt
new file mode 100644
index 0000000..387c600
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_419.txt
@@ -0,0 +1,3 @@
+obj1 </ext_link_noexist2> is a dangling link.
+1 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_420.txt b/tools/test/h5diff/testfiles/h5diff_420.txt
new file mode 100644
index 0000000..f3e65d9
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_420.txt
@@ -0,0 +1,3 @@
+obj2 </ext_link_noexist2> is a dangling link.
+1 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_421.txt b/tools/test/h5diff/testfiles/h5diff_421.txt
new file mode 100644
index 0000000..833c60c
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_421.txt
@@ -0,0 +1,3 @@
+obj2 </ext_link_noexist1> is a dangling link.
+1 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_422.txt b/tools/test/h5diff/testfiles/h5diff_422.txt
new file mode 100644
index 0000000..3e675d5
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_422.txt
@@ -0,0 +1,3 @@
+obj1 </ext_link_noexist1> is a dangling link.
+1 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_423.txt b/tools/test/h5diff/testfiles/h5diff_423.txt
new file mode 100644
index 0000000..1ebc157
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_423.txt
@@ -0,0 +1,13 @@
+dataset: </ext_link_to_slink1> and </dset2>
+size: [2x4] [2x4]
+position ext_link_to_slink1 dset2 difference
+------------------------------------------------------------
+[ 0 1 ] 0 1 1
+[ 0 2 ] 0 2 2
+[ 0 3 ] 0 3 3
+[ 1 0 ] 0 1 1
+[ 1 1 ] 0 2 2
+[ 1 2 ] 0 3 3
+[ 1 3 ] 0 4 4
+7 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_424.txt b/tools/test/h5diff/testfiles/h5diff_424.txt
new file mode 100644
index 0000000..9099c41
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_424.txt
@@ -0,0 +1,13 @@
+dataset: </dset2> and </ext_link_to_slink1>
+size: [2x4] [2x4]
+position dset2 ext_link_to_slink1 difference
+------------------------------------------------------------
+[ 0 1 ] 1 0 1
+[ 0 2 ] 2 0 2
+[ 0 3 ] 3 0 3
+[ 1 0 ] 1 0 1
+[ 1 1 ] 2 0 2
+[ 1 2 ] 3 0 3
+[ 1 3 ] 4 0 4
+7 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_425.txt b/tools/test/h5diff/testfiles/h5diff_425.txt
new file mode 100644
index 0000000..03ceb78
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_425.txt
@@ -0,0 +1,13 @@
+dataset: </ext_link_to_slink1> and </ext_link_to_slink2>
+size: [2x4] [2x4]
+position ext_link_to_slink1 ext_link_to_slink2 difference
+------------------------------------------------------------
+[ 0 1 ] 0 1 1
+[ 0 2 ] 0 2 2
+[ 0 3 ] 0 3 3
+[ 1 0 ] 0 1 1
+[ 1 1 ] 0 2 2
+[ 1 2 ] 0 3 3
+[ 1 3 ] 0 4 4
+7 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_450.txt b/tools/test/h5diff/testfiles/h5diff_450.txt
new file mode 100644
index 0000000..a63d78f
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_450.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
+dangling link: </ext_link1> and </ext_link1>
+0 differences found
+obj2 </ext_link2> is a dangling link.
+1 differences found
+obj1 </ext_link3> is a dangling link.
+1 differences found
+dangling link: </ext_link4> and </ext_link4>
+0 differences found
+dangling link: </soft_link1> and </soft_link1>
+0 differences found
+obj2 </soft_link2> is a dangling link.
+1 differences found
+obj1 </soft_link3> is a dangling link.
+1 differences found
+dangling link: </soft_link4> and </soft_link4>
+0 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_451.txt b/tools/test/h5diff/testfiles/h5diff_451.txt
new file mode 100644
index 0000000..fd0691f
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_451.txt
@@ -0,0 +1,30 @@
+
+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
+Warning: </ext_link1> is a dangling link.
+Warning: </ext_link2> is a dangling link.
+Warning: </ext_link3> is a dangling link.
+Warning: </ext_link4> is a dangling link.
+Warning: </soft_link1> is a dangling link.
+Warning: </soft_link2> is a dangling link.
+Warning: </soft_link3> is a dangling link.
+Warning: </soft_link4> is a dangling link.
+EXIT CODE: 2
diff --git a/tools/test/h5diff/testfiles/h5diff_452.txt b/tools/test/h5diff/testfiles/h5diff_452.txt
new file mode 100644
index 0000000..05403af
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_452.txt
@@ -0,0 +1,2 @@
+Error: --no-dangling-links must be used along with --follow-symlinks option.
+EXIT CODE: 2
diff --git a/tools/test/h5diff/testfiles/h5diff_453.txt b/tools/test/h5diff/testfiles/h5diff_453.txt
new file mode 100644
index 0000000..8a5ca52
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_453.txt
@@ -0,0 +1,34 @@
+
+file1 file2
+---------------------------------------
+ x x /
+ x x /softlink_dset1_1
+ x x /softlink_dset2
+ x x /softlink_group1
+ x x /softlink_group1/dset
+ x x /softlink_noexist
+ x x /target_dset1
+ x x /target_dset2
+ x x /target_group
+ x x /target_group/dset
+
+group : </> and </>
+0 differences found
+dataset: </softlink_dset1_1> and </softlink_dset1_1>
+0 differences found
+dataset: </softlink_dset2> and </softlink_dset2>
+0 differences found
+group : </softlink_group1> and </softlink_group1>
+0 differences found
+dataset: </softlink_group1/dset> and </softlink_group1/dset>
+0 differences found
+Warning: </softlink_noexist> is a dangling link.
+dataset: </target_dset1> and </target_dset1>
+0 differences found
+dataset: </target_dset2> and </target_dset2>
+0 differences found
+group : </target_group> and </target_group>
+0 differences found
+dataset: </target_group/dset> and </target_group/dset>
+0 differences found
+EXIT CODE: 2
diff --git a/tools/test/h5diff/testfiles/h5diff_454.txt b/tools/test/h5diff/testfiles/h5diff_454.txt
new file mode 100644
index 0000000..dcc2e9c
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_454.txt
@@ -0,0 +1,2 @@
+Warning: </softlink_noexist> is a dangling link.
+EXIT CODE: 2
diff --git a/tools/test/h5diff/testfiles/h5diff_455.txt b/tools/test/h5diff/testfiles/h5diff_455.txt
new file mode 100644
index 0000000..dcc2e9c
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_455.txt
@@ -0,0 +1,2 @@
+Warning: </softlink_noexist> is a dangling link.
+EXIT CODE: 2
diff --git a/tools/test/h5diff/testfiles/h5diff_456.txt b/tools/test/h5diff/testfiles/h5diff_456.txt
new file mode 100644
index 0000000..9317988
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_456.txt
@@ -0,0 +1,30 @@
+
+file1 file2
+---------------------------------------
+ x x /
+ x x /ext_link_dset1
+ x x /ext_link_dset2
+ x x /ext_link_grp1
+ x x /ext_link_grp1/x_dset
+ x x /ext_link_grp2
+ x x /ext_link_grp2/x_dset
+ x x /ext_link_noexist1
+ x x /ext_link_noexist2
+
+group : </> and </>
+0 differences found
+dataset: </ext_link_dset1> and </ext_link_dset1>
+0 differences found
+dataset: </ext_link_dset2> and </ext_link_dset2>
+0 differences found
+group : </ext_link_grp1> and </ext_link_grp1>
+0 differences found
+dataset: </ext_link_grp1/x_dset> and </ext_link_grp1/x_dset>
+0 differences found
+group : </ext_link_grp2> and </ext_link_grp2>
+0 differences found
+dataset: </ext_link_grp2/x_dset> and </ext_link_grp2/x_dset>
+0 differences found
+Warning: </ext_link_noexist1> is a dangling link.
+Warning: </ext_link_noexist2> is a dangling link.
+EXIT CODE: 2
diff --git a/tools/test/h5diff/testfiles/h5diff_457.txt b/tools/test/h5diff/testfiles/h5diff_457.txt
new file mode 100644
index 0000000..762ccdc
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_457.txt
@@ -0,0 +1,2 @@
+Warning: </ext_link_noexist1> is a dangling link.
+EXIT CODE: 2
diff --git a/tools/test/h5diff/testfiles/h5diff_458.txt b/tools/test/h5diff/testfiles/h5diff_458.txt
new file mode 100644
index 0000000..067d665
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_458.txt
@@ -0,0 +1,2 @@
+Warning: </ext_link_noexist2> is a dangling link.
+EXIT CODE: 2
diff --git a/tools/test/h5diff/testfiles/h5diff_459.txt b/tools/test/h5diff/testfiles/h5diff_459.txt
new file mode 100644
index 0000000..762ccdc
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_459.txt
@@ -0,0 +1,2 @@
+Warning: </ext_link_noexist1> is a dangling link.
+EXIT CODE: 2
diff --git a/tools/test/h5diff/testfiles/h5diff_465.txt b/tools/test/h5diff/testfiles/h5diff_465.txt
new file mode 100644
index 0000000..eca5994
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_465.txt
@@ -0,0 +1 @@
+EXIT CODE: 0
diff --git a/tools/test/h5diff/testfiles/h5diff_466.txt b/tools/test/h5diff/testfiles/h5diff_466.txt
new file mode 100644
index 0000000..3e00ca3
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_466.txt
@@ -0,0 +1,5 @@
+obj1 </soft_link1> is a dangling link.
+obj2 </soft_link1> is a dangling link.
+dangling link: </soft_link1> and </soft_link1>
+0 differences found
+EXIT CODE: 0
diff --git a/tools/test/h5diff/testfiles/h5diff_467.txt b/tools/test/h5diff/testfiles/h5diff_467.txt
new file mode 100644
index 0000000..f5195c0
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_467.txt
@@ -0,0 +1,3 @@
+obj2 </soft_link2> is a dangling link.
+1 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_468.txt b/tools/test/h5diff/testfiles/h5diff_468.txt
new file mode 100644
index 0000000..75b16c6
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_468.txt
@@ -0,0 +1,5 @@
+obj1 </ext_link4> is a dangling link.
+obj2 </ext_link4> is a dangling link.
+dangling link: </ext_link4> and </ext_link4>
+0 differences found
+EXIT CODE: 0
diff --git a/tools/test/h5diff/testfiles/h5diff_469.txt b/tools/test/h5diff/testfiles/h5diff_469.txt
new file mode 100644
index 0000000..594fd80
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_469.txt
@@ -0,0 +1,3 @@
+obj2 </ext_link2> is a dangling link.
+1 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_471.txt b/tools/test/h5diff/testfiles/h5diff_471.txt
new file mode 100644
index 0000000..124cdd7
--- /dev/null
+++ b/tools/test/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/test/h5diff/testfiles/h5diff_472.txt b/tools/test/h5diff/testfiles/h5diff_472.txt
new file mode 100644
index 0000000..57a8af4
--- /dev/null
+++ b/tools/test/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/test/h5diff/testfiles/h5diff_473.txt b/tools/test/h5diff/testfiles/h5diff_473.txt
new file mode 100644
index 0000000..4c1855d
--- /dev/null
+++ b/tools/test/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/test/h5diff/testfiles/h5diff_474.txt b/tools/test/h5diff/testfiles/h5diff_474.txt
new file mode 100644
index 0000000..7807551
--- /dev/null
+++ b/tools/test/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/test/h5diff/testfiles/h5diff_475.txt b/tools/test/h5diff/testfiles/h5diff_475.txt
new file mode 100644
index 0000000..be6110e
--- /dev/null
+++ b/tools/test/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/test/h5diff/testfiles/h5diff_480.txt b/tools/test/h5diff/testfiles/h5diff_480.txt
new file mode 100644
index 0000000..3e1f900
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_480.txt
@@ -0,0 +1,17 @@
+
+file1 file2
+---------------------------------------
+ x x /
+ x x /dset1
+ x x /group1
+ x x /group1/dset2
+
+group : </> and </>
+0 differences found
+dataset: </dset1> and </dset1>
+0 differences found
+group : </group1> and </group1>
+0 differences found
+dataset: </group1/dset2> and </group1/dset2>
+0 differences found
+EXIT CODE: 0
diff --git a/tools/test/h5diff/testfiles/h5diff_481.txt b/tools/test/h5diff/testfiles/h5diff_481.txt
new file mode 100644
index 0000000..c4f2448
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_481.txt
@@ -0,0 +1,30 @@
+
+file1 file2
+---------------------------------------
+ x x /
+ x x /dset1
+ x x /group1
+ x x /group1/dset2
+ x x /group1/dset3
+
+group : </> and </>
+0 differences found
+dataset: </dset1> and </dset1>
+0 differences found
+group : </group1> and </group1>
+0 differences found
+dataset: </group1/dset2> and </group1/dset2>
+0 differences found
+dataset: </group1/dset3> and </group1/dset3>
+size: [2x4] [2x4]
+position dset3 dset3 difference
+------------------------------------------------------------
+[ 0 1 ] 0 1 1
+[ 0 2 ] 0 2 2
+[ 0 3 ] 0 3 3
+[ 1 0 ] 0 1 1
+[ 1 1 ] 0 2 2
+[ 1 2 ] 0 3 3
+[ 1 3 ] 0 4 4
+7 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_482.txt b/tools/test/h5diff/testfiles/h5diff_482.txt
new file mode 100644
index 0000000..5b3c8c1
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_482.txt
@@ -0,0 +1,17 @@
+
+file1 file2
+---------------------------------------
+ x x /
+ x x /dset10
+ x x /group10
+ x x /group10/dset2
+
+group : </> and </>
+0 differences found
+dataset: </dset10> and </dset10>
+0 differences found
+group : </group10> and </group10>
+0 differences found
+dataset: </group10/dset2> and </group10/dset2>
+0 differences found
+EXIT CODE: 0
diff --git a/tools/test/h5diff/testfiles/h5diff_483.txt b/tools/test/h5diff/testfiles/h5diff_483.txt
new file mode 100644
index 0000000..a45e928
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_483.txt
@@ -0,0 +1,18 @@
+
+file1 file2
+---------------------------------------
+ x x /
+ x /dset1
+ x x /dset10
+ x x /group10
+ x x /group10/dset2
+
+group : </> and </>
+0 differences found
+dataset: </dset10> and </dset10>
+0 differences found
+group : </group10> and </group10>
+0 differences found
+dataset: </group10/dset2> and </group10/dset2>
+0 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_484.txt b/tools/test/h5diff/testfiles/h5diff_484.txt
new file mode 100644
index 0000000..87d9c7c
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_484.txt
@@ -0,0 +1,11 @@
+
+group1 group2
+---------------------------------------
+ x x
+ x x /dset2
+
+group : </group1> and </group1>
+0 differences found
+dataset: </group1/dset2> and </group1/dset2>
+0 differences found
+EXIT CODE: 0
diff --git a/tools/test/h5diff/testfiles/h5diff_485.txt b/tools/test/h5diff/testfiles/h5diff_485.txt
new file mode 100644
index 0000000..4175809
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_485.txt
@@ -0,0 +1,11 @@
+
+file1 file2
+---------------------------------------
+ x x /
+ x x /dset1
+
+group : </> and </>
+0 differences found
+dataset: </dset1> and </dset1>
+0 differences found
+EXIT CODE: 0
diff --git a/tools/test/h5diff/testfiles/h5diff_486.txt b/tools/test/h5diff/testfiles/h5diff_486.txt
new file mode 100644
index 0000000..4175809
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_486.txt
@@ -0,0 +1,11 @@
+
+file1 file2
+---------------------------------------
+ x x /
+ x x /dset1
+
+group : </> and </>
+0 differences found
+dataset: </dset1> and </dset1>
+0 differences found
+EXIT CODE: 0
diff --git a/tools/test/h5diff/testfiles/h5diff_487.txt b/tools/test/h5diff/testfiles/h5diff_487.txt
new file mode 100644
index 0000000..8555a71
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_487.txt
@@ -0,0 +1,12 @@
+
+file1 file2
+---------------------------------------
+ x x /
+ x x /dset1
+ x /group1
+
+group : </> and </>
+0 differences found
+dataset: </dset1> and </dset1>
+0 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_50.txt b/tools/test/h5diff/testfiles/h5diff_50.txt
new file mode 100644
index 0000000..434b458
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_50.txt
@@ -0,0 +1,13 @@
+dataset: </dset0a> and </dset0b>
+Warning: different storage datatype
+</dset0a> has file datatype H5T_STD_I16LE
+</dset0b> has file datatype H5T_STD_I32LE
+size: [3x2] [3x2]
+position dset0a dset0b difference
+------------------------------------------------------------
+[ 1 0 ] 1 3 2
+[ 1 1 ] 1 4 3
+[ 2 0 ] 1 5 4
+[ 2 1 ] 1 6 5
+4 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_500.txt b/tools/test/h5diff/testfiles/h5diff_500.txt
new file mode 100644
index 0000000..7d688d2
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_500.txt
@@ -0,0 +1,72 @@
+
+file1 file2
+---------------------------------------
+ x x /
+ x x /dset1
+ x x /dset2
+ x x /dset3
+ x x /elink_grp1
+ x x /elink_grp2
+ x x /elink_grp3
+ x x /grp1
+ x x /grp1/dset1
+ x x /grp1/grp2
+ x x /grp1/grp2/dset1
+ x x /grp1/grp2/dset2
+ x x /grp1/grp2/grp3
+ x x /grp1/grp2/grp3/dset1
+ x x /grp1/grp2/grp3/dset2
+ x x /grp1/grp2/grp3/dset3
+ x /grp10
+ x /grp10/dset4
+ x /grp10/dset5
+ x /grp10/elink_grp_circle
+ x /grp11
+ x /grp11/dset4
+ x /grp11/dset5
+ x /grp11/elink_grp_circle
+ x x /slink_grp1
+ x /slink_grp10
+ x /slink_grp11
+ x x /slink_grp2
+ x x /slink_grp3
+
+group : </> and </>
+0 differences found
+dataset: </dset1> and </dset1>
+0 differences found
+dataset: </dset2> and </dset2>
+0 differences found
+dataset: </dset3> and </dset3>
+0 differences found
+external link: </elink_grp1> and </elink_grp1>
+1 differences found
+external link: </elink_grp2> and </elink_grp2>
+1 differences found
+external link: </elink_grp3> and </elink_grp3>
+1 differences found
+group : </grp1> and </grp1>
+0 differences found
+dataset: </grp1/dset1> and </grp1/dset1>
+0 differences found
+group : </grp1/grp2> and </grp1/grp2>
+0 differences found
+dataset: </grp1/grp2/dset1> and </grp1/grp2/dset1>
+0 differences found
+dataset: </grp1/grp2/dset2> and </grp1/grp2/dset2>
+0 differences found
+group : </grp1/grp2/grp3> and </grp1/grp2/grp3>
+0 differences found
+dataset: </grp1/grp2/grp3/dset1> and </grp1/grp2/grp3/dset1>
+0 differences found
+dataset: </grp1/grp2/grp3/dset2> and </grp1/grp2/grp3/dset2>
+0 differences found
+dataset: </grp1/grp2/grp3/dset3> and </grp1/grp2/grp3/dset3>
+0 differences found
+link : </slink_grp1> and </slink_grp1>
+0 differences found
+link : </slink_grp2> and </slink_grp2>
+0 differences found
+link : </slink_grp3> and </slink_grp3>
+0 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_501.txt b/tools/test/h5diff/testfiles/h5diff_501.txt
new file mode 100644
index 0000000..75e91da
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_501.txt
@@ -0,0 +1,188 @@
+
+file1 file2
+---------------------------------------
+ x x /
+ x x /dset1
+ x x /dset2
+ x x /dset3
+ x x /elink_grp1
+ x x /elink_grp1/dset1
+ x x /elink_grp1/grp2
+ x x /elink_grp1/grp2/dset1
+ x x /elink_grp1/grp2/dset2
+ x x /elink_grp1/grp2/grp3
+ x x /elink_grp1/grp2/grp3/dset1
+ x x /elink_grp1/grp2/grp3/dset2
+ x x /elink_grp1/grp2/grp3/dset3
+ x x /elink_grp2
+ x x /elink_grp2/dset1
+ x x /elink_grp2/dset2
+ x x /elink_grp2/grp3
+ x x /elink_grp2/grp3/dset1
+ x x /elink_grp2/grp3/dset2
+ x x /elink_grp2/grp3/dset3
+ x x /elink_grp3
+ x x /elink_grp3/dset1
+ x x /elink_grp3/dset2
+ x x /elink_grp3/dset3
+ x x /grp1
+ x x /grp1/dset1
+ x x /grp1/grp2
+ x x /grp1/grp2/dset1
+ x x /grp1/grp2/dset2
+ x x /grp1/grp2/grp3
+ x x /grp1/grp2/grp3/dset1
+ x x /grp1/grp2/grp3/dset2
+ x x /grp1/grp2/grp3/dset3
+ x /grp10
+ x /grp10/dset4
+ x /grp10/dset5
+ x /grp10/elink_grp_circle
+ x /grp10/elink_grp_circle/dset4
+ x /grp10/elink_grp_circle/dset5
+ x /grp10/elink_grp_circle/elink_grp_circle
+ x /grp10/elink_grp_circle/elink_grp_circle/dset4
+ x /grp10/elink_grp_circle/elink_grp_circle/dset5
+ x /grp11
+ x /grp11/dset4
+ x /grp11/dset5
+ x /grp11/elink_grp_circle
+ x /grp11/elink_grp_circle/dset4
+ x /grp11/elink_grp_circle/dset5
+ x /grp11/elink_grp_circle/elink_grp_circle
+ x /grp11/elink_grp_circle/elink_grp_circle/dset4
+ x /grp11/elink_grp_circle/elink_grp_circle/dset5
+ x x /slink_grp1
+ x x /slink_grp1/dset1
+ x x /slink_grp1/grp2
+ x x /slink_grp1/grp2/dset1
+ x x /slink_grp1/grp2/dset2
+ x x /slink_grp1/grp2/grp3
+ x x /slink_grp1/grp2/grp3/dset1
+ x x /slink_grp1/grp2/grp3/dset2
+ x x /slink_grp1/grp2/grp3/dset3
+ x /slink_grp10
+ x /slink_grp10/dset4
+ x /slink_grp10/dset5
+ x /slink_grp11
+ x /slink_grp11/dset4
+ x /slink_grp11/dset5
+ x x /slink_grp2
+ x x /slink_grp2/dset1
+ x x /slink_grp2/dset2
+ x x /slink_grp2/grp3
+ x x /slink_grp2/grp3/dset1
+ x x /slink_grp2/grp3/dset2
+ x x /slink_grp2/grp3/dset3
+ x x /slink_grp3
+ x x /slink_grp3/dset1
+ x x /slink_grp3/dset2
+ x x /slink_grp3/dset3
+
+group : </> and </>
+0 differences found
+dataset: </dset1> and </dset1>
+0 differences found
+dataset: </dset2> and </dset2>
+0 differences found
+dataset: </dset3> and </dset3>
+0 differences found
+group : </elink_grp1> and </elink_grp1>
+0 differences found
+dataset: </elink_grp1/dset1> and </elink_grp1/dset1>
+0 differences found
+group : </elink_grp1/grp2> and </elink_grp1/grp2>
+0 differences found
+dataset: </elink_grp1/grp2/dset1> and </elink_grp1/grp2/dset1>
+0 differences found
+dataset: </elink_grp1/grp2/dset2> and </elink_grp1/grp2/dset2>
+0 differences found
+group : </elink_grp1/grp2/grp3> and </elink_grp1/grp2/grp3>
+0 differences found
+dataset: </elink_grp1/grp2/grp3/dset1> and </elink_grp1/grp2/grp3/dset1>
+0 differences found
+dataset: </elink_grp1/grp2/grp3/dset2> and </elink_grp1/grp2/grp3/dset2>
+0 differences found
+dataset: </elink_grp1/grp2/grp3/dset3> and </elink_grp1/grp2/grp3/dset3>
+0 differences found
+group : </elink_grp2> and </elink_grp2>
+0 differences found
+dataset: </elink_grp2/dset1> and </elink_grp2/dset1>
+0 differences found
+dataset: </elink_grp2/dset2> and </elink_grp2/dset2>
+0 differences found
+group : </elink_grp2/grp3> and </elink_grp2/grp3>
+0 differences found
+dataset: </elink_grp2/grp3/dset1> and </elink_grp2/grp3/dset1>
+0 differences found
+dataset: </elink_grp2/grp3/dset2> and </elink_grp2/grp3/dset2>
+0 differences found
+dataset: </elink_grp2/grp3/dset3> and </elink_grp2/grp3/dset3>
+0 differences found
+group : </elink_grp3> and </elink_grp3>
+0 differences found
+dataset: </elink_grp3/dset1> and </elink_grp3/dset1>
+0 differences found
+dataset: </elink_grp3/dset2> and </elink_grp3/dset2>
+0 differences found
+dataset: </elink_grp3/dset3> and </elink_grp3/dset3>
+0 differences found
+group : </grp1> and </grp1>
+0 differences found
+dataset: </grp1/dset1> and </grp1/dset1>
+0 differences found
+group : </grp1/grp2> and </grp1/grp2>
+0 differences found
+dataset: </grp1/grp2/dset1> and </grp1/grp2/dset1>
+0 differences found
+dataset: </grp1/grp2/dset2> and </grp1/grp2/dset2>
+0 differences found
+group : </grp1/grp2/grp3> and </grp1/grp2/grp3>
+0 differences found
+dataset: </grp1/grp2/grp3/dset1> and </grp1/grp2/grp3/dset1>
+0 differences found
+dataset: </grp1/grp2/grp3/dset2> and </grp1/grp2/grp3/dset2>
+0 differences found
+dataset: </grp1/grp2/grp3/dset3> and </grp1/grp2/grp3/dset3>
+0 differences found
+group : </slink_grp1> and </slink_grp1>
+0 differences found
+dataset: </slink_grp1/dset1> and </slink_grp1/dset1>
+0 differences found
+group : </slink_grp1/grp2> and </slink_grp1/grp2>
+0 differences found
+dataset: </slink_grp1/grp2/dset1> and </slink_grp1/grp2/dset1>
+0 differences found
+dataset: </slink_grp1/grp2/dset2> and </slink_grp1/grp2/dset2>
+0 differences found
+group : </slink_grp1/grp2/grp3> and </slink_grp1/grp2/grp3>
+0 differences found
+dataset: </slink_grp1/grp2/grp3/dset1> and </slink_grp1/grp2/grp3/dset1>
+0 differences found
+dataset: </slink_grp1/grp2/grp3/dset2> and </slink_grp1/grp2/grp3/dset2>
+0 differences found
+dataset: </slink_grp1/grp2/grp3/dset3> and </slink_grp1/grp2/grp3/dset3>
+0 differences found
+group : </slink_grp2> and </slink_grp2>
+0 differences found
+dataset: </slink_grp2/dset1> and </slink_grp2/dset1>
+0 differences found
+dataset: </slink_grp2/dset2> and </slink_grp2/dset2>
+0 differences found
+group : </slink_grp2/grp3> and </slink_grp2/grp3>
+0 differences found
+dataset: </slink_grp2/grp3/dset1> and </slink_grp2/grp3/dset1>
+0 differences found
+dataset: </slink_grp2/grp3/dset2> and </slink_grp2/grp3/dset2>
+0 differences found
+dataset: </slink_grp2/grp3/dset3> and </slink_grp2/grp3/dset3>
+0 differences found
+group : </slink_grp3> and </slink_grp3>
+0 differences found
+dataset: </slink_grp3/dset1> and </slink_grp3/dset1>
+0 differences found
+dataset: </slink_grp3/dset2> and </slink_grp3/dset2>
+0 differences found
+dataset: </slink_grp3/dset3> and </slink_grp3/dset3>
+0 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_502.txt b/tools/test/h5diff/testfiles/h5diff_502.txt
new file mode 100644
index 0000000..d3de6e5
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_502.txt
@@ -0,0 +1,36 @@
+
+group1 group2
+---------------------------------------
+ x
+ x /
+ x x /dset1
+ x x /dset2
+ x x /dset3
+ x /elink_grp1
+ x /elink_grp2
+ x /elink_grp3
+ x /grp1
+ x /grp1/dset1
+ x /grp1/grp2
+ x /grp1/grp2/dset1
+ x /grp1/grp2/dset2
+ x /grp1/grp2/grp3
+ x /grp1/grp2/grp3/dset1
+ x /grp1/grp2/grp3/dset2
+ x /grp1/grp2/grp3/dset3
+ x /grp10
+ x /grp10/dset4
+ x /grp10/dset5
+ x /grp10/elink_grp_circle
+ x /slink_grp1
+ x /slink_grp10
+ x /slink_grp2
+ x /slink_grp3
+
+dataset: </dset1> and </grp1/grp2/grp3/dset1>
+0 differences found
+dataset: </dset2> and </grp1/grp2/grp3/dset2>
+0 differences found
+dataset: </dset3> and </grp1/grp2/grp3/dset3>
+0 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_503.txt b/tools/test/h5diff/testfiles/h5diff_503.txt
new file mode 100644
index 0000000..cf01598
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_503.txt
@@ -0,0 +1,32 @@
+
+group1 group2
+---------------------------------------
+ x x
+ x x /dset1
+ x x /grp2
+ x x /grp2/dset1
+ x x /grp2/dset2
+ x x /grp2/grp3
+ x x /grp2/grp3/dset1
+ x x /grp2/grp3/dset2
+ x x /grp2/grp3/dset3
+
+group : </grp1> and </grp1>
+0 differences found
+dataset: </grp1/dset1> and </grp1/dset1>
+0 differences found
+group : </grp1/grp2> and </grp1/grp2>
+0 differences found
+dataset: </grp1/grp2/dset1> and </grp1/grp2/dset1>
+0 differences found
+dataset: </grp1/grp2/dset2> and </grp1/grp2/dset2>
+0 differences found
+group : </grp1/grp2/grp3> and </grp1/grp2/grp3>
+0 differences found
+dataset: </grp1/grp2/grp3/dset1> and </grp1/grp2/grp3/dset1>
+0 differences found
+dataset: </grp1/grp2/grp3/dset2> and </grp1/grp2/grp3/dset2>
+0 differences found
+dataset: </grp1/grp2/grp3/dset3> and </grp1/grp2/grp3/dset3>
+0 differences found
+EXIT CODE: 0
diff --git a/tools/test/h5diff/testfiles/h5diff_504.txt b/tools/test/h5diff/testfiles/h5diff_504.txt
new file mode 100644
index 0000000..6cf43b3
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_504.txt
@@ -0,0 +1,19 @@
+
+group1 group2
+---------------------------------------
+ x x
+ x x /dset1
+ x x /dset2
+ x /dset3
+ x /grp3
+ x /grp3/dset1
+ x /grp3/dset2
+ x /grp3/dset3
+
+group : </grp1/grp2> and </grp1/grp2/grp3>
+0 differences found
+dataset: </grp1/grp2/dset1> and </grp1/grp2/grp3/dset1>
+0 differences found
+dataset: </grp1/grp2/dset2> and </grp1/grp2/grp3/dset2>
+0 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_505.txt b/tools/test/h5diff/testfiles/h5diff_505.txt
new file mode 100644
index 0000000..607b99b
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_505.txt
@@ -0,0 +1,6 @@
+Not comparable: </grp1> is of type H5G_GROUP and </slink_grp1> is of type H5G_LINK
+--------------------------------
+Some objects are not comparable
+--------------------------------
+Use -c for a list of objects without details of differences.
+EXIT CODE: 0
diff --git a/tools/test/h5diff/testfiles/h5diff_506.txt b/tools/test/h5diff/testfiles/h5diff_506.txt
new file mode 100644
index 0000000..efef9a7
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_506.txt
@@ -0,0 +1,26 @@
+
+group1 group2
+---------------------------------------
+ x x
+ x x /dset1
+ x x /dset2
+ x x /grp3
+ x x /grp3/dset1
+ x x /grp3/dset2
+ x x /grp3/dset3
+
+group : </grp1/grp2> and </slink_grp2>
+0 differences found
+dataset: </grp1/grp2/dset1> and </slink_grp2/dset1>
+0 differences found
+dataset: </grp1/grp2/dset2> and </slink_grp2/dset2>
+0 differences found
+group : </grp1/grp2/grp3> and </slink_grp2/grp3>
+0 differences found
+dataset: </grp1/grp2/grp3/dset1> and </slink_grp2/grp3/dset1>
+0 differences found
+dataset: </grp1/grp2/grp3/dset2> and </slink_grp2/grp3/dset2>
+0 differences found
+dataset: </grp1/grp2/grp3/dset3> and </slink_grp2/grp3/dset3>
+0 differences found
+EXIT CODE: 0
diff --git a/tools/test/h5diff/testfiles/h5diff_507.txt b/tools/test/h5diff/testfiles/h5diff_507.txt
new file mode 100644
index 0000000..06b7fe6
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_507.txt
@@ -0,0 +1,6 @@
+Not comparable: </grp1> is of type H5G_GROUP and </elink_grp1> is of type H5G_UDLINK
+--------------------------------
+Some objects are not comparable
+--------------------------------
+Use -c for a list of objects without details of differences.
+EXIT CODE: 0
diff --git a/tools/test/h5diff/testfiles/h5diff_508.txt b/tools/test/h5diff/testfiles/h5diff_508.txt
new file mode 100644
index 0000000..9796345
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_508.txt
@@ -0,0 +1,32 @@
+
+group1 group2
+---------------------------------------
+ x x
+ x x /dset1
+ x x /grp2
+ x x /grp2/dset1
+ x x /grp2/dset2
+ x x /grp2/grp3
+ x x /grp2/grp3/dset1
+ x x /grp2/grp3/dset2
+ x x /grp2/grp3/dset3
+
+group : </grp1> and </elink_grp1>
+0 differences found
+dataset: </grp1/dset1> and </elink_grp1/dset1>
+0 differences found
+group : </grp1/grp2> and </elink_grp1/grp2>
+0 differences found
+dataset: </grp1/grp2/dset1> and </elink_grp1/grp2/dset1>
+0 differences found
+dataset: </grp1/grp2/dset2> and </elink_grp1/grp2/dset2>
+0 differences found
+group : </grp1/grp2/grp3> and </elink_grp1/grp2/grp3>
+0 differences found
+dataset: </grp1/grp2/grp3/dset1> and </elink_grp1/grp2/grp3/dset1>
+0 differences found
+dataset: </grp1/grp2/grp3/dset2> and </elink_grp1/grp2/grp3/dset2>
+0 differences found
+dataset: </grp1/grp2/grp3/dset3> and </elink_grp1/grp2/grp3/dset3>
+0 differences found
+EXIT CODE: 0
diff --git a/tools/test/h5diff/testfiles/h5diff_509.txt b/tools/test/h5diff/testfiles/h5diff_509.txt
new file mode 100644
index 0000000..2e3e87a
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_509.txt
@@ -0,0 +1,6 @@
+Not comparable: </slink_grp1> is of type H5G_LINK and </elink_grp1> is of type H5G_UDLINK
+--------------------------------
+Some objects are not comparable
+--------------------------------
+Use -c for a list of objects without details of differences.
+EXIT CODE: 0
diff --git a/tools/test/h5diff/testfiles/h5diff_51.txt b/tools/test/h5diff/testfiles/h5diff_51.txt
new file mode 100644
index 0000000..621ba2a
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_51.txt
@@ -0,0 +1,10 @@
+dataset: </dset1a> and </dset1b>
+size: [3x2] [3x2]
+position dset1a dset1b difference
+------------------------------------------------------------
+[ 1 0 ] 1 3 2
+[ 1 1 ] 1 4 3
+[ 2 0 ] 1 5 4
+[ 2 1 ] 1 6 5
+4 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_510.txt b/tools/test/h5diff/testfiles/h5diff_510.txt
new file mode 100644
index 0000000..9d92768
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_510.txt
@@ -0,0 +1,32 @@
+
+group1 group2
+---------------------------------------
+ x x
+ x x /dset1
+ x x /grp2
+ x x /grp2/dset1
+ x x /grp2/dset2
+ x x /grp2/grp3
+ x x /grp2/grp3/dset1
+ x x /grp2/grp3/dset2
+ x x /grp2/grp3/dset3
+
+group : </slink_grp1> and </elink_grp1>
+0 differences found
+dataset: </slink_grp1/dset1> and </elink_grp1/dset1>
+0 differences found
+group : </slink_grp1/grp2> and </elink_grp1/grp2>
+0 differences found
+dataset: </slink_grp1/grp2/dset1> and </elink_grp1/grp2/dset1>
+0 differences found
+dataset: </slink_grp1/grp2/dset2> and </elink_grp1/grp2/dset2>
+0 differences found
+group : </slink_grp1/grp2/grp3> and </elink_grp1/grp2/grp3>
+0 differences found
+dataset: </slink_grp1/grp2/grp3/dset1> and </elink_grp1/grp2/grp3/dset1>
+0 differences found
+dataset: </slink_grp1/grp2/grp3/dset2> and </elink_grp1/grp2/grp3/dset2>
+0 differences found
+dataset: </slink_grp1/grp2/grp3/dset3> and </elink_grp1/grp2/grp3/dset3>
+0 differences found
+EXIT CODE: 0
diff --git a/tools/test/h5diff/testfiles/h5diff_511.txt b/tools/test/h5diff/testfiles/h5diff_511.txt
new file mode 100644
index 0000000..4bac100
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_511.txt
@@ -0,0 +1,24 @@
+
+group1 group2
+---------------------------------------
+ x x
+ x x /dset4
+ x x /dset5
+ x x /elink_grp_circle
+
+group : </grp10> and </grp11>
+0 differences found
+dataset: </grp10/dset4> and </grp11/dset4>
+0 differences found
+dataset: </grp10/dset5> and </grp11/dset5>
+size: [2x4] [2x4]
+position dset5 dset5 difference
+------------------------------------------------------------
+[ 0 1 ] 3 2 1
+[ 0 3 ] 3 2 1
+[ 1 0 ] 3 2 1
+[ 1 2 ] 3 2 1
+4 differences found
+external link: </grp10/elink_grp_circle> and </grp11/elink_grp_circle>
+1 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_512.txt b/tools/test/h5diff/testfiles/h5diff_512.txt
new file mode 100644
index 0000000..23fbc12
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_512.txt
@@ -0,0 +1,53 @@
+
+group1 group2
+---------------------------------------
+ x x
+ x x /dset4
+ x x /dset5
+ x x /elink_grp_circle
+ x x /elink_grp_circle/dset4
+ x x /elink_grp_circle/dset5
+ x x /elink_grp_circle/elink_grp_circle
+ x x /elink_grp_circle/elink_grp_circle/dset4
+ x x /elink_grp_circle/elink_grp_circle/dset5
+
+group : </grp10> and </grp11>
+0 differences found
+dataset: </grp10/dset4> and </grp11/dset4>
+0 differences found
+dataset: </grp10/dset5> and </grp11/dset5>
+size: [2x4] [2x4]
+position dset5 dset5 difference
+------------------------------------------------------------
+[ 0 1 ] 3 2 1
+[ 0 3 ] 3 2 1
+[ 1 0 ] 3 2 1
+[ 1 2 ] 3 2 1
+4 differences found
+group : </grp10/elink_grp_circle> and </grp11/elink_grp_circle>
+0 differences found
+dataset: </grp10/elink_grp_circle/dset4> and </grp11/elink_grp_circle/dset4>
+0 differences found
+dataset: </grp10/elink_grp_circle/dset5> and </grp11/elink_grp_circle/dset5>
+size: [2x4] [2x4]
+position dset5 dset5 difference
+------------------------------------------------------------
+[ 0 1 ] 2 3 1
+[ 0 3 ] 2 3 1
+[ 1 0 ] 2 3 1
+[ 1 2 ] 2 3 1
+4 differences found
+group : </grp10/elink_grp_circle/elink_grp_circle> and </grp11/elink_grp_circle/elink_grp_circle>
+0 differences found
+dataset: </grp10/elink_grp_circle/elink_grp_circle/dset4> and </grp11/elink_grp_circle/elink_grp_circle/dset4>
+0 differences found
+dataset: </grp10/elink_grp_circle/elink_grp_circle/dset5> and </grp11/elink_grp_circle/elink_grp_circle/dset5>
+size: [2x4] [2x4]
+position dset5 dset5 difference
+------------------------------------------------------------
+[ 0 1 ] 3 2 1
+[ 0 3 ] 3 2 1
+[ 1 0 ] 3 2 1
+[ 1 2 ] 3 2 1
+4 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_513.txt b/tools/test/h5diff/testfiles/h5diff_513.txt
new file mode 100644
index 0000000..b0af15d
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_513.txt
@@ -0,0 +1,3 @@
+link : </slink_grp10> and </slink_grp11>
+1 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_514.txt b/tools/test/h5diff/testfiles/h5diff_514.txt
new file mode 100644
index 0000000..f8e16e9
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_514.txt
@@ -0,0 +1,53 @@
+
+group1 group2
+---------------------------------------
+ x x
+ x x /dset4
+ x x /dset5
+ x x /elink_grp_circle
+ x x /elink_grp_circle/dset4
+ x x /elink_grp_circle/dset5
+ x x /elink_grp_circle/elink_grp_circle
+ x x /elink_grp_circle/elink_grp_circle/dset4
+ x x /elink_grp_circle/elink_grp_circle/dset5
+
+group : </slink_grp10> and </slink_grp11>
+0 differences found
+dataset: </slink_grp10/dset4> and </slink_grp11/dset4>
+0 differences found
+dataset: </slink_grp10/dset5> and </slink_grp11/dset5>
+size: [2x4] [2x4]
+position dset5 dset5 difference
+------------------------------------------------------------
+[ 0 1 ] 3 2 1
+[ 0 3 ] 3 2 1
+[ 1 0 ] 3 2 1
+[ 1 2 ] 3 2 1
+4 differences found
+group : </slink_grp10/elink_grp_circle> and </slink_grp11/elink_grp_circle>
+0 differences found
+dataset: </slink_grp10/elink_grp_circle/dset4> and </slink_grp11/elink_grp_circle/dset4>
+0 differences found
+dataset: </slink_grp10/elink_grp_circle/dset5> and </slink_grp11/elink_grp_circle/dset5>
+size: [2x4] [2x4]
+position dset5 dset5 difference
+------------------------------------------------------------
+[ 0 1 ] 2 3 1
+[ 0 3 ] 2 3 1
+[ 1 0 ] 2 3 1
+[ 1 2 ] 2 3 1
+4 differences found
+group : </slink_grp10/elink_grp_circle/elink_grp_circle> and </slink_grp11/elink_grp_circle/elink_grp_circle>
+0 differences found
+dataset: </slink_grp10/elink_grp_circle/elink_grp_circle/dset4> and </slink_grp11/elink_grp_circle/elink_grp_circle/dset4>
+0 differences found
+dataset: </slink_grp10/elink_grp_circle/elink_grp_circle/dset5> and </slink_grp11/elink_grp_circle/elink_grp_circle/dset5>
+size: [2x4] [2x4]
+position dset5 dset5 difference
+------------------------------------------------------------
+[ 0 1 ] 3 2 1
+[ 0 3 ] 3 2 1
+[ 1 0 ] 3 2 1
+[ 1 2 ] 3 2 1
+4 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_515.txt b/tools/test/h5diff/testfiles/h5diff_515.txt
new file mode 100644
index 0000000..263441d
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_515.txt
@@ -0,0 +1,27 @@
+
+file1 file2
+---------------------------------------
+ x x /
+ x x /dset1
+ x x /g1
+ x x /g1/g2
+ x /g1/g2/g3
+ x /g1/g2/g3/dset1
+ x /g1/g2/g3/g4
+ x /g1/g2/g3/g4/dset2
+ x x /soft_dset1
+
+group : </> and </>
+0 differences found
+dataset: </dset1> and </dset1>
+0 differences found
+group : </g1> and </g1>
+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/test/h5diff/testfiles/h5diff_516.txt b/tools/test/h5diff/testfiles/h5diff_516.txt
new file mode 100644
index 0000000..32f4bd5
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_516.txt
@@ -0,0 +1,32 @@
+
+file1 file2
+---------------------------------------
+ x x /
+ x x /dset1
+ x x /g1
+ x x /g1/g2
+ x x /g1/g2/g3
+ x x /g1/g2/g3/dset1
+ x x /g1/g2/g3/g4
+ x x /g1/g2/g3/g4/dset2
+ x x /soft_dset1
+
+group : </> and </>
+0 differences found
+dataset: </dset1> and </dset1>
+0 differences found
+group : </g1> and </g1>
+0 differences found
+group : </g1/g2> and </g1/g2>
+0 differences found
+group : </g1/g2/g3> and </g1/g2/g3>
+0 differences found
+dataset: </g1/g2/g3/dset1> and </g1/g2/g3/dset1>
+0 differences found
+group : </g1/g2/g3/g4> and </g1/g2/g3/g4>
+0 differences found
+dataset: </g1/g2/g3/g4/dset2> and </g1/g2/g3/g4/dset2>
+0 differences found
+dataset: </soft_dset1> and </soft_dset1>
+0 differences found
+EXIT CODE: 0
diff --git a/tools/test/h5diff/testfiles/h5diff_517.txt b/tools/test/h5diff/testfiles/h5diff_517.txt
new file mode 100644
index 0000000..91c69fb
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_517.txt
@@ -0,0 +1,18 @@
+
+group1 group2
+---------------------------------------
+ x x
+ x x /g2
+ x /g2/g3
+ x /g2/g3/dset1
+ x /g2/g3/g4
+ x /g2/g3/g4/dset2
+
+group : </g1> and </g1>
+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/test/h5diff/testfiles/h5diff_518.txt b/tools/test/h5diff/testfiles/h5diff_518.txt
new file mode 100644
index 0000000..f4761ad
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_518.txt
@@ -0,0 +1,23 @@
+
+group1 group2
+---------------------------------------
+ x x
+ x x /g2
+ x x /g2/g3
+ x x /g2/g3/dset1
+ x x /g2/g3/g4
+ x x /g2/g3/g4/dset2
+
+group : </g1> and </g1>
+0 differences found
+group : </g1/g2> and </g1/g2>
+0 differences found
+group : </g1/g2/g3> and </g1/g2/g3>
+0 differences found
+dataset: </g1/g2/g3/dset1> and </g1/g2/g3/dset1>
+0 differences found
+group : </g1/g2/g3/g4> and </g1/g2/g3/g4>
+0 differences found
+dataset: </g1/g2/g3/g4/dset2> and </g1/g2/g3/g4/dset2>
+0 differences found
+EXIT CODE: 0
diff --git a/tools/test/h5diff/testfiles/h5diff_52.txt b/tools/test/h5diff/testfiles/h5diff_52.txt
new file mode 100644
index 0000000..6667659
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_52.txt
@@ -0,0 +1,10 @@
+dataset: </dset2a> and </dset2b>
+size: [3x2] [3x2]
+position dset2a dset2b difference
+------------------------------------------------------------
+[ 1 0 ] 1 3 2
+[ 1 1 ] 1 4 3
+[ 2 0 ] 1 5 4
+[ 2 1 ] 1 6 5
+4 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_53.txt b/tools/test/h5diff/testfiles/h5diff_53.txt
new file mode 100644
index 0000000..458d166
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_53.txt
@@ -0,0 +1,10 @@
+dataset: </dset3a> and </dset4b>
+size: [3x2] [3x2]
+position dset3a dset4b difference
+------------------------------------------------------------
+[ 1 0 ] 1 3 2
+[ 1 1 ] 1 4 3
+[ 2 0 ] 1 5 4
+[ 2 1 ] 1 6 5
+4 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_530.txt b/tools/test/h5diff/testfiles/h5diff_530.txt
new file mode 100644
index 0000000..73d736e
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_530.txt
@@ -0,0 +1,35 @@
+
+group1 group2
+---------------------------------------
+ x x
+ x x /Compound_dset1
+ x x /Compound_dset2
+ x x /Compound_dset3
+ x x /Compound_dset4
+ x x /Compound_dset5
+ x x /Compound_dset6
+ x x /Compound_dset7
+ x x /Compound_dset8
+ x x /Compound_dset9
+
+group : </group> and </group_copy>
+0 differences found
+dataset: </group/Compound_dset1> and </group_copy/Compound_dset1>
+0 differences found
+dataset: </group/Compound_dset2> and </group_copy/Compound_dset2>
+0 differences found
+dataset: </group/Compound_dset3> and </group_copy/Compound_dset3>
+0 differences found
+dataset: </group/Compound_dset4> and </group_copy/Compound_dset4>
+0 differences found
+dataset: </group/Compound_dset5> and </group_copy/Compound_dset5>
+0 differences found
+dataset: </group/Compound_dset6> and </group_copy/Compound_dset6>
+0 differences found
+dataset: </group/Compound_dset7> and </group_copy/Compound_dset7>
+0 differences found
+dataset: </group/Compound_dset8> and </group_copy/Compound_dset8>
+0 differences found
+dataset: </group/Compound_dset9> and </group_copy/Compound_dset9>
+0 differences found
+EXIT CODE: 0
diff --git a/tools/test/h5diff/testfiles/h5diff_54.txt b/tools/test/h5diff/testfiles/h5diff_54.txt
new file mode 100644
index 0000000..2ca60f8
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_54.txt
@@ -0,0 +1,10 @@
+dataset: </dset4a> and </dset4b>
+size: [3x2] [3x2]
+position dset4a dset4b difference
+------------------------------------------------------------
+[ 1 0 ] 1 3 2
+[ 1 1 ] 1 4 3
+[ 2 0 ] 1 5 4
+[ 2 1 ] 1 6 5
+4 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_540.txt b/tools/test/h5diff/testfiles/h5diff_540.txt
new file mode 100644
index 0000000..a6903c8
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_540.txt
@@ -0,0 +1,86 @@
+
+file1 file2
+---------------------------------------
+ x x /
+ x x /dset1
+ x x /dset2
+ x x /dset3
+ x x /dset4
+
+group : </> and </>
+0 differences found
+attribute: <attr1 of </>> and <attr1 of </>>
+size: [2] [2]
+position attr1 of </> attr1 of </> difference
+------------------------------------------------------------
+[ 0 ] 0 5 5
+[ 0 ] 0 5 5
+[ 0 ] 0 5 5
+[ 0 ] 0 5 5
+[ 1 ] 10 15 5
+[ 1 ] 10.5 15.5 5
+[ 1 ] 10 15 5
+[ 1 ] 10.5 15.5 5
+8 differences found
+dataset: </dset1> and </dset1>
+size: [2] [2]
+position dset1 dset1 difference
+------------------------------------------------------------
+[ 0 ] 0 5 5
+[ 0 ] 0 5 5
+[ 0 ] 0 5 5
+[ 0 ] 0 5 5
+[ 1 ] 10 15 5
+[ 1 ] 10.5 15.5 5
+[ 1 ] 10 15 5
+[ 1 ] 10.5 15.5 5
+8 differences found
+dataset: </dset2> and </dset2>
+size: [2] [2]
+position dset2 dset2 difference
+------------------------------------------------------------
+[ 0 ] 0 5 5
+[ 0 ] 0 5 5
+[ 1 ] 10 15 5
+[ 1 ] 10.5 15.5 5
+[ 1 ] 10 15 5
+[ 1 ] 10.5 15.5 5
+6 differences found
+dataset: </dset3> and </dset3>
+size: [2] [2]
+position dset3 dset3 difference
+------------------------------------------------------------
+[ 0 ] 0 5 5
+[ 0 ] 0 5 5
+[ 0 ] 10 15 5
+[ 0 ] 10.5 15.5 5
+[ 0 ] 10 15 5
+[ 0 ] 10.5 15.5 5
+[ 1 ] 0 5 5
+[ 1 ] 0 5 5
+[ 1 ] 10 15 5
+[ 1 ] 10.5 15.5 5
+[ 1 ] 10 15 5
+[ 1 ] 10.5 15.5 5
+12 differences found
+dataset: </dset4> and </dset4>
+size: [2] [2]
+position dset4 dset4 difference
+------------------------------------------------------------
+[ 0 ] 0 5 5
+[ 0 ] 0 5 5
+[ 0 ] 0 5 5
+[ 0 ] 10 15 5
+[ 0 ] 10.5 15.5 5
+[ 1 ] 10 15 5
+[ 1 ] 0 5 5
+[ 1 ] 0 5 5
+[ 1 ] 10 15 5
+[ 1 ] 10.5 15.5 5
+[ 1 ] 10 15 5
+[ 1 ] 0 5 5
+[ 1 ] 0 5 5
+[ 1 ] 10 15 5
+[ 1 ] 10.5 15.5 5
+15 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_55.txt b/tools/test/h5diff/testfiles/h5diff_55.txt
new file mode 100644
index 0000000..1288887
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_55.txt
@@ -0,0 +1,10 @@
+dataset: </dset5a> and </dset5b>
+size: [3x2] [3x2]
+position dset5a dset5b difference
+------------------------------------------------------------
+[ 1 0 ] 1 3 2
+[ 1 1 ] 1 4 3
+[ 2 0 ] 1 5 4
+[ 2 1 ] 1 6 5
+4 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_56.txt b/tools/test/h5diff/testfiles/h5diff_56.txt
new file mode 100644
index 0000000..0e82860
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_56.txt
@@ -0,0 +1,10 @@
+dataset: </dset6a> and </dset6b>
+size: [3x2] [3x2]
+position dset6a dset6b difference
+------------------------------------------------------------
+[ 1 0 ] 1 3 2
+[ 1 1 ] 1 4 3
+[ 2 0 ] 1 5 4
+[ 2 1 ] 1 6 5
+4 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_57.txt b/tools/test/h5diff/testfiles/h5diff_57.txt
new file mode 100644
index 0000000..d5125fe
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_57.txt
@@ -0,0 +1,11 @@
+dataset: </dset7a> and </dset7b>
+Warning: different storage datatype
+</dset7a> has file datatype H5T_STD_I8LE
+</dset7b> has file datatype H5T_STD_U8LE
+Not comparable: </dset7a> has sign H5T_SGN_2 and </dset7b> has sign H5T_SGN_NONE
+0 differences found
+--------------------------------
+Some objects are not comparable
+--------------------------------
+Use -c for a list of objects without details of differences.
+EXIT CODE: 0
diff --git a/tools/test/h5diff/testfiles/h5diff_58.txt b/tools/test/h5diff/testfiles/h5diff_58.txt
new file mode 100644
index 0000000..768dd97
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_58.txt
@@ -0,0 +1,11 @@
+dataset: </refreg> and </refreg>
+Referenced dataset 10720 10720
+------------------------------------------------------------
+Region blocks
+block #0 (2,2)-(7,7) (0,0)-(2,2)
+Region points
+point #1 (2,2) (3,3)
+point #3 (1,6) (2,5)
+point #4 (2,8) (1,7)
+4 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_59.txt b/tools/test/h5diff/testfiles/h5diff_59.txt
new file mode 100644
index 0000000..996a7b2
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_59.txt
@@ -0,0 +1,11 @@
+dataset: </dset11a> and </dset11b>
+Warning: different storage datatype
+</dset11a> has file datatype H5T_STD_U16LE
+</dset11b> has file datatype H5T_STD_U32LE
+0 differences found
+Warning: different storage datatype
+<attr> has file datatype H5T_STD_U16LE
+<attr> has file datatype H5T_STD_U32LE
+attribute: <attr of </dset11a>> and <attr of </dset11b>>
+0 differences found
+EXIT CODE: 0
diff --git a/tools/test/h5diff/testfiles/h5diff_600.txt b/tools/test/h5diff/testfiles/h5diff_600.txt
new file mode 100644
index 0000000..3c3ad9f
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_600.txt
@@ -0,0 +1,141 @@
+usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
+ file1 File name of the first HDF5 file
+ file2 File name of the second HDF5 file
+ [obj1] Name of an HDF5 object, in absolute path
+ [obj2] Name of an HDF5 object, in absolute path
+
+ OPTIONS
+ -h, --help
+ Print a usage message and exit.
+ -V, --version
+ Print version number and exit.
+ -r, --report
+ Report mode. Print differences.
+ -v --verbose
+ Verbose mode. Print differences information and list of objects.
+ -vN --verbose=N
+ Verbose mode with level. Print differences and list of objects.
+ Level of detail depends on value of N:
+ 0 : Identical to '-v' or '--verbose'.
+ 1 : All level 0 information plus one-line attribute
+ status summary.
+ 2 : All level 1 information plus extended attribute
+ status report.
+ -q, --quiet
+ Quiet mode. Do not produce output.
+ --follow-symlinks
+ Follow symbolic links (soft links and external links and compare the)
+ links' target objects.
+ If symbolic link(s) with the same name exist in the files being
+ compared, then determine whether the target of each link is an existing
+ object (dataset, group, or named datatype) or the link is a dangling
+ link (a soft or external link pointing to a target object that does
+ not yet exist).
+ - If both symbolic links are dangling links, they are treated as being
+ the same; by default, h5diff returns an exit code of 0.
+ If, however, --no-dangling-links is used with --follow-symlinks,
+ this situation is treated as an error and h5diff returns an
+ exit code of 2.
+ - If only one of the two links is a dangling link,they are treated as
+ being different and h5diff returns an exit code of 1.
+ If, however, --no-dangling-links is used with --follow-symlinks,
+ this situation is treated as an error and h5diff returns an
+ exit code of 2.
+ - If both symbolic links point to existing objects, h5diff compares the
+ two objects.
+ If any symbolic link specified in the call to h5diff does not exist,
+ h5diff treats it as an error and returns an exit code of 2.
+ --no-dangling-links
+ Must be used with --follow-symlinks option; otherwise, h5diff shows
+ error message and returns an exit code of 2.
+ Check for any symbolic links (soft links or external links) that do not
+ resolve to an existing object (dataset, group, or named datatype).
+ If any dangling link is found, this situation is treated as an error
+ and h5diff returns an exit code of 2.
+ -c, --compare
+ List objects that are not comparable
+ -N, --nan
+ Avoid NaNs detection
+ -n C, --count=C
+ Print differences up to C. C must be a positive integer.
+ -d D, --delta=D
+ Print difference if (|a-b| > D). D must be a positive number.
+ Can not use with '-p' or '--use-system-epsilon'.
+ -p R, --relative=R
+ Print difference if (|(a-b)/b| > R). R must be a positive number.
+ Can not use with '-d' or '--use-system-epsilon'.
+ --use-system-epsilon
+ Print difference if (|a-b| > EPSILON), EPSILON is system defined value.
+ If the system epsilon is not defined,one of the following predefined
+ values will be used:
+ FLT_EPSILON = 1.19209E-07 for floating-point type
+ DBL_EPSILON = 2.22045E-16 for double precision type
+ Can not use with '-p' or '-d'.
+ --exclude-path "path"
+ Exclude the specified path to an object when comparing files or groups.
+ If a group is excluded, all member objects will also be excluded.
+ The specified path is excluded wherever it occurs.
+ This flexibility enables the same option to exclude either objects that
+ exist only in one file or common objects that are known to differ.
+
+ When comparing files, "path" is the absolute path to the excluded;
+ object; when comparing groups, "path" is similar to the relative
+ path from the group to the excluded object. This "path" can be
+ taken from the first section of the output of the --verbose option.
+ For example, if you are comparing the group /groupA in two files and
+ you want to exclude /groupA/groupB/groupC in both files, the exclude
+ option would read as follows:
+ --exclude-path "/groupB/groupC"
+
+ If there are multiple paths to an object, only the specified path(s)
+ will be excluded; the comparison will include any path not explicitly
+ excluded.
+ This option can be used repeatedly to exclude multiple paths.
+
+ Modes of output:
+ Default mode: print the number of differences found and where they occured
+ -r Report mode: print the above plus the differences
+ -v Verbose mode: print the above plus a list of objects and warnings
+ -q Quiet mode: do not print output
+
+ File comparison:
+ If no objects [obj1[ obj2]] are specified, the h5diff comparison proceeds as
+ a comparison of the two files' root groups. That is, h5diff first compares
+ the names of root group members, generates a report of root group objects
+ that appear in only one file or in both files, and recursively compares
+ common objects.
+
+ Object comparison:
+ 1) Groups
+ First compares the names of member objects (relative path, from the
+ specified group) and generates a report of objects that appear in only
+ one group or in both groups. Common objects are then compared recursively.
+ 2) Datasets
+ Array rank and dimensions, datatypes, and data values are compared.
+ 3) Datatypes
+ The comparison is based on the return value of H5Tequal.
+ 4) Symbolic links
+ The paths to the target objects are compared.
+ (The option --follow-symlinks overrides the default behavior when
+ symbolic links are compared.).
+
+ Exit code:
+ 0 if no differences, 1 if differences found, 2 if error
+
+ Examples of use:
+ 1) h5diff file1 file2 /g1/dset1 /g1/dset2
+ Compares object '/g1/dset1' in file1 with '/g1/dset2' in file2
+
+ 2) h5diff file1 file2 /g1/dset1
+ Compares object '/g1/dset1' in both files
+
+ 3) h5diff file1 file2
+ Compares all objects in both files
+
+ Notes:
+ file1 and file2 can be the same file.
+ Use h5diff file1 file1 /g1/dset1 /g1/dset2 to compare
+ '/g1/dset1' and '/g1/dset2' in the same file
+
+h5diff error: missing file names
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_601.txt b/tools/test/h5diff/testfiles/h5diff_601.txt
new file mode 100644
index 0000000..eb12f38
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_601.txt
@@ -0,0 +1,2 @@
+Object </nono_obj> could not be found in <h5diff_basic1.h5>
+EXIT CODE: 2
diff --git a/tools/test/h5diff/testfiles/h5diff_603.txt b/tools/test/h5diff/testfiles/h5diff_603.txt
new file mode 100644
index 0000000..087764a
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_603.txt
@@ -0,0 +1,141 @@
+<-d -4> is not a valid option
+usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
+ file1 File name of the first HDF5 file
+ file2 File name of the second HDF5 file
+ [obj1] Name of an HDF5 object, in absolute path
+ [obj2] Name of an HDF5 object, in absolute path
+
+ OPTIONS
+ -h, --help
+ Print a usage message and exit.
+ -V, --version
+ Print version number and exit.
+ -r, --report
+ Report mode. Print differences.
+ -v --verbose
+ Verbose mode. Print differences information and list of objects.
+ -vN --verbose=N
+ Verbose mode with level. Print differences and list of objects.
+ Level of detail depends on value of N:
+ 0 : Identical to '-v' or '--verbose'.
+ 1 : All level 0 information plus one-line attribute
+ status summary.
+ 2 : All level 1 information plus extended attribute
+ status report.
+ -q, --quiet
+ Quiet mode. Do not produce output.
+ --follow-symlinks
+ Follow symbolic links (soft links and external links and compare the)
+ links' target objects.
+ If symbolic link(s) with the same name exist in the files being
+ compared, then determine whether the target of each link is an existing
+ object (dataset, group, or named datatype) or the link is a dangling
+ link (a soft or external link pointing to a target object that does
+ not yet exist).
+ - If both symbolic links are dangling links, they are treated as being
+ the same; by default, h5diff returns an exit code of 0.
+ If, however, --no-dangling-links is used with --follow-symlinks,
+ this situation is treated as an error and h5diff returns an
+ exit code of 2.
+ - If only one of the two links is a dangling link,they are treated as
+ being different and h5diff returns an exit code of 1.
+ If, however, --no-dangling-links is used with --follow-symlinks,
+ this situation is treated as an error and h5diff returns an
+ exit code of 2.
+ - If both symbolic links point to existing objects, h5diff compares the
+ two objects.
+ If any symbolic link specified in the call to h5diff does not exist,
+ h5diff treats it as an error and returns an exit code of 2.
+ --no-dangling-links
+ Must be used with --follow-symlinks option; otherwise, h5diff shows
+ error message and returns an exit code of 2.
+ Check for any symbolic links (soft links or external links) that do not
+ resolve to an existing object (dataset, group, or named datatype).
+ If any dangling link is found, this situation is treated as an error
+ and h5diff returns an exit code of 2.
+ -c, --compare
+ List objects that are not comparable
+ -N, --nan
+ Avoid NaNs detection
+ -n C, --count=C
+ Print differences up to C. C must be a positive integer.
+ -d D, --delta=D
+ Print difference if (|a-b| > D). D must be a positive number.
+ Can not use with '-p' or '--use-system-epsilon'.
+ -p R, --relative=R
+ Print difference if (|(a-b)/b| > R). R must be a positive number.
+ Can not use with '-d' or '--use-system-epsilon'.
+ --use-system-epsilon
+ Print difference if (|a-b| > EPSILON), EPSILON is system defined value.
+ If the system epsilon is not defined,one of the following predefined
+ values will be used:
+ FLT_EPSILON = 1.19209E-07 for floating-point type
+ DBL_EPSILON = 2.22045E-16 for double precision type
+ Can not use with '-p' or '-d'.
+ --exclude-path "path"
+ Exclude the specified path to an object when comparing files or groups.
+ If a group is excluded, all member objects will also be excluded.
+ The specified path is excluded wherever it occurs.
+ This flexibility enables the same option to exclude either objects that
+ exist only in one file or common objects that are known to differ.
+
+ When comparing files, "path" is the absolute path to the excluded;
+ object; when comparing groups, "path" is similar to the relative
+ path from the group to the excluded object. This "path" can be
+ taken from the first section of the output of the --verbose option.
+ For example, if you are comparing the group /groupA in two files and
+ you want to exclude /groupA/groupB/groupC in both files, the exclude
+ option would read as follows:
+ --exclude-path "/groupB/groupC"
+
+ If there are multiple paths to an object, only the specified path(s)
+ will be excluded; the comparison will include any path not explicitly
+ excluded.
+ This option can be used repeatedly to exclude multiple paths.
+
+ Modes of output:
+ Default mode: print the number of differences found and where they occured
+ -r Report mode: print the above plus the differences
+ -v Verbose mode: print the above plus a list of objects and warnings
+ -q Quiet mode: do not print output
+
+ File comparison:
+ If no objects [obj1[ obj2]] are specified, the h5diff comparison proceeds as
+ a comparison of the two files' root groups. That is, h5diff first compares
+ the names of root group members, generates a report of root group objects
+ that appear in only one file or in both files, and recursively compares
+ common objects.
+
+ Object comparison:
+ 1) Groups
+ First compares the names of member objects (relative path, from the
+ specified group) and generates a report of objects that appear in only
+ one group or in both groups. Common objects are then compared recursively.
+ 2) Datasets
+ Array rank and dimensions, datatypes, and data values are compared.
+ 3) Datatypes
+ The comparison is based on the return value of H5Tequal.
+ 4) Symbolic links
+ The paths to the target objects are compared.
+ (The option --follow-symlinks overrides the default behavior when
+ symbolic links are compared.).
+
+ Exit code:
+ 0 if no differences, 1 if differences found, 2 if error
+
+ Examples of use:
+ 1) h5diff file1 file2 /g1/dset1 /g1/dset2
+ Compares object '/g1/dset1' in file1 with '/g1/dset2' in file2
+
+ 2) h5diff file1 file2 /g1/dset1
+ Compares object '/g1/dset1' in both files
+
+ 3) h5diff file1 file2
+ Compares all objects in both files
+
+ Notes:
+ file1 and file2 can be the same file.
+ Use h5diff file1 file1 /g1/dset1 /g1/dset2 to compare
+ '/g1/dset1' and '/g1/dset2' in the same file
+
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_604.txt b/tools/test/h5diff/testfiles/h5diff_604.txt
new file mode 100644
index 0000000..db14532
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_604.txt
@@ -0,0 +1,3 @@
+dataset: </g1/dset3> and </g1/dset4>
+6 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_605.txt b/tools/test/h5diff/testfiles/h5diff_605.txt
new file mode 100644
index 0000000..db14532
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_605.txt
@@ -0,0 +1,3 @@
+dataset: </g1/dset3> and </g1/dset4>
+6 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_606.txt b/tools/test/h5diff/testfiles/h5diff_606.txt
new file mode 100644
index 0000000..c31a67e
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_606.txt
@@ -0,0 +1,141 @@
+<-d 0x1> is not a valid option
+usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
+ file1 File name of the first HDF5 file
+ file2 File name of the second HDF5 file
+ [obj1] Name of an HDF5 object, in absolute path
+ [obj2] Name of an HDF5 object, in absolute path
+
+ OPTIONS
+ -h, --help
+ Print a usage message and exit.
+ -V, --version
+ Print version number and exit.
+ -r, --report
+ Report mode. Print differences.
+ -v --verbose
+ Verbose mode. Print differences information and list of objects.
+ -vN --verbose=N
+ Verbose mode with level. Print differences and list of objects.
+ Level of detail depends on value of N:
+ 0 : Identical to '-v' or '--verbose'.
+ 1 : All level 0 information plus one-line attribute
+ status summary.
+ 2 : All level 1 information plus extended attribute
+ status report.
+ -q, --quiet
+ Quiet mode. Do not produce output.
+ --follow-symlinks
+ Follow symbolic links (soft links and external links and compare the)
+ links' target objects.
+ If symbolic link(s) with the same name exist in the files being
+ compared, then determine whether the target of each link is an existing
+ object (dataset, group, or named datatype) or the link is a dangling
+ link (a soft or external link pointing to a target object that does
+ not yet exist).
+ - If both symbolic links are dangling links, they are treated as being
+ the same; by default, h5diff returns an exit code of 0.
+ If, however, --no-dangling-links is used with --follow-symlinks,
+ this situation is treated as an error and h5diff returns an
+ exit code of 2.
+ - If only one of the two links is a dangling link,they are treated as
+ being different and h5diff returns an exit code of 1.
+ If, however, --no-dangling-links is used with --follow-symlinks,
+ this situation is treated as an error and h5diff returns an
+ exit code of 2.
+ - If both symbolic links point to existing objects, h5diff compares the
+ two objects.
+ If any symbolic link specified in the call to h5diff does not exist,
+ h5diff treats it as an error and returns an exit code of 2.
+ --no-dangling-links
+ Must be used with --follow-symlinks option; otherwise, h5diff shows
+ error message and returns an exit code of 2.
+ Check for any symbolic links (soft links or external links) that do not
+ resolve to an existing object (dataset, group, or named datatype).
+ If any dangling link is found, this situation is treated as an error
+ and h5diff returns an exit code of 2.
+ -c, --compare
+ List objects that are not comparable
+ -N, --nan
+ Avoid NaNs detection
+ -n C, --count=C
+ Print differences up to C. C must be a positive integer.
+ -d D, --delta=D
+ Print difference if (|a-b| > D). D must be a positive number.
+ Can not use with '-p' or '--use-system-epsilon'.
+ -p R, --relative=R
+ Print difference if (|(a-b)/b| > R). R must be a positive number.
+ Can not use with '-d' or '--use-system-epsilon'.
+ --use-system-epsilon
+ Print difference if (|a-b| > EPSILON), EPSILON is system defined value.
+ If the system epsilon is not defined,one of the following predefined
+ values will be used:
+ FLT_EPSILON = 1.19209E-07 for floating-point type
+ DBL_EPSILON = 2.22045E-16 for double precision type
+ Can not use with '-p' or '-d'.
+ --exclude-path "path"
+ Exclude the specified path to an object when comparing files or groups.
+ If a group is excluded, all member objects will also be excluded.
+ The specified path is excluded wherever it occurs.
+ This flexibility enables the same option to exclude either objects that
+ exist only in one file or common objects that are known to differ.
+
+ When comparing files, "path" is the absolute path to the excluded;
+ object; when comparing groups, "path" is similar to the relative
+ path from the group to the excluded object. This "path" can be
+ taken from the first section of the output of the --verbose option.
+ For example, if you are comparing the group /groupA in two files and
+ you want to exclude /groupA/groupB/groupC in both files, the exclude
+ option would read as follows:
+ --exclude-path "/groupB/groupC"
+
+ If there are multiple paths to an object, only the specified path(s)
+ will be excluded; the comparison will include any path not explicitly
+ excluded.
+ This option can be used repeatedly to exclude multiple paths.
+
+ Modes of output:
+ Default mode: print the number of differences found and where they occured
+ -r Report mode: print the above plus the differences
+ -v Verbose mode: print the above plus a list of objects and warnings
+ -q Quiet mode: do not print output
+
+ File comparison:
+ If no objects [obj1[ obj2]] are specified, the h5diff comparison proceeds as
+ a comparison of the two files' root groups. That is, h5diff first compares
+ the names of root group members, generates a report of root group objects
+ that appear in only one file or in both files, and recursively compares
+ common objects.
+
+ Object comparison:
+ 1) Groups
+ First compares the names of member objects (relative path, from the
+ specified group) and generates a report of objects that appear in only
+ one group or in both groups. Common objects are then compared recursively.
+ 2) Datasets
+ Array rank and dimensions, datatypes, and data values are compared.
+ 3) Datatypes
+ The comparison is based on the return value of H5Tequal.
+ 4) Symbolic links
+ The paths to the target objects are compared.
+ (The option --follow-symlinks overrides the default behavior when
+ symbolic links are compared.).
+
+ Exit code:
+ 0 if no differences, 1 if differences found, 2 if error
+
+ Examples of use:
+ 1) h5diff file1 file2 /g1/dset1 /g1/dset2
+ Compares object '/g1/dset1' in file1 with '/g1/dset2' in file2
+
+ 2) h5diff file1 file2 /g1/dset1
+ Compares object '/g1/dset1' in both files
+
+ 3) h5diff file1 file2
+ Compares all objects in both files
+
+ Notes:
+ file1 and file2 can be the same file.
+ Use h5diff file1 file1 /g1/dset1 /g1/dset2 to compare
+ '/g1/dset1' and '/g1/dset2' in the same file
+
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_607.txt b/tools/test/h5diff/testfiles/h5diff_607.txt
new file mode 100644
index 0000000..db14532
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_607.txt
@@ -0,0 +1,3 @@
+dataset: </g1/dset3> and </g1/dset4>
+6 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_608.txt b/tools/test/h5diff/testfiles/h5diff_608.txt
new file mode 100644
index 0000000..db14532
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_608.txt
@@ -0,0 +1,3 @@
+dataset: </g1/dset3> and </g1/dset4>
+6 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_609.txt b/tools/test/h5diff/testfiles/h5diff_609.txt
new file mode 100644
index 0000000..eca5994
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_609.txt
@@ -0,0 +1 @@
+EXIT CODE: 0
diff --git a/tools/test/h5diff/testfiles/h5diff_610.txt b/tools/test/h5diff/testfiles/h5diff_610.txt
new file mode 100644
index 0000000..db14532
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_610.txt
@@ -0,0 +1,3 @@
+dataset: </g1/dset3> and </g1/dset4>
+6 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_612.txt b/tools/test/h5diff/testfiles/h5diff_612.txt
new file mode 100644
index 0000000..05318bd
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_612.txt
@@ -0,0 +1,141 @@
+<-p -4> is not a valid option
+usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
+ file1 File name of the first HDF5 file
+ file2 File name of the second HDF5 file
+ [obj1] Name of an HDF5 object, in absolute path
+ [obj2] Name of an HDF5 object, in absolute path
+
+ OPTIONS
+ -h, --help
+ Print a usage message and exit.
+ -V, --version
+ Print version number and exit.
+ -r, --report
+ Report mode. Print differences.
+ -v --verbose
+ Verbose mode. Print differences information and list of objects.
+ -vN --verbose=N
+ Verbose mode with level. Print differences and list of objects.
+ Level of detail depends on value of N:
+ 0 : Identical to '-v' or '--verbose'.
+ 1 : All level 0 information plus one-line attribute
+ status summary.
+ 2 : All level 1 information plus extended attribute
+ status report.
+ -q, --quiet
+ Quiet mode. Do not produce output.
+ --follow-symlinks
+ Follow symbolic links (soft links and external links and compare the)
+ links' target objects.
+ If symbolic link(s) with the same name exist in the files being
+ compared, then determine whether the target of each link is an existing
+ object (dataset, group, or named datatype) or the link is a dangling
+ link (a soft or external link pointing to a target object that does
+ not yet exist).
+ - If both symbolic links are dangling links, they are treated as being
+ the same; by default, h5diff returns an exit code of 0.
+ If, however, --no-dangling-links is used with --follow-symlinks,
+ this situation is treated as an error and h5diff returns an
+ exit code of 2.
+ - If only one of the two links is a dangling link,they are treated as
+ being different and h5diff returns an exit code of 1.
+ If, however, --no-dangling-links is used with --follow-symlinks,
+ this situation is treated as an error and h5diff returns an
+ exit code of 2.
+ - If both symbolic links point to existing objects, h5diff compares the
+ two objects.
+ If any symbolic link specified in the call to h5diff does not exist,
+ h5diff treats it as an error and returns an exit code of 2.
+ --no-dangling-links
+ Must be used with --follow-symlinks option; otherwise, h5diff shows
+ error message and returns an exit code of 2.
+ Check for any symbolic links (soft links or external links) that do not
+ resolve to an existing object (dataset, group, or named datatype).
+ If any dangling link is found, this situation is treated as an error
+ and h5diff returns an exit code of 2.
+ -c, --compare
+ List objects that are not comparable
+ -N, --nan
+ Avoid NaNs detection
+ -n C, --count=C
+ Print differences up to C. C must be a positive integer.
+ -d D, --delta=D
+ Print difference if (|a-b| > D). D must be a positive number.
+ Can not use with '-p' or '--use-system-epsilon'.
+ -p R, --relative=R
+ Print difference if (|(a-b)/b| > R). R must be a positive number.
+ Can not use with '-d' or '--use-system-epsilon'.
+ --use-system-epsilon
+ Print difference if (|a-b| > EPSILON), EPSILON is system defined value.
+ If the system epsilon is not defined,one of the following predefined
+ values will be used:
+ FLT_EPSILON = 1.19209E-07 for floating-point type
+ DBL_EPSILON = 2.22045E-16 for double precision type
+ Can not use with '-p' or '-d'.
+ --exclude-path "path"
+ Exclude the specified path to an object when comparing files or groups.
+ If a group is excluded, all member objects will also be excluded.
+ The specified path is excluded wherever it occurs.
+ This flexibility enables the same option to exclude either objects that
+ exist only in one file or common objects that are known to differ.
+
+ When comparing files, "path" is the absolute path to the excluded;
+ object; when comparing groups, "path" is similar to the relative
+ path from the group to the excluded object. This "path" can be
+ taken from the first section of the output of the --verbose option.
+ For example, if you are comparing the group /groupA in two files and
+ you want to exclude /groupA/groupB/groupC in both files, the exclude
+ option would read as follows:
+ --exclude-path "/groupB/groupC"
+
+ If there are multiple paths to an object, only the specified path(s)
+ will be excluded; the comparison will include any path not explicitly
+ excluded.
+ This option can be used repeatedly to exclude multiple paths.
+
+ Modes of output:
+ Default mode: print the number of differences found and where they occured
+ -r Report mode: print the above plus the differences
+ -v Verbose mode: print the above plus a list of objects and warnings
+ -q Quiet mode: do not print output
+
+ File comparison:
+ If no objects [obj1[ obj2]] are specified, the h5diff comparison proceeds as
+ a comparison of the two files' root groups. That is, h5diff first compares
+ the names of root group members, generates a report of root group objects
+ that appear in only one file or in both files, and recursively compares
+ common objects.
+
+ Object comparison:
+ 1) Groups
+ First compares the names of member objects (relative path, from the
+ specified group) and generates a report of objects that appear in only
+ one group or in both groups. Common objects are then compared recursively.
+ 2) Datasets
+ Array rank and dimensions, datatypes, and data values are compared.
+ 3) Datatypes
+ The comparison is based on the return value of H5Tequal.
+ 4) Symbolic links
+ The paths to the target objects are compared.
+ (The option --follow-symlinks overrides the default behavior when
+ symbolic links are compared.).
+
+ Exit code:
+ 0 if no differences, 1 if differences found, 2 if error
+
+ Examples of use:
+ 1) h5diff file1 file2 /g1/dset1 /g1/dset2
+ Compares object '/g1/dset1' in file1 with '/g1/dset2' in file2
+
+ 2) h5diff file1 file2 /g1/dset1
+ Compares object '/g1/dset1' in both files
+
+ 3) h5diff file1 file2
+ Compares all objects in both files
+
+ Notes:
+ file1 and file2 can be the same file.
+ Use h5diff file1 file1 /g1/dset1 /g1/dset2 to compare
+ '/g1/dset1' and '/g1/dset2' in the same file
+
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_613.txt b/tools/test/h5diff/testfiles/h5diff_613.txt
new file mode 100644
index 0000000..db14532
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_613.txt
@@ -0,0 +1,3 @@
+dataset: </g1/dset3> and </g1/dset4>
+6 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_614.txt b/tools/test/h5diff/testfiles/h5diff_614.txt
new file mode 100644
index 0000000..db14532
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_614.txt
@@ -0,0 +1,3 @@
+dataset: </g1/dset3> and </g1/dset4>
+6 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_615.txt b/tools/test/h5diff/testfiles/h5diff_615.txt
new file mode 100644
index 0000000..fd756b3
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_615.txt
@@ -0,0 +1,141 @@
+<-p 0x1> is not a valid option
+usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
+ file1 File name of the first HDF5 file
+ file2 File name of the second HDF5 file
+ [obj1] Name of an HDF5 object, in absolute path
+ [obj2] Name of an HDF5 object, in absolute path
+
+ OPTIONS
+ -h, --help
+ Print a usage message and exit.
+ -V, --version
+ Print version number and exit.
+ -r, --report
+ Report mode. Print differences.
+ -v --verbose
+ Verbose mode. Print differences information and list of objects.
+ -vN --verbose=N
+ Verbose mode with level. Print differences and list of objects.
+ Level of detail depends on value of N:
+ 0 : Identical to '-v' or '--verbose'.
+ 1 : All level 0 information plus one-line attribute
+ status summary.
+ 2 : All level 1 information plus extended attribute
+ status report.
+ -q, --quiet
+ Quiet mode. Do not produce output.
+ --follow-symlinks
+ Follow symbolic links (soft links and external links and compare the)
+ links' target objects.
+ If symbolic link(s) with the same name exist in the files being
+ compared, then determine whether the target of each link is an existing
+ object (dataset, group, or named datatype) or the link is a dangling
+ link (a soft or external link pointing to a target object that does
+ not yet exist).
+ - If both symbolic links are dangling links, they are treated as being
+ the same; by default, h5diff returns an exit code of 0.
+ If, however, --no-dangling-links is used with --follow-symlinks,
+ this situation is treated as an error and h5diff returns an
+ exit code of 2.
+ - If only one of the two links is a dangling link,they are treated as
+ being different and h5diff returns an exit code of 1.
+ If, however, --no-dangling-links is used with --follow-symlinks,
+ this situation is treated as an error and h5diff returns an
+ exit code of 2.
+ - If both symbolic links point to existing objects, h5diff compares the
+ two objects.
+ If any symbolic link specified in the call to h5diff does not exist,
+ h5diff treats it as an error and returns an exit code of 2.
+ --no-dangling-links
+ Must be used with --follow-symlinks option; otherwise, h5diff shows
+ error message and returns an exit code of 2.
+ Check for any symbolic links (soft links or external links) that do not
+ resolve to an existing object (dataset, group, or named datatype).
+ If any dangling link is found, this situation is treated as an error
+ and h5diff returns an exit code of 2.
+ -c, --compare
+ List objects that are not comparable
+ -N, --nan
+ Avoid NaNs detection
+ -n C, --count=C
+ Print differences up to C. C must be a positive integer.
+ -d D, --delta=D
+ Print difference if (|a-b| > D). D must be a positive number.
+ Can not use with '-p' or '--use-system-epsilon'.
+ -p R, --relative=R
+ Print difference if (|(a-b)/b| > R). R must be a positive number.
+ Can not use with '-d' or '--use-system-epsilon'.
+ --use-system-epsilon
+ Print difference if (|a-b| > EPSILON), EPSILON is system defined value.
+ If the system epsilon is not defined,one of the following predefined
+ values will be used:
+ FLT_EPSILON = 1.19209E-07 for floating-point type
+ DBL_EPSILON = 2.22045E-16 for double precision type
+ Can not use with '-p' or '-d'.
+ --exclude-path "path"
+ Exclude the specified path to an object when comparing files or groups.
+ If a group is excluded, all member objects will also be excluded.
+ The specified path is excluded wherever it occurs.
+ This flexibility enables the same option to exclude either objects that
+ exist only in one file or common objects that are known to differ.
+
+ When comparing files, "path" is the absolute path to the excluded;
+ object; when comparing groups, "path" is similar to the relative
+ path from the group to the excluded object. This "path" can be
+ taken from the first section of the output of the --verbose option.
+ For example, if you are comparing the group /groupA in two files and
+ you want to exclude /groupA/groupB/groupC in both files, the exclude
+ option would read as follows:
+ --exclude-path "/groupB/groupC"
+
+ If there are multiple paths to an object, only the specified path(s)
+ will be excluded; the comparison will include any path not explicitly
+ excluded.
+ This option can be used repeatedly to exclude multiple paths.
+
+ Modes of output:
+ Default mode: print the number of differences found and where they occured
+ -r Report mode: print the above plus the differences
+ -v Verbose mode: print the above plus a list of objects and warnings
+ -q Quiet mode: do not print output
+
+ File comparison:
+ If no objects [obj1[ obj2]] are specified, the h5diff comparison proceeds as
+ a comparison of the two files' root groups. That is, h5diff first compares
+ the names of root group members, generates a report of root group objects
+ that appear in only one file or in both files, and recursively compares
+ common objects.
+
+ Object comparison:
+ 1) Groups
+ First compares the names of member objects (relative path, from the
+ specified group) and generates a report of objects that appear in only
+ one group or in both groups. Common objects are then compared recursively.
+ 2) Datasets
+ Array rank and dimensions, datatypes, and data values are compared.
+ 3) Datatypes
+ The comparison is based on the return value of H5Tequal.
+ 4) Symbolic links
+ The paths to the target objects are compared.
+ (The option --follow-symlinks overrides the default behavior when
+ symbolic links are compared.).
+
+ Exit code:
+ 0 if no differences, 1 if differences found, 2 if error
+
+ Examples of use:
+ 1) h5diff file1 file2 /g1/dset1 /g1/dset2
+ Compares object '/g1/dset1' in file1 with '/g1/dset2' in file2
+
+ 2) h5diff file1 file2 /g1/dset1
+ Compares object '/g1/dset1' in both files
+
+ 3) h5diff file1 file2
+ Compares all objects in both files
+
+ Notes:
+ file1 and file2 can be the same file.
+ Use h5diff file1 file1 /g1/dset1 /g1/dset2 to compare
+ '/g1/dset1' and '/g1/dset2' in the same file
+
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_616.txt b/tools/test/h5diff/testfiles/h5diff_616.txt
new file mode 100644
index 0000000..3bc194a
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_616.txt
@@ -0,0 +1,3 @@
+dataset: </g1/dset3> and </g1/dset4>
+2 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_617.txt b/tools/test/h5diff/testfiles/h5diff_617.txt
new file mode 100644
index 0000000..3bc194a
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_617.txt
@@ -0,0 +1,3 @@
+dataset: </g1/dset3> and </g1/dset4>
+2 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_618.txt b/tools/test/h5diff/testfiles/h5diff_618.txt
new file mode 100644
index 0000000..eca5994
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_618.txt
@@ -0,0 +1 @@
+EXIT CODE: 0
diff --git a/tools/test/h5diff/testfiles/h5diff_619.txt b/tools/test/h5diff/testfiles/h5diff_619.txt
new file mode 100644
index 0000000..db14532
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_619.txt
@@ -0,0 +1,3 @@
+dataset: </g1/dset3> and </g1/dset4>
+6 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_621.txt b/tools/test/h5diff/testfiles/h5diff_621.txt
new file mode 100644
index 0000000..fd8c680
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_621.txt
@@ -0,0 +1,141 @@
+<-n -4> is not a valid option
+usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
+ file1 File name of the first HDF5 file
+ file2 File name of the second HDF5 file
+ [obj1] Name of an HDF5 object, in absolute path
+ [obj2] Name of an HDF5 object, in absolute path
+
+ OPTIONS
+ -h, --help
+ Print a usage message and exit.
+ -V, --version
+ Print version number and exit.
+ -r, --report
+ Report mode. Print differences.
+ -v --verbose
+ Verbose mode. Print differences information and list of objects.
+ -vN --verbose=N
+ Verbose mode with level. Print differences and list of objects.
+ Level of detail depends on value of N:
+ 0 : Identical to '-v' or '--verbose'.
+ 1 : All level 0 information plus one-line attribute
+ status summary.
+ 2 : All level 1 information plus extended attribute
+ status report.
+ -q, --quiet
+ Quiet mode. Do not produce output.
+ --follow-symlinks
+ Follow symbolic links (soft links and external links and compare the)
+ links' target objects.
+ If symbolic link(s) with the same name exist in the files being
+ compared, then determine whether the target of each link is an existing
+ object (dataset, group, or named datatype) or the link is a dangling
+ link (a soft or external link pointing to a target object that does
+ not yet exist).
+ - If both symbolic links are dangling links, they are treated as being
+ the same; by default, h5diff returns an exit code of 0.
+ If, however, --no-dangling-links is used with --follow-symlinks,
+ this situation is treated as an error and h5diff returns an
+ exit code of 2.
+ - If only one of the two links is a dangling link,they are treated as
+ being different and h5diff returns an exit code of 1.
+ If, however, --no-dangling-links is used with --follow-symlinks,
+ this situation is treated as an error and h5diff returns an
+ exit code of 2.
+ - If both symbolic links point to existing objects, h5diff compares the
+ two objects.
+ If any symbolic link specified in the call to h5diff does not exist,
+ h5diff treats it as an error and returns an exit code of 2.
+ --no-dangling-links
+ Must be used with --follow-symlinks option; otherwise, h5diff shows
+ error message and returns an exit code of 2.
+ Check for any symbolic links (soft links or external links) that do not
+ resolve to an existing object (dataset, group, or named datatype).
+ If any dangling link is found, this situation is treated as an error
+ and h5diff returns an exit code of 2.
+ -c, --compare
+ List objects that are not comparable
+ -N, --nan
+ Avoid NaNs detection
+ -n C, --count=C
+ Print differences up to C. C must be a positive integer.
+ -d D, --delta=D
+ Print difference if (|a-b| > D). D must be a positive number.
+ Can not use with '-p' or '--use-system-epsilon'.
+ -p R, --relative=R
+ Print difference if (|(a-b)/b| > R). R must be a positive number.
+ Can not use with '-d' or '--use-system-epsilon'.
+ --use-system-epsilon
+ Print difference if (|a-b| > EPSILON), EPSILON is system defined value.
+ If the system epsilon is not defined,one of the following predefined
+ values will be used:
+ FLT_EPSILON = 1.19209E-07 for floating-point type
+ DBL_EPSILON = 2.22045E-16 for double precision type
+ Can not use with '-p' or '-d'.
+ --exclude-path "path"
+ Exclude the specified path to an object when comparing files or groups.
+ If a group is excluded, all member objects will also be excluded.
+ The specified path is excluded wherever it occurs.
+ This flexibility enables the same option to exclude either objects that
+ exist only in one file or common objects that are known to differ.
+
+ When comparing files, "path" is the absolute path to the excluded;
+ object; when comparing groups, "path" is similar to the relative
+ path from the group to the excluded object. This "path" can be
+ taken from the first section of the output of the --verbose option.
+ For example, if you are comparing the group /groupA in two files and
+ you want to exclude /groupA/groupB/groupC in both files, the exclude
+ option would read as follows:
+ --exclude-path "/groupB/groupC"
+
+ If there are multiple paths to an object, only the specified path(s)
+ will be excluded; the comparison will include any path not explicitly
+ excluded.
+ This option can be used repeatedly to exclude multiple paths.
+
+ Modes of output:
+ Default mode: print the number of differences found and where they occured
+ -r Report mode: print the above plus the differences
+ -v Verbose mode: print the above plus a list of objects and warnings
+ -q Quiet mode: do not print output
+
+ File comparison:
+ If no objects [obj1[ obj2]] are specified, the h5diff comparison proceeds as
+ a comparison of the two files' root groups. That is, h5diff first compares
+ the names of root group members, generates a report of root group objects
+ that appear in only one file or in both files, and recursively compares
+ common objects.
+
+ Object comparison:
+ 1) Groups
+ First compares the names of member objects (relative path, from the
+ specified group) and generates a report of objects that appear in only
+ one group or in both groups. Common objects are then compared recursively.
+ 2) Datasets
+ Array rank and dimensions, datatypes, and data values are compared.
+ 3) Datatypes
+ The comparison is based on the return value of H5Tequal.
+ 4) Symbolic links
+ The paths to the target objects are compared.
+ (The option --follow-symlinks overrides the default behavior when
+ symbolic links are compared.).
+
+ Exit code:
+ 0 if no differences, 1 if differences found, 2 if error
+
+ Examples of use:
+ 1) h5diff file1 file2 /g1/dset1 /g1/dset2
+ Compares object '/g1/dset1' in file1 with '/g1/dset2' in file2
+
+ 2) h5diff file1 file2 /g1/dset1
+ Compares object '/g1/dset1' in both files
+
+ 3) h5diff file1 file2
+ Compares all objects in both files
+
+ Notes:
+ file1 and file2 can be the same file.
+ Use h5diff file1 file1 /g1/dset1 /g1/dset2 to compare
+ '/g1/dset1' and '/g1/dset2' in the same file
+
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_622.txt b/tools/test/h5diff/testfiles/h5diff_622.txt
new file mode 100644
index 0000000..f0d38af
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_622.txt
@@ -0,0 +1,141 @@
+<-n 0> is not a valid option
+usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
+ file1 File name of the first HDF5 file
+ file2 File name of the second HDF5 file
+ [obj1] Name of an HDF5 object, in absolute path
+ [obj2] Name of an HDF5 object, in absolute path
+
+ OPTIONS
+ -h, --help
+ Print a usage message and exit.
+ -V, --version
+ Print version number and exit.
+ -r, --report
+ Report mode. Print differences.
+ -v --verbose
+ Verbose mode. Print differences information and list of objects.
+ -vN --verbose=N
+ Verbose mode with level. Print differences and list of objects.
+ Level of detail depends on value of N:
+ 0 : Identical to '-v' or '--verbose'.
+ 1 : All level 0 information plus one-line attribute
+ status summary.
+ 2 : All level 1 information plus extended attribute
+ status report.
+ -q, --quiet
+ Quiet mode. Do not produce output.
+ --follow-symlinks
+ Follow symbolic links (soft links and external links and compare the)
+ links' target objects.
+ If symbolic link(s) with the same name exist in the files being
+ compared, then determine whether the target of each link is an existing
+ object (dataset, group, or named datatype) or the link is a dangling
+ link (a soft or external link pointing to a target object that does
+ not yet exist).
+ - If both symbolic links are dangling links, they are treated as being
+ the same; by default, h5diff returns an exit code of 0.
+ If, however, --no-dangling-links is used with --follow-symlinks,
+ this situation is treated as an error and h5diff returns an
+ exit code of 2.
+ - If only one of the two links is a dangling link,they are treated as
+ being different and h5diff returns an exit code of 1.
+ If, however, --no-dangling-links is used with --follow-symlinks,
+ this situation is treated as an error and h5diff returns an
+ exit code of 2.
+ - If both symbolic links point to existing objects, h5diff compares the
+ two objects.
+ If any symbolic link specified in the call to h5diff does not exist,
+ h5diff treats it as an error and returns an exit code of 2.
+ --no-dangling-links
+ Must be used with --follow-symlinks option; otherwise, h5diff shows
+ error message and returns an exit code of 2.
+ Check for any symbolic links (soft links or external links) that do not
+ resolve to an existing object (dataset, group, or named datatype).
+ If any dangling link is found, this situation is treated as an error
+ and h5diff returns an exit code of 2.
+ -c, --compare
+ List objects that are not comparable
+ -N, --nan
+ Avoid NaNs detection
+ -n C, --count=C
+ Print differences up to C. C must be a positive integer.
+ -d D, --delta=D
+ Print difference if (|a-b| > D). D must be a positive number.
+ Can not use with '-p' or '--use-system-epsilon'.
+ -p R, --relative=R
+ Print difference if (|(a-b)/b| > R). R must be a positive number.
+ Can not use with '-d' or '--use-system-epsilon'.
+ --use-system-epsilon
+ Print difference if (|a-b| > EPSILON), EPSILON is system defined value.
+ If the system epsilon is not defined,one of the following predefined
+ values will be used:
+ FLT_EPSILON = 1.19209E-07 for floating-point type
+ DBL_EPSILON = 2.22045E-16 for double precision type
+ Can not use with '-p' or '-d'.
+ --exclude-path "path"
+ Exclude the specified path to an object when comparing files or groups.
+ If a group is excluded, all member objects will also be excluded.
+ The specified path is excluded wherever it occurs.
+ This flexibility enables the same option to exclude either objects that
+ exist only in one file or common objects that are known to differ.
+
+ When comparing files, "path" is the absolute path to the excluded;
+ object; when comparing groups, "path" is similar to the relative
+ path from the group to the excluded object. This "path" can be
+ taken from the first section of the output of the --verbose option.
+ For example, if you are comparing the group /groupA in two files and
+ you want to exclude /groupA/groupB/groupC in both files, the exclude
+ option would read as follows:
+ --exclude-path "/groupB/groupC"
+
+ If there are multiple paths to an object, only the specified path(s)
+ will be excluded; the comparison will include any path not explicitly
+ excluded.
+ This option can be used repeatedly to exclude multiple paths.
+
+ Modes of output:
+ Default mode: print the number of differences found and where they occured
+ -r Report mode: print the above plus the differences
+ -v Verbose mode: print the above plus a list of objects and warnings
+ -q Quiet mode: do not print output
+
+ File comparison:
+ If no objects [obj1[ obj2]] are specified, the h5diff comparison proceeds as
+ a comparison of the two files' root groups. That is, h5diff first compares
+ the names of root group members, generates a report of root group objects
+ that appear in only one file or in both files, and recursively compares
+ common objects.
+
+ Object comparison:
+ 1) Groups
+ First compares the names of member objects (relative path, from the
+ specified group) and generates a report of objects that appear in only
+ one group or in both groups. Common objects are then compared recursively.
+ 2) Datasets
+ Array rank and dimensions, datatypes, and data values are compared.
+ 3) Datatypes
+ The comparison is based on the return value of H5Tequal.
+ 4) Symbolic links
+ The paths to the target objects are compared.
+ (The option --follow-symlinks overrides the default behavior when
+ symbolic links are compared.).
+
+ Exit code:
+ 0 if no differences, 1 if differences found, 2 if error
+
+ Examples of use:
+ 1) h5diff file1 file2 /g1/dset1 /g1/dset2
+ Compares object '/g1/dset1' in file1 with '/g1/dset2' in file2
+
+ 2) h5diff file1 file2 /g1/dset1
+ Compares object '/g1/dset1' in both files
+
+ 3) h5diff file1 file2
+ Compares all objects in both files
+
+ Notes:
+ file1 and file2 can be the same file.
+ Use h5diff file1 file1 /g1/dset1 /g1/dset2 to compare
+ '/g1/dset1' and '/g1/dset2' in the same file
+
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_623.txt b/tools/test/h5diff/testfiles/h5diff_623.txt
new file mode 100644
index 0000000..4ab66a5
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_623.txt
@@ -0,0 +1,141 @@
+<-n u> is not a valid option
+usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
+ file1 File name of the first HDF5 file
+ file2 File name of the second HDF5 file
+ [obj1] Name of an HDF5 object, in absolute path
+ [obj2] Name of an HDF5 object, in absolute path
+
+ OPTIONS
+ -h, --help
+ Print a usage message and exit.
+ -V, --version
+ Print version number and exit.
+ -r, --report
+ Report mode. Print differences.
+ -v --verbose
+ Verbose mode. Print differences information and list of objects.
+ -vN --verbose=N
+ Verbose mode with level. Print differences and list of objects.
+ Level of detail depends on value of N:
+ 0 : Identical to '-v' or '--verbose'.
+ 1 : All level 0 information plus one-line attribute
+ status summary.
+ 2 : All level 1 information plus extended attribute
+ status report.
+ -q, --quiet
+ Quiet mode. Do not produce output.
+ --follow-symlinks
+ Follow symbolic links (soft links and external links and compare the)
+ links' target objects.
+ If symbolic link(s) with the same name exist in the files being
+ compared, then determine whether the target of each link is an existing
+ object (dataset, group, or named datatype) or the link is a dangling
+ link (a soft or external link pointing to a target object that does
+ not yet exist).
+ - If both symbolic links are dangling links, they are treated as being
+ the same; by default, h5diff returns an exit code of 0.
+ If, however, --no-dangling-links is used with --follow-symlinks,
+ this situation is treated as an error and h5diff returns an
+ exit code of 2.
+ - If only one of the two links is a dangling link,they are treated as
+ being different and h5diff returns an exit code of 1.
+ If, however, --no-dangling-links is used with --follow-symlinks,
+ this situation is treated as an error and h5diff returns an
+ exit code of 2.
+ - If both symbolic links point to existing objects, h5diff compares the
+ two objects.
+ If any symbolic link specified in the call to h5diff does not exist,
+ h5diff treats it as an error and returns an exit code of 2.
+ --no-dangling-links
+ Must be used with --follow-symlinks option; otherwise, h5diff shows
+ error message and returns an exit code of 2.
+ Check for any symbolic links (soft links or external links) that do not
+ resolve to an existing object (dataset, group, or named datatype).
+ If any dangling link is found, this situation is treated as an error
+ and h5diff returns an exit code of 2.
+ -c, --compare
+ List objects that are not comparable
+ -N, --nan
+ Avoid NaNs detection
+ -n C, --count=C
+ Print differences up to C. C must be a positive integer.
+ -d D, --delta=D
+ Print difference if (|a-b| > D). D must be a positive number.
+ Can not use with '-p' or '--use-system-epsilon'.
+ -p R, --relative=R
+ Print difference if (|(a-b)/b| > R). R must be a positive number.
+ Can not use with '-d' or '--use-system-epsilon'.
+ --use-system-epsilon
+ Print difference if (|a-b| > EPSILON), EPSILON is system defined value.
+ If the system epsilon is not defined,one of the following predefined
+ values will be used:
+ FLT_EPSILON = 1.19209E-07 for floating-point type
+ DBL_EPSILON = 2.22045E-16 for double precision type
+ Can not use with '-p' or '-d'.
+ --exclude-path "path"
+ Exclude the specified path to an object when comparing files or groups.
+ If a group is excluded, all member objects will also be excluded.
+ The specified path is excluded wherever it occurs.
+ This flexibility enables the same option to exclude either objects that
+ exist only in one file or common objects that are known to differ.
+
+ When comparing files, "path" is the absolute path to the excluded;
+ object; when comparing groups, "path" is similar to the relative
+ path from the group to the excluded object. This "path" can be
+ taken from the first section of the output of the --verbose option.
+ For example, if you are comparing the group /groupA in two files and
+ you want to exclude /groupA/groupB/groupC in both files, the exclude
+ option would read as follows:
+ --exclude-path "/groupB/groupC"
+
+ If there are multiple paths to an object, only the specified path(s)
+ will be excluded; the comparison will include any path not explicitly
+ excluded.
+ This option can be used repeatedly to exclude multiple paths.
+
+ Modes of output:
+ Default mode: print the number of differences found and where they occured
+ -r Report mode: print the above plus the differences
+ -v Verbose mode: print the above plus a list of objects and warnings
+ -q Quiet mode: do not print output
+
+ File comparison:
+ If no objects [obj1[ obj2]] are specified, the h5diff comparison proceeds as
+ a comparison of the two files' root groups. That is, h5diff first compares
+ the names of root group members, generates a report of root group objects
+ that appear in only one file or in both files, and recursively compares
+ common objects.
+
+ Object comparison:
+ 1) Groups
+ First compares the names of member objects (relative path, from the
+ specified group) and generates a report of objects that appear in only
+ one group or in both groups. Common objects are then compared recursively.
+ 2) Datasets
+ Array rank and dimensions, datatypes, and data values are compared.
+ 3) Datatypes
+ The comparison is based on the return value of H5Tequal.
+ 4) Symbolic links
+ The paths to the target objects are compared.
+ (The option --follow-symlinks overrides the default behavior when
+ symbolic links are compared.).
+
+ Exit code:
+ 0 if no differences, 1 if differences found, 2 if error
+
+ Examples of use:
+ 1) h5diff file1 file2 /g1/dset1 /g1/dset2
+ Compares object '/g1/dset1' in file1 with '/g1/dset2' in file2
+
+ 2) h5diff file1 file2 /g1/dset1
+ Compares object '/g1/dset1' in both files
+
+ 3) h5diff file1 file2
+ Compares all objects in both files
+
+ Notes:
+ file1 and file2 can be the same file.
+ Use h5diff file1 file1 /g1/dset1 /g1/dset2 to compare
+ '/g1/dset1' and '/g1/dset2' in the same file
+
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_624.txt b/tools/test/h5diff/testfiles/h5diff_624.txt
new file mode 100644
index 0000000..f5e7ee3
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_624.txt
@@ -0,0 +1,141 @@
+<-n 0x1> is not a valid option
+usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
+ file1 File name of the first HDF5 file
+ file2 File name of the second HDF5 file
+ [obj1] Name of an HDF5 object, in absolute path
+ [obj2] Name of an HDF5 object, in absolute path
+
+ OPTIONS
+ -h, --help
+ Print a usage message and exit.
+ -V, --version
+ Print version number and exit.
+ -r, --report
+ Report mode. Print differences.
+ -v --verbose
+ Verbose mode. Print differences information and list of objects.
+ -vN --verbose=N
+ Verbose mode with level. Print differences and list of objects.
+ Level of detail depends on value of N:
+ 0 : Identical to '-v' or '--verbose'.
+ 1 : All level 0 information plus one-line attribute
+ status summary.
+ 2 : All level 1 information plus extended attribute
+ status report.
+ -q, --quiet
+ Quiet mode. Do not produce output.
+ --follow-symlinks
+ Follow symbolic links (soft links and external links and compare the)
+ links' target objects.
+ If symbolic link(s) with the same name exist in the files being
+ compared, then determine whether the target of each link is an existing
+ object (dataset, group, or named datatype) or the link is a dangling
+ link (a soft or external link pointing to a target object that does
+ not yet exist).
+ - If both symbolic links are dangling links, they are treated as being
+ the same; by default, h5diff returns an exit code of 0.
+ If, however, --no-dangling-links is used with --follow-symlinks,
+ this situation is treated as an error and h5diff returns an
+ exit code of 2.
+ - If only one of the two links is a dangling link,they are treated as
+ being different and h5diff returns an exit code of 1.
+ If, however, --no-dangling-links is used with --follow-symlinks,
+ this situation is treated as an error and h5diff returns an
+ exit code of 2.
+ - If both symbolic links point to existing objects, h5diff compares the
+ two objects.
+ If any symbolic link specified in the call to h5diff does not exist,
+ h5diff treats it as an error and returns an exit code of 2.
+ --no-dangling-links
+ Must be used with --follow-symlinks option; otherwise, h5diff shows
+ error message and returns an exit code of 2.
+ Check for any symbolic links (soft links or external links) that do not
+ resolve to an existing object (dataset, group, or named datatype).
+ If any dangling link is found, this situation is treated as an error
+ and h5diff returns an exit code of 2.
+ -c, --compare
+ List objects that are not comparable
+ -N, --nan
+ Avoid NaNs detection
+ -n C, --count=C
+ Print differences up to C. C must be a positive integer.
+ -d D, --delta=D
+ Print difference if (|a-b| > D). D must be a positive number.
+ Can not use with '-p' or '--use-system-epsilon'.
+ -p R, --relative=R
+ Print difference if (|(a-b)/b| > R). R must be a positive number.
+ Can not use with '-d' or '--use-system-epsilon'.
+ --use-system-epsilon
+ Print difference if (|a-b| > EPSILON), EPSILON is system defined value.
+ If the system epsilon is not defined,one of the following predefined
+ values will be used:
+ FLT_EPSILON = 1.19209E-07 for floating-point type
+ DBL_EPSILON = 2.22045E-16 for double precision type
+ Can not use with '-p' or '-d'.
+ --exclude-path "path"
+ Exclude the specified path to an object when comparing files or groups.
+ If a group is excluded, all member objects will also be excluded.
+ The specified path is excluded wherever it occurs.
+ This flexibility enables the same option to exclude either objects that
+ exist only in one file or common objects that are known to differ.
+
+ When comparing files, "path" is the absolute path to the excluded;
+ object; when comparing groups, "path" is similar to the relative
+ path from the group to the excluded object. This "path" can be
+ taken from the first section of the output of the --verbose option.
+ For example, if you are comparing the group /groupA in two files and
+ you want to exclude /groupA/groupB/groupC in both files, the exclude
+ option would read as follows:
+ --exclude-path "/groupB/groupC"
+
+ If there are multiple paths to an object, only the specified path(s)
+ will be excluded; the comparison will include any path not explicitly
+ excluded.
+ This option can be used repeatedly to exclude multiple paths.
+
+ Modes of output:
+ Default mode: print the number of differences found and where they occured
+ -r Report mode: print the above plus the differences
+ -v Verbose mode: print the above plus a list of objects and warnings
+ -q Quiet mode: do not print output
+
+ File comparison:
+ If no objects [obj1[ obj2]] are specified, the h5diff comparison proceeds as
+ a comparison of the two files' root groups. That is, h5diff first compares
+ the names of root group members, generates a report of root group objects
+ that appear in only one file or in both files, and recursively compares
+ common objects.
+
+ Object comparison:
+ 1) Groups
+ First compares the names of member objects (relative path, from the
+ specified group) and generates a report of objects that appear in only
+ one group or in both groups. Common objects are then compared recursively.
+ 2) Datasets
+ Array rank and dimensions, datatypes, and data values are compared.
+ 3) Datatypes
+ The comparison is based on the return value of H5Tequal.
+ 4) Symbolic links
+ The paths to the target objects are compared.
+ (The option --follow-symlinks overrides the default behavior when
+ symbolic links are compared.).
+
+ Exit code:
+ 0 if no differences, 1 if differences found, 2 if error
+
+ Examples of use:
+ 1) h5diff file1 file2 /g1/dset1 /g1/dset2
+ Compares object '/g1/dset1' in file1 with '/g1/dset2' in file2
+
+ 2) h5diff file1 file2 /g1/dset1
+ Compares object '/g1/dset1' in both files
+
+ 3) h5diff file1 file2
+ Compares all objects in both files
+
+ Notes:
+ file1 and file2 can be the same file.
+ Use h5diff file1 file1 /g1/dset1 /g1/dset2 to compare
+ '/g1/dset1' and '/g1/dset2' in the same file
+
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_625.txt b/tools/test/h5diff/testfiles/h5diff_625.txt
new file mode 100644
index 0000000..3bc194a
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_625.txt
@@ -0,0 +1,3 @@
+dataset: </g1/dset3> and </g1/dset4>
+2 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_626.txt b/tools/test/h5diff/testfiles/h5diff_626.txt
new file mode 100644
index 0000000..6494066
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_626.txt
@@ -0,0 +1,3 @@
+dataset: </g1/dset3> and </g1/dset4>
+3 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_627.txt b/tools/test/h5diff/testfiles/h5diff_627.txt
new file mode 100644
index 0000000..db14532
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_627.txt
@@ -0,0 +1,3 @@
+dataset: </g1/dset3> and </g1/dset4>
+6 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_628.txt b/tools/test/h5diff/testfiles/h5diff_628.txt
new file mode 100644
index 0000000..e11d8ee
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_628.txt
@@ -0,0 +1,3 @@
+dataset: </g1/dset3> and </g1/dset4>
+1 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_629.txt b/tools/test/h5diff/testfiles/h5diff_629.txt
new file mode 100644
index 0000000..962c2b0
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_629.txt
@@ -0,0 +1,2 @@
+h5diff: <file1.h6>: unable to open file
+EXIT CODE: 2
diff --git a/tools/test/h5diff/testfiles/h5diff_630.txt b/tools/test/h5diff/testfiles/h5diff_630.txt
new file mode 100644
index 0000000..aaf0148
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_630.txt
@@ -0,0 +1,3 @@
+dataset: </g1/fp18> and </g1/fp18_COPY>
+0 differences found
+EXIT CODE: 0
diff --git a/tools/test/h5diff/testfiles/h5diff_631.txt b/tools/test/h5diff/testfiles/h5diff_631.txt
new file mode 100644
index 0000000..aaf0148
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_631.txt
@@ -0,0 +1,3 @@
+dataset: </g1/fp18> and </g1/fp18_COPY>
+0 differences found
+EXIT CODE: 0
diff --git a/tools/test/h5diff/testfiles/h5diff_640.txt b/tools/test/h5diff/testfiles/h5diff_640.txt
new file mode 100644
index 0000000..4c956a6
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_640.txt
@@ -0,0 +1,4 @@
+h5diff error: -d, -p and --use-system-epsilon options are mutually-exclusive;
+use no more than one.
+Try '-h' or '--help' option for more information or see the h5diff entry in the 'HDF5 Reference Manual'.
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_641.txt b/tools/test/h5diff/testfiles/h5diff_641.txt
new file mode 100644
index 0000000..4c956a6
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_641.txt
@@ -0,0 +1,4 @@
+h5diff error: -d, -p and --use-system-epsilon options are mutually-exclusive;
+use no more than one.
+Try '-h' or '--help' option for more information or see the h5diff entry in the 'HDF5 Reference Manual'.
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_642.txt b/tools/test/h5diff/testfiles/h5diff_642.txt
new file mode 100644
index 0000000..4c956a6
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_642.txt
@@ -0,0 +1,4 @@
+h5diff error: -d, -p and --use-system-epsilon options are mutually-exclusive;
+use no more than one.
+Try '-h' or '--help' option for more information or see the h5diff entry in the 'HDF5 Reference Manual'.
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_643.txt b/tools/test/h5diff/testfiles/h5diff_643.txt
new file mode 100644
index 0000000..4c956a6
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_643.txt
@@ -0,0 +1,4 @@
+h5diff error: -d, -p and --use-system-epsilon options are mutually-exclusive;
+use no more than one.
+Try '-h' or '--help' option for more information or see the h5diff entry in the 'HDF5 Reference Manual'.
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_644.txt b/tools/test/h5diff/testfiles/h5diff_644.txt
new file mode 100644
index 0000000..4c956a6
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_644.txt
@@ -0,0 +1,4 @@
+h5diff error: -d, -p and --use-system-epsilon options are mutually-exclusive;
+use no more than one.
+Try '-h' or '--help' option for more information or see the h5diff entry in the 'HDF5 Reference Manual'.
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_645.txt b/tools/test/h5diff/testfiles/h5diff_645.txt
new file mode 100644
index 0000000..4c956a6
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_645.txt
@@ -0,0 +1,4 @@
+h5diff error: -d, -p and --use-system-epsilon options are mutually-exclusive;
+use no more than one.
+Try '-h' or '--help' option for more information or see the h5diff entry in the 'HDF5 Reference Manual'.
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_646.txt b/tools/test/h5diff/testfiles/h5diff_646.txt
new file mode 100644
index 0000000..4c956a6
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_646.txt
@@ -0,0 +1,4 @@
+h5diff error: -d, -p and --use-system-epsilon options are mutually-exclusive;
+use no more than one.
+Try '-h' or '--help' option for more information or see the h5diff entry in the 'HDF5 Reference Manual'.
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_70.txt b/tools/test/h5diff/testfiles/h5diff_70.txt
new file mode 100644
index 0000000..0a6b0c0
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_70.txt
@@ -0,0 +1,2032 @@
+
+file1 file2
+---------------------------------------
+ x x /
+ x x /dset
+ x x /g1
+
+group : </> and </>
+0 differences found
+attribute: <VLstring of </>> and <VLstring of </>>
+size: [2] [2]
+position VLstring of </> VLstring of </> difference
+------------------------------------------------------------
+[ 0 ] a z
+[ 0 ] b z
+[ 1 ] d z
+[ 1 ] e z
+4 differences found
+attribute: <VLstring2D of </>> and <VLstring2D of </>>
+size: [3x2] [3x2]
+position VLstring2D of </> VLstring2D of </> difference
+------------------------------------------------------------
+[ 0 0 ] a z
+[ 0 0 ] b z
+[ 0 1 ] c z
+[ 0 1 ] d z
+[ 1 0 ] e z
+[ 1 0 ] f z
+[ 1 1 ] g z
+[ 1 1 ] h z
+[ 2 0 ] i z
+[ 2 0 ] j z
+[ 2 1 ] k z
+[ 2 1 ] l z
+12 differences found
+attribute: <VLstring3D of </>> and <VLstring3D of </>>
+size: [4x3x2] [4x3x2]
+position VLstring3D of </> VLstring3D of </> difference
+------------------------------------------------------------
+[ 0 0 0 ] a z
+[ 0 0 0 ] b z
+[ 0 0 1 ] c z
+[ 0 0 1 ] d z
+[ 0 1 0 ] e z
+[ 0 1 0 ] f z
+[ 0 1 1 ] g z
+[ 0 1 1 ] h z
+[ 0 2 0 ] i z
+[ 0 2 0 ] j z
+[ 0 2 1 ] k z
+[ 0 2 1 ] l z
+[ 1 0 0 ] m z
+[ 1 0 0 ] n z
+[ 1 0 1 ] p z
+[ 1 0 1 ] q z
+[ 1 1 0 ] r z
+[ 1 1 0 ] s z
+[ 1 1 1 ] t z
+[ 1 1 1 ] u z
+[ 1 2 0 ] v z
+[ 1 2 0 ] w z
+[ 1 2 1 ] x z
+[ 2 0 0 ] A z
+[ 2 0 0 ] B z
+[ 2 0 1 ] C z
+[ 2 0 1 ] D z
+[ 2 1 0 ] E z
+[ 2 1 0 ] F z
+[ 2 1 1 ] G z
+[ 2 1 1 ] H z
+[ 2 2 0 ] I z
+[ 2 2 0 ] J z
+[ 2 2 1 ] K z
+[ 2 2 1 ] L z
+[ 3 0 0 ] M z
+[ 3 0 0 ] N z
+[ 3 0 1 ] P z
+[ 3 0 1 ] Q z
+[ 3 1 0 ] R z
+[ 3 1 0 ] S z
+[ 3 1 1 ] T z
+[ 3 1 1 ] U z
+[ 3 2 0 ] V z
+[ 3 2 0 ] W z
+[ 3 2 1 ] X z
+[ 3 2 1 ] Z z
+47 differences found
+attribute: <array of </>> and <array of </>>
+size: [2] [2]
+position array of </> array of </> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 0 ] 2 0 2
+[ 0 ] 3 0 3
+[ 1 ] 4 0 4
+[ 1 ] 5 0 5
+[ 1 ] 6 0 6
+6 differences found
+attribute: <array2D of </>> and <array2D of </>>
+size: [3x2] [3x2]
+position array2D of </> array2D of </> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 0 ] 2 0 2
+[ 0 0 ] 3 0 3
+[ 0 1 ] 4 0 4
+[ 0 1 ] 5 0 5
+[ 0 1 ] 6 0 6
+[ 1 0 ] 7 0 7
+[ 1 0 ] 8 0 8
+[ 1 0 ] 9 0 9
+[ 1 1 ] 10 0 10
+[ 1 1 ] 11 0 11
+[ 1 1 ] 12 0 12
+[ 2 0 ] 13 0 13
+[ 2 0 ] 14 0 14
+[ 2 0 ] 15 0 15
+[ 2 1 ] 16 0 16
+[ 2 1 ] 17 0 17
+[ 2 1 ] 18 0 18
+18 differences found
+attribute: <array3D of </>> and <array3D of </>>
+size: [4x3x2] [4x3x2]
+position array3D of </> array3D of </> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 0 ] 2 0 2
+[ 0 0 0 ] 3 0 3
+[ 0 0 1 ] 4 0 4
+[ 0 0 1 ] 5 0 5
+[ 0 0 1 ] 6 0 6
+[ 0 1 0 ] 7 0 7
+[ 0 1 0 ] 8 0 8
+[ 0 1 0 ] 9 0 9
+[ 0 1 1 ] 10 0 10
+[ 0 1 1 ] 11 0 11
+[ 0 1 1 ] 12 0 12
+[ 0 2 0 ] 13 0 13
+[ 0 2 0 ] 14 0 14
+[ 0 2 0 ] 15 0 15
+[ 0 2 1 ] 16 0 16
+[ 0 2 1 ] 17 0 17
+[ 0 2 1 ] 18 0 18
+[ 1 0 0 ] 19 0 19
+[ 1 0 0 ] 20 0 20
+[ 1 0 0 ] 21 0 21
+[ 1 0 1 ] 22 0 22
+[ 1 0 1 ] 23 0 23
+[ 1 0 1 ] 24 0 24
+[ 1 1 0 ] 25 0 25
+[ 1 1 0 ] 26 0 26
+[ 1 1 0 ] 27 0 27
+[ 1 1 1 ] 28 0 28
+[ 1 1 1 ] 29 0 29
+[ 1 1 1 ] 30 0 30
+[ 1 2 0 ] 31 0 31
+[ 1 2 0 ] 32 0 32
+[ 1 2 0 ] 33 0 33
+[ 1 2 1 ] 34 0 34
+[ 1 2 1 ] 35 0 35
+[ 1 2 1 ] 36 0 36
+[ 2 0 0 ] 37 0 37
+[ 2 0 0 ] 38 0 38
+[ 2 0 0 ] 39 0 39
+[ 2 0 1 ] 40 0 40
+[ 2 0 1 ] 41 0 41
+[ 2 0 1 ] 42 0 42
+[ 2 1 0 ] 43 0 43
+[ 2 1 0 ] 44 0 44
+[ 2 1 0 ] 45 0 45
+[ 2 1 1 ] 46 0 46
+[ 2 1 1 ] 47 0 47
+[ 2 1 1 ] 48 0 48
+[ 2 2 0 ] 49 0 49
+[ 2 2 0 ] 50 0 50
+[ 2 2 0 ] 51 0 51
+[ 2 2 1 ] 52 0 52
+[ 2 2 1 ] 53 0 53
+[ 2 2 1 ] 54 0 54
+[ 3 0 0 ] 55 0 55
+[ 3 0 0 ] 56 0 56
+[ 3 0 0 ] 57 0 57
+[ 3 0 1 ] 58 0 58
+[ 3 0 1 ] 59 0 59
+[ 3 0 1 ] 60 0 60
+[ 3 1 0 ] 61 0 61
+[ 3 1 0 ] 62 0 62
+[ 3 1 0 ] 63 0 63
+[ 3 1 1 ] 64 0 64
+[ 3 1 1 ] 65 0 65
+[ 3 1 1 ] 66 0 66
+[ 3 2 0 ] 67 0 67
+[ 3 2 0 ] 68 0 68
+[ 3 2 0 ] 69 0 69
+[ 3 2 1 ] 70 0 70
+[ 3 2 1 ] 71 0 71
+[ 3 2 1 ] 72 0 72
+72 differences found
+attribute: <bitfield of </>> and <bitfield of </>>
+size: [2] [2]
+position bitfield of </> bitfield of </> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+2 differences found
+attribute: <bitfield2D of </>> and <bitfield2D of </>>
+size: [3x2] [3x2]
+position bitfield2D of </> bitfield2D of </> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 2 0 ] 5 0 5
+[ 2 1 ] 6 0 6
+6 differences found
+attribute: <bitfield3D of </>> and <bitfield3D of </>>
+size: [4x3x2] [4x3x2]
+position bitfield3D of </> bitfield3D of </> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 1 ] 2 0 2
+[ 0 1 0 ] 3 0 3
+[ 0 1 1 ] 4 0 4
+[ 0 2 0 ] 5 0 5
+[ 0 2 1 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 1 0 ] 9 0 9
+[ 1 1 1 ] 10 0 10
+[ 1 2 0 ] 11 0 11
+[ 1 2 1 ] 12 0 12
+[ 2 0 0 ] 13 0 13
+[ 2 0 1 ] 14 0 14
+[ 2 1 0 ] 15 0 15
+[ 2 1 1 ] 16 0 16
+[ 2 2 0 ] 17 0 17
+[ 2 2 1 ] 18 0 18
+[ 3 0 0 ] 19 0 19
+[ 3 0 1 ] 20 0 20
+[ 3 1 0 ] 21 0 21
+[ 3 1 1 ] 22 0 22
+[ 3 2 0 ] 23 0 23
+[ 3 2 1 ] 24 0 24
+24 differences found
+attribute: <compound of </>> and <compound of </>>
+size: [2] [2]
+position compound of </> compound of </> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 0 ] 2 0 2
+[ 1 ] 3 0 3
+[ 1 ] 4 0 4
+4 differences found
+attribute: <compound2D of </>> and <compound2D of </>>
+size: [3x2] [3x2]
+position compound2D of </> compound2D of </> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 0 ] 2 0 2
+[ 0 1 ] 3 0 3
+[ 0 1 ] 4 0 4
+[ 1 0 ] 5 0 5
+[ 1 0 ] 6 0 6
+[ 1 1 ] 7 0 7
+[ 1 1 ] 8 0 8
+[ 2 0 ] 9 0 9
+[ 2 0 ] 10 0 10
+[ 2 1 ] 11 0 11
+[ 2 1 ] 12 0 12
+12 differences found
+attribute: <compound3D of </>> and <compound3D of </>>
+size: [4x3x2] [4x3x2]
+position compound3D of </> compound3D of </> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 0 ] 2 0 2
+[ 0 0 1 ] 3 0 3
+[ 0 0 1 ] 4 0 4
+[ 0 1 0 ] 5 0 5
+[ 0 1 0 ] 6 0 6
+[ 0 1 1 ] 7 0 7
+[ 0 1 1 ] 8 0 8
+[ 0 2 0 ] 9 0 9
+[ 0 2 0 ] 10 0 10
+[ 0 2 1 ] 11 0 11
+[ 0 2 1 ] 12 0 12
+[ 1 0 0 ] 13 0 13
+[ 1 0 0 ] 14 0 14
+[ 1 0 1 ] 15 0 15
+[ 1 0 1 ] 16 0 16
+[ 1 1 0 ] 17 0 17
+[ 1 1 0 ] 18 0 18
+[ 1 1 1 ] 19 0 19
+[ 1 1 1 ] 20 0 20
+[ 1 2 0 ] 21 0 21
+[ 1 2 0 ] 22 0 22
+[ 1 2 1 ] 23 0 23
+[ 1 2 1 ] 24 0 24
+[ 2 0 0 ] 25 0 25
+[ 2 0 0 ] 26 0 26
+[ 2 0 1 ] 27 0 27
+[ 2 0 1 ] 28 0 28
+[ 2 1 0 ] 29 0 29
+[ 2 1 0 ] 30 0 30
+[ 2 1 1 ] 31 0 31
+[ 2 1 1 ] 32 0 32
+[ 2 2 0 ] 33 0 33
+[ 2 2 0 ] 34 0 34
+[ 2 2 1 ] 35 0 35
+[ 2 2 1 ] 36 0 36
+[ 3 0 0 ] 37 0 37
+[ 3 0 0 ] 38 0 38
+[ 3 0 1 ] 39 0 39
+[ 3 0 1 ] 40 0 40
+[ 3 1 0 ] 41 0 41
+[ 3 1 0 ] 42 0 42
+[ 3 1 1 ] 43 0 43
+[ 3 1 1 ] 44 0 44
+[ 3 2 0 ] 45 0 45
+[ 3 2 0 ] 46 0 46
+[ 3 2 1 ] 47 0 47
+[ 3 2 1 ] 48 0 48
+48 differences found
+attribute: <enum of </>> and <enum of </>>
+size: [2] [2]
+position enum of </> enum of </> difference
+------------------------------------------------------------
+[ 0 ] RED GREEN
+[ 1 ] RED GREEN
+2 differences found
+attribute: <enum2D of </>> and <enum2D of </>>
+size: [3x2] [3x2]
+position enum2D of </> enum2D of </> difference
+------------------------------------------------------------
+[ 0 0 ] RED GREEN
+[ 0 1 ] RED GREEN
+[ 1 0 ] RED GREEN
+[ 1 1 ] RED GREEN
+[ 2 0 ] RED GREEN
+[ 2 1 ] RED GREEN
+6 differences found
+attribute: <enum3D of </>> and <enum3D of </>>
+size: [4x3x2] [4x3x2]
+position enum3D of </> enum3D of </> difference
+------------------------------------------------------------
+[ 0 0 0 ] GREEN RED
+[ 0 0 1 ] GREEN RED
+[ 0 1 0 ] GREEN RED
+[ 0 1 1 ] GREEN RED
+[ 0 2 0 ] GREEN RED
+[ 0 2 1 ] GREEN RED
+[ 1 0 0 ] GREEN RED
+[ 1 0 1 ] GREEN RED
+[ 1 1 0 ] GREEN RED
+[ 1 1 1 ] GREEN RED
+[ 1 2 0 ] GREEN RED
+[ 1 2 1 ] GREEN RED
+[ 2 0 0 ] GREEN RED
+[ 2 0 1 ] GREEN RED
+[ 2 1 0 ] GREEN RED
+[ 2 1 1 ] GREEN RED
+[ 2 2 0 ] GREEN RED
+[ 2 2 1 ] GREEN RED
+[ 3 0 0 ] GREEN RED
+[ 3 0 1 ] GREEN RED
+[ 3 1 0 ] GREEN RED
+[ 3 1 1 ] GREEN RED
+[ 3 2 0 ] GREEN RED
+[ 3 2 1 ] GREEN RED
+24 differences found
+attribute: <float of </>> and <float of </>>
+size: [2] [2]
+position float of </> float of </> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+2 differences found
+attribute: <float2D of </>> and <float2D of </>>
+size: [3x2] [3x2]
+position float2D of </> float2D of </> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 2 0 ] 5 0 5
+[ 2 1 ] 6 0 6
+6 differences found
+attribute: <float3D of </>> and <float3D of </>>
+size: [4x3x2] [4x3x2]
+position float3D of </> float3D of </> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 1 ] 2 0 2
+[ 0 1 0 ] 3 0 3
+[ 0 1 1 ] 4 0 4
+[ 0 2 0 ] 5 0 5
+[ 0 2 1 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 1 0 ] 9 0 9
+[ 1 1 1 ] 10 0 10
+[ 1 2 0 ] 11 0 11
+[ 1 2 1 ] 12 0 12
+[ 2 0 0 ] 13 0 13
+[ 2 0 1 ] 14 0 14
+[ 2 1 0 ] 15 0 15
+[ 2 1 1 ] 16 0 16
+[ 2 2 0 ] 17 0 17
+[ 2 2 1 ] 18 0 18
+[ 3 0 0 ] 19 0 19
+[ 3 0 1 ] 20 0 20
+[ 3 1 0 ] 21 0 21
+[ 3 1 1 ] 22 0 22
+[ 3 2 0 ] 23 0 23
+[ 3 2 1 ] 24 0 24
+24 differences found
+attribute: <integer of </>> and <integer of </>>
+size: [2] [2]
+position integer of </> integer of </> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+2 differences found
+attribute: <integer2D of </>> and <integer2D of </>>
+size: [3x2] [3x2]
+position integer2D of </> integer2D of </> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 2 0 ] 5 0 5
+[ 2 1 ] 6 0 6
+6 differences found
+attribute: <integer3D of </>> and <integer3D of </>>
+size: [4x3x2] [4x3x2]
+position integer3D of </> integer3D of </> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 1 ] 2 0 2
+[ 0 1 0 ] 3 0 3
+[ 0 1 1 ] 4 0 4
+[ 0 2 0 ] 5 0 5
+[ 0 2 1 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 1 0 ] 9 0 9
+[ 1 1 1 ] 10 0 10
+[ 1 2 0 ] 11 0 11
+[ 1 2 1 ] 12 0 12
+[ 2 0 0 ] 13 0 13
+[ 2 0 1 ] 14 0 14
+[ 2 1 0 ] 15 0 15
+[ 2 1 1 ] 16 0 16
+[ 2 2 0 ] 17 0 17
+[ 2 2 1 ] 18 0 18
+[ 3 0 0 ] 19 0 19
+[ 3 0 1 ] 20 0 20
+[ 3 1 0 ] 21 0 21
+[ 3 1 1 ] 22 0 22
+[ 3 2 0 ] 23 0 23
+[ 3 2 1 ] 24 0 24
+24 differences found
+attribute: <opaque of </>> and <opaque of </>>
+size: [2] [2]
+position opaque of </> opaque of </> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+2 differences found
+attribute: <opaque2D of </>> and <opaque2D of </>>
+size: [3x2] [3x2]
+position opaque2D of </> opaque2D of </> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 2 0 ] 5 0 5
+[ 2 1 ] 6 0 6
+6 differences found
+attribute: <opaque3D of </>> and <opaque3D of </>>
+size: [4x3x2] [4x3x2]
+position opaque3D of </> opaque3D of </> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 1 ] 2 0 2
+[ 0 1 0 ] 3 0 3
+[ 0 1 1 ] 4 0 4
+[ 0 2 0 ] 5 0 5
+[ 0 2 1 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 1 0 ] 9 0 9
+[ 1 1 1 ] 10 0 10
+[ 1 2 0 ] 11 0 11
+[ 1 2 1 ] 12 0 12
+[ 2 0 0 ] 13 0 13
+[ 2 0 1 ] 14 0 14
+[ 2 1 0 ] 15 0 15
+[ 2 1 1 ] 16 0 16
+[ 2 2 0 ] 17 0 17
+[ 2 2 1 ] 18 0 18
+[ 3 0 0 ] 19 0 19
+[ 3 0 1 ] 20 0 20
+[ 3 1 0 ] 21 0 21
+[ 3 1 1 ] 22 0 22
+[ 3 2 0 ] 23 0 23
+[ 3 2 1 ] 24 0 24
+24 differences found
+attribute: <string of </>> and <string of </>>
+size: [2] [2]
+position string of </> string of </> difference
+------------------------------------------------------------
+[ 0 ] a z
+[ 0 ] b z
+[ 1 ] d z
+[ 1 ] e z
+4 differences found
+attribute: <string2D of </>> and <string2D of </>>
+size: [3x2] [3x2]
+position string2D of </> string2D of </> difference
+------------------------------------------------------------
+[ 0 0 ] a z
+[ 0 0 ] b z
+[ 0 1 ] c z
+[ 0 1 ] d z
+[ 1 0 ] e z
+[ 1 0 ] f z
+[ 1 1 ] g z
+[ 1 1 ] h z
+[ 2 0 ] i z
+[ 2 0 ] j z
+[ 2 1 ] k z
+[ 2 1 ] l z
+12 differences found
+attribute: <string3D of </>> and <string3D of </>>
+size: [4x3x2] [4x3x2]
+position string3D of </> string3D of </> difference
+------------------------------------------------------------
+[ 0 0 0 ] a z
+[ 0 0 0 ] b z
+[ 0 0 1 ] c z
+[ 0 0 1 ] d z
+[ 0 1 0 ] e z
+[ 0 1 0 ] f z
+[ 0 1 1 ] g z
+[ 0 1 1 ] h z
+[ 0 2 0 ] i z
+[ 0 2 0 ] j z
+[ 0 2 1 ] k z
+[ 0 2 1 ] l z
+[ 1 0 0 ] m z
+[ 1 0 0 ] n z
+[ 1 0 1 ] p z
+[ 1 0 1 ] q z
+[ 1 1 0 ] r z
+[ 1 1 0 ] s z
+[ 1 1 1 ] t z
+[ 1 1 1 ] u z
+[ 1 2 0 ] v z
+[ 1 2 0 ] w z
+[ 1 2 1 ] x z
+[ 2 0 0 ] A z
+[ 2 0 0 ] B z
+[ 2 0 1 ] C z
+[ 2 0 1 ] D z
+[ 2 1 0 ] E z
+[ 2 1 0 ] F z
+[ 2 1 1 ] G z
+[ 2 1 1 ] H z
+[ 2 2 0 ] I z
+[ 2 2 0 ] J z
+[ 2 2 1 ] K z
+[ 2 2 1 ] L z
+[ 3 0 0 ] M z
+[ 3 0 0 ] N z
+[ 3 0 1 ] P z
+[ 3 0 1 ] Q z
+[ 3 1 0 ] R z
+[ 3 1 0 ] S z
+[ 3 1 1 ] T z
+[ 3 1 1 ] U z
+[ 3 2 0 ] V z
+[ 3 2 0 ] W z
+[ 3 2 1 ] X z
+[ 3 2 1 ] Z z
+47 differences found
+attribute: <vlen of </>> and <vlen of </>>
+size: [2] [2]
+position vlen of </> vlen of </> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+[ 1 ] 3 0 3
+3 differences found
+attribute: <vlen2D of </>> and <vlen2D of </>>
+size: [3x2] [3x2]
+position vlen2D of </> vlen2D of </> difference
+------------------------------------------------------------
+[ 0 1 ] 1 0 1
+[ 1 0 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 1 1 ] 5 0 5
+[ 2 0 ] 6 0 6
+[ 2 0 ] 7 0 7
+[ 2 0 ] 8 0 8
+[ 2 1 ] 9 0 9
+[ 2 1 ] 10 0 10
+[ 2 1 ] 11 0 11
+11 differences found
+attribute: <vlen3D of </>> and <vlen3D of </>>
+size: [4x3x2] [4x3x2]
+position vlen3D of </> vlen3D of </> difference
+------------------------------------------------------------
+[ 0 0 1 ] 1 0 1
+[ 0 1 0 ] 2 0 2
+[ 0 1 1 ] 3 0 3
+[ 0 2 0 ] 4 0 4
+[ 0 2 1 ] 5 0 5
+[ 1 0 0 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 0 1 ] 9 0 9
+[ 1 1 0 ] 10 0 10
+[ 1 1 0 ] 11 0 11
+[ 1 1 1 ] 12 0 12
+[ 1 1 1 ] 13 0 13
+[ 1 2 0 ] 14 0 14
+[ 1 2 0 ] 15 0 15
+[ 1 2 1 ] 16 0 16
+[ 1 2 1 ] 17 0 17
+[ 2 0 0 ] 18 0 18
+[ 2 0 0 ] 19 0 19
+[ 2 0 0 ] 20 0 20
+[ 2 0 1 ] 21 0 21
+[ 2 0 1 ] 22 0 22
+[ 2 0 1 ] 23 0 23
+[ 2 1 0 ] 24 0 24
+[ 2 1 0 ] 25 0 25
+[ 2 1 0 ] 26 0 26
+[ 2 1 1 ] 27 0 27
+[ 2 1 1 ] 28 0 28
+[ 2 1 1 ] 29 0 29
+[ 2 2 0 ] 30 0 30
+[ 2 2 0 ] 31 0 31
+[ 2 2 0 ] 32 0 32
+[ 2 2 1 ] 33 0 33
+[ 2 2 1 ] 34 0 34
+[ 2 2 1 ] 35 0 35
+[ 3 0 0 ] 36 0 36
+[ 3 0 0 ] 37 0 37
+[ 3 0 0 ] 38 0 38
+[ 3 0 0 ] 39 0 39
+[ 3 0 1 ] 40 0 40
+[ 3 0 1 ] 41 0 41
+[ 3 0 1 ] 42 0 42
+[ 3 0 1 ] 43 0 43
+[ 3 1 0 ] 44 0 44
+[ 3 1 0 ] 45 0 45
+[ 3 1 0 ] 46 0 46
+[ 3 1 0 ] 47 0 47
+[ 3 1 1 ] 48 0 48
+[ 3 1 1 ] 49 0 49
+[ 3 1 1 ] 50 0 50
+[ 3 1 1 ] 51 0 51
+[ 3 2 0 ] 52 0 52
+[ 3 2 0 ] 53 0 53
+[ 3 2 0 ] 54 0 54
+[ 3 2 0 ] 55 0 55
+[ 3 2 1 ] 56 0 56
+[ 3 2 1 ] 57 0 57
+[ 3 2 1 ] 58 0 58
+[ 3 2 1 ] 59 0 59
+59 differences found
+dataset: </dset> and </dset>
+Not comparable: </dset> or </dset> is an empty dataset
+0 differences found
+attribute: <VLstring of </dset>> and <VLstring of </dset>>
+size: [2] [2]
+position VLstring of </dset> VLstring of </dset> difference
+------------------------------------------------------------
+[ 0 ] a z
+[ 0 ] b z
+[ 1 ] d z
+[ 1 ] e z
+4 differences found
+attribute: <VLstring2D of </dset>> and <VLstring2D of </dset>>
+size: [3x2] [3x2]
+position VLstring2D of </dset> VLstring2D of </dset> difference
+------------------------------------------------------------
+[ 0 0 ] a z
+[ 0 0 ] b z
+[ 0 1 ] c z
+[ 0 1 ] d z
+[ 1 0 ] e z
+[ 1 0 ] f z
+[ 1 1 ] g z
+[ 1 1 ] h z
+[ 2 0 ] i z
+[ 2 0 ] j z
+[ 2 1 ] k z
+[ 2 1 ] l z
+12 differences found
+attribute: <VLstring3D of </dset>> and <VLstring3D of </dset>>
+size: [4x3x2] [4x3x2]
+position VLstring3D of </dset> VLstring3D of </dset> difference
+------------------------------------------------------------
+[ 0 0 0 ] a z
+[ 0 0 0 ] b z
+[ 0 0 1 ] c z
+[ 0 0 1 ] d z
+[ 0 1 0 ] e z
+[ 0 1 0 ] f z
+[ 0 1 1 ] g z
+[ 0 1 1 ] h z
+[ 0 2 0 ] i z
+[ 0 2 0 ] j z
+[ 0 2 1 ] k z
+[ 0 2 1 ] l z
+[ 1 0 0 ] m z
+[ 1 0 0 ] n z
+[ 1 0 1 ] p z
+[ 1 0 1 ] q z
+[ 1 1 0 ] r z
+[ 1 1 0 ] s z
+[ 1 1 1 ] t z
+[ 1 1 1 ] u z
+[ 1 2 0 ] v z
+[ 1 2 0 ] w z
+[ 1 2 1 ] x z
+[ 2 0 0 ] A z
+[ 2 0 0 ] B z
+[ 2 0 1 ] C z
+[ 2 0 1 ] D z
+[ 2 1 0 ] E z
+[ 2 1 0 ] F z
+[ 2 1 1 ] G z
+[ 2 1 1 ] H z
+[ 2 2 0 ] I z
+[ 2 2 0 ] J z
+[ 2 2 1 ] K z
+[ 2 2 1 ] L z
+[ 3 0 0 ] M z
+[ 3 0 0 ] N z
+[ 3 0 1 ] P z
+[ 3 0 1 ] Q z
+[ 3 1 0 ] R z
+[ 3 1 0 ] S z
+[ 3 1 1 ] T z
+[ 3 1 1 ] U z
+[ 3 2 0 ] V z
+[ 3 2 0 ] W z
+[ 3 2 1 ] X z
+[ 3 2 1 ] Z z
+47 differences found
+attribute: <array of </dset>> and <array of </dset>>
+size: [2] [2]
+position array of </dset> array of </dset> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 0 ] 2 0 2
+[ 0 ] 3 0 3
+[ 1 ] 4 0 4
+[ 1 ] 5 0 5
+[ 1 ] 6 0 6
+6 differences found
+attribute: <array2D of </dset>> and <array2D of </dset>>
+size: [3x2] [3x2]
+position array2D of </dset> array2D of </dset> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 0 ] 2 0 2
+[ 0 0 ] 3 0 3
+[ 0 1 ] 4 0 4
+[ 0 1 ] 5 0 5
+[ 0 1 ] 6 0 6
+[ 1 0 ] 7 0 7
+[ 1 0 ] 8 0 8
+[ 1 0 ] 9 0 9
+[ 1 1 ] 10 0 10
+[ 1 1 ] 11 0 11
+[ 1 1 ] 12 0 12
+[ 2 0 ] 13 0 13
+[ 2 0 ] 14 0 14
+[ 2 0 ] 15 0 15
+[ 2 1 ] 16 0 16
+[ 2 1 ] 17 0 17
+[ 2 1 ] 18 0 18
+18 differences found
+attribute: <array3D of </dset>> and <array3D of </dset>>
+size: [4x3x2] [4x3x2]
+position array3D of </dset> array3D of </dset> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 0 ] 2 0 2
+[ 0 0 0 ] 3 0 3
+[ 0 0 1 ] 4 0 4
+[ 0 0 1 ] 5 0 5
+[ 0 0 1 ] 6 0 6
+[ 0 1 0 ] 7 0 7
+[ 0 1 0 ] 8 0 8
+[ 0 1 0 ] 9 0 9
+[ 0 1 1 ] 10 0 10
+[ 0 1 1 ] 11 0 11
+[ 0 1 1 ] 12 0 12
+[ 0 2 0 ] 13 0 13
+[ 0 2 0 ] 14 0 14
+[ 0 2 0 ] 15 0 15
+[ 0 2 1 ] 16 0 16
+[ 0 2 1 ] 17 0 17
+[ 0 2 1 ] 18 0 18
+[ 1 0 0 ] 19 0 19
+[ 1 0 0 ] 20 0 20
+[ 1 0 0 ] 21 0 21
+[ 1 0 1 ] 22 0 22
+[ 1 0 1 ] 23 0 23
+[ 1 0 1 ] 24 0 24
+[ 1 1 0 ] 25 0 25
+[ 1 1 0 ] 26 0 26
+[ 1 1 0 ] 27 0 27
+[ 1 1 1 ] 28 0 28
+[ 1 1 1 ] 29 0 29
+[ 1 1 1 ] 30 0 30
+[ 1 2 0 ] 31 0 31
+[ 1 2 0 ] 32 0 32
+[ 1 2 0 ] 33 0 33
+[ 1 2 1 ] 34 0 34
+[ 1 2 1 ] 35 0 35
+[ 1 2 1 ] 36 0 36
+[ 2 0 0 ] 37 0 37
+[ 2 0 0 ] 38 0 38
+[ 2 0 0 ] 39 0 39
+[ 2 0 1 ] 40 0 40
+[ 2 0 1 ] 41 0 41
+[ 2 0 1 ] 42 0 42
+[ 2 1 0 ] 43 0 43
+[ 2 1 0 ] 44 0 44
+[ 2 1 0 ] 45 0 45
+[ 2 1 1 ] 46 0 46
+[ 2 1 1 ] 47 0 47
+[ 2 1 1 ] 48 0 48
+[ 2 2 0 ] 49 0 49
+[ 2 2 0 ] 50 0 50
+[ 2 2 0 ] 51 0 51
+[ 2 2 1 ] 52 0 52
+[ 2 2 1 ] 53 0 53
+[ 2 2 1 ] 54 0 54
+[ 3 0 0 ] 55 0 55
+[ 3 0 0 ] 56 0 56
+[ 3 0 0 ] 57 0 57
+[ 3 0 1 ] 58 0 58
+[ 3 0 1 ] 59 0 59
+[ 3 0 1 ] 60 0 60
+[ 3 1 0 ] 61 0 61
+[ 3 1 0 ] 62 0 62
+[ 3 1 0 ] 63 0 63
+[ 3 1 1 ] 64 0 64
+[ 3 1 1 ] 65 0 65
+[ 3 1 1 ] 66 0 66
+[ 3 2 0 ] 67 0 67
+[ 3 2 0 ] 68 0 68
+[ 3 2 0 ] 69 0 69
+[ 3 2 1 ] 70 0 70
+[ 3 2 1 ] 71 0 71
+[ 3 2 1 ] 72 0 72
+72 differences found
+attribute: <bitfield of </dset>> and <bitfield of </dset>>
+size: [2] [2]
+position bitfield of </dset> bitfield of </dset> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+2 differences found
+attribute: <bitfield2D of </dset>> and <bitfield2D of </dset>>
+size: [3x2] [3x2]
+position bitfield2D of </dset> bitfield2D of </dset> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 2 0 ] 5 0 5
+[ 2 1 ] 6 0 6
+6 differences found
+attribute: <bitfield3D of </dset>> and <bitfield3D of </dset>>
+size: [4x3x2] [4x3x2]
+position bitfield3D of </dset> bitfield3D of </dset> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 1 ] 2 0 2
+[ 0 1 0 ] 3 0 3
+[ 0 1 1 ] 4 0 4
+[ 0 2 0 ] 5 0 5
+[ 0 2 1 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 1 0 ] 9 0 9
+[ 1 1 1 ] 10 0 10
+[ 1 2 0 ] 11 0 11
+[ 1 2 1 ] 12 0 12
+[ 2 0 0 ] 13 0 13
+[ 2 0 1 ] 14 0 14
+[ 2 1 0 ] 15 0 15
+[ 2 1 1 ] 16 0 16
+[ 2 2 0 ] 17 0 17
+[ 2 2 1 ] 18 0 18
+[ 3 0 0 ] 19 0 19
+[ 3 0 1 ] 20 0 20
+[ 3 1 0 ] 21 0 21
+[ 3 1 1 ] 22 0 22
+[ 3 2 0 ] 23 0 23
+[ 3 2 1 ] 24 0 24
+24 differences found
+attribute: <compound of </dset>> and <compound of </dset>>
+size: [2] [2]
+position compound of </dset> compound of </dset> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 0 ] 2 0 2
+[ 1 ] 3 0 3
+[ 1 ] 4 0 4
+4 differences found
+attribute: <compound2D of </dset>> and <compound2D of </dset>>
+size: [3x2] [3x2]
+position compound2D of </dset> compound2D of </dset> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 0 ] 2 0 2
+[ 0 1 ] 3 0 3
+[ 0 1 ] 4 0 4
+[ 1 0 ] 5 0 5
+[ 1 0 ] 6 0 6
+[ 1 1 ] 7 0 7
+[ 1 1 ] 8 0 8
+[ 2 0 ] 9 0 9
+[ 2 0 ] 10 0 10
+[ 2 1 ] 11 0 11
+[ 2 1 ] 12 0 12
+12 differences found
+attribute: <compound3D of </dset>> and <compound3D of </dset>>
+size: [4x3x2] [4x3x2]
+position compound3D of </dset> compound3D of </dset> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 0 ] 2 0 2
+[ 0 0 1 ] 3 0 3
+[ 0 0 1 ] 4 0 4
+[ 0 1 0 ] 5 0 5
+[ 0 1 0 ] 6 0 6
+[ 0 1 1 ] 7 0 7
+[ 0 1 1 ] 8 0 8
+[ 0 2 0 ] 9 0 9
+[ 0 2 0 ] 10 0 10
+[ 0 2 1 ] 11 0 11
+[ 0 2 1 ] 12 0 12
+[ 1 0 0 ] 13 0 13
+[ 1 0 0 ] 14 0 14
+[ 1 0 1 ] 15 0 15
+[ 1 0 1 ] 16 0 16
+[ 1 1 0 ] 17 0 17
+[ 1 1 0 ] 18 0 18
+[ 1 1 1 ] 19 0 19
+[ 1 1 1 ] 20 0 20
+[ 1 2 0 ] 21 0 21
+[ 1 2 0 ] 22 0 22
+[ 1 2 1 ] 23 0 23
+[ 1 2 1 ] 24 0 24
+[ 2 0 0 ] 25 0 25
+[ 2 0 0 ] 26 0 26
+[ 2 0 1 ] 27 0 27
+[ 2 0 1 ] 28 0 28
+[ 2 1 0 ] 29 0 29
+[ 2 1 0 ] 30 0 30
+[ 2 1 1 ] 31 0 31
+[ 2 1 1 ] 32 0 32
+[ 2 2 0 ] 33 0 33
+[ 2 2 0 ] 34 0 34
+[ 2 2 1 ] 35 0 35
+[ 2 2 1 ] 36 0 36
+[ 3 0 0 ] 37 0 37
+[ 3 0 0 ] 38 0 38
+[ 3 0 1 ] 39 0 39
+[ 3 0 1 ] 40 0 40
+[ 3 1 0 ] 41 0 41
+[ 3 1 0 ] 42 0 42
+[ 3 1 1 ] 43 0 43
+[ 3 1 1 ] 44 0 44
+[ 3 2 0 ] 45 0 45
+[ 3 2 0 ] 46 0 46
+[ 3 2 1 ] 47 0 47
+[ 3 2 1 ] 48 0 48
+48 differences found
+attribute: <enum of </dset>> and <enum of </dset>>
+size: [2] [2]
+position enum of </dset> enum of </dset> difference
+------------------------------------------------------------
+[ 0 ] RED GREEN
+[ 1 ] RED GREEN
+2 differences found
+attribute: <enum2D of </dset>> and <enum2D of </dset>>
+size: [3x2] [3x2]
+position enum2D of </dset> enum2D of </dset> difference
+------------------------------------------------------------
+[ 0 0 ] RED GREEN
+[ 0 1 ] RED GREEN
+[ 1 0 ] RED GREEN
+[ 1 1 ] RED GREEN
+[ 2 0 ] RED GREEN
+[ 2 1 ] RED GREEN
+6 differences found
+attribute: <enum3D of </dset>> and <enum3D of </dset>>
+size: [4x3x2] [4x3x2]
+position enum3D of </dset> enum3D of </dset> difference
+------------------------------------------------------------
+[ 0 0 0 ] GREEN RED
+[ 0 0 1 ] GREEN RED
+[ 0 1 0 ] GREEN RED
+[ 0 1 1 ] GREEN RED
+[ 0 2 0 ] GREEN RED
+[ 0 2 1 ] GREEN RED
+[ 1 0 0 ] GREEN RED
+[ 1 0 1 ] GREEN RED
+[ 1 1 0 ] GREEN RED
+[ 1 1 1 ] GREEN RED
+[ 1 2 0 ] GREEN RED
+[ 1 2 1 ] GREEN RED
+[ 2 0 0 ] GREEN RED
+[ 2 0 1 ] GREEN RED
+[ 2 1 0 ] GREEN RED
+[ 2 1 1 ] GREEN RED
+[ 2 2 0 ] GREEN RED
+[ 2 2 1 ] GREEN RED
+[ 3 0 0 ] GREEN RED
+[ 3 0 1 ] GREEN RED
+[ 3 1 0 ] GREEN RED
+[ 3 1 1 ] GREEN RED
+[ 3 2 0 ] GREEN RED
+[ 3 2 1 ] GREEN RED
+24 differences found
+attribute: <float of </dset>> and <float of </dset>>
+size: [2] [2]
+position float of </dset> float of </dset> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+2 differences found
+attribute: <float2D of </dset>> and <float2D of </dset>>
+size: [3x2] [3x2]
+position float2D of </dset> float2D of </dset> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 2 0 ] 5 0 5
+[ 2 1 ] 6 0 6
+6 differences found
+attribute: <float3D of </dset>> and <float3D of </dset>>
+size: [4x3x2] [4x3x2]
+position float3D of </dset> float3D of </dset> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 1 ] 2 0 2
+[ 0 1 0 ] 3 0 3
+[ 0 1 1 ] 4 0 4
+[ 0 2 0 ] 5 0 5
+[ 0 2 1 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 1 0 ] 9 0 9
+[ 1 1 1 ] 10 0 10
+[ 1 2 0 ] 11 0 11
+[ 1 2 1 ] 12 0 12
+[ 2 0 0 ] 13 0 13
+[ 2 0 1 ] 14 0 14
+[ 2 1 0 ] 15 0 15
+[ 2 1 1 ] 16 0 16
+[ 2 2 0 ] 17 0 17
+[ 2 2 1 ] 18 0 18
+[ 3 0 0 ] 19 0 19
+[ 3 0 1 ] 20 0 20
+[ 3 1 0 ] 21 0 21
+[ 3 1 1 ] 22 0 22
+[ 3 2 0 ] 23 0 23
+[ 3 2 1 ] 24 0 24
+24 differences found
+attribute: <integer of </dset>> and <integer of </dset>>
+size: [2] [2]
+position integer of </dset> integer of </dset> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+2 differences found
+attribute: <integer2D of </dset>> and <integer2D of </dset>>
+size: [3x2] [3x2]
+position integer2D of </dset> integer2D of </dset> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 2 0 ] 5 0 5
+[ 2 1 ] 6 0 6
+6 differences found
+attribute: <integer3D of </dset>> and <integer3D of </dset>>
+size: [4x3x2] [4x3x2]
+position integer3D of </dset> integer3D of </dset> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 1 ] 2 0 2
+[ 0 1 0 ] 3 0 3
+[ 0 1 1 ] 4 0 4
+[ 0 2 0 ] 5 0 5
+[ 0 2 1 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 1 0 ] 9 0 9
+[ 1 1 1 ] 10 0 10
+[ 1 2 0 ] 11 0 11
+[ 1 2 1 ] 12 0 12
+[ 2 0 0 ] 13 0 13
+[ 2 0 1 ] 14 0 14
+[ 2 1 0 ] 15 0 15
+[ 2 1 1 ] 16 0 16
+[ 2 2 0 ] 17 0 17
+[ 2 2 1 ] 18 0 18
+[ 3 0 0 ] 19 0 19
+[ 3 0 1 ] 20 0 20
+[ 3 1 0 ] 21 0 21
+[ 3 1 1 ] 22 0 22
+[ 3 2 0 ] 23 0 23
+[ 3 2 1 ] 24 0 24
+24 differences found
+attribute: <opaque of </dset>> and <opaque of </dset>>
+size: [2] [2]
+position opaque of </dset> opaque of </dset> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+2 differences found
+attribute: <opaque2D of </dset>> and <opaque2D of </dset>>
+size: [3x2] [3x2]
+position opaque2D of </dset> opaque2D of </dset> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 2 0 ] 5 0 5
+[ 2 1 ] 6 0 6
+6 differences found
+attribute: <opaque3D of </dset>> and <opaque3D of </dset>>
+size: [4x3x2] [4x3x2]
+position opaque3D of </dset> opaque3D of </dset> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 1 ] 2 0 2
+[ 0 1 0 ] 3 0 3
+[ 0 1 1 ] 4 0 4
+[ 0 2 0 ] 5 0 5
+[ 0 2 1 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 1 0 ] 9 0 9
+[ 1 1 1 ] 10 0 10
+[ 1 2 0 ] 11 0 11
+[ 1 2 1 ] 12 0 12
+[ 2 0 0 ] 13 0 13
+[ 2 0 1 ] 14 0 14
+[ 2 1 0 ] 15 0 15
+[ 2 1 1 ] 16 0 16
+[ 2 2 0 ] 17 0 17
+[ 2 2 1 ] 18 0 18
+[ 3 0 0 ] 19 0 19
+[ 3 0 1 ] 20 0 20
+[ 3 1 0 ] 21 0 21
+[ 3 1 1 ] 22 0 22
+[ 3 2 0 ] 23 0 23
+[ 3 2 1 ] 24 0 24
+24 differences found
+attribute: <reference of </dset>> and <reference of </dset>>
+0 differences found
+attribute: <reference2D of </dset>> and <reference2D of </dset>>
+0 differences found
+attribute: <reference3D of </dset>> and <reference3D of </dset>>
+0 differences found
+attribute: <string of </dset>> and <string of </dset>>
+size: [2] [2]
+position string of </dset> string of </dset> difference
+------------------------------------------------------------
+[ 0 ] a z
+[ 0 ] b z
+[ 1 ] d z
+[ 1 ] e z
+4 differences found
+attribute: <string2D of </dset>> and <string2D of </dset>>
+size: [3x2] [3x2]
+position string2D of </dset> string2D of </dset> difference
+------------------------------------------------------------
+[ 0 0 ] a z
+[ 0 0 ] b z
+[ 0 1 ] c z
+[ 0 1 ] d z
+[ 1 0 ] e z
+[ 1 0 ] f z
+[ 1 1 ] g z
+[ 1 1 ] h z
+[ 2 0 ] i z
+[ 2 0 ] j z
+[ 2 1 ] k z
+[ 2 1 ] l z
+12 differences found
+attribute: <string3D of </dset>> and <string3D of </dset>>
+size: [4x3x2] [4x3x2]
+position string3D of </dset> string3D of </dset> difference
+------------------------------------------------------------
+[ 0 0 0 ] a z
+[ 0 0 0 ] b z
+[ 0 0 1 ] c z
+[ 0 0 1 ] d z
+[ 0 1 0 ] e z
+[ 0 1 0 ] f z
+[ 0 1 1 ] g z
+[ 0 1 1 ] h z
+[ 0 2 0 ] i z
+[ 0 2 0 ] j z
+[ 0 2 1 ] k z
+[ 0 2 1 ] l z
+[ 1 0 0 ] m z
+[ 1 0 0 ] n z
+[ 1 0 1 ] p z
+[ 1 0 1 ] q z
+[ 1 1 0 ] r z
+[ 1 1 0 ] s z
+[ 1 1 1 ] t z
+[ 1 1 1 ] u z
+[ 1 2 0 ] v z
+[ 1 2 0 ] w z
+[ 1 2 1 ] x z
+[ 2 0 0 ] A z
+[ 2 0 0 ] B z
+[ 2 0 1 ] C z
+[ 2 0 1 ] D z
+[ 2 1 0 ] E z
+[ 2 1 0 ] F z
+[ 2 1 1 ] G z
+[ 2 1 1 ] H z
+[ 2 2 0 ] I z
+[ 2 2 0 ] J z
+[ 2 2 1 ] K z
+[ 2 2 1 ] L z
+[ 3 0 0 ] M z
+[ 3 0 0 ] N z
+[ 3 0 1 ] P z
+[ 3 0 1 ] Q z
+[ 3 1 0 ] R z
+[ 3 1 0 ] S z
+[ 3 1 1 ] T z
+[ 3 1 1 ] U z
+[ 3 2 0 ] V z
+[ 3 2 0 ] W z
+[ 3 2 1 ] X z
+[ 3 2 1 ] Z z
+47 differences found
+attribute: <vlen of </dset>> and <vlen of </dset>>
+size: [2] [2]
+position vlen of </dset> vlen of </dset> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+[ 1 ] 3 0 3
+3 differences found
+attribute: <vlen2D of </dset>> and <vlen2D of </dset>>
+size: [3x2] [3x2]
+position vlen2D of </dset> vlen2D of </dset> difference
+------------------------------------------------------------
+[ 0 1 ] 1 0 1
+[ 1 0 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 1 1 ] 5 0 5
+[ 2 0 ] 6 0 6
+[ 2 0 ] 7 0 7
+[ 2 0 ] 8 0 8
+[ 2 1 ] 9 0 9
+[ 2 1 ] 10 0 10
+[ 2 1 ] 11 0 11
+11 differences found
+attribute: <vlen3D of </dset>> and <vlen3D of </dset>>
+size: [4x3x2] [4x3x2]
+position vlen3D of </dset> vlen3D of </dset> difference
+------------------------------------------------------------
+[ 0 0 1 ] 1 0 1
+[ 0 1 0 ] 2 0 2
+[ 0 1 1 ] 3 0 3
+[ 0 2 0 ] 4 0 4
+[ 0 2 1 ] 5 0 5
+[ 1 0 0 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 0 1 ] 9 0 9
+[ 1 1 0 ] 10 0 10
+[ 1 1 0 ] 11 0 11
+[ 1 1 1 ] 12 0 12
+[ 1 1 1 ] 13 0 13
+[ 1 2 0 ] 14 0 14
+[ 1 2 0 ] 15 0 15
+[ 1 2 1 ] 16 0 16
+[ 1 2 1 ] 17 0 17
+[ 2 0 0 ] 18 0 18
+[ 2 0 0 ] 19 0 19
+[ 2 0 0 ] 20 0 20
+[ 2 0 1 ] 21 0 21
+[ 2 0 1 ] 22 0 22
+[ 2 0 1 ] 23 0 23
+[ 2 1 0 ] 24 0 24
+[ 2 1 0 ] 25 0 25
+[ 2 1 0 ] 26 0 26
+[ 2 1 1 ] 27 0 27
+[ 2 1 1 ] 28 0 28
+[ 2 1 1 ] 29 0 29
+[ 2 2 0 ] 30 0 30
+[ 2 2 0 ] 31 0 31
+[ 2 2 0 ] 32 0 32
+[ 2 2 1 ] 33 0 33
+[ 2 2 1 ] 34 0 34
+[ 2 2 1 ] 35 0 35
+[ 3 0 0 ] 36 0 36
+[ 3 0 0 ] 37 0 37
+[ 3 0 0 ] 38 0 38
+[ 3 0 0 ] 39 0 39
+[ 3 0 1 ] 40 0 40
+[ 3 0 1 ] 41 0 41
+[ 3 0 1 ] 42 0 42
+[ 3 0 1 ] 43 0 43
+[ 3 1 0 ] 44 0 44
+[ 3 1 0 ] 45 0 45
+[ 3 1 0 ] 46 0 46
+[ 3 1 0 ] 47 0 47
+[ 3 1 1 ] 48 0 48
+[ 3 1 1 ] 49 0 49
+[ 3 1 1 ] 50 0 50
+[ 3 1 1 ] 51 0 51
+[ 3 2 0 ] 52 0 52
+[ 3 2 0 ] 53 0 53
+[ 3 2 0 ] 54 0 54
+[ 3 2 0 ] 55 0 55
+[ 3 2 1 ] 56 0 56
+[ 3 2 1 ] 57 0 57
+[ 3 2 1 ] 58 0 58
+[ 3 2 1 ] 59 0 59
+59 differences found
+group : </g1> and </g1>
+0 differences found
+attribute: <VLstring of </g1>> and <VLstring of </g1>>
+size: [2] [2]
+position VLstring of </g1> VLstring of </g1> difference
+------------------------------------------------------------
+[ 0 ] a z
+[ 0 ] b z
+[ 1 ] d z
+[ 1 ] e z
+4 differences found
+attribute: <VLstring2D of </g1>> and <VLstring2D of </g1>>
+size: [3x2] [3x2]
+position VLstring2D of </g1> VLstring2D of </g1> difference
+------------------------------------------------------------
+[ 0 0 ] a z
+[ 0 0 ] b z
+[ 0 1 ] c z
+[ 0 1 ] d z
+[ 1 0 ] e z
+[ 1 0 ] f z
+[ 1 1 ] g z
+[ 1 1 ] h z
+[ 2 0 ] i z
+[ 2 0 ] j z
+[ 2 1 ] k z
+[ 2 1 ] l z
+12 differences found
+attribute: <VLstring3D of </g1>> and <VLstring3D of </g1>>
+size: [4x3x2] [4x3x2]
+position VLstring3D of </g1> VLstring3D of </g1> difference
+------------------------------------------------------------
+[ 0 0 0 ] a z
+[ 0 0 0 ] b z
+[ 0 0 1 ] c z
+[ 0 0 1 ] d z
+[ 0 1 0 ] e z
+[ 0 1 0 ] f z
+[ 0 1 1 ] g z
+[ 0 1 1 ] h z
+[ 0 2 0 ] i z
+[ 0 2 0 ] j z
+[ 0 2 1 ] k z
+[ 0 2 1 ] l z
+[ 1 0 0 ] m z
+[ 1 0 0 ] n z
+[ 1 0 1 ] p z
+[ 1 0 1 ] q z
+[ 1 1 0 ] r z
+[ 1 1 0 ] s z
+[ 1 1 1 ] t z
+[ 1 1 1 ] u z
+[ 1 2 0 ] v z
+[ 1 2 0 ] w z
+[ 1 2 1 ] x z
+[ 2 0 0 ] A z
+[ 2 0 0 ] B z
+[ 2 0 1 ] C z
+[ 2 0 1 ] D z
+[ 2 1 0 ] E z
+[ 2 1 0 ] F z
+[ 2 1 1 ] G z
+[ 2 1 1 ] H z
+[ 2 2 0 ] I z
+[ 2 2 0 ] J z
+[ 2 2 1 ] K z
+[ 2 2 1 ] L z
+[ 3 0 0 ] M z
+[ 3 0 0 ] N z
+[ 3 0 1 ] P z
+[ 3 0 1 ] Q z
+[ 3 1 0 ] R z
+[ 3 1 0 ] S z
+[ 3 1 1 ] T z
+[ 3 1 1 ] U z
+[ 3 2 0 ] V z
+[ 3 2 0 ] W z
+[ 3 2 1 ] X z
+[ 3 2 1 ] Z z
+47 differences found
+attribute: <array of </g1>> and <array of </g1>>
+size: [2] [2]
+position array of </g1> array of </g1> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 0 ] 2 0 2
+[ 0 ] 3 0 3
+[ 1 ] 4 0 4
+[ 1 ] 5 0 5
+[ 1 ] 6 0 6
+6 differences found
+attribute: <array2D of </g1>> and <array2D of </g1>>
+size: [3x2] [3x2]
+position array2D of </g1> array2D of </g1> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 0 ] 2 0 2
+[ 0 0 ] 3 0 3
+[ 0 1 ] 4 0 4
+[ 0 1 ] 5 0 5
+[ 0 1 ] 6 0 6
+[ 1 0 ] 7 0 7
+[ 1 0 ] 8 0 8
+[ 1 0 ] 9 0 9
+[ 1 1 ] 10 0 10
+[ 1 1 ] 11 0 11
+[ 1 1 ] 12 0 12
+[ 2 0 ] 13 0 13
+[ 2 0 ] 14 0 14
+[ 2 0 ] 15 0 15
+[ 2 1 ] 16 0 16
+[ 2 1 ] 17 0 17
+[ 2 1 ] 18 0 18
+18 differences found
+attribute: <array3D of </g1>> and <array3D of </g1>>
+size: [4x3x2] [4x3x2]
+position array3D of </g1> array3D of </g1> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 0 ] 2 0 2
+[ 0 0 0 ] 3 0 3
+[ 0 0 1 ] 4 0 4
+[ 0 0 1 ] 5 0 5
+[ 0 0 1 ] 6 0 6
+[ 0 1 0 ] 7 0 7
+[ 0 1 0 ] 8 0 8
+[ 0 1 0 ] 9 0 9
+[ 0 1 1 ] 10 0 10
+[ 0 1 1 ] 11 0 11
+[ 0 1 1 ] 12 0 12
+[ 0 2 0 ] 13 0 13
+[ 0 2 0 ] 14 0 14
+[ 0 2 0 ] 15 0 15
+[ 0 2 1 ] 16 0 16
+[ 0 2 1 ] 17 0 17
+[ 0 2 1 ] 18 0 18
+[ 1 0 0 ] 19 0 19
+[ 1 0 0 ] 20 0 20
+[ 1 0 0 ] 21 0 21
+[ 1 0 1 ] 22 0 22
+[ 1 0 1 ] 23 0 23
+[ 1 0 1 ] 24 0 24
+[ 1 1 0 ] 25 0 25
+[ 1 1 0 ] 26 0 26
+[ 1 1 0 ] 27 0 27
+[ 1 1 1 ] 28 0 28
+[ 1 1 1 ] 29 0 29
+[ 1 1 1 ] 30 0 30
+[ 1 2 0 ] 31 0 31
+[ 1 2 0 ] 32 0 32
+[ 1 2 0 ] 33 0 33
+[ 1 2 1 ] 34 0 34
+[ 1 2 1 ] 35 0 35
+[ 1 2 1 ] 36 0 36
+[ 2 0 0 ] 37 0 37
+[ 2 0 0 ] 38 0 38
+[ 2 0 0 ] 39 0 39
+[ 2 0 1 ] 40 0 40
+[ 2 0 1 ] 41 0 41
+[ 2 0 1 ] 42 0 42
+[ 2 1 0 ] 43 0 43
+[ 2 1 0 ] 44 0 44
+[ 2 1 0 ] 45 0 45
+[ 2 1 1 ] 46 0 46
+[ 2 1 1 ] 47 0 47
+[ 2 1 1 ] 48 0 48
+[ 2 2 0 ] 49 0 49
+[ 2 2 0 ] 50 0 50
+[ 2 2 0 ] 51 0 51
+[ 2 2 1 ] 52 0 52
+[ 2 2 1 ] 53 0 53
+[ 2 2 1 ] 54 0 54
+[ 3 0 0 ] 55 0 55
+[ 3 0 0 ] 56 0 56
+[ 3 0 0 ] 57 0 57
+[ 3 0 1 ] 58 0 58
+[ 3 0 1 ] 59 0 59
+[ 3 0 1 ] 60 0 60
+[ 3 1 0 ] 61 0 61
+[ 3 1 0 ] 62 0 62
+[ 3 1 0 ] 63 0 63
+[ 3 1 1 ] 64 0 64
+[ 3 1 1 ] 65 0 65
+[ 3 1 1 ] 66 0 66
+[ 3 2 0 ] 67 0 67
+[ 3 2 0 ] 68 0 68
+[ 3 2 0 ] 69 0 69
+[ 3 2 1 ] 70 0 70
+[ 3 2 1 ] 71 0 71
+[ 3 2 1 ] 72 0 72
+72 differences found
+attribute: <bitfield of </g1>> and <bitfield of </g1>>
+size: [2] [2]
+position bitfield of </g1> bitfield of </g1> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+2 differences found
+attribute: <bitfield2D of </g1>> and <bitfield2D of </g1>>
+size: [3x2] [3x2]
+position bitfield2D of </g1> bitfield2D of </g1> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 2 0 ] 5 0 5
+[ 2 1 ] 6 0 6
+6 differences found
+attribute: <bitfield3D of </g1>> and <bitfield3D of </g1>>
+size: [4x3x2] [4x3x2]
+position bitfield3D of </g1> bitfield3D of </g1> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 1 ] 2 0 2
+[ 0 1 0 ] 3 0 3
+[ 0 1 1 ] 4 0 4
+[ 0 2 0 ] 5 0 5
+[ 0 2 1 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 1 0 ] 9 0 9
+[ 1 1 1 ] 10 0 10
+[ 1 2 0 ] 11 0 11
+[ 1 2 1 ] 12 0 12
+[ 2 0 0 ] 13 0 13
+[ 2 0 1 ] 14 0 14
+[ 2 1 0 ] 15 0 15
+[ 2 1 1 ] 16 0 16
+[ 2 2 0 ] 17 0 17
+[ 2 2 1 ] 18 0 18
+[ 3 0 0 ] 19 0 19
+[ 3 0 1 ] 20 0 20
+[ 3 1 0 ] 21 0 21
+[ 3 1 1 ] 22 0 22
+[ 3 2 0 ] 23 0 23
+[ 3 2 1 ] 24 0 24
+24 differences found
+attribute: <compound of </g1>> and <compound of </g1>>
+size: [2] [2]
+position compound of </g1> compound of </g1> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 0 ] 2 0 2
+[ 1 ] 3 0 3
+[ 1 ] 4 0 4
+4 differences found
+attribute: <compound2D of </g1>> and <compound2D of </g1>>
+size: [3x2] [3x2]
+position compound2D of </g1> compound2D of </g1> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 0 ] 2 0 2
+[ 0 1 ] 3 0 3
+[ 0 1 ] 4 0 4
+[ 1 0 ] 5 0 5
+[ 1 0 ] 6 0 6
+[ 1 1 ] 7 0 7
+[ 1 1 ] 8 0 8
+[ 2 0 ] 9 0 9
+[ 2 0 ] 10 0 10
+[ 2 1 ] 11 0 11
+[ 2 1 ] 12 0 12
+12 differences found
+attribute: <compound3D of </g1>> and <compound3D of </g1>>
+size: [4x3x2] [4x3x2]
+position compound3D of </g1> compound3D of </g1> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 0 ] 2 0 2
+[ 0 0 1 ] 3 0 3
+[ 0 0 1 ] 4 0 4
+[ 0 1 0 ] 5 0 5
+[ 0 1 0 ] 6 0 6
+[ 0 1 1 ] 7 0 7
+[ 0 1 1 ] 8 0 8
+[ 0 2 0 ] 9 0 9
+[ 0 2 0 ] 10 0 10
+[ 0 2 1 ] 11 0 11
+[ 0 2 1 ] 12 0 12
+[ 1 0 0 ] 13 0 13
+[ 1 0 0 ] 14 0 14
+[ 1 0 1 ] 15 0 15
+[ 1 0 1 ] 16 0 16
+[ 1 1 0 ] 17 0 17
+[ 1 1 0 ] 18 0 18
+[ 1 1 1 ] 19 0 19
+[ 1 1 1 ] 20 0 20
+[ 1 2 0 ] 21 0 21
+[ 1 2 0 ] 22 0 22
+[ 1 2 1 ] 23 0 23
+[ 1 2 1 ] 24 0 24
+[ 2 0 0 ] 25 0 25
+[ 2 0 0 ] 26 0 26
+[ 2 0 1 ] 27 0 27
+[ 2 0 1 ] 28 0 28
+[ 2 1 0 ] 29 0 29
+[ 2 1 0 ] 30 0 30
+[ 2 1 1 ] 31 0 31
+[ 2 1 1 ] 32 0 32
+[ 2 2 0 ] 33 0 33
+[ 2 2 0 ] 34 0 34
+[ 2 2 1 ] 35 0 35
+[ 2 2 1 ] 36 0 36
+[ 3 0 0 ] 37 0 37
+[ 3 0 0 ] 38 0 38
+[ 3 0 1 ] 39 0 39
+[ 3 0 1 ] 40 0 40
+[ 3 1 0 ] 41 0 41
+[ 3 1 0 ] 42 0 42
+[ 3 1 1 ] 43 0 43
+[ 3 1 1 ] 44 0 44
+[ 3 2 0 ] 45 0 45
+[ 3 2 0 ] 46 0 46
+[ 3 2 1 ] 47 0 47
+[ 3 2 1 ] 48 0 48
+48 differences found
+attribute: <enum of </g1>> and <enum of </g1>>
+size: [2] [2]
+position enum of </g1> enum of </g1> difference
+------------------------------------------------------------
+[ 0 ] RED GREEN
+[ 1 ] RED GREEN
+2 differences found
+attribute: <enum2D of </g1>> and <enum2D of </g1>>
+size: [3x2] [3x2]
+position enum2D of </g1> enum2D of </g1> difference
+------------------------------------------------------------
+[ 0 0 ] RED GREEN
+[ 0 1 ] RED GREEN
+[ 1 0 ] RED GREEN
+[ 1 1 ] RED GREEN
+[ 2 0 ] RED GREEN
+[ 2 1 ] RED GREEN
+6 differences found
+attribute: <enum3D of </g1>> and <enum3D of </g1>>
+size: [4x3x2] [4x3x2]
+position enum3D of </g1> enum3D of </g1> difference
+------------------------------------------------------------
+[ 0 0 0 ] GREEN RED
+[ 0 0 1 ] GREEN RED
+[ 0 1 0 ] GREEN RED
+[ 0 1 1 ] GREEN RED
+[ 0 2 0 ] GREEN RED
+[ 0 2 1 ] GREEN RED
+[ 1 0 0 ] GREEN RED
+[ 1 0 1 ] GREEN RED
+[ 1 1 0 ] GREEN RED
+[ 1 1 1 ] GREEN RED
+[ 1 2 0 ] GREEN RED
+[ 1 2 1 ] GREEN RED
+[ 2 0 0 ] GREEN RED
+[ 2 0 1 ] GREEN RED
+[ 2 1 0 ] GREEN RED
+[ 2 1 1 ] GREEN RED
+[ 2 2 0 ] GREEN RED
+[ 2 2 1 ] GREEN RED
+[ 3 0 0 ] GREEN RED
+[ 3 0 1 ] GREEN RED
+[ 3 1 0 ] GREEN RED
+[ 3 1 1 ] GREEN RED
+[ 3 2 0 ] GREEN RED
+[ 3 2 1 ] GREEN RED
+24 differences found
+attribute: <float of </g1>> and <float of </g1>>
+size: [2] [2]
+position float of </g1> float of </g1> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+2 differences found
+attribute: <float2D of </g1>> and <float2D of </g1>>
+size: [3x2] [3x2]
+position float2D of </g1> float2D of </g1> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 2 0 ] 5 0 5
+[ 2 1 ] 6 0 6
+6 differences found
+attribute: <float3D of </g1>> and <float3D of </g1>>
+size: [4x3x2] [4x3x2]
+position float3D of </g1> float3D of </g1> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 1 ] 2 0 2
+[ 0 1 0 ] 3 0 3
+[ 0 1 1 ] 4 0 4
+[ 0 2 0 ] 5 0 5
+[ 0 2 1 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 1 0 ] 9 0 9
+[ 1 1 1 ] 10 0 10
+[ 1 2 0 ] 11 0 11
+[ 1 2 1 ] 12 0 12
+[ 2 0 0 ] 13 0 13
+[ 2 0 1 ] 14 0 14
+[ 2 1 0 ] 15 0 15
+[ 2 1 1 ] 16 0 16
+[ 2 2 0 ] 17 0 17
+[ 2 2 1 ] 18 0 18
+[ 3 0 0 ] 19 0 19
+[ 3 0 1 ] 20 0 20
+[ 3 1 0 ] 21 0 21
+[ 3 1 1 ] 22 0 22
+[ 3 2 0 ] 23 0 23
+[ 3 2 1 ] 24 0 24
+24 differences found
+attribute: <integer of </g1>> and <integer of </g1>>
+size: [2] [2]
+position integer of </g1> integer of </g1> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+2 differences found
+attribute: <integer2D of </g1>> and <integer2D of </g1>>
+size: [3x2] [3x2]
+position integer2D of </g1> integer2D of </g1> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 2 0 ] 5 0 5
+[ 2 1 ] 6 0 6
+6 differences found
+attribute: <integer3D of </g1>> and <integer3D of </g1>>
+size: [4x3x2] [4x3x2]
+position integer3D of </g1> integer3D of </g1> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 1 ] 2 0 2
+[ 0 1 0 ] 3 0 3
+[ 0 1 1 ] 4 0 4
+[ 0 2 0 ] 5 0 5
+[ 0 2 1 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 1 0 ] 9 0 9
+[ 1 1 1 ] 10 0 10
+[ 1 2 0 ] 11 0 11
+[ 1 2 1 ] 12 0 12
+[ 2 0 0 ] 13 0 13
+[ 2 0 1 ] 14 0 14
+[ 2 1 0 ] 15 0 15
+[ 2 1 1 ] 16 0 16
+[ 2 2 0 ] 17 0 17
+[ 2 2 1 ] 18 0 18
+[ 3 0 0 ] 19 0 19
+[ 3 0 1 ] 20 0 20
+[ 3 1 0 ] 21 0 21
+[ 3 1 1 ] 22 0 22
+[ 3 2 0 ] 23 0 23
+[ 3 2 1 ] 24 0 24
+24 differences found
+attribute: <opaque of </g1>> and <opaque of </g1>>
+size: [2] [2]
+position opaque of </g1> opaque of </g1> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+2 differences found
+attribute: <opaque2D of </g1>> and <opaque2D of </g1>>
+size: [3x2] [3x2]
+position opaque2D of </g1> opaque2D of </g1> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 2 0 ] 5 0 5
+[ 2 1 ] 6 0 6
+6 differences found
+attribute: <opaque3D of </g1>> and <opaque3D of </g1>>
+size: [4x3x2] [4x3x2]
+position opaque3D of </g1> opaque3D of </g1> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 1 ] 2 0 2
+[ 0 1 0 ] 3 0 3
+[ 0 1 1 ] 4 0 4
+[ 0 2 0 ] 5 0 5
+[ 0 2 1 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 1 0 ] 9 0 9
+[ 1 1 1 ] 10 0 10
+[ 1 2 0 ] 11 0 11
+[ 1 2 1 ] 12 0 12
+[ 2 0 0 ] 13 0 13
+[ 2 0 1 ] 14 0 14
+[ 2 1 0 ] 15 0 15
+[ 2 1 1 ] 16 0 16
+[ 2 2 0 ] 17 0 17
+[ 2 2 1 ] 18 0 18
+[ 3 0 0 ] 19 0 19
+[ 3 0 1 ] 20 0 20
+[ 3 1 0 ] 21 0 21
+[ 3 1 1 ] 22 0 22
+[ 3 2 0 ] 23 0 23
+[ 3 2 1 ] 24 0 24
+24 differences found
+attribute: <string of </g1>> and <string of </g1>>
+size: [2] [2]
+position string of </g1> string of </g1> difference
+------------------------------------------------------------
+[ 0 ] a z
+[ 0 ] b z
+[ 1 ] d z
+[ 1 ] e z
+4 differences found
+attribute: <string2D of </g1>> and <string2D of </g1>>
+size: [3x2] [3x2]
+position string2D of </g1> string2D of </g1> difference
+------------------------------------------------------------
+[ 0 0 ] a z
+[ 0 0 ] b z
+[ 0 1 ] c z
+[ 0 1 ] d z
+[ 1 0 ] e z
+[ 1 0 ] f z
+[ 1 1 ] g z
+[ 1 1 ] h z
+[ 2 0 ] i z
+[ 2 0 ] j z
+[ 2 1 ] k z
+[ 2 1 ] l z
+12 differences found
+attribute: <string3D of </g1>> and <string3D of </g1>>
+size: [4x3x2] [4x3x2]
+position string3D of </g1> string3D of </g1> difference
+------------------------------------------------------------
+[ 0 0 0 ] a z
+[ 0 0 0 ] b z
+[ 0 0 1 ] c z
+[ 0 0 1 ] d z
+[ 0 1 0 ] e z
+[ 0 1 0 ] f z
+[ 0 1 1 ] g z
+[ 0 1 1 ] h z
+[ 0 2 0 ] i z
+[ 0 2 0 ] j z
+[ 0 2 1 ] k z
+[ 0 2 1 ] l z
+[ 1 0 0 ] m z
+[ 1 0 0 ] n z
+[ 1 0 1 ] p z
+[ 1 0 1 ] q z
+[ 1 1 0 ] r z
+[ 1 1 0 ] s z
+[ 1 1 1 ] t z
+[ 1 1 1 ] u z
+[ 1 2 0 ] v z
+[ 1 2 0 ] w z
+[ 1 2 1 ] x z
+[ 2 0 0 ] A z
+[ 2 0 0 ] B z
+[ 2 0 1 ] C z
+[ 2 0 1 ] D z
+[ 2 1 0 ] E z
+[ 2 1 0 ] F z
+[ 2 1 1 ] G z
+[ 2 1 1 ] H z
+[ 2 2 0 ] I z
+[ 2 2 0 ] J z
+[ 2 2 1 ] K z
+[ 2 2 1 ] L z
+[ 3 0 0 ] M z
+[ 3 0 0 ] N z
+[ 3 0 1 ] P z
+[ 3 0 1 ] Q z
+[ 3 1 0 ] R z
+[ 3 1 0 ] S z
+[ 3 1 1 ] T z
+[ 3 1 1 ] U z
+[ 3 2 0 ] V z
+[ 3 2 0 ] W z
+[ 3 2 1 ] X z
+[ 3 2 1 ] Z z
+47 differences found
+attribute: <vlen of </g1>> and <vlen of </g1>>
+size: [2] [2]
+position vlen of </g1> vlen of </g1> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+[ 1 ] 3 0 3
+3 differences found
+attribute: <vlen2D of </g1>> and <vlen2D of </g1>>
+size: [3x2] [3x2]
+position vlen2D of </g1> vlen2D of </g1> difference
+------------------------------------------------------------
+[ 0 1 ] 1 0 1
+[ 1 0 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 1 1 ] 5 0 5
+[ 2 0 ] 6 0 6
+[ 2 0 ] 7 0 7
+[ 2 0 ] 8 0 8
+[ 2 1 ] 9 0 9
+[ 2 1 ] 10 0 10
+[ 2 1 ] 11 0 11
+11 differences found
+attribute: <vlen3D of </g1>> and <vlen3D of </g1>>
+size: [4x3x2] [4x3x2]
+position vlen3D of </g1> vlen3D of </g1> difference
+------------------------------------------------------------
+[ 0 0 1 ] 1 0 1
+[ 0 1 0 ] 2 0 2
+[ 0 1 1 ] 3 0 3
+[ 0 2 0 ] 4 0 4
+[ 0 2 1 ] 5 0 5
+[ 1 0 0 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 0 1 ] 9 0 9
+[ 1 1 0 ] 10 0 10
+[ 1 1 0 ] 11 0 11
+[ 1 1 1 ] 12 0 12
+[ 1 1 1 ] 13 0 13
+[ 1 2 0 ] 14 0 14
+[ 1 2 0 ] 15 0 15
+[ 1 2 1 ] 16 0 16
+[ 1 2 1 ] 17 0 17
+[ 2 0 0 ] 18 0 18
+[ 2 0 0 ] 19 0 19
+[ 2 0 0 ] 20 0 20
+[ 2 0 1 ] 21 0 21
+[ 2 0 1 ] 22 0 22
+[ 2 0 1 ] 23 0 23
+[ 2 1 0 ] 24 0 24
+[ 2 1 0 ] 25 0 25
+[ 2 1 0 ] 26 0 26
+[ 2 1 1 ] 27 0 27
+[ 2 1 1 ] 28 0 28
+[ 2 1 1 ] 29 0 29
+[ 2 2 0 ] 30 0 30
+[ 2 2 0 ] 31 0 31
+[ 2 2 0 ] 32 0 32
+[ 2 2 1 ] 33 0 33
+[ 2 2 1 ] 34 0 34
+[ 2 2 1 ] 35 0 35
+[ 3 0 0 ] 36 0 36
+[ 3 0 0 ] 37 0 37
+[ 3 0 0 ] 38 0 38
+[ 3 0 0 ] 39 0 39
+[ 3 0 1 ] 40 0 40
+[ 3 0 1 ] 41 0 41
+[ 3 0 1 ] 42 0 42
+[ 3 0 1 ] 43 0 43
+[ 3 1 0 ] 44 0 44
+[ 3 1 0 ] 45 0 45
+[ 3 1 0 ] 46 0 46
+[ 3 1 0 ] 47 0 47
+[ 3 1 1 ] 48 0 48
+[ 3 1 1 ] 49 0 49
+[ 3 1 1 ] 50 0 50
+[ 3 1 1 ] 51 0 51
+[ 3 2 0 ] 52 0 52
+[ 3 2 0 ] 53 0 53
+[ 3 2 0 ] 54 0 54
+[ 3 2 0 ] 55 0 55
+[ 3 2 1 ] 56 0 56
+[ 3 2 1 ] 57 0 57
+[ 3 2 1 ] 58 0 58
+[ 3 2 1 ] 59 0 59
+59 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/test/h5diff/testfiles/h5diff_700.txt b/tools/test/h5diff/testfiles/h5diff_700.txt
new file mode 100644
index 0000000..1cf71dd
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_700.txt
@@ -0,0 +1,2038 @@
+
+file1 file2
+---------------------------------------
+ x x /
+ x x /dset
+ x x /g1
+
+
+group : </> and </>
+0 differences found
+Attributes status: 30 common, 0 only in obj1, 0 only in obj2
+attribute: <VLstring of </>> and <VLstring of </>>
+size: [2] [2]
+position VLstring of </> VLstring of </> difference
+------------------------------------------------------------
+[ 0 ] a z
+[ 0 ] b z
+[ 1 ] d z
+[ 1 ] e z
+4 differences found
+attribute: <VLstring2D of </>> and <VLstring2D of </>>
+size: [3x2] [3x2]
+position VLstring2D of </> VLstring2D of </> difference
+------------------------------------------------------------
+[ 0 0 ] a z
+[ 0 0 ] b z
+[ 0 1 ] c z
+[ 0 1 ] d z
+[ 1 0 ] e z
+[ 1 0 ] f z
+[ 1 1 ] g z
+[ 1 1 ] h z
+[ 2 0 ] i z
+[ 2 0 ] j z
+[ 2 1 ] k z
+[ 2 1 ] l z
+12 differences found
+attribute: <VLstring3D of </>> and <VLstring3D of </>>
+size: [4x3x2] [4x3x2]
+position VLstring3D of </> VLstring3D of </> difference
+------------------------------------------------------------
+[ 0 0 0 ] a z
+[ 0 0 0 ] b z
+[ 0 0 1 ] c z
+[ 0 0 1 ] d z
+[ 0 1 0 ] e z
+[ 0 1 0 ] f z
+[ 0 1 1 ] g z
+[ 0 1 1 ] h z
+[ 0 2 0 ] i z
+[ 0 2 0 ] j z
+[ 0 2 1 ] k z
+[ 0 2 1 ] l z
+[ 1 0 0 ] m z
+[ 1 0 0 ] n z
+[ 1 0 1 ] p z
+[ 1 0 1 ] q z
+[ 1 1 0 ] r z
+[ 1 1 0 ] s z
+[ 1 1 1 ] t z
+[ 1 1 1 ] u z
+[ 1 2 0 ] v z
+[ 1 2 0 ] w z
+[ 1 2 1 ] x z
+[ 2 0 0 ] A z
+[ 2 0 0 ] B z
+[ 2 0 1 ] C z
+[ 2 0 1 ] D z
+[ 2 1 0 ] E z
+[ 2 1 0 ] F z
+[ 2 1 1 ] G z
+[ 2 1 1 ] H z
+[ 2 2 0 ] I z
+[ 2 2 0 ] J z
+[ 2 2 1 ] K z
+[ 2 2 1 ] L z
+[ 3 0 0 ] M z
+[ 3 0 0 ] N z
+[ 3 0 1 ] P z
+[ 3 0 1 ] Q z
+[ 3 1 0 ] R z
+[ 3 1 0 ] S z
+[ 3 1 1 ] T z
+[ 3 1 1 ] U z
+[ 3 2 0 ] V z
+[ 3 2 0 ] W z
+[ 3 2 1 ] X z
+[ 3 2 1 ] Z z
+47 differences found
+attribute: <array of </>> and <array of </>>
+size: [2] [2]
+position array of </> array of </> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 0 ] 2 0 2
+[ 0 ] 3 0 3
+[ 1 ] 4 0 4
+[ 1 ] 5 0 5
+[ 1 ] 6 0 6
+6 differences found
+attribute: <array2D of </>> and <array2D of </>>
+size: [3x2] [3x2]
+position array2D of </> array2D of </> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 0 ] 2 0 2
+[ 0 0 ] 3 0 3
+[ 0 1 ] 4 0 4
+[ 0 1 ] 5 0 5
+[ 0 1 ] 6 0 6
+[ 1 0 ] 7 0 7
+[ 1 0 ] 8 0 8
+[ 1 0 ] 9 0 9
+[ 1 1 ] 10 0 10
+[ 1 1 ] 11 0 11
+[ 1 1 ] 12 0 12
+[ 2 0 ] 13 0 13
+[ 2 0 ] 14 0 14
+[ 2 0 ] 15 0 15
+[ 2 1 ] 16 0 16
+[ 2 1 ] 17 0 17
+[ 2 1 ] 18 0 18
+18 differences found
+attribute: <array3D of </>> and <array3D of </>>
+size: [4x3x2] [4x3x2]
+position array3D of </> array3D of </> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 0 ] 2 0 2
+[ 0 0 0 ] 3 0 3
+[ 0 0 1 ] 4 0 4
+[ 0 0 1 ] 5 0 5
+[ 0 0 1 ] 6 0 6
+[ 0 1 0 ] 7 0 7
+[ 0 1 0 ] 8 0 8
+[ 0 1 0 ] 9 0 9
+[ 0 1 1 ] 10 0 10
+[ 0 1 1 ] 11 0 11
+[ 0 1 1 ] 12 0 12
+[ 0 2 0 ] 13 0 13
+[ 0 2 0 ] 14 0 14
+[ 0 2 0 ] 15 0 15
+[ 0 2 1 ] 16 0 16
+[ 0 2 1 ] 17 0 17
+[ 0 2 1 ] 18 0 18
+[ 1 0 0 ] 19 0 19
+[ 1 0 0 ] 20 0 20
+[ 1 0 0 ] 21 0 21
+[ 1 0 1 ] 22 0 22
+[ 1 0 1 ] 23 0 23
+[ 1 0 1 ] 24 0 24
+[ 1 1 0 ] 25 0 25
+[ 1 1 0 ] 26 0 26
+[ 1 1 0 ] 27 0 27
+[ 1 1 1 ] 28 0 28
+[ 1 1 1 ] 29 0 29
+[ 1 1 1 ] 30 0 30
+[ 1 2 0 ] 31 0 31
+[ 1 2 0 ] 32 0 32
+[ 1 2 0 ] 33 0 33
+[ 1 2 1 ] 34 0 34
+[ 1 2 1 ] 35 0 35
+[ 1 2 1 ] 36 0 36
+[ 2 0 0 ] 37 0 37
+[ 2 0 0 ] 38 0 38
+[ 2 0 0 ] 39 0 39
+[ 2 0 1 ] 40 0 40
+[ 2 0 1 ] 41 0 41
+[ 2 0 1 ] 42 0 42
+[ 2 1 0 ] 43 0 43
+[ 2 1 0 ] 44 0 44
+[ 2 1 0 ] 45 0 45
+[ 2 1 1 ] 46 0 46
+[ 2 1 1 ] 47 0 47
+[ 2 1 1 ] 48 0 48
+[ 2 2 0 ] 49 0 49
+[ 2 2 0 ] 50 0 50
+[ 2 2 0 ] 51 0 51
+[ 2 2 1 ] 52 0 52
+[ 2 2 1 ] 53 0 53
+[ 2 2 1 ] 54 0 54
+[ 3 0 0 ] 55 0 55
+[ 3 0 0 ] 56 0 56
+[ 3 0 0 ] 57 0 57
+[ 3 0 1 ] 58 0 58
+[ 3 0 1 ] 59 0 59
+[ 3 0 1 ] 60 0 60
+[ 3 1 0 ] 61 0 61
+[ 3 1 0 ] 62 0 62
+[ 3 1 0 ] 63 0 63
+[ 3 1 1 ] 64 0 64
+[ 3 1 1 ] 65 0 65
+[ 3 1 1 ] 66 0 66
+[ 3 2 0 ] 67 0 67
+[ 3 2 0 ] 68 0 68
+[ 3 2 0 ] 69 0 69
+[ 3 2 1 ] 70 0 70
+[ 3 2 1 ] 71 0 71
+[ 3 2 1 ] 72 0 72
+72 differences found
+attribute: <bitfield of </>> and <bitfield of </>>
+size: [2] [2]
+position bitfield of </> bitfield of </> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+2 differences found
+attribute: <bitfield2D of </>> and <bitfield2D of </>>
+size: [3x2] [3x2]
+position bitfield2D of </> bitfield2D of </> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 2 0 ] 5 0 5
+[ 2 1 ] 6 0 6
+6 differences found
+attribute: <bitfield3D of </>> and <bitfield3D of </>>
+size: [4x3x2] [4x3x2]
+position bitfield3D of </> bitfield3D of </> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 1 ] 2 0 2
+[ 0 1 0 ] 3 0 3
+[ 0 1 1 ] 4 0 4
+[ 0 2 0 ] 5 0 5
+[ 0 2 1 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 1 0 ] 9 0 9
+[ 1 1 1 ] 10 0 10
+[ 1 2 0 ] 11 0 11
+[ 1 2 1 ] 12 0 12
+[ 2 0 0 ] 13 0 13
+[ 2 0 1 ] 14 0 14
+[ 2 1 0 ] 15 0 15
+[ 2 1 1 ] 16 0 16
+[ 2 2 0 ] 17 0 17
+[ 2 2 1 ] 18 0 18
+[ 3 0 0 ] 19 0 19
+[ 3 0 1 ] 20 0 20
+[ 3 1 0 ] 21 0 21
+[ 3 1 1 ] 22 0 22
+[ 3 2 0 ] 23 0 23
+[ 3 2 1 ] 24 0 24
+24 differences found
+attribute: <compound of </>> and <compound of </>>
+size: [2] [2]
+position compound of </> compound of </> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 0 ] 2 0 2
+[ 1 ] 3 0 3
+[ 1 ] 4 0 4
+4 differences found
+attribute: <compound2D of </>> and <compound2D of </>>
+size: [3x2] [3x2]
+position compound2D of </> compound2D of </> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 0 ] 2 0 2
+[ 0 1 ] 3 0 3
+[ 0 1 ] 4 0 4
+[ 1 0 ] 5 0 5
+[ 1 0 ] 6 0 6
+[ 1 1 ] 7 0 7
+[ 1 1 ] 8 0 8
+[ 2 0 ] 9 0 9
+[ 2 0 ] 10 0 10
+[ 2 1 ] 11 0 11
+[ 2 1 ] 12 0 12
+12 differences found
+attribute: <compound3D of </>> and <compound3D of </>>
+size: [4x3x2] [4x3x2]
+position compound3D of </> compound3D of </> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 0 ] 2 0 2
+[ 0 0 1 ] 3 0 3
+[ 0 0 1 ] 4 0 4
+[ 0 1 0 ] 5 0 5
+[ 0 1 0 ] 6 0 6
+[ 0 1 1 ] 7 0 7
+[ 0 1 1 ] 8 0 8
+[ 0 2 0 ] 9 0 9
+[ 0 2 0 ] 10 0 10
+[ 0 2 1 ] 11 0 11
+[ 0 2 1 ] 12 0 12
+[ 1 0 0 ] 13 0 13
+[ 1 0 0 ] 14 0 14
+[ 1 0 1 ] 15 0 15
+[ 1 0 1 ] 16 0 16
+[ 1 1 0 ] 17 0 17
+[ 1 1 0 ] 18 0 18
+[ 1 1 1 ] 19 0 19
+[ 1 1 1 ] 20 0 20
+[ 1 2 0 ] 21 0 21
+[ 1 2 0 ] 22 0 22
+[ 1 2 1 ] 23 0 23
+[ 1 2 1 ] 24 0 24
+[ 2 0 0 ] 25 0 25
+[ 2 0 0 ] 26 0 26
+[ 2 0 1 ] 27 0 27
+[ 2 0 1 ] 28 0 28
+[ 2 1 0 ] 29 0 29
+[ 2 1 0 ] 30 0 30
+[ 2 1 1 ] 31 0 31
+[ 2 1 1 ] 32 0 32
+[ 2 2 0 ] 33 0 33
+[ 2 2 0 ] 34 0 34
+[ 2 2 1 ] 35 0 35
+[ 2 2 1 ] 36 0 36
+[ 3 0 0 ] 37 0 37
+[ 3 0 0 ] 38 0 38
+[ 3 0 1 ] 39 0 39
+[ 3 0 1 ] 40 0 40
+[ 3 1 0 ] 41 0 41
+[ 3 1 0 ] 42 0 42
+[ 3 1 1 ] 43 0 43
+[ 3 1 1 ] 44 0 44
+[ 3 2 0 ] 45 0 45
+[ 3 2 0 ] 46 0 46
+[ 3 2 1 ] 47 0 47
+[ 3 2 1 ] 48 0 48
+48 differences found
+attribute: <enum of </>> and <enum of </>>
+size: [2] [2]
+position enum of </> enum of </> difference
+------------------------------------------------------------
+[ 0 ] RED GREEN
+[ 1 ] RED GREEN
+2 differences found
+attribute: <enum2D of </>> and <enum2D of </>>
+size: [3x2] [3x2]
+position enum2D of </> enum2D of </> difference
+------------------------------------------------------------
+[ 0 0 ] RED GREEN
+[ 0 1 ] RED GREEN
+[ 1 0 ] RED GREEN
+[ 1 1 ] RED GREEN
+[ 2 0 ] RED GREEN
+[ 2 1 ] RED GREEN
+6 differences found
+attribute: <enum3D of </>> and <enum3D of </>>
+size: [4x3x2] [4x3x2]
+position enum3D of </> enum3D of </> difference
+------------------------------------------------------------
+[ 0 0 0 ] GREEN RED
+[ 0 0 1 ] GREEN RED
+[ 0 1 0 ] GREEN RED
+[ 0 1 1 ] GREEN RED
+[ 0 2 0 ] GREEN RED
+[ 0 2 1 ] GREEN RED
+[ 1 0 0 ] GREEN RED
+[ 1 0 1 ] GREEN RED
+[ 1 1 0 ] GREEN RED
+[ 1 1 1 ] GREEN RED
+[ 1 2 0 ] GREEN RED
+[ 1 2 1 ] GREEN RED
+[ 2 0 0 ] GREEN RED
+[ 2 0 1 ] GREEN RED
+[ 2 1 0 ] GREEN RED
+[ 2 1 1 ] GREEN RED
+[ 2 2 0 ] GREEN RED
+[ 2 2 1 ] GREEN RED
+[ 3 0 0 ] GREEN RED
+[ 3 0 1 ] GREEN RED
+[ 3 1 0 ] GREEN RED
+[ 3 1 1 ] GREEN RED
+[ 3 2 0 ] GREEN RED
+[ 3 2 1 ] GREEN RED
+24 differences found
+attribute: <float of </>> and <float of </>>
+size: [2] [2]
+position float of </> float of </> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+2 differences found
+attribute: <float2D of </>> and <float2D of </>>
+size: [3x2] [3x2]
+position float2D of </> float2D of </> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 2 0 ] 5 0 5
+[ 2 1 ] 6 0 6
+6 differences found
+attribute: <float3D of </>> and <float3D of </>>
+size: [4x3x2] [4x3x2]
+position float3D of </> float3D of </> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 1 ] 2 0 2
+[ 0 1 0 ] 3 0 3
+[ 0 1 1 ] 4 0 4
+[ 0 2 0 ] 5 0 5
+[ 0 2 1 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 1 0 ] 9 0 9
+[ 1 1 1 ] 10 0 10
+[ 1 2 0 ] 11 0 11
+[ 1 2 1 ] 12 0 12
+[ 2 0 0 ] 13 0 13
+[ 2 0 1 ] 14 0 14
+[ 2 1 0 ] 15 0 15
+[ 2 1 1 ] 16 0 16
+[ 2 2 0 ] 17 0 17
+[ 2 2 1 ] 18 0 18
+[ 3 0 0 ] 19 0 19
+[ 3 0 1 ] 20 0 20
+[ 3 1 0 ] 21 0 21
+[ 3 1 1 ] 22 0 22
+[ 3 2 0 ] 23 0 23
+[ 3 2 1 ] 24 0 24
+24 differences found
+attribute: <integer of </>> and <integer of </>>
+size: [2] [2]
+position integer of </> integer of </> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+2 differences found
+attribute: <integer2D of </>> and <integer2D of </>>
+size: [3x2] [3x2]
+position integer2D of </> integer2D of </> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 2 0 ] 5 0 5
+[ 2 1 ] 6 0 6
+6 differences found
+attribute: <integer3D of </>> and <integer3D of </>>
+size: [4x3x2] [4x3x2]
+position integer3D of </> integer3D of </> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 1 ] 2 0 2
+[ 0 1 0 ] 3 0 3
+[ 0 1 1 ] 4 0 4
+[ 0 2 0 ] 5 0 5
+[ 0 2 1 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 1 0 ] 9 0 9
+[ 1 1 1 ] 10 0 10
+[ 1 2 0 ] 11 0 11
+[ 1 2 1 ] 12 0 12
+[ 2 0 0 ] 13 0 13
+[ 2 0 1 ] 14 0 14
+[ 2 1 0 ] 15 0 15
+[ 2 1 1 ] 16 0 16
+[ 2 2 0 ] 17 0 17
+[ 2 2 1 ] 18 0 18
+[ 3 0 0 ] 19 0 19
+[ 3 0 1 ] 20 0 20
+[ 3 1 0 ] 21 0 21
+[ 3 1 1 ] 22 0 22
+[ 3 2 0 ] 23 0 23
+[ 3 2 1 ] 24 0 24
+24 differences found
+attribute: <opaque of </>> and <opaque of </>>
+size: [2] [2]
+position opaque of </> opaque of </> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+2 differences found
+attribute: <opaque2D of </>> and <opaque2D of </>>
+size: [3x2] [3x2]
+position opaque2D of </> opaque2D of </> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 2 0 ] 5 0 5
+[ 2 1 ] 6 0 6
+6 differences found
+attribute: <opaque3D of </>> and <opaque3D of </>>
+size: [4x3x2] [4x3x2]
+position opaque3D of </> opaque3D of </> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 1 ] 2 0 2
+[ 0 1 0 ] 3 0 3
+[ 0 1 1 ] 4 0 4
+[ 0 2 0 ] 5 0 5
+[ 0 2 1 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 1 0 ] 9 0 9
+[ 1 1 1 ] 10 0 10
+[ 1 2 0 ] 11 0 11
+[ 1 2 1 ] 12 0 12
+[ 2 0 0 ] 13 0 13
+[ 2 0 1 ] 14 0 14
+[ 2 1 0 ] 15 0 15
+[ 2 1 1 ] 16 0 16
+[ 2 2 0 ] 17 0 17
+[ 2 2 1 ] 18 0 18
+[ 3 0 0 ] 19 0 19
+[ 3 0 1 ] 20 0 20
+[ 3 1 0 ] 21 0 21
+[ 3 1 1 ] 22 0 22
+[ 3 2 0 ] 23 0 23
+[ 3 2 1 ] 24 0 24
+24 differences found
+attribute: <string of </>> and <string of </>>
+size: [2] [2]
+position string of </> string of </> difference
+------------------------------------------------------------
+[ 0 ] a z
+[ 0 ] b z
+[ 1 ] d z
+[ 1 ] e z
+4 differences found
+attribute: <string2D of </>> and <string2D of </>>
+size: [3x2] [3x2]
+position string2D of </> string2D of </> difference
+------------------------------------------------------------
+[ 0 0 ] a z
+[ 0 0 ] b z
+[ 0 1 ] c z
+[ 0 1 ] d z
+[ 1 0 ] e z
+[ 1 0 ] f z
+[ 1 1 ] g z
+[ 1 1 ] h z
+[ 2 0 ] i z
+[ 2 0 ] j z
+[ 2 1 ] k z
+[ 2 1 ] l z
+12 differences found
+attribute: <string3D of </>> and <string3D of </>>
+size: [4x3x2] [4x3x2]
+position string3D of </> string3D of </> difference
+------------------------------------------------------------
+[ 0 0 0 ] a z
+[ 0 0 0 ] b z
+[ 0 0 1 ] c z
+[ 0 0 1 ] d z
+[ 0 1 0 ] e z
+[ 0 1 0 ] f z
+[ 0 1 1 ] g z
+[ 0 1 1 ] h z
+[ 0 2 0 ] i z
+[ 0 2 0 ] j z
+[ 0 2 1 ] k z
+[ 0 2 1 ] l z
+[ 1 0 0 ] m z
+[ 1 0 0 ] n z
+[ 1 0 1 ] p z
+[ 1 0 1 ] q z
+[ 1 1 0 ] r z
+[ 1 1 0 ] s z
+[ 1 1 1 ] t z
+[ 1 1 1 ] u z
+[ 1 2 0 ] v z
+[ 1 2 0 ] w z
+[ 1 2 1 ] x z
+[ 2 0 0 ] A z
+[ 2 0 0 ] B z
+[ 2 0 1 ] C z
+[ 2 0 1 ] D z
+[ 2 1 0 ] E z
+[ 2 1 0 ] F z
+[ 2 1 1 ] G z
+[ 2 1 1 ] H z
+[ 2 2 0 ] I z
+[ 2 2 0 ] J z
+[ 2 2 1 ] K z
+[ 2 2 1 ] L z
+[ 3 0 0 ] M z
+[ 3 0 0 ] N z
+[ 3 0 1 ] P z
+[ 3 0 1 ] Q z
+[ 3 1 0 ] R z
+[ 3 1 0 ] S z
+[ 3 1 1 ] T z
+[ 3 1 1 ] U z
+[ 3 2 0 ] V z
+[ 3 2 0 ] W z
+[ 3 2 1 ] X z
+[ 3 2 1 ] Z z
+47 differences found
+attribute: <vlen of </>> and <vlen of </>>
+size: [2] [2]
+position vlen of </> vlen of </> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+[ 1 ] 3 0 3
+3 differences found
+attribute: <vlen2D of </>> and <vlen2D of </>>
+size: [3x2] [3x2]
+position vlen2D of </> vlen2D of </> difference
+------------------------------------------------------------
+[ 0 1 ] 1 0 1
+[ 1 0 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 1 1 ] 5 0 5
+[ 2 0 ] 6 0 6
+[ 2 0 ] 7 0 7
+[ 2 0 ] 8 0 8
+[ 2 1 ] 9 0 9
+[ 2 1 ] 10 0 10
+[ 2 1 ] 11 0 11
+11 differences found
+attribute: <vlen3D of </>> and <vlen3D of </>>
+size: [4x3x2] [4x3x2]
+position vlen3D of </> vlen3D of </> difference
+------------------------------------------------------------
+[ 0 0 1 ] 1 0 1
+[ 0 1 0 ] 2 0 2
+[ 0 1 1 ] 3 0 3
+[ 0 2 0 ] 4 0 4
+[ 0 2 1 ] 5 0 5
+[ 1 0 0 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 0 1 ] 9 0 9
+[ 1 1 0 ] 10 0 10
+[ 1 1 0 ] 11 0 11
+[ 1 1 1 ] 12 0 12
+[ 1 1 1 ] 13 0 13
+[ 1 2 0 ] 14 0 14
+[ 1 2 0 ] 15 0 15
+[ 1 2 1 ] 16 0 16
+[ 1 2 1 ] 17 0 17
+[ 2 0 0 ] 18 0 18
+[ 2 0 0 ] 19 0 19
+[ 2 0 0 ] 20 0 20
+[ 2 0 1 ] 21 0 21
+[ 2 0 1 ] 22 0 22
+[ 2 0 1 ] 23 0 23
+[ 2 1 0 ] 24 0 24
+[ 2 1 0 ] 25 0 25
+[ 2 1 0 ] 26 0 26
+[ 2 1 1 ] 27 0 27
+[ 2 1 1 ] 28 0 28
+[ 2 1 1 ] 29 0 29
+[ 2 2 0 ] 30 0 30
+[ 2 2 0 ] 31 0 31
+[ 2 2 0 ] 32 0 32
+[ 2 2 1 ] 33 0 33
+[ 2 2 1 ] 34 0 34
+[ 2 2 1 ] 35 0 35
+[ 3 0 0 ] 36 0 36
+[ 3 0 0 ] 37 0 37
+[ 3 0 0 ] 38 0 38
+[ 3 0 0 ] 39 0 39
+[ 3 0 1 ] 40 0 40
+[ 3 0 1 ] 41 0 41
+[ 3 0 1 ] 42 0 42
+[ 3 0 1 ] 43 0 43
+[ 3 1 0 ] 44 0 44
+[ 3 1 0 ] 45 0 45
+[ 3 1 0 ] 46 0 46
+[ 3 1 0 ] 47 0 47
+[ 3 1 1 ] 48 0 48
+[ 3 1 1 ] 49 0 49
+[ 3 1 1 ] 50 0 50
+[ 3 1 1 ] 51 0 51
+[ 3 2 0 ] 52 0 52
+[ 3 2 0 ] 53 0 53
+[ 3 2 0 ] 54 0 54
+[ 3 2 0 ] 55 0 55
+[ 3 2 1 ] 56 0 56
+[ 3 2 1 ] 57 0 57
+[ 3 2 1 ] 58 0 58
+[ 3 2 1 ] 59 0 59
+59 differences found
+
+dataset: </dset> and </dset>
+Not comparable: </dset> or </dset> is an empty dataset
+0 differences found
+Attributes status: 33 common, 0 only in obj1, 0 only in obj2
+attribute: <VLstring of </dset>> and <VLstring of </dset>>
+size: [2] [2]
+position VLstring of </dset> VLstring of </dset> difference
+------------------------------------------------------------
+[ 0 ] a z
+[ 0 ] b z
+[ 1 ] d z
+[ 1 ] e z
+4 differences found
+attribute: <VLstring2D of </dset>> and <VLstring2D of </dset>>
+size: [3x2] [3x2]
+position VLstring2D of </dset> VLstring2D of </dset> difference
+------------------------------------------------------------
+[ 0 0 ] a z
+[ 0 0 ] b z
+[ 0 1 ] c z
+[ 0 1 ] d z
+[ 1 0 ] e z
+[ 1 0 ] f z
+[ 1 1 ] g z
+[ 1 1 ] h z
+[ 2 0 ] i z
+[ 2 0 ] j z
+[ 2 1 ] k z
+[ 2 1 ] l z
+12 differences found
+attribute: <VLstring3D of </dset>> and <VLstring3D of </dset>>
+size: [4x3x2] [4x3x2]
+position VLstring3D of </dset> VLstring3D of </dset> difference
+------------------------------------------------------------
+[ 0 0 0 ] a z
+[ 0 0 0 ] b z
+[ 0 0 1 ] c z
+[ 0 0 1 ] d z
+[ 0 1 0 ] e z
+[ 0 1 0 ] f z
+[ 0 1 1 ] g z
+[ 0 1 1 ] h z
+[ 0 2 0 ] i z
+[ 0 2 0 ] j z
+[ 0 2 1 ] k z
+[ 0 2 1 ] l z
+[ 1 0 0 ] m z
+[ 1 0 0 ] n z
+[ 1 0 1 ] p z
+[ 1 0 1 ] q z
+[ 1 1 0 ] r z
+[ 1 1 0 ] s z
+[ 1 1 1 ] t z
+[ 1 1 1 ] u z
+[ 1 2 0 ] v z
+[ 1 2 0 ] w z
+[ 1 2 1 ] x z
+[ 2 0 0 ] A z
+[ 2 0 0 ] B z
+[ 2 0 1 ] C z
+[ 2 0 1 ] D z
+[ 2 1 0 ] E z
+[ 2 1 0 ] F z
+[ 2 1 1 ] G z
+[ 2 1 1 ] H z
+[ 2 2 0 ] I z
+[ 2 2 0 ] J z
+[ 2 2 1 ] K z
+[ 2 2 1 ] L z
+[ 3 0 0 ] M z
+[ 3 0 0 ] N z
+[ 3 0 1 ] P z
+[ 3 0 1 ] Q z
+[ 3 1 0 ] R z
+[ 3 1 0 ] S z
+[ 3 1 1 ] T z
+[ 3 1 1 ] U z
+[ 3 2 0 ] V z
+[ 3 2 0 ] W z
+[ 3 2 1 ] X z
+[ 3 2 1 ] Z z
+47 differences found
+attribute: <array of </dset>> and <array of </dset>>
+size: [2] [2]
+position array of </dset> array of </dset> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 0 ] 2 0 2
+[ 0 ] 3 0 3
+[ 1 ] 4 0 4
+[ 1 ] 5 0 5
+[ 1 ] 6 0 6
+6 differences found
+attribute: <array2D of </dset>> and <array2D of </dset>>
+size: [3x2] [3x2]
+position array2D of </dset> array2D of </dset> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 0 ] 2 0 2
+[ 0 0 ] 3 0 3
+[ 0 1 ] 4 0 4
+[ 0 1 ] 5 0 5
+[ 0 1 ] 6 0 6
+[ 1 0 ] 7 0 7
+[ 1 0 ] 8 0 8
+[ 1 0 ] 9 0 9
+[ 1 1 ] 10 0 10
+[ 1 1 ] 11 0 11
+[ 1 1 ] 12 0 12
+[ 2 0 ] 13 0 13
+[ 2 0 ] 14 0 14
+[ 2 0 ] 15 0 15
+[ 2 1 ] 16 0 16
+[ 2 1 ] 17 0 17
+[ 2 1 ] 18 0 18
+18 differences found
+attribute: <array3D of </dset>> and <array3D of </dset>>
+size: [4x3x2] [4x3x2]
+position array3D of </dset> array3D of </dset> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 0 ] 2 0 2
+[ 0 0 0 ] 3 0 3
+[ 0 0 1 ] 4 0 4
+[ 0 0 1 ] 5 0 5
+[ 0 0 1 ] 6 0 6
+[ 0 1 0 ] 7 0 7
+[ 0 1 0 ] 8 0 8
+[ 0 1 0 ] 9 0 9
+[ 0 1 1 ] 10 0 10
+[ 0 1 1 ] 11 0 11
+[ 0 1 1 ] 12 0 12
+[ 0 2 0 ] 13 0 13
+[ 0 2 0 ] 14 0 14
+[ 0 2 0 ] 15 0 15
+[ 0 2 1 ] 16 0 16
+[ 0 2 1 ] 17 0 17
+[ 0 2 1 ] 18 0 18
+[ 1 0 0 ] 19 0 19
+[ 1 0 0 ] 20 0 20
+[ 1 0 0 ] 21 0 21
+[ 1 0 1 ] 22 0 22
+[ 1 0 1 ] 23 0 23
+[ 1 0 1 ] 24 0 24
+[ 1 1 0 ] 25 0 25
+[ 1 1 0 ] 26 0 26
+[ 1 1 0 ] 27 0 27
+[ 1 1 1 ] 28 0 28
+[ 1 1 1 ] 29 0 29
+[ 1 1 1 ] 30 0 30
+[ 1 2 0 ] 31 0 31
+[ 1 2 0 ] 32 0 32
+[ 1 2 0 ] 33 0 33
+[ 1 2 1 ] 34 0 34
+[ 1 2 1 ] 35 0 35
+[ 1 2 1 ] 36 0 36
+[ 2 0 0 ] 37 0 37
+[ 2 0 0 ] 38 0 38
+[ 2 0 0 ] 39 0 39
+[ 2 0 1 ] 40 0 40
+[ 2 0 1 ] 41 0 41
+[ 2 0 1 ] 42 0 42
+[ 2 1 0 ] 43 0 43
+[ 2 1 0 ] 44 0 44
+[ 2 1 0 ] 45 0 45
+[ 2 1 1 ] 46 0 46
+[ 2 1 1 ] 47 0 47
+[ 2 1 1 ] 48 0 48
+[ 2 2 0 ] 49 0 49
+[ 2 2 0 ] 50 0 50
+[ 2 2 0 ] 51 0 51
+[ 2 2 1 ] 52 0 52
+[ 2 2 1 ] 53 0 53
+[ 2 2 1 ] 54 0 54
+[ 3 0 0 ] 55 0 55
+[ 3 0 0 ] 56 0 56
+[ 3 0 0 ] 57 0 57
+[ 3 0 1 ] 58 0 58
+[ 3 0 1 ] 59 0 59
+[ 3 0 1 ] 60 0 60
+[ 3 1 0 ] 61 0 61
+[ 3 1 0 ] 62 0 62
+[ 3 1 0 ] 63 0 63
+[ 3 1 1 ] 64 0 64
+[ 3 1 1 ] 65 0 65
+[ 3 1 1 ] 66 0 66
+[ 3 2 0 ] 67 0 67
+[ 3 2 0 ] 68 0 68
+[ 3 2 0 ] 69 0 69
+[ 3 2 1 ] 70 0 70
+[ 3 2 1 ] 71 0 71
+[ 3 2 1 ] 72 0 72
+72 differences found
+attribute: <bitfield of </dset>> and <bitfield of </dset>>
+size: [2] [2]
+position bitfield of </dset> bitfield of </dset> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+2 differences found
+attribute: <bitfield2D of </dset>> and <bitfield2D of </dset>>
+size: [3x2] [3x2]
+position bitfield2D of </dset> bitfield2D of </dset> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 2 0 ] 5 0 5
+[ 2 1 ] 6 0 6
+6 differences found
+attribute: <bitfield3D of </dset>> and <bitfield3D of </dset>>
+size: [4x3x2] [4x3x2]
+position bitfield3D of </dset> bitfield3D of </dset> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 1 ] 2 0 2
+[ 0 1 0 ] 3 0 3
+[ 0 1 1 ] 4 0 4
+[ 0 2 0 ] 5 0 5
+[ 0 2 1 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 1 0 ] 9 0 9
+[ 1 1 1 ] 10 0 10
+[ 1 2 0 ] 11 0 11
+[ 1 2 1 ] 12 0 12
+[ 2 0 0 ] 13 0 13
+[ 2 0 1 ] 14 0 14
+[ 2 1 0 ] 15 0 15
+[ 2 1 1 ] 16 0 16
+[ 2 2 0 ] 17 0 17
+[ 2 2 1 ] 18 0 18
+[ 3 0 0 ] 19 0 19
+[ 3 0 1 ] 20 0 20
+[ 3 1 0 ] 21 0 21
+[ 3 1 1 ] 22 0 22
+[ 3 2 0 ] 23 0 23
+[ 3 2 1 ] 24 0 24
+24 differences found
+attribute: <compound of </dset>> and <compound of </dset>>
+size: [2] [2]
+position compound of </dset> compound of </dset> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 0 ] 2 0 2
+[ 1 ] 3 0 3
+[ 1 ] 4 0 4
+4 differences found
+attribute: <compound2D of </dset>> and <compound2D of </dset>>
+size: [3x2] [3x2]
+position compound2D of </dset> compound2D of </dset> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 0 ] 2 0 2
+[ 0 1 ] 3 0 3
+[ 0 1 ] 4 0 4
+[ 1 0 ] 5 0 5
+[ 1 0 ] 6 0 6
+[ 1 1 ] 7 0 7
+[ 1 1 ] 8 0 8
+[ 2 0 ] 9 0 9
+[ 2 0 ] 10 0 10
+[ 2 1 ] 11 0 11
+[ 2 1 ] 12 0 12
+12 differences found
+attribute: <compound3D of </dset>> and <compound3D of </dset>>
+size: [4x3x2] [4x3x2]
+position compound3D of </dset> compound3D of </dset> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 0 ] 2 0 2
+[ 0 0 1 ] 3 0 3
+[ 0 0 1 ] 4 0 4
+[ 0 1 0 ] 5 0 5
+[ 0 1 0 ] 6 0 6
+[ 0 1 1 ] 7 0 7
+[ 0 1 1 ] 8 0 8
+[ 0 2 0 ] 9 0 9
+[ 0 2 0 ] 10 0 10
+[ 0 2 1 ] 11 0 11
+[ 0 2 1 ] 12 0 12
+[ 1 0 0 ] 13 0 13
+[ 1 0 0 ] 14 0 14
+[ 1 0 1 ] 15 0 15
+[ 1 0 1 ] 16 0 16
+[ 1 1 0 ] 17 0 17
+[ 1 1 0 ] 18 0 18
+[ 1 1 1 ] 19 0 19
+[ 1 1 1 ] 20 0 20
+[ 1 2 0 ] 21 0 21
+[ 1 2 0 ] 22 0 22
+[ 1 2 1 ] 23 0 23
+[ 1 2 1 ] 24 0 24
+[ 2 0 0 ] 25 0 25
+[ 2 0 0 ] 26 0 26
+[ 2 0 1 ] 27 0 27
+[ 2 0 1 ] 28 0 28
+[ 2 1 0 ] 29 0 29
+[ 2 1 0 ] 30 0 30
+[ 2 1 1 ] 31 0 31
+[ 2 1 1 ] 32 0 32
+[ 2 2 0 ] 33 0 33
+[ 2 2 0 ] 34 0 34
+[ 2 2 1 ] 35 0 35
+[ 2 2 1 ] 36 0 36
+[ 3 0 0 ] 37 0 37
+[ 3 0 0 ] 38 0 38
+[ 3 0 1 ] 39 0 39
+[ 3 0 1 ] 40 0 40
+[ 3 1 0 ] 41 0 41
+[ 3 1 0 ] 42 0 42
+[ 3 1 1 ] 43 0 43
+[ 3 1 1 ] 44 0 44
+[ 3 2 0 ] 45 0 45
+[ 3 2 0 ] 46 0 46
+[ 3 2 1 ] 47 0 47
+[ 3 2 1 ] 48 0 48
+48 differences found
+attribute: <enum of </dset>> and <enum of </dset>>
+size: [2] [2]
+position enum of </dset> enum of </dset> difference
+------------------------------------------------------------
+[ 0 ] RED GREEN
+[ 1 ] RED GREEN
+2 differences found
+attribute: <enum2D of </dset>> and <enum2D of </dset>>
+size: [3x2] [3x2]
+position enum2D of </dset> enum2D of </dset> difference
+------------------------------------------------------------
+[ 0 0 ] RED GREEN
+[ 0 1 ] RED GREEN
+[ 1 0 ] RED GREEN
+[ 1 1 ] RED GREEN
+[ 2 0 ] RED GREEN
+[ 2 1 ] RED GREEN
+6 differences found
+attribute: <enum3D of </dset>> and <enum3D of </dset>>
+size: [4x3x2] [4x3x2]
+position enum3D of </dset> enum3D of </dset> difference
+------------------------------------------------------------
+[ 0 0 0 ] GREEN RED
+[ 0 0 1 ] GREEN RED
+[ 0 1 0 ] GREEN RED
+[ 0 1 1 ] GREEN RED
+[ 0 2 0 ] GREEN RED
+[ 0 2 1 ] GREEN RED
+[ 1 0 0 ] GREEN RED
+[ 1 0 1 ] GREEN RED
+[ 1 1 0 ] GREEN RED
+[ 1 1 1 ] GREEN RED
+[ 1 2 0 ] GREEN RED
+[ 1 2 1 ] GREEN RED
+[ 2 0 0 ] GREEN RED
+[ 2 0 1 ] GREEN RED
+[ 2 1 0 ] GREEN RED
+[ 2 1 1 ] GREEN RED
+[ 2 2 0 ] GREEN RED
+[ 2 2 1 ] GREEN RED
+[ 3 0 0 ] GREEN RED
+[ 3 0 1 ] GREEN RED
+[ 3 1 0 ] GREEN RED
+[ 3 1 1 ] GREEN RED
+[ 3 2 0 ] GREEN RED
+[ 3 2 1 ] GREEN RED
+24 differences found
+attribute: <float of </dset>> and <float of </dset>>
+size: [2] [2]
+position float of </dset> float of </dset> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+2 differences found
+attribute: <float2D of </dset>> and <float2D of </dset>>
+size: [3x2] [3x2]
+position float2D of </dset> float2D of </dset> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 2 0 ] 5 0 5
+[ 2 1 ] 6 0 6
+6 differences found
+attribute: <float3D of </dset>> and <float3D of </dset>>
+size: [4x3x2] [4x3x2]
+position float3D of </dset> float3D of </dset> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 1 ] 2 0 2
+[ 0 1 0 ] 3 0 3
+[ 0 1 1 ] 4 0 4
+[ 0 2 0 ] 5 0 5
+[ 0 2 1 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 1 0 ] 9 0 9
+[ 1 1 1 ] 10 0 10
+[ 1 2 0 ] 11 0 11
+[ 1 2 1 ] 12 0 12
+[ 2 0 0 ] 13 0 13
+[ 2 0 1 ] 14 0 14
+[ 2 1 0 ] 15 0 15
+[ 2 1 1 ] 16 0 16
+[ 2 2 0 ] 17 0 17
+[ 2 2 1 ] 18 0 18
+[ 3 0 0 ] 19 0 19
+[ 3 0 1 ] 20 0 20
+[ 3 1 0 ] 21 0 21
+[ 3 1 1 ] 22 0 22
+[ 3 2 0 ] 23 0 23
+[ 3 2 1 ] 24 0 24
+24 differences found
+attribute: <integer of </dset>> and <integer of </dset>>
+size: [2] [2]
+position integer of </dset> integer of </dset> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+2 differences found
+attribute: <integer2D of </dset>> and <integer2D of </dset>>
+size: [3x2] [3x2]
+position integer2D of </dset> integer2D of </dset> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 2 0 ] 5 0 5
+[ 2 1 ] 6 0 6
+6 differences found
+attribute: <integer3D of </dset>> and <integer3D of </dset>>
+size: [4x3x2] [4x3x2]
+position integer3D of </dset> integer3D of </dset> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 1 ] 2 0 2
+[ 0 1 0 ] 3 0 3
+[ 0 1 1 ] 4 0 4
+[ 0 2 0 ] 5 0 5
+[ 0 2 1 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 1 0 ] 9 0 9
+[ 1 1 1 ] 10 0 10
+[ 1 2 0 ] 11 0 11
+[ 1 2 1 ] 12 0 12
+[ 2 0 0 ] 13 0 13
+[ 2 0 1 ] 14 0 14
+[ 2 1 0 ] 15 0 15
+[ 2 1 1 ] 16 0 16
+[ 2 2 0 ] 17 0 17
+[ 2 2 1 ] 18 0 18
+[ 3 0 0 ] 19 0 19
+[ 3 0 1 ] 20 0 20
+[ 3 1 0 ] 21 0 21
+[ 3 1 1 ] 22 0 22
+[ 3 2 0 ] 23 0 23
+[ 3 2 1 ] 24 0 24
+24 differences found
+attribute: <opaque of </dset>> and <opaque of </dset>>
+size: [2] [2]
+position opaque of </dset> opaque of </dset> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+2 differences found
+attribute: <opaque2D of </dset>> and <opaque2D of </dset>>
+size: [3x2] [3x2]
+position opaque2D of </dset> opaque2D of </dset> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 2 0 ] 5 0 5
+[ 2 1 ] 6 0 6
+6 differences found
+attribute: <opaque3D of </dset>> and <opaque3D of </dset>>
+size: [4x3x2] [4x3x2]
+position opaque3D of </dset> opaque3D of </dset> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 1 ] 2 0 2
+[ 0 1 0 ] 3 0 3
+[ 0 1 1 ] 4 0 4
+[ 0 2 0 ] 5 0 5
+[ 0 2 1 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 1 0 ] 9 0 9
+[ 1 1 1 ] 10 0 10
+[ 1 2 0 ] 11 0 11
+[ 1 2 1 ] 12 0 12
+[ 2 0 0 ] 13 0 13
+[ 2 0 1 ] 14 0 14
+[ 2 1 0 ] 15 0 15
+[ 2 1 1 ] 16 0 16
+[ 2 2 0 ] 17 0 17
+[ 2 2 1 ] 18 0 18
+[ 3 0 0 ] 19 0 19
+[ 3 0 1 ] 20 0 20
+[ 3 1 0 ] 21 0 21
+[ 3 1 1 ] 22 0 22
+[ 3 2 0 ] 23 0 23
+[ 3 2 1 ] 24 0 24
+24 differences found
+attribute: <reference of </dset>> and <reference of </dset>>
+0 differences found
+attribute: <reference2D of </dset>> and <reference2D of </dset>>
+0 differences found
+attribute: <reference3D of </dset>> and <reference3D of </dset>>
+0 differences found
+attribute: <string of </dset>> and <string of </dset>>
+size: [2] [2]
+position string of </dset> string of </dset> difference
+------------------------------------------------------------
+[ 0 ] a z
+[ 0 ] b z
+[ 1 ] d z
+[ 1 ] e z
+4 differences found
+attribute: <string2D of </dset>> and <string2D of </dset>>
+size: [3x2] [3x2]
+position string2D of </dset> string2D of </dset> difference
+------------------------------------------------------------
+[ 0 0 ] a z
+[ 0 0 ] b z
+[ 0 1 ] c z
+[ 0 1 ] d z
+[ 1 0 ] e z
+[ 1 0 ] f z
+[ 1 1 ] g z
+[ 1 1 ] h z
+[ 2 0 ] i z
+[ 2 0 ] j z
+[ 2 1 ] k z
+[ 2 1 ] l z
+12 differences found
+attribute: <string3D of </dset>> and <string3D of </dset>>
+size: [4x3x2] [4x3x2]
+position string3D of </dset> string3D of </dset> difference
+------------------------------------------------------------
+[ 0 0 0 ] a z
+[ 0 0 0 ] b z
+[ 0 0 1 ] c z
+[ 0 0 1 ] d z
+[ 0 1 0 ] e z
+[ 0 1 0 ] f z
+[ 0 1 1 ] g z
+[ 0 1 1 ] h z
+[ 0 2 0 ] i z
+[ 0 2 0 ] j z
+[ 0 2 1 ] k z
+[ 0 2 1 ] l z
+[ 1 0 0 ] m z
+[ 1 0 0 ] n z
+[ 1 0 1 ] p z
+[ 1 0 1 ] q z
+[ 1 1 0 ] r z
+[ 1 1 0 ] s z
+[ 1 1 1 ] t z
+[ 1 1 1 ] u z
+[ 1 2 0 ] v z
+[ 1 2 0 ] w z
+[ 1 2 1 ] x z
+[ 2 0 0 ] A z
+[ 2 0 0 ] B z
+[ 2 0 1 ] C z
+[ 2 0 1 ] D z
+[ 2 1 0 ] E z
+[ 2 1 0 ] F z
+[ 2 1 1 ] G z
+[ 2 1 1 ] H z
+[ 2 2 0 ] I z
+[ 2 2 0 ] J z
+[ 2 2 1 ] K z
+[ 2 2 1 ] L z
+[ 3 0 0 ] M z
+[ 3 0 0 ] N z
+[ 3 0 1 ] P z
+[ 3 0 1 ] Q z
+[ 3 1 0 ] R z
+[ 3 1 0 ] S z
+[ 3 1 1 ] T z
+[ 3 1 1 ] U z
+[ 3 2 0 ] V z
+[ 3 2 0 ] W z
+[ 3 2 1 ] X z
+[ 3 2 1 ] Z z
+47 differences found
+attribute: <vlen of </dset>> and <vlen of </dset>>
+size: [2] [2]
+position vlen of </dset> vlen of </dset> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+[ 1 ] 3 0 3
+3 differences found
+attribute: <vlen2D of </dset>> and <vlen2D of </dset>>
+size: [3x2] [3x2]
+position vlen2D of </dset> vlen2D of </dset> difference
+------------------------------------------------------------
+[ 0 1 ] 1 0 1
+[ 1 0 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 1 1 ] 5 0 5
+[ 2 0 ] 6 0 6
+[ 2 0 ] 7 0 7
+[ 2 0 ] 8 0 8
+[ 2 1 ] 9 0 9
+[ 2 1 ] 10 0 10
+[ 2 1 ] 11 0 11
+11 differences found
+attribute: <vlen3D of </dset>> and <vlen3D of </dset>>
+size: [4x3x2] [4x3x2]
+position vlen3D of </dset> vlen3D of </dset> difference
+------------------------------------------------------------
+[ 0 0 1 ] 1 0 1
+[ 0 1 0 ] 2 0 2
+[ 0 1 1 ] 3 0 3
+[ 0 2 0 ] 4 0 4
+[ 0 2 1 ] 5 0 5
+[ 1 0 0 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 0 1 ] 9 0 9
+[ 1 1 0 ] 10 0 10
+[ 1 1 0 ] 11 0 11
+[ 1 1 1 ] 12 0 12
+[ 1 1 1 ] 13 0 13
+[ 1 2 0 ] 14 0 14
+[ 1 2 0 ] 15 0 15
+[ 1 2 1 ] 16 0 16
+[ 1 2 1 ] 17 0 17
+[ 2 0 0 ] 18 0 18
+[ 2 0 0 ] 19 0 19
+[ 2 0 0 ] 20 0 20
+[ 2 0 1 ] 21 0 21
+[ 2 0 1 ] 22 0 22
+[ 2 0 1 ] 23 0 23
+[ 2 1 0 ] 24 0 24
+[ 2 1 0 ] 25 0 25
+[ 2 1 0 ] 26 0 26
+[ 2 1 1 ] 27 0 27
+[ 2 1 1 ] 28 0 28
+[ 2 1 1 ] 29 0 29
+[ 2 2 0 ] 30 0 30
+[ 2 2 0 ] 31 0 31
+[ 2 2 0 ] 32 0 32
+[ 2 2 1 ] 33 0 33
+[ 2 2 1 ] 34 0 34
+[ 2 2 1 ] 35 0 35
+[ 3 0 0 ] 36 0 36
+[ 3 0 0 ] 37 0 37
+[ 3 0 0 ] 38 0 38
+[ 3 0 0 ] 39 0 39
+[ 3 0 1 ] 40 0 40
+[ 3 0 1 ] 41 0 41
+[ 3 0 1 ] 42 0 42
+[ 3 0 1 ] 43 0 43
+[ 3 1 0 ] 44 0 44
+[ 3 1 0 ] 45 0 45
+[ 3 1 0 ] 46 0 46
+[ 3 1 0 ] 47 0 47
+[ 3 1 1 ] 48 0 48
+[ 3 1 1 ] 49 0 49
+[ 3 1 1 ] 50 0 50
+[ 3 1 1 ] 51 0 51
+[ 3 2 0 ] 52 0 52
+[ 3 2 0 ] 53 0 53
+[ 3 2 0 ] 54 0 54
+[ 3 2 0 ] 55 0 55
+[ 3 2 1 ] 56 0 56
+[ 3 2 1 ] 57 0 57
+[ 3 2 1 ] 58 0 58
+[ 3 2 1 ] 59 0 59
+59 differences found
+
+group : </g1> and </g1>
+0 differences found
+Attributes status: 30 common, 0 only in obj1, 0 only in obj2
+attribute: <VLstring of </g1>> and <VLstring of </g1>>
+size: [2] [2]
+position VLstring of </g1> VLstring of </g1> difference
+------------------------------------------------------------
+[ 0 ] a z
+[ 0 ] b z
+[ 1 ] d z
+[ 1 ] e z
+4 differences found
+attribute: <VLstring2D of </g1>> and <VLstring2D of </g1>>
+size: [3x2] [3x2]
+position VLstring2D of </g1> VLstring2D of </g1> difference
+------------------------------------------------------------
+[ 0 0 ] a z
+[ 0 0 ] b z
+[ 0 1 ] c z
+[ 0 1 ] d z
+[ 1 0 ] e z
+[ 1 0 ] f z
+[ 1 1 ] g z
+[ 1 1 ] h z
+[ 2 0 ] i z
+[ 2 0 ] j z
+[ 2 1 ] k z
+[ 2 1 ] l z
+12 differences found
+attribute: <VLstring3D of </g1>> and <VLstring3D of </g1>>
+size: [4x3x2] [4x3x2]
+position VLstring3D of </g1> VLstring3D of </g1> difference
+------------------------------------------------------------
+[ 0 0 0 ] a z
+[ 0 0 0 ] b z
+[ 0 0 1 ] c z
+[ 0 0 1 ] d z
+[ 0 1 0 ] e z
+[ 0 1 0 ] f z
+[ 0 1 1 ] g z
+[ 0 1 1 ] h z
+[ 0 2 0 ] i z
+[ 0 2 0 ] j z
+[ 0 2 1 ] k z
+[ 0 2 1 ] l z
+[ 1 0 0 ] m z
+[ 1 0 0 ] n z
+[ 1 0 1 ] p z
+[ 1 0 1 ] q z
+[ 1 1 0 ] r z
+[ 1 1 0 ] s z
+[ 1 1 1 ] t z
+[ 1 1 1 ] u z
+[ 1 2 0 ] v z
+[ 1 2 0 ] w z
+[ 1 2 1 ] x z
+[ 2 0 0 ] A z
+[ 2 0 0 ] B z
+[ 2 0 1 ] C z
+[ 2 0 1 ] D z
+[ 2 1 0 ] E z
+[ 2 1 0 ] F z
+[ 2 1 1 ] G z
+[ 2 1 1 ] H z
+[ 2 2 0 ] I z
+[ 2 2 0 ] J z
+[ 2 2 1 ] K z
+[ 2 2 1 ] L z
+[ 3 0 0 ] M z
+[ 3 0 0 ] N z
+[ 3 0 1 ] P z
+[ 3 0 1 ] Q z
+[ 3 1 0 ] R z
+[ 3 1 0 ] S z
+[ 3 1 1 ] T z
+[ 3 1 1 ] U z
+[ 3 2 0 ] V z
+[ 3 2 0 ] W z
+[ 3 2 1 ] X z
+[ 3 2 1 ] Z z
+47 differences found
+attribute: <array of </g1>> and <array of </g1>>
+size: [2] [2]
+position array of </g1> array of </g1> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 0 ] 2 0 2
+[ 0 ] 3 0 3
+[ 1 ] 4 0 4
+[ 1 ] 5 0 5
+[ 1 ] 6 0 6
+6 differences found
+attribute: <array2D of </g1>> and <array2D of </g1>>
+size: [3x2] [3x2]
+position array2D of </g1> array2D of </g1> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 0 ] 2 0 2
+[ 0 0 ] 3 0 3
+[ 0 1 ] 4 0 4
+[ 0 1 ] 5 0 5
+[ 0 1 ] 6 0 6
+[ 1 0 ] 7 0 7
+[ 1 0 ] 8 0 8
+[ 1 0 ] 9 0 9
+[ 1 1 ] 10 0 10
+[ 1 1 ] 11 0 11
+[ 1 1 ] 12 0 12
+[ 2 0 ] 13 0 13
+[ 2 0 ] 14 0 14
+[ 2 0 ] 15 0 15
+[ 2 1 ] 16 0 16
+[ 2 1 ] 17 0 17
+[ 2 1 ] 18 0 18
+18 differences found
+attribute: <array3D of </g1>> and <array3D of </g1>>
+size: [4x3x2] [4x3x2]
+position array3D of </g1> array3D of </g1> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 0 ] 2 0 2
+[ 0 0 0 ] 3 0 3
+[ 0 0 1 ] 4 0 4
+[ 0 0 1 ] 5 0 5
+[ 0 0 1 ] 6 0 6
+[ 0 1 0 ] 7 0 7
+[ 0 1 0 ] 8 0 8
+[ 0 1 0 ] 9 0 9
+[ 0 1 1 ] 10 0 10
+[ 0 1 1 ] 11 0 11
+[ 0 1 1 ] 12 0 12
+[ 0 2 0 ] 13 0 13
+[ 0 2 0 ] 14 0 14
+[ 0 2 0 ] 15 0 15
+[ 0 2 1 ] 16 0 16
+[ 0 2 1 ] 17 0 17
+[ 0 2 1 ] 18 0 18
+[ 1 0 0 ] 19 0 19
+[ 1 0 0 ] 20 0 20
+[ 1 0 0 ] 21 0 21
+[ 1 0 1 ] 22 0 22
+[ 1 0 1 ] 23 0 23
+[ 1 0 1 ] 24 0 24
+[ 1 1 0 ] 25 0 25
+[ 1 1 0 ] 26 0 26
+[ 1 1 0 ] 27 0 27
+[ 1 1 1 ] 28 0 28
+[ 1 1 1 ] 29 0 29
+[ 1 1 1 ] 30 0 30
+[ 1 2 0 ] 31 0 31
+[ 1 2 0 ] 32 0 32
+[ 1 2 0 ] 33 0 33
+[ 1 2 1 ] 34 0 34
+[ 1 2 1 ] 35 0 35
+[ 1 2 1 ] 36 0 36
+[ 2 0 0 ] 37 0 37
+[ 2 0 0 ] 38 0 38
+[ 2 0 0 ] 39 0 39
+[ 2 0 1 ] 40 0 40
+[ 2 0 1 ] 41 0 41
+[ 2 0 1 ] 42 0 42
+[ 2 1 0 ] 43 0 43
+[ 2 1 0 ] 44 0 44
+[ 2 1 0 ] 45 0 45
+[ 2 1 1 ] 46 0 46
+[ 2 1 1 ] 47 0 47
+[ 2 1 1 ] 48 0 48
+[ 2 2 0 ] 49 0 49
+[ 2 2 0 ] 50 0 50
+[ 2 2 0 ] 51 0 51
+[ 2 2 1 ] 52 0 52
+[ 2 2 1 ] 53 0 53
+[ 2 2 1 ] 54 0 54
+[ 3 0 0 ] 55 0 55
+[ 3 0 0 ] 56 0 56
+[ 3 0 0 ] 57 0 57
+[ 3 0 1 ] 58 0 58
+[ 3 0 1 ] 59 0 59
+[ 3 0 1 ] 60 0 60
+[ 3 1 0 ] 61 0 61
+[ 3 1 0 ] 62 0 62
+[ 3 1 0 ] 63 0 63
+[ 3 1 1 ] 64 0 64
+[ 3 1 1 ] 65 0 65
+[ 3 1 1 ] 66 0 66
+[ 3 2 0 ] 67 0 67
+[ 3 2 0 ] 68 0 68
+[ 3 2 0 ] 69 0 69
+[ 3 2 1 ] 70 0 70
+[ 3 2 1 ] 71 0 71
+[ 3 2 1 ] 72 0 72
+72 differences found
+attribute: <bitfield of </g1>> and <bitfield of </g1>>
+size: [2] [2]
+position bitfield of </g1> bitfield of </g1> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+2 differences found
+attribute: <bitfield2D of </g1>> and <bitfield2D of </g1>>
+size: [3x2] [3x2]
+position bitfield2D of </g1> bitfield2D of </g1> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 2 0 ] 5 0 5
+[ 2 1 ] 6 0 6
+6 differences found
+attribute: <bitfield3D of </g1>> and <bitfield3D of </g1>>
+size: [4x3x2] [4x3x2]
+position bitfield3D of </g1> bitfield3D of </g1> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 1 ] 2 0 2
+[ 0 1 0 ] 3 0 3
+[ 0 1 1 ] 4 0 4
+[ 0 2 0 ] 5 0 5
+[ 0 2 1 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 1 0 ] 9 0 9
+[ 1 1 1 ] 10 0 10
+[ 1 2 0 ] 11 0 11
+[ 1 2 1 ] 12 0 12
+[ 2 0 0 ] 13 0 13
+[ 2 0 1 ] 14 0 14
+[ 2 1 0 ] 15 0 15
+[ 2 1 1 ] 16 0 16
+[ 2 2 0 ] 17 0 17
+[ 2 2 1 ] 18 0 18
+[ 3 0 0 ] 19 0 19
+[ 3 0 1 ] 20 0 20
+[ 3 1 0 ] 21 0 21
+[ 3 1 1 ] 22 0 22
+[ 3 2 0 ] 23 0 23
+[ 3 2 1 ] 24 0 24
+24 differences found
+attribute: <compound of </g1>> and <compound of </g1>>
+size: [2] [2]
+position compound of </g1> compound of </g1> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 0 ] 2 0 2
+[ 1 ] 3 0 3
+[ 1 ] 4 0 4
+4 differences found
+attribute: <compound2D of </g1>> and <compound2D of </g1>>
+size: [3x2] [3x2]
+position compound2D of </g1> compound2D of </g1> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 0 ] 2 0 2
+[ 0 1 ] 3 0 3
+[ 0 1 ] 4 0 4
+[ 1 0 ] 5 0 5
+[ 1 0 ] 6 0 6
+[ 1 1 ] 7 0 7
+[ 1 1 ] 8 0 8
+[ 2 0 ] 9 0 9
+[ 2 0 ] 10 0 10
+[ 2 1 ] 11 0 11
+[ 2 1 ] 12 0 12
+12 differences found
+attribute: <compound3D of </g1>> and <compound3D of </g1>>
+size: [4x3x2] [4x3x2]
+position compound3D of </g1> compound3D of </g1> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 0 ] 2 0 2
+[ 0 0 1 ] 3 0 3
+[ 0 0 1 ] 4 0 4
+[ 0 1 0 ] 5 0 5
+[ 0 1 0 ] 6 0 6
+[ 0 1 1 ] 7 0 7
+[ 0 1 1 ] 8 0 8
+[ 0 2 0 ] 9 0 9
+[ 0 2 0 ] 10 0 10
+[ 0 2 1 ] 11 0 11
+[ 0 2 1 ] 12 0 12
+[ 1 0 0 ] 13 0 13
+[ 1 0 0 ] 14 0 14
+[ 1 0 1 ] 15 0 15
+[ 1 0 1 ] 16 0 16
+[ 1 1 0 ] 17 0 17
+[ 1 1 0 ] 18 0 18
+[ 1 1 1 ] 19 0 19
+[ 1 1 1 ] 20 0 20
+[ 1 2 0 ] 21 0 21
+[ 1 2 0 ] 22 0 22
+[ 1 2 1 ] 23 0 23
+[ 1 2 1 ] 24 0 24
+[ 2 0 0 ] 25 0 25
+[ 2 0 0 ] 26 0 26
+[ 2 0 1 ] 27 0 27
+[ 2 0 1 ] 28 0 28
+[ 2 1 0 ] 29 0 29
+[ 2 1 0 ] 30 0 30
+[ 2 1 1 ] 31 0 31
+[ 2 1 1 ] 32 0 32
+[ 2 2 0 ] 33 0 33
+[ 2 2 0 ] 34 0 34
+[ 2 2 1 ] 35 0 35
+[ 2 2 1 ] 36 0 36
+[ 3 0 0 ] 37 0 37
+[ 3 0 0 ] 38 0 38
+[ 3 0 1 ] 39 0 39
+[ 3 0 1 ] 40 0 40
+[ 3 1 0 ] 41 0 41
+[ 3 1 0 ] 42 0 42
+[ 3 1 1 ] 43 0 43
+[ 3 1 1 ] 44 0 44
+[ 3 2 0 ] 45 0 45
+[ 3 2 0 ] 46 0 46
+[ 3 2 1 ] 47 0 47
+[ 3 2 1 ] 48 0 48
+48 differences found
+attribute: <enum of </g1>> and <enum of </g1>>
+size: [2] [2]
+position enum of </g1> enum of </g1> difference
+------------------------------------------------------------
+[ 0 ] RED GREEN
+[ 1 ] RED GREEN
+2 differences found
+attribute: <enum2D of </g1>> and <enum2D of </g1>>
+size: [3x2] [3x2]
+position enum2D of </g1> enum2D of </g1> difference
+------------------------------------------------------------
+[ 0 0 ] RED GREEN
+[ 0 1 ] RED GREEN
+[ 1 0 ] RED GREEN
+[ 1 1 ] RED GREEN
+[ 2 0 ] RED GREEN
+[ 2 1 ] RED GREEN
+6 differences found
+attribute: <enum3D of </g1>> and <enum3D of </g1>>
+size: [4x3x2] [4x3x2]
+position enum3D of </g1> enum3D of </g1> difference
+------------------------------------------------------------
+[ 0 0 0 ] GREEN RED
+[ 0 0 1 ] GREEN RED
+[ 0 1 0 ] GREEN RED
+[ 0 1 1 ] GREEN RED
+[ 0 2 0 ] GREEN RED
+[ 0 2 1 ] GREEN RED
+[ 1 0 0 ] GREEN RED
+[ 1 0 1 ] GREEN RED
+[ 1 1 0 ] GREEN RED
+[ 1 1 1 ] GREEN RED
+[ 1 2 0 ] GREEN RED
+[ 1 2 1 ] GREEN RED
+[ 2 0 0 ] GREEN RED
+[ 2 0 1 ] GREEN RED
+[ 2 1 0 ] GREEN RED
+[ 2 1 1 ] GREEN RED
+[ 2 2 0 ] GREEN RED
+[ 2 2 1 ] GREEN RED
+[ 3 0 0 ] GREEN RED
+[ 3 0 1 ] GREEN RED
+[ 3 1 0 ] GREEN RED
+[ 3 1 1 ] GREEN RED
+[ 3 2 0 ] GREEN RED
+[ 3 2 1 ] GREEN RED
+24 differences found
+attribute: <float of </g1>> and <float of </g1>>
+size: [2] [2]
+position float of </g1> float of </g1> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+2 differences found
+attribute: <float2D of </g1>> and <float2D of </g1>>
+size: [3x2] [3x2]
+position float2D of </g1> float2D of </g1> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 2 0 ] 5 0 5
+[ 2 1 ] 6 0 6
+6 differences found
+attribute: <float3D of </g1>> and <float3D of </g1>>
+size: [4x3x2] [4x3x2]
+position float3D of </g1> float3D of </g1> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 1 ] 2 0 2
+[ 0 1 0 ] 3 0 3
+[ 0 1 1 ] 4 0 4
+[ 0 2 0 ] 5 0 5
+[ 0 2 1 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 1 0 ] 9 0 9
+[ 1 1 1 ] 10 0 10
+[ 1 2 0 ] 11 0 11
+[ 1 2 1 ] 12 0 12
+[ 2 0 0 ] 13 0 13
+[ 2 0 1 ] 14 0 14
+[ 2 1 0 ] 15 0 15
+[ 2 1 1 ] 16 0 16
+[ 2 2 0 ] 17 0 17
+[ 2 2 1 ] 18 0 18
+[ 3 0 0 ] 19 0 19
+[ 3 0 1 ] 20 0 20
+[ 3 1 0 ] 21 0 21
+[ 3 1 1 ] 22 0 22
+[ 3 2 0 ] 23 0 23
+[ 3 2 1 ] 24 0 24
+24 differences found
+attribute: <integer of </g1>> and <integer of </g1>>
+size: [2] [2]
+position integer of </g1> integer of </g1> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+2 differences found
+attribute: <integer2D of </g1>> and <integer2D of </g1>>
+size: [3x2] [3x2]
+position integer2D of </g1> integer2D of </g1> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 2 0 ] 5 0 5
+[ 2 1 ] 6 0 6
+6 differences found
+attribute: <integer3D of </g1>> and <integer3D of </g1>>
+size: [4x3x2] [4x3x2]
+position integer3D of </g1> integer3D of </g1> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 1 ] 2 0 2
+[ 0 1 0 ] 3 0 3
+[ 0 1 1 ] 4 0 4
+[ 0 2 0 ] 5 0 5
+[ 0 2 1 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 1 0 ] 9 0 9
+[ 1 1 1 ] 10 0 10
+[ 1 2 0 ] 11 0 11
+[ 1 2 1 ] 12 0 12
+[ 2 0 0 ] 13 0 13
+[ 2 0 1 ] 14 0 14
+[ 2 1 0 ] 15 0 15
+[ 2 1 1 ] 16 0 16
+[ 2 2 0 ] 17 0 17
+[ 2 2 1 ] 18 0 18
+[ 3 0 0 ] 19 0 19
+[ 3 0 1 ] 20 0 20
+[ 3 1 0 ] 21 0 21
+[ 3 1 1 ] 22 0 22
+[ 3 2 0 ] 23 0 23
+[ 3 2 1 ] 24 0 24
+24 differences found
+attribute: <opaque of </g1>> and <opaque of </g1>>
+size: [2] [2]
+position opaque of </g1> opaque of </g1> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+2 differences found
+attribute: <opaque2D of </g1>> and <opaque2D of </g1>>
+size: [3x2] [3x2]
+position opaque2D of </g1> opaque2D of </g1> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 2 0 ] 5 0 5
+[ 2 1 ] 6 0 6
+6 differences found
+attribute: <opaque3D of </g1>> and <opaque3D of </g1>>
+size: [4x3x2] [4x3x2]
+position opaque3D of </g1> opaque3D of </g1> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 1 ] 2 0 2
+[ 0 1 0 ] 3 0 3
+[ 0 1 1 ] 4 0 4
+[ 0 2 0 ] 5 0 5
+[ 0 2 1 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 1 0 ] 9 0 9
+[ 1 1 1 ] 10 0 10
+[ 1 2 0 ] 11 0 11
+[ 1 2 1 ] 12 0 12
+[ 2 0 0 ] 13 0 13
+[ 2 0 1 ] 14 0 14
+[ 2 1 0 ] 15 0 15
+[ 2 1 1 ] 16 0 16
+[ 2 2 0 ] 17 0 17
+[ 2 2 1 ] 18 0 18
+[ 3 0 0 ] 19 0 19
+[ 3 0 1 ] 20 0 20
+[ 3 1 0 ] 21 0 21
+[ 3 1 1 ] 22 0 22
+[ 3 2 0 ] 23 0 23
+[ 3 2 1 ] 24 0 24
+24 differences found
+attribute: <string of </g1>> and <string of </g1>>
+size: [2] [2]
+position string of </g1> string of </g1> difference
+------------------------------------------------------------
+[ 0 ] a z
+[ 0 ] b z
+[ 1 ] d z
+[ 1 ] e z
+4 differences found
+attribute: <string2D of </g1>> and <string2D of </g1>>
+size: [3x2] [3x2]
+position string2D of </g1> string2D of </g1> difference
+------------------------------------------------------------
+[ 0 0 ] a z
+[ 0 0 ] b z
+[ 0 1 ] c z
+[ 0 1 ] d z
+[ 1 0 ] e z
+[ 1 0 ] f z
+[ 1 1 ] g z
+[ 1 1 ] h z
+[ 2 0 ] i z
+[ 2 0 ] j z
+[ 2 1 ] k z
+[ 2 1 ] l z
+12 differences found
+attribute: <string3D of </g1>> and <string3D of </g1>>
+size: [4x3x2] [4x3x2]
+position string3D of </g1> string3D of </g1> difference
+------------------------------------------------------------
+[ 0 0 0 ] a z
+[ 0 0 0 ] b z
+[ 0 0 1 ] c z
+[ 0 0 1 ] d z
+[ 0 1 0 ] e z
+[ 0 1 0 ] f z
+[ 0 1 1 ] g z
+[ 0 1 1 ] h z
+[ 0 2 0 ] i z
+[ 0 2 0 ] j z
+[ 0 2 1 ] k z
+[ 0 2 1 ] l z
+[ 1 0 0 ] m z
+[ 1 0 0 ] n z
+[ 1 0 1 ] p z
+[ 1 0 1 ] q z
+[ 1 1 0 ] r z
+[ 1 1 0 ] s z
+[ 1 1 1 ] t z
+[ 1 1 1 ] u z
+[ 1 2 0 ] v z
+[ 1 2 0 ] w z
+[ 1 2 1 ] x z
+[ 2 0 0 ] A z
+[ 2 0 0 ] B z
+[ 2 0 1 ] C z
+[ 2 0 1 ] D z
+[ 2 1 0 ] E z
+[ 2 1 0 ] F z
+[ 2 1 1 ] G z
+[ 2 1 1 ] H z
+[ 2 2 0 ] I z
+[ 2 2 0 ] J z
+[ 2 2 1 ] K z
+[ 2 2 1 ] L z
+[ 3 0 0 ] M z
+[ 3 0 0 ] N z
+[ 3 0 1 ] P z
+[ 3 0 1 ] Q z
+[ 3 1 0 ] R z
+[ 3 1 0 ] S z
+[ 3 1 1 ] T z
+[ 3 1 1 ] U z
+[ 3 2 0 ] V z
+[ 3 2 0 ] W z
+[ 3 2 1 ] X z
+[ 3 2 1 ] Z z
+47 differences found
+attribute: <vlen of </g1>> and <vlen of </g1>>
+size: [2] [2]
+position vlen of </g1> vlen of </g1> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+[ 1 ] 3 0 3
+3 differences found
+attribute: <vlen2D of </g1>> and <vlen2D of </g1>>
+size: [3x2] [3x2]
+position vlen2D of </g1> vlen2D of </g1> difference
+------------------------------------------------------------
+[ 0 1 ] 1 0 1
+[ 1 0 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 1 1 ] 5 0 5
+[ 2 0 ] 6 0 6
+[ 2 0 ] 7 0 7
+[ 2 0 ] 8 0 8
+[ 2 1 ] 9 0 9
+[ 2 1 ] 10 0 10
+[ 2 1 ] 11 0 11
+11 differences found
+attribute: <vlen3D of </g1>> and <vlen3D of </g1>>
+size: [4x3x2] [4x3x2]
+position vlen3D of </g1> vlen3D of </g1> difference
+------------------------------------------------------------
+[ 0 0 1 ] 1 0 1
+[ 0 1 0 ] 2 0 2
+[ 0 1 1 ] 3 0 3
+[ 0 2 0 ] 4 0 4
+[ 0 2 1 ] 5 0 5
+[ 1 0 0 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 0 1 ] 9 0 9
+[ 1 1 0 ] 10 0 10
+[ 1 1 0 ] 11 0 11
+[ 1 1 1 ] 12 0 12
+[ 1 1 1 ] 13 0 13
+[ 1 2 0 ] 14 0 14
+[ 1 2 0 ] 15 0 15
+[ 1 2 1 ] 16 0 16
+[ 1 2 1 ] 17 0 17
+[ 2 0 0 ] 18 0 18
+[ 2 0 0 ] 19 0 19
+[ 2 0 0 ] 20 0 20
+[ 2 0 1 ] 21 0 21
+[ 2 0 1 ] 22 0 22
+[ 2 0 1 ] 23 0 23
+[ 2 1 0 ] 24 0 24
+[ 2 1 0 ] 25 0 25
+[ 2 1 0 ] 26 0 26
+[ 2 1 1 ] 27 0 27
+[ 2 1 1 ] 28 0 28
+[ 2 1 1 ] 29 0 29
+[ 2 2 0 ] 30 0 30
+[ 2 2 0 ] 31 0 31
+[ 2 2 0 ] 32 0 32
+[ 2 2 1 ] 33 0 33
+[ 2 2 1 ] 34 0 34
+[ 2 2 1 ] 35 0 35
+[ 3 0 0 ] 36 0 36
+[ 3 0 0 ] 37 0 37
+[ 3 0 0 ] 38 0 38
+[ 3 0 0 ] 39 0 39
+[ 3 0 1 ] 40 0 40
+[ 3 0 1 ] 41 0 41
+[ 3 0 1 ] 42 0 42
+[ 3 0 1 ] 43 0 43
+[ 3 1 0 ] 44 0 44
+[ 3 1 0 ] 45 0 45
+[ 3 1 0 ] 46 0 46
+[ 3 1 0 ] 47 0 47
+[ 3 1 1 ] 48 0 48
+[ 3 1 1 ] 49 0 49
+[ 3 1 1 ] 50 0 50
+[ 3 1 1 ] 51 0 51
+[ 3 2 0 ] 52 0 52
+[ 3 2 0 ] 53 0 53
+[ 3 2 0 ] 54 0 54
+[ 3 2 0 ] 55 0 55
+[ 3 2 1 ] 56 0 56
+[ 3 2 1 ] 57 0 57
+[ 3 2 1 ] 58 0 58
+[ 3 2 1 ] 59 0 59
+59 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/test/h5diff/testfiles/h5diff_701.txt b/tools/test/h5diff/testfiles/h5diff_701.txt
new file mode 100644
index 0000000..405ab2f
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_701.txt
@@ -0,0 +1,2137 @@
+
+file1 file2
+---------------------------------------
+ x x /
+ x x /dset
+ x x /g1
+
+
+group : </> and </>
+0 differences found
+ obj1 obj2
+ --------------------------------------
+ x x VLstring
+ x x VLstring2D
+ x x VLstring3D
+ x x array
+ x x array2D
+ x x array3D
+ x x bitfield
+ x x bitfield2D
+ x x bitfield3D
+ x x compound
+ x x compound2D
+ x x compound3D
+ x x enum
+ x x enum2D
+ x x enum3D
+ x x float
+ x x float2D
+ x x float3D
+ x x integer
+ x x integer2D
+ x x integer3D
+ x x opaque
+ x x opaque2D
+ x x opaque3D
+ x x string
+ x x string2D
+ x x string3D
+ x x vlen
+ x x vlen2D
+ x x vlen3D
+Attributes status: 30 common, 0 only in obj1, 0 only in obj2
+attribute: <VLstring of </>> and <VLstring of </>>
+size: [2] [2]
+position VLstring of </> VLstring of </> difference
+------------------------------------------------------------
+[ 0 ] a z
+[ 0 ] b z
+[ 1 ] d z
+[ 1 ] e z
+4 differences found
+attribute: <VLstring2D of </>> and <VLstring2D of </>>
+size: [3x2] [3x2]
+position VLstring2D of </> VLstring2D of </> difference
+------------------------------------------------------------
+[ 0 0 ] a z
+[ 0 0 ] b z
+[ 0 1 ] c z
+[ 0 1 ] d z
+[ 1 0 ] e z
+[ 1 0 ] f z
+[ 1 1 ] g z
+[ 1 1 ] h z
+[ 2 0 ] i z
+[ 2 0 ] j z
+[ 2 1 ] k z
+[ 2 1 ] l z
+12 differences found
+attribute: <VLstring3D of </>> and <VLstring3D of </>>
+size: [4x3x2] [4x3x2]
+position VLstring3D of </> VLstring3D of </> difference
+------------------------------------------------------------
+[ 0 0 0 ] a z
+[ 0 0 0 ] b z
+[ 0 0 1 ] c z
+[ 0 0 1 ] d z
+[ 0 1 0 ] e z
+[ 0 1 0 ] f z
+[ 0 1 1 ] g z
+[ 0 1 1 ] h z
+[ 0 2 0 ] i z
+[ 0 2 0 ] j z
+[ 0 2 1 ] k z
+[ 0 2 1 ] l z
+[ 1 0 0 ] m z
+[ 1 0 0 ] n z
+[ 1 0 1 ] p z
+[ 1 0 1 ] q z
+[ 1 1 0 ] r z
+[ 1 1 0 ] s z
+[ 1 1 1 ] t z
+[ 1 1 1 ] u z
+[ 1 2 0 ] v z
+[ 1 2 0 ] w z
+[ 1 2 1 ] x z
+[ 2 0 0 ] A z
+[ 2 0 0 ] B z
+[ 2 0 1 ] C z
+[ 2 0 1 ] D z
+[ 2 1 0 ] E z
+[ 2 1 0 ] F z
+[ 2 1 1 ] G z
+[ 2 1 1 ] H z
+[ 2 2 0 ] I z
+[ 2 2 0 ] J z
+[ 2 2 1 ] K z
+[ 2 2 1 ] L z
+[ 3 0 0 ] M z
+[ 3 0 0 ] N z
+[ 3 0 1 ] P z
+[ 3 0 1 ] Q z
+[ 3 1 0 ] R z
+[ 3 1 0 ] S z
+[ 3 1 1 ] T z
+[ 3 1 1 ] U z
+[ 3 2 0 ] V z
+[ 3 2 0 ] W z
+[ 3 2 1 ] X z
+[ 3 2 1 ] Z z
+47 differences found
+attribute: <array of </>> and <array of </>>
+size: [2] [2]
+position array of </> array of </> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 0 ] 2 0 2
+[ 0 ] 3 0 3
+[ 1 ] 4 0 4
+[ 1 ] 5 0 5
+[ 1 ] 6 0 6
+6 differences found
+attribute: <array2D of </>> and <array2D of </>>
+size: [3x2] [3x2]
+position array2D of </> array2D of </> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 0 ] 2 0 2
+[ 0 0 ] 3 0 3
+[ 0 1 ] 4 0 4
+[ 0 1 ] 5 0 5
+[ 0 1 ] 6 0 6
+[ 1 0 ] 7 0 7
+[ 1 0 ] 8 0 8
+[ 1 0 ] 9 0 9
+[ 1 1 ] 10 0 10
+[ 1 1 ] 11 0 11
+[ 1 1 ] 12 0 12
+[ 2 0 ] 13 0 13
+[ 2 0 ] 14 0 14
+[ 2 0 ] 15 0 15
+[ 2 1 ] 16 0 16
+[ 2 1 ] 17 0 17
+[ 2 1 ] 18 0 18
+18 differences found
+attribute: <array3D of </>> and <array3D of </>>
+size: [4x3x2] [4x3x2]
+position array3D of </> array3D of </> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 0 ] 2 0 2
+[ 0 0 0 ] 3 0 3
+[ 0 0 1 ] 4 0 4
+[ 0 0 1 ] 5 0 5
+[ 0 0 1 ] 6 0 6
+[ 0 1 0 ] 7 0 7
+[ 0 1 0 ] 8 0 8
+[ 0 1 0 ] 9 0 9
+[ 0 1 1 ] 10 0 10
+[ 0 1 1 ] 11 0 11
+[ 0 1 1 ] 12 0 12
+[ 0 2 0 ] 13 0 13
+[ 0 2 0 ] 14 0 14
+[ 0 2 0 ] 15 0 15
+[ 0 2 1 ] 16 0 16
+[ 0 2 1 ] 17 0 17
+[ 0 2 1 ] 18 0 18
+[ 1 0 0 ] 19 0 19
+[ 1 0 0 ] 20 0 20
+[ 1 0 0 ] 21 0 21
+[ 1 0 1 ] 22 0 22
+[ 1 0 1 ] 23 0 23
+[ 1 0 1 ] 24 0 24
+[ 1 1 0 ] 25 0 25
+[ 1 1 0 ] 26 0 26
+[ 1 1 0 ] 27 0 27
+[ 1 1 1 ] 28 0 28
+[ 1 1 1 ] 29 0 29
+[ 1 1 1 ] 30 0 30
+[ 1 2 0 ] 31 0 31
+[ 1 2 0 ] 32 0 32
+[ 1 2 0 ] 33 0 33
+[ 1 2 1 ] 34 0 34
+[ 1 2 1 ] 35 0 35
+[ 1 2 1 ] 36 0 36
+[ 2 0 0 ] 37 0 37
+[ 2 0 0 ] 38 0 38
+[ 2 0 0 ] 39 0 39
+[ 2 0 1 ] 40 0 40
+[ 2 0 1 ] 41 0 41
+[ 2 0 1 ] 42 0 42
+[ 2 1 0 ] 43 0 43
+[ 2 1 0 ] 44 0 44
+[ 2 1 0 ] 45 0 45
+[ 2 1 1 ] 46 0 46
+[ 2 1 1 ] 47 0 47
+[ 2 1 1 ] 48 0 48
+[ 2 2 0 ] 49 0 49
+[ 2 2 0 ] 50 0 50
+[ 2 2 0 ] 51 0 51
+[ 2 2 1 ] 52 0 52
+[ 2 2 1 ] 53 0 53
+[ 2 2 1 ] 54 0 54
+[ 3 0 0 ] 55 0 55
+[ 3 0 0 ] 56 0 56
+[ 3 0 0 ] 57 0 57
+[ 3 0 1 ] 58 0 58
+[ 3 0 1 ] 59 0 59
+[ 3 0 1 ] 60 0 60
+[ 3 1 0 ] 61 0 61
+[ 3 1 0 ] 62 0 62
+[ 3 1 0 ] 63 0 63
+[ 3 1 1 ] 64 0 64
+[ 3 1 1 ] 65 0 65
+[ 3 1 1 ] 66 0 66
+[ 3 2 0 ] 67 0 67
+[ 3 2 0 ] 68 0 68
+[ 3 2 0 ] 69 0 69
+[ 3 2 1 ] 70 0 70
+[ 3 2 1 ] 71 0 71
+[ 3 2 1 ] 72 0 72
+72 differences found
+attribute: <bitfield of </>> and <bitfield of </>>
+size: [2] [2]
+position bitfield of </> bitfield of </> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+2 differences found
+attribute: <bitfield2D of </>> and <bitfield2D of </>>
+size: [3x2] [3x2]
+position bitfield2D of </> bitfield2D of </> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 2 0 ] 5 0 5
+[ 2 1 ] 6 0 6
+6 differences found
+attribute: <bitfield3D of </>> and <bitfield3D of </>>
+size: [4x3x2] [4x3x2]
+position bitfield3D of </> bitfield3D of </> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 1 ] 2 0 2
+[ 0 1 0 ] 3 0 3
+[ 0 1 1 ] 4 0 4
+[ 0 2 0 ] 5 0 5
+[ 0 2 1 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 1 0 ] 9 0 9
+[ 1 1 1 ] 10 0 10
+[ 1 2 0 ] 11 0 11
+[ 1 2 1 ] 12 0 12
+[ 2 0 0 ] 13 0 13
+[ 2 0 1 ] 14 0 14
+[ 2 1 0 ] 15 0 15
+[ 2 1 1 ] 16 0 16
+[ 2 2 0 ] 17 0 17
+[ 2 2 1 ] 18 0 18
+[ 3 0 0 ] 19 0 19
+[ 3 0 1 ] 20 0 20
+[ 3 1 0 ] 21 0 21
+[ 3 1 1 ] 22 0 22
+[ 3 2 0 ] 23 0 23
+[ 3 2 1 ] 24 0 24
+24 differences found
+attribute: <compound of </>> and <compound of </>>
+size: [2] [2]
+position compound of </> compound of </> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 0 ] 2 0 2
+[ 1 ] 3 0 3
+[ 1 ] 4 0 4
+4 differences found
+attribute: <compound2D of </>> and <compound2D of </>>
+size: [3x2] [3x2]
+position compound2D of </> compound2D of </> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 0 ] 2 0 2
+[ 0 1 ] 3 0 3
+[ 0 1 ] 4 0 4
+[ 1 0 ] 5 0 5
+[ 1 0 ] 6 0 6
+[ 1 1 ] 7 0 7
+[ 1 1 ] 8 0 8
+[ 2 0 ] 9 0 9
+[ 2 0 ] 10 0 10
+[ 2 1 ] 11 0 11
+[ 2 1 ] 12 0 12
+12 differences found
+attribute: <compound3D of </>> and <compound3D of </>>
+size: [4x3x2] [4x3x2]
+position compound3D of </> compound3D of </> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 0 ] 2 0 2
+[ 0 0 1 ] 3 0 3
+[ 0 0 1 ] 4 0 4
+[ 0 1 0 ] 5 0 5
+[ 0 1 0 ] 6 0 6
+[ 0 1 1 ] 7 0 7
+[ 0 1 1 ] 8 0 8
+[ 0 2 0 ] 9 0 9
+[ 0 2 0 ] 10 0 10
+[ 0 2 1 ] 11 0 11
+[ 0 2 1 ] 12 0 12
+[ 1 0 0 ] 13 0 13
+[ 1 0 0 ] 14 0 14
+[ 1 0 1 ] 15 0 15
+[ 1 0 1 ] 16 0 16
+[ 1 1 0 ] 17 0 17
+[ 1 1 0 ] 18 0 18
+[ 1 1 1 ] 19 0 19
+[ 1 1 1 ] 20 0 20
+[ 1 2 0 ] 21 0 21
+[ 1 2 0 ] 22 0 22
+[ 1 2 1 ] 23 0 23
+[ 1 2 1 ] 24 0 24
+[ 2 0 0 ] 25 0 25
+[ 2 0 0 ] 26 0 26
+[ 2 0 1 ] 27 0 27
+[ 2 0 1 ] 28 0 28
+[ 2 1 0 ] 29 0 29
+[ 2 1 0 ] 30 0 30
+[ 2 1 1 ] 31 0 31
+[ 2 1 1 ] 32 0 32
+[ 2 2 0 ] 33 0 33
+[ 2 2 0 ] 34 0 34
+[ 2 2 1 ] 35 0 35
+[ 2 2 1 ] 36 0 36
+[ 3 0 0 ] 37 0 37
+[ 3 0 0 ] 38 0 38
+[ 3 0 1 ] 39 0 39
+[ 3 0 1 ] 40 0 40
+[ 3 1 0 ] 41 0 41
+[ 3 1 0 ] 42 0 42
+[ 3 1 1 ] 43 0 43
+[ 3 1 1 ] 44 0 44
+[ 3 2 0 ] 45 0 45
+[ 3 2 0 ] 46 0 46
+[ 3 2 1 ] 47 0 47
+[ 3 2 1 ] 48 0 48
+48 differences found
+attribute: <enum of </>> and <enum of </>>
+size: [2] [2]
+position enum of </> enum of </> difference
+------------------------------------------------------------
+[ 0 ] RED GREEN
+[ 1 ] RED GREEN
+2 differences found
+attribute: <enum2D of </>> and <enum2D of </>>
+size: [3x2] [3x2]
+position enum2D of </> enum2D of </> difference
+------------------------------------------------------------
+[ 0 0 ] RED GREEN
+[ 0 1 ] RED GREEN
+[ 1 0 ] RED GREEN
+[ 1 1 ] RED GREEN
+[ 2 0 ] RED GREEN
+[ 2 1 ] RED GREEN
+6 differences found
+attribute: <enum3D of </>> and <enum3D of </>>
+size: [4x3x2] [4x3x2]
+position enum3D of </> enum3D of </> difference
+------------------------------------------------------------
+[ 0 0 0 ] GREEN RED
+[ 0 0 1 ] GREEN RED
+[ 0 1 0 ] GREEN RED
+[ 0 1 1 ] GREEN RED
+[ 0 2 0 ] GREEN RED
+[ 0 2 1 ] GREEN RED
+[ 1 0 0 ] GREEN RED
+[ 1 0 1 ] GREEN RED
+[ 1 1 0 ] GREEN RED
+[ 1 1 1 ] GREEN RED
+[ 1 2 0 ] GREEN RED
+[ 1 2 1 ] GREEN RED
+[ 2 0 0 ] GREEN RED
+[ 2 0 1 ] GREEN RED
+[ 2 1 0 ] GREEN RED
+[ 2 1 1 ] GREEN RED
+[ 2 2 0 ] GREEN RED
+[ 2 2 1 ] GREEN RED
+[ 3 0 0 ] GREEN RED
+[ 3 0 1 ] GREEN RED
+[ 3 1 0 ] GREEN RED
+[ 3 1 1 ] GREEN RED
+[ 3 2 0 ] GREEN RED
+[ 3 2 1 ] GREEN RED
+24 differences found
+attribute: <float of </>> and <float of </>>
+size: [2] [2]
+position float of </> float of </> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+2 differences found
+attribute: <float2D of </>> and <float2D of </>>
+size: [3x2] [3x2]
+position float2D of </> float2D of </> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 2 0 ] 5 0 5
+[ 2 1 ] 6 0 6
+6 differences found
+attribute: <float3D of </>> and <float3D of </>>
+size: [4x3x2] [4x3x2]
+position float3D of </> float3D of </> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 1 ] 2 0 2
+[ 0 1 0 ] 3 0 3
+[ 0 1 1 ] 4 0 4
+[ 0 2 0 ] 5 0 5
+[ 0 2 1 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 1 0 ] 9 0 9
+[ 1 1 1 ] 10 0 10
+[ 1 2 0 ] 11 0 11
+[ 1 2 1 ] 12 0 12
+[ 2 0 0 ] 13 0 13
+[ 2 0 1 ] 14 0 14
+[ 2 1 0 ] 15 0 15
+[ 2 1 1 ] 16 0 16
+[ 2 2 0 ] 17 0 17
+[ 2 2 1 ] 18 0 18
+[ 3 0 0 ] 19 0 19
+[ 3 0 1 ] 20 0 20
+[ 3 1 0 ] 21 0 21
+[ 3 1 1 ] 22 0 22
+[ 3 2 0 ] 23 0 23
+[ 3 2 1 ] 24 0 24
+24 differences found
+attribute: <integer of </>> and <integer of </>>
+size: [2] [2]
+position integer of </> integer of </> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+2 differences found
+attribute: <integer2D of </>> and <integer2D of </>>
+size: [3x2] [3x2]
+position integer2D of </> integer2D of </> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 2 0 ] 5 0 5
+[ 2 1 ] 6 0 6
+6 differences found
+attribute: <integer3D of </>> and <integer3D of </>>
+size: [4x3x2] [4x3x2]
+position integer3D of </> integer3D of </> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 1 ] 2 0 2
+[ 0 1 0 ] 3 0 3
+[ 0 1 1 ] 4 0 4
+[ 0 2 0 ] 5 0 5
+[ 0 2 1 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 1 0 ] 9 0 9
+[ 1 1 1 ] 10 0 10
+[ 1 2 0 ] 11 0 11
+[ 1 2 1 ] 12 0 12
+[ 2 0 0 ] 13 0 13
+[ 2 0 1 ] 14 0 14
+[ 2 1 0 ] 15 0 15
+[ 2 1 1 ] 16 0 16
+[ 2 2 0 ] 17 0 17
+[ 2 2 1 ] 18 0 18
+[ 3 0 0 ] 19 0 19
+[ 3 0 1 ] 20 0 20
+[ 3 1 0 ] 21 0 21
+[ 3 1 1 ] 22 0 22
+[ 3 2 0 ] 23 0 23
+[ 3 2 1 ] 24 0 24
+24 differences found
+attribute: <opaque of </>> and <opaque of </>>
+size: [2] [2]
+position opaque of </> opaque of </> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+2 differences found
+attribute: <opaque2D of </>> and <opaque2D of </>>
+size: [3x2] [3x2]
+position opaque2D of </> opaque2D of </> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 2 0 ] 5 0 5
+[ 2 1 ] 6 0 6
+6 differences found
+attribute: <opaque3D of </>> and <opaque3D of </>>
+size: [4x3x2] [4x3x2]
+position opaque3D of </> opaque3D of </> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 1 ] 2 0 2
+[ 0 1 0 ] 3 0 3
+[ 0 1 1 ] 4 0 4
+[ 0 2 0 ] 5 0 5
+[ 0 2 1 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 1 0 ] 9 0 9
+[ 1 1 1 ] 10 0 10
+[ 1 2 0 ] 11 0 11
+[ 1 2 1 ] 12 0 12
+[ 2 0 0 ] 13 0 13
+[ 2 0 1 ] 14 0 14
+[ 2 1 0 ] 15 0 15
+[ 2 1 1 ] 16 0 16
+[ 2 2 0 ] 17 0 17
+[ 2 2 1 ] 18 0 18
+[ 3 0 0 ] 19 0 19
+[ 3 0 1 ] 20 0 20
+[ 3 1 0 ] 21 0 21
+[ 3 1 1 ] 22 0 22
+[ 3 2 0 ] 23 0 23
+[ 3 2 1 ] 24 0 24
+24 differences found
+attribute: <string of </>> and <string of </>>
+size: [2] [2]
+position string of </> string of </> difference
+------------------------------------------------------------
+[ 0 ] a z
+[ 0 ] b z
+[ 1 ] d z
+[ 1 ] e z
+4 differences found
+attribute: <string2D of </>> and <string2D of </>>
+size: [3x2] [3x2]
+position string2D of </> string2D of </> difference
+------------------------------------------------------------
+[ 0 0 ] a z
+[ 0 0 ] b z
+[ 0 1 ] c z
+[ 0 1 ] d z
+[ 1 0 ] e z
+[ 1 0 ] f z
+[ 1 1 ] g z
+[ 1 1 ] h z
+[ 2 0 ] i z
+[ 2 0 ] j z
+[ 2 1 ] k z
+[ 2 1 ] l z
+12 differences found
+attribute: <string3D of </>> and <string3D of </>>
+size: [4x3x2] [4x3x2]
+position string3D of </> string3D of </> difference
+------------------------------------------------------------
+[ 0 0 0 ] a z
+[ 0 0 0 ] b z
+[ 0 0 1 ] c z
+[ 0 0 1 ] d z
+[ 0 1 0 ] e z
+[ 0 1 0 ] f z
+[ 0 1 1 ] g z
+[ 0 1 1 ] h z
+[ 0 2 0 ] i z
+[ 0 2 0 ] j z
+[ 0 2 1 ] k z
+[ 0 2 1 ] l z
+[ 1 0 0 ] m z
+[ 1 0 0 ] n z
+[ 1 0 1 ] p z
+[ 1 0 1 ] q z
+[ 1 1 0 ] r z
+[ 1 1 0 ] s z
+[ 1 1 1 ] t z
+[ 1 1 1 ] u z
+[ 1 2 0 ] v z
+[ 1 2 0 ] w z
+[ 1 2 1 ] x z
+[ 2 0 0 ] A z
+[ 2 0 0 ] B z
+[ 2 0 1 ] C z
+[ 2 0 1 ] D z
+[ 2 1 0 ] E z
+[ 2 1 0 ] F z
+[ 2 1 1 ] G z
+[ 2 1 1 ] H z
+[ 2 2 0 ] I z
+[ 2 2 0 ] J z
+[ 2 2 1 ] K z
+[ 2 2 1 ] L z
+[ 3 0 0 ] M z
+[ 3 0 0 ] N z
+[ 3 0 1 ] P z
+[ 3 0 1 ] Q z
+[ 3 1 0 ] R z
+[ 3 1 0 ] S z
+[ 3 1 1 ] T z
+[ 3 1 1 ] U z
+[ 3 2 0 ] V z
+[ 3 2 0 ] W z
+[ 3 2 1 ] X z
+[ 3 2 1 ] Z z
+47 differences found
+attribute: <vlen of </>> and <vlen of </>>
+size: [2] [2]
+position vlen of </> vlen of </> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+[ 1 ] 3 0 3
+3 differences found
+attribute: <vlen2D of </>> and <vlen2D of </>>
+size: [3x2] [3x2]
+position vlen2D of </> vlen2D of </> difference
+------------------------------------------------------------
+[ 0 1 ] 1 0 1
+[ 1 0 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 1 1 ] 5 0 5
+[ 2 0 ] 6 0 6
+[ 2 0 ] 7 0 7
+[ 2 0 ] 8 0 8
+[ 2 1 ] 9 0 9
+[ 2 1 ] 10 0 10
+[ 2 1 ] 11 0 11
+11 differences found
+attribute: <vlen3D of </>> and <vlen3D of </>>
+size: [4x3x2] [4x3x2]
+position vlen3D of </> vlen3D of </> difference
+------------------------------------------------------------
+[ 0 0 1 ] 1 0 1
+[ 0 1 0 ] 2 0 2
+[ 0 1 1 ] 3 0 3
+[ 0 2 0 ] 4 0 4
+[ 0 2 1 ] 5 0 5
+[ 1 0 0 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 0 1 ] 9 0 9
+[ 1 1 0 ] 10 0 10
+[ 1 1 0 ] 11 0 11
+[ 1 1 1 ] 12 0 12
+[ 1 1 1 ] 13 0 13
+[ 1 2 0 ] 14 0 14
+[ 1 2 0 ] 15 0 15
+[ 1 2 1 ] 16 0 16
+[ 1 2 1 ] 17 0 17
+[ 2 0 0 ] 18 0 18
+[ 2 0 0 ] 19 0 19
+[ 2 0 0 ] 20 0 20
+[ 2 0 1 ] 21 0 21
+[ 2 0 1 ] 22 0 22
+[ 2 0 1 ] 23 0 23
+[ 2 1 0 ] 24 0 24
+[ 2 1 0 ] 25 0 25
+[ 2 1 0 ] 26 0 26
+[ 2 1 1 ] 27 0 27
+[ 2 1 1 ] 28 0 28
+[ 2 1 1 ] 29 0 29
+[ 2 2 0 ] 30 0 30
+[ 2 2 0 ] 31 0 31
+[ 2 2 0 ] 32 0 32
+[ 2 2 1 ] 33 0 33
+[ 2 2 1 ] 34 0 34
+[ 2 2 1 ] 35 0 35
+[ 3 0 0 ] 36 0 36
+[ 3 0 0 ] 37 0 37
+[ 3 0 0 ] 38 0 38
+[ 3 0 0 ] 39 0 39
+[ 3 0 1 ] 40 0 40
+[ 3 0 1 ] 41 0 41
+[ 3 0 1 ] 42 0 42
+[ 3 0 1 ] 43 0 43
+[ 3 1 0 ] 44 0 44
+[ 3 1 0 ] 45 0 45
+[ 3 1 0 ] 46 0 46
+[ 3 1 0 ] 47 0 47
+[ 3 1 1 ] 48 0 48
+[ 3 1 1 ] 49 0 49
+[ 3 1 1 ] 50 0 50
+[ 3 1 1 ] 51 0 51
+[ 3 2 0 ] 52 0 52
+[ 3 2 0 ] 53 0 53
+[ 3 2 0 ] 54 0 54
+[ 3 2 0 ] 55 0 55
+[ 3 2 1 ] 56 0 56
+[ 3 2 1 ] 57 0 57
+[ 3 2 1 ] 58 0 58
+[ 3 2 1 ] 59 0 59
+59 differences found
+
+dataset: </dset> and </dset>
+Not comparable: </dset> or </dset> is an empty dataset
+0 differences found
+ obj1 obj2
+ --------------------------------------
+ x x VLstring
+ x x VLstring2D
+ x x VLstring3D
+ x x array
+ x x array2D
+ x x array3D
+ x x bitfield
+ x x bitfield2D
+ x x bitfield3D
+ x x compound
+ x x compound2D
+ x x compound3D
+ x x enum
+ x x enum2D
+ x x enum3D
+ x x float
+ x x float2D
+ x x float3D
+ x x integer
+ x x integer2D
+ x x integer3D
+ x x opaque
+ x x opaque2D
+ x x opaque3D
+ x x reference
+ x x reference2D
+ x x reference3D
+ x x string
+ x x string2D
+ x x string3D
+ x x vlen
+ x x vlen2D
+ x x vlen3D
+Attributes status: 33 common, 0 only in obj1, 0 only in obj2
+attribute: <VLstring of </dset>> and <VLstring of </dset>>
+size: [2] [2]
+position VLstring of </dset> VLstring of </dset> difference
+------------------------------------------------------------
+[ 0 ] a z
+[ 0 ] b z
+[ 1 ] d z
+[ 1 ] e z
+4 differences found
+attribute: <VLstring2D of </dset>> and <VLstring2D of </dset>>
+size: [3x2] [3x2]
+position VLstring2D of </dset> VLstring2D of </dset> difference
+------------------------------------------------------------
+[ 0 0 ] a z
+[ 0 0 ] b z
+[ 0 1 ] c z
+[ 0 1 ] d z
+[ 1 0 ] e z
+[ 1 0 ] f z
+[ 1 1 ] g z
+[ 1 1 ] h z
+[ 2 0 ] i z
+[ 2 0 ] j z
+[ 2 1 ] k z
+[ 2 1 ] l z
+12 differences found
+attribute: <VLstring3D of </dset>> and <VLstring3D of </dset>>
+size: [4x3x2] [4x3x2]
+position VLstring3D of </dset> VLstring3D of </dset> difference
+------------------------------------------------------------
+[ 0 0 0 ] a z
+[ 0 0 0 ] b z
+[ 0 0 1 ] c z
+[ 0 0 1 ] d z
+[ 0 1 0 ] e z
+[ 0 1 0 ] f z
+[ 0 1 1 ] g z
+[ 0 1 1 ] h z
+[ 0 2 0 ] i z
+[ 0 2 0 ] j z
+[ 0 2 1 ] k z
+[ 0 2 1 ] l z
+[ 1 0 0 ] m z
+[ 1 0 0 ] n z
+[ 1 0 1 ] p z
+[ 1 0 1 ] q z
+[ 1 1 0 ] r z
+[ 1 1 0 ] s z
+[ 1 1 1 ] t z
+[ 1 1 1 ] u z
+[ 1 2 0 ] v z
+[ 1 2 0 ] w z
+[ 1 2 1 ] x z
+[ 2 0 0 ] A z
+[ 2 0 0 ] B z
+[ 2 0 1 ] C z
+[ 2 0 1 ] D z
+[ 2 1 0 ] E z
+[ 2 1 0 ] F z
+[ 2 1 1 ] G z
+[ 2 1 1 ] H z
+[ 2 2 0 ] I z
+[ 2 2 0 ] J z
+[ 2 2 1 ] K z
+[ 2 2 1 ] L z
+[ 3 0 0 ] M z
+[ 3 0 0 ] N z
+[ 3 0 1 ] P z
+[ 3 0 1 ] Q z
+[ 3 1 0 ] R z
+[ 3 1 0 ] S z
+[ 3 1 1 ] T z
+[ 3 1 1 ] U z
+[ 3 2 0 ] V z
+[ 3 2 0 ] W z
+[ 3 2 1 ] X z
+[ 3 2 1 ] Z z
+47 differences found
+attribute: <array of </dset>> and <array of </dset>>
+size: [2] [2]
+position array of </dset> array of </dset> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 0 ] 2 0 2
+[ 0 ] 3 0 3
+[ 1 ] 4 0 4
+[ 1 ] 5 0 5
+[ 1 ] 6 0 6
+6 differences found
+attribute: <array2D of </dset>> and <array2D of </dset>>
+size: [3x2] [3x2]
+position array2D of </dset> array2D of </dset> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 0 ] 2 0 2
+[ 0 0 ] 3 0 3
+[ 0 1 ] 4 0 4
+[ 0 1 ] 5 0 5
+[ 0 1 ] 6 0 6
+[ 1 0 ] 7 0 7
+[ 1 0 ] 8 0 8
+[ 1 0 ] 9 0 9
+[ 1 1 ] 10 0 10
+[ 1 1 ] 11 0 11
+[ 1 1 ] 12 0 12
+[ 2 0 ] 13 0 13
+[ 2 0 ] 14 0 14
+[ 2 0 ] 15 0 15
+[ 2 1 ] 16 0 16
+[ 2 1 ] 17 0 17
+[ 2 1 ] 18 0 18
+18 differences found
+attribute: <array3D of </dset>> and <array3D of </dset>>
+size: [4x3x2] [4x3x2]
+position array3D of </dset> array3D of </dset> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 0 ] 2 0 2
+[ 0 0 0 ] 3 0 3
+[ 0 0 1 ] 4 0 4
+[ 0 0 1 ] 5 0 5
+[ 0 0 1 ] 6 0 6
+[ 0 1 0 ] 7 0 7
+[ 0 1 0 ] 8 0 8
+[ 0 1 0 ] 9 0 9
+[ 0 1 1 ] 10 0 10
+[ 0 1 1 ] 11 0 11
+[ 0 1 1 ] 12 0 12
+[ 0 2 0 ] 13 0 13
+[ 0 2 0 ] 14 0 14
+[ 0 2 0 ] 15 0 15
+[ 0 2 1 ] 16 0 16
+[ 0 2 1 ] 17 0 17
+[ 0 2 1 ] 18 0 18
+[ 1 0 0 ] 19 0 19
+[ 1 0 0 ] 20 0 20
+[ 1 0 0 ] 21 0 21
+[ 1 0 1 ] 22 0 22
+[ 1 0 1 ] 23 0 23
+[ 1 0 1 ] 24 0 24
+[ 1 1 0 ] 25 0 25
+[ 1 1 0 ] 26 0 26
+[ 1 1 0 ] 27 0 27
+[ 1 1 1 ] 28 0 28
+[ 1 1 1 ] 29 0 29
+[ 1 1 1 ] 30 0 30
+[ 1 2 0 ] 31 0 31
+[ 1 2 0 ] 32 0 32
+[ 1 2 0 ] 33 0 33
+[ 1 2 1 ] 34 0 34
+[ 1 2 1 ] 35 0 35
+[ 1 2 1 ] 36 0 36
+[ 2 0 0 ] 37 0 37
+[ 2 0 0 ] 38 0 38
+[ 2 0 0 ] 39 0 39
+[ 2 0 1 ] 40 0 40
+[ 2 0 1 ] 41 0 41
+[ 2 0 1 ] 42 0 42
+[ 2 1 0 ] 43 0 43
+[ 2 1 0 ] 44 0 44
+[ 2 1 0 ] 45 0 45
+[ 2 1 1 ] 46 0 46
+[ 2 1 1 ] 47 0 47
+[ 2 1 1 ] 48 0 48
+[ 2 2 0 ] 49 0 49
+[ 2 2 0 ] 50 0 50
+[ 2 2 0 ] 51 0 51
+[ 2 2 1 ] 52 0 52
+[ 2 2 1 ] 53 0 53
+[ 2 2 1 ] 54 0 54
+[ 3 0 0 ] 55 0 55
+[ 3 0 0 ] 56 0 56
+[ 3 0 0 ] 57 0 57
+[ 3 0 1 ] 58 0 58
+[ 3 0 1 ] 59 0 59
+[ 3 0 1 ] 60 0 60
+[ 3 1 0 ] 61 0 61
+[ 3 1 0 ] 62 0 62
+[ 3 1 0 ] 63 0 63
+[ 3 1 1 ] 64 0 64
+[ 3 1 1 ] 65 0 65
+[ 3 1 1 ] 66 0 66
+[ 3 2 0 ] 67 0 67
+[ 3 2 0 ] 68 0 68
+[ 3 2 0 ] 69 0 69
+[ 3 2 1 ] 70 0 70
+[ 3 2 1 ] 71 0 71
+[ 3 2 1 ] 72 0 72
+72 differences found
+attribute: <bitfield of </dset>> and <bitfield of </dset>>
+size: [2] [2]
+position bitfield of </dset> bitfield of </dset> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+2 differences found
+attribute: <bitfield2D of </dset>> and <bitfield2D of </dset>>
+size: [3x2] [3x2]
+position bitfield2D of </dset> bitfield2D of </dset> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 2 0 ] 5 0 5
+[ 2 1 ] 6 0 6
+6 differences found
+attribute: <bitfield3D of </dset>> and <bitfield3D of </dset>>
+size: [4x3x2] [4x3x2]
+position bitfield3D of </dset> bitfield3D of </dset> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 1 ] 2 0 2
+[ 0 1 0 ] 3 0 3
+[ 0 1 1 ] 4 0 4
+[ 0 2 0 ] 5 0 5
+[ 0 2 1 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 1 0 ] 9 0 9
+[ 1 1 1 ] 10 0 10
+[ 1 2 0 ] 11 0 11
+[ 1 2 1 ] 12 0 12
+[ 2 0 0 ] 13 0 13
+[ 2 0 1 ] 14 0 14
+[ 2 1 0 ] 15 0 15
+[ 2 1 1 ] 16 0 16
+[ 2 2 0 ] 17 0 17
+[ 2 2 1 ] 18 0 18
+[ 3 0 0 ] 19 0 19
+[ 3 0 1 ] 20 0 20
+[ 3 1 0 ] 21 0 21
+[ 3 1 1 ] 22 0 22
+[ 3 2 0 ] 23 0 23
+[ 3 2 1 ] 24 0 24
+24 differences found
+attribute: <compound of </dset>> and <compound of </dset>>
+size: [2] [2]
+position compound of </dset> compound of </dset> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 0 ] 2 0 2
+[ 1 ] 3 0 3
+[ 1 ] 4 0 4
+4 differences found
+attribute: <compound2D of </dset>> and <compound2D of </dset>>
+size: [3x2] [3x2]
+position compound2D of </dset> compound2D of </dset> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 0 ] 2 0 2
+[ 0 1 ] 3 0 3
+[ 0 1 ] 4 0 4
+[ 1 0 ] 5 0 5
+[ 1 0 ] 6 0 6
+[ 1 1 ] 7 0 7
+[ 1 1 ] 8 0 8
+[ 2 0 ] 9 0 9
+[ 2 0 ] 10 0 10
+[ 2 1 ] 11 0 11
+[ 2 1 ] 12 0 12
+12 differences found
+attribute: <compound3D of </dset>> and <compound3D of </dset>>
+size: [4x3x2] [4x3x2]
+position compound3D of </dset> compound3D of </dset> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 0 ] 2 0 2
+[ 0 0 1 ] 3 0 3
+[ 0 0 1 ] 4 0 4
+[ 0 1 0 ] 5 0 5
+[ 0 1 0 ] 6 0 6
+[ 0 1 1 ] 7 0 7
+[ 0 1 1 ] 8 0 8
+[ 0 2 0 ] 9 0 9
+[ 0 2 0 ] 10 0 10
+[ 0 2 1 ] 11 0 11
+[ 0 2 1 ] 12 0 12
+[ 1 0 0 ] 13 0 13
+[ 1 0 0 ] 14 0 14
+[ 1 0 1 ] 15 0 15
+[ 1 0 1 ] 16 0 16
+[ 1 1 0 ] 17 0 17
+[ 1 1 0 ] 18 0 18
+[ 1 1 1 ] 19 0 19
+[ 1 1 1 ] 20 0 20
+[ 1 2 0 ] 21 0 21
+[ 1 2 0 ] 22 0 22
+[ 1 2 1 ] 23 0 23
+[ 1 2 1 ] 24 0 24
+[ 2 0 0 ] 25 0 25
+[ 2 0 0 ] 26 0 26
+[ 2 0 1 ] 27 0 27
+[ 2 0 1 ] 28 0 28
+[ 2 1 0 ] 29 0 29
+[ 2 1 0 ] 30 0 30
+[ 2 1 1 ] 31 0 31
+[ 2 1 1 ] 32 0 32
+[ 2 2 0 ] 33 0 33
+[ 2 2 0 ] 34 0 34
+[ 2 2 1 ] 35 0 35
+[ 2 2 1 ] 36 0 36
+[ 3 0 0 ] 37 0 37
+[ 3 0 0 ] 38 0 38
+[ 3 0 1 ] 39 0 39
+[ 3 0 1 ] 40 0 40
+[ 3 1 0 ] 41 0 41
+[ 3 1 0 ] 42 0 42
+[ 3 1 1 ] 43 0 43
+[ 3 1 1 ] 44 0 44
+[ 3 2 0 ] 45 0 45
+[ 3 2 0 ] 46 0 46
+[ 3 2 1 ] 47 0 47
+[ 3 2 1 ] 48 0 48
+48 differences found
+attribute: <enum of </dset>> and <enum of </dset>>
+size: [2] [2]
+position enum of </dset> enum of </dset> difference
+------------------------------------------------------------
+[ 0 ] RED GREEN
+[ 1 ] RED GREEN
+2 differences found
+attribute: <enum2D of </dset>> and <enum2D of </dset>>
+size: [3x2] [3x2]
+position enum2D of </dset> enum2D of </dset> difference
+------------------------------------------------------------
+[ 0 0 ] RED GREEN
+[ 0 1 ] RED GREEN
+[ 1 0 ] RED GREEN
+[ 1 1 ] RED GREEN
+[ 2 0 ] RED GREEN
+[ 2 1 ] RED GREEN
+6 differences found
+attribute: <enum3D of </dset>> and <enum3D of </dset>>
+size: [4x3x2] [4x3x2]
+position enum3D of </dset> enum3D of </dset> difference
+------------------------------------------------------------
+[ 0 0 0 ] GREEN RED
+[ 0 0 1 ] GREEN RED
+[ 0 1 0 ] GREEN RED
+[ 0 1 1 ] GREEN RED
+[ 0 2 0 ] GREEN RED
+[ 0 2 1 ] GREEN RED
+[ 1 0 0 ] GREEN RED
+[ 1 0 1 ] GREEN RED
+[ 1 1 0 ] GREEN RED
+[ 1 1 1 ] GREEN RED
+[ 1 2 0 ] GREEN RED
+[ 1 2 1 ] GREEN RED
+[ 2 0 0 ] GREEN RED
+[ 2 0 1 ] GREEN RED
+[ 2 1 0 ] GREEN RED
+[ 2 1 1 ] GREEN RED
+[ 2 2 0 ] GREEN RED
+[ 2 2 1 ] GREEN RED
+[ 3 0 0 ] GREEN RED
+[ 3 0 1 ] GREEN RED
+[ 3 1 0 ] GREEN RED
+[ 3 1 1 ] GREEN RED
+[ 3 2 0 ] GREEN RED
+[ 3 2 1 ] GREEN RED
+24 differences found
+attribute: <float of </dset>> and <float of </dset>>
+size: [2] [2]
+position float of </dset> float of </dset> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+2 differences found
+attribute: <float2D of </dset>> and <float2D of </dset>>
+size: [3x2] [3x2]
+position float2D of </dset> float2D of </dset> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 2 0 ] 5 0 5
+[ 2 1 ] 6 0 6
+6 differences found
+attribute: <float3D of </dset>> and <float3D of </dset>>
+size: [4x3x2] [4x3x2]
+position float3D of </dset> float3D of </dset> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 1 ] 2 0 2
+[ 0 1 0 ] 3 0 3
+[ 0 1 1 ] 4 0 4
+[ 0 2 0 ] 5 0 5
+[ 0 2 1 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 1 0 ] 9 0 9
+[ 1 1 1 ] 10 0 10
+[ 1 2 0 ] 11 0 11
+[ 1 2 1 ] 12 0 12
+[ 2 0 0 ] 13 0 13
+[ 2 0 1 ] 14 0 14
+[ 2 1 0 ] 15 0 15
+[ 2 1 1 ] 16 0 16
+[ 2 2 0 ] 17 0 17
+[ 2 2 1 ] 18 0 18
+[ 3 0 0 ] 19 0 19
+[ 3 0 1 ] 20 0 20
+[ 3 1 0 ] 21 0 21
+[ 3 1 1 ] 22 0 22
+[ 3 2 0 ] 23 0 23
+[ 3 2 1 ] 24 0 24
+24 differences found
+attribute: <integer of </dset>> and <integer of </dset>>
+size: [2] [2]
+position integer of </dset> integer of </dset> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+2 differences found
+attribute: <integer2D of </dset>> and <integer2D of </dset>>
+size: [3x2] [3x2]
+position integer2D of </dset> integer2D of </dset> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 2 0 ] 5 0 5
+[ 2 1 ] 6 0 6
+6 differences found
+attribute: <integer3D of </dset>> and <integer3D of </dset>>
+size: [4x3x2] [4x3x2]
+position integer3D of </dset> integer3D of </dset> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 1 ] 2 0 2
+[ 0 1 0 ] 3 0 3
+[ 0 1 1 ] 4 0 4
+[ 0 2 0 ] 5 0 5
+[ 0 2 1 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 1 0 ] 9 0 9
+[ 1 1 1 ] 10 0 10
+[ 1 2 0 ] 11 0 11
+[ 1 2 1 ] 12 0 12
+[ 2 0 0 ] 13 0 13
+[ 2 0 1 ] 14 0 14
+[ 2 1 0 ] 15 0 15
+[ 2 1 1 ] 16 0 16
+[ 2 2 0 ] 17 0 17
+[ 2 2 1 ] 18 0 18
+[ 3 0 0 ] 19 0 19
+[ 3 0 1 ] 20 0 20
+[ 3 1 0 ] 21 0 21
+[ 3 1 1 ] 22 0 22
+[ 3 2 0 ] 23 0 23
+[ 3 2 1 ] 24 0 24
+24 differences found
+attribute: <opaque of </dset>> and <opaque of </dset>>
+size: [2] [2]
+position opaque of </dset> opaque of </dset> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+2 differences found
+attribute: <opaque2D of </dset>> and <opaque2D of </dset>>
+size: [3x2] [3x2]
+position opaque2D of </dset> opaque2D of </dset> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 2 0 ] 5 0 5
+[ 2 1 ] 6 0 6
+6 differences found
+attribute: <opaque3D of </dset>> and <opaque3D of </dset>>
+size: [4x3x2] [4x3x2]
+position opaque3D of </dset> opaque3D of </dset> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 1 ] 2 0 2
+[ 0 1 0 ] 3 0 3
+[ 0 1 1 ] 4 0 4
+[ 0 2 0 ] 5 0 5
+[ 0 2 1 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 1 0 ] 9 0 9
+[ 1 1 1 ] 10 0 10
+[ 1 2 0 ] 11 0 11
+[ 1 2 1 ] 12 0 12
+[ 2 0 0 ] 13 0 13
+[ 2 0 1 ] 14 0 14
+[ 2 1 0 ] 15 0 15
+[ 2 1 1 ] 16 0 16
+[ 2 2 0 ] 17 0 17
+[ 2 2 1 ] 18 0 18
+[ 3 0 0 ] 19 0 19
+[ 3 0 1 ] 20 0 20
+[ 3 1 0 ] 21 0 21
+[ 3 1 1 ] 22 0 22
+[ 3 2 0 ] 23 0 23
+[ 3 2 1 ] 24 0 24
+24 differences found
+attribute: <reference of </dset>> and <reference of </dset>>
+0 differences found
+attribute: <reference2D of </dset>> and <reference2D of </dset>>
+0 differences found
+attribute: <reference3D of </dset>> and <reference3D of </dset>>
+0 differences found
+attribute: <string of </dset>> and <string of </dset>>
+size: [2] [2]
+position string of </dset> string of </dset> difference
+------------------------------------------------------------
+[ 0 ] a z
+[ 0 ] b z
+[ 1 ] d z
+[ 1 ] e z
+4 differences found
+attribute: <string2D of </dset>> and <string2D of </dset>>
+size: [3x2] [3x2]
+position string2D of </dset> string2D of </dset> difference
+------------------------------------------------------------
+[ 0 0 ] a z
+[ 0 0 ] b z
+[ 0 1 ] c z
+[ 0 1 ] d z
+[ 1 0 ] e z
+[ 1 0 ] f z
+[ 1 1 ] g z
+[ 1 1 ] h z
+[ 2 0 ] i z
+[ 2 0 ] j z
+[ 2 1 ] k z
+[ 2 1 ] l z
+12 differences found
+attribute: <string3D of </dset>> and <string3D of </dset>>
+size: [4x3x2] [4x3x2]
+position string3D of </dset> string3D of </dset> difference
+------------------------------------------------------------
+[ 0 0 0 ] a z
+[ 0 0 0 ] b z
+[ 0 0 1 ] c z
+[ 0 0 1 ] d z
+[ 0 1 0 ] e z
+[ 0 1 0 ] f z
+[ 0 1 1 ] g z
+[ 0 1 1 ] h z
+[ 0 2 0 ] i z
+[ 0 2 0 ] j z
+[ 0 2 1 ] k z
+[ 0 2 1 ] l z
+[ 1 0 0 ] m z
+[ 1 0 0 ] n z
+[ 1 0 1 ] p z
+[ 1 0 1 ] q z
+[ 1 1 0 ] r z
+[ 1 1 0 ] s z
+[ 1 1 1 ] t z
+[ 1 1 1 ] u z
+[ 1 2 0 ] v z
+[ 1 2 0 ] w z
+[ 1 2 1 ] x z
+[ 2 0 0 ] A z
+[ 2 0 0 ] B z
+[ 2 0 1 ] C z
+[ 2 0 1 ] D z
+[ 2 1 0 ] E z
+[ 2 1 0 ] F z
+[ 2 1 1 ] G z
+[ 2 1 1 ] H z
+[ 2 2 0 ] I z
+[ 2 2 0 ] J z
+[ 2 2 1 ] K z
+[ 2 2 1 ] L z
+[ 3 0 0 ] M z
+[ 3 0 0 ] N z
+[ 3 0 1 ] P z
+[ 3 0 1 ] Q z
+[ 3 1 0 ] R z
+[ 3 1 0 ] S z
+[ 3 1 1 ] T z
+[ 3 1 1 ] U z
+[ 3 2 0 ] V z
+[ 3 2 0 ] W z
+[ 3 2 1 ] X z
+[ 3 2 1 ] Z z
+47 differences found
+attribute: <vlen of </dset>> and <vlen of </dset>>
+size: [2] [2]
+position vlen of </dset> vlen of </dset> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+[ 1 ] 3 0 3
+3 differences found
+attribute: <vlen2D of </dset>> and <vlen2D of </dset>>
+size: [3x2] [3x2]
+position vlen2D of </dset> vlen2D of </dset> difference
+------------------------------------------------------------
+[ 0 1 ] 1 0 1
+[ 1 0 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 1 1 ] 5 0 5
+[ 2 0 ] 6 0 6
+[ 2 0 ] 7 0 7
+[ 2 0 ] 8 0 8
+[ 2 1 ] 9 0 9
+[ 2 1 ] 10 0 10
+[ 2 1 ] 11 0 11
+11 differences found
+attribute: <vlen3D of </dset>> and <vlen3D of </dset>>
+size: [4x3x2] [4x3x2]
+position vlen3D of </dset> vlen3D of </dset> difference
+------------------------------------------------------------
+[ 0 0 1 ] 1 0 1
+[ 0 1 0 ] 2 0 2
+[ 0 1 1 ] 3 0 3
+[ 0 2 0 ] 4 0 4
+[ 0 2 1 ] 5 0 5
+[ 1 0 0 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 0 1 ] 9 0 9
+[ 1 1 0 ] 10 0 10
+[ 1 1 0 ] 11 0 11
+[ 1 1 1 ] 12 0 12
+[ 1 1 1 ] 13 0 13
+[ 1 2 0 ] 14 0 14
+[ 1 2 0 ] 15 0 15
+[ 1 2 1 ] 16 0 16
+[ 1 2 1 ] 17 0 17
+[ 2 0 0 ] 18 0 18
+[ 2 0 0 ] 19 0 19
+[ 2 0 0 ] 20 0 20
+[ 2 0 1 ] 21 0 21
+[ 2 0 1 ] 22 0 22
+[ 2 0 1 ] 23 0 23
+[ 2 1 0 ] 24 0 24
+[ 2 1 0 ] 25 0 25
+[ 2 1 0 ] 26 0 26
+[ 2 1 1 ] 27 0 27
+[ 2 1 1 ] 28 0 28
+[ 2 1 1 ] 29 0 29
+[ 2 2 0 ] 30 0 30
+[ 2 2 0 ] 31 0 31
+[ 2 2 0 ] 32 0 32
+[ 2 2 1 ] 33 0 33
+[ 2 2 1 ] 34 0 34
+[ 2 2 1 ] 35 0 35
+[ 3 0 0 ] 36 0 36
+[ 3 0 0 ] 37 0 37
+[ 3 0 0 ] 38 0 38
+[ 3 0 0 ] 39 0 39
+[ 3 0 1 ] 40 0 40
+[ 3 0 1 ] 41 0 41
+[ 3 0 1 ] 42 0 42
+[ 3 0 1 ] 43 0 43
+[ 3 1 0 ] 44 0 44
+[ 3 1 0 ] 45 0 45
+[ 3 1 0 ] 46 0 46
+[ 3 1 0 ] 47 0 47
+[ 3 1 1 ] 48 0 48
+[ 3 1 1 ] 49 0 49
+[ 3 1 1 ] 50 0 50
+[ 3 1 1 ] 51 0 51
+[ 3 2 0 ] 52 0 52
+[ 3 2 0 ] 53 0 53
+[ 3 2 0 ] 54 0 54
+[ 3 2 0 ] 55 0 55
+[ 3 2 1 ] 56 0 56
+[ 3 2 1 ] 57 0 57
+[ 3 2 1 ] 58 0 58
+[ 3 2 1 ] 59 0 59
+59 differences found
+
+group : </g1> and </g1>
+0 differences found
+ obj1 obj2
+ --------------------------------------
+ x x VLstring
+ x x VLstring2D
+ x x VLstring3D
+ x x array
+ x x array2D
+ x x array3D
+ x x bitfield
+ x x bitfield2D
+ x x bitfield3D
+ x x compound
+ x x compound2D
+ x x compound3D
+ x x enum
+ x x enum2D
+ x x enum3D
+ x x float
+ x x float2D
+ x x float3D
+ x x integer
+ x x integer2D
+ x x integer3D
+ x x opaque
+ x x opaque2D
+ x x opaque3D
+ x x string
+ x x string2D
+ x x string3D
+ x x vlen
+ x x vlen2D
+ x x vlen3D
+Attributes status: 30 common, 0 only in obj1, 0 only in obj2
+attribute: <VLstring of </g1>> and <VLstring of </g1>>
+size: [2] [2]
+position VLstring of </g1> VLstring of </g1> difference
+------------------------------------------------------------
+[ 0 ] a z
+[ 0 ] b z
+[ 1 ] d z
+[ 1 ] e z
+4 differences found
+attribute: <VLstring2D of </g1>> and <VLstring2D of </g1>>
+size: [3x2] [3x2]
+position VLstring2D of </g1> VLstring2D of </g1> difference
+------------------------------------------------------------
+[ 0 0 ] a z
+[ 0 0 ] b z
+[ 0 1 ] c z
+[ 0 1 ] d z
+[ 1 0 ] e z
+[ 1 0 ] f z
+[ 1 1 ] g z
+[ 1 1 ] h z
+[ 2 0 ] i z
+[ 2 0 ] j z
+[ 2 1 ] k z
+[ 2 1 ] l z
+12 differences found
+attribute: <VLstring3D of </g1>> and <VLstring3D of </g1>>
+size: [4x3x2] [4x3x2]
+position VLstring3D of </g1> VLstring3D of </g1> difference
+------------------------------------------------------------
+[ 0 0 0 ] a z
+[ 0 0 0 ] b z
+[ 0 0 1 ] c z
+[ 0 0 1 ] d z
+[ 0 1 0 ] e z
+[ 0 1 0 ] f z
+[ 0 1 1 ] g z
+[ 0 1 1 ] h z
+[ 0 2 0 ] i z
+[ 0 2 0 ] j z
+[ 0 2 1 ] k z
+[ 0 2 1 ] l z
+[ 1 0 0 ] m z
+[ 1 0 0 ] n z
+[ 1 0 1 ] p z
+[ 1 0 1 ] q z
+[ 1 1 0 ] r z
+[ 1 1 0 ] s z
+[ 1 1 1 ] t z
+[ 1 1 1 ] u z
+[ 1 2 0 ] v z
+[ 1 2 0 ] w z
+[ 1 2 1 ] x z
+[ 2 0 0 ] A z
+[ 2 0 0 ] B z
+[ 2 0 1 ] C z
+[ 2 0 1 ] D z
+[ 2 1 0 ] E z
+[ 2 1 0 ] F z
+[ 2 1 1 ] G z
+[ 2 1 1 ] H z
+[ 2 2 0 ] I z
+[ 2 2 0 ] J z
+[ 2 2 1 ] K z
+[ 2 2 1 ] L z
+[ 3 0 0 ] M z
+[ 3 0 0 ] N z
+[ 3 0 1 ] P z
+[ 3 0 1 ] Q z
+[ 3 1 0 ] R z
+[ 3 1 0 ] S z
+[ 3 1 1 ] T z
+[ 3 1 1 ] U z
+[ 3 2 0 ] V z
+[ 3 2 0 ] W z
+[ 3 2 1 ] X z
+[ 3 2 1 ] Z z
+47 differences found
+attribute: <array of </g1>> and <array of </g1>>
+size: [2] [2]
+position array of </g1> array of </g1> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 0 ] 2 0 2
+[ 0 ] 3 0 3
+[ 1 ] 4 0 4
+[ 1 ] 5 0 5
+[ 1 ] 6 0 6
+6 differences found
+attribute: <array2D of </g1>> and <array2D of </g1>>
+size: [3x2] [3x2]
+position array2D of </g1> array2D of </g1> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 0 ] 2 0 2
+[ 0 0 ] 3 0 3
+[ 0 1 ] 4 0 4
+[ 0 1 ] 5 0 5
+[ 0 1 ] 6 0 6
+[ 1 0 ] 7 0 7
+[ 1 0 ] 8 0 8
+[ 1 0 ] 9 0 9
+[ 1 1 ] 10 0 10
+[ 1 1 ] 11 0 11
+[ 1 1 ] 12 0 12
+[ 2 0 ] 13 0 13
+[ 2 0 ] 14 0 14
+[ 2 0 ] 15 0 15
+[ 2 1 ] 16 0 16
+[ 2 1 ] 17 0 17
+[ 2 1 ] 18 0 18
+18 differences found
+attribute: <array3D of </g1>> and <array3D of </g1>>
+size: [4x3x2] [4x3x2]
+position array3D of </g1> array3D of </g1> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 0 ] 2 0 2
+[ 0 0 0 ] 3 0 3
+[ 0 0 1 ] 4 0 4
+[ 0 0 1 ] 5 0 5
+[ 0 0 1 ] 6 0 6
+[ 0 1 0 ] 7 0 7
+[ 0 1 0 ] 8 0 8
+[ 0 1 0 ] 9 0 9
+[ 0 1 1 ] 10 0 10
+[ 0 1 1 ] 11 0 11
+[ 0 1 1 ] 12 0 12
+[ 0 2 0 ] 13 0 13
+[ 0 2 0 ] 14 0 14
+[ 0 2 0 ] 15 0 15
+[ 0 2 1 ] 16 0 16
+[ 0 2 1 ] 17 0 17
+[ 0 2 1 ] 18 0 18
+[ 1 0 0 ] 19 0 19
+[ 1 0 0 ] 20 0 20
+[ 1 0 0 ] 21 0 21
+[ 1 0 1 ] 22 0 22
+[ 1 0 1 ] 23 0 23
+[ 1 0 1 ] 24 0 24
+[ 1 1 0 ] 25 0 25
+[ 1 1 0 ] 26 0 26
+[ 1 1 0 ] 27 0 27
+[ 1 1 1 ] 28 0 28
+[ 1 1 1 ] 29 0 29
+[ 1 1 1 ] 30 0 30
+[ 1 2 0 ] 31 0 31
+[ 1 2 0 ] 32 0 32
+[ 1 2 0 ] 33 0 33
+[ 1 2 1 ] 34 0 34
+[ 1 2 1 ] 35 0 35
+[ 1 2 1 ] 36 0 36
+[ 2 0 0 ] 37 0 37
+[ 2 0 0 ] 38 0 38
+[ 2 0 0 ] 39 0 39
+[ 2 0 1 ] 40 0 40
+[ 2 0 1 ] 41 0 41
+[ 2 0 1 ] 42 0 42
+[ 2 1 0 ] 43 0 43
+[ 2 1 0 ] 44 0 44
+[ 2 1 0 ] 45 0 45
+[ 2 1 1 ] 46 0 46
+[ 2 1 1 ] 47 0 47
+[ 2 1 1 ] 48 0 48
+[ 2 2 0 ] 49 0 49
+[ 2 2 0 ] 50 0 50
+[ 2 2 0 ] 51 0 51
+[ 2 2 1 ] 52 0 52
+[ 2 2 1 ] 53 0 53
+[ 2 2 1 ] 54 0 54
+[ 3 0 0 ] 55 0 55
+[ 3 0 0 ] 56 0 56
+[ 3 0 0 ] 57 0 57
+[ 3 0 1 ] 58 0 58
+[ 3 0 1 ] 59 0 59
+[ 3 0 1 ] 60 0 60
+[ 3 1 0 ] 61 0 61
+[ 3 1 0 ] 62 0 62
+[ 3 1 0 ] 63 0 63
+[ 3 1 1 ] 64 0 64
+[ 3 1 1 ] 65 0 65
+[ 3 1 1 ] 66 0 66
+[ 3 2 0 ] 67 0 67
+[ 3 2 0 ] 68 0 68
+[ 3 2 0 ] 69 0 69
+[ 3 2 1 ] 70 0 70
+[ 3 2 1 ] 71 0 71
+[ 3 2 1 ] 72 0 72
+72 differences found
+attribute: <bitfield of </g1>> and <bitfield of </g1>>
+size: [2] [2]
+position bitfield of </g1> bitfield of </g1> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+2 differences found
+attribute: <bitfield2D of </g1>> and <bitfield2D of </g1>>
+size: [3x2] [3x2]
+position bitfield2D of </g1> bitfield2D of </g1> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 2 0 ] 5 0 5
+[ 2 1 ] 6 0 6
+6 differences found
+attribute: <bitfield3D of </g1>> and <bitfield3D of </g1>>
+size: [4x3x2] [4x3x2]
+position bitfield3D of </g1> bitfield3D of </g1> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 1 ] 2 0 2
+[ 0 1 0 ] 3 0 3
+[ 0 1 1 ] 4 0 4
+[ 0 2 0 ] 5 0 5
+[ 0 2 1 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 1 0 ] 9 0 9
+[ 1 1 1 ] 10 0 10
+[ 1 2 0 ] 11 0 11
+[ 1 2 1 ] 12 0 12
+[ 2 0 0 ] 13 0 13
+[ 2 0 1 ] 14 0 14
+[ 2 1 0 ] 15 0 15
+[ 2 1 1 ] 16 0 16
+[ 2 2 0 ] 17 0 17
+[ 2 2 1 ] 18 0 18
+[ 3 0 0 ] 19 0 19
+[ 3 0 1 ] 20 0 20
+[ 3 1 0 ] 21 0 21
+[ 3 1 1 ] 22 0 22
+[ 3 2 0 ] 23 0 23
+[ 3 2 1 ] 24 0 24
+24 differences found
+attribute: <compound of </g1>> and <compound of </g1>>
+size: [2] [2]
+position compound of </g1> compound of </g1> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 0 ] 2 0 2
+[ 1 ] 3 0 3
+[ 1 ] 4 0 4
+4 differences found
+attribute: <compound2D of </g1>> and <compound2D of </g1>>
+size: [3x2] [3x2]
+position compound2D of </g1> compound2D of </g1> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 0 ] 2 0 2
+[ 0 1 ] 3 0 3
+[ 0 1 ] 4 0 4
+[ 1 0 ] 5 0 5
+[ 1 0 ] 6 0 6
+[ 1 1 ] 7 0 7
+[ 1 1 ] 8 0 8
+[ 2 0 ] 9 0 9
+[ 2 0 ] 10 0 10
+[ 2 1 ] 11 0 11
+[ 2 1 ] 12 0 12
+12 differences found
+attribute: <compound3D of </g1>> and <compound3D of </g1>>
+size: [4x3x2] [4x3x2]
+position compound3D of </g1> compound3D of </g1> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 0 ] 2 0 2
+[ 0 0 1 ] 3 0 3
+[ 0 0 1 ] 4 0 4
+[ 0 1 0 ] 5 0 5
+[ 0 1 0 ] 6 0 6
+[ 0 1 1 ] 7 0 7
+[ 0 1 1 ] 8 0 8
+[ 0 2 0 ] 9 0 9
+[ 0 2 0 ] 10 0 10
+[ 0 2 1 ] 11 0 11
+[ 0 2 1 ] 12 0 12
+[ 1 0 0 ] 13 0 13
+[ 1 0 0 ] 14 0 14
+[ 1 0 1 ] 15 0 15
+[ 1 0 1 ] 16 0 16
+[ 1 1 0 ] 17 0 17
+[ 1 1 0 ] 18 0 18
+[ 1 1 1 ] 19 0 19
+[ 1 1 1 ] 20 0 20
+[ 1 2 0 ] 21 0 21
+[ 1 2 0 ] 22 0 22
+[ 1 2 1 ] 23 0 23
+[ 1 2 1 ] 24 0 24
+[ 2 0 0 ] 25 0 25
+[ 2 0 0 ] 26 0 26
+[ 2 0 1 ] 27 0 27
+[ 2 0 1 ] 28 0 28
+[ 2 1 0 ] 29 0 29
+[ 2 1 0 ] 30 0 30
+[ 2 1 1 ] 31 0 31
+[ 2 1 1 ] 32 0 32
+[ 2 2 0 ] 33 0 33
+[ 2 2 0 ] 34 0 34
+[ 2 2 1 ] 35 0 35
+[ 2 2 1 ] 36 0 36
+[ 3 0 0 ] 37 0 37
+[ 3 0 0 ] 38 0 38
+[ 3 0 1 ] 39 0 39
+[ 3 0 1 ] 40 0 40
+[ 3 1 0 ] 41 0 41
+[ 3 1 0 ] 42 0 42
+[ 3 1 1 ] 43 0 43
+[ 3 1 1 ] 44 0 44
+[ 3 2 0 ] 45 0 45
+[ 3 2 0 ] 46 0 46
+[ 3 2 1 ] 47 0 47
+[ 3 2 1 ] 48 0 48
+48 differences found
+attribute: <enum of </g1>> and <enum of </g1>>
+size: [2] [2]
+position enum of </g1> enum of </g1> difference
+------------------------------------------------------------
+[ 0 ] RED GREEN
+[ 1 ] RED GREEN
+2 differences found
+attribute: <enum2D of </g1>> and <enum2D of </g1>>
+size: [3x2] [3x2]
+position enum2D of </g1> enum2D of </g1> difference
+------------------------------------------------------------
+[ 0 0 ] RED GREEN
+[ 0 1 ] RED GREEN
+[ 1 0 ] RED GREEN
+[ 1 1 ] RED GREEN
+[ 2 0 ] RED GREEN
+[ 2 1 ] RED GREEN
+6 differences found
+attribute: <enum3D of </g1>> and <enum3D of </g1>>
+size: [4x3x2] [4x3x2]
+position enum3D of </g1> enum3D of </g1> difference
+------------------------------------------------------------
+[ 0 0 0 ] GREEN RED
+[ 0 0 1 ] GREEN RED
+[ 0 1 0 ] GREEN RED
+[ 0 1 1 ] GREEN RED
+[ 0 2 0 ] GREEN RED
+[ 0 2 1 ] GREEN RED
+[ 1 0 0 ] GREEN RED
+[ 1 0 1 ] GREEN RED
+[ 1 1 0 ] GREEN RED
+[ 1 1 1 ] GREEN RED
+[ 1 2 0 ] GREEN RED
+[ 1 2 1 ] GREEN RED
+[ 2 0 0 ] GREEN RED
+[ 2 0 1 ] GREEN RED
+[ 2 1 0 ] GREEN RED
+[ 2 1 1 ] GREEN RED
+[ 2 2 0 ] GREEN RED
+[ 2 2 1 ] GREEN RED
+[ 3 0 0 ] GREEN RED
+[ 3 0 1 ] GREEN RED
+[ 3 1 0 ] GREEN RED
+[ 3 1 1 ] GREEN RED
+[ 3 2 0 ] GREEN RED
+[ 3 2 1 ] GREEN RED
+24 differences found
+attribute: <float of </g1>> and <float of </g1>>
+size: [2] [2]
+position float of </g1> float of </g1> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+2 differences found
+attribute: <float2D of </g1>> and <float2D of </g1>>
+size: [3x2] [3x2]
+position float2D of </g1> float2D of </g1> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 2 0 ] 5 0 5
+[ 2 1 ] 6 0 6
+6 differences found
+attribute: <float3D of </g1>> and <float3D of </g1>>
+size: [4x3x2] [4x3x2]
+position float3D of </g1> float3D of </g1> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 1 ] 2 0 2
+[ 0 1 0 ] 3 0 3
+[ 0 1 1 ] 4 0 4
+[ 0 2 0 ] 5 0 5
+[ 0 2 1 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 1 0 ] 9 0 9
+[ 1 1 1 ] 10 0 10
+[ 1 2 0 ] 11 0 11
+[ 1 2 1 ] 12 0 12
+[ 2 0 0 ] 13 0 13
+[ 2 0 1 ] 14 0 14
+[ 2 1 0 ] 15 0 15
+[ 2 1 1 ] 16 0 16
+[ 2 2 0 ] 17 0 17
+[ 2 2 1 ] 18 0 18
+[ 3 0 0 ] 19 0 19
+[ 3 0 1 ] 20 0 20
+[ 3 1 0 ] 21 0 21
+[ 3 1 1 ] 22 0 22
+[ 3 2 0 ] 23 0 23
+[ 3 2 1 ] 24 0 24
+24 differences found
+attribute: <integer of </g1>> and <integer of </g1>>
+size: [2] [2]
+position integer of </g1> integer of </g1> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+2 differences found
+attribute: <integer2D of </g1>> and <integer2D of </g1>>
+size: [3x2] [3x2]
+position integer2D of </g1> integer2D of </g1> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 2 0 ] 5 0 5
+[ 2 1 ] 6 0 6
+6 differences found
+attribute: <integer3D of </g1>> and <integer3D of </g1>>
+size: [4x3x2] [4x3x2]
+position integer3D of </g1> integer3D of </g1> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 1 ] 2 0 2
+[ 0 1 0 ] 3 0 3
+[ 0 1 1 ] 4 0 4
+[ 0 2 0 ] 5 0 5
+[ 0 2 1 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 1 0 ] 9 0 9
+[ 1 1 1 ] 10 0 10
+[ 1 2 0 ] 11 0 11
+[ 1 2 1 ] 12 0 12
+[ 2 0 0 ] 13 0 13
+[ 2 0 1 ] 14 0 14
+[ 2 1 0 ] 15 0 15
+[ 2 1 1 ] 16 0 16
+[ 2 2 0 ] 17 0 17
+[ 2 2 1 ] 18 0 18
+[ 3 0 0 ] 19 0 19
+[ 3 0 1 ] 20 0 20
+[ 3 1 0 ] 21 0 21
+[ 3 1 1 ] 22 0 22
+[ 3 2 0 ] 23 0 23
+[ 3 2 1 ] 24 0 24
+24 differences found
+attribute: <opaque of </g1>> and <opaque of </g1>>
+size: [2] [2]
+position opaque of </g1> opaque of </g1> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+2 differences found
+attribute: <opaque2D of </g1>> and <opaque2D of </g1>>
+size: [3x2] [3x2]
+position opaque2D of </g1> opaque2D of </g1> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 2 0 ] 5 0 5
+[ 2 1 ] 6 0 6
+6 differences found
+attribute: <opaque3D of </g1>> and <opaque3D of </g1>>
+size: [4x3x2] [4x3x2]
+position opaque3D of </g1> opaque3D of </g1> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 1 ] 2 0 2
+[ 0 1 0 ] 3 0 3
+[ 0 1 1 ] 4 0 4
+[ 0 2 0 ] 5 0 5
+[ 0 2 1 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 1 0 ] 9 0 9
+[ 1 1 1 ] 10 0 10
+[ 1 2 0 ] 11 0 11
+[ 1 2 1 ] 12 0 12
+[ 2 0 0 ] 13 0 13
+[ 2 0 1 ] 14 0 14
+[ 2 1 0 ] 15 0 15
+[ 2 1 1 ] 16 0 16
+[ 2 2 0 ] 17 0 17
+[ 2 2 1 ] 18 0 18
+[ 3 0 0 ] 19 0 19
+[ 3 0 1 ] 20 0 20
+[ 3 1 0 ] 21 0 21
+[ 3 1 1 ] 22 0 22
+[ 3 2 0 ] 23 0 23
+[ 3 2 1 ] 24 0 24
+24 differences found
+attribute: <string of </g1>> and <string of </g1>>
+size: [2] [2]
+position string of </g1> string of </g1> difference
+------------------------------------------------------------
+[ 0 ] a z
+[ 0 ] b z
+[ 1 ] d z
+[ 1 ] e z
+4 differences found
+attribute: <string2D of </g1>> and <string2D of </g1>>
+size: [3x2] [3x2]
+position string2D of </g1> string2D of </g1> difference
+------------------------------------------------------------
+[ 0 0 ] a z
+[ 0 0 ] b z
+[ 0 1 ] c z
+[ 0 1 ] d z
+[ 1 0 ] e z
+[ 1 0 ] f z
+[ 1 1 ] g z
+[ 1 1 ] h z
+[ 2 0 ] i z
+[ 2 0 ] j z
+[ 2 1 ] k z
+[ 2 1 ] l z
+12 differences found
+attribute: <string3D of </g1>> and <string3D of </g1>>
+size: [4x3x2] [4x3x2]
+position string3D of </g1> string3D of </g1> difference
+------------------------------------------------------------
+[ 0 0 0 ] a z
+[ 0 0 0 ] b z
+[ 0 0 1 ] c z
+[ 0 0 1 ] d z
+[ 0 1 0 ] e z
+[ 0 1 0 ] f z
+[ 0 1 1 ] g z
+[ 0 1 1 ] h z
+[ 0 2 0 ] i z
+[ 0 2 0 ] j z
+[ 0 2 1 ] k z
+[ 0 2 1 ] l z
+[ 1 0 0 ] m z
+[ 1 0 0 ] n z
+[ 1 0 1 ] p z
+[ 1 0 1 ] q z
+[ 1 1 0 ] r z
+[ 1 1 0 ] s z
+[ 1 1 1 ] t z
+[ 1 1 1 ] u z
+[ 1 2 0 ] v z
+[ 1 2 0 ] w z
+[ 1 2 1 ] x z
+[ 2 0 0 ] A z
+[ 2 0 0 ] B z
+[ 2 0 1 ] C z
+[ 2 0 1 ] D z
+[ 2 1 0 ] E z
+[ 2 1 0 ] F z
+[ 2 1 1 ] G z
+[ 2 1 1 ] H z
+[ 2 2 0 ] I z
+[ 2 2 0 ] J z
+[ 2 2 1 ] K z
+[ 2 2 1 ] L z
+[ 3 0 0 ] M z
+[ 3 0 0 ] N z
+[ 3 0 1 ] P z
+[ 3 0 1 ] Q z
+[ 3 1 0 ] R z
+[ 3 1 0 ] S z
+[ 3 1 1 ] T z
+[ 3 1 1 ] U z
+[ 3 2 0 ] V z
+[ 3 2 0 ] W z
+[ 3 2 1 ] X z
+[ 3 2 1 ] Z z
+47 differences found
+attribute: <vlen of </g1>> and <vlen of </g1>>
+size: [2] [2]
+position vlen of </g1> vlen of </g1> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+[ 1 ] 3 0 3
+3 differences found
+attribute: <vlen2D of </g1>> and <vlen2D of </g1>>
+size: [3x2] [3x2]
+position vlen2D of </g1> vlen2D of </g1> difference
+------------------------------------------------------------
+[ 0 1 ] 1 0 1
+[ 1 0 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 1 1 ] 5 0 5
+[ 2 0 ] 6 0 6
+[ 2 0 ] 7 0 7
+[ 2 0 ] 8 0 8
+[ 2 1 ] 9 0 9
+[ 2 1 ] 10 0 10
+[ 2 1 ] 11 0 11
+11 differences found
+attribute: <vlen3D of </g1>> and <vlen3D of </g1>>
+size: [4x3x2] [4x3x2]
+position vlen3D of </g1> vlen3D of </g1> difference
+------------------------------------------------------------
+[ 0 0 1 ] 1 0 1
+[ 0 1 0 ] 2 0 2
+[ 0 1 1 ] 3 0 3
+[ 0 2 0 ] 4 0 4
+[ 0 2 1 ] 5 0 5
+[ 1 0 0 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 0 1 ] 9 0 9
+[ 1 1 0 ] 10 0 10
+[ 1 1 0 ] 11 0 11
+[ 1 1 1 ] 12 0 12
+[ 1 1 1 ] 13 0 13
+[ 1 2 0 ] 14 0 14
+[ 1 2 0 ] 15 0 15
+[ 1 2 1 ] 16 0 16
+[ 1 2 1 ] 17 0 17
+[ 2 0 0 ] 18 0 18
+[ 2 0 0 ] 19 0 19
+[ 2 0 0 ] 20 0 20
+[ 2 0 1 ] 21 0 21
+[ 2 0 1 ] 22 0 22
+[ 2 0 1 ] 23 0 23
+[ 2 1 0 ] 24 0 24
+[ 2 1 0 ] 25 0 25
+[ 2 1 0 ] 26 0 26
+[ 2 1 1 ] 27 0 27
+[ 2 1 1 ] 28 0 28
+[ 2 1 1 ] 29 0 29
+[ 2 2 0 ] 30 0 30
+[ 2 2 0 ] 31 0 31
+[ 2 2 0 ] 32 0 32
+[ 2 2 1 ] 33 0 33
+[ 2 2 1 ] 34 0 34
+[ 2 2 1 ] 35 0 35
+[ 3 0 0 ] 36 0 36
+[ 3 0 0 ] 37 0 37
+[ 3 0 0 ] 38 0 38
+[ 3 0 0 ] 39 0 39
+[ 3 0 1 ] 40 0 40
+[ 3 0 1 ] 41 0 41
+[ 3 0 1 ] 42 0 42
+[ 3 0 1 ] 43 0 43
+[ 3 1 0 ] 44 0 44
+[ 3 1 0 ] 45 0 45
+[ 3 1 0 ] 46 0 46
+[ 3 1 0 ] 47 0 47
+[ 3 1 1 ] 48 0 48
+[ 3 1 1 ] 49 0 49
+[ 3 1 1 ] 50 0 50
+[ 3 1 1 ] 51 0 51
+[ 3 2 0 ] 52 0 52
+[ 3 2 0 ] 53 0 53
+[ 3 2 0 ] 54 0 54
+[ 3 2 0 ] 55 0 55
+[ 3 2 1 ] 56 0 56
+[ 3 2 1 ] 57 0 57
+[ 3 2 1 ] 58 0 58
+[ 3 2 1 ] 59 0 59
+59 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/test/h5diff/testfiles/h5diff_702.txt b/tools/test/h5diff/testfiles/h5diff_702.txt
new file mode 100644
index 0000000..1cf71dd
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_702.txt
@@ -0,0 +1,2038 @@
+
+file1 file2
+---------------------------------------
+ x x /
+ x x /dset
+ x x /g1
+
+
+group : </> and </>
+0 differences found
+Attributes status: 30 common, 0 only in obj1, 0 only in obj2
+attribute: <VLstring of </>> and <VLstring of </>>
+size: [2] [2]
+position VLstring of </> VLstring of </> difference
+------------------------------------------------------------
+[ 0 ] a z
+[ 0 ] b z
+[ 1 ] d z
+[ 1 ] e z
+4 differences found
+attribute: <VLstring2D of </>> and <VLstring2D of </>>
+size: [3x2] [3x2]
+position VLstring2D of </> VLstring2D of </> difference
+------------------------------------------------------------
+[ 0 0 ] a z
+[ 0 0 ] b z
+[ 0 1 ] c z
+[ 0 1 ] d z
+[ 1 0 ] e z
+[ 1 0 ] f z
+[ 1 1 ] g z
+[ 1 1 ] h z
+[ 2 0 ] i z
+[ 2 0 ] j z
+[ 2 1 ] k z
+[ 2 1 ] l z
+12 differences found
+attribute: <VLstring3D of </>> and <VLstring3D of </>>
+size: [4x3x2] [4x3x2]
+position VLstring3D of </> VLstring3D of </> difference
+------------------------------------------------------------
+[ 0 0 0 ] a z
+[ 0 0 0 ] b z
+[ 0 0 1 ] c z
+[ 0 0 1 ] d z
+[ 0 1 0 ] e z
+[ 0 1 0 ] f z
+[ 0 1 1 ] g z
+[ 0 1 1 ] h z
+[ 0 2 0 ] i z
+[ 0 2 0 ] j z
+[ 0 2 1 ] k z
+[ 0 2 1 ] l z
+[ 1 0 0 ] m z
+[ 1 0 0 ] n z
+[ 1 0 1 ] p z
+[ 1 0 1 ] q z
+[ 1 1 0 ] r z
+[ 1 1 0 ] s z
+[ 1 1 1 ] t z
+[ 1 1 1 ] u z
+[ 1 2 0 ] v z
+[ 1 2 0 ] w z
+[ 1 2 1 ] x z
+[ 2 0 0 ] A z
+[ 2 0 0 ] B z
+[ 2 0 1 ] C z
+[ 2 0 1 ] D z
+[ 2 1 0 ] E z
+[ 2 1 0 ] F z
+[ 2 1 1 ] G z
+[ 2 1 1 ] H z
+[ 2 2 0 ] I z
+[ 2 2 0 ] J z
+[ 2 2 1 ] K z
+[ 2 2 1 ] L z
+[ 3 0 0 ] M z
+[ 3 0 0 ] N z
+[ 3 0 1 ] P z
+[ 3 0 1 ] Q z
+[ 3 1 0 ] R z
+[ 3 1 0 ] S z
+[ 3 1 1 ] T z
+[ 3 1 1 ] U z
+[ 3 2 0 ] V z
+[ 3 2 0 ] W z
+[ 3 2 1 ] X z
+[ 3 2 1 ] Z z
+47 differences found
+attribute: <array of </>> and <array of </>>
+size: [2] [2]
+position array of </> array of </> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 0 ] 2 0 2
+[ 0 ] 3 0 3
+[ 1 ] 4 0 4
+[ 1 ] 5 0 5
+[ 1 ] 6 0 6
+6 differences found
+attribute: <array2D of </>> and <array2D of </>>
+size: [3x2] [3x2]
+position array2D of </> array2D of </> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 0 ] 2 0 2
+[ 0 0 ] 3 0 3
+[ 0 1 ] 4 0 4
+[ 0 1 ] 5 0 5
+[ 0 1 ] 6 0 6
+[ 1 0 ] 7 0 7
+[ 1 0 ] 8 0 8
+[ 1 0 ] 9 0 9
+[ 1 1 ] 10 0 10
+[ 1 1 ] 11 0 11
+[ 1 1 ] 12 0 12
+[ 2 0 ] 13 0 13
+[ 2 0 ] 14 0 14
+[ 2 0 ] 15 0 15
+[ 2 1 ] 16 0 16
+[ 2 1 ] 17 0 17
+[ 2 1 ] 18 0 18
+18 differences found
+attribute: <array3D of </>> and <array3D of </>>
+size: [4x3x2] [4x3x2]
+position array3D of </> array3D of </> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 0 ] 2 0 2
+[ 0 0 0 ] 3 0 3
+[ 0 0 1 ] 4 0 4
+[ 0 0 1 ] 5 0 5
+[ 0 0 1 ] 6 0 6
+[ 0 1 0 ] 7 0 7
+[ 0 1 0 ] 8 0 8
+[ 0 1 0 ] 9 0 9
+[ 0 1 1 ] 10 0 10
+[ 0 1 1 ] 11 0 11
+[ 0 1 1 ] 12 0 12
+[ 0 2 0 ] 13 0 13
+[ 0 2 0 ] 14 0 14
+[ 0 2 0 ] 15 0 15
+[ 0 2 1 ] 16 0 16
+[ 0 2 1 ] 17 0 17
+[ 0 2 1 ] 18 0 18
+[ 1 0 0 ] 19 0 19
+[ 1 0 0 ] 20 0 20
+[ 1 0 0 ] 21 0 21
+[ 1 0 1 ] 22 0 22
+[ 1 0 1 ] 23 0 23
+[ 1 0 1 ] 24 0 24
+[ 1 1 0 ] 25 0 25
+[ 1 1 0 ] 26 0 26
+[ 1 1 0 ] 27 0 27
+[ 1 1 1 ] 28 0 28
+[ 1 1 1 ] 29 0 29
+[ 1 1 1 ] 30 0 30
+[ 1 2 0 ] 31 0 31
+[ 1 2 0 ] 32 0 32
+[ 1 2 0 ] 33 0 33
+[ 1 2 1 ] 34 0 34
+[ 1 2 1 ] 35 0 35
+[ 1 2 1 ] 36 0 36
+[ 2 0 0 ] 37 0 37
+[ 2 0 0 ] 38 0 38
+[ 2 0 0 ] 39 0 39
+[ 2 0 1 ] 40 0 40
+[ 2 0 1 ] 41 0 41
+[ 2 0 1 ] 42 0 42
+[ 2 1 0 ] 43 0 43
+[ 2 1 0 ] 44 0 44
+[ 2 1 0 ] 45 0 45
+[ 2 1 1 ] 46 0 46
+[ 2 1 1 ] 47 0 47
+[ 2 1 1 ] 48 0 48
+[ 2 2 0 ] 49 0 49
+[ 2 2 0 ] 50 0 50
+[ 2 2 0 ] 51 0 51
+[ 2 2 1 ] 52 0 52
+[ 2 2 1 ] 53 0 53
+[ 2 2 1 ] 54 0 54
+[ 3 0 0 ] 55 0 55
+[ 3 0 0 ] 56 0 56
+[ 3 0 0 ] 57 0 57
+[ 3 0 1 ] 58 0 58
+[ 3 0 1 ] 59 0 59
+[ 3 0 1 ] 60 0 60
+[ 3 1 0 ] 61 0 61
+[ 3 1 0 ] 62 0 62
+[ 3 1 0 ] 63 0 63
+[ 3 1 1 ] 64 0 64
+[ 3 1 1 ] 65 0 65
+[ 3 1 1 ] 66 0 66
+[ 3 2 0 ] 67 0 67
+[ 3 2 0 ] 68 0 68
+[ 3 2 0 ] 69 0 69
+[ 3 2 1 ] 70 0 70
+[ 3 2 1 ] 71 0 71
+[ 3 2 1 ] 72 0 72
+72 differences found
+attribute: <bitfield of </>> and <bitfield of </>>
+size: [2] [2]
+position bitfield of </> bitfield of </> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+2 differences found
+attribute: <bitfield2D of </>> and <bitfield2D of </>>
+size: [3x2] [3x2]
+position bitfield2D of </> bitfield2D of </> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 2 0 ] 5 0 5
+[ 2 1 ] 6 0 6
+6 differences found
+attribute: <bitfield3D of </>> and <bitfield3D of </>>
+size: [4x3x2] [4x3x2]
+position bitfield3D of </> bitfield3D of </> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 1 ] 2 0 2
+[ 0 1 0 ] 3 0 3
+[ 0 1 1 ] 4 0 4
+[ 0 2 0 ] 5 0 5
+[ 0 2 1 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 1 0 ] 9 0 9
+[ 1 1 1 ] 10 0 10
+[ 1 2 0 ] 11 0 11
+[ 1 2 1 ] 12 0 12
+[ 2 0 0 ] 13 0 13
+[ 2 0 1 ] 14 0 14
+[ 2 1 0 ] 15 0 15
+[ 2 1 1 ] 16 0 16
+[ 2 2 0 ] 17 0 17
+[ 2 2 1 ] 18 0 18
+[ 3 0 0 ] 19 0 19
+[ 3 0 1 ] 20 0 20
+[ 3 1 0 ] 21 0 21
+[ 3 1 1 ] 22 0 22
+[ 3 2 0 ] 23 0 23
+[ 3 2 1 ] 24 0 24
+24 differences found
+attribute: <compound of </>> and <compound of </>>
+size: [2] [2]
+position compound of </> compound of </> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 0 ] 2 0 2
+[ 1 ] 3 0 3
+[ 1 ] 4 0 4
+4 differences found
+attribute: <compound2D of </>> and <compound2D of </>>
+size: [3x2] [3x2]
+position compound2D of </> compound2D of </> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 0 ] 2 0 2
+[ 0 1 ] 3 0 3
+[ 0 1 ] 4 0 4
+[ 1 0 ] 5 0 5
+[ 1 0 ] 6 0 6
+[ 1 1 ] 7 0 7
+[ 1 1 ] 8 0 8
+[ 2 0 ] 9 0 9
+[ 2 0 ] 10 0 10
+[ 2 1 ] 11 0 11
+[ 2 1 ] 12 0 12
+12 differences found
+attribute: <compound3D of </>> and <compound3D of </>>
+size: [4x3x2] [4x3x2]
+position compound3D of </> compound3D of </> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 0 ] 2 0 2
+[ 0 0 1 ] 3 0 3
+[ 0 0 1 ] 4 0 4
+[ 0 1 0 ] 5 0 5
+[ 0 1 0 ] 6 0 6
+[ 0 1 1 ] 7 0 7
+[ 0 1 1 ] 8 0 8
+[ 0 2 0 ] 9 0 9
+[ 0 2 0 ] 10 0 10
+[ 0 2 1 ] 11 0 11
+[ 0 2 1 ] 12 0 12
+[ 1 0 0 ] 13 0 13
+[ 1 0 0 ] 14 0 14
+[ 1 0 1 ] 15 0 15
+[ 1 0 1 ] 16 0 16
+[ 1 1 0 ] 17 0 17
+[ 1 1 0 ] 18 0 18
+[ 1 1 1 ] 19 0 19
+[ 1 1 1 ] 20 0 20
+[ 1 2 0 ] 21 0 21
+[ 1 2 0 ] 22 0 22
+[ 1 2 1 ] 23 0 23
+[ 1 2 1 ] 24 0 24
+[ 2 0 0 ] 25 0 25
+[ 2 0 0 ] 26 0 26
+[ 2 0 1 ] 27 0 27
+[ 2 0 1 ] 28 0 28
+[ 2 1 0 ] 29 0 29
+[ 2 1 0 ] 30 0 30
+[ 2 1 1 ] 31 0 31
+[ 2 1 1 ] 32 0 32
+[ 2 2 0 ] 33 0 33
+[ 2 2 0 ] 34 0 34
+[ 2 2 1 ] 35 0 35
+[ 2 2 1 ] 36 0 36
+[ 3 0 0 ] 37 0 37
+[ 3 0 0 ] 38 0 38
+[ 3 0 1 ] 39 0 39
+[ 3 0 1 ] 40 0 40
+[ 3 1 0 ] 41 0 41
+[ 3 1 0 ] 42 0 42
+[ 3 1 1 ] 43 0 43
+[ 3 1 1 ] 44 0 44
+[ 3 2 0 ] 45 0 45
+[ 3 2 0 ] 46 0 46
+[ 3 2 1 ] 47 0 47
+[ 3 2 1 ] 48 0 48
+48 differences found
+attribute: <enum of </>> and <enum of </>>
+size: [2] [2]
+position enum of </> enum of </> difference
+------------------------------------------------------------
+[ 0 ] RED GREEN
+[ 1 ] RED GREEN
+2 differences found
+attribute: <enum2D of </>> and <enum2D of </>>
+size: [3x2] [3x2]
+position enum2D of </> enum2D of </> difference
+------------------------------------------------------------
+[ 0 0 ] RED GREEN
+[ 0 1 ] RED GREEN
+[ 1 0 ] RED GREEN
+[ 1 1 ] RED GREEN
+[ 2 0 ] RED GREEN
+[ 2 1 ] RED GREEN
+6 differences found
+attribute: <enum3D of </>> and <enum3D of </>>
+size: [4x3x2] [4x3x2]
+position enum3D of </> enum3D of </> difference
+------------------------------------------------------------
+[ 0 0 0 ] GREEN RED
+[ 0 0 1 ] GREEN RED
+[ 0 1 0 ] GREEN RED
+[ 0 1 1 ] GREEN RED
+[ 0 2 0 ] GREEN RED
+[ 0 2 1 ] GREEN RED
+[ 1 0 0 ] GREEN RED
+[ 1 0 1 ] GREEN RED
+[ 1 1 0 ] GREEN RED
+[ 1 1 1 ] GREEN RED
+[ 1 2 0 ] GREEN RED
+[ 1 2 1 ] GREEN RED
+[ 2 0 0 ] GREEN RED
+[ 2 0 1 ] GREEN RED
+[ 2 1 0 ] GREEN RED
+[ 2 1 1 ] GREEN RED
+[ 2 2 0 ] GREEN RED
+[ 2 2 1 ] GREEN RED
+[ 3 0 0 ] GREEN RED
+[ 3 0 1 ] GREEN RED
+[ 3 1 0 ] GREEN RED
+[ 3 1 1 ] GREEN RED
+[ 3 2 0 ] GREEN RED
+[ 3 2 1 ] GREEN RED
+24 differences found
+attribute: <float of </>> and <float of </>>
+size: [2] [2]
+position float of </> float of </> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+2 differences found
+attribute: <float2D of </>> and <float2D of </>>
+size: [3x2] [3x2]
+position float2D of </> float2D of </> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 2 0 ] 5 0 5
+[ 2 1 ] 6 0 6
+6 differences found
+attribute: <float3D of </>> and <float3D of </>>
+size: [4x3x2] [4x3x2]
+position float3D of </> float3D of </> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 1 ] 2 0 2
+[ 0 1 0 ] 3 0 3
+[ 0 1 1 ] 4 0 4
+[ 0 2 0 ] 5 0 5
+[ 0 2 1 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 1 0 ] 9 0 9
+[ 1 1 1 ] 10 0 10
+[ 1 2 0 ] 11 0 11
+[ 1 2 1 ] 12 0 12
+[ 2 0 0 ] 13 0 13
+[ 2 0 1 ] 14 0 14
+[ 2 1 0 ] 15 0 15
+[ 2 1 1 ] 16 0 16
+[ 2 2 0 ] 17 0 17
+[ 2 2 1 ] 18 0 18
+[ 3 0 0 ] 19 0 19
+[ 3 0 1 ] 20 0 20
+[ 3 1 0 ] 21 0 21
+[ 3 1 1 ] 22 0 22
+[ 3 2 0 ] 23 0 23
+[ 3 2 1 ] 24 0 24
+24 differences found
+attribute: <integer of </>> and <integer of </>>
+size: [2] [2]
+position integer of </> integer of </> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+2 differences found
+attribute: <integer2D of </>> and <integer2D of </>>
+size: [3x2] [3x2]
+position integer2D of </> integer2D of </> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 2 0 ] 5 0 5
+[ 2 1 ] 6 0 6
+6 differences found
+attribute: <integer3D of </>> and <integer3D of </>>
+size: [4x3x2] [4x3x2]
+position integer3D of </> integer3D of </> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 1 ] 2 0 2
+[ 0 1 0 ] 3 0 3
+[ 0 1 1 ] 4 0 4
+[ 0 2 0 ] 5 0 5
+[ 0 2 1 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 1 0 ] 9 0 9
+[ 1 1 1 ] 10 0 10
+[ 1 2 0 ] 11 0 11
+[ 1 2 1 ] 12 0 12
+[ 2 0 0 ] 13 0 13
+[ 2 0 1 ] 14 0 14
+[ 2 1 0 ] 15 0 15
+[ 2 1 1 ] 16 0 16
+[ 2 2 0 ] 17 0 17
+[ 2 2 1 ] 18 0 18
+[ 3 0 0 ] 19 0 19
+[ 3 0 1 ] 20 0 20
+[ 3 1 0 ] 21 0 21
+[ 3 1 1 ] 22 0 22
+[ 3 2 0 ] 23 0 23
+[ 3 2 1 ] 24 0 24
+24 differences found
+attribute: <opaque of </>> and <opaque of </>>
+size: [2] [2]
+position opaque of </> opaque of </> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+2 differences found
+attribute: <opaque2D of </>> and <opaque2D of </>>
+size: [3x2] [3x2]
+position opaque2D of </> opaque2D of </> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 2 0 ] 5 0 5
+[ 2 1 ] 6 0 6
+6 differences found
+attribute: <opaque3D of </>> and <opaque3D of </>>
+size: [4x3x2] [4x3x2]
+position opaque3D of </> opaque3D of </> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 1 ] 2 0 2
+[ 0 1 0 ] 3 0 3
+[ 0 1 1 ] 4 0 4
+[ 0 2 0 ] 5 0 5
+[ 0 2 1 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 1 0 ] 9 0 9
+[ 1 1 1 ] 10 0 10
+[ 1 2 0 ] 11 0 11
+[ 1 2 1 ] 12 0 12
+[ 2 0 0 ] 13 0 13
+[ 2 0 1 ] 14 0 14
+[ 2 1 0 ] 15 0 15
+[ 2 1 1 ] 16 0 16
+[ 2 2 0 ] 17 0 17
+[ 2 2 1 ] 18 0 18
+[ 3 0 0 ] 19 0 19
+[ 3 0 1 ] 20 0 20
+[ 3 1 0 ] 21 0 21
+[ 3 1 1 ] 22 0 22
+[ 3 2 0 ] 23 0 23
+[ 3 2 1 ] 24 0 24
+24 differences found
+attribute: <string of </>> and <string of </>>
+size: [2] [2]
+position string of </> string of </> difference
+------------------------------------------------------------
+[ 0 ] a z
+[ 0 ] b z
+[ 1 ] d z
+[ 1 ] e z
+4 differences found
+attribute: <string2D of </>> and <string2D of </>>
+size: [3x2] [3x2]
+position string2D of </> string2D of </> difference
+------------------------------------------------------------
+[ 0 0 ] a z
+[ 0 0 ] b z
+[ 0 1 ] c z
+[ 0 1 ] d z
+[ 1 0 ] e z
+[ 1 0 ] f z
+[ 1 1 ] g z
+[ 1 1 ] h z
+[ 2 0 ] i z
+[ 2 0 ] j z
+[ 2 1 ] k z
+[ 2 1 ] l z
+12 differences found
+attribute: <string3D of </>> and <string3D of </>>
+size: [4x3x2] [4x3x2]
+position string3D of </> string3D of </> difference
+------------------------------------------------------------
+[ 0 0 0 ] a z
+[ 0 0 0 ] b z
+[ 0 0 1 ] c z
+[ 0 0 1 ] d z
+[ 0 1 0 ] e z
+[ 0 1 0 ] f z
+[ 0 1 1 ] g z
+[ 0 1 1 ] h z
+[ 0 2 0 ] i z
+[ 0 2 0 ] j z
+[ 0 2 1 ] k z
+[ 0 2 1 ] l z
+[ 1 0 0 ] m z
+[ 1 0 0 ] n z
+[ 1 0 1 ] p z
+[ 1 0 1 ] q z
+[ 1 1 0 ] r z
+[ 1 1 0 ] s z
+[ 1 1 1 ] t z
+[ 1 1 1 ] u z
+[ 1 2 0 ] v z
+[ 1 2 0 ] w z
+[ 1 2 1 ] x z
+[ 2 0 0 ] A z
+[ 2 0 0 ] B z
+[ 2 0 1 ] C z
+[ 2 0 1 ] D z
+[ 2 1 0 ] E z
+[ 2 1 0 ] F z
+[ 2 1 1 ] G z
+[ 2 1 1 ] H z
+[ 2 2 0 ] I z
+[ 2 2 0 ] J z
+[ 2 2 1 ] K z
+[ 2 2 1 ] L z
+[ 3 0 0 ] M z
+[ 3 0 0 ] N z
+[ 3 0 1 ] P z
+[ 3 0 1 ] Q z
+[ 3 1 0 ] R z
+[ 3 1 0 ] S z
+[ 3 1 1 ] T z
+[ 3 1 1 ] U z
+[ 3 2 0 ] V z
+[ 3 2 0 ] W z
+[ 3 2 1 ] X z
+[ 3 2 1 ] Z z
+47 differences found
+attribute: <vlen of </>> and <vlen of </>>
+size: [2] [2]
+position vlen of </> vlen of </> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+[ 1 ] 3 0 3
+3 differences found
+attribute: <vlen2D of </>> and <vlen2D of </>>
+size: [3x2] [3x2]
+position vlen2D of </> vlen2D of </> difference
+------------------------------------------------------------
+[ 0 1 ] 1 0 1
+[ 1 0 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 1 1 ] 5 0 5
+[ 2 0 ] 6 0 6
+[ 2 0 ] 7 0 7
+[ 2 0 ] 8 0 8
+[ 2 1 ] 9 0 9
+[ 2 1 ] 10 0 10
+[ 2 1 ] 11 0 11
+11 differences found
+attribute: <vlen3D of </>> and <vlen3D of </>>
+size: [4x3x2] [4x3x2]
+position vlen3D of </> vlen3D of </> difference
+------------------------------------------------------------
+[ 0 0 1 ] 1 0 1
+[ 0 1 0 ] 2 0 2
+[ 0 1 1 ] 3 0 3
+[ 0 2 0 ] 4 0 4
+[ 0 2 1 ] 5 0 5
+[ 1 0 0 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 0 1 ] 9 0 9
+[ 1 1 0 ] 10 0 10
+[ 1 1 0 ] 11 0 11
+[ 1 1 1 ] 12 0 12
+[ 1 1 1 ] 13 0 13
+[ 1 2 0 ] 14 0 14
+[ 1 2 0 ] 15 0 15
+[ 1 2 1 ] 16 0 16
+[ 1 2 1 ] 17 0 17
+[ 2 0 0 ] 18 0 18
+[ 2 0 0 ] 19 0 19
+[ 2 0 0 ] 20 0 20
+[ 2 0 1 ] 21 0 21
+[ 2 0 1 ] 22 0 22
+[ 2 0 1 ] 23 0 23
+[ 2 1 0 ] 24 0 24
+[ 2 1 0 ] 25 0 25
+[ 2 1 0 ] 26 0 26
+[ 2 1 1 ] 27 0 27
+[ 2 1 1 ] 28 0 28
+[ 2 1 1 ] 29 0 29
+[ 2 2 0 ] 30 0 30
+[ 2 2 0 ] 31 0 31
+[ 2 2 0 ] 32 0 32
+[ 2 2 1 ] 33 0 33
+[ 2 2 1 ] 34 0 34
+[ 2 2 1 ] 35 0 35
+[ 3 0 0 ] 36 0 36
+[ 3 0 0 ] 37 0 37
+[ 3 0 0 ] 38 0 38
+[ 3 0 0 ] 39 0 39
+[ 3 0 1 ] 40 0 40
+[ 3 0 1 ] 41 0 41
+[ 3 0 1 ] 42 0 42
+[ 3 0 1 ] 43 0 43
+[ 3 1 0 ] 44 0 44
+[ 3 1 0 ] 45 0 45
+[ 3 1 0 ] 46 0 46
+[ 3 1 0 ] 47 0 47
+[ 3 1 1 ] 48 0 48
+[ 3 1 1 ] 49 0 49
+[ 3 1 1 ] 50 0 50
+[ 3 1 1 ] 51 0 51
+[ 3 2 0 ] 52 0 52
+[ 3 2 0 ] 53 0 53
+[ 3 2 0 ] 54 0 54
+[ 3 2 0 ] 55 0 55
+[ 3 2 1 ] 56 0 56
+[ 3 2 1 ] 57 0 57
+[ 3 2 1 ] 58 0 58
+[ 3 2 1 ] 59 0 59
+59 differences found
+
+dataset: </dset> and </dset>
+Not comparable: </dset> or </dset> is an empty dataset
+0 differences found
+Attributes status: 33 common, 0 only in obj1, 0 only in obj2
+attribute: <VLstring of </dset>> and <VLstring of </dset>>
+size: [2] [2]
+position VLstring of </dset> VLstring of </dset> difference
+------------------------------------------------------------
+[ 0 ] a z
+[ 0 ] b z
+[ 1 ] d z
+[ 1 ] e z
+4 differences found
+attribute: <VLstring2D of </dset>> and <VLstring2D of </dset>>
+size: [3x2] [3x2]
+position VLstring2D of </dset> VLstring2D of </dset> difference
+------------------------------------------------------------
+[ 0 0 ] a z
+[ 0 0 ] b z
+[ 0 1 ] c z
+[ 0 1 ] d z
+[ 1 0 ] e z
+[ 1 0 ] f z
+[ 1 1 ] g z
+[ 1 1 ] h z
+[ 2 0 ] i z
+[ 2 0 ] j z
+[ 2 1 ] k z
+[ 2 1 ] l z
+12 differences found
+attribute: <VLstring3D of </dset>> and <VLstring3D of </dset>>
+size: [4x3x2] [4x3x2]
+position VLstring3D of </dset> VLstring3D of </dset> difference
+------------------------------------------------------------
+[ 0 0 0 ] a z
+[ 0 0 0 ] b z
+[ 0 0 1 ] c z
+[ 0 0 1 ] d z
+[ 0 1 0 ] e z
+[ 0 1 0 ] f z
+[ 0 1 1 ] g z
+[ 0 1 1 ] h z
+[ 0 2 0 ] i z
+[ 0 2 0 ] j z
+[ 0 2 1 ] k z
+[ 0 2 1 ] l z
+[ 1 0 0 ] m z
+[ 1 0 0 ] n z
+[ 1 0 1 ] p z
+[ 1 0 1 ] q z
+[ 1 1 0 ] r z
+[ 1 1 0 ] s z
+[ 1 1 1 ] t z
+[ 1 1 1 ] u z
+[ 1 2 0 ] v z
+[ 1 2 0 ] w z
+[ 1 2 1 ] x z
+[ 2 0 0 ] A z
+[ 2 0 0 ] B z
+[ 2 0 1 ] C z
+[ 2 0 1 ] D z
+[ 2 1 0 ] E z
+[ 2 1 0 ] F z
+[ 2 1 1 ] G z
+[ 2 1 1 ] H z
+[ 2 2 0 ] I z
+[ 2 2 0 ] J z
+[ 2 2 1 ] K z
+[ 2 2 1 ] L z
+[ 3 0 0 ] M z
+[ 3 0 0 ] N z
+[ 3 0 1 ] P z
+[ 3 0 1 ] Q z
+[ 3 1 0 ] R z
+[ 3 1 0 ] S z
+[ 3 1 1 ] T z
+[ 3 1 1 ] U z
+[ 3 2 0 ] V z
+[ 3 2 0 ] W z
+[ 3 2 1 ] X z
+[ 3 2 1 ] Z z
+47 differences found
+attribute: <array of </dset>> and <array of </dset>>
+size: [2] [2]
+position array of </dset> array of </dset> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 0 ] 2 0 2
+[ 0 ] 3 0 3
+[ 1 ] 4 0 4
+[ 1 ] 5 0 5
+[ 1 ] 6 0 6
+6 differences found
+attribute: <array2D of </dset>> and <array2D of </dset>>
+size: [3x2] [3x2]
+position array2D of </dset> array2D of </dset> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 0 ] 2 0 2
+[ 0 0 ] 3 0 3
+[ 0 1 ] 4 0 4
+[ 0 1 ] 5 0 5
+[ 0 1 ] 6 0 6
+[ 1 0 ] 7 0 7
+[ 1 0 ] 8 0 8
+[ 1 0 ] 9 0 9
+[ 1 1 ] 10 0 10
+[ 1 1 ] 11 0 11
+[ 1 1 ] 12 0 12
+[ 2 0 ] 13 0 13
+[ 2 0 ] 14 0 14
+[ 2 0 ] 15 0 15
+[ 2 1 ] 16 0 16
+[ 2 1 ] 17 0 17
+[ 2 1 ] 18 0 18
+18 differences found
+attribute: <array3D of </dset>> and <array3D of </dset>>
+size: [4x3x2] [4x3x2]
+position array3D of </dset> array3D of </dset> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 0 ] 2 0 2
+[ 0 0 0 ] 3 0 3
+[ 0 0 1 ] 4 0 4
+[ 0 0 1 ] 5 0 5
+[ 0 0 1 ] 6 0 6
+[ 0 1 0 ] 7 0 7
+[ 0 1 0 ] 8 0 8
+[ 0 1 0 ] 9 0 9
+[ 0 1 1 ] 10 0 10
+[ 0 1 1 ] 11 0 11
+[ 0 1 1 ] 12 0 12
+[ 0 2 0 ] 13 0 13
+[ 0 2 0 ] 14 0 14
+[ 0 2 0 ] 15 0 15
+[ 0 2 1 ] 16 0 16
+[ 0 2 1 ] 17 0 17
+[ 0 2 1 ] 18 0 18
+[ 1 0 0 ] 19 0 19
+[ 1 0 0 ] 20 0 20
+[ 1 0 0 ] 21 0 21
+[ 1 0 1 ] 22 0 22
+[ 1 0 1 ] 23 0 23
+[ 1 0 1 ] 24 0 24
+[ 1 1 0 ] 25 0 25
+[ 1 1 0 ] 26 0 26
+[ 1 1 0 ] 27 0 27
+[ 1 1 1 ] 28 0 28
+[ 1 1 1 ] 29 0 29
+[ 1 1 1 ] 30 0 30
+[ 1 2 0 ] 31 0 31
+[ 1 2 0 ] 32 0 32
+[ 1 2 0 ] 33 0 33
+[ 1 2 1 ] 34 0 34
+[ 1 2 1 ] 35 0 35
+[ 1 2 1 ] 36 0 36
+[ 2 0 0 ] 37 0 37
+[ 2 0 0 ] 38 0 38
+[ 2 0 0 ] 39 0 39
+[ 2 0 1 ] 40 0 40
+[ 2 0 1 ] 41 0 41
+[ 2 0 1 ] 42 0 42
+[ 2 1 0 ] 43 0 43
+[ 2 1 0 ] 44 0 44
+[ 2 1 0 ] 45 0 45
+[ 2 1 1 ] 46 0 46
+[ 2 1 1 ] 47 0 47
+[ 2 1 1 ] 48 0 48
+[ 2 2 0 ] 49 0 49
+[ 2 2 0 ] 50 0 50
+[ 2 2 0 ] 51 0 51
+[ 2 2 1 ] 52 0 52
+[ 2 2 1 ] 53 0 53
+[ 2 2 1 ] 54 0 54
+[ 3 0 0 ] 55 0 55
+[ 3 0 0 ] 56 0 56
+[ 3 0 0 ] 57 0 57
+[ 3 0 1 ] 58 0 58
+[ 3 0 1 ] 59 0 59
+[ 3 0 1 ] 60 0 60
+[ 3 1 0 ] 61 0 61
+[ 3 1 0 ] 62 0 62
+[ 3 1 0 ] 63 0 63
+[ 3 1 1 ] 64 0 64
+[ 3 1 1 ] 65 0 65
+[ 3 1 1 ] 66 0 66
+[ 3 2 0 ] 67 0 67
+[ 3 2 0 ] 68 0 68
+[ 3 2 0 ] 69 0 69
+[ 3 2 1 ] 70 0 70
+[ 3 2 1 ] 71 0 71
+[ 3 2 1 ] 72 0 72
+72 differences found
+attribute: <bitfield of </dset>> and <bitfield of </dset>>
+size: [2] [2]
+position bitfield of </dset> bitfield of </dset> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+2 differences found
+attribute: <bitfield2D of </dset>> and <bitfield2D of </dset>>
+size: [3x2] [3x2]
+position bitfield2D of </dset> bitfield2D of </dset> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 2 0 ] 5 0 5
+[ 2 1 ] 6 0 6
+6 differences found
+attribute: <bitfield3D of </dset>> and <bitfield3D of </dset>>
+size: [4x3x2] [4x3x2]
+position bitfield3D of </dset> bitfield3D of </dset> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 1 ] 2 0 2
+[ 0 1 0 ] 3 0 3
+[ 0 1 1 ] 4 0 4
+[ 0 2 0 ] 5 0 5
+[ 0 2 1 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 1 0 ] 9 0 9
+[ 1 1 1 ] 10 0 10
+[ 1 2 0 ] 11 0 11
+[ 1 2 1 ] 12 0 12
+[ 2 0 0 ] 13 0 13
+[ 2 0 1 ] 14 0 14
+[ 2 1 0 ] 15 0 15
+[ 2 1 1 ] 16 0 16
+[ 2 2 0 ] 17 0 17
+[ 2 2 1 ] 18 0 18
+[ 3 0 0 ] 19 0 19
+[ 3 0 1 ] 20 0 20
+[ 3 1 0 ] 21 0 21
+[ 3 1 1 ] 22 0 22
+[ 3 2 0 ] 23 0 23
+[ 3 2 1 ] 24 0 24
+24 differences found
+attribute: <compound of </dset>> and <compound of </dset>>
+size: [2] [2]
+position compound of </dset> compound of </dset> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 0 ] 2 0 2
+[ 1 ] 3 0 3
+[ 1 ] 4 0 4
+4 differences found
+attribute: <compound2D of </dset>> and <compound2D of </dset>>
+size: [3x2] [3x2]
+position compound2D of </dset> compound2D of </dset> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 0 ] 2 0 2
+[ 0 1 ] 3 0 3
+[ 0 1 ] 4 0 4
+[ 1 0 ] 5 0 5
+[ 1 0 ] 6 0 6
+[ 1 1 ] 7 0 7
+[ 1 1 ] 8 0 8
+[ 2 0 ] 9 0 9
+[ 2 0 ] 10 0 10
+[ 2 1 ] 11 0 11
+[ 2 1 ] 12 0 12
+12 differences found
+attribute: <compound3D of </dset>> and <compound3D of </dset>>
+size: [4x3x2] [4x3x2]
+position compound3D of </dset> compound3D of </dset> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 0 ] 2 0 2
+[ 0 0 1 ] 3 0 3
+[ 0 0 1 ] 4 0 4
+[ 0 1 0 ] 5 0 5
+[ 0 1 0 ] 6 0 6
+[ 0 1 1 ] 7 0 7
+[ 0 1 1 ] 8 0 8
+[ 0 2 0 ] 9 0 9
+[ 0 2 0 ] 10 0 10
+[ 0 2 1 ] 11 0 11
+[ 0 2 1 ] 12 0 12
+[ 1 0 0 ] 13 0 13
+[ 1 0 0 ] 14 0 14
+[ 1 0 1 ] 15 0 15
+[ 1 0 1 ] 16 0 16
+[ 1 1 0 ] 17 0 17
+[ 1 1 0 ] 18 0 18
+[ 1 1 1 ] 19 0 19
+[ 1 1 1 ] 20 0 20
+[ 1 2 0 ] 21 0 21
+[ 1 2 0 ] 22 0 22
+[ 1 2 1 ] 23 0 23
+[ 1 2 1 ] 24 0 24
+[ 2 0 0 ] 25 0 25
+[ 2 0 0 ] 26 0 26
+[ 2 0 1 ] 27 0 27
+[ 2 0 1 ] 28 0 28
+[ 2 1 0 ] 29 0 29
+[ 2 1 0 ] 30 0 30
+[ 2 1 1 ] 31 0 31
+[ 2 1 1 ] 32 0 32
+[ 2 2 0 ] 33 0 33
+[ 2 2 0 ] 34 0 34
+[ 2 2 1 ] 35 0 35
+[ 2 2 1 ] 36 0 36
+[ 3 0 0 ] 37 0 37
+[ 3 0 0 ] 38 0 38
+[ 3 0 1 ] 39 0 39
+[ 3 0 1 ] 40 0 40
+[ 3 1 0 ] 41 0 41
+[ 3 1 0 ] 42 0 42
+[ 3 1 1 ] 43 0 43
+[ 3 1 1 ] 44 0 44
+[ 3 2 0 ] 45 0 45
+[ 3 2 0 ] 46 0 46
+[ 3 2 1 ] 47 0 47
+[ 3 2 1 ] 48 0 48
+48 differences found
+attribute: <enum of </dset>> and <enum of </dset>>
+size: [2] [2]
+position enum of </dset> enum of </dset> difference
+------------------------------------------------------------
+[ 0 ] RED GREEN
+[ 1 ] RED GREEN
+2 differences found
+attribute: <enum2D of </dset>> and <enum2D of </dset>>
+size: [3x2] [3x2]
+position enum2D of </dset> enum2D of </dset> difference
+------------------------------------------------------------
+[ 0 0 ] RED GREEN
+[ 0 1 ] RED GREEN
+[ 1 0 ] RED GREEN
+[ 1 1 ] RED GREEN
+[ 2 0 ] RED GREEN
+[ 2 1 ] RED GREEN
+6 differences found
+attribute: <enum3D of </dset>> and <enum3D of </dset>>
+size: [4x3x2] [4x3x2]
+position enum3D of </dset> enum3D of </dset> difference
+------------------------------------------------------------
+[ 0 0 0 ] GREEN RED
+[ 0 0 1 ] GREEN RED
+[ 0 1 0 ] GREEN RED
+[ 0 1 1 ] GREEN RED
+[ 0 2 0 ] GREEN RED
+[ 0 2 1 ] GREEN RED
+[ 1 0 0 ] GREEN RED
+[ 1 0 1 ] GREEN RED
+[ 1 1 0 ] GREEN RED
+[ 1 1 1 ] GREEN RED
+[ 1 2 0 ] GREEN RED
+[ 1 2 1 ] GREEN RED
+[ 2 0 0 ] GREEN RED
+[ 2 0 1 ] GREEN RED
+[ 2 1 0 ] GREEN RED
+[ 2 1 1 ] GREEN RED
+[ 2 2 0 ] GREEN RED
+[ 2 2 1 ] GREEN RED
+[ 3 0 0 ] GREEN RED
+[ 3 0 1 ] GREEN RED
+[ 3 1 0 ] GREEN RED
+[ 3 1 1 ] GREEN RED
+[ 3 2 0 ] GREEN RED
+[ 3 2 1 ] GREEN RED
+24 differences found
+attribute: <float of </dset>> and <float of </dset>>
+size: [2] [2]
+position float of </dset> float of </dset> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+2 differences found
+attribute: <float2D of </dset>> and <float2D of </dset>>
+size: [3x2] [3x2]
+position float2D of </dset> float2D of </dset> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 2 0 ] 5 0 5
+[ 2 1 ] 6 0 6
+6 differences found
+attribute: <float3D of </dset>> and <float3D of </dset>>
+size: [4x3x2] [4x3x2]
+position float3D of </dset> float3D of </dset> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 1 ] 2 0 2
+[ 0 1 0 ] 3 0 3
+[ 0 1 1 ] 4 0 4
+[ 0 2 0 ] 5 0 5
+[ 0 2 1 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 1 0 ] 9 0 9
+[ 1 1 1 ] 10 0 10
+[ 1 2 0 ] 11 0 11
+[ 1 2 1 ] 12 0 12
+[ 2 0 0 ] 13 0 13
+[ 2 0 1 ] 14 0 14
+[ 2 1 0 ] 15 0 15
+[ 2 1 1 ] 16 0 16
+[ 2 2 0 ] 17 0 17
+[ 2 2 1 ] 18 0 18
+[ 3 0 0 ] 19 0 19
+[ 3 0 1 ] 20 0 20
+[ 3 1 0 ] 21 0 21
+[ 3 1 1 ] 22 0 22
+[ 3 2 0 ] 23 0 23
+[ 3 2 1 ] 24 0 24
+24 differences found
+attribute: <integer of </dset>> and <integer of </dset>>
+size: [2] [2]
+position integer of </dset> integer of </dset> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+2 differences found
+attribute: <integer2D of </dset>> and <integer2D of </dset>>
+size: [3x2] [3x2]
+position integer2D of </dset> integer2D of </dset> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 2 0 ] 5 0 5
+[ 2 1 ] 6 0 6
+6 differences found
+attribute: <integer3D of </dset>> and <integer3D of </dset>>
+size: [4x3x2] [4x3x2]
+position integer3D of </dset> integer3D of </dset> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 1 ] 2 0 2
+[ 0 1 0 ] 3 0 3
+[ 0 1 1 ] 4 0 4
+[ 0 2 0 ] 5 0 5
+[ 0 2 1 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 1 0 ] 9 0 9
+[ 1 1 1 ] 10 0 10
+[ 1 2 0 ] 11 0 11
+[ 1 2 1 ] 12 0 12
+[ 2 0 0 ] 13 0 13
+[ 2 0 1 ] 14 0 14
+[ 2 1 0 ] 15 0 15
+[ 2 1 1 ] 16 0 16
+[ 2 2 0 ] 17 0 17
+[ 2 2 1 ] 18 0 18
+[ 3 0 0 ] 19 0 19
+[ 3 0 1 ] 20 0 20
+[ 3 1 0 ] 21 0 21
+[ 3 1 1 ] 22 0 22
+[ 3 2 0 ] 23 0 23
+[ 3 2 1 ] 24 0 24
+24 differences found
+attribute: <opaque of </dset>> and <opaque of </dset>>
+size: [2] [2]
+position opaque of </dset> opaque of </dset> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+2 differences found
+attribute: <opaque2D of </dset>> and <opaque2D of </dset>>
+size: [3x2] [3x2]
+position opaque2D of </dset> opaque2D of </dset> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 2 0 ] 5 0 5
+[ 2 1 ] 6 0 6
+6 differences found
+attribute: <opaque3D of </dset>> and <opaque3D of </dset>>
+size: [4x3x2] [4x3x2]
+position opaque3D of </dset> opaque3D of </dset> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 1 ] 2 0 2
+[ 0 1 0 ] 3 0 3
+[ 0 1 1 ] 4 0 4
+[ 0 2 0 ] 5 0 5
+[ 0 2 1 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 1 0 ] 9 0 9
+[ 1 1 1 ] 10 0 10
+[ 1 2 0 ] 11 0 11
+[ 1 2 1 ] 12 0 12
+[ 2 0 0 ] 13 0 13
+[ 2 0 1 ] 14 0 14
+[ 2 1 0 ] 15 0 15
+[ 2 1 1 ] 16 0 16
+[ 2 2 0 ] 17 0 17
+[ 2 2 1 ] 18 0 18
+[ 3 0 0 ] 19 0 19
+[ 3 0 1 ] 20 0 20
+[ 3 1 0 ] 21 0 21
+[ 3 1 1 ] 22 0 22
+[ 3 2 0 ] 23 0 23
+[ 3 2 1 ] 24 0 24
+24 differences found
+attribute: <reference of </dset>> and <reference of </dset>>
+0 differences found
+attribute: <reference2D of </dset>> and <reference2D of </dset>>
+0 differences found
+attribute: <reference3D of </dset>> and <reference3D of </dset>>
+0 differences found
+attribute: <string of </dset>> and <string of </dset>>
+size: [2] [2]
+position string of </dset> string of </dset> difference
+------------------------------------------------------------
+[ 0 ] a z
+[ 0 ] b z
+[ 1 ] d z
+[ 1 ] e z
+4 differences found
+attribute: <string2D of </dset>> and <string2D of </dset>>
+size: [3x2] [3x2]
+position string2D of </dset> string2D of </dset> difference
+------------------------------------------------------------
+[ 0 0 ] a z
+[ 0 0 ] b z
+[ 0 1 ] c z
+[ 0 1 ] d z
+[ 1 0 ] e z
+[ 1 0 ] f z
+[ 1 1 ] g z
+[ 1 1 ] h z
+[ 2 0 ] i z
+[ 2 0 ] j z
+[ 2 1 ] k z
+[ 2 1 ] l z
+12 differences found
+attribute: <string3D of </dset>> and <string3D of </dset>>
+size: [4x3x2] [4x3x2]
+position string3D of </dset> string3D of </dset> difference
+------------------------------------------------------------
+[ 0 0 0 ] a z
+[ 0 0 0 ] b z
+[ 0 0 1 ] c z
+[ 0 0 1 ] d z
+[ 0 1 0 ] e z
+[ 0 1 0 ] f z
+[ 0 1 1 ] g z
+[ 0 1 1 ] h z
+[ 0 2 0 ] i z
+[ 0 2 0 ] j z
+[ 0 2 1 ] k z
+[ 0 2 1 ] l z
+[ 1 0 0 ] m z
+[ 1 0 0 ] n z
+[ 1 0 1 ] p z
+[ 1 0 1 ] q z
+[ 1 1 0 ] r z
+[ 1 1 0 ] s z
+[ 1 1 1 ] t z
+[ 1 1 1 ] u z
+[ 1 2 0 ] v z
+[ 1 2 0 ] w z
+[ 1 2 1 ] x z
+[ 2 0 0 ] A z
+[ 2 0 0 ] B z
+[ 2 0 1 ] C z
+[ 2 0 1 ] D z
+[ 2 1 0 ] E z
+[ 2 1 0 ] F z
+[ 2 1 1 ] G z
+[ 2 1 1 ] H z
+[ 2 2 0 ] I z
+[ 2 2 0 ] J z
+[ 2 2 1 ] K z
+[ 2 2 1 ] L z
+[ 3 0 0 ] M z
+[ 3 0 0 ] N z
+[ 3 0 1 ] P z
+[ 3 0 1 ] Q z
+[ 3 1 0 ] R z
+[ 3 1 0 ] S z
+[ 3 1 1 ] T z
+[ 3 1 1 ] U z
+[ 3 2 0 ] V z
+[ 3 2 0 ] W z
+[ 3 2 1 ] X z
+[ 3 2 1 ] Z z
+47 differences found
+attribute: <vlen of </dset>> and <vlen of </dset>>
+size: [2] [2]
+position vlen of </dset> vlen of </dset> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+[ 1 ] 3 0 3
+3 differences found
+attribute: <vlen2D of </dset>> and <vlen2D of </dset>>
+size: [3x2] [3x2]
+position vlen2D of </dset> vlen2D of </dset> difference
+------------------------------------------------------------
+[ 0 1 ] 1 0 1
+[ 1 0 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 1 1 ] 5 0 5
+[ 2 0 ] 6 0 6
+[ 2 0 ] 7 0 7
+[ 2 0 ] 8 0 8
+[ 2 1 ] 9 0 9
+[ 2 1 ] 10 0 10
+[ 2 1 ] 11 0 11
+11 differences found
+attribute: <vlen3D of </dset>> and <vlen3D of </dset>>
+size: [4x3x2] [4x3x2]
+position vlen3D of </dset> vlen3D of </dset> difference
+------------------------------------------------------------
+[ 0 0 1 ] 1 0 1
+[ 0 1 0 ] 2 0 2
+[ 0 1 1 ] 3 0 3
+[ 0 2 0 ] 4 0 4
+[ 0 2 1 ] 5 0 5
+[ 1 0 0 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 0 1 ] 9 0 9
+[ 1 1 0 ] 10 0 10
+[ 1 1 0 ] 11 0 11
+[ 1 1 1 ] 12 0 12
+[ 1 1 1 ] 13 0 13
+[ 1 2 0 ] 14 0 14
+[ 1 2 0 ] 15 0 15
+[ 1 2 1 ] 16 0 16
+[ 1 2 1 ] 17 0 17
+[ 2 0 0 ] 18 0 18
+[ 2 0 0 ] 19 0 19
+[ 2 0 0 ] 20 0 20
+[ 2 0 1 ] 21 0 21
+[ 2 0 1 ] 22 0 22
+[ 2 0 1 ] 23 0 23
+[ 2 1 0 ] 24 0 24
+[ 2 1 0 ] 25 0 25
+[ 2 1 0 ] 26 0 26
+[ 2 1 1 ] 27 0 27
+[ 2 1 1 ] 28 0 28
+[ 2 1 1 ] 29 0 29
+[ 2 2 0 ] 30 0 30
+[ 2 2 0 ] 31 0 31
+[ 2 2 0 ] 32 0 32
+[ 2 2 1 ] 33 0 33
+[ 2 2 1 ] 34 0 34
+[ 2 2 1 ] 35 0 35
+[ 3 0 0 ] 36 0 36
+[ 3 0 0 ] 37 0 37
+[ 3 0 0 ] 38 0 38
+[ 3 0 0 ] 39 0 39
+[ 3 0 1 ] 40 0 40
+[ 3 0 1 ] 41 0 41
+[ 3 0 1 ] 42 0 42
+[ 3 0 1 ] 43 0 43
+[ 3 1 0 ] 44 0 44
+[ 3 1 0 ] 45 0 45
+[ 3 1 0 ] 46 0 46
+[ 3 1 0 ] 47 0 47
+[ 3 1 1 ] 48 0 48
+[ 3 1 1 ] 49 0 49
+[ 3 1 1 ] 50 0 50
+[ 3 1 1 ] 51 0 51
+[ 3 2 0 ] 52 0 52
+[ 3 2 0 ] 53 0 53
+[ 3 2 0 ] 54 0 54
+[ 3 2 0 ] 55 0 55
+[ 3 2 1 ] 56 0 56
+[ 3 2 1 ] 57 0 57
+[ 3 2 1 ] 58 0 58
+[ 3 2 1 ] 59 0 59
+59 differences found
+
+group : </g1> and </g1>
+0 differences found
+Attributes status: 30 common, 0 only in obj1, 0 only in obj2
+attribute: <VLstring of </g1>> and <VLstring of </g1>>
+size: [2] [2]
+position VLstring of </g1> VLstring of </g1> difference
+------------------------------------------------------------
+[ 0 ] a z
+[ 0 ] b z
+[ 1 ] d z
+[ 1 ] e z
+4 differences found
+attribute: <VLstring2D of </g1>> and <VLstring2D of </g1>>
+size: [3x2] [3x2]
+position VLstring2D of </g1> VLstring2D of </g1> difference
+------------------------------------------------------------
+[ 0 0 ] a z
+[ 0 0 ] b z
+[ 0 1 ] c z
+[ 0 1 ] d z
+[ 1 0 ] e z
+[ 1 0 ] f z
+[ 1 1 ] g z
+[ 1 1 ] h z
+[ 2 0 ] i z
+[ 2 0 ] j z
+[ 2 1 ] k z
+[ 2 1 ] l z
+12 differences found
+attribute: <VLstring3D of </g1>> and <VLstring3D of </g1>>
+size: [4x3x2] [4x3x2]
+position VLstring3D of </g1> VLstring3D of </g1> difference
+------------------------------------------------------------
+[ 0 0 0 ] a z
+[ 0 0 0 ] b z
+[ 0 0 1 ] c z
+[ 0 0 1 ] d z
+[ 0 1 0 ] e z
+[ 0 1 0 ] f z
+[ 0 1 1 ] g z
+[ 0 1 1 ] h z
+[ 0 2 0 ] i z
+[ 0 2 0 ] j z
+[ 0 2 1 ] k z
+[ 0 2 1 ] l z
+[ 1 0 0 ] m z
+[ 1 0 0 ] n z
+[ 1 0 1 ] p z
+[ 1 0 1 ] q z
+[ 1 1 0 ] r z
+[ 1 1 0 ] s z
+[ 1 1 1 ] t z
+[ 1 1 1 ] u z
+[ 1 2 0 ] v z
+[ 1 2 0 ] w z
+[ 1 2 1 ] x z
+[ 2 0 0 ] A z
+[ 2 0 0 ] B z
+[ 2 0 1 ] C z
+[ 2 0 1 ] D z
+[ 2 1 0 ] E z
+[ 2 1 0 ] F z
+[ 2 1 1 ] G z
+[ 2 1 1 ] H z
+[ 2 2 0 ] I z
+[ 2 2 0 ] J z
+[ 2 2 1 ] K z
+[ 2 2 1 ] L z
+[ 3 0 0 ] M z
+[ 3 0 0 ] N z
+[ 3 0 1 ] P z
+[ 3 0 1 ] Q z
+[ 3 1 0 ] R z
+[ 3 1 0 ] S z
+[ 3 1 1 ] T z
+[ 3 1 1 ] U z
+[ 3 2 0 ] V z
+[ 3 2 0 ] W z
+[ 3 2 1 ] X z
+[ 3 2 1 ] Z z
+47 differences found
+attribute: <array of </g1>> and <array of </g1>>
+size: [2] [2]
+position array of </g1> array of </g1> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 0 ] 2 0 2
+[ 0 ] 3 0 3
+[ 1 ] 4 0 4
+[ 1 ] 5 0 5
+[ 1 ] 6 0 6
+6 differences found
+attribute: <array2D of </g1>> and <array2D of </g1>>
+size: [3x2] [3x2]
+position array2D of </g1> array2D of </g1> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 0 ] 2 0 2
+[ 0 0 ] 3 0 3
+[ 0 1 ] 4 0 4
+[ 0 1 ] 5 0 5
+[ 0 1 ] 6 0 6
+[ 1 0 ] 7 0 7
+[ 1 0 ] 8 0 8
+[ 1 0 ] 9 0 9
+[ 1 1 ] 10 0 10
+[ 1 1 ] 11 0 11
+[ 1 1 ] 12 0 12
+[ 2 0 ] 13 0 13
+[ 2 0 ] 14 0 14
+[ 2 0 ] 15 0 15
+[ 2 1 ] 16 0 16
+[ 2 1 ] 17 0 17
+[ 2 1 ] 18 0 18
+18 differences found
+attribute: <array3D of </g1>> and <array3D of </g1>>
+size: [4x3x2] [4x3x2]
+position array3D of </g1> array3D of </g1> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 0 ] 2 0 2
+[ 0 0 0 ] 3 0 3
+[ 0 0 1 ] 4 0 4
+[ 0 0 1 ] 5 0 5
+[ 0 0 1 ] 6 0 6
+[ 0 1 0 ] 7 0 7
+[ 0 1 0 ] 8 0 8
+[ 0 1 0 ] 9 0 9
+[ 0 1 1 ] 10 0 10
+[ 0 1 1 ] 11 0 11
+[ 0 1 1 ] 12 0 12
+[ 0 2 0 ] 13 0 13
+[ 0 2 0 ] 14 0 14
+[ 0 2 0 ] 15 0 15
+[ 0 2 1 ] 16 0 16
+[ 0 2 1 ] 17 0 17
+[ 0 2 1 ] 18 0 18
+[ 1 0 0 ] 19 0 19
+[ 1 0 0 ] 20 0 20
+[ 1 0 0 ] 21 0 21
+[ 1 0 1 ] 22 0 22
+[ 1 0 1 ] 23 0 23
+[ 1 0 1 ] 24 0 24
+[ 1 1 0 ] 25 0 25
+[ 1 1 0 ] 26 0 26
+[ 1 1 0 ] 27 0 27
+[ 1 1 1 ] 28 0 28
+[ 1 1 1 ] 29 0 29
+[ 1 1 1 ] 30 0 30
+[ 1 2 0 ] 31 0 31
+[ 1 2 0 ] 32 0 32
+[ 1 2 0 ] 33 0 33
+[ 1 2 1 ] 34 0 34
+[ 1 2 1 ] 35 0 35
+[ 1 2 1 ] 36 0 36
+[ 2 0 0 ] 37 0 37
+[ 2 0 0 ] 38 0 38
+[ 2 0 0 ] 39 0 39
+[ 2 0 1 ] 40 0 40
+[ 2 0 1 ] 41 0 41
+[ 2 0 1 ] 42 0 42
+[ 2 1 0 ] 43 0 43
+[ 2 1 0 ] 44 0 44
+[ 2 1 0 ] 45 0 45
+[ 2 1 1 ] 46 0 46
+[ 2 1 1 ] 47 0 47
+[ 2 1 1 ] 48 0 48
+[ 2 2 0 ] 49 0 49
+[ 2 2 0 ] 50 0 50
+[ 2 2 0 ] 51 0 51
+[ 2 2 1 ] 52 0 52
+[ 2 2 1 ] 53 0 53
+[ 2 2 1 ] 54 0 54
+[ 3 0 0 ] 55 0 55
+[ 3 0 0 ] 56 0 56
+[ 3 0 0 ] 57 0 57
+[ 3 0 1 ] 58 0 58
+[ 3 0 1 ] 59 0 59
+[ 3 0 1 ] 60 0 60
+[ 3 1 0 ] 61 0 61
+[ 3 1 0 ] 62 0 62
+[ 3 1 0 ] 63 0 63
+[ 3 1 1 ] 64 0 64
+[ 3 1 1 ] 65 0 65
+[ 3 1 1 ] 66 0 66
+[ 3 2 0 ] 67 0 67
+[ 3 2 0 ] 68 0 68
+[ 3 2 0 ] 69 0 69
+[ 3 2 1 ] 70 0 70
+[ 3 2 1 ] 71 0 71
+[ 3 2 1 ] 72 0 72
+72 differences found
+attribute: <bitfield of </g1>> and <bitfield of </g1>>
+size: [2] [2]
+position bitfield of </g1> bitfield of </g1> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+2 differences found
+attribute: <bitfield2D of </g1>> and <bitfield2D of </g1>>
+size: [3x2] [3x2]
+position bitfield2D of </g1> bitfield2D of </g1> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 2 0 ] 5 0 5
+[ 2 1 ] 6 0 6
+6 differences found
+attribute: <bitfield3D of </g1>> and <bitfield3D of </g1>>
+size: [4x3x2] [4x3x2]
+position bitfield3D of </g1> bitfield3D of </g1> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 1 ] 2 0 2
+[ 0 1 0 ] 3 0 3
+[ 0 1 1 ] 4 0 4
+[ 0 2 0 ] 5 0 5
+[ 0 2 1 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 1 0 ] 9 0 9
+[ 1 1 1 ] 10 0 10
+[ 1 2 0 ] 11 0 11
+[ 1 2 1 ] 12 0 12
+[ 2 0 0 ] 13 0 13
+[ 2 0 1 ] 14 0 14
+[ 2 1 0 ] 15 0 15
+[ 2 1 1 ] 16 0 16
+[ 2 2 0 ] 17 0 17
+[ 2 2 1 ] 18 0 18
+[ 3 0 0 ] 19 0 19
+[ 3 0 1 ] 20 0 20
+[ 3 1 0 ] 21 0 21
+[ 3 1 1 ] 22 0 22
+[ 3 2 0 ] 23 0 23
+[ 3 2 1 ] 24 0 24
+24 differences found
+attribute: <compound of </g1>> and <compound of </g1>>
+size: [2] [2]
+position compound of </g1> compound of </g1> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 0 ] 2 0 2
+[ 1 ] 3 0 3
+[ 1 ] 4 0 4
+4 differences found
+attribute: <compound2D of </g1>> and <compound2D of </g1>>
+size: [3x2] [3x2]
+position compound2D of </g1> compound2D of </g1> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 0 ] 2 0 2
+[ 0 1 ] 3 0 3
+[ 0 1 ] 4 0 4
+[ 1 0 ] 5 0 5
+[ 1 0 ] 6 0 6
+[ 1 1 ] 7 0 7
+[ 1 1 ] 8 0 8
+[ 2 0 ] 9 0 9
+[ 2 0 ] 10 0 10
+[ 2 1 ] 11 0 11
+[ 2 1 ] 12 0 12
+12 differences found
+attribute: <compound3D of </g1>> and <compound3D of </g1>>
+size: [4x3x2] [4x3x2]
+position compound3D of </g1> compound3D of </g1> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 0 ] 2 0 2
+[ 0 0 1 ] 3 0 3
+[ 0 0 1 ] 4 0 4
+[ 0 1 0 ] 5 0 5
+[ 0 1 0 ] 6 0 6
+[ 0 1 1 ] 7 0 7
+[ 0 1 1 ] 8 0 8
+[ 0 2 0 ] 9 0 9
+[ 0 2 0 ] 10 0 10
+[ 0 2 1 ] 11 0 11
+[ 0 2 1 ] 12 0 12
+[ 1 0 0 ] 13 0 13
+[ 1 0 0 ] 14 0 14
+[ 1 0 1 ] 15 0 15
+[ 1 0 1 ] 16 0 16
+[ 1 1 0 ] 17 0 17
+[ 1 1 0 ] 18 0 18
+[ 1 1 1 ] 19 0 19
+[ 1 1 1 ] 20 0 20
+[ 1 2 0 ] 21 0 21
+[ 1 2 0 ] 22 0 22
+[ 1 2 1 ] 23 0 23
+[ 1 2 1 ] 24 0 24
+[ 2 0 0 ] 25 0 25
+[ 2 0 0 ] 26 0 26
+[ 2 0 1 ] 27 0 27
+[ 2 0 1 ] 28 0 28
+[ 2 1 0 ] 29 0 29
+[ 2 1 0 ] 30 0 30
+[ 2 1 1 ] 31 0 31
+[ 2 1 1 ] 32 0 32
+[ 2 2 0 ] 33 0 33
+[ 2 2 0 ] 34 0 34
+[ 2 2 1 ] 35 0 35
+[ 2 2 1 ] 36 0 36
+[ 3 0 0 ] 37 0 37
+[ 3 0 0 ] 38 0 38
+[ 3 0 1 ] 39 0 39
+[ 3 0 1 ] 40 0 40
+[ 3 1 0 ] 41 0 41
+[ 3 1 0 ] 42 0 42
+[ 3 1 1 ] 43 0 43
+[ 3 1 1 ] 44 0 44
+[ 3 2 0 ] 45 0 45
+[ 3 2 0 ] 46 0 46
+[ 3 2 1 ] 47 0 47
+[ 3 2 1 ] 48 0 48
+48 differences found
+attribute: <enum of </g1>> and <enum of </g1>>
+size: [2] [2]
+position enum of </g1> enum of </g1> difference
+------------------------------------------------------------
+[ 0 ] RED GREEN
+[ 1 ] RED GREEN
+2 differences found
+attribute: <enum2D of </g1>> and <enum2D of </g1>>
+size: [3x2] [3x2]
+position enum2D of </g1> enum2D of </g1> difference
+------------------------------------------------------------
+[ 0 0 ] RED GREEN
+[ 0 1 ] RED GREEN
+[ 1 0 ] RED GREEN
+[ 1 1 ] RED GREEN
+[ 2 0 ] RED GREEN
+[ 2 1 ] RED GREEN
+6 differences found
+attribute: <enum3D of </g1>> and <enum3D of </g1>>
+size: [4x3x2] [4x3x2]
+position enum3D of </g1> enum3D of </g1> difference
+------------------------------------------------------------
+[ 0 0 0 ] GREEN RED
+[ 0 0 1 ] GREEN RED
+[ 0 1 0 ] GREEN RED
+[ 0 1 1 ] GREEN RED
+[ 0 2 0 ] GREEN RED
+[ 0 2 1 ] GREEN RED
+[ 1 0 0 ] GREEN RED
+[ 1 0 1 ] GREEN RED
+[ 1 1 0 ] GREEN RED
+[ 1 1 1 ] GREEN RED
+[ 1 2 0 ] GREEN RED
+[ 1 2 1 ] GREEN RED
+[ 2 0 0 ] GREEN RED
+[ 2 0 1 ] GREEN RED
+[ 2 1 0 ] GREEN RED
+[ 2 1 1 ] GREEN RED
+[ 2 2 0 ] GREEN RED
+[ 2 2 1 ] GREEN RED
+[ 3 0 0 ] GREEN RED
+[ 3 0 1 ] GREEN RED
+[ 3 1 0 ] GREEN RED
+[ 3 1 1 ] GREEN RED
+[ 3 2 0 ] GREEN RED
+[ 3 2 1 ] GREEN RED
+24 differences found
+attribute: <float of </g1>> and <float of </g1>>
+size: [2] [2]
+position float of </g1> float of </g1> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+2 differences found
+attribute: <float2D of </g1>> and <float2D of </g1>>
+size: [3x2] [3x2]
+position float2D of </g1> float2D of </g1> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 2 0 ] 5 0 5
+[ 2 1 ] 6 0 6
+6 differences found
+attribute: <float3D of </g1>> and <float3D of </g1>>
+size: [4x3x2] [4x3x2]
+position float3D of </g1> float3D of </g1> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 1 ] 2 0 2
+[ 0 1 0 ] 3 0 3
+[ 0 1 1 ] 4 0 4
+[ 0 2 0 ] 5 0 5
+[ 0 2 1 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 1 0 ] 9 0 9
+[ 1 1 1 ] 10 0 10
+[ 1 2 0 ] 11 0 11
+[ 1 2 1 ] 12 0 12
+[ 2 0 0 ] 13 0 13
+[ 2 0 1 ] 14 0 14
+[ 2 1 0 ] 15 0 15
+[ 2 1 1 ] 16 0 16
+[ 2 2 0 ] 17 0 17
+[ 2 2 1 ] 18 0 18
+[ 3 0 0 ] 19 0 19
+[ 3 0 1 ] 20 0 20
+[ 3 1 0 ] 21 0 21
+[ 3 1 1 ] 22 0 22
+[ 3 2 0 ] 23 0 23
+[ 3 2 1 ] 24 0 24
+24 differences found
+attribute: <integer of </g1>> and <integer of </g1>>
+size: [2] [2]
+position integer of </g1> integer of </g1> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+2 differences found
+attribute: <integer2D of </g1>> and <integer2D of </g1>>
+size: [3x2] [3x2]
+position integer2D of </g1> integer2D of </g1> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 2 0 ] 5 0 5
+[ 2 1 ] 6 0 6
+6 differences found
+attribute: <integer3D of </g1>> and <integer3D of </g1>>
+size: [4x3x2] [4x3x2]
+position integer3D of </g1> integer3D of </g1> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 1 ] 2 0 2
+[ 0 1 0 ] 3 0 3
+[ 0 1 1 ] 4 0 4
+[ 0 2 0 ] 5 0 5
+[ 0 2 1 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 1 0 ] 9 0 9
+[ 1 1 1 ] 10 0 10
+[ 1 2 0 ] 11 0 11
+[ 1 2 1 ] 12 0 12
+[ 2 0 0 ] 13 0 13
+[ 2 0 1 ] 14 0 14
+[ 2 1 0 ] 15 0 15
+[ 2 1 1 ] 16 0 16
+[ 2 2 0 ] 17 0 17
+[ 2 2 1 ] 18 0 18
+[ 3 0 0 ] 19 0 19
+[ 3 0 1 ] 20 0 20
+[ 3 1 0 ] 21 0 21
+[ 3 1 1 ] 22 0 22
+[ 3 2 0 ] 23 0 23
+[ 3 2 1 ] 24 0 24
+24 differences found
+attribute: <opaque of </g1>> and <opaque of </g1>>
+size: [2] [2]
+position opaque of </g1> opaque of </g1> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+2 differences found
+attribute: <opaque2D of </g1>> and <opaque2D of </g1>>
+size: [3x2] [3x2]
+position opaque2D of </g1> opaque2D of </g1> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 2 0 ] 5 0 5
+[ 2 1 ] 6 0 6
+6 differences found
+attribute: <opaque3D of </g1>> and <opaque3D of </g1>>
+size: [4x3x2] [4x3x2]
+position opaque3D of </g1> opaque3D of </g1> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 1 ] 2 0 2
+[ 0 1 0 ] 3 0 3
+[ 0 1 1 ] 4 0 4
+[ 0 2 0 ] 5 0 5
+[ 0 2 1 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 1 0 ] 9 0 9
+[ 1 1 1 ] 10 0 10
+[ 1 2 0 ] 11 0 11
+[ 1 2 1 ] 12 0 12
+[ 2 0 0 ] 13 0 13
+[ 2 0 1 ] 14 0 14
+[ 2 1 0 ] 15 0 15
+[ 2 1 1 ] 16 0 16
+[ 2 2 0 ] 17 0 17
+[ 2 2 1 ] 18 0 18
+[ 3 0 0 ] 19 0 19
+[ 3 0 1 ] 20 0 20
+[ 3 1 0 ] 21 0 21
+[ 3 1 1 ] 22 0 22
+[ 3 2 0 ] 23 0 23
+[ 3 2 1 ] 24 0 24
+24 differences found
+attribute: <string of </g1>> and <string of </g1>>
+size: [2] [2]
+position string of </g1> string of </g1> difference
+------------------------------------------------------------
+[ 0 ] a z
+[ 0 ] b z
+[ 1 ] d z
+[ 1 ] e z
+4 differences found
+attribute: <string2D of </g1>> and <string2D of </g1>>
+size: [3x2] [3x2]
+position string2D of </g1> string2D of </g1> difference
+------------------------------------------------------------
+[ 0 0 ] a z
+[ 0 0 ] b z
+[ 0 1 ] c z
+[ 0 1 ] d z
+[ 1 0 ] e z
+[ 1 0 ] f z
+[ 1 1 ] g z
+[ 1 1 ] h z
+[ 2 0 ] i z
+[ 2 0 ] j z
+[ 2 1 ] k z
+[ 2 1 ] l z
+12 differences found
+attribute: <string3D of </g1>> and <string3D of </g1>>
+size: [4x3x2] [4x3x2]
+position string3D of </g1> string3D of </g1> difference
+------------------------------------------------------------
+[ 0 0 0 ] a z
+[ 0 0 0 ] b z
+[ 0 0 1 ] c z
+[ 0 0 1 ] d z
+[ 0 1 0 ] e z
+[ 0 1 0 ] f z
+[ 0 1 1 ] g z
+[ 0 1 1 ] h z
+[ 0 2 0 ] i z
+[ 0 2 0 ] j z
+[ 0 2 1 ] k z
+[ 0 2 1 ] l z
+[ 1 0 0 ] m z
+[ 1 0 0 ] n z
+[ 1 0 1 ] p z
+[ 1 0 1 ] q z
+[ 1 1 0 ] r z
+[ 1 1 0 ] s z
+[ 1 1 1 ] t z
+[ 1 1 1 ] u z
+[ 1 2 0 ] v z
+[ 1 2 0 ] w z
+[ 1 2 1 ] x z
+[ 2 0 0 ] A z
+[ 2 0 0 ] B z
+[ 2 0 1 ] C z
+[ 2 0 1 ] D z
+[ 2 1 0 ] E z
+[ 2 1 0 ] F z
+[ 2 1 1 ] G z
+[ 2 1 1 ] H z
+[ 2 2 0 ] I z
+[ 2 2 0 ] J z
+[ 2 2 1 ] K z
+[ 2 2 1 ] L z
+[ 3 0 0 ] M z
+[ 3 0 0 ] N z
+[ 3 0 1 ] P z
+[ 3 0 1 ] Q z
+[ 3 1 0 ] R z
+[ 3 1 0 ] S z
+[ 3 1 1 ] T z
+[ 3 1 1 ] U z
+[ 3 2 0 ] V z
+[ 3 2 0 ] W z
+[ 3 2 1 ] X z
+[ 3 2 1 ] Z z
+47 differences found
+attribute: <vlen of </g1>> and <vlen of </g1>>
+size: [2] [2]
+position vlen of </g1> vlen of </g1> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+[ 1 ] 3 0 3
+3 differences found
+attribute: <vlen2D of </g1>> and <vlen2D of </g1>>
+size: [3x2] [3x2]
+position vlen2D of </g1> vlen2D of </g1> difference
+------------------------------------------------------------
+[ 0 1 ] 1 0 1
+[ 1 0 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 1 1 ] 5 0 5
+[ 2 0 ] 6 0 6
+[ 2 0 ] 7 0 7
+[ 2 0 ] 8 0 8
+[ 2 1 ] 9 0 9
+[ 2 1 ] 10 0 10
+[ 2 1 ] 11 0 11
+11 differences found
+attribute: <vlen3D of </g1>> and <vlen3D of </g1>>
+size: [4x3x2] [4x3x2]
+position vlen3D of </g1> vlen3D of </g1> difference
+------------------------------------------------------------
+[ 0 0 1 ] 1 0 1
+[ 0 1 0 ] 2 0 2
+[ 0 1 1 ] 3 0 3
+[ 0 2 0 ] 4 0 4
+[ 0 2 1 ] 5 0 5
+[ 1 0 0 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 0 1 ] 9 0 9
+[ 1 1 0 ] 10 0 10
+[ 1 1 0 ] 11 0 11
+[ 1 1 1 ] 12 0 12
+[ 1 1 1 ] 13 0 13
+[ 1 2 0 ] 14 0 14
+[ 1 2 0 ] 15 0 15
+[ 1 2 1 ] 16 0 16
+[ 1 2 1 ] 17 0 17
+[ 2 0 0 ] 18 0 18
+[ 2 0 0 ] 19 0 19
+[ 2 0 0 ] 20 0 20
+[ 2 0 1 ] 21 0 21
+[ 2 0 1 ] 22 0 22
+[ 2 0 1 ] 23 0 23
+[ 2 1 0 ] 24 0 24
+[ 2 1 0 ] 25 0 25
+[ 2 1 0 ] 26 0 26
+[ 2 1 1 ] 27 0 27
+[ 2 1 1 ] 28 0 28
+[ 2 1 1 ] 29 0 29
+[ 2 2 0 ] 30 0 30
+[ 2 2 0 ] 31 0 31
+[ 2 2 0 ] 32 0 32
+[ 2 2 1 ] 33 0 33
+[ 2 2 1 ] 34 0 34
+[ 2 2 1 ] 35 0 35
+[ 3 0 0 ] 36 0 36
+[ 3 0 0 ] 37 0 37
+[ 3 0 0 ] 38 0 38
+[ 3 0 0 ] 39 0 39
+[ 3 0 1 ] 40 0 40
+[ 3 0 1 ] 41 0 41
+[ 3 0 1 ] 42 0 42
+[ 3 0 1 ] 43 0 43
+[ 3 1 0 ] 44 0 44
+[ 3 1 0 ] 45 0 45
+[ 3 1 0 ] 46 0 46
+[ 3 1 0 ] 47 0 47
+[ 3 1 1 ] 48 0 48
+[ 3 1 1 ] 49 0 49
+[ 3 1 1 ] 50 0 50
+[ 3 1 1 ] 51 0 51
+[ 3 2 0 ] 52 0 52
+[ 3 2 0 ] 53 0 53
+[ 3 2 0 ] 54 0 54
+[ 3 2 0 ] 55 0 55
+[ 3 2 1 ] 56 0 56
+[ 3 2 1 ] 57 0 57
+[ 3 2 1 ] 58 0 58
+[ 3 2 1 ] 59 0 59
+59 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/test/h5diff/testfiles/h5diff_703.txt b/tools/test/h5diff/testfiles/h5diff_703.txt
new file mode 100644
index 0000000..405ab2f
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_703.txt
@@ -0,0 +1,2137 @@
+
+file1 file2
+---------------------------------------
+ x x /
+ x x /dset
+ x x /g1
+
+
+group : </> and </>
+0 differences found
+ obj1 obj2
+ --------------------------------------
+ x x VLstring
+ x x VLstring2D
+ x x VLstring3D
+ x x array
+ x x array2D
+ x x array3D
+ x x bitfield
+ x x bitfield2D
+ x x bitfield3D
+ x x compound
+ x x compound2D
+ x x compound3D
+ x x enum
+ x x enum2D
+ x x enum3D
+ x x float
+ x x float2D
+ x x float3D
+ x x integer
+ x x integer2D
+ x x integer3D
+ x x opaque
+ x x opaque2D
+ x x opaque3D
+ x x string
+ x x string2D
+ x x string3D
+ x x vlen
+ x x vlen2D
+ x x vlen3D
+Attributes status: 30 common, 0 only in obj1, 0 only in obj2
+attribute: <VLstring of </>> and <VLstring of </>>
+size: [2] [2]
+position VLstring of </> VLstring of </> difference
+------------------------------------------------------------
+[ 0 ] a z
+[ 0 ] b z
+[ 1 ] d z
+[ 1 ] e z
+4 differences found
+attribute: <VLstring2D of </>> and <VLstring2D of </>>
+size: [3x2] [3x2]
+position VLstring2D of </> VLstring2D of </> difference
+------------------------------------------------------------
+[ 0 0 ] a z
+[ 0 0 ] b z
+[ 0 1 ] c z
+[ 0 1 ] d z
+[ 1 0 ] e z
+[ 1 0 ] f z
+[ 1 1 ] g z
+[ 1 1 ] h z
+[ 2 0 ] i z
+[ 2 0 ] j z
+[ 2 1 ] k z
+[ 2 1 ] l z
+12 differences found
+attribute: <VLstring3D of </>> and <VLstring3D of </>>
+size: [4x3x2] [4x3x2]
+position VLstring3D of </> VLstring3D of </> difference
+------------------------------------------------------------
+[ 0 0 0 ] a z
+[ 0 0 0 ] b z
+[ 0 0 1 ] c z
+[ 0 0 1 ] d z
+[ 0 1 0 ] e z
+[ 0 1 0 ] f z
+[ 0 1 1 ] g z
+[ 0 1 1 ] h z
+[ 0 2 0 ] i z
+[ 0 2 0 ] j z
+[ 0 2 1 ] k z
+[ 0 2 1 ] l z
+[ 1 0 0 ] m z
+[ 1 0 0 ] n z
+[ 1 0 1 ] p z
+[ 1 0 1 ] q z
+[ 1 1 0 ] r z
+[ 1 1 0 ] s z
+[ 1 1 1 ] t z
+[ 1 1 1 ] u z
+[ 1 2 0 ] v z
+[ 1 2 0 ] w z
+[ 1 2 1 ] x z
+[ 2 0 0 ] A z
+[ 2 0 0 ] B z
+[ 2 0 1 ] C z
+[ 2 0 1 ] D z
+[ 2 1 0 ] E z
+[ 2 1 0 ] F z
+[ 2 1 1 ] G z
+[ 2 1 1 ] H z
+[ 2 2 0 ] I z
+[ 2 2 0 ] J z
+[ 2 2 1 ] K z
+[ 2 2 1 ] L z
+[ 3 0 0 ] M z
+[ 3 0 0 ] N z
+[ 3 0 1 ] P z
+[ 3 0 1 ] Q z
+[ 3 1 0 ] R z
+[ 3 1 0 ] S z
+[ 3 1 1 ] T z
+[ 3 1 1 ] U z
+[ 3 2 0 ] V z
+[ 3 2 0 ] W z
+[ 3 2 1 ] X z
+[ 3 2 1 ] Z z
+47 differences found
+attribute: <array of </>> and <array of </>>
+size: [2] [2]
+position array of </> array of </> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 0 ] 2 0 2
+[ 0 ] 3 0 3
+[ 1 ] 4 0 4
+[ 1 ] 5 0 5
+[ 1 ] 6 0 6
+6 differences found
+attribute: <array2D of </>> and <array2D of </>>
+size: [3x2] [3x2]
+position array2D of </> array2D of </> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 0 ] 2 0 2
+[ 0 0 ] 3 0 3
+[ 0 1 ] 4 0 4
+[ 0 1 ] 5 0 5
+[ 0 1 ] 6 0 6
+[ 1 0 ] 7 0 7
+[ 1 0 ] 8 0 8
+[ 1 0 ] 9 0 9
+[ 1 1 ] 10 0 10
+[ 1 1 ] 11 0 11
+[ 1 1 ] 12 0 12
+[ 2 0 ] 13 0 13
+[ 2 0 ] 14 0 14
+[ 2 0 ] 15 0 15
+[ 2 1 ] 16 0 16
+[ 2 1 ] 17 0 17
+[ 2 1 ] 18 0 18
+18 differences found
+attribute: <array3D of </>> and <array3D of </>>
+size: [4x3x2] [4x3x2]
+position array3D of </> array3D of </> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 0 ] 2 0 2
+[ 0 0 0 ] 3 0 3
+[ 0 0 1 ] 4 0 4
+[ 0 0 1 ] 5 0 5
+[ 0 0 1 ] 6 0 6
+[ 0 1 0 ] 7 0 7
+[ 0 1 0 ] 8 0 8
+[ 0 1 0 ] 9 0 9
+[ 0 1 1 ] 10 0 10
+[ 0 1 1 ] 11 0 11
+[ 0 1 1 ] 12 0 12
+[ 0 2 0 ] 13 0 13
+[ 0 2 0 ] 14 0 14
+[ 0 2 0 ] 15 0 15
+[ 0 2 1 ] 16 0 16
+[ 0 2 1 ] 17 0 17
+[ 0 2 1 ] 18 0 18
+[ 1 0 0 ] 19 0 19
+[ 1 0 0 ] 20 0 20
+[ 1 0 0 ] 21 0 21
+[ 1 0 1 ] 22 0 22
+[ 1 0 1 ] 23 0 23
+[ 1 0 1 ] 24 0 24
+[ 1 1 0 ] 25 0 25
+[ 1 1 0 ] 26 0 26
+[ 1 1 0 ] 27 0 27
+[ 1 1 1 ] 28 0 28
+[ 1 1 1 ] 29 0 29
+[ 1 1 1 ] 30 0 30
+[ 1 2 0 ] 31 0 31
+[ 1 2 0 ] 32 0 32
+[ 1 2 0 ] 33 0 33
+[ 1 2 1 ] 34 0 34
+[ 1 2 1 ] 35 0 35
+[ 1 2 1 ] 36 0 36
+[ 2 0 0 ] 37 0 37
+[ 2 0 0 ] 38 0 38
+[ 2 0 0 ] 39 0 39
+[ 2 0 1 ] 40 0 40
+[ 2 0 1 ] 41 0 41
+[ 2 0 1 ] 42 0 42
+[ 2 1 0 ] 43 0 43
+[ 2 1 0 ] 44 0 44
+[ 2 1 0 ] 45 0 45
+[ 2 1 1 ] 46 0 46
+[ 2 1 1 ] 47 0 47
+[ 2 1 1 ] 48 0 48
+[ 2 2 0 ] 49 0 49
+[ 2 2 0 ] 50 0 50
+[ 2 2 0 ] 51 0 51
+[ 2 2 1 ] 52 0 52
+[ 2 2 1 ] 53 0 53
+[ 2 2 1 ] 54 0 54
+[ 3 0 0 ] 55 0 55
+[ 3 0 0 ] 56 0 56
+[ 3 0 0 ] 57 0 57
+[ 3 0 1 ] 58 0 58
+[ 3 0 1 ] 59 0 59
+[ 3 0 1 ] 60 0 60
+[ 3 1 0 ] 61 0 61
+[ 3 1 0 ] 62 0 62
+[ 3 1 0 ] 63 0 63
+[ 3 1 1 ] 64 0 64
+[ 3 1 1 ] 65 0 65
+[ 3 1 1 ] 66 0 66
+[ 3 2 0 ] 67 0 67
+[ 3 2 0 ] 68 0 68
+[ 3 2 0 ] 69 0 69
+[ 3 2 1 ] 70 0 70
+[ 3 2 1 ] 71 0 71
+[ 3 2 1 ] 72 0 72
+72 differences found
+attribute: <bitfield of </>> and <bitfield of </>>
+size: [2] [2]
+position bitfield of </> bitfield of </> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+2 differences found
+attribute: <bitfield2D of </>> and <bitfield2D of </>>
+size: [3x2] [3x2]
+position bitfield2D of </> bitfield2D of </> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 2 0 ] 5 0 5
+[ 2 1 ] 6 0 6
+6 differences found
+attribute: <bitfield3D of </>> and <bitfield3D of </>>
+size: [4x3x2] [4x3x2]
+position bitfield3D of </> bitfield3D of </> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 1 ] 2 0 2
+[ 0 1 0 ] 3 0 3
+[ 0 1 1 ] 4 0 4
+[ 0 2 0 ] 5 0 5
+[ 0 2 1 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 1 0 ] 9 0 9
+[ 1 1 1 ] 10 0 10
+[ 1 2 0 ] 11 0 11
+[ 1 2 1 ] 12 0 12
+[ 2 0 0 ] 13 0 13
+[ 2 0 1 ] 14 0 14
+[ 2 1 0 ] 15 0 15
+[ 2 1 1 ] 16 0 16
+[ 2 2 0 ] 17 0 17
+[ 2 2 1 ] 18 0 18
+[ 3 0 0 ] 19 0 19
+[ 3 0 1 ] 20 0 20
+[ 3 1 0 ] 21 0 21
+[ 3 1 1 ] 22 0 22
+[ 3 2 0 ] 23 0 23
+[ 3 2 1 ] 24 0 24
+24 differences found
+attribute: <compound of </>> and <compound of </>>
+size: [2] [2]
+position compound of </> compound of </> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 0 ] 2 0 2
+[ 1 ] 3 0 3
+[ 1 ] 4 0 4
+4 differences found
+attribute: <compound2D of </>> and <compound2D of </>>
+size: [3x2] [3x2]
+position compound2D of </> compound2D of </> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 0 ] 2 0 2
+[ 0 1 ] 3 0 3
+[ 0 1 ] 4 0 4
+[ 1 0 ] 5 0 5
+[ 1 0 ] 6 0 6
+[ 1 1 ] 7 0 7
+[ 1 1 ] 8 0 8
+[ 2 0 ] 9 0 9
+[ 2 0 ] 10 0 10
+[ 2 1 ] 11 0 11
+[ 2 1 ] 12 0 12
+12 differences found
+attribute: <compound3D of </>> and <compound3D of </>>
+size: [4x3x2] [4x3x2]
+position compound3D of </> compound3D of </> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 0 ] 2 0 2
+[ 0 0 1 ] 3 0 3
+[ 0 0 1 ] 4 0 4
+[ 0 1 0 ] 5 0 5
+[ 0 1 0 ] 6 0 6
+[ 0 1 1 ] 7 0 7
+[ 0 1 1 ] 8 0 8
+[ 0 2 0 ] 9 0 9
+[ 0 2 0 ] 10 0 10
+[ 0 2 1 ] 11 0 11
+[ 0 2 1 ] 12 0 12
+[ 1 0 0 ] 13 0 13
+[ 1 0 0 ] 14 0 14
+[ 1 0 1 ] 15 0 15
+[ 1 0 1 ] 16 0 16
+[ 1 1 0 ] 17 0 17
+[ 1 1 0 ] 18 0 18
+[ 1 1 1 ] 19 0 19
+[ 1 1 1 ] 20 0 20
+[ 1 2 0 ] 21 0 21
+[ 1 2 0 ] 22 0 22
+[ 1 2 1 ] 23 0 23
+[ 1 2 1 ] 24 0 24
+[ 2 0 0 ] 25 0 25
+[ 2 0 0 ] 26 0 26
+[ 2 0 1 ] 27 0 27
+[ 2 0 1 ] 28 0 28
+[ 2 1 0 ] 29 0 29
+[ 2 1 0 ] 30 0 30
+[ 2 1 1 ] 31 0 31
+[ 2 1 1 ] 32 0 32
+[ 2 2 0 ] 33 0 33
+[ 2 2 0 ] 34 0 34
+[ 2 2 1 ] 35 0 35
+[ 2 2 1 ] 36 0 36
+[ 3 0 0 ] 37 0 37
+[ 3 0 0 ] 38 0 38
+[ 3 0 1 ] 39 0 39
+[ 3 0 1 ] 40 0 40
+[ 3 1 0 ] 41 0 41
+[ 3 1 0 ] 42 0 42
+[ 3 1 1 ] 43 0 43
+[ 3 1 1 ] 44 0 44
+[ 3 2 0 ] 45 0 45
+[ 3 2 0 ] 46 0 46
+[ 3 2 1 ] 47 0 47
+[ 3 2 1 ] 48 0 48
+48 differences found
+attribute: <enum of </>> and <enum of </>>
+size: [2] [2]
+position enum of </> enum of </> difference
+------------------------------------------------------------
+[ 0 ] RED GREEN
+[ 1 ] RED GREEN
+2 differences found
+attribute: <enum2D of </>> and <enum2D of </>>
+size: [3x2] [3x2]
+position enum2D of </> enum2D of </> difference
+------------------------------------------------------------
+[ 0 0 ] RED GREEN
+[ 0 1 ] RED GREEN
+[ 1 0 ] RED GREEN
+[ 1 1 ] RED GREEN
+[ 2 0 ] RED GREEN
+[ 2 1 ] RED GREEN
+6 differences found
+attribute: <enum3D of </>> and <enum3D of </>>
+size: [4x3x2] [4x3x2]
+position enum3D of </> enum3D of </> difference
+------------------------------------------------------------
+[ 0 0 0 ] GREEN RED
+[ 0 0 1 ] GREEN RED
+[ 0 1 0 ] GREEN RED
+[ 0 1 1 ] GREEN RED
+[ 0 2 0 ] GREEN RED
+[ 0 2 1 ] GREEN RED
+[ 1 0 0 ] GREEN RED
+[ 1 0 1 ] GREEN RED
+[ 1 1 0 ] GREEN RED
+[ 1 1 1 ] GREEN RED
+[ 1 2 0 ] GREEN RED
+[ 1 2 1 ] GREEN RED
+[ 2 0 0 ] GREEN RED
+[ 2 0 1 ] GREEN RED
+[ 2 1 0 ] GREEN RED
+[ 2 1 1 ] GREEN RED
+[ 2 2 0 ] GREEN RED
+[ 2 2 1 ] GREEN RED
+[ 3 0 0 ] GREEN RED
+[ 3 0 1 ] GREEN RED
+[ 3 1 0 ] GREEN RED
+[ 3 1 1 ] GREEN RED
+[ 3 2 0 ] GREEN RED
+[ 3 2 1 ] GREEN RED
+24 differences found
+attribute: <float of </>> and <float of </>>
+size: [2] [2]
+position float of </> float of </> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+2 differences found
+attribute: <float2D of </>> and <float2D of </>>
+size: [3x2] [3x2]
+position float2D of </> float2D of </> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 2 0 ] 5 0 5
+[ 2 1 ] 6 0 6
+6 differences found
+attribute: <float3D of </>> and <float3D of </>>
+size: [4x3x2] [4x3x2]
+position float3D of </> float3D of </> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 1 ] 2 0 2
+[ 0 1 0 ] 3 0 3
+[ 0 1 1 ] 4 0 4
+[ 0 2 0 ] 5 0 5
+[ 0 2 1 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 1 0 ] 9 0 9
+[ 1 1 1 ] 10 0 10
+[ 1 2 0 ] 11 0 11
+[ 1 2 1 ] 12 0 12
+[ 2 0 0 ] 13 0 13
+[ 2 0 1 ] 14 0 14
+[ 2 1 0 ] 15 0 15
+[ 2 1 1 ] 16 0 16
+[ 2 2 0 ] 17 0 17
+[ 2 2 1 ] 18 0 18
+[ 3 0 0 ] 19 0 19
+[ 3 0 1 ] 20 0 20
+[ 3 1 0 ] 21 0 21
+[ 3 1 1 ] 22 0 22
+[ 3 2 0 ] 23 0 23
+[ 3 2 1 ] 24 0 24
+24 differences found
+attribute: <integer of </>> and <integer of </>>
+size: [2] [2]
+position integer of </> integer of </> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+2 differences found
+attribute: <integer2D of </>> and <integer2D of </>>
+size: [3x2] [3x2]
+position integer2D of </> integer2D of </> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 2 0 ] 5 0 5
+[ 2 1 ] 6 0 6
+6 differences found
+attribute: <integer3D of </>> and <integer3D of </>>
+size: [4x3x2] [4x3x2]
+position integer3D of </> integer3D of </> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 1 ] 2 0 2
+[ 0 1 0 ] 3 0 3
+[ 0 1 1 ] 4 0 4
+[ 0 2 0 ] 5 0 5
+[ 0 2 1 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 1 0 ] 9 0 9
+[ 1 1 1 ] 10 0 10
+[ 1 2 0 ] 11 0 11
+[ 1 2 1 ] 12 0 12
+[ 2 0 0 ] 13 0 13
+[ 2 0 1 ] 14 0 14
+[ 2 1 0 ] 15 0 15
+[ 2 1 1 ] 16 0 16
+[ 2 2 0 ] 17 0 17
+[ 2 2 1 ] 18 0 18
+[ 3 0 0 ] 19 0 19
+[ 3 0 1 ] 20 0 20
+[ 3 1 0 ] 21 0 21
+[ 3 1 1 ] 22 0 22
+[ 3 2 0 ] 23 0 23
+[ 3 2 1 ] 24 0 24
+24 differences found
+attribute: <opaque of </>> and <opaque of </>>
+size: [2] [2]
+position opaque of </> opaque of </> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+2 differences found
+attribute: <opaque2D of </>> and <opaque2D of </>>
+size: [3x2] [3x2]
+position opaque2D of </> opaque2D of </> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 2 0 ] 5 0 5
+[ 2 1 ] 6 0 6
+6 differences found
+attribute: <opaque3D of </>> and <opaque3D of </>>
+size: [4x3x2] [4x3x2]
+position opaque3D of </> opaque3D of </> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 1 ] 2 0 2
+[ 0 1 0 ] 3 0 3
+[ 0 1 1 ] 4 0 4
+[ 0 2 0 ] 5 0 5
+[ 0 2 1 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 1 0 ] 9 0 9
+[ 1 1 1 ] 10 0 10
+[ 1 2 0 ] 11 0 11
+[ 1 2 1 ] 12 0 12
+[ 2 0 0 ] 13 0 13
+[ 2 0 1 ] 14 0 14
+[ 2 1 0 ] 15 0 15
+[ 2 1 1 ] 16 0 16
+[ 2 2 0 ] 17 0 17
+[ 2 2 1 ] 18 0 18
+[ 3 0 0 ] 19 0 19
+[ 3 0 1 ] 20 0 20
+[ 3 1 0 ] 21 0 21
+[ 3 1 1 ] 22 0 22
+[ 3 2 0 ] 23 0 23
+[ 3 2 1 ] 24 0 24
+24 differences found
+attribute: <string of </>> and <string of </>>
+size: [2] [2]
+position string of </> string of </> difference
+------------------------------------------------------------
+[ 0 ] a z
+[ 0 ] b z
+[ 1 ] d z
+[ 1 ] e z
+4 differences found
+attribute: <string2D of </>> and <string2D of </>>
+size: [3x2] [3x2]
+position string2D of </> string2D of </> difference
+------------------------------------------------------------
+[ 0 0 ] a z
+[ 0 0 ] b z
+[ 0 1 ] c z
+[ 0 1 ] d z
+[ 1 0 ] e z
+[ 1 0 ] f z
+[ 1 1 ] g z
+[ 1 1 ] h z
+[ 2 0 ] i z
+[ 2 0 ] j z
+[ 2 1 ] k z
+[ 2 1 ] l z
+12 differences found
+attribute: <string3D of </>> and <string3D of </>>
+size: [4x3x2] [4x3x2]
+position string3D of </> string3D of </> difference
+------------------------------------------------------------
+[ 0 0 0 ] a z
+[ 0 0 0 ] b z
+[ 0 0 1 ] c z
+[ 0 0 1 ] d z
+[ 0 1 0 ] e z
+[ 0 1 0 ] f z
+[ 0 1 1 ] g z
+[ 0 1 1 ] h z
+[ 0 2 0 ] i z
+[ 0 2 0 ] j z
+[ 0 2 1 ] k z
+[ 0 2 1 ] l z
+[ 1 0 0 ] m z
+[ 1 0 0 ] n z
+[ 1 0 1 ] p z
+[ 1 0 1 ] q z
+[ 1 1 0 ] r z
+[ 1 1 0 ] s z
+[ 1 1 1 ] t z
+[ 1 1 1 ] u z
+[ 1 2 0 ] v z
+[ 1 2 0 ] w z
+[ 1 2 1 ] x z
+[ 2 0 0 ] A z
+[ 2 0 0 ] B z
+[ 2 0 1 ] C z
+[ 2 0 1 ] D z
+[ 2 1 0 ] E z
+[ 2 1 0 ] F z
+[ 2 1 1 ] G z
+[ 2 1 1 ] H z
+[ 2 2 0 ] I z
+[ 2 2 0 ] J z
+[ 2 2 1 ] K z
+[ 2 2 1 ] L z
+[ 3 0 0 ] M z
+[ 3 0 0 ] N z
+[ 3 0 1 ] P z
+[ 3 0 1 ] Q z
+[ 3 1 0 ] R z
+[ 3 1 0 ] S z
+[ 3 1 1 ] T z
+[ 3 1 1 ] U z
+[ 3 2 0 ] V z
+[ 3 2 0 ] W z
+[ 3 2 1 ] X z
+[ 3 2 1 ] Z z
+47 differences found
+attribute: <vlen of </>> and <vlen of </>>
+size: [2] [2]
+position vlen of </> vlen of </> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+[ 1 ] 3 0 3
+3 differences found
+attribute: <vlen2D of </>> and <vlen2D of </>>
+size: [3x2] [3x2]
+position vlen2D of </> vlen2D of </> difference
+------------------------------------------------------------
+[ 0 1 ] 1 0 1
+[ 1 0 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 1 1 ] 5 0 5
+[ 2 0 ] 6 0 6
+[ 2 0 ] 7 0 7
+[ 2 0 ] 8 0 8
+[ 2 1 ] 9 0 9
+[ 2 1 ] 10 0 10
+[ 2 1 ] 11 0 11
+11 differences found
+attribute: <vlen3D of </>> and <vlen3D of </>>
+size: [4x3x2] [4x3x2]
+position vlen3D of </> vlen3D of </> difference
+------------------------------------------------------------
+[ 0 0 1 ] 1 0 1
+[ 0 1 0 ] 2 0 2
+[ 0 1 1 ] 3 0 3
+[ 0 2 0 ] 4 0 4
+[ 0 2 1 ] 5 0 5
+[ 1 0 0 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 0 1 ] 9 0 9
+[ 1 1 0 ] 10 0 10
+[ 1 1 0 ] 11 0 11
+[ 1 1 1 ] 12 0 12
+[ 1 1 1 ] 13 0 13
+[ 1 2 0 ] 14 0 14
+[ 1 2 0 ] 15 0 15
+[ 1 2 1 ] 16 0 16
+[ 1 2 1 ] 17 0 17
+[ 2 0 0 ] 18 0 18
+[ 2 0 0 ] 19 0 19
+[ 2 0 0 ] 20 0 20
+[ 2 0 1 ] 21 0 21
+[ 2 0 1 ] 22 0 22
+[ 2 0 1 ] 23 0 23
+[ 2 1 0 ] 24 0 24
+[ 2 1 0 ] 25 0 25
+[ 2 1 0 ] 26 0 26
+[ 2 1 1 ] 27 0 27
+[ 2 1 1 ] 28 0 28
+[ 2 1 1 ] 29 0 29
+[ 2 2 0 ] 30 0 30
+[ 2 2 0 ] 31 0 31
+[ 2 2 0 ] 32 0 32
+[ 2 2 1 ] 33 0 33
+[ 2 2 1 ] 34 0 34
+[ 2 2 1 ] 35 0 35
+[ 3 0 0 ] 36 0 36
+[ 3 0 0 ] 37 0 37
+[ 3 0 0 ] 38 0 38
+[ 3 0 0 ] 39 0 39
+[ 3 0 1 ] 40 0 40
+[ 3 0 1 ] 41 0 41
+[ 3 0 1 ] 42 0 42
+[ 3 0 1 ] 43 0 43
+[ 3 1 0 ] 44 0 44
+[ 3 1 0 ] 45 0 45
+[ 3 1 0 ] 46 0 46
+[ 3 1 0 ] 47 0 47
+[ 3 1 1 ] 48 0 48
+[ 3 1 1 ] 49 0 49
+[ 3 1 1 ] 50 0 50
+[ 3 1 1 ] 51 0 51
+[ 3 2 0 ] 52 0 52
+[ 3 2 0 ] 53 0 53
+[ 3 2 0 ] 54 0 54
+[ 3 2 0 ] 55 0 55
+[ 3 2 1 ] 56 0 56
+[ 3 2 1 ] 57 0 57
+[ 3 2 1 ] 58 0 58
+[ 3 2 1 ] 59 0 59
+59 differences found
+
+dataset: </dset> and </dset>
+Not comparable: </dset> or </dset> is an empty dataset
+0 differences found
+ obj1 obj2
+ --------------------------------------
+ x x VLstring
+ x x VLstring2D
+ x x VLstring3D
+ x x array
+ x x array2D
+ x x array3D
+ x x bitfield
+ x x bitfield2D
+ x x bitfield3D
+ x x compound
+ x x compound2D
+ x x compound3D
+ x x enum
+ x x enum2D
+ x x enum3D
+ x x float
+ x x float2D
+ x x float3D
+ x x integer
+ x x integer2D
+ x x integer3D
+ x x opaque
+ x x opaque2D
+ x x opaque3D
+ x x reference
+ x x reference2D
+ x x reference3D
+ x x string
+ x x string2D
+ x x string3D
+ x x vlen
+ x x vlen2D
+ x x vlen3D
+Attributes status: 33 common, 0 only in obj1, 0 only in obj2
+attribute: <VLstring of </dset>> and <VLstring of </dset>>
+size: [2] [2]
+position VLstring of </dset> VLstring of </dset> difference
+------------------------------------------------------------
+[ 0 ] a z
+[ 0 ] b z
+[ 1 ] d z
+[ 1 ] e z
+4 differences found
+attribute: <VLstring2D of </dset>> and <VLstring2D of </dset>>
+size: [3x2] [3x2]
+position VLstring2D of </dset> VLstring2D of </dset> difference
+------------------------------------------------------------
+[ 0 0 ] a z
+[ 0 0 ] b z
+[ 0 1 ] c z
+[ 0 1 ] d z
+[ 1 0 ] e z
+[ 1 0 ] f z
+[ 1 1 ] g z
+[ 1 1 ] h z
+[ 2 0 ] i z
+[ 2 0 ] j z
+[ 2 1 ] k z
+[ 2 1 ] l z
+12 differences found
+attribute: <VLstring3D of </dset>> and <VLstring3D of </dset>>
+size: [4x3x2] [4x3x2]
+position VLstring3D of </dset> VLstring3D of </dset> difference
+------------------------------------------------------------
+[ 0 0 0 ] a z
+[ 0 0 0 ] b z
+[ 0 0 1 ] c z
+[ 0 0 1 ] d z
+[ 0 1 0 ] e z
+[ 0 1 0 ] f z
+[ 0 1 1 ] g z
+[ 0 1 1 ] h z
+[ 0 2 0 ] i z
+[ 0 2 0 ] j z
+[ 0 2 1 ] k z
+[ 0 2 1 ] l z
+[ 1 0 0 ] m z
+[ 1 0 0 ] n z
+[ 1 0 1 ] p z
+[ 1 0 1 ] q z
+[ 1 1 0 ] r z
+[ 1 1 0 ] s z
+[ 1 1 1 ] t z
+[ 1 1 1 ] u z
+[ 1 2 0 ] v z
+[ 1 2 0 ] w z
+[ 1 2 1 ] x z
+[ 2 0 0 ] A z
+[ 2 0 0 ] B z
+[ 2 0 1 ] C z
+[ 2 0 1 ] D z
+[ 2 1 0 ] E z
+[ 2 1 0 ] F z
+[ 2 1 1 ] G z
+[ 2 1 1 ] H z
+[ 2 2 0 ] I z
+[ 2 2 0 ] J z
+[ 2 2 1 ] K z
+[ 2 2 1 ] L z
+[ 3 0 0 ] M z
+[ 3 0 0 ] N z
+[ 3 0 1 ] P z
+[ 3 0 1 ] Q z
+[ 3 1 0 ] R z
+[ 3 1 0 ] S z
+[ 3 1 1 ] T z
+[ 3 1 1 ] U z
+[ 3 2 0 ] V z
+[ 3 2 0 ] W z
+[ 3 2 1 ] X z
+[ 3 2 1 ] Z z
+47 differences found
+attribute: <array of </dset>> and <array of </dset>>
+size: [2] [2]
+position array of </dset> array of </dset> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 0 ] 2 0 2
+[ 0 ] 3 0 3
+[ 1 ] 4 0 4
+[ 1 ] 5 0 5
+[ 1 ] 6 0 6
+6 differences found
+attribute: <array2D of </dset>> and <array2D of </dset>>
+size: [3x2] [3x2]
+position array2D of </dset> array2D of </dset> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 0 ] 2 0 2
+[ 0 0 ] 3 0 3
+[ 0 1 ] 4 0 4
+[ 0 1 ] 5 0 5
+[ 0 1 ] 6 0 6
+[ 1 0 ] 7 0 7
+[ 1 0 ] 8 0 8
+[ 1 0 ] 9 0 9
+[ 1 1 ] 10 0 10
+[ 1 1 ] 11 0 11
+[ 1 1 ] 12 0 12
+[ 2 0 ] 13 0 13
+[ 2 0 ] 14 0 14
+[ 2 0 ] 15 0 15
+[ 2 1 ] 16 0 16
+[ 2 1 ] 17 0 17
+[ 2 1 ] 18 0 18
+18 differences found
+attribute: <array3D of </dset>> and <array3D of </dset>>
+size: [4x3x2] [4x3x2]
+position array3D of </dset> array3D of </dset> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 0 ] 2 0 2
+[ 0 0 0 ] 3 0 3
+[ 0 0 1 ] 4 0 4
+[ 0 0 1 ] 5 0 5
+[ 0 0 1 ] 6 0 6
+[ 0 1 0 ] 7 0 7
+[ 0 1 0 ] 8 0 8
+[ 0 1 0 ] 9 0 9
+[ 0 1 1 ] 10 0 10
+[ 0 1 1 ] 11 0 11
+[ 0 1 1 ] 12 0 12
+[ 0 2 0 ] 13 0 13
+[ 0 2 0 ] 14 0 14
+[ 0 2 0 ] 15 0 15
+[ 0 2 1 ] 16 0 16
+[ 0 2 1 ] 17 0 17
+[ 0 2 1 ] 18 0 18
+[ 1 0 0 ] 19 0 19
+[ 1 0 0 ] 20 0 20
+[ 1 0 0 ] 21 0 21
+[ 1 0 1 ] 22 0 22
+[ 1 0 1 ] 23 0 23
+[ 1 0 1 ] 24 0 24
+[ 1 1 0 ] 25 0 25
+[ 1 1 0 ] 26 0 26
+[ 1 1 0 ] 27 0 27
+[ 1 1 1 ] 28 0 28
+[ 1 1 1 ] 29 0 29
+[ 1 1 1 ] 30 0 30
+[ 1 2 0 ] 31 0 31
+[ 1 2 0 ] 32 0 32
+[ 1 2 0 ] 33 0 33
+[ 1 2 1 ] 34 0 34
+[ 1 2 1 ] 35 0 35
+[ 1 2 1 ] 36 0 36
+[ 2 0 0 ] 37 0 37
+[ 2 0 0 ] 38 0 38
+[ 2 0 0 ] 39 0 39
+[ 2 0 1 ] 40 0 40
+[ 2 0 1 ] 41 0 41
+[ 2 0 1 ] 42 0 42
+[ 2 1 0 ] 43 0 43
+[ 2 1 0 ] 44 0 44
+[ 2 1 0 ] 45 0 45
+[ 2 1 1 ] 46 0 46
+[ 2 1 1 ] 47 0 47
+[ 2 1 1 ] 48 0 48
+[ 2 2 0 ] 49 0 49
+[ 2 2 0 ] 50 0 50
+[ 2 2 0 ] 51 0 51
+[ 2 2 1 ] 52 0 52
+[ 2 2 1 ] 53 0 53
+[ 2 2 1 ] 54 0 54
+[ 3 0 0 ] 55 0 55
+[ 3 0 0 ] 56 0 56
+[ 3 0 0 ] 57 0 57
+[ 3 0 1 ] 58 0 58
+[ 3 0 1 ] 59 0 59
+[ 3 0 1 ] 60 0 60
+[ 3 1 0 ] 61 0 61
+[ 3 1 0 ] 62 0 62
+[ 3 1 0 ] 63 0 63
+[ 3 1 1 ] 64 0 64
+[ 3 1 1 ] 65 0 65
+[ 3 1 1 ] 66 0 66
+[ 3 2 0 ] 67 0 67
+[ 3 2 0 ] 68 0 68
+[ 3 2 0 ] 69 0 69
+[ 3 2 1 ] 70 0 70
+[ 3 2 1 ] 71 0 71
+[ 3 2 1 ] 72 0 72
+72 differences found
+attribute: <bitfield of </dset>> and <bitfield of </dset>>
+size: [2] [2]
+position bitfield of </dset> bitfield of </dset> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+2 differences found
+attribute: <bitfield2D of </dset>> and <bitfield2D of </dset>>
+size: [3x2] [3x2]
+position bitfield2D of </dset> bitfield2D of </dset> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 2 0 ] 5 0 5
+[ 2 1 ] 6 0 6
+6 differences found
+attribute: <bitfield3D of </dset>> and <bitfield3D of </dset>>
+size: [4x3x2] [4x3x2]
+position bitfield3D of </dset> bitfield3D of </dset> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 1 ] 2 0 2
+[ 0 1 0 ] 3 0 3
+[ 0 1 1 ] 4 0 4
+[ 0 2 0 ] 5 0 5
+[ 0 2 1 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 1 0 ] 9 0 9
+[ 1 1 1 ] 10 0 10
+[ 1 2 0 ] 11 0 11
+[ 1 2 1 ] 12 0 12
+[ 2 0 0 ] 13 0 13
+[ 2 0 1 ] 14 0 14
+[ 2 1 0 ] 15 0 15
+[ 2 1 1 ] 16 0 16
+[ 2 2 0 ] 17 0 17
+[ 2 2 1 ] 18 0 18
+[ 3 0 0 ] 19 0 19
+[ 3 0 1 ] 20 0 20
+[ 3 1 0 ] 21 0 21
+[ 3 1 1 ] 22 0 22
+[ 3 2 0 ] 23 0 23
+[ 3 2 1 ] 24 0 24
+24 differences found
+attribute: <compound of </dset>> and <compound of </dset>>
+size: [2] [2]
+position compound of </dset> compound of </dset> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 0 ] 2 0 2
+[ 1 ] 3 0 3
+[ 1 ] 4 0 4
+4 differences found
+attribute: <compound2D of </dset>> and <compound2D of </dset>>
+size: [3x2] [3x2]
+position compound2D of </dset> compound2D of </dset> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 0 ] 2 0 2
+[ 0 1 ] 3 0 3
+[ 0 1 ] 4 0 4
+[ 1 0 ] 5 0 5
+[ 1 0 ] 6 0 6
+[ 1 1 ] 7 0 7
+[ 1 1 ] 8 0 8
+[ 2 0 ] 9 0 9
+[ 2 0 ] 10 0 10
+[ 2 1 ] 11 0 11
+[ 2 1 ] 12 0 12
+12 differences found
+attribute: <compound3D of </dset>> and <compound3D of </dset>>
+size: [4x3x2] [4x3x2]
+position compound3D of </dset> compound3D of </dset> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 0 ] 2 0 2
+[ 0 0 1 ] 3 0 3
+[ 0 0 1 ] 4 0 4
+[ 0 1 0 ] 5 0 5
+[ 0 1 0 ] 6 0 6
+[ 0 1 1 ] 7 0 7
+[ 0 1 1 ] 8 0 8
+[ 0 2 0 ] 9 0 9
+[ 0 2 0 ] 10 0 10
+[ 0 2 1 ] 11 0 11
+[ 0 2 1 ] 12 0 12
+[ 1 0 0 ] 13 0 13
+[ 1 0 0 ] 14 0 14
+[ 1 0 1 ] 15 0 15
+[ 1 0 1 ] 16 0 16
+[ 1 1 0 ] 17 0 17
+[ 1 1 0 ] 18 0 18
+[ 1 1 1 ] 19 0 19
+[ 1 1 1 ] 20 0 20
+[ 1 2 0 ] 21 0 21
+[ 1 2 0 ] 22 0 22
+[ 1 2 1 ] 23 0 23
+[ 1 2 1 ] 24 0 24
+[ 2 0 0 ] 25 0 25
+[ 2 0 0 ] 26 0 26
+[ 2 0 1 ] 27 0 27
+[ 2 0 1 ] 28 0 28
+[ 2 1 0 ] 29 0 29
+[ 2 1 0 ] 30 0 30
+[ 2 1 1 ] 31 0 31
+[ 2 1 1 ] 32 0 32
+[ 2 2 0 ] 33 0 33
+[ 2 2 0 ] 34 0 34
+[ 2 2 1 ] 35 0 35
+[ 2 2 1 ] 36 0 36
+[ 3 0 0 ] 37 0 37
+[ 3 0 0 ] 38 0 38
+[ 3 0 1 ] 39 0 39
+[ 3 0 1 ] 40 0 40
+[ 3 1 0 ] 41 0 41
+[ 3 1 0 ] 42 0 42
+[ 3 1 1 ] 43 0 43
+[ 3 1 1 ] 44 0 44
+[ 3 2 0 ] 45 0 45
+[ 3 2 0 ] 46 0 46
+[ 3 2 1 ] 47 0 47
+[ 3 2 1 ] 48 0 48
+48 differences found
+attribute: <enum of </dset>> and <enum of </dset>>
+size: [2] [2]
+position enum of </dset> enum of </dset> difference
+------------------------------------------------------------
+[ 0 ] RED GREEN
+[ 1 ] RED GREEN
+2 differences found
+attribute: <enum2D of </dset>> and <enum2D of </dset>>
+size: [3x2] [3x2]
+position enum2D of </dset> enum2D of </dset> difference
+------------------------------------------------------------
+[ 0 0 ] RED GREEN
+[ 0 1 ] RED GREEN
+[ 1 0 ] RED GREEN
+[ 1 1 ] RED GREEN
+[ 2 0 ] RED GREEN
+[ 2 1 ] RED GREEN
+6 differences found
+attribute: <enum3D of </dset>> and <enum3D of </dset>>
+size: [4x3x2] [4x3x2]
+position enum3D of </dset> enum3D of </dset> difference
+------------------------------------------------------------
+[ 0 0 0 ] GREEN RED
+[ 0 0 1 ] GREEN RED
+[ 0 1 0 ] GREEN RED
+[ 0 1 1 ] GREEN RED
+[ 0 2 0 ] GREEN RED
+[ 0 2 1 ] GREEN RED
+[ 1 0 0 ] GREEN RED
+[ 1 0 1 ] GREEN RED
+[ 1 1 0 ] GREEN RED
+[ 1 1 1 ] GREEN RED
+[ 1 2 0 ] GREEN RED
+[ 1 2 1 ] GREEN RED
+[ 2 0 0 ] GREEN RED
+[ 2 0 1 ] GREEN RED
+[ 2 1 0 ] GREEN RED
+[ 2 1 1 ] GREEN RED
+[ 2 2 0 ] GREEN RED
+[ 2 2 1 ] GREEN RED
+[ 3 0 0 ] GREEN RED
+[ 3 0 1 ] GREEN RED
+[ 3 1 0 ] GREEN RED
+[ 3 1 1 ] GREEN RED
+[ 3 2 0 ] GREEN RED
+[ 3 2 1 ] GREEN RED
+24 differences found
+attribute: <float of </dset>> and <float of </dset>>
+size: [2] [2]
+position float of </dset> float of </dset> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+2 differences found
+attribute: <float2D of </dset>> and <float2D of </dset>>
+size: [3x2] [3x2]
+position float2D of </dset> float2D of </dset> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 2 0 ] 5 0 5
+[ 2 1 ] 6 0 6
+6 differences found
+attribute: <float3D of </dset>> and <float3D of </dset>>
+size: [4x3x2] [4x3x2]
+position float3D of </dset> float3D of </dset> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 1 ] 2 0 2
+[ 0 1 0 ] 3 0 3
+[ 0 1 1 ] 4 0 4
+[ 0 2 0 ] 5 0 5
+[ 0 2 1 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 1 0 ] 9 0 9
+[ 1 1 1 ] 10 0 10
+[ 1 2 0 ] 11 0 11
+[ 1 2 1 ] 12 0 12
+[ 2 0 0 ] 13 0 13
+[ 2 0 1 ] 14 0 14
+[ 2 1 0 ] 15 0 15
+[ 2 1 1 ] 16 0 16
+[ 2 2 0 ] 17 0 17
+[ 2 2 1 ] 18 0 18
+[ 3 0 0 ] 19 0 19
+[ 3 0 1 ] 20 0 20
+[ 3 1 0 ] 21 0 21
+[ 3 1 1 ] 22 0 22
+[ 3 2 0 ] 23 0 23
+[ 3 2 1 ] 24 0 24
+24 differences found
+attribute: <integer of </dset>> and <integer of </dset>>
+size: [2] [2]
+position integer of </dset> integer of </dset> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+2 differences found
+attribute: <integer2D of </dset>> and <integer2D of </dset>>
+size: [3x2] [3x2]
+position integer2D of </dset> integer2D of </dset> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 2 0 ] 5 0 5
+[ 2 1 ] 6 0 6
+6 differences found
+attribute: <integer3D of </dset>> and <integer3D of </dset>>
+size: [4x3x2] [4x3x2]
+position integer3D of </dset> integer3D of </dset> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 1 ] 2 0 2
+[ 0 1 0 ] 3 0 3
+[ 0 1 1 ] 4 0 4
+[ 0 2 0 ] 5 0 5
+[ 0 2 1 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 1 0 ] 9 0 9
+[ 1 1 1 ] 10 0 10
+[ 1 2 0 ] 11 0 11
+[ 1 2 1 ] 12 0 12
+[ 2 0 0 ] 13 0 13
+[ 2 0 1 ] 14 0 14
+[ 2 1 0 ] 15 0 15
+[ 2 1 1 ] 16 0 16
+[ 2 2 0 ] 17 0 17
+[ 2 2 1 ] 18 0 18
+[ 3 0 0 ] 19 0 19
+[ 3 0 1 ] 20 0 20
+[ 3 1 0 ] 21 0 21
+[ 3 1 1 ] 22 0 22
+[ 3 2 0 ] 23 0 23
+[ 3 2 1 ] 24 0 24
+24 differences found
+attribute: <opaque of </dset>> and <opaque of </dset>>
+size: [2] [2]
+position opaque of </dset> opaque of </dset> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+2 differences found
+attribute: <opaque2D of </dset>> and <opaque2D of </dset>>
+size: [3x2] [3x2]
+position opaque2D of </dset> opaque2D of </dset> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 2 0 ] 5 0 5
+[ 2 1 ] 6 0 6
+6 differences found
+attribute: <opaque3D of </dset>> and <opaque3D of </dset>>
+size: [4x3x2] [4x3x2]
+position opaque3D of </dset> opaque3D of </dset> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 1 ] 2 0 2
+[ 0 1 0 ] 3 0 3
+[ 0 1 1 ] 4 0 4
+[ 0 2 0 ] 5 0 5
+[ 0 2 1 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 1 0 ] 9 0 9
+[ 1 1 1 ] 10 0 10
+[ 1 2 0 ] 11 0 11
+[ 1 2 1 ] 12 0 12
+[ 2 0 0 ] 13 0 13
+[ 2 0 1 ] 14 0 14
+[ 2 1 0 ] 15 0 15
+[ 2 1 1 ] 16 0 16
+[ 2 2 0 ] 17 0 17
+[ 2 2 1 ] 18 0 18
+[ 3 0 0 ] 19 0 19
+[ 3 0 1 ] 20 0 20
+[ 3 1 0 ] 21 0 21
+[ 3 1 1 ] 22 0 22
+[ 3 2 0 ] 23 0 23
+[ 3 2 1 ] 24 0 24
+24 differences found
+attribute: <reference of </dset>> and <reference of </dset>>
+0 differences found
+attribute: <reference2D of </dset>> and <reference2D of </dset>>
+0 differences found
+attribute: <reference3D of </dset>> and <reference3D of </dset>>
+0 differences found
+attribute: <string of </dset>> and <string of </dset>>
+size: [2] [2]
+position string of </dset> string of </dset> difference
+------------------------------------------------------------
+[ 0 ] a z
+[ 0 ] b z
+[ 1 ] d z
+[ 1 ] e z
+4 differences found
+attribute: <string2D of </dset>> and <string2D of </dset>>
+size: [3x2] [3x2]
+position string2D of </dset> string2D of </dset> difference
+------------------------------------------------------------
+[ 0 0 ] a z
+[ 0 0 ] b z
+[ 0 1 ] c z
+[ 0 1 ] d z
+[ 1 0 ] e z
+[ 1 0 ] f z
+[ 1 1 ] g z
+[ 1 1 ] h z
+[ 2 0 ] i z
+[ 2 0 ] j z
+[ 2 1 ] k z
+[ 2 1 ] l z
+12 differences found
+attribute: <string3D of </dset>> and <string3D of </dset>>
+size: [4x3x2] [4x3x2]
+position string3D of </dset> string3D of </dset> difference
+------------------------------------------------------------
+[ 0 0 0 ] a z
+[ 0 0 0 ] b z
+[ 0 0 1 ] c z
+[ 0 0 1 ] d z
+[ 0 1 0 ] e z
+[ 0 1 0 ] f z
+[ 0 1 1 ] g z
+[ 0 1 1 ] h z
+[ 0 2 0 ] i z
+[ 0 2 0 ] j z
+[ 0 2 1 ] k z
+[ 0 2 1 ] l z
+[ 1 0 0 ] m z
+[ 1 0 0 ] n z
+[ 1 0 1 ] p z
+[ 1 0 1 ] q z
+[ 1 1 0 ] r z
+[ 1 1 0 ] s z
+[ 1 1 1 ] t z
+[ 1 1 1 ] u z
+[ 1 2 0 ] v z
+[ 1 2 0 ] w z
+[ 1 2 1 ] x z
+[ 2 0 0 ] A z
+[ 2 0 0 ] B z
+[ 2 0 1 ] C z
+[ 2 0 1 ] D z
+[ 2 1 0 ] E z
+[ 2 1 0 ] F z
+[ 2 1 1 ] G z
+[ 2 1 1 ] H z
+[ 2 2 0 ] I z
+[ 2 2 0 ] J z
+[ 2 2 1 ] K z
+[ 2 2 1 ] L z
+[ 3 0 0 ] M z
+[ 3 0 0 ] N z
+[ 3 0 1 ] P z
+[ 3 0 1 ] Q z
+[ 3 1 0 ] R z
+[ 3 1 0 ] S z
+[ 3 1 1 ] T z
+[ 3 1 1 ] U z
+[ 3 2 0 ] V z
+[ 3 2 0 ] W z
+[ 3 2 1 ] X z
+[ 3 2 1 ] Z z
+47 differences found
+attribute: <vlen of </dset>> and <vlen of </dset>>
+size: [2] [2]
+position vlen of </dset> vlen of </dset> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+[ 1 ] 3 0 3
+3 differences found
+attribute: <vlen2D of </dset>> and <vlen2D of </dset>>
+size: [3x2] [3x2]
+position vlen2D of </dset> vlen2D of </dset> difference
+------------------------------------------------------------
+[ 0 1 ] 1 0 1
+[ 1 0 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 1 1 ] 5 0 5
+[ 2 0 ] 6 0 6
+[ 2 0 ] 7 0 7
+[ 2 0 ] 8 0 8
+[ 2 1 ] 9 0 9
+[ 2 1 ] 10 0 10
+[ 2 1 ] 11 0 11
+11 differences found
+attribute: <vlen3D of </dset>> and <vlen3D of </dset>>
+size: [4x3x2] [4x3x2]
+position vlen3D of </dset> vlen3D of </dset> difference
+------------------------------------------------------------
+[ 0 0 1 ] 1 0 1
+[ 0 1 0 ] 2 0 2
+[ 0 1 1 ] 3 0 3
+[ 0 2 0 ] 4 0 4
+[ 0 2 1 ] 5 0 5
+[ 1 0 0 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 0 1 ] 9 0 9
+[ 1 1 0 ] 10 0 10
+[ 1 1 0 ] 11 0 11
+[ 1 1 1 ] 12 0 12
+[ 1 1 1 ] 13 0 13
+[ 1 2 0 ] 14 0 14
+[ 1 2 0 ] 15 0 15
+[ 1 2 1 ] 16 0 16
+[ 1 2 1 ] 17 0 17
+[ 2 0 0 ] 18 0 18
+[ 2 0 0 ] 19 0 19
+[ 2 0 0 ] 20 0 20
+[ 2 0 1 ] 21 0 21
+[ 2 0 1 ] 22 0 22
+[ 2 0 1 ] 23 0 23
+[ 2 1 0 ] 24 0 24
+[ 2 1 0 ] 25 0 25
+[ 2 1 0 ] 26 0 26
+[ 2 1 1 ] 27 0 27
+[ 2 1 1 ] 28 0 28
+[ 2 1 1 ] 29 0 29
+[ 2 2 0 ] 30 0 30
+[ 2 2 0 ] 31 0 31
+[ 2 2 0 ] 32 0 32
+[ 2 2 1 ] 33 0 33
+[ 2 2 1 ] 34 0 34
+[ 2 2 1 ] 35 0 35
+[ 3 0 0 ] 36 0 36
+[ 3 0 0 ] 37 0 37
+[ 3 0 0 ] 38 0 38
+[ 3 0 0 ] 39 0 39
+[ 3 0 1 ] 40 0 40
+[ 3 0 1 ] 41 0 41
+[ 3 0 1 ] 42 0 42
+[ 3 0 1 ] 43 0 43
+[ 3 1 0 ] 44 0 44
+[ 3 1 0 ] 45 0 45
+[ 3 1 0 ] 46 0 46
+[ 3 1 0 ] 47 0 47
+[ 3 1 1 ] 48 0 48
+[ 3 1 1 ] 49 0 49
+[ 3 1 1 ] 50 0 50
+[ 3 1 1 ] 51 0 51
+[ 3 2 0 ] 52 0 52
+[ 3 2 0 ] 53 0 53
+[ 3 2 0 ] 54 0 54
+[ 3 2 0 ] 55 0 55
+[ 3 2 1 ] 56 0 56
+[ 3 2 1 ] 57 0 57
+[ 3 2 1 ] 58 0 58
+[ 3 2 1 ] 59 0 59
+59 differences found
+
+group : </g1> and </g1>
+0 differences found
+ obj1 obj2
+ --------------------------------------
+ x x VLstring
+ x x VLstring2D
+ x x VLstring3D
+ x x array
+ x x array2D
+ x x array3D
+ x x bitfield
+ x x bitfield2D
+ x x bitfield3D
+ x x compound
+ x x compound2D
+ x x compound3D
+ x x enum
+ x x enum2D
+ x x enum3D
+ x x float
+ x x float2D
+ x x float3D
+ x x integer
+ x x integer2D
+ x x integer3D
+ x x opaque
+ x x opaque2D
+ x x opaque3D
+ x x string
+ x x string2D
+ x x string3D
+ x x vlen
+ x x vlen2D
+ x x vlen3D
+Attributes status: 30 common, 0 only in obj1, 0 only in obj2
+attribute: <VLstring of </g1>> and <VLstring of </g1>>
+size: [2] [2]
+position VLstring of </g1> VLstring of </g1> difference
+------------------------------------------------------------
+[ 0 ] a z
+[ 0 ] b z
+[ 1 ] d z
+[ 1 ] e z
+4 differences found
+attribute: <VLstring2D of </g1>> and <VLstring2D of </g1>>
+size: [3x2] [3x2]
+position VLstring2D of </g1> VLstring2D of </g1> difference
+------------------------------------------------------------
+[ 0 0 ] a z
+[ 0 0 ] b z
+[ 0 1 ] c z
+[ 0 1 ] d z
+[ 1 0 ] e z
+[ 1 0 ] f z
+[ 1 1 ] g z
+[ 1 1 ] h z
+[ 2 0 ] i z
+[ 2 0 ] j z
+[ 2 1 ] k z
+[ 2 1 ] l z
+12 differences found
+attribute: <VLstring3D of </g1>> and <VLstring3D of </g1>>
+size: [4x3x2] [4x3x2]
+position VLstring3D of </g1> VLstring3D of </g1> difference
+------------------------------------------------------------
+[ 0 0 0 ] a z
+[ 0 0 0 ] b z
+[ 0 0 1 ] c z
+[ 0 0 1 ] d z
+[ 0 1 0 ] e z
+[ 0 1 0 ] f z
+[ 0 1 1 ] g z
+[ 0 1 1 ] h z
+[ 0 2 0 ] i z
+[ 0 2 0 ] j z
+[ 0 2 1 ] k z
+[ 0 2 1 ] l z
+[ 1 0 0 ] m z
+[ 1 0 0 ] n z
+[ 1 0 1 ] p z
+[ 1 0 1 ] q z
+[ 1 1 0 ] r z
+[ 1 1 0 ] s z
+[ 1 1 1 ] t z
+[ 1 1 1 ] u z
+[ 1 2 0 ] v z
+[ 1 2 0 ] w z
+[ 1 2 1 ] x z
+[ 2 0 0 ] A z
+[ 2 0 0 ] B z
+[ 2 0 1 ] C z
+[ 2 0 1 ] D z
+[ 2 1 0 ] E z
+[ 2 1 0 ] F z
+[ 2 1 1 ] G z
+[ 2 1 1 ] H z
+[ 2 2 0 ] I z
+[ 2 2 0 ] J z
+[ 2 2 1 ] K z
+[ 2 2 1 ] L z
+[ 3 0 0 ] M z
+[ 3 0 0 ] N z
+[ 3 0 1 ] P z
+[ 3 0 1 ] Q z
+[ 3 1 0 ] R z
+[ 3 1 0 ] S z
+[ 3 1 1 ] T z
+[ 3 1 1 ] U z
+[ 3 2 0 ] V z
+[ 3 2 0 ] W z
+[ 3 2 1 ] X z
+[ 3 2 1 ] Z z
+47 differences found
+attribute: <array of </g1>> and <array of </g1>>
+size: [2] [2]
+position array of </g1> array of </g1> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 0 ] 2 0 2
+[ 0 ] 3 0 3
+[ 1 ] 4 0 4
+[ 1 ] 5 0 5
+[ 1 ] 6 0 6
+6 differences found
+attribute: <array2D of </g1>> and <array2D of </g1>>
+size: [3x2] [3x2]
+position array2D of </g1> array2D of </g1> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 0 ] 2 0 2
+[ 0 0 ] 3 0 3
+[ 0 1 ] 4 0 4
+[ 0 1 ] 5 0 5
+[ 0 1 ] 6 0 6
+[ 1 0 ] 7 0 7
+[ 1 0 ] 8 0 8
+[ 1 0 ] 9 0 9
+[ 1 1 ] 10 0 10
+[ 1 1 ] 11 0 11
+[ 1 1 ] 12 0 12
+[ 2 0 ] 13 0 13
+[ 2 0 ] 14 0 14
+[ 2 0 ] 15 0 15
+[ 2 1 ] 16 0 16
+[ 2 1 ] 17 0 17
+[ 2 1 ] 18 0 18
+18 differences found
+attribute: <array3D of </g1>> and <array3D of </g1>>
+size: [4x3x2] [4x3x2]
+position array3D of </g1> array3D of </g1> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 0 ] 2 0 2
+[ 0 0 0 ] 3 0 3
+[ 0 0 1 ] 4 0 4
+[ 0 0 1 ] 5 0 5
+[ 0 0 1 ] 6 0 6
+[ 0 1 0 ] 7 0 7
+[ 0 1 0 ] 8 0 8
+[ 0 1 0 ] 9 0 9
+[ 0 1 1 ] 10 0 10
+[ 0 1 1 ] 11 0 11
+[ 0 1 1 ] 12 0 12
+[ 0 2 0 ] 13 0 13
+[ 0 2 0 ] 14 0 14
+[ 0 2 0 ] 15 0 15
+[ 0 2 1 ] 16 0 16
+[ 0 2 1 ] 17 0 17
+[ 0 2 1 ] 18 0 18
+[ 1 0 0 ] 19 0 19
+[ 1 0 0 ] 20 0 20
+[ 1 0 0 ] 21 0 21
+[ 1 0 1 ] 22 0 22
+[ 1 0 1 ] 23 0 23
+[ 1 0 1 ] 24 0 24
+[ 1 1 0 ] 25 0 25
+[ 1 1 0 ] 26 0 26
+[ 1 1 0 ] 27 0 27
+[ 1 1 1 ] 28 0 28
+[ 1 1 1 ] 29 0 29
+[ 1 1 1 ] 30 0 30
+[ 1 2 0 ] 31 0 31
+[ 1 2 0 ] 32 0 32
+[ 1 2 0 ] 33 0 33
+[ 1 2 1 ] 34 0 34
+[ 1 2 1 ] 35 0 35
+[ 1 2 1 ] 36 0 36
+[ 2 0 0 ] 37 0 37
+[ 2 0 0 ] 38 0 38
+[ 2 0 0 ] 39 0 39
+[ 2 0 1 ] 40 0 40
+[ 2 0 1 ] 41 0 41
+[ 2 0 1 ] 42 0 42
+[ 2 1 0 ] 43 0 43
+[ 2 1 0 ] 44 0 44
+[ 2 1 0 ] 45 0 45
+[ 2 1 1 ] 46 0 46
+[ 2 1 1 ] 47 0 47
+[ 2 1 1 ] 48 0 48
+[ 2 2 0 ] 49 0 49
+[ 2 2 0 ] 50 0 50
+[ 2 2 0 ] 51 0 51
+[ 2 2 1 ] 52 0 52
+[ 2 2 1 ] 53 0 53
+[ 2 2 1 ] 54 0 54
+[ 3 0 0 ] 55 0 55
+[ 3 0 0 ] 56 0 56
+[ 3 0 0 ] 57 0 57
+[ 3 0 1 ] 58 0 58
+[ 3 0 1 ] 59 0 59
+[ 3 0 1 ] 60 0 60
+[ 3 1 0 ] 61 0 61
+[ 3 1 0 ] 62 0 62
+[ 3 1 0 ] 63 0 63
+[ 3 1 1 ] 64 0 64
+[ 3 1 1 ] 65 0 65
+[ 3 1 1 ] 66 0 66
+[ 3 2 0 ] 67 0 67
+[ 3 2 0 ] 68 0 68
+[ 3 2 0 ] 69 0 69
+[ 3 2 1 ] 70 0 70
+[ 3 2 1 ] 71 0 71
+[ 3 2 1 ] 72 0 72
+72 differences found
+attribute: <bitfield of </g1>> and <bitfield of </g1>>
+size: [2] [2]
+position bitfield of </g1> bitfield of </g1> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+2 differences found
+attribute: <bitfield2D of </g1>> and <bitfield2D of </g1>>
+size: [3x2] [3x2]
+position bitfield2D of </g1> bitfield2D of </g1> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 2 0 ] 5 0 5
+[ 2 1 ] 6 0 6
+6 differences found
+attribute: <bitfield3D of </g1>> and <bitfield3D of </g1>>
+size: [4x3x2] [4x3x2]
+position bitfield3D of </g1> bitfield3D of </g1> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 1 ] 2 0 2
+[ 0 1 0 ] 3 0 3
+[ 0 1 1 ] 4 0 4
+[ 0 2 0 ] 5 0 5
+[ 0 2 1 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 1 0 ] 9 0 9
+[ 1 1 1 ] 10 0 10
+[ 1 2 0 ] 11 0 11
+[ 1 2 1 ] 12 0 12
+[ 2 0 0 ] 13 0 13
+[ 2 0 1 ] 14 0 14
+[ 2 1 0 ] 15 0 15
+[ 2 1 1 ] 16 0 16
+[ 2 2 0 ] 17 0 17
+[ 2 2 1 ] 18 0 18
+[ 3 0 0 ] 19 0 19
+[ 3 0 1 ] 20 0 20
+[ 3 1 0 ] 21 0 21
+[ 3 1 1 ] 22 0 22
+[ 3 2 0 ] 23 0 23
+[ 3 2 1 ] 24 0 24
+24 differences found
+attribute: <compound of </g1>> and <compound of </g1>>
+size: [2] [2]
+position compound of </g1> compound of </g1> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 0 ] 2 0 2
+[ 1 ] 3 0 3
+[ 1 ] 4 0 4
+4 differences found
+attribute: <compound2D of </g1>> and <compound2D of </g1>>
+size: [3x2] [3x2]
+position compound2D of </g1> compound2D of </g1> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 0 ] 2 0 2
+[ 0 1 ] 3 0 3
+[ 0 1 ] 4 0 4
+[ 1 0 ] 5 0 5
+[ 1 0 ] 6 0 6
+[ 1 1 ] 7 0 7
+[ 1 1 ] 8 0 8
+[ 2 0 ] 9 0 9
+[ 2 0 ] 10 0 10
+[ 2 1 ] 11 0 11
+[ 2 1 ] 12 0 12
+12 differences found
+attribute: <compound3D of </g1>> and <compound3D of </g1>>
+size: [4x3x2] [4x3x2]
+position compound3D of </g1> compound3D of </g1> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 0 ] 2 0 2
+[ 0 0 1 ] 3 0 3
+[ 0 0 1 ] 4 0 4
+[ 0 1 0 ] 5 0 5
+[ 0 1 0 ] 6 0 6
+[ 0 1 1 ] 7 0 7
+[ 0 1 1 ] 8 0 8
+[ 0 2 0 ] 9 0 9
+[ 0 2 0 ] 10 0 10
+[ 0 2 1 ] 11 0 11
+[ 0 2 1 ] 12 0 12
+[ 1 0 0 ] 13 0 13
+[ 1 0 0 ] 14 0 14
+[ 1 0 1 ] 15 0 15
+[ 1 0 1 ] 16 0 16
+[ 1 1 0 ] 17 0 17
+[ 1 1 0 ] 18 0 18
+[ 1 1 1 ] 19 0 19
+[ 1 1 1 ] 20 0 20
+[ 1 2 0 ] 21 0 21
+[ 1 2 0 ] 22 0 22
+[ 1 2 1 ] 23 0 23
+[ 1 2 1 ] 24 0 24
+[ 2 0 0 ] 25 0 25
+[ 2 0 0 ] 26 0 26
+[ 2 0 1 ] 27 0 27
+[ 2 0 1 ] 28 0 28
+[ 2 1 0 ] 29 0 29
+[ 2 1 0 ] 30 0 30
+[ 2 1 1 ] 31 0 31
+[ 2 1 1 ] 32 0 32
+[ 2 2 0 ] 33 0 33
+[ 2 2 0 ] 34 0 34
+[ 2 2 1 ] 35 0 35
+[ 2 2 1 ] 36 0 36
+[ 3 0 0 ] 37 0 37
+[ 3 0 0 ] 38 0 38
+[ 3 0 1 ] 39 0 39
+[ 3 0 1 ] 40 0 40
+[ 3 1 0 ] 41 0 41
+[ 3 1 0 ] 42 0 42
+[ 3 1 1 ] 43 0 43
+[ 3 1 1 ] 44 0 44
+[ 3 2 0 ] 45 0 45
+[ 3 2 0 ] 46 0 46
+[ 3 2 1 ] 47 0 47
+[ 3 2 1 ] 48 0 48
+48 differences found
+attribute: <enum of </g1>> and <enum of </g1>>
+size: [2] [2]
+position enum of </g1> enum of </g1> difference
+------------------------------------------------------------
+[ 0 ] RED GREEN
+[ 1 ] RED GREEN
+2 differences found
+attribute: <enum2D of </g1>> and <enum2D of </g1>>
+size: [3x2] [3x2]
+position enum2D of </g1> enum2D of </g1> difference
+------------------------------------------------------------
+[ 0 0 ] RED GREEN
+[ 0 1 ] RED GREEN
+[ 1 0 ] RED GREEN
+[ 1 1 ] RED GREEN
+[ 2 0 ] RED GREEN
+[ 2 1 ] RED GREEN
+6 differences found
+attribute: <enum3D of </g1>> and <enum3D of </g1>>
+size: [4x3x2] [4x3x2]
+position enum3D of </g1> enum3D of </g1> difference
+------------------------------------------------------------
+[ 0 0 0 ] GREEN RED
+[ 0 0 1 ] GREEN RED
+[ 0 1 0 ] GREEN RED
+[ 0 1 1 ] GREEN RED
+[ 0 2 0 ] GREEN RED
+[ 0 2 1 ] GREEN RED
+[ 1 0 0 ] GREEN RED
+[ 1 0 1 ] GREEN RED
+[ 1 1 0 ] GREEN RED
+[ 1 1 1 ] GREEN RED
+[ 1 2 0 ] GREEN RED
+[ 1 2 1 ] GREEN RED
+[ 2 0 0 ] GREEN RED
+[ 2 0 1 ] GREEN RED
+[ 2 1 0 ] GREEN RED
+[ 2 1 1 ] GREEN RED
+[ 2 2 0 ] GREEN RED
+[ 2 2 1 ] GREEN RED
+[ 3 0 0 ] GREEN RED
+[ 3 0 1 ] GREEN RED
+[ 3 1 0 ] GREEN RED
+[ 3 1 1 ] GREEN RED
+[ 3 2 0 ] GREEN RED
+[ 3 2 1 ] GREEN RED
+24 differences found
+attribute: <float of </g1>> and <float of </g1>>
+size: [2] [2]
+position float of </g1> float of </g1> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+2 differences found
+attribute: <float2D of </g1>> and <float2D of </g1>>
+size: [3x2] [3x2]
+position float2D of </g1> float2D of </g1> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 2 0 ] 5 0 5
+[ 2 1 ] 6 0 6
+6 differences found
+attribute: <float3D of </g1>> and <float3D of </g1>>
+size: [4x3x2] [4x3x2]
+position float3D of </g1> float3D of </g1> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 1 ] 2 0 2
+[ 0 1 0 ] 3 0 3
+[ 0 1 1 ] 4 0 4
+[ 0 2 0 ] 5 0 5
+[ 0 2 1 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 1 0 ] 9 0 9
+[ 1 1 1 ] 10 0 10
+[ 1 2 0 ] 11 0 11
+[ 1 2 1 ] 12 0 12
+[ 2 0 0 ] 13 0 13
+[ 2 0 1 ] 14 0 14
+[ 2 1 0 ] 15 0 15
+[ 2 1 1 ] 16 0 16
+[ 2 2 0 ] 17 0 17
+[ 2 2 1 ] 18 0 18
+[ 3 0 0 ] 19 0 19
+[ 3 0 1 ] 20 0 20
+[ 3 1 0 ] 21 0 21
+[ 3 1 1 ] 22 0 22
+[ 3 2 0 ] 23 0 23
+[ 3 2 1 ] 24 0 24
+24 differences found
+attribute: <integer of </g1>> and <integer of </g1>>
+size: [2] [2]
+position integer of </g1> integer of </g1> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+2 differences found
+attribute: <integer2D of </g1>> and <integer2D of </g1>>
+size: [3x2] [3x2]
+position integer2D of </g1> integer2D of </g1> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 2 0 ] 5 0 5
+[ 2 1 ] 6 0 6
+6 differences found
+attribute: <integer3D of </g1>> and <integer3D of </g1>>
+size: [4x3x2] [4x3x2]
+position integer3D of </g1> integer3D of </g1> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 1 ] 2 0 2
+[ 0 1 0 ] 3 0 3
+[ 0 1 1 ] 4 0 4
+[ 0 2 0 ] 5 0 5
+[ 0 2 1 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 1 0 ] 9 0 9
+[ 1 1 1 ] 10 0 10
+[ 1 2 0 ] 11 0 11
+[ 1 2 1 ] 12 0 12
+[ 2 0 0 ] 13 0 13
+[ 2 0 1 ] 14 0 14
+[ 2 1 0 ] 15 0 15
+[ 2 1 1 ] 16 0 16
+[ 2 2 0 ] 17 0 17
+[ 2 2 1 ] 18 0 18
+[ 3 0 0 ] 19 0 19
+[ 3 0 1 ] 20 0 20
+[ 3 1 0 ] 21 0 21
+[ 3 1 1 ] 22 0 22
+[ 3 2 0 ] 23 0 23
+[ 3 2 1 ] 24 0 24
+24 differences found
+attribute: <opaque of </g1>> and <opaque of </g1>>
+size: [2] [2]
+position opaque of </g1> opaque of </g1> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+2 differences found
+attribute: <opaque2D of </g1>> and <opaque2D of </g1>>
+size: [3x2] [3x2]
+position opaque2D of </g1> opaque2D of </g1> difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 2 0 ] 5 0 5
+[ 2 1 ] 6 0 6
+6 differences found
+attribute: <opaque3D of </g1>> and <opaque3D of </g1>>
+size: [4x3x2] [4x3x2]
+position opaque3D of </g1> opaque3D of </g1> difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 1 ] 2 0 2
+[ 0 1 0 ] 3 0 3
+[ 0 1 1 ] 4 0 4
+[ 0 2 0 ] 5 0 5
+[ 0 2 1 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 1 0 ] 9 0 9
+[ 1 1 1 ] 10 0 10
+[ 1 2 0 ] 11 0 11
+[ 1 2 1 ] 12 0 12
+[ 2 0 0 ] 13 0 13
+[ 2 0 1 ] 14 0 14
+[ 2 1 0 ] 15 0 15
+[ 2 1 1 ] 16 0 16
+[ 2 2 0 ] 17 0 17
+[ 2 2 1 ] 18 0 18
+[ 3 0 0 ] 19 0 19
+[ 3 0 1 ] 20 0 20
+[ 3 1 0 ] 21 0 21
+[ 3 1 1 ] 22 0 22
+[ 3 2 0 ] 23 0 23
+[ 3 2 1 ] 24 0 24
+24 differences found
+attribute: <string of </g1>> and <string of </g1>>
+size: [2] [2]
+position string of </g1> string of </g1> difference
+------------------------------------------------------------
+[ 0 ] a z
+[ 0 ] b z
+[ 1 ] d z
+[ 1 ] e z
+4 differences found
+attribute: <string2D of </g1>> and <string2D of </g1>>
+size: [3x2] [3x2]
+position string2D of </g1> string2D of </g1> difference
+------------------------------------------------------------
+[ 0 0 ] a z
+[ 0 0 ] b z
+[ 0 1 ] c z
+[ 0 1 ] d z
+[ 1 0 ] e z
+[ 1 0 ] f z
+[ 1 1 ] g z
+[ 1 1 ] h z
+[ 2 0 ] i z
+[ 2 0 ] j z
+[ 2 1 ] k z
+[ 2 1 ] l z
+12 differences found
+attribute: <string3D of </g1>> and <string3D of </g1>>
+size: [4x3x2] [4x3x2]
+position string3D of </g1> string3D of </g1> difference
+------------------------------------------------------------
+[ 0 0 0 ] a z
+[ 0 0 0 ] b z
+[ 0 0 1 ] c z
+[ 0 0 1 ] d z
+[ 0 1 0 ] e z
+[ 0 1 0 ] f z
+[ 0 1 1 ] g z
+[ 0 1 1 ] h z
+[ 0 2 0 ] i z
+[ 0 2 0 ] j z
+[ 0 2 1 ] k z
+[ 0 2 1 ] l z
+[ 1 0 0 ] m z
+[ 1 0 0 ] n z
+[ 1 0 1 ] p z
+[ 1 0 1 ] q z
+[ 1 1 0 ] r z
+[ 1 1 0 ] s z
+[ 1 1 1 ] t z
+[ 1 1 1 ] u z
+[ 1 2 0 ] v z
+[ 1 2 0 ] w z
+[ 1 2 1 ] x z
+[ 2 0 0 ] A z
+[ 2 0 0 ] B z
+[ 2 0 1 ] C z
+[ 2 0 1 ] D z
+[ 2 1 0 ] E z
+[ 2 1 0 ] F z
+[ 2 1 1 ] G z
+[ 2 1 1 ] H z
+[ 2 2 0 ] I z
+[ 2 2 0 ] J z
+[ 2 2 1 ] K z
+[ 2 2 1 ] L z
+[ 3 0 0 ] M z
+[ 3 0 0 ] N z
+[ 3 0 1 ] P z
+[ 3 0 1 ] Q z
+[ 3 1 0 ] R z
+[ 3 1 0 ] S z
+[ 3 1 1 ] T z
+[ 3 1 1 ] U z
+[ 3 2 0 ] V z
+[ 3 2 0 ] W z
+[ 3 2 1 ] X z
+[ 3 2 1 ] Z z
+47 differences found
+attribute: <vlen of </g1>> and <vlen of </g1>>
+size: [2] [2]
+position vlen of </g1> vlen of </g1> difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+[ 1 ] 3 0 3
+3 differences found
+attribute: <vlen2D of </g1>> and <vlen2D of </g1>>
+size: [3x2] [3x2]
+position vlen2D of </g1> vlen2D of </g1> difference
+------------------------------------------------------------
+[ 0 1 ] 1 0 1
+[ 1 0 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 1 1 ] 5 0 5
+[ 2 0 ] 6 0 6
+[ 2 0 ] 7 0 7
+[ 2 0 ] 8 0 8
+[ 2 1 ] 9 0 9
+[ 2 1 ] 10 0 10
+[ 2 1 ] 11 0 11
+11 differences found
+attribute: <vlen3D of </g1>> and <vlen3D of </g1>>
+size: [4x3x2] [4x3x2]
+position vlen3D of </g1> vlen3D of </g1> difference
+------------------------------------------------------------
+[ 0 0 1 ] 1 0 1
+[ 0 1 0 ] 2 0 2
+[ 0 1 1 ] 3 0 3
+[ 0 2 0 ] 4 0 4
+[ 0 2 1 ] 5 0 5
+[ 1 0 0 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 0 1 ] 9 0 9
+[ 1 1 0 ] 10 0 10
+[ 1 1 0 ] 11 0 11
+[ 1 1 1 ] 12 0 12
+[ 1 1 1 ] 13 0 13
+[ 1 2 0 ] 14 0 14
+[ 1 2 0 ] 15 0 15
+[ 1 2 1 ] 16 0 16
+[ 1 2 1 ] 17 0 17
+[ 2 0 0 ] 18 0 18
+[ 2 0 0 ] 19 0 19
+[ 2 0 0 ] 20 0 20
+[ 2 0 1 ] 21 0 21
+[ 2 0 1 ] 22 0 22
+[ 2 0 1 ] 23 0 23
+[ 2 1 0 ] 24 0 24
+[ 2 1 0 ] 25 0 25
+[ 2 1 0 ] 26 0 26
+[ 2 1 1 ] 27 0 27
+[ 2 1 1 ] 28 0 28
+[ 2 1 1 ] 29 0 29
+[ 2 2 0 ] 30 0 30
+[ 2 2 0 ] 31 0 31
+[ 2 2 0 ] 32 0 32
+[ 2 2 1 ] 33 0 33
+[ 2 2 1 ] 34 0 34
+[ 2 2 1 ] 35 0 35
+[ 3 0 0 ] 36 0 36
+[ 3 0 0 ] 37 0 37
+[ 3 0 0 ] 38 0 38
+[ 3 0 0 ] 39 0 39
+[ 3 0 1 ] 40 0 40
+[ 3 0 1 ] 41 0 41
+[ 3 0 1 ] 42 0 42
+[ 3 0 1 ] 43 0 43
+[ 3 1 0 ] 44 0 44
+[ 3 1 0 ] 45 0 45
+[ 3 1 0 ] 46 0 46
+[ 3 1 0 ] 47 0 47
+[ 3 1 1 ] 48 0 48
+[ 3 1 1 ] 49 0 49
+[ 3 1 1 ] 50 0 50
+[ 3 1 1 ] 51 0 51
+[ 3 2 0 ] 52 0 52
+[ 3 2 0 ] 53 0 53
+[ 3 2 0 ] 54 0 54
+[ 3 2 0 ] 55 0 55
+[ 3 2 1 ] 56 0 56
+[ 3 2 1 ] 57 0 57
+[ 3 2 1 ] 58 0 58
+[ 3 2 1 ] 59 0 59
+59 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/test/h5diff/testfiles/h5diff_704.txt b/tools/test/h5diff/testfiles/h5diff_704.txt
new file mode 100644
index 0000000..e752a01
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_704.txt
@@ -0,0 +1,28 @@
+
+group1 group2
+---------------------------------------
+ x x
+
+
+group : </g> and </g>
+0 differences found
+ obj1 obj2
+ --------------------------------------
+ x x float1
+ x x integer1
+Attributes status: 2 common, 0 only in obj1, 0 only in obj2
+attribute: <float1 of </g>> and <float1 of </g>>
+size: [2] [2]
+position float1 of </g> float1 of </g> difference
+------------------------------------------------------------
+[ 0 ] 1.1 2.1 1
+[ 1 ] 2.2 3.2 1
+2 differences found
+attribute: <integer1 of </g>> and <integer1 of </g>>
+size: [2] [2]
+position integer1 of </g> integer1 of </g> difference
+------------------------------------------------------------
+[ 0 ] 1 2 1
+[ 1 ] 2 3 1
+2 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_705.txt b/tools/test/h5diff/testfiles/h5diff_705.txt
new file mode 100644
index 0000000..2e52f18
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_705.txt
@@ -0,0 +1,17 @@
+
+dataset: </dset> and </dset>
+0 differences found
+ obj1 obj2
+ --------------------------------------
+ x float2
+ x float3
+ x x integer1
+Attributes status: 1 common, 1 only in obj1, 1 only in obj2
+attribute: <integer1 of </dset>> and <integer1 of </dset>>
+size: [2] [2]
+position integer1 of </dset> integer1 of </dset> difference
+------------------------------------------------------------
+[ 0 ] 1 2 1
+[ 1 ] 2 3 1
+2 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_706.txt b/tools/test/h5diff/testfiles/h5diff_706.txt
new file mode 100644
index 0000000..5825150
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_706.txt
@@ -0,0 +1,13 @@
+
+datatype: </ntype> and </ntype>
+0 differences found
+ obj1 obj2
+ --------------------------------------
+ x float2
+ x float3
+ x float5
+ x float6
+ x integer1
+ x integer4
+Attributes status: 0 common, 3 only in obj1, 3 only in obj2
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_707.txt b/tools/test/h5diff/testfiles/h5diff_707.txt
new file mode 100644
index 0000000..4d6378b
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_707.txt
@@ -0,0 +1,29 @@
+
+group1 group2
+---------------------------------------
+ x x
+
+
+group : </g2> and </g2>
+0 differences found
+ obj1 obj2
+ --------------------------------------
+ x x float2
+ x float3
+ x x integer1
+Attributes status: 2 common, 1 only in obj1, 0 only in obj2
+attribute: <float2 of </g2>> and <float2 of </g2>>
+size: [2] [2]
+position float2 of </g2> float2 of </g2> difference
+------------------------------------------------------------
+[ 0 ] 1.1 2.1 1
+[ 1 ] 2.2 3.2 1
+2 differences found
+attribute: <integer1 of </g2>> and <integer1 of </g2>>
+size: [2] [2]
+position integer1 of </g2> integer1 of </g2> difference
+------------------------------------------------------------
+[ 0 ] 1 2 1
+[ 1 ] 2 3 1
+2 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_708.txt b/tools/test/h5diff/testfiles/h5diff_708.txt
new file mode 100644
index 0000000..a10a8b7
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_708.txt
@@ -0,0 +1,17 @@
+
+group1 group2
+---------------------------------------
+ x x
+
+
+group : </g3> and </g3>
+0 differences found
+ obj1 obj2
+ --------------------------------------
+ x float11
+ x float12
+ x float4
+ x integer10
+ x integer3
+Attributes status: 0 common, 3 only in obj1, 2 only in obj2
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_709.txt b/tools/test/h5diff/testfiles/h5diff_709.txt
new file mode 100644
index 0000000..d0e68bf
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_709.txt
@@ -0,0 +1,12 @@
+
+group1 group2
+---------------------------------------
+ x x
+
+
+group : </g4> and </g4>
+0 differences found
+ obj1 obj2
+ --------------------------------------
+Attributes status: 0 common, 0 only in obj1, 0 only in obj2
+EXIT CODE: 0
diff --git a/tools/test/h5diff/testfiles/h5diff_710.txt b/tools/test/h5diff/testfiles/h5diff_710.txt
new file mode 100644
index 0000000..10a8501
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_710.txt
@@ -0,0 +1,108 @@
+
+file1 file2
+---------------------------------------
+ x x /
+ x x /dset
+ x x /g
+ x x /g2
+ x x /g3
+ x x /g4
+ x x /ntype
+
+
+group : </> and </>
+0 differences found
+ obj1 obj2
+ --------------------------------------
+Attributes status: 0 common, 0 only in obj1, 0 only in obj2
+
+dataset: </dset> and </dset>
+0 differences found
+ obj1 obj2
+ --------------------------------------
+ x float2
+ x float3
+ x x integer1
+Attributes status: 1 common, 1 only in obj1, 1 only in obj2
+attribute: <integer1 of </dset>> and <integer1 of </dset>>
+size: [2] [2]
+position integer1 of </dset> integer1 of </dset> difference
+------------------------------------------------------------
+[ 0 ] 1 2 1
+[ 1 ] 2 3 1
+2 differences found
+
+group : </g> and </g>
+0 differences found
+ obj1 obj2
+ --------------------------------------
+ x x float1
+ x x integer1
+Attributes status: 2 common, 0 only in obj1, 0 only in obj2
+attribute: <float1 of </g>> and <float1 of </g>>
+size: [2] [2]
+position float1 of </g> float1 of </g> difference
+------------------------------------------------------------
+[ 0 ] 1.1 2.1 1
+[ 1 ] 2.2 3.2 1
+2 differences found
+attribute: <integer1 of </g>> and <integer1 of </g>>
+size: [2] [2]
+position integer1 of </g> integer1 of </g> difference
+------------------------------------------------------------
+[ 0 ] 1 2 1
+[ 1 ] 2 3 1
+2 differences found
+
+group : </g2> and </g2>
+0 differences found
+ obj1 obj2
+ --------------------------------------
+ x x float2
+ x float3
+ x x integer1
+Attributes status: 2 common, 1 only in obj1, 0 only in obj2
+attribute: <float2 of </g2>> and <float2 of </g2>>
+size: [2] [2]
+position float2 of </g2> float2 of </g2> difference
+------------------------------------------------------------
+[ 0 ] 1.1 2.1 1
+[ 1 ] 2.2 3.2 1
+2 differences found
+attribute: <integer1 of </g2>> and <integer1 of </g2>>
+size: [2] [2]
+position integer1 of </g2> integer1 of </g2> difference
+------------------------------------------------------------
+[ 0 ] 1 2 1
+[ 1 ] 2 3 1
+2 differences found
+
+group : </g3> and </g3>
+0 differences found
+ obj1 obj2
+ --------------------------------------
+ x float11
+ x float12
+ x float4
+ x integer10
+ x integer3
+Attributes status: 0 common, 3 only in obj1, 2 only in obj2
+
+group : </g4> and </g4>
+0 differences found
+ obj1 obj2
+ --------------------------------------
+Attributes status: 0 common, 0 only in obj1, 0 only in obj2
+
+datatype: </ntype> and </ntype>
+0 differences found
+ obj1 obj2
+ --------------------------------------
+ x float2
+ x float3
+ x float5
+ x float6
+ x integer1
+ x integer4
+Attributes status: 0 common, 3 only in obj1, 3 only in obj2
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_80.txt b/tools/test/h5diff/testfiles/h5diff_80.txt
new file mode 100644
index 0000000..5957d72
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_80.txt
@@ -0,0 +1,881 @@
+
+file1 file2
+---------------------------------------
+ x x /
+ x x /dset
+ x x /dsetref
+ x x /g1
+ x x /g1/VLstring
+ x x /g1/VLstring2D
+ x x /g1/VLstring3D
+ x x /g1/array
+ x x /g1/array2D
+ x x /g1/array3D
+ x x /g1/arrayd
+ x x /g1/bitfield
+ x x /g1/bitfield2D
+ x x /g1/bitfield3D
+ x x /g1/compound
+ x x /g1/compound2D
+ x x /g1/compound3D
+ x x /g1/enum
+ x x /g1/enum2D
+ x x /g1/enum3D
+ x x /g1/float
+ x x /g1/float2D
+ x x /g1/float3D
+ x x /g1/integer
+ x x /g1/integer2D
+ x x /g1/integer3D
+ x x /g1/opaque
+ x x /g1/opaque2D
+ x x /g1/opaque3D
+ x x /g1/reference
+ x x /g1/reference2D
+ x x /g1/reference3D
+ x x /g1/scalar
+ x x /g1/string
+ x x /g1/string2D
+ x x /g1/string3D
+ x x /g1/vlen
+ x x /g1/vlen2D
+ x x /g1/vlen3D
+ x x /refreg
+
+group : </> and </>
+0 differences found
+dataset: </dset> and </dset>
+size: [2] [2]
+position dset dset difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+2 differences found
+dataset: </dsetref> and </dsetref>
+0 differences found
+group : </g1> and </g1>
+0 differences found
+dataset: </g1/VLstring> and </g1/VLstring>
+size: [2] [2]
+position VLstring VLstring difference
+------------------------------------------------------------
+[ 0 ] a z
+[ 0 ] b z
+[ 1 ] d z
+[ 1 ] e z
+4 differences found
+dataset: </g1/VLstring2D> and </g1/VLstring2D>
+size: [3x2] [3x2]
+position VLstring2D VLstring2D difference
+------------------------------------------------------------
+[ 0 0 ] a z
+[ 0 0 ] b z
+[ 0 1 ] c z
+[ 0 1 ] d z
+[ 1 0 ] e z
+[ 1 0 ] f z
+[ 1 1 ] g z
+[ 1 1 ] h z
+[ 2 0 ] i z
+[ 2 0 ] j z
+[ 2 1 ] k z
+[ 2 1 ] l z
+12 differences found
+dataset: </g1/VLstring3D> and </g1/VLstring3D>
+size: [4x3x2] [4x3x2]
+position VLstring3D VLstring3D difference
+------------------------------------------------------------
+[ 0 0 0 ] a z
+[ 0 0 0 ] b z
+[ 0 0 1 ] c z
+[ 0 0 1 ] d z
+[ 0 1 0 ] e z
+[ 0 1 0 ] f z
+[ 0 1 1 ] g z
+[ 0 1 1 ] h z
+[ 0 2 0 ] i z
+[ 0 2 0 ] j z
+[ 0 2 1 ] k z
+[ 0 2 1 ] l z
+[ 1 0 0 ] m z
+[ 1 0 0 ] n z
+[ 1 0 1 ] p z
+[ 1 0 1 ] q z
+[ 1 1 0 ] r z
+[ 1 1 0 ] s z
+[ 1 1 1 ] t z
+[ 1 1 1 ] u z
+[ 1 2 0 ] v z
+[ 1 2 0 ] w z
+[ 1 2 1 ] x z
+[ 2 0 0 ] A z
+[ 2 0 0 ] B z
+[ 2 0 1 ] C z
+[ 2 0 1 ] D z
+[ 2 1 0 ] E z
+[ 2 1 0 ] F z
+[ 2 1 1 ] G z
+[ 2 1 1 ] H z
+[ 2 2 0 ] I z
+[ 2 2 0 ] J z
+[ 2 2 1 ] K z
+[ 2 2 1 ] L z
+[ 3 0 0 ] M z
+[ 3 0 0 ] N z
+[ 3 0 1 ] P z
+[ 3 0 1 ] Q z
+[ 3 1 0 ] R z
+[ 3 1 0 ] S z
+[ 3 1 1 ] T z
+[ 3 1 1 ] U z
+[ 3 2 0 ] V z
+[ 3 2 0 ] W z
+[ 3 2 1 ] X z
+[ 3 2 1 ] Z z
+47 differences found
+dataset: </g1/array> and </g1/array>
+size: [2] [2]
+position array array difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 0 ] 2 0 2
+[ 0 ] 3 0 3
+[ 1 ] 4 0 4
+[ 1 ] 5 0 5
+[ 1 ] 6 0 6
+6 differences found
+dataset: </g1/array2D> and </g1/array2D>
+size: [3x2] [3x2]
+position array2D array2D difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 0 ] 2 0 2
+[ 0 0 ] 3 0 3
+[ 0 1 ] 4 0 4
+[ 0 1 ] 5 0 5
+[ 0 1 ] 6 0 6
+[ 1 0 ] 7 0 7
+[ 1 0 ] 8 0 8
+[ 1 0 ] 9 0 9
+[ 1 1 ] 10 0 10
+[ 1 1 ] 11 0 11
+[ 1 1 ] 12 0 12
+[ 2 0 ] 13 0 13
+[ 2 0 ] 14 0 14
+[ 2 0 ] 15 0 15
+[ 2 1 ] 16 0 16
+[ 2 1 ] 17 0 17
+[ 2 1 ] 18 0 18
+18 differences found
+dataset: </g1/array3D> and </g1/array3D>
+size: [4x3x2] [4x3x2]
+position array3D array3D difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 0 ] 2 0 2
+[ 0 0 0 ] 3 0 3
+[ 0 0 1 ] 4 0 4
+[ 0 0 1 ] 5 0 5
+[ 0 0 1 ] 6 0 6
+[ 0 1 0 ] 7 0 7
+[ 0 1 0 ] 8 0 8
+[ 0 1 0 ] 9 0 9
+[ 0 1 1 ] 10 0 10
+[ 0 1 1 ] 11 0 11
+[ 0 1 1 ] 12 0 12
+[ 0 2 0 ] 13 0 13
+[ 0 2 0 ] 14 0 14
+[ 0 2 0 ] 15 0 15
+[ 0 2 1 ] 16 0 16
+[ 0 2 1 ] 17 0 17
+[ 0 2 1 ] 18 0 18
+[ 1 0 0 ] 19 0 19
+[ 1 0 0 ] 20 0 20
+[ 1 0 0 ] 21 0 21
+[ 1 0 1 ] 22 0 22
+[ 1 0 1 ] 23 0 23
+[ 1 0 1 ] 24 0 24
+[ 1 1 0 ] 25 0 25
+[ 1 1 0 ] 26 0 26
+[ 1 1 0 ] 27 0 27
+[ 1 1 1 ] 28 0 28
+[ 1 1 1 ] 29 0 29
+[ 1 1 1 ] 30 0 30
+[ 1 2 0 ] 31 0 31
+[ 1 2 0 ] 32 0 32
+[ 1 2 0 ] 33 0 33
+[ 1 2 1 ] 34 0 34
+[ 1 2 1 ] 35 0 35
+[ 1 2 1 ] 36 0 36
+[ 2 0 0 ] 37 0 37
+[ 2 0 0 ] 38 0 38
+[ 2 0 0 ] 39 0 39
+[ 2 0 1 ] 40 0 40
+[ 2 0 1 ] 41 0 41
+[ 2 0 1 ] 42 0 42
+[ 2 1 0 ] 43 0 43
+[ 2 1 0 ] 44 0 44
+[ 2 1 0 ] 45 0 45
+[ 2 1 1 ] 46 0 46
+[ 2 1 1 ] 47 0 47
+[ 2 1 1 ] 48 0 48
+[ 2 2 0 ] 49 0 49
+[ 2 2 0 ] 50 0 50
+[ 2 2 0 ] 51 0 51
+[ 2 2 1 ] 52 0 52
+[ 2 2 1 ] 53 0 53
+[ 2 2 1 ] 54 0 54
+[ 3 0 0 ] 55 0 55
+[ 3 0 0 ] 56 0 56
+[ 3 0 0 ] 57 0 57
+[ 3 0 1 ] 58 0 58
+[ 3 0 1 ] 59 0 59
+[ 3 0 1 ] 60 0 60
+[ 3 1 0 ] 61 0 61
+[ 3 1 0 ] 62 0 62
+[ 3 1 0 ] 63 0 63
+[ 3 1 1 ] 64 0 64
+[ 3 1 1 ] 65 0 65
+[ 3 1 1 ] 66 0 66
+[ 3 2 0 ] 67 0 67
+[ 3 2 0 ] 68 0 68
+[ 3 2 0 ] 69 0 69
+[ 3 2 1 ] 70 0 70
+[ 3 2 1 ] 71 0 71
+[ 3 2 1 ] 72 0 72
+72 differences found
+dataset: </g1/arrayd> and </g1/arrayd>
+Not comparable: </g1/arrayd> or </g1/arrayd> is an empty dataset
+0 differences found
+dataset: </g1/bitfield> and </g1/bitfield>
+size: [2] [2]
+position bitfield bitfield difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+2 differences found
+dataset: </g1/bitfield2D> and </g1/bitfield2D>
+size: [3x2] [3x2]
+position bitfield2D bitfield2D difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 2 0 ] 5 0 5
+[ 2 1 ] 6 0 6
+6 differences found
+dataset: </g1/bitfield3D> and </g1/bitfield3D>
+size: [4x3x2] [4x3x2]
+position bitfield3D bitfield3D difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 1 ] 2 0 2
+[ 0 1 0 ] 3 0 3
+[ 0 1 1 ] 4 0 4
+[ 0 2 0 ] 5 0 5
+[ 0 2 1 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 1 0 ] 9 0 9
+[ 1 1 1 ] 10 0 10
+[ 1 2 0 ] 11 0 11
+[ 1 2 1 ] 12 0 12
+[ 2 0 0 ] 13 0 13
+[ 2 0 1 ] 14 0 14
+[ 2 1 0 ] 15 0 15
+[ 2 1 1 ] 16 0 16
+[ 2 2 0 ] 17 0 17
+[ 2 2 1 ] 18 0 18
+[ 3 0 0 ] 19 0 19
+[ 3 0 1 ] 20 0 20
+[ 3 1 0 ] 21 0 21
+[ 3 1 1 ] 22 0 22
+[ 3 2 0 ] 23 0 23
+[ 3 2 1 ] 24 0 24
+24 differences found
+dataset: </g1/compound> and </g1/compound>
+size: [2] [2]
+position compound compound difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 0 ] 2 0 2
+[ 1 ] 3 0 3
+[ 1 ] 4 0 4
+4 differences found
+dataset: </g1/compound2D> and </g1/compound2D>
+size: [3x2] [3x2]
+position compound2D compound2D difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 0 ] 2 0 2
+[ 0 1 ] 3 0 3
+[ 0 1 ] 4 0 4
+[ 1 0 ] 5 0 5
+[ 1 0 ] 6 0 6
+[ 1 1 ] 7 0 7
+[ 1 1 ] 8 0 8
+[ 2 0 ] 9 0 9
+[ 2 0 ] 10 0 10
+[ 2 1 ] 11 0 11
+[ 2 1 ] 12 0 12
+12 differences found
+dataset: </g1/compound3D> and </g1/compound3D>
+size: [4x3x2] [4x3x2]
+position compound3D compound3D difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 0 ] 2 0 2
+[ 0 0 1 ] 3 0 3
+[ 0 0 1 ] 4 0 4
+[ 0 1 0 ] 5 0 5
+[ 0 1 0 ] 6 0 6
+[ 0 1 1 ] 7 0 7
+[ 0 1 1 ] 8 0 8
+[ 0 2 0 ] 9 0 9
+[ 0 2 0 ] 10 0 10
+[ 0 2 1 ] 11 0 11
+[ 0 2 1 ] 12 0 12
+[ 1 0 0 ] 13 0 13
+[ 1 0 0 ] 14 0 14
+[ 1 0 1 ] 15 0 15
+[ 1 0 1 ] 16 0 16
+[ 1 1 0 ] 17 0 17
+[ 1 1 0 ] 18 0 18
+[ 1 1 1 ] 19 0 19
+[ 1 1 1 ] 20 0 20
+[ 1 2 0 ] 21 0 21
+[ 1 2 0 ] 22 0 22
+[ 1 2 1 ] 23 0 23
+[ 1 2 1 ] 24 0 24
+[ 2 0 0 ] 25 0 25
+[ 2 0 0 ] 26 0 26
+[ 2 0 1 ] 27 0 27
+[ 2 0 1 ] 28 0 28
+[ 2 1 0 ] 29 0 29
+[ 2 1 0 ] 30 0 30
+[ 2 1 1 ] 31 0 31
+[ 2 1 1 ] 32 0 32
+[ 2 2 0 ] 33 0 33
+[ 2 2 0 ] 34 0 34
+[ 2 2 1 ] 35 0 35
+[ 2 2 1 ] 36 0 36
+[ 3 0 0 ] 37 0 37
+[ 3 0 0 ] 38 0 38
+[ 3 0 1 ] 39 0 39
+[ 3 0 1 ] 40 0 40
+[ 3 1 0 ] 41 0 41
+[ 3 1 0 ] 42 0 42
+[ 3 1 1 ] 43 0 43
+[ 3 1 1 ] 44 0 44
+[ 3 2 0 ] 45 0 45
+[ 3 2 0 ] 46 0 46
+[ 3 2 1 ] 47 0 47
+[ 3 2 1 ] 48 0 48
+48 differences found
+dataset: </g1/enum> and </g1/enum>
+size: [2] [2]
+position enum enum difference
+------------------------------------------------------------
+[ 0 ] RED GREEN
+1 differences found
+dataset: </g1/enum2D> and </g1/enum2D>
+Not comparable: </g1/enum2D> or </g1/enum2D> is an empty dataset
+0 differences found
+dataset: </g1/enum3D> and </g1/enum3D>
+Not comparable: </g1/enum3D> or </g1/enum3D> is an empty dataset
+0 differences found
+dataset: </g1/float> and </g1/float>
+size: [2] [2]
+position float float difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+2 differences found
+dataset: </g1/float2D> and </g1/float2D>
+size: [3x2] [3x2]
+position float2D float2D difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 2 0 ] 5 0 5
+[ 2 1 ] 6 0 6
+6 differences found
+dataset: </g1/float3D> and </g1/float3D>
+size: [4x3x2] [4x3x2]
+position float3D float3D difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 1 ] 2 0 2
+[ 0 1 0 ] 3 0 3
+[ 0 1 1 ] 4 0 4
+[ 0 2 0 ] 5 0 5
+[ 0 2 1 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 1 0 ] 9 0 9
+[ 1 1 1 ] 10 0 10
+[ 1 2 0 ] 11 0 11
+[ 1 2 1 ] 12 0 12
+[ 2 0 0 ] 13 0 13
+[ 2 0 1 ] 14 0 14
+[ 2 1 0 ] 15 0 15
+[ 2 1 1 ] 16 0 16
+[ 2 2 0 ] 17 0 17
+[ 2 2 1 ] 18 0 18
+[ 3 0 0 ] 19 0 19
+[ 3 0 1 ] 20 0 20
+[ 3 1 0 ] 21 0 21
+[ 3 1 1 ] 22 0 22
+[ 3 2 0 ] 23 0 23
+[ 3 2 1 ] 24 0 24
+24 differences found
+dataset: </g1/integer> and </g1/integer>
+size: [2] [2]
+position integer integer difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+2 differences found
+dataset: </g1/integer2D> and </g1/integer2D>
+size: [3x2] [3x2]
+position integer2D integer2D difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 2 0 ] 5 0 5
+[ 2 1 ] 6 0 6
+6 differences found
+dataset: </g1/integer3D> and </g1/integer3D>
+size: [4x3x2] [4x3x2]
+position integer3D integer3D difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 1 ] 2 0 2
+[ 0 1 0 ] 3 0 3
+[ 0 1 1 ] 4 0 4
+[ 0 2 0 ] 5 0 5
+[ 0 2 1 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 1 0 ] 9 0 9
+[ 1 1 1 ] 10 0 10
+[ 1 2 0 ] 11 0 11
+[ 1 2 1 ] 12 0 12
+[ 2 0 0 ] 13 0 13
+[ 2 0 1 ] 14 0 14
+[ 2 1 0 ] 15 0 15
+[ 2 1 1 ] 16 0 16
+[ 2 2 0 ] 17 0 17
+[ 2 2 1 ] 18 0 18
+[ 3 0 0 ] 19 0 19
+[ 3 0 1 ] 20 0 20
+[ 3 1 0 ] 21 0 21
+[ 3 1 1 ] 22 0 22
+[ 3 2 0 ] 23 0 23
+[ 3 2 1 ] 24 0 24
+24 differences found
+dataset: </g1/opaque> and </g1/opaque>
+size: [2] [2]
+position opaque opaque difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+2 differences found
+dataset: </g1/opaque2D> and </g1/opaque2D>
+size: [3x2] [3x2]
+position opaque2D opaque2D difference
+------------------------------------------------------------
+[ 0 0 ] 1 0 1
+[ 0 1 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 2 0 ] 5 0 5
+[ 2 1 ] 6 0 6
+6 differences found
+dataset: </g1/opaque3D> and </g1/opaque3D>
+size: [4x3x2] [4x3x2]
+position opaque3D opaque3D difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 1 ] 2 0 2
+[ 0 1 0 ] 3 0 3
+[ 0 1 1 ] 4 0 4
+[ 0 2 0 ] 5 0 5
+[ 0 2 1 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 1 0 ] 9 0 9
+[ 1 1 1 ] 10 0 10
+[ 1 2 0 ] 11 0 11
+[ 1 2 1 ] 12 0 12
+[ 2 0 0 ] 13 0 13
+[ 2 0 1 ] 14 0 14
+[ 2 1 0 ] 15 0 15
+[ 2 1 1 ] 16 0 16
+[ 2 2 0 ] 17 0 17
+[ 2 2 1 ] 18 0 18
+[ 3 0 0 ] 19 0 19
+[ 3 0 1 ] 20 0 20
+[ 3 1 0 ] 21 0 21
+[ 3 1 1 ] 22 0 22
+[ 3 2 0 ] 23 0 23
+[ 3 2 1 ] 24 0 24
+24 differences found
+dataset: </g1/reference> and </g1/reference>
+size: [2] [2]
+position difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+size: [2] [2]
+position difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+4 differences found
+dataset: </g1/reference2D> and </g1/reference2D>
+size: [2] [2]
+position difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+size: [2] [2]
+position difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+size: [2] [2]
+position difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+size: [2] [2]
+position difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+size: [2] [2]
+position difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+size: [2] [2]
+position difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+12 differences found
+dataset: </g1/reference3D> and </g1/reference3D>
+size: [2] [2]
+position difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+size: [2] [2]
+position difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+size: [2] [2]
+position difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+size: [2] [2]
+position difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+size: [2] [2]
+position difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+size: [2] [2]
+position difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+size: [2] [2]
+position difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+size: [2] [2]
+position difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+size: [2] [2]
+position difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+size: [2] [2]
+position difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+size: [2] [2]
+position difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+size: [2] [2]
+position difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+size: [2] [2]
+position difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+size: [2] [2]
+position difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+size: [2] [2]
+position difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+size: [2] [2]
+position difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+size: [2] [2]
+position difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+size: [2] [2]
+position difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+size: [2] [2]
+position difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+size: [2] [2]
+position difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+size: [2] [2]
+position difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+size: [2] [2]
+position difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+size: [2] [2]
+position difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+size: [2] [2]
+position difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+48 differences found
+dataset: </g1/scalar> and </g1/scalar>
+size: H5S_SCALAR H5S_SCALAR
+position scalar scalar difference
+------------------------------------------------------------
+ 2 1 1
+1 differences found
+dataset: </g1/string> and </g1/string>
+size: [2] [2]
+position string string difference
+------------------------------------------------------------
+[ 0 ] a z
+[ 0 ] b z
+[ 1 ] d z
+[ 1 ] e z
+4 differences found
+dataset: </g1/string2D> and </g1/string2D>
+size: [3x2] [3x2]
+position string2D string2D difference
+------------------------------------------------------------
+[ 0 0 ] a z
+[ 0 0 ] b z
+[ 0 1 ] c z
+[ 0 1 ] d z
+[ 1 0 ] e z
+[ 1 0 ] f z
+[ 1 1 ] g z
+[ 1 1 ] h z
+[ 2 0 ] i z
+[ 2 0 ] j z
+[ 2 1 ] k z
+[ 2 1 ] l z
+12 differences found
+dataset: </g1/string3D> and </g1/string3D>
+size: [4x3x2] [4x3x2]
+position string3D string3D difference
+------------------------------------------------------------
+[ 0 0 0 ] a z
+[ 0 0 0 ] b z
+[ 0 0 1 ] c z
+[ 0 0 1 ] d z
+[ 0 1 0 ] e z
+[ 0 1 0 ] f z
+[ 0 1 1 ] g z
+[ 0 1 1 ] h z
+[ 0 2 0 ] i z
+[ 0 2 0 ] j z
+[ 0 2 1 ] k z
+[ 0 2 1 ] l z
+[ 1 0 0 ] m z
+[ 1 0 0 ] n z
+[ 1 0 1 ] p z
+[ 1 0 1 ] q z
+[ 1 1 0 ] r z
+[ 1 1 0 ] s z
+[ 1 1 1 ] t z
+[ 1 1 1 ] u z
+[ 1 2 0 ] v z
+[ 1 2 0 ] w z
+[ 1 2 1 ] x z
+[ 2 0 0 ] A z
+[ 2 0 0 ] B z
+[ 2 0 1 ] C z
+[ 2 0 1 ] D z
+[ 2 1 0 ] E z
+[ 2 1 0 ] F z
+[ 2 1 1 ] G z
+[ 2 1 1 ] H z
+[ 2 2 0 ] I z
+[ 2 2 0 ] J z
+[ 2 2 1 ] K z
+[ 2 2 1 ] L z
+[ 3 0 0 ] M z
+[ 3 0 0 ] N z
+[ 3 0 1 ] P z
+[ 3 0 1 ] Q z
+[ 3 1 0 ] R z
+[ 3 1 0 ] S z
+[ 3 1 1 ] T z
+[ 3 1 1 ] U z
+[ 3 2 0 ] V z
+[ 3 2 0 ] W z
+[ 3 2 1 ] X z
+[ 3 2 1 ] Z z
+47 differences found
+dataset: </g1/vlen> and </g1/vlen>
+size: [2] [2]
+position vlen vlen difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+[ 1 ] 3 0 3
+3 differences found
+dataset: </g1/vlen2D> and </g1/vlen2D>
+size: [3x2] [3x2]
+position vlen2D vlen2D difference
+------------------------------------------------------------
+[ 0 1 ] 1 0 1
+[ 1 0 ] 2 0 2
+[ 1 0 ] 3 0 3
+[ 1 1 ] 4 0 4
+[ 1 1 ] 5 0 5
+[ 2 0 ] 6 0 6
+[ 2 0 ] 7 0 7
+[ 2 0 ] 8 0 8
+[ 2 1 ] 9 0 9
+[ 2 1 ] 10 0 10
+[ 2 1 ] 11 0 11
+11 differences found
+dataset: </g1/vlen3D> and </g1/vlen3D>
+size: [4x3x2] [4x3x2]
+position vlen3D vlen3D difference
+------------------------------------------------------------
+[ 0 0 1 ] 1 0 1
+[ 0 1 0 ] 2 0 2
+[ 0 1 1 ] 3 0 3
+[ 0 2 0 ] 4 0 4
+[ 0 2 1 ] 5 0 5
+[ 1 0 0 ] 6 0 6
+[ 1 0 0 ] 7 0 7
+[ 1 0 1 ] 8 0 8
+[ 1 0 1 ] 9 0 9
+[ 1 1 0 ] 10 0 10
+[ 1 1 0 ] 11 0 11
+[ 1 1 1 ] 12 0 12
+[ 1 1 1 ] 13 0 13
+[ 1 2 0 ] 14 0 14
+[ 1 2 0 ] 15 0 15
+[ 1 2 1 ] 16 0 16
+[ 1 2 1 ] 17 0 17
+[ 2 0 0 ] 18 0 18
+[ 2 0 0 ] 19 0 19
+[ 2 0 0 ] 20 0 20
+[ 2 0 1 ] 21 0 21
+[ 2 0 1 ] 22 0 22
+[ 2 0 1 ] 23 0 23
+[ 2 1 0 ] 24 0 24
+[ 2 1 0 ] 25 0 25
+[ 2 1 0 ] 26 0 26
+[ 2 1 1 ] 27 0 27
+[ 2 1 1 ] 28 0 28
+[ 2 1 1 ] 29 0 29
+[ 2 2 0 ] 30 0 30
+[ 2 2 0 ] 31 0 31
+[ 2 2 0 ] 32 0 32
+[ 2 2 1 ] 33 0 33
+[ 2 2 1 ] 34 0 34
+[ 2 2 1 ] 35 0 35
+[ 3 0 0 ] 36 0 36
+[ 3 0 0 ] 37 0 37
+[ 3 0 0 ] 38 0 38
+[ 3 0 0 ] 39 0 39
+[ 3 0 1 ] 40 0 40
+[ 3 0 1 ] 41 0 41
+[ 3 0 1 ] 42 0 42
+[ 3 0 1 ] 43 0 43
+[ 3 1 0 ] 44 0 44
+[ 3 1 0 ] 45 0 45
+[ 3 1 0 ] 46 0 46
+[ 3 1 0 ] 47 0 47
+[ 3 1 1 ] 48 0 48
+[ 3 1 1 ] 49 0 49
+[ 3 1 1 ] 50 0 50
+[ 3 1 1 ] 51 0 51
+[ 3 2 0 ] 52 0 52
+[ 3 2 0 ] 53 0 53
+[ 3 2 0 ] 54 0 54
+[ 3 2 0 ] 55 0 55
+[ 3 2 1 ] 56 0 56
+[ 3 2 1 ] 57 0 57
+[ 3 2 1 ] 58 0 58
+[ 3 2 1 ] 59 0 59
+59 differences found
+dataset: </refreg> and </refreg>
+Referenced dataset 10720 10720
+------------------------------------------------------------
+Region blocks
+block #0 (2,2)-(7,7) (0,0)-(2,2)
+Region points
+point #1 (2,2) (3,3)
+point #3 (1,6) (2,5)
+point #4 (2,8) (1,7)
+4 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/test/h5diff/testfiles/h5diff_90.txt b/tools/test/h5diff/testfiles/h5diff_90.txt
new file mode 100644
index 0000000..9965ab0
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_90.txt
@@ -0,0 +1,50 @@
+
+file1 file2
+---------------------------------------
+ x x /
+ x x /g1
+ x x /g1/dset1
+ x x /g1/dset2
+ x x /g1/dset4
+ x x /g2
+ x x /g2/dset1
+ x x /g2/dset2
+ x x /g2/dset3
+ x x /g2/dset4
+ x x /g2/dset5
+ x x /g2/dset6
+ x x /g2/dset7
+ x x /g2/dset8
+ x x /g2/dset9
+
+group : </> and </>
+0 differences found
+group : </g1> and </g1>
+0 differences found
+dataset: </g1/dset1> and </g1/dset1>
+0 differences found
+dataset: </g1/dset2> and </g1/dset2>
+0 differences found
+dataset: </g1/dset4> and </g1/dset4>
+0 differences found
+group : </g2> and </g2>
+0 differences found
+dataset: </g2/dset1> and </g2/dset1>
+0 differences found
+dataset: </g2/dset2> and </g2/dset2>
+0 differences found
+dataset: </g2/dset3> and </g2/dset3>
+0 differences found
+dataset: </g2/dset4> and </g2/dset4>
+0 differences found
+dataset: </g2/dset5> and </g2/dset5>
+0 differences found
+dataset: </g2/dset6> and </g2/dset6>
+0 differences found
+dataset: </g2/dset7> and </g2/dset7>
+0 differences found
+dataset: </g2/dset8> and </g2/dset8>
+0 differences found
+dataset: </g2/dset9> and </g2/dset9>
+0 differences found
+EXIT CODE: 0
diff --git a/tools/test/h5diff/testfiles/h5diff_attr1.h5 b/tools/test/h5diff/testfiles/h5diff_attr1.h5
new file mode 100644
index 0000000..c44066b
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_attr1.h5
Binary files differ
diff --git a/tools/test/h5diff/testfiles/h5diff_attr2.h5 b/tools/test/h5diff/testfiles/h5diff_attr2.h5
new file mode 100644
index 0000000..5de3303
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_attr2.h5
Binary files differ
diff --git a/tools/test/h5diff/testfiles/h5diff_attr_v_level1.h5 b/tools/test/h5diff/testfiles/h5diff_attr_v_level1.h5
new file mode 100644
index 0000000..2b1d8a1
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_attr_v_level1.h5
Binary files differ
diff --git a/tools/test/h5diff/testfiles/h5diff_attr_v_level2.h5 b/tools/test/h5diff/testfiles/h5diff_attr_v_level2.h5
new file mode 100644
index 0000000..4588fca
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_attr_v_level2.h5
Binary files differ
diff --git a/tools/test/h5diff/testfiles/h5diff_basic1.h5 b/tools/test/h5diff/testfiles/h5diff_basic1.h5
new file mode 100644
index 0000000..e1396be
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_basic1.h5
Binary files differ
diff --git a/tools/test/h5diff/testfiles/h5diff_basic2.h5 b/tools/test/h5diff/testfiles/h5diff_basic2.h5
new file mode 100644
index 0000000..c0795b6
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_basic2.h5
Binary files differ
diff --git a/tools/test/h5diff/testfiles/h5diff_comp_vl_strs.h5 b/tools/test/h5diff/testfiles/h5diff_comp_vl_strs.h5
new file mode 100644
index 0000000..4ad6f19
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_comp_vl_strs.h5
Binary files differ
diff --git a/tools/test/h5diff/testfiles/h5diff_danglelinks1.h5 b/tools/test/h5diff/testfiles/h5diff_danglelinks1.h5
new file mode 100644
index 0000000..b8be9bc
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_danglelinks1.h5
Binary files differ
diff --git a/tools/test/h5diff/testfiles/h5diff_danglelinks2.h5 b/tools/test/h5diff/testfiles/h5diff_danglelinks2.h5
new file mode 100644
index 0000000..3c3907c
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_danglelinks2.h5
Binary files differ
diff --git a/tools/test/h5diff/testfiles/h5diff_dset1.h5 b/tools/test/h5diff/testfiles/h5diff_dset1.h5
new file mode 100644
index 0000000..123e141
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_dset1.h5
Binary files differ
diff --git a/tools/test/h5diff/testfiles/h5diff_dset2.h5 b/tools/test/h5diff/testfiles/h5diff_dset2.h5
new file mode 100644
index 0000000..3ae6993
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_dset2.h5
Binary files differ
diff --git a/tools/test/h5diff/testfiles/h5diff_dset_zero_dim_size1.h5 b/tools/test/h5diff/testfiles/h5diff_dset_zero_dim_size1.h5
new file mode 100644
index 0000000..cdc7644
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_dset_zero_dim_size1.h5
Binary files differ
diff --git a/tools/test/h5diff/testfiles/h5diff_dset_zero_dim_size2.h5 b/tools/test/h5diff/testfiles/h5diff_dset_zero_dim_size2.h5
new file mode 100644
index 0000000..4752ed1
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_dset_zero_dim_size2.h5
Binary files differ
diff --git a/tools/test/h5diff/testfiles/h5diff_dtypes.h5 b/tools/test/h5diff/testfiles/h5diff_dtypes.h5
new file mode 100644
index 0000000..ffa5264
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_dtypes.h5
Binary files differ
diff --git a/tools/test/h5diff/testfiles/h5diff_empty.h5 b/tools/test/h5diff/testfiles/h5diff_empty.h5
new file mode 100644
index 0000000..3f0d1df
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_empty.h5
Binary files differ
diff --git a/tools/test/h5diff/testfiles/h5diff_enum_invalid_values.h5 b/tools/test/h5diff/testfiles/h5diff_enum_invalid_values.h5
new file mode 100644
index 0000000..dd02db9
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_enum_invalid_values.h5
Binary files differ
diff --git a/tools/test/h5diff/testfiles/h5diff_exclude1-1.h5 b/tools/test/h5diff/testfiles/h5diff_exclude1-1.h5
new file mode 100644
index 0000000..8b675ea
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_exclude1-1.h5
Binary files differ
diff --git a/tools/test/h5diff/testfiles/h5diff_exclude1-2.h5 b/tools/test/h5diff/testfiles/h5diff_exclude1-2.h5
new file mode 100644
index 0000000..78854cd
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_exclude1-2.h5
Binary files differ
diff --git a/tools/test/h5diff/testfiles/h5diff_exclude2-1.h5 b/tools/test/h5diff/testfiles/h5diff_exclude2-1.h5
new file mode 100644
index 0000000..8923111
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_exclude2-1.h5
Binary files differ
diff --git a/tools/test/h5diff/testfiles/h5diff_exclude2-2.h5 b/tools/test/h5diff/testfiles/h5diff_exclude2-2.h5
new file mode 100644
index 0000000..9e42007
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_exclude2-2.h5
Binary files differ
diff --git a/tools/test/h5diff/testfiles/h5diff_exclude3-1.h5 b/tools/test/h5diff/testfiles/h5diff_exclude3-1.h5
new file mode 100644
index 0000000..f9cc83d
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_exclude3-1.h5
Binary files differ
diff --git a/tools/test/h5diff/testfiles/h5diff_exclude3-2.h5 b/tools/test/h5diff/testfiles/h5diff_exclude3-2.h5
new file mode 100644
index 0000000..f811905
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_exclude3-2.h5
Binary files differ
diff --git a/tools/test/h5diff/testfiles/h5diff_ext2softlink_src.h5 b/tools/test/h5diff/testfiles/h5diff_ext2softlink_src.h5
new file mode 100644
index 0000000..50b7d2b
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_ext2softlink_src.h5
Binary files differ
diff --git a/tools/test/h5diff/testfiles/h5diff_ext2softlink_trg.h5 b/tools/test/h5diff/testfiles/h5diff_ext2softlink_trg.h5
new file mode 100644
index 0000000..610e890
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_ext2softlink_trg.h5
Binary files differ
diff --git a/tools/test/h5diff/testfiles/h5diff_extlink_src.h5 b/tools/test/h5diff/testfiles/h5diff_extlink_src.h5
new file mode 100644
index 0000000..cfc1066
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_extlink_src.h5
Binary files differ
diff --git a/tools/test/h5diff/testfiles/h5diff_extlink_trg.h5 b/tools/test/h5diff/testfiles/h5diff_extlink_trg.h5
new file mode 100644
index 0000000..3a322c9
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_extlink_trg.h5
Binary files differ
diff --git a/tools/test/h5diff/testfiles/h5diff_grp_recurse1.h5 b/tools/test/h5diff/testfiles/h5diff_grp_recurse1.h5
new file mode 100644
index 0000000..cfd4e62
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_grp_recurse1.h5
Binary files differ
diff --git a/tools/test/h5diff/testfiles/h5diff_grp_recurse2.h5 b/tools/test/h5diff/testfiles/h5diff_grp_recurse2.h5
new file mode 100644
index 0000000..54bcdec
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_grp_recurse2.h5
Binary files differ
diff --git a/tools/test/h5diff/testfiles/h5diff_grp_recurse_ext1.h5 b/tools/test/h5diff/testfiles/h5diff_grp_recurse_ext1.h5
new file mode 100644
index 0000000..12a534a
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_grp_recurse_ext1.h5
Binary files differ
diff --git a/tools/test/h5diff/testfiles/h5diff_grp_recurse_ext2-1.h5 b/tools/test/h5diff/testfiles/h5diff_grp_recurse_ext2-1.h5
new file mode 100644
index 0000000..5bb02df
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_grp_recurse_ext2-1.h5
Binary files differ
diff --git a/tools/test/h5diff/testfiles/h5diff_grp_recurse_ext2-2.h5 b/tools/test/h5diff/testfiles/h5diff_grp_recurse_ext2-2.h5
new file mode 100644
index 0000000..312543e
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_grp_recurse_ext2-2.h5
Binary files differ
diff --git a/tools/test/h5diff/testfiles/h5diff_grp_recurse_ext2-3.h5 b/tools/test/h5diff/testfiles/h5diff_grp_recurse_ext2-3.h5
new file mode 100644
index 0000000..43ad156
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_grp_recurse_ext2-3.h5
Binary files differ
diff --git a/tools/test/h5diff/testfiles/h5diff_hyper1.h5 b/tools/test/h5diff/testfiles/h5diff_hyper1.h5
new file mode 100644
index 0000000..ceeff80
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_hyper1.h5
Binary files differ
diff --git a/tools/test/h5diff/testfiles/h5diff_hyper2.h5 b/tools/test/h5diff/testfiles/h5diff_hyper2.h5
new file mode 100644
index 0000000..05a2eb1
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_hyper2.h5
Binary files differ
diff --git a/tools/test/h5diff/testfiles/h5diff_linked_softlink.h5 b/tools/test/h5diff/testfiles/h5diff_linked_softlink.h5
new file mode 100644
index 0000000..03c5dee
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_linked_softlink.h5
Binary files differ
diff --git a/tools/test/h5diff/testfiles/h5diff_links.h5 b/tools/test/h5diff/testfiles/h5diff_links.h5
new file mode 100644
index 0000000..8af66a6
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_links.h5
Binary files differ
diff --git a/tools/test/h5diff/testfiles/h5diff_softlinks.h5 b/tools/test/h5diff/testfiles/h5diff_softlinks.h5
new file mode 100644
index 0000000..67a843d
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_softlinks.h5
Binary files differ
diff --git a/tools/test/h5diff/testfiles/h5diff_tmp1.txt b/tools/test/h5diff/testfiles/h5diff_tmp1.txt
new file mode 100644
index 0000000..40e3fb6
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_tmp1.txt
@@ -0,0 +1,5 @@
+--------------------------------
+Some objects are not comparable
+--------------------------------
+Use -c for a list of objects.
+EXIT CODE: 0
diff --git a/tools/test/h5diff/testfiles/h5diff_tmp2.txt b/tools/test/h5diff/testfiles/h5diff_tmp2.txt
new file mode 100644
index 0000000..a2d6da6
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_tmp2.txt
@@ -0,0 +1,13 @@
+dataset: </G/down/Data> and </G/down/Data>
+1599 differences found
+dataset: </G/down/Tail/array> and </G/down/Tail/array>
+8 differences found
+dataset: </G/up/Data> and </G/up/Data>
+1845 differences found
+dataset: </G/up/Tail/array> and </G/up/Tail/array>
+10 differences found
+--------------------------------
+Some objects are not comparable
+--------------------------------
+Use -c for a list of objects.
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_types.h5 b/tools/test/h5diff/testfiles/h5diff_types.h5
new file mode 100644
index 0000000..c835069
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_types.h5
Binary files differ
diff --git a/tools/test/h5diff/testfiles/h5diff_v1.txt b/tools/test/h5diff/testfiles/h5diff_v1.txt
new file mode 100644
index 0000000..8210cf9
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_v1.txt
@@ -0,0 +1,18 @@
+
+file1 file2
+---------------------------------------
+ x x /
+ x x /vds_dset
+
+group : </> and </>
+0 differences found
+dataset: </vds_dset> and </vds_dset>
+Warning: </vds_dset> or </vds_dset> is a virtual dataset
+Not comparable: </vds_dset> has rank 3, dimensions [5x18x8], max dimensions [18446744073709551615x18x8]
+and </vds_dset> has rank 3, dimensions [6x8x14], max dimensions [18446744073709551615x8x14]
+0 differences found
+--------------------------------
+Some objects are not comparable
+--------------------------------
+Use -c for a list of objects without details of differences.
+EXIT CODE: 0
diff --git a/tools/test/h5diff/testfiles/h5diff_v2.txt b/tools/test/h5diff/testfiles/h5diff_v2.txt
new file mode 100644
index 0000000..aa327b1
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_v2.txt
@@ -0,0 +1,7 @@
+dataset: </vds_dset> and </vds_dset>
+0 differences found
+--------------------------------
+Some objects are not comparable
+--------------------------------
+Use -c for a list of objects.
+EXIT CODE: 0
diff --git a/tools/test/h5diff/testfiles/h5diff_v3.txt b/tools/test/h5diff/testfiles/h5diff_v3.txt
new file mode 100644
index 0000000..57af303
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_v3.txt
@@ -0,0 +1,4 @@
+Warning: </vds_dset> or </vds_dset> is a virtual dataset
+Not comparable: </vds_dset> has rank 3, dimensions [5x18x8], max dimensions [18446744073709551615x18x8]
+and </vds_dset> has rank 3, dimensions [6x8x14], max dimensions [18446744073709551615x8x14]
+EXIT CODE: 0
diff --git a/tools/test/h5diff/testfiles/non_comparables1.h5 b/tools/test/h5diff/testfiles/non_comparables1.h5
new file mode 100644
index 0000000..7dbb45d
--- /dev/null
+++ b/tools/test/h5diff/testfiles/non_comparables1.h5
Binary files differ
diff --git a/tools/test/h5diff/testfiles/non_comparables2.h5 b/tools/test/h5diff/testfiles/non_comparables2.h5
new file mode 100644
index 0000000..a5e7014
--- /dev/null
+++ b/tools/test/h5diff/testfiles/non_comparables2.h5
Binary files differ
diff --git a/tools/test/h5diff/testfiles/tmpSingleSiteBethe.output.h5 b/tools/test/h5diff/testfiles/tmpSingleSiteBethe.output.h5
new file mode 100644
index 0000000..bbcfb63
--- /dev/null
+++ b/tools/test/h5diff/testfiles/tmpSingleSiteBethe.output.h5
Binary files differ
diff --git a/tools/test/h5diff/testfiles/tmpSingleSiteBethe.reference.h5 b/tools/test/h5diff/testfiles/tmpSingleSiteBethe.reference.h5
new file mode 100644
index 0000000..6b19ed7
--- /dev/null
+++ b/tools/test/h5diff/testfiles/tmpSingleSiteBethe.reference.h5
Binary files differ
diff --git a/tools/test/h5diff/testfiles/tmptest.he5 b/tools/test/h5diff/testfiles/tmptest.he5
new file mode 100644
index 0000000..edcfcd2
--- /dev/null
+++ b/tools/test/h5diff/testfiles/tmptest.he5
Binary files differ
diff --git a/tools/test/h5diff/testfiles/tmptest2.he5 b/tools/test/h5diff/testfiles/tmptest2.he5
new file mode 100644
index 0000000..a6ab02b
--- /dev/null
+++ b/tools/test/h5diff/testfiles/tmptest2.he5
Binary files differ
diff --git a/tools/test/h5diff/testh5diff.sh.in b/tools/test/h5diff/testh5diff.sh.in
new file mode 100644
index 0000000..8eae4c3
--- /dev/null
+++ b/tools/test/h5diff/testh5diff.sh.in
@@ -0,0 +1,1160 @@
+#! /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 h5diff tool
+#
+# Modification:
+# Albert Cheng, 2005/08/17
+# Added the SKIP feature.
+# Albert Cheng, 2005/2/3
+# Added -p option for parallel h5diff tests.
+# Pedro Vicente Nunes:
+# 10/25/2005: Added test #9
+# 11/27/2006: Added test #10, #11
+# Jonathan Kim:
+# Improved to use single line
+# Improved to check exit code (only serial mode, not necessary for parallel)
+# Added test 400 - 425 (links with --follow-symlinks option)
+# Added test 450 - 459 (dangling links)
+
+srcdir=@srcdir@
+
+TESTNAME=h5diff
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+
+H5DIFF=../../src/h5diff/h5diff # The tool name
+H5DIFF_BIN=`pwd`/$H5DIFF # The path of the tool binary
+
+RM='rm -rf'
+CMP='cmp -s'
+DIFF='diff -c'
+CP='cp'
+DIRNAME='dirname'
+LS='ls'
+AWK='awk'
+
+nerrors=0
+verbose=yes
+h5haveexitcode=yes # default is yes
+pmode= # default to run h5diff tests
+mydomainname=`domainname 2>/dev/null`
+
+# 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/test/h5diff/testfiles"
+SRC_H5COPY_TESTFILES="$SRC_TOOLS/test/h5copy/testfiles"
+SRC_H5REPACK_TESTFILES="$SRC_TOOLS/test/h5repack/testfiles"
+SRC_H5JAM_TESTFILES="$SRC_TOOLS/test/h5jam/testfiles"
+SRC_H5STAT_TESTFILES="$SRC_TOOLS/test/h5stat/testfiles"
+SRC_H5IMPORT_TESTFILES="$SRC_TOOLS/test/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_H5DIFF_TESTFILES/h5diff_basic1.h5
+$SRC_H5DIFF_TESTFILES/h5diff_basic2.h5
+$SRC_H5DIFF_TESTFILES/h5diff_types.h5
+$SRC_H5DIFF_TESTFILES/h5diff_dtypes.h5
+$SRC_H5DIFF_TESTFILES/h5diff_attr1.h5
+$SRC_H5DIFF_TESTFILES/h5diff_attr2.h5
+$SRC_H5DIFF_TESTFILES/h5diff_dset1.h5
+$SRC_H5DIFF_TESTFILES/h5diff_dset2.h5
+$SRC_H5DIFF_TESTFILES/h5diff_hyper1.h5
+$SRC_H5DIFF_TESTFILES/h5diff_hyper2.h5
+$SRC_H5DIFF_TESTFILES/h5diff_empty.h5
+$SRC_H5DIFF_TESTFILES/h5diff_links.h5
+$SRC_H5DIFF_TESTFILES/h5diff_softlinks.h5
+$SRC_H5DIFF_TESTFILES/h5diff_linked_softlink.h5
+$SRC_H5DIFF_TESTFILES/h5diff_extlink_src.h5
+$SRC_H5DIFF_TESTFILES/h5diff_extlink_trg.h5
+$SRC_H5DIFF_TESTFILES/h5diff_ext2softlink_src.h5
+$SRC_H5DIFF_TESTFILES/h5diff_ext2softlink_trg.h5
+$SRC_H5DIFF_TESTFILES/h5diff_dset_zero_dim_size1.h5
+$SRC_H5DIFF_TESTFILES/h5diff_dset_zero_dim_size2.h5
+$SRC_H5DIFF_TESTFILES/h5diff_danglelinks1.h5
+$SRC_H5DIFF_TESTFILES/h5diff_danglelinks2.h5
+$SRC_H5DIFF_TESTFILES/h5diff_grp_recurse1.h5
+$SRC_H5DIFF_TESTFILES/h5diff_grp_recurse2.h5
+$SRC_H5DIFF_TESTFILES/h5diff_grp_recurse_ext1.h5
+$SRC_H5DIFF_TESTFILES/h5diff_grp_recurse_ext2-1.h5
+$SRC_H5DIFF_TESTFILES/h5diff_grp_recurse_ext2-2.h5
+$SRC_H5DIFF_TESTFILES/h5diff_grp_recurse_ext2-3.h5
+$SRC_H5DIFF_TESTFILES/h5diff_exclude1-1.h5
+$SRC_H5DIFF_TESTFILES/h5diff_exclude1-2.h5
+$SRC_H5DIFF_TESTFILES/h5diff_exclude2-1.h5
+$SRC_H5DIFF_TESTFILES/h5diff_exclude2-2.h5
+$SRC_H5DIFF_TESTFILES/h5diff_exclude3-1.h5
+$SRC_H5DIFF_TESTFILES/h5diff_exclude3-2.h5
+$SRC_H5DIFF_TESTFILES/h5diff_comp_vl_strs.h5
+$SRC_H5DIFF_TESTFILES/compounds_array_vlen1.h5
+$SRC_H5DIFF_TESTFILES/compounds_array_vlen2.h5
+$SRC_H5DIFF_TESTFILES/h5diff_attr_v_level1.h5
+$SRC_H5DIFF_TESTFILES/h5diff_attr_v_level2.h5
+$SRC_H5DIFF_TESTFILES/h5diff_enum_invalid_values.h5
+$SRC_H5DIFF_TESTFILES/non_comparables1.h5
+$SRC_H5DIFF_TESTFILES/non_comparables2.h5
+$SRC_H5DIFF_TESTFILES/tmptest.he5
+$SRC_H5DIFF_TESTFILES/tmptest2.he5
+$SRC_H5DIFF_TESTFILES/tmpSingleSiteBethe.reference.h5
+$SRC_H5DIFF_TESTFILES/tmpSingleSiteBethe.output.h5
+$SRC_TOOLS_TESTFILES/vds/1_a.h5
+$SRC_TOOLS_TESTFILES/vds/1_b.h5
+$SRC_TOOLS_TESTFILES/vds/1_c.h5
+$SRC_TOOLS_TESTFILES/vds/1_d.h5
+$SRC_TOOLS_TESTFILES/vds/1_e.h5
+$SRC_TOOLS_TESTFILES/vds/1_f.h5
+$SRC_TOOLS_TESTFILES/vds/1_vds.h5
+$SRC_TOOLS_TESTFILES/vds/2_a.h5
+$SRC_TOOLS_TESTFILES/vds/2_b.h5
+$SRC_TOOLS_TESTFILES/vds/2_c.h5
+$SRC_TOOLS_TESTFILES/vds/2_d.h5
+$SRC_TOOLS_TESTFILES/vds/2_e.h5
+$SRC_TOOLS_TESTFILES/vds/2_vds.h5
+$SRC_TOOLS_TESTFILES/vds/3_1_vds.h5
+$SRC_TOOLS_TESTFILES/vds/3_2_vds.h5
+$SRC_TOOLS_TESTFILES/vds/4_0.h5
+$SRC_TOOLS_TESTFILES/vds/4_1.h5
+$SRC_TOOLS_TESTFILES/vds/4_2.h5
+$SRC_TOOLS_TESTFILES/vds/4_vds.h5
+$SRC_TOOLS_TESTFILES/vds/5_a.h5
+$SRC_TOOLS_TESTFILES/vds/5_b.h5
+$SRC_TOOLS_TESTFILES/vds/5_c.h5
+$SRC_TOOLS_TESTFILES/vds/5_vds.h5
+"
+
+LIST_OTHER_TEST_FILES="
+$SRC_H5DIFF_TESTFILES/h5diff_10.txt
+$SRC_H5DIFF_TESTFILES/h5diff_100.txt
+$SRC_H5DIFF_TESTFILES/h5diff_101.txt
+$SRC_H5DIFF_TESTFILES/h5diff_102.txt
+$SRC_H5DIFF_TESTFILES/h5diff_103.txt
+$SRC_H5DIFF_TESTFILES/h5diff_104.txt
+$SRC_H5DIFF_TESTFILES/h5diff_11.txt
+$SRC_H5DIFF_TESTFILES/h5diff_12.txt
+$SRC_H5DIFF_TESTFILES/h5diff_13.txt
+$SRC_H5DIFF_TESTFILES/h5diff_14.txt
+$SRC_H5DIFF_TESTFILES/h5diff_15.txt
+$SRC_H5DIFF_TESTFILES/h5diff_16_1.txt
+$SRC_H5DIFF_TESTFILES/h5diff_16_2.txt
+$SRC_H5DIFF_TESTFILES/h5diff_16_3.txt
+$SRC_H5DIFF_TESTFILES/h5diff_17.txt
+$SRC_H5DIFF_TESTFILES/h5diff_171.txt
+$SRC_H5DIFF_TESTFILES/h5diff_172.txt
+$SRC_H5DIFF_TESTFILES/h5diff_18_1.txt
+$SRC_H5DIFF_TESTFILES/h5diff_18.txt
+$SRC_H5DIFF_TESTFILES/h5diff_20.txt
+$SRC_H5DIFF_TESTFILES/h5diff_200.txt
+$SRC_H5DIFF_TESTFILES/h5diff_201.txt
+$SRC_H5DIFF_TESTFILES/h5diff_202.txt
+$SRC_H5DIFF_TESTFILES/h5diff_203.txt
+$SRC_H5DIFF_TESTFILES/h5diff_204.txt
+$SRC_H5DIFF_TESTFILES/h5diff_205.txt
+$SRC_H5DIFF_TESTFILES/h5diff_206.txt
+$SRC_H5DIFF_TESTFILES/h5diff_207.txt
+$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
+$SRC_H5DIFF_TESTFILES/h5diff_24.txt
+$SRC_H5DIFF_TESTFILES/h5diff_25.txt
+$SRC_H5DIFF_TESTFILES/h5diff_26.txt
+$SRC_H5DIFF_TESTFILES/h5diff_27.txt
+$SRC_H5DIFF_TESTFILES/h5diff_28.txt
+$SRC_H5DIFF_TESTFILES/h5diff_30.txt
+$SRC_H5DIFF_TESTFILES/h5diff_300.txt
+$SRC_H5DIFF_TESTFILES/h5diff_400.txt
+$SRC_H5DIFF_TESTFILES/h5diff_401.txt
+$SRC_H5DIFF_TESTFILES/h5diff_402.txt
+$SRC_H5DIFF_TESTFILES/h5diff_403.txt
+$SRC_H5DIFF_TESTFILES/h5diff_404.txt
+$SRC_H5DIFF_TESTFILES/h5diff_405.txt
+$SRC_H5DIFF_TESTFILES/h5diff_406.txt
+$SRC_H5DIFF_TESTFILES/h5diff_407.txt
+$SRC_H5DIFF_TESTFILES/h5diff_408.txt
+$SRC_H5DIFF_TESTFILES/h5diff_409.txt
+$SRC_H5DIFF_TESTFILES/h5diff_410.txt
+$SRC_H5DIFF_TESTFILES/h5diff_411.txt
+$SRC_H5DIFF_TESTFILES/h5diff_412.txt
+$SRC_H5DIFF_TESTFILES/h5diff_413.txt
+$SRC_H5DIFF_TESTFILES/h5diff_414.txt
+$SRC_H5DIFF_TESTFILES/h5diff_415.txt
+$SRC_H5DIFF_TESTFILES/h5diff_416.txt
+$SRC_H5DIFF_TESTFILES/h5diff_417.txt
+$SRC_H5DIFF_TESTFILES/h5diff_418.txt
+$SRC_H5DIFF_TESTFILES/h5diff_419.txt
+$SRC_H5DIFF_TESTFILES/h5diff_420.txt
+$SRC_H5DIFF_TESTFILES/h5diff_421.txt
+$SRC_H5DIFF_TESTFILES/h5diff_422.txt
+$SRC_H5DIFF_TESTFILES/h5diff_423.txt
+$SRC_H5DIFF_TESTFILES/h5diff_424.txt
+$SRC_H5DIFF_TESTFILES/h5diff_425.txt
+$SRC_H5DIFF_TESTFILES/h5diff_450.txt
+$SRC_H5DIFF_TESTFILES/h5diff_451.txt
+$SRC_H5DIFF_TESTFILES/h5diff_452.txt
+$SRC_H5DIFF_TESTFILES/h5diff_453.txt
+$SRC_H5DIFF_TESTFILES/h5diff_454.txt
+$SRC_H5DIFF_TESTFILES/h5diff_455.txt
+$SRC_H5DIFF_TESTFILES/h5diff_456.txt
+$SRC_H5DIFF_TESTFILES/h5diff_457.txt
+$SRC_H5DIFF_TESTFILES/h5diff_458.txt
+$SRC_H5DIFF_TESTFILES/h5diff_459.txt
+$SRC_H5DIFF_TESTFILES/h5diff_465.txt
+$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
+$SRC_H5DIFF_TESTFILES/h5diff_53.txt
+$SRC_H5DIFF_TESTFILES/h5diff_54.txt
+$SRC_H5DIFF_TESTFILES/h5diff_55.txt
+$SRC_H5DIFF_TESTFILES/h5diff_56.txt
+$SRC_H5DIFF_TESTFILES/h5diff_57.txt
+$SRC_H5DIFF_TESTFILES/h5diff_58.txt
+$SRC_H5DIFF_TESTFILES/h5diff_59.txt
+$SRC_H5DIFF_TESTFILES/h5diff_500.txt
+$SRC_H5DIFF_TESTFILES/h5diff_501.txt
+$SRC_H5DIFF_TESTFILES/h5diff_502.txt
+$SRC_H5DIFF_TESTFILES/h5diff_503.txt
+$SRC_H5DIFF_TESTFILES/h5diff_504.txt
+$SRC_H5DIFF_TESTFILES/h5diff_505.txt
+$SRC_H5DIFF_TESTFILES/h5diff_506.txt
+$SRC_H5DIFF_TESTFILES/h5diff_507.txt
+$SRC_H5DIFF_TESTFILES/h5diff_508.txt
+$SRC_H5DIFF_TESTFILES/h5diff_509.txt
+$SRC_H5DIFF_TESTFILES/h5diff_510.txt
+$SRC_H5DIFF_TESTFILES/h5diff_511.txt
+$SRC_H5DIFF_TESTFILES/h5diff_512.txt
+$SRC_H5DIFF_TESTFILES/h5diff_513.txt
+$SRC_H5DIFF_TESTFILES/h5diff_514.txt
+$SRC_H5DIFF_TESTFILES/h5diff_515.txt
+$SRC_H5DIFF_TESTFILES/h5diff_516.txt
+$SRC_H5DIFF_TESTFILES/h5diff_517.txt
+$SRC_H5DIFF_TESTFILES/h5diff_518.txt
+$SRC_H5DIFF_TESTFILES/h5diff_530.txt
+$SRC_H5DIFF_TESTFILES/h5diff_540.txt
+$SRC_H5DIFF_TESTFILES/h5diff_600.txt
+$SRC_H5DIFF_TESTFILES/h5diff_601.txt
+$SRC_H5DIFF_TESTFILES/h5diff_603.txt
+$SRC_H5DIFF_TESTFILES/h5diff_604.txt
+$SRC_H5DIFF_TESTFILES/h5diff_605.txt
+$SRC_H5DIFF_TESTFILES/h5diff_606.txt
+$SRC_H5DIFF_TESTFILES/h5diff_607.txt
+$SRC_H5DIFF_TESTFILES/h5diff_608.txt
+$SRC_H5DIFF_TESTFILES/h5diff_609.txt
+$SRC_H5DIFF_TESTFILES/h5diff_610.txt
+$SRC_H5DIFF_TESTFILES/h5diff_612.txt
+$SRC_H5DIFF_TESTFILES/h5diff_613.txt
+$SRC_H5DIFF_TESTFILES/h5diff_614.txt
+$SRC_H5DIFF_TESTFILES/h5diff_615.txt
+$SRC_H5DIFF_TESTFILES/h5diff_616.txt
+$SRC_H5DIFF_TESTFILES/h5diff_617.txt
+$SRC_H5DIFF_TESTFILES/h5diff_618.txt
+$SRC_H5DIFF_TESTFILES/h5diff_619.txt
+$SRC_H5DIFF_TESTFILES/h5diff_621.txt
+$SRC_H5DIFF_TESTFILES/h5diff_622.txt
+$SRC_H5DIFF_TESTFILES/h5diff_623.txt
+$SRC_H5DIFF_TESTFILES/h5diff_624.txt
+$SRC_H5DIFF_TESTFILES/h5diff_625.txt
+$SRC_H5DIFF_TESTFILES/h5diff_626.txt
+$SRC_H5DIFF_TESTFILES/h5diff_627.txt
+$SRC_H5DIFF_TESTFILES/h5diff_628.txt
+$SRC_H5DIFF_TESTFILES/h5diff_629.txt
+$SRC_H5DIFF_TESTFILES/h5diff_630.txt
+$SRC_H5DIFF_TESTFILES/h5diff_631.txt
+$SRC_H5DIFF_TESTFILES/h5diff_640.txt
+$SRC_H5DIFF_TESTFILES/h5diff_641.txt
+$SRC_H5DIFF_TESTFILES/h5diff_642.txt
+$SRC_H5DIFF_TESTFILES/h5diff_643.txt
+$SRC_H5DIFF_TESTFILES/h5diff_644.txt
+$SRC_H5DIFF_TESTFILES/h5diff_645.txt
+$SRC_H5DIFF_TESTFILES/h5diff_646.txt
+$SRC_H5DIFF_TESTFILES/h5diff_70.txt
+$SRC_H5DIFF_TESTFILES/h5diff_700.txt
+$SRC_H5DIFF_TESTFILES/h5diff_701.txt
+$SRC_H5DIFF_TESTFILES/h5diff_702.txt
+$SRC_H5DIFF_TESTFILES/h5diff_703.txt
+$SRC_H5DIFF_TESTFILES/h5diff_704.txt
+$SRC_H5DIFF_TESTFILES/h5diff_705.txt
+$SRC_H5DIFF_TESTFILES/h5diff_706.txt
+$SRC_H5DIFF_TESTFILES/h5diff_707.txt
+$SRC_H5DIFF_TESTFILES/h5diff_708.txt
+$SRC_H5DIFF_TESTFILES/h5diff_709.txt
+$SRC_H5DIFF_TESTFILES/h5diff_710.txt
+$SRC_H5DIFF_TESTFILES/h5diff_80.txt
+$SRC_H5DIFF_TESTFILES/h5diff_90.txt
+$SRC_H5DIFF_TESTFILES/h5diff_tmp1.txt
+$SRC_H5DIFF_TESTFILES/h5diff_tmp2.txt
+$SRC_H5DIFF_TESTFILES/h5diff_v1.txt
+$SRC_H5DIFF_TESTFILES/h5diff_v2.txt
+$SRC_H5DIFF_TESTFILES/h5diff_v3.txt
+"
+
+#
+# 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
+ # skip cp if srcdir is same as destdir
+ # this occurs when build/test performed in source dir and
+ # make cp fail
+ SDIR=`$DIRNAME $tstfile`
+ INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
+ INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
+ if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
+ $CP -f $tstfile $TESTDIR
+ if [ $? -ne 0 ]; then
+ echo "Error: FAILED to copy $tstfile ."
+
+ # Comment out this to CREATE expected file
+ exit $EXIT_FAILURE
+ fi
+ fi
+ fi
+ done
+}
+
+CLEAN_TESTFILES_AND_TESTDIR()
+{
+ # skip rm if srcdir is same as destdir
+ # this occurs when build/test performed in source dir and
+ # make cp fail
+ SDIR=$SRC_H5DIFF_TESTFILES
+ INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
+ INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
+ if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
+ $RM $TESTDIR
+ fi
+}
+
+# Parse option
+# -p run ph5diff tests
+# -h print help page
+while [ $# -gt 0 ]; do
+ case "$1" in
+ -p) # reset the tool name and bin to run ph5diff tests
+ TESTNAME=ph5diff
+ H5DIFF=ph5diff # The tool name
+ H5DIFF_BIN=`pwd`/$H5DIFF
+ pmode=yes
+ shift
+ ;;
+ -h) # print help page
+ echo "$0 [-p] [-h]"
+ echo " -p run ph5diff tests"
+ echo " -h print help page"
+ shift
+ exit 0
+ ;;
+ *) # unknown option
+ echo "$0: Unknown option ($1)"
+ exit 1
+ ;;
+ esac
+done
+
+# RUNSERIAL is used. Check if it can return exit code from executalbe correctly.
+if [ -n "$RUNSERIAL_NOEXITCODE" ]; then
+ echo "***Warning*** Serial Exit Code is not passed back to shell corretly."
+ echo "***Warning*** Exit code checking is skipped."
+ h5haveexitcode=no
+fi
+
+# 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.
+#
+# Need eval before the RUNCMD command because some machines like
+# AIX, has RUNPARALLEL in the style as
+# MP_PROCS=3 MP_TASKS_PER_NODE=3 poe ./a.out
+# that throws the shell script off.
+#
+TOOLTEST() {
+ expect="$TESTDIR/$1"
+ actual="$TESTDIR/`basename $1 .txt`.out"
+ actual_err="$TESTDIR/`basename $1 .txt`.err"
+ actual_sav=${actual}-sav
+ actual_err_sav=${actual_err}-sav
+ shift
+ if test -n "$pmode"; then
+ RUNCMD=$RUNPARALLEL
+ else
+ RUNCMD=$RUNSERIAL
+ fi
+
+ # Run test.
+ TESTING $H5DIFF $@
+ (
+ #echo "#############################"
+ #echo "Expected output for '$H5DIFF $@'"
+ #echo "#############################"
+ cd $TESTDIR
+ eval $RUNCMD $H5DIFF_BIN "$@"
+ ) >$actual 2>$actual_err
+ EXIT_CODE=$?
+ # save actual and actual_err in case they are needed later.
+ cp $actual $actual_sav
+ STDOUT_FILTER $actual
+ cp $actual_err $actual_err_sav
+ STDERR_FILTER $actual_err
+ cat $actual_err >> $actual
+ # don't add exit code check in pmode, as it causes failure. (exit code
+ # is from mpirun not tool)
+ # if any problem occurs relate to an exit code, it will be caught in
+ # serial mode, so the test is fullfilled.
+ if test $h5haveexitcode = 'yes' -a -z "$pmode"; then
+ echo "EXIT CODE: $EXIT_CODE" >> $actual
+ fi
+
+ 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"
+ elif test $h5haveexitcode = 'yes' -a -z "$pmode"; then
+ echo "*FAILED*"
+ echo " Expected result ($expect) differs from actual result ($actual)"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /'
+ else
+ # parallel mode output are often of different ordering from serial
+ # output. If the sorted expected and actual files compare the same,
+ # it is safe to assume the actual output match the expected file.
+ expect_sorted=expect_sorted
+ actual_sorted=actual_sorted
+ sort $expect -o $expect_sorted
+ sort $actual -o $actual_sorted
+ # remove "EXIT CODE:" line from expect file. test for exit code
+ # is done by serial mode.
+ grep -v "EXIT CODE:" $expect_sorted > $expect_sorted.noexit
+ mv $expect_sorted.noexit $expect_sorted
+ if $CMP $expect_sorted $actual_sorted; then
+ echo " PASSED"
+ else
+ echo "*FAILED*"
+ nerrors="`expr $nerrors + 1`"
+ if test yes = "$verbose"; then
+ echo "====Expected result ($expect_sorted) differs from actual result ($actual_sorted)"
+ $DIFF $expect_sorted $actual_sorted |sed 's/^/ /'
+ echo "====The actual output ($actual_sav)"
+ sed 's/^/ /' < $actual_sav
+ echo "====The actual stderr ($actual_err_sav)"
+ sed 's/^/ /' < $actual_err_sav
+ echo "====End of actual stderr ($actual_err_sav)"
+ echo ""
+ fi
+ fi
+ fi
+
+ # Clean up output file
+ if test -z "$HDF5_NOCLEANUP"; then
+ rm -f $actual $actual_err $actual_sav $actual_err_sav
+ rm -f $actual_sorted $expect_sorted
+ fi
+}
+
+
+# Print a "SKIP" message
+SKIP() {
+ TESTING $H5DIFF $@
+ echo " -SKIP-"
+}
+
+
+
+##############################################################################
+# The tests
+# To avoid the printing of the complete full path of the test file, that hides
+# all the other parameters for long paths, the printing of the command line
+# is done first in
+# TESTING with the name only of the test file $TOOL, not its full path $TESTFILE
+##############################################################################
+# prepare for test
+COPY_TESTFILES_TO_TESTDIR
+
+# ############################################################################
+# # Common usage
+# ############################################################################
+
+# 1.0
+TOOLTEST h5diff_10.txt -h
+
+# 1.1 normal mode
+TOOLTEST h5diff_11.txt h5diff_basic1.h5 h5diff_basic2.h5
+
+# 1.2 normal mode with objects
+TOOLTEST h5diff_12.txt h5diff_basic1.h5 h5diff_basic2.h5 g1/dset1 g1/dset2
+
+# 1.3 report mode
+TOOLTEST h5diff_13.txt -r h5diff_basic1.h5 h5diff_basic2.h5
+
+# 1.4 report mode with objects
+TOOLTEST h5diff_14.txt -r h5diff_basic1.h5 h5diff_basic2.h5 g1/dset1 g1/dset2
+
+# 1.5 with -d
+TOOLTEST h5diff_15.txt --report --delta=5 h5diff_basic1.h5 h5diff_basic2.h5 g1/dset3 g1/dset4
+
+# 1.6.1 with -p (int)
+TOOLTEST h5diff_16_1.txt -v -p 0.02 h5diff_basic1.h5 h5diff_basic1.h5 g1/dset5 g1/dset6
+
+# 1.6.2 with -p (unsigned long_long)
+TOOLTEST h5diff_16_2.txt --verbose --relative=0.02 h5diff_basic1.h5 h5diff_basic1.h5 g1/dset7 g1/dset8
+
+# 1.6.3 with -p (double)
+TOOLTEST h5diff_16_3.txt -v -p 0.02 h5diff_basic1.h5 h5diff_basic1.h5 g1/dset9 g1/dset10
+
+# 1.7 verbose mode
+TOOLTEST h5diff_17.txt -v h5diff_basic1.h5 h5diff_basic2.h5
+
+# 1.7 test 32-bit INFINITY
+TOOLTEST h5diff_171.txt -v h5diff_basic1.h5 h5diff_basic1.h5 /g1/fp19 /g1/fp19_COPY
+
+# 1.7 test 64-bit INFINITY
+TOOLTEST h5diff_172.txt -v h5diff_basic1.h5 h5diff_basic1.h5 /g1/fp20 /g1/fp20_COPY
+
+# 1.8 quiet mode
+TOOLTEST h5diff_18.txt -q h5diff_basic1.h5 h5diff_basic2.h5
+
+# 1.8 -v and -q
+TOOLTEST h5diff_18_1.txt -v -q h5diff_basic1.h5 h5diff_basic2.h5
+
+
+# ##############################################################################
+# # not comparable types
+# ##############################################################################
+
+# 2.0
+TOOLTEST h5diff_20.txt -v h5diff_types.h5 h5diff_types.h5 dset g1
+
+# 2.1
+TOOLTEST h5diff_21.txt -v h5diff_types.h5 h5diff_types.h5 dset l1
+
+# 2.2
+TOOLTEST h5diff_22.txt -v h5diff_types.h5 h5diff_types.h5 dset t1
+
+# ##############################################################################
+# # compare groups, types, links (no differences and differences)
+# ##############################################################################
+
+# 2.3
+TOOLTEST h5diff_23.txt -v h5diff_types.h5 h5diff_types.h5 g1 g1
+
+# 2.4
+TOOLTEST h5diff_24.txt -v h5diff_types.h5 h5diff_types.h5 t1 t1
+
+# 2.5
+TOOLTEST h5diff_25.txt -v h5diff_types.h5 h5diff_types.h5 l1 l1
+
+# 2.6
+TOOLTEST h5diff_26.txt -v h5diff_types.h5 h5diff_types.h5 g1 g2
+
+# 2.7
+TOOLTEST h5diff_27.txt -v h5diff_types.h5 h5diff_types.h5 t1 t2
+
+# 2.8
+TOOLTEST h5diff_28.txt -v h5diff_types.h5 h5diff_types.h5 l1 l2
+
+
+# ##############################################################################
+# # Enum value tests (may become more comprehensive in the future)
+# ##############################################################################
+
+# 3.0
+# test enum types which may have invalid values
+TOOLTEST h5diff_30.txt -v h5diff_enum_invalid_values.h5 h5diff_enum_invalid_values.h5 dset1 dset2
+
+
+
+
+# ##############################################################################
+# # Dataset datatypes
+# ##############################################################################
+
+# 5.0
+TOOLTEST h5diff_50.txt -v h5diff_dtypes.h5 h5diff_dtypes.h5 dset0a dset0b
+
+# 5.1
+TOOLTEST h5diff_51.txt -v h5diff_dtypes.h5 h5diff_dtypes.h5 dset1a dset1b
+
+# 5.2
+TOOLTEST h5diff_52.txt -v h5diff_dtypes.h5 h5diff_dtypes.h5 dset2a dset2b
+
+# 5.3
+TOOLTEST h5diff_53.txt -v h5diff_dtypes.h5 h5diff_dtypes.h5 dset3a dset4b
+
+# 5.4
+TOOLTEST h5diff_54.txt -v h5diff_dtypes.h5 h5diff_dtypes.h5 dset4a dset4b
+
+# 5.5
+TOOLTEST h5diff_55.txt -v h5diff_dtypes.h5 h5diff_dtypes.h5 dset5a dset5b
+
+# 5.6
+TOOLTEST h5diff_56.txt -v h5diff_dtypes.h5 h5diff_dtypes.h5 dset6a dset6b
+
+# 5.7
+TOOLTEST h5diff_57.txt -v h5diff_dtypes.h5 h5diff_dtypes.h5 dset7a dset7b
+
+# 5.8 (region reference)
+TOOLTEST h5diff_58.txt -v h5diff_dset1.h5 h5diff_dset2.h5 refreg
+
+# test for both dset and attr with same type but with different size
+# ( HDDFV-7942 )
+TOOLTEST h5diff_59.txt -v h5diff_dtypes.h5 h5diff_dtypes.h5 dset11a dset11b
+
+# ##############################################################################
+# # Error messages
+# ##############################################################################
+
+
+# 6.0: Check if the command line number of arguments is less than 3
+TOOLTEST h5diff_600.txt h5diff_basic1.h5
+
+# 6.1: Check if non-exist object name is specified
+TOOLTEST h5diff_601.txt h5diff_basic1.h5 h5diff_basic1.h5 nono_obj
+
+
+# ##############################################################################
+# # -d
+# ##############################################################################
+
+
+# 6.3: negative value
+TOOLTEST h5diff_603.txt -d -4 h5diff_basic1.h5 h5diff_basic2.h5 g1/dset3 g1/dset4
+
+# 6.4: zero
+TOOLTEST h5diff_604.txt -d 0 h5diff_basic1.h5 h5diff_basic2.h5 g1/dset3 g1/dset4
+
+# 6.5: non number
+TOOLTEST h5diff_605.txt -d u h5diff_basic1.h5 h5diff_basic2.h5 g1/dset3 g1/dset4
+
+# 6.6: hexadecimal
+TOOLTEST h5diff_606.txt -d 0x1 h5diff_basic1.h5 h5diff_basic2.h5 g1/dset3 g1/dset4
+
+# 6.7: string
+TOOLTEST h5diff_607.txt -d "1" h5diff_basic1.h5 h5diff_basic2.h5 g1/dset3 g1/dset4
+
+# 6.8: use system epsilon
+TOOLTEST h5diff_608.txt --use-system-epsilon h5diff_basic1.h5 h5diff_basic2.h5 g1/dset3 g1/dset4
+
+# 6.9: number larger than biggest difference
+TOOLTEST h5diff_609.txt -d 200 h5diff_basic1.h5 h5diff_basic2.h5 g1/dset3 g1/dset4
+
+# 6.10: number smaller than smallest difference
+TOOLTEST h5diff_610.txt -d 1 h5diff_basic1.h5 h5diff_basic2.h5 g1/dset3 g1/dset4
+
+
+# ##############################################################################
+# # -p
+# ##############################################################################
+
+
+# 6.12: negative value
+TOOLTEST h5diff_612.txt -p -4 h5diff_basic1.h5 h5diff_basic2.h5 g1/dset3 g1/dset4
+
+# 6.13: zero
+TOOLTEST h5diff_613.txt -p 0 h5diff_basic1.h5 h5diff_basic2.h5 g1/dset3 g1/dset4
+
+# 6.14: non number
+TOOLTEST h5diff_614.txt -p u h5diff_basic1.h5 h5diff_basic2.h5 g1/dset3 g1/dset4
+
+# 6.15: hexadecimal
+TOOLTEST h5diff_615.txt -p 0x1 h5diff_basic1.h5 h5diff_basic2.h5 g1/dset3 g1/dset4
+
+# 6.16: string
+TOOLTEST h5diff_616.txt -p "0.21" h5diff_basic1.h5 h5diff_basic2.h5 g1/dset3 g1/dset4
+
+# 6.17: repeated option
+TOOLTEST h5diff_617.txt -p 0.21 -p 0.22 h5diff_basic1.h5 h5diff_basic2.h5 g1/dset3 g1/dset4
+
+# 6.18: number larger than biggest difference
+TOOLTEST h5diff_618.txt -p 2 h5diff_basic1.h5 h5diff_basic2.h5 g1/dset3 g1/dset4
+
+# 6.19: number smaller than smallest difference
+TOOLTEST h5diff_619.txt -p 0.005 h5diff_basic1.h5 h5diff_basic2.h5 g1/dset3 g1/dset4
+
+
+
+# ##############################################################################
+# # -n
+# ##############################################################################
+
+# 6.21: negative value
+TOOLTEST h5diff_621.txt -n -4 h5diff_basic1.h5 h5diff_basic2.h5 g1/dset3 g1/dset4
+
+# 6.22: zero
+TOOLTEST h5diff_622.txt -n 0 h5diff_basic1.h5 h5diff_basic2.h5 g1/dset3 g1/dset4
+
+# 6.23: non number
+TOOLTEST h5diff_623.txt -n u h5diff_basic1.h5 h5diff_basic2.h5 g1/dset3 g1/dset4
+
+# 6.24: hexadecimal
+TOOLTEST h5diff_624.txt -n 0x1 h5diff_basic1.h5 h5diff_basic2.h5 g1/dset3 g1/dset4
+
+# 6.25: string
+TOOLTEST h5diff_625.txt -n "2" h5diff_basic1.h5 h5diff_basic2.h5 g1/dset3 g1/dset4
+
+# 6.26: repeated option
+TOOLTEST h5diff_626.txt -n 2 -n 3 h5diff_basic1.h5 h5diff_basic2.h5 g1/dset3 g1/dset4
+
+# 6.27: number larger than biggest difference
+TOOLTEST h5diff_627.txt --count=200 h5diff_basic1.h5 h5diff_basic2.h5 g1/dset3 g1/dset4
+
+# 6.28: number smaller than smallest difference
+TOOLTEST h5diff_628.txt -n 1 h5diff_basic1.h5 h5diff_basic2.h5 g1/dset3 g1/dset4
+
+# Disabling this test as it hangs - LRK 20090618
+# 6.29 non valid files
+#TOOLTEST h5diff_629.txt file1.h6 file2.h6
+
+# ##############################################################################
+# # NaN
+# ##############################################################################
+# 6.30: test (NaN == NaN) must be true based on our documentation -- XCAO
+TOOLTEST h5diff_630.txt -v -d "0.0001" h5diff_basic1.h5 h5diff_basic1.h5 g1/fp18 g1/fp18_COPY
+TOOLTEST h5diff_631.txt -v --use-system-epsilon h5diff_basic1.h5 h5diff_basic1.h5 g1/fp18 g1/fp18_COPY
+
+
+# ##############################################################################
+# 7. attributes
+# ##############################################################################
+TOOLTEST h5diff_70.txt -v h5diff_attr1.h5 h5diff_attr2.h5
+# temporary test to verify HDF5-8625
+TOOLTEST h5diff_tmp1.txt tmptest2.he5 tmptest.he5
+# temporary test to verify HDF5-8639
+TOOLTEST h5diff_tmp2.txt tmpSingleSiteBethe.output.h5 tmpSingleSiteBethe.reference.h5
+
+# ##################################################
+# attrs with verbose option level
+# ##################################################
+
+TOOLTEST h5diff_700.txt -v1 h5diff_attr1.h5 h5diff_attr2.h5
+TOOLTEST h5diff_701.txt -v2 h5diff_attr1.h5 h5diff_attr2.h5
+TOOLTEST h5diff_702.txt --verbose=1 h5diff_attr1.h5 h5diff_attr2.h5
+TOOLTEST h5diff_703.txt --verbose=2 h5diff_attr1.h5 h5diff_attr2.h5
+
+# same attr number , all same attr name
+TOOLTEST h5diff_704.txt -v2 h5diff_attr_v_level1.h5 h5diff_attr_v_level2.h5 /g
+
+# same attr number , some same attr name
+TOOLTEST h5diff_705.txt -v2 h5diff_attr_v_level1.h5 h5diff_attr_v_level2.h5 /dset
+
+# same attr number , all different attr name
+TOOLTEST h5diff_706.txt -v2 h5diff_attr_v_level1.h5 h5diff_attr_v_level2.h5 /ntype
+
+# different attr number , same attr name (intersected)
+TOOLTEST h5diff_707.txt -v2 h5diff_attr_v_level1.h5 h5diff_attr_v_level2.h5 /g2
+
+# different attr number , all different attr name
+TOOLTEST h5diff_708.txt -v2 h5diff_attr_v_level1.h5 h5diff_attr_v_level2.h5 /g3
+
+# when no attributes exist in both objects
+TOOLTEST h5diff_709.txt -v2 h5diff_attr_v_level1.h5 h5diff_attr_v_level2.h5 /g4
+
+# file vs file
+TOOLTEST h5diff_710.txt -v2 h5diff_attr_v_level1.h5 h5diff_attr_v_level2.h5
+
+# ##############################################################################
+# 8. all dataset datatypes
+# ##############################################################################
+TOOLTEST h5diff_80.txt -v h5diff_dset1.h5 h5diff_dset2.h5
+
+# 9. compare a file with itself
+TOOLTEST h5diff_90.txt -v h5diff_basic2.h5 h5diff_basic2.h5
+
+# 10. read by hyperslab, print indexes
+TOOLTEST h5diff_100.txt -v h5diff_hyper1.h5 h5diff_hyper2.h5
+
+# 11. floating point comparison
+# double value
+TOOLTEST h5diff_101.txt -v h5diff_basic1.h5 h5diff_basic1.h5 g1/d1 g1/d2
+
+# float value
+TOOLTEST h5diff_102.txt -v h5diff_basic1.h5 h5diff_basic1.h5 g1/fp1 g1/fp2
+
+# with --use-system-epsilon for double value
+TOOLTEST h5diff_103.txt -v --use-system-epsilon h5diff_basic1.h5 h5diff_basic1.h5 g1/d1 g1/d2
+
+# with --use-system-epsilon for float value
+TOOLTEST h5diff_104.txt -v --use-system-epsilon h5diff_basic1.h5 h5diff_basic1.h5 g1/fp1 g1/fp2
+
+
+# not comparable -c flag
+TOOLTEST h5diff_200.txt h5diff_basic2.h5 h5diff_basic2.h5 g2/dset1 g2/dset2
+
+TOOLTEST h5diff_201.txt -c h5diff_basic2.h5 h5diff_basic2.h5 g2/dset1 g2/dset2
+
+TOOLTEST h5diff_202.txt -c h5diff_basic2.h5 h5diff_basic2.h5 g2/dset2 g2/dset3
+
+TOOLTEST h5diff_203.txt -c h5diff_basic2.h5 h5diff_basic2.h5 g2/dset3 g2/dset4
+
+TOOLTEST h5diff_204.txt -c h5diff_basic2.h5 h5diff_basic2.h5 g2/dset4 g2/dset5
+
+TOOLTEST h5diff_205.txt -c h5diff_basic2.h5 h5diff_basic2.h5 g2/dset5 g2/dset6
+
+# not comparable in compound
+TOOLTEST h5diff_206.txt -c h5diff_basic2.h5 h5diff_basic2.h5 g2/dset7 g2/dset8
+
+TOOLTEST h5diff_207.txt -c h5diff_basic2.h5 h5diff_basic2.h5 g2/dset8 g2/dset9
+
+# not comparable in dataspace of zero dimension size
+TOOLTEST h5diff_208.txt -c h5diff_dset_zero_dim_size1.h5 h5diff_dset_zero_dim_size2.h5
+
+# non-comparable dataset with comparable attribute, and other comparable datasets.
+# Also test non-compatible attributes with different type, dimention, rank.
+# All the comparables should display differences.
+TOOLTEST h5diff_220.txt -c non_comparables1.h5 non_comparables2.h5 /g1
+
+# comparable dataset with non-comparable attribute and other comparable attributes.
+# All the comparables should display differences.
+TOOLTEST h5diff_221.txt -c non_comparables1.h5 non_comparables2.h5 /g2
+
+# entire file
+# All the comparables should display differences.
+TOOLTEST h5diff_222.txt -c non_comparables1.h5 non_comparables2.h5
+
+# 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
+# ##############################################################################
+# test for bug1749
+TOOLTEST h5diff_300.txt -v h5diff_links.h5 h5diff_links.h5 /link_g1 /link_g2
+
+# ##############################################################################
+# # Links compare with --follow-symlinks Only
+# ##############################################################################
+# soft links file to file
+TOOLTEST h5diff_400.txt --follow-symlinks -v h5diff_softlinks.h5 h5diff_softlinks.h5
+
+# softlink vs dset"
+TOOLTEST h5diff_401.txt --follow-symlinks -v h5diff_softlinks.h5 h5diff_softlinks.h5 /softlink_dset1_1 /target_dset2
+
+# dset vs softlink"
+TOOLTEST h5diff_402.txt --follow-symlinks -v h5diff_softlinks.h5 h5diff_softlinks.h5 /target_dset2 /softlink_dset1_1
+
+# softlink vs softlink"
+TOOLTEST h5diff_403.txt --follow-symlinks -v h5diff_softlinks.h5 h5diff_softlinks.h5 /softlink_dset1_1 /softlink_dset2
+
+# extlink vs extlink (FILE)"
+TOOLTEST h5diff_404.txt --follow-symlinks -v h5diff_extlink_src.h5 h5diff_extlink_src.h5
+
+# extlink vs dset"
+TOOLTEST h5diff_405.txt --follow-symlinks -v h5diff_extlink_src.h5 h5diff_extlink_trg.h5 /ext_link_dset1 /target_group2/x_dset
+
+# dset vs extlink"
+TOOLTEST h5diff_406.txt --follow-symlinks -v h5diff_extlink_trg.h5 h5diff_extlink_src.h5 /target_group2/x_dset /ext_link_dset1
+
+# extlink vs extlink"
+TOOLTEST h5diff_407.txt --follow-symlinks -v h5diff_extlink_src.h5 h5diff_extlink_src.h5 /ext_link_dset1 /ext_link_dset2
+
+# softlink vs extlink"
+TOOLTEST h5diff_408.txt --follow-symlinks -v h5diff_softlinks.h5 h5diff_extlink_src.h5 /softlink_dset1_1 /ext_link_dset2
+
+# extlink vs softlink "
+TOOLTEST h5diff_409.txt --follow-symlinks -v h5diff_extlink_src.h5 h5diff_softlinks.h5 /ext_link_dset2 /softlink_dset1_1
+
+# linked_softlink vs linked_softlink (FILE)"
+TOOLTEST h5diff_410.txt --follow-symlinks -v h5diff_linked_softlink.h5 h5diff_linked_softlink.h5
+
+# dset2 vs linked_softlink_dset1"
+TOOLTEST h5diff_411.txt --follow-symlinks -v h5diff_linked_softlink.h5 h5diff_linked_softlink.h5 /target_dset2 /softlink1_to_slink2
+
+# linked_softlink_dset1 vs dset2"
+TOOLTEST h5diff_412.txt --follow-symlinks -v h5diff_linked_softlink.h5 h5diff_linked_softlink.h5 /softlink1_to_slink2 /target_dset2
+
+# linked_softlink_to_dset1 vs linked_softlink_to_dset2"
+TOOLTEST h5diff_413.txt --follow-symlinks -v h5diff_linked_softlink.h5 h5diff_linked_softlink.h5 /softlink1_to_slink2 /softlink2_to_slink2
+
+# group vs linked_softlink_group1"
+TOOLTEST h5diff_414.txt --follow-symlinks -v h5diff_linked_softlink.h5 h5diff_linked_softlink.h5 /target_group /softlink3_to_slink2
+
+# linked_softlink_group1 vs group"
+TOOLTEST h5diff_415.txt --follow-symlinks -v h5diff_linked_softlink.h5 h5diff_linked_softlink.h5 /softlink3_to_slink2 /target_group
+
+# linked_softlink_to_group1 vs linked_softlink_to_group2"
+TOOLTEST h5diff_416.txt --follow-symlinks -v h5diff_linked_softlink.h5 h5diff_linked_softlink.h5 /softlink3_to_slink2 /softlink4_to_slink2
+
+# non-exist-softlink vs softlink"
+TOOLTEST h5diff_417.txt --follow-symlinks -v h5diff_softlinks.h5 h5diff_softlinks.h5 /softlink_noexist /softlink_dset2
+
+# softlink vs non-exist-softlink"
+TOOLTEST h5diff_418.txt --follow-symlinks -v h5diff_softlinks.h5 h5diff_softlinks.h5 /softlink_dset2 /softlink_noexist
+
+# non-exist-extlink_file vs extlink"
+TOOLTEST h5diff_419.txt --follow-symlinks -v h5diff_extlink_src.h5 h5diff_extlink_src.h5 /ext_link_noexist2 /ext_link_dset2
+
+# exlink vs non-exist-extlink_file"
+TOOLTEST h5diff_420.txt --follow-symlinks -v h5diff_extlink_src.h5 h5diff_extlink_src.h5 /ext_link_dset2 /ext_link_noexist2
+
+# extlink vs non-exist-extlink_obj"
+TOOLTEST h5diff_421.txt --follow-symlinks -v h5diff_extlink_src.h5 h5diff_extlink_src.h5 /ext_link_dset2 /ext_link_noexist1
+
+# non-exist-extlink_obj vs extlink"
+TOOLTEST h5diff_422.txt --follow-symlinks -v h5diff_extlink_src.h5 h5diff_extlink_src.h5 /ext_link_noexist1 /ext_link_dset2
+
+# extlink_to_softlink_to_dset1 vs dset2"
+TOOLTEST h5diff_423.txt --follow-symlinks -v h5diff_ext2softlink_src.h5 h5diff_ext2softlink_trg.h5 /ext_link_to_slink1 /dset2
+
+# dset2 vs extlink_to_softlink_to_dset1"
+TOOLTEST h5diff_424.txt --follow-symlinks -v h5diff_ext2softlink_trg.h5 h5diff_ext2softlink_src.h5 /dset2 /ext_link_to_slink1
+
+# extlink_to_softlink_to_dset1 vs extlink_to_softlink_to_dset2"
+TOOLTEST h5diff_425.txt --follow-symlinks -v h5diff_ext2softlink_src.h5 h5diff_ext2softlink_src.h5 /ext_link_to_slink1 /ext_link_to_slink2
+
+
+# ##############################################################################
+# # Dangling links compare (--follow-symlinks and --no-dangling-links)
+# ##############################################################################
+# dangling links --follow-symlinks (FILE to FILE)
+TOOLTEST h5diff_450.txt --follow-symlinks -v h5diff_danglelinks1.h5 h5diff_danglelinks2.h5
+
+# dangling links --follow-symlinks and --no-dangling-links (FILE to FILE)
+TOOLTEST h5diff_451.txt --follow-symlinks -v --no-dangling-links h5diff_danglelinks1.h5 h5diff_danglelinks2.h5
+
+# try --no-dangling-links without --follow-symlinks options
+TOOLTEST h5diff_452.txt --no-dangling-links h5diff_softlinks.h5 h5diff_softlinks.h5
+
+# dangling link found for soft links (FILE to FILE)
+TOOLTEST h5diff_453.txt --follow-symlinks -v --no-dangling-links h5diff_softlinks.h5 h5diff_softlinks.h5
+
+# dangling link found for soft links (obj to obj)
+TOOLTEST h5diff_454.txt --follow-symlinks -v --no-dangling-links h5diff_softlinks.h5 h5diff_softlinks.h5 /softlink_dset2 /softlink_noexist
+
+# dangling link found for soft links (obj to obj) Both dangle links
+TOOLTEST h5diff_455.txt --follow-symlinks -v --no-dangling-links h5diff_softlinks.h5 h5diff_softlinks.h5 /softlink_noexist /softlink_noexist
+
+# dangling link found for ext links (FILE to FILE)
+TOOLTEST h5diff_456.txt --follow-symlinks -v --no-dangling-links h5diff_extlink_src.h5 h5diff_extlink_src.h5
+
+# dangling link found for ext links (obj to obj). target file exist
+TOOLTEST h5diff_457.txt --follow-symlinks -v --no-dangling-links h5diff_extlink_src.h5 h5diff_extlink_src.h5 /ext_link_dset1 /ext_link_noexist1
+
+# dangling link found for ext links (obj to obj). target file NOT exist
+TOOLTEST h5diff_458.txt --follow-symlinks -v --no-dangling-links h5diff_extlink_src.h5 h5diff_extlink_src.h5 /ext_link_dset1 /ext_link_noexist2
+
+# dangling link found for ext links (obj to obj). Both dangle links
+TOOLTEST h5diff_459.txt --follow-symlinks -v --no-dangling-links h5diff_extlink_src.h5 h5diff_extlink_src.h5 /ext_link_noexist1 /ext_link_noexist2
+
+# dangling link --follow-symlinks (obj vs obj)
+# (HDFFV-7836)
+TOOLTEST h5diff_465.txt --follow-symlinks h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /soft_link1
+# (HDFFV-7835)
+# soft dangling vs. soft dangling
+TOOLTEST h5diff_466.txt -v --follow-symlinks h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /soft_link1
+# soft link vs. soft dangling
+TOOLTEST h5diff_467.txt -v --follow-symlinks h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /soft_link2
+# ext dangling vs. ext dangling
+TOOLTEST h5diff_468.txt -v --follow-symlinks h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /ext_link4
+# 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
+# ##############################################################################
+# root
+TOOLTEST h5diff_500.txt -v h5diff_grp_recurse1.h5 h5diff_grp_recurse2.h5 / /
+TOOLTEST h5diff_501.txt -v --follow-symlinks h5diff_grp_recurse1.h5 h5diff_grp_recurse2.h5 / /
+
+# root vs group
+TOOLTEST h5diff_502.txt -v h5diff_grp_recurse1.h5 h5diff_grp_recurse2.h5 / /grp1/grp2/grp3
+
+# group vs group (same name and structure)
+TOOLTEST h5diff_503.txt -v h5diff_grp_recurse1.h5 h5diff_grp_recurse2.h5 /grp1 /grp1
+
+# group vs group (different name and structure)
+TOOLTEST h5diff_504.txt -v h5diff_grp_recurse1.h5 h5diff_grp_recurse2.h5 /grp1/grp2 /grp1/grp2/grp3
+
+# groups vs soft-link
+TOOLTEST h5diff_505.txt -v h5diff_grp_recurse1.h5 h5diff_grp_recurse2.h5 /grp1 /slink_grp1
+TOOLTEST h5diff_506.txt -v --follow-symlinks h5diff_grp_recurse1.h5 h5diff_grp_recurse2.h5 /grp1/grp2 /slink_grp2
+
+# groups vs ext-link
+TOOLTEST h5diff_507.txt -v h5diff_grp_recurse1.h5 h5diff_grp_recurse2.h5 /grp1 /elink_grp1
+TOOLTEST h5diff_508.txt -v --follow-symlinks h5diff_grp_recurse1.h5 h5diff_grp_recurse2.h5 /grp1 /elink_grp1
+
+# soft-link vs ext-link
+TOOLTEST h5diff_509.txt -v h5diff_grp_recurse1.h5 h5diff_grp_recurse2.h5 /slink_grp1 /elink_grp1
+TOOLTEST h5diff_510.txt -v --follow-symlinks h5diff_grp_recurse1.h5 h5diff_grp_recurse2.h5 /slink_grp1 /elink_grp1
+
+# circled ext links
+TOOLTEST h5diff_511.txt -v h5diff_grp_recurse1.h5 h5diff_grp_recurse2.h5 /grp10 /grp11
+TOOLTEST h5diff_512.txt -v --follow-symlinks h5diff_grp_recurse1.h5 h5diff_grp_recurse2.h5 /grp10 /grp11
+
+# circled soft2ext-link vs soft2ext-link
+TOOLTEST h5diff_513.txt -v h5diff_grp_recurse1.h5 h5diff_grp_recurse2.h5 /slink_grp10 /slink_grp11
+TOOLTEST h5diff_514.txt -v --follow-symlinks h5diff_grp_recurse1.h5 h5diff_grp_recurse2.h5 /slink_grp10 /slink_grp11
+
+###############################################################################
+# Test for group recursive diff via multi-linked external links
+# With follow-symlinks, file h5diff_grp_recurse_ext1.h5 and h5diff_grp_recurse_ext2-1.h5 should
+# be same with the external links.
+###############################################################################
+# file vs file
+TOOLTEST h5diff_515.txt -v h5diff_grp_recurse_ext1.h5 h5diff_grp_recurse_ext2-1.h5
+TOOLTEST h5diff_516.txt -v --follow-symlinks h5diff_grp_recurse_ext1.h5 h5diff_grp_recurse_ext2-1.h5
+# group vs group
+TOOLTEST h5diff_517.txt -v h5diff_grp_recurse_ext1.h5 h5diff_grp_recurse_ext2-1.h5 /g1
+TOOLTEST h5diff_518.txt -v --follow-symlinks h5diff_grp_recurse_ext1.h5 h5diff_grp_recurse_ext2-1.h5 /g1
+
+# ##############################################################################
+# # Exclude objects (--exclude-path)
+# ##############################################################################
+#
+# Same structure, same names and different value.
+#
+# Exclude the object with different value. Expect return - same
+TOOLTEST h5diff_480.txt -v --exclude-path /group1/dset3 h5diff_exclude1-1.h5 h5diff_exclude1-2.h5
+# Verify different by not excluding. Expect return - diff
+TOOLTEST h5diff_481.txt -v h5diff_exclude1-1.h5 h5diff_exclude1-2.h5
+
+#
+# Different structure, different names.
+#
+# Exclude all the different objects. Expect return - same
+TOOLTEST h5diff_482.txt -v --exclude-path "/group1" --exclude-path "/dset1" h5diff_exclude2-1.h5 h5diff_exclude2-2.h5
+# Exclude only some different objects. Expect return - diff
+TOOLTEST h5diff_483.txt -v --exclude-path "/group1" h5diff_exclude2-1.h5 h5diff_exclude2-2.h5
+
+# Exclude from group compare
+TOOLTEST h5diff_484.txt -v --exclude-path "/dset3" h5diff_exclude1-1.h5 h5diff_exclude1-2.h5 /group1
+
+#
+# Only one file contains unique objs. Common objs are same.
+# (HDFFV-7837)
+#
+TOOLTEST h5diff_485.txt -v --exclude-path "/group1" h5diff_exclude3-1.h5 h5diff_exclude3-2.h5
+TOOLTEST h5diff_486.txt -v --exclude-path "/group1" h5diff_exclude3-2.h5 h5diff_exclude3-1.h5
+TOOLTEST h5diff_487.txt -v --exclude-path "/group1/dset" h5diff_exclude3-1.h5 h5diff_exclude3-2.h5
+
+
+# ##############################################################################
+# # diff various multiple vlen and fixed strings in a compound type dataset
+# ##############################################################################
+TOOLTEST h5diff_530.txt -v h5diff_comp_vl_strs.h5 h5diff_comp_vl_strs.h5 /group /group_copy
+
+# ##############################################################################
+# # Test container types (array,vlen) with multiple nested compound types
+# # Complex compound types in dataset and attribute
+# ##############################################################################
+TOOLTEST h5diff_540.txt -v compounds_array_vlen1.h5 compounds_array_vlen2.h5
+
+# ##############################################################################
+# # Test mutually exclusive options
+# ##############################################################################
+# Test with -d , -p and --use-system-epsilon.
+TOOLTEST h5diff_640.txt -v -d 5 -p 0.05 --use-system-epsilon h5diff_basic1.h5 h5diff_basic2.h5 /g1/dset3 /g1/dset4
+TOOLTEST h5diff_641.txt -v -d 5 -p 0.05 h5diff_basic1.h5 h5diff_basic2.h5 /g1/dset3 /g1/dset4
+TOOLTEST h5diff_642.txt -v -p 0.05 -d 5 h5diff_basic1.h5 h5diff_basic2.h5 /g1/dset3 /g1/dset4
+TOOLTEST h5diff_643.txt -v -d 5 --use-system-epsilon h5diff_basic1.h5 h5diff_basic2.h5 /g1/dset3 /g1/dset4
+TOOLTEST h5diff_644.txt -v --use-system-epsilon -d 5 h5diff_basic1.h5 h5diff_basic2.h5 /g1/dset3 /g1/dset4
+TOOLTEST h5diff_645.txt -v -p 0.05 --use-system-epsilon h5diff_basic1.h5 h5diff_basic2.h5 /g1/dset3 /g1/dset4
+TOOLTEST h5diff_646.txt -v --use-system-epsilon -p 0.05 h5diff_basic1.h5 h5diff_basic2.h5 /g1/dset3 /g1/dset4
+
+# ##############################################################################
+# VDS tests
+# ##############################################################################
+TOOLTEST h5diff_v1.txt -v 1_vds.h5 2_vds.h5
+TOOLTEST h5diff_v2.txt -r 1_vds.h5 2_vds.h5
+TOOLTEST h5diff_v3.txt -c 1_vds.h5 2_vds.h5
+
+
+# ##############################################################################
+# # END
+# ##############################################################################
+
+# Clean up temporary files/directories
+CLEAN_TESTFILES_AND_TESTDIR
+
+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/test/h5diff/testph5diff.sh.in b/tools/test/h5diff/testph5diff.sh.in
new file mode 100644
index 0000000..ca212a1
--- /dev/null
+++ b/tools/test/h5diff/testph5diff.sh.in
@@ -0,0 +1,64 @@
+#! /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.
+#
+
+srcdir=@srcdir@
+
+TESTNAME=ph5diff
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+
+TOOL=testh5diff.sh
+
+nerrors=0
+
+# 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'
+}
+
+# Run a test. If a test fails then increment the `nerrors' global variable.
+#
+TOOLTEST() {
+ # Run test.
+ echo $TOOL "$@"
+ /bin/sh $TOOL "$@"
+
+ # Check if the command failed and increment nerrors if so.
+ if test $? -ne 0 ; then
+ nerrors="`expr $nerrors + 1`"
+ fi
+}
+
+##############################################################################
+##############################################################################
+### T H E T E S T S ###
+##############################################################################
+##############################################################################
+
+# Invoke the regular h5diff testing script, with the -p parameter to indicate
+# that it should run the parallel version of the tests
+TOOLTEST -p
+
+# no need to print any message since this is just a shell to invoke
+# testh5diff.sh which has already printed the result. Just exit.
+if test $nerrors -eq 0 ; then
+ exit $EXIT_SUCCESS
+else
+ exit $EXIT_FAILURE
+fi
diff --git a/tools/test/h5dump/CMakeLists.txt b/tools/test/h5dump/CMakeLists.txt
new file mode 100644
index 0000000..1398aca
--- /dev/null
+++ b/tools/test/h5dump/CMakeLists.txt
@@ -0,0 +1,28 @@
+cmake_minimum_required (VERSION 3.1.0)
+PROJECT (HDF5_TOOLS_TEST_H5DUMP)
+
+#-----------------------------------------------------------------------------
+# Setup include Directories
+#-----------------------------------------------------------------------------
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib)
+
+ # --------------------------------------------------------------------
+ # Add the h5dump test executable
+ # --------------------------------------------------------------------
+ if (HDF5_BUILD_GENERATORS)
+ add_executable (h5dumpgentest ${HDF5_TOOLS_TEST_H5DUMP_SOURCE_DIR}/h5dumpgentest.c)
+ TARGET_NAMING (h5dumpgentest STATIC)
+ TARGET_C_PROPERTIES (h5dumpgentest STATIC " " " ")
+ target_link_libraries (h5dumpgentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+ set_target_properties (h5dumpgentest PROPERTIES FOLDER generator/tools)
+
+ #add_test (NAME h5dumpgentest COMMAND $<TARGET_FILE:h5dumpgentest>)
+ endif (HDF5_BUILD_GENERATORS)
+
+ include (CMakeTests.cmake)
+
+ include (CMakeTestsPBITS.cmake)
+
+ include (CMakeTestsVDS.cmake)
+
+ include (CMakeTestsXML.cmake)
diff --git a/tools/test/h5dump/CMakeTests.cmake b/tools/test/h5dump/CMakeTests.cmake
new file mode 100644
index 0000000..dad3a8b
--- /dev/null
+++ b/tools/test/h5dump/CMakeTests.cmake
@@ -0,0 +1,1412 @@
+
+##############################################################################
+##############################################################################
+### T E S T I N G ###
+##############################################################################
+##############################################################################
+
+ # --------------------------------------------------------------------
+ # Copy all the HDF5 files from the test directory into the source directory
+ # --------------------------------------------------------------------
+ set (HDF5_REFERENCE_FILES
+ ${HDF5_TOOLS_DIR}/testfiles/charsets.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/file_space.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/filter_fail.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/non_existing.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/packedbits.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tall-1.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tall-2.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tall-2A.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tall-2A0.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tall-2B.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tall-3.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tall-4s.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tall-5s.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tall-6.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tall-7.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tall-7N.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tallfilters.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tarray1.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tarray1_big.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tarray2.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tarray3.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tarray4.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tarray5.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tarray6.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tarray7.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tarray8.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tattr-1.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tattr-2.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tattr-3.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tattr-4_be.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tattrcontents1.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tattrcontents2.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tattrintsize.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tattrreg.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tattrregR.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tbin1.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tbin1.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tbin2.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tbin3.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tbin4.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tbinregR.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tbigdims.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tbitnopaque.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tboot1.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tboot2.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tboot2A.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tboot2B.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tchar1.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tchunked.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tcmpdattrintsize.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tcmpdintarray.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tcmpdints.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tcmpdintsize.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tcompound_complex2.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tcomp-1.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tcomp-2.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tcomp-3.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tcomp-4.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tcompact.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tcontents.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tcontiguos.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tdatareg.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tdataregR.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tdeflate.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tdset-1.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tdset-2.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tdset-3s.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tempty.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/texceedsubstart.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/texceedsubcount.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/texceedsubstride.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/texceedsubblock.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/texternal.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/textlinksrc.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/textlinkfar.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/textlink.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tfamily.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tfill.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tfletcher32.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tfpformat.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tgroup-1.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tgroup-2.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tgrp_comments.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/thlink-1.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/thlink-2.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/thlink-3.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/thlink-4.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/thlink-5.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/thyperslab.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tindicesno.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tindicessub1.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tindicessub2.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tindicessub3.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tindicessub4.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tindicesyes.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tints4dims.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tints4dimsBlock2.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tints4dimsBlockEq.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tints4dimsCount2.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tints4dimsCountEq.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tints4dimsStride2.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tintsattrs.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tlarge_objname.ddl
+ #${HDF5_TOOLS_DIR}/testfiles/tldouble.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tlonglinks.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tloop-1.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tmulti.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tmultifile.ddl
+ #${HDF5_TOOLS_DIR}/testfiles/tqmarkfile.ddl
+ #${HDF5_TOOLS_DIR}/testfiles/tstarfile.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tnamed_dtype_attr.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tnestcomp-1.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tnestedcmpddt.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tnbit.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tnoattrdata.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tnoattrddl.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tnodata.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tnoddl.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tnoddlfile.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tno-subset.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tnullspace.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tordergr1.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tordergr2.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tordergr3.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tordergr4.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tordergr5.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/torderattr1.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/torderattr2.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/torderattr3.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/torderattr4.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tordercontents1.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tordercontents2.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/torderlinks1.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/torderlinks2.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tperror.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/trawdatafile.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/trawssetfile.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/treadfilter.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/treadintfilter.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/treference.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tsaf.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tscalarattrintsize.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tscalarintattrsize.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tscalarintsize.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tscalarstring.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tscaleoffset.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tshuffle.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tslink-1.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tslink-2.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tslink-D.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tsplit_file.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tstr-1.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tstr-2.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tstring.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tstring2.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tstringe.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tszip.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tudlink-1.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tudlink-2.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tuserfilter.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tvldtypes1.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tvldtypes2.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tvldtypes3.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tvldtypes4.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tvldtypes5.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tvlenstr_array.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tvlstr.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tvms.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/twidedisplay.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/twithddlfile.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/h5dump-help.txt
+ ${HDF5_TOOLS_DIR}/testfiles/out3.h5import
+ ${HDF5_TOOLS_DIR}/testfiles/zerodim.ddl
+ )
+ set (HDF5_REFERENCE_EXP_FILES
+ tall-6.exp
+ tnoddlfile.exp
+ trawdatafile.exp
+ trawssetfile.exp
+ tstr2bin2.exp
+ tstr2bin6.exp
+ twithddl.exp
+ twithddlfile.exp
+ )
+ set (HDF5_REFERENCE_TEST_FILES
+ ${HDF5_TOOLS_DIR}/testfiles/charsets.h5
+ ${HDF5_TOOLS_DIR}/testfiles/file_space.h5
+ ${HDF5_TOOLS_DIR}/testfiles/filter_fail.h5
+ ${HDF5_TOOLS_DIR}/testfiles/packedbits.h5
+ ${HDF5_TOOLS_DIR}/testfiles/taindices.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tall.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tarray1.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tarray1_big.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tarray2.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tarray3.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tarray4.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tarray5.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tarray6.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tarray7.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tarray8.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tattr.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tattr2.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tattr4_be.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tattrintsize.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tattrreg.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tbigdims.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tbinary.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tbitnopaque.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tchar.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tcmpdattrintsize.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tcmpdintarray.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tcmpdints.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tcmpdintsize.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tcompound.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tcompound_complex.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tcompound_complex2.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tdatareg.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tdset.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tempty.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tsoftlinks.h5
+ ${HDF5_TOOLS_DIR}/testfiles/textlinkfar.h5
+ ${HDF5_TOOLS_DIR}/testfiles/textlinksrc.h5
+ ${HDF5_TOOLS_DIR}/testfiles/textlinktar.h5
+ ${HDF5_TOOLS_DIR}/testfiles/textlink.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tfamily00000.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tfamily00001.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tfamily00002.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tfamily00003.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tfamily00004.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tfamily00005.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tfamily00006.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tfamily00007.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tfamily00008.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tfamily00009.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tfamily00010.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tfcontents1.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tfcontents2.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tfilters.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tfpformat.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tfvalues.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tgroup.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tgrp_comments.h5
+ ${HDF5_TOOLS_DIR}/testfiles/thlink.h5
+ ${HDF5_TOOLS_DIR}/testfiles/thyperslab.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tints4dims.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tintsattrs.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tlarge_objname.h5
+ #${HDF5_TOOLS_DIR}/testfiles/tldouble.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tlonglinks.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tloop.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tmulti-b.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tmulti-g.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tmulti-l.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tmulti-o.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tmulti-r.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tmulti-s.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tnamed_dtype_attr.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tnestedcomp.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tnestedcmpddt.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tno-subset.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tnullspace.h5
+ ${HDF5_TOOLS_DIR}/testfiles/torderattr.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tordergr.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tsaf.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tscalarattrintsize.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tscalarintattrsize.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tscalarintsize.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tscalarstring.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tslink.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tsplit_file-m.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tsplit_file-r.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tstr.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tstr2.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tstr3.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tudlink.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tvldtypes1.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tvldtypes2.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tvldtypes3.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tvldtypes4.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tvldtypes5.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tvlenstr_array.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tvlstr.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tvms.h5
+ ${HDF5_TOOLS_DIR}/testfiles/zerodim.h5
+ )
+ set (HDF5_ERROR_REFERENCE_TEST_FILES
+ ${PROJECT_SOURCE_DIR}/errfiles/filter_fail.err
+ ${PROJECT_SOURCE_DIR}/errfiles/non_existing.err
+ ${PROJECT_SOURCE_DIR}/errfiles/tall-1.err
+ ${PROJECT_SOURCE_DIR}/errfiles/tall-2A.err
+ ${PROJECT_SOURCE_DIR}/errfiles/tall-2A0.err
+ ${PROJECT_SOURCE_DIR}/errfiles/tall-2B.err
+ ${PROJECT_SOURCE_DIR}/errfiles/tarray1_big.err
+ ${PROJECT_SOURCE_DIR}/errfiles/tattrregR.err
+ ${PROJECT_SOURCE_DIR}/errfiles/tattr-3.err
+ ${PROJECT_SOURCE_DIR}/errfiles/tcomp-3.err
+ ${PROJECT_SOURCE_DIR}/errfiles/tdataregR.err
+ ${PROJECT_SOURCE_DIR}/errfiles/tdset-2.err
+ ${PROJECT_SOURCE_DIR}/errfiles/texceedsubblock.err
+ ${PROJECT_SOURCE_DIR}/errfiles/texceedsubcount.err
+ ${PROJECT_SOURCE_DIR}/errfiles/texceedsubstart.err
+ ${PROJECT_SOURCE_DIR}/errfiles/texceedsubstride.err
+ ${PROJECT_SOURCE_DIR}/errfiles/textlink.err
+ ${PROJECT_SOURCE_DIR}/errfiles/textlinkfar.err
+ ${PROJECT_SOURCE_DIR}/errfiles/textlinksrc.err
+ ${PROJECT_SOURCE_DIR}/errfiles/torderlinks1.err
+ ${PROJECT_SOURCE_DIR}/errfiles/torderlinks2.err
+ ${PROJECT_SOURCE_DIR}/errfiles/tgroup-2.err
+ ${PROJECT_SOURCE_DIR}/errfiles/tperror.err
+ ${PROJECT_SOURCE_DIR}/errfiles/tslink-D.err
+ )
+
+ # make test dir
+ file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
+
+ #
+ # copy test files from source dir to test dir
+ #
+ foreach (tst_h5_file ${HDF5_REFERENCE_TEST_FILES})
+ get_filename_component (fname "${tst_h5_file}" NAME)
+ HDFTEST_COPY_FILE("${tst_h5_file}" "${PROJECT_BINARY_DIR}/testfiles/std/${fname}" "h5dump_std_files")
+ endforeach (tst_h5_file ${HDF5_REFERENCE_TEST_FILES})
+
+ foreach (tst_exp_file ${HDF5_REFERENCE_EXP_FILES})
+ if (WIN32)
+ file (READ ${HDF5_TOOLS_DIR}/testfiles/${tst_exp_file} TEST_STREAM)
+ file (WRITE ${PROJECT_BINARY_DIR}/testfiles/std/${tst_exp_file} "${TEST_STREAM}")
+ else (WIN32)
+ HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/${tst_exp_file}" "${PROJECT_BINARY_DIR}/testfiles/std/${tst_exp_file}" "h5dump_std_files")
+ endif (WIN32)
+ endforeach (tst_exp_file ${HDF5_REFERENCE_EXP_FILES})
+
+ foreach (tst_other_file ${HDF5_REFERENCE_FILES})
+ get_filename_component (fname "${tst_other_file}" NAME)
+ HDFTEST_COPY_FILE("${tst_other_file}" "${PROJECT_BINARY_DIR}/testfiles/std/${fname}" "h5dump_std_files")
+ endforeach (tst_other_file ${HDF5_REFERENCE_FILES})
+
+ foreach (tst_error_file ${HDF5_ERROR_REFERENCE_TEST_FILES})
+ get_filename_component (fname "${tst_error_file}" NAME)
+ HDFTEST_COPY_FILE("${tst_error_file}" "${PROJECT_BINARY_DIR}/testfiles/std/${fname}" "h5dump_std_files")
+ endforeach (tst_error_file ${HDF5_ERROR_REFERENCE_TEST_FILES})
+
+ # --------------------------------------------------------------------
+ # Special file handling
+ # --------------------------------------------------------------------
+ HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/tbin1.ddl" "${PROJECT_BINARY_DIR}/testfiles/std/tbin1LE.ddl" "h5dump_std_files")
+
+ if (WIN32)
+ file (READ ${HDF5_TOOLS_DIR}/testfiles/tbinregR.exp TEST_STREAM)
+ file (WRITE ${PROJECT_BINARY_DIR}/testfiles/std/tbinregR.exp "${TEST_STREAM}")
+ else (WIN32)
+ HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/tbinregR.exp" "${PROJECT_BINARY_DIR}/testfiles/std/tbinregR.exp" "h5dump_std_files")
+ endif (WIN32)
+ add_custom_target(h5dump_std_files ALL COMMENT "Copying files needed by h5dump_std tests" DEPENDS ${h5dump_std_files_list})
+
+##############################################################################
+##############################################################################
+### T H E T E S T S M A C R O S ###
+##############################################################################
+##############################################################################
+
+ MACRO (ADD_HELP_TEST testname resultcode)
+ # If using memchecker add tests without using scripts
+ if (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (NAME H5DUMP-${testname} COMMAND $<TARGET_FILE:h5dump> ${ARGN})
+ set_tests_properties (H5DUMP-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std")
+ if (NOT "${last_test}" STREQUAL "")
+ set_tests_properties (H5DUMP-${testname} PROPERTIES DEPENDS ${last_test})
+ endif (NOT "${last_test}" STREQUAL "")
+ set (last_test "H5DUMP-${testname}")
+ else (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (
+ NAME H5DUMP-h5dump-${testname}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_ARGS:STRING=${ARGN}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std"
+ -D "TEST_OUTPUT=h5dump-${testname}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=h5dump-${testname}.txt"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ endif (HDF5_ENABLE_USING_MEMCHECKER)
+ ENDMACRO (ADD_HELP_TEST)
+
+ MACRO (ADD_SKIP_H5_TEST skipresultfile skipresultcode testtype)
+ if (${testtype} STREQUAL "SKIP")
+ if (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (
+ NAME H5DUMP-${skipresultfile}-SKIPPED
+ COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${skipresultfile} ${ARGN}"
+ )
+ endif (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ else (${testtype} STREQUAL "SKIP")
+ ADD_H5_TEST (${skipresultfile} ${skipresultcode} ${ARGN})
+ endif (${testtype} STREQUAL "SKIP")
+ ENDMACRO (ADD_SKIP_H5_TEST)
+
+ MACRO (ADD_H5_TEST resultfile resultcode)
+ # If using memchecker add tests without using scripts
+ if (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (NAME H5DUMP-${resultfile} COMMAND $<TARGET_FILE:h5dump> ${ARGN})
+ set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std")
+ if (NOT ${resultcode} STREQUAL "0")
+ set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true")
+ endif (NOT ${resultcode} STREQUAL "0")
+ if (NOT "${last_test}" STREQUAL "")
+ set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS ${last_test})
+ endif (NOT "${last_test}" STREQUAL "")
+ else (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (
+ NAME H5DUMP-${resultfile}-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove ${resultfile}.bin
+ )
+ set_tests_properties (H5DUMP-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std")
+ add_test (
+ NAME H5DUMP-${resultfile}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_ARGS:STRING=${ARGN}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std"
+ -D "TEST_OUTPUT=${resultfile}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=${resultfile}.ddl"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-${resultfile}-clear-objects")
+ endif (HDF5_ENABLE_USING_MEMCHECKER)
+ ENDMACRO (ADD_H5_TEST file)
+
+ MACRO (ADD_H5_TEST_N resultfile resultcode)
+ # If using memchecker add tests without using scripts
+ if (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (NAME H5DUMP-N-${resultfile} COMMAND $<TARGET_FILE:h5dump> ${ARGN})
+ set_tests_properties (H5DUMP-N-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std")
+ if (NOT ${resultcode} STREQUAL "0")
+ set_tests_properties (H5DUMP-N-${resultfile} PROPERTIES WILL_FAIL "true")
+ endif (NOT ${resultcode} STREQUAL "0")
+ if (NOT "${last_test}" STREQUAL "")
+ set_tests_properties (H5DUMP-N-${resultfile} PROPERTIES DEPENDS ${last_test})
+ endif (NOT "${last_test}" STREQUAL "")
+ else (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (
+ NAME H5DUMP-N-${resultfile}-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove ${resultfile}-N.bin
+ )
+ set_tests_properties (H5DUMP-N-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std")
+ add_test (
+ NAME H5DUMP-N-${resultfile}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_ARGS:STRING=${ARGN}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std"
+ -D "TEST_OUTPUT=${resultfile}-N.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=${resultfile}.ddl"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ set_tests_properties (H5DUMP-N-${resultfile} PROPERTIES DEPENDS "H5DUMP-N-${resultfile}-clear-objects")
+ endif (HDF5_ENABLE_USING_MEMCHECKER)
+ ENDMACRO (ADD_H5_TEST_N file)
+
+ MACRO (ADD_H5_TEST_EXPORT resultfile targetfile resultcode)
+ # If using memchecker add tests without using scripts
+ if (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (NAME H5DUMP-${resultfile} COMMAND $<TARGET_FILE:h5dump> ${ARGN} ${resultfile}.txt ${targetfile})
+ set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std")
+ if (NOT ${resultcode} STREQUAL "0")
+ set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true")
+ endif (NOT ${resultcode} STREQUAL "0")
+ if (NOT "${last_test}" STREQUAL "")
+ set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS ${last_test})
+ endif (NOT "${last_test}" STREQUAL "")
+ else (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (
+ NAME H5DUMP-${resultfile}-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove ${resultfile}.txt
+ )
+ set_tests_properties (H5DUMP-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std")
+ add_test (
+ NAME H5DUMP-${resultfile}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_ARGS:STRING=${ARGN};${resultfile}.txt;${targetfile}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std"
+ -D "TEST_OUTPUT=${resultfile}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=${resultfile}.ddl"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-${resultfile}-clear-objects")
+ add_test (
+ NAME H5DUMP-${resultfile}-output-cmp
+ COMMAND ${CMAKE_COMMAND}
+ -E compare_files ${resultfile}.txt ${resultfile}.exp
+ )
+ set_tests_properties (H5DUMP-${resultfile}-output-cmp PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std")
+ set_tests_properties (H5DUMP-${resultfile}-output-cmp PROPERTIES DEPENDS H5DUMP-${resultfile})
+ endif (HDF5_ENABLE_USING_MEMCHECKER)
+ ENDMACRO (ADD_H5_TEST_EXPORT file)
+
+ MACRO (ADD_H5_TEST_EXPORT_DDL resultfile targetfile resultcode ddlfile)
+ # If using memchecker add tests without using scripts
+ if (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (NAME H5DUMP-${resultfile} COMMAND $<TARGET_FILE:h5dump> --ddl=${ddlfile}.txt ${ARGN} ${resultfile}.txt ${targetfile})
+ set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std")
+ if (NOT ${resultcode} STREQUAL "0")
+ set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true")
+ endif (NOT ${resultcode} STREQUAL "0")
+ if (NOT "${last_test}" STREQUAL "")
+ set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS ${last_test})
+ endif (NOT "${last_test}" STREQUAL "")
+ else (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (
+ NAME H5DUMP-${resultfile}-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove ${ddlfile}.txt ${resultfile}.txt
+ )
+ set_tests_properties (H5DUMP-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std")
+ add_test (
+ NAME H5DUMP-${resultfile}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_ARGS:STRING=--ddl=${ddlfile}.txt;${ARGN};${resultfile}.txt;${targetfile}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std"
+ -D "TEST_OUTPUT=${resultfile}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=${resultfile}.ddl"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-${resultfile}-clear-objects")
+ add_test (
+ NAME H5DUMP-${resultfile}-output-cmp
+ COMMAND ${CMAKE_COMMAND}
+ -E compare_files ${resultfile}.txt ${resultfile}.exp
+ )
+ set_tests_properties (H5DUMP-${resultfile}-output-cmp PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std")
+ set_tests_properties (H5DUMP-${resultfile}-output-cmp PROPERTIES DEPENDS H5DUMP-${resultfile})
+ add_test (
+ NAME H5DUMP-${resultfile}-output-cmp-ddl
+ COMMAND ${CMAKE_COMMAND}
+ -E compare_files ${ddlfile}.txt ${ddlfile}.exp
+ )
+ set_tests_properties (H5DUMP-${resultfile}-output-cmp-ddl PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std")
+ set_tests_properties (H5DUMP-${resultfile}-output-cmp-ddl PROPERTIES DEPENDS H5DUMP-${resultfile}-output-cmp)
+ endif (HDF5_ENABLE_USING_MEMCHECKER)
+ ENDMACRO (ADD_H5_TEST_EXPORT_DDL file)
+
+ MACRO (ADD_H5_EXPORT_TEST resultfile targetfile resultcode)
+ if (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (
+ NAME H5DUMP-output-${resultfile}-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove ${resultfile}.txt
+ )
+ set_tests_properties (H5DUMP-output-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std")
+ add_test (
+ NAME H5DUMP-output-${resultfile}
+ COMMAND $<TARGET_FILE:h5dump> ${ARGN} ${resultfile}.txt ${targetfile}
+ )
+ set_tests_properties (H5DUMP-output-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std")
+ set_tests_properties (H5DUMP-output-${resultfile} PROPERTIES DEPENDS H5DUMP-output-${resultfile}-clear-objects)
+ add_test (
+ NAME H5DUMP-output-cmp-${resultfile}
+ COMMAND ${CMAKE_COMMAND}
+ -E compare_files ${resultfile}.txt ${resultfile}.exp
+ )
+ set_tests_properties (H5DUMP-output-cmp-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std")
+ set_tests_properties (H5DUMP-output-cmp-${resultfile} PROPERTIES DEPENDS H5DUMP-output-${resultfile})
+ endif (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ ENDMACRO (ADD_H5_EXPORT_TEST file)
+
+ MACRO (ADD_H5_MASK_TEST resultfile resultcode)
+ if (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (
+ NAME H5DUMP-${resultfile}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_ARGS:STRING=${ARGN}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std"
+ -D "TEST_OUTPUT=${resultfile}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=${resultfile}.ddl"
+ -D "TEST_MASK_ERROR=true"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ endif (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ ENDMACRO (ADD_H5_MASK_TEST file)
+
+ MACRO (ADD_H5ERR_MASK_TEST resultfile resultcode)
+ if (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (
+ NAME H5DUMP-${resultfile}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_ARGS:STRING=${ARGN}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std"
+ -D "TEST_OUTPUT=${resultfile}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=${resultfile}.ddl"
+ -D "TEST_ERRREF=${resultfile}.err"
+ -D "TEST_MASK_ERROR=true"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ endif (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ ENDMACRO (ADD_H5ERR_MASK_TEST file)
+
+ MACRO (ADD_H5ERR_MASK_ENV_TEST resultfile resultcode envvar envval)
+ if (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (
+ NAME H5DUMP-${resultfile}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_ARGS:STRING=${ARGN}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std"
+ -D "TEST_OUTPUT=${resultfile}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=${resultfile}.ddl"
+ -D "TEST_ERRREF=${resultfile}.err"
+ -D "TEST_MASK_ERROR=true"
+ -D "TEST_ENV_VAR:STRING=${envvar}"
+ -D "TEST_ENV_VALUE:STRING=${envval}"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ endif (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ ENDMACRO (ADD_H5ERR_MASK_ENV_TEST)
+
+ MACRO (ADD_H5_TEST_IMPORT conffile resultfile testfile resultcode)
+ # If using memchecker add tests without using scripts
+ if (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (
+ NAME H5DUMP-IMPORT-${resultfile}-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove ${resultfile}.bin ${resultfile}.h5
+ )
+ set_tests_properties (H5DUMP-IMPORT-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std")
+ add_test (
+ NAME H5DUMP-IMPORT-${resultfile}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_ARGS:STRING=${ARGN};-o;${resultfile}.bin;${testfile}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std"
+ -D "TEST_OUTPUT=${conffile}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=${conffile}.ddl"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ set_tests_properties (H5DUMP-IMPORT-${resultfile} PROPERTIES DEPENDS "H5DUMP-IMPORT-${resultfile}-clear-objects")
+ add_test (NAME H5DUMP-IMPORT-h5import-${resultfile} COMMAND h5import ${resultfile}.bin -c ${conffile}.out -o ${resultfile}.h5)
+ set_tests_properties (H5DUMP-IMPORT-h5import-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std")
+ set_tests_properties (H5DUMP-IMPORT-h5import-${resultfile} PROPERTIES DEPENDS H5DUMP-IMPORT-${resultfile})
+ add_test (NAME H5DUMP-IMPORT-h5diff-${resultfile} COMMAND h5diff ${testfile} ${resultfile}.h5 /integer /integer)
+ set_tests_properties (H5DUMP-IMPORT-h5diff-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std")
+ set_tests_properties (H5DUMP-IMPORT-h5diff-${resultfile} PROPERTIES DEPENDS H5DUMP-IMPORT-h5import-${resultfile})
+ endif (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ ENDMACRO (ADD_H5_TEST_IMPORT file)
+
+##############################################################################
+##############################################################################
+### T H E T E S T S HDF5_ENABLE_USING_MEMCHECKER ###
+##############################################################################
+##############################################################################
+
+ if (HDF5_ENABLE_USING_MEMCHECKER)
+ # Remove any output file left over from previous test run
+ add_test (
+ NAME H5DUMP-clearall-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ h5dump-help.out
+ charsets.out
+ charsets.out.err
+ file_space.out
+ file_space.out.err
+ filter_fail.out
+ filter_fail.out.err
+ non_existing.out
+ non_existing.out.err
+ packedbits.out
+ packedbits.out.err
+ tall-1.out
+ tall-1.out.err
+ tall-2.out
+ tall-2.out.err
+ tall-2A.out
+ tall-2A.out.err
+ tall-2A0.out
+ tall-2A0.out.err
+ tall-2B.out
+ tall-2B.out.err
+ tall-3.out
+ tall-3.out.err
+ tall-4s.out
+ tall-4s.out.err
+ tall-5s.out
+ tall-5s.out.err
+ tall-6.txt
+ tall-6.out
+ tall-6.out.err
+ tall-7.out
+ tall-7.out.err
+ tall-7N.out
+ tall-7N.out.err
+ tallfilters.out
+ tallfilters.out.err
+ tarray1.out
+ tarray1.out.err
+ tarray1_big.out
+ tarray1_big.out.err
+ tarray2.out
+ tarray2.out.err
+ tarray3.out
+ tarray3.out.err
+ tarray4.out
+ tarray4.out.err
+ tarray5.out
+ tarray5.out.err
+ tarray6.out
+ tarray6.out.err
+ tarray7.out
+ tarray7.out.err
+ tarray8.out
+ tarray8.out.err
+ tattr-1.out
+ tattr-1.out.err
+ tattr-2.out
+ tattr-2.out.err
+ tattr-3.out
+ tattr-3.out.err
+ tattr-4_be.out
+ tattr-4_be.out.err
+ tattrcontents1.out
+ tattrcontents1.out.err
+ tattrcontents2.out
+ tattrcontents2.out.err
+ tattrintsize.out
+ tattrintsize.out.err
+ tattrreg.out
+ tattrreg.out.err
+ tattrregR.out
+ tattrregR.out.err
+ tbin1LE.bin
+ tbinregR.txt
+ tbinregR.out
+ tbinregR.out.err
+ tbigdims.out
+ tbigdims.out.err
+ tbitnopaque.out
+ tbitnopaque.out.err
+ tboot1.out
+ tboot1.out.err
+ tboot2.out
+ tboot2.out.err
+ tboot2A.out
+ tboot2A.out.err
+ tboot2B.out
+ tboot2B.out.err
+ tchar1.out
+ tchar1.out.err
+ tchunked.out
+ tchunked.out.err
+ tcmpdattrintsize.out
+ tcmpdattrintsize.out.err
+ tcmpdintarray.out
+ tcmpdintarray.out.err
+ tcmpdints.out
+ tcmpdints.out.err
+ tcmpdintsize.out
+ tcmpdintsize.out.err
+ tcomp-1.out
+ tcomp-1.out.err
+ tcomp-2.out
+ tcomp-2.out.err
+ tcomp-3.out
+ tcomp-3.out.err
+ tcomp-4.out
+ tcomp-4.out.err
+ tcompact.out
+ tcompact.out.err
+ tcompound_complex.out
+ tcompound_complex.out.err
+ tcontents.out
+ tcontents.out.err
+ tcontiguos.out
+ tcontiguos.out.err
+ tdatareg.out
+ tdatareg.out.err
+ tdataregR.out
+ tdataregR.out.err
+ tdeflate.out
+ tdeflate.out.err
+ tdset-1.out
+ tdset-1.out.err
+ tdset-2.out
+ tdset-2.out.err
+ tdset-3s.out
+ tdset-3s.out.err
+ tempty.out
+ tempty.out.err
+ texternal.out
+ texternal.out.err
+ textlinksrc.out
+ textlinksrc.out.err
+ textlinkfar.out
+ textlinkfar.out.err
+ textlink.out
+ textlink.out.err
+ tfamily.out
+ tfamily.out.err
+ tfill.out
+ tfill.out.err
+ tfletcher32.out
+ tfletcher32.out.err
+ tfpformat.out
+ tfpformat.out.err
+ tgroup-1.out
+ tgroup-1.out.err
+ tgroup-2.out
+ tgroup-2.out.err
+ tgrp_comments.out
+ tgrp_comments.out.err
+ thlink-1.out
+ thlink-1.out.err
+ thlink-2.out
+ thlink-2.out.err
+ thlink-3.out
+ thlink-3.out.err
+ thlink-4.out
+ thlink-4.out.err
+ thlink-5.out
+ thlink-5.out.err
+ thyperslab.out
+ thyperslab.out.err
+ tindicesno.out
+ tindicesno.out.err
+ tindicessub1.out
+ tindicessub1.out.err
+ tindicessub2.out
+ tindicessub2.out.err
+ tindicessub3.out
+ tindicessub3.out.err
+ tindicessub4.out
+ tindicessub4.out.err
+ texceedsubstart.out
+ texceedsubstart.out.err
+ texceedsubcount.out
+ texceedsubcount.out.err
+ texceedsubstride.out
+ texceedsubstride.out.err
+ texceedsubblock.out
+ texceedsubblock.out.err
+ tindicesyes.out
+ tindicesyes.out.err
+ tints4dims.out
+ tints4dims.out.err
+ tints4dimsBlock2.out
+ tints4dimsBlock2.out.err
+ tints4dimsBlockEq.out
+ tints4dimsBlockEq.out.err
+ tints4dimsCount2.out
+ tints4dimsCount2.out.err
+ tints4dimsCountEq.out
+ tints4dimsCountEq.out.err
+ tints4dimsStride2.out
+ tints4dimsStride2.out.err
+ tintsattrs.out
+ tintsattrs.out.err
+ tlarge_objname.out
+ tlarge_objname.out.err
+ tldouble.out
+ tldouble.out.err
+ tlonglinks.out
+ tlonglinks.out.err
+ tloop-1.out
+ tloop-1.out.err
+ tmulti.out
+ tmulti.out.err
+ tmultifile.out
+ tmultifile.out.err
+# tqmarkfile.out
+# tqmarkfile.out.err
+# tstarfile.out
+# tstarfile.out.err
+ tnamed_dtype_attr.out
+ tnamed_dtype_attr.out.err
+ tnbit.out
+ tnbit.out.err
+ tnestcomp-1.out
+ tnestcomp-1.out.err
+ tnestedcmpddt.out
+ tnestedcmpddt.out.err
+ tnoattrdata.out
+ tnoattrdata.out.err
+ tnoattrddl.out
+ tnoattrddl.out.err
+ tnodata.out
+ tnodata.out.err
+ tnoddl.out
+ tnoddl.out.err
+ tnoddlfile.out
+ tnoddlfile.out.err
+ tno-subset.out
+ tno-subset.out.err
+ tnullspace.out
+ tnullspace.out.err
+ tordergr1.out
+ tordergr1.out.err
+ tordergr2.out
+ tordergr2.out.err
+ tordergr3.out
+ tordergr3.out.err
+ tordergr4.out
+ tordergr4.out.err
+ tordergr5.out
+ tordergr5.out.err
+ torderattr1.out
+ torderattr1.out.err
+ torderattr2.out
+ torderattr2.out.err
+ torderattr3.out
+ torderattr3.out.err
+ torderattr4.out
+ torderattr4.out.err
+ tordercontents1.out
+ tordercontents1.out.err
+ tordercontents2.out
+ tordercontents2.out.err
+ torderlinks1.out
+ torderlinks1.out.err
+ torderlinks2.out
+ torderlinks2.out.err
+ tperror.out
+ tperror.out.err
+ trawdatafile.out
+ trawdatafile.out.err
+ trawdatafile.txt
+ trawssetfile.out
+ trawssetfile.out.err
+ trawssetfile.txt
+ treadfilter.out
+ treadfilter.out.err
+ treadintfilter.out
+ treadintfilter.out.err
+ treference.out
+ treference.out.err
+ tsaf.out
+ tsaf.out.err
+ tscalarattrintsize.out
+ tscalarattrintsize.out.err
+ tscalarintattrsize.out
+ tscalarintattrsize.out.err
+ tscalarintsize.out
+ tscalarintsize.out.err
+ tscalarstring.out
+ tscalarstring.out.err
+ tscaleoffset.out
+ tscaleoffset.out.err
+ tshuffle.out
+ tshuffle.out.err
+ tslink-1.out
+ tslink-1.out.err
+ tslink-2.out
+ tslink-2.out.err
+ tslink-D.out
+ tslink-D.out.err
+ tsplit_file.out
+ tsplit_file.out.err
+ tstr-1.out
+ tstr-1.out.err
+ tstr-2.out
+ tstr-2.out.err
+ tstr2bin2.txt
+ tstr2bin6.txt
+ tstring.out
+ tstring.out.err
+ tstring2.out
+ tstring2.out.err
+ tstringe.out
+ tstringe.out.err
+ tszip.out
+ tszip.out.err
+ tudlink-1.out
+ tudlink-1.out.err
+ tudlink-2.out
+ tudlink-2.out.err
+ tuserfilter.out
+ tuserfilter.out.err
+ tvldtypes1.out
+ tvldtypes1.out.err
+ tvldtypes2.out
+ tvldtypes2.out.err
+ tvldtypes3.out
+ tvldtypes3.out.err
+ tvldtypes4.out
+ tvldtypes4.out.err
+ tvldtypes5.out
+ tvldtypes5.out.err
+ tvlenstr_array.out
+ tvlenstr_array.out.err
+ tvlstr.out
+ tvlstr.out.err
+ tvms.out
+ tvms.out.err
+ twidedisplay.out
+ twidedisplay.out.err
+ twithddl.txt
+ twithddlfile.out
+ twithddlfile.out.err
+ twithddlfile.txt
+ zerodim.out
+ zerodim.out.err
+ )
+ set_tests_properties (H5DUMP-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std")
+ if (NOT "${last_test}" STREQUAL "")
+ set_tests_properties (H5DUMP-clearall-objects PROPERTIES DEPENDS ${last_test})
+ endif (NOT "${last_test}" STREQUAL "")
+ set (last_test "H5DUMP-clearall-objects")
+ endif (HDF5_ENABLE_USING_MEMCHECKER)
+
+ ADD_HELP_TEST(help 0 -h)
+
+ # test data output redirection
+ #ADD_H5_TEST (tnoddl 0 --enable-error-stack -O -y packedbits.h5)
+ ADD_H5_TEST (tnoddl 0 --enable-error-stack --ddl -y packedbits.h5)
+ #ADD_H5_TEST (tnodata 0 --enable-error-stack -o packedbits.h5)
+ ADD_H5_TEST (tnodata 0 --enable-error-stack --output packedbits.h5)
+ ADD_H5_TEST (tnoattrddl 0 --enable-error-stack -O -y tattr.h5)
+ ADD_H5_TEST (tnoattrdata 0 --enable-error-stack -A -o tattr.h5)
+ ADD_H5_TEST_EXPORT (trawdatafile packedbits.h5 0 --enable-error-stack -y -o)
+ ADD_H5_TEST_EXPORT (tnoddlfile packedbits.h5 0 --enable-error-stack -O -y -o)
+ ADD_H5_TEST_EXPORT (trawssetfile tdset.h5 0 --enable-error-stack -d "/dset1[1,1;;;]" -y -o)
+
+ ADD_H5_TEST_EXPORT_DDL (twithddlfile packedbits.h5 0 twithddl --enable-error-stack --ddl=twithddl.txt -y -o)
+
+ # test for maximum display datasets
+ ADD_H5_TEST (twidedisplay 0 --enable-error-stack -w0 packedbits.h5)
+
+ # test for signed/unsigned datasets
+ ADD_H5_TEST (packedbits 0 --enable-error-stack packedbits.h5)
+ # test for compound signed/unsigned datasets
+ ADD_H5_TEST (tcmpdintarray 0 --enable-error-stack tcmpdintarray.h5)
+ ADD_H5_TEST (tcmpdints 0 --enable-error-stack tcmpdints.h5)
+ ADD_H5_TEST (tcmpdintsize 0 --enable-error-stack tcmpdintsize.h5)
+ # test for signed/unsigned scalar datasets
+ ADD_H5_TEST (tscalarintsize 0 --enable-error-stack tscalarintsize.h5)
+ # test for signed/unsigned attributes
+ ADD_H5_TEST (tattrintsize 0 --enable-error-stack tattrintsize.h5)
+ # test for compound signed/unsigned attributes
+ ADD_H5_TEST (tcmpdattrintsize 0 --enable-error-stack tcmpdattrintsize.h5)
+ # test for signed/unsigned scalar attributes
+ ADD_H5_TEST (tscalarattrintsize 0 --enable-error-stack tscalarattrintsize.h5)
+ # test for string scalar dataset and attribute
+ ADD_H5_TEST (tscalarstring 0 --enable-error-stack tscalarstring.h5)
+ # test for signed/unsigned scalar datasets with attributes
+ ADD_H5_TEST (tscalarintattrsize 0 --enable-error-stack tscalarintattrsize.h5)
+ # test for signed/unsigned datasets attributes
+ ADD_H5_TEST (tintsattrs 0 --enable-error-stack tintsattrs.h5)
+ # test for displaying groups
+ ADD_H5_TEST (tgroup-1 0 --enable-error-stack tgroup.h5)
+ # test for displaying the selected groups
+ ADD_H5ERR_MASK_TEST (tgroup-2 1 --enable-error-stack --group=/g2 --group / -g /y tgroup.h5)
+
+ # test for displaying simple space datasets
+ ADD_H5_TEST (tdset-1 0 --enable-error-stack tdset.h5)
+ # test for displaying selected datasets
+ ADD_H5ERR_MASK_TEST (tdset-2 1 --enable-error-stack -H -d dset1 -d /dset2 --dataset=dset3 tdset.h5)
+
+ # test for displaying attributes
+ ADD_H5_TEST (tattr-1 0 --enable-error-stack tattr.h5)
+ # test for displaying the selected attributes of string type and scalar space
+ ADD_H5_TEST (tattr-2 0 --enable-error-stack -a /\\\\/attr1 --attribute /attr4 --attribute=/attr5 tattr.h5)
+ ADD_H5_TEST_N (tattr-2 0 --enable-error-stack -N /\\\\/attr1 --any_path /attr4 --any_path=/attr5 tattr.h5)
+ # test for header and error messages
+ ADD_H5ERR_MASK_TEST (tattr-3 1 --enable-error-stack --header -a /attr2 --attribute=/attr tattr.h5)
+ # test for displaying at least 9 attributes on root from a be machine
+ ADD_H5_TEST (tattr-4_be 0 --enable-error-stack tattr4_be.h5)
+ # test for displaying attributes in shared datatype (also in group and dataset)
+ ADD_H5_TEST (tnamed_dtype_attr 0 --enable-error-stack tnamed_dtype_attr.h5)
+
+ # test for displaying soft links and user-defined links
+ ADD_H5_TEST (tslink-1 0 --enable-error-stack tslink.h5)
+ ADD_H5_TEST (tudlink-1 0 --enable-error-stack tudlink.h5)
+ # test for displaying the selected link
+ ADD_H5_TEST (tslink-2 0 --enable-error-stack -l slink2 tslink.h5)
+ ADD_H5_TEST_N (tslink-2 0 --enable-error-stack -N slink2 tslink.h5)
+ ADD_H5_TEST (tudlink-2 0 --enable-error-stack -l udlink2 tudlink.h5)
+ # test for displaying dangling soft links
+ ADD_H5ERR_MASK_TEST (tslink-D 0 --enable-error-stack -d /slink1 tslink.h5)
+
+ # tests for hard links
+ ADD_H5_TEST (thlink-1 0 --enable-error-stack thlink.h5)
+ ADD_H5_TEST (thlink-2 0 --enable-error-stack -d /g1/dset2 --dataset /dset1 --dataset=/g1/g1.1/dset3 thlink.h5)
+ ADD_H5_TEST (thlink-3 0 --enable-error-stack -d /g1/g1.1/dset3 --dataset /g1/dset2 --dataset=/dset1 thlink.h5)
+ ADD_H5_TEST (thlink-4 0 --enable-error-stack -g /g1 thlink.h5)
+ ADD_H5_TEST_N (thlink-4 0 --enable-error-stack -N /g1 thlink.h5)
+ ADD_H5_TEST (thlink-5 0 --enable-error-stack -d /dset1 -g /g2 -d /g1/dset2 thlink.h5)
+ ADD_H5_TEST_N (thlink-5 0 --enable-error-stack -N /dset1 -N /g2 -N /g1/dset2 thlink.h5)
+
+ # tests for compound data types
+ ADD_H5_TEST (tcomp-1 0 --enable-error-stack tcompound.h5)
+ # test for named data types
+ ADD_H5_TEST (tcomp-2 0 --enable-error-stack -t /type1 --datatype /type2 --datatype=/group1/type3 tcompound.h5)
+ ADD_H5_TEST_N (tcomp-2 0 --enable-error-stack -N /type1 --any_path /type2 --any_path=/group1/type3 tcompound.h5)
+ # test for unamed type
+ ADD_H5ERR_MASK_TEST (tcomp-3 0 "--enable-error-stack;-t;/#6632;-g;/group2;tcompound.h5")
+ # test complicated compound datatype
+ ADD_H5_TEST (tcomp-4 0 --enable-error-stack tcompound_complex.h5)
+ ADD_H5_TEST (tcompound_complex2 0 --enable-error-stack tcompound_complex2.h5)
+ # tests for bitfields and opaque data types
+ ADD_H5_TEST (tbitnopaque 0 --enable-error-stack tbitnopaque.h5)
+
+ #test for the nested compound type
+ ADD_H5_TEST (tnestcomp-1 0 --enable-error-stack tnestedcomp.h5)
+ ADD_H5_TEST (tnestedcmpddt 0 --enable-error-stack tnestedcmpddt.h5)
+
+ # test for options
+ ADD_H5ERR_MASK_TEST (tall-1 0 --enable-error-stack tall.h5)
+ ADD_H5_TEST (tall-2 0 --enable-error-stack --header -g /g1/g1.1 -a attr2 tall.h5)
+ ADD_H5_TEST (tall-3 0 --enable-error-stack -d /g2/dset2.1 -l /g1/g1.2/g1.2.1/slink tall.h5)
+ ADD_H5_TEST_N (tall-3 0 --enable-error-stack -N /g2/dset2.1 -N /g1/g1.2/g1.2.1/slink tall.h5)
+ ADD_H5_TEST (tall-7 0 --enable-error-stack -a attr1 tall.h5)
+ ADD_H5_TEST (tall-7N 0 --enable-error-stack -N attr1 tall.h5)
+
+ # test for loop detection
+ ADD_H5_TEST (tloop-1 0 --enable-error-stack tloop.h5)
+
+ # test for string
+ ADD_H5_TEST (tstr-1 0 --enable-error-stack tstr.h5)
+ ADD_H5_TEST (tstr-2 0 --enable-error-stack tstr2.h5)
+
+ # test for file created by Lib SAF team
+ ADD_H5_TEST (tsaf 0 --enable-error-stack tsaf.h5)
+
+ # test for file with variable length data
+ ADD_H5_TEST (tvldtypes1 0 --enable-error-stack tvldtypes1.h5)
+ ADD_H5_TEST (tvldtypes2 0 --enable-error-stack tvldtypes2.h5)
+ ADD_H5_TEST (tvldtypes3 0 --enable-error-stack tvldtypes3.h5)
+ ADD_H5_TEST (tvldtypes4 0 --enable-error-stack tvldtypes4.h5)
+ ADD_H5_TEST (tvldtypes5 0 --enable-error-stack tvldtypes5.h5)
+
+ #test for file with variable length string data
+ ADD_H5_TEST (tvlstr 0 --enable-error-stack tvlstr.h5)
+ ADD_H5_TEST (tvlenstr_array 0 --enable-error-stack tvlenstr_array.h5)
+
+ # test for files with array data
+ ADD_H5_TEST (tarray1 0 --enable-error-stack tarray1.h5)
+ # # added for bug# 2092 - tarray1_big.h5
+ ADD_H5ERR_MASK_TEST (tarray1_big 0 --enable-error-stack -R tarray1_big.h5)
+ ADD_H5_TEST (tarray2 0 --enable-error-stack tarray2.h5)
+ ADD_H5_TEST (tarray3 0 --enable-error-stack tarray3.h5)
+ ADD_H5_TEST (tarray4 0 --enable-error-stack tarray4.h5)
+ ADD_H5_TEST (tarray5 0 --enable-error-stack tarray5.h5)
+ ADD_H5_TEST (tarray6 0 --enable-error-stack tarray6.h5)
+ ADD_H5_TEST (tarray7 0 --enable-error-stack tarray7.h5)
+ ADD_H5_TEST (tarray8 0 --enable-error-stack tarray8.h5)
+
+ # test for wildcards in filename (does not work with cmake)
+ #ADD_H5_MASK_TEST (tstarfile 0 --enable-error-stack -H -d Dataset1 tarr*.h5)
+ #ADD_H5_MASK_TEST (tqmarkfile 0 --enable-error-stack -H -d Dataset1 tarray?.h5)
+ ADD_H5_TEST (tmultifile 0 --enable-error-stack -H -d Dataset1 tarray2.h5 tarray3.h5 tarray4.h5 tarray5.h5 tarray6.h5 tarray7.h5)
+
+ # test for files with empty data
+ ADD_H5_TEST (tempty 0 --enable-error-stack tempty.h5)
+
+ # test for files with groups that have comments
+ ADD_H5_TEST (tgrp_comments 0 --enable-error-stack tgrp_comments.h5)
+
+ # test the --filedriver flag
+ ADD_H5_TEST (tsplit_file 0 --enable-error-stack --filedriver=split tsplit_file)
+ ADD_H5_TEST (tfamily 0 --enable-error-stack --filedriver=family tfamily%05d.h5)
+ ADD_H5_TEST (tmulti 0 --enable-error-stack --filedriver=multi tmulti)
+
+ # test for files with group names which reach > 1024 bytes in size
+ ADD_H5_TEST (tlarge_objname 0 --enable-error-stack -w157 tlarge_objname.h5)
+
+ # test '-A' to suppress data but print attr's
+ ADD_H5ERR_MASK_TEST (tall-2A 0 --enable-error-stack -A tall.h5)
+
+ # test '-A' to suppress attr's but print data
+ ADD_H5ERR_MASK_TEST (tall-2A0 0 --enable-error-stack -A 0 tall.h5)
+
+ # test '-r' to print attributes in ASCII instead of decimal
+ ADD_H5ERR_MASK_TEST (tall-2B 0 --enable-error-stack -A -r tall.h5)
+
+ # test Subsetting
+ ADD_H5_TEST (tall-4s 0 --enable-error-stack --dataset=/g1/g1.1/dset1.1.1 --start=1,1 --stride=2,3 --count=3,2 --block=1,1 tall.h5)
+ ADD_H5_TEST (tall-5s 0 --enable-error-stack -d "/g1/g1.1/dset1.1.2[0;2;10;]" tall.h5)
+ ADD_H5_TEST (tdset-3s 0 --enable-error-stack -d "/dset1[1,1;;;]" tdset.h5)
+ ADD_H5_TEST (tno-subset 0 --enable-error-stack --no-compact-subset -d "AHFINDERDIRECT::ah_centroid_t[0] it=0 tl=0" tno-subset.h5)
+
+ ADD_H5_TEST (tints4dimsCount2 0 --enable-error-stack -d FourDimInts -s 0,0,0,0 -c 2,2,2,2 tints4dims.h5)
+ ADD_H5_TEST (tints4dimsBlock2 0 --enable-error-stack -d FourDimInts -s 0,0,0,0 -c 1,1,1,1 -k 2,2,2,2 tints4dims.h5)
+ ADD_H5_TEST (tints4dimsStride2 0 --enable-error-stack -d FourDimInts -s 0,0,0,0 -S 2,2,2,2 -c 2,2,2,2 tints4dims.h5)
+ ADD_H5_TEST (tints4dimsCountEq 0 --enable-error-stack -d FourDimInts -s 0,0,0,0 -S 2,2,1,1 -k 1,2,1,1 -c 2,2,4,4 tints4dims.h5)
+ ADD_H5_TEST (tints4dimsBlockEq 0 --enable-error-stack -d FourDimInts -s 0,0,0,0 -S 2,2,1,1 -c 2,2,1,1 -k 1,2,4,4 tints4dims.h5)
+
+ # 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)
+ ADD_H5_TEST (tboot2 0 --enable-error-stack -B tfcontents2.h5)
+ ADD_H5_TEST (tboot2A 0 --enable-error-stack --boot-block tfcontents2.h5)
+ ADD_H5_TEST (tboot2B 0 --enable-error-stack --superblock tfcontents2.h5)
+ ADD_H5_TEST (file_space 0 --enable-error-stack -B file_space.h5)
+
+ # test -p with a non existing dataset
+ ADD_H5ERR_MASK_TEST (tperror 1 --enable-error-stack -p -d bogus tfcontents1.h5)
+
+ # test for file contents
+ ADD_H5_TEST (tcontents 0 --enable-error-stack -n tfcontents1.h5)
+ ADD_H5_TEST (tordercontents1 0 --enable-error-stack -n --sort_by=name --sort_order=ascending tfcontents1.h5)
+ ADD_H5_TEST (tordercontents2 0 --enable-error-stack -n --sort_by=name --sort_order=descending tfcontents1.h5)
+ ADD_H5_TEST (tattrcontents1 0 --enable-error-stack -n 1 --sort_order=ascending tall.h5)
+ ADD_H5_TEST (tattrcontents2 0 --enable-error-stack -n 1 --sort_order=descending tall.h5)
+
+ # tests for storage layout
+ # compact
+ ADD_H5_TEST (tcompact 0 --enable-error-stack -H -p -d compact tfilters.h5)
+ # contiguous
+ ADD_H5_TEST (tcontiguos 0 --enable-error-stack -H -p -d contiguous tfilters.h5)
+ # chunked
+ ADD_H5_TEST (tchunked 0 --enable-error-stack -H -p -d chunked tfilters.h5)
+ # external
+ ADD_H5_TEST (texternal 0 --enable-error-stack -H -p -d external tfilters.h5)
+
+ # fill values
+ ADD_H5_TEST (tfill 0 --enable-error-stack -p tfvalues.h5)
+
+ # several datatype, with references , print path
+ ADD_H5_TEST (treference 0 --enable-error-stack tattr2.h5)
+
+ # escape/not escape non printable characters
+ ADD_H5_TEST (tstringe 0 --enable-error-stack -e tstr3.h5)
+ ADD_H5_TEST (tstring 0 --enable-error-stack tstr3.h5)
+ # char data as ASCII with non escape
+ ADD_H5_TEST (tstring2 0 --enable-error-stack -r -d str4 tstr3.h5)
+
+ # array indices print/not print
+ ADD_H5_TEST (tindicesyes 0 --enable-error-stack taindices.h5)
+ ADD_H5_TEST (tindicesno 0 --enable-error-stack -y taindices.h5)
+
+ ########## array indices with subsetting
+ # 1D case
+ ADD_H5_TEST (tindicessub1 0 --enable-error-stack -d 1d -s 1 -S 10 -c 2 -k 3 taindices.h5)
+
+ # 2D case
+ ADD_H5_TEST (tindicessub2 0 --enable-error-stack -d 2d -s 1,2 -S 3,3 -c 3,2 -k 2,2 taindices.h5)
+
+ # 3D case
+ ADD_H5_TEST (tindicessub3 0 --enable-error-stack -d 3d -s 0,1,2 -S 1,3,3 -c 2,2,2 -k 1,2,2 taindices.h5)
+
+ # 4D case
+ ADD_H5_TEST (tindicessub4 0 --enable-error-stack -d 4d -s 0,0,1,2 -c 2,2,3,2 -S 1,1,3,3 -k 1,1,2,2 taindices.h5)
+
+ # Exceed the dimensions for subsetting
+ ADD_H5_TEST (texceedsubstart 1 --enable-error-stack -d 1d -s 1,3 taindices.h5)
+ ADD_H5_TEST (texceedsubcount 1 --enable-error-stack -d 1d -c 1,3 taindices.h5)
+ ADD_H5_TEST (texceedsubstride 1 --enable-error-stack -d 1d -S 1,3 taindices.h5)
+ ADD_H5_TEST (texceedsubblock 1 --enable-error-stack -d 1d -k 1,3 taindices.h5)
+
+ # tests for filters
+ # SZIP
+ ADD_H5_TEST (tszip 0 --enable-error-stack -H -p -d szip tfilters.h5)
+
+ # deflate
+ ADD_H5_TEST (tdeflate 0 --enable-error-stack -H -p -d deflate tfilters.h5)
+
+ # shuffle
+ ADD_H5_TEST (tshuffle 0 --enable-error-stack -H -p -d shuffle tfilters.h5)
+
+ # fletcher32
+ ADD_H5_TEST (tfletcher32 0 --enable-error-stack -H -p -d fletcher32 tfilters.h5)
+
+ # nbit
+ ADD_H5_TEST (tnbit 0 --enable-error-stack -H -p -d nbit tfilters.h5)
+
+ # scaleoffset
+ ADD_H5_TEST (tscaleoffset 0 --enable-error-stack -H -p -d scaleoffset tfilters.h5)
+
+ # all
+ ADD_H5_TEST (tallfilters 0 --enable-error-stack -H -p -d all tfilters.h5)
+
+ # user defined
+ ADD_H5_TEST (tuserfilter 0 --enable-error-stack -H -p -d myfilter tfilters.h5)
+
+
+# See which filters are usable (and skip tests for filters we
+# don't have). Do this by searching H5pubconf.h to see which
+# filters are defined.
+
+# detect whether the encoder is present.
+ if (H5_HAVE_FILTER_DEFLATE)
+ set (USE_FILTER_DEFLATE "true")
+ endif (H5_HAVE_FILTER_DEFLATE)
+
+ if (H5_HAVE_FILTER_SZIP)
+ set (USE_FILTER_SZIP "true")
+ endif (H5_HAVE_FILTER_SZIP)
+
+ if (USE_FILTER_DEFLATE)
+ # data read internal filters
+ ADD_H5_TEST (treadintfilter 0 --enable-error-stack -d deflate -d shuffle -d fletcher32 -d nbit -d scaleoffset tfilters.h5)
+ if (HDF5_ENABLE_SZIP_SUPPORT)
+ # data read all filters
+ ADD_H5_TEST (treadfilter 0 --enable-error-stack -d all -d szip tfilters.h5)
+ endif (HDF5_ENABLE_SZIP_SUPPORT)
+ endif (USE_FILTER_DEFLATE)
+
+ # test for displaying objects with very long names
+ ADD_H5_TEST (tlonglinks 0 --enable-error-stack tlonglinks.h5)
+
+ # dimensions over 4GB, print boundary
+ ADD_H5_TEST (tbigdims 0 --enable-error-stack -d dset4gb -s 4294967284 -c 22 tbigdims.h5)
+
+ # hyperslab read
+ ADD_H5_TEST (thyperslab 0 --enable-error-stack thyperslab.h5)
+
+ # test for displaying dataset and attribute of null space
+ ADD_H5_TEST (tnullspace 0 --enable-error-stack tnullspace.h5)
+
+ # test for displaying dataset and attribute of space with 0 dimension size
+ ADD_H5_TEST (zerodim 0 --enable-error-stack zerodim.h5)
+
+ # test for long double (some systems do not have long double)
+ #ADD_H5_TEST (tldouble 0 --enable-error-stack tldouble.h5)
+
+ # test for vms
+ ADD_H5_TEST (tvms 0 --enable-error-stack tvms.h5)
+
+ # test for binary output
+ ADD_H5_TEST (tbin1LE 0 --enable-error-stack -d integer -o tbin1LE.bin -b LE tbinary.h5)
+
+ # test for string binary output
+ ADD_H5_EXPORT_TEST (tstr2bin2 tstr2.h5 0 --enable-error-stack -d /g2/dset2 -b -o)
+ ADD_H5_EXPORT_TEST (tstr2bin6 tstr2.h5 0 --enable-error-stack -d /g6/dset6 -b -o)
+
+ # NATIVE default. the NATIVE test can be validated with h5import/h5diff
+ ADD_H5_TEST_IMPORT (tbin1 out1D tbinary.h5 0 --enable-error-stack -d integer -b)
+
+ if (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ ADD_H5_TEST (tbin2 0 --enable-error-stack -b BE -d float -o tbin2.bin tbinary.h5)
+ endif (NOT HDF5_ENABLE_USING_MEMCHECKER)
+
+ # the NATIVE test can be validated with h5import/h5diff
+ ADD_H5_TEST_IMPORT (tbin3 out3D tbinary.h5 0 --enable-error-stack -d integer -b NATIVE)
+
+ if (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ ADD_H5_TEST (tbin4 0 --enable-error-stack -d double -b FILE -o tbin4.bin tbinary.h5)
+ endif (NOT HDF5_ENABLE_USING_MEMCHECKER)
+
+ # test for dataset region references
+ ADD_H5_TEST (tdatareg 0 --enable-error-stack tdatareg.h5)
+ ADD_H5ERR_MASK_TEST (tdataregR 0 --enable-error-stack -R tdatareg.h5)
+ ADD_H5_TEST (tattrreg 0 --enable-error-stack tattrreg.h5)
+ ADD_H5ERR_MASK_TEST (tattrregR 0 -R --enable-error-stack tattrreg.h5)
+ ADD_H5_EXPORT_TEST (tbinregR tdatareg.h5 0 --enable-error-stack -d /Dataset1 -s 0 -R -y -o)
+
+ # tests for group creation order
+ # "1" tracked, "2" name, root tracked
+ ADD_H5_TEST (tordergr1 0 --enable-error-stack --group=1 --sort_by=creation_order --sort_order=ascending tordergr.h5)
+ ADD_H5_TEST (tordergr2 0 --enable-error-stack --group=1 --sort_by=creation_order --sort_order=descending tordergr.h5)
+ ADD_H5_TEST (tordergr3 0 --enable-error-stack -g 2 -q name -z ascending tordergr.h5)
+ ADD_H5_TEST (tordergr4 0 --enable-error-stack -g 2 -q name -z descending tordergr.h5)
+ ADD_H5_TEST (tordergr5 0 --enable-error-stack -q creation_order tordergr.h5)
+
+ # tests for attribute order
+ ADD_H5_TEST (torderattr1 0 --enable-error-stack -H --sort_by=name --sort_order=ascending torderattr.h5)
+ ADD_H5_TEST (torderattr2 0 --enable-error-stack -H --sort_by=name --sort_order=descending torderattr.h5)
+ ADD_H5_TEST (torderattr3 0 --enable-error-stack -H --sort_by=creation_order --sort_order=ascending torderattr.h5)
+ ADD_H5_TEST (torderattr4 0 --enable-error-stack -H --sort_by=creation_order --sort_order=descending torderattr.h5)
+
+ # tests for link references and order
+ ADD_H5ERR_MASK_TEST (torderlinks1 0 --enable-error-stack --sort_by=name --sort_order=ascending tfcontents1.h5)
+ ADD_H5ERR_MASK_TEST (torderlinks2 0 --enable-error-stack --sort_by=name --sort_order=descending tfcontents1.h5)
+
+ # tests for floating point user defined printf format
+ ADD_H5_TEST (tfpformat 0 --enable-error-stack -m %.7f tfpformat.h5)
+
+ # tests for traversal of external links
+ ADD_H5ERR_MASK_TEST (textlinksrc 0 --enable-error-stack textlinksrc.h5)
+ ADD_H5ERR_MASK_TEST (textlinkfar 0 --enable-error-stack textlinkfar.h5)
+
+ # test for dangling external links
+ ADD_H5ERR_MASK_TEST (textlink 0 --enable-error-stack textlink.h5)
+
+ # test for error stack display (BZ2048)
+ ADD_H5ERR_MASK_ENV_TEST (filter_fail 1 "HDF5_PLUGIN_PRELOAD" "::" --enable-error-stack filter_fail.h5)
+
+ # test for -o -y for dataset with attributes
+ ADD_H5_TEST_EXPORT (tall-6 tall.h5 0 --enable-error-stack -d /g1/g1.1/dset1.1.1 -y -o)
+
+ # test for non-existing file
+ ADD_H5_TEST (non_existing 1 --enable-error-stack tgroup.h5 non_existing.h5)
diff --git a/tools/test/h5dump/CMakeTestsPBITS.cmake b/tools/test/h5dump/CMakeTestsPBITS.cmake
new file mode 100644
index 0000000..c2ec9cc
--- /dev/null
+++ b/tools/test/h5dump/CMakeTestsPBITS.cmake
@@ -0,0 +1,340 @@
+
+##############################################################################
+##############################################################################
+### T E S T I N G ###
+##############################################################################
+##############################################################################
+
+ # --------------------------------------------------------------------
+ # Packed Bits
+ # --------------------------------------------------------------------
+ #-- Copy all the HDF5 files from the test directory into the source directory
+ set (HDF5_REFERENCE_PBITS
+ tnofilename-with-packed-bits.ddl
+ tpbitsArray.ddl
+ tpbitsCompound.ddl
+ tpbitsIncomplete.ddl
+ tpbitsLengthExceeded.ddl
+ tpbitsCharLengthExceeded.ddl
+ tpbitsIntLengthExceeded.ddl
+ tpbitsLongLengthExceeded.ddl
+ tpbitsLengthPositive.ddl
+ tpbitsMax.ddl
+ tpbitsMaxExceeded.ddl
+ tpbitsOffsetExceeded.ddl
+ tpbitsCharOffsetExceeded.ddl
+ tpbitsIntOffsetExceeded.ddl
+ tpbitsLongOffsetExceeded.ddl
+ tpbitsOffsetNegative.ddl
+ tpbitsOverlapped.ddl
+ tpbitsSigned.ddl
+ tpbitsUnsigned.ddl
+ tpbitsSignedInt.ddl
+ tpbitsUnsignedInt.ddl
+ tpbitsSignedLong.ddl
+ tpbitsUnsignedLong.ddl
+ tpbitsSignedLongLong.ddl
+ tpbitsUnsignedLongLong.ddl
+ tpbitsSignedWhole.ddl
+ tpbitsUnsignedWhole.ddl
+ tpbitsSignedIntWhole.ddl
+ tpbitsUnsignedIntWhole.ddl
+ tpbitsSignedLongWhole.ddl
+ tpbitsUnsignedLongWhole.ddl
+ tpbitsSignedLongLongWhole.ddl
+ tpbitsUnsignedLongLongWhole.ddl
+ tpbitsSignedLongLongWhole1.ddl
+ tpbitsUnsignedLongLongWhole1.ddl
+ tpbitsSignedLongLongWhole63.ddl
+ tpbitsUnsignedLongLongWhole63.ddl
+ tpbitsSigned4.ddl
+ tpbitsUnsigned4.ddl
+ tpbitsSignedInt8.ddl
+ tpbitsUnsignedInt8.ddl
+ tpbitsSignedLong16.ddl
+ tpbitsUnsignedLong16.ddl
+ tpbitsSignedLongLong32.ddl
+ tpbitsUnsignedLongLong32.ddl
+ tpbitsSigned2.ddl
+ tpbitsUnsigned2.ddl
+ tpbitsSignedInt4.ddl
+ tpbitsUnsignedInt4.ddl
+ tpbitsSignedLong8.ddl
+ tpbitsUnsignedLong8.ddl
+ tpbitsSignedLongLong16.ddl
+ tpbitsUnsignedLongLong16.ddl
+ )
+ set (HDF5_REFERENCE_TEST_PBITS
+ ${HDF5_TOOLS_DIR}/testfiles/packedbits.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tarray1.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tcompound.h5
+ )
+ set (HDF5_ERROR_REFERENCE_PBITS
+ tnofilename-with-packed-bits.err
+ tpbitsCharLengthExceeded.err
+ tpbitsCharOffsetExceeded.err
+ tpbitsIncomplete.err
+ tpbitsIntLengthExceeded.err
+ tpbitsIntOffsetExceeded.err
+ tpbitsLengthExceeded.err
+ tpbitsLengthPositive.err
+ tpbitsLongLengthExceeded.err
+ tpbitsLongOffsetExceeded.err
+ tpbitsMaxExceeded.err
+ tpbitsOffsetExceeded.err
+ tpbitsOffsetNegative.err
+ )
+
+ foreach (pbits_h5_file ${HDF5_REFERENCE_TEST_PBITS})
+ get_filename_component(fname "${pbits_h5_file}" NAME)
+ HDFTEST_COPY_FILE("${pbits_h5_file}" "${PROJECT_BINARY_DIR}/testfiles/pbits/${fname}" "h5dump_pbits_files")
+ endforeach (pbits_h5_file ${HDF5_REFERENCE_TEST_PBITS})
+
+
+ foreach (ddl_pbits ${HDF5_REFERENCE_PBITS})
+ get_filename_component(fname "${ddl_pbits}" NAME)
+ HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/pbits/${ddl_pbits}" "${PROJECT_BINARY_DIR}/testfiles/pbits/${fname}" "h5dump_pbits_files")
+ endforeach (ddl_pbits ${HDF5_REFERENCE_PBITS})
+
+ foreach (ddl_pbits ${HDF5_ERROR_REFERENCE_PBITS})
+ get_filename_component(fname "${ddl_pbits}" NAME)
+ HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/errfiles/${ddl_pbits}" "${PROJECT_BINARY_DIR}/testfiles/pbits/${fname}" "h5dump_pbits_files")
+ endforeach (ddl_pbits ${HDF5_ERROR_REFERENCE_PBITS})
+ add_custom_target(h5dump_pbits_files ALL COMMENT "Copying files needed by h5dump_pbits tests" DEPENDS ${h5dump_pbits_files_list})
+
+##############################################################################
+##############################################################################
+### T H E T E S T S M A C R O S ###
+##############################################################################
+##############################################################################
+
+ MACRO (ADD_H5_PBITS_TEST resultfile resultcode)
+ # If using memchecker add tests without using scripts
+ if (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (NAME H5DUMP-${resultfile} COMMAND $<TARGET_FILE:h5dump> ${ARGN})
+ set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/pbits")
+ if (NOT ${resultcode} STREQUAL "0")
+ set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true")
+ endif ()
+ if (NOT "${last_pbits_test}" STREQUAL "")
+ set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS ${last_pbits_test})
+ endif ()
+ else (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (
+ NAME H5DUMP-${resultfile}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_ARGS:STRING=${ARGN}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/pbits"
+ -D "TEST_OUTPUT=${resultfile}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=${resultfile}.ddl"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ endif (HDF5_ENABLE_USING_MEMCHECKER)
+ ENDMACRO (ADD_H5_PBITS_TEST file)
+
+##############################################################################
+##############################################################################
+### T H E T E S T S ###
+##############################################################################
+##############################################################################
+
+ if (HDF5_ENABLE_USING_MEMCHECKER)
+ # Remove any output file left over from previous test run
+ add_test (
+ NAME H5DUMP_PACKED_BITS-clearall-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ tnofilename-with-packed-bits.out
+ tnofilename-with-packed-bits.out.err
+ tpbitsArray.out
+ tpbitsArray.out.err
+ tpbitsCompound.out
+ tpbitsCompound.out.err
+ tpbitsIncomplete.out
+ tpbitsIncomplete.out.err
+ tpbitsLengthExceeded.out
+ tpbitsLengthExceeded.out.err
+ tpbitsCharLengthExceeded.out
+ tpbitsCharLengthExceeded.out.err
+ tpbitsIntLengthExceeded.out
+ tpbitsIntLengthExceeded.out.err
+ tpbitsLongLengthExceeded.out
+ tpbitsLongLengthExceeded.out.err
+ tpbitsLengthPositive.out
+ tpbitsLengthPositive.out.err
+ tpbitsMax.out
+ tpbitsMax.out.err
+ tpbitsMaxExceeded.out
+ tpbitsMaxExceeded.out.err
+ tpbitsOffsetExceeded.out
+ tpbitsOffsetExceeded.out.err
+ tpbitsCharOffsetExceeded.out
+ tpbitsCharOffsetExceeded.out.err
+ tpbitsIntOffsetExceeded.out
+ tpbitsIntOffsetExceeded.out.err
+ tpbitsLongOffsetExceeded.out
+ tpbitsLongOffsetExceeded.out.err
+ tpbitsOffsetNegative.out
+ tpbitsOffsetNegative.out.err
+ tpbitsOverlapped.out
+ tpbitsOverlapped.out.err
+ tpbitsSigned.out
+ tpbitsSigned.out.err
+ tpbitsUnsigned.out
+ tpbitsUnsigned.out.err
+ tpbitsSignedInt.out
+ tpbitsSignedInt.out.err
+ tpbitsUnsignedInt.out
+ tpbitsUnsignedInt.out.err
+ tpbitsSignedLong.out
+ tpbitsSignedLong.out.err
+ tpbitsUnsignedLong.out
+ tpbitsUnsignedLong.out.err
+ tpbitsSignedLongLong.out
+ tpbitsSignedLongLong.out.err
+ tpbitsUnsignedLongLong.out
+ tpbitsUnsignedLongLong.out.err
+ tpbitsSignedWhole.out
+ tpbitsSignedWhole.out.err
+ tpbitsUnsignedWhole.out
+ tpbitsUnsignedWhole.out.err
+ tpbitsSignedIntWhole.out
+ tpbitsSignedIntWhole.out.err
+ tpbitsUnsignedIntWhole.out
+ tpbitsUnsignedIntWhole.out.err
+ tpbitsSignedLongWhole.out
+ tpbitsSignedLongWhole.out.err
+ tpbitsUnsignedLongWhole.out
+ tpbitsUnsignedLongWhole.out.err
+ tpbitsSignedLongLongWhole.out
+ tpbitsSignedLongLongWhole.out.err
+ tpbitsUnsignedLongLongWhole.out
+ tpbitsUnsignedLongLongWhole.out.err
+ tpbitsSignedLongLongWhole1.out
+ tpbitsSignedLongLongWhole1.out.err
+ tpbitsUnsignedLongLongWhole1.out
+ tpbitsUnsignedLongLongWhole1.out.err
+ tpbitsSignedLongLongWhole63.out
+ tpbitsSignedLongLongWhole63.out.err
+ tpbitsUnsignedLongLongWhole63.out
+ tpbitsUnsignedLongLongWhole63.out.err
+ tpbitsSigned4.out
+ tpbitsSigned4.out.err
+ tpbitsUnsigned4.out
+ tpbitsUnsigned4.out.err
+ tpbitsSignedInt8.out
+ tpbitsSignedInt8.out.err
+ tpbitsUnsignedInt8.out
+ tpbitsUnsignedInt8.out.err
+ tpbitsSignedLong16.out
+ tpbitsSignedLong16.out.err
+ tpbitsUnsignedLong16.out
+ tpbitsUnsignedLong16.out.err
+ tpbitsSignedLongLong32.out
+ tpbitsSignedLongLong32.out.err
+ tpbitsUnsignedLongLong32.out
+ tpbitsUnsignedLongLong32.out.err
+ tpbitsSigned2.out
+ tpbitsSigned2.out.err
+ tpbitsUnsigned2.out
+ tpbitsUnsigned2.out.err
+ tpbitsSignedInt4.out
+ tpbitsSignedInt4.out.err
+ tpbitsUnsignedInt4.out
+ tpbitsUnsignedInt4.out.err
+ tpbitsSignedLong8.out
+ tpbitsSignedLong8.out.err
+ tpbitsUnsignedLong8.out
+ tpbitsUnsignedLong8.out.err
+ tpbitsSignedLongLong16.out
+ tpbitsSignedLongLong16.out.err
+ tpbitsUnsignedLongLong16.out
+ tpbitsUnsignedLongLong16.out.err
+ )
+ set_tests_properties (H5DUMP_PACKED_BITS-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/pbits")
+ if (NOT "${last_pbits_test}" STREQUAL "")
+ set_tests_properties (H5DUMP_PACKED_BITS-clearall-objects PROPERTIES DEPENDS ${last_pbits_test})
+ endif (NOT "${last_pbits_test}" STREQUAL "")
+ set (last_pbits_test "H5DUMP_PACKED_BITS-clearall-objects")
+ endif (HDF5_ENABLE_USING_MEMCHECKER)
+
+ # test failure handling
+ # Missing file name
+ ADD_H5_PBITS_TEST (tnofilename-with-packed-bits 1 --enable-error-stack)
+ # Limits:
+ # Maximum number of packed bits is 8 (for now).
+ # Maximum integer size is 8*sizeof(long long).
+ # Maximun Offset is Maximum size - 1.
+ # Maximum Offset+Length is Maximum size.
+ # Tests:
+ # Normal operation on both signed and unsigned int datasets.
+ # Sanity check
+ # Their rawdata output should be the same.
+ ADD_H5_PBITS_TEST (tpbitsSignedWhole 0 --enable-error-stack -d /DS08BITS -M 0,8 packedbits.h5)
+ ADD_H5_PBITS_TEST (tpbitsUnsignedWhole 0 --enable-error-stack -d /DU08BITS -M 0,8 packedbits.h5)
+ ADD_H5_PBITS_TEST (tpbitsSignedIntWhole 0 --enable-error-stack -d /DS16BITS -M 0,16 packedbits.h5)
+ ADD_H5_PBITS_TEST (tpbitsUnsignedIntWhole 0 --enable-error-stack -d /DU16BITS -M 0,16 packedbits.h5)
+ ADD_H5_PBITS_TEST (tpbitsSignedLongWhole 0 --enable-error-stack -d /DS32BITS -M 0,32 packedbits.h5)
+ ADD_H5_PBITS_TEST (tpbitsUnsignedLongWhole 0 --enable-error-stack -d /DU32BITS -M 0,32 packedbits.h5)
+ ADD_H5_PBITS_TEST (tpbitsSignedLongLongWhole 0 --enable-error-stack -d /DS64BITS -M 0,64 packedbits.h5)
+ ADD_H5_PBITS_TEST (tpbitsUnsignedLongLongWhole 0 --enable-error-stack -d /DU64BITS -M 0,64 packedbits.h5)
+ ADD_H5_PBITS_TEST (tpbitsSignedLongLongWhole63 0 --enable-error-stack -d /DS64BITS -M 0,63 packedbits.h5)
+ ADD_H5_PBITS_TEST (tpbitsUnsignedLongLongWhole63 0 --enable-error-stack -d /DU64BITS -M 0,63 packedbits.h5)
+ ADD_H5_PBITS_TEST (tpbitsSignedLongLongWhole1 0 --enable-error-stack -d /DS64BITS -M 1,63 packedbits.h5)
+ ADD_H5_PBITS_TEST (tpbitsUnsignedLongLongWhole1 0 --enable-error-stack -d /DU64BITS -M 1,63 packedbits.h5)
+ # Half sections
+ ADD_H5_PBITS_TEST (tpbitsSigned4 0 --enable-error-stack -d /DS08BITS -M 0,4,4,4 packedbits.h5)
+ ADD_H5_PBITS_TEST (tpbitsUnsigned4 0 --enable-error-stack -d /DU08BITS -M 0,4,4,4 packedbits.h5)
+ ADD_H5_PBITS_TEST (tpbitsSignedInt8 0 --enable-error-stack -d /DS16BITS -M 0,8,8,8 packedbits.h5)
+ ADD_H5_PBITS_TEST (tpbitsUnsignedInt8 0 --enable-error-stack -d /DU16BITS -M 0,8,8,8 packedbits.h5)
+ ADD_H5_PBITS_TEST (tpbitsSignedLong16 0 --enable-error-stack -d /DS32BITS -M 0,16,16,16 packedbits.h5)
+ ADD_H5_PBITS_TEST (tpbitsUnsignedLong16 0 --enable-error-stack -d /DU32BITS -M 0,16,16,16 packedbits.h5)
+ ADD_H5_PBITS_TEST (tpbitsSignedLongLong32 0 --enable-error-stack -d /DS64BITS -M 0,32,32,32 packedbits.h5)
+ ADD_H5_PBITS_TEST (tpbitsUnsignedLongLong32 0 --enable-error-stack -d /DU64BITS -M 0,32,32,32 packedbits.h5)
+ # Quarter sections
+ ADD_H5_PBITS_TEST (tpbitsSigned2 0 --enable-error-stack -d /DS08BITS -M 0,2,2,2,4,2,6,2 packedbits.h5)
+ ADD_H5_PBITS_TEST (tpbitsUnsigned2 0 --enable-error-stack -d /DU08BITS -M 0,2,2,2,4,2,6,2 packedbits.h5)
+ ADD_H5_PBITS_TEST (tpbitsSignedInt4 0 --enable-error-stack -d /DS16BITS -M 0,4,4,4,8,4,12,4 packedbits.h5)
+ ADD_H5_PBITS_TEST (tpbitsUnsignedInt4 0 --enable-error-stack -d /DU16BITS -M 0,4,4,4,8,4,12,4 packedbits.h5)
+ ADD_H5_PBITS_TEST (tpbitsSignedLong8 0 --enable-error-stack -d /DS32BITS -M 0,8,8,8,16,8,24,8 packedbits.h5)
+ ADD_H5_PBITS_TEST (tpbitsUnsignedLong8 0 --enable-error-stack -d /DU32BITS -M 0,8,8,8,16,8,24,8 packedbits.h5)
+ ADD_H5_PBITS_TEST (tpbitsSignedLongLong16 0 --enable-error-stack -d /DS64BITS -M 0,16,16,16,32,16,48,16 packedbits.h5)
+ ADD_H5_PBITS_TEST (tpbitsUnsignedLongLong16 0 --enable-error-stack -d /DU64BITS -M 0,16,16,16,32,16,48,16 packedbits.h5)
+ # Begin and End
+ ADD_H5_PBITS_TEST (tpbitsSigned 0 --enable-error-stack -d /DS08BITS -M 0,2,2,6 packedbits.h5)
+ ADD_H5_PBITS_TEST (tpbitsUnsigned 0 --enable-error-stack -d /DU08BITS -M 0,2,2,6 packedbits.h5)
+ ADD_H5_PBITS_TEST (tpbitsSignedInt 0 --enable-error-stack -d /DS16BITS -M 0,2,10,6 packedbits.h5)
+ ADD_H5_PBITS_TEST (tpbitsUnsignedInt 0 --enable-error-stack -d /DU16BITS -M 0,2,10,6 packedbits.h5)
+ ADD_H5_PBITS_TEST (tpbitsSignedLong 0 --enable-error-stack -d /DS32BITS -M 0,2,26,6 packedbits.h5)
+ ADD_H5_PBITS_TEST (tpbitsUnsignedLong 0 --enable-error-stack -d /DU32BITS -M 0,2,26,6 packedbits.h5)
+ ADD_H5_PBITS_TEST (tpbitsSignedLongLong 0 --enable-error-stack -d /DS64BITS -M 0,2,58,6 packedbits.h5)
+ ADD_H5_PBITS_TEST (tpbitsUnsignedLongLong 0 --enable-error-stack -d /DU64BITS -M 0,2,58,6 packedbits.h5)
+ # Overlapped packed bits.
+ ADD_H5_PBITS_TEST (tpbitsOverlapped 0 --enable-error-stack -d /DS08BITS -M 0,1,1,1,2,1,0,3 packedbits.h5)
+ # Maximum number of packed bits.
+ ADD_H5_PBITS_TEST (tpbitsMax 0 --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.
+ ADD_H5_PBITS_TEST (tpbitsCompound 0 --enable-error-stack -d /dset1 -M 0,1,1,1 tcompound.h5)
+ # Array type.
+ ADD_H5_PBITS_TEST (tpbitsArray 0 --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.
+ ADD_H5_PBITS_TEST (tpbitsMaxExceeded 1 --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 8*sizeof(long long.
+ ADD_H5_PBITS_TEST (tpbitsOffsetExceeded 1 --enable-error-stack -d /DS08BITS -M 64,1 packedbits.h5)
+ ADD_H5_PBITS_TEST (tpbitsCharOffsetExceeded 0 --enable-error-stack -d /DS08BITS -M 8,1 packedbits.h5)
+ ADD_H5_PBITS_TEST (tpbitsIntOffsetExceeded 0 --enable-error-stack -d /DS16BITS -M 16,1 packedbits.h5)
+ ADD_H5_PBITS_TEST (tpbitsLongOffsetExceeded 0 --enable-error-stack -d /DS32BITS -M 32,1 packedbits.h5)
+ # Bad offset, must not be negative.
+ ADD_H5_PBITS_TEST (tpbitsOffsetNegative 1 --enable-error-stack -d /DS08BITS -M -1,1 packedbits.h5)
+ # Bad length, must not be positive.
+ ADD_H5_PBITS_TEST (tpbitsLengthPositive 1 --enable-error-stack -d /DS08BITS -M 4,0 packedbits.h5)
+ # Offset+Length is too large. Max is 8*sizeof(long long).
+ ADD_H5_PBITS_TEST (tpbitsLengthExceeded 1 --enable-error-stack -d /DS08BITS -M 37,28 packedbits.h5)
+ ADD_H5_PBITS_TEST (tpbitsCharLengthExceeded 0 --enable-error-stack -d /DS08BITS -M 2,7 packedbits.h5)
+ ADD_H5_PBITS_TEST (tpbitsIntLengthExceeded 0 --enable-error-stack -d /DS16BITS -M 10,7 packedbits.h5)
+ ADD_H5_PBITS_TEST (tpbitsLongLengthExceeded 0 --enable-error-stack -d /DS32BITS -M 26,7 packedbits.h5)
+ # Incomplete pair of packed bits request.
+ ADD_H5_PBITS_TEST (tpbitsIncomplete 1 --enable-error-stack -d /DS08BITS -M 0,2,2,1,0,2,2, packedbits.h5)
diff --git a/tools/test/h5dump/CMakeTestsVDS.cmake b/tools/test/h5dump/CMakeTestsVDS.cmake
new file mode 100644
index 0000000..aa85350
--- /dev/null
+++ b/tools/test/h5dump/CMakeTestsVDS.cmake
@@ -0,0 +1,233 @@
+
+##############################################################################
+##############################################################################
+### T E S T I N G ###
+##############################################################################
+##############################################################################
+
+ # --------------------------------------------------------------------
+ # VDS
+ # --------------------------------------------------------------------
+ #-- Copy all the HDF5 files from the test directory into the source directory
+ set (HDF5_REFERENCE_VDS
+ tvds-1.ddl
+ tvds-2.ddl
+ tvds-3_1.ddl
+ tvds-3_2.ddl
+ tvds-4.ddl
+ tvds-5.ddl
+ tvds_layout-1.ddl
+ tvds_layout-2.ddl
+ tvds_layout-3_1.ddl
+ tvds_layout-3_2.ddl
+ tvds_layout-4.ddl
+ tvds_layout-5.ddl
+ vds-first.ddl
+ vds-gap1.ddl
+ vds-gap2.ddl
+ vds_layout-eiger.ddl
+ vds_layout-maxmin.ddl
+ )
+ set (HDF5_REFERENCE_TEST_VDS
+ 1_a.h5
+ 1_b.h5
+ 1_c.h5
+ 1_d.h5
+ 1_e.h5
+ 1_f.h5
+ 1_vds.h5
+ 2_a.h5
+ 2_b.h5
+ 2_c.h5
+ 2_d.h5
+ 2_e.h5
+ 2_vds.h5
+ 3_1_vds.h5
+ 3_2_vds.h5
+ 4_0.h5
+ 4_1.h5
+ 4_2.h5
+ 4_vds.h5
+ 5_a.h5
+ 5_b.h5
+ 5_c.h5
+ 5_vds.h5
+ a.h5
+ b.h5
+ c.h5
+ d.h5
+ vds-percival-unlim-maxmin.h5
+ f-0.h5
+ f-3.h5
+ vds-eiger.h5
+ )
+ set (HDF5_ERROR_REFERENCE_VDS
+ )
+
+ foreach (vds_h5_file ${HDF5_REFERENCE_TEST_VDS})
+ get_filename_component(fname "${vds_h5_file}" NAME)
+ HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/vds/${vds_h5_file}" "${PROJECT_BINARY_DIR}/testfiles/vds/${fname}" "h5dump_vds_files")
+ endforeach (vds_h5_file ${HDF5_REFERENCE_TEST_VDS})
+
+
+ foreach (ddl_vds ${HDF5_REFERENCE_VDS})
+ get_filename_component(fname "${ddl_vds}" NAME)
+ HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/vds/${ddl_vds}" "${PROJECT_BINARY_DIR}/testfiles/vds/${fname}" "h5dump_vds_files")
+ endforeach (ddl_vds ${HDF5_REFERENCE_VDS})
+
+ foreach (ddl_vds ${HDF5_ERROR_REFERENCE_VDS})
+ get_filename_component(fname "${ddl_vds}" NAME)
+ HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/errfiles/${ddl_vds}" "${PROJECT_BINARY_DIR}/testfiles/vds/${fname}" "h5dump_vds_files")
+ endforeach (ddl_vds ${HDF5_ERROR_REFERENCE_VDS})
+ add_custom_target(h5dump_vds_files ALL COMMENT "Copying files needed by h5dump_vds tests" DEPENDS ${h5dump_vds_files_list})
+
+##############################################################################
+##############################################################################
+### T H E T E S T S M A C R O S ###
+##############################################################################
+##############################################################################
+
+ MACRO (ADD_H5_VDS_TEST resultfile resultcode)
+ # If using memchecker add tests without using scripts
+ if (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (NAME H5DUMP-${resultfile} COMMAND $<TARGET_FILE:h5dump> ${ARGN})
+ set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds")
+ if (NOT ${resultcode} STREQUAL "0")
+ set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true")
+ endif ()
+ if (NOT "${last_vds_test}" STREQUAL "")
+ set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS ${last_VDS_test})
+ endif ()
+ else (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (
+ NAME H5DUMP-${resultfile}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_ARGS:STRING=${ARGN}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/vds"
+ -D "TEST_OUTPUT=${resultfile}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=${resultfile}.ddl"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ endif (HDF5_ENABLE_USING_MEMCHECKER)
+ ENDMACRO (ADD_H5_VDS_TEST file)
+
+ MACRO (ADD_H5_VDS_LAYOUT resultfile resultcode)
+ # If using memchecker add tests without using scripts
+ if (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (NAME H5DUMP-${resultfile} COMMAND $<TARGET_FILE:h5dump> -p ${ARGN})
+ set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds")
+ if (NOT ${resultcode} STREQUAL "0")
+ set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true")
+ endif ()
+ if (NOT "${last_vds_test}" STREQUAL "")
+ set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS ${last_VDS_test})
+ endif ()
+ else (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (
+ NAME H5DUMP-${resultfile}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_ARGS:STRING=-p;${ARGN}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/vds"
+ -D "TEST_OUTPUT=${resultfile}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=${resultfile}.ddl"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-${resultfile}-clear-objects")
+ endif (HDF5_ENABLE_USING_MEMCHECKER)
+ ENDMACRO (ADD_H5_VDS_LAYOUT file)
+
+##############################################################################
+##############################################################################
+### T H E T E S T S ###
+##############################################################################
+##############################################################################
+
+ if (HDF5_ENABLE_USING_MEMCHECKER)
+ # Remove any output file left over from previous test run
+ add_test (
+ NAME H5DUMP_VDS-clearall-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ tvds-1.out
+ tvds-1.out.err
+ tvds-2.out
+ tvds-2.out.err
+ tvds-3_1.out
+ tvds-3_1.out.err
+ tvds-3_2.out
+ tvds-3_2.out.err
+ tvds-4.out
+ tvds-4.out.err
+ tvds-5.out
+ tvds-5.out.err
+ vds-first.out
+ vds-first.out.err
+ vds-gap1.out
+ vds-gap1.out.err
+ vds-gap2.out
+ vds-gap2.out.err
+ tvds_layout-1.out
+ tvds_layout-1.out.err
+ tvds_layout-2.out
+ tvds_layout-2.out.err
+ tvds_layout-3_1.out
+ tvds_layout-3_1.out.err
+ tvds_layout-3_2.out
+ tvds_layout-3_2.out.err
+ tvds_layout-4.out
+ tvds_layout-4.out.err
+ tvds_layout-5.out
+ tvds_layout-5.out.err
+ vds_layout-eiger.out
+ vds_layout-eiger.out.err
+ vds_layout-maxmin.out
+ vds_layout-maxmin.out.err
+ )
+ set_tests_properties (H5DUMP_VDS-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds")
+ if (NOT "${last_vds_test}" STREQUAL "")
+ set_tests_properties (H5DUMP_VDS-clearall-objects PROPERTIES DEPENDS ${last_vds_test})
+ endif (NOT "${last_vds_test}" STREQUAL "")
+ set (last_VDS_test "H5DUMP_VDS-clearall-objects")
+ endif (HDF5_ENABLE_USING_MEMCHECKER)
+
+# See which filters are usable (and skip tests for filters we
+# don't have). Do this by searching H5pubconf.h to see which
+# filters are defined.
+
+# detect whether the encoder is present.
+ if (H5_HAVE_FILTER_DEFLATE)
+ set (USE_FILTER_DEFLATE "true")
+ endif (H5_HAVE_FILTER_DEFLATE)
+
+ if (H5_HAVE_FILTER_SZIP)
+ set (USE_FILTER_SZIP "true")
+ endif (H5_HAVE_FILTER_SZIP)
+
+ # Data read
+ if (USE_FILTER_DEFLATE)
+ ADD_H5_VDS_TEST (tvds-1 0 --enable-error-stack 1_vds.h5)
+ ADD_H5_VDS_TEST (tvds-2 0 --enable-error-stack 2_vds.h5)
+ ADD_H5_VDS_TEST (tvds-3_1 0 --enable-error-stack 3_1_vds.h5)
+ ADD_H5_VDS_TEST (tvds-3_2 0 --enable-error-stack 3_2_vds.h5)
+ ADD_H5_VDS_TEST (tvds-4 0 --enable-error-stack 4_vds.h5)
+ ADD_H5_VDS_TEST (tvds-5 0 --enable-error-stack 5_vds.h5)
+ ADD_H5_VDS_TEST (vds-first 0 --vds-view-first-missing --enable-error-stack vds-percival-unlim-maxmin.h5)
+ ADD_H5_VDS_TEST (vds-gap1 0 -d /VDS-Eiger --vds-gap-size=1 --enable-error-stack vds-eiger.h5)
+ ADD_H5_VDS_TEST (vds-gap2 0 --vds-gap-size=2 --enable-error-stack vds-eiger.h5)
+ endif (USE_FILTER_DEFLATE)
+
+ # Layout read
+ if (USE_FILTER_DEFLATE)
+ ADD_H5_VDS_LAYOUT (tvds_layout-1 0 --enable-error-stack 1_vds.h5)
+ ADD_H5_VDS_LAYOUT (tvds_layout-2 0 --enable-error-stack 2_vds.h5)
+ ADD_H5_VDS_LAYOUT (tvds_layout-3_1 0 --enable-error-stack 3_1_vds.h5)
+ ADD_H5_VDS_LAYOUT (tvds_layout-3_2 0 --enable-error-stack 3_2_vds.h5)
+ ADD_H5_VDS_LAYOUT (tvds_layout-4 0 --enable-error-stack 4_vds.h5)
+ ADD_H5_VDS_LAYOUT (tvds_layout-5 0 --enable-error-stack 5_vds.h5)
+ ADD_H5_VDS_LAYOUT (vds_layout-eiger 0 --enable-error-stack vds-eiger.h5)
+ ADD_H5_VDS_LAYOUT (vds_layout-maxmin 0 --enable-error-stack vds-percival-unlim-maxmin.h5)
+ endif (USE_FILTER_DEFLATE)
diff --git a/tools/test/h5dump/CMakeTestsXML.cmake b/tools/test/h5dump/CMakeTestsXML.cmake
new file mode 100644
index 0000000..79d3ff8
--- /dev/null
+++ b/tools/test/h5dump/CMakeTestsXML.cmake
@@ -0,0 +1,414 @@
+
+##############################################################################
+##############################################################################
+### T E S T I N G ###
+##############################################################################
+##############################################################################
+
+ #
+ # copy XML test files from source dir to test dir
+ #
+ set (HDF5_XML_REFERENCE_TEST_FILES
+ ${HDF5_TOOLS_DIR}/testfiles/tall.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tarray1.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tarray2.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tarray3.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tarray6.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tarray7.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tattr.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tbitfields.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tcompound.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tcompound2.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tcompound_complex.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tdatareg.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tdset.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tdset2.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tempty.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tenum.h5
+ ${HDF5_TOOLS_DIR}/testfiles/textlink.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tfpformat.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tgroup.h5
+ ${HDF5_TOOLS_DIR}/testfiles/thlink.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tloop.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tloop2.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tmany.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tname-amp.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tname-apos.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tname-gt.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tname-lt.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tname-quot.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tname-sp.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tnamed_dtype_attr.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tnestedcomp.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tnodata.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tobjref.h5
+ ${HDF5_TOOLS_DIR}/testfiles/topaque.h5
+ ${HDF5_TOOLS_DIR}/testfiles/torderattr.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tref.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tref-escapes.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tref-escapes-at.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tsaf.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tslink.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tstring.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tstring-at.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tstr.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tstr2.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tudlink.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tvldtypes1.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tvldtypes2.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tvldtypes3.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tvldtypes4.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tvldtypes5.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tvlstr.h5
+ )
+ set (HDF5_XML_REFERENCE_FILES
+ ${HDF5_TOOLS_DIR}/testfiles/tall.h5.xml
+ ${HDF5_TOOLS_DIR}/testfiles/tall-2A.h5.xml
+ ${HDF5_TOOLS_DIR}/testfiles/tarray1.h5.xml
+ ${HDF5_TOOLS_DIR}/testfiles/tarray2.h5.xml
+ ${HDF5_TOOLS_DIR}/testfiles/tarray3.h5.xml
+ ${HDF5_TOOLS_DIR}/testfiles/tarray6.h5.xml
+ ${HDF5_TOOLS_DIR}/testfiles/tarray7.h5.xml
+ ${HDF5_TOOLS_DIR}/testfiles/tattr.h5.xml
+ ${HDF5_TOOLS_DIR}/testfiles/tbitfields.h5.xml
+ ${HDF5_TOOLS_DIR}/testfiles/tcompound_complex.h5.xml
+ ${HDF5_TOOLS_DIR}/testfiles/tcompound.h5.xml
+ ${HDF5_TOOLS_DIR}/testfiles/tcompound2.h5.xml
+ ${HDF5_TOOLS_DIR}/testfiles/tdatareg.h5.xml
+ ${HDF5_TOOLS_DIR}/testfiles/tdset.h5.xml
+ ${HDF5_TOOLS_DIR}/testfiles/tdset2.h5.xml
+ ${HDF5_TOOLS_DIR}/testfiles/tempty.h5.xml
+ ${HDF5_TOOLS_DIR}/testfiles/tempty-dtd.h5.xml
+ ${HDF5_TOOLS_DIR}/testfiles/tempty-dtd-2.h5.xml
+ ${HDF5_TOOLS_DIR}/testfiles/tempty-dtd-uri.h5.xml
+ ${HDF5_TOOLS_DIR}/testfiles/tempty-nons.h5.xml
+ ${HDF5_TOOLS_DIR}/testfiles/tempty-nons-2.h5.xml
+ ${HDF5_TOOLS_DIR}/testfiles/tempty-nons-uri.h5.xml
+ ${HDF5_TOOLS_DIR}/testfiles/tempty-ns.h5.xml
+ ${HDF5_TOOLS_DIR}/testfiles/tempty-ns-2.h5.xml
+ ${HDF5_TOOLS_DIR}/testfiles/tenum.h5.xml
+ ${HDF5_TOOLS_DIR}/testfiles/textlink.h5.xml
+ ${HDF5_TOOLS_DIR}/testfiles/tfpformat.h5.xml
+ ${HDF5_TOOLS_DIR}/testfiles/tgroup.h5.xml
+ ${HDF5_TOOLS_DIR}/testfiles/thlink.h5.xml
+ ${HDF5_TOOLS_DIR}/testfiles/tloop.h5.xml
+ ${HDF5_TOOLS_DIR}/testfiles/tloop2.h5.xml
+ ${HDF5_TOOLS_DIR}/testfiles/tmany.h5.xml
+ ${HDF5_TOOLS_DIR}/testfiles/tname-amp.h5.xml
+ ${HDF5_TOOLS_DIR}/testfiles/tname-apos.h5.xml
+ ${HDF5_TOOLS_DIR}/testfiles/tnamed_dtype_attr.h5.xml
+ ${HDF5_TOOLS_DIR}/testfiles/tname-gt.h5.xml
+ ${HDF5_TOOLS_DIR}/testfiles/tname-lt.h5.xml
+ ${HDF5_TOOLS_DIR}/testfiles/tname-quot.h5.xml
+ ${HDF5_TOOLS_DIR}/testfiles/tname-sp.h5.xml
+ ${HDF5_TOOLS_DIR}/testfiles/tnestedcomp.h5.xml
+ ${HDF5_TOOLS_DIR}/testfiles/tnodata.h5.xml
+ ${HDF5_TOOLS_DIR}/testfiles/tobjref.h5.xml
+ ${HDF5_TOOLS_DIR}/testfiles/topaque.h5.xml
+ ${HDF5_TOOLS_DIR}/testfiles/torderattr1.h5.xml
+ ${HDF5_TOOLS_DIR}/testfiles/torderattr2.h5.xml
+ ${HDF5_TOOLS_DIR}/testfiles/torderattr3.h5.xml
+ ${HDF5_TOOLS_DIR}/testfiles/torderattr4.h5.xml
+ ${HDF5_TOOLS_DIR}/testfiles/tref.h5.xml
+ ${HDF5_TOOLS_DIR}/testfiles/tref-escapes.h5.xml
+ ${HDF5_TOOLS_DIR}/testfiles/tref-escapes-at.h5.xml
+ ${HDF5_TOOLS_DIR}/testfiles/tsaf.h5.xml
+ ${HDF5_TOOLS_DIR}/testfiles/tslink.h5.xml
+ ${HDF5_TOOLS_DIR}/testfiles/tstr.h5.xml
+ ${HDF5_TOOLS_DIR}/testfiles/tstr2.h5.xml
+ ${HDF5_TOOLS_DIR}/testfiles/tstring.h5.xml
+ ${HDF5_TOOLS_DIR}/testfiles/tstring-at.h5.xml
+ ${HDF5_TOOLS_DIR}/testfiles/tudlink.h5.xml
+ ${HDF5_TOOLS_DIR}/testfiles/tvldtypes1.h5.xml
+ ${HDF5_TOOLS_DIR}/testfiles/tvldtypes2.h5.xml
+ ${HDF5_TOOLS_DIR}/testfiles/tvldtypes3.h5.xml
+ ${HDF5_TOOLS_DIR}/testfiles/tvldtypes4.h5.xml
+ ${HDF5_TOOLS_DIR}/testfiles/tvldtypes5.h5.xml
+ ${HDF5_TOOLS_DIR}/testfiles/tvlstr.h5.xml
+ )
+
+ foreach (tst_xml_h5_file ${HDF5_XML_REFERENCE_TEST_FILES})
+ get_filename_component(fname "${tst_xml_h5_file}" NAME)
+ HDFTEST_COPY_FILE("${tst_xml_h5_file}" "${PROJECT_BINARY_DIR}/testfiles/xml/${fname}" "h5dump_xml_files")
+ endforeach (tst_xml_h5_file ${HDF5_XML_REFERENCE_TEST_FILES})
+
+ foreach (tst_xml_other_file ${HDF5_XML_REFERENCE_FILES})
+ get_filename_component(fname "${tst_xml_other_file}" NAME)
+ HDFTEST_COPY_FILE("${tst_xml_other_file}" "${PROJECT_BINARY_DIR}/testfiles/xml/${fname}" "h5dump_xml_files")
+ endforeach (tst_xml_other_file ${HDF5_XML_REFERENCE_FILES})
+ add_custom_target(h5dump_xml_files ALL COMMENT "Copying files needed by h5dump_xml tests" DEPENDS ${h5dump_xml_files_list})
+
+##############################################################################
+##############################################################################
+### T H E T E S T S M A C R O S ###
+##############################################################################
+##############################################################################
+
+ MACRO (ADD_XML_SKIP_H5_TEST skipresultfile skipresultcode testtype)
+ if (${testtype} STREQUAL "SKIP")
+ if (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (
+ NAME H5DUMP-XML-${skipresultfile}-SKIPPED
+ COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${skipresultfile}.xml --xml ${ARGN}"
+ )
+ endif (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ else (${testtype} STREQUAL "SKIP")
+ ADD_XML_H5_TEST (${skipresultfile} ${skipresultcode} ${ARGN})
+ endif (${testtype} STREQUAL "SKIP")
+ ENDMACRO (ADD_XML_SKIP_H5_TEST)
+
+ MACRO (ADD_XML_H5_TEST resultfile resultcode)
+ if (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (NAME H5DUMP-XML-${resultfile} COMMAND $<TARGET_FILE:h5dump> --xml ${ARGN})
+ set_tests_properties (H5DUMP-XML-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/xml")
+ if (NOT ${resultcode} STREQUAL "0")
+ set_tests_properties (H5DUMP-XML-${resultfile} PROPERTIES WILL_FAIL "true")
+ endif ()
+ if (NOT "${last_xml_test}" STREQUAL "")
+ set_tests_properties (H5DUMP-XML-${resultfile} PROPERTIES DEPENDS ${last_xml_test})
+ endif ()
+ else (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (
+ NAME H5DUMP-XML-${resultfile}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_ARGS:STRING=--xml;${ARGN}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/xml"
+ -D "TEST_OUTPUT=${resultfile}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=${resultfile}.xml"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ endif (HDF5_ENABLE_USING_MEMCHECKER)
+ ENDMACRO (ADD_XML_H5_TEST file)
+
+##############################################################################
+##############################################################################
+### T H E T E S T S ###
+##############################################################################
+##############################################################################
+
+ if (HDF5_ENABLE_USING_MEMCHECKER)
+ # Remove any output file left over from previous test run
+ add_test (
+ NAME H5DUMP-XML-clearall-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ tall.h5.out
+ tall.h5.out.err
+ tall-2A.h5.out
+ tall-2A.h5.out.err
+ tarray1.h5.out
+ tarray1.h5.out.err
+ tarray2.h5.out
+ tarray2.h5.out.err
+ tarray3.h5.out
+ tarray3.h5.out.err
+ tarray6.h5.out
+ tarray6.h5.out.err
+ tarray7.h5.out
+ tarray7.h5.out.err
+ tattr.h5.out
+ tattr.h5.out.err
+ tbitfields.h5.out
+ tbitfields.h5.out.err
+ tcompound.h5.out
+ tcompound.h5.out.err
+ tcompound2.h5.out
+ tcompound2.h5.out.err
+ tcompound_complex.h5.out
+ tcompound_complex.h5.out.err
+ tdatareg.h5.out
+ tdatareg.h5.out.err
+ tdset.h5.out
+ tdset.h5.out.err
+ tdset2.h5.out
+ tdset2.h5.out.err
+ tempty-dtd-2.h5.out
+ tempty-dtd-2.h5.out.err
+ tempty-dtd-uri.h5.out
+ tempty-dtd-uri.h5.out.err
+ tempty-dtd.h5.out
+ tempty-dtd.h5.out.err
+ tempty-nons-2.h5.out
+ tempty-nons-2.h5.out.err
+ tempty-nons-uri.h5.out
+ tempty-nons-uri.h5.out.err
+ tempty-nons.h5.out
+ tempty-nons.h5.out.err
+ tempty-ns-2.h5.out
+ tempty-ns-2.h5.out.err
+ tempty-ns.h5.out
+ tempty-ns.h5.out.err
+ tempty.h5.out
+ tempty.h5.out.err
+ tenum.h5.out
+ tenum.h5.out.err
+ textlink.h5.out
+ textlink.h5.out.err
+ tfpformat.h5.out
+ tfpformat.h5.out.err
+ tgroup.h5.out
+ tgroup.h5.out.err
+ thlink.h5.out
+ thlink.h5.out.err
+ tloop.h5.out
+ tloop.h5.out.err
+ tloop2.h5.out
+ tloop2.h5.out.err
+ tmany.h5.out
+ tmany.h5.out.err
+ tname-amp.h5.out
+ tname-amp.h5.out.err
+ tname-apos.h5.out
+ tname-apos.h5.out.err
+ tname-gt.h5.out
+ tname-gt.h5.out.err
+ tname-lt.h5.out
+ tname-lt.h5.out.err
+ tname-quot.h5.out
+ tname-quot.h5.out.err
+ tname-sp.h5.out
+ tname-sp.h5.out.err
+ tnamed_dtype_attr.h5.out
+ tnamed_dtype_attr.h5.out.err
+ tnestedcomp.h5.out
+ tnestedcomp.h5.out.err
+ tnodata.h5.out
+ tnodata.h5.out.err
+ tnoname.h5.out
+ tnoname.h5.out.err
+ tobjref.h5.out
+ tobjref.h5.out.err
+ topaque.h5.out
+ topaque.h5.out.err
+ torderattr1.h5.out
+ torderattr1.h5.out.err
+ torderattr2.h5.out
+ torderattr2.h5.out.err
+ torderattr3.h5.out
+ torderattr3.h5.out.err
+ torderattr4.h5.out
+ torderattr4.h5.out.err
+ tref-escapes-at.h5.out
+ tref-escapes-at.h5.out.err
+ tref-escapes.h5.out
+ tref-escapes.h5.out.err
+ tref.h5.out
+ tref.h5.out.err
+ tsaf.h5.out
+ tsaf.h5.out.err
+ tslink.h5.out
+ tslink.h5.out.err
+ tstr.h5.out
+ tstr.h5.out.err
+ tstr2.h5.out
+ tstr2.h5.out.err
+ tstring.h5.out
+ tstring.h5.out.err
+ tstring-at.h5.out
+ tstring-at.h5.out.err
+ tudlink.h5.out
+ tudlink.h5.out.err
+ tvldtypes1.h5.out
+ tvldtypes1.h5.out.err
+ tvldtypes2.h5.out
+ tvldtypes2.h5.out.err
+ tvldtypes3.h5.out
+ tvldtypes3.h5.out.err
+ tvldtypes4.h5.out
+ tvldtypes4.h5.out.err
+ tvldtypes5.h5.out
+ tvldtypes5.h5.out.err
+ tvlstr.h5.out
+ tvlstr.h5.out.err
+ )
+ set_tests_properties (H5DUMP-XML-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/xml")
+ if (NOT "${last_xml_test}" STREQUAL "")
+ set_tests_properties (H5DUMP-XML-clearall-objects PROPERTIES DEPENDS ${last_xml_test})
+ endif (NOT "${last_xml_test}" STREQUAL "")
+ set (last_test "H5DUMP-XML-clearall-objects")
+ endif (HDF5_ENABLE_USING_MEMCHECKER)
+
+ ########## test XML
+ ADD_XML_H5_TEST (tall.h5 0 tall.h5)
+ ADD_XML_H5_TEST (tattr.h5 0 tattr.h5)
+ ADD_XML_H5_TEST (tbitfields.h5 0 tbitfields.h5)
+ ADD_XML_H5_TEST (tcompound.h5 0 tcompound.h5)
+ ADD_XML_H5_TEST (tcompound2.h5 0 tcompound2.h5)
+ ADD_XML_H5_TEST (tdatareg.h5 0 tdatareg.h5)
+ ADD_XML_H5_TEST (tdset.h5 0 tdset.h5)
+ ADD_XML_H5_TEST (tdset2.h5 0 tdset2.h5)
+ ADD_XML_H5_TEST (tenum.h5 0 tenum.h5)
+ ADD_XML_H5_TEST (tgroup.h5 0 tgroup.h5)
+ ADD_XML_H5_TEST (thlink.h5 0 thlink.h5)
+ ADD_XML_H5_TEST (tloop.h5 0 tloop.h5)
+ ADD_XML_H5_TEST (tloop2.h5 0 tloop2.h5)
+ ADD_XML_H5_TEST (tmany.h5 0 tmany.h5)
+ ADD_XML_H5_TEST (tnestedcomp.h5 0 tnestedcomp.h5)
+ ADD_XML_H5_TEST (tcompound_complex.h5 0 tcompound_complex.h5)
+ ADD_XML_H5_TEST (tobjref.h5 0 tobjref.h5)
+ ADD_XML_H5_TEST (topaque.h5 0 topaque.h5)
+ ADD_XML_H5_TEST (tslink.h5 0 tslink.h5)
+ ADD_XML_H5_TEST (tudlink.h5 0 tudlink.h5)
+ ADD_XML_H5_TEST (textlink.h5 0 textlink.h5)
+ ADD_XML_H5_TEST (tstr.h5 0 tstr.h5)
+ ADD_XML_H5_TEST (tstr2.h5 0 tstr2.h5)
+ ADD_XML_H5_TEST (tref.h5 0 tref.h5)
+ ADD_XML_H5_TEST (tname-amp.h5 0 tname-amp.h5)
+ ADD_XML_H5_TEST (tname-apos.h5 0 tname-apos.h5)
+ ADD_XML_H5_TEST (tname-gt.h5 0 tname-gt.h5)
+ ADD_XML_H5_TEST (tname-lt.h5 0 tname-lt.h5)
+ ADD_XML_H5_TEST (tname-quot.h5 0 tname-quot.h5)
+ ADD_XML_H5_TEST (tname-sp.h5 0 tname-sp.h5)
+ ADD_XML_H5_TEST (tstring.h5 0 tstring.h5)
+ ADD_XML_H5_TEST (tstring-at.h5 0 tstring-at.h5)
+ ADD_XML_H5_TEST (tref-escapes.h5 0 tref-escapes.h5)
+ ADD_XML_H5_TEST (tref-escapes-at.h5 0 tref-escapes-at.h5)
+ ADD_XML_H5_TEST (tnodata.h5 0 tnodata.h5)
+ ADD_XML_H5_TEST (tarray1.h5 0 tarray1.h5)
+ ADD_XML_H5_TEST (tarray2.h5 0 tarray2.h5)
+ ADD_XML_H5_TEST (tarray3.h5 0 tarray3.h5)
+ ADD_XML_H5_TEST (tarray6.h5 0 tarray6.h5)
+ ADD_XML_H5_TEST (tarray7.h5 0 tarray7.h5)
+ ADD_XML_H5_TEST (tvldtypes1.h5 0 tvldtypes1.h5)
+ ADD_XML_H5_TEST (tvldtypes2.h5 0 tvldtypes2.h5)
+ ADD_XML_H5_TEST (tvldtypes3.h5 0 tvldtypes3.h5)
+ ADD_XML_H5_TEST (tvldtypes4.h5 0 tvldtypes4.h5)
+ ADD_XML_H5_TEST (tvldtypes5.h5 0 tvldtypes5.h5)
+ ADD_XML_H5_TEST (tvlstr.h5 0 tvlstr.h5)
+ ADD_XML_H5_TEST (tsaf.h5 0 tsaf.h5)
+ ADD_XML_H5_TEST (tempty.h5 0 tempty.h5)
+ ADD_XML_H5_TEST (tnamed_dtype_attr.h5 0 tnamed_dtype_attr.h5)
+ ##Test dataset and attribute of null space. Commented out:
+ ## wait until the XML schema is updated for null space.
+ ## ADD_XML_H5_TEST (tnullspace.h5 0 tnulspace.h5)
+ ## So is dataspace with 0 dimension size.
+ ## ADD_XML_H5_TEST (zerodim.h5 0 zerodim.h5)
+
+ # other options for xml
+
+ ADD_XML_H5_TEST (tempty-dtd.h5 0 --use-dtd tempty.h5)
+ ADD_XML_H5_TEST (tempty-dtd-2.h5 0 -u tempty.h5)
+
+ ADD_XML_H5_TEST (tempty-nons-2.h5 0 --xml-ns=: tempty.h5)
+
+ ## Some of these combinations are syntactically correct but
+ ## the URLs are dummies
+ ADD_XML_H5_TEST (tempty-ns.h5 0 -X thing: tempty.h5)
+ ADD_XML_H5_TEST (tempty-ns-2.h5 0 --xml-ns=thing: tempty.h5)
+ ADD_XML_H5_TEST (tempty-nons-uri.h5 0 --xml-ns=: --xml-dtd=http://somewhere.net tempty.h5)
+ ADD_XML_H5_TEST (tempty-dtd-uri.h5 0 --use-dtd --xml-dtd=http://somewhere.net tempty.h5)
+
+ ADD_XML_H5_TEST (tall-2A.h5 0 -A tall.h5)
+
+
+ # tests for attribute order
+ ADD_XML_H5_TEST (torderattr1.h5 0 -H --sort_by=name --sort_order=ascending torderattr.h5)
+ ADD_XML_H5_TEST (torderattr2.h5 0 -H --sort_by=name --sort_order=descending torderattr.h5)
+ ADD_XML_H5_TEST (torderattr3.h5 0 -H --sort_by=creation_order --sort_order=ascending torderattr.h5)
+ ADD_XML_H5_TEST (torderattr4.h5 0 -H --sort_by=creation_order --sort_order=descending torderattr.h5)
+
+ # tests for floating point user defined printf format
+ ADD_XML_H5_TEST (tfpformat.h5 0 -u -m %.7f tfpformat.h5)
+
diff --git a/tools/test/h5dump/Makefile.am b/tools/test/h5dump/Makefile.am
new file mode 100644
index 0000000..aed34ec
--- /dev/null
+++ b/tools/test/h5dump/Makefile.am
@@ -0,0 +1,42 @@
+#
+# 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.
+##
+## Makefile.am
+## Run automake to generate a Makefile.in from this file.
+#
+# HDF5 Library Makefile(.in)
+#
+
+include $(top_srcdir)/config/commence.am
+
+# Include files in /src directory and /tools/lib directory
+AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib
+
+# Test programs and scripts
+TEST_PROG=h5dumpgentest
+TEST_SCRIPT=testh5dump.sh testh5dumppbits.sh testh5dumpvds.sh testh5dumpxml.sh
+
+check_PROGRAMS=$(TEST_PROG) binread
+check_SCRIPTS=$(TEST_SCRIPT)
+SCRIPT_DEPEND=../../src/h5dump/h5dump$(EXEEXT)
+
+# All the programs depend on the hdf5 and h5tools libraries
+LDADD=$(LIBH5TOOLS) $(LIBHDF5)
+
+# 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 testh5dumppbits.sh testh5dumpxml.sh
+
+include $(top_srcdir)/config/conclude.am
diff --git a/tools/test/h5dump/binread.c b/tools/test/h5dump/binread.c
new file mode 100644
index 0000000..74db92c
--- /dev/null
+++ b/tools/test/h5dump/binread.c
@@ -0,0 +1,97 @@
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/*
+ This program reads binary output from h5dump (-b option).
+ To use change the following 3 symbols accordingly.
+ For example, to read 2 elements of a float type , define
+
+ #define NELMTS 2
+ #define TYPE float
+ #define FORMAT "%f "
+
+*/
+
+#define NELMTS 6
+#define TYPE int
+#define FORMAT "%d "
+
+/*-------------------------------------------------------------------------
+ * Function: usage
+ *
+ * Purpose: Prints a usage message on stderr and then returns.
+ *
+ * Return: void
+ *
+ * Programmer: Pedro Vicente Nunes
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+usage (void)
+{
+ fprintf(stderr, "usage: binread FILE_NAME\n");
+}
+
+/*-------------------------------------------------------------------------
+ * Function: main
+ *
+ * Purpose: main program.
+ *
+ *-------------------------------------------------------------------------
+ */
+
+int
+main (int argc, const char *argv[])
+{
+ FILE *stream;
+ size_t numread;
+ TYPE buf[NELMTS];
+ size_t i, nelmts = NELMTS;
+ char *fname=NULL;
+
+ if (argc != 2) {
+ usage();
+ exit(1);
+ }
+
+ fname = strdup(argv[1]);
+
+ if((stream = fopen(fname, "rb")) != NULL) {
+ numread = fread(buf, sizeof( TYPE ), nelmts, stream);
+ printf("Number of items read = %llu\n", (unsigned long long)numread);
+
+ for (i = 0; i < nelmts; i++) {
+ printf(FORMAT,buf[i]);
+ }
+ printf("\n");
+
+ fclose(stream);
+ }
+ else
+ printf("File %s could not be opened\n", fname);
+
+ free(fname);
+
+ return 0;
+}
+
diff --git a/tools/test/h5dump/errfiles/filter_fail.err b/tools/test/h5dump/errfiles/filter_fail.err
new file mode 100644
index 0000000..db21044
--- /dev/null
+++ b/tools/test/h5dump/errfiles/filter_fail.err
@@ -0,0 +1,24 @@
+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
+ major: Dataset
+ minor: Read failed
+ #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
+ major: Data filters
+ minor: Filter operation failed
+ #004: (file name) line (number) in H5Z_pipeline(): required filter 'filter_fail_test' is not registered
+ major: Data filters
+ minor: Read failed
+ #005: (file name) line (number) in H5PL_load(): required dynamically loaded plugin filter '312' is not available
+ major: Plugin for dynamically loaded library
+ minor: Unable to load metadata into cache
+h5dump error: unable to print data
+H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs):
+ #000: (file name) line (number) in h5tools_dump_simple_dset(): H5Dread failed
+ major: Failure in tools library
+ minor: error in function
diff --git a/tools/test/h5dump/errfiles/non_existing.err b/tools/test/h5dump/errfiles/non_existing.err
new file mode 100644
index 0000000..f7e3afa
--- /dev/null
+++ b/tools/test/h5dump/errfiles/non_existing.err
@@ -0,0 +1 @@
+h5dump error: unable to open file "non_existing.h5"
diff --git a/tools/test/h5dump/errfiles/tall-1.err b/tools/test/h5dump/errfiles/tall-1.err
new file mode 100644
index 0000000..ab9dbe3
--- /dev/null
+++ b/tools/test/h5dump/errfiles/tall-1.err
@@ -0,0 +1,25 @@
+HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
+ #000: (file name) line (number) in H5Oopen(): unable to open object
+ major: Object header
+ minor: Can't open object
+ #001: (file name) line (number) in H5O_open_name(): object not found
+ major: Object header
+ minor: Object not found
+ #002: (file name) line (number) in H5G_loc_find(): can't find object
+ major: Symbol table
+ minor: Object not found
+ #003: (file name) line (number) in H5G_traverse(): internal path traversal failed
+ major: Symbol table
+ minor: Object not found
+ #004: (file name) line (number) in H5G_traverse_real(): special link traversal failed
+ major: Links
+ minor: Link traversal failure
+ #005: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed
+ major: Links
+ minor: Link traversal failure
+ #006: (file name) line (number) in H5G_traverse_ud(): traversal callback returned invalid ID
+ major: Symbol table
+ minor: Unable to find atom information (already closed?)
+ #007: (file name) line (number) in H5L_extern_traverse(): unable to open external file, external link file name = 'somefile', temp_file_name = 'somefile'
+ major: Links
+ minor: Unable to open file
diff --git a/tools/test/h5dump/errfiles/tall-2A.err b/tools/test/h5dump/errfiles/tall-2A.err
new file mode 100644
index 0000000..ab9dbe3
--- /dev/null
+++ b/tools/test/h5dump/errfiles/tall-2A.err
@@ -0,0 +1,25 @@
+HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
+ #000: (file name) line (number) in H5Oopen(): unable to open object
+ major: Object header
+ minor: Can't open object
+ #001: (file name) line (number) in H5O_open_name(): object not found
+ major: Object header
+ minor: Object not found
+ #002: (file name) line (number) in H5G_loc_find(): can't find object
+ major: Symbol table
+ minor: Object not found
+ #003: (file name) line (number) in H5G_traverse(): internal path traversal failed
+ major: Symbol table
+ minor: Object not found
+ #004: (file name) line (number) in H5G_traverse_real(): special link traversal failed
+ major: Links
+ minor: Link traversal failure
+ #005: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed
+ major: Links
+ minor: Link traversal failure
+ #006: (file name) line (number) in H5G_traverse_ud(): traversal callback returned invalid ID
+ major: Symbol table
+ minor: Unable to find atom information (already closed?)
+ #007: (file name) line (number) in H5L_extern_traverse(): unable to open external file, external link file name = 'somefile', temp_file_name = 'somefile'
+ major: Links
+ minor: Unable to open file
diff --git a/tools/test/h5dump/errfiles/tall-2A0.err b/tools/test/h5dump/errfiles/tall-2A0.err
new file mode 100644
index 0000000..ab9dbe3
--- /dev/null
+++ b/tools/test/h5dump/errfiles/tall-2A0.err
@@ -0,0 +1,25 @@
+HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
+ #000: (file name) line (number) in H5Oopen(): unable to open object
+ major: Object header
+ minor: Can't open object
+ #001: (file name) line (number) in H5O_open_name(): object not found
+ major: Object header
+ minor: Object not found
+ #002: (file name) line (number) in H5G_loc_find(): can't find object
+ major: Symbol table
+ minor: Object not found
+ #003: (file name) line (number) in H5G_traverse(): internal path traversal failed
+ major: Symbol table
+ minor: Object not found
+ #004: (file name) line (number) in H5G_traverse_real(): special link traversal failed
+ major: Links
+ minor: Link traversal failure
+ #005: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed
+ major: Links
+ minor: Link traversal failure
+ #006: (file name) line (number) in H5G_traverse_ud(): traversal callback returned invalid ID
+ major: Symbol table
+ minor: Unable to find atom information (already closed?)
+ #007: (file name) line (number) in H5L_extern_traverse(): unable to open external file, external link file name = 'somefile', temp_file_name = 'somefile'
+ major: Links
+ minor: Unable to open file
diff --git a/tools/test/h5dump/errfiles/tall-2B.err b/tools/test/h5dump/errfiles/tall-2B.err
new file mode 100644
index 0000000..ab9dbe3
--- /dev/null
+++ b/tools/test/h5dump/errfiles/tall-2B.err
@@ -0,0 +1,25 @@
+HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
+ #000: (file name) line (number) in H5Oopen(): unable to open object
+ major: Object header
+ minor: Can't open object
+ #001: (file name) line (number) in H5O_open_name(): object not found
+ major: Object header
+ minor: Object not found
+ #002: (file name) line (number) in H5G_loc_find(): can't find object
+ major: Symbol table
+ minor: Object not found
+ #003: (file name) line (number) in H5G_traverse(): internal path traversal failed
+ major: Symbol table
+ minor: Object not found
+ #004: (file name) line (number) in H5G_traverse_real(): special link traversal failed
+ major: Links
+ minor: Link traversal failure
+ #005: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed
+ major: Links
+ minor: Link traversal failure
+ #006: (file name) line (number) in H5G_traverse_ud(): traversal callback returned invalid ID
+ major: Symbol table
+ minor: Unable to find atom information (already closed?)
+ #007: (file name) line (number) in H5L_extern_traverse(): unable to open external file, external link file name = 'somefile', temp_file_name = 'somefile'
+ major: Links
+ minor: Unable to open file
diff --git a/tools/test/h5dump/errfiles/tarray1_big.err b/tools/test/h5dump/errfiles/tarray1_big.err
new file mode 100644
index 0000000..7a0fd7b
--- /dev/null
+++ b/tools/test/h5dump/errfiles/tarray1_big.err
@@ -0,0 +1,31 @@
+HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
+ #000: (file name) line (number) in H5Rdereference2(): unable to dereference object
+ major: References
+ minor: Unable to initialize object
+ #001: (file name) line (number) in H5R_dereference(): Undefined reference pointer
+ major: Invalid arguments to routine
+ minor: Bad value
+HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
+ #000: (file name) line (number) in H5Rdereference2(): unable to dereference object
+ major: References
+ minor: Unable to initialize object
+ #001: (file name) line (number) in H5R_dereference(): Undefined reference pointer
+ major: Invalid arguments to routine
+ minor: Bad value
+HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
+ #000: (file name) line (number) in H5Rdereference2(): unable to dereference object
+ major: References
+ minor: Unable to initialize object
+ #001: (file name) line (number) in H5R_dereference(): Undefined reference pointer
+ major: Invalid arguments to routine
+ minor: Bad value
+H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs):
+ #000: (file name) line (number) in h5tools_dump_simple_data(): H5Rdereference failed
+ major: Failure in tools library
+ minor: error in function
+ #001: (file name) line (number) in h5tools_dump_simple_data(): H5Rdereference failed
+ major: Failure in tools library
+ minor: error in function
+ #002: (file name) line (number) in h5tools_dump_simple_data(): H5Rdereference failed
+ major: Failure in tools library
+ minor: error in function
diff --git a/tools/test/h5dump/errfiles/tattr-3.err b/tools/test/h5dump/errfiles/tattr-3.err
new file mode 100644
index 0000000..ce8ddda
--- /dev/null
+++ b/tools/test/h5dump/errfiles/tattr-3.err
@@ -0,0 +1,8 @@
+HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
+ #000: (file name) line (number) in H5Aopen(): unable to load attribute info from object header for attribute: 'attr'
+ major: Attribute
+ minor: Unable to initialize object
+ #001: (file name) line (number) in H5O_attr_open_by_name(): can't locate attribute: 'attr'
+ major: Attribute
+ minor: Object not found
+h5dump error: unable to open attribute "attr"
diff --git a/tools/test/h5dump/errfiles/tattrregR.err b/tools/test/h5dump/errfiles/tattrregR.err
new file mode 100644
index 0000000..9449a6d
--- /dev/null
+++ b/tools/test/h5dump/errfiles/tattrregR.err
@@ -0,0 +1,21 @@
+HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
+ #000: (file name) line (number) in H5Rdereference2(): unable to dereference object
+ major: References
+ minor: Unable to initialize object
+ #001: (file name) line (number) in H5R_dereference(): Undefined reference pointer
+ major: Invalid arguments to routine
+ minor: Bad value
+HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
+ #000: (file name) line (number) in H5Rdereference2(): unable to dereference object
+ major: References
+ minor: Unable to initialize object
+ #001: (file name) line (number) in H5R_dereference(): Undefined reference pointer
+ major: Invalid arguments to routine
+ minor: Bad value
+H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs):
+ #000: (file name) line (number) in h5tools_dump_simple_data(): H5Rdereference failed
+ major: Failure in tools library
+ minor: error in function
+ #001: (file name) line (number) in h5tools_dump_simple_data(): H5Rdereference failed
+ major: Failure in tools library
+ minor: error in function
diff --git a/tools/test/h5dump/errfiles/tcomp-3.err b/tools/test/h5dump/errfiles/tcomp-3.err
new file mode 100644
index 0000000..ee47ee5
--- /dev/null
+++ b/tools/test/h5dump/errfiles/tcomp-3.err
@@ -0,0 +1,16 @@
+HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
+ #000: (file name) line (number) in H5Topen2(): not found
+ major: Datatype
+ minor: Object not found
+ #001: (file name) line (number) in H5G_loc_find(): can't find object
+ major: Symbol table
+ minor: Object not found
+ #002: (file name) line (number) in H5G_traverse(): internal path traversal failed
+ major: Symbol table
+ minor: Object not found
+ #003: (file name) line (number) in H5G_traverse_real(): traversal operator failed
+ major: Symbol table
+ minor: Callback failed
+ #004: (file name) line (number) in H5G_loc_find_cb(): object '#6632' doesn't exist
+ major: Symbol table
+ minor: Object not found
diff --git a/tools/test/h5dump/errfiles/tdataregR.err b/tools/test/h5dump/errfiles/tdataregR.err
new file mode 100644
index 0000000..9449a6d
--- /dev/null
+++ b/tools/test/h5dump/errfiles/tdataregR.err
@@ -0,0 +1,21 @@
+HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
+ #000: (file name) line (number) in H5Rdereference2(): unable to dereference object
+ major: References
+ minor: Unable to initialize object
+ #001: (file name) line (number) in H5R_dereference(): Undefined reference pointer
+ major: Invalid arguments to routine
+ minor: Bad value
+HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
+ #000: (file name) line (number) in H5Rdereference2(): unable to dereference object
+ major: References
+ minor: Unable to initialize object
+ #001: (file name) line (number) in H5R_dereference(): Undefined reference pointer
+ major: Invalid arguments to routine
+ minor: Bad value
+H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs):
+ #000: (file name) line (number) in h5tools_dump_simple_data(): H5Rdereference failed
+ major: Failure in tools library
+ minor: error in function
+ #001: (file name) line (number) in h5tools_dump_simple_data(): H5Rdereference failed
+ major: Failure in tools library
+ minor: error in function
diff --git a/tools/test/h5dump/errfiles/tdset-2.err b/tools/test/h5dump/errfiles/tdset-2.err
new file mode 100644
index 0000000..e594c1b
--- /dev/null
+++ b/tools/test/h5dump/errfiles/tdset-2.err
@@ -0,0 +1,36 @@
+HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
+ #000: (file name) line (number) in H5Dopen2(): unable to open dataset
+ major: Dataset
+ minor: Can't open object
+ #001: (file name) line (number) in H5D__open_name(): not found
+ major: Dataset
+ minor: Object not found
+ #002: (file name) line (number) in H5G_loc_find(): can't find object
+ major: Symbol table
+ minor: Object not found
+ #003: (file name) line (number) in H5G_traverse(): internal path traversal failed
+ major: Symbol table
+ minor: Object not found
+ #004: (file name) line (number) in H5G_traverse_real(): traversal operator failed
+ major: Symbol table
+ minor: Callback failed
+ #005: (file name) line (number) in H5G_loc_find_cb(): object 'dset3' doesn't exist
+ major: Symbol table
+ minor: Object not found
+HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
+ #000: (file name) line (number) in H5Lget_info(): unable to get link info
+ major: Links
+ minor: Object not found
+ #001: (file name) line (number) in H5L_get_info(): name doesn't exist
+ major: Symbol table
+ minor: Object already exists
+ #002: (file name) line (number) in H5G_traverse(): internal path traversal failed
+ major: Symbol table
+ minor: Object not found
+ #003: (file name) line (number) in H5G_traverse_real(): traversal operator failed
+ major: Symbol table
+ minor: Callback failed
+ #004: (file name) line (number) in H5L_get_info_cb(): name doesn't exist
+ major: Symbol table
+ minor: Object not found
+h5dump error: unable to get link info from "dset3"
diff --git a/tools/test/h5dump/errfiles/texceedsubblock.err b/tools/test/h5dump/errfiles/texceedsubblock.err
new file mode 100644
index 0000000..4c87ab9
--- /dev/null
+++ b/tools/test/h5dump/errfiles/texceedsubblock.err
@@ -0,0 +1 @@
+h5dump error: number of block dims (2) exceed dataset dims (1)
diff --git a/tools/test/h5dump/errfiles/texceedsubcount.err b/tools/test/h5dump/errfiles/texceedsubcount.err
new file mode 100644
index 0000000..de1c9d1
--- /dev/null
+++ b/tools/test/h5dump/errfiles/texceedsubcount.err
@@ -0,0 +1 @@
+h5dump error: number of count dims (2) exceed dataset dims (1)
diff --git a/tools/test/h5dump/errfiles/texceedsubstart.err b/tools/test/h5dump/errfiles/texceedsubstart.err
new file mode 100644
index 0000000..4555224
--- /dev/null
+++ b/tools/test/h5dump/errfiles/texceedsubstart.err
@@ -0,0 +1 @@
+h5dump error: number of start dims (2) exceed dataset dims (1)
diff --git a/tools/test/h5dump/errfiles/texceedsubstride.err b/tools/test/h5dump/errfiles/texceedsubstride.err
new file mode 100644
index 0000000..32d5725
--- /dev/null
+++ b/tools/test/h5dump/errfiles/texceedsubstride.err
@@ -0,0 +1 @@
+h5dump error: number of stride dims (2) exceed dataset dims (1)
diff --git a/tools/test/h5dump/errfiles/textlink.err b/tools/test/h5dump/errfiles/textlink.err
new file mode 100644
index 0000000..95556db
--- /dev/null
+++ b/tools/test/h5dump/errfiles/textlink.err
@@ -0,0 +1,50 @@
+HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
+ #000: (file name) line (number) in H5Oopen(): unable to open object
+ major: Object header
+ minor: Can't open object
+ #001: (file name) line (number) in H5O_open_name(): object not found
+ major: Object header
+ minor: Object not found
+ #002: (file name) line (number) in H5G_loc_find(): can't find object
+ major: Symbol table
+ minor: Object not found
+ #003: (file name) line (number) in H5G_traverse(): internal path traversal failed
+ major: Symbol table
+ minor: Object not found
+ #004: (file name) line (number) in H5G_traverse_real(): special link traversal failed
+ major: Links
+ minor: Link traversal failure
+ #005: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed
+ major: Links
+ minor: Link traversal failure
+ #006: (file name) line (number) in H5G_traverse_ud(): traversal callback returned invalid ID
+ major: Symbol table
+ minor: Unable to find atom information (already closed?)
+ #007: (file name) line (number) in H5L_extern_traverse(): unable to open external file, external link file name = 'filename', temp_file_name = 'filename'
+ major: Links
+ minor: Unable to open file
+HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
+ #000: (file name) line (number) in H5Oopen(): unable to open object
+ major: Object header
+ minor: Can't open object
+ #001: (file name) line (number) in H5O_open_name(): object not found
+ major: Object header
+ minor: Object not found
+ #002: (file name) line (number) in H5G_loc_find(): can't find object
+ major: Symbol table
+ minor: Object not found
+ #003: (file name) line (number) in H5G_traverse(): internal path traversal failed
+ major: Symbol table
+ minor: Object not found
+ #004: (file name) line (number) in H5G_traverse_real(): special link traversal failed
+ major: Links
+ minor: Link traversal failure
+ #005: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed
+ major: Links
+ minor: Link traversal failure
+ #006: (file name) line (number) in H5G_traverse_ud(): traversal callback returned invalid ID
+ major: Symbol table
+ minor: Unable to find atom information (already closed?)
+ #007: (file name) line (number) in H5L_extern_traverse(): unable to open external file, external link file name = 'anotherfile', temp_file_name = 'anotherfile'
+ major: Links
+ minor: Unable to open file
diff --git a/tools/test/h5dump/errfiles/textlinkfar.err b/tools/test/h5dump/errfiles/textlinkfar.err
new file mode 100644
index 0000000..5aa7f87
--- /dev/null
+++ b/tools/test/h5dump/errfiles/textlinkfar.err
@@ -0,0 +1,243 @@
+HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
+ #000: (file name) line (number) in H5Oopen(): unable to open object
+ major: Object header
+ minor: Can't open object
+ #001: (file name) line (number) in H5O_open_name(): object not found
+ major: Object header
+ minor: Object not found
+ #002: (file name) line (number) in H5G_loc_find(): can't find object
+ major: Symbol table
+ minor: Object not found
+ #003: (file name) line (number) in H5G_traverse(): internal path traversal failed
+ major: Symbol table
+ minor: Object not found
+ #004: (file name) line (number) in H5G_traverse_real(): special link traversal failed
+ major: Links
+ minor: Link traversal failure
+ #005: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed
+ major: Links
+ minor: Link traversal failure
+ #006: (file name) line (number) in H5G_traverse_ud(): traversal callback returned invalid ID
+ major: Symbol table
+ minor: Unable to find atom information (already closed?)
+ #007: (file name) line (number) in H5L_extern_traverse(): unable to open object
+ major: Symbol table
+ minor: Can't open object
+ #008: (file name) line (number) in H5O_open_name(): object not found
+ major: Object header
+ minor: Object not found
+ #009: (file name) line (number) in H5G_loc_find(): can't find object
+ major: Symbol table
+ minor: Object not found
+ #010: (file name) line (number) in H5G_traverse(): internal path traversal failed
+ major: Symbol table
+ minor: Object not found
+ #011: (file name) line (number) in H5G_traverse_real(): special link traversal failed
+ major: Links
+ minor: Link traversal failure
+ #012: (file name) line (number) in H5G__traverse_special(): symbolic link traversal failed
+ major: Links
+ minor: Link traversal failure
+ #013: (file name) line (number) in H5G_traverse_slink(): unable to follow symbolic link
+ major: Symbol table
+ minor: Object not found
+ #014: (file name) line (number) in H5G_traverse_real(): traversal operator failed
+ major: Symbol table
+ minor: Callback failed
+ #015: (file name) line (number) in H5G_traverse_slink_cb(): component not found
+ major: Symbol table
+ minor: Object not found
+HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
+ #000: (file name) line (number) in H5G_loc_find(): can't find object
+ major: Symbol table
+ minor: Object not found
+ #001: (file name) line (number) in H5G_traverse(): internal path traversal failed
+ major: Symbol table
+ minor: Object not found
+ #002: (file name) line (number) in H5G_traverse_real(): special link traversal failed
+ major: Links
+ minor: Link traversal failure
+ #003: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed
+ major: Links
+ minor: Link traversal failure
+ #004: (file name) line (number) in H5G_traverse_ud(): traversal callback returned invalid ID
+ major: Symbol table
+ minor: Unable to find atom information (already closed?)
+ #005: (file name) line (number) in H5L_extern_traverse(): unable to open object
+ major: Symbol table
+ minor: Can't open object
+ #006: (file name) line (number) in H5O_open_name(): object not found
+ major: Object header
+ minor: Object not found
+ #007: (file name) line (number) in H5G_loc_find(): can't find object
+ major: Symbol table
+ minor: Object not found
+ #008: (file name) line (number) in H5G_traverse(): internal path traversal failed
+ major: Symbol table
+ minor: Object not found
+ #009: (file name) line (number) in H5G_traverse_real(): special link traversal failed
+ major: Links
+ minor: Link traversal failure
+ #010: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed
+ major: Links
+ minor: Link traversal failure
+ #011: (file name) line (number) in H5G_traverse_ud(): traversal callback returned invalid ID
+ major: Symbol table
+ minor: Unable to find atom information (already closed?)
+ #012: (file name) line (number) in H5L_extern_traverse(): unable to open object
+ major: Symbol table
+ minor: Can't open object
+ #013: (file name) line (number) in H5O_open_name(): object not found
+ major: Object header
+ minor: Object not found
+ #014: (file name) line (number) in H5G_loc_find(): can't find object
+ major: Symbol table
+ minor: Object not found
+ #015: (file name) line (number) in H5G_traverse(): internal path traversal failed
+ major: Symbol table
+ minor: Object not found
+ #016: (file name) line (number) in H5G_traverse_real(): special link traversal failed
+ major: Links
+ minor: Link traversal failure
+ #017: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed
+ major: Links
+ minor: Link traversal failure
+ #018: (file name) line (number) in H5G_traverse_ud(): traversal callback returned invalid ID
+ major: Symbol table
+ minor: Unable to find atom information (already closed?)
+ #019: (file name) line (number) in H5L_extern_traverse(): unable to open object
+ major: Symbol table
+ minor: Can't open object
+ #020: (file name) line (number) in H5O_open_name(): object not found
+ major: Object header
+ minor: Object not found
+ #021: (file name) line (number) in H5G_loc_find(): can't find object
+ major: Symbol table
+ minor: Object not found
+ #022: (file name) line (number) in H5G_traverse(): internal path traversal failed
+ major: Symbol table
+ minor: Object not found
+ #023: (file name) line (number) in H5G_traverse_real(): special link traversal failed
+ major: Links
+ minor: Link traversal failure
+ #024: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed
+ major: Links
+ minor: Link traversal failure
+ #025: (file name) line (number) in H5G_traverse_ud(): traversal callback returned invalid ID
+ major: Symbol table
+ minor: Unable to find atom information (already closed?)
+ #026: (file name) line (number) in H5L_extern_traverse(): unable to open object
+ major: Symbol table
+ minor: Can't open object
+ #027: (file name) line (number) in H5O_open_name(): object not found
+ major: Object header
+ minor: Object not found
+ #028: (file name) line (number) in H5G_loc_find(): can't find object
+ major: Symbol table
+ minor: Object not found
+ #029: (file name) line (number) in H5G_traverse(): internal path traversal failed
+ major: Symbol table
+ minor: Object not found
+ #030: (file name) line (number) in H5G_traverse_real(): special link traversal failed
+ major: Links
+ minor: Link traversal failure
+ #031: (file name) line (number) in H5G__traverse_special(): too many links
+ major: Links
+ minor: Too many soft links in path
+HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
+ #000: (file name) line (number) in H5G_loc_find(): can't find object
+ major: Symbol table
+ minor: Object not found
+ #001: (file name) line (number) in H5G_traverse(): internal path traversal failed
+ major: Symbol table
+ minor: Object not found
+ #002: (file name) line (number) in H5G_traverse_real(): special link traversal failed
+ major: Links
+ minor: Link traversal failure
+ #003: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed
+ major: Links
+ minor: Link traversal failure
+ #004: (file name) line (number) in H5G_traverse_ud(): traversal callback returned invalid ID
+ major: Symbol table
+ minor: Unable to find atom information (already closed?)
+ #005: (file name) line (number) in H5L_extern_traverse(): unable to open object
+ major: Symbol table
+ minor: Can't open object
+ #006: (file name) line (number) in H5O_open_name(): object not found
+ major: Object header
+ minor: Object not found
+ #007: (file name) line (number) in H5G_loc_find(): can't find object
+ major: Symbol table
+ minor: Object not found
+ #008: (file name) line (number) in H5G_traverse(): internal path traversal failed
+ major: Symbol table
+ minor: Object not found
+ #009: (file name) line (number) in H5G_traverse_real(): special link traversal failed
+ major: Links
+ minor: Link traversal failure
+ #010: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed
+ major: Links
+ minor: Link traversal failure
+ #011: (file name) line (number) in H5G_traverse_ud(): traversal callback returned invalid ID
+ major: Symbol table
+ minor: Unable to find atom information (already closed?)
+ #012: (file name) line (number) in H5L_extern_traverse(): unable to open object
+ major: Symbol table
+ minor: Can't open object
+ #013: (file name) line (number) in H5O_open_name(): object not found
+ major: Object header
+ minor: Object not found
+ #014: (file name) line (number) in H5G_loc_find(): can't find object
+ major: Symbol table
+ minor: Object not found
+ #015: (file name) line (number) in H5G_traverse(): internal path traversal failed
+ major: Symbol table
+ minor: Object not found
+ #016: (file name) line (number) in H5G_traverse_real(): special link traversal failed
+ major: Links
+ minor: Link traversal failure
+ #017: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed
+ major: Links
+ minor: Link traversal failure
+ #018: (file name) line (number) in H5G_traverse_ud(): traversal callback returned invalid ID
+ major: Symbol table
+ minor: Unable to find atom information (already closed?)
+ #019: (file name) line (number) in H5L_extern_traverse(): unable to open object
+ major: Symbol table
+ minor: Can't open object
+ #020: (file name) line (number) in H5O_open_name(): object not found
+ major: Object header
+ minor: Object not found
+ #021: (file name) line (number) in H5G_loc_find(): can't find object
+ major: Symbol table
+ minor: Object not found
+ #022: (file name) line (number) in H5G_traverse(): internal path traversal failed
+ major: Symbol table
+ minor: Object not found
+ #023: (file name) line (number) in H5G_traverse_real(): special link traversal failed
+ major: Links
+ minor: Link traversal failure
+ #024: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed
+ major: Links
+ minor: Link traversal failure
+ #025: (file name) line (number) in H5G_traverse_ud(): traversal callback returned invalid ID
+ major: Symbol table
+ minor: Unable to find atom information (already closed?)
+ #026: (file name) line (number) in H5L_extern_traverse(): unable to open object
+ major: Symbol table
+ minor: Can't open object
+ #027: (file name) line (number) in H5O_open_name(): object not found
+ major: Object header
+ minor: Object not found
+ #028: (file name) line (number) in H5G_loc_find(): can't find object
+ major: Symbol table
+ minor: Object not found
+ #029: (file name) line (number) in H5G_traverse(): internal path traversal failed
+ major: Symbol table
+ minor: Object not found
+ #030: (file name) line (number) in H5G_traverse_real(): special link traversal failed
+ major: Links
+ minor: Link traversal failure
+ #031: (file name) line (number) in H5G__traverse_special(): too many links
+ major: Links
+ minor: Too many soft links in path
diff --git a/tools/test/h5dump/errfiles/textlinksrc.err b/tools/test/h5dump/errfiles/textlinksrc.err
new file mode 100644
index 0000000..5aa7f87
--- /dev/null
+++ b/tools/test/h5dump/errfiles/textlinksrc.err
@@ -0,0 +1,243 @@
+HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
+ #000: (file name) line (number) in H5Oopen(): unable to open object
+ major: Object header
+ minor: Can't open object
+ #001: (file name) line (number) in H5O_open_name(): object not found
+ major: Object header
+ minor: Object not found
+ #002: (file name) line (number) in H5G_loc_find(): can't find object
+ major: Symbol table
+ minor: Object not found
+ #003: (file name) line (number) in H5G_traverse(): internal path traversal failed
+ major: Symbol table
+ minor: Object not found
+ #004: (file name) line (number) in H5G_traverse_real(): special link traversal failed
+ major: Links
+ minor: Link traversal failure
+ #005: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed
+ major: Links
+ minor: Link traversal failure
+ #006: (file name) line (number) in H5G_traverse_ud(): traversal callback returned invalid ID
+ major: Symbol table
+ minor: Unable to find atom information (already closed?)
+ #007: (file name) line (number) in H5L_extern_traverse(): unable to open object
+ major: Symbol table
+ minor: Can't open object
+ #008: (file name) line (number) in H5O_open_name(): object not found
+ major: Object header
+ minor: Object not found
+ #009: (file name) line (number) in H5G_loc_find(): can't find object
+ major: Symbol table
+ minor: Object not found
+ #010: (file name) line (number) in H5G_traverse(): internal path traversal failed
+ major: Symbol table
+ minor: Object not found
+ #011: (file name) line (number) in H5G_traverse_real(): special link traversal failed
+ major: Links
+ minor: Link traversal failure
+ #012: (file name) line (number) in H5G__traverse_special(): symbolic link traversal failed
+ major: Links
+ minor: Link traversal failure
+ #013: (file name) line (number) in H5G_traverse_slink(): unable to follow symbolic link
+ major: Symbol table
+ minor: Object not found
+ #014: (file name) line (number) in H5G_traverse_real(): traversal operator failed
+ major: Symbol table
+ minor: Callback failed
+ #015: (file name) line (number) in H5G_traverse_slink_cb(): component not found
+ major: Symbol table
+ minor: Object not found
+HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
+ #000: (file name) line (number) in H5G_loc_find(): can't find object
+ major: Symbol table
+ minor: Object not found
+ #001: (file name) line (number) in H5G_traverse(): internal path traversal failed
+ major: Symbol table
+ minor: Object not found
+ #002: (file name) line (number) in H5G_traverse_real(): special link traversal failed
+ major: Links
+ minor: Link traversal failure
+ #003: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed
+ major: Links
+ minor: Link traversal failure
+ #004: (file name) line (number) in H5G_traverse_ud(): traversal callback returned invalid ID
+ major: Symbol table
+ minor: Unable to find atom information (already closed?)
+ #005: (file name) line (number) in H5L_extern_traverse(): unable to open object
+ major: Symbol table
+ minor: Can't open object
+ #006: (file name) line (number) in H5O_open_name(): object not found
+ major: Object header
+ minor: Object not found
+ #007: (file name) line (number) in H5G_loc_find(): can't find object
+ major: Symbol table
+ minor: Object not found
+ #008: (file name) line (number) in H5G_traverse(): internal path traversal failed
+ major: Symbol table
+ minor: Object not found
+ #009: (file name) line (number) in H5G_traverse_real(): special link traversal failed
+ major: Links
+ minor: Link traversal failure
+ #010: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed
+ major: Links
+ minor: Link traversal failure
+ #011: (file name) line (number) in H5G_traverse_ud(): traversal callback returned invalid ID
+ major: Symbol table
+ minor: Unable to find atom information (already closed?)
+ #012: (file name) line (number) in H5L_extern_traverse(): unable to open object
+ major: Symbol table
+ minor: Can't open object
+ #013: (file name) line (number) in H5O_open_name(): object not found
+ major: Object header
+ minor: Object not found
+ #014: (file name) line (number) in H5G_loc_find(): can't find object
+ major: Symbol table
+ minor: Object not found
+ #015: (file name) line (number) in H5G_traverse(): internal path traversal failed
+ major: Symbol table
+ minor: Object not found
+ #016: (file name) line (number) in H5G_traverse_real(): special link traversal failed
+ major: Links
+ minor: Link traversal failure
+ #017: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed
+ major: Links
+ minor: Link traversal failure
+ #018: (file name) line (number) in H5G_traverse_ud(): traversal callback returned invalid ID
+ major: Symbol table
+ minor: Unable to find atom information (already closed?)
+ #019: (file name) line (number) in H5L_extern_traverse(): unable to open object
+ major: Symbol table
+ minor: Can't open object
+ #020: (file name) line (number) in H5O_open_name(): object not found
+ major: Object header
+ minor: Object not found
+ #021: (file name) line (number) in H5G_loc_find(): can't find object
+ major: Symbol table
+ minor: Object not found
+ #022: (file name) line (number) in H5G_traverse(): internal path traversal failed
+ major: Symbol table
+ minor: Object not found
+ #023: (file name) line (number) in H5G_traverse_real(): special link traversal failed
+ major: Links
+ minor: Link traversal failure
+ #024: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed
+ major: Links
+ minor: Link traversal failure
+ #025: (file name) line (number) in H5G_traverse_ud(): traversal callback returned invalid ID
+ major: Symbol table
+ minor: Unable to find atom information (already closed?)
+ #026: (file name) line (number) in H5L_extern_traverse(): unable to open object
+ major: Symbol table
+ minor: Can't open object
+ #027: (file name) line (number) in H5O_open_name(): object not found
+ major: Object header
+ minor: Object not found
+ #028: (file name) line (number) in H5G_loc_find(): can't find object
+ major: Symbol table
+ minor: Object not found
+ #029: (file name) line (number) in H5G_traverse(): internal path traversal failed
+ major: Symbol table
+ minor: Object not found
+ #030: (file name) line (number) in H5G_traverse_real(): special link traversal failed
+ major: Links
+ minor: Link traversal failure
+ #031: (file name) line (number) in H5G__traverse_special(): too many links
+ major: Links
+ minor: Too many soft links in path
+HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
+ #000: (file name) line (number) in H5G_loc_find(): can't find object
+ major: Symbol table
+ minor: Object not found
+ #001: (file name) line (number) in H5G_traverse(): internal path traversal failed
+ major: Symbol table
+ minor: Object not found
+ #002: (file name) line (number) in H5G_traverse_real(): special link traversal failed
+ major: Links
+ minor: Link traversal failure
+ #003: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed
+ major: Links
+ minor: Link traversal failure
+ #004: (file name) line (number) in H5G_traverse_ud(): traversal callback returned invalid ID
+ major: Symbol table
+ minor: Unable to find atom information (already closed?)
+ #005: (file name) line (number) in H5L_extern_traverse(): unable to open object
+ major: Symbol table
+ minor: Can't open object
+ #006: (file name) line (number) in H5O_open_name(): object not found
+ major: Object header
+ minor: Object not found
+ #007: (file name) line (number) in H5G_loc_find(): can't find object
+ major: Symbol table
+ minor: Object not found
+ #008: (file name) line (number) in H5G_traverse(): internal path traversal failed
+ major: Symbol table
+ minor: Object not found
+ #009: (file name) line (number) in H5G_traverse_real(): special link traversal failed
+ major: Links
+ minor: Link traversal failure
+ #010: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed
+ major: Links
+ minor: Link traversal failure
+ #011: (file name) line (number) in H5G_traverse_ud(): traversal callback returned invalid ID
+ major: Symbol table
+ minor: Unable to find atom information (already closed?)
+ #012: (file name) line (number) in H5L_extern_traverse(): unable to open object
+ major: Symbol table
+ minor: Can't open object
+ #013: (file name) line (number) in H5O_open_name(): object not found
+ major: Object header
+ minor: Object not found
+ #014: (file name) line (number) in H5G_loc_find(): can't find object
+ major: Symbol table
+ minor: Object not found
+ #015: (file name) line (number) in H5G_traverse(): internal path traversal failed
+ major: Symbol table
+ minor: Object not found
+ #016: (file name) line (number) in H5G_traverse_real(): special link traversal failed
+ major: Links
+ minor: Link traversal failure
+ #017: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed
+ major: Links
+ minor: Link traversal failure
+ #018: (file name) line (number) in H5G_traverse_ud(): traversal callback returned invalid ID
+ major: Symbol table
+ minor: Unable to find atom information (already closed?)
+ #019: (file name) line (number) in H5L_extern_traverse(): unable to open object
+ major: Symbol table
+ minor: Can't open object
+ #020: (file name) line (number) in H5O_open_name(): object not found
+ major: Object header
+ minor: Object not found
+ #021: (file name) line (number) in H5G_loc_find(): can't find object
+ major: Symbol table
+ minor: Object not found
+ #022: (file name) line (number) in H5G_traverse(): internal path traversal failed
+ major: Symbol table
+ minor: Object not found
+ #023: (file name) line (number) in H5G_traverse_real(): special link traversal failed
+ major: Links
+ minor: Link traversal failure
+ #024: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed
+ major: Links
+ minor: Link traversal failure
+ #025: (file name) line (number) in H5G_traverse_ud(): traversal callback returned invalid ID
+ major: Symbol table
+ minor: Unable to find atom information (already closed?)
+ #026: (file name) line (number) in H5L_extern_traverse(): unable to open object
+ major: Symbol table
+ minor: Can't open object
+ #027: (file name) line (number) in H5O_open_name(): object not found
+ major: Object header
+ minor: Object not found
+ #028: (file name) line (number) in H5G_loc_find(): can't find object
+ major: Symbol table
+ minor: Object not found
+ #029: (file name) line (number) in H5G_traverse(): internal path traversal failed
+ major: Symbol table
+ minor: Object not found
+ #030: (file name) line (number) in H5G_traverse_real(): special link traversal failed
+ major: Links
+ minor: Link traversal failure
+ #031: (file name) line (number) in H5G__traverse_special(): too many links
+ major: Links
+ minor: Too many soft links in path
diff --git a/tools/test/h5dump/errfiles/tgroup-2.err b/tools/test/h5dump/errfiles/tgroup-2.err
new file mode 100644
index 0000000..3659b5c
--- /dev/null
+++ b/tools/test/h5dump/errfiles/tgroup-2.err
@@ -0,0 +1,20 @@
+HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
+ #000: (file name) line (number) in H5Gopen2(): unable to open group
+ major: Symbol table
+ minor: Can't open object
+ #001: (file name) line (number) in H5G__open_name(): group not found
+ major: Symbol table
+ minor: Object not found
+ #002: (file name) line (number) in H5G_loc_find(): can't find object
+ major: Symbol table
+ minor: Object not found
+ #003: (file name) line (number) in H5G_traverse(): internal path traversal failed
+ major: Symbol table
+ minor: Object not found
+ #004: (file name) line (number) in H5G_traverse_real(): traversal operator failed
+ major: Symbol table
+ minor: Callback failed
+ #005: (file name) line (number) in H5G_loc_find_cb(): object 'y' doesn't exist
+ major: Symbol table
+ minor: Object not found
+h5dump error: unable to open group "/y"
diff --git a/tools/test/h5dump/errfiles/tnofilename-with-packed-bits.err b/tools/test/h5dump/errfiles/tnofilename-with-packed-bits.err
new file mode 100644
index 0000000..84a7011
--- /dev/null
+++ b/tools/test/h5dump/errfiles/tnofilename-with-packed-bits.err
@@ -0,0 +1 @@
+h5dump error: missing file name
diff --git a/tools/test/h5dump/errfiles/torderlinks1.err b/tools/test/h5dump/errfiles/torderlinks1.err
new file mode 100644
index 0000000..e665f03
--- /dev/null
+++ b/tools/test/h5dump/errfiles/torderlinks1.err
@@ -0,0 +1,25 @@
+HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
+ #000: (file name) line (number) in H5Oopen(): unable to open object
+ major: Object header
+ minor: Can't open object
+ #001: (file name) line (number) in H5O_open_name(): object not found
+ major: Object header
+ minor: Object not found
+ #002: (file name) line (number) in H5G_loc_find(): can't find object
+ major: Symbol table
+ minor: Object not found
+ #003: (file name) line (number) in H5G_traverse(): internal path traversal failed
+ major: Symbol table
+ minor: Object not found
+ #004: (file name) line (number) in H5G_traverse_real(): special link traversal failed
+ major: Links
+ minor: Link traversal failure
+ #005: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed
+ major: Links
+ minor: Link traversal failure
+ #006: (file name) line (number) in H5G_traverse_ud(): traversal callback returned invalid ID
+ major: Symbol table
+ minor: Unable to find atom information (already closed?)
+ #007: (file name) line (number) in H5L_extern_traverse(): unable to open external file, external link file name = 'fname', temp_file_name = 'fname'
+ major: Links
+ minor: Unable to open file
diff --git a/tools/test/h5dump/errfiles/torderlinks2.err b/tools/test/h5dump/errfiles/torderlinks2.err
new file mode 100644
index 0000000..e665f03
--- /dev/null
+++ b/tools/test/h5dump/errfiles/torderlinks2.err
@@ -0,0 +1,25 @@
+HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
+ #000: (file name) line (number) in H5Oopen(): unable to open object
+ major: Object header
+ minor: Can't open object
+ #001: (file name) line (number) in H5O_open_name(): object not found
+ major: Object header
+ minor: Object not found
+ #002: (file name) line (number) in H5G_loc_find(): can't find object
+ major: Symbol table
+ minor: Object not found
+ #003: (file name) line (number) in H5G_traverse(): internal path traversal failed
+ major: Symbol table
+ minor: Object not found
+ #004: (file name) line (number) in H5G_traverse_real(): special link traversal failed
+ major: Links
+ minor: Link traversal failure
+ #005: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed
+ major: Links
+ minor: Link traversal failure
+ #006: (file name) line (number) in H5G_traverse_ud(): traversal callback returned invalid ID
+ major: Symbol table
+ minor: Unable to find atom information (already closed?)
+ #007: (file name) line (number) in H5L_extern_traverse(): unable to open external file, external link file name = 'fname', temp_file_name = 'fname'
+ major: Links
+ minor: Unable to open file
diff --git a/tools/test/h5dump/errfiles/tpbitsCharLengthExceeded.err b/tools/test/h5dump/errfiles/tpbitsCharLengthExceeded.err
new file mode 100644
index 0000000..e5854ea
--- /dev/null
+++ b/tools/test/h5dump/errfiles/tpbitsCharLengthExceeded.err
@@ -0,0 +1 @@
+h5dump error: Packed Bit offset+length value(9) too large. Max is 8
diff --git a/tools/test/h5dump/errfiles/tpbitsCharOffsetExceeded.err b/tools/test/h5dump/errfiles/tpbitsCharOffsetExceeded.err
new file mode 100644
index 0000000..e5854ea
--- /dev/null
+++ b/tools/test/h5dump/errfiles/tpbitsCharOffsetExceeded.err
@@ -0,0 +1 @@
+h5dump error: Packed Bit offset+length value(9) too large. Max is 8
diff --git a/tools/test/h5dump/errfiles/tpbitsIncomplete.err b/tools/test/h5dump/errfiles/tpbitsIncomplete.err
new file mode 100644
index 0000000..e0abee5
--- /dev/null
+++ b/tools/test/h5dump/errfiles/tpbitsIncomplete.err
@@ -0,0 +1 @@
+h5dump error: Bad mask list(0,2,2,1,0,2,2,)
diff --git a/tools/test/h5dump/errfiles/tpbitsIntLengthExceeded.err b/tools/test/h5dump/errfiles/tpbitsIntLengthExceeded.err
new file mode 100644
index 0000000..7dd88ed
--- /dev/null
+++ b/tools/test/h5dump/errfiles/tpbitsIntLengthExceeded.err
@@ -0,0 +1 @@
+h5dump error: Packed Bit offset+length value(17) too large. Max is 16
diff --git a/tools/test/h5dump/errfiles/tpbitsIntOffsetExceeded.err b/tools/test/h5dump/errfiles/tpbitsIntOffsetExceeded.err
new file mode 100644
index 0000000..7dd88ed
--- /dev/null
+++ b/tools/test/h5dump/errfiles/tpbitsIntOffsetExceeded.err
@@ -0,0 +1 @@
+h5dump error: Packed Bit offset+length value(17) too large. Max is 16
diff --git a/tools/test/h5dump/errfiles/tpbitsLengthExceeded.err b/tools/test/h5dump/errfiles/tpbitsLengthExceeded.err
new file mode 100644
index 0000000..d4673f2
--- /dev/null
+++ b/tools/test/h5dump/errfiles/tpbitsLengthExceeded.err
@@ -0,0 +1 @@
+h5dump error: Packed Bit offset+length value(65) too large. Max is 64
diff --git a/tools/test/h5dump/errfiles/tpbitsLengthPositive.err b/tools/test/h5dump/errfiles/tpbitsLengthPositive.err
new file mode 100644
index 0000000..4928007
--- /dev/null
+++ b/tools/test/h5dump/errfiles/tpbitsLengthPositive.err
@@ -0,0 +1 @@
+h5dump error: Packed Bit length value(0) must be positive.
diff --git a/tools/test/h5dump/errfiles/tpbitsLongLengthExceeded.err b/tools/test/h5dump/errfiles/tpbitsLongLengthExceeded.err
new file mode 100644
index 0000000..0318f79
--- /dev/null
+++ b/tools/test/h5dump/errfiles/tpbitsLongLengthExceeded.err
@@ -0,0 +1 @@
+h5dump error: Packed Bit offset+length value(33) too large. Max is 32
diff --git a/tools/test/h5dump/errfiles/tpbitsLongOffsetExceeded.err b/tools/test/h5dump/errfiles/tpbitsLongOffsetExceeded.err
new file mode 100644
index 0000000..0318f79
--- /dev/null
+++ b/tools/test/h5dump/errfiles/tpbitsLongOffsetExceeded.err
@@ -0,0 +1 @@
+h5dump error: Packed Bit offset+length value(33) too large. Max is 32
diff --git a/tools/test/h5dump/errfiles/tpbitsMaxExceeded.err b/tools/test/h5dump/errfiles/tpbitsMaxExceeded.err
new file mode 100644
index 0000000..a8d12fc
--- /dev/null
+++ b/tools/test/h5dump/errfiles/tpbitsMaxExceeded.err
@@ -0,0 +1 @@
+h5dump error: Too many masks requested (max. 8). Mask list(0,1,0,1,1,1,2,1,3,1,4,1,5,1,6,1,7,1)
diff --git a/tools/test/h5dump/errfiles/tpbitsOffsetExceeded.err b/tools/test/h5dump/errfiles/tpbitsOffsetExceeded.err
new file mode 100644
index 0000000..b7d6dad
--- /dev/null
+++ b/tools/test/h5dump/errfiles/tpbitsOffsetExceeded.err
@@ -0,0 +1 @@
+h5dump error: Packed Bit offset value(64) must be between 0 and 63
diff --git a/tools/test/h5dump/errfiles/tpbitsOffsetNegative.err b/tools/test/h5dump/errfiles/tpbitsOffsetNegative.err
new file mode 100644
index 0000000..8a027c1
--- /dev/null
+++ b/tools/test/h5dump/errfiles/tpbitsOffsetNegative.err
@@ -0,0 +1 @@
+h5dump error: Bad mask list(-1,1)
diff --git a/tools/test/h5dump/errfiles/tperror.err b/tools/test/h5dump/errfiles/tperror.err
new file mode 100644
index 0000000..b469029
--- /dev/null
+++ b/tools/test/h5dump/errfiles/tperror.err
@@ -0,0 +1,36 @@
+HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
+ #000: (file name) line (number) in H5Dopen2(): unable to open dataset
+ major: Dataset
+ minor: Can't open object
+ #001: (file name) line (number) in H5D__open_name(): not found
+ major: Dataset
+ minor: Object not found
+ #002: (file name) line (number) in H5G_loc_find(): can't find object
+ major: Symbol table
+ minor: Object not found
+ #003: (file name) line (number) in H5G_traverse(): internal path traversal failed
+ major: Symbol table
+ minor: Object not found
+ #004: (file name) line (number) in H5G_traverse_real(): traversal operator failed
+ major: Symbol table
+ minor: Callback failed
+ #005: (file name) line (number) in H5G_loc_find_cb(): object 'bogus' doesn't exist
+ major: Symbol table
+ minor: Object not found
+HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
+ #000: (file name) line (number) in H5Lget_info(): unable to get link info
+ major: Links
+ minor: Object not found
+ #001: (file name) line (number) in H5L_get_info(): name doesn't exist
+ major: Symbol table
+ minor: Object already exists
+ #002: (file name) line (number) in H5G_traverse(): internal path traversal failed
+ major: Symbol table
+ minor: Object not found
+ #003: (file name) line (number) in H5G_traverse_real(): traversal operator failed
+ major: Symbol table
+ minor: Callback failed
+ #004: (file name) line (number) in H5L_get_info_cb(): name doesn't exist
+ major: Symbol table
+ minor: Object not found
+h5dump error: unable to get link info from "bogus"
diff --git a/tools/test/h5dump/errfiles/tqmarkfile.err b/tools/test/h5dump/errfiles/tqmarkfile.err
new file mode 100644
index 0000000..06519fb
--- /dev/null
+++ b/tools/test/h5dump/errfiles/tqmarkfile.err
@@ -0,0 +1,33 @@
+HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
+ #000: (file name) line (number) in H5Dopen2(): not found
+ major: Dataset
+ minor: Object not found
+ #001: (file name) line (number) in H5G_loc_find(): can't find object
+ major: Symbol table
+ minor: Object not found
+ #002: (file name) line (number) in H5G_traverse(): internal path traversal failed
+ major: Symbol table
+ minor: Object not found
+ #003: (file name) line (number) in H5G_traverse_real(): traversal operator failed
+ major: Symbol table
+ minor: Callback failed
+ #004: (file name) line (number) in H5G_loc_find_cb(): object 'Dataset1' doesn't exist
+ major: Symbol table
+ minor: Object not found
+HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
+ #000: (file name) line (number) in H5Lget_info(): unable to get link info
+ major: Symbol table
+ minor: Object not found
+ #001: (file name) line (number) in H5L_get_info(): name doesn't exist
+ major: Symbol table
+ minor: Object already exists
+ #002: (file name) line (number) in H5G_traverse(): internal path traversal failed
+ major: Symbol table
+ minor: Object not found
+ #003: (file name) line (number) in H5G_traverse_real(): traversal operator failed
+ major: Symbol table
+ minor: Callback failed
+ #004: (file name) line (number) in H5L_get_info_cb(): name doesn't exist
+ major: Symbol table
+ minor: Object not found
+h5dump error: unable to get link info from "Dataset1"
diff --git a/tools/test/h5dump/errfiles/tslink-D.err b/tools/test/h5dump/errfiles/tslink-D.err
new file mode 100644
index 0000000..924e9cf
--- /dev/null
+++ b/tools/test/h5dump/errfiles/tslink-D.err
@@ -0,0 +1,28 @@
+HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
+ #000: (file name) line (number) in H5Dopen2(): unable to open dataset
+ major: Dataset
+ minor: Can't open object
+ #001: (file name) line (number) in H5D__open_name(): not found
+ major: Dataset
+ minor: Object not found
+ #002: (file name) line (number) in H5G_loc_find(): can't find object
+ major: Symbol table
+ minor: Object not found
+ #003: (file name) line (number) in H5G_traverse(): internal path traversal failed
+ major: Symbol table
+ minor: Object not found
+ #004: (file name) line (number) in H5G_traverse_real(): special link traversal failed
+ major: Links
+ minor: Link traversal failure
+ #005: (file name) line (number) in H5G__traverse_special(): symbolic link traversal failed
+ major: Links
+ minor: Link traversal failure
+ #006: (file name) line (number) in H5G_traverse_slink(): unable to follow symbolic link
+ major: Symbol table
+ minor: Object not found
+ #007: (file name) line (number) in H5G_traverse_real(): traversal operator failed
+ major: Symbol table
+ minor: Callback failed
+ #008: (file name) line (number) in H5G_traverse_slink_cb(): component not found
+ major: Symbol table
+ minor: Object not found
diff --git a/tools/test/h5dump/h5dumpgentest.c b/tools/test/h5dump/h5dumpgentest.c
new file mode 100644
index 0000000..bbec813
--- /dev/null
+++ b/tools/test/h5dump/h5dumpgentest.c
@@ -0,0 +1,10388 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Generate the binary hdf5 files for the h5dump tests.
+ * Usage: just execute the program without any arguments will
+ * generate all the binary hdf5 files in the local directory.
+ *
+ * If you regenerate the test files (e.g., changing some code,
+ * trying it on a new platform, ...), you need to verify the correctness
+ * of the expected output and update the corresponding *.ddl files.
+ */
+#include <limits.h>
+
+#include "hdf5.h"
+#include "H5private.h"
+#include "h5tools.h"
+
+#define FILE1 "tgroup.h5"
+#define FILE2 "tdset.h5"
+#define FILE3 "tattr.h5"
+#define FILE4 "tslink.h5"
+#define FILE4_1 "tsoftlinks.h5"
+#define FILE5 "thlink.h5"
+#define FILE6 "tcompound.h5"
+#define FILE7 "tall.h5"
+#define FILE8 "tdset2.h5"
+#define FILE9 "tcompound2.h5"
+#define FILE10 "tloop.h5"
+#define FILE11 "tloop2.h5"
+#define FILE12 "tmany.h5"
+#define FILE13 "tstr.h5"
+#define FILE14 "tstr2.h5"
+#define FILE15 "tenum.h5"
+#define FILE16 "tobjref.h5"
+#define FILE17 "tdatareg.h5"
+#define FILE18 "tnestedcomp.h5"
+#define FILE19 "topaque.h5"
+#define FILE20 "tbitfields.h5"
+#define FILE21 "tvldtypes1.h5"
+#define FILE22 "tvldtypes2.h5"
+#define FILE23 "tvldtypes3.h5"
+#define FILE24 "tvldtypes4.h5"
+#define FILE25 "tarray1.h5"
+#define FILE25_BIG "tarray1_big.h5"
+#define FILE26 "tarray2.h5"
+#define FILE27 "tarray3.h5"
+#define FILE28 "tarray4.h5"
+#define FILE29 "tarray5.h5"
+#define FILE30 "tarray6.h5"
+#define FILE31 "tarray7.h5"
+#define FILE32 "tempty.h5"
+#define FILE33 "tgrp_comments.h5"
+#define FILE34 "tsplit_file"
+#define FILE35 "tfamily%05d.h5"
+#define FILE36 "tmulti"
+#define FILE37 "tlarge_objname.h5"
+#define FILE38 "tvlstr.h5"
+#define FILE39 "tchar.h5"
+#define FILE40 "tattr2.h5"
+#define FILE41 "tcompound_complex.h5"
+#define FILE42 "tnamed_dtype_attr.h5"
+#define FILE43 "tvldtypes5.h5"
+#define FILE44 "tfilters.h5"
+#define FILE45 "tnullspace.h5"
+#define FILE46 "tfcontents1.h5"
+#define FILE47 "tfcontents2.h5"
+#define FILE48 "tfvalues.h5"
+#define FILE49 "tstr3.h5"
+#define FILE50 "taindices.h5"
+#define FILE51 "tlonglinks.h5"
+#define FILE52 "tldouble.h5"
+#define FILE53 "textlink.h5"
+#define FILE54 "tudlink.h5"
+#define FILE55 "tbinary.h5"
+#define FILE56 "tbigdims.h5"
+#define FILE57 "thyperslab.h5"
+#define FILE58 "tordergr.h5"
+#define FILE59 "torderattr.h5"
+#define FILE60 "tfpformat.h5"
+#define FILE61 "textlinksrc.h5"
+#define FILE62 "textlinktar.h5"
+#define FILE63 "textlinkfar.h5"
+#define FILE64 "tattrreg.h5"
+#define FILE65 "file_space.h5"
+#define FILE66 "packedbits.h5"
+#define FILE67 "zerodim.h5"
+#define FILE68 "charsets.h5"
+#define FILE68a "tdset_idx.h5"
+#define FILE69 "tattrintsize.h5"
+#define FILE70 "tcmpdintsize.h5"
+#define FILE71 "tcmpdattrintsize.h5"
+#define FILE72 "tnestedcmpddt.h5"
+#define FILE73 "tscalarintsize.h5"
+#define FILE74 "tscalarattrintsize.h5"
+#define FILE75 "tscalarstring.h5"
+#define FILE76 "tcmpdintarray.h5"
+#define FILE77 "tcmpdints.h5"
+#define FILE78 "tscalarintattrsize.h5"
+#define FILE79 "tintsattrs.h5"
+#define FILE80 "tbitnopaque.h5"
+#define FILE81 "tints4dims.h5"
+#define FILE82 "tcompound_complex2.h5"
+#define FILE83 "tvlenstr_array.h5"
+
+/*-------------------------------------------------------------------------
+ * prototypes
+ *-------------------------------------------------------------------------
+ */
+
+/* utility functions */
+static int
+make_dset(hid_t loc_id, const char *name, hid_t sid, hid_t tid, hid_t dcpl, void *buf);
+static int
+write_attr(hid_t loc_id, int rank, hsize_t *dims, const char *attr_name,
+ hid_t tid, void *buf);
+static int
+write_dset( hid_t loc_id, int rank, hsize_t *dims, const char *dset_name,
+ hid_t tid, void *buf );
+
+/* a filter operation callback function */
+static size_t
+myfilter(unsigned int H5_ATTR_UNUSED flags, size_t H5_ATTR_UNUSED cd_nelmts,
+ const unsigned int H5_ATTR_UNUSED *cd_values, size_t nbytes,
+ size_t H5_ATTR_UNUSED *buf_size, void H5_ATTR_UNUSED **buf);
+
+/* a "set local" callback */
+static herr_t
+set_local_myfilter(hid_t dcpl_id, hid_t tid, hid_t H5_ATTR_UNUSED sid);
+
+#define MYFILTER_ID 405
+
+/* This message derives from H5Z */
+const H5Z_class2_t H5Z_MYFILTER[1] = {{
+ H5Z_CLASS_T_VERS,
+ MYFILTER_ID, /* Filter id number */
+ 1, 1,
+ "myfilter", /* Filter name for debugging */
+ NULL, /* The "can apply" callback */
+ set_local_myfilter, /* The "set local" callback */
+ myfilter, /* The actual filter function */
+}};
+
+
+/* A UD link traversal function. Shouldn't actually be called. */
+static hid_t UD_traverse(H5_ATTR_UNUSED const char * link_name, H5_ATTR_UNUSED hid_t cur_group,
+ H5_ATTR_UNUSED const void * udata, H5_ATTR_UNUSED size_t udata_size, H5_ATTR_UNUSED hid_t lapl_id)
+{
+ return -1;
+}
+
+#define MY_LINKCLASS 187
+
+const H5L_class_t UD_link_class[1] = {{
+ H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */
+ (H5L_type_t)MY_LINKCLASS, /* Link type id number */
+ "UD link class", /* name for debugging */
+ NULL, /* Creation callback */
+ NULL, /* Move/rename callback */
+ NULL, /* Copy callback */
+ UD_traverse, /* The actual traversal function */
+ NULL, /* Deletion callback */
+ NULL /* Query callback */
+}};
+
+
+#define LENSTR 50
+#define LENSTR2 11
+
+#define SPACE2_RANK 2
+#define SPACE2_DIM1 10
+#define SPACE2_DIM2 10
+
+#define SPACE1_RANK 1
+#define SPACE1_DIM1 4
+
+#define DIM1 20
+#define DIM2 10
+#define CDIM1 DIM1/2
+#define CDIM2 DIM2/2
+#define RANK 2
+
+/* Dataspace of 0 dimension size */
+#define SPACE3_RANK 2
+#define SPACE3_DIM1 0
+#define SPACE3_DIM2 0
+
+/* Element selection information */
+#define POINT1_NPOINTS 10
+
+typedef enum{
+ RED,
+ GREEN,
+ BLUE,
+ WHITE,
+ BLACK
+} enumtype;
+
+/* Compound datatype */
+typedef struct s1_t {
+ unsigned int a;
+ unsigned int b;
+ float c;
+} s1_t;
+
+
+/* 1-D array datatype */
+#define ARRAY1_RANK 1
+#define ARRAY1_DIM1 4
+
+/* 3-D array datatype */
+#define ARRAY2_RANK 3
+#define ARRAY2_DIM1 3
+#define ARRAY2_DIM2 4
+#define ARRAY2_DIM3 5
+
+/* 2-D array datatype */
+#define ARRAY3_RANK 2
+#define ARRAY3_DIM1 6
+#define ARRAY3_DIM2 3
+
+/* VL string datatype name */
+/* TODO remove complier error not used, remove the link when everything is OK */
+/* #define VLSTR_TYPE "vl_string_type" */
+
+/* "File 41" macros */
+/* Name of dataset to create in datafile */
+#define F41_DATASETNAME "CompoundComplex"
+/* Dataset dimensions */
+#define F41_LENGTH 6
+#define F41_RANK 1
+#define F41_ARRAY_RANK 1
+#define F41_ARRAY_RANKd 2
+#define F41_DIMb 4
+#define F41_ARRAY_DIMc 6
+#define F41_ARRAY_DIMd1 5
+#define F41_ARRAY_DIMd2 6
+#define F41_ARRAY_DIMf 10
+
+/* "File 42" macros */
+/* Name of dataset to create in datafile */
+#define F42_DSETNAME "Dataset"
+#define F42_TYPENAME "Datatype"
+#define F42_ATTRNAME "Attribute"
+#define F42_LINKNAME "Link_to_Datatype"
+
+/* "File 43" macros */
+/* Name of dataset to create in datafile */
+#define F43_DSETNAME "Dataset"
+
+/* "File 51" macros */
+#define F51_MAX_NAME_LEN ((64*1024)+1024)
+
+/* "File 64" macros */
+#define F64_FILE "tarray8.h5"
+#define F64_DATASET "DS1"
+#define F64_DIM0 1
+#define F64_ARRAY_BUF_LEN (4*1024)
+#define F64_DIM1 (F64_ARRAY_BUF_LEN / sizeof(int) + 1)
+
+/* File 65 macros */
+#define STRATEGY H5F_FILE_SPACE_AGGR_VFD /* File space handling strategy */
+#define THRESHOLD10 10 /* Free space section threshold */
+
+/* "FILE66" macros and for FILE69 */
+#define F66_XDIM 8
+#define F66_DATASETU08 "DU08BITS"
+#define F66_DATASETS08 "DS08BITS"
+#define F66_YDIM8 8
+#define F66_DATASETU16 "DU16BITS"
+#define F66_DATASETS16 "DS16BITS"
+#define F66_YDIM16 16
+#define F66_DATASETU32 "DU32BITS"
+#define F66_DATASETS32 "DS32BITS"
+#define F66_YDIM32 32
+#define F66_DATASETU64 "DU64BITS"
+#define F66_DATASETS64 "DS64BITS"
+#define F66_YDIM64 64
+#define F66_DUMMYDBL "DummyDBL"
+
+/* Declarations for gent_dataset_idx() for "FILE68a" */
+#define F68a_DSET_FIXED "dset_fixed"
+#define F68a_DSET_FIXED_FILTER "dset_filter"
+#define F68a_DSET_BTREE "dset_btree"
+#define F68a_DIM200 200
+#define F68a_DIM100 100
+#define F68a_DIM20 20
+#define F68a_DIM10 10
+#define F68a_CHUNK 5
+
+/* "FILE70" macros and for FILE71 */
+/* Name of dataset to create in datafile */
+#define F70_DATASETNAME "CompoundIntSize"
+#define F70_LENGTH 4
+#define F70_RANK 1
+#define F70_ARRAY_RANK 2
+#define F70_XDIM 8
+#define F70_DATASETU08 "DU08BITS"
+#define F70_DATASETS08 "DS08BITS"
+#define F70_YDIM8 8
+#define F70_DATASETU16 "DU16BITS"
+#define F70_DATASETS16 "DS16BITS"
+#define F70_YDIM16 16
+#define F70_DATASETU32 "DU32BITS"
+#define F70_DATASETS32 "DS32BITS"
+#define F70_YDIM32 32
+#define F70_DATASETU64 "DU64BITS"
+#define F70_DATASETS64 "DS64BITS"
+#define F70_YDIM64 64
+#define F70_DUMMYDBL "DummyDBL"
+/* Name of dataset to create in datafile */
+#define F71_DATASETNAME "CompoundAttrIntSize"
+
+/* "FILE73" macros and for FILE69 and FILE78 */
+#define F73_ARRAY_RANK 2
+#define F73_XDIM 8
+#define F73_DATASETU08 "DU08BITS"
+#define F73_DATASETS08 "DS08BITS"
+#define F73_YDIM8 8
+#define F73_DATASETU16 "DU16BITS"
+#define F73_DATASETS16 "DS16BITS"
+#define F73_YDIM16 16
+#define F73_DATASETU32 "DU32BITS"
+#define F73_DATASETS32 "DS32BITS"
+#define F73_YDIM32 32
+#define F73_DATASETU64 "DU64BITS"
+#define F73_DATASETS64 "DS64BITS"
+#define F73_YDIM64 64
+#define F73_DUMMYDBL "DummyDBL"
+
+/* "FILE76 and FILE77 */
+/* Name of dataset to create in datafile */
+#define F76_DATASETNAME "CompoundIntArray"
+#define F76_LENGTH 4
+#define F76_RANK 1
+#define F76_ARRAY_RANK 1
+#define F76_DATASETU08 "DU08BITS"
+#define F76_DATASETS08 "DS08BITS"
+#define F76_DIM8 8
+#define F76_DATASETU16 "DU16BITS"
+#define F76_DATASETS16 "DS16BITS"
+#define F76_DIM16 16
+#define F76_DATASETU32 "DU32BITS"
+#define F76_DATASETS32 "DS32BITS"
+#define F76_DIM32 32
+#define F76_DATASETU64 "DU64BITS"
+#define F76_DATASETS64 "DS64BITS"
+#define F76_DIM64 64
+#define F76_DUMMYDBL "DummyDBL"
+/* Name of dataset to create in datafile */
+#define F77_DATASETNAME1 "CompoundInts"
+#define F77_DATASETNAME2 "CompoundRInts"
+#define F77_LENGTH 64
+
+#define F80_DIM32 32
+
+#define F81_DATASETNAME "FourDimInts"
+#define F81_RANK 4
+#define F81_WDIM 10
+#define F81_XDIM 8
+#define F81_YDIM 6
+#define F81_ZDIM 4
+
+/* "File 82" macros */
+/* Name of dataset to create in datafile */
+#define F82_DATASETNAME "CompoundComplex1D"
+/* Dataset dimensions */
+#define F82_DIM32 32
+#define F82_RANK 1
+//#define F82_RANK2 2
+//#define F82_RANK3 3
+//#define F82_RANK4 4
+
+/* "File 83" macros */
+/* Name of dataset to create in datafile */
+#define F83_DATASETNAME "ScalarArrayOfVlenStr"
+#define F83_DATASETNAME2 "CompoundArrayOfVlenStr"
+/* Dataset dimensions */
+#define F83_DIM 5
+#define F83_RANK 1
+#define F83_ARRAYDIM 3
+
+static void
+gent_group(void)
+{
+ hid_t fid, group;
+
+ fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* / */
+ group = H5Gcreate2(fid, "/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
+ group = H5Gcreate2(fid, "/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
+ group = H5Gcreate2(fid, "/g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
+
+ /* /g1 */
+ group = H5Gcreate2(fid, "/g1/g1.1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
+ group = H5Gcreate2(fid, "/g1/g1.2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
+
+ /* /g2 */
+ group = H5Gcreate2(fid, "/g2/g2.1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
+
+ /* /g3 */
+ group = H5Gcreate2(fid, "/g3/g3.1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
+ group = H5Gcreate2(fid, "/g3/g3.2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
+ group = H5Gcreate2(fid, "/g3/g3.3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
+ group = H5Gcreate2(fid, "/g3/g3.4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
+
+ /* /g2/g2.1 */
+ group = H5Gcreate2(fid, "/g2/g2.1/g2.1.1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
+ group = H5Gcreate2(fid, "/g2/g2.1/g2.1.2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
+ group = H5Gcreate2(fid, "/g2/g2.1/g2.1.3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
+
+ H5Fclose(fid);
+}
+
+static void
+gent_dataset(void)
+{
+ hid_t fid, dataset, space;
+ hsize_t dims[2];
+ int dset1[10][20];
+ double dset2[30][20];
+ int i, j;
+
+ fid = H5Fcreate(FILE2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* dset1 */
+ dims[0] = 10; dims[1] = 20;
+ space = H5Screate_simple(2, dims, NULL);
+ dataset = H5Dcreate2(fid, "/dset1", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ for(i = 0; i < 10; i++)
+ for(j = 0; j < 20; j++)
+ dset1[i][j] = j + i;
+
+ H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset1);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+ /* dset2 */
+ dims[0] = 30; dims[1] = 20;
+ space = H5Screate_simple(2, dims, NULL);
+ dataset = H5Dcreate2(fid, "/dset2", H5T_IEEE_F64BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ for(i = 0; i < 30; i++)
+ for(j = 0; j < 20; j++)
+ dset2[i][j] = 0.0001F * (float)j + (float)i;
+
+ H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2);
+
+ H5Sclose(space);
+ H5Dclose(dataset);
+ H5Fclose(fid);
+}
+
+static void
+gent_dataset2(void)
+{
+ hid_t fid, dataset, space, create_plist;
+ hsize_t dims[2];
+ hsize_t maxdims[2];
+ int dset1[10][20];
+ double dset2[30][10];
+ int i, j;
+
+ fid = H5Fcreate(FILE8, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ create_plist = H5Pcreate(H5P_DATASET_CREATE);
+ dims[0] = 5; dims[1] = 5;
+ H5Pset_chunk(create_plist, 2, dims);
+
+ /* dset1 */
+ dims[0] = 10; dims[1] = 20;
+ maxdims[0] = H5S_UNLIMITED; maxdims[1] = 20;
+ space = H5Screate_simple(2, dims, maxdims);
+ dataset = H5Dcreate2(fid, "/dset1", H5T_STD_I32BE, space, H5P_DEFAULT, create_plist, H5P_DEFAULT);
+
+ for(i = 0; i < 10; i++)
+ for(j = 0; j < 20; j++)
+ dset1[i][j] = j;
+
+ H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset1);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+ /* dset2 */
+ dims[0] = 30; dims[1] = 10;
+ maxdims[0] = 30; maxdims[1] = H5S_UNLIMITED;
+ space = H5Screate_simple(2, dims, maxdims);
+ dataset = H5Dcreate2(fid, "/dset2", H5T_IEEE_F64BE, space, H5P_DEFAULT, create_plist, H5P_DEFAULT);
+
+ for(i = 0; i < 30; i++)
+ for(j = 0; j < 10; j++)
+ dset2[i][j] = j;
+
+ H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2);
+
+ H5Sclose(space);
+ H5Dclose(dataset);
+ H5Pclose(create_plist);
+ H5Fclose(fid);
+}
+
+static void
+gent_attribute(void)
+{
+ hid_t fid, root, space, attr, type;
+ hsize_t dims[2];
+ char buf[60];
+ int i, data[10];
+ double d[10];
+ char string[]= "string attribute";
+ int point = 100;
+
+ fid = H5Fcreate(FILE3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ root = H5Gopen2(fid, "/", H5P_DEFAULT);
+
+ /* attribute 1 */
+ dims[0] = 24;
+ space = H5Screate_simple(1, dims, NULL);
+ attr = H5Acreate2(root, "/attr1", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT);
+ sprintf(buf, "attribute of root group");
+ H5Awrite(attr, H5T_NATIVE_SCHAR, buf);
+ H5Sclose(space);
+ H5Aclose(attr);
+
+ /* attribute 2 */
+ dims[0] = 10;
+ space = H5Screate_simple(1, dims, NULL);
+ attr = H5Acreate2(root, "attr2", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT);
+
+ for(i = 0; i < 10; i++) data[i] = i+1;
+
+ H5Awrite(attr, H5T_NATIVE_INT, data);
+ H5Sclose(space);
+ H5Aclose(attr);
+
+ /* attribute 3 */
+ dims[0] = 10;
+ space = H5Screate_simple(1, dims, NULL);
+ attr = H5Acreate2(root, "attr3", H5T_IEEE_F64BE, space, H5P_DEFAULT, H5P_DEFAULT);
+
+ for(i = 0; i < 10; i++) d[i] = 0.1F * (float)i;
+
+ H5Awrite(attr, H5T_NATIVE_DOUBLE, d);
+ H5Sclose(space);
+ H5Aclose(attr);
+
+ /* attribute 4 */
+ space = H5Screate(H5S_SCALAR);
+ attr = H5Acreate2(root, "attr4", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT);
+ H5Awrite(attr, H5T_NATIVE_INT, &point);
+ H5Sclose(space);
+ H5Aclose(attr);
+
+ /* attribute 5 */
+ space = H5Screate(H5S_SCALAR);
+ type = H5Tcopy(H5T_C_S1);
+ H5Tset_size(type, 17);
+ attr = H5Acreate2(root, "attr5", type, space, H5P_DEFAULT, H5P_DEFAULT);
+ H5Awrite(attr, type, string);
+
+ H5Tclose(type);
+ H5Sclose(space);
+ H5Aclose(attr);
+ H5Gclose(root);
+ H5Fclose(fid);
+}
+
+static void gent_softlink(void)
+{
+ hid_t fid, root;
+
+ fid = H5Fcreate(FILE4, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ root = H5Gopen2(fid, "/", H5P_DEFAULT);
+ H5Lcreate_soft("somevalue", root, "slink1", H5P_DEFAULT, H5P_DEFAULT);
+ H5Lcreate_soft("linkvalue", root, "slink2", H5P_DEFAULT, H5P_DEFAULT);
+
+ H5Gclose(root);
+ H5Fclose(fid);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: gent_softlink2
+ *
+ * Purpose: Create soft links to various objects.
+ * Return:
+ * SUCCEED
+ * FAIL
+ * Programmer: Jonathan Kim
+ * Date: May 26, 2010
+ *-------------------------------------------------------------------------*/
+#define NX 4
+#define NY 2
+static int gent_softlink2(void)
+{
+ hid_t fileid1 = -1;
+ hid_t gid1 = -1, gid2 = -1;
+ hid_t datatype = -1;
+ hid_t dset1 = -1, dset2 = -1;
+ hid_t dataspace = -1;
+ hsize_t dimsf[2]; /* dataset dimensions */
+ int data1[NX][NY] = {{0,0},{1,1},{2,2},{3,3}};
+ int data2[NX][NY] = {{0,0},{0,1},{0,2},{3,3}};
+ herr_t status = SUCCEED;
+
+ /*-----------------------------------------------------------------------
+ * FILE
+ *------------------------------------------------------------------------*/
+ /* Create a new file */
+ fileid1 = H5Fcreate(FILE4_1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ if (fileid1 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Fcreate failed.\n", FILE4_1);
+ status = FAIL;
+ goto out;
+ }
+
+ /*-----------------------------------------------------------------------
+ * Groups
+ *------------------------------------------------------------------------*/
+ gid1 = H5Gcreate2(fileid1, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (gid1 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", FILE4_1);
+ status = FAIL;
+ goto out;
+ }
+
+ gid2 = H5Gcreate2(fileid1, "group_empty", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (gid2 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", FILE4_1);
+ status = FAIL;
+ goto out;
+ }
+
+ /*-----------------------------------------------------------------------
+ * Named datatype
+ *------------------------------------------------------------------------*/
+ datatype = H5Tcopy(H5T_NATIVE_INT);
+ status = H5Tcommit2(fileid1, "dtype", datatype, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Tcommit2 failed.\n", FILE4_1);
+ status = FAIL;
+ goto out;
+ }
+
+ /*-----------------------------------------------------------------------
+ * Datasets
+ *------------------------------------------------------------------------*/
+ /*
+ * Describe the size of the array and create the data space for fixed
+ * size dataset.
+ */
+ dimsf[0] = NX;
+ dimsf[1] = NY;
+ dataspace = H5Screate_simple(2, dimsf, NULL);
+
+ /*
+ * We will store little endian INT numbers.
+ */
+
+ /*---------------
+ * dset1
+ */
+ /* Create a new dataset as sample object */
+ dset1 = H5Dcreate2(fileid1, "/dset1", H5T_NATIVE_INT, dataspace,
+ H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (dset1 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Dcreate2 failed.\n", FILE4_1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data1);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Dwrite failed.\n", FILE4_1);
+ status = FAIL;
+ goto out;
+ }
+
+ /*---------------
+ * dset2
+ */
+ /* Create a new dataset as sample object */
+ dset2 = H5Dcreate2(fileid1, "/dset2", H5T_NATIVE_INT, dataspace,
+ H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (dset2 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Dcreate2 failed.\n", FILE4_1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Dwrite(dset2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data2);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Dwrite failed.\n", FILE4_1);
+ status = FAIL;
+ goto out;
+ }
+
+ /*-----------------------------------------------------------------------
+ * Soft links
+ *------------------------------------------------------------------------*/
+ /*
+ * create various soft links under '/' root
+ */
+ /* link to dset1 */
+ status = H5Lcreate_soft("/dset1", fileid1, "soft_dset1", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1);
+ status = FAIL;
+ goto out;
+ }
+
+ /* link to data type */
+ status = H5Lcreate_soft("/dtype", fileid1, "soft_dtype", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1);
+ status = FAIL;
+ goto out;
+ }
+
+ /* link to group1 */
+ status = H5Lcreate_soft("/group1", fileid1, "soft_group1", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1);
+ status = FAIL;
+ goto out;
+ }
+
+ /* link to empty group */
+ status = H5Lcreate_soft("/group_empty", fileid1, "soft_empty_grp", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1);
+ status = FAIL;
+ goto out;
+ }
+
+ /* dangling link */
+ status = H5Lcreate_soft("not_yet", fileid1, "soft_dangle", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1);
+ status = FAIL;
+ goto out;
+ }
+
+ /*-----------------------------------------
+ * create various soft links under a group
+ */
+ /* link to dset1 */
+ status = H5Lcreate_soft("/dset1", gid1, "soft_dset1", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1);
+ status = FAIL;
+ goto out;
+ }
+
+ /* link to dset2 */
+ status = H5Lcreate_soft("/dset2", gid1, "soft_dset2", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1);
+ status = FAIL;
+ goto out;
+ }
+
+ /* link to data type */
+ status = H5Lcreate_soft("/dtype", gid1, "soft_dtype", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1);
+ status = FAIL;
+ goto out;
+ }
+
+ /* link to empty group */
+ status = H5Lcreate_soft("/group_empty", gid1, "soft_empty_grp", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1);
+ status = FAIL;
+ goto out;
+ }
+
+ /* dangling link */
+ status = H5Lcreate_soft("not_yet", gid1, "soft_dangle", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1);
+ status = FAIL;
+ goto out;
+ }
+
+ out:
+ /*
+ * Close/release resources.
+ */
+ if(dataspace >= 0 && H5Sclose(dataspace) < 0) {
+ fprintf(stderr, "Error: %s> H5Sclose failed.\n", FILE4_1);
+ status = FAIL;
+ }
+ if(gid1 >= 0 && H5Gclose(gid1) < 0) {
+ fprintf(stderr, "Error: %s> H5Gclose failed.\n", FILE4_1);
+ status = FAIL;
+ }
+ if(gid2 >= 0 && H5Gclose(gid2) < 0) {
+ fprintf(stderr, "Error: %s> H5Gclose failed.\n", FILE4_1);
+ status = FAIL;
+ }
+ if(datatype >= 0 && H5Tclose(datatype) < 0) {
+ fprintf(stderr, "Error: %s> H5Tclose failed.\n", FILE4_1);
+ status = FAIL;
+ }
+ if(dset1 >= 0 && H5Dclose(dset1) < 0) {
+ fprintf(stderr, "Error: %s> H5Dclose failed.\n", FILE4_1);
+ status = FAIL;
+ }
+ if(dset2 >= 0 && H5Dclose(dset2) < 0) {
+ fprintf(stderr, "Error: %s> H5Dclose failed.\n", FILE4_1);
+ status = FAIL;
+ }
+ if(fileid1 >= 0 && H5Fclose(fileid1) < 0) {
+ fprintf(stderr, "Error: %s> H5Fclose failed.\n", FILE4_1);
+ status = FAIL;
+ }
+
+ return status;
+}
+
+/*
+ /
+
+ / | \ the dataset is hardlinked to three names
+ /dset1, /g1/dset2, and /g1/g1.1/dset3
+ dset1 g1 g2
+ /g2 and /g1/g1.1 are hardlinked to the same object.
+ / \
+ dset2 g1.1
+ |
+ dset3
+ */
+
+static void gent_hardlink(void)
+{
+ hid_t fid, group, dataset, space;
+ hsize_t dim = 5;
+ int i, dset[5];
+
+ fid = H5Fcreate(FILE5, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ space = H5Screate_simple(1, &dim, NULL);
+ dataset = H5Dcreate2(fid, "/dset1", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ for(i = 0; i < 5; i++) dset[i] = i;
+
+ H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+ group = H5Gcreate2(fid, "/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Lcreate_hard(group, "/dset1", H5L_SAME_LOC, "dset2", H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
+
+ group = H5Gcreate2(fid, "/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Lcreate_hard(group, "/dset1", H5L_SAME_LOC, "dset3", H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
+
+ group = H5Gopen2(fid, "/g1", H5P_DEFAULT);
+ H5Lcreate_hard(group, "/g2", H5L_SAME_LOC, "g1.1", H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
+
+ /* create a link to the root group */
+ H5Lcreate_hard(fid, "/", H5L_SAME_LOC, "g3", H5P_DEFAULT, H5P_DEFAULT);
+ H5Fclose(fid);
+}
+
+static void gent_extlink(void)
+{
+ hid_t fid;
+
+ /* This external link will dangle, but that's okay */
+ fid = H5Fcreate(FILE53, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ H5Lcreate_external("filename", "objname", fid, "extlink1", H5P_DEFAULT, H5P_DEFAULT);
+ H5Lcreate_external("anotherfile", "anotherobj", fid, "extlink2", H5P_DEFAULT, H5P_DEFAULT);
+
+ H5Fclose(fid);
+}
+
+static void gent_udlink(void)
+{
+ hid_t fid;
+ char buf[4];
+
+ H5Lregister(UD_link_class);
+
+ /* This ud link will dangle, but that's okay */
+ fid = H5Fcreate(FILE54, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ H5Lcreate_ud(fid, "udlink1", (H5L_type_t)MY_LINKCLASS, NULL, 0, H5P_DEFAULT, H5P_DEFAULT);
+ strcpy(buf, "foo");
+ H5Lcreate_ud(fid, "udlink2", (H5L_type_t)MY_LINKCLASS, buf, 4, H5P_DEFAULT, H5P_DEFAULT);
+
+ H5Fclose(fid);
+}
+
+
+/*
+ /
+ / | \ \
+ dset1 group1 type1 type2
+ |
+ dset2
+
+ */
+static void gent_compound_dt(void) { /* test compound data type */
+ hid_t fid, group, dataset, space, space3, type, type2;
+ hid_t array_dt;
+ typedef struct {
+ int a;
+ float b;
+ double c;
+ } dset1_t;
+ dset1_t dset1[5];
+
+ typedef struct {
+ int a;
+ float b;
+ } dset2_t;
+ dset2_t dset2[5];
+
+ typedef struct {
+ int a[4];
+ float b[5][6];
+ } dset3_t;
+ dset3_t dset3[3][6];
+
+ typedef struct {
+ int a;
+ float b;
+ } dset4_t;
+ dset4_t dset4[5];
+
+ typedef struct {
+ int a;
+ float b;
+ } dset5_t;
+ dset5_t dset5[5];
+
+ int i, j, k, l;
+ unsigned ndims;
+ hsize_t dim[2];
+
+ hsize_t sdim = 5;
+ hsize_t dset3_dim[2];
+
+
+ for(i = 0; i < (int)sdim; i++) {
+ dset1[i].a = i;
+ dset1[i].b = (float)(i*i);
+ dset1[i].c = (float)(1.0F/(float)(i+1));
+
+ dset2[i].a = i;
+ dset2[i].b = (float)((float)i+ (float)i*0.1F);
+
+ dset4[i].a = i;
+ dset4[i].b = (float)(i+3);
+
+ dset5[i].a = i;
+ dset5[i].b = (float)((float)i*0.1F);
+ }
+
+
+ fid = H5Fcreate(FILE6, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ space = H5Screate_simple(1, &sdim, NULL);
+
+ type = H5Tcreate (H5T_COMPOUND, sizeof(dset1[0]));
+ type2 = H5Tcreate(H5T_COMPOUND, sizeof(dset1[0]));
+ H5Tinsert(type, "a_name", HOFFSET(dset1_t, a), H5T_STD_I32BE);
+ H5Tinsert(type, "b_name", HOFFSET(dset1_t, b), H5T_IEEE_F32BE);
+ H5Tinsert(type, "c_name", HOFFSET(dset1_t, c), H5T_IEEE_F64BE);
+ H5Tinsert(type2, "a_name", HOFFSET(dset1_t, a), H5T_NATIVE_INT);
+ H5Tinsert(type2, "b_name", HOFFSET(dset1_t, b), H5T_NATIVE_FLOAT);
+ H5Tinsert(type2, "c_name", HOFFSET(dset1_t, c), H5T_NATIVE_DOUBLE);
+ dataset = H5Dcreate2(fid, "/dset1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Dwrite(dataset, type2, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset1);
+ H5Tclose(type2);
+ H5Tclose(type);
+ H5Dclose(dataset);
+
+ /* shared data type 1 */
+ type = H5Tcreate (H5T_COMPOUND, sizeof(dset2_t));
+ H5Tinsert(type, "int_name", HOFFSET(dset2_t, a), H5T_STD_I32BE);
+ H5Tinsert(type, "float_name", HOFFSET(dset2_t, b), H5T_IEEE_F32BE);
+ H5Tcommit2(fid, "type1", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ type2 = H5Tcreate (H5T_COMPOUND, sizeof(dset2_t));
+ H5Tinsert(type2, "int_name", HOFFSET(dset2_t, a), H5T_NATIVE_INT);
+ H5Tinsert(type2, "float_name", HOFFSET(dset2_t, b), H5T_NATIVE_FLOAT);
+ group = H5Gcreate2(fid, "/group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ dataset = H5Dcreate2(group, "dset2", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Dwrite(dataset, type2, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2);
+ H5Tclose(type2);
+ H5Tclose(type);
+ H5Dclose(dataset);
+
+
+ /* shared data type 2 */
+ type = H5Tcreate (H5T_COMPOUND, sizeof(dset3_t));
+ type2 = H5Tcreate (H5T_COMPOUND, sizeof(dset3_t));
+
+ ndims = 1; dim[0] = 4;
+
+ array_dt = H5Tarray_create2(H5T_STD_I32BE, ndims, dim);
+ H5Tinsert(type, "int_array", HOFFSET(dset3_t, a), array_dt);
+ H5Tclose(array_dt);
+
+ array_dt = H5Tarray_create2(H5T_NATIVE_INT, ndims, dim);
+ H5Tinsert(type2, "int_array", HOFFSET(dset3_t, a), array_dt);
+ H5Tclose(array_dt);
+
+ ndims = 2; dim[0] = 5; dim[1] = 6;
+
+ array_dt = H5Tarray_create2(H5T_IEEE_F32BE, ndims, dim);
+ H5Tinsert(type, "float_array", HOFFSET(dset3_t, b), array_dt);
+ H5Tclose(array_dt);
+
+ array_dt = H5Tarray_create2(H5T_NATIVE_FLOAT, ndims, dim);
+ H5Tinsert(type2, "float_array", HOFFSET(dset3_t, b), array_dt);
+ H5Tclose(array_dt);
+
+ H5Tcommit2(fid, "type2", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+
+ dset3_dim[0] = 3; dset3_dim[1] = 6;
+ space3 = H5Screate_simple(2, dset3_dim, NULL);
+ dataset = H5Dcreate2(group, "dset3", type, space3, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ for(i = 0; i < (int)dset3_dim[0]; i++)
+ for(j = 0; j < (int)dset3_dim[1]; j++) {
+ for(k = 0; k < 4; k++)
+ dset3[i][j].a[k] = k + j + i;
+ for(k = 0; k < 5; k++)
+ for(l = 0; l < 6; l++)
+ dset3[i][j].b[k][l] = (float)((k + 1) + l + j + i);
+ }
+ H5Dwrite(dataset, type2, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset3);
+ H5Sclose(space3);
+ H5Tclose(type);
+ H5Tclose(type2);
+ H5Dclose(dataset);
+
+ /* shared data type 3 */
+ type = H5Tcreate (H5T_COMPOUND, sizeof(dset4_t));
+ type2 = H5Tcreate (H5T_COMPOUND, sizeof(dset4_t));
+ H5Tinsert(type, "int", HOFFSET(dset4_t, a), H5T_STD_I32BE);
+ H5Tinsert(type, "float", HOFFSET(dset4_t, b), H5T_IEEE_F32BE);
+ H5Tcommit2(group, "type3", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Tinsert(type2, "int", HOFFSET(dset4_t, a), H5T_NATIVE_INT);
+ H5Tinsert(type2, "float", HOFFSET(dset4_t, b), H5T_NATIVE_FLOAT);
+ dataset = H5Dcreate2(group, "dset4", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Dwrite(dataset, type2, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset4);
+
+ H5Tclose(type);
+ H5Tclose(type2);
+ H5Dclose(dataset);
+ H5Gclose(group);
+
+
+ /* unamed data type */
+ group = H5Gcreate2(fid, "/group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ type = H5Tcreate(H5T_COMPOUND, sizeof(dset5_t));
+ H5Tinsert(type, "int", HOFFSET(dset5_t, a), H5T_STD_I32BE);
+ H5Tinsert(type, "float", HOFFSET(dset5_t, b), H5T_IEEE_F32BE);
+ H5Tcommit2(group, "type4", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ type2 = H5Tcreate(H5T_COMPOUND, sizeof(dset5_t));
+ H5Tinsert(type2, "int", HOFFSET(dset5_t, a), H5T_NATIVE_INT);
+ H5Tinsert(type2, "float", HOFFSET(dset5_t, b), H5T_NATIVE_FLOAT);
+ dataset = H5Dcreate2(group, "dset5", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Dwrite(dataset, type2, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset5);
+
+ H5Ldelete(group, "type4", H5P_DEFAULT);
+
+ H5Tclose(type);
+ H5Tclose(type2);
+ H5Dclose(dataset);
+ H5Sclose(space);
+ H5Gclose(group);
+
+ H5Fclose(fid);
+}
+
+/*
+ /
+ / | \ \
+ dset1 group1 type1 type2
+ |
+ dset2
+
+ */
+static void gent_compound_dt2(void) { /* test compound data type */
+ hid_t fid, group, dataset, space, type, create_plist, type2;
+ hid_t array_dt;
+
+ typedef struct {
+ int a;
+ float b;
+ double c;
+ } dset1_t;
+ dset1_t dset1[10];
+
+ typedef struct {
+ int a;
+ float b;
+ } dset2_t;
+ dset2_t dset2[10];
+
+ typedef struct {
+ int a[4];
+ float b[5][6];
+ } dset3_t;
+
+ typedef struct {
+ int a;
+ float b;
+ } dset4_t;
+ dset4_t dset4[10];
+
+ typedef struct {
+ int a;
+ float b;
+ } dset5_t;
+ dset5_t dset5[10];
+
+ int i;
+ unsigned ndims;
+ hsize_t dim[2];
+
+ hsize_t sdim, maxdim;
+
+ sdim = 10;
+ for(i = 0; i < (int)sdim; i++) {
+ dset1[i].a = i;
+ dset1[i].b = (float)(i*i);
+ dset1[i].c = (float)(1.0F / (float)(i+ 1));
+
+ dset2[i].a = i;
+ dset2[i].b = (float)((float)i + (float)i * 0.1F);
+
+ dset4[i].a = i;
+ dset4[i].b = (float)((float)i * 1.0F);
+
+ dset5[i].a = i;
+ dset5[i].b = (float)((float)i * 1.0F);
+ }
+
+ fid = H5Fcreate(FILE9, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ create_plist = H5Pcreate(H5P_DATASET_CREATE);
+
+ sdim = 2;
+ H5Pset_chunk(create_plist, 1, &sdim);
+
+ sdim = 6;
+ maxdim = H5S_UNLIMITED;
+
+ space = H5Screate_simple(1, &sdim, &maxdim);
+
+ type = H5Tcreate (H5T_COMPOUND, sizeof(dset1[0]));
+
+ H5Tinsert(type, "a_name", HOFFSET(dset1_t, a), H5T_STD_I32BE);
+ H5Tinsert(type, "b_name", HOFFSET(dset1_t, b), H5T_IEEE_F32BE);
+ H5Tinsert(type, "c_name", HOFFSET(dset1_t, c), H5T_IEEE_F64BE);
+
+ dataset = H5Dcreate2(fid, "/dset1", type, space, H5P_DEFAULT, create_plist, H5P_DEFAULT);
+
+ type2 = H5Tcreate (H5T_COMPOUND, sizeof(dset1[0]));
+
+ H5Tinsert(type2, "a_name", HOFFSET(dset1_t, a), H5T_NATIVE_INT);
+ H5Tinsert(type2, "b_name", HOFFSET(dset1_t, b), H5T_NATIVE_FLOAT);
+ H5Tinsert(type2, "c_name", HOFFSET(dset1_t, c), H5T_NATIVE_DOUBLE);
+
+ H5Dwrite(dataset, type2, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset1);
+
+ H5Tclose(type);
+ H5Tclose(type2);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+ sdim = 6;
+ maxdim = 10;
+
+ space = H5Screate_simple(1, &sdim, &maxdim);
+
+ /* shared data type 1 */
+ type = H5Tcreate(H5T_COMPOUND, sizeof(dset2_t));
+ H5Tinsert(type, "int_name", HOFFSET(dset2_t, a), H5T_STD_I32BE);
+ H5Tinsert(type, "float_name", HOFFSET(dset2_t, b), H5T_IEEE_F32BE);
+ H5Tcommit2(fid, "type1", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ group = H5Gcreate2(fid, "/group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ dataset = H5Dcreate2(group, "dset2", type, space, H5P_DEFAULT, create_plist, H5P_DEFAULT);
+
+ type2 = H5Tcreate (H5T_COMPOUND, sizeof(dset2_t));
+ H5Tinsert(type2, "int_name", HOFFSET(dset2_t, a), H5T_NATIVE_INT);
+ H5Tinsert(type2, "float_name", HOFFSET(dset2_t, b), H5T_NATIVE_FLOAT);
+ H5Dwrite(dataset, type2, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2);
+
+ H5Tclose(type);
+ H5Tclose(type2);
+ H5Dclose(dataset);
+
+
+ /* shared data type 2 */
+ type = H5Tcreate (H5T_COMPOUND, sizeof(dset3_t));
+
+ ndims = 1; dim[0] = 4;
+ array_dt = H5Tarray_create2(H5T_STD_I32BE, ndims, dim);
+ H5Tinsert(type, "int_array", HOFFSET(dset3_t, a), array_dt);
+ H5Tclose(array_dt);
+
+ ndims = 2; dim[0] = 5; dim[1] = 6;
+ array_dt = H5Tarray_create2(H5T_IEEE_F32BE, ndims, dim);
+ H5Tinsert(type, "float_array", HOFFSET(dset3_t, b), array_dt);
+ H5Tclose(array_dt);
+
+ H5Tcommit2(fid, "type2", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Tclose(type);
+
+ /* shared data type 3 */
+ type = H5Tcreate(H5T_COMPOUND, sizeof(dset4_t));
+ H5Tinsert(type, "int", HOFFSET(dset4_t, a), H5T_STD_I32BE);
+ H5Tinsert(type, "float", HOFFSET(dset4_t, b), H5T_IEEE_F32BE);
+ H5Tcommit2(group, "type3", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ dataset = H5Dcreate2(group, "dset4", type, space, H5P_DEFAULT, create_plist, H5P_DEFAULT);
+
+ type2 = H5Tcreate (H5T_COMPOUND, sizeof(dset4_t));
+ H5Tinsert(type2, "int", HOFFSET(dset4_t, a), H5T_NATIVE_INT);
+ H5Tinsert(type2, "float", HOFFSET(dset4_t, b), H5T_NATIVE_FLOAT);
+ H5Dwrite(dataset, type2, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset4);
+
+ H5Tclose(type);
+ H5Tclose(type2);
+ H5Dclose(dataset);
+ H5Gclose(group);
+
+
+ /* unamed data type */
+ group = H5Gcreate2(fid, "/group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ type = H5Tcreate(H5T_COMPOUND, sizeof(dset5_t));
+ H5Tinsert(type, "int", HOFFSET(dset5_t, a), H5T_STD_I32BE);
+ H5Tinsert(type, "float", HOFFSET(dset5_t, b), H5T_IEEE_F32BE);
+ H5Tcommit2(group, "type4", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset = H5Dcreate2(group, "dset5", type, space, H5P_DEFAULT, create_plist, H5P_DEFAULT);
+ type2 = H5Tcreate(H5T_COMPOUND, sizeof(dset5_t));
+ H5Tinsert(type2, "int", HOFFSET(dset5_t, a), H5T_NATIVE_INT);
+ H5Tinsert(type2, "float", HOFFSET(dset5_t, b), H5T_NATIVE_FLOAT);
+ H5Dwrite(dataset, type2, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset5);
+
+ H5Ldelete(group, "type4", H5P_DEFAULT);
+
+ H5Tclose(type);
+ H5Tclose(type2);
+ H5Dclose(dataset);
+ H5Sclose(space);
+ H5Gclose(group);
+ H5Pclose(create_plist);
+
+ H5Fclose(fid);
+
+}
+
+
+/*
+
+/ : g1 g2 attr1 attr2
+g1 : g1.1 g1.2
+g1.1 : dset1.1.1(attr1, attr2) dset1.1.2
+g1.2 : g1.2.1 extlink
+g1.2.1 : slink
+g2 : dset2.1 dset2.2 udlink
+
+ */
+
+static void gent_all(void)
+{
+ hid_t fid, group, attr, dataset, space;
+ hsize_t dims[2];
+ int data[2][2], dset1[10][10], dset2[20];
+ char buf[60];
+ int i, j;
+ float dset2_1[10], dset2_2[3][5];
+
+ fid = H5Fcreate(FILE7, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* create groups */
+ group = H5Gcreate2(fid, "/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
+
+ group = H5Gcreate2(fid, "/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
+
+ group = H5Gcreate2(fid, "/g1/g1.1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
+
+ group = H5Gcreate2(fid, "/g1/g1.2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
+
+ group = H5Gcreate2(fid, "/g1/g1.2/g1.2.1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
+
+ /* root attributes */
+ group = H5Gopen2(fid, "/", H5P_DEFAULT);
+
+ dims[0] = 10;
+ space = H5Screate_simple(1, dims, NULL);
+ attr = H5Acreate2(group, "attr1", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT);
+ sprintf(buf, "abcdefghi");
+ H5Awrite(attr, H5T_NATIVE_SCHAR, buf);
+ H5Sclose(space);
+ H5Aclose(attr);
+
+ dims[0] = 2; dims[1] = 2;
+ space = H5Screate_simple(2, dims, NULL);
+ attr = H5Acreate2(group, "attr2", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT);
+ data[0][0] = 0; data[0][1] = 1; data[1][0] = 2; data[1][1] = 3;
+ H5Awrite(attr, H5T_NATIVE_INT, data);
+ H5Sclose(space);
+ H5Aclose(attr);
+
+ H5Gclose(group);
+
+ group = H5Gopen2(fid, "/g1/g1.1", H5P_DEFAULT);
+
+ /* dset1.1.1 */
+ dims[0] = 10; dims[1] = 10;
+ space = H5Screate_simple(2, dims, NULL);
+ dataset = H5Dcreate2(group, "dset1.1.1", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ for(i = 0; i < 10; i++)
+ for(j = 0; j < 10; j++)
+ dset1[i][j] = j * i;
+ H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset1);
+ H5Sclose(space);
+
+ /* attributes of dset1.1.1 */
+ dims[0] = 27;
+ space = H5Screate_simple(1, dims, NULL);
+ attr = H5Acreate2(dataset, "attr1", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT);
+ sprintf(buf, "1st attribute of dset1.1.1");
+ H5Awrite(attr, H5T_NATIVE_SCHAR, buf);
+ H5Sclose(space);
+ H5Aclose(attr);
+
+ dims[0] = 27;
+ space = H5Screate_simple(1, dims, NULL);
+ attr = H5Acreate2(dataset, "attr2", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT);
+ sprintf(buf, "2nd attribute of dset1.1.1");
+ H5Awrite(attr, H5T_NATIVE_SCHAR, buf);
+ H5Sclose(space);
+ H5Aclose(attr);
+
+ H5Dclose(dataset);
+
+ /* dset1.1.2 */
+ dims[0] = 20;
+ space = H5Screate_simple(1, dims, NULL);
+ dataset = H5Dcreate2(group, "dset1.1.2", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ for(i = 0; i < 20; i++)
+ dset2[i] = i;
+ H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+ H5Gclose(group);
+
+ /* external link */
+ H5Lcreate_external("somefile", "somepath", fid, "/g1/g1.2/extlink", H5P_DEFAULT, H5P_DEFAULT);
+
+ /* soft link */
+ group = H5Gopen2(fid, "/g1/g1.2/g1.2.1", H5P_DEFAULT);
+ H5Lcreate_soft("somevalue", group, "slink", H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
+
+ group = H5Gopen2(fid, "/g2", H5P_DEFAULT);
+
+ /* dset2.1 */
+ dims[0] = 10;
+ space = H5Screate_simple(1, dims, NULL);
+ dataset = H5Dcreate2(group, "dset2.1", H5T_IEEE_F32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ for(i = 0; i < 10; i++)
+ dset2_1[i] = (float)((float)i * 0.1F + 1);
+ H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2_1);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+ /* dset2.2 */
+ dims[0] = 3; dims[1] = 5;
+ space = H5Screate_simple(2, dims, NULL);
+ dataset = H5Dcreate2(group, "dset2.2", H5T_IEEE_F32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ for(i = 0; i < 3; i++)
+ for(j = 0; j < 5; j++)
+ dset2_2[i][j] = (float)((float)(i + 1) * (float)j * 0.1F);
+ H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2_2);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+ H5Gclose(group);
+
+ /* user-defined link */
+ H5Lregister(UD_link_class);
+ H5Lcreate_ud(fid, "/g2/udlink", (H5L_type_t)MY_LINKCLASS, NULL, 0, H5P_DEFAULT, H5P_DEFAULT);
+
+ H5Fclose(fid);
+}
+
+/*
+ o
+ /___\
+ g1 o/ \o g2
+ \___/
+
+
+o - group objects
+
+ */
+
+static void gent_loop(void) {
+ hid_t fid, group;
+
+ fid = H5Fcreate(FILE10, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ group = H5Gcreate2(fid, "/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
+ group = H5Gcreate2(fid, "/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
+
+ H5Lcreate_hard(fid, "/g2", H5L_SAME_LOC, "/g1/g1.1", H5P_DEFAULT, H5P_DEFAULT);
+ H5Lcreate_hard(fid, "/g1", H5L_SAME_LOC, "/g2/g2.1", H5P_DEFAULT, H5P_DEFAULT);
+
+ H5Fclose(fid);
+}
+
+static void gent_loop2(void)
+{
+ hid_t fid, group;
+
+ fid = H5Fcreate(FILE11, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* create group object g1 and implcit path from root object */
+ group = H5Gcreate2(fid, "/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
+
+ /* create group object g2 and implcit path from root object */
+ group = H5Gcreate2(fid, "/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
+
+ /* create path from object at /g1 to object at /g2 and name it g1.1 */
+ H5Lcreate_hard(fid, "/g2", H5L_SAME_LOC, "/g1/g1.1", H5P_DEFAULT, H5P_DEFAULT);
+
+ /* create path from object at /g2 to object at /g1 and name it g2.1 */
+ H5Lcreate_soft("/g1", fid, "/g2/g2.1", H5P_DEFAULT, H5P_DEFAULT);
+
+ H5Fclose(fid);
+}
+
+/*
+ /
+ | | | \ \ \ \ \
+ g1 g2 g3 g4 g5 g6 g7 g8
+ / \ | | \ \ \ \ \
+ g1.1 g1.2 slink2 link3 dset2 slink4 dset3 slink5 elink
+ | | (g1) (dset2) (dset3) (elink) udlink
+ dset1 link1 slink6
+ (dset1) (udlink)
+ */
+
+static void
+gent_many(void)
+{
+ hid_t fid, group, attr, dataset, space, space2, type, create_plist, type2;
+ hid_t array_dt;
+ hsize_t dims[2];
+ int data[2][2], dset2[10][10], dset3[10][10];
+ double d[10];
+
+ char buf[60];
+ int i, j;
+ int i0, i1, i2, i3;
+ hsize_t sdim, maxdim;
+
+ typedef struct { /* compound type has members with rank > 1 */
+ int a[2][2][2][2]; /* arrays are 2x2x2x2 */
+ double b[2][2][2][2];
+ double c[2][2][2][2];
+ } dset1_t;
+ dset1_t dset1[6];
+
+ hsize_t dim[4];
+ herr_t ret;
+
+ fid = H5Fcreate(FILE12, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ group = H5Gcreate2(fid, "/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
+
+ create_plist = H5Pcreate(H5P_DATASET_CREATE);
+
+ sdim = 2;
+ H5Pset_chunk(create_plist, 1, &sdim);
+
+ group = H5Gcreate2(fid, "/g1/g1.1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ type = H5Tcreate (H5T_COMPOUND, sizeof(dset1[0]));
+
+ dim[0] = dim[1] = dim[2] = dim[3] = 2;
+ array_dt = H5Tarray_create2(H5T_STD_I32BE, 4, dim);
+ H5Tinsert(type, "a_array", HOFFSET(dset1_t, a), array_dt);
+ H5Tclose(array_dt);
+
+ array_dt = H5Tarray_create2(H5T_IEEE_F64BE, 4, dim);
+ H5Tinsert(type, "b_array", HOFFSET(dset1_t, b), array_dt);
+ H5Tclose(array_dt);
+
+ array_dt = H5Tarray_create2(H5T_IEEE_F64BE, 4, dim);
+ H5Tinsert(type, "c_array", HOFFSET(dset1_t, c), array_dt);
+ H5Tclose(array_dt);
+
+ type2 = H5Tcreate (H5T_COMPOUND, sizeof(dset1[0]));
+
+ array_dt = H5Tarray_create2(H5T_NATIVE_INT, 4, dim);
+ H5Tinsert(type2, "a_array", HOFFSET(dset1_t, a), array_dt);
+ H5Tclose(array_dt);
+
+ array_dt = H5Tarray_create2(H5T_NATIVE_DOUBLE, 4, dim);
+ H5Tinsert(type2, "b_array", HOFFSET(dset1_t, b), array_dt);
+ H5Tclose(array_dt);
+
+ array_dt = H5Tarray_create2(H5T_NATIVE_DOUBLE, 4, dim);
+ H5Tinsert(type2, "c_array", HOFFSET(dset1_t, c), array_dt);
+ H5Tclose(array_dt);
+
+
+ /* dset1 */
+ sdim = 6;
+ maxdim = H5S_UNLIMITED;
+ space = H5Screate_simple(1, &sdim, &maxdim);
+ dataset = H5Dcreate2(group, "dset1", type, space, H5P_DEFAULT, create_plist, H5P_DEFAULT);
+
+ /* add attributes to dset1 */
+ dims[0] = 10;
+ space2 = H5Screate_simple(1, dims, NULL);
+ attr = H5Acreate2(dataset, "attr1", H5T_STD_I8BE, space2, H5P_DEFAULT, H5P_DEFAULT);
+ sprintf(buf, "abcdefghi");
+ H5Awrite(attr, H5T_NATIVE_CHAR, buf);
+ H5Sclose(space2);
+ H5Aclose(attr);
+
+ dims[0] = 2; dims[1] = 2;
+ space2 = H5Screate_simple(2, dims, NULL);
+ attr = H5Acreate2(dataset, "attr2", H5T_STD_I32BE, space2, H5P_DEFAULT, H5P_DEFAULT);
+ data[0][0] = 0; data[0][1] = 1; data[1][0] = 2; data[1][1] = 3;
+ H5Awrite(attr, H5T_NATIVE_INT, data);
+ H5Sclose(space2);
+ H5Aclose(attr);
+
+ dims[0] = 10;
+ space2 = H5Screate_simple(1, dims, NULL);
+ attr = H5Acreate2(dataset, "attr3", H5T_IEEE_F64BE, space2, H5P_DEFAULT, H5P_DEFAULT);
+ for(i = 0; i < 10; i++)
+ d[i] = 0.1F * (float)i;
+ H5Awrite(attr, H5T_NATIVE_DOUBLE, d);
+ H5Sclose(space2);
+ H5Aclose(attr);
+
+ for(j=0; j<(int)sdim; j++) {
+ for(i3 = 0; i3 < 2; i3++) {
+ for(i2 = 0; i2 < 2; i2++) {
+ for(i1 = 0; i1 < 2; i1++) {
+ for(i0 = 0; i0 < 2; i0++) {
+ dset1[j].a[i3][i2][i1][i0] = i0 + j;
+ dset1[j].b[i3][i2][i1][i0] = (double)(i0 + j);
+ dset1[j].c[i3][i2][i1][i0] = (double)((hsize_t)i0 + (hsize_t)j + sdim);
+ }
+ }
+ }
+ }
+ }
+
+ H5Dwrite(dataset, type2, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset1);
+
+ H5Dclose(dataset);
+ H5Sclose(space);
+
+ H5Tclose(type);
+ H5Tclose(type2);
+ H5Gclose(group);
+
+ group = H5Gcreate2(fid, "/g1/g1.2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Lcreate_hard(group, "/g1/g1.1/dset1", H5L_SAME_LOC, "link1", H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
+
+ group = H5Gcreate2(fid, "/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Lcreate_soft("/g1", group, "slink2", H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
+
+ group = H5Gcreate2(fid, "/g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
+
+ group = H5Gcreate2(fid, "/g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* dset2 */
+ dims[0] = 10; dims[1] = 10;
+ space = H5Screate_simple(2, dims, NULL);
+
+ dataset = H5Dcreate2(group, "dset2", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ for(i = 0; i < 10; i++)
+ for(j = 0; j < 10; j++)
+ dset2[i][j] = j;
+ H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2);
+
+ H5Dclose(dataset);
+
+ H5Sclose(space);
+ H5Gclose(group);
+
+ group = H5Gopen2(fid, "/g3", H5P_DEFAULT);
+ H5Lcreate_hard(group, "/g4/dset2", H5L_SAME_LOC, "link3", H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
+
+ group = H5Gcreate2(fid, "/g5", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
+
+ group = H5Gcreate2(fid, "/g6", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ /* dset3 */
+ dims[0] = 10; dims[1] = 10;
+ space = H5Screate_simple(2, dims, NULL);
+
+ dataset = H5Dcreate2(group, "dset3", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ for(i = 0; i < 10; i++)
+ for(j = 0; j < 10; j++)
+ dset3[i][j] = i;
+ H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset3);
+
+ H5Dclose(dataset);
+
+ H5Sclose(space);
+ H5Gclose(group);
+
+ group = H5Gopen2(fid, "/g5", H5P_DEFAULT);
+ H5Lcreate_soft("/g6/dset3", group, "slink4", H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
+ H5Pclose(create_plist);
+
+ group = H5Gcreate2(fid, "/g7", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
+ group = H5Gcreate2(fid, "/g8", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
+
+ /* Create dangling external and UD links */
+ H5Lcreate_external("somefile", "somepath", fid, "/g8/elink", H5P_DEFAULT, H5P_DEFAULT);
+ H5Lregister(UD_link_class);
+ H5Lcreate_ud(fid, "/g8/udlink", (H5L_type_t)MY_LINKCLASS, NULL, 0, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Create links to external and UD links */
+ ret = H5Lcreate_soft("/g8/elink", fid, "/g7/slink5", H5P_DEFAULT, H5P_DEFAULT);
+ HDassert(ret >= 0);
+ ret = H5Lcreate_soft("/g8/udlink", fid, "/g7/slink6", H5P_DEFAULT, H5P_DEFAULT);
+ HDassert(ret >= 0);
+
+ H5Fclose(fid);
+}
+
+static hid_t mkstr(int size, H5T_str_t pad) {
+ hid_t type;
+
+ if((type=H5Tcopy(H5T_C_S1)) < 0) return -1;
+ if(H5Tset_size(type, (size_t)size) < 0) return -1;
+ if(H5Tset_strpad(type, pad) < 0) return -1;
+
+ return type;
+}
+
+static void gent_str(void) {
+ hid_t fid, dataset, space, f_type, m_type, str_type, f_type2;
+ hid_t array_dt;
+
+ hsize_t dims1[] = { 3, 4};
+ char string1[12][3] = {"s1","s2","s3","s4","s5","s6","s7","s8","s9",
+ "s0","s1","s2"};
+
+ hsize_t dims2[]={20};
+ char string2[20][10] = {"ab cd ef1", "ab cd ef2", "ab cd ef3", "ab cd ef4",
+ "ab cd ef5", "ab cd ef6", "ab cd ef7", "ab cd ef8",
+ "ab cd ef9", "ab cd ef0", "ab cd ef1", "ab cd ef2",
+ "ab cd ef3", "ab cd ef4", "ab cd ef5", "ab cd ef6",
+ "ab cd ef7", "ab cd ef8", "ab cd ef9", "ab cd ef0"};
+
+ hsize_t dims3[] = { 27};
+ char string3[27][6] = {"abcd0", "abcd1", "abcd2", "abcd3",
+ "abcd4", "abcd5", "abcd6", "abcd7",
+ "abcd8", "abcd9", "abcd0", "abcd1",
+ "abcd2", "abcd3", "abcd4", "abcd5",
+ "abcd6", "abcd7", "abcd8", "abcd9",
+ "abcd0", "abcd1", "abcd2", "abcd3",
+ "abcd4", "abcd5", "abcd6"};
+
+ int i, j, k, l;
+
+ hsize_t dims4[] = { 3 };
+ char string4[3][21] = { "s1234567890123456789", "s1234567890123456789",
+ "s1234567890123456789"};
+
+ hsize_t dims5[] = { 3, 6};
+ typedef struct {
+ int a[8][10];
+ char s[12][33];
+ } compound_t;
+ compound_t comp1[3][6];
+ hsize_t mdims[2];
+
+ fid = H5Fcreate(FILE13, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* string 1 : nullterm string */
+ space = H5Screate_simple(2, dims1, NULL);
+ f_type = mkstr(5, H5T_STR_NULLTERM);
+ m_type = mkstr(3, H5T_STR_NULLTERM);
+ dataset = H5Dcreate2(fid, "/string1", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Dwrite(dataset, m_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, string1);
+ H5Tclose(m_type);
+ H5Tclose(f_type);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+ /* string 2 : space pad string */
+ space = H5Screate_simple(1, dims2, NULL);
+ f_type = mkstr(11, H5T_STR_SPACEPAD);
+ m_type = mkstr(10, H5T_STR_NULLTERM);
+ dataset = H5Dcreate2(fid, "/string2", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Dwrite(dataset, m_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, string2);
+ H5Tclose(m_type);
+ H5Tclose(f_type);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+ /* string 3 : null pad string */
+ space = H5Screate_simple(1, dims3, NULL);
+ f_type = mkstr(8, H5T_STR_NULLPAD);
+ m_type = mkstr(6, H5T_STR_NULLTERM);
+ dataset = H5Dcreate2(fid, "/string3", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Dwrite(dataset, m_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, string3);
+ H5Tclose(m_type);
+ H5Tclose(f_type);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+ /* string 4 : space pad long string */
+ space = H5Screate_simple(1, dims4, NULL);
+ f_type = mkstr(168, H5T_STR_SPACEPAD);
+ m_type = mkstr(21, H5T_STR_NULLTERM);
+ dataset = H5Dcreate2(fid, "/string4", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Dwrite(dataset, m_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, string4);
+ H5Tclose(m_type);
+ H5Tclose(f_type);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+ /* compound data */
+ space = H5Screate_simple(2, dims5, NULL);
+ f_type = H5Tcreate (H5T_COMPOUND, sizeof(compound_t));
+ f_type2 = H5Tcreate (H5T_COMPOUND, sizeof(compound_t));
+
+ mdims[0] = 8; mdims[1] = 10;
+
+ array_dt = H5Tarray_create2(H5T_STD_I32BE, 2, mdims);
+ H5Tinsert(f_type, "int_array", HOFFSET(compound_t, a), array_dt);
+ H5Tclose(array_dt);
+
+ array_dt = H5Tarray_create2(H5T_NATIVE_INT, 2, mdims);
+ H5Tinsert(f_type2, "int_array", HOFFSET(compound_t, a), array_dt);
+ H5Tclose(array_dt);
+
+ mdims[0] = 3; mdims[1] = 4;
+
+ str_type = mkstr(32, H5T_STR_SPACEPAD);
+ array_dt = H5Tarray_create2(str_type, 2, mdims);
+ H5Tinsert(f_type, "string", HOFFSET(compound_t, s), array_dt);
+ H5Tclose(array_dt);
+ H5Tclose(str_type);
+
+ str_type = mkstr(33, H5T_STR_NULLTERM);
+ array_dt = H5Tarray_create2(str_type, 2, mdims);
+ H5Tinsert(f_type2, "string", HOFFSET(compound_t, s), array_dt);
+ H5Tclose(array_dt);
+ H5Tclose(str_type);
+
+ for(i = 0; i < 3; i++)
+ for(j = 0; j < 6; j++) {
+ for(k = 0 ; k < 8; k++)
+ for(l = 0; l < 10; l++)
+ comp1[i][j].a[k][l] = (l + j + k) * (l + j + k);
+ for(k = 0 ; k < 12; k++)
+ strcpy(comp1[i][j].s[k], "abcdefgh12345678abcdefgh12345678");
+ }
+
+ dataset = H5Dcreate2(fid, "/comp1", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Dwrite(dataset, f_type2, H5S_ALL, H5S_ALL, H5P_DEFAULT, comp1);
+
+ H5Tclose(f_type);
+ H5Tclose(f_type2);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+ H5Fclose(fid);
+}
+
+/*
+ /
+ / / | \ \ \
+ g1 g2 g3 g4 g5 g6
+ | | | | \ \
+ string1 string3 string5
+ string2 string4 string6
+ */
+
+static void gent_str2(void)
+{
+ hid_t fid, group, attr, dataset, space, space2, mem_space, hyper_space;
+ hid_t fxdlenstr, fxdlenstr2, memtype;
+ hsize_t dims[1], size[1], stride[1], count[1], block[1];
+ hsize_t start[1];
+
+
+ int i;
+ char buf[LENSTR+10];
+ char buf2[3*LENSTR2];
+ hsize_t sdim;
+
+ fid = H5Fcreate(FILE14, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ fxdlenstr = H5Tcopy(H5T_C_S1);
+ H5Tset_size(fxdlenstr, LENSTR);
+ H5Tset_cset(fxdlenstr, H5T_CSET_ASCII);
+ H5Tset_strpad(fxdlenstr, H5T_STR_NULLTERM);
+
+ memtype = H5Tcopy(H5T_C_S1);
+ H5Tset_size(memtype, LENSTR);
+ H5Tset_cset(memtype, H5T_CSET_ASCII);
+ H5Tset_strpad(memtype, H5T_STR_NULLTERM);
+
+ sdim = 10;
+ size[0] = sdim;
+ space = H5Screate_simple(1, size, NULL);
+ size[0] = 1;
+ mem_space = H5Screate_simple(1,size,NULL);
+ hyper_space = H5Scopy(space);
+
+ /* dset1 */
+
+ group = H5Gcreate2(fid, "/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset = H5Dcreate2(group, "dset1", fxdlenstr, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* add attributes to dset1 */
+
+ fxdlenstr2 = H5Tcopy(H5T_C_S1);
+ H5Tset_size(fxdlenstr2, LENSTR2);
+ H5Tset_cset(fxdlenstr2, H5T_CSET_ASCII);
+ H5Tset_strpad(fxdlenstr2, H5T_STR_NULLTERM);
+
+ dims[0] = 3;
+ space2 = H5Screate_simple(1, dims, NULL);
+ attr = H5Acreate2(dataset, "attr1", fxdlenstr2, space2, H5P_DEFAULT, H5P_DEFAULT);
+ sprintf(&(buf2[0*LENSTR2]), "0123456789");
+ sprintf(&(buf2[1*LENSTR2]), "abcdefghij");
+ sprintf(&(buf2[2*LENSTR2]), "ABCDEFGHIJ");
+ H5Awrite(attr, fxdlenstr2, buf2);
+ H5Sclose(space2);
+ H5Tclose(fxdlenstr2);
+ H5Aclose(attr);
+
+ stride[0]=1;
+ count[0]=1;
+ block[0]=1;
+
+ for(i = 0; (hsize_t)i < sdim; i++) {
+ start[0] = (hsize_t)i;
+ sprintf(buf, "This is row %1d of type H5T_STR_NULLTERM of", i);
+ H5Tset_size(memtype, HDstrlen(buf)+1);
+ H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block);
+ H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf);
+ }
+ H5Dclose(dataset);
+ H5Gclose(group);
+
+ group = H5Gcreate2(fid, "/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset = H5Dcreate2(group, "dset2", fxdlenstr, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ for(i = 0; (hsize_t)i < sdim; i++) {
+ start[0] = (hsize_t)i;
+ sprintf(buf, "This is row %1d of type H5T_STR_NULLTERM of string array", i);
+ H5Tset_size(memtype, HDstrlen(buf)+1);
+ H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block);
+ H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf);
+ }
+ H5Dclose(dataset);
+ H5Gclose(group);
+
+
+ H5Tclose(fxdlenstr);
+ fxdlenstr = H5Tcopy(H5T_C_S1);
+ H5Tset_size(fxdlenstr, LENSTR);
+ H5Tset_cset(fxdlenstr, H5T_CSET_ASCII);
+ H5Tset_strpad(fxdlenstr, H5T_STR_NULLPAD);
+
+ group = H5Gcreate2(fid, "/g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset = H5Dcreate2(group, "dset3", fxdlenstr, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ for(i = 0;(hsize_t) i < sdim; i++) {
+ start[0] = (hsize_t)i;
+ sprintf(buf, "This is row %1d of type H5T_STR_NULLPAD of", i);
+ H5Tset_size(memtype, HDstrlen(buf)+1);
+ H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block);
+ H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf);
+ }
+ H5Dclose(dataset);
+ H5Gclose(group);
+
+
+ group = H5Gcreate2(fid, "/g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset = H5Dcreate2(group, "dset4", fxdlenstr, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ for(i = 0; (hsize_t)i < sdim; i++) {
+ start[0] = (hsize_t)i;
+ sprintf(buf, "This is row %1d of type H5T_STR_NULLPAD of string array", i);
+ H5Tset_size(memtype, HDstrlen(buf)+1);
+ H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block);
+ H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf);
+ }
+ H5Dclose(dataset);
+ H5Gclose(group);
+
+ H5Tclose(fxdlenstr);
+ fxdlenstr = H5Tcopy(H5T_C_S1);
+ H5Tset_size(fxdlenstr, LENSTR);
+ H5Tset_cset(fxdlenstr, H5T_CSET_ASCII);
+ H5Tset_strpad(fxdlenstr, H5T_STR_SPACEPAD);
+
+ group = H5Gcreate2(fid, "/g5", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset = H5Dcreate2(group, "dset5", fxdlenstr, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ for(i = 0; (hsize_t)i < sdim; i++) {
+ start[0] = (hsize_t)i;
+ sprintf(buf, "This is row %1d of type H5T_STR_SPACEPAD of", i);
+ H5Tset_size(memtype, HDstrlen(buf) + 1);
+ H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block);
+ H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf);
+ }
+ H5Dclose(dataset);
+ H5Gclose(group);
+
+
+ group = H5Gcreate2(fid, "/g6", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset = H5Dcreate2(group, "dset6", fxdlenstr, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ for(i = 0; (hsize_t)i < sdim; i++) {
+ start[0] = (hsize_t)i;
+ sprintf(buf, "This is row %1d of type H5T_STR_SPACEPAD of string array", i);
+ H5Tset_size(memtype, HDstrlen(buf) + 1);
+ H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block);
+ H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf);
+ }
+
+ H5Dclose(dataset);
+ H5Gclose(group);
+ H5Tclose(fxdlenstr);
+ H5Tclose(memtype);
+ H5Sclose(mem_space);
+ H5Sclose(hyper_space);
+ H5Sclose(space);
+ H5Fclose(fid);
+}
+
+static void gent_enum(void)
+{
+ /*some code is taken from enum.c in the test dir */
+ hid_t file, type, space, dset;
+ int val;
+ enumtype data[] = {RED, GREEN, BLUE, GREEN, WHITE,
+ WHITE, BLACK, GREEN, BLUE, RED,
+ RED, BLUE, GREEN, BLACK, WHITE,
+ RED, WHITE, GREEN, GREEN, BLUE};
+ hsize_t size[1] = {NELMTS(data)};
+
+ file = H5Fcreate(FILE15,H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Try to test names with special characters */
+ type = H5Tcreate(H5T_ENUM, sizeof(enumtype));
+ H5Tenum_insert(type, "RED", (val = 0, &val));
+ H5Tenum_insert(type, "GREEN\ngreen", (val = 1, &val));
+ H5Tenum_insert(type, "BLUE blue", (val = 2, &val));
+ H5Tenum_insert(type, "WHITE \"white\"", (val = 3, &val));
+ H5Tenum_insert(type, "BLACK \'black\'", (val = 4, &val));
+ H5Tcommit2(file, "enum normal", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ space = H5Screate_simple(1,size,NULL);
+ dset = H5Dcreate2(file,"table",type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Dwrite(dset, type, space, space, H5P_DEFAULT, data);
+
+ H5Dclose(dset);
+ H5Sclose(space);
+ H5Fclose(file);
+}
+
+static void gent_objref(void)
+{
+ /*some code is taken from enum.c in the test dir */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+
+ hid_t group; /* Group ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1; /* Datatype ID */
+ hsize_t dims1[] = {SPACE1_DIM1};
+ hobj_ref_t *wbuf, /* buffer to write to disk */
+ *rbuf, /* buffer read from disk */
+ *tbuf; /* temp. buffer read from disk */
+ uint32_t *tu32; /* Temporary pointer to uint32 data */
+ int i; /* counting variables */
+ const char *write_comment = "Foo!"; /* Comments for group */
+
+ /* Allocate write & read buffers */
+ wbuf = (hobj_ref_t*) HDmalloc(sizeof(hobj_ref_t) * SPACE1_DIM1);
+ rbuf = (hobj_ref_t*) HDmalloc(sizeof(hobj_ref_t) * SPACE1_DIM1);
+ tbuf = (hobj_ref_t*) HDmalloc(sizeof(hobj_ref_t) * SPACE1_DIM1);
+
+ /* Create file */
+ fid1 = H5Fcreate(FILE16, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Create dataspace for datasets */
+ sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL);
+
+ /* Create a group */
+ group = H5Gcreate2(fid1, "Group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Set group's comment */
+ H5Oset_comment(group, write_comment);
+
+ /* Create a dataset (inside Group1) */
+ dataset = H5Dcreate2(group, "Dataset1", H5T_STD_U32BE, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ for(tu32 = (uint32_t *)((void*)wbuf), i = 0; i < SPACE1_DIM1; i++)
+ *tu32++ = (uint32_t)(i * 3);
+
+ /* Write selection to disk */
+ H5Dwrite(dataset, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf);
+
+ /* Close Dataset */
+ H5Dclose(dataset);
+
+ /* Create another dataset (inside Group1) */
+ dataset = H5Dcreate2(group, "Dataset2", H5T_STD_U8BE, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Close Dataset */
+ H5Dclose(dataset);
+
+ /* Create a datatype to refer to */
+ tid1 = H5Tcreate(H5T_COMPOUND, sizeof(s1_t));
+
+ /* Insert fields */
+ H5Tinsert(tid1, "a", HOFFSET(s1_t,a), H5T_STD_I32BE);
+
+ H5Tinsert(tid1, "b", HOFFSET(s1_t,b), H5T_IEEE_F32BE);
+
+ H5Tinsert(tid1, "c", HOFFSET(s1_t,c), H5T_IEEE_F32BE);
+
+ /* Save datatype for later */
+ H5Tcommit2(group, "Datatype1", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Close datatype */
+ H5Tclose(tid1);
+
+ /* Close group */
+ H5Gclose(group);
+
+ /* Create a dataset */
+ dataset = H5Dcreate2(fid1, "Dataset3", H5T_STD_REF_OBJ, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Create reference to dataset */
+ H5Rcreate(&wbuf[0], fid1, "/Group1/Dataset1", H5R_OBJECT, (hid_t)-1);
+
+ /* Create reference to dataset */
+ H5Rcreate(&wbuf[1], fid1, "/Group1/Dataset2", H5R_OBJECT, (hid_t)-1);
+
+ /* Create reference to group */
+ H5Rcreate(&wbuf[2], fid1, "/Group1", H5R_OBJECT, (hid_t)-1);
+
+ /* Create reference to named datatype */
+ H5Rcreate(&wbuf[3], fid1, "/Group1/Datatype1", H5R_OBJECT, (hid_t)-1);
+
+ /* Write selection to disk */
+ H5Dwrite(dataset, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf);
+
+ /* Close disk dataspace */
+ H5Sclose(sid1);
+
+ /* Close Dataset */
+ H5Dclose(dataset);
+
+ /* Close file */
+ H5Fclose(fid1);
+
+ /* Free memory buffers */
+ HDfree(wbuf);
+ HDfree(rbuf);
+ HDfree(tbuf);
+}
+
+static void gent_datareg(void)
+{
+ /*some code is taken from enum.c in the test dir */
+
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dset1, /* Dataset ID */
+ dset2; /* Dereferenced dataset ID */
+ hid_t sid1, /* Dataspace ID #1 */
+ sid2; /* Dataspace ID #2 */
+ hsize_t dims1[] = {SPACE1_DIM1},
+ dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
+ hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */
+ hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */
+ hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */
+ hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */
+ hsize_t coord1[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */
+ hdset_reg_ref_t *wbuf, /* buffer to write to disk */
+ *rbuf; /* buffer read from disk */
+ uint8_t *dwbuf, /* Buffer for writing numeric data to disk */
+ *drbuf; /* Buffer for reading numeric data from disk */
+ uint8_t *tu8; /* Temporary pointer to uint8 data */
+ int i; /* counting variables */
+
+ /* Allocate write & read buffers */
+ wbuf = (hdset_reg_ref_t*) HDcalloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1);
+ rbuf = (hdset_reg_ref_t*) HDmalloc(sizeof(hdset_reg_ref_t)*SPACE1_DIM1);
+ dwbuf = (uint8_t*) HDmalloc(sizeof(uint8_t)*SPACE2_DIM1*SPACE2_DIM2);
+ drbuf = (uint8_t*) HDcalloc(sizeof(uint8_t),SPACE2_DIM1*SPACE2_DIM2);
+
+ /* Create file */
+ fid1 = H5Fcreate(FILE17, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Create dataspace for datasets */
+ sid2 = H5Screate_simple(SPACE2_RANK, dims2, NULL);
+
+ /* Create a dataset */
+ dset2 = H5Dcreate2(fid1, "Dataset2", H5T_STD_U8BE, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ for(tu8 = dwbuf, i = 0; i < SPACE2_DIM1 * SPACE2_DIM2; i++)
+ *tu8++ = (uint8_t)(i * 3);
+
+ /* Write selection to disk */
+ H5Dwrite(dset2, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, dwbuf);
+
+ /* Close Dataset */
+ H5Dclose(dset2);
+
+ /* Create dataspace for the reference dataset */
+ sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL);
+
+ /* Create a dataset */
+ dset1 = H5Dcreate2(fid1, "Dataset1", H5T_STD_REF_DSETREG, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Create references */
+
+ /* Select 6x6 hyperslab for first reference */
+ start[0] = 2; start[1] = 2;
+ stride[0] = 1; stride[1] = 1;
+ count[0] = 6; count[1] = 6;
+ block[0] = 1; block[1] = 1;
+ H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
+
+ H5Sget_select_npoints(sid2);
+
+ /* Store first dataset region */
+ H5Rcreate(&wbuf[0], fid1, "/Dataset2", H5R_DATASET_REGION, sid2);
+
+ /* Select sequence of ten points for second reference */
+ coord1[0][0]=6; coord1[0][1]=9;
+ coord1[1][0]=2; coord1[1][1]=2;
+ coord1[2][0]=8; coord1[2][1]=4;
+ coord1[3][0]=1; coord1[3][1]=6;
+ coord1[4][0]=2; coord1[4][1]=8;
+ coord1[5][0]=3; coord1[5][1]=2;
+ coord1[6][0]=0; coord1[6][1]=4;
+ coord1[7][0]=9; coord1[7][1]=0;
+ coord1[8][0]=7; coord1[8][1]=1;
+ coord1[9][0]=3; coord1[9][1]=3;
+ H5Sselect_elements(sid2,H5S_SELECT_SET,POINT1_NPOINTS,(hsize_t *)coord1);
+
+ H5Sget_select_npoints(sid2);
+
+ /* Store second dataset region */
+ H5Rcreate(&wbuf[1],fid1,"/Dataset2",H5R_DATASET_REGION,sid2);
+
+ /* Write selection to disk */
+ H5Dwrite(dset1,H5T_STD_REF_DSETREG,H5S_ALL,H5S_ALL,H5P_DEFAULT,wbuf);
+
+ /* Close disk dataspace */
+ H5Sclose(sid1);
+
+ /* Close Dataset */
+ H5Dclose(dset1);
+
+ /* Close uint8 dataset dataspace */
+ H5Sclose(sid2);
+
+ /* Close file */
+ H5Fclose(fid1);
+
+ /* Free memory buffers */
+ HDfree(wbuf);
+ HDfree(rbuf);
+ HDfree(dwbuf);
+ HDfree(drbuf);
+}
+
+static void gent_attrreg(void)
+{
+ /*some code is taken from enum.c in the test dir */
+
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dset1; /* Dataset ID */
+ hid_t dset2; /* Dereferenced dataset ID */
+ hid_t sid1; /* Dataspace ID #1 */
+ hid_t sid2; /* Dataspace ID #2 */
+ hid_t sid3; /* Dataspace ID #3 */
+ hid_t attr1; /* Attribute ID */
+ hsize_t dims1[] = {SPACE1_DIM1};
+ hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
+ hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */
+ hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */
+ hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */
+ hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */
+ hsize_t coord1[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */
+ hdset_reg_ref_t *wbuf; /* buffer to write to disk */
+ hdset_reg_ref_t *rbuf; /* buffer read from disk */
+ uint8_t *dwbuf; /* Buffer for writing numeric data to disk */
+ uint8_t *drbuf; /* Buffer for reading numeric data from disk */
+ uint8_t *tu8; /* Temporary pointer to uint8 data */
+ int i; /* counting variables */
+
+ /* Allocate write & read buffers */
+ wbuf = (hdset_reg_ref_t*) HDcalloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1);
+ rbuf = (hdset_reg_ref_t*) HDmalloc(sizeof(hdset_reg_ref_t)*SPACE1_DIM1);
+ dwbuf = (uint8_t*) HDmalloc(sizeof(uint8_t)*SPACE2_DIM1*SPACE2_DIM2);
+ drbuf = (uint8_t*) HDcalloc(sizeof(uint8_t),SPACE2_DIM1*SPACE2_DIM2);
+
+ /* Create file */
+ fid1 = H5Fcreate(FILE64, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Create dataspace for datasets */
+ sid2 = H5Screate_simple(SPACE2_RANK, dims2, NULL);
+
+ /* Create a dataset */
+ dset2 = H5Dcreate2(fid1, "Dataset2", H5T_STD_U8BE, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ for(tu8 = dwbuf, i = 0; i < SPACE2_DIM1 * SPACE2_DIM2; i++)
+ *tu8++ = (uint8_t)(i * 3);
+
+ /* Write selection to disk */
+ H5Dwrite(dset2, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, dwbuf);
+
+ /* Close Dataset */
+ H5Dclose(dset2);
+
+ /*
+ * Create dataset with a null dataspace to serve as the parent for
+ * the attribute.
+ */
+ sid1 = H5Screate (H5S_NULL);
+ dset1 = H5Dcreate2 (fid1, "Dataset1", H5T_STD_I32LE, sid1, H5P_DEFAULT,
+ H5P_DEFAULT, H5P_DEFAULT);
+ H5Sclose (sid1);
+
+ /* Create references */
+
+ /* Select 6x6 hyperslab for first reference */
+ start[0] = 2; start[1] = 2;
+ stride[0] = 1; stride[1] = 1;
+ count[0] = 6; count[1] = 6;
+ block[0] = 1; block[1] = 1;
+ H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
+
+ H5Sget_select_npoints(sid2);
+
+ /* Store first dataset region */
+ H5Rcreate(&wbuf[0], fid1, "/Dataset2", H5R_DATASET_REGION, sid2);
+
+ /* Select sequence of ten points for second reference */
+ coord1[0][0]=6; coord1[0][1]=9;
+ coord1[1][0]=2; coord1[1][1]=2;
+ coord1[2][0]=8; coord1[2][1]=4;
+ coord1[3][0]=1; coord1[3][1]=6;
+ coord1[4][0]=2; coord1[4][1]=8;
+ coord1[5][0]=3; coord1[5][1]=2;
+ coord1[6][0]=0; coord1[6][1]=4;
+ coord1[7][0]=9; coord1[7][1]=0;
+ coord1[8][0]=7; coord1[8][1]=1;
+ coord1[9][0]=3; coord1[9][1]=3;
+ H5Sselect_elements(sid2,H5S_SELECT_SET,POINT1_NPOINTS,(hsize_t *)coord1);
+
+ H5Sget_select_npoints(sid2);
+
+ /* Store second dataset region */
+ H5Rcreate(&wbuf[1],fid1,"/Dataset2",H5R_DATASET_REGION,sid2);
+
+ /* Create dataspace for the attribute */
+ sid3 = H5Screate_simple(SPACE1_RANK, dims1, NULL);
+
+ /* Create the attribute and write the region references to it. */
+ attr1 = H5Acreate2 (dset1, "Attribute1", H5T_STD_REF_DSETREG, sid3, H5P_DEFAULT,
+ H5P_DEFAULT);
+ H5Awrite (attr1, H5T_STD_REF_DSETREG, wbuf);
+
+ /* Close attribute dataspace */
+ H5Sclose(sid3);
+
+ /* Close attribute */
+ H5Aclose (attr1);
+
+ /* Close Dataset */
+ H5Dclose(dset1);
+
+ /* Close uint8 dataset dataspace */
+ H5Sclose(sid2);
+
+ /* Close file */
+ H5Fclose(fid1);
+
+ /* Free memory buffers */
+ HDfree(wbuf);
+ HDfree(rbuf);
+ HDfree(dwbuf);
+ HDfree(drbuf);
+}
+
+/*taken from Elena's compound test file*/
+static void gent_nestcomp(void)
+{
+ /* Compound memeber of the compound datatype*/
+ typedef struct cmp_t {
+ char a;
+ float b[2];
+ } cmp_t;
+
+ /* First structure and dataset*/
+ typedef struct s1_t {
+ int a;
+ float b;
+ double c;
+ cmp_t d;
+ } s2_t;
+ hid_t cmp_tid; /* Handle for the compound datatype */
+ hid_t char_id; /* Handle for the string datatype */
+ hid_t array_dt;
+ hsize_t array_dims[] = {2}; /* Dataspace dimensions */
+ unsigned ndims = 1; /* Number of dimensions in the array field */
+
+ s2_t s1[10];
+ hid_t s2_tid; /* File datatype identifier */
+
+ int i;
+ hid_t file, dataset, space; /* Handles */
+ herr_t status;
+ hsize_t dim[] = {10}; /* Dataspace dimensions */
+
+ char datasetname[] = "ArrayOfStructures";
+
+
+ /*
+ * Initialize the data
+ */
+ for(i = 0; i< 10; i++) {
+ s1[i].a = i;
+ s1[i].b = (float)(i*i);
+ s1[i].c = 1.0F/(float)(i + 1);
+ s1[i].d.a = (char)(65 + i);
+ s1[i].d.b[0] = -100.0F;
+ s1[i].d.b[1] = 100.0F;
+ }
+
+ /*
+ * Create the data space.
+ */
+ space = H5Screate_simple(1, dim, NULL);
+
+ /*
+ * Create the file.
+ */
+ file = H5Fcreate(FILE18, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create the memory data type.
+ */
+ /*
+ * Create a datatype for compound field first.
+ */
+ cmp_tid = H5Tcreate (H5T_COMPOUND, sizeof(cmp_t));
+
+ /* We are using C string of length one to represent "real" character */
+ char_id = H5Tcopy(H5T_C_S1);
+ H5Tset_strpad(char_id, H5T_STR_NULLTERM);
+ H5Tinsert(cmp_tid, "char_name", HOFFSET(cmp_t, a), char_id);
+
+ array_dt = H5Tarray_create2(H5T_NATIVE_FLOAT, ndims, array_dims);
+ H5Tinsert(cmp_tid, "array_name", HOFFSET(cmp_t, b), array_dt);
+ H5Tclose(array_dt);
+
+ s2_tid = H5Tcreate (H5T_COMPOUND, sizeof(s2_t));
+ H5Tinsert(s2_tid, "a_name", HOFFSET(s2_t, a), H5T_NATIVE_INT);
+ H5Tinsert(s2_tid, "c_name", HOFFSET(s2_t, c), H5T_NATIVE_DOUBLE);
+ H5Tinsert(s2_tid, "b_name", HOFFSET(s2_t, b), H5T_NATIVE_FLOAT);
+
+ /* Insert compound memeber created above */
+ H5Tinsert(s2_tid, "d_name", HOFFSET(s2_t, d), cmp_tid);
+
+ /*
+ * Create the dataset.
+ */
+ dataset = H5Dcreate2(file, datasetname, s2_tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Wtite data to the dataset;
+ */
+ status = H5Dwrite(dataset, s2_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, s1);
+ if(status < 0)
+ fprintf(stderr, "gent_nestcomp H5Dwrite failed\n");
+
+ /*
+ * Release resources
+ */
+ H5Tclose(s2_tid);
+ H5Tclose(cmp_tid);
+ H5Tclose(char_id);
+ H5Sclose(space);
+ H5Dclose(dataset);
+ H5Fclose(file);
+}
+
+static void gent_opaque(void)
+{
+ hid_t file, type, dataset, space;
+ char test[100][2];
+ int x;
+ hsize_t dim = 2;
+
+ for(x = 0; x < 100; x++){
+ test[x][0] = (char)x;
+ test[x][1] = (char)(99 - x);
+ }
+
+ /*
+ * Create the data space.
+ */
+ space = H5Screate_simple(1, &dim, NULL);
+
+ /*
+ * Create the file.
+ */
+ file = H5Fcreate(FILE19, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create the memory datatype.
+ */
+ type = H5Tcreate(H5T_OPAQUE, sizeof(char) * 100 * 2);
+ H5Tset_tag(type, "test opaque type");
+
+ /*
+ * Create the dataset.
+ */
+ dataset = H5Dcreate2(file, "opaque test", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Write data to the dataset;
+ */
+ H5Dwrite(dataset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, test);
+
+ H5Tclose(type);
+ H5Sclose(space);
+ H5Dclose(dataset);
+ H5Fclose(file);
+}
+
+static void gent_bitfields(void)
+{
+ hid_t file, grp=-1, type=-1, space=-1, dset=-1;
+ size_t i;
+ hsize_t nelmts;
+ unsigned char buf[32];
+
+ file = H5Fcreate(FILE20, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ if((grp = H5Gcreate2(file, "typetests", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error;
+
+ /* bitfield_1 */
+ nelmts = sizeof(buf);
+ if((type = H5Tcopy(H5T_STD_B8LE)) < 0 ||
+ (space = H5Screate_simple(1, &nelmts, NULL)) < 0 ||
+ (dset = H5Dcreate2(grp, "bitfield_1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+
+ for(i = 0; i < sizeof buf; i++)
+ buf[i] = (unsigned char)0xff ^ (unsigned char)i;
+ if(H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ goto error;
+ if(H5Sclose(space) < 0) goto error;
+ if(H5Tclose(type) < 0) goto error;
+ if(H5Dclose(dset) < 0) goto error;
+
+ /* bitfield_2 */
+ nelmts = sizeof(buf)/2;
+ if((type = H5Tcopy(H5T_STD_B16LE)) < 0 ||
+ (space = H5Screate_simple(1, &nelmts, NULL)) < 0 ||
+ (dset = H5Dcreate2(grp, "bitfield_2", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+ for(i = 0; i < sizeof buf; i++)
+ buf[i] = (unsigned char)0xff ^ (unsigned char)i;
+ if(H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ goto error;
+ if(H5Sclose(space) < 0) goto error;
+ if(H5Tclose(type) < 0) goto error;
+ if(H5Dclose(dset) < 0) goto error;
+ if(H5Gclose(grp) < 0) goto error;
+ H5Fclose(file);
+
+ error:
+ H5E_BEGIN_TRY {
+ H5Gclose(grp);
+ H5Tclose(type);
+ H5Sclose(space);
+ H5Dclose(dset);
+ } H5E_END_TRY;
+}
+
+static void gent_vldatatypes(void)
+{
+ hvl_t adata, wdata[SPACE1_DIM1];
+ hid_t file, dset, space, type;
+ hsize_t dims[] = { SPACE1_DIM1 };
+ int i;
+ herr_t ret=0;
+
+ file = H5Fcreate(FILE21, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Allocate and initialize VL dataset to write */
+ for(i = 0; i < SPACE1_DIM1; i++) {
+ int j;
+
+ wdata[i].p = HDmalloc((size_t)(i + 1) * sizeof(int));
+ wdata[i].len = (size_t)(i + 1);
+
+ for(j = 0; j < i + 1; j++)
+ ((int *)wdata[i].p)[j] = i * 10 + j;
+ }
+
+ /* write out the integers in little-endian format */
+ space = H5Screate_simple(SPACE1_RANK, dims, NULL);
+ type = H5Tvlen_create(H5T_NATIVE_INT);
+ dset = H5Dcreate2(file, "Dataset1.0", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ ret = H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
+ HDassert(ret >= 0);
+ ret = H5Dvlen_reclaim(type, space, H5P_DEFAULT, wdata);
+ HDassert(ret >= 0);
+
+ ret = H5Dclose(dset);
+ HDassert(ret >= 0);
+ ret = H5Tclose(type);
+ HDassert(ret >= 0);
+ ret = H5Sclose(space);
+ HDassert(ret >= 0);
+
+ /* Allocate and initialize VL dataset to write */
+ for(i = 0; i < SPACE1_DIM1; i++) {
+ int j;
+
+ wdata[i].p = HDmalloc((size_t)(i + 1) * sizeof(float));
+ wdata[i].len = (size_t)(i + 1);
+
+ for(j = 0; j < i + 1; j++)
+ ((float *)wdata[i].p)[j] = (float)((float)(i * 10) + ((float)j) / 10.0F);
+ } /* end for */
+
+ /* write out the floats in little-endian format */
+ space = H5Screate_simple(SPACE1_RANK, dims, NULL);
+ type = H5Tvlen_create(H5T_NATIVE_FLOAT);
+ dset = H5Dcreate2(file, "Dataset2.0", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ ret = H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
+ HDassert(ret >= 0);
+ ret = H5Dvlen_reclaim(type, space, H5P_DEFAULT, wdata);
+ HDassert(ret >= 0);
+
+ ret = H5Dclose(dset);
+ HDassert(ret >= 0);
+ ret = H5Tclose(type);
+ HDassert(ret >= 0);
+ ret = H5Sclose(space);
+ HDassert(ret >= 0);
+
+ /* Allocate and initialize a scalar VL dataset to write */
+ adata.p = HDmalloc(37 * sizeof(int));
+ adata.len = 37;
+
+ for(i = 0; i < 37; i++)
+ ((int *)adata.p)[i] = i * 2;
+
+ /* write out scalar VL dataset in little-endian format */
+ space = H5Screate_simple(0, NULL, NULL);
+ type = H5Tvlen_create(H5T_NATIVE_INT);
+ dset = H5Dcreate2(file, "Dataset3.0", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ ret = H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, &adata);
+ HDassert(ret >= 0);
+ ret = H5Dvlen_reclaim(type, space, H5P_DEFAULT, &adata);
+ HDassert(ret >= 0);
+
+ ret = H5Dclose(dset);
+ HDassert(ret >= 0);
+ ret = H5Tclose(type);
+ HDassert(ret >= 0);
+ ret = H5Sclose(space);
+ HDassert(ret >= 0);
+ ret = H5Fclose(file);
+ HDassert(ret >= 0);
+}
+
+static void
+gent_vldatatypes2(void)
+{
+ hvl_t wdata[SPACE1_DIM1]; /* Information to write */
+ hvl_t *t1; /* Temporary pointer to VL information */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1, tid2; /* Datatype IDs */
+ hsize_t dims1[] = {SPACE1_DIM1};
+ unsigned i,j,k; /* counting variables */
+ herr_t ret; /* Generic return value */
+
+ /* Allocate and initialize VL data to write */
+ for(i = 0; i < SPACE1_DIM1; i++) {
+ wdata[i].p = (hvl_t *)HDmalloc((i + 1) * sizeof(hvl_t));
+ if(wdata[i].p == NULL) {
+ printf("Cannot allocate memory for VL data! i=%u\n", i);
+ return;
+ } /* end if */
+ wdata[i].len = i + 1;
+ for(t1 = (hvl_t *)wdata[i].p, j = 0; j < (i + 1); j++, t1++) {
+ t1->p = (unsigned *)HDmalloc((j + 1) * sizeof(unsigned));
+ if(t1->p == NULL) {
+ printf("Cannot allocate memory for VL data! i=%u, j=%u\n",i,j);
+ return;
+ } /* end if */
+ t1->len=j+1;
+ for(k=0; k<(j+1); k++)
+ ((unsigned int *)t1->p)[k]=i*100+j*10+k;
+ } /* end for */
+ } /* end for */
+
+ /* Create file */
+ fid1 = H5Fcreate(FILE22, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Create dataspace for datasets */
+ sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL);
+
+ /* Create a VL datatype to refer to */
+ tid1 = H5Tvlen_create(H5T_NATIVE_UINT);
+
+ /* Create the base VL type */
+ tid2 = H5Tvlen_create(tid1);
+
+ /* Create a dataset */
+ dataset = H5Dcreate2(fid1, "Dataset1", tid2, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Write dataset to disk */
+ ret = H5Dwrite(dataset, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
+ HDassert(ret >= 0);
+
+ /* Reclaim the write VL data */
+ ret = H5Dvlen_reclaim(tid2, sid1, H5P_DEFAULT, wdata);
+ HDassert(ret >= 0);
+
+ /* Close Dataset */
+ ret = H5Dclose(dataset);
+ HDassert(ret >= 0);
+ ret = H5Tclose(tid2);
+ HDassert(ret >= 0);
+ ret = H5Tclose(tid1);
+ HDassert(ret >= 0);
+ ret = H5Sclose(sid1);
+ HDassert(ret >= 0);
+ ret = H5Fclose(fid1);
+ HDassert(ret >= 0);
+
+}
+
+static void gent_vldatatypes3(void)
+{
+ typedef struct { /* Struct that the VL sequences are composed of */
+ int i;
+ float f;
+ hvl_t v;
+ } s1;
+ s1 wdata[SPACE1_DIM1]; /* Information to write */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1, tid2; /* Datatype IDs */
+ hsize_t dims1[] = {SPACE1_DIM1};
+ unsigned i,j; /* counting variables */
+ herr_t ret; /* Generic return value */
+
+ /* Allocate and initialize VL data to write */
+ for(i=0; i<SPACE1_DIM1; i++) {
+ wdata[i].i = (int)(i * 10);
+ wdata[i].f = (float)((float)(i * 20)/3.0F);
+ wdata[i].v.p = HDmalloc((size_t)(i + 1) * sizeof(unsigned int));
+ wdata[i].v.len = (size_t)(i + 1);
+ for(j = 0; j < (i + 1); j++)
+ ((unsigned int *)wdata[i].v.p)[j] = i * 10 + j;
+ } /* end for */
+
+ /* Create file */
+ fid1 = H5Fcreate(FILE23, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Create dataspace for datasets */
+ sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL);
+
+ /* Create a VL datatype to refer to */
+ tid1 = H5Tvlen_create(H5T_NATIVE_UINT);
+
+ /* Create the base compound type */
+ tid2 = H5Tcreate(H5T_COMPOUND, sizeof(s1));
+
+ /* Insert fields */
+ ret = H5Tinsert(tid2, "i", HOFFSET(s1, i), H5T_NATIVE_INT);
+ HDassert(ret >= 0);
+ ret = H5Tinsert(tid2, "f", HOFFSET(s1, f), H5T_NATIVE_FLOAT);
+ HDassert(ret >= 0);
+ ret = H5Tinsert(tid2, "v", HOFFSET(s1, v), tid1);
+ HDassert(ret >= 0);
+
+ /* Create a dataset */
+ dataset = H5Dcreate2(fid1, "Dataset1", tid2, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Write dataset to disk */
+ ret = H5Dwrite(dataset, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
+ HDassert(ret >= 0);
+
+ /* Reclaim the write VL data */
+ ret = H5Dvlen_reclaim(tid2, sid1, H5P_DEFAULT, wdata);
+ HDassert(ret >= 0);
+
+ /* Close Dataset */
+ ret = H5Dclose(dataset);
+ HDassert(ret >= 0);
+ ret = H5Tclose(tid2);
+ HDassert(ret >= 0);
+ ret = H5Tclose(tid1);
+ HDassert(ret >= 0);
+ ret = H5Sclose(sid1);
+ HDassert(ret >= 0);
+ ret = H5Fclose(fid1);
+ HDassert(ret >= 0);
+}
+
+static void gent_vldatatypes4(void)
+{
+ typedef struct { /* Struct that the VL sequences are composed of */
+ int i;
+ float f;
+ } s1;
+ hvl_t wdata[SPACE1_DIM1]; /* Information to write */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1, tid2; /* Datatype IDs */
+ hsize_t dims1[] = {SPACE1_DIM1};
+ unsigned i,j; /* counting variables */
+ herr_t ret; /* Generic return value */
+
+ /* Allocate and initialize VL data to write */
+ for(i=0; i<SPACE1_DIM1; i++) {
+ wdata[i].p = HDmalloc((i + 1) * sizeof(s1));
+ wdata[i].len = i + 1;
+ for(j = 0; j < (i + 1); j++) {
+ ((s1 *)wdata[i].p)[j].i = (int)(i * 10 + j);
+ ((s1 *)wdata[i].p)[j].f = (float)((float)(i * 20 + j) / 3.0F);
+ } /* end for */
+ } /* end for */
+
+ /* Create file */
+ fid1 = H5Fcreate(FILE24, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Create dataspace for datasets */
+ sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL);
+
+ /* Create the base compound type */
+ tid2 = H5Tcreate(H5T_COMPOUND, sizeof(s1));
+
+ /* Insert fields */
+ ret = H5Tinsert(tid2, "i", HOFFSET(s1, i), H5T_NATIVE_INT);
+ HDassert(ret >= 0);
+ ret = H5Tinsert(tid2, "f", HOFFSET(s1, f), H5T_NATIVE_FLOAT);
+ HDassert(ret >= 0);
+
+ /* Create a datatype to refer to */
+ tid1 = H5Tvlen_create(tid2);
+
+ /* Create a dataset */
+ dataset = H5Dcreate2(fid1, "Dataset1", tid1, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Write dataset to disk */
+ ret = H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
+ HDassert(ret >= 0);
+
+ /* Reclaim the write VL data */
+ ret = H5Dvlen_reclaim(tid1, sid1, H5P_DEFAULT, wdata);
+ HDassert(ret >= 0);
+
+ /* Close Dataset */
+ ret = H5Dclose(dataset);
+ HDassert(ret >= 0);
+ ret = H5Tclose(tid1);
+ HDassert(ret >= 0);
+ ret = H5Tclose(tid2);
+ HDassert(ret >= 0);
+ ret = H5Sclose(sid1);
+ HDassert(ret >= 0);
+ ret = H5Fclose(fid1);
+ HDassert(ret >= 0);
+}
+
+/* Generate a variable-length dataset with NULL values in it */
+static void gent_vldatatypes5(void)
+{
+ hvl_t wdata [SPACE1_DIM1];
+ hid_t fid1;
+ hid_t dataset;
+ hid_t sid1;
+ hid_t tid1;
+ hsize_t dims1[] = {SPACE1_DIM1};
+ int i,j; /* counting variable */
+ herr_t ret; /* Generic return value */
+
+ /* initialize data for dataset */
+ for(i=0; i<SPACE1_DIM1; i++) {
+ if(i%2) {
+ wdata[i].len=0;
+ wdata[i].p=NULL;
+ } /* end if */
+ else {
+ wdata[i].len = (size_t)(i + 5);
+ wdata[i].p = HDmalloc(sizeof(unsigned) * (size_t)(i + 5));
+ for(j = 0; j < i + 5; j++)
+ ((unsigned *)wdata[i].p)[j] = (unsigned)(j * 2);
+ } /* end else */
+ } /* end for */
+
+ /* Create file */
+ fid1 = H5Fcreate(FILE43, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ HDassert(fid1>0);
+
+ /* Create dataspace for datasets */
+ sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL);
+ HDassert(sid1>0);
+
+ /* Create a datatype to refer to */
+ tid1 = H5Tvlen_create(H5T_NATIVE_UINT);
+ HDassert(tid1>0);
+
+ /* Create a dataset */
+ dataset = H5Dcreate2(fid1, F43_DSETNAME, tid1, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ HDassert(dataset>0);
+
+ ret = H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
+ HDassert(ret >= 0);
+
+ ret = H5Dclose(dataset);
+ HDassert(ret >= 0);
+
+ ret = H5Dvlen_reclaim(tid1, sid1, H5P_DEFAULT, wdata);
+ HDassert(ret >= 0);
+
+ ret = H5Tclose(tid1);
+ HDassert(ret >= 0);
+
+ ret = H5Sclose (sid1);
+ HDassert(ret >= 0);
+
+ ret = H5Fclose (fid1);
+ HDassert(ret >= 0);
+}
+
+/* This is big enough to make h5dump to use hyperslap to read
+ from file and display portion by portion. This also prints out array indices
+ via region reference for testing refion reference output.
+ Note: this was added originally prepared for bug2092. before the fix h5dump didn't
+ display array indices every 262 x N (N > 0) based on 2000x1000 dims.
+ */
+#define SPACE_ARRAY1BIG_DIM 2000
+#define ARRAY1BIG_DIM 1000
+
+static void gent_array1_big(void)
+{
+ int *wdata; /* Information to write */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1; /* Datatype ID */
+ hsize_t sdims1[] = {SPACE_ARRAY1BIG_DIM};
+ hsize_t tdims1[] = {ARRAY1BIG_DIM};
+ int i,j; /* counting variables */
+ herr_t ret; /* Generic return value */
+
+
+ /* for region reference dataset */
+ hid_t dset2;
+ hid_t sid2;
+ hsize_t dims2[] = {SPACE1_DIM1};
+ hsize_t start[SPACE1_RANK]; /* Starting location of hyperslab */
+ hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */
+ hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */
+ hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */
+ hdset_reg_ref_t *wbuf; /* buffer to write to disk */
+
+ start[0] = 0;
+ stride[0] = 1;
+ count[0] = 999;
+ block[0] = 1;
+
+ /* Allocate write & read buffers */
+ wbuf = (hdset_reg_ref_t*) HDcalloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1);
+ wdata = (int *)HDmalloc(sizeof(int) * (size_t)(SPACE_ARRAY1BIG_DIM * ARRAY1BIG_DIM));
+
+ /* Allocate and initialize array data to write */
+ for(i = 0; i < SPACE_ARRAY1BIG_DIM; i++)
+ for(j = 0; j < ARRAY1BIG_DIM; j++)
+ *(wdata + (i * ARRAY1BIG_DIM) + j) = i * 1;
+
+ /* Create file */
+ fid1 = H5Fcreate(FILE25_BIG, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*-------------------------
+ * Array type dataset
+ */
+ /* Create dataspace for datasets */
+ sid1 = H5Screate_simple(SPACE1_RANK, sdims1, NULL);
+
+ /* Create a datatype to refer to */
+ tid1 = H5Tarray_create2(H5T_NATIVE_INT, ARRAY1_RANK, tdims1);
+
+ /* Create a dataset */
+ dataset = H5Dcreate2(fid1, "Dataset1", tid1, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Write dataset to disk */
+ ret = H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
+ HDassert(ret >= 0);
+
+ /*---------------------------
+ * Region Reference dataset
+ */
+ /* Create dataspace for the reference dataset */
+ sid2 = H5Screate_simple(SPACE1_RANK, dims2, NULL);
+
+ /* Create a dataset */
+ dset2 = H5Dcreate2(fid1, "Dataset2", H5T_STD_REF_DSETREG, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Create references */
+ H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, stride, count, block);
+
+ H5Sget_select_npoints(sid1);
+
+ /* Create Dataset1 region */
+ H5Rcreate(&wbuf[0], fid1, "/Dataset1", H5R_DATASET_REGION, sid1);
+
+ /* Write selection to disk */
+ H5Dwrite(dset2,H5T_STD_REF_DSETREG,H5S_ALL,H5S_ALL,H5P_DEFAULT,wbuf);
+
+ /* Close Dataset */
+ ret = H5Dclose(dataset);
+ HDassert(ret >= 0);
+ ret = H5Tclose(tid1);
+ HDassert(ret >= 0);
+ ret = H5Sclose(sid1);
+ HDassert(ret >= 0);
+ ret = H5Fclose(fid1);
+ HDassert(ret >= 0);
+
+ /* Release memory */
+ HDfree(wbuf);
+ HDfree(wdata);
+}
+
+static void gent_array1(void)
+{
+ int wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1; /* Datatype ID */
+ hsize_t sdims1[] = {SPACE1_DIM1};
+ hsize_t tdims1[] = {ARRAY1_DIM1};
+ int i,j; /* counting variables */
+ herr_t ret; /* Generic return value */
+
+ /* Allocate and initialize array data to write */
+ for(i=0; i<SPACE1_DIM1; i++)
+ for(j=0; j<ARRAY1_DIM1; j++)
+ wdata[i][j]=i*10+j;
+
+ /* Create file */
+ fid1 = H5Fcreate(FILE25, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Create dataspace for datasets */
+ sid1 = H5Screate_simple(SPACE1_RANK, sdims1, NULL);
+
+ /* Create a datatype to refer to */
+ tid1 = H5Tarray_create2(H5T_NATIVE_INT, ARRAY1_RANK, tdims1);
+
+ /* Create a dataset */
+ dataset = H5Dcreate2(fid1, "Dataset1", tid1, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Write dataset to disk */
+ ret = H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
+ HDassert(ret >= 0);
+
+ /* Close Dataset */
+ ret = H5Dclose(dataset);
+ HDassert(ret >= 0);
+ ret = H5Tclose(tid1);
+ HDassert(ret >= 0);
+ ret = H5Sclose(sid1);
+ HDassert(ret >= 0);
+ ret = H5Fclose(fid1);
+ HDassert(ret >= 0);
+}
+
+static void gent_array2(void)
+{
+ int wdata[SPACE1_DIM1][ARRAY2_DIM1][ARRAY2_DIM2][ARRAY2_DIM3]; /* Information to write */
+ hid_t fid; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t tid; /* Datatype ID */
+ hsize_t sdims1[] = {SPACE1_DIM1};
+ hsize_t tdims2[] = {ARRAY2_DIM1,ARRAY2_DIM2,ARRAY2_DIM3};
+ int i,j,k,l; /* counting variables */
+ herr_t ret; /* Generic return value */
+
+ /* Allocate and initialize array data to write */
+ for(i=0; i<SPACE1_DIM1; i++)
+ for(j=0; j<ARRAY2_DIM1; j++)
+ for(k=0; k<ARRAY2_DIM2; k++)
+ for(l=0; l<ARRAY2_DIM3; l++)
+ wdata[i][j][k][l]=i*1000+j*100+k*10+l;
+
+ /* Create file */
+ fid = H5Fcreate(FILE26, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Create dataspace for datasets */
+ sid = H5Screate_simple(SPACE1_RANK, sdims1, NULL);
+
+ /* Create a datatype to refer to */
+ tid = H5Tarray_create2(H5T_NATIVE_INT, ARRAY2_RANK, tdims2);
+
+ /* Create a dataset */
+ dataset = H5Dcreate2(fid, "Dataset1", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Write dataset to disk */
+ ret = H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
+ HDassert(ret >= 0);
+
+ /* Close Dataset */
+ ret = H5Dclose(dataset);
+ HDassert(ret >= 0);
+ ret = H5Tclose(tid);
+ HDassert(ret >= 0);
+ ret = H5Sclose(sid);
+ HDassert(ret >= 0);
+ ret = H5Fclose(fid);
+ HDassert(ret >= 0);
+}
+
+static void gent_array3(void)
+{
+ int wdata[SPACE1_DIM1][ARRAY1_DIM1][ARRAY3_DIM1][ARRAY3_DIM2]; /* Information to write */
+ hid_t fid; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t tid1; /* 1-D array Datatype ID */
+ hid_t tid2; /* 2-D array Datatype ID */
+ hsize_t sdims1[] = {SPACE1_DIM1};
+ hsize_t tdims1[] = {ARRAY1_DIM1};
+ hsize_t tdims2[] = {ARRAY3_DIM1,ARRAY3_DIM2};
+ int i,j,k,l; /* counting variables */
+ herr_t ret; /* Generic return value */
+
+ /* Allocate and initialize array data to write */
+ for(i=0; i<SPACE1_DIM1; i++)
+ for(j=0; j<ARRAY1_DIM1; j++)
+ for(k=0; k<ARRAY3_DIM1; k++)
+ for(l=0; l<ARRAY3_DIM2; l++)
+ wdata[i][j][k][l]=i*1000+j*100+k*10+l;
+
+ /* Create file */
+ fid = H5Fcreate(FILE27, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Create dataspace for datasets */
+ sid = H5Screate_simple(SPACE1_RANK, sdims1, NULL);
+
+ /* Create a 2-D datatype to refer to */
+ tid2 = H5Tarray_create2(H5T_NATIVE_INT, ARRAY3_RANK, tdims2);
+
+ /* Create a 1-D datatype to refer to */
+ tid1 = H5Tarray_create2(tid2, ARRAY1_RANK, tdims1);
+
+ /* Create a dataset */
+ dataset = H5Dcreate2(fid, "Dataset1", tid1, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Write dataset to disk */
+ ret = H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
+ HDassert(ret >= 0);
+
+ /* Close Dataset */
+ ret = H5Dclose(dataset);
+ HDassert(ret >= 0);
+ ret = H5Tclose(tid1);
+ HDassert(ret >= 0);
+ ret = H5Tclose(tid2);
+ HDassert(ret >= 0);
+ ret = H5Sclose(sid);
+ HDassert(ret >= 0);
+ ret = H5Fclose(fid);
+ HDassert(ret >= 0);
+}
+
+static void gent_array4(void)
+{
+ typedef struct { /* Typedef for compound datatype */
+ int i;
+ float f;
+ } s2_t;
+ s2_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1; /* Array Datatype ID */
+ hid_t tid2; /* Compound Datatype ID */
+ hsize_t sdims1[] = {SPACE1_DIM1};
+ hsize_t tdims1[] = {ARRAY1_DIM1};
+ int i,j; /* counting variables */
+ herr_t ret; /* Generic return value */
+
+ /* Initialize array data to write */
+ for(i=0; i<SPACE1_DIM1; i++)
+ for(j=0; j<ARRAY1_DIM1; j++) {
+ wdata[i][j].i = i * 10 + j;
+ wdata[i][j].f = (float)((float)i * 2.5F + (float)j);
+ } /* end for */
+
+ /* Create file */
+ fid1 = H5Fcreate(FILE28, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Create dataspace for datasets */
+ sid1 = H5Screate_simple(SPACE1_RANK, sdims1, NULL);
+
+ /* Create a compound datatype to refer to */
+ tid2 = H5Tcreate(H5T_COMPOUND, sizeof(s2_t));
+
+ /* Insert integer field */
+ ret = H5Tinsert(tid2, "i", HOFFSET(s2_t, i), H5T_NATIVE_INT);
+ HDassert(ret >= 0);
+
+ /* Insert float field */
+ ret = H5Tinsert(tid2, "f", HOFFSET(s2_t, f), H5T_NATIVE_FLOAT);
+ HDassert(ret >= 0);
+
+ /* Create an array datatype to refer to */
+ tid1 = H5Tarray_create2(tid2, ARRAY1_RANK, tdims1);
+
+ /* Close compound datatype */
+ ret = H5Tclose(tid2);
+ HDassert(ret >= 0);
+
+ /* Create a dataset */
+ dataset = H5Dcreate2(fid1, "Dataset1", tid1, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Write dataset to disk */
+ ret = H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
+ HDassert(ret >= 0);
+
+ /* Close Dataset */
+ ret = H5Dclose(dataset);
+ HDassert(ret >= 0);
+ ret = H5Tclose(tid1);
+ HDassert(ret >= 0);
+ ret = H5Sclose(sid1);
+ HDassert(ret >= 0);
+ ret = H5Fclose(fid1);
+ HDassert(ret >= 0);
+}
+
+static void gent_array5(void)
+{
+ typedef struct { /* Typedef for compound datatype */
+ int i;
+ float f[ARRAY1_DIM1];
+ } s2_t;
+ s2_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1; /* Array Datatype ID */
+ hid_t tid2; /* Compound Datatype ID */
+ hid_t tid3; /* Nested Array Datatype ID */
+ hsize_t sdims1[] = {SPACE1_DIM1};
+ hsize_t tdims1[] = {ARRAY1_DIM1};
+ int i,j,k; /* counting variables */
+ herr_t ret; /* Generic return value */
+
+ /* Initialize array data to write */
+ for(i=0; i<SPACE1_DIM1; i++)
+ for(j=0; j<ARRAY1_DIM1; j++) {
+ wdata[i][j].i = i * 10 + j;
+ for(k=0; k<ARRAY1_DIM1; k++)
+ wdata[i][j].f[k] = (float)((float)i * 10 + (float)j * 2.5F + (float)k);
+ } /* end for */
+
+ /* Create file */
+ fid1 = H5Fcreate(FILE29, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Create dataspace for datasets */
+ sid1 = H5Screate_simple(SPACE1_RANK, sdims1, NULL);
+
+ /* Create a compound datatype to refer to */
+ tid2 = H5Tcreate(H5T_COMPOUND, sizeof(s2_t));
+
+ /* Insert integer field */
+ ret = H5Tinsert (tid2, "i", HOFFSET(s2_t,i), H5T_NATIVE_INT);
+ HDassert(ret >= 0);
+
+ /* Create an array of floats datatype */
+ tid3 = H5Tarray_create2(H5T_NATIVE_FLOAT, ARRAY1_RANK, tdims1);
+
+ /* Insert float array field */
+ ret = H5Tinsert (tid2, "f", HOFFSET(s2_t,f), tid3);
+ HDassert(ret >= 0);
+
+ /* Close array of floats field datatype */
+ ret = H5Tclose(tid3);
+ HDassert(ret >= 0);
+
+ /* Create an array datatype to refer to */
+ tid1 = H5Tarray_create2(tid2, ARRAY1_RANK, tdims1);
+
+ /* Close compound datatype */
+ ret = H5Tclose(tid2);
+ HDassert(ret >= 0);
+
+ /* Create a dataset */
+ dataset = H5Dcreate2(fid1, "Dataset1", tid1, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Write dataset to disk */
+ ret = H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
+ HDassert(ret >= 0);
+
+ /* Close Dataset */
+ ret = H5Dclose(dataset);
+ HDassert(ret >= 0);
+ ret = H5Tclose(tid1);
+ HDassert(ret >= 0);
+ ret = H5Sclose(sid1);
+ HDassert(ret >= 0);
+ ret = H5Fclose(fid1);
+ HDassert(ret >= 0);
+}
+
+static void gent_array6(void)
+{
+ hvl_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1; /* Array Datatype ID */
+ hid_t tid2; /* VL Datatype ID */
+ hsize_t sdims1[] = {SPACE1_DIM1};
+ hsize_t tdims1[] = {ARRAY1_DIM1};
+ int i,j,k; /* counting variables */
+ herr_t ret; /* Generic return value */
+
+ /* Initialize array data to write */
+ for(i=0; i<SPACE1_DIM1; i++)
+ for(j=0; j<ARRAY1_DIM1; j++) {
+ wdata[i][j].p = HDmalloc((size_t)(i + j + 1) * sizeof(unsigned int));
+ wdata[i][j].len = (size_t)(i + j + 1);
+ for(k = 0; k < (i + j + 1); k++)
+ ((unsigned int *)wdata[i][j].p)[k] = (unsigned)(i * 100 + j * 10 + k);
+ } /* end for */
+
+ /* Create file */
+ fid1 = H5Fcreate(FILE30, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Create dataspace for datasets */
+ sid1 = H5Screate_simple(SPACE1_RANK, sdims1, NULL);
+
+ /* Create a compound datatype to refer to */
+ tid2 = H5Tvlen_create(H5T_NATIVE_UINT);
+
+ /* Create an array datatype to refer to */
+ tid1 = H5Tarray_create2(tid2, ARRAY1_RANK, tdims1);
+
+ /* Close VL datatype */
+ ret = H5Tclose(tid2);
+ HDassert(ret >= 0);
+
+ /* Create a dataset */
+ dataset = H5Dcreate2(fid1, "Dataset1", tid1, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Write dataset to disk */
+ ret = H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
+ HDassert(ret >= 0);
+
+ /* Reclaim the write VL data */
+ ret = H5Dvlen_reclaim(tid1, sid1, H5P_DEFAULT, wdata);
+ HDassert(ret >= 0);
+
+ /* Close Dataset */
+ ret = H5Dclose(dataset);
+ HDassert(ret >= 0);
+ ret = H5Tclose(tid1);
+ HDassert(ret >= 0);
+ ret = H5Sclose(sid1);
+ HDassert(ret >= 0);
+ ret = H5Fclose(fid1);
+ HDassert(ret >= 0);
+}
+
+static void gent_array7(void)
+{
+ hvl_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1; /* Array Datatype ID */
+ hid_t tid2; /* VL Datatype ID */
+ hid_t tid3; /* Nested Array Datatype ID */
+ hsize_t sdims1[] = {SPACE1_DIM1};
+ hsize_t tdims1[] = {ARRAY1_DIM1};
+ int i,j,k,l; /* Index variables */
+ herr_t ret; /* Generic return value */
+
+ /* Initialize array data to write */
+ for(i=0; i<SPACE1_DIM1; i++)
+ for(j=0; j<ARRAY1_DIM1; j++) {
+ wdata[i][j].p = HDmalloc((size_t)(i + j + 1) * (sizeof(unsigned int) * ARRAY1_DIM1));
+ wdata[i][j].len = (size_t)(i + j + 1);
+ for(k = 0; k < (i + j + 1); k++)
+ for(l = 0; l<ARRAY1_DIM1; l++)
+ ((unsigned int *)wdata[i][j].p)[k * ARRAY1_DIM1 + l] = (unsigned)(i * 1000+j * 100+k * 10 + l);
+ } /* end for */
+
+ /* Create file */
+ fid1 = H5Fcreate(FILE31, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Create dataspace for datasets */
+ sid1 = H5Screate_simple(SPACE1_RANK, sdims1, NULL);
+
+ /* Create the nested array datatype to refer to */
+ tid3 = H5Tarray_create2(H5T_NATIVE_UINT, ARRAY1_RANK, tdims1);
+
+ /* Create a VL datatype of 1-D arrays to refer to */
+ tid2 = H5Tvlen_create(tid3);
+
+ /* Close nested array datatype */
+ ret = H5Tclose(tid3);
+ HDassert(ret >= 0);
+
+ /* Create an array datatype to refer to */
+ tid1 = H5Tarray_create2(tid2, ARRAY1_RANK, tdims1);
+
+ /* Close VL datatype */
+ ret = H5Tclose(tid2);
+ HDassert(ret >= 0);
+
+ /* Create a dataset */
+ dataset = H5Dcreate2(fid1, "Dataset1", tid1, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Write dataset to disk */
+ ret = H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
+ HDassert(ret >= 0);
+
+ /* Reclaim the write VL data */
+ ret = H5Dvlen_reclaim(tid1, sid1, H5P_DEFAULT, wdata);
+ HDassert(ret >= 0);
+
+ /* Close Dataset */
+ ret = H5Dclose(dataset);
+ HDassert(ret >= 0);
+ ret = H5Tclose(tid1);
+ HDassert(ret >= 0);
+ ret = H5Sclose(sid1);
+ HDassert(ret >= 0);
+ ret = H5Fclose(fid1);
+ HDassert(ret >= 0);
+}
+
+/* Test the boundary of the display output buffer at the reallocation event */
+static void gent_array8(void)
+{
+ hid_t file = -1; /* Handles */
+ hid_t filetype = -1; /* Handles */
+ hid_t space = -1; /* Handles */
+ hid_t dset = -1; /* Handles */
+ herr_t status = -1;
+ hsize_t sdims[] = {F64_DIM0};
+ hsize_t tdims[] = {F64_DIM1};
+ int *wdata; /* Write buffer */
+ unsigned int i;
+
+ /* Allocate data buffer */
+ wdata = HDmalloc(F64_DIM1 * sizeof(int));
+ HDassert(wdata);
+
+ /*
+ * Initialize data. i is the element in the dataspace, j and k the
+ * elements within the array datatype.
+ */
+ for (i = 0; i < F64_DIM1; i++)
+ wdata[i] = (int)i;
+
+ /*
+ * Create a new file using the default properties.
+ */
+ file = H5Fcreate (F64_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create array datatypes for file and memory.
+ */
+ filetype = H5Tarray_create2 (H5T_NATIVE_INT, 1, tdims);
+
+ /*
+ * Create dataspace. Setting maximum size to NULL sets the maximum
+ * size to be the current size.
+ */
+ space = H5Screate_simple (1, sdims, NULL);
+
+ /*
+ * Create the dataset and write the array data to it.
+ */
+ if(file>=0 && filetype>=0 && space>=0) {
+ dset = H5Dcreate2 (file, F64_DATASET, filetype, space, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT);
+ if(dset>=0)
+ status = H5Dwrite (dset, filetype, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
+ HDassert(status >= 0);
+ }
+
+ /*
+ * Close and release resources.
+ */
+ status = H5Dclose (dset);
+ HDassert(status >= 0);
+ status = H5Sclose (space);
+ HDassert(status >= 0);
+ status = H5Tclose (filetype);
+ HDassert(status >= 0);
+ status = H5Fclose (file);
+ HDassert(status >= 0);
+ HDfree(wdata);
+}
+
+static void gent_empty(void)
+{
+ typedef struct {
+ int a;
+ float b;
+ char c;
+ } empty_struct;
+ hid_t file, dset, space, type;
+ hsize_t dims[] = { SPACE1_DIM1 };
+ herr_t ret=0;
+
+ file = H5Fcreate(FILE32, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ space = H5Screate_simple(SPACE1_RANK, dims, NULL);
+
+ /* write out an empty vlen dataset */
+ type = H5Tvlen_create(H5T_NATIVE_INT);
+ dset = H5Dcreate2(file, "Dataset1.0", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ /* Don't write any data */
+ ret = H5Dclose(dset);
+ HDassert(ret >= 0);
+ ret = H5Tclose(type);
+ HDassert(ret >= 0);
+
+ /* write out an empty native integer dataset dataset */
+ dset = H5Dcreate2(file, "Dataset2.0", H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ /* Don't write any data */
+ ret = H5Dclose(dset);
+ HDassert(ret >= 0);
+
+ /* write out an empty native floating-point dataset dataset */
+ dset = H5Dcreate2(file, "Dataset3.0", H5T_NATIVE_FLOAT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ /* Don't write any data */
+ ret = H5Dclose(dset);
+ HDassert(ret >= 0);
+
+ /* write out an empty array dataset */
+ type = H5Tarray_create2(H5T_NATIVE_INT, SPACE1_RANK, dims);
+ dset = H5Dcreate2(file, "Dataset4.0", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ /* Don't write any data */
+ ret = H5Dclose(dset);
+ HDassert(ret >= 0);
+ ret = H5Tclose(type);
+ HDassert(ret >= 0);
+
+ /* write out an empty compound dataset */
+ type = H5Tcreate(H5T_COMPOUND,sizeof(empty_struct));
+ H5Tinsert(type, "a", HOFFSET(empty_struct, a),H5T_NATIVE_INT);
+ H5Tinsert(type, "b", HOFFSET(empty_struct, b),H5T_NATIVE_FLOAT);
+ H5Tinsert(type, "c", HOFFSET(empty_struct, c),H5T_NATIVE_CHAR);
+ dset = H5Dcreate2(file, "Dataset5.0", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ /* Don't write any data */
+ ret = H5Dclose(dset);
+ HDassert(ret >= 0);
+ ret = H5Tclose(type);
+ HDassert(ret >= 0);
+
+ ret = H5Sclose(space);
+ HDassert(ret >= 0);
+
+ ret = H5Fclose(file);
+ HDassert(ret >= 0);
+}
+
+static void
+gent_group_comments(void)
+{
+ hid_t fid, group;
+
+ fid = H5Fcreate(FILE33, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* / */
+ group = H5Gcreate2(fid, "/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Oset_comment_by_name(group, "/g1", "Comment for group /g1", H5P_DEFAULT);
+ H5Gclose(group);
+ group = H5Gcreate2(fid, "/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Oset_comment_by_name(group, "/g2", "Comment for group /g2", H5P_DEFAULT);
+ H5Gclose(group);
+ group = H5Gcreate2(fid, "/g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Oset_comment_by_name(group, "/g3", "Comment for group /g3", H5P_DEFAULT);
+ H5Gclose(group);
+
+ /* /g1 */
+ group = H5Gcreate2(fid, "/g1/g1.1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Oset_comment_by_name(group, "/g1/g1.1", "Comment for group /g1/g1.1", H5P_DEFAULT);
+ H5Gclose(group);
+ group = H5Gcreate2(fid, "/g1/g1.2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Oset_comment_by_name(group, "/g1/g1.2", "Comment for group /g1/g1.2", H5P_DEFAULT);
+ H5Gclose(group);
+
+ /* /g2 */
+ group = H5Gcreate2(fid, "/g2/g2.1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Oset_comment_by_name(group, "/g2/g2.1", "Comment for group /g2/g2.1", H5P_DEFAULT);
+ H5Gclose(group);
+
+ /* /g3 */
+ group = H5Gcreate2(fid, "/g3/g3.1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Oset_comment_by_name(group, "/g3/g3.1", "Comment for group /g3/g3.1", H5P_DEFAULT);
+ H5Gclose(group);
+ group = H5Gcreate2(fid, "/g3/g3.2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Oset_comment_by_name(group, "/g3/g3.2", "Comment for group /g3/g3.2", H5P_DEFAULT);
+ H5Gclose(group);
+ group = H5Gcreate2(fid, "/g3/g3.3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Oset_comment_by_name(group, "/g3/g3.3", "Comment for group /g3/g3.3", H5P_DEFAULT);
+ H5Gclose(group);
+ group = H5Gcreate2(fid, "/g3/g3.4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Oset_comment_by_name(group, "/g3/g3.4", "Comment for group /g3/g3.4", H5P_DEFAULT);
+ H5Gclose(group);
+
+ /* /g2/g2.1 */
+ group = H5Gcreate2(fid, "/g2/g2.1/g2.1.1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Oset_comment_by_name(group, "/g2/g2.1/g2.1.1", "Comment for group /g2/g2.1/g2.1.1", H5P_DEFAULT);
+ H5Gclose(group);
+ group = H5Gcreate2(fid, "/g2/g2.1/g2.1.2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Oset_comment_by_name(group, "/g2/g2.1/g2.1.2", "Comment for group /g2/g2.1/g2.1.2", H5P_DEFAULT);
+ H5Gclose(group);
+ group = H5Gcreate2(fid, "/g2/g2.1/g2.1.3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Oset_comment_by_name(group, "/g2/g2.1/g2.1.3", "Comment for group /g2/g2.1/g2.1.3", H5P_DEFAULT);
+ H5Gclose(group);
+
+ /* /glongcomment */
+ group = H5Gcreate2(fid, "/glongcomment", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Oset_comment_by_name(group, "/glongcomment", "Comment for group /glongcomment with a really, really, really long, long, long comment", H5P_DEFAULT);
+ H5Gclose(group);
+
+ H5Fclose(fid);
+}
+
+static
+void gent_split_file(void)
+{
+ hid_t fapl, fid, root, attr, space, dataset, atype;
+ char meta[] = "this is some metadata on this file";
+ hsize_t dims[2];
+ int i, j, dset[10][15];
+
+ fapl = H5Pcreate(H5P_FILE_ACCESS);
+ H5Pset_fapl_split(fapl, "-m.h5", H5P_DEFAULT, "-r.h5", H5P_DEFAULT);
+ fid = H5Fcreate(FILE34, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
+ root = H5Gopen2(fid, "/", H5P_DEFAULT);
+
+ atype = H5Tcopy(H5T_C_S1);
+ H5Tset_size(atype, HDstrlen(meta) + 1);
+ H5Tset_strpad(atype, H5T_STR_NULLTERM);
+
+ dims[0] = 1;
+ space = H5Screate_simple(1, dims, NULL);
+ attr = H5Acreate2(root, "Metadata", atype, space, H5P_DEFAULT, H5P_DEFAULT);
+ H5Awrite(attr, atype, meta);
+ H5Tclose(atype);
+ H5Sclose(space);
+ H5Aclose(attr);
+
+ /* create dataset */
+ dims[0] = 10;
+ dims[1] = 15;
+ space = H5Screate_simple(2, dims, NULL);
+ dataset = H5Dcreate2(fid, "/dset1", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ for(i = 0; i < 10; i++)
+ for(j = 0; j < 15; j++)
+ dset[i][j] = i + j;
+
+ H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset);
+ H5Sclose(space);
+ H5Dclose(dataset);
+ H5Gclose(root);
+ H5Fclose(fid);
+ H5Pclose(fapl);
+}
+
+static
+void gent_family(void)
+{
+ hid_t fapl, fid, space, dataset;
+ hsize_t dims[2];
+ int i, j, dset[10][15];
+
+#define FAMILY_SIZE 256
+
+ fapl = H5Pcreate(H5P_FILE_ACCESS);
+ H5Pset_fapl_family(fapl, (hsize_t)FAMILY_SIZE, H5P_DEFAULT);
+
+ fid = H5Fcreate(FILE35, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
+
+ /* create dataset */
+ dims[0] = 10;
+ dims[1] = 15;
+ space = H5Screate_simple(2, dims, NULL);
+ dataset = H5Dcreate2(fid, "/dset1", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ for(i = 0; i < 10; i++)
+ for(j = 0; j < 15; j++)
+ dset[i][j] = i + j;
+
+ H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset);
+ H5Sclose(space);
+ H5Dclose(dataset);
+ H5Fclose(fid);
+ H5Pclose(fapl);
+}
+
+static const char *multi_letters = "msbrglo";
+
+static
+void gent_multi(void)
+{
+ hid_t fapl, fid, space, dataset;
+ hsize_t dims[2];
+ int i, j, dset[10][15];
+
+ /* Multi-file driver, general case of the split driver */
+ H5FD_mem_t mt, memb_map[H5FD_MEM_NTYPES];
+ hid_t memb_fapl[H5FD_MEM_NTYPES];
+ const char *memb_name[H5FD_MEM_NTYPES];
+ char sv[H5FD_MEM_NTYPES][1024];
+ haddr_t memb_addr[H5FD_MEM_NTYPES];
+
+ fapl = H5Pcreate(H5P_FILE_ACCESS);
+
+ HDmemset(memb_map, 0, sizeof memb_map);
+ HDmemset(memb_fapl, 0, sizeof memb_fapl);
+ HDmemset(memb_name, 0, sizeof memb_name);
+ HDmemset(memb_addr, 0, sizeof memb_addr);
+
+ HDassert(HDstrlen(multi_letters) == H5FD_MEM_NTYPES);
+
+ for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,mt)) {
+ memb_fapl[mt] = H5P_DEFAULT;
+ memb_map[mt] = mt;
+ sprintf(sv[mt], "%%s-%c.h5", multi_letters[mt]);
+ memb_name[mt] = sv[mt];
+ /*printf("memb_name[%d]=%s, memb_map[%d]=%d; ", mt, memb_name[mt], mt, memb_map[mt]);*/
+ memb_addr[mt] = (haddr_t)MAX(mt - 1, 0) * (HADDR_MAX / 10);
+ }
+ memb_map[H5FD_MEM_DEFAULT] = H5FD_MEM_SUPER;
+
+ H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name,
+ memb_addr, FALSE);
+
+ fid = H5Fcreate(FILE36, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
+
+ /* create dataset */
+ dims[0] = 10;
+ dims[1] = 15;
+ space = H5Screate_simple(2, dims, NULL);
+ dataset = H5Dcreate2(fid, "/dset1", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ for(i = 0; i < 10; i++)
+ for(j = 0; j < 15; j++)
+ dset[i][j] = i + j;
+
+ H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset);
+
+ H5Sclose(space);
+ H5Dclose(dataset);
+ H5Fclose(fid);
+ H5Pclose(fapl);
+}
+
+static void gent_large_objname(void)
+{
+ hid_t fid, group, group2;
+ char grp_name[128];
+ register int i;
+
+ fid = H5Fcreate(FILE37, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ group = H5Gcreate2(fid, "this_is_a_large_group_name", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ for(i = 0; i < 50; ++i) {
+ sprintf(grp_name, "this_is_a_large_group_name%d", i);
+ group2 = H5Gcreate2(group, grp_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group2);
+ }
+
+ H5Gclose(group);
+ H5Fclose(fid);
+}
+
+static void gent_vlstr(void)
+{
+ const char *wdata[SPACE1_DIM1]= {
+ "Four score and seven years ago our forefathers brought forth on this continent a new nation,",
+ "conceived in liberty and dedicated to the proposition that all men are created equal.",
+ "",
+ NULL
+ }; /* Information to write */
+ const char *string_att= "This is the string for the attribute";
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset, root; /* Dataset ID */
+ hid_t sid1, dataspace;/* Dataspace ID */
+ hid_t tid1, att; /* Datatype ID */
+ hsize_t dims1[] = {SPACE1_DIM1};
+
+ /* Create file */
+ fid1 = H5Fcreate(FILE38, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL);
+
+ /* Create a VL string datatype to refer to */
+ tid1 = H5Tcopy (H5T_C_S1);
+ H5Tset_size (tid1, H5T_VARIABLE);
+
+ /* Create a dataset and write VL string to it. */
+ dataset = H5Dcreate2(fid1, "Dataset1", tid1, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
+ H5Dclose(dataset);
+
+ /* Create a named VL string type. Change padding of datatype */
+ H5Tset_strpad(tid1, H5T_STR_NULLPAD);
+ H5Tcommit2(fid1, "vl_string_type", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Create an group attribute of VL string type */
+ root = H5Gopen2(fid1, "/", H5P_DEFAULT);
+ dataspace = H5Screate(H5S_SCALAR);
+
+ att = H5Acreate2(root, "test_scalar", tid1, dataspace, H5P_DEFAULT, H5P_DEFAULT);
+ H5Awrite(att, tid1, &string_att);
+
+ /* Close */
+ H5Tclose(tid1);
+ H5Sclose(sid1);
+ H5Sclose(dataspace);
+ H5Aclose(att);
+ H5Gclose(root);
+ H5Fclose(fid1);
+}
+
+static void gent_char(void)
+{
+ const char *wdata =
+ "Four score and seven years ago our forefathers brought "
+ "forth on this continent a new nation, conceived in "
+ "liberty and dedicated to the proposition that all "
+ "men are created equal. Now we are engaged in a great "
+ "civil war, testing whether that nation or any nation "
+ "so conceived and so dedicated can long endure.";
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hsize_t dims1[1];
+
+ dims1[0] = HDstrlen(wdata);
+
+ /* Create file */
+ fid1 = H5Fcreate(FILE39, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ sid1 = H5Screate_simple(1, dims1, NULL);
+
+ /* Create a dataset */
+ dataset = H5Dcreate2(fid1, "Dataset1", H5T_NATIVE_CHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Write some characters to it. */
+ H5Dwrite(dataset, H5T_NATIVE_CHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
+
+ /* Close */
+ H5Dclose(dataset);
+ H5Sclose(sid1);
+ H5Fclose(fid1);
+}
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: write_attr_in
+ *
+ * Purpose: write attributes in LOC_ID (dataset, group, named datatype)
+ *
+ * Return: void
+ *
+ * Programmer: pvn@ncsa.uiuc.edu
+ *
+ * Date: May 28, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static void write_attr_in(hid_t loc_id,
+ const char* dset_name, /* for saving reference to dataset*/
+ hid_t fid)
+{
+ /* Compound datatype */
+ typedef struct s_t
+ {
+ char a;
+ double b;
+ } s_t;
+
+ typedef enum
+ {
+ E_RED,
+ E_GREEN
+ } e_t;
+
+ hid_t aid;
+ hid_t sid;
+ hid_t tid;
+ herr_t status;
+ int val, i, j, k, n;
+ float f;
+
+ /* create 1D attributes with dimension [2], 2 elements */
+ hsize_t dims[1]={2};
+ char buf1[2][3]= {"ab","de"}; /* string */
+ char buf2[2]= {1,2}; /* bitfield, opaque */
+ s_t buf3[2]= {{1,2},{3,4}}; /* compound */
+ hobj_ref_t buf4[2]; /* reference */
+ hvl_t buf5[2]; /* vlen */
+ hsize_t dimarray[1]={3}; /* array dimension */
+ int buf6[2][3]= {{1,2,3},{4,5,6}}; /* array */
+ int buf7[2]= {1,2}; /* integer */
+ float buf8[2]= {1,2}; /* float */
+
+ /* create 2D attributes with dimension [3][2], 6 elements */
+ hsize_t dims2[2]={3,2};
+ char buf12[6][3]= {"ab","cd","ef","gh","ij","kl"}; /* string */
+ char buf22[3][2]= {{1,2},{3,4},{5,6}}; /* bitfield, opaque */
+ s_t buf32[6]= {{1,2},{3,4},{5,6},{7,8},{9,10},{11,12}}; /* compound */
+ hobj_ref_t buf42[3][2]; /* reference */
+ hvl_t buf52[3][2]; /* vlen */
+ int buf62[6][3]= {{1,2,3},{4,5,6},{7,8,9},{10,11,12},{13,14,15},{16,17,18}}; /* array */
+ int buf72[3][2]= {{1,2},{3,4},{5,6}}; /* integer */
+ float buf82[3][2]= {{1,2},{3,4},{5,6}}; /* float */
+
+ /* create 3D attributes with dimension [4][3][2], 24 elements */
+ hsize_t dims3[3]={4,3,2};
+ char buf13[24][3]= {"ab","cd","ef","gh","ij","kl","mn","pq",
+ "rs","tu","vw","xz","AB","CD","EF","GH",
+ "IJ","KL","MN","PQ","RS","TU","VW","XZ"}; /* string */
+ char buf23[4][3][2]; /* bitfield, opaque */
+ s_t buf33[4][3][2]; /* compound */
+ hobj_ref_t buf43[4][3][2]; /* reference */
+ hvl_t buf53[4][3][2]; /* vlen */
+ int buf63[24][3]; /* array */
+ int buf73[4][3][2]; /* integer */
+ float buf83[4][3][2]; /* float */
+
+
+ /*-------------------------------------------------------------------------
+ * 1D attributes
+ *-------------------------------------------------------------------------
+ */
+
+ /*-------------------------------------------------------------------------
+ * H5T_STRING
+ *-------------------------------------------------------------------------
+ */
+ tid = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(tid, 2);
+ write_attr(loc_id,1,dims,"string",tid,buf1);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_BITFIELD
+ *-------------------------------------------------------------------------
+ */
+ tid = H5Tcopy(H5T_STD_B8LE);
+ write_attr(loc_id,1,dims,"bitfield",tid,buf2);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_OPAQUE
+ *-------------------------------------------------------------------------
+ */
+ tid = H5Tcreate(H5T_OPAQUE, 1);
+ status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */
+ write_attr(loc_id,1,dims,"opaque",tid,buf2);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_COMPOUND
+ *-------------------------------------------------------------------------
+ */
+ tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t));
+ H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR);
+ H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE);
+ write_attr(loc_id,1,dims,"compound",tid,buf3);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_REFERENCE
+ *-------------------------------------------------------------------------
+ */
+ /* Create references to dataset */
+ if(dset_name)
+ {
+ status=H5Rcreate(&buf4[0],fid,dset_name,H5R_OBJECT,(hid_t)-1);
+ status=H5Rcreate(&buf4[1],fid,dset_name,H5R_OBJECT,(hid_t)-1);
+ write_attr(loc_id,1,dims,"reference",H5T_STD_REF_OBJ,buf4);
+ }
+
+ /*-------------------------------------------------------------------------
+ * H5T_ENUM
+ *-------------------------------------------------------------------------
+ */
+ tid = H5Tcreate(H5T_ENUM, sizeof(e_t));
+ H5Tenum_insert(tid, "RED", (val = 0, &val));
+ H5Tenum_insert(tid, "GREEN", (val = 1, &val));
+ write_attr(loc_id,1,dims,"enum",tid,0);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_VLEN
+ *-------------------------------------------------------------------------
+ */
+
+ /* Allocate and initialize VL dataset to write */
+
+ buf5[0].len = 1;
+ buf5[0].p = HDmalloc(1 * sizeof(int));
+ ((int *)buf5[0].p)[0] = 1;
+ buf5[1].len = 2;
+ buf5[1].p = HDmalloc(2 * sizeof(int));
+ ((int *)buf5[1].p)[0] = 2;
+ ((int *)buf5[1].p)[1] = 3;
+
+ sid = H5Screate_simple(1, dims, NULL);
+ tid = H5Tvlen_create(H5T_NATIVE_INT);
+ aid = H5Acreate2(loc_id, "vlen", tid, sid, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Awrite(aid, tid, buf5);
+ HDassert(status >= 0);
+ status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf5);
+ HDassert(status >= 0);
+ status = H5Aclose(aid);
+ status = H5Tclose(tid);
+ status = H5Sclose(sid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_ARRAY
+ *-------------------------------------------------------------------------
+ */
+ tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray);
+ write_attr(loc_id, 1, dims, "array", tid, buf6);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_INTEGER and H5T_FLOAT
+ *-------------------------------------------------------------------------
+ */
+ write_attr(loc_id, 1, dims, "integer", H5T_NATIVE_INT, buf7);
+ write_attr(loc_id, 1, dims, "float", H5T_NATIVE_FLOAT, buf8);
+
+
+ /*-------------------------------------------------------------------------
+ * 2D attributes
+ *-------------------------------------------------------------------------
+ */
+
+ /*-------------------------------------------------------------------------
+ * H5T_STRING
+ *-------------------------------------------------------------------------
+ */
+ tid = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(tid, 2);
+ write_attr(loc_id,2,dims2,"string2D",tid,buf12);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_BITFIELD
+ *-------------------------------------------------------------------------
+ */
+ tid = H5Tcopy(H5T_STD_B8LE);
+ write_attr(loc_id,2,dims2,"bitfield2D",tid,buf22);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_OPAQUE
+ *-------------------------------------------------------------------------
+ */
+ tid = H5Tcreate(H5T_OPAQUE, 1);
+ status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */
+ write_attr(loc_id,2,dims2,"opaque2D",tid,buf22);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_COMPOUND
+ *-------------------------------------------------------------------------
+ */
+ tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t));
+ H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR);
+ H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE);
+ write_attr(loc_id,2,dims2,"compound2D",tid,buf32);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_REFERENCE
+ *-------------------------------------------------------------------------
+ */
+ /* Create references to dataset */
+ if(dset_name)
+ {
+ for(i = 0; i < 3; i++) {
+ for(j = 0; j < 2; j++) {
+ status=H5Rcreate(&buf42[i][j],fid,dset_name,H5R_OBJECT,(hid_t)-1);
+ }
+ }
+ write_attr(loc_id,2,dims2,"reference2D",H5T_STD_REF_OBJ,buf42);
+ }
+
+ /*-------------------------------------------------------------------------
+ * H5T_ENUM
+ *-------------------------------------------------------------------------
+ */
+ tid = H5Tcreate(H5T_ENUM, sizeof(e_t));
+ H5Tenum_insert(tid, "RED", (val = 0, &val));
+ H5Tenum_insert(tid, "GREEN", (val = 1, &val));
+ write_attr(loc_id,2,dims2,"enum2D",tid,0);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_VLEN
+ *-------------------------------------------------------------------------
+ */
+
+ /* Allocate and initialize VL dataset to write */
+ n=0;
+ for(i = 0; i < 3; i++) {
+ for(j = 0; j < 2; j++) {
+ int l;
+
+ buf52[i][j].p = HDmalloc((size_t)(i + 1) * sizeof(int));
+ buf52[i][j].len = (size_t)(i + 1);
+ for(l = 0; l < i + 1; l++)
+ ((int *)buf52[i][j].p)[l] = n++;
+ }
+ }
+
+ sid = H5Screate_simple(2, dims2, NULL);
+ tid = H5Tvlen_create(H5T_NATIVE_INT);
+ aid = H5Acreate2(loc_id, "vlen2D", tid, sid, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Awrite(aid, tid, buf52);
+ HDassert(status >= 0);
+ status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf52);
+ HDassert(status >= 0);
+ status = H5Aclose(aid);
+ status = H5Tclose(tid);
+ status = H5Sclose(sid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_ARRAY
+ *-------------------------------------------------------------------------
+ */
+ tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray);
+ write_attr(loc_id, 2, dims2, "array2D", tid, buf62);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_INTEGER and H5T_FLOAT
+ *-------------------------------------------------------------------------
+ */
+ write_attr(loc_id, 2, dims2, "integer2D", H5T_NATIVE_INT, buf72);
+ write_attr(loc_id, 2, dims2, "float2D", H5T_NATIVE_FLOAT, buf82);
+
+
+ /*-------------------------------------------------------------------------
+ * 3D attributes
+ *-------------------------------------------------------------------------
+ */
+
+ /*-------------------------------------------------------------------------
+ * H5T_STRING
+ *-------------------------------------------------------------------------
+ */
+ tid = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(tid, 2);
+ write_attr(loc_id,3,dims3,"string3D",tid,buf13);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_BITFIELD
+ *-------------------------------------------------------------------------
+ */
+
+ n=1;
+ for(i = 0; i < 4; i++) {
+ for(j = 0; j < 3; j++) {
+ for(k = 0; k < 2; k++) {
+ buf23[i][j][k] = (char)n++;
+ }
+ }
+ }
+ tid = H5Tcopy(H5T_STD_B8LE);
+ write_attr(loc_id,3,dims3,"bitfield3D",tid,buf23);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_OPAQUE
+ *-------------------------------------------------------------------------
+ */
+ tid = H5Tcreate(H5T_OPAQUE, 1);
+ status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */
+ write_attr(loc_id,3,dims3,"opaque3D",tid,buf23);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_COMPOUND
+ *-------------------------------------------------------------------------
+ */
+
+ n=1;
+ for(i = 0; i < 4; i++) {
+ for(j = 0; j < 3; j++) {
+ for(k = 0; k < 2; k++) {
+ buf33[i][j][k].a = (char)n++;
+ buf33[i][j][k].b=n++;
+ }
+ }
+ }
+ tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t));
+ H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR);
+ H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE);
+ write_attr(loc_id,3,dims3,"compound3D",tid,buf33);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_REFERENCE
+ *-------------------------------------------------------------------------
+ */
+ /* Create references to dataset */
+ if(dset_name)
+ {
+ for(i = 0; i < 4; i++) {
+ for(j = 0; j < 3; j++) {
+ for(k = 0; k < 2; k++)
+ status=H5Rcreate(&buf43[i][j][k],fid,dset_name,H5R_OBJECT,(hid_t)-1);
+ }
+ }
+ write_attr(loc_id,3,dims3,"reference3D",H5T_STD_REF_OBJ,buf43);
+ }
+
+ /*-------------------------------------------------------------------------
+ * H5T_ENUM
+ *-------------------------------------------------------------------------
+ */
+ tid = H5Tcreate(H5T_ENUM, sizeof(e_t));
+ H5Tenum_insert(tid, "RED", (val = 0, &val));
+ H5Tenum_insert(tid, "GREEN", (val = 1, &val));
+ write_attr(loc_id,3,dims3,"enum3D",tid,0);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_VLEN
+ *-------------------------------------------------------------------------
+ */
+
+ /* Allocate and initialize VL dataset to write */
+ n = 0;
+ for(i = 0; i < 4; i++) {
+ for(j = 0; j < 3; j++) {
+ for(k = 0; k < 2; k++) {
+ int l;
+
+ buf53[i][j][k].p = HDmalloc((size_t)(i + 1) * sizeof(int));
+ buf53[i][j][k].len = (size_t)(i + 1);
+ for(l = 0; l < i + 1; l++)
+ ((int *)buf53[i][j][k].p)[l] = n++;
+ }
+ }
+ }
+
+ sid = H5Screate_simple(3, dims3, NULL);
+ tid = H5Tvlen_create(H5T_NATIVE_INT);
+ aid = H5Acreate2(loc_id, "vlen3D", tid, sid, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Awrite(aid, tid, buf53);
+ HDassert(status >= 0);
+ status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf53);
+ HDassert(status >= 0);
+ status = H5Aclose(aid);
+ status = H5Tclose(tid);
+ status = H5Sclose(sid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_ARRAY
+ *-------------------------------------------------------------------------
+ */
+ n = 1;
+ for(i = 0; i < 24; i++)
+ for(j = 0; j < (int)dimarray[0]; j++)
+ buf63[i][j] = n++;
+
+ tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray);
+ write_attr(loc_id, 3, dims3, "array3D", tid, buf63);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_INTEGER and H5T_FLOAT
+ *-------------------------------------------------------------------------
+ */
+ n=1; f=1;
+ for(i = 0; i < 4; i++) {
+ for(j = 0; j < 3; j++) {
+ for(k = 0; k < 2; k++) {
+ buf73[i][j][k]=n++;
+ buf83[i][j][k]=f++;
+ }
+ }
+ }
+ write_attr(loc_id,3,dims3,"integer3D",H5T_NATIVE_INT,buf73);
+ write_attr(loc_id,3,dims3,"float3D",H5T_NATIVE_FLOAT,buf83);
+}
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: write_dset_in
+ *
+ * Purpose: write datasets in LOC_ID
+ *
+ * Return: void
+ *
+ * Programmer: pvn@ncsa.uiuc.edu
+ *
+ * Date: May 28, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static void write_dset_in(hid_t loc_id,
+ const char* dset_name, /* for saving reference to dataset*/
+ hid_t fid)
+{
+ /* Compound datatype */
+ typedef struct s_t
+ {
+ char a;
+ double b;
+ } s_t;
+
+ typedef enum
+ {
+ E_RED,
+ E_GREEN
+ } e_t;
+
+ hid_t did;
+ hid_t sid;
+ hid_t tid;
+ hid_t plist_id;
+ herr_t status;
+ int val, i, j, k, n;
+ float f;
+ int fillvalue=2;
+
+ /* create 1D attributes with dimension [2], 2 elements */
+ hsize_t dims[1]={2};
+ char buf1[2][3]= {"ab","de"}; /* string */
+ char buf2[2]= {1,2}; /* bitfield, opaque */
+ s_t buf3[2]= {{1,2},{3,4}}; /* compound */
+ hobj_ref_t buf4[2]; /* reference */
+ hvl_t buf5[2]; /* vlen */
+ hsize_t dimarray[1]={3}; /* array dimension */
+ int buf6[2][3]= {{1,2,3},{4,5,6}}; /* array */
+ int buf7[2]= {1,2}; /* integer */
+ float buf8[2]= {1,2}; /* float */
+
+ /* create 2D attributes with dimension [3][2], 6 elements */
+ hsize_t dims2[2]={3,2};
+ char buf12[6][3]= {"ab","cd","ef","gh","ij","kl"}; /* string */
+ char buf22[3][2]= {{1,2},{3,4},{5,6}}; /* bitfield, opaque */
+ s_t buf32[6]= {{1,2},{3,4},{5,6},{7,8},{9,10},{11,12}}; /* compound */
+ hobj_ref_t buf42[3][2]; /* reference */
+ hvl_t buf52[3][2]; /* vlen */
+ int buf62[6][3]= {{1,2,3},{4,5,6},{7,8,9},{10,11,12},{13,14,15},{16,17,18}}; /* array */
+ int buf72[3][2]= {{1,2},{3,4},{5,6}}; /* integer */
+ float buf82[3][2]= {{1,2},{3,4},{5,6}}; /* float */
+
+ /* create 3D attributes with dimension [4][3][2], 24 elements */
+ hsize_t dims3[3]={4,3,2};
+ char buf13[24][3]= {"ab","cd","ef","gh","ij","kl","mn","pq",
+ "rs","tu","vw","xz","AB","CD","EF","GH",
+ "IJ","KL","MN","PQ","RS","TU","VW","XZ"}; /* string */
+ char buf23[4][3][2]; /* bitfield, opaque */
+ s_t buf33[4][3][2]; /* compound */
+ hobj_ref_t buf43[4][3][2]; /* reference */
+ hvl_t buf53[4][3][2]; /* vlen */
+ int buf63[24][3]; /* array */
+ int buf73[4][3][2]; /* integer */
+ float buf83[4][3][2]; /* float */
+
+
+ /*-------------------------------------------------------------------------
+ * 1D
+ *-------------------------------------------------------------------------
+ */
+
+ /*-------------------------------------------------------------------------
+ * H5T_STRING
+ *-------------------------------------------------------------------------
+ */
+ tid = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(tid, 2);
+ write_dset(loc_id,1,dims,"string",tid,buf1);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_BITFIELD
+ *-------------------------------------------------------------------------
+ */
+ tid = H5Tcopy(H5T_STD_B8LE);
+ write_dset(loc_id,1,dims,"bitfield",tid,buf2);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_OPAQUE
+ *-------------------------------------------------------------------------
+ */
+ tid = H5Tcreate(H5T_OPAQUE, 1);
+ status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */
+ write_dset(loc_id,1,dims,"opaque",tid,buf2);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_COMPOUND
+ *-------------------------------------------------------------------------
+ */
+ tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t));
+ H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR);
+ H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE);
+ write_dset(loc_id,1,dims,"compound",tid,buf3);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_REFERENCE
+ *-------------------------------------------------------------------------
+ */
+ /* Create references to dataset */
+ if(dset_name)
+ {
+ status=H5Rcreate(&buf4[0],fid,dset_name,H5R_OBJECT,(hid_t)-1);
+ status=H5Rcreate(&buf4[1],fid,dset_name,H5R_OBJECT,(hid_t)-1);
+ write_dset(loc_id,1,dims,"reference",H5T_STD_REF_OBJ,buf4);
+ }
+
+ /*-------------------------------------------------------------------------
+ * H5T_ENUM
+ *-------------------------------------------------------------------------
+ */
+ tid = H5Tcreate(H5T_ENUM, sizeof(e_t));
+ H5Tenum_insert(tid, "RED", (val = 0, &val));
+ H5Tenum_insert(tid, "GREEN", (val = 1, &val));
+ write_dset(loc_id,1,dims,"enum",tid,0);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_VLEN
+ *-------------------------------------------------------------------------
+ */
+
+ /* Allocate and initialize VL dataset to write */
+
+ buf5[0].len = 1;
+ buf5[0].p = HDmalloc( 1 * sizeof(int));
+ ((int *)buf5[0].p)[0]=1;
+ buf5[1].len = 2;
+ buf5[1].p = HDmalloc( 2 * sizeof(int));
+ ((int *)buf5[1].p)[0]=2;
+ ((int *)buf5[1].p)[1]=3;
+
+ sid = H5Screate_simple(1, dims, NULL);
+ tid = H5Tvlen_create(H5T_NATIVE_INT);
+ did = H5Dcreate2(loc_id, "vlen", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf5);
+ HDassert(status >= 0);
+ status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf5);
+ HDassert(status >= 0);
+ status = H5Dclose(did);
+ status = H5Tclose(tid);
+ status = H5Sclose(sid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_ARRAY
+ *-------------------------------------------------------------------------
+ */
+ tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray);
+ write_dset(loc_id, 1, dims, "array", tid, buf6);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_INTEGER and H5T_FLOAT
+ *-------------------------------------------------------------------------
+ */
+ write_dset(loc_id,1,dims,"integer",H5T_NATIVE_INT,buf7);
+ write_dset(loc_id,1,dims,"float",H5T_NATIVE_FLOAT,buf8);
+
+
+ /*-------------------------------------------------------------------------
+ * 2D
+ *-------------------------------------------------------------------------
+ */
+
+ /*-------------------------------------------------------------------------
+ * H5T_STRING
+ *-------------------------------------------------------------------------
+ */
+ tid = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(tid, 2);
+ write_dset(loc_id,2,dims2,"string2D",tid,buf12);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_BITFIELD
+ *-------------------------------------------------------------------------
+ */
+ tid = H5Tcopy(H5T_STD_B8LE);
+ write_dset(loc_id,2,dims2,"bitfield2D",tid,buf22);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_OPAQUE
+ *-------------------------------------------------------------------------
+ */
+ tid = H5Tcreate(H5T_OPAQUE, 1);
+ status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */
+ write_dset(loc_id,2,dims2,"opaque2D",tid,buf22);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_COMPOUND
+ *-------------------------------------------------------------------------
+ */
+ tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t));
+ H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR);
+ H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE);
+ write_dset(loc_id,2,dims2,"compound2D",tid,buf32);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_REFERENCE
+ *-------------------------------------------------------------------------
+ */
+ /* Create references to dataset */
+ if(dset_name)
+ {
+ for(i = 0; i < 3; i++) {
+ for(j = 0; j < 2; j++) {
+ status=H5Rcreate(&buf42[i][j],fid,dset_name,H5R_OBJECT,(hid_t)-1);
+ }
+ }
+ write_dset(loc_id,2,dims2,"reference2D",H5T_STD_REF_OBJ,buf42);
+ }
+
+ /*-------------------------------------------------------------------------
+ * H5T_ENUM
+ *-------------------------------------------------------------------------
+ */
+ tid = H5Tcreate(H5T_ENUM, sizeof(e_t));
+ H5Tenum_insert(tid, "RED", (val = 0, &val));
+ H5Tenum_insert(tid, "GREEN", (val = 1, &val));
+ write_dset(loc_id,2,dims2,"enum2D",tid,0);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_VLEN
+ *-------------------------------------------------------------------------
+ */
+
+ /* Allocate and initialize VL dataset to write */
+ n=0;
+ for(i = 0; i < 3; i++)
+ for(j = 0; j < 2; j++) {
+ int l;
+
+ buf52[i][j].p = HDmalloc((size_t)(i + 1) * sizeof(int));
+ buf52[i][j].len = (size_t)(i + 1);
+ for(l = 0; l < i + 1; l++)
+ ((int *)buf52[i][j].p)[l] = n++;
+ }
+
+ sid = H5Screate_simple(2, dims2, NULL);
+ tid = H5Tvlen_create(H5T_NATIVE_INT);
+ did = H5Dcreate2(loc_id, "vlen2D", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf52);
+ HDassert(status >= 0);
+ status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf52);
+ HDassert(status >= 0);
+ status = H5Dclose(did);
+ status = H5Tclose(tid);
+ status = H5Sclose(sid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_ARRAY
+ *-------------------------------------------------------------------------
+ */
+ tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray);
+ write_dset(loc_id, 2, dims2, "array2D", tid, buf62);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_INTEGER, write a fill value
+ *-------------------------------------------------------------------------
+ */
+ plist_id = H5Pcreate(H5P_DATASET_CREATE);
+ status = H5Pset_fill_value(plist_id, H5T_NATIVE_INT, &fillvalue);
+ sid = H5Screate_simple(2, dims2, NULL);
+ did = H5Dcreate2(loc_id, "integer2D", H5T_NATIVE_INT, sid, H5P_DEFAULT, plist_id, H5P_DEFAULT);
+ status = H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf72);
+ status = H5Pclose(plist_id);
+ status = H5Dclose(did);
+ status = H5Sclose(sid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_FLOAT
+ *-------------------------------------------------------------------------
+ */
+
+ write_dset(loc_id, 2, dims2, "float2D", H5T_NATIVE_FLOAT, buf82);
+
+
+ /*-------------------------------------------------------------------------
+ * 3D
+ *-------------------------------------------------------------------------
+ */
+
+ /*-------------------------------------------------------------------------
+ * H5T_STRING
+ *-------------------------------------------------------------------------
+ */
+ tid = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(tid, 2);
+ write_dset(loc_id,3,dims3,"string3D",tid,buf13);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_BITFIELD
+ *-------------------------------------------------------------------------
+ */
+
+ n=1;
+ for(i = 0; i < 4; i++)
+ for(j = 0; j < 3; j++)
+ for(k = 0; k < 2; k++)
+ buf23[i][j][k] = (char)n++;
+ tid = H5Tcopy(H5T_STD_B8LE);
+ write_dset(loc_id,3,dims3,"bitfield3D",tid,buf23);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_OPAQUE
+ *-------------------------------------------------------------------------
+ */
+ tid = H5Tcreate(H5T_OPAQUE, 1);
+ status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */
+ write_dset(loc_id,3,dims3,"opaque3D",tid,buf23);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_COMPOUND
+ *-------------------------------------------------------------------------
+ */
+
+ n=1;
+ for(i = 0; i < 4; i++)
+ for(j = 0; j < 3; j++)
+ for(k = 0; k < 2; k++) {
+ buf33[i][j][k].a = (char)n++;
+ buf33[i][j][k].b = n++;
+ }
+ tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t));
+ H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR);
+ H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE);
+ write_dset(loc_id,3,dims3,"compound3D",tid,buf33);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_REFERENCE
+ *-------------------------------------------------------------------------
+ */
+ /* Create references to dataset */
+ if(dset_name)
+ {
+ for(i = 0; i < 4; i++) {
+ for(j = 0; j < 3; j++) {
+ for(k = 0; k < 2; k++)
+ status=H5Rcreate(&buf43[i][j][k],fid,dset_name,H5R_OBJECT,(hid_t)-1);
+ }
+ }
+ write_dset(loc_id,3,dims3,"reference3D",H5T_STD_REF_OBJ,buf43);
+ }
+
+ /*-------------------------------------------------------------------------
+ * H5T_ENUM
+ *-------------------------------------------------------------------------
+ */
+ tid = H5Tcreate(H5T_ENUM, sizeof(e_t));
+ H5Tenum_insert(tid, "RED", (val = 0, &val));
+ H5Tenum_insert(tid, "GREEN", (val = 1, &val));
+ write_dset(loc_id,3,dims3,"enum3D",tid,0);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_VLEN
+ *-------------------------------------------------------------------------
+ */
+
+ /* Allocate and initialize VL dataset to write */
+ n = 0;
+ for(i = 0; i < 4; i++)
+ for(j = 0; j < 3; j++)
+ for(k = 0; k < 2; k++) {
+ int l;
+
+ buf53[i][j][k].p = HDmalloc(((size_t)i + 1) * sizeof(int));
+ buf53[i][j][k].len = (size_t)(i + 1);
+ for(l = 0; l < i + 1; l++)
+ ((int *)buf53[i][j][k].p)[l] = n++;
+ }
+
+ sid = H5Screate_simple(3, dims3, NULL);
+ tid = H5Tvlen_create(H5T_NATIVE_INT);
+ did = H5Dcreate2(loc_id, "vlen3D", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf53);
+ HDassert(status >= 0);
+ status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf53);
+ HDassert(status >= 0);
+ status = H5Dclose(did);
+ status = H5Tclose(tid);
+ status = H5Sclose(sid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_ARRAY
+ *-------------------------------------------------------------------------
+ */
+ n=1;
+ for(i = 0; i < 24; i++) {
+ for(j = 0; j < (int)dimarray[0]; j++) {
+ buf63[i][j]=n++;
+ }
+ }
+
+ tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray);
+ write_dset(loc_id, 3, dims3, "array3D", tid, buf63);
+ status = H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * H5T_INTEGER and H5T_FLOAT
+ *-------------------------------------------------------------------------
+ */
+ n=1; f=1;
+ for(i = 0; i < 4; i++) {
+ for(j = 0; j < 3; j++) {
+ for(k = 0; k < 2; k++) {
+ buf73[i][j][k]=n++;
+ buf83[i][j][k]=f++;
+ }
+ }
+ }
+ write_dset(loc_id,3,dims3,"integer3D",H5T_NATIVE_INT,buf73);
+ write_dset(loc_id,3,dims3,"float3D",H5T_NATIVE_FLOAT,buf83);
+}
+
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: gent_attr_all
+ *
+ * Purpose: generate all datatype attributes
+ *
+ * Return: void
+ *
+ * Programmer: pvn@ncsa.uiuc.edu
+ *
+ * Date: May 19, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static void gent_attr_all(void)
+{
+ hid_t fid;
+ hid_t did;
+ hid_t group_id;
+ hid_t group2_id;
+ hid_t root_id;
+ hid_t sid;
+ hsize_t dims[1] = {2};
+ herr_t status;
+
+ /* Create a file and a dataset */
+ fid = H5Fcreate(FILE40, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Create a 1D dataset */
+ sid = H5Screate_simple(1,dims,NULL);
+ did = H5Dcreate2(fid, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Sclose(sid);
+ HDassert(status >= 0);
+
+ /* Create groups */
+ group_id = H5Gcreate2(fid, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ group2_id = H5Gcreate2(fid, "g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ root_id = H5Gopen2(fid, "/", H5P_DEFAULT);
+
+ /*-------------------------------------------------------------------------
+ * write a series of attributes on the dataset, group
+ *-------------------------------------------------------------------------
+ */
+
+ write_attr_in(did,"dset",fid);
+ write_attr_in(group_id,NULL,(hid_t)0);
+ write_attr_in(root_id,NULL,(hid_t)0);
+
+ /*-------------------------------------------------------------------------
+ * write a series of datasets on group 2
+ *-------------------------------------------------------------------------
+ */
+
+ write_dset_in(group2_id,"/dset",fid);
+
+ /* Close */
+ status = H5Dclose(did);
+ HDassert(status >= 0);
+ status = H5Gclose(group_id);
+ HDassert(status >= 0);
+ status = H5Gclose(group2_id);
+ HDassert(status >= 0);
+ status = H5Gclose(root_id);
+ HDassert(status >= 0);
+
+ /* Close file */
+ status = H5Fclose(fid);
+ HDassert(status >= 0);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: write_attr
+ *
+ * Purpose: utility function to write an attribute
+ *
+ * Programmer: pvn@ncsa.uiuc.edu
+ *
+ * Date: May 19, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static
+int write_attr(hid_t loc_id, int rank, hsize_t *dims, const char *attr_name,
+ hid_t tid, void *buf)
+{
+ hid_t aid;
+ hid_t sid;
+ herr_t status;
+
+ /* Create a buf space */
+ sid = H5Screate_simple(rank, dims, NULL);
+
+ /* Create the attribute */
+ aid = H5Acreate2(loc_id, attr_name, tid, sid, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Write the buf */
+ if(buf)
+ status = H5Awrite(aid, tid, buf);
+
+ /* Close */
+ status = H5Aclose(aid);
+ status = H5Sclose(sid);
+
+ return status;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: write_dset
+ *
+ * Purpose: utility function to create and write a dataset in LOC_ID
+ *
+ * Return:
+ *
+ * Programmer: pvn@ncsa.uiuc.edu
+ *
+ * Date: May 27, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static
+int write_dset( hid_t loc_id, int rank, hsize_t *dims, const char *dset_name,
+ hid_t tid, void *buf )
+{
+ hid_t did;
+ hid_t sid;
+ herr_t status;
+
+ /* Create a buf space */
+ sid = H5Screate_simple(rank, dims, NULL);
+
+ /* Create a dataset */
+ did = H5Dcreate2(loc_id, dset_name, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Write the buf */
+ if(buf)
+ status = H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
+
+ /* Close */
+ status = H5Dclose(did);
+ status = H5Sclose(sid);
+
+ return status;
+}
+
+
+static void gent_compound_complex(void)
+{
+ /* Structure and array for compound types */
+ typedef struct Array1Struct {
+ int a;
+ const char *b[F41_DIMb];
+ char c[F41_ARRAY_DIMc];
+ short d[F41_ARRAY_DIMd1][F41_ARRAY_DIMd2];
+ float e;
+ double f[F41_ARRAY_DIMf];
+ char g;
+ } Array1Struct;
+ Array1Struct Array1[F41_LENGTH];
+
+ /* Define the value of the string array */
+ const char *quote [F41_DIMb] = {
+ "A fight is a contract that takes two people to honor.",
+ "A combative stance means that you've accepted the contract.",
+ "In which case, you deserve what you get.",
+ " -- Professor Cheng Man-ch'ing"
+ };
+
+ /* Define the value of the character array */
+ char chararray [F41_ARRAY_DIMc] = {'H', 'e', 'l', 'l', 'o', '!'};
+
+
+ hid_t Array1Structid; /* File datatype identifier */
+ hid_t array_tid; /* Array datatype handle */
+ hid_t array1_tid; /* Array datatype handle */
+ hid_t array2_tid; /* Array datatype handle */
+ hid_t array4_tid; /* Array datatype handle */
+ hid_t datafile, dataset; /* Datafile/dataset handles */
+ hid_t dataspace; /* Dataspace handle */
+ herr_t status; /* Error checking variable */
+ hsize_t dim[] = {F41_LENGTH}; /* Dataspace dimensions */
+ hsize_t array_dimb[] = {F41_DIMb}; /* Array dimensions */
+ hsize_t array_dimd[]={F41_ARRAY_DIMd1,F41_ARRAY_DIMd2}; /* Array dimensions */
+ hsize_t array_dimf[]={F41_ARRAY_DIMf}; /* Array dimensions */
+ hid_t str_array_id;
+
+ int m, n, o; /* Array init loop vars */
+
+ /* Initialize the data in the arrays/datastructure */
+ for(m = 0; m< F41_LENGTH; m++) {
+ Array1[m].a = m;
+
+ for(n = 0; n < F41_DIMb; n++)
+ Array1[m].b[n] = quote[n];
+
+ for(n = 0; n < F41_ARRAY_DIMc; n++)
+ Array1[m].c[n] = chararray[n];
+
+ for(n = 0; n < F41_ARRAY_DIMd1; n++)
+ for(o = 0; o < F41_ARRAY_DIMd2; o++)
+ Array1[m].d[n][o] = (short)(m + n + o);
+
+ Array1[m].e = (float)((float)m * 0.96F );
+
+ for(n = 0; n < F41_ARRAY_DIMf; n++)
+ Array1[m].f[n] = ((float)m * 1024.9637F );
+
+ Array1[m].g = 'm';
+ }
+
+ /* Create the dataspace */
+ dataspace = H5Screate_simple(F41_RANK, dim, NULL);
+ HDassert(dataspace >= 0);
+
+ /* Create the file */
+ datafile = H5Fcreate(FILE41, H5F_ACC_TRUNC, H5P_DEFAULT,
+ H5P_DEFAULT);
+ HDassert(datafile >= 0);
+
+ /* Copy the array data type for the string array */
+ array_tid = H5Tcopy (H5T_C_S1);
+ HDassert(array_tid >= 0);
+
+ /* Set the string array size to Variable */
+ status = H5Tset_size (array_tid,H5T_VARIABLE);
+ HDassert(status >= 0);
+
+ /* Create the array data type for the string array */
+ str_array_id = H5Tarray_create2(array_tid, F41_ARRAY_RANK, array_dimb);
+ HDassert(str_array_id >= 0);
+
+ /* Copy the array data type for the character array */
+ array1_tid = H5Tcopy (H5T_C_S1);
+ HDassert(array1_tid >= 0);
+
+ /* Set the character array size */
+ status = H5Tset_size (array1_tid, F41_ARRAY_DIMc);
+ HDassert(status >= 0);
+
+ /* Create the array data type for the character array */
+ array2_tid = H5Tarray_create2(H5T_NATIVE_SHORT, F41_ARRAY_RANKd, array_dimd);
+ HDassert(array2_tid >= 0);
+
+ /* Create the array data type for the character array */
+ array4_tid = H5Tarray_create2(H5T_NATIVE_DOUBLE, F41_ARRAY_RANK, array_dimf);
+ HDassert(array4_tid >= 0);
+
+ /* Create the memory data type */
+ Array1Structid = H5Tcreate (H5T_COMPOUND, sizeof(Array1Struct));
+ HDassert(Array1Structid >= 0);
+
+ /* Insert the arrays and variables into the structure */
+ status = H5Tinsert(Array1Structid, "a_name",
+ HOFFSET(Array1Struct, a), H5T_NATIVE_INT);
+ HDassert(status >= 0);
+
+ status = H5Tinsert(Array1Structid, "b_name",
+ HOFFSET(Array1Struct, b), str_array_id);
+ HDassert(status >= 0);
+
+ status = H5Tinsert(Array1Structid, "c_name",
+ HOFFSET(Array1Struct, c), array1_tid);
+ HDassert(status >= 0);
+
+ status = H5Tinsert(Array1Structid, "d_name",
+ HOFFSET(Array1Struct, d), array2_tid);
+ HDassert(status >= 0);
+
+ status = H5Tinsert(Array1Structid, "e_name",
+ HOFFSET(Array1Struct, e), H5T_NATIVE_FLOAT);
+ HDassert(status >= 0);
+
+ status = H5Tinsert(Array1Structid, "f_name",
+ HOFFSET(Array1Struct, f), array4_tid);
+ HDassert(status >= 0);
+
+ status = H5Tinsert(Array1Structid, "g_name",
+ HOFFSET(Array1Struct, g), H5T_NATIVE_CHAR);
+ HDassert(status >= 0);
+
+ /* Create the dataset */
+ dataset = H5Dcreate2(datafile, F41_DATASETNAME, Array1Structid,
+ dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Write data to the dataset */
+ status = H5Dwrite(dataset, Array1Structid, H5S_ALL, H5S_ALL,
+ H5P_DEFAULT, Array1);
+ HDassert(status >= 0);
+
+ /* Release resources */
+ status = H5Tclose(Array1Structid);
+ HDassert(status >= 0);
+
+ status = H5Tclose(array_tid);
+ HDassert(status >= 0);
+
+ status = H5Tclose(array1_tid);
+ HDassert(status >= 0);
+
+ status = H5Tclose(array2_tid);
+ HDassert(status >= 0);
+
+ status = H5Tclose(array4_tid);
+ HDassert(status >= 0);
+
+ status = H5Tclose(str_array_id);
+ HDassert(status >= 0);
+
+ status = H5Sclose(dataspace);
+ HDassert(status >= 0);
+
+ status = H5Dclose(dataset);
+ HDassert(status >= 0);
+
+ status = H5Fclose(datafile);
+ HDassert(status >= 0);
+}
+
+
+static void gent_named_dtype_attr(void)
+{
+ hid_t fid;
+ hid_t did;
+ hid_t sid;
+ hid_t tid;
+ hid_t aid;
+ hid_t gid;
+ int data=8;
+ herr_t ret;
+
+ /* Create a file */
+ fid=H5Fcreate(FILE42, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ HDassert(fid>0);
+
+ /*-------------------------------------------------------------------------
+ * datatype
+ *-------------------------------------------------------------------------
+ */
+
+ /* Create a datatype to commit and use */
+ tid=H5Tcopy(H5T_NATIVE_INT);
+ HDassert(tid>0);
+
+ /* Commit datatype to file */
+ ret = H5Tcommit2(fid, F42_TYPENAME, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ HDassert(ret >= 0);
+
+ /* Create a hard link to the datatype */
+ ret = H5Lcreate_hard(fid, F42_TYPENAME, fid, F42_LINKNAME, H5P_DEFAULT, H5P_DEFAULT);
+ HDassert(ret >= 0);
+
+ /* Create a scalar dataspace used for all objects */
+ sid = H5Screate(H5S_SCALAR);
+ HDassert(sid > 0);
+
+ /* Create attribute on commited datatype */
+ aid = H5Acreate2(tid, F42_ATTRNAME, H5T_STD_I32LE, sid, H5P_DEFAULT, H5P_DEFAULT);
+ HDassert(aid > 0);
+
+ /* Write data into the attribute */
+ ret = H5Awrite(aid, H5T_NATIVE_INT, &data);
+ HDassert(ret >= 0);
+
+ /*-------------------------------------------------------------------------
+ * dataset
+ *-------------------------------------------------------------------------
+ */
+
+ /* Create dataset */
+ did = H5Dcreate2(fid, F42_DSETNAME, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ HDassert(did > 0);
+
+ /* Create attribute on dataset */
+ aid = H5Acreate2(did, F42_ATTRNAME, tid, sid, H5P_DEFAULT, H5P_DEFAULT);
+ HDassert(aid > 0);
+
+ /* Write data into the attribute */
+ ret = H5Awrite(aid, H5T_NATIVE_INT, &data);
+ HDassert(ret >= 0);
+
+ /*-------------------------------------------------------------------------
+ * group
+ *-------------------------------------------------------------------------
+ */
+
+ /* Create a group */
+ gid = H5Gcreate2(fid, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ HDassert(gid > 0);
+
+ /* Create attribute on group */
+ aid = H5Acreate2(gid, F42_ATTRNAME, tid, sid, H5P_DEFAULT, H5P_DEFAULT);
+ HDassert(aid > 0);
+
+ /* Write data into the attribute */
+ ret = H5Awrite(aid, H5T_NATIVE_INT, &data);
+ HDassert(ret >= 0);
+
+ /*-------------------------------------------------------------------------
+ * close
+ *-------------------------------------------------------------------------
+ */
+
+ /* Close attribute */
+ ret = H5Aclose(aid);
+ HDassert(ret >= 0);
+
+ /* Close dataset */
+ ret = H5Dclose(did);
+ HDassert(ret >= 0);
+
+ /* Close dataspace */
+ ret = H5Sclose(sid);
+ HDassert(ret >= 0);
+
+ /* Close datatype */
+ ret = H5Tclose(tid);
+ HDassert(ret >= 0);
+
+ /* Close file */
+ ret = H5Fclose(fid);
+ HDassert(ret >= 0);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: gent_null_space
+ *
+ * Purpose: generates dataset and attribute of null dataspace
+ *-------------------------------------------------------------------------
+ */
+static void gent_null_space(void)
+{
+ hid_t fid, root, dataset, space, attr;
+ int dset_buf = 10;
+ int point = 4;
+
+ fid = H5Fcreate(FILE45, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ root = H5Gopen2(fid, "/", H5P_DEFAULT);
+
+ /* null space */
+ space = H5Screate(H5S_NULL);
+
+ /* dataset */
+ dataset = H5Dcreate2(fid, "dset", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ /* nothing should be written */
+ H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &dset_buf);
+
+ /* attribute */
+ attr = H5Acreate2(root, "attr", H5T_NATIVE_UINT, space, H5P_DEFAULT, H5P_DEFAULT);
+ H5Awrite(attr, H5T_NATIVE_INT, &point); /* Nothing can be written */
+
+ H5Dclose(dataset);
+ H5Aclose(attr);
+ H5Gclose(root);
+ H5Sclose(space);
+ H5Fclose(fid);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: gent_zero_dim_size
+ *
+ * Purpose: generates dataset and attribute with dataspace of 0 dimension size
+ *-------------------------------------------------------------------------
+ */
+static void gent_zero_dim_size(void)
+{
+ hid_t fid, root, dataset, space, attr;
+ hsize_t dims1[] = {SPACE3_DIM1, SPACE3_DIM2};
+ int dset_buf = 10;
+ int point = 4;
+
+ fid = H5Fcreate(FILE67, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ root = H5Gopen2(fid, "/", H5P_DEFAULT);
+
+ /* dataspace of 0 dimension size */
+ space = H5Screate_simple(SPACE3_RANK, dims1, NULL);
+
+ /* dataset */
+ dataset = H5Dcreate2(fid, "dset of 0 dimension size", H5T_STD_I32BE, space, H5P_DEFAULT,
+ H5P_DEFAULT, H5P_DEFAULT);
+ /* nothing should be written */
+ H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &dset_buf);
+
+ /* attribute */
+ attr = H5Acreate2(root, "attr of 0 dimension size", H5T_NATIVE_UINT, space, H5P_DEFAULT, H5P_DEFAULT);
+ H5Awrite(attr, H5T_NATIVE_INT, &point); /* Nothing can be written */
+
+ H5Dclose(dataset);
+ H5Aclose(attr);
+ H5Gclose(root);
+ H5Sclose(space);
+ H5Fclose(fid);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: make_dset
+ *
+ * Purpose: utility function to create and write a dataset in LOC_ID
+ *
+ *-------------------------------------------------------------------------
+ */
+static
+int make_dset(hid_t loc_id,
+ const char *name,
+ hid_t sid,
+ hid_t tid,
+ hid_t dcpl,
+ void *buf)
+{
+ hid_t dsid;
+
+ /* create the dataset */
+ if((dsid = H5Dcreate2(loc_id, name, tid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ return -1;
+
+ /* write */
+ if(H5Dwrite(dsid, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ goto out;
+
+ /* close */
+ if(H5Dclose(dsid) < 0)
+ return -1;
+
+ return 0;
+
+ out:
+ H5E_BEGIN_TRY {
+ H5Dclose(dsid);
+ } H5E_END_TRY;
+ return -1;
+}
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: make_external
+ *
+ * Purpose: make a dataset with external storage
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+make_external(hid_t fid)
+{
+ hid_t dcpl; /*dataset creation property list */
+ hid_t sid; /*dataspace ID */
+ hid_t dsid; /*dataset ID */
+ hsize_t cur_size[1]; /*data space current size */
+ hsize_t max_size[1]; /*data space maximum size */
+ hsize_t size; /*bytes reserved for data in the external file*/
+ int ret;
+
+ cur_size[0] = max_size[0] = 100;
+ size = (max_size[0]*sizeof(int)/2);
+
+ dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ ret = H5Pset_external(dcpl, "ext1.bin", (off_t)0, size);
+ HDassert(ret >= 0);
+
+ ret = H5Pset_external(dcpl, "ext2.bin", (off_t)0, size);
+ HDassert(ret >= 0);
+
+ sid = H5Screate_simple(1, cur_size, max_size);
+ HDassert(ret >= 0);
+
+ dsid = H5Dcreate2(fid, "external", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ HDassert(ret >= 0);
+
+ H5Dclose(dsid);
+ HDassert(ret >= 0);
+
+ H5Sclose(sid);
+ HDassert(ret >= 0);
+
+ H5Pclose(dcpl);
+ HDassert(ret >= 0);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: gent_filters
+ *
+ * Purpose: make several datasets with filters, external dataset
+ *
+ *-------------------------------------------------------------------------
+ */
+static void gent_filters(void)
+{
+ hid_t fid; /* file id */
+ hid_t dcpl; /* dataset creation property list */
+ hid_t sid; /* dataspace ID */
+ hid_t tid; /* datatype ID */
+#ifdef H5_HAVE_FILTER_SZIP
+ unsigned szip_options_mask=H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_NN_OPTION_MASK;
+ unsigned szip_pixels_per_block=4;
+#endif /* H5_HAVE_FILTER_SZIP */
+ hsize_t dims1[RANK] = {DIM1,DIM2};
+ hsize_t chunk_dims[RANK] = {CDIM1,CDIM2};
+ int buf1[DIM1][DIM2];
+ int i, j, n, ret;
+
+ for(i=n=0; i<DIM1; i++){
+ for(j=0; j<DIM2; j++){
+ buf1[i][j]=n++;
+ }
+ }
+
+ /* create a file */
+ fid = H5Fcreate(FILE44, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ HDassert(fid>=0);
+
+ /* create a space */
+ sid = H5Screate_simple(SPACE2_RANK, dims1, NULL);
+
+ /* create a dataset creation property list; the same DCPL is used for all dsets */
+ dcpl = H5Pcreate(H5P_DATASET_CREATE);
+
+ /*-------------------------------------------------------------------------
+ * create a compact and contiguous storage layout dataset
+ * add a comment to the datasets
+ *-------------------------------------------------------------------------
+ */
+ ret = H5Pset_layout(dcpl, H5D_COMPACT);
+ HDassert(ret >= 0);
+
+ ret=make_dset(fid,"compact",sid,H5T_NATIVE_INT,dcpl,buf1);
+ HDassert(ret >= 0);
+
+ ret = H5Oset_comment_by_name(fid, "compact", "This is a dataset with compact storage", H5P_DEFAULT);
+ HDassert(ret >= 0);
+
+ ret = H5Pset_layout(dcpl, H5D_CONTIGUOUS);
+ HDassert(ret >= 0);
+
+ ret=make_dset(fid,"contiguous",sid,H5T_NATIVE_INT,dcpl,buf1);
+ HDassert(ret >= 0);
+
+ ret = H5Oset_comment_by_name(fid, "contiguous", "This is a dataset with contiguous storage", H5P_DEFAULT);
+ HDassert(ret >= 0);
+
+ ret = H5Pset_layout(dcpl, H5D_CHUNKED);
+ HDassert(ret >= 0);
+
+ ret = H5Pset_chunk(dcpl, SPACE2_RANK, chunk_dims);
+ HDassert(ret >= 0);
+
+ ret=make_dset(fid,"chunked",sid,H5T_NATIVE_INT,dcpl,buf1);
+ HDassert(ret >= 0);
+
+ ret = H5Oset_comment_by_name(fid, "chunked", "This is a dataset with chunked storage", H5P_DEFAULT);
+ HDassert(ret >= 0);
+
+ /*-------------------------------------------------------------------------
+ * make several dataset with filters
+ *-------------------------------------------------------------------------
+ */
+
+ /* set up chunk */
+ ret = H5Pset_chunk(dcpl, SPACE2_RANK, chunk_dims);
+ HDassert(ret >= 0);
+
+ /*-------------------------------------------------------------------------
+ * SZIP
+ *-------------------------------------------------------------------------
+ */
+#ifdef H5_HAVE_FILTER_SZIP
+ if(h5tools_can_encode(H5Z_FILTER_SZIP) == 1) {
+ /* remove the filters from the dcpl */
+ ret = H5Premove_filter(dcpl,H5Z_FILTER_ALL);
+ HDassert(ret >= 0);
+
+ /* set szip data */
+ ret = H5Pset_szip (dcpl,szip_options_mask,szip_pixels_per_block);
+ HDassert(ret >= 0);
+
+ ret=make_dset(fid,"szip",sid,H5T_NATIVE_INT,dcpl,buf1);
+ HDassert(ret >= 0);
+ }
+#endif /* H5_HAVE_FILTER_SZIP */
+
+ /*-------------------------------------------------------------------------
+ * GZIP
+ *-------------------------------------------------------------------------
+ */
+#if defined (H5_HAVE_FILTER_DEFLATE)
+ /* remove the filters from the dcpl */
+ ret = H5Premove_filter(dcpl,H5Z_FILTER_ALL);
+ HDassert(ret >= 0);
+
+ /* set deflate data */
+ ret = H5Pset_deflate(dcpl, 9);
+ HDassert(ret >= 0);
+
+ ret=make_dset(fid,"deflate",sid,H5T_NATIVE_INT,dcpl,buf1);
+ HDassert(ret >= 0);
+#endif
+
+
+ /*-------------------------------------------------------------------------
+ * shuffle
+ *-------------------------------------------------------------------------
+ */
+
+ /* remove the filters from the dcpl */
+ ret = H5Premove_filter(dcpl,H5Z_FILTER_ALL);
+ HDassert(ret >= 0);
+
+ /* set the shuffle filter */
+ ret = H5Pset_shuffle(dcpl);
+ HDassert(ret >= 0);
+
+ ret=make_dset(fid,"shuffle",sid,H5T_NATIVE_INT,dcpl,buf1);
+ HDassert(ret >= 0);
+
+
+ /*-------------------------------------------------------------------------
+ * checksum
+ *-------------------------------------------------------------------------
+ */
+
+ /* remove the filters from the dcpl */
+ ret = H5Premove_filter(dcpl,H5Z_FILTER_ALL);
+ HDassert(ret >= 0);
+
+ /* set the checksum filter */
+ ret = H5Pset_fletcher32(dcpl);
+ HDassert(ret >= 0);
+
+ ret=make_dset(fid,"fletcher32",sid,H5T_NATIVE_INT,dcpl,buf1);
+ HDassert(ret >= 0);
+
+ /*-------------------------------------------------------------------------
+ * nbit
+ *-------------------------------------------------------------------------
+ */
+
+ /* remove the filters from the dcpl */
+ ret = H5Premove_filter(dcpl,H5Z_FILTER_ALL);
+ HDassert(ret >= 0);
+
+ /* set the checksum filter */
+ ret = H5Pset_nbit(dcpl);
+ HDassert(ret >= 0);
+
+ tid=H5Tcopy(H5T_NATIVE_INT);
+ H5Tset_precision(tid,H5Tget_size(tid)-1);
+ ret=make_dset(fid,"nbit",sid,tid,dcpl,buf1);
+ HDassert(ret >= 0);
+
+ /*-------------------------------------------------------------------------
+ * scaleoffset
+ *-------------------------------------------------------------------------
+ */
+
+ /* remove the filters from the dcpl */
+ ret = H5Premove_filter(dcpl,H5Z_FILTER_ALL);
+ HDassert(ret >= 0);
+
+ /* set the scaleoffset filter */
+ ret = H5Pset_scaleoffset(dcpl,H5Z_SO_INT,(int)H5Tget_size(H5T_NATIVE_INT));
+ HDassert(ret >= 0);
+
+ ret=make_dset(fid,"scaleoffset",sid,H5T_NATIVE_INT,dcpl,buf1);
+ HDassert(ret >= 0);
+
+ /*-------------------------------------------------------------------------
+ * all filters
+ *-------------------------------------------------------------------------
+ */
+ /* remove the filters from the dcpl */
+ ret = H5Premove_filter(dcpl,H5Z_FILTER_ALL);
+ HDassert(ret >= 0);
+
+ /* set the shuffle filter */
+ ret = H5Pset_shuffle(dcpl);
+ HDassert(ret >= 0);
+
+#ifdef H5_HAVE_FILTER_SZIP
+ if(h5tools_can_encode(H5Z_FILTER_SZIP) == 1) {
+ szip_options_mask=H5_SZIP_CHIP_OPTION_MASK | H5_SZIP_EC_OPTION_MASK;
+ /* set szip data */
+ ret = H5Pset_szip (dcpl,szip_options_mask,szip_pixels_per_block);
+ HDassert(ret >= 0);
+ }
+#endif /* H5_HAVE_FILTER_SZIP */
+
+#if defined (H5_HAVE_FILTER_DEFLATE)
+ /* set deflate data */
+ ret = H5Pset_deflate(dcpl, 5);
+ HDassert(ret >= 0);
+#endif
+
+ /* set the checksum filter */
+ ret = H5Pset_fletcher32(dcpl);
+ HDassert(ret >= 0);
+
+ /* set the nbit filter */
+ ret = H5Pset_nbit(dcpl);
+ HDassert(ret >= 0);
+
+ ret=make_dset(fid,"all",sid,H5T_NATIVE_INT,dcpl,buf1);
+ HDassert(ret >= 0);
+
+
+ /*-------------------------------------------------------------------------
+ * user defined filter
+ *-------------------------------------------------------------------------
+ */
+ /* remove the filters from the dcpl */
+ ret = H5Premove_filter(dcpl,H5Z_FILTER_ALL);
+ HDassert(ret >= 0);
+
+ ret = H5Zregister (H5Z_MYFILTER);
+ HDassert(ret >= 0);
+
+ ret = H5Pset_filter (dcpl, MYFILTER_ID, 0, 0, NULL);
+ HDassert(ret >= 0);
+
+ ret=make_dset(fid,"myfilter",sid,H5T_NATIVE_INT,dcpl,buf1);
+ HDassert(ret >= 0);
+
+ /* remove the filters from the dcpl */
+ ret = H5Premove_filter(dcpl,H5Z_FILTER_ALL);
+ HDassert(ret >= 0);
+
+ /*-------------------------------------------------------------------------
+ * make an external dataset
+ *-------------------------------------------------------------------------
+ */
+ make_external(fid);
+
+ /*-------------------------------------------------------------------------
+ * H5D_ALLOC_TIME_EARLY
+ *-------------------------------------------------------------------------
+ */
+ ret = H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY);
+ HDassert(ret >= 0);
+ ret=make_dset(fid,"alloc_time_early",sid,H5T_NATIVE_INT,dcpl,buf1);
+ HDassert(ret >= 0);
+
+ /*-------------------------------------------------------------------------
+ * H5D_ALLOC_TIME_INCR
+ *-------------------------------------------------------------------------
+ */
+ ret = H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_INCR);
+ HDassert(ret >= 0);
+ ret=make_dset(fid,"alloc_time_incr",sid,H5T_NATIVE_INT,dcpl,buf1);
+ HDassert(ret >= 0);
+
+ /*-------------------------------------------------------------------------
+ * H5D_ALLOC_TIME_LATE
+ *-------------------------------------------------------------------------
+ */
+ ret = H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_LATE);
+ HDassert(ret >= 0);
+ ret=make_dset(fid,"alloc_time_late",sid,H5T_NATIVE_INT,dcpl,buf1);
+ HDassert(ret >= 0);
+
+ /*-------------------------------------------------------------------------
+ * commit a H5G_TYPE type with a comment
+ *-------------------------------------------------------------------------
+ */
+ tid = H5Tcopy(H5T_STD_B8LE);
+ ret = H5Tcommit2(fid, "mytype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ HDassert(ret >= 0);
+
+ ret = H5Oset_comment_by_name(fid, "mytype", "This is a commited datatype", H5P_DEFAULT);
+ HDassert(ret >= 0);
+
+ ret = H5Tclose(tid);
+ HDassert(ret >= 0);
+
+ /*-------------------------------------------------------------------------
+ * close
+ *-------------------------------------------------------------------------
+ */
+ ret = H5Sclose(sid);
+ HDassert(ret >= 0);
+
+ ret = H5Pclose(dcpl);
+ HDassert(ret >= 0);
+
+ ret = H5Fclose(fid);
+ HDassert(ret >= 0);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: myfilter
+ *
+ * Purpose: filter operation callback function; the filter does nothing
+ *
+ *-------------------------------------------------------------------------
+ */
+static size_t
+myfilter(unsigned int H5_ATTR_UNUSED flags, size_t H5_ATTR_UNUSED cd_nelmts,
+ const unsigned int H5_ATTR_UNUSED *cd_values, size_t nbytes,
+ size_t H5_ATTR_UNUSED *buf_size, void H5_ATTR_UNUSED **buf)
+{
+ return nbytes;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: set_local_myfilter
+ *
+ * Purpose: filter operation "set local" callback
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static herr_t
+set_local_myfilter(hid_t dcpl_id, hid_t H5_ATTR_UNUSED tid, hid_t H5_ATTR_UNUSED sid)
+{
+ unsigned flags; /* Filter flags */
+ size_t cd_nelmts = 0; /* Number of filter parameters */
+ unsigned cd_values[2] = {5, 6}; /* Filter parameters */
+
+ /* Get the filter's current parameters */
+ if(H5Pget_filter_by_id2(dcpl_id, MYFILTER_ID, &flags, &cd_nelmts, cd_values, 0, NULL, NULL) < 0)
+ return(FAIL);
+
+ cd_nelmts = 2;
+
+ /* Modify the filter's parameters for this dataset */
+ if(H5Pmodify_filter(dcpl_id, MYFILTER_ID, flags, cd_nelmts, cd_values) < 0)
+ return(FAIL);
+
+ return(SUCCEED);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: gent_fcontents
+ *
+ * Purpose: generate several files to list its contents
+ *
+ *-------------------------------------------------------------------------
+ */
+static void gent_fcontents(void)
+{
+ hid_t fid; /* file id */
+ hid_t gid1; /* group ID */
+ hid_t tid; /* datatype ID */
+ hsize_t dims[1]={4};
+ int buf[4]={1,2,3,4};
+ int ret;
+
+
+ /* create a file */
+ fid = H5Fcreate(FILE46, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ HDassert(fid>=0);
+
+
+ write_dset(fid,1,dims,"dset",H5T_NATIVE_INT,buf);
+
+
+ /*-------------------------------------------------------------------------
+ * links
+ *-------------------------------------------------------------------------
+ */
+
+
+ /* hard link to "dset" */
+ gid1 = H5Gcreate2(fid, "/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Lcreate_hard(gid1, "/dset", H5L_SAME_LOC, "dset1", H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(gid1);
+
+
+ /* hard link to "dset" */
+ gid1 = H5Gcreate2(fid, "/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Lcreate_hard(gid1, "/dset", H5L_SAME_LOC, "dset2", H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(gid1);
+
+
+ /* hard link to "g2" */
+ gid1 = H5Gopen2(fid, "/g1", H5P_DEFAULT);
+ H5Lcreate_hard(gid1, "/g2", H5L_SAME_LOC, "g1.1", H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(gid1);
+
+
+ /* hard link to "dset" */
+ ret = H5Lcreate_hard(fid, "/dset", H5L_SAME_LOC, "dset3", H5P_DEFAULT, H5P_DEFAULT);
+ HDassert(ret >= 0);
+
+
+ /* hard link to "dset" */
+ ret = H5Lcreate_hard(fid, "/dset", H5L_SAME_LOC, "dset4", H5P_DEFAULT, H5P_DEFAULT);
+ HDassert(ret >= 0);
+
+
+ /* soft link to itself */
+ ret = H5Lcreate_soft("mylink", fid, "mylink", H5P_DEFAULT, H5P_DEFAULT);
+ HDassert(ret >= 0);
+
+
+ /* soft link to "dset" */
+ ret = H5Lcreate_soft("/dset", fid, "softlink", H5P_DEFAULT, H5P_DEFAULT);
+ HDassert(ret >= 0);
+
+ /* dangling external link */
+ ret = H5Lcreate_external("fname", "oname", fid, "extlink", H5P_DEFAULT, H5P_DEFAULT);
+ HDassert(ret >= 0);
+
+ /* dangling udlink */
+ ret = H5Lcreate_ud(fid, "udlink", (H5L_type_t)MY_LINKCLASS, NULL, 0, H5P_DEFAULT, H5P_DEFAULT);
+ HDassert(ret >= 0);
+
+ /*-------------------------------------------------------------------------
+ * datatypes
+ *-------------------------------------------------------------------------
+ */
+ tid = H5Tcopy(H5T_NATIVE_INT);
+ ret = H5Tcommit2(fid, "mytype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ HDassert(ret >= 0);
+ ret = H5Tclose(tid);
+ HDassert(ret >= 0);
+
+
+ /* no name datatype */
+ tid = H5Tcopy(H5T_NATIVE_INT);
+ ret = H5Tcommit2(fid, "mytype2", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ HDassert(ret >= 0);
+ write_dset(fid, 1, dims, "dsetmytype2", tid, buf);
+ ret = H5Ldelete(fid, "mytype2", H5P_DEFAULT);
+ HDassert(ret >= 0);
+ ret = H5Tclose(tid);
+ HDassert(ret >= 0);
+
+
+ /*-------------------------------------------------------------------------
+ * close
+ *-------------------------------------------------------------------------
+ */
+
+
+ ret = H5Fclose(fid);
+ HDassert(ret >= 0);
+
+
+ /* create a file for the bootblock test */
+ fid = H5Fcreate(FILE47, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ HDassert(fid>=0);
+
+
+ ret = H5Fclose(fid);
+ HDassert(ret >= 0);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: gent_fvalues
+ *
+ * Purpose: generate a file for the fill values test
+ *
+ *-------------------------------------------------------------------------
+ */
+static void gent_fvalues(void)
+{
+ /* compound datatype */
+ typedef struct c_t
+ {
+ char a;
+ double b;
+ } c_t;
+
+
+ hid_t fid; /* file id */
+ hid_t dcpl; /* dataset creation property list */
+ hid_t sid; /* dataspace ID */
+ hid_t tid; /* datatype ID */
+ hid_t did; /* datasetID */
+ hsize_t dims[1]={2};
+ int buf[2]={1,2}; /* integer */
+ int fillval1=-99; /* integer fill value */
+ c_t buf2[2]={{1,2},{3,4}}; /* compound */
+ c_t fillval2[1]={{1,2}}; /* compound fill value */
+ hvl_t buf3[2]; /* vlen */
+ hvl_t fillval3; /* vlen fill value */
+ hsize_t dimarray[1]={3}; /* array dimension */
+ int buf4[2][3]= {{1,2,3},{4,5,6}}; /* array */
+ int ret;
+
+ /* create a file */
+ fid = H5Fcreate(FILE48, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ HDassert(fid>=0);
+
+ /* create a space */
+ sid = H5Screate_simple(1, dims, NULL);
+
+ /* create a dataset creation property list */
+ dcpl = H5Pcreate(H5P_DATASET_CREATE);
+
+ /*-------------------------------------------------------------------------
+ * make datasets with fill value combinations
+ * H5D_FILL_TIME_IFSET
+ *-------------------------------------------------------------------------
+ */
+ ret = H5Pset_fill_time(dcpl, H5D_FILL_TIME_IFSET);
+ HDassert(ret >= 0);
+
+ ret = H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval1);
+ HDassert(ret >= 0);
+
+ ret=make_dset(fid,"fill_time_ifset",sid,H5T_NATIVE_INT,dcpl,buf);
+ HDassert(ret >= 0);
+
+ /*-------------------------------------------------------------------------
+ * H5D_FILL_TIME_NEVER
+ *-------------------------------------------------------------------------
+ */
+ ret = H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER);
+ HDassert(ret >= 0);
+
+ ret = H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval1);
+ HDassert(ret >= 0);
+
+ ret=make_dset(fid,"fill_time_never",sid,H5T_NATIVE_INT,dcpl,buf);
+ HDassert(ret >= 0);
+
+ /*-------------------------------------------------------------------------
+ * H5D_FILL_TIME_ALLOC
+ *-------------------------------------------------------------------------
+ */
+ ret = H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC);
+ HDassert(ret >= 0);
+
+ ret = H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval1);
+ HDassert(ret >= 0);
+
+ ret=make_dset(fid,"fill_time_alloc",sid,H5T_NATIVE_INT,dcpl,buf);
+ HDassert(ret >= 0);
+
+ ret = H5Pclose(dcpl);
+ HDassert(ret >= 0);
+
+ /*-------------------------------------------------------------------------
+ * dataset with no fill value
+ *-------------------------------------------------------------------------
+ */
+ write_dset(fid,1,dims,"no_fill",H5T_NATIVE_INT,buf);
+
+ /*-------------------------------------------------------------------------
+ * dataset with a H5T_COMPOUND fill value
+ *-------------------------------------------------------------------------
+ */
+ dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ tid = H5Tcreate (H5T_COMPOUND, sizeof(c_t));
+ H5Tinsert(tid, "a", HOFFSET(c_t, a), H5T_NATIVE_CHAR);
+ H5Tinsert(tid, "b", HOFFSET(c_t, b), H5T_NATIVE_DOUBLE);
+ ret = H5Pset_fill_value(dcpl, tid, &fillval2);
+ HDassert(ret >= 0);
+ ret=make_dset(fid,"fill_compound",sid,tid,dcpl,buf2);
+ HDassert(ret >= 0);
+ ret = H5Tclose(tid);
+ HDassert(ret >= 0);
+ ret = H5Pclose(dcpl);
+ HDassert(ret >= 0);
+
+ /*-------------------------------------------------------------------------
+ * dataset with a H5T_VLEN fill value
+ *-------------------------------------------------------------------------
+ */
+ buf3[0].len = 1;
+ buf3[0].p = HDmalloc( 1 * sizeof(int));
+ ((int *)buf3[0].p)[0]=1;
+ buf3[1].len = 2;
+ buf3[1].p = HDmalloc(2 * sizeof(int));
+ ((int *)buf3[1].p)[0] = 2;
+ ((int *)buf3[1].p)[1] = 3;
+
+ tid = H5Tvlen_create(H5T_NATIVE_INT);
+ dcpl = H5Pcreate(H5P_DATASET_CREATE);
+
+ fillval3.p=NULL; fillval3.len=0;
+ ret = H5Pset_fill_value(dcpl, tid, &fillval3);
+ HDassert(ret >= 0);
+
+ did = H5Dcreate2(fid, "fill_vlen", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ ret = H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf3);
+ HDassert(ret >= 0);
+ ret = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf3);
+ HDassert(ret >= 0);
+ ret = H5Dclose(did);
+ ret = H5Tclose(tid);
+ ret = H5Pclose(dcpl);
+ HDassert(ret >= 0);
+
+ /*-------------------------------------------------------------------------
+ * dataset with a H5T_ARRAY fill value
+ *-------------------------------------------------------------------------
+ */
+ tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray);
+ write_dset(fid, 1, dims, "fill_array", tid, buf4);
+ ret = H5Tclose(tid);
+
+
+ /*-------------------------------------------------------------------------
+ * close
+ *-------------------------------------------------------------------------
+ */
+ ret = H5Sclose(sid);
+ HDassert(ret >= 0);
+ ret = H5Fclose(fid);
+ HDassert(ret >= 0);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: gent_string
+ *
+ * Purpose: make several datasets for the string with escape/not escape test
+ *
+ *-------------------------------------------------------------------------
+ */
+static void gent_string(void)
+{
+ /* compound datatype */
+ typedef struct c_t
+ {
+ int a;
+ char str[255];
+ } c_t;
+
+ hid_t fid; /* file id */
+ hid_t sid; /* dataspace ID */
+ hid_t tid; /* datatype ID */
+ hid_t str_tid; /* datatype ID */
+ hid_t did; /* dataset ID */
+ char buf1[]={"quote \" backspace\b form feed\f new line\n tab\t new line\n carriage return\r"};
+ const char *buf2[SPACE1_DIM1]= {
+ "Four score and seven\n years ago our forefathers brought forth on this continent a new nation,",
+ "conceived in liberty\n and dedicated to the proposition that all men are created equal.",
+ "Now we are engaged\n in a great civil war,",
+ "testing whether that\n nation or any nation so conceived and so dedicated can long endure."
+ };
+ c_t buf3 = {24, "Four score and seven\n years ago our forefathers brought forth on this continent a new nation"};
+ char buf4[] = {"Four score and seven\n years ago our forefathers brought forth on this continent a new nation"};
+ hsize_t dims1[] = {1};
+ hsize_t dims2[] = {SPACE1_DIM1};
+ hsize_t dims4[1];
+ int ret;
+
+ dims4[0] = sizeof(buf4);
+
+ /* create a file */
+ fid = H5Fcreate(FILE49, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ HDassert(fid>=0);
+
+ /*-------------------------------------------------------------------------
+ * str1
+ *-------------------------------------------------------------------------
+ */
+
+ tid=H5Tcopy(H5T_C_S1);
+ ret = H5Tset_size(tid, sizeof(buf1));
+ HDassert(ret >= 0);
+ write_dset(fid,1,dims1,"str1",tid,buf1);
+ HDassert(ret >= 0);
+ ret = H5Tclose(tid);
+ HDassert(ret >= 0);
+
+ /*-------------------------------------------------------------------------
+ * str2
+ *-------------------------------------------------------------------------
+ */
+ sid = H5Screate_simple(SPACE1_RANK, dims2, NULL);
+ tid = H5Tcopy(H5T_C_S1);
+ ret = H5Tset_size(tid, H5T_VARIABLE);
+ HDassert(ret >= 0);
+ did = H5Dcreate2(fid, "str2", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ ret = H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2);
+ HDassert(ret >= 0);
+ ret = H5Tclose(tid);
+ HDassert(ret >= 0);
+ ret = H5Dclose(did);
+ HDassert(ret >= 0);
+ ret = H5Sclose(sid);
+ HDassert(ret >= 0);
+
+ /*-------------------------------------------------------------------------
+ * str3
+ *-------------------------------------------------------------------------
+ */
+ sid = H5Screate_simple(SPACE1_RANK, dims1, NULL);
+ tid = H5Tcreate (H5T_COMPOUND, sizeof(c_t));
+ str_tid = H5Tcopy( H5T_C_S1 );
+ H5Tset_size( str_tid, 255 );
+ H5Tinsert(tid, "a", HOFFSET(c_t, a), H5T_NATIVE_INT);
+ H5Tinsert(tid, "str", HOFFSET(c_t, str), str_tid );
+ ret=make_dset(fid,"str3",sid,tid,H5P_DEFAULT,&buf3);
+ HDassert(ret >= 0);
+ ret = H5Tclose(tid);
+ HDassert(ret >= 0);
+ ret = H5Tclose(str_tid);
+ HDassert(ret >= 0);
+ ret = H5Sclose(sid);
+ HDassert(ret >= 0);
+
+ /*-------------------------------------------------------------------------
+ * str4
+ *-------------------------------------------------------------------------
+ */
+ sid = H5Screate_simple(SPACE1_RANK, dims4, NULL);
+ ret=make_dset(fid,"str4",sid,H5T_NATIVE_CHAR,H5P_DEFAULT,buf4);
+ ret = H5Sclose(sid);
+ HDassert(ret >= 0);
+
+ /*-------------------------------------------------------------------------
+ * close
+ *-------------------------------------------------------------------------
+ */
+ ret = H5Fclose(fid);
+ HDassert(ret >= 0);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: gent_aindices
+ *
+ * Purpose: make several datasets for the array indices and subsetting tests
+ *
+ *-------------------------------------------------------------------------
+ */
+static void gent_aindices(void)
+{
+ hid_t fid; /* file id */
+ hid_t gid[6]; /* group ids */
+ hsize_t dims1[1] = {100};
+ hsize_t dims2[2] = {10,10};
+ hsize_t dims3[3] = {2,10,10};
+ hsize_t dims4[4] = {2,2,10,10};
+ int buf1[100];
+ int buf2[10][10];
+ int buf3[2][10][10];
+ int buf4[2][2][10][10];
+ int i, j, k, l, n, ret;
+
+ for(i = n = 0; i < 100; i++)
+ buf1[i] = n++;
+
+ for(i = n = 0; i < 10; i++)
+ for(j = 0; j < 10; j++)
+ buf2[i][j] = n++;
+ for(i = n = 0; i < 2; i++)
+ for(j = 0; j < 10; j++)
+ for(k = 0; k < 10; k++)
+ buf3[i][j][k] = n++;
+ for(i = n = 0; i < 2; i++)
+ for(j = 0; j < 2; j++)
+ for(k = 0; k < 10; k++)
+ for(l = 0; l < 10; l++)
+ buf4[i][j][k][l] = n++;
+
+ /* create a file */
+ fid = H5Fcreate(FILE50, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ HDassert(fid>=0);
+
+ /*-------------------------------------------------------------------------
+ * root datasets
+ *-------------------------------------------------------------------------
+ */
+ write_dset(fid,1,dims1,"1d",H5T_NATIVE_INT,buf1);
+ write_dset(fid,2,dims2,"2d",H5T_NATIVE_INT,buf2);
+ write_dset(fid,3,dims3,"3d",H5T_NATIVE_INT,buf3);
+ write_dset(fid,4,dims4,"4d",H5T_NATIVE_INT,buf4);
+
+ /*-------------------------------------------------------------------------
+ * test with group indentation
+ *-------------------------------------------------------------------------
+ */
+ gid[0] = H5Gcreate2(fid, "/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ gid[1] = H5Gcreate2(fid, "g1/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ gid[2] = H5Gcreate2(fid, "g1/g2/g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ gid[3] = H5Gcreate2(fid, "g1/g2/g3/g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ gid[4] = H5Gcreate2(fid, "g1/g2/g3/g4/g5", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ gid[5] = H5Gcreate2(fid, "g1/g2/g3/g4/g5/g6", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ write_dset(gid[5],1,dims1,"1d",H5T_NATIVE_INT,buf1);
+ write_dset(gid[5],2,dims2,"2d",H5T_NATIVE_INT,buf2);
+ write_dset(gid[5],3,dims3,"3d",H5T_NATIVE_INT,buf3);
+ write_dset(gid[5],4,dims4,"4d",H5T_NATIVE_INT,buf4);
+ for(i = 0; i < 6; i++)
+ H5Gclose(gid[i]);
+
+ /*-------------------------------------------------------------------------
+ * close
+ *-------------------------------------------------------------------------
+ */
+ ret = H5Fclose(fid);
+ HDassert(ret >= 0);
+
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: gent_longlinks
+ *
+ * Purpose: make file with very long names for objects
+ *
+ *-------------------------------------------------------------------------
+ */
+static void gent_longlinks(void)
+{
+ hid_t fid = (-1); /* File ID */
+ hid_t gid = (-1); /* Group ID */
+ hid_t gid2 = (-1); /* Datatype ID */
+ char *objname = NULL; /* Name of object [Long] */
+ size_t u; /* Local index variable */
+
+ /* Create files */
+ fid = H5Fcreate(FILE51, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ HDassert(fid >= 0);
+
+ /* Create group with short name in file (used as target for hard links) */
+ gid = H5Gcreate2(fid, "grp1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ HDassert(gid >= 0);
+
+ /* Construct very long file name */
+ objname = (char*) HDmalloc((size_t)(F51_MAX_NAME_LEN + 1));
+ HDassert(objname);
+ for(u = 0; u < F51_MAX_NAME_LEN; u++)
+ objname[u] = 'a';
+ objname[F51_MAX_NAME_LEN] = '\0';
+
+ /* Create hard link to existing object */
+ HDassert(H5Lcreate_hard(fid, "grp1", fid, objname, H5P_DEFAULT, H5P_DEFAULT) >= 0);
+
+ /* Create soft link to existing object */
+ objname[0] = 'b';
+ HDassert(H5Lcreate_soft("grp1", fid, objname, H5P_DEFAULT, H5P_DEFAULT) >= 0);
+
+ /* Create group with long name in existing group */
+ gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ HDassert(gid2 >= 0);
+
+ /* Close objects */
+ HDassert(H5Gclose(gid2) >= 0);
+ HDassert(H5Gclose(gid) >= 0);
+ HDassert(H5Fclose(fid) >= 0);
+
+ /* Release memory */
+ HDfree(objname);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: gent_ldouble
+ *
+ * Purpose: make file with a long double dataset
+ *
+ *-------------------------------------------------------------------------
+ */
+static int gent_ldouble(void)
+{
+ hid_t fid;
+ hid_t did;
+ hid_t tid;
+ hid_t sid;
+ hsize_t dims[1] = {3};
+ long double buf[3] = {1,2,3};
+
+ if((fid = H5Fcreate(FILE52, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+
+ if((sid = H5Screate_simple(1, dims, NULL)) < 0)
+ goto error;
+
+ if((tid = H5Tcopy(H5T_NATIVE_LDOUBLE)) < 0)
+ goto error;
+
+ if(H5Tget_size(tid) == 0)
+ goto error;
+
+ if((did = H5Dcreate2(fid, "dset", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+
+ if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ goto error;
+
+ if(H5Sclose(sid) < 0)
+ goto error;
+ if(H5Tclose(tid) < 0)
+ goto error;
+ if(H5Dclose(did) < 0)
+ goto error;
+ if(H5Fclose(fid) < 0)
+ goto error;
+
+ return 0;
+
+ error:
+ printf("error !\n");
+ return -1;
+
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: gent_binary
+ *
+ * Purpose: Generate a file to be used in the binary output test
+ * Contains:
+ * 1) an integer dataset
+ * 2) a float dataset
+ * 3) a double dataset
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+gent_binary(void)
+{
+ hid_t fid, sid, did, aid;
+ hsize_t dims[1] = {6};
+ int ibuf[6] = {1,2,3,4,5,6};
+ float fbuf[6] = {1,2,3,4,5,6};
+ double dbuf[6] = {1,2,3,4,5,6};
+
+ fid = H5Fcreate(FILE55, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ sid = H5Screate_simple(1, dims, NULL);
+
+
+ /*-------------------------------------------------------------------------
+ * integer
+ *-------------------------------------------------------------------------
+ */
+
+ did = H5Dcreate2(fid, "integer", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, ibuf);
+ H5Dclose(did);
+
+ /*-------------------------------------------------------------------------
+ * float
+ *-------------------------------------------------------------------------
+ */
+ did = H5Dcreate2(fid, "float", H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, fbuf);
+ H5Dclose(did);
+
+ /*-------------------------------------------------------------------------
+ * double
+ *-------------------------------------------------------------------------
+ */
+ did = H5Dcreate2(fid, "double", H5T_NATIVE_DOUBLE, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Dwrite(did, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dbuf);
+ /* create an attribute */
+ aid = H5Acreate2(did, "attr", H5T_NATIVE_DOUBLE, sid, H5P_DEFAULT, H5P_DEFAULT);
+ H5Aclose(aid);
+ H5Dclose(did);
+
+
+ /* close */
+ H5Sclose(sid);
+ H5Fclose(fid);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: gen_bigdims
+ *
+ * Purpose: generate a dataset with dimensions greater than 4GB
+ * and write one hyperslab on the boundary
+ *
+ *-------------------------------------------------------------------------
+ */
+#define GB4LL ((unsigned long long) 4*1024*1024*1024)
+#define DIM_4GB (GB4LL + 10)
+
+static void
+gent_bigdims(void)
+{
+ hid_t fid = -1;
+ hid_t did = -1;
+ hid_t f_sid = -1;
+ hid_t m_sid = -1;
+ hid_t tid = -1;
+ hid_t dcpl = -1;
+ hsize_t dims[1]={DIM_4GB}; /* dataset dimensions */
+ hsize_t chunk_dims[1]={1024}; /* chunk dimensions */
+ hsize_t hs_start[1];
+ hsize_t hs_size[1]; /* hyperslab dimensions */
+ size_t size;
+ char fillvalue=0;
+ char *buf=NULL;
+ hsize_t i;
+ char c;
+ size_t nelmts;
+ int ret;
+
+ /* create a file */
+ fid = H5Fcreate(FILE56, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ HDassert(fid >= 0);
+
+ /* create dataset */
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto out;
+ if(H5Pset_fill_value(dcpl, H5T_NATIVE_SCHAR, &fillvalue) < 0)
+ goto out;
+ if(H5Pset_chunk(dcpl, 1, chunk_dims) < 0)
+ goto out;
+ if((f_sid = H5Screate_simple(1, dims, NULL)) < 0)
+ goto out;
+ if((did = H5Dcreate2(fid, "dset4gb", H5T_NATIVE_SCHAR, f_sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto out;
+ if((tid = H5Dget_type(did)) < 0)
+ goto out;
+ if((size = H5Tget_size(tid)) <= 0)
+ goto out;
+
+ /* select an hyperslab */
+ nelmts = 20;
+ hs_start[0] = GB4LL - 10;
+ hs_size[0] = nelmts;
+
+ if((m_sid = H5Screate_simple(1, hs_size, hs_size)) < 0)
+ goto out;
+
+ buf=(char *) HDmalloc((unsigned)(nelmts*size));
+
+ for(i=0, c=0; i<nelmts; i++, c++)
+ {
+ buf[i] = c;
+ }
+
+ if(H5Sselect_hyperslab (f_sid,H5S_SELECT_SET,hs_start,NULL,hs_size,NULL) < 0)
+ goto out;
+ if(H5Dwrite (did,H5T_NATIVE_SCHAR,m_sid,f_sid,H5P_DEFAULT,buf) < 0)
+ goto out;
+
+
+ HDfree(buf);
+ buf=NULL;
+
+ /* close */
+ if(H5Tclose(tid) < 0)
+ goto out;
+ tid = -1;
+ if(H5Sclose(f_sid) < 0)
+ goto out;
+ f_sid = -1;
+ if(H5Sclose(m_sid) < 0)
+ goto out;
+ m_sid = -1;
+ if(H5Pclose(dcpl) < 0)
+ goto out;
+ dcpl = -1;
+ if(H5Dclose(did) < 0)
+ goto out;
+ did = -1;
+
+ ret = H5Fclose(fid);
+ HDassert(ret >= 0);
+
+ return;
+
+ out:
+ printf("Error.....\n");
+ H5E_BEGIN_TRY {
+ H5Pclose(dcpl);
+ H5Sclose(f_sid);
+ H5Sclose(m_sid);
+ H5Tclose(tid);
+ H5Dclose(did);
+ H5Fclose(fid);
+ } H5E_END_TRY;
+ return;
+}
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: gent_hyperslab
+ *
+ * Purpose: make a dataset for hyperslab read
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+gent_hyperslab(void)
+{
+ hid_t fid; /* file id */
+ hsize_t dims[2] = {32,4097}; /* big enough data size to force a second stripmine read */
+ double *buf;
+ int i, ret;
+
+ buf = (double*) HDmalloc(32 * 4097 * sizeof(double) );
+ for(i = 0; i < 32 * 4097; i++)
+ buf[i] = 1;
+
+ /* create a file */
+ fid = H5Fcreate(FILE57, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ HDassert(fid>=0);
+
+ write_dset(fid,2,dims,"stripmine",H5T_NATIVE_DOUBLE,buf);
+
+ ret = H5Fclose(fid);
+ HDassert(ret >= 0);
+
+ HDfree(buf);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: gent_group_creation_order
+ *
+ * Purpose: generate a file with several groups with creation order set and not
+ * set tru its hierarchy
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+gent_group_creation_order(void)
+{
+ hid_t fid = -1; /* file ID */
+ hid_t gid = -1; /* group ID */
+ hid_t gcpl_id = -1; /* group creation property list ID */
+ hid_t fcpl_id = -1; /* file creation property list ID (to set root group order) */
+
+ if((fcpl_id = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ goto out;
+
+ if(H5Pset_link_creation_order(fcpl_id, H5P_CRT_ORDER_TRACKED ) < 0)
+ goto out;
+
+ if((fid = H5Fcreate(FILE58, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT)) < 0)
+ goto out;
+
+
+ /* create group creation property list */
+ if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0)
+ goto out;
+
+ /*-------------------------------------------------------------------------
+ * create a group "2"
+ *-------------------------------------------------------------------------
+ */
+
+
+ if((gid = H5Gcreate2(fid, "2", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
+ goto out;
+ if(H5Gclose(gid) < 0)
+ goto out;
+ gid = -1;
+
+ if((gid = H5Gcreate2(fid, "2/c", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
+ if(H5Gclose(gid) < 0)
+ goto out;
+ gid = -1;
+ if((gid = H5Gcreate2(fid, "2/b", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
+ if(H5Gclose(gid) < 0)
+ goto out;
+ gid = -1;
+ if((gid = H5Gcreate2(fid, "2/a", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
+ if(H5Gclose(gid) < 0)
+ goto out;
+ gid = -1;
+
+ if((gid = H5Gcreate2(fid, "2/a/a2", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
+ goto out;
+ if(H5Gclose(gid) < 0)
+ goto out;
+ gid = -1;
+ if((gid = H5Gcreate2(fid, "2/a/a1", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
+ goto out;
+ if(H5Gclose(gid) < 0)
+ goto out;
+ gid = -1;
+
+ if((gid = H5Gcreate2(fid, "2/a/a2/a22", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
+ if(H5Gclose(gid) < 0)
+ goto out;
+ gid = -1;
+ if((gid = H5Gcreate2(fid, "2/a/a2/a21", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
+ if(H5Gclose(gid) < 0)
+ goto out;
+ gid = -1;
+
+
+ /*-------------------------------------------------------------------------
+ * create a group "1" with H5P_CRT_ORDER_TRACKED set
+ *-------------------------------------------------------------------------
+ */
+ if(H5Pset_link_creation_order(gcpl_id, H5P_CRT_ORDER_TRACKED) < 0)
+ goto out;
+
+
+ if((gid = H5Gcreate2(fid, "1", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
+ goto out;
+ if(H5Gclose(gid) < 0)
+ goto out;
+ gid = -1;
+
+ if((gid = H5Gcreate2(fid, "1/c", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
+ if(H5Gclose(gid) < 0)
+ goto out;
+ gid = -1;
+ if((gid = H5Gcreate2(fid, "1/b", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
+ if(H5Gclose(gid) < 0)
+ goto out;
+ gid = -1;
+ if((gid = H5Gcreate2(fid, "1/a", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
+ if(H5Gclose(gid) < 0)
+ goto out;
+ gid = -1;
+
+ if((gid = H5Gcreate2(fid, "1/a/a2", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
+ goto out;
+ if(H5Gclose(gid) < 0)
+ goto out;
+ gid = -1;
+ if((gid = H5Gcreate2(fid, "1/a/a1", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
+ goto out;
+ if(H5Gclose(gid) < 0)
+ goto out;
+ gid = -1;
+
+ if((gid = H5Gcreate2(fid, "1/a/a2/a22", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
+ if(H5Gclose(gid) < 0)
+ goto out;
+ gid = -1;
+ if((gid = H5Gcreate2(fid, "1/a/a2/a21", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
+ if(H5Gclose(gid) < 0)
+ goto out;
+ gid = -1;
+
+
+ if(H5Pclose(gcpl_id) < 0)
+ goto out;
+ gcpl_id = -1;
+ if(H5Pclose(fcpl_id) < 0)
+ goto out;
+ fcpl_id = -1;
+ if(H5Fclose(fid) < 0)
+ goto out;
+ fid = -1;
+
+ return;
+
+ out:
+ printf("Error.....\n");
+ H5E_BEGIN_TRY {
+ H5Gclose(gid);
+ H5Pclose(gcpl_id);
+ H5Pclose(fcpl_id);
+ H5Fclose(fid);
+
+ } H5E_END_TRY;
+ return;
+
+}
+
+/*-------------------------------------------------------------------------
+ * Function: gent_attr_creation_order
+ *
+ * Purpose: generate a file with several objects with attributes with creation
+ * order set and not set
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+gent_attr_creation_order(void)
+{
+ hid_t fid = -1; /* file id */
+ hid_t gid = -1; /* group id */
+ hid_t did = -1; /* dataset id */
+ hid_t sid = -1; /* space id */
+ hid_t aid = -1; /* attribute id */
+ hid_t tid = -1; /* datatype id */
+ hid_t gcpl_id = -1; /* group creation property list ID */
+ hid_t dcpl_id = -1; /* dataset creation property list ID */
+ hid_t tcpl_id = -1; /* datatype creation property list ID */
+ int i;
+ const char *attr_name[3] = {"c", "b", "a" };
+
+ if((fid = H5Fcreate(FILE59, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
+
+ /* create group creation property list */
+ if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0)
+ goto out;
+
+ /* create dataset creation property list */
+ if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto out;
+
+ /* create dataset creation property list */
+ if((tcpl_id = H5Pcreate(H5P_DATATYPE_CREATE)) < 0)
+ goto out;
+
+ /* enable attribute creation order tracking on dataset property list */
+ if(H5Pset_attr_creation_order(dcpl_id, H5P_CRT_ORDER_TRACKED) < 0)
+ goto out;
+
+ /* enable attribute creation order tracking on group property list */
+ if(H5Pset_attr_creation_order(gcpl_id, H5P_CRT_ORDER_TRACKED) < 0)
+ goto out;
+
+ /* enable attribute creation order tracking on datatype property list */
+ if(H5Pset_attr_creation_order(tcpl_id, H5P_CRT_ORDER_TRACKED) < 0)
+ goto out;
+
+ /* create a dataspace */
+ if((sid = H5Screate(H5S_SCALAR)) < 0)
+ goto out;
+
+ /*-------------------------------------------------------------------------
+ * create a dataset with creation order tracked for attributes and atributes in it
+ *-------------------------------------------------------------------------
+ */
+
+ /* create a dataset */
+ if((did = H5Dcreate2(fid, "dt", H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0)
+ goto out;
+
+ /* add attributes */
+ for(i = 0; i < 3; i++)
+ {
+ if((aid = H5Acreate2(did, attr_name[i], H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
+
+ /* close attribute */
+ if(H5Aclose(aid) < 0)
+ goto out;
+ aid = -1;
+ } /* end for */
+
+ if(H5Dclose(did) < 0)
+ goto out;
+ did = -1;
+
+
+ /*-------------------------------------------------------------------------
+ * create a dataset without creation order tracked for attributes and atributes in it
+ *-------------------------------------------------------------------------
+ */
+
+ /* create a dataset */
+ if((did = H5Dcreate2(fid, "d", H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
+
+ /* add attributes */
+ for(i = 0; i < 3; i++)
+ {
+ if((aid = H5Acreate2(did, attr_name[i], H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
+
+ /* close attribute */
+ if(H5Aclose(aid) < 0)
+ goto out;
+ aid = -1;
+ } /* end for */
+
+ if(H5Dclose(did) < 0)
+ goto out;
+ did = -1;
+
+
+
+ /*-------------------------------------------------------------------------
+ * create a group with creation order tracked for attributes and atributes in it
+ *-------------------------------------------------------------------------
+ */
+
+ if((gid = H5Gcreate2(fid, "gt", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
+ goto out;
+
+ /* add attributes */
+ for(i = 0; i < 3; i++)
+ {
+ if((aid = H5Acreate2(gid, attr_name[i], H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
+
+ /* close attribute */
+ if(H5Aclose(aid) < 0)
+ goto out;
+ aid = -1;
+ } /* end for */
+
+ if(H5Gclose(gid) < 0)
+ goto out;
+ gid = -1;
+
+ /*-------------------------------------------------------------------------
+ * create a group without creation order tracked for attributes and atributes in it
+ *-------------------------------------------------------------------------
+ */
+
+ if((gid = H5Gcreate2(fid, "g", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
+
+ /* add attributes */
+ for(i = 0; i < 3; i++)
+ {
+ if((aid = H5Acreate2(gid, attr_name[i], H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
+
+ /* close attribute */
+ if(H5Aclose(aid) < 0)
+ goto out;
+ aid = -1;
+ } /* end for */
+
+ if(H5Gclose(gid) < 0)
+ goto out;
+ gid = -1;
+
+ /*-------------------------------------------------------------------------
+ * create a named datatype with creation order tracked for attributes and atributes in it
+ *-------------------------------------------------------------------------
+ */
+
+ if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ goto out;
+
+ if((H5Tcommit2(fid, "tt", tid, H5P_DEFAULT, tcpl_id, H5P_DEFAULT)) < 0)
+ goto out;
+
+ /* add attributes */
+ for(i = 0; i < 3; i++)
+ {
+ if((aid = H5Acreate2(tid, attr_name[i], H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
+
+ /* close attribute */
+ if(H5Aclose(aid) < 0)
+ goto out;
+ aid = -1;
+ } /* end for */
+
+ if(H5Tclose(tid) < 0)
+ goto out;
+ tid = -1;
+
+ /*-------------------------------------------------------------------------
+ * create a named datatype without creation order tracked for attributes and atributes in it
+ *-------------------------------------------------------------------------
+ */
+
+ if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ goto out;
+
+ if((H5Tcommit2(fid, "t", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
+
+ /* add attributes */
+ for(i = 0; i < 3; i++)
+ {
+ if((aid = H5Acreate2(tid, attr_name[i], H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
+
+ /* close attribute */
+ if(H5Aclose(aid) < 0)
+ goto out;
+ aid = -1;
+ } /* end for */
+
+ if(H5Tclose(tid) < 0)
+ goto out;
+ tid = -1;
+
+ /*-------------------------------------------------------------------------
+ * add some attributes to the root group
+ *-------------------------------------------------------------------------
+ */
+ if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0)
+ goto out;
+
+ /* add attributes */
+ for(i = 0; i < 3; i++)
+ {
+ if((aid = H5Acreate2(gid, attr_name[i], H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
+
+ /* close attribute */
+ if(H5Aclose(aid) < 0)
+ goto out;
+ aid = -1;
+ } /* end for */
+
+ if(H5Gclose(gid) < 0)
+ goto out;
+ gid = -1;
+
+ /*-------------------------------------------------------------------------
+ * close
+ *-------------------------------------------------------------------------
+ */
+ if(H5Sclose(sid) < 0)
+ goto out;
+ sid = -1;
+ if(H5Pclose(dcpl_id) < 0)
+ goto out;
+ dcpl_id = -1;
+ if(H5Pclose(gcpl_id) < 0)
+ goto out;
+ gcpl_id = -1;
+ if(H5Pclose(tcpl_id) < 0)
+ goto out;
+ tcpl_id = -1;
+ if(H5Fclose(fid) < 0)
+ goto out;
+ fid = -1;
+
+
+
+ return;
+
+ out:
+ printf("Error.....\n");
+ H5E_BEGIN_TRY {
+ H5Gclose(gid);
+ H5Dclose(did);
+ H5Sclose(sid);
+ H5Pclose(gcpl_id);
+ H5Pclose(dcpl_id);
+ H5Pclose(tcpl_id);
+ H5Fclose(fid);
+
+ } H5E_END_TRY;
+ return;
+
+}
+
+/*-------------------------------------------------------------------------
+ * Function: gent_fpformat
+ *
+ * Purpose: Generate a file to be used in the floating point format test
+ * Contains:
+ * 1) a float dataset
+ * 2) a double dataset
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+gent_fpformat(void)
+{
+ hid_t fid, sid, did;
+ hsize_t dims[1] = {6};
+ double dbuf[6] = {-0.1234567f, 0.1234567f, 0, 0, 0, 0};
+ float fbuf[6] = {-0.1234567f, 0.1234567f, 0, 0, 0, 0};
+
+ fid = H5Fcreate(FILE60, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ sid = H5Screate_simple(1, dims, NULL);
+
+ /*-------------------------------------------------------------------------
+ * double
+ *-------------------------------------------------------------------------
+ */
+ did = H5Dcreate2(fid, "double", H5T_NATIVE_DOUBLE, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Dwrite(did, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dbuf);
+ H5Dclose(did);
+
+
+ /*-------------------------------------------------------------------------
+ * float
+ *-------------------------------------------------------------------------
+ */
+ did = H5Dcreate2(fid, "float", H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, fbuf);
+ H5Dclose(did);
+
+
+ /* close */
+ H5Sclose(sid);
+ H5Fclose(fid);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: gent_extlinks
+ *
+ * Purpose: Generate 3 files to be used in the external links test
+ * External links point from one HDF5 file to an object (Group, Dataset,
+ * or committed Datatype) in another file. Try to create cycles.
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+gent_extlinks(void)
+{
+ hid_t source_fid, target_fid, far_fid, sid, did, gid, gid2, tid;
+ hsize_t dims[1] = {6};
+ int buf[6] = {1, 2, 3, 4, 5, 6};
+
+ /* create two files, a source and a target */
+ source_fid = H5Fcreate(FILE61, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ target_fid = H5Fcreate(FILE62, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ far_fid = H5Fcreate(FILE63, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+
+ /*-------------------------------------------------------------------------
+ * create Groups, a Dataset, a committed Datatype, external links, and a
+ * cycle in the target
+ *-------------------------------------------------------------------------
+ */
+
+ gid = H5Gcreate2(target_fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(H5Gcreate2(target_fid, "empty_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT));
+ sid = H5Screate_simple(1, dims, NULL);
+ did = H5Dcreate2(gid, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
+ H5Lcreate_external(FILE61, "/", gid, "elink_t1", H5P_DEFAULT, H5P_DEFAULT);
+ H5Lcreate_external(FILE61, "/ext_link4", gid, "elink_t2", H5P_DEFAULT, H5P_DEFAULT);
+
+ gid2 = H5Gcreate2(gid, "subgroup", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Lcreate_hard(target_fid, "/group", gid2, "link_to_group", H5P_DEFAULT, H5P_DEFAULT);
+
+ H5Dclose(did);
+ H5Sclose(sid);
+ H5Gclose(gid2);
+ H5Gclose(gid);
+
+
+ sid = H5Screate_simple(1, dims, NULL);
+ did = H5Dcreate2(target_fid, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
+ H5Dclose(did);
+ H5Sclose(sid);
+
+ tid = H5Tcopy(H5T_NATIVE_INT);
+ H5Tcommit2(target_fid, "type", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Tclose(tid);
+
+ /*-------------------------------------------------------------------------
+ * create external links in the source file pointing to the target objects
+ *-------------------------------------------------------------------------
+ */
+
+ H5Lcreate_external(FILE62, "group", source_fid, "ext_link1", H5P_DEFAULT, H5P_DEFAULT);
+ H5Lcreate_external(FILE62, "dset", source_fid, "ext_link2", H5P_DEFAULT, H5P_DEFAULT);
+ H5Lcreate_external(FILE62, "type", source_fid, "ext_link3", H5P_DEFAULT, H5P_DEFAULT);
+ H5Lcreate_external(FILE62, "group/elink_t2", source_fid, "ext_link4", H5P_DEFAULT, H5P_DEFAULT);
+ H5Lcreate_external(FILE62, "empty_group", source_fid, "ext_link5", H5P_DEFAULT, H5P_DEFAULT);
+ /* external link to soft link which linked to a dataset */
+ H5Lcreate_external(FILE4_1, "/soft_dset1", source_fid, "ext2soft_link1", H5P_DEFAULT, H5P_DEFAULT);
+
+ /* external link to dangle soft link */
+ H5Lcreate_external(FILE4_1, "/soft_dangle", source_fid, "ext2softdangle_link1", H5P_DEFAULT, H5P_DEFAULT);
+
+ /*-------------------------------------------------------------------------
+ * create external link in the "far" file pointing to the source file
+ *-------------------------------------------------------------------------
+ */
+ H5Lcreate_external(FILE61, "/", far_fid, "src_file", H5P_DEFAULT, H5P_DEFAULT);
+
+ /* close */
+ H5Fclose(source_fid);
+ H5Fclose(target_fid);
+ H5Fclose(far_fid);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: gent_fs_strategy_threshold
+ *
+ * Purpose: Generate a file with non-default file space strategy and
+ * non-default free-space section threshold.
+ *-------------------------------------------------------------------------
+ */
+static void
+gent_fs_strategy_threshold(void)
+{
+ hid_t fid; /* File id */
+ hid_t fcpl; /* File creation property */
+
+ /* Create file-creation template */
+ fcpl = H5Pcreate(H5P_FILE_CREATE);
+
+ /* Set file space information */
+ H5Pset_file_space(fcpl, STRATEGY, (hsize_t)THRESHOLD10);
+
+ /* Create the file with the specified strategy and threshold */
+ fid = H5Fcreate(FILE65, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT);
+
+ /* close */
+ H5Fclose(fid);
+ H5Pclose(fcpl);
+}
+
+/*
+ * Create a file with new format:
+ * Create one dataset with (set_chunk, fixed dims, null max. dims)
+ * so that Fixed Array indexing will be used.
+ * Create one dataset with (set_chunk, fixed dims, null max. dims, filter)
+ * so that Fixed Array indexing will be used.
+ * Create one dataset with (set_chunk, fixed dims, fixed max. dims)
+ * so that Fixed Array indexing will be used.
+ *
+ * Modifications:
+ * Fixed Array indexing will be used for chunked dataset
+ * with fixed max. dims setting.
+ *
+ */
+static void
+gent_dataset_idx(void)
+{
+ hid_t fid, space, dcpl, fapl;
+ hsize_t dims[2];
+ hsize_t maxdims[2];
+ int buf[20][10];
+ int i, j, ret;
+
+ /* Get a copy of the file aaccess property */
+ fapl = H5Pcreate(H5P_FILE_ACCESS);
+
+ /* Set the "use the latest version of the format" bounds for creating objects in the file */
+ ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST);
+ assert(ret >= 0);
+
+ fid = H5Fcreate(FILE68a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
+ dcpl = H5Pcreate(H5P_DATASET_CREATE);
+
+ dims[0] = F68a_CHUNK;
+ dims[1] = F68a_CHUNK;
+
+ /* set chunk */
+ ret = H5Pset_chunk(dcpl, RANK, dims);
+ assert(ret >= 0);
+
+ /* dataset with fixed dimensions */
+ dims[0] = F68a_DIM20;
+ dims[1] = F68a_DIM10;
+ space = H5Screate_simple(RANK, dims, NULL);
+
+ for(i = 0; i < F68a_DIM20; i++)
+ for(j = 0; j < F68a_DIM10; j++)
+ buf[i][j] = j;
+
+ ret = make_dset(fid, F68a_DSET_FIXED, space, H5T_NATIVE_INT, dcpl, buf);
+ assert(ret >= 0);
+ H5Sclose(space);
+
+ /* dataset with non-fixed dimensions */
+ maxdims[0] = F68a_DIM200;
+ maxdims[1] = F68a_DIM100;
+ space = H5Screate_simple(RANK, dims, maxdims);
+
+ ret = make_dset(fid, F68a_DSET_BTREE, space, H5T_NATIVE_INT, dcpl, buf);
+ assert(ret >= 0);
+ H5Sclose(space);
+
+#if defined (H5_HAVE_FILTER_DEFLATE)
+
+ /* dataset with fixed dimensions and filters */
+ /* remove the filters from the dcpl */
+ ret = H5Premove_filter(dcpl, H5Z_FILTER_ALL);
+ assert(ret >= 0);
+
+ /* set deflate data */
+ ret = H5Pset_deflate(dcpl, 9);
+ assert(ret >= 0);
+
+ space = H5Screate_simple(RANK, dims, NULL);
+ ret = make_dset(fid, F68a_DSET_FIXED_FILTER, space, H5T_NATIVE_INT, dcpl, buf);
+ assert(ret >= 0);
+
+ H5Sclose(space);
+#endif
+
+ H5Pclose(dcpl);
+ H5Fclose(fid);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: gent_packedbits
+ *
+ * Purpose: Generate a file to be used in the h5dump packed bits tests.
+ * Four datasets of 1, 2, 4 and 8 bytes of unsigned int types are created.
+ * Four more datasets of 1, 2, 4 and 8 bytes of signed int types are created.
+ * Fill them with raw data such that no bit will be all zero in a dataset.
+ * A dummy dataset of double type is created for failure test.
+ * Created: Albert Cheng, 2010/5/10.
+ * Modified: Allen Byrne, 2011/1/5 Use file to test Signed/Unsigned datatypes
+ *-------------------------------------------------------------------------
+ */
+static void
+gent_packedbits(void)
+{
+ hid_t fid, dataset, space;
+ hsize_t dims[2];
+ uint8_t dsetu8[F66_XDIM][F66_YDIM8], valu8bits;
+ uint16_t dsetu16[F66_XDIM][F66_YDIM16], valu16bits;
+ uint32_t dsetu32[F66_XDIM][F66_YDIM32], valu32bits;
+ uint64_t dsetu64[F66_XDIM][F66_YDIM64], valu64bits;
+ int8_t dset8[F66_XDIM][F66_YDIM8], val8bits;
+ int16_t dset16[F66_XDIM][F66_YDIM16], val16bits;
+ int32_t dset32[F66_XDIM][F66_YDIM32], val32bits;
+ int64_t dset64[F66_XDIM][F66_YDIM64], val64bits;
+ double dsetdbl[F66_XDIM][F66_YDIM8];
+ unsigned int i, j;
+
+ fid = H5Fcreate(FILE66, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Dataset of 8 bits unsigned int */
+ dims[0] = F66_XDIM; dims[1] = F66_YDIM8;
+ space = H5Screate_simple(2, dims, NULL);
+ dataset = H5Dcreate2(fid, F66_DATASETU08, H5T_STD_U8LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ valu8bits = (uint8_t) ~0u; /* all 1s */
+ for(i = 0; i < dims[0]; i++){
+ dsetu8[i][0] = valu8bits;
+ for(j = 1; j < dims[1]; j++)
+ dsetu8[i][j] = (uint8_t)(dsetu8[i][j - 1] << 1);
+ valu8bits = (uint8_t)(valu8bits << 1);
+ }
+
+ H5Dwrite(dataset, H5T_NATIVE_UINT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu8);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+ /* Dataset of 16 bits unsigned int */
+ dims[0] = F66_XDIM; dims[1] = F66_YDIM16;
+ space = H5Screate_simple(2, dims, NULL);
+ dataset = H5Dcreate2(fid, F66_DATASETU16, H5T_STD_U16LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ valu16bits = (uint16_t) ~0u; /* all 1s */
+ for(i = 0; i < dims[0]; i++){
+ dsetu16[i][0] = valu16bits;
+ for(j = 1; j < dims[1]; j++)
+ dsetu16[i][j] = (uint16_t)(dsetu16[i][j-1] << 1);
+ valu16bits = (uint16_t)(valu16bits << 1);
+ }
+
+ H5Dwrite(dataset, H5T_NATIVE_UINT16, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu16);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+ /* Dataset of 32 bits unsigned int */
+ dims[0] = F66_XDIM; dims[1] = F66_YDIM32;
+ space = H5Screate_simple(2, dims, NULL);
+ dataset = H5Dcreate2(fid, F66_DATASETU32, H5T_STD_U32LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ valu32bits = (uint32_t) ~0u; /* all 1s */
+ for(i = 0; i < dims[0]; i++){
+ dsetu32[i][0] = valu32bits;
+ for(j = 1; j < dims[1]; j++)
+ dsetu32[i][j] = dsetu32[i][j-1] << 1;
+ valu32bits <<= 1;
+ }
+
+ H5Dwrite(dataset, H5T_NATIVE_UINT32, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu32);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+ /* Dataset of 64 bits unsigned int */
+ dims[0] = F66_XDIM; dims[1] = F66_YDIM64;
+ space = H5Screate_simple(2, dims, NULL);
+ dataset = H5Dcreate2(fid, F66_DATASETU64, H5T_STD_U64LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ valu64bits = (uint64_t) ~0Lu; /* all 1s */
+ for(i = 0; i < dims[0]; i++){
+ dsetu64[i][0] = valu64bits;
+ for(j = 1; j < dims[1]; j++)
+ dsetu64[i][j] = dsetu64[i][j-1] << 1;
+ valu64bits <<= 1;
+ }
+
+ H5Dwrite(dataset, H5T_NATIVE_UINT64, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu64);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+ /* Dataset of 8 bits signed int */
+ dims[0] = F66_XDIM; dims[1] = F66_YDIM8;
+ space = H5Screate_simple(2, dims, NULL);
+ dataset = H5Dcreate2(fid, F66_DATASETS08, H5T_STD_I8LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ val8bits = (int8_t) ~0; /* all 1s */
+ for(i = 0; i < dims[0]; i++){
+ dset8[i][0] = val8bits;
+ for(j = 1; j < dims[1]; j++)
+ dset8[i][j] = (int8_t)(dset8[i][j-1] << 1);
+ val8bits = (int8_t)(val8bits << 1);
+ }
+
+ H5Dwrite(dataset, H5T_NATIVE_INT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset8);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+ /* Dataset of 16 bits signed int */
+ dims[0] = F66_XDIM; dims[1] = F66_YDIM16;
+ space = H5Screate_simple(2, dims, NULL);
+ dataset = H5Dcreate2(fid, F66_DATASETS16, H5T_STD_I16LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ val16bits = (int16_t) ~0; /* all 1s */
+ for(i = 0; i < dims[0]; i++){
+ dset16[i][0] = val16bits;
+ for(j = 1; j < dims[1]; j++)
+ dset16[i][j] = (int16_t)(dset16[i][j-1] << 1);
+ val16bits = (int16_t)(val16bits << 1);
+ }
+
+ H5Dwrite(dataset, H5T_NATIVE_INT16, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset16);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+ /* Dataset of 32 bits signed int */
+ dims[0] = F66_XDIM; dims[1] = F66_YDIM32;
+ space = H5Screate_simple(2, dims, NULL);
+ dataset = H5Dcreate2(fid, F66_DATASETS32, H5T_STD_I32LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ val32bits = (int32_t) ~0; /* all 1s */
+ for(i = 0; i < dims[0]; i++){
+ dset32[i][0] = val32bits;
+ for(j = 1; j < dims[1]; j++)
+ dset32[i][j] = dset32[i][j-1] << 1;
+ val32bits <<= 1;
+ }
+
+ H5Dwrite(dataset, H5T_NATIVE_INT32, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset32);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+ /* Dataset of 64 bits signed int */
+ dims[0] = F66_XDIM; dims[1] = F66_YDIM64;
+ space = H5Screate_simple(2, dims, NULL);
+ dataset = H5Dcreate2(fid, F66_DATASETS64, H5T_STD_I64LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ val64bits = (int64_t) ~0L; /* all 1s */
+ for(i = 0; i < dims[0]; i++){
+ dset64[i][0] = val64bits;
+ for(j = 1; j < dims[1]; j++)
+ dset64[i][j] = dset64[i][j-1] << 1;
+ val64bits <<= 1;
+ }
+
+ H5Dwrite(dataset, H5T_NATIVE_INT64, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset64);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+ /* Double Dummy set for failure tests */
+ dims[0] = F66_XDIM; dims[1] = F66_YDIM8;
+ space = H5Screate_simple(2, dims, NULL);
+ dataset = H5Dcreate2(fid, F66_DUMMYDBL, H5T_IEEE_F64BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ for(i = 0; i < dims[0]; i++)
+ for(j = 0; j < dims[1]; j++)
+ dsetdbl[i][j] = 0.0001F * (float)j + (float)i;
+
+ H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetdbl);
+
+ H5Sclose(space);
+ H5Dclose(dataset);
+ H5Fclose(fid);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: gent_attr_packedbits
+ *
+ * Purpose: Generate a file to be used in the h5dump packed bits tests.
+ * Four attributes of 1, 2, 4 and 8 bytes of unsigned int types are created.
+ * Four more datasets of 1, 2, 4 and 8 bytes of signed int types are created.
+ * Fill them with raw data such that no bit will be all zero in a dataset.
+ * A dummy dataset of double type is created for failure test.
+ * Use file to test Signed/Unsigned datatypes and keep in sync with gent_packedbits()
+ *-------------------------------------------------------------------------
+ */
+static void
+gent_attr_intsize(void)
+{
+ hid_t fid, attr, space, root;
+ hsize_t dims[2];
+ uint8_t dsetu8[F66_XDIM][F66_YDIM8], valu8bits;
+ uint16_t dsetu16[F66_XDIM][F66_YDIM16], valu16bits;
+ uint32_t dsetu32[F66_XDIM][F66_YDIM32], valu32bits;
+ uint64_t dsetu64[F66_XDIM][F66_YDIM64], valu64bits;
+ int8_t dset8[F66_XDIM][F66_YDIM8], val8bits;
+ int16_t dset16[F66_XDIM][F66_YDIM16], val16bits;
+ int32_t dset32[F66_XDIM][F66_YDIM32], val32bits;
+ int64_t dset64[F66_XDIM][F66_YDIM64], val64bits;
+ double dsetdbl[F66_XDIM][F66_YDIM8];
+ unsigned int i, j;
+
+ fid = H5Fcreate(FILE69, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ root = H5Gopen2(fid, "/", H5P_DEFAULT);
+
+ /* Attribute of 8 bits unsigned int */
+ dims[0] = F66_XDIM; dims[1] = F66_YDIM8;
+ space = H5Screate_simple(2, dims, NULL);
+ attr = H5Acreate2(root, F66_DATASETU08, H5T_STD_U8LE, space, H5P_DEFAULT, H5P_DEFAULT);
+
+ valu8bits = (uint8_t) ~0u; /* all 1s */
+ for(i = 0; i < dims[0]; i++){
+ dsetu8[i][0] = valu8bits;
+ for(j = 1; j < dims[1]; j++) {
+ dsetu8[i][j] = (uint8_t)(dsetu8[i][j-1] << 1);
+ }
+ valu8bits = (uint8_t)(valu8bits << 1);
+ }
+
+ H5Awrite(attr, H5T_NATIVE_UINT8, dsetu8);
+ H5Sclose(space);
+ H5Aclose(attr);
+
+ /* Attribute of 16 bits unsigned int */
+ dims[0] = F66_XDIM; dims[1] = F66_YDIM16;
+ space = H5Screate_simple(2, dims, NULL);
+ attr = H5Acreate2(root, F66_DATASETU16, H5T_STD_U16LE, space, H5P_DEFAULT, H5P_DEFAULT);
+
+ valu16bits = (uint16_t) ~0u; /* all 1s */
+ for(i = 0; i < dims[0]; i++){
+ dsetu16[i][0] = valu16bits;
+ for(j = 1; j < dims[1]; j++) {
+ dsetu16[i][j] = (uint16_t)(dsetu16[i][j-1] << 1);
+ }
+ valu16bits = (uint16_t)(valu16bits << 1);
+ }
+
+ H5Awrite(attr, H5T_NATIVE_UINT16, dsetu16);
+ H5Sclose(space);
+ H5Aclose(attr);
+
+ /* Attribute of 32 bits unsigned int */
+ dims[0] = F66_XDIM; dims[1] = F66_YDIM32;
+ space = H5Screate_simple(2, dims, NULL);
+ attr = H5Acreate2(root, F66_DATASETU32, H5T_STD_U32LE, space, H5P_DEFAULT, H5P_DEFAULT);
+
+ valu32bits = (uint32_t) ~0u; /* all 1s */
+ for(i = 0; i < dims[0]; i++){
+ dsetu32[i][0] = valu32bits;
+ for(j = 1; j < dims[1]; j++) {
+ dsetu32[i][j] = dsetu32[i][j-1] << 1;
+ }
+ valu32bits <<= 1;
+ }
+
+ H5Awrite(attr, H5T_NATIVE_UINT32, dsetu32);
+ H5Sclose(space);
+ H5Aclose(attr);
+
+ /* Attribute of 64 bits unsigned int */
+ dims[0] = F66_XDIM; dims[1] = F66_YDIM64;
+ space = H5Screate_simple(2, dims, NULL);
+ attr = H5Acreate2(root, F66_DATASETU64, H5T_STD_U64LE, space, H5P_DEFAULT, H5P_DEFAULT);
+
+ valu64bits = (uint64_t) ~0Lu; /* all 1s */
+ for(i = 0; i < dims[0]; i++){
+ dsetu64[i][0] = valu64bits;
+ for(j = 1; j < dims[1]; j++) {
+ dsetu64[i][j] = dsetu64[i][j-1] << 1;
+ }
+ valu64bits <<= 1;
+ }
+
+ H5Awrite(attr, H5T_NATIVE_UINT64, dsetu64);
+ H5Sclose(space);
+ H5Aclose(attr);
+
+ /* Attribute of 8 bits signed int */
+ dims[0] = F66_XDIM; dims[1] = F66_YDIM8;
+ space = H5Screate_simple(2, dims, NULL);
+ attr = H5Acreate2(root, F66_DATASETS08, H5T_STD_I8LE, space, H5P_DEFAULT, H5P_DEFAULT);
+
+ val8bits = (int8_t) ~0; /* all 1s */
+ for(i = 0; i < dims[0]; i++){
+ dset8[i][0] = val8bits;
+ for(j = 1; j < dims[1]; j++) {
+ dset8[i][j] = (int8_t)(dset8[i][j-1] << 1);
+ }
+ val8bits = (int8_t)(val8bits << 1);
+ }
+
+ H5Awrite(attr, H5T_NATIVE_INT8, dset8);
+ H5Sclose(space);
+ H5Aclose(attr);
+
+ /* Attribute of 16 bits signed int */
+ dims[0] = F66_XDIM; dims[1] = F66_YDIM16;
+ space = H5Screate_simple(2, dims, NULL);
+ attr = H5Acreate2(root, F66_DATASETS16, H5T_STD_I16LE, space, H5P_DEFAULT, H5P_DEFAULT);
+
+ val16bits = (int16_t) ~0; /* all 1s */
+ for(i = 0; i < dims[0]; i++){
+ dset16[i][0] = val16bits;
+ for(j = 1; j < dims[1]; j++) {
+ dset16[i][j] = (int16_t)(dset16[i][j-1] << 1);
+ }
+ val16bits = (int16_t)(val16bits << 1);
+ }
+
+ H5Awrite(attr, H5T_NATIVE_INT16, dset16);
+ H5Sclose(space);
+ H5Aclose(attr);
+
+ /* Attribute of 32 bits signed int */
+ dims[0] = F66_XDIM; dims[1] = F66_YDIM32;
+ space = H5Screate_simple(2, dims, NULL);
+ attr = H5Acreate2(root, F66_DATASETS32, H5T_STD_I32LE, space, H5P_DEFAULT, H5P_DEFAULT);
+
+ val32bits = (int32_t) ~0; /* all 1s */
+ for(i = 0; i < dims[0]; i++){
+ dset32[i][0] = val32bits;
+ for(j = 1; j < dims[1]; j++) {
+ dset32[i][j] = dset32[i][j-1] << 1;
+ }
+ val32bits <<= 1;
+ }
+
+ H5Awrite(attr, H5T_NATIVE_INT32, dset32);
+ H5Sclose(space);
+ H5Aclose(attr);
+
+ /* Attribute of 64 bits signed int */
+ dims[0] = F66_XDIM; dims[1] = F66_YDIM64;
+ space = H5Screate_simple(2, dims, NULL);
+ attr = H5Acreate2(root, F66_DATASETS64, H5T_STD_I64LE, space, H5P_DEFAULT, H5P_DEFAULT);
+
+ val64bits = (int64_t) ~0L; /* all 1s */
+ for(i = 0; i < dims[0]; i++){
+ dset64[i][0] = val64bits;
+ for(j = 1; j < dims[1]; j++) {
+ dset64[i][j] = dset64[i][j-1] << 1;
+ }
+ val64bits <<= 1;
+ }
+
+ H5Awrite(attr, H5T_NATIVE_INT64, dset64);
+ H5Sclose(space);
+ H5Aclose(attr);
+
+ /* Double Dummy set for failure tests */
+ dims[0] = F66_XDIM; dims[1] = F66_YDIM8;
+ space = H5Screate_simple(2, dims, NULL);
+ attr = H5Acreate2(root, F66_DUMMYDBL, H5T_IEEE_F64BE, space, H5P_DEFAULT, H5P_DEFAULT);
+
+ for(i = 0; i < dims[0]; i++)
+ for(j = 0; j < dims[1]; j++)
+ dsetdbl[i][j] = 0.0001F * (float)j + (float)i;
+
+ H5Awrite(attr, H5T_NATIVE_DOUBLE, dsetdbl);
+
+ H5Sclose(space);
+ H5Aclose(attr);
+
+ H5Gclose(root);
+ H5Fclose(fid);
+}
+
+/*-------------------------------------------------------------------------
+ * 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;
+
+ hid_t charset_dtid = H5Tcreate( H5T_COMPOUND, sizeof( CharSetInfo ) );
+ hid_t ascii_dtid = H5Tcreate( H5T_STRING, H5T_VARIABLE );
+ hid_t utf8_dtid = H5Tcreate( H5T_STRING, H5T_VARIABLE );
+ const char * writeData[] = { "ascii", "utf8", };
+
+ sid = H5Screate_simple( 1, dim, NULL );
+ fid = H5Fcreate( FILE68, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT );
+ status = H5Tset_cset( ascii_dtid, H5T_CSET_ASCII );
+ HDassert(status >= 0);
+ H5Tinsert( charset_dtid, "ascii", HOFFSET(CharSetInfo, ascii_p_ ), ascii_dtid );
+
+ status = H5Tset_cset( utf8_dtid, H5T_CSET_UTF8 );
+ HDassert(status >= 0);
+ H5Tinsert( charset_dtid, "utf8", HOFFSET( CharSetInfo, utf8_p_ ), utf8_dtid );
+
+ did = H5Dcreate2( fid, "CharSets", charset_dtid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT );
+
+ status = H5Dwrite( did, charset_dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, writeData );
+ HDassert(status >= 0);
+
+ H5Tclose( charset_dtid );
+ H5Tclose( ascii_dtid );
+ H5Tclose( utf8_dtid );
+ H5Sclose( sid );
+ H5Dclose( did );
+ H5Fclose( fid );
+}
+
+static void gent_compound_intsizes(void) {
+ hid_t fid, dataset, space;
+ hsize_t dims[2];
+ hsize_t array_dim8[]={F70_XDIM,F70_YDIM8}; /* Array dimensions */
+ hsize_t array_dim16[]={F70_XDIM,F70_YDIM16}; /* Array dimensions */
+ hsize_t array_dim32[]={F70_XDIM,F70_YDIM32}; /* Array dimensions */
+ hsize_t array_dim64[]={F70_XDIM,F70_YDIM64}; /* Array dimensions */
+ hid_t arrayu8_tid; /* Array datatype handle */
+ hid_t arrayu16_tid; /* Array datatype handle */
+ hid_t arrayu32_tid; /* Array datatype handle */
+ hid_t arrayu64_tid; /* Array datatype handle */
+ hid_t array8_tid; /* Array datatype handle */
+ hid_t array16_tid; /* Array datatype handle */
+ hid_t array32_tid; /* Array datatype handle */
+ hid_t array64_tid; /* Array datatype handle */
+ hid_t arraydbl_tid; /* Array datatype handle */
+ uint8_t valu8bits;
+ uint16_t valu16bits;
+ uint32_t valu32bits;
+ uint64_t valu64bits;
+ int8_t val8bits;
+ int16_t val16bits;
+ int32_t val32bits;
+ int64_t val64bits;
+ /* Structure and array for compound types */
+ typedef struct Array1Struct {
+ uint8_t dsetu8[F70_XDIM][F70_YDIM8];
+ uint16_t dsetu16[F70_XDIM][F70_YDIM16];
+ uint32_t dsetu32[F70_XDIM][F70_YDIM32];
+ uint64_t dsetu64[F70_XDIM][F70_YDIM64];
+ int8_t dset8[F70_XDIM][F70_YDIM8];
+ int16_t dset16[F70_XDIM][F70_YDIM16];
+ int32_t dset32[F70_XDIM][F70_YDIM32];
+ int64_t dset64[F70_XDIM][F70_YDIM64];
+ double dsetdbl[F70_XDIM][F70_YDIM8];
+ } Array1Struct;
+ Array1Struct *Array1;
+
+ hid_t Array1Structid; /* File datatype identifier */
+ herr_t status; /* Error checking variable */
+ hsize_t dim[] = { F70_LENGTH }; /* Dataspace dimensions */
+
+ int m, n, o; /* Array init loop vars */
+
+ /* Allocate buffer */
+ Array1 = (Array1Struct *)HDmalloc(sizeof(Array1Struct) * F70_LENGTH);
+ HDassert(Array1);
+
+ /* Initialize the data in the arrays/datastructure */
+ for (m = 0; m < F70_LENGTH; m++) {
+
+ /* Array of 8 bits unsigned int */
+ dims[0] = F70_XDIM; dims[1] = F70_YDIM8;
+
+ valu8bits = (uint8_t) ~0u; /* all 1s */
+ for(n = 0; n < (int)dims[0]; n++){
+ Array1[m].dsetu8[n][0] = valu8bits;
+ for(o = 1; o < (int)dims[1]; o++)
+ Array1[m].dsetu8[n][o] = (uint8_t)(Array1[m].dsetu8[n][o-1] << 1);
+ valu8bits = (uint8_t)(valu8bits << 1);
+ }
+
+ /* Array of 16 bits unsigned int */
+ dims[0] = F70_XDIM; dims[1] = F70_YDIM16;
+
+ valu16bits = (uint16_t) ~0u; /* all 1s */
+ for(n = 0; n < (int)dims[0]; n++){
+ Array1[m].dsetu16[n][0] = valu16bits;
+ for(o = 1; o < (int)dims[1]; o++)
+ Array1[m].dsetu16[n][o] = (uint16_t)(Array1[m].dsetu16[n][o-1] << 1);
+ valu16bits = (uint16_t)(valu16bits << 1);
+ }
+
+ /* Array of 32 bits unsigned int */
+ dims[0] = F70_XDIM; dims[1] = F70_YDIM32;
+
+ valu32bits = (uint32_t) ~0u; /* all 1s */
+ for(n = 0; n < (int)dims[0]; n++){
+ Array1[m].dsetu32[n][0] = valu32bits;
+ for(o = 1; o < (int)dims[1]; o++)
+ Array1[m].dsetu32[n][o] = Array1[m].dsetu32[n][o-1] << 1;
+ valu32bits <<= 1;
+ }
+
+ /* Array of 64 bits unsigned int */
+ dims[0] = F70_XDIM; dims[1] = F70_YDIM64;
+
+ valu64bits = (uint64_t) ~0Lu; /* all 1s */
+ for(n = 0; n < (int)dims[0]; n++){
+ Array1[m].dsetu64[n][0] = valu64bits;
+ for(o = 1; o < (int)dims[1]; o++)
+ Array1[m].dsetu64[n][o] = Array1[m].dsetu64[n][o-1] << 1;
+ valu64bits <<= 1;
+ }
+
+ /* Array of 8 bits signed int */
+ dims[0] = F70_XDIM; dims[1] = F70_YDIM8;
+
+ val8bits = (int8_t) ~0; /* all 1s */
+ for(n = 0; n < (int)dims[0]; n++){
+ Array1[m].dset8[n][0] = val8bits;
+ for(o = 1; o < (int)dims[1]; o++)
+ Array1[m].dset8[n][o] = (int8_t)(Array1[m].dset8[n][o-1] << 1);
+ val8bits = (int8_t)(val8bits << 1);
+ }
+
+ /* Array of 16 bits signed int */
+ dims[0] = F70_XDIM; dims[1] = F70_YDIM16;
+
+ val16bits = (int16_t) ~0; /* all 1s */
+ for(n = 0; n < (int)dims[0]; n++){
+ Array1[m].dset16[n][0] = val16bits;
+ for(o = 1; o < (int)dims[1]; o++)
+ Array1[m].dset16[n][o] = (int16_t)(Array1[m].dset16[n][o-1] << 1);
+ val16bits = (int16_t)(val16bits << 1);
+ }
+
+ /* Array of 32 bits signed int */
+ dims[0] = F70_XDIM; dims[1] = F70_YDIM32;
+
+ val32bits = (int32_t) ~0; /* all 1s */
+ for(n = 0; n < (int)dims[0]; n++){
+ Array1[m].dset32[n][0] = val32bits;
+ for(o = 1; o < (int)dims[1]; o++)
+ Array1[m].dset32[n][o] = Array1[m].dset32[n][o-1] << 1;
+ val32bits <<= 1;
+ }
+
+ /* Array of 64 bits signed int */
+ dims[0] = F70_XDIM; dims[1] = F70_YDIM64;
+
+ val64bits = (int64_t) ~0L; /* all 1s */
+ for(n = 0; n < (int)dims[0]; n++){
+ Array1[m].dset64[n][0] = val64bits;
+ for(o = 1; o < (int)dims[1]; o++)
+ Array1[m].dset64[n][o] = Array1[m].dset64[n][o-1] << 1;
+ val64bits <<= 1;
+ }
+
+ /* Double Dummy set for failure tests */
+ dims[0] = F70_XDIM; dims[1] = F70_YDIM8;
+
+ for(n = 0; n < (int)dims[0]; n++)
+ for(o = 0; o < (int)dims[1]; o++)
+ Array1[m].dsetdbl[n][o] = 0.0001F * (float)o + (float)n;
+ }
+
+ /* Create the array data type for the 8 bits signed int array */
+ array8_tid = H5Tarray_create2(H5T_NATIVE_SCHAR, F70_ARRAY_RANK, array_dim8);
+ HDassert(array8_tid >= 0);
+
+ /* Create the array data type for the 16 bits signed int array */
+ array16_tid = H5Tarray_create2(H5T_NATIVE_SHORT, F70_ARRAY_RANK, array_dim16);
+ HDassert(array16_tid >= 0);
+
+ /* Create the array data type for the 32 bits signed int array */
+ array32_tid = H5Tarray_create2(H5T_NATIVE_INT, F70_ARRAY_RANK, array_dim32);
+ HDassert(array32_tid >= 0);
+
+ /* Create the array data type for the 64 bits signed int array */
+ array64_tid = H5Tarray_create2(H5T_NATIVE_LONG, F70_ARRAY_RANK, array_dim64);
+ HDassert(array64_tid >= 0);
+
+ /* Create the array data type for the 8 bits signed int array */
+ arrayu8_tid = H5Tarray_create2(H5T_NATIVE_UCHAR, F70_ARRAY_RANK, array_dim8);
+ HDassert(arrayu8_tid >= 0);
+
+ /* Create the array data type for the 16 bits signed int array */
+ arrayu16_tid = H5Tarray_create2(H5T_NATIVE_USHORT, F70_ARRAY_RANK, array_dim16);
+ HDassert(arrayu16_tid >= 0);
+
+ /* Create the array data type for the 32 bits signed int array */
+ arrayu32_tid = H5Tarray_create2(H5T_NATIVE_UINT, F70_ARRAY_RANK, array_dim32);
+ HDassert(arrayu32_tid >= 0);
+
+ /* Create the array data type for the 64 bits signed int array */
+ arrayu64_tid = H5Tarray_create2(H5T_NATIVE_ULONG, F70_ARRAY_RANK, array_dim64);
+ HDassert(arrayu64_tid >= 0);
+
+ /* Create the array data type for the 32 bits double array */
+ arraydbl_tid = H5Tarray_create2(H5T_NATIVE_DOUBLE, F70_ARRAY_RANK, array_dim8);
+ HDassert(arraydbl_tid >= 0);
+
+ /* Create the dataspace */
+ space = H5Screate_simple(F70_RANK, dim, NULL);
+ HDassert(space >= 0);
+
+ /* Create the file */
+ fid = H5Fcreate(FILE70, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ HDassert(fid >= 0);
+
+ /* Create the memory data type */
+ Array1Structid = H5Tcreate(H5T_COMPOUND, sizeof(Array1Struct));
+ HDassert(Array1Structid >= 0);
+
+ /* Insert the arrays and variables into the structure */
+ status = H5Tinsert(Array1Structid, F70_DATASETU08, HOFFSET(Array1Struct, dsetu8), arrayu8_tid);
+ HDassert(status >= 0);
+
+ status = H5Tinsert(Array1Structid, F70_DATASETU16, HOFFSET(Array1Struct, dsetu16), arrayu16_tid);
+ HDassert(status >= 0);
+
+ status = H5Tinsert(Array1Structid, F70_DATASETU32, HOFFSET(Array1Struct, dsetu32), arrayu32_tid);
+ HDassert(status >= 0);
+
+ status = H5Tinsert(Array1Structid, F70_DATASETU64, HOFFSET(Array1Struct, dsetu64), arrayu64_tid);
+ HDassert(status >= 0);
+
+ status = H5Tinsert(Array1Structid, F70_DATASETS08, HOFFSET(Array1Struct, dset8), array8_tid);
+ HDassert(status >= 0);
+
+ status = H5Tinsert(Array1Structid, F70_DATASETS16, HOFFSET(Array1Struct, dset16), array16_tid);
+ HDassert(status >= 0);
+
+ status = H5Tinsert(Array1Structid, F70_DATASETS32, HOFFSET(Array1Struct, dset32), array32_tid);
+ HDassert(status >= 0);
+
+ status = H5Tinsert(Array1Structid, F70_DATASETS64, HOFFSET(Array1Struct, dset64), array64_tid);
+ HDassert(status >= 0);
+
+ status = H5Tinsert(Array1Structid, F70_DUMMYDBL, HOFFSET(Array1Struct, dsetdbl), arraydbl_tid);
+ HDassert(status >= 0);
+
+ /* Create the dataset */
+ dataset = H5Dcreate2(fid, F70_DATASETNAME, Array1Structid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Write data to the dataset */
+ status = H5Dwrite(dataset, Array1Structid, H5S_ALL, H5S_ALL, H5P_DEFAULT, Array1);
+ HDassert(status >= 0);
+
+ /* Release resources */
+ status = H5Tclose(Array1Structid);
+ HDassert(status >= 0);
+
+ status = H5Tclose(arrayu8_tid);
+ HDassert(status >= 0);
+
+ status = H5Tclose(arrayu16_tid);
+ HDassert(status >= 0);
+
+ status = H5Tclose(arrayu32_tid);
+ HDassert(status >= 0);
+
+ status = H5Tclose(arrayu64_tid);
+ HDassert(status >= 0);
+
+ status = H5Tclose(array8_tid);
+ HDassert(status >= 0);
+
+ status = H5Tclose(array16_tid);
+ HDassert(status >= 0);
+
+ status = H5Tclose(array32_tid);
+ HDassert(status >= 0);
+
+ status = H5Tclose(array64_tid);
+ HDassert(status >= 0);
+
+ status = H5Tclose(arraydbl_tid);
+ HDassert(status >= 0);
+
+ status = H5Sclose(space);
+ HDassert(status >= 0);
+
+ status = H5Dclose(dataset);
+ HDassert(status >= 0);
+
+ status = H5Fclose(fid);
+ HDassert(status >= 0);
+
+ HDfree(Array1);
+}
+
+static void gent_compound_attr_intsizes(void) {
+ hid_t fid, attr, space, root;
+ hsize_t dims[2];
+ hsize_t array_dim8[]={F70_XDIM,F70_YDIM8}; /* Array dimensions */
+ hsize_t array_dim16[]={F70_XDIM,F70_YDIM16}; /* Array dimensions */
+ hsize_t array_dim32[]={F70_XDIM,F70_YDIM32}; /* Array dimensions */
+ hsize_t array_dim64[]={F70_XDIM,F70_YDIM64}; /* Array dimensions */
+ hid_t arrayu8_tid; /* Array datatype handle */
+ hid_t arrayu16_tid; /* Array datatype handle */
+ hid_t arrayu32_tid; /* Array datatype handle */
+ hid_t arrayu64_tid; /* Array datatype handle */
+ hid_t array8_tid; /* Array datatype handle */
+ hid_t array16_tid; /* Array datatype handle */
+ hid_t array32_tid; /* Array datatype handle */
+ hid_t array64_tid; /* Array datatype handle */
+ hid_t arraydbl_tid; /* Array datatype handle */
+ uint8_t valu8bits;
+ uint16_t valu16bits;
+ uint32_t valu32bits;
+ uint64_t valu64bits;
+ int8_t val8bits;
+ int16_t val16bits;
+ int32_t val32bits;
+ int64_t val64bits;
+ /* Structure and array for compound types */
+ typedef struct Array1Struct {
+ uint8_t dsetu8[F70_XDIM][F70_YDIM8];
+ uint16_t dsetu16[F70_XDIM][F70_YDIM16];
+ uint32_t dsetu32[F70_XDIM][F70_YDIM32];
+ uint64_t dsetu64[F70_XDIM][F70_YDIM64];
+ int8_t dset8[F70_XDIM][F70_YDIM8];
+ int16_t dset16[F70_XDIM][F70_YDIM16];
+ int32_t dset32[F70_XDIM][F70_YDIM32];
+ int64_t dset64[F70_XDIM][F70_YDIM64];
+ double dsetdbl[F70_XDIM][F70_YDIM8];
+ } Array1Struct;
+ Array1Struct Array1[F70_LENGTH];
+
+ hid_t Array1Structid; /* File datatype identifier */
+ herr_t status; /* Error checking variable */
+ hsize_t dim[] = { F70_LENGTH }; /* Dataspace dimensions */
+
+ int m, n, o; /* Array init loop vars */
+
+ /* Initialize the data in the arrays/datastructure */
+ for (m = 0; m < F70_LENGTH; m++) {
+
+ /* Array of 8 bits unsigned int */
+ dims[0] = F70_XDIM; dims[1] = F70_YDIM8;
+
+ valu8bits = (uint8_t) ~0u; /* all 1s */
+ for(n = 0; n < (int)dims[0]; n++){
+ Array1[m].dsetu8[n][0] = valu8bits;
+ for(o = 1; o < (int)dims[1]; o++) {
+ Array1[m].dsetu8[n][o] = (uint8_t)(Array1[m].dsetu8[n][o-1] << 1);
+ }
+ valu8bits = (uint8_t)(valu8bits << 1);
+ }
+
+ /* Array of 16 bits unsigned int */
+ dims[0] = F70_XDIM; dims[1] = F70_YDIM16;
+
+ valu16bits = (uint16_t) ~0u; /* all 1s */
+ for(n = 0; n < (int)dims[0]; n++){
+ Array1[m].dsetu16[n][0] = valu16bits;
+ for(o = 1; o < (int)dims[1]; o++) {
+ Array1[m].dsetu16[n][o] = (uint16_t)(Array1[m].dsetu16[n][o-1] << 1);
+ }
+ valu16bits = (uint16_t)(valu16bits << 1);
+ }
+
+ /* Array of 32 bits unsigned int */
+ dims[0] = F70_XDIM; dims[1] = F70_YDIM32;
+
+ valu32bits = (uint32_t) ~0u; /* all 1s */
+ for(n = 0; n < (int)dims[0]; n++){
+ Array1[m].dsetu32[n][0] = valu32bits;
+ for(o = 1; o < (int)dims[1]; o++) {
+ Array1[m].dsetu32[n][o] = Array1[m].dsetu32[n][o-1] << 1;
+ }
+ valu32bits <<= 1;
+ }
+
+ /* Array of 64 bits unsigned int */
+ dims[0] = F70_XDIM; dims[1] = F70_YDIM64;
+
+ valu64bits = (uint64_t) ~0Lu; /* all 1s */
+ for(n = 0; n < (int)dims[0]; n++){
+ Array1[m].dsetu64[n][0] = valu64bits;
+ for(o = 1; o < (int)dims[1]; o++) {
+ Array1[m].dsetu64[n][o] = Array1[m].dsetu64[n][o-1] << 1;
+ }
+ valu64bits <<= 1;
+ }
+
+ /* Array of 8 bits signed int */
+ dims[0] = F70_XDIM; dims[1] = F70_YDIM8;
+
+ val8bits = (int8_t) ~0; /* all 1s */
+ for(n = 0; n < (int)dims[0]; n++){
+ Array1[m].dset8[n][0] = val8bits;
+ for(o = 1; o < (int)dims[1]; o++) {
+ Array1[m].dset8[n][o] = (int8_t)(Array1[m].dset8[n][o-1] << 1);
+ }
+ val8bits = (int8_t)(val8bits << 1);
+ }
+
+ /* Array of 16 bits signed int */
+ dims[0] = F70_XDIM; dims[1] = F70_YDIM16;
+
+ val16bits = (int16_t) ~0; /* all 1s */
+ for(n = 0; n < (int)dims[0]; n++){
+ Array1[m].dset16[n][0] = val16bits;
+ for(o = 1; o < (int)dims[1]; o++) {
+ Array1[m].dset16[n][o] = (int16_t)(Array1[m].dset16[n][o-1] << 1);
+ }
+ val16bits = (int16_t)(val16bits << 1);
+ }
+
+ /* Array of 32 bits signed int */
+ dims[0] = F70_XDIM; dims[1] = F70_YDIM32;
+
+ val32bits = (int32_t) ~0; /* all 1s */
+ for(n = 0; n < (int)dims[0]; n++){
+ Array1[m].dset32[n][0] = val32bits;
+ for(o = 1; o < (int)dims[1]; o++) {
+ Array1[m].dset32[n][o] = Array1[m].dset32[n][o-1] << 1;
+ }
+ val32bits <<= 1;
+ }
+
+ /* Array of 64 bits signed int */
+ dims[0] = F70_XDIM; dims[1] = F70_YDIM64;
+
+ val64bits = (int64_t) ~0L; /* all 1s */
+ for(n = 0; n < (int)dims[0]; n++){
+ Array1[m].dset64[n][0] = val64bits;
+ for(o = 1; o < (int)dims[1]; o++) {
+ Array1[m].dset64[n][o] = Array1[m].dset64[n][o-1] << 1;
+ }
+ val64bits <<= 1;
+ }
+
+ /* Double Dummy set for failure tests */
+ dims[0] = F70_XDIM; dims[1] = F70_YDIM8;
+
+ for(n = 0; n < (int)dims[0]; n++)
+ for(o = 0; o < (int)dims[1]; o++)
+ Array1[m].dsetdbl[n][o] = 0.0001F * (float)o + (float)n;
+ }
+
+ /* Create the array data type for the 8 bits signed int array */
+ array8_tid = H5Tarray_create2(H5T_NATIVE_SCHAR, F70_ARRAY_RANK, array_dim8);
+ HDassert(array8_tid >= 0);
+
+ /* Create the array data type for the 16 bits signed int array */
+ array16_tid = H5Tarray_create2(H5T_NATIVE_SHORT, F70_ARRAY_RANK, array_dim16);
+ HDassert(array16_tid >= 0);
+
+ /* Create the array data type for the 32 bits signed int array */
+ array32_tid = H5Tarray_create2(H5T_NATIVE_INT, F70_ARRAY_RANK, array_dim32);
+ HDassert(array32_tid >= 0);
+
+ /* Create the array data type for the 64 bits signed int array */
+ array64_tid = H5Tarray_create2(H5T_NATIVE_LONG, F70_ARRAY_RANK, array_dim64);
+ HDassert(array64_tid >= 0);
+
+ /* Create the array data type for the 8 bits signed int array */
+ arrayu8_tid = H5Tarray_create2(H5T_NATIVE_UCHAR, F70_ARRAY_RANK, array_dim8);
+ HDassert(arrayu8_tid >= 0);
+
+ /* Create the array data type for the 16 bits signed int array */
+ arrayu16_tid = H5Tarray_create2(H5T_NATIVE_USHORT, F70_ARRAY_RANK, array_dim16);
+ HDassert(arrayu16_tid >= 0);
+
+ /* Create the array data type for the 32 bits signed int array */
+ arrayu32_tid = H5Tarray_create2(H5T_NATIVE_UINT, F70_ARRAY_RANK, array_dim32);
+ HDassert(arrayu32_tid >= 0);
+
+ /* Create the array data type for the 64 bits signed int array */
+ arrayu64_tid = H5Tarray_create2(H5T_NATIVE_ULONG, F70_ARRAY_RANK, array_dim64);
+ HDassert(arrayu64_tid >= 0);
+
+ /* Create the array data type for the 32 bits double array */
+ arraydbl_tid = H5Tarray_create2(H5T_NATIVE_DOUBLE, F70_ARRAY_RANK, array_dim8);
+ HDassert(arraydbl_tid >= 0);
+
+ /* Create the dataspace */
+ space = H5Screate_simple(F70_RANK, dim, NULL);
+ HDassert(space >= 0);
+
+ /* Create the file */
+ fid = H5Fcreate(FILE71, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ HDassert(fid >= 0);
+
+ /* Create the memory data type */
+ Array1Structid = H5Tcreate(H5T_COMPOUND, sizeof(Array1Struct));
+ HDassert(Array1Structid >= 0);
+
+ /* Insert the arrays and variables into the structure */
+ status = H5Tinsert(Array1Structid, F70_DATASETU08, HOFFSET(Array1Struct, dsetu8), arrayu8_tid);
+ HDassert(status >= 0);
+
+ status = H5Tinsert(Array1Structid, F70_DATASETU16, HOFFSET(Array1Struct, dsetu16), arrayu16_tid);
+ HDassert(status >= 0);
+
+ status = H5Tinsert(Array1Structid, F70_DATASETU32, HOFFSET(Array1Struct, dsetu32), arrayu32_tid);
+ HDassert(status >= 0);
+
+ status = H5Tinsert(Array1Structid, F70_DATASETU64, HOFFSET(Array1Struct, dsetu64), arrayu64_tid);
+ HDassert(status >= 0);
+
+ status = H5Tinsert(Array1Structid, F70_DATASETS08, HOFFSET(Array1Struct, dset8), array8_tid);
+ HDassert(status >= 0);
+
+ status = H5Tinsert(Array1Structid, F70_DATASETS16, HOFFSET(Array1Struct, dset16), array16_tid);
+ HDassert(status >= 0);
+
+ status = H5Tinsert(Array1Structid, F70_DATASETS32, HOFFSET(Array1Struct, dset32), array32_tid);
+ HDassert(status >= 0);
+
+ status = H5Tinsert(Array1Structid, F70_DATASETS64, HOFFSET(Array1Struct, dset64), array64_tid);
+ HDassert(status >= 0);
+
+ status = H5Tinsert(Array1Structid, F70_DUMMYDBL, HOFFSET(Array1Struct, dsetdbl), arraydbl_tid);
+ HDassert(status >= 0);
+
+ root = H5Gopen2(fid, "/", H5P_DEFAULT);
+
+ /* Create the Attribute */
+ attr = H5Acreate2(root, F71_DATASETNAME, Array1Structid, space, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Write data to the attribute */
+ status = H5Awrite(attr, Array1Structid, Array1);
+ HDassert(status >= 0);
+
+ status = H5Tclose(arrayu8_tid);
+ HDassert(status >= 0);
+
+ status = H5Tclose(arrayu16_tid);
+ HDassert(status >= 0);
+
+ status = H5Tclose(arrayu32_tid);
+ HDassert(status >= 0);
+
+ status = H5Tclose(arrayu64_tid);
+ HDassert(status >= 0);
+
+ status = H5Tclose(array8_tid);
+ HDassert(status >= 0);
+
+ status = H5Tclose(array16_tid);
+ HDassert(status >= 0);
+
+ status = H5Tclose(array32_tid);
+ HDassert(status >= 0);
+
+ status = H5Tclose(array64_tid);
+ HDassert(status >= 0);
+
+ status = H5Tclose(arraydbl_tid);
+ HDassert(status >= 0);
+
+ /* Release resources */
+ status = H5Tclose(Array1Structid);
+ HDassert(status >= 0);
+
+ status = H5Sclose(space);
+ HDassert(status >= 0);
+
+ status = H5Aclose(attr);
+ HDassert(status >= 0);
+
+ status = H5Fclose(fid);
+ HDassert(status >= 0);
+}
+
+static void gent_nested_compound_dt(void) { /* test nested data type */
+ hid_t fid, group, dataset, space, type, create_plist, type1, type2;
+ hid_t array_dt, enum_dt;
+ enumtype val;
+
+ typedef struct {
+ int a;
+ float b;
+ } dset1_t;
+ dset1_t dset1[10];
+
+ typedef struct {
+ int a;
+ float b;
+ enumtype c;
+ } dset2_t;
+ dset2_t dset2[10];
+
+ typedef struct {
+ int a[5];
+ float b[5][6];
+ dset1_t c;
+ } dset3_t;
+ dset3_t dset3[10];
+
+ enumtype dset4[] = {RED, GREEN, BLUE, GREEN, WHITE, BLUE};
+
+ int i, j, k;
+ unsigned ndims;
+ hsize_t dim[2];
+
+ hsize_t sdim, maxdim;
+
+ sdim = 10;
+ for(i = 0; i < (int)sdim; i++) {
+ dset1[i].a = i;
+ dset1[i].b = (float)(i*i);
+
+ dset2[i].a = i;
+ dset2[i].b = (float)((float)i + (float)i * 0.1F);
+ dset2[i].c = GREEN;
+
+ for(j = 0; j < 5; j++) {
+ dset3[i].a[j] = i * j;
+ for(k = 0; k < 6; k++) {
+ dset3[i].b[j][k] = (float)((float)i * (float)j * (float)k * 1.0F);
+ }
+ }
+ dset3[i].c.a = i;
+ dset3[i].c.b = (float)((float)i * 1.0F);
+ }
+
+ fid = H5Fcreate(FILE72, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ create_plist = H5Pcreate(H5P_DATASET_CREATE);
+
+ sdim = 2;
+ H5Pset_chunk(create_plist, 1, &sdim);
+
+
+ sdim = 6;
+ maxdim = H5S_UNLIMITED;
+
+ space = H5Screate_simple(1, &sdim, &maxdim);
+
+ type = H5Tcreate (H5T_COMPOUND, sizeof(dset1[0]));
+ H5Tinsert(type, "a_name", HOFFSET(dset1_t, a), H5T_STD_I32LE);
+ H5Tinsert(type, "b_name", HOFFSET(dset1_t, b), H5T_IEEE_F32LE);
+
+ dataset = H5Dcreate2(fid, "/dset1", type, space, H5P_DEFAULT, create_plist, H5P_DEFAULT);
+
+ H5Dwrite(dataset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset1);
+
+ H5Tclose(type);
+ H5Dclose(dataset);
+
+ /* Create the shared enumerated datatype. */
+ enum_dt = H5Tenum_create (H5T_NATIVE_INT);
+ val = (enumtype) RED;
+ H5Tenum_insert (enum_dt, "Red", &val);
+ val = (enumtype) GREEN;
+ H5Tenum_insert (enum_dt, "Green", &val);
+ val = (enumtype) BLUE;
+ H5Tenum_insert (enum_dt, "Blue", &val);
+ val = (enumtype) WHITE;
+ H5Tenum_insert (enum_dt, "White", &val);
+ val = (enumtype) BLACK;
+ H5Tenum_insert (enum_dt, "Black", &val);
+ H5Tcommit2(fid, "enumtype", enum_dt, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ type2 = H5Tcreate (H5T_COMPOUND, sizeof(dset2[0]));
+
+ H5Tinsert(type2, "a_name", HOFFSET(dset2_t, a), H5T_NATIVE_INT);
+ H5Tinsert(type2, "b_name", HOFFSET(dset2_t, b), H5T_NATIVE_FLOAT);
+ H5Tinsert(type2, "c_name", HOFFSET(dset2_t, c), enum_dt);
+
+ dataset = H5Dcreate2(fid, "/dset2", type2, space, H5P_DEFAULT, create_plist, H5P_DEFAULT);
+
+ H5Dwrite(dataset, type2, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2);
+
+ H5Tclose(type2);
+
+ dataset = H5Dcreate2(fid, "/dset4", enum_dt, space, H5P_DEFAULT, create_plist, H5P_DEFAULT);
+ H5Dwrite(dataset, enum_dt, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset4);
+
+ H5Tclose(enum_dt);
+ H5Dclose(dataset);
+
+ /* shared data type 1 */
+ type1 = H5Tcreate(H5T_COMPOUND, sizeof(dset1_t));
+ H5Tinsert(type1, "int_name", HOFFSET(dset1_t, a), H5T_STD_I32LE);
+ H5Tinsert(type1, "float_name", HOFFSET(dset1_t, b), H5T_IEEE_F32LE);
+ H5Tcommit2(fid, "type1", type1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ group = H5Gcreate2(fid, "/group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ type2 = H5Tcreate (H5T_COMPOUND, sizeof(dset3_t));
+
+ ndims = 1; dim[0] = 5;
+ array_dt = H5Tarray_create2(H5T_STD_I32LE, ndims, dim);
+ H5Tinsert(type2, "int_name", HOFFSET(dset3_t, a), array_dt);
+ H5Tclose(array_dt);
+
+ ndims = 2; dim[0] = 5; dim[1] = 6;
+ array_dt = H5Tarray_create2(H5T_IEEE_F32LE, ndims, dim);
+ H5Tinsert(type2, "float_name", HOFFSET(dset3_t, b), array_dt);
+ H5Tclose(array_dt);
+
+ H5Tinsert (type2, "cmpd_name", HOFFSET (dset3_t, c), type1);
+
+ dataset = H5Dcreate2(group, "dset3", type2, space, H5P_DEFAULT, create_plist, H5P_DEFAULT);
+
+ H5Dwrite(dataset, type2, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset3);
+
+ dataset = H5Dcreate2(fid, "/dset5", type1, space, H5P_DEFAULT, create_plist, H5P_DEFAULT);
+ H5Dwrite(dataset, type1, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset1);
+
+ H5Tclose(type1);
+ H5Tclose(type2);
+ H5Sclose(space);
+ H5Dclose(dataset);
+ H5Gclose(group);
+
+ H5Pclose(create_plist);
+
+ H5Fclose(fid);
+
+}
+
+/*-------------------------------------------------------------------------
+ * Function: gent_intscalars
+ *
+ * Purpose: Generate a file to be used in the h5dump scalar tests.
+ * Four datasets of 1, 2, 4 and 8 bytes of unsigned int types are created.
+ * Four more datasets of 1, 2, 4 and 8 bytes of signed int types are created.
+ * Fill them with raw data such that no bit will be all zero in a dataset.
+ * A dummy dataset of double type is created for failure test.
+ *-------------------------------------------------------------------------
+ */
+static void
+gent_intscalars(void)
+{
+ hid_t fid, dataset, space, tid;
+ hsize_t dims[2];
+ uint8_t dsetu8[F73_XDIM][F73_YDIM8], valu8bits;
+ uint16_t dsetu16[F73_XDIM][F73_YDIM16], valu16bits;
+ uint32_t dsetu32[F73_XDIM][F73_YDIM32], valu32bits;
+ uint64_t dsetu64[F73_XDIM][F73_YDIM64], valu64bits;
+ int8_t dset8[F73_XDIM][F73_YDIM8], val8bits;
+ int16_t dset16[F73_XDIM][F73_YDIM16], val16bits;
+ int32_t dset32[F73_XDIM][F73_YDIM32], val32bits;
+ int64_t dset64[F73_XDIM][F73_YDIM64], val64bits;
+ double dsetdbl[F73_XDIM][F73_YDIM8];
+ unsigned int i, j;
+
+ fid = H5Fcreate(FILE73, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Dataset of 8 bits unsigned int */
+ dims[0] = F73_XDIM; dims[1] = F73_YDIM8;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_U8LE, F73_ARRAY_RANK, dims);
+ dataset = H5Dcreate2(fid, F73_DATASETU08, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ valu8bits = (uint8_t) ~0u; /* all 1s */
+ for(i = 0; i < dims[0]; i++){
+ dsetu8[i][0] = valu8bits;
+ for(j = 1; j < dims[1]; j++) {
+ dsetu8[i][j] = (uint8_t)(dsetu8[i][j-1] << 1);
+ }
+ valu8bits = (uint8_t)(valu8bits << 1);
+ }
+
+ H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu8);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+ /* Dataset of 16 bits unsigned int */
+ dims[0] = F73_XDIM; dims[1] = F73_YDIM16;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_U16LE, F73_ARRAY_RANK, dims);
+ dataset = H5Dcreate2(fid, F73_DATASETU16, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ valu16bits = (uint16_t) ~0u; /* all 1s */
+ for(i = 0; i < dims[0]; i++){
+ dsetu16[i][0] = valu16bits;
+ for(j = 1; j < dims[1]; j++) {
+ dsetu16[i][j] = (uint16_t)(dsetu16[i][j-1] << 1);
+ }
+ valu16bits = (uint16_t)(valu16bits << 1);
+ }
+
+ H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu16);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+ /* Dataset of 32 bits unsigned int */
+ dims[0] = F73_XDIM; dims[1] = F73_YDIM32;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_U32LE, F73_ARRAY_RANK, dims);
+ dataset = H5Dcreate2(fid, F73_DATASETU32, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ valu32bits = (uint32_t) ~0u; /* all 1s */
+ for(i = 0; i < dims[0]; i++){
+ dsetu32[i][0] = valu32bits;
+ for(j = 1; j < dims[1]; j++) {
+ dsetu32[i][j] = dsetu32[i][j-1] << 1;
+ }
+ valu32bits <<= 1;
+ }
+
+ H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu32);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+ /* Dataset of 64 bits unsigned int */
+ dims[0] = F73_XDIM; dims[1] = F73_YDIM64;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_U64LE, F73_ARRAY_RANK, dims);
+ dataset = H5Dcreate2(fid, F73_DATASETU64, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ valu64bits = (uint64_t) ~0Lu; /* all 1s */
+ for(i = 0; i < dims[0]; i++){
+ dsetu64[i][0] = valu64bits;
+ for(j = 1; j < dims[1]; j++) {
+ dsetu64[i][j] = dsetu64[i][j-1] << 1;
+ }
+ valu64bits <<= 1;
+ }
+
+ H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu64);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+ /* Dataset of 8 bits signed int */
+ dims[0] = F73_XDIM; dims[1] = F73_YDIM8;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_I8LE, F73_ARRAY_RANK, dims);
+ dataset = H5Dcreate2(fid, F73_DATASETS08, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ val8bits = (int8_t) ~0; /* all 1s */
+ for(i = 0; i < dims[0]; i++){
+ dset8[i][0] = val8bits;
+ for(j = 1; j < dims[1]; j++) {
+ dset8[i][j] = (int8_t)(dset8[i][j-1] << 1);
+ }
+ val8bits = (int8_t)(val8bits << 1);
+ }
+
+ H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset8);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+ /* Dataset of 16 bits signed int */
+ dims[0] = F73_XDIM; dims[1] = F73_YDIM16;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_I16LE, F73_ARRAY_RANK, dims);
+ dataset = H5Dcreate2(fid, F73_DATASETS16, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ val16bits = (int16_t) ~0; /* all 1s */
+ for(i = 0; i < dims[0]; i++){
+ dset16[i][0] = val16bits;
+ for(j = 1; j < dims[1]; j++) {
+ dset16[i][j] = (int16_t)(dset16[i][j-1] << 1);
+ }
+ val16bits = (int16_t)(val16bits << 1);
+ }
+
+ H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset16);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+ /* Dataset of 32 bits signed int */
+ dims[0] = F73_XDIM; dims[1] = F73_YDIM32;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_I32LE, F73_ARRAY_RANK, dims);
+ dataset = H5Dcreate2(fid, F73_DATASETS32, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ val32bits = (int32_t) ~0; /* all 1s */
+ for(i = 0; i < dims[0]; i++){
+ dset32[i][0] = val32bits;
+ for(j = 1; j < dims[1]; j++) {
+ dset32[i][j] = dset32[i][j-1] << 1;
+ }
+ val32bits <<= 1;
+ }
+
+ H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset32);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+ /* Dataset of 64 bits signed int */
+ dims[0] = F73_XDIM; dims[1] = F73_YDIM64;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_I64LE, F73_ARRAY_RANK, dims);
+ dataset = H5Dcreate2(fid, F73_DATASETS64, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ val64bits = (int64_t) ~0L; /* all 1s */
+ for(i = 0; i < dims[0]; i++){
+ dset64[i][0] = val64bits;
+ for(j = 1; j < dims[1]; j++) {
+ dset64[i][j] = dset64[i][j-1] << 1;
+ }
+ val64bits <<= 1;
+ }
+
+ H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset64);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+ /* Double Dummy set for failure tests */
+ dims[0] = F73_XDIM; dims[1] = F73_YDIM8;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_NATIVE_DOUBLE, F73_ARRAY_RANK, dims);
+ dataset = H5Dcreate2(fid, F73_DUMMYDBL, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ for(i = 0; i < dims[0]; i++)
+ for(j = 0; j < dims[1]; j++)
+ dsetdbl[i][j] = 0.0001F * (float)j + (float)i;
+
+ H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetdbl);
+
+ H5Sclose(space);
+ H5Dclose(dataset);
+ H5Fclose(fid);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: gent_attr_intscalars
+ *
+ * Purpose: Generate a file to be used in the h5dump attribute scalar tests.
+ * Four attributes of 1, 2, 4 and 8 bytes of unsigned int types are created.
+ * Four more datasets of 1, 2, 4 and 8 bytes of signed int types are created.
+ * Fill them with raw data such that no bit will be all zero in a dataset.
+ * A dummy dataset of double type is created for failure test.
+ * Use file to test Signed/Unsigned datatypes and keep in sync with gent_packedbits()
+ *-------------------------------------------------------------------------
+ */
+static void
+gent_attr_intscalars(void)
+{
+ hid_t fid, attr, space, root, tid;
+ hsize_t dims[2];
+ uint8_t dsetu8[F73_XDIM][F73_YDIM8], valu8bits;
+ uint16_t dsetu16[F73_XDIM][F73_YDIM16], valu16bits;
+ uint32_t dsetu32[F73_XDIM][F73_YDIM32], valu32bits;
+ uint64_t dsetu64[F73_XDIM][F73_YDIM64], valu64bits;
+ int8_t dset8[F73_XDIM][F73_YDIM8], val8bits;
+ int16_t dset16[F73_XDIM][F73_YDIM16], val16bits;
+ int32_t dset32[F73_XDIM][F73_YDIM32], val32bits;
+ int64_t dset64[F73_XDIM][F73_YDIM64], val64bits;
+ double dsetdbl[F73_XDIM][F73_YDIM8];
+ unsigned int i, j;
+
+ fid = H5Fcreate(FILE74, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ root = H5Gopen2(fid, "/", H5P_DEFAULT);
+
+ /* Attribute of 8 bits unsigned int */
+ dims[0] = F73_XDIM; dims[1] = F73_YDIM8;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_U8LE, F73_ARRAY_RANK, dims);
+ attr = H5Acreate2(root, F73_DATASETU08, tid, space, H5P_DEFAULT, H5P_DEFAULT);
+
+ valu8bits = (uint8_t) ~0u; /* all 1s */
+ for(i = 0; i < dims[0]; i++){
+ dsetu8[i][0] = valu8bits;
+ for(j = 1; j < dims[1]; j++) {
+ dsetu8[i][j] = (uint8_t)(dsetu8[i][j-1] << 1);
+ }
+ valu8bits = (uint8_t)(valu8bits << 1);
+ }
+
+ H5Awrite(attr, tid, dsetu8);
+ H5Sclose(space);
+ H5Aclose(attr);
+
+ /* Attribute of 16 bits unsigned int */
+ dims[0] = F73_XDIM; dims[1] = F73_YDIM16;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_U16LE, F73_ARRAY_RANK, dims);
+ attr = H5Acreate2(root, F73_DATASETU16, tid, space, H5P_DEFAULT, H5P_DEFAULT);
+
+ valu16bits = (uint16_t) ~0u; /* all 1s */
+ for(i = 0; i < dims[0]; i++){
+ dsetu16[i][0] = valu16bits;
+ for(j = 1; j < dims[1]; j++) {
+ dsetu16[i][j] = (uint16_t)(dsetu16[i][j-1] << 1);
+ }
+ valu16bits = (uint16_t)(valu16bits << 1);
+ }
+
+ H5Awrite(attr, tid, dsetu16);
+ H5Sclose(space);
+ H5Aclose(attr);
+
+ /* Attribute of 32 bits unsigned int */
+ dims[0] = F73_XDIM; dims[1] = F73_YDIM32;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_U32LE, F73_ARRAY_RANK, dims);
+ attr = H5Acreate2(root, F73_DATASETU32, tid, space, H5P_DEFAULT, H5P_DEFAULT);
+
+ valu32bits = (uint32_t) ~0u; /* all 1s */
+ for(i = 0; i < dims[0]; i++){
+ dsetu32[i][0] = valu32bits;
+ for(j = 1; j < dims[1]; j++) {
+ dsetu32[i][j] = dsetu32[i][j-1] << 1;
+ }
+ valu32bits <<= 1;
+ }
+
+ H5Awrite(attr, tid, dsetu32);
+ H5Sclose(space);
+ H5Aclose(attr);
+
+ /* Attribute of 64 bits unsigned int */
+ dims[0] = F73_XDIM; dims[1] = F73_YDIM64;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_U64LE, F73_ARRAY_RANK, dims);
+ attr = H5Acreate2(root, F73_DATASETU64, tid, space, H5P_DEFAULT, H5P_DEFAULT);
+
+ valu64bits = (uint64_t) ~0Lu; /* all 1s */
+ for(i = 0; i < dims[0]; i++){
+ dsetu64[i][0] = valu64bits;
+ for(j = 1; j < dims[1]; j++) {
+ dsetu64[i][j] = dsetu64[i][j-1] << 1;
+ }
+ valu64bits <<= 1;
+ }
+
+ H5Awrite(attr, tid, dsetu64);
+ H5Sclose(space);
+ H5Aclose(attr);
+
+ /* Attribute of 8 bits signed int */
+ dims[0] = F73_XDIM; dims[1] = F73_YDIM8;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_I8LE, F73_ARRAY_RANK, dims);
+ attr = H5Acreate2(root, F73_DATASETS08, tid, space, H5P_DEFAULT, H5P_DEFAULT);
+
+ val8bits = (int8_t) ~0; /* all 1s */
+ for(i = 0; i < dims[0]; i++){
+ dset8[i][0] = val8bits;
+ for(j = 1; j < dims[1]; j++) {
+ dset8[i][j] = (int8_t)(dset8[i][j-1] << 1);
+ }
+ val8bits = (int8_t)(val8bits << 1);
+ }
+
+ H5Awrite(attr, tid, dset8);
+ H5Sclose(space);
+ H5Aclose(attr);
+
+ /* Attribute of 16 bits signed int */
+ dims[0] = F73_XDIM; dims[1] = F73_YDIM16;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_I16LE, F73_ARRAY_RANK, dims);
+ attr = H5Acreate2(root, F73_DATASETS16, tid, space, H5P_DEFAULT, H5P_DEFAULT);
+
+ val16bits = (int16_t) ~0; /* all 1s */
+ for(i = 0; i < dims[0]; i++){
+ dset16[i][0] = val16bits;
+ for(j = 1; j < dims[1]; j++) {
+ dset16[i][j] = (int16_t)(dset16[i][j-1] << 1);
+ }
+ val16bits = (int16_t)(val16bits << 1);
+ }
+
+ H5Awrite(attr, tid, dset16);
+ H5Sclose(space);
+ H5Aclose(attr);
+
+ /* Attribute of 32 bits signed int */
+ dims[0] = F73_XDIM; dims[1] = F73_YDIM32;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_I32LE, F73_ARRAY_RANK, dims);
+ attr = H5Acreate2(root, F73_DATASETS32, tid, space, H5P_DEFAULT, H5P_DEFAULT);
+
+ val32bits = (int32_t) ~0; /* all 1s */
+ for(i = 0; i < dims[0]; i++){
+ dset32[i][0] = val32bits;
+ for(j = 1; j < dims[1]; j++) {
+ dset32[i][j] = dset32[i][j-1] << 1;
+ }
+ val32bits <<= 1;
+ }
+
+ H5Awrite(attr, tid, dset32);
+ H5Sclose(space);
+ H5Aclose(attr);
+
+ /* Attribute of 64 bits signed int */
+ dims[0] = F73_XDIM; dims[1] = F73_YDIM64;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_I64LE, F73_ARRAY_RANK, dims);
+ attr = H5Acreate2(root, F73_DATASETS64, tid, space, H5P_DEFAULT, H5P_DEFAULT);
+
+ val64bits = (int64_t) ~0L; /* all 1s */
+ for(i = 0; i < dims[0]; i++){
+ dset64[i][0] = val64bits;
+ for(j = 1; j < dims[1]; j++) {
+ dset64[i][j] = dset64[i][j-1] << 1;
+ }
+ val64bits <<= 1;
+ }
+
+ H5Awrite(attr, tid, dset64);
+ H5Sclose(space);
+ H5Aclose(attr);
+
+ /* Double Dummy set for failure tests */
+ dims[0] = F73_XDIM; dims[1] = F73_YDIM8;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_NATIVE_DOUBLE, F73_ARRAY_RANK, dims);
+ attr = H5Acreate2(root, F73_DUMMYDBL, tid, space, H5P_DEFAULT, H5P_DEFAULT);
+
+ for(i = 0; i < dims[0]; i++)
+ for(j = 0; j < dims[1]; j++)
+ dsetdbl[i][j] = 0.0001F * (float)j + (float)i;
+
+ H5Awrite(attr, tid, dsetdbl);
+
+ H5Sclose(space);
+ H5Aclose(attr);
+
+ H5Gclose(root);
+ H5Fclose(fid);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: gent_string_scalars
+ *
+ * Purpose: Generate a file to be used in the h5dump string scalar tests.
+ * A dataset of string types are created.
+ * An attribute of string types are created.
+ * Fill them with raw data such that no bit will be all zero in a dataset.
+ *-------------------------------------------------------------------------
+ */
+static void
+gent_string_scalars(void)
+{
+ hid_t fid, attr, dataset, space, tid, root;
+ hsize_t dims[2];
+ char string[F73_XDIM][F73_YDIM8];
+ unsigned int i, j;
+
+ fid = H5Fcreate(FILE75, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ root = H5Gopen2(fid, "/", H5P_DEFAULT);
+
+ /* string scalar */
+ dims[0] = F73_XDIM; dims[1] = F73_YDIM8;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tcopy(H5T_C_S1);
+ H5Tset_size(tid, F73_XDIM * F73_YDIM8);
+
+ memset(string, ' ', F73_XDIM * F73_YDIM8);
+ for(i = 0; i < dims[0]; i++) {
+ string[i][0] = (char)('A' + i);
+ for(j = 1; j < dims[1]; j++) {
+ string[i][j] = (char)(string[i][j-1] + 1);
+ }
+ }
+ string[dims[0]-1][dims[1]-1] = 0;
+
+ /* Dataset of string scalar */
+ dataset = H5Dcreate2(fid, "the_str", tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, string);
+ H5Dclose(dataset);
+
+ /* attribute of string scalar */
+ attr = H5Acreate2(root, "attr_str", tid, space, H5P_DEFAULT, H5P_DEFAULT);
+ H5Awrite(attr, tid, string);
+
+ H5Sclose(space);
+ H5Aclose(attr);
+
+ H5Gclose(root);
+ H5Fclose(fid);
+}
+
+static void gent_compound_int_array(void) {
+ hid_t fid, dataset, space;
+ hsize_t dims[1];
+ uint8_t valu8bits;
+ uint16_t valu16bits;
+ uint32_t valu32bits;
+ uint64_t valu64bits;
+ int8_t val8bits;
+ int16_t val16bits;
+ int32_t val32bits;
+ int64_t val64bits;
+ hsize_t array_dim8[]={F76_DIM8}; /* Array dimensions */
+ hsize_t array_dim16[]={F76_DIM16}; /* Array dimensions */
+ hsize_t array_dim32[]={F76_DIM32}; /* Array dimensions */
+ hsize_t array_dim64[]={F76_DIM64}; /* Array dimensions */
+ hid_t arrayu8_tid; /* Array datatype handle */
+ hid_t arrayu16_tid; /* Array datatype handle */
+ hid_t arrayu32_tid; /* Array datatype handle */
+ hid_t arrayu64_tid; /* Array datatype handle */
+ hid_t array8_tid; /* Array datatype handle */
+ hid_t array16_tid; /* Array datatype handle */
+ hid_t array32_tid; /* Array datatype handle */
+ hid_t array64_tid; /* Array datatype handle */
+ hid_t arraydbl_tid; /* Array datatype handle */
+ /* Structure and array for compound types */
+ typedef struct Cmpd1Struct {
+ uint8_t dsetu8[F76_DIM8];
+ uint16_t dsetu16[F76_DIM16];
+ uint32_t dsetu32[F76_DIM32];
+ uint64_t dsetu64[F76_DIM64];
+ int8_t dset8[F76_DIM8];
+ int16_t dset16[F76_DIM16];
+ int32_t dset32[F76_DIM32];
+ int64_t dset64[F76_DIM64];
+ double dsetdbl[F76_DIM8];
+ } Cmpd1Struct;
+ Cmpd1Struct *Cmpd1;
+
+ hid_t Cmpd1Structid; /* File datatype identifier */
+ herr_t status; /* Error checking variable */
+ hsize_t dim[] = { F76_LENGTH }; /* Dataspace dimensions */
+
+ int m, n; /* Array init loop vars */
+
+ /* Allocate buffer */
+ Cmpd1 = (Cmpd1Struct *)HDmalloc(sizeof(Cmpd1Struct) * F76_LENGTH);
+ HDassert(Cmpd1);
+
+ /* Initialize the data in the arrays/datastructure */
+ for (m = 0; m < F76_LENGTH; m++) {
+
+ /* Array of 8 bits unsigned int */
+ dims[0] = F76_DIM8;
+
+ valu8bits = (uint8_t) ~0u; /* all 1s */
+ for(n = 0; n < (int)dims[0]; n++){
+ Cmpd1[m].dsetu8[n] = valu8bits;
+ valu8bits = (uint8_t)(valu8bits << 1);
+ }
+
+ /* Array of 16 bits unsigned int */
+ dims[0] = F76_DIM16;
+
+ valu16bits = (uint16_t) ~0u; /* all 1s */
+ for(n = 0; n < (int)dims[0]; n++){
+ Cmpd1[m].dsetu16[n] = valu16bits;
+ valu16bits = (uint16_t)(valu16bits << 1);
+ }
+
+ /* Array of 32 bits unsigned int */
+ dims[0] = F76_DIM32;
+
+ valu32bits = (uint32_t) ~0u; /* all 1s */
+ for(n = 0; n < (int)dims[0]; n++){
+ Cmpd1[m].dsetu32[n] = valu32bits;
+ valu32bits <<= 1;
+ }
+
+ /* Array of 64 bits unsigned int */
+ dims[0] = F76_DIM64;
+
+ valu64bits = (uint64_t) ~0Lu; /* all 1s */
+ for(n = 0; n < (int)dims[0]; n++){
+ Cmpd1[m].dsetu64[n] = valu64bits;
+ valu64bits <<= 1;
+ }
+
+ /* Array of 8 bits signed int */
+ dims[0] = F76_DIM8;
+
+ val8bits = (int8_t) ~0; /* all 1s */
+ for(n = 0; n < (int)dims[0]; n++){
+ Cmpd1[m].dset8[n] = val8bits;
+ val8bits = (int8_t)(val8bits << 1);
+ }
+
+ /* Array of 16 bits signed int */
+ dims[0] = F76_DIM16;
+
+ val16bits = (int16_t) ~0; /* all 1s */
+ for(n = 0; n < (int)dims[0]; n++){
+ Cmpd1[m].dset16[n] = val16bits;
+ val16bits = (int16_t)(val16bits << 1);
+ }
+
+ /* Array of 32 bits signed int */
+ dims[0] = F76_DIM32;
+
+ val32bits = (int32_t) ~0; /* all 1s */
+ for(n = 0; n < (int)dims[0]; n++){
+ Cmpd1[m].dset32[n] = val32bits;
+ val32bits <<= 1;
+ }
+
+ /* Array of 64 bits signed int */
+ dims[0] = F76_DIM64;
+
+ val64bits = (int64_t) ~0L; /* all 1s */
+ for(n = 0; n < (int)dims[0]; n++){
+ Cmpd1[m].dset64[n] = val64bits;
+ val64bits <<= 1;
+ }
+
+ /* Double Dummy set for failure tests */
+ dims[0] = F76_DIM8;
+
+ for(n = 0; n < (int)dims[0]; n++)
+ Cmpd1[m].dsetdbl[n] = 0.0001F + (float)n;
+ }
+
+ /* Create the array data type for the 8 bits signed int array */
+ array8_tid = H5Tarray_create2(H5T_NATIVE_SCHAR, F76_ARRAY_RANK, array_dim8);
+ HDassert(array8_tid >= 0);
+
+ /* Create the array data type for the 16 bits signed int array */
+ array16_tid = H5Tarray_create2(H5T_NATIVE_SHORT, F76_ARRAY_RANK, array_dim16);
+ HDassert(array16_tid >= 0);
+
+ /* Create the array data type for the 32 bits signed int array */
+ array32_tid = H5Tarray_create2(H5T_NATIVE_INT, F76_ARRAY_RANK, array_dim32);
+ HDassert(array32_tid >= 0);
+
+ /* Create the array data type for the 64 bits signed int array */
+ array64_tid = H5Tarray_create2(H5T_NATIVE_LONG, F76_ARRAY_RANK, array_dim64);
+ HDassert(array64_tid >= 0);
+
+ /* Create the array data type for the 8 bits signed int array */
+ arrayu8_tid = H5Tarray_create2(H5T_NATIVE_UCHAR, F76_ARRAY_RANK, array_dim8);
+ HDassert(arrayu8_tid >= 0);
+
+ /* Create the array data type for the 16 bits signed int array */
+ arrayu16_tid = H5Tarray_create2(H5T_NATIVE_USHORT, F76_ARRAY_RANK, array_dim16);
+ HDassert(arrayu16_tid >= 0);
+
+ /* Create the array data type for the 32 bits signed int array */
+ arrayu32_tid = H5Tarray_create2(H5T_NATIVE_UINT, F76_ARRAY_RANK, array_dim32);
+ HDassert(arrayu32_tid >= 0);
+
+ /* Create the array data type for the 64 bits signed int array */
+ arrayu64_tid = H5Tarray_create2(H5T_NATIVE_ULONG, F76_ARRAY_RANK, array_dim64);
+ HDassert(arrayu64_tid >= 0);
+
+ /* Create the array data type for the 32 bits double array */
+ arraydbl_tid = H5Tarray_create2(H5T_NATIVE_DOUBLE, F76_ARRAY_RANK, array_dim8);
+ HDassert(arraydbl_tid >= 0);
+
+ /* Create the dataspace */
+ space = H5Screate_simple(F76_RANK, dim, NULL);
+ HDassert(space >= 0);
+
+ /* Create the file */
+ fid = H5Fcreate(FILE76, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ HDassert(fid >= 0);
+
+ /* Create the memory data type */
+ Cmpd1Structid = H5Tcreate(H5T_COMPOUND, sizeof(Cmpd1Struct));
+ HDassert(Cmpd1Structid >= 0);
+
+ /* Insert the arrays and variables into the structure */
+ status = H5Tinsert(Cmpd1Structid, F76_DATASETU08, HOFFSET(Cmpd1Struct, dsetu8), arrayu8_tid);
+ HDassert(status >= 0);
+
+ status = H5Tinsert(Cmpd1Structid, F76_DATASETU16, HOFFSET(Cmpd1Struct, dsetu16), arrayu16_tid);
+ HDassert(status >= 0);
+
+ status = H5Tinsert(Cmpd1Structid, F76_DATASETU32, HOFFSET(Cmpd1Struct, dsetu32), arrayu32_tid);
+ HDassert(status >= 0);
+
+ status = H5Tinsert(Cmpd1Structid, F76_DATASETU64, HOFFSET(Cmpd1Struct, dsetu64), arrayu64_tid);
+ HDassert(status >= 0);
+
+ status = H5Tinsert(Cmpd1Structid, F76_DATASETS08, HOFFSET(Cmpd1Struct, dset8), array8_tid);
+ HDassert(status >= 0);
+
+ status = H5Tinsert(Cmpd1Structid, F76_DATASETS16, HOFFSET(Cmpd1Struct, dset16), array16_tid);
+ HDassert(status >= 0);
+
+ status = H5Tinsert(Cmpd1Structid, F76_DATASETS32, HOFFSET(Cmpd1Struct, dset32), array32_tid);
+ HDassert(status >= 0);
+
+ status = H5Tinsert(Cmpd1Structid, F76_DATASETS64, HOFFSET(Cmpd1Struct, dset64), array64_tid);
+ HDassert(status >= 0);
+
+ status = H5Tinsert(Cmpd1Structid, F76_DUMMYDBL, HOFFSET(Cmpd1Struct, dsetdbl), arraydbl_tid);
+ HDassert(status >= 0);
+
+ /* Create the dataset */
+ dataset = H5Dcreate2(fid, F76_DATASETNAME, Cmpd1Structid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Write data to the dataset */
+ status = H5Dwrite(dataset, Cmpd1Structid, H5S_ALL, H5S_ALL, H5P_DEFAULT, Cmpd1);
+ HDassert(status >= 0);
+
+ /* Release resources */
+ status = H5Tclose(Cmpd1Structid);
+ HDassert(status >= 0);
+
+ status = H5Tclose(arrayu8_tid);
+ HDassert(status >= 0);
+
+ status = H5Tclose(arrayu16_tid);
+ HDassert(status >= 0);
+
+ status = H5Tclose(arrayu32_tid);
+ HDassert(status >= 0);
+
+ status = H5Tclose(arrayu64_tid);
+ HDassert(status >= 0);
+
+ status = H5Tclose(array8_tid);
+ HDassert(status >= 0);
+
+ status = H5Tclose(array16_tid);
+ HDassert(status >= 0);
+
+ status = H5Tclose(array32_tid);
+ HDassert(status >= 0);
+
+ status = H5Tclose(array64_tid);
+ HDassert(status >= 0);
+
+ status = H5Tclose(arraydbl_tid);
+ HDassert(status >= 0);
+
+ status = H5Sclose(space);
+ HDassert(status >= 0);
+
+ status = H5Dclose(dataset);
+ HDassert(status >= 0);
+
+ status = H5Fclose(fid);
+ HDassert(status >= 0);
+
+ HDfree(Cmpd1);
+}
+
+static void gent_compound_ints(void) {
+ hid_t fid, dataset, space;
+ uint8_t valu8bits = (uint8_t) ~0u; /* all 1s */
+ uint16_t valu16bits = (uint16_t) ~0u; /* all 1s */
+ uint32_t valu32bits = (uint32_t) ~0u; /* all 1s */
+ uint64_t valu64bits = (uint64_t) ~0Lu; /* all 1s */
+ int8_t val8bits = (int8_t) ~0; /* all 1s */
+ int16_t val16bits = (int16_t) ~0; /* all 1s */
+ int32_t val32bits = (int32_t) ~0; /* all 1s */
+ int64_t val64bits = (int64_t) ~0L; /* all 1s */
+ /* Structure and array for compound types */
+ typedef struct Cmpd1Struct {
+ uint8_t dsetu8;
+ uint16_t dsetu16;
+ uint32_t dsetu32;
+ uint64_t dsetu64;
+ int8_t dset8;
+ int16_t dset16;
+ int32_t dset32;
+ int64_t dset64;
+ double dsetdbl;
+ } Cmpd1Struct;
+ Cmpd1Struct *Cmpd1;
+
+ typedef struct Cmpd2Struct {
+ uint64_t dsetu64;
+ uint32_t dsetu32;
+ uint16_t dsetu16;
+ uint8_t dsetu8;
+ int64_t dset64;
+ int32_t dset32;
+ int16_t dset16;
+ int8_t dset8;
+ double dsetdbl;
+ } Cmpd2Struct;
+ Cmpd2Struct *Cmpd2;
+
+ hid_t Cmpd1Structid; /* File datatype identifier */
+ hid_t Cmpd2Structid; /* File datatype identifier */
+ herr_t status; /* Error checking variable */
+ hsize_t dim[] = { F77_LENGTH }; /* Dataspace dimensions */
+
+ int m; /* Array init loop vars */
+
+ /* Allocate buffers */
+ Cmpd1 = (Cmpd1Struct *)HDmalloc(sizeof(Cmpd1Struct) * F77_LENGTH);
+ HDassert(Cmpd1);
+ Cmpd2 = (Cmpd2Struct *)HDmalloc(sizeof(Cmpd2Struct) * F77_LENGTH);
+ HDassert(Cmpd2);
+
+ /* Initialize the data in the arrays/datastructure */
+ for (m = 0; m < F77_LENGTH; m++) {
+
+ /* Array of 8 bits unsigned int */
+ if((m % F76_DIM8) == 0)
+ valu8bits = (uint8_t) ~0u; /* all 1s */
+ Cmpd1[m].dsetu8 = valu8bits;
+ Cmpd2[m].dsetu8 = valu8bits;
+ valu8bits = (uint8_t)(valu8bits << 1);
+
+ /* Array of 16 bits unsigned int */
+ if((m % F76_DIM16) == 0)
+ valu16bits = (uint16_t) ~0u; /* all 1s */
+ Cmpd1[m].dsetu16 = valu16bits;
+ Cmpd2[m].dsetu16 = valu16bits;
+ valu16bits = (uint16_t)(valu16bits << 1);
+
+ /* Array of 32 bits unsigned int */
+ if((m % F76_DIM32) == 0)
+ valu32bits = (uint32_t) ~0u; /* all 1s */
+ Cmpd1[m].dsetu32 = valu32bits;
+ Cmpd2[m].dsetu32 = valu32bits;
+ valu32bits <<= 1;
+
+ /* Array of 64 bits unsigned int */
+ if((m % F76_DIM64) == 0)
+ valu64bits = (uint64_t) ~0Lu; /* all 1s */
+ Cmpd1[m].dsetu64 = valu64bits;
+ Cmpd2[m].dsetu64 = valu64bits;
+ valu64bits <<= 1;
+
+ /* Array of 8 bits signed int */
+ if((m % F76_DIM8) == 0)
+ val8bits = (int8_t) ~0; /* all 1s */
+ Cmpd1[m].dset8 = val8bits;
+ Cmpd2[m].dset8 = val8bits;
+ val8bits = (int8_t)(val8bits << 1);
+
+ /* Array of 16 bits signed int */
+ if((m % F76_DIM16) == 0)
+ val16bits = (int16_t) ~0; /* all 1s */
+ Cmpd1[m].dset16 = val16bits;
+ Cmpd2[m].dset16 = val16bits;
+ val16bits = (int16_t)(val16bits << 1);
+
+ /* Array of 32 bits signed int */
+ if((m % F76_DIM32) == 0)
+ val32bits = (int32_t) ~0; /* all 1s */
+ Cmpd1[m].dset32 = val32bits;
+ Cmpd2[m].dset32 = val32bits;
+ val32bits <<= 1;
+
+ /* Array of 64 bits signed int */
+ if((m % F76_DIM64) == 0)
+ val64bits = (int64_t) ~0L; /* all 1s */
+ Cmpd1[m].dset64 = val64bits;
+ Cmpd2[m].dset64 = val64bits;
+ val64bits <<= 1;
+
+ /* Double Dummy set for failure tests */
+ Cmpd1[m].dsetdbl = 0.0001F + (float)m;
+ Cmpd2[m].dsetdbl = 0.0001F + (float)m;
+ }
+
+ /* Create the dataspace */
+ space = H5Screate_simple(F76_RANK, dim, NULL);
+ HDassert(space >= 0);
+
+ /* Create the file */
+ fid = H5Fcreate(FILE77, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ HDassert(fid >= 0);
+
+ /* Create the memory data type */
+ Cmpd1Structid = H5Tcreate(H5T_COMPOUND, sizeof(Cmpd1Struct));
+ HDassert(Cmpd1Structid >= 0);
+
+ /* Insert the arrays and variables into the structure */
+ status = H5Tinsert(Cmpd1Structid, F76_DATASETU08, HOFFSET(Cmpd1Struct, dsetu8), H5T_NATIVE_UCHAR);
+ HDassert(status >= 0);
+
+ status = H5Tinsert(Cmpd1Structid, F76_DATASETU16, HOFFSET(Cmpd1Struct, dsetu16), H5T_NATIVE_USHORT);
+ HDassert(status >= 0);
+
+ status = H5Tinsert(Cmpd1Structid, F76_DATASETU32, HOFFSET(Cmpd1Struct, dsetu32), H5T_NATIVE_UINT);
+ HDassert(status >= 0);
+
+ status = H5Tinsert(Cmpd1Structid, F76_DATASETU64, HOFFSET(Cmpd1Struct, dsetu64), H5T_NATIVE_ULONG);
+ HDassert(status >= 0);
+
+ status = H5Tinsert(Cmpd1Structid, F76_DATASETS08, HOFFSET(Cmpd1Struct, dset8), H5T_NATIVE_SCHAR);
+ HDassert(status >= 0);
+
+ status = H5Tinsert(Cmpd1Structid, F76_DATASETS16, HOFFSET(Cmpd1Struct, dset16), H5T_NATIVE_SHORT);
+ HDassert(status >= 0);
+
+ status = H5Tinsert(Cmpd1Structid, F76_DATASETS32, HOFFSET(Cmpd1Struct, dset32), H5T_NATIVE_INT);
+ HDassert(status >= 0);
+
+ status = H5Tinsert(Cmpd1Structid, F76_DATASETS64, HOFFSET(Cmpd1Struct, dset64), H5T_NATIVE_LONG);
+ HDassert(status >= 0);
+
+ status = H5Tinsert(Cmpd1Structid, F76_DUMMYDBL, HOFFSET(Cmpd1Struct, dsetdbl), H5T_NATIVE_DOUBLE);
+ HDassert(status >= 0);
+
+ /* Create the dataset */
+ dataset = H5Dcreate2(fid, F77_DATASETNAME1, Cmpd1Structid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Write data to the dataset */
+ status = H5Dwrite(dataset, Cmpd1Structid, H5S_ALL, H5S_ALL, H5P_DEFAULT, Cmpd1);
+ HDassert(status >= 0);
+
+ /* Release resources */
+ status = H5Tclose(Cmpd1Structid);
+ HDassert(status >= 0);
+
+ status = H5Sclose(space);
+ HDassert(status >= 0);
+
+ status = H5Dclose(dataset);
+ HDassert(status >= 0);
+
+ /* Create the dataspace */
+ space = H5Screate_simple(F76_RANK, dim, NULL);
+ HDassert(space >= 0);
+
+ /* Create the memory data type */
+ Cmpd2Structid = H5Tcreate(H5T_COMPOUND, sizeof(Cmpd2Struct));
+ HDassert(Cmpd2Structid >= 0);
+
+ /* Insert the arrays and variables into the structure */
+ status = H5Tinsert(Cmpd2Structid, F76_DATASETU64, HOFFSET(Cmpd2Struct, dsetu64), H5T_NATIVE_ULONG);
+ HDassert(status >= 0);
+
+ status = H5Tinsert(Cmpd2Structid, F76_DATASETU32, HOFFSET(Cmpd2Struct, dsetu32), H5T_NATIVE_UINT);
+ HDassert(status >= 0);
+
+ status = H5Tinsert(Cmpd2Structid, F76_DATASETU16, HOFFSET(Cmpd2Struct, dsetu16), H5T_NATIVE_USHORT);
+ HDassert(status >= 0);
+
+ status = H5Tinsert(Cmpd2Structid, F76_DATASETU08, HOFFSET(Cmpd2Struct, dsetu8), H5T_NATIVE_UCHAR);
+ HDassert(status >= 0);
+
+ status = H5Tinsert(Cmpd2Structid, F76_DATASETS64, HOFFSET(Cmpd2Struct, dset64), H5T_NATIVE_LONG);
+ HDassert(status >= 0);
+
+ status = H5Tinsert(Cmpd2Structid, F76_DATASETS32, HOFFSET(Cmpd2Struct, dset32), H5T_NATIVE_INT);
+ HDassert(status >= 0);
+
+ status = H5Tinsert(Cmpd2Structid, F76_DATASETS16, HOFFSET(Cmpd2Struct, dset16), H5T_NATIVE_SHORT);
+ HDassert(status >= 0);
+
+ status = H5Tinsert(Cmpd2Structid, F76_DATASETS08, HOFFSET(Cmpd2Struct, dset8), H5T_NATIVE_SCHAR);
+ HDassert(status >= 0);
+
+ status = H5Tinsert(Cmpd2Structid, F76_DUMMYDBL, HOFFSET(Cmpd2Struct, dsetdbl), H5T_NATIVE_DOUBLE);
+ HDassert(status >= 0);
+
+ /* Create the dataset */
+ dataset = H5Dcreate2(fid, F77_DATASETNAME2, Cmpd2Structid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Write data to the dataset */
+ status = H5Dwrite(dataset, Cmpd2Structid, H5S_ALL, H5S_ALL, H5P_DEFAULT, Cmpd2);
+ HDassert(status >= 0);
+
+ /* Release resources */
+ status = H5Tclose(Cmpd2Structid);
+ HDassert(status >= 0);
+
+ status = H5Sclose(space);
+ HDassert(status >= 0);
+
+ status = H5Dclose(dataset);
+ HDassert(status >= 0);
+
+ status = H5Fclose(fid);
+ HDassert(status >= 0);
+
+ HDfree(Cmpd1);
+ HDfree(Cmpd2);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: gent_intscalars
+ *
+ * Purpose: Generate a file to be used in the h5dump scalar with attribute tests.
+ * Four datasets of 1, 2, 4 and 8 bytes of unsigned int types are created.
+ * Four more datasets of 1, 2, 4 and 8 bytes of signed int types are created.
+ * Fill them with raw data such that no bit will be all zero in a dataset.
+ * A dummy dataset of double type is created for failure test.
+ *-------------------------------------------------------------------------
+ */
+static void
+gent_intattrscalars(void)
+{
+ hid_t fid, attr, dataset, space, tid;
+ hsize_t dims[2];
+ uint8_t dsetu8[F73_XDIM][F73_YDIM8], valu8bits;
+ uint16_t dsetu16[F73_XDIM][F73_YDIM16], valu16bits;
+ uint32_t dsetu32[F73_XDIM][F73_YDIM32], valu32bits;
+ uint64_t dsetu64[F73_XDIM][F73_YDIM64], valu64bits;
+ int8_t dset8[F73_XDIM][F73_YDIM8], val8bits;
+ int16_t dset16[F73_XDIM][F73_YDIM16], val16bits;
+ int32_t dset32[F73_XDIM][F73_YDIM32], val32bits;
+ int64_t dset64[F73_XDIM][F73_YDIM64], val64bits;
+ double dsetdbl[F73_XDIM][F73_YDIM8];
+ unsigned int i, j;
+
+ fid = H5Fcreate(FILE78, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Dataset of 8 bits unsigned int */
+ dims[0] = F73_XDIM; dims[1] = F73_YDIM8;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_U8LE, F73_ARRAY_RANK, dims);
+ dataset = H5Dcreate2(fid, F73_DATASETU08, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ valu8bits = (uint8_t) ~0u; /* all 1s */
+ for(i = 0; i < dims[0]; i++){
+ dsetu8[i][0] = valu8bits;
+ for(j = 1; j < dims[1]; j++) {
+ dsetu8[i][j] = (uint8_t)(dsetu8[i][j-1] << 1);
+ }
+ valu8bits = (uint8_t)(valu8bits << 1);
+ }
+
+ H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu8);
+ /* Attribute of 8 bits unsigned int */
+ attr = H5Acreate2(dataset, F73_DATASETU08, tid, space, H5P_DEFAULT, H5P_DEFAULT);
+ H5Awrite(attr, tid, dsetu8);
+ H5Aclose(attr);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+ /* Dataset of 16 bits unsigned int */
+ dims[0] = F73_XDIM; dims[1] = F73_YDIM16;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_U16LE, F73_ARRAY_RANK, dims);
+ dataset = H5Dcreate2(fid, F73_DATASETU16, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ valu16bits = (uint16_t) ~0u; /* all 1s */
+ for(i = 0; i < dims[0]; i++){
+ dsetu16[i][0] = valu16bits;
+ for(j = 1; j < dims[1]; j++) {
+ dsetu16[i][j] = (uint16_t)(dsetu16[i][j-1] << 1);
+ }
+ valu16bits = (uint16_t)(valu16bits << 1);
+ }
+
+ H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu16);
+ /* Attribute of 16 bits unsigned int */
+ attr = H5Acreate2(dataset, F73_DATASETU16, tid, space, H5P_DEFAULT, H5P_DEFAULT);
+ H5Awrite(attr, tid, dsetu16);
+ H5Aclose(attr);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+ /* Dataset of 32 bits unsigned int */
+ dims[0] = F73_XDIM; dims[1] = F73_YDIM32;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_U32LE, F73_ARRAY_RANK, dims);
+ dataset = H5Dcreate2(fid, F73_DATASETU32, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ valu32bits = (uint32_t) ~0u; /* all 1s */
+ for(i = 0; i < dims[0]; i++){
+ dsetu32[i][0] = valu32bits;
+ for(j = 1; j < dims[1]; j++) {
+ dsetu32[i][j] = dsetu32[i][j-1] << 1;
+ }
+ valu32bits <<= 1;
+ }
+
+ H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu32);
+ /* Attribute of 32 bits unsigned int */
+ attr = H5Acreate2(dataset, F73_DATASETU32, tid, space, H5P_DEFAULT, H5P_DEFAULT);
+ H5Awrite(attr, tid, dsetu32);
+ H5Aclose(attr);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+ /* Dataset of 64 bits unsigned int */
+ dims[0] = F73_XDIM; dims[1] = F73_YDIM64;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_U64LE, F73_ARRAY_RANK, dims);
+ dataset = H5Dcreate2(fid, F73_DATASETU64, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ valu64bits = (uint64_t) ~0Lu; /* all 1s */
+ for(i = 0; i < dims[0]; i++){
+ dsetu64[i][0] = valu64bits;
+ for(j = 1; j < dims[1]; j++) {
+ dsetu64[i][j] = dsetu64[i][j-1] << 1;
+ }
+ valu64bits <<= 1;
+ }
+
+ H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu64);
+ /* Attribute of 64 bits unsigned int */
+ attr = H5Acreate2(dataset, F73_DATASETU64, tid, space, H5P_DEFAULT, H5P_DEFAULT);
+ H5Awrite(attr, tid, dsetu64);
+ H5Aclose(attr);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+ /* Dataset of 8 bits signed int */
+ dims[0] = F73_XDIM; dims[1] = F73_YDIM8;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_I8LE, F73_ARRAY_RANK, dims);
+ dataset = H5Dcreate2(fid, F73_DATASETS08, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ val8bits = (int8_t) ~0; /* all 1s */
+ for(i = 0; i < dims[0]; i++){
+ dset8[i][0] = val8bits;
+ for(j = 1; j < dims[1]; j++) {
+ dset8[i][j] = (int8_t)(dset8[i][j-1] << 1);
+ }
+ val8bits = (int8_t)(val8bits << 1);
+ }
+
+ H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset8);
+ /* Attribute of 8 bits signed int */
+ attr = H5Acreate2(dataset, F73_DATASETS08, tid, space, H5P_DEFAULT, H5P_DEFAULT);
+ H5Awrite(attr, tid, dset8);
+ H5Aclose(attr);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+ /* Dataset of 16 bits signed int */
+ dims[0] = F73_XDIM; dims[1] = F73_YDIM16;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_I16LE, F73_ARRAY_RANK, dims);
+ dataset = H5Dcreate2(fid, F73_DATASETS16, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ val16bits = (int16_t) ~0; /* all 1s */
+ for(i = 0; i < dims[0]; i++){
+ dset16[i][0] = val16bits;
+ for(j = 1; j < dims[1]; j++) {
+ dset16[i][j] = (int16_t)(dset16[i][j-1] << 1);
+ }
+ val16bits = (int16_t)(val16bits << 1);
+ }
+
+ H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset16);
+ /* Attribute of 16 bits signed int */
+ attr = H5Acreate2(dataset, F73_DATASETS16, tid, space, H5P_DEFAULT, H5P_DEFAULT);
+ H5Awrite(attr, tid, dset16);
+ H5Aclose(attr);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+ /* Dataset of 32 bits signed int */
+ dims[0] = F73_XDIM; dims[1] = F73_YDIM32;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_I32LE, F73_ARRAY_RANK, dims);
+ dataset = H5Dcreate2(fid, F73_DATASETS32, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ val32bits = (int32_t) ~0; /* all 1s */
+ for(i = 0; i < dims[0]; i++){
+ dset32[i][0] = val32bits;
+ for(j = 1; j < dims[1]; j++) {
+ dset32[i][j] = dset32[i][j-1] << 1;
+ }
+ val32bits <<= 1;
+ }
+
+ H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset32);
+ /* Attribute of 32 bits signed int */
+ attr = H5Acreate2(dataset, F73_DATASETS32, tid, space, H5P_DEFAULT, H5P_DEFAULT);
+ H5Awrite(attr, tid, dset32);
+ H5Aclose(attr);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+ /* Dataset of 64 bits signed int */
+ dims[0] = F73_XDIM; dims[1] = F73_YDIM64;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_STD_I64LE, F73_ARRAY_RANK, dims);
+ dataset = H5Dcreate2(fid, F73_DATASETS64, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ val64bits = (int64_t) ~0L; /* all 1s */
+ for(i = 0; i < dims[0]; i++){
+ dset64[i][0] = val64bits;
+ for(j = 1; j < dims[1]; j++) {
+ dset64[i][j] = dset64[i][j-1] << 1;
+ }
+ val64bits <<= 1;
+ }
+
+ H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset64);
+ /* Attribute of 64 bits signed int */
+ attr = H5Acreate2(dataset, F73_DATASETS64, tid, space, H5P_DEFAULT, H5P_DEFAULT);
+ H5Awrite(attr, tid, dset64);
+ H5Aclose(attr);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+ /* Double Dummy set for failure tests */
+ dims[0] = F73_XDIM; dims[1] = F73_YDIM8;
+ space = H5Screate(H5S_SCALAR);
+ tid = H5Tarray_create2(H5T_NATIVE_DOUBLE, F73_ARRAY_RANK, dims);
+ dataset = H5Dcreate2(fid, F73_DUMMYDBL, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ for(i = 0; i < dims[0]; i++)
+ for(j = 0; j < dims[1]; j++)
+ dsetdbl[i][j] = 0.0001F * (float)j + (float)i;
+
+ H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetdbl);
+ /* Attribute of double */
+ attr = H5Acreate2(dataset, F73_DUMMYDBL, tid, space, H5P_DEFAULT, H5P_DEFAULT);
+ H5Awrite(attr, tid, dsetdbl);
+ H5Aclose(attr);
+ H5Sclose(space);
+ H5Dclose(dataset);
+ H5Fclose(fid);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: gent_packedbits
+ *
+ * Purpose: Generate a file to be used in the h5dump packed bits tests.
+ * Four datasets of 1, 2, 4 and 8 bytes of unsigned int types are created.
+ * Four more datasets of 1, 2, 4 and 8 bytes of signed int types are created.
+ * Fill them with raw data such that no bit will be all zero in a dataset.
+ * A dummy dataset of double type is created for failure test.
+ * Created: Albert Cheng, 2010/5/10.
+ * Modified: Allen Byrne, 2011/1/5 Use file to test Signed/Unsigned datatypes
+ *-------------------------------------------------------------------------
+ */
+static void
+gent_intsattrs(void)
+{
+ hid_t fid, attr, dataset, space, aspace;
+ hsize_t dims[2], adims[1];
+ uint8_t dsetu8[F66_XDIM][F66_YDIM8], asetu8[F66_XDIM*F66_YDIM8], valu8bits;
+ uint16_t dsetu16[F66_XDIM][F66_YDIM16], asetu16[F66_XDIM*F66_YDIM16], valu16bits;
+ uint32_t dsetu32[F66_XDIM][F66_YDIM32], asetu32[F66_XDIM*F66_YDIM32], valu32bits;
+ uint64_t dsetu64[F66_XDIM][F66_YDIM64], asetu64[F66_XDIM*F66_YDIM64], valu64bits;
+ int8_t dset8[F66_XDIM][F66_YDIM8], aset8[F66_XDIM*F66_YDIM8], val8bits;
+ int16_t dset16[F66_XDIM][F66_YDIM16], aset16[F66_XDIM*F66_YDIM16], val16bits;
+ int32_t dset32[F66_XDIM][F66_YDIM32], aset32[F66_XDIM*F66_YDIM32], val32bits;
+ int64_t dset64[F66_XDIM][F66_YDIM64], aset64[F66_XDIM*F66_YDIM64], val64bits;
+ double dsetdbl[F66_XDIM][F66_YDIM8], asetdbl[F66_XDIM*F66_YDIM8];
+ unsigned int i, j;
+
+ fid = H5Fcreate(FILE79, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Dataset of 8 bits unsigned int */
+ dims[0] = F66_XDIM; dims[1] = F66_YDIM8;
+ space = H5Screate_simple(2, dims, NULL);
+ dataset = H5Dcreate2(fid, F66_DATASETU08, H5T_STD_U8LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ valu8bits = (uint8_t) ~0u; /* all 1s */
+ for(i = 0; i < dims[0]; i++){
+ dsetu8[i][0] = valu8bits;
+ asetu8[i*dims[1]] = dsetu8[i][0];
+ for(j = 1; j < dims[1]; j++) {
+ dsetu8[i][j] = (uint8_t)(dsetu8[i][j-1] << 1);
+ asetu8[i*dims[1]+j] = dsetu8[i][j];
+ }
+ valu8bits = (uint8_t)(valu8bits << 1);
+ }
+
+ H5Dwrite(dataset, H5T_NATIVE_UINT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu8);
+ /* Attribute of 8 bits unsigned int */
+ adims[0] = F66_XDIM * F66_YDIM8;
+ aspace = H5Screate_simple(1, adims, NULL);
+ attr = H5Acreate2(dataset, F66_DATASETU08, H5T_STD_U8LE, aspace, H5P_DEFAULT, H5P_DEFAULT);
+ H5Awrite(attr, H5T_NATIVE_UINT8, asetu8);
+ H5Aclose(attr);
+ H5Sclose(aspace);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+ /* Dataset of 16 bits unsigned int */
+ dims[0] = F66_XDIM; dims[1] = F66_YDIM16;
+ space = H5Screate_simple(2, dims, NULL);
+ dataset = H5Dcreate2(fid, F66_DATASETU16, H5T_STD_U16LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ valu16bits = (uint16_t) ~0u; /* all 1s */
+ for(i = 0; i < dims[0]; i++){
+ dsetu16[i][0] = valu16bits;
+ asetu16[i*dims[1]] = dsetu16[i][0];
+ for(j = 1; j < dims[1]; j++) {
+ dsetu16[i][j] = (uint16_t)(dsetu16[i][j-1] << 1);
+ asetu16[i*dims[1]+j] = dsetu16[i][j];
+ }
+ valu16bits = (uint16_t)(valu16bits << 1);
+ }
+
+ H5Dwrite(dataset, H5T_NATIVE_UINT16, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu16);
+ /* Attribute of 16 bits unsigned int */
+ adims[0] = F66_XDIM * F66_YDIM16;
+ aspace = H5Screate_simple(1, adims, NULL);
+ attr = H5Acreate2(dataset, F66_DATASETU16, H5T_STD_U16LE, aspace, H5P_DEFAULT, H5P_DEFAULT);
+ H5Awrite(attr, H5T_NATIVE_UINT16, asetu16);
+ H5Aclose(attr);
+ H5Sclose(aspace);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+ /* Dataset of 32 bits unsigned int */
+ dims[0] = F66_XDIM; dims[1] = F66_YDIM32;
+ space = H5Screate_simple(2, dims, NULL);
+ dataset = H5Dcreate2(fid, F66_DATASETU32, H5T_STD_U32LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ valu32bits = (uint32_t) ~0u; /* all 1s */
+ for(i = 0; i < dims[0]; i++){
+ dsetu32[i][0] = valu32bits;
+ asetu32[i*dims[1]] = dsetu32[i][0];
+ for(j = 1; j < dims[1]; j++) {
+ dsetu32[i][j] = dsetu32[i][j-1] << 1;
+ asetu32[i*dims[1]+j] = dsetu32[i][j];
+ }
+ valu32bits <<= 1;
+ }
+
+ H5Dwrite(dataset, H5T_NATIVE_UINT32, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu32);
+ /* Attribute of 32 bits unsigned int */
+ adims[0] = F66_XDIM * F66_YDIM32;
+ aspace = H5Screate_simple(1, adims, NULL);
+ attr = H5Acreate2(dataset, F66_DATASETU32, H5T_STD_U32LE, aspace, H5P_DEFAULT, H5P_DEFAULT);
+ H5Awrite(attr, H5T_NATIVE_UINT32, asetu32);
+ H5Aclose(attr);
+ H5Sclose(aspace);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+ /* Dataset of 64 bits unsigned int */
+ dims[0] = F66_XDIM; dims[1] = F66_YDIM64;
+ space = H5Screate_simple(2, dims, NULL);
+ dataset = H5Dcreate2(fid, F66_DATASETU64, H5T_STD_U64LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ valu64bits = (uint64_t) ~0Lu; /* all 1s */
+ for(i = 0; i < dims[0]; i++){
+ dsetu64[i][0] = valu64bits;
+ asetu64[i*dims[1]] = dsetu64[i][0];
+ for(j = 1; j < dims[1]; j++) {
+ dsetu64[i][j] = dsetu64[i][j-1] << 1;
+ asetu64[i*dims[1]+j] = dsetu64[i][j];
+ }
+ valu64bits <<= 1;
+ }
+
+ H5Dwrite(dataset, H5T_NATIVE_UINT64, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu64);
+ /* Attribute of 64 bits unsigned int */
+ adims[0] = F66_XDIM * F66_YDIM64;
+ aspace = H5Screate_simple(1, adims, NULL);
+ attr = H5Acreate2(dataset, F66_DATASETU64, H5T_STD_U64LE, aspace, H5P_DEFAULT, H5P_DEFAULT);
+ H5Awrite(attr, H5T_NATIVE_UINT64, asetu64);
+ H5Aclose(attr);
+ H5Sclose(aspace);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+ /* Dataset of 8 bits signed int */
+ dims[0] = F66_XDIM; dims[1] = F66_YDIM8;
+ space = H5Screate_simple(2, dims, NULL);
+ dataset = H5Dcreate2(fid, F66_DATASETS08, H5T_STD_I8LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ val8bits = (int8_t) ~0; /* all 1s */
+ for(i = 0; i < dims[0]; i++){
+ dset8[i][0] = val8bits;
+ aset8[i*dims[1]] = dset8[i][0];
+ for(j = 1; j < dims[1]; j++) {
+ dset8[i][j] = (int8_t)(dset8[i][j-1] << 1);
+ aset8[i*dims[1]+j] = dset8[i][j];
+ }
+ val8bits = (int8_t)(val8bits << 1);
+ }
+
+ H5Dwrite(dataset, H5T_NATIVE_INT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset8);
+ /* Attribute of 8 bits signed int */
+ adims[0] = F66_XDIM * F66_YDIM8;
+ aspace = H5Screate_simple(1, adims, NULL);
+ attr = H5Acreate2(dataset, F66_DATASETS08, H5T_STD_I8LE, aspace, H5P_DEFAULT, H5P_DEFAULT);
+ H5Awrite(attr, H5T_NATIVE_INT8, aset8);
+ H5Aclose(attr);
+ H5Sclose(aspace);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+ /* Dataset of 16 bits signed int */
+ dims[0] = F66_XDIM; dims[1] = F66_YDIM16;
+ space = H5Screate_simple(2, dims, NULL);
+ dataset = H5Dcreate2(fid, F66_DATASETS16, H5T_STD_I16LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ val16bits = (int16_t) ~0; /* all 1s */
+ for(i = 0; i < dims[0]; i++){
+ dset16[i][0] = val16bits;
+ aset16[i*dims[1]] = dset16[i][0];
+ for(j = 1; j < dims[1]; j++) {
+ dset16[i][j] = (int16_t)(dset16[i][j-1] << 1);
+ aset16[i*dims[1]+j] = dset16[i][j];
+ }
+ val16bits = (int16_t)(val16bits << 1);
+ }
+
+ H5Dwrite(dataset, H5T_NATIVE_INT16, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset16);
+ /* Attribute of 16 bits signed int */
+ adims[0] = F66_XDIM * F66_YDIM16;
+ aspace = H5Screate_simple(1, adims, NULL);
+ attr = H5Acreate2(dataset, F66_DATASETS16, H5T_STD_I16LE, aspace, H5P_DEFAULT, H5P_DEFAULT);
+ H5Awrite(attr, H5T_NATIVE_INT16, aset16);
+ H5Aclose(attr);
+ H5Sclose(aspace);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+ /* Dataset of 32 bits signed int */
+ dims[0] = F66_XDIM; dims[1] = F66_YDIM32;
+ space = H5Screate_simple(2, dims, NULL);
+ dataset = H5Dcreate2(fid, F66_DATASETS32, H5T_STD_I32LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ val32bits = (int32_t) ~0; /* all 1s */
+ for(i = 0; i < dims[0]; i++){
+ dset32[i][0] = val32bits;
+ aset32[i*dims[1]] = dset32[i][0];
+ for(j = 1; j < dims[1]; j++) {
+ dset32[i][j] = dset32[i][j-1] << 1;
+ aset32[i*dims[1]+j] = dset32[i][j];
+ }
+ val32bits <<= 1;
+ }
+
+ H5Dwrite(dataset, H5T_NATIVE_INT32, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset32);
+ /* Attribute of 32 bits signed int */
+ adims[0] = F66_XDIM * F66_YDIM32;
+ aspace = H5Screate_simple(1, adims, NULL);
+ attr = H5Acreate2(dataset, F66_DATASETS32, H5T_STD_I32LE, aspace, H5P_DEFAULT, H5P_DEFAULT);
+ H5Awrite(attr, H5T_NATIVE_INT32, aset32);
+ H5Aclose(attr);
+ H5Sclose(aspace);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+ /* Dataset of 64 bits signed int */
+ dims[0] = F66_XDIM; dims[1] = F66_YDIM64;
+ space = H5Screate_simple(2, dims, NULL);
+ dataset = H5Dcreate2(fid, F66_DATASETS64, H5T_STD_I64LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ val64bits = (int64_t) ~0L; /* all 1s */
+ for(i = 0; i < dims[0]; i++){
+ dset64[i][0] = val64bits;
+ aset64[i*dims[1]] = dset64[i][0];
+ for(j = 1; j < dims[1]; j++) {
+ dset64[i][j] = dset64[i][j-1] << 1;
+ aset64[i*dims[1]+j] = dset64[i][j];
+ }
+ val64bits <<= 1;
+ }
+
+ H5Dwrite(dataset, H5T_NATIVE_INT64, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset64);
+ /* Attribute of 64 bits signed int */
+ adims[0] = F66_XDIM * F66_YDIM64;
+ aspace = H5Screate_simple(1, adims, NULL);
+ attr = H5Acreate2(dataset, F66_DATASETS64, H5T_STD_I64LE, aspace, H5P_DEFAULT, H5P_DEFAULT);
+ H5Awrite(attr, H5T_NATIVE_INT64, aset64);
+ H5Aclose(attr);
+ H5Sclose(aspace);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+ /* Double Dummy set for failure tests */
+ dims[0] = F66_XDIM; dims[1] = F66_YDIM8;
+ space = H5Screate_simple(2, dims, NULL);
+ dataset = H5Dcreate2(fid, F66_DUMMYDBL, H5T_IEEE_F64BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ for(i = 0; i < dims[0]; i++)
+ for(j = 0; j < dims[1]; j++) {
+ dsetdbl[i][j] = 0.0001F * (float)j + (float)i;
+ asetdbl[i*dims[1]+j] = dsetdbl[i][j];
+ }
+
+ H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetdbl);
+ /* Attribute of double */
+ adims[0] = F66_XDIM * F66_YDIM8;
+ aspace = H5Screate_simple(1, adims, NULL);
+ attr = H5Acreate2(dataset, F66_DUMMYDBL, H5T_IEEE_F64BE, aspace, H5P_DEFAULT, H5P_DEFAULT);
+ H5Awrite(attr, H5T_NATIVE_DOUBLE, asetdbl);
+ H5Aclose(attr);
+ H5Sclose(aspace);
+ H5Sclose(space);
+ H5Dclose(dataset);
+ H5Fclose(fid);
+}
+
+static void gent_bitnopaquefields(void)
+{
+ /* Compound datatype */
+ typedef struct s_t
+ {
+ unsigned char a;
+ unsigned int b;
+ unsigned long c;
+ unsigned long long d;
+ } s_t;
+ hid_t file, grp=-1, type=-1, space=-1, dset=-1;
+ size_t i;
+ hsize_t nelmts = F80_DIM32;
+ unsigned char buf[F80_DIM32]; /* bitfield, opaque */
+ unsigned int buf2[F80_DIM32]; /* bitfield, opaque */
+ unsigned long buf3[F80_DIM32]; /* bitfield, opaque */
+ unsigned long long buf4[F80_DIM32]; /* bitfield, opaque */
+ s_t buf5[F80_DIM32]; /* compound */
+
+ file = H5Fcreate(FILE80, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ if ((grp = H5Gcreate2(file, "bittypetests", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ /* bitfield_1 */
+ if ((type = H5Tcopy(H5T_STD_B8LE)) >= 0) {
+ if ((space = H5Screate_simple(1, &nelmts, NULL)) >= 0) {
+ if ((dset = H5Dcreate2(grp, "bitfield_1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ for (i = 0; i < nelmts; i++) {
+ buf[i] = (unsigned char)0xff ^ (unsigned char)i;
+ }
+ H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
+ H5Dclose(dset);
+ }
+ H5Sclose(space);
+ }
+ H5Tclose(type);
+ }
+
+ /* bitfield_2 */
+ if ((type = H5Tcopy(H5T_STD_B16LE)) >= 0) {
+ if ((space = H5Screate_simple(1, &nelmts, NULL)) >= 0) {
+ if ((dset = H5Dcreate2(grp, "bitfield_2", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ for (i = 0; i < nelmts; i++) {
+ buf2[i] = (unsigned int)0xffff ^ (unsigned int)(i * 16);
+ }
+ H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2);
+ H5Dclose(dset);
+ }
+ H5Sclose(space);
+ }
+ H5Tclose(type);
+ }
+
+ /* bitfield_3 */
+ if ((type = H5Tcopy(H5T_STD_B32LE)) >= 0) {
+ if ((space = H5Screate_simple(1, &nelmts, NULL)) >= 0) {
+ if ((dset = H5Dcreate2(grp, "bitfield_3", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ for (i = 0; i < nelmts; i++) {
+ buf3[i] = (unsigned long)0xffffffff ^ (unsigned long)(i * 32);
+ }
+ H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf3);
+ H5Dclose(dset);
+ }
+ H5Sclose(space);
+ }
+ H5Tclose(type);
+ }
+
+ /* bitfield_4 */
+ if ((type = H5Tcopy(H5T_STD_B64LE)) >= 0) {
+ if ((space = H5Screate_simple(1, &nelmts, NULL)) >= 0) {
+ if ((dset = H5Dcreate2(grp, "bitfield_4", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ for (i = 0; i < nelmts; i++) {
+ buf4[i] = (unsigned long long)0xffffffffffffffff ^ (unsigned long long)(i * 64);
+ }
+ H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf4);
+ H5Dclose(dset);
+ }
+ H5Sclose(space);
+ }
+ H5Tclose(type);
+ }
+
+ H5Gclose(grp);
+ }
+
+ if ((grp = H5Gcreate2(file, "opaquetypetests", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ /* opaque_1 */
+ if ((type = H5Tcreate(H5T_OPAQUE, 1)) >= 0) {
+ if ((H5Tset_tag(type, "1-byte opaque type")) >= 0) {
+ if ((space = H5Screate_simple(1, &nelmts, NULL)) >= 0) {
+ if ((dset = H5Dcreate2(grp, "opaque_1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ for(i = 0; i < nelmts; i++)
+ buf[i] = (unsigned char)0xff ^ (unsigned char)i;
+ H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
+ H5Dclose(dset);
+ }
+ H5Sclose(space);
+ }
+ }
+ H5Tclose(type);
+ }
+
+ /* opaque_2 */
+ if ((type = H5Tcreate(H5T_OPAQUE, 2)) >= 0) {
+ if ((H5Tset_tag(type, "2-byte opaque type")) >= 0) {
+ if ((space = H5Screate_simple(1, &nelmts, NULL)) >= 0) {
+ if ((dset = H5Dcreate2(grp, "opaque_2", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ for(i = 0; i < nelmts; i++)
+ buf2[i] = (unsigned int)0xffff ^ (unsigned int)(i * 16);
+
+ H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2);
+ H5Dclose(dset);
+ }
+ H5Sclose(space);
+ }
+ }
+ H5Tclose(type);
+ }
+ H5Gclose(grp);
+ }
+
+ if ((grp = H5Gcreate2(file, "cmpdtypetests", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ /* compound_1 */
+ if ((type = H5Tcreate(H5T_COMPOUND, sizeof(s_t))) >= 0) {
+ H5Tinsert(type, "a", HOFFSET(s_t, a), H5T_STD_B8LE);
+ H5Tinsert(type, "b", HOFFSET(s_t, b), H5T_STD_B16LE);
+ H5Tinsert(type, "c", HOFFSET(s_t, c), H5T_STD_B32LE);
+ H5Tinsert(type, "d", HOFFSET(s_t, d), H5T_STD_B64LE);
+ if ((space = H5Screate_simple(1, &nelmts, NULL)) >= 0) {
+ if ((dset = H5Dcreate2(grp, "compound_1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ for(i = 0; i < nelmts; i++) {
+ buf5[i].a = (unsigned char)0xff ^ (unsigned char)i;
+ buf5[i].b = (unsigned int)0xffff ^ (unsigned int)(i * 16);
+ buf5[i].c = (unsigned long)0xffffffff ^ (unsigned long)(i * 32);
+ buf5[i].d = (unsigned long long)0xffffffffffffffff ^ (unsigned long long)(i * 64);
+ }
+
+ H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf5);
+ H5Dclose(dset);
+ }
+ H5Sclose(space);
+ }
+ H5Tclose(type);
+ }
+ H5Gclose(grp);
+ }
+
+ H5Fclose(file);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: gent_intsfourdims
+ *
+ * Purpose: Generate a file to be used in the h5dump subsetting tests.
+ * One datasets of unsigned int types are created in four dimensions 2,4,6,10.
+ *-------------------------------------------------------------------------
+ */
+static void
+gent_intsfourdims(void)
+{
+ hid_t fid, dataset, space;
+ hsize_t dims[F81_RANK];
+ uint32_t dset1[F81_ZDIM][F81_YDIM][F81_XDIM][F81_WDIM];
+ unsigned int i, j, k, l;
+
+ fid = H5Fcreate(FILE81, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Dataset of 32 bits unsigned int */
+ dims[0] = F81_ZDIM; dims[1] = F81_YDIM; dims[2] = F81_XDIM; dims[3] = F81_WDIM;
+ space = H5Screate_simple(F81_RANK, dims, NULL);
+ dataset = H5Dcreate2(fid, F81_DATASETNAME, H5T_STD_U32LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ for(i = 0; i < F81_ZDIM; i++)
+ for(j = 0; j < F81_YDIM; j++)
+ for(k = 0; k < F81_XDIM; k++)
+ for(l = 0; l < F81_WDIM; l++)
+ dset1[i][j][k][l] = i*F81_YDIM*F81_XDIM*F81_WDIM + j*F81_XDIM*F81_WDIM + k*F81_WDIM + l;
+
+ H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset1);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+ H5Fclose(fid);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: gent_compound_complex2
+ *
+ * Purpose: Generate a file to be used in testing compound datatypes of
+ * various sizes, dimensions, member types and nesting.
+ *-------------------------------------------------------------------------
+ */
+static void gent_compound_complex2(void)
+{
+ /* Third-level nested compound */
+ typedef struct {
+ short deep_nested_short[10];
+ int deep_nested_int[10];
+ long deep_nested_long[10];
+ double deep_nested_double[10];
+ float deep_nested_float[10];
+ } third_level_compound;
+
+ /* Second-level multiply-nested compounds */
+ typedef struct {
+ unsigned int multiple_nested_a[5];
+ int multiple_nested_b[5];
+ unsigned long multiple_nested_c[5];
+ long multiple_nested_d[5];
+ } further_nested;
+
+ typedef struct {
+ char further_nested_string[11];
+ char further_nested_string_array[4][13];
+ third_level_compound deep_nest;
+ } further_nested2;
+
+ /* First First-level nested compound */
+ typedef struct
+ {
+ double nested_a;
+ char nested_string[23];
+ char nested_string_array[4][12];
+ } nested_compound;
+
+ /* Second First-level nested compound */
+ typedef struct
+ {
+ float a;
+ further_nested b;
+ further_nested2 c;
+ } multiple_nested_compound;
+
+ /* Compound datatype with different member types */
+ typedef struct
+ {
+ /* Arrays nested inside compound */
+ unsigned int a[4];
+ int b[6];
+ float c[2][4];
+ nested_compound d; /* Compound inside compound */
+ multiple_nested_compound e; /* Compound inside compound with further nested compound */
+ } compound;
+
+ compound *buf; /* compound */
+
+ hid_t file, type=-1, space=-1, dset=-1;
+ hid_t dset_array_a, dset_array_b, dset_array_c;
+ hid_t cmpd_tid1 = -1, cmpd_tid2 = -1, cmpd_tid3 = -1;
+ size_t i;
+ size_t j, k;
+ unsigned dset_array_ndims;
+ hsize_t dset_array_a_dims[1], dset_array_b_dims[1], dset_array_c_dims[2];
+ hsize_t nelmts = F82_DIM32;
+
+ /* Allocate buffer */
+ buf = (compound *)HDmalloc(sizeof(compound) * F82_DIM32);
+ HDassert(buf);
+
+ file = H5Fcreate(FILE82, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ if ((space = H5Screate_simple(F82_RANK, &nelmts, NULL)) >= 0) {
+ /* CompoundComplex1D */
+ if ((type = H5Tcreate(H5T_COMPOUND, sizeof(compound))) >= 0) {
+ hid_t str_type, array;
+ hsize_t dims[1];
+ hid_t nest1, nest2;
+
+ /* Insert top-level array members */
+ dset_array_ndims = 1; dset_array_a_dims[0] = 4;
+ dset_array_a = H5Tarray_create2(H5T_STD_U32LE, dset_array_ndims, dset_array_a_dims);
+ H5Tinsert(type, "a", HOFFSET(compound, a), dset_array_a);
+ H5Tclose(dset_array_a);
+
+ dset_array_ndims = 1; dset_array_b_dims[0] = 6;
+ dset_array_b = H5Tarray_create2(H5T_STD_I32LE, dset_array_ndims, dset_array_b_dims);
+ H5Tinsert(type, "b", HOFFSET(compound, b), dset_array_b);
+ H5Tclose(dset_array_b);
+
+ dset_array_ndims = 2; dset_array_c_dims[0] = 2; dset_array_c_dims[1] = 4;
+ dset_array_c = H5Tarray_create2(H5T_IEEE_F32LE, dset_array_ndims, dset_array_c_dims);
+ H5Tinsert(type, "c", HOFFSET(compound, c), dset_array_c);
+ H5Tclose(dset_array_c);
+
+ /* Insert first nested compound */
+ cmpd_tid1 = H5Tcreate(H5T_COMPOUND, sizeof(nested_compound));
+
+ H5Tinsert(cmpd_tid1, "nested_double", HOFFSET(nested_compound, nested_a), H5T_IEEE_F64LE);
+
+ dims[0] = 1;
+ str_type = mkstr(23, H5T_STR_NULLTERM);
+ array = H5Tarray_create2(str_type, 1, dims);
+ H5Tinsert(cmpd_tid1, "nested_string", HOFFSET(nested_compound, nested_string), array);
+ H5Tclose(array);
+ H5Tclose(str_type);
+
+ dims[0] = 4;
+ str_type = mkstr(12, H5T_STR_NULLTERM);
+ array = H5Tarray_create2(str_type, 1, dims);
+ H5Tinsert(cmpd_tid1, "nested_string_array", HOFFSET(nested_compound, nested_string_array), array);
+ H5Tclose(array);
+ H5Tclose(str_type);
+
+ H5Tinsert(type, "nested_compound", HOFFSET(compound, d), cmpd_tid1);
+
+ /* Insert second nested compound */
+ cmpd_tid2 = H5Tcreate(H5T_COMPOUND, sizeof(multiple_nested_compound));
+
+ H5Tinsert(cmpd_tid2, "nested_float", HOFFSET(multiple_nested_compound, a), H5T_IEEE_F32LE);
+
+ /* Add first further nested compound */
+ nest1 = H5Tcreate(H5T_COMPOUND, sizeof(further_nested));
+
+ dims[0] = 5;
+ array = H5Tarray_create2(H5T_STD_U32LE, 1, dims);
+ H5Tinsert(nest1, "nested_unsigned_int", HOFFSET(further_nested, multiple_nested_a), array);
+ H5Tclose(array);
+
+ array = H5Tarray_create2(H5T_STD_I32LE, 1, dims);
+ H5Tinsert(nest1, "nested_int", HOFFSET(further_nested, multiple_nested_b), array);
+ H5Tclose(array);
+
+ array = H5Tarray_create2(H5T_STD_U64LE, 1, dims);
+ H5Tinsert(nest1, "nested_unsigned_long", HOFFSET(further_nested, multiple_nested_c), array);
+ H5Tclose(array);
+
+ array = H5Tarray_create2(H5T_STD_I64LE, 1, dims);
+ H5Tinsert(nest1, "nested_long", HOFFSET(further_nested, multiple_nested_d), array);
+ H5Tclose(array);
+
+ H5Tinsert(cmpd_tid2, "further_nested_compoundA", HOFFSET(multiple_nested_compound, b), nest1);
+ H5Tclose(nest1);
+
+ /* Add second further nested compound */
+ nest2 = H5Tcreate(H5T_COMPOUND, sizeof(further_nested2));
+
+ dims[0] = 1;
+ str_type = mkstr(11, H5T_STR_NULLTERM);
+ array = H5Tarray_create2(str_type, 1, dims);
+ H5Tinsert(nest2, "nested_string", HOFFSET(further_nested2, further_nested_string), array);
+ H5Tclose(array);
+ H5Tclose(str_type);
+
+ dims[0] = 4;
+ str_type = mkstr(13, H5T_STR_NULLTERM);
+ array = H5Tarray_create2(str_type, 1, dims);
+ H5Tinsert(nest2, "nested_string_array", HOFFSET(further_nested2, further_nested_string_array), array);
+ H5Tclose(array);
+ H5Tclose(str_type);
+
+ /* Add a final third-level nested compound to this second-level compound */
+ cmpd_tid3 = H5Tcreate(H5T_COMPOUND, sizeof(third_level_compound));
+
+ dims[0] = 10;
+ array = H5Tarray_create2(H5T_STD_I16LE, 1, dims);
+ H5Tinsert(cmpd_tid3, "deep_nested_short", HOFFSET(third_level_compound, deep_nested_short), array);
+ H5Tclose(array);
+
+ array = H5Tarray_create2(H5T_STD_I32LE, 1, dims);
+ H5Tinsert(cmpd_tid3, "deep_nested_int", HOFFSET(third_level_compound, deep_nested_int), array);
+ H5Tclose(array);
+
+ array = H5Tarray_create2(H5T_STD_I64LE, 1, dims);
+ H5Tinsert(cmpd_tid3, "deep_nested_long", HOFFSET(third_level_compound, deep_nested_long), array);
+ H5Tclose(array);
+
+ array = H5Tarray_create2(H5T_IEEE_F64LE, 1, dims);
+ H5Tinsert(cmpd_tid3, "deep_nested_double", HOFFSET(third_level_compound, deep_nested_double), array);
+ H5Tclose(array);
+
+ array = H5Tarray_create2(H5T_IEEE_F32LE, 1, dims);
+ H5Tinsert(cmpd_tid3, "deep_nested_float", HOFFSET(third_level_compound, deep_nested_float), array);
+ H5Tclose(array);
+
+ H5Tinsert(nest2, "deep_nested_compound", HOFFSET(further_nested2, deep_nest), cmpd_tid3);
+
+ H5Tinsert(cmpd_tid2, "further_nested_compoundB", HOFFSET(multiple_nested_compound, c), nest2);
+ H5Tclose(nest2);
+
+ H5Tinsert(type, "multiple_nested_compound", HOFFSET(compound, e), cmpd_tid2);
+
+
+ if ((dset = H5Dcreate2(file, F82_DATASETNAME, type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ for(i = 0; i < nelmts; i++) {
+ for (j = 0; j < dset_array_a_dims[0]; j++)
+ buf[i].a[j] = (unsigned int)(j + i*10);
+ for (j = 0; j < dset_array_b_dims[0]; j++)
+ buf[i].b[j] = (int)(j - i*10);
+ for (j = 0; j < dset_array_c_dims[0]; j++)
+ for (k = 0; k < dset_array_c_dims[1]; k++)
+ buf[i].c[j][k] = (float)(j + k + i*10) + (float)(j) * 0.1F;
+
+ /* Set up first nested compound */
+ buf[i].d.nested_a = (double) i;
+
+ strcpy(buf[i].d.nested_string, "This is a test string.");
+
+ for (j = 0; j < 4; j++)
+ strcpy(buf[i].d.nested_string_array[j], "String test");
+
+ /* Set up multiple nested compound */
+ buf[i].e.a = (float) i;
+
+ for (j = 0; j < 5; j++) {
+ buf[i].e.b.multiple_nested_a[j] = (unsigned int)(j + i*10);
+ buf[i].e.b.multiple_nested_b[j] = (int)(j - i*10);
+ buf[i].e.b.multiple_nested_c[j] = (unsigned long)(j + i*10);
+ buf[i].e.b.multiple_nested_d[j] = (long)(j - i*10);
+ }
+
+ strcpy(buf[i].e.c.further_nested_string, "1234567890");
+ for (j = 0; j < 4; j++)
+ strcpy(buf[i].e.c.further_nested_string_array[j], "STRING ARRAY");
+
+ for (j = 0; j < 10; j++) {
+ buf[i].e.c.deep_nest.deep_nested_short[j] = (short)(j + i*10);
+ buf[i].e.c.deep_nest.deep_nested_int[j] = (int)(j - i*10);
+ buf[i].e.c.deep_nest.deep_nested_long[j] = (long)(j + i*10);
+ buf[i].e.c.deep_nest.deep_nested_double[j] = (double)(j + i*10);
+ buf[i].e.c.deep_nest.deep_nested_float[j] = (float)(j + i*10);
+ }
+ }
+
+ if (H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ fprintf(stderr, "gent_tcompound_complex2 H5Dwrite failed\n");
+
+ H5Dclose(dset);
+ }
+ H5Tclose(type);
+ }
+ H5Tclose(cmpd_tid1);
+ H5Tclose(cmpd_tid2);
+ H5Tclose(cmpd_tid3);
+ H5Sclose(space);
+ }
+
+// /* CompoundComplex2D */
+// if ((type = H5Tcreate(H5T_COMPOUND, sizeof(s_t))) >= 0) {
+// H5Tinsert(type, "a", HOFFSET(s_t, a), H5T_STD_B8LE);
+// H5Tinsert(type, "b", HOFFSET(s_t, b), H5T_STD_B16LE);
+// H5Tinsert(type, "c", HOFFSET(s_t, c), H5T_STD_B32LE);
+// H5Tinsert(type, "d", HOFFSET(s_t, d), H5T_STD_B64LE);
+// if ((space = H5Screate_simple(F82_RANK2, &nelmts, NULL)) >= 0) {
+// if ((dset = H5Dcreate2(file, "compound_1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+// for(i = 0; i < nelmts; i++) {
+// buf5[i].a = (unsigned char)0xff ^ (unsigned char)i;
+// buf5[i].b = (unsigned int)0xffff ^ (unsigned int)(i * 16);
+// buf5[i].c = (unsigned long)0xffffffff ^ (unsigned long)(i * 32);
+// buf5[i].d = (unsigned long long)0xffffffffffffffff ^ (unsigned long long)(i * 64);
+// }
+//
+// H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf5);
+// H5Dclose(dset);
+// }
+// H5Sclose(space);
+// }
+// H5Tclose(type);
+// }
+//
+// /* CompoundComplex3D */
+// if ((type = H5Tcreate(H5T_COMPOUND, sizeof(s_t))) >= 0) {
+// H5Tinsert(type, "a", HOFFSET(s_t, a), H5T_STD_B8LE);
+// H5Tinsert(type, "b", HOFFSET(s_t, b), H5T_STD_B16LE);
+// H5Tinsert(type, "c", HOFFSET(s_t, c), H5T_STD_B32LE);
+// H5Tinsert(type, "d", HOFFSET(s_t, d), H5T_STD_B64LE);
+// if ((space = H5Screate_simple(F82_RANK3, &nelmts, NULL)) >= 0) {
+// if ((dset = H5Dcreate2(file, "compound_1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+// for(i = 0; i < nelmts; i++) {
+// buf5[i].a = (unsigned char)0xff ^ (unsigned char)i;
+// buf5[i].b = (unsigned int)0xffff ^ (unsigned int)(i * 16);
+// buf5[i].c = (unsigned long)0xffffffff ^ (unsigned long)(i * 32);
+// buf5[i].d = (unsigned long long)0xffffffffffffffff ^ (unsigned long long)(i * 64);
+// }
+//
+// H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf5);
+// H5Dclose(dset);
+// }
+// H5Sclose(space);
+// }
+// H5Tclose(type);
+// }
+//
+// /* CompoundComplex4D */
+// if ((type = H5Tcreate(H5T_COMPOUND, sizeof(s_t))) >= 0) {
+// H5Tinsert(type, "a", HOFFSET(s_t, a), H5T_STD_B8LE);
+// H5Tinsert(type, "b", HOFFSET(s_t, b), H5T_STD_B16LE);
+// H5Tinsert(type, "c", HOFFSET(s_t, c), H5T_STD_B32LE);
+// H5Tinsert(type, "d", HOFFSET(s_t, d), H5T_STD_B64LE);
+// if ((space = H5Screate_simple(F82_RANK4, &nelmts, NULL)) >= 0) {
+// if ((dset = H5Dcreate2(file, "compound_1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+// for(i = 0; i < nelmts; i++) {
+// buf5[i].a = (unsigned char)0xff ^ (unsigned char)i;
+// buf5[i].b = (unsigned int)0xffff ^ (unsigned int)(i * 16);
+// buf5[i].c = (unsigned long)0xffffffff ^ (unsigned long)(i * 32);
+// buf5[i].d = (unsigned long long)0xffffffffffffffff ^ (unsigned long long)(i * 64);
+// }
+//
+// H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf5);
+// H5Dclose(dset);
+// }
+// H5Sclose(space);
+// }
+// H5Tclose(type);
+// }
+
+ H5Fclose(file);
+
+ HDfree(buf);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: gent_vlenstr_array
+ *
+ * Purpose: Generate a file to be used in testing Arrays of variable
+ * length strings.
+ *-------------------------------------------------------------------------
+ */
+static void gent_vlenstr_array(void)
+{
+ /* Compound datatype with different member types */
+ typedef struct compound
+ {
+ /* Array of variable-length strings*/
+ const char *vlen_array[F83_ARRAYDIM];
+ } compound;
+ compound buf[F83_DIM];
+
+ const char *test[F83_ARRAYDIM] = {
+ "This is a variable-length test string.",
+ "This test string is also variable-length.",
+ "A final test of variable-length strings. This string is longer than the others."
+ };
+ const char *buffer[F83_DIM*F83_ARRAYDIM];
+
+ hid_t file, type=-1, space=-1, dset=-1;
+ hid_t cmpd_tid1, array_tid;
+ int i, j;
+
+ hsize_t dims[] = {F83_DIM}, arraydim[] = {F83_ARRAYDIM};
+ /* Initialize scalar data */
+ for (i = 0; i < F83_DIM; i++)
+ for (j = 0; j < 3; j++)
+ buffer[j + 3*i] = test[j];
+
+ /* Initialize compound data */
+ for (i = 0; i < F83_DIM; i++)
+ for (j = 0; j < 3; j++)
+ buf[i].vlen_array[j] = test[j];
+
+ file = H5Fcreate(FILE83, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ if ((space = H5Screate_simple(F83_RANK, dims, NULL)) >= 0) {
+ array_tid = H5Tcopy(H5T_C_S1);
+ H5Tset_size(array_tid, H5T_VARIABLE);
+
+ /* ScalarArrayOfVlenStr */
+ if ((type = H5Tarray_create2(array_tid, F83_RANK, arraydim)) >= 0) {
+ if ((dset = H5Dcreate2(file, F83_DATASETNAME, type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ if (H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buffer) < 0)
+ fprintf(stderr, "gent_vlenstr_array H5Dwrite failed\n");
+
+ H5Dclose(dset);
+ }
+ H5Tclose(type);
+ }
+ H5Tclose(array_tid);
+ H5Sclose(space);
+ }
+
+ if ((space = H5Screate_simple(F83_RANK, dims, NULL)) >= 0) {
+ /* CompoundArrayOfVlenStr */
+ if ((type = H5Tcreate(H5T_COMPOUND, sizeof(compound))) >= 0) {
+ cmpd_tid1 = H5Tcopy(H5T_C_S1);
+ H5Tset_size(cmpd_tid1, H5T_VARIABLE);
+
+ array_tid = H5Tarray_create2(cmpd_tid1, F83_RANK, arraydim);
+ H5Tinsert(type, "vlen_str_array", HOFFSET(compound, vlen_array), array_tid);
+
+ if ((dset = H5Dcreate2(file, F83_DATASETNAME2, type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ if (H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ fprintf(stderr, "gent_vlenstr_array H5Dwrite failed\n");
+
+ H5Dclose(dset);
+ }
+ H5Tclose(cmpd_tid1);
+ H5Tclose(type);
+ }
+ H5Sclose(space);
+ }
+
+ H5Fclose(file);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: main
+ *
+ *-------------------------------------------------------------------------
+ */
+
+int main(void)
+{
+ gent_group();
+ gent_attribute();
+ gent_softlink();
+ gent_softlink2();
+ gent_dataset();
+ gent_hardlink();
+ gent_extlink();
+ gent_udlink();
+ gent_compound_dt();
+ gent_all();
+ gent_loop();
+ gent_dataset2();
+ gent_compound_dt2();
+ gent_loop2();
+ gent_many();
+ gent_str();
+ gent_str2();
+ gent_enum();
+ gent_objref();
+ gent_datareg();
+ gent_attrreg();
+ gent_nestcomp();
+ gent_opaque();
+ gent_bitfields();
+ gent_vldatatypes();
+ gent_vldatatypes2();
+ gent_vldatatypes3();
+ gent_vldatatypes4();
+ gent_vldatatypes5();
+ gent_array1_big();
+ gent_array1();
+ gent_array2();
+ gent_array3();
+ gent_array4();
+ gent_array5();
+ gent_array6();
+ gent_array7();
+ gent_array8();
+ gent_empty();
+ gent_group_comments();
+ gent_split_file();
+ gent_family();
+ gent_multi();
+ gent_large_objname();
+ gent_vlstr();
+ gent_vlenstr_array();
+ gent_char();
+ gent_attr_all();
+ gent_compound_complex();
+ gent_compound_complex2();
+ gent_named_dtype_attr();
+ gent_null_space();
+ gent_zero_dim_size();
+
+ gent_filters();
+ gent_fvalues();
+ gent_fcontents();
+ gent_string();
+ gent_aindices();
+ gent_longlinks();
+ gent_ldouble();
+ gent_binary();
+ gent_bigdims();
+ gent_hyperslab();
+ gent_group_creation_order();
+ gent_attr_creation_order();
+ gent_fpformat();
+ gent_extlinks();
+ gent_fs_strategy_threshold();
+ gent_packedbits();
+ gent_dataset_idx();
+ gent_attr_intsize();
+ gent_charsets();
+ gent_compound_intsizes();
+ gent_compound_attr_intsizes();
+
+ gent_nested_compound_dt();
+ gent_intscalars();
+ gent_attr_intscalars();
+ gent_string_scalars();
+ gent_compound_int_array();
+ gent_compound_ints();
+ gent_intattrscalars();
+ gent_intsattrs();
+ gent_bitnopaquefields();
+
+ gent_intsfourdims();
+
+ return 0;
+}
+
diff --git a/tools/test/h5dump/testh5dump.sh.in b/tools/test/h5dump/testh5dump.sh.in
new file mode 100644
index 0000000..14d753c
--- /dev/null
+++ b/tools/test/h5dump/testh5dump.sh.in
@@ -0,0 +1,1345 @@
+#! /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
+
+srcdir=@srcdir@
+
+USE_FILTER_SZIP="@USE_FILTER_SZIP@"
+USE_FILTER_DEFLATE="@USE_FILTER_DEFLATE@"
+
+TESTNAME=h5dump
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+
+DUMPER=../../src/h5dump/h5dump # The tool name
+DUMPER_BIN=`pwd`/$DUMPER # The path of the tool binary
+
+H5DIFF=../../src/h5diff/h5diff # The h5diff tool name
+H5DIFF_BIN=`pwd`/$H5DIFF # The path of the h5diff tool binary
+
+H5IMPORT=../../src/h5import/h5import # The h5import tool name
+H5IMPORT_BIN=`pwd`/$H5IMPORT # The path of the h5import tool binary
+
+RM='rm -rf'
+CMP='cmp'
+DIFF='diff -c'
+CP='cp'
+DIRNAME='dirname'
+LS='ls'
+AWK='awk'
+
+# Skip plugin module to test missing filter
+ENVCMD="env HDF5_PLUGIN_PRELOAD=::"
+
+nerrors=0
+verbose=yes
+
+# 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_H5DUMP_ERRORFILES="$srcdir/errfiles"
+SRC_H5DIFF_TESTFILES="$SRC_TOOLS/test/h5diff/testfiles"
+SRC_H5COPY_TESTFILES="$SRC_TOOLS/test/h5copy/testfiles"
+SRC_H5REPACK_TESTFILES="$SRC_TOOLS/test/h5repack/testfiles"
+SRC_H5JAM_TESTFILES="$SRC_TOOLS/test/h5jam/testfiles"
+SRC_H5STAT_TESTFILES="$SRC_TOOLS/test/h5stat/testfiles"
+SRC_H5IMPORT_TESTFILES="$SRC_TOOLS/test/h5import/testfiles"
+
+TEST_P_DIR=./testfiles
+TESTDIR=./testfiles/std
+test -d $TEST_P_DIR || mkdir -p $TEST_P_DIR
+test -d $TESTDIR || mkdir -p $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/charsets.h5
+$SRC_H5DUMP_TESTFILES/file_space.h5
+$SRC_H5DUMP_TESTFILES/filter_fail.h5
+$SRC_H5DUMP_TESTFILES/packedbits.h5
+$SRC_H5DUMP_TESTFILES/taindices.h5
+$SRC_H5DUMP_TESTFILES/tall.h5
+$SRC_H5DUMP_TESTFILES/tarray1.h5
+$SRC_H5DUMP_TESTFILES/tarray1_big.h5
+$SRC_H5DUMP_TESTFILES/tarray2.h5
+$SRC_H5DUMP_TESTFILES/tarray3.h5
+$SRC_H5DUMP_TESTFILES/tarray4.h5
+$SRC_H5DUMP_TESTFILES/tarray5.h5
+$SRC_H5DUMP_TESTFILES/tarray6.h5
+$SRC_H5DUMP_TESTFILES/tarray7.h5
+$SRC_H5DUMP_TESTFILES/tarray8.h5
+$SRC_H5DUMP_TESTFILES/tattr.h5
+$SRC_H5DUMP_TESTFILES/tattr2.h5
+$SRC_H5DUMP_TESTFILES/tattr4_be.h5
+$SRC_H5DUMP_TESTFILES/tattrintsize.h5
+$SRC_H5DUMP_TESTFILES/tattrreg.h5
+$SRC_H5DUMP_TESTFILES/tbigdims.h5
+$SRC_H5DUMP_TESTFILES/tbinary.h5
+$SRC_H5DUMP_TESTFILES/tchar.h5
+$SRC_H5DUMP_TESTFILES/tcmpdattrintsize.h5
+$SRC_H5DUMP_TESTFILES/tcmpdintsize.h5
+$SRC_H5DUMP_TESTFILES/tcompound.h5
+$SRC_H5DUMP_TESTFILES/tcompound_complex.h5
+$SRC_H5DUMP_TESTFILES/tcompound_complex2.h5
+$SRC_H5DUMP_TESTFILES/tdatareg.h5
+$SRC_H5DUMP_TESTFILES/tdset.h5
+$SRC_H5DUMP_TESTFILES/tempty.h5
+$SRC_H5DUMP_TESTFILES/tsoftlinks.h5
+$SRC_H5DUMP_TESTFILES/textlinkfar.h5
+$SRC_H5DUMP_TESTFILES/textlinksrc.h5
+$SRC_H5DUMP_TESTFILES/textlinktar.h5
+$SRC_H5DUMP_TESTFILES/textlink.h5
+$SRC_H5DUMP_TESTFILES/tfamily00000.h5
+$SRC_H5DUMP_TESTFILES/tfamily00001.h5
+$SRC_H5DUMP_TESTFILES/tfamily00002.h5
+$SRC_H5DUMP_TESTFILES/tfamily00003.h5
+$SRC_H5DUMP_TESTFILES/tfamily00004.h5
+$SRC_H5DUMP_TESTFILES/tfamily00005.h5
+$SRC_H5DUMP_TESTFILES/tfamily00006.h5
+$SRC_H5DUMP_TESTFILES/tfamily00007.h5
+$SRC_H5DUMP_TESTFILES/tfamily00008.h5
+$SRC_H5DUMP_TESTFILES/tfamily00009.h5
+$SRC_H5DUMP_TESTFILES/tfamily00010.h5
+$SRC_H5DUMP_TESTFILES/tfcontents1.h5
+$SRC_H5DUMP_TESTFILES/tfcontents2.h5
+$SRC_H5DUMP_TESTFILES/tfilters.h5
+$SRC_H5DUMP_TESTFILES/tfpformat.h5
+$SRC_H5DUMP_TESTFILES/tfvalues.h5
+$SRC_H5DUMP_TESTFILES/tgroup.h5
+$SRC_H5DUMP_TESTFILES/tgrp_comments.h5
+$SRC_H5DUMP_TESTFILES/thlink.h5
+$SRC_H5DUMP_TESTFILES/thyperslab.h5
+$SRC_H5DUMP_TESTFILES/tintsattrs.h5
+$SRC_H5DUMP_TESTFILES/tints4dims.h5
+$SRC_H5DUMP_TESTFILES/tlarge_objname.h5
+#$SRC_H5DUMP_TESTFILES/tldouble.h5
+$SRC_H5DUMP_TESTFILES/tlonglinks.h5
+$SRC_H5DUMP_TESTFILES/tloop.h5
+$SRC_H5DUMP_TESTFILES/tmulti-b.h5
+$SRC_H5DUMP_TESTFILES/tmulti-g.h5
+$SRC_H5DUMP_TESTFILES/tmulti-l.h5
+$SRC_H5DUMP_TESTFILES/tmulti-o.h5
+$SRC_H5DUMP_TESTFILES/tmulti-r.h5
+$SRC_H5DUMP_TESTFILES/tmulti-s.h5
+$SRC_H5DUMP_TESTFILES/tnamed_dtype_attr.h5
+$SRC_H5DUMP_TESTFILES/tnestedcomp.h5
+$SRC_H5DUMP_TESTFILES/tnestedcmpddt.h5
+$SRC_H5DUMP_TESTFILES/tno-subset.h5
+$SRC_H5DUMP_TESTFILES/tnullspace.h5
+$SRC_H5DUMP_TESTFILES/zerodim.h5
+$SRC_H5DUMP_TESTFILES/torderattr.h5
+$SRC_H5DUMP_TESTFILES/tordergr.h5
+$SRC_H5DUMP_TESTFILES/tsaf.h5
+$SRC_H5DUMP_TESTFILES/tscalarattrintsize.h5
+$SRC_H5DUMP_TESTFILES/tscalarintattrsize.h5
+$SRC_H5DUMP_TESTFILES/tscalarintsize.h5
+$SRC_H5DUMP_TESTFILES/tscalarstring.h5
+$SRC_H5DUMP_TESTFILES/tslink.h5
+$SRC_H5DUMP_TESTFILES/tsplit_file-m.h5
+$SRC_H5DUMP_TESTFILES/tsplit_file-r.h5
+$SRC_H5DUMP_TESTFILES/tstr.h5
+$SRC_H5DUMP_TESTFILES/tstr2.h5
+$SRC_H5DUMP_TESTFILES/tstr3.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/tvlenstr_array.h5
+$SRC_H5DUMP_TESTFILES/tvlstr.h5
+$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/non_existing.ddl
+$SRC_H5DUMP_TESTFILES/packedbits.ddl
+$SRC_H5DUMP_TESTFILES/tall-1.ddl
+$SRC_H5DUMP_TESTFILES/tall-2.ddl
+$SRC_H5DUMP_TESTFILES/tall-2A.ddl
+$SRC_H5DUMP_TESTFILES/tall-2A0.ddl
+$SRC_H5DUMP_TESTFILES/tall-2B.ddl
+$SRC_H5DUMP_TESTFILES/tall-3.ddl
+$SRC_H5DUMP_TESTFILES/tall-4s.ddl
+$SRC_H5DUMP_TESTFILES/tall-5s.ddl
+$SRC_H5DUMP_TESTFILES/tall-6.ddl
+$SRC_H5DUMP_TESTFILES/tall-6.exp
+$SRC_H5DUMP_TESTFILES/tall-7.ddl
+$SRC_H5DUMP_TESTFILES/tall-7N.ddl
+$SRC_H5DUMP_TESTFILES/tallfilters.ddl
+$SRC_H5DUMP_TESTFILES/tarray1.ddl
+$SRC_H5DUMP_TESTFILES/tarray1_big.ddl
+$SRC_H5DUMP_TESTFILES/tarray2.ddl
+$SRC_H5DUMP_TESTFILES/tarray3.ddl
+$SRC_H5DUMP_TESTFILES/tarray4.ddl
+$SRC_H5DUMP_TESTFILES/tarray5.ddl
+$SRC_H5DUMP_TESTFILES/tarray6.ddl
+$SRC_H5DUMP_TESTFILES/tarray7.ddl
+$SRC_H5DUMP_TESTFILES/tarray8.ddl
+$SRC_H5DUMP_TESTFILES/tattr-1.ddl
+$SRC_H5DUMP_TESTFILES/tattr-2.ddl
+$SRC_H5DUMP_TESTFILES/tattr-3.ddl
+$SRC_H5DUMP_TESTFILES/tattr-4_be.ddl
+$SRC_H5DUMP_TESTFILES/tattrcontents1.ddl
+$SRC_H5DUMP_TESTFILES/tattrcontents2.ddl
+$SRC_H5DUMP_TESTFILES/tattrintsize.ddl
+$SRC_H5DUMP_TESTFILES/tattrreg.ddl
+$SRC_H5DUMP_TESTFILES/tattrregR.ddl
+$SRC_H5DUMP_TESTFILES/tbin1.ddl
+$SRC_H5DUMP_TESTFILES/tbin1.ddl
+$SRC_H5DUMP_TESTFILES/tbin2.ddl
+$SRC_H5DUMP_TESTFILES/tbin3.ddl
+$SRC_H5DUMP_TESTFILES/tbin4.ddl
+$SRC_H5DUMP_TESTFILES/tbinregR.ddl
+$SRC_H5DUMP_TESTFILES/tbigdims.ddl
+$SRC_H5DUMP_TESTFILES/tboot1.ddl
+$SRC_H5DUMP_TESTFILES/tboot2.ddl
+$SRC_H5DUMP_TESTFILES/tboot2A.ddl
+$SRC_H5DUMP_TESTFILES/tboot2B.ddl
+$SRC_H5DUMP_TESTFILES/tchar1.ddl
+$SRC_H5DUMP_TESTFILES/tchunked.ddl
+$SRC_H5DUMP_TESTFILES/tcmpdattrintsize.ddl
+$SRC_H5DUMP_TESTFILES/tcmpdintsize.ddl
+$SRC_H5DUMP_TESTFILES/tcomp-1.ddl
+$SRC_H5DUMP_TESTFILES/tcomp-2.ddl
+$SRC_H5DUMP_TESTFILES/tcomp-3.ddl
+$SRC_H5DUMP_TESTFILES/tcomp-4.ddl
+$SRC_H5DUMP_TESTFILES/tcompound_complex2.ddl
+$SRC_H5DUMP_TESTFILES/tcompact.ddl
+$SRC_H5DUMP_TESTFILES/tcontents.ddl
+$SRC_H5DUMP_TESTFILES/tcontiguos.ddl
+$SRC_H5DUMP_TESTFILES/tdatareg.ddl
+$SRC_H5DUMP_TESTFILES/tdataregR.ddl
+$SRC_H5DUMP_TESTFILES/tdeflate.ddl
+$SRC_H5DUMP_TESTFILES/tdset-1.ddl
+$SRC_H5DUMP_TESTFILES/tdset-2.ddl
+$SRC_H5DUMP_TESTFILES/tdset-3s.ddl
+$SRC_H5DUMP_TESTFILES/tempty.ddl
+$SRC_H5DUMP_TESTFILES/texceedsubstart.ddl
+$SRC_H5DUMP_TESTFILES/texceedsubcount.ddl
+$SRC_H5DUMP_TESTFILES/texceedsubstride.ddl
+$SRC_H5DUMP_TESTFILES/texceedsubblock.ddl
+$SRC_H5DUMP_TESTFILES/texternal.ddl
+$SRC_H5DUMP_TESTFILES/textlinksrc.ddl
+$SRC_H5DUMP_TESTFILES/textlinkfar.ddl
+$SRC_H5DUMP_TESTFILES/textlink.ddl
+$SRC_H5DUMP_TESTFILES/tfamily.ddl
+$SRC_H5DUMP_TESTFILES/tfill.ddl
+$SRC_H5DUMP_TESTFILES/tfletcher32.ddl
+$SRC_H5DUMP_TESTFILES/tfpformat.ddl
+$SRC_H5DUMP_TESTFILES/tgroup-1.ddl
+$SRC_H5DUMP_TESTFILES/tgroup-2.ddl
+$SRC_H5DUMP_TESTFILES/tgrp_comments.ddl
+$SRC_H5DUMP_TESTFILES/thlink-1.ddl
+$SRC_H5DUMP_TESTFILES/thlink-2.ddl
+$SRC_H5DUMP_TESTFILES/thlink-3.ddl
+$SRC_H5DUMP_TESTFILES/thlink-4.ddl
+$SRC_H5DUMP_TESTFILES/thlink-5.ddl
+$SRC_H5DUMP_TESTFILES/thyperslab.ddl
+$SRC_H5DUMP_TESTFILES/tindicesno.ddl
+$SRC_H5DUMP_TESTFILES/tindicessub1.ddl
+$SRC_H5DUMP_TESTFILES/tindicessub2.ddl
+$SRC_H5DUMP_TESTFILES/tindicessub3.ddl
+$SRC_H5DUMP_TESTFILES/tindicessub4.ddl
+$SRC_H5DUMP_TESTFILES/tindicesyes.ddl
+$SRC_H5DUMP_TESTFILES/tints4dims.ddl
+$SRC_H5DUMP_TESTFILES/tints4dimsBlock2.ddl
+$SRC_H5DUMP_TESTFILES/tints4dimsBlockEq.ddl
+$SRC_H5DUMP_TESTFILES/tints4dimsCount2.ddl
+$SRC_H5DUMP_TESTFILES/tints4dimsCountEq.ddl
+$SRC_H5DUMP_TESTFILES/tints4dimsStride2.ddl
+$SRC_H5DUMP_TESTFILES/tintsattrs.ddl
+$SRC_H5DUMP_TESTFILES/tlarge_objname.ddl
+#$SRC_H5DUMP_TESTFILES/tldouble.ddl
+$SRC_H5DUMP_TESTFILES/tlonglinks.ddl
+$SRC_H5DUMP_TESTFILES/tloop-1.ddl
+$SRC_H5DUMP_TESTFILES/tmulti.ddl
+$SRC_H5DUMP_TESTFILES/tmultifile.ddl
+$SRC_H5DUMP_TESTFILES/tqmarkfile.ddl
+$SRC_H5DUMP_TESTFILES/tstarfile.ddl
+$SRC_H5DUMP_TESTFILES/tnamed_dtype_attr.ddl
+$SRC_H5DUMP_TESTFILES/tnestcomp-1.ddl
+$SRC_H5DUMP_TESTFILES/tnestedcmpddt.ddl
+$SRC_H5DUMP_TESTFILES/tnbit.ddl
+$SRC_H5DUMP_TESTFILES/tnoattrdata.ddl
+$SRC_H5DUMP_TESTFILES/tnoattrddl.ddl
+$SRC_H5DUMP_TESTFILES/tnodata.ddl
+$SRC_H5DUMP_TESTFILES/tnoddl.ddl
+$SRC_H5DUMP_TESTFILES/tnoddlfile.ddl
+$SRC_H5DUMP_TESTFILES/tnoddlfile.exp
+$SRC_H5DUMP_TESTFILES/tno-subset.ddl
+$SRC_H5DUMP_TESTFILES/tnullspace.ddl
+$SRC_H5DUMP_TESTFILES/trawdatafile.ddl
+$SRC_H5DUMP_TESTFILES/trawdatafile.exp
+$SRC_H5DUMP_TESTFILES/trawssetfile.ddl
+$SRC_H5DUMP_TESTFILES/trawssetfile.exp
+$SRC_H5DUMP_TESTFILES/zerodim.ddl
+$SRC_H5DUMP_TESTFILES/tordergr1.ddl
+$SRC_H5DUMP_TESTFILES/tordergr2.ddl
+$SRC_H5DUMP_TESTFILES/tordergr3.ddl
+$SRC_H5DUMP_TESTFILES/tordergr4.ddl
+$SRC_H5DUMP_TESTFILES/tordergr5.ddl
+$SRC_H5DUMP_TESTFILES/torderattr1.ddl
+$SRC_H5DUMP_TESTFILES/torderattr2.ddl
+$SRC_H5DUMP_TESTFILES/torderattr3.ddl
+$SRC_H5DUMP_TESTFILES/torderattr4.ddl
+$SRC_H5DUMP_TESTFILES/tordercontents1.ddl
+$SRC_H5DUMP_TESTFILES/tordercontents2.ddl
+$SRC_H5DUMP_TESTFILES/torderlinks1.ddl
+$SRC_H5DUMP_TESTFILES/torderlinks2.ddl
+$SRC_H5DUMP_TESTFILES/tperror.ddl
+$SRC_H5DUMP_TESTFILES/treadfilter.ddl
+$SRC_H5DUMP_TESTFILES/treadintfilter.ddl
+$SRC_H5DUMP_TESTFILES/treference.ddl
+$SRC_H5DUMP_TESTFILES/tsaf.ddl
+$SRC_H5DUMP_TESTFILES/tscalarattrintsize.ddl
+$SRC_H5DUMP_TESTFILES/tscalarintattrsize.ddl
+$SRC_H5DUMP_TESTFILES/tscalarintsize.ddl
+$SRC_H5DUMP_TESTFILES/tscalarstring.ddl
+$SRC_H5DUMP_TESTFILES/tscaleoffset.ddl
+$SRC_H5DUMP_TESTFILES/tshuffle.ddl
+$SRC_H5DUMP_TESTFILES/tslink-1.ddl
+$SRC_H5DUMP_TESTFILES/tslink-2.ddl
+$SRC_H5DUMP_TESTFILES/tslink-D.ddl
+$SRC_H5DUMP_TESTFILES/tsplit_file.ddl
+$SRC_H5DUMP_TESTFILES/tstr-1.ddl
+$SRC_H5DUMP_TESTFILES/tstr-2.ddl
+$SRC_H5DUMP_TESTFILES/tstr2bin2.exp
+$SRC_H5DUMP_TESTFILES/tstr2bin6.exp
+$SRC_H5DUMP_TESTFILES/tstring.ddl
+$SRC_H5DUMP_TESTFILES/tstring2.ddl
+$SRC_H5DUMP_TESTFILES/tstringe.ddl
+$SRC_H5DUMP_TESTFILES/tszip.ddl
+$SRC_H5DUMP_TESTFILES/tudlink-1.ddl
+$SRC_H5DUMP_TESTFILES/tudlink-2.ddl
+$SRC_H5DUMP_TESTFILES/tuserfilter.ddl
+$SRC_H5DUMP_TESTFILES/tvldtypes1.ddl
+$SRC_H5DUMP_TESTFILES/tvldtypes2.ddl
+$SRC_H5DUMP_TESTFILES/tvldtypes3.ddl
+$SRC_H5DUMP_TESTFILES/tvldtypes4.ddl
+$SRC_H5DUMP_TESTFILES/tvldtypes5.ddl
+$SRC_H5DUMP_TESTFILES/tvlenstr_array.ddl
+$SRC_H5DUMP_TESTFILES/tvlstr.ddl
+$SRC_H5DUMP_TESTFILES/tvms.ddl
+$SRC_H5DUMP_TESTFILES/twidedisplay.ddl
+$SRC_H5DUMP_TESTFILES/twithddl.exp
+$SRC_H5DUMP_TESTFILES/twithddlfile.ddl
+$SRC_H5DUMP_TESTFILES/twithddlfile.exp
+$SRC_H5DUMP_TESTFILES/h5dump-help.txt
+$SRC_H5DUMP_TESTFILES/out3.h5import
+$SRC_H5DUMP_TESTFILES/tbinregR.exp
+"
+
+LIST_ERROR_TEST_FILES="
+${SRC_H5DUMP_ERRORFILES}/filter_fail.err
+${SRC_H5DUMP_ERRORFILES}/non_existing.err
+${SRC_H5DUMP_ERRORFILES}/tall-1.err
+${SRC_H5DUMP_ERRORFILES}/tall-2A.err
+${SRC_H5DUMP_ERRORFILES}/tall-2A0.err
+${SRC_H5DUMP_ERRORFILES}/tall-2B.err
+${SRC_H5DUMP_ERRORFILES}/tarray1_big.err
+${SRC_H5DUMP_ERRORFILES}/tattr-3.err
+${SRC_H5DUMP_ERRORFILES}/tattrregR.err
+${SRC_H5DUMP_ERRORFILES}/tcomp-3.err
+${SRC_H5DUMP_ERRORFILES}/tdataregR.err
+${SRC_H5DUMP_ERRORFILES}/tdset-2.err
+${SRC_H5DUMP_ERRORFILES}/texceedsubblock.err
+${SRC_H5DUMP_ERRORFILES}/texceedsubcount.err
+${SRC_H5DUMP_ERRORFILES}/texceedsubstart.err
+${SRC_H5DUMP_ERRORFILES}/texceedsubstride.err
+${SRC_H5DUMP_ERRORFILES}/textlink.err
+${SRC_H5DUMP_ERRORFILES}/textlinkfar.err
+${SRC_H5DUMP_ERRORFILES}/textlinksrc.err
+${SRC_H5DUMP_ERRORFILES}/tgroup-2.err
+${SRC_H5DUMP_ERRORFILES}/torderlinks1.err
+${SRC_H5DUMP_ERRORFILES}/torderlinks2.err
+${SRC_H5DUMP_ERRORFILES}/tperror.err
+${SRC_H5DUMP_ERRORFILES}/tqmarkfile.err
+${SRC_H5DUMP_ERRORFILES}/tslink-D.err
+"
+
+#
+# copy test files and expected output files from source dirs to test dir
+#
+COPY_TESTFILES="$LIST_HDF5_TEST_FILES $LIST_OTHER_TEST_FILES $LIST_ERROR_TEST_FILES"
+
+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
+ # skip cp if srcdir is same as destdir
+ # this occurs when build/test performed in source dir and
+ # make cp fail
+ SDIR=`$DIRNAME $tstfile`
+ INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
+ INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
+ if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
+ $CP -f $tstfile $TESTDIR
+ if [ $? -ne 0 ]; then
+ echo "Error: FAILED to copy $tstfile ."
+
+ # Comment out this to CREATE expected file
+ exit $EXIT_FAILURE
+ fi
+ fi
+ fi
+ done
+}
+
+CLEAN_TESTFILES_AND_TESTDIR()
+{
+ # skip rm if srcdir is same as destdir
+ # this occurs when build/test performed in source dir and
+ # make cp fail
+ SDIR=$SRC_H5DUMP_TESTFILES
+ INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
+ INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
+ if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
+ $RM $TESTDIR
+ fi
+}
+
+# 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.
+# If $1 == ignorecase then do caseless CMP and DIFF.
+# ADD_H5_TEST
+TOOLTEST() {
+ # check if caseless compare and diff requested
+ if [ "$1" = ignorecase ]; then
+ caseless="-i"
+ # replace cmp with diff which runs much longer.
+ xCMP="$DIFF -i"
+ shift
+ else
+ caseless=""
+ # stick with faster cmp if ignorecase is not requested.
+ xCMP="$CMP"
+ fi
+
+ 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 $xCMP $expect $actual > /dev/null 2>&1 ; then
+ echo " PASSED"
+ else
+ echo "*FAILED*"
+ echo " Expected result (*.ddl) differs from actual result (*.out)"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF $caseless $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
+# ADD_H5_EXPORT_TEST
+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 TOOLTEST2 but compares generated file to expected ddl file
+# 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
+# ADD_H5_TEST_EXPORT
+TOOLTEST2A() {
+
+ 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
+ expectmeta="$TESTDIR/$1"
+ actualmeta="$TESTDIR/`basename $1 .exp`.txt"
+ 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 $DIFF $expectdata $actualdata; then
+ if [ ! -f $expectmeta ]; then
+ # Create the expect meta file if it doesn't yet exist.
+ echo " CREATED"
+ cp $actualmeta $expectmeta
+ elif $CMP $expectmeta $actualmeta; then
+ echo " PASSED"
+ else
+ echo "*FAILED*"
+ echo " Expected metafile (*.ddl) differs from actual metafile (*.txt)"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF $expectmeta $actualmeta |sed 's/^/ /'
+ fi
+ 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 $actualmeta
+ fi
+
+}
+
+# same as TOOLTEST2 but only compares the generated data file to the expected data file
+# used for the binary tests that expect a full path in -o with -b
+# ADD_H5_EXPORT_TEST
+TOOLTEST2B() {
+
+ expectdata="$TESTDIR/$1"
+ 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 $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
+
+ # 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
+
+}
+
+# same as TOOLTEST3 but filters error stack output and compares to an error file
+# Extract file name, line number, version and thread IDs because they may be different
+# ADD_H5ERR_MASK_TEST
+TOOLTEST4() {
+
+ expect="$TESTDIR/$1"
+ expect_err="$TESTDIR/`basename $1 .ddl`.err"
+ actual="$TESTDIR/`basename $1 .ddl`.out"
+ actual_err="$TESTDIR/`basename $1 .ddl`.oerr"
+ 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
+ if $CMP $expect_err $actual_ext; then
+ echo " PASSED"
+ else
+ echo "*FAILED*"
+ echo " Expected result (*.err) differs from actual result (*.oerr)"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF $expect_err $actual_ext |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 $actual_err $actual_sav $actual_err_sav
+ fi
+
+}
+
+# same as TOOLTEST4 but disables plugin filter loading
+# silences extra error output on some platforms
+# ADD_H5ERR_MASK_TEST
+TOOLTEST5() {
+
+ expect="$TESTDIR/$1"
+ expect_err="$TESTDIR/`basename $1 .ddl`.err"
+ actual="$TESTDIR/`basename $1 .ddl`.out"
+ actual_err="$TESTDIR/`basename $1 .ddl`.oerr"
+ actual_ext="$TESTDIR/`basename $1 .ddl`.ext"
+ actual_sav=${actual}-sav
+ actual_err_sav=${actual_err}-sav
+ shift
+
+ # Run test.
+ TESTING $DUMPER $@
+ (
+ cd $TESTDIR
+ $ENVCMD $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
+ if $CMP $expect_err $actual_ext; then
+ echo " PASSED"
+ else
+ echo "*FAILED*"
+ echo " Expected result (*.err) differs from actual result (*.oerr)"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF $expect_err $actual_ext |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 $actual_err $actual_sav $actual_err_sav
+ fi
+
+}
+# ADD_HELP_TEST
+TOOLTEST_HELP() {
+
+ expect="$TESTDIR/$1"
+ actual="$TESTDIR/`basename $1 .txt`.out"
+ actual_err="$TESTDIR/`basename $1 .txt`.err"
+ shift
+
+ # Run test.
+ TESTING $DUMPER $@
+ (
+ cd $TESTDIR
+ $RUNSERIAL $DUMPER_BIN "$@"
+ ) >$actual 2>$actual_err
+ cat $actual_err >> $actual
+
+ if [ ! -f $expectdata ]; then
+ # Create the expect data file if it doesn't yet exist.
+ echo " CREATED"
+ cp $actual $expect-CREATED
+ elif $CMP $expect $actual; then
+ echo " PASSED"
+ else
+ echo "*FAILED*"
+ echo " Expected output (*.txt) differs from actual output (*.out)"
+ nerrors="`expr $nerrors + 1`"
+ fi
+
+ # Clean up output file
+ if test -z "$HDF5_NOCLEANUP"; then
+ rm -f $actual $actual_err
+ 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
+
+TOOLTEST_HELP h5dump-help.txt -h
+
+# test data output redirection
+TOOLTEST tnoddl.ddl --enable-error-stack --ddl -y packedbits.h5
+TOOLTEST tnodata.ddl --enable-error-stack --output packedbits.h5
+TOOLTEST tnoattrddl.ddl --enable-error-stack -O -y tattr.h5
+TOOLTEST tnoattrdata.ddl --enable-error-stack -A -o tattr.h5
+TOOLTEST2 trawdatafile.exp --enable-error-stack -y -o trawdatafile.txt packedbits.h5
+TOOLTEST2 tnoddlfile.exp --enable-error-stack -O -y -o tnoddlfile.txt packedbits.h5
+TOOLTEST2A twithddlfile.exp twithddl.exp --enable-error-stack --ddl=twithddl.txt -y -o twithddlfile.txt packedbits.h5
+TOOLTEST2 trawssetfile.exp --enable-error-stack -d "/dset1[1,1;;;]" -y -o trawssetfile.txt tdset.h5
+
+# test for maximum display datasets
+TOOLTEST twidedisplay.ddl --enable-error-stack -w0 packedbits.h5
+
+# test for signed/unsigned datasets
+TOOLTEST packedbits.ddl --enable-error-stack packedbits.h5
+# test for compound signed/unsigned datasets
+TOOLTEST tcmpdintsize.ddl --enable-error-stack tcmpdintsize.h5
+# test for signed/unsigned scalar datasets
+TOOLTEST tscalarintsize.ddl --enable-error-stack tscalarintsize.h5
+# test for signed/unsigned attributes
+TOOLTEST tattrintsize.ddl --enable-error-stack tattrintsize.h5
+# test for compound signed/unsigned attributes
+TOOLTEST tcmpdattrintsize.ddl --enable-error-stack tcmpdattrintsize.h5
+# test for signed/unsigned scalar attributes
+TOOLTEST tscalarattrintsize.ddl --enable-error-stack tscalarattrintsize.h5
+# test for signed/unsigned scalar datasets with attributes
+TOOLTEST tscalarintattrsize.ddl --enable-error-stack tscalarintattrsize.h5
+# test for signed/unsigned datasets attributes
+TOOLTEST tintsattrs.ddl --enable-error-stack tintsattrs.h5
+# test for string scalar dataset attribute
+TOOLTEST tscalarstring.ddl --enable-error-stack tscalarstring.h5
+# test for displaying groups
+TOOLTEST tgroup-1.ddl --enable-error-stack tgroup.h5
+# test for displaying the selected groups
+TOOLTEST4 tgroup-2.ddl --enable-error-stack --group=/g2 --group / -g /y tgroup.h5
+
+# test for displaying simple space datasets
+TOOLTEST tdset-1.ddl --enable-error-stack tdset.h5
+# test for displaying selected datasets
+TOOLTEST4 tdset-2.ddl --enable-error-stack -H -d dset1 -d /dset2 --dataset=dset3 tdset.h5
+
+# test for displaying attributes
+TOOLTEST tattr-1.ddl --enable-error-stack tattr.h5
+# test for displaying the selected attributes of string type and scalar space
+TOOLTEST tattr-2.ddl --enable-error-stack -a "/\/attr1" --attribute /attr4 --attribute=/attr5 tattr.h5
+TOOLTEST tattr-2.ddl --enable-error-stack -N "/\/attr1" --any_path /attr4 --any_path=/attr5 tattr.h5
+# test for header and error messages
+TOOLTEST4 tattr-3.ddl --enable-error-stack --header -a /attr2 --attribute=/attr tattr.h5
+# test for displaying at least 9 attributes on root from a BE machine
+TOOLTEST tattr-4_be.ddl --enable-error-stack tattr4_be.h5
+# test for displaying attributes in shared datatype (also in group and dataset)
+TOOLTEST tnamed_dtype_attr.ddl --enable-error-stack tnamed_dtype_attr.h5
+
+# test for displaying soft links and user-defined links
+TOOLTEST tslink-1.ddl --enable-error-stack tslink.h5
+TOOLTEST tudlink-1.ddl --enable-error-stack tudlink.h5
+# test for displaying the selected link
+TOOLTEST tslink-2.ddl --enable-error-stack -l slink2 tslink.h5
+TOOLTEST tslink-2.ddl --enable-error-stack -N slink2 tslink.h5
+TOOLTEST tudlink-2.ddl --enable-error-stack -l udlink2 tudlink.h5
+# test for displaying dangling soft links
+TOOLTEST4 tslink-D.ddl --enable-error-stack -d /slink1 tslink.h5
+
+# tests for hard links
+TOOLTEST thlink-1.ddl --enable-error-stack thlink.h5
+TOOLTEST thlink-2.ddl --enable-error-stack -d /g1/dset2 --dataset /dset1 --dataset=/g1/g1.1/dset3 thlink.h5
+TOOLTEST thlink-3.ddl --enable-error-stack -d /g1/g1.1/dset3 --dataset /g1/dset2 --dataset=/dset1 thlink.h5
+TOOLTEST thlink-4.ddl --enable-error-stack -g /g1 thlink.h5
+TOOLTEST thlink-4.ddl --enable-error-stack -N /g1 thlink.h5
+TOOLTEST thlink-5.ddl --enable-error-stack -d /dset1 -g /g2 -d /g1/dset2 thlink.h5
+TOOLTEST thlink-5.ddl --enable-error-stack -N /dset1 -N /g2 -N /g1/dset2 thlink.h5
+
+# tests for compound data types
+TOOLTEST tcomp-1.ddl --enable-error-stack tcompound.h5
+# test for named data types
+TOOLTEST tcomp-2.ddl --enable-error-stack -t /type1 --datatype /type2 --datatype=/group1/type3 tcompound.h5
+TOOLTEST tcomp-2.ddl --enable-error-stack -N /type1 --any_path /type2 --any_path=/group1/type3 tcompound.h5
+# test for unamed type
+TOOLTEST4 tcomp-3.ddl --enable-error-stack -t /#6632 -g /group2 tcompound.h5
+# test complicated compound datatype
+TOOLTEST tcomp-4.ddl --enable-error-stack tcompound_complex.h5
+TOOLTEST tcompound_complex.ddl --enable-error-stack tcompound_complex2.h5
+# tests for bitfields and opaque data types
+TOOLTEST tbitnopaque.ddl --enable-error-stack tbitnopaque.h5
+
+#test for the nested compound type
+TOOLTEST tnestcomp-1.ddl --enable-error-stack tnestedcomp.h5
+TOOLTEST tnestedcmpddt.ddl --enable-error-stack tnestedcmpddt.h5
+
+# test for options
+TOOLTEST4 tall-1.ddl --enable-error-stack tall.h5
+TOOLTEST tall-2.ddl --enable-error-stack --header -g /g1/g1.1 -a attr2 tall.h5
+TOOLTEST tall-3.ddl --enable-error-stack -d /g2/dset2.1 -l /g1/g1.2/g1.2.1/slink tall.h5
+TOOLTEST tall-3.ddl --enable-error-stack -N /g2/dset2.1 -N /g1/g1.2/g1.2.1/slink tall.h5
+TOOLTEST tall-7.ddl --enable-error-stack -a attr1 tall.h5
+TOOLTEST tall-7N.ddl --enable-error-stack -N attr1 tall.h5
+
+# test for loop detection
+TOOLTEST tloop-1.ddl --enable-error-stack tloop.h5
+
+# test for string
+TOOLTEST tstr-1.ddl --enable-error-stack tstr.h5
+TOOLTEST tstr-2.ddl --enable-error-stack tstr2.h5
+
+# test for file created by Lib SAF team
+TOOLTEST tsaf.ddl --enable-error-stack tsaf.h5
+
+# test for file with variable length data
+TOOLTEST tvldtypes1.ddl --enable-error-stack tvldtypes1.h5
+TOOLTEST tvldtypes2.ddl --enable-error-stack tvldtypes2.h5
+TOOLTEST tvldtypes3.ddl --enable-error-stack tvldtypes3.h5
+TOOLTEST tvldtypes4.ddl --enable-error-stack tvldtypes4.h5
+TOOLTEST tvldtypes5.ddl --enable-error-stack tvldtypes5.h5
+
+#test for file with variable length string data
+TOOLTEST tvlstr.ddl --enable-error-stack tvlstr.h5
+TOOLTEST tvlenstr_array.ddl --enable-error-stack tvlenstr_array.h5
+
+# test for files with array data
+TOOLTEST tarray1.ddl --enable-error-stack tarray1.h5
+# # added for bug# 2092 - tarray1_big.h
+TOOLTEST4 tarray1_big.ddl --enable-error-stack -R tarray1_big.h5
+TOOLTEST tarray2.ddl --enable-error-stack tarray2.h5
+TOOLTEST tarray3.ddl --enable-error-stack tarray3.h5
+TOOLTEST tarray4.ddl --enable-error-stack tarray4.h5
+TOOLTEST tarray5.ddl --enable-error-stack tarray5.h5
+TOOLTEST tarray6.ddl --enable-error-stack tarray6.h5
+TOOLTEST tarray7.ddl --enable-error-stack tarray7.h5
+TOOLTEST tarray8.ddl --enable-error-stack tarray8.h5
+
+# test for wildcards in filename (does not work with cmake)
+# inconsistent across platforms TOOLTEST3 tstarfile.ddl --enable-error-stack -H -d Dataset1 tarr*.h5
+#TOOLTEST4 tqmarkfile.ddl --enable-error-stack -H -d Dataset1 tarray?.h5
+TOOLTEST tmultifile.ddl --enable-error-stack -H -d Dataset1 tarray2.h5 tarray3.h5 tarray4.h5 tarray5.h5 tarray6.h5 tarray7.h5
+
+# test for files with empty data
+TOOLTEST tempty.ddl --enable-error-stack tempty.h5
+
+# test for files with groups that have comments
+TOOLTEST tgrp_comments.ddl --enable-error-stack tgrp_comments.h5
+
+# test the --filedriver flag
+TOOLTEST tsplit_file.ddl --enable-error-stack --filedriver=split tsplit_file
+TOOLTEST tfamily.ddl --enable-error-stack --filedriver=family tfamily%05d.h5
+TOOLTEST tmulti.ddl --enable-error-stack --filedriver=multi tmulti
+
+# test for files with group names which reach > 1024 bytes in size
+TOOLTEST tlarge_objname.ddl --enable-error-stack -w157 tlarge_objname.h5
+
+# test '-A' to suppress data but print attr's
+TOOLTEST4 tall-2A.ddl --enable-error-stack -A tall.h5
+
+# test '-A' to suppress attr's but print data
+TOOLTEST4 tall-2A0.ddl --enable-error-stack -A 0 tall.h5
+
+# test '-r' to print attributes in ASCII instead of decimal
+TOOLTEST4 tall-2B.ddl --enable-error-stack -A -r tall.h5
+
+# test Subsetting
+TOOLTEST tall-4s.ddl --enable-error-stack --dataset=/g1/g1.1/dset1.1.1 --start=1,1 --stride=2,3 --count=3,2 --block=1,1 tall.h5
+TOOLTEST tall-5s.ddl --enable-error-stack -d "/g1/g1.1/dset1.1.2[0;2;10;]" tall.h5
+TOOLTEST tdset-3s.ddl --enable-error-stack -d "/dset1[1,1;;;]" tdset.h5
+TOOLTEST tno-subset.ddl --enable-error-stack --no-compact-subset -d "AHFINDERDIRECT::ah_centroid_t[0] it=0 tl=0" tno-subset.h5
+
+TOOLTEST tints4dimsCount2.ddl --enable-error-stack -d FourDimInts -s 0,0,0,0 -c 2,2,2,2 tints4dims.h5
+TOOLTEST tints4dimsBlock2.ddl --enable-error-stack -d FourDimInts -s 0,0,0,0 -c 1,1,1,1 -k 2,2,2,2 tints4dims.h5
+TOOLTEST tints4dimsStride2.ddl --enable-error-stack -d FourDimInts -s 0,0,0,0 -S 2,2,2,2 -c 2,2,2,2 tints4dims.h5
+TOOLTEST tints4dimsCountEq.ddl --enable-error-stack -d FourDimInts -s 0,0,0,0 -S 2,2,1,1 -k 1,2,1,1 -c 2,2,4,4 tints4dims.h5
+TOOLTEST tints4dimsBlockEq.ddl --enable-error-stack -d FourDimInts -s 0,0,0,0 -S 2,2,1,1 -c 2,2,1,1 -k 1,2,4,4 tints4dims.h5
+
+# 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
+TOOLTEST tboot1.ddl --enable-error-stack -H -B -d dset tfcontents1.h5
+TOOLTEST tboot2.ddl --enable-error-stack -B tfcontents2.h5
+TOOLTEST tboot2A.ddl --enable-error-stack --boot-block tfcontents2.h5
+TOOLTEST tboot2B.ddl --enable-error-stack --superblock tfcontents2.h5
+TOOLTEST file_space.ddl --enable-error-stack -B file_space.h5
+
+# test -p with a non existing dataset
+TOOLTEST4 tperror.ddl --enable-error-stack -p -d bogus tfcontents1.h5
+
+# test for file contents
+TOOLTEST tcontents.ddl --enable-error-stack -n tfcontents1.h5
+TOOLTEST tordercontents1.ddl --enable-error-stack -n --sort_by=name --sort_order=ascending tfcontents1.h5
+TOOLTEST tordercontents2.ddl --enable-error-stack -n --sort_by=name --sort_order=descending tfcontents1.h5
+TOOLTEST tattrcontents1.ddl --enable-error-stack -n 1 --sort_order=ascending tall.h5
+TOOLTEST tattrcontents2.ddl --enable-error-stack -n 1 --sort_order=descending tall.h5
+
+# tests for storage layout
+# compact
+TOOLTEST tcompact.ddl --enable-error-stack -H -p -d compact tfilters.h5
+# contiguous
+TOOLTEST tcontiguos.ddl --enable-error-stack -H -p -d contiguous tfilters.h5
+# chunked
+TOOLTEST tchunked.ddl --enable-error-stack -H -p -d chunked tfilters.h5
+# external
+TOOLTEST texternal.ddl --enable-error-stack -H -p -d external tfilters.h5
+
+# fill values
+TOOLTEST tfill.ddl --enable-error-stack -p tfvalues.h5
+
+# several datatype, with references , print path
+TOOLTEST treference.ddl --enable-error-stack tattr2.h5
+
+# escape/not escape non printable characters
+TOOLTEST tstringe.ddl --enable-error-stack -e tstr3.h5
+TOOLTEST tstring.ddl --enable-error-stack tstr3.h5
+# char data as ASCII with non escape
+TOOLTEST tstring2.ddl --enable-error-stack -r -d str4 tstr3.h5
+
+# array indices print/not print
+TOOLTEST tindicesyes.ddl --enable-error-stack taindices.h5
+TOOLTEST tindicesno.ddl --enable-error-stack -y taindices.h5
+
+########## array indices with subsetting
+# 1D case
+TOOLTEST tindicessub1.ddl --enable-error-stack -d 1d -s 1 -S 10 -c 2 -k 3 taindices.h5
+
+# 2D case
+TOOLTEST tindicessub2.ddl --enable-error-stack -d 2d -s 1,2 -S 3,3 -c 3,2 -k 2,2 taindices.h5
+
+# 3D case
+TOOLTEST tindicessub3.ddl --enable-error-stack -d 3d -s 0,1,2 -S 1,3,3 -c 2,2,2 -k 1,2,2 taindices.h5
+
+# 4D case
+TOOLTEST tindicessub4.ddl --enable-error-stack -d 4d -s 0,0,1,2 -c 2,2,3,2 -S 1,1,3,3 -k 1,1,2,2 taindices.h5
+
+#Exceed the dimensions for subsetting
+TOOLTEST texceedsubstart.ddl --enable-error-stack -d 1d -s 1,3 taindices.h5
+TOOLTEST texceedsubcount.ddl --enable-error-stack -d 1d -c 1,3 taindices.h5
+TOOLTEST texceedsubstride.ddl --enable-error-stack -d 1d -S 1,3 taindices.h5
+TOOLTEST texceedsubblock.ddl --enable-error-stack -d 1d -k 1,3 taindices.h5
+
+
+# tests for filters
+# SZIP
+TOOLTEST tszip.ddl --enable-error-stack -H -p -d szip tfilters.h5
+# deflate
+TOOLTEST tdeflate.ddl --enable-error-stack -H -p -d deflate tfilters.h5
+# shuffle
+TOOLTEST tshuffle.ddl --enable-error-stack -H -p -d shuffle tfilters.h5
+# fletcher32
+TOOLTEST tfletcher32.ddl --enable-error-stack -H -p -d fletcher32 tfilters.h5
+# nbit
+TOOLTEST tnbit.ddl --enable-error-stack -H -p -d nbit tfilters.h5
+# scaleoffset
+TOOLTEST tscaleoffset.ddl --enable-error-stack -H -p -d scaleoffset tfilters.h5
+# all
+TOOLTEST tallfilters.ddl --enable-error-stack -H -p -d all tfilters.h5
+# user defined
+TOOLTEST tuserfilter.ddl --enable-error-stack -H -p -d myfilter tfilters.h5
+
+if test $USE_FILTER_DEFLATE = "yes" ; then
+ # data read internal filters
+ TOOLTEST treadintfilter.ddl --enable-error-stack -d deflate -d shuffle -d fletcher32 -d nbit -d scaleoffset tfilters.h5
+ if test $USE_FILTER_SZIP = "yes"; then
+ # data read
+ TOOLTEST treadfilter.ddl --enable-error-stack -d all -d szip tfilters.h5
+ fi
+fi
+
+# test for displaying objects with very long names
+TOOLTEST tlonglinks.ddl --enable-error-stack tlonglinks.h5
+
+# dimensions over 4GB, print boundary
+TOOLTEST tbigdims.ddl --enable-error-stack -d dset4gb -s 4294967284 -c 22 tbigdims.h5
+
+# hyperslab read
+TOOLTEST thyperslab.ddl --enable-error-stack thyperslab.h5
+
+
+#
+
+# test for displaying dataset and attribute of null space
+TOOLTEST tnullspace.ddl --enable-error-stack tnullspace.h5
+
+# test for displaying dataset and attribute of space with 0 dimension size
+TOOLTEST zerodim.ddl --enable-error-stack zerodim.h5
+
+# test for long double (some systems do not have long double)
+#TOOLTEST tldouble.ddl --enable-error-stack tldouble.h5
+
+# test for vms
+TOOLTEST tvms.ddl --enable-error-stack tvms.h5
+
+# test for binary output
+TOOLTEST tbin1.ddl --enable-error-stack -d integer -o out1.bin -b LE tbinary.h5
+
+# test for string binary output
+TOOLTEST2B tstr2bin2.exp --enable-error-stack -d /g2/dset2 -b -o tstr2bin2.txt tstr2.h5
+TOOLTEST2B tstr2bin6.exp --enable-error-stack -d /g6/dset6 -b -o tstr2bin6.txt tstr2.h5
+
+# NATIVE default. the NATIVE test can be validated with h5import/h5diff
+TOOLTEST tbin1.ddl --enable-error-stack -d integer -o out1.bin -b tbinary.h5
+IMPORTTEST out1.bin -c out3.h5import -o out1.h5
+DIFFTEST tbinary.h5 out1.h5 /integer /integer
+# Same but use h5dump as input to h5import
+IMPORTTEST out1.bin -c tbin1.ddl -o out1D.h5
+DIFFTEST tbinary.h5 out1D.h5 /integer /integer
+
+TOOLTEST tbin2.ddl --enable-error-stack -b BE -d float -o out2.bin tbinary.h5
+
+# the NATIVE test can be validated with h5import/h5diff
+TOOLTEST tbin3.ddl --enable-error-stack -d integer -o out3.bin -b NATIVE tbinary.h5
+IMPORTTEST out3.bin -c out3.h5import -o out3.h5
+DIFFTEST tbinary.h5 out3.h5 /integer /integer
+# Same but use h5dump as input to h5import
+IMPORTTEST out3.bin -c tbin3.ddl -o out3D.h5
+DIFFTEST tbinary.h5 out3D.h5 /integer /integer
+
+TOOLTEST tbin4.ddl --enable-error-stack -d double -b FILE -o out4.bin tbinary.h5
+
+# Clean up binary output files
+if test -z "$HDF5_NOCLEANUP"; then
+ rm -f out[1-4].bin
+ rm -f out1.h5
+ rm -f out3.h5
+fi
+
+# test for dataset region references
+TOOLTEST tdatareg.ddl --enable-error-stack tdatareg.h5
+TOOLTEST4 tdataregR.ddl --enable-error-stack -R tdatareg.h5
+TOOLTEST tattrreg.ddl --enable-error-stack tattrreg.h5
+TOOLTEST4 tattrregR.ddl --enable-error-stack -R tattrreg.h5
+TOOLTEST2 tbinregR.exp --enable-error-stack -d /Dataset1 -s 0 -R -y -o tbinregR.txt tdatareg.h5
+
+# Clean up text output files
+if test -z "$HDF5_NOCLEANUP"; then
+ rm -f tbinregR.txt
+fi
+
+# tests for group creation order
+# "1" tracked, "2" name, root tracked
+TOOLTEST tordergr1.ddl --enable-error-stack --group=1 --sort_by=creation_order --sort_order=ascending tordergr.h5
+TOOLTEST tordergr2.ddl --enable-error-stack --group=1 --sort_by=creation_order --sort_order=descending tordergr.h5
+TOOLTEST tordergr3.ddl --enable-error-stack -g 2 -q name -z ascending tordergr.h5
+TOOLTEST tordergr4.ddl --enable-error-stack -g 2 -q name -z descending tordergr.h5
+TOOLTEST tordergr5.ddl --enable-error-stack -q creation_order tordergr.h5
+
+# tests for attribute order
+TOOLTEST torderattr1.ddl --enable-error-stack -H --sort_by=name --sort_order=ascending torderattr.h5
+TOOLTEST torderattr2.ddl --enable-error-stack -H --sort_by=name --sort_order=descending torderattr.h5
+TOOLTEST torderattr3.ddl --enable-error-stack -H --sort_by=creation_order --sort_order=ascending torderattr.h5
+TOOLTEST torderattr4.ddl --enable-error-stack -H --sort_by=creation_order --sort_order=descending torderattr.h5
+
+# tests for link references and order
+TOOLTEST4 torderlinks1.ddl --enable-error-stack --sort_by=name --sort_order=ascending tfcontents1.h5
+TOOLTEST4 torderlinks2.ddl --enable-error-stack --sort_by=name --sort_order=descending tfcontents1.h5
+
+# tests for floating point user defined printf format
+TOOLTEST tfpformat.ddl --enable-error-stack -m %.7f tfpformat.h5
+
+# tests for traversal of external links
+TOOLTEST4 textlinksrc.ddl --enable-error-stack textlinksrc.h5
+TOOLTEST4 textlinkfar.ddl --enable-error-stack textlinkfar.h5
+
+# test for dangling external links
+TOOLTEST4 textlink.ddl --enable-error-stack textlink.h5
+
+# test for error stack display (BZ2048)
+TOOLTEST5 filter_fail.ddl --enable-error-stack filter_fail.h5
+
+# test for -o -y for dataset with attributes
+TOOLTEST2 tall-6.exp --enable-error-stack -y -o tall-6.txt -d /g1/g1.1/dset1.1.1 tall.h5
+
+# test for non-existing file
+TOOLTEST3 non_existing.ddl --enable-error-stack tgroup.h5 non_existing.h5
+
+# Clean up temporary files/directories
+CLEAN_TESTFILES_AND_TESTDIR
+
+# 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/test/h5dump/testh5dumppbits.sh.in b/tools/test/h5dump/testh5dumppbits.sh.in
new file mode 100644
index 0000000..92247d3
--- /dev/null
+++ b/tools/test/h5dump/testh5dumppbits.sh.in
@@ -0,0 +1,598 @@
+#! /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
+
+srcdir=@srcdir@
+
+# Determine which filters are available
+USE_FILTER_SZIP="@USE_FILTER_SZIP@"
+USE_FILTER_DEFLATE="@USE_FILTER_DEFLATE@"
+
+TESTNAME=h5dump
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+
+DUMPER=../../src/h5dump/h5dump # The tool name
+DUMPER_BIN=`pwd`/$DUMPER # The path of the tool binary
+
+H5DIFF=../../src/h5diff/h5diff # The h5diff tool name
+H5DIFF_BIN=`pwd`/$H5DIFF # The path of the h5diff tool binary
+
+H5IMPORT=../../src/h5import/h5import # The h5import tool name
+H5IMPORT_BIN=`pwd`/$H5IMPORT # The path of the h5import tool binary
+
+RM='rm -rf'
+CMP='cmp -s'
+DIFF='diff -c'
+CP='cp'
+DIRNAME='dirname'
+LS='ls'
+AWK='awk'
+
+nerrors=0
+verbose=yes
+
+# 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_H5DUMP_ERRORFILES="$srcdir/errfiles"
+SRC_H5DIFF_TESTFILES="$SRC_TOOLS/test/h5diff/testfiles"
+SRC_H5COPY_TESTFILES="$SRC_TOOLS/test/h5copy/testfiles"
+SRC_H5REPACK_TESTFILES="$SRC_TOOLS/test/h5repack/testfiles"
+SRC_H5JAM_TESTFILES="$SRC_TOOLS/test/h5jam/testfiles"
+SRC_H5STAT_TESTFILES="$SRC_TOOLS/test/h5stat/testfiles"
+SRC_H5IMPORT_TESTFILES="$SRC_TOOLS/test/h5import/testfiles"
+
+TEST_P_DIR=./testfiles
+TESTDIR=./testfiles/pbits
+test -d $TEST_P_DIR || mkdir -p $TEST_P_DIR
+test -d $TESTDIR || mkdir -p $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
+$SRC_H5DUMP_TESTFILES/tarray1.h5
+$SRC_H5DUMP_TESTFILES/tcompound.h5
+"
+
+LIST_OTHER_TEST_FILES="
+$SRC_H5DUMP_TESTFILES/pbits/tnofilename-with-packed-bits.ddl
+$SRC_H5DUMP_TESTFILES/pbits/tpbitsArray.ddl
+$SRC_H5DUMP_TESTFILES/pbits/tpbitsCompound.ddl
+$SRC_H5DUMP_TESTFILES/pbits/tpbitsIncomplete.ddl
+$SRC_H5DUMP_TESTFILES/pbits/tpbitsLengthExceeded.ddl
+$SRC_H5DUMP_TESTFILES/pbits/tpbitsCharLengthExceeded.ddl
+$SRC_H5DUMP_TESTFILES/pbits/tpbitsIntLengthExceeded.ddl
+$SRC_H5DUMP_TESTFILES/pbits/tpbitsLongLengthExceeded.ddl
+$SRC_H5DUMP_TESTFILES/pbits/tpbitsLengthPositive.ddl
+$SRC_H5DUMP_TESTFILES/pbits/tpbitsMax.ddl
+$SRC_H5DUMP_TESTFILES/pbits/tpbitsMaxExceeded.ddl
+$SRC_H5DUMP_TESTFILES/pbits/tpbitsOffsetExceeded.ddl
+$SRC_H5DUMP_TESTFILES/pbits/tpbitsCharOffsetExceeded.ddl
+$SRC_H5DUMP_TESTFILES/pbits/tpbitsIntOffsetExceeded.ddl
+$SRC_H5DUMP_TESTFILES/pbits/tpbitsLongOffsetExceeded.ddl
+$SRC_H5DUMP_TESTFILES/pbits/tpbitsOffsetNegative.ddl
+$SRC_H5DUMP_TESTFILES/pbits/tpbitsOverlapped.ddl
+$SRC_H5DUMP_TESTFILES/pbits/tpbitsSigned.ddl
+$SRC_H5DUMP_TESTFILES/pbits/tpbitsUnsigned.ddl
+$SRC_H5DUMP_TESTFILES/pbits/tpbitsSignedInt.ddl
+$SRC_H5DUMP_TESTFILES/pbits/tpbitsUnsignedInt.ddl
+$SRC_H5DUMP_TESTFILES/pbits/tpbitsSignedLong.ddl
+$SRC_H5DUMP_TESTFILES/pbits/tpbitsUnsignedLong.ddl
+$SRC_H5DUMP_TESTFILES/pbits/tpbitsSignedLongLong.ddl
+$SRC_H5DUMP_TESTFILES/pbits/tpbitsUnsignedLongLong.ddl
+$SRC_H5DUMP_TESTFILES/pbits/tpbitsSignedWhole.ddl
+$SRC_H5DUMP_TESTFILES/pbits/tpbitsUnsignedWhole.ddl
+$SRC_H5DUMP_TESTFILES/pbits/tpbitsSignedIntWhole.ddl
+$SRC_H5DUMP_TESTFILES/pbits/tpbitsUnsignedIntWhole.ddl
+$SRC_H5DUMP_TESTFILES/pbits/tpbitsSignedLongWhole.ddl
+$SRC_H5DUMP_TESTFILES/pbits/tpbitsUnsignedLongWhole.ddl
+$SRC_H5DUMP_TESTFILES/pbits/tpbitsSignedLongLongWhole.ddl
+$SRC_H5DUMP_TESTFILES/pbits/tpbitsUnsignedLongLongWhole.ddl
+$SRC_H5DUMP_TESTFILES/pbits/tpbitsSignedLongLongWhole1.ddl
+$SRC_H5DUMP_TESTFILES/pbits/tpbitsUnsignedLongLongWhole1.ddl
+$SRC_H5DUMP_TESTFILES/pbits/tpbitsSignedLongLongWhole63.ddl
+$SRC_H5DUMP_TESTFILES/pbits/tpbitsUnsignedLongLongWhole63.ddl
+$SRC_H5DUMP_TESTFILES/pbits/tpbitsSigned4.ddl
+$SRC_H5DUMP_TESTFILES/pbits/tpbitsUnsigned4.ddl
+$SRC_H5DUMP_TESTFILES/pbits/tpbitsSignedInt8.ddl
+$SRC_H5DUMP_TESTFILES/pbits/tpbitsUnsignedInt8.ddl
+$SRC_H5DUMP_TESTFILES/pbits/tpbitsSignedLong16.ddl
+$SRC_H5DUMP_TESTFILES/pbits/tpbitsUnsignedLong16.ddl
+$SRC_H5DUMP_TESTFILES/pbits/tpbitsSignedLongLong32.ddl
+$SRC_H5DUMP_TESTFILES/pbits/tpbitsUnsignedLongLong32.ddl
+$SRC_H5DUMP_TESTFILES/pbits/tpbitsSigned2.ddl
+$SRC_H5DUMP_TESTFILES/pbits/tpbitsUnsigned2.ddl
+$SRC_H5DUMP_TESTFILES/pbits/tpbitsSignedInt4.ddl
+$SRC_H5DUMP_TESTFILES/pbits/tpbitsUnsignedInt4.ddl
+$SRC_H5DUMP_TESTFILES/pbits/tpbitsSignedLong8.ddl
+$SRC_H5DUMP_TESTFILES/pbits/tpbitsUnsignedLong8.ddl
+$SRC_H5DUMP_TESTFILES/pbits/tpbitsSignedLongLong16.ddl
+$SRC_H5DUMP_TESTFILES/pbits/tpbitsUnsignedLongLong16.ddl
+"
+
+LIST_ERROR_TEST_FILES="
+${SRC_H5DUMP_ERRORFILES}/tnofilename-with-packed-bits.err
+${SRC_H5DUMP_ERRORFILES}/tpbitsCharLengthExceeded.err
+${SRC_H5DUMP_ERRORFILES}/tpbitsCharOffsetExceeded.err
+${SRC_H5DUMP_ERRORFILES}/tpbitsIncomplete.err
+${SRC_H5DUMP_ERRORFILES}/tpbitsIntLengthExceeded.err
+${SRC_H5DUMP_ERRORFILES}/tpbitsIntOffsetExceeded.err
+${SRC_H5DUMP_ERRORFILES}/tpbitsLengthExceeded.err
+${SRC_H5DUMP_ERRORFILES}/tpbitsLengthPositive.err
+${SRC_H5DUMP_ERRORFILES}/tpbitsLongLengthExceeded.err
+${SRC_H5DUMP_ERRORFILES}/tpbitsLongOffsetExceeded.err
+${SRC_H5DUMP_ERRORFILES}/tpbitsMaxExceeded.err
+${SRC_H5DUMP_ERRORFILES}/tpbitsOffsetExceeded.err
+${SRC_H5DUMP_ERRORFILES}/tpbitsOffsetNegative.err
+"
+
+#
+# copy test files and expected output files from source dirs to test dir
+#
+COPY_TESTFILES="$LIST_HDF5_TEST_FILES $LIST_OTHER_TEST_FILES $LIST_ERROR_TEST_FILES"
+
+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
+ # skip cp if srcdir is same as destdir
+ # this occurs when build/test performed in source dir and
+ # make cp fail
+ SDIR=`$DIRNAME $tstfile`
+ INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
+ INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
+ if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
+ $CP -f $tstfile $TESTDIR
+ if [ $? -ne 0 ]; then
+ echo "Error: FAILED to copy $tstfile ."
+
+ # Comment out this to CREATE expected file
+ exit $EXIT_FAILURE
+ fi
+ fi
+ fi
+ done
+}
+
+CLEAN_TESTFILES_AND_TESTDIR()
+{
+ # skip rm if srcdir is same as destdir
+ # this occurs when build/test performed in source dir and
+ # make cp fail
+ SDIR=$SRC_H5DUMP_TESTFILES/pbits
+ INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
+ INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
+ if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
+ $RM $TESTDIR
+ fi
+}
+
+# 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
+
+}
+
+# same as TOOLTEST3 but filters error stack output and compares to an error file
+# Extract file name, line number, version and thread IDs because they may be different
+TOOLTEST4() {
+
+ expect="$TESTDIR/$1"
+ expect_err="$TESTDIR/`basename $1 .ddl`.err"
+ actual="$TESTDIR/`basename $1 .ddl`.out"
+ actual_err="$TESTDIR/`basename $1 .ddl`.oerr"
+ 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
+ if $CMP $expect_err $actual_ext; then
+ echo " PASSED"
+ else
+ echo "*FAILED*"
+ echo " Expected result (*.err) differs from actual result (*.oerr)"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF $expect_err $actual_ext |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 $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
+
+# Clean up temporary files/directories
+CLEAN_TESTFILES_AND_TESTDIR
+
+# 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/test/h5dump/testh5dumpvds.sh.in b/tools/test/h5dump/testh5dumpvds.sh.in
new file mode 100644
index 0000000..459d506
--- /dev/null
+++ b/tools/test/h5dump/testh5dumpvds.sh.in
@@ -0,0 +1,523 @@
+#! /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 vds type files
+
+srcdir=@srcdir@
+
+# Determine which filters are available
+USE_FILTER_SZIP="@USE_FILTER_SZIP@"
+USE_FILTER_DEFLATE="@USE_FILTER_DEFLATE@"
+
+TESTNAME=h5dump
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+
+DUMPER=../../src/h5dump/h5dump # The tool name
+DUMPER_BIN=`pwd`/$DUMPER # The path of the tool binary
+
+H5DIFF=../../src/h5diff/h5diff # The h5diff tool name
+H5DIFF_BIN=`pwd`/$H5DIFF # The path of the h5diff tool binary
+
+H5IMPORT=../../src/h5import/h5import # The h5import tool name
+H5IMPORT_BIN=`pwd`/$H5IMPORT # The path of the h5import tool binary
+
+RM='rm -rf'
+CMP='cmp -s'
+DIFF='diff -c'
+CP='cp'
+DIRNAME='dirname'
+LS='ls'
+AWK='awk'
+
+nerrors=0
+verbose=yes
+
+# 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_H5DUMP_ERRORFILES="$srcdir/errfiles"
+SRC_H5DIFF_TESTFILES="$SRC_TOOLS/test/h5diff/testfiles"
+SRC_H5COPY_TESTFILES="$SRC_TOOLS/test/h5copy/testfiles"
+SRC_H5REPACK_TESTFILES="$SRC_TOOLS/test/h5repack/testfiles"
+SRC_H5JAM_TESTFILES="$SRC_TOOLS/test/h5jam/testfiles"
+SRC_H5STAT_TESTFILES="$SRC_TOOLS/test/h5stat/testfiles"
+SRC_H5IMPORT_TESTFILES="$SRC_TOOLS/test/h5import/testfiles"
+
+TEST_P_DIR=./testfiles
+TESTDIR=./testfiles/vds
+test -d $TEST_P_DIR || mkdir -p $TEST_P_DIR
+test -d $TESTDIR || mkdir -p $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/vds/1_a.h5
+$SRC_H5DUMP_TESTFILES/vds/1_b.h5
+$SRC_H5DUMP_TESTFILES/vds/1_c.h5
+$SRC_H5DUMP_TESTFILES/vds/1_d.h5
+$SRC_H5DUMP_TESTFILES/vds/1_e.h5
+$SRC_H5DUMP_TESTFILES/vds/1_f.h5
+$SRC_H5DUMP_TESTFILES/vds/1_vds.h5
+$SRC_H5DUMP_TESTFILES/vds/2_a.h5
+$SRC_H5DUMP_TESTFILES/vds/2_b.h5
+$SRC_H5DUMP_TESTFILES/vds/2_c.h5
+$SRC_H5DUMP_TESTFILES/vds/2_d.h5
+$SRC_H5DUMP_TESTFILES/vds/2_e.h5
+$SRC_H5DUMP_TESTFILES/vds/2_vds.h5
+$SRC_H5DUMP_TESTFILES/vds/3_1_vds.h5
+$SRC_H5DUMP_TESTFILES/vds/3_2_vds.h5
+$SRC_H5DUMP_TESTFILES/vds/4_0.h5
+$SRC_H5DUMP_TESTFILES/vds/4_1.h5
+$SRC_H5DUMP_TESTFILES/vds/4_2.h5
+$SRC_H5DUMP_TESTFILES/vds/4_vds.h5
+$SRC_H5DUMP_TESTFILES/vds/5_a.h5
+$SRC_H5DUMP_TESTFILES/vds/5_b.h5
+$SRC_H5DUMP_TESTFILES/vds/5_c.h5
+$SRC_H5DUMP_TESTFILES/vds/5_vds.h5
+$SRC_H5DUMP_TESTFILES/vds/a.h5
+$SRC_H5DUMP_TESTFILES/vds/b.h5
+$SRC_H5DUMP_TESTFILES/vds/c.h5
+$SRC_H5DUMP_TESTFILES/vds/d.h5
+$SRC_H5DUMP_TESTFILES/vds/vds-percival-unlim-maxmin.h5
+$SRC_H5DUMP_TESTFILES/vds/f-0.h5
+$SRC_H5DUMP_TESTFILES/vds/f-3.h5
+$SRC_H5DUMP_TESTFILES/vds/vds-eiger.h5
+"
+
+LIST_OTHER_TEST_FILES="
+$SRC_H5DUMP_TESTFILES/vds/tvds-1.ddl
+$SRC_H5DUMP_TESTFILES/vds/tvds-2.ddl
+$SRC_H5DUMP_TESTFILES/vds/tvds-3_1.ddl
+$SRC_H5DUMP_TESTFILES/vds/tvds-3_2.ddl
+$SRC_H5DUMP_TESTFILES/vds/tvds-4.ddl
+$SRC_H5DUMP_TESTFILES/vds/tvds-5.ddl
+$SRC_H5DUMP_TESTFILES/vds/tvds_layout-1.ddl
+$SRC_H5DUMP_TESTFILES/vds/tvds_layout-2.ddl
+$SRC_H5DUMP_TESTFILES/vds/tvds_layout-3_1.ddl
+$SRC_H5DUMP_TESTFILES/vds/tvds_layout-3_2.ddl
+$SRC_H5DUMP_TESTFILES/vds/tvds_layout-4.ddl
+$SRC_H5DUMP_TESTFILES/vds/tvds_layout-5.ddl
+$SRC_H5DUMP_TESTFILES/vds/vds-first.ddl
+$SRC_H5DUMP_TESTFILES/vds/vds-gap1.ddl
+$SRC_H5DUMP_TESTFILES/vds/vds-gap2.ddl
+$SRC_H5DUMP_TESTFILES/vds/vds_layout-eiger.ddl
+$SRC_H5DUMP_TESTFILES/vds/vds_layout-maxmin.ddl
+"
+
+LIST_ERROR_TEST_FILES="
+"
+
+#
+# copy test files and expected output files from source dirs to test dir
+#
+COPY_TESTFILES="$LIST_HDF5_TEST_FILES $LIST_OTHER_TEST_FILES $LIST_ERROR_TEST_FILES"
+
+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
+ # skip cp if srcdir is same as destdir
+ # this occurs when build/test performed in source dir and
+ # make cp fail
+ SDIR=`$DIRNAME $tstfile`
+ INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
+ INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
+ if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
+ $CP -f $tstfile $TESTDIR
+ if [ $? -ne 0 ]; then
+ echo "Error: FAILED to copy $tstfile ."
+
+ # Comment out this to CREATE expected file
+ exit $EXIT_FAILURE
+ fi
+ fi
+ fi
+ done
+}
+
+CLEAN_TESTFILES_AND_TESTDIR()
+{
+ # skip rm if srcdir is same as destdir
+ # this occurs when build/test performed in source dir and
+ # make cp fail
+ SDIR=$SRC_H5DUMP_TESTFILES/vds
+ INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
+ INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
+ if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
+ $RM $TESTDIR
+ fi
+}
+
+# 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
+
+}
+
+# same as TOOLTEST3 but filters error stack output and compares to an error file
+# Extract file name, line number, version and thread IDs because they may be different
+TOOLTEST4() {
+
+ expect="$TESTDIR/$1"
+ expect_err="$TESTDIR/`basename $1 .ddl`.err"
+ actual="$TESTDIR/`basename $1 .ddl`.out"
+ actual_err="$TESTDIR/`basename $1 .ddl`.oerr"
+ 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
+ if $CMP $expect_err $actual_ext; then
+ echo " PASSED"
+ else
+ echo "*FAILED*"
+ echo " Expected result (*.err) differs from actual result (*.oerr)"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF $expect_err $actual_ext |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 $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 vds ######
+
+ # Data read
+if test $USE_FILTER_DEFLATE = "yes" ; then
+ TOOLTEST tvds-1.ddl --enable-error-stack 1_vds.h5
+ TOOLTEST tvds-2.ddl --enable-error-stack 2_vds.h5
+ TOOLTEST tvds-3_1.ddl --enable-error-stack 3_1_vds.h5
+ TOOLTEST tvds-3_2.ddl --enable-error-stack 3_2_vds.h5
+ TOOLTEST tvds-4.ddl --enable-error-stack 4_vds.h5
+ TOOLTEST tvds-5.ddl --enable-error-stack 5_vds.h5
+ TOOLTEST vds-first.ddl --vds-view-first-missing --enable-error-stack vds-percival-unlim-maxmin.h5
+ TOOLTEST vds-gap1.ddl -d /VDS-Eiger --vds-gap-size=1 --enable-error-stack vds-eiger.h5
+ TOOLTEST vds-gap2.ddl --vds-gap-size=2 --enable-error-stack vds-eiger.h5
+fi
+
+ # Layout read
+if test $USE_FILTER_DEFLATE = "yes" ; then
+ TOOLTEST tvds_layout-1.ddl -p --enable-error-stack 1_vds.h5
+ TOOLTEST tvds_layout-2.ddl -p --enable-error-stack 2_vds.h5
+ TOOLTEST tvds_layout-3_1.ddl -p --enable-error-stack 3_1_vds.h5
+ TOOLTEST tvds_layout-3_2.ddl -p --enable-error-stack 3_2_vds.h5
+ TOOLTEST tvds_layout-4.ddl -p --enable-error-stack 4_vds.h5
+ TOOLTEST tvds_layout-5.ddl -p --enable-error-stack 5_vds.h5
+ TOOLTEST vds_layout-eiger.ddl -p --enable-error-stack vds-eiger.h5
+ TOOLTEST vds_layout-maxmin.ddl -p --enable-error-stack vds-percival-unlim-maxmin.h5
+fi
+
+# Clean up temporary files/directories
+CLEAN_TESTFILES_AND_TESTDIR
+
+# 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/test/h5dump/testh5dumpxml.sh.in b/tools/test/h5dump/testh5dumpxml.sh.in
new file mode 100644
index 0000000..638a710
--- /dev/null
+++ b/tools/test/h5dump/testh5dumpxml.sh.in
@@ -0,0 +1,388 @@
+#! /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
+
+srcdir=@srcdir@
+
+TESTNAME=h5dumpxml
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+
+DUMPER=../../src/h5dump/h5dump # The tool name
+DUMPER_BIN=`pwd`/$DUMPER # The path of the tool binary
+
+RM='rm -rf'
+CMP='cmp -s'
+DIFF='diff -c'
+CP='cp'
+DIRNAME='dirname'
+LS='ls'
+AWK='awk'
+
+nerrors=0
+verbose=yes
+
+# 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/test/h5diff/testfiles"
+SRC_H5COPY_TESTFILES="$SRC_TOOLS/test/h5copy/testfiles"
+SRC_H5REPACK_TESTFILES="$SRC_TOOLS/test/h5repack/testfiles"
+SRC_H5JAM_TESTFILES="$SRC_TOOLS/test/h5jam/testfiles"
+SRC_H5STAT_TESTFILES="$SRC_TOOLS/test/h5stat/testfiles"
+SRC_H5IMPORT_TESTFILES="$SRC_TOOLS/test/h5import/testfiles"
+
+TEST_P_DIR=./testfiles
+TESTDIR=./testfiles/xml
+test -d $TEST_P_DIR || mkdir -p $TEST_P_DIR
+test -d $TESTDIR || mkdir -p $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
+ # skip cp if srcdir is same as destdir
+ # this occurs when build/test performed in source dir and
+ # make cp fail
+ SDIR=`$DIRNAME $tstfile`
+ INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
+ INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
+ if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
+ $CP -f $tstfile $TESTDIR
+ if [ $? -ne 0 ]; then
+ echo "Error: FAILED to copy $tstfile ."
+
+ # Comment out this to CREATE expected file
+ exit $EXIT_FAILURE
+ fi
+ fi
+ fi
+ done
+}
+
+CLEAN_TESTFILES_AND_TESTDIR()
+{
+ # skip rm if srcdir is same as destdir
+ # this occurs when build/test performed in source dir and
+ # make cp fail
+ SDIR=$SRC_H5DUMP_TESTFILES
+ INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
+ INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
+ if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
+ $RM $TESTDIR
+ fi
+}
+
+# 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 .xml`.out"
+ actual_err="$TESTDIR/`basename $1 .xml`.err"
+ shift
+
+ # Run test.
+ TESTING $DUMPER $@
+ (
+ cd $TESTDIR
+ $RUNSERIAL $DUMPER_BIN "$@"
+ ) >$actual 2>$actual_err
+
+
+ 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 (*.xml) 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
+ fi
+}
+
+# Print a "SKIP" message
+SKIP() {
+ TESTING $DUMPER $@
+ echo " -SKIP-"
+}
+
+
+##############################################################################
+##############################################################################
+### T H E T E S T S ###
+##############################################################################
+##############################################################################
+# prepare for test
+COPY_TESTFILES_TO_TESTDIR
+
+# test XML
+TOOLTEST tall.h5.xml --xml tall.h5
+TOOLTEST tattr.h5.xml --xml tattr.h5
+TOOLTEST tbitfields.h5.xml --xml tbitfields.h5
+TOOLTEST tcompound.h5.xml --xml tcompound.h5
+TOOLTEST tcompound2.h5.xml --xml tcompound2.h5
+TOOLTEST tdatareg.h5.xml --xml tdatareg.h5
+TOOLTEST tdset.h5.xml --xml tdset.h5
+TOOLTEST tdset2.h5.xml --xml tdset2.h5
+TOOLTEST tenum.h5.xml --xml tenum.h5
+TOOLTEST tgroup.h5.xml --xml tgroup.h5
+TOOLTEST thlink.h5.xml --xml thlink.h5
+TOOLTEST tloop.h5.xml --xml tloop.h5
+TOOLTEST tloop2.h5.xml --xml tloop2.h5
+TOOLTEST tmany.h5.xml --xml tmany.h5
+TOOLTEST tnestedcomp.h5.xml --xml tnestedcomp.h5
+TOOLTEST tcompound_complex.h5.xml --xml tcompound_complex.h5
+TOOLTEST tobjref.h5.xml --xml tobjref.h5
+TOOLTEST topaque.h5.xml --xml topaque.h5
+TOOLTEST tslink.h5.xml --xml tslink.h5
+TOOLTEST tudlink.h5.xml --xml tudlink.h5
+TOOLTEST textlink.h5.xml --xml textlink.h5
+TOOLTEST tstr.h5.xml --xml tstr.h5
+TOOLTEST tstr2.h5.xml --xml tstr2.h5
+TOOLTEST tref.h5.xml --xml tref.h5
+TOOLTEST tname-amp.h5.xml --xml tname-amp.h5
+TOOLTEST tname-apos.h5.xml --xml tname-apos.h5
+TOOLTEST tname-gt.h5.xml --xml tname-gt.h5
+TOOLTEST tname-lt.h5.xml --xml tname-lt.h5
+TOOLTEST tname-quot.h5.xml --xml tname-quot.h5
+TOOLTEST tname-sp.h5.xml --xml tname-sp.h5
+TOOLTEST tstring.h5.xml --xml tstring.h5
+TOOLTEST tstring-at.h5.xml --xml tstring-at.h5
+TOOLTEST tref-escapes.h5.xml --xml tref-escapes.h5
+TOOLTEST tref-escapes-at.h5.xml --xml tref-escapes-at.h5
+TOOLTEST tnodata.h5.xml --xml tnodata.h5
+TOOLTEST tarray1.h5.xml --xml tarray1.h5
+TOOLTEST tarray2.h5.xml --xml tarray2.h5
+TOOLTEST tarray3.h5.xml --xml tarray3.h5
+TOOLTEST tarray6.h5.xml --xml tarray6.h5
+TOOLTEST tarray7.h5.xml --xml tarray7.h5
+TOOLTEST tvldtypes1.h5.xml --xml tvldtypes1.h5
+TOOLTEST tvldtypes2.h5.xml --xml tvldtypes2.h5
+TOOLTEST tvldtypes3.h5.xml --xml tvldtypes3.h5
+TOOLTEST tvldtypes4.h5.xml --xml tvldtypes4.h5
+TOOLTEST tvldtypes5.h5.xml --xml tvldtypes5.h5
+TOOLTEST tvlstr.h5.xml --xml tvlstr.h5
+TOOLTEST tsaf.h5.xml --xml tsaf.h5
+TOOLTEST tempty.h5.xml --xml tempty.h5
+TOOLTEST tnamed_dtype_attr.h5.xml --xml tnamed_dtype_attr.h5
+##Test dataset and attribute of null space. Commented out:
+## wait until the XML schema is updated for null space.
+##TOOLTEST tnullspace.h5.xml --xml tnulspace.h5
+
+# other options for xml
+
+TOOLTEST tempty-dtd.h5.xml --xml --use-dtd tempty.h5
+TOOLTEST tempty-dtd-2.h5.xml --xml -u tempty.h5
+TOOLTEST tempty-nons.h5.xml --xml -X ":" tempty.h5
+TOOLTEST tempty-nons-2.h5.xml --xml --xml-ns=":" tempty.h5
+
+## Some of these combinations are syntactically correct but
+## the URLs are dummies
+TOOLTEST tempty-ns.h5.xml --xml -X "thing:" tempty.h5
+TOOLTEST tempty-ns-2.h5.xml --xml --xml-ns="thing:" tempty.h5
+TOOLTEST tempty-nons-uri.h5.xml --xml --xml-ns=":" --xml-dtd="http://somewhere.net" tempty.h5
+TOOLTEST tempty-dtd-uri.h5.xml --xml --use-dtd --xml-dtd="http://somewhere.net" tempty.h5
+
+TOOLTEST tall-2A.h5.xml --xml -A tall.h5
+
+
+# tests for attribute order
+TOOLTEST torderattr1.h5.xml --xml -H --sort_by=name --sort_order=ascending torderattr.h5
+TOOLTEST torderattr2.h5.xml --xml -H --sort_by=name --sort_order=descending torderattr.h5
+TOOLTEST torderattr3.h5.xml --xml -H --sort_by=creation_order --sort_order=ascending torderattr.h5
+TOOLTEST torderattr4.h5.xml --xml -H --sort_by=creation_order --sort_order=descending torderattr.h5
+
+# tests for floating point user defined printf format
+TOOLTEST tfpformat.h5.xml -u -m %.7f tfpformat.h5
+
+# Clean up temporary files/directories
+CLEAN_TESTFILES_AND_TESTDIR
+
+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/test/h5format_convert/CMakeLists.txt b/tools/test/h5format_convert/CMakeLists.txt
new file mode 100644
index 0000000..1d18e9a
--- /dev/null
+++ b/tools/test/h5format_convert/CMakeLists.txt
@@ -0,0 +1,28 @@
+cmake_minimum_required (VERSION 3.1.0)
+PROJECT (HDF5_TOOLS_TEST_H5FC)
+
+#-----------------------------------------------------------------------------
+# Setup include Directories
+#-----------------------------------------------------------------------------
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib)
+
+ # --------------------------------------------------------------------
+ # Add the h5format_convert test executables
+ # --------------------------------------------------------------------
+ add_executable (h5fc_chk_idx ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/h5fc_chk_idx.c)
+ TARGET_NAMING (h5fc_chk_idx STATIC)
+ TARGET_C_PROPERTIES (h5fc_chk_idx STATIC " " " ")
+ target_link_libraries (h5fc_chk_idx ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+ set_target_properties (h5fc_chk_idx PROPERTIES FOLDER tools)
+
+ if (HDF5_BUILD_GENERATORS)
+ add_executable (h5fc_gentest ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/h5fc_gentest.c)
+ TARGET_NAMING (h5fc_gentest STATIC)
+ TARGET_C_PROPERTIES (h5fc_gentest STATIC " " " ")
+ target_link_libraries (h5fc_gentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+ set_target_properties (h5fc_gentest PROPERTIES FOLDER generator/tools)
+
+ #add_test (NAME h5fc_gentest COMMAND $<TARGET_FILE:h5fc_gentest>)
+ endif (HDF5_BUILD_GENERATORS)
+
+ include (CMakeTests.cmake)
diff --git a/tools/test/h5format_convert/CMakeTests.cmake b/tools/test/h5format_convert/CMakeTests.cmake
new file mode 100644
index 0000000..68f9318
--- /dev/null
+++ b/tools/test/h5format_convert/CMakeTests.cmake
@@ -0,0 +1,460 @@
+
+##############################################################################
+##############################################################################
+### T E S T I N G ###
+##############################################################################
+##############################################################################
+
+ # --------------------------------------------------------------------
+ # Copy all the HDF5 files from the test directory into the source directory
+ # --------------------------------------------------------------------
+ set (HDF5_REFERENCE_FILES
+ h5fc_help.ddl
+ h5fc_nooption.ddl
+ h5fc_nonexistfile.ddl
+ h5fc_d_file.ddl
+ h5fc_dname.ddl
+ h5fc_nonexistdset_file.ddl
+ h5fc_v_non_chunked.ddl
+ h5fc_v_bt1.ddl
+ h5fc_v_ndata_bt1.ddl
+ h5fc_v_all.ddl
+ h5fc_v_n_1d.ddl
+ h5fc_v_n_all.ddl
+ h5fc_ext1_i.ddl
+ h5fc_ext1_s.ddl
+ h5fc_ext1_f.ddl
+ h5fc_ext2_if.ddl
+ h5fc_ext2_is.ddl
+ h5fc_ext2_sf.ddl
+ h5fc_ext3_isf.ddl
+ old_h5fc_ext1_i.ddl
+ old_h5fc_ext1_s.ddl
+ old_h5fc_ext1_f.ddl
+ old_h5fc_ext2_if.ddl
+ old_h5fc_ext2_is.ddl
+ old_h5fc_ext2_sf.ddl
+ old_h5fc_ext3_isf.ddl
+ h5fc_v_err.ddl
+ )
+ set (HDF5_REFERENCE_TEST_FILES
+ h5fc_non_v3.h5
+ h5fc_edge_v3.h5
+ h5fc_ext_none.h5
+ old_h5fc_ext_none.h5
+ h5fc_ext1_i.h5
+ h5fc_ext1_s.h5
+ h5fc_ext1_f.h5
+ h5fc_ext2_if.h5
+ h5fc_ext2_is.h5
+ h5fc_ext2_sf.h5
+ h5fc_ext3_isf.h5
+ old_h5fc_ext1_i.h5
+ old_h5fc_ext1_s.h5
+ old_h5fc_ext1_f.h5
+ old_h5fc_ext2_if.h5
+ old_h5fc_ext2_is.h5
+ old_h5fc_ext2_sf.h5
+ old_h5fc_ext3_isf.h5
+ h5fc_err_level.h5
+ )
+
+ file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
+ add_custom_target(h5fc-files ALL COMMENT "Copying files needed by h5fc tests")
+
+ foreach (ddl_file ${HDF5_REFERENCE_FILES})
+ HDFTEST_COPY_FILE("${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/testfiles/${ddl_file}" "${PROJECT_BINARY_DIR}/testfiles/${ddl_file}" "h5fc_files")
+ endforeach (ddl_file ${HDF5_REFERENCE_FILES})
+
+ foreach (h5_file ${HDF5_REFERENCE_TEST_FILES})
+ HDFTEST_COPY_FILE("${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/testfiles/${h5_file}" "${PROJECT_BINARY_DIR}/testfiles/${h5_file}" "h5fc_files")
+ endforeach (h5_file ${HDF5_REFERENCE_TEST_FILES})
+ add_custom_target(h5fc_files ALL COMMENT "Copying files needed by h5fc tests" DEPENDS ${h5fc_files_list})
+
+##############################################################################
+##############################################################################
+### T H E T E S T S M A C R O S ###
+##############################################################################
+##############################################################################
+
+ MACRO (ADD_H5_OUTPUT testname resultfile resultcode testfile)
+ # If using memchecker add tests without using scripts
+ if (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (
+ NAME H5FC-${testname}-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove ./testfiles/outtmp.h5
+ )
+ if (NOT "${last_test}" STREQUAL "")
+ set_tests_properties (H5FC-${testname}-clear-objects PROPERTIES DEPENDS ${last_test})
+ endif (NOT "${last_test}" STREQUAL "")
+ if (NOT "${testfile}" STREQUAL "")
+ add_test (
+ NAME H5FC-${testname}-${testfile}-tmpfile
+ COMMAND ${CMAKE_COMMAND}
+ -E copy_if_different ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/testfiles/${testfile} ./testfiles/outtmp.h5
+ )
+ set_tests_properties (H5FC-${testname}-${testfile}-tmpfile PROPERTIES DEPENDS "H5FC-${testname}-clear-objects")
+ add_test (
+ NAME H5FC-${testname}-${testfile}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5format_convert>"
+ -D "TEST_ARGS=${ARGN};outtmp.h5"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
+ -D "TEST_OUTPUT=${testname}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=${resultfile}"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ set_tests_properties (H5FC-${testname}-${testfile} PROPERTIES DEPENDS "H5FC-${testname}-${testfile}-tmpfile")
+ set (last_test "H5FC-${testname}-${testfile}")
+ else (NOT "${testfile}" STREQUAL "")
+ add_test (
+ NAME H5FC-${testname}-NA
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5format_convert>"
+ -D "TEST_ARGS=${ARGN}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
+ -D "TEST_OUTPUT=${testname}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=${resultfile}"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ set_tests_properties (H5FC-${testname}-NA PROPERTIES DEPENDS "H5FC-${testname}-clear-objects")
+ set (last_test "H5FC-${testname}-NA")
+ endif (NOT "${testfile}" STREQUAL "")
+ endif (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ ENDMACRO (ADD_H5_OUTPUT)
+
+ MACRO (ADD_H5_TEST testname resultcode testfile)
+ # If using memchecker add tests without using scripts
+ if (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (
+ NAME H5FC-${testname}-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove ./testfiles/tmp.h5
+ )
+ if (NOT "${last_test}" STREQUAL "")
+ set_tests_properties (H5FC-${testname}-clear-objects PROPERTIES DEPENDS ${last_test})
+ endif (NOT "${last_test}" STREQUAL "")
+ add_test (
+ NAME H5FC-${testname}-tmpfile
+ COMMAND ${CMAKE_COMMAND}
+ -E copy_if_different ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/testfiles/${testfile} testfiles/tmp.h5
+ )
+ set_tests_properties (H5FC-${testname}-tmpfile PROPERTIES DEPENDS "H5FC-${testname}-clear-objects")
+ add_test (
+ NAME H5FC-${testname}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5format_convert>"
+ -D "TEST_ARGS=${ARGN};./testfiles/tmp.h5"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_OUTPUT=testfiles/${testname}.out"
+ -D "TEST_SKIP_COMPARE=TRUE"
+ -D "TEST_EXPECT=${resultcode}"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ set_tests_properties (H5FC-${testname} PROPERTIES DEPENDS "H5FC-${testname}-tmpfile")
+ set (last_test "H5FC-${testname}")
+ endif (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ ENDMACRO (ADD_H5_TEST)
+
+ MACRO (ADD_H5_CHECK_IDX dependtest testname)
+ # If using memchecker add tests without using scripts
+ if (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (
+ NAME H5FC_CHECK_IDX-${testname}
+ COMMAND "$<TARGET_FILE:h5fc_chk_idx>" "./testfiles/tmp.h5" "${ARGN}"
+ )
+ set_tests_properties (H5FC_CHECK_IDX-${testname} PROPERTIES DEPENDS "H5FC-${dependtest}")
+ endif (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ ENDMACRO (ADD_H5_CHECK_IDX)
+
+ MACRO (ADD_H5_TEST_CHECK_IDX testname resultcode testfile)
+ # If using memchecker add tests without using scripts
+ if (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (
+ NAME H5FC-${testname}-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove ./testfiles/chktmp.h5
+ )
+ if (NOT "${last_test}" STREQUAL "")
+ set_tests_properties (H5FC-${testname}-clear-objects PROPERTIES DEPENDS ${last_test})
+ endif (NOT "${last_test}" STREQUAL "")
+ add_test (
+ NAME H5FC-${testname}-tmpfile
+ COMMAND ${CMAKE_COMMAND}
+ -E copy_if_different ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/testfiles/${testfile} testfiles/chktmp.h5
+ )
+ set_tests_properties (H5FC-${testname}-tmpfile PROPERTIES DEPENDS "H5FC-${testname}-clear-objects")
+ add_test (
+ NAME H5FC-${testname}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5format_convert>"
+ -D "TEST_ARGS=-d;${ARGN};./testfiles/chktmp.h5"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_OUTPUT=testfiles/${testname}.out"
+ -D "TEST_SKIP_COMPARE=TRUE"
+ -D "TEST_EXPECT=${resultcode}"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ set_tests_properties (H5FC-${testname} PROPERTIES DEPENDS "H5FC-${testname}-tmpfile")
+ add_test (
+ NAME H5FC_CHECK_IDX-${testname}
+ COMMAND "$<TARGET_FILE:h5fc_chk_idx>" "./testfiles/chktmp.h5" "${ARGN}"
+ )
+ set_tests_properties (H5FC_CHECK_IDX-${testname} PROPERTIES DEPENDS "H5FC-${testname}")
+ set (last_test "H5FC_CHECK_IDX-${testname}")
+ endif (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ ENDMACRO (ADD_H5_TEST_CHECK_IDX)
+
+ MACRO (ADD_H5_H5DUMP_CHECK testname)
+ # If using memchecker add tests without using scripts
+ if (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (
+ NAME H5FC-${testname}-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove ./testfiles/dmptmp.h5
+ )
+ if (NOT "${last_test}" STREQUAL "")
+ set_tests_properties (H5FC-${testname}-clear-objects PROPERTIES DEPENDS ${last_test})
+ endif (NOT "${last_test}" STREQUAL "")
+ add_test (
+ NAME H5FC-${testname}-tmpfile
+ COMMAND ${CMAKE_COMMAND}
+ -E copy_if_different ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/testfiles/${testname}.h5 testfiles/dmptmp.h5
+ )
+ set_tests_properties (H5FC-${testname}-tmpfile PROPERTIES DEPENDS "H5FC-${testname}-clear-objects")
+ add_test (
+ NAME H5FC-${testname}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5format_convert>"
+ -D "TEST_ARGS=${ARGN};./testfiles/dmptmp.h5"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_OUTPUT=testfiles/${testname}.out"
+ -D "TEST_SKIP_COMPARE=TRUE"
+ -D "TEST_EXPECT=0"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ set_tests_properties (H5FC-${testname} PROPERTIES DEPENDS "H5FC-${testname}-tmpfile")
+ add_test (
+ NAME H5FC_CHECK_DUMP-${testname}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_ARGS:STRING=-BH;./testfiles/dmptmp.h5"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_OUTPUT=testfiles/${testname}.out"
+ -D "TEST_EXPECT=0"
+ -D "TEST_REFERENCE=testfiles/${testname}.ddl"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ set_tests_properties (H5FC_CHECK_DUMP-${testname} PROPERTIES DEPENDS "H5FC-${testname}")
+ set (last_test "H5FC_CHECK_DUMP-${testname}")
+ endif (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ ENDMACRO (ADD_H5_H5DUMP_CHECK)
+
+##############################################################################
+##############################################################################
+### T H E T E S T S ###
+##############################################################################
+##############################################################################
+
+ if (HDF5_ENABLE_USING_MEMCHECKER)
+ # Remove any output file left over from previous test run
+ add_test (
+ NAME H5FC-clearall-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ h5fc_help.out
+ h5fc_help.out.err
+ h5fc_nooption.out
+ h5fc_nooption.out.err
+ h5fc_nonexistfile.out
+ h5fc_nonexistfile.out.err
+ h5fc_d_file.out
+ h5fc_d_file.out.err
+ h5fc_d_file-d.out
+ h5fc_d_file-d.out.err
+ h5fc_dname.out
+ h5fc_dname.out.err
+ h5fc_nonexistdset_file.out
+ h5fc_nonexistdset_file.out.err
+ h5fc_v_non_chunked.out
+ h5fc_v_non_chunked.out.err
+ h5fc_v_bt1.out
+ h5fc_v_bt1.out.err
+ h5fc_v_ndata_bt1.out
+ h5fc_v_ndata_bt1.out.err
+ h5fc_v_all.out
+ h5fc_v_all.out.err
+ h5fc_v_n_1d.out
+ h5fc_v_n_1d.out.err
+ h5fc_v_n_all.out
+ h5fc_v_n_all.out.err
+ h5fc_ext1_i.out
+ h5fc_ext1_i.out.err
+ h5fc_ext1_s.out
+ h5fc_ext1_s.out.err
+ h5fc_ext1_f.out
+ h5fc_ext1_f.out.err
+ h5fc_ext2_if.out
+ h5fc_ext2_if.out.err
+ h5fc_ext2_is.out
+ h5fc_ext2_is.out.err
+ h5fc_ext2_sf.out
+ h5fc_ext2_sf.out.err
+ h5fc_ext3_isf.out
+ h5fc_ext3_isf.out.err
+ old_h5fc_ext1_i.out
+ old_h5fc_ext1_i.out.err
+ old_h5fc_ext1_s.out
+ old_h5fc_ext1_s.out.err
+ old_h5fc_ext1_f.out
+ old_h5fc_ext1_f.out.err
+ old_h5fc_ext2_if.out
+ old_h5fc_ext2_is.out.err
+ old_h5fc_ext2_is.out
+ old_h5fc_ext2_sf.out.err
+ old_h5fc_ext3_isf.out
+ old_h5fc_ext3_isf.out.err
+ outtmp.h5
+ tmp.h5
+ chktmp.h5
+ dmptmp.h5
+ )
+ if (NOT "${last_test}" STREQUAL "")
+ set_tests_properties (H5FC-clearall-objects PROPERTIES DEPENDS ${last_test})
+ endif (NOT "${last_test}" STREQUAL "")
+ set (last_test "H5FC-clearall-objects")
+ endif (HDF5_ENABLE_USING_MEMCHECKER)
+
+# h5format_convert --help
+# h5format_convert (no options)
+# h5format_convert nonexist.h5 (no options, file does not exist)
+ ADD_H5_OUTPUT (h5fc_help h5fc_help.ddl 0 "" --help)
+ ADD_H5_OUTPUT (h5fc_nooption h5fc_nooption.ddl 1 "")
+ ADD_H5_OUTPUT (h5fc_nonexistfile h5fc_nonexistfile.ddl 1 "" nonexist.h5)
+#
+#
+# h5format_convert -d old_h5fc_ext_none.h5 (just -d option, file exists)
+# h5format_convert --dname old_h5fc_ext_none.h5 (just --dname option, file exists)
+# h5format_convert --dname (just --dname option)
+# h5format_convert --dname=nonexist old_h5fc_ext_none.h5 (dataset does not exist, file exists)
+ ADD_H5_OUTPUT (h5fc_d_file-d h5fc_d_file.ddl 1 old_h5fc_ext_none.h5 -d)
+ ADD_H5_OUTPUT (h5fc_d_file h5fc_d_file.ddl 1 old_h5fc_ext_none.h5 --dname)
+ ADD_H5_OUTPUT (h5fc_dname h5fc_dname.ddl 1 "" --dname)
+ ADD_H5_OUTPUT (h5fc_nonexistdset_file h5fc_nonexistdset_file.ddl 1 old_h5fc_ext_none.h5 --dname=nonexist)
+#
+#
+#
+# h5format_convert -d /DSET_CONTIGUOUS -v old_h5fc_ext_none.h5 (verbose, contiguous dataset)
+# h5format_convert -d /GROUP/DSET_BT2 --verbose old_h5fc_ext_none.h5 (verbose, bt1 dataset)
+# h5format_convert -d /DSET_NDATA_BT2 -v -n old_h5fc_ext_none.h5 (verbose, noop, bt1+nodata dataset)
+# h5format_convert -v old_h5fc_ext_none.h5 (verbose, all datasets)
+ ADD_H5_OUTPUT (h5fc_v_non_chunked h5fc_v_non_chunked.ddl 0 old_h5fc_ext_none.h5 -d /DSET_CONTIGUOUS -v)
+ ADD_H5_OUTPUT (h5fc_v_bt1 h5fc_v_bt1.ddl 0 old_h5fc_ext_none.h5 -d /GROUP/DSET_BT2 --verbose)
+ ADD_H5_OUTPUT (h5fc_v_ndata_bt1 h5fc_v_ndata_bt1.ddl 0 old_h5fc_ext_none.h5 -d /DSET_NDATA_BT2 -v -n)
+ ADD_H5_OUTPUT (h5fc_v_all h5fc_v_all.ddl 0 old_h5fc_ext_none.h5 -v)
+#
+#
+#
+# h5format_convert -d /DSET_EA -v -n h5fc_ext_none.h5 (verbose, noop, one ea dataset)
+# h5format_convert -v -n h5fc_non_v3.h5 (verbose, noop, all datasets)
+ ADD_H5_OUTPUT (h5fc_v_n_1d h5fc_v_n_1d.ddl 0 h5fc_ext_none.h5 -d /DSET_EA -v -n)
+ ADD_H5_OUTPUT (h5fc_v_n_all h5fc_v_n_all.ddl 0 h5fc_non_v3.h5 -v -n)
+#
+#
+#
+# h5format_convert -v h5fc_err_level.h5 (error encountered in converting the dataset)
+ ADD_H5_OUTPUT (h5fc_v_err h5fc_v_err.ddl 1 h5fc_err_level.h5 -v)
+#
+#
+#
+# No output from tests
+# 1) Use the tool to convert the dataset
+# 2) Verify the chunk indexing type is correct
+# h5format_convert -d /DSET_EA h5fc_ext_none.h5
+# h5format_convert -d /GROUP/DSET_NDATA_EA h5fc_ext_none.h5
+# h5format_convert -d /GROUP/DSET_BT2 h5fc_ext_none.h5
+# h5format_convert -d /DSET_NDATA_BT2 h5fc_ext_none.h5
+# h5format_convert -d /DSET_FA h5fc_ext_none.h5
+# h5format_convert -d /GROUP/DSET_FA h5fc_ext_none.h5
+# h5format_convert -d /DSET_NONE h5fc_ext_none.h5
+# h5format_convert -d /GROUP/DSET_NDATA_NONE h5fc_ext_none.h5
+ ADD_H5_TEST_CHECK_IDX (h5fc_ext_none_EA 0 h5fc_ext_none.h5 /DSET_EA)
+#
+ ADD_H5_TEST_CHECK_IDX (h5fc_ext_none_ND_EA 0 h5fc_ext_none.h5 /GROUP/DSET_NDATA_EA)
+#
+ ADD_H5_TEST_CHECK_IDX (h5fc_ext_none_BT 0 h5fc_ext_none.h5 /GROUP/DSET_BT2)
+#
+ ADD_H5_TEST_CHECK_IDX (h5fc_ext_none_ND_BT 0 h5fc_ext_none.h5 /DSET_NDATA_BT2)
+#
+ ADD_H5_TEST_CHECK_IDX (h5fc_ext_none_FA 0 h5fc_ext_none.h5 /DSET_FA)
+#
+ ADD_H5_TEST_CHECK_IDX (h5fc_ext_none_ND_FA 0 h5fc_ext_none.h5 /GROUP/DSET_NDATA_FA)
+#
+ ADD_H5_TEST_CHECK_IDX (h5fc_ext_none_NONE 0 h5fc_ext_none.h5 /DSET_NONE)
+#
+ ADD_H5_TEST_CHECK_IDX (h5fc_ext_none_ND_NONE 0 h5fc_ext_none.h5 /GROUP/DSET_NDATA_NONE)
+#
+#
+#
+# No output from tests: just check exit code
+# h5format_convert -d /DSET_NDATA_BT2 old_h5fc_ext_none.h5 (v1-btree dataset)
+# h5format_convert -d /DSET_CONTIGUOUS h5fc_non_v3.h5 (non-chunked dataset)
+ ADD_H5_TEST (old_h5fc_ext_none 0 old_h5fc_ext_none.h5 -d /DSET_NDATA_BT2)
+ ADD_H5_TEST (old_h5fc_ext_none_CONT 0 h5fc_non_v3.h5 -d /DSET_CONTIGUOUS)
+#
+#
+#
+# No output from tests: just check exit code
+# h5format_convert -d /GROUP/DSET_BT2 -n h5fc_non_v3.h5 (noop, one dataset)
+# h5format_convert -n h5fc_non_v3.h5 (noop, all datasets)
+ ADD_H5_TEST (h5fc_non_v3_BT 0 h5fc_non_v3.h5 -d /GROUP/DSET_BT2 -n)
+ ADD_H5_TEST (h5fc_non_v3-n 0 h5fc_non_v3.h5 -n)
+#
+#
+#
+# No output from tests: just check exit code
+# h5format_convert h5fc_non_v3.h5
+# 1) convert all datasets
+# 2) verify indexing types
+ ADD_H5_TEST (h5fc_non_v3 0 h5fc_non_v3.h5)
+ ADD_H5_CHECK_IDX (h5fc_non_v3 h5fc_non_v3-NEA /DSET_NDATA_EA)
+ ADD_H5_CHECK_IDX (h5fc_non_v3 h5fc_non_v3-NBT /DSET_NDATA_BT2)
+ ADD_H5_CHECK_IDX (h5fc_non_v3 h5fc_non_v3-BT /GROUP/DSET_BT2)
+ ADD_H5_CHECK_IDX (h5fc_non_v3 h5fc_non_v3-EA /GROUP/DSET_EA)
+#
+#
+#
+# No output from test: just check exit code
+# h5format_convert h5fc_edge_v3.h5
+# 1) convert the chunked dataset (filter, no-filter-edge-chunk)
+# 2) verify the indexing type
+ ADD_H5_TEST_CHECK_IDX (h5fc_edge_v3 0 h5fc_edge_v3.h5 /DSET_EDGE)
+#
+#
+
+# The following test files have messages in the superblock extension.
+# Verify h5dump output for correctness after conversion
+ ADD_H5_H5DUMP_CHECK (h5fc_ext1_i)
+ ADD_H5_H5DUMP_CHECK (h5fc_ext1_s)
+ ADD_H5_H5DUMP_CHECK (h5fc_ext1_f)
+#
+ ADD_H5_H5DUMP_CHECK (h5fc_ext2_if)
+ ADD_H5_H5DUMP_CHECK (h5fc_ext2_is)
+ ADD_H5_H5DUMP_CHECK (h5fc_ext2_sf)
+#
+ ADD_H5_H5DUMP_CHECK (h5fc_ext3_isf)
+#
+#
+#
+ ADD_H5_H5DUMP_CHECK (old_h5fc_ext1_i)
+ ADD_H5_H5DUMP_CHECK (old_h5fc_ext1_s)
+ ADD_H5_H5DUMP_CHECK (old_h5fc_ext1_f)
+#
+ ADD_H5_H5DUMP_CHECK (old_h5fc_ext2_if)
+ ADD_H5_H5DUMP_CHECK (old_h5fc_ext2_is)
+ ADD_H5_H5DUMP_CHECK (old_h5fc_ext2_sf)
+#
+ ADD_H5_H5DUMP_CHECK (old_h5fc_ext3_isf)
diff --git a/tools/test/h5format_convert/Makefile.am b/tools/test/h5format_convert/Makefile.am
new file mode 100644
index 0000000..5779d4d
--- /dev/null
+++ b/tools/test/h5format_convert/Makefile.am
@@ -0,0 +1,43 @@
+#
+# 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.
+##
+## Makefile.am
+## Run automake to generate a Makefile.in from this file.
+#
+# HDF5 Library Makefile(.in)
+#
+
+include $(top_srcdir)/config/commence.am
+
+# Include src directory
+AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib
+
+#test script and program
+TEST_PROG=h5fc_gentest
+TEST_SCRIPT=testh5fc.sh
+
+check_PROGRAMS=$(TEST_PROG) h5fc_chk_idx
+check_SCRIPTS=$(TEST_SCRIPT)
+SCRIPT_DEPEND=../../src/h5format_convert/h5format_convert$(EXEEXT)
+
+# Tell automake to clean h5redeploy script
+CHECK_CLEANFILES+=*.h5
+
+# These were generated by configure. Remove them only when distclean.
+DISTCLEANFILES=testh5fc.sh
+
+# All programs rely on hdf5 library and h5tools library
+LDADD=$(LIBH5TOOLS) $(LIBHDF5)
+
+include $(top_srcdir)/config/conclude.am
diff --git a/tools/test/h5format_convert/h5fc_chk_idx.c b/tools/test/h5format_convert/h5fc_chk_idx.c
new file mode 100644
index 0000000..3a87594
--- /dev/null
+++ b/tools/test/h5format_convert/h5fc_chk_idx.c
@@ -0,0 +1,103 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * A program to verify that the chunk indexing type of a dataset in a file
+ * is version 1 B-tree.
+ * This is to support the testing of the tool "h5format_convert".
+ */
+
+#include "hdf5.h"
+#include "H5private.h"
+#include "h5tools.h"
+
+static void usage(void);
+
+static void
+usage(void)
+{
+ HDfprintf(stdout, "Usage: h5fc_chk_idx file_name dataset_pathname\n");
+} /* usage() */
+
+/*-------------------------------------------------------------------------
+ * Function: main
+ *
+ * Purpose: To check that the chunk indexing type for the dataset in
+ * the file is version 1 B-tree.
+ *
+ * Return: 0 -- the indexing type is version 1 B-tree
+ * 1 -- otherwise
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+main(int argc, char *argv[])
+{
+ char *fname = NULL;
+ char *dname = NULL;
+ hid_t fid = -1;
+ hid_t did = -1;
+ H5D_chunk_index_t idx_type;
+
+ /* h5fc_chk_idx fname dname */
+ if(argc != 3) {
+ usage();
+ HDexit(EXIT_FAILURE);
+ } /* end if */
+
+ /* Duplicate the file name & dataset name */
+ fname = HDstrdup(argv[1]);
+ dname = HDstrdup(argv[2]);
+
+ /* Try opening the file */
+ if((fid = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, (size_t)0)) < 0) {
+ HDfprintf(stderr, "h5fc_chk_idx: unable to open the file\n");
+ HDexit(EXIT_FAILURE);
+ } /* end if */
+
+ /* Open the dataset */
+ if((did = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0) {
+ HDfprintf(stderr, "h5fc_chk_idx: unable to open the dataset\n");
+ HDexit(EXIT_FAILURE);
+ } /* end if */
+
+ /* Get the dataset's chunk indexing type */
+ if(H5Dget_chunk_index_type(did, &idx_type) < 0) {
+ HDfprintf(stderr, "h5fc_chk_idx: unable to get chunk index type for the dataset\n");
+ HDexit(EXIT_FAILURE);
+ } /* end if */
+
+ /* Close the dataset */
+ if(H5Dclose(did) < 0) {
+ HDfprintf(stderr, "h5fc_chk_idx: unable to close the dataset\n");
+ HDexit(EXIT_FAILURE);
+ } /* end if */
+
+ /* Close the file */
+ if(H5Fclose(fid) < 0) {
+ HDfprintf(stderr, "h5fc_chk_idx_type: cannot close the file\n");
+ HDexit(EXIT_FAILURE);
+ } /* end if */
+
+ /* Return success when the chunk indexing type is version 1 B-tree */
+ if(idx_type == H5D_CHUNK_IDX_BTREE)
+ HDexit(EXIT_SUCCESS);
+ else {
+ HDfprintf(stderr, "Error: chunk indexing type is %d\n", idx_type);
+ HDexit(EXIT_FAILURE);
+ } /* end if */
+
+} /* main() */
+
diff --git a/tools/test/h5format_convert/h5fc_gentest.c b/tools/test/h5format_convert/h5fc_gentest.c
new file mode 100644
index 0000000..97def9a
--- /dev/null
+++ b/tools/test/h5format_convert/h5fc_gentest.c
@@ -0,0 +1,812 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Generate the binary hdf5 files for the h5format_convert tests.
+ * Usage: just execute the program without any arguments will
+ * generate all the binary hdf5 files
+ *
+ * If you regenerate the test files (e.g., changing some code,
+ * trying it on a new platform, ...), you need to verify the correctness
+ * of the expected output and update the corresponding *.ddl files.
+ */
+
+#include "hdf5.h"
+#include "H5private.h"
+
+#define NON_V3_FILE "h5fc_non_v3.h5"
+#define EDGE_V3_FILE "h5fc_edge_v3.h5"
+#define ERR_LEVEL_FILE "h5fc_err_level.h5"
+
+const char *FILENAME[] = {
+ "h5fc_ext1_i.h5", /* 0 */
+ "h5fc_ext1_s.h5", /* 1 */
+ "h5fc_ext1_f.h5", /* 2 */
+ "h5fc_ext2_is.h5", /* 3 */
+ "h5fc_ext2_if.h5", /* 4 */
+ "h5fc_ext2_sf.h5", /* 5 */
+ "h5fc_ext3_isf.h5", /* 6 */
+ "h5fc_ext_none.h5", /* 7 */
+ NULL
+};
+
+#define GROUP "GROUP"
+
+#define DSET_COMPACT "DSET_COMPACT"
+#define DSET_CONTIGUOUS "DSET_CONTIGUOUS"
+
+#define DSET_EA "DSET_EA"
+#define DSET_NDATA_EA "DSET_NDATA_EA"
+#define DSET_BT2 "DSET_BT2"
+#define DSET_NDATA_BT2 "DSET_NDATA_BT2"
+#define DSET_FA "DSET_FA"
+#define DSET_NDATA_FA "DSET_NDATA_FA"
+#define DSET_NONE "DSET_NONE"
+#define DSET_NDATA_NONE "DSET_NDATA_NONE"
+
+#define DSET_EDGE "DSET_EDGE"
+#define DSET_ERR "DSET_ERR"
+
+#define ISTORE_IK 64
+#define ISTORE_ERR 1
+
+#define NUM 500
+
+
+/*
+ * Function: gen_non()
+ *
+ * Create empty file with latest-format--this will result in v3 superbock
+ * Close and re-open file with non-latest-format--v3 superblock will result in latest version support:
+ * 1) 1 chunked dataset with extensible array chunk indexing type (without data)
+ * 2) 1 chunked dataset with version 2 B-tree chunk indexing type (with data)
+ * Re-open the file with write+non-latest-format and create:
+ * 3) 1 chunked dataset with version 2 B-tree chunk indexing type (without data)
+ * 4) 1 chunked dataset with extensible array indexing type (with data)
+ * 5) 1 compact and 1 contiguous datasets
+ */
+static void
+gen_non(const char *fname)
+{
+ hid_t fid = -1; /* file id */
+ hid_t fcpl = -1; /* file creation property list */
+ hid_t fapl = -1; /* file access property list */
+ hid_t gid = -1; /* group id */
+ hid_t sid = -1; /* space id */
+ hid_t dcpl = -1; /* dataset creation property id */
+ hid_t did1 = -1, did2 = -1; /* dataset id */
+ hsize_t dims1[1] = {10}; /* dataset dimension */
+ hsize_t dims2[2] = {4, 6}; /* dataset dimension */
+ hsize_t max_dims[2]; /* maximum dataset dimension */
+ hsize_t c_dims[2] = {2, 3}; /* chunk dimension */
+ int i; /* local index variable */
+ int buf[24]; /* data buffer */
+
+ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ goto error;
+ if(H5Pset_shared_mesg_nindexes(fcpl, 4) < 0)
+ goto error;
+ if(H5Pset_istore_k(fcpl, 64) < 0)
+ goto error;
+
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ goto error;
+ if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ goto error;
+
+ /* Create an empty file with latest-format */
+ if((fid = H5Fcreate(fname, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ goto error;
+
+ /* Create a group */
+ if((gid = H5Gcreate2(fid, GROUP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Create data */
+ for(i = 0; i < 24; i++)
+ buf[i] = i;
+
+ /* Set chunk */
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto error;
+ if(H5Pset_chunk(dcpl, 2, c_dims) < 0)
+ goto error;
+
+ /*
+ * Create a chunked dataset with extensible array chunk indexing type (without data)
+ */
+
+ /* Create dataspace */
+ max_dims[0] = 10;
+ max_dims[1] = H5S_UNLIMITED;
+ if((sid = H5Screate_simple(2, dims2, max_dims)) < 0)
+ goto error;
+
+ /* Create the dataset */
+ if((did1 = H5Dcreate2(fid, DSET_NDATA_EA, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Closing */
+ if(H5Sclose(sid) < 0)
+ goto error;
+ if(H5Dclose(did1) < 0)
+ goto error;
+
+ /*
+ * Create a chunked dataset with version 2 B-tree chunk indexing type (with data)
+ */
+
+ /* Create dataspace */
+ max_dims[0] = 10;
+ max_dims[0] = H5S_UNLIMITED;
+ max_dims[1] = H5S_UNLIMITED;
+ if((sid = H5Screate_simple(2, dims2, max_dims)) < 0)
+ goto error;
+
+ /* Create the dataset */
+ if((did1 = H5Dcreate2(gid, DSET_BT2, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Write to the dataset */
+ if(H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ goto error;
+
+ /* Closing */
+ if(H5Sclose(sid) < 0)
+ goto error;
+ if(H5Dclose(did1) < 0)
+ goto error;
+ if(H5Pclose(dcpl) < 0)
+ goto error;
+ if(H5Gclose(gid) < 0)
+ goto error;
+
+
+ /* Open the group */
+ if((gid = H5Gopen2(fid, GROUP, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /*
+ * Create a dataset with version 2 B-btree chunk indexing type (without data)
+ */
+
+ /* Set chunk */
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto error;
+ if(H5Pset_chunk(dcpl, 2, c_dims) < 0)
+ goto error;
+
+ /* Create dataspace */
+ max_dims[0] = H5S_UNLIMITED;
+ max_dims[1] = H5S_UNLIMITED;
+ if((sid = H5Screate_simple(2, dims2, max_dims)) < 0)
+ goto error;
+
+ /* Create the dataset */
+ if((did1 = H5Dcreate2(fid, DSET_NDATA_BT2, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Close the dataspace */
+ if(H5Sclose(sid) < 0)
+ goto error;
+
+ /*
+ * Create a dataset with extensible array chunk indexing type (with data) in the group
+ */
+
+ /* Create dataspace */
+ max_dims[0] = 10;
+ max_dims[1] = H5S_UNLIMITED;
+ if((sid = H5Screate_simple(2, dims2, max_dims)) < 0)
+ goto error;
+
+ /* Create the dataset */
+ if((did2 = H5Dcreate2(gid, DSET_EA, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Write to the dataset */
+ if(H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ goto error;
+
+ /* Closing */
+ if(H5Sclose(sid) < 0)
+ goto error;
+ if(H5Pclose(dcpl) < 0)
+ goto error;
+ if(H5Dclose(did1) < 0)
+ goto error;
+ if(H5Dclose(did2) < 0)
+ goto error;
+
+ /*
+ * Create a compact dataset in the group
+ */
+
+ /* Create dataspace */
+ if((sid = H5Screate_simple(1, dims1, NULL)) < 0)
+ goto error;
+
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto error;
+ if(H5Pset_layout(dcpl, H5D_COMPACT) < 0)
+ goto error;
+
+ /* Create the dataset */
+ if((did1 = H5Dcreate2(gid, DSET_COMPACT, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Closing */
+ if(H5Dclose(did1) < 0)
+ goto error;
+ if(H5Pclose(dcpl) < 0)
+ goto error;
+ if(H5Sclose(sid) < 0)
+ goto error;
+
+ /*
+ * Create a contiguous dataset with (2d with data) in the file
+ */
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto error;
+ if(H5Pset_layout(dcpl, H5D_CONTIGUOUS) < 0)
+ goto error;
+
+ if((sid = H5Screate_simple(2, dims2, NULL)) < 0)
+ goto error;
+
+ /* Create the dataset */
+ if((did2 = H5Dcreate2(fid, DSET_CONTIGUOUS, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+ /* Write to the dataset */
+ if(H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ goto error;
+
+ /* Closing */
+ if(H5Dclose(did2) < 0)
+ goto error;
+ if(H5Pclose(dcpl) < 0)
+ goto error;
+ if(H5Sclose(sid) < 0)
+ goto error;
+
+ if(H5Gclose(gid) < 0)
+ goto error;
+ if(H5Pclose(fcpl) < 0)
+ goto error;
+ if(H5Pclose(fapl) < 0)
+ goto error;
+ if(H5Fclose(fid) < 0)
+ goto error;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Pclose(dcpl);
+ H5Sclose(sid);
+ H5Dclose(did1);
+ H5Dclose(did2);
+ H5Gclose(gid);
+ H5Fclose(fcpl);
+ H5Fclose(fapl);
+ H5Fclose(fid);
+ } H5E_END_TRY;
+
+} /* gen_non() */
+
+/*
+ * Function: gen_edge()
+ *
+ * Create a file with write+latest-format--this will result in v3 superblock+latest version support:
+ * A dataset: chunked, filtered, H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS enabled
+ * (i.e. the dataset does not filter partial edge chunks)
+ */
+static void
+gen_edge(const char *fname)
+{
+ hid_t fid = -1; /* file id */
+ hid_t fapl = -1; /* file access property list */
+ hid_t sid = -1; /* dataspace id */
+ hid_t dcpl = -1; /* dataset creation property id */
+ hid_t did = -1; /* dataset id */
+ hsize_t dims2[2] = {12, 6}; /* Dataset dimensions */
+ hsize_t c_dims[2] = {5, 5}; /* Chunk dimensions */
+ float buf[12][6]; /* Buffer for writing data */
+ int i, j; /* local index variable */
+
+ /* Create a new format file */
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ goto error;
+ if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ goto error;
+ if((fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ goto error;
+
+ /* Set chunk, filter, no-filter-edge-chunk */
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto error;
+ if(H5Pset_chunk(dcpl, 2, c_dims) < 0)
+ goto error;
+ if(H5Pset_deflate(dcpl, 9) < 0)
+ goto error;
+ if(H5Pset_chunk_opts(dcpl, H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS) < 0)
+ goto error;
+
+ /* Create dataspace */
+ if((sid = H5Screate_simple(2, dims2, NULL)) < 0)
+ goto error;
+
+ /* Create the dataset */
+ if((did = H5Dcreate2(fid, DSET_EDGE, H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Create data */
+ for (i = 0; i< 12; i++)
+ for (j = 0; j< 6; j++)
+ buf[i][j] = 100.0F;
+
+ /* Write to the dataset */
+ if(H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ goto error;
+
+ /* Closing */
+ if(H5Pclose(dcpl) < 0)
+ goto error;
+ if(H5Sclose(sid) < 0)
+ goto error;
+ if(H5Dclose(did) < 0)
+ goto error;
+ if(H5Pclose(fapl) < 0)
+ goto error;
+ if(H5Fclose(fid) < 0)
+ goto error;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Pclose(dcpl);
+ H5Sclose(sid);
+ H5Dclose(did);
+ H5Fclose(fid);
+ H5Pclose(fapl);
+ } H5E_END_TRY;
+
+} /* gen_edge() */
+
+
+/*
+ * Function: gen_err_level()
+ *
+ * Generate a file to test the situtation described in HDFFV-9434:
+ * Exceed the limit of v1-btree level
+ *
+ * Create a file with H5Pset_istore_k(fcpl, 1).
+ * Create a chunked dataset with extensible array chunk index and
+ * appends many chunks to the dataset.
+ *
+ * When h5format_convert tries to convert the dataset with
+ * extensive array index in the file to v1-btree chunk index,
+ * it will insert the dataset chunks to the v1-btree chunk index.
+ * The tree will split quickly due to the 'K' value of 1 and the
+ * tree level will eventually hit the maximum: 2^8(256).
+ */
+static void
+gen_err_level(const char *fname)
+{
+ hid_t fid = -1; /* file ID */
+ hid_t fapl = -1; /* file access property list */
+ hid_t fcpl = -1; /* file creation property list */
+ hid_t sid = -1; /* dataspace id */
+ hid_t dcpl = -1; /* dataset creation property list */
+ hid_t did = -1; /* dataset ID */
+ hid_t fsid = -1; /* file dataspace ID */
+ hid_t msid = -1; /* memory dataspace ID */
+ unsigned char *buf = NULL; /* buffer for data */
+ hsize_t dims[2] = {0, 1}; /* dataset dimension sizes */
+ hsize_t max_dims[2] = {1, H5S_UNLIMITED}; /* dataset maximum dimension sizes */
+ hsize_t chunk_dims[2] = {1, 1}; /* chunk dimension sizes */
+ int n = 0; /* local index variable */
+
+ /* Create a new format file */
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ goto error;
+ if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ goto error;
+
+ /* Set 'K' value to 1 in file creation property list */
+ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ goto error;
+ if(H5Pset_istore_k(fcpl, ISTORE_ERR) < 0)
+ goto error;
+
+ /* Initialize data buffer */
+ buf = (unsigned char *)HDmalloc(NUM * sizeof(unsigned char *));
+ HDmemset(buf, 42, NUM * sizeof(unsigned char));
+
+ /* Create the test file */
+ if((fid = H5Fcreate(fname, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ goto error;
+
+ /* Create a chunked dataset with extensible array chunk index */
+ if((sid = H5Screate_simple(2, dims, max_dims)) < 0)
+ goto error;
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto error;
+ if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
+ goto error;
+ if((did = H5Dcreate2(fid, DSET_ERR, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Closing */
+ if(H5Pclose(dcpl) < 0)
+ goto error;
+ if(H5Sclose(sid) < 0)
+ goto error;
+ if(H5Dclose(did) < 0)
+ goto error;
+ if(H5Fclose(fid) < 0)
+ goto error;
+
+ /* Re-open the file */
+ if((fid = H5Fopen(fname, H5F_ACC_RDWR, fapl)) < 0)
+ goto error;
+
+ /* Open the dataset */
+ if((did = H5Dopen2(fid, DSET_ERR, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Loop through appending 1 element at a time */
+ for(n = 0; n < NUM; n++) {
+ hsize_t start[2] = {0, 0};
+ hsize_t count[2] = {1, 1};
+ hsize_t extent[2] = {0, 0};
+
+ start[0] = 0;
+ start[1] = (hsize_t)n;
+ extent[0] = 1;
+ extent[1] = (hsize_t)(n + 1);
+
+ /* Set current dimension sizes for the dataset */
+ if(H5Dset_extent(did, extent) < 0)
+ goto error;
+
+ /* Set up memory dataspace */
+ if((msid = H5Screate_simple(2, count, NULL)) < 0)
+ goto error;
+
+ /* Get file dataspace */
+ if((fsid = H5Dget_space(did)) < 0)
+ goto error;
+
+ if((H5Sselect_hyperslab(fsid, H5S_SELECT_SET, start, NULL, count, NULL)) < 0)
+ goto error;
+
+ /* Write to the dataset */
+ if(H5Dwrite(did, H5T_NATIVE_UCHAR, msid, fsid, H5P_DEFAULT, buf) < 0)
+ goto error;
+
+ if(H5Sclose(fsid) < 0)
+ goto error;
+ if(H5Sclose(msid) < 0)
+ goto error;
+ }
+
+ /* Closing */
+ if(H5Dclose(did) < 0)
+ goto error;
+ if(H5Fclose(fid) < 0)
+ goto error;
+ if(H5Pclose(fapl) < 0)
+ goto error;
+ if(buf) free(buf);
+
+error:
+ H5E_BEGIN_TRY {
+ H5Pclose(dcpl);
+ H5Sclose(sid);
+ H5Dclose(did);
+ H5Sclose(msid);
+ H5Sclose(fsid);
+ H5Fclose(fid);
+ H5Pclose(fapl);
+ H5Pclose(fcpl);
+ } H5E_END_TRY;
+
+} /* gen_err_level() */
+
+/*
+ * Function: gen_ext()
+ *
+ * Create a file with/without latest format with:
+ * 1) 1 contiguous dataset (without data)
+ * 2) 2 chunked datasets with extensible array chunk indexing type (with/without data)
+ * 3) 2 chunked datasets with version 2 B-tree chunk indexing type (with/without data)
+ * 4) 2 chunked datasets with fixed array chunk indexing type (with/without data)
+ * 5) 2 chunked datasets with implicit array chunk indexing type (with/without data)
+ * It will create the file with/without messages in the superblock extension depending
+ * on the parameter "what".
+ */
+static void
+gen_ext(const char *fname, unsigned new_format, unsigned what)
+{
+ hid_t fid = -1; /* file id */
+ hid_t fapl = -1; /* file access property list */
+ hid_t fcpl = -1; /* file creation property list */
+ hid_t gid = -1; /* group id */
+ hid_t sid = -1; /* space id */
+ hid_t dcpl = -1; /* dataset creation property id */
+ hid_t did1 = -1, did2 = -1; /* dataset id */
+ hsize_t dims1[1] = {10}; /* dataset dimension */
+ hsize_t dims2[2] = {4, 6}; /* dataset dimension */
+ hsize_t max_dims[2]; /* maximum dataset dimension */
+ hsize_t c_dims[2] = {2, 3}; /* chunk dimension */
+ int i; /* local index variable */
+ int buf[24]; /* data buffer */
+
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ goto error;
+
+ if(new_format) {
+ /* Create a new format file */
+ if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ goto error;
+ } /* end if */
+
+ /* Create a file creation property list */
+ fcpl = H5Pcreate(H5P_FILE_CREATE);
+
+ /* Generate messages that might be placed in superblock extension */
+ switch(what) {
+ case 0:
+ H5Pset_istore_k(fcpl, ISTORE_IK);
+ break;
+ case 1:
+ H5Pset_shared_mesg_nindexes(fcpl, 4);
+ break;
+ case 2:
+ H5Pset_file_space(fcpl, H5F_FILE_SPACE_ALL_PERSIST, (hsize_t)0);
+ break;
+ case 3:
+ H5Pset_istore_k(fcpl, ISTORE_IK);
+ H5Pset_shared_mesg_nindexes(fcpl, 4);
+ break;
+ case 4:
+ H5Pset_istore_k(fcpl, ISTORE_IK);
+ H5Pset_file_space(fcpl, H5F_FILE_SPACE_DEFAULT, (hsize_t)2);
+ break;
+ case 5:
+ H5Pset_shared_mesg_nindexes(fcpl, 4);
+ H5Pset_file_space(fcpl, H5F_FILE_SPACE_VFD, (hsize_t)0);
+ break;
+ case 6:
+ H5Pset_istore_k(fcpl, ISTORE_IK);
+ H5Pset_shared_mesg_nindexes(fcpl, 4);
+ H5Pset_file_space(fcpl, H5F_FILE_SPACE_AGGR_VFD, (hsize_t)0);
+ break;
+ default:
+ break;
+ }
+
+ /* Create the file */
+ if((fid = H5Fcreate(fname, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ goto error;
+
+ /* Create a group */
+ if((gid = H5Gcreate2(fid, GROUP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Set chunk */
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto error;
+ if(H5Pset_chunk(dcpl, 2, c_dims) < 0)
+ goto error;
+
+
+ /*
+ * Create a contiguous dataset
+ */
+
+ /* Create dataspace */
+ if((sid = H5Screate_simple(1, dims1, NULL)) < 0)
+ goto error;
+
+ /* Create the dataset */
+ if((did1 = H5Dcreate2(fid, DSET_CONTIGUOUS, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Closing */
+ if(H5Sclose(sid) < 0)
+ goto error;
+ if(H5Dclose(did1) < 0)
+ goto error;
+
+ /*
+ * Create 2 chunked datasets with extensible array chunk indexing type
+ * (one with data; one without data)
+ */
+
+ /* Create dataspace */
+ max_dims[0] = 10;
+ max_dims[1] = H5S_UNLIMITED;
+ if((sid = H5Screate_simple(2, dims2, max_dims)) < 0)
+ goto error;
+
+ /* Create the 2 datasets */
+ if((did1 = H5Dcreate2(gid, DSET_NDATA_EA, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
+
+ if((did2 = H5Dcreate2(fid, DSET_EA, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Create data */
+ for(i = 0; i < 24; i++)
+ buf[i] = i;
+
+ /* Write to one dataset */
+ if(H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ goto error;
+
+ /* Closing */
+ if(H5Sclose(sid) < 0)
+ goto error;
+ if(H5Dclose(did1) < 0)
+ goto error;
+ if(H5Dclose(did2) < 0)
+ goto error;
+
+
+ /*
+ * Create 2 chunked datasets with version 2 B-tree chunk indexing type
+ * (one with data; one without data)
+ */
+
+ /* Create dataspace */
+ max_dims[0] = 10;
+ max_dims[0] = H5S_UNLIMITED;
+ max_dims[1] = H5S_UNLIMITED;
+ if((sid = H5Screate_simple(2, dims2, max_dims)) < 0)
+ goto error;
+
+ /* Create the 2 datasets */
+ if((did1 = H5Dcreate2(fid, DSET_NDATA_BT2, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
+
+ if((did2 = H5Dcreate2(gid, DSET_BT2, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Write to one dataset */
+ if(H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ goto error;
+
+ /* Closing */
+ if(H5Sclose(sid) < 0)
+ goto error;
+ if(H5Dclose(did1) < 0)
+ goto error;
+ if(H5Dclose(did2) < 0)
+ goto error;
+
+ /*
+ * Create 2 chunked datasets with fixed array chunk indexing type
+ * (one with data; one without data)
+ */
+
+ /* Create dataspace */
+ max_dims[0] = 20;
+ max_dims[1] = 10;
+ if((sid = H5Screate_simple(2, dims2, max_dims)) < 0)
+ goto error;
+
+ /* Create the datasets */
+ if((did1 = H5Dcreate2(fid, DSET_FA, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
+
+ if((did2 = H5Dcreate2(gid, DSET_NDATA_FA, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Write to the dataset */
+ if(H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ goto error;
+
+ /* Closing */
+ if(H5Sclose(sid) < 0)
+ goto error;
+ if(H5Dclose(did1) < 0)
+ goto error;
+ if(H5Dclose(did2) < 0)
+ goto error;
+
+
+ /*
+ * Create 2 chunked datasets with implicit chunk indexing type
+ * (one with data; one without data)
+ */
+
+ /* Create dataspace */
+ if((sid = H5Screate_simple(2, dims2, NULL)) < 0)
+ goto error;
+
+ /* Set early allocation */
+ if(H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY) < 0)
+ goto error;
+
+ /* Create the 2 datasets */
+ if((did1 = H5Dcreate2(fid, DSET_NONE, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
+
+ if((did2 = H5Dcreate2(gid, DSET_NDATA_NONE, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Write to one dataset */
+ if(H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ goto error;
+
+ /* Closing */
+ if(H5Dclose(did1) < 0)
+ goto error;
+ if(H5Dclose(did2) < 0)
+ goto error;
+ if(H5Sclose(sid) < 0)
+ goto error;
+
+ if(H5Pclose(dcpl) < 0)
+ goto error;
+ if(H5Gclose(gid) < 0)
+ goto error;
+ if(H5Fclose(fid) < 0)
+ goto error;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Pclose(dcpl);
+ H5Sclose(sid);
+ H5Dclose(did1);
+ H5Dclose(did2);
+ H5Gclose(gid);
+ H5Fclose(fid);
+ H5Pclose(fapl);
+ H5Pclose(fcpl);
+ } H5E_END_TRY;
+
+} /* end gen_ext() */
+
+int
+main(void)
+{
+ unsigned i, new_format;
+
+ /* Generate a non-latest-format file with v3 superblock */
+ gen_non(NON_V3_FILE);
+
+ /* Generate a new format file with a no-filter-edge-chunk dataset */
+ gen_edge(EDGE_V3_FILE);
+
+ /* Generate a new format file with 'K' value of 1 in H5Pset_istore_k() */
+ gen_err_level(ERR_LEVEL_FILE);
+
+ /* Generate old/new format file with/without messages in the superblock extension */
+ for(new_format = FALSE; new_format <= TRUE; new_format++) {
+ for(i = 0; i < 8; i++) {
+ char filename[50];
+
+ HDmemset(filename, 0, sizeof(filename));
+ if(!new_format)
+ HDstrcat(filename, "old_");
+ HDstrcat(filename, FILENAME[i]);
+
+ gen_ext(filename, new_format, i);
+ } /* end for */
+ } /* end for */
+
+ return 0;
+} /* end main */
+
diff --git a/tools/test/h5format_convert/testfiles/h5fc_d_file.ddl b/tools/test/h5format_convert/testfiles/h5fc_d_file.ddl
new file mode 100644
index 0000000..38fc432
--- /dev/null
+++ b/tools/test/h5format_convert/testfiles/h5fc_d_file.ddl
@@ -0,0 +1,26 @@
+usage: h5format_convert [OPTIONS] file_name
+ OPTIONS
+ -h, --help Print a usage message and exit
+ -V, --version Print version number and exit
+ -v, --verbose Turn on verbose mode
+ -d dname, --dname=dataset_name Pathname for the dataset
+ -n, --noop Perform all the steps except the actual conversion
+
+Examples of use:
+
+h5format_convert -d /group/dataset file_name
+ Convert the dataset </group/dataset> in the HDF5 file <file_name>:
+ a. chunked dataset: convert the chunk indexing type to version 1 B-tree
+ b. compact/contiguous dataset: downgrade the layout version to 3
+ c. virtual dataset: no action
+
+h5format_convert file_name
+ Convert all datasets in the HDF5 file <file_name>:
+ a. chunked dataset: convert the chunk indexing type to version 1 B-tree
+ b. compact/contiguous dataset: downgrade the layout version to 3
+ c. virtual dataset: no action
+
+h5format_convert -n -d /group/dataset file_name
+ Go through all the steps except the actual conversion when
+ converting the dataset </group/dataset> in the HDF5 file <file_name>.
+h5format_convert error: missing file name
diff --git a/tools/test/h5format_convert/testfiles/h5fc_dname.ddl b/tools/test/h5format_convert/testfiles/h5fc_dname.ddl
new file mode 100644
index 0000000..48564b7
--- /dev/null
+++ b/tools/test/h5format_convert/testfiles/h5fc_dname.ddl
@@ -0,0 +1,26 @@
+usage: h5format_convert [OPTIONS] file_name
+ OPTIONS
+ -h, --help Print a usage message and exit
+ -V, --version Print version number and exit
+ -v, --verbose Turn on verbose mode
+ -d dname, --dname=dataset_name Pathname for the dataset
+ -n, --noop Perform all the steps except the actual conversion
+
+Examples of use:
+
+h5format_convert -d /group/dataset file_name
+ Convert the dataset </group/dataset> in the HDF5 file <file_name>:
+ a. chunked dataset: convert the chunk indexing type to version 1 B-tree
+ b. compact/contiguous dataset: downgrade the layout version to 3
+ c. virtual dataset: no action
+
+h5format_convert file_name
+ Convert all datasets in the HDF5 file <file_name>:
+ a. chunked dataset: convert the chunk indexing type to version 1 B-tree
+ b. compact/contiguous dataset: downgrade the layout version to 3
+ c. virtual dataset: no action
+
+h5format_convert -n -d /group/dataset file_name
+ Go through all the steps except the actual conversion when
+ converting the dataset </group/dataset> in the HDF5 file <file_name>.
+h5format_convert error: No dataset name
diff --git a/tools/test/h5format_convert/testfiles/h5fc_edge_v3.h5 b/tools/test/h5format_convert/testfiles/h5fc_edge_v3.h5
new file mode 100644
index 0000000..ac7dbd3
--- /dev/null
+++ b/tools/test/h5format_convert/testfiles/h5fc_edge_v3.h5
Binary files differ
diff --git a/tools/test/h5format_convert/testfiles/h5fc_err_level.h5 b/tools/test/h5format_convert/testfiles/h5fc_err_level.h5
new file mode 100644
index 0000000..a10e8a4
--- /dev/null
+++ b/tools/test/h5format_convert/testfiles/h5fc_err_level.h5
Binary files differ
diff --git a/tools/test/h5format_convert/testfiles/h5fc_ext1_f.ddl b/tools/test/h5format_convert/testfiles/h5fc_ext1_f.ddl
new file mode 100644
index 0000000..dae9284
--- /dev/null
+++ b/tools/test/h5format_convert/testfiles/h5fc_ext1_f.ddl
@@ -0,0 +1,58 @@
+HDF5 "./testfiles/dmptmp.h5" {
+SUPER_BLOCK {
+ SUPERBLOCK_VERSION 2
+ FREELIST_VERSION 0
+ SYMBOLTABLE_VERSION 0
+ OBJECTHEADER_VERSION 0
+ OFFSET_SIZE 8
+ LENGTH_SIZE 8
+ BTREE_RANK 16
+ BTREE_LEAF 4
+ ISTORE_K 32
+ FILE_SPACE_STRATEGY H5F_FILE_SPACE_ALL
+ FREE_SPACE_THRESHOLD 1
+ USER_BLOCK {
+ USERBLOCK_SIZE 0
+ }
+}
+GROUP "/" {
+ DATASET "DSET_CONTIGUOUS" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 10 ) / ( 10 ) }
+ }
+ DATASET "DSET_EA" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 10, H5S_UNLIMITED ) }
+ }
+ DATASET "DSET_FA" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 20, 10 ) }
+ }
+ DATASET "DSET_NDATA_BT2" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( H5S_UNLIMITED, H5S_UNLIMITED ) }
+ }
+ DATASET "DSET_NONE" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 4, 6 ) }
+ }
+ GROUP "GROUP" {
+ DATASET "DSET_BT2" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( H5S_UNLIMITED, H5S_UNLIMITED ) }
+ }
+ DATASET "DSET_NDATA_EA" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 10, H5S_UNLIMITED ) }
+ }
+ DATASET "DSET_NDATA_FA" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 20, 10 ) }
+ }
+ DATASET "DSET_NDATA_NONE" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 4, 6 ) }
+ }
+ }
+}
+}
diff --git a/tools/test/h5format_convert/testfiles/h5fc_ext1_f.h5 b/tools/test/h5format_convert/testfiles/h5fc_ext1_f.h5
new file mode 100644
index 0000000..68ba2ac
--- /dev/null
+++ b/tools/test/h5format_convert/testfiles/h5fc_ext1_f.h5
Binary files differ
diff --git a/tools/test/h5format_convert/testfiles/h5fc_ext1_i.ddl b/tools/test/h5format_convert/testfiles/h5fc_ext1_i.ddl
new file mode 100644
index 0000000..8ec4656
--- /dev/null
+++ b/tools/test/h5format_convert/testfiles/h5fc_ext1_i.ddl
@@ -0,0 +1,58 @@
+HDF5 "./testfiles/dmptmp.h5" {
+SUPER_BLOCK {
+ SUPERBLOCK_VERSION 2
+ FREELIST_VERSION 0
+ SYMBOLTABLE_VERSION 0
+ OBJECTHEADER_VERSION 0
+ OFFSET_SIZE 8
+ LENGTH_SIZE 8
+ BTREE_RANK 16
+ BTREE_LEAF 4
+ ISTORE_K 64
+ FILE_SPACE_STRATEGY H5F_FILE_SPACE_ALL
+ FREE_SPACE_THRESHOLD 1
+ USER_BLOCK {
+ USERBLOCK_SIZE 0
+ }
+}
+GROUP "/" {
+ DATASET "DSET_CONTIGUOUS" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 10 ) / ( 10 ) }
+ }
+ DATASET "DSET_EA" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 10, H5S_UNLIMITED ) }
+ }
+ DATASET "DSET_FA" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 20, 10 ) }
+ }
+ DATASET "DSET_NDATA_BT2" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( H5S_UNLIMITED, H5S_UNLIMITED ) }
+ }
+ DATASET "DSET_NONE" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 4, 6 ) }
+ }
+ GROUP "GROUP" {
+ DATASET "DSET_BT2" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( H5S_UNLIMITED, H5S_UNLIMITED ) }
+ }
+ DATASET "DSET_NDATA_EA" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 10, H5S_UNLIMITED ) }
+ }
+ DATASET "DSET_NDATA_FA" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 20, 10 ) }
+ }
+ DATASET "DSET_NDATA_NONE" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 4, 6 ) }
+ }
+ }
+}
+}
diff --git a/tools/test/h5format_convert/testfiles/h5fc_ext1_i.h5 b/tools/test/h5format_convert/testfiles/h5fc_ext1_i.h5
new file mode 100644
index 0000000..1a58089
--- /dev/null
+++ b/tools/test/h5format_convert/testfiles/h5fc_ext1_i.h5
Binary files differ
diff --git a/tools/test/h5format_convert/testfiles/h5fc_ext1_s.ddl b/tools/test/h5format_convert/testfiles/h5fc_ext1_s.ddl
new file mode 100644
index 0000000..dae9284
--- /dev/null
+++ b/tools/test/h5format_convert/testfiles/h5fc_ext1_s.ddl
@@ -0,0 +1,58 @@
+HDF5 "./testfiles/dmptmp.h5" {
+SUPER_BLOCK {
+ SUPERBLOCK_VERSION 2
+ FREELIST_VERSION 0
+ SYMBOLTABLE_VERSION 0
+ OBJECTHEADER_VERSION 0
+ OFFSET_SIZE 8
+ LENGTH_SIZE 8
+ BTREE_RANK 16
+ BTREE_LEAF 4
+ ISTORE_K 32
+ FILE_SPACE_STRATEGY H5F_FILE_SPACE_ALL
+ FREE_SPACE_THRESHOLD 1
+ USER_BLOCK {
+ USERBLOCK_SIZE 0
+ }
+}
+GROUP "/" {
+ DATASET "DSET_CONTIGUOUS" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 10 ) / ( 10 ) }
+ }
+ DATASET "DSET_EA" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 10, H5S_UNLIMITED ) }
+ }
+ DATASET "DSET_FA" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 20, 10 ) }
+ }
+ DATASET "DSET_NDATA_BT2" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( H5S_UNLIMITED, H5S_UNLIMITED ) }
+ }
+ DATASET "DSET_NONE" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 4, 6 ) }
+ }
+ GROUP "GROUP" {
+ DATASET "DSET_BT2" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( H5S_UNLIMITED, H5S_UNLIMITED ) }
+ }
+ DATASET "DSET_NDATA_EA" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 10, H5S_UNLIMITED ) }
+ }
+ DATASET "DSET_NDATA_FA" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 20, 10 ) }
+ }
+ DATASET "DSET_NDATA_NONE" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 4, 6 ) }
+ }
+ }
+}
+}
diff --git a/tools/test/h5format_convert/testfiles/h5fc_ext1_s.h5 b/tools/test/h5format_convert/testfiles/h5fc_ext1_s.h5
new file mode 100644
index 0000000..26e9b25
--- /dev/null
+++ b/tools/test/h5format_convert/testfiles/h5fc_ext1_s.h5
Binary files differ
diff --git a/tools/test/h5format_convert/testfiles/h5fc_ext2_if.ddl b/tools/test/h5format_convert/testfiles/h5fc_ext2_if.ddl
new file mode 100644
index 0000000..8ec4656
--- /dev/null
+++ b/tools/test/h5format_convert/testfiles/h5fc_ext2_if.ddl
@@ -0,0 +1,58 @@
+HDF5 "./testfiles/dmptmp.h5" {
+SUPER_BLOCK {
+ SUPERBLOCK_VERSION 2
+ FREELIST_VERSION 0
+ SYMBOLTABLE_VERSION 0
+ OBJECTHEADER_VERSION 0
+ OFFSET_SIZE 8
+ LENGTH_SIZE 8
+ BTREE_RANK 16
+ BTREE_LEAF 4
+ ISTORE_K 64
+ FILE_SPACE_STRATEGY H5F_FILE_SPACE_ALL
+ FREE_SPACE_THRESHOLD 1
+ USER_BLOCK {
+ USERBLOCK_SIZE 0
+ }
+}
+GROUP "/" {
+ DATASET "DSET_CONTIGUOUS" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 10 ) / ( 10 ) }
+ }
+ DATASET "DSET_EA" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 10, H5S_UNLIMITED ) }
+ }
+ DATASET "DSET_FA" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 20, 10 ) }
+ }
+ DATASET "DSET_NDATA_BT2" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( H5S_UNLIMITED, H5S_UNLIMITED ) }
+ }
+ DATASET "DSET_NONE" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 4, 6 ) }
+ }
+ GROUP "GROUP" {
+ DATASET "DSET_BT2" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( H5S_UNLIMITED, H5S_UNLIMITED ) }
+ }
+ DATASET "DSET_NDATA_EA" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 10, H5S_UNLIMITED ) }
+ }
+ DATASET "DSET_NDATA_FA" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 20, 10 ) }
+ }
+ DATASET "DSET_NDATA_NONE" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 4, 6 ) }
+ }
+ }
+}
+}
diff --git a/tools/test/h5format_convert/testfiles/h5fc_ext2_if.h5 b/tools/test/h5format_convert/testfiles/h5fc_ext2_if.h5
new file mode 100644
index 0000000..e5c5e25
--- /dev/null
+++ b/tools/test/h5format_convert/testfiles/h5fc_ext2_if.h5
Binary files differ
diff --git a/tools/test/h5format_convert/testfiles/h5fc_ext2_is.ddl b/tools/test/h5format_convert/testfiles/h5fc_ext2_is.ddl
new file mode 100644
index 0000000..8ec4656
--- /dev/null
+++ b/tools/test/h5format_convert/testfiles/h5fc_ext2_is.ddl
@@ -0,0 +1,58 @@
+HDF5 "./testfiles/dmptmp.h5" {
+SUPER_BLOCK {
+ SUPERBLOCK_VERSION 2
+ FREELIST_VERSION 0
+ SYMBOLTABLE_VERSION 0
+ OBJECTHEADER_VERSION 0
+ OFFSET_SIZE 8
+ LENGTH_SIZE 8
+ BTREE_RANK 16
+ BTREE_LEAF 4
+ ISTORE_K 64
+ FILE_SPACE_STRATEGY H5F_FILE_SPACE_ALL
+ FREE_SPACE_THRESHOLD 1
+ USER_BLOCK {
+ USERBLOCK_SIZE 0
+ }
+}
+GROUP "/" {
+ DATASET "DSET_CONTIGUOUS" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 10 ) / ( 10 ) }
+ }
+ DATASET "DSET_EA" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 10, H5S_UNLIMITED ) }
+ }
+ DATASET "DSET_FA" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 20, 10 ) }
+ }
+ DATASET "DSET_NDATA_BT2" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( H5S_UNLIMITED, H5S_UNLIMITED ) }
+ }
+ DATASET "DSET_NONE" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 4, 6 ) }
+ }
+ GROUP "GROUP" {
+ DATASET "DSET_BT2" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( H5S_UNLIMITED, H5S_UNLIMITED ) }
+ }
+ DATASET "DSET_NDATA_EA" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 10, H5S_UNLIMITED ) }
+ }
+ DATASET "DSET_NDATA_FA" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 20, 10 ) }
+ }
+ DATASET "DSET_NDATA_NONE" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 4, 6 ) }
+ }
+ }
+}
+}
diff --git a/tools/test/h5format_convert/testfiles/h5fc_ext2_is.h5 b/tools/test/h5format_convert/testfiles/h5fc_ext2_is.h5
new file mode 100644
index 0000000..0e3eca7
--- /dev/null
+++ b/tools/test/h5format_convert/testfiles/h5fc_ext2_is.h5
Binary files differ
diff --git a/tools/test/h5format_convert/testfiles/h5fc_ext2_sf.ddl b/tools/test/h5format_convert/testfiles/h5fc_ext2_sf.ddl
new file mode 100644
index 0000000..dae9284
--- /dev/null
+++ b/tools/test/h5format_convert/testfiles/h5fc_ext2_sf.ddl
@@ -0,0 +1,58 @@
+HDF5 "./testfiles/dmptmp.h5" {
+SUPER_BLOCK {
+ SUPERBLOCK_VERSION 2
+ FREELIST_VERSION 0
+ SYMBOLTABLE_VERSION 0
+ OBJECTHEADER_VERSION 0
+ OFFSET_SIZE 8
+ LENGTH_SIZE 8
+ BTREE_RANK 16
+ BTREE_LEAF 4
+ ISTORE_K 32
+ FILE_SPACE_STRATEGY H5F_FILE_SPACE_ALL
+ FREE_SPACE_THRESHOLD 1
+ USER_BLOCK {
+ USERBLOCK_SIZE 0
+ }
+}
+GROUP "/" {
+ DATASET "DSET_CONTIGUOUS" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 10 ) / ( 10 ) }
+ }
+ DATASET "DSET_EA" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 10, H5S_UNLIMITED ) }
+ }
+ DATASET "DSET_FA" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 20, 10 ) }
+ }
+ DATASET "DSET_NDATA_BT2" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( H5S_UNLIMITED, H5S_UNLIMITED ) }
+ }
+ DATASET "DSET_NONE" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 4, 6 ) }
+ }
+ GROUP "GROUP" {
+ DATASET "DSET_BT2" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( H5S_UNLIMITED, H5S_UNLIMITED ) }
+ }
+ DATASET "DSET_NDATA_EA" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 10, H5S_UNLIMITED ) }
+ }
+ DATASET "DSET_NDATA_FA" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 20, 10 ) }
+ }
+ DATASET "DSET_NDATA_NONE" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 4, 6 ) }
+ }
+ }
+}
+}
diff --git a/tools/test/h5format_convert/testfiles/h5fc_ext2_sf.h5 b/tools/test/h5format_convert/testfiles/h5fc_ext2_sf.h5
new file mode 100644
index 0000000..cb15f03
--- /dev/null
+++ b/tools/test/h5format_convert/testfiles/h5fc_ext2_sf.h5
Binary files differ
diff --git a/tools/test/h5format_convert/testfiles/h5fc_ext3_isf.ddl b/tools/test/h5format_convert/testfiles/h5fc_ext3_isf.ddl
new file mode 100644
index 0000000..8ec4656
--- /dev/null
+++ b/tools/test/h5format_convert/testfiles/h5fc_ext3_isf.ddl
@@ -0,0 +1,58 @@
+HDF5 "./testfiles/dmptmp.h5" {
+SUPER_BLOCK {
+ SUPERBLOCK_VERSION 2
+ FREELIST_VERSION 0
+ SYMBOLTABLE_VERSION 0
+ OBJECTHEADER_VERSION 0
+ OFFSET_SIZE 8
+ LENGTH_SIZE 8
+ BTREE_RANK 16
+ BTREE_LEAF 4
+ ISTORE_K 64
+ FILE_SPACE_STRATEGY H5F_FILE_SPACE_ALL
+ FREE_SPACE_THRESHOLD 1
+ USER_BLOCK {
+ USERBLOCK_SIZE 0
+ }
+}
+GROUP "/" {
+ DATASET "DSET_CONTIGUOUS" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 10 ) / ( 10 ) }
+ }
+ DATASET "DSET_EA" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 10, H5S_UNLIMITED ) }
+ }
+ DATASET "DSET_FA" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 20, 10 ) }
+ }
+ DATASET "DSET_NDATA_BT2" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( H5S_UNLIMITED, H5S_UNLIMITED ) }
+ }
+ DATASET "DSET_NONE" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 4, 6 ) }
+ }
+ GROUP "GROUP" {
+ DATASET "DSET_BT2" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( H5S_UNLIMITED, H5S_UNLIMITED ) }
+ }
+ DATASET "DSET_NDATA_EA" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 10, H5S_UNLIMITED ) }
+ }
+ DATASET "DSET_NDATA_FA" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 20, 10 ) }
+ }
+ DATASET "DSET_NDATA_NONE" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 4, 6 ) }
+ }
+ }
+}
+}
diff --git a/tools/test/h5format_convert/testfiles/h5fc_ext3_isf.h5 b/tools/test/h5format_convert/testfiles/h5fc_ext3_isf.h5
new file mode 100644
index 0000000..d46cef4
--- /dev/null
+++ b/tools/test/h5format_convert/testfiles/h5fc_ext3_isf.h5
Binary files differ
diff --git a/tools/test/h5format_convert/testfiles/h5fc_ext_none.h5 b/tools/test/h5format_convert/testfiles/h5fc_ext_none.h5
new file mode 100644
index 0000000..defbcb3
--- /dev/null
+++ b/tools/test/h5format_convert/testfiles/h5fc_ext_none.h5
Binary files differ
diff --git a/tools/test/h5format_convert/testfiles/h5fc_help.ddl b/tools/test/h5format_convert/testfiles/h5fc_help.ddl
new file mode 100644
index 0000000..bc0229c
--- /dev/null
+++ b/tools/test/h5format_convert/testfiles/h5fc_help.ddl
@@ -0,0 +1,25 @@
+usage: h5format_convert [OPTIONS] file_name
+ OPTIONS
+ -h, --help Print a usage message and exit
+ -V, --version Print version number and exit
+ -v, --verbose Turn on verbose mode
+ -d dname, --dname=dataset_name Pathname for the dataset
+ -n, --noop Perform all the steps except the actual conversion
+
+Examples of use:
+
+h5format_convert -d /group/dataset file_name
+ Convert the dataset </group/dataset> in the HDF5 file <file_name>:
+ a. chunked dataset: convert the chunk indexing type to version 1 B-tree
+ b. compact/contiguous dataset: downgrade the layout version to 3
+ c. virtual dataset: no action
+
+h5format_convert file_name
+ Convert all datasets in the HDF5 file <file_name>:
+ a. chunked dataset: convert the chunk indexing type to version 1 B-tree
+ b. compact/contiguous dataset: downgrade the layout version to 3
+ c. virtual dataset: no action
+
+h5format_convert -n -d /group/dataset file_name
+ Go through all the steps except the actual conversion when
+ converting the dataset </group/dataset> in the HDF5 file <file_name>.
diff --git a/tools/test/h5format_convert/testfiles/h5fc_non_v3.h5 b/tools/test/h5format_convert/testfiles/h5fc_non_v3.h5
new file mode 100644
index 0000000..58a340d
--- /dev/null
+++ b/tools/test/h5format_convert/testfiles/h5fc_non_v3.h5
Binary files differ
diff --git a/tools/test/h5format_convert/testfiles/h5fc_nonexistdset_file.ddl b/tools/test/h5format_convert/testfiles/h5fc_nonexistdset_file.ddl
new file mode 100644
index 0000000..39450c0
--- /dev/null
+++ b/tools/test/h5format_convert/testfiles/h5fc_nonexistdset_file.ddl
@@ -0,0 +1 @@
+h5format_convert error: unable to open dataset "nonexist"
diff --git a/tools/test/h5format_convert/testfiles/h5fc_nonexistfile.ddl b/tools/test/h5format_convert/testfiles/h5fc_nonexistfile.ddl
new file mode 100644
index 0000000..706ea9d
--- /dev/null
+++ b/tools/test/h5format_convert/testfiles/h5fc_nonexistfile.ddl
@@ -0,0 +1 @@
+h5format_convert error: unable to open file "nonexist.h5"
diff --git a/tools/test/h5format_convert/testfiles/h5fc_nooption.ddl b/tools/test/h5format_convert/testfiles/h5fc_nooption.ddl
new file mode 100644
index 0000000..bc0229c
--- /dev/null
+++ b/tools/test/h5format_convert/testfiles/h5fc_nooption.ddl
@@ -0,0 +1,25 @@
+usage: h5format_convert [OPTIONS] file_name
+ OPTIONS
+ -h, --help Print a usage message and exit
+ -V, --version Print version number and exit
+ -v, --verbose Turn on verbose mode
+ -d dname, --dname=dataset_name Pathname for the dataset
+ -n, --noop Perform all the steps except the actual conversion
+
+Examples of use:
+
+h5format_convert -d /group/dataset file_name
+ Convert the dataset </group/dataset> in the HDF5 file <file_name>:
+ a. chunked dataset: convert the chunk indexing type to version 1 B-tree
+ b. compact/contiguous dataset: downgrade the layout version to 3
+ c. virtual dataset: no action
+
+h5format_convert file_name
+ Convert all datasets in the HDF5 file <file_name>:
+ a. chunked dataset: convert the chunk indexing type to version 1 B-tree
+ b. compact/contiguous dataset: downgrade the layout version to 3
+ c. virtual dataset: no action
+
+h5format_convert -n -d /group/dataset file_name
+ Go through all the steps except the actual conversion when
+ converting the dataset </group/dataset> in the HDF5 file <file_name>.
diff --git a/tools/test/h5format_convert/testfiles/h5fc_v_all.ddl b/tools/test/h5format_convert/testfiles/h5fc_v_all.ddl
new file mode 100644
index 0000000..a1af831
--- /dev/null
+++ b/tools/test/h5format_convert/testfiles/h5fc_v_all.ddl
@@ -0,0 +1,77 @@
+Process command line options
+Open the file outtmp.h5
+Processing all datasets in the file...
+Going to process dataset:/DSET_CONTIGUOUS...
+Open the dataset
+Retrieve the dataset's layout
+Dataset is a contiguous dataset: downgrade layout version as needed
+Converting the dataset...
+Done
+Close the dataset
+Close the dataset creation property list
+Going to process dataset:/DSET_EA...
+Open the dataset
+Retrieve the dataset's layout
+Dataset is a chunked dataset
+Retrieve the dataset's chunk indexing type
+Dataset's chunk indexing type is already version 1 B-tree: no further action
+Close the dataset
+Close the dataset creation property list
+Going to process dataset:/DSET_FA...
+Open the dataset
+Retrieve the dataset's layout
+Dataset is a chunked dataset
+Retrieve the dataset's chunk indexing type
+Dataset's chunk indexing type is already version 1 B-tree: no further action
+Close the dataset
+Close the dataset creation property list
+Going to process dataset:/DSET_NDATA_BT2...
+Open the dataset
+Retrieve the dataset's layout
+Dataset is a chunked dataset
+Retrieve the dataset's chunk indexing type
+Dataset's chunk indexing type is already version 1 B-tree: no further action
+Close the dataset
+Close the dataset creation property list
+Going to process dataset:/DSET_NONE...
+Open the dataset
+Retrieve the dataset's layout
+Dataset is a chunked dataset
+Retrieve the dataset's chunk indexing type
+Dataset's chunk indexing type is already version 1 B-tree: no further action
+Close the dataset
+Close the dataset creation property list
+Going to process dataset:/GROUP/DSET_BT2...
+Open the dataset
+Retrieve the dataset's layout
+Dataset is a chunked dataset
+Retrieve the dataset's chunk indexing type
+Dataset's chunk indexing type is already version 1 B-tree: no further action
+Close the dataset
+Close the dataset creation property list
+Going to process dataset:/GROUP/DSET_NDATA_EA...
+Open the dataset
+Retrieve the dataset's layout
+Dataset is a chunked dataset
+Retrieve the dataset's chunk indexing type
+Dataset's chunk indexing type is already version 1 B-tree: no further action
+Close the dataset
+Close the dataset creation property list
+Going to process dataset:/GROUP/DSET_NDATA_FA...
+Open the dataset
+Retrieve the dataset's layout
+Dataset is a chunked dataset
+Retrieve the dataset's chunk indexing type
+Dataset's chunk indexing type is already version 1 B-tree: no further action
+Close the dataset
+Close the dataset creation property list
+Going to process dataset:/GROUP/DSET_NDATA_NONE...
+Open the dataset
+Retrieve the dataset's layout
+Dataset is a chunked dataset
+Retrieve the dataset's chunk indexing type
+Dataset's chunk indexing type is already version 1 B-tree: no further action
+Close the dataset
+Close the dataset creation property list
+Processing the file's superblock...
+Close the file
diff --git a/tools/test/h5format_convert/testfiles/h5fc_v_bt1.ddl b/tools/test/h5format_convert/testfiles/h5fc_v_bt1.ddl
new file mode 100644
index 0000000..31de12a
--- /dev/null
+++ b/tools/test/h5format_convert/testfiles/h5fc_v_bt1.ddl
@@ -0,0 +1,12 @@
+Process command line options
+Open the file outtmp.h5
+Going to process dataset: /GROUP/DSET_BT2...
+Open the dataset
+Retrieve the dataset's layout
+Dataset is a chunked dataset
+Retrieve the dataset's chunk indexing type
+Dataset's chunk indexing type is already version 1 B-tree: no further action
+Close the dataset
+Close the dataset creation property list
+Processing the file's superblock...
+Close the file
diff --git a/tools/test/h5format_convert/testfiles/h5fc_v_err.ddl b/tools/test/h5format_convert/testfiles/h5fc_v_err.ddl
new file mode 100644
index 0000000..b671db0
--- /dev/null
+++ b/tools/test/h5format_convert/testfiles/h5fc_v_err.ddl
@@ -0,0 +1,13 @@
+Process command line options
+Open the file outtmp.h5
+Processing all datasets in the file...
+Going to process dataset:/DSET_ERR...
+Open the dataset
+Retrieve the dataset's layout
+Dataset is a chunked dataset
+Retrieve the dataset's chunk indexing type
+Dataset's chunk indexing type is not version 1 B-tree
+Converting the dataset...
+Error encountered
+Close the file
+h5format_convert error: unable to downgrade dataset "/DSET_ERR"
diff --git a/tools/test/h5format_convert/testfiles/h5fc_v_n_1d.ddl b/tools/test/h5format_convert/testfiles/h5fc_v_n_1d.ddl
new file mode 100644
index 0000000..fcdadd8
--- /dev/null
+++ b/tools/test/h5format_convert/testfiles/h5fc_v_n_1d.ddl
@@ -0,0 +1,14 @@
+Process command line options
+It is noop...
+Open the file outtmp.h5
+Going to process dataset: /DSET_EA...
+Open the dataset
+Retrieve the dataset's layout
+Dataset is a chunked dataset
+Retrieve the dataset's chunk indexing type
+Dataset's chunk indexing type is not version 1 B-tree
+Not converting the dataset
+Close the dataset
+Close the dataset creation property list
+Not processing the file's superblock...
+Close the file
diff --git a/tools/test/h5format_convert/testfiles/h5fc_v_n_all.ddl b/tools/test/h5format_convert/testfiles/h5fc_v_n_all.ddl
new file mode 100644
index 0000000..074ce6f
--- /dev/null
+++ b/tools/test/h5format_convert/testfiles/h5fc_v_n_all.ddl
@@ -0,0 +1,56 @@
+Process command line options
+It is noop...
+Open the file outtmp.h5
+Processing all datasets in the file...
+Going to process dataset:/DSET_CONTIGUOUS...
+Open the dataset
+Retrieve the dataset's layout
+Dataset is a contiguous dataset: downgrade layout version as needed
+Not converting the dataset
+Close the dataset
+Close the dataset creation property list
+Going to process dataset:/DSET_NDATA_BT2...
+Open the dataset
+Retrieve the dataset's layout
+Dataset is a chunked dataset
+Retrieve the dataset's chunk indexing type
+Dataset's chunk indexing type is not version 1 B-tree
+Not converting the dataset
+Close the dataset
+Close the dataset creation property list
+Going to process dataset:/DSET_NDATA_EA...
+Open the dataset
+Retrieve the dataset's layout
+Dataset is a chunked dataset
+Retrieve the dataset's chunk indexing type
+Dataset's chunk indexing type is not version 1 B-tree
+Not converting the dataset
+Close the dataset
+Close the dataset creation property list
+Going to process dataset:/GROUP/DSET_BT2...
+Open the dataset
+Retrieve the dataset's layout
+Dataset is a chunked dataset
+Retrieve the dataset's chunk indexing type
+Dataset's chunk indexing type is not version 1 B-tree
+Not converting the dataset
+Close the dataset
+Close the dataset creation property list
+Going to process dataset:/GROUP/DSET_COMPACT...
+Open the dataset
+Retrieve the dataset's layout
+Dataset is a contiguous dataset: downgrade layout version as needed
+Not converting the dataset
+Close the dataset
+Close the dataset creation property list
+Going to process dataset:/GROUP/DSET_EA...
+Open the dataset
+Retrieve the dataset's layout
+Dataset is a chunked dataset
+Retrieve the dataset's chunk indexing type
+Dataset's chunk indexing type is not version 1 B-tree
+Not converting the dataset
+Close the dataset
+Close the dataset creation property list
+Not processing the file's superblock...
+Close the file
diff --git a/tools/test/h5format_convert/testfiles/h5fc_v_ndata_bt1.ddl b/tools/test/h5format_convert/testfiles/h5fc_v_ndata_bt1.ddl
new file mode 100644
index 0000000..c75699a
--- /dev/null
+++ b/tools/test/h5format_convert/testfiles/h5fc_v_ndata_bt1.ddl
@@ -0,0 +1,13 @@
+Process command line options
+It is noop...
+Open the file outtmp.h5
+Going to process dataset: /DSET_NDATA_BT2...
+Open the dataset
+Retrieve the dataset's layout
+Dataset is a chunked dataset
+Retrieve the dataset's chunk indexing type
+Dataset's chunk indexing type is already version 1 B-tree: no further action
+Close the dataset
+Close the dataset creation property list
+Not processing the file's superblock...
+Close the file
diff --git a/tools/test/h5format_convert/testfiles/h5fc_v_non_chunked.ddl b/tools/test/h5format_convert/testfiles/h5fc_v_non_chunked.ddl
new file mode 100644
index 0000000..5945389
--- /dev/null
+++ b/tools/test/h5format_convert/testfiles/h5fc_v_non_chunked.ddl
@@ -0,0 +1,12 @@
+Process command line options
+Open the file outtmp.h5
+Going to process dataset: /DSET_CONTIGUOUS...
+Open the dataset
+Retrieve the dataset's layout
+Dataset is a contiguous dataset: downgrade layout version as needed
+Converting the dataset...
+Done
+Close the dataset
+Close the dataset creation property list
+Processing the file's superblock...
+Close the file
diff --git a/tools/test/h5format_convert/testfiles/old_h5fc_ext1_f.ddl b/tools/test/h5format_convert/testfiles/old_h5fc_ext1_f.ddl
new file mode 100644
index 0000000..dae9284
--- /dev/null
+++ b/tools/test/h5format_convert/testfiles/old_h5fc_ext1_f.ddl
@@ -0,0 +1,58 @@
+HDF5 "./testfiles/dmptmp.h5" {
+SUPER_BLOCK {
+ SUPERBLOCK_VERSION 2
+ FREELIST_VERSION 0
+ SYMBOLTABLE_VERSION 0
+ OBJECTHEADER_VERSION 0
+ OFFSET_SIZE 8
+ LENGTH_SIZE 8
+ BTREE_RANK 16
+ BTREE_LEAF 4
+ ISTORE_K 32
+ FILE_SPACE_STRATEGY H5F_FILE_SPACE_ALL
+ FREE_SPACE_THRESHOLD 1
+ USER_BLOCK {
+ USERBLOCK_SIZE 0
+ }
+}
+GROUP "/" {
+ DATASET "DSET_CONTIGUOUS" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 10 ) / ( 10 ) }
+ }
+ DATASET "DSET_EA" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 10, H5S_UNLIMITED ) }
+ }
+ DATASET "DSET_FA" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 20, 10 ) }
+ }
+ DATASET "DSET_NDATA_BT2" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( H5S_UNLIMITED, H5S_UNLIMITED ) }
+ }
+ DATASET "DSET_NONE" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 4, 6 ) }
+ }
+ GROUP "GROUP" {
+ DATASET "DSET_BT2" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( H5S_UNLIMITED, H5S_UNLIMITED ) }
+ }
+ DATASET "DSET_NDATA_EA" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 10, H5S_UNLIMITED ) }
+ }
+ DATASET "DSET_NDATA_FA" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 20, 10 ) }
+ }
+ DATASET "DSET_NDATA_NONE" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 4, 6 ) }
+ }
+ }
+}
+}
diff --git a/tools/test/h5format_convert/testfiles/old_h5fc_ext1_f.h5 b/tools/test/h5format_convert/testfiles/old_h5fc_ext1_f.h5
new file mode 100644
index 0000000..3cbc7f4
--- /dev/null
+++ b/tools/test/h5format_convert/testfiles/old_h5fc_ext1_f.h5
Binary files differ
diff --git a/tools/test/h5format_convert/testfiles/old_h5fc_ext1_i.ddl b/tools/test/h5format_convert/testfiles/old_h5fc_ext1_i.ddl
new file mode 100644
index 0000000..d1768c8
--- /dev/null
+++ b/tools/test/h5format_convert/testfiles/old_h5fc_ext1_i.ddl
@@ -0,0 +1,58 @@
+HDF5 "./testfiles/dmptmp.h5" {
+SUPER_BLOCK {
+ SUPERBLOCK_VERSION 1
+ FREELIST_VERSION 0
+ SYMBOLTABLE_VERSION 0
+ OBJECTHEADER_VERSION 0
+ OFFSET_SIZE 8
+ LENGTH_SIZE 8
+ BTREE_RANK 16
+ BTREE_LEAF 4
+ ISTORE_K 64
+ FILE_SPACE_STRATEGY H5F_FILE_SPACE_ALL
+ FREE_SPACE_THRESHOLD 1
+ USER_BLOCK {
+ USERBLOCK_SIZE 0
+ }
+}
+GROUP "/" {
+ DATASET "DSET_CONTIGUOUS" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 10 ) / ( 10 ) }
+ }
+ DATASET "DSET_EA" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 10, H5S_UNLIMITED ) }
+ }
+ DATASET "DSET_FA" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 20, 10 ) }
+ }
+ DATASET "DSET_NDATA_BT2" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( H5S_UNLIMITED, H5S_UNLIMITED ) }
+ }
+ DATASET "DSET_NONE" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 4, 6 ) }
+ }
+ GROUP "GROUP" {
+ DATASET "DSET_BT2" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( H5S_UNLIMITED, H5S_UNLIMITED ) }
+ }
+ DATASET "DSET_NDATA_EA" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 10, H5S_UNLIMITED ) }
+ }
+ DATASET "DSET_NDATA_FA" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 20, 10 ) }
+ }
+ DATASET "DSET_NDATA_NONE" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 4, 6 ) }
+ }
+ }
+}
+}
diff --git a/tools/test/h5format_convert/testfiles/old_h5fc_ext1_i.h5 b/tools/test/h5format_convert/testfiles/old_h5fc_ext1_i.h5
new file mode 100644
index 0000000..a2c9187
--- /dev/null
+++ b/tools/test/h5format_convert/testfiles/old_h5fc_ext1_i.h5
Binary files differ
diff --git a/tools/test/h5format_convert/testfiles/old_h5fc_ext1_s.ddl b/tools/test/h5format_convert/testfiles/old_h5fc_ext1_s.ddl
new file mode 100644
index 0000000..dae9284
--- /dev/null
+++ b/tools/test/h5format_convert/testfiles/old_h5fc_ext1_s.ddl
@@ -0,0 +1,58 @@
+HDF5 "./testfiles/dmptmp.h5" {
+SUPER_BLOCK {
+ SUPERBLOCK_VERSION 2
+ FREELIST_VERSION 0
+ SYMBOLTABLE_VERSION 0
+ OBJECTHEADER_VERSION 0
+ OFFSET_SIZE 8
+ LENGTH_SIZE 8
+ BTREE_RANK 16
+ BTREE_LEAF 4
+ ISTORE_K 32
+ FILE_SPACE_STRATEGY H5F_FILE_SPACE_ALL
+ FREE_SPACE_THRESHOLD 1
+ USER_BLOCK {
+ USERBLOCK_SIZE 0
+ }
+}
+GROUP "/" {
+ DATASET "DSET_CONTIGUOUS" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 10 ) / ( 10 ) }
+ }
+ DATASET "DSET_EA" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 10, H5S_UNLIMITED ) }
+ }
+ DATASET "DSET_FA" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 20, 10 ) }
+ }
+ DATASET "DSET_NDATA_BT2" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( H5S_UNLIMITED, H5S_UNLIMITED ) }
+ }
+ DATASET "DSET_NONE" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 4, 6 ) }
+ }
+ GROUP "GROUP" {
+ DATASET "DSET_BT2" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( H5S_UNLIMITED, H5S_UNLIMITED ) }
+ }
+ DATASET "DSET_NDATA_EA" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 10, H5S_UNLIMITED ) }
+ }
+ DATASET "DSET_NDATA_FA" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 20, 10 ) }
+ }
+ DATASET "DSET_NDATA_NONE" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 4, 6 ) }
+ }
+ }
+}
+}
diff --git a/tools/test/h5format_convert/testfiles/old_h5fc_ext1_s.h5 b/tools/test/h5format_convert/testfiles/old_h5fc_ext1_s.h5
new file mode 100644
index 0000000..fdf4f33
--- /dev/null
+++ b/tools/test/h5format_convert/testfiles/old_h5fc_ext1_s.h5
Binary files differ
diff --git a/tools/test/h5format_convert/testfiles/old_h5fc_ext2_if.ddl b/tools/test/h5format_convert/testfiles/old_h5fc_ext2_if.ddl
new file mode 100644
index 0000000..8ec4656
--- /dev/null
+++ b/tools/test/h5format_convert/testfiles/old_h5fc_ext2_if.ddl
@@ -0,0 +1,58 @@
+HDF5 "./testfiles/dmptmp.h5" {
+SUPER_BLOCK {
+ SUPERBLOCK_VERSION 2
+ FREELIST_VERSION 0
+ SYMBOLTABLE_VERSION 0
+ OBJECTHEADER_VERSION 0
+ OFFSET_SIZE 8
+ LENGTH_SIZE 8
+ BTREE_RANK 16
+ BTREE_LEAF 4
+ ISTORE_K 64
+ FILE_SPACE_STRATEGY H5F_FILE_SPACE_ALL
+ FREE_SPACE_THRESHOLD 1
+ USER_BLOCK {
+ USERBLOCK_SIZE 0
+ }
+}
+GROUP "/" {
+ DATASET "DSET_CONTIGUOUS" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 10 ) / ( 10 ) }
+ }
+ DATASET "DSET_EA" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 10, H5S_UNLIMITED ) }
+ }
+ DATASET "DSET_FA" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 20, 10 ) }
+ }
+ DATASET "DSET_NDATA_BT2" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( H5S_UNLIMITED, H5S_UNLIMITED ) }
+ }
+ DATASET "DSET_NONE" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 4, 6 ) }
+ }
+ GROUP "GROUP" {
+ DATASET "DSET_BT2" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( H5S_UNLIMITED, H5S_UNLIMITED ) }
+ }
+ DATASET "DSET_NDATA_EA" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 10, H5S_UNLIMITED ) }
+ }
+ DATASET "DSET_NDATA_FA" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 20, 10 ) }
+ }
+ DATASET "DSET_NDATA_NONE" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 4, 6 ) }
+ }
+ }
+}
+}
diff --git a/tools/test/h5format_convert/testfiles/old_h5fc_ext2_if.h5 b/tools/test/h5format_convert/testfiles/old_h5fc_ext2_if.h5
new file mode 100644
index 0000000..6bf0a2f
--- /dev/null
+++ b/tools/test/h5format_convert/testfiles/old_h5fc_ext2_if.h5
Binary files differ
diff --git a/tools/test/h5format_convert/testfiles/old_h5fc_ext2_is.ddl b/tools/test/h5format_convert/testfiles/old_h5fc_ext2_is.ddl
new file mode 100644
index 0000000..8ec4656
--- /dev/null
+++ b/tools/test/h5format_convert/testfiles/old_h5fc_ext2_is.ddl
@@ -0,0 +1,58 @@
+HDF5 "./testfiles/dmptmp.h5" {
+SUPER_BLOCK {
+ SUPERBLOCK_VERSION 2
+ FREELIST_VERSION 0
+ SYMBOLTABLE_VERSION 0
+ OBJECTHEADER_VERSION 0
+ OFFSET_SIZE 8
+ LENGTH_SIZE 8
+ BTREE_RANK 16
+ BTREE_LEAF 4
+ ISTORE_K 64
+ FILE_SPACE_STRATEGY H5F_FILE_SPACE_ALL
+ FREE_SPACE_THRESHOLD 1
+ USER_BLOCK {
+ USERBLOCK_SIZE 0
+ }
+}
+GROUP "/" {
+ DATASET "DSET_CONTIGUOUS" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 10 ) / ( 10 ) }
+ }
+ DATASET "DSET_EA" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 10, H5S_UNLIMITED ) }
+ }
+ DATASET "DSET_FA" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 20, 10 ) }
+ }
+ DATASET "DSET_NDATA_BT2" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( H5S_UNLIMITED, H5S_UNLIMITED ) }
+ }
+ DATASET "DSET_NONE" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 4, 6 ) }
+ }
+ GROUP "GROUP" {
+ DATASET "DSET_BT2" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( H5S_UNLIMITED, H5S_UNLIMITED ) }
+ }
+ DATASET "DSET_NDATA_EA" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 10, H5S_UNLIMITED ) }
+ }
+ DATASET "DSET_NDATA_FA" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 20, 10 ) }
+ }
+ DATASET "DSET_NDATA_NONE" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 4, 6 ) }
+ }
+ }
+}
+}
diff --git a/tools/test/h5format_convert/testfiles/old_h5fc_ext2_is.h5 b/tools/test/h5format_convert/testfiles/old_h5fc_ext2_is.h5
new file mode 100644
index 0000000..c0c7ecc
--- /dev/null
+++ b/tools/test/h5format_convert/testfiles/old_h5fc_ext2_is.h5
Binary files differ
diff --git a/tools/test/h5format_convert/testfiles/old_h5fc_ext2_sf.ddl b/tools/test/h5format_convert/testfiles/old_h5fc_ext2_sf.ddl
new file mode 100644
index 0000000..dae9284
--- /dev/null
+++ b/tools/test/h5format_convert/testfiles/old_h5fc_ext2_sf.ddl
@@ -0,0 +1,58 @@
+HDF5 "./testfiles/dmptmp.h5" {
+SUPER_BLOCK {
+ SUPERBLOCK_VERSION 2
+ FREELIST_VERSION 0
+ SYMBOLTABLE_VERSION 0
+ OBJECTHEADER_VERSION 0
+ OFFSET_SIZE 8
+ LENGTH_SIZE 8
+ BTREE_RANK 16
+ BTREE_LEAF 4
+ ISTORE_K 32
+ FILE_SPACE_STRATEGY H5F_FILE_SPACE_ALL
+ FREE_SPACE_THRESHOLD 1
+ USER_BLOCK {
+ USERBLOCK_SIZE 0
+ }
+}
+GROUP "/" {
+ DATASET "DSET_CONTIGUOUS" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 10 ) / ( 10 ) }
+ }
+ DATASET "DSET_EA" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 10, H5S_UNLIMITED ) }
+ }
+ DATASET "DSET_FA" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 20, 10 ) }
+ }
+ DATASET "DSET_NDATA_BT2" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( H5S_UNLIMITED, H5S_UNLIMITED ) }
+ }
+ DATASET "DSET_NONE" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 4, 6 ) }
+ }
+ GROUP "GROUP" {
+ DATASET "DSET_BT2" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( H5S_UNLIMITED, H5S_UNLIMITED ) }
+ }
+ DATASET "DSET_NDATA_EA" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 10, H5S_UNLIMITED ) }
+ }
+ DATASET "DSET_NDATA_FA" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 20, 10 ) }
+ }
+ DATASET "DSET_NDATA_NONE" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 4, 6 ) }
+ }
+ }
+}
+}
diff --git a/tools/test/h5format_convert/testfiles/old_h5fc_ext2_sf.h5 b/tools/test/h5format_convert/testfiles/old_h5fc_ext2_sf.h5
new file mode 100644
index 0000000..055cabf
--- /dev/null
+++ b/tools/test/h5format_convert/testfiles/old_h5fc_ext2_sf.h5
Binary files differ
diff --git a/tools/test/h5format_convert/testfiles/old_h5fc_ext3_isf.ddl b/tools/test/h5format_convert/testfiles/old_h5fc_ext3_isf.ddl
new file mode 100644
index 0000000..8ec4656
--- /dev/null
+++ b/tools/test/h5format_convert/testfiles/old_h5fc_ext3_isf.ddl
@@ -0,0 +1,58 @@
+HDF5 "./testfiles/dmptmp.h5" {
+SUPER_BLOCK {
+ SUPERBLOCK_VERSION 2
+ FREELIST_VERSION 0
+ SYMBOLTABLE_VERSION 0
+ OBJECTHEADER_VERSION 0
+ OFFSET_SIZE 8
+ LENGTH_SIZE 8
+ BTREE_RANK 16
+ BTREE_LEAF 4
+ ISTORE_K 64
+ FILE_SPACE_STRATEGY H5F_FILE_SPACE_ALL
+ FREE_SPACE_THRESHOLD 1
+ USER_BLOCK {
+ USERBLOCK_SIZE 0
+ }
+}
+GROUP "/" {
+ DATASET "DSET_CONTIGUOUS" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 10 ) / ( 10 ) }
+ }
+ DATASET "DSET_EA" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 10, H5S_UNLIMITED ) }
+ }
+ DATASET "DSET_FA" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 20, 10 ) }
+ }
+ DATASET "DSET_NDATA_BT2" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( H5S_UNLIMITED, H5S_UNLIMITED ) }
+ }
+ DATASET "DSET_NONE" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 4, 6 ) }
+ }
+ GROUP "GROUP" {
+ DATASET "DSET_BT2" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( H5S_UNLIMITED, H5S_UNLIMITED ) }
+ }
+ DATASET "DSET_NDATA_EA" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 10, H5S_UNLIMITED ) }
+ }
+ DATASET "DSET_NDATA_FA" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 20, 10 ) }
+ }
+ DATASET "DSET_NDATA_NONE" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 6 ) / ( 4, 6 ) }
+ }
+ }
+}
+}
diff --git a/tools/test/h5format_convert/testfiles/old_h5fc_ext3_isf.h5 b/tools/test/h5format_convert/testfiles/old_h5fc_ext3_isf.h5
new file mode 100644
index 0000000..f4caaf4
--- /dev/null
+++ b/tools/test/h5format_convert/testfiles/old_h5fc_ext3_isf.h5
Binary files differ
diff --git a/tools/test/h5format_convert/testfiles/old_h5fc_ext_none.h5 b/tools/test/h5format_convert/testfiles/old_h5fc_ext_none.h5
new file mode 100644
index 0000000..d0bf344
--- /dev/null
+++ b/tools/test/h5format_convert/testfiles/old_h5fc_ext_none.h5
Binary files differ
diff --git a/tools/test/h5format_convert/testh5fc.sh.in b/tools/test/h5format_convert/testh5fc.sh.in
new file mode 100644
index 0000000..5384354
--- /dev/null
+++ b/tools/test/h5format_convert/testh5fc.sh.in
@@ -0,0 +1,505 @@
+#! /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 h5format_convert tool
+#
+#
+
+srcdir=@srcdir@
+
+# 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=h5format_convert
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+
+FORMCONV=../../src/h5format_convert/h5format_convert # The tool name
+FORMCONV_BIN=`pwd`/$FORMCONV # The path of the tool binary
+
+CHK_IDX=h5fc_chk_idx # The program name
+CHK_IDX_BIN=`pwd`/$CHK_IDX # The program to verify the chunk indexing type is v1 B-tree
+
+RM='rm -rf'
+CMP='cmp -s'
+DIFF='diff -c'
+CP='cp'
+H5DUMP=../../src/h5dump/h5dump # The h5dump tool name
+H5DUMP_BIN=`pwd`/$H5DUMP # The path of the h5dump tool binary
+DIRNAME='dirname'
+LS='ls'
+AWK='awk'
+
+nerrors=0
+verbose=yes
+
+# 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/test/h5diff/testfiles"
+SRC_H5COPY_TESTFILES="$SRC_TOOLS/test/h5copy/testfiles"
+SRC_H5REPACK_TESTFILES="$SRC_TOOLS/test/h5repack/testfiles"
+SRC_H5JAM_TESTFILES="$SRC_TOOLS/test/h5jam/testfiles"
+SRC_H5STAT_TESTFILES="$SRC_TOOLS/test/h5stat/testfiles"
+SRC_H5IMPORT_TESTFILES="$SRC_TOOLS/test/h5import/testfiles"
+SRC_H5FORMCONV_TESTFILES="$SRC_TOOLS/test/h5format_convert/testfiles"
+
+TESTDIR=./testfiles
+test -d $TESTDIR || mkdir $TESTDIR
+
+# Copy the testfile to a temporary file for testing as h5format_convert is changing the file in place
+TMPOUTFILE=outtmp.h5
+TMPFILE=tmp.h5
+TMPCHKFILE=chktmp.h5
+TMPDMPFILE=dmptmp.h5
+
+######################################################################
+# 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_H5FORMCONV_TESTFILES/h5fc_non_v3.h5
+$SRC_H5FORMCONV_TESTFILES/h5fc_edge_v3.h5
+$SRC_H5FORMCONV_TESTFILES/h5fc_ext_none.h5
+$SRC_H5FORMCONV_TESTFILES/old_h5fc_ext_none.h5
+$SRC_H5FORMCONV_TESTFILES/h5fc_ext1_i.h5
+$SRC_H5FORMCONV_TESTFILES/h5fc_ext1_s.h5
+$SRC_H5FORMCONV_TESTFILES/h5fc_ext1_f.h5
+$SRC_H5FORMCONV_TESTFILES/h5fc_ext2_if.h5
+$SRC_H5FORMCONV_TESTFILES/h5fc_ext2_is.h5
+$SRC_H5FORMCONV_TESTFILES/h5fc_ext2_sf.h5
+$SRC_H5FORMCONV_TESTFILES/h5fc_ext3_isf.h5
+$SRC_H5FORMCONV_TESTFILES/old_h5fc_ext1_i.h5
+$SRC_H5FORMCONV_TESTFILES/old_h5fc_ext1_s.h5
+$SRC_H5FORMCONV_TESTFILES/old_h5fc_ext1_f.h5
+$SRC_H5FORMCONV_TESTFILES/old_h5fc_ext2_if.h5
+$SRC_H5FORMCONV_TESTFILES/old_h5fc_ext2_is.h5
+$SRC_H5FORMCONV_TESTFILES/old_h5fc_ext2_sf.h5
+$SRC_H5FORMCONV_TESTFILES/old_h5fc_ext3_isf.h5
+$SRC_H5FORMCONV_TESTFILES/h5fc_err_level.h5
+"
+
+LIST_OTHER_TEST_FILES="
+$SRC_H5FORMCONV_TESTFILES/h5fc_help.ddl
+$SRC_H5FORMCONV_TESTFILES/h5fc_nooption.ddl
+$SRC_H5FORMCONV_TESTFILES/h5fc_nonexistfile.ddl
+$SRC_H5FORMCONV_TESTFILES/h5fc_d_file.ddl
+$SRC_H5FORMCONV_TESTFILES/h5fc_dname.ddl
+$SRC_H5FORMCONV_TESTFILES/h5fc_nonexistdset_file.ddl
+$SRC_H5FORMCONV_TESTFILES/h5fc_v_non_chunked.ddl
+$SRC_H5FORMCONV_TESTFILES/h5fc_v_bt1.ddl
+$SRC_H5FORMCONV_TESTFILES/h5fc_v_ndata_bt1.ddl
+$SRC_H5FORMCONV_TESTFILES/h5fc_v_all.ddl
+$SRC_H5FORMCONV_TESTFILES/h5fc_v_n_1d.ddl
+$SRC_H5FORMCONV_TESTFILES/h5fc_v_n_all.ddl
+$SRC_H5FORMCONV_TESTFILES/h5fc_ext1_i.ddl
+$SRC_H5FORMCONV_TESTFILES/h5fc_ext1_s.ddl
+$SRC_H5FORMCONV_TESTFILES/h5fc_ext1_f.ddl
+$SRC_H5FORMCONV_TESTFILES/h5fc_ext2_if.ddl
+$SRC_H5FORMCONV_TESTFILES/h5fc_ext2_is.ddl
+$SRC_H5FORMCONV_TESTFILES/h5fc_ext2_sf.ddl
+$SRC_H5FORMCONV_TESTFILES/h5fc_ext3_isf.ddl
+$SRC_H5FORMCONV_TESTFILES/old_h5fc_ext1_i.ddl
+$SRC_H5FORMCONV_TESTFILES/old_h5fc_ext1_s.ddl
+$SRC_H5FORMCONV_TESTFILES/old_h5fc_ext1_f.ddl
+$SRC_H5FORMCONV_TESTFILES/old_h5fc_ext2_if.ddl
+$SRC_H5FORMCONV_TESTFILES/old_h5fc_ext2_is.ddl
+$SRC_H5FORMCONV_TESTFILES/old_h5fc_ext2_sf.ddl
+$SRC_H5FORMCONV_TESTFILES/old_h5fc_ext3_isf.ddl
+$SRC_H5FORMCONV_TESTFILES/h5fc_v_err.ddl
+"
+
+#
+# copy test files and expected output files from source dirs to test dir
+#
+COPY_TESTFILES="$LIST_HDF5_TEST_FILES $LIST_OTHER_TEST_FILES"
+
+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
+ # skip cp if srcdir is same as destdir
+ # this occurs when build/test performed in source dir and
+ # make cp fail
+ SDIR=`$DIRNAME $tstfile`
+ INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
+ INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
+ if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
+ $CP -f $tstfile $TESTDIR
+ if [ $? -ne 0 ]; then
+ echo "Error: FAILED to copy $tstfile ."
+
+ # Comment out this to CREATE expected file
+ exit $EXIT_FAILURE
+ fi
+ fi
+ fi
+ done
+}
+
+CLEAN_TESTFILES_AND_TESTDIR()
+{
+ # skip rm if srcdir is same as destdir
+ # this occurs when build/test performed in source dir and
+ # make cp fail
+ SDIR=$SRC_H5FORMCONV_TESTFILES
+ INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
+ INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
+ if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
+ $RM $TESTDIR
+ else
+ $RM $TESTDIR/$TMPFILE
+ fi
+}
+
+# Print a line-line message left justified in a field of 80 characters
+# beginning with the word "Testing".
+#
+TESTING() {
+ SPACES=" "
+ echo "Testing $* $SPACES" | cut -c1-80 | tr -d '\012'
+}
+
+# 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.
+#
+# $1: expected output
+# $2: the test file name
+# --fname might be empty or fname does not exist
+# --fname is copied to a temporary file for testing
+# $3 to at most $6--options to the tool such as:
+# -d dname or --dname=dname
+# -v or --verbose
+# -n or --noop
+TOOLTEST_OUT() {
+ # Prepare expected and actual output
+ 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
+
+ # Prepare the test file
+ $RM $TESTDIR/$TMPOUTFILE
+ TFILE=$2
+ if [ ! -z "$2" ] && [ -e $TESTDIR/$2 ] ; then
+ $CP $TESTDIR/$2 $TESTDIR/$TMPOUTFILE
+ TFILE=$TMPOUTFILE
+ fi
+
+ # Run test.
+ TESTING $FORMCONV $3 $4 $5 $6 $2
+ (
+ cd $TESTDIR
+ $RUNSERIAL $FORMCONV_BIN $3 $4 $5 $6 $TFILE
+ ) >$actual 2>$actual_err
+ cp $actual $actual_sav
+ cp $actual_err $actual_err_sav
+ cat $actual_err >> $actual
+
+ # Compare output
+ COMPARE_OUT $expect $actual
+
+ # Clean up output file
+ if test -z "$HDF5_NOCLEANUP"; then
+ $RM $actual $actual_err
+ $RM $actual $actual_err $actual_sav $actual_err_sav
+ fi
+}
+
+# To check that the tool exits success, no output
+# Assume all short options
+# $1 is the test file name
+# --fname exists
+# --fname is copied to a temporary file for testing
+# $2 is the temporary file name
+# $3 to at most $5--options to the tool such as:
+# -d dname
+# -n
+TOOLTEST() {
+ TESTING $FORMCONV $3 $4 $5 $1
+ $RM $TESTDIR/$2
+ $CP $TESTDIR/$1 $TESTDIR/$2
+ $RUNSERIAL $FORMCONV_BIN $3 $4 $5 $TESTDIR/$2
+ exitcode=$?
+ if [ $exitcode -ne 0 ]; then
+ echo "*FAILED*"
+ echo " The tool exits failure"
+ nerrors="`expr $nerrors + 1`"
+ else
+ echo " PASSED"
+ fi
+}
+
+CHECKING() {
+ SPACES=" "
+ echo "Verifying $* $SPACES" | cut -c1-80 | tr -d '\012'
+}
+
+# Assume $TESTDIR/$TMPFILE is the converted test file
+# $1 dataset name
+IDX_CHECK() {
+ CHECKING $1
+ $RUNSERIAL $CHK_IDX_BIN $TESTDIR/$TMPCHKFILE $1
+ ret=$?
+ if [ $ret -eq 0 ]; then
+ echo " PASSED"
+ else
+ echo "*FAILED*"
+ echo " The chunk indexing type is not correct"
+ nerrors="`expr $nerrors + 1`"
+ fi
+}
+
+# $1 is the expected output
+# $2 is the output from testing
+COMPARE_OUT() {
+ if $CMP $1 $2; 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
+}
+
+# Assume $TESTDIR/$TMPFILE is the converted test file
+# $1 is the test file for verifying h5dump output
+# $2 is the expected output from h5dump
+H5DUMP_CHECK() {
+ CHECKING h5dump output for $1
+ expect="$TESTDIR/$2"
+ actual="$TESTDIR/`basename $2 .ddl`.out"
+ actual_err="$TESTDIR/`basename $2 .ddl`.err"
+ $RUNSERIAL $H5DUMP_BIN -BH $TESTDIR/$TMPDMPFILE > $actual 2>$actual_err
+ cat $actual_err >> $actual
+
+ # Compare output
+ COMPARE_OUT $expect $actual
+
+ # Clean up output file
+ if test -z "$HDF5_NOCLEANUP"; then
+ $RM $actual $actual_err
+ fi
+}
+
+# Print a "SKIP" message
+SKIP() {
+ TESTING $STAT $@
+ echo " -SKIP-"
+}
+
+
+
+##############################################################################
+##############################################################################
+### T H E T E S T S ###
+##############################################################################
+##############################################################################
+# prepare for test
+COPY_TESTFILES_TO_TESTDIR
+#
+#
+#
+# h5format_convert --help
+# h5format_convert (no options)
+# h5format_convert nonexist.h5 (no options, file does not exist)
+TOOLTEST_OUT h5fc_help.ddl '' --help
+TOOLTEST_OUT h5fc_nooption.ddl ''
+TOOLTEST_OUT h5fc_nonexistfile.ddl nonexist.h5
+#
+#
+# h5format_convert -d old_h5fc_ext_none.h5 (just -d option, file exists)
+# h5format_convert --dname old_h5fc_ext_none.h5 (just --dname option, file exists)
+# h5format_convert --dname (just --dname option)
+# h5format_convert --dname=nonexist old_h5fc_ext_none.h5 (dataset does not exist, file exists)
+TOOLTEST_OUT h5fc_d_file.ddl old_h5fc_ext_none.h5 -d
+TOOLTEST_OUT h5fc_d_file.ddl old_h5fc_ext_none.h5 --dname
+TOOLTEST_OUT h5fc_dname.ddl '' --dname
+TOOLTEST_OUT h5fc_nonexistdset_file.ddl old_h5fc_ext_none.h5 --dname=nonexist
+#
+#
+#
+# h5format_convert -d /DSET_CONTIGUOUS -v old_h5fc_ext_none.h5 (verbose, contiguous dataset)
+# h5format_convert -d /GROUP/DSET_BT2 --verbose old_h5fc_ext_none.h5 (verbose, bt1 dataset)
+# h5format_convert -d /DSET_NDATA_BT2 -v -n old_h5fc_ext_none.h5 (verbose, noop, bt1+nodata dataset)
+# h5format_convert -v old_h5fc_ext_none.h5 (verbose, all datasets)
+TOOLTEST_OUT h5fc_v_non_chunked.ddl old_h5fc_ext_none.h5 -d /DSET_CONTIGUOUS -v
+TOOLTEST_OUT h5fc_v_bt1.ddl old_h5fc_ext_none.h5 -d /GROUP/DSET_BT2 --verbose
+TOOLTEST_OUT h5fc_v_ndata_bt1.ddl old_h5fc_ext_none.h5 -d /DSET_NDATA_BT2 -v -n
+TOOLTEST_OUT h5fc_v_all.ddl old_h5fc_ext_none.h5 -v
+#
+#
+#
+# h5format_convert -d /DSET_EA -v -n h5fc_ext_none.h5 (verbose, noop, one ea dataset)
+# h5format_convert -v -n h5fc_non_v3.h5 (verbose, noop, all datasets)
+TOOLTEST_OUT h5fc_v_n_1d.ddl h5fc_ext_none.h5 -d /DSET_EA -v -n
+TOOLTEST_OUT h5fc_v_n_all.ddl h5fc_non_v3.h5 -v -n
+#
+#
+#
+# h5format_convert -v h5fc_err_level.h5 (error encountered in converting the dataset)
+TOOLTEST_OUT h5fc_v_err.ddl h5fc_err_level.h5 -v
+#
+#
+#
+# No output from tests
+# 1) Use the tool to convert the dataset
+# 2) Verify the chunk indexing type is correct
+# h5format_convert -d /DSET_EA h5fc_ext_none.h5
+# h5format_convert -d /GROUP/DSET_NDATA_EA h5fc_ext_none.h5
+# h5format_convert -d /GROUP/DSET_BT2 h5fc_ext_none.h5
+# h5format_convert -d /DSET_NDATA_BT2 h5fc_ext_none.h5
+# h5format_convert -d /DSET_FA h5fc_ext_none.h5
+# h5format_convert -d /GROUP/DSET_FA h5fc_ext_none.h5
+# h5format_convert -d /DSET_NONE h5fc_ext_none.h5
+# h5format_convert -d /GROUP/DSET_NDATA_NONE h5fc_ext_none.h5
+TOOLTEST h5fc_ext_none.h5 $TMPCHKFILE -d /DSET_EA
+IDX_CHECK /DSET_EA
+#
+TOOLTEST h5fc_ext_none.h5 $TMPCHKFILE -d /GROUP/DSET_NDATA_EA
+IDX_CHECK /GROUP/DSET_NDATA_EA
+#
+TOOLTEST h5fc_ext_none.h5 $TMPCHKFILE -d /GROUP/DSET_BT2
+IDX_CHECK /GROUP/DSET_BT2
+#
+TOOLTEST h5fc_ext_none.h5 $TMPCHKFILE -d /DSET_NDATA_BT2
+IDX_CHECK /DSET_NDATA_BT2
+#
+TOOLTEST h5fc_ext_none.h5 $TMPCHKFILE -d /DSET_FA
+IDX_CHECK /DSET_FA
+#
+TOOLTEST h5fc_ext_none.h5 $TMPCHKFILE -d /GROUP/DSET_NDATA_FA
+IDX_CHECK /GROUP/DSET_NDATA_FA
+#
+TOOLTEST h5fc_ext_none.h5 $TMPCHKFILE -d /DSET_NONE
+IDX_CHECK /DSET_NONE
+#
+TOOLTEST h5fc_ext_none.h5 $TMPCHKFILE -d /GROUP/DSET_NDATA_NONE
+IDX_CHECK /GROUP/DSET_NDATA_NONE
+#
+#
+#
+# No output from tests: just check exit code
+# h5format_convert -d /DSET_NDATA_BT2 old_h5fc_ext_none.h5 (v1-btree dataset)
+# h5format_convert -d /DSET_CONTIGUOUS h5fc_non_v3.h5 (non-chunked dataset)
+TOOLTEST old_h5fc_ext_none.h5 $TMPFILE -d /DSET_NDATA_BT2
+TOOLTEST h5fc_non_v3.h5 $TMPFILE -d /DSET_CONTIGUOUS
+#
+#
+#
+# No output from tests: just check exit code
+# h5format_convert -d /GROUP/DSET_BT2 -n h5fc_non_v3.h5 (noop, one dataset)
+# h5format_convert -n h5fc_non_v3.h5 (noop, all datasets)
+TOOLTEST h5fc_non_v3.h5 $TMPFILE -d /GROUP/DSET_BT2 -n
+TOOLTEST h5fc_non_v3.h5 $TMPFILE -n
+#
+#
+#
+# No output from tests: just check exit code
+# h5format_convert h5fc_non_v3.h5
+# 1) convert all datasets
+# 2) verify indexing types
+TOOLTEST h5fc_non_v3.h5 $TMPCHKFILE
+IDX_CHECK /DSET_NDATA_EA
+IDX_CHECK /DSET_NDATA_BT2
+IDX_CHECK /GROUP/DSET_BT2
+IDX_CHECK /GROUP/DSET_EA
+#
+#
+#
+# No output from test: just check exit code
+# h5format_convert h5fc_edge_v3.h5
+# 1) convert the chunked dataset (filter, no-filter-edge-chunk)
+# 2) verify the indexing type
+TOOLTEST h5fc_edge_v3.h5 $TMPCHKFILE
+IDX_CHECK /DSET_EDGE
+#
+#
+
+# The following test files have messages in the superblock extension.
+# Verify h5dump output for correctness after conversion
+TOOLTEST h5fc_ext1_i.h5 $TMPDMPFILE
+H5DUMP_CHECK h5fc_ext1_i.h5 h5fc_ext1_i.ddl
+TOOLTEST h5fc_ext1_s.h5 $TMPDMPFILE
+H5DUMP_CHECK h5fc_ext1_s.h5 h5fc_ext1_s.ddl
+TOOLTEST h5fc_ext1_f.h5 $TMPDMPFILE
+H5DUMP_CHECK h5fc_ext1_f.h5 h5fc_ext1_f.ddl
+#
+TOOLTEST h5fc_ext2_if.h5 $TMPDMPFILE
+H5DUMP_CHECK h5fc_ext2_if.h5 h5fc_ext2_if.ddl
+TOOLTEST h5fc_ext2_is.h5 $TMPDMPFILE
+H5DUMP_CHECK h5fc_ext2_is.h5 h5fc_ext2_is.ddl
+TOOLTEST h5fc_ext2_sf.h5 $TMPDMPFILE
+H5DUMP_CHECK h5fc_ext2_sf.h5 h5fc_ext2_sf.ddl
+#
+TOOLTEST h5fc_ext3_isf.h5 $TMPDMPFILE
+H5DUMP_CHECK h5fc_ext3_isf.h5 h5fc_ext3_isf.ddl
+#
+#
+#
+TOOLTEST old_h5fc_ext1_i.h5 $TMPDMPFILE
+H5DUMP_CHECK old_h5fc_ext1_i.h5 old_h5fc_ext1_i.ddl
+TOOLTEST old_h5fc_ext1_s.h5 $TMPDMPFILE
+H5DUMP_CHECK old_h5fc_ext1_s.h5 old_h5fc_ext1_s.ddl
+TOOLTEST old_h5fc_ext1_f.h5 $TMPDMPFILE
+H5DUMP_CHECK old_h5fc_ext1_f.h5 old_h5fc_ext1_f.ddl
+#
+TOOLTEST old_h5fc_ext2_if.h5 $TMPDMPFILE
+H5DUMP_CHECK old_h5fc_ext2_if.h5 old_h5fc_ext2_if.ddl
+TOOLTEST old_h5fc_ext2_is.h5 $TMPDMPFILE
+H5DUMP_CHECK old_h5fc_ext2_is.h5 old_h5fc_ext2_is.ddl
+TOOLTEST old_h5fc_ext2_sf.h5 $TMPDMPFILE
+H5DUMP_CHECK old_h5fc_ext2_sf.h5 old_h5fc_ext2_sf.ddl
+#
+TOOLTEST old_h5fc_ext3_isf.h5 $TMPDMPFILE
+H5DUMP_CHECK old_h5fc_ext3_isf.h5 old_h5fc_ext3_isf.ddl
+#
+# Clean up temporary files/directories
+CLEAN_TESTFILES_AND_TESTDIR
+
+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/test/h5import/CMakeLists.txt b/tools/test/h5import/CMakeLists.txt
new file mode 100644
index 0000000..22491b4
--- /dev/null
+++ b/tools/test/h5import/CMakeLists.txt
@@ -0,0 +1,18 @@
+cmake_minimum_required (VERSION 3.1.0)
+PROJECT (HDF5_TOOLS_TEST_H5IMPORT)
+
+#-----------------------------------------------------------------------------
+# Setup include Directories
+#-----------------------------------------------------------------------------
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib)
+
+ # --------------------------------------------------------------------
+ # Add the h5import executables
+ # --------------------------------------------------------------------
+ add_executable (h5importtest ${HDF5_TOOLS_TEST_H5IMPORT_SOURCE_DIR}/h5importtest.c)
+ TARGET_NAMING (h5importtest STATIC)
+ TARGET_C_PROPERTIES (h5importtest STATIC " " " ")
+ target_link_libraries (h5importtest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+ set_target_properties (h5importtest PROPERTIES FOLDER tools)
+
+ include (CMakeTests.cmake)
diff --git a/tools/test/h5import/CMakeTests.cmake b/tools/test/h5import/CMakeTests.cmake
new file mode 100644
index 0000000..eb0b413
--- /dev/null
+++ b/tools/test/h5import/CMakeTests.cmake
@@ -0,0 +1,465 @@
+
+##############################################################################
+##############################################################################
+### T E S T I N G ###
+##############################################################################
+##############################################################################
+
+ set (HDF5_REFERENCE_CONF_FILES
+ binfp64.conf
+ binin8.conf
+ binin8w.conf
+ binin16.conf
+ binin32.conf
+ binuin16.conf
+ binuin32.conf
+ txtfp32.conf
+ txtfp64.conf
+ txtin8.conf
+ txtin16.conf
+ txtin32.conf
+ txtuin16.conf
+ txtuin32.conf
+ textpfe.conf
+ txtstr.conf
+ )
+ set (HDF5_REFERENCE_TXT_FILES
+ txtfp32.txt
+ txtfp64.txt
+ txtuin16.txt
+ txtuin32.txt
+ txtin8.txt
+ txtin16.txt
+ txtin32.txt
+ textpfe64.txt
+ txtstr.txt
+ dbinfp64.h5.txt
+ dbinin8.h5.txt
+ dbinin8w.h5.txt
+ dbinin16.h5.txt
+ dbinin32.h5.txt
+ dbinuin16.h5.txt
+ dbinuin32.h5.txt
+ dtxtstr.h5.txt
+ )
+ set (HDF5_REFERENCE_TEST_FILES
+ binfp64.h5
+ binin8.h5
+ binin8w.h5
+ binin16.h5
+ binin32.h5
+ binuin16.h5
+ binuin32.h5
+ txtfp32.h5
+ txtfp64.h5
+ txtin8.h5
+ txtin16.h5
+ txtin32.h5
+ txtuin16.h5
+ txtuin32.h5
+ txtstr.h5
+ textpfe.h5
+ )
+
+ file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
+ foreach (conf_file ${HDF5_REFERENCE_CONF_FILES})
+ HDFTEST_COPY_FILE("${HDF5_TOOLS_TEST_H5IMPORT_SOURCE_DIR}/testfiles/${conf_file}" "${PROJECT_BINARY_DIR}/testfiles/${conf_file}" "h5import_files")
+ endforeach (conf_file ${HDF5_REFERENCE_CONF_FILES})
+
+ foreach (txt_file ${HDF5_REFERENCE_TXT_FILES})
+ HDFTEST_COPY_FILE("${HDF5_TOOLS_TEST_H5IMPORT_SOURCE_DIR}/testfiles/${txt_file}" "${PROJECT_BINARY_DIR}/testfiles/${txt_file}" "h5import_files")
+ endforeach (txt_file ${HDF5_REFERENCE_TXT_FILES})
+
+ foreach (h5_file ${HDF5_REFERENCE_TEST_FILES})
+ HDFTEST_COPY_FILE("${HDF5_TOOLS_TEST_H5IMPORT_SOURCE_DIR}/testfiles/${h5_file}" "${PROJECT_BINARY_DIR}/testfiles/${h5_file}" "h5import_files")
+ endforeach (h5_file ${HDF5_REFERENCE_TEST_FILES})
+ add_custom_target(h5import_files ALL COMMENT "Copying files needed by h5import tests" DEPENDS ${h5import_files_list})
+
+##############################################################################
+##############################################################################
+### T H E T E S T S M A C R O S ###
+##############################################################################
+##############################################################################
+ MACRO (ADD_H5_TEST testname importfile conffile testfile)
+ # If using memchecker skip macro based tests
+ if (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (NAME H5IMPORT-${testname} COMMAND $<TARGET_FILE:h5import> ${importfile} -c ${conffile} -o ${testfile})
+ if (NOT "${last_test}" STREQUAL "")
+ set_tests_properties (H5IMPORT-${testname} PROPERTIES DEPENDS H5IMPORT-h5importtest)
+ endif ()
+ else (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (
+ NAME H5IMPORT-${testname}-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ ${testfile}
+ )
+ set_tests_properties (H5IMPORT-${testname}-clear-objects PROPERTIES DEPENDS H5IMPORT-h5importtest)
+
+ add_test (NAME H5IMPORT-${testname} COMMAND $<TARGET_FILE:h5import> ${importfile} -c ${conffile} -o ${testfile})
+ set_tests_properties (H5IMPORT-${testname} PROPERTIES DEPENDS H5IMPORT-${testname}-clear-objects)
+
+ add_test (
+ NAME H5IMPORT-${testname}-H5DMP
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_ARGS:STRING=${testfile}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_OUTPUT=${testfile}.new"
+ -D "TEST_EXPECT=0"
+ -D "TEST_FILTER=(^(HDF5)[^\n]*)"
+ -D "TEST_SKIP_COMPARE=TRUE"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ set_tests_properties (H5IMPORT-${testname}-H5DMP PROPERTIES DEPENDS H5IMPORT-${testname})
+ add_test (
+ NAME H5IMPORT-${testname}-H5DMP_CMP
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_ARGS:STRING=testfiles/${testfile}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_OUTPUT=${testfile}.out"
+ -D "TEST_EXPECT=0"
+ -D "TEST_FILTER=(^(HDF5)[^\n]*)"
+ -D "TEST_REFERENCE=${testfile}.new"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ set_tests_properties (H5IMPORT-${testname}-H5DMP_CMP PROPERTIES DEPENDS H5IMPORT-${testname}-H5DMP)
+ endif (HDF5_ENABLE_USING_MEMCHECKER)
+ ENDMACRO (ADD_H5_TEST testname importfile conffile testfile)
+
+ MACRO (ADD_H5_DUMPTEST testname datasetname testfile)
+ # If using memchecker skip tests
+ if (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (
+ NAME H5IMPORT-DUMP-${testname}-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ d${testfile}
+ d${testfile}.bin
+ )
+ set_tests_properties (H5IMPORT-DUMP-${testname}-clear-objects PROPERTIES DEPENDS H5IMPORT-h5importtest)
+
+ if ("${ARGN}" STREQUAL "BINARY")
+ add_test (
+ NAME H5IMPORT-DUMP-${testname}-H5DMP
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_ARGS:STRING=-p;-d;${datasetname};-o;d${testfile}.bin;-b;testfiles/${testfile}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_OUTPUT=d${testfile}.dmp"
+ -D "TEST_EXPECT=0"
+ -D "TEST_SKIP_COMPARE=TRUE"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ else ("${ARGN}" STREQUAL "BINARY")
+ add_test (
+ NAME H5IMPORT-DUMP-${testname}-H5DMP
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_ARGS:STRING=-p;-d;${datasetname};-o;d${testfile}.bin;-y;--width=1;testfiles/${testfile}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_OUTPUT=d${testfile}.dmp"
+ -D "TEST_EXPECT=0"
+ -D "TEST_SKIP_COMPARE=TRUE"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ endif ("${ARGN}" STREQUAL "BINARY")
+ set_tests_properties (H5IMPORT-DUMP-${testname}-H5DMP PROPERTIES DEPENDS "H5IMPORT-DUMP-${testname}-clear-objects")
+
+ add_test (
+ NAME H5IMPORT-DUMP-${testname}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5import>"
+ -D "TEST_ARGS:STRING=d${testfile}.bin;-c;d${testfile}.dmp;-o;d${testfile}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_OUTPUT=d${testfile}.imp"
+ -D "TEST_EXPECT=0"
+ -D "TEST_SKIP_COMPARE=TRUE"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ set_tests_properties (H5IMPORT-DUMP-${testname} PROPERTIES DEPENDS "H5IMPORT-DUMP-${testname}-H5DMP")
+
+ add_test (
+ NAME H5IMPORT-DUMP-${testname}-H5DFF
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5diff>"
+ -D "TEST_ARGS:STRING=-r;d${testfile};testfiles/${testfile};${datasetname};${datasetname}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_OUTPUT=d${testfile}.dff"
+ -D "TEST_EXPECT=0"
+ -D "TEST_FILTER=(^(Warning)[^\n]*)"
+ -D "TEST_REFERENCE=testfiles/d${testfile}.txt"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ set_tests_properties (H5IMPORT-DUMP-${testname}-H5DFF PROPERTIES DEPENDS "H5IMPORT-DUMP-${testname}")
+ endif (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ ENDMACRO (ADD_H5_DUMPTEST testname datasetname testfile)
+
+ MACRO (ADD_H5_SKIP_DUMPTEST testname datasetname testfile)
+ if (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (
+ NAME H5IMPORT-DUMP-${testname}-SKIPPED
+ COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${testname} ${datasetname} ${testfile} --- DEFLATE filter not available"
+ )
+ endif (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ ENDMACRO (ADD_H5_SKIP_DUMPTEST testname datasetname testfile)
+
+ # --------------------------------------------------------------------
+ # Determine if filter is available for h5diff
+ # --------------------------------------------------------------------
+ if (H5_HAVE_FILTER_DEFLATE)
+ set (USE_FILTER_DEFLATE "true")
+ endif (H5_HAVE_FILTER_DEFLATE)
+
+##############################################################################
+##############################################################################
+### T H E T E S T S ###
+##############################################################################
+##############################################################################
+
+ if (HDF5_ENABLE_USING_MEMCHECKER)
+ # Remove any output file left over from previous test run
+ add_test (
+ NAME H5IMPORT-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ binfp64.bin
+ binin8.bin
+ binin8w.bin
+ binin16.bin
+ binin32.bin
+ binuin16.bin
+ binuin32.bin
+ txtin32.h5
+ txtin32.h5.new
+ txtin32.h5.new.err
+ txtin32.h5.out
+ txtin32.h5.out.err
+ txtin16.h5
+ txtin16.h5.new
+ txtin16.h5.new.err
+ txtin16.h5.out
+ txtin16.h5.out.err
+ txtin8.h5
+ txtin8.h5.new
+ txtin8.h5.new.err
+ txtin8.h5.out
+ txtin8.h5.out.err
+ txtuin16.h5
+ txtuin16.h5.new
+ txtuin16.h5.new.err
+ txtuin16.h5.out
+ txtuin16.h5.out.err
+ txtuin32.h5
+ txtuin32.h5.new
+ txtuin32.h5.new.err
+ txtuin32.h5.out
+ txtuin32.h5.out.err
+ txtfp32.h5
+ txtfp32.h5.new
+ txtfp32.h5.new.err
+ txtfp32.h5.out
+ txtfp32.h5.out.err
+ txtfp64.h5
+ txtfp64.h5.new
+ txtfp64.h5.new.err
+ txtfp64.h5.out
+ txtfp64.h5.out.err
+ binfp64.h5
+ binfp64.h5.new
+ binfp64.h5.new.err
+ binfp64.h5.out
+ binfp64.h5.out.err
+ binin8.h5
+ binin8.h5.new
+ binin8.h5.new.err
+ binin8.h5.out
+ binin8.h5.out.err
+ binin8w.h5
+ binin8w.h5.new
+ binin8w.h5.new.err
+ binin8w.h5.out
+ binin8w.h5.out.err
+ binin16.h5
+ binin16.h5.new
+ binin16.h5.new.err
+ binin16.h5.out
+ binin16.h5.out.err
+ binin32.h5
+ binin32.h5.new
+ binin32.h5.new.err
+ binin32.h5.out
+ binin32.h5.out.err
+ binuin16.h5
+ binuin16.h5.new
+ binuin16.h5.new.err
+ binuin16.h5.out
+ binuin16.h5.out.err
+ binuin32.h5
+ binuin32.h5.new
+ binuin32.h5.new.err
+ binuin32.h5.out
+ binuin32.h5.out.err
+ txtstr.h5
+ txtstr.h5.new
+ txtstr.h5.new.err
+ txtstr.h5.out
+ txtstr.h5.out.err
+ textpfe.h5
+ textpfe.h5.new
+ textpfe.h5.new.err
+ textpfe.h5.out
+ textpfe.h5.out.err
+ dbinfp64.h5
+ dbinfp64.h5.bin
+ dbinfp64.h5.imp
+ dbinfp64.h5.imp.err
+ dbinfp64.h5.dmp
+ dbinfp64.h5.dmp.err
+ dbinfp64.h5.dff
+ dbinfp64.h5.dff.err
+ dbinin8.h5
+ dbinin8.h5.bin
+ dbinin8.h5.imp
+ dbinin8.h5.imp.err
+ dbinin8.h5.dmp
+ dbinin8.h5.dmp.err
+ dbinin8.h5.dff
+ dbinin8.h5.dff.err
+ dbinin8w.h5
+ dbinin8w.h5.bin
+ dbinin8w.h5.imp
+ dbinin8w.h5.imp.err
+ dbinin8w.h5.dmp
+ dbinin8w.h5.dmp.err
+ dbinin8w.h5.dff
+ dbinin8w.h5.dff.err
+ dbinin16.h5
+ dbinin16.h5.bin
+ dbinin16.h5.imp
+ dbinin16.h5.imp.err
+ dbinin16.h5.dmp
+ dbinin16.h5.dmp.err
+ dbinin16.h5.dff
+ dbinin16.h5.dff.err
+ dbinin32.h5
+ dbinin32.h5.bin
+ dbinin32.h5.imp
+ dbinin32.h5.imp.err
+ dbinin32.h5.dmp
+ dbinin32.h5.dmp.err
+ dbinin32.h5.dff
+ dbinin32.h5.dff.err
+ dbinuin16.h5
+ dbinuin16.h5.bin
+ dbinuin16.h5.imp
+ dbinuin16.h5.imp.err
+ dbinuin16.h5.dmp
+ dbinuin16.h5.dmp.err
+ dbinuin16.h5.dff
+ dbinuin16.h5.dff.err
+ dbinuin32.h5
+ dbinuin32.h5.bin
+ dbinuin32.h5.imp
+ dbinuin32.h5.imp.err
+ dbinuin32.h5.dmp
+ dbinuin32.h5.dmp.err
+ dbinuin32.h5.dff
+ dbinuin32.h5.dff.err
+ dtxtstr.h5
+ dtxtstr.h5.bin
+ dtxtstr.h5.imp
+ dtxtstr.h5.imp.err
+ dtxtstr.h5.dmp
+ dtxtstr.h5.dmp.err
+ dtxtstr.h5.dff
+ dtxtstr.h5.dff.err
+ )
+ set (last_test "H5IMPORT-clear-objects")
+ endif (HDF5_ENABLE_USING_MEMCHECKER)
+
+ add_test (
+ NAME H5IMPORT-h5importtest-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ binfp64.bin
+ binin8.bin
+ binin8w.bin
+ binin16.bin
+ binin32.bin
+ binuin16.bin
+ binuin32.bin
+ )
+ if (NOT "${last_test}" STREQUAL "")
+ set_tests_properties (H5IMPORT-h5importtest-clear-objects PROPERTIES DEPENDS ${last_test})
+ endif (NOT "${last_test}" STREQUAL "")
+ set (last_test "H5IMPORT-clear-objects")
+
+ add_test (NAME H5IMPORT-h5importtest COMMAND $<TARGET_FILE:h5importtest>)
+ set_tests_properties (H5IMPORT-h5importtest PROPERTIES DEPENDS H5IMPORT-h5importtest-clear-objects)
+
+ # ----- TESTING "ASCII I32 rank 3 - Output BE " ;
+ ADD_H5_TEST (ASCII_I32 testfiles/txtin32.txt testfiles/txtin32.conf txtin32.h5)
+
+ # ----- TESTING "ASCII I16 rank 3 - Output LE - CHUNKED - extended"
+ ADD_H5_TEST (ASCII_I16 testfiles/txtin16.txt testfiles/txtin16.conf txtin16.h5)
+
+ # ----- TESTING "ASCII I8 - rank 3 - Output I8 LE-Chunked+Extended+Compressed "
+ ADD_H5_TEST (ASCII_I8 testfiles/txtin8.txt testfiles/txtin8.conf txtin8.h5)
+
+ # ----- TESTING "ASCII UI16 - rank 2 - Output LE+Chunked+Compressed "
+ ADD_H5_TEST (ASCII_UI16 testfiles/txtuin16.txt testfiles/txtuin16.conf txtuin16.h5)
+
+ # ----- TESTING "ASCII UI32 - rank 3 - Output BE"
+ ADD_H5_TEST (ASCII_UI32 testfiles/txtuin32.txt testfiles/txtuin32.conf txtuin32.h5)
+
+ # ----- TESTING "ASCII F32 - rank 3 - Output LE "
+ ADD_H5_TEST (ASCII_F32 testfiles/txtfp32.txt testfiles/txtfp32.conf txtfp32.h5)
+
+ # ----- TESTING "ASCII F64 - rank 3 - Output BE + CHUNKED+Extended+Compressed "
+ ADD_H5_TEST (ASCII_F64 testfiles/txtfp64.txt testfiles/txtfp64.conf txtfp64.h5)
+
+ # ----- TESTING "BINARY F64 - rank 3 - Output LE+CHUNKED+Extended+Compressed "
+ ADD_H5_TEST (BINARY_F64 binfp64.bin testfiles/binfp64.conf binfp64.h5)
+ if (NOT USE_FILTER_DEFLATE)
+ ADD_H5_SKIP_DUMPTEST (BINARY_F64 "/fp/bin/64-bit" binfp64.h5 BINARY)
+ else (NOT USE_FILTER_DEFLATE)
+ ADD_H5_DUMPTEST (BINARY_F64 "/fp/bin/64-bit" binfp64.h5 BINARY)
+ endif (NOT USE_FILTER_DEFLATE)
+
+ # ----- TESTING "BINARY I8 - rank 3 - Output I16LE + Chunked+Extended+Compressed "
+ ADD_H5_TEST (BINARY_I8 binin8.bin testfiles/binin8.conf binin8.h5)
+ if (NOT USE_FILTER_DEFLATE)
+ ADD_H5_SKIP_DUMPTEST (BINARY_I8 "/int/bin/8-bit" binin8.h5 BINARY)
+ else (NOT USE_FILTER_DEFLATE)
+ ADD_H5_DUMPTEST (BINARY_I8 "/int/bin/8-bit" binin8.h5 BINARY)
+ endif (NOT USE_FILTER_DEFLATE)
+
+ # ----- TESTING "BINARY I16 - rank 3 - Output order LE + CHUNKED + extended "
+ ADD_H5_TEST (BINARY_I16 binin16.bin testfiles/binin16.conf binin16.h5)
+ ADD_H5_DUMPTEST (BINARY_I16 "/int/bin/16-bit" binin16.h5 BINARY)
+
+ # ----- TESTING "BINARY I32 - rank 3 - Output BE + CHUNKED "
+ ADD_H5_TEST (BINARY_I32 binin32.bin testfiles/binin32.conf binin32.h5)
+ ADD_H5_DUMPTEST (BINARY_I32 "/int/bin/32-bit" binin32.h5 BINARY)
+
+ # ----- TESTING "BINARY UI16 - rank 3 - Output byte BE + CHUNKED "
+ ADD_H5_TEST (BINARY_UI16 binuin16.bin testfiles/binuin16.conf binuin16.h5)
+ ADD_H5_DUMPTEST (BINARY_UI16 "/int/buin/16-bit" binuin16.h5 BINARY)
+
+ # ----- TESTING "BINARY UI32 - rank 3 - Output LE "
+ ADD_H5_TEST (BINARY_UI32 binuin32.bin testfiles/binuin32.conf binuin32.h5)
+ ADD_H5_DUMPTEST (BINARY_UI32 "/int/buin/32-bit" binuin32.h5 BINARY)
+
+ # ----- TESTING "STR"
+ ADD_H5_TEST (STR testfiles/txtstr.txt testfiles/txtstr.conf txtstr.h5)
+ ADD_H5_DUMPTEST (STR "/mytext/data" txtstr.h5)
+
+ # ----- TESTING "BINARY I8 CR LF EOF"
+ ADD_H5_TEST (BINARY_I8_EOF binin8w.bin testfiles/binin8w.conf binin8w.h5)
+ ADD_H5_DUMPTEST (BINARY_I8_EOF "/dataset0" binin8w.h5 BINARY)
+
+ # ----- TESTING "ASCII F64 - rank 1 - INPUT-CLASS TEXTFPE "
+ ADD_H5_TEST (ASCII_F64_R1 testfiles/textpfe64.txt testfiles/textpfe.conf textpfe.h5)
+
diff --git a/tools/test/h5import/Makefile.am b/tools/test/h5import/Makefile.am
new file mode 100644
index 0000000..f238f77
--- /dev/null
+++ b/tools/test/h5import/Makefile.am
@@ -0,0 +1,40 @@
+#
+# 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.
+##
+## Makefile.am
+## Run automake to generate a Makefile.in from this file.
+#
+# HDF5 Library Makefile(.in)
+#
+
+include $(top_srcdir)/config/commence.am
+
+# Include src and tools/lib directories
+AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib
+
+# Test programs and scripts
+TEST_PROG=h5importtest
+TEST_SCRIPT=h5importtestutil.sh
+
+check_PROGRAMS=$(TEST_PROG)
+check_SCRIPT=$(TEST_SCRIPT)
+SCRIPT_DEPEND=../../src/h5import/h5import$(EXEEXT)
+
+# All programs depend on the main hdf5 library and the tools library
+LDADD=$(LIBH5TOOLS) $(LIBHDF5)
+
+# Temporary files from h5importtest
+CHECK_CLEANFILES+=*.bin
+
+include $(top_srcdir)/config/conclude.am
diff --git a/tools/test/h5import/h5importtest.c b/tools/test/h5import/h5importtest.c
new file mode 100644
index 0000000..38fd75b
--- /dev/null
+++ b/tools/test/h5import/h5importtest.c
@@ -0,0 +1,371 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include <stdio.h>
+#include "H5private.h"
+
+#ifdef H5_HAVE_WIN32_API
+#define OPEN_FLAGS "wb"
+#else
+#define OPEN_FLAGS "w"
+#endif
+
+/*
+ * Name:
+ * h5importtest
+ *
+ * Description:
+ * This program creates that can be
+ * used to test the h5import program.
+ *
+ */
+
+int
+main(void)
+{
+ int nrow = 3, ncol = 4, npln = 5;
+ int i, j, k;
+ FILE *sp;
+
+ float row4[3], col4[4], pln4[5];
+ float rowo4 = 11.0F, colo4 = 21.0F, plno4 = 51.0F;
+ float rowi4 = 1.0F, coli4 = 2.0F, plni4 = 5.0F;
+
+ int b32i3[5][3][4];
+ int row4i[3], col4i[4], pln4i[5];
+ int rowo4i = 11 , colo4i = 21 , plno4i = 51 ;
+ int rowi4i = 1 , coli4i = 2 , plni4i = 5 ;
+
+#ifdef H5_SIZEOF_LONG_LONG
+ long long row4i64[3], col4i64[4], pln4i64[5];
+ long long rowo4i64 = (long long)11 , colo4i64 = (long long)21 , plno4i64 = (long long)51 ;
+ long long rowi4i64 = (long long)1 , coli4i64 = (long long)2 , plni4i64 = (long long)5 ;
+#endif
+
+ short b16i3[5][3][4];
+ short row4i16[3], col4i16[4], pln4i16[5];
+ short rowo4i16 = (short)11 , colo4i16 = (short)21 , plno4i16 = (short)51 ;
+ short rowi4i16 = (short)1 , coli4i16 = (short)2 , plni4i16 = (short)5 ;
+
+ char b8i3[5][3][4];
+ char row4i8[3], col4i8[4], pln4i8[5];
+ char rowo4i8 = (char)11 , colo4i8 = (char)21 , plno4i8 = (char)51 ;
+ char rowi4i8 = (char)1 , coli4i8 = (char)2 , plni4i8 = (char)5 ;
+
+ double b64r3[5][3][4];
+ double row8[3], col8[4], pln8[5];
+ double rowo8 = 11.0F, colo8 = 21.0F, plno8 = 51.0F;
+ double rowi8 = 1.0F, coli8 = 2.0F, plni8 = 5.0F;
+
+
+ /*
+ * initialize the row, column, and plane vectors
+ *
+ * row values start at 11 and increment by 1 => 11, 12, 13
+ * column values start at 21 and increment by 2 => 21, 23, 25, 27
+ * plane values start at 51 and increment by 5 => 51, 56, 61, 66, 71
+ */
+
+
+ /*
+ * build array elements - rank 2
+ *
+ * element value = sum of row value and col values
+ */
+
+ row4[0] = rowo4;
+ col4[0] = colo4;
+ pln4[0] = plno4;
+
+ row8[0] = rowo8;
+ col8[0] = colo8;
+ pln8[0] = plno8;
+
+ row4i[0] = rowo4i;
+ col4i[0] = colo4i;
+ pln4i[0] = plno4i;
+
+#ifdef H5_SIZEOF_LONG_LONG
+ row4i64[0] = rowo4i64;
+ col4i64[0] = colo4i64;
+ pln4i64[0] = plno4i64;
+#endif
+
+ row4i16[0] = rowo4i16;
+ col4i16[0] = colo4i16;
+ pln4i16[0] = plno4i16;
+
+ row4i8[0] = rowo4i8;
+ col4i8[0] = colo4i8;
+ pln4i8[0] = plno4i8;
+
+ for (i = 1; i < nrow; i++)
+ {
+ row4[i] = row4[i - 1] + rowi4;
+ row8[i] = row8[i - 1] + rowi8;
+ row4i[i] = row4i[i - 1] + rowi4i;
+#ifdef H5_SIZEOF_LONG_LONG
+ row4i64[i] = row4i64[i - 1] + rowi4i64;
+#endif
+ row4i16[i] = (short)(row4i16[i - 1] + rowi4i16);
+ row4i8[i] = (char)(row4i8[i - 1] + rowi4i8);
+ }
+
+ for (j = 1; j < ncol; j++)
+ {
+ col4[j] = col4[j - 1] + coli4;
+ col8[j] = col8[j - 1] + coli8;
+ col4i[j] = col4i[j - 1] + coli4i;
+#ifdef H5_SIZEOF_LONG_LONG
+ col4i64[j] = col4i64[j - 1] + coli4i64;
+#endif
+ col4i16[j] = (short)(col4i16[j - 1] + coli4i16);
+ col4i8[j] = (char)(col4i8[j - 1] + coli4i8);
+ }
+ for (k = 1; k < npln; k++)
+ {
+ pln4[k] = pln4[k - 1] + plni4;
+ pln8[k] = pln8[k - 1] + plni8;
+ pln4i[k] = pln4i[k - 1] + plni4i;
+#ifdef H5_SIZEOF_LONG_LONG
+ pln4i64[k] = pln4i64[k - 1] + plni4i64;
+#endif
+ pln4i16[k] = (short)(pln4i16[k - 1] + plni4i16);
+ pln4i8[k] = (char)(pln4i8[k - 1] + plni4i8);
+ }
+
+ /*
+ * build array elements - rank 3
+ *
+ * element value = sum of row value, col, and plane values
+ */
+
+ for (i = 0; i < nrow; i++)
+ for (j = 0; j < ncol; j++)
+ for (k = 0; k < npln; k++) {
+ b64r3[k][i][j] = row8[i] + col8[j] + pln8[k];
+ b32i3[k][i][j] = row4i[i] + col4i[j] + pln4i[k];
+ b16i3[k][i][j] = (short)(row4i16[i] + col4i16[j] + pln4i16[k]);
+ b8i3[k][i][j] = (char)(row4i8[i] + col4i8[j] + pln4i8[k]);
+ }
+
+
+
+#ifndef UNICOS
+
+#ifdef REBUILDTEXTFILES
+ /*-------------------------------------------------------------------------
+ * TOOLTEST txtin8.txt -c $srcdir/testfiles/txtin8.conf -o txtin8.h5
+ *-------------------------------------------------------------------------
+ */
+
+ sp = HDfopen("txtin8.txt", "w");
+ for (k = 0; k < npln; k++)
+ {
+ for (i = 0; i < nrow; i++)
+ {
+ for (j = 0; j < ncol; j++)
+ (void) fprintf(sp, "%10u", b8i3[k][i][j]);
+ (void) fprintf(sp, "\n");
+ }
+ }
+ (void) HDfclose(sp);
+
+ /*-------------------------------------------------------------------------
+ * TOOLTEST txtin16.txt -c $srcdir/testfiles/txtin16.conf -o txtin16.h5
+ *-------------------------------------------------------------------------
+ */
+
+ sp = HDfopen("txtin16.txt", "w");
+ for (k = 0; k < npln; k++)
+ {
+ for (i = 0; i < nrow; i++)
+ {
+ for (j = 0; j < ncol; j++)
+ (void) fprintf(sp, "%10u", b16i3[k][i][j]);
+ (void) fprintf(sp, "\n");
+ }
+ }
+ (void) HDfclose(sp);
+
+ /*-------------------------------------------------------------------------
+ * TOOLTEST txtin32.txt -c $srcdir/testfiles/textin32.conf -o textin32.h5
+ *-------------------------------------------------------------------------
+ */
+
+ sp = HDfopen("txtin32.txt", "w");
+ for (k = 0; k < npln; k++)
+ {
+ for (i = 0; i < nrow; i++)
+ {
+ for (j = 0; j < ncol; j++)
+ (void) fprintf(sp, "%10d", b32i3[k][i][j]);
+ (void) fprintf(sp, "\n");
+ }
+ }
+ (void) HDfclose(sp);
+#endif
+
+ /*-------------------------------------------------------------------------
+ * TOOLTEST binin32.bin -c $srcdir/testfiles/binin32.conf -o binin32.h5
+ *-------------------------------------------------------------------------
+ */
+
+ sp = HDfopen("binin32.bin", OPEN_FLAGS);
+ for (k = 0; k < npln; k++)
+ {
+ for (i = 0; i < nrow; i++)
+ {
+ for (j = 0; j < ncol; j++)
+ {
+ (void) HDfwrite((char *) &b32i3[k][i][j], sizeof(int), 1, sp);
+ }
+ }
+ }
+ (void) HDfclose(sp);
+
+ /*-------------------------------------------------------------------------
+ * TOOLTEST binuin32.bin -c $srcdir/testfiles/binuin32.conf -o binuin32.h5
+ *-------------------------------------------------------------------------
+ */
+
+ sp = HDfopen("binuin32.bin", OPEN_FLAGS);
+ for (k = 0; k < npln; k++)
+ {
+ for (i = 0; i < nrow; i++)
+ {
+ for (j = 0; j < ncol; j++)
+ {
+ (void) HDfwrite((char *) &b32i3[k][i][j], sizeof(unsigned int), 1, sp);
+ }
+ }
+ }
+ (void) HDfclose(sp);
+
+
+
+
+ /*-------------------------------------------------------------------------
+ * TOOLTEST binin16.bin -c $srcdir/testfiles/binin16.conf -o binin16.h5
+ *-------------------------------------------------------------------------
+ */
+
+ sp = HDfopen("binin16.bin", OPEN_FLAGS);
+ for (k = 0; k < npln; k++)
+ {
+ for (i = 0; i < nrow; i++)
+ {
+ for (j = 0; j < ncol; j++)
+ {
+ (void) HDfwrite((char *) &b16i3[k][i][j], sizeof(short), 1, sp);
+ }
+ }
+ }
+ (void) HDfclose(sp);
+
+ /*-------------------------------------------------------------------------
+ * TOOLTEST binuin16.bin -c $srcdir/testfiles/binuin16.conf -o binuin16.h5
+ *-------------------------------------------------------------------------
+ */
+ sp = HDfopen("binuin16.bin", OPEN_FLAGS);
+ for (k = 0; k < npln; k++)
+ {
+ for (i = 0; i < nrow; i++)
+ {
+ for (j = 0; j < ncol; j++)
+ {
+ (void) HDfwrite((char *) &b16i3[k][i][j], sizeof(unsigned short), 1, sp);
+ }
+ }
+ }
+ (void) HDfclose(sp);
+
+
+
+ /*-------------------------------------------------------------------------
+ * TOOLTEST binin8.bin -c $srcdir/testfiles/binin8.conf -o binin8.h5
+ *-------------------------------------------------------------------------
+ */
+
+ sp = HDfopen("binin8.bin", OPEN_FLAGS);
+ for (k = 0; k < npln; k++)
+ {
+ for (i = 0; i < nrow; i++)
+ {
+ for (j = 0; j < ncol; j++)
+ {
+ (void) HDfwrite((char *) &b8i3[k][i][j], sizeof(char), 1, sp);
+ }
+ }
+ }
+ (void) HDfclose(sp);
+
+#endif /* UNICOS */
+
+
+
+
+ /*-------------------------------------------------------------------------
+ * TOOLTEST binfp64.bin -c $srcdir/testfiles/binfp64.conf -o binfp64.h5
+ *-------------------------------------------------------------------------
+ */
+
+ /*
+ * binary 64-bit file - rank 2 & 3
+ */
+
+ sp = HDfopen("binfp64.bin", OPEN_FLAGS);
+ for (k = 0; k < npln; k++)
+ {
+ for (i = 0; i < nrow; i++)
+ {
+ for (j = 0; j < ncol; j++)
+ {
+ (void) HDfwrite((char *) &b64r3[k][i][j], sizeof(double), 1, sp);
+ }
+ }
+ }
+ (void) HDfclose(sp);
+
+
+
+ /*-------------------------------------------------------------------------
+ * TOOLTEST binin8w.bin -c $srcdir/testfiles/binin8w.conf -o binin8w.h5
+ *-------------------------------------------------------------------------
+ */
+
+ {
+ /* test CR+LF (13,10) and EOF (26) in windows */
+ char bin8w[4] = {13,10,26,0};
+
+ sp = HDfopen("binin8w.bin", OPEN_FLAGS);
+ for (i = 0; i < 4; i++)
+ {
+ char c = bin8w[i];
+ if ( HDfwrite( &c, sizeof(char), 1, sp) != 1 )
+ printf("error writing file\n");
+ }
+ HDfclose(sp);
+
+
+ }
+
+
+
+
+
+ return (EXIT_SUCCESS);
+}
+
diff --git a/tools/test/h5import/h5importtestutil.sh.in b/tools/test/h5import/h5importtestutil.sh.in
new file mode 100644
index 0000000..1a9a3fc
--- /dev/null
+++ b/tools/test/h5import/h5importtestutil.sh.in
@@ -0,0 +1,384 @@
+#!/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 h5import tool
+
+srcdir=@srcdir@
+
+# Determine which filters are available
+USE_FILTER_DEFLATE="@USE_FILTER_DEFLATE@"
+
+TESTNAME=h5import
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+
+DUMPER=../../src/h5dump/h5dump # The tool name
+DUMPER_BIN=`pwd`/$DUMPER # The path of the tool binary
+
+H5DIFF=../../src/h5diff/h5diff # The h5diff tool name
+H5DIFF_BIN=`pwd`/$H5DIFF # The path of the h5diff tool binary
+
+H5IMPORT=../../src/h5import/h5import # The h5import tool name
+H5IMPORT_BIN=`pwd`/$H5IMPORT # The path of the h5import tool binary
+
+RM='rm -rf'
+CP='cp'
+DIRNAME='dirname'
+LS='ls'
+AWK='awk'
+
+# initialize errors variable
+nerrors=0
+
+# 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/test/h5diff/testfiles"
+SRC_H5COPY_TESTFILES="$SRC_TOOLS/test/h5copy/testfiles"
+SRC_H5REPACK_TESTFILES="$SRC_TOOLS/test/h5repack/testfiles"
+SRC_H5JAM_TESTFILES="$SRC_TOOLS/test/h5jam/testfiles"
+SRC_H5STAT_TESTFILES="$SRC_TOOLS/test/h5stat/testfiles"
+SRC_H5IMPORT_TESTFILES="$SRC_TOOLS/test/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_H5IMPORT_TESTFILES/binfp64.h5
+$SRC_H5IMPORT_TESTFILES/binin8.h5
+$SRC_H5IMPORT_TESTFILES/binin8w.h5
+$SRC_H5IMPORT_TESTFILES/binin16.h5
+$SRC_H5IMPORT_TESTFILES/binin32.h5
+$SRC_H5IMPORT_TESTFILES/binuin16.h5
+$SRC_H5IMPORT_TESTFILES/binuin32.h5
+$SRC_H5IMPORT_TESTFILES/txtfp32.h5
+$SRC_H5IMPORT_TESTFILES/txtfp64.h5
+$SRC_H5IMPORT_TESTFILES/txtin8.h5
+$SRC_H5IMPORT_TESTFILES/txtin16.h5
+$SRC_H5IMPORT_TESTFILES/txtin32.h5
+$SRC_H5IMPORT_TESTFILES/txtuin16.h5
+$SRC_H5IMPORT_TESTFILES/txtuin32.h5
+$SRC_H5IMPORT_TESTFILES/txtstr.h5
+$SRC_H5IMPORT_TESTFILES/textpfe.h5
+"
+
+LIST_OTHER_TEST_FILES="
+$SRC_H5IMPORT_TESTFILES/binfp64.conf
+$SRC_H5IMPORT_TESTFILES/binin8.conf
+$SRC_H5IMPORT_TESTFILES/binin8w.conf
+$SRC_H5IMPORT_TESTFILES/binin16.conf
+$SRC_H5IMPORT_TESTFILES/binin32.conf
+$SRC_H5IMPORT_TESTFILES/binuin16.conf
+$SRC_H5IMPORT_TESTFILES/binuin32.conf
+$SRC_H5IMPORT_TESTFILES/txtfp32.conf
+$SRC_H5IMPORT_TESTFILES/txtfp64.conf
+$SRC_H5IMPORT_TESTFILES/txtin8.conf
+$SRC_H5IMPORT_TESTFILES/txtin16.conf
+$SRC_H5IMPORT_TESTFILES/txtin32.conf
+$SRC_H5IMPORT_TESTFILES/txtuin16.conf
+$SRC_H5IMPORT_TESTFILES/txtuin32.conf
+$SRC_H5IMPORT_TESTFILES/textpfe.conf
+$SRC_H5IMPORT_TESTFILES/txtstr.conf
+$SRC_H5IMPORT_TESTFILES/txtfp32.txt
+$SRC_H5IMPORT_TESTFILES/txtfp64.txt
+$SRC_H5IMPORT_TESTFILES/txtuin16.txt
+$SRC_H5IMPORT_TESTFILES/txtuin32.txt
+$SRC_H5IMPORT_TESTFILES/txtin8.txt
+$SRC_H5IMPORT_TESTFILES/txtin16.txt
+$SRC_H5IMPORT_TESTFILES/txtin32.txt
+$SRC_H5IMPORT_TESTFILES/textpfe64.txt
+$SRC_H5IMPORT_TESTFILES/txtstr.txt
+$SRC_H5IMPORT_TESTFILES/dbinfp64.h5.txt
+$SRC_H5IMPORT_TESTFILES/dbinin8.h5.txt
+$SRC_H5IMPORT_TESTFILES/dbinin8w.h5.txt
+$SRC_H5IMPORT_TESTFILES/dbinin16.h5.txt
+$SRC_H5IMPORT_TESTFILES/dbinin32.h5.txt
+$SRC_H5IMPORT_TESTFILES/dbinuin16.h5.txt
+$SRC_H5IMPORT_TESTFILES/dbinuin32.h5.txt
+$SRC_H5IMPORT_TESTFILES/dtxtstr.h5.txt
+"
+
+#
+# copy test files and expected output files from source dirs to test dir
+#
+COPY_TESTFILES="$LIST_HDF5_TEST_FILES $LIST_OTHER_TEST_FILES"
+
+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
+ # skip cp if srcdir is same as destdir
+ # this occurs when build/test performed in source dir and
+ # make cp fail
+ SDIR=`$DIRNAME $tstfile`
+ INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
+ INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
+ if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
+ $CP -f $tstfile $TESTDIR
+ if [ $? -ne 0 ]; then
+ echo "Error: FAILED to copy $tstfile ."
+
+ # Comment out this to CREATE expected file
+ exit $EXIT_FAILURE
+ fi
+ fi
+ fi
+ done
+}
+
+CLEAN_TESTFILES_AND_TESTDIR()
+{
+ # skip rm if srcdir is same as destdir
+ # this occurs when build/test performed in source dir and
+ # make cp fail
+ SDIR=$SRC_H5IMPORT_TESTFILES
+ INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
+ INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
+ if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
+ $RM $TESTDIR
+ fi
+}
+
+# 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'
+}
+
+# Print a "SKIP" message
+SKIP() {
+ TESTING $TESTNAME $@
+ echo " -SKIP-"
+}
+
+TOOLTEST()
+{
+err=0
+$RUNSERIAL $H5IMPORT_BIN $*
+$RUNSERIAL $DUMPER_BIN $5 >log2
+
+cd tmp_testfiles
+$RUNSERIAL $DUMPER_BIN $5 >log1
+cd ..
+
+cmp -s tmp_testfiles/log1 log2 || err=1
+rm -f log2 tmp_testfiles/log1
+if [ $err -eq 1 ]; then
+nerrors="` expr $nerrors + 1 `";
+ echo "*FAILED*"
+else
+ echo " PASSED"
+fi
+}
+
+# Use h5dump output as input to h5import for binary numbers
+# Use h5diff to verify results
+TOOLTEST2()
+{
+err=0
+$RUNSERIAL $DUMPER_BIN -p -d $1 -o d$2.bin -b tmp_testfiles/$2 > d$2.dmp
+$RUNSERIAL $H5IMPORT_BIN d$2.bin -c d$2.dmp -o d$2 > d$2.imp
+$RUNSERIAL $H5DIFF_BIN -v d$2 tmp_testfiles/$2 $1 $1 > log2
+$CP -f $SRC_H5IMPORT_TESTFILES/d$2.txt log1
+
+cmp -s log1 log2 || err=1
+rm -f log1 log2
+if [ $err -eq 1 ]; then
+nerrors="` expr $nerrors + 1 `";
+ echo "*FAILED*"
+else
+ echo " PASSED"
+fi
+}
+
+# Same as TOOLTEST2 except for strings
+# Use h5dump output as input to h5import for strings
+# Use h5diff to verify results
+TOOLTEST3()
+{
+err=0
+$RUNSERIAL $DUMPER_BIN -p -d $1 -o d$2.bin -y --width=1 tmp_testfiles/$2 > d$2.dmp
+$RUNSERIAL $H5IMPORT_BIN d$2.bin -c d$2.dmp -o d$2 > d$2.imp
+$RUNSERIAL $H5DIFF_BIN -v d$2 tmp_testfiles/$2 $1 $1 > log2
+$CP -f $SRC_H5IMPORT_TESTFILES/d$2.txt log1
+
+cmp -s log1 log2 || err=1
+rm -f log1 log2
+if [ $err -eq 1 ]; then
+nerrors="` expr $nerrors + 1 `";
+ echo "*FAILED*"
+else
+ echo " PASSED"
+fi
+}
+
+# Same as TOOLTEST3 except for h5diff uses report mode without warnings
+# Use h5dump output as input to h5import for strings
+# Use h5diff to verify results
+TOOLTEST4()
+{
+err=0
+$RUNSERIAL $DUMPER_BIN -p -d $1 -o d$2.bin -y --width=1 tmp_testfiles/$2 > d$2.dmp
+$RUNSERIAL $H5IMPORT_BIN d$2.bin -c d$2.dmp -o d$2 > d$2.imp
+$RUNSERIAL $H5DIFF_BIN -r d$2 tmp_testfiles/$2 $1 $1 > log2
+$CP -f $SRC_H5IMPORT_TESTFILES/d$2.txt log1
+
+
+cmp -s log1 log2 || err=1
+rm -f log1 log2
+if [ $err -eq 1 ]; then
+nerrors="` expr $nerrors + 1 `";
+ echo "*FAILED*"
+else
+ echo " PASSED"
+fi
+}
+
+echo ""
+echo "=============================="
+echo "H5IMPORT tests started"
+echo "=============================="
+
+#echo "** Testing h5import ***"
+
+rm -f output.h5 log1 tx* b* *.dat
+
+# prepare for test
+COPY_TESTFILES_TO_TESTDIR
+
+mkdir tmp_testfiles
+$CP $TESTDIR/*.h5 ./tmp_testfiles/
+
+$RUNSERIAL ./h5importtest
+
+################################################
+### T H E T E S T S
+################################################
+
+TESTING "ASCII I32 rank 3 - Output BE " ;
+TOOLTEST $TESTDIR/txtin32.txt -c $TESTDIR/txtin32.conf -o txtin32.h5
+
+TESTING "ASCII I16 rank 3 - Output LE - CHUNKED - extended"
+TOOLTEST $TESTDIR/txtin16.txt -c $TESTDIR/txtin16.conf -o txtin16.h5
+
+TESTING "ASCII I8 - rank 3 - Output I8 LE-Chunked+Extended+Compressed "
+TOOLTEST $TESTDIR/txtin8.txt -c $TESTDIR/txtin8.conf -o txtin8.h5
+
+
+TESTING "ASCII UI16 - rank 2 - Output LE+Chunked+Compressed "
+TOOLTEST $TESTDIR/txtuin16.txt -c $TESTDIR/txtuin16.conf -o txtuin16.h5
+
+TESTING "ASCII UI32 - rank 3 - Output BE"
+TOOLTEST $TESTDIR/txtuin32.txt -c $TESTDIR/txtuin32.conf -o txtuin32.h5
+
+
+TESTING "ASCII F32 - rank 3 - Output LE "
+TOOLTEST $TESTDIR/txtfp32.txt -c $TESTDIR/txtfp32.conf -o txtfp32.h5
+
+TESTING "ASCII F64 - rank 3 - Output BE + CHUNKED+Extended+Compressed "
+TOOLTEST $TESTDIR/txtfp64.txt -c $TESTDIR/txtfp64.conf -o txtfp64.h5
+
+
+TESTING "BINARY F64 - rank 3 - Output LE+CHUNKED+Extended+Compressed "
+TOOLTEST binfp64.bin -c $TESTDIR/binfp64.conf -o binfp64.h5
+TESTING "H5DUMP-BINARY F64 - rank 3 - Output LE+CHUNKED+Extended+Compressed "
+if test $USE_FILTER_DEFLATE != "yes"; then
+ SKIP "/fp/bin/64-bit" binfp64.h5
+else
+ TOOLTEST2 "/fp/bin/64-bit" binfp64.h5
+fi
+
+
+TESTING "BINARY I8 - rank 3 - Output I16LE + Chunked+Extended+Compressed "
+TOOLTEST binin8.bin -c $TESTDIR/binin8.conf -o binin8.h5
+TESTING "H5DUMP-BINARY I8 - rank 3 - Output I16LE + Chunked+Extended+Compressed "
+if test $USE_FILTER_DEFLATE != "yes"; then
+ SKIP "/int/bin/8-bit" binin8.h5
+else
+ TOOLTEST2 "/int/bin/8-bit" binin8.h5
+fi
+
+TESTING "BINARY I16 - rank 3 - Output order LE + CHUNKED + extended "
+TOOLTEST binin16.bin -c $TESTDIR/binin16.conf -o binin16.h5
+TESTING "H5DUMP-BINARY I16 - rank 3 - Output order LE + CHUNKED + extended "
+TOOLTEST2 "/int/bin/16-bit" binin16.h5
+
+TESTING "BINARY I32 - rank 3 - Output BE + CHUNKED "
+TOOLTEST binin32.bin -c $TESTDIR/binin32.conf -o binin32.h5
+TESTING "H5DUMP-BINARY I32 - rank 3 - Output BE + CHUNKED "
+TOOLTEST2 "/int/bin/32-bit" binin32.h5
+
+
+TESTING "BINARY UI16 - rank 3 - Output byte BE + CHUNKED "
+TOOLTEST binuin16.bin -c $TESTDIR/binuin16.conf -o binuin16.h5
+TESTING "H5DUMP-BINARY UI16 - rank 3 - Output byte BE + CHUNKED "
+TOOLTEST2 "/int/buin/16-bit" binuin16.h5
+
+TESTING "BINARY UI32 - rank 3 - Output LE + CHUNKED "
+TOOLTEST binuin32.bin -c $TESTDIR/binuin32.conf -o binuin32.h5
+TESTING "H5DUMP-BINARY UI32 - rank 3 - Output LE + CHUNKED "
+TOOLTEST2 "/int/buin/32-bit" binuin32.h5
+
+
+TESTING "STR"
+TOOLTEST $TESTDIR/txtstr.txt -c $TESTDIR/txtstr.conf -o txtstr.h5
+TESTING "H5DUMP-STR"
+TOOLTEST4 "/mytext/data" txtstr.h5
+
+
+TESTING "BINARY I8 CR LF EOF"
+TOOLTEST binin8w.bin -c $TESTDIR/binin8w.conf -o binin8w.h5
+TESTING "H5DUMP-BINARY I8 CR LF EOF"
+TOOLTEST2 "/dataset0" binin8w.h5
+
+TESTING "ASCII F64 - rank 1 - INPUT-CLASS TEXTFPE "
+TOOLTEST $TESTDIR/textpfe64.txt -c $TESTDIR/textpfe.conf -o textpfe.h5
+
+
+rm -f txtin32.txt txtin16.txt txtin8.txt txtuin32.txt txtuin16.txt *.bin *.dmp *.imp *.h5
+rm -rf tmp_testfiles
+
+# Clean up temporary files/directories
+CLEAN_TESTFILES_AND_TESTDIR
+
+#
+# Check errors result
+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/test/h5import/testfiles/binfp64.conf b/tools/test/h5import/testfiles/binfp64.conf
new file mode 100644
index 0000000..6b4c361
--- /dev/null
+++ b/tools/test/h5import/testfiles/binfp64.conf
@@ -0,0 +1,13 @@
+PATH /fp/bin/64-bit
+INPUT-CLASS FP
+INPUT-SIZE 64
+RANK 3
+DIMENSION-SIZES 5 3 4
+OUTPUT-ARCHITECTURE IEEE
+OUTPUT-BYTE-ORDER LE
+CHUNKED-DIMENSION-SIZES 2 2 2
+COMPRESSION-PARAM 8
+MAXIMUM-DIMENSIONS -1 6 7
+
+
+
diff --git a/tools/test/h5import/testfiles/binfp64.h5 b/tools/test/h5import/testfiles/binfp64.h5
new file mode 100644
index 0000000..80e3a8a
--- /dev/null
+++ b/tools/test/h5import/testfiles/binfp64.h5
Binary files differ
diff --git a/tools/test/h5import/testfiles/binin16.conf b/tools/test/h5import/testfiles/binin16.conf
new file mode 100644
index 0000000..06869cb
--- /dev/null
+++ b/tools/test/h5import/testfiles/binin16.conf
@@ -0,0 +1,12 @@
+PATH /int/bin/16-bit
+INPUT-CLASS IN
+INPUT-SIZE 16
+RANK 3
+DIMENSION-SIZES 2 3 4
+CHUNKED-DIMENSION-SIZES 2 2 2
+MAXIMUM-DIMENSIONS -1 -1 8
+OUTPUT-ARCHITECTURE STD
+OUTPUT-BYTE-ORDER LE
+
+
+
diff --git a/tools/test/h5import/testfiles/binin16.h5 b/tools/test/h5import/testfiles/binin16.h5
new file mode 100644
index 0000000..0825bbc
--- /dev/null
+++ b/tools/test/h5import/testfiles/binin16.h5
Binary files differ
diff --git a/tools/test/h5import/testfiles/binin32.conf b/tools/test/h5import/testfiles/binin32.conf
new file mode 100644
index 0000000..11996ef
--- /dev/null
+++ b/tools/test/h5import/testfiles/binin32.conf
@@ -0,0 +1,12 @@
+PATH /int/bin/32-bit
+INPUT-CLASS IN
+INPUT-SIZE 32
+RANK 3
+DIMENSION-SIZES 5 3 4
+OUTPUT-ARCHITECTURE STD
+OUTPUT-BYTE-ORDER BE
+CHUNKED-DIMENSION-SIZES 1 2 1
+
+
+
+
diff --git a/tools/test/h5import/testfiles/binin32.h5 b/tools/test/h5import/testfiles/binin32.h5
new file mode 100644
index 0000000..fd8faa9
--- /dev/null
+++ b/tools/test/h5import/testfiles/binin32.h5
Binary files differ
diff --git a/tools/test/h5import/testfiles/binin8.conf b/tools/test/h5import/testfiles/binin8.conf
new file mode 100644
index 0000000..1edd80a
--- /dev/null
+++ b/tools/test/h5import/testfiles/binin8.conf
@@ -0,0 +1,16 @@
+PATH /int/bin/8-bit
+INPUT-CLASS IN
+INPUT-SIZE 8
+OUTPUT-CLASS IN
+OUTPUT-SIZE 16
+RANK 3
+OUTPUT-ARCHITECTURE STD
+OUTPUT-BYTE-ORDER LE
+DIMENSION-SIZES 5 3 4
+CHUNKED-DIMENSION-SIZES 2 2 2
+MAXIMUM-DIMENSIONS -1 -1 -1
+COMPRESSION-PARAM 3
+
+
+
+
diff --git a/tools/test/h5import/testfiles/binin8.h5 b/tools/test/h5import/testfiles/binin8.h5
new file mode 100644
index 0000000..a1d1a37
--- /dev/null
+++ b/tools/test/h5import/testfiles/binin8.h5
Binary files differ
diff --git a/tools/test/h5import/testfiles/binin8w.conf b/tools/test/h5import/testfiles/binin8w.conf
new file mode 100644
index 0000000..fccb4ac
--- /dev/null
+++ b/tools/test/h5import/testfiles/binin8w.conf
@@ -0,0 +1,9 @@
+
+INPUT-CLASS IN
+INPUT-SIZE 8
+RANK 1
+DIMENSION-SIZES 4
+OUTPUT-BYTE-ORDER LE
+OUTPUT-CLASS IN
+OUTPUT-SIZE 8
+OUTPUT-ARCHITECTURE STD
diff --git a/tools/test/h5import/testfiles/binin8w.h5 b/tools/test/h5import/testfiles/binin8w.h5
new file mode 100644
index 0000000..64acaed
--- /dev/null
+++ b/tools/test/h5import/testfiles/binin8w.h5
Binary files differ
diff --git a/tools/test/h5import/testfiles/binuin16.conf b/tools/test/h5import/testfiles/binuin16.conf
new file mode 100644
index 0000000..a4603df
--- /dev/null
+++ b/tools/test/h5import/testfiles/binuin16.conf
@@ -0,0 +1,12 @@
+PATH /int/buin/16-bit
+INPUT-CLASS UIN
+INPUT-SIZE 16
+RANK 3
+DIMENSION-SIZES 2 3 4
+CHUNKED-DIMENSION-SIZES 2 2 2
+MAXIMUM-DIMENSIONS -1 -1 8
+OUTPUT-ARCHITECTURE STD
+OUTPUT-BYTE-ORDER BE
+
+
+
diff --git a/tools/test/h5import/testfiles/binuin16.h5 b/tools/test/h5import/testfiles/binuin16.h5
new file mode 100644
index 0000000..c486c89
--- /dev/null
+++ b/tools/test/h5import/testfiles/binuin16.h5
Binary files differ
diff --git a/tools/test/h5import/testfiles/binuin32.conf b/tools/test/h5import/testfiles/binuin32.conf
new file mode 100644
index 0000000..a649e97
--- /dev/null
+++ b/tools/test/h5import/testfiles/binuin32.conf
@@ -0,0 +1,12 @@
+PATH /int/buin/32-bit
+INPUT-CLASS UIN
+INPUT-SIZE 32
+RANK 3
+DIMENSION-SIZES 5 3 4
+OUTPUT-ARCHITECTURE STD
+OUTPUT-BYTE-ORDER LE
+
+
+
+
+
diff --git a/tools/test/h5import/testfiles/binuin32.h5 b/tools/test/h5import/testfiles/binuin32.h5
new file mode 100644
index 0000000..41699d7
--- /dev/null
+++ b/tools/test/h5import/testfiles/binuin32.h5
Binary files differ
diff --git a/tools/test/h5import/testfiles/dbinfp64.h5.txt b/tools/test/h5import/testfiles/dbinfp64.h5.txt
new file mode 100644
index 0000000..fb88984
--- /dev/null
+++ b/tools/test/h5import/testfiles/dbinfp64.h5.txt
@@ -0,0 +1,2 @@
+dataset: </fp/bin/64-bit> and </fp/bin/64-bit>
+0 differences found
diff --git a/tools/test/h5import/testfiles/dbinin16.h5.txt b/tools/test/h5import/testfiles/dbinin16.h5.txt
new file mode 100644
index 0000000..b94781e
--- /dev/null
+++ b/tools/test/h5import/testfiles/dbinin16.h5.txt
@@ -0,0 +1,2 @@
+dataset: </int/bin/16-bit> and </int/bin/16-bit>
+0 differences found
diff --git a/tools/test/h5import/testfiles/dbinin32.h5.txt b/tools/test/h5import/testfiles/dbinin32.h5.txt
new file mode 100644
index 0000000..a35cd79
--- /dev/null
+++ b/tools/test/h5import/testfiles/dbinin32.h5.txt
@@ -0,0 +1,2 @@
+dataset: </int/bin/32-bit> and </int/bin/32-bit>
+0 differences found
diff --git a/tools/test/h5import/testfiles/dbinin8.h5.txt b/tools/test/h5import/testfiles/dbinin8.h5.txt
new file mode 100644
index 0000000..bbc6c67
--- /dev/null
+++ b/tools/test/h5import/testfiles/dbinin8.h5.txt
@@ -0,0 +1,2 @@
+dataset: </int/bin/8-bit> and </int/bin/8-bit>
+0 differences found
diff --git a/tools/test/h5import/testfiles/dbinin8w.h5.txt b/tools/test/h5import/testfiles/dbinin8w.h5.txt
new file mode 100644
index 0000000..28d43d2
--- /dev/null
+++ b/tools/test/h5import/testfiles/dbinin8w.h5.txt
@@ -0,0 +1,2 @@
+dataset: </dataset0> and </dataset0>
+0 differences found
diff --git a/tools/test/h5import/testfiles/dbinuin16.h5.txt b/tools/test/h5import/testfiles/dbinuin16.h5.txt
new file mode 100644
index 0000000..ecad7a0
--- /dev/null
+++ b/tools/test/h5import/testfiles/dbinuin16.h5.txt
@@ -0,0 +1,2 @@
+dataset: </int/buin/16-bit> and </int/buin/16-bit>
+0 differences found
diff --git a/tools/test/h5import/testfiles/dbinuin32.h5.txt b/tools/test/h5import/testfiles/dbinuin32.h5.txt
new file mode 100644
index 0000000..cc1d9f3
--- /dev/null
+++ b/tools/test/h5import/testfiles/dbinuin32.h5.txt
@@ -0,0 +1,2 @@
+dataset: </int/buin/32-bit> and </int/buin/32-bit>
+0 differences found
diff --git a/tools/test/h5import/testfiles/dtxtstr.h5.txt b/tools/test/h5import/testfiles/dtxtstr.h5.txt
new file mode 100644
index 0000000..2170300
--- /dev/null
+++ b/tools/test/h5import/testfiles/dtxtstr.h5.txt
@@ -0,0 +1,2 @@
+dataset: </mytext/data> and </mytext/data>
+0 differences found
diff --git a/tools/test/h5import/testfiles/textpfe.conf b/tools/test/h5import/testfiles/textpfe.conf
new file mode 100644
index 0000000..6404d5f
--- /dev/null
+++ b/tools/test/h5import/testfiles/textpfe.conf
@@ -0,0 +1,12 @@
+PATH /test
+INPUT-CLASS TEXTFPE
+INPUT-SIZE 64
+RANK 1
+DIMENSION-SIZES 2
+OUTPUT-CLASS FP
+OUTPUT-BYTE-ORDER LE
+OUTPUT-SIZE 64
+
+
+
+
diff --git a/tools/test/h5import/testfiles/textpfe.h5 b/tools/test/h5import/testfiles/textpfe.h5
new file mode 100644
index 0000000..213051d
--- /dev/null
+++ b/tools/test/h5import/testfiles/textpfe.h5
Binary files differ
diff --git a/tools/test/h5import/testfiles/textpfe64.txt b/tools/test/h5import/testfiles/textpfe64.txt
new file mode 100644
index 0000000..f6dd7f4
--- /dev/null
+++ b/tools/test/h5import/testfiles/textpfe64.txt
@@ -0,0 +1,2 @@
+6.02E+24
+3.14159265E+00
diff --git a/tools/test/h5import/testfiles/txtfp32.conf b/tools/test/h5import/testfiles/txtfp32.conf
new file mode 100644
index 0000000..9696a7f
--- /dev/null
+++ b/tools/test/h5import/testfiles/txtfp32.conf
@@ -0,0 +1,10 @@
+PATH /fp/32-bit
+INPUT-CLASS TEXTFP
+INPUT-SIZE 32
+RANK 3
+DIMENSION-SIZES 2 4 3
+OUTPUT-ARCHITECTURE IEEE
+OUTPUT-BYTE-ORDER LE
+
+
+
diff --git a/tools/test/h5import/testfiles/txtfp32.h5 b/tools/test/h5import/testfiles/txtfp32.h5
new file mode 100644
index 0000000..f74e003
--- /dev/null
+++ b/tools/test/h5import/testfiles/txtfp32.h5
Binary files differ
diff --git a/tools/test/h5import/testfiles/txtfp32.txt b/tools/test/h5import/testfiles/txtfp32.txt
new file mode 100644
index 0000000..142c94f
--- /dev/null
+++ b/tools/test/h5import/testfiles/txtfp32.txt
@@ -0,0 +1,9 @@
+12.3 14.2 15.56
+26.782 27.22 28.44
+29.33 20.11 11.45
+22.31 23.3332 24.343
+
+16.134 19.34 0.17
+4.5 8.9 91.8
+34.7 0.32 0.076
+22.2 88.31 77.83 \ No newline at end of file
diff --git a/tools/test/h5import/testfiles/txtfp64.conf b/tools/test/h5import/testfiles/txtfp64.conf
new file mode 100644
index 0000000..fbab6a6
--- /dev/null
+++ b/tools/test/h5import/testfiles/txtfp64.conf
@@ -0,0 +1,13 @@
+PATH /fp/64-bit
+INPUT-CLASS TEXTFP
+INPUT-SIZE 64
+RANK 3
+DIMENSION-SIZES 4 4 3
+OUTPUT-ARCHITECTURE IEEE
+OUTPUT-BYTE-ORDER BE
+CHUNKED-DIMENSION-SIZES 2 2 2
+COMPRESSION-PARAM 8
+MAXIMUM-DIMENSIONS -1 6 7
+
+
+
diff --git a/tools/test/h5import/testfiles/txtfp64.h5 b/tools/test/h5import/testfiles/txtfp64.h5
new file mode 100644
index 0000000..b6ba4f5
--- /dev/null
+++ b/tools/test/h5import/testfiles/txtfp64.h5
Binary files differ
diff --git a/tools/test/h5import/testfiles/txtfp64.txt b/tools/test/h5import/testfiles/txtfp64.txt
new file mode 100644
index 0000000..6c83dc3
--- /dev/null
+++ b/tools/test/h5import/testfiles/txtfp64.txt
@@ -0,0 +1,19 @@
+12.3 14.2 15.56
+26.782 27.22 28.44
+29.33 20.11 11.45
+22.31 23.3332 24.343
+
+16.134 19.34 0.17
+4.5 8.9 91.8
+34.7 0.32 0.076
+22.2 88.31 77.83
+
+216.134 139.34 101.17
+24.5 82.9 291.8
+334.7 0.232 10.076
+222.2 88.31 77.83
+
+122.3 114.2 125.56
+226.782 27.222 128.44
+341.7 30.132 0.1076
+4.51 181.9 911.8
diff --git a/tools/test/h5import/testfiles/txtin16.conf b/tools/test/h5import/testfiles/txtin16.conf
new file mode 100644
index 0000000..d2d11c3
--- /dev/null
+++ b/tools/test/h5import/testfiles/txtin16.conf
@@ -0,0 +1,12 @@
+PATH /int/16-bit
+INPUT-CLASS TEXTIN
+INPUT-SIZE 16
+RANK 3
+DIMENSION-SIZES 2 4 3
+OUTPUT-BYTE-ORDER LE
+CHUNKED-DIMENSION-SIZES 2 2 2
+MAXIMUM-DIMENSIONS -1 -1 8
+OUTPUT-ARCHITECTURE STD
+
+
+
diff --git a/tools/test/h5import/testfiles/txtin16.h5 b/tools/test/h5import/testfiles/txtin16.h5
new file mode 100644
index 0000000..dc6c1ea
--- /dev/null
+++ b/tools/test/h5import/testfiles/txtin16.h5
Binary files differ
diff --git a/tools/test/h5import/testfiles/txtin16.txt b/tools/test/h5import/testfiles/txtin16.txt
new file mode 100644
index 0000000..0688e9b
--- /dev/null
+++ b/tools/test/h5import/testfiles/txtin16.txt
@@ -0,0 +1,15 @@
+ 83 85 87 89
+ 84 86 88 90
+ 85 87 89 91
+ 88 90 92 94
+ 89 91 93 95
+ 90 92 94 96
+ 93 95 97 99
+ 94 96 98 100
+ 95 97 99 101
+ 98 100 102 104
+ 99 101 103 105
+ 100 102 104 106
+ 103 105 107 109
+ 104 106 108 110
+ 105 107 109 111
diff --git a/tools/test/h5import/testfiles/txtin32.conf b/tools/test/h5import/testfiles/txtin32.conf
new file mode 100644
index 0000000..ca4802a
--- /dev/null
+++ b/tools/test/h5import/testfiles/txtin32.conf
@@ -0,0 +1,11 @@
+PATH /int/32-bit
+INPUT-CLASS TEXTIN
+INPUT-SIZE 32
+RANK 3
+DIMENSION-SIZES 2 4 3
+OUTPUT-ARCHITECTURE STD
+OUTPUT-BYTE-ORDER BE
+
+
+
+
diff --git a/tools/test/h5import/testfiles/txtin32.h5 b/tools/test/h5import/testfiles/txtin32.h5
new file mode 100644
index 0000000..350333c
--- /dev/null
+++ b/tools/test/h5import/testfiles/txtin32.h5
Binary files differ
diff --git a/tools/test/h5import/testfiles/txtin32.txt b/tools/test/h5import/testfiles/txtin32.txt
new file mode 100644
index 0000000..0688e9b
--- /dev/null
+++ b/tools/test/h5import/testfiles/txtin32.txt
@@ -0,0 +1,15 @@
+ 83 85 87 89
+ 84 86 88 90
+ 85 87 89 91
+ 88 90 92 94
+ 89 91 93 95
+ 90 92 94 96
+ 93 95 97 99
+ 94 96 98 100
+ 95 97 99 101
+ 98 100 102 104
+ 99 101 103 105
+ 100 102 104 106
+ 103 105 107 109
+ 104 106 108 110
+ 105 107 109 111
diff --git a/tools/test/h5import/testfiles/txtin8.conf b/tools/test/h5import/testfiles/txtin8.conf
new file mode 100644
index 0000000..9dbfd2b
--- /dev/null
+++ b/tools/test/h5import/testfiles/txtin8.conf
@@ -0,0 +1,18 @@
+PATH /int/8-bit
+INPUT-CLASS TEXTIN
+INPUT-SIZE 8
+OUTPUT-CLASS IN
+OUTPUT-SIZE 8
+OUTPUT-BYTE-ORDER LE
+OUTPUT-ARCHITECTURE STD
+RANK 3
+DIMENSION-SIZES 2 4 3
+CHUNKED-DIMENSION-SIZES 2 2 2
+MAXIMUM-DIMENSIONS -1 -1 -1
+COMPRESSION-PARAM 3
+COMPRESSION-TYPE GZIP
+
+
+
+
+
diff --git a/tools/test/h5import/testfiles/txtin8.h5 b/tools/test/h5import/testfiles/txtin8.h5
new file mode 100644
index 0000000..42e7727
--- /dev/null
+++ b/tools/test/h5import/testfiles/txtin8.h5
Binary files differ
diff --git a/tools/test/h5import/testfiles/txtin8.txt b/tools/test/h5import/testfiles/txtin8.txt
new file mode 100644
index 0000000..0688e9b
--- /dev/null
+++ b/tools/test/h5import/testfiles/txtin8.txt
@@ -0,0 +1,15 @@
+ 83 85 87 89
+ 84 86 88 90
+ 85 87 89 91
+ 88 90 92 94
+ 89 91 93 95
+ 90 92 94 96
+ 93 95 97 99
+ 94 96 98 100
+ 95 97 99 101
+ 98 100 102 104
+ 99 101 103 105
+ 100 102 104 106
+ 103 105 107 109
+ 104 106 108 110
+ 105 107 109 111
diff --git a/tools/test/h5import/testfiles/txtstr.conf b/tools/test/h5import/testfiles/txtstr.conf
new file mode 100644
index 0000000..85079e0
--- /dev/null
+++ b/tools/test/h5import/testfiles/txtstr.conf
@@ -0,0 +1,6 @@
+PATH /mytext/data
+INPUT-CLASS STR
+
+
+
+
diff --git a/tools/test/h5import/testfiles/txtstr.h5 b/tools/test/h5import/testfiles/txtstr.h5
new file mode 100644
index 0000000..ceb0810
--- /dev/null
+++ b/tools/test/h5import/testfiles/txtstr.h5
Binary files differ
diff --git a/tools/test/h5import/testfiles/txtstr.txt b/tools/test/h5import/testfiles/txtstr.txt
new file mode 100644
index 0000000..25be0a6
--- /dev/null
+++ b/tools/test/h5import/testfiles/txtstr.txt
@@ -0,0 +1,2 @@
+ hello world
+ hello world again
diff --git a/tools/test/h5import/testfiles/txtuin16.conf b/tools/test/h5import/testfiles/txtuin16.conf
new file mode 100644
index 0000000..753e6e8
--- /dev/null
+++ b/tools/test/h5import/testfiles/txtuin16.conf
@@ -0,0 +1,12 @@
+PATH /int/uint/16-bit
+INPUT-CLASS TEXTUIN
+INPUT-SIZE 16
+RANK 2
+DIMENSION-SIZES 4 3
+COMPRESSION-PARAM 2
+CHUNKED-DIMENSION-SIZES 2 2
+OUTPUT-ARCHITECTURE STD
+OUTPUT-BYTE-ORDER LE
+
+
+
diff --git a/tools/test/h5import/testfiles/txtuin16.h5 b/tools/test/h5import/testfiles/txtuin16.h5
new file mode 100644
index 0000000..9ee166a
--- /dev/null
+++ b/tools/test/h5import/testfiles/txtuin16.h5
Binary files differ
diff --git a/tools/test/h5import/testfiles/txtuin16.txt b/tools/test/h5import/testfiles/txtuin16.txt
new file mode 100644
index 0000000..0688e9b
--- /dev/null
+++ b/tools/test/h5import/testfiles/txtuin16.txt
@@ -0,0 +1,15 @@
+ 83 85 87 89
+ 84 86 88 90
+ 85 87 89 91
+ 88 90 92 94
+ 89 91 93 95
+ 90 92 94 96
+ 93 95 97 99
+ 94 96 98 100
+ 95 97 99 101
+ 98 100 102 104
+ 99 101 103 105
+ 100 102 104 106
+ 103 105 107 109
+ 104 106 108 110
+ 105 107 109 111
diff --git a/tools/test/h5import/testfiles/txtuin32.conf b/tools/test/h5import/testfiles/txtuin32.conf
new file mode 100644
index 0000000..d61e1a1
--- /dev/null
+++ b/tools/test/h5import/testfiles/txtuin32.conf
@@ -0,0 +1,11 @@
+PATH /int/uint/32-bit
+INPUT-CLASS TEXTUIN
+INPUT-SIZE 32
+RANK 3
+DIMENSION-SIZES 2 4 3
+OUTPUT-ARCHITECTURE STD
+OUTPUT-BYTE-ORDER BE
+
+
+
+
diff --git a/tools/test/h5import/testfiles/txtuin32.h5 b/tools/test/h5import/testfiles/txtuin32.h5
new file mode 100644
index 0000000..1a4dda5
--- /dev/null
+++ b/tools/test/h5import/testfiles/txtuin32.h5
Binary files differ
diff --git a/tools/test/h5import/testfiles/txtuin32.txt b/tools/test/h5import/testfiles/txtuin32.txt
new file mode 100644
index 0000000..0688e9b
--- /dev/null
+++ b/tools/test/h5import/testfiles/txtuin32.txt
@@ -0,0 +1,15 @@
+ 83 85 87 89
+ 84 86 88 90
+ 85 87 89 91
+ 88 90 92 94
+ 89 91 93 95
+ 90 92 94 96
+ 93 95 97 99
+ 94 96 98 100
+ 95 97 99 101
+ 98 100 102 104
+ 99 101 103 105
+ 100 102 104 106
+ 103 105 107 109
+ 104 106 108 110
+ 105 107 109 111
diff --git a/tools/test/h5jam/CMakeLists.txt b/tools/test/h5jam/CMakeLists.txt
new file mode 100644
index 0000000..d3980c4
--- /dev/null
+++ b/tools/test/h5jam/CMakeLists.txt
@@ -0,0 +1,34 @@
+cmake_minimum_required (VERSION 3.1.0)
+PROJECT (HDF5_TOOLS_TEST_H5JAM)
+
+#-----------------------------------------------------------------------------
+# Setup include Directories
+#-----------------------------------------------------------------------------
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib)
+
+ # --------------------------------------------------------------------
+ # Add the h5jam test executables
+ # --------------------------------------------------------------------
+ if (HDF5_BUILD_GENERATORS)
+ add_executable (h5jamgentest ${HDF5_TOOLS_TEST_H5JAM_SOURCE_DIR}/h5jamgentest.c)
+ TARGET_NAMING (h5jamgentest STATIC)
+ TARGET_C_PROPERTIES (testhdf5 STATIC " " " ")
+ target_link_libraries (h5jamgentest ${HDF5_LIB_TARGET})
+ set_target_properties (h5jamgentest PROPERTIES FOLDER generator/tools)
+
+ #add_test (NAME h5jamgentest COMMAND $<TARGET_FILE:h5jamgentest>)
+ endif (HDF5_BUILD_GENERATORS)
+
+add_executable (getub ${HDF5_TOOLS_TEST_H5JAM_SOURCE_DIR}/getub.c)
+TARGET_NAMING (getub STATIC)
+TARGET_C_PROPERTIES (getub STATIC " " " ")
+target_link_libraries (getub ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+set_target_properties (getub PROPERTIES FOLDER tools)
+
+add_executable (tellub ${HDF5_TOOLS_TEST_H5JAM_SOURCE_DIR}/tellub.c)
+TARGET_NAMING (tellub STATIC)
+TARGET_C_PROPERTIES (tellub STATIC " " " ")
+target_link_libraries (tellub ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+set_target_properties (tellub PROPERTIES FOLDER tools)
+
+ include (CMakeTests.cmake)
diff --git a/tools/test/h5jam/CMakeTests.cmake b/tools/test/h5jam/CMakeTests.cmake
new file mode 100644
index 0000000..9ed2015
--- /dev/null
+++ b/tools/test/h5jam/CMakeTests.cmake
@@ -0,0 +1,384 @@
+
+##############################################################################
+##############################################################################
+### T E S T I N G ###
+##############################################################################
+##############################################################################
+
+ set (HDF5_REFERENCE_TXT_FILES
+ u10.txt
+ u511.txt
+ u512.txt
+ u513.txt
+ h5jam-help.txt
+ h5unjam-help.txt
+ h5jam-ub-nohdf5.txt
+ )
+ set (HDF5_REFERENCE_TEST_FILES
+ tall.h5
+ twithub.h5
+ twithub513.h5
+ )
+
+ file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
+ foreach (h5_file ${HDF5_REFERENCE_TEST_FILES})
+ HDFTEST_COPY_FILE("${HDF5_TOOLS_TEST_H5JAM_SOURCE_DIR}/testfiles/${h5_file}" "${PROJECT_BINARY_DIR}/testfiles/${h5_file}" "h5jam_files")
+ endforeach (h5_file ${HDF5_REFERENCE_TEST_FILES})
+
+ foreach (txt_file ${HDF5_REFERENCE_TXT_FILES})
+ HDFTEST_COPY_FILE("${HDF5_TOOLS_TEST_H5JAM_SOURCE_DIR}/testfiles/${txt_file}" "${PROJECT_BINARY_DIR}/testfiles/${txt_file}" "h5jam_files")
+ endforeach (txt_file ${HDF5_REFERENCE_TXT_FILES})
+ add_custom_target(h5jam_files ALL COMMENT "Copying files needed by h5jam tests" DEPENDS ${h5jam_files_list})
+
+##############################################################################
+##############################################################################
+### T H E T E S T S M A C R O S ###
+##############################################################################
+##############################################################################
+
+ # ============================================================
+ # TEST_H5JAM_OUTPUT
+ # For the purpose to verify only output & exitcode from h5jam
+ #
+ MACRO (TEST_H5JAM_OUTPUT expectfile resultcode)
+ # If using memchecker add tests without using scripts
+ if (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (NAME H5JAM-${expectfile} COMMAND $<TARGET_FILE:h5jam> ${ARGN})
+ if (NOT "${resultcode}" STREQUAL "0")
+ set_tests_properties (H5JAM-${expectfile} PROPERTIES WILL_FAIL "true")
+ endif (NOT "${resultcode}" STREQUAL "0")
+ else (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (
+ NAME H5JAM-${expectfile}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5jam>"
+ -D "TEST_ARGS:STRING=${ARGN}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_OUTPUT=${expectfile}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=testfiles/${expectfile}.txt"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ endif (HDF5_ENABLE_USING_MEMCHECKER)
+ ENDMACRO (TEST_H5JAM_OUTPUT)
+
+ # ============================================================
+ # TEST_H5UNJAM_OUTPUT
+ # For the purpose to verify only output & exitcode from h5unjam
+ #
+ MACRO (TEST_H5UNJAM_OUTPUT expectfile resultcode)
+ # If using memchecker add tests without using scripts
+ if (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (NAME H5JAM-UNJAM-${expectfile} COMMAND $<TARGET_FILE:h5unjam> ${ARGN})
+ if (NOT "${resultcode}" STREQUAL "0")
+ set_tests_properties (H5JAM-UNJAM-${expectfile} PROPERTIES WILL_FAIL "true")
+ endif (NOT "${resultcode}" STREQUAL "0")
+ else (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (
+ NAME H5JAM-UNJAM-${expectfile}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5unjam>"
+ -D "TEST_ARGS=${ARGN}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_OUTPUT=${expectfile}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=testfiles/${expectfile}.txt"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ endif (HDF5_ENABLE_USING_MEMCHECKER)
+ ENDMACRO (TEST_H5UNJAM_OUTPUT)
+
+ MACRO (CHECKFILE testname testdepends expected actual)
+ # If using memchecker add tests without using scripts
+ if (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (
+ NAME H5JAM-${testname}-CHECKFILE-H5DMP
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_ARGS:STRING=testfiles/${expected}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_OUTPUT=${actual}.new"
+ -D "TEST_EXPECT=0"
+ -D "TEST_FILTER=(^(HDF5)[^\n]*)"
+ -D "TEST_SKIP_COMPARE=TRUE"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ set_tests_properties (H5JAM-${testname}-CHECKFILE-H5DMP PROPERTIES DEPENDS ${testdepends})
+ add_test (
+ NAME H5JAM-${testname}-CHECKFILE-H5DMP_CMP
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_ARGS:STRING=${actual}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_OUTPUT=${actual}.out"
+ -D "TEST_EXPECT=0"
+ -D "TEST_FILTER=(^(HDF5)[^\n]*)"
+ -D "TEST_REFERENCE=${actual}.new"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ set_tests_properties (H5JAM-${testname}-CHECKFILE-H5DMP_CMP PROPERTIES DEPENDS H5JAM-${testname}-CHECKFILE-H5DMP)
+ endif (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ ENDMACRO(CHECKFILE testname testdepends expected actual)
+
+ MACRO (UNJAMTEST testname setfile infile ufile chkfile outfile)
+ if (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (
+ NAME H5JAM-${testname}-UNJAM-SETUP-clear-objects
+ COMMAND ${CMAKE_COMMAND} -E remove ${infile}
+ )
+ add_test (
+ NAME H5JAM-${testname}-UNJAM-SETUP
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different ${HDF5_TOOLS_TEST_H5JAM_SOURCE_DIR}/testfiles/${setfile} ${PROJECT_BINARY_DIR}/${infile}
+ )
+ set_tests_properties (H5JAM-${testname}-UNJAM-SETUP PROPERTIES DEPENDS H5JAM-${testname}-UNJAM-SETUP-clear-objects)
+ add_test (
+ NAME H5JAM-${testname}-UNJAM-clear-objects
+ COMMAND ${CMAKE_COMMAND} -E remove ${outfile}
+ )
+ set_tests_properties (H5JAM-${testname}-UNJAM-clear-objects PROPERTIES DEPENDS H5JAM-${testname}-UNJAM-SETUP)
+ if (NOT "${ufile}" STREQUAL "NONE")
+ add_test (
+ NAME H5JAM-${testname}-UNJAM_D-clear-objects
+ COMMAND ${CMAKE_COMMAND} -E remove ${ufile}
+ )
+ set_tests_properties (H5JAM-${testname}-UNJAM_D-clear-objects PROPERTIES DEPENDS H5JAM-${testname}-UNJAM-clear-objects)
+ add_test (NAME H5JAM-${testname}-UNJAM COMMAND $<TARGET_FILE:h5unjam> -i ${infile} -u ${ufile} -o ${outfile})
+ set_tests_properties (H5JAM-${testname}-UNJAM PROPERTIES DEPENDS H5JAM-${testname}-UNJAM_D-clear-objects)
+ set (compare_test ${ufile})
+ else (NOT "${ufile}" STREQUAL "NONE")
+ if (NOT "${ARGN}" STREQUAL "--delete")
+ add_test (
+ NAME H5JAM-${testname}-UNJAM
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5unjam>"
+ -D "TEST_ARGS:STRING=-i;${infile};-o;${outfile}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_OUTPUT=${outfile}.ufile.txt"
+ -D "TEST_EXPECT=0"
+ -D "TEST_SKIP_COMPARE=TRUE"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ set_tests_properties (H5JAM-${testname}-UNJAM PROPERTIES DEPENDS H5JAM-${testname}-UNJAM-clear-objects)
+ set (compare_test "${outfile}.ufile.txt")
+ else (NOT "${ARGN}" STREQUAL "--delete")
+ add_test (NAME H5JAM-${testname}-UNJAM COMMAND $<TARGET_FILE:h5unjam> -i ${infile} -o ${outfile})
+ set_tests_properties (H5JAM-${testname}-UNJAM PROPERTIES DEPENDS H5JAM-${testname}-UNJAM-clear-objects)
+ set (compare_test "")
+ endif (NOT "${ARGN}" STREQUAL "--delete")
+ endif (NOT "${ufile}" STREQUAL "NONE")
+ if (NOT "${compare_test}" STREQUAL "")
+ add_test (
+ NAME H5JAM-${testname}-UNJAM-CHECK_UB_1-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ ${infile}.len.txt
+ ${infile}.cmp
+ ${infile}-ub.cmp
+ )
+ set_tests_properties (H5JAM-${testname}-UNJAM-CHECK_UB_1-clear-objects PROPERTIES DEPENDS "H5JAM-${testname}-UNJAM")
+ add_test (
+ NAME H5JAM-${testname}-UNJAM-CHECK_UB_1
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:tellub>"
+ -D "TEST_GET_PROGRAM=$<TARGET_FILE:getub>"
+ -D "TEST_CHECKUB=YES"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_HFILE=${infile}"
+ -D "TEST_UFILE=${compare_test}"
+ -D "TEST_EXPECT=0"
+ -D "TEST_OFILE="
+ -P "${HDF_RESOURCES_DIR}/userblockTest.cmake"
+ )
+ set_tests_properties (H5JAM-${testname}-UNJAM-CHECK_UB_1 PROPERTIES DEPENDS H5JAM-${testname}-UNJAM-CHECK_UB_1-clear-objects)
+ endif (NOT "${compare_test}" STREQUAL "")
+
+ add_test (
+ NAME H5JAM-${testname}-UNJAM-CHECK_NOUB
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:tellub>"
+ -D "TEST_GET_PROGRAM=$<TARGET_FILE:getub>"
+ -D "TEST_CHECKUB=NO"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_HFILE=${outfile}"
+ -D "TEST_EXPECT=0"
+ -D "TEST_UFILE=NULL"
+ -D "TEST_OFILE=NULL"
+ -P "${HDF_RESOURCES_DIR}/userblockTest.cmake"
+ )
+ if (NOT "${compare_test}" STREQUAL "")
+ set_tests_properties (H5JAM-${testname}-UNJAM-CHECK_NOUB PROPERTIES DEPENDS H5JAM-${testname}-UNJAM-CHECK_UB_1)
+ else (NOT "${compare_test}" STREQUAL "")
+ set_tests_properties (H5JAM-${testname}-UNJAM-CHECK_NOUB PROPERTIES DEPENDS H5JAM-${testname}-UNJAM)
+ endif (NOT "${compare_test}" STREQUAL "")
+
+ CHECKFILE (${testname} "H5JAM-${testname}-UNJAM-CHECK_NOUB" ${chkfile} ${outfile})
+ endif (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ ENDMACRO(UNJAMTEST testname infile ufile outfile)
+
+ MACRO (JAMTEST testname jamfile infile chkfile outfile)
+ if (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (
+ NAME H5JAM-${testname}-clear-objects
+ COMMAND ${CMAKE_COMMAND} -E remove ${outfile} ${infile}.cpy.h5
+ )
+ endif (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (NAME H5JAM-${testname} COMMAND $<TARGET_FILE:h5jam> -u testfiles/${jamfile} -i testfiles/${infile} -o ${outfile} ${ARGN})
+ if (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ set_tests_properties (H5JAM-${testname} PROPERTIES DEPENDS H5JAM-${testname}-clear-objects)
+ set (compare_test ${outfile})
+ set (compare_orig testfiles/${infile})
+ if ("${ARGN}" STREQUAL "--clobber")
+ set (compare_orig "")
+ endif ("${ARGN}" STREQUAL "--clobber")
+
+ add_test (
+ NAME H5JAM-${testname}-CHECK_UB_1-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ ${compare_test}.len.txt
+ ${compare_test}.cmp
+ ${compare_test}-ub.cmp
+ )
+ set_tests_properties (H5JAM-${testname}-CHECK_UB_1-clear-objects PROPERTIES DEPENDS "H5JAM-${testname}")
+ add_test (
+ NAME H5JAM-${testname}-CHECK_UB_1
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:tellub>"
+ -D "TEST_GET_PROGRAM=$<TARGET_FILE:getub>"
+ -D "TEST_CHECKUB=YES"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_HFILE=${compare_test}"
+ -D "TEST_UFILE=testfiles/${jamfile}"
+ -D "TEST_EXPECT=0"
+ -D "TEST_OFILE=${compare_orig}"
+ -P "${HDF_RESOURCES_DIR}/userblockTest.cmake"
+ )
+ set_tests_properties (H5JAM-${testname}-CHECK_UB_1 PROPERTIES DEPENDS H5JAM-${testname}-CHECK_UB_1-clear-objects)
+ CHECKFILE (${testname} "H5JAM-${testname}-CHECK_UB_1" ${chkfile} ${outfile})
+ endif (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ ENDMACRO (JAMTEST testname jamfile infile outfile)
+
+ MACRO (JAMTEST_NONE testname jamfile infile setfile chkfile)
+ if (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (
+ NAME H5JAM-${testname}_NONE-clear-objects
+ COMMAND ${CMAKE_COMMAND} -E remove
+ ${chkfile} ${chkfile}.cpy.h5
+ )
+ add_test (
+ NAME H5JAM-${testname}_NONE-SETUP
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different testfiles/${setfile} ${chkfile}
+ )
+ set_tests_properties (H5JAM-${testname}_NONE-SETUP PROPERTIES DEPENDS H5JAM-${testname}_NONE-clear-objects)
+
+ add_test (
+ NAME H5JAM-${testname}_NONE_COPY
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different ${chkfile} ${chkfile}.cpy.h5
+ )
+ set_tests_properties (H5JAM-${testname}_NONE_COPY PROPERTIES DEPENDS H5JAM-${testname}_NONE-SETUP)
+
+ add_test (NAME H5JAM-${testname}_NONE COMMAND $<TARGET_FILE:h5jam> -u testfiles/${jamfile} -i ${chkfile} ${ARGN})
+ set_tests_properties (H5JAM-${testname}_NONE PROPERTIES DEPENDS H5JAM-${testname}_NONE_COPY)
+
+ set (compare_test ${chkfile})
+ set (compare_orig ${chkfile}.cpy.h5)
+ if ("${ARGN}" STREQUAL "--clobber")
+ set (compare_orig "")
+ endif ("${ARGN}" STREQUAL "--clobber")
+
+ add_test (
+ NAME H5JAM-${testname}_NONE-CHECK_UB_1-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ ${compare_test}.len.txt
+ ${compare_test}.cmp
+ ${compare_test}-ub.cmp
+ )
+ set_tests_properties (H5JAM-${testname}_NONE-CHECK_UB_1-clear-objects PROPERTIES DEPENDS "H5JAM-${testname}_NONE")
+ add_test (
+ NAME H5JAM-${testname}_NONE-CHECK_UB_1
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:tellub>"
+ -D "TEST_GET_PROGRAM=$<TARGET_FILE:getub>"
+ -D "TEST_CHECKUB=YES"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_HFILE=${compare_test}"
+ -D "TEST_UFILE=testfiles/${jamfile}"
+ -D "TEST_EXPECT=0"
+ -D "TEST_OFILE=${compare_orig}"
+ -P "${HDF_RESOURCES_DIR}/userblockTest.cmake"
+ )
+ set_tests_properties (H5JAM-${testname}_NONE-CHECK_UB_1 PROPERTIES DEPENDS H5JAM-${testname}_NONE-CHECK_UB_1-clear-objects)
+ CHECKFILE (${testname} "H5JAM-${testname}_NONE-CHECK_UB_1" ${infile} ${chkfile})
+ endif (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ ENDMACRO (JAMTEST_NONE testname jamfile infile setfile chkfile)
+
+##############################################################################
+##############################################################################
+### T H E T E S T S ###
+##############################################################################
+##############################################################################
+
+#-------------------------------
+# Testing h5jam
+#-------------------------------
+ # help page
+ TEST_H5JAM_OUTPUT(h5jam-help 0 -h)
+
+ # don't allow HDF5 format file as an user block file
+ TEST_H5JAM_OUTPUT(h5jam-ub-nohdf5 1 -i testfiles/tall.h5 -u testfiles/tall.h5 -o tall-tmp.h5)
+
+ JAMTEST (tall_u10 u10.txt tall.h5 tall.h5 ta2.h5)
+ JAMTEST (tall_u511 u511.txt tall.h5 tall.h5 ta3.h5)
+ JAMTEST (tall_u512 u512.txt tall.h5 tall.h5 ta4.h5)
+ JAMTEST (tall_u513 u513.txt tall.h5 tall.h5 ta5.h5)
+
+ JAMTEST_NONE (N_ta_u10 u10.txt tall.h5 tall.h5 ta6.h5)
+ JAMTEST_NONE (N_ta_u511 u511.txt tall.h5 tall.h5 ta7.h5)
+ JAMTEST_NONE (N_ta_u512 u512.txt tall.h5 tall.h5 ta8.h5)
+ JAMTEST_NONE (N_ta_u513 u513.txt tall.h5 tall.h5 ta9.h5)
+
+ JAMTEST (twithub_u10 u10.txt twithub.h5 tall.h5 tax2.h5)
+ JAMTEST (twithub_u511 u511.txt twithub.h5 tall.h5 tax3.h5)
+ JAMTEST (twithub_u512 u512.txt twithub.h5 tall.h5 tax4.h5)
+ JAMTEST (twithub_u513 u513.txt twithub.h5 tall.h5 tax5.h5)
+
+ JAMTEST (twithub513_u10 u10.txt twithub513.h5 tall.h5 tax6.h5)
+ JAMTEST (twithub513_u511 u511.txt twithub513.h5 tall.h5 tax7.h5)
+ JAMTEST (twithub513_u512 u512.txt twithub513.h5 tall.h5 tax8.h5)
+ JAMTEST (twithub513_u513 u513.txt twithub513.h5 tall.h5 tax9.h5)
+
+ JAMTEST (twithub_u10_c u10.txt twithub.h5 tall.h5 taz2.h5 --clobber)
+ JAMTEST (twithub_u511_c u511.txt twithub.h5 tall.h5 taz3.h5 --clobber)
+ JAMTEST (twithub_u512_c u512.txt twithub.h5 tall.h5 taz4.h5 --clobber)
+ JAMTEST (twithub_u513_c u513.txt twithub.h5 tall.h5 taz5.h5 --clobber)
+
+ JAMTEST (twithub513_u10_c u10.txt twithub513.h5 tall.h5 taz6.h5 --clobber)
+ JAMTEST (twithub513_u511_c u511.txt twithub513.h5 tall.h5 taz7.h5 --clobber)
+ JAMTEST (twithub513_u512_c u512.txt twithub513.h5 tall.h5 taz8.h5 --clobber)
+ JAMTEST (twithub513_u513_c u513.txt twithub513.h5 tall.h5 taz9.h5 --clobber)
+
+ JAMTEST_NONE (N_twithub_u10_c u10.txt tall.h5 twithub.h5 tay2.h5 --clobber)
+ JAMTEST_NONE (N_twithub_u511_c u511.txt tall.h5 twithub.h5 tay3.h5 --clobber)
+ JAMTEST_NONE (N_twithub_u512_c u512.txt tall.h5 twithub.h5 tay4.h5 --clobber)
+ JAMTEST_NONE (N_twithub_u513_c u513.txt tall.h5 twithub.h5 tay5.h5 --clobber)
+
+ JAMTEST_NONE (N_twithub513_u10_c u10.txt tall.h5 twithub513.h5 tay6.h5 --clobber)
+ JAMTEST_NONE (N_twithub513_u511_c u511.txt tall.h5 twithub513.h5 tay7.h5 --clobber)
+ JAMTEST_NONE (N_twithub513_u512_c u512.txt tall.h5 twithub513.h5 tay8.h5 --clobber)
+ JAMTEST_NONE (N_twithub513_u513_c u513.txt tall.h5 twithub513.h5 tay9.h5 --clobber)
+
+#-------------------------------
+# Testing h5unjam
+#-------------------------------
+ # help page
+ TEST_H5UNJAM_OUTPUT(h5unjam-help 0 -h)
+
+ UNJAMTEST (twithub_tall twithub.h5 tai1.h5 o10.txt tall.h5 taa1.h5)
+ UNJAMTEST (twithub513_tall twithub513.h5 tai2.h5 o512.txt tall.h5 taa2.h5)
+
+ UNJAMTEST (N_twithub_tall twithub.h5 tai3.h5 NONE tall.h5 taa3.h5)
+ UNJAMTEST (N_twithub513_tall twithub513.h5 tai4.h5 NONE tall.h5 taa4.h5)
+
+ UNJAMTEST (D_twithub_tall twithub.h5 taj2.h5 NONE tall.h5 tac2.h5 --delete)
+ UNJAMTEST (D_twithub513_tall twithub513.h5 taj3.h5 NONE tall.h5 tac3.h5 --delete)
diff --git a/tools/test/h5jam/Makefile.am b/tools/test/h5jam/Makefile.am
new file mode 100644
index 0000000..068f437
--- /dev/null
+++ b/tools/test/h5jam/Makefile.am
@@ -0,0 +1,40 @@
+#
+# 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.
+##
+## Makefile.am
+## Run automake to generate a Makefile.in from this file.
+#
+# HDF5 Library Makefile(.in)
+#
+
+include $(top_srcdir)/config/commence.am
+
+# Include src and tools/lib directories
+AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib
+
+check_PROGRAMS=tellub h5jamgentest getub
+TEST_SCRIPT=testh5jam.sh
+
+check_SCRIPTS=$(TEST_SCRIPT)
+SCRIPT_DEPEND=../../src/h5jam/h5jam$(EXEEXT) ../../src/h5jam/h5unjam$(EXEEXT)
+
+# Link against the main HDF5 library and tools library
+LDADD=$(LIBH5TOOLS) $(LIBHDF5)
+
+# Temporary files. *.h5 are generated by jamgentest. They should
+# copied to the testfiles/ directory if update is required.
+CHECK_CLEANFILES+=*.h5 testfiles/h5jam-*-sav testfiles/h5unjam-*-sav
+DISTCLEANFILES=testh5jam.sh
+
+include $(top_srcdir)/config/conclude.am
diff --git a/tools/test/h5jam/getub.c b/tools/test/h5jam/getub.c
new file mode 100644
index 0000000..4e02e6b
--- /dev/null
+++ b/tools/test/h5jam/getub.c
@@ -0,0 +1,157 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include "H5private.h"
+#include "h5tools.h"
+#include "h5tools_utils.h"
+
+void parse_command_line(int argc, const char *argv[]);
+
+/* Name of tool */
+#define PROGRAM_NAME "getub"
+char *nbytes = NULL;
+
+static const char *s_opts = "c:"; /* add more later ? */
+static struct long_options l_opts[] = {
+ {"c", require_arg, 'c'}, /* input file */
+ {NULL, 0, '\0'}
+};
+
+/*-------------------------------------------------------------------------
+ * Function: usage
+ *
+ * Purpose: Print the usage message
+ *
+ * Return: void
+ *-------------------------------------------------------------------------
+ */
+static void
+usage (const char *prog)
+{
+ HDfflush(stdout);
+ HDfprintf(stdout, "usage: %s -c nb file] \n", prog);
+ HDfprintf(stdout, " print first 'nb' byts of file to stdoug.\n");
+}
+
+/*-------------------------------------------------------------------------
+ * Function: parse_command_line
+ *
+ * Purpose: Parse the command line for the h5dumper.
+ *
+ * Return: Success:
+ *
+ * Failure: Exits program with EXIT_FAILURE value.
+ *-------------------------------------------------------------------------
+ */
+void
+parse_command_line(int argc, const char *argv[])
+{
+ int opt;
+
+ /* parse command line options */
+ while((opt = get_option (argc, argv, s_opts, l_opts)) != EOF) {
+ switch((char) opt) {
+ case 'c':
+ nbytes = HDstrdup(opt_arg);
+ break;
+ case '?':
+ default:
+ usage(h5tools_getprogname());
+ HDexit(EXIT_FAILURE);
+ } /* end switch */
+ } /* end while */
+
+ if(argc <= opt_ind) {
+ error_msg("missing file name\n");
+ usage(h5tools_getprogname());
+ HDexit(EXIT_FAILURE);
+ } /* end if */
+} /* end parse_command_line() */
+
+int
+main(int argc, const char *argv[])
+{
+ int fd = -1;
+ unsigned size;
+ char *filename = NULL;
+ long res;
+ char *buf = NULL;
+
+ h5tools_setprogname(PROGRAM_NAME);
+ h5tools_setstatus(EXIT_SUCCESS);
+
+ /* Initialize h5tools lib */
+ h5tools_init();
+
+ parse_command_line(argc, argv);
+
+ if(NULL == nbytes) {
+ /* missing arg */
+ error_msg("missing size\n");
+ usage(h5tools_getprogname());
+ goto error;
+ } /* end if */
+
+ if(argc <= (opt_ind)) {
+ error_msg("missing file name\n");
+ usage(h5tools_getprogname());
+ goto error;
+ } /* end if */
+
+ filename = HDstrdup(argv[opt_ind]);
+
+ size = 0;
+ if(EOF == (res = sscanf(nbytes, "%u", &size))) {
+ /* fail */
+ error_msg("missing file name\n");
+ usage(h5tools_getprogname());
+ goto error;
+ } /* end if */
+
+ if((fd = HDopen(filename, O_RDONLY, 0)) < 0) {
+ error_msg("can't open file %s\n", filename);
+ goto error;
+ } /* end if */
+
+ if(NULL == (buf = (char *)HDmalloc((unsigned)(size + 1)))) {
+ error_msg("can't allocate buffer \n");
+ goto error;
+ } /* end if */
+
+ res = HDread(fd, buf, (unsigned)size);
+ if(res < (long)size) {
+ error_msg("Bad read \n");
+ goto error;
+ } /* end if */
+
+ if(HDwrite(1, buf, (unsigned)size) < 0) {
+ error_msg("Bad write \n");
+ goto error;
+ } /* end if */
+
+ /* close things and exit */
+ HDfree(buf);
+ HDclose(fd);
+
+ return EXIT_SUCCESS;
+
+error:
+ if(buf)
+ HDfree(buf);
+ if(fd > -1)
+ HDclose(fd);
+ return EXIT_FAILURE;
+} /* end main() */
+
diff --git a/tools/test/h5jam/h5jamgentest.c b/tools/test/h5jam/h5jamgentest.c
new file mode 100644
index 0000000..a12b17a
--- /dev/null
+++ b/tools/test/h5jam/h5jamgentest.c
@@ -0,0 +1,389 @@
+ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Generate the binary hdf5 files and user block data for the jam/unjam tests.
+ * Usage: just execute the program without any arguments will
+ * generate all the files in the local directory.
+ *
+ * If you regenerate the test files (e.g., changing some code,
+ * trying it on a new platform, ...), you need to verify the correctness
+ * of the expected output and update the corresponding *.ddl files.
+ */
+#include <assert.h>
+#include <limits.h>
+
+#include "hdf5.h"
+#include "H5private.h"
+
+/* not used yet
+#define UBTXT1 "u0.txt"
+*/
+#define UBTXT2 "u10.txt"
+#define UBTXT3 "u511.txt"
+#define UBTXT4 "u512.txt"
+#define UBTXT5 "u513.txt"
+/* not used yet
+#define UBTXT6 "u1023.txt"
+#define UBTXT7 "u1024.txt"
+#define UBTXT8 "u1025.txt"
+#define UBTXT9 "u2047.txt"
+#define UBTXT10 "u2048.txt"
+#define UBTXT11 "u2049.txt"
+#define UBBIN1 "u0.dat"
+#define UBBIN2 "u10.dat"
+#define UBBIN3 "u511.dat"
+#define UBBIN4 "u512.dat"
+#define UBBIN5 "u513.dat"
+*/
+
+/* not used yet
+#define FILE1 "tnull.h5"
+#define FILE2 "tnullwithub.h5"
+*/
+/* tall is same as dumper test */
+#define FILE7 "tall.h5"
+#define FILE8 "twithub.h5"
+#define FILE9 "twithub513.h5"
+
+/*
+ * This pattern is used to fill text files
+ */
+char pattern[11] = "abcdefghij";
+
+/*-------------------------------------------------------------------------
+ * prototypes
+ *-------------------------------------------------------------------------
+ */
+
+
+#define BUF_SIZE 1024
+
+/* Element selection information */
+
+typedef enum{
+ RED,
+ GREEN,
+ BLUE,
+ WHITE,
+ BLACK
+} enumtype;
+
+/* Compound datatype */
+typedef struct s1_t {
+ unsigned int a;
+ unsigned int b;
+ float c;
+} s1_t;
+
+
+/* A UD link traversal function. Shouldn't actually be called. */
+static hid_t UD_traverse(const char H5_ATTR_UNUSED * link_name, hid_t H5_ATTR_UNUSED cur_group,
+ const void H5_ATTR_UNUSED * udata, size_t H5_ATTR_UNUSED udata_size, hid_t H5_ATTR_UNUSED lapl_id)
+{
+ return -1;
+}
+
+#define MY_LINKCLASS 187
+const H5L_class_t UD_link_class[1] = {{
+ H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */
+ (H5L_type_t)MY_LINKCLASS, /* Link type id number */
+ "UD link class", /* name for debugging */
+ NULL, /* Creation callback */
+ NULL, /* Move/rename callback */
+ NULL, /* Copy callback */
+ UD_traverse, /* The actual traversal function */
+ NULL, /* Deletion callback */
+ NULL /* Query callback */
+}};
+
+
+
+/* gent_ub
+ with no ub, identical to gent_all from h5dumpgentest.c
+
+ FILENAME is the name of the file to create
+ UB_SIZE is the size the buffer should be
+ UB_FILL characters will be set to the PATTERN array,
+ the rest of the user block will be NULL.
+
+/ : g1 g2 attr1 attr2
+g1 : g1.1 g1.2
+g1.1 : dset1.1.1(attr1, attr2) dset1.1.2
+g1.2 : g1.2.1 extlink
+g1.2.1 : slink
+g2 : dset2.1 dset2.2 udlink
+
+*/
+
+static void
+gent_ub(const char * filename, size_t ub_size, size_t ub_fill)
+{
+ hid_t fid, group, attr, dataset, space;
+ hid_t create_plist;
+ hsize_t dims[2];
+ int data[2][2], dset1[10][10], dset2[20];
+ char buf[BUF_SIZE];
+ int i, j;
+ size_t u;
+ float dset2_1[10], dset2_2[3][5];
+ int fd;
+ char *bp;
+
+ if(ub_size > 0)
+ {
+ create_plist = H5Pcreate(H5P_FILE_CREATE);
+ H5Pset_userblock(create_plist, (hsize_t)ub_size);
+ fid = H5Fcreate(filename, H5F_ACC_TRUNC, create_plist, H5P_DEFAULT);
+ }
+ else
+ {
+ fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ }
+
+ /* create groups */
+ group = H5Gcreate2(fid, "/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
+
+ group = H5Gcreate2(fid, "/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
+
+ group = H5Gcreate2(fid, "/g1/g1.1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
+
+ group = H5Gcreate2(fid, "/g1/g1.2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
+
+ group = H5Gcreate2(fid, "/g1/g1.2/g1.2.1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
+
+ /* root attributes */
+ group = H5Gopen2(fid, "/", H5P_DEFAULT);
+
+ dims[0] = 10;
+ space = H5Screate_simple(1, dims, NULL);
+ attr = H5Acreate2(group, "attr1", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT);
+ sprintf(buf, "abcdefghi");
+ H5Awrite(attr, H5T_NATIVE_SCHAR, buf);
+ H5Sclose(space);
+ H5Aclose(attr);
+
+ dims[0] = 2; dims[1] = 2;
+ space = H5Screate_simple(2, dims, NULL);
+ attr = H5Acreate2(group, "attr2", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT);
+ data[0][0] = 0; data[0][1] = 1; data[1][0] = 2; data[1][1] = 3;
+ H5Awrite(attr, H5T_NATIVE_INT, data);
+ H5Sclose(space);
+ H5Aclose(attr);
+
+ H5Gclose(group);
+
+ group = H5Gopen2(fid, "/g1/g1.1", H5P_DEFAULT);
+
+ /* dset1.1.1 */
+ dims[0] = 10; dims[1] = 10;
+ space = H5Screate_simple(2, dims, NULL);
+ dataset = H5Dcreate2(group, "dset1.1.1", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 10; j++)
+ dset1[i][j] = j*i;
+ H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset1);
+ H5Sclose(space);
+
+ /* attributes of dset1.1.1 */
+ dims[0] = 27;
+ space = H5Screate_simple(1, dims, NULL);
+ attr = H5Acreate2(dataset, "attr1", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT);
+ sprintf(buf, "1st attribute of dset1.1.1");
+ H5Awrite(attr, H5T_NATIVE_SCHAR, buf);
+ H5Sclose(space);
+ H5Aclose(attr);
+
+ dims[0] = 27;
+ space = H5Screate_simple(1, dims, NULL);
+ attr = H5Acreate2(dataset, "attr2", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT);
+ sprintf(buf, "2nd attribute of dset1.1.1");
+ H5Awrite(attr, H5T_NATIVE_SCHAR, buf);
+ H5Sclose(space);
+ H5Aclose(attr);
+
+ H5Dclose(dataset);
+
+ /* dset1.1.2 */
+ dims[0] = 20;
+ space = H5Screate_simple(1, dims, NULL);
+ dataset = H5Dcreate2(group, "dset1.1.2", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ for (i = 0; i < 20; i++)
+ dset2[i] = i;
+ H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+ H5Gclose(group);
+
+ /* external link */
+ H5Lcreate_external("somefile", "somepath", fid, "/g1/g1.2/extlink", H5P_DEFAULT, H5P_DEFAULT);
+
+ /* soft link */
+ group = H5Gopen2(fid, "/g1/g1.2/g1.2.1", H5P_DEFAULT);
+ H5Lcreate_soft("somevalue", group, "slink", H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
+
+ group = H5Gopen2(fid, "/g2", H5P_DEFAULT);
+
+ /* dset2.1 */
+ dims[0] = 10;
+ space = H5Screate_simple(1, dims, NULL);
+ dataset = H5Dcreate2(group, "dset2.1", H5T_IEEE_F32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ for (i = 0; i < 10; i++)
+ dset2_1[i] = (float)((float)i * 0.1F + 1.0F);
+ H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2_1);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+ /* dset2.2 */
+ dims[0] = 3; dims[1] = 5;
+ space = H5Screate_simple(2, dims, NULL);
+ dataset = H5Dcreate2(group, "dset2.2", H5T_IEEE_F32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ for (i = 0; i < 3; i++)
+ for (j = 0; j < 5; j++)
+ dset2_2[i][j] = (float)(((float)i + 1.0F) * (float)j * 0.1F);
+ H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2_2);
+ H5Sclose(space);
+ H5Dclose(dataset);
+
+ H5Gclose(group);
+
+ /* user-defined link */
+ H5Lregister(UD_link_class);
+ H5Lcreate_ud(fid, "/g2/udlink", (H5L_type_t)MY_LINKCLASS, NULL, (size_t)0, H5P_DEFAULT, H5P_DEFAULT);
+
+ H5Fclose(fid);
+
+ /* If a user block is being used, write to it here */
+ if(ub_size > 0)
+ {
+ ssize_t nbytes;
+
+ HDassert(ub_size <= BUF_SIZE);
+
+ fd = HDopen(filename, O_RDWR, 0);
+ HDassert(fd >= 0);
+
+ /* fill buf with pattern */
+ HDmemset(buf, '\0', ub_size);
+ bp = buf;
+ for (u = 0; u < ub_fill; u++)
+ *bp++ = pattern[u % 10];
+
+ nbytes = HDwrite(fd, buf, ub_size);
+ HDassert(nbytes >= 0);
+
+ HDclose(fd);
+ }
+}
+
+static void
+create_textfile(const char *name, size_t size)
+{
+ char *buf;
+ int fd;
+ size_t i;
+ char *bp;
+ ssize_t nbytes;
+
+ fd = HDcreat(name,0777);
+ HDassert(fd >= 0);
+ buf = (char *)HDcalloc(size, (size_t)1);
+ HDassert(buf);
+
+ /* fill buf with pattern */
+ bp = buf;
+ for(i = 0; i < size; i++)
+ *bp++ = pattern[i % 10];
+
+ nbytes = HDwrite(fd, buf, size);
+ HDassert(nbytes >= 0);
+
+ HDfree(buf);
+
+ HDclose(fd);
+}
+
+#ifdef notdef
+/* not used yet */
+void
+create_binfile(char *name, off_t size)
+{
+ char *buf;
+ int fd;
+ int i;
+ char *bp;
+
+ fd = creat(name,0777);
+ HDassert(fd >= 0);
+
+ buf = HDcalloc(size,1);
+ HDassert(buf);
+
+ /* fill buf with pattern */
+ bp = buf;
+ for (i = 0; i < size; i++)
+ *bp++ = (char) i & 0xff;
+
+ HDwrite(fd,buf,size);
+
+ HDclose(fd);
+}
+#endif
+
+/*-------------------------------------------------------------------------
+ * Function: main
+ *
+ *-------------------------------------------------------------------------
+ */
+
+
+int main(void)
+{
+
+/*
+create_textfile(UBTXT1, (size_t)0);
+*/
+create_textfile(UBTXT2, (size_t)10);
+create_textfile(UBTXT3, (size_t)511);
+create_textfile(UBTXT4, (size_t)512);
+create_textfile(UBTXT5, (size_t)513);
+/*
+create_textfile(UBTXT6, (size_t)1023);
+create_textfile(UBTXT7, (size_t)1024);
+create_textfile(UBTXT8, (size_t)1025);
+create_textfile(UBTXT9, (size_t)2047);
+create_textfile(UBTXT10, (size_t)2048);
+create_textfile(UBTXT11, (size_t)2049);
+
+create_binfile(UBBIN1, (off_t)0);
+create_binfile(UBBIN2, (off_t)10);
+create_binfile(UBBIN3, (off_t)511);
+create_binfile(UBBIN4, (off_t)512);
+create_binfile(UBBIN5, (off_t)513);
+
+*/
+ gent_ub(FILE7, (size_t)0, (size_t)0);
+ gent_ub(FILE8, (size_t)512, HDstrlen(pattern));
+ gent_ub(FILE9, (size_t)1024, (size_t)513);
+
+ return 0;
+}
diff --git a/tools/test/h5jam/tellub.c b/tools/test/h5jam/tellub.c
new file mode 100644
index 0000000..b4f87af
--- /dev/null
+++ b/tools/test/h5jam/tellub.c
@@ -0,0 +1,196 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include <stdio.h>
+
+#ifdef H5_HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#include "hdf5.h"
+#include "H5private.h"
+#include "h5tools.h"
+#include "h5tools_utils.h"
+
+/* Name of tool */
+#define PROGRAMNAME "tellub"
+
+/*
+ * Command-line options: The user can specify short or long-named
+ * parameters. The long-named ones can be partially spelled. When
+ * adding more, make sure that they don't clash with each other.
+ */
+static const char *s_opts = "h";
+static struct long_options l_opts[] = {
+ {"help", no_arg, 'h'},
+ {"hel", no_arg, 'h'},
+ {NULL, 0, '\0'}
+};
+
+/*-------------------------------------------------------------------------
+ * Function: usage
+ *
+ * Purpose: Print the usage message
+ *
+ * Return: void
+ *
+ * Programmer:
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+usage (const char *prog)
+{
+ fflush (stdout);
+ fprintf (stdout, "usage: %s h5_file\n", prog);
+ fprintf (stdout,
+ " Check that h5_fil is HDF5 file and print size of user block \n");
+ fprintf (stdout, " %s -h\n", prog);
+ fprintf (stdout, " Print a usage message and exit\n");
+}
+
+/*-------------------------------------------------------------------------
+ * Function: parse_command_line
+ *
+ * Purpose: Parse the command line for the h5dumper.
+ *
+ * Return: Success:
+ *
+ * Failure: Exits program with EXIT_FAILURE value.
+ *
+ * Programmer:
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static void
+parse_command_line (int argc, const char *argv[])
+{
+ int opt;
+
+ /* parse command line options */
+ while ((opt = get_option (argc, argv, s_opts, l_opts)) != EOF)
+ {
+ switch ((char) opt)
+ {
+ case 'h':
+ usage (h5tools_getprogname());
+ exit (EXIT_SUCCESS);
+ case '?':
+ default:
+ usage (h5tools_getprogname());
+ exit (EXIT_FAILURE);
+ }
+ }
+
+ /* check for file name to be processed */
+ if (argc <= opt_ind)
+ {
+ error_msg("missing file name\n");
+ usage (h5tools_getprogname());
+ exit (EXIT_FAILURE);
+ }
+}
+
+/*-------------------------------------------------------------------------
+ * Function: main
+ *
+ * Purpose: HDF5 user block unjammer
+ *
+ * Return: Success: 0
+ * Failure: 1
+ *
+ * Programmer:
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+main (int argc, const char *argv[])
+{
+ char *ifname;
+ void *edata;
+ H5E_auto2_t func;
+ hid_t ifile;
+ hsize_t usize;
+ htri_t testval;
+ herr_t status;
+ hid_t plist;
+
+ h5tools_setprogname(PROGRAMNAME);
+ h5tools_setstatus(EXIT_SUCCESS);
+
+ /* Initialize h5tools lib */
+ h5tools_init();
+
+ /* Disable error reporting */
+ H5Eget_auto2(H5E_DEFAULT, &func, &edata);
+ H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
+
+ parse_command_line (argc, argv);
+
+ if (argc <= (opt_ind))
+ {
+ error_msg("missing file name\n");
+ usage (h5tools_getprogname());
+ return (EXIT_FAILURE);
+ }
+
+ ifname = HDstrdup (argv[opt_ind]);
+
+ testval = H5Fis_hdf5 (ifname);
+
+ if (testval <= 0)
+ {
+ error_msg("Input HDF5 file is not HDF \"%s\"\n", ifname);
+ return (EXIT_FAILURE);
+ }
+
+ ifile = H5Fopen (ifname, H5F_ACC_RDONLY, H5P_DEFAULT);
+
+ if (ifile < 0)
+ {
+ error_msg("Can't open input HDF5 file \"%s\"\n", ifname);
+ return (EXIT_FAILURE);
+ }
+
+ plist = H5Fget_create_plist (ifile);
+ if (plist < 0)
+ {
+ error_msg("Can't get file creation plist for file \"%s\"\n",
+ ifname);
+ return (EXIT_FAILURE);
+ }
+
+ status = H5Pget_userblock (plist, &usize);
+ if (status < 0)
+ {
+ error_msg("Can't get user block for file \"%s\"\n", ifname);
+ return (EXIT_FAILURE);
+ }
+
+ printf ("%ld\n", (long) usize);
+
+ H5Pclose (plist);
+ H5Fclose (ifile);
+
+ return (EXIT_SUCCESS);
+}
+
diff --git a/tools/test/h5jam/testfiles/h5jam-help.txt b/tools/test/h5jam/testfiles/h5jam-help.txt
new file mode 100644
index 0000000..ce97c22
--- /dev/null
+++ b/tools/test/h5jam/testfiles/h5jam-help.txt
@@ -0,0 +1,24 @@
+usage: h5jam -i <in_file.h5> -u <in_user_file> [-o <out_file.h5>] [--clobber]
+
+Adds user block to front of an HDF5 file and creates a new concatenated file.
+
+OPTIONS
+ -i in_file.h5 Specifies the input HDF5 file.
+ -u in_user_file Specifies the file to be inserted into the user block.
+ Can be any file format except an HDF5 format.
+ -o out_file.h5 Specifies the output HDF5 file.
+ If not specified, the user block will be concatenated in
+ place to the input HDF5 file.
+ --clobber Wipes out any existing user block before concatenating
+ the given user block.
+ The size of the new user block will be the larger of;
+ - the size of existing user block in the input HDF5 file
+ - the size of user block required by new input user file
+ (size = 512 x 2N, N is positive integer.)
+
+ -h Prints a usage message and exits.
+ -V Prints the HDF5 library version and exits.
+
+Exit Status:
+ 0 Succeeded.
+ >0 An error occurred.
diff --git a/tools/test/h5jam/testfiles/h5jam-ub-nohdf5.txt b/tools/test/h5jam/testfiles/h5jam-ub-nohdf5.txt
new file mode 100644
index 0000000..72c0b17
--- /dev/null
+++ b/tools/test/h5jam/testfiles/h5jam-ub-nohdf5.txt
@@ -0,0 +1,2 @@
+h5jam error: -u <user_file> cannot be HDF5 file, but it appears to be an HDF5 file.
+Try '-h' or '--help' for more information or see the <h5jam> entry in the 'HDF5 Reference Manual'.
diff --git a/tools/test/h5jam/testfiles/h5unjam-help.txt b/tools/test/h5jam/testfiles/h5unjam-help.txt
new file mode 100644
index 0000000..f0d92e9
--- /dev/null
+++ b/tools/test/h5jam/testfiles/h5unjam-help.txt
@@ -0,0 +1,27 @@
+usage: h5unjam -i <in_file.h5> [-o <out_file.h5> ] [-u <out_user_file> | --delete]
+
+Splits user file and HDF5 file into two files: user block data and HDF5 data.
+
+OPTIONS
+ -i in_file.h5 Specifies the HDF5 as input. If the input HDF5 file
+ contains no user block, exit with an error message.
+ -o out_file.h5 Specifies output HDF5 file without a user block.
+ If not specified, the user block will be removed from the
+ input HDF5 file.
+ -u out_user_file
+ Specifies the output file containing the data from the
+ user block.
+ Cannot be used with --delete option.
+ --delete Remove the user block from the input HDF5 file. The content
+ of the user block is discarded.
+ Cannot be used with the -u option.
+
+ -h Prints a usage message and exits.
+ -V Prints the HDF5 library version and exits.
+
+ If neither --delete nor -u is specified, the user block from the input file
+ will be displayed to stdout.
+
+Exit Status:
+ 0 Succeeded.
+ >0 An error occurred.
diff --git a/tools/test/h5jam/testfiles/tall.h5 b/tools/test/h5jam/testfiles/tall.h5
new file mode 100644
index 0000000..918aeee
--- /dev/null
+++ b/tools/test/h5jam/testfiles/tall.h5
Binary files differ
diff --git a/tools/test/h5jam/testfiles/twithub.h5 b/tools/test/h5jam/testfiles/twithub.h5
new file mode 100644
index 0000000..4bc1833
--- /dev/null
+++ b/tools/test/h5jam/testfiles/twithub.h5
Binary files differ
diff --git a/tools/test/h5jam/testfiles/twithub513.h5 b/tools/test/h5jam/testfiles/twithub513.h5
new file mode 100644
index 0000000..0eac208
--- /dev/null
+++ b/tools/test/h5jam/testfiles/twithub513.h5
Binary files differ
diff --git a/tools/test/h5jam/testfiles/u10.txt b/tools/test/h5jam/testfiles/u10.txt
new file mode 100644
index 0000000..c76a964
--- /dev/null
+++ b/tools/test/h5jam/testfiles/u10.txt
@@ -0,0 +1 @@
+abcdefghij \ No newline at end of file
diff --git a/tools/test/h5jam/testfiles/u511.txt b/tools/test/h5jam/testfiles/u511.txt
new file mode 100644
index 0000000..bff1736
--- /dev/null
+++ b/tools/test/h5jam/testfiles/u511.txt
@@ -0,0 +1 @@
+abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghija \ No newline at end of file
diff --git a/tools/test/h5jam/testfiles/u512.txt b/tools/test/h5jam/testfiles/u512.txt
new file mode 100644
index 0000000..33a36c9
--- /dev/null
+++ b/tools/test/h5jam/testfiles/u512.txt
@@ -0,0 +1 @@
+abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijab \ No newline at end of file
diff --git a/tools/test/h5jam/testfiles/u513.txt b/tools/test/h5jam/testfiles/u513.txt
new file mode 100644
index 0000000..6b46ebf
--- /dev/null
+++ b/tools/test/h5jam/testfiles/u513.txt
@@ -0,0 +1 @@
+abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabc \ No newline at end of file
diff --git a/tools/test/h5jam/testh5jam.sh.in b/tools/test/h5jam/testh5jam.sh.in
new file mode 100644
index 0000000..fb6d9e2
--- /dev/null
+++ b/tools/test/h5jam/testh5jam.sh.in
@@ -0,0 +1,699 @@
+#! /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 h5jam/h5unjam tools
+
+srcdir=@srcdir@
+
+# Determine which filters are available
+USE_FILTER_SZIP="@USE_FILTER_SZIP@"
+USE_FILTER_DEFLATE="@USE_FILTER_DEFLATE@"
+
+TESTNAME=../../src/h5jam/h5unjam
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+
+DUMPER=../../src/h5dump/h5dump # The dumper to use
+DUMPER_BIN=`pwd`/../$DUMPER # The path of the dumper binary
+JAM=../../src/h5jam/h5jam # Tool to test
+UNJAM=../../src/h5jam/h5unjam # Tool to test
+JAM_BIN="$RUNSERIAL "`pwd` # The path of the jam binary
+UNJAM_BIN=`pwd` # The path of the jam binary
+
+RM='rm -rf'
+CMP='cmp -s'
+DIFF='diff -c'
+AWK='awk'
+CP='cp'
+DIRNAME='dirname'
+LS='ls'
+AWK='awk'
+
+nerrors=0
+verbose=yes
+
+# 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/test/h5diff/testfiles"
+SRC_H5COPY_TESTFILES="$SRC_TOOLS/test/h5copy/testfiles"
+SRC_H5REPACK_TESTFILES="$SRC_TOOLS/test/h5repack/testfiles"
+SRC_H5JAM_TESTFILES="$SRC_TOOLS/test/h5jam/testfiles"
+SRC_H5STAT_TESTFILES="$SRC_TOOLS/test/h5stat/testfiles"
+SRC_H5IMPORT_TESTFILES="$SRC_TOOLS/test/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_H5JAM_TESTFILES/tall.h5
+$SRC_H5JAM_TESTFILES/twithub.h5
+$SRC_H5JAM_TESTFILES/twithub513.h5
+"
+LIST_OTHER_TEST_FILES="
+$SRC_H5JAM_TESTFILES/u10.txt
+$SRC_H5JAM_TESTFILES/u511.txt
+$SRC_H5JAM_TESTFILES/u512.txt
+$SRC_H5JAM_TESTFILES/u513.txt
+$SRC_H5JAM_TESTFILES/h5jam-help.txt
+$SRC_H5JAM_TESTFILES/h5unjam-help.txt
+$SRC_H5JAM_TESTFILES/h5jam-ub-nohdf5.txt
+"
+
+# Source in the output filter function definitions.
+. $srcdir/../../../bin/output_filter.sh
+
+#
+# copy test files and expected output files from source dirs to test dir
+#
+COPY_TESTFILES="$LIST_HDF5_TEST_FILES $LIST_OTHER_TEST_FILES"
+
+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
+ # skip cp if srcdir is same as destdir
+ # this occurs when build/test performed in source dir and
+ # make cp fail
+ SDIR=`$DIRNAME $tstfile`
+ INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
+ INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
+ if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
+ $CP -f $tstfile $TESTDIR
+ if [ $? -ne 0 ]; then
+ echo "Error: FAILED to copy $tstfile ."
+
+ # Comment out this to CREATE expected file
+ exit $EXIT_FAILURE
+ fi
+ fi
+ fi
+ done
+}
+
+CLEAN_TESTFILES_AND_TESTDIR()
+{
+ # skip rm if srcdir is same as destdir
+ # this occurs when build/test performed in source dir and
+ # make cp fail
+ SDIR=$SRC_H5JAM_TESTFILES
+ INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
+ INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
+ if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
+ $RM $TESTDIR
+ fi
+}
+
+# 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'
+}
+
+# Print a line-line message left justified in a field of 70 characters
+# beginning with the word "Compare".
+#
+COMPARE() {
+ SPACES=" "
+ echo "Compare $* $SPACES" | cut -c1-70 | tr -d '\012'
+}
+
+# Print a "SKIP" message
+SKIP() {
+ TESTING $JAM $@
+ echo " -SKIP-"
+}
+
+#
+# COMPARE_FILES a.h5 b.h5
+# Compare two files, skipping the first line. This is used to
+# compare the output of the dumper, skipping the file name which
+# is different.
+# The result is stored in 'compval'.
+#
+cmpval=0;
+COMPARE_FILES() {
+ $AWK 'NR > 1' $1 > $1.cmp
+ $AWK 'NR > 1' $2 > $2.cmp
+ $CMP $1.cmp $2.cmp
+ cmpval=$?
+ rm -f $1.cmp $2.cmp
+}
+
+# CLEANUP files
+# Clean up named files.
+CLEANUP() {
+ if test -z "$HDF5_NOCLEANUP"; then
+ for i in $*
+ do
+ rm -f $i
+ done
+ fi
+}
+
+# SETUP file tocopy
+# Clone a standard input file in the test directory
+# Modification:
+# Was using "cp" command which means file $2 will inherit the permission
+# setting of file $1. If $1 is read-only, so will $2. That will cause
+# failure when the test attempts to write it later on. Changed to use
+# the "cat" command.
+#
+SETUP() {
+ cat < $1 > $2
+}
+
+#
+# CHECKFILE orig.h5 compar.h5
+# Check that the test file is the same as an original.
+# The two files are dumped with the dumper, and the output
+# compared with COMPARE_FILES.
+# If the files are the same, the test reports " PASSED",
+# otherwise, it reports "*FAILED*"
+CHECKFILE() {
+ expected="`dirname $2`/`basename $2 .h5`.out"
+ expected_err="`dirname $2`/`basename $2 .h5`.err"
+ actual="`basename $1 .h5`.out"
+ actual_err="`basename $1 .h5`.err"
+
+ $RUNSERIAL $DUMPER_BIN/$DUMPER $1 >$expected 2>$expected_err
+ cat $expected_err >> $expected
+
+ # dump the test file
+ COMPARE $2 to $1
+ $RUNSERIAL $DUMPER_BIN/$DUMPER $2 >$actual 2>$actual_err
+ cat $actual_err >> $actual
+
+ # compare the two files (ignore line 1)
+ COMPARE_FILES $actual $expected
+ if [ "$cmpval" = 0 ] ; then
+ echo " PASSED"
+ else
+ echo "*FAILED*"
+ echo " Expected result (*.ddl) differs from actual result (*.out)"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF $expected $actual |sed 's/^/ /'
+ fi
+
+ # Clean up output files
+ if test -z "$HDF5_NOCLEANUP"; then
+ rm -f $actual $actual_err
+ rm -f $expected $expected_err
+ fi
+}
+
+#
+# CHECK_UB file.h5 user_block_file origfile.h5
+#
+# Check the user block in 'file.h5' is the same as
+# 'user_block' (allowing for padding).
+#
+# If the original file had a user block before the test
+# then 'compare.h5' is passed. The user block must be extracted
+# and the test file compared to:
+# cat compare_ub user_block_file.
+#
+# This test uses './getub' to extract the user block from
+# 'file.h5', which is compared to the file described above.
+#
+# The result is set in variable 'result1'.
+#
+result1=0;
+CHECK_UB_1() {
+ hfile="$1"
+ ufile="$2"
+
+ # check for third argument (the original file)
+ origfile="";
+ if [ -n "$3" ];
+ then
+ origfile="$3"
+ fi
+
+ # find the length of the user block to check
+ s1=`cat $ufile | wc -c | sed -e 's/ //g'`
+ if [ "$s1" = "0" ];
+ then
+ echo "File "$ufile" is empty"
+ result1=1;
+ fi
+
+ # Get the size of the original user block, if any.
+ if [ -n "$origfile" ];
+ then
+ # 'tellub' calls H5Fget_user_block to get the size
+ # of the user block
+ s2=`$JAM_BIN/tellub $origfile`
+ if [ "$s2" = "0" ];
+ then
+ size=$s1;
+ cmpfile=$ufile
+ else
+ cmpfile="tt2"
+ size=`expr $s2 + $s1`
+ $JAM_BIN/getub -c $s2 $origfile > $cmpfile
+ cat $ufile >> $cmpfile
+ fi
+ else
+ # assume no user block
+ s2="0"
+ size=$s1;
+ cmpfile=$ufile
+ fi
+
+ # Extract 'size' bytes from the front of 'hfile'
+ # Compare to 'cmpfile', result is set in result1
+ tfile="tt1"
+ $JAM_BIN/getub -c $size $hfile > $tfile
+ res=`cmp $cmpfile $tfile`
+ if [ "$?" != "0" ];
+ then
+ echo $res
+ result1=1;
+ else
+ result1=0;
+ fi
+
+ # clean up
+ rm -f $tfile
+ if [ "$s2" != "0" ] ;
+ then
+ rm -f $cmpfile
+ fi
+}
+
+
+# CHECK_NOUB file.h5
+#
+# Check that 'file.h5' has no user block.
+# Setst result2 to 1 if there is a user block (fail), 0 if none (pass)
+
+result2=0;
+
+CHECK_NOUB() {
+ hfile="$1"
+
+ # call 'ubsize' to get the size of the user block
+ ubsize=`$JAM_BIN/tellub $hfile`
+
+ if [ "$?" != "0" ];
+ then
+ # error
+ result2=1;
+ else
+ if [ "$ubsize" = "0" ];
+ then
+ # pass
+ result2=0;
+ else
+ # fail
+ result2=1;
+ fi
+ fi
+}
+
+# JAMTEST user_block file.h5 [--clobber] [ofile.h5]
+#
+# Test the 'jam' tool:
+# 1. figure out the input and output, and the comparision
+# that will be done.
+# 2. call 'jam' with the appropriate arguments
+# 3. check the user block is correct in the output (Check_UB)
+# If the user block is correct, print "PASSED", else "*FAILED*"
+JAMTEST() {
+ ufile="$1"
+ ifile="$2"
+ compare_test="" # the file to test
+ compare_orig="" # the comparison to test against
+ cleanup=""
+
+ # sort out the arguments for the test and the check
+ do_clobber="no"
+ if [ "$3" = "--clobber" ];
+ then
+ # clobber overwrites any existing user block
+ do_clobber="yes"
+ clobber="--clobber"
+ compare_orig=""
+ if [ -z "$4" ];
+ then
+ # output goes to infile, compare ubfile to infile
+ ofile=""
+ compare_test="$ifile"
+ else
+ # output goes to $4, compare ofile to ubfile
+ ofile="$4"
+ compare_test="$ofile"
+ fi
+ else
+ clobber=""
+ # add user block to existing ub, if any
+ if [ -z "$3" ];
+ then
+ # output goes to infile, compare ubfile to infile
+ ofile=""
+ compare_test="$ifile"
+ cp $ifile xxofile.h5
+ compare_orig="xxofile.h5"
+ cleanup="$cleanup $compare_orig"
+ else
+ # output goes to $3, compare ofile to ubfile
+ ofile="$3"
+ compare_test="$ofile"
+ compare_orig="$ifile"
+ fi
+ fi
+
+ # call 'jam' with the appropriate arguments
+ if [ -n "$ofile" ];
+ then
+ TESTING h5jam -u `basename $ufile` -i `basename $ifile` -o `basename $ofile` $clobber
+ $JAM_BIN/$JAM -u $ufile -i $ifile -o $ofile $clobber
+ else
+ TESTING jam -u `basename $ufile` -i `basename $ifile` $clobber
+ $JAM_BIN/$JAM -u $ufile -i $ifile $clobber
+ fi
+
+ #echo "CHECK_UB_1 $compare_test $ufile $compare_orig"
+ CHECK_UB_1 $compare_test $ufile $compare_orig
+
+ if [ "$result1" = "0" ] ;
+ then
+ echo " PASSED"
+ else
+ echo " *FAILED*"
+ nerrors="`expr $nerrors + 1`"
+ fi
+ CLEANUP $cleanup
+}
+
+# UNJAMTEST file.h5 [- | --delete] ofile
+#
+# Test the 'unjam' tool
+#
+###fix the working directory here and in jamtest
+UNJAMTEST () {
+ infile="$1"
+ ofile="$3"
+ if [ "$2" = "-" ];
+ then
+ uofile="uofile"
+ TESTING h5unjam -i `basename $infile` -o `basename $ofile` "> "`basename $uofile`
+ $JAM_BIN/$UNJAM -i $infile -o $ofile > $uofile
+ else
+ if [ "$2" = "--delete" ];
+ then
+ uofile="none"
+ TESTING h5unjam -i `basename $infile` -o `basename $ofile` --delete
+ $JAM_BIN/$UNJAM -i $infile -o $ofile --delete
+
+ else
+ uofile="$2"
+ TESTING h5unjam -i `basename $infile` -u `basename $uofile` -o `basename $ofile`
+ $JAM_BIN/$UNJAM -i $infile -u $uofile -o $ofile
+ fi
+ fi
+
+ result1=0
+ result2=0
+ cleanup=""
+ if [ "$uofile" != "none" ];
+ then
+ # sets result1
+ CHECK_UB_1 $infile $uofile
+ CLEANUP $uofile
+ fi
+
+ # sets result2
+ CHECK_NOUB $ofile
+
+ if [ "$result1" = "0" -a "$result2" = "0" ];
+ then
+ echo " PASSED"
+ else
+ echo " *FAILED*"
+ nerrors="`expr $nerrors + 1`"
+ fi
+}
+
+
+#
+# TOOLTEST_OUTPUT < JAM | UNJAM > expect-output.txt exit-code options
+#
+# Only verify stdout/stderr output from h5jam and j5unjam
+#
+
+TOOLTEST_OUTPUT() {
+ if [ "$1" == "JAM" ]; then
+ TOOLCMD=$JAM_BIN/$JAM
+ elif [ "$1" == "UNJAM" ]; then
+ TOOLCMD=$JAM_BIN/$UNJAM
+ fi
+ shift
+ expect="$TESTDIR/$1"
+ actual="$TESTDIR/`basename $1 .ls`.out"
+ actual_err="$TESTDIR/`basename $1 .ls`.err"
+ actual_sav=${actual}-sav
+ actual_err_sav=${actual_err}-sav
+ shift
+ retvalexpect=$1
+ shift
+
+ TESTING h5jam $@
+ (
+ cd $TESTDIR
+ $TOOLCMD "$@"
+ ) >$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
+ # combine stderr to stdout for output compare
+ cat $actual_err >> $actual
+
+ if [ ! -f $expect ]; then
+ # Create the expect file if it doesn't yet exist.
+ echo " CREATED"
+ cp $actual $expect
+ rm -f $actual $actual_sav $actual_err $actual_err_sav
+ elif $CMP $expect $actual; then
+ echo " PASSED"
+ rm -f $actual $actual_sav $actual_err $actual_err_sav
+ else
+ echo "*FAILED*"
+ echo " Expected result differs from actual result"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /'
+ fi
+}
+
+##############################################################################
+##############################################################################
+### T H E T E S T S ###
+##############################################################################
+##############################################################################
+# prepare for test
+COPY_TESTFILES_TO_TESTDIR
+
+#-------------------------------
+# Testing h5jam
+#-------------------------------
+# help page
+TOOLTEST_OUTPUT JAM h5jam-help.txt 0 -h
+
+# don't allow HDF5 format file as an user block file
+TOOLTEST_OUTPUT JAM h5jam-ub-nohdf5.txt 1 -i tall.h5 -u tall.h5 -o tall-tmp.h5
+
+JAMTEST $TESTDIR/u10.txt $TESTDIR/tall.h5 ta2.h5
+CHECKFILE $TESTDIR/tall.h5 ta2.h5
+CLEANUP ta2.h5
+JAMTEST $TESTDIR/u511.txt $TESTDIR/tall.h5 ta3.h5
+CHECKFILE $TESTDIR/tall.h5 ta3.h5
+CLEANUP ta3.h5
+JAMTEST $TESTDIR/u512.txt $TESTDIR/tall.h5 ta4.h5
+CHECKFILE $TESTDIR/tall.h5 ta4.h5
+CLEANUP ta4.h5
+JAMTEST $TESTDIR/u513.txt $TESTDIR/tall.h5 ta5.h5
+CHECKFILE $TESTDIR/tall.h5 ta5.h5
+CLEANUP ta5.h5
+
+SETUP $TESTDIR/tall.h5 ta6.h5
+JAMTEST $TESTDIR/u10.txt ta6.h5
+CHECKFILE $TESTDIR/tall.h5 ta6.h5
+CLEANUP ta6.h5
+SETUP $TESTDIR/tall.h5 ta7.h5
+JAMTEST $TESTDIR/u511.txt ta7.h5
+CHECKFILE $TESTDIR/tall.h5 ta7.h5
+CLEANUP ta7.h5
+SETUP $TESTDIR/tall.h5 ta8.h5
+JAMTEST $TESTDIR/u512.txt ta8.h5
+CHECKFILE $TESTDIR/tall.h5 ta8.h5
+CLEANUP ta8.h5
+SETUP $TESTDIR/tall.h5 ta9.h5
+JAMTEST $TESTDIR/u513.txt ta9.h5
+CHECKFILE $TESTDIR/tall.h5 ta9.h5
+CLEANUP ta9.h5
+
+JAMTEST $TESTDIR/u10.txt $TESTDIR/twithub.h5 tax2.h5
+CHECKFILE $TESTDIR/tall.h5 tax2.h5
+CLEANUP tax2.h5
+JAMTEST $TESTDIR/u511.txt $TESTDIR/twithub.h5 tax3.h5
+CHECKFILE $TESTDIR/tall.h5 tax3.h5
+CLEANUP tax3.h5
+JAMTEST $TESTDIR/u512.txt $TESTDIR/twithub.h5 tax4.h5
+CHECKFILE $TESTDIR/tall.h5 tax4.h5
+CLEANUP tax4.h5
+JAMTEST $TESTDIR/u513.txt $TESTDIR/twithub.h5 tax5.h5
+CHECKFILE $TESTDIR/tall.h5 tax5.h5
+CLEANUP tax5.h5
+
+JAMTEST $TESTDIR/u10.txt $TESTDIR/twithub513.h5 tax6.h5
+CHECKFILE $TESTDIR/tall.h5 tax6.h5
+CLEANUP tax6.h5
+JAMTEST $TESTDIR/u511.txt $TESTDIR/twithub513.h5 tax7.h5
+CHECKFILE $TESTDIR/tall.h5 tax7.h5
+CLEANUP tax7.h5
+JAMTEST $TESTDIR/u512.txt $TESTDIR/twithub513.h5 tax8.h5
+CHECKFILE $TESTDIR/tall.h5 tax8.h5
+CLEANUP tax8.h5
+JAMTEST $TESTDIR/u513.txt $TESTDIR/twithub513.h5 tax9.h5
+CHECKFILE $TESTDIR/tall.h5 tax9.h5
+CLEANUP tax9.h5
+
+JAMTEST $TESTDIR/u10.txt $TESTDIR/twithub.h5 --clobber taz2.h5
+CHECKFILE $TESTDIR/tall.h5 taz2.h5
+CLEANUP taz2.h5
+JAMTEST $TESTDIR/u511.txt $TESTDIR/twithub.h5 --clobber taz3.h5
+CHECKFILE $TESTDIR/tall.h5 taz3.h5
+CLEANUP taz3.h5
+JAMTEST $TESTDIR/u512.txt $TESTDIR/twithub.h5 --clobber taz4.h5
+CHECKFILE $TESTDIR/tall.h5 taz4.h5
+CLEANUP taz4.h5
+JAMTEST $TESTDIR/u513.txt $TESTDIR/twithub.h5 --clobber taz5.h5
+CHECKFILE $TESTDIR/tall.h5 taz5.h5
+CLEANUP taz5.h5
+
+JAMTEST $TESTDIR/u10.txt $TESTDIR/twithub513.h5 --clobber taz6.h5
+CHECKFILE $TESTDIR/tall.h5 taz6.h5
+CLEANUP taz6.h5
+JAMTEST $TESTDIR/u511.txt $TESTDIR/twithub513.h5 --clobber taz7.h5
+CHECKFILE $TESTDIR/tall.h5 taz7.h5
+CLEANUP taz7.h5
+JAMTEST $TESTDIR/u512.txt $TESTDIR/twithub513.h5 --clobber taz8.h5
+CHECKFILE $TESTDIR/tall.h5 taz8.h5
+CLEANUP taz8.h5
+JAMTEST $TESTDIR/u513.txt $TESTDIR/twithub513.h5 --clobber taz9.h5
+CHECKFILE $TESTDIR/tall.h5 taz9.h5
+CLEANUP taz9.h5
+
+SETUP $TESTDIR/twithub.h5 tay2.h5
+JAMTEST $TESTDIR/u10.txt tay2.h5 --clobber
+CHECKFILE $TESTDIR/tall.h5 tay2.h5
+CLEANUP tay2.h5
+SETUP $TESTDIR/twithub.h5 tay3.h5
+JAMTEST $TESTDIR/u511.txt tay3.h5 --clobber
+CHECKFILE $TESTDIR/tall.h5 tay3.h5
+CLEANUP tay3.h5
+SETUP $TESTDIR/twithub.h5 tay4.h5
+JAMTEST $TESTDIR/u512.txt tay4.h5 --clobber
+CHECKFILE $TESTDIR/tall.h5 tay4.h5
+CLEANUP tay4.h5
+SETUP $TESTDIR/twithub.h5 tay5.h5
+JAMTEST $TESTDIR/u513.txt tay5.h5 --clobber
+CHECKFILE $TESTDIR/tall.h5 tay5.h5
+CLEANUP tay5.h5
+
+SETUP $TESTDIR/twithub513.h5 tay6.h5
+JAMTEST $TESTDIR/u10.txt tay6.h5 --clobber
+CHECKFILE $TESTDIR/tall.h5 tay6.h5
+CLEANUP tay6.h5
+SETUP $TESTDIR/twithub513.h5 tay7.h5
+JAMTEST $TESTDIR/u511.txt tay7.h5 --clobber
+CHECKFILE $TESTDIR/tall.h5 tay7.h5
+CLEANUP tay7.h5
+SETUP $TESTDIR/twithub513.h5 tay8.h5
+JAMTEST $TESTDIR/u512.txt tay8.h5 --clobber
+CHECKFILE $TESTDIR/tall.h5 tay8.h5
+CLEANUP tay8.h5
+SETUP $TESTDIR/twithub513.h5 tay9.h5
+JAMTEST $TESTDIR/u513.txt tay9.h5 --clobber
+CHECKFILE $TESTDIR/tall.h5 tay9.h5
+CLEANUP tay9.h5
+
+#---------------------------------
+# Testing h5unjam
+#---------------------------------
+# help page
+TOOLTEST_OUTPUT UNJAM h5unjam-help.txt 0 -h
+
+SETUP $TESTDIR/twithub.h5 tai1.h5
+UNJAMTEST tai1.h5 o10.txt taa1.h5
+CHECKFILE $TESTDIR/tall.h5 taa1.h5
+CLEANUP taa1.h5 tai1.h5 o10.txt
+SETUP $TESTDIR/twithub513.h5 tai2.h5
+UNJAMTEST tai2.h5 o512.txt taa2.h5
+CHECKFILE $TESTDIR/tall.h5 taa2.h5
+CLEANUP taa2.h5 tai2.h5 o512.txt
+
+SETUP $TESTDIR/twithub.h5 tai3.h5
+UNJAMTEST tai3.h5 - taa3.h5
+CHECKFILE $TESTDIR/tall.h5 taa3.h5
+CLEANUP taa3.h5 tai3.h5
+SETUP $TESTDIR/twithub513.h5 tai4.h5
+UNJAMTEST tai4.h5 - taa4.h5
+CHECKFILE $TESTDIR/tall.h5 taa4.h5
+CLEANUP taa4.h5 tai4.h5
+
+SETUP $TESTDIR/twithub.h5 taj2.h5
+UNJAMTEST taj2.h5 --delete tac2.h5
+CHECKFILE $TESTDIR/tall.h5 tac2.h5
+CLEANUP tac2.h5 taj2.h5
+SETUP $TESTDIR/twithub513.h5 taj3.h5
+UNJAMTEST taj3.h5 --delete tac3.h5
+CHECKFILE $TESTDIR/tall.h5 tac3.h5
+CLEANUP tac3.h5 taj3.h5
+
+# Clean up temporary files/directories
+CLEAN_TESTFILES_AND_TESTDIR
+
+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/test/h5ls/CMakeLists.txt b/tools/test/h5ls/CMakeLists.txt
new file mode 100644
index 0000000..48894fb
--- /dev/null
+++ b/tools/test/h5ls/CMakeLists.txt
@@ -0,0 +1,11 @@
+cmake_minimum_required (VERSION 3.1.0)
+PROJECT (HDF5_TOOLS_TEST_H5LS)
+
+#-----------------------------------------------------------------------------
+# Setup include Directories
+#-----------------------------------------------------------------------------
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib)
+
+ include (CMakeTests.cmake)
+
+ include (CMakeTestsVDS.cmake)
diff --git a/tools/test/h5ls/CMakeTests.cmake b/tools/test/h5ls/CMakeTests.cmake
new file mode 100644
index 0000000..816907c
--- /dev/null
+++ b/tools/test/h5ls/CMakeTests.cmake
@@ -0,0 +1,390 @@
+
+##############################################################################
+##############################################################################
+### T E S T I N G ###
+##############################################################################
+##############################################################################
+
+ # --------------------------------------------------------------------
+ # Copy all the test files from source directory to test directory
+ # --------------------------------------------------------------------
+ set (LIST_HDF5_TEST_FILES
+ ${HDF5_TOOLS_DIR}/testfiles/tall.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tarray1.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tattr2.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tattrreg.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tcompound.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tdatareg.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tdset.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tempty.h5
+ ${HDF5_TOOLS_DIR}/testfiles/textlink.h5
+ ${HDF5_TOOLS_DIR}/testfiles/textlinksrc.h5
+ ${HDF5_TOOLS_DIR}/testfiles/textlinktar.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tgroup.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tgrp_comments.h5
+ ${HDF5_TOOLS_DIR}/testfiles/thlink.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tloop.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tnestedcomp.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tsaf.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tslink.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tsoftlinks.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tstr.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tudlink.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tvldtypes1.h5
+ )
+
+ set (LIST_OTHER_TEST_FILES
+ ${HDF5_TOOLS_DIR}/testfiles/help-1.ls
+ ${HDF5_TOOLS_DIR}/testfiles/help-2.ls
+ ${HDF5_TOOLS_DIR}/testfiles/help-3.ls
+ ${HDF5_TOOLS_DIR}/testfiles/nosuchfile.ls
+ ${HDF5_TOOLS_DIR}/testfiles/tall-1.ls
+ ${HDF5_TOOLS_DIR}/testfiles/tall-2.ls
+ ${HDF5_TOOLS_DIR}/testfiles/tarray1.ls
+ ${HDF5_TOOLS_DIR}/testfiles/tattr2.ls
+ ${HDF5_TOOLS_DIR}/testfiles/tattrreg_le.ls
+ ${HDF5_TOOLS_DIR}/testfiles/tattrreg_be.ls
+ ${HDF5_TOOLS_DIR}/testfiles/tcomp-1.ls
+ ${HDF5_TOOLS_DIR}/testfiles/tdataregbe.ls
+ ${HDF5_TOOLS_DIR}/testfiles/tdataregle.ls
+ ${HDF5_TOOLS_DIR}/testfiles/tdset-1.ls
+ ${HDF5_TOOLS_DIR}/testfiles/tempty.ls
+ ${HDF5_TOOLS_DIR}/testfiles/textlink-1.ls
+ ${HDF5_TOOLS_DIR}/testfiles/textlinksrc-1.ls
+ ${HDF5_TOOLS_DIR}/testfiles/textlinksrc-2.ls
+ ${HDF5_TOOLS_DIR}/testfiles/textlinksrc-3.ls
+ ${HDF5_TOOLS_DIR}/testfiles/textlinksrc-4.ls
+ ${HDF5_TOOLS_DIR}/testfiles/textlinksrc-5.ls
+ ${HDF5_TOOLS_DIR}/testfiles/textlinksrc-6.ls
+ ${HDF5_TOOLS_DIR}/testfiles/textlinksrc-7.ls
+ ${HDF5_TOOLS_DIR}/testfiles/textlinksrc-1-old.ls
+ ${HDF5_TOOLS_DIR}/testfiles/textlinksrc-2-old.ls
+ ${HDF5_TOOLS_DIR}/testfiles/textlinksrc-3-old.ls
+ ${HDF5_TOOLS_DIR}/testfiles/textlinksrc-6-old.ls
+ ${HDF5_TOOLS_DIR}/testfiles/textlinksrc-7-old.ls
+ ${HDF5_TOOLS_DIR}/testfiles/tsoftlinks-1.ls
+ ${HDF5_TOOLS_DIR}/testfiles/tsoftlinks-2.ls
+ ${HDF5_TOOLS_DIR}/testfiles/tsoftlinks-3.ls
+ ${HDF5_TOOLS_DIR}/testfiles/tsoftlinks-4.ls
+ ${HDF5_TOOLS_DIR}/testfiles/tsoftlinks-5.ls
+ ${HDF5_TOOLS_DIR}/testfiles/textlinksrc-nodangle-1.ls
+ ${HDF5_TOOLS_DIR}/testfiles/textlinksrc-nodangle-2.ls
+ ${HDF5_TOOLS_DIR}/testfiles/tgrp_comments.ls
+ ${HDF5_TOOLS_DIR}/testfiles/tsoftlinks-nodangle-1.ls
+ ${HDF5_TOOLS_DIR}/testfiles/thlinks-nodangle-1.ls
+ ${HDF5_TOOLS_DIR}/testfiles/tgroup.ls
+ ${HDF5_TOOLS_DIR}/testfiles/tgroup-1.ls
+ ${HDF5_TOOLS_DIR}/testfiles/tgroup-2.ls
+ ${HDF5_TOOLS_DIR}/testfiles/tgroup-3.ls
+ ${HDF5_TOOLS_DIR}/testfiles/thlink-1.ls
+ ${HDF5_TOOLS_DIR}/testfiles/tloop-1.ls
+ ${HDF5_TOOLS_DIR}/testfiles/tmultifile.ls
+ ${HDF5_TOOLS_DIR}/testfiles/tnestcomp-1.ls
+ ${HDF5_TOOLS_DIR}/testfiles/tnestcomp-2.ls
+ ${HDF5_TOOLS_DIR}/testfiles/tnestcomp-3.ls
+ ${HDF5_TOOLS_DIR}/testfiles/tnestcomp-4.ls
+ ${HDF5_TOOLS_DIR}/testfiles/tsaf.ls
+ ${HDF5_TOOLS_DIR}/testfiles/tslink-1.ls
+ ${HDF5_TOOLS_DIR}/testfiles/tstr-1.ls
+ ${HDF5_TOOLS_DIR}/testfiles/tudlink-1.ls
+ ${HDF5_TOOLS_DIR}/testfiles/tvldtypes1.ls
+ ${HDF5_TOOLS_DIR}/testfiles/tvldtypes2le.ls
+ ${HDF5_TOOLS_DIR}/testfiles/tvldtypes2be.ls
+ )
+
+ file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
+
+ # copy the list of test files
+ foreach (listfiles ${LIST_HDF5_TEST_FILES} ${LIST_OTHER_TEST_FILES})
+ get_filename_component(fname "${listfiles}" NAME)
+ HDFTEST_COPY_FILE("${listfiles}" "${PROJECT_BINARY_DIR}/testfiles/${fname}" "h5ls_files")
+ endforeach (listfiles ${LIST_HDF5_TEST_FILES} ${LIST_OTHER_TEST_FILES})
+ add_custom_target(h5ls_files ALL COMMENT "Copying files needed by h5ls tests" DEPENDS ${h5ls_files_list})
+
+##############################################################################
+##############################################################################
+### T H E T E S T S M A C R O S ###
+##############################################################################
+##############################################################################
+
+ MACRO (ADD_H5_TEST resultfile resultcode)
+ # If using memchecker add tests without using scripts
+ if (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (NAME H5LS-${resultfile} COMMAND $<TARGET_FILE:h5ls> ${ARGN})
+ set_tests_properties (H5LS-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
+ if (${resultcode} STREQUAL "1")
+ set_tests_properties (H5LS-${resultfile} PROPERTIES WILL_FAIL "true")
+ endif ()
+ if (NOT "${last_test}" STREQUAL "")
+ set_tests_properties (H5LS-${resultfile} PROPERTIES DEPENDS ${last_test})
+ endif ()
+ else (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (
+ NAME H5LS-${resultfile}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5ls>"
+ -D "TEST_ARGS=${ARGN}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
+ -D "TEST_OUTPUT=${resultfile}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=${resultfile}.ls"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ endif (HDF5_ENABLE_USING_MEMCHECKER)
+ ENDMACRO (ADD_H5_TEST file)
+
+##############################################################################
+##############################################################################
+### T H E T E S T S ###
+##############################################################################
+##############################################################################
+
+ if (HDF5_ENABLE_USING_MEMCHECKER)
+ # Remove any output file left over from previous test run
+ add_test (
+ NAME H5LS-clearall-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ help-1.out
+ help-1.out.err
+ help-2.out
+ help-2.out.err
+ help-3.out
+ help-3.out.err
+ nosuchfile.out
+ nosuchfile.out.err
+ tall-1.out
+ tall-1.out.err
+ tall-2.out
+ tall-2.out.err
+ tarray1.out
+ tarray1.out.err
+ tattr2.out
+ tattr2.out.err
+ tcomp-1.out
+ tcomp-1.out.err
+ tdataregbe.out
+ tdataregbe.out.err
+ tdataregle.out
+ tdataregle.out.err
+ tdset-1.out
+ tdset-1.out.err
+ tempty.out
+ tempty.out.err
+ textlink-1.out
+ textlink-1.out.err
+ textlinksrc-1.out
+ textlinksrc-1.out.err
+ textlinksrc-2.out
+ textlinksrc-2.out.err
+ textlinksrc-3.out
+ textlinksrc-3.out.err
+ textlinksrc-4.out
+ textlinksrc-4.out.err
+ textlinksrc-5.out
+ textlinksrc-5.out.err
+ textlinksrc-6.out
+ textlinksrc-6.out.err
+ textlinksrc-7.out
+ textlinksrc-7.out.err
+ textlinksrc-1-old.out
+ textlinksrc-1-old.out.err
+ textlinksrc-2-old.out
+ textlinksrc-2-old.out.err
+ textlinksrc-3-old.out
+ textlinksrc-3-old.out.err
+ textlinksrc-6-old.out
+ textlinksrc-6-old.out.err
+ textlinksrc-7-old.out
+ textlinksrc-7-old.out.err
+ tgrp_comments.out
+ tgrp_comments.out.err
+ tsoftlinks-1.out
+ tsoftlinks-1.out.err
+ tsoftlinks-2.out
+ tsoftlinks-2.out.err
+ tsoftlinks-3.out
+ tsoftlinks-3.out.err
+ tsoftlinks-4.out
+ tsoftlinks-4.out.err
+ tsoftlinks-5.out
+ tsoftlinks-5.out.err
+ textlinksrc-nodangle-1.out
+ textlinksrc-nodangle-1.out.err
+ textlinksrc-nodangle-2.out
+ textlinksrc-nodangle-2.out.err
+ tsoftlinks-nodangle-1.out
+ tsoftlinks-nodangle-1.out.err
+ thlinks-nodangle-1.out
+ thlinks-nodangle-1.out.err
+ tgroup.out
+ tgroup.out.err
+ tgroup-1.out
+ tgroup-1.out.err
+ tgroup-2.out
+ tgroup-2.out.err
+ tgroup-3.out
+ tgroup-3.out.err
+ thlink-1.out
+ thlink-1.out.err
+ tloop-1.out
+ tloop-1.out.err
+ tnestcomp-1.out
+ tnestcomp-1.out.err
+ tnestcomp-2.out
+ tnestcomp-2.out.err
+ tnestcomp-3.out
+ tnestcomp-3.out.err
+ tnestcomp-4.out
+ tnestcomp-4.out.err
+ tsaf.out
+ tsaf.out.err
+ tslink-1.out
+ tslink-1.out.err
+ tstr-1.out
+ tstr-1.out.err
+ tudlink-1.out
+ tudlink-1.out.err
+ tvldtypes1.out
+ tvldtypes1.out.err
+ tvldtypes2le.out
+ tvldtypes2le.out.err
+ tvldtypes2be.out
+ tvldtypes2be.out.err
+ )
+ set_tests_properties (H5LS-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
+ if (NOT "${last_test}" STREQUAL "")
+ set_tests_properties (H5LS-clearall-objects PROPERTIES DEPENDS ${last_test})
+ endif (NOT "${last_test}" STREQUAL "")
+ set (last_test "H5LS-clearall-objects")
+ endif (HDF5_ENABLE_USING_MEMCHECKER)
+
+ # test the help syntax
+ ADD_H5_TEST (help-1 0 -w80 -h)
+ ADD_H5_TEST (help-2 0 -w80 --help)
+ ADD_H5_TEST (help-3 0 -w80 -?)
+
+ # test simple command
+ ADD_H5_TEST (tall-1 0 -w80 tall.h5)
+ ADD_H5_TEST (tall-2 0 -w80 -r -d tall.h5)
+ ADD_H5_TEST (tgroup 0 -w80 tgroup.h5)
+ ADD_H5_TEST (tgroup-3 0 -w80 tgroup.h5/g1)
+
+ # test for displaying groups
+ # The following combination of arguments is expected to return an error message
+ # and return value 1
+ ADD_H5_TEST (tgroup-1 1 -w80 -r -g tgroup.h5)
+ ADD_H5_TEST (tgroup-2 0 -w80 -g tgroup.h5/g1)
+
+ # test for files with groups that have long comments
+ ADD_H5_TEST (tgrp_comments 0 -w80 -v -g tgrp_comments.h5/glongcomment)
+
+ # test for displaying simple space datasets
+ ADD_H5_TEST (tdset-1 0 -w80 -r -d tdset.h5)
+
+ # test for displaying soft links (dangle)
+ ADD_H5_TEST (tslink-1 0 -w80 -r tslink.h5)
+
+ # test for displaying more soft links with --follow-symlinks
+ ADD_H5_TEST (tsoftlinks-1 0 --follow-symlinks tsoftlinks.h5)
+ ADD_H5_TEST (tsoftlinks-2 0 --follow-symlinks -r tsoftlinks.h5)
+ ADD_H5_TEST (tsoftlinks-3 0 --follow-symlinks tsoftlinks.h5/group1)
+ ADD_H5_TEST (tsoftlinks-4 0 --follow-symlinks -r tsoftlinks.h5/group1)
+ ADD_H5_TEST (tsoftlinks-5 0 --follow-symlinks tsoftlinks.h5/soft_dset1)
+
+ # test for displaying external and user-defined links with --follow-symlinks
+ ADD_H5_TEST (textlink-1 0 -w80 -r textlink.h5)
+ ADD_H5_TEST (textlinksrc-1 0 -w80 --follow-symlinks -r textlinksrc.h5)
+ ADD_H5_TEST (textlinksrc-2 0 -w80 --follow-symlinks -rv textlinksrc.h5/ext_link5)
+ ADD_H5_TEST (textlinksrc-3 0 -w80 --follow-symlinks -r textlinksrc.h5/ext_link1)
+ ADD_H5_TEST (textlinksrc-4 0 -w80 -r textlinksrc.h5)
+ ADD_H5_TEST (textlinksrc-5 0 -w80 -r textlinksrc.h5/ext_link1)
+ ADD_H5_TEST (textlinksrc-6 0 -w80 --follow-symlinks textlinksrc.h5)
+ ADD_H5_TEST (textlinksrc-7 0 -w80 --follow-symlinks textlinksrc.h5/ext_link1)
+ ADD_H5_TEST (tudlink-1 0 -w80 -r tudlink.h5)
+
+ # test for displaying external links with -E
+ # the option -E will be depriciated but keep it for backward compatibility
+ ADD_H5_TEST (textlinksrc-1-old 0 -w80 -Er textlinksrc.h5)
+ ADD_H5_TEST (textlinksrc-2-old 0 -w80 -Erv textlinksrc.h5/ext_link5)
+ ADD_H5_TEST (textlinksrc-3-old 0 -w80 -Er textlinksrc.h5/ext_link1)
+ ADD_H5_TEST (textlinksrc-6-old 0 -w80 -E textlinksrc.h5)
+ ADD_H5_TEST (textlinksrc-7-old 0 -w80 -E textlinksrc.h5/ext_link1)
+
+ # tests for no-dangling-links
+ # if this option is given on dangling link, h5ls should return exit code 1
+ # when used alone , expect to print out help and return exit code 1
+ ADD_H5_TEST (textlinksrc-nodangle-1 1 -w80 --no-dangling-links textlinksrc.h5)
+ # external dangling link - expected exit code 1
+ ADD_H5_TEST (textlinksrc-nodangle-2 1 -w80 --follow-symlinks --no-dangling-links textlinksrc.h5)
+ # soft dangling link - expected exit code 1
+ ADD_H5_TEST (tsoftlinks-nodangle-1 1 -w80 --follow-symlinks --no-dangling-links tsoftlinks.h5)
+ # when used file with no dangling links - expected exit code 0
+ ADD_H5_TEST (thlinks-nodangle-1 0 -w80 --follow-symlinks --no-dangling-links thlink.h5)
+
+# test for wildcards in filename (does not work with cmake)
+# ADD_H5_TEST (tstarfile 0 -w80 t*link.h5)
+# ADD_H5_TEST (tqmarkfile 0 -w80 t?link.h5)
+ ADD_H5_TEST (tmultifile 0 -w80 thlink.h5 tslink.h5)
+
+ # tests for hard links
+ ADD_H5_TEST (thlink-1 0 -w80 thlink.h5)
+
+ # tests for compound data types
+ ADD_H5_TEST (tcomp-1 0 -w80 -r -d tcompound.h5)
+
+ #test for the nested compound type
+ ADD_H5_TEST (tnestcomp-1 0 -w80 -r -d tnestedcomp.h5)
+
+ ADD_H5_TEST (tnestcomp-2 0 -w80 -r -d -S tnestedcomp.h5)
+
+ ADD_H5_TEST (tnestcomp-3 0 -w80 -r -d -l tnestedcomp.h5)
+
+ ADD_H5_TEST (tnestcomp-4 0 -w80 -r -d -l -S tnestedcomp.h5)
+
+ # test for loop detection
+ ADD_H5_TEST (tloop-1 0 -w80 -r -d tloop.h5)
+
+ # test for string
+ ADD_H5_TEST (tstr-1 0 -w80 -r -d tstr.h5)
+
+ # test test file created from lib SAF team
+ ADD_H5_TEST (tsaf 0 -w80 -r -d tsaf.h5)
+
+ # test for variable length data types
+ ADD_H5_TEST (tvldtypes1 0 -w80 -r -d tvldtypes1.h5)
+
+ # test for array data types
+ ADD_H5_TEST (tarray1 0 -w80 -r -d tarray1.h5)
+
+ # test for empty data
+ ADD_H5_TEST (tempty 0 -w80 -d tempty.h5)
+
+ # test for all dataset types written to attributes
+ # enable -S for avoiding printing NATIVE types
+ ADD_H5_TEST (tattr2 0 -w80 -v -S tattr2.h5)
+
+ # test for attribute with region references wo verbose mode
+ # ( HDFFV-7838, )
+ if (H5_WORDS_BIGENDIAN)
+ ADD_H5_TEST (tattrreg_be 0 -w80 -v -d tattrreg.h5)
+ else (H5_WORDS_BIGENDIAN)
+ ADD_H5_TEST (tattrreg_le 0 -w80 -v -d tattrreg.h5)
+ endif (H5_WORDS_BIGENDIAN)
+
+ # test for non-existing file
+ ADD_H5_TEST (nosuchfile 1 nosuchfile.h5)
+
+ # test for variable length data types in verbose mode
+ if (H5_WORDS_BIGENDIAN)
+ ADD_H5_TEST (tvldtypes2be 0 -v tvldtypes1.h5)
+ else (H5_WORDS_BIGENDIAN)
+ ADD_H5_TEST (tvldtypes2le 0 -v tvldtypes1.h5)
+ endif (H5_WORDS_BIGENDIAN)
+
+ # test for dataset region references data types in verbose mode
+ if (H5_WORDS_BIGENDIAN)
+ ADD_H5_TEST (tdataregbe 0 -v tdatareg.h5)
+ else (H5_WORDS_BIGENDIAN)
+ ADD_H5_TEST (tdataregle 0 -v tdatareg.h5)
+ endif (H5_WORDS_BIGENDIAN)
diff --git a/tools/test/h5ls/CMakeTestsVDS.cmake b/tools/test/h5ls/CMakeTestsVDS.cmake
new file mode 100644
index 0000000..72e14a1
--- /dev/null
+++ b/tools/test/h5ls/CMakeTestsVDS.cmake
@@ -0,0 +1,137 @@
+
+##############################################################################
+##############################################################################
+### T E S T I N G ###
+##############################################################################
+##############################################################################
+
+ # --------------------------------------------------------------------
+ # Copy all the test files from source directory to test directory
+ # --------------------------------------------------------------------
+ set (LIST_HDF5_TEST_FILES
+ 1_a.h5
+ 1_b.h5
+ 1_c.h5
+ 1_d.h5
+ 1_e.h5
+ 1_f.h5
+ 1_vds.h5
+ 2_a.h5
+ 2_b.h5
+ 2_c.h5
+ 2_d.h5
+ 2_e.h5
+ 2_vds.h5
+ 3_1_vds.h5
+ 3_2_vds.h5
+ 4_0.h5
+ 4_1.h5
+ 4_2.h5
+ 4_vds.h5
+ 5_a.h5
+ 5_b.h5
+ 5_c.h5
+ 5_vds.h5
+ )
+
+ set (LIST_OTHER_TEST_FILES
+ tvds-1.ls
+ tvds-2.ls
+ tvds-3_1.ls
+ tvds-3_2.ls
+ tvds-4.ls
+ tvds-5.ls
+ )
+
+ file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
+
+ # copy the list of test files
+ foreach (listfiles ${LIST_HDF5_TEST_FILES} ${LIST_OTHER_TEST_FILES})
+ get_filename_component(fname "${listfiles}" NAME)
+ HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/vds/${listfiles}" "${PROJECT_BINARY_DIR}/testfiles/vds/${fname}" "h5ls_vds_files")
+ endforeach (listfiles ${LIST_HDF5_TEST_FILES} ${LIST_OTHER_TEST_FILES})
+ add_custom_target(h5ls_vds_files ALL COMMENT "Copying files needed by h5ls_vds tests" DEPENDS ${h5ls_vds_files_list})
+
+##############################################################################
+##############################################################################
+### T H E T E S T S M A C R O S ###
+##############################################################################
+##############################################################################
+
+ MACRO (ADD_H5_VDS_TEST resultfile resultcode)
+ # If using memchecker add tests without using scripts
+ if (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (NAME H5LS-${resultfile} COMMAND $<TARGET_FILE:h5ls> ${ARGN})
+ set_tests_properties (H5LS-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds")
+ if (${resultcode} STREQUAL "1")
+ set_tests_properties (H5LS-${resultfile} PROPERTIES WILL_FAIL "true")
+ endif ()
+ if (NOT "${last_test}" STREQUAL "")
+ set_tests_properties (H5LS-${resultfile} PROPERTIES DEPENDS ${last_test})
+ endif ()
+ else (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (
+ NAME H5LS-${resultfile}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5ls>"
+ -D "TEST_ARGS=${ARGN}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/vds"
+ -D "TEST_OUTPUT=${resultfile}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=${resultfile}.ls"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ endif (HDF5_ENABLE_USING_MEMCHECKER)
+ ENDMACRO (ADD_H5_VDS_TEST file)
+
+##############################################################################
+##############################################################################
+### T H E T E S T S ###
+##############################################################################
+##############################################################################
+
+ if (HDF5_ENABLE_USING_MEMCHECKER)
+ # Remove any output file left over from previous test run
+ add_test (
+ NAME H5LS_VDS-clearall-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ tvds-1.out
+ tvds-1.out.err
+ tvds-2.out
+ tvds-2.out.err
+ tvds-3_1.out
+ tvds-3_1.out.err
+ tvds-3_2.out
+ tvds-3_2.out.err
+ tvds-4.out
+ tvds-4.out.err
+ tvds-5.out
+ tvds-5.out.err
+ tvds_layout-1.out
+ tvds_layout-1.out.err
+ tvds_layout-2.out
+ tvds_layout-2.out.err
+ tvds_layout-3_1.out
+ tvds_layout-3_1.out.err
+ tvds_layout-3_2.out
+ tvds_layout-3_2.out.err
+ tvds_layout-4.out
+ tvds_layout-4.out.err
+ tvds_layout-5.out
+ tvds_layout-5.out.err
+ )
+ set_tests_properties (H5LS_VDS-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds")
+ if (NOT "${last_test}" STREQUAL "")
+ set_tests_properties (H5LS_VDS-clearall-objects PROPERTIES DEPENDS ${last_test})
+ endif (NOT "${last_test}" STREQUAL "")
+ set (last_test "H5LS_VDS-clearall-objects")
+ endif (HDF5_ENABLE_USING_MEMCHECKER)
+
+ ADD_H5_VDS_TEST (tvds-1 0 -w80 -v -S 1_vds.h5)
+ ADD_H5_VDS_TEST (tvds-2 0 -w80 -v -S 2_vds.h5)
+ ADD_H5_VDS_TEST (tvds-3_1 0 -w80 -v -S 3_1_vds.h5)
+ ADD_H5_VDS_TEST (tvds-3_2 0 -w80 -v -S 3_2_vds.h5)
+ ADD_H5_VDS_TEST (tvds-4 0 -w80 -v -S 4_vds.h5)
+ ADD_H5_VDS_TEST (tvds-5 0 -w80 -v -S 5_vds.h5)
+
diff --git a/tools/test/h5ls/Makefile.am b/tools/test/h5ls/Makefile.am
new file mode 100644
index 0000000..6f3d3dd
--- /dev/null
+++ b/tools/test/h5ls/Makefile.am
@@ -0,0 +1,34 @@
+#
+# 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.
+##
+## Makefile.am
+## Run automake to generate a Makefile.in from this file.
+#
+# HDF5 Library Makefile(.in)
+#
+
+include $(top_srcdir)/config/commence.am
+
+# Include src and tools/lib directories
+AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib
+
+# Test programs and scripts
+TEST_SCRIPT=testh5ls.sh testh5lsvds.sh
+check_SCRIPTS=$(TEST_SCRIPT)
+SCRIPT_DEPEND=../../src/h5ls/h5ls$(EXEEXT)
+
+# All programs depend on the hdf5 and h5tools libraries
+LDADD=$(LIBH5TOOLS) $(LIBHDF5)
+
+include $(top_srcdir)/config/conclude.am
diff --git a/tools/test/h5ls/testh5ls.sh.in b/tools/test/h5ls/testh5ls.sh.in
new file mode 100644
index 0000000..0637a74
--- /dev/null
+++ b/tools/test/h5ls/testh5ls.sh.in
@@ -0,0 +1,436 @@
+#! /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 h5ls tool
+
+srcdir=@srcdir@
+
+TESTNAME=h5ls
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+
+H5LS=../../src/h5ls/h5ls # The tool name
+H5LS_BIN=`pwd`/$H5LS # The path of the tool binary
+
+RM='rm -rf'
+CMP='cmp -s'
+DIFF='diff -c'
+CP='cp'
+NLINES=20 # Max. lines of output to display if test fails
+DIRNAME='dirname'
+LS='ls'
+AWK='awk'
+
+WORDS_BIGENDIAN="@WORDS_BIGENDIAN@"
+
+nerrors=0
+verbose=yes
+h5haveexitcode=yes # default is yes
+
+# 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/test/h5diff/testfiles"
+SRC_H5COPY_TESTFILES="$SRC_TOOLS/test/h5copy/testfiles"
+SRC_H5REPACK_TESTFILES="$SRC_TOOLS/test/h5repack/testfiles"
+SRC_H5JAM_TESTFILES="$SRC_TOOLS/test/h5jam/testfiles"
+SRC_H5STAT_TESTFILES="$SRC_TOOLS/test/h5stat/testfiles"
+SRC_H5IMPORT_TESTFILES="$SRC_TOOLS/test/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_H5LS_TESTFILES/tall.h5
+$SRC_H5LS_TESTFILES/tarray1.h5
+$SRC_H5LS_TESTFILES/tattr2.h5
+$SRC_H5LS_TESTFILES/tattrreg.h5
+$SRC_H5LS_TESTFILES/tcompound.h5
+$SRC_H5LS_TESTFILES/tdatareg.h5
+$SRC_H5LS_TESTFILES/tdset.h5
+$SRC_H5LS_TESTFILES/tempty.h5
+$SRC_H5LS_TESTFILES/textlink.h5
+$SRC_H5LS_TESTFILES/textlinksrc.h5
+$SRC_H5LS_TESTFILES/textlinktar.h5
+$SRC_H5LS_TESTFILES/tgroup.h5
+$SRC_H5LS_TESTFILES/tgrp_comments.h5
+$SRC_H5LS_TESTFILES/thlink.h5
+$SRC_H5LS_TESTFILES/tloop.h5
+$SRC_H5LS_TESTFILES/tnestedcomp.h5
+$SRC_H5LS_TESTFILES/tsaf.h5
+$SRC_H5LS_TESTFILES/tslink.h5
+$SRC_H5LS_TESTFILES/tsoftlinks.h5
+$SRC_H5LS_TESTFILES/tstr.h5
+$SRC_H5LS_TESTFILES/tudlink.h5
+$SRC_H5LS_TESTFILES/tvldtypes1.h5
+$SRC_H5LS_TESTFILES/tdset_idx.h5
+"
+
+LIST_OTHER_TEST_FILES="
+$SRC_H5LS_TESTFILES/help-1.ls
+$SRC_H5LS_TESTFILES/help-2.ls
+$SRC_H5LS_TESTFILES/help-3.ls
+$SRC_H5LS_TESTFILES/nosuchfile.ls
+$SRC_H5LS_TESTFILES/tall-1.ls
+$SRC_H5LS_TESTFILES/tall-2.ls
+$SRC_H5LS_TESTFILES/tarray1.ls
+$SRC_H5LS_TESTFILES/tattr2.ls
+$SRC_H5LS_TESTFILES/tattrreg_le.ls
+$SRC_H5LS_TESTFILES/tattrreg_be.ls
+$SRC_H5LS_TESTFILES/tcomp-1.ls
+$SRC_H5LS_TESTFILES/tdataregbe.ls
+$SRC_H5LS_TESTFILES/tdataregle.ls
+$SRC_H5LS_TESTFILES/tdset-1.ls
+$SRC_H5LS_TESTFILES/tempty.ls
+$SRC_H5LS_TESTFILES/textlink-1.ls
+$SRC_H5LS_TESTFILES/textlinksrc-1.ls
+$SRC_H5LS_TESTFILES/textlinksrc-2.ls
+$SRC_H5LS_TESTFILES/textlinksrc-3.ls
+$SRC_H5LS_TESTFILES/textlinksrc-4.ls
+$SRC_H5LS_TESTFILES/textlinksrc-5.ls
+$SRC_H5LS_TESTFILES/textlinksrc-6.ls
+$SRC_H5LS_TESTFILES/textlinksrc-7.ls
+$SRC_H5LS_TESTFILES/textlinksrc-1-old.ls
+$SRC_H5LS_TESTFILES/textlinksrc-2-old.ls
+$SRC_H5LS_TESTFILES/textlinksrc-3-old.ls
+$SRC_H5LS_TESTFILES/textlinksrc-6-old.ls
+$SRC_H5LS_TESTFILES/textlinksrc-7-old.ls
+$SRC_H5LS_TESTFILES/tsoftlinks-1.ls
+$SRC_H5LS_TESTFILES/tsoftlinks-2.ls
+$SRC_H5LS_TESTFILES/tsoftlinks-3.ls
+$SRC_H5LS_TESTFILES/tsoftlinks-4.ls
+$SRC_H5LS_TESTFILES/tsoftlinks-5.ls
+$SRC_H5LS_TESTFILES/textlinksrc-nodangle-1.ls
+$SRC_H5LS_TESTFILES/textlinksrc-nodangle-2.ls
+$SRC_H5LS_TESTFILES/tgrp_comments.ls
+$SRC_H5LS_TESTFILES/tsoftlinks-nodangle-1.ls
+$SRC_H5LS_TESTFILES/thlinks-nodangle-1.ls
+$SRC_H5LS_TESTFILES/tgroup.ls
+$SRC_H5LS_TESTFILES/tgroup-1.ls
+$SRC_H5LS_TESTFILES/tgroup-2.ls
+$SRC_H5LS_TESTFILES/tgroup-3.ls
+$SRC_H5LS_TESTFILES/thlink-1.ls
+$SRC_H5LS_TESTFILES/tloop-1.ls
+$SRC_H5LS_TESTFILES/tmultifile.ls
+$SRC_H5LS_TESTFILES/tnestcomp-1.ls
+$SRC_H5LS_TESTFILES/tnestcomp-2.ls
+$SRC_H5LS_TESTFILES/tnestcomp-3.ls
+$SRC_H5LS_TESTFILES/tnestcomp-4.ls
+$SRC_H5LS_TESTFILES/tsaf.ls
+$SRC_H5LS_TESTFILES/tslink-1.ls
+$SRC_H5LS_TESTFILES/tstr-1.ls
+$SRC_H5LS_TESTFILES/tudlink-1.ls
+$SRC_H5LS_TESTFILES/tvldtypes1.ls
+$SRC_H5LS_TESTFILES/tvldtypes2le.ls
+$SRC_H5LS_TESTFILES/tvldtypes2be.ls
+$SRC_H5LS_TESTFILES/tdset_idx.ls
+"
+
+
+# RUNSERIAL is used. Check if it can return exit code from executalbe correctly.
+if [ -n "$RUNSERIAL_NOEXITCODE" ]; then
+ echo "***Warning*** Serial Exit Code is not passed back to shell corretly."
+ echo "***Warning*** Exit code checking is skipped."
+ h5haveexitcode=no
+fi
+
+#
+# copy test files and expected output files from source dirs to test dir
+#
+COPY_TESTFILES="$LIST_HDF5_TEST_FILES $LIST_OTHER_TEST_FILES"
+
+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
+ # skip cp if srcdir is same as destdir
+ # this occurs when build/test performed in source dir and
+ # make cp fail
+ SDIR=`$DIRNAME $tstfile`
+ INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
+ INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
+ if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
+ $CP -f $tstfile $TESTDIR
+ if [ $? -ne 0 ]; then
+ echo "Error: FAILED to copy $tstfile ."
+
+ # Comment out this to CREATE expected file
+ exit $EXIT_FAILURE
+ fi
+ fi
+ fi
+ done
+}
+
+CLEAN_TESTFILES_AND_TESTDIR()
+{
+ # skip rm if srcdir is same as destdir
+ # this occurs when build/test performed in source dir and
+ # make cp fail
+ SDIR=$SRC_H5LS_TESTFILES
+ INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
+ INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
+ if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
+ $RM $TESTDIR
+ fi
+}
+
+# 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*. For now, if h5ls can complete
+# with exit status 0, consider it pass. If a test fails then increment
+# the `nerrors' global variable and (if $verbose is set) display up to $NLINS
+# lines of the actual output from the tool test. The actual output is not
+# removed if $HDF5_NOCLEANUP has a non-zero value.
+# Arguemnts:
+# $1 -- actual output filename to use
+# $2 and on -- argument for the h5ls tool
+TOOLTEST() {
+ expect="$TESTDIR/$1"
+ actual="$TESTDIR/`basename $1 .ls`.out"
+ actual_err="$TESTDIR/`basename $1 .ls`.err"
+ actual_sav=${actual}-sav
+ actual_err_sav=${actual_err}-sav
+ shift
+ retvalexpect=$1
+ shift
+
+ # Run test.
+ # Stderr is included in stdout so that the diff can detect
+ # any unexpected output from that stream too.
+ TESTING $H5LS $@
+ (
+ cd $TESTDIR
+ $RUNSERIAL $H5LS_BIN "$@"
+ ) >$actual 2>$actual_err
+
+ exitcode=$?
+ # 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 [ $h5haveexitcode = 'yes' -a $exitcode -ne $retvalexpect ]; then
+ echo "*FAILED*"
+ nerrors="`expr $nerrors + 1`"
+ if [ yes = "$verbose" ]; then
+ echo "test returned with exit code $exitcode"
+ echo "test output: (up to $NLINES lines)"
+ head -$NLINES $actual
+ echo "***end of test output***"
+ echo ""
+ fi
+ elif [ ! -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 differs from actual result"
+ 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
+}
+
+##############################################################################
+##############################################################################
+### T H E T E S T S ###
+##############################################################################
+##############################################################################
+# prepare for test
+COPY_TESTFILES_TO_TESTDIR
+
+# Toss in a bunch of tests. Not sure if they are the right kinds.
+# test the help syntax
+TOOLTEST help-1.ls 0 -w80 -h
+TOOLTEST help-2.ls 0 -w80 -help
+TOOLTEST help-3.ls 0 -w80 -?
+
+# test simple command
+TOOLTEST tall-1.ls 0 -w80 tall.h5
+TOOLTEST tall-2.ls 0 -w80 -r -d tall.h5
+TOOLTEST tgroup.ls 0 -w80 tgroup.h5
+TOOLTEST tgroup-3.ls 0 -w80 tgroup.h5/g1
+
+# test for displaying groups
+# The following combination of arguments is expected to return an error message
+# and return value 1
+TOOLTEST tgroup-1.ls 1 -w80 -r -g tgroup.h5
+TOOLTEST tgroup-2.ls 0 -w80 -g tgroup.h5/g1
+
+# test for files with groups that have long comments
+TOOLTEST tgrp_comments.ls 0 -w80 -v -g tgrp_comments.h5/glongcomment
+
+# test for displaying simple space datasets
+TOOLTEST tdset-1.ls 0 -w80 -r -d tdset.h5
+
+# test for displaying soft links
+TOOLTEST tslink-1.ls 0 -w80 -r tslink.h5
+
+# test for displaying more soft links with --follow-symlinks
+TOOLTEST tsoftlinks-1.ls 0 --follow-symlinks tsoftlinks.h5
+TOOLTEST tsoftlinks-2.ls 0 --follow-symlinks -r tsoftlinks.h5
+TOOLTEST tsoftlinks-3.ls 0 --follow-symlinks tsoftlinks.h5/group1
+TOOLTEST tsoftlinks-4.ls 0 --follow-symlinks -r tsoftlinks.h5/group1
+TOOLTEST tsoftlinks-5.ls 0 --follow-symlinks tsoftlinks.h5/soft_dset1
+
+# test for displaying external and user-defined links with --follow-symlinks
+TOOLTEST textlink-1.ls 0 -w80 -r textlink.h5
+TOOLTEST textlinksrc-1.ls 0 -w80 --follow-symlinks -r textlinksrc.h5
+TOOLTEST textlinksrc-2.ls 0 -w80 --follow-symlinks -rv textlinksrc.h5/ext_link5
+TOOLTEST textlinksrc-3.ls 0 -w80 --follow-symlinks -r textlinksrc.h5/ext_link1
+TOOLTEST textlinksrc-4.ls 0 -w80 -r textlinksrc.h5
+TOOLTEST textlinksrc-5.ls 0 -w80 -r textlinksrc.h5/ext_link1
+TOOLTEST textlinksrc-6.ls 0 -w80 --follow-symlinks textlinksrc.h5
+TOOLTEST textlinksrc-7.ls 0 -w80 --follow-symlinks textlinksrc.h5/ext_link1
+TOOLTEST tudlink-1.ls 0 -w80 -r tudlink.h5
+
+# test for displaying external links with -E
+# the option -E will be depriciated but keep it for backward compatibility
+TOOLTEST textlinksrc-1-old.ls 0 -w80 -Er textlinksrc.h5
+TOOLTEST textlinksrc-2-old.ls 0 -w80 -Erv textlinksrc.h5/ext_link5
+TOOLTEST textlinksrc-3-old.ls 0 -w80 -Er textlinksrc.h5/ext_link1
+TOOLTEST textlinksrc-6-old.ls 0 -w80 -E textlinksrc.h5
+TOOLTEST textlinksrc-7-old.ls 0 -w80 -E textlinksrc.h5/ext_link1
+
+# tests for no-dangling-links
+# if this option is given on dangling link, h5ls should return exit code 1
+# when used alone , expect to print out help and return exit code 1
+TOOLTEST textlinksrc-nodangle-1.ls 1 -w80 --no-dangling-links textlinksrc.h5
+# external dangling link - expected exit code 1
+TOOLTEST textlinksrc-nodangle-2.ls 1 -w80 --follow-symlinks --no-dangling-links textlinksrc.h5
+# soft dangling link - expected exit code 1
+TOOLTEST tsoftlinks-nodangle-1.ls 1 -w80 --follow-symlinks --no-dangling-links tsoftlinks.h5
+# when used file with no dangling links - expected exit code 0
+TOOLTEST thlinks-nodangle-1.ls 0 -w80 --follow-symlinks --no-dangling-links thlink.h5
+
+# test for wildcards in filename (does not work with cmake)
+# this h5ls test script does not pass the filename properly like the h5dump test script???
+#TOOLTEST tstarfile.ls 0 -w80 t*link.h5
+#TOOLTEST tqmarkfile.ls 0 -w80 t?link.h5
+TOOLTEST tmultifile.ls 0 -w80 thlink.h5 tslink.h5
+
+# tests for hard links
+TOOLTEST thlink-1.ls 0 -w80 thlink.h5
+
+# tests for compound data types
+TOOLTEST tcomp-1.ls 0 -w80 -r -d tcompound.h5
+
+#test for the nested compound type
+TOOLTEST tnestcomp-1.ls 0 -w80 -r -d tnestedcomp.h5
+
+TOOLTEST tnestcomp-2.ls 0 -w80 -r -d -S tnestedcomp.h5
+
+TOOLTEST tnestcomp-3.ls 0 -w80 -r -d -l tnestedcomp.h5
+
+TOOLTEST tnestcomp-4.ls 0 -w80 -r -d -l -S tnestedcomp.h5
+
+# test for loop detection
+TOOLTEST tloop-1.ls 0 -w80 -r -d tloop.h5
+
+# test for string
+TOOLTEST tstr-1.ls 0 -w80 -r -d tstr.h5
+
+# test test file created from lib SAF team
+TOOLTEST tsaf.ls 0 -w80 -r -d tsaf.h5
+
+# test for variable length data types
+TOOLTEST tvldtypes1.ls 0 -w80 -r -d tvldtypes1.h5
+
+# test for array data types
+TOOLTEST tarray1.ls 0 -w80 -r -d tarray1.h5
+
+# test for empty data
+TOOLTEST tempty.ls 0 -w80 -d tempty.h5
+
+# test for all dataset types written to attributes
+# enable -S for avoiding printing NATIVE types
+TOOLTEST tattr2.ls 0 -w80 -v -S tattr2.h5
+
+# test for attribute with region references without verbose mode
+# ( HDFFV-7838, )
+if test $WORDS_BIGENDIAN != "yes"; then
+TOOLTEST tattrreg_le.ls 0 -w80 -v -d tattrreg.h5
+else
+TOOLTEST tattrreg_be.ls 0 -w80 -v -d tattrreg.h5
+fi
+
+# tests for error handling.
+# test for non-existing file
+TOOLTEST nosuchfile.ls 1 nosuchfile.h5
+
+# test for variable length data types in verbose mode
+if test $WORDS_BIGENDIAN != "yes"; then
+ TOOLTEST tvldtypes2le.ls 0 -v tvldtypes1.h5
+else
+ TOOLTEST tvldtypes2be.ls 0 -v tvldtypes1.h5
+fi
+
+
+# test for dataset region references data types in verbose mode
+if test $WORDS_BIGENDIAN != "yes"; then
+ TOOLTEST tdataregle.ls 0 -v tdatareg.h5
+else
+ TOOLTEST tdataregbe.ls 0 -v tdatareg.h5
+fi
+
+# test for file with datasets that use Fixed Array chunk indices
+#echo "***skip testing tdset_idx.h5"
+TOOLTEST tdset_idx.ls 0 -w80 -d tdset_idx.h5
+
+# Clean up temporary files/directories
+CLEAN_TESTFILES_AND_TESTDIR
+
+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/test/h5ls/testh5lsvds.sh.in b/tools/test/h5ls/testh5lsvds.sh.in
new file mode 100644
index 0000000..b5c6aac
--- /dev/null
+++ b/tools/test/h5ls/testh5lsvds.sh.in
@@ -0,0 +1,258 @@
+#! /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 h5ls tool
+
+srcdir=@srcdir@
+
+TESTNAME=h5ls
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+
+H5LS=../../src/h5ls/h5ls # The tool name
+H5LS_BIN=`pwd`/$H5LS # The path of the tool binary
+
+RM='rm -rf'
+CMP='cmp -s'
+DIFF='diff -c'
+CP='cp'
+NLINES=20 # Max. lines of output to display if test fails
+DIRNAME='dirname'
+LS='ls'
+AWK='awk'
+
+WORDS_BIGENDIAN="@WORDS_BIGENDIAN@"
+
+nerrors=0
+verbose=yes
+h5haveexitcode=yes # default is yes
+
+# 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/test/h5diff/testfiles"
+SRC_H5COPY_TESTFILES="$SRC_TOOLS/test/h5copy/testfiles"
+SRC_H5REPACK_TESTFILES="$SRC_TOOLS/test/h5repack/testfiles"
+SRC_H5JAM_TESTFILES="$SRC_TOOLS/test/h5jam/testfiles"
+SRC_H5STAT_TESTFILES="$SRC_TOOLS/test/h5stat/testfiles"
+SRC_H5IMPORT_TESTFILES="$SRC_TOOLS/test/h5import/testfiles"
+
+TEST_P_DIR=./testfiles
+TESTDIR=./testfiles/vds
+test -d $TEST_P_DIR || mkdir -p $TEST_P_DIR
+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_H5LS_TESTFILES/vds/1_a.h5
+$SRC_H5LS_TESTFILES/vds/1_b.h5
+$SRC_H5LS_TESTFILES/vds/1_c.h5
+$SRC_H5LS_TESTFILES/vds/1_d.h5
+$SRC_H5LS_TESTFILES/vds/1_e.h5
+$SRC_H5LS_TESTFILES/vds/1_f.h5
+$SRC_H5LS_TESTFILES/vds/1_vds.h5
+$SRC_H5LS_TESTFILES/vds/2_a.h5
+$SRC_H5LS_TESTFILES/vds/2_b.h5
+$SRC_H5LS_TESTFILES/vds/2_c.h5
+$SRC_H5LS_TESTFILES/vds/2_d.h5
+$SRC_H5LS_TESTFILES/vds/2_e.h5
+$SRC_H5LS_TESTFILES/vds/2_vds.h5
+$SRC_H5LS_TESTFILES/vds/3_1_vds.h5
+$SRC_H5LS_TESTFILES/vds/3_2_vds.h5
+$SRC_H5LS_TESTFILES/vds/4_0.h5
+$SRC_H5LS_TESTFILES/vds/4_1.h5
+$SRC_H5LS_TESTFILES/vds/4_2.h5
+$SRC_H5LS_TESTFILES/vds/4_vds.h5
+$SRC_H5LS_TESTFILES/vds/5_a.h5
+$SRC_H5LS_TESTFILES/vds/5_b.h5
+$SRC_H5LS_TESTFILES/vds/5_c.h5
+$SRC_H5LS_TESTFILES/vds/5_vds.h5
+"
+
+LIST_OTHER_TEST_FILES="
+$SRC_H5LS_TESTFILES/vds/tvds-1.ls
+$SRC_H5LS_TESTFILES/vds/tvds-2.ls
+$SRC_H5LS_TESTFILES/vds/tvds-3_1.ls
+$SRC_H5LS_TESTFILES/vds/tvds-3_2.ls
+$SRC_H5LS_TESTFILES/vds/tvds-4.ls
+$SRC_H5LS_TESTFILES/vds/tvds-5.ls
+"
+
+
+# RUNSERIAL is used. Check if it can return exit code from executalbe correctly.
+if [ -n "$RUNSERIAL_NOEXITCODE" ]; then
+ echo "***Warning*** Serial Exit Code is not passed back to shell corretly."
+ echo "***Warning*** Exit code checking is skipped."
+ h5haveexitcode=no
+fi
+
+#
+# copy test files and expected output files from source dirs to test dir
+#
+COPY_TESTFILES="$LIST_HDF5_TEST_FILES $LIST_OTHER_TEST_FILES"
+
+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
+ # skip cp if srcdir is same as destdir
+ # this occurs when build/test performed in source dir and
+ # make cp fail
+ SDIR=`$DIRNAME $tstfile`
+ INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
+ INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
+ if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
+ $CP -f $tstfile $TESTDIR
+ if [ $? -ne 0 ]; then
+ echo "Error: FAILED to copy $tstfile ."
+
+ # Comment out this to CREATE expected file
+ exit $EXIT_FAILURE
+ fi
+ fi
+ fi
+ done
+}
+
+CLEAN_TESTFILES_AND_TESTDIR()
+{
+ # skip rm if srcdir is same as destdir
+ # this occurs when build/test performed in source dir and
+ # make cp fail
+ SDIR=$SRC_H5LS_TESTFILES/vds
+ INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
+ INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
+ if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
+ $RM $TESTDIR
+ fi
+}
+
+# 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*. For now, if h5ls can complete
+# with exit status 0, consider it pass. If a test fails then increment
+# the `nerrors' global variable and (if $verbose is set) display up to $NLINS
+# lines of the actual output from the tool test. The actual output is not
+# removed if $HDF5_NOCLEANUP has a non-zero value.
+# Arguemnts:
+# $1 -- actual output filename to use
+# $2 and on -- argument for the h5ls tool
+TOOLTEST() {
+ expect="$TESTDIR/$1"
+ actual="$TESTDIR/`basename $1 .ls`.out"
+ actual_err="$TESTDIR/`basename $1 .ls`.err"
+ actual_sav=${actual}-sav
+ actual_err_sav=${actual_err}-sav
+ shift
+ retvalexpect=$1
+ shift
+
+ # Run test.
+ # Stderr is included in stdout so that the diff can detect
+ # any unexpected output from that stream too.
+ TESTING $H5LS $@
+ (
+ cd $TESTDIR
+ $RUNSERIAL $H5LS_BIN "$@"
+ ) >$actual 2>$actual_err
+
+ exitcode=$?
+ # 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 [ $h5haveexitcode = 'yes' -a $exitcode -ne $retvalexpect ]; then
+ echo "*FAILED*"
+ nerrors="`expr $nerrors + 1`"
+ if [ yes = "$verbose" ]; then
+ echo "test returned with exit code $exitcode"
+ echo "test output: (up to $NLINES lines)"
+ head -$NLINES $actual
+ echo "***end of test output***"
+ echo ""
+ fi
+ elif [ ! -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 differs from actual result"
+ 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
+}
+
+##############################################################################
+##############################################################################
+### T H E T E S T S ###
+##############################################################################
+##############################################################################
+# prepare for test
+COPY_TESTFILES_TO_TESTDIR
+
+####### test for dataset vds ######
+
+TOOLTEST tvds-1.ls 0 -w80 -v -S 1_vds.h5
+TOOLTEST tvds-2.ls 0 -w80 -v -S 2_vds.h5
+TOOLTEST tvds-3_1.ls 0 -w80 -v -S 3_1_vds.h5
+TOOLTEST tvds-3_2.ls 0 -w80 -v -S 3_2_vds.h5
+TOOLTEST tvds-4.ls 0 -w80 -v -S 4_vds.h5
+TOOLTEST tvds-5.ls 0 -w80 -v -S 5_vds.h5
+
+# Clean up temporary files/directories
+CLEAN_TESTFILES_AND_TESTDIR
+
+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/test/h5repack/CMakeLists.txt b/tools/test/h5repack/CMakeLists.txt
new file mode 100644
index 0000000..cecec53
--- /dev/null
+++ b/tools/test/h5repack/CMakeLists.txt
@@ -0,0 +1,79 @@
+cmake_minimum_required (VERSION 3.1.0)
+PROJECT (HDF5_TOOLS_TEST_H5REPACK)
+
+#-----------------------------------------------------------------------------
+# Setup include Directories
+#-----------------------------------------------------------------------------
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib)
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/src/h5repack)
+INCLUDE_DIRECTORIES (${HDF5_TEST_SRC_DIR})
+
+# --------------------------------------------------------------------
+# Add h5Repack test executables
+# --------------------------------------------------------------------
+add_executable (testh5repack_detect_szip ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testh5repack_detect_szip.c)
+TARGET_NAMING (testh5repack_detect_szip STATIC)
+TARGET_C_PROPERTIES (testh5repack_detect_szip STATIC " " " ")
+target_link_libraries (testh5repack_detect_szip ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
+set_target_properties (testh5repack_detect_szip PROPERTIES FOLDER tools)
+
+set (REPACK_COMMON_SOURCES
+ ${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack_copy.c
+ ${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack_filters.c
+ ${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack_opttable.c
+ ${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack_parse.c
+ ${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack_refs.c
+ ${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack_verify.c
+ ${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack.c
+)
+add_executable (h5repacktest ${REPACK_COMMON_SOURCES} ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/h5repacktst.c)
+TARGET_NAMING (h5repacktest STATIC)
+TARGET_C_PROPERTIES (h5repacktest STATIC " " " ")
+target_link_libraries (h5repacktest ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
+set_target_properties (h5repacktest PROPERTIES FOLDER tools)
+
+ #-----------------------------------------------------------------------------
+ # If plugin library tests can be tested
+ #-----------------------------------------------------------------------------
+ set (HDF5_TOOL_PLUGIN_LIB_CORENAME "dynlibadd")
+ set (HDF5_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TOOL_PLUGIN_LIB_CORENAME}")
+ set (HDF5_TOOL_PLUGIN_LIB_TARGET ${HDF5_TOOL_PLUGIN_LIB_CORENAME})
+ set (HDF5_TOOL_PLUGIN_LIB_VCORENAME "dynlibvers")
+ set (HDF5_TOOL_PLUGIN_LIB_VNAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TOOL_PLUGIN_LIB_VCORENAME}")
+ set (HDF5_TOOL_PLUGIN_LIB_VTARGET ${HDF5_TOOL_PLUGIN_LIB_VCORENAME})
+ add_definitions (${HDF_EXTRA_C_FLAGS})
+ INCLUDE_DIRECTORIES (${HDF5_SRC_DIR})
+
+ add_library (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_rpk.c)
+ TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED " " " ")
+ target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
+ H5_SET_LIB_OPTIONS (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TOOL_PLUGIN_LIB_NAME} SHARED ${HDF5_PACKAGE_SOVERSION})
+
+ add_library (${HDF5_TOOL_PLUGIN_LIB_VTARGET} SHARED dynlib_vrpk.c)
+ TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_VTARGET} SHARED " " " ")
+ target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_VTARGET} ${HDF5_TEST_LIB_TARGET})
+ H5_SET_LIB_OPTIONS (${HDF5_TOOL_PLUGIN_LIB_VTARGET} ${HDF5_TOOL_PLUGIN_LIB_VNAME} SHARED ${HDF5_PACKAGE_SOVERSION})
+
+ # make plugins dir
+ file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/plugins")
+ #-----------------------------------------------------------------------------
+ # Copy plugin library to a plugins folder
+ #-----------------------------------------------------------------------------
+ add_custom_command (
+ TARGET ${HDF5_TOOL_PLUGIN_LIB_TARGET}
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different
+ "$<TARGET_FILE:${HDF5_TOOL_PLUGIN_LIB_TARGET}>"
+ "${CMAKE_BINARY_DIR}/plugins/$<TARGET_FILE_NAME:${HDF5_TOOL_PLUGIN_LIB_TARGET}>"
+ )
+ add_custom_command (
+ TARGET ${HDF5_TOOL_PLUGIN_LIB_VTARGET}
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different
+ "$<TARGET_FILE:${HDF5_TOOL_PLUGIN_LIB_VTARGET}>"
+ "${CMAKE_BINARY_DIR}/plugins/$<TARGET_FILE_NAME:${HDF5_TOOL_PLUGIN_LIB_VTARGET}>"
+ )
+
+ include (CMakeTests.cmake)
diff --git a/tools/test/h5repack/CMakeTests.cmake b/tools/test/h5repack/CMakeTests.cmake
new file mode 100644
index 0000000..f3ef2a5
--- /dev/null
+++ b/tools/test/h5repack/CMakeTests.cmake
@@ -0,0 +1,1153 @@
+
+##############################################################################
+##############################################################################
+### T E S T I N G ###
+##############################################################################
+##############################################################################
+
+ if (HDF5_TEST_VFD)
+ set (VFD_LIST
+ sec2
+ stdio
+ core
+ split
+ multi
+ family
+ )
+
+ if (DIRECT_VFD)
+ set (VFD_LIST ${VFD_LIST} direct)
+ endif (DIRECT_VFD)
+
+ MACRO (ADD_VFD_TEST vfdname resultcode)
+ add_test (
+ NAME H5REPACK-VFD-${vfdname}-h5repacktest
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5repacktest>"
+ -D "TEST_ARGS:STRING="
+ -D "TEST_VFD:STRING=${vfdname}"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_OUTPUT=h5repacktest"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -P "${HDF_RESOURCES_DIR}/vfdTest.cmake"
+ )
+ if (NOT "${last_test}" STREQUAL "")
+ set_tests_properties (H5REPACK-VFD-${vfdname}-h5repacktest PROPERTIES DEPENDS ${last_test})
+ endif (NOT "${last_test}" STREQUAL "")
+ set (last_test "H5REPACK-VFD-${vfdname}-h5repacktest")
+ ENDMACRO (ADD_VFD_TEST)
+ endif (HDF5_TEST_VFD)
+
+ # --------------------------------------------------------------------
+ # Copy all the HDF5 files from the source directory into the test directory
+ # --------------------------------------------------------------------
+ set (LIST_HDF5_TEST_FILES
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_attr.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_attr_refs.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_deflate.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_early.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_ext.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_fill.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_filters.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_fletcher.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_hlink.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_layout.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_layouto.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_layout2.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_layout3.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_layout.UD.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_named_dtypes.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_nbit.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_objs.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_refs.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_shuffle.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_soffset.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_szip.h5
+ # h5diff/testfile
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_attr1.h5
+ # tools/testfiles
+ ${HDF5_TOOLS_DIR}/testfiles/tfamily00000.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tfamily00001.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tfamily00002.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tfamily00003.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tfamily00004.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tfamily00005.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tfamily00006.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tfamily00007.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tfamily00008.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tfamily00009.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tfamily00010.h5
+ # tools/testfiles/vds
+ ${HDF5_TOOLS_DIR}/testfiles/vds/1_a.h5
+ ${HDF5_TOOLS_DIR}/testfiles/vds/1_b.h5
+ ${HDF5_TOOLS_DIR}/testfiles/vds/1_c.h5
+ ${HDF5_TOOLS_DIR}/testfiles/vds/1_d.h5
+ ${HDF5_TOOLS_DIR}/testfiles/vds/1_e.h5
+ ${HDF5_TOOLS_DIR}/testfiles/vds/1_f.h5
+ ${HDF5_TOOLS_DIR}/testfiles/vds/1_vds.h5
+ ${HDF5_TOOLS_DIR}/testfiles/vds/2_a.h5
+ ${HDF5_TOOLS_DIR}/testfiles/vds/2_b.h5
+ ${HDF5_TOOLS_DIR}/testfiles/vds/2_c.h5
+ ${HDF5_TOOLS_DIR}/testfiles/vds/2_d.h5
+ ${HDF5_TOOLS_DIR}/testfiles/vds/2_e.h5
+ ${HDF5_TOOLS_DIR}/testfiles/vds/2_vds.h5
+ ${HDF5_TOOLS_DIR}/testfiles/vds/3_1_vds.h5
+ ${HDF5_TOOLS_DIR}/testfiles/vds/3_2_vds.h5
+ ${HDF5_TOOLS_DIR}/testfiles/vds/4_0.h5
+ ${HDF5_TOOLS_DIR}/testfiles/vds/4_1.h5
+ ${HDF5_TOOLS_DIR}/testfiles/vds/4_2.h5
+ ${HDF5_TOOLS_DIR}/testfiles/vds/4_vds.h5
+ ${HDF5_TOOLS_DIR}/testfiles/vds/5_a.h5
+ ${HDF5_TOOLS_DIR}/testfiles/vds/5_b.h5
+ ${HDF5_TOOLS_DIR}/testfiles/vds/5_c.h5
+ ${HDF5_TOOLS_DIR}/testfiles/vds/5_vds.h5
+ )
+
+ set (LIST_OTHER_TEST_FILES
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack-help.txt
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_ext.bin
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/ublock.bin
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack.info
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/deflate_limit.h5repack_layout.h5.ddl
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_layout.h5.ddl
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_filters.h5-gzip_verbose_filters.tst
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_layout.h5-dset2_chunk_20x10-errstk.tst
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_layout.h5-plugin_test.ddl
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/plugin_test.h5repack_layout.h5.tst
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_layout.UD.h5-plugin_none.ddl
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/plugin_none.h5repack_layout.UD.h5.tst
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_layout.h5-plugin_version_test.ddl
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/plugin_version_test.h5repack_layout.h5.tst
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/1_vds.h5-vds_dset_chunk20x10x5-v.ddl
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/2_vds.h5-vds_chunk3x6x9-v.ddl
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/3_1_vds.h5-vds_chunk2x5x8-v.ddl
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/4_vds.h5-vds_compa-v.ddl
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/4_vds.h5-vds_conti-v.ddl
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_layout.h5-plugin_zero.tst
+ )
+
+ foreach (h5_file ${LIST_HDF5_TEST_FILES} ${LIST_OTHER_TEST_FILES})
+ get_filename_component(fname "${h5_file}" NAME)
+ HDFTEST_COPY_FILE("${h5_file}" "${PROJECT_BINARY_DIR}/testfiles/${fname}" "h5repack_files")
+ endforeach (h5_file ${LIST_HDF5_TEST_FILES} ${LIST_OTHER_TEST_FILES})
+ add_custom_target(h5repack_files ALL COMMENT "Copying files needed by h5repack tests" DEPENDS ${h5repack_files_list})
+
+##############################################################################
+##############################################################################
+### T H E T E S T S M A C R O S ###
+##############################################################################
+##############################################################################
+
+ MACRO (ADD_HELP_TEST testname resultcode)
+ # If using memchecker add tests without using scripts
+ if (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (NAME H5REPACK-${testname} COMMAND $<TARGET_FILE:h5repack> ${ARGN})
+ set_tests_properties (H5REPACK-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
+ if (NOT "${last_test}" STREQUAL "")
+ set_tests_properties (H5REPACK-${testname} PROPERTIES DEPENDS ${last_test})
+ endif ()
+ set (last_test "H5REPACK-${testname}")
+ else (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (
+ NAME H5REPACK-h5repack-${testname}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5repack>"
+ -D "TEST_ARGS:STRING=${ARGN}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
+ -D "TEST_OUTPUT=h5repack-${testname}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=h5repack-${testname}.txt"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ endif (HDF5_ENABLE_USING_MEMCHECKER)
+ ENDMACRO (ADD_HELP_TEST)
+
+ MACRO (ADD_H5_TEST_OLD testname testtype testfile)
+ if ("${testtype}" STREQUAL "SKIP")
+ if (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (
+ NAME H5REPACK_OLD-${testname}-SKIPPED
+ COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${ARGN} -i ${PROJECT_BINARY_DIR}/testfiles/${testfile} -o ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}"
+ )
+ endif (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ else ("${testtype}" STREQUAL "SKIP")
+ add_test (
+ NAME H5REPACK_OLD-${testname}
+ COMMAND $<TARGET_FILE:h5repack> ${ARGN} -i ${PROJECT_BINARY_DIR}/testfiles/${testfile} -o ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}
+ )
+ if (NOT "${last_test}" STREQUAL "")
+ set_tests_properties (H5REPACK_OLD-${testname} PROPERTIES DEPENDS ${last_test})
+ endif ()
+ add_test (
+ NAME H5REPACK_OLD-${testname}_DFF
+ COMMAND $<TARGET_FILE:h5diff> ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}
+ )
+ set_tests_properties (H5REPACK_OLD-${testname}_DFF PROPERTIES DEPENDS H5REPACK_OLD-${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)
+ add_test (
+ NAME H5REPACK-${testname}-SKIPPED
+ COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}"
+ )
+ endif (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ else ("${testtype}" STREQUAL "SKIP")
+ add_test (
+ NAME H5REPACK-${testname}
+ COMMAND $<TARGET_FILE:h5repack> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}
+ )
+ if (NOT "${last_test}" STREQUAL "")
+ set_tests_properties (H5REPACK-${testname} PROPERTIES DEPENDS ${last_test})
+ endif ()
+ add_test (
+ NAME H5REPACK-${testname}_DFF
+ COMMAND $<TARGET_FILE:h5diff> ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}
+ )
+ set_tests_properties (H5REPACK-${testname}_DFF PROPERTIES DEPENDS H5REPACK-${testname})
+ endif ("${testtype}" STREQUAL "SKIP")
+ ENDMACRO (ADD_H5_TEST)
+
+ MACRO (ADD_H5_CMP_TEST testname testfilter testtype resultcode resultfile)
+ if ("${testtype}" STREQUAL "SKIP")
+ if (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (
+ NAME H5REPACK_CMP-${testname}-SKIPPED
+ COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile}"
+ )
+ endif (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ else ("${testtype}" STREQUAL "SKIP")
+ # If using memchecker add tests without using scripts
+ if (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (
+ NAME H5REPACK_CMP-${testname}
+ COMMAND $<TARGET_FILE:h5repack> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile})
+ else (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (
+ NAME H5REPACK_CMP-${testname}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5repack>"
+ -D "TEST_ARGS:STRING=${ARGN};${resultfile};out-${testname}.${resultfile}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
+ -D "TEST_OUTPUT=${resultfile}-${testname}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_FILTER:STRING=${testfilter}"
+ -D "TEST_REFERENCE=${resultfile}-${testname}.tst"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ endif (HDF5_ENABLE_USING_MEMCHECKER)
+ if (NOT "${last_test}" STREQUAL "")
+ set_tests_properties (H5REPACK_CMP-${testname} PROPERTIES DEPENDS ${last_test})
+ endif ()
+ endif ("${testtype}" STREQUAL "SKIP")
+ ENDMACRO (ADD_H5_CMP_TEST)
+
+ MACRO (ADD_H5_MASK_TEST testname testtype resultcode resultfile)
+ if ("${testtype}" STREQUAL "SKIP")
+ if (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (
+ NAME H5REPACK_MASK-${testname}-SKIPPED
+ COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile}"
+ )
+ endif (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ else ("${testtype}" STREQUAL "SKIP")
+ # If using memchecker add tests without using scripts
+ if (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (
+ NAME H5REPACK_MASK-${testname}
+ COMMAND $<TARGET_FILE:h5repack> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile})
+ else (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (
+ NAME H5REPACK_MASK-${testname}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5repack>"
+ -D "TEST_ARGS:STRING=${ARGN};${resultfile};out-${testname}.${resultfile}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
+ -D "TEST_OUTPUT=${resultfile}-${testname}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_MASK_ERROR=true"
+ -D "TEST_REFERENCE=${resultfile}-${testname}.tst"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ endif (HDF5_ENABLE_USING_MEMCHECKER)
+ if (NOT "${last_test}" STREQUAL "")
+ set_tests_properties (H5REPACK_MASK-${testname} PROPERTIES DEPENDS ${last_test})
+ endif ()
+ endif ("${testtype}" STREQUAL "SKIP")
+ ENDMACRO (ADD_H5_MASK_TEST)
+
+ MACRO (ADD_H5_DMP_TEST testname testtype resultcode resultfile)
+ if ("${testtype}" STREQUAL "SKIP")
+ if (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (
+ NAME H5REPACK_DMP-${testname}-SKIPPED
+ COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile}"
+ )
+ endif (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ else ("${testtype}" STREQUAL "SKIP")
+ # If using memchecker add tests without using scripts
+ add_test (
+ NAME H5REPACK_DMP-${testname}
+ COMMAND $<TARGET_FILE:h5repack> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile})
+ if (NOT "${last_test}" STREQUAL "")
+ set_tests_properties (H5REPACK_DMP-${testname} PROPERTIES DEPENDS ${last_test})
+ endif ()
+ if (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (
+ NAME H5REPACK_DMP-h5dump-${testname}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_ARGS:STRING=-pH;out-${testname}.${resultfile}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
+ -D "TEST_OUTPUT=${resultfile}-${testname}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=${testname}.${resultfile}.ddl"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ set_tests_properties (H5REPACK_DMP-h5dump-${testname} PROPERTIES DEPENDS "H5REPACK_DMP-${testname}")
+ endif (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ endif ("${testtype}" STREQUAL "SKIP")
+ ENDMACRO (ADD_H5_DMP_TEST)
+
+ MACRO (ADD_H5_VERIFY_TEST testname testtype resultcode testfile testdset testfilter)
+ if ("${testtype}" STREQUAL "SKIP")
+ if (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (
+ NAME H5REPACK_VERIFY_LAYOUT-${testname}-SKIPPED
+ COMMAND ${CMAKE_COMMAND} -E echo "SKIP -d ${testdset} -pH ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile}"
+ )
+ endif (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ else ("${testtype}" STREQUAL "SKIP")
+ if (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (
+ NAME H5REPACK_VERIFY_LAYOUT-${testname}
+ COMMAND $<TARGET_FILE:h5repack> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}
+ )
+ if (NOT "${last_test}" STREQUAL "")
+ set_tests_properties (H5REPACK_VERIFY_LAYOUT-${testname} PROPERTIES DEPENDS ${last_test})
+ endif ()
+ add_test (
+ NAME H5REPACK_VERIFY_LAYOUT-${testname}_DFF
+ COMMAND $<TARGET_FILE:h5diff> ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}
+ )
+ set_tests_properties (H5REPACK_VERIFY_LAYOUT-${testname}_DFF PROPERTIES DEPENDS H5REPACK_VERIFY_LAYOUT-${testname})
+ if ("${resultcode}" STREQUAL "0")
+ add_test (
+ NAME H5REPACK_VERIFY_LAYOUT-${testname}_DMP
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_ARGS:STRING=-d;${testdset};-pH;out-${testname}.${testfile}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
+ -D "TEST_OUTPUT=${testfile}-${testname}-v.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_FILTER:STRING=${testfilter}"
+ -D "TEST_REFERENCE=${testfilter}"
+ -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake"
+ )
+ set_tests_properties (H5REPACK_VERIFY_LAYOUT-${testname}_DMP PROPERTIES DEPENDS H5REPACK_VERIFY_LAYOUT-${testname}_DFF)
+ else ("${resultcode}" STREQUAL "0")
+ if ("${testfilter}" STREQUAL "CHUNKED")
+ set (nottestfilter "(CONTIGUOUS|COMPACT)")
+ endif ()
+ if ("${testfilter}" STREQUAL "CONTIGUOUS")
+ set (nottestfilter "(CHUNK|COMPACT)")
+ endif ()
+ if ("${testfilter}" STREQUAL "COMPACT")
+ set (nottestfilter "(CONTIGUOUS|CHUNK)")
+ endif ()
+ add_test (
+ NAME H5REPACK_VERIFY_LAYOUT-${testname}_DMP
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_ARGS:STRING=-pH;out-${testname}.${testfile}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
+ -D "TEST_OUTPUT=${testfile}-${testname}-v.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_FILTER:STRING=${nottestfilter}"
+ -D "TEST_REFERENCE=${testfilter}"
+ -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake"
+ )
+ set_tests_properties (H5REPACK_VERIFY_LAYOUT-${testname}_DMP PROPERTIES DEPENDS H5REPACK_VERIFY_LAYOUT-${testname}_DFF)
+ endif ("${resultcode}" STREQUAL "0")
+ endif (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ endif ("${testtype}" STREQUAL "SKIP")
+ ENDMACRO (ADD_H5_VERIFY_TEST)
+
+ MACRO (ADD_H5_VERIFY_VDS testname testtype resultcode testfile testdset testfilter)
+ if ("${testtype}" STREQUAL "SKIP")
+ if (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (
+ NAME H5REPACK_VERIFY_LAYOUT_VDS-${testname}-SKIPPED
+ COMMAND ${CMAKE_COMMAND} -E echo "SKIP -d ${testdset} -pH ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile}"
+ )
+ endif (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ else ("${testtype}" STREQUAL "SKIP")
+ if (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (
+ NAME H5REPACK_VERIFY_LAYOUT_VDS-${testname}
+ COMMAND $<TARGET_FILE:h5repack> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}
+ )
+ set_tests_properties (H5REPACK_VERIFY_LAYOUT_VDS-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
+ if (NOT "${last_test}" STREQUAL "")
+ set_tests_properties (H5REPACK_VERIFY_LAYOUT_VDS-${testname} PROPERTIES DEPENDS ${last_test})
+ endif ()
+ add_test (
+ NAME H5REPACK_VERIFY_LAYOUT_VDS-${testname}_DMP
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_ARGS:STRING=-d;${testdset};-p;out-${testname}.${testfile}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
+ -D "TEST_OUTPUT=${testfile}-${testname}-v.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=${testfile}-${testname}-v.ddl"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ set_tests_properties (H5REPACK_VERIFY_LAYOUT_VDS-${testname}_DMP PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
+ set_tests_properties (H5REPACK_VERIFY_LAYOUT_VDS-${testname}_DMP PROPERTIES DEPENDS H5REPACK_VERIFY_LAYOUT_VDS-${testname})
+ endif (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ endif ("${testtype}" STREQUAL "SKIP")
+ ENDMACRO (ADD_H5_VERIFY_VDS)
+
+ MACRO (ADD_H5_TEST_META testname testfile)
+ add_test (
+ NAME H5REPACK_META-${testname}_N
+ COMMAND $<TARGET_FILE:h5repack> ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}_N.${testname}.h5
+ )
+ if (NOT "${last_test}" STREQUAL "")
+ set_tests_properties (H5REPACK_META-${testname}_N PROPERTIES DEPENDS ${last_test})
+ endif ()
+ add_test (
+ NAME H5REPACK_META-${testname}_M
+ COMMAND $<TARGET_FILE:h5repack> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}_M.${testname}.h5
+ )
+ set_tests_properties (H5REPACK_META-${testname}_M PROPERTIES DEPENDS H5REPACK_META-${testname}_N)
+
+ add_test (NAME H5REPACK_META-${testname} COMMAND ${CMAKE_COMMAND} -E compare_files ${PROJECT_BINARY_DIR}/testfiles/out-${testname}_N.${testname}.h5 ${PROJECT_BINARY_DIR}/testfiles/out-${testname}_M.${testname}.h5)
+ set_tests_properties (H5REPACK_META-${testname} PROPERTIES WILL_FAIL "true")
+ set_tests_properties (H5REPACK_META-${testname} PROPERTIES DEPENDS H5REPACK_META-${testname}_M)
+ ENDMACRO (ADD_H5_TEST_META)
+
+ MACRO (ADD_H5_UD_TEST testname resultcode resultfile)
+ if (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ # Remove any output file left over from previous test run
+ add_test (
+ NAME H5REPACK_UD-${testname}-clearall-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ testfiles/out-${testname}.${resultfile}
+ )
+ add_test (
+ NAME H5REPACK_UD-${testname}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5repack>"
+ -D "TEST_ARGS:STRING=${ARGN};${resultfile};out-${testname}.${resultfile}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_FILTER:STRING=O?...ing file[^\n]+\n"
+ -D "TEST_OUTPUT=${testname}.${resultfile}.out"
+ -D "TEST_REFERENCE=${testname}.${resultfile}.tst"
+ -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH"
+ -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}/plugins"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ set_tests_properties (H5REPACK_UD-${testname} PROPERTIES DEPENDS H5REPACK_UD-${testname}-clearall-objects)
+ add_test (
+ NAME H5REPACK_UD-h5dump-${testname}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_ARGS:STRING=-pH;out-${testname}.${resultfile}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
+ -D "TEST_OUTPUT=${resultfile}-${testname}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=${resultfile}-${testname}.ddl"
+ -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH"
+ -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}/plugins"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ set_tests_properties (H5REPACK_UD-h5dump-${testname} PROPERTIES DEPENDS "H5REPACK_UD-${testname}")
+ endif (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ ENDMACRO (ADD_H5_UD_TEST)
+
+##############################################################################
+##############################################################################
+### T H E T E S T S ###
+##############################################################################
+##############################################################################
+
+ # --------------------------------------------------------------------
+ # test file names
+ # --------------------------------------------------------------------
+ set (INFO_FILE testfiles/h5repack.info)
+
+ set (FILE0 h5repack_fill.h5)
+ set (FILE1 h5repack_objs.h5)
+ set (FILE2 h5repack_attr.h5)
+ set (FILE3 h5repack_hlink.h5)
+ set (FILE4 h5repack_layout.h5)
+ set (FILE5 h5repack_early.h5)
+ set (FILE7 h5repack_szip.h5)
+ set (FILE8 h5repack_deflate.h5)
+ set (FILE9 h5repack_shuffle.h5)
+ set (FILE10 h5repack_fletcher.h5)
+ set (FILE11 h5repack_filters.h5)
+ set (FILE12 h5repack_nbit.h5)
+ set (FILE13 h5repack_soffset.h5)
+ set (FILE14 h5repack_layouto.h5 ) # A file with an older version of the layout message (copy of test/tlayouto.h5)
+ set (FILE15 h5repack_named_dtypes.h5)
+ set (FILE16 tfamily%05d.h5) # located in common testfiles folder
+ set (FILE18 h5repack_layout2.h5)
+ set (FILE_REF h5repack_refs.h5)
+ set (FILE_ATTR_REF h5repack_attr_refs.h5)
+ set (FILEV1 1_vds.h5)
+ set (FILEV2 2_vds.h5)
+ set (FILEV3_1 3_1_vds.h5)
+ set (FILEV3_2 3_2_vds.h5)
+ set (FILEV4 4_vds.h5)
+ set (FILEV5 5_vds.h5)
+
+ # Remove any output file left over from previous test run
+ add_test (
+ NAME H5REPACK-clearall-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ ./testfiles/h5dump-help.out
+ ./testfiles/h5repack_filters.h5-gzip_verbose_filters.out
+ ./testfiles/h5repack_filters.h5-gzip_verbose_filters.out.err
+ ./testfiles/h5repack_layout.h5-chunk_18x13-v.out
+ ./testfiles/h5repack_layout.h5-chunk_18x13-v.out.err
+ ./testfiles/h5repack_layout.h5-chunk_20x10-v.out
+ ./testfiles/h5repack_layout.h5-chunk_20x10-v.out.err
+ ./testfiles/h5repack_layout.h5-chunk_compa-v.out
+ ./testfiles/h5repack_layout.h5-chunk_compa-v.out.err
+ ./testfiles/h5repack_layout.h5-chunk_conti-v.out
+ ./testfiles/h5repack_layout.h5-chunk_conti-v.out.err
+ ./testfiles/h5repack_layout.h5-compa-v.out
+ ./testfiles/h5repack_layout.h5-compa-v.out.err
+ ./testfiles/h5repack_layout.h5-conti-v.out
+ ./testfiles/h5repack_layout.h5-conti-v.out.err
+ ./testfiles/h5repack_layout.h5-deflate_limit.out
+ ./testfiles/h5repack_layout.h5-deflate_limit.out.err
+ ./testfiles/h5repack_layout.h5-dset2_chunk_20x10-v.out
+ ./testfiles/h5repack_layout.h5-dset2_chunk_20x10-v.out.err
+ ./testfiles/h5repack_layout.h5-dset2_chunk_20x10-errstk.out
+ ./testfiles/h5repack_layout.h5-dset2_chunk_20x10-errstk.out.err
+ ./testfiles/h5repack_layout.h5-dset2_compa-v.out
+ ./testfiles/h5repack_layout.h5-dset2_compa-v.out.err
+ ./testfiles/h5repack_layout.h5-dset2_conti-v.out
+ ./testfiles/h5repack_layout.h5-dset2_conti-v.out.err
+ ./testfiles/h5repack_layout.h5-dset_compa_chunk-v.out
+ ./testfiles/h5repack_layout.h5-dset_compa_chunk-v.out.err
+ ./testfiles/h5repack_layout.h5-dset_compa_compa-v.out
+ ./testfiles/h5repack_layout.h5-dset_compa_compa-v.out.err
+ ./testfiles/h5repack_layout.h5-dset_compa_conti-v.out
+ ./testfiles/h5repack_layout.h5-dset_compa_conti-v.out.err
+ ./testfiles/h5repack_layout.h5-dset_conti_chunk-v.out
+ ./testfiles/h5repack_layout.h5-dset_conti_chunk-v.out.err
+ ./testfiles/h5repack_layout.h5-dset_conti_compa-v.out
+ ./testfiles/h5repack_layout.h5-dset_conti_compa-v.out.err
+ ./testfiles/h5repack_layout.h5-dset_conti_conti-v.out
+ ./testfiles/h5repack_layout.h5-dset_conti_conti-v.out.err
+ ./testfiles/h5repack_layout.h5-layout_long_switches-v.out
+ ./testfiles/h5repack_layout.h5-layout_long_switches-v.out.err
+ ./testfiles/h5repack_layout.h5-layout_short_switches-v.out
+ ./testfiles/h5repack_layout.h5-layout_short_switches-v.out.err
+ ./testfiles/h5repack_layout.h5-plugin_test.out
+ ./testfiles/h5repack_layout.h5-plugin_test.out.err
+ ./testfiles/h5repack_layout2.h5-contig_small_compa-v.out
+ ./testfiles/h5repack_layout2.h5-contig_small_compa-v.out.err
+ ./testfiles/h5repack_layout2.h5-contig_small_fixed_compa-v.out
+ ./testfiles/h5repack_layout2.h5-contig_small_fixed_compa-v.out.err
+ ./testfiles/h5repack_layout3.h5-ckdim_biger-v.out
+ ./testfiles/h5repack_layout3.h5-ckdim_biger-v.out.err
+ ./testfiles/h5repack_layout3.h5-ckdim_smaller-v.out
+ ./testfiles/h5repack_layout3.h5-ckdim_smaller-v.out.err
+ ./testfiles/h5repack_layout3.h5-chunk2chunk-v.out
+ ./testfiles/h5repack_layout3.h5-chunk2chunk-v.out.err
+ ./testfiles/h5repack_layout3.h5-chunk2compa-v.out
+ ./testfiles/h5repack_layout3.h5-chunk2compa-v.out.err
+ ./testfiles/h5repack_layout3.h5-chunk2conti-v.out
+ ./testfiles/h5repack_layout3.h5-chunk2conti-v.out.err
+ ./testfiles/h5repack_layout3.h5-error1-v.out
+ ./testfiles/h5repack_layout3.h5-error1-v.out.err
+ ./testfiles/h5repack_layout3.h5-error2-v.out
+ ./testfiles/h5repack_layout3.h5-error2-v.out.err
+ ./testfiles/h5repack_layout3.h5-error3-v.out
+ ./testfiles/h5repack_layout3.h5-error3-v.out.err
+ ./testfiles/out-family.tfamily%05d.h5
+ ./testfiles/out-HDFFV-7840.h5diff_attr1.h5
+ ./testfiles/out-attr.h5repack_attr.h5
+ ./testfiles/out-native_attr.h5repack_attr.h5
+ ./testfiles/out-HDFFV-5932.h5repack_attr_refs.h5
+ ./testfiles/out-deflate_copy.h5repack_deflate.h5
+ ./testfiles/out-deflate_remove.h5repack_deflate.h5
+ ./testfiles/out-early.h5repack_early.h5
+ ./testfiles/out-fill.h5repack_fill.h5
+ ./testfiles/out-native_fill.h5repack_fill.h5
+ ./testfiles/out-gzip_verbose_filters.h5repack_filters.h5
+ ./testfiles/out-fletcher_copy.h5repack_fletcher.h5
+ ./testfiles/out-fletcher_remove.h5repack_fletcher.h5
+ ./testfiles/out-hlink.h5repack_hlink.h5
+ ./testfiles/out-chunk_18x13.h5repack_layout.h5
+ ./testfiles/out-chunk_20x10.h5repack_layout.h5
+ ./testfiles/out-chunk_compa.h5repack_layout.h5
+ ./testfiles/out-chunk_conti.h5repack_layout.h5
+ ./testfiles/out-compa.h5repack_layout.h5
+ ./testfiles/out-conti.h5repack_layout.h5
+ ./testfiles/out-deflate_file.h5repack_layout.h5
+ ./testfiles/out-deflate_limit.h5repack_layout.h5
+ ./testfiles/out-dset2_chunk_20x10.h5repack_layout.h5
+ ./testfiles/out-dset2_compa.h5repack_layout.h5
+ ./testfiles/out-dset2_conti.h5repack_layout.h5
+ ./testfiles/out-dset_compa_chunk.h5repack_layout.h5
+ ./testfiles/out-dset_compa_compa.h5repack_layout.h5
+ ./testfiles/out-dset_compa_conti.h5repack_layout.h5
+ ./testfiles/out-dset_conti_chunk.h5repack_layout.h5
+ ./testfiles/out-dset_conti_compa.h5repack_layout.h5
+ ./testfiles/out-dset_conti_conti.h5repack_layout.h5
+ ./testfiles/out-fletcher_all.h5repack_layout.h5
+ ./testfiles/out-fletcher_individual.h5repack_layout.h5
+ ./testfiles/out-global_filters.h5repack_layout.h5
+ ./testfiles/out-gzip_all.h5repack_layout.h5
+ ./testfiles/out-gzip_individual.h5repack_layout.h5
+ ./testfiles/out-layout.h5repack_layout.h5
+ ./testfiles/out-layout_long_switches.h5repack_layout.h5
+ ./testfiles/out-layout_short_switches.h5repack_layout.h5
+ ./testfiles/out-old_style_layout_short_switches.h5repack_layout.h5
+ ./testfiles/out-plugin_test.h5repack_layout.h5
+ ./testfiles/out-shuffle_all.h5repack_layout.h5
+ ./testfiles/out-shuffle_individual.h5repack_layout.h5
+ ./testfiles/out-upgrade_layout.h5repack_layouto.h5
+ ./testfiles/out-contig_small_compa.h5repack_layout2.h5
+ ./testfiles/out-contig_small_fixed_compa.h5repack_layout2.h5
+ ./testfiles/out-ckdim_biger.h5repack_layout3.h5
+ ./testfiles/out-ckdim_smaller.h5repack_layout3.h5
+ ./testfiles/out-chunk2chunk.h5repack_layout3.h5
+ ./testfiles/out-chunk2compa.h5repack_layout3.h5
+ ./testfiles/out-chunk2conti.h5repack_layout3.h5
+ ./testfiles/out-error1.h5repack_layout3.h5
+ ./testfiles/out-error2.h5repack_layout3.h5
+ ./testfiles/out-error3.h5repack_layout3.h5
+ ./testfiles/out-error4.h5repack_layout3.h5
+ ./testfiles/out-committed_dt.h5repack_named_dtypes.h5
+ ./testfiles/out-nbit_add.h5repack_nbit.h5
+ ./testfiles/out-nbit_copy.h5repack_nbit.h5
+ ./testfiles/out-nbit_remove.h5repack_nbit.h5
+ ./testfiles/out-add_alignment.h5repack_objs.h5
+ ./testfiles/out-add_userblock.h5repack_objs.h5
+ ./testfiles/out-objs.h5repack_objs.h5
+ ./testfiles/out-gt_mallocsize.h5repack_objs.h5
+ ./testfiles/out-bug1814.h5repack_refs.h5
+ ./testfiles/out-shuffle_copy.h5repack_shuffle.h5
+ ./testfiles/out-shuffle_remove.h5repack_shuffle.h5
+ ./testfiles/out-scale_add.h5repack_soffset.h5
+ ./testfiles/out-scale_copy.h5repack_soffset.h5
+ ./testfiles/out-scale_remove.h5repack_soffset.h5
+ ./testfiles/out-meta_short_M.meta_short.h5
+ ./testfiles/out-meta_short_N.meta_short.h5
+ ./testfiles/out-meta_long_M.meta_long.h5
+ ./testfiles/out-meta_long_N.meta_long.h5
+ ./testfiles/1_vds.h5-vds_dset_chunk20x10x5-v.out
+ ./testfiles/1_vds.h5-vds_dset_chunk20x10x5-v.out.err
+ ./testfiles/2_vds.h5-vds_chunk3x6x9-v.out
+ ./testfiles/2_vds.h5-vds_chunk3x6x9-v.out.err
+ ./testfiles/3_1_vds.h5-vds_chunk2x5x8-v.out
+ ./testfiles/3_1_vds.h5-vds_chunk2x5x8-v.out.err
+ ./testfiles/4_vds.h5-vds_compa-v.out
+ ./testfiles/4_vds.h5-vds_compa-v.out.err
+ ./testfiles/4_vds.h5-vds_conti-v.out
+ ./testfiles/4_vds.h5-vds_conti-v.out.err
+ ./testfiles/out-vds_compa.4_vds.h5
+ ./testfiles/out-vds_conti.4_vds.h5
+ ./testfiles/out-vds_chunk2x5x8.3_1_vds.h5
+ ./testfiles/out-vds_chunk3x6x9.2_vds.h5
+ ./testfiles/out-vds_dset_chunk20x10x5.1_vds.h5
+ h5repack_attr.h5
+ h5repack_attr_out.h5
+ h5repack_attr_refs.h5
+ h5repack_big.h5
+ h5repack_deflate.h5
+ h5repack_deflate_out.h5
+ h5repack_early2.h5
+ h5repack_early.h5
+ h5repack_early_out.h5
+ h5repack_ext.h5
+ h5repack_ext_out.h5
+ h5repack_fill.h5
+ h5repack_fill_out.h5
+ h5repack_filters.h5
+ h5repack_filters_out.h5
+ h5repack_fletcher.h5
+ h5repack_fletcher_out.h5
+ h5repack_hlink.h5
+ h5repack_hlink_out.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
+ h5repack_nbit_out.h5
+ h5repack_objs.h5
+ h5repack_objs_out.h5
+ h5repack_refs.h5
+ h5repack_shuffle.h5
+ h5repack_shuffle_out.h5
+ h5repack_soffset.h5
+ h5repack_soffset_out.h5
+ h5repack_szip.h5
+ h5repack_szip_out.h5
+ h5repack_ub.h5
+ h5repack_ub_out.h5
+ h5repack_ext.bin
+ ublock.bin
+ )
+ if (NOT "${last_test}" STREQUAL "")
+ set_tests_properties (H5REPACK-clearall-objects PROPERTIES DEPENDS ${last_test})
+ endif (NOT "${last_test}" STREQUAL "")
+
+ ADD_HELP_TEST(help 0 -h)
+
+ add_test (NAME H5REPACK-testh5repack_detect_szip COMMAND $<TARGET_FILE:testh5repack_detect_szip>)
+ if (HDF5_ENABLE_SZIP_SUPPORT)
+ if (HDF5_ENABLE_SZIP_ENCODING)
+ set (passRegex "yes")
+ set_tests_properties (H5REPACK-testh5repack_detect_szip PROPERTIES PASS_REGULAR_EXPRESSION "yes")
+ else (HDF5_ENABLE_SZIP_ENCODING)
+ set (passRegex "no")
+ set_tests_properties (H5REPACK-testh5repack_detect_szip PROPERTIES PASS_REGULAR_EXPRESSION "no")
+ endif (HDF5_ENABLE_SZIP_ENCODING)
+ else (HDF5_ENABLE_SZIP_SUPPORT)
+ set (passRegex "no")
+ set_tests_properties (H5REPACK-testh5repack_detect_szip PROPERTIES PASS_REGULAR_EXPRESSION "no")
+ endif (HDF5_ENABLE_SZIP_SUPPORT)
+ set_tests_properties (H5REPACK-testh5repack_detect_szip PROPERTIES DEPENDS H5REPACK-clearall-objects)
+
+ add_test (NAME H5REPACK-h5repacktest COMMAND $<TARGET_FILE:h5repacktest>)
+ set_tests_properties (H5REPACK-h5repacktest PROPERTIES DEPENDS H5REPACK-testh5repack_detect_szip)
+ set (last_test "H5REPACK-h5repacktest")
+
+#
+# The tests
+# We use the files generated by h5repacktst
+# Each run generates "<file>.out.h5" and the tool h5diff is used to
+# compare the input and output files
+#
+# the tests are the same as the program h5repacktst, but run from the CLI
+#
+
+# See which filters are usable (and skip tests for filters we
+# don't have). Do this by searching H5pubconf.h to see which
+# filters are defined.
+
+# detect whether the encoder is present.
+ set (USE_FILTER_SZIP_ENCODER "no")
+ if (HDF5_ENABLE_SZIP_ENCODING)
+ set (USE_FILTER_SZIP_ENCODER ${testh5repack_detect_szip})
+ endif (HDF5_ENABLE_SZIP_ENCODING)
+
+ if (H5_HAVE_FILTER_DEFLATE)
+ set (USE_FILTER_DEFLATE "true")
+ endif (H5_HAVE_FILTER_DEFLATE)
+
+ if (H5_HAVE_FILTER_SZIP)
+ set (USE_FILTER_SZIP "true")
+ endif (H5_HAVE_FILTER_SZIP)
+
+# copy files (these files have no filters)
+ ADD_H5_TEST (fill "TEST" ${FILE0})
+ ADD_H5_TEST (objs "TEST" ${FILE1})
+ ADD_H5_TEST (attr "TEST" ${FILE2})
+ ADD_H5_TEST (hlink "TEST" ${FILE3})
+ ADD_H5_TEST (layout "TEST" ${FILE4})
+ ADD_H5_TEST (early "TEST" ${FILE5})
+
+# use $FILE4 to write some filters (this file has no filters)
+
+# gzip with individual object
+ set (arg ${FILE4} -f dset1:GZIP=1 -l dset1:CHUNK=20x10)
+ set (TESTTYPE "TEST")
+ if (NOT USE_FILTER_DEFLATE)
+ set (TESTTYPE "SKIP")
+ endif (NOT USE_FILTER_DEFLATE)
+ ADD_H5_TEST (gzip_individual ${TESTTYPE} ${arg})
+
+# gzip for all
+ set (arg ${FILE4} -f GZIP=1)
+ set (TESTTYPE "TEST")
+ if (NOT USE_FILTER_DEFLATE)
+ set (TESTTYPE "SKIP")
+ endif (NOT USE_FILTER_DEFLATE)
+ ADD_H5_TEST (gzip_all ${TESTTYPE} ${arg})
+
+# szip with individual object
+ set (arg ${FILE4} -f dset2:SZIP=8,EC -l dset2:CHUNK=20x10)
+ set (TESTTYPE "TEST")
+ if (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP)
+ set (TESTTYPE "SKIP")
+ endif (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP)
+ ADD_H5_TEST (szip_individual ${TESTTYPE} ${arg})
+
+# szip for all
+ set (arg ${FILE4} -f SZIP=8,NN)
+ set (TESTTYPE "TEST")
+ if (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP)
+ set (TESTTYPE "SKIP")
+ endif (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP)
+ ADD_H5_TEST (szip_all ${TESTTYPE} ${arg})
+
+# shuffle with individual object
+ set (arg ${FILE4} -f dset2:SHUF -l dset2:CHUNK=20x10)
+ ADD_H5_TEST (shuffle_individual "TEST" ${arg})
+
+# shuffle for all
+ set (arg ${FILE4} -f SHUF)
+ ADD_H5_TEST (shuffle_all "TEST" ${arg})
+
+# fletcher32 with individual object
+ set (arg ${FILE4} -f dset2:FLET -l dset2:CHUNK=20x10)
+ ADD_H5_TEST (fletcher_individual "TEST" ${arg})
+
+# fletcher32 for all
+ set (arg ${FILE4} -f FLET)
+ ADD_H5_TEST (fletcher_all "TEST" ${arg})
+
+# all filters
+ set (arg ${FILE4} -f dset2:SHUF -f dset2:FLET -f dset2:SZIP=8,NN -f dset2:GZIP=1 -l dset2:CHUNK=20x10)
+ set (TESTTYPE "TEST")
+ if (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP OR NOT USE_FILTER_DEFLATE)
+ set (TESTTYPE "SKIP")
+ endif (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP OR NOT USE_FILTER_DEFLATE)
+ ADD_H5_TEST (all_filters ${TESTTYPE} ${arg})
+
+# verbose gzip with individual object
+ set (arg ${FILE11} -v -f /dset_deflate:GZIP=9)
+ set (TESTTYPE "TEST")
+ if (NOT USE_FILTER_DEFLATE)
+ set (TESTTYPE "SKIP")
+ endif (NOT USE_FILTER_DEFLATE)
+ ADD_H5_CMP_TEST (gzip_verbose_filters "O?...ing file[^\n]+\n" ${TESTTYPE} 0 ${arg})
+
+###########################################################
+# the following tests assume the input files have filters
+###########################################################
+
+# szip copy
+ set (arg ${FILE7})
+ set (TESTTYPE "TEST")
+ if (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP)
+ set (TESTTYPE "SKIP")
+ endif (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP)
+ ADD_H5_TEST (szip_copy ${TESTTYPE} ${arg})
+
+# szip remove
+ set (arg ${FILE7} --filter=dset_szip:NONE)
+ set (TESTTYPE "TEST")
+ if (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP)
+ set (TESTTYPE "SKIP")
+ endif (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP)
+ ADD_H5_TEST (szip_remove ${TESTTYPE} ${arg})
+
+# deflate copy
+ set (arg ${FILE8})
+ set (TESTTYPE "TEST")
+ if (NOT USE_FILTER_DEFLATE)
+ set (TESTTYPE "SKIP")
+ endif (NOT USE_FILTER_DEFLATE)
+ ADD_H5_TEST (deflate_copy ${TESTTYPE} ${arg})
+
+# deflate remove
+ set (arg ${FILE8} -f dset_deflate:NONE)
+ set (TESTTYPE "TEST")
+ if (NOT USE_FILTER_DEFLATE)
+ set (TESTTYPE "SKIP")
+ endif (NOT USE_FILTER_DEFLATE)
+ ADD_H5_TEST (deflate_remove ${TESTTYPE} ${arg})
+
+# shuffle copy
+ set (arg ${FILE9})
+ ADD_H5_TEST (shuffle_copy "TEST" ${arg})
+
+# shuffle remove
+ set (arg ${FILE9} -f dset_shuffle:NONE)
+ ADD_H5_TEST (shuffle_remove "TEST" ${arg})
+
+# fletcher32 copy
+ set (arg ${FILE10})
+ ADD_H5_TEST (fletcher_copy "TEST" ${arg})
+
+# fletcher32 remove
+ set (arg ${FILE10} -f dset_fletcher32:NONE)
+ ADD_H5_TEST (fletcher_remove "TEST" ${arg})
+
+# nbit copy
+ set (arg ${FILE12})
+ ADD_H5_TEST (nbit_copy "TEST" ${arg})
+
+# nbit remove
+ set (arg ${FILE12} -f dset_nbit:NONE)
+ ADD_H5_TEST (nbit_remove "TEST" ${arg})
+
+# nbit add
+ set (arg ${FILE12} -f dset_int31:NBIT)
+ ADD_H5_TEST (nbit_add "TEST" ${arg})
+
+# scaleoffset copy
+ set (arg ${FILE13})
+ ADD_H5_TEST (scale_copy "TEST" ${arg})
+
+# scaleoffset add
+ set (arg ${FILE13} -f dset_none:SOFF=31,IN)
+ ADD_H5_TEST (scale_add "TEST" ${arg})
+
+# scaleoffset remove
+ set (arg ${FILE13} -f dset_scaleoffset:NONE)
+ ADD_H5_TEST (scale_remove "TEST" ${arg})
+
+# remove all filters
+ set (arg ${FILE11} -f NONE)
+ set (TESTTYPE "TEST")
+ if (NOT USE_FILTER_DEFLATE OR NOT USE_FILTER_SZIP OR NOT USE_FILTER_SZIP_ENCODER)
+ set (TESTTYPE "SKIP")
+ endif (NOT USE_FILTER_DEFLATE OR NOT USE_FILTER_SZIP OR NOT USE_FILTER_SZIP_ENCODER)
+ ADD_H5_TEST (remove_all ${TESTTYPE} ${arg})
+
+#filter conversions
+ set (arg ${FILE8} -f dset_deflate:SZIP=8,NN)
+ set (TESTTYPE "TEST")
+ if (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP OR NOT USE_FILTER_DEFLATE)
+ set (TESTTYPE "SKIP")
+ endif (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP OR NOT USE_FILTER_DEFLATE)
+ ADD_H5_TEST (deflate_convert ${TESTTYPE} ${arg})
+
+ set (arg ${FILE7} -f dset_szip:GZIP=1)
+ set (TESTTYPE "TEST")
+ if (NOT USE_FILTER_SZIP OR NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_DEFLATE)
+ set (TESTTYPE "SKIP")
+ endif (NOT USE_FILTER_SZIP OR NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_DEFLATE)
+ ADD_H5_TEST (szip_convert ${TESTTYPE} ${arg})
+
+#limit
+ set (arg ${FILE4} -f GZIP=1 -m 1024)
+ set (TESTTYPE "TEST")
+ if (NOT USE_FILTER_DEFLATE)
+ set (TESTTYPE "SKIP")
+ endif (NOT USE_FILTER_DEFLATE)
+ ADD_H5_DMP_TEST (deflate_limit ${TESTTYPE} 0 ${arg})
+
+#file
+ set (arg ${FILE4} -e ${INFO_FILE})
+ set (TESTTYPE "TEST")
+ if (NOT USE_FILTER_DEFLATE)
+ set (TESTTYPE "SKIP")
+ endif (NOT USE_FILTER_DEFLATE)
+ ADD_H5_TEST (deflate_file ${TESTTYPE} ${arg})
+
+#########################################################
+# layout options (these files have no filters)
+#########################################################
+ ADD_H5_VERIFY_TEST (dset2_chunk_20x10 "TEST" 0 ${FILE4} dset2 CHUNKED --layout=dset2:CHUNK=20x10)
+ ADD_H5_VERIFY_TEST (chunk_20x10 "TEST" 1 ${FILE4} null CHUNKED -l CHUNK=20x10)
+ ADD_H5_VERIFY_TEST (dset2_conti "TEST" 0 ${FILE4} dset2 CONTIGUOUS -l dset2:CONTI)
+ ADD_H5_VERIFY_TEST (conti "TEST" 1 ${FILE4} null CONTIGUOUS -l CONTI)
+ ADD_H5_VERIFY_TEST (dset2_compa "TEST" 0 ${FILE4} dset2 COMPACT -l dset2:COMPA)
+ ADD_H5_VERIFY_TEST (compa "TEST" 1 ${FILE4} null COMPACT -l COMPA)
+ ADD_H5_MASK_TEST (dset2_chunk_20x10-errstk "TEST" 0 ${FILE4} --layout=dset2:CHUNK=20x10x5 --enable-error-stack)
+
+################################################################
+# layout conversions (file has no filters)
+###############################################################
+ ADD_H5_VERIFY_TEST (dset_compa_conti "TEST" 0 ${FILE4} dset_compact CONTIGUOUS -l dset_compact:CONTI)
+ ADD_H5_VERIFY_TEST (dset_compa_chunk "TEST" 0 ${FILE4} dset_compact CHUNKED -l dset_compact:CHUNK=2x5)
+ ADD_H5_VERIFY_TEST (dset_compa_compa "TEST" 0 ${FILE4} dset_compact COMPACT -l dset_compact:COMPA)
+ ADD_H5_VERIFY_TEST (dset_conti_compa "TEST" 0 ${FILE4} dset_contiguous COMPACT -l dset_contiguous:COMPA)
+ ADD_H5_VERIFY_TEST (dset_conti_chunk "TEST" 0 ${FILE4} dset_contiguous CHUNKED -l dset_contiguous:CHUNK=3x6)
+ ADD_H5_VERIFY_TEST (dset_conti_conti "TEST" 0 ${FILE4} dset_contiguous CONTIGUOUS -l dset_contiguous:CONTI)
+ ADD_H5_VERIFY_TEST (chunk_compa "TEST" 0 ${FILE4} dset_chunk COMPACT -l dset_chunk:COMPA)
+ ADD_H5_VERIFY_TEST (chunk_conti "TEST" 0 ${FILE4} dset_chunk CONTIGUOUS -l dset_chunk:CONTI)
+ ADD_H5_VERIFY_TEST (chunk_18x13 "TEST" 0 ${FILE4} dset_chunk CHUNKED -l dset_chunk:CHUNK=18x13)
+
+# test convert small size dataset ( < 1k) to compact layout without -m
+ ADD_H5_VERIFY_TEST (contig_small_compa "TEST" 0 ${FILE18} contig_small COMPACT -l contig_small:COMPA)
+ ADD_H5_VERIFY_TEST (contig_small_fixed_compa "TEST" 0 ${FILE18} chunked_small_fixed COMPACT -l chunked_small_fixed:COMPA)
+
+#---------------------------------------------------------------------------
+# 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_VERIFY_TEST (chunk2chunk "TEST" 0 h5repack_layout3.h5 chunk_unlimit1 CHUNK -l chunk_unlimit1:CHUNK=100x300)
+
+# chunk to contiguous
+ ADD_H5_VERIFY_TEST (chunk2conti "TEST" 0 h5repack_layout3.h5 chunk_unlimit1 CONTI -l chunk_unlimit1:CONTI)
+
+# chunk to compact - convert big dataset (should be > 64k) for this purpose,
+# should remain as original layout (chunk)
+ ADD_H5_VERIFY_TEST (chunk2compa "TEST" 0 h5repack_layout3.h5 chunk_unlimit1 CHUNK -l chunk_unlimit1:COMPA)
+
+#--------------------------------------------------------------------------
+# Test -f for some specific cases. Chunked dataset with unlimited max dims.
+# (HDFFV-8012)
+#--------------------------------------------------------------------------
+# - should not fail
+# - should not change max dims from unlimit
+
+# chunk dim is bigger than dataset dim. ( dset size < 64k )
+ ADD_H5_VERIFY_TEST (error1 "TEST" 0 h5repack_layout3.h5 chunk_unlimit1 H5S_UNLIMITED -f chunk_unlimit1:NONE)
+
+# chunk dim is bigger than dataset dim. ( dset size > 64k )
+ ADD_H5_VERIFY_TEST (error2 "TEST" 0 h5repack_layout3.h5 chunk_unlimit2 H5S_UNLIMITED -f chunk_unlimit2:NONE)
+
+# chunk dims are smaller than dataset dims. ( dset size < 64k )
+ ADD_H5_VERIFY_TEST (error3 "TEST" 0 h5repack_layout3.h5 chunk_unlimit3 H5S_UNLIMITED -f chunk_unlimit3:NONE)
+
+# file input - should not fail
+ ADD_H5_TEST (error4 "TEST" h5repack_layout3.h5 -f NONE)
+
+#--------------------------------------------------------------------------
+# Test base: Convert CHUNK to CONTI for a chunked dataset with small dataset
+# (dset size < 64K) and with unlimited max dims on a condition as follow.
+# (HDFFV-8214)
+#--------------------------------------------------------------------------
+# chunk dim is bigger than dataset dim. should succeed.
+ ADD_H5_VERIFY_TEST (ckdim_biger "TEST" 0 h5repack_layout3.h5 chunk_unlimit2 CONTI -l chunk_unlimit2:CONTI)
+# chunk dim is smaller than dataset dim. should succeed.
+ ADD_H5_VERIFY_TEST (ckdim_smaller "TEST" 0 h5repack_layout3.h5 chunk_unlimit3 CONTI -l chunk_unlimit3:CONTI)
+
+
+
+# Native option
+# Do not use FILE1, as the named dtype will be converted to native, and h5diff will
+# report a difference.
+ ADD_H5_TEST (native_fill "TEST" ${FILE0} -n)
+ ADD_H5_TEST (native_attr "TEST" ${FILE2} -n)
+
+# latest file format with long switches. use FILE4=h5repack_layout.h5 (no filters)
+ set (arg --layout CHUNK=20x10 --filter GZIP=1 --minimum=10 --native --latest --compact=8 --indexed=6 --ssize=8[:dtype])
+ set (TESTTYPE "TEST")
+ if (NOT USE_FILTER_DEFLATE)
+ set (TESTTYPE "SKIP")
+ endif (NOT USE_FILTER_DEFLATE)
+ ADD_H5_VERIFY_TEST (layout_long_switches ${TESTTYPE} 1 ${FILE4} null CHUNKED ${arg})
+
+# latest file format with short switches. use FILE4=h5repack_layout.h5 (no filters)
+ set (arg -l CHUNK=20x10 -f GZIP=1 -m 10 -n -L -c 8 -d 6 -s 8[:dtype])
+ set (TESTTYPE "TEST")
+ if (NOT USE_FILTER_DEFLATE)
+ set (TESTTYPE "SKIP")
+ endif (NOT USE_FILTER_DEFLATE)
+ ADD_H5_VERIFY_TEST (layout_short_switches ${TESTTYPE} 1 ${FILE4} null CHUNKED ${arg})
+
+# several global filters
+ set (arg ${FILE4} --filter GZIP=1 --filter SHUF)
+ set (TESTTYPE "TEST")
+ if (NOT USE_FILTER_DEFLATE)
+ set (TESTTYPE "SKIP")
+ endif (NOT USE_FILTER_DEFLATE)
+ ADD_H5_TEST (global_filters ${TESTTYPE} ${arg})
+
+# syntax of -i infile -o outfile
+# latest file format with short switches. use FILE4=h5repack_layout.h5 (no filters)
+ set (arg ${FILE4} -l CHUNK=20x10 -f GZIP=1 -m 10 -n -L -c 8 -d 6 -s 8[:dtype])
+ set (TESTTYPE "LEGACY")
+ if (NOT USE_FILTER_DEFLATE)
+ set (TESTTYPE "SKIP")
+ endif (NOT USE_FILTER_DEFLATE)
+ 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)
+ ADD_H5_TEST (add_userblock "TEST" ${arg})
+
+# add alignment
+ set (arg ${FILE1} -t 1 -a 1)
+ ADD_H5_TEST (add_alignment "TEST" ${arg})
+
+# Check repacking file with old version of layout message (should get upgraded
+# to new version and be readable, etc.)
+ ADD_H5_TEST (upgrade_layout "TEST" ${FILE14})
+
+# test for datum size > H5TOOLS_MALLOCSIZE
+ ADD_H5_TEST (gt_mallocsize "TEST" ${FILE1} -f GZIP=1)
+
+# Check repacking file with committed datatypes in odd configurations
+ ADD_H5_TEST (committed_dt "TEST" ${FILE15})
+
+# tests family driver (file is located in common testfiles folder, uses TOOLTEST1
+ 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 (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
+# 2. leak from compound type without reference member
+# (HDFFV-7840, )
+# 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)
+
+# VDS tests
+
+################################################################
+# layout conversions
+###############################################################
+ set (TESTTYPE "TEST")
+ if (NOT USE_FILTER_DEFLATE)
+ set (TESTTYPE "SKIP")
+ endif (NOT USE_FILTER_DEFLATE)
+ ADD_H5_VERIFY_VDS (vds_dset_chunk20x10x5 ${TESTTYPE} 0 ${FILEV1} vds_dset CHUNKED -l vds_dset:CHUNK=20x10x5)
+
+ set (TESTTYPE "TEST")
+ if (NOT USE_FILTER_DEFLATE)
+ set (TESTTYPE "SKIP")
+ endif (NOT USE_FILTER_DEFLATE)
+ ADD_H5_VERIFY_VDS (vds_chunk2x5x8 ${TESTTYPE} 0 ${FILEV3_1} vds_dset CHUNKED -l vds_dset:CHUNK=2x5x8)
+
+ set (TESTTYPE "TEST")
+ if (NOT USE_FILTER_DEFLATE)
+ set (TESTTYPE "SKIP")
+ endif (NOT USE_FILTER_DEFLATE)
+ ADD_H5_VERIFY_VDS (vds_chunk3x6x9 ${TESTTYPE} 0 ${FILEV2} vds_dset CHUNKED -l vds_dset:CHUNK=3x6x9)
+
+ set (TESTTYPE "TEST")
+ if (NOT USE_FILTER_DEFLATE)
+ set (TESTTYPE "SKIP")
+ endif (NOT USE_FILTER_DEFLATE)
+ ADD_H5_VERIFY_VDS (vds_compa ${TESTTYPE} 0 ${FILEV4} vds_dset COMPACT -l vds_dset:COMPA)
+
+ set (TESTTYPE "TEST")
+ if (NOT USE_FILTER_DEFLATE)
+ set (TESTTYPE "SKIP")
+ endif (NOT USE_FILTER_DEFLATE)
+ ADD_H5_VERIFY_VDS (vds_conti ${TESTTYPE} 0 ${FILEV4} vds_dset CONTIGUOUS -l vds_dset:CONTI)
+
+##############################################################################
+### P L U G I N T E S T S
+##############################################################################
+ ADD_H5_UD_TEST (plugin_version_test 0 h5repack_layout.h5 -v -f UD=260,4,9,1,9,235)
+ ADD_H5_UD_TEST (plugin_test 0 h5repack_layout.h5 -v -f UD=257,1,9)
+ ADD_H5_UD_TEST (plugin_none 0 h5repack_layout.UD.h5 -v -f NONE)
+ # check for no parameters
+ set (TESTRETVAL 255)
+ if (WIN32)
+ set (TESTRETVAL -1)
+ endif()
+ ADD_H5_CMP_TEST (plugin_zero "" "TEST" ${TESTRETVAL} h5repack_layout.h5 -v -f UD=250,0)
+
+ if (HDF5_TEST_VFD)
+ # Run test with different Virtual File Driver
+ foreach (vfd ${VFD_LIST})
+ ADD_VFD_TEST (${vfd} 0)
+ endforeach (vfd ${VFD_LIST})
+ endif (HDF5_TEST_VFD)
diff --git a/tools/test/h5repack/Makefile.am b/tools/test/h5repack/Makefile.am
new file mode 100644
index 0000000..6c045c4
--- /dev/null
+++ b/tools/test/h5repack/Makefile.am
@@ -0,0 +1,67 @@
+#
+# 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.
+##
+## Makefile.am
+## Run automake to generate a Makefile.in from this file.
+#
+# HDF5 Library Makefile(.in)
+#
+
+include $(top_srcdir)/config/commence.am
+
+# Include src, test, and tools/lib directories
+AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/test -I$(top_srcdir)/tools/lib -I$(top_srcdir)/tools/src/h5repack
+
+# Test programs and scripts
+TEST_SCRIPT=h5repack.sh
+
+noinst_PROGRAMS=h5repacktst testh5repack_detect_szip
+
+SCRIPT_DEPEND=../../src/h5repack/h5repack$(EXEEXT) h5repacktst$(EXEEXT)
+if HAVE_SHARED_CONDITIONAL
+if USE_PLUGINS_CONDITIONAL
+ TEST_SCRIPT += h5repack_plugin.sh
+endif
+endif
+
+check_SCRIPTS=$(TEST_SCRIPT)
+
+# Depend on the hdf5 library, the tools library, the test library
+LDADD=$(LIBH5TOOLS) $(LIBH5TEST) $(LIBHDF5)
+
+testh5repack_detect_szip_SOURCES=testh5repack_detect_szip.c
+
+# Source files
+COMMON_SOURCES=../../src/h5repack/h5repack.c ../../src/h5repack/h5repack_copy.c ../../src/h5repack/h5repack_filters.c \
+ ../../src/h5repack/h5repack_opttable.c ../../src/h5repack/h5repack_parse.c ../../src/h5repack/h5repack_refs.c \
+ ../../src/h5repack/h5repack_verify.c
+h5repacktst_SOURCES=$(COMMON_SOURCES) h5repacktst.c
+
+
+if HAVE_SHARED_CONDITIONAL
+ # Build it as shared library if configure is enabled for shared library.
+ lib_LTLIBRARIES=libdynlibadd.la libdynlibvers.la
+ libdynlibadd_la_SOURCES=dynlib_rpk.c
+ libdynlibvers_la_SOURCES=dynlib_vrpk.c
+
+install-exec-hook:
+ $(RM) $(DESTDIR)$(libdir)/*dynlib*
+endif
+
+# Temporary files. *.h5 are generated by h5repack. They should
+# copied to the testfiles/ directory if update is required.
+CHECK_CLEANFILES+=*.h5 *.bin testfiles/h5diff_attr1.h5 testfiles/tfamily*.h5
+DISTCLEANFILES=h5repack.sh h5repack_plugin.sh
+
+include $(top_srcdir)/config/conclude.am
diff --git a/tools/test/h5repack/dynlib_rpk.c b/tools/test/h5repack/dynlib_rpk.c
new file mode 100644
index 0000000..3469e58
--- /dev/null
+++ b/tools/test/h5repack/dynlib_rpk.c
@@ -0,0 +1,97 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * 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 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/*
+ * Programmer: Raymond Lu
+ * 13 February 2013
+ *
+ * Purpose: Tests the plugin module (H5PL)
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include "H5PLextern.h"
+
+#define H5Z_FILTER_DYNLIB1 257
+
+static size_t H5Z_filter_dynlib1(unsigned int flags, size_t cd_nelmts,
+ const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
+
+/* This message derives from H5Z */
+const H5Z_class2_t H5Z_DYNLIB1[1] = {{
+ H5Z_CLASS_T_VERS, /* H5Z_class_t version */
+ H5Z_FILTER_DYNLIB1, /* Filter id number */
+ 1, 1, /* Encoding and decoding enabled */
+ "dynlib1", /* Filter name for debugging */
+ NULL, /* The "can apply" callback */
+ NULL, /* The "set local" callback */
+ (H5Z_func_t)H5Z_filter_dynlib1, /* The actual filter function */
+}};
+
+H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;}
+const void *H5PLget_plugin_info(void) {return H5Z_DYNLIB1;}
+
+/*-------------------------------------------------------------------------
+ * Function: H5Z_filter_dynlib1
+ *
+ * Purpose: A dynlib1 filter method that adds on and subtract from
+ * the original value with another value. It will be built
+ * as a shared library. plugin.c test will load and use
+ * this filter library.
+ *
+ * Return: Success: Data chunk size
+ *
+ * Failure: 0
+ *
+ * Programmer: Raymond Lu
+ * 29 March 2013
+ *
+ *-------------------------------------------------------------------------
+ */
+static size_t
+H5Z_filter_dynlib1(unsigned int flags, size_t cd_nelmts,
+ const unsigned int *cd_values, size_t nbytes,
+ size_t *buf_size, void **buf)
+{
+ int *int_ptr = (int *)*buf; /* Pointer to the data values */
+ size_t buf_left = *buf_size; /* Amount of data buffer left to process */
+ int add_on = 0;
+
+ /* Check for the correct number of parameters */
+ if(cd_nelmts == 0)
+ return 0;
+
+ /* Check that permanent parameters are set correctly */
+ if(cd_values[0] > 9)
+ return 0;
+
+ add_on = (int)cd_values[0];
+
+ if(flags & H5Z_FLAG_REVERSE) { /*read*/
+ /* Substract the "add on" value to all the data values */
+ while(buf_left > 0) {
+ *int_ptr++ -= add_on;
+ buf_left -= sizeof(int);
+ } /* end while */
+ } /* end if */
+ else { /*write*/
+ /* Add the "add on" value to all the data values */
+ while(buf_left > 0) {
+ *int_ptr++ += add_on;
+ buf_left -= sizeof(int);
+ } /* end while */
+ } /* end else */
+
+ return nbytes;
+} /* end H5Z_filter_dynlib1() */
+
diff --git a/tools/test/h5repack/dynlib_vrpk.c b/tools/test/h5repack/dynlib_vrpk.c
new file mode 100644
index 0000000..8da0270
--- /dev/null
+++ b/tools/test/h5repack/dynlib_vrpk.c
@@ -0,0 +1,104 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * 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 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/*
+ * Purpose: Tests the plugin module (H5PL)
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include "H5PLextern.h"
+
+#define H5Z_FILTER_DYNLIB4 260
+
+#define PUSH_ERR(func, minor, str) H5Epush2(H5E_DEFAULT, __FILE__, func, __LINE__, H5E_ERR_CLS, H5E_PLUGIN, minor, str)
+
+static size_t H5Z_filter_dynlib4(unsigned int flags, size_t cd_nelmts,
+ const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
+
+/* This message derives from H5Z */
+const H5Z_class2_t H5Z_DYNLIB4[1] = {{
+ H5Z_CLASS_T_VERS, /* H5Z_class_t version */
+ H5Z_FILTER_DYNLIB4, /* Filter id number */
+ 1, 1, /* Encoding and decoding enabled */
+ "dynlib4", /* Filter name for debugging */
+ NULL, /* The "can apply" callback */
+ NULL, /* The "set local" callback */
+ (H5Z_func_t)H5Z_filter_dynlib4, /* The actual filter function */
+}};
+
+H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;}
+const void *H5PLget_plugin_info(void) {return H5Z_DYNLIB4;}
+
+/*-------------------------------------------------------------------------
+ * Function: H5Z_filter_dynlib4
+ *
+ * Purpose: A dynlib4 filter method that adds on and subtract from
+ * the original value with another value. It will be built
+ * as a shared library. plugin.c test will load and use
+ * this filter library. Designed to call a HDF function.
+ *
+ * Return: Success: Data chunk size
+ *
+ * Failure: 0
+ *
+ *-------------------------------------------------------------------------
+ */
+static size_t
+H5Z_filter_dynlib4(unsigned int flags, size_t cd_nelmts,
+ const unsigned int *cd_values, size_t nbytes,
+ size_t *buf_size, void **buf)
+{
+ int *int_ptr = (int *)*buf; /* Pointer to the data values */
+ size_t buf_left = *buf_size; /* Amount of data buffer left to process */
+ int add_on = 0;
+ unsigned ver_info[3];
+
+ /* Check for the library version */
+ if(H5get_libversion(&ver_info[0], &ver_info[1], &ver_info[2]) < 0) {
+ PUSH_ERR("dynlib4", H5E_CALLBACK, "H5get_libversion");
+ return(0);
+ }
+ /* Check for the correct number of parameters */
+ if(cd_nelmts == 0)
+ return(0);
+
+ /* Check that permanent parameters are set correctly */
+ if(cd_values[0] > 9)
+ return(0);
+
+ if(ver_info[0] != cd_values[1] || ver_info[1] != cd_values[2]) {
+ PUSH_ERR("dynlib4", H5E_CALLBACK, "H5get_libversion does not match");
+ return(0);
+ }
+
+ add_on = (int)cd_values[0];
+
+ if(flags & H5Z_FLAG_REVERSE) { /*read*/
+ /* Substract the "add on" value to all the data values */
+ while(buf_left > 0) {
+ *int_ptr++ -= add_on;
+ buf_left -= sizeof(int);
+ } /* end while */
+ } /* end if */
+ else { /*write*/
+ /* Add the "add on" value to all the data values */
+ while(buf_left > 0) {
+ *int_ptr++ += add_on;
+ buf_left -= sizeof(int);
+ } /* end while */
+ } /* end else */
+
+ return nbytes;
+} /* end H5Z_filter_dynlib4() */
+
diff --git a/tools/test/h5repack/h5repack.sh.in b/tools/test/h5repack/h5repack.sh.in
new file mode 100644
index 0000000..4d3cae8
--- /dev/null
+++ b/tools/test/h5repack/h5repack.sh.in
@@ -0,0 +1,1265 @@
+#! /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 h5repack tool
+#
+# Modification:
+# Pedro Vicente Nunes, 11/15/2006
+# Added $FILEN variables for file names
+#
+
+srcdir=@srcdir@
+
+USE_FILTER_SZIP="@USE_FILTER_SZIP@"
+USE_FILTER_DEFLATE="@USE_FILTER_DEFLATE@"
+
+TESTNAME=h5repack
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+
+H5REPACK=../../src/h5repack/h5repack # The tool name
+H5REPACK_BIN=`pwd`/$H5REPACK # The path of the tool binary
+
+H5DIFF=../../src/h5diff/h5diff # The h5diff tool name
+H5DIFF_BIN=`pwd`/$H5DIFF # The path of the h5diff tool binary
+
+H5DUMP=../../src/h5dump/h5dump # The h5dump tool name
+H5DUMP_BIN=`pwd`/$H5DUMP # The path of the h5dump tool binary
+
+RM='rm -rf'
+CMP='cmp'
+DIFF='diff -c'
+GREP='grep'
+CP='cp'
+DIRNAME='dirname'
+LS='ls'
+AWK='awk'
+
+H5DETECTSZIP=testh5repack_detect_szip
+H5DETECTSZIP_BIN=`pwd`/$H5DETECTSZIP
+
+
+nerrors=0
+verbose=yes
+
+# 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/test/h5diff/testfiles"
+SRC_H5COPY_TESTFILES="$SRC_TOOLS/test/h5copy/testfiles"
+SRC_H5REPACK_TESTFILES="$SRC_TOOLS/test/h5repack/testfiles"
+SRC_H5JAM_TESTFILES="$SRC_TOOLS/test/h5jam/testfiles"
+SRC_H5STAT_TESTFILES="$SRC_TOOLS/test/h5stat/testfiles"
+SRC_H5IMPORT_TESTFILES="$SRC_TOOLS/test/h5import/testfiles"
+
+TESTDIR=./testpack
+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_H5REPACK_TESTFILES/h5repack_attr.h5
+$SRC_H5REPACK_TESTFILES/h5repack_attr_refs.h5
+$SRC_H5REPACK_TESTFILES/h5repack_deflate.h5
+$SRC_H5REPACK_TESTFILES/h5repack_early.h5
+$SRC_H5REPACK_TESTFILES/h5repack_ext.h5
+$SRC_H5REPACK_TESTFILES/h5repack_fill.h5
+$SRC_H5REPACK_TESTFILES/h5repack_filters.h5
+$SRC_H5REPACK_TESTFILES/h5repack_fletcher.h5
+$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_nested_8bit_enum.h5
+$SRC_H5REPACK_TESTFILES/h5repack_nested_8bit_enum_deflated.h5
+$SRC_H5REPACK_TESTFILES/h5repack_nbit.h5
+$SRC_H5REPACK_TESTFILES/h5repack_objs.h5
+$SRC_H5REPACK_TESTFILES/h5repack_refs.h5
+$SRC_H5REPACK_TESTFILES/h5repack_shuffle.h5
+$SRC_H5REPACK_TESTFILES/h5repack_soffset.h5
+$SRC_H5REPACK_TESTFILES/h5repack_szip.h5
+$SRC_H5DIFF_TESTFILES/h5diff_attr1.h5
+$SRC_TOOLS_TESTFILES/tfamily00000.h5
+$SRC_TOOLS_TESTFILES/tfamily00001.h5
+$SRC_TOOLS_TESTFILES/tfamily00002.h5
+$SRC_TOOLS_TESTFILES/tfamily00003.h5
+$SRC_TOOLS_TESTFILES/tfamily00004.h5
+$SRC_TOOLS_TESTFILES/tfamily00005.h5
+$SRC_TOOLS_TESTFILES/tfamily00006.h5
+$SRC_TOOLS_TESTFILES/tfamily00007.h5
+$SRC_TOOLS_TESTFILES/tfamily00008.h5
+$SRC_TOOLS_TESTFILES/tfamily00009.h5
+$SRC_TOOLS_TESTFILES/tfamily00010.h5
+$SRC_TOOLS_TESTFILES/vds/1_a.h5
+$SRC_TOOLS_TESTFILES/vds/1_b.h5
+$SRC_TOOLS_TESTFILES/vds/1_c.h5
+$SRC_TOOLS_TESTFILES/vds/1_d.h5
+$SRC_TOOLS_TESTFILES/vds/1_e.h5
+$SRC_TOOLS_TESTFILES/vds/1_f.h5
+$SRC_TOOLS_TESTFILES/vds/1_vds.h5
+$SRC_TOOLS_TESTFILES/vds/2_a.h5
+$SRC_TOOLS_TESTFILES/vds/2_b.h5
+$SRC_TOOLS_TESTFILES/vds/2_c.h5
+$SRC_TOOLS_TESTFILES/vds/2_d.h5
+$SRC_TOOLS_TESTFILES/vds/2_e.h5
+$SRC_TOOLS_TESTFILES/vds/2_vds.h5
+$SRC_TOOLS_TESTFILES/vds/3_1_vds.h5
+$SRC_TOOLS_TESTFILES/vds/3_2_vds.h5
+$SRC_TOOLS_TESTFILES/vds/4_0.h5
+$SRC_TOOLS_TESTFILES/vds/4_1.h5
+$SRC_TOOLS_TESTFILES/vds/4_2.h5
+$SRC_TOOLS_TESTFILES/vds/4_vds.h5
+$SRC_TOOLS_TESTFILES/vds/5_a.h5
+$SRC_TOOLS_TESTFILES/vds/5_b.h5
+$SRC_TOOLS_TESTFILES/vds/5_c.h5
+$SRC_TOOLS_TESTFILES/vds/5_vds.h5
+"
+
+LIST_OTHER_TEST_FILES="
+$SRC_H5REPACK_TESTFILES/h5repack-help.txt
+$SRC_H5REPACK_TESTFILES/h5repack_ext.bin
+$SRC_H5REPACK_TESTFILES/ublock.bin
+$SRC_H5REPACK_TESTFILES/h5repack.info
+$SRC_H5REPACK_TESTFILES/deflate_limit.h5repack_layout.h5.ddl
+$SRC_H5REPACK_TESTFILES/h5repack_layout.h5.ddl
+$SRC_H5REPACK_TESTFILES/h5repack_filters.h5-gzip_verbose_filters.tst
+$SRC_H5REPACK_TESTFILES/h5repack_layout.h5-dset2_chunk_20x10-errstk.tst
+$SRC_H5REPACK_TESTFILES/h5repack_layout.h5-plugin_test.ddl
+$SRC_H5REPACK_TESTFILES/plugin_test.h5repack_layout.h5.tst
+$SRC_H5REPACK_TESTFILES/1_vds.h5-vds_dset_chunk20x10x5-v.ddl
+$SRC_H5REPACK_TESTFILES/2_vds.h5-vds_chunk3x6x9-v.ddl
+$SRC_H5REPACK_TESTFILES/3_1_vds.h5-vds_chunk2x5x8-v.ddl
+$SRC_H5REPACK_TESTFILES/4_vds.h5-vds_compa-v.ddl
+$SRC_H5REPACK_TESTFILES/4_vds.h5-vds_conti-v.ddl
+"
+
+#
+# copy test files and expected output files from source dirs to test dir
+#
+COPY_TESTFILES="$LIST_HDF5_TEST_FILES $LIST_OTHER_TEST_FILES"
+
+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
+ # skip cp if srcdir is same as destdir
+ # this occurs when build/test performed in source dir and
+ # make cp fail
+ SDIR=`$DIRNAME $tstfile`
+ INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
+ INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
+ if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
+ $CP -f $tstfile $TESTDIR
+ if [ $? -ne 0 ]; then
+ echo "Error: FAILED to copy $tstfile ."
+
+ # Comment out this to CREATE expected file
+ exit $EXIT_FAILURE
+ fi
+ fi
+ fi
+ done
+}
+
+CLEAN_TESTFILES_AND_TESTDIR()
+{
+ # skip rm if srcdir is same as destdir
+ # this occurs when build/test performed in source dir and
+ # make cp fail
+ SDIR=$SRC_H5REPACK_TESTFILES
+ INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
+ INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
+ if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
+ $RM $TESTDIR
+ fi
+}
+
+# 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() {
+ MESSAGE "Testing $*"
+}
+
+# Print a line-line message left justified in a field of 70 characters
+# beginning with the word "Verifying".
+#
+VERIFY() {
+ MESSAGE "Verifying $*"
+}
+
+# Print a message that a test has been skipped (because a required filter
+# was unavailable)
+SKIP() {
+ TESTING $H5REPACK $@
+ echo " -SKIP-"
+}
+
+# Call the h5diff tool
+#
+DIFFTEST()
+{
+ VERIFY h5diff output $@
+ (
+ cd $TESTDIR
+ $RUNSERIAL $H5DIFF_BIN -q "$@"
+ )
+ RET=$?
+ if [ $RET != 0 ] ; then
+ echo "*FAILED*"
+ nerrors="`expr $nerrors + 1`"
+ else
+ echo " PASSED"
+ fi
+
+}
+
+# Call h5repack
+#
+
+
+# call TOOLTEST_MAIN and delete $output file
+TOOLTEST()
+{
+ echo $@
+ infile=$2
+ outfile=out-$1.$2
+ shift
+ shift
+
+ # Run test.
+ TESTING $H5REPACK $@
+ (
+ cd $TESTDIR
+ $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile
+ )
+ RET=$?
+ if [ $RET != 0 ] ; then
+ echo "*FAILED*"
+ nerrors="`expr $nerrors + 1`"
+ else
+ echo " PASSED"
+ DIFFTEST $infile $outfile
+ fi
+ rm -f $outfile
+}
+
+#------------------------------------------
+# Verifying layouts of a dataset
+VERIFY_LAYOUT_DSET()
+{
+ layoutfile=layout-$1.$2
+ dset=$3
+ expectlayout=$4
+ infile=$2
+ outfile=out-$1.$2
+ shift
+ shift
+ shift
+ shift
+
+ TESTING $H5REPACK $@
+ (
+ cd $TESTDIR
+ $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile
+ )
+ RET=$?
+ if [ $RET != 0 ] ; then
+ echo "*FAILED*"
+ nerrors="`expr $nerrors + 1`"
+ else
+ echo " PASSED"
+ DIFFTEST $infile $outfile
+ fi
+
+ #---------------------------------
+ # check the layout from a dataset
+ VERIFY "a dataset layout"
+ (
+ cd $TESTDIR
+ $RUNSERIAL $H5DUMP_BIN -d $dset -pH $outfile > $layoutfile
+ )
+ $GREP $expectlayout $TESTDIR/$layoutfile > /dev/null
+ if [ $? -eq 0 ]; then
+ echo " PASSED"
+ else
+ echo " FAILED"
+ nerrors="`expr $nerrors + 1`"
+ fi
+
+ # clean up tmp files
+ rm -f $outfile
+ rm -f $layoutfile
+}
+
+#------------------------------------------
+# Verifying layouts of a dataset
+VERIFY_LAYOUT_VDS()
+{
+ layoutfile=layout-$1.$2
+ dset=$3
+ expectlayout=$4
+ infile=$2
+ outfile=out-$1.$2
+
+ expect="$TESTDIR/$2-$1-v.ddl"
+ actual="$TESTDIR/$2-$1-v.out"
+ actual_err="$TESTDIR/$2-$1-v.err"
+
+ shift
+ shift
+ shift
+ shift
+
+ TESTING $H5REPACK $@
+ (
+ cd $TESTDIR
+ $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile
+ )
+ RET=$?
+ if [ $RET != 0 ] ; then
+ echo "*FAILED*"
+ nerrors="`expr $nerrors + 1`"
+ else
+ echo " PASSED"
+ fi
+
+ #---------------------------------
+ # check the layout from a dataset
+ VERIFY "a dataset layout"
+ (
+ cd $TESTDIR
+ $RUNSERIAL $H5DUMP_BIN -d $dset -p $outfile
+ ) >$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 > /dev/null 2>&1 ; then
+ echo " PASSED"
+ else
+ echo "*FAILED*"
+ echo " Expected result (*.ddl) differs from actual result (*.out)"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF $caseless $expect $actual |sed 's/^/ /'
+ fi
+
+ # Clean up output file
+ if test -z "$HDF5_NOCLEANUP"; then
+ rm -f $actual $actual_err
+ fi
+
+ # clean up tmp files
+ rm -f $outfile
+}
+
+#----------------------------------------
+# Verifying layouts from entire file
+VERIFY_LAYOUT_ALL()
+{
+ infile=$2
+ outfile=out-$1.$2
+ layoutfile=layout-$1.$2
+ expectlayout=$3
+ shift
+ shift
+ shift
+
+ TESTING $H5REPACK $@
+ (
+ cd $TESTDIR
+ $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile
+ )
+ RET=$?
+ if [ $RET != 0 ] ; then
+ echo "*FAILED*"
+ nerrors="`expr $nerrors + 1`"
+ else
+ echo " PASSED"
+ DIFFTEST $infile $outfile
+ fi
+
+
+ #---------------------------------
+ # check the layout from a dataset
+ # check if the other layouts still exsit
+ VERIFY "layouts"
+ (
+ cd $TESTDIR
+ echo
+ # if CONTIGUOUS
+ if [ $expectlayout = "CONTIGUOUS" ]; then
+ TESTING $H5DUMP_BIN -pH $outfile
+ (
+ $RUNSERIAL $H5DUMP_BIN -pH $outfile > $layoutfile
+ )
+ $GREP "COMPACT" $layoutfile > /dev/null
+ if [ $? -eq 0 ]; then
+ echo " FAILED"
+ nerrors="`expr $nerrors + 1`"
+ else
+ $GREP "CHUNKED" $layoutfile > /dev/null
+ if [ $? -eq 0 ]; then
+ echo " FAILED"
+ nerrors="`expr $nerrors + 1`"
+ else
+ echo " PASSED"
+ fi
+ fi
+ else
+ # if COMPACT
+ if [ $expectlayout = "COMPACT" ]; then
+ TESTING $H5DUMP_BIN -pH $outfile
+ (
+ $RUNSERIAL $H5DUMP_BIN -pH $outfile > $layoutfile
+ )
+ $GREP "CHUNKED" $layoutfile > /dev/null
+ if [ $? -eq 0 ]; then
+ echo " FAILED"
+ nerrors="`expr $nerrors + 1`"
+ else
+ $GREP "CONTIGUOUS" $layoutfile > /dev/null
+ if [ $? -eq 0 ]; then
+ echo " FAILED"
+ nerrors="`expr $nerrors + 1`"
+ else
+ echo " PASSED"
+ fi
+ fi
+ else
+ # if CHUNKED
+ if [ $expectlayout = "CHUNKED" ]; then
+ TESTING $H5DUMP_BIN -pH $outfile
+ (
+ $RUNSERIAL $H5DUMP_BIN -pH $outfile > $layoutfile
+ )
+ $GREP "CONTIGUOUS" $layoutfile > /dev/null
+ if [ $? -eq 0 ]; then
+ echo " FAILED"
+ nerrors="`expr $nerrors + 1`"
+ else
+ $GREP "COMPACT" $layoutfile > /dev/null
+ if [ $? -eq 0 ]; then
+ echo " FAILED"
+ nerrors="`expr $nerrors + 1`"
+ else
+ echo " PASSED"
+ fi
+ fi
+ fi
+ fi
+ fi
+ )
+
+ # clean up tmp files
+ rm -f $outfile
+ rm -f $layoutfile
+}
+
+# same as TOOLTEST, but it uses the old syntax -i input_file -o output_file
+#
+TOOLTEST0()
+{
+ infile=$2
+ outfile=out-$1.$2
+ shift
+ shift
+
+ # Run test.
+ TESTING $H5REPACK $@
+ (
+ cd $TESTDIR
+ $RUNSERIAL $H5REPACK_BIN -i $infile -o $outfile "$@"
+ )
+ RET=$?
+ if [ $RET != 0 ] ; then
+ echo "*FAILED*"
+ nerrors="`expr $nerrors + 1`"
+ else
+ echo " PASSED"
+ DIFFTEST $infile $outfile
+ fi
+ rm -f $outfile
+}
+
+
+# same as TOOLTEST, but it uses without -i -o options
+# used to test the family driver, where these files reside
+#
+TOOLTEST1()
+{
+ infile=$2
+ outfile=out-$1.$2
+ shift
+ shift
+
+ # Run test.
+ TESTING $H5REPACK $@
+ (
+ cd $TESTDIR
+ $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile
+ )
+ RET=$?
+ if [ $RET != 0 ] ; then
+ echo "*FAILED*"
+ nerrors="`expr $nerrors + 1`"
+ else
+ echo " PASSED"
+ DIFFTEST $infile $outfile
+ fi
+ rm -f $outfile
+}
+
+# This is same as TOOLTEST() with comparing display output
+# from -v option
+#
+TOOLTESTV()
+{
+ expect="$TESTDIR/$2-$1.tst"
+ actual="$TESTDIR/`basename $2 .ddl`.out"
+ actual_err="$TESTDIR/`basename $2 .ddl`.err"
+
+ infile=$2
+ outfile=out-$1.$2
+ shift
+ shift
+
+ # Run test.
+ TESTING $H5REPACK $@
+ (
+ cd $TESTDIR
+ $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile
+ ) >$actual 2>$actual_err
+ 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
+ echo "*FAILED*"
+ echo " Expected result (*.tst) differs from actual result (*.out)"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && diff -c $expect $actual |sed 's/^/ /'
+ fi
+
+ rm -f $actual $actual_err
+ rm -f $outfile
+}
+
+# same as TOOLTESTV but filters error stack output and compares to an error file
+# Extract file name, line number, version and thread IDs because they may be different
+# ADD_H5ERR_MASK_TEST
+TOOLTESTM() {
+
+ expect="$TESTDIR/$2-$1.tst"
+ actual="$TESTDIR/`basename $2 .tst`.out"
+ actual_err="$TESTDIR/`basename $2 .tst`.oerr"
+ actual_sav=${actual}-sav
+ actual_err_sav=${actual_err}-sav
+
+ infile=$2
+ outfile=out-$1.$2
+ shift
+ shift
+
+ # Run test.
+ TESTING $H5REPACK $@
+ (
+ cd $TESTDIR
+ $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile
+ ) >$actual 2>$actual_err
+
+ # save actual and actual_err in case they are needed later.
+ cp $actual $actual_sav
+ cp $actual_err $actual_err_sav
+
+ # 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
+
+ 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 (*.tst) 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
+
+}
+
+# This is same as TOOLTESTV() with comparing h5dump output
+# from -pH option
+#
+TOOLTEST_DUMP()
+{
+ infile=$2
+ outfile=out-$1.$2
+ expect="$TESTDIR/$1.$2.ddl"
+ actual="$TESTDIR/out-$1.$2.out"
+ actual_err="$TESTDIR/out-$1.$2.err"
+
+ shift
+ shift
+
+ # Run test.
+ TESTING $H5REPACK $@
+ (
+ cd $TESTDIR
+ $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile
+ ) >$actual 2>$actual_err
+ RET=$?
+ if [ $RET != 0 ] ; then
+ echo "*FAILED*"
+ nerrors="`expr $nerrors + 1`"
+ else
+ echo " PASSED"
+ VERIFY h5dump output $@
+ (
+ cd $TESTDIR
+ $RUNSERIAL $H5DUMP_BIN -pH $outfile
+ ) >$actual 2>$actual_err
+ cat $actual_err >> $actual
+
+ RET=$?
+
+ fi
+
+ if cmp -s $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 -c $expect $actual |sed 's/^/ /'
+ fi
+
+ 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()
+{
+ infile=$2
+ outfile=out-$1.$2
+ shift
+ shift
+
+ # Run test.
+ TESTING $H5REPACK $@
+ (
+ cd $TESTDIR
+ $RUNSERIAL $H5REPACK_BIN $infile $outfile
+ )
+ RET=$?
+ if [ $RET != 0 ] ; then
+ echo "*FAILED*"
+ nerrors="`expr $nerrors + 1`"
+ else
+ echo " PASSED"
+ DIFFTEST $infile $outfile
+ fi
+ # get the size of the first output file
+ size1=`wc -c $TESTDIR/$outfile | cut -d' ' -f1`
+
+ # 2nd run with metadata option
+ # Run test.
+ TESTING $H5REPACK $@
+ (
+ cd $TESTDIR
+ $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile
+ )
+ RET=$?
+ if [ $RET != 0 ] ; then
+ echo "*FAILED*"
+ nerrors="`expr $nerrors + 1`"
+ else
+ echo " PASSED"
+ DIFFTEST $infile $outfile
+ fi
+ # get the size of the second output file
+ size2=`wc -c $TESTDIR/$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*"
+ nerrors="`expr $nerrors + 1`"
+ fi
+
+ rm -f $outfile
+}
+
+# ADD_HELP_TEST
+TOOLTEST_HELP() {
+
+ expect="$TESTDIR/$1"
+ actual="$TESTDIR/`basename $1 .txt`.out"
+ actual_err="$TESTDIR/`basename $1 .txt`.err"
+ shift
+
+ # Run test.
+ TESTING $H5REPACK $@
+ (
+ cd $TESTDIR
+ $RUNSERIAL $H5REPACK_BIN "$@"
+ ) >$actual 2>$actual_err
+ cat $actual_err >> $actual
+
+ if [ ! -f $expect ]; then
+ # Create the expect data file if it doesn't yet exist.
+ echo " CREATED"
+ cp $actual $expect-CREATED
+ elif cmp -s $expect $actual; then
+ echo " PASSED"
+ else
+ echo "*FAILED*"
+ echo " Expected output (*.txt) differs from actual output (*.out)"
+ nerrors="`expr $nerrors + 1`"
+ fi
+
+ # Clean up output file
+ if test -z "$HDF5_NOCLEANUP"; then
+ rm -f $actual $actual_err
+ fi
+
+}
+
+# This is different from $srcdir/../../../bin/output_filter.sh
+STDOUT_FILTER() {
+ result_file=$1
+ tmp_file=/tmp/h5test_tmp_$$
+ # Filter name of files.
+ cp $result_file $tmp_file
+ sed -e '/^Opening file/d' -e '/^Making file/d' \
+ < $tmp_file > $result_file
+ # cleanup
+ rm -f $tmp_file
+}
+
+#
+# The tests
+# We use the files generated by h5repacktst
+# Each run generates "<file>.out.h5" and the tool h5diff is used to
+# compare the input and output files
+#
+# the tests are the same as the program h5repacktst, but run from the CLI
+#
+
+# See which filters are usable (and skip tests for filters we
+# don't have). Do this by searching H5pubconf.h to see which
+# filters are defined.
+
+# detect whether the encoder is present.
+USE_FILTER_SZIP_ENCODER="no";
+if test $USE_FILTER_SZIP = "yes"; then
+USE_FILTER_SZIP_ENCODER=`$RUNSERIAL $H5DETECTSZIP_BIN`
+fi
+
+##############################################################################
+### T H E T E S T S
+##############################################################################
+# prepare for test
+COPY_TESTFILES_TO_TESTDIR
+
+TOOLTEST_HELP h5repack-help.txt -h
+
+# copy files (these files have no filters)
+TOOLTEST fill h5repack_fill.h5
+TOOLTEST objs h5repack_objs.h5
+TOOLTEST attr h5repack_attr.h5
+TOOLTEST hlink h5repack_hlink.h5
+TOOLTEST layout h5repack_layout.h5
+TOOLTEST early h5repack_early.h5
+
+# nested 8bit enum in both deflated and non-deflated datafiles
+if [ $USE_FILTER_DEFLATE != "yes" ]; then
+TOOLTEST nested_8bit_enum h5repack_nested_8bit_enum.h5
+else
+TOOLTEST nested_8bit_enum h5repack_nested_8bit_enum_deflated.h5
+fi
+
+# use h5repack_layout.h5 to write some filters (this file has no filters)
+
+# gzip with individual object
+arg="h5repack_layout.h5 -f dset1:GZIP=1 -l dset1:CHUNK=20x10"
+if test $USE_FILTER_DEFLATE != "yes" ; then
+ SKIP $arg
+else
+ TOOLTEST gzip_individual $arg
+fi
+
+# gzip for all
+arg="h5repack_layout.h5 -f GZIP=1"
+if test $USE_FILTER_DEFLATE != "yes" ; then
+ SKIP $arg
+else
+ TOOLTEST gzip_all $arg
+fi
+
+# szip with individual object
+arg="h5repack_layout.h5 -f dset2:SZIP=8,EC -l dset2:CHUNK=20x10"
+if test $USE_FILTER_SZIP_ENCODER != "yes" -o $USE_FILTER_SZIP != "yes" ; then
+ SKIP $arg
+else
+ TOOLTEST szip_individual $arg
+fi
+
+# szip for all
+arg="h5repack_layout.h5 -f SZIP=8,NN"
+if test $USE_FILTER_SZIP_ENCODER != "yes" -o $USE_FILTER_SZIP != "yes" ; then
+ SKIP $arg
+else
+ TOOLTEST szip_all $arg
+fi
+
+# shuffle with individual object
+arg="h5repack_layout.h5 -f dset2:SHUF -l dset2:CHUNK=20x10"
+TOOLTEST shuffle_individual $arg
+
+
+# shuffle for all
+arg="h5repack_layout.h5 -f SHUF"
+TOOLTEST shuffle_all $arg
+
+# fletcher32 with individual object
+arg="h5repack_layout.h5 -f dset2:FLET -l dset2:CHUNK=20x10"
+TOOLTEST fletcher_individual $arg
+
+# fletcher32 for all
+arg="h5repack_layout.h5 -f FLET"
+TOOLTEST fletcher_all $arg
+
+# all filters
+arg="h5repack_layout.h5 -f dset2:SHUF -f dset2:FLET -f dset2:SZIP=8,NN -f dset2:GZIP=1 -l dset2:CHUNK=20x10"
+if test $USE_FILTER_SZIP_ENCODER != "yes" -o $USE_FILTER_SZIP != "yes" -o $USE_FILTER_DEFLATE != "yes" ; then
+ SKIP $arg
+else
+ TOOLTEST all_filters $arg
+fi
+
+# verbose gzip with individual object
+arg="h5repack_filters.h5 -v -f /dset_deflate:GZIP=9"
+if test $USE_FILTER_DEFLATE != "yes" ; then
+ SKIP $arg
+else
+ # compare output
+ TOOLTESTV gzip_verbose_filters $arg
+fi
+
+###########################################################
+# the following tests assume the input files have filters
+###########################################################
+
+# szip copy
+arg="h5repack_szip.h5"
+if test $USE_FILTER_SZIP_ENCODER != "yes" -o $USE_FILTER_SZIP != "yes" ; then
+ SKIP $arg
+else
+ TOOLTEST szip_copy $arg
+fi
+
+# szip remove
+arg="h5repack_szip.h5 --filter=dset_szip:NONE"
+if test $USE_FILTER_SZIP_ENCODER != "yes" -o $USE_FILTER_SZIP != "yes" ; then
+ SKIP $arg
+else
+ TOOLTEST szip_remove $arg
+fi
+
+# deflate copy
+arg="h5repack_deflate.h5"
+if test $USE_FILTER_DEFLATE != "yes" ; then
+ SKIP $arg
+else
+ TOOLTEST deflate_copy $arg
+fi
+
+# deflate remove
+arg="h5repack_deflate.h5 -f dset_deflate:NONE"
+if test $USE_FILTER_DEFLATE != "yes" ; then
+ SKIP $arg
+else
+ TOOLTEST deflate_remove $arg
+fi
+
+# shuffle copy
+arg="h5repack_shuffle.h5"
+TOOLTEST shuffle_copy $arg
+
+# shuffle remove
+arg="h5repack_shuffle.h5 -f dset_shuffle:NONE"
+TOOLTEST shuffle_remove $arg
+
+# fletcher32 copy
+arg="h5repack_fletcher.h5"
+TOOLTEST fletcher_copy $arg
+
+# fletcher32 remove
+arg="h5repack_fletcher.h5 -f dset_fletcher32:NONE"
+TOOLTEST fletcher_remove $arg
+
+# nbit copy
+arg="h5repack_nbit.h5"
+TOOLTEST nbit_copy $arg
+
+# nbit remove
+arg="h5repack_nbit.h5 -f dset_nbit:NONE"
+TOOLTEST nbit_remove $arg
+
+# nbit add
+arg="h5repack_nbit.h5 -f dset_int31:NBIT"
+TOOLTEST nbit_add $arg
+
+# scaleoffset copy
+arg="h5repack_soffset.h5"
+TOOLTEST scale_copy $arg
+
+# scaleoffset add
+arg="h5repack_soffset.h5 -f dset_none:SOFF=31,IN"
+TOOLTEST scale_add $arg
+
+# scaleoffset remove
+arg="h5repack_soffset.h5 -f dset_scaleoffset:NONE"
+TOOLTEST scale_remove $arg
+
+# remove all filters
+arg="h5repack_filters.h5 -f NONE"
+if test $USE_FILTER_DEFLATE != "yes" -o $USE_FILTER_SZIP != "yes" -o $USE_FILTER_SZIP_ENCODER != "yes" ; then
+ SKIP $arg
+else
+ TOOLTEST remove_all $arg
+fi
+
+#filter conversions
+
+arg="h5repack_deflate.h5 -f dset_deflate:SZIP=8,NN"
+if test $USE_FILTER_SZIP_ENCODER != "yes" -o $USE_FILTER_SZIP != "yes" -o $USE_FILTER_DEFLATE != "yes" ; then
+ SKIP $arg
+else
+ TOOLTEST deflate_convert $arg
+fi
+
+arg="h5repack_szip.h5 -f dset_szip:GZIP=1"
+if test $USE_FILTER_SZIP != "yes" -o $USE_FILTER_SZIP_ENCODER != "yes" -o $USE_FILTER_DEFLATE != "yes" ; then
+ SKIP $arg
+else
+ TOOLTEST szip_convert $arg
+fi
+
+
+#limit
+arg="h5repack_layout.h5 -f GZIP=1 -m 1024"
+if test $USE_FILTER_DEFLATE != "yes" ; then
+ SKIP $arg
+else
+ TOOLTEST_DUMP deflate_limit $arg
+fi
+
+#file
+arg="h5repack_layout.h5 -e h5repack.info"
+if test $USE_FILTER_DEFLATE != "yes" ; then
+ SKIP $arg
+else
+ TOOLTEST deflate_file $arg
+fi
+
+#########################################################
+# layout options (these files have no filters)
+#########################################################
+VERIFY_LAYOUT_DSET dset2_chunk_20x10 h5repack_layout.h5 dset2 CHUNKED --layout dset2:CHUNK=20x10
+
+VERIFY_LAYOUT_ALL chunk_20x10 h5repack_layout.h5 CHUNKED -l CHUNK=20x10
+
+VERIFY_LAYOUT_DSET dset2_conti h5repack_layout.h5 dset2 CONTIGUOUS -l dset2:CONTI
+
+VERIFY_LAYOUT_ALL conti h5repack_layout.h5 CONTIGUOUS -l CONTI
+
+VERIFY_LAYOUT_DSET dset2_compa h5repack_layout.h5 dset2 COMPACT -l dset2:COMPA
+
+VERIFY_LAYOUT_ALL compa h5repack_layout.h5 COMPACT -l COMPA
+
+TOOLTESTM dset2_chunk_20x10-errstk h5repack_layout.h5 --layout=dset2:CHUNK=20x10x5 --enable-error-stack
+
+################################################################
+# layout conversions (file has no filters)
+###############################################################
+
+VERIFY_LAYOUT_DSET dset_compa_conti h5repack_layout.h5 dset_compact CONTIGUOUS -l dset_compact:CONTI
+
+VERIFY_LAYOUT_DSET dset_compa_chunk h5repack_layout.h5 dset_compact CHUNKED -l dset_compact:CHUNK=2x5
+
+VERIFY_LAYOUT_DSET dset_compa_compa h5repack_layout.h5 dset_compact COMPACT -l dset_compact:COMPA
+
+VERIFY_LAYOUT_DSET dset_conti_compa h5repack_layout.h5 dset_contiguous COMPACT -l dset_contiguous:COMPA
+
+VERIFY_LAYOUT_DSET dset_conti_chunk h5repack_layout.h5 dset_contiguous CHUNKED -l dset_contiguous:CHUNK=3x6
+
+VERIFY_LAYOUT_DSET dset_conti_conti h5repack_layout.h5 dset_contiguous CONTIGUOUS -l dset_contiguous:CONTI
+
+VERIFY_LAYOUT_DSET chunk_compa h5repack_layout.h5 dset_chunk COMPACT -l dset_chunk:COMPA
+
+VERIFY_LAYOUT_DSET chunk_conti h5repack_layout.h5 dset_chunk CONTIGUOUS -l dset_chunk:CONTI
+
+VERIFY_LAYOUT_DSET chunk_18x13 h5repack_layout.h5 dset_chunk CHUNKED -l dset_chunk:CHUNK=18x13
+
+# test convert small size dataset ( < 1k) to compact layout without -m
+VERIFY_LAYOUT_DSET contig_small_compa h5repack_layout2.h5 contig_small COMPACT -l contig_small:COMPA
+
+VERIFY_LAYOUT_DSET contig_small_fixed_compa h5repack_layout2.h5 chunked_small_fixed COMPACT -l chunked_small_fixed:COMPA
+
+#---------------------------------------------------------------------------
+# 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
+VERIFY_LAYOUT_DSET chunk2chunk h5repack_layout3.h5 chunk_unlimit1 CHUNK -l chunk_unlimit1:CHUNK=100x300
+
+# chunk to contiguous
+VERIFY_LAYOUT_DSET chunk2conti h5repack_layout3.h5 chunk_unlimit1 CONTI -l chunk_unlimit1:CONTI
+
+# chunk to compact - convert big dataset (should be > 64k) for this purpose,
+# should remain as original layout (chunk)
+VERIFY_LAYOUT_DSET chunk2compa h5repack_layout3.h5 chunk_unlimit1 CHUNK -l chunk_unlimit1:COMPA
+
+#--------------------------------------------------------------------------
+# Test -f for some specific cases. Chunked dataset with unlimited max dims.
+# (HDFFV-8012)
+#--------------------------------------------------------------------------
+# - should not fail
+# - should not change max dims from unlimit
+
+# chunk dim is bigger than dataset dim. ( dset size < 64k )
+VERIFY_LAYOUT_DSET error1 h5repack_layout3.h5 chunk_unlimit1 H5S_UNLIMITED -f chunk_unlimit1:NONE
+# chunk dim is bigger than dataset dim. ( dset size > 64k )
+VERIFY_LAYOUT_DSET error2 h5repack_layout3.h5 chunk_unlimit2 H5S_UNLIMITED -f chunk_unlimit2:NONE
+
+# chunk dims are smaller than dataset dims. ( dset size < 64k )
+#TOOLTEST_MAIN h5repack_layout3.h5 -f chunk_unlimit3:NONE
+VERIFY_LAYOUT_DSET error3 h5repack_layout3.h5 chunk_unlimit3 H5S_UNLIMITED -f chunk_unlimit3:NONE
+
+# file input - should not fail
+TOOLTEST error4 h5repack_layout3.h5 -f NONE
+
+#--------------------------------------------------------------------------
+# Test base: Convert CHUNK to CONTI for a chunked dataset with small dataset
+# (dset size < 64K) and with unlimited max dims on a condition as follow.
+# (HDFFV-8214)
+#--------------------------------------------------------------------------
+
+# chunk dim is bigger than dataset dim. should succeed.
+VERIFY_LAYOUT_DSET ckdim_biger h5repack_layout3.h5 chunk_unlimit2 CONTI -l chunk_unlimit2:CONTI
+# chunk dim is smaller than dataset dim. should succeed.
+VERIFY_LAYOUT_DSET ckdim_smaller h5repack_layout3.h5 chunk_unlimit3 CONTI -l chunk_unlimit3:CONTI
+
+
+# Native option
+# Do not use FILE1, as the named dtype will be converted to native, and h5diff will
+# report a difference.
+TOOLTEST native_fill h5repack_fill.h5 -n
+TOOLTEST native_attr h5repack_attr.h5 -n
+
+
+# latest file format with long switches. use FILE4=h5repack_layout.h5 (no filters)
+arg="h5repack_layout.h5 --layout CHUNK=20x10 --filter GZIP=1 --minimum=10 --native --latest --compact=8 --indexed=6 --ssize=8[:dtype]"
+if test $USE_FILTER_DEFLATE != "yes" ; then
+ SKIP $arg
+else
+ VERIFY_LAYOUT_ALL layout_long_switches h5repack_layout.h5 CHUNKED --layout CHUNK=20x10 --filter GZIP=1 --minimum=10 --native --latest --compact=8 --indexed=6 --ssize=8[:dtype]
+fi
+
+# latest file format with short switches. use FILE4=h5repack_layout.h5 (no filters)
+arg="h5repack_layout.h5 -l CHUNK=20x10 -f GZIP=1 -m 10 -n -L -c 8 -d 6 -s 8[:dtype]"
+if test $USE_FILTER_DEFLATE != "yes" ; then
+ SKIP $arg
+else
+ VERIFY_LAYOUT_ALL layout_short_switches h5repack_layout.h5 CHUNKED -l CHUNK=20x10 -f GZIP=1 -m 10 -n -L -c 8 -d 6 -s 8[:dtype]
+fi
+
+# several global filters
+
+arg="h5repack_layout.h5 --filter GZIP=1 --filter SHUF"
+if test $USE_FILTER_DEFLATE != "yes" ; then
+ SKIP $arg
+else
+ TOOLTEST global_filters $arg
+fi
+
+# syntax of -i infile -o outfile
+# latest file format with short switches. use FILE4=h5repack_layout.h5 (no filters)
+arg="h5repack_layout.h5 -l CHUNK=20x10 -f GZIP=1 -m 10 -n -L -c 8 -d 6 -s 8[:dtype]"
+if test $USE_FILTER_DEFLATE != "yes" ; then
+ SKIP $arg
+else
+ TOOLTEST0 old_style_layout_short_switches $arg
+fi
+
+# add a userblock to file
+arg="h5repack_objs.h5 -u ublock.bin -b 2048"
+TOOLTEST add_userblock $arg
+
+# add alignment
+arg="h5repack_objs.h5 -t 1 -a 1 "
+TOOLTEST add_alignment $arg
+
+# Check repacking file with old version of layout message (should get upgraded
+# to new version and be readable, etc.)
+TOOLTEST upgrade_layout h5repack_layouto.h5
+
+# test for datum size > H5TOOLS_MALLOCSIZE
+TOOLTEST gt_mallocsize h5repack_objs.h5 -f GZIP=1
+
+# Check repacking file with committed datatypes in odd configurations
+TOOLTEST committed_dt h5repack_named_dtypes.h5
+
+# tests family driver (file is located in common testfiles folder, uses TOOLTEST1
+TOOLTEST1 family tfamily%05d.h5
+
+# test various references (bug 1814 and 1726)
+TOOLTEST bug1814 h5repack_refs.h5
+
+# test attribute with various references (bug1797 / HDFFV-5932)
+# the references in attribute of compund or vlen datatype
+TOOLTEST HDFFV-5932 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
+# (HDFFV-7840, )
+# Note: this test is experimental for sharing test file among tools
+TOOLTEST HDFFV-7840 h5diff_attr1.h5
+
+# tests for metadata block size option
+TOOLTEST_META meta_short h5repack_layout.h5 -M 8192
+TOOLTEST_META meta_long h5repack_layout.h5 --metadata_block_size=8192
+
+# VDS tests
+
+################################################################
+# layout conversions
+###############################################################
+if test $USE_FILTER_DEFLATE != "yes" ; then
+ SKIP vds_dset_chunk_20x10x5
+else
+ VERIFY_LAYOUT_VDS vds_dset_chunk_20x10x5 1_vds.h5 vds_dset CHUNKED --layout vds_dset:CHUNK=20x10x5
+fi
+
+if test $USE_FILTER_DEFLATE != "yes" ; then
+ SKIP vds_chunk2x5x8
+else
+ VERIFY_LAYOUT_VDS vds_chunk2x5x8 3_1_vds.h5 vds_dset CHUNKED -l vds_dset:CHUNK=2x5x8
+fi
+
+if test $USE_FILTER_DEFLATE != "yes" ; then
+ SKIP vds_chunk3x6x9
+else
+ VERIFY_LAYOUT_VDS vds_chunk3x6x9 2_vds.h5 vds_dset CHUNKED -l vds_dset:CHUNK=3x6x9
+fi
+
+if test $USE_FILTER_DEFLATE != "yes" ; then
+ SKIP vds_compa 4_vds.h5
+else
+ VERIFY_LAYOUT_VDS vds_compa 4_vds.h5 vds_dset COMPACT -l vds_dset:COMPA
+fi
+
+if test $USE_FILTER_DEFLATE != "yes" ; then
+ SKIP vds_conti 4_vds.h5
+else
+ VERIFY_LAYOUT_VDS vds_conti 4_vds.h5 vds_dset CONTIGUOUS -l vds_dset:CONTI
+fi
+
+# Clean up temporary files/directories
+CLEAN_TESTFILES_AND_TESTDIR
+
+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/test/h5repack/h5repack_plugin.sh.in b/tools/test/h5repack/h5repack_plugin.sh.in
new file mode 100644
index 0000000..c7a9a6b
--- /dev/null
+++ b/tools/test/h5repack/h5repack_plugin.sh.in
@@ -0,0 +1,275 @@
+#! /bin/sh
+#
+# Copyright by The HDF Group.
+# 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 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.
+#
+srcdir=@srcdir@
+TOP_BUILDDIR=@top_builddir@
+
+# Determine backward compatibility options enabled
+DEPRECATED_SYMBOLS="@DEPRECATED_SYMBOLS@"
+
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+
+H5REPACK=../../src/h5repack/h5repack # The tool name
+H5REPACK_BIN=`pwd`/$H5REPACK # The path of the tool binary
+
+H5DUMP=../../src/h5dump/h5dump # The h5dump tool name
+H5DUMP_BIN=`pwd`/$H5DUMP # The path of the h5dump tool binary
+
+nerrors=0
+verbose=yes
+exit_code=$EXIT_SUCCESS
+
+TEST_NAME=ud_plugin
+FROM_DIR=`pwd`/.libs
+PLUGIN_LIB="$FROM_DIR/libdynlibadd.*"
+PLUGIN_LIB2="$FROM_DIR/libdynlibvers.*"
+PLUGIN_LIBDIR=testdir3
+RM='rm -rf'
+
+GREP='grep'
+CP='cp'
+DIRNAME='dirname'
+LS='ls'
+AWK='awk'
+
+# source dirs
+SRC_TOOLS="$srcdir/../.."
+
+# testfiles source dirs for tools
+SRC_H5REPACK_TESTFILES="$SRC_TOOLS/test/h5repack/testfiles"
+
+TESTDIR=testplug
+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_H5REPACK_TESTFILES/h5repack_layout.h5
+$SRC_H5REPACK_TESTFILES/h5repack_layout.h5-plugin_test.ddl
+$SRC_H5REPACK_TESTFILES/plugin_test.h5repack_layout.h5.tst
+$SRC_H5REPACK_TESTFILES/h5repack_layout.h5-plugin_version_test.ddl
+$SRC_H5REPACK_TESTFILES/plugin_version_test.h5repack_layout.h5.tst
+"
+#$SRC_H5REPACK_TESTFILES/h5repack_layout.UD.h5
+#$SRC_H5REPACK_TESTFILES/h5repack_layout.UD.h5-plugin_none.ddl
+#$SRC_H5REPACK_TESTFILES/plugin_none.h5repack_layout.UD.h5.tst
+#"
+
+#
+# copy test files and expected output files from source dirs to test dir
+#
+COPY_TESTFILES="$LIST_HDF5_TEST_FILES"
+
+# Main Body
+# Create test directories if not exists yet.
+test -d $PLUGIN_LIBDIR || mkdir -p $PLUGIN_LIBDIR
+if [ $? != 0 ]; then
+ echo "Failed to create test directory($PLUGIN_LIBDIR)"
+ exit $EXIT_FAILURE
+fi
+
+# copy plugin library for test
+$CP $PLUGIN_LIB $PLUGIN_LIBDIR
+if [ $? != 0 ]; then
+ echo "Failed to copy plugin library ($PLUGIN_LIB) for test."
+ exit $EXIT_FAILURE
+fi
+$CP $PLUGIN_LIB2 $PLUGIN_LIBDIR
+if [ $? != 0 ]; then
+ echo "Failed to copy plugin library ($PLUGIN_LIB2) for test."
+ exit $EXIT_FAILURE
+fi
+
+# setup plugin path
+ENVCMD="env HDF5_PLUGIN_PATH=../${PLUGIN_LIBDIR}"
+
+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
+ # skip cp if srcdir is same as destdir
+ # this occurs when build/test performed in source dir and
+ # make cp fail
+ SDIR=`$DIRNAME $tstfile`
+ INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
+ INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
+ if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
+ $CP -f $tstfile $TESTDIR
+ if [ $? -ne 0 ]; then
+ echo "Error: FAILED to copy $tstfile ."
+
+ # Comment out this to CREATE expected file
+ exit $EXIT_FAILURE
+ fi
+ fi
+ fi
+ done
+}
+
+CLEAN_TESTFILES_AND_TESTDIR()
+{
+ # skip rm if srcdir is same as destdir
+ # this occurs when build/test performed in source dir and
+ # make cp fail
+ SDIR=$SRC_H5REPACK_TESTFILES
+ INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
+ INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
+ if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
+ $RM $TESTDIR
+ fi
+}
+
+# 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'
+}
+
+# Print a line-line message left justified in a field of 70 characters
+# beginning with the word "Verifying".
+#
+VERIFY() {
+ MESSAGE "Verifying $*"
+}
+
+# This is different from $srcdir/../../../bin/output_filter.sh
+STDOUT_FILTER() {
+ result_file=$1
+ tmp_file=/tmp/h5test_tmp_$$
+ # Filter name of files.
+ cp $result_file $tmp_file
+ sed -e '/^Opening file/d' -e '/^Making file/d' \
+ < $tmp_file > $result_file
+ # cleanup
+ rm -f $tmp_file
+}
+
+# This runs h5repack comparing output with h5dump output
+# from -pH option
+#
+TOOLTEST_DUMP()
+{
+ echo $@
+ infile=$2
+ outfile=out-$1.$2
+ expect1="$TESTDIR/$1.$2.tst"
+ actual1="$TESTDIR/$1.$2.out"
+ actual1_err="$TESTDIR/$1.$2.err"
+ expect2="$TESTDIR/$2-$1.ddl"
+ actual2="$TESTDIR/$2-$1.out"
+ actual2_err="$TESTDIR/$2-$1.err"
+
+ shift
+ shift
+
+ # Run test.
+ TESTING $H5REPACK $@
+ (
+ cd $TESTDIR
+ $ENVCMD $H5REPACK_BIN "$@" $infile $outfile
+ ) >$actual1 2>$actual1_err
+ RET=$?
+ STDOUT_FILTER $actual1
+ cat $actual1_err >> $actual1
+ if [ $RET != 0 ] ; then
+ echo "*FAILED*"
+ nerrors="`expr $nerrors + 1`"
+ else
+ echo " PASSED"
+ if cmp -s $expect1 $actual1; then
+ echo " PASSED"
+ else
+ echo "*FAILED*"
+ echo " Expected result (*.tst) differs from actual result (*.out)"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && diff -c $expect1 $actual1 |sed 's/^/ /'
+ fi
+ VERIFY h5dump output -pH $outfile
+ (
+ cd $TESTDIR
+ $ENVCMD $H5DUMP_BIN -pH $outfile
+ ) >$actual2 2>$actual2_err
+ RET=$?
+ cat $actual2_err >> $actual2
+
+ if cmp -s $expect2 $actual2; then
+ echo " PASSED"
+ else
+ echo "*FAILED*"
+ echo " Expected result (*.ddl) differs from actual result (*.out)"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && diff -c $expect2 $actual2 |sed 's/^/ /'
+ fi
+
+ fi
+
+
+ rm -f $actual1 $actual1_err $actual2 $actual2_err
+ rm -f $outfile
+}
+
+##############################################################################
+### T H E T E S T S
+##############################################################################
+# prepare for test
+COPY_TESTFILES_TO_TESTDIR
+
+# Run the test
+arg="h5repack_layout.h5 -v -f UD=260,4,9,1,9,235"
+TOOLTEST_DUMP plugin_version_test $arg
+
+arg="h5repack_layout.h5 -v -f UD=257,1,9"
+TOOLTEST_DUMP plugin_test $arg
+
+#arg="h5repack_layout.UD.h5 -v -f NONE"
+#TOOLTEST_DUMP plugin_none $arg
+
+# print results
+if test $nerrors -ne 0 ; then
+ echo "$nerrors errors encountered"
+ exit_code=$EXIT_FAILURE
+else
+ echo "All Plugin API tests passed."
+ exit_code=$EXIT_SUCCESS
+fi
+
+# Clean up temporary files/directories
+CLEAN_TESTFILES_AND_TESTDIR
+
+# Clean up temporary files/directories and leave
+$RM $PLUGIN_LIBDIR
+
+exit $exit_code
diff --git a/tools/test/h5repack/h5repacktst.c b/tools/test/h5repack/h5repacktst.c
new file mode 100644
index 0000000..82b45fc
--- /dev/null
+++ b/tools/test/h5repack/h5repacktst.c
@@ -0,0 +1,6856 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+* 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. *
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include "h5repack.h"
+#include "h5test.h"
+#include "h5diff.h"
+#include "h5tools.h"
+#include "h5tools_utils.h"
+
+#define GOERROR {H5_FAILED(); goto error;}
+
+
+/* fill value test */
+#define FNAME0 "h5repack_fill.h5"
+#define FNAME0OUT "h5repack_fill_out.h5"
+/* HDF5 objects and all dataset datatypes */
+#define FNAME1 "h5repack_objs.h5"
+#define FNAME1OUT "h5repack_objs_out.h5"
+/* attributes, all datatypes */
+#define FNAME2 "h5repack_attr.h5"
+#define FNAME2OUT "h5repack_attr_out.h5"
+/* hard links */
+#define FNAME3 "h5repack_hlink.h5"
+#define FNAME3OUT "h5repack_hlink_out.h5"
+/* layout */
+#define FNAME4 "h5repack_layout.h5"
+#define FNAME4OUT "h5repack_layout_out.h5"
+/* H5D_ALLOC_TIME_EARLY */
+#define FNAME5 "h5repack_early.h5"
+#define FNAME5OUT "h5repack_early_out.h5"
+#define FNAME6 "h5repack_early2.h5"
+#ifdef H5_HAVE_FILTER_SZIP
+/* SZIP filter */
+#define FNAME7 "h5repack_szip.h5"
+#define FNAME7OUT "h5repack_szip_out.h5"
+#endif
+/* GZIP filter */
+#define FNAME8 "h5repack_deflate.h5"
+#define FNAME8OUT "h5repack_deflate_out.h5"
+/* GZIP filter */
+#define FNAME9 "h5repack_shuffle.h5"
+#define FNAME9OUT "h5repack_shuffle_out.h5"
+/* Fletcher filter */
+#define FNAME10 "h5repack_fletcher.h5"
+#define FNAME10OUT "h5repack_fletcher_out.h5"
+/* All filters */
+#define FNAME11 "h5repack_filters.h5"
+#define FNAME11OUT "h5repack_filters_out.h5"
+/* NBit filter */
+#define FNAME12 "h5repack_nbit.h5"
+#define FNAME12OUT "h5repack_nbit_out.h5"
+/* Scale Offset filter */
+#define FNAME13 "h5repack_soffset.h5"
+#define FNAME13OUT "h5repack_soffset_out.h5"
+/* Big file to test read by hyperslabs */
+#define FNAME14 "h5repack_big.h5"
+#define FNAME14OUT "h5repack_big_out.h5"
+/* external file */
+#define FNAME15 "h5repack_ext.h5"
+#define FNAME15OUT "h5repack_ext_out.h5"
+/* File w/userblock */
+#define FNAME16 "h5repack_ub.h5"
+#define FNAME16OUT "h5repack_ub_out.h5"
+/* Named datatypes */
+#define FNAME17 "h5repack_named_dtypes.h5"
+#define FNAME17OUT "h5repack_named_dtypes_out.h5"
+
+#define FNAME18 "h5repack_layout2.h5"
+
+#define FNAME_UB "ublock.bin"
+
+/* obj and region references */
+#define FNAME_REF "h5repack_refs.h5"
+
+/* obj and region references in attr of compound and vlen type */
+#define FNAME_ATTR_REF "h5repack_attr_refs.h5"
+
+const char *H5REPACK_FILENAMES[] = {
+ "h5repack_big_out",
+ NULL
+};
+
+#define H5REPACK_EXTFILE "h5repack_ext.bin"
+
+/* Name of tool */
+#define PROGRAMNAME "h5repacktst"
+
+
+#define DIM1 40
+#define DIM2 20
+#define CDIM1 DIM1/2
+#define CDIM2 DIM2/2
+#define RANK 2
+
+/* Size of userblock (for userblock test) */
+#define USERBLOCK_SIZE 2048
+
+/* obj and region references */
+#define NAME_OBJ_DS1 "Dset1"
+#define NAME_OBJ_GRP "Group"
+#define NAME_OBJ_NDTYPE "NamedDatatype"
+#define NAME_OBJ_DS2 "Dset2"
+#define REG_REF_DS1 "Dset_REGREF"
+
+/*-------------------------------------------------------------------------
+* prototypes
+*-------------------------------------------------------------------------
+*/
+static int make_all_objects(hid_t loc_id);
+static int make_attributes(hid_t loc_id);
+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 */
+static int make_deflate(hid_t loc_id);
+static int make_shuffle(hid_t loc_id);
+static int make_fletcher32(hid_t loc_id);
+static int make_nbit(hid_t loc_id);
+static int make_scaleoffset(hid_t loc_id);
+static int make_all_filters(hid_t loc_id);
+static int make_fill(hid_t loc_id);
+static int make_big(hid_t loc_id);
+static int make_testfiles(void);
+static int write_dset_in(hid_t loc_id,const char* dset_name,hid_t file_id,int make_diffs );
+static int write_attr_in(hid_t loc_id,const char* dset_name,hid_t fid,int make_diffs );
+static int write_dset(hid_t loc_id,int rank,hsize_t *dims,const char *dset_name,hid_t tid,void *buf );
+static int make_dset(hid_t loc_id,const char *name,hid_t sid,hid_t dcpl,void *buf);
+static int make_attr(hid_t loc_id,int rank,hsize_t *dims,const char *attr_name,hid_t tid,void *buf);
+static int make_dset_reg_ref(hid_t loc_id);
+static int make_external(hid_t loc_id);
+static int make_userblock(void);
+static int verify_userblock( const char* filename);
+static int make_userblock_file(void);
+static int make_named_dtype(hid_t loc_id);
+static int make_references(hid_t loc_id);
+static int make_complex_attr_references(hid_t loc_id);
+
+
+/*-------------------------------------------------------------------------
+* Function: main
+*
+* Purpose: Executes h5repack tests
+*
+* Return: Success: zero
+* Failure: 1
+*
+* Programmer: Pedro Vicente <pvn@ncsa.uiuc.edu>
+* January, 6, 2004
+*
+*-------------------------------------------------------------------------
+*/
+
+int main (void)
+{
+ pack_opt_t pack_options;
+ 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
+
+ h5tools_setprogname(PROGRAMNAME);
+ h5tools_setstatus(EXIT_SUCCESS);
+
+ /* Initialize h5tools lib */
+ h5tools_init();
+
+ /* initialize */
+ HDmemset(&diff_options, 0, sizeof (diff_opt_t));
+ HDmemset(&pack_options, 0, sizeof (pack_opt_t));
+
+ /* run tests */
+ puts("Testing h5repack:");
+
+ /* make the test files */
+ TESTING(" generating datasets");
+ if (make_testfiles() < 0)
+ GOERROR;
+ PASSED();
+
+ /*-------------------------------------------------------------------------
+ * Format of the tests:
+ *
+ * 1) make a copy of the file with h5repack
+ * 2) use the h5diff function to compare the input and output file
+ *-------------------------------------------------------------------------
+ */
+
+
+ /*-------------------------------------------------------------------------
+ * file with fill values
+ *-------------------------------------------------------------------------
+ */
+
+ TESTING(" copy of datasets (fill values)");
+
+ /* fs_type = 0; fs_size = 0 */
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
+ GOERROR;
+ if (h5repack(FNAME0,FNAME0OUT,&pack_options) < 0)
+ GOERROR;
+ if (h5diff(FNAME0,FNAME0OUT,NULL,NULL,&diff_options) >0)
+ GOERROR;
+ if (h5repack_verify(FNAME0, FNAME0OUT,&pack_options)<=0)
+ GOERROR;
+ if (h5repack_cmp_pl(FNAME0,FNAME0OUT)<=0)
+ GOERROR;
+ if (h5repack_end (&pack_options) < 0)
+ GOERROR;
+ PASSED();
+
+
+ /*-------------------------------------------------------------------------
+ * file with all kinds of dataset datatypes
+ *-------------------------------------------------------------------------
+ */
+ TESTING(" copy of datasets (all datatypes)");
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
+ GOERROR;
+ if (h5repack(FNAME1,FNAME1OUT,&pack_options) < 0)
+ GOERROR;
+ if (h5diff(FNAME1,FNAME1OUT,NULL,NULL,&diff_options) >0)
+ GOERROR;
+ if (h5repack_verify(FNAME1, FNAME1OUT,&pack_options)<=0)
+ GOERROR;
+ if (h5repack_cmp_pl(FNAME1,FNAME1OUT)<=0)
+ GOERROR;
+ if (h5repack_end (&pack_options) < 0)
+ GOERROR;
+ PASSED();
+
+
+ /*-------------------------------------------------------------------------
+ * file with attributes
+ *-------------------------------------------------------------------------
+ */
+ TESTING(" copy of datasets (attributes)");
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
+ GOERROR;
+ if (h5repack(FNAME2,FNAME2OUT,&pack_options) < 0)
+ GOERROR;
+ if (h5diff(FNAME2,FNAME2OUT,NULL,NULL,&diff_options) >0)
+ GOERROR;
+ if (h5repack_verify(FNAME2, FNAME2OUT,&pack_options)<=0)
+ GOERROR;
+ if (h5repack_cmp_pl(FNAME2,FNAME2OUT)<=0)
+ GOERROR;
+ if (h5repack_end (&pack_options) < 0)
+ GOERROR;
+ PASSED();
+
+ /*-------------------------------------------------------------------------
+ * file with hardlinks
+ *-------------------------------------------------------------------------
+ */
+ TESTING(" copy of datasets (hardlinks)");
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
+ GOERROR;
+ if (h5repack(FNAME3,FNAME3OUT,&pack_options) < 0)
+ GOERROR;
+ if (h5diff(FNAME3,FNAME3OUT,NULL,NULL,&diff_options) >0)
+ GOERROR;
+ if (h5repack_verify(FNAME3, FNAME3OUT,&pack_options)<=0)
+ GOERROR;
+ if (h5repack_cmp_pl(FNAME3,FNAME3OUT)<=0)
+ GOERROR;
+ if (h5repack_end (&pack_options) < 0)
+ GOERROR;
+
+ PASSED();
+
+ /*-------------------------------------------------------------------------
+ * alloc early test
+ *-------------------------------------------------------------------------
+ */
+ TESTING(" copy of allocation early file");
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
+ GOERROR;
+ if (h5repack(FNAME5,FNAME5OUT,&pack_options) < 0)
+ GOERROR;
+ if (h5diff(FNAME5,FNAME5OUT,NULL,NULL,&diff_options) >0)
+ GOERROR;
+ if (h5repack_verify(FNAME5, FNAME5OUT, &pack_options)<=0)
+ GOERROR;
+ if (h5repack_end (&pack_options) < 0)
+ GOERROR;
+ PASSED();
+
+ /*-------------------------------------------------------------------------
+ * the remaining files differ in the dcpl's
+ *-------------------------------------------------------------------------
+ */
+
+ /*-------------------------------------------------------------------------
+ * deflate
+ *-------------------------------------------------------------------------
+ */
+ TESTING(" adding deflate filter (old_format)");
+
+#ifdef H5_HAVE_FILTER_DEFLATE
+
+ /*-------------------------------------------------------------------------
+ * test an individual object option
+ *-------------------------------------------------------------------------
+ */
+
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
+ GOERROR;
+ if (h5repack_addfilter("dset1:GZIP=9",&pack_options) < 0)
+ GOERROR;
+ if (h5repack_addlayout("dset1:CHUNK=20x10",&pack_options) < 0)
+ GOERROR;
+ 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;
+ if (h5repack_end (&pack_options) < 0)
+ GOERROR;
+ PASSED();
+#else
+ SKIPPED();
+#endif
+
+ TESTING(" adding deflate filter (new format)");
+#ifdef H5_HAVE_FILTER_DEFLATE
+ /*-------------------------------------------------------------------------
+ * test an individual object option
+ * For new format, "dset1" should be using Fixed Array indexing
+ *-------------------------------------------------------------------------
+ */
+
+ if (h5repack_init (&pack_options, 0, TRUE, fs_type, fs_size) < 0)
+ GOERROR;
+ if (h5repack_addfilter("dset1:GZIP=9",&pack_options) < 0)
+ GOERROR;
+ if (h5repack_addlayout("dset1:CHUNK=20x10",&pack_options) < 0)
+ GOERROR;
+ 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;
+ if (h5repack_end (&pack_options) < 0)
+ GOERROR;
+ PASSED();
+#else
+ SKIPPED();
+#endif
+
+ /*-------------------------------------------------------------------------
+ * test all objects option
+ *-------------------------------------------------------------------------
+ */
+
+ TESTING(" adding deflate filter to all");
+
+#ifdef H5_HAVE_FILTER_DEFLATE
+
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
+ GOERROR;
+ if (h5repack_addfilter("GZIP=1",&pack_options) < 0)
+ GOERROR;
+ if (h5repack_addlayout("CHUNK=20x10",&pack_options) < 0)
+ GOERROR;
+ 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;
+ if (h5repack_end (&pack_options) < 0)
+ GOERROR;
+
+ PASSED();
+#else
+ SKIPPED();
+#endif
+
+ /*-------------------------------------------------------------------------
+ * SZIP
+ *-------------------------------------------------------------------------
+ */
+
+ TESTING(" adding szip filter");
+
+#if defined (H5_HAVE_FILTER_SZIP)
+ if (h5tools_can_encode(H5Z_FILTER_SZIP) >0) {
+ szip_can_encode = 1;
+ }
+
+ /*-------------------------------------------------------------------------
+ * test an individual object option
+ *-------------------------------------------------------------------------
+ */
+
+ if (szip_can_encode) {
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
+ GOERROR;
+ if (h5repack_addfilter("dset2:SZIP=8,EC",&pack_options) < 0)
+ GOERROR;
+ if (h5repack_addlayout("dset2:CHUNK=20x10",&pack_options) < 0)
+ GOERROR;
+ 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;
+ if (h5repack_end (&pack_options) < 0)
+ GOERROR;
+
+ PASSED();
+ } else {
+ SKIPPED();
+ }
+#else
+ SKIPPED();
+#endif
+
+
+ /*-------------------------------------------------------------------------
+ * test all objects option
+ *-------------------------------------------------------------------------
+ */
+ TESTING(" adding szip filter to all");
+
+#if defined (H5_HAVE_FILTER_SZIP)
+ if (szip_can_encode) {
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
+ GOERROR;
+ if (h5repack_addfilter("SZIP=8,NN",&pack_options) < 0)
+ GOERROR;
+ 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;
+ if (h5repack_end (&pack_options) < 0)
+ GOERROR;
+
+ PASSED();
+ } else {
+ SKIPPED();
+ }
+#else
+ SKIPPED();
+#endif
+
+
+ TESTING(" addding shuffle filter");
+
+ /*-------------------------------------------------------------------------
+ * test an individual object option
+ *-------------------------------------------------------------------------
+ */
+
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
+ GOERROR;
+ if (h5repack_addfilter("dset1:SHUF",&pack_options) < 0)
+ GOERROR;
+ if (h5repack_addlayout("dset1:CHUNK=20x10",&pack_options) < 0)
+ GOERROR;
+ 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;
+ if (h5repack_end (&pack_options) < 0)
+ GOERROR;
+
+ PASSED();
+
+ /*-------------------------------------------------------------------------
+ * test all objects option
+ *-------------------------------------------------------------------------
+ */
+
+ TESTING(" addding shuffle filter to all");
+
+ /* fs_type = H5F_FILE_SPACE_ALL_PERSIST; fs_size = 1 */
+ if (h5repack_init (&pack_options, 0, FALSE, H5_INC_ENUM(H5F_file_space_type_t, fs_type), ++fs_size) < 0)
+ GOERROR;
+ if (h5repack_addfilter("SHUF",&pack_options) < 0)
+ GOERROR;
+ if (h5repack_addlayout("CHUNK=20x10",&pack_options) < 0)
+ GOERROR;
+ 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;
+ if (h5repack_end (&pack_options) < 0)
+ GOERROR;
+
+ PASSED();
+
+
+ TESTING(" adding checksum filter");
+
+ /*-------------------------------------------------------------------------
+ * test an individual object option
+ *-------------------------------------------------------------------------
+ */
+
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
+ GOERROR;
+ if (h5repack_addfilter("dset1:FLET",&pack_options) < 0)
+ GOERROR;
+ if (h5repack_addlayout("dset1:CHUNK=20x10",&pack_options) < 0)
+ GOERROR;
+ 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;
+ if (h5repack_end (&pack_options) < 0)
+ GOERROR;
+
+ PASSED();
+
+ /*-------------------------------------------------------------------------
+ * test all objects option
+ *-------------------------------------------------------------------------
+ */
+
+
+ TESTING(" adding checksum filter to all");
+
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
+ GOERROR;
+ if (h5repack_addfilter("FLET",&pack_options) < 0)
+ GOERROR;
+ if (h5repack_addlayout("CHUNK=20x10",&pack_options) < 0)
+ GOERROR;
+ 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;
+ if (h5repack_end (&pack_options) < 0)
+ GOERROR;
+
+ PASSED();
+
+
+ TESTING(" filter queue fletcher, shuffle, deflate, szip");
+
+ /*-------------------------------------------------------------------------
+ * add some filters
+ *-------------------------------------------------------------------------
+ */
+
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
+ GOERROR;
+ if (h5repack_addlayout("dset1:CHUNK 20x10",&pack_options) < 0)
+ GOERROR;
+ if (h5repack_addfilter("dset1:FLET",&pack_options) < 0)
+ GOERROR;
+ if (h5repack_addfilter("dset1:SHUF",&pack_options) < 0)
+ GOERROR;
+
+#if defined (H5_HAVE_FILTER_SZIP)
+ if (szip_can_encode) {
+ if (h5repack_addfilter("dset1:SZIP=8,NN",&pack_options) < 0)
+ GOERROR;
+ }
+#endif
+
+#ifdef H5_HAVE_FILTER_DEFLATE
+ if (h5repack_addfilter("dset1:GZIP=1",&pack_options) < 0)
+ GOERROR;
+#endif
+
+ 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;
+ if (h5repack_end (&pack_options) < 0)
+ GOERROR;
+
+ PASSED();
+
+
+ TESTING(" adding layout chunked (old format)");
+
+ /*-------------------------------------------------------------------------
+ * test an individual object option
+ *-------------------------------------------------------------------------
+ */
+
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
+ GOERROR;
+ if (h5repack_addlayout("dset1:CHUNK=20x10",&pack_options) < 0)
+ GOERROR;
+ 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;
+ if (h5repack_end (&pack_options) < 0)
+ GOERROR;
+ PASSED();
+
+ TESTING(" adding layout chunked (new format)");
+
+ /*-------------------------------------------------------------------------
+ * test an individual object option
+ * For new format, "dset1" should be using Fixed Array indexing
+ *-------------------------------------------------------------------------
+ */
+
+ if (h5repack_init (&pack_options, 0, TRUE, fs_type, fs_size) < 0)
+ GOERROR;
+ if (h5repack_addlayout("dset1:CHUNK=20x10",&pack_options) < 0)
+ GOERROR;
+ 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;
+ if (h5repack_end (&pack_options) < 0)
+ GOERROR;
+ PASSED();
+
+ /*-------------------------------------------------------------------------
+ * test all objects option
+ *-------------------------------------------------------------------------
+ */
+ TESTING(" adding layout chunked to all");
+
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
+ GOERROR;
+ if (h5repack_addlayout("CHUNK=20x10",&pack_options) < 0)
+ GOERROR;
+ 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;
+ if (h5repack_end (&pack_options) < 0)
+ GOERROR;
+
+ PASSED();
+
+ TESTING(" adding layout contiguous");
+
+ /*-------------------------------------------------------------------------
+ * test an individual object option
+ *-------------------------------------------------------------------------
+ */
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
+ GOERROR;
+ if (h5repack_addlayout("dset1:CONTI",&pack_options) < 0)
+ GOERROR;
+ 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;
+ if (h5repack_end (&pack_options) < 0)
+ GOERROR;
+
+ PASSED();
+
+ TESTING(" adding layout contiguous to all");
+
+ /*-------------------------------------------------------------------------
+ * test all objects option
+ *-------------------------------------------------------------------------
+ */
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
+ GOERROR;
+ if (h5repack_addlayout("CONTI",&pack_options) < 0)
+ GOERROR;
+ 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;
+ if (h5repack_end (&pack_options) < 0)
+ GOERROR;
+
+ /*-------------------------------------------------------------------------
+ * do the same test for a file with filters (chunked)
+ *-------------------------------------------------------------------------
+ */
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
+ GOERROR;
+ if (h5repack_addlayout("CONTI",&pack_options) < 0)
+ GOERROR;
+ if (h5repack(FNAME8,FNAME8OUT,&pack_options) < 0)
+ GOERROR;
+ if (h5diff(FNAME8,FNAME8OUT,NULL,NULL,&diff_options) >0)
+ GOERROR;
+ if (h5repack_verify(FNAME8, FNAME8OUT,&pack_options)<=0)
+ GOERROR;
+ if (h5repack_end (&pack_options) < 0)
+ GOERROR;
+
+ PASSED();
+
+ TESTING(" adding layout compact");
+
+ /*-------------------------------------------------------------------------
+ * test an individual object option
+ *-------------------------------------------------------------------------
+ */
+
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
+ GOERROR;
+ if (h5repack_addlayout("dset1:COMPA",&pack_options) < 0)
+ GOERROR;
+ 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;
+ if (h5repack_end (&pack_options) < 0)
+ GOERROR;
+ PASSED();
+
+ TESTING(" adding layout compact to all");
+
+ /*-------------------------------------------------------------------------
+ * test all objects option
+ *-------------------------------------------------------------------------
+ */
+
+ /* fs_type = H5F_FILE_SPACE_ALL; fs_size = 2 */
+ if (h5repack_init (&pack_options, 0, FALSE, H5_INC_ENUM(H5F_file_space_type_t, fs_type), ++fs_size) < 0)
+ GOERROR;
+ if (h5repack_addlayout("COMPA",&pack_options) < 0)
+ GOERROR;
+ 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;
+ if (h5repack_end (&pack_options) < 0)
+ GOERROR;
+
+ PASSED();
+
+
+ TESTING(" layout compact to contiguous conversion");
+
+ /*-------------------------------------------------------------------------
+ * layout compact to contiguous conversion
+ *-------------------------------------------------------------------------
+ */
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
+ GOERROR;
+ if (h5repack_addlayout("dset_compact:CONTI",&pack_options) < 0)
+ GOERROR;
+ 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;
+ if (h5repack_end (&pack_options) < 0)
+ GOERROR;
+ PASSED();
+
+ TESTING(" layout compact to chunk conversion");
+
+ /*-------------------------------------------------------------------------
+ * layout compact to chunk conversion
+ *-------------------------------------------------------------------------
+ */
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
+ GOERROR;
+ if (h5repack_addlayout("dset_compact:CHUNK=2x5",&pack_options) < 0)
+ GOERROR;
+ 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;
+ if (h5repack_end (&pack_options) < 0)
+ GOERROR;
+ PASSED();
+
+ TESTING(" layout compact to compact conversion");
+
+ /*-------------------------------------------------------------------------
+ * layout compact to compact conversion
+ *-------------------------------------------------------------------------
+ */
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
+ GOERROR;
+ if (h5repack_addlayout("dset_compact:COMPA",&pack_options) < 0)
+ GOERROR;
+ 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;
+ if (h5repack_end (&pack_options) < 0)
+ GOERROR;
+ PASSED();
+
+ TESTING(" layout contiguous to compact conversion");
+ /*-------------------------------------------------------------------------
+ * layout contiguous to compact conversion
+ *-------------------------------------------------------------------------
+ */
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
+ GOERROR;
+ if (h5repack_addlayout("dset_contiguous:COMPA",&pack_options) < 0)
+ GOERROR;
+ 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;
+ if (h5repack_end (&pack_options) < 0)
+ GOERROR;
+ PASSED();
+
+ TESTING(" layout contiguous to chunk conversion");
+ /*-------------------------------------------------------------------------
+ * layout contiguous to chunk conversion
+ *-------------------------------------------------------------------------
+ */
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
+ GOERROR;
+ if (h5repack_addlayout("dset_contiguous:CHUNK=3x6",&pack_options) < 0)
+ GOERROR;
+ 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;
+ if (h5repack_end (&pack_options) < 0)
+ GOERROR;
+ PASSED();
+
+ TESTING(" layout contiguous to contiguous conversion");
+
+ /*-------------------------------------------------------------------------
+ * layout contiguous to contiguous conversion
+ *-------------------------------------------------------------------------
+ */
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
+ GOERROR;
+ if (h5repack_addlayout("dset_contiguous:CONTI",&pack_options) < 0)
+ GOERROR;
+ 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;
+ if (h5repack_end (&pack_options) < 0)
+ GOERROR;
+ PASSED();
+
+ TESTING(" layout chunked to compact conversion");
+ /*-------------------------------------------------------------------------
+ * layout chunked to compact conversion
+ *-------------------------------------------------------------------------
+ */
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
+ GOERROR;
+ if (h5repack_addlayout("dset_chunk:COMPA",&pack_options) < 0)
+ GOERROR;
+ 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;
+ if (h5repack_end (&pack_options) < 0)
+ GOERROR;
+ PASSED();
+
+ TESTING(" layout chunked to contiguous conversion");
+
+ /*-------------------------------------------------------------------------
+ * layout chunked to contiguous conversion
+ *-------------------------------------------------------------------------
+ */
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
+ GOERROR;
+ if (h5repack_addlayout("dset_chunk:CONTI",&pack_options) < 0)
+ GOERROR;
+ 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;
+ if (h5repack_end (&pack_options) < 0)
+ GOERROR;
+ PASSED();
+
+ TESTING(" layout chunked to chunk conversion");
+ /*-------------------------------------------------------------------------
+ * layout chunked to chunked conversion
+ *-------------------------------------------------------------------------
+ */
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
+ GOERROR;
+ if (h5repack_addlayout("dset_chunk:CHUNK=18x13",&pack_options) < 0)
+ GOERROR;
+ 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;
+ if (h5repack_end (&pack_options) < 0)
+ GOERROR;
+ PASSED();
+
+
+ /*-------------------------------------------------------------------------
+ * the following tests assume the input files have filters
+ * FNAME7
+ * FNAME8
+ * FNAME9
+ * FNAME10
+ * FNAME11
+ *-------------------------------------------------------------------------
+ */
+
+
+ TESTING(" copy of szip filter");
+
+#if defined (H5_HAVE_FILTER_SZIP)
+ if (szip_can_encode) {
+ /* fs_type = H5F_FILE_SPACE_AGGR_VFD; fs_size = 3 */
+ if (h5repack_init (&pack_options, 0, FALSE, H5_INC_ENUM(H5F_file_space_type_t, fs_type), ++fs_size) < 0)
+ GOERROR;
+ if (h5repack(FNAME7,FNAME7OUT,&pack_options) < 0)
+ GOERROR;
+ if (h5diff(FNAME7,FNAME7OUT,NULL,NULL,&diff_options) >0)
+ GOERROR;
+ if (h5repack_verify(FNAME7, FNAME7OUT,&pack_options)<=0)
+ GOERROR;
+ if (h5repack_cmp_pl(FNAME7,FNAME7OUT)<=0)
+ GOERROR;
+ if (h5repack_end (&pack_options) < 0)
+ GOERROR;
+
+ PASSED();
+ } else {
+ SKIPPED();
+ }
+#else
+ SKIPPED();
+#endif
+
+ TESTING(" removing szip filter");
+
+#if defined (H5_HAVE_FILTER_SZIP)
+ if (szip_can_encode) {
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
+ GOERROR;
+ if (h5repack_addfilter("dset_szip:NONE",&pack_options) < 0)
+ GOERROR;
+ if (h5repack(FNAME7,FNAME7OUT,&pack_options) < 0)
+ GOERROR;
+ if (h5diff(FNAME7,FNAME7OUT,NULL,NULL,&diff_options) >0)
+ GOERROR;
+ if (h5repack_verify(FNAME7, FNAME7OUT,&pack_options)<=0)
+ GOERROR;
+ if (h5repack_end (&pack_options) < 0)
+ GOERROR;
+
+ PASSED();
+ } else {
+ SKIPPED();
+ }
+#else
+ SKIPPED();
+#endif
+
+
+ TESTING(" copy of deflate filter");
+
+#ifdef H5_HAVE_FILTER_DEFLATE
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
+ GOERROR;
+ if (h5repack(FNAME8,FNAME8OUT,&pack_options) < 0)
+ GOERROR;
+ if (h5diff(FNAME8,FNAME8OUT,NULL,NULL,&diff_options) >0)
+ GOERROR;
+ if (h5repack_verify(FNAME8, FNAME8OUT,&pack_options)<=0)
+ GOERROR;
+ if (h5repack_end (&pack_options) < 0)
+ GOERROR;
+
+ PASSED();
+#else
+ SKIPPED();
+#endif
+
+
+ TESTING(" removing deflate filter");
+
+#ifdef H5_HAVE_FILTER_DEFLATE
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, ++fs_size) < 0)
+ GOERROR;
+ if (h5repack_addfilter("dset_deflate:NONE",&pack_options) < 0)
+ GOERROR;
+ if (h5repack(FNAME8,FNAME8OUT,&pack_options) < 0)
+ GOERROR;
+ if (h5diff(FNAME8,FNAME8OUT,NULL,NULL,&diff_options) >0)
+ GOERROR;
+ if (h5repack_verify(FNAME8, FNAME8OUT,&pack_options)<=0)
+ GOERROR;
+ if (h5repack_end (&pack_options) < 0)
+ GOERROR;
+
+ PASSED();
+#else
+ SKIPPED();
+#endif
+
+
+
+ TESTING(" copy of shuffle filter");
+
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
+ GOERROR;
+ if (h5repack(FNAME9,FNAME9OUT,&pack_options) < 0)
+ GOERROR;
+ if (h5diff(FNAME9,FNAME9OUT,NULL,NULL,&diff_options) >0)
+ GOERROR;
+ if (h5repack_verify(FNAME9, FNAME9OUT,&pack_options)<=0)
+ GOERROR;
+ if (h5repack_end (&pack_options) < 0)
+ GOERROR;
+
+ PASSED();
+
+
+ TESTING(" removing shuffle filter");
+
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
+ GOERROR;
+ if (h5repack_addfilter("dset_shuffle:NONE",&pack_options) < 0)
+ GOERROR;
+ if (h5repack(FNAME9,FNAME9OUT,&pack_options) < 0)
+ GOERROR;
+ if (h5diff(FNAME9,FNAME9OUT,NULL,NULL,&diff_options) >0)
+ GOERROR;
+ if (h5repack_verify(FNAME9, FNAME9OUT,&pack_options)<=0)
+ GOERROR;
+ if (h5repack_end (&pack_options) < 0)
+ GOERROR;
+
+ PASSED();
+
+
+ TESTING(" copy of fletcher filter");
+
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
+ GOERROR;
+ if (h5repack(FNAME10,FNAME10OUT,&pack_options) < 0)
+ GOERROR;
+ if (h5diff(FNAME10,FNAME10OUT,NULL,NULL,&diff_options) >0)
+ GOERROR;
+ if (h5repack_verify(FNAME10, FNAME10OUT,&pack_options)<=0)
+ GOERROR;
+ if (h5repack_end (&pack_options) < 0)
+ GOERROR;
+
+ PASSED();
+
+
+ TESTING(" removing fletcher filter");
+
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
+ GOERROR;
+ if (h5repack_addfilter("dset_fletcher32:NONE",&pack_options) < 0)
+ GOERROR;
+ if (h5repack(FNAME10,FNAME10OUT,&pack_options) < 0)
+ GOERROR;
+ if (h5diff(FNAME10,FNAME10OUT,NULL,NULL,&diff_options) >0)
+ GOERROR;
+ if (h5repack_verify(FNAME10, FNAME10OUT,&pack_options)<=0)
+ GOERROR;
+ if (h5repack_end (&pack_options) < 0)
+ GOERROR;
+
+ PASSED();
+
+
+ TESTING(" copy of nbit filter");
+
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
+ GOERROR;
+ if (h5repack(FNAME12,FNAME12OUT,&pack_options) < 0)
+ GOERROR;
+ if (h5diff(FNAME12,FNAME12OUT,NULL,NULL,&diff_options) >0)
+ GOERROR;
+ if (h5repack_verify(FNAME12, FNAME12OUT,&pack_options)<=0)
+ GOERROR;
+ if (h5repack_end (&pack_options) < 0)
+ GOERROR;
+
+ PASSED();
+
+
+ TESTING(" removing nbit filter");
+
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
+ GOERROR;
+ if (h5repack_addfilter("dset_nbit:NONE",&pack_options) < 0)
+ GOERROR;
+ if (h5repack(FNAME12,FNAME12OUT,&pack_options) < 0)
+ GOERROR;
+ if (h5diff(FNAME12,FNAME12OUT,NULL,NULL,&diff_options) >0)
+ GOERROR;
+ if (h5repack_verify(FNAME12, FNAME12OUT,&pack_options)<=0)
+ GOERROR;
+ if (h5repack_end (&pack_options) < 0)
+ GOERROR;
+
+ PASSED();
+
+
+ TESTING(" adding nbit filter");
+
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
+ GOERROR;
+ if (h5repack_addfilter("dset_int31:NBIT",&pack_options) < 0)
+ GOERROR;
+ if (h5repack(FNAME12,FNAME12OUT,&pack_options) < 0)
+ GOERROR;
+ if (h5diff(FNAME12,FNAME12OUT,NULL,NULL,&diff_options) >0)
+ GOERROR;
+ if (h5repack_verify(FNAME12, FNAME12OUT,&pack_options)<=0)
+ GOERROR;
+ if (h5repack_end (&pack_options) < 0)
+ GOERROR;
+
+ PASSED();
+
+
+ TESTING(" copy of scaleoffset filter");
+
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
+ GOERROR;
+ if (h5repack(FNAME13,FNAME13OUT,&pack_options) < 0)
+ GOERROR;
+ if (h5diff(FNAME13,FNAME13OUT,NULL,NULL,&diff_options) >0)
+ GOERROR;
+ if (h5repack_verify(FNAME13, FNAME13OUT,&pack_options)<=0)
+ GOERROR;
+ if (h5repack_end (&pack_options) < 0)
+ GOERROR;
+
+ PASSED();
+
+
+ TESTING(" removing scaleoffset filter");
+
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
+ GOERROR;
+ if (h5repack_addfilter("dset_scaleoffset:NONE",&pack_options) < 0)
+ GOERROR;
+ if (h5repack(FNAME13,FNAME13OUT,&pack_options) < 0)
+ GOERROR;
+ if (h5diff(FNAME13,FNAME13OUT,NULL,NULL,&diff_options) >0)
+ GOERROR;
+ if (h5repack_verify(FNAME13, FNAME13OUT,&pack_options)<=0)
+ GOERROR;
+ if (h5repack_end (&pack_options) < 0)
+ GOERROR;
+
+ PASSED();
+
+
+ TESTING(" adding scaleoffset filter");
+
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
+ GOERROR;
+ if (h5repack_addfilter("dset_none:SOFF=31,IN",&pack_options) < 0)
+ GOERROR;
+ if (h5repack(FNAME13,FNAME13OUT,&pack_options) < 0)
+ GOERROR;
+ if (h5diff(FNAME13,FNAME13OUT,NULL,NULL,&diff_options) >0)
+ GOERROR;
+ if (h5repack_verify(FNAME13, FNAME13OUT,&pack_options)<=0)
+ GOERROR;
+ if (h5repack_end (&pack_options) < 0)
+ GOERROR;
+
+ PASSED();
+
+
+ /*-------------------------------------------------------------------------
+ * file with all filters
+ * dset_all
+ * dset_deflate
+ * dset_szip
+ * dset_shuffle
+ * dset_fletcher32
+ *-------------------------------------------------------------------------
+ */
+
+
+ TESTING(" filter conversion from deflate to szip");
+
+#if defined (H5_HAVE_FILTER_SZIP) && defined (H5_HAVE_FILTER_DEFLATE)
+
+ if (szip_can_encode) {
+ /* fs_type = H5F_FILE_SPACE_VFD; fs_size = 4 */
+ if (h5repack_init (&pack_options, 0, FALSE, H5_INC_ENUM(H5F_file_space_type_t, fs_type), ++fs_size) < 0)
+ GOERROR;
+ if (h5repack_addfilter("dset_deflate:SZIP=8,NN",&pack_options) < 0)
+ GOERROR;
+ if (h5repack(FNAME11,FNAME11OUT,&pack_options) < 0)
+ GOERROR;
+ if (h5diff(FNAME11,FNAME11OUT,NULL,NULL,&diff_options) >0)
+ GOERROR;
+ if (h5repack_verify(FNAME11, FNAME11OUT,&pack_options)<=0)
+ GOERROR;
+ if (h5repack_end (&pack_options) < 0)
+ GOERROR;
+
+ PASSED();
+ } else {
+ SKIPPED();
+ }
+#else
+ SKIPPED();
+#endif
+
+ TESTING(" filter conversion from szip to deflate");
+
+#if defined (H5_HAVE_FILTER_SZIP) && defined (H5_HAVE_FILTER_DEFLATE)
+
+ if (szip_can_encode) {
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
+ GOERROR;
+ if (h5repack_addfilter("dset_szip:GZIP=1",&pack_options) < 0)
+ GOERROR;
+ if (h5repack(FNAME11,FNAME11OUT,&pack_options) < 0)
+ GOERROR;
+ if (h5diff(FNAME11,FNAME11OUT,NULL,NULL,&diff_options) >0)
+ GOERROR;
+ if (h5repack_verify(FNAME11, FNAME11OUT,&pack_options)<=0)
+ GOERROR;
+ if (h5repack_end (&pack_options) < 0)
+ GOERROR;
+
+ PASSED();
+ } else {
+ SKIPPED();
+ }
+#else
+ SKIPPED();
+#endif
+
+
+ /*-------------------------------------------------------------------------
+ * test the NONE global option
+ *-------------------------------------------------------------------------
+ */
+
+ TESTING(" removing all filters");
+
+#if defined (H5_HAVE_FILTER_SZIP) && defined (H5_HAVE_FILTER_DEFLATE)
+
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
+ GOERROR;
+ if (h5repack_addfilter("NONE",&pack_options) < 0)
+ GOERROR;
+ if (h5repack(FNAME11,FNAME11OUT,&pack_options) < 0)
+ GOERROR;
+ if (h5diff(FNAME11,FNAME11OUT,NULL,NULL,&diff_options) >0)
+ GOERROR;
+ if (h5repack_verify(FNAME11, FNAME11OUT,&pack_options)<=0)
+ GOERROR;
+ if (h5repack_end (&pack_options) < 0)
+ GOERROR;
+
+ PASSED();
+#else
+ SKIPPED();
+#endif
+
+ /*-------------------------------------------------------------------------
+ * test a big file
+ *-------------------------------------------------------------------------
+ */
+ TESTING(" big file");
+
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
+ GOERROR;
+ if (h5repack(FNAME14,FNAME14OUT,&pack_options) < 0)
+ GOERROR;
+ if (h5diff(FNAME14,FNAME14OUT,NULL,NULL,&diff_options) >0)
+ GOERROR;
+ if (h5repack_verify(FNAME14, FNAME14OUT,&pack_options)<=0)
+ GOERROR;
+ if (h5repack_end (&pack_options) < 0)
+ GOERROR;
+ PASSED();
+
+ /*-------------------------------------------------------------------------
+ * test external dataset
+ *-------------------------------------------------------------------------
+ */
+ TESTING(" external datasets");
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
+ GOERROR;
+ if (h5repack(FNAME15,FNAME15OUT,&pack_options) < 0)
+ GOERROR;
+ if (h5diff(FNAME15,FNAME15OUT,NULL,NULL,&diff_options) > 0)
+ GOERROR;
+ if (h5repack_verify(FNAME15, FNAME15OUT,&pack_options)<=0)
+ GOERROR;
+ if (h5repack_end (&pack_options) < 0)
+ GOERROR;
+ PASSED();
+
+ /*-------------------------------------------------------------------------
+ * test file with userblock
+ *-------------------------------------------------------------------------
+ */
+ TESTING(" file with userblock");
+ if(h5repack_init(&pack_options, 0, FALSE, fs_type, fs_size) < 0)
+ GOERROR;
+ if(h5repack(FNAME16, FNAME16OUT, &pack_options) < 0)
+ GOERROR;
+ if(h5diff(FNAME16, FNAME16OUT, NULL, NULL, &diff_options) > 0)
+ GOERROR;
+ if(h5repack_verify(FNAME16, FNAME16OUT, &pack_options) <= 0)
+ GOERROR;
+ if(verify_userblock(FNAME16OUT) < 0)
+ GOERROR;
+ if(h5repack_end(&pack_options) < 0)
+ GOERROR;
+ PASSED();
+
+ /*-------------------------------------------------------------------------
+ * test --latest options
+ *-------------------------------------------------------------------------
+ */
+ TESTING(" latest file format options");
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
+ GOERROR;
+ pack_options.latest=1;
+ pack_options.grp_compact=10;
+ pack_options.grp_indexed=5;
+ pack_options.msg_size[0] = 10;
+ pack_options.msg_size[1] = 20;
+ pack_options.msg_size[2] = 30;
+ pack_options.msg_size[3] = 40;
+ pack_options.msg_size[4] = 50;
+ if (h5repack(FNAME1,FNAME1OUT,&pack_options) < 0)
+ GOERROR;
+ if (h5diff(FNAME1,FNAME1OUT,NULL,NULL,&diff_options) > 0)
+ GOERROR;
+ if (h5repack_verify(FNAME1, FNAME1OUT,&pack_options)<=0)
+ GOERROR;
+ if (h5repack_end (&pack_options) < 0)
+ GOERROR;
+ PASSED();
+
+
+ /*-------------------------------------------------------------------------
+ * test several global filters
+ *-------------------------------------------------------------------------
+ */
+
+ TESTING(" several global filters");
+
+#if defined (H5_HAVE_FILTER_DEFLATE)
+
+ if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0)
+ GOERROR;
+ if (h5repack_addfilter("GZIP=1",&pack_options) < 0)
+ GOERROR;
+ if (h5repack_addfilter("SHUF",&pack_options) < 0)
+ GOERROR;
+ if (h5repack(FNAME11,FNAME11OUT,&pack_options) < 0)
+ GOERROR;
+ if (h5diff(FNAME11,FNAME11OUT,NULL,NULL,&diff_options) >0)
+ GOERROR;
+ if (h5repack_verify(FNAME11, FNAME11OUT,&pack_options)<=0)
+ GOERROR;
+ if (h5repack_end (&pack_options) < 0)
+ GOERROR;
+
+ PASSED();
+#else
+ SKIPPED();
+#endif
+
+
+ /*-------------------------------------------------------------------------
+ * test file with userblock
+ *-------------------------------------------------------------------------
+ */
+ TESTING(" file with added userblock");
+
+#ifdef H5_HAVE_FILTER_DEFLATE
+
+ if(h5repack_init(&pack_options, 0, FALSE, fs_type, fs_size) < 0)
+ GOERROR;
+
+ /* add the options for a user block size and user block filename */
+ pack_options.ublock_size = USERBLOCK_SIZE;
+ pack_options.ublock_filename = FNAME_UB;
+
+ if(h5repack(FNAME8, FNAME8OUT, &pack_options) < 0)
+ GOERROR;
+ if(h5diff(FNAME8, FNAME8OUT, NULL, NULL, &diff_options) > 0)
+ GOERROR;
+ if(h5repack_verify(FNAME8, FNAME8OUT, &pack_options) <= 0)
+ GOERROR;
+ if(verify_userblock(FNAME8OUT) < 0)
+ GOERROR;
+ if(h5repack_end(&pack_options) < 0)
+ GOERROR;
+
+
+ PASSED();
+#else
+ SKIPPED();
+#endif
+
+
+ /*-------------------------------------------------------------------------
+ * test file with aligment
+ *-------------------------------------------------------------------------
+ */
+ TESTING(" file with aligment");
+
+#ifdef H5_HAVE_FILTER_DEFLATE
+
+ if(h5repack_init(&pack_options, 0, FALSE, fs_type, fs_size) < 0)
+ GOERROR;
+
+ /* add the options for aligment */
+ pack_options.alignment = 1;
+ pack_options.threshold = 1;
+
+ if(h5repack(FNAME8, FNAME8OUT, &pack_options) < 0)
+ GOERROR;
+ if(h5diff(FNAME8, FNAME8OUT, NULL, NULL, &diff_options) > 0)
+ GOERROR;
+ if(h5repack_verify(FNAME8, FNAME8OUT, &pack_options) <= 0)
+ GOERROR;
+
+ /* verify aligment */
+ {
+ hsize_t threshold;
+ hsize_t alignment;
+ hid_t fapl;
+ hid_t fid;
+
+ if (( fid = H5Fopen(FNAME8OUT, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0 )
+ GOERROR;
+ if ((fapl = H5Fget_access_plist(fid)) < 0)
+ GOERROR;
+ if ( H5Pget_alignment(fapl, &threshold, &alignment ) < 0)
+ GOERROR;
+ if ( threshold != 1 )
+ GOERROR;
+ if ( alignment != 1 )
+ GOERROR;
+ if ( H5Pclose(fapl) < 0)
+ GOERROR;
+ if (H5Fclose(fid) < 0)
+ GOERROR;
+
+ }
+
+
+ if(h5repack_end(&pack_options) < 0)
+ GOERROR;
+
+
+ PASSED();
+#else
+ SKIPPED();
+#endif
+
+ /*-------------------------------------------------------------------------
+ * test file with userblock
+ *-------------------------------------------------------------------------
+ */
+ TESTING(" file with committed datatypes");
+
+ if(h5repack_init(&pack_options, 0, FALSE, fs_type, fs_size) < 0)
+ GOERROR;
+
+ if(h5repack(FNAME17, FNAME17OUT, &pack_options) < 0)
+ GOERROR;
+ if(h5diff(FNAME17, FNAME17OUT, NULL, NULL, &diff_options) > 0)
+ GOERROR;
+ if(h5repack_verify(FNAME17, FNAME17OUT, &pack_options) <= 0)
+ GOERROR;
+ if(h5repack_end(&pack_options) < 0)
+ GOERROR;
+
+
+ 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, FALSE, 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, FALSE, 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
+ *-------------------------------------------------------------------------
+ */
+ {
+ hid_t fapl;
+
+ fapl = h5_fileaccess();
+ h5_clean_files(H5REPACK_FILENAMES, fapl);
+
+ }
+
+ puts("All h5repack tests passed.");
+
+ h5tools_close();
+
+ return 0;
+
+error:
+ puts("***** H5REPACK TESTS FAILED *****");
+ return 1;
+
+}
+
+
+/*-------------------------------------------------------------------------
+* Function: make_testfiles
+*
+* Purpose: make a test file with all types of HDF5 objects,
+* datatypes and filters
+*
+*-------------------------------------------------------------------------
+*/
+static
+int make_testfiles(void)
+{
+ hid_t fid;
+
+ /*-------------------------------------------------------------------------
+ * create a file for general copy test
+ *-------------------------------------------------------------------------
+ */
+ if((fid = H5Fcreate(FNAME0,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0)
+ return -1;
+ if (make_fill(fid) < 0)
+ goto out;
+ if(H5Fclose(fid) < 0)
+ return -1;
+
+ /*-------------------------------------------------------------------------
+ * create another file for general copy test (all datatypes)
+ *-------------------------------------------------------------------------
+ */
+ if((fid = H5Fcreate(FNAME1,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0)
+ return -1;
+ if (make_all_objects(fid) < 0)
+ goto out;
+ if(H5Fclose(fid) < 0)
+ return -1;
+
+ /*-------------------------------------------------------------------------
+ * create a file for attributes copy test
+ *-------------------------------------------------------------------------
+ */
+ if((fid = H5Fcreate(FNAME2,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0)
+ return -1;
+ if (make_attributes(fid) < 0)
+ goto out;
+ if(H5Fclose(fid) < 0)
+ return -1;
+
+ /*-------------------------------------------------------------------------
+ * create a file for hard links test
+ *-------------------------------------------------------------------------
+ */
+ if((fid = H5Fcreate(FNAME3,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0)
+ return -1;
+ if (make_hlinks(fid) < 0)
+ goto out;
+ if(H5Fclose(fid) < 0)
+ return -1;
+
+ /*-------------------------------------------------------------------------
+ * create a file for layouts test
+ *-------------------------------------------------------------------------
+ */
+ if((fid = H5Fcreate(FNAME4,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0)
+ return -1;
+ if (make_layout(fid) < 0)
+ goto out;
+ if(H5Fclose(fid) < 0)
+ return -1;
+
+ /*-------------------------------------------------------------------------
+ * create a file for layout conversion test
+ *-------------------------------------------------------------------------
+ */
+ if((fid = H5Fcreate(FNAME18, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ return -1;
+
+ if(make_layout2(fid) < 0)
+ goto out;
+
+ if(H5Fclose(fid) < 0)
+ 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
+ *-------------------------------------------------------------------------
+ */
+ if (make_early() < 0)
+ goto out;
+
+ /*-------------------------------------------------------------------------
+ * create a file with the SZIP filter
+ *-------------------------------------------------------------------------
+ */
+#ifdef H5_HAVE_FILTER_SZIP
+ if((fid = H5Fcreate(FNAME7,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0)
+ return -1;
+ if (make_szip(fid) < 0)
+ goto out;
+ if(H5Fclose(fid) < 0)
+ return -1;
+#endif /* H5_HAVE_FILTER_SZIP */
+
+
+ /*-------------------------------------------------------------------------
+ * create a file with the deflate filter
+ *-------------------------------------------------------------------------
+ */
+ if((fid = H5Fcreate(FNAME8,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0)
+ return -1;
+ if (make_deflate(fid) < 0)
+ goto out;
+ if(H5Fclose(fid) < 0)
+ return -1;
+
+ /*-------------------------------------------------------------------------
+ * create a file with the shuffle filter
+ *-------------------------------------------------------------------------
+ */
+ if((fid = H5Fcreate(FNAME9,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0)
+ return -1;
+ if (make_shuffle(fid) < 0)
+ goto out;
+ if(H5Fclose(fid) < 0)
+ return -1;
+
+ /*-------------------------------------------------------------------------
+ * create a file with the fletcher32 filter
+ *-------------------------------------------------------------------------
+ */
+ if((fid = H5Fcreate(FNAME10,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0)
+ return -1;
+ if (make_fletcher32(fid) < 0)
+ goto out;
+ if(H5Fclose(fid) < 0)
+ return -1;
+
+ /*-------------------------------------------------------------------------
+ * create a file with all the filters
+ *-------------------------------------------------------------------------
+ */
+ if((fid = H5Fcreate(FNAME11,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0)
+ return -1;
+ if (make_all_filters(fid) < 0)
+ goto out;
+ if(H5Fclose(fid) < 0)
+ return -1;
+
+ /*-------------------------------------------------------------------------
+ * create a file with the nbit filter
+ *-------------------------------------------------------------------------
+ */
+ if((fid = H5Fcreate(FNAME12,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0)
+ return -1;
+ if (make_nbit(fid) < 0)
+ goto out;
+ if(H5Fclose(fid) < 0)
+ return -1;
+
+ /*-------------------------------------------------------------------------
+ * create a file with the scaleoffset filter
+ *-------------------------------------------------------------------------
+ */
+ if((fid = H5Fcreate(FNAME13,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0)
+ return -1;
+ if (make_scaleoffset(fid) < 0)
+ goto out;
+ if(H5Fclose(fid) < 0)
+ return -1;
+
+ /*-------------------------------------------------------------------------
+ * create a big dataset
+ *-------------------------------------------------------------------------
+ */
+ if((fid = H5Fcreate(FNAME14,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0)
+ return -1;
+ if (make_big(fid) < 0)
+ goto out;
+ if(H5Fclose(fid) < 0)
+ return -1;
+
+ /*-------------------------------------------------------------------------
+ * create a file with external dataset
+ *-------------------------------------------------------------------------
+ */
+ if((fid = H5Fcreate(FNAME15,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0)
+ return -1;
+ if (make_external(fid) < 0)
+ goto out;
+ if(H5Fclose(fid) < 0)
+ return -1;
+
+ /*-------------------------------------------------------------------------
+ * create a file with userblock
+ *-------------------------------------------------------------------------
+ */
+ if(make_userblock() < 0)
+ goto out;
+
+ /*-------------------------------------------------------------------------
+ * create a userblock file
+ *-------------------------------------------------------------------------
+ */
+ if(make_userblock_file() < 0)
+ goto out;
+
+ /*-------------------------------------------------------------------------
+ * create a file with named datatypes
+ *-------------------------------------------------------------------------
+ */
+ if((fid = H5Fcreate(FNAME17,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0)
+ return -1;
+ if (make_named_dtype(fid) < 0)
+ goto out;
+ if(H5Fclose(fid) < 0)
+ return -1;
+
+ /*-------------------------------------------------------------------------
+ * create obj and region reference type datasets (bug1814)
+ * add attribute with int type (bug1726)
+ * add attribute with obj and region reference type (bug1726)
+ *-------------------------------------------------------------------------*/
+ if((fid = H5Fcreate(FNAME_REF,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0)
+ return -1;
+ /* create reference type datasets */
+ if (make_references(fid) < 0)
+ goto out;
+ if(H5Fclose(fid) < 0)
+ return -1;
+
+ /*-------------------------------------------------------------------------
+ * create a file with obj and region references in attribute of compound and
+ * vlen datatype
+ *-------------------------------------------------------------------------*/
+ if((fid = H5Fcreate(FNAME_ATTR_REF,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT)) < 0)
+ return -1;
+ if (make_complex_attr_references(fid) < 0)
+ goto out;
+ if(H5Fclose(fid) < 0)
+ return -1;
+
+ return 0;
+
+out:
+ H5Fclose(fid);
+ return -1;
+}
+
+
+
+/*-------------------------------------------------------------------------
+* Function: make_all_objects
+*
+* Purpose: make a test file with all types of HDF5 objects
+*
+*-------------------------------------------------------------------------
+*/
+static
+int make_all_objects(hid_t loc_id)
+{
+ hid_t did=-1;
+ hid_t gid=-1;
+ hid_t tid=-1;
+ hid_t rid=-1;
+ hid_t sid=-1;
+ hid_t gcplid=-1;
+ hsize_t dims[1]={2};
+ /* compound datatype */
+ typedef struct s_t
+ {
+ int a;
+ float b;
+ } s_t;
+
+ /*-------------------------------------------------------------------------
+ * H5G_DATASET
+ *-------------------------------------------------------------------------
+ */
+ if ((sid = H5Screate_simple(1, dims, NULL)) < 0)
+ goto out;
+ if ((did = H5Dcreate2(loc_id, "dset_referenced", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
+
+
+ /*-------------------------------------------------------------------------
+ * H5G_GROUP
+ *-------------------------------------------------------------------------
+ */
+ if ((gid = H5Gcreate2(loc_id, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
+ if (H5Gclose(gid) < 0)
+ goto out;
+
+ /* create a group "g2" with H5P_CRT_ORDER_TRACKED set */
+ if ((gcplid = H5Pcreate(H5P_GROUP_CREATE)) < 0)
+ goto out;
+ if (H5Pset_link_creation_order(gcplid, H5P_CRT_ORDER_TRACKED) < 0)
+ goto out;
+ if ((gid = H5Gcreate2(loc_id, "g2", H5P_DEFAULT, gcplid, H5P_DEFAULT)) < 0)
+ goto out;
+ if (H5Gclose(gid) < 0)
+ goto out;
+
+ /*-------------------------------------------------------------------------
+ * H5G_TYPE
+ *-------------------------------------------------------------------------
+ */
+
+ /* create a compound datatype */
+ if ((tid = H5Tcreate(H5T_COMPOUND, sizeof(s_t))) < 0)
+ goto out;
+ if (H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_INT) < 0)
+ goto out;
+ if (H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_FLOAT) < 0)
+ goto out;
+ if (H5Tcommit2(loc_id, "type", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ goto out;
+
+ /*-------------------------------------------------------------------------
+ * H5G_LINK
+ *-------------------------------------------------------------------------
+ */
+
+ if (H5Lcreate_soft("dset", loc_id, "link", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ goto out;
+
+ /*-------------------------------------------------------------------------
+ * H5G_UDLINK
+ *-------------------------------------------------------------------------
+ */
+ /* Create an external link. Other UD links are not supported by h5repack */
+ if (H5Lcreate_external("file", "path", loc_id, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ goto out;
+
+ /*-------------------------------------------------------------------------
+ * write a series of datasetes at root
+ *-------------------------------------------------------------------------
+ */
+
+ if ((rid = H5Gopen2(loc_id, "/", H5P_DEFAULT)) < 0)
+ goto out;
+ if (write_dset_in(rid,"dset_referenced",loc_id,0) < 0)
+ goto out;
+ if (H5Gclose(rid) < 0)
+ goto out;
+
+ /* close */
+ if (H5Dclose(did) < 0)
+ goto out;
+ if (H5Sclose(sid) < 0)
+ goto out;
+ if (H5Tclose(tid) < 0)
+ goto out;
+ if (H5Pclose(gcplid) < 0)
+ goto out;
+
+ return 0;
+
+out:
+ H5E_BEGIN_TRY
+ {
+ H5Dclose(did);
+ H5Gclose(gid);
+ H5Gclose(rid);
+ H5Sclose(sid);
+ H5Tclose(tid);
+ H5Pclose(gcplid);
+ } H5E_END_TRY;
+ return -1;
+}
+
+
+/*-------------------------------------------------------------------------
+* Function: make_attributes
+*
+* Purpose: make a test file with all types of attributes
+*
+*-------------------------------------------------------------------------
+*/
+static
+int make_attributes(hid_t loc_id)
+{
+ hid_t did=-1;
+ hid_t gid=-1;
+ hid_t rid=-1;
+ hid_t sid=-1;
+ hsize_t dims[1]={2};
+
+ /*-------------------------------------------------------------------------
+ * H5G_DATASET
+ *-------------------------------------------------------------------------
+ */
+ if ((sid = H5Screate_simple(1, dims, NULL)) < 0)
+ goto out;
+ if ((did = H5Dcreate2(loc_id, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
+
+ /*-------------------------------------------------------------------------
+ * H5G_GROUP
+ *-------------------------------------------------------------------------
+ */
+ if ((gid = H5Gcreate2(loc_id, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
+ if ((rid = H5Gopen2(loc_id, "/", H5P_DEFAULT)) < 0)
+ goto out;
+
+ /*-------------------------------------------------------------------------
+ * write a series of attributes on the dataset, group, and root group
+ *-------------------------------------------------------------------------
+ */
+
+ if ( write_attr_in(did,"dset",loc_id,0) < 0)
+ goto out;
+ if (write_attr_in(gid,"dset",loc_id,0) < 0)
+ goto out;
+ if (write_attr_in(rid,"dset",loc_id,0) < 0)
+ goto out;
+
+ /* close */
+ if (H5Dclose(did) < 0)
+ goto out;
+ if (H5Gclose(gid) < 0)
+ goto out;
+ if (H5Gclose(rid) < 0)
+ goto out;
+ if (H5Sclose(sid) < 0)
+ goto out;
+
+ return 0;
+
+out:
+ H5E_BEGIN_TRY
+ {
+ H5Dclose(did);
+ H5Gclose(gid);
+ H5Gclose(rid);
+ H5Sclose(sid);
+ } H5E_END_TRY;
+ return -1;
+
+}
+
+/*-------------------------------------------------------------------------
+* Function: make_hlinks
+*
+* Purpose: make a test file with hard links
+*
+*-------------------------------------------------------------------------
+*/
+static
+int make_hlinks(hid_t loc_id)
+{
+ hid_t g1id=-1;
+ hid_t g2id=-1;
+ hid_t g3id=-1;
+ hsize_t dims[2]={3,2};
+ int buf[3][2]= {{1,1},{1,2},{2,2}};
+
+ /*-------------------------------------------------------------------------
+ * create a dataset and some hard links to it
+ *-------------------------------------------------------------------------
+ */
+
+ if(write_dset(loc_id, 2, dims, "dset", H5T_NATIVE_INT, buf) < 0)
+ return -1;
+ if(H5Lcreate_hard(loc_id, "dset", H5L_SAME_LOC, "link1 to dset", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ return -1;
+ if(H5Lcreate_hard(loc_id, "dset", H5L_SAME_LOC, "link2 to dset", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ return -1;
+ if(H5Lcreate_hard(loc_id, "dset", H5L_SAME_LOC, "link3 to dset", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ return -1;
+
+ /*-------------------------------------------------------------------------
+ * create a group and some hard links to it
+ *-------------------------------------------------------------------------
+ */
+
+ if((g1id = H5Gcreate2(loc_id, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
+ if((g2id = H5Gcreate2(g1id, "g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
+ if((g3id = H5Gcreate2(g2id, "g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
+
+ if(H5Lcreate_hard(loc_id, "g1", g2id, "link1 to g1", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ goto out;
+ if(H5Lcreate_hard(g1id, "g2", g3id, "link1 to g2", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ goto out;
+
+
+ /* close */
+ if (H5Gclose(g1id) < 0)
+ goto out;
+ if (H5Gclose(g2id) < 0)
+ goto out;
+ if (H5Gclose(g3id) < 0)
+ goto out;
+
+ return 0;
+
+out:
+ H5E_BEGIN_TRY
+ {
+ H5Gclose(g1id);
+ H5Gclose(g2id);
+ H5Gclose(g3id);
+ } H5E_END_TRY;
+ return -1;
+
+}
+
+
+/*-------------------------------------------------------------------------
+* Function: make_szip
+*
+* Purpose: make a dataset with the SZIP filter
+*
+*-------------------------------------------------------------------------
+*/
+#ifdef H5_HAVE_FILTER_SZIP
+static
+int make_szip(hid_t loc_id)
+{
+ hid_t dcpl; /* dataset creation property list */
+ hid_t sid; /* dataspace ID */
+ unsigned szip_options_mask=H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_NN_OPTION_MASK;
+ unsigned szip_pixels_per_block=8;
+ hsize_t dims[RANK]={DIM1,DIM2};
+ hsize_t chunk_dims[RANK]={CDIM1,CDIM2};
+ int buf[DIM1][DIM2];
+ int i, j, n;
+ int szip_can_encode = 0;
+
+ for (i=n=0; i<DIM1; i++)
+ {
+ for (j=0; j<DIM2; j++)
+ {
+ buf[i][j]=n++;
+ }
+ }
+ /* create a space */
+ if((sid = H5Screate_simple(RANK, dims, NULL)) < 0)
+ return -1;
+ /* create a dcpl */
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto out;
+ /* set up chunk */
+ if(H5Pset_chunk(dcpl, RANK, chunk_dims) < 0)
+ goto out;
+
+ /*-------------------------------------------------------------------------
+ * SZIP
+ *-------------------------------------------------------------------------
+ */
+ /* Make sure encoding is enabled */
+ if (h5tools_can_encode(H5Z_FILTER_SZIP) == 1)
+ {
+ szip_can_encode = 1;
+ }
+ if (szip_can_encode)
+ {
+ /* set szip data */
+ if(H5Pset_szip (dcpl,szip_options_mask,szip_pixels_per_block) < 0)
+ goto out;
+ if (make_dset(loc_id,"dset_szip",sid,dcpl,buf) < 0)
+ goto out;
+ }
+ else
+ {
+ /* WARNING? SZIP is decoder only, can't generate test files */
+ }
+
+ 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;
+}
+#endif /* H5_HAVE_FILTER_SZIP */
+
+
+
+/*-------------------------------------------------------------------------
+* Function: make_deflate
+*
+* Purpose: make a dataset with the deflate filter
+*
+*-------------------------------------------------------------------------
+*/
+static
+int make_deflate(hid_t loc_id)
+{
+ hid_t dcpl; /* dataset creation property list */
+ hid_t sid; /* dataspace ID */
+ hsize_t dims[RANK]={DIM1,DIM2};
+ hsize_t chunk_dims[RANK]={CDIM1,CDIM2};
+ int buf[DIM1][DIM2];
+ hobj_ref_t bufref[1]; /* reference */
+ hsize_t dims1r[1]={1};
+ int i, j, n;
+
+ for (i=n=0; i<DIM1; i++)
+ {
+ for (j=0; j<DIM2; j++)
+ {
+ buf[i][j]=n++;
+ }
+ }
+
+ /* create a space */
+ if((sid = H5Screate_simple(RANK, dims, NULL)) < 0)
+ return -1;
+ /* create a dcpl */
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto out;
+ /* set up chunk */
+ if(H5Pset_chunk(dcpl, RANK, chunk_dims) < 0)
+ goto out;
+
+ /*-------------------------------------------------------------------------
+ * GZIP
+ *-------------------------------------------------------------------------
+ */
+#if defined (H5_HAVE_FILTER_DEFLATE)
+ /* set deflate data */
+ if(H5Pset_deflate(dcpl, 9) < 0)
+ goto out;
+ if (make_dset(loc_id,"dset_deflate",sid,dcpl,buf) < 0)
+ goto out;
+
+ /* create a reference to the dataset, test second seeep of file for references */
+
+ if (H5Rcreate(&bufref[0],loc_id,"dset_deflate",H5R_OBJECT,(hid_t)-1) < 0)
+ goto out;
+ if (write_dset(loc_id,1,dims1r,"ref",H5T_STD_REF_OBJ,bufref) < 0)
+ goto out;
+#endif
+
+
+ /*-------------------------------------------------------------------------
+ * 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_shuffle
+*
+* Purpose: make a dataset with the shuffle filter
+*
+*-------------------------------------------------------------------------
+*/
+static
+int make_shuffle(hid_t loc_id)
+{
+ hid_t dcpl; /* dataset creation property list */
+ hid_t sid; /* dataspace ID */
+ hsize_t dims[RANK]={DIM1,DIM2};
+ hsize_t chunk_dims[RANK]={CDIM1,CDIM2};
+ int buf[DIM1][DIM2];
+ int i, j, n;
+
+ for (i=n=0; i<DIM1; i++)
+ {
+ for (j=0; j<DIM2; j++)
+ {
+ buf[i][j]=n++;
+ }
+ }
+ /* create a space */
+ if((sid = H5Screate_simple(RANK, dims, NULL)) < 0)
+ return -1;
+ /* create a dcpl */
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto out;
+ /* set up chunk */
+ if(H5Pset_chunk(dcpl, RANK, chunk_dims) < 0)
+ goto out;
+
+ /*-------------------------------------------------------------------------
+ * shuffle
+ *-------------------------------------------------------------------------
+ */
+
+ /* set the shuffle filter */
+ if (H5Pset_shuffle(dcpl) < 0)
+ goto out;
+ if (make_dset(loc_id,"dset_shuffle",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_fletcher32
+*
+* Purpose: make a dataset with the fletcher32 filter
+*
+*-------------------------------------------------------------------------
+*/
+static
+int make_fletcher32(hid_t loc_id)
+{
+ hid_t dcpl; /* dataset creation property list */
+ hid_t sid; /* dataspace ID */
+ hsize_t dims[RANK]={DIM1,DIM2};
+ hsize_t chunk_dims[RANK]={CDIM1,CDIM2};
+ int buf[DIM1][DIM2];
+ int i, j, n;
+
+ for (i=n=0; i<DIM1; i++)
+ {
+ for (j=0; j<DIM2; j++)
+ {
+ buf[i][j]=n++;
+ }
+ }
+ /* create a space */
+ if((sid = H5Screate_simple(RANK, dims, NULL)) < 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;
+ /* set up chunk */
+ if(H5Pset_chunk(dcpl, RANK, chunk_dims) < 0)
+ goto out;
+
+
+ /*-------------------------------------------------------------------------
+ * fletcher32
+ *-------------------------------------------------------------------------
+ */
+
+ /* remove the filters from the dcpl */
+ if (H5Premove_filter(dcpl,H5Z_FILTER_ALL) < 0)
+ goto out;
+ /* set the checksum filter */
+ if (H5Pset_fletcher32(dcpl) < 0)
+ goto out;
+ if (make_dset(loc_id,"dset_fletcher32",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_nbit
+*
+* Purpose: make a dataset with the nbit filter
+*
+*-------------------------------------------------------------------------
+*/
+static
+int make_nbit(hid_t loc_id)
+{
+ hid_t dcpl; /* dataset creation property list */
+ hid_t sid; /* dataspace ID */
+ hid_t dtid;
+ hid_t dsid;
+ hsize_t dims[RANK]={DIM1,DIM2};
+ hsize_t chunk_dims[RANK]={CDIM1,CDIM2};
+ int buf[DIM1][DIM2];
+ int i, j, n;
+
+ for (i=n=0; i<DIM1; i++)
+ {
+ for (j=0; j<DIM2; j++)
+ {
+ buf[i][j]=n++;
+ }
+ }
+ /* create a space */
+ if((sid = H5Screate_simple(RANK, dims, NULL)) < 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;
+ /* set up chunk */
+ if(H5Pset_chunk(dcpl, RANK, chunk_dims) < 0)
+ goto out;
+
+ dtid = H5Tcopy(H5T_NATIVE_INT);
+ if (H5Tset_precision(dtid,(H5Tget_precision(dtid) - 1)) < 0)
+ {
+ H5Tclose(dtid);
+ goto out;
+ }
+
+ /* remove the filters from the dcpl */
+ if(H5Premove_filter(dcpl, H5Z_FILTER_ALL) < 0)
+ {
+ H5Tclose(dtid);
+ goto out;
+ }
+ if(H5Pset_nbit(dcpl) < 0) {
+ H5Tclose(dtid);
+ goto out;
+ }
+ if((dsid = H5Dcreate2(loc_id, "dset_nbit", dtid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) {
+ H5Tclose(dtid);
+ goto out;
+ }
+ if(H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) {
+ H5Tclose(dtid);
+ goto out;
+ }
+ H5Dclose(dsid);
+
+ if(H5Premove_filter(dcpl, H5Z_FILTER_ALL) < 0) {
+ H5Tclose(dtid);
+ goto out;
+ }
+ if((dsid = H5Dcreate2(loc_id, "dset_int31", dtid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) {
+ H5Tclose(dtid);
+ goto out;
+ }
+ if(H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) {
+ H5Tclose(dtid);
+ goto out;
+ }
+ H5Dclose(dsid);
+
+ /*-------------------------------------------------------------------------
+ * close
+ *-------------------------------------------------------------------------
+ */
+ if(H5Sclose(sid) < 0)
+ goto out;
+ if(H5Pclose(dcpl) < 0)
+ goto out;
+ if (H5Tclose(dtid) < 0)
+ goto out;
+
+ return 0;
+
+out:
+ H5E_BEGIN_TRY {
+ H5Pclose(dcpl);
+ H5Sclose(sid);
+ } H5E_END_TRY;
+ return -1;
+}
+
+
+/*-------------------------------------------------------------------------
+* Function: make_scaleoffset
+*
+* Purpose: make a dataset with the scaleoffset filter
+*
+*-------------------------------------------------------------------------
+*/
+static
+int make_scaleoffset(hid_t loc_id)
+{
+ hid_t dcpl; /* dataset creation property list */
+ hid_t sid; /* dataspace ID */
+ hid_t dtid;
+ hid_t dsid;
+ hsize_t dims[RANK]={DIM1,DIM2};
+ hsize_t chunk_dims[RANK]={CDIM1,CDIM2};
+ int buf[DIM1][DIM2];
+ int i, j, n;
+
+ for (i=n=0; i<DIM1; i++)
+ {
+ for (j=0; j<DIM2; j++)
+ {
+ buf[i][j]=n++;
+ }
+ }
+ /* create a space */
+ if((sid = H5Screate_simple(RANK, dims, NULL)) < 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;
+ /* set up chunk */
+ if(H5Pset_chunk(dcpl, RANK, chunk_dims) < 0)
+ goto out;
+
+ dtid = H5Tcopy(H5T_NATIVE_INT);
+
+ /* remove the filters from the dcpl */
+ if(H5Premove_filter(dcpl, H5Z_FILTER_ALL) < 0) {
+ H5Tclose(dtid);
+ goto out;
+ }
+ if(H5Pset_scaleoffset(dcpl, H5Z_SO_INT, 31) < 0) {
+ H5Tclose(dtid);
+ goto out;
+ }
+ if((dsid = H5Dcreate2(loc_id, "dset_scaleoffset", dtid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) {
+ H5Tclose(dtid);
+ goto out;
+ }
+ if(H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) {
+ H5Tclose(dtid);
+ goto out;
+ }
+ H5Dclose(dsid);
+ if((dsid = H5Dcreate2(loc_id, "dset_none", dtid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
+ H5Tclose(dtid);
+ goto out;
+ }
+ if(H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) {
+ H5Tclose(dtid);
+ goto out;
+ }
+ H5Tclose(dtid);
+ H5Dclose(dsid);
+
+ /*-------------------------------------------------------------------------
+ * 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_all_filters
+*
+* Purpose: make a file with all filters
+*
+*-------------------------------------------------------------------------
+*/
+static
+int make_all_filters(hid_t loc_id)
+{
+ hid_t dcpl; /* dataset creation property list */
+ hid_t sid; /* dataspace ID */
+ hid_t dtid;
+ hid_t dsid;
+#if defined (H5_HAVE_FILTER_SZIP)
+ unsigned szip_options_mask=H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_NN_OPTION_MASK;
+ unsigned szip_pixels_per_block=8;
+#endif /* H5_HAVE_FILTER_SZIP */
+ hsize_t dims[RANK]={DIM1,DIM2};
+ hsize_t chunk_dims[RANK]={CDIM1,CDIM2};
+ int buf[DIM1][DIM2];
+ int i, j, n;
+#if defined (H5_HAVE_FILTER_SZIP)
+ int szip_can_encode = 0;
+#endif
+
+ for (i=n=0; i<DIM1; i++)
+ {
+ for (j=0; j<DIM2; j++)
+ {
+ buf[i][j]=n++;
+ }
+ }
+ /* create a space */
+ if((sid = H5Screate_simple(RANK, dims, NULL)) < 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;
+ /* set up chunk */
+ if (H5Pset_chunk(dcpl, RANK, chunk_dims) < 0)
+ goto out;
+
+ /* set the shuffle filter */
+ if (H5Pset_shuffle(dcpl) < 0)
+ goto out;
+
+ /* set the checksum filter */
+ if (H5Pset_fletcher32(dcpl) < 0)
+ goto out;
+
+#if defined (H5_HAVE_FILTER_SZIP)
+ if (h5tools_can_encode(H5Z_FILTER_SZIP) == 1)
+ {
+ szip_can_encode = 1;
+ }
+ if (szip_can_encode)
+ {
+ /* set szip data */
+ if(H5Pset_szip (dcpl,szip_options_mask,szip_pixels_per_block) < 0)
+ goto out;
+ } else {
+ /* WARNING? SZIP is decoder only, can't generate test data using szip */
+ }
+#endif
+
+#if defined (H5_HAVE_FILTER_DEFLATE)
+ /* set deflate data */
+ if(H5Pset_deflate(dcpl, 9) < 0)
+ goto out;
+#endif
+
+ if (make_dset(loc_id,"dset_all",sid,dcpl,buf) < 0)
+ goto out;
+
+ /* remove the filters from the dcpl */
+ if (H5Premove_filter(dcpl,H5Z_FILTER_ALL) < 0)
+ goto out;
+ /* set the checksum filter */
+ if (H5Pset_fletcher32(dcpl) < 0)
+ goto out;
+ if (make_dset(loc_id,"dset_fletcher32",sid,dcpl,buf) < 0)
+ goto out;
+
+
+ /* Make sure encoding is enabled */
+#if defined (H5_HAVE_FILTER_SZIP)
+ if (szip_can_encode)
+ {
+ /* remove the filters from the dcpl */
+ if (H5Premove_filter(dcpl,H5Z_FILTER_ALL) < 0)
+ goto out;
+ /* set szip data */
+ if(H5Pset_szip (dcpl,szip_options_mask,szip_pixels_per_block) < 0)
+ goto out;
+ if (make_dset(loc_id,"dset_szip",sid,dcpl,buf) < 0)
+ goto out;
+ } else
+ {
+ /* WARNING? SZIP is decoder only, can't generate test dataset */
+ }
+#endif
+
+
+ /* remove the filters from the dcpl */
+ if (H5Premove_filter(dcpl,H5Z_FILTER_ALL) < 0)
+ goto out;
+ /* set the shuffle filter */
+ if (H5Pset_shuffle(dcpl) < 0)
+ goto out;
+ if (make_dset(loc_id,"dset_shuffle",sid,dcpl,buf) < 0)
+ goto out;
+
+
+#if defined (H5_HAVE_FILTER_DEFLATE)
+ /* remove the filters from the dcpl */
+ if (H5Premove_filter(dcpl,H5Z_FILTER_ALL) < 0)
+ goto out;
+ /* set deflate data */
+ if(H5Pset_deflate(dcpl, 1) < 0)
+ goto out;
+ if (make_dset(loc_id,"dset_deflate",sid,dcpl,buf) < 0)
+ goto out;
+#endif
+
+
+
+ /* remove the filters from the dcpl */
+ if (H5Premove_filter(dcpl, H5Z_FILTER_ALL) < 0)
+ goto out;
+ /* set the shuffle filter */
+ if (H5Pset_nbit(dcpl) < 0)
+ goto out;
+ if ((dtid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ goto out;
+ if (H5Tset_precision(dtid, (H5Tget_precision(dtid) - 1)) < 0)
+ goto out;
+ if((dsid = H5Dcreate2(loc_id, "dset_nbit", dtid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto out;
+ if(H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ goto out;
+
+ /* close */
+ if(H5Tclose(dtid) < 0)
+ return -1;
+ if(H5Dclose(dsid) < 0)
+ return -1;
+
+ 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_early
+*
+* Purpose: create a file for the H5D_ALLOC_TIME_EARLY test
+*
+*-------------------------------------------------------------------------
+*/
+static
+int make_early(void)
+{
+ hsize_t dims[1] ={3000};
+ hsize_t cdims[1]={30};
+ hid_t fid=-1;
+ hid_t did=-1;
+ hid_t sid=-1;
+ hid_t tid=-1;
+ hid_t dcpl=-1;
+ int i;
+ char name[10];
+ int iter=100;
+
+ if ((fid = H5Fcreate(FNAME5, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ return -1;
+ if (H5Fclose(fid) < 0)
+ goto out;
+
+ if ((sid = H5Screate_simple(1, dims, NULL)) < 0)
+ goto out;
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto out;
+ if (H5Pset_chunk(dcpl, 1, cdims) < 0)
+ goto out;
+ if (H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY) < 0)
+ goto out;
+
+ for(i = 0; i < iter; i++)
+ {
+ if ((fid = H5Fopen(FNAME5, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ goto out;
+ if ((did = H5Dcreate2(fid, "early", H5T_NATIVE_DOUBLE, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto out;
+ if ((tid = H5Tcopy(H5T_NATIVE_DOUBLE)) < 0)
+ goto out;
+ sprintf(name, "%d", i);
+ if ((H5Tcommit2(fid, name, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
+ if (H5Tclose(tid) < 0)
+ goto out;
+ if (H5Dclose(did) < 0)
+ goto out;
+ if (H5Ldelete(fid, "early", H5P_DEFAULT) < 0)
+ goto out;
+ if (H5Fclose(fid) < 0)
+ goto out;
+ }
+
+ /*-------------------------------------------------------------------------
+ * do the same without close/opening the file and creating the dataset
+ *-------------------------------------------------------------------------
+ */
+
+ if ((fid = H5Fcreate(FNAME6, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ return -1;
+
+ for(i = 0; i < iter; i++)
+ {
+ if ((tid = H5Tcopy(H5T_NATIVE_DOUBLE)) < 0)
+ goto out;
+ sprintf(name, "%d", i);
+ if ((H5Tcommit2(fid, name, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
+ if (H5Tclose(tid) < 0)
+ goto out;
+ }
+
+ if (H5Sclose(sid) < 0)
+ goto out;
+ if (H5Pclose(dcpl) < 0)
+ goto out;
+ if (H5Fclose(fid) < 0)
+ goto out;
+
+ return 0;
+
+out:
+ H5E_BEGIN_TRY
+ {
+ H5Tclose(tid);
+ H5Pclose(dcpl);
+ H5Sclose(sid);
+ H5Dclose(did);
+ H5Fclose(fid);
+ } H5E_END_TRY;
+ return -1;
+}
+
+
+/*-------------------------------------------------------------------------
+* Function: make_layout
+*
+* Purpose: make several datasets with several layouts in location LOC_ID
+*
+*-------------------------------------------------------------------------
+*/
+static
+int make_layout(hid_t loc_id)
+{
+ hid_t dcpl=-1; /* dataset creation property list */
+ hid_t sid=-1; /* dataspace ID */
+ hsize_t dims[RANK]={DIM1,DIM2};
+ hsize_t chunk_dims[RANK]={CDIM1,CDIM2};
+ int buf[DIM1][DIM2];
+ int i, j, n;
+ char name[6];
+
+
+ for (i=n=0; i<DIM1; i++)
+ {
+ for (j=0; j<DIM2; j++)
+ {
+ buf[i][j]=n++;
+ }
+ }
+
+ /*-------------------------------------------------------------------------
+ * make several dataset with no filters
+ *-------------------------------------------------------------------------
+ */
+ for (i=0; i<4; i++)
+ {
+ sprintf(name,"dset%d",i+1);
+ if (write_dset(loc_id,RANK,dims,name,H5T_NATIVE_INT,buf) < 0)
+ return -1;
+ }
+
+
+ /*-------------------------------------------------------------------------
+ * make several dataset with several layout options
+ *-------------------------------------------------------------------------
+ */
+ /* create a space */
+ if((sid = H5Screate_simple(RANK, dims, NULL)) < 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_COMPACT
+ *-------------------------------------------------------------------------
+ */
+ if(H5Pset_layout (dcpl,H5D_COMPACT) < 0)
+ goto out;
+ if (make_dset(loc_id,"dset_compact",sid,dcpl,buf) < 0)
+ {
+ goto out;
+ }
+
+ /*-------------------------------------------------------------------------
+ * H5D_CONTIGUOUS
+ *-------------------------------------------------------------------------
+ */
+ if(H5Pset_layout (dcpl,H5D_CONTIGUOUS) < 0)
+ goto out;
+ if (make_dset(loc_id,"dset_contiguous",sid,dcpl,buf) < 0)
+ {
+ goto out;
+ }
+
+ /*-------------------------------------------------------------------------
+ * H5D_CHUNKED
+ *-------------------------------------------------------------------------
+ */
+ if(H5Pset_chunk(dcpl, RANK, chunk_dims) < 0)
+ goto out;
+ if (make_dset(loc_id,"dset_chunk",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_layout2
+ *
+ * Purpose: create datasets with contiguous and chunked layouts:
+ *
+ * contig_small: < 1k, fixed dims datspace
+ * chunked_small_fixed: < 1k, fixed dims dataspace
+ *
+ *-------------------------------------------------------------------------
+ */
+#define S_DIM1 4
+#define S_DIM2 10
+#define CONTIG_S "contig_small"
+#define CHUNKED_S_FIX "chunked_small_fixed"
+
+static
+int make_layout2(hid_t loc_id)
+{
+
+ hid_t contig_dcpl = -1; /* dataset creation property list */
+ hid_t chunked_dcpl = -1; /* dataset creation property list */
+
+ int i, j, n; /* Local index variables */
+ int ret_value = -1; /* Return value */
+ hid_t s_sid = -1; /* dataspace ID */
+
+ hsize_t s_dims[RANK] = {S_DIM1,S_DIM2}; /* Dataspace (< 1 k) */
+ hsize_t chunk_dims[RANK] = {S_DIM1/2, S_DIM2/2}; /* Dimension sizes for chunks */
+
+ int s_buf[S_DIM1][S_DIM2]; /* Temporary buffer */
+
+ for(i = n = 0; i < S_DIM1; i++) {
+ for (j = 0; j < S_DIM2; j++) {
+ s_buf[i][j] = n++;
+ }
+ }
+
+ /* Create dataspaces */
+ if((s_sid = H5Screate_simple(RANK, s_dims, NULL)) < 0)
+ goto out;
+
+ /* Create contiguous datasets */
+ if((contig_dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto out;
+ if(H5Pset_layout(contig_dcpl, H5D_CONTIGUOUS) < 0)
+ goto out;
+ if(make_dset(loc_id, CONTIG_S, s_sid, contig_dcpl, s_buf) < 0)
+ goto out;
+
+ /* Create chunked datasets */
+ if((chunked_dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto out;
+ if(H5Pset_chunk(chunked_dcpl, RANK, chunk_dims) < 0)
+ goto out;
+ if(make_dset(loc_id, CHUNKED_S_FIX, s_sid, chunked_dcpl, s_buf) < 0)
+ goto out;
+
+ ret_value = 0;
+
+out:
+ H5E_BEGIN_TRY {
+ H5Pclose(contig_dcpl);
+ H5Pclose(chunked_dcpl);
+
+ H5Sclose(s_sid);
+
+ } H5E_END_TRY;
+
+ return(ret_value);
+
+} /* 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
+/* small size */
+#define SDIM1_L3 4
+#define SDIM2_L3 50
+static
+int make_layout3(hid_t loc_id)
+{
+ hid_t dcpl1=-1; /* dataset creation property list */
+ hid_t dcpl2=-1; /* dataset creation property list */
+ hid_t dcpl3=-1; /* dataset creation property list */
+ hid_t sid1=-1; /* dataspace ID */
+ hid_t sid2=-1; /* dataspace ID */
+ hsize_t dims1[RANK]={DIM1_L3,DIM2_L3};
+ hsize_t dims2[RANK]={SDIM1_L3,SDIM2_L3};
+ hsize_t maxdims[RANK]={H5S_UNLIMITED, H5S_UNLIMITED};
+ hsize_t chunk_dims1[RANK]={DIM1_L3*2,5};
+ hsize_t chunk_dims2[RANK]={SDIM1_L3 + 2, SDIM2_L3/2};
+ hsize_t chunk_dims3[RANK]={SDIM1_L3 - 2, SDIM2_L3/2};
+ int buf1[DIM1_L3][DIM2_L3];
+ int buf2[SDIM1_L3][SDIM2_L3];
+ int i, j, n;
+
+ /* init buf1 */
+ for (i=n=0; i<DIM1_L3; i++)
+ {
+ for (j=0; j<DIM2_L3; j++)
+ {
+ buf1[i][j]=n++;
+ }
+ }
+
+ /* init buf2 */
+ for (i=n=0; i<SDIM1_L3; i++)
+ {
+ for (j=0; j<SDIM2_L3; j++)
+ {
+ buf2[i][j]=n++;
+ }
+ }
+
+ /*-------------------------------------------------------------------------
+ * make chunked dataset with
+ * - dset maxdims are UNLIMIT
+ * - a chunk dim is bigger than dset dim
+ * - dset size bigger than compact max (64K)
+ *-------------------------------------------------------------------------
+ */
+ /* create a space */
+ if((sid1 = H5Screate_simple(RANK, dims1, maxdims)) < 0)
+ return -1;
+ /* create a dataset creation property list; the same DCPL is used for all dsets */
+ if ((dcpl1 = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ {
+ goto out;
+ }
+
+ if(H5Pset_chunk(dcpl1, RANK, chunk_dims1) < 0)
+ goto out;
+ if (make_dset(loc_id,"chunk_unlimit1",sid1,dcpl1,buf1) < 0)
+ {
+ goto out;
+ }
+
+ /*-------------------------------------------------------------------------
+ * make chunked dataset with
+ * - dset maxdims are UNLIMIT
+ * - a chunk dim is bigger than dset dim
+ * - dset size smaller than compact (64K)
+ *-------------------------------------------------------------------------
+ */
+
+ /* create a space */
+ if((sid2 = H5Screate_simple(RANK, dims2, maxdims)) < 0)
+ return -1;
+ /* create a dataset creation property list; the same DCPL is used for all dsets */
+ if ((dcpl2 = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto out;
+
+ if(H5Pset_chunk(dcpl2, RANK, chunk_dims2) < 0)
+ goto out;
+
+ if (make_dset(loc_id,"chunk_unlimit2",sid2,dcpl2,buf2) < 0)
+ goto out;
+
+ /*-------------------------------------------------------------------------
+ * make chunked dataset with
+ * - dset maxdims are UNLIMIT
+ * - a chunk dims are smaller than dset dims
+ * - dset size smaller than compact (64K)
+ *-------------------------------------------------------------------------
+ */
+ /* create a dataset creation property list; the same DCPL is used for all dsets */
+ if ((dcpl3 = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto out;
+
+ if(H5Pset_chunk(dcpl3, RANK, chunk_dims3) < 0)
+ goto out;
+
+ if (make_dset(loc_id,"chunk_unlimit3",sid2,dcpl3,buf2) < 0)
+ goto out;
+
+ /*-------------------------------------------------------------------------
+ * close space and dcpl
+ *-------------------------------------------------------------------------
+ */
+ if(H5Sclose(sid1) < 0)
+ goto out;
+ if(H5Sclose(sid2) < 0)
+ goto out;
+ if(H5Pclose(dcpl1) < 0)
+ goto out;
+ if(H5Pclose(dcpl2) < 0)
+ goto out;
+ if(H5Pclose(dcpl3) < 0)
+ goto out;
+
+ return 0;
+
+out:
+ H5E_BEGIN_TRY
+ {
+ H5Sclose(sid1);
+ H5Sclose(sid2);
+ H5Pclose(dcpl1);
+ H5Pclose(dcpl2);
+ H5Pclose(dcpl3);
+ } H5E_END_TRY;
+ return -1;
+}
+
+/*-------------------------------------------------------------------------
+* Function: make a file with an integer dataset with a fill value
+*
+* Purpose: test copy of fill values
+*
+*-------------------------------------------------------------------------
+*/
+static
+int make_fill(hid_t loc_id)
+{
+ hid_t did=-1;
+ hid_t sid=-1;
+ hid_t dcpl;
+ hsize_t dims[2]={3,2};
+ int buf[3][2]= {{1,1},{1,2},{2,2}};
+ int fillvalue = 2;
+
+ /*-------------------------------------------------------------------------
+ * H5T_INTEGER, write a fill value
+ *-------------------------------------------------------------------------
+ */
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto out;
+ if(H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillvalue) < 0)
+ goto out;
+ if((sid = H5Screate_simple(2,dims,NULL)) < 0)
+ goto out;
+ if((did = H5Dcreate2(loc_id, "dset_fill", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto out;
+ if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ goto out;
+
+ /* close */
+ if(H5Sclose(sid) < 0)
+ goto out;
+ if(H5Pclose(dcpl) < 0)
+ goto out;
+ if(H5Dclose(did) < 0)
+ goto out;
+
+ return 0;
+
+out:
+ H5E_BEGIN_TRY {
+ H5Pclose(dcpl);
+ H5Sclose(sid);
+ H5Dclose(did);
+ } H5E_END_TRY;
+ return -1;
+
+}
+
+/*-------------------------------------------------------------------------
+* Function: make_big
+*
+* Purpose: used in test read by hyperslabs. Creates a 128MB dataset.
+* Only 1 1024Kb hyperslab is written.
+*
+*-------------------------------------------------------------------------
+*/
+static
+int make_big(hid_t loc_id)
+{
+ hid_t did=-1;
+ hid_t f_sid=-1;
+ hid_t m_sid=-1;
+ hid_t tid;
+ hid_t dcpl;
+ hsize_t dims[1]={ H5TOOLS_MALLOCSIZE + 1}; /* dataset dimensions */
+ hsize_t hs_size[1]; /* hyperslab dimensions */
+ hsize_t hs_start[1]; /* hyperslab start */
+ hsize_t chunk_dims[1]={1024}; /* chunk dimensions */
+ size_t size;
+ size_t nelmts=(size_t)1024;
+ signed char fillvalue=-1;
+ signed char *buf=NULL;
+
+ /* write one 1024 byte hyperslab */
+ hs_start[0] = 0;
+ hs_size[0] = 1024;
+
+ /* create */
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto out;
+ if(H5Pset_fill_value(dcpl, H5T_NATIVE_SCHAR, &fillvalue) < 0)
+ goto out;
+ if(H5Pset_chunk(dcpl, 1, chunk_dims) < 0)
+ goto out;
+ if((f_sid = H5Screate_simple(1,dims,NULL)) < 0)
+ goto out;
+ if((did = H5Dcreate2(loc_id, "dset", H5T_NATIVE_SCHAR, f_sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto out;
+ if((m_sid = H5Screate_simple(1, hs_size, hs_size)) < 0)
+ goto out;
+ if((tid = H5Dget_type(did)) < 0)
+ goto out;
+ if((size = H5Tget_size(tid))<=0)
+ goto out;
+
+ /* initialize buffer to 0 */
+ buf=(signed char *) HDcalloc( nelmts, size);
+
+ if (H5Sselect_hyperslab (f_sid,H5S_SELECT_SET,hs_start,NULL,hs_size, NULL) < 0)
+ goto out;
+ if (H5Dwrite (did,H5T_NATIVE_SCHAR,m_sid,f_sid,H5P_DEFAULT,buf) < 0)
+ goto out;
+
+ HDfree(buf);
+ buf=NULL;
+
+ /* close */
+ if(H5Sclose(f_sid) < 0)
+ goto out;
+ if(H5Sclose(m_sid) < 0)
+ goto out;
+ if(H5Pclose(dcpl) < 0)
+ goto out;
+ if(H5Dclose(did) < 0)
+ goto out;
+
+ return 0;
+
+out:
+ H5E_BEGIN_TRY {
+ H5Pclose(dcpl);
+ H5Sclose(f_sid);
+ H5Sclose(m_sid);
+ H5Dclose(did);
+ } H5E_END_TRY;
+ return -1;
+
+}
+
+
+/*-------------------------------------------------------------------------
+* Function: make_external
+*
+* Purpose: create a external dataset
+*
+*-------------------------------------------------------------------------
+*/
+static
+int make_external(hid_t loc_id)
+{
+ hid_t did=-1;
+ hid_t sid=-1;
+ hid_t dcpl;
+ int buf[2]={1,2};
+ hsize_t cur_size[1]; /* data space current size */
+ hsize_t max_size[1]; /* data space maximum size */
+ hsize_t size;
+
+ cur_size[0] = max_size[0] = 2;
+ size = max_size[0] * sizeof(int);
+
+ /* create */
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto out;
+ if(H5Pset_external(dcpl, H5REPACK_EXTFILE, (off_t)0, size) < 0)
+ goto out;
+ if((sid = H5Screate_simple(1,cur_size, max_size)) < 0)
+ goto out;
+ if((did = H5Dcreate2(loc_id, "external", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto out;
+ if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ goto out;
+
+ /* close */
+ if(H5Sclose(sid) < 0)
+ goto out;
+ if(H5Pclose(dcpl) < 0)
+ goto out;
+ if(H5Dclose(did) < 0)
+ goto out;
+
+ return 0;
+
+out:
+ H5E_BEGIN_TRY
+ {
+ H5Pclose(dcpl);
+ H5Sclose(sid);
+ H5Dclose(did);
+ } H5E_END_TRY;
+ return -1;
+
+}
+
+/*-------------------------------------------------------------------------
+* Function: make_userblock
+*
+* Purpose: create a file for the userblock copying test
+*
+*-------------------------------------------------------------------------
+*/
+static int
+make_userblock(void)
+{
+ hid_t fid = -1;
+ hid_t fcpl = -1;
+ int fd = -1; /* File descriptor for writing userblock */
+ char ub[USERBLOCK_SIZE]; /* User block data */
+ ssize_t nwritten; /* # of bytes written */
+ size_t u; /* Local index variable */
+
+ /* Create file creation property list with userblock set */
+ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ goto out;
+ if(H5Pset_userblock(fcpl, (hsize_t)USERBLOCK_SIZE) < 0)
+ goto out;
+
+ /* Create file with userblock */
+ if((fid = H5Fcreate(FNAME16, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0)
+ goto out;
+ if(H5Fclose(fid) < 0)
+ goto out;
+
+ /* Close file creation property list */
+ if(H5Pclose(fcpl) < 0)
+ goto out;
+
+
+ /* Initialize userblock data */
+ for(u = 0; u < USERBLOCK_SIZE; u++)
+ ub[u] = (char)('a' + (char)(u % 26));
+
+ /* Re-open HDF5 file, as "plain" file */
+ if((fd = HDopen(FNAME16, O_WRONLY, 0644)) < 0)
+ goto out;
+
+ /* Write userblock data */
+ nwritten = HDwrite(fd, ub, (size_t)USERBLOCK_SIZE);
+ HDassert(nwritten == USERBLOCK_SIZE);
+
+ /* Close file */
+ HDclose(fd);
+
+ return 0;
+
+out:
+ H5E_BEGIN_TRY {
+ H5Pclose(fcpl);
+ H5Fclose(fid);
+ } H5E_END_TRY;
+ if(fd > 0)
+ HDclose(fd);
+
+ return -1;
+} /* end make_userblock() */
+
+/*-------------------------------------------------------------------------
+* Function: verify_userblock
+*
+* Purpose: Verify that the userblock was copied correctly
+*
+*-------------------------------------------------------------------------
+*/
+static int
+verify_userblock( const char* filename)
+{
+ hid_t fid = -1;
+ hid_t fcpl = -1;
+ int fd = -1; /* File descriptor for writing userblock */
+ char ub[USERBLOCK_SIZE]; /* User block data */
+ hsize_t ub_size = 0; /* User block size */
+ ssize_t nread; /* # of bytes read */
+ size_t u; /* Local index variable */
+
+ /* Open file with userblock */
+ if((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ goto out;
+
+ /* Retrieve file creation property list & userblock size */
+ if((fcpl = H5Fget_create_plist(fid)) < 0)
+ goto out;
+ if(H5Pget_userblock(fcpl, &ub_size) < 0)
+ goto out;
+
+ /* Verify userblock size is correct */
+ if(ub_size != USERBLOCK_SIZE)
+ goto out;
+
+ /* Close file creation property list */
+ if(H5Pclose(fcpl) < 0)
+ goto out;
+
+ if(H5Fclose(fid) < 0)
+ goto out;
+
+
+ /* Re-open HDF5 file, as "plain" file */
+ if((fd = HDopen(filename, O_RDONLY, 0)) < 0)
+ goto out;
+
+ /* Read userblock data */
+ nread = HDread(fd, ub, (size_t)USERBLOCK_SIZE);
+ HDassert(nread == USERBLOCK_SIZE);
+
+ /* Verify userblock data */
+ for(u = 0; u < USERBLOCK_SIZE; u++)
+ if(ub[u] != (char)('a' + (u % 26)))
+ goto out;
+
+ /* Close file */
+ HDclose(fd);
+
+ return 0;
+
+out:
+ H5E_BEGIN_TRY {
+ H5Pclose(fcpl);
+ H5Fclose(fid);
+ } H5E_END_TRY;
+ if(fd > 0)
+ HDclose(fd);
+
+ return -1;
+} /* end verify_userblock() */
+
+
+/*-------------------------------------------------------------------------
+* Function: make_userblock_file
+*
+* Purpose: create a file for the userblock add test
+*
+*-------------------------------------------------------------------------
+*/
+static int
+make_userblock_file(void)
+{
+ int fd = -1; /* File descriptor for writing userblock */
+ char ub[USERBLOCK_SIZE]; /* User block data */
+ ssize_t nwritten; /* # of bytes written */
+ size_t u; /* Local index variable */
+
+ /* initialize userblock data */
+ for(u = 0; u < USERBLOCK_SIZE; u++)
+ ub[u] = (char)('a' + (char)(u % 26));
+
+ /* open file */
+ if((fd = HDopen(FNAME_UB,O_WRONLY|O_CREAT|O_TRUNC, 0644 )) < 0)
+ goto out;
+
+ /* write userblock data */
+ nwritten = HDwrite(fd, ub, (size_t)USERBLOCK_SIZE);
+ HDassert(nwritten == USERBLOCK_SIZE);
+
+ /* close file */
+ HDclose(fd);
+
+ return 0;
+
+out:
+
+ if(fd > 0)
+ HDclose(fd);
+
+ return -1;
+}
+
+/*-------------------------------------------------------------------------
+* Function: write_dset_in
+*
+* Purpose: write datasets in LOC_ID
+*
+* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+*
+* Date: November 12, 2003
+*
+*-------------------------------------------------------------------------
+*/
+static
+int write_dset_in(hid_t loc_id,
+ const char* dset_name, /* for saving reference to dataset*/
+ hid_t file_id,
+ int make_diffs /* flag to modify data buffers */)
+{
+ /* compound datatype */
+ typedef struct s_t
+ {
+ char a;
+ double b;
+ } s_t;
+
+ typedef enum
+ {
+ RED,
+ GREEN
+ } e_t;
+
+ hid_t did=-1;
+ hid_t sid=-1;
+ hid_t tid=-1;
+ hid_t pid=-1;
+ unsigned i, j;
+ int val, k, n;
+ float f;
+
+ /* create 1D attributes with dimension [2], 2 elements */
+ hsize_t dims[1]={2};
+ hsize_t dims1r[1]={2};
+ char buf1[2][3]= {"ab","de"}; /* string */
+ char buf2[2]= {1,2}; /* bitfield, opaque */
+ s_t buf3[2]= {{1,2},{3,4}}; /* compound */
+ hobj_ref_t buf4[2]; /* reference */
+ e_t buf45[2]= {RED,GREEN}; /* enum */
+ hvl_t buf5[2]; /* vlen */
+ hsize_t dimarray[1]={3}; /* array dimension */
+ int buf6[2][3]= {{1,2,3},{4,5,6}}; /* array */
+ int buf7[2]= {1,2}; /* integer */
+ float buf8[2]= {1,2}; /* float */
+
+ /* create 2D attributes with dimension [3][2], 6 elements */
+ hsize_t dims2[2]={3,2};
+ hsize_t dims2r[2]={1,1};
+ char buf12[6][3]= {"ab","cd","ef","gh","ij","kl"}; /* string */
+ char buf22[3][2]= {{1,2},{3,4},{5,6}}; /* bitfield, opaque */
+ s_t buf32[6]= {{1,2},{3,4},{5,6},{7,8},{9,10},{11,12}}; /* compound */
+ hobj_ref_t buf42[1][1]; /* reference */
+ hvl_t buf52[3][2]; /* vlen */
+ int buf62[6][3]= {{1,2,3},{4,5,6},{7,8,9},{10,11,12},{13,14,15},{16,17,18}}; /* array */
+ int buf72[3][2]= {{1,2},{3,4},{5,6}}; /* integer */
+ float buf82[3][2]= {{1,2},{3,4},{5,6}}; /* float */
+
+ /* create 3D attributes with dimension [4][3][2], 24 elements */
+ hsize_t dims3[3]={4,3,2};
+ hsize_t dims3r[3]={1,1,1};
+ char buf13[24][3]= {"ab","cd","ef","gh","ij","kl","mn","pq",
+ "rs","tu","vw","xz","AB","CD","EF","GH",
+ "IJ","KL","MN","PQ","RS","TU","VW","XZ"}; /* string */
+ char buf23[4][3][2]; /* bitfield, opaque */
+ s_t buf33[4][3][2]; /* compound */
+ hobj_ref_t buf43[1][1][1]; /* reference */
+ hvl_t buf53[4][3][2]; /* vlen */
+ int buf63[24][3]; /* array */
+ int buf73[4][3][2]; /* integer */
+ float buf83[4][3][2]; /* float */
+
+
+ /*-------------------------------------------------------------------------
+ * 1D
+ *-------------------------------------------------------------------------
+ */
+
+ /*-------------------------------------------------------------------------
+ * H5T_STRING
+ *-------------------------------------------------------------------------
+ */
+
+
+ if(make_diffs) {
+ for(i = 0; i < 2; i++)
+ for(j = 0; j < 2; j++)
+ buf1[i][j] = 'z';
+ }
+
+
+ if ((tid = H5Tcopy(H5T_C_S1)) < 0)
+ goto out;
+ if (H5Tset_size(tid, (size_t)2) < 0)
+ goto out;
+ if (write_dset(loc_id,1,dims,"string",tid,buf1) < 0)
+ goto out;
+ if (H5Tclose(tid) < 0)
+ goto out;
+
+
+ /* create hard link */
+ if (H5Lcreate_hard(loc_id, "string", H5L_SAME_LOC, "string_link", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ goto out;
+
+ /*-------------------------------------------------------------------------
+ * H5T_BITFIELD
+ *-------------------------------------------------------------------------
+ */
+
+ if(make_diffs) {
+ for(i = 0; i < 2; i++)
+ buf2[i] = buf2[1] = 0;
+ }
+
+ if ((tid = H5Tcopy(H5T_STD_B8LE)) < 0)
+ goto out;
+ if (write_dset(loc_id,1,dims,"bitfield",tid,buf2) < 0)
+ goto out;
+ if (H5Tclose(tid) < 0)
+ goto out;
+
+ /*-------------------------------------------------------------------------
+ * H5T_OPAQUE
+ *-------------------------------------------------------------------------
+ */
+
+ if(make_diffs) {
+ for(i = 0; i < 2; i++) {
+ buf3[i].a = 0;
+ buf3[i].b = 0;
+ }
+ }
+
+ if ((tid = H5Tcreate(H5T_OPAQUE, (size_t)1)) < 0)
+ goto out;
+ if (H5Tset_tag(tid, "1-byte opaque type") < 0)
+ goto out;
+ if (write_dset(loc_id,1,dims,"opaque",tid,buf2) < 0)
+ goto out;
+ if (H5Tclose(tid) < 0)
+ goto out;
+
+ /*-------------------------------------------------------------------------
+ * H5T_COMPOUND
+ *-------------------------------------------------------------------------
+ */
+
+
+ if(make_diffs) {
+ for(i = 0; i < 2; i++)
+ buf45[i] = GREEN;
+ }
+
+ if ((tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t))) < 0)
+ goto out;
+ if (H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR) < 0)
+ goto out;
+ if (H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE) < 0)
+ goto out;
+ if (write_dset(loc_id,1,dims,"compound",tid,buf3) < 0)
+ goto out;
+ if (H5Tclose(tid) < 0)
+ goto out;
+
+ /*-------------------------------------------------------------------------
+ * H5T_REFERENCE
+ *-------------------------------------------------------------------------
+ */
+ /* object references ( H5R_OBJECT ) */
+ buf4[0]=0;
+ buf4[1]=0;
+ if (dset_name)
+ {
+ if (H5Rcreate(&buf4[0],file_id,dset_name,H5R_OBJECT,(hid_t)-1) < 0)
+ goto out;
+ if (write_dset(loc_id,1,dims1r,"refobj",H5T_STD_REF_OBJ,buf4) < 0)
+ goto out;
+ }
+
+ /* Dataset region reference ( H5R_DATASET_REGION ) */
+ if (make_dset_reg_ref(loc_id) < 0)
+ goto out;
+
+
+ /*-------------------------------------------------------------------------
+ * H5T_ENUM
+ *-------------------------------------------------------------------------
+ */
+ if ((tid = H5Tcreate(H5T_ENUM, sizeof(e_t))) < 0)
+ goto out;
+ if (H5Tenum_insert(tid, "RED", (val = 0, &val)) < 0)
+ goto out;
+ if (H5Tenum_insert(tid, "GREEN", (val = 1, &val)) < 0)
+ goto out;
+ if (write_dset(loc_id,1,dims,"enum",tid,buf45) < 0)
+ goto out;
+ if (H5Tclose(tid) < 0)
+ goto out;
+
+ /*-------------------------------------------------------------------------
+ * H5T_VLEN
+ *-------------------------------------------------------------------------
+ */
+
+ /* Allocate and initialize VL dataset to write */
+
+ buf5[0].len = 1;
+ buf5[0].p = HDmalloc( 1 * sizeof(int));
+ ((int *)buf5[0].p)[0]=1;
+ buf5[1].len = 2;
+ buf5[1].p = HDmalloc( 2 * sizeof(int));
+ ((int *)buf5[1].p)[0] = 2;
+ ((int *)buf5[1].p)[1] = 3;
+
+ if(make_diffs) {
+ ((int *)buf5[0].p)[0] = 0;
+ ((int *)buf5[1].p)[0] = 0;
+ ((int *)buf5[1].p)[1] = 0;
+ }
+
+ if ((sid = H5Screate_simple(1, dims, NULL)) < 0)
+ goto out;
+ if ((tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0)
+ goto out;
+ if ((did = H5Dcreate2(loc_id, "vlen", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
+ if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf5) < 0)
+ goto out;
+ if (H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf5) < 0)
+ goto out;
+ if (H5Dclose(did) < 0)
+ goto out;
+ if (H5Tclose(tid) < 0)
+ goto out;
+ if (H5Sclose(sid) < 0)
+ goto out;
+
+ /*-------------------------------------------------------------------------
+ * H5T_ARRAY
+ *-------------------------------------------------------------------------
+ */
+
+ if(make_diffs) {
+ for(i = 0; i < 2; i++)
+ for(j = 0; j < 3; j++)
+ buf6[i][j] = 0;
+ }
+
+ if ((tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray)) < 0)
+ goto out;
+ if (write_dset(loc_id, 1, dims, "array", tid, buf6) < 0)
+ goto out;
+ if (H5Tclose(tid) < 0)
+ goto out;
+
+ {
+
+ hsize_t TEST_BUFSIZE = (128 * 1024 * 1024); /* 128MB */
+ double *dbuf; /* information to write */
+ size_t size;
+ hsize_t sdims[] = {1};
+ hsize_t tdims[] = {TEST_BUFSIZE / sizeof(double) + 1};
+ unsigned u;
+
+ /* allocate and initialize array data to write */
+ size = ( TEST_BUFSIZE / sizeof(double) + 1 ) * sizeof(double);
+ dbuf = (double*)HDmalloc( 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 < TEST_BUFSIZE / sizeof(double) + 1; u++)
+ dbuf[u] = u;
+
+ if (make_diffs)
+ {
+ dbuf[5] = 0;
+ dbuf[6] = 0;
+ }
+
+ /* create a type larger than TEST_BUFSIZE */
+ if ((tid = H5Tarray_create2(H5T_NATIVE_DOUBLE, 1, tdims)) < 0)
+ goto out;
+ size = H5Tget_size(tid);
+ if ((sid = H5Screate_simple(1, sdims, NULL)) < 0)
+ goto out;
+ if ((did = H5Dcreate2(loc_id, "arrayd", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
+#if defined(WRITE_ARRAY)
+ H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dbuf);
+#endif
+
+ /* close */
+ H5Dclose(did);
+ H5Tclose(tid);
+ H5Sclose(sid);
+ HDfree( dbuf );
+ }
+
+ /*-------------------------------------------------------------------------
+ * H5T_INTEGER and H5T_FLOAT
+ *-------------------------------------------------------------------------
+ */
+
+ if(make_diffs) {
+ for(i = 0; i < 2; i++) {
+ buf7[i] = 0;
+ buf8[i] = 0;
+ }
+ }
+
+ if (write_dset(loc_id,1,dims,"integer",H5T_NATIVE_INT,buf7) < 0)
+ goto out;
+ if (write_dset(loc_id,1,dims,"float",H5T_NATIVE_FLOAT,buf8) < 0)
+ goto out;
+
+
+ /*-------------------------------------------------------------------------
+ * 2D
+ *-------------------------------------------------------------------------
+ */
+
+ /*-------------------------------------------------------------------------
+ * H5T_STRING
+ *-------------------------------------------------------------------------
+ */
+
+ if (make_diffs)
+ {
+ HDmemset(buf12, 'z', sizeof buf12);
+ }
+
+
+ if ((tid = H5Tcopy(H5T_C_S1)) < 0)
+ goto out;
+ if (H5Tset_size(tid, (size_t)2) < 0)
+ goto out;
+ if (write_dset(loc_id,2,dims2,"string2D",tid,buf12) < 0)
+ goto out;
+ if (H5Tclose(tid) < 0)
+ goto out;
+
+ /*-------------------------------------------------------------------------
+ * H5T_BITFIELD
+ *-------------------------------------------------------------------------
+ */
+
+
+ if (make_diffs)
+ {
+ HDmemset(buf22,0,sizeof buf22);
+ }
+
+ if ((tid = H5Tcopy(H5T_STD_B8LE)) < 0)
+ goto out;
+ if (write_dset(loc_id,2,dims2,"bitfield2D",tid,buf22) < 0)
+ goto out;
+ if (H5Tclose(tid) < 0)
+ goto out;
+
+ /*-------------------------------------------------------------------------
+ * H5T_OPAQUE
+ *-------------------------------------------------------------------------
+ */
+ if ((tid = H5Tcreate(H5T_OPAQUE, (size_t)1)) < 0)
+ goto out;
+ if (H5Tset_tag(tid, "1-byte opaque type") < 0)
+ goto out;
+ if (write_dset(loc_id,2,dims2,"opaque2D",tid,buf22) < 0)
+ goto out;
+ if (H5Tclose(tid) < 0)
+ goto out;
+
+ /*-------------------------------------------------------------------------
+ * H5T_COMPOUND
+ *-------------------------------------------------------------------------
+ */
+
+ if (make_diffs)
+ {
+ HDmemset(buf32,0,sizeof buf32);
+ }
+
+ if ((tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t))) < 0)
+ goto out;
+ if (H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR) < 0)
+ goto out;
+ if (H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE) < 0)
+ goto out;
+ if (write_dset(loc_id,2,dims2,"compound2D",tid,buf32) < 0)
+ goto out;
+ if (H5Tclose(tid) < 0)
+ goto out;
+
+ /*-------------------------------------------------------------------------
+ * H5T_REFERENCE
+ *-------------------------------------------------------------------------
+ */
+ /* Create references to dataset */
+ if (dset_name)
+ {
+ if (H5Rcreate(&buf42[0][0], file_id, dset_name, H5R_OBJECT, (hid_t)-1) < 0)
+ goto out;
+ if (write_dset(loc_id, 2, dims2r, "refobj2D", H5T_STD_REF_OBJ, buf42) < 0)
+ goto out;
+ }
+
+ /*-------------------------------------------------------------------------
+ * H5T_ENUM
+ *-------------------------------------------------------------------------
+ */
+
+ if ((tid = H5Tcreate(H5T_ENUM, sizeof(e_t))) < 0)
+ goto out;
+ if (H5Tenum_insert(tid, "RED", (val = 0, &val)) < 0)
+ goto out;
+ if (H5Tenum_insert(tid, "GREEN", (val = 1, &val)) < 0)
+ goto out;
+ if (write_dset(loc_id,2,dims2,"enum2D",tid,0) < 0)
+ goto out;
+ if (H5Tclose(tid) < 0)
+ goto out;
+
+ /*-------------------------------------------------------------------------
+ * H5T_VLEN
+ *-------------------------------------------------------------------------
+ */
+
+ /* Allocate and initialize VL dataset to write */
+ n = 0;
+ for(i = 0; i < 3; i++) {
+ for(j = 0; j < 2; j++) {
+ unsigned l;
+
+ buf52[i][j].p = HDmalloc((i + 1) * sizeof(int));
+ 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++;
+ }
+ }
+ }
+
+ if ((sid = H5Screate_simple(2, dims2, NULL)) < 0)
+ goto out;
+ if ((tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0)
+ goto out;
+ if ((did = H5Dcreate2(loc_id, "vlen2D", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
+ if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf52) < 0)
+ goto out;
+ if (H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf52) < 0)
+ goto out;
+ if (H5Dclose(did) < 0)
+ goto out;
+ if (H5Tclose(tid) < 0)
+ goto out;
+ if (H5Sclose(sid) < 0)
+ goto out;
+
+ /*-------------------------------------------------------------------------
+ * H5T_ARRAY
+ *-------------------------------------------------------------------------
+ */
+
+ if (make_diffs)
+ {
+ HDmemset(buf62,0,sizeof buf62);
+ }
+
+
+ if ((tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray)) < 0)
+ goto out;
+ if (write_dset(loc_id, 2, dims2, "array2D", tid, buf62) < 0)
+ goto out;
+ if (H5Tclose(tid) < 0)
+ goto out;
+
+ /*-------------------------------------------------------------------------
+ * H5T_INTEGER, write a fill value
+ *-------------------------------------------------------------------------
+ */
+
+
+ if(make_diffs) {
+ HDmemset(buf72, 0, sizeof buf72);
+ HDmemset(buf82, 0, sizeof buf82);
+ }
+
+
+ if ((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto out;
+ if ((sid = H5Screate_simple(2, dims2, NULL)) < 0)
+ goto out;
+ if ((did = H5Dcreate2(loc_id, "integer2D", H5T_NATIVE_INT, sid, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0)
+ goto out;
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf72) < 0)
+ goto out;
+ if (H5Pclose(pid) < 0)
+ goto out;
+ if (H5Dclose(did) < 0)
+ goto out;
+ if (H5Sclose(sid) < 0)
+ goto out;
+
+ /*-------------------------------------------------------------------------
+ * H5T_FLOAT
+ *-------------------------------------------------------------------------
+ */
+
+ if (write_dset(loc_id,2,dims2,"float2D",H5T_NATIVE_FLOAT,buf82) < 0)
+ goto out;
+
+
+ /*-------------------------------------------------------------------------
+ * 3D
+ *-------------------------------------------------------------------------
+ */
+
+ /*-------------------------------------------------------------------------
+ * H5T_STRING
+ *-------------------------------------------------------------------------
+ */
+
+ if (make_diffs)
+ {
+ HDmemset(buf13,'z',sizeof buf13);
+ }
+
+ if ((tid = H5Tcopy(H5T_C_S1)) < 0)
+ goto out;
+ if (H5Tset_size(tid, (size_t)2) < 0)
+ goto out;
+ if (write_dset(loc_id,3,dims3,"string3D",tid,buf13) < 0)
+ goto out;
+ if (H5Tclose(tid) < 0)
+ goto out;
+
+ /*-------------------------------------------------------------------------
+ * H5T_BITFIELD
+ *-------------------------------------------------------------------------
+ */
+
+
+ n=1;
+ for(i = 0; i < 4; i++) {
+ for(j = 0; j < 3; j++) {
+ for(k = 0; k < 2; k++) {
+ if(make_diffs)
+ buf23[i][j][k] = 0;
+ else
+ buf23[i][j][k] = (char)(n++);
+ }
+ }
+ }
+
+
+ if ((tid = H5Tcopy(H5T_STD_B8LE)) < 0)
+ goto out;
+ if (write_dset(loc_id,3,dims3,"bitfield3D",tid,buf23) < 0)
+ goto out;
+ if (H5Tclose(tid) < 0)
+ goto out;
+
+ /*-------------------------------------------------------------------------
+ * H5T_OPAQUE
+ *-------------------------------------------------------------------------
+ */
+ if ((tid = H5Tcreate(H5T_OPAQUE, (size_t)1)) < 0)
+ goto out;
+ if (H5Tset_tag(tid, "1-byte opaque type") < 0)
+ goto out;
+ if (write_dset(loc_id,3,dims3,"opaque3D",tid,buf23) < 0)
+ goto out;
+ if (H5Tclose(tid) < 0)
+ goto out;
+
+ /*-------------------------------------------------------------------------
+ * H5T_COMPOUND
+ *-------------------------------------------------------------------------
+ */
+
+ n=1;
+ for(i = 0; i < 4; i++) {
+ for(j = 0; j < 3; j++) {
+ for(k = 0; k < 2; k++) {
+ if(make_diffs) {
+ buf33[i][j][k].a = 0;
+ buf33[i][j][k].b = 0;
+ }
+ else {
+ buf33[i][j][k].a = (char)(n++);
+ buf33[i][j][k].b = n++;
+ }
+ }
+ }
+ }
+
+
+ if ((tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t))) < 0)
+ goto out;
+ if (H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR) < 0)
+ goto out;
+ if (H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE) < 0)
+ goto out;
+ if (write_dset(loc_id,3,dims3,"compound3D",tid,buf33) < 0)
+ goto out;
+ if (H5Tclose(tid) < 0)
+ goto out;
+
+ /*-------------------------------------------------------------------------
+ * H5T_REFERENCE
+ *-------------------------------------------------------------------------
+ */
+ /* Create references to dataset */
+ if (dset_name)
+ {
+ if (H5Rcreate(&buf43[0][0][0], file_id, dset_name, H5R_OBJECT, (hid_t)-1) < 0)
+ goto out;
+ if (write_dset(loc_id, 3, dims3r, "refobj3D", H5T_STD_REF_OBJ, buf43) < 0)
+ goto out;
+ }
+
+ /*-------------------------------------------------------------------------
+ * H5T_ENUM
+ *-------------------------------------------------------------------------
+ */
+
+ if ((tid = H5Tcreate(H5T_ENUM, sizeof(e_t))) < 0)
+ goto out;
+ if (H5Tenum_insert(tid, "RED", (val = 0, &val)) < 0)
+ goto out;
+ if (H5Tenum_insert(tid, "GREEN", (val = 1, &val)) < 0)
+ goto out;
+ if (write_dset(loc_id,3,dims3,"enum3D",tid,0) < 0)
+ goto out;
+ if (H5Tclose(tid) < 0)
+ goto out;
+
+ /*-------------------------------------------------------------------------
+ * H5T_VLEN
+ *-------------------------------------------------------------------------
+ */
+
+ /* Allocate and initialize VL dataset to write */
+ n = 0;
+ for(i = 0; i < 4; i++) {
+ for(j = 0; j < 3; j++) {
+ for(k = 0; k < 2; k++) {
+ unsigned l;
+
+ buf53[i][j][k].p = HDmalloc((i + 1) * sizeof(int));
+ buf53[i][j][k].len = (size_t)(i + 1);
+ for(l = 0; l < i + 1; l++) {
+ if(make_diffs)
+ ((int *)buf53[i][j][k].p)[l] = 0;
+ else
+ ((int *)buf53[i][j][k].p)[l] = n++;
+ }
+ }
+ }
+ }
+
+ if ((sid = H5Screate_simple(3, dims3, NULL)) < 0)
+ goto out;
+ if ((tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0)
+ goto out;
+ if ((did = H5Dcreate2(loc_id, "vlen3D", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
+ if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf53) < 0)
+ goto out;
+
+ if (H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf53) < 0)
+ goto out;
+
+ if (H5Dclose(did) < 0)
+ goto out;
+ if (H5Tclose(tid) < 0)
+ goto out;
+ if (H5Sclose(sid) < 0)
+ goto out;
+
+ /*-------------------------------------------------------------------------
+ * H5T_ARRAY
+ *-------------------------------------------------------------------------
+ */
+
+
+ n = 1;
+ for(i = 0; i < 24; i++) {
+ for(j = 0; j < dimarray[0]; j++) {
+ if(make_diffs)
+ buf63[i][j] = 0;
+ else
+ buf63[i][j] = n++;
+ }
+ }
+
+ if ((tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray)) < 0)
+ goto out;
+ if (write_dset(loc_id, 3, dims3, "array3D", tid, buf63) < 0)
+ goto out;
+ if (H5Tclose(tid) < 0)
+ goto out;
+
+ /*-------------------------------------------------------------------------
+ * H5T_INTEGER and H5T_FLOAT
+ *-------------------------------------------------------------------------
+ */
+ n=1; f=1;
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < 3; j++) {
+ for (k = 0; k < 2; k++) {
+ if (make_diffs) {
+ buf73[i][j][k]=0;
+ buf83[i][j][k]=0;
+ }
+ else {
+ buf73[i][j][k]=n++;
+ buf83[i][j][k]=f++;
+ }
+ }
+ }
+ }
+ if (write_dset(loc_id,3,dims3,"integer3D",H5T_NATIVE_INT,buf73) < 0)
+ goto out;
+ if (write_dset(loc_id,3,dims3,"float3D",H5T_NATIVE_FLOAT,buf83) < 0)
+ goto out;
+
+ return 0;
+
+out:
+ H5E_BEGIN_TRY {
+ H5Pclose(pid);
+ H5Sclose(sid);
+ H5Dclose(did);
+ H5Tclose(tid);
+ } H5E_END_TRY;
+ return -1;
+}
+
+
+
+/*-------------------------------------------------------------------------
+* Function: make_dset_reg_ref
+*
+* Purpose: write dataset region references
+*
+*-------------------------------------------------------------------------
+*/
+
+#define SPACE1_RANK 1
+#define SPACE1_DIM1 1
+#define SPACE2_RANK 2
+#define SPACE2_DIM1 10
+#define SPACE2_DIM2 10
+static
+int make_dset_reg_ref(hid_t loc_id)
+{
+ hid_t did1=-1; /* Dataset ID */
+ hid_t did2=-1; /* Dereferenced dataset ID */
+ hid_t sid1=-1; /* Dataspace ID #1 */
+ hid_t sid2=-1; /* Dataspace ID #2 */
+ hsize_t dims1[] = {SPACE1_DIM1};
+ hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
+ hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */
+ hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */
+ hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */
+ hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */
+ hdset_reg_ref_t *wbuf=NULL; /* buffer to write to disk */
+ int *dwbuf=NULL; /* Buffer for writing numeric data to disk */
+ int i; /* counting variables */
+ int retval = -1; /* return value */
+
+ /* Allocate write & read buffers */
+ wbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)SPACE1_DIM1);
+ dwbuf = (int *)HDmalloc(sizeof(int) * SPACE2_DIM1 * SPACE2_DIM2);
+
+ /* Create dataspace for datasets */
+ if ((sid2 = H5Screate_simple(SPACE2_RANK, dims2, NULL)) < 0)
+ goto out;
+
+ /* Create a dataset */
+ if ((did2 = H5Dcreate2(loc_id, "dsetreg", H5T_NATIVE_UCHAR, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
+
+ for (i = 0; i < SPACE2_DIM1 * SPACE2_DIM2; i++)
+ dwbuf[i] = i * 3;
+
+ /* Write selection to disk */
+ if (H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dwbuf) < 0)
+ goto out;
+
+ /* Create dataspace for the reference dataset */
+ if ((sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL)) < 0)
+ goto out;
+
+ /* Create a dataset */
+ if ((did1 = H5Dcreate2(loc_id, "refreg", H5T_STD_REF_DSETREG, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
+
+ /* Select 6x6 hyperslab for first reference */
+ start[0] = 2; start[1] = 2;
+ stride[0] = 1; stride[1] = 1;
+ count[0] = 6; count[1] = 6;
+ block[0] = 1; block[1] = 1;
+ if (H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block) < 0)
+ goto out;
+
+
+ /* Store dataset region */
+ if (H5Rcreate(&wbuf[0], loc_id, "dsetreg", H5R_DATASET_REGION, sid2) < 0)
+ goto out;
+
+ /* Write selection to disk */
+ if (H5Dwrite(did1,H5T_STD_REF_DSETREG,H5S_ALL,H5S_ALL,H5P_DEFAULT,wbuf) < 0)
+ goto out;
+
+ /* Close all objects */
+ if (H5Sclose(sid1) < 0)
+ goto out;
+ if (H5Dclose(did1) < 0)
+ goto out;
+ if (H5Sclose(sid2) < 0)
+ goto out;
+ if (H5Dclose(did2) < 0)
+ goto out;
+
+ retval = 0;
+
+out:
+ if(wbuf)
+ HDfree(wbuf);
+ if(dwbuf)
+ HDfree(dwbuf);
+
+ H5E_BEGIN_TRY
+ {
+ H5Sclose(sid1);
+ H5Sclose(sid2);
+ H5Dclose(did1);
+ H5Dclose(did2);
+ } H5E_END_TRY;
+
+ return retval;
+}
+
+/*-------------------------------------------------------------------------
+* Function: write_attr_in
+*
+* Purpose: write attributes in LOC_ID (dataset, group, named datatype)
+*
+* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+*
+* Date: November 12, 2003
+*
+*-------------------------------------------------------------------------
+*/
+
+static
+int write_attr_in(hid_t loc_id,
+ const char* dset_name, /* for saving reference to dataset*/
+ hid_t fid, /* for reference create */
+ int make_diffs /* flag to modify data buffers */)
+{
+ /* Compound datatype */
+ typedef struct s_t
+ {
+ char a;
+ double b;
+ } s_t;
+
+ typedef enum
+ {
+ RED,
+ GREEN
+ } e_t;
+
+ hid_t aid = -1;
+ hid_t sid = -1;
+ hid_t tid = -1;
+ int val, j, k, n;
+ unsigned i;
+ float f;
+
+ /* create 1D attributes with dimension [2], 2 elements */
+ hsize_t dims[1]={2};
+ char buf1[2][3]= {"ab","de"}; /* string */
+ char buf2[2]= {1,2}; /* bitfield, opaque */
+ s_t buf3[2]= {{1,2},{3,4}}; /* compound */
+ hobj_ref_t buf4[2]; /* reference */
+ e_t buf45[2]= {RED,RED}; /* enum */
+ hvl_t buf5[2]; /* vlen */
+ hsize_t dimarray[1]={3}; /* array dimension */
+ int buf6[2][3]= {{1,2,3},{4,5,6}}; /* array */
+ int buf7[2]= {1,2}; /* integer */
+ float buf8[2]= {1,2}; /* float */
+
+ /* create 2D attributes with dimension [3][2], 6 elements */
+ hsize_t dims2[2]={3,2};
+ char buf12[6][3]= {"ab","cd","ef","gh","ij","kl"}; /* string */
+ char buf22[3][2]= {{1,2},{3,4},{5,6}}; /* bitfield, opaque */
+ s_t buf32[6]= {{1,2},{3,4},{5,6},{7,8},{9,10},{11,12}}; /* compound */
+ hobj_ref_t buf42[3][2]; /* reference */
+ e_t buf452[3][2]; /* enum */
+ hvl_t buf52[3][2]; /* vlen */
+ int buf62[6][3]= {{1,2,3},{4,5,6},{7,8,9},{10,11,12},{13,14,15},{16,17,18}}; /* array */
+ int buf72[3][2]= {{1,2},{3,4},{5,6}}; /* integer */
+ float buf82[3][2]= {{1,2},{3,4},{5,6}}; /* float */
+
+ /* create 3D attributes with dimension [4][3][2], 24 elements */
+ hsize_t dims3[3]={4,3,2};
+ char buf13[24][3]= {"ab","cd","ef","gh","ij","kl","mn","pq",
+ "rs","tu","vw","xz","AB","CD","EF","GH",
+ "IJ","KL","MN","PQ","RS","TU","VW","XZ"}; /* string */
+ char buf23[4][3][2]; /* bitfield, opaque */
+ s_t buf33[4][3][2]; /* compound */
+ hobj_ref_t buf43[4][3][2]; /* reference */
+ e_t buf453[4][3][2]; /* enum */
+ hvl_t buf53[4][3][2]; /* vlen */
+ int buf63[24][3]; /* array */
+ int buf73[4][3][2]; /* integer */
+ float buf83[4][3][2]; /* float */
+
+
+ /*-------------------------------------------------------------------------
+ * 1D attributes
+ *-------------------------------------------------------------------------
+ */
+
+ /*-------------------------------------------------------------------------
+ * H5T_STRING
+ *-------------------------------------------------------------------------
+ */
+
+ if (make_diffs)
+ {
+ for (i=0; i<2; i++)
+ for (j=0; j<2; j++)
+ {
+ buf1[i][j]='z';
+ }
+ }
+ /*
+ buf1[2][2]= {"ab","de"};
+ $h5diff file7.h5 file6.h5 g1 g1 -v
+ Group: </g1> and </g1>
+ Attribute: <string> and <string>
+ position string of </g1> string of </g1> difference
+ ------------------------------------------------------------
+ [ 0 ] a z
+ [ 0 ] b z
+ [ 1 ] d z
+ [ 1 ] e z
+ */
+ if ((tid = H5Tcopy(H5T_C_S1)) < 0)
+ goto out;
+ if (H5Tset_size(tid, (size_t)2) < 0)
+ goto out;
+ if (make_attr(loc_id,1,dims,"string",tid,buf1) < 0)
+ goto out;
+ if (H5Tclose(tid) < 0)
+ goto out;
+ tid = -1;
+
+ /*-------------------------------------------------------------------------
+ * H5T_BITFIELD
+ *-------------------------------------------------------------------------
+ */
+
+ if (make_diffs)
+ {
+ for (i=0; i<2; i++)
+ buf2[i]=buf2[1]=0;
+ }
+ /*
+ buf2[2]= {1,2};
+ $h5diff file7.h5 file6.h5 g1 g1 -v
+ Group: </g1> and </g1>
+ Attribute: <bitfield> and <bitfield>
+ position bitfield of </g1> bitfield of </g1> difference
+ position opaque of </g1> opaque of </g1> difference
+ ------------------------------------------------------------
+ [ 0 ] 1 0 1
+ [ 1 ] 2 0 2
+ */
+
+ if ((tid = H5Tcopy(H5T_STD_B8LE)) < 0)
+ goto out;
+ if (make_attr(loc_id,1,dims,"bitfield",tid,buf2) < 0)
+ goto out;
+ if (H5Tclose(tid) < 0)
+ goto out;
+ tid = -1;
+
+ /*-------------------------------------------------------------------------
+ * H5T_OPAQUE
+ *-------------------------------------------------------------------------
+ */
+
+ /*
+ buf2[2]= {1,2};
+ $h5diff file7.h5 file6.h5 g1 g1 -v
+ Group: </g1> and </g1>
+ Attribute: <opaque> and <opaque>
+ position opaque of </g1> opaque of </g1> difference
+ position opaque of </g1> opaque of </g1> difference
+ ------------------------------------------------------------
+ [ 0 ] 1 0 1
+ [ 1 ] 2 0 2
+ */
+
+ if ((tid = H5Tcreate(H5T_OPAQUE, (size_t)1)) < 0)
+ goto out;
+ if (H5Tset_tag(tid, "1-byte opaque type") < 0)
+ goto out;
+ if (make_attr(loc_id,1,dims,"opaque",tid,buf2) < 0)
+ goto out;
+ if (H5Tclose(tid) < 0)
+ goto out;
+ tid = -1;
+
+ /*-------------------------------------------------------------------------
+ * H5T_COMPOUND
+ *-------------------------------------------------------------------------
+ */
+
+ if (make_diffs)
+ {
+ for (i=0; i<2; i++)
+ {
+ buf3[i].a=0; buf3[i].b=0;
+ }
+ }
+
+ /*
+ buf3[2]= {{1,2},{3,4}};
+ $h5diff file7.h5 file6.h5 g1 g1 -v
+ Group: </g1> and </g1>
+ Attribute: <compound> and <compound>
+ position compound of </g1> compound of </g1> difference
+ ------------------------------------------------------------
+ [ 0 ] 1 5 4
+ [ 0 ] 2 5 3
+ [ 1 ] 3 5 2
+ [ 1 ] 4 5 1
+ */
+
+ if ((tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t))) < 0)
+ goto out;
+ if (H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR) < 0)
+ goto out;
+ if (H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE) < 0)
+ goto out;
+ if (make_attr(loc_id,1,dims,"compound",tid,buf3) < 0)
+ goto out;
+ if (H5Tclose(tid) < 0)
+ goto out;
+ tid = -1;
+
+ /*-------------------------------------------------------------------------
+ * H5T_REFERENCE
+ *-------------------------------------------------------------------------
+ */
+ /* object references ( H5R_OBJECT */
+ if (dset_name)
+ {
+ if (H5Rcreate(&buf4[0],fid,dset_name,H5R_OBJECT,(hid_t)-1) < 0)
+ goto out;
+ if (H5Rcreate(&buf4[1],fid,dset_name,H5R_OBJECT,(hid_t)-1) < 0)
+ goto out;
+ if (make_attr(loc_id,1,dims,"reference",H5T_STD_REF_OBJ,buf4) < 0)
+ goto out;
+ }
+
+
+ /*-------------------------------------------------------------------------
+ * H5T_ENUM
+ *-------------------------------------------------------------------------
+ */
+ if (make_diffs)
+ {
+ for (i=0; i<2; i++)
+ {
+ buf45[i]=GREEN;
+ }
+ }
+ /*
+ buf45[2]= {RED,RED};
+ $h5diff file7.h5 file6.h5 g1 g1 -v
+ Group: </g1> and </g1>
+ Attribute: <enum> and <enum>
+ position enum of </g1> enum of </g1> difference
+ ------------------------------------------------------------
+ [ 0 ] RED GREEN
+ [ 1 ] RED GREEN
+ */
+ if ((tid = H5Tcreate(H5T_ENUM, sizeof(e_t))) < 0)
+ goto out;
+ if (H5Tenum_insert(tid, "RED", (val = 0, &val)) < 0)
+ goto out;
+ if (H5Tenum_insert(tid, "GREEN", (val = 1, &val)) < 0)
+ goto out;
+ if (make_attr(loc_id,1,dims,"enum",tid,buf45) < 0)
+ goto out;
+ if (H5Tclose(tid) < 0)
+ goto out;
+ tid = -1;
+
+ /*-------------------------------------------------------------------------
+ * H5T_VLEN
+ *-------------------------------------------------------------------------
+ */
+
+ /* Allocate and initialize VL dataset to write */
+
+ buf5[0].len = 1;
+ buf5[0].p = HDmalloc( 1 * sizeof(int));
+ ((int *)buf5[0].p)[0]=1;
+ buf5[1].len = 2;
+ buf5[1].p = HDmalloc(2 * sizeof(int));
+ ((int *)buf5[1].p)[0] = 2;
+ ((int *)buf5[1].p)[1] = 3;
+
+ if(make_diffs)
+ {
+ ((int *)buf5[0].p)[0] = 0;
+ ((int *)buf5[1].p)[0] = 0;
+ ((int *)buf5[1].p)[1] = 0;
+ }
+ /*
+ $h5diff file7.h5 file6.h5 g1 g1 -v
+ Group: </g1> and </g1>
+ position vlen of </g1> vlen of </g1> difference
+ ------------------------------------------------------------
+ [ 0 ] 1 0 1
+ [ 1 ] 2 0 2
+ [ 1 ] 3 0 3
+ */
+
+ if ((sid = H5Screate_simple(1, dims, NULL)) < 0)
+ goto out;
+ if ((tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0)
+ goto out;
+ if ((aid = H5Acreate2(loc_id, "vlen", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
+ if (H5Awrite(aid, tid, buf5) < 0)
+ goto out;
+ if (H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf5) < 0)
+ goto out;
+ if (H5Aclose(aid) < 0)
+ goto out;
+ aid = -1;
+ if (H5Tclose(tid) < 0)
+ goto out;
+ tid = -1;
+ if (H5Sclose(sid) < 0)
+ goto out;
+ sid = -1;
+
+ /*-------------------------------------------------------------------------
+ * H5T_ARRAY
+ *-------------------------------------------------------------------------
+ */
+
+ if (make_diffs)
+ {
+ for (i=0; i<2; i++)
+ for (j=0; j<3; j++)
+ {
+ buf6[i][j]=0;
+ }
+ }
+ /*
+ buf6[2][3]= {{1,2,3},{4,5,6}};
+ $h5diff file7.h5 file6.h5 g1 g1 -v
+ Group: </g1> and </g1>
+ Attribute: <array> and <array>
+ position array of </g1> array of </g1> difference
+ ------------------------------------------------------------
+ [ 0 ] 1 0 1
+ [ 0 ] 2 0 2
+ [ 0 ] 3 0 3
+ [ 1 ] 4 0 4
+ [ 1 ] 5 0 5
+ [ 1 ] 6 0 6
+ */
+ if ((tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray)) < 0)
+ goto out;
+ if (make_attr(loc_id, 1, dims, "array", tid, buf6) < 0)
+ goto out;
+ if (H5Tclose(tid) < 0)
+ goto out;
+ tid = -1;
+
+ /*-------------------------------------------------------------------------
+ * H5T_INTEGER and H5T_FLOAT
+ *-------------------------------------------------------------------------
+ */
+
+ if(make_diffs)
+ {
+ for(i = 0; i < 2; i++)
+ {
+ buf7[i]=0;
+ buf8[i]=0;
+ }
+ }
+
+ /*
+ buf7[2]= {1,2};
+ buf8[2]= {1,2};
+ $h5diff file7.h5 file6.h5 g1 g1 -v
+ Group: </g1> and </g1>
+ position integer of </g1> integer of </g1> difference
+ ------------------------------------------------------------
+ [ 0 ] 1 0 1
+ [ 1 ] 2 0 2
+ position float of </g1> float of </g1> difference
+ ------------------------------------------------------------
+ [ 0 ] 1 0 1
+ [ 1 ] 2 0 2
+ */
+ if (make_attr(loc_id,1,dims,"integer",H5T_NATIVE_INT,buf7) < 0)
+ goto out;
+ if (make_attr(loc_id,1,dims,"float",H5T_NATIVE_FLOAT,buf8) < 0)
+ goto out;
+
+
+ /*-------------------------------------------------------------------------
+ * 2D attributes
+ *-------------------------------------------------------------------------
+ */
+
+ /*-------------------------------------------------------------------------
+ * H5T_STRING
+ *-------------------------------------------------------------------------
+ */
+ if (make_diffs)
+ {
+ HDmemset(buf12, 'z', sizeof buf12);
+ }
+
+ /*
+ buf12[6][2]= {"ab","cd","ef","gh","ij","kl"};
+ $h5diff file7.h5 file6.h5 g1 g1 -v
+ Attribute: <string2D> and <string2D>
+ position string2D of </g1> string2D of </g1> difference
+ ------------------------------------------------------------
+ [ 0 0 ] a z
+ [ 0 0 ] b z
+ [ 0 1 ] c z
+ [ 0 1 ] d z
+ [ 1 0 ] e z
+ [ 1 0 ] f z
+ [ 1 1 ] g z
+ [ 1 1 ] h z
+ [ 2 0 ] i z
+ [ 2 0 ] j z
+ [ 2 1 ] k z
+ [ 2 1 ] l z
+ */
+
+ if ((tid = H5Tcopy(H5T_C_S1)) < 0)
+ goto out;
+ if (H5Tset_size(tid, (size_t)2) < 0)
+ goto out;
+ if (make_attr(loc_id,2,dims2,"string2D",tid,buf12) < 0)
+ goto out;
+ if (H5Tclose(tid) < 0)
+ goto out;
+ tid = -1;
+
+ /*-------------------------------------------------------------------------
+ * H5T_BITFIELD
+ *-------------------------------------------------------------------------
+ */
+
+ if (make_diffs)
+ {
+ HDmemset(buf22,0,sizeof buf22);
+ }
+
+ /*
+ buf22[3][2]= {{1,2},{3,4},{5,6}};
+ $h5diff file7.h5 file6.h5 g1 g1 -v
+ Attribute: <bitfield2D> and <bitfield2D>
+ position bitfield2D of </g1> bitfield2D of </g1> difference
+ ------------------------------------------------------------
+ [ 0 0 ] 1 0 1
+ [ 0 1 ] 2 0 2
+ [ 1 0 ] 3 0 3
+ [ 1 1 ] 4 0 4
+ [ 2 0 ] 5 0 5
+ [ 2 1 ] 6 0 6
+ */
+
+
+ if ((tid = H5Tcopy(H5T_STD_B8LE)) < 0)
+ goto out;
+ if (make_attr(loc_id,2,dims2,"bitfield2D",tid,buf22) < 0)
+ goto out;
+ if (H5Tclose(tid) < 0)
+ goto out;
+ tid = -1;
+
+ /*-------------------------------------------------------------------------
+ * H5T_OPAQUE
+ *-------------------------------------------------------------------------
+ */
+
+ /*
+ buf22[3][2]= {{1,2},{3,4},{5,6}};
+ $h5diff file7.h5 file6.h5 g1 g1 -v
+ Attribute: <opaque2D> and <opaque2D>
+ position opaque2D of </g1> opaque2D of </g1> difference
+ ------------------------------------------------------------
+ [ 0 0 ] 1 0 1
+ [ 0 1 ] 2 0 2
+ [ 1 0 ] 3 0 3
+ [ 1 1 ] 4 0 4
+ [ 2 0 ] 5 0 5
+ [ 2 1 ] 6 0 6
+ */
+ if ((tid = H5Tcreate(H5T_OPAQUE, (size_t)1)) < 0)
+ goto out;
+ if (H5Tset_tag(tid, "1-byte opaque type") < 0)
+ goto out;
+ if (make_attr(loc_id,2,dims2,"opaque2D",tid,buf22) < 0)
+ goto out;
+ if (H5Tclose(tid) < 0)
+ goto out;
+ tid = -1;
+
+ /*-------------------------------------------------------------------------
+ * H5T_COMPOUND
+ *-------------------------------------------------------------------------
+ */
+ if (make_diffs)
+ {
+ HDmemset(buf32,0,sizeof buf32);
+ }
+
+ /*
+ buf32[6]= {{1,2},{3,4},{5,6},{7,8},{9,10},{11,12}};
+ $h5diff file7.h5 file6.h5 g1 g1 -v
+ Attribute: <opaque2D> and <opaque2D>
+ position opaque2D of </g1> opaque2D of </g1> difference
+ ------------------------------------------------------------
+ [ 0 0 ] 1 0 1
+ [ 0 1 ] 2 0 2
+ [ 1 0 ] 3 0 3
+ [ 1 1 ] 4 0 4
+ [ 2 0 ] 5 0 5
+ [ 2 1 ] 6 0 6
+ */
+
+
+ if ((tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t))) < 0)
+ goto out;
+ if (H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR) < 0)
+ goto out;
+ if (H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE) < 0)
+ goto out;
+ if (make_attr(loc_id,2,dims2,"compound2D",tid,buf32) < 0)
+ goto out;
+ if (H5Tclose(tid) < 0)
+ goto out;
+ tid = -1;
+
+ /*-------------------------------------------------------------------------
+ * H5T_REFERENCE
+ *-------------------------------------------------------------------------
+ */
+ /* Create references to dataset */
+ if (dset_name)
+ {
+ for (i = 0; i < 3; i++)
+ {
+ for (j = 0; j < 2; j++)
+ {
+ if (H5Rcreate(&buf42[i][j],fid,dset_name,H5R_OBJECT,(hid_t)-1) < 0)
+ goto out;
+ }
+ }
+ if (make_attr(loc_id,2,dims2,"reference2D",H5T_STD_REF_OBJ,buf42) < 0)
+ goto out;
+ }
+
+ /*-------------------------------------------------------------------------
+ * H5T_ENUM
+ *-------------------------------------------------------------------------
+ */
+ for (i=0; i<3; i++)
+ {
+ for (j=0; j<2; j++)
+ {
+ if (make_diffs) buf452[i][j]=GREEN; else buf452[i][j]=RED;
+ }
+ }
+
+ /*
+ Attribute: <enum2D> and <enum2D>
+ position enum2D of </g1> enum2D of </g1> difference
+ ------------------------------------------------------------
+ [ 0 0 ] RED GREEN
+ [ 0 1 ] RED GREEN
+ [ 1 0 ] RED GREEN
+ [ 1 1 ] RED GREEN
+ [ 2 0 ] RED GREEN
+ [ 2 1 ] RED GREEN
+ */
+
+ if ((tid = H5Tcreate(H5T_ENUM, sizeof(e_t))) < 0)
+ goto out;
+ if (H5Tenum_insert(tid, "RED", (val = 0, &val)) < 0)
+ goto out;
+ if (H5Tenum_insert(tid, "GREEN", (val = 1, &val)) < 0)
+ goto out;
+ if (make_attr(loc_id,2,dims2,"enum2D",tid,buf452) < 0)
+ goto out;
+ if (H5Tclose(tid) < 0)
+ goto out;
+ tid = -1;
+
+ /*-------------------------------------------------------------------------
+ * H5T_VLEN
+ *-------------------------------------------------------------------------
+ */
+
+ /* Allocate and initialize VL dataset to write */
+ n=0;
+ for(i = 0; i < 3; i++) {
+ for(j = 0; j < 2; j++) {
+ unsigned l;
+
+ buf52[i][j].p = HDmalloc((i + 1) * sizeof(int));
+ 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++;
+ }
+ }
+
+ /*
+ position vlen2D of </g1> vlen2D of </g1> difference
+ ------------------------------------------------------------
+ [ 0 1 ] 1 0 1
+ [ 1 0 ] 2 0 2
+ [ 1 0 ] 3 0 3
+ [ 1 1 ] 4 0 4
+ [ 1 1 ] 5 0 5
+ [ 2 0 ] 6 0 6
+ [ 2 0 ] 7 0 7
+ [ 2 0 ] 8 0 8
+ [ 2 1 ] 9 0 9
+ [ 2 1 ] 10 0 10
+ [ 2 1 ] 11 0 11
+ */
+
+ if ((sid = H5Screate_simple(2, dims2, NULL)) < 0)
+ goto out;
+ if ((tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0)
+ goto out;
+ if ((aid = H5Acreate2(loc_id, "vlen2D", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
+ if (H5Awrite(aid, tid, buf52) < 0)
+ goto out;
+ if (H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf52) < 0)
+ goto out;
+ if (H5Aclose(aid) < 0)
+ goto out;
+ aid = -1;
+ if (H5Tclose(tid) < 0)
+ goto out;
+ tid = -1;
+ if (H5Sclose(sid) < 0)
+ goto out;
+ sid = -1;
+
+ /*-------------------------------------------------------------------------
+ * H5T_ARRAY
+ *-------------------------------------------------------------------------
+ */
+
+ if (make_diffs)
+ {
+ HDmemset(buf62,0,sizeof buf62);
+ }
+ /*
+ buf62[6][3]= {{1,2,3},{4,5,6},{7,8,9},{10,11,12},{13,14,15},{16,17,18}};
+ $h5diff file7.h5 file6.h5 g1 g1 -v
+ Group: </g1> and </g1>
+ Attribute: <array2D> and <array2D>
+ position array2D of </g1> array2D of </g1> difference
+ ------------------------------------------------------------
+ [ 0 0 ] 1 0 1
+ [ 0 0 ] 2 0 2
+ [ 0 0 ] 3 0 3
+ [ 0 1 ] 4 0 4
+ [ 0 1 ] 5 0 5
+ [ 0 1 ] 6 0 6
+ [ 1 0 ] 7 0 7
+ [ 1 0 ] 8 0 8
+ [ 1 0 ] 9 0 9
+ [ 1 1 ] 10 0 10
+ [ 1 1 ] 11 0 11
+ [ 1 1 ] 12 0 12
+ [ 2 0 ] 13 0 13
+ [ 2 0 ] 14 0 14
+ [ 2 0 ] 15 0 15
+ [ 2 1 ] 16 0 16
+ [ 2 1 ] 17 0 17
+ [ 2 1 ] 18 0 18
+ */
+ if ((tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray)) < 0)
+ goto out;
+ if (make_attr(loc_id, 2, dims2, "array2D", tid, buf62) < 0)
+ goto out;
+ if (H5Tclose(tid) < 0)
+ goto out;
+ tid = -1;
+
+ /*-------------------------------------------------------------------------
+ * H5T_INTEGER and H5T_FLOAT
+ *-------------------------------------------------------------------------
+ */
+
+ if(make_diffs)
+ {
+ HDmemset(buf72, 0, sizeof buf72);
+ HDmemset(buf82, 0, sizeof buf82);
+ }
+ /*
+ Attribute: <integer2D> and <integer2D>
+ position integer2D of </g1> integer2D of </g1> difference
+ ------------------------------------------------------------
+ [ 0 0 ] 1 0 1
+ [ 0 1 ] 2 0 2
+ [ 1 0 ] 3 0 3
+ [ 1 1 ] 4 0 4
+ [ 2 0 ] 5 0 5
+ [ 2 1 ] 6 0 6
+ 6 differences found
+ Attribute: <float2D> and <float2D>
+ position float2D of </g1> float2D of </g1> difference
+ ------------------------------------------------------------
+ [ 0 0 ] 1 0 1
+ [ 0 1 ] 2 0 2
+ [ 1 0 ] 3 0 3
+ [ 1 1 ] 4 0 4
+ [ 2 0 ] 5 0 5
+ [ 2 1 ] 6 0 6
+ */
+
+ if (make_attr(loc_id,2,dims2,"integer2D",H5T_NATIVE_INT,buf72) < 0)
+ goto out;
+ if (make_attr(loc_id,2,dims2,"float2D",H5T_NATIVE_FLOAT,buf82) < 0)
+ goto out;
+
+
+ /*-------------------------------------------------------------------------
+ * 3D attributes
+ *-------------------------------------------------------------------------
+ */
+
+ /*-------------------------------------------------------------------------
+ * H5T_STRING
+ *-------------------------------------------------------------------------
+ */
+
+ if (make_diffs)
+ {
+ HDmemset(buf13,'z',sizeof buf13);
+ }
+
+ /*
+ buf13[24][2]= {"ab","cd","ef","gh","ij","kl","mn","pq",
+ "rs","tu","vw","xz","AB","CD","EF","GH",
+ "IJ","KL","MN","PQ","RS","TU","VW","XZ"};
+
+ Attribute: <string3D> and <string3D>
+ position string3D of </g1> string3D of </g1> difference
+ ------------------------------------------------------------
+ [ 0 0 0 ] a z
+ [ 0 0 0 ] b z
+ [ 0 0 1 ] c z
+ [ 0 0 1 ] d z
+ [ 0 1 0 ] e z
+ [ 0 1 0 ] f z
+ [ 0 1 1 ] g z
+ [ 0 1 1 ] h z
+ [ 0 2 0 ] i z
+ [ 0 2 0 ] j z
+ [ 0 2 1 ] k z
+ [ 0 2 1 ] l z
+ [ 1 0 0 ] m z
+ [ 1 0 0 ] n z
+ [ 1 0 1 ] p z
+ [ 1 0 1 ] q z
+ [ 1 1 0 ] r z
+ [ 1 1 0 ] s z
+ [ 1 1 1 ] t z
+ [ 1 1 1 ] u z
+ [ 1 2 0 ] v z
+ [ 1 2 0 ] w z
+ [ 1 2 1 ] x z
+ [ 2 0 0 ] A z
+ [ 2 0 0 ] B z
+ [ 2 0 1 ] C z
+ [ 2 0 1 ] D z
+ [ 2 1 0 ] E z
+ [ 2 1 0 ] F z
+ [ 2 1 1 ] G z
+ [ 2 1 1 ] H z
+ [ 2 2 0 ] I z
+ [ 2 2 0 ] J z
+ [ 2 2 1 ] K z
+ [ 2 2 1 ] L z
+ [ 3 0 0 ] M z
+ [ 3 0 0 ] N z
+ [ 3 0 1 ] P z
+ [ 3 0 1 ] Q z
+ [ 3 1 0 ] R z
+ [ 3 1 0 ] S z
+ [ 3 1 1 ] T z
+ [ 3 1 1 ] U z
+ [ 3 2 0 ] V z
+ [ 3 2 0 ] W z
+ [ 3 2 1 ] X z
+ [ 3 2 1 ] Z z
+ */
+
+ if ((tid = H5Tcopy(H5T_C_S1)) < 0)
+ goto out;
+ if (H5Tset_size(tid, (size_t)2) < 0)
+ goto out;
+ if (make_attr(loc_id,3,dims3,"string3D",tid,buf13) < 0)
+ goto out;
+ if (H5Tclose(tid) < 0)
+ goto out;
+ tid = -1;
+
+ /*-------------------------------------------------------------------------
+ * H5T_BITFIELD
+ *-------------------------------------------------------------------------
+ */
+
+ n=1;
+ for(i = 0; i < 4; i++) {
+ for(j = 0; j < 3; j++) {
+ for(k = 0; k < 2; k++) {
+ if(make_diffs)
+ buf23[i][j][k] = 0;
+ else
+ buf23[i][j][k] = (char)(n++);
+ }
+ }
+ }
+
+ /*
+ position bitfield3D of </g1> bitfield3D of </g1> difference
+ ------------------------------------------------------------
+ [ 0 0 0 ] 1 0 1
+ [ 0 0 1 ] 2 0 2
+ [ 0 1 0 ] 3 0 3
+ [ 0 1 1 ] 4 0 4
+ [ 0 2 0 ] 5 0 5
+ [ 0 2 1 ] 6 0 6
+ [ 1 0 0 ] 7 0 7
+ [ 1 0 1 ] 8 0 8
+ [ 1 1 0 ] 9 0 9
+ [ 1 1 1 ] 10 0 10
+ [ 1 2 0 ] 11 0 11
+ [ 1 2 1 ] 12 0 12
+ [ 2 0 0 ] 13 0 13
+ [ 2 0 1 ] 14 0 14
+ [ 2 1 0 ] 15 0 15
+ [ 2 1 1 ] 16 0 16
+ [ 2 2 0 ] 17 0 17
+ [ 2 2 1 ] 18 0 18
+ [ 3 0 0 ] 19 0 19
+ [ 3 0 1 ] 20 0 20
+ [ 3 1 0 ] 21 0 21
+ [ 3 1 1 ] 22 0 22
+ [ 3 2 0 ] 23 0 23
+ [ 3 2 1 ] 24 0 24
+ */
+
+ if ((tid = H5Tcopy(H5T_STD_B8LE)) < 0)
+ goto out;
+ if (make_attr(loc_id,3,dims3,"bitfield3D",tid,buf23) < 0)
+ goto out;
+ if (H5Tclose(tid) < 0)
+ goto out;
+ tid = -1;
+
+ /*-------------------------------------------------------------------------
+ * H5T_OPAQUE
+ *-------------------------------------------------------------------------
+ */
+ if ((tid = H5Tcreate(H5T_OPAQUE, (size_t)1)) < 0)
+ goto out;
+ if (H5Tset_tag(tid, "1-byte opaque type") < 0)
+ goto out;
+ if (make_attr(loc_id,3,dims3,"opaque3D",tid,buf23) < 0)
+ goto out;
+ if (H5Tclose(tid) < 0)
+ goto out;
+ tid = -1;
+
+ /*-------------------------------------------------------------------------
+ * H5T_COMPOUND
+ *-------------------------------------------------------------------------
+ */
+
+ n=1;
+ for(i = 0; i < 4; i++) {
+ for(j = 0; j < 3; j++) {
+ for(k = 0; k < 2; k++) {
+ if(make_diffs) {
+ buf33[i][j][k].a = 0;
+ buf33[i][j][k].b = 0;
+ }
+ else {
+ buf33[i][j][k].a = (char)(n++);
+ buf33[i][j][k].b = n++;
+ }
+ }
+ }
+ }
+ /*position compound3D of </g1> compound3D of </g1> difference
+ ------------------------------------------------------------
+ [ 0 0 0 ] 1 0 1
+ [ 0 0 0 ] 2 0 2
+ [ 0 0 1 ] 3 0 3
+ [ 0 0 1 ] 4 0 4
+ [ 0 1 0 ] 5 0 5
+ [ 0 1 0 ] 6 0 6
+ [ 0 1 1 ] 7 0 7
+ [ 0 1 1 ] 8 0 8
+ [ 0 2 0 ] 9 0 9
+ [ 0 2 0 ] 10 0 10
+ [ 0 2 1 ] 11 0 11
+ [ 0 2 1 ] 12 0 12
+ [ 1 0 0 ] 13 0 13
+ [ 1 0 0 ] 14 0 14
+ [ 1 0 1 ] 15 0 15
+ [ 1 0 1 ] 16 0 16
+ [ 1 1 0 ] 17 0 17
+ [ 1 1 0 ] 18 0 18
+ [ 1 1 1 ] 19 0 19
+ [ 1 1 1 ] 20 0 20
+ [ 1 2 0 ] 21 0 21
+ [ 1 2 0 ] 22 0 22
+ [ 1 2 1 ] 23 0 23
+ [ 1 2 1 ] 24 0 24
+ [ 2 0 0 ] 25 0 25
+ [ 2 0 0 ] 26 0 26
+ [ 2 0 1 ] 27 0 27
+ [ 2 0 1 ] 28 0 28
+ [ 2 1 0 ] 29 0 29
+ [ 2 1 0 ] 30 0 30
+ [ 2 1 1 ] 31 0 31
+ [ 2 1 1 ] 32 0 32
+ [ 2 2 0 ] 33 0 33
+ [ 2 2 0 ] 34 0 34
+ [ 2 2 1 ] 35 0 35
+ [ 2 2 1 ] 36 0 36
+ [ 3 0 0 ] 37 0 37
+ [ 3 0 0 ] 38 0 38
+ [ 3 0 1 ] 39 0 39
+ [ 3 0 1 ] 40 0 40
+ [ 3 1 0 ] 41 0 41
+ [ 3 1 0 ] 42 0 42
+ [ 3 1 1 ] 43 0 43
+ [ 3 1 1 ] 44 0 44
+ [ 3 2 0 ] 45 0 45
+ [ 3 2 0 ] 46 0 46
+ [ 3 2 1 ] 47 0 47
+ [ 3 2 1 ] 48 0 48
+ */
+
+
+
+ if ((tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t))) < 0)
+ goto out;
+ if (H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR) < 0)
+ goto out;
+ if (H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE) < 0)
+ goto out;
+ if (make_attr(loc_id,3,dims3,"compound3D",tid,buf33) < 0)
+ goto out;
+ if (H5Tclose(tid) < 0)
+ goto out;
+ tid = -1;
+
+ /*-------------------------------------------------------------------------
+ * H5T_REFERENCE
+ *-------------------------------------------------------------------------
+ */
+ /* Create references to dataset */
+ if (dset_name)
+ {
+ for (i = 0; i < 4; i++)
+ {
+ for (j = 0; j < 3; j++)
+ {
+ for (k = 0; k < 2; k++)
+ if (H5Rcreate(&buf43[i][j][k],fid,dset_name,H5R_OBJECT,(hid_t)-1) < 0)
+ goto out;
+ }
+ }
+ if (make_attr(loc_id,3,dims3,"reference3D",H5T_STD_REF_OBJ,buf43) < 0)
+ goto out;
+ }
+
+ /*-------------------------------------------------------------------------
+ * H5T_ENUM
+ *-------------------------------------------------------------------------
+ */
+
+ for (i = 0; i < 4; i++)
+ {
+ for (j = 0; j < 3; j++)
+ {
+ for (k = 0; k < 2; k++)
+ {
+ if (make_diffs)
+ {
+ buf453[i][j][k]=RED;
+ }
+ else
+ {
+ buf453[i][j][k]=GREEN;
+ }
+ }
+ }
+ }
+
+ /*
+ position enum3D of </g1> enum3D of </g1> difference
+ ------------------------------------------------------------
+ [ 0 0 0 ] GREEN RED
+ [ 0 0 1 ] GREEN RED
+ [ 0 1 0 ] GREEN RED
+ [ 0 1 1 ] GREEN RED
+ [ 0 2 0 ] GREEN RED
+ [ 0 2 1 ] GREEN RED
+ [ 1 0 0 ] GREEN RED
+ [ 1 0 1 ] GREEN RED
+ [ 1 1 0 ] GREEN RED
+ [ 1 1 1 ] GREEN RED
+ [ 1 2 0 ] GREEN RED
+ [ 1 2 1 ] GREEN RED
+ [ 2 0 0 ] GREEN RED
+ [ 2 0 1 ] GREEN RED
+ [ 2 1 0 ] GREEN RED
+ [ 2 1 1 ] GREEN RED
+ [ 2 2 0 ] GREEN RED
+ [ 2 2 1 ] GREEN RED
+ [ 3 0 0 ] GREEN RED
+ [ 3 0 1 ] GREEN RED
+ [ 3 1 0 ] GREEN RED
+ [ 3 1 1 ] GREEN RED
+ [ 3 2 0 ] GREEN RED
+ [ 3 2 1 ] GREEN RED
+ */
+
+
+ if ((tid = H5Tcreate(H5T_ENUM, sizeof(e_t))) < 0)
+ goto out;
+ if (H5Tenum_insert(tid, "RED", (val = 0, &val)) < 0)
+ goto out;
+ if (H5Tenum_insert(tid, "GREEN", (val = 1, &val)) < 0)
+ goto out;
+ if (make_attr(loc_id,3,dims3,"enum3D",tid,buf453) < 0)
+ goto out;
+ if (H5Tclose(tid) < 0)
+ goto out;
+ tid = -1;
+
+ /*-------------------------------------------------------------------------
+ * H5T_VLEN
+ *-------------------------------------------------------------------------
+ */
+
+ /* Allocate and initialize VL dataset to write */
+ n=0;
+ for (i = 0; i < 4; i++)
+ {
+ for (j = 0; j < 3; j++)
+ {
+ for (k = 0; k < 2; k++)
+ {
+ unsigned l;
+
+ buf53[i][j][k].p = HDmalloc((i + 1) * sizeof(int));
+ buf53[i][j][k].len = (size_t)i + 1;
+ for (l = 0; l < i + 1; l++)
+ if (make_diffs)
+ ((int *)buf53[i][j][k].p)[l] = 0;
+ else
+ ((int *)buf53[i][j][k].p)[l] = n++;
+ }
+ }
+ }
+ /*
+ position vlen3D of </g1> vlen3D of </g1> difference
+ ------------------------------------------------------------
+ [ 0 0 1 ] 1 0 1
+ [ 0 1 0 ] 2 0 2
+ [ 0 1 1 ] 3 0 3
+ [ 0 2 0 ] 4 0 4
+ [ 0 2 1 ] 5 0 5
+ [ 1 0 0 ] 6 0 6
+ [ 1 0 0 ] 7 0 7
+ [ 1 0 1 ] 8 0 8
+ [ 1 0 1 ] 9 0 9
+ [ 1 1 0 ] 10 0 10
+ etc
+ */
+ if ((sid = H5Screate_simple(3, dims3, NULL)) < 0)
+ goto out;
+ if ((tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0)
+ goto out;
+ if ((aid = H5Acreate2(loc_id, "vlen3D", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
+ if (H5Awrite(aid, tid, buf53) < 0)
+ goto out;
+ if (H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf53) < 0)
+ goto out;
+ if (H5Aclose(aid) < 0)
+ goto out;
+ aid = -1;
+ if (H5Tclose(tid) < 0)
+ goto out;
+ tid = -1;
+ if (H5Sclose(sid) < 0)
+ goto out;
+ sid = -1;
+
+ /*-------------------------------------------------------------------------
+ * H5T_ARRAY
+ *-------------------------------------------------------------------------
+ */
+ n=1;
+ for (i = 0; i < 24; i++)
+ {
+ for (j = 0; j < (int)dimarray[0]; j++)
+ {
+ if (make_diffs) buf63[i][j]=0;
+ else buf63[i][j]=n++;
+ }
+ }
+ /*
+ position array3D of </g1> array3D of </g1> difference
+ ------------------------------------------------------------
+ [ 0 0 0 ] 1 0 1
+ [ 0 0 0 ] 2 0 2
+ [ 0 0 0 ] 3 0 3
+ [ 0 0 1 ] 4 0 4
+ [ 0 0 1 ] 5 0 5
+ [ 0 0 1 ] 6 0 6
+ [ 0 1 0 ] 7 0 7
+ etc
+ */
+
+ if ((tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray)) < 0)
+ goto out;
+ if (make_attr(loc_id, 3, dims3, "array3D", tid, buf63) < 0)
+ goto out;
+ if (H5Tclose(tid) < 0)
+ goto out;
+ tid = -1;
+
+ /*-------------------------------------------------------------------------
+ * H5T_INTEGER and H5T_FLOAT
+ *-------------------------------------------------------------------------
+ */
+ n = 1; f = 1;
+ for(i = 0; i < 4; i++)
+ {
+ for(j = 0; j < 3; j++)
+ {
+ for(k = 0; k < 2; k++)
+ {
+ if(make_diffs)
+ {
+ buf73[i][j][k] = 0;
+ buf83[i][j][k] = 0;
+ }
+ else
+ {
+ buf73[i][j][k] = n++;
+ buf83[i][j][k] = f++;
+ }
+ }
+ }
+ }
+
+ /*
+ position integer3D of </g1> integer3D of </g1> difference
+ ------------------------------------------------------------
+ [ 0 0 0 ] 1 0 1
+ [ 0 0 1 ] 2 0 2
+ [ 0 1 0 ] 3 0 3
+ [ 0 1 1 ] 4 0 4
+ [ 0 2 0 ] 5 0 5
+ [ 0 2 1 ] 6 0 6
+ [ 1 0 0 ] 7 0 7
+ [ 1 0 1 ] 8 0 8
+ [ 1 1 0 ] 9 0 9
+ [ 1 1 1 ] 10 0 10
+ etc
+ */
+ if (make_attr(loc_id,3,dims3,"integer3D",H5T_NATIVE_INT,buf73) < 0)
+ goto out;
+ if (make_attr(loc_id,3,dims3,"float3D",H5T_NATIVE_FLOAT,buf83) < 0)
+ goto out;
+
+
+ return 0;
+
+out:
+ H5E_BEGIN_TRY {
+ H5Aclose(aid);
+ H5Sclose(sid);
+ H5Tclose(tid);
+ } H5E_END_TRY;
+ return -1;
+}
+
+
+
+
+/*-------------------------------------------------------------------------
+* Function: make_dset
+*
+* Purpose: utility function to create and write a dataset in LOC_ID
+*
+* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+*
+* Date: November 12, 2003
+*
+*-------------------------------------------------------------------------
+*/
+static
+int make_dset(hid_t loc_id,
+ const char *name,
+ hid_t sid,
+ hid_t dcpl,
+ void *buf)
+{
+ hid_t did=-1;
+
+ if ((did = H5Dcreate2(loc_id, name, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ return -1;
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ goto out;
+ if (H5Dclose(did) < 0)
+ return -1;
+ return 0;
+
+out:
+ H5E_BEGIN_TRY {
+ H5Dclose(did);
+ } H5E_END_TRY;
+ return -1;
+}
+
+
+/*-------------------------------------------------------------------------
+* Function: write_dset
+*
+* Purpose: utility function to create and write a dataset in LOC_ID
+*
+* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+*
+* Date: November 12, 2003
+*
+*-------------------------------------------------------------------------
+*/
+static
+int write_dset( hid_t loc_id,
+ int rank,
+ hsize_t *dims,
+ const char *dset_name,
+ hid_t tid,
+ void *buf )
+{
+ hid_t did=-1;
+ hid_t sid=-1;
+
+ if ((sid = H5Screate_simple(rank, dims, NULL)) < 0)
+ return -1;
+ if ((did = H5Dcreate2(loc_id, dset_name, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
+ if (buf)
+ {
+ if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ goto out;
+ }
+ if (H5Dclose(did) < 0)
+ goto out;
+ if (H5Sclose(sid) < 0)
+ goto out;
+
+ return 0;
+
+out:
+ H5E_BEGIN_TRY {
+ H5Dclose(did);
+ H5Sclose(sid);
+ } H5E_END_TRY;
+ return -1;
+}
+
+
+
+/*-------------------------------------------------------------------------
+* Function: make_attr
+*
+* Purpose: utility function to write an attribute in LOC_ID
+*
+* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+*
+* Date: November 12, 2003
+*
+*-------------------------------------------------------------------------
+*/
+static
+int make_attr(hid_t loc_id,
+ int rank,
+ hsize_t *dims,
+ const char *attr_name,
+ hid_t tid,
+ void *buf)
+{
+ hid_t aid;
+ hid_t sid;
+
+ if ((sid = H5Screate_simple(rank, dims, NULL)) < 0)
+ return -1;
+ if ((aid = H5Acreate2(loc_id, attr_name, tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
+ if(buf)
+ {
+ if(H5Awrite(aid, tid, buf) < 0)
+ goto out;
+ }
+ if (H5Aclose(aid) < 0)
+ goto out;
+ if (H5Sclose(sid) < 0)
+ goto out;
+ return 0;
+
+out:
+ H5E_BEGIN_TRY {
+ H5Aclose(aid);
+ H5Sclose(sid);
+ } H5E_END_TRY;
+ return -1;
+}
+
+
+/*-------------------------------------------------------------------------
+* Function: make_named_dtype
+*
+* Purpose: create a file with named datatypes in various configurations
+*
+*-------------------------------------------------------------------------
+*/
+static
+int make_named_dtype(hid_t loc_id)
+{
+ hsize_t dims[1] ={3};
+ hid_t did=-1;
+ hid_t aid=-1;
+ hid_t sid=-1;
+ hid_t tid=-1;
+ hid_t gid=-1;
+
+ if ((sid = H5Screate_simple(1, dims, NULL)) < 0)
+ goto out;
+
+ /* Create a dataset with an anonymous committed datatype as the first thing
+ * h5repack sees */
+ if((tid = H5Tcopy(H5T_STD_I16LE)) < 0)
+ goto out;
+ if(H5Tcommit_anon(loc_id, tid, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ goto out;
+ if ((did = H5Dcreate2(loc_id, "A", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
+ if(H5Tclose(tid) < 0)
+ goto out;
+
+ /* Create an attribute on that dataset that uses a committed datatype in
+ * a remote group */
+ if((gid = H5Gcreate2(loc_id, "M", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
+ if(H5Gclose(gid) < 0)
+ goto out;
+ if((gid = H5Gcreate2(loc_id, "M/M", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
+ if(H5Gclose(gid) < 0)
+ goto out;
+ if((tid = H5Tcopy(H5T_STD_I16BE)) < 0)
+ goto out;
+ if(H5Tcommit2(loc_id, "/M/M/A", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ goto out;
+ if((aid = H5Acreate2(did, "A", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
+ if(H5Aclose(aid) < 0)
+ goto out;
+ if(H5Tclose(tid) < 0)
+ goto out;
+ if(H5Dclose(did) < 0)
+ goto out;
+
+ /* Create a dataset in the remote group that uses a committed datatype in
+ * the root group */
+ if((tid = H5Tcopy(H5T_STD_I32LE)) < 0)
+ goto out;
+ if(H5Tcommit2(loc_id, "N", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ goto out;
+ if((did = H5Dcreate2(loc_id, "M/M/B", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
+ if(H5Tclose(tid) < 0)
+ goto out;
+
+ /* Create an attribute on the remote dataset that uses an anonymous
+ * committed datatype */
+ if((tid = H5Tcopy(H5T_STD_I32BE)) < 0)
+ goto out;
+ if(H5Tcommit_anon(loc_id, tid, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ goto out;
+ if((aid = H5Acreate2(did, "A", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
+ if(H5Aclose(aid) < 0)
+ goto out;
+
+ /* Create another attribute that uses the same anonymous datatype */
+ if((aid = H5Acreate2(did, "B", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
+ if(H5Aclose(aid) < 0)
+ goto out;
+ if(H5Tclose(tid) < 0)
+ goto out;
+ if(H5Dclose(did) < 0)
+ goto out;
+
+ /* Create a dataset in the root group that uses the committed datatype in
+ * the root group */
+ if((tid = H5Topen2(loc_id, "N", H5P_DEFAULT)) < 0)
+ goto out;
+ if((did = H5Dcreate2(loc_id, "O", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
+ if(H5Dclose(did) < 0)
+ goto out;
+
+ /* Create 2 attributes on the committed datatype that use that datatype */
+ if((aid = H5Acreate2(tid, "A", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
+ if(H5Aclose(aid) < 0)
+ goto out;
+ if((aid = H5Acreate2(tid, "B", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
+ if(H5Aclose(aid) < 0)
+ goto out;
+ if(H5Tclose(tid) < 0)
+ goto out;
+
+ /* Close */
+ if (H5Sclose(sid) < 0)
+ goto out;
+
+ return 0;
+
+out:
+ H5E_BEGIN_TRY
+ {
+ H5Tclose(tid);
+ H5Aclose(aid);
+ H5Sclose(sid);
+ H5Dclose(did);
+ H5Gclose(gid);
+ } H5E_END_TRY;
+ return -1;
+} /* end make_named_dtype() */
+
+/*-------------------------------------------------------------------------
+ * Function: add_attr_with_objref
+ *
+ * Purpose:
+ * Create attributes with object reference to objects (dset,
+ * group, datatype).
+ *
+ * Note:
+ * this function depends on locally created objects, however can be modified
+ * to be independent as necessary
+ *
+ * Programmer: Jonathan Kim (March 23, 2010)
+ *------------------------------------------------------------------------*/
+static herr_t add_attr_with_objref(hid_t file_id, hid_t obj_id)
+{
+ int ret = SUCCEED;
+ int status;
+ /* attr obj ref */
+ hsize_t dim_attr_objref[1]={3};
+ hobj_ref_t data_attr_objref[3];
+
+ /* --------------------------------
+ * add attribute with obj ref type
+ */
+ /* ref to dset */
+ status = H5Rcreate(&data_attr_objref[0],file_id,NAME_OBJ_DS1,H5R_OBJECT,(hid_t)-1);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* ref to group */
+ status = H5Rcreate(&data_attr_objref[1],file_id,NAME_OBJ_GRP,H5R_OBJECT,(hid_t)-1);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* ref to datatype */
+ status = H5Rcreate(&data_attr_objref[2],file_id,NAME_OBJ_NDTYPE,H5R_OBJECT,(hid_t)-1);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* create attr with obj ref type */
+ status = make_attr(obj_id,1,dim_attr_objref,"Attr_OBJREF",H5T_STD_REF_OBJ,data_attr_objref);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> make_attr failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+out:
+
+ return ret;
+
+}
+
+/*-------------------------------------------------------------------------
+ * Function: add_attr_with_regref
+ *
+ * Purpose:
+ * Create attributes with region reference to dset
+ *
+ * Note:
+ * this function depends on locally created objects, however can be modified
+ * to be independent as necessary
+ *
+ * Programmer: Jonathan Kim (March 23, 2010)
+ *------------------------------------------------------------------------*/
+static herr_t add_attr_with_regref(hid_t file_id, hid_t obj_id)
+{
+ int ret = SUCCEED;
+ int status;
+
+ /* attr region ref */
+ hid_t sid_regrefed_dset=0;
+ hsize_t dim_regrefed_dset[2]={3,6};
+ hsize_t coords_regrefed_dset[3][2] = {{0,1},{1,2},{2,3}};
+ hsize_t dim_attr_regref[1]= {1}; /* dim of */
+ hdset_reg_ref_t data_attr_regref[1];
+
+
+ /* -----------------------------------
+ * add attribute with region ref type
+ */
+ sid_regrefed_dset = H5Screate_simple (2, dim_regrefed_dset, NULL);
+ if (sid_regrefed_dset < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* select elements space for reference */
+ 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__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* create region reference from elements space */
+ status = H5Rcreate (&data_attr_regref[0], file_id, NAME_OBJ_DS2, H5R_DATASET_REGION, sid_regrefed_dset);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* create attr with region ref type */
+ status = make_attr(obj_id,1,dim_attr_regref,"Attr_REGREF",H5T_STD_REF_DSETREG,data_attr_regref);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> make_attr failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+out:
+ if (sid_regrefed_dset > 0)
+ H5Sclose (sid_regrefed_dset);
+
+ return ret;
+
+}
+
+/*-------------------------------------------------------------------------
+ * Function: gen_refered_objs
+ *
+ * Purpose:
+ * Create objects (dataset, group, datatype) to be referenced
+ *
+ * Note:
+ * This function is to use along with gen_obj_ref() gen_region_ref()
+ *
+ * Programmer: Jonathan Kim (March 23, 2010)
+ *------------------------------------------------------------------------*/
+static herr_t gen_refered_objs(hid_t loc_id)
+{
+ int status;
+ herr_t ret = SUCCEED;
+
+ /* objects (dset, group, datatype) */
+ hid_t sid=0, did1=0, gid=0, tid=0;
+ hsize_t dims1[1]={3};
+ int data[3] = {10,20,30};
+
+ /* Dset2 */
+ hid_t sid2=0, did2=0;
+ hsize_t dims2[2] = {3,16};
+ char data2[3][16] = {"The quick brown", "fox jumps over ", "the 5 lazy dogs"};
+
+ /*-----------------------
+ * add short dataset
+ * (define NAME_OBJ_DS1)
+ */
+ sid = H5Screate_simple(1, dims1, NULL);
+ if (sid < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ did1 = H5Dcreate2 (loc_id, NAME_OBJ_DS1, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (did1 < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ status = H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /*--------------
+ * add group
+ * (define NAME_OBJ_GRP)
+ */
+ gid = H5Gcreate2 (loc_id, NAME_OBJ_GRP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (gid < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Gcreate2 failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /*----------------------
+ * add named datatype
+ * (define NAME_OBJ_NDTYPE)
+ */
+ tid = H5Tcopy(H5T_NATIVE_INT);
+ status = H5Tcommit2(loc_id, NAME_OBJ_NDTYPE, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Tcommit2 failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+
+ /*--------------------------
+ * create long dataset
+ * (define NAME_OBJ_DS2)
+ */
+ sid2 = H5Screate_simple (2, dims2, NULL);
+ if (sid2 < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* create normal dataset which is refered */
+ did2 = H5Dcreate2 (loc_id, NAME_OBJ_DS2, H5T_STD_I8LE, sid2, H5P_DEFAULT,H5P_DEFAULT,H5P_DEFAULT);
+ if (did2 < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* write values to dataset */
+ status = H5Dwrite (did2, H5T_NATIVE_CHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, data2);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+out:
+ if(did1 > 0)
+ H5Dclose(did1);
+ if(gid > 0)
+ H5Gclose(gid);
+ if(tid > 0)
+ H5Tclose(tid);
+ if(sid > 0)
+ H5Sclose(sid);
+
+ if(did2 > 0)
+ H5Dclose(did2);
+ if(sid2 > 0)
+ H5Sclose(sid2);
+ return ret;
+
+}
+
+/*-------------------------------------------------------------------------
+ * Function: gen_obj_ref
+ *
+ * Purpose:
+ * Generate object references to objects (dataset,group and named datatype)
+ *
+ * Note:
+ * copied from h5copygentest.c and upate to create named datatype
+ *
+ * Programmer: Jonathan Kim (March 18, 2010)
+ *------------------------------------------------------------------------*/
+static herr_t gen_obj_ref(hid_t loc_id)
+{
+ int status;
+ herr_t ret = SUCCEED;
+
+ hid_t sid=0, oid=0;
+ hsize_t dims_dset_objref[1]={3};
+
+ /* attr with int type */
+ hsize_t dim_attr_int[1]={2};
+ int data_attr_int[2] = {10,20};
+
+ /* write buffer for obj reference */
+ hobj_ref_t objref_buf[3];
+
+ /*---------------------------------------------------------
+ * create obj references to the previously created objects.
+ * Passing -1 as reference is an object.*/
+
+ /* obj ref to dataset */
+ status = H5Rcreate (&objref_buf[0], loc_id, NAME_OBJ_DS1, H5R_OBJECT, (hid_t)-1);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* obj ref to group */
+ status = H5Rcreate (&objref_buf[1], loc_id, NAME_OBJ_GRP, H5R_OBJECT, (hid_t)-1);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* obj ref to named-datatype */
+ status = H5Rcreate (&objref_buf[2], loc_id, NAME_OBJ_NDTYPE, H5R_OBJECT, (hid_t)-1);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /*---------------------------------------------------------
+ * create dataset contain references
+ */
+ sid = H5Screate_simple (1, dims_dset_objref, NULL);
+ if (sid < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ oid = H5Dcreate2 (loc_id, "Dset_OBJREF", H5T_STD_REF_OBJ, sid, H5P_DEFAULT,H5P_DEFAULT,H5P_DEFAULT);
+ if (oid < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ status = H5Dwrite(oid, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, objref_buf);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* add attribute with int type */
+ if (make_attr(oid,1,dim_attr_int,"integer",H5T_NATIVE_INT,data_attr_int) < 0)
+ goto out;
+
+ /* add attribute with obj ref */
+ status = add_attr_with_objref(loc_id, oid);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> add_attr_with_objref failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* add attribute with region ref */
+ status = add_attr_with_regref(loc_id, oid);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> add_attr_with_regref failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+out:
+ if(oid > 0)
+ H5Dclose(oid);
+ if(sid > 0)
+ H5Sclose(sid);
+
+ return ret;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: gen_region_ref
+ *
+ * Purpose: Generate dataset region references
+ *
+ * Note:
+ * copied from h5copygentest.c
+ *
+ * Programmer: Jonathan Kim (March 18, 2010)
+ *------------------------------------------------------------------------*/
+static herr_t gen_region_ref(hid_t loc_id)
+{
+ int status;
+ herr_t ret = SUCCEED;
+
+ /* target dataset */
+ hid_t sid_trg=0;
+ hsize_t dims_trg[2] = {3,16};
+
+ /* dset with region ref type */
+ hid_t sid_ref=0, oid_ref=0;
+
+ /* region ref to target dataset */
+ hsize_t coords[4][2] = { {0,1}, {2,11}, {1,0}, {2,4} };
+ hdset_reg_ref_t rr_data[2];
+ hsize_t start[2] = {0,0};
+ hsize_t stride[2] = {2,11};
+ hsize_t count[2] = {2,2};
+ hsize_t block[2] = {1,3};
+ hsize_t dims1[1] = {2};
+
+ /* attr with int type */
+ hsize_t dim_attr_int[1]={2};
+ int data_attr_int[2] = {10,20};
+
+ sid_trg = H5Screate_simple (2, dims_trg, NULL);
+ if (sid_trg < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* select elements space for reference */
+ 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__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* create region reference from elements space */
+ status = H5Rcreate (&rr_data[0], loc_id, NAME_OBJ_DS2, H5R_DATASET_REGION, sid_trg);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* select hyperslab space for reference */
+ status = H5Sselect_hyperslab (sid_trg, H5S_SELECT_SET, start, stride, count, block);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Sselect_hyperslab failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* create region reference from hyperslab space */
+ status = H5Rcreate (&rr_data[1], loc_id, NAME_OBJ_DS2, H5R_DATASET_REGION, sid_trg);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* Create dataspace. */
+ sid_ref = H5Screate_simple (1, dims1, NULL);
+ if (sid_ref < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* create region reference dataset */
+ oid_ref = H5Dcreate2 (loc_id, REG_REF_DS1, H5T_STD_REF_DSETREG, sid_ref, H5P_DEFAULT,H5P_DEFAULT,H5P_DEFAULT);
+ if (oid_ref < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* write data as region references */
+ status = H5Dwrite (oid_ref, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, rr_data);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* add attribute with int type */
+ if (make_attr(oid_ref,1,dim_attr_int,"integer",H5T_NATIVE_INT,data_attr_int) < 0)
+ goto out;
+
+ /* add attribute with obj ref */
+ status = add_attr_with_objref(loc_id, oid_ref);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> add_attr_with_objref failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* add attribute with region ref */
+ status = add_attr_with_regref(loc_id, oid_ref);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> add_attr_with_regref failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+out:
+ if (oid_ref > 0)
+ H5Dclose (oid_ref);
+ if (sid_ref > 0)
+ H5Sclose (sid_ref);
+ if (sid_trg > 0)
+ H5Sclose (sid_trg);
+
+ return ret;
+}
+
+/*-------------------------------------------------------------------------
+* Function: make_references
+*
+* Purpose: create a file with obj and region references
+*
+* Programmer: Jonathan Kim (March 18, 2010)
+*-------------------------------------------------------------------------
+*/
+static herr_t make_references(hid_t loc_id)
+{
+ herr_t ret = SUCCEED;
+ herr_t status;
+
+ /* add target objects */
+ status = gen_refered_objs(loc_id);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Failed to generate referenced object.\n");
+ ret = FAIL;
+ }
+
+ /* add object reference */
+ status = gen_obj_ref(loc_id);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Failed to generate object reference.\n");
+ ret = FAIL;
+ }
+
+ /* add region reference */
+ status = gen_region_ref(loc_id);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Failed to generate region reference.\n");
+ ret = FAIL;
+ }
+
+ return ret;
+}
+
+/*-------------------------------------------------------------------------
+* Function: make_complex_attr_references
+*
+* Purpose:
+* create a file with :
+* 1. obj ref in attribute of compound type
+* 2. region ref in attribute of compound type
+* 3. obj ref in attribute of vlen type
+* 4. region ref in attribute of vlen type
+*
+* Programmer: Jonathan (March 25, 2010)
+*-------------------------------------------------------------------------
+*/
+/* obj dset */
+#define RANK_OBJ 2
+#define DIM0_OBJ 6
+#define DIM1_OBJ 10
+/* container dset */
+#define RANK_DSET 1
+#define DIM_DSET 4
+/* 1. obj references in compound attr */
+#define RANK_COMP_OBJREF 1
+#define DIM_COMP_OBJREF 3 /* for dataset, group, datatype */
+/* 2. region references in compound attr */
+#define RANK_COMP_REGREF 1
+#define DIM_COMP_REGREF 1 /* for element region */
+/* 3. obj references in vlen attr */
+#define RANK_VLEN_OBJREF 1
+#define DIM_VLEN_OBJREF 3 /* for dataset, group, datatype */
+#define LEN0_VLEN_OBJREF 1 /* dataset */
+#define LEN1_VLEN_OBJREF 1 /* group */
+#define LEN2_VLEN_OBJREF 1 /* datatype */
+/* 4. region references in vlen attr */
+#define RANK_VLEN_REGREF 1
+#define DIM_VLEN_REGREF 1 /* for element region */
+#define LEN0_VLEN_REGREF 1 /* element region */
+
+static herr_t make_complex_attr_references(hid_t loc_id)
+{
+ herr_t ret = SUCCEED;
+ herr_t status;
+ /*
+ * for objects
+ */
+ hid_t objgid=0, objdid=0, objtid=0, objsid=0;
+ hsize_t obj_dims[RANK_OBJ] = {DIM0_OBJ, DIM1_OBJ};
+ int obj_data[DIM0_OBJ][DIM1_OBJ]=
+ {{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
+ {10,11,12,13,14,15,16,17,18,19},
+ {20,21,22,23,24,25,26,27,28,29},
+ {30,31,32,33,34,35,36,37,38,39},
+ {40,41,42,43,44,45,46,47,48,49},
+ {50,51,52,53,54,55,56,57,58,59}};
+
+ /*
+ * group main
+ */
+ hid_t main_gid=0;
+ /*
+ * dataset which the attribute will be attached to
+ */
+ hsize_t main_dset_dims[RANK_DSET] = {DIM_DSET};
+ hid_t main_sid=0, main_did=0;
+ /*
+ * 1. obj references in compound attr
+ */
+ hid_t comp_objref_tid=0, comp_objref_aid=0;
+ typedef struct comp_objref_t {
+ hobj_ref_t val_objref;
+ int val_int;
+ } comp_objref_t;
+ comp_objref_t comp_objref_data[DIM_COMP_OBJREF];
+ hid_t comp_objref_attr_sid=0;
+ hsize_t comp_objref_dim[RANK_COMP_OBJREF] = {DIM_COMP_OBJREF};
+
+ /*
+ * 2. region references in compound attr
+ */
+ hid_t comp_regref_tid=0, comp_regref_aid=0;
+ typedef struct comp_regref_t {
+ hdset_reg_ref_t val_regref;
+ int val_int;
+ } comp_regref_t;
+ comp_regref_t comp_regref_data[DIM_COMP_REGREF];
+ hid_t comp_regref_attr_sid=0;
+ hsize_t comp_regref_dim[RANK_COMP_REGREF] = {DIM_COMP_REGREF};
+ hsize_t coords[4][2] = { {0,1}, {2,3}, {3,4}, {4,5} };
+
+ /*
+ * 3. obj references in vlen attr
+ */
+ hid_t vlen_objref_attr_tid=0, vlen_objref_attr_sid=0;
+ hid_t vlen_objref_attr_id=0;
+ hvl_t vlen_objref_data[DIM_VLEN_OBJREF];
+ hsize_t vlen_objref_dims[RANK_VLEN_OBJREF] = {DIM_VLEN_OBJREF};
+
+ /*
+ * 4. region references in vlen attr
+ */
+ hid_t vlen_regref_attr_tid=0, vlen_regref_attr_sid=0;
+ hid_t vlen_regref_attr_id=0;
+ hvl_t vlen_regref_data[DIM_VLEN_REGREF];
+ hsize_t vlen_regref_dim[RANK_VLEN_REGREF] = {DIM_VLEN_REGREF};
+
+
+ /* ---------------------------------------
+ * create objects which to be referenced
+ */
+ /* object1 group */
+ objgid = H5Gcreate2(loc_id, NAME_OBJ_GRP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* object2 dataset */
+ objsid = H5Screate_simple(RANK_OBJ, obj_dims, NULL);
+ objdid = H5Dcreate2(loc_id, NAME_OBJ_DS1, H5T_NATIVE_INT, objsid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Dwrite(objdid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, obj_data[0]);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* object3 named datatype */
+ objtid = H5Tcopy(H5T_NATIVE_INT);
+ status = H5Tcommit2(loc_id, NAME_OBJ_NDTYPE, objtid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Tcommit2 failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+
+ /* ---------------------------------------------
+ * Put testing objs in this group
+ * create group contain dataset with attribute and the attribute has
+ * compound type which contain obj and region reference */
+ main_gid = H5Gcreate2(loc_id, "group_main", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (main_gid < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Gcreate2 failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /*----------------------------------------------------------
+ * create dataset which the attribute will be attached to
+ */
+ main_sid = H5Screate_simple(RANK_DSET, main_dset_dims, NULL);
+
+ main_did = H5Dcreate2(main_gid, "dset_main", H5T_NATIVE_INT, main_sid, H5P_DEFAULT,H5P_DEFAULT, H5P_DEFAULT);
+
+ status = H5Dwrite(main_did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, obj_data[0]);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /*-------------------------------------------------------------------
+ * 1. create obj references in a attribute of compound type
+ */
+
+ /*
+ * create compound type for attribute
+ */
+ comp_objref_tid = H5Tcreate (H5T_COMPOUND, sizeof(comp_objref_t));
+
+ H5Tinsert(comp_objref_tid, "value_objref", HOFFSET(comp_objref_t, val_objref), H5T_STD_REF_OBJ);
+ H5Tinsert(comp_objref_tid, "value_int", HOFFSET(comp_objref_t, val_int), H5T_NATIVE_INT);
+
+ /*
+ * Create the object references into compound type
+ */
+ /* references to dataset */
+ status = H5Rcreate (&(comp_objref_data[0].val_objref), loc_id, NAME_OBJ_DS1, H5R_OBJECT,(hid_t)-1);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+ comp_objref_data[0].val_int = 0;
+
+ /* references to group */
+ status = H5Rcreate (&(comp_objref_data[1].val_objref), loc_id, NAME_OBJ_GRP, H5R_OBJECT,(hid_t)-1);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+ comp_objref_data[1].val_int = 10;
+
+ /* references to datatype */
+ status = H5Rcreate (&(comp_objref_data[2].val_objref), loc_id, NAME_OBJ_NDTYPE, H5R_OBJECT,(hid_t)-1);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+ comp_objref_data[2].val_int = 20;
+
+ /*
+ * create attribute and write the object ref
+ */
+ comp_objref_attr_sid = H5Screate_simple (RANK_COMP_OBJREF, comp_objref_dim, NULL);
+ comp_objref_aid = H5Acreate2 (main_did, "Comp_OBJREF", comp_objref_tid, comp_objref_attr_sid, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Awrite (comp_objref_aid, comp_objref_tid, comp_objref_data);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Awrite failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /*-------------------------------------------------------------------
+ * 2. create region references in attribute of compound type
+ */
+ /*
+ * create compound type for attribute
+ */
+ comp_regref_tid = H5Tcreate (H5T_COMPOUND, sizeof(comp_regref_t));
+
+ H5Tinsert(comp_regref_tid, "value_regref", HOFFSET(comp_regref_t, val_regref), H5T_STD_REF_DSETREG);
+ H5Tinsert(comp_regref_tid, "value_int", HOFFSET(comp_regref_t, val_int), H5T_NATIVE_INT);
+
+ /*
+ * create the region reference
+ */
+ 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__);
+ ret = FAIL;
+ goto out;
+ }
+ status = H5Rcreate (&(comp_regref_data[0].val_regref), loc_id, NAME_OBJ_DS1, H5R_DATASET_REGION, objsid);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+ comp_regref_data[0].val_int = 10;
+
+ /*
+ * create attribute and write the region ref
+ */
+ comp_regref_attr_sid = H5Screate_simple (RANK_COMP_REGREF, comp_regref_dim, NULL);
+ comp_regref_aid = H5Acreate2 (main_did, "Comp_REGREF", comp_regref_tid, comp_regref_attr_sid, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Awrite (comp_regref_aid, comp_regref_tid, comp_regref_data);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Awrite failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+
+ /*-------------------------------------------------------------------
+ * 3. create obj references in attribute of vlen type
+ */
+ /*
+ * prepare vlen data
+ */
+ vlen_objref_data[0].len = LEN0_VLEN_OBJREF;
+ vlen_objref_data[0].p = HDmalloc (vlen_objref_data[0].len * sizeof(hobj_ref_t));
+ vlen_objref_data[1].len = LEN1_VLEN_OBJREF;
+ vlen_objref_data[1].p = HDmalloc (vlen_objref_data[1].len * sizeof(hobj_ref_t));
+ vlen_objref_data[2].len = LEN2_VLEN_OBJREF;
+ vlen_objref_data[2].p = HDmalloc (vlen_objref_data[2].len * sizeof(hobj_ref_t));
+
+ /*
+ * create obj references
+ */
+ /* reference to dataset */
+ status = H5Rcreate (&((hobj_ref_t*)vlen_objref_data[0].p)[0], loc_id, NAME_OBJ_DS1, H5R_OBJECT, (hid_t)-1);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+ /* reference to group */
+ status = H5Rcreate (&((hobj_ref_t*)vlen_objref_data[1].p)[0], loc_id, NAME_OBJ_GRP, H5R_OBJECT, (hid_t)-1);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+ /* reference to datatype */
+ status = H5Rcreate (&((hobj_ref_t*)vlen_objref_data[2].p)[0], loc_id, NAME_OBJ_NDTYPE, H5R_OBJECT, (hid_t)-1);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /*
+ * create vlen type with obj reference
+ */
+ vlen_objref_attr_tid = H5Tvlen_create (H5T_STD_REF_OBJ);
+ vlen_objref_attr_sid = H5Screate_simple (RANK_VLEN_OBJREF, vlen_objref_dims, NULL);
+
+ /*
+ * create attribute and write the object reference
+ */
+ vlen_objref_attr_id = H5Acreate2(main_did, "Vlen_OBJREF", vlen_objref_attr_tid, vlen_objref_attr_sid, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Awrite (vlen_objref_attr_id, vlen_objref_attr_tid, vlen_objref_data);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Awrite failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* close resource for vlen data */
+ status = H5Dvlen_reclaim (vlen_objref_attr_tid, vlen_objref_attr_sid, H5P_DEFAULT, vlen_objref_data);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Dvlen_reclaim failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /*-------------------------------------------------------------------
+ * 4. create region references in a attribute of vlen type
+ */
+
+ /*
+ * prepare vlen data
+ */
+ vlen_regref_data[0].len = LEN0_VLEN_REGREF;
+ vlen_regref_data[0].p = HDmalloc (vlen_regref_data[0].len * sizeof(hdset_reg_ref_t));
+
+ /*
+ * create region reference
+ */
+ 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__);
+ ret = FAIL;
+ goto out;
+ }
+ status = H5Rcreate (&((hdset_reg_ref_t*)vlen_regref_data[0].p)[0], loc_id, NAME_OBJ_DS1, H5R_DATASET_REGION, objsid);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /*
+ * create vlen type with region reference
+ */
+ vlen_regref_attr_tid = H5Tvlen_create(H5T_STD_REF_DSETREG);
+ vlen_regref_attr_sid = H5Screate_simple(RANK_VLEN_REGREF, vlen_regref_dim, NULL);
+
+ /*
+ * create attribute and write the region reference
+ */
+ vlen_regref_attr_id = H5Acreate2(main_did, "Vlen_REGREF", vlen_regref_attr_tid, vlen_regref_attr_sid, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Awrite(vlen_regref_attr_id, vlen_regref_attr_tid, vlen_regref_data);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Awrite failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* close resource for vlen data */
+ status = H5Dvlen_reclaim (vlen_regref_attr_tid, vlen_regref_attr_sid, H5P_DEFAULT, vlen_regref_data);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Dvlen_reclaim failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+out:
+ /* release resources */
+ if (objgid > 0)
+ H5Gclose(objgid);
+ if (objsid > 0)
+ H5Sclose(objsid);
+ if (objdid > 0)
+ H5Dclose(objdid);
+ if (objtid > 0)
+ H5Tclose(objtid);
+
+ if (main_gid > 0)
+ H5Gclose(main_gid);
+ if (main_sid > 0)
+ H5Sclose(main_sid);
+ if (main_did > 0)
+ H5Dclose(main_did);
+ /* comp obj ref */
+ if (comp_objref_tid > 0)
+ H5Tclose(comp_objref_tid);
+ if (comp_objref_aid > 0)
+ H5Aclose(comp_objref_aid);
+ if (comp_objref_attr_sid > 0)
+ H5Sclose(comp_objref_attr_sid);
+ /* comp region ref */
+ if (comp_regref_tid > 0)
+ H5Tclose(comp_regref_tid);
+ if (comp_regref_aid > 0)
+ H5Aclose(comp_regref_aid);
+ if (comp_regref_attr_sid > 0)
+ H5Sclose(comp_regref_attr_sid);
+ /* vlen obj ref */
+ if (vlen_objref_attr_id > 0)
+ H5Aclose(vlen_objref_attr_id);
+ if (vlen_objref_attr_sid > 0)
+ H5Sclose(vlen_objref_attr_sid);
+ if (vlen_objref_attr_tid > 0)
+ H5Tclose(vlen_objref_attr_tid);
+ /* vlen region ref */
+ if (vlen_regref_attr_id > 0)
+ H5Aclose(vlen_regref_attr_id);
+ if (vlen_regref_attr_sid > 0)
+ H5Sclose(vlen_regref_attr_sid);
+ if (vlen_regref_attr_tid > 0)
+ H5Tclose(vlen_regref_attr_tid);
+
+ return ret;
+}
diff --git a/tools/test/h5repack/testfiles/1_vds.h5-vds_dset_chunk20x10x5-v.ddl b/tools/test/h5repack/testfiles/1_vds.h5-vds_dset_chunk20x10x5-v.ddl
new file mode 100644
index 0000000..fab9494
--- /dev/null
+++ b/tools/test/h5repack/testfiles/1_vds.h5-vds_dset_chunk20x10x5-v.ddl
@@ -0,0 +1,112 @@
+HDF5 "out-vds_dset_chunk20x10x5.1_vds.h5" {
+DATASET "vds_dset" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 5, 18, 8 ) / ( H5S_UNLIMITED, 18, 8 ) }
+ STORAGE_LAYOUT {
+ CHUNKED ( 20, 10, 5 )
+ SIZE 16000
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE -9
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_INCR
+ }
+ DATA {
+ (0,0,0): 10, 10, 10, 10, 10, 10, 10, 10,
+ (0,1,0): 10, 10, 10, 10, 10, 10, 10, 10,
+ (0,2,0): 20, 20, 20, 20, 20, 20, 20, 20,
+ (0,3,0): 20, 20, 20, 20, 20, 20, 20, 20,
+ (0,4,0): 20, 20, 20, 20, 20, 20, 20, 20,
+ (0,5,0): 20, 20, 20, 20, 20, 20, 20, 20,
+ (0,6,0): 30, 30, 30, 30, 30, 30, 30, 30,
+ (0,7,0): 30, 30, 30, 30, 30, 30, 30, 30,
+ (0,8,0): 40, 40, 40, 40, 40, 40, 40, 40,
+ (0,9,0): 40, 40, 40, 40, 40, 40, 40, 40,
+ (0,10,0): 40, 40, 40, 40, 40, 40, 40, 40,
+ (0,11,0): 40, 40, 40, 40, 40, 40, 40, 40,
+ (0,12,0): 50, 50, 50, 50, 50, 50, 50, 50,
+ (0,13,0): 50, 50, 50, 50, 50, 50, 50, 50,
+ (0,14,0): 60, 60, 60, 60, 60, 60, 60, 60,
+ (0,15,0): 60, 60, 60, 60, 60, 60, 60, 60,
+ (0,16,0): 60, 60, 60, 60, 60, 60, 60, 60,
+ (0,17,0): 60, 60, 60, 60, 60, 60, 60, 60,
+ (1,0,0): 11, 11, 11, 11, 11, 11, 11, 11,
+ (1,1,0): 11, 11, 11, 11, 11, 11, 11, 11,
+ (1,2,0): 21, 21, 21, 21, 21, 21, 21, 21,
+ (1,3,0): 21, 21, 21, 21, 21, 21, 21, 21,
+ (1,4,0): 21, 21, 21, 21, 21, 21, 21, 21,
+ (1,5,0): 21, 21, 21, 21, 21, 21, 21, 21,
+ (1,6,0): 31, 31, 31, 31, 31, 31, 31, 31,
+ (1,7,0): 31, 31, 31, 31, 31, 31, 31, 31,
+ (1,8,0): 41, 41, 41, 41, 41, 41, 41, 41,
+ (1,9,0): 41, 41, 41, 41, 41, 41, 41, 41,
+ (1,10,0): 41, 41, 41, 41, 41, 41, 41, 41,
+ (1,11,0): 41, 41, 41, 41, 41, 41, 41, 41,
+ (1,12,0): 51, 51, 51, 51, 51, 51, 51, 51,
+ (1,13,0): 51, 51, 51, 51, 51, 51, 51, 51,
+ (1,14,0): 61, 61, 61, 61, 61, 61, 61, 61,
+ (1,15,0): 61, 61, 61, 61, 61, 61, 61, 61,
+ (1,16,0): 61, 61, 61, 61, 61, 61, 61, 61,
+ (1,17,0): 61, 61, 61, 61, 61, 61, 61, 61,
+ (2,0,0): 12, 12, 12, 12, 12, 12, 12, 12,
+ (2,1,0): 12, 12, 12, 12, 12, 12, 12, 12,
+ (2,2,0): 22, 22, 22, 22, 22, 22, 22, 22,
+ (2,3,0): 22, 22, 22, 22, 22, 22, 22, 22,
+ (2,4,0): 22, 22, 22, 22, 22, 22, 22, 22,
+ (2,5,0): 22, 22, 22, 22, 22, 22, 22, 22,
+ (2,6,0): 32, 32, 32, 32, 32, 32, 32, 32,
+ (2,7,0): 32, 32, 32, 32, 32, 32, 32, 32,
+ (2,8,0): 42, 42, 42, 42, 42, 42, 42, 42,
+ (2,9,0): 42, 42, 42, 42, 42, 42, 42, 42,
+ (2,10,0): 42, 42, 42, 42, 42, 42, 42, 42,
+ (2,11,0): 42, 42, 42, 42, 42, 42, 42, 42,
+ (2,12,0): 52, 52, 52, 52, 52, 52, 52, 52,
+ (2,13,0): 52, 52, 52, 52, 52, 52, 52, 52,
+ (2,14,0): 62, 62, 62, 62, 62, 62, 62, 62,
+ (2,15,0): 62, 62, 62, 62, 62, 62, 62, 62,
+ (2,16,0): 62, 62, 62, 62, 62, 62, 62, 62,
+ (2,17,0): 62, 62, 62, 62, 62, 62, 62, 62,
+ (3,0,0): 13, 13, 13, 13, 13, 13, 13, 13,
+ (3,1,0): 13, 13, 13, 13, 13, 13, 13, 13,
+ (3,2,0): 23, 23, 23, 23, 23, 23, 23, 23,
+ (3,3,0): 23, 23, 23, 23, 23, 23, 23, 23,
+ (3,4,0): 23, 23, 23, 23, 23, 23, 23, 23,
+ (3,5,0): 23, 23, 23, 23, 23, 23, 23, 23,
+ (3,6,0): 33, 33, 33, 33, 33, 33, 33, 33,
+ (3,7,0): 33, 33, 33, 33, 33, 33, 33, 33,
+ (3,8,0): 43, 43, 43, 43, 43, 43, 43, 43,
+ (3,9,0): 43, 43, 43, 43, 43, 43, 43, 43,
+ (3,10,0): 43, 43, 43, 43, 43, 43, 43, 43,
+ (3,11,0): 43, 43, 43, 43, 43, 43, 43, 43,
+ (3,12,0): 53, 53, 53, 53, 53, 53, 53, 53,
+ (3,13,0): 53, 53, 53, 53, 53, 53, 53, 53,
+ (3,14,0): 63, 63, 63, 63, 63, 63, 63, 63,
+ (3,15,0): 63, 63, 63, 63, 63, 63, 63, 63,
+ (3,16,0): 63, 63, 63, 63, 63, 63, 63, 63,
+ (3,17,0): 63, 63, 63, 63, 63, 63, 63, 63,
+ (4,0,0): 14, 14, 14, 14, 14, 14, 14, 14,
+ (4,1,0): 14, 14, 14, 14, 14, 14, 14, 14,
+ (4,2,0): 24, 24, 24, 24, 24, 24, 24, 24,
+ (4,3,0): 24, 24, 24, 24, 24, 24, 24, 24,
+ (4,4,0): 24, 24, 24, 24, 24, 24, 24, 24,
+ (4,5,0): 24, 24, 24, 24, 24, 24, 24, 24,
+ (4,6,0): 34, 34, 34, 34, 34, 34, 34, 34,
+ (4,7,0): 34, 34, 34, 34, 34, 34, 34, 34,
+ (4,8,0): 44, 44, 44, 44, 44, 44, 44, 44,
+ (4,9,0): 44, 44, 44, 44, 44, 44, 44, 44,
+ (4,10,0): 44, 44, 44, 44, 44, 44, 44, 44,
+ (4,11,0): 44, 44, 44, 44, 44, 44, 44, 44,
+ (4,12,0): 54, 54, 54, 54, 54, 54, 54, 54,
+ (4,13,0): 54, 54, 54, 54, 54, 54, 54, 54,
+ (4,14,0): 64, 64, 64, 64, 64, 64, 64, 64,
+ (4,15,0): 64, 64, 64, 64, 64, 64, 64, 64,
+ (4,16,0): 64, 64, 64, 64, 64, 64, 64, 64,
+ (4,17,0): 64, 64, 64, 64, 64, 64, 64, 64
+ }
+}
+}
diff --git a/tools/test/h5repack/testfiles/2_vds.h5-vds_chunk3x6x9-v.ddl b/tools/test/h5repack/testfiles/2_vds.h5-vds_chunk3x6x9-v.ddl
new file mode 100644
index 0000000..51df9dd
--- /dev/null
+++ b/tools/test/h5repack/testfiles/2_vds.h5-vds_chunk3x6x9-v.ddl
@@ -0,0 +1,70 @@
+HDF5 "out-vds_chunk3x6x9.2_vds.h5" {
+DATASET "vds_dset" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 6, 8, 14 ) / ( H5S_UNLIMITED, 8, 14 ) }
+ STORAGE_LAYOUT {
+ CHUNKED ( 3, 6, 9 )
+ SIZE 5184
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE -9
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_INCR
+ }
+ DATA {
+ (0,0,0): 10, 10, 10, 10, 10, 10, 10, 40, 40, 40, 40, 40, 40, 40,
+ (0,1,0): 10, 10, 10, 10, 10, 10, 10, 40, 40, 40, 40, 40, 40, 40,
+ (0,2,0): 20, 20, 20, 20, 20, 20, 20, 40, 40, 40, 40, 40, 40, 40,
+ (0,3,0): 20, 20, 20, 20, 20, 20, 20, 40, 40, 40, 40, 40, 40, 40,
+ (0,4,0): 20, 20, 20, 20, 20, 20, 20, 40, 40, 40, 40, 40, 40, 40,
+ (0,5,0): 20, 20, 20, 20, 20, 20, 20, 50, 50, 50, 50, 50, 50, 50,
+ (0,6,0): 30, 30, 30, 30, 30, 30, 30, 50, 50, 50, 50, 50, 50, 50,
+ (0,7,0): 30, 30, 30, 30, 30, 30, 30, 50, 50, 50, 50, 50, 50, 50,
+ (1,0,0): 11, 11, 11, 11, 11, 11, 11, 41, 41, 41, 41, 41, 41, 41,
+ (1,1,0): 11, 11, 11, 11, 11, 11, 11, 41, 41, 41, 41, 41, 41, 41,
+ (1,2,0): 21, 21, 21, 21, 21, 21, 21, 41, 41, 41, 41, 41, 41, 41,
+ (1,3,0): 21, 21, 21, 21, 21, 21, 21, 41, 41, 41, 41, 41, 41, 41,
+ (1,4,0): 21, 21, 21, 21, 21, 21, 21, 41, 41, 41, 41, 41, 41, 41,
+ (1,5,0): 21, 21, 21, 21, 21, 21, 21, 51, 51, 51, 51, 51, 51, 51,
+ (1,6,0): 31, 31, 31, 31, 31, 31, 31, 51, 51, 51, 51, 51, 51, 51,
+ (1,7,0): 31, 31, 31, 31, 31, 31, 31, 51, 51, 51, 51, 51, 51, 51,
+ (2,0,0): 12, 12, 12, 12, 12, 12, 12, 42, 42, 42, 42, 42, 42, 42,
+ (2,1,0): 12, 12, 12, 12, 12, 12, 12, 42, 42, 42, 42, 42, 42, 42,
+ (2,2,0): 22, 22, 22, 22, 22, 22, 22, 42, 42, 42, 42, 42, 42, 42,
+ (2,3,0): 22, 22, 22, 22, 22, 22, 22, 42, 42, 42, 42, 42, 42, 42,
+ (2,4,0): 22, 22, 22, 22, 22, 22, 22, 42, 42, 42, 42, 42, 42, 42,
+ (2,5,0): 22, 22, 22, 22, 22, 22, 22, 52, 52, 52, 52, 52, 52, 52,
+ (2,6,0): 32, 32, 32, 32, 32, 32, 32, 52, 52, 52, 52, 52, 52, 52,
+ (2,7,0): 32, 32, 32, 32, 32, 32, 32, 52, 52, 52, 52, 52, 52, 52,
+ (3,0,0): 13, 13, 13, 13, 13, 13, 13, 43, 43, 43, 43, 43, 43, 43,
+ (3,1,0): 13, 13, 13, 13, 13, 13, 13, 43, 43, 43, 43, 43, 43, 43,
+ (3,2,0): 23, 23, 23, 23, 23, 23, 23, 43, 43, 43, 43, 43, 43, 43,
+ (3,3,0): 23, 23, 23, 23, 23, 23, 23, 43, 43, 43, 43, 43, 43, 43,
+ (3,4,0): 23, 23, 23, 23, 23, 23, 23, 43, 43, 43, 43, 43, 43, 43,
+ (3,5,0): 23, 23, 23, 23, 23, 23, 23, 53, 53, 53, 53, 53, 53, 53,
+ (3,6,0): 33, 33, 33, 33, 33, 33, 33, 53, 53, 53, 53, 53, 53, 53,
+ (3,7,0): 33, 33, 33, 33, 33, 33, 33, 53, 53, 53, 53, 53, 53, 53,
+ (4,0,0): 14, 14, 14, 14, 14, 14, 14, 44, 44, 44, 44, 44, 44, 44,
+ (4,1,0): 14, 14, 14, 14, 14, 14, 14, 44, 44, 44, 44, 44, 44, 44,
+ (4,2,0): 24, 24, 24, 24, 24, 24, 24, 44, 44, 44, 44, 44, 44, 44,
+ (4,3,0): 24, 24, 24, 24, 24, 24, 24, 44, 44, 44, 44, 44, 44, 44,
+ (4,4,0): 24, 24, 24, 24, 24, 24, 24, 44, 44, 44, 44, 44, 44, 44,
+ (4,5,0): 24, 24, 24, 24, 24, 24, 24, 54, 54, 54, 54, 54, 54, 54,
+ (4,6,0): 34, 34, 34, 34, 34, 34, 34, 54, 54, 54, 54, 54, 54, 54,
+ (4,7,0): 34, 34, 34, 34, 34, 34, 34, 54, 54, 54, 54, 54, 54, 54,
+ (5,0,0): 15, 15, 15, 15, 15, 15, 15, 45, 45, 45, 45, 45, 45, 45,
+ (5,1,0): 15, 15, 15, 15, 15, 15, 15, 45, 45, 45, 45, 45, 45, 45,
+ (5,2,0): 25, 25, 25, 25, 25, 25, 25, 45, 45, 45, 45, 45, 45, 45,
+ (5,3,0): 25, 25, 25, 25, 25, 25, 25, 45, 45, 45, 45, 45, 45, 45,
+ (5,4,0): 25, 25, 25, 25, 25, 25, 25, 45, 45, 45, 45, 45, 45, 45,
+ (5,5,0): 25, 25, 25, 25, 25, 25, 25, 55, 55, 55, 55, 55, 55, 55,
+ (5,6,0): 35, 35, 35, 35, 35, 35, 35, 55, 55, 55, 55, 55, 55, 55,
+ (5,7,0): 35, 35, 35, 35, 35, 35, 35, 55, 55, 55, 55, 55, 55, 55
+ }
+}
+}
diff --git a/tools/test/h5repack/testfiles/3_1_vds.h5-vds_chunk2x5x8-v.ddl b/tools/test/h5repack/testfiles/3_1_vds.h5-vds_chunk2x5x8-v.ddl
new file mode 100644
index 0000000..dcd172c
--- /dev/null
+++ b/tools/test/h5repack/testfiles/3_1_vds.h5-vds_chunk2x5x8-v.ddl
@@ -0,0 +1,147 @@
+HDF5 "out-vds_chunk2x5x8.3_1_vds.h5" {
+DATASET "vds_dset" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 5, 25, 8 ) / ( H5S_UNLIMITED, 25, 8 ) }
+ STORAGE_LAYOUT {
+ CHUNKED ( 2, 5, 8 )
+ SIZE 4800
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE -9
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_INCR
+ }
+ DATA {
+ (0,0,0): -9, -9, -9, -9, -9, -9, -9, -9,
+ (0,1,0): 10, 10, 10, 10, 10, 10, 10, 10,
+ (0,2,0): 10, 10, 10, 10, 10, 10, 10, 10,
+ (0,3,0): -9, -9, -9, -9, -9, -9, -9, -9,
+ (0,4,0): 20, 20, 20, 20, 20, 20, 20, 20,
+ (0,5,0): 20, 20, 20, 20, 20, 20, 20, 20,
+ (0,6,0): 20, 20, 20, 20, 20, 20, 20, 20,
+ (0,7,0): 20, 20, 20, 20, 20, 20, 20, 20,
+ (0,8,0): -9, -9, -9, -9, -9, -9, -9, -9,
+ (0,9,0): 30, 30, 30, 30, 30, 30, 30, 30,
+ (0,10,0): 30, 30, 30, 30, 30, 30, 30, 30,
+ (0,11,0): -9, -9, -9, -9, -9, -9, -9, -9,
+ (0,12,0): 40, 40, 40, 40, 40, 40, 40, 40,
+ (0,13,0): 40, 40, 40, 40, 40, 40, 40, 40,
+ (0,14,0): 40, 40, 40, 40, 40, 40, 40, 40,
+ (0,15,0): 40, 40, 40, 40, 40, 40, 40, 40,
+ (0,16,0): -9, -9, -9, -9, -9, -9, -9, -9,
+ (0,17,0): 50, 50, 50, 50, 50, 50, 50, 50,
+ (0,18,0): 50, 50, 50, 50, 50, 50, 50, 50,
+ (0,19,0): -9, -9, -9, -9, -9, -9, -9, -9,
+ (0,20,0): 60, 60, 60, 60, 60, 60, 60, 60,
+ (0,21,0): 60, 60, 60, 60, 60, 60, 60, 60,
+ (0,22,0): 60, 60, 60, 60, 60, 60, 60, 60,
+ (0,23,0): 60, 60, 60, 60, 60, 60, 60, 60,
+ (0,24,0): -9, -9, -9, -9, -9, -9, -9, -9,
+ (1,0,0): -9, -9, -9, -9, -9, -9, -9, -9,
+ (1,1,0): 11, 11, 11, 11, 11, 11, 11, 11,
+ (1,2,0): 11, 11, 11, 11, 11, 11, 11, 11,
+ (1,3,0): -9, -9, -9, -9, -9, -9, -9, -9,
+ (1,4,0): 21, 21, 21, 21, 21, 21, 21, 21,
+ (1,5,0): 21, 21, 21, 21, 21, 21, 21, 21,
+ (1,6,0): 21, 21, 21, 21, 21, 21, 21, 21,
+ (1,7,0): 21, 21, 21, 21, 21, 21, 21, 21,
+ (1,8,0): -9, -9, -9, -9, -9, -9, -9, -9,
+ (1,9,0): 31, 31, 31, 31, 31, 31, 31, 31,
+ (1,10,0): 31, 31, 31, 31, 31, 31, 31, 31,
+ (1,11,0): -9, -9, -9, -9, -9, -9, -9, -9,
+ (1,12,0): 41, 41, 41, 41, 41, 41, 41, 41,
+ (1,13,0): 41, 41, 41, 41, 41, 41, 41, 41,
+ (1,14,0): 41, 41, 41, 41, 41, 41, 41, 41,
+ (1,15,0): 41, 41, 41, 41, 41, 41, 41, 41,
+ (1,16,0): -9, -9, -9, -9, -9, -9, -9, -9,
+ (1,17,0): 51, 51, 51, 51, 51, 51, 51, 51,
+ (1,18,0): 51, 51, 51, 51, 51, 51, 51, 51,
+ (1,19,0): -9, -9, -9, -9, -9, -9, -9, -9,
+ (1,20,0): 61, 61, 61, 61, 61, 61, 61, 61,
+ (1,21,0): 61, 61, 61, 61, 61, 61, 61, 61,
+ (1,22,0): 61, 61, 61, 61, 61, 61, 61, 61,
+ (1,23,0): 61, 61, 61, 61, 61, 61, 61, 61,
+ (1,24,0): -9, -9, -9, -9, -9, -9, -9, -9,
+ (2,0,0): -9, -9, -9, -9, -9, -9, -9, -9,
+ (2,1,0): 12, 12, 12, 12, 12, 12, 12, 12,
+ (2,2,0): 12, 12, 12, 12, 12, 12, 12, 12,
+ (2,3,0): -9, -9, -9, -9, -9, -9, -9, -9,
+ (2,4,0): 22, 22, 22, 22, 22, 22, 22, 22,
+ (2,5,0): 22, 22, 22, 22, 22, 22, 22, 22,
+ (2,6,0): 22, 22, 22, 22, 22, 22, 22, 22,
+ (2,7,0): 22, 22, 22, 22, 22, 22, 22, 22,
+ (2,8,0): -9, -9, -9, -9, -9, -9, -9, -9,
+ (2,9,0): 32, 32, 32, 32, 32, 32, 32, 32,
+ (2,10,0): 32, 32, 32, 32, 32, 32, 32, 32,
+ (2,11,0): -9, -9, -9, -9, -9, -9, -9, -9,
+ (2,12,0): 42, 42, 42, 42, 42, 42, 42, 42,
+ (2,13,0): 42, 42, 42, 42, 42, 42, 42, 42,
+ (2,14,0): 42, 42, 42, 42, 42, 42, 42, 42,
+ (2,15,0): 42, 42, 42, 42, 42, 42, 42, 42,
+ (2,16,0): -9, -9, -9, -9, -9, -9, -9, -9,
+ (2,17,0): 52, 52, 52, 52, 52, 52, 52, 52,
+ (2,18,0): 52, 52, 52, 52, 52, 52, 52, 52,
+ (2,19,0): -9, -9, -9, -9, -9, -9, -9, -9,
+ (2,20,0): 62, 62, 62, 62, 62, 62, 62, 62,
+ (2,21,0): 62, 62, 62, 62, 62, 62, 62, 62,
+ (2,22,0): 62, 62, 62, 62, 62, 62, 62, 62,
+ (2,23,0): 62, 62, 62, 62, 62, 62, 62, 62,
+ (2,24,0): -9, -9, -9, -9, -9, -9, -9, -9,
+ (3,0,0): -9, -9, -9, -9, -9, -9, -9, -9,
+ (3,1,0): 13, 13, 13, 13, 13, 13, 13, 13,
+ (3,2,0): 13, 13, 13, 13, 13, 13, 13, 13,
+ (3,3,0): -9, -9, -9, -9, -9, -9, -9, -9,
+ (3,4,0): 23, 23, 23, 23, 23, 23, 23, 23,
+ (3,5,0): 23, 23, 23, 23, 23, 23, 23, 23,
+ (3,6,0): 23, 23, 23, 23, 23, 23, 23, 23,
+ (3,7,0): 23, 23, 23, 23, 23, 23, 23, 23,
+ (3,8,0): -9, -9, -9, -9, -9, -9, -9, -9,
+ (3,9,0): 33, 33, 33, 33, 33, 33, 33, 33,
+ (3,10,0): 33, 33, 33, 33, 33, 33, 33, 33,
+ (3,11,0): -9, -9, -9, -9, -9, -9, -9, -9,
+ (3,12,0): 43, 43, 43, 43, 43, 43, 43, 43,
+ (3,13,0): 43, 43, 43, 43, 43, 43, 43, 43,
+ (3,14,0): 43, 43, 43, 43, 43, 43, 43, 43,
+ (3,15,0): 43, 43, 43, 43, 43, 43, 43, 43,
+ (3,16,0): -9, -9, -9, -9, -9, -9, -9, -9,
+ (3,17,0): 53, 53, 53, 53, 53, 53, 53, 53,
+ (3,18,0): 53, 53, 53, 53, 53, 53, 53, 53,
+ (3,19,0): -9, -9, -9, -9, -9, -9, -9, -9,
+ (3,20,0): 63, 63, 63, 63, 63, 63, 63, 63,
+ (3,21,0): 63, 63, 63, 63, 63, 63, 63, 63,
+ (3,22,0): 63, 63, 63, 63, 63, 63, 63, 63,
+ (3,23,0): 63, 63, 63, 63, 63, 63, 63, 63,
+ (3,24,0): -9, -9, -9, -9, -9, -9, -9, -9,
+ (4,0,0): -9, -9, -9, -9, -9, -9, -9, -9,
+ (4,1,0): 14, 14, 14, 14, 14, 14, 14, 14,
+ (4,2,0): 14, 14, 14, 14, 14, 14, 14, 14,
+ (4,3,0): -9, -9, -9, -9, -9, -9, -9, -9,
+ (4,4,0): 24, 24, 24, 24, 24, 24, 24, 24,
+ (4,5,0): 24, 24, 24, 24, 24, 24, 24, 24,
+ (4,6,0): 24, 24, 24, 24, 24, 24, 24, 24,
+ (4,7,0): 24, 24, 24, 24, 24, 24, 24, 24,
+ (4,8,0): -9, -9, -9, -9, -9, -9, -9, -9,
+ (4,9,0): 34, 34, 34, 34, 34, 34, 34, 34,
+ (4,10,0): 34, 34, 34, 34, 34, 34, 34, 34,
+ (4,11,0): -9, -9, -9, -9, -9, -9, -9, -9,
+ (4,12,0): 44, 44, 44, 44, 44, 44, 44, 44,
+ (4,13,0): 44, 44, 44, 44, 44, 44, 44, 44,
+ (4,14,0): 44, 44, 44, 44, 44, 44, 44, 44,
+ (4,15,0): 44, 44, 44, 44, 44, 44, 44, 44,
+ (4,16,0): -9, -9, -9, -9, -9, -9, -9, -9,
+ (4,17,0): 54, 54, 54, 54, 54, 54, 54, 54,
+ (4,18,0): 54, 54, 54, 54, 54, 54, 54, 54,
+ (4,19,0): -9, -9, -9, -9, -9, -9, -9, -9,
+ (4,20,0): 64, 64, 64, 64, 64, 64, 64, 64,
+ (4,21,0): 64, 64, 64, 64, 64, 64, 64, 64,
+ (4,22,0): 64, 64, 64, 64, 64, 64, 64, 64,
+ (4,23,0): 64, 64, 64, 64, 64, 64, 64, 64,
+ (4,24,0): -9, -9, -9, -9, -9, -9, -9, -9
+ }
+}
+}
diff --git a/tools/test/h5repack/testfiles/4_vds.h5-vds_compa-v.ddl b/tools/test/h5repack/testfiles/4_vds.h5-vds_compa-v.ddl
new file mode 100644
index 0000000..1e8927c
--- /dev/null
+++ b/tools/test/h5repack/testfiles/4_vds.h5-vds_compa-v.ddl
@@ -0,0 +1,58 @@
+HDF5 "out-vds_compa.4_vds.h5" {
+DATASET "vds_dset" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 9, 4, 4 ) / ( 9, 4, 4 ) }
+ STORAGE_LAYOUT {
+ COMPACT
+ SIZE 576
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE -9
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_EARLY
+ }
+ DATA {
+ (0,0,0): 10, 10, 10, 10,
+ (0,1,0): 10, 10, 10, 10,
+ (0,2,0): 10, 10, 10, 10,
+ (0,3,0): 10, 10, 10, 10,
+ (1,0,0): 11, 11, 11, 11,
+ (1,1,0): 11, 11, 11, 11,
+ (1,2,0): 11, 11, 11, 11,
+ (1,3,0): 11, 11, 11, 11,
+ (2,0,0): 12, 12, 12, 12,
+ (2,1,0): 12, 12, 12, 12,
+ (2,2,0): 12, 12, 12, 12,
+ (2,3,0): 12, 12, 12, 12,
+ (3,0,0): 20, 20, 20, 20,
+ (3,1,0): 20, 20, 20, 20,
+ (3,2,0): 20, 20, 20, 20,
+ (3,3,0): 20, 20, 20, 20,
+ (4,0,0): 21, 21, 21, 21,
+ (4,1,0): 21, 21, 21, 21,
+ (4,2,0): 21, 21, 21, 21,
+ (4,3,0): 21, 21, 21, 21,
+ (5,0,0): 22, 22, 22, 22,
+ (5,1,0): 22, 22, 22, 22,
+ (5,2,0): 22, 22, 22, 22,
+ (5,3,0): 22, 22, 22, 22,
+ (6,0,0): 30, 30, 30, 30,
+ (6,1,0): 30, 30, 30, 30,
+ (6,2,0): 30, 30, 30, 30,
+ (6,3,0): 30, 30, 30, 30,
+ (7,0,0): 31, 31, 31, 31,
+ (7,1,0): 31, 31, 31, 31,
+ (7,2,0): 31, 31, 31, 31,
+ (7,3,0): 31, 31, 31, 31,
+ (8,0,0): 32, 32, 32, 32,
+ (8,1,0): 32, 32, 32, 32,
+ (8,2,0): 32, 32, 32, 32,
+ (8,3,0): 32, 32, 32, 32
+ }
+}
+}
diff --git a/tools/test/h5repack/testfiles/4_vds.h5-vds_conti-v.ddl b/tools/test/h5repack/testfiles/4_vds.h5-vds_conti-v.ddl
new file mode 100644
index 0000000..c499b35
--- /dev/null
+++ b/tools/test/h5repack/testfiles/4_vds.h5-vds_conti-v.ddl
@@ -0,0 +1,59 @@
+HDF5 "out-vds_conti.4_vds.h5" {
+DATASET "vds_dset" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 9, 4, 4 ) / ( 9, 4, 4 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 576
+ OFFSET 2144
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE -9
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ DATA {
+ (0,0,0): 10, 10, 10, 10,
+ (0,1,0): 10, 10, 10, 10,
+ (0,2,0): 10, 10, 10, 10,
+ (0,3,0): 10, 10, 10, 10,
+ (1,0,0): 11, 11, 11, 11,
+ (1,1,0): 11, 11, 11, 11,
+ (1,2,0): 11, 11, 11, 11,
+ (1,3,0): 11, 11, 11, 11,
+ (2,0,0): 12, 12, 12, 12,
+ (2,1,0): 12, 12, 12, 12,
+ (2,2,0): 12, 12, 12, 12,
+ (2,3,0): 12, 12, 12, 12,
+ (3,0,0): 20, 20, 20, 20,
+ (3,1,0): 20, 20, 20, 20,
+ (3,2,0): 20, 20, 20, 20,
+ (3,3,0): 20, 20, 20, 20,
+ (4,0,0): 21, 21, 21, 21,
+ (4,1,0): 21, 21, 21, 21,
+ (4,2,0): 21, 21, 21, 21,
+ (4,3,0): 21, 21, 21, 21,
+ (5,0,0): 22, 22, 22, 22,
+ (5,1,0): 22, 22, 22, 22,
+ (5,2,0): 22, 22, 22, 22,
+ (5,3,0): 22, 22, 22, 22,
+ (6,0,0): 30, 30, 30, 30,
+ (6,1,0): 30, 30, 30, 30,
+ (6,2,0): 30, 30, 30, 30,
+ (6,3,0): 30, 30, 30, 30,
+ (7,0,0): 31, 31, 31, 31,
+ (7,1,0): 31, 31, 31, 31,
+ (7,2,0): 31, 31, 31, 31,
+ (7,3,0): 31, 31, 31, 31,
+ (8,0,0): 32, 32, 32, 32,
+ (8,1,0): 32, 32, 32, 32,
+ (8,2,0): 32, 32, 32, 32,
+ (8,3,0): 32, 32, 32, 32
+ }
+}
+}
diff --git a/tools/test/h5repack/testfiles/README b/tools/test/h5repack/testfiles/README
new file mode 100644
index 0000000..4096dee
--- /dev/null
+++ b/tools/test/h5repack/testfiles/README
@@ -0,0 +1,5 @@
+h5repack_nested_8bit_enum_deflated.h5:
+h5repack_nested_8bit_enum.h5:
+ enuberated 8bit type nested in compount type. Original file provided
+ by a user (HDFFV-8667) as a test file. Used h5copy to extract only the
+ Compound type dataset. The non-deflated version is produced by h5repack.
diff --git a/tools/test/h5repack/testfiles/deflate_limit.h5repack_layout.h5.ddl b/tools/test/h5repack/testfiles/deflate_limit.h5repack_layout.h5.ddl
new file mode 100644
index 0000000..75f54fa
--- /dev/null
+++ b/tools/test/h5repack/testfiles/deflate_limit.h5repack_layout.h5.ddl
@@ -0,0 +1,130 @@
+HDF5 "out-deflate_limit.h5repack_layout.h5" {
+GROUP "/" {
+ DATASET "dset1" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) }
+ STORAGE_LAYOUT {
+ CHUNKED ( 40, 20 )
+ SIZE 1150 (2.783:1 COMPRESSION)
+ }
+ FILTERS {
+ COMPRESSION DEFLATE { LEVEL 1 }
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_INCR
+ }
+ }
+ DATASET "dset2" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) }
+ STORAGE_LAYOUT {
+ CHUNKED ( 40, 20 )
+ SIZE 1150 (2.783:1 COMPRESSION)
+ }
+ FILTERS {
+ COMPRESSION DEFLATE { LEVEL 1 }
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_INCR
+ }
+ }
+ DATASET "dset3" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) }
+ STORAGE_LAYOUT {
+ CHUNKED ( 40, 20 )
+ SIZE 1150 (2.783:1 COMPRESSION)
+ }
+ FILTERS {
+ COMPRESSION DEFLATE { LEVEL 1 }
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_INCR
+ }
+ }
+ DATASET "dset4" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) }
+ STORAGE_LAYOUT {
+ CHUNKED ( 40, 20 )
+ SIZE 1150 (2.783:1 COMPRESSION)
+ }
+ FILTERS {
+ COMPRESSION DEFLATE { LEVEL 1 }
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_INCR
+ }
+ }
+ DATASET "dset_chunk" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) }
+ STORAGE_LAYOUT {
+ CHUNKED ( 20, 10 )
+ SIZE 1283 (2.494:1 COMPRESSION)
+ }
+ FILTERS {
+ COMPRESSION DEFLATE { LEVEL 1 }
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_INCR
+ }
+ }
+ DATASET "dset_compact" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) }
+ STORAGE_LAYOUT {
+ CHUNKED ( 40, 20 )
+ SIZE 1150 (2.783:1 COMPRESSION)
+ }
+ FILTERS {
+ COMPRESSION DEFLATE { LEVEL 1 }
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_INCR
+ }
+ }
+ DATASET "dset_contiguous" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) }
+ STORAGE_LAYOUT {
+ CHUNKED ( 40, 20 )
+ SIZE 1150 (2.783:1 COMPRESSION)
+ }
+ FILTERS {
+ COMPRESSION DEFLATE { LEVEL 1 }
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_INCR
+ }
+ }
+}
+}
diff --git a/tools/test/h5repack/testfiles/h5repack-help.txt b/tools/test/h5repack/testfiles/h5repack-help.txt
new file mode 100644
index 0000000..049e27d
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5repack-help.txt
@@ -0,0 +1,125 @@
+usage: h5repack [OPTIONS] file1 file2
+ file1 Input HDF5 File
+ file2 Output HDF5 File
+ OPTIONS
+ -h, --help Print a usage message and exit
+ -v, --verbose Verbose mode, print object information
+ -V, --version Print version number and exit
+ -n, --native Use a native HDF5 type when repacking
+ -L, --latest Use latest version of file format
+ -c L1, --compact=L1 Maximum number of links in header messages
+ -d L2, --indexed=L2 Minimum number of links in the indexed format
+ -s S[:F], --ssize=S[:F] Shared object header message minimum size
+ -m M, --minimum=M Do not apply the filter to datasets smaller than M
+ -e E, --file=E Name of file E with the -f and -l options
+ -u U, --ublock=U Name of file U with user block data to be added
+ -b B, --block=B Size of user block to be added
+ -M A, --metadata_block_size=A Metadata block size for H5Pset_meta_block_size
+ -t T, --threshold=T Threshold value for H5Pset_alignment
+ -a A, --alignment=A Alignment value for H5Pset_alignment
+ -f FILT, --filter=FILT Filter type
+ -l LAYT, --layout=LAYT Layout type
+ -S FS_STRGY, --fs_strategy=FS_STRGY File space management strategy
+ -T FS_THRD, --fs_threshold=FS_THRD Free-space section threshold
+
+ M - is an integer greater than 1, size of dataset in bytes (default is 0)
+ E - is a filename.
+ S - is an integer
+ U - is a filename.
+ T - is an integer
+ A - is an integer greater than zero
+ B - is the user block size, any value that is 512 or greater and is
+ a power of 2 (1024 default)
+ F - is the shared object header message type, any of <dspace|dtype|fill|
+ pline|attr>. If F is not specified, S applies to all messages
+
+ --enable-error-stack Prints messages from the HDF5 error stack as they
+ occur.
+
+ FS_STRGY is the file space management strategy to use for the output file.
+ It is a string as listed below:
+ ALL_PERSIST - Use persistent free-space managers, aggregators and virtual file driver
+ for file space allocation
+ ALL - Use non-persistent free-space managers, aggregators and virtual file driver
+ for file space allocation
+ AGGR_VFD - Use aggregators and virtual file driver for file space allocation
+ VFD - Use virtual file driver for file space allocation
+
+ FS_THRD is the free-space section threshold to use for the output file.
+ It is the minimum size (in bytes) of free-space sections to be tracked
+ by the the library's free-space managers.
+
+ FILT - is a string with the format:
+
+ <list of objects>:<name of filter>=<filter parameters>
+
+ <list of objects> is a comma separated list of object names, meaning apply
+ compression only to those objects. If no names are specified, the filter
+ is applied to all objects
+ <name of filter> can be:
+ GZIP, to apply the HDF5 GZIP filter (GZIP compression)
+ SZIP, to apply the HDF5 SZIP filter (SZIP compression)
+ SHUF, to apply the HDF5 shuffle filter
+ FLET, to apply the HDF5 checksum filter
+ NBIT, to apply the HDF5 NBIT filter (NBIT compression)
+ SOFF, to apply the HDF5 Scale/Offset filter
+ UD, to apply a user defined filter
+ NONE, to remove all filters
+ <filter parameters> is optional filter parameter information
+ GZIP=<deflation level> from 1-9
+ SZIP=<pixels per block,coding> pixels per block is a even number in
+ 2-32 and coding method is either EC or NN
+ SHUF (no parameter)
+ FLET (no parameter)
+ NBIT (no parameter)
+ SOFF=<scale_factor,scale_type> scale_factor is an integer and scale_type
+ is either IN or DS
+ UD=<filter_number,cd_value_count,value_1[,value_2,...,value_N]>
+ required values for filter_number,cd_value_count,value_1
+ optional values for value_2 to value_N
+ NONE (no parameter)
+
+ LAYT - is a string with the format:
+
+ <list of objects>:<layout type>=<layout parameters>
+
+ <list of objects> is a comma separated list of object names, meaning that
+ layout information is supplied for those objects. If no names are
+ specified, the layout type is applied to all objects
+ <layout type> can be:
+ CHUNK, to apply chunking layout
+ COMPA, to apply compact layout
+ CONTI, to apply contiguous layout
+ <layout parameters> is optional layout information
+ CHUNK=DIM[xDIM...xDIM], the chunk size of each dimension
+ COMPA (no parameter)
+ CONTI (no parameter)
+
+Examples of use:
+
+1) h5repack -v -f GZIP=1 file1 file2
+
+ GZIP compression with level 1 to all objects
+
+2) h5repack -v -f dset1:SZIP=8,NN file1 file2
+
+ SZIP compression with 8 pixels per block and NN coding method to object dset1
+
+3) h5repack -v -l dset1,dset2:CHUNK=20x10 -f dset3,dset4,dset5:NONE file1 file2
+
+ Chunked layout, with a layout size of 20x10, to objects dset1 and dset2
+ and remove filters to objects dset3, dset4, dset5
+
+4) h5repack -L -c 10 -s 20:dtype file1 file2
+
+ Using latest file format with maximum compact group size of 10 and
+ and minimum shared datatype size of 20
+
+5) h5repack -f SHUF -f GZIP=1 file1 file2
+
+ Add both filters SHUF and GZIP in this order to all datasets
+
+6) h5repack -f UD=307,1,9 file1 file2
+
+ Add bzip2 filter to all datasets
+
diff --git a/tools/test/h5repack/testfiles/h5repack.info b/tools/test/h5repack/testfiles/h5repack.info
new file mode 100644
index 0000000..216948d
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5repack.info
@@ -0,0 +1 @@
+-l dset1:CHUNK=20x20 -f dset1,dset2:GZIP=1
diff --git a/tools/test/h5repack/testfiles/h5repack_attr.h5 b/tools/test/h5repack/testfiles/h5repack_attr.h5
new file mode 100644
index 0000000..80df0be
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5repack_attr.h5
Binary files differ
diff --git a/tools/test/h5repack/testfiles/h5repack_attr_refs.h5 b/tools/test/h5repack/testfiles/h5repack_attr_refs.h5
new file mode 100644
index 0000000..1b0ca34
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5repack_attr_refs.h5
Binary files differ
diff --git a/tools/test/h5repack/testfiles/h5repack_deflate.h5 b/tools/test/h5repack/testfiles/h5repack_deflate.h5
new file mode 100644
index 0000000..4988491
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5repack_deflate.h5
Binary files differ
diff --git a/tools/test/h5repack/testfiles/h5repack_early.h5 b/tools/test/h5repack/testfiles/h5repack_early.h5
new file mode 100644
index 0000000..d9a7ece
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5repack_early.h5
Binary files differ
diff --git a/tools/test/h5repack/testfiles/h5repack_ext.bin b/tools/test/h5repack/testfiles/h5repack_ext.bin
new file mode 100644
index 0000000..f858094
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5repack_ext.bin
Binary files differ
diff --git a/tools/test/h5repack/testfiles/h5repack_ext.h5 b/tools/test/h5repack/testfiles/h5repack_ext.h5
new file mode 100644
index 0000000..8518b5b
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5repack_ext.h5
Binary files differ
diff --git a/tools/test/h5repack/testfiles/h5repack_fill.h5 b/tools/test/h5repack/testfiles/h5repack_fill.h5
new file mode 100644
index 0000000..ac40089
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5repack_fill.h5
Binary files differ
diff --git a/tools/test/h5repack/testfiles/h5repack_filters.h5 b/tools/test/h5repack/testfiles/h5repack_filters.h5
new file mode 100644
index 0000000..eabade8
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5repack_filters.h5
Binary files differ
diff --git a/tools/test/h5repack/testfiles/h5repack_filters.h5-gzip_verbose_filters.tst b/tools/test/h5repack/testfiles/h5repack_filters.h5-gzip_verbose_filters.tst
new file mode 100644
index 0000000..36e65b9
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5repack_filters.h5-gzip_verbose_filters.tst
@@ -0,0 +1,13 @@
+Objects to modify layout are...
+Objects to apply filter are...
+ </dset_deflate> with GZIP filter
+ </dset_deflate>...Found
+-----------------------------------------
+ Type Filter (Compression) Name
+-----------------------------------------
+ group /
+ dset /dset_all
+ dset GZIP (0.995:1) /dset_deflate
+ dset /dset_fletcher32
+ dset /dset_nbit
+ dset /dset_shuffle
diff --git a/tools/test/h5repack/testfiles/h5repack_fletcher.h5 b/tools/test/h5repack/testfiles/h5repack_fletcher.h5
new file mode 100644
index 0000000..16ca4ef
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5repack_fletcher.h5
Binary files differ
diff --git a/tools/test/h5repack/testfiles/h5repack_hlink.h5 b/tools/test/h5repack/testfiles/h5repack_hlink.h5
new file mode 100644
index 0000000..80c0fcc
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5repack_hlink.h5
Binary files differ
diff --git a/tools/test/h5repack/testfiles/h5repack_layout.UD.h5 b/tools/test/h5repack/testfiles/h5repack_layout.UD.h5
new file mode 100644
index 0000000..caf2024
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5repack_layout.UD.h5
Binary files differ
diff --git a/tools/test/h5repack/testfiles/h5repack_layout.UD.h5-plugin_none.ddl b/tools/test/h5repack/testfiles/h5repack_layout.UD.h5-plugin_none.ddl
new file mode 100644
index 0000000..66c4c69
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5repack_layout.UD.h5-plugin_none.ddl
@@ -0,0 +1,130 @@
+HDF5 "out-plugin_none.h5repack_layout.UD.h5" {
+GROUP "/" {
+ DATASET "dset1" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) }
+ STORAGE_LAYOUT {
+ CHUNKED ( 40, 20 )
+ SIZE 3200
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_INCR
+ }
+ }
+ DATASET "dset2" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) }
+ STORAGE_LAYOUT {
+ CHUNKED ( 40, 20 )
+ SIZE 3200
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_INCR
+ }
+ }
+ DATASET "dset3" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) }
+ STORAGE_LAYOUT {
+ CHUNKED ( 40, 20 )
+ SIZE 3200
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_INCR
+ }
+ }
+ DATASET "dset4" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) }
+ STORAGE_LAYOUT {
+ CHUNKED ( 40, 20 )
+ SIZE 3200
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_INCR
+ }
+ }
+ DATASET "dset_chunk" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 40, 20 ) / ( 40, H5S_UNLIMITED ) }
+ STORAGE_LAYOUT {
+ CHUNKED ( 20, 10 )
+ SIZE 3200
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_INCR
+ }
+ }
+ DATASET "dset_compact" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) }
+ STORAGE_LAYOUT {
+ CHUNKED ( 40, 20 )
+ SIZE 3200
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_INCR
+ }
+ }
+ DATASET "dset_contiguous" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) }
+ STORAGE_LAYOUT {
+ CHUNKED ( 40, 20 )
+ SIZE 3200
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_INCR
+ }
+ }
+}
+}
diff --git a/tools/test/h5repack/testfiles/h5repack_layout.h5 b/tools/test/h5repack/testfiles/h5repack_layout.h5
new file mode 100644
index 0000000..4e53766
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5repack_layout.h5
Binary files differ
diff --git a/tools/test/h5repack/testfiles/h5repack_layout.h5-dset2_chunk_20x10-errstk.tst b/tools/test/h5repack/testfiles/h5repack_layout.h5-dset2_chunk_20x10-errstk.tst
new file mode 100644
index 0000000..95cc4c6
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5repack_layout.h5-dset2_chunk_20x10-errstk.tst
@@ -0,0 +1,38 @@
+HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
+ #000: (file name) line (number) in H5Dcreate2(): unable to create dataset
+ major: Dataset
+ minor: Unable to initialize object
+ #001: (file name) line (number) in H5D__create_named(): unable to create and link to dataset
+ major: Dataset
+ minor: Unable to initialize object
+ #002: (file name) line (number) in H5L_link_object(): unable to create new link to object
+ major: Links
+ minor: Unable to initialize object
+ #003: (file name) line (number) in H5L_create_real(): can't insert link
+ major: Symbol table
+ minor: Unable to insert object
+ #004: (file name) line (number) in H5G_traverse(): internal path traversal failed
+ major: Symbol table
+ minor: Object not found
+ #005: (file name) line (number) in H5G_traverse_real(): traversal operator failed
+ major: Symbol table
+ minor: Callback failed
+ #006: (file name) line (number) in H5L_link_cb(): unable to create object
+ major: Object header
+ minor: Unable to initialize object
+ #007: (file name) line (number) in H5O_obj_create(): unable to open object
+ major: Object header
+ minor: Can't open object
+ #008: (file name) line (number) in H5O__dset_create(): unable to create dataset
+ major: Dataset
+ minor: Unable to initialize object
+ #009: (file name) line (number) in H5D__create(): unable to construct layout information
+ major: Dataset
+ minor: Unable to initialize object
+ #010: (file name) line (number) in H5D__chunk_construct(): dimensionality of chunks doesn't match the dataspace
+ major: Dataset
+ minor: Bad value
+H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs):
+ #000: (file name) line (number) in do_copy_objects(): H5Dcreate2 failed
+ major: Failure in tools library
+ minor: error in function
diff --git a/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_test.ddl b/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_test.ddl
new file mode 100644
index 0000000..a8b4562
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_test.ddl
@@ -0,0 +1,158 @@
+HDF5 "out-plugin_test.h5repack_layout.h5" {
+GROUP "/" {
+ DATASET "dset1" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) }
+ STORAGE_LAYOUT {
+ CHUNKED ( 40, 20 )
+ SIZE 3200 (1.000:1 COMPRESSION)
+ }
+ FILTERS {
+ USER_DEFINED_FILTER {
+ FILTER_ID 257
+ COMMENT dynlib1
+ PARAMS { 9 }
+ }
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_INCR
+ }
+ }
+ DATASET "dset2" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) }
+ STORAGE_LAYOUT {
+ CHUNKED ( 40, 20 )
+ SIZE 3200 (1.000:1 COMPRESSION)
+ }
+ FILTERS {
+ USER_DEFINED_FILTER {
+ FILTER_ID 257
+ COMMENT dynlib1
+ PARAMS { 9 }
+ }
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_INCR
+ }
+ }
+ DATASET "dset3" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) }
+ STORAGE_LAYOUT {
+ CHUNKED ( 40, 20 )
+ SIZE 3200 (1.000:1 COMPRESSION)
+ }
+ FILTERS {
+ USER_DEFINED_FILTER {
+ FILTER_ID 257
+ COMMENT dynlib1
+ PARAMS { 9 }
+ }
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_INCR
+ }
+ }
+ DATASET "dset4" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) }
+ STORAGE_LAYOUT {
+ CHUNKED ( 40, 20 )
+ SIZE 3200 (1.000:1 COMPRESSION)
+ }
+ FILTERS {
+ USER_DEFINED_FILTER {
+ FILTER_ID 257
+ COMMENT dynlib1
+ PARAMS { 9 }
+ }
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_INCR
+ }
+ }
+ DATASET "dset_chunk" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) }
+ STORAGE_LAYOUT {
+ CHUNKED ( 20, 10 )
+ SIZE 3200 (1.000:1 COMPRESSION)
+ }
+ FILTERS {
+ USER_DEFINED_FILTER {
+ FILTER_ID 257
+ COMMENT dynlib1
+ PARAMS { 9 }
+ }
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_INCR
+ }
+ }
+ DATASET "dset_compact" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) }
+ STORAGE_LAYOUT {
+ CHUNKED ( 40, 20 )
+ SIZE 3200 (1.000:1 COMPRESSION)
+ }
+ FILTERS {
+ USER_DEFINED_FILTER {
+ FILTER_ID 257
+ COMMENT dynlib1
+ PARAMS { 9 }
+ }
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_INCR
+ }
+ }
+ DATASET "dset_contiguous" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) }
+ STORAGE_LAYOUT {
+ CHUNKED ( 40, 20 )
+ SIZE 3200 (1.000:1 COMPRESSION)
+ }
+ FILTERS {
+ USER_DEFINED_FILTER {
+ FILTER_ID 257
+ COMMENT dynlib1
+ PARAMS { 9 }
+ }
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_INCR
+ }
+ }
+}
+}
diff --git a/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl b/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl
new file mode 100644
index 0000000..3d09e14
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl
@@ -0,0 +1,158 @@
+HDF5 "out-plugin_version_test.h5repack_layout.h5" {
+GROUP "/" {
+ DATASET "dset1" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) }
+ STORAGE_LAYOUT {
+ CHUNKED ( 40, 20 )
+ SIZE 3200 (1.000:1 COMPRESSION)
+ }
+ FILTERS {
+ USER_DEFINED_FILTER {
+ FILTER_ID 260
+ COMMENT dynlib4
+ PARAMS { 9 1 9 235 }
+ }
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_INCR
+ }
+ }
+ DATASET "dset2" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) }
+ STORAGE_LAYOUT {
+ CHUNKED ( 40, 20 )
+ SIZE 3200 (1.000:1 COMPRESSION)
+ }
+ FILTERS {
+ USER_DEFINED_FILTER {
+ FILTER_ID 260
+ COMMENT dynlib4
+ PARAMS { 9 1 9 235 }
+ }
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_INCR
+ }
+ }
+ DATASET "dset3" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) }
+ STORAGE_LAYOUT {
+ CHUNKED ( 40, 20 )
+ SIZE 3200 (1.000:1 COMPRESSION)
+ }
+ FILTERS {
+ USER_DEFINED_FILTER {
+ FILTER_ID 260
+ COMMENT dynlib4
+ PARAMS { 9 1 9 235 }
+ }
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_INCR
+ }
+ }
+ DATASET "dset4" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) }
+ STORAGE_LAYOUT {
+ CHUNKED ( 40, 20 )
+ SIZE 3200 (1.000:1 COMPRESSION)
+ }
+ FILTERS {
+ USER_DEFINED_FILTER {
+ FILTER_ID 260
+ COMMENT dynlib4
+ PARAMS { 9 1 9 235 }
+ }
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_INCR
+ }
+ }
+ DATASET "dset_chunk" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) }
+ STORAGE_LAYOUT {
+ CHUNKED ( 20, 10 )
+ SIZE 3200 (1.000:1 COMPRESSION)
+ }
+ FILTERS {
+ USER_DEFINED_FILTER {
+ FILTER_ID 260
+ COMMENT dynlib4
+ PARAMS { 9 1 9 235 }
+ }
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_INCR
+ }
+ }
+ DATASET "dset_compact" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) }
+ STORAGE_LAYOUT {
+ CHUNKED ( 40, 20 )
+ SIZE 3200 (1.000:1 COMPRESSION)
+ }
+ FILTERS {
+ USER_DEFINED_FILTER {
+ FILTER_ID 260
+ COMMENT dynlib4
+ PARAMS { 9 1 9 235 }
+ }
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_INCR
+ }
+ }
+ DATASET "dset_contiguous" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) }
+ STORAGE_LAYOUT {
+ CHUNKED ( 40, 20 )
+ SIZE 3200 (1.000:1 COMPRESSION)
+ }
+ FILTERS {
+ USER_DEFINED_FILTER {
+ FILTER_ID 260
+ COMMENT dynlib4
+ PARAMS { 9 1 9 235 }
+ }
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_INCR
+ }
+ }
+}
+}
diff --git a/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_zero.tst b/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_zero.tst
new file mode 100644
index 0000000..0993d5b
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_zero.tst
@@ -0,0 +1,9 @@
+Objects to modify layout are...
+Objects to apply filter are...
+ User Defined 250
+Making file <out-plugin_zero.h5repack_layout.h5>...
+-----------------------------------------
+ Type Filter (Compression) Name
+-----------------------------------------
+ group /
+h5repack error: <h5repack_layout.h5>: Could not copy data to: out-plugin_zero.h5repack_layout.h5
diff --git a/tools/test/h5repack/testfiles/h5repack_layout.h5.ddl b/tools/test/h5repack/testfiles/h5repack_layout.h5.ddl
new file mode 100644
index 0000000..00c74f4
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5repack_layout.h5.ddl
@@ -0,0 +1,606 @@
+HDF5 "h5repack_layout.h5" {
+GROUP "/" {
+ DATASET "dset1" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) }
+ DATA {
+ (0,0): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
+ (0,18): 18, 19,
+ (1,0): 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
+ (1,16): 36, 37, 38, 39,
+ (2,0): 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
+ (2,16): 56, 57, 58, 59,
+ (3,0): 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
+ (3,16): 76, 77, 78, 79,
+ (4,0): 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
+ (4,16): 96, 97, 98, 99,
+ (5,0): 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
+ (5,13): 113, 114, 115, 116, 117, 118, 119,
+ (6,0): 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132,
+ (6,13): 133, 134, 135, 136, 137, 138, 139,
+ (7,0): 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152,
+ (7,13): 153, 154, 155, 156, 157, 158, 159,
+ (8,0): 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172,
+ (8,13): 173, 174, 175, 176, 177, 178, 179,
+ (9,0): 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192,
+ (9,13): 193, 194, 195, 196, 197, 198, 199,
+ (10,0): 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211,
+ (10,12): 212, 213, 214, 215, 216, 217, 218, 219,
+ (11,0): 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231,
+ (11,12): 232, 233, 234, 235, 236, 237, 238, 239,
+ (12,0): 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251,
+ (12,12): 252, 253, 254, 255, 256, 257, 258, 259,
+ (13,0): 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271,
+ (13,12): 272, 273, 274, 275, 276, 277, 278, 279,
+ (14,0): 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291,
+ (14,12): 292, 293, 294, 295, 296, 297, 298, 299,
+ (15,0): 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311,
+ (15,12): 312, 313, 314, 315, 316, 317, 318, 319,
+ (16,0): 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331,
+ (16,12): 332, 333, 334, 335, 336, 337, 338, 339,
+ (17,0): 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351,
+ (17,12): 352, 353, 354, 355, 356, 357, 358, 359,
+ (18,0): 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371,
+ (18,12): 372, 373, 374, 375, 376, 377, 378, 379,
+ (19,0): 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391,
+ (19,12): 392, 393, 394, 395, 396, 397, 398, 399,
+ (20,0): 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411,
+ (20,12): 412, 413, 414, 415, 416, 417, 418, 419,
+ (21,0): 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431,
+ (21,12): 432, 433, 434, 435, 436, 437, 438, 439,
+ (22,0): 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451,
+ (22,12): 452, 453, 454, 455, 456, 457, 458, 459,
+ (23,0): 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471,
+ (23,12): 472, 473, 474, 475, 476, 477, 478, 479,
+ (24,0): 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491,
+ (24,12): 492, 493, 494, 495, 496, 497, 498, 499,
+ (25,0): 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511,
+ (25,12): 512, 513, 514, 515, 516, 517, 518, 519,
+ (26,0): 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531,
+ (26,12): 532, 533, 534, 535, 536, 537, 538, 539,
+ (27,0): 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551,
+ (27,12): 552, 553, 554, 555, 556, 557, 558, 559,
+ (28,0): 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571,
+ (28,12): 572, 573, 574, 575, 576, 577, 578, 579,
+ (29,0): 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591,
+ (29,12): 592, 593, 594, 595, 596, 597, 598, 599,
+ (30,0): 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611,
+ (30,12): 612, 613, 614, 615, 616, 617, 618, 619,
+ (31,0): 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631,
+ (31,12): 632, 633, 634, 635, 636, 637, 638, 639,
+ (32,0): 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651,
+ (32,12): 652, 653, 654, 655, 656, 657, 658, 659,
+ (33,0): 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671,
+ (33,12): 672, 673, 674, 675, 676, 677, 678, 679,
+ (34,0): 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691,
+ (34,12): 692, 693, 694, 695, 696, 697, 698, 699,
+ (35,0): 700, 701, 702, 703, 704, 705, 706, 707, 708, 709, 710, 711,
+ (35,12): 712, 713, 714, 715, 716, 717, 718, 719,
+ (36,0): 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 730, 731,
+ (36,12): 732, 733, 734, 735, 736, 737, 738, 739,
+ (37,0): 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751,
+ (37,12): 752, 753, 754, 755, 756, 757, 758, 759,
+ (38,0): 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771,
+ (38,12): 772, 773, 774, 775, 776, 777, 778, 779,
+ (39,0): 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791,
+ (39,12): 792, 793, 794, 795, 796, 797, 798, 799
+ }
+ }
+ DATASET "dset2" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) }
+ DATA {
+ (0,0): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
+ (0,18): 18, 19,
+ (1,0): 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
+ (1,16): 36, 37, 38, 39,
+ (2,0): 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
+ (2,16): 56, 57, 58, 59,
+ (3,0): 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
+ (3,16): 76, 77, 78, 79,
+ (4,0): 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
+ (4,16): 96, 97, 98, 99,
+ (5,0): 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
+ (5,13): 113, 114, 115, 116, 117, 118, 119,
+ (6,0): 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132,
+ (6,13): 133, 134, 135, 136, 137, 138, 139,
+ (7,0): 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152,
+ (7,13): 153, 154, 155, 156, 157, 158, 159,
+ (8,0): 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172,
+ (8,13): 173, 174, 175, 176, 177, 178, 179,
+ (9,0): 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192,
+ (9,13): 193, 194, 195, 196, 197, 198, 199,
+ (10,0): 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211,
+ (10,12): 212, 213, 214, 215, 216, 217, 218, 219,
+ (11,0): 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231,
+ (11,12): 232, 233, 234, 235, 236, 237, 238, 239,
+ (12,0): 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251,
+ (12,12): 252, 253, 254, 255, 256, 257, 258, 259,
+ (13,0): 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271,
+ (13,12): 272, 273, 274, 275, 276, 277, 278, 279,
+ (14,0): 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291,
+ (14,12): 292, 293, 294, 295, 296, 297, 298, 299,
+ (15,0): 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311,
+ (15,12): 312, 313, 314, 315, 316, 317, 318, 319,
+ (16,0): 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331,
+ (16,12): 332, 333, 334, 335, 336, 337, 338, 339,
+ (17,0): 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351,
+ (17,12): 352, 353, 354, 355, 356, 357, 358, 359,
+ (18,0): 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371,
+ (18,12): 372, 373, 374, 375, 376, 377, 378, 379,
+ (19,0): 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391,
+ (19,12): 392, 393, 394, 395, 396, 397, 398, 399,
+ (20,0): 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411,
+ (20,12): 412, 413, 414, 415, 416, 417, 418, 419,
+ (21,0): 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431,
+ (21,12): 432, 433, 434, 435, 436, 437, 438, 439,
+ (22,0): 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451,
+ (22,12): 452, 453, 454, 455, 456, 457, 458, 459,
+ (23,0): 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471,
+ (23,12): 472, 473, 474, 475, 476, 477, 478, 479,
+ (24,0): 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491,
+ (24,12): 492, 493, 494, 495, 496, 497, 498, 499,
+ (25,0): 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511,
+ (25,12): 512, 513, 514, 515, 516, 517, 518, 519,
+ (26,0): 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531,
+ (26,12): 532, 533, 534, 535, 536, 537, 538, 539,
+ (27,0): 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551,
+ (27,12): 552, 553, 554, 555, 556, 557, 558, 559,
+ (28,0): 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571,
+ (28,12): 572, 573, 574, 575, 576, 577, 578, 579,
+ (29,0): 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591,
+ (29,12): 592, 593, 594, 595, 596, 597, 598, 599,
+ (30,0): 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611,
+ (30,12): 612, 613, 614, 615, 616, 617, 618, 619,
+ (31,0): 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631,
+ (31,12): 632, 633, 634, 635, 636, 637, 638, 639,
+ (32,0): 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651,
+ (32,12): 652, 653, 654, 655, 656, 657, 658, 659,
+ (33,0): 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671,
+ (33,12): 672, 673, 674, 675, 676, 677, 678, 679,
+ (34,0): 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691,
+ (34,12): 692, 693, 694, 695, 696, 697, 698, 699,
+ (35,0): 700, 701, 702, 703, 704, 705, 706, 707, 708, 709, 710, 711,
+ (35,12): 712, 713, 714, 715, 716, 717, 718, 719,
+ (36,0): 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 730, 731,
+ (36,12): 732, 733, 734, 735, 736, 737, 738, 739,
+ (37,0): 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751,
+ (37,12): 752, 753, 754, 755, 756, 757, 758, 759,
+ (38,0): 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771,
+ (38,12): 772, 773, 774, 775, 776, 777, 778, 779,
+ (39,0): 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791,
+ (39,12): 792, 793, 794, 795, 796, 797, 798, 799
+ }
+ }
+ DATASET "dset3" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) }
+ DATA {
+ (0,0): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
+ (0,18): 18, 19,
+ (1,0): 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
+ (1,16): 36, 37, 38, 39,
+ (2,0): 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
+ (2,16): 56, 57, 58, 59,
+ (3,0): 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
+ (3,16): 76, 77, 78, 79,
+ (4,0): 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
+ (4,16): 96, 97, 98, 99,
+ (5,0): 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
+ (5,13): 113, 114, 115, 116, 117, 118, 119,
+ (6,0): 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132,
+ (6,13): 133, 134, 135, 136, 137, 138, 139,
+ (7,0): 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152,
+ (7,13): 153, 154, 155, 156, 157, 158, 159,
+ (8,0): 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172,
+ (8,13): 173, 174, 175, 176, 177, 178, 179,
+ (9,0): 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192,
+ (9,13): 193, 194, 195, 196, 197, 198, 199,
+ (10,0): 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211,
+ (10,12): 212, 213, 214, 215, 216, 217, 218, 219,
+ (11,0): 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231,
+ (11,12): 232, 233, 234, 235, 236, 237, 238, 239,
+ (12,0): 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251,
+ (12,12): 252, 253, 254, 255, 256, 257, 258, 259,
+ (13,0): 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271,
+ (13,12): 272, 273, 274, 275, 276, 277, 278, 279,
+ (14,0): 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291,
+ (14,12): 292, 293, 294, 295, 296, 297, 298, 299,
+ (15,0): 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311,
+ (15,12): 312, 313, 314, 315, 316, 317, 318, 319,
+ (16,0): 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331,
+ (16,12): 332, 333, 334, 335, 336, 337, 338, 339,
+ (17,0): 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351,
+ (17,12): 352, 353, 354, 355, 356, 357, 358, 359,
+ (18,0): 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371,
+ (18,12): 372, 373, 374, 375, 376, 377, 378, 379,
+ (19,0): 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391,
+ (19,12): 392, 393, 394, 395, 396, 397, 398, 399,
+ (20,0): 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411,
+ (20,12): 412, 413, 414, 415, 416, 417, 418, 419,
+ (21,0): 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431,
+ (21,12): 432, 433, 434, 435, 436, 437, 438, 439,
+ (22,0): 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451,
+ (22,12): 452, 453, 454, 455, 456, 457, 458, 459,
+ (23,0): 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471,
+ (23,12): 472, 473, 474, 475, 476, 477, 478, 479,
+ (24,0): 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491,
+ (24,12): 492, 493, 494, 495, 496, 497, 498, 499,
+ (25,0): 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511,
+ (25,12): 512, 513, 514, 515, 516, 517, 518, 519,
+ (26,0): 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531,
+ (26,12): 532, 533, 534, 535, 536, 537, 538, 539,
+ (27,0): 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551,
+ (27,12): 552, 553, 554, 555, 556, 557, 558, 559,
+ (28,0): 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571,
+ (28,12): 572, 573, 574, 575, 576, 577, 578, 579,
+ (29,0): 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591,
+ (29,12): 592, 593, 594, 595, 596, 597, 598, 599,
+ (30,0): 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611,
+ (30,12): 612, 613, 614, 615, 616, 617, 618, 619,
+ (31,0): 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631,
+ (31,12): 632, 633, 634, 635, 636, 637, 638, 639,
+ (32,0): 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651,
+ (32,12): 652, 653, 654, 655, 656, 657, 658, 659,
+ (33,0): 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671,
+ (33,12): 672, 673, 674, 675, 676, 677, 678, 679,
+ (34,0): 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691,
+ (34,12): 692, 693, 694, 695, 696, 697, 698, 699,
+ (35,0): 700, 701, 702, 703, 704, 705, 706, 707, 708, 709, 710, 711,
+ (35,12): 712, 713, 714, 715, 716, 717, 718, 719,
+ (36,0): 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 730, 731,
+ (36,12): 732, 733, 734, 735, 736, 737, 738, 739,
+ (37,0): 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751,
+ (37,12): 752, 753, 754, 755, 756, 757, 758, 759,
+ (38,0): 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771,
+ (38,12): 772, 773, 774, 775, 776, 777, 778, 779,
+ (39,0): 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791,
+ (39,12): 792, 793, 794, 795, 796, 797, 798, 799
+ }
+ }
+ DATASET "dset4" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) }
+ DATA {
+ (0,0): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
+ (0,18): 18, 19,
+ (1,0): 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
+ (1,16): 36, 37, 38, 39,
+ (2,0): 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
+ (2,16): 56, 57, 58, 59,
+ (3,0): 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
+ (3,16): 76, 77, 78, 79,
+ (4,0): 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
+ (4,16): 96, 97, 98, 99,
+ (5,0): 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
+ (5,13): 113, 114, 115, 116, 117, 118, 119,
+ (6,0): 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132,
+ (6,13): 133, 134, 135, 136, 137, 138, 139,
+ (7,0): 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152,
+ (7,13): 153, 154, 155, 156, 157, 158, 159,
+ (8,0): 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172,
+ (8,13): 173, 174, 175, 176, 177, 178, 179,
+ (9,0): 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192,
+ (9,13): 193, 194, 195, 196, 197, 198, 199,
+ (10,0): 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211,
+ (10,12): 212, 213, 214, 215, 216, 217, 218, 219,
+ (11,0): 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231,
+ (11,12): 232, 233, 234, 235, 236, 237, 238, 239,
+ (12,0): 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251,
+ (12,12): 252, 253, 254, 255, 256, 257, 258, 259,
+ (13,0): 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271,
+ (13,12): 272, 273, 274, 275, 276, 277, 278, 279,
+ (14,0): 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291,
+ (14,12): 292, 293, 294, 295, 296, 297, 298, 299,
+ (15,0): 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311,
+ (15,12): 312, 313, 314, 315, 316, 317, 318, 319,
+ (16,0): 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331,
+ (16,12): 332, 333, 334, 335, 336, 337, 338, 339,
+ (17,0): 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351,
+ (17,12): 352, 353, 354, 355, 356, 357, 358, 359,
+ (18,0): 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371,
+ (18,12): 372, 373, 374, 375, 376, 377, 378, 379,
+ (19,0): 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391,
+ (19,12): 392, 393, 394, 395, 396, 397, 398, 399,
+ (20,0): 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411,
+ (20,12): 412, 413, 414, 415, 416, 417, 418, 419,
+ (21,0): 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431,
+ (21,12): 432, 433, 434, 435, 436, 437, 438, 439,
+ (22,0): 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451,
+ (22,12): 452, 453, 454, 455, 456, 457, 458, 459,
+ (23,0): 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471,
+ (23,12): 472, 473, 474, 475, 476, 477, 478, 479,
+ (24,0): 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491,
+ (24,12): 492, 493, 494, 495, 496, 497, 498, 499,
+ (25,0): 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511,
+ (25,12): 512, 513, 514, 515, 516, 517, 518, 519,
+ (26,0): 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531,
+ (26,12): 532, 533, 534, 535, 536, 537, 538, 539,
+ (27,0): 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551,
+ (27,12): 552, 553, 554, 555, 556, 557, 558, 559,
+ (28,0): 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571,
+ (28,12): 572, 573, 574, 575, 576, 577, 578, 579,
+ (29,0): 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591,
+ (29,12): 592, 593, 594, 595, 596, 597, 598, 599,
+ (30,0): 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611,
+ (30,12): 612, 613, 614, 615, 616, 617, 618, 619,
+ (31,0): 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631,
+ (31,12): 632, 633, 634, 635, 636, 637, 638, 639,
+ (32,0): 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651,
+ (32,12): 652, 653, 654, 655, 656, 657, 658, 659,
+ (33,0): 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671,
+ (33,12): 672, 673, 674, 675, 676, 677, 678, 679,
+ (34,0): 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691,
+ (34,12): 692, 693, 694, 695, 696, 697, 698, 699,
+ (35,0): 700, 701, 702, 703, 704, 705, 706, 707, 708, 709, 710, 711,
+ (35,12): 712, 713, 714, 715, 716, 717, 718, 719,
+ (36,0): 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 730, 731,
+ (36,12): 732, 733, 734, 735, 736, 737, 738, 739,
+ (37,0): 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751,
+ (37,12): 752, 753, 754, 755, 756, 757, 758, 759,
+ (38,0): 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771,
+ (38,12): 772, 773, 774, 775, 776, 777, 778, 779,
+ (39,0): 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791,
+ (39,12): 792, 793, 794, 795, 796, 797, 798, 799
+ }
+ }
+ DATASET "dset_chunk" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 40, 20 ) / ( 40, H5S_UNLIMITED ) }
+ DATA {
+ (0,0): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
+ (0,18): 18, 19,
+ (1,0): 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
+ (1,16): 36, 37, 38, 39,
+ (2,0): 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
+ (2,16): 56, 57, 58, 59,
+ (3,0): 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
+ (3,16): 76, 77, 78, 79,
+ (4,0): 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
+ (4,16): 96, 97, 98, 99,
+ (5,0): 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
+ (5,13): 113, 114, 115, 116, 117, 118, 119,
+ (6,0): 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132,
+ (6,13): 133, 134, 135, 136, 137, 138, 139,
+ (7,0): 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152,
+ (7,13): 153, 154, 155, 156, 157, 158, 159,
+ (8,0): 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172,
+ (8,13): 173, 174, 175, 176, 177, 178, 179,
+ (9,0): 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192,
+ (9,13): 193, 194, 195, 196, 197, 198, 199,
+ (10,0): 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211,
+ (10,12): 212, 213, 214, 215, 216, 217, 218, 219,
+ (11,0): 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231,
+ (11,12): 232, 233, 234, 235, 236, 237, 238, 239,
+ (12,0): 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251,
+ (12,12): 252, 253, 254, 255, 256, 257, 258, 259,
+ (13,0): 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271,
+ (13,12): 272, 273, 274, 275, 276, 277, 278, 279,
+ (14,0): 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291,
+ (14,12): 292, 293, 294, 295, 296, 297, 298, 299,
+ (15,0): 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311,
+ (15,12): 312, 313, 314, 315, 316, 317, 318, 319,
+ (16,0): 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331,
+ (16,12): 332, 333, 334, 335, 336, 337, 338, 339,
+ (17,0): 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351,
+ (17,12): 352, 353, 354, 355, 356, 357, 358, 359,
+ (18,0): 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371,
+ (18,12): 372, 373, 374, 375, 376, 377, 378, 379,
+ (19,0): 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391,
+ (19,12): 392, 393, 394, 395, 396, 397, 398, 399,
+ (20,0): 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411,
+ (20,12): 412, 413, 414, 415, 416, 417, 418, 419,
+ (21,0): 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431,
+ (21,12): 432, 433, 434, 435, 436, 437, 438, 439,
+ (22,0): 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451,
+ (22,12): 452, 453, 454, 455, 456, 457, 458, 459,
+ (23,0): 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471,
+ (23,12): 472, 473, 474, 475, 476, 477, 478, 479,
+ (24,0): 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491,
+ (24,12): 492, 493, 494, 495, 496, 497, 498, 499,
+ (25,0): 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511,
+ (25,12): 512, 513, 514, 515, 516, 517, 518, 519,
+ (26,0): 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531,
+ (26,12): 532, 533, 534, 535, 536, 537, 538, 539,
+ (27,0): 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551,
+ (27,12): 552, 553, 554, 555, 556, 557, 558, 559,
+ (28,0): 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571,
+ (28,12): 572, 573, 574, 575, 576, 577, 578, 579,
+ (29,0): 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591,
+ (29,12): 592, 593, 594, 595, 596, 597, 598, 599,
+ (30,0): 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611,
+ (30,12): 612, 613, 614, 615, 616, 617, 618, 619,
+ (31,0): 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631,
+ (31,12): 632, 633, 634, 635, 636, 637, 638, 639,
+ (32,0): 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651,
+ (32,12): 652, 653, 654, 655, 656, 657, 658, 659,
+ (33,0): 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671,
+ (33,12): 672, 673, 674, 675, 676, 677, 678, 679,
+ (34,0): 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691,
+ (34,12): 692, 693, 694, 695, 696, 697, 698, 699,
+ (35,0): 700, 701, 702, 703, 704, 705, 706, 707, 708, 709, 710, 711,
+ (35,12): 712, 713, 714, 715, 716, 717, 718, 719,
+ (36,0): 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 730, 731,
+ (36,12): 732, 733, 734, 735, 736, 737, 738, 739,
+ (37,0): 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751,
+ (37,12): 752, 753, 754, 755, 756, 757, 758, 759,
+ (38,0): 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771,
+ (38,12): 772, 773, 774, 775, 776, 777, 778, 779,
+ (39,0): 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791,
+ (39,12): 792, 793, 794, 795, 796, 797, 798, 799
+ }
+ }
+ DATASET "dset_compact" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) }
+ DATA {
+ (0,0): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
+ (0,18): 18, 19,
+ (1,0): 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
+ (1,16): 36, 37, 38, 39,
+ (2,0): 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
+ (2,16): 56, 57, 58, 59,
+ (3,0): 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
+ (3,16): 76, 77, 78, 79,
+ (4,0): 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
+ (4,16): 96, 97, 98, 99,
+ (5,0): 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
+ (5,13): 113, 114, 115, 116, 117, 118, 119,
+ (6,0): 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132,
+ (6,13): 133, 134, 135, 136, 137, 138, 139,
+ (7,0): 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152,
+ (7,13): 153, 154, 155, 156, 157, 158, 159,
+ (8,0): 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172,
+ (8,13): 173, 174, 175, 176, 177, 178, 179,
+ (9,0): 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192,
+ (9,13): 193, 194, 195, 196, 197, 198, 199,
+ (10,0): 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211,
+ (10,12): 212, 213, 214, 215, 216, 217, 218, 219,
+ (11,0): 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231,
+ (11,12): 232, 233, 234, 235, 236, 237, 238, 239,
+ (12,0): 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251,
+ (12,12): 252, 253, 254, 255, 256, 257, 258, 259,
+ (13,0): 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271,
+ (13,12): 272, 273, 274, 275, 276, 277, 278, 279,
+ (14,0): 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291,
+ (14,12): 292, 293, 294, 295, 296, 297, 298, 299,
+ (15,0): 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311,
+ (15,12): 312, 313, 314, 315, 316, 317, 318, 319,
+ (16,0): 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331,
+ (16,12): 332, 333, 334, 335, 336, 337, 338, 339,
+ (17,0): 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351,
+ (17,12): 352, 353, 354, 355, 356, 357, 358, 359,
+ (18,0): 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371,
+ (18,12): 372, 373, 374, 375, 376, 377, 378, 379,
+ (19,0): 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391,
+ (19,12): 392, 393, 394, 395, 396, 397, 398, 399,
+ (20,0): 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411,
+ (20,12): 412, 413, 414, 415, 416, 417, 418, 419,
+ (21,0): 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431,
+ (21,12): 432, 433, 434, 435, 436, 437, 438, 439,
+ (22,0): 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451,
+ (22,12): 452, 453, 454, 455, 456, 457, 458, 459,
+ (23,0): 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471,
+ (23,12): 472, 473, 474, 475, 476, 477, 478, 479,
+ (24,0): 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491,
+ (24,12): 492, 493, 494, 495, 496, 497, 498, 499,
+ (25,0): 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511,
+ (25,12): 512, 513, 514, 515, 516, 517, 518, 519,
+ (26,0): 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531,
+ (26,12): 532, 533, 534, 535, 536, 537, 538, 539,
+ (27,0): 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551,
+ (27,12): 552, 553, 554, 555, 556, 557, 558, 559,
+ (28,0): 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571,
+ (28,12): 572, 573, 574, 575, 576, 577, 578, 579,
+ (29,0): 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591,
+ (29,12): 592, 593, 594, 595, 596, 597, 598, 599,
+ (30,0): 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611,
+ (30,12): 612, 613, 614, 615, 616, 617, 618, 619,
+ (31,0): 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631,
+ (31,12): 632, 633, 634, 635, 636, 637, 638, 639,
+ (32,0): 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651,
+ (32,12): 652, 653, 654, 655, 656, 657, 658, 659,
+ (33,0): 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671,
+ (33,12): 672, 673, 674, 675, 676, 677, 678, 679,
+ (34,0): 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691,
+ (34,12): 692, 693, 694, 695, 696, 697, 698, 699,
+ (35,0): 700, 701, 702, 703, 704, 705, 706, 707, 708, 709, 710, 711,
+ (35,12): 712, 713, 714, 715, 716, 717, 718, 719,
+ (36,0): 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 730, 731,
+ (36,12): 732, 733, 734, 735, 736, 737, 738, 739,
+ (37,0): 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751,
+ (37,12): 752, 753, 754, 755, 756, 757, 758, 759,
+ (38,0): 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771,
+ (38,12): 772, 773, 774, 775, 776, 777, 778, 779,
+ (39,0): 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791,
+ (39,12): 792, 793, 794, 795, 796, 797, 798, 799
+ }
+ }
+ DATASET "dset_contiguous" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) }
+ DATA {
+ (0,0): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
+ (0,18): 18, 19,
+ (1,0): 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
+ (1,16): 36, 37, 38, 39,
+ (2,0): 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
+ (2,16): 56, 57, 58, 59,
+ (3,0): 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
+ (3,16): 76, 77, 78, 79,
+ (4,0): 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
+ (4,16): 96, 97, 98, 99,
+ (5,0): 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
+ (5,13): 113, 114, 115, 116, 117, 118, 119,
+ (6,0): 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132,
+ (6,13): 133, 134, 135, 136, 137, 138, 139,
+ (7,0): 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152,
+ (7,13): 153, 154, 155, 156, 157, 158, 159,
+ (8,0): 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172,
+ (8,13): 173, 174, 175, 176, 177, 178, 179,
+ (9,0): 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192,
+ (9,13): 193, 194, 195, 196, 197, 198, 199,
+ (10,0): 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211,
+ (10,12): 212, 213, 214, 215, 216, 217, 218, 219,
+ (11,0): 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231,
+ (11,12): 232, 233, 234, 235, 236, 237, 238, 239,
+ (12,0): 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251,
+ (12,12): 252, 253, 254, 255, 256, 257, 258, 259,
+ (13,0): 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271,
+ (13,12): 272, 273, 274, 275, 276, 277, 278, 279,
+ (14,0): 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291,
+ (14,12): 292, 293, 294, 295, 296, 297, 298, 299,
+ (15,0): 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311,
+ (15,12): 312, 313, 314, 315, 316, 317, 318, 319,
+ (16,0): 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331,
+ (16,12): 332, 333, 334, 335, 336, 337, 338, 339,
+ (17,0): 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351,
+ (17,12): 352, 353, 354, 355, 356, 357, 358, 359,
+ (18,0): 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371,
+ (18,12): 372, 373, 374, 375, 376, 377, 378, 379,
+ (19,0): 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391,
+ (19,12): 392, 393, 394, 395, 396, 397, 398, 399,
+ (20,0): 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411,
+ (20,12): 412, 413, 414, 415, 416, 417, 418, 419,
+ (21,0): 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431,
+ (21,12): 432, 433, 434, 435, 436, 437, 438, 439,
+ (22,0): 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451,
+ (22,12): 452, 453, 454, 455, 456, 457, 458, 459,
+ (23,0): 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471,
+ (23,12): 472, 473, 474, 475, 476, 477, 478, 479,
+ (24,0): 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491,
+ (24,12): 492, 493, 494, 495, 496, 497, 498, 499,
+ (25,0): 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511,
+ (25,12): 512, 513, 514, 515, 516, 517, 518, 519,
+ (26,0): 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531,
+ (26,12): 532, 533, 534, 535, 536, 537, 538, 539,
+ (27,0): 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551,
+ (27,12): 552, 553, 554, 555, 556, 557, 558, 559,
+ (28,0): 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571,
+ (28,12): 572, 573, 574, 575, 576, 577, 578, 579,
+ (29,0): 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591,
+ (29,12): 592, 593, 594, 595, 596, 597, 598, 599,
+ (30,0): 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611,
+ (30,12): 612, 613, 614, 615, 616, 617, 618, 619,
+ (31,0): 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631,
+ (31,12): 632, 633, 634, 635, 636, 637, 638, 639,
+ (32,0): 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651,
+ (32,12): 652, 653, 654, 655, 656, 657, 658, 659,
+ (33,0): 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671,
+ (33,12): 672, 673, 674, 675, 676, 677, 678, 679,
+ (34,0): 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691,
+ (34,12): 692, 693, 694, 695, 696, 697, 698, 699,
+ (35,0): 700, 701, 702, 703, 704, 705, 706, 707, 708, 709, 710, 711,
+ (35,12): 712, 713, 714, 715, 716, 717, 718, 719,
+ (36,0): 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 730, 731,
+ (36,12): 732, 733, 734, 735, 736, 737, 738, 739,
+ (37,0): 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751,
+ (37,12): 752, 753, 754, 755, 756, 757, 758, 759,
+ (38,0): 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771,
+ (38,12): 772, 773, 774, 775, 776, 777, 778, 779,
+ (39,0): 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791,
+ (39,12): 792, 793, 794, 795, 796, 797, 798, 799
+ }
+ }
+}
+}
diff --git a/tools/test/h5repack/testfiles/h5repack_layout2.h5 b/tools/test/h5repack/testfiles/h5repack_layout2.h5
new file mode 100644
index 0000000..f6821e5
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5repack_layout2.h5
Binary files differ
diff --git a/tools/test/h5repack/testfiles/h5repack_layout3.h5 b/tools/test/h5repack/testfiles/h5repack_layout3.h5
new file mode 100644
index 0000000..6d2de41
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5repack_layout3.h5
Binary files differ
diff --git a/tools/test/h5repack/testfiles/h5repack_layouto.h5 b/tools/test/h5repack/testfiles/h5repack_layouto.h5
new file mode 100644
index 0000000..a038e68
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5repack_layouto.h5
Binary files differ
diff --git a/tools/test/h5repack/testfiles/h5repack_named_dtypes.h5 b/tools/test/h5repack/testfiles/h5repack_named_dtypes.h5
new file mode 100644
index 0000000..85c1352
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5repack_named_dtypes.h5
Binary files differ
diff --git a/tools/test/h5repack/testfiles/h5repack_nbit.h5 b/tools/test/h5repack/testfiles/h5repack_nbit.h5
new file mode 100644
index 0000000..ac71bee
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5repack_nbit.h5
Binary files differ
diff --git a/tools/test/h5repack/testfiles/h5repack_nested_8bit_enum.h5 b/tools/test/h5repack/testfiles/h5repack_nested_8bit_enum.h5
new file mode 100644
index 0000000..f1bd8e9
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5repack_nested_8bit_enum.h5
Binary files differ
diff --git a/tools/test/h5repack/testfiles/h5repack_nested_8bit_enum_deflated.h5 b/tools/test/h5repack/testfiles/h5repack_nested_8bit_enum_deflated.h5
new file mode 100644
index 0000000..2e66da2
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5repack_nested_8bit_enum_deflated.h5
Binary files differ
diff --git a/tools/test/h5repack/testfiles/h5repack_objs.h5 b/tools/test/h5repack/testfiles/h5repack_objs.h5
new file mode 100644
index 0000000..284b0ac
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5repack_objs.h5
Binary files differ
diff --git a/tools/test/h5repack/testfiles/h5repack_refs.h5 b/tools/test/h5repack/testfiles/h5repack_refs.h5
new file mode 100644
index 0000000..2a1ec9b
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5repack_refs.h5
Binary files differ
diff --git a/tools/test/h5repack/testfiles/h5repack_shuffle.h5 b/tools/test/h5repack/testfiles/h5repack_shuffle.h5
new file mode 100644
index 0000000..c14e2cb
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5repack_shuffle.h5
Binary files differ
diff --git a/tools/test/h5repack/testfiles/h5repack_soffset.h5 b/tools/test/h5repack/testfiles/h5repack_soffset.h5
new file mode 100644
index 0000000..2acd867
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5repack_soffset.h5
Binary files differ
diff --git a/tools/test/h5repack/testfiles/h5repack_szip.h5 b/tools/test/h5repack/testfiles/h5repack_szip.h5
new file mode 100644
index 0000000..b16d169
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5repack_szip.h5
Binary files differ
diff --git a/tools/test/h5repack/testfiles/plugin_none.h5repack_layout.UD.h5.tst b/tools/test/h5repack/testfiles/plugin_none.h5repack_layout.UD.h5.tst
new file mode 100644
index 0000000..4fb6906
--- /dev/null
+++ b/tools/test/h5repack/testfiles/plugin_none.h5repack_layout.UD.h5.tst
@@ -0,0 +1,14 @@
+Objects to modify layout are...
+Objects to apply filter are...
+ Uncompress all
+-----------------------------------------
+ Type Filter (Compression) Name
+-----------------------------------------
+ group /
+ dset (1.000:1) /dset1
+ dset (1.000:1) /dset2
+ dset (1.000:1) /dset3
+ dset (1.000:1) /dset4
+ dset (1.000:1) /dset_chunk
+ dset (1.000:1) /dset_compact
+ dset (1.000:1) /dset_contiguous
diff --git a/tools/test/h5repack/testfiles/plugin_test.h5repack_layout.h5.tst b/tools/test/h5repack/testfiles/plugin_test.h5repack_layout.h5.tst
new file mode 100644
index 0000000..7f9bd6e
--- /dev/null
+++ b/tools/test/h5repack/testfiles/plugin_test.h5repack_layout.h5.tst
@@ -0,0 +1,14 @@
+Objects to modify layout are...
+Objects to apply filter are...
+ User Defined 257
+-----------------------------------------
+ Type Filter (Compression) Name
+-----------------------------------------
+ group /
+ dset UD (1.000:1) /dset1
+ dset UD (1.000:1) /dset2
+ dset UD (1.000:1) /dset3
+ dset UD (1.000:1) /dset4
+ dset UD (1.000:1) /dset_chunk
+ dset UD (1.000:1) /dset_compact
+ dset UD (1.000:1) /dset_contiguous
diff --git a/tools/test/h5repack/testfiles/plugin_version_test.h5repack_layout.h5.tst b/tools/test/h5repack/testfiles/plugin_version_test.h5repack_layout.h5.tst
new file mode 100644
index 0000000..1a496c6
--- /dev/null
+++ b/tools/test/h5repack/testfiles/plugin_version_test.h5repack_layout.h5.tst
@@ -0,0 +1,14 @@
+Objects to modify layout are...
+Objects to apply filter are...
+ User Defined 260
+-----------------------------------------
+ Type Filter (Compression) Name
+-----------------------------------------
+ group /
+ dset UD (1.000:1) /dset1
+ dset UD (1.000:1) /dset2
+ dset UD (1.000:1) /dset3
+ dset UD (1.000:1) /dset4
+ dset UD (1.000:1) /dset_chunk
+ dset UD (1.000:1) /dset_compact
+ dset UD (1.000:1) /dset_contiguous
diff --git a/tools/test/h5repack/testfiles/ublock.bin b/tools/test/h5repack/testfiles/ublock.bin
new file mode 100644
index 0000000..b2d03f3
--- /dev/null
+++ b/tools/test/h5repack/testfiles/ublock.bin
@@ -0,0 +1 @@
+abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrst \ No newline at end of file
diff --git a/tools/test/h5repack/testh5repack_detect_szip.c b/tools/test/h5repack/testh5repack_detect_szip.c
new file mode 100644
index 0000000..e91b2f7
--- /dev/null
+++ b/tools/test/h5repack/testh5repack_detect_szip.c
@@ -0,0 +1,62 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include <stdio.h>
+#include "h5repack.h"
+#include "h5tools.h"
+#include "h5tools_utils.h"
+#include "h5test.h"
+
+
+/* Name of tool */
+#define PROGRAMNAME "h5repack_detect_szip"
+
+/*-------------------------------------------------------------------------
+ * Function: main
+ *
+ * Purpose: detects szip encoder, prints "yes" or "no" to stdout.
+ * Intended to be used in test scripts.
+ *
+ * Return:
+ *
+ * Programmer:
+ *
+ * Date:
+ *
+ * Comments:
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+
+
+int main(void)
+{
+ h5tools_setprogname(PROGRAMNAME);
+ h5tools_setstatus(EXIT_SUCCESS);
+
+ /* Initialize h5tools lib */
+ h5tools_init();
+
+#ifdef H5_HAVE_FILTER_SZIP
+ if (h5tools_can_encode(H5Z_FILTER_SZIP) == 1) {
+ printf("yes\n");
+ return(1);
+ }
+#endif /* H5_HAVE_FILTER_SZIP */
+ printf("no\n");
+ return(0);
+}
diff --git a/tools/test/h5stat/CMakeLists.txt b/tools/test/h5stat/CMakeLists.txt
new file mode 100644
index 0000000..98cfed7
--- /dev/null
+++ b/tools/test/h5stat/CMakeLists.txt
@@ -0,0 +1,22 @@
+cmake_minimum_required (VERSION 3.1.0)
+PROJECT (HDF5_TOOLS_TEST_H5STAT)
+
+#-----------------------------------------------------------------------------
+# Setup include Directories
+#-----------------------------------------------------------------------------
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib)
+
+ # --------------------------------------------------------------------
+ # Add the h5stat test executables
+ # --------------------------------------------------------------------
+ if (HDF5_BUILD_GENERATORS)
+ add_executable (h5stat_gentest ${HDF5_TOOLS_TEST_H5STAT_SOURCE_DIR}/h5stat_gentest.c)
+ TARGET_NAMING (h5stat_gentest STATIC)
+ TARGET_C_PROPERTIES (h5stat_gentest STATIC " " " ")
+ target_link_libraries (h5stat_gentest ${HDF5_LIB_TARGET})
+ set_target_properties (h5stat_gentest PROPERTIES FOLDER generator/tools)
+
+ #add_test (NAME h5stat_gentest COMMAND $<TARGET_FILE:h5stat_gentest>)
+ endif (HDF5_BUILD_GENERATORS)
+
+ include (CMakeTests.cmake)
diff --git a/tools/test/h5stat/CMakeTests.cmake b/tools/test/h5stat/CMakeTests.cmake
new file mode 100644
index 0000000..201e978
--- /dev/null
+++ b/tools/test/h5stat/CMakeTests.cmake
@@ -0,0 +1,237 @@
+
+##############################################################################
+##############################################################################
+### T E S T I N G ###
+##############################################################################
+##############################################################################
+
+ # --------------------------------------------------------------------
+ # Copy all the HDF5 files from the test directory into the source directory
+ # --------------------------------------------------------------------
+ set (HDF5_REFERENCE_FILES
+ h5stat_help1.ddl
+ h5stat_help2.ddl
+ h5stat_notexist.ddl
+ h5stat_nofile.ddl
+ h5stat_filters.ddl
+ h5stat_filters-file.ddl
+ h5stat_filters-F.ddl
+ h5stat_filters-d.ddl
+ h5stat_filters-g.ddl
+ h5stat_filters-dT.ddl
+ h5stat_filters-UD.ddl
+ h5stat_filters-UT.ddl
+ h5stat_tsohm.ddl
+ h5stat_newgrat.ddl
+ h5stat_newgrat-UG.ddl
+ h5stat_newgrat-UA.ddl
+ h5stat_err1_links.ddl
+ h5stat_links1.ddl
+ h5stat_links2.ddl
+ h5stat_links3.ddl
+ h5stat_links4.ddl
+ h5stat_links5.ddl
+ h5stat_err1_dims.ddl
+ h5stat_dims1.ddl
+ h5stat_dims2.ddl
+ h5stat_err1_numattrs.ddl
+ h5stat_err2_numattrs.ddl
+ h5stat_numattrs1.ddl
+ h5stat_numattrs2.ddl
+ h5stat_numattrs3.ddl
+ h5stat_numattrs4.ddl
+ )
+ set (HDF5_REFERENCE_TEST_FILES
+ h5stat_filters.h5
+ h5stat_tsohm.h5
+ h5stat_newgrat.h5
+ h5stat_threshold.h5
+ )
+
+ foreach (ddl_file ${HDF5_REFERENCE_FILES})
+ HDFTEST_COPY_FILE("${HDF5_TOOLS_TEST_H5STAT_SOURCE_DIR}/testfiles/${ddl_file}" "${PROJECT_BINARY_DIR}/${ddl_file}" "h5stat_files")
+ endforeach (ddl_file ${HDF5_REFERENCE_FILES})
+
+ foreach (h5_file ${HDF5_REFERENCE_TEST_FILES})
+ HDFTEST_COPY_FILE("${HDF5_TOOLS_TEST_H5STAT_SOURCE_DIR}/testfiles/${h5_file}" "${PROJECT_BINARY_DIR}/${h5_file}" "h5stat_files")
+ endforeach (h5_file ${HDF5_REFERENCE_TEST_FILES})
+ add_custom_target(h5stat_files ALL COMMENT "Copying files needed by h5stat tests" DEPENDS ${h5stat_files_list})
+
+##############################################################################
+##############################################################################
+### T H E T E S T S M A C R O S ###
+##############################################################################
+##############################################################################
+
+ MACRO (ADD_H5_TEST resultfile resultcode)
+ # 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 "")
+ else (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (
+ NAME H5STAT-${resultfile}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5stat>"
+ -D "TEST_ARGS=${ARGN}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_OUTPUT=${resultfile}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=${resultfile}.ddl"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ endif (HDF5_ENABLE_USING_MEMCHECKER)
+ ENDMACRO (ADD_H5_TEST file)
+
+##############################################################################
+##############################################################################
+### T H E T E S T S ###
+##############################################################################
+##############################################################################
+
+ if (HDF5_ENABLE_USING_MEMCHECKER)
+ # Remove any output file left over from previous test run
+ add_test (
+ NAME H5STAT-clearall-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ h5stat_help1.out
+ h5stat_help1.out.err
+ h5stat_help2.out
+ h5stat_help2.out.err
+ h5stat_notexist.out
+ h5stat_notexist.out.err
+ h5stat_nofile.out
+ h5stat_nofile.out.err
+ h5stat_filters.out
+ h5stat_filters.out.err
+ h5stat_filters-file.out
+ h5stat_filters-file.out.err
+ h5stat_filters-F.out
+ h5stat_filters-F.out.err
+ h5stat_filters-d.out
+ h5stat_filters-d.out.err
+ h5stat_filters-g.out
+ h5stat_filters-g.out.err
+ h5stat_filters-dT.out
+ h5stat_filters-dT.out.err
+ h5stat_filters-UD.out
+ h5stat_filters-UD.out.err
+ h5stat_filters-UT.out
+ h5stat_filters-UT.out.err
+ h5stat_tsohm.out
+ h5stat_tsohm.out.err
+ h5stat_newgrat.out
+ h5stat_newgrat.out.err
+ h5stat_newgrat-UG.out
+ h5stat_newgrat-UG.out.err
+ h5stat_newgrat-UA.out
+ h5stat_newgrat-UA.out.err
+ h5stat_err1_links.out
+ h5stat_err1_links.out.err
+ h5stat_links1.out
+ h5stat_links1.out.err
+ h5stat_links2.out
+ h5stat_links2.out.err
+ h5stat_links3.out
+ h5stat_links3.out.err
+ h5stat_links4.out
+ h5stat_links4.out.err
+ h5stat_links5.out
+ h5stat_links5.out.err
+ h5stat_err1_dims.out
+ h5stat_err1_dims.out.err
+ h5stat_dims1.out
+ h5stat_dims1.out.err
+ h5stat_dims2.out
+ h5stat_dims2.out.err
+ h5stat_err1_numattrs.out
+ h5stat_err1_numattrs.out.err
+ h5stat_err2_numattrs.out
+ h5stat_err2_numattrs.out.err
+ h5stat_numattrs1.out
+ h5stat_numattrs1.out.err
+ h5stat_numattrs2.out
+ h5stat_numattrs2.out.err
+ h5stat_numattrs3.out
+ h5stat_numattrs3.out.err
+ h5stat_numattrs4.out
+ h5stat_numattrs4.out.err
+ )
+ if (NOT "${last_test}" STREQUAL "")
+ set_tests_properties (H5STAT-clearall-objects PROPERTIES DEPENDS ${last_test})
+ endif (NOT "${last_test}" STREQUAL "")
+ set (last_test "H5STAT-clearall-objects")
+ endif (HDF5_ENABLE_USING_MEMCHECKER)
+
+# Test for help flag
+ 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)
+ ADD_H5_TEST (h5stat_nofile 1 '')
+
+# 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)
+ ADD_H5_TEST (h5stat_filters-file 0 -f h5stat_filters.h5)
+ ADD_H5_TEST (h5stat_filters-F 0 -F h5stat_filters.h5)
+ ADD_H5_TEST (h5stat_filters-d 0 -d h5stat_filters.h5)
+ ADD_H5_TEST (h5stat_filters-g 0 -g h5stat_filters.h5)
+ ADD_H5_TEST (h5stat_filters-dT 0 -dT h5stat_filters.h5)
+ ADD_H5_TEST (h5stat_filters-UD 0 -D h5stat_filters.h5)
+ ADD_H5_TEST (h5stat_filters-UT 0 -T h5stat_filters.h5)
+# h5stat_tsohm.h5 is a copy of ../../../test/tsohm.h5 generated by tsohm.c
+# as of release 1.8.7-snap0 (on a 64-bit machine)
+ ADD_H5_TEST (h5stat_tsohm 0 h5stat_tsohm.h5)
+# h5stat_newgrat.h5 is generated by h5stat_gentest.c
+ ADD_H5_TEST (h5stat_newgrat 0 h5stat_newgrat.h5)
+ ADD_H5_TEST (h5stat_newgrat-UG 0 -G h5stat_newgrat.h5)
+ ADD_H5_TEST (h5stat_newgrat-UA 0 -A h5stat_newgrat.h5)
+#
+# Tests for -l (--links) option on h5stat_threshold.h5:
+# -l 0 (incorrect threshold value)
+# -g -l 8
+# --links=8
+# --links=20 -g
+ ADD_H5_TEST (h5stat_err1_links 1 -l 0 h5stat_threshold.h5)
+ ADD_H5_TEST (h5stat_links1 0 -g -l 8 h5stat_threshold.h5)
+ ADD_H5_TEST (h5stat_links2 0 --links=8 h5stat_threshold.h5)
+ ADD_H5_TEST (h5stat_links3 0 --links=20 -g h5stat_threshold.h5)
+#
+# Tests for -l (--links) option on h5stat_newgrat.h5:
+# -g
+# -g -l 40000
+ ADD_H5_TEST (h5stat_links4 0 -g h5stat_newgrat.h5)
+ ADD_H5_TEST (h5stat_links5 0 -g -l 40000 h5stat_newgrat.h5)
+#
+# Tests for -m (--dims) option on h5stat_threshold.h5
+# -d --dims=-1 (incorrect threshold value)
+# -gd -m 5
+# -d --di=15
+ ADD_H5_TEST (h5stat_err1_dims 1 -d --dims=-1 h5stat_threshold.h5)
+ ADD_H5_TEST (h5stat_dims1 0 -gd -m 5 h5stat_threshold.h5)
+ ADD_H5_TEST (h5stat_dims2 0 -d --di=15 h5stat_threshold.h5)
+#
+# Tests for -a option on h5stat_threshold.h5
+# -a -2 (incorrect threshold value)
+# --numattrs (without threshold value)
+# -AS -a 10
+# -a 1
+# -A --numattrs=25
+ ADD_H5_TEST (h5stat_err1_numattrs 1 -a -2 h5stat_threshold.h5)
+ ADD_H5_TEST (h5stat_err2_numattrs 1 --numattrs h5stat_threshold.h5)
+ ADD_H5_TEST (h5stat_numattrs1 0 -AS -a 10 h5stat_threshold.h5)
+ ADD_H5_TEST (h5stat_numattrs2 0 -a 1 h5stat_threshold.h5)
+ ADD_H5_TEST (h5stat_numattrs3 0 -A --numattrs=25 h5stat_threshold.h5)
+#
+# Tests for -a option on h5stat_newgrat.h5
+# -A -a 100
+ ADD_H5_TEST (h5stat_numattrs4 0 -A -a 100 h5stat_newgrat.h5)
+#
diff --git a/tools/test/h5stat/Makefile.am b/tools/test/h5stat/Makefile.am
new file mode 100644
index 0000000..630e896
--- /dev/null
+++ b/tools/test/h5stat/Makefile.am
@@ -0,0 +1,48 @@
+#
+# 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.
+##
+## Makefile.am
+## Run automake to generate a Makefile.in from this file.
+#
+# HDF5 Library Makefile(.in)
+#
+
+include $(top_srcdir)/config/commence.am
+
+# Include src directory
+AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib
+
+#test script and program
+TEST_PROG=h5stat_gentest
+TEST_SCRIPT=testh5stat.sh
+
+check_PROGRAMS=$(TEST_PROG)
+check_SCRIPTS=$(TEST_SCRIPT)
+SCRIPT_DEPEND=../../src/h5stat/h5stat$(EXEEXT)
+
+# Tell automake to clean h5redeploy script
+CLEANFILES=
+
+# Temporary files. *.h5 are generated by h5repart_gentest. They should
+# copied to the testfiles/ directory if update is required. fst_family*.h5
+# and scd_family*.h5 were created by setting the HDF5_NOCLEANUP variable.
+CHECK_CLEANFILES+=*.h5 ../testfiles/fst_family*.h5 ../testfiles/scd_family*.h5
+
+# These were generated by configure. Remove them only when distclean.
+DISTCLEANFILES=testh5stat.sh
+
+# All programs rely on hdf5 library and h5tools library
+LDADD=$(LIBH5TOOLS) $(LIBHDF5)
+
+include $(top_srcdir)/config/conclude.am
diff --git a/tools/test/h5stat/h5stat_gentest.c b/tools/test/h5stat/h5stat_gentest.c
new file mode 100644
index 0000000..b1ab168
--- /dev/null
+++ b/tools/test/h5stat/h5stat_gentest.c
@@ -0,0 +1,449 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Generate the binary hdf5 files for the h5stat tests.
+ * Usage: just execute the program without any arguments will
+ * generate all the binary hdf5 files
+ *
+ * If you regenerate the test files (e.g., changing some code,
+ * trying it on a new platform, ...), you need to verify the correctness
+ * of the expected output and update the corresponding *.ddl files.
+ */
+#include "hdf5.h"
+
+/* For gen_newgrat_file() */
+#define NEWGRAT_FILE "h5stat_newgrat.h5"
+#define DATASET_NAME "DATASET_NAME"
+#define GROUP_NAME "GROUP"
+#define ATTR_NAME "ATTR"
+#define NUM_GRPS 35000
+#define NUM_ATTRS 100
+
+/* Declarations for gen_idx_file() */
+#define IDX_FILE "h5stat_idx.h5"
+#define DSET "dset"
+#define DSET_FILTER "dset_filter"
+
+/* For gen_threshold_file() */
+#define THRESHOLD_FILE "h5stat_threshold.h5"
+#define THRES_ATTR_NAME "attr"
+#define THRES_ATTR_GRP_NAME "grp_attr"
+#define THRES_DSET_NAME "dset"
+#define THRES_NUM 10
+#define THRES_NUM_25 25
+
+/*
+ * Generate HDF5 file with latest format with
+ * NUM_GRPS groups and NUM_ATTRS attributes for the dataset
+ */
+static void
+gen_newgrat_file(const char *fname)
+{
+ hid_t fcpl = -1; /* File creation property */
+ hid_t fapl = -1; /* File access property */
+ hid_t fid = -1; /* File id */
+ hid_t gid = -1; /* Group id */
+ hid_t tid = -1; /* Datatype id */
+ hid_t sid = -1; /* Dataspace id */
+ hid_t attr_id = -1; /* Attribute id */
+ hid_t did = -1; /* Dataset id */
+ char name[30]; /* Group name */
+ char attrname[30]; /* Attribute name */
+ int i; /* Local index variable */
+
+ /* Get a copy file access property list */
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ goto error;
+
+ /* Set to use latest library format */
+ if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ goto error;
+
+ /* Get a copy of file creation property list */
+ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ goto error;
+
+ /* Set file space handling strategy */
+ if(H5Pset_file_space(fcpl, H5F_FILE_SPACE_ALL_PERSIST, (hsize_t)0) < 0)
+ goto error;
+
+ /* Create file */
+ if((fid = H5Fcreate(fname, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ goto error;
+
+ /* Create NUM_GRPS groups in the root group */
+ for(i = 1; i <= NUM_GRPS; i++) {
+ sprintf(name, "%s%d", GROUP_NAME,i);
+ if((gid = H5Gcreate2(fid, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+ if(H5Gclose(gid) < 0)
+ goto error;
+ } /* end for */
+
+ /* Create a datatype to commit and use */
+ if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ goto error;
+
+ /* Create dataspace for dataset */
+ if((sid = H5Screate(H5S_SCALAR)) < 0)
+ goto error;
+
+ /* Create dataset */
+ if((did = H5Dcreate2(fid, DATASET_NAME, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Create NUM_ATTRS for the dataset */
+ for(i = 1; i <= NUM_ATTRS; i++) {
+ sprintf(attrname, "%s%d", ATTR_NAME,i);
+ if((attr_id = H5Acreate2(did, attrname, tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+ if(H5Aclose(attr_id) < 0)
+ goto error;
+ } /* end for */
+
+ /* Close dataset, dataspace, datatype, file */
+ if(H5Pclose(fapl) < 0)
+ goto error;
+ if(H5Pclose(fcpl) < 0)
+ goto error;
+ if(H5Dclose(did) < 0)
+ goto error;
+ if(H5Sclose(sid) < 0)
+ goto error;
+ if(H5Tclose(tid) < 0)
+ goto error;
+ if(H5Fclose(fid) < 0)
+ goto error;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Pclose(fapl);
+ H5Pclose(fcpl);
+ H5Aclose(attr_id);
+ H5Dclose(did);
+ H5Tclose(tid);
+ H5Sclose(sid);
+ H5Gclose(gid);
+ H5Fclose(fid);
+ } H5E_END_TRY;
+} /* gen_newgrat_file() */
+
+/*
+ * Generate an HDF5 file with groups, datasets, attributes for testing the options:
+ * -l N (--links=N): Set the threshold for # of links when printing information for small groups.
+ * -m N (--dims=N): Set the threshold for the # of dimension sizes when printing information for small datasets.
+ * -a N (--numattrs=N): Set the threshold for the # of attributes when printing information for small # of attributes.
+ */
+static void
+gen_threshold_file(const char *fname)
+{
+ hid_t fid; /* File ID */
+ hid_t sid0, sid1, sid2, sid3, sid4; /* Dataspace IDs */
+ hid_t did; /* Dataset ID */
+ hid_t attr_id; /* Attribute ID */
+ hid_t gid; /* Group ID */
+ hsize_t two_dims[] = {2, 5}; /* Dimension array */
+ hsize_t one_dims[] = {6}; /* Dimension array */
+ hsize_t zero_dims[] = {0}; /* Dimension array */
+ char name[30]; /* Name */
+ unsigned i; /* Local index variable */
+
+ /* Create file */
+ if((fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Create 1-D dataspace with zero dimension size */
+ if((sid0 = H5Screate_simple(1, zero_dims, NULL)) < 0)
+ goto error;
+
+ /* Create 1-D dataspace with non-zero dimension size*/
+ if((sid1 = H5Screate_simple(1, one_dims, NULL)) < 0)
+ goto error;
+
+ /* Create 2-D dataspace */
+ if((sid2 = H5Screate_simple(2, two_dims, NULL)) < 0)
+ goto error;
+
+ /* Create scalar dataspace */
+ if((sid3 = H5Screate(H5S_SCALAR)) < 0)
+ goto error;
+
+ /* Create null dataspace */
+ if((sid4 = H5Screate(H5S_NULL)) < 0)
+ goto error;
+
+ /* Create an attribute for the root group */
+ if((attr_id = H5Acreate2(fid, "attr", H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+ if(H5Aclose(attr_id) < 0)
+ goto error;
+
+ /* Create 1-D dataset with zero dimension size for the root group */
+ if((did = H5Dcreate2(fid, "zero_dset", H5T_NATIVE_UCHAR, sid0, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Create 11 attributes for the dataset */
+ for(i = 1; i <= (THRES_NUM+1); i++) {
+ sprintf(name, "%s%d", THRES_ATTR_NAME,i);
+ if((attr_id = H5Acreate2(did, name, H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+ if(H5Aclose(attr_id) < 0)
+ goto error;
+ }
+ if(H5Dclose(did) < 0)
+ goto error;
+
+ /* Create dataset with scalar dataspace for the root group */
+ if((did = H5Dcreate2(fid, "scalar_dset", H5T_NATIVE_UCHAR, sid3, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+ if(H5Dclose(did) < 0)
+ goto error;
+
+ /* Create dataset with null dataspace for the root group */
+ if((did = H5Dcreate2(fid, "null_dset", H5T_NATIVE_UCHAR, sid4, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+ if(H5Dclose(did) < 0)
+ goto error;
+
+ /* Create 2-D dataset for the root group */
+ if((did = H5Dcreate2(fid, "dset", H5T_NATIVE_UCHAR, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Create 10 attributes for the 2-D dataset */
+ for(i = 1; i <= THRES_NUM; i++) {
+ sprintf(name, "%s%d", THRES_ATTR_NAME,i);
+ if((attr_id = H5Acreate2(did, name, H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+ if(H5Aclose(attr_id) < 0)
+ goto error;
+ }
+ if(H5Dclose(did) < 0)
+ goto error;
+
+ /* Create first group */
+ if((gid = H5Gcreate2(fid, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Create an attribute for the group */
+ if((attr_id = H5Acreate2(gid, "ATTR", H5T_NATIVE_INT, sid3, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Close attribute */
+ if(H5Aclose(attr_id) < 0)
+ goto error;
+
+ /* Create 10 1-D datasets with non-zero dimension size for the group */
+ for(i = 1; i <= THRES_NUM; i++) {
+ /* set up dataset name */
+ sprintf(name, "%s%d", THRES_DSET_NAME,i);
+
+ /* Create the dataset */
+ if((did = H5Dcreate2(gid, name, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Close the dataset */
+ if(H5Dclose(did) < 0)
+ goto error;
+ }
+
+ /* Close the group */
+ if(H5Gclose(gid) < 0)
+ goto error;
+
+
+ /* Create second group */
+ if((gid = H5Gcreate2(fid, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Create 25 attributes for the group */
+ for(i = 1; i <= THRES_NUM_25; i++) {
+ /* Set up attribute name */
+ sprintf(name, "%s%d", THRES_ATTR_GRP_NAME,i);
+
+ /* Create the attribute */
+ if((attr_id = H5Acreate2(gid, name, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Close the attribute */
+ if(H5Aclose(attr_id) < 0)
+ goto error;
+ }
+
+ /* Close the group */
+ if(H5Gclose(gid) < 0)
+ goto error;
+
+ /* Create third group */
+ if((gid = H5Gcreate2(fid, "group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Create 9 1-D datasets with non-zero dimension size for the group */
+ for(i = 1; i < THRES_NUM; i++) {
+ /* set up dataset name */
+ sprintf(name, "%s%d", THRES_DSET_NAME,i);
+
+ /* Create the dataset */
+ if((did = H5Dcreate2(gid, name, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Close the dataset */
+ if(H5Dclose(did) < 0)
+ goto error;
+ }
+
+ /* Close the group */
+ if(H5Gclose(gid) < 0)
+ goto error;
+
+
+ /* Close dataspaces */
+ if(H5Sclose(sid0) < 0)
+ goto error;
+ if(H5Sclose(sid1) < 0)
+ goto error;
+ if(H5Sclose(sid2) < 0)
+ goto error;
+ if(H5Sclose(sid3) < 0)
+ goto error;
+ if(H5Sclose(sid4) < 0)
+ goto error;
+
+ /* Close file */
+ if(H5Fclose(fid) < 0)
+ goto error;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Gclose(gid);
+ H5Aclose(attr_id);
+ H5Dclose(did);
+ H5Sclose(sid0);
+ H5Sclose(sid1);
+ H5Sclose(sid2);
+ H5Sclose(sid3);
+ H5Sclose(sid4);
+ H5Fclose(fid);
+ } H5E_END_TRY;
+
+} /* gen_threshold_file() */
+
+/*
+ * Function: gen_idx_file
+ *
+ * Purpose: Create a file with datasets that use Fixed Array indexing:
+ * one dataset: fixed dimension, chunked layout, w/o filters
+ * one dataset: fixed dimension, chunked layout, w/ filters
+ *
+ */
+static void
+gen_idx_file(const char *fname)
+{
+ hid_t fapl = -1; /* file access property id */
+ hid_t fid = -1; /* file id */
+ hid_t sid = -1; /* space id */
+ hid_t dcpl = -1; /* dataset creation property id */
+ hid_t did = -1, did2 = -1; /* dataset id */
+ hsize_t dims[1] = {10}; /* dataset dimension */
+ hsize_t c_dims[1] = {2}; /* chunk dimension */
+ int i; /* local index variable */
+ int buf[10]; /* data buffer */
+
+ /* Get a copy of the file access property */
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ goto error;
+
+ /* Set the "use the latest format" bounds for creating objects in the file */
+ if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ goto error;
+
+ /* Create file */
+ if((fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ goto error;
+
+ /* Create data */
+ for(i = 0; i < 10; i++)
+ buf[i] = i;
+
+ /* Set chunk */
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto error;
+
+ if(H5Pset_chunk(dcpl, 1, c_dims) < 0)
+ goto error;
+
+ /* Create a 1D dataset */
+ if((sid = H5Screate_simple(1, dims, NULL)) < 0)
+ goto error;
+ if((did = H5Dcreate2(fid, DSET, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Write to the dataset */
+ if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ goto error;
+
+#if defined (H5_HAVE_FILTER_DEFLATE)
+ /* set deflate data */
+ if(H5Pset_deflate(dcpl, 9) < 0)
+ goto error;
+
+ /* Create and write the dataset */
+ if((did2 = H5Dcreate2(fid, DSET_FILTER, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
+ if(H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ goto error;
+
+ /* Close the dataset */
+ if(H5Dclose(did2) < 0)
+ goto error;
+#endif
+
+ /* closing: dataspace, dataset, file */
+ if(H5Pclose(fapl) < 0)
+ goto error;
+ if(H5Pclose(dcpl) < 0)
+ goto error;
+ if(H5Sclose(sid) < 0)
+ goto error;
+ if(H5Dclose(did) < 0)
+ goto error;
+ if(H5Fclose(fid) < 0)
+ goto error;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Pclose(fapl);
+ H5Pclose(dcpl);
+ H5Sclose(sid);
+ H5Dclose(did);
+ H5Fclose(fid);
+#if defined (H5_HAVE_FILTER_DEFLATE)
+ H5Dclose(did2);
+#endif
+ } H5E_END_TRY;
+
+} /* gen_idx_file() */
+
+int main(void)
+{
+ gen_newgrat_file(NEWGRAT_FILE);
+ gen_threshold_file(THRESHOLD_FILE);
+
+ /* Generate an HDF file to test for datasets with Fixed Array indexing */
+ gen_idx_file(IDX_FILE);
+
+ return 0;
+}
+
diff --git a/tools/test/h5stat/testfiles/h5stat_dims1.ddl b/tools/test/h5stat/testfiles/h5stat_dims1.ddl
new file mode 100644
index 0000000..07b2900
--- /dev/null
+++ b/tools/test/h5stat/testfiles/h5stat_dims1.ddl
@@ -0,0 +1,45 @@
+Filename: h5stat_threshold.h5
+Small groups (with 0 to 9 links):
+ # of groups with 0 link(s): 1
+ # of groups with 7 link(s): 1
+ # of groups with 9 link(s): 1
+ Total # of small groups: 3
+Group bins:
+ # of groups with 0 link: 1
+ # of groups with 1 - 9 links: 2
+ # of groups with 10 - 99 links: 1
+ Total # of groups: 4
+Dataset dimension information:
+ Max. rank of datasets: 2
+ Dataset ranks:
+ # of dataset with rank 0: 2
+ # of dataset with rank 1: 20
+ # of dataset with rank 2: 1
+1-D Dataset information:
+ Max. dimension size of 1-D datasets: 6
+ Small 1-D datasets (with dimension sizes 0 to 4):
+ # of datasets with dimension sizes 0: 1
+ Total # of small datasets: 1
+ 1-D Dataset dimension bins:
+ # of datasets with dimension size 0: 1
+ # of datasets with dimension size 1 - 9: 19
+ Total # of datasets: 20
+Dataset storage information:
+ Total raw data size: 0
+ Total external raw data size: 0
+Dataset layout information:
+ Dataset layout counts[COMPACT]: 0
+ Dataset layout counts[CONTIG]: 23
+ Dataset layout counts[CHUNKED]: 0
+ Dataset layout counts[VIRTUAL]: 0
+ Number of external files : 0
+Dataset filters information:
+ Number of datasets with:
+ NO filter: 23
+ GZIP filter: 0
+ SHUFFLE filter: 0
+ FLETCHER32 filter: 0
+ SZIP filter: 0
+ NBIT filter: 0
+ SCALEOFFSET filter: 0
+ USER-DEFINED filter: 0
diff --git a/tools/test/h5stat/testfiles/h5stat_dims2.ddl b/tools/test/h5stat/testfiles/h5stat_dims2.ddl
new file mode 100644
index 0000000..dbccd05
--- /dev/null
+++ b/tools/test/h5stat/testfiles/h5stat_dims2.ddl
@@ -0,0 +1,36 @@
+Filename: h5stat_threshold.h5
+Dataset dimension information:
+ Max. rank of datasets: 2
+ Dataset ranks:
+ # of dataset with rank 0: 2
+ # of dataset with rank 1: 20
+ # of dataset with rank 2: 1
+1-D Dataset information:
+ Max. dimension size of 1-D datasets: 6
+ Small 1-D datasets (with dimension sizes 0 to 14):
+ # of datasets with dimension sizes 0: 1
+ # of datasets with dimension sizes 6: 19
+ Total # of small datasets: 20
+ 1-D Dataset dimension bins:
+ # of datasets with dimension size 0: 1
+ # of datasets with dimension size 1 - 9: 19
+ Total # of datasets: 20
+Dataset storage information:
+ Total raw data size: 0
+ Total external raw data size: 0
+Dataset layout information:
+ Dataset layout counts[COMPACT]: 0
+ Dataset layout counts[CONTIG]: 23
+ Dataset layout counts[CHUNKED]: 0
+ Dataset layout counts[VIRTUAL]: 0
+ Number of external files : 0
+Dataset filters information:
+ Number of datasets with:
+ NO filter: 23
+ GZIP filter: 0
+ SHUFFLE filter: 0
+ FLETCHER32 filter: 0
+ SZIP filter: 0
+ NBIT filter: 0
+ SCALEOFFSET filter: 0
+ USER-DEFINED filter: 0
diff --git a/tools/test/h5stat/testfiles/h5stat_err1_dims.ddl b/tools/test/h5stat/testfiles/h5stat_err1_dims.ddl
new file mode 100644
index 0000000..86d375b
--- /dev/null
+++ b/tools/test/h5stat/testfiles/h5stat_err1_dims.ddl
@@ -0,0 +1 @@
+h5stat error: Invalid threshold for small datasets
diff --git a/tools/test/h5stat/testfiles/h5stat_err1_links.ddl b/tools/test/h5stat/testfiles/h5stat_err1_links.ddl
new file mode 100644
index 0000000..d43207c
--- /dev/null
+++ b/tools/test/h5stat/testfiles/h5stat_err1_links.ddl
@@ -0,0 +1 @@
+h5stat error: Invalid threshold for small groups
diff --git a/tools/test/h5stat/testfiles/h5stat_err1_numattrs.ddl b/tools/test/h5stat/testfiles/h5stat_err1_numattrs.ddl
new file mode 100644
index 0000000..01b6c18
--- /dev/null
+++ b/tools/test/h5stat/testfiles/h5stat_err1_numattrs.ddl
@@ -0,0 +1 @@
+h5stat error: Invalid threshold for small # of attributes
diff --git a/tools/test/h5stat/testfiles/h5stat_err2_numattrs.ddl b/tools/test/h5stat/testfiles/h5stat_err2_numattrs.ddl
new file mode 100644
index 0000000..01b6c18
--- /dev/null
+++ b/tools/test/h5stat/testfiles/h5stat_err2_numattrs.ddl
@@ -0,0 +1 @@
+h5stat error: Invalid threshold for small # of attributes
diff --git a/tools/test/h5stat/testfiles/h5stat_filters-F.ddl b/tools/test/h5stat/testfiles/h5stat_filters-F.ddl
new file mode 100644
index 0000000..d44445b
--- /dev/null
+++ b/tools/test/h5stat/testfiles/h5stat_filters-F.ddl
@@ -0,0 +1,26 @@
+Filename: h5stat_filters.h5
+File space information for file metadata (in bytes):
+ Superblock: 96
+ Superblock extension: 0
+ User block: 0
+ Object headers: (total/unused)
+ Groups: 48/8
+ Datasets(exclude compact data): 4136/1344
+ Datatypes: 80/0
+ Groups:
+ B-tree/List: 1200
+ Heap: 288
+ Attributes:
+ B-tree/List: 0
+ Heap: 0
+ Chunked datasets:
+ Index: 31392
+ Datasets:
+ Heap: 72
+ Shared Messages:
+ Header: 0
+ B-tree/List: 0
+ Heap: 0
+ Free-space managers:
+ Header: 0
+ Amount of free space: 0
diff --git a/tools/test/h5stat/testfiles/h5stat_filters-UD.ddl b/tools/test/h5stat/testfiles/h5stat_filters-UD.ddl
new file mode 100644
index 0000000..4efafd1
--- /dev/null
+++ b/tools/test/h5stat/testfiles/h5stat_filters-UD.ddl
@@ -0,0 +1,5 @@
+Filename: h5stat_filters.h5
+File space information for datasets' metadata (in bytes):
+ Object headers (total/unused): 4136/1344
+ Index for Chunked datasets: 31392
+ Heap: 72
diff --git a/tools/test/h5stat/testfiles/h5stat_filters-UT.ddl b/tools/test/h5stat/testfiles/h5stat_filters-UT.ddl
new file mode 100644
index 0000000..d8de31f
--- /dev/null
+++ b/tools/test/h5stat/testfiles/h5stat_filters-UT.ddl
@@ -0,0 +1,10 @@
+Filename: h5stat_filters.h5
+Dataset datatype information:
+ # of unique datatypes used by datasets: 2
+ Dataset datatype #0:
+ Count (total/named) = (14/0)
+ Size (desc./elmt) = (14/4)
+ Dataset datatype #1:
+ Count (total/named) = (1/0)
+ Size (desc./elmt) = (14/4)
+ Total dataset datatype count: 15
diff --git a/tools/test/h5stat/testfiles/h5stat_filters-d.ddl b/tools/test/h5stat/testfiles/h5stat_filters-d.ddl
new file mode 100644
index 0000000..6e6dd61
--- /dev/null
+++ b/tools/test/h5stat/testfiles/h5stat_filters-d.ddl
@@ -0,0 +1,32 @@
+Filename: h5stat_filters.h5
+Dataset dimension information:
+ Max. rank of datasets: 2
+ Dataset ranks:
+ # of dataset with rank 1: 1
+ # of dataset with rank 2: 14
+1-D Dataset information:
+ Max. dimension size of 1-D datasets: 100
+ Small 1-D datasets (with dimension sizes 0 to 9):
+ Total # of small datasets: 0
+ 1-D Dataset dimension bins:
+ # of datasets with dimension size 100 - 999: 1
+ Total # of datasets: 1
+Dataset storage information:
+ Total raw data size: 8659
+ Total external raw data size: 400
+Dataset layout information:
+ Dataset layout counts[COMPACT]: 1
+ Dataset layout counts[CONTIG]: 2
+ Dataset layout counts[CHUNKED]: 12
+ Dataset layout counts[VIRTUAL]: 0
+ Number of external files : 2
+Dataset filters information:
+ Number of datasets with:
+ NO filter: 7
+ GZIP filter: 2
+ SHUFFLE filter: 2
+ FLETCHER32 filter: 2
+ SZIP filter: 2
+ NBIT filter: 2
+ SCALEOFFSET filter: 1
+ USER-DEFINED filter: 1
diff --git a/tools/test/h5stat/testfiles/h5stat_filters-dT.ddl b/tools/test/h5stat/testfiles/h5stat_filters-dT.ddl
new file mode 100644
index 0000000..b14ca9f
--- /dev/null
+++ b/tools/test/h5stat/testfiles/h5stat_filters-dT.ddl
@@ -0,0 +1,41 @@
+Filename: h5stat_filters.h5
+Dataset dimension information:
+ Max. rank of datasets: 2
+ Dataset ranks:
+ # of dataset with rank 1: 1
+ # of dataset with rank 2: 14
+1-D Dataset information:
+ Max. dimension size of 1-D datasets: 100
+ Small 1-D datasets (with dimension sizes 0 to 9):
+ Total # of small datasets: 0
+ 1-D Dataset dimension bins:
+ # of datasets with dimension size 100 - 999: 1
+ Total # of datasets: 1
+Dataset storage information:
+ Total raw data size: 8659
+ Total external raw data size: 400
+Dataset layout information:
+ Dataset layout counts[COMPACT]: 1
+ Dataset layout counts[CONTIG]: 2
+ Dataset layout counts[CHUNKED]: 12
+ Dataset layout counts[VIRTUAL]: 0
+ Number of external files : 2
+Dataset filters information:
+ Number of datasets with:
+ NO filter: 7
+ GZIP filter: 2
+ SHUFFLE filter: 2
+ FLETCHER32 filter: 2
+ SZIP filter: 2
+ NBIT filter: 2
+ SCALEOFFSET filter: 1
+ USER-DEFINED filter: 1
+Dataset datatype information:
+ # of unique datatypes used by datasets: 2
+ Dataset datatype #0:
+ Count (total/named) = (14/0)
+ Size (desc./elmt) = (14/4)
+ Dataset datatype #1:
+ Count (total/named) = (1/0)
+ Size (desc./elmt) = (14/4)
+ Total dataset datatype count: 15
diff --git a/tools/test/h5stat/testfiles/h5stat_filters-file.ddl b/tools/test/h5stat/testfiles/h5stat_filters-file.ddl
new file mode 100644
index 0000000..5f7eff9
--- /dev/null
+++ b/tools/test/h5stat/testfiles/h5stat_filters-file.ddl
@@ -0,0 +1,9 @@
+Filename: h5stat_filters.h5
+File information
+ # of unique groups: 1
+ # of unique datasets: 15
+ # of unique named datatypes: 1
+ # of unique links: 0
+ # of unique other: 0
+ Max. # of links to object: 1
+ Max. # of objects in group: 16
diff --git a/tools/test/h5stat/testfiles/h5stat_filters-g.ddl b/tools/test/h5stat/testfiles/h5stat_filters-g.ddl
new file mode 100644
index 0000000..290c82a
--- /dev/null
+++ b/tools/test/h5stat/testfiles/h5stat_filters-g.ddl
@@ -0,0 +1,6 @@
+Filename: h5stat_filters.h5
+Small groups (with 0 to 9 links):
+ Total # of small groups: 0
+Group bins:
+ # of groups with 10 - 99 links: 1
+ Total # of groups: 1
diff --git a/tools/test/h5stat/testfiles/h5stat_filters.ddl b/tools/test/h5stat/testfiles/h5stat_filters.ddl
new file mode 100644
index 0000000..1a4fd72
--- /dev/null
+++ b/tools/test/h5stat/testfiles/h5stat_filters.ddl
@@ -0,0 +1,97 @@
+Filename: h5stat_filters.h5
+File information
+ # of unique groups: 1
+ # of unique datasets: 15
+ # of unique named datatypes: 1
+ # of unique links: 0
+ # of unique other: 0
+ Max. # of links to object: 1
+ Max. # of objects in group: 16
+File space information for file metadata (in bytes):
+ Superblock: 96
+ Superblock extension: 0
+ User block: 0
+ Object headers: (total/unused)
+ Groups: 48/8
+ Datasets(exclude compact data): 4136/1344
+ Datatypes: 80/0
+ Groups:
+ B-tree/List: 1200
+ Heap: 288
+ Attributes:
+ B-tree/List: 0
+ Heap: 0
+ Chunked datasets:
+ Index: 31392
+ Datasets:
+ Heap: 72
+ Shared Messages:
+ Header: 0
+ B-tree/List: 0
+ Heap: 0
+ Free-space managers:
+ Header: 0
+ Amount of free space: 0
+Small groups (with 0 to 9 links):
+ Total # of small groups: 0
+Group bins:
+ # of groups with 10 - 99 links: 1
+ Total # of groups: 1
+Dataset dimension information:
+ Max. rank of datasets: 2
+ Dataset ranks:
+ # of dataset with rank 1: 1
+ # of dataset with rank 2: 14
+1-D Dataset information:
+ Max. dimension size of 1-D datasets: 100
+ Small 1-D datasets (with dimension sizes 0 to 9):
+ Total # of small datasets: 0
+ 1-D Dataset dimension bins:
+ # of datasets with dimension size 100 - 999: 1
+ Total # of datasets: 1
+Dataset storage information:
+ Total raw data size: 8659
+ Total external raw data size: 400
+Dataset layout information:
+ Dataset layout counts[COMPACT]: 1
+ Dataset layout counts[CONTIG]: 2
+ Dataset layout counts[CHUNKED]: 12
+ Dataset layout counts[VIRTUAL]: 0
+ Number of external files : 2
+Dataset filters information:
+ Number of datasets with:
+ NO filter: 7
+ GZIP filter: 2
+ SHUFFLE filter: 2
+ FLETCHER32 filter: 2
+ SZIP filter: 2
+ NBIT filter: 2
+ SCALEOFFSET filter: 1
+ USER-DEFINED filter: 1
+Dataset datatype information:
+ # of unique datatypes used by datasets: 2
+ Dataset datatype #0:
+ Count (total/named) = (14/0)
+ Size (desc./elmt) = (14/4)
+ Dataset datatype #1:
+ Count (total/named) = (1/0)
+ Size (desc./elmt) = (14/4)
+ Total dataset datatype count: 15
+Small # of attributes (objects with 1 to 10 attributes):
+ Total # of objects with small # of attributes: 0
+Attribute bins:
+ Total # of objects with attributes: 0
+ Max. # of attributes to objects: 0
+Free-space section threshold: 1 bytes
+Small size free-space sections (< 10 bytes):
+ Total # of small size sections: 0
+Free-space section bins:
+ Total # of sections: 0
+File space management strategy: H5F_FILE_SPACE_ALL
+Summary of file space information:
+ File metadata: 37312 bytes
+ Raw data: 8659 bytes
+ Amount/Percent of tracked free space: 0 bytes/0.0%
+ Unaccounted space: 301 bytes
+Total space: 46272 bytes
+External raw data: 400 bytes
diff --git a/tools/test/h5stat/testfiles/h5stat_filters.h5 b/tools/test/h5stat/testfiles/h5stat_filters.h5
new file mode 100644
index 0000000..5b5f4bb
--- /dev/null
+++ b/tools/test/h5stat/testfiles/h5stat_filters.h5
Binary files differ
diff --git a/tools/test/h5stat/testfiles/h5stat_help1.ddl b/tools/test/h5stat/testfiles/h5stat_help1.ddl
new file mode 100644
index 0000000..d2a8715
--- /dev/null
+++ b/tools/test/h5stat/testfiles/h5stat_help1.ddl
@@ -0,0 +1,24 @@
+Usage: h5stat [OPTIONS] file
+
+ OPTIONS
+ -h, --help Print a usage message and exit
+ -V, --version Print version number and exit
+ -f, --file Print file information
+ -F, --filemetadata Print file space information for file's metadata
+ -g, --group Print group information
+ -l N, --links=N Set the threshold for the # of links when printing
+ information for small groups. N is an integer greater
+ than 0. The default threshold is 10.
+ -G, --groupmetadata Print file space information for groups' metadata
+ -d, --dset Print dataset information
+ -m N, --dims=N Set the threshold for the dimension sizes when printing
+ information for small datasets. N is an integer greater
+ than 0. The default threshold is 10.
+ -D, --dsetmetadata Print file space information for datasets' metadata
+ -T, --dtypemetadata Print datasets' datatype information
+ -A, --attribute Print attribute information
+ -a N, --numattrs=N Set the threshold for the # of attributes when printing
+ information for small # of attributes. N is an integer greater
+ than 0. The default threshold is 10.
+ -s, --freespace Print free space information
+ -S, --summary Print summary of file space information
diff --git a/tools/test/h5stat/testfiles/h5stat_help2.ddl b/tools/test/h5stat/testfiles/h5stat_help2.ddl
new file mode 100644
index 0000000..d2a8715
--- /dev/null
+++ b/tools/test/h5stat/testfiles/h5stat_help2.ddl
@@ -0,0 +1,24 @@
+Usage: h5stat [OPTIONS] file
+
+ OPTIONS
+ -h, --help Print a usage message and exit
+ -V, --version Print version number and exit
+ -f, --file Print file information
+ -F, --filemetadata Print file space information for file's metadata
+ -g, --group Print group information
+ -l N, --links=N Set the threshold for the # of links when printing
+ information for small groups. N is an integer greater
+ than 0. The default threshold is 10.
+ -G, --groupmetadata Print file space information for groups' metadata
+ -d, --dset Print dataset information
+ -m N, --dims=N Set the threshold for the dimension sizes when printing
+ information for small datasets. N is an integer greater
+ than 0. The default threshold is 10.
+ -D, --dsetmetadata Print file space information for datasets' metadata
+ -T, --dtypemetadata Print datasets' datatype information
+ -A, --attribute Print attribute information
+ -a N, --numattrs=N Set the threshold for the # of attributes when printing
+ information for small # of attributes. N is an integer greater
+ than 0. The default threshold is 10.
+ -s, --freespace Print free space information
+ -S, --summary Print summary of file space information
diff --git a/tools/test/h5stat/testfiles/h5stat_idx.ddl b/tools/test/h5stat/testfiles/h5stat_idx.ddl
new file mode 100644
index 0000000..b26f1a4
--- /dev/null
+++ b/tools/test/h5stat/testfiles/h5stat_idx.ddl
@@ -0,0 +1,93 @@
+Filename: h5stat_idx.h5
+File information
+ # of unique groups: 1
+ # of unique datasets: 2
+ # of unique named datatypes: 0
+ # of unique links: 0
+ # of unique other: 0
+ Max. # of links to object: 1
+ Max. # of objects in group: 2
+File space information for file metadata (in bytes):
+ Superblock: 48
+ Superblock extension: 0
+ User block: 0
+ Object headers: (total/unused)
+ Groups: 147/47
+ Datasets(exclude compact data): 568/362
+ Datatypes: 0/0
+ Groups:
+ B-tree/List: 0
+ Heap: 0
+ Attributes:
+ B-tree/List: 0
+ Heap: 0
+ Chunked datasets:
+ Index: 202
+ Datasets:
+ Heap: 0
+ Shared Messages:
+ Header: 0
+ B-tree/List: 0
+ Heap: 0
+ Free-space managers:
+ Header: 0
+ Amount of free space: 0
+Small groups (with 0 to 9 links):
+ # of groups with 2 link(s): 1
+ Total # of small groups: 1
+Group bins:
+ # of groups with 1 - 9 links: 1
+ Total # of groups: 1
+Dataset dimension information:
+ Max. rank of datasets: 1
+ Dataset ranks:
+ # of dataset with rank 1: 2
+1-D Dataset information:
+ Max. dimension size of 1-D datasets: 10
+ Small 1-D datasets (with dimension sizes 0 to 9):
+ Total # of small datasets: 0
+ 1-D Dataset dimension bins:
+ # of datasets with dimension size 10 - 99: 2
+ Total # of datasets: 2
+Dataset storage information:
+ Total raw data size: 110
+ Total external raw data size: 0
+Dataset layout information:
+ Dataset layout counts[COMPACT]: 0
+ Dataset layout counts[CONTIG]: 0
+ Dataset layout counts[CHUNKED]: 2
+ Dataset layout counts[VIRTUAL]: 0
+ Number of external files : 0
+Dataset filters information:
+ Number of datasets with:
+ NO filter: 1
+ GZIP filter: 1
+ SHUFFLE filter: 0
+ FLETCHER32 filter: 0
+ SZIP filter: 0
+ NBIT filter: 0
+ SCALEOFFSET filter: 0
+ USER-DEFINED filter: 0
+Dataset datatype information:
+ # of unique datatypes used by datasets: 1
+ Dataset datatype #0:
+ Count (total/named) = (2/0)
+ Size (desc./elmt) = (14/4)
+ Total dataset datatype count: 2
+Small # of attributes (objects with 1 to 10 attributes):
+ Total # of objects with small # of attributes: 0
+Attribute bins:
+ Total # of objects with attributes: 0
+ Max. # of attributes to objects: 0
+Free-space section threshold: 1 bytes
+Small size free-space sections (< 10 bytes):
+ Total # of small size sections: 0
+Free-space section bins:
+ Total # of sections: 0
+File space management strategy: H5F_FILE_SPACE_ALL
+Summary of file space information:
+ File metadata: 965 bytes
+ Raw data: 110 bytes
+ Amount/Percent of tracked free space: 0 bytes/0.0%
+ Unaccounted space: 1131 bytes
+Total space: 2206 bytes
diff --git a/tools/test/h5stat/testfiles/h5stat_idx.h5 b/tools/test/h5stat/testfiles/h5stat_idx.h5
new file mode 100644
index 0000000..303d1f8
--- /dev/null
+++ b/tools/test/h5stat/testfiles/h5stat_idx.h5
Binary files differ
diff --git a/tools/test/h5stat/testfiles/h5stat_links1.ddl b/tools/test/h5stat/testfiles/h5stat_links1.ddl
new file mode 100644
index 0000000..c650f15
--- /dev/null
+++ b/tools/test/h5stat/testfiles/h5stat_links1.ddl
@@ -0,0 +1,10 @@
+Filename: h5stat_threshold.h5
+Small groups (with 0 to 7 links):
+ # of groups with 0 link(s): 1
+ # of groups with 7 link(s): 1
+ Total # of small groups: 2
+Group bins:
+ # of groups with 0 link: 1
+ # of groups with 1 - 9 links: 2
+ # of groups with 10 - 99 links: 1
+ Total # of groups: 4
diff --git a/tools/test/h5stat/testfiles/h5stat_links2.ddl b/tools/test/h5stat/testfiles/h5stat_links2.ddl
new file mode 100644
index 0000000..4622884
--- /dev/null
+++ b/tools/test/h5stat/testfiles/h5stat_links2.ddl
@@ -0,0 +1,105 @@
+Filename: h5stat_threshold.h5
+File information
+ # of unique groups: 4
+ # of unique datasets: 23
+ # of unique named datatypes: 0
+ # of unique links: 0
+ # of unique other: 0
+ Max. # of links to object: 1
+ Max. # of objects in group: 10
+File space information for file metadata (in bytes):
+ Superblock: 96
+ Superblock extension: 0
+ User block: 0
+ Object headers: (total/unused)
+ Groups: 3576/0
+ Datasets(exclude compact data): 7896/2912
+ Datatypes: 0/0
+ Groups:
+ B-tree/List: 3816
+ Heap: 744
+ Attributes:
+ B-tree/List: 0
+ Heap: 0
+ Chunked datasets:
+ Index: 0
+ Datasets:
+ Heap: 0
+ Shared Messages:
+ Header: 0
+ B-tree/List: 0
+ Heap: 0
+ Free-space managers:
+ Header: 0
+ Amount of free space: 0
+Small groups (with 0 to 7 links):
+ # of groups with 0 link(s): 1
+ # of groups with 7 link(s): 1
+ Total # of small groups: 2
+Group bins:
+ # of groups with 0 link: 1
+ # of groups with 1 - 9 links: 2
+ # of groups with 10 - 99 links: 1
+ Total # of groups: 4
+Dataset dimension information:
+ Max. rank of datasets: 2
+ Dataset ranks:
+ # of dataset with rank 0: 2
+ # of dataset with rank 1: 20
+ # of dataset with rank 2: 1
+1-D Dataset information:
+ Max. dimension size of 1-D datasets: 6
+ Small 1-D datasets (with dimension sizes 0 to 9):
+ # of datasets with dimension sizes 0: 1
+ # of datasets with dimension sizes 6: 19
+ Total # of small datasets: 20
+ 1-D Dataset dimension bins:
+ # of datasets with dimension size 0: 1
+ # of datasets with dimension size 1 - 9: 19
+ Total # of datasets: 20
+Dataset storage information:
+ Total raw data size: 0
+ Total external raw data size: 0
+Dataset layout information:
+ Dataset layout counts[COMPACT]: 0
+ Dataset layout counts[CONTIG]: 23
+ Dataset layout counts[CHUNKED]: 0
+ Dataset layout counts[VIRTUAL]: 0
+ Number of external files : 0
+Dataset filters information:
+ Number of datasets with:
+ NO filter: 23
+ GZIP filter: 0
+ SHUFFLE filter: 0
+ FLETCHER32 filter: 0
+ SZIP filter: 0
+ NBIT filter: 0
+ SCALEOFFSET filter: 0
+ USER-DEFINED filter: 0
+Dataset datatype information:
+ # of unique datatypes used by datasets: 1
+ Dataset datatype #0:
+ Count (total/named) = (23/0)
+ Size (desc./elmt) = (14/1)
+ Total dataset datatype count: 23
+Small # of attributes (objects with 1 to 10 attributes):
+ # of objects with 1 attributes: 2
+ # of objects with 10 attributes: 1
+ Total # of objects with small # of attributes: 3
+Attribute bins:
+ # of objects with 1 - 9 attributes: 2
+ # of objects with 10 - 99 attributes: 3
+ Total # of objects with attributes: 5
+ Max. # of attributes to objects: 25
+Free-space section threshold: 1 bytes
+Small size free-space sections (< 10 bytes):
+ Total # of small size sections: 0
+Free-space section bins:
+ Total # of sections: 0
+File space management strategy: H5F_FILE_SPACE_ALL
+Summary of file space information:
+ File metadata: 16128 bytes
+ Raw data: 0 bytes
+ Amount/Percent of tracked free space: 0 bytes/0.0%
+ Unaccounted space: 184 bytes
+Total space: 16312 bytes
diff --git a/tools/test/h5stat/testfiles/h5stat_links3.ddl b/tools/test/h5stat/testfiles/h5stat_links3.ddl
new file mode 100644
index 0000000..f80471a
--- /dev/null
+++ b/tools/test/h5stat/testfiles/h5stat_links3.ddl
@@ -0,0 +1,12 @@
+Filename: h5stat_threshold.h5
+Small groups (with 0 to 19 links):
+ # of groups with 0 link(s): 1
+ # of groups with 7 link(s): 1
+ # of groups with 9 link(s): 1
+ # of groups with 10 link(s): 1
+ Total # of small groups: 4
+Group bins:
+ # of groups with 0 link: 1
+ # of groups with 1 - 9 links: 2
+ # of groups with 10 - 99 links: 1
+ Total # of groups: 4
diff --git a/tools/test/h5stat/testfiles/h5stat_links4.ddl b/tools/test/h5stat/testfiles/h5stat_links4.ddl
new file mode 100644
index 0000000..94feffd
--- /dev/null
+++ b/tools/test/h5stat/testfiles/h5stat_links4.ddl
@@ -0,0 +1,8 @@
+Filename: h5stat_newgrat.h5
+Small groups (with 0 to 9 links):
+ # of groups with 0 link(s): 35000
+ Total # of small groups: 35000
+Group bins:
+ # of groups with 0 link: 35000
+ # of groups with 10000 - 99999 links: 1
+ Total # of groups: 35001
diff --git a/tools/test/h5stat/testfiles/h5stat_links5.ddl b/tools/test/h5stat/testfiles/h5stat_links5.ddl
new file mode 100644
index 0000000..6f33bed
--- /dev/null
+++ b/tools/test/h5stat/testfiles/h5stat_links5.ddl
@@ -0,0 +1,9 @@
+Filename: h5stat_newgrat.h5
+Small groups (with 0 to 39999 links):
+ # of groups with 0 link(s): 35000
+ # of groups with 35001 link(s): 1
+ Total # of small groups: 35001
+Group bins:
+ # of groups with 0 link: 35000
+ # of groups with 10000 - 99999 links: 1
+ Total # of groups: 35001
diff --git a/tools/test/h5stat/testfiles/h5stat_newgrat-UA.ddl b/tools/test/h5stat/testfiles/h5stat_newgrat-UA.ddl
new file mode 100644
index 0000000..a5ee7e8
--- /dev/null
+++ b/tools/test/h5stat/testfiles/h5stat_newgrat-UA.ddl
@@ -0,0 +1,7 @@
+Filename: h5stat_newgrat.h5
+Small # of attributes (objects with 1 to 10 attributes):
+ Total # of objects with small # of attributes: 0
+Attribute bins:
+ # of objects with 100 - 999 attributes: 1
+ Total # of objects with attributes: 1
+ Max. # of attributes to objects: 100
diff --git a/tools/test/h5stat/testfiles/h5stat_newgrat-UG.ddl b/tools/test/h5stat/testfiles/h5stat_newgrat-UG.ddl
new file mode 100644
index 0000000..41195ac
--- /dev/null
+++ b/tools/test/h5stat/testfiles/h5stat_newgrat-UG.ddl
@@ -0,0 +1,5 @@
+Filename: h5stat_newgrat.h5
+File space information for groups' metadata (in bytes):
+ Object headers (total/unused): 5145147/3220092
+ B-tree/List: 470054
+ Heap: 739045
diff --git a/tools/test/h5stat/testfiles/h5stat_newgrat.ddl b/tools/test/h5stat/testfiles/h5stat_newgrat.ddl
new file mode 100644
index 0000000..e305f58
--- /dev/null
+++ b/tools/test/h5stat/testfiles/h5stat_newgrat.ddl
@@ -0,0 +1,95 @@
+Filename: h5stat_newgrat.h5
+File information
+ # of unique groups: 35001
+ # of unique datasets: 1
+ # of unique named datatypes: 0
+ # of unique links: 0
+ # of unique other: 0
+ Max. # of links to object: 1
+ Max. # of objects in group: 35001
+File space information for file metadata (in bytes):
+ Superblock: 48
+ Superblock extension: 119
+ User block: 0
+ Object headers: (total/unused)
+ Groups: 5145147/3220092
+ Datasets(exclude compact data): 414/312
+ Datatypes: 0/0
+ Groups:
+ B-tree/List: 470054
+ Heap: 739045
+ Attributes:
+ B-tree/List: 2598
+ Heap: 4431
+ Chunked datasets:
+ Index: 0
+ Datasets:
+ Heap: 0
+ Shared Messages:
+ Header: 0
+ B-tree/List: 0
+ Heap: 0
+ Free-space managers:
+ Header: 180
+ Amount of free space: 132
+Small groups (with 0 to 9 links):
+ # of groups with 0 link(s): 35000
+ Total # of small groups: 35000
+Group bins:
+ # of groups with 0 link: 35000
+ # of groups with 10000 - 99999 links: 1
+ Total # of groups: 35001
+Dataset dimension information:
+ Max. rank of datasets: 0
+ Dataset ranks:
+ # of dataset with rank 0: 1
+1-D Dataset information:
+ Max. dimension size of 1-D datasets: 0
+ Small 1-D datasets (with dimension sizes 0 to 9):
+ Total # of small datasets: 0
+Dataset storage information:
+ Total raw data size: 0
+ Total external raw data size: 0
+Dataset layout information:
+ Dataset layout counts[COMPACT]: 0
+ Dataset layout counts[CONTIG]: 1
+ Dataset layout counts[CHUNKED]: 0
+ Dataset layout counts[VIRTUAL]: 0
+ Number of external files : 0
+Dataset filters information:
+ Number of datasets with:
+ NO filter: 1
+ GZIP filter: 0
+ SHUFFLE filter: 0
+ FLETCHER32 filter: 0
+ SZIP filter: 0
+ NBIT filter: 0
+ SCALEOFFSET filter: 0
+ USER-DEFINED filter: 0
+Dataset datatype information:
+ # of unique datatypes used by datasets: 1
+ Dataset datatype #0:
+ Count (total/named) = (1/0)
+ Size (desc./elmt) = (14/4)
+ Total dataset datatype count: 1
+Small # of attributes (objects with 1 to 10 attributes):
+ Total # of objects with small # of attributes: 0
+Attribute bins:
+ # of objects with 100 - 999 attributes: 1
+ Total # of objects with attributes: 1
+ Max. # of attributes to objects: 100
+Free-space section threshold: 1 bytes
+Small size free-space sections (< 10 bytes):
+ # of sections of size 1: 1
+ Total # of small size sections: 1
+Free-space section bins:
+ # of sections of size 1 - 9: 1
+ # of sections of size 10 - 99: 4
+ Total # of sections: 5
+File space management strategy: H5F_FILE_SPACE_ALL_PERSIST
+Summary of file space information:
+ File metadata: 6362036 bytes
+ Raw data: 0 bytes
+ Amount/Percent of tracked free space: 132 bytes/0.0%
+ Unaccounted space: 0 bytes
+Total space: 6362168 bytes
diff --git a/tools/test/h5stat/testfiles/h5stat_newgrat.h5 b/tools/test/h5stat/testfiles/h5stat_newgrat.h5
new file mode 100644
index 0000000..c919b71
--- /dev/null
+++ b/tools/test/h5stat/testfiles/h5stat_newgrat.h5
Binary files differ
diff --git a/tools/test/h5stat/testfiles/h5stat_nofile.ddl b/tools/test/h5stat/testfiles/h5stat_nofile.ddl
new file mode 100644
index 0000000..d8a8b2c
--- /dev/null
+++ b/tools/test/h5stat/testfiles/h5stat_nofile.ddl
@@ -0,0 +1,25 @@
+Usage: h5stat [OPTIONS] file
+
+ OPTIONS
+ -h, --help Print a usage message and exit
+ -V, --version Print version number and exit
+ -f, --file Print file information
+ -F, --filemetadata Print file space information for file's metadata
+ -g, --group Print group information
+ -l N, --links=N Set the threshold for the # of links when printing
+ information for small groups. N is an integer greater
+ than 0. The default threshold is 10.
+ -G, --groupmetadata Print file space information for groups' metadata
+ -d, --dset Print dataset information
+ -m N, --dims=N Set the threshold for the dimension sizes when printing
+ information for small datasets. N is an integer greater
+ than 0. The default threshold is 10.
+ -D, --dsetmetadata Print file space information for datasets' metadata
+ -T, --dtypemetadata Print datasets' datatype information
+ -A, --attribute Print attribute information
+ -a N, --numattrs=N Set the threshold for the # of attributes when printing
+ information for small # of attributes. N is an integer greater
+ than 0. The default threshold is 10.
+ -s, --freespace Print free space information
+ -S, --summary Print summary of file space information
+h5stat error: missing file name
diff --git a/tools/test/h5stat/testfiles/h5stat_notexist.ddl b/tools/test/h5stat/testfiles/h5stat_notexist.ddl
new file mode 100644
index 0000000..cc25e43
--- /dev/null
+++ b/tools/test/h5stat/testfiles/h5stat_notexist.ddl
@@ -0,0 +1,2 @@
+Filename: notexist.h5
+h5stat error: unable to open file "notexist.h5"
diff --git a/tools/test/h5stat/testfiles/h5stat_numattrs1.ddl b/tools/test/h5stat/testfiles/h5stat_numattrs1.ddl
new file mode 100644
index 0000000..fb5568d
--- /dev/null
+++ b/tools/test/h5stat/testfiles/h5stat_numattrs1.ddl
@@ -0,0 +1,17 @@
+Filename: h5stat_threshold.h5
+Small # of attributes (objects with 1 to 10 attributes):
+ # of objects with 1 attributes: 2
+ # of objects with 10 attributes: 1
+ Total # of objects with small # of attributes: 3
+Attribute bins:
+ # of objects with 1 - 9 attributes: 2
+ # of objects with 10 - 99 attributes: 3
+ Total # of objects with attributes: 5
+ Max. # of attributes to objects: 25
+File space management strategy: H5F_FILE_SPACE_ALL
+Summary of file space information:
+ File metadata: 16128 bytes
+ Raw data: 0 bytes
+ Amount/Percent of tracked free space: 0 bytes/0.0%
+ Unaccounted space: 184 bytes
+Total space: 16312 bytes
diff --git a/tools/test/h5stat/testfiles/h5stat_numattrs2.ddl b/tools/test/h5stat/testfiles/h5stat_numattrs2.ddl
new file mode 100644
index 0000000..ccb23c1
--- /dev/null
+++ b/tools/test/h5stat/testfiles/h5stat_numattrs2.ddl
@@ -0,0 +1,105 @@
+Filename: h5stat_threshold.h5
+File information
+ # of unique groups: 4
+ # of unique datasets: 23
+ # of unique named datatypes: 0
+ # of unique links: 0
+ # of unique other: 0
+ Max. # of links to object: 1
+ Max. # of objects in group: 10
+File space information for file metadata (in bytes):
+ Superblock: 96
+ Superblock extension: 0
+ User block: 0
+ Object headers: (total/unused)
+ Groups: 3576/0
+ Datasets(exclude compact data): 7896/2912
+ Datatypes: 0/0
+ Groups:
+ B-tree/List: 3816
+ Heap: 744
+ Attributes:
+ B-tree/List: 0
+ Heap: 0
+ Chunked datasets:
+ Index: 0
+ Datasets:
+ Heap: 0
+ Shared Messages:
+ Header: 0
+ B-tree/List: 0
+ Heap: 0
+ Free-space managers:
+ Header: 0
+ Amount of free space: 0
+Small groups (with 0 to 9 links):
+ # of groups with 0 link(s): 1
+ # of groups with 7 link(s): 1
+ # of groups with 9 link(s): 1
+ Total # of small groups: 3
+Group bins:
+ # of groups with 0 link: 1
+ # of groups with 1 - 9 links: 2
+ # of groups with 10 - 99 links: 1
+ Total # of groups: 4
+Dataset dimension information:
+ Max. rank of datasets: 2
+ Dataset ranks:
+ # of dataset with rank 0: 2
+ # of dataset with rank 1: 20
+ # of dataset with rank 2: 1
+1-D Dataset information:
+ Max. dimension size of 1-D datasets: 6
+ Small 1-D datasets (with dimension sizes 0 to 9):
+ # of datasets with dimension sizes 0: 1
+ # of datasets with dimension sizes 6: 19
+ Total # of small datasets: 20
+ 1-D Dataset dimension bins:
+ # of datasets with dimension size 0: 1
+ # of datasets with dimension size 1 - 9: 19
+ Total # of datasets: 20
+Dataset storage information:
+ Total raw data size: 0
+ Total external raw data size: 0
+Dataset layout information:
+ Dataset layout counts[COMPACT]: 0
+ Dataset layout counts[CONTIG]: 23
+ Dataset layout counts[CHUNKED]: 0
+ Dataset layout counts[VIRTUAL]: 0
+ Number of external files : 0
+Dataset filters information:
+ Number of datasets with:
+ NO filter: 23
+ GZIP filter: 0
+ SHUFFLE filter: 0
+ FLETCHER32 filter: 0
+ SZIP filter: 0
+ NBIT filter: 0
+ SCALEOFFSET filter: 0
+ USER-DEFINED filter: 0
+Dataset datatype information:
+ # of unique datatypes used by datasets: 1
+ Dataset datatype #0:
+ Count (total/named) = (23/0)
+ Size (desc./elmt) = (14/1)
+ Total dataset datatype count: 23
+Small # of attributes (objects with 1 to 1 attributes):
+ # of objects with 1 attributes: 2
+ Total # of objects with small # of attributes: 2
+Attribute bins:
+ # of objects with 1 - 9 attributes: 2
+ # of objects with 10 - 99 attributes: 3
+ Total # of objects with attributes: 5
+ Max. # of attributes to objects: 25
+Free-space section threshold: 1 bytes
+Small size free-space sections (< 10 bytes):
+ Total # of small size sections: 0
+Free-space section bins:
+ Total # of sections: 0
+File space management strategy: H5F_FILE_SPACE_ALL
+Summary of file space information:
+ File metadata: 16128 bytes
+ Raw data: 0 bytes
+ Amount/Percent of tracked free space: 0 bytes/0.0%
+ Unaccounted space: 184 bytes
+Total space: 16312 bytes
diff --git a/tools/test/h5stat/testfiles/h5stat_numattrs3.ddl b/tools/test/h5stat/testfiles/h5stat_numattrs3.ddl
new file mode 100644
index 0000000..de8d6a3
--- /dev/null
+++ b/tools/test/h5stat/testfiles/h5stat_numattrs3.ddl
@@ -0,0 +1,12 @@
+Filename: h5stat_threshold.h5
+Small # of attributes (objects with 1 to 25 attributes):
+ # of objects with 1 attributes: 2
+ # of objects with 10 attributes: 1
+ # of objects with 11 attributes: 1
+ # of objects with 25 attributes: 1
+ Total # of objects with small # of attributes: 5
+Attribute bins:
+ # of objects with 1 - 9 attributes: 2
+ # of objects with 10 - 99 attributes: 3
+ Total # of objects with attributes: 5
+ Max. # of attributes to objects: 25
diff --git a/tools/test/h5stat/testfiles/h5stat_numattrs4.ddl b/tools/test/h5stat/testfiles/h5stat_numattrs4.ddl
new file mode 100644
index 0000000..2b0122a
--- /dev/null
+++ b/tools/test/h5stat/testfiles/h5stat_numattrs4.ddl
@@ -0,0 +1,8 @@
+Filename: h5stat_newgrat.h5
+Small # of attributes (objects with 1 to 100 attributes):
+ # of objects with 100 attributes: 1
+ Total # of objects with small # of attributes: 1
+Attribute bins:
+ # of objects with 100 - 999 attributes: 1
+ Total # of objects with attributes: 1
+ Max. # of attributes to objects: 100
diff --git a/tools/test/h5stat/testfiles/h5stat_threshold.h5 b/tools/test/h5stat/testfiles/h5stat_threshold.h5
new file mode 100644
index 0000000..9f7c8c8
--- /dev/null
+++ b/tools/test/h5stat/testfiles/h5stat_threshold.h5
Binary files differ
diff --git a/tools/test/h5stat/testfiles/h5stat_tsohm.ddl b/tools/test/h5stat/testfiles/h5stat_tsohm.ddl
new file mode 100644
index 0000000..4cf33fc
--- /dev/null
+++ b/tools/test/h5stat/testfiles/h5stat_tsohm.ddl
@@ -0,0 +1,90 @@
+Filename: h5stat_tsohm.h5
+File information
+ # of unique groups: 1
+ # of unique datasets: 3
+ # of unique named datatypes: 0
+ # of unique links: 0
+ # of unique other: 0
+ Max. # of links to object: 1
+ Max. # of objects in group: 3
+File space information for file metadata (in bytes):
+ Superblock: 48
+ Superblock extension: 40
+ User block: 0
+ Object headers: (total/unused)
+ Groups: 51/2
+ Datasets(exclude compact data): 852/447
+ Datatypes: 0/0
+ Groups:
+ B-tree/List: 872
+ Heap: 120
+ Attributes:
+ B-tree/List: 0
+ Heap: 0
+ Chunked datasets:
+ Index: 0
+ Datasets:
+ Heap: 0
+ Shared Messages:
+ Header: 38
+ B-tree/List: 550
+ Heap: 1279
+ Free-space managers:
+ Header: 0
+ Amount of free space: 0
+Small groups (with 0 to 9 links):
+ # of groups with 3 link(s): 1
+ Total # of small groups: 1
+Group bins:
+ # of groups with 1 - 9 links: 1
+ Total # of groups: 1
+Dataset dimension information:
+ Max. rank of datasets: 2
+ Dataset ranks:
+ # of dataset with rank 2: 3
+1-D Dataset information:
+ Max. dimension size of 1-D datasets: 0
+ Small 1-D datasets (with dimension sizes 0 to 9):
+ Total # of small datasets: 0
+Dataset storage information:
+ Total raw data size: 0
+ Total external raw data size: 0
+Dataset layout information:
+ Dataset layout counts[COMPACT]: 0
+ Dataset layout counts[CONTIG]: 0
+ Dataset layout counts[CHUNKED]: 3
+ Dataset layout counts[VIRTUAL]: 0
+ Number of external files : 0
+Dataset filters information:
+ Number of datasets with:
+ NO filter: 3
+ GZIP filter: 0
+ SHUFFLE filter: 0
+ FLETCHER32 filter: 0
+ SZIP filter: 0
+ NBIT filter: 0
+ SCALEOFFSET filter: 0
+ USER-DEFINED filter: 0
+Dataset datatype information:
+ # of unique datatypes used by datasets: 1
+ Dataset datatype #0:
+ Count (total/named) = (3/0)
+ Size (desc./elmt) = (14/8)
+ Total dataset datatype count: 3
+Small # of attributes (objects with 1 to 10 attributes):
+ Total # of objects with small # of attributes: 0
+Attribute bins:
+ Total # of objects with attributes: 0
+ Max. # of attributes to objects: 0
+Free-space section threshold: 1 bytes
+Small size free-space sections (< 10 bytes):
+ Total # of small size sections: 0
+Free-space section bins:
+ Total # of sections: 0
+File space management strategy: H5F_FILE_SPACE_ALL
+Summary of file space information:
+ File metadata: 3850 bytes
+ Raw data: 0 bytes
+ Amount/Percent of tracked free space: 0 bytes/0.0%
+ Unaccounted space: 0 bytes
+Total space: 3850 bytes
diff --git a/tools/test/h5stat/testfiles/h5stat_tsohm.h5 b/tools/test/h5stat/testfiles/h5stat_tsohm.h5
new file mode 100644
index 0000000..e6c89f6
--- /dev/null
+++ b/tools/test/h5stat/testfiles/h5stat_tsohm.h5
Binary files differ
diff --git a/tools/test/h5stat/testh5stat.sh.in b/tools/test/h5stat/testh5stat.sh.in
new file mode 100644
index 0000000..e94f9bd
--- /dev/null
+++ b/tools/test/h5stat/testh5stat.sh.in
@@ -0,0 +1,318 @@
+#! /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 h5stat tool
+#
+# Modifcations:
+# Vailin Choi; July 2013
+# Add tests for -l, -m, -a options
+#
+
+srcdir=@srcdir@
+
+# Determine which filters are available
+USE_FILTER_SZIP="@USE_FILTER_SZIP@"
+USE_FILTER_DEFLATE="@USE_FILTER_DEFLATE@"
+
+TESTNAME=h5stat
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+
+STAT=../../src/h5stat/h5stat # The tool name
+STAT_BIN=`pwd`/$STAT # The path of the tool binary
+
+RM='rm -rf'
+CMP='cmp -s'
+DIFF='diff -c'
+CP='cp'
+DIRNAME='dirname'
+LS='ls'
+AWK='awk'
+
+nerrors=0
+verbose=yes
+
+# 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/test/h5diff/testfiles"
+SRC_H5COPY_TESTFILES="$SRC_TOOLS/test/h5copy/testfiles"
+SRC_H5REPACK_TESTFILES="$SRC_TOOLS/test/h5repack/testfiles"
+SRC_H5JAM_TESTFILES="$SRC_TOOLS/test/h5jam/testfiles"
+SRC_H5STAT_TESTFILES="$SRC_TOOLS/test/h5stat/testfiles"
+SRC_H5IMPORT_TESTFILES="$SRC_TOOLS/test/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_H5STAT_TESTFILES/h5stat_filters.h5
+$SRC_H5STAT_TESTFILES/h5stat_tsohm.h5
+$SRC_H5STAT_TESTFILES/h5stat_newgrat.h5
+$SRC_H5STAT_TESTFILES/h5stat_idx.h5
+$SRC_H5STAT_TESTFILES/h5stat_threshold.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_nofile.ddl
+$SRC_H5STAT_TESTFILES/h5stat_filters.ddl
+$SRC_H5STAT_TESTFILES/h5stat_filters-file.ddl
+$SRC_H5STAT_TESTFILES/h5stat_filters-F.ddl
+$SRC_H5STAT_TESTFILES/h5stat_filters-d.ddl
+$SRC_H5STAT_TESTFILES/h5stat_filters-g.ddl
+$SRC_H5STAT_TESTFILES/h5stat_filters-dT.ddl
+$SRC_H5STAT_TESTFILES/h5stat_filters-UD.ddl
+$SRC_H5STAT_TESTFILES/h5stat_filters-UT.ddl
+$SRC_H5STAT_TESTFILES/h5stat_tsohm.ddl
+$SRC_H5STAT_TESTFILES/h5stat_newgrat.ddl
+$SRC_H5STAT_TESTFILES/h5stat_newgrat-UG.ddl
+$SRC_H5STAT_TESTFILES/h5stat_newgrat-UA.ddl
+$SRC_H5STAT_TESTFILES/h5stat_idx.ddl
+$SRC_H5STAT_TESTFILES/h5stat_err1_links.ddl
+$SRC_H5STAT_TESTFILES/h5stat_links1.ddl
+$SRC_H5STAT_TESTFILES/h5stat_links2.ddl
+$SRC_H5STAT_TESTFILES/h5stat_links3.ddl
+$SRC_H5STAT_TESTFILES/h5stat_links4.ddl
+$SRC_H5STAT_TESTFILES/h5stat_links5.ddl
+$SRC_H5STAT_TESTFILES/h5stat_err1_dims.ddl
+$SRC_H5STAT_TESTFILES/h5stat_dims1.ddl
+$SRC_H5STAT_TESTFILES/h5stat_dims2.ddl
+$SRC_H5STAT_TESTFILES/h5stat_err1_numattrs.ddl
+$SRC_H5STAT_TESTFILES/h5stat_err2_numattrs.ddl
+$SRC_H5STAT_TESTFILES/h5stat_numattrs1.ddl
+$SRC_H5STAT_TESTFILES/h5stat_numattrs2.ddl
+$SRC_H5STAT_TESTFILES/h5stat_numattrs3.ddl
+$SRC_H5STAT_TESTFILES/h5stat_numattrs4.ddl
+"
+
+#
+# copy test files and expected output files from source dirs to test dir
+#
+COPY_TESTFILES="$LIST_HDF5_TEST_FILES $LIST_OTHER_TEST_FILES"
+
+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
+ # skip cp if srcdir is same as destdir
+ # this occurs when build/test performed in source dir and
+ # make cp fail
+ SDIR=`$DIRNAME $tstfile`
+ INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
+ INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
+ if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
+ $CP -f $tstfile $TESTDIR
+ if [ $? -ne 0 ]; then
+ echo "Error: FAILED to copy $tstfile ."
+
+ # Comment out this to CREATE expected file
+ exit $EXIT_FAILURE
+ fi
+ fi
+ fi
+ done
+}
+
+CLEAN_TESTFILES_AND_TESTDIR()
+{
+ # skip rm if srcdir is same as destdir
+ # this occurs when build/test performed in source dir and
+ # make cp fail
+ SDIR=$SRC_H5STAT_TESTFILES
+ INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
+ INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
+ if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
+ $RM $TESTDIR
+ fi
+}
+
+# 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 $STAT $@
+ (
+ cd $TESTDIR
+ $RUNSERIAL $STAT_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
+ fi
+}
+
+
+# Print a "SKIP" message
+SKIP() {
+ TESTING $STAT $@
+ echo " -SKIP-"
+}
+
+
+
+##############################################################################
+##############################################################################
+### T H E T E S T S ###
+##############################################################################
+##############################################################################
+# prepare for test
+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
+TOOLTEST h5stat_nofile.ddl ''
+
+# 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
+TOOLTEST h5stat_filters.ddl h5stat_filters.h5
+TOOLTEST h5stat_filters-file.ddl -f h5stat_filters.h5
+TOOLTEST h5stat_filters-F.ddl -F h5stat_filters.h5
+TOOLTEST h5stat_filters-d.ddl -d h5stat_filters.h5
+TOOLTEST h5stat_filters-g.ddl -g h5stat_filters.h5
+TOOLTEST h5stat_filters-dT.ddl -dT h5stat_filters.h5
+TOOLTEST h5stat_filters-UD.ddl -D h5stat_filters.h5
+TOOLTEST h5stat_filters-UT.ddl -T h5stat_filters.h5
+#
+# h5stat_tsohm.h5 is a copy of ../../../test/tsohm.h5 generated by tsohm.c
+# as of release 1.8.7-snap0 (on a 64-bit machine)
+TOOLTEST h5stat_tsohm.ddl h5stat_tsohm.h5
+# h5stat_newgrat.h5 is generated by h5stat_gentest.c
+TOOLTEST h5stat_newgrat.ddl h5stat_newgrat.h5
+TOOLTEST h5stat_newgrat-UG.ddl -G h5stat_newgrat.h5
+TOOLTEST h5stat_newgrat-UA.ddl -A h5stat_newgrat.h5
+# h5stat_idx.h5 is generated by h5stat_gentest.c
+TOOLTEST h5stat_idx.ddl h5stat_idx.h5
+#
+# Tests for -l (--links) option on h5stat_threshold.h5:
+# -l 0 (incorrect threshold value)
+# -g -l 8
+# --links=8
+# --links=20 -g
+TOOLTEST h5stat_err1_links.ddl -l 0 h5stat_threshold.h5
+TOOLTEST h5stat_links1.ddl -g -l 8 h5stat_threshold.h5
+TOOLTEST h5stat_links2.ddl --links=8 h5stat_threshold.h5
+TOOLTEST h5stat_links3.ddl --links=20 -g h5stat_threshold.h5
+#
+# Tests for -l (--links) option on h5stat_newgrat.h5:
+# -g
+# -g -l 40000
+TOOLTEST h5stat_links4.ddl -g h5stat_newgrat.h5
+TOOLTEST h5stat_links5.ddl -g -l 40000 h5stat_newgrat.h5
+#
+# Tests for -m (--dims) option on h5stat_threshold.h5
+# -d --dims=-1 (incorrect threshold value)
+# -gd -m 5
+# -d --di=15
+TOOLTEST h5stat_err1_dims.ddl -d --dims=-1 h5stat_threshold.h5
+TOOLTEST h5stat_dims1.ddl -gd -m 5 h5stat_threshold.h5
+TOOLTEST h5stat_dims2.ddl -d --di=15 h5stat_threshold.h5
+#
+# Tests for -a option on h5stat_threshold.h5
+# -a -2 (incorrect threshold value)
+# --numattrs (without threshold value)
+# -AS -a 10
+# -a 1
+# -A --numattrs=25
+TOOLTEST h5stat_err1_numattrs.ddl -a -2 h5stat_threshold.h5
+TOOLTEST h5stat_err2_numattrs.ddl --numattrs h5stat_threshold.h5
+TOOLTEST h5stat_numattrs1.ddl -AS -a 10 h5stat_threshold.h5
+TOOLTEST h5stat_numattrs2.ddl -a 1 h5stat_threshold.h5
+TOOLTEST h5stat_numattrs3.ddl -A --numattrs=25 h5stat_threshold.h5
+#
+# Tests for -a option on h5stat_newgrat.h5
+# -A -a 100
+TOOLTEST h5stat_numattrs4.ddl -A -a 100 h5stat_newgrat.h5
+#
+
+# Clean up temporary files/directories
+CLEAN_TESTFILES_AND_TESTDIR
+
+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/test/misc/CMakeLists.txt b/tools/test/misc/CMakeLists.txt
new file mode 100644
index 0000000..db68eb1
--- /dev/null
+++ b/tools/test/misc/CMakeLists.txt
@@ -0,0 +1,30 @@
+cmake_minimum_required (VERSION 3.1.0)
+PROJECT (HDF5_TOOLS_TEST_MISC)
+
+#-----------------------------------------------------------------------------
+# Setup include Directories
+#-----------------------------------------------------------------------------
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib)
+
+ # --------------------------------------------------------------------
+ # Add the misc test executables
+ # --------------------------------------------------------------------
+ if (HDF5_BUILD_GENERATORS)
+ add_executable (h5repart_gentest ${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/h5repart_gentest.c)
+ TARGET_NAMING (h5repart_gentest STATIC)
+ TARGET_C_PROPERTIES (h5repart_gentest STATIC " " " ")
+ target_link_libraries (h5repart_gentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+ set_target_properties (h5repart_gentest PROPERTIES FOLDER generator/tools)
+ #add_test (NAME h5repart_gentest COMMAND $<TARGET_FILE:h5repart_gentest>)
+
+ add_subdirectory (${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/vds)
+
+ endif (HDF5_BUILD_GENERATORS)
+
+ add_executable (h5repart_test ${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/repart_test.c)
+ TARGET_NAMING (h5repart_test STATIC)
+ TARGET_C_PROPERTIES (h5repart_test STATIC " " " ")
+ target_link_libraries (h5repart_test ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+ set_target_properties (h5repart_test PROPERTIES FOLDER tools)
+
+ include (CMakeTests.cmake)
diff --git a/tools/test/misc/CMakeTests.cmake b/tools/test/misc/CMakeTests.cmake
new file mode 100644
index 0000000..c041b21
--- /dev/null
+++ b/tools/test/misc/CMakeTests.cmake
@@ -0,0 +1,253 @@
+
+##############################################################################
+##############################################################################
+### T E S T I N G ###
+##############################################################################
+##############################################################################
+
+ # --------------------------------------------------------------------
+ # Copy all the HDF5 files from the source directory into the test directory
+ # --------------------------------------------------------------------
+ set (HDF5_REFERENCE_TEST_FILES
+ family_file00000.h5
+ family_file00001.h5
+ family_file00002.h5
+ family_file00003.h5
+ family_file00004.h5
+ family_file00005.h5
+ family_file00006.h5
+ family_file00007.h5
+ family_file00008.h5
+ family_file00009.h5
+ family_file00010.h5
+ family_file00011.h5
+ family_file00012.h5
+ family_file00013.h5
+ family_file00014.h5
+ family_file00015.h5
+ family_file00016.h5
+ family_file00017.h5
+ )
+
+ foreach (h5_file ${HDF5_REFERENCE_TEST_FILES})
+ HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/${h5_file}" "${PROJECT_BINARY_DIR}/${h5_file}" "h5repart_files")
+ endforeach (h5_file ${HDF5_REFERENCE_TEST_FILES})
+ add_custom_target(h5repart_files ALL COMMENT "Copying files needed by h5repart tests" DEPENDS ${h5repart_files_list})
+
+ set (HDF5_MKGRP_TEST_FILES
+ #h5mkgrp_help.txt
+ #h5mkgrp_version
+ h5mkgrp_single.ls
+ h5mkgrp_single_v.ls
+ h5mkgrp_single_p.ls
+ h5mkgrp_single_l.ls
+ h5mkgrp_several.ls
+ h5mkgrp_several_v.ls
+ h5mkgrp_several_p.ls
+ h5mkgrp_several_l.ls
+ h5mkgrp_nested_p.ls
+ h5mkgrp_nested_lp.ls
+ h5mkgrp_nested_mult_p.ls
+ h5mkgrp_nested_mult_lp.ls
+ )
+
+ # make test dir
+ file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
+
+ foreach (h5_mkgrp_file ${HDF5_MKGRP_TEST_FILES})
+ HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/${h5_mkgrp_file}" "${PROJECT_BINARY_DIR}/testfiles/${h5_mkgrp_file}" "h5mkgrp_files")
+ endforeach (h5_mkgrp_file ${HDF5_MKGRP_TEST_FILES})
+
+ HDFTEST_COPY_FILE("${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/testfiles/h5mkgrp_help.txt" "${PROJECT_BINARY_DIR}/testfiles/h5mkgrp_help.txt" "h5mkgrp_files")
+ add_custom_target(h5mkgrp_files ALL COMMENT "Copying files needed by h5mkgrp tests" DEPENDS ${h5mkgrp_files_list})
+
+ configure_file (${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/testfiles/h5mkgrp_version.txt.in ${PROJECT_BINARY_DIR}/testfiles/h5mkgrp_version.txt @ONLY)
+
+##############################################################################
+##############################################################################
+### T H E T E S T S M A C R O S ###
+##############################################################################
+##############################################################################
+
+ MACRO (ADD_H5_TEST resultfile resultcode resultoption)
+ if (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (
+ NAME H5MKGRP-${resultfile}-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ ${resultfile}.h5
+ )
+ set_tests_properties (H5MKGRP-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
+ endif (NOT HDF5_ENABLE_USING_MEMCHECKER)
+
+ add_test (
+ NAME H5MKGRP-${resultfile}
+ COMMAND $<TARGET_FILE:h5mkgrp> ${resultoption} ${resultfile}.h5 ${ARGN}
+ )
+ set_tests_properties (H5MKGRP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
+ if (HDF5_ENABLE_USING_MEMCHECKER)
+ if (NOT "${last_test}" STREQUAL "")
+ set_tests_properties (H5MKGRP-${resultfile} PROPERTIES DEPENDS ${last_test})
+ endif (NOT "${last_test}" STREQUAL "")
+ else (HDF5_ENABLE_USING_MEMCHECKER)
+ set_tests_properties (H5MKGRP-${resultfile} PROPERTIES DEPENDS H5MKGRP-${resultfile}-clear-objects)
+ add_test (
+ NAME H5MKGRP-${resultfile}-h5ls
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5ls>"
+ -D "TEST_ARGS:STRING=-v;-r;${resultfile}.h5"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
+ -D "TEST_OUTPUT=${resultfile}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_MASK_MOD=true"
+ -D "TEST_REFERENCE=${resultfile}.ls"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ set_tests_properties (H5MKGRP-${resultfile}-h5ls PROPERTIES DEPENDS H5MKGRP-${resultfile})
+ endif (HDF5_ENABLE_USING_MEMCHECKER)
+ ENDMACRO (ADD_H5_TEST resultfile resultcode resultoption)
+
+ MACRO (ADD_H5_CMP resultfile resultcode)
+ if (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (NAME H5MKGRP_CMP-${resultfile} COMMAND $<TARGET_FILE:h5mkgrp> ${ARGN})
+ else (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (
+ NAME H5MKGRP_CMP-${resultfile}-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ ${resultfile}.h5
+ )
+ set_tests_properties (H5MKGRP_CMP-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
+ add_test (
+ NAME H5MKGRP_CMP-${resultfile}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5mkgrp>"
+ -D "TEST_ARGS:STRING=${ARGN}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
+ -D "TEST_OUTPUT=${resultfile}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=${resultfile}.txt"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ set_tests_properties (H5MKGRP_CMP-${resultfile} PROPERTIES DEPENDS H5MKGRP_CMP-${resultfile}-clear-objects)
+ endif (HDF5_ENABLE_USING_MEMCHECKER)
+ ENDMACRO (ADD_H5_CMP resultfile resultcode)
+
+##############################################################################
+##############################################################################
+### T H E T E S T S ###
+##############################################################################
+##############################################################################
+
+ ###################### H5REPART #########################
+ # Remove any output file left over from previous test run
+ add_test (
+ NAME H5REPART-clearall-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ fst_family00000.h5
+ scd_family00000.h5
+ scd_family00001.h5
+ scd_family00002.h5
+ scd_family00003.h5
+ family_to_sec2.h5
+ )
+ if (NOT "${last_test}" STREQUAL "")
+ set_tests_properties (H5REPART-clearall-objects PROPERTIES DEPENDS ${last_test})
+ endif (NOT "${last_test}" STREQUAL "")
+ set (last_test "H5REPART-clearall-objects")
+
+ # repartition family member size to 20,000 bytes.
+ add_test (NAME H5REPART-h5repart_20K COMMAND $<TARGET_FILE:h5repart> -m 20000 family_file%05d.h5 fst_family%05d.h5)
+ set_tests_properties (H5REPART-h5repart_20K PROPERTIES DEPENDS H5REPART-clearall-objects)
+
+ # repartition family member size to 5 KB.
+ add_test (NAME H5REPART-h5repart_5K COMMAND $<TARGET_FILE:h5repart> -m 5k family_file%05d.h5 scd_family%05d.h5)
+ set_tests_properties (H5REPART-h5repart_5K PROPERTIES DEPENDS H5REPART-clearall-objects)
+
+ # convert family file to sec2 file of 20,000 bytes
+ add_test (NAME H5REPART-h5repart_sec2 COMMAND $<TARGET_FILE:h5repart> -m 20000 -family_to_sec2 family_file%05d.h5 family_to_sec2.h5)
+ set_tests_properties (H5REPART-h5repart_sec2 PROPERTIES DEPENDS H5REPART-clearall-objects)
+
+ # test the output files repartitioned above.
+ add_test (NAME H5REPART-h5repart_test COMMAND $<TARGET_FILE:h5repart_test>)
+ set_tests_properties (H5REPART-h5repart_test PROPERTIES DEPENDS "H5REPART-clearall-objects;H5REPART-h5repart_20K;H5REPART-h5repart_5K;H5REPART-h5repart_sec2")
+
+ set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES}
+ h5repart_test
+ )
+
+ if (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (
+ NAME H5MKGRP-clearall-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ h5mkgrp_help.out
+ h5mkgrp_help.out.err
+ h5mkgrp_version.out
+ h5mkgrp_version.out.err
+ h5mkgrp_single.h5
+ h5mkgrp_single.out
+ h5mkgrp_single.out.err
+ h5mkgrp_single_v.h5
+ h5mkgrp_single_v.out
+ h5mkgrp_single_v.out.err
+ h5mkgrp_single_p.h5
+ h5mkgrp_single_p.out
+ h5mkgrp_single_p.out.err
+ h5mkgrp_single_l.h5
+ h5mkgrp_single_l.out
+ h5mkgrp_single_l.out.err
+ h5mkgrp_several.h5
+ h5mkgrp_several.out
+ h5mkgrp_several.out.err
+ h5mkgrp_several_v.h5
+ h5mkgrp_several_v.out
+ h5mkgrp_several_v.out.err
+ h5mkgrp_several_p.h5
+ h5mkgrp_several_p.out
+ h5mkgrp_several_p.out.err
+ h5mkgrp_several_l.h5
+ h5mkgrp_several_l.out
+ h5mkgrp_several_l.out.err
+ h5mkgrp_nested_p.h5
+ h5mkgrp_nested_p.out
+ h5mkgrp_nested_p.out.err
+ h5mkgrp_nested_lp.h5
+ h5mkgrp_nested_lp.out
+ h5mkgrp_nested_lp.out.err
+ h5mkgrp_nested_mult_p.h5
+ h5mkgrp_nested_mult_p.out
+ h5mkgrp_nested_mult_p.out.err
+ h5mkgrp_nested_mult_lp.h5
+ h5mkgrp_nested_mult_lp.out
+ h5mkgrp_nested_mult_lp.out.err
+ )
+ set_tests_properties (H5MKGRP-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
+ if (NOT "${last_test}" STREQUAL "")
+ set_tests_properties (H5MKGRP-clearall-objects PROPERTIES DEPENDS ${last_test})
+ endif (NOT "${last_test}" STREQUAL "")
+ set (last_test "H5MKGRP-clearall-objects")
+ endif (HDF5_ENABLE_USING_MEMCHECKER)
+
+ # Check that help & version is displayed properly
+ ADD_H5_CMP (h5mkgrp_help 0 "-h")
+ ADD_H5_CMP (h5mkgrp_version 0 "-V")
+
+ # Create single group at root level
+ ADD_H5_TEST (h5mkgrp_single 0 "" single)
+ ADD_H5_TEST (h5mkgrp_single_v 0 "-v" single)
+ ADD_H5_TEST (h5mkgrp_single_p 0 "-p" single)
+ ADD_H5_TEST (h5mkgrp_single_l 0 "-l" latest)
+
+ # Create several groups at root level
+ ADD_H5_TEST (h5mkgrp_several 0 "" one two)
+ ADD_H5_TEST (h5mkgrp_several_v 0 "-v" one two)
+ ADD_H5_TEST (h5mkgrp_several_p 0 "-p" one two)
+ ADD_H5_TEST (h5mkgrp_several_l 0 "-l" one two)
+
+ # Create various nested groups
+ ADD_H5_TEST (h5mkgrp_nested_p 0 "-p" /one/two)
+ ADD_H5_TEST (h5mkgrp_nested_lp 0 "-lp" /one/two)
+ ADD_H5_TEST (h5mkgrp_nested_mult_p 0 "-p" /one/two /three/four)
+ ADD_H5_TEST (h5mkgrp_nested_mult_lp 0 "-lp" /one/two /three/four)
diff --git a/tools/test/misc/Makefile.am b/tools/test/misc/Makefile.am
new file mode 100644
index 0000000..4168e8c
--- /dev/null
+++ b/tools/test/misc/Makefile.am
@@ -0,0 +1,47 @@
+#
+# 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.
+##
+## Makefile.am
+## Run automake to generate a Makefile.in from this file.
+#
+# HDF5 Library Makefile(.in)
+#
+
+include $(top_srcdir)/config/commence.am
+
+SUBDIRS=vds
+
+# Include src directory
+AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib
+
+#test scripts and programs
+TEST_PROG=h5repart_gentest talign
+TEST_SCRIPT=testh5repart.sh testh5mkgrp.sh
+
+check_PROGRAMS=$(TEST_PROG) repart_test
+check_SCRIPTS=$(TEST_SCRIPT)
+SCRIPT_DEPEND=../../src/misc/h5repart$(EXEEXT) ../../src/misc/h5mkgrp$(EXEEXT)
+
+# Temporary files. *.h5 are generated by h5repart_gentest. They should
+# copied to the testfiles/ directory if update is required. fst_family*.h5
+# and scd_family*.h5 were created by setting the HDF5_NOCLEANUP variable.
+CHECK_CLEANFILES+=*.h5 ../testfiles/fst_family*.h5 ../testfiles/scd_family*.h5
+
+# These were generated by configure. Remove them only when distclean.
+DISTCLEANFILES=testh5repart.sh
+
+# All programs rely on hdf5 library and h5tools library
+LDADD=$(LIBH5TOOLS) $(LIBHDF5)
+
+include $(top_srcdir)/config/conclude.am
diff --git a/tools/test/misc/h5perf_gentest.c b/tools/test/misc/h5perf_gentest.c
new file mode 100644
index 0000000..50c18c1
--- /dev/null
+++ b/tools/test/misc/h5perf_gentest.c
@@ -0,0 +1,598 @@
+/*****************************************************************************
+ This test generates attributes, groups, and datasets of many types. It
+ creates a large number of attributes, groups, and datasets by specifying
+ -a, -g, -d options respectively. Using "-h" option to see details.
+
+ Programmer: Peter Cao <xcao@hdfgroup.org>, Jan. 2013
+ ****************************************************************************/
+
+#include "hdf5.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#define FNAME "test_perf.h5"
+#define NGROUPS 20
+#define NDSETS 20
+#define NATTRS 20
+#define DIM0 40
+#define NROWS 100
+#define NTYPES 9
+#define MAXVLEN 10
+#define FIXED_LEN 8
+
+typedef enum { SOLID=0, LIQUID, GAS, PLASMA } phase_t;
+
+typedef struct {
+ int i;
+ unsigned long long l;
+ float f;
+ double d;
+ char s[FIXED_LEN];
+ phase_t e;
+ float f_array[FIXED_LEN];
+ hvl_t i_vlen;
+ char *s_vlen;
+} test_comp_t;
+
+typedef struct {
+ int zipcode;
+ char *city;
+} zipcode_t;
+
+int add_attrs(hid_t oid, int idx);
+int add_attr(hid_t oid, const char *name, hid_t tid, hid_t sid, void *buf) ;
+herr_t create_perf_test_file(const char *fname, int ngrps, int ndsets,
+ int nattrs, hsize_t nrows, hsize_t dim0, hsize_t chunk, int vlen,
+ int compressed, int latest);
+
+int main (int argc, char *argv[])
+{
+ char fname[32];
+ int i, ngrps=NGROUPS, ndsets=NDSETS, nattrs=NATTRS, dim0=DIM0,
+ chunk=DIM0/10+1, nrows=NROWS, vlen=MAXVLEN, l=0, z=0;
+
+ memset(fname, 0, 32);
+ for (i=1; i<argc; i++) {
+ if (strcmp(argv[i], "-f")==0)
+ strcpy(fname, argv[i+1]);
+ else if (strcmp(argv[i], "-g")==0)
+ ngrps = atoi(argv[i+1]);
+ else if (strcmp(argv[i], "-d")==0)
+ ndsets = atoi(argv[i+1]);
+ else if (strcmp(argv[i], "-a")==0)
+ nattrs = atoi(argv[i+1]);
+ else if (strcmp(argv[i], "-r")==0)
+ nrows = atoi(argv[i+1]);
+ else if (strcmp(argv[i], "-s")==0)
+ dim0 = atoi(argv[i+1]);
+ else if (strcmp(argv[i], "-c")==0)
+ chunk = atoi(argv[i+1]);
+ else if (strcmp(argv[i], "-v")==0)
+ vlen = atoi(argv[i+1]);
+ else if (strcmp(argv[i], "-l")==0)
+ l = 1;
+ else if (strcmp(argv[i], "-z")==0)
+ z = 1;
+ else if (strcmp(argv[i], "-h")==0) {
+ printf("\nOPTONS:\n");
+ printf("\t-f F:\tname of the test file (default: %s).\n", FNAME);
+ printf("\t-g N:\tnumber of top level groups (default: %d).\n", NGROUPS);
+ printf("\t-d N:\tnumber of datasets (default: %d).\n", NDSETS);
+ printf("\t-a N:\tnumber of attributes (default: %d).\n", NATTRS);
+ printf("\t-r N:\tnumber of rows in the large compound dataset (default: %d).\n", NROWS);
+ printf("\t-s N:\tsize of dim0 in datasets (default: %d).\n", DIM0);
+ printf("\t-c N:\tchunk size of dim0 (default: %d).\n", (DIM0/10+1));
+ printf("\t-v N:\tmax vlen size (default: %d).\n", MAXVLEN);
+ printf("\t-l:\tuse latest format (default: no).\n");
+ printf("\t-z:\tuse gzip compression (default: no).\n");
+ printf("\t-h:\tthis help information.\n");
+ printf("Example:\n");
+ printf("\t./a.out -f test.h5 -g 10000 -d 5000 -a 500 -r 10000 -s 200 -c 20 -v 40 -l -z\n\n");
+ exit(0);
+ }
+ }
+
+ if (strlen(fname)<=0)
+ sprintf(fname, FNAME);
+
+ create_perf_test_file(fname, ngrps, ndsets, nattrs, (hsize_t)nrows,
+ (hsize_t)dim0, (hsize_t)chunk, vlen, z, l);
+
+ return 0;
+}
+
+/*****************************************************************************
+ This function generates attributes, groups, and datasets of many types.
+
+ Parameters:
+ fname: file_name.
+ ngrps: number of top level groups.
+ ndsets: number of datasets.
+ attrs: number of attributes.
+ nrow: number of rows in a dataset.
+ chunk: chunk size (single number).
+ vlen: max vlen size.
+ comp: use latest format.
+ latest: use gzip comnpression.
+
+ Return: Non-negative on success/Negative on failure
+
+ Programmer: Peter Cao <xcao@hdfgroup.org>, Jan. 2013
+ ****************************************************************************/
+herr_t create_perf_test_file(const char *fname, int ngrps, int ndsets,
+ int nattrs, hsize_t nrows, hsize_t dim0, hsize_t chunk, int vlen,
+ int compressed, int latest)
+{
+ int i, j, k;
+ hid_t fid, sid_null, sid_scalar, sid_1d, sid_2d, did, aid, sid_2, sid_large,
+ fapl=H5P_DEFAULT, dcpl=H5P_DEFAULT, gid1, gid2, cmp_tid, tid_str,
+ tid_enum, tid_array_f, tid_vlen_i, tid_vlen_s;
+ char name[32], tmp_name1[32], tmp_name2[32], tmp_name3[32];
+ hsize_t dims[1]={dim0}, dims2d[2]={dim0, (dim0/4+1)}, dims_array[1]={FIXED_LEN},
+ dim1[1]={2};
+ char *enum_names[4] = {"SOLID", "LIQUID", "GAS", "PLASMA"};
+ test_comp_t *buf_comp=NULL, *buf_comp_large=NULL;
+ int *buf_int=NULL;
+ float (*buf_float_a)[FIXED_LEN]=NULL;
+ double **buf_double2d=NULL;
+ hvl_t *buf_vlen_i=NULL;
+ char (*buf_str)[FIXED_LEN];
+ char **buf_vlen_s=NULL;
+ hobj_ref_t buf_ref[2];
+ hdset_reg_ref_t buf_reg_ref[2];
+ size_t offset, len;
+ herr_t status;
+ char *names[NTYPES] = { "int", "ulong", "float", "double", "fixed string",
+ "enum", "fixed float array", "vlen int array", "vlen strings"};
+ hid_t types[NTYPES] = { H5T_NATIVE_INT, H5T_NATIVE_UINT64, H5T_NATIVE_FLOAT,
+ H5T_NATIVE_DOUBLE, tid_str, tid_enum, tid_array_f, tid_vlen_i, tid_vlen_s};
+ hsize_t coords[4][2] = { {0, 1}, {3, 5}, {1, 0}, {2, 4}}, start=0, stride=1, count=1;
+
+ if (nrows < NROWS) nrows = NROWS;
+ if (ngrps<NGROUPS) ngrps=NGROUPS;
+ if (ndsets<NDSETS) ndsets=NDSETS;
+ if (nattrs<NATTRS) nattrs=NATTRS;
+ if (dim0<DIM0) dim0=DIM0;
+ if (chunk>dim0) chunk=dim0/4;
+ if (chunk<1) chunk = 1;
+ if (vlen<1) vlen = MAXVLEN;
+
+ /* create fixed string datatype */
+ types[4] = tid_str = H5Tcopy (H5T_C_S1);
+ H5Tset_size (tid_str, FIXED_LEN);
+
+ /* create enum datatype */
+ types[5] = tid_enum = H5Tenum_create(H5T_NATIVE_INT);
+ for (i = (int) SOLID; i <= (int) PLASMA; i++) {
+ phase_t val = (phase_t) i;
+ status = H5Tenum_insert (tid_enum, enum_names[i], &val);
+ }
+
+ /* create float array datatype */
+ types[6] = tid_array_f = H5Tarray_create (H5T_NATIVE_FLOAT, 1, dims_array);
+
+ /* create variable length integer datatypes */
+ types[7] = tid_vlen_i = H5Tvlen_create (H5T_NATIVE_INT);
+
+ /* create variable length string datatype */
+ types[8] = tid_vlen_s = H5Tcopy (H5T_C_S1);
+ H5Tset_size (tid_vlen_s, H5T_VARIABLE);
+
+ /* create compound datatypes */
+ cmp_tid = H5Tcreate (H5T_COMPOUND, sizeof (test_comp_t));
+ offset = 0;
+ for (i=0; i<NTYPES-2; i++) {
+ H5Tinsert(cmp_tid, names[i], offset, types[i]);
+ offset += H5Tget_size(types[i]);
+ }
+
+ H5Tinsert(cmp_tid, names[7], offset, types[7]);
+ offset += sizeof (hvl_t);
+ H5Tinsert(cmp_tid, names[8], offset, types[8]);
+
+ /* create dataspace */
+ sid_1d = H5Screate_simple (1, dims, NULL);
+ sid_2d = H5Screate_simple (2, dims2d, NULL);
+ sid_2 = H5Screate_simple (1, dim1, NULL);
+ sid_large = H5Screate_simple (1, &nrows, NULL);
+ sid_null = H5Screate (H5S_NULL);
+ sid_scalar = H5Screate (H5S_SCALAR);
+
+ /* create fid access property */
+ fapl = H5Pcreate (H5P_FILE_ACCESS);
+ H5Pset_libver_bounds (fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST);
+
+ /* create dataset creation property */
+ dcpl = H5Pcreate (H5P_DATASET_CREATE);
+
+ /* set dataset chunk */
+ if (chunk>0) {
+ H5Pset_chunk (dcpl, 1, &chunk);
+ }
+
+ /* set dataset compression */
+ if (compressed) {
+ if (chunk<=0) {
+ chunk = dim0/10+1;;
+ H5Pset_chunk (dcpl, 1, &chunk);
+ }
+ H5Pset_shuffle (dcpl);
+ H5Pset_deflate (dcpl, 6);
+ }
+
+ /* allocate buffers */
+ buf_comp = (test_comp_t *)calloc(dim0, sizeof(test_comp_t));
+ buf_comp_large = (test_comp_t *)calloc(nrows, sizeof(test_comp_t));
+ buf_int = (int *)calloc(dim0, sizeof(int));
+ buf_float_a = malloc(dim0*sizeof(*buf_float_a));
+ buf_vlen_i = (hvl_t *)calloc(dim0, sizeof (hvl_t));
+ buf_vlen_s = (char **)calloc(dim0, sizeof(char *));
+ buf_str = malloc(dim0*sizeof (*buf_str));
+
+ /* allocate array of doulbe pointers */
+ buf_double2d = (double **)calloc(dims2d[0],sizeof(double *));
+ /* allocate a contigous chunk of memory for the data */
+ buf_double2d[0] = (double *)calloc( dims2d[0]*dims2d[1],sizeof(double) );
+ /* assign memory city to pointer array */
+ for (i=1; i <dims2d[0]; i++) buf_double2d[i] = buf_double2d[0]+i*dims2d[1];
+
+ /* fill buffer values */
+ len = 1;
+ for (i=0; i<dims[0]; i++) {
+ buf_comp[i].i = buf_int[i] = i-2147483648;
+ buf_comp[i].l = 0xffffffffffffffff-i;
+ buf_comp[i].f = 1.0/(i+1.0);
+ buf_comp[i].d = 987654321.0*i+1.0/(i+1.0);
+ buf_comp[i].e = (phase_t) (i % (int) (PLASMA + 1));
+
+ for (j=0; j<FIXED_LEN; j++) {
+ buf_comp[i].f_array[j] = buf_float_a[i][j] = i*100+j;
+ buf_str[i][j] = 'a' + (i%26);
+ }
+ buf_str[i][FIXED_LEN-1] = 0;
+ strcpy(buf_comp[i].s, buf_str[i]);
+
+ len = (1-cos(i/8.0))/2*vlen+1;
+ if (!i) len = vlen;
+ buf_vlen_i[i].len = len;
+ buf_vlen_i[i].p = (int *)calloc(len, sizeof(int));
+ for (j=0; j<len; j++) ((int*)(buf_vlen_i[i].p))[j] = i*100+j;
+ buf_comp[i].i_vlen = buf_vlen_i[i];
+
+ buf_vlen_s[i] = (char *)calloc(len, sizeof(char));
+ for (j=0; j<len-1; j++)
+ buf_vlen_s[i][j] = j%26+'A';
+ buf_comp[i].s_vlen = buf_vlen_s[i];
+
+ for (j=0; j<dims2d[1]; j++)
+ buf_double2d[i][j] = i+j/10000.0;
+ }
+
+ for (i=0; i<nrows; i++) {
+ buf_comp_large[i].i = i-2147483648;
+ buf_comp_large[i].l = 0xffffffffffffffff-i;
+ buf_comp_large[i].f = 1.0/(i+1.0);
+ buf_comp_large[i].d = 987654321.0*i+1.0/(i+1.0);
+ buf_comp_large[i].e = (phase_t) (i % (int) (PLASMA + 1));
+ for (j=0; j<FIXED_LEN-1; j++) {
+ buf_comp_large[i].f_array[j] = i*100+j;
+ buf_comp_large[i].s[j] = 'a' + (i%26);
+ }
+ len = i%vlen+1;
+ buf_comp_large[i].i_vlen.len = len;
+ buf_comp_large[i].i_vlen.p = (int *)calloc(len, sizeof(int));
+ for (j=0; j<len; j++) ((int*)(buf_comp_large[i].i_vlen.p))[j] = i*100+j;
+ buf_comp_large[i].s_vlen = (char *)calloc(i+2, sizeof(char));
+ for (j=0; j<i+1; j++) (buf_comp_large[i].s_vlen)[j] = j%26+'A';
+ }
+
+ /* create file */
+ if (latest)
+ fid = H5Fcreate (fname, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
+ else
+ fid = H5Fcreate (fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ add_attrs(fid, 0);
+
+ sprintf(name, "a cmp ds of %d rows", nrows);
+ did = H5Dcreate (fid, name, cmp_tid, sid_large, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ H5Dwrite (did, cmp_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_comp_large);
+ add_attrs(did, 0);
+ H5Dclose(did);
+
+ // /* add attributes*/
+ gid1 = H5Gcreate (fid, "attributes", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (nattrs<1) nattrs = 1;
+ i=0;
+ while (i<nattrs) i += add_attrs(gid1, i);
+ H5Gclose(gid1);
+
+ /* add many sub groups to a group*/
+ gid1 = H5Gcreate (fid, "groups", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ add_attrs(gid1, 0);
+ for (i=0; i<ngrps; i++) {
+ /* create sub groups */
+ sprintf(name, "g%02d", i);
+ gid2 = H5Gcreate (gid1, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (i<10) add_attrs(gid2, 0);
+ H5Gclose(gid2);
+ }
+ H5Gclose(gid1);
+
+ /* add many datasets to a group */
+ gid1 = H5Gcreate (fid, "datasets", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ add_attrs(gid1, 0);
+ for (j=0; j<ndsets; j+=12) {
+ /* 1 add a null dataset */
+ sprintf(name, "%05d null dataset", j);
+ did = H5Dcreate (gid1, name, H5T_STD_I32LE, sid_null, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (!j) add_attrs(did, j);
+ H5Dclose(did);
+
+ /* 2 add scalar int point */
+ sprintf(name, "%05d scalar int point", j);
+ did = H5Dcreate (gid1, name, H5T_NATIVE_INT, sid_scalar, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Dwrite (did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &j);
+ if (!j) add_attrs(did, j);
+ H5Dclose(did);
+
+ /* 3 scalar vlen string */
+ sprintf(name, "%05d scalar vlen string", j);
+ did = H5Dcreate (gid1, name, tid_vlen_s, sid_scalar, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Dwrite (did, tid_vlen_s, H5S_ALL, H5S_ALL, H5P_DEFAULT, &buf_vlen_s[0]);
+ if (!j) add_attrs(did, j);
+ H5Dclose(did);
+
+ /* 4 add fixed-length float array */
+ sprintf(name, "%05d fixed-length float array", j);
+ did = H5Dcreate (gid1, name, tid_array_f, sid_1d, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ H5Dwrite (did, tid_array_f, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_float_a);
+ if (!j) add_attrs(did, j);
+ H5Dclose(did);
+
+ /* 5 add fixed-length strings */
+ sprintf(name, "%05d fixed-length strings", j);
+ did = H5Dcreate (gid1, name, tid_str, sid_1d, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ H5Dwrite (did, tid_str, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_str);
+ if (!j) add_attrs(did, j);
+ H5Dclose(did);
+
+ /* 6 add compound data */
+ sprintf(name, "%05d compund data", j);
+ did = H5Dcreate (gid1, name, cmp_tid, sid_1d, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ H5Dwrite (did, cmp_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_comp);
+ if (!j) add_attrs(did, j);
+ H5Dclose(did);
+
+ /* 7 add 2D double */
+ sprintf(name, "%05d 2D double", j);
+ strcpy (tmp_name1, name);
+ did = H5Dcreate (gid1, name, H5T_NATIVE_DOUBLE, sid_2d, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Dwrite (did, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_double2d[0]);
+ if (!j) add_attrs(did, j);
+ H5Dclose(did);
+
+ /* 8 add 1D int array */
+ sprintf(name, "%05d 1D int array", j);
+ did = H5Dcreate (gid1, name, H5T_NATIVE_INT, sid_1d, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ H5Dwrite (did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_int);
+ if (!j) add_attrs(did, j);
+ H5Dclose(did);
+
+ /* 9 add vlen int array */
+ sprintf(name, "%05d vlen int array", j);
+ strcpy (tmp_name2, name);
+ did = H5Dcreate (gid1, name, tid_vlen_i, sid_1d, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ H5Dwrite (did, tid_vlen_i, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_vlen_i);
+ if (!j) add_attrs(did, j);
+ H5Dclose(did);
+
+ /* 10 add vlen strings */
+ sprintf(name, "%05d vlen strings", j);
+ strcpy (tmp_name3, name);
+ did = H5Dcreate (gid1, name, tid_vlen_s, sid_1d, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ H5Dwrite (did, tid_vlen_s, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_vlen_s);
+ if (!j) add_attrs(did, j);
+ H5Dclose(did);
+
+ /* 11 add object refs */
+ H5Rcreate(&buf_ref[0],gid1, ".", H5R_OBJECT, (hid_t)-1);
+ H5Rcreate(&buf_ref[1],gid1, tmp_name3, H5R_OBJECT, (hid_t)-1);
+ sprintf(name, "%05d obj refs", j);
+ did = H5Dcreate (gid1, name, H5T_STD_REF_OBJ, sid_2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Dwrite (did, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_ref);
+ if (!j) add_attrs(did, j);
+ H5Dclose(did);
+
+ /* 12 add region refs */
+ H5Sselect_elements (sid_2d, H5S_SELECT_SET, 4, coords[0]);
+ H5Rcreate(&buf_reg_ref[0],gid1, tmp_name1, H5R_DATASET_REGION, sid_2d);
+ H5Sselect_none(sid_2d);
+ count = dims[0]/2+1;
+ H5Sselect_hyperslab (sid_1d, H5S_SELECT_SET, &start, &stride, &count,NULL);
+ H5Rcreate(&buf_reg_ref[1],gid1, tmp_name2, H5R_DATASET_REGION, sid_1d);
+ H5Sselect_none(sid_1d);
+ sprintf(name, "%05d region refs", j);
+ did = H5Dcreate (gid1, name, H5T_STD_REF_DSETREG, sid_2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Dwrite (did, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_reg_ref);
+ if (!j) add_attrs(did, j);
+ H5Dclose(did);
+ }
+ H5Gclose(gid1);
+
+ H5Tclose (tid_array_f);
+ H5Tclose (tid_vlen_i);
+ H5Tclose (tid_vlen_s);
+ H5Tclose (tid_enum);
+ H5Tclose (tid_str);
+ H5Tclose (cmp_tid);
+ H5Pclose (dcpl);
+ H5Pclose (fapl);
+ H5Sclose (sid_1d);
+ H5Sclose (sid_2d);
+ H5Sclose (sid_2);
+ H5Sclose (sid_large);
+ H5Sclose (sid_null);
+ H5Sclose (sid_scalar);
+ H5Fclose (fid);
+
+ for (i=0; i<dims[0]; i++) {
+ if (buf_vlen_i[i].p) free(buf_vlen_i[i].p);
+ if (buf_vlen_s[i]) free(buf_vlen_s[i]);
+ }
+
+ for (i=0; i<nrows; i++) {
+ if (buf_comp_large[i].i_vlen.p) free(buf_comp_large[i].i_vlen.p);
+ if (buf_comp_large[i].s_vlen) free(buf_comp_large[i].s_vlen);
+ }
+
+ free (buf_comp);
+ free (buf_comp_large);
+ free (buf_int);
+ free (buf_float_a);
+ free (buf_double2d[0]);
+ free (buf_double2d);
+ free (buf_str);
+ free(buf_vlen_i);
+ free(buf_vlen_s);
+
+ return 0;
+}
+
+/* add a single attribute */
+int add_attr(hid_t oid, const char *name, hid_t tid, hid_t sid, void *buf)
+{
+ hid_t aid;
+
+ aid = H5Acreate (oid, name, tid, sid, H5P_DEFAULT, H5P_DEFAULT);
+ if (aid <0)
+ return 0;
+
+ H5Awrite(aid, tid, buf);
+
+ H5Aclose(aid);
+
+ return 1;
+}
+
+/*
+ adds different types of attributes to an object.
+
+ returns the number of attributes added to the objects.
+ */
+int add_attrs(hid_t oid, int idx)
+{
+ char name[32];
+ int i0, i1, i2, j, nattrs=0;
+ hid_t aid, tid, tid1, sid;
+ hvl_t i_vlen[4];
+ hobj_ref_t ref;
+ zipcode_t cmp_data[4];
+ unsigned int i = 0xffffffff;
+ long long l = -2147483647;
+ float f = 123456789.987654321;
+ double d = 987654321.123456789;
+ char *s[7] = {"Parting", "is such", "sweeter", "sorrow."};
+ float f_array[4] = {1.0, 2.22, 3.333, 4.444};
+ char *s_vlen[4] = {"Parting", "is such", "sweet", "sorrow."};
+ hsize_t dims1[1]={1}, dims2[1]={4}, dims3[2]={3,5};
+ int int3d[4][3][5];
+ size_t offset = 0;
+
+ for (i0=0; i0<4; i0++) {
+ i_vlen[i0].len = (i0+1);
+ i_vlen[i0].p = (int *)calloc(i_vlen[i0].len, sizeof(int));
+ for (j=0; j<i_vlen[i0].len; j++)
+ ((int *)i_vlen[i0].p)[j] = i0*100+j;
+ for (i1=0; i1<3; i1++) {
+ for (i2=0; i2<5; i2++)
+ int3d[i0][i1][i2] = i0*i1-i1*i2+i0*i2;
+ }
+ }
+
+ cmp_data[0].zipcode = 01001;
+ cmp_data[0].city = "Agawam, Massachusetts";
+ cmp_data[1].zipcode = 99950;
+ cmp_data[1].city = "Ketchikan, Alaska";
+ cmp_data[2].zipcode = 00501;
+ cmp_data[2].city = "Holtsville, New York";
+ cmp_data[3].zipcode = 61820;
+ cmp_data[3].city = "Champaign, Illinois";
+
+ /* 1 scalar point */
+ sid = H5Screate (H5S_SCALAR);
+ sprintf(name, "%05d scalar int", idx);
+ nattrs += add_attr(oid, name, H5T_NATIVE_UINT, sid, &i);
+ sprintf(name, "%05d scalar ulong", idx);
+ nattrs += add_attr(oid, name, H5T_NATIVE_INT64, sid, &l);
+ sprintf(name, "%05d scalar str", idx);
+ tid = H5Tcopy (H5T_C_S1);
+ H5Tset_size (tid, H5T_VARIABLE);
+ nattrs += add_attr(oid, name, tid, sid, &s[2]);
+ H5Tclose(tid);
+ H5Sclose(sid);
+
+ /* 4 single point */
+ sid = H5Screate_simple (1, dims1, NULL);
+ H5Rcreate(&ref, oid, ".", H5R_OBJECT, (hid_t)-1);
+ sprintf(name, "%05d single float", idx);
+ nattrs += add_attr(oid, name, H5T_NATIVE_FLOAT, sid, &f);
+ sprintf(name, "%05d single double", idx);
+ nattrs += add_attr(oid, name, H5T_NATIVE_DOUBLE, sid, &d);
+ sprintf(name, "%05d single obj_ref", idx);
+ nattrs += add_attr(oid, name, H5T_STD_REF_OBJ, sid, &ref);
+ H5Sclose(sid);
+
+ /* 7 fixed length 1D array */
+ sid = H5Screate_simple (1, dims1, NULL);
+ tid = H5Tarray_create (H5T_NATIVE_FLOAT, 1, dims2);
+ sprintf(name, "%05d array float", idx);
+ nattrs += add_attr(oid, name, tid, sid, &f_array[0]);
+ H5Tclose(tid);
+ tid = H5Tcopy (H5T_C_S1);
+ H5Tset_size (tid, strlen(s[0])+1);
+ tid1 = H5Tarray_create (tid, 1, dims2);
+ sprintf(name, "%05d array str", idx);
+ nattrs += add_attr(oid, name, tid1, sid, s);
+ H5Tclose(tid1);
+ H5Tclose(tid);
+ H5Sclose(sid);
+
+ /* 9 fixed length 2D int arrays */
+ sid = H5Screate_simple (1, dims2, NULL);
+ tid = H5Tarray_create (H5T_NATIVE_INT, 2, dims3);
+ sprintf(name, "%05d array int 2D", idx);
+ nattrs += add_attr(oid, name, tid, sid, int3d[0][0]);
+ H5Tclose(tid);
+ H5Sclose(sid);
+
+ /* 10 variable length arrays */
+ sid = H5Screate_simple (1, dims2, NULL);
+ tid = H5Tcopy (H5T_C_S1);
+ H5Tset_size (tid, H5T_VARIABLE);
+ sprintf(name, "%05d vlen strings", idx);
+ nattrs += add_attr(oid, name, tid, sid, s_vlen);
+ H5Tclose(tid);
+ tid = H5Tvlen_create (H5T_NATIVE_INT);;
+ sprintf(name, "%05d vlen int array", idx);
+ nattrs += add_attr(oid, name, tid, sid, i_vlen);
+ H5Tclose(tid);
+ H5Sclose(sid);
+
+ /* 12 compound data */
+ sid = H5Screate_simple (1, dims2, NULL);
+ tid = H5Tcreate (H5T_COMPOUND, sizeof (zipcode_t));
+ tid1 = H5Tcopy (H5T_C_S1);
+ H5Tset_size (tid1, H5T_VARIABLE);
+ H5Tinsert (tid, "zip code", 0, H5T_NATIVE_INT); offset += sizeof(H5T_NATIVE_INT);
+ H5Tinsert (tid, "City", offset, tid1); offset += sizeof(char *);
+ sprintf(name, "%05d compound data", idx);
+ nattrs += add_attr(oid, name, tid, sid, cmp_data);
+ H5Tclose(tid1);
+ H5Tclose(tid);
+ H5Sclose(sid);
+
+ for (i0=0; i0<4; i0++)
+ free(i_vlen[i0].p);
+
+ return nattrs;
+}
diff --git a/tools/test/misc/h5repart_gentest.c b/tools/test/misc/h5repart_gentest.c
new file mode 100644
index 0000000..8a34694
--- /dev/null
+++ b/tools/test/misc/h5repart_gentest.c
@@ -0,0 +1,101 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Programmer: Raymond Lu<slu@ncsa.uiuc.edu>
+ * June 1, 2005
+ *
+ * Purpose: Generate a family file of 1024 bytes for each member
+ * for h5repart test.
+ */
+#include "hdf5.h"
+#include "H5private.h"
+
+#define FAMILY_NUMBER 4
+#define FAMILY_SIZE 1024
+#define FILENAME "family_file%05d.h5"
+
+static int buf[FAMILY_NUMBER][FAMILY_SIZE];
+
+int main(void)
+{
+ hid_t file=(-1), fapl, space=(-1), dset=(-1);
+ char dname[]="dataset";
+ int i, j;
+ hsize_t dims[2]={FAMILY_NUMBER, FAMILY_SIZE};
+
+ /* Set property list and file name for FAMILY driver */
+ if ((fapl=H5Pcreate(H5P_FILE_ACCESS)) < 0) {
+ perror ("H5Pcreate");
+ exit (EXIT_FAILURE);
+ }
+
+ if(H5Pset_fapl_family(fapl, (hsize_t)FAMILY_SIZE, H5P_DEFAULT) < 0) {
+ perror ("H5Pset_fapl_family");
+ exit (EXIT_FAILURE);
+ }
+
+ if((file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) {
+ perror("H5Fcreate");
+ exit(EXIT_FAILURE);
+ }
+
+ /* Create and write dataset */
+ if((space = H5Screate_simple(2, dims, NULL)) < 0) {
+ perror("H5Screate_simple");
+ exit(EXIT_FAILURE);
+ }
+
+
+ if((dset = H5Dcreate2(file, dname, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
+ perror("H5Dcreate2");
+ exit(EXIT_FAILURE);
+ }
+
+
+ for(i = 0; i<FAMILY_NUMBER; i++)
+ for(j = 0; j<FAMILY_SIZE; j++)
+ buf[i][j] = i * 10000 + j;
+
+ if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) {
+ perror("H5Dwrite");
+ exit(EXIT_FAILURE);
+ }
+
+
+ if(H5Sclose(space) < 0) {
+ perror ("H5Sclose");
+ exit (EXIT_FAILURE);
+ }
+
+ if(H5Dclose(dset) < 0) {
+ perror ("H5Dclose");
+ exit (EXIT_FAILURE);
+ }
+
+ if(H5Pclose(fapl) < 0) {
+ perror ("H5Pclose");
+ exit (EXIT_FAILURE);
+ }
+
+ if(H5Fclose(file) < 0) {
+ perror ("H5Fclose");
+ exit (EXIT_FAILURE);
+ }
+
+ puts(" PASSED"); fflush(stdout);
+
+ return 0;
+}
diff --git a/tools/test/misc/repart_test.c b/tools/test/misc/repart_test.c
new file mode 100644
index 0000000..e6da779
--- /dev/null
+++ b/tools/test/misc/repart_test.c
@@ -0,0 +1,165 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Programmer: Raymond Lu <slu@ncsa.uiuc.edu>
+ * June 1, 2005
+ *
+ * Purpose: This program tests family files after being repartitioned
+ * by h5repart. It simply tries to reopen the files with
+ * correct family driver and member size.
+ */
+#include "hdf5.h"
+
+#define KB 1024
+#define FAMILY_H5REPART_SIZE1 20000
+#define FAMILY_H5REPART_SIZE2 (5*KB)
+#define MAX(a,b) (a>b ? a:b)
+
+const char *FILENAME[] = {
+ "fst_family%05d.h5",
+ "scd_family%05d.h5",
+ "family_to_sec2.h5",
+ NULL
+};
+
+herr_t test_family_h5repart_opens(void);
+herr_t test_sec2_h5repart_opens(void);
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_family_h5repart_opens
+ *
+ * Purpose: Tries to reopen family files.
+ *
+ * Return: Success: exit(0)
+ *
+ * Failure: exit(1)
+ *
+ * Programmer: Raymond Lu
+ * June 1, 2005
+ *
+ * Modifications:
+ *-------------------------------------------------------------------------
+ */
+herr_t
+test_family_h5repart_opens(void)
+{
+ hid_t file=(-1), fapl=(-1);
+
+ /* open 1st file(single member file) with correct family size(20000 byte) */
+ if ((fapl=H5Pcreate(H5P_FILE_ACCESS))<0)
+ goto error;
+
+ if(H5Pset_fapl_family(fapl, (hsize_t)FAMILY_H5REPART_SIZE1, H5P_DEFAULT)<0)
+ goto error;
+
+ if((file=H5Fopen(FILENAME[0], H5F_ACC_RDWR, fapl))<0)
+ goto error;
+
+ if(H5Fclose(file)<0)
+ goto error;
+
+ /* open 2nd file(multiple member files) with correct family size(5KB) */
+ if(H5Pset_fapl_family(fapl, (hsize_t)FAMILY_H5REPART_SIZE2, H5P_DEFAULT)<0)
+ goto error;
+
+ if((file=H5Fopen(FILENAME[1], H5F_ACC_RDWR, fapl))<0)
+ goto error;
+
+ if(H5Fclose(file)<0)
+ goto error;
+
+ return 0;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Fclose(file);
+ } H5E_END_TRY;
+ return -1;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_sec2_h5repart_opens
+ *
+ * Purpose: Tries to reopen a sec2 file.
+ *
+ * Return: Success: exit(0)
+ *
+ * Failure: exit(1)
+ *
+ * Programmer: Raymond Lu
+ * June 21, 2005
+ *
+ * Modifications:
+ *-------------------------------------------------------------------------
+ */
+herr_t
+test_sec2_h5repart_opens(void)
+{
+ hid_t file=(-1);
+
+ /* open the sec2 file */
+ if((file=H5Fopen(FILENAME[2], H5F_ACC_RDWR, H5P_DEFAULT))<0)
+ goto error;
+
+ if(H5Fclose(file)<0)
+ goto error;
+
+ return 0;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Fclose(file);
+ } H5E_END_TRY;
+ return -1;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: main
+ *
+ * Purpose: Tests h5repart-ed family files
+ *
+ * Return: Success: exit(0)
+ *
+ * Failure: exit(1)
+ *
+ * Programmer: Raymond Lu
+ * June 1, 2005
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+main(void)
+{
+ int nerrors=0;
+
+ nerrors += test_family_h5repart_opens()<0 ?1:0;
+ nerrors += test_sec2_h5repart_opens()<0 ?1:0;
+
+ if (nerrors) goto error;
+
+ return 0;
+
+error:
+ nerrors = MAX(1, nerrors);
+ printf("***** %d FAMILY FILE TEST%s FAILED! *****\n",
+ nerrors, 1 == nerrors ? "" : "S");
+ return 1;
+}
diff --git a/tools/test/misc/talign.c b/tools/test/misc/talign.c
new file mode 100644
index 0000000..be373e7
--- /dev/null
+++ b/tools/test/misc/talign.c
@@ -0,0 +1,244 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Small program to illustrate the "misalignment" of members within a compound
+ * datatype, in a datatype fixed by H5Tget_native_type().
+ */
+#include <string.h>
+#include <stdlib.h>
+/*#include <unistd.h> *//* Required for unlink() */
+
+#include "hdf5.h"
+#include "H5private.h"
+#include "h5tools.h"
+
+const char *fname = "talign.h5";
+const char *setname = "align";
+
+/*
+ * This program assumes that there is no extra space between the members 'Ok'
+ * and 'Not Ok', (there shouldn't be because they are of the same atomic type
+ * H5T_NATIVE_FLOAT, and they are placed within the compound next to one
+ * another per construction)
+ */
+
+int main(void)
+{
+ hid_t fil=-1, spc=-1, set=-1;
+ hid_t cs6=-1, cmp=-1, fix=-1;
+ hid_t cmp1=-1, cmp2=-1, cmp3=-1;
+ hid_t plist=-1;
+ hid_t array_dt=-1;
+
+ hsize_t dim[2];
+ hsize_t cdim[4];
+
+ char string5[5];
+ float fok[2] = {1234.0f, 2341.0f};
+ float fnok[2] = {5678.0f, 6785.0f};
+ float *fptr = NULL;
+
+ char *data = NULL;
+
+ int result = 0;
+ herr_t error = 1;
+
+ printf("%-70s", "Testing alignment in compound datatypes");
+
+ strcpy(string5, "Hi!");
+ HDunlink(fname);
+ fil = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ if (fil < 0) {
+ puts("*FAILED*");
+ return 1;
+ }
+
+ H5E_BEGIN_TRY {
+ (void)H5Ldelete(fil, setname, H5P_DEFAULT);
+ } H5E_END_TRY;
+
+ cs6 = H5Tcopy(H5T_C_S1);
+ H5Tset_size(cs6, sizeof(string5));
+ H5Tset_strpad(cs6, H5T_STR_NULLPAD);
+
+ cmp = H5Tcreate(H5T_COMPOUND, sizeof(fok) + sizeof(string5) + sizeof(fnok));
+ H5Tinsert(cmp, "Awkward length", 0, cs6);
+
+ cdim[0] = sizeof(fok) / sizeof(float);
+ array_dt = H5Tarray_create2(H5T_NATIVE_FLOAT, 1, cdim);
+ H5Tinsert(cmp, "Ok", sizeof(string5), array_dt);
+ H5Tclose(array_dt);
+
+ cdim[0] = sizeof(fnok) / sizeof(float);
+ array_dt = H5Tarray_create2(H5T_NATIVE_FLOAT, 1, cdim);
+ H5Tinsert(cmp, "Not Ok", sizeof(fok) + sizeof(string5), array_dt);
+ H5Tclose(array_dt);
+
+ fix = h5tools_get_native_type(cmp);
+
+ cmp1 = H5Tcreate(H5T_COMPOUND, sizeof(fok));
+
+ cdim[0] = sizeof(fok) / sizeof(float);
+ array_dt = H5Tarray_create2(H5T_NATIVE_FLOAT, 1, cdim);
+ H5Tinsert(cmp1, "Ok", 0, array_dt);
+ H5Tclose(array_dt);
+
+ cmp2 = H5Tcreate(H5T_COMPOUND, sizeof(string5));
+ H5Tinsert(cmp2, "Awkward length", 0, cs6);
+
+ cmp3 = H5Tcreate(H5T_COMPOUND, sizeof(fnok));
+
+ cdim[0] = sizeof(fnok) / sizeof(float);
+ array_dt = H5Tarray_create2(H5T_NATIVE_FLOAT, 1, cdim);
+ H5Tinsert(cmp3, "Not Ok", 0, array_dt);
+ H5Tclose(array_dt);
+
+ plist = H5Pcreate(H5P_DATASET_XFER);
+ if((error = H5Pset_preserve(plist, 1)) < 0)
+ goto out;
+
+ /*
+ * Create a small dataset, and write data into it we write each field
+ * in turn so that we are avoid alignment issues at this point
+ */
+ dim[0] = 1;
+ spc = H5Screate_simple(1, dim, NULL);
+ set = H5Dcreate2(fil, setname, cmp, spc, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ H5Dwrite(set, cmp1, spc, H5S_ALL, plist, fok);
+ H5Dwrite(set, cmp2, spc, H5S_ALL, plist, string5);
+ H5Dwrite(set, cmp3, spc, H5S_ALL, plist, fnok);
+
+ H5Dclose(set);
+
+ /* Now open the set, and read it back in */
+ data = (char *)HDmalloc(H5Tget_size(fix));
+
+ if(!data) {
+ perror("malloc() failed");
+ abort();
+ }
+
+ set = H5Dopen2(fil, setname, H5P_DEFAULT);
+
+ H5Dread(set, fix, spc, H5S_ALL, H5P_DEFAULT, data);
+ fptr = (float *)(data + H5Tget_member_offset(fix, 1));
+ H5Dclose(set);
+
+out:
+ if(error < 0) {
+ result = 1;
+ puts("*FAILED - HDF5 library error*");
+ } else if(!(H5_FLT_ABS_EQUAL(fok[0], fptr[0]))
+ || !(H5_FLT_ABS_EQUAL(fok[1], fptr[1]))
+ || !(H5_FLT_ABS_EQUAL(fnok[0], fptr[2]))
+ || !(H5_FLT_ABS_EQUAL(fnok[1], fptr[3]))) {
+ char *mname;
+
+ result = 1;
+ mname = H5Tget_member_name(fix, 0);
+ printf("%14s (%2d) %6s = %s\n",
+ mname ? mname : "(null)", (int)H5Tget_member_offset(fix,0),
+ string5, (char *)(data + H5Tget_member_offset(fix, 0)));
+ if(mname)
+ H5free_memory(mname);
+
+ fptr = (float *)(data + H5Tget_member_offset(fix, 1));
+ mname = H5Tget_member_name(fix, 1);
+ printf("Data comparison:\n"
+ "%14s (%2d) %6f = %f\n"
+ " %6f = %f\n",
+ mname ? mname : "(null)", (int)H5Tget_member_offset(fix,1),
+ (double)fok[0], (double)fptr[0],
+ (double)fok[1], (double)fptr[1]);
+ if(mname)
+ H5free_memory(mname);
+
+ fptr = (float *)(data + H5Tget_member_offset(fix, 2));
+ mname = H5Tget_member_name(fix, 2);
+ printf("%14s (%2d) %6f = %f\n"
+ " %6f = %6f\n",
+ mname ? mname : "(null)", (int)H5Tget_member_offset(fix,2),
+ (double)fnok[0], (double)fptr[0],
+ (double)fnok[1], (double)fptr[1]);
+ if(mname)
+ H5free_memory(mname);
+
+ fptr = (float *)(data + H5Tget_member_offset(fix, 1));
+ printf("\n"
+ "Short circuit\n"
+ " %6f = %f\n"
+ " %6f = %f\n"
+ " %6f = %f\n"
+ " %6f = %f\n",
+ (double)fok[0], (double)fptr[0],
+ (double)fok[1], (double)fptr[1],
+ (double)fnok[0], (double)fptr[2],
+ (double)fnok[1], (double)fptr[3]);
+ puts("*FAILED - compound type alignmnent problem*");
+ } else {
+ puts(" PASSED");
+ }
+
+ if(data)
+ HDfree(data);
+ H5Sclose(spc);
+ H5Tclose(cs6);
+ H5Tclose(cmp);
+ H5Tclose(fix);
+ H5Tclose(cmp1);
+ H5Tclose(cmp2);
+ H5Tclose(cmp3);
+ H5Pclose(plist);
+ H5Fclose(fil);
+ HDunlink(fname);
+ fflush(stdout);
+ return result;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: h5tools_get_native_type
+ *
+ * Purpose: Wrapper around H5Tget_native_type() to work around
+ * Problems with bitfields.
+ *
+ * Return: Success: datatype ID
+ *
+ * Failure: FAIL
+ *
+ * Programmer: Quincey Koziol
+ * Tuesday, October 5, 2004
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+h5tools_get_native_type(hid_t type)
+{
+ hid_t p_type;
+ H5T_class_t type_class;
+
+ type_class = H5Tget_class(type);
+ if(type_class==H5T_BITFIELD)
+ p_type=H5Tcopy(type);
+ else
+ p_type = H5Tget_native_type(type,H5T_DIR_DEFAULT);
+
+ return(p_type);
+}
+
diff --git a/tools/test/misc/testfiles/h5mkgrp_help.txt b/tools/test/misc/testfiles/h5mkgrp_help.txt
new file mode 100644
index 0000000..ba130f6
--- /dev/null
+++ b/tools/test/misc/testfiles/h5mkgrp_help.txt
@@ -0,0 +1,7 @@
+usage: h5mkgrp [OPTIONS] FILE GROUP...
+ OPTIONS
+ -h, --help Print a usage message and exit
+ -l, --latest Use latest version of file format to create groups
+ -p, --parents No error if existing, make parent groups as needed
+ -v, --verbose Print information about OBJECTS and OPTIONS
+ -V, --version Print version number and exit
diff --git a/tools/test/misc/testfiles/h5mkgrp_version.txt.in b/tools/test/misc/testfiles/h5mkgrp_version.txt.in
new file mode 100644
index 0000000..75c13a5
--- /dev/null
+++ b/tools/test/misc/testfiles/h5mkgrp_version.txt.in
@@ -0,0 +1 @@
+h5mkgrp: Version @HDF5_PACKAGE_VERSION_STRING@
diff --git a/tools/test/misc/testh5mkgrp.sh.in b/tools/test/misc/testh5mkgrp.sh.in
new file mode 100644
index 0000000..83ffe16
--- /dev/null
+++ b/tools/test/misc/testh5mkgrp.sh.in
@@ -0,0 +1,325 @@
+#! /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 h5mkgrp tool
+#
+# Quincey Koziol (koziol@hdfgroup.org)
+# Tuesday, February 13, 2007
+#
+
+srcdir=@srcdir@
+
+TESTNAME=h5mkgrp
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+
+H5MKGRP=../../src/misc/h5mkgrp # The tool name
+H5MKGRP_BIN=`pwd`/$H5MKGRP # The path of the tool binary
+H5LS=../../src/h5ls/h5ls # The h5ls tool name
+H5LS_ARGS=-vr # Arguments to the h5ls tool
+H5LS_BIN=`pwd`/$H5LS # The path of the h5ls tool binary
+
+RM='rm -rf'
+CMP='cmp'
+DIFF='diff -c'
+CP='cp'
+DIRNAME='dirname'
+LS='ls'
+AWK='awk'
+
+nerrors=0
+verbose=yes
+
+# source dirs
+SRC_TOOLS="$srcdir/../.."
+
+SRC_TOOLS_TESTFILES="$SRC_TOOLS/testfiles"
+# testfiles source dirs for tools
+SRC_H5MKGRP_TESTFILES="$SRC_TOOLS/test/misc/testfiles"
+
+TESTDIR=./testgrp
+test -d $TESTDIR || mkdir -p $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.
+# --------------------------------------------------------------------
+
+CMP='cmp -s'
+DIFF='diff -c'
+
+#
+# copy test files and expected output files from source dirs to test dir
+#
+COPY_TESTFILES="
+$SRC_H5MKGRP_TESTFILES/h5mkgrp_help.txt
+$SRC_TOOLS_TESTFILES/h5mkgrp_single.ls
+$SRC_TOOLS_TESTFILES/h5mkgrp_single_v.ls
+$SRC_TOOLS_TESTFILES/h5mkgrp_single_p.ls
+$SRC_TOOLS_TESTFILES/h5mkgrp_single_l.ls
+$SRC_TOOLS_TESTFILES/h5mkgrp_several.ls
+$SRC_TOOLS_TESTFILES/h5mkgrp_several_v.ls
+$SRC_TOOLS_TESTFILES/h5mkgrp_several_p.ls
+$SRC_TOOLS_TESTFILES/h5mkgrp_several_l.ls
+$SRC_TOOLS_TESTFILES/h5mkgrp_nested_p.ls
+$SRC_TOOLS_TESTFILES/h5mkgrp_nested_lp.ls
+$SRC_TOOLS_TESTFILES/h5mkgrp_nested_mult_p.ls
+$SRC_TOOLS_TESTFILES/h5mkgrp_nested_mult_lp.ls
+"
+
+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
+ # skip cp if srcdir is same as destdir
+ # this occurs when build/test performed in source dir and
+ # make cp fail
+ SDIR=`$DIRNAME $tstfile`
+ INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
+ INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
+ if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
+ $CP -f $tstfile $TESTDIR
+ if [ $? -ne 0 ]; then
+ echo "Error: FAILED to copy $tstfile ."
+
+ # Comment out this to CREATE expected file
+ exit $EXIT_FAILURE
+ fi
+ fi
+ fi
+ done
+}
+
+CLEAN_TESTFILES_AND_TESTDIR()
+{
+ # skip rm if srcdir is same as destdir
+ # this occurs when build/test performed in source dir and
+ # make cp fail
+ SDIR=$SRC_H5MKGRP_TESTFILES
+ INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
+ INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
+ if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
+ $RM $TESTDIR
+ fi
+}
+
+# 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
+
+# Print a line-line message left justified in a field of 70 characters
+# beginning with the word "Verifying".
+#
+VERIFY_H5LS()
+{
+ SPACES=" "
+ echo "Verifying h5ls file structure $* $SPACES" | cut -c1-70 | tr -d '\012'
+}
+
+# Run a test and print PASS or *FAIL*. If h5mkgrp can complete
+# with exit status 0, consider it pass. If a test fails then increment
+# the `nerrors' global variable.
+# Assumed arguments:
+# $* arguments for h5mkgrp.
+
+TOOLTEST()
+{
+ TESTING $H5MKGRP $@
+ (
+ cd $TESTDIR
+ $RUNSERIAL $H5MKGRP_BIN $@
+ ) > output.out
+ RET=$?
+ if [ $RET != 0 ]; then
+ echo "*FAILED*"
+ echo "failed result is:"
+ cat output.out
+ nerrors="`expr $nerrors + 1`"
+ else
+ echo " PASSED"
+
+ # Clean up output file
+ if test -z "$HDF5_NOCLEANUP"; then
+ rm -f output.out
+ fi
+ fi
+}
+
+# Call the h5ls tool to verify the correct output data in the destination file
+#
+H5LSTEST()
+{
+ expect="$TESTDIR/`basename $1 .h5`.ls"
+ actual="$TESTDIR/`basename $1 .h5`.out"
+ actual_sav=${actual}-sav
+
+ # Stderr is included in stdout so that the diff can detect
+ # any unexpected output from that stream too.
+ VERIFY_H5LS $@
+ (
+ cd $TESTDIR
+ $RUNSERIAL $H5LS_BIN $H5LS_ARGS $@
+ ) 2>&1 |sed 's/Modified:.*/Modified: XXXX-XX-XX XX:XX:XX XXX/' >$actual
+
+ # save actual in case it is needed later.
+ cp $actual $actual_sav
+ STDOUT_FILTER $actual
+ STDERR_FILTER $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 (*.ls) 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_sav
+ fi
+}
+
+# Single run of tool
+#
+# Assumed arguments:
+# $1 is test file name
+# $2 is h5mkgrp options
+# $* are groups to create
+RUNTEST()
+{
+ FILEOUT=$1
+ shift
+ H5MKGRP_ARGS=$1
+ shift
+
+ # Remove any output file left over from previous test run
+ rm -f $FILEOUT
+
+ # Run test
+ TOOLTEST $H5MKGRP_ARGS $FILEOUT $@
+
+ # Verify that the file created above is correct
+ H5LSTEST $FILEOUT
+
+ # Remove output file created, if the "no cleanup" environment variable is
+ # not defined
+ if test -z "$HDF5_NOCLEANUP"; then
+ rm -f $TESTDIR/$FILEOUT
+ fi
+}
+
+# Single run of tool
+#
+# Assumed arguments:
+# $1 is test expected output file
+# $2 is h5mkgrp options
+# $* are groups to create
+CMPTEST()
+{
+ FILEOUT=$1
+ expect="$TESTDIR/`basename $1 .h5`.txt"
+ actual="$TESTDIR/`basename $1 .h5`.out"
+ actual_err="$TESTDIR/`basename $1 .h5`.err"
+ shift
+
+ # Stderr is included in stdout so that the diff can detect
+ # any unexpected output from that stream too.
+ TESTING $H5MKGRP $@
+ (
+ cd $TESTDIR
+ $RUNSERIAL $H5MKGRP_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
+ echo " PASSED"
+ else
+ echo "*FAILED*"
+ echo " Expected result (*.txt) 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
+ fi
+}
+
+##############################################################################
+### T H E T E S T S ###
+##############################################################################
+# prepare for test
+COPY_TESTFILES_TO_TESTDIR
+
+# Check that help & version is displayed properly
+CMPTEST h5mkgrp_help.h5 "-h"
+#CMPTEST h5mkgrp_version.h5 "-V"
+
+# Create single group at root level
+RUNTEST h5mkgrp_single.h5 " " single
+RUNTEST h5mkgrp_single_v.h5 "-v" single
+RUNTEST h5mkgrp_single_p.h5 "-p" single
+RUNTEST h5mkgrp_single_l.h5 "-l" latest
+
+# Create several groups at root level
+RUNTEST h5mkgrp_several.h5 " " one two
+RUNTEST h5mkgrp_several_v.h5 "-v" one two
+RUNTEST h5mkgrp_several_p.h5 "-p" one two
+RUNTEST h5mkgrp_several_l.h5 "-l" one two
+
+# Create various nested groups
+RUNTEST h5mkgrp_nested_p.h5 "-p" /one/two
+RUNTEST h5mkgrp_nested_lp.h5 "-lp" /one/two
+RUNTEST h5mkgrp_nested_mult_p.h5 "-p" /one/two /three/four
+RUNTEST h5mkgrp_nested_mult_lp.h5 "-lp" /one/two /three/four
+
+# Clean up temporary files/directories
+CLEAN_TESTFILES_AND_TESTDIR
+
+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/test/misc/testh5repart.sh.in b/tools/test/misc/testh5repart.sh.in
new file mode 100644
index 0000000..0bce3a7
--- /dev/null
+++ b/tools/test/misc/testh5repart.sh.in
@@ -0,0 +1,116 @@
+#! /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 h5repart tool
+
+srcdir=@srcdir@
+
+TESTNAME=h5repart
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+
+REPART=../../src/misc/h5repart # The tool name
+REPART_BIN=`pwd`/$REPART # The path of the tool binary
+
+REPARTED_FAM=repart_test # The test name
+REPARTED_FAM_BIN=`pwd`/$REPARTED_FAM # The path of the test binary
+
+nerrors=0
+verbose=yes
+
+test -d ../testfiles || mkdir ../testfiles
+
+actual_dir=`pwd`/../testfiles
+
+# 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'
+}
+
+# Run a test and print PASS or *FAIL*. If a test fails then increment
+# the `nerrors' global variable.
+#
+TOOLTEST() {
+ # Run tool test.
+ TESTING $REPART $@
+ (
+# echo
+ cd $srcdir/../testfiles
+ $RUNSERIAL $REPART_BIN $@
+ )
+
+ if test $? -eq 0; then
+ echo " PASSED"
+ else
+ echo " FAILED"
+ nerrors=`expr $nerrors + 1`
+ fi
+}
+
+OUTPUTTEST() {
+ # Run test program.
+ TESTING $REPARTED_FAM $@
+ (
+ cd $actual_dir
+ $RUNSERIAL $REPARTED_FAM_BIN $@
+ )
+
+ if test $? -eq 0; then
+ echo " PASSED"
+ else
+ echo " FAILED"
+ nerrors=`expr $nerrors + 1`
+ fi
+}
+
+# Print a "SKIP" message
+SKIP() {
+ TESTING $REPART $@
+ echo " -SKIP-"
+}
+
+##############################################################################
+##############################################################################
+### T H E T E S T S ###
+##############################################################################
+##############################################################################
+
+# repartition family member size to 20,000 bytes.
+TOOLTEST -m 20000 family_file%05d.h5 $actual_dir/fst_family%05d.h5
+# repartition family member size to 5 KB.
+TOOLTEST -m 5k family_file%05d.h5 $actual_dir/scd_family%05d.h5
+# convert family file to sec2 file of 20,000 bytes
+TOOLTEST -m 20000 -family_to_sec2 family_file%05d.h5 $actual_dir/family_to_sec2.h5
+
+# test the output files repartitioned above.
+OUTPUTTEST
+echo
+
+# Clean up output file
+if test -z "$HDF5_NOCLEANUP"; then
+ cd $actual_dir
+ rm -f fst_family*.h5 scd_family*.h5 family_to_sec2.h5
+fi
+
+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/test/misc/vds/CMakeLists.txt b/tools/test/misc/vds/CMakeLists.txt
new file mode 100644
index 0000000..cd9e2c7
--- /dev/null
+++ b/tools/test/misc/vds/CMakeLists.txt
@@ -0,0 +1,28 @@
+cmake_minimum_required (VERSION 3.1.0)
+PROJECT (HDF5_TOOLS_TEST_MISC_VDS)
+
+#-----------------------------------------------------------------------------
+# Setup include Directories
+#-----------------------------------------------------------------------------
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_TEST_SRC_DIR}/lib)
+
+MACRO (ADD_H5_GENERATOR genfile)
+ add_executable (${genfile} ${HDF5_TOOLS_TEST_MISC_VDS_SOURCE_DIR}/${genfile}.c)
+ TARGET_NAMING (${genfile} STATIC)
+ TARGET_C_PROPERTIES (${genfile} STATIC " " " ")
+ target_link_libraries (${genfile} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+ set_target_properties (${genfile} PROPERTIES FOLDER generator/tools)
+ENDMACRO (ADD_H5_GENERATOR genfile)
+
+# generator executables
+set (H5_GENERATORS
+ UC_1_one_dim_gen
+ UC_2_two_dims_gen
+ UC_3_gaps_gen
+ UC_4_printf_gen
+ UC_5_stride_gen
+)
+
+foreach (gen ${H5_GENERATORS})
+ ADD_H5_GENERATOR (${gen})
+endforeach (gen ${H5_GENERATORS})
diff --git a/tools/test/misc/vds/Makefile.am b/tools/test/misc/vds/Makefile.am
new file mode 100644
index 0000000..89aed64
--- /dev/null
+++ b/tools/test/misc/vds/Makefile.am
@@ -0,0 +1,38 @@
+#
+# 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.
+##
+## Makefile.am
+## Run automake to generate a Makefile.in from this file.
+#
+# HDF5 Library Makefile(.in)
+#
+
+include $(top_srcdir)/config/commence.am
+
+# Include src directory
+AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib -I$(top_srcdir)/tools/test/misc/vds
+
+#test scripts and programs
+TEST_PROG=UC_1_one_dim_gen UC_2_two_dims_gen UC_3_gaps_gen UC_4_printf_gen \
+ UC_5_stride_gen
+
+check_PROGRAMS=$(TEST_PROG)
+
+# Temporary files.
+CHECK_CLEANFILES+=*.h5
+
+# All programs rely on hdf5 library and h5tools library
+LDADD=$(LIBH5TOOLS) $(LIBHDF5)
+
+include $(top_srcdir)/config/conclude.am
diff --git a/tools/test/misc/vds/UC_1.h b/tools/test/misc/vds/UC_1.h
new file mode 100644
index 0000000..2150cfa
--- /dev/null
+++ b/tools/test/misc/vds/UC_1.h
@@ -0,0 +1,121 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifndef UC_1_H
+#define UC_1_H
+
+#include "hdf5.h"
+
+#include "UC_common.h"
+
+/*
+ * Definitions for VDS use case 1
+ *
+ * Datasets have a single unlimited dimension and two fixed dimensions. They
+ * are mapped along a single dimension in the VDS with no gaps between them.
+ */
+
+/* virtual dataset <---> source dataset mapping and sizes
+
+ ***************** --+
+ * A * K
+ ***************** --+
+ * * |
+ * B * N
+ * * |
+ ***************** --+
+ * C *
+ *****************
+ * *
+ * D *
+ * *
+ *****************
+ * E *
+ *****************
+ * *
+ * F *
+ * *
+ *****************
+
+ | |
+ +-------M-------+
+
+
+ dim[0]
+ /
+ /
+ /
+ -----> dim[2]
+ |
+ |
+ |
+ dim[1]
+
+ */
+
+
+#define UC_1_N_SOURCES 6
+
+/* Dataset dimensions */
+#define UC_1_SM_HEIGHT 2 /* K */
+#define UC_1_LG_HEIGHT 4 /* N */
+#define UC_1_SM_LG_HEIGHT 6 /* SM_HEIGHT + LG_HEIGHT */
+#define UC_1_FULL_HEIGHT 18 /* (3 * K) + (3 * N) */
+#define UC_1_HALF_HEIGHT 9
+#define UC_1_WIDTH 8 /* M */
+#define UC_1_HALF_WIDTH 4
+
+#define UC_1_N_MAX_PLANES H5S_UNLIMITED /* max number of planes */
+#define UC_1_N_TEST_PLANES 5 /* number of planes we write */
+
+/* Dataset datatypes */
+#define UC_1_SOURCE_DATATYPE H5T_STD_I32LE
+#define UC_1_VDS_DATATYPE H5T_STD_I32LE
+
+/* Starting size of datasets, both source and VDS */
+static hsize_t UC_1_DIMS[UC_1_N_SOURCES][RANK] = {
+ {0, UC_1_SM_HEIGHT, UC_1_WIDTH},
+ {0, UC_1_LG_HEIGHT, UC_1_WIDTH},
+ {0, UC_1_SM_HEIGHT, UC_1_WIDTH},
+ {0, UC_1_LG_HEIGHT, UC_1_WIDTH},
+ {0, UC_1_SM_HEIGHT, UC_1_WIDTH},
+ {0, UC_1_LG_HEIGHT, UC_1_WIDTH}
+};
+
+/* Maximum size of datasets, both source and VDS */
+static hsize_t UC_1_MAX_DIMS[UC_1_N_SOURCES][RANK] = {
+ {UC_1_N_MAX_PLANES, UC_1_SM_HEIGHT, UC_1_WIDTH},
+ {UC_1_N_MAX_PLANES, UC_1_LG_HEIGHT, UC_1_WIDTH},
+ {UC_1_N_MAX_PLANES, UC_1_SM_HEIGHT, UC_1_WIDTH},
+ {UC_1_N_MAX_PLANES, UC_1_LG_HEIGHT, UC_1_WIDTH},
+ {UC_1_N_MAX_PLANES, UC_1_SM_HEIGHT, UC_1_WIDTH},
+ {UC_1_N_MAX_PLANES, UC_1_LG_HEIGHT, UC_1_WIDTH}
+};
+
+/* File names for source datasets */
+static char UC_1_FILE_NAMES[UC_1_N_SOURCES][NAME_LEN] = {
+ {"1_a.h5"},
+ {"1_b.h5"},
+ {"1_c.h5"},
+ {"1_d.h5"},
+ {"1_e.h5"},
+ {"1_f.h5"}
+};
+
+/* Dataset names */
+static char UC_1_SOURCE_DSET_PATH[NAME_LEN] = "/source_dset";
+
+#endif /* UC_1_H */
+
diff --git a/tools/test/misc/vds/UC_1_one_dim_gen.c b/tools/test/misc/vds/UC_1_one_dim_gen.c
new file mode 100644
index 0000000..f47b982
--- /dev/null
+++ b/tools/test/misc/vds/UC_1_one_dim_gen.c
@@ -0,0 +1,269 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * File/dataset generator for VDS use case 1
+ *
+ * See the header file for a description.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "hdf5.h"
+
+#include "UC_common.h"
+#include "UC_1.h"
+
+static hsize_t UC_1_VDS_DIMS[RANK] = {0, UC_1_FULL_HEIGHT, UC_1_WIDTH};
+static hsize_t UC_1_VDS_MAX_DIMS[RANK] = {UC_1_N_MAX_PLANES, UC_1_FULL_HEIGHT, UC_1_WIDTH};
+
+/* Planes */
+static hsize_t UC_1_PLANES[UC_1_N_SOURCES][RANK] = {
+ {1, UC_1_SM_HEIGHT, UC_1_WIDTH},
+ {1, UC_1_LG_HEIGHT, UC_1_WIDTH},
+ {1, UC_1_SM_HEIGHT, UC_1_WIDTH},
+ {1, UC_1_LG_HEIGHT, UC_1_WIDTH},
+ {1, UC_1_SM_HEIGHT, UC_1_WIDTH},
+ {1, UC_1_LG_HEIGHT, UC_1_WIDTH}
+};
+
+/* VDS file name */
+static char UC_1_VDS_FILE_NAME[NAME_LEN] = "1_vds.h5";
+
+/* Dataset names */
+static char UC_1_SOURCE_DSET_NAME[NAME_LEN] = "source_dset";
+static char UC_1_VDS_DSET_NAME[NAME_LEN] = "vds_dset";
+
+/* Fill values */
+static int UC_1_FILL_VALUES[UC_1_N_SOURCES] = {
+ -1,
+ -2,
+ -3,
+ -4,
+ -5,
+ -6
+};
+static int UC_1_VDS_FILL_VALUE = -9;
+
+int
+main(void)
+{
+ hid_t src_sid = -1; /* source dataset's dataspace ID */
+ hid_t src_dcplid = -1; /* source dataset property list ID */
+
+ hid_t vds_sid = -1; /* VDS dataspace ID */
+ hid_t vds_dcplid = -1; /* VDS dataset property list ID */
+
+ hid_t fid = -1; /* HDF5 file ID */
+ hid_t did = -1; /* dataset ID */
+ hid_t msid = -1; /* memory dataspace ID */
+ hid_t fsid = -1; /* file dataspace ID */
+
+ hsize_t extent[RANK]; /* dataset extents */
+ hsize_t start[RANK]; /* starting point for hyperslab */
+ hsize_t map_start = 0; /* starting point in the VDS map */
+
+ int *buffer = NULL; /* data buffer */
+ hsize_t count = 0; /* number of elements in a plane */
+ int n_planes = -1; /* number of planes to write */
+ int value = -1; /* value written to datasets */
+
+ int i; /* iterator */
+ int j; /* iterator */
+ hsize_t k; /* iterator */
+
+
+ /* Start by creating the virtual dataset (VDS) dataspace and creation
+ * property list. The individual source datasets are then created
+ * and the VDS map (stored in the VDS property list) is updated.
+ */
+
+ /* Create VDS dcpl */
+ if((vds_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ UC_ERROR
+ if(H5Pset_fill_value(vds_dcplid, UC_1_VDS_DATATYPE,
+ &UC_1_VDS_FILL_VALUE) < 0)
+ UC_ERROR
+
+ /* Create VDS dataspace */
+ if((vds_sid = H5Screate_simple(RANK, UC_1_VDS_DIMS,
+ UC_1_VDS_MAX_DIMS)) < 0)
+ UC_ERROR
+
+ /************************************
+ * Create source files and datasets *
+ ************************************/
+
+ start[0] = 0;
+ start[1] = 0;
+ start[2] = 0;
+ map_start = 0;
+
+ for(i = 0; i < UC_1_N_SOURCES; i++) {
+
+ /* Create source dataset dcpl */
+ if((src_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ UC_ERROR
+ if(H5Pset_chunk(src_dcplid, RANK, UC_1_PLANES[i]) < 0)
+ UC_ERROR
+ if(H5Pset_fill_value(src_dcplid, UC_1_SOURCE_DATATYPE,
+ &UC_1_FILL_VALUES[i]) < 0)
+ UC_ERROR
+ if(0 != i % 2)
+ if(H5Pset_deflate(src_dcplid, COMPRESSION_LEVEL) < 0)
+ UC_ERROR
+
+ /* Create source file, dataspace, and dataset */
+ if((fid = H5Fcreate(UC_1_FILE_NAMES[i], H5F_ACC_TRUNC,
+ H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ UC_ERROR
+ if((src_sid = H5Screate_simple(RANK, UC_1_DIMS[i],
+ UC_1_MAX_DIMS[i])) < 0)
+ UC_ERROR
+ if((did = H5Dcreate2(fid, UC_1_SOURCE_DSET_NAME,
+ UC_1_SOURCE_DATATYPE, src_sid,
+ H5P_DEFAULT, src_dcplid, H5P_DEFAULT)) < 0)
+ UC_ERROR
+
+ /* Set the dataset's extent (will eventually vary with i) */
+ extent[0] = UC_1_N_TEST_PLANES;
+ extent[1] = UC_1_PLANES[i][1];
+ extent[2] = UC_1_PLANES[i][2];
+ if(H5Dset_extent(did, extent) < 0)
+ UC_ERROR
+
+ /* Create a data buffer that represents a plane */
+ count = UC_1_PLANES[i][1] * UC_1_PLANES[i][2];
+ if(NULL == (buffer = (int *)malloc(count * sizeof(int))))
+ UC_ERROR
+
+ /* Create the memory dataspace */
+ if((msid = H5Screate_simple(RANK, UC_1_PLANES[i], NULL)) < 0)
+ UC_ERROR
+
+ /* Get the file dataspace */
+ if((fsid = H5Dget_space(did)) < 0)
+ UC_ERROR
+
+ /* Write planes to the dataset, number will eventually vary with i */
+ n_planes = UC_1_N_TEST_PLANES;
+ for(j = 0; j < n_planes; j++) {
+
+ value = ((i + 1) * 10) + j;
+ for(k = 0; k < count; k++)
+ buffer[k] = value;
+
+ start[0] = (hsize_t)j;
+ start[1] = 0;
+ start[2] = 0;
+ if(H5Sselect_hyperslab(fsid, H5S_SELECT_SET, start, NULL, UC_1_PLANES[i], NULL) < 0)
+ UC_ERROR
+ if(H5Dwrite(did, H5T_NATIVE_INT, msid, fsid, H5P_DEFAULT, buffer) < 0)
+ UC_ERROR
+
+ } /* end for */
+
+ /* set up hyperslabs for source and destination datasets */
+ start[0] = 0;
+ start[1] = 0;
+ start[2] = 0;
+ if(H5Sselect_hyperslab(src_sid, H5S_SELECT_SET, start, NULL,
+ UC_1_MAX_DIMS[i], NULL) < 0)
+ UC_ERROR
+ start[0] = 0;
+ start[1] = map_start;
+ start[2] = 0;
+ if(H5Sselect_hyperslab(vds_sid, H5S_SELECT_SET, start, NULL,
+ UC_1_MAX_DIMS[i], NULL) < 0)
+ UC_ERROR
+ map_start += UC_1_PLANES[i][1];
+
+ /* Add VDS mapping */
+ if(H5Pset_virtual(vds_dcplid, vds_sid, UC_1_FILE_NAMES[i],
+ UC_1_SOURCE_DSET_PATH, src_sid) < 0)
+ UC_ERROR
+
+ /* close */
+ if(H5Sclose(src_sid) < 0)
+ UC_ERROR
+ if(H5Pclose(src_dcplid) < 0)
+ UC_ERROR
+ if(H5Sclose(msid) < 0)
+ UC_ERROR
+ if(H5Sclose(fsid) < 0)
+ UC_ERROR
+ if(H5Dclose(did) < 0)
+ UC_ERROR
+ if(H5Fclose(fid) < 0)
+ UC_ERROR
+ free(buffer);
+
+ } /* end for */
+
+
+ /*******************
+ * Create VDS file *
+ *******************/
+
+ /* file */
+ if((fid = H5Fcreate(UC_1_VDS_FILE_NAME, H5F_ACC_TRUNC,
+ H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ UC_ERROR
+
+ /* dataset */
+ if((did = H5Dcreate2(fid, UC_1_VDS_DSET_NAME, UC_1_VDS_DATATYPE, vds_sid,
+ H5P_DEFAULT, vds_dcplid, H5P_DEFAULT)) < 0)
+ UC_ERROR
+
+ /* close */
+ if(H5Pclose(vds_dcplid) < 0)
+ UC_ERROR
+ if(H5Sclose(vds_sid) < 0)
+ UC_ERROR
+ if(H5Dclose(did) < 0)
+ UC_ERROR
+ if(H5Fclose(fid) < 0)
+ UC_ERROR
+
+ return EXIT_SUCCESS;
+
+error:
+
+ H5E_BEGIN_TRY {
+ if(src_sid >= 0)
+ (void)H5Sclose(src_sid);
+ if(src_dcplid >= 0)
+ (void)H5Pclose(src_dcplid);
+ if(vds_sid >= 0)
+ (void)H5Sclose(vds_sid);
+ if(vds_dcplid >= 0)
+ (void)H5Pclose(vds_dcplid);
+ if(fid >= 0)
+ (void)H5Fclose(fid);
+ if(did >= 0)
+ (void)H5Dclose(did);
+ if(msid >= 0)
+ (void)H5Sclose(msid);
+ if(fsid >= 0)
+ (void)H5Sclose(fsid);
+ if(buffer != NULL)
+ free(buffer);
+ } H5E_END_TRY
+
+ return EXIT_FAILURE;
+
+} /* end main */
+
diff --git a/tools/test/misc/vds/UC_2.h b/tools/test/misc/vds/UC_2.h
new file mode 100644
index 0000000..fe3f350
--- /dev/null
+++ b/tools/test/misc/vds/UC_2.h
@@ -0,0 +1,110 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifndef UC_2_H
+#define UC_2_H
+
+#include "hdf5.h"
+
+/*
+ * Definitions for VDS use case 2
+ *
+ * Datasets have a single unlimited dimension and two fixed dimensions. They
+ * are mapped along two dimensions in the VDS with no gaps between them.
+ */
+
+/* virtual dataset <---> source dataset mapping and sizes
+
+ **********************************
+ * A * *
+ ***************** D *
+ * * *
+ * B * *
+ * ******************
+ ***************** E *
+ * C * *
+ **********************************
+
+
+ dim[0]
+ /
+ /
+ /
+ -----> dim[2]
+ |
+ |
+ |
+ dim[1]
+
+ */
+
+#define UC_2_N_SOURCES 5
+
+/* Dataset dimensions */
+#define UC_2_A_HEIGHT 2
+#define UC_2_B_HEIGHT 4
+#define UC_2_AB_HEIGHT 6 /* For hyperslab start position */
+#define UC_2_C_HEIGHT 2
+#define UC_2_D_HEIGHT 5
+#define UC_2_E_HEIGHT 3
+#define UC_2_FULL_HEIGHT 8 /* A+B+C and D+E */
+#define UC_2_WIDTH 7
+#define UC_2_FULL_WIDTH 14 /* 2*width */
+
+#define UC_2_N_PLANES_IN_SERIES 3 /* number of planes in a series of sub-images */
+#define UC_2_N_MAX_PLANES H5S_UNLIMITED /* max number of planes */
+#define UC_2_N_TEST_PLANES 6 /* number of planes we write */
+
+/* Dataset datatypes */
+#define UC_2_SOURCE_DATATYPE H5T_STD_I32LE
+#define UC_2_VDS_DATATYPE H5T_STD_I32LE
+
+/* Starting size of datasets, both source and VDS */
+static hsize_t UC_2_DIMS[UC_2_N_SOURCES][RANK] = {
+ {0, UC_2_A_HEIGHT, UC_2_WIDTH},
+ {0, UC_2_B_HEIGHT, UC_2_WIDTH},
+ {0, UC_2_C_HEIGHT, UC_2_WIDTH},
+ {0, UC_2_D_HEIGHT, UC_2_WIDTH},
+ {0, UC_2_E_HEIGHT, UC_2_WIDTH}
+};
+
+/* Maximum size of datasets, both source and VDS */
+static hsize_t UC_2_MAX_DIMS[UC_2_N_SOURCES][RANK] = {
+ {UC_2_N_MAX_PLANES, UC_2_A_HEIGHT, UC_2_WIDTH},
+ {UC_2_N_MAX_PLANES, UC_2_B_HEIGHT, UC_2_WIDTH},
+ {UC_2_N_MAX_PLANES, UC_2_C_HEIGHT, UC_2_WIDTH},
+ {UC_2_N_MAX_PLANES, UC_2_D_HEIGHT, UC_2_WIDTH},
+ {UC_2_N_MAX_PLANES, UC_2_E_HEIGHT, UC_2_WIDTH}
+};
+
+/* File names for source datasets */
+static char UC_2_FILE_NAMES[UC_2_N_SOURCES][NAME_LEN] = {
+ {"2_a.h5"},
+ {"2_b.h5"},
+ {"2_c.h5"},
+ {"2_d.h5"},
+ {"2_e.h5"}
+};
+
+/* VDS file name */
+#define UC_2_VDS_FILE_NAME "2_vds.h5"
+
+/* Dataset names */
+#define UC_2_SOURCE_DSET_NAME "source_dset"
+#define UC_2_SOURCE_DSET_PATH "/source_dset"
+#define UC_2_VDS_DSET_NAME "vds_dset"
+
+#endif /* UC_2_H */
+
diff --git a/tools/test/misc/vds/UC_2_two_dims_gen.c b/tools/test/misc/vds/UC_2_two_dims_gen.c
new file mode 100644
index 0000000..d08cc5f
--- /dev/null
+++ b/tools/test/misc/vds/UC_2_two_dims_gen.c
@@ -0,0 +1,270 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * File/dataset generator for VDS use case 2
+ *
+ * See the header file for a description.
+ */
+
+
+#include <stdlib.h>
+
+#include "hdf5.h"
+
+#include "UC_common.h"
+#include "UC_2.h"
+
+static hsize_t UC_2_VDS_DIMS[RANK] = {0, UC_2_FULL_HEIGHT, UC_2_FULL_WIDTH};
+static hsize_t UC_2_VDS_MAX_DIMS[RANK] = {UC_2_N_MAX_PLANES, UC_2_FULL_HEIGHT, UC_2_FULL_WIDTH};
+
+/* Positions of source datasets in the VDS */
+static hsize_t UC_2_POSITIONS[UC_2_N_SOURCES][RANK] = {
+ /* A */ {0, 0, 0},
+ /* B */ {0, UC_2_A_HEIGHT, 0},
+ /* C */ {0, UC_2_AB_HEIGHT, 0},
+ /* D */ {0, 0, UC_2_WIDTH},
+ /* E */ {0, UC_2_D_HEIGHT, UC_2_WIDTH}
+};
+
+/* Planes */
+static hsize_t UC_2_PLANES[UC_2_N_SOURCES][RANK] = {
+ {1, UC_2_A_HEIGHT, UC_2_WIDTH},
+ {1, UC_2_B_HEIGHT, UC_2_WIDTH},
+ {1, UC_2_C_HEIGHT, UC_2_WIDTH},
+ {1, UC_2_D_HEIGHT, UC_2_WIDTH},
+ {1, UC_2_E_HEIGHT, UC_2_WIDTH}
+};
+
+/* Chunk dimensions */
+static hsize_t UC_2_CHUNK_DIMS[UC_2_N_SOURCES][RANK] = {
+ {UC_2_N_PLANES_IN_SERIES, UC_2_A_HEIGHT, UC_2_WIDTH},
+ {UC_2_N_PLANES_IN_SERIES, UC_2_B_HEIGHT, UC_2_WIDTH},
+ {UC_2_N_PLANES_IN_SERIES, UC_2_C_HEIGHT, UC_2_WIDTH},
+ {UC_2_N_PLANES_IN_SERIES, UC_2_D_HEIGHT, UC_2_WIDTH},
+ {UC_2_N_PLANES_IN_SERIES, UC_2_E_HEIGHT, UC_2_WIDTH}
+};
+
+/* Fill values */
+static int UC_2_FILL_VALUES[UC_2_N_SOURCES] = {
+ -1,
+ -2,
+ -3,
+ -4,
+ -5
+};
+static int UC_2_VDS_FILL_VALUE = -9;
+
+int
+main(void)
+{
+ hid_t src_sid = -1; /* source dataset's dataspace ID */
+ hid_t src_dcplid = -1; /* source dataset property list ID */
+
+ hid_t vds_sid = -1; /* VDS dataspace ID */
+ hid_t vds_dcplid = -1; /* VDS dataset property list ID */
+
+ hid_t fid = -1; /* HDF5 file ID */
+ hid_t did = -1; /* dataset ID */
+ hid_t msid = -1; /* memory dataspace ID */
+ hid_t fsid = -1; /* file dataspace ID */
+
+ hsize_t start[RANK]; /* starting point for hyperslab */
+ hsize_t extent[RANK]; /* dataset extents */
+
+ int *buffer = NULL; /* data buffer */
+ int value = -1; /* value written to datasets */
+ hsize_t count = 0; /* number of elements in a plane */
+ int n_planes = -1; /* number of planes to write */
+
+ int i; /* iterator */
+ int j; /* iterator */
+ hsize_t k; /* iterator */
+
+
+ /* Start by creating the virtual dataset (VDS) dataspace and creation
+ * property list. The individual source datasets are then created
+ * and the VDS map (stored in the VDS property list) is updated.
+ */
+
+ /* Create VDS dcpl */
+ if((vds_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ UC_ERROR
+ if(H5Pset_fill_value(vds_dcplid, UC_2_VDS_DATATYPE,
+ &UC_2_VDS_FILL_VALUE) < 0)
+ UC_ERROR
+
+ /* Create VDS dataspace */
+ if((vds_sid = H5Screate_simple(RANK, UC_2_VDS_DIMS,
+ UC_2_VDS_MAX_DIMS)) < 0)
+ UC_ERROR
+
+ /************************************
+ * Create source files and datasets *
+ ************************************/
+
+ start[0] = 0;
+ start[1] = 0;
+ start[2] = 0;
+
+ for(i = 0; i < UC_2_N_SOURCES; i++) {
+
+ /* source dataset dcpl */
+ if((src_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ UC_ERROR
+ if(H5Pset_chunk(src_dcplid, RANK, UC_2_CHUNK_DIMS[i]) < 0)
+ UC_ERROR
+ if(H5Pset_fill_value(src_dcplid, UC_2_SOURCE_DATATYPE,
+ &UC_2_FILL_VALUES[i]) < 0)
+ UC_ERROR
+ if(H5Pset_deflate(src_dcplid, COMPRESSION_LEVEL) < 0)
+ UC_ERROR
+
+ /* Create source file, dataspace, and dataset */
+ if((fid = H5Fcreate(UC_2_FILE_NAMES[i], H5F_ACC_TRUNC,
+ H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ UC_ERROR
+ if((src_sid = H5Screate_simple(RANK, UC_2_DIMS[i],
+ UC_2_MAX_DIMS[i])) < 0)
+ UC_ERROR
+ if((did = H5Dcreate2(fid, UC_2_SOURCE_DSET_NAME,
+ UC_2_SOURCE_DATATYPE, src_sid,
+ H5P_DEFAULT, src_dcplid, H5P_DEFAULT)) < 0)
+ UC_ERROR
+
+ /* Set the dataset's extent (will eventually vary with i) */
+ extent[0] = UC_2_N_TEST_PLANES;
+ extent[1] = UC_2_PLANES[i][1];
+ extent[2] = UC_2_PLANES[i][2];
+ if(H5Dset_extent(did, extent) < 0)
+ UC_ERROR
+
+ /* Create a data buffer that represents a plane */
+ count = UC_2_PLANES[i][1] * UC_2_PLANES[i][2];
+ if(NULL == (buffer = (int *)malloc(count * sizeof(int))))
+ UC_ERROR
+
+ /* Create the memory dataspace */
+ if((msid = H5Screate_simple(RANK, UC_2_PLANES[i], NULL)) < 0)
+ UC_ERROR
+
+ /* Get the file dataspace */
+ if((fsid = H5Dget_space(did)) < 0)
+ UC_ERROR
+
+ /* Write planes to the dataset, number will eventually vary with i */
+ n_planes = UC_2_N_TEST_PLANES;
+ for(j = 0; j < n_planes; j++) {
+
+ value = ((i + 1) * 10) + j;
+ for(k = 0; k < count; k++)
+ buffer[k] = value;
+
+ start[0] = (hsize_t)j;
+ start[1] = 0;
+ start[2] = 0;
+ if(H5Sselect_hyperslab(fsid, H5S_SELECT_SET, start, NULL, UC_2_PLANES[i], NULL) < 0)
+ UC_ERROR
+ if(H5Dwrite(did, H5T_NATIVE_INT, msid, fsid, H5P_DEFAULT, buffer) < 0)
+ UC_ERROR
+
+ } /* end for */
+
+ /* set up hyperslabs for source and destination datasets */
+ start[0] = 0;
+ start[1] = 0;
+ start[2] = 0;
+ if(H5Sselect_hyperslab(src_sid, H5S_SELECT_SET, start, NULL,
+ UC_2_MAX_DIMS[i], NULL) < 0)
+ UC_ERROR
+ if(H5Sselect_hyperslab(vds_sid, H5S_SELECT_SET, UC_2_POSITIONS[i], NULL,
+ UC_2_MAX_DIMS[i], NULL) < 0)
+ UC_ERROR
+
+ /* Add VDS mapping */
+ if(H5Pset_virtual(vds_dcplid, vds_sid, UC_2_FILE_NAMES[i],
+ UC_2_SOURCE_DSET_PATH, src_sid) < 0)
+ UC_ERROR
+
+ /* close */
+ if(H5Sclose(msid) < 0)
+ UC_ERROR
+ if(H5Sclose(fsid) < 0)
+ UC_ERROR
+ if(H5Sclose(src_sid) < 0)
+ UC_ERROR
+ if(H5Pclose(src_dcplid) < 0)
+ UC_ERROR
+ if(H5Dclose(did) < 0)
+ UC_ERROR
+ if(H5Fclose(fid) < 0)
+ UC_ERROR
+ free(buffer);
+
+ } /* end for */
+
+ /*******************************
+ * Create VDS file and dataset *
+ *******************************/
+
+ /* file */
+ if((fid = H5Fcreate(UC_2_VDS_FILE_NAME, H5F_ACC_TRUNC,
+ H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ UC_ERROR
+
+ /* dataset */
+ if((did = H5Dcreate2(fid, UC_2_VDS_DSET_NAME, UC_2_VDS_DATATYPE, vds_sid,
+ H5P_DEFAULT, vds_dcplid, H5P_DEFAULT)) < 0)
+ UC_ERROR
+
+ /* close */
+ if(H5Pclose(vds_dcplid) < 0)
+ UC_ERROR
+ if(H5Sclose(vds_sid) < 0)
+ UC_ERROR
+ if(H5Dclose(did) < 0)
+ UC_ERROR
+ if(H5Fclose(fid) < 0)
+ UC_ERROR
+
+ return EXIT_SUCCESS;
+
+error:
+
+ H5E_BEGIN_TRY {
+ if(src_sid >= 0)
+ (void)H5Sclose(src_sid);
+ if(src_dcplid >= 0)
+ (void)H5Pclose(src_dcplid);
+ if(vds_sid >= 0)
+ (void)H5Sclose(vds_sid);
+ if(vds_dcplid >= 0)
+ (void)H5Pclose(vds_dcplid);
+ if(fid >= 0)
+ (void)H5Fclose(fid);
+ if(did >= 0)
+ (void)H5Dclose(did);
+ if(msid >= 0)
+ (void)H5Sclose(msid);
+ if(fsid >= 0)
+ (void)H5Sclose(fsid);
+ if(buffer != NULL)
+ free(buffer);
+ } H5E_END_TRY
+
+ return EXIT_FAILURE;
+
+} /* end main() */
+
diff --git a/tools/test/misc/vds/UC_3.h b/tools/test/misc/vds/UC_3.h
new file mode 100644
index 0000000..0654a48
--- /dev/null
+++ b/tools/test/misc/vds/UC_3.h
@@ -0,0 +1,74 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifndef UC_3_H
+#define UC_3_H
+
+#include "hdf5.h"
+
+#include "UC_1.h"
+#include "UC_2.h"
+
+/*
+ * Definitions for VDS use case 3
+ *
+ * Datasets have a single unlimited dimension and one or two fixed
+ * dimensions (they are reused from use cases 1 and 2). In this use case,
+ * the datasets are mapped in the VDS with gaps between them.
+ */
+
+/* VDS dimensions
+ * Height and width are large enough to encompass the
+ * mapped source datasets with gaps.
+ */
+#define UC_31_VDS_HEIGHT 25 /* full height + 7 (gaps of 1) */
+#define UC_31_VDS_WIDTH 8 /* full width + 0 (no gaps) */
+#define UC_32_VDS_HEIGHT 13 /* full height + 5 */
+#define UC_32_VDS_WIDTH 19 /* full width + 5 */
+#define UC_31_GAP 1
+
+/* VDS datatypes */
+#define UC_31_VDS_DATATYPE H5T_STD_I32LE
+#define UC_32_VDS_DATATYPE H5T_STD_I32LE
+
+/* Starting size of virtual datasets */
+static hsize_t UC_31_VDS_DIMS[RANK] = {0, UC_31_VDS_HEIGHT, UC_31_VDS_WIDTH};
+static hsize_t UC_32_VDS_DIMS[RANK] = {0, UC_32_VDS_HEIGHT, UC_32_VDS_WIDTH};
+
+/* Maximum size of virtual datasets */
+static hsize_t UC_31_VDS_MAX_DIMS[RANK] = {UC_1_N_MAX_PLANES, UC_31_VDS_HEIGHT, UC_31_VDS_WIDTH};
+static hsize_t UC_32_VDS_MAX_DIMS[RANK] = {UC_2_N_MAX_PLANES, UC_32_VDS_HEIGHT, UC_32_VDS_WIDTH};
+
+/* Positions of mapped source datasets */
+static hsize_t UC_32_POSITIONS[UC_2_N_SOURCES][RANK] = {
+ /* A */ {0, 1, 1},
+ /* B */ {0, 4, 0},
+ /* C */ {0, 11, 4},
+ /* D */ {0, 1, 9},
+ /* E */ {0, 8, 12}
+};
+
+/* VDS file names */
+#define UC_31_VDS_FILE_NAME "3_1_vds.h5"
+#define UC_32_VDS_FILE_NAME "3_2_vds.h5"
+
+/* Dataset name */
+#define UC_3_VDS_DSET_NAME "vds_dset"
+
+/* Fill value */
+static int UC_3_VDS_FILL_VALUE = -9;
+
+#endif /* UC_3_H */
+
diff --git a/tools/test/misc/vds/UC_3_gaps_gen.c b/tools/test/misc/vds/UC_3_gaps_gen.c
new file mode 100644
index 0000000..7cb208b
--- /dev/null
+++ b/tools/test/misc/vds/UC_3_gaps_gen.c
@@ -0,0 +1,255 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * File/dataset generator for VDS use case 3
+ *
+ * See the header file for a description.
+ */
+
+#include <stdlib.h>
+#include <string.h>
+
+#include <hdf5.h>
+
+#include "UC_common.h"
+#include "UC_3.h"
+
+/* Create the VDS that uses use case 1 files */
+static herr_t
+create_3_1_vds(void)
+{
+ hid_t src_sid = -1; /* source dataset's dataspace ID */
+ hid_t vds_sid = -1; /* VDS dataspace ID */
+ hid_t vds_dcplid = -1; /* VDS dataset property list ID */
+
+ hid_t fid = -1; /* HDF5 file ID */
+ hid_t did = -1; /* dataset ID */
+
+ hsize_t start[RANK]; /* source starting point for hyperslab */
+ hsize_t position[RANK]; /* vds mapping positions */
+
+ int i; /* iterator */
+
+ /* Create VDS dcpl */
+ if((vds_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ UC_ERROR
+ if(H5Pset_fill_value(vds_dcplid, UC_31_VDS_DATATYPE,
+ &UC_3_VDS_FILL_VALUE) < 0)
+ UC_ERROR
+
+ /* Create VDS dataspace */
+ if((vds_sid = H5Screate_simple(RANK, UC_31_VDS_DIMS,
+ UC_31_VDS_MAX_DIMS)) < 0)
+ UC_ERROR
+
+ /* Set starting positions */
+ start[0] = 0;
+ start[1] = 0;
+ start[2] = 0;
+
+ position[0] = 0;
+ position[1] = UC_31_GAP;
+ position[2] = 0;
+
+ /******************************
+ * Create source-VDS mappings *
+ ******************************/
+ for(i = 0; i < UC_1_N_SOURCES; i++) {
+
+ if((src_sid = H5Screate_simple(RANK, UC_1_DIMS[i],
+ UC_1_MAX_DIMS[i])) < 0)
+ UC_ERROR
+
+ /* set up hyperslabs for source and destination datasets */
+ if(H5Sselect_hyperslab(src_sid, H5S_SELECT_SET, start, NULL,
+ UC_1_MAX_DIMS[i], NULL) < 0)
+ UC_ERROR
+ if(H5Sselect_hyperslab(vds_sid, H5S_SELECT_SET, position,
+ NULL, UC_1_MAX_DIMS[i], NULL) < 0)
+ UC_ERROR
+ position[1] += UC_1_DIMS[i][1] + UC_31_GAP;
+
+ /* Add VDS mapping */
+ if(H5Pset_virtual(vds_dcplid, vds_sid, UC_1_FILE_NAMES[i],
+ UC_1_SOURCE_DSET_PATH, src_sid) < 0)
+ UC_ERROR
+ if(H5Sclose(src_sid) < 0)
+ UC_ERROR
+
+ } /* end for */
+
+ /*******************************
+ * Create VDS file and dataset *
+ *******************************/
+
+ /* file */
+ if((fid = H5Fcreate(UC_31_VDS_FILE_NAME, H5F_ACC_TRUNC,
+ H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ UC_ERROR
+
+ /* dataset */
+ if((did = H5Dcreate2(fid, UC_3_VDS_DSET_NAME, UC_31_VDS_DATATYPE, vds_sid,
+ H5P_DEFAULT, vds_dcplid, H5P_DEFAULT)) < 0)
+ UC_ERROR
+
+ /* close */
+ if(H5Pclose(vds_dcplid) < 0)
+ UC_ERROR
+ if(H5Sclose(vds_sid) < 0)
+ UC_ERROR
+ if(H5Dclose(did) < 0)
+ UC_ERROR
+ if(H5Fclose(fid) < 0)
+ UC_ERROR
+
+ return 0;
+
+error:
+
+ H5E_BEGIN_TRY {
+ if(vds_sid >= 0)
+ (void)H5Sclose(vds_sid);
+ if(vds_dcplid >= 0)
+ (void)H5Pclose(vds_dcplid);
+ if(fid >= 0)
+ (void)H5Fclose(fid);
+ if(did >= 0)
+ (void)H5Dclose(did);
+ } H5E_END_TRY
+
+ return -1;
+
+} /* end create_3_1_vds() */
+
+/* Create the VDS that uses use case 2 files */
+static herr_t
+create_3_2_vds(void)
+{
+ hid_t src_sid = -1; /* source dataset's dataspace ID */
+ hid_t vds_sid = -1; /* VDS dataspace ID */
+ hid_t vds_dcplid = -1; /* VDS dataset property list ID */
+
+ hid_t fid = -1; /* HDF5 file ID */
+ hid_t did = -1; /* dataset ID */
+
+ hsize_t start[RANK]; /* source starting point for hyperslab */
+
+ int i; /* iterator */
+
+ /* Create VDS dcpl */
+ if((vds_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ UC_ERROR
+ if(H5Pset_fill_value(vds_dcplid, UC_32_VDS_DATATYPE,
+ &UC_3_VDS_FILL_VALUE) < 0)
+ UC_ERROR
+
+ /* Create VDS dataspace */
+ if((vds_sid = H5Screate_simple(RANK, UC_32_VDS_DIMS,
+ UC_32_VDS_MAX_DIMS)) < 0)
+ UC_ERROR
+
+ /* Set starting positions */
+ start[0] = 0;
+ start[1] = 0;
+ start[2] = 0;
+
+ /******************************
+ * Create source-VDS mappings *
+ ******************************/
+ for(i = 0; i < UC_2_N_SOURCES; i++) {
+
+ if((src_sid = H5Screate_simple(RANK, UC_2_DIMS[i],
+ UC_2_MAX_DIMS[i])) < 0)
+ UC_ERROR
+
+ /* set up hyperslabs for source and destination datasets */
+ if(H5Sselect_hyperslab(src_sid, H5S_SELECT_SET, start, NULL,
+ UC_2_MAX_DIMS[i], NULL) < 0)
+ UC_ERROR
+ if(H5Sselect_hyperslab(vds_sid, H5S_SELECT_SET, UC_32_POSITIONS[i],
+ NULL, UC_2_MAX_DIMS[i], NULL) < 0)
+ UC_ERROR
+
+ /* Add VDS mapping */
+ if(H5Pset_virtual(vds_dcplid, vds_sid, UC_2_FILE_NAMES[i],
+ UC_2_SOURCE_DSET_PATH, src_sid) < 0)
+ UC_ERROR
+ if(H5Sclose(src_sid) < 0)
+ UC_ERROR
+
+ } /* end for */
+
+ /*******************************
+ * Create VDS file and dataset *
+ *******************************/
+
+ /* file */
+ if((fid = H5Fcreate(UC_32_VDS_FILE_NAME, H5F_ACC_TRUNC,
+ H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ UC_ERROR
+
+ /* dataset */
+ if((did = H5Dcreate2(fid, UC_3_VDS_DSET_NAME, UC_32_VDS_DATATYPE, vds_sid,
+ H5P_DEFAULT, vds_dcplid, H5P_DEFAULT)) < 0)
+ UC_ERROR
+
+ /* close */
+ if(H5Pclose(vds_dcplid) < 0)
+ UC_ERROR
+ if(H5Sclose(vds_sid) < 0)
+ UC_ERROR
+ if(H5Dclose(did) < 0)
+ UC_ERROR
+ if(H5Fclose(fid) < 0)
+ UC_ERROR
+
+ return 0;
+
+error:
+
+ H5E_BEGIN_TRY {
+ if(vds_sid >= 0)
+ (void)H5Sclose(vds_sid);
+ if(vds_dcplid >= 0)
+ (void)H5Pclose(vds_dcplid);
+ if(fid >= 0)
+ (void)H5Fclose(fid);
+ if(did >= 0)
+ (void)H5Dclose(did);
+ } H5E_END_TRY
+
+ return -1;
+
+} /* end create_3_2_vds() */
+
+int
+main(void)
+{
+
+ if(create_3_1_vds() < 0)
+ UC_ERROR
+
+ if(create_3_2_vds() < 0)
+ UC_ERROR
+
+ return EXIT_SUCCESS;
+
+error:
+
+ return EXIT_FAILURE;
+
+} /* end main() */
+
diff --git a/tools/test/misc/vds/UC_4.h b/tools/test/misc/vds/UC_4.h
new file mode 100644
index 0000000..bfcafed
--- /dev/null
+++ b/tools/test/misc/vds/UC_4.h
@@ -0,0 +1,86 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifndef UC_4_H
+#define UC_4_H
+
+#include "hdf5.h"
+
+#include "UC_common.h"
+
+/*
+ * Definitions for VDS use case 4
+ *
+ * Source datasets have three fixed dimensions. In this use case, the
+ * datasets are mapped consecutively in the VDS along a single dimension with
+ * no gaps between them. Datasets are automatically loaded using a
+ * printf-like format string for the file name.
+ */
+
+/* virtual dataset <---> source dataset mapping and sizes */
+
+#define UC_4_N_SOURCES 3
+
+/* Dataset dimensions */
+#define UC_4_SRC_PLANES 3
+#define UC_4_HEIGHT 4
+#define UC_4_WIDTH 4
+
+/* max number of planes for VDS (sources are finite) */
+#define UC_4_VDS_MAX_PLANES H5S_UNLIMITED
+#define UC_4_N_TEST_PLANES 9 /* number of planes in the VDS */
+
+/* Dataset datatypes */
+#define UC_4_SOURCE_DATATYPE H5T_STD_I32LE
+#define UC_4_VDS_DATATYPE H5T_STD_I32LE
+
+/* Starting size of datasets, both source and VDS */
+static hsize_t UC_4_SOURCE_DIMS[RANK] = {0, UC_4_HEIGHT, UC_4_WIDTH};
+static hsize_t UC_4_VDS_DIMS[RANK] = {0, UC_4_HEIGHT, UC_4_WIDTH};
+
+/* Max size of datasets, both source and VDS */
+static hsize_t UC_4_SOURCE_MAX_DIMS[RANK] = {UC_4_SRC_PLANES, UC_4_HEIGHT, UC_4_WIDTH};
+static hsize_t UC_4_VDS_MAX_DIMS[RANK] = {UC_4_VDS_MAX_PLANES, UC_4_HEIGHT, UC_4_WIDTH};
+
+/* Planes (both source and VDS) */
+static hsize_t UC_4_PLANE[RANK] = {1, UC_4_HEIGHT, UC_4_WIDTH};
+
+/* File names for source datasets */
+static char UC_4_FILE_NAMES[UC_4_N_SOURCES][NAME_LEN] = {
+ {"4_0.h5"},
+ {"4_1.h5"},
+ {"4_2.h5"}
+};
+static char UC_4_MAPPING_FILE_NAME[NAME_LEN] = "4_%b.h5";
+
+/* VDS file name */
+static char UC_4_VDS_FILE_NAME[NAME_LEN] = "4_vds.h5";
+
+/* Dataset names */
+static char UC_4_SOURCE_DSET_NAME[NAME_LEN] = "source_dset";
+static char UC_4_SOURCE_DSET_PATH[NAME_LEN] = "/source_dset";
+static char UC_4_VDS_DSET_NAME[NAME_LEN] = "vds_dset";
+
+/* Fill values */
+static int UC_4_FILL_VALUES[UC_4_N_SOURCES] = {
+ -1,
+ -2,
+ -3
+};
+static int UC_4_VDS_FILL_VALUE = -9;
+
+#endif /* UC_4_H */
+
+
diff --git a/tools/test/misc/vds/UC_4_printf_gen.c b/tools/test/misc/vds/UC_4_printf_gen.c
new file mode 100644
index 0000000..d067d47
--- /dev/null
+++ b/tools/test/misc/vds/UC_4_printf_gen.c
@@ -0,0 +1,219 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * File/dataset generator for VDS use case 4
+ *
+ * See the header file for a description.
+ */
+
+#include <stdlib.h>
+
+#include <hdf5.h>
+
+#include "UC_common.h"
+#include "UC_4.h"
+
+int
+main(void)
+{
+ hid_t src_sid = -1; /* source dataset's dataspace ID */
+ hid_t src_dcplid = -1; /* source dataset property list ID */
+
+ hid_t vds_sid = -1; /* VDS dataspace ID */
+ hid_t vds_dcplid = -1; /* VDS dataset property list ID */
+
+ hid_t fid = -1; /* HDF5 file ID */
+ hid_t did = -1; /* dataset ID */
+ hid_t msid = -1; /* memory dataspace ID */
+ hid_t fsid = -1; /* file dataspace ID */
+
+ /* Hyperslab arrays */
+ hsize_t start[RANK] = {0, 0, 0};
+ hsize_t count[RANK] = {H5S_UNLIMITED, 1, 1};
+
+ int *buffer = NULL; /* data buffer */
+ int value = -1; /* value written to datasets */
+
+ hsize_t n = 0; /* number of elements in a plane */
+
+ int i; /* iterator */
+ int j; /* iterator */
+ hsize_t k; /* iterator */
+
+ /************************************
+ * Create source files and datasets *
+ ************************************/
+
+ /* Create source dataspace ID */
+ if((src_sid = H5Screate_simple(RANK, UC_4_SOURCE_DIMS,
+ UC_4_SOURCE_MAX_DIMS)) < 0)
+ UC_ERROR
+ if(H5Sselect_hyperslab(src_sid, H5S_SELECT_SET, start, NULL,
+ UC_4_SOURCE_MAX_DIMS, NULL) < 0)
+ UC_ERROR
+
+ /* Create source files and datasets */
+ for(i = 0; i < UC_4_N_SOURCES; i++) {
+
+ /* source dataset dcpl */
+ if((src_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ UC_ERROR
+ if(H5Pset_chunk(src_dcplid, RANK, UC_4_PLANE) < 0)
+ UC_ERROR
+ if(H5Pset_fill_value(src_dcplid, UC_4_SOURCE_DATATYPE,
+ &UC_4_FILL_VALUES[i]) < 0)
+ UC_ERROR
+ if(H5Pset_deflate(src_dcplid, COMPRESSION_LEVEL) < 0)
+ UC_ERROR
+
+ /* Create source file and dataset */
+ if((fid = H5Fcreate(UC_4_FILE_NAMES[i], H5F_ACC_TRUNC,
+ H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ UC_ERROR
+ if((did = H5Dcreate2(fid, UC_4_SOURCE_DSET_NAME,
+ UC_4_SOURCE_DATATYPE, src_sid,
+ H5P_DEFAULT, src_dcplid, H5P_DEFAULT)) < 0)
+ UC_ERROR
+
+ /* Set the dataset's extent */
+ if(H5Dset_extent(did, UC_4_SOURCE_MAX_DIMS) < 0)
+ UC_ERROR
+
+ /* Create a data buffer that represents a plane */
+ n = UC_4_PLANE[1] * UC_4_PLANE[2];
+ if(NULL == (buffer = (int *)malloc(n * sizeof(int))))
+ UC_ERROR
+
+ /* Create the memory dataspace */
+ if((msid = H5Screate_simple(RANK, UC_4_PLANE, NULL)) < 0)
+ UC_ERROR
+
+ /* Get the file dataspace */
+ if((fsid = H5Dget_space(did)) < 0)
+ UC_ERROR
+
+ /* Write planes to the dataset */
+ for(j = 0; j < UC_4_SRC_PLANES; j++) {
+
+ value = ((i + 1) * 10) + j;
+ for(k = 0; k < n; k++)
+ buffer[k] = value;
+
+ start[0] = (hsize_t)j;
+ start[1] = 0;
+ start[2] = 0;
+ if(H5Sselect_hyperslab(fsid, H5S_SELECT_SET, start, NULL, UC_4_PLANE, NULL) < 0)
+ UC_ERROR
+ if(H5Dwrite(did, H5T_NATIVE_INT, msid, fsid, H5P_DEFAULT, buffer) < 0)
+ UC_ERROR
+
+ } /* end for */
+
+ /* close */
+ if(H5Sclose(msid) < 0)
+ UC_ERROR
+ if(H5Sclose(fsid) < 0)
+ UC_ERROR
+ if(H5Pclose(src_dcplid) < 0)
+ UC_ERROR
+ if(H5Dclose(did) < 0)
+ UC_ERROR
+ if(H5Fclose(fid) < 0)
+ UC_ERROR
+ free(buffer);
+
+ } /* end for */
+
+ /*******************
+ * Create VDS file *
+ *******************/
+
+ /* Create file */
+ if((fid = H5Fcreate(UC_4_VDS_FILE_NAME, H5F_ACC_TRUNC,
+ H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ UC_ERROR
+
+ /* Create VDS dcpl */
+ if((vds_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ UC_ERROR
+ if(H5Pset_fill_value(vds_dcplid, UC_4_VDS_DATATYPE,
+ &UC_4_VDS_FILL_VALUE) < 0)
+ UC_ERROR
+
+ /* Create VDS dataspace */
+ if((vds_sid = H5Screate_simple(RANK, UC_4_VDS_DIMS,
+ UC_4_VDS_MAX_DIMS)) < 0)
+ UC_ERROR
+ start[0] = 0;
+ start[1] = 0;
+ start[2] = 0;
+ if(H5Sselect_hyperslab(vds_sid, H5S_SELECT_SET, start,
+ UC_4_SOURCE_MAX_DIMS, count, UC_4_SOURCE_MAX_DIMS) < 0)
+ UC_ERROR
+
+ /* Add VDS mapping - The mapped file name uses a printf-like
+ * naming scheme that automatically maps new files.
+ */
+ if(H5Pset_virtual(vds_dcplid, vds_sid, UC_4_MAPPING_FILE_NAME,
+ UC_4_SOURCE_DSET_PATH, src_sid) < 0)
+ UC_ERROR
+
+ /* Create dataset */
+ if((did = H5Dcreate2(fid, UC_4_VDS_DSET_NAME, UC_4_VDS_DATATYPE, vds_sid,
+ H5P_DEFAULT, vds_dcplid, H5P_DEFAULT)) < 0)
+ UC_ERROR
+
+ /* close */
+ if(H5Sclose(src_sid) < 0)
+ UC_ERROR
+ if(H5Pclose(vds_dcplid) < 0)
+ UC_ERROR
+ if(H5Sclose(vds_sid) < 0)
+ UC_ERROR
+ if(H5Dclose(did) < 0)
+ UC_ERROR
+ if(H5Fclose(fid) < 0)
+ UC_ERROR
+
+ return EXIT_SUCCESS;
+
+error:
+
+ H5E_BEGIN_TRY {
+ if(src_sid >= 0)
+ (void)H5Sclose(src_sid);
+ if(src_dcplid >= 0)
+ (void)H5Pclose(src_dcplid);
+ if(vds_sid >= 0)
+ (void)H5Sclose(vds_sid);
+ if(vds_dcplid >= 0)
+ (void)H5Pclose(vds_dcplid);
+ if(fid >= 0)
+ (void)H5Fclose(fid);
+ if(did >= 0)
+ (void)H5Dclose(did);
+ if(msid >= 0)
+ (void)H5Sclose(msid);
+ if(fsid >= 0)
+ (void)H5Sclose(fsid);
+ if(buffer != NULL)
+ free(buffer);
+ } H5E_END_TRY
+
+ return EXIT_FAILURE;
+
+} /* end main() */
+
diff --git a/tools/test/misc/vds/UC_5.h b/tools/test/misc/vds/UC_5.h
new file mode 100644
index 0000000..96b2af3
--- /dev/null
+++ b/tools/test/misc/vds/UC_5.h
@@ -0,0 +1,83 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifndef UC_5_H
+#define UC_5_H
+
+#include <hdf5.h>
+
+#include "UC_common.h"
+
+/*
+ * Definitions for VDS use case 5
+ *
+ * Source datasets have one unlimited dimension and two fixed dimensions. In
+ * this use case, the datasets are mapped in the VDS so that alternating
+ * planes in the source are interleaved in the VDS.
+ */
+
+/* virtual dataset <---> source dataset mapping and sizes */
+
+#define UC_5_N_SOURCES 3
+
+/* Dataset dimensions */
+#define UC_5_SRC_PLANES 3
+#define UC_5_HEIGHT 4
+#define UC_5_WIDTH 4
+
+/* max number of planes for datasets */
+#define UC_5_MAX_PLANES H5S_UNLIMITED
+#define UC_5_N_TEST_PLANES 9 /* number of planes in VDS */
+
+/* Dataset datatypes */
+#define UC_5_SOURCE_DATATYPE H5T_STD_I32LE
+#define UC_5_VDS_DATATYPE H5T_STD_I32LE
+
+/* Starting size of datasets, both source and VDS */
+static hsize_t UC_5_SOURCE_DIMS[RANK] = {0, UC_5_HEIGHT, UC_5_WIDTH};
+static hsize_t UC_5_VDS_DIMS[RANK] = {0, UC_5_HEIGHT, UC_5_WIDTH};
+
+/* Max size of datasets, both source and VDS */
+static hsize_t UC_5_SOURCE_MAX_DIMS[RANK] = {UC_5_MAX_PLANES, UC_5_HEIGHT, UC_5_WIDTH};
+static hsize_t UC_5_VDS_MAX_DIMS[RANK] = {UC_5_MAX_PLANES, UC_5_HEIGHT, UC_5_WIDTH};
+
+/* Planes (both source and VDS) */
+static hsize_t UC_5_PLANE[RANK] = {1, UC_5_HEIGHT, UC_5_WIDTH};
+
+/* File names for source datasets */
+static char UC_5_FILE_NAMES[UC_5_N_SOURCES][NAME_LEN] = {
+ {"5_a.h5"},
+ {"5_b.h5"},
+ {"5_c.h5"}
+};
+
+/* VDS file name */
+static char UC_5_VDS_FILE_NAME[NAME_LEN] = "5_vds.h5";
+
+/* Dataset names */
+static char UC_5_SOURCE_DSET_NAME[NAME_LEN] = "source_dset";
+static char UC_5_SOURCE_DSET_PATH[NAME_LEN] = "/source_dset";
+static char UC_5_VDS_DSET_NAME[NAME_LEN] = "vds_dset";
+
+/* Fill values */
+static int UC_5_FILL_VALUES[UC_5_N_SOURCES] = {
+ -1,
+ -2,
+ -3
+};
+static int UC_5_VDS_FILL_VALUE = -9;
+
+#endif /* UC_5_H */
+
diff --git a/tools/test/misc/vds/UC_5_stride_gen.c b/tools/test/misc/vds/UC_5_stride_gen.c
new file mode 100644
index 0000000..38d24a6
--- /dev/null
+++ b/tools/test/misc/vds/UC_5_stride_gen.c
@@ -0,0 +1,243 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * File/dataset generator for VDS use case 5
+ *
+ * See the header file for a description.
+ */
+
+#include <stdlib.h>
+
+#include <hdf5.h>
+
+#include "UC_common.h"
+#include "UC_5.h"
+
+int
+main(void)
+{
+ hid_t src_sid = -1; /* source dataset's dataspace ID */
+ hid_t src_dcplid = -1; /* source dataset property list ID */
+
+ hid_t vds_sid = -1; /* VDS dataspace ID */
+ hid_t vds_dcplid = -1; /* VDS dataset property list ID */
+
+ hid_t fid = -1; /* HDF5 file ID */
+ hid_t did = -1; /* dataset ID */
+ hid_t msid = -1; /* memory dataspace ID */
+ hid_t fsid = -1; /* file dataspace ID */
+
+ hsize_t extent[RANK]; /* source dataset extents */
+ hsize_t start[RANK]; /* starting point for hyperslab */
+ hsize_t stride[RANK]; /* hypserslab stride */
+ hsize_t count[RANK]; /* hypserslab count */
+ hsize_t map_start = 0; /* starting point in the VDS map */
+
+ int *buffer = NULL; /* data buffer */
+ int value = -1; /* value written to datasets */
+
+ hsize_t n = 0; /* number of elements in a plane */
+
+ int i; /* iterator */
+ int j; /* iterator */
+ hsize_t k; /* iterator */
+
+ /* Start by creating the virtual dataset (VDS) dataspace and creation
+ * property list. The individual source datasets are then created
+ * and the VDS map (stored in the VDS property list) is updated.
+ */
+
+ /* Create VDS dcpl */
+ if((vds_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ UC_ERROR
+ if(H5Pset_fill_value(vds_dcplid, UC_5_VDS_DATATYPE,
+ &UC_5_VDS_FILL_VALUE) < 0)
+ UC_ERROR
+
+ /* Create VDS dataspace */
+ if((vds_sid = H5Screate_simple(RANK, UC_5_VDS_DIMS,
+ UC_5_VDS_MAX_DIMS)) < 0)
+ UC_ERROR
+
+ /*********************************
+ * Map source files and datasets *
+ *********************************/
+
+ /* Hyperslab array setup */
+ start[0] = 0;
+ start[1] = 0;
+ start[2] = 0;
+ map_start = 0;
+
+ stride[0] = UC_5_N_SOURCES;
+ stride[1] = 1;
+ stride[2] = 1;
+
+ count[0] = H5S_UNLIMITED;
+ count[1] = 1;
+ count[2] = 1;
+
+ extent[0] = UC_5_SRC_PLANES;
+ extent[1] = UC_5_HEIGHT;
+ extent[2] = UC_5_WIDTH;
+
+ for(i = 0; i < UC_5_N_SOURCES; i++) {
+
+ /* source dataset dcpl */
+ if((src_dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ UC_ERROR
+ if(H5Pset_chunk(src_dcplid, RANK, UC_5_PLANE) < 0)
+ UC_ERROR
+ if(H5Pset_fill_value(src_dcplid, UC_5_SOURCE_DATATYPE,
+ &UC_5_FILL_VALUES[i]) < 0)
+ UC_ERROR
+ if(H5Pset_deflate(src_dcplid, COMPRESSION_LEVEL) < 0)
+ UC_ERROR
+
+ /* Create source file, dataspace, and dataset */
+ if((fid = H5Fcreate(UC_5_FILE_NAMES[i], H5F_ACC_TRUNC,
+ H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ UC_ERROR
+ if((src_sid = H5Screate_simple(RANK, UC_5_SOURCE_DIMS,
+ UC_5_SOURCE_MAX_DIMS)) < 0)
+ UC_ERROR
+ if((did = H5Dcreate2(fid, UC_5_SOURCE_DSET_NAME,
+ UC_5_SOURCE_DATATYPE, src_sid,
+ H5P_DEFAULT, src_dcplid, H5P_DEFAULT)) < 0)
+ UC_ERROR
+
+ /* Set the dataset's extent */
+ if(H5Dset_extent(did, extent) < 0)
+ UC_ERROR
+
+ /* Create a data buffer that represents a plane */
+ n = UC_5_PLANE[1] * UC_5_PLANE[2];
+ if(NULL == (buffer = (int *)malloc(n * sizeof(int))))
+ UC_ERROR
+
+ /* Create the memory dataspace */
+ if((msid = H5Screate_simple(RANK, UC_5_PLANE, NULL)) < 0)
+ UC_ERROR
+
+ /* Get the file dataspace */
+ if((fsid = H5Dget_space(did)) < 0)
+ UC_ERROR
+
+ /* Write planes to the dataset */
+ for(j = 0; j < UC_5_SRC_PLANES; j++) {
+
+ value = ((i + 1) * 10) + j;
+ for(k = 0; k < n; k++)
+ buffer[k] = value;
+
+ start[0] = (hsize_t)j;
+ start[1] = 0;
+ start[2] = 0;
+ if(H5Sselect_hyperslab(fsid, H5S_SELECT_SET, start, NULL, UC_5_PLANE, NULL) < 0)
+ UC_ERROR
+ if(H5Dwrite(did, H5T_NATIVE_INT, msid, fsid, H5P_DEFAULT, buffer) < 0)
+ UC_ERROR
+
+ } /* end for */
+
+ /* set up hyperslabs for source and destination datasets */
+ start[0] = 0;
+ start[1] = 0;
+ start[2] = 0;
+ if(H5Sselect_hyperslab(src_sid, H5S_SELECT_SET, start, NULL,
+ UC_5_SOURCE_MAX_DIMS, NULL) < 0)
+ UC_ERROR
+ start[0] = map_start;
+ if(H5Sselect_hyperslab(vds_sid, H5S_SELECT_SET, start, stride,
+ count, UC_5_PLANE) < 0)
+ UC_ERROR
+ map_start += 1;
+
+ /* Add VDS mapping */
+ if(H5Pset_virtual(vds_dcplid, vds_sid, UC_5_FILE_NAMES[i],
+ UC_5_SOURCE_DSET_PATH, src_sid) < 0)
+ UC_ERROR
+
+ /* close */
+ if(H5Sclose(msid) < 0)
+ UC_ERROR
+ if(H5Sclose(fsid) < 0)
+ UC_ERROR
+ if(H5Sclose(src_sid) < 0)
+ UC_ERROR
+ if(H5Pclose(src_dcplid) < 0)
+ UC_ERROR
+ if(H5Dclose(did) < 0)
+ UC_ERROR
+ if(H5Fclose(fid) < 0)
+ UC_ERROR
+ free(buffer);
+
+ } /* end for */
+
+ /*******************
+ * Create VDS file *
+ *******************/
+
+ /* file */
+ if((fid = H5Fcreate(UC_5_VDS_FILE_NAME, H5F_ACC_TRUNC,
+ H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ UC_ERROR
+
+ /* dataset */
+ if((did = H5Dcreate2(fid, UC_5_VDS_DSET_NAME, UC_5_VDS_DATATYPE, vds_sid,
+ H5P_DEFAULT, vds_dcplid, H5P_DEFAULT)) < 0)
+ UC_ERROR
+
+ /* close */
+ if(H5Pclose(vds_dcplid) < 0)
+ UC_ERROR
+ if(H5Sclose(vds_sid) < 0)
+ UC_ERROR
+ if(H5Dclose(did) < 0)
+ UC_ERROR
+ if(H5Fclose(fid) < 0)
+ UC_ERROR
+
+ return EXIT_SUCCESS;
+
+error:
+
+ H5E_BEGIN_TRY {
+ if(src_sid >= 0)
+ (void)H5Sclose(src_sid);
+ if(src_dcplid >= 0)
+ (void)H5Pclose(src_dcplid);
+ if(vds_sid >= 0)
+ (void)H5Sclose(vds_sid);
+ if(vds_dcplid >= 0)
+ (void)H5Pclose(vds_dcplid);
+ if(fid >= 0)
+ (void)H5Fclose(fid);
+ if(did >= 0)
+ (void)H5Dclose(did);
+ if(msid >= 0)
+ (void)H5Sclose(msid);
+ if(fsid >= 0)
+ (void)H5Sclose(fsid);
+ if(buffer != NULL)
+ free(buffer);
+ } H5E_END_TRY
+
+ return EXIT_FAILURE;
+
+} /* end main() */
+
diff --git a/tools/test/misc/vds/UC_common.h b/tools/test/misc/vds/UC_common.h
new file mode 100644
index 0000000..0e61016
--- /dev/null
+++ b/tools/test/misc/vds/UC_common.h
@@ -0,0 +1,41 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifndef USE_CASE_COMMON_H
+#define USE_CASE_COMMON_H
+
+/******************************************
+ * Symbols used across multiple use cases *
+ ******************************************/
+
+/* All datasets are 3D */
+#define RANK 3
+
+/* Lengths of string identifiers (file, dataset names, etc.) */
+#define NAME_LEN 32
+
+/* Compression level */
+#define COMPRESSION_LEVEL 7
+
+/* Booleans */
+#define TRUE 1
+#define FALSE 0
+
+/* Testing macros */
+#define AT() printf (" at %s:%d in %s()...\n", __FILE__, __LINE__, __func__);
+#define UC_ERROR {puts("*ERROR*"); fflush(stdout); AT(); goto error;}
+
+#endif /* USE_CASE_COMMON_H */
+
diff --git a/tools/test/perform/CMakeLists.txt b/tools/test/perform/CMakeLists.txt
new file mode 100644
index 0000000..bea2d0c
--- /dev/null
+++ b/tools/test/perform/CMakeLists.txt
@@ -0,0 +1,124 @@
+cmake_minimum_required (VERSION 3.1.0)
+PROJECT (HDF5_TOOLS_TEST_PERFORM )
+
+#-----------------------------------------------------------------------------
+# Apply Definitions to compiler in this directory and below
+#-----------------------------------------------------------------------------
+add_definitions (${HDF_EXTRA_C_FLAGS})
+
+#-----------------------------------------------------------------------------
+# Setup include Directories
+#-----------------------------------------------------------------------------
+INCLUDE_DIRECTORIES (${HDF5_TEST_SRC_DIR})
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib )
+
+# --------------------------------------------------------------------
+# Add the executables
+# --------------------------------------------------------------------
+#-- Adding test for h5perf_serial
+set (h5perf_serial_SOURCES
+ ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/sio_perf.c
+ ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/sio_engine.c
+)
+add_executable (h5perf_serial ${h5perf_serial_SOURCES})
+TARGET_NAMING (h5perf_serial STATIC)
+TARGET_C_PROPERTIES (h5perf_serial STATIC " " " ")
+target_link_libraries (h5perf_serial ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+set_target_properties (h5perf_serial PROPERTIES FOLDER perform)
+
+if (HDF5_BUILD_PERFORM_STANDALONE)
+ #-- Adding test for h5perf_serial_alone
+ set (h5perf_serial_alone_SOURCES
+ ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/sio_perf.c
+ ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/sio_engine.c
+ )
+ add_executable (h5perf_serial_alone ${h5perf_serial_alone_SOURCES})
+ TARGET_NAMING (h5perf_serial_alone STATIC)
+ TARGET_C_PROPERTIES (h5perf_serial_alone STATIC " " " ")
+ target_link_libraries (h5perf_serial_alone ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+ set_target_properties (h5perf_serial_alone PROPERTIES FOLDER perform)
+ set_property (TARGET h5perf_serial_alone
+ APPEND PROPERTY COMPILE_DEFINITIONS STANDALONE
+ )
+endif (HDF5_BUILD_PERFORM_STANDALONE)
+
+#-- Adding test for chunk
+set (chunk_SOURCES
+ ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/chunk.c
+)
+ADD_EXECUTABLE(chunk ${chunk_SOURCES})
+TARGET_NAMING (chunk STATIC)
+TARGET_C_PROPERTIES (chunk STATIC " " " ")
+TARGET_LINK_LIBRARIES(chunk ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+set_target_properties (chunk PROPERTIES FOLDER perform)
+
+#-- Adding test for iopipe
+set (iopipe_SOURCES
+ ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/iopipe.c
+)
+add_executable (iopipe ${iopipe_SOURCES})
+TARGET_NAMING (iopipe STATIC)
+TARGET_C_PROPERTIES (iopipe STATIC " " " ")
+target_link_libraries (iopipe ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+set_target_properties (iopipe PROPERTIES FOLDER perform)
+
+#-- Adding test for overhead
+set (overhead_SOURCES
+ ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/overhead.c
+)
+add_executable (overhead ${overhead_SOURCES})
+TARGET_NAMING (overhead STATIC)
+TARGET_C_PROPERTIES (overhead STATIC " " " ")
+target_link_libraries (overhead ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+set_target_properties (overhead PROPERTIES FOLDER perform)
+
+#-- Adding test for perf_meta
+ set (perf_meta_SOURCES
+ ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/perf_meta.c
+ )
+ add_executable (perf_meta ${perf_meta_SOURCES})
+ TARGET_NAMING (perf_meta STATIC)
+ TARGET_C_PROPERTIES (perf_meta STATIC " " " ")
+ target_link_libraries (perf_meta ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
+ set_target_properties (perf_meta PROPERTIES FOLDER perform)
+
+#-- Adding test for zip_perf
+set (zip_perf_SOURCES
+ ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/zip_perf.c
+)
+add_executable (zip_perf ${zip_perf_SOURCES})
+TARGET_NAMING (zip_perf STATIC)
+TARGET_C_PROPERTIES (zip_perf STATIC " " " ")
+target_link_libraries (zip_perf ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+set_target_properties (zip_perf PROPERTIES FOLDER perform)
+
+if (H5_HAVE_PARALLEL AND BUILD_TESTING)
+ #-- Adding test for h5perf
+ set (h5perf_SOURCES
+ ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/pio_perf.c
+ ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/pio_engine.c
+ )
+ add_executable (h5perf ${h5perf_SOURCES})
+ TARGET_NAMING (h5perf STATIC)
+ TARGET_C_PROPERTIES (h5perf STATIC " " " ")
+ target_link_libraries (h5perf ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
+ set_target_properties (h5perf PROPERTIES FOLDER perform)
+
+ if (HDF5_BUILD_PERFORM_STANDALONE)
+ #-- Adding test for h5perf
+ set (h5perf_alone_SOURCES
+ ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/pio_perf.c
+ ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/pio_engine.c
+ )
+ add_executable (h5perf_alone ${h5perf_alone_SOURCES})
+ TARGET_NAMING (h5perf_alone STATIC)
+ TARGET_C_PROPERTIES (h5perf_alone STATIC " " " ")
+ target_link_libraries (h5perf_alone ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
+ set_target_properties (h5perf_alone PROPERTIES FOLDER perform)
+ set_property (TARGET h5perf_alone
+ APPEND PROPERTY COMPILE_DEFINITIONS STANDALONE
+ )
+ endif (HDF5_BUILD_PERFORM_STANDALONE)
+endif (H5_HAVE_PARALLEL AND BUILD_TESTING)
+
+include (CMakeTests.cmake)
diff --git a/tools/test/perform/CMakeTests.cmake b/tools/test/perform/CMakeTests.cmake
new file mode 100644
index 0000000..0ea40a3
--- /dev/null
+++ b/tools/test/perform/CMakeTests.cmake
@@ -0,0 +1,54 @@
+
+##############################################################################
+##############################################################################
+### T E S T I N G ###
+##############################################################################
+##############################################################################
+
+HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/tfilters.h5" "${PROJECT_BINARY_DIR}/tfilters.h5" "zip_perf_files")
+add_custom_target(zip_perf_files ALL COMMENT "Copying files needed by zip_perf tests" DEPENDS ${zip_perf_list})
+
+#-----------------------------------------------------------------------------
+# Add Tests
+#-----------------------------------------------------------------------------
+
+# Remove any output file left over from previous test run
+add_test (
+ NAME PERFORM_h5perform-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ chunk.h5
+ iopipe.h5
+ iopipe.raw
+ x-diag-rd.dat
+ x-diag-wr.dat
+ x-rowmaj-rd.dat
+ x-rowmaj-wr.dat
+ x-gnuplot
+)
+
+add_test (NAME PERFORM_h5perf_serial COMMAND $<TARGET_FILE:h5perf_serial>)
+set_tests_properties (PERFORM_h5perf_serial PROPERTIES TIMEOUT 1800)
+
+if (HDF5_BUILD_PERFORM_STANDALONE)
+ add_test (NAME PERFORM_h5perf_serial_alone COMMAND $<TARGET_FILE:h5perf_serial_alone>)
+endif (HDF5_BUILD_PERFORM_STANDALONE)
+
+add_test (NAME PERFORM_chunk COMMAND $<TARGET_FILE:chunk>)
+
+add_test (NAME PERFORM_iopipe COMMAND $<TARGET_FILE:iopipe>)
+
+add_test (NAME PERFORM_overhead COMMAND $<TARGET_FILE:overhead>)
+
+add_test (NAME PERFORM_perf_meta COMMAND $<TARGET_FILE:perf_meta>)
+
+add_test (NAME PERFORM_zip_perf_help COMMAND $<TARGET_FILE:zip_perf> "-h")
+add_test (NAME PERFORM_zip_perf COMMAND $<TARGET_FILE:zip_perf> tfilters.h5)
+
+if (H5_HAVE_PARALLEL)
+ add_test (NAME PERFORM_h5perf COMMAND ${MPIEXEC} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_POSTFLAGS} $<TARGET_FILE:h5perf>)
+
+ if (HDF5_BUILD_PERFORM_STANDALONE)
+ add_test (NAME PERFORM_h5perf_alone COMMAND ${MPIEXEC} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_POSTFLAGS} $<TARGET_FILE:h5perf_alone>)
+ endif (HDF5_BUILD_PERFORM_STANDALONE)
+endif (H5_HAVE_PARALLEL)
diff --git a/tools/test/perform/COPYING b/tools/test/perform/COPYING
new file mode 100644
index 0000000..6903daf
--- /dev/null
+++ b/tools/test/perform/COPYING
@@ -0,0 +1,16 @@
+
+ Copyright by The HDF Group and
+ The Board of Trustees of the University of Illinois.
+ All rights reserved.
+
+ The files and subdirectories in this directory are 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://www.hdfgroup.org/HDF5/doc/Copyright.html. If you do not
+ have access to either file, you may request a copy from
+ help@hdfgroup.org.
+
diff --git a/tools/test/perform/Makefile.am b/tools/test/perform/Makefile.am
new file mode 100644
index 0000000..1af0e7f
--- /dev/null
+++ b/tools/test/perform/Makefile.am
@@ -0,0 +1,79 @@
+#
+# 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.
+##
+## Makefile.am
+## Run automake to generate a Makefile.in from this file.
+##
+#
+# HDF5 Library Performance Makefile(.in)
+#
+
+include $(top_srcdir)/config/commence.am
+
+AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/test -I$(top_srcdir)/tools/lib
+
+# bin_PROGRAMS will be installed.
+if BUILD_PARALLEL_CONDITIONAL
+ bin_PROGRAMS=h5perf_serial h5perf
+else
+ bin_PROGRAMS=h5perf_serial
+endif
+
+# Add h5perf and h5perf_serial specific linker flags here
+h5perf_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+h5perf_serial_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+
+# Some programs are not built or run by default, but can be built by hand or by
+# specifying --enable-build-all at configure time.
+# Also, some of these programs should only be built in parallel.
+# Currently there is no such program.
+if BUILD_PARALLEL_CONDITIONAL
+ PARA_BUILD_ALL=
+endif
+if BUILD_ALL_CONDITIONAL
+ BUILD_ALL_PROGS=$(PARA_BUILD_ALL)
+endif
+
+# Define programs that will be run in 'make check'
+# List them in the order they should be run.
+# Parallel test programs.
+if BUILD_PARALLEL_CONDITIONAL
+ TEST_PROG_PARA=h5perf perf
+endif
+# Serial test programs.
+TEST_PROG = iopipe chunk overhead zip_perf perf_meta h5perf_serial $(BUILD_ALL_PROGS)
+
+# check_PROGRAMS will be built but not installed. Do not any executable
+# that is in bin_PROGRAMS already. Otherwise, it will be removed twice in
+# "make clean" and some systems, e.g., AIX, do not like it.
+check_PROGRAMS= iopipe chunk overhead zip_perf perf_meta $(BUILD_ALL_PROGS) perf
+
+h5perf_SOURCES=pio_perf.c pio_engine.c
+h5perf_serial_SOURCES=sio_perf.c sio_engine.c
+
+# These are the files that `make clean' (and derivatives) will remove from
+# this directory.
+CLEANFILES=*.h5 *.raw *.dat x-gnuplot perftest.out
+
+# All of the programs depend on the main hdf5 library, and some of them
+# depend on test or tools library.
+LDADD=$(LIBHDF5)
+h5perf_LDADD=$(LIBH5TOOLS) $(LIBH5TEST) $(LIBHDF5)
+h5perf_serial_LDADD=$(LIBH5TOOLS) $(LIBH5TEST) $(LIBHDF5)
+perf_LDADD=$(LIBH5TEST) $(LIBHDF5)
+iopipe_LDADD=$(LIBH5TEST) $(LIBHDF5)
+zip_perf_LDADD=$(LIBH5TOOLS) $(LIBH5TEST) $(LIBHDF5)
+perf_meta_LDADD=$(LIBH5TEST) $(LIBHDF5)
+
+include $(top_srcdir)/config/conclude.am
diff --git a/tools/test/perform/build_h5perf_alone.sh b/tools/test/perform/build_h5perf_alone.sh
new file mode 100644
index 0000000..b65e863
--- /dev/null
+++ b/tools/test/perform/build_h5perf_alone.sh
@@ -0,0 +1,28 @@
+#! /bin/sh -x
+#
+# 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.
+#
+# Name: build_h5perf_alone.sh
+#
+# Puporse: Build the h5perf tool by standalone mode.
+#
+# Created: Albert Cheng, 2005/09/18
+#
+# Modification:
+#
+
+# Default to use h5pcc to build h5perf unless $H5CC is defined.
+#
+h5pcc=${H5CC:-h5pcc}
+$h5pcc -DSTANDALONE pio_perf.c pio_engine.c pio_timer.c -o h5perf
diff --git a/tools/test/perform/build_h5perf_serial_alone.sh b/tools/test/perform/build_h5perf_serial_alone.sh
new file mode 100644
index 0000000..2566609
--- /dev/null
+++ b/tools/test/perform/build_h5perf_serial_alone.sh
@@ -0,0 +1,28 @@
+#! /bin/sh -x
+#
+# 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.
+#
+# Name: build_h5perf_serial_alone.sh
+#
+# Puporse: Build the h5perf_serial tool by standalone mode.
+#
+# Created: Christian Chilan, 2008/09/02
+#
+# Modification:
+#
+
+# Default to use h5cc to build h5perf_serial unless $H5CC is defined.
+#
+h5cc=${H5CC:-h5cc}
+$h5cc -DSTANDALONE sio_perf.c sio_engine.c sio_timer.c -o h5perf_serial
diff --git a/tools/test/perform/chunk.c b/tools/test/perform/chunk.c
new file mode 100644
index 0000000..b1419ee
--- /dev/null
+++ b/tools/test/perform/chunk.c
@@ -0,0 +1,550 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Programmer: Robb Matzke <robb@arborea.spizella.com>
+ * Thursday, May 14, 1998
+ *
+ * Purpose: Checks the effect of various I/O request sizes and raw data
+ * cache sizes. Performance depends on the amount of data read
+ * from disk and we use a filter to get that number.
+ */
+
+/* See H5private.h for how to include headers */
+#undef NDEBUG
+#include "hdf5.h"
+
+#ifdef H5_STDC_HEADERS
+# include <assert.h>
+# include <stdio.h>
+# include <stdlib.h>
+# include <string.h>
+#endif
+
+/* Solaris Studio defines attribute, but for the attributes we need */
+#if !defined(H5_HAVE_ATTRIBUTE) || defined __cplusplus || defined(__SUNPRO_C)
+# undef __attribute__
+# define __attribute__(X) /*void*/
+# define H5_ATTR_UNUSED /*void*/
+#else
+# define H5_ATTR_UNUSED __attribute__((unused))
+#endif
+
+#define FILE_NAME "chunk.h5"
+#define LINESPOINTS "lines"
+#define CH_SIZE 100 /*squared in terms of bytes */
+#define DS_SIZE 20 /*squared in terms of chunks */
+#define FILTER_COUNTER 305
+#define READ 0
+#define WRITE 1
+#define MIN(X,Y) ((X)<(Y)?(X):(Y))
+#define MAX(X,Y) ((X)>(Y)?(X):(Y))
+#define SQUARE(X) ((X)*(X))
+
+/* The row-major test */
+#define RM_CACHE_STRT 25
+#define RM_CACHE_END 25
+#define RM_CACHE_DELT 5
+#define RM_START (double)0.50F
+#define RM_END (double)5.00F
+#define RM_DELTA (double)0.50F
+#define RM_W0 0.0F
+#define RM_NRDCC 521
+
+/* Diagonal test */
+#define DIAG_CACHE_STRT 25
+#define DIAG_CACHE_END 25
+#define DIAG_CACHE_DELT 5
+#define DIAG_START (double)0.50F
+#define DIAG_END (double)5.00F
+#define DIAG_DELTA (double)0.50F
+/* #define DIAG_W0 0.65F */
+/* #define DIAG_NRDCC 521 */
+
+static size_t nio_g;
+static hid_t fapl_g = -1;
+
+/* Local function prototypes */
+static size_t
+counter (unsigned H5_ATTR_UNUSED flags, size_t cd_nelmts,
+ const unsigned *cd_values, size_t nbytes,
+ size_t *buf_size, void **buf);
+
+/* This message derives from H5Z */
+const H5Z_class2_t H5Z_COUNTER[1] = {{
+ H5Z_CLASS_T_VERS, /* H5Z_class_t version */
+ FILTER_COUNTER, /* Filter id number */
+ 1, 1, /* Encoding and decoding enabled */
+ "counter", /* Filter name for debugging */
+ NULL, /* The "can apply" callback */
+ NULL, /* The "set local" callback */
+ counter, /* The actual filter function */
+}};
+
+
+/*-------------------------------------------------------------------------
+ * Function: counter
+ *
+ * Purpose: Count number of bytes but don't do anything.
+ *
+ * Return: Success: src_nbytes-1
+ *
+ * Failure: never fails
+ *
+ * Programmer: Robb Matzke
+ * Thursday, May 14, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static size_t
+counter (unsigned H5_ATTR_UNUSED flags, size_t H5_ATTR_UNUSED cd_nelmts,
+ const unsigned H5_ATTR_UNUSED *cd_values, size_t nbytes,
+ size_t H5_ATTR_UNUSED *buf_size, void H5_ATTR_UNUSED **buf)
+{
+ nio_g += nbytes;
+ return nbytes;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: create_dataset
+ *
+ * Purpose: Creates a square dataset with square chunks, registers a
+ * stupid compress/uncompress pair for counting I/O, and
+ * initializes the dataset. The chunk size is in bytes, the
+ * dataset size is in terms of chunks.
+ *
+ * Return: void
+ *
+ * Programmer: Robb Matzke
+ * Thursday, May 14, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+create_dataset (void)
+{
+ hid_t file, space, dcpl, dset;
+ hsize_t size[2];
+ signed char *buf;
+
+ /* The file */
+ file = H5Fcreate (FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_g);
+
+ /* The data space */
+ size[0] = size[1] = DS_SIZE * CH_SIZE;
+ space = H5Screate_simple(2, size, size);
+
+ /* The storage layout and compression */
+ dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ size[0] = size[1] = CH_SIZE;
+ H5Pset_chunk(dcpl, 2, size);
+ H5Zregister(H5Z_COUNTER);
+ H5Pset_filter(dcpl, FILTER_COUNTER, 0, 0, NULL);
+
+ /* The dataset */
+ dset = H5Dcreate2(file, "dset", H5T_NATIVE_SCHAR, space, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ assert(dset>=0);
+
+ /* The data */
+ buf = (signed char *)calloc(1, SQUARE (DS_SIZE*CH_SIZE));
+ H5Dwrite(dset, H5T_NATIVE_SCHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
+ free(buf);
+
+ /* Close */
+ H5Dclose(dset);
+ H5Sclose(space);
+ H5Pclose(dcpl);
+ H5Fclose(file);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_rowmaj
+ *
+ * Purpose: Reads the entire dataset using the specified size-squared
+ * I/O requests in row major order.
+ *
+ * Return: Efficiency: data requested divided by data actually read.
+ *
+ * Programmer: Robb Matzke
+ * Thursday, May 14, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static double
+test_rowmaj (int op, size_t cache_size, size_t io_size)
+{
+ hid_t file, dset, mem_space, file_space;
+ signed char *buf = (signed char *)calloc (1, (size_t)(SQUARE(io_size)));
+ hsize_t i, j, hs_size[2];
+ hsize_t hs_offset[2];
+ int mdc_nelmts;
+ size_t rdcc_nelmts;
+ double w0;
+
+ H5Pget_cache (fapl_g, &mdc_nelmts, &rdcc_nelmts, NULL, &w0);
+#ifdef RM_W0
+ w0 = RM_W0;
+#endif
+#ifdef RM_NRDCC
+ rdcc_nelmts = RM_NRDCC;
+#endif
+ H5Pset_cache (fapl_g, mdc_nelmts, rdcc_nelmts,
+ cache_size*SQUARE (CH_SIZE), w0);
+ file = H5Fopen(FILE_NAME, H5F_ACC_RDWR, fapl_g);
+ dset = H5Dopen2(file, "dset", H5P_DEFAULT);
+ file_space = H5Dget_space(dset);
+ nio_g = 0;
+
+ for (i=0; i<CH_SIZE*DS_SIZE; i+=io_size) {
+#if 0
+ fprintf (stderr, "%5d\b\b\b\b\b", (int)i);
+ fflush (stderr);
+#endif
+ for (j=0; j<CH_SIZE*DS_SIZE; j+=io_size) {
+ hs_offset[0] = i;
+ hs_size[0] = MIN (io_size, CH_SIZE*DS_SIZE-i);
+ hs_offset[1] = j;
+ hs_size[1] = MIN (io_size, CH_SIZE*DS_SIZE-j);
+ mem_space = H5Screate_simple (2, hs_size, hs_size);
+ H5Sselect_hyperslab (file_space, H5S_SELECT_SET, hs_offset,
+ NULL, hs_size, NULL);
+
+ if (READ==op) {
+ H5Dread (dset, H5T_NATIVE_SCHAR, mem_space, file_space,
+ H5P_DEFAULT, buf);
+ } else {
+ H5Dwrite (dset, H5T_NATIVE_SCHAR, mem_space, file_space,
+ H5P_DEFAULT, buf);
+ }
+ H5Sclose (mem_space);
+ }
+ }
+
+ free (buf);
+ H5Sclose (file_space);
+ H5Dclose (dset);
+ H5Fclose (file);
+
+ return (double)SQUARE(CH_SIZE*DS_SIZE)/(double)nio_g;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_diag
+ *
+ * Purpose: Reads windows diagonally across the dataset. Each window is
+ * offset from the previous window by OFFSET in the x and y
+ * directions. The reading ends after the (k,k) value is read
+ * where k is the maximum index in the dataset.
+ *
+ * Return: Efficiency.
+ *
+ * Programmer: Robb Matzke
+ * Friday, May 15, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static double
+test_diag (int op, size_t cache_size, size_t io_size, size_t offset)
+{
+ hid_t file, dset, mem_space, file_space;
+ hsize_t i, hs_size[2];
+ hsize_t nio = 0;
+ hsize_t hs_offset[2];
+ signed char *buf = (signed char *)calloc(1, (size_t)(SQUARE (io_size)));
+ int mdc_nelmts;
+ size_t rdcc_nelmts;
+ double w0;
+
+ H5Pget_cache (fapl_g, &mdc_nelmts, &rdcc_nelmts, NULL, &w0);
+#ifdef DIAG_W0
+ w0 = DIAG_W0;
+#endif
+#ifdef DIAG_NRDCC
+ rdcc_nelmts = DIAG_NRDCC;
+#endif
+ H5Pset_cache (fapl_g, mdc_nelmts, rdcc_nelmts,
+ cache_size*SQUARE (CH_SIZE), w0);
+ file = H5Fopen(FILE_NAME, H5F_ACC_RDWR, fapl_g);
+ dset = H5Dopen2(file, "dset", H5P_DEFAULT);
+ file_space = H5Dget_space(dset);
+ nio_g = 0;
+
+ for (i=0, hs_size[0]=io_size; hs_size[0]==io_size; i+=offset) {
+ hs_offset[0] = hs_offset[1] = i;
+ hs_size[0] = hs_size[1] = MIN (io_size, CH_SIZE*DS_SIZE-i);
+ mem_space = H5Screate_simple (2, hs_size, hs_size);
+ H5Sselect_hyperslab (file_space, H5S_SELECT_SET, hs_offset, NULL,
+ hs_size, NULL);
+ if (READ==op) {
+ H5Dread (dset, H5T_NATIVE_SCHAR, mem_space, file_space,
+ H5P_DEFAULT, buf);
+ } else {
+ H5Dwrite (dset, H5T_NATIVE_SCHAR, mem_space, file_space,
+ H5P_DEFAULT, buf);
+ }
+ H5Sclose (mem_space);
+ nio += hs_size[0]*hs_size[1];
+ if (i>0) nio -= SQUARE (io_size-offset);
+ }
+
+ free (buf);
+ H5Sclose (file_space);
+ H5Dclose (dset);
+ H5Fclose (file);
+
+ /*
+ * The extra cast in the following statement is a bug workaround for the
+ * Win32 version 5.0 compiler.
+ * 1998-11-06 ptl
+ */
+ return (double)nio/(double)nio_g;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: main
+ *
+ * Purpose: See file prologue.
+ *
+ * Return: Success:
+ *
+ * Failure:
+ *
+ * Programmer: Robb Matzke
+ * Thursday, May 14, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+main (void)
+{
+ size_t io_size;
+ double effic, io_percent;
+ FILE *f, *d;
+ size_t cache_size;
+ double w0;
+
+ /*
+ * Create a global file access property list.
+ */
+ fapl_g = H5Pcreate (H5P_FILE_ACCESS);
+ H5Pget_cache (fapl_g, NULL, NULL, NULL, &w0);
+
+ /* Create the file */
+ create_dataset ();
+ f = fopen ("x-gnuplot", "w");
+
+ printf("Test %8s %8s %8s\n", "CacheSz", "ChunkSz", "Effic");
+ printf("--------- -------- -------- --------\n");
+
+#if 1
+ /*
+ * Test row-major reading of the dataset with various sizes of request
+ * windows.
+ */
+ if (RM_CACHE_STRT==RM_CACHE_END) {
+ fprintf (f, "set yrange [0:1.2]\n");
+ fprintf (f, "set ytics 0, 0.1, 1\n");
+ fprintf (f, "set xlabel \"%s\"\n",
+ "Request size as a fraction of chunk size");
+ fprintf (f, "set ylabel \"Efficiency\"\n");
+ fprintf (f, "set title \"Cache %d chunks, w0=%g, "
+ "Size=(total=%d, chunk=%d)\"\n",
+ RM_CACHE_STRT, w0, DS_SIZE*CH_SIZE, CH_SIZE);
+ } else {
+ fprintf (f, "set autoscale\n");
+ fprintf (f, "set hidden3d\n");
+ }
+
+ fprintf (f, "set terminal postscript\nset output \"x-rowmaj-rd.ps\"\n");
+ fprintf (f, "%s \"x-rowmaj-rd.dat\" title \"RowMaj-Read\" with %s\n",
+ RM_CACHE_STRT==RM_CACHE_END?"plot":"splot",
+ LINESPOINTS);
+ fprintf (f, "set terminal x11\nreplot\n");
+ d = fopen ("x-rowmaj-rd.dat", "w");
+ for (cache_size=RM_CACHE_STRT;
+ cache_size<=RM_CACHE_END;
+ cache_size+=RM_CACHE_DELT) {
+ for (io_percent=RM_START; io_percent<=RM_END; io_percent+=RM_DELTA) {
+ io_size = MAX (1, (size_t)(CH_SIZE*io_percent));
+ printf ("Rowmaj-rd %8d %8.2f", (int)cache_size, io_percent);
+ fflush (stdout);
+ effic = test_rowmaj (READ, cache_size, io_size);
+ printf (" %8.2f\n", effic);
+ if (RM_CACHE_STRT==RM_CACHE_END) {
+ fprintf (d, "%g %g\n", io_percent, effic);
+ } else {
+ fprintf (d, "%g\n", effic);
+ }
+ }
+ fprintf (d, "\n");
+ }
+ fclose (d);
+ fprintf (f, "pause -1\n");
+#endif
+
+#if 1
+ /*
+ * Test row-major writing of the dataset with various sizes of request
+ * windows.
+ */
+ if (RM_CACHE_STRT==RM_CACHE_END) {
+ fprintf (f, "set yrange [0:1.2]\n");
+ fprintf (f, "set ytics 0, 0.1, 1\n");
+ fprintf (f, "set xlabel \"%s\"\n",
+ "Request size as a fraction of chunk size");
+ fprintf (f, "set ylabel \"Efficiency\"\n");
+ fprintf (f, "set title \"Cache %d chunks,w0=%g, "
+ "Size=(total=%d, chunk=%d)\"\n",
+ RM_CACHE_STRT, w0, DS_SIZE*CH_SIZE, CH_SIZE);
+ } else {
+ fprintf (f, "set autoscale\n");
+ fprintf (f, "set hidden3d\n");
+ }
+
+ fprintf (f, "set terminal postscript\nset output \"x-rowmaj-wr.ps\"\n");
+ fprintf (f, "%s \"x-rowmaj-wr.dat\" title \"RowMaj-Write\" with %s\n",
+ RM_CACHE_STRT==RM_CACHE_END?"plot":"splot",
+ LINESPOINTS);
+ fprintf (f, "set terminal x11\nreplot\n");
+ d = fopen ("x-rowmaj-wr.dat", "w");
+ for (cache_size=RM_CACHE_STRT;
+ cache_size<=RM_CACHE_END;
+ cache_size+=RM_CACHE_DELT) {
+ for (io_percent=RM_START; io_percent<=RM_END; io_percent+=RM_DELTA) {
+ io_size = MAX (1, (size_t)(CH_SIZE*io_percent));
+ printf ("Rowmaj-wr %8d %8.2f", (int)cache_size, io_percent);
+ fflush (stdout);
+ effic = test_rowmaj (WRITE, cache_size, io_size);
+ printf (" %8.2f\n", effic);
+ if (RM_CACHE_STRT==RM_CACHE_END) {
+ fprintf (d, "%g %g\n", io_percent, effic);
+ } else {
+ fprintf (d, "%g\n", effic);
+ }
+ }
+ fprintf (d, "\n");
+ }
+ fclose (d);
+ fprintf (f, "pause -1\n");
+#endif
+
+#if 1
+ /*
+ * Test diagonal read
+ */
+ if (DIAG_CACHE_STRT==DIAG_CACHE_END) {
+ fprintf (f, "set yrange [0:1.2]\n");
+ fprintf (f, "set ytics 0, 0.1, 1\n");
+ fprintf (f, "set xlabel \"%s\"\n",
+ "Request size as a fraction of chunk size");
+ fprintf (f, "set ylabel \"Efficiency\"\n");
+ fprintf (f, "set title \"Cache %d chunks,w0=%g, "
+ "Size=(total=%d, chunk=%d)\"\n",
+ DIAG_CACHE_STRT, w0, DS_SIZE*CH_SIZE, CH_SIZE);
+ } else {
+ fprintf (f, "set autoscale\n");
+ fprintf (f, "set hidden3d\n");
+ }
+ fprintf (f, "set terminal postscript\nset output \"x-diag-rd.ps\"\n");
+ fprintf (f, "%s \"x-diag-rd.dat\" title \"Diag-Read\" with %s\n",
+ DIAG_CACHE_STRT==DIAG_CACHE_END?"plot":"splot", LINESPOINTS);
+ fprintf (f, "set terminal x11\nreplot\n");
+ d = fopen ("x-diag-rd.dat", "w");
+ for (cache_size=DIAG_CACHE_STRT;
+ cache_size<=DIAG_CACHE_END;
+ cache_size+=DIAG_CACHE_DELT) {
+ for (io_percent=DIAG_START; io_percent<=DIAG_END; io_percent+=DIAG_DELTA) {
+ io_size = MAX (1, (size_t)(CH_SIZE*io_percent));
+ printf ("Diag-rd %8d %8.2f", (int)cache_size, io_percent);
+ fflush (stdout);
+ effic = test_diag (READ, cache_size, io_size, MAX (1, io_size/2));
+ printf (" %8.2f\n", effic);
+ if (DIAG_CACHE_STRT==DIAG_CACHE_END) {
+ fprintf (d, "%g %g\n", io_percent, effic);
+ } else {
+ fprintf (d, "%g\n", effic);
+ }
+ }
+ fprintf (d, "\n");
+ }
+ fclose (d);
+ fprintf (f, "pause -1\n");
+#endif
+
+#if 1
+ /*
+ * Test diagonal write
+ */
+ if (DIAG_CACHE_STRT==DIAG_CACHE_END) {
+ fprintf (f, "set yrange [0:1.2]\n");
+ fprintf (f, "set ytics 0, 0.1, 1\n");
+ fprintf (f, "set xlabel \"%s\"\n",
+ "Request size as a fraction of chunk size");
+ fprintf (f, "set ylabel \"Efficiency\"\n");
+ fprintf (f, "set title \"Cache %d chunks, w0=%g, "
+ "Size=(total=%d, chunk=%d)\"\n",
+ DIAG_CACHE_STRT, w0, DS_SIZE*CH_SIZE, CH_SIZE);
+ } else {
+ fprintf (f, "set autoscale\n");
+ fprintf (f, "set hidden3d\n");
+ }
+ fprintf (f, "set terminal postscript\nset output \"x-diag-wr.ps\"\n");
+ fprintf (f, "%s \"x-diag-wr.dat\" title \"Diag-Write\" with %s\n",
+ DIAG_CACHE_STRT==DIAG_CACHE_END?"plot":"splot", LINESPOINTS);
+ fprintf (f, "set terminal x11\nreplot\n");
+ d = fopen ("x-diag-wr.dat", "w");
+ for (cache_size=DIAG_CACHE_STRT;
+ cache_size<=DIAG_CACHE_END;
+ cache_size+=DIAG_CACHE_DELT) {
+ for (io_percent=DIAG_START;
+ io_percent<=DIAG_END;
+ io_percent+=DIAG_DELTA) {
+ io_size = MAX (1, (size_t)(CH_SIZE*io_percent));
+ printf ("Diag-wr %8d %8.2f", (int)cache_size, io_percent);
+ fflush (stdout);
+ effic = test_diag (WRITE, cache_size, io_size, MAX (1, io_size/2));
+ printf (" %8.2f\n", effic);
+ if (DIAG_CACHE_STRT==DIAG_CACHE_END) {
+ fprintf (d, "%g %g\n", io_percent, effic);
+ } else {
+ fprintf (d, "%g\n", effic);
+ }
+ }
+ fprintf (d, "\n");
+ }
+ fclose (d);
+ fprintf (f, "pause -1\n");
+#endif
+
+
+ H5Pclose (fapl_g);
+ fclose (f);
+ return 0;
+}
+
diff --git a/tools/test/perform/gen_report.pl b/tools/test/perform/gen_report.pl
new file mode 100644
index 0000000..285f5d7
--- /dev/null
+++ b/tools/test/perform/gen_report.pl
@@ -0,0 +1,527 @@
+#!/usr/bin/perl
+#
+# 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.
+#
+
+#
+# Generates an ASCII and Excel-importable file of tables representing
+# the output of running the "pio_perf" command. The name of the input
+# file is important. The name should reflect the command-line options
+# used in the performance test. It needs to be of the form:
+#
+# f#[GMK].i#.d#.X#[GMK].x#[GMK]..*
+#
+# For example:
+#
+# PIO_output_f1G.i2.d1.X2M.x128K.frost
+#
+# for a 1GB sized file ran for 2 iterations with 1 dataset from xfer
+# buffer size of 128KB to 2MB on the frost machine.
+#
+# The output file will have the same name as the input, but will append
+# ".ascii" for the ASCII file and ".excel" for the Excel-importable
+# file.
+#
+# The data structure used in this program looks like:
+#
+# %results = {
+# num_proc => (
+# %xfer_size => (
+# %posix = {
+# 'write-only' => ##,
+# 'write-close' => ##,
+# 'read-only' => ##,
+# 'read-close' => ##
+# },
+# %mpio = {
+# 'write-only' => ##,
+# 'write-close' => ##,
+# 'read-only' => ##,
+# 'read-close' => ##
+# },
+# %phdf = {
+# 'write-only' => ##,
+# 'write-close' => ##,
+# 'read-only' => ##,
+# 'read-close' => ##
+# }
+# )
+# )
+# }
+
+use IO::Handle;
+use Getopt::Long;
+use List::Util qw[max];
+
+if ($#ARGV == -1) {
+ usage();
+}
+
+my ($ascii_output, $excel_output);
+
+GetOptions("data_type=s"=>\$data_type,
+ "buffer_size=i"=>\$transfer_buffer_size,
+ "procs=i"=>\$num_procs_graph,
+ "help!"=>\$help,
+ "throughput=s"=>\$throughput_type,
+ "io_type=i"=>\$io_type,
+ "3d!"=>\$plot_3d);
+
+usage() if $help or !@ARGV;
+
+$throughput_type = "average" if !$throughput_type;
+$io_type = 7 if !$io_type;
+
+foreach my $arg (@ARGV) {
+
+ if ($arg !~ /^-/) {
+ $arg =~ /f([0-9]+.)\.i([0-9]+)\.d([0-9]+)\.X([0-9]+.)\.x([0-9]+.)\.(.*)/;
+
+ my $output = $arg . $1 . ".X" . $4 . ".x" . $5 . "." . $6;
+
+ $ascii_output = $output . ".ascii";
+ $excel_output = $output . ".excel";
+
+ open(INPUT, "<$arg") or die "error: cannot open file $arg: $!\n";
+ open(ASCII_OUTPUT, ">$ascii_output") or
+ die "error: cannot open file $ascii_output: $!\n";
+ open(EXCEL_OUTPUT, ">$excel_output") or
+ die "error: cannot open file $excel_output: $!\n";
+ }
+ else
+ {
+ die "error: unrecognized option: $arg\n";
+ }
+}
+
+my %results;
+my $num_procs = 0;
+my ($xfer_size, $avg_type, $type);
+
+my $posix = 0, $mpio = 1, $phdf5 = 2;
+
+##"==== End of Parameters ===="
+
+while (<INPUT>) {
+ if (/Number of processors = ([0-9]+)/) {
+ $num_procs = $1;
+ }
+
+ if (/Transfer Buffer Size: ([0-9]+)/) {
+ $xfer_size = $1;
+ }
+
+ $type = $posix if /POSIX/;
+ $type = $mpio if /MPIO/;
+ $type = $phdf5 if /PHDF5/;
+
+ if (/Write Open/) {
+ $avg_type = "write-close";
+ } elsif (/Write/) {
+ $avg_type = "write-only";
+ } elsif (/Read Open/) {
+ $avg_type = "read-close";
+ } elsif (/Read/) {
+ $avg_type = "read-only";
+ }
+
+ if($throughput_type eq "max")
+ {
+ if (/Maximum Throughput: ( {0,2}[0-9]+\.[0-9]{2}) MB\/s/) {
+ $results{$num_procs}{$xfer_size}[$type]{$avg_type} = $1;
+ }
+ }
+ elsif($throughput_type eq "min")
+ {
+ if (/Minimum Throughput: ( {0,2}[0-9]+\.[0-9]{2}) MB\/s/) {
+ $results{$num_procs}{$xfer_size}[$type]{$avg_type} = $1;
+ }
+ }
+ elsif($throughput_type eq "average")
+ {
+ if (/Average Throughput: ( {0,2}[0-9]+\.[0-9]{2}) MB\/s/) {
+ $results{$num_procs}{$xfer_size}[$type]{$avg_type} = $1;
+ }
+ }
+}
+
+sub usage {
+ print "Usage: gen_reporl.pl [options] FILE
+ options are:\n
+ -data_type \"data_type\" plots the results for \"write-only\",\"read-only\", \"write-close\", or \"read-close\" (default is write-only)\n
+ -buffer_size \"buffer_size\" plots data from this buffer size (in kilobytes, default is 128)\n
+ -procs \"num_procs\" plots data from the run with num_procs processors (default is the highest number of processors for which there is data).\n
+ -throughput \"throughput_type\" plots either the \"max\", \"min\", or \"average\" throughput (default is average)\n
+ -io_type \"io_type\" where \"io_type\" is the bitwise or of the io_type for which plotting is desired (1 for POSIX, 2 for MPIO, 4 for PHDF5 (default is 7 (all))\n
+ -3d if present, does a 3d plot in addition to the normal ones\n";
+
+ exit 1;
+}
+
+sub create_excel_output_header {
+ my $output_header;
+ my $kb = 1024;
+ my $mb = $kb * $kb;
+
+ foreach my $key (sort { $a <=> $b } keys(%{$results{$num_procs}})) {
+ if ($key < $mb) {
+ $key /= $kb;
+ $output_header .= "\t". $key . "K";
+ } else {
+ $key /= $mb;
+ $output_header .= "\t". $key . "M";
+ }
+ }
+
+ $output_header;
+}
+
+sub create_excel_output_string {
+ my ($t) = @_;
+ my $output_content = "";
+
+ foreach my $procs (sort { $b <=> $a } keys(%results)) {
+ $output_content .= "\n$procs Procs";
+ $output_content .= "\n" . create_excel_output_header;
+ $output_content .= "\n POSIX";
+
+ foreach my $xfer (sort { $a <=> $b } keys(%{$results{$procs}})) {
+ $output_content .= "\t$results{$procs}{$xfer}[0]{$t}";
+ }
+
+ $output_content .= "\n MPIO";
+
+ foreach my $xfer (sort { $a <=> $b } keys(%{$results{$procs}})) {
+ $output_content .= "\t$results{$procs}{$xfer}[1]{$t}";
+ }
+
+ $output_content .= "\n PHDF5";
+
+ foreach my $xfer (sort { $a <=> $b } keys(%{$results{$procs}})) {
+ $output_content .= "\t$results{$procs}{$xfer}[2]{$t}";
+ }
+
+ $output_content .= "\n";
+ }
+
+ $output_content;
+}
+
+sub is_defined {
+ my ($t) = @_;
+ my $def = 1;
+
+ foreach my $procs (sort { $b <=> $a } keys(%results)) {
+ foreach my $xfer (sort { $a <=> $b } keys(%{$results{$procs}})) {
+ if (!defined($results{$procs}{$xfer}[0]{$t})) {
+ $def = 0;
+ }
+ }
+
+ foreach my $xfer (sort { $a <=> $b } keys(%{$results{$procs}})) {
+ if (!defined($results{$procs}{$xfer}[0]{$t})) {
+ $def = 0;
+ }
+ }
+
+ foreach my $xfer (sort { $a <=> $b } keys(%{$results{$procs}})) {
+ if (!defined($results{$procs}{$xfer}[0]{$t})) {
+ $def = 0;
+ }
+ }
+ }
+
+ $def;
+}
+
+sub write_excel_file {
+ print EXCEL_OUTPUT "\nWrite-Only\n";
+ print EXCEL_OUTPUT create_excel_output_string("write-only");
+ print EXCEL_OUTPUT "\nWrite-Close\n";
+ print EXCEL_OUTPUT create_excel_output_string("write-close");
+
+ if (is_defined("read-only")) {
+ print EXCEL_OUTPUT "\nRead-Only\n";
+ print EXCEL_OUTPUT create_excel_output_string("read-only");
+ print EXCEL_OUTPUT "\nRead-Close\n";
+ print EXCEL_OUTPUT create_excel_output_string("read-close");
+ }
+}
+
+sub create_ascii_output_header {
+ my $output_header = " " x 12 . "|";
+ my $kb = 1024;
+ my $mb = $kb * $kb;
+
+ foreach my $key (sort { $a <=> $b } keys(%{$results{$num_procs}})) {
+ if ($key < $mb) {
+ $key /= $kb;
+ $output_header = sprintf("$output_header %-4s |", $key . "K");
+ } else {
+ $key /= $mb;
+ $output_header = sprintf("$output_header %-4s |", $key . "M");
+ }
+ }
+
+ $output_header;
+}
+
+sub create_ascii_output_string {
+ my ($t) = @_;
+ my $output_content = "";
+ my $output_header = create_ascii_output_header;
+
+ foreach my $procs (sort { $b <=> $a } keys(%results)) {
+ $output_content .= "\n$procs Procs";
+ $output_content .= "\n$output_header\n";
+ $output_content .= "-" x length($output_header);
+ $output_content .= "\n POSIX |";
+
+ foreach my $xfer (sort { $a <=> $b } keys(%{$results{$procs}})) {
+ $output_content = sprintf("$output_content %-6s |",
+ $results{$procs}{$xfer}[0]{$t});
+ }
+
+ $output_content .= "\n ";
+ $output_content .= "-" x (length($output_header) - 4);
+ $output_content .= "\n MPI/IO |";
+
+ foreach my $xfer (sort { $a <=> $b } keys(%{$results{$procs}})) {
+ $output_content = sprintf("$output_content %-6s |",
+ $results{$procs}{$xfer}[1]{$t});
+ }
+
+ $output_content .= "\n ";
+ $output_content .= "-" x (length($output_header) - 4);
+ $output_content .= "\n PHDF5 |";
+
+ foreach my $xfer (sort { $a <=> $b } keys(%{$results{$procs}})) {
+ $output_content = sprintf("$output_content %-6s |",
+ $results{$procs}{$xfer}[2]{$t});
+ }
+
+ $output_content .= "\n";
+ $output_content .= "=" x length($output_header);
+ $output_content .= "\n";
+ }
+
+ $output_content;
+}
+
+sub write_ascii_file {
+ print ASCII_OUTPUT "\nWrite-Only";
+ print ASCII_OUTPUT "\n----------\n";
+ print ASCII_OUTPUT create_ascii_output_string("write-only");
+ print ASCII_OUTPUT "\n\nWrite-Close";
+ print ASCII_OUTPUT "\n-----------\n";
+ print ASCII_OUTPUT create_ascii_output_string("write-close");
+
+ if (is_defined("read-only")) {
+ print ASCII_OUTPUT "\n\nRead-Only";
+ print ASCII_OUTPUT "\n---------\n";
+ print ASCII_OUTPUT create_ascii_output_string("read-only");
+ print ASCII_OUTPUT "\n\nRead-Close";
+ print ASCII_OUTPUT "\n----------\n";
+ print ASCII_OUTPUT create_ascii_output_string("read-close");
+ }
+}
+
+sub draw_plot
+{
+ my($p_3d) = @_;
+
+ if($p_3d)
+ {
+ $counter = 3;
+ print GNUPLOT_PIPE "splot ";
+ }
+ else
+ {
+ $counter = 2;
+ print GNUPLOT_PIPE "plot ";
+ }
+
+ if($io_type & 1) {
+ print GNUPLOT_PIPE " \"gnuplot.data\" using 1:";
+
+ if($p_3d) { print GNUPLOT_PIPE "2:"; }
+
+ print GNUPLOT_PIPE $counter . " title 'POSIX' with linespoints";
+ $counter = $counter + 1;
+ }
+ if($io_type & 2) {
+ if($io_type & 1) { print GNUPLOT_PIPE ", "; }
+ print GNUPLOT_PIPE "\"gnuplot.data\" using 1:";
+
+ if($p_3d) { print GNUPLOT_PIPE "2:"; }
+
+ print GNUPLOT_PIPE $counter . " title 'MPIO' with linespoints";
+ $counter = $counter + 1;
+ if($io_type & 4) { print GNUPLOT_PIPE ", ";}
+ }
+ if($io_type & 4) {
+ print GNUPLOT_PIPE " \"gnuplot.data\" using 1:";
+
+ if($p_3d) { print GNUPLOT_PIPE "2:"; }
+
+ print GNUPLOT_PIPE $counter . " title 'PHDF5' with linespoints";
+
+ }
+ print GNUPLOT_PIPE "\n";
+}
+
+
+sub plot_default_graph1 {
+ open(GNUPLOT_DATA_OUTPUT, ">gnuplot.data") or
+ die "error: cannot open file gnuplot.data: $!\n";
+
+ $transfer_buffer_size = 128 if !$transfer_buffer_size;
+ $data_type = "write-only" if !$data_type;
+
+ #set up the plot
+ print GNUPLOT_PIPE "set term x11 1\n";
+ print GNUPLOT_PIPE "set xlabel \"Number of Processors\"\n";
+ print GNUPLOT_PIPE "set title \"" . $data_type . " Performance (Speed vs. Num. Procs)\"\n";
+ print GNUPLOT_PIPE "set ylabel \"Bandwdith (MB/s)\"\n";
+ print GNUPLOT_PIPE "set label 1 \"Transfer buffer size: " . $transfer_buffer_size . "K\" at graph 0.7, graph 0.7 left \n";
+
+#the next line attempts to hack gnuplot to get around it's inability to linearly scale, but logarithmically label an axis
+ print GNUPLOT_PIPE "set xtics (\"1\" 1, \"2\" 2, \"4\" 4, \"8\" 8, \"16\" 16, \"32\" 32, \"64\" 64, \"128\" 128, \"256\" 256, \"512\" 512, \"1024\" 1024)\n";
+
+
+ foreach $proc (sort { $a <=> $b }( keys %results ))
+ {
+ print GNUPLOT_DATA_OUTPUT $proc . "\t";
+ if($io_type & 1) {
+ print GNUPLOT_DATA_OUTPUT $results{$proc}{$transfer_buffer_size*1024}[0]{$data_type} . "\t";
+ }
+ if($io_type & 2) {
+ print GNUPLOT_DATA_OUTPUT $results{$proc}{$transfer_buffer_size*1024}[1]{$data_type}. "\t";
+ }
+ if($io_type & 4) {
+ print GNUPLOT_DATA_OUTPUT $results{$proc}{$transfer_buffer_size*1024}[2]{$data_type};
+ }
+ print GNUPLOT_DATA_OUTPUT "\n";
+
+ }
+
+ close(GNUPLOT_DATA_OUTPUT);
+
+ draw_plot(0);
+
+ unlink(GNUPLOT_DATA_OUTPUT);
+
+}
+
+
+sub plot_default_graph2 {
+ open(GNUPLOT_DATA_OUTPUT, ">gnuplot.data") or
+ die "error: cannot open file gnuplot.data: $!\n";
+
+ $num_procs_graph = max(sort { $a <=> $b }( keys %results )) if !$num_procs_graph;
+ print "min-rpocs: " . $num_procs_graph;
+ $data_type = "write-only" if !$data_type;
+
+ #set up the plot
+ print GNUPLOT_PIPE "set term x11 2\n";
+ print GNUPLOT_PIPE "set xlabel \"Transfer Buffer Size (in bytes)\"\n";
+ print GNUPLOT_PIPE "set title \"" . $data_type . " Performance (Speed vs. Transfer Buffer Size)\"\n";
+ print GNUPLOT_PIPE "set ylabel \"Bandwdith (MB/s)\"\n";
+ print GNUPLOT_PIPE "set label 1 \"Procs: " . $num_procs_graph . "\" at graph 0.7, graph 0.7 left \n";
+
+#the next line attempts to hack gnuplot to get around it's inability to linearly scale, but logarithmically label an axis
+ print GNUPLOT_PIPE "set xtics (\"4K\" 4*1024, \"8K\" 8*1024, \"16K\" 16*1024, \"32K\" 32*1024, \"64K\" 64*1024, \"128K\" 128*1024, \"256K\" 256*1024, \"512K\" 512*1024, \"1M\" 1024*1024, \"2M\" 2048*1024, \"4M\" 4096*1024, \"8M\" 8192*1024, \"16M\" 16384*1024)\n";
+
+ foreach $xfer (sort {$a <=> $b} ( keys %{$results{$num_procs_graph}} ))
+ {
+ print GNUPLOT_DATA_OUTPUT $xfer . "\t";
+ if($io_type & 1) {
+ print GNUPLOT_DATA_OUTPUT $results{$num_procs_graph}{$xfer}[0]{$data_type} . "\t";
+ }
+ if($io_type & 2) {
+ print GNUPLOT_DATA_OUTPUT $results{$num_procs_graph}{$xfer}[1]{$data_type}. "\t";
+ }
+ if($io_type & 4) {
+ print GNUPLOT_DATA_OUTPUT $results{$num_procs_graph}{$xfer}[2]{$data_type};
+ }
+ print GNUPLOT_DATA_OUTPUT "\n";
+
+ }
+
+ close(GNUPLOT_DATA_OUTPUT);
+
+ draw_plot(0);
+
+ unlink(GNUPLOT_DATA_OUTPUT);
+}
+
+sub plot_3d_graph3 {
+ open(GNUPLOT_DATA_OUTPUT, ">gnuplot.data") or
+ die "error: cannot open file gnuplot.data: $!\n";
+
+ #set up the plot
+ print GNUPLOT_PIPE "set term x11 3\n";
+ print GNUPLOT_PIPE "set xlabel \"Num. Processors\"\n";
+ print GNUPLOT_PIPE "set title \"Write Speed v. No. Procs v. Buffer Size\"\n";
+ print GNUPLOT_PIPE "set ylabel \"Buffer Size (bytes)\"\n";
+ print GNUPLOT_PIPE "set zlabel \"Bandwidth (in MB/s)\"\n";
+ print GNUPLOT_PIPE "set nolabel\n";
+ print GNUPLOT_PIPE "set dgrid3d 30,30\n";
+ print GNUPLOT_PIPE "set hidden3d\n";
+
+#the next lines attempts to hack gnuplot to get around it's inability to linearly scale, but logarithmically label an axis
+ print GNUPLOT_PIPE "set xtics (\"1\" 1, \"2\" 2, \"4\" 4, \"8\" 8, \"16\" 16, \"32\" 32, \"64\" 64, \"128\" 128, \"256\" 256, \"512\" 512, \"1024\" 1024)\n";
+ print GNUPLOT_PIPE "set ytics (\"4K\" 4*1024, \"8K\" 8*1024, \"16K\" 16*1024, \"32K\" 32*1024, \"64K\" 64*1024, \"128K\" 128*1024, \"256K\" 256*1024, \"512K\" 512*1024, \"1M\" 1024*1024, \"2M\" 2048*1024, \"4M\" 4096*1024, \"8M\" 8192*1024, \"16M\" 16384*1024)\n";
+
+
+#Read speed on z-axis, processors on x, buffer size on y.
+
+ foreach $proc (sort { $a <=> $b }( keys %results ))
+ {
+ foreach $xfer (sort {$a <=> $b} ( keys %{$results{$proc}} ))
+ {
+ print GNUPLOT_DATA_OUTPUT $proc . "\t" . $xfer . "\t";
+ if($io_type & 1) {
+ print GNUPLOT_DATA_OUTPUT $results{$proc}{$xfer}[0]{"write-only"} . "\t";
+ }
+ if($io_type & 2) {
+ print GNUPLOT_DATA_OUTPUT $results{$proc}{$xfer}[1]{"write-only"}. "\t";
+ }
+ if($io_type & 4) {
+ print GNUPLOT_DATA_OUTPUT $results{$proc}{$xfer}[2]{"write-only"};
+ }
+ print GNUPLOT_DATA_OUTPUT "\n";
+
+ }
+ }
+
+ close(GNUPLOT_DATA_OUTPUT);
+
+ draw_plot(1);
+
+ unlink(GNUPLOT_DATA_OUTPUT);
+}
+
+open(GNUPLOT_PIPE, "| tee gnuplot.script | gnuplot -persist") || die "Couldn't run gnuplot: $!\n";
+GNUPLOT_PIPE->autoflush(1);
+
+write_excel_file;
+write_ascii_file;
+plot_default_graph1;
+sleep 1;
+plot_default_graph2;
+sleep 1;
+
+plot_3d_graph3 if $plot_3d;
+close(GNUPLOT_PIPE);
diff --git a/tools/test/perform/iopipe.c b/tools/test/perform/iopipe.c
new file mode 100644
index 0000000..fd62d37
--- /dev/null
+++ b/tools/test/perform/iopipe.c
@@ -0,0 +1,508 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Programmer: Robb Matzke <matzke@llnl.gov>
+ * Thursday, March 12, 1998
+ */
+
+/* See H5private.h for how to include headers */
+#include "hdf5.h"
+
+#include "H5private.h"
+
+#ifdef H5_HAVE_SYS_TIMEB
+#include <sys/timeb.h>
+#endif
+
+
+#define RAW_FILE_NAME "iopipe.raw"
+#define HDF5_FILE_NAME "iopipe.h5"
+#define HEADING "%-16s"
+#define PROGRESS '='
+
+#if 0
+/* Normal testing */
+#define REQUEST_SIZE_X 4579
+#define REQUEST_SIZE_Y 4579
+#define NREAD_REQUESTS 45
+#define NWRITE_REQUESTS 45
+#else
+/* Speedy testing */
+#define REQUEST_SIZE_X 1000
+#define REQUEST_SIZE_Y 1000
+#define NREAD_REQUESTS 45
+#define NWRITE_REQUESTS 45
+#endif
+
+
+/*-------------------------------------------------------------------------
+ * Function: print_stats
+ *
+ * Purpose: Prints statistics
+ *
+ * Return: void
+ *
+ * Programmer: Robb Matzke
+ * Thursday, March 12, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifdef H5_HAVE_GETRUSAGE
+static void
+print_stats (const char *prefix,
+ struct rusage *r_start, struct rusage *r_stop,
+ struct timeval *t_start, struct timeval *t_stop,
+ size_t nbytes)
+#else /* H5_HAVE_GETRUSAGE */
+static void
+print_stats (const char *prefix,
+ struct timeval *r_start, struct timeval *r_stop,
+ struct timeval *t_start, struct timeval *t_stop,
+ size_t nbytes)
+#endif /* H5_HAVE_GETRUSAGE */
+{
+ double e_time, bw;
+#ifdef H5_HAVE_GETRUSAGE
+ double u_time, s_time;
+
+ u_time = ((double)(r_stop->ru_utime.tv_sec)+
+ (double)(r_stop->ru_utime.tv_usec)/(double)1000000.0F) -
+ ((double)(r_start->ru_utime.tv_sec)+
+ (double)(r_start->ru_utime.tv_usec)/(double)1000000.0F);
+
+ s_time = ((double)(r_stop->ru_stime.tv_sec)+
+ (double)(r_stop->ru_stime.tv_usec)/(double)1000000.0F) -
+ ((double)(r_start->ru_stime.tv_sec)+
+ (double)(r_start->ru_stime.tv_usec)/(double)1000000.0F);
+#endif
+#ifndef H5_HAVE_SYS_TIMEB
+ e_time = ((double)(t_stop->tv_sec)+
+ (double)(t_stop->tv_usec)/(double)1000000.0F) -
+ ((double)(t_start->tv_sec)+
+ (double)(t_start->tv_usec)/(double)1000000.0F);
+#else
+ e_time = ((double)(t_stop->tv_sec)+
+ (double)(t_stop->tv_usec)/(double)1000.0F) -
+ ((double)(t_start->tv_sec)+
+ (double)(t_start->tv_usec)/(double)1000.0F);
+#endif
+ bw = (double)nbytes / e_time;
+
+#ifdef H5_HAVE_GETRUSAGE
+ printf (HEADING "%1.2fuser %1.2fsystem %1.2felapsed %1.2fMB/s\n",
+ prefix, u_time, s_time, e_time, bw/(1024*1024));
+#else
+ printf (HEADING "%1.2felapsed %1.2fMB/s\n",
+ prefix, e_time, bw/(1024*1024));
+#endif
+
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: synchronize
+ *
+ * Purpose:
+ *
+ * Return: void
+ *
+ * Programmer: Robb Matzke
+ * Thursday, March 12, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+synchronize (void)
+{
+#ifdef H5_HAVE_SYSTEM
+#if defined(H5_HAVE_WIN32_API) && ! defined(__CYGWIN__)
+ _flushall();
+#else
+ int status;
+
+ status = HDsystem("sync");
+ HDassert(status >= 0);
+
+ status = HDsystem("df >/dev/null");
+ HDassert(status >= 0);
+#endif
+#endif
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: main
+ *
+ * Purpose:
+ *
+ * Return: Success:
+ *
+ * Failure:
+ *
+ * Programmer: Robb Matzke
+ * Thursday, March 12, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+main (void)
+{
+ static hsize_t size[2] = {REQUEST_SIZE_X, REQUEST_SIZE_Y};
+ static unsigned nread = NREAD_REQUESTS, nwrite = NWRITE_REQUESTS;
+
+ unsigned char *the_data = NULL;
+ hid_t file, dset, file_space = -1;
+ herr_t status;
+#ifdef H5_HAVE_GETRUSAGE
+ struct rusage r_start, r_stop;
+#else
+ struct timeval r_start, r_stop;
+#endif
+ struct timeval t_start, t_stop;
+ int fd;
+ unsigned u;
+ hssize_t n;
+ off_t offset;
+ hsize_t start[2];
+ hsize_t count[2];
+
+
+#ifdef H5_HAVE_SYS_TIMEB
+ struct _timeb *tbstart = malloc(sizeof(struct _timeb));
+ struct _timeb *tbstop = malloc(sizeof(struct _timeb));
+#endif
+ /*
+ * The extra cast in the following statement is a bug workaround for the
+ * Win32 version 5.0 compiler.
+ * 1998-11-06 ptl
+ */
+ printf ("I/O request size is %1.1fMB\n",
+ (double)(hssize_t)(size[0]*size[1])/(double)1024.0F*(double)1024);
+
+ /* Open the files */
+ file = H5Fcreate (HDF5_FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ assert (file>=0);
+ fd = HDopen (RAW_FILE_NAME, O_RDWR|O_CREAT|O_TRUNC, 0666);
+ assert (fd>=0);
+
+ /* Create the dataset */
+ file_space = H5Screate_simple (2, size, size);
+ assert(file_space >= 0);
+ dset = H5Dcreate2(file, "dset", H5T_NATIVE_UCHAR, file_space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ assert(dset >= 0);
+ the_data = (unsigned char *)malloc((size_t)(size[0] * size[1]));
+
+ /* initial fill for lazy malloc */
+ HDmemset(the_data, 0xAA, (size_t)(size[0] * size[1]));
+
+ /* Fill raw */
+ synchronize ();
+#ifdef H5_HAVE_GETRUSAGE
+ HDgetrusage(RUSAGE_SELF, &r_start);
+#endif
+#ifdef H5_HAVE_GETTIMEOFDAY
+ HDgettimeofday(&t_start, NULL);
+#else
+#ifdef H5_HAVE_SYS_TIMEB
+ _ftime(tbstart);
+#endif
+#endif
+ fprintf (stderr, HEADING, "fill raw");
+ for(u = 0; u < nwrite; u++) {
+ putc (PROGRESS, stderr);
+ HDfflush(stderr);
+ HDmemset(the_data, 0xAA, (size_t)(size[0]*size[1]));
+ }
+#ifdef H5_HAVE_GETRUSAGE
+ HDgetrusage(RUSAGE_SELF, &r_stop);
+#endif
+#ifdef H5_HAVE_GETTIMEOFDAY
+ HDgettimeofday(&t_stop, NULL);
+#else
+#ifdef H5_HAVE_SYS_TIMEB
+ _ftime(tbstop);
+ t_start.tv_sec = tbstart->time;
+ t_start.tv_usec = tbstart->millitm;
+ t_stop.tv_sec = tbstop->time;
+ t_stop.tv_usec = tbstop->millitm;
+#endif
+#endif
+ putc ('\n', stderr);
+ print_stats ("fill raw",
+ &r_start, &r_stop, &t_start, &t_stop,
+ (size_t)(nread*size[0]*size[1]));
+
+
+ /* Fill hdf5 */
+ synchronize ();
+#ifdef H5_HAVE_GETRUSAGE
+ HDgetrusage(RUSAGE_SELF, &r_start);
+#endif
+#ifdef H5_HAVE_GETTIMEOFDAY
+ HDgettimeofday(&t_start, NULL);
+#else
+#ifdef H5_HAVE_SYS_TIMEB
+ _ftime(tbstart);
+#endif
+#endif
+ fprintf (stderr, HEADING, "fill hdf5");
+ for(u = 0; u < nread; u++) {
+ putc (PROGRESS, stderr);
+ HDfflush(stderr);
+ status = H5Dread (dset, H5T_NATIVE_UCHAR, file_space, file_space,
+ H5P_DEFAULT, the_data);
+ assert (status>=0);
+ }
+#ifdef H5_HAVE_GETRUSAGE
+ HDgetrusage(RUSAGE_SELF, &r_stop);
+#endif
+#ifdef H5_HAVE_GETTIMEOFDAY
+ HDgettimeofday(&t_stop, NULL);
+#else
+#ifdef H5_HAVE_SYS_TIMEB
+ _ftime(tbstop);
+ t_start.tv_sec = tbstart->time;
+ t_start.tv_usec = tbstart->millitm;
+ t_stop.tv_sec = tbstop->time;
+ t_stop.tv_usec = tbstop->millitm;
+#endif
+#endif
+ putc ('\n', stderr);
+ print_stats ("fill hdf5",
+ &r_start, &r_stop, &t_start, &t_stop,
+ (size_t)(nread*size[0]*size[1]));
+
+ /* Write the raw dataset */
+ synchronize ();
+#ifdef H5_HAVE_GETRUSAGE
+ HDgetrusage(RUSAGE_SELF, &r_start);
+#endif
+#ifdef H5_HAVE_GETTIMEOFDAY
+ HDgettimeofday(&t_start, NULL);
+#else
+#ifdef H5_HAVE_SYS_TIMEB
+ _ftime(tbstart);
+#endif
+#endif
+ fprintf (stderr, HEADING, "out raw");
+ for(u = 0; u < nwrite; u++) {
+ putc (PROGRESS, stderr);
+ HDfflush(stderr);
+ offset = HDlseek (fd, (off_t)0, SEEK_SET);
+ assert (0==offset);
+ n = HDwrite (fd, the_data, (size_t)(size[0]*size[1]));
+ assert (n>=0 && (size_t)n==size[0]*size[1]);
+ }
+#ifdef H5_HAVE_GETRUSAGE
+ HDgetrusage(RUSAGE_SELF, &r_stop);
+#endif
+#ifdef H5_HAVE_GETTIMEOFDAY
+ HDgettimeofday(&t_stop, NULL);
+#else
+#ifdef H5_HAVE_SYS_TIMEB
+ _ftime(tbstop);
+ t_start.tv_sec = tbstart->time;
+ t_start.tv_usec = tbstart->millitm;
+ t_stop.tv_sec = tbstop->time;
+ t_stop.tv_usec = tbstop->millitm;
+#endif
+#endif
+ putc ('\n', stderr);
+ print_stats ("out raw",
+ &r_start, &r_stop, &t_start, &t_stop,
+ (size_t)(nread*size[0]*size[1]));
+
+ /* Write the hdf5 dataset */
+ synchronize ();
+#ifdef H5_HAVE_GETRUSAGE
+ HDgetrusage(RUSAGE_SELF, &r_start);
+#endif
+#ifdef H5_HAVE_GETTIMEOFDAY
+ HDgettimeofday(&t_start, NULL);
+#else
+#ifdef H5_HAVE_SYS_TIMEB
+ _ftime(tbstart);
+#endif
+#endif
+ fprintf (stderr, HEADING, "out hdf5");
+ for(u = 0; u < nwrite; u++) {
+ putc (PROGRESS, stderr);
+ HDfflush(stderr);
+ status = H5Dwrite (dset, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL,
+ H5P_DEFAULT, the_data);
+ assert (status>=0);
+ }
+#ifdef H5_HAVE_GETRUSAGE
+ HDgetrusage(RUSAGE_SELF, &r_stop);
+#endif
+#ifdef H5_HAVE_GETTIMEOFDAY
+ HDgettimeofday(&t_stop, NULL);
+#else
+#ifdef H5_HAVE_SYS_TIMEB
+ _ftime(tbstop);
+ t_start.tv_sec = tbstart->time;
+ t_start.tv_usec = tbstart->millitm;
+ t_stop.tv_sec = tbstop->time;
+ t_stop.tv_usec = tbstop->millitm;
+#endif
+#endif
+ putc ('\n', stderr);
+ print_stats ("out hdf5",
+ &r_start, &r_stop, &t_start, &t_stop,
+ (size_t)(nread*size[0]*size[1]));
+
+ /* Read the raw dataset */
+ synchronize ();
+#ifdef H5_HAVE_GETRUSAGE
+ HDgetrusage(RUSAGE_SELF, &r_start);
+#endif
+#ifdef H5_HAVE_GETTIMEOFDAY
+ HDgettimeofday(&t_start, NULL);
+#else
+#ifdef H5_HAVE_SYS_TIMEB
+ _ftime(tbstart);
+#endif
+#endif
+ fprintf (stderr, HEADING, "in raw");
+ for(u = 0; u < nread; u++) {
+ putc (PROGRESS, stderr);
+ HDfflush(stderr);
+ offset = HDlseek (fd, (off_t)0, SEEK_SET);
+ assert (0==offset);
+ n = HDread (fd, the_data, (size_t)(size[0]*size[1]));
+ assert (n>=0 && (size_t)n==size[0]*size[1]);
+ }
+#ifdef H5_HAVE_GETRUSAGE
+ HDgetrusage(RUSAGE_SELF, &r_stop);
+#endif
+#ifdef H5_HAVE_GETTIMEOFDAY
+ HDgettimeofday(&t_stop, NULL);
+#else
+#ifdef H5_HAVE_SYS_TIMEB
+ _ftime(tbstop);
+ t_start.tv_sec = tbstart->time;
+ t_start.tv_usec = tbstart->millitm;
+ t_stop.tv_sec = tbstop->time;
+ t_stop.tv_usec = tbstop->millitm;
+#endif
+#endif
+ putc ('\n', stderr);
+ print_stats ("in raw",
+ &r_start, &r_stop, &t_start, &t_stop,
+ (size_t)(nread*size[0]*size[1]));
+
+
+ /* Read the hdf5 dataset */
+ synchronize ();
+#ifdef H5_HAVE_GETRUSAGE
+ HDgetrusage(RUSAGE_SELF, &r_start);
+#endif
+#ifdef H5_HAVE_GETTIMEOFDAY
+ HDgettimeofday(&t_start, NULL);
+#else
+#ifdef H5_HAVE_SYS_TIMEB
+ _ftime(tbstart);
+#endif
+#endif
+ fprintf (stderr, HEADING, "in hdf5");
+ for(u = 0; u < nread; u++) {
+ putc (PROGRESS, stderr);
+ HDfflush(stderr);
+ status = H5Dread (dset, H5T_NATIVE_UCHAR, file_space, file_space,
+ H5P_DEFAULT, the_data);
+ assert (status>=0);
+ }
+#ifdef H5_HAVE_GETRUSAGE
+ HDgetrusage(RUSAGE_SELF, &r_stop);
+#endif
+#ifdef H5_HAVE_GETTIMEOFDAY
+ HDgettimeofday(&t_stop, NULL);
+#else
+#ifdef H5_HAVE_SYS_TIMEB
+ _ftime(tbstop);
+ t_start.tv_sec = tbstart->time;
+ t_start.tv_usec = tbstart->millitm;
+ t_stop.tv_sec = tbstop->time;
+ t_stop.tv_usec = tbstop->millitm;
+#endif
+#endif
+ putc ('\n', stderr);
+ print_stats ("in hdf5",
+ &r_start, &r_stop, &t_start, &t_stop,
+ (size_t)(nread*size[0]*size[1]));
+
+ /* Read hyperslab */
+ assert (size[0]>20 && size[1]>20);
+ start[0] = start[1] = 10;
+ count[0] = count[1] = size[0]-20;
+ status = H5Sselect_hyperslab (file_space, H5S_SELECT_SET, start, NULL, count, NULL);
+ assert (status>=0);
+ synchronize ();
+#ifdef H5_HAVE_GETRUSAGE
+ HDgetrusage(RUSAGE_SELF, &r_start);
+#endif
+#ifdef H5_HAVE_GETTIMEOFDAY
+ HDgettimeofday(&t_start, NULL);
+#else
+#ifdef H5_HAVE_SYS_TIMEB
+ _ftime(tbstart);
+#endif
+#endif
+ fprintf (stderr, HEADING, "in hdf5 partial");
+ for(u = 0; u < nread; u++) {
+ putc (PROGRESS, stderr);
+ HDfflush(stderr);
+ status = H5Dread (dset, H5T_NATIVE_UCHAR, file_space, file_space,
+ H5P_DEFAULT, the_data);
+ assert (status>=0);
+ }
+#ifdef H5_HAVE_GETRUSAGE
+ HDgetrusage(RUSAGE_SELF, &r_stop);
+#endif
+#ifdef H5_HAVE_GETTIMEOFDAY
+ HDgettimeofday(&t_stop, NULL);
+#else
+#ifdef H5_HAVE_SYS_TIMEB
+ _ftime(tbstop);
+ t_start.tv_sec = tbstart->time;
+ t_start.tv_usec = tbstart->millitm;
+ t_stop.tv_sec = tbstop->time;
+ t_stop.tv_usec = tbstop->millitm;
+#endif
+#endif
+ putc('\n', stderr);
+ print_stats("in hdf5 partial",
+ &r_start, &r_stop, &t_start, &t_stop,
+ (size_t)(nread*count[0]*count[1]));
+
+
+
+ /* Close everything */
+ HDclose(fd);
+ H5Dclose(dset);
+ H5Sclose(file_space);
+ H5Fclose(file);
+ free(the_data);
+
+ return 0;
+}
+
diff --git a/tools/test/perform/overhead.c b/tools/test/perform/overhead.c
new file mode 100644
index 0000000..98093c7
--- /dev/null
+++ b/tools/test/perform/overhead.c
@@ -0,0 +1,408 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Programmer: Robb Matzke <matzke@llnl.gov>
+ * Monday, September 28, 1998
+ *
+ * Purpose: Creates a chunked dataset and measures the storage overhead.
+ */
+
+/* See H5private.h for how to include headers */
+#undef NDEBUG
+#include "hdf5.h"
+#include "H5private.h"
+
+#ifdef H5_STDC_HEADERS
+# include <ctype.h>
+# include <fcntl.h>
+# include <stdlib.h>
+# include <sys/stat.h>
+# include <string.h>
+#endif
+
+#ifdef H5_HAVE_IO_H
+# include <io.h>
+#endif
+
+#ifdef H5_HAVE_UNISTD_H
+# include <sys/types.h>
+# include <unistd.h>
+#endif
+
+/* Solaris Studio defines attribute, but for the attributes we need */
+#if !defined(H5_HAVE_ATTRIBUTE) || defined __cplusplus || defined(__SUNPRO_C)
+# undef __attribute__
+# define __attribute__(X) /*void*/
+# define H5_ATTR_UNUSED /*void*/
+#else
+# define H5_ATTR_UNUSED __attribute__((unused))
+#endif
+
+#define FILE_NAME_1 "overhead.h5"
+#ifndef FALSE
+#define FALSE 0
+#endif /* FALSE */
+#ifndef TRUE
+#define TRUE 1
+#endif /* TRUE */
+
+typedef enum fill_t {
+ FILL_ALL,
+ FILL_FORWARD,
+ FILL_REVERSE,
+ FILL_INWARD,
+ FILL_OUTWARD,
+ FILL_RANDOM
+} fill_t;
+
+
+/*-------------------------------------------------------------------------
+ * Function: usage
+ *
+ * Purpose: Prints a usage message and exits.
+ *
+ * Return: never returns
+ *
+ * Programmer: Robb Matzke
+ * Wednesday, September 30, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+usage(const char *prog)
+{
+ fprintf(stderr, "usage: %s [STYLE|cache] [LEFT [MIDDLE [RIGHT]]]\n",
+ prog);
+ fprintf(stderr, "\
+ STYLE is the order that the dataset is filled and should be one of:\n\
+ forward -- Fill the dataset from lowest address to highest\n\
+ address. This style tests the right split ratio.\n\
+ reverse -- Fill the dataset from highest address to lowest\n\
+ address. This is the reverse order of `forward' and\n\
+ tests the left split ratio.\n\
+ inward -- Fill beginning at both the lowest and highest\n\
+ addresses and work in toward the center of the\n\
+ dataset. This tests the middle split ratio.\n\
+ outward -- Start at the center of the dataset and work outward\n\
+ toward the lowest and highest addresses. This tests\n\
+ both left and right split ratios.\n\
+ random -- Write the chunks of the dataset in random order. This\n\
+ tests all split ratios.\n\
+ If no fill style is specified then all fill styles are tried and a\n\
+ single value is printed for each one.\n\
+\n\
+ If the word `cache' is used instead of a fill style then the raw data\n\
+ cache is enabled. It is not possible to enable the raw data cache when\n\
+ a specific fill style is used because H5Fflush() is called after each\n\
+ chunk is written in order to calculate overhead during the test. If\n\
+ the cache is enabled then chunks are written to disk in different orders\n\
+ than the actual H5Dwrite() calls in the test due to collisions and the\n\
+ resulting B-tree will be split differently.\n\
+\n\
+ LEFT, MIDDLE, and RIGHT are the ratios to use for splitting and should\n\
+ be values between zero and one, inclusive.\n");
+ exit(1);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: cleanup
+ *
+ * Purpose: Removes test files
+ *
+ * Return: void
+ *
+ * Programmer: Robb Matzke
+ * Thursday, June 4, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+cleanup (void)
+{
+ if (!getenv ("HDF5_NOCLEANUP")) {
+ remove (FILE_NAME_1);
+ }
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: display_error_cb
+ *
+ * Purpose: Displays the error stack after printing "*FAILED*".
+ *
+ * Return: Success: 0
+ *
+ * Failure: -1
+ *
+ * Programmer: Robb Matzke
+ * Wednesday, March 4, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+display_error_cb (hid_t estack, void H5_ATTR_UNUSED *client_data)
+{
+ puts ("*FAILED*");
+ H5Eprint2(estack, stdout);
+
+ return 0;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: test
+ *
+ * Purpose: The guts of the test
+ *
+ * Return: Success: 0
+ *
+ * Failure: number of errors
+ *
+ * Programmer: Robb Matzke
+ * Wednesday, September 30, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+test(fill_t fill_style, const double splits[],
+ hbool_t verbose, hbool_t use_rdcc)
+{
+ hid_t file = (-1), fapl = (-1), dcpl = (-1), xfer = (-1), mspace = (-1), fspace = (-1), dset = (-1);
+ hsize_t ch_size[1] = {1}; /*chunk size */
+ hsize_t cur_size[1] = {1000}; /*current dataset size */
+ hsize_t max_size[1] = {H5S_UNLIMITED}; /*maximum dataset size */
+ hsize_t hs_start[1]; /*hyperslab start offset*/
+ hsize_t hs_count[1] = {1}; /*hyperslab nelmts */
+ int fd = (-1); /*h5 file direct */
+ int *had = NULL; /*for random filling */
+ const char *sname=NULL; /*fill style nam */
+ int mdc_nelmts; /*num meta objs to cache*/
+ hsize_t i, k;
+ int j;
+ h5_stat_t sb;
+
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) goto error;
+ if(!use_rdcc) {
+ if(H5Pget_cache(fapl, &mdc_nelmts, NULL, NULL, NULL) < 0) goto error;
+ if(H5Pset_cache(fapl, mdc_nelmts, 0, 0, 0.0F) < 0) goto error;
+ }
+ if((file = H5Fcreate(FILE_NAME_1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) goto error;
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
+ if(H5Pset_chunk(dcpl, 1, ch_size) < 0) goto error;
+ if((xfer = H5Pcreate(H5P_DATASET_XFER)) < 0) goto error;
+ if(H5Pset_btree_ratios(xfer, splits[0], splits[1], splits[2]) < 0) goto error;
+ if((fspace = H5Screate_simple(1, cur_size, max_size)) < 0) goto error;
+ if((mspace = H5Screate_simple(1, ch_size, ch_size)) < 0) goto error;
+ if((dset = H5Dcreate2(file, "chunked", H5T_NATIVE_INT,
+ fspace, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) goto error;
+ if ((fd=HDopen(FILE_NAME_1, O_RDONLY, 0666)) < 0) goto error;
+
+ if(FILL_RANDOM==fill_style)
+ had = (int *)calloc((size_t)cur_size[0], sizeof(int));
+
+ for (i=1; i<=cur_size[0]; i++) {
+
+ /* Decide which chunk to write to */
+ switch (fill_style) {
+ case FILL_FORWARD:
+ hs_start[0] = i-1;
+ break;
+ case FILL_REVERSE:
+ hs_start[0] = cur_size[0]-i;
+ break;
+ case FILL_INWARD:
+ hs_start[0] = i%2 ? i/2 : cur_size[0]-i/2;
+ break;
+ case FILL_OUTWARD:
+ k = (cur_size[0] - i) + 1;
+ hs_start[0] = k % 2 ? (k / 2) : (hsize_t)((hssize_t)cur_size[0] - (hssize_t)(k / 2));
+ break;
+ case FILL_RANDOM:
+ for (j=HDrand()%(int)cur_size[0]; had[j]; j=(j+1)%(int)cur_size[0])
+ /*void*/;
+ hs_start[0] = (hsize_t)j;
+ had[j] = 1;
+ break;
+ case FILL_ALL:
+ abort();
+ default:
+ /* unknown request */
+ HDfprintf(stderr, "Unknown fill style\n");
+ goto error;
+ break;
+ }
+
+ /* Write the chunk */
+ if (H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_start, NULL,
+ hs_count, NULL) < 0) goto error;
+ if (H5Dwrite(dset, H5T_NATIVE_INT, mspace, fspace, xfer, &i) < 0) {
+ goto error;
+ }
+
+ /* Determine overhead */
+ if (verbose) {
+ if (H5Fflush(file, H5F_SCOPE_LOCAL) < 0) goto error;
+ if (HDfstat(fd, &sb) < 0) goto error;
+ printf("%4lu %8.3f ***\n",
+ (unsigned long)i,
+ (double)(sb.st_size - (HDoff_t)(i * sizeof(int))) / (double)i);
+ }
+ }
+
+ if(had) {
+ free(had);
+ had = NULL;
+ } /* end if */
+
+ H5Dclose(dset);
+ H5Sclose(mspace);
+ H5Sclose(fspace);
+ H5Pclose(dcpl);
+ H5Pclose(xfer);
+ H5Fclose(file);
+
+ if (!verbose) {
+ switch (fill_style) {
+ case FILL_FORWARD:
+ sname = "forward";
+ break;
+ case FILL_REVERSE:
+ sname = "reverse";
+ break;
+ case FILL_INWARD:
+ sname = "inward";
+ break;
+ case FILL_OUTWARD:
+ sname = "outward";
+ break;
+ case FILL_RANDOM:
+ sname = "random";
+ break;
+ case FILL_ALL:
+ abort();
+ default:
+ /* unknown request */
+ HDfprintf(stderr, "Unknown fill style\n");
+ goto error;
+ break;
+ }
+
+ if (HDfstat(fd, &sb) < 0) goto error;
+ printf("%-7s %8.3f\n", sname,
+ (double)(sb.st_size - (HDoff_t)(cur_size[0] * sizeof(int))) /
+ (double)cur_size[0]);
+ }
+ HDclose(fd);
+
+ return 0;
+
+ error:
+ H5Dclose(dset);
+ H5Sclose(mspace);
+ H5Sclose(fspace);
+ H5Pclose(dcpl);
+ H5Pclose(xfer);
+ H5Fclose(file);
+ if(had)
+ free(had);
+ HDclose(fd);
+ return 1;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: main
+ *
+ * Purpose:
+ *
+ * Return: Success: zero
+ *
+ * Failure: non-zero
+ *
+ * Programmer: Robb Matzke
+ * Monday, September 28, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+main(int argc, char *argv[])
+{
+ hid_t xfer;
+ fill_t fill_style = FILL_ALL;
+ hbool_t use_cache = FALSE;
+ double splits[3];
+ int i, j, nerrors=0;
+
+ /* Default split ratios */
+ H5Eset_auto2(H5E_DEFAULT, display_error_cb, NULL);
+
+ if((xfer = H5Pcreate(H5P_DATASET_XFER)) < 0) goto error;
+ if(H5Pget_btree_ratios(xfer, splits+0, splits+1, splits+2) < 0) goto error;
+ if(H5Pclose(xfer) < 0) goto error;
+
+ /* Parse command-line options */
+ for(i = 1, j = 0; i < argc; i++) {
+ if (!strcmp(argv[i], "forward")) {
+ fill_style = FILL_FORWARD;
+ } else if (!strcmp(argv[i], "reverse")) {
+ fill_style = FILL_REVERSE;
+ } else if (!strcmp(argv[i], "inward")) {
+ fill_style = FILL_INWARD;
+ } else if (!strcmp(argv[i], "outward")) {
+ fill_style = FILL_OUTWARD;
+ } else if (!strcmp(argv[i], "random")) {
+ fill_style = FILL_RANDOM;
+ } else if (!strcmp(argv[i], "cache")) {
+ use_cache = TRUE;
+ } else if (j<3 && (isdigit(argv[i][0]) || '.'==argv[i][0])) {
+ splits[j++] = strtod(argv[i], NULL);
+ } else {
+ usage(argv[0]);
+ }
+ }
+
+ if (FILL_ALL==fill_style) {
+ printf("%-7s %8s\n", "Style", "Bytes/Chunk");
+ printf("%-7s %8s\n", "-----", "-----------");
+ nerrors += test(FILL_FORWARD, splits, FALSE, use_cache);
+ nerrors += test(FILL_REVERSE, splits, FALSE, use_cache);
+ nerrors += test(FILL_INWARD, splits, FALSE, use_cache);
+ nerrors += test(FILL_OUTWARD, splits, FALSE, use_cache);
+ nerrors += test(FILL_RANDOM, splits, FALSE, use_cache);
+ }
+ else {
+ if (use_cache) usage(argv[0]);
+ nerrors += test(fill_style, splits, TRUE, FALSE);
+ }
+ if (nerrors>0) goto error;
+ cleanup();
+ return 0;
+
+ error:
+ fprintf(stderr, "*** ERRORS DETECTED ***\n");
+ return 1;
+}
diff --git a/tools/test/perform/perf.c b/tools/test/perform/perf.c
new file mode 100644
index 0000000..7b9590c
--- /dev/null
+++ b/tools/test/perform/perf.c
@@ -0,0 +1,494 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Author: Albert Cheng of NCSA, May 1, 2001.
+ * This is derived from code given to me by Robert Ross.
+ *
+ * NOTE: This code assumes that all command line arguments make it out to all
+ * the processes that make up the parallel job, which isn't always the case.
+ * So if it doesn't work on some platform, that might be why.
+ */
+
+#include "hdf5.h"
+#include "H5private.h"
+
+#ifdef H5_HAVE_PARALLEL
+
+#ifdef H5_STDC_HEADERS
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#endif
+
+#ifdef H5_HAVE_UNISTD_H
+#include <sys/types.h>
+#include <unistd.h>
+#endif
+
+#ifdef H5_HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+
+#if defined(H5_TIME_WITH_SYS_TIME)
+# include <sys/time.h>
+# include <time.h>
+#elif defined(H5_HAVE_SYS_TIME_H)
+# include <sys/time.h>
+#else
+# include <time.h>
+#endif
+
+#include <mpi.h>
+#ifndef MPI_FILE_NULL /*MPIO may be defined in mpi.h already */
+# include <mpio.h>
+#endif
+
+/* Macro definitions */
+/* Verify:
+ * if val is false (0), print mesg and if fatal is true (non-zero), die.
+ */
+#define H5FATAL 1
+#define VRFY(val, mesg, fatal) do { \
+ if (!val) { \
+ printf("Proc %d: ", mynod); \
+ printf("*** Assertion failed (%s) at line %4d in %s\n", \
+ mesg, (int)__LINE__, __FILE__); \
+ if (fatal){ \
+ fflush(stdout); \
+ goto die_jar_jar_die; \
+ } \
+ } \
+} while(0)
+#define RANK 1
+#define MAX_PATH 1024
+
+hsize_t dims[RANK]; /* dataset dim sizes */
+hsize_t block[RANK], stride[RANK], count[RANK];
+hssize_t start[RANK];
+hid_t fid; /* HDF5 file ID */
+hid_t acc_tpl; /* File access templates */
+hid_t sid; /* Dataspace ID */
+hid_t file_dataspace; /* File dataspace ID */
+hid_t mem_dataspace; /* memory dataspace ID */
+hid_t dataset; /* Dataset ID */
+hsize_t opt_alignment = 1;
+hsize_t opt_threshold = 1;
+int opt_split_vfd = 0;
+char *meta_ext, *raw_ext; /* holds the meta and raw file extension if */
+ /* opt_split_vfd is set */
+
+
+/* DEFAULT VALUES FOR OPTIONS */
+int64_t opt_block = 1048576*16;
+int opt_iter = 1;
+int opt_stripe = -1;
+int opt_correct = 0;
+int amode = O_RDWR | O_CREAT;
+char opt_file[256] = "perftest.out";
+char opt_pvfstab[256] = "notset";
+int opt_pvfstab_set = 0;
+
+const char *FILENAME[] = {
+ opt_file,
+ NULL
+};
+
+/* function prototypes */
+static int parse_args(int argc, char **argv);
+
+extern int errno;
+
+/* globals needed for getopt */
+extern char *optarg;
+
+int main(int argc, char **argv)
+{
+ char *buf, *tmp, *buf2, *tmp2, *check;
+ int i, j, mynod=0, nprocs=1, err, my_correct = 1, correct, myerrno;
+ double stim, etim;
+ double write_tim = 0;
+ double read_tim = 0;
+ double read_bw, write_bw;
+ double max_read_tim, max_write_tim;
+ double min_read_tim, min_write_tim;
+ double ave_read_tim, ave_write_tim;
+ int64_t iter_jump = 0;
+ int64_t seek_position = 0;
+ MPI_File fh;
+ MPI_Status status;
+ int nchars;
+ char filename[MAX_PATH];
+ herr_t ret; /* Generic return value */
+
+ /* startup MPI and determine the rank of this process */
+ MPI_Init(&argc,&argv);
+ MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
+ MPI_Comm_rank(MPI_COMM_WORLD, &mynod);
+
+ /* parse the command line arguments */
+ parse_args(argc, argv);
+
+ if (mynod == 0) printf("# Using hdf5-io calls.\n");
+
+ /* kindof a weird hack- if the location of the pvfstab file was
+ * specified on the command line, then spit out this location into
+ * the appropriate environment variable: */
+
+#if H5_HAVE_SETENV
+/* no setenv or unsetenv */
+ if (opt_pvfstab_set) {
+ if((setenv("PVFSTAB_FILE", opt_pvfstab, 1)) < 0){
+ perror("setenv");
+ goto die_jar_jar_die;
+ }
+ }
+#endif
+
+ /* this is how much of the file data is covered on each iteration of
+ * the test. used to help determine the seek offset on each
+ * iteration */
+ iter_jump = nprocs * opt_block;
+
+ /* setup a buffer of data to write */
+ if (!(tmp = (char *) malloc(opt_block + 256))) {
+ perror("malloc");
+ goto die_jar_jar_die;
+ }
+ buf = tmp + 128 - (((long)tmp) % 128); /* align buffer */
+
+ if (opt_correct) {
+ /* do the same buffer setup for verifiable data */
+ if (!(tmp2 = (char *) malloc(opt_block + 256))) {
+ perror("malloc2");
+ goto die_jar_jar_die;
+ }
+ buf2 = tmp + 128 - (((long)tmp) % 128);
+ }
+
+ /* setup file access template with parallel IO access. */
+ if (opt_split_vfd){
+ hid_t mpio_pl;
+
+ mpio_pl = H5Pcreate (H5P_FILE_ACCESS);
+ VRFY((acc_tpl >= 0), "", H5FATAL);
+ ret = H5Pset_fapl_mpio(mpio_pl, MPI_COMM_WORLD, MPI_INFO_NULL);
+ VRFY((ret >= 0), "", H5FATAL);
+
+ /* set optional allocation alignment */
+ if (opt_alignment*opt_threshold != 1){
+ ret = H5Pset_alignment(acc_tpl, opt_threshold, opt_alignment );
+ VRFY((ret >= 0), "H5Pset_alignment succeeded", !H5FATAL);
+ }
+
+ /* setup file access template */
+ acc_tpl = H5Pcreate (H5P_FILE_ACCESS);
+ VRFY((acc_tpl >= 0), "", H5FATAL);
+ ret = H5Pset_fapl_split(acc_tpl, meta_ext, mpio_pl, raw_ext, mpio_pl);
+ VRFY((ret >= 0), "H5Pset_fapl_split succeeded", H5FATAL);
+ ret = H5Pclose(mpio_pl);
+ VRFY((ret >= 0), "H5Pclose mpio_pl succeeded", H5FATAL);
+ }else{
+ /* setup file access template */
+ acc_tpl = H5Pcreate (H5P_FILE_ACCESS);
+ VRFY((acc_tpl >= 0), "", H5FATAL);
+ ret = H5Pset_fapl_mpio(acc_tpl, MPI_COMM_WORLD, MPI_INFO_NULL);
+ VRFY((ret >= 0), "", H5FATAL);
+
+ /* set optional allocation alignment */
+ if (opt_alignment*opt_threshold != 1){
+ ret = H5Pset_alignment(acc_tpl, opt_threshold, opt_alignment );
+ VRFY((ret >= 0), "H5Pset_alignment succeeded", !H5FATAL);
+ }
+ }
+
+ h5_fixname_no_suffix(FILENAME[0], acc_tpl, filename, sizeof filename);
+
+ /* create the parallel file */
+ fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, acc_tpl);
+ VRFY((fid >= 0), "H5Fcreate succeeded", H5FATAL);
+
+ /* define a contiquous dataset of opt_iter*nprocs*opt_block chars */
+ dims[0] = opt_iter * nprocs * opt_block;
+ sid = H5Screate_simple(RANK, dims, NULL);
+ VRFY((sid >= 0), "H5Screate_simple succeeded", H5FATAL);
+ dataset = H5Dcreate2(fid, "Dataset1", H5T_NATIVE_CHAR, sid,
+ H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ VRFY((dataset >= 0), "H5Dcreate2 succeeded", H5FATAL);
+
+ /* create the memory dataspace and the file dataspace */
+ dims[0] = opt_block;
+ mem_dataspace = H5Screate_simple(RANK, dims, NULL);
+ VRFY((mem_dataspace >= 0), "", H5FATAL);
+ file_dataspace = H5Dget_space(dataset);
+ VRFY((file_dataspace >= 0), "H5Dget_space succeeded", H5FATAL);
+
+ /* now each process writes a block of opt_block chars in round robbin
+ * fashion until the whole dataset is covered.
+ */
+ for(j=0; j < opt_iter; j++) {
+ /* setup a file dataspace selection */
+ start[0] = (j*iter_jump)+(mynod*opt_block);
+ stride[0] = block[0] = opt_block;
+ count[0]= 1;
+ ret=H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block);
+ VRFY((ret >= 0), "H5Sset_hyperslab succeeded", H5FATAL);
+
+ if (opt_correct) /* fill in buffer for iteration */ {
+ for (i=mynod+j, check=buf; i<opt_block; i++,check++) *check=(char)i;
+ }
+
+ /* discover the starting time of the operation */
+ MPI_Barrier(MPI_COMM_WORLD);
+ stim = MPI_Wtime();
+
+ /* write data */
+ ret = H5Dwrite(dataset, H5T_NATIVE_CHAR, mem_dataspace, file_dataspace,
+ H5P_DEFAULT, buf);
+ VRFY((ret >= 0), "H5Dwrite dataset1 succeeded", !H5FATAL);
+
+ /* discover the ending time of the operation */
+ etim = MPI_Wtime();
+
+ write_tim += (etim - stim);
+
+ /* we are done with this "write" iteration */
+ }
+
+ /* close dataset and file */
+ ret=H5Dclose(dataset);
+ VRFY((ret >= 0), "H5Dclose succeeded", H5FATAL);
+ ret=H5Fclose(fid);
+ VRFY((ret >= 0), "H5Fclose succeeded", H5FATAL);
+
+
+
+ /* wait for everyone to synchronize at this point */
+ MPI_Barrier(MPI_COMM_WORLD);
+
+ /* reopen the file for reading */
+ fid=H5Fopen(filename,H5F_ACC_RDONLY,acc_tpl);
+ VRFY((fid >= 0), "", H5FATAL);
+
+ /* open the dataset */
+ dataset = H5Dopen2(fid, "Dataset1", H5P_DEFAULT);
+ VRFY((dataset >= 0), "H5Dopen succeeded", H5FATAL);
+
+ /* we can re-use the same mem_dataspace and file_dataspace
+ * the H5Dwrite used since the dimension size is the same.
+ */
+
+ /* we are going to repeat the read the same pattern the write used */
+ for (j=0; j < opt_iter; j++) {
+ /* setup a file dataspace selection */
+ start[0] = (j*iter_jump)+(mynod*opt_block);
+ stride[0] = block[0] = opt_block;
+ count[0]= 1;
+ ret=H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block);
+ VRFY((ret >= 0), "H5Sset_hyperslab succeeded", H5FATAL);
+ /* seek to the appropriate spot give the current iteration and
+ * rank within the MPI processes */
+
+ /* discover the start time */
+ MPI_Barrier(MPI_COMM_WORLD);
+ stim = MPI_Wtime();
+
+ /* read in the file data */
+ if (!opt_correct){
+ ret = H5Dread(dataset, H5T_NATIVE_CHAR, mem_dataspace, file_dataspace, H5P_DEFAULT, buf);
+ }
+ else{
+ ret = H5Dread(dataset, H5T_NATIVE_CHAR, mem_dataspace, file_dataspace, H5P_DEFAULT, buf2);
+ }
+ myerrno = errno;
+
+ /* discover the end time */
+ etim = MPI_Wtime();
+ read_tim += (etim - stim);
+ VRFY((ret >= 0), "H5Dwrite dataset1 succeeded", !H5FATAL);
+
+
+ if (ret < 0) fprintf(stderr, "node %d, read error, loc = %Ld: %s\n",
+ mynod, mynod*opt_block, strerror(myerrno));
+
+ /* if the user wanted to check correctness, compare the write
+ * buffer to the read buffer */
+ if (opt_correct && memcmp(buf, buf2, opt_block)) {
+ fprintf(stderr, "node %d, correctness test failed\n", mynod);
+ my_correct = 0;
+ MPI_Allreduce(&my_correct, &correct, 1, MPI_INT, MPI_MIN,
+ MPI_COMM_WORLD);
+ }
+
+ /* we are done with this read iteration */
+ }
+
+ /* close dataset and file */
+ ret=H5Dclose(dataset);
+ VRFY((ret >= 0), "H5Dclose succeeded", H5FATAL);
+ ret=H5Fclose(fid);
+ VRFY((ret >= 0), "H5Fclose succeeded", H5FATAL);
+ ret=H5Pclose(acc_tpl);
+ VRFY((ret >= 0), "H5Pclose succeeded", H5FATAL);
+
+ /* compute the read and write times */
+ MPI_Allreduce(&read_tim, &max_read_tim, 1, MPI_DOUBLE, MPI_MAX,
+ MPI_COMM_WORLD);
+ MPI_Allreduce(&read_tim, &min_read_tim, 1, MPI_DOUBLE, MPI_MIN,
+ MPI_COMM_WORLD);
+ MPI_Allreduce(&read_tim, &ave_read_tim, 1, MPI_DOUBLE, MPI_SUM,
+ MPI_COMM_WORLD);
+
+ /* calculate the average from the sum */
+ ave_read_tim = ave_read_tim / nprocs;
+
+ MPI_Allreduce(&write_tim, &max_write_tim, 1, MPI_DOUBLE, MPI_MAX,
+ MPI_COMM_WORLD);
+ MPI_Allreduce(&write_tim, &min_write_tim, 1, MPI_DOUBLE, MPI_MIN,
+ MPI_COMM_WORLD);
+ MPI_Allreduce(&write_tim, &ave_write_tim, 1, MPI_DOUBLE, MPI_SUM,
+ MPI_COMM_WORLD);
+
+ /* calculate the average from the sum */
+ ave_write_tim = ave_write_tim / nprocs;
+
+ /* print out the results on one node */
+ if (mynod == 0) {
+ read_bw = ((int64_t)(opt_block*nprocs*opt_iter))/(max_read_tim*1000000.0);
+ write_bw = ((int64_t)(opt_block*nprocs*opt_iter))/(max_write_tim*1000000.0);
+
+ printf("nr_procs = %d, nr_iter = %d, blk_sz = %ld\n", nprocs,
+ opt_iter, (long)opt_block);
+
+ printf("# total_size = %ld\n", (long)(opt_block*nprocs*opt_iter));
+
+ printf("# Write: min_time = %f, max_time = %f, mean_time = %f\n",
+ min_write_tim, max_write_tim, ave_write_tim);
+ printf("# Read: min_time = %f, max_time = %f, mean_time = %f\n",
+ min_read_tim, max_read_tim, ave_read_tim);
+
+ printf("Write bandwidth = %f Mbytes/sec\n", write_bw);
+ printf("Read bandwidth = %f Mbytes/sec\n", read_bw);
+
+ if (opt_correct) {
+ printf("Correctness test %s.\n", correct ? "passed" : "failed");
+ }
+ }
+
+
+die_jar_jar_die:
+
+#if H5_HAVE_SETENV
+/* no setenv or unsetenv */
+ /* clear the environment variable if it was set earlier */
+ if (opt_pvfstab_set){
+ unsetenv("PVFSTAB_FILE");
+ }
+#endif
+
+ free(tmp);
+ if (opt_correct) free(tmp2);
+
+ MPI_Finalize();
+
+ return(0);
+}
+
+static int
+parse_args(int argc, char **argv)
+{
+ int c;
+
+ while ((c = getopt(argc, argv, "s:b:i:f:p:a:2:c")) != EOF) {
+ switch (c) {
+ case 's': /* stripe */
+ opt_stripe = atoi(optarg);
+ break;
+ case 'b': /* block size */
+ opt_block = atoi(optarg);
+ break;
+ case 'i': /* iterations */
+ opt_iter = atoi(optarg);
+ break;
+ case 'f': /* filename */
+ strncpy(opt_file, optarg, 255);
+ FILENAME[0] = opt_file;
+ break;
+ case 'p': /* pvfstab file */
+ strncpy(opt_pvfstab, optarg, 255);
+ opt_pvfstab_set = 1;
+ break;
+ case 'a': /* aligned allocation.
+ * syntax: -a<alignment>/<threshold>
+ * e.g., -a4096/512 allocate at 4096 bytes
+ * boundary if request size >= 512.
+ */
+ {char *p;
+ opt_alignment = atoi(optarg);
+ if (p=(char*)strchr(optarg, '/'))
+ opt_threshold = atoi(p+1);
+ }
+ HDfprintf(stdout,
+ "alignment/threshold=%Hu/%Hu\n",
+ opt_alignment, opt_threshold);
+ break;
+ case '2': /* use 2-files, i.e., split file driver */
+ opt_split_vfd=1;
+ /* get meta and raw file extension. */
+ /* syntax is <raw_ext>,<meta_ext> */
+ meta_ext = raw_ext = optarg;
+ while (*raw_ext != '\0'){
+ if (*raw_ext == ','){
+ *raw_ext = '\0';
+ raw_ext++;
+ break;
+ }
+ raw_ext++;
+ }
+ printf("split-file-vfd used: %s,%s\n",
+ meta_ext, raw_ext);
+ break;
+ case 'c': /* correctness */
+ opt_correct = 1;
+ break;
+ case '?': /* unknown */
+ default:
+ break;
+ }
+ }
+
+ return(0);
+}
+
+/*
+ * Local variables:
+ * c-indent-level: 3
+ * c-basic-offset: 3
+ * tab-width: 3
+ * End:
+ */
+
+#else /* H5_HAVE_PARALLEL */
+/* dummy program since H5_HAVE_PARALLEL is not configured in */
+int
+main(int H5_ATTR_UNUSED argc, char H5_ATTR_UNUSED **argv)
+{
+ printf("No parallel performance because parallel is not configured in\n");
+ return(0);
+}
+#endif /* H5_HAVE_PARALLEL */
+
diff --git a/tools/test/perform/perf_meta.c b/tools/test/perform/perf_meta.c
new file mode 100644
index 0000000..2c3a19c
--- /dev/null
+++ b/tools/test/perform/perf_meta.c
@@ -0,0 +1,850 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Programmer: Raymond Lu <slu@ncsa.uiuc.edu>
+ * Friday, Oct 3, 2004
+ *
+ * Purpose: Tests performance of metadata
+ */
+
+#include "h5test.h"
+
+#ifdef H5_HAVE_PARALLEL
+#define MAINPROCESS (!mpi_rank) /* define process 0 as main process */
+#endif /*H5_HAVE_PARALLEL*/
+
+/* File_Access_type bits */
+#define FACC_DEFAULT 0x0 /* serial as default */
+#define FACC_MPIO 0x1 /* MPIO */
+
+/* Which test to run */
+int RUN_TEST = 0x0; /* all tests as default */
+int TEST_1 = 0x1; /* Test 1 */
+int TEST_2 = 0x2; /* Test 2 */
+int TEST_3 = 0x4; /* Test 3 */
+
+
+const char *FILENAME[] = {
+ "meta_perf_1",
+ "meta_perf_2",
+ "meta_perf_3",
+ NULL
+};
+
+/* Default values for performance. Can be changed through command line options */
+int NUM_DSETS = 16;
+int NUM_ATTRS = 8;
+int BATCH_ATTRS = 2;
+hbool_t flush_dset = FALSE;
+hbool_t flush_attr = FALSE;
+int nerrors = 0; /* errors count */
+hid_t fapl;
+
+/* Data space IDs */
+hid_t space;
+hid_t small_space;
+
+/* Performance data */
+typedef struct p_time {
+ double total;
+ double avg;
+ double max;
+ double min;
+ double start;
+ char func[32];
+} p_time;
+
+/*Test file access type for parallel. MPIO as default */
+int facc_type = FACC_DEFAULT;
+
+double retrieve_time(void);
+void perf(p_time *perf_t, double start_t, double end_t);
+void print_perf(p_time, p_time, p_time);
+
+
+/*-------------------------------------------------------------------------
+ * Function: parse_options
+ *
+ Purpose: Parse command line options
+ *
+ * Programmer: Raymond Lu
+ * Friday, Oct 3, 2003
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+parse_options(int argc, char **argv)
+{
+ int t;
+
+ /* Use default values */
+ if(argc==1)
+ return(0);
+
+ while (--argc){
+ if (**(++argv) != '-'){
+ break;
+ }else{
+ switch(*(*argv+1)){
+ case 'h': /* Help page */
+ return(1);
+
+ case 'd': /* Number of datasets */
+ NUM_DSETS = atoi((*argv+1)+1);
+ if (NUM_DSETS < 0){
+ nerrors++;
+ return(1);
+ }
+ break;
+
+ case 'a': /* Number of attributes per dataset */
+ NUM_ATTRS = atoi((*argv+1)+1);
+ if (NUM_ATTRS < 0){
+ nerrors++;
+ return(1);
+ }
+ break;
+
+ case 'n': /* Number of attributes to be created in batch */
+ BATCH_ATTRS = atoi((*argv+1)+1);
+ if (BATCH_ATTRS < 0){
+ nerrors++;
+ return(1);
+ }
+ break;
+
+ case 'm': /* Use the MPI-IO driver */
+ facc_type = FACC_MPIO;
+ break;
+
+ case 'f': /* Call H5Fflush for each dataset or attribute */
+ if(!strcmp("a", (*argv+2)))
+ flush_attr = TRUE;
+ else if(!strcmp("d", (*argv+2)))
+ flush_dset = TRUE;
+ else {
+ nerrors++;
+ return(1);
+ }
+ break;
+
+ case 't': /* Which test to run */
+ t = atoi((*argv+1)+1);
+ if (t < 1 || t > 3){
+ nerrors++;
+ return(1);
+ }
+ if(t == 1)
+ RUN_TEST |= TEST_1;
+ else if(t == 2)
+ RUN_TEST |= TEST_2;
+ else
+ RUN_TEST |= TEST_3;
+
+ break;
+
+ default: nerrors++;
+ return(1);
+ }
+ }
+ } /*while*/
+
+ /* Check valid values */
+#ifndef H5_HAVE_PARALLEL
+ if(facc_type == FACC_MPIO)
+ {
+ nerrors++;
+ return(1);
+ }
+#endif /*H5_HAVE_PARALLEL*/
+
+ if(NUM_ATTRS && !BATCH_ATTRS)
+ NUM_ATTRS = 0;
+
+ if(!NUM_ATTRS && BATCH_ATTRS)
+ BATCH_ATTRS = 0;
+
+ if(!NUM_DSETS) {
+ nerrors++;
+ return(1);
+ }
+
+ if(NUM_ATTRS && BATCH_ATTRS) {
+ if(BATCH_ATTRS > NUM_ATTRS || NUM_ATTRS % BATCH_ATTRS) {
+ nerrors++;
+ return(1);
+ }
+ }
+
+ return(0);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: usage
+ *
+ Purpose: Prints help page
+ *
+ * Programmer: Raymond Lu
+ * Friday, Oct 3, 2003
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+usage(void)
+{
+ printf("Usage: perf_meta [-h] [-m] [-d<num_datasets>]"
+ "[-a<num_attributes>]\n"
+ "\t[-n<batch_attributes>] [-f<option>] [-t<test>]\n");
+ printf("\t-h"
+ "\t\t\thelp page.\n");
+ printf("\t-m"
+ "\t\t\tset MPIO as the file driver when parallel HDF5\n"
+ "\t\t\t\tis enabled. -m must be specified\n"
+ "\t\t\t\twhen running parallel program.\n");
+ printf("\t-d<num_datasets>"
+ "\tset number of datasets for meta data \n"
+ "\t\t\t\tperformance test\n");
+ printf("\t-a<num_attributes>"
+ "\tset number of attributes per dataset for meta \n"
+ "\t\t\t\tdata performance test.\n");
+ printf("\t-n<batch_attributes>"
+ "\tset batch number of attributes for dataset \n"
+ "\t\t\t\tfor meta data performance test.\n");
+ printf("\t-f<option>"
+ "\t\tflush data to disk after closing a dataset \n"
+ "\t\t\t\tor attribute. Valid options are \"d\" for \n"
+ "\t\t\t\tdataset, \"a\" for attribute. Disabled is \n"
+ "\t\t\t\tthe default.\n");
+ printf("\t-t<tests>"
+ "\t\trun specific test. Give only one number each \n"
+ "\t\t\t\ttime. i.e. \"-t1 -t3\" will run test 1 and 3. \n"
+ "\t\t\t\tDefault is all three tests. The 3 tests are: \n\n"
+ "\t\t\t\t1. Create <num_attributes> attributes for each \n"
+ "\t\t\t\t of <num_datasets> existing datasets.\n"
+ "\t\t\t\t2. Create <num_attributes> attributes for each \n"
+ "\t\t\t\t of <num_datasets> new datasets.\n"
+ "\t\t\t\t3. Create <batch_attributes> attributes for \n"
+ "\t\t\t\t each of <num_dataset> new datasets for \n"
+ "\t\t\t\t <num_attributes>/<batch_attributes> times.\n");
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: create_dspace
+ *
+ * Purpose: Attempts to create data space.
+ *
+ * Return: Success: 0
+ *
+ * Failure: -1
+ *
+ * Programmer: Raymond Lu
+ * Friday, Oct 3, 2003
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+create_dspace(void)
+{
+ hsize_t dims[2];
+ hsize_t small_dims[2];
+
+ /* Create the data space */
+ dims[0] = 256;
+ dims[1] = 512;
+ if((space = H5Screate_simple(2, dims, NULL)) < 0)
+ goto error;
+
+ /* Create a small data space for attributes */
+ small_dims[0] = 16;
+ small_dims[1] = 8;
+ if((small_space = H5Screate_simple(2, small_dims, NULL)) < 0)
+ goto error;
+
+ return 0;
+
+error:
+ return -1;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: create_dsets
+ *
+ * Purpose: Attempts to create some datasets.
+ *
+ * Return: Success: 0
+ *
+ * Failure: -1
+ *
+ * Programmer: Raymond Lu
+ * Friday, Oct 3, 2003
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+create_dsets(hid_t file)
+{
+ hid_t dataset;
+ char dset_name[32];
+ int i;
+
+ /*
+ * Create a dataset using the default dataset creation properties.
+ */
+ for(i = 0; i < NUM_DSETS; i++) {
+ sprintf(dset_name, "dataset %d", i);
+ if((dataset = H5Dcreate2(file, dset_name, H5T_NATIVE_DOUBLE, space,
+ H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+
+ if(H5Dclose(dataset) < 0)
+ goto error;
+ } /* end for */
+
+ return 0;
+
+error:
+ return -1;
+
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: create_attrs_1
+ *
+ * Purpose: Attempts to create all attributes for each existing dataset.
+ *
+ * Return: Success: 0
+ *
+ * Failure: -1
+ *
+ * Programmer: Raymond Lu
+ * Friday, Oct 3, 2003
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+create_attrs_1(void)
+{
+ hid_t file, dataset, attr;
+ char filename[128];
+ char dset_name[64];
+ char attr_name[128];
+ int i, j;
+ p_time attr_t = {0, 0, 0, 1000000, 0, ""};
+ p_time open_t = {0, 0, 0, 1000000, 0, "H5Dopen2"};
+ p_time close_t = {0, 0, 0, 1000000, 0, ""};
+
+#ifdef H5_HAVE_PARALLEL
+ /* need the rank for printing data */
+ int mpi_rank;
+ if(facc_type == FACC_MPIO)
+ MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
+#endif /*H5_HAVE_PARALLEL*/
+
+ h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
+
+ if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT,
+ fapl)) < 0)
+ goto error;
+
+ if(create_dsets(file) < 0)
+ goto error;
+
+ /*
+ * Create all(user specifies the number) attributes for each dataset
+ */
+ for(i = 0; i < NUM_DSETS; i++) {
+ sprintf(dset_name, "dataset %d", i);
+ open_t.start = retrieve_time();
+ if((dataset = H5Dopen2(file, dset_name, H5P_DEFAULT)) < 0)
+ goto error;
+ perf(&open_t, open_t.start, retrieve_time());
+
+ for(j = 0; j < NUM_ATTRS; j++) {
+ sprintf(attr_name, "all attrs for each dset %d", j);
+ attr_t.start = retrieve_time();
+ if((attr = H5Acreate2(dataset, attr_name, H5T_NATIVE_DOUBLE,
+ small_space, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+ if(H5Aclose(attr) < 0)
+ goto error;
+ perf(&attr_t, attr_t.start, retrieve_time());
+ if(flush_attr && H5Fflush(file, H5F_SCOPE_LOCAL) < 0)
+ goto error;
+ } /* end for */
+
+ close_t.start = retrieve_time();
+ if(H5Dclose(dataset) < 0)
+ goto error;
+ perf(&close_t, close_t.start, retrieve_time());
+ if(flush_dset && H5Fflush(file, H5F_SCOPE_LOCAL) < 0)
+ goto error;
+ } /* end for */
+
+ if(facc_type == FACC_MPIO) {
+#ifdef H5_HAVE_PARALLEL
+ MPI_Barrier(MPI_COMM_WORLD);
+#endif /*H5_HAVE_PARALLEL*/
+ }
+
+#ifdef H5_HAVE_PARALLEL
+ if (facc_type == FACC_DEFAULT || (facc_type != FACC_DEFAULT && MAINPROCESS)) /* only process 0 reports */
+#endif /*H5_HAVE_PARALLEL*/
+ {
+ /* Calculate the average time */
+ open_t.avg = open_t.total / NUM_DSETS;
+ close_t.avg = close_t.total / NUM_DSETS;
+ if(NUM_ATTRS)
+ attr_t.avg = attr_t.total / (NUM_ATTRS*NUM_DSETS);
+
+ /* Print out the performance result */
+ fprintf(stderr, "1. Create %d attributes for each of %d existing datasets\n",
+ NUM_ATTRS, NUM_DSETS);
+ print_perf(open_t, close_t, attr_t);
+ }
+
+ if (H5Fclose(file) < 0) goto error;
+
+ return 0;
+
+error:
+ return -1;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: create_attrs_2
+ *
+ * Purpose: Attempts to create all attributes for each new dataset.
+ *
+ * Return: Success: 0
+ *
+ * Failure: -1
+ *
+ * Programmer: Raymond Lu
+ * Friday, Oct 3, 2003
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+create_attrs_2(void)
+{
+ hid_t file, dataset, attr;
+ char filename[128];
+ char dset_name[64];
+ char attr_name[128];
+ int i, j;
+ p_time attr_t = {0, 0, 0, 1000000, 0, ""};
+ p_time create_t = {0, 0, 0, 1000000, 0, "H5Dcreate2"};
+ p_time close_t = {0, 0, 0, 1000000, 0, ""};
+
+#ifdef H5_HAVE_PARALLEL
+ /* need the rank for printing data */
+ int mpi_rank;
+ if(facc_type == FACC_MPIO)
+ MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
+#endif /*H5_HAVE_PARALLEL*/
+
+ h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
+
+ if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ goto error;
+
+ /*
+ * Create all(user specifies the number) attributes for each new dataset
+ */
+ for(i = 0; i < NUM_DSETS; i++) {
+ sprintf(dset_name, "dataset %d", i);
+ create_t.start = retrieve_time();
+ if((dataset = H5Dcreate2(file, dset_name, H5T_NATIVE_DOUBLE,
+ space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+ perf(&create_t, create_t.start, retrieve_time());
+
+ for(j = 0; j < NUM_ATTRS; j++) {
+ sprintf(attr_name, "all attrs for each dset %d", j);
+ attr_t.start = retrieve_time();
+ if((attr = H5Acreate2(dataset, attr_name, H5T_NATIVE_DOUBLE,
+ small_space, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+ if(H5Aclose(attr) < 0)
+ goto error;
+ perf(&attr_t, attr_t.start, retrieve_time());
+ if(flush_attr && H5Fflush(file, H5F_SCOPE_LOCAL) < 0)
+ goto error;
+ } /* end for */
+
+ close_t.start = retrieve_time();
+ if(H5Dclose(dataset) < 0)
+ goto error;
+ perf(&close_t, close_t.start, retrieve_time());
+ if(flush_dset && H5Fflush(file, H5F_SCOPE_LOCAL) < 0)
+ goto error;
+ } /* end for */
+
+#ifdef H5_HAVE_PARALLEL
+ if(facc_type == FACC_MPIO)
+ MPI_Barrier(MPI_COMM_WORLD);
+#endif /*H5_HAVE_PARALLEL*/
+
+#ifdef H5_HAVE_PARALLEL
+ /* only process 0 reports if parallel */
+ if (facc_type == FACC_DEFAULT || (facc_type != FACC_DEFAULT && MAINPROCESS))
+#endif /*H5_HAVE_PARALLEL*/
+ {
+ /* Calculate the average time */
+ create_t.avg = create_t.total / NUM_DSETS;
+ close_t.avg = close_t.total / NUM_DSETS;
+ if(NUM_ATTRS)
+ attr_t.avg = attr_t.total / (NUM_ATTRS*NUM_DSETS);
+
+ /* Print out the performance result */
+ fprintf(stderr, "2. Create %d attributes for each of %d new datasets\n",
+ NUM_ATTRS, NUM_DSETS);
+ print_perf(create_t, close_t, attr_t);
+ }
+
+ if (H5Fclose(file) < 0) goto error;
+
+ return 0;
+
+error:
+ return -1;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: create_attrs_3
+ *
+ * Purpose: Attempts to create some attributes for each dataset in a
+ * loop.
+ *
+ * Return: Success: 0
+ *
+ * Failure: -1
+ *
+ * Programmer: Raymond Lu
+ * Friday, Oct 3, 2003
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+create_attrs_3(void)
+{
+ hid_t file, dataset, attr;
+ char filename[128];
+ char dset_name[64];
+ char attr_name[128];
+ int loop_num;
+ int i, j, k;
+ p_time attr_t = {0, 0, 0, 1000000, 0, ""};
+ p_time open_t = {0, 0, 0, 1000000, 0, "H5Dopen2"};
+ p_time close_t = {0, 0, 0, 1000000, 0, ""};
+
+#ifdef H5_HAVE_PARALLEL
+ /* need the rank for printing data */
+ int mpi_rank;
+ if(facc_type == FACC_MPIO)
+ MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
+#endif /*H5_HAVE_PARALLEL*/
+
+ h5_fixname(FILENAME[2], fapl, filename, sizeof filename);
+
+ if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT,
+ fapl)) < 0)
+ goto error;
+
+ if(create_dsets(file) < 0)
+ goto error;
+
+ /*
+ * Create some(user specifies the number) attributes for each dataset
+ * in a loop
+ */
+ loop_num = NUM_ATTRS/BATCH_ATTRS;
+
+ for(i = 0; i < loop_num; i++) {
+ for(j = 0; j < NUM_DSETS; j++) {
+ sprintf(dset_name, "dataset %d", j);
+ open_t.start = retrieve_time();
+ if((dataset = H5Dopen2(file, dset_name, H5P_DEFAULT)) < 0)
+ goto error;
+ perf(&open_t, open_t.start, retrieve_time());
+
+ for(k = 0; k < BATCH_ATTRS; k++) {
+ sprintf(attr_name, "some attrs for each dset %d %d", i, k);
+ attr_t.start = retrieve_time();
+ if((attr = H5Acreate2(dataset, attr_name, H5T_NATIVE_DOUBLE,
+ small_space, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+ if(H5Aclose(attr) < 0)
+ goto error;
+ perf(&attr_t, attr_t.start, retrieve_time());
+ if(flush_attr && H5Fflush(file, H5F_SCOPE_LOCAL) < 0)
+ goto error;
+ } /* end for */
+
+ close_t.start = retrieve_time();
+ if(H5Dclose(dataset) < 0)
+ goto error;
+ perf(&close_t, close_t.start, retrieve_time());
+ if(flush_dset && H5Fflush(file, H5F_SCOPE_LOCAL) < 0)
+ goto error;
+ } /* end for */
+ } /* end for */
+
+#ifdef H5_HAVE_PARALLEL
+ if(facc_type == FACC_MPIO)
+ MPI_Barrier(MPI_COMM_WORLD);
+#endif /*H5_HAVE_PARALLEL*/
+
+#ifdef H5_HAVE_PARALLEL
+ /* only process 0 reports if parallel */
+ if (facc_type == FACC_DEFAULT || (facc_type != FACC_DEFAULT && MAINPROCESS))
+#endif /*H5_HAVE_PARALLEL*/
+ {
+ /* Calculate the average time */
+ open_t.avg = open_t.total / (loop_num*NUM_DSETS);
+ close_t.avg = close_t.total / (loop_num*NUM_DSETS);
+ attr_t.avg = attr_t.total / (NUM_ATTRS*NUM_DSETS);
+
+ /* Print out the performance result */
+ fprintf(stderr, "3. Create %d attributes for each of %d existing datasets for %d times\n",
+ BATCH_ATTRS, NUM_DSETS, loop_num);
+ print_perf(open_t, close_t, attr_t);
+ }
+
+ if (H5Fclose(file) < 0) goto error;
+
+ return 0;
+
+error:
+ return -1;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: retrieve_time
+ *
+ * Purpose: Returns time in seconds, in a double number.
+ *
+ * Programmer: Raymond Lu
+ * Friday, Oct 3, 2003
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+double retrieve_time(void)
+{
+#ifdef H5_HAVE_PARALLEL
+ if(facc_type == FACC_DEFAULT) {
+#endif /*H5_HAVE_PARALLEL*/
+ struct timeval t;
+ HDgettimeofday(&t, NULL);
+ return ((double)t.tv_sec + (double)t.tv_usec / 1000000);
+#ifdef H5_HAVE_PARALLEL
+ } else {
+ return MPI_Wtime();
+ }
+#endif /*H5_HAVE_PARALLEL*/
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: perf
+ *
+ * Purpose: Calculate total time, maximal and minimal time of
+ * performance.
+ *
+ * Programmer: Raymond Lu
+ * Friday, Oct 3, 2003
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+void perf(p_time *perf_t, double start_t, double end_t)
+{
+ double t = end_t - start_t;
+
+#ifdef H5_HAVE_PARALLEL
+ if(facc_type == FACC_MPIO) {
+ double reduced_t;
+ double t_max, t_min;
+ int mpi_size, mpi_rank;
+
+ MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
+ MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
+ MPI_Barrier(MPI_COMM_WORLD);
+
+ MPI_Reduce(&t, &reduced_t, 1, MPI_DOUBLE, MPI_SUM, 0,
+ MPI_COMM_WORLD);
+ reduced_t /= mpi_size;
+
+ MPI_Reduce(&t, &t_max, 1, MPI_DOUBLE, MPI_MAX, 0,
+ MPI_COMM_WORLD);
+ MPI_Reduce(&t, &t_min, 1, MPI_DOUBLE, MPI_MIN, 0,
+ MPI_COMM_WORLD);
+
+ if (MAINPROCESS) {
+ perf_t->total += reduced_t;
+
+ if(t_max > perf_t->max)
+ perf_t->max = t_max;
+ if(t_min < perf_t->min)
+ perf_t->min = t_min;
+ }
+ } else
+#endif /*H5_HAVE_PARALLEL*/
+ {
+ perf_t->total += t;
+
+ if(t > perf_t->max)
+ perf_t->max = t;
+ if(t < perf_t->min)
+ perf_t->min = t;
+ }
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: print_perf
+ *
+ * Purpose: Print out performance data.
+ *
+ * Programmer: Raymond Lu
+ * Friday, Oct 3, 2003
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+void print_perf(p_time open_t, p_time close_t, p_time attr_t)
+{
+ fprintf(stderr, "\t%s:\t\tavg=%.6fs;\tmax=%.6fs;\tmin=%.6fs\n",
+ open_t.func, open_t.avg, open_t.max, open_t.min);
+ fprintf(stderr, "\tH5Dclose:\t\tavg=%.6fs;\tmax=%.6fs;\tmin=%.6fs\n",
+ close_t.avg, close_t.max, close_t.min);
+ if(NUM_ATTRS)
+ fprintf(stderr, "\tH5A(create & close):\tavg=%.6fs;\tmax=%.6fs;\tmin=%.6fs\n",
+ attr_t.avg, attr_t.max, attr_t.min);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: main
+ *
+ * Purpose: Tests
+ *
+ * Return: Success: exit(0)
+ *
+ * Failure: exit(1)
+ *
+ * Programmer: Raymond Lu
+ * Friday, Oct 3, 2003
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+main(int argc, char **argv)
+{
+#ifdef H5_HAVE_PARALLEL
+ int mpi_size, mpi_rank; /* mpi variables */
+#endif /*H5_HAVE_PARALLEL*/
+
+ if(parse_options(argc, argv) != 0) {
+ usage();
+ return 0;
+ }
+
+#ifdef H5_HAVE_PARALLEL
+ if(facc_type == FACC_MPIO) {
+ MPI_Init(&argc, &argv);
+ MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
+ MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
+ }
+#endif /*H5_HAVE_PARALLEL*/
+
+#ifdef H5_HAVE_PARALLEL
+ if (facc_type == FACC_DEFAULT || (facc_type != FACC_DEFAULT && MAINPROCESS))
+#endif /*H5_HAVE_PARALLEL*/
+ fprintf(stderr, "\t\tPerformance result of metadata for datasets and attributes\n\n");
+
+ fapl = H5Pcreate (H5P_FILE_ACCESS);
+#ifdef H5_HAVE_PARALLEL
+ if(facc_type == FACC_MPIO)
+ H5Pset_fapl_mpio(fapl, MPI_COMM_WORLD, MPI_INFO_NULL);
+#endif /*H5_HAVE_PARALLEL*/
+
+ nerrors += create_dspace() < 0 ?1:0;
+
+ if((RUN_TEST & TEST_1) || !RUN_TEST)
+ nerrors += create_attrs_1() < 0 ?1:0;
+ if((RUN_TEST & TEST_2) || !RUN_TEST)
+ nerrors += create_attrs_2() < 0 ?1:0;
+ if(((RUN_TEST & TEST_3) || !RUN_TEST) && BATCH_ATTRS && NUM_ATTRS)
+ nerrors += create_attrs_3() < 0 ?1:0;
+
+ if (H5Sclose(space) < 0) goto error;
+ if (H5Sclose(small_space) < 0) goto error;
+
+ h5_clean_files(FILENAME, fapl);
+
+#ifdef H5_HAVE_PARALLEL
+ if(facc_type == FACC_MPIO)
+ /* MPI_Finalize must be called AFTER H5close which may use MPI calls */
+ MPI_Finalize();
+#endif /*H5_HAVE_PARALLEL*/
+
+ if (nerrors) goto error;
+#ifdef H5_HAVE_PARALLEL
+ if (facc_type != FACC_DEFAULT && MAINPROCESS)
+#endif /*H5_HAVE_PARALLEL*/
+ printf("All metadata performance tests passed.\n");
+
+ return 0;
+
+ error:
+ nerrors = MAX(1, nerrors);
+#ifdef H5_HAVE_PARALLEL
+ if (facc_type != FACC_DEFAULT && MAINPROCESS)
+#endif /*H5_HAVE_PARALLEL*/
+ printf("***** %d PERFORMANCE TEST%s FAILED! *****\n",
+ nerrors, 1 == nerrors ? "" : "S");
+
+ return 1;
+}
+
diff --git a/tools/test/perform/pio_engine.c b/tools/test/perform/pio_engine.c
new file mode 100644
index 0000000..eaedcb8
--- /dev/null
+++ b/tools/test/perform/pio_engine.c
@@ -0,0 +1,2683 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Author: Albert Cheng of NCSA, Oct 24, 2001.
+ */
+
+#include "hdf5.h"
+
+#ifdef H5_STDC_HEADERS
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#endif
+
+#ifdef H5_HAVE_UNISTD_H
+#include <sys/types.h>
+#include <unistd.h>
+#endif
+
+#ifdef H5_HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+
+#ifdef H5_HAVE_PARALLEL
+
+#include <mpi.h>
+
+#ifndef MPI_FILE_NULL /*MPIO may be defined in mpi.h already */
+# include <mpio.h>
+#endif /* !MPI_FILE_NULL */
+
+#include "pio_perf.h"
+
+/* Macro definitions */
+
+#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR == 6
+# define H5DCREATE(fd, name, type, space, dcpl) H5Dcreate(fd, name, type, space, dcpl)
+# define H5DOPEN(fd, name) H5Dopen(fd, name)
+#else
+# define H5DCREATE(fd, name, type, space, dcpl) H5Dcreate2(fd, name, type, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)
+# define H5DOPEN(fd, name) H5Dopen2(fd, name, H5P_DEFAULT)
+#endif
+
+/* sizes of various items. these sizes won't change during program execution */
+/* The following three must have the same type */
+#define ELMT_SIZE (sizeof(unsigned char)) /* we're doing bytes */
+#define ELMT_MPI_TYPE MPI_BYTE
+#define ELMT_H5_TYPE H5T_NATIVE_UCHAR
+
+#define GOTOERROR(errcode) { ret_code = errcode; goto done; }
+#define GOTODONE { goto done; }
+#define ERRMSG(mesg) { \
+ fprintf(stderr, "Proc %d: ", pio_mpi_rank_g); \
+ fprintf(stderr, "*** Assertion failed (%s) at line %4d in %s\n", \
+ mesg, (int)__LINE__, __FILE__); \
+}
+
+#define MSG(mesg) { \
+ fprintf(stderr, "Proc %d: ", pio_mpi_rank_g); \
+ fprintf(stderr, "(%s) at line %4d in %s\n", \
+ mesg, (int)__LINE__, __FILE__); \
+}
+
+/* verify: if val is false (0), print mesg. */
+#define VRFY(val, mesg) do { \
+ if (!val) { \
+ ERRMSG(mesg); \
+ GOTOERROR(FAIL); \
+ } \
+} while(0)
+
+
+/* POSIX I/O macros */
+#define POSIXCREATE(fn) HDopen(fn, O_CREAT|O_TRUNC|O_RDWR, 0600)
+#define POSIXOPEN(fn, F) HDopen(fn, F, 0600)
+#define POSIXCLOSE(F) HDclose(F)
+#define POSIXSEEK(F,L) HDlseek(F, L, SEEK_SET)
+#define POSIXWRITE(F,B,S) HDwrite(F,B,S)
+#define POSIXREAD(F,B,S) HDread(F,B,S)
+
+enum {
+ PIO_CREATE = 1,
+ PIO_WRITE = 2,
+ PIO_READ = 4
+};
+
+/* Global variables */
+static int clean_file_g = -1; /*whether to cleanup temporary test */
+/*files. -1 is not defined; */
+/*0 is no cleanup; 1 is do cleanup */
+
+/*
+ * In a parallel machine, the filesystem suitable for compiling is
+ * unlikely a parallel file system that is suitable for parallel I/O.
+ * There is no standard pathname for the parallel file system. /tmp
+ * is about the best guess.
+ */
+#ifndef HDF5_PARAPREFIX
+# define HDF5_PARAPREFIX ""
+#endif /* !HDF5_PARAPREFIX */
+
+#ifndef MIN
+# define MIN(a,b) ((a) < (b) ? (a) : (b))
+#endif /* !MIN */
+
+/* the different types of file descriptors we can expect */
+typedef union _file_descr {
+ int posixfd; /* POSIX file handle*/
+ MPI_File mpifd; /* MPI file */
+ hid_t h5fd; /* HDF5 file */
+} file_descr;
+
+/* local functions */
+static char *pio_create_filename(iotype iot, const char *base_name,
+ char *fullname, size_t size);
+static herr_t do_write(results *res, file_descr *fd, parameters *parms,
+ long ndsets, off_t nelmts, size_t buf_size, void *buffer);
+static herr_t do_read(results *res, file_descr *fd, parameters *parms,
+ long ndsets, off_t nelmts, size_t buf_size, void *buffer /*out*/);
+static herr_t do_fopen(parameters *param, char *fname, file_descr *fd /*out*/,
+ int flags);
+static herr_t do_fclose(iotype iot, file_descr *fd);
+static void do_cleanupfile(iotype iot, char *fname);
+
+/*
+ * Function: do_pio
+ * Purpose: PIO Engine where Parallel IO are executed.
+ * Return: results
+ * Programmer: Albert Cheng, Bill Wendling 2001/12/12
+ * Modifications:
+ * Added 2D testing (Christian Chilan, 10. August 2005)
+ */
+ results
+do_pio(parameters param)
+{
+ /* return codes */
+ herr_t ret_code = 0; /*return code */
+ results res;
+
+ file_descr fd;
+ iotype iot;
+
+ char fname[FILENAME_MAX];
+ long nf;
+ long ndsets;
+ off_t nbytes; /*number of bytes per dataset */
+ off_t snbytes; /*general dataset size */
+ /*for 1D, it is the actual dataset size */
+ /*for 2D, it is the size of a side of the dataset square */
+ char *buffer = NULL; /*data buffer pointer */
+ size_t buf_size; /*general buffer size in bytes */
+ /*for 1D, it is the actual buffer size */
+ /*for 2D, it is the length of the buffer rectangle */
+ size_t blk_size; /*data block size in bytes */
+ size_t bsize; /*actual buffer size */
+
+ /* HDF5 variables */
+ herr_t hrc; /*HDF5 return code */
+
+ /* Sanity check parameters */
+
+ /* IO type */
+ iot = param.io_type;
+
+ switch (iot) {
+ case MPIO:
+ fd.mpifd = MPI_FILE_NULL;
+ res.timers = io_time_new(MPI_CLOCK);
+ break;
+ case POSIXIO:
+ fd.posixfd = -1;
+ res.timers = io_time_new(MPI_CLOCK);
+ break;
+ case PHDF5:
+ fd.h5fd = -1;
+ res.timers = io_time_new(MPI_CLOCK);
+ break;
+ default:
+ /* unknown request */
+ fprintf(stderr, "Unknown IO type request (%d)\n", iot);
+ GOTOERROR(FAIL);
+ }
+
+ ndsets = param.num_dsets; /* number of datasets per file */
+ nbytes = param.num_bytes; /* number of bytes per dataset */
+ buf_size = param.buf_size;
+ blk_size = param.blk_size;
+
+ if (!param.dim2d){
+ snbytes = nbytes; /* General dataset size */
+ bsize = buf_size; /* Actual buffer size */
+ }
+ else {
+ snbytes = (off_t)sqrt(nbytes); /* General dataset size */
+ bsize = buf_size * blk_size; /* Actual buffer size */
+ }
+
+ if (param.num_files < 0 ) {
+ fprintf(stderr,
+ "number of files must be >= 0 (%ld)\n",
+ param.num_files);
+ GOTOERROR(FAIL);
+ }
+
+ if (ndsets < 0 ) {
+ fprintf(stderr,
+ "number of datasets per file must be >= 0 (%ld)\n",
+ ndsets);
+ GOTOERROR(FAIL);
+ }
+
+ if (param.num_procs <= 0 ) {
+ fprintf(stderr,
+ "maximum number of process to use must be > 0 (%d)\n",
+ param.num_procs);
+ GOTOERROR(FAIL);
+ }
+
+ /* Validate transfer buffer size & block size*/
+ if(blk_size<=0) {
+ HDfprintf(stderr,
+ "Transfer block size (%zu) must be > 0\n", blk_size);
+ GOTOERROR(FAIL);
+ }
+ if(buf_size<=0) {
+ HDfprintf(stderr,
+ "Transfer buffer size (%zu) must be > 0\n", buf_size);
+ GOTOERROR(FAIL);
+ }
+ if ((buf_size % blk_size) != 0){
+ HDfprintf(stderr,
+ "Transfer buffer size (%zu) must be a multiple of the "
+ "interleaved I/O block size (%zu)\n",
+ buf_size, blk_size);
+ GOTOERROR(FAIL);
+ }
+ if((snbytes%pio_mpi_nprocs_g)!=0) {
+ HDfprintf(stderr,
+ "Dataset size (%" H5_PRINTF_LL_WIDTH "d) must be a multiple of the "
+ "number of processes (%d)\n",
+ (long long)snbytes, pio_mpi_nprocs_g);
+ GOTOERROR(FAIL);
+ }
+
+ if (!param.dim2d){
+ if(((snbytes/pio_mpi_nprocs_g)%buf_size)!=0) {
+ HDfprintf(stderr,
+ "Dataset size/process (%" H5_PRINTF_LL_WIDTH "d) must be a multiple of the "
+ "trasfer buffer size (%zu)\n",
+ (long long)(snbytes/pio_mpi_nprocs_g), buf_size);
+ GOTOERROR(FAIL);
+ }
+ }
+ else {
+ if((snbytes%buf_size)!=0) {
+ HDfprintf(stderr,
+ "Dataset side size (%" H5_PRINTF_LL_WIDTH "d) must be a multiple of the "
+ "trasfer buffer size (%zu)\n",
+ (long long)snbytes, buf_size);
+ GOTOERROR(FAIL);
+ }
+ }
+
+ /* Allocate transfer buffer */
+ if ((buffer = malloc(bsize)) == NULL){
+ HDfprintf(stderr, "malloc for transfer buffer size (%zu) failed\n",
+ bsize);
+ GOTOERROR(FAIL);
+ }
+
+ if (pio_debug_level >= 4) {
+ int myrank;
+
+ MPI_Comm_rank(pio_comm_g, &myrank);
+
+ /* output all of the times for all iterations */
+ if (myrank == 0)
+ fprintf(output, "Timer details:\n");
+ }
+
+ for (nf = 1; nf <= param.num_files; nf++) {
+ /*
+ * Write performance measurement
+ */
+ /* Open file for write */
+ char base_name[256];
+
+ sprintf(base_name, "#pio_tmp_%lu", nf);
+ pio_create_filename(iot, base_name, fname, sizeof(fname));
+ if (pio_debug_level > 0)
+ HDfprintf(output, "rank %d: data filename=%s\n",
+ pio_mpi_rank_g, fname);
+
+ /* Need barrier to make sure everyone starts at the same time */
+ MPI_Barrier(pio_comm_g);
+
+ set_time(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS, TSTART);
+ hrc = do_fopen(&param, fname, &fd, PIO_CREATE | PIO_WRITE);
+
+ VRFY((hrc == SUCCESS), "do_fopen failed");
+
+ set_time(res.timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTART);
+ hrc = do_write(&res, &fd, &param, ndsets, nbytes, buf_size, buffer);
+ hrc == SUCCESS;
+ set_time(res.timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTOP);
+
+ VRFY((hrc == SUCCESS), "do_write failed");
+
+ /* Close file for write */
+ hrc = do_fclose(iot, &fd);
+
+ set_time(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS, TSTOP);
+ VRFY((hrc == SUCCESS), "do_fclose failed");
+
+ if (!param.h5_write_only) {
+ /*
+ * Read performance measurement
+ */
+ /* Need barrier to make sure everyone is done writing and has
+ * closed the file. Also to make sure everyone starts reading
+ * at the same time.
+ */
+ MPI_Barrier(pio_comm_g);
+
+ /* Open file for read */
+ set_time(res.timers, HDF5_GROSS_READ_FIXED_DIMS, TSTART);
+ hrc = do_fopen(&param, fname, &fd, PIO_READ);
+
+ VRFY((hrc == SUCCESS), "do_fopen failed");
+
+ set_time(res.timers, HDF5_FINE_READ_FIXED_DIMS, TSTART);
+ hrc = do_read(&res, &fd, &param, ndsets, nbytes, buf_size, buffer);
+ set_time(res.timers, HDF5_FINE_READ_FIXED_DIMS, TSTOP);
+ VRFY((hrc == SUCCESS), "do_read failed");
+
+ /* Close file for read */
+ hrc = do_fclose(iot, &fd);
+
+ set_time(res.timers, HDF5_GROSS_READ_FIXED_DIMS, TSTOP);
+ VRFY((hrc == SUCCESS), "do_fclose failed");
+ }
+
+ /* Need barrier to make sure everyone is done with the file */
+ /* before it may be removed by do_cleanupfile */
+ MPI_Barrier(pio_comm_g);
+ do_cleanupfile(iot, fname);
+ }
+
+done:
+ /* clean up */
+ /* release HDF5 objects */
+
+ /* close any opened files */
+ /* no remove(fname) because that should have happened normally. */
+ switch (iot) {
+ case POSIXIO:
+ if (fd.posixfd != -1)
+ hrc = do_fclose(iot, &fd);
+ break;
+ case MPIO:
+ if (fd.mpifd != MPI_FILE_NULL)
+ hrc = do_fclose(iot, &fd);
+ break;
+ case PHDF5:
+ if (fd.h5fd != -1)
+ hrc = do_fclose(iot, &fd);
+ break;
+ }
+
+ /* release generic resources */
+ if(buffer)
+ free(buffer);
+ res.ret_code = ret_code;
+ return res;
+}
+
+/*
+ * Function: pio_create_filename
+ * Purpose: Create a new filename to write to. Determine the correct
+ * suffix to append to the filename by the type of I/O we're
+ * doing. Also, place in the /tmp/{$USER,$LOGIN} directory if
+ * USER or LOGIN are specified in the environment.
+ * Return: Pointer to filename or NULL
+ * Programmer: Bill Wendling, 21. November 2001
+ * Modifications:
+ */
+ static char *
+pio_create_filename(iotype iot, const char *base_name, char *fullname, size_t size)
+{
+ const char *prefix, *suffix = "";
+ char *ptr, last = '\0';
+ size_t i, j;
+
+ if (!base_name || !fullname || size < 1)
+ return NULL;
+
+ HDmemset(fullname, 0, size);
+
+ switch (iot) {
+ case POSIXIO:
+ suffix = ".posix";
+ break;
+ case MPIO:
+ suffix = ".mpio";
+ break;
+ case PHDF5:
+ suffix = ".h5";
+ break;
+ }
+
+ /* First use the environment variable and then try the constant */
+ prefix = HDgetenv("HDF5_PARAPREFIX");
+
+#ifdef HDF5_PARAPREFIX
+ if (!prefix)
+ prefix = HDF5_PARAPREFIX;
+#endif /* HDF5_PARAPREFIX */
+
+ /* Prepend the prefix value to the base name */
+ if (prefix && *prefix) {
+ /* If the prefix specifies the HDF5_PARAPREFIX directory, then
+ * default to using the "/tmp/$USER" or "/tmp/$LOGIN"
+ * directory instead. */
+ register char *user, *login, *subdir;
+
+ user = HDgetenv("USER");
+ login = HDgetenv("LOGIN");
+ subdir = (user ? user : login);
+
+ if (subdir) {
+ for (i = 0; i < size-1 && prefix[i]; i++)
+ fullname[i] = prefix[i];
+
+ fullname[i++] = '/';
+
+ for (j = 0; i < size && subdir[j]; i++, j++)
+ fullname[i] = subdir[j];
+ }
+ else {
+ /* We didn't append the prefix yet */
+ HDstrncpy(fullname, prefix, size);
+ fullname[size - 1] = '\0';
+ }
+
+ if ((HDstrlen(fullname) + HDstrlen(base_name) + 1) < size) {
+ /* Append the base_name with a slash first. Multiple slashes are
+ * handled below. */
+ h5_stat_t buf;
+
+ if (HDstat(fullname, &buf) < 0)
+ /* The directory doesn't exist just yet */
+ if (HDmkdir(fullname, (mode_t) 0755) < 0 && errno != EEXIST) {
+ /* We couldn't make the "/tmp/${USER,LOGIN}" subdirectory.
+ * Default to PREFIX's original prefix value. */
+ HDstrcpy(fullname, prefix);
+ }
+
+ HDstrcat(fullname, "/");
+ HDstrcat(fullname, base_name);
+ }
+ else {
+ /* Buffer is too small */
+ return NULL;
+ }
+ }
+ else if (HDstrlen(base_name) >= size) {
+ /* Buffer is too small */
+ return NULL;
+ }
+ else {
+ HDstrcpy(fullname, base_name);
+ }
+
+ /* Append a suffix */
+ if (suffix) {
+ if (HDstrlen(fullname) + HDstrlen(suffix) >= size)
+ return NULL;
+
+ HDstrcat(fullname, suffix);
+ }
+
+ /* Remove any double slashes in the filename */
+ for (ptr = fullname, i = j = 0; ptr && i < size; i++, ptr++) {
+ if (*ptr != '/' || last != '/')
+ fullname[j++] = *ptr;
+
+ last = *ptr;
+ }
+
+ return fullname;
+}
+
+/*
+ * Function: do_write
+ * Purpose: Write the required amount of data to the file.
+ * Return: SUCCESS or FAIL
+ * Programmer: Albert Cheng, Bill Wendling, 2001/12/13
+ * Modifications:
+ * Added 2D testing (Christian Chilan, 10. August 2005)
+ */
+ static herr_t
+do_write(results *res, file_descr *fd, parameters *parms, long ndsets,
+ off_t nbytes, size_t buf_size, void *buffer)
+{
+ int ret_code = SUCCESS;
+ int rc; /*routine return code */
+ long ndset;
+ size_t blk_size; /* The block size to subdivide the xfer buffer into */
+ off_t nbytes_xfer; /* Total number of bytes transferred so far */
+ size_t nbytes_xfer_advance; /* Number of bytes transferred in a single I/O operation */
+ size_t nbytes_toxfer; /* Number of bytes to transfer a particular time */
+ char dname[64];
+ off_t dset_offset=0; /*dataset offset in a file */
+ off_t bytes_begin[2]; /*first elmt this process transfer */
+ off_t bytes_count; /*number of elmts this process transfer */
+ off_t snbytes=0; /*size of a side of the dataset square */
+ unsigned char *buf_p; /* Current buffer pointer */
+
+ /* POSIX variables */
+ off_t file_offset; /* File offset of the next transfer */
+ off_t file_offset_advance; /* File offset advance after each I/O operation */
+ off_t posix_file_offset; /* Base file offset of the next transfer */
+
+ /* MPI variables */
+ MPI_Offset mpi_file_offset; /* Base file offset of the next transfer*/
+ MPI_Offset mpi_offset; /* Offset in MPI file */
+ MPI_Offset mpi_offset_advance; /* Offset advance after each I/O operation */
+ MPI_Datatype mpi_file_type; /* MPI derived type for 1D file */
+ MPI_Datatype mpi_blk_type; /* MPI derived type for 1D buffer */
+ MPI_Datatype mpi_cont_type; /* MPI derived type for 2D contiguous file */
+ MPI_Datatype mpi_partial_buffer_cont; /* MPI derived type for partial 2D contiguous buffer */
+ MPI_Datatype mpi_inter_type; /* MPI derived type for 2D interleaved file */
+ MPI_Datatype mpi_partial_buffer_inter; /* MPI derived type for partial 2D interleaved buffer */
+ MPI_Datatype mpi_full_buffer; /* MPI derived type for 2D full buffer */
+ MPI_Datatype mpi_full_chunk; /* MPI derived type for 2D full chunk */
+ MPI_Datatype mpi_chunk_inter_type; /* MPI derived type for 2D chunk interleaved file */
+ MPI_Datatype mpi_collective_type; /* Generic MPI derived type for 2D collective access */
+ MPI_Status mpi_status;
+ int mrc; /* MPI return code */
+
+ /* HDF5 variables */
+ herr_t hrc; /*HDF5 return code */
+ hsize_t h5dims[2]; /*dataset dim sizes */
+ hid_t h5dset_space_id = -1; /*dataset space ID */
+ hid_t h5mem_space_id = -1; /*memory dataspace ID */
+ hid_t h5ds_id = -1; /*dataset handle */
+ hsize_t h5block[2]; /*dataspace selection */
+ hsize_t h5stride[2];
+ hsize_t h5count[2];
+ hsize_t h5start[2];
+ hssize_t h5offset[2]; /* Selection offset within dataspace */
+ hid_t h5dcpl = -1; /* Dataset creation property list */
+ hid_t h5dxpl = -1; /* Dataset transfer property list */
+
+ /* Get the parameters from the parameter block */
+ blk_size=parms->blk_size;
+
+ /* There are two kinds of transfer patterns, contiguous and interleaved.
+ * Let 0,1,2,...,n be data accessed by process 0,1,2,...,n
+ * where n is rank of the last process.
+ * In contiguous pattern, data are accessed as
+ * 000...111...222...nnn...
+ * In interleaved pattern, data are accessed as
+ * 012...n012...n...
+ * These are all in the scope of one dataset.
+ */
+
+ /* 1D dataspace */
+ if (!parms->dim2d){
+ /* Contiguous Pattern: */
+ if (!parms->interleaved) {
+ bytes_begin[0] = (off_t)(((double)nbytes*pio_mpi_rank_g)/pio_mpi_nprocs_g);
+ } /* end if */
+ /* Interleaved Pattern: */
+ else {
+ bytes_begin[0] = (off_t)(blk_size*pio_mpi_rank_g);
+ } /* end else */
+
+ /* Prepare buffer for verifying data */
+ if (parms->verify)
+ memset(buffer,pio_mpi_rank_g+1,buf_size);
+ }/* end if */
+ /* 2D dataspace */
+ else {
+ /* nbytes is always the number of bytes per dataset (1D or 2D). If the
+ dataspace is 2D, snbytes is the size of a side of the dataset square.
+ */
+ snbytes = (off_t)sqrt(nbytes);
+
+ /* Contiguous Pattern: */
+ if (!parms->interleaved) {
+ bytes_begin[0] = (off_t)((double)snbytes*pio_mpi_rank_g / pio_mpi_nprocs_g);
+ bytes_begin[1] = 0;
+ } /* end if */
+ /* Interleaved Pattern: */
+ else {
+ bytes_begin[0] = 0;
+
+ if(!parms->h5_use_chunks || parms->io_type==PHDF5)
+ bytes_begin[1] = (off_t)(blk_size*pio_mpi_rank_g);
+ else
+ bytes_begin[1] = (off_t)(blk_size*blk_size*pio_mpi_rank_g);
+ } /* end else */
+
+ /* Prepare buffer for verifying data */
+ if (parms->verify)
+ memset(buffer,pio_mpi_rank_g+1,buf_size*blk_size);
+ } /* end else */
+
+
+ /* Calculate the total number of bytes (bytes_count) to be
+ * transferred by this process. It may be different for different
+ * transfer pattern due to rounding to integral values.
+ */
+ /*
+ * Calculate the beginning bytes of this process and the next.
+ * bytes_count is the difference between these two beginnings.
+ * This way, it eliminates any rounding errors.
+ * (This is tricky, don't mess with the formula, rounding errors
+ * can easily get introduced) */
+ bytes_count = (off_t)(((double)nbytes*(pio_mpi_rank_g+1)) / pio_mpi_nprocs_g)
+ - (off_t)(((double)nbytes*pio_mpi_rank_g) / pio_mpi_nprocs_g);
+
+ /* debug */
+ if (pio_debug_level >= 4) {
+ HDprint_rank(output);
+ if (!parms->dim2d) {
+ HDfprintf(output, "Debug(do_write): "
+ "buf_size=%zu, bytes_begin=%" H5_PRINTF_LL_WIDTH "d, bytes_count=%" H5_PRINTF_LL_WIDTH "d\n",
+ buf_size, (long long)bytes_begin[0],
+ (long long)bytes_count);
+ } else {
+ HDfprintf(output, "Debug(do_write): "
+ "linear buf_size=%zu, bytes_begin=(%" H5_PRINTF_LL_WIDTH "d,%" H5_PRINTF_LL_WIDTH "d), bytes_count=%" H5_PRINTF_LL_WIDTH "d\n",
+ buf_size*blk_size, (long long)bytes_begin[0],
+ (long long)bytes_begin[1], (long long)bytes_count);
+ }
+ }
+
+ /* I/O Access specific setup */
+ switch (parms->io_type) {
+ case POSIXIO:
+ /* No extra setup */
+ break;
+
+ case MPIO: /* MPI-I/O setup */
+ /* 1D dataspace */
+ if (!parms->dim2d){
+ /* Build block's derived type */
+ mrc = MPI_Type_contiguous((int)blk_size,
+ MPI_BYTE, &mpi_blk_type);
+ VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE");
+
+ /* Build file's derived type */
+ mrc = MPI_Type_vector((int)(buf_size/blk_size), (int)1,
+ (int)pio_mpi_nprocs_g, mpi_blk_type, &mpi_file_type);
+ VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE");
+
+ /* Commit file type */
+ mrc = MPI_Type_commit( &mpi_file_type );
+ VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT");
+
+ /* Commit buffer type */
+ mrc = MPI_Type_commit( &mpi_blk_type );
+ VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT");
+ } /* end if */
+ /* 2D dataspace */
+ else {
+ /* Build partial buffer derived type for contiguous access */
+
+ mrc = MPI_Type_contiguous((int)buf_size, MPI_BYTE,
+ &mpi_partial_buffer_cont);
+ VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE");
+
+ /* Commit partial buffer derived type */
+ mrc = MPI_Type_commit(&mpi_partial_buffer_cont);
+ VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT");
+
+ /* Build contiguous file's derived type */
+ mrc = MPI_Type_vector((int)blk_size, (int)1, (int)(snbytes/buf_size),
+ mpi_partial_buffer_cont, &mpi_cont_type);
+ VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE");
+
+ /* Commit contiguous file type */
+ mrc = MPI_Type_commit(&mpi_cont_type);
+ VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT");
+
+ /* Build partial buffer derived type for interleaved access */
+ mrc = MPI_Type_contiguous((int)blk_size, MPI_BYTE,
+ &mpi_partial_buffer_inter);
+ VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE");
+
+ /* Commit partial buffer derived type */
+ mrc = MPI_Type_commit(&mpi_partial_buffer_inter);
+ VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT");
+
+ /* Build interleaved file's derived type */
+ mrc = MPI_Type_vector((int)buf_size, (int)1, (int)(snbytes/blk_size),
+ mpi_partial_buffer_inter, &mpi_inter_type);
+ VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE");
+
+ /* Commit interleaved file type */
+ mrc = MPI_Type_commit(&mpi_inter_type);
+ VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT");
+
+ /* Build full buffer derived type */
+ mrc = MPI_Type_contiguous((int)(blk_size*buf_size), MPI_BYTE,
+ &mpi_full_buffer);
+ VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE");
+
+ /* Commit full buffer derived type */
+ mrc = MPI_Type_commit(&mpi_full_buffer);
+ VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT");
+
+ /* Build full chunk derived type */
+ mrc = MPI_Type_contiguous((int)(blk_size*blk_size), MPI_BYTE,
+ &mpi_full_chunk);
+ VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE");
+
+ /* Commit full chunk derived type */
+ mrc = MPI_Type_commit(&mpi_full_chunk);
+ VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT");
+
+ /* Build chunk interleaved file's derived type */
+ mrc = MPI_Type_vector((int)(buf_size/blk_size), (int)1, (int)(snbytes/blk_size),
+ mpi_full_chunk, &mpi_chunk_inter_type);
+ VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE");
+
+ /* Commit chunk interleaved file type */
+ mrc = MPI_Type_commit(&mpi_chunk_inter_type);
+ VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT");
+
+ } /* end else */
+ break;
+
+ case PHDF5: /* HDF5 setup */
+ /* 1D dataspace */
+ if (!parms->dim2d){
+ if(nbytes>0) {
+ /* define a contiguous dataset of nbytes native bytes */
+ h5dims[0] = nbytes;
+ h5dset_space_id = H5Screate_simple(1, h5dims, NULL);
+ VRFY((h5dset_space_id >= 0), "H5Screate_simple");
+
+ /* Set up the file dset space id to select the pattern to access */
+ if (!parms->interleaved){
+ /* Contiguous pattern */
+ h5start[0] = bytes_begin[0];
+ h5stride[0] = h5block[0] = blk_size;
+ h5count[0] = buf_size/blk_size;
+ } /* end if */
+ else {
+ /* Interleaved access pattern */
+ /* Skip offset over blocks of other processes */
+ h5start[0] = bytes_begin[0];
+ h5stride[0] = blk_size*pio_mpi_nprocs_g;
+ h5block[0] = blk_size;
+ h5count[0] = buf_size/blk_size;
+ } /* end else */
+ hrc = H5Sselect_hyperslab(h5dset_space_id, H5S_SELECT_SET,
+ h5start, h5stride, h5count, h5block);
+ VRFY((hrc >= 0), "H5Sselect_hyperslab");
+ } /* end if */
+ else {
+ h5dset_space_id = H5Screate(H5S_SCALAR);
+ VRFY((h5dset_space_id >= 0), "H5Screate");
+ } /* end else */
+
+ /* Create the memory dataspace that corresponds to the xfer buffer */
+ if(buf_size>0) {
+ h5dims[0] = buf_size;
+ h5mem_space_id = H5Screate_simple(1, h5dims, NULL);
+ VRFY((h5mem_space_id >= 0), "H5Screate_simple");
+ } /* end if */
+ else {
+ h5mem_space_id = H5Screate(H5S_SCALAR);
+ VRFY((h5mem_space_id >= 0), "H5Screate");
+ } /* end else */
+ } /* end if */
+ /* 2D dataspace */
+ else {
+ if(nbytes>0) {
+ /* define a contiguous dataset of nbytes native bytes */
+ h5dims[0] = snbytes;
+ h5dims[1] = snbytes;
+ h5dset_space_id = H5Screate_simple(2, h5dims, NULL);
+ VRFY((h5dset_space_id >= 0), "H5Screate_simple");
+
+ /* Set up the file dset space id to select the pattern to access */
+ if (!parms->interleaved){
+ /* Contiguous pattern */
+ h5start[0] = bytes_begin[0];
+ h5start[1] = bytes_begin[1];
+ h5stride[0] = 1;
+ h5stride[1] = h5block[0] = h5block[1] = blk_size;
+ h5count[0] = 1;
+ h5count[1] = buf_size/blk_size;
+ } /* end if */
+ else {
+ /* Interleaved access pattern */
+ /* Skip offset over blocks of other processes */
+ h5start[0] = bytes_begin[0];
+ h5start[1] = bytes_begin[1];
+ h5stride[0] = blk_size;
+ h5stride[1] = blk_size*pio_mpi_nprocs_g;
+ h5block[0] = h5block[1] = blk_size;
+ h5count[0] = buf_size/blk_size;
+ h5count[1] = 1;
+ } /* end else */
+ hrc = H5Sselect_hyperslab(h5dset_space_id, H5S_SELECT_SET,
+ h5start, h5stride, h5count, h5block);
+ VRFY((hrc >= 0), "H5Sselect_hyperslab");
+ } /* end if */
+ else {
+ h5dset_space_id = H5Screate(H5S_SCALAR);
+ VRFY((h5dset_space_id >= 0), "H5Screate");
+ } /* end else */
+
+ /* Create the memory dataspace that corresponds to the xfer buffer */
+ if(buf_size>0) {
+ if (!parms->interleaved){
+ h5dims[0] = blk_size;
+ h5dims[1] = buf_size;
+ }else{
+ h5dims[0] = buf_size;
+ h5dims[1] = blk_size;
+ }
+ h5mem_space_id = H5Screate_simple(2, h5dims, NULL);
+ VRFY((h5mem_space_id >= 0), "H5Screate_simple");
+ } /* end if */
+ else {
+ h5mem_space_id = H5Screate(H5S_SCALAR);
+ VRFY((h5mem_space_id >= 0), "H5Screate");
+ } /* end else */
+ } /* end else */
+
+ /* Create the dataset transfer property list */
+ h5dxpl = H5Pcreate(H5P_DATASET_XFER);
+ if (h5dxpl < 0) {
+ fprintf(stderr, "HDF5 Property List Create failed\n");
+ GOTOERROR(FAIL);
+ }
+
+ /* Change to collective I/O, if asked */
+ if(parms->collective) {
+ hrc = H5Pset_dxpl_mpio(h5dxpl, H5FD_MPIO_COLLECTIVE);
+ if (hrc < 0) {
+ fprintf(stderr, "HDF5 Property List Set failed\n");
+ GOTOERROR(FAIL);
+ } /* end if */
+ } /* end if */
+ break;
+ } /* end switch */
+
+ for (ndset = 1; ndset <= ndsets; ++ndset) {
+
+ /* Calculate dataset offset within a file */
+
+ /* create dataset */
+ switch (parms->io_type) {
+ case POSIXIO:
+ case MPIO:
+ /* both posix and mpi io just need dataset offset in file*/
+ dset_offset = (ndset - 1) * nbytes;
+ break;
+
+ case PHDF5:
+ h5dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ if (h5dcpl < 0) {
+ fprintf(stderr, "HDF5 Property List Create failed\n");
+ GOTOERROR(FAIL);
+ }
+ /* 1D dataspace */
+ if (!parms->dim2d){
+ /* Make the dataset chunked if asked */
+ if(parms->h5_use_chunks) {
+ /* Set the chunk size to be the same as the buffer size */
+ h5dims[0] = blk_size;
+ hrc = H5Pset_chunk(h5dcpl, 1, h5dims);
+ if (hrc < 0) {
+ fprintf(stderr, "HDF5 Property List Set failed\n");
+ GOTOERROR(FAIL);
+ } /* end if */
+ } /* end if */
+ }/* end if */
+ else{
+ /* 2D dataspace */
+ if(parms->h5_use_chunks) {
+ /* Set the chunk size to be the same as the block size */
+ h5dims[0] = blk_size;
+ h5dims[1] = blk_size;
+ hrc = H5Pset_chunk(h5dcpl, 2, h5dims);
+ if (hrc < 0) {
+ fprintf(stderr, "HDF5 Property List Set failed\n");
+ GOTOERROR(FAIL);
+ } /* end if */
+ } /* end if */
+ }/* end else */
+
+ sprintf(dname, "Dataset_%ld", ndset);
+ h5ds_id = H5DCREATE(fd->h5fd, dname, ELMT_H5_TYPE,
+ h5dset_space_id, h5dcpl);
+
+ if (h5ds_id < 0) {
+ fprintf(stderr, "HDF5 Dataset Create failed\n");
+ GOTOERROR(FAIL);
+ }
+
+ hrc = H5Pclose(h5dcpl);
+ /* verifying the close of the dcpl */
+ if (hrc < 0) {
+ fprintf(stderr, "HDF5 Property List Close failed\n");
+ GOTOERROR(FAIL);
+ }
+ break;
+ }
+
+ /* The task is to transfer bytes_count bytes, starting at
+ * bytes_begin position, using transfer buffer of buf_size bytes.
+ * If interleaved, select buf_size at a time, in round robin
+ * fashion, according to number of process. Otherwise, select
+ * all bytes_count in contiguous.
+ */
+ nbytes_xfer = 0 ;
+
+ /* 1D dataspace */
+ if (!parms->dim2d){
+ /* Set base file offset for all I/O patterns and POSIX access */
+ posix_file_offset = dset_offset + bytes_begin[0];
+
+ /* Set base file offset for all I/O patterns and MPI access */
+ mpi_file_offset = (MPI_Offset)(dset_offset + bytes_begin[0]);
+ } /* end if */
+ else {
+ /* Set base file offset for all I/O patterns and POSIX access */
+ posix_file_offset=dset_offset + bytes_begin[0]*snbytes+
+ bytes_begin[1];
+
+ /* Set base file offset for all I/O patterns and MPI access */
+ mpi_file_offset=(MPI_Offset)(dset_offset + bytes_begin[0]*snbytes+
+ bytes_begin[1]);
+ } /* end else */
+
+ /* Start "raw data" write timer */
+ set_time(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, TSTART);
+
+ while (nbytes_xfer < bytes_count){
+ /* Write */
+ /* Calculate offset of write within a dataset/file */
+ switch (parms->io_type) {
+ case POSIXIO:
+ /* 1D dataspace */
+ if (!parms->dim2d){
+ /* Contiguous pattern */
+ if (!parms->interleaved) {
+ /* Compute file offset */
+ file_offset = posix_file_offset + (off_t)nbytes_xfer;
+
+ /* only care if seek returns error */
+ rc = POSIXSEEK(fd->posixfd, file_offset) < 0 ? -1 : 0;
+ VRFY((rc==0), "POSIXSEEK");
+
+ /* check if all bytes are written */
+ rc = ((ssize_t)buf_size ==
+ POSIXWRITE(fd->posixfd, buffer, buf_size));
+ VRFY((rc != 0), "POSIXWRITE");
+
+ /* Advance global offset in dataset */
+ nbytes_xfer+=buf_size;
+ } /* end if */
+ /* Interleaved access pattern */
+ else {
+ /* Set the base of user's buffer */
+ buf_p=(unsigned char *)buffer;
+
+ /* Set the number of bytes to transfer this time */
+ nbytes_toxfer = buf_size;
+
+ /* Loop over the buffers to write */
+ while(nbytes_toxfer>0) {
+ /* Skip offset over blocks of other processes */
+ file_offset = posix_file_offset +
+ (off_t)(nbytes_xfer*pio_mpi_nprocs_g);
+
+ /* only care if seek returns error */
+ rc = POSIXSEEK(fd->posixfd, file_offset) < 0 ? -1 : 0;
+ VRFY((rc==0), "POSIXSEEK");
+
+ /* check if all bytes are written */
+ rc = ((ssize_t)blk_size ==
+ POSIXWRITE(fd->posixfd, buf_p, blk_size));
+ VRFY((rc != 0), "POSIXWRITE");
+
+ /* Advance location in buffer */
+ buf_p+=blk_size;
+
+ /* Advance global offset in dataset */
+ nbytes_xfer+=blk_size;
+
+ /* Decrement number of bytes left this time */
+ nbytes_toxfer-=blk_size;
+ } /* end while */
+ } /* end else */
+ } /* end if */
+ /* 2D dataspace */
+ else {
+ /* Contiguous storage */
+ if (!parms->h5_use_chunks) {
+ /* Contiguous access pattern */
+ if (!parms->interleaved) {
+ /* Compute file offset */
+ file_offset=posix_file_offset+(off_t)(((nbytes_xfer/blk_size)
+ /snbytes)*(blk_size*snbytes)+((nbytes_xfer/blk_size)%snbytes));
+
+ /* Number of bytes to be transferred per I/O operation */
+ nbytes_xfer_advance = buf_size;
+
+ /* Global offset advance after each I/O operation */
+ file_offset_advance = (off_t)snbytes;
+ } /* end if */
+ /* Interleaved access pattern */
+ else {
+ /* Compute file offset */
+ file_offset=posix_file_offset+(off_t)((((nbytes_xfer/buf_size)
+ *pio_mpi_nprocs_g)/snbytes)*(buf_size*snbytes)
+ +((nbytes_xfer/buf_size)*pio_mpi_nprocs_g)%snbytes);
+
+ /* Number of bytes to be transferred per I/O operation */
+ nbytes_xfer_advance = blk_size;
+
+ /* Global offset advance after each I/O operation */
+ file_offset_advance = (off_t)snbytes;
+ } /* end else */
+ } /* end if */
+ /* Chunked storage */
+ else {
+ /*Contiguous access pattern */
+ if (!parms->interleaved) {
+ /* Compute file offset */
+ file_offset=posix_file_offset+(off_t)nbytes_xfer;
+
+ /* Number of bytes to be transferred per I/O operation */
+ nbytes_xfer_advance = blk_size * buf_size;
+
+ /* Global offset advance after each I/O operation */
+ file_offset_advance = 0;
+ } /* end if */
+ /*Interleaved access pattern */
+ else {
+ /* Compute file offset */
+ /* Before simplification */
+ /* file_offset=posix_file_offset+(off_t)((nbytes_xfer/(buf_size/blk_size)
+ *pio_mpi_nprocs_g)/(snbytes/blk_size*(blk_size*blk_size))*(buf_size/blk_size
+ *snbytes/blk_size*(blk_size*blk_size))+((nbytes_xfer/(buf_size/blk_size))
+ *pio_mpi_nprocs_g)%(snbytes/blk_size*(blk_size*blk_size))); */
+
+ file_offset=posix_file_offset+(off_t)(((nbytes_xfer/(buf_size/blk_size)
+ *pio_mpi_nprocs_g)/(snbytes*blk_size))*(buf_size*snbytes)+((nbytes_xfer/(buf_size/blk_size))
+ *pio_mpi_nprocs_g)%(snbytes*blk_size));
+
+ /* Number of bytes to be transferred per I/O operation */
+ nbytes_xfer_advance = blk_size * blk_size;
+
+ /* Global offset advance after each I/O operation */
+ /* file_offset_advance = (off_t)(snbytes/blk_size*(blk_size*blk_size)); */
+ file_offset_advance = (off_t)(snbytes*blk_size);
+ } /* end else */
+ } /* end else */
+
+ /* Common code for file access */
+
+ /* Set the base of user's buffer */
+ buf_p = (unsigned char *)buffer;
+
+ /* Set the number of bytes to transfer this time */
+ nbytes_toxfer = buf_size*blk_size;
+
+ /* Loop over portions of the buffer to write */
+ while(nbytes_toxfer>0){
+ /* only care if seek returns error */
+ rc = POSIXSEEK(fd->posixfd, file_offset) < 0 ? -1 : 0;
+ VRFY((rc==0), "POSIXSEEK");
+
+ /* check if all bytes are written */
+ rc = ((ssize_t)nbytes_xfer_advance ==
+ POSIXWRITE(fd->posixfd, buf_p, nbytes_xfer_advance));
+ VRFY((rc != 0), "POSIXWRITE");
+
+ /* Advance location in buffer */
+ buf_p+=nbytes_xfer_advance;
+
+ /* Advance global offset in dataset */
+ nbytes_xfer+=nbytes_xfer_advance;
+
+ /* Decrement number of bytes left this time */
+ nbytes_toxfer-=nbytes_xfer_advance;
+
+ /* Partially advance file offset */
+ file_offset+=file_offset_advance;
+ } /* end while */
+
+ } /* end else */
+
+ break;
+
+ case MPIO:
+ /* 1D dataspace */
+ if (!parms->dim2d){
+ /* Independent file access */
+ if(!parms->collective) {
+ /* Contiguous pattern */
+ if (!parms->interleaved){
+ /* Compute offset in file */
+ mpi_offset = mpi_file_offset +
+ nbytes_xfer;
+
+ /* Perform independent write */
+ mrc = MPI_File_write_at(fd->mpifd, mpi_offset, buffer,
+ (int)(buf_size/blk_size), mpi_blk_type,
+ &mpi_status);
+ VRFY((mrc==MPI_SUCCESS), "MPIO_WRITE");
+
+ /* Advance global offset in dataset */
+ nbytes_xfer+=buf_size;
+ } /* end if */
+ /* Interleaved access pattern */
+ else {
+ /* Set the base of user's buffer */
+ buf_p=(unsigned char *)buffer;
+
+ /* Set the number of bytes to transfer this time */
+ nbytes_toxfer = buf_size;
+
+ /* Loop over the buffers to write */
+ while(nbytes_toxfer>0) {
+ /* Skip offset over blocks of other processes */
+ mpi_offset = mpi_file_offset +
+ (nbytes_xfer*pio_mpi_nprocs_g);
+
+ /* Perform independent write */
+ mrc = MPI_File_write_at(fd->mpifd, mpi_offset, buf_p,
+ (int)1, mpi_blk_type, &mpi_status);
+ VRFY((mrc==MPI_SUCCESS), "MPIO_WRITE");
+
+ /* Advance location in buffer */
+ buf_p+=blk_size;
+
+ /* Advance global offset in dataset */
+ nbytes_xfer+=blk_size;
+
+ /* Decrement number of bytes left this time */
+ nbytes_toxfer-=blk_size;
+ } /* end while */
+ } /* end else */
+ } /* end if */
+ /* Collective file access */
+ else {
+ /* Contiguous access pattern */
+ if (!parms->interleaved){
+ /* Compute offset in file */
+ mpi_offset = mpi_file_offset +
+ nbytes_xfer;
+
+ /* Perform independent write */
+ mrc = MPI_File_write_at_all(fd->mpifd, mpi_offset, buffer,
+ (int)(buf_size/blk_size), mpi_blk_type, &mpi_status);
+ VRFY((mrc==MPI_SUCCESS), "MPIO_WRITE");
+
+ /* Advance global offset in dataset */
+ nbytes_xfer+=buf_size;
+ } /* end if */
+ /* Interleaved access pattern */
+ else {
+ /* Compute offset in file */
+ mpi_offset = mpi_file_offset +
+ (nbytes_xfer*pio_mpi_nprocs_g);
+
+ /* Set the file view */
+ mrc = MPI_File_set_view(fd->mpifd, mpi_offset, mpi_blk_type,
+ mpi_file_type, (char*)"native", h5_io_info_g);
+ VRFY((mrc==MPI_SUCCESS), "MPIO_VIEW");
+
+ /* Perform write */
+ mrc = MPI_File_write_at_all(fd->mpifd, 0, buffer,
+ (int)(buf_size/blk_size), mpi_blk_type, &mpi_status);
+ VRFY((mrc==MPI_SUCCESS), "MPIO_WRITE");
+
+ /* Advance global offset in dataset */
+ nbytes_xfer+=buf_size;
+ } /* end else */
+ } /* end else */
+ } /* end if */
+ /* 2D dataspace */
+ else {
+ /* Contiguous storage */
+ if (!parms->h5_use_chunks) {
+ /* Contiguous access pattern */
+ if (!parms->interleaved) {
+ /* Compute offset in file */
+ mpi_offset=mpi_file_offset+((nbytes_xfer/blk_size)/snbytes)*
+ (blk_size*snbytes)+((nbytes_xfer/blk_size)%snbytes);
+
+ /* Number of bytes to be transferred per I/O operation */
+ nbytes_xfer_advance = buf_size;
+
+ /* Global offset advance after each I/O operation */
+ mpi_offset_advance = snbytes;
+
+ /* MPI type to be used for collective access */
+ mpi_collective_type = mpi_cont_type;
+ } /* end if */
+ /* Interleaved access pattern */
+ else {
+ /* Compute offset in file */
+ mpi_offset=mpi_file_offset+(((nbytes_xfer/buf_size)*pio_mpi_nprocs_g)/snbytes)*
+ (buf_size*snbytes)+((nbytes_xfer/buf_size)*pio_mpi_nprocs_g)%snbytes;
+
+ /* Number of bytes to be transferred per I/O operation */
+ nbytes_xfer_advance = blk_size;
+
+ /* Global offset advance after each I/O operation */
+ mpi_offset_advance = snbytes;
+
+ /* MPI type to be used for collective access */
+ mpi_collective_type = mpi_inter_type;
+ } /* end else */
+ } /* end if */
+ /* Chunked storage */
+ else {
+ /*Contiguous access pattern */
+ if (!parms->interleaved) {
+ /* Compute offset in file */
+ mpi_offset=mpi_file_offset+nbytes_xfer;
+
+ /* Number of bytes to be transferred per I/O operation */
+ nbytes_xfer_advance = blk_size * buf_size;
+
+ /* Global offset advance after each I/O operation */
+ mpi_offset_advance = 0;
+
+ /* MPI type to be used for collective access */
+ mpi_collective_type = mpi_full_buffer;
+ } /* end if */
+ /*Interleaved access pattern */
+ else {
+ /* Compute offset in file */
+ /* Before simplification */
+ /* mpi_offset=mpi_file_offset+(nbytes_xfer/(buf_size/blk_size)
+ *pio_mpi_nprocs_g)/(snbytes/blk_size*(blk_size*blk_size))*
+ (buf_size/blk_size*snbytes/blk_size*(blk_size*blk_size))+
+ ((nbytes_xfer/(buf_size/blk_size))*pio_mpi_nprocs_g)%(snbytes
+ /blk_size*(blk_size*blk_size)); */
+ mpi_offset=mpi_file_offset+((nbytes_xfer/(buf_size/blk_size)
+ *pio_mpi_nprocs_g)/(snbytes*blk_size))*(buf_size*snbytes)
+ +((nbytes_xfer/(buf_size/blk_size))*pio_mpi_nprocs_g)%(snbytes*blk_size);
+
+ /* Number of bytes to be transferred per I/O operation */
+ nbytes_xfer_advance = blk_size * blk_size;
+
+ /* Global offset advance after each I/O operation */
+ /* mpi_offset_advance = (MPI_Offset)(snbytes/blk_size*(blk_size*blk_size)); */
+ mpi_offset_advance = (MPI_Offset)(snbytes*blk_size);
+
+ /* MPI type to be used for collective access */
+ mpi_collective_type = mpi_chunk_inter_type;
+ } /* end else */
+ } /* end else */
+
+ /* Common code for independent file access */
+ if (!parms->collective) {
+ /* Set the base of user's buffer */
+ buf_p = (unsigned char *)buffer;
+
+ /* Set the number of bytes to transfer this time */
+ nbytes_toxfer = buf_size * blk_size;
+
+ /* Loop over portions of the buffer to write */
+ while(nbytes_toxfer>0){
+ /* Perform independent write */
+ mrc = MPI_File_write_at(fd->mpifd, mpi_offset, buf_p,
+ (int)nbytes_xfer_advance, MPI_BYTE, &mpi_status);
+ VRFY((mrc==MPI_SUCCESS), "MPIO_WRITE");
+
+ /* Advance location in buffer */
+ buf_p+=nbytes_xfer_advance;
+
+ /* Advance global offset in dataset */
+ nbytes_xfer+=nbytes_xfer_advance;
+
+ /* Decrement number of bytes left this time */
+ nbytes_toxfer-=nbytes_xfer_advance;
+
+ /* Partially advance global offset in dataset */
+ mpi_offset+=mpi_offset_advance;
+ } /* end while */
+ } /* end if */
+
+ /* Common code for collective file access */
+ else {
+ /* Set the file view */
+ mrc = MPI_File_set_view(fd->mpifd, mpi_offset, MPI_BYTE,
+ mpi_collective_type, (char *)"native", h5_io_info_g);
+ VRFY((mrc==MPI_SUCCESS), "MPIO_VIEW");
+
+ /* Perform write */
+ MPI_File_write_at_all(fd->mpifd, 0, buffer,(int)(buf_size*blk_size),
+ MPI_BYTE, &mpi_status);
+ VRFY((mrc==MPI_SUCCESS), "MPIO_WRITE");
+
+ /* Advance global offset in dataset */
+ nbytes_xfer+=buf_size*blk_size;
+ } /* end else */
+
+ } /* end else */
+
+ break;
+
+ case PHDF5:
+ /* 1D dataspace */
+ if (!parms->dim2d){
+ /* Set up the file dset space id to move the selection to process */
+ if (!parms->interleaved){
+ /* Contiguous pattern */
+ h5offset[0] = nbytes_xfer;
+ } /* end if */
+ else {
+ /* Interleaved access pattern */
+ /* Skip offset over blocks of other processes */
+ h5offset[0] = (nbytes_xfer*pio_mpi_nprocs_g);
+ } /* end else */
+ hrc = H5Soffset_simple(h5dset_space_id, h5offset);
+ VRFY((hrc >= 0), "H5Soffset_simple");
+
+ /* Write the buffer out */
+ hrc = H5Dwrite(h5ds_id, ELMT_H5_TYPE, h5mem_space_id,
+ h5dset_space_id, h5dxpl, buffer);
+ VRFY((hrc >= 0), "H5Dwrite");
+
+ /* Increment number of bytes transferred */
+ nbytes_xfer += buf_size;
+ } /* end if */
+ /* 2D dataspace */
+ else {
+ /* Set up the file dset space id to move the selection to process */
+ if (!parms->interleaved){
+ /* Contiguous pattern */
+ h5offset[0] = (nbytes_xfer/(snbytes*blk_size))*blk_size;
+ h5offset[1] = (nbytes_xfer%(snbytes*blk_size))/blk_size;
+
+ } /* end if */
+ else {
+ /* Interleaved access pattern */
+ /* Skip offset over blocks of other processes */
+ h5offset[0] = ((nbytes_xfer*pio_mpi_nprocs_g)/(snbytes*buf_size))*buf_size;
+ h5offset[1] = ((nbytes_xfer*pio_mpi_nprocs_g)%(snbytes*buf_size))/buf_size;
+
+ } /* end else */
+ hrc = H5Soffset_simple(h5dset_space_id, h5offset);
+ VRFY((hrc >= 0), "H5Soffset_simple");
+
+ /* Write the buffer out */
+ hrc = H5Dwrite(h5ds_id, ELMT_H5_TYPE, h5mem_space_id,
+ h5dset_space_id, h5dxpl, buffer);
+ VRFY((hrc >= 0), "H5Dwrite");
+
+ /* Increment number of bytes transferred */
+ nbytes_xfer += buf_size*blk_size;
+
+ } /* end else */
+
+ break;
+ } /* switch (parms->io_type) */
+ } /* end while */
+
+ /* Stop "raw data" write timer */
+ set_time(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, TSTOP);
+
+ /* Calculate write time */
+
+ /* Close dataset. Only HDF5 needs to do an explicit close. */
+ if (parms->io_type == PHDF5) {
+ hrc = H5Dclose(h5ds_id);
+
+ if (hrc < 0) {
+ fprintf(stderr, "HDF5 Dataset Close failed\n");
+ GOTOERROR(FAIL);
+ }
+
+ h5ds_id = -1;
+ } /* end if */
+ } /* end for */
+
+done:
+ /* release MPI-I/O objects */
+ if (parms->io_type == MPIO) {
+ /* 1D dataspace */
+ if (!parms->dim2d){
+ /* Free file type */
+ mrc = MPI_Type_free( &mpi_file_type );
+ VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_FREE");
+
+ /* Free buffer type */
+ mrc = MPI_Type_free( &mpi_blk_type );
+ VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_FREE");
+ } /* end if */
+ /* 2D dataspace */
+ else {
+ /* Free partial buffer type for contiguous access */
+ mrc = MPI_Type_free( &mpi_partial_buffer_cont );
+ VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_FREE");
+
+ /* Free contiguous file type */
+ mrc = MPI_Type_free( &mpi_cont_type );
+ VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_FREE");
+
+ /* Free partial buffer type for interleaved access */
+ mrc = MPI_Type_free( &mpi_partial_buffer_inter );
+ VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_FREE");
+
+ /* Free interleaved file type */
+ mrc = MPI_Type_free( &mpi_inter_type );
+ VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_FREE");
+
+ /* Free full buffer type */
+ mrc = MPI_Type_free(&mpi_full_buffer);
+ VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_FREE");
+
+ /* Free full chunk type */
+ mrc = MPI_Type_free(&mpi_full_chunk);
+ VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_FREE");
+
+ /* Free chunk interleaved file type */
+ mrc = MPI_Type_free(&mpi_chunk_inter_type);
+ VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_FREE");
+ } /* end else */
+ } /* end if */
+
+ /* release HDF5 objects */
+ if (h5dset_space_id != -1) {
+ hrc = H5Sclose(h5dset_space_id);
+ if (hrc < 0){
+ fprintf(stderr, "HDF5 Dataset Space Close failed\n");
+ ret_code = FAIL;
+ } else {
+ h5dset_space_id = -1;
+ }
+ }
+
+ if (h5mem_space_id != -1) {
+ hrc = H5Sclose(h5mem_space_id);
+ if (hrc < 0) {
+ fprintf(stderr, "HDF5 Memory Space Close failed\n");
+ ret_code = FAIL;
+ } else {
+ h5mem_space_id = -1;
+ }
+ }
+
+ if (h5dxpl != -1) {
+ hrc = H5Pclose(h5dxpl);
+ if (hrc < 0) {
+ fprintf(stderr, "HDF5 Dataset Transfer Property List Close failed\n");
+ ret_code = FAIL;
+ } else {
+ h5dxpl = -1;
+ }
+ }
+
+ return ret_code;
+}
+
+/*
+ * Function: do_read
+ * Purpose: read the required amount of data from the file.
+ * Return: SUCCESS or FAIL
+ * Programmer: Albert Cheng 2001/12/13
+ * Modifications:
+ * Added 2D testing (Christian Chilan, 10. August 2005)
+ */
+ static herr_t
+do_read(results *res, file_descr *fd, parameters *parms, long ndsets,
+ off_t nbytes, size_t buf_size, void *buffer /*out*/)
+{
+ int ret_code = SUCCESS;
+ int rc; /*routine return code */
+ long ndset;
+ size_t blk_size; /* The block size to subdivide the xfer buffer into */
+ size_t bsize; /* Size of the actual buffer */
+ off_t nbytes_xfer; /* Total number of bytes transferred so far */
+ size_t nbytes_xfer_advance; /* Number of bytes transferred in a single I/O operation */
+ size_t nbytes_toxfer; /* Number of bytes to transfer a particular time */
+ char dname[64];
+ off_t dset_offset=0; /*dataset offset in a file */
+ off_t bytes_begin[2]; /*first elmt this process transfer */
+ off_t bytes_count; /*number of elmts this process transfer */
+ off_t snbytes=0; /*size of a side of the dataset square */
+ unsigned char *buf_p; /* Current buffer pointer */
+
+ /* POSIX variables */
+ off_t file_offset; /* File offset of the next transfer */
+ off_t file_offset_advance; /* File offset advance after each I/O operation */
+ off_t posix_file_offset; /* Base file offset of the next transfer */
+
+ /* MPI variables */
+ MPI_Offset mpi_file_offset;/* Base file offset of the next transfer*/
+ MPI_Offset mpi_offset; /* Offset in MPI file */
+ MPI_Offset mpi_offset_advance; /* Offset advance after each I/O operation */
+ MPI_Datatype mpi_file_type; /* MPI derived type for 1D file */
+ MPI_Datatype mpi_blk_type; /* MPI derived type for 1D buffer */
+ MPI_Datatype mpi_cont_type; /* MPI derived type for 2D contiguous file */
+ MPI_Datatype mpi_partial_buffer_cont; /* MPI derived type for partial 2D contiguous buffer */
+ MPI_Datatype mpi_inter_type; /* MPI derived type for 2D interleaved file */
+ MPI_Datatype mpi_partial_buffer_inter; /* MPI derived type for partial 2D interleaved buffer */
+ MPI_Datatype mpi_full_buffer; /* MPI derived type for 2D full buffer */
+ MPI_Datatype mpi_full_chunk; /* MPI derived type for 2D full chunk */
+ MPI_Datatype mpi_chunk_inter_type; /* MPI derived type for 2D chunk interleaved file */
+ MPI_Datatype mpi_collective_type; /* Generic MPI derived type for 2D collective access */
+ MPI_Status mpi_status;
+ int mrc; /* MPI return code */
+
+ /* HDF5 variables */
+ herr_t hrc; /*HDF5 return code */
+ hsize_t h5dims[2]; /*dataset dim sizes */
+ hid_t h5dset_space_id = -1; /*dataset space ID */
+ hid_t h5mem_space_id = -1; /*memory dataspace ID */
+ hid_t h5ds_id = -1; /*dataset handle */
+ hsize_t h5block[2]; /*dataspace selection */
+ hsize_t h5stride[2];
+ hsize_t h5count[2];
+ hsize_t h5start[2];
+ hssize_t h5offset[2]; /* Selection offset within dataspace */
+ hid_t h5dxpl = -1; /* Dataset transfer property list */
+
+ /* Get the parameters from the parameter block */
+ blk_size=parms->blk_size;
+
+ /* There are two kinds of transfer patterns, contiguous and interleaved.
+ * Let 0,1,2,...,n be data accessed by process 0,1,2,...,n
+ * where n is rank of the last process.
+ * In contiguous pattern, data are accessed as
+ * 000...111...222...nnn...
+ * In interleaved pattern, data are accessed as
+ * 012...n012...n...
+ * These are all in the scope of one dataset.
+ */
+
+ /* 1D dataspace */
+ if (!parms->dim2d){
+ bsize = buf_size;
+ /* Contiguous Pattern: */
+ if (!parms->interleaved) {
+ bytes_begin[0] = (off_t)(((double)nbytes*pio_mpi_rank_g)/pio_mpi_nprocs_g);
+ } /* end if */
+ /* Interleaved Pattern: */
+ else {
+ bytes_begin[0] = (off_t)(blk_size*pio_mpi_rank_g);
+ } /* end else */
+ }/* end if */
+ /* 2D dataspace */
+ else {
+ /* nbytes is always the number of bytes per dataset (1D or 2D). If the
+ dataspace is 2D, snbytes is the size of a side of the 'dataset square'.
+ */
+ snbytes = (off_t)sqrt(nbytes);
+
+ bsize = buf_size * blk_size;
+
+ /* Contiguous Pattern: */
+ if (!parms->interleaved) {
+ bytes_begin[0] = (off_t)((double)snbytes*pio_mpi_rank_g / pio_mpi_nprocs_g);
+ bytes_begin[1] = 0;
+ } /* end if */
+ /* Interleaved Pattern: */
+ else {
+ bytes_begin[0] = 0;
+
+ if (!parms->h5_use_chunks || parms->io_type==PHDF5)
+ bytes_begin[1] = (off_t)(blk_size*pio_mpi_rank_g);
+ else
+ bytes_begin[1] = (off_t)(blk_size*blk_size*pio_mpi_rank_g);
+ } /* end else */
+ } /* end else */
+
+ /* Calculate the total number of bytes (bytes_count) to be
+ * transferred by this process. It may be different for different
+ * transfer pattern due to rounding to integral values.
+ */
+ /*
+ * Calculate the beginning bytes of this process and the next.
+ * bytes_count is the difference between these two beginnings.
+ * This way, it eliminates any rounding errors.
+ * (This is tricky, don't mess with the formula, rounding errors
+ * can easily get introduced) */
+ bytes_count = (off_t)(((double)nbytes*(pio_mpi_rank_g+1)) / pio_mpi_nprocs_g)
+ - (off_t)(((double)nbytes*pio_mpi_rank_g) / pio_mpi_nprocs_g);
+
+ /* debug */
+ if (pio_debug_level >= 4) {
+ HDprint_rank(output);
+ if (!parms->dim2d) {
+ HDfprintf(output, "Debug(do_write): "
+ "buf_size=%zu, bytes_begin=%" H5_PRINTF_LL_WIDTH "d, bytes_count=%" H5_PRINTF_LL_WIDTH "d\n",
+ buf_size, (long long)bytes_begin[0],
+ (long long)bytes_count);
+ } else {
+ HDfprintf(output, "Debug(do_write): "
+ "linear buf_size=%zu, bytes_begin=(%" H5_PRINTF_LL_WIDTH "d,%" H5_PRINTF_LL_WIDTH "d), bytes_count=%" H5_PRINTF_LL_WIDTH "d\n",
+ buf_size*blk_size, (long long)bytes_begin[0],
+ (long long)bytes_begin[1], (long long)bytes_count);
+ }
+ }
+
+ /* I/O Access specific setup */
+ switch (parms->io_type) {
+ case POSIXIO:
+ /* No extra setup */
+ break;
+
+ case MPIO: /* MPI-I/O setup */
+ /* 1D dataspace */
+ if (!parms->dim2d){
+ /* Build block's derived type */
+ mrc = MPI_Type_contiguous((int)blk_size,
+ MPI_BYTE, &mpi_blk_type);
+ VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE");
+
+ /* Build file's derived type */
+ mrc = MPI_Type_vector((int)(buf_size/blk_size), (int)1,
+ (int)pio_mpi_nprocs_g, mpi_blk_type, &mpi_file_type);
+ VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE");
+
+ /* Commit file type */
+ mrc = MPI_Type_commit( &mpi_file_type );
+ VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT");
+
+ /* Commit buffer type */
+ mrc = MPI_Type_commit( &mpi_blk_type );
+ VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT");
+ } /* end if */
+ /* 2D dataspace */
+ else {
+ /* Build partial buffer derived type for contiguous access */
+ mrc = MPI_Type_contiguous((int)buf_size, MPI_BYTE,
+ &mpi_partial_buffer_cont);
+ VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE");
+
+ /* Commit partial buffer derived type */
+ mrc = MPI_Type_commit(&mpi_partial_buffer_cont);
+ VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT");
+
+ /* Build contiguous file's derived type */
+ mrc = MPI_Type_vector((int)blk_size, (int)1, (int)(snbytes/buf_size),
+ mpi_partial_buffer_cont, &mpi_cont_type);
+ VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE");
+
+ /* Commit contiguous file type */
+ mrc = MPI_Type_commit(&mpi_cont_type);
+ VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT");
+
+ /* Build partial buffer derived type for interleaved access */
+ mrc = MPI_Type_contiguous((int)blk_size, MPI_BYTE,
+ &mpi_partial_buffer_inter);
+ VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE");
+
+ /* Commit partial buffer derived type */
+ mrc = MPI_Type_commit(&mpi_partial_buffer_inter);
+ VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT");
+
+ /* Build interleaved file's derived type */
+ mrc = MPI_Type_vector((int)buf_size, (int)1, (int)(snbytes/blk_size),
+ mpi_partial_buffer_inter, &mpi_inter_type);
+ VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE");
+
+ /* Commit interleaved file type */
+ mrc = MPI_Type_commit(&mpi_inter_type);
+ VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT");
+
+ /* Build full buffer derived type */
+ mrc = MPI_Type_contiguous((int)(blk_size*buf_size), MPI_BYTE,
+ &mpi_full_buffer);
+ VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE");
+
+ /* Commit full buffer derived type */
+ mrc = MPI_Type_commit(&mpi_full_buffer);
+ VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT");
+
+ /* Build full chunk derived type */
+ mrc = MPI_Type_contiguous((int)(blk_size*blk_size), MPI_BYTE,
+ &mpi_full_chunk);
+ VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE");
+
+ /* Commit full chunk derived type */
+ mrc = MPI_Type_commit(&mpi_full_chunk);
+ VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT");
+
+ /* Build chunk interleaved file's derived type */
+ mrc = MPI_Type_vector((int)(buf_size/blk_size), (int)1, (int)(snbytes/blk_size),
+ mpi_full_chunk, &mpi_chunk_inter_type);
+ VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_CREATE");
+
+ /* Commit chunk interleaved file type */
+ mrc = MPI_Type_commit(&mpi_chunk_inter_type);
+ VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_COMMIT");
+ } /* end else */
+ break;
+
+ case PHDF5: /* HDF5 setup */
+ /* 1D dataspace */
+ if (!parms->dim2d){
+ if(nbytes>0) {
+ /* define a contiguous dataset of nbytes native bytes */
+ h5dims[0] = nbytes;
+ h5dset_space_id = H5Screate_simple(1, h5dims, NULL);
+ VRFY((h5dset_space_id >= 0), "H5Screate_simple");
+
+ /* Set up the file dset space id to select the pattern to access */
+ if (!parms->interleaved){
+ /* Contiguous pattern */
+ h5start[0] = bytes_begin[0];
+ h5stride[0] = h5block[0] = blk_size;
+ h5count[0] = buf_size/blk_size;
+ } /* end if */
+ else {
+ /* Interleaved access pattern */
+ /* Skip offset over blocks of other processes */
+ h5start[0] = bytes_begin[0];
+ h5stride[0] = blk_size*pio_mpi_nprocs_g;
+ h5block[0] = blk_size;
+ h5count[0] = buf_size/blk_size;
+ } /* end else */
+ hrc = H5Sselect_hyperslab(h5dset_space_id, H5S_SELECT_SET,
+ h5start, h5stride, h5count, h5block);
+ VRFY((hrc >= 0), "H5Sselect_hyperslab");
+ } /* end if */
+ else {
+ h5dset_space_id = H5Screate(H5S_SCALAR);
+ VRFY((h5dset_space_id >= 0), "H5Screate");
+ } /* end else */
+
+ /* Create the memory dataspace that corresponds to the xfer buffer */
+ if(buf_size>0) {
+ h5dims[0] = buf_size;
+ h5mem_space_id = H5Screate_simple(1, h5dims, NULL);
+ VRFY((h5mem_space_id >= 0), "H5Screate_simple");
+ } /* end if */
+ else {
+ h5mem_space_id = H5Screate(H5S_SCALAR);
+ VRFY((h5mem_space_id >= 0), "H5Screate");
+ } /* end else */
+ } /* end if */
+ /* 2D dataspace */
+ else {
+ if(nbytes>0) {
+ /* define a contiguous dataset of nbytes native bytes */
+ h5dims[0] = snbytes;
+ h5dims[1] = snbytes;
+ h5dset_space_id = H5Screate_simple(2, h5dims, NULL);
+ VRFY((h5dset_space_id >= 0), "H5Screate_simple");
+
+ /* Set up the file dset space id to select the pattern to access */
+ if (!parms->interleaved){
+ /* Contiguous pattern */
+ h5start[0] = bytes_begin[0];
+ h5start[1] = bytes_begin[1];
+ h5stride[0] = 1;
+ h5stride[1] = h5block[0] = h5block[1] = blk_size;
+ h5count[0] = 1;
+ h5count[1] = buf_size/blk_size;
+ } /* end if */
+ else {
+ /* Interleaved access pattern */
+ /* Skip offset over blocks of other processes */
+ h5start[0] = bytes_begin[0];
+ h5start[1] = bytes_begin[1];
+ h5stride[0] = blk_size;
+ h5stride[1] = blk_size*pio_mpi_nprocs_g;
+ h5block[0] = h5block[1] = blk_size;
+ h5count[0] = buf_size/blk_size;
+ h5count[1] = 1;
+ } /* end else */
+ hrc = H5Sselect_hyperslab(h5dset_space_id, H5S_SELECT_SET,
+ h5start, h5stride, h5count, h5block);
+ VRFY((hrc >= 0), "H5Sselect_hyperslab");
+ } /* end if */
+ else {
+ h5dset_space_id = H5Screate(H5S_SCALAR);
+ VRFY((h5dset_space_id >= 0), "H5Screate");
+ } /* end else */
+
+ /* Create the memory dataspace that corresponds to the xfer buffer */
+ if(buf_size>0) {
+ if (!parms->interleaved){
+ h5dims[0] = blk_size;
+ h5dims[1] = buf_size;
+ }else{
+ h5dims[0] = buf_size;
+ h5dims[1] = blk_size;
+ }
+ h5mem_space_id = H5Screate_simple(2, h5dims, NULL);
+ VRFY((h5mem_space_id >= 0), "H5Screate_simple");
+ } /* end if */
+ else {
+ h5mem_space_id = H5Screate(H5S_SCALAR);
+ VRFY((h5mem_space_id >= 0), "H5Screate");
+ } /* end else */
+ } /* end else */
+
+ /* Create the dataset transfer property list */
+ h5dxpl = H5Pcreate(H5P_DATASET_XFER);
+ if (h5dxpl < 0) {
+ fprintf(stderr, "HDF5 Property List Create failed\n");
+ GOTOERROR(FAIL);
+ }
+
+ /* Change to collective I/O, if asked */
+ if(parms->collective) {
+ hrc = H5Pset_dxpl_mpio(h5dxpl, H5FD_MPIO_COLLECTIVE);
+ if (hrc < 0) {
+ fprintf(stderr, "HDF5 Property List Set failed\n");
+ GOTOERROR(FAIL);
+ } /* end if */
+ } /* end if */
+ break;
+ } /* end switch */
+
+ for (ndset = 1; ndset <= ndsets; ++ndset) {
+
+ /* Calculate dataset offset within a file */
+
+ /* create dataset */
+ switch (parms->io_type) {
+ case POSIXIO:
+ case MPIO:
+ /* both posix and mpi io just need dataset offset in file*/
+ dset_offset = (ndset - 1) * nbytes;
+ break;
+
+ case PHDF5:
+ sprintf(dname, "Dataset_%ld", ndset);
+ h5ds_id = H5DOPEN(fd->h5fd, dname);
+ if (h5ds_id < 0) {
+ fprintf(stderr, "HDF5 Dataset open failed\n");
+ GOTOERROR(FAIL);
+ }
+
+ break;
+ }
+
+ /* The task is to transfer bytes_count bytes, starting at
+ * bytes_begin position, using transfer buffer of buf_size bytes.
+ * If interleaved, select buf_size at a time, in round robin
+ * fashion, according to number of process. Otherwise, select
+ * all bytes_count in contiguous.
+ */
+ nbytes_xfer = 0 ;
+
+ /* 1D dataspace */
+ if (!parms->dim2d){
+ /* Set base file offset for all I/O patterns and POSIX access */
+ posix_file_offset = dset_offset + bytes_begin[0];
+
+ /* Set base file offset for all I/O patterns and MPI access */
+ mpi_file_offset = (MPI_Offset)(dset_offset + bytes_begin[0]);
+ } /* end if */
+ else {
+ /* Set base file offset for all I/O patterns and POSIX access */
+ posix_file_offset=dset_offset + bytes_begin[0]*snbytes+
+ bytes_begin[1];
+
+ /* Set base file offset for all I/O patterns and MPI access */
+ mpi_file_offset=(MPI_Offset)(dset_offset + bytes_begin[0]*snbytes+
+ bytes_begin[1]);
+ } /* end else */
+
+ /* Start "raw data" read timer */
+ set_time(res->timers, HDF5_RAW_READ_FIXED_DIMS, TSTART);
+
+ while (nbytes_xfer < bytes_count){
+ /* Read */
+ /* Calculate offset of read within a dataset/file */
+ switch (parms->io_type) {
+ case POSIXIO:
+ /* 1D dataspace */
+ if (!parms->dim2d){
+ /* Contiguous pattern */
+ if (!parms->interleaved) {
+ /* Compute file offset */
+ file_offset = posix_file_offset + (off_t)nbytes_xfer;
+
+ /* only care if seek returns error */
+ rc = POSIXSEEK(fd->posixfd, file_offset) < 0 ? -1 : 0;
+ VRFY((rc==0), "POSIXSEEK");
+
+ /* check if all bytes are read */
+ rc = ((ssize_t)buf_size ==
+ POSIXREAD(fd->posixfd, buffer, buf_size));
+ VRFY((rc != 0), "POSIXREAD");
+
+ /* Advance global offset in dataset */
+ nbytes_xfer+=buf_size;
+ } /* end if */
+ /* Interleaved access pattern */
+ else {
+ /* Set the base of user's buffer */
+ buf_p=(unsigned char *)buffer;
+
+ /* Set the number of bytes to transfer this time */
+ nbytes_toxfer = buf_size;
+
+ /* Loop over the buffers to read */
+ while(nbytes_toxfer>0) {
+ /* Skip offset over blocks of other processes */
+ file_offset = posix_file_offset +
+ (off_t)(nbytes_xfer*pio_mpi_nprocs_g);
+
+ /* only care if seek returns error */
+ rc = POSIXSEEK(fd->posixfd, file_offset) < 0 ? -1 : 0;
+ VRFY((rc==0), "POSIXSEEK");
+
+ /* check if all bytes are read */
+ rc = ((ssize_t)blk_size ==
+ POSIXREAD(fd->posixfd, buf_p, blk_size));
+ VRFY((rc != 0), "POSIXREAD");
+
+ /* Advance location in buffer */
+ buf_p+=blk_size;
+
+ /* Advance global offset in dataset */
+ nbytes_xfer+=blk_size;
+
+ /* Decrement number of bytes left this time */
+ nbytes_toxfer-=blk_size;
+ } /* end while */
+ } /* end else */
+ } /* end if */
+ /* 2D dataspace */
+ else {
+ /* Contiguous storage */
+ if (!parms->h5_use_chunks) {
+ /* Contiguous access pattern */
+ if (!parms->interleaved) {
+ /* Compute file offset */
+ file_offset=posix_file_offset+(off_t)(((nbytes_xfer/blk_size)
+ /snbytes)*(blk_size*snbytes)+((nbytes_xfer/blk_size)%snbytes));
+
+ /* Number of bytes to be transferred per I/O operation */
+ nbytes_xfer_advance = buf_size;
+
+ /* Global offset advance after each I/O operation */
+ file_offset_advance = (off_t)snbytes;
+ } /* end if */
+ /* Interleaved access pattern */
+ else {
+ /* Compute file offset */
+ file_offset=posix_file_offset+(off_t)((((nbytes_xfer/buf_size)
+ *pio_mpi_nprocs_g)/snbytes)*(buf_size*snbytes)
+ +((nbytes_xfer/buf_size)*pio_mpi_nprocs_g)%snbytes);
+
+ /* Number of bytes to be transferred per I/O operation */
+ nbytes_xfer_advance = blk_size;
+
+ /* Global offset advance after each I/O operation */
+ file_offset_advance = (off_t)snbytes;
+ } /* end else */
+ } /* end if */
+ /* Chunked storage */
+ else {
+ /*Contiguous access pattern */
+ if (!parms->interleaved) {
+ /* Compute file offset */
+ file_offset=posix_file_offset+(off_t)nbytes_xfer;
+
+ /* Number of bytes to be transferred per I/O operation */
+ nbytes_xfer_advance = blk_size * buf_size;
+
+ /* Global offset advance after each I/O operation */
+ file_offset_advance = 0;
+ } /* end if */
+ /*Interleaved access pattern */
+ else {
+ /* Compute file offset */
+ /* Before simplification */
+ /* file_offset=posix_file_offset+(off_t)((nbytes_xfer/(buf_size/blk_size)
+ *pio_mpi_nprocs_g)/(snbytes/blk_size*(blk_size*blk_size))*(buf_size/blk_size
+ *snbytes/blk_size*(blk_size*blk_size))+((nbytes_xfer/(buf_size/blk_size))
+ *pio_mpi_nprocs_g)%(snbytes/blk_size*(blk_size*blk_size))); */
+
+ file_offset=posix_file_offset+(off_t)(((nbytes_xfer/(buf_size/blk_size)
+ *pio_mpi_nprocs_g)/(snbytes*blk_size))*(buf_size*snbytes)+((nbytes_xfer/(buf_size/blk_size))
+ *pio_mpi_nprocs_g)%(snbytes*blk_size));
+
+ /* Number of bytes to be transferred per I/O operation */
+ nbytes_xfer_advance = blk_size * blk_size;
+
+ /* Global offset advance after each I/O operation */
+ /* file_offset_advance = (off_t)(snbytes/blk_size*(blk_size*blk_size)); */
+ file_offset_advance = (off_t)(snbytes*blk_size);
+ } /* end else */
+ } /* end else */
+
+ /* Common code for file access */
+
+ /* Set the base of user's buffer */
+ buf_p = (unsigned char *)buffer;
+
+ /* Set the number of bytes to transfer this time */
+ nbytes_toxfer = buf_size*blk_size;
+
+ /* Loop over portions of the buffer to read */
+ while(nbytes_toxfer>0){
+ /* only care if seek returns error */
+ rc = POSIXSEEK(fd->posixfd, file_offset) < 0 ? -1 : 0;
+ VRFY((rc==0), "POSIXSEEK");
+
+ /* check if all bytes are read */
+ rc = ((ssize_t)nbytes_xfer_advance ==
+ POSIXREAD(fd->posixfd, buf_p, nbytes_xfer_advance));
+ VRFY((rc != 0), "POSIXREAD");
+
+ /* Advance location in buffer */
+ buf_p+=nbytes_xfer_advance;
+
+ /* Advance global offset in dataset */
+ nbytes_xfer+=nbytes_xfer_advance;
+
+ /* Decrement number of bytes left this time */
+ nbytes_toxfer-=nbytes_xfer_advance;
+
+ /* Partially advance file offset */
+ file_offset+=file_offset_advance;
+ } /* end while */
+
+ } /* end else */
+ break;
+
+ case MPIO:
+ /* 1D dataspace */
+ if (!parms->dim2d){
+ /* Independent file access */
+ if(!parms->collective) {
+ /* Contiguous pattern */
+ if (!parms->interleaved){
+ /* Compute offset in file */
+ mpi_offset = mpi_file_offset +
+ nbytes_xfer;
+
+ /* Perform independent read */
+ mrc = MPI_File_read_at(fd->mpifd, mpi_offset, buffer,
+ (int)(buf_size/blk_size), mpi_blk_type,
+ &mpi_status);
+ VRFY((mrc==MPI_SUCCESS), "MPIO_READ");
+
+ /* Advance global offset in dataset */
+ nbytes_xfer+=buf_size;
+ } /* end if */
+ /* Interleaved access pattern */
+ else {
+ /* Set the base of user's buffer */
+ buf_p=(unsigned char *)buffer;
+
+ /* Set the number of bytes to transfer this time */
+ nbytes_toxfer = buf_size;
+
+ /* Loop over the buffers to read */
+ while(nbytes_toxfer>0) {
+ /* Skip offset over blocks of other processes */
+ mpi_offset = mpi_file_offset +
+ (nbytes_xfer*pio_mpi_nprocs_g);
+
+ /* Perform independent read */
+ mrc = MPI_File_read_at(fd->mpifd, mpi_offset, buf_p,
+ (int)1, mpi_blk_type, &mpi_status);
+ VRFY((mrc==MPI_SUCCESS), "MPIO_READ");
+
+ /* Advance location in buffer */
+ buf_p+=blk_size;
+
+ /* Advance global offset in dataset */
+ nbytes_xfer+=blk_size;
+
+ /* Decrement number of bytes left this time */
+ nbytes_toxfer-=blk_size;
+ } /* end while */
+ } /* end else */
+ } /* end if */
+ /* Collective file access */
+ else {
+ /* Contiguous access pattern */
+ if (!parms->interleaved){
+ /* Compute offset in file */
+ mpi_offset = mpi_file_offset +
+ nbytes_xfer;
+
+ /* Perform collective read */
+ mrc = MPI_File_read_at_all(fd->mpifd, mpi_offset, buffer,
+ (int)(buf_size/blk_size), mpi_blk_type, &mpi_status);
+ VRFY((mrc==MPI_SUCCESS), "MPIO_READ");
+
+ /* Advance global offset in dataset */
+ nbytes_xfer+=buf_size;
+ } /* end if */
+ /* Interleaved access pattern */
+ else {
+ /* Compute offset in file */
+ mpi_offset = mpi_file_offset +
+ (nbytes_xfer*pio_mpi_nprocs_g);
+
+ /* Set the file view */
+ mrc = MPI_File_set_view(fd->mpifd, mpi_offset, mpi_blk_type,
+ mpi_file_type, (char*)"native", h5_io_info_g);
+ VRFY((mrc==MPI_SUCCESS), "MPIO_VIEW");
+
+ /* Perform collective read */
+ mrc = MPI_File_read_at_all(fd->mpifd, 0, buffer,
+ (int)(buf_size/blk_size), mpi_blk_type, &mpi_status);
+ VRFY((mrc==MPI_SUCCESS), "MPIO_READ");
+
+ /* Advance global offset in dataset */
+ nbytes_xfer+=buf_size;
+ } /* end else */
+ } /* end else */
+ } /* end if */
+ /* 2D dataspace */
+ else {
+ /* Contiguous storage */
+ if (!parms->h5_use_chunks) {
+ /* Contiguous access pattern */
+ if (!parms->interleaved) {
+ /* Compute offset in file */
+ mpi_offset=mpi_file_offset+((nbytes_xfer/blk_size)/snbytes)*
+ (blk_size*snbytes)+((nbytes_xfer/blk_size)%snbytes);
+
+ /* Number of bytes to be transferred per I/O operation */
+ nbytes_xfer_advance = buf_size;
+
+ /* Global offset advance after each I/O operation */
+ mpi_offset_advance = snbytes;
+
+ /* MPI type to be used for collective access */
+ mpi_collective_type = mpi_cont_type;
+ } /* end if */
+ /* Interleaved access pattern */
+ else {
+ /* Compute offset in file */
+ mpi_offset=mpi_file_offset+(((nbytes_xfer/buf_size)*pio_mpi_nprocs_g)/snbytes)*
+ (buf_size*snbytes)+((nbytes_xfer/buf_size)*pio_mpi_nprocs_g)%snbytes;
+
+ /* Number of bytes to be transferred per I/O operation */
+ nbytes_xfer_advance = blk_size;
+
+ /* Global offset advance after each I/O operation */
+ mpi_offset_advance = snbytes;
+
+ /* MPI type to be used for collective access */
+ mpi_collective_type = mpi_inter_type;
+ } /* end else */
+ } /* end if */
+ /* Chunked storage */
+ else {
+ /*Contiguous access pattern */
+ if (!parms->interleaved) {
+ /* Compute offset in file */
+ mpi_offset=mpi_file_offset+nbytes_xfer;
+
+ /* Number of bytes to be transferred per I/O operation */
+ nbytes_xfer_advance = blk_size * buf_size;
+
+ /* Global offset advance after each I/O operation */
+ mpi_offset_advance = 0;
+
+ /* MPI type to be used for collective access */
+ mpi_collective_type = mpi_full_buffer;
+ } /* end if */
+ /*Interleaved access pattern */
+ else {
+ /* Compute offset in file */
+ /* Before simplification */
+ /* mpi_offset=mpi_file_offset+(nbytes_xfer/(buf_size/blk_size)
+ *pio_mpi_nprocs_g)/(snbytes/blk_size*(blk_size*blk_size))*
+ (buf_size/blk_size*snbytes/blk_size*(blk_size*blk_size))+
+ ((nbytes_xfer/(buf_size/blk_size))*pio_mpi_nprocs_g)%(snbytes
+ /blk_size*(blk_size*blk_size)); */
+ mpi_offset=mpi_file_offset+((nbytes_xfer/(buf_size/blk_size)
+ *pio_mpi_nprocs_g)/(snbytes*blk_size))*(buf_size*snbytes)
+ +((nbytes_xfer/(buf_size/blk_size))*pio_mpi_nprocs_g)%(snbytes*blk_size);
+
+ /* Number of bytes to be transferred per I/O operation */
+ nbytes_xfer_advance = blk_size * blk_size;
+
+ /* Global offset advance after each I/O operation */
+ /* mpi_offset_advance = (MPI_Offset)(snbytes/blk_size*(blk_size*blk_size)); */
+ mpi_offset_advance = (MPI_Offset)(snbytes*blk_size);
+
+ /* MPI type to be used for collective access */
+ mpi_collective_type = mpi_chunk_inter_type;
+ } /* end else */
+ } /* end else */
+
+ /* Common code for independent file access */
+ if (!parms->collective) {
+ /* Set the base of user's buffer */
+ buf_p = (unsigned char *)buffer;
+
+ /* Set the number of bytes to transfer this time */
+ nbytes_toxfer = buf_size * blk_size;
+
+ /* Loop over portions of the buffer to read */
+ while(nbytes_toxfer>0){
+ /* Perform independent read */
+ mrc = MPI_File_read_at(fd->mpifd, mpi_offset, buf_p,
+ (int)nbytes_xfer_advance, MPI_BYTE, &mpi_status);
+ VRFY((mrc==MPI_SUCCESS), "MPIO_READ");
+
+ /* Advance location in buffer */
+ buf_p+=nbytes_xfer_advance;
+
+ /* Advance global offset in dataset */
+ nbytes_xfer+=nbytes_xfer_advance;
+
+ /* Decrement number of bytes left this time */
+ nbytes_toxfer-=nbytes_xfer_advance;
+
+ /* Partially advance global offset in dataset */
+ mpi_offset+=mpi_offset_advance;
+ } /* end while */
+ } /* end if */
+
+ /* Common code for collective file access */
+ else {
+ /* Set the file view */
+ mrc = MPI_File_set_view(fd->mpifd, mpi_offset, MPI_BYTE,
+ mpi_collective_type, (char *)"native", h5_io_info_g);
+ VRFY((mrc==MPI_SUCCESS), "MPIO_VIEW");
+
+ /* Perform read */
+ MPI_File_read_at_all(fd->mpifd, 0, buffer,(int)(buf_size*blk_size),
+ MPI_BYTE, &mpi_status);
+ VRFY((mrc==MPI_SUCCESS), "MPIO_READ");
+
+ /* Advance global offset in dataset */
+ nbytes_xfer+=buf_size*blk_size;
+ } /* end else */
+
+ } /* end else */
+ break;
+
+ case PHDF5:
+ /* 1D dataspace */
+ if (!parms->dim2d){
+ /* Set up the file dset space id to move the selection to process */
+ if (!parms->interleaved){
+ /* Contiguous pattern */
+ h5offset[0] = nbytes_xfer;
+ } /* end if */
+ else {
+ /* Interleaved access pattern */
+ /* Skip offset over blocks of other processes */
+ h5offset[0] = (nbytes_xfer*pio_mpi_nprocs_g);
+ } /* end else */
+ hrc = H5Soffset_simple(h5dset_space_id, h5offset);
+ VRFY((hrc >= 0), "H5Soffset_simple");
+
+ /* Read the buffer in */
+ hrc = H5Dread(h5ds_id, ELMT_H5_TYPE, h5mem_space_id,
+ h5dset_space_id, h5dxpl, buffer);
+ VRFY((hrc >= 0), "H5Dread");
+
+ /* Increment number of bytes transferred */
+ nbytes_xfer += buf_size;
+ } /* end if */
+ /* 2D dataspace */
+ else {
+ /* Set up the file dset space id to move the selection to process */
+ if (!parms->interleaved){
+ /* Contiguous pattern */
+ h5offset[0] = (nbytes_xfer/(snbytes*blk_size))*blk_size;
+ h5offset[1] = (nbytes_xfer%(snbytes*blk_size))/blk_size;
+ } /* end if */
+ else {
+ /* Interleaved access pattern */
+ /* Skip offset over blocks of other processes */
+ h5offset[0] = ((nbytes_xfer*pio_mpi_nprocs_g)/(snbytes*buf_size))*buf_size;
+ h5offset[1] = ((nbytes_xfer*pio_mpi_nprocs_g)%(snbytes*buf_size))/buf_size;
+
+ } /* end else */
+ hrc = H5Soffset_simple(h5dset_space_id, h5offset);
+ VRFY((hrc >= 0), "H5Soffset_simple");
+
+ /* Write the buffer out */
+ hrc = H5Dread(h5ds_id, ELMT_H5_TYPE, h5mem_space_id,
+ h5dset_space_id, h5dxpl, buffer);
+ VRFY((hrc >= 0), "H5Dread");
+
+ /* Increment number of bytes transferred */
+ nbytes_xfer += buf_size*blk_size;
+
+ } /* end else */
+ break;
+ } /* switch (parms->io_type) */
+
+ /* Verify raw data, if asked */
+ if (parms->verify) {
+ /* Verify data read */
+ unsigned char *ucharptr = (unsigned char *)buffer;
+ size_t i;
+ int nerror=0;
+
+ for (i = 0; i < bsize; ++i){
+ if (*ucharptr++ != pio_mpi_rank_g+1) {
+ if (++nerror < 20){
+ /* report at most 20 errors */
+ HDprint_rank(output);
+ HDfprintf(output, "read data error, expected (%d), "
+ "got (%d)\n",
+ pio_mpi_rank_g+1,
+ (int)*(ucharptr-1));
+ } /* end if */
+ } /* end if */
+ } /* end for */
+ if (nerror >= 20) {
+ HDprint_rank(output);
+ HDfprintf(output, "...");
+ HDfprintf(output, "total read data errors=%d\n",
+ nerror);
+ } /* end if */
+ } /* if (parms->verify) */
+
+ } /* end while */
+
+ /* Stop "raw data" read timer */
+ set_time(res->timers, HDF5_RAW_READ_FIXED_DIMS, TSTOP);
+
+ /* Calculate read time */
+
+ /* Close dataset. Only HDF5 needs to do an explicit close. */
+ if (parms->io_type == PHDF5) {
+ hrc = H5Dclose(h5ds_id);
+
+ if (hrc < 0) {
+ fprintf(stderr, "HDF5 Dataset Close failed\n");
+ GOTOERROR(FAIL);
+ }
+
+ h5ds_id = -1;
+ } /* end if */
+ } /* end for */
+
+done:
+ /* release MPI-I/O objects */
+ if (parms->io_type == MPIO) {
+ /* 1D dataspace */
+ if (!parms->dim2d){
+ /* Free file type */
+ mrc = MPI_Type_free( &mpi_file_type );
+ VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_FREE");
+
+ /* Free buffer type */
+ mrc = MPI_Type_free( &mpi_blk_type );
+ VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_FREE");
+ } /* end if */
+ /* 2D dataspace */
+ else {
+ /* Free partial buffer type for contiguous access */
+ mrc = MPI_Type_free( &mpi_partial_buffer_cont );
+ VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_FREE");
+
+ /* Free contiguous file type */
+ mrc = MPI_Type_free( &mpi_cont_type );
+ VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_FREE");
+
+ /* Free partial buffer type for interleaved access */
+ mrc = MPI_Type_free( &mpi_partial_buffer_inter );
+ VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_FREE");
+
+ /* Free interleaved file type */
+ mrc = MPI_Type_free( &mpi_inter_type );
+ VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_FREE");
+
+ /* Free full buffer type */
+ mrc = MPI_Type_free(&mpi_full_buffer);
+ VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_FREE");
+
+ /* Free full chunk type */
+ mrc = MPI_Type_free(&mpi_full_chunk);
+ VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_FREE");
+
+ /* Free chunk interleaved file type */
+ mrc = MPI_Type_free(&mpi_chunk_inter_type);
+ VRFY((mrc==MPI_SUCCESS), "MPIO_TYPE_FREE");
+ } /* end else */
+ } /* end if */
+
+ /* release HDF5 objects */
+ if (h5dset_space_id != -1) {
+ hrc = H5Sclose(h5dset_space_id);
+ if (hrc < 0){
+ fprintf(stderr, "HDF5 Dataset Space Close failed\n");
+ ret_code = FAIL;
+ } else {
+ h5dset_space_id = -1;
+ }
+ }
+
+ if (h5mem_space_id != -1) {
+ hrc = H5Sclose(h5mem_space_id);
+ if (hrc < 0) {
+ fprintf(stderr, "HDF5 Memory Space Close failed\n");
+ ret_code = FAIL;
+ } else {
+ h5mem_space_id = -1;
+ }
+ }
+
+ if (h5dxpl != -1) {
+ hrc = H5Pclose(h5dxpl);
+ if (hrc < 0) {
+ fprintf(stderr, "HDF5 Dataset Transfer Property List Close failed\n");
+ ret_code = FAIL;
+ } else {
+ h5dxpl = -1;
+ }
+ }
+
+ return ret_code;
+}
+
+/*
+ * Function: do_fopen
+ * Purpose: Open the specified file.
+ * Return: SUCCESS or FAIL
+ * Programmer: Albert Cheng, Bill Wendling, 2001/12/13
+ * Modifications:
+ */
+ static herr_t
+do_fopen(parameters *param, char *fname, file_descr *fd /*out*/, int flags)
+{
+ int ret_code = SUCCESS, mrc;
+ hid_t acc_tpl = -1; /* file access templates */
+
+ switch (param->io_type) {
+ case POSIXIO:
+ if (flags & (PIO_CREATE | PIO_WRITE))
+ fd->posixfd = POSIXCREATE(fname);
+ else
+ fd->posixfd = POSIXOPEN(fname, O_RDONLY);
+
+ if (fd->posixfd < 0 ) {
+ fprintf(stderr, "POSIX File Open failed(%s)\n", fname);
+ GOTOERROR(FAIL);
+ }
+
+
+ /* The perils of POSIX I/O in a parallel environment. The problem is:
+ *
+ * - Process n opens a file with truncation and then starts
+ * writing to the file.
+ * - Process m also opens the file with truncation, but after
+ * process n has already started to write to the file. Thus,
+ * all of the stuff process n wrote is now lost.
+ */
+ MPI_Barrier(pio_comm_g);
+
+ break;
+
+ case MPIO:
+ if (flags & (PIO_CREATE | PIO_WRITE)) {
+ MPI_File_delete(fname, h5_io_info_g);
+ mrc = MPI_File_open(pio_comm_g, fname, MPI_MODE_CREATE | MPI_MODE_RDWR,
+ h5_io_info_g, &fd->mpifd);
+
+ if (mrc != MPI_SUCCESS) {
+ fprintf(stderr, "MPI File Open failed(%s)\n", fname);
+ GOTOERROR(FAIL);
+ }
+
+ /*since MPI_File_open with MPI_MODE_CREATE does not truncate */
+ /*filesize , set size to 0 explicitedly. */
+ mrc = MPI_File_set_size(fd->mpifd, (MPI_Offset)0);
+ if (mrc != MPI_SUCCESS) {
+ fprintf(stderr, "MPI_File_set_size failed\n");
+ GOTOERROR(FAIL);
+ }
+ } else {
+ mrc = MPI_File_open(pio_comm_g, fname, MPI_MODE_RDONLY, h5_io_info_g, &fd->mpifd);
+ if (mrc != MPI_SUCCESS) {
+ fprintf(stderr, "MPI File Open failed(%s)\n", fname);
+ GOTOERROR(FAIL);
+ }
+ }
+
+ break;
+
+ case PHDF5:
+ if ((acc_tpl = H5Pcreate(H5P_FILE_ACCESS)) < 0) {
+ fprintf(stderr, "HDF5 Property List Create failed\n");
+ GOTOERROR(FAIL);
+ }
+
+ /* Set the file driver to the MPI-IO driver */
+ if (H5Pset_fapl_mpio(acc_tpl, pio_comm_g, h5_io_info_g) < 0) {
+ fprintf(stderr, "HDF5 Property List Set failed\n");
+ GOTOERROR(FAIL);
+ }
+
+ /* Set the alignment of objects in HDF5 file */
+ if (H5Pset_alignment(acc_tpl, param->h5_thresh, param->h5_align) < 0) {
+ fprintf(stderr, "HDF5 Property List Set failed\n");
+ GOTOERROR(FAIL);
+ }
+
+ /* create the parallel file */
+ if (flags & (PIO_CREATE | PIO_WRITE))
+ fd->h5fd = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, acc_tpl);
+ else
+ fd->h5fd = H5Fopen(fname, H5F_ACC_RDONLY, acc_tpl);
+ if (fd->h5fd < 0) {
+ fprintf(stderr, "HDF5 File Create failed(%s)\n", fname);
+ GOTOERROR(FAIL);
+ }
+
+ /* verifying the close of the acc_tpl */
+ if (H5Pclose(acc_tpl) < 0) {
+ fprintf(stderr, "HDF5 Property List Close failed\n");
+ GOTOERROR(FAIL);
+ }
+
+ break;
+ }
+
+done:
+ return ret_code;
+}
+
+/*
+ * Function: do_fclose
+ * Purpose: Close the specified file descriptor.
+ * Return: SUCCESS or FAIL
+ * Programmer: Albert Cheng, Bill Wendling, 2001/12/13
+ * Modifications:
+ */
+ static herr_t
+do_fclose(iotype iot, file_descr *fd /*out*/)
+{
+ herr_t ret_code = SUCCESS, hrc;
+ int mrc = 0, rc = 0;
+
+ switch (iot) {
+ case POSIXIO:
+ rc = POSIXCLOSE(fd->posixfd);
+
+ if (rc != 0){
+ fprintf(stderr, "POSIX File Close failed\n");
+ GOTOERROR(FAIL);
+ }
+
+ fd->posixfd = -1;
+ break;
+
+ case MPIO:
+ mrc = MPI_File_close(&fd->mpifd);
+
+ if (mrc != MPI_SUCCESS){
+ fprintf(stderr, "MPI File close failed\n");
+ GOTOERROR(FAIL);
+ }
+
+ fd->mpifd = MPI_FILE_NULL;
+ break;
+
+ case PHDF5:
+ hrc = H5Fclose(fd->h5fd);
+
+ if (hrc < 0) {
+ fprintf(stderr, "HDF5 File Close failed\n");
+ GOTOERROR(FAIL);
+ }
+
+ fd->h5fd = -1;
+ break;
+ }
+
+done:
+ return ret_code;
+}
+
+
+/*
+ * Function: do_fclose
+ * Purpose: Cleanup temporary file unless HDF5_NOCLEANUP is set.
+ * Only Proc 0 of the PIO communicator will do the cleanup.
+ * Other processes just return.
+ * Return: void
+ * Programmer: Albert Cheng 2001/12/12
+ * Modifications:
+ */
+ static void
+do_cleanupfile(iotype iot, char *fname)
+{
+ if (pio_mpi_rank_g != 0)
+ return;
+
+ if (clean_file_g == -1)
+ clean_file_g = (getenv("HDF5_NOCLEANUP")==NULL) ? 1 : 0;
+
+ if (clean_file_g){
+ switch (iot){
+ case POSIXIO:
+ remove(fname);
+ break;
+ case MPIO:
+ case PHDF5:
+ MPI_File_delete(fname, h5_io_info_g);
+ break;
+ }
+ }
+}
+
+#ifdef TIME_MPI
+/* instrument the MPI_File_wrirte_xxx and read_xxx calls to measure
+ * pure time spent in MPI_File code.
+ */
+int MPI_File_read_at(MPI_File fh, MPI_Offset offset, void *buf,
+ int count, MPI_Datatype datatype, MPI_Status *status)
+{
+ int err;
+ set_time(timer_g, HDF5_MPI_READ, TSTART);
+ err=PMPI_File_read_at(fh, offset, buf, count, datatype, status);
+ set_time(timer_g, HDF5_MPI_READ, TSTOP);
+ return err;
+}
+
+
+int MPI_File_read_at_all(MPI_File fh, MPI_Offset offset, void *buf,
+ int count, MPI_Datatype datatype, MPI_Status *status)
+{
+ int err;
+ set_time(timer_g, HDF5_MPI_READ, TSTART);
+ err=PMPI_File_read_at_all(fh, offset, buf, count, datatype, status);
+ set_time(timer_g, HDF5_MPI_READ, TSTOP);
+ return err;
+}
+
+int MPI_File_write_at(MPI_File fh, MPI_Offset offset, void *buf,
+ int count, MPI_Datatype datatype, MPI_Status *status)
+{
+ int err;
+ set_time(timer_g, HDF5_MPI_WRITE, TSTART);
+ err=PMPI_File_write_at(fh, offset, buf, count, datatype, status);
+ set_time(timer_g, HDF5_MPI_WRITE, TSTOP);
+ return err;
+}
+
+int MPI_File_write_at_all(MPI_File fh, MPI_Offset offset, void *buf,
+ int count, MPI_Datatype datatype, MPI_Status *status)
+{
+ int err;
+ set_time(timer_g, HDF5_MPI_WRITE, TSTART);
+ err=PMPI_File_write_at_all(fh, offset, buf, count, datatype, status);
+ set_time(timer_g, HDF5_MPI_WRITE, TSTOP);
+ return err;
+}
+
+#endif /* TIME_MPI */
+#endif /* H5_HAVE_PARALLEL */
+
+
+
+
+
diff --git a/tools/test/perform/pio_perf.c b/tools/test/perform/pio_perf.c
new file mode 100644
index 0000000..1402ec3
--- /dev/null
+++ b/tools/test/perform/pio_perf.c
@@ -0,0 +1,1695 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Parallel HDF5 Performance Testing Code
+ * --------------------------------------
+ *
+ * Portable code to test performance on the different platforms we support.
+ * This is what the report should look like:
+ *
+ * nprocs = Max#Procs
+ * IO API = POSIXIO
+ * # Files = 1, # of dsets = 1000, Elements per dset = 37000
+ * Write Results = x MB/s
+ * Read Results = x MB/s
+ * # Files = 1, # of dsets = 3000, Elements per dset = 37000
+ * Write Results = x MB/s
+ * Read Results = x MB/s
+ *
+ * . . .
+ *
+ * IO API = MPIO
+ * # Files = 1, # of dsets = 1000, Elements per dset = 37000
+ * Write Results = x MB/s
+ * Read Results = x MB/s
+ * # Files = 1, # of dsets = 3000, Elements per dset = 37000
+ * Write Results = x MB/s
+ * Read Results = x MB/s
+ *
+ * . . .
+ *
+ * IO API = PHDF5
+ * # Files = 1, # of dsets = 1000, Elements per dset = 37000
+ * Write Results = x MB/s
+ * Read Results = x MB/s
+ * # Files = 1, # of dsets = 3000, Elements per dset = 37000
+ * Write Results = x MB/s
+ * Read Results = x MB/s
+ *
+ * . . .
+ *
+ * nprocs = Max#Procs / 2
+ *
+ * . . .
+ *
+ */
+
+/* system header files */
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "hdf5.h"
+
+#ifdef H5_HAVE_PARALLEL
+
+/* library header files */
+#include <mpi.h>
+
+/* our header files */
+#include "pio_perf.h"
+
+/* useful macros */
+#define TAB_SPACE 4
+
+#define ONE_KB 1024
+#define ONE_MB (ONE_KB * ONE_KB)
+#define ONE_GB (ONE_MB * ONE_KB)
+
+#define PIO_POSIX 0x1
+#define PIO_MPI 0x2
+#define PIO_HDF5 0x4
+
+/* report 0.0 in case t is zero too */
+#define MB_PER_SEC(bytes,t) (((t)==0.0) ? 0.0 : ((((double)bytes) / ONE_MB) / (t)))
+
+#ifndef TRUE
+#define TRUE 1
+#endif /* TRUE */
+#ifndef FALSE
+#define FALSE (!TRUE)
+#endif /* FALSE */
+
+/* global variables */
+FILE *output; /* output file */
+int comm_world_rank_g; /* my rank in MPI_COMM_RANK */
+int comm_world_nprocs_g;/* num. of processes of MPI_COMM_WORLD */
+MPI_Comm pio_comm_g; /* Communicator to run the PIO */
+int pio_mpi_rank_g; /* MPI rank of pio_comm_g */
+int pio_mpi_nprocs_g; /* Number of processes of pio_comm_g */
+int pio_debug_level = 0;/* The debug level:
+ * 0 - Off
+ * 1 - Minimal
+ * 2 - Some more
+ * 3 - Maximal
+ * 4 - Maximal & then some
+ */
+
+/* local variables */
+static const char *progname = "h5perf";
+
+/*
+ * Command-line options: The user can specify short or long-named
+ * parameters. The long-named ones can be partially spelled. When
+ * adding more, make sure that they don't clash with each other.
+ */
+#if 1
+static const char *s_opts = "a:A:B:cCd:D:e:F:ghi:Imno:p:P:stT:wx:X:";
+#else
+static const char *s_opts = "a:A:bB:cCd:D:e:F:ghi:Imno:p:P:stT:wx:X:";
+#endif /* 1 */
+static struct long_options l_opts[] = {
+ { "align", require_arg, 'a' },
+ { "alig", require_arg, 'a' },
+ { "ali", require_arg, 'a' },
+ { "al", require_arg, 'a' },
+ { "api", require_arg, 'A' },
+ { "ap", require_arg, 'A' },
+#if 0
+ /* a sighting of the elusive binary option */
+ { "binary", no_arg, 'b' },
+ { "binar", no_arg, 'b' },
+ { "bina", no_arg, 'b' },
+ { "bin", no_arg, 'b' },
+ { "bi", no_arg, 'b' },
+#endif /* 0 */
+ { "block-size", require_arg, 'B' },
+ { "block-siz", require_arg, 'B' },
+ { "block-si", require_arg, 'B' },
+ { "block-s", require_arg, 'B' },
+ { "block-", require_arg, 'B' },
+ { "block", require_arg, 'B' },
+ { "bloc", require_arg, 'B' },
+ { "blo", require_arg, 'B' },
+ { "bl", require_arg, 'B' },
+ { "chunk", no_arg, 'c' },
+ { "chun", no_arg, 'c' },
+ { "chu", no_arg, 'c' },
+ { "ch", no_arg, 'c' },
+ { "collective", no_arg, 'C' },
+ { "collectiv", no_arg, 'C' },
+ { "collecti", no_arg, 'C' },
+ { "collect", no_arg, 'C' },
+ { "collec", no_arg, 'C' },
+ { "colle", no_arg, 'C' },
+ { "coll", no_arg, 'C' },
+ { "col", no_arg, 'C' },
+ { "co", no_arg, 'C' },
+ { "debug", require_arg, 'D' },
+ { "debu", require_arg, 'D' },
+ { "deb", require_arg, 'D' },
+ { "de", require_arg, 'D' },
+ { "geometry", no_arg, 'g' },
+ { "geometr", no_arg, 'g' },
+ { "geomet", no_arg, 'g' },
+ { "geome", no_arg, 'g' },
+ { "geom", no_arg, 'g' },
+ { "geo", no_arg, 'g' },
+ { "ge", no_arg, 'g' },
+ { "help", no_arg, 'h' },
+ { "hel", no_arg, 'h' },
+ { "he", no_arg, 'h' },
+ { "interleaved", require_arg, 'I' },
+ { "interleave", require_arg, 'I' },
+ { "interleav", require_arg, 'I' },
+ { "interlea", require_arg, 'I' },
+ { "interle", require_arg, 'I' },
+ { "interl", require_arg, 'I' },
+ { "inter", require_arg, 'I' },
+ { "inte", require_arg, 'I' },
+ { "int", require_arg, 'I' },
+ { "in", require_arg, 'I' },
+ { "max-num-processes", require_arg, 'P' },
+ { "max-num-processe", require_arg, 'P' },
+ { "max-num-process", require_arg, 'P' },
+ { "max-num-proces", require_arg, 'P' },
+ { "max-num-proce", require_arg, 'P' },
+ { "max-num-proc", require_arg, 'P' },
+ { "max-num-pro", require_arg, 'P' },
+ { "max-num-pr", require_arg, 'P' },
+ { "max-num-p", require_arg, 'P' },
+ { "min-num-processes", require_arg, 'p' },
+ { "min-num-processe", require_arg, 'p' },
+ { "min-num-process", require_arg, 'p' },
+ { "min-num-proces", require_arg, 'p' },
+ { "min-num-proce", require_arg, 'p' },
+ { "min-num-proc", require_arg, 'p' },
+ { "min-num-pro", require_arg, 'p' },
+ { "min-num-pr", require_arg, 'p' },
+ { "min-num-p", require_arg, 'p' },
+ { "max-xfer-size", require_arg, 'X' },
+ { "max-xfer-siz", require_arg, 'X' },
+ { "max-xfer-si", require_arg, 'X' },
+ { "max-xfer-s", require_arg, 'X' },
+ { "max-xfer", require_arg, 'X' },
+ { "max-xfe", require_arg, 'X' },
+ { "max-xf", require_arg, 'X' },
+ { "max-x", require_arg, 'X' },
+ { "min-xfer-size", require_arg, 'x' },
+ { "min-xfer-siz", require_arg, 'x' },
+ { "min-xfer-si", require_arg, 'x' },
+ { "min-xfer-s", require_arg, 'x' },
+ { "min-xfer", require_arg, 'x' },
+ { "min-xfe", require_arg, 'x' },
+ { "min-xf", require_arg, 'x' },
+ { "min-x", require_arg, 'x' },
+ { "num-bytes", require_arg, 'e' },
+ { "num-byte", require_arg, 'e' },
+ { "num-byt", require_arg, 'e' },
+ { "num-by", require_arg, 'e' },
+ { "num-b", require_arg, 'e' },
+ { "num-dsets", require_arg, 'd' },
+ { "num-dset", require_arg, 'd' },
+ { "num-dse", require_arg, 'd' },
+ { "num-ds", require_arg, 'd' },
+ { "num-d", require_arg, 'd' },
+ { "num-files", require_arg, 'F' },
+ { "num-file", require_arg, 'F' },
+ { "num-fil", require_arg, 'F' },
+ { "num-fi", require_arg, 'F' },
+ { "num-f", require_arg, 'F' },
+ { "num-iterations", require_arg, 'i' },
+ { "num-iteration", require_arg, 'i' },
+ { "num-iteratio", require_arg, 'i' },
+ { "num-iterati", require_arg, 'i' },
+ { "num-iterat", require_arg, 'i' },
+ { "num-itera", require_arg, 'i' },
+ { "num-iter", require_arg, 'i' },
+ { "num-ite", require_arg, 'i' },
+ { "num-it", require_arg, 'i' },
+ { "num-i", require_arg, 'i' },
+ { "output", require_arg, 'o' },
+ { "outpu", require_arg, 'o' },
+ { "outp", require_arg, 'o' },
+ { "out", require_arg, 'o' },
+ { "ou", require_arg, 'o' },
+ { "threshold", require_arg, 'T' },
+ { "threshol", require_arg, 'T' },
+ { "thresho", require_arg, 'T' },
+ { "thresh", require_arg, 'T' },
+ { "thres", require_arg, 'T' },
+ { "thre", require_arg, 'T' },
+ { "thr", require_arg, 'T' },
+ { "th", require_arg, 'T' },
+ { "write-only", require_arg, 'w' },
+ { "write-onl", require_arg, 'w' },
+ { "write-on", require_arg, 'w' },
+ { "write-o", require_arg, 'w' },
+ { "write", require_arg, 'w' },
+ { "writ", require_arg, 'w' },
+ { "wri", require_arg, 'w' },
+ { "wr", require_arg, 'w' },
+ { NULL, 0, '\0' }
+};
+
+struct options {
+ long io_types; /* bitmask of which I/O types to test */
+ const char *output_file; /* file to print report to */
+ long num_dsets; /* number of datasets */
+ long num_files; /* number of files */
+ off_t num_bpp; /* number of bytes per proc per dset */
+ int num_iters; /* number of iterations */
+ int max_num_procs; /* maximum number of processes to use */
+ int min_num_procs; /* minimum number of processes to use */
+ size_t max_xfer_size; /* maximum transfer buffer size */
+ size_t min_xfer_size; /* minimum transfer buffer size */
+ size_t blk_size; /* Block size */
+ unsigned interleaved; /* Interleaved vs. contiguous blocks */
+ unsigned collective; /* Collective vs. independent I/O */
+ unsigned dim2d; /* 1D vs. 2D geometry */
+ int print_times; /* print times as well as throughputs */
+ int print_raw; /* print raw data throughput info */
+ off_t h5_alignment; /* alignment in HDF5 file */
+ off_t h5_threshold; /* threshold for alignment in HDF5 file */
+ int h5_use_chunks; /* Make HDF5 dataset chunked */
+ int h5_write_only; /* Perform the write tests only */
+ int verify; /* Verify data correctness */
+};
+
+typedef struct _minmax {
+ double min;
+ double max;
+ double sum;
+ int num;
+} minmax;
+
+/* local functions */
+static off_t parse_size_directive(const char *size);
+static struct options *parse_command_line(int argc, char *argv[]);
+static void run_test_loop(struct options *options);
+static int run_test(iotype iot, parameters parms, struct options *opts);
+static void output_all_info(minmax *mm, int count, int indent_level);
+static void get_minmax(minmax *mm, double val);
+static minmax accumulate_minmax_stuff(minmax *mm, int count);
+static int create_comm_world(int num_procs, int *doing_pio);
+static int destroy_comm_world(void);
+static void output_results(const struct options *options, const char *name,
+ minmax *table, int table_size, off_t data_size);
+static void output_times(const struct options *options, const char *name,
+ minmax *table, int table_size);
+static void output_report(const char *fmt, ...);
+static void print_indent(register int indent);
+static void usage(const char *prog);
+static void report_parameters(struct options *opts);
+
+/*
+ * Function: main
+ * Purpose: Start things up. Initialize MPI and then call the test looping
+ * function.
+ * Return: EXIT_SUCCESS or EXIT_FAILURE
+ * Programmer: Bill Wendling, 30. October 2001
+ * Modifications:
+ */
+int
+main(int argc, char **argv)
+{
+ int ret;
+ int exit_value = EXIT_SUCCESS;
+ struct options *opts = NULL;
+
+#ifndef STANDALONE
+ /* Initialize h5tools lib */
+ h5tools_init();
+#endif
+
+ output = stdout;
+
+ /* initialize MPI and get the maximum num of processors we started with */
+ MPI_Init(&argc, &argv);
+ ret = MPI_Comm_size(MPI_COMM_WORLD, &comm_world_nprocs_g);
+
+ if (ret != MPI_SUCCESS) {
+ fprintf(stderr, "%s: MPI_Comm_size call failed\n", progname);
+
+ if (ret == MPI_ERR_COMM)
+ fprintf(stderr, "invalid MPI communicator\n");
+ else
+ fprintf(stderr, "invalid argument\n");
+
+ exit_value = EXIT_FAILURE;
+ goto finish;
+ }
+
+ ret = MPI_Comm_rank(MPI_COMM_WORLD, &comm_world_rank_g);
+
+ if (ret != MPI_SUCCESS) {
+ fprintf(stderr, "%s: MPI_Comm_rank call failed\n", progname);
+
+ if (ret == MPI_ERR_COMM)
+ fprintf(stderr, "invalid MPI communicator\n");
+ else
+ fprintf(stderr, "invalid argument\n");
+
+ exit_value = EXIT_FAILURE;
+ goto finish;
+ }
+
+ pio_comm_g = MPI_COMM_WORLD;
+
+ h5_set_info_object();
+ opts = parse_command_line(argc, argv);
+
+ if (!opts) {
+ exit_value = EXIT_FAILURE;
+ goto finish;
+ }
+
+ if (opts->output_file) {
+ if ((output = fopen(opts->output_file, "w")) == NULL) {
+ fprintf(stderr, "%s: cannot open output file\n", progname);
+ perror(opts->output_file);
+ goto finish;
+ }
+ }
+
+ if ((pio_debug_level == 0 && comm_world_rank_g == 0) || pio_debug_level > 0)
+ report_parameters(opts);
+
+ run_test_loop(opts);
+
+finish:
+ MPI_Finalize();
+ free(opts);
+ return exit_value;
+}
+
+/*
+ * Function: run_test_loop
+ * Purpose: Run the I/O tests. Write the results to OUTPUT.
+ *
+ * - The slowest changing part of the test is the number of
+ * processors to use. For each loop iteration, we divide that
+ * number by 2 and rerun the test.
+ *
+ * - The second slowest is what type of IO API to perform. We have
+ * three choices: POSIXIO, MPI-IO, and PHDF5.
+ *
+ * - Then we change the size of the buffer. This information is
+ * inferred from the number of datasets to create and the number
+ * of integers to put into each dataset. The backend code figures
+ * this out.
+ *
+ * Return: Nothing
+ * Programmer: Bill Wendling, 30. October 2001
+ * Modifications:
+ * Added 2D testing (Christian Chilan, 10. August 2005)
+ */
+static void
+run_test_loop(struct options *opts)
+{
+ parameters parms;
+ int num_procs;
+ int doing_pio; /* if this process is doing PIO */
+
+ parms.num_files = opts->num_files;
+ parms.num_dsets = opts->num_dsets;
+ parms.num_iters = opts->num_iters;
+ parms.blk_size = opts->blk_size;
+ parms.interleaved = opts->interleaved;
+ parms.collective = opts->collective;
+ parms.dim2d = opts->dim2d;
+ parms.h5_align = opts->h5_alignment;
+ parms.h5_thresh = opts->h5_threshold;
+ parms.h5_use_chunks = opts->h5_use_chunks;
+ parms.h5_write_only = opts->h5_write_only;
+ parms.verify = opts->verify;
+
+ /* start with max_num_procs and decrement it by half for each loop. */
+ /* if performance needs restart, fewer processes may be needed. */
+ for (num_procs = opts->max_num_procs;
+ num_procs >= opts->min_num_procs; num_procs >>= 1) {
+ register size_t buf_size;
+
+ parms.num_procs = num_procs;
+
+ if (create_comm_world(parms.num_procs, &doing_pio) != SUCCESS) {
+ /* do something harsh */
+ }
+
+ /* only processes doing PIO will run the tests */
+ if (doing_pio){
+ output_report("Number of processors = %ld\n", parms.num_procs);
+
+ /* multiply the xfer buffer size by 2 for each loop iteration */
+ for (buf_size = opts->min_xfer_size;
+ buf_size <= opts->max_xfer_size; buf_size <<= 1) {
+ parms.buf_size = buf_size;
+
+ if (parms.dim2d){
+ parms.num_bytes = (off_t)pow((double)(opts->num_bpp*parms.num_procs),2);
+ if (parms.interleaved)
+ output_report("Transfer Buffer Size: %ldx%ld bytes, File size: %.2f MB\n",
+ buf_size, opts->blk_size,
+ ((double)parms.num_dsets * (double)parms.num_bytes)
+ / ONE_MB);
+ else
+ output_report("Transfer Buffer Size: %ldx%ld bytes, File size: %.2f MB\n",
+ opts->blk_size, buf_size,
+ ((double)parms.num_dsets * (double)parms.num_bytes)
+ / ONE_MB);
+
+ print_indent(1);
+ output_report(" # of files: %ld, # of datasets: %ld, dataset size: %.2fx%.2f KB\n",
+ parms.num_files, parms.num_dsets, (double)(opts->num_bpp*parms.num_procs)/ONE_KB,
+ (double)(opts->num_bpp*parms.num_procs)/ONE_KB);
+ }
+ else{
+ parms.num_bytes = (off_t)opts->num_bpp*parms.num_procs;
+ output_report("Transfer Buffer Size: %ld bytes, File size: %.2f MB\n",
+ buf_size,((double)parms.num_dsets * (double)parms.num_bytes) / ONE_MB);
+
+ print_indent(1);
+ output_report(" # of files: %ld, # of datasets: %ld, dataset size: %.2f MB\n",
+ parms.num_files, parms.num_dsets, (double)(opts->num_bpp*parms.num_procs)/ONE_MB);
+ }
+
+ if (opts->io_types & PIO_POSIX)
+ run_test(POSIXIO, parms, opts);
+
+ if (opts->io_types & PIO_MPI)
+ run_test(MPIO, parms, opts);
+
+ if (opts->io_types & PIO_HDF5)
+ run_test(PHDF5, parms, opts);
+
+ /* Run the tests once if buf_size==0, but then break out */
+ if(buf_size==0)
+ break;
+ }
+
+ if (destroy_comm_world() != SUCCESS) {
+ /* do something harsh */
+ }
+ }
+ }
+}
+
+/*
+ * Function: run_test
+ * Purpose: Inner loop call to actually run the I/O test.
+ * Return: Nothing
+ * Programmer: Bill Wendling, 18. December 2001
+ * Modifications:
+ */
+static int
+run_test(iotype iot, parameters parms, struct options *opts)
+{
+ results res;
+ register int i, ret_value = SUCCESS;
+ int comm_size;
+ off_t raw_size;
+ minmax *write_mpi_mm_table=NULL;
+ minmax *write_mm_table=NULL;
+ minmax *write_gross_mm_table=NULL;
+ minmax *write_raw_mm_table=NULL;
+ minmax *read_mpi_mm_table=NULL;
+ minmax *read_mm_table=NULL;
+ minmax *read_gross_mm_table=NULL;
+ minmax *read_raw_mm_table=NULL;
+ minmax *read_open_mm_table=NULL;
+ minmax *read_close_mm_table=NULL;
+ minmax *write_open_mm_table=NULL;
+ minmax *write_close_mm_table=NULL;
+ minmax write_mpi_mm = {0.0, 0.0, 0.0, 0};
+ minmax write_mm = {0.0, 0.0, 0.0, 0};
+ minmax write_gross_mm = {0.0, 0.0, 0.0, 0};
+ minmax write_raw_mm = {0.0, 0.0, 0.0, 0};
+ minmax read_mpi_mm = {0.0, 0.0, 0.0, 0};
+ minmax read_mm = {0.0, 0.0, 0.0, 0};
+ minmax read_gross_mm = {0.0, 0.0, 0.0, 0};
+ minmax read_raw_mm = {0.0, 0.0, 0.0, 0};
+ minmax read_open_mm = {0.0, 0.0, 0.0, 0};
+ minmax read_close_mm = {0.0, 0.0, 0.0, 0};
+ minmax write_open_mm = {0.0, 0.0, 0.0, 0};
+ minmax write_close_mm = {0.0, 0.0, 0.0, 0};
+
+ raw_size = parms.num_files * (off_t)parms.num_dsets * (off_t)parms.num_bytes;
+ parms.io_type = iot;
+ print_indent(2);
+ output_report("IO API = ");
+
+ switch (iot) {
+ case POSIXIO:
+ output_report("POSIX\n");
+ break;
+ case MPIO:
+ output_report("MPIO\n");
+ break;
+ case PHDF5:
+ output_report("PHDF5 (w/MPI-IO driver)\n");
+ break;
+ }
+
+ MPI_Comm_size(pio_comm_g, &comm_size);
+
+ /* allocate space for tables minmax and that it is sufficient */
+ /* to initialize all elements to zeros by calloc. */
+ write_mpi_mm_table = calloc((size_t)parms.num_iters , sizeof(minmax));
+ write_mm_table = calloc((size_t)parms.num_iters , sizeof(minmax));
+ write_gross_mm_table = calloc((size_t)parms.num_iters , sizeof(minmax));
+ write_raw_mm_table = calloc((size_t)parms.num_iters , sizeof(minmax));
+ write_open_mm_table = calloc((size_t)parms.num_iters , sizeof(minmax));
+ write_close_mm_table = calloc((size_t)parms.num_iters , sizeof(minmax));
+ if (!parms.h5_write_only) {
+ read_mpi_mm_table = calloc((size_t)parms.num_iters , sizeof(minmax));
+ read_mm_table = calloc((size_t)parms.num_iters , sizeof(minmax));
+ read_gross_mm_table = calloc((size_t)parms.num_iters , sizeof(minmax));
+ read_raw_mm_table = calloc((size_t)parms.num_iters , sizeof(minmax));
+ read_open_mm_table = calloc((size_t)parms.num_iters , sizeof(minmax));
+ read_close_mm_table = calloc((size_t)parms.num_iters , sizeof(minmax));
+ }
+
+ /* Do IO iteration times, collecting statistics each time */
+ for (i = 0; i < parms.num_iters; ++i) {
+ double t;
+
+ MPI_Barrier(pio_comm_g);
+ res = do_pio(parms);
+
+ /* gather all of the "mpi write" times */
+ t = get_time(res.timers, HDF5_MPI_WRITE);
+ get_minmax(&write_mpi_mm, t);
+
+ write_mpi_mm_table[i] = write_mpi_mm;
+
+ /* gather all of the "write" times */
+ t = get_time(res.timers, HDF5_FINE_WRITE_FIXED_DIMS);
+ get_minmax(&write_mm, t);
+
+ write_mm_table[i] = write_mm;
+
+ /* gather all of the "write" times from open to close */
+ t = get_time(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS);
+ get_minmax(&write_gross_mm, t);
+
+ write_gross_mm_table[i] = write_gross_mm;
+
+ /* gather all of the raw "write" times */
+ t = get_time(res.timers, HDF5_RAW_WRITE_FIXED_DIMS);
+ get_minmax(&write_raw_mm, t);
+
+ write_raw_mm_table[i] = write_raw_mm;
+
+ /* gather all of the file open times (time from open to first write) */
+ t = get_time(res.timers, HDF5_FILE_WRITE_OPEN);
+ get_minmax(&write_open_mm, t);
+
+ write_open_mm_table[i] = write_open_mm;
+
+ /* gather all of the file close times (time from last write to close) */
+ t = get_time(res.timers, HDF5_FILE_WRITE_CLOSE);
+ get_minmax(&write_close_mm, t);
+
+ write_close_mm_table[i] = write_close_mm;
+
+ if (!parms.h5_write_only) {
+ /* gather all of the "mpi read" times */
+ t = get_time(res.timers, HDF5_MPI_READ);
+ get_minmax(&read_mpi_mm, t);
+
+ read_mpi_mm_table[i] = read_mpi_mm;
+
+ /* gather all of the "read" times */
+ t = get_time(res.timers, HDF5_FINE_READ_FIXED_DIMS);
+ get_minmax(&read_mm, t);
+
+ read_mm_table[i] = read_mm;
+
+ /* gather all of the "read" times from open to close */
+ t = get_time(res.timers, HDF5_GROSS_READ_FIXED_DIMS);
+ get_minmax(&read_gross_mm, t);
+
+ read_gross_mm_table[i] = read_gross_mm;
+
+ /* gather all of the raw "read" times */
+ t = get_time(res.timers, HDF5_RAW_READ_FIXED_DIMS);
+ get_minmax(&read_raw_mm, t);
+
+ read_raw_mm_table[i] = read_raw_mm;
+
+ /* gather all of the file open times (time from open to first read) */
+ t = get_time(res.timers, HDF5_FILE_READ_OPEN);
+ get_minmax(&read_open_mm, t);
+
+ read_open_mm_table[i] = read_open_mm;
+
+ /* gather all of the file close times (time from last read to close) */
+ t = get_time(res.timers, HDF5_FILE_READ_CLOSE);
+ get_minmax(&read_close_mm, t);
+
+ read_close_mm_table[i] = read_close_mm;
+
+ }
+
+ io_time_destroy(res.timers);
+ }
+
+ /*
+ * Show various statistics
+ */
+ /* Write statistics */
+ /* Print the raw data throughput if desired */
+ if (opts->print_raw) {
+ /* accumulate and output the max, min, and average "raw write" times */
+ if (pio_debug_level >= 3) {
+ /* output all of the times for all iterations */
+ print_indent(3);
+ output_report("Raw Data Write details:\n");
+ output_all_info(write_raw_mm_table, parms.num_iters, 4);
+ }
+
+ output_results(opts,"Raw Data Write",write_raw_mm_table,parms.num_iters,raw_size);
+ } /* end if */
+
+ /* show mpi write statics */
+ if (pio_debug_level >= 3) {
+ /* output all of the times for all iterations */
+ print_indent(3);
+ output_report("MPI Write details:\n");
+ output_all_info(write_mpi_mm_table, parms.num_iters, 4);
+ }
+
+ /* We don't currently output the MPI write results */
+
+ /* accumulate and output the max, min, and average "write" times */
+ if (pio_debug_level >= 3) {
+ /* output all of the times for all iterations */
+ print_indent(3);
+ output_report("Write details:\n");
+ output_all_info(write_mm_table, parms.num_iters, 4);
+ }
+
+ output_results(opts,"Write",write_mm_table,parms.num_iters,raw_size);
+
+ /* accumulate and output the max, min, and average "gross write" times */
+ if (pio_debug_level >= 3) {
+ /* output all of the times for all iterations */
+ print_indent(3);
+ output_report("Write Open-Close details:\n");
+ output_all_info(write_gross_mm_table, parms.num_iters, 4);
+ }
+
+ output_results(opts,"Write Open-Close",write_gross_mm_table,parms.num_iters,raw_size);
+
+ if (opts->print_times) {
+ output_times(opts,"Write File Open",write_open_mm_table,parms.num_iters);
+ output_times(opts,"Write File Close",write_close_mm_table,parms.num_iters);
+ }
+
+ /* Print out time from open to first write */
+ if (pio_debug_level >= 3) {
+ /* output all of the times for all iterations */
+ print_indent(3);
+ output_report("Write file open details:\n");
+ output_all_info(write_open_mm_table, parms.num_iters, 4);
+ }
+
+ /* Print out time from last write to close */
+ if (pio_debug_level >= 3) {
+ /* output all of the times for all iterations */
+ print_indent(3);
+ output_report("Write file close details:\n");
+ output_all_info(write_close_mm_table, parms.num_iters, 4);
+ }
+
+ if (!parms.h5_write_only) {
+ /* Read statistics */
+ /* Print the raw data throughput if desired */
+ if (opts->print_raw) {
+ /* accumulate and output the max, min, and average "raw read" times */
+ if (pio_debug_level >= 3) {
+ /* output all of the times for all iterations */
+ print_indent(3);
+ output_report("Raw Data Read details:\n");
+ output_all_info(read_raw_mm_table, parms.num_iters, 4);
+ }
+
+ output_results(opts, "Raw Data Read", read_raw_mm_table,
+ parms.num_iters, raw_size);
+ } /* end if */
+
+ /* show mpi read statics */
+ if (pio_debug_level >= 3) {
+ /* output all of the times for all iterations */
+ print_indent(3);
+ output_report("MPI Read details:\n");
+ output_all_info(read_mpi_mm_table, parms.num_iters, 4);
+ }
+
+ /* We don't currently output the MPI read results */
+
+ /* accumulate and output the max, min, and average "read" times */
+ if (pio_debug_level >= 3) {
+ /* output all of the times for all iterations */
+ print_indent(3);
+ output_report("Read details:\n");
+ output_all_info(read_mm_table, parms.num_iters, 4);
+ }
+
+ output_results(opts, "Read", read_mm_table, parms.num_iters, raw_size);
+
+ /* accumulate and output the max, min, and average "gross read" times */
+ if (pio_debug_level >= 3) {
+ /* output all of the times for all iterations */
+ print_indent(3);
+ output_report("Read Open-Close details:\n");
+ output_all_info(read_gross_mm_table, parms.num_iters, 4);
+ }
+
+ output_results(opts, "Read Open-Close", read_gross_mm_table,parms.num_iters, raw_size);
+
+ if (opts->print_times) {
+ output_times(opts,"Read File Open",read_open_mm_table,parms.num_iters);
+ output_times(opts,"Read File Close",read_close_mm_table,parms.num_iters);
+ }
+
+ /* Print out time from open to first read */
+ if (pio_debug_level >= 3) {
+ /* output all of the times for all iterations */
+ print_indent(3);
+ output_report("Read file open details:\n");
+ output_all_info(read_open_mm_table, parms.num_iters, 4);
+ }
+
+ /* Print out time from last read to close */
+ if (pio_debug_level >= 3) {
+ /* output all of the times for all iterations */
+ print_indent(3);
+ output_report("Read file close details:\n");
+ output_all_info(read_close_mm_table, parms.num_iters, 4);
+ }
+
+ }
+
+ /* clean up our mess */
+ free(write_mpi_mm_table);
+ free(write_mm_table);
+ free(write_gross_mm_table);
+ free(write_raw_mm_table);
+ free(write_open_mm_table);
+ free(write_close_mm_table);
+
+ if (!parms.h5_write_only) {
+ free(read_mpi_mm_table);
+ free(read_mm_table);
+ free(read_gross_mm_table);
+ free(read_raw_mm_table);
+ free(read_open_mm_table);
+ free(read_close_mm_table);
+ }
+
+ return ret_value;
+}
+
+/*
+ * Function: output_all_info
+ * Purpose:
+ * Return: Nothing
+ * Programmer: Bill Wendling, 29. January 2002
+ * Modifications:
+ */
+static void
+output_all_info(minmax *mm, int count, int indent_level)
+{
+ int i;
+
+ for (i = 0; i < count; ++i) {
+ print_indent(indent_level);
+ output_report("Iteration %d:\n", i + 1);
+ print_indent(indent_level + 1);
+ output_report("Minimum Time: %.2fs\n", mm[i].min);
+ print_indent(indent_level + 1);
+ output_report("Maximum Time: %.2fs\n", mm[i].max);
+ }
+}
+
+/*
+ * Function: get_minmax
+ * Purpose: Gather all the min, max and total of val.
+ * Return: Nothing
+ * Programmer: Bill Wendling, 21. December 2001
+ * Modifications:
+ * Use MPI_Allreduce to do it. -akc, 2002/01/11
+ */
+static void
+get_minmax(minmax *mm, double val)
+{
+ int myrank;
+
+ MPI_Comm_rank(pio_comm_g, &myrank);
+ MPI_Comm_size(pio_comm_g, &mm->num);
+
+ MPI_Allreduce(&val, &mm->max, 1, MPI_DOUBLE, MPI_MAX, pio_comm_g);
+ MPI_Allreduce(&val, &mm->min, 1, MPI_DOUBLE, MPI_MIN, pio_comm_g);
+ MPI_Allreduce(&val, &mm->sum, 1, MPI_DOUBLE, MPI_SUM, pio_comm_g);
+}
+
+/*
+ * Function: accumulate_minmax_stuff
+ * Purpose: Accumulate the minimum, maximum, and average of the times
+ * across all processes.
+ * Return: TOTAL_MM - the total of all of these.
+ * Programmer: Bill Wendling, 21. December 2001
+ * Modifications:
+ * Changed to use seconds instead of MB/s - QAK, 5/9/02
+ */
+static minmax
+accumulate_minmax_stuff(minmax *mm, int count)
+{
+ int i;
+ minmax total_mm;
+
+ total_mm.sum = 0.0;
+ total_mm.max = -DBL_MAX;
+ total_mm.min = DBL_MAX;
+ total_mm.num = count;
+
+ for (i = 0; i < count; ++i) {
+ double m = mm[i].max;
+
+ total_mm.sum += m;
+
+ if (m < total_mm.min)
+ total_mm.min = m;
+
+ if (m > total_mm.max)
+ total_mm.max = m;
+ }
+
+ return total_mm;
+}
+
+/*
+ * Function: create_comm_world
+ * Purpose: Create an MPI Comm world and store it in pio_comm_g, which
+ * is a global variable.
+ * Return: SUCCESS on success.
+ * FAIL otherwise.
+ * Programmer: Bill Wendling, 19. December 2001
+ * Modifications:
+ */
+static int
+create_comm_world(int num_procs, int *doing_pio)
+{
+ /* MPI variables */
+ int mrc; /* return values */
+ int color; /* for communicator creation */
+ int myrank, nprocs;
+
+ pio_comm_g = MPI_COMM_NULL;
+
+ /*
+ * Create a sub communicator for this PIO run. Easier to use the first N
+ * processes.
+ */
+ MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
+
+ if (num_procs > nprocs) {
+ fprintf(stderr,
+ "number of process(%d) must be <= number of processes in MPI_COMM_WORLD(%d)\n",
+ num_procs, nprocs);
+ goto error_done;
+ }
+
+ MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
+ color = (myrank < num_procs);
+ mrc = MPI_Comm_split(MPI_COMM_WORLD, color, myrank, &pio_comm_g);
+
+ if (mrc != MPI_SUCCESS) {
+ fprintf(stderr, "MPI_Comm_split failed\n");
+ goto error_done;
+ }
+
+ if (!color) {
+ /* not involved in this run */
+ mrc = destroy_comm_world();
+ goto done;
+ }
+
+ /* determine the MPI rank in the PIO communicator */
+ MPI_Comm_size(pio_comm_g, &pio_mpi_nprocs_g);
+ MPI_Comm_rank(pio_comm_g, &pio_mpi_rank_g);
+
+done:
+ *doing_pio = color;
+ return SUCCESS;
+
+error_done:
+ destroy_comm_world();
+ return FAIL;
+}
+
+/*
+ * Function: destroy_comm_world
+ * Purpose: Destroy the created MPI Comm world which is stored in the
+ * pio_comm_g global variable.
+ * Return: SUCCESS on success.
+ * FAIL otherwise.
+ * Programmer: Bill Wendling, 19. December 2001
+ * Modifications:
+ */
+static int
+destroy_comm_world(void)
+{
+ int mrc = SUCCESS; /* return code */
+
+ /* release MPI resources */
+ if (pio_comm_g != MPI_COMM_NULL)
+ mrc = (MPI_Comm_free(&pio_comm_g) == MPI_SUCCESS ? SUCCESS : FAIL);
+
+ return mrc;
+}
+
+/*
+ * Function: output_results
+ * Purpose: Print information about the time & bandwidth for a given
+ * minmax & # of iterations.
+ * Return: Nothing
+ * Programmer: Quincey Koziol, 9. May 2002
+ * Modifications:
+ */
+static void
+output_results(const struct options *opts, const char *name, minmax *table,
+ int table_size,off_t data_size)
+{
+ minmax total_mm;
+
+ total_mm = accumulate_minmax_stuff(table, table_size);
+
+ print_indent(3);
+ output_report("%s (%d iteration(s)):\n", name,table_size);
+
+ /* Note: The maximum throughput uses the minimum amount of time & vice versa */
+
+ print_indent(4);
+ output_report("Maximum Throughput: %6.2f MB/s", MB_PER_SEC(data_size,total_mm.min));
+ if(opts->print_times)
+ output_report(" (%7.3f s)\n", total_mm.min);
+ else
+ output_report("\n");
+
+ print_indent(4);
+ output_report("Average Throughput: %6.2f MB/s",
+ MB_PER_SEC(data_size,total_mm.sum / total_mm.num));
+ if(opts->print_times)
+ output_report(" (%7.3f s)\n", (total_mm.sum / total_mm.num));
+ else
+ output_report("\n");
+
+ print_indent(4);
+ output_report("Minimum Throughput: %6.2f MB/s", MB_PER_SEC(data_size,total_mm.max));
+ if(opts->print_times)
+ output_report(" (%7.3f s)\n", total_mm.max);
+ else
+ output_report("\n");
+
+}
+
+static void
+output_times(const struct options *opts, const char *name, minmax *table,
+ int table_size)
+{
+ minmax total_mm;
+
+ total_mm = accumulate_minmax_stuff(table, table_size);
+
+ print_indent(3);
+ output_report("%s (%d iteration(s)):\n", name,table_size);
+
+ /* Note: The maximum throughput uses the minimum amount of time & vice versa */
+
+ print_indent(4);
+ output_report("Minimum Accumulated Time using %d file(s): %7.5f s\n", opts->num_files,(total_mm.min));
+
+ print_indent(4);
+ output_report("Average Accumulated Time using %d file(s): %7.5f s\n", opts->num_files,(total_mm.sum / total_mm.num));
+
+ print_indent(4);
+ output_report("Maximum Accumulated Time using %d file(s): %7.5f s\n", opts->num_files,(total_mm.max));
+}
+
+/*
+ * Function: output_report
+ * Purpose: Print a line of the report. Only do so if I'm the 0 process.
+ * Return: Nothing
+ * Programmer: Bill Wendling, 19. December 2001
+ * Modifications:
+ */
+static void
+output_report(const char *fmt, ...)
+{
+ int myrank;
+
+ MPI_Comm_rank(pio_comm_g, &myrank);
+
+ if (myrank == 0) {
+ va_list ap;
+
+ va_start(ap, fmt);
+ vfprintf(output, fmt, ap);
+ va_end(ap);
+ }
+}
+
+/*
+ * Function: print_indent
+ * Purpose: Print spaces to indent a new line of text for pretty printing
+ * things.
+ * Return: Nothing
+ * Programmer: Bill Wendling, 29. October 2001
+ * Modifications:
+ */
+static void
+print_indent(register int indent)
+{
+ int myrank;
+
+ MPI_Comm_rank(pio_comm_g, &myrank);
+
+ if (myrank == 0) {
+ indent *= TAB_SPACE;
+
+ for (; indent > 0; --indent)
+ fputc(' ', output);
+ }
+}
+
+static void
+recover_size_and_print(long long val, const char *end)
+{
+ if (val >= ONE_KB && (val % ONE_KB) == 0) {
+ if (val >= ONE_MB && (val % ONE_MB) == 0) {
+ if (val >= ONE_GB && (val % ONE_GB) == 0)
+ HDfprintf(output, "%" H5_PRINTF_LL_WIDTH "d""GB%s", val / ONE_GB, end);
+ else
+ HDfprintf(output, "%" H5_PRINTF_LL_WIDTH "d""MB%s", val / ONE_MB, end);
+ } else {
+ HDfprintf(output, "%" H5_PRINTF_LL_WIDTH "d""KB%s", val / ONE_KB, end);
+ }
+ } else {
+ HDfprintf(output, "%" H5_PRINTF_LL_WIDTH "d""%s", val, end);
+ }
+}
+
+static void
+print_io_api(long io_types)
+{
+ if (io_types & PIO_POSIX)
+ HDfprintf(output, "posix ");
+ if (io_types & PIO_MPI)
+ HDfprintf(output, "mpiio ");
+ if (io_types & PIO_HDF5)
+ HDfprintf(output, "phdf5 ");
+ HDfprintf(output, "\n");
+}
+
+static void
+report_parameters(struct options *opts)
+{
+ int rank = comm_world_rank_g;
+
+ print_version("HDF5 Library"); /* print library version */
+ HDfprintf(output, "rank %d: ==== Parameters ====\n", rank);
+
+ HDfprintf(output, "rank %d: IO API=", rank);
+ print_io_api(opts->io_types);
+
+ HDfprintf(output, "rank %d: Number of files=%ld\n", rank,
+ opts->num_files);
+ HDfprintf(output, "rank %d: Number of datasets=%ld\n", rank,
+ opts->num_dsets);
+ HDfprintf(output, "rank %d: Number of iterations=%d\n", rank,
+ opts->num_iters);
+ HDfprintf(output, "rank %d: Number of processes=%d:%d\n", rank,
+ opts->min_num_procs, opts->max_num_procs);
+
+ if (opts->dim2d){
+ HDfprintf(output, "rank %d: Number of bytes per process per dataset=", rank);
+ recover_size_and_print((long long)(opts->num_bpp * opts->num_bpp * opts->min_num_procs), ":");
+ recover_size_and_print((long long)(opts->num_bpp * opts->num_bpp * opts->max_num_procs), "\n");
+
+ HDfprintf(output, "rank %d: Size of dataset(s)=", rank);
+ recover_size_and_print((long long)(opts->num_bpp * opts->min_num_procs), "x");
+ recover_size_and_print((long long)(opts->num_bpp * opts->min_num_procs), ":");
+ recover_size_and_print((long long)(opts->num_bpp * opts->max_num_procs), "x");
+ recover_size_and_print((long long)(opts->num_bpp * opts->max_num_procs), "\n");
+
+ HDfprintf(output, "rank %d: File size=", rank);
+ recover_size_and_print((long long)(pow(opts->num_bpp * opts->min_num_procs,2)
+ * opts->num_dsets), ":");
+ recover_size_and_print((long long)(pow(opts->num_bpp * opts->max_num_procs,2)
+ * opts->num_dsets), "\n");
+
+ HDfprintf(output, "rank %d: Transfer buffer size=", rank);
+ if(opts->interleaved){
+ recover_size_and_print((long long)opts->min_xfer_size, "x");
+ recover_size_and_print((long long)opts->blk_size, ":");
+ recover_size_and_print((long long)opts->max_xfer_size, "x");
+ recover_size_and_print((long long)opts->blk_size, "\n");
+ }
+ else{
+ recover_size_and_print((long long)opts->blk_size, "x");
+ recover_size_and_print((long long)opts->min_xfer_size, ":");
+ recover_size_and_print((long long)opts->blk_size, "x");
+ recover_size_and_print((long long)opts->max_xfer_size, "\n");
+ }
+ HDfprintf(output, "rank %d: Block size=", rank);
+ recover_size_and_print((long long)opts->blk_size, "x");
+ recover_size_and_print((long long)opts->blk_size, "\n");
+ }
+ else{
+ HDfprintf(output, "rank %d: Number of bytes per process per dataset=", rank);
+ recover_size_and_print((long long)opts->num_bpp, "\n");
+
+ HDfprintf(output, "rank %d: Size of dataset(s)=", rank);
+ recover_size_and_print((long long)(opts->num_bpp * opts->min_num_procs), ":");
+ recover_size_and_print((long long)(opts->num_bpp * opts->max_num_procs), "\n");
+
+ HDfprintf(output, "rank %d: File size=", rank);
+ recover_size_and_print((long long)(opts->num_bpp * opts->min_num_procs
+ * opts->num_dsets), ":");
+ recover_size_and_print((long long)(opts->num_bpp * opts->max_num_procs
+ * opts->num_dsets), "\n");
+
+ HDfprintf(output, "rank %d: Transfer buffer size=", rank);
+ recover_size_and_print((long long)opts->min_xfer_size, ":");
+ recover_size_and_print((long long)opts->max_xfer_size, "\n");
+ HDfprintf(output, "rank %d: Block size=", rank);
+ recover_size_and_print((long long)opts->blk_size, "\n");
+ }
+
+ HDfprintf(output, "rank %d: Block Pattern in Dataset=", rank);
+ if(opts->interleaved)
+ HDfprintf(output, "Interleaved\n");
+ else
+ HDfprintf(output, "Contiguous\n");
+
+ HDfprintf(output, "rank %d: I/O Method for MPI and HDF5=", rank);
+ if(opts->collective)
+ HDfprintf(output, "Collective\n");
+ else
+ HDfprintf(output, "Independent\n");
+
+ HDfprintf(output, "rank %d: Geometry=", rank);
+ if(opts->dim2d)
+ HDfprintf(output, "2D\n");
+ else
+ HDfprintf(output, "1D\n");
+
+ HDfprintf(output, "rank %d: VFL used for HDF5 I/O=%s\n", rank, "MPI-IO driver");
+
+ HDfprintf(output, "rank %d: Data storage method in HDF5=", rank);
+ if(opts->h5_use_chunks)
+ HDfprintf(output, "Chunked\n");
+ else
+ HDfprintf(output, "Contiguous\n");
+
+ {
+ char *prefix = getenv("HDF5_PARAPREFIX");
+
+ HDfprintf(output, "rank %d: Env HDF5_PARAPREFIX=%s\n", rank,
+ (prefix ? prefix : "not set"));
+ }
+
+ HDfprintf(output, "rank %d: ", rank);
+ h5_dump_info_object(h5_io_info_g);
+
+ HDfprintf(output, "rank %d: ==== End of Parameters ====\n", rank);
+ HDfprintf(output, "\n");
+}
+
+/*
+ * Function: parse_command_line
+ * Purpose: Parse the command line options and return a STRUCT OPTIONS
+ * structure which will need to be freed by the calling function.
+ * Return: Pointer to an OPTIONS structure
+ * Programmer: Bill Wendling, 31. October 2001
+ * Modifications:
+ * Added 2D testing (Christian Chilan, 10. August 2005)
+ */
+static struct options *
+parse_command_line(int argc, char *argv[])
+{
+ register int opt;
+ struct options *cl_opts;
+
+ cl_opts = (struct options *)malloc(sizeof(struct options));
+
+ cl_opts->output_file = NULL;
+ cl_opts->io_types = 0; /* will set default after parsing options */
+ cl_opts->num_dsets = 1;
+ cl_opts->num_files = 1;
+ cl_opts->num_bpp = 0;
+ cl_opts->num_iters = 1;
+ cl_opts->max_num_procs = comm_world_nprocs_g;
+ cl_opts->min_num_procs = 1;
+ cl_opts->max_xfer_size = 0;
+ cl_opts->min_xfer_size = 0;
+ cl_opts->blk_size = 0;
+ cl_opts->interleaved = 0; /* Default to contiguous blocks in dataset */
+ cl_opts->collective = 0; /* Default to independent I/O access */
+ cl_opts->dim2d = 0; /* Default to 1D */
+ cl_opts->print_times = FALSE; /* Printing times is off by default */
+ cl_opts->print_raw = FALSE; /* Printing raw data throughput is off by default */
+ cl_opts->h5_alignment = 1; /* No alignment for HDF5 objects by default */
+ cl_opts->h5_threshold = 1; /* No threshold for aligning HDF5 objects by default */
+ cl_opts->h5_use_chunks = FALSE; /* Don't chunk the HDF5 dataset by default */
+ cl_opts->h5_write_only = FALSE; /* Do both read and write by default */
+ cl_opts->verify = FALSE; /* No Verify data correctness by default */
+
+ while ((opt = get_option(argc, (const char **)argv, s_opts, l_opts)) != EOF) {
+ switch ((char)opt) {
+ case 'a':
+ cl_opts->h5_alignment = parse_size_directive(opt_arg);
+ break;
+ case 'A':
+ {
+ const char *end = opt_arg;
+
+ while (end && *end != '\0') {
+ char buf[10];
+ int i;
+
+ memset(buf, '\0', sizeof(buf));
+
+ for (i = 0; *end != '\0' && *end != ','; ++end)
+ if (isalnum(*end) && i < 10)
+ buf[i++] = *end;
+
+ if (!HDstrcasecmp(buf, "phdf5")) {
+ cl_opts->io_types |= PIO_HDF5;
+ } else if (!HDstrcasecmp(buf, "mpiio")) {
+ cl_opts->io_types |= PIO_MPI;
+ } else if (!HDstrcasecmp(buf, "posix")) {
+ cl_opts->io_types |= PIO_POSIX;
+ } else {
+ fprintf(stderr, "pio_perf: invalid --api option %s\n",
+ buf);
+ exit(EXIT_FAILURE);
+ }
+
+ if (*end == '\0')
+ break;
+
+ end++;
+ }
+ }
+
+ break;
+#if 0
+ case 'b':
+ /* the future "binary" option */
+ break;
+#endif /* 0 */
+ case 'B':
+ cl_opts->blk_size = parse_size_directive(opt_arg);
+ break;
+ case 'c':
+ /* Turn on chunked HDF5 dataset creation */
+ cl_opts->h5_use_chunks = TRUE;
+ break;
+ case 'C':
+ cl_opts->collective = 1;
+ break;
+ case 'd':
+ cl_opts->num_dsets = atoi(opt_arg);
+ break;
+ case 'D':
+ {
+ const char *end = opt_arg;
+
+ while (end && *end != '\0') {
+ char buf[10];
+ int i;
+
+ memset(buf, '\0', sizeof(buf));
+
+ for (i = 0; *end != '\0' && *end != ','; ++end)
+ if (isalnum(*end) && i < 10)
+ buf[i++] = *end;
+
+ if (strlen(buf) > 1 || isdigit(buf[0])) {
+ size_t j;
+
+ for (j = 0; j < 10 && buf[j] != '\0'; ++j)
+ if (!isdigit(buf[j])) {
+ fprintf(stderr, "pio_perf: invalid --debug option %s\n",
+ buf);
+ exit(EXIT_FAILURE);
+ }
+
+ pio_debug_level = atoi(buf);
+
+ if (pio_debug_level > 4)
+ pio_debug_level = 4;
+ else if (pio_debug_level < 0)
+ pio_debug_level = 0;
+ } else {
+ switch (*buf) {
+ case 'r':
+ /* Turn on raw data throughput info */
+ cl_opts->print_raw = TRUE;
+ break;
+ case 't':
+ /* Turn on time printing */
+ cl_opts->print_times = TRUE;
+ break;
+ case 'v':
+ /* Turn on verify data correctness*/
+ cl_opts->verify = TRUE;
+ break;
+ default:
+ fprintf(stderr, "pio_perf: invalid --debug option %s\n", buf);
+ exit(EXIT_FAILURE);
+ }
+ }
+
+ if (*end == '\0')
+ break;
+
+ end++;
+ }
+ }
+
+ break;
+ case 'e':
+ cl_opts->num_bpp = parse_size_directive(opt_arg);
+ break;
+ case 'F':
+ cl_opts->num_files = atoi(opt_arg);
+ break;
+ case 'g':
+ cl_opts->dim2d = 1;
+ break;
+ case 'i':
+ cl_opts->num_iters = atoi(opt_arg);
+ break;
+ case 'I':
+ cl_opts->interleaved = 1;
+ break;
+ case 'o':
+ cl_opts->output_file = opt_arg;
+ break;
+ case 'p':
+ cl_opts->min_num_procs = atoi(opt_arg);
+ break;
+ case 'P':
+ cl_opts->max_num_procs = atoi(opt_arg);
+ break;
+ case 'T':
+ cl_opts->h5_threshold = parse_size_directive(opt_arg);
+ break;
+ case 'w':
+ cl_opts->h5_write_only = TRUE;
+ break;
+ case 'x':
+ cl_opts->min_xfer_size = parse_size_directive(opt_arg);
+ break;
+ case 'X':
+ cl_opts->max_xfer_size = parse_size_directive(opt_arg);
+ break;
+ case 'h':
+ case '?':
+ default:
+ usage(progname);
+ free(cl_opts);
+ return NULL;
+ }
+ }
+
+
+ if (cl_opts->num_bpp == 0){
+ if (cl_opts->dim2d == 0)
+ cl_opts->num_bpp = 256 * ONE_KB;
+ else
+ cl_opts->num_bpp = 8 * ONE_KB;
+ }
+
+ if (cl_opts->max_xfer_size == 0)
+ cl_opts->max_xfer_size = cl_opts->num_bpp;
+
+ if (cl_opts->min_xfer_size == 0)
+ cl_opts->min_xfer_size = (cl_opts->num_bpp)/2;
+
+ if (cl_opts->blk_size == 0)
+ cl_opts->blk_size = (cl_opts->num_bpp)/2;
+
+
+ /* set default if none specified yet */
+ if (!cl_opts->io_types)
+ cl_opts->io_types = PIO_HDF5 | PIO_MPI | PIO_POSIX; /* run all API */
+
+ /* verify parameters sanity. Adjust if needed. */
+ /* cap xfer_size with bytes per process */
+ if (!cl_opts->dim2d) {
+ if (cl_opts->min_xfer_size > cl_opts->num_bpp)
+ cl_opts->min_xfer_size = cl_opts->num_bpp;
+ if (cl_opts->max_xfer_size > cl_opts->num_bpp)
+ cl_opts->max_xfer_size = cl_opts->num_bpp;
+ }
+ if (cl_opts->min_xfer_size > cl_opts->max_xfer_size)
+ cl_opts->min_xfer_size = cl_opts->max_xfer_size;
+ if (cl_opts->blk_size > cl_opts->num_bpp )
+ cl_opts->blk_size = cl_opts->num_bpp;
+ /* check range of number of processes */
+ if (cl_opts->min_num_procs <= 0)
+ cl_opts->min_num_procs = 1;
+ if (cl_opts->max_num_procs <= 0)
+ cl_opts->max_num_procs = 1;
+ if (cl_opts->min_num_procs > cl_opts->max_num_procs)
+ cl_opts->min_num_procs = cl_opts->max_num_procs;
+ /* check iteration */
+ if (cl_opts->num_iters <= 0)
+ cl_opts->num_iters = 1;
+
+ return cl_opts;
+}
+
+/*
+ * Function: parse_size_directive
+ * Purpose: Parse the size directive passed on the commandline. The size
+ * directive is an integer followed by a size indicator:
+ *
+ * K, k - Kilobyte
+ * M, m - Megabyte
+ * G, g - Gigabyte
+ *
+ * Return: The size as a off_t because this is related to file size.
+ * If an unknown size indicator is used, then the program will
+ * exit with EXIT_FAILURE as the return value.
+ * Programmer: Bill Wendling, 18. December 2001
+ * Modifications:
+ */
+static off_t
+parse_size_directive(const char *size)
+{
+ off_t s;
+ char *endptr;
+
+ s = strtol(size, &endptr, 10);
+
+ if (endptr && *endptr) {
+ while (*endptr != '\0' && (*endptr == ' ' || *endptr == '\t'))
+ ++endptr;
+
+ switch (*endptr) {
+ case 'K':
+ case 'k':
+ s *= ONE_KB;
+ break;
+ case 'M':
+ case 'm':
+ s *= ONE_MB;
+ break;
+ case 'G':
+ case 'g':
+ s *= ONE_GB;
+ break;
+ default:
+ fprintf(stderr, "Illegal size specifier '%c'\n", *endptr);
+ exit(EXIT_FAILURE);
+ }
+ }
+
+ return s;
+}
+
+/*
+ * Function: usage
+ * Purpose: Print a usage message and then exit.
+ * Return: Nothing
+ * Programmer: Bill Wendling, 31. October 2001
+ * Modifications:
+ * Added 2D testing (Christian Chilan, 10. August 2005)
+ */
+static void
+usage(const char *prog)
+{
+ int myrank;
+
+ MPI_Comm_rank(pio_comm_g, &myrank);
+
+ if (myrank == 0) {
+ print_version(prog);
+ printf("usage: %s [OPTIONS]\n", prog);
+ printf(" OPTIONS\n");
+ printf(" -h, --help Print a usage message and exit\n");
+ printf(" -a S, --align=S Alignment of objects in HDF5 file [default: 1]\n");
+ printf(" -A AL, --api=AL Which APIs to test [default: all of them]\n");
+#if 0
+ printf(" -b, --binary The elusive binary option\n");
+#endif /* 0 */
+ printf(" -B S, --block-size=S Block size within transfer buffer\n");
+ printf(" (see below for description)\n");
+ printf(" [default: half the number of bytes per process\n");
+ printf(" per dataset]\n");
+ printf(" -c, --chunk Create HDF5 datasets using chunked storage\n");
+ printf(" [default: contiguous storage]\n");
+ printf(" -C, --collective Use collective I/O for MPI and HDF5 APIs\n");
+ printf(" [default: independent I/O)\n");
+ printf(" -d N, --num-dsets=N Number of datasets per file [default: 1]\n");
+ printf(" -D DL, --debug=DL Indicate the debugging level\n");
+ printf(" [default: no debugging]\n");
+ printf(" -e S, --num-bytes=S Number of bytes per process per dataset\n");
+ printf(" (see below for description)\n");
+ printf(" [default: 256K for 1D, 8K for 2D]\n");
+ printf(" -F N, --num-files=N Number of files [default: 1]\n");
+ printf(" -g, --geometry Use 2D geometry [default: 1D geometry]\n");
+ printf(" -i N, --num-iterations=N Number of iterations to perform [default: 1]\n");
+ printf(" -I, --interleaved Interleaved access pattern\n");
+ printf(" (see below for example)\n");
+ printf(" [default: Contiguous access pattern]\n");
+ printf(" -o F, --output=F Output raw data into file F [default: none]\n");
+ printf(" -p N, --min-num-processes=N Minimum number of processes to use [default: 1]\n");
+ printf(" -P N, --max-num-processes=N Maximum number of processes to use\n");
+ printf(" [default: all MPI_COMM_WORLD processes ]\n");
+ printf(" -T S, --threshold=S Threshold for alignment of objects in HDF5 file\n");
+ printf(" [default: 1]\n");
+ printf(" -w, --write-only Perform write tests not the read tests\n");
+ printf(" -x S, --min-xfer-size=S Minimum transfer buffer size\n");
+ printf(" (see below for description)\n");
+ printf(" [default: half the number of bytes per process\n");
+ printf(" per dataset]\n");
+ printf(" -X S, --max-xfer-size=S Maximum transfer buffer size\n");
+ printf(" [default: the number of bytes per process per\n");
+ printf(" dataset]\n");
+ printf("\n");
+ printf(" F - is a filename.\n");
+ printf(" N - is an integer >=0.\n");
+ printf(" S - is a size specifier, an integer >=0 followed by a size indicator:\n");
+ printf(" K - Kilobyte (%d)\n", ONE_KB);
+ printf(" M - Megabyte (%d)\n", ONE_MB);
+ printf(" G - Gigabyte (%d)\n", ONE_GB);
+ printf("\n");
+ printf(" Example: '37M' is 37 megabytes or %d bytes\n", 37*ONE_MB);
+ printf("\n");
+ printf(" AL - is an API list. Valid values are:\n");
+ printf(" phdf5 - Parallel HDF5\n");
+ printf(" mpiio - MPI-I/O\n");
+ printf(" posix - POSIX\n");
+ printf("\n");
+ printf(" Example: --api=mpiio,phdf5\n");
+ printf("\n");
+ printf(" Dataset size:\n");
+ printf(" Depending on the selected geometry, each test dataset is either a linear\n");
+ printf(" array of size bytes-per-process * num-processes, or a square array of size\n");
+ printf(" (bytes-per-process * num-processes) x (bytes-per-process * num-processes).\n");
+ printf("\n");
+ printf(" Block size vs. Transfer buffer size:\n");
+ printf(" buffer-size controls the size of the memory buffer, which is broken into\n");
+ printf(" blocks and written to the file. Depending on the selected geometry, each\n");
+ printf(" block can be a linear array of size block-size or a square array of size\n");
+ printf(" block-size x block-size. The arrangement in which blocks are written is\n");
+ printf(" determined by the access pattern.\n");
+ printf("\n");
+ printf(" In 1D geometry, the transfer buffer is a linear array of size buffer-size.\n");
+ printf(" In 2D geometry, it is a rectangular array of size block-size x buffer-size\n");
+ printf(" or buffer-size x block-size if interleaved pattern is selected.\n");
+ printf("\n");
+ printf(" Interleaved and Contiguous patterns in 1D geometry:\n");
+ printf(" When contiguous access pattern is chosen, the dataset is evenly divided\n");
+ printf(" into num-processes regions and each process writes data to its own region.\n");
+ printf(" When interleaved blocks are written to a dataset, space for the first\n");
+ printf(" block of the first process is allocated in the dataset, then space is\n");
+ printf(" allocated for the first block of the second process, etc. until space is\n");
+ printf(" allocated for the first block of each process, then space is allocated for\n");
+ printf(" the second block of the first process, the second block of the second\n");
+ printf(" process, etc.\n");
+ printf("\n");
+ printf(" For example, with a 3 process run, 512KB bytes-per-process, 256KB transfer\n");
+ printf(" buffer size, and 64KB block size, each process must issue 2 transfer\n");
+ printf(" requests to complete access to the dataset.\n");
+ printf(" Contiguous blocks of the first transfer request are written like so:\n");
+ printf(" 1111----2222----3333----\n");
+ printf(" Interleaved blocks of the first transfer request are written like so:\n");
+ printf(" 123123123123------------\n");
+ printf(" The actual number of I/O operations involved in a transfer request\n");
+ printf(" depends on the access pattern and communication mode.\n");
+ printf(" When using independent I/O with interleaved pattern, each process\n");
+ printf(" performs 4 small non-contiguous I/O operations per transfer request.\n");
+ printf(" If collective I/O is turned on, the combined content of the buffers of\n");
+ printf(" the 3 processes will be written using one collective I/O operation\n");
+ printf(" per transfer request.\n");
+ printf("\n");
+ printf(" For information about access patterns in 2D geometry, please refer to the\n");
+ printf(" HDF5 Reference Manual.\n");
+ printf("\n");
+ printf(" DL - is a list of debugging flags. Valid values are:\n");
+ printf(" 1 - Minimal\n");
+ printf(" 2 - Not quite everything\n");
+ printf(" 3 - Everything\n");
+ printf(" 4 - The kitchen sink\n");
+ printf(" r - Raw data I/O throughput information\n");
+ printf(" t - Times as well as throughputs\n");
+ printf(" v - Verify data correctness\n");
+ printf("\n");
+ printf(" Example: --debug=2,r,t\n");
+ printf("\n");
+ printf(" Environment variables:\n");
+ printf(" HDF5_NOCLEANUP Do not remove data files if set [default remove]\n");
+ printf(" HDF5_MPI_INFO MPI INFO object key=value separated by ;\n");
+ printf(" HDF5_PARAPREFIX Paralllel data files prefix\n");
+ fflush(stdout);
+ } /* end if */
+} /* end usage() */
+
+#else /* H5_HAVE_PARALLEL */
+
+/*
+ * Function: main
+ * Purpose: Dummy main() function for if HDF5 was configured without
+ * parallel stuff.
+ * Return: EXIT_SUCCESS
+ * Programmer: Bill Wendling, 14. November 2001
+ */
+int
+main(void)
+{
+ printf("No parallel IO performance because parallel is not configured\n");
+ return EXIT_SUCCESS;
+} /* end main */
+
+#endif /* !H5_HAVE_PARALLEL */
diff --git a/tools/test/perform/pio_perf.h b/tools/test/perform/pio_perf.h
new file mode 100644
index 0000000..0fff7a3
--- /dev/null
+++ b/tools/test/perform/pio_perf.h
@@ -0,0 +1,105 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifndef PIO_PERF_H__
+#define PIO_PERF_H__
+
+#ifndef STANDALONE
+#include "H5private.h"
+#include "h5test.h"
+#include "h5tools.h"
+#include "h5tools_utils.h"
+#else
+#include "pio_standalone.h"
+#endif
+#include "io_timer.h"
+
+/* setup the dataset no fill option if this is v1.5 or more */
+#if H5_VERS_MAJOR > 1 || H5_VERS_MINOR > 4
+#define H5_HAVE_NOFILL 1
+#endif
+
+typedef enum iotype_ {
+ POSIXIO,
+ MPIO,
+ PHDF5
+ /*NUM_TYPES*/
+} iotype;
+
+typedef struct parameters_ {
+ iotype io_type; /* The type of IO test to perform */
+ int num_procs; /* Maximum number of processes to use */
+ long num_files; /* Number of files to create */
+ long num_dsets; /* Number of datasets to create */
+ off_t num_bytes; /* Number of bytes in each dset */
+ int num_iters; /* Number of times to loop doing the IO */
+ size_t buf_size; /* Buffer size */
+ size_t blk_size; /* Block size */
+ unsigned interleaved; /* Interleaved vs. contiguous blocks */
+ unsigned collective; /* Collective vs. independent I/O */
+ unsigned dim2d; /* 1D vs. 2D */
+ hsize_t h5_align; /* HDF5 object alignment */
+ hsize_t h5_thresh; /* HDF5 object alignment threshold */
+ int h5_use_chunks; /* Make HDF5 dataset chunked */
+ int h5_write_only; /* Perform the write tests only */
+ int verify; /* Verify data correctness */
+} parameters;
+
+typedef struct results_ {
+ herr_t ret_code;
+ io_time_t *timers;
+} results;
+
+#ifndef SUCCESS
+#define SUCCESS 0
+#endif /* !SUCCESS */
+
+#ifndef FAIL
+#define FAIL -1
+#endif /* !FAIL */
+
+extern FILE *output; /* output file */
+extern io_time_t *timer_g; /* timer: global for stub functions */
+extern int comm_world_rank_g; /* my rank in MPI_COMM_RANK */
+extern int comm_world_nprocs_g;/* num. of processes of MPI_COMM_WORLD */
+extern MPI_Comm pio_comm_g; /* Communicator to run the PIO */
+extern int pio_mpi_rank_g; /* MPI rank of pio_comm_g */
+extern int pio_mpi_nprocs_g; /* number of processes of pio_comm_g */
+extern int pio_debug_level; /* The debug level:
+ * 0 - Off
+ * 1 - Minimal
+ * 2 - Some more
+ * 3 - Maximal
+ * 4 - Even More Debugging (timer stuff)
+ */
+
+#define HDprint_rank(f) /* print rank in MPI_COMM_WORLD */ \
+ HDfprintf(f, "%d: ", comm_world_rank_g);
+#define HDprint_size(f) /* print size of MPI_COMM_WORLD */ \
+ HDfprintf(f, "%d", comm_world_nprocs_g);
+#define HDprint_rank_size(f) /* print rank/size of MPI_COMM_WORLD */ \
+ HDfprintf(f, "%d/%d: ", comm_world_rank_g, comm_world_nprocs_g);
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+extern results do_pio(parameters param);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* PIO_PERF_H__ */
diff --git a/tools/test/perform/pio_standalone.c b/tools/test/perform/pio_standalone.c
new file mode 100644
index 0000000..e404274
--- /dev/null
+++ b/tools/test/perform/pio_standalone.c
@@ -0,0 +1,282 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+
+/* This file contains the definition of functions required to build h5perf in
+ * STANDALONE mode.
+ * Created: Christian Chilan, 2005/5/18.
+ */
+
+#include "pio_perf.h"
+
+
+/** From h5tools_utils.c **/
+
+/* global variables */
+int nCols = 80;
+
+/* ``get_option'' variables */
+int opt_err = 1; /*get_option prints errors if this is on */
+int opt_ind = 1; /*token pointer */
+const char *opt_arg; /*flag argument (or value) */
+
+
+int
+get_option(int argc, const char **argv, const char *opts, const struct long_options *l_opts)
+{
+ static int sp = 1; /* character index in current token */
+ int opt_opt = '?'; /* option character passed back to user */
+
+ if (sp == 1) {
+ /* check for more flag-like tokens */
+ if (opt_ind >= argc || argv[opt_ind][0] != '-' || argv[opt_ind][1] == '\0') {
+ return EOF;
+ } else if (HDstrcmp(argv[opt_ind], "--") == 0) {
+ opt_ind++;
+ return EOF;
+ }
+ }
+
+ if (sp == 1 && argv[opt_ind][0] == '-' && argv[opt_ind][1] == '-') {
+ /* long command line option */
+ const char *arg = &argv[opt_ind][2];
+ int i;
+
+ for (i = 0; l_opts && l_opts[i].name; i++) {
+ size_t len = HDstrlen(l_opts[i].name);
+
+ if (HDstrncmp(arg, l_opts[i].name, len) == 0) {
+ /* we've found a matching long command line flag */
+ opt_opt = l_opts[i].shortval;
+
+ if (l_opts[i].has_arg != no_arg) {
+ if (arg[len] == '=') {
+ opt_arg = &arg[len + 1];
+ } else if (opt_ind < (argc - 1) && argv[opt_ind + 1][0] != '-') {
+ opt_arg = argv[++opt_ind];
+ } else if (l_opts[i].has_arg == require_arg) {
+ if (opt_err)
+ HDfprintf(stderr,
+ "%s: option required for \"--%s\" flag\n",
+ argv[0], arg);
+
+ opt_opt = '?';
+ }
+ } else {
+ if (arg[len] == '=') {
+ if (opt_err)
+ HDfprintf(stderr,
+ "%s: no option required for \"%s\" flag\n",
+ argv[0], arg);
+
+ opt_opt = '?';
+ }
+
+ opt_arg = NULL;
+ }
+
+ break;
+ }
+ }
+
+ if (l_opts[i].name == NULL) {
+ /* exhausted all of the l_opts we have and still didn't match */
+ if (opt_err)
+ HDfprintf(stderr, "%s: unknown option \"%s\"\n", argv[0], arg);
+
+ opt_opt = '?';
+ }
+
+ opt_ind++;
+ sp = 1;
+ } else {
+ register char *cp; /* pointer into current token */
+
+ /* short command line option */
+ opt_opt = argv[opt_ind][sp];
+
+ if (opt_opt == ':' || (cp = strchr(opts, opt_opt)) == 0) {
+
+ if (opt_err)
+ HDfprintf(stderr, "%s: unknown option \"%c\"\n",
+ argv[0], opt_opt);
+
+ /* if no chars left in this token, move to next token */
+ if (argv[opt_ind][++sp] == '\0') {
+ opt_ind++;
+ sp = 1;
+ }
+
+ return '?';
+ }
+
+ if (*++cp == ':') {
+ /* if a value is expected, get it */
+ if (argv[opt_ind][sp + 1] != '\0') {
+ /* flag value is rest of current token */
+ opt_arg = &argv[opt_ind++][sp + 1];
+ } else if (++opt_ind >= argc) {
+ if (opt_err)
+ HDfprintf(stderr,
+ "%s: value expected for option \"%c\"\n",
+ argv[0], opt_opt);
+
+ opt_opt = '?';
+ } else {
+ /* flag value is next token */
+ opt_arg = argv[opt_ind++];
+ }
+
+ sp = 1;
+ } else {
+ /* set up to look at next char in token, next time */
+ if (argv[opt_ind][++sp] == '\0') {
+ /* no more in current token, so setup next token */
+ opt_ind++;
+ sp = 1;
+ }
+
+ opt_arg = NULL;
+ }
+ }
+
+ /* return the current flag character found */
+ return opt_opt;
+}
+
+
+void
+print_version(const char *progname)
+{
+ printf("%s: Version %u.%u.%u%s%s\n",
+ progname, H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE,
+ H5_VERS_SUBRELEASE[0] ? "-" : "", H5_VERS_SUBRELEASE);
+}
+
+
+
+/** From h5test.c **/
+
+#ifdef H5_HAVE_PARALLEL
+MPI_Info h5_io_info_g=MPI_INFO_NULL;/* MPI INFO object for IO */
+#endif
+
+int
+h5_set_info_object(void)
+{
+ char *envp; /* environment pointer */
+ int ret_value=0;
+
+ /* handle any MPI INFO hints via $HDF5_MPI_INFO */
+ if ((envp = getenv("HDF5_MPI_INFO")) != NULL){
+ char *next, *valp;
+
+
+ valp = envp = next = HDstrdup(envp);
+
+ /* create an INFO object if not created yet */
+ if (h5_io_info_g == MPI_INFO_NULL)
+ MPI_Info_create(&h5_io_info_g);
+
+ do {
+ size_t len;
+ char *key_val, *endp, *namep;
+
+ if (*valp == ';')
+ valp++;
+
+ /* copy key/value pair into temporary buffer */
+ len = strcspn(valp, ";");
+ next = &valp[len];
+ key_val = calloc(1, len + 1);
+
+ /* increment the next pointer past the terminating semicolon */
+ if (*next == ';')
+ ++next;
+
+ namep = HDstrncpy(key_val, valp, len);
+
+ /* pass up any beginning whitespaces */
+ while (*namep && (*namep == ' ' || *namep == '\t'))
+ namep++;
+
+ /* eat up any ending white spaces */
+ endp = &namep[strlen(namep) - 1];
+
+ while (endp && (*endp == ' ' || *endp == '\t'))
+ *endp-- = '\0';
+
+ /* find the '=' */
+
+ valp = HDstrchr(namep, '=');
+
+ if (valp != NULL) { /* it's a valid key/value pairing */
+ char *tmp_val = valp + 1;
+
+ /* change '=' to \0, move valp down one */
+ *valp-- = '\0';
+
+ /* eat up ending whitespace on the "key" part */
+ while (*valp == ' ' || *valp == '\t')
+ *valp-- = '\0';
+
+ valp = tmp_val;
+
+ /* eat up beginning whitespace on the "value" part */
+ while (*valp == ' ' || *valp == '\t')
+ *valp++ = '\0';
+
+ /* actually set the darned thing */
+ if (MPI_SUCCESS != MPI_Info_set(h5_io_info_g, namep, valp)) {
+ printf("MPI_Info_set failed\n");
+ ret_value = -1;
+ }
+ }
+
+ valp = next;
+ HDfree(key_val);
+ } while (next && *next);
+
+ HDfree(envp);
+ }
+
+ return ret_value;
+}
+
+
+void
+h5_dump_info_object(MPI_Info info)
+{
+ char key[MPI_MAX_INFO_KEY+1];
+ char value[MPI_MAX_INFO_VAL+1];
+ int flag;
+ int i, nkeys;
+
+ printf("Dumping MPI Info Object(%d) (up to %d bytes per item):\n", (int)info,
+ MPI_MAX_INFO_VAL);
+ if (info==MPI_INFO_NULL){
+ printf("object is MPI_INFO_NULL\n");
+ }
+ else {
+ MPI_Info_get_nkeys(info, &nkeys);
+ printf("object has %d items\n", nkeys);
+ for (i=0; i<nkeys; i++){
+ MPI_Info_get_nthkey(info, i, key);
+ MPI_Info_get(info, key, MPI_MAX_INFO_VAL, value, &flag);
+ printf("%s=%s\n", key, value);
+ }
+
+ }
+}
diff --git a/tools/test/perform/pio_standalone.h b/tools/test/perform/pio_standalone.h
new file mode 100644
index 0000000..762a564
--- /dev/null
+++ b/tools/test/perform/pio_standalone.h
@@ -0,0 +1,157 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifndef PIO_STANDALONE_H__
+#define PIO_PERF_H__
+
+/* Header file for building h5perf by standalone mode.
+ * Created: Christian Chilan, 2005/5/18.
+ */
+
+/** From H5private.h **/
+
+#include "H5public.h" /* Include Public Definitions */
+
+
+/*
+ * Include ANSI-C header files.
+ */
+#ifdef H5_STDC_HEADERS
+# include <assert.h>
+# include <ctype.h>
+# include <errno.h>
+# include <fcntl.h>
+# include <float.h>
+# include <limits.h>
+# include <math.h>
+# include <signal.h>
+# include <stdarg.h>
+# include <stdio.h>
+# include <stdlib.h>
+# include <string.h>
+#endif
+
+/*
+ * And now for a couple non-Posix functions... Watch out for systems that
+ * define these in terms of macros.
+ */
+#ifdef H5_HAVE_WIN32_API
+#define HDstrdup(S) _strdup(S)
+#else /* H5_HAVE_WIN32_API */
+
+#if !defined strdup && !defined H5_HAVE_STRDUP
+extern char *strdup(const char *s);
+#endif
+
+#define HDstrdup(S) strdup(S)
+
+#endif /* H5_HAVE_WIN32_API */
+
+H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...);
+#define HDstrcmp(S,T) strcmp(S,T)
+#define HDstrlen(S) strlen(S)
+#define HDstrncmp(S,T,L) strncmp(S,T,L)
+#define HDstrncpy(X,Y,Z) strncpy(X,Y,Z)
+#define HDstrchr(S,C) strchr(S,C)
+#define HDfree(M) free(M)
+
+
+#ifdef _O_BINARY
+#define HDopen(S,F,M) open(S,F|_O_BINARY,M)
+#else
+#define HDopen(S,F,M) open(S,F,M)
+#endif
+#define HDclose(F) close(F)
+
+#ifdef H5_HAVE_WIN32_API
+#define HDlseek(F,O,W) _lseeki64(F,O,W)
+#else
+#define HDlseek(F,O,W) lseek(F,O,W)
+#endif
+
+#define HDwrite(F,M,Z) write(F,M,Z)
+
+#define HDread(F,M,Z) read(F,M,Z)
+
+#ifdef H5_HAVE_WIN32_API
+ #define HDstat(S,B) _stati64(S,B)
+#else
+#define HDstat(S,B) stat(S,B)
+#endif
+
+#ifdef H5_HAVE_WIN32_API
+#define HDfstat(F,B) _fstati64(F,B)
+typedef struct _stati64 h5_stat_t;
+typedef __int64 h5_stat_size_t;
+#else
+#define HDfstat(F,B) fstat(F,B)
+typedef struct stat h5_stat_t;
+typedef off_t h5_stat_size_t;
+#endif
+
+/*
+ * HDF Boolean type.
+ */
+#ifndef FALSE
+# define FALSE false
+#endif
+#ifndef TRUE
+# define TRUE true
+#endif
+
+
+/** From h5test.h **/
+
+#ifdef H5_HAVE_PARALLEL
+extern MPI_Info h5_io_info_g; /* MPI INFO object for IO */
+#endif
+
+#ifdef H5_HAVE_PARALLEL
+H5TEST_DLL int h5_set_info_object(void);
+H5TEST_DLL void h5_dump_info_object(MPI_Info info);
+#endif
+
+
+
+/** From h5tools_utils.h **/
+
+extern int opt_err; /* getoption prints errors if this is on */
+extern int opt_ind; /* token pointer */
+extern const char *opt_arg; /* flag argument (or value) */
+
+
+enum {
+ no_arg = 0, /* doesn't take an argument */
+ require_arg, /* requires an argument */
+ optional_arg /* argument is optional */
+};
+
+
+typedef struct long_options {
+ const char *name; /* name of the long option */
+ int has_arg; /* whether we should look for an arg */
+ char shortval; /* the shortname equivalent of long arg
+ * this gets returned from get_option */
+} long_options;
+
+extern int get_option(int argc, const char **argv, const char *opt,
+ const struct long_options *l_opt);
+
+extern int nCols; /*max number of columns for outputting */
+
+/* Definitions of useful routines */
+extern void print_version(const char *progname);
+
+#endif
diff --git a/tools/test/perform/sio_engine.c b/tools/test/perform/sio_engine.c
new file mode 100644
index 0000000..abf1fa6
--- /dev/null
+++ b/tools/test/perform/sio_engine.c
@@ -0,0 +1,1313 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Author: Christian Chilan, April 2008
+ */
+
+#include "hdf5.h"
+
+#ifdef H5_STDC_HEADERS
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#endif
+
+#ifdef H5_HAVE_UNISTD_H
+#include <sys/types.h>
+#include <unistd.h>
+#endif
+
+#ifdef H5_HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+
+#include "sio_perf.h"
+
+/* Macro definitions */
+
+/* sizes of various items. these sizes won't change during program execution */
+#define ELMT_H5_TYPE H5T_NATIVE_UCHAR
+
+#define GOTOERROR(errcode) { ret_code = errcode; goto done; }
+#define ERRMSG(mesg) { \
+ fprintf(stderr, "*** Assertion failed (%s) at line %4d in %s\n", \
+ mesg, (int)__LINE__, __FILE__); \
+}
+
+/* verify: if val is false (0), print mesg. */
+#define VRFY(val, mesg) do { \
+ if (!val) { \
+ ERRMSG(mesg); \
+ GOTOERROR(FAIL); \
+ } \
+} while(0)
+
+/* POSIX I/O macros */
+#define POSIXCREATE(fn) HDopen(fn, O_CREAT|O_TRUNC|O_RDWR, 0600)
+#define POSIXOPEN(fn, F) HDopen(fn, F, 0600)
+#define POSIXCLOSE(F) HDclose(F)
+#define POSIXSEEK(F,L) HDlseek(F, L, SEEK_SET)
+#define POSIXWRITE(F,B,S) HDwrite(F,B,S)
+#define POSIXREAD(F,B,S) HDread(F,B,S)
+
+enum {
+ SIO_CREATE = 1,
+ SIO_WRITE = 2,
+ SIO_READ = 4
+};
+
+/* Global variables */
+static int clean_file_g = -1; /*whether to cleanup temporary test */
+/*files. -1 is not defined; */
+/*0 is no cleanup; 1 is do cleanup */
+
+/* the different types of file descriptors we can expect */
+typedef union _file_descr {
+ int posixfd; /* POSIX file handle*/
+ hid_t h5fd; /* HDF5 file */
+} file_descr;
+
+/* local functions */
+static char *sio_create_filename(iotype iot, const char *base_name,
+ char *fullname, size_t size, parameters *param);
+static herr_t do_write(results *res, file_descr *fd, parameters *parms, void *buffer);
+static herr_t do_read(results *res, file_descr *fd, parameters *parms, void *buffer);
+static herr_t dset_write(int local_dim, file_descr *fd, parameters *parms, void *buffer);
+static herr_t posix_buffer_write(int local_dim, file_descr *fd, parameters *parms, void *buffer);
+static herr_t dset_read(int localrank, file_descr *fd, parameters *parms, void *buffer, const char *buffer2);
+static herr_t posix_buffer_read(int local_dim, file_descr *fd, parameters *parms, void *buffer);
+static herr_t do_fopen(parameters *param, char *fname, file_descr *fd /*out*/,
+ int flags);
+hid_t set_vfd(parameters *param);
+static herr_t do_fclose(iotype iot, file_descr *fd);
+static void do_cleanupfile(iotype iot, char *fname);
+
+/* global variables */
+static HDoff_t offset[MAX_DIMS]; /* dataset size in bytes */
+static size_t buf_offset[MAX_DIMS]; /* dataset size in bytes */
+static int order[MAX_DIMS]; /* dimension access order */
+static size_t linear_buf_size; /* linear buffer size */
+static int cont_dim; /* lowest dimension for contiguous POSIX
+ access */
+static size_t cont_size; /* size of contiguous POSIX access */
+static hid_t fapl; /* file access list */
+static unsigned char *buf_p; /* buffer pointer */
+static const char *multi_letters = "msbrglo"; /* string for multi driver */
+
+/* HDF5 global variables */
+static hsize_t h5count[MAX_DIMS]; /*selection count */
+static hssize_t h5offset[MAX_DIMS]; /* Selection offset within dataspace */
+static hid_t h5dset_space_id = -1; /*dataset space ID */
+static hid_t h5mem_space_id = -1; /*memory dataspace ID */
+static hid_t h5ds_id = -1; /*dataset handle */
+static hid_t h5dcpl = -1; /* Dataset creation property list */
+static hid_t h5dxpl = -1; /* Dataset transfer property list */
+
+/*
+ * Function: do_sio
+ * Purpose: SIO Engine where IO are executed.
+ * Return: results
+ * Programmer: Christian Chilan, April, 2008
+ * Modifications:
+ */
+void
+do_sio(parameters param, results *res)
+{
+ char *buffer = NULL; /*data buffer pointer */
+ size_t buf_size[MAX_DIMS]; /* general buffer size in bytes */
+ file_descr fd; /* file handles */
+ iotype iot; /* API type */
+ char base_name[256]; /* test file base name */
+ /* return codes */
+ herr_t ret_code = 0; /*return code */
+
+ char fname[FILENAME_MAX]; /* test file name */
+ int i;
+ /* HDF5 variables */
+ herr_t hrc; /*HDF5 return code */
+
+ /* Sanity check parameters */
+
+ /* IO type */
+ iot = param.io_type;
+
+ switch (iot) {
+ case POSIXIO:
+ fd.posixfd = -1;
+ res->timers = io_time_new(SYS_CLOCK);
+ break;
+ case HDF5:
+ fd.h5fd = -1;
+ res->timers = io_time_new(SYS_CLOCK);
+ break;
+ default:
+ /* unknown request */
+ HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)iot);
+ GOTOERROR(FAIL);
+ }
+
+ linear_buf_size = 1;
+
+ for (i=0; i<param.rank; i++){
+ buf_size[i] = param.buf_size[i];
+ order[i] = param.order[i];
+ linear_buf_size *= buf_size[i];
+ buf_offset[i] = 0;
+ offset[i] = 0;
+
+ /* Validate transfer buffer size */
+ if (param.buf_size[i]<=0) {
+ HDfprintf(stderr,
+ "Transfer buffer size[%d] (%zu) must be > 0\n", i,buf_size[i]);
+ GOTOERROR(FAIL);
+ }
+
+ if ((param.dset_size[i]%param.buf_size[i])!=0) {
+ HDfprintf(stderr,
+ "Dataset size[%d] (%" H5_PRINTF_LL_WIDTH "d) must be a multiple of the "
+ "trasfer buffer size[%d] (%zu)\n",param.rank,
+ (long long)param.dset_size[i], param.rank, param.buf_size[i]);
+ GOTOERROR(FAIL);
+ }
+
+ }
+
+ /* Allocate transfer buffer */
+ if ((buffer = (char *)malloc(linear_buf_size)) == NULL){
+ HDfprintf(stderr, "malloc for transfer buffer size (%zu) failed\n", linear_buf_size);
+ GOTOERROR(FAIL);
+ }
+
+ if (sio_debug_level >= 4)
+
+ /* output all of the times for all iterations */
+ fprintf(output, "Timer details:\n");
+
+ /*
+ * Write performance measurement
+ */
+ /* Open file for write */
+
+ HDstrcpy(base_name, "#sio_tmp");
+ sio_create_filename(iot, base_name, fname, sizeof(fname), &param);
+
+ if (sio_debug_level > 0)
+ HDfprintf(output, "data filename=%s\n",
+ fname);
+
+ set_time(res->timers, HDF5_GROSS_WRITE_FIXED_DIMS, TSTART);
+ hrc = do_fopen(&param, fname, &fd, SIO_CREATE | SIO_WRITE);
+ VRFY((hrc == SUCCESS), "do_fopen failed");
+
+ set_time(res->timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTART);
+ hrc = do_write(res, &fd, &param, buffer);
+ set_time(res->timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTOP);
+ VRFY((hrc == SUCCESS), "do_write failed");
+
+ /* Close file for write */
+ hrc = do_fclose(iot, &fd);
+ set_time(res->timers, HDF5_GROSS_WRITE_FIXED_DIMS, TSTOP);
+ VRFY((hrc == SUCCESS), "do_fclose failed");
+
+ if (!param.h5_write_only) {
+ /*
+ * Read performance measurement
+ */
+
+ /* Open file for read */
+ set_time(res->timers, HDF5_GROSS_READ_FIXED_DIMS, TSTART);
+ hrc = do_fopen(&param, fname, &fd, SIO_READ);
+ VRFY((hrc == SUCCESS), "do_fopen failed");
+
+ set_time(res->timers, HDF5_FINE_READ_FIXED_DIMS, TSTART);
+ hrc = do_read(res, &fd, &param, buffer);
+ set_time(res->timers, HDF5_FINE_READ_FIXED_DIMS, TSTOP);
+ VRFY((hrc == SUCCESS), "do_read failed");
+
+ /* Close file for read */
+ hrc = do_fclose(iot, &fd);
+
+ set_time(res->timers, HDF5_GROSS_READ_FIXED_DIMS, TSTOP);
+ VRFY((hrc == SUCCESS), "do_fclose failed");
+ }
+
+ do_cleanupfile(iot, fname);
+
+done:
+ /* clean up */
+ /* release HDF5 objects */
+
+ /* close any opened files */
+ /* no remove(fname) because that should have happened normally. */
+ switch (iot) {
+ case POSIXIO:
+ if (fd.posixfd != -1)
+ hrc = do_fclose(iot, &fd);
+ break;
+ case HDF5:
+ if (fd.h5fd != -1)
+ hrc = do_fclose(iot, &fd);
+ break;
+ default:
+ /* unknown request */
+ HDassert(0 && "Unknown IO type");
+ break;
+ }
+
+ /* release generic resources */
+ if (buffer)
+ free(buffer);
+
+ res->ret_code = ret_code;
+}
+
+/*
+ * Function: sio_create_filename
+ * Purpose: Create a new filename to write to. Determine the correct
+ * suffix to append to the filename by the type of I/O we're
+ * doing. Also, place in the /tmp/{$USER,$LOGIN} directory if
+ * USER or LOGIN are specified in the environment.
+ * Return: Pointer to filename or NULL
+ * Programmer: Bill Wendling, 21. November 2001
+ * Modifications: Support for file drivers. Christian Chilan, April, 2008
+ */
+ static char *
+sio_create_filename(iotype iot, const char *base_name, char *fullname, size_t size, parameters *param)
+{
+ const char *prefix, *suffix="";
+ char *ptr, last = '\0';
+ size_t i, j;
+ vfdtype vfd;
+ vfd = param->vfd;
+
+ if (!base_name || !fullname || size < 1)
+ return NULL;
+
+ memset(fullname, 0, size);
+
+ switch (iot) {
+ case POSIXIO:
+ suffix = ".posix";
+ break;
+ case HDF5:
+ suffix = ".h5";
+ if (vfd == family)
+ suffix = "%05d.h5";
+ else if (vfd == multi)
+ suffix = NULL;
+ break;
+ default:
+ /* unknown request */
+ HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)iot);
+ HDassert(0 && "Unknown IO type");
+ break;
+ }
+
+ /* First use the environment variable and then try the constant */
+ prefix = HDgetenv("HDF5_PREFIX");
+
+#ifdef HDF5_PREFIX
+ if (!prefix)
+ prefix = HDF5_PREFIX;
+#endif /* HDF5_PREFIX */
+
+ /* Prepend the prefix value to the base name */
+ if (prefix && *prefix) {
+ /* If the prefix specifies the HDF5_PREFIX directory, then
+ * default to using the "/tmp/$USER" or "/tmp/$LOGIN"
+ * directory instead. */
+ register char *user, *login, *subdir;
+
+ user = HDgetenv("USER");
+ login = HDgetenv("LOGIN");
+ subdir = (user ? user : login);
+
+ if (subdir) {
+ for (i = 0; i < size-1 && prefix[i]; i++)
+ fullname[i] = prefix[i];
+
+ fullname[i++] = '/';
+
+ for (j = 0; i < size && subdir[j]; i++, j++)
+ fullname[i] = subdir[j];
+ } else {
+ /* We didn't append the prefix yet */
+ HDstrncpy(fullname, prefix, size);
+ fullname[size - 1] = '\0';
+ }
+
+ if ((HDstrlen(fullname) + HDstrlen(base_name) + 1) < size) {
+ /* Append the base_name with a slash first. Multiple slashes are
+ * handled below. */
+ h5_stat_t buf;
+
+ if (HDstat(fullname, &buf) < 0)
+ /* The directory doesn't exist just yet */
+ if (HDmkdir(fullname, 0755) < 0 && errno != EEXIST) {
+ /* We couldn't make the "/tmp/${USER,LOGIN}" subdirectory.
+ * Default to PREFIX's original prefix value. */
+ HDstrcpy(fullname, prefix);
+ }
+
+ HDstrcat(fullname, "/");
+ HDstrcat(fullname, base_name);
+ } else {
+ /* Buffer is too small */
+ return NULL;
+ }
+ } else if (strlen(base_name) >= size) {
+ /* Buffer is too small */
+ return NULL;
+ } else {
+ HDstrcpy(fullname, base_name);
+ }
+
+ /* Append a suffix */
+ if (suffix) {
+ if (HDstrlen(fullname) + HDstrlen(suffix) >= size)
+ return NULL;
+
+ HDstrcat(fullname, suffix);
+ }
+
+ /* Remove any double slashes in the filename */
+ for (ptr = fullname, i = j = 0; ptr && (i < size); i++, ptr++) {
+ if (*ptr != '/' || last != '/')
+ fullname[j++] = *ptr;
+
+ last = *ptr;
+ }
+
+ return fullname;
+}
+
+/*
+ * Function: do_write
+ * Purpose: Write the required amount of data to the file.
+ * Return: SUCCESS or FAIL
+ * Programmer: Christian Chilan, April, 2008
+ * Modifications:
+ */
+static herr_t
+do_write(results *res, file_descr *fd, parameters *parms, void *buffer)
+{
+ int ret_code = SUCCESS;
+ char dname[64];
+ int i;
+ size_t u;
+ /* HDF5 variables */
+ herr_t hrc; /*HDF5 return code */
+ hsize_t h5dims[MAX_DIMS]; /*dataset dim sizes */
+ hsize_t h5chunk[MAX_DIMS]; /*dataset dim sizes */
+ hsize_t h5block[MAX_DIMS]; /*dataspace selection */
+ hsize_t h5stride[MAX_DIMS]; /*selection stride */
+ hsize_t h5start[MAX_DIMS]; /*selection start */
+ hsize_t h5maxdims[MAX_DIMS];
+ int rank; /*rank of dataset */
+
+ /* Prepare buffer for verifying data */
+/* if (parms->verify)
+ memset(buffer,1,linear_buf_size); */
+
+ buf_p=(unsigned char *)buffer;
+
+ for(u = 0; u < linear_buf_size; u++)
+ buf_p[u] = u % 128;
+
+ rank = parms->rank;
+
+ for(i = 0; i < rank; i++)
+ h5offset[i] = offset[i] = 0;
+
+ /* I/O Access specific setup */
+ switch (parms->io_type) {
+ case POSIXIO:
+
+ /* determine lowest dimension for contiguous POSIX access */
+ cont_dim = rank;
+
+ for (i=rank-1; i>=0; i--) {
+ if (parms->buf_size[i]==parms->dset_size[i])
+ cont_dim = i;
+ else
+ break;
+ }
+
+ /* determine size of the contiguous POSIX access */
+ cont_size = (!cont_dim)? 1 : parms->buf_size[cont_dim-1];
+ for (i=cont_dim; i<rank; i++)
+ cont_size *= parms->buf_size[i];
+
+ break;
+
+ case HDF5: /* HDF5 setup */
+
+ for (i=0; i < rank; i++){
+ h5dims[i] = parms->dset_size[i];
+ h5start[i] = 0;
+ h5stride[i] = 1;
+ h5block[i] = 1;
+ h5count[i] = parms->buf_size[i];
+ h5chunk[i] = parms->chk_size[i];
+ h5maxdims[i] = H5S_UNLIMITED;
+
+ }
+
+ if (parms->h5_use_chunks && parms->h5_extendable) {
+ h5dset_space_id = H5Screate_simple(rank, h5count, h5maxdims);
+ VRFY((h5dset_space_id >= 0), "H5Screate_simple");
+ }
+ else {
+ h5dset_space_id = H5Screate_simple(rank, h5dims, NULL);
+ VRFY((h5dset_space_id >= 0), "H5Screate_simple");
+ }
+
+ hrc = H5Sselect_hyperslab(h5dset_space_id, H5S_SELECT_SET,
+ h5start, h5stride, h5count, h5block);
+ VRFY((hrc >= 0), "H5Sselect_hyperslab");
+
+ /* Create the memory dataspace that corresponds to the xfer buffer */
+ h5mem_space_id = H5Screate_simple(rank, h5count, NULL);
+ VRFY((h5mem_space_id >= 0), "H5Screate_simple");
+
+ /* Create the dataset transfer property list */
+ h5dxpl = H5Pcreate(H5P_DATASET_XFER);
+ if (h5dxpl < 0) {
+ fprintf(stderr, "HDF5 Property List Create failed\n");
+ GOTOERROR(FAIL);
+ }
+
+ break;
+
+ default:
+ HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)parms->io_type);
+ GOTOERROR(FAIL);
+ break;
+ } /* end switch */
+
+
+ /* create dataset */
+ switch (parms->io_type) {
+ case POSIXIO:
+ break;
+
+ case HDF5:
+ h5dcpl = H5Pcreate(H5P_DATASET_CREATE);
+
+ if (h5dcpl < 0) {
+ fprintf(stderr, "HDF5 Property List Create failed\n");
+ GOTOERROR(FAIL);
+ }
+
+ if(parms->h5_use_chunks) {
+ /* Set the chunk size to be the same as the buffer size */
+ hrc = H5Pset_chunk(h5dcpl, rank, h5chunk);
+ if (hrc < 0) {
+ fprintf(stderr, "HDF5 Property List Set failed\n");
+ GOTOERROR(FAIL);
+ } /* end if */
+ } /* end if */
+
+ sprintf(dname, "Dataset_%ld", (unsigned long)parms->num_bytes);
+ h5ds_id = H5Dcreate2(fd->h5fd, dname, ELMT_H5_TYPE,
+ h5dset_space_id, H5P_DEFAULT, h5dcpl, H5P_DEFAULT);
+
+ if (h5ds_id < 0) {
+ HDfprintf(stderr, "HDF5 Dataset Create failed\n");
+ GOTOERROR(FAIL);
+ }
+
+ hrc = H5Pclose(h5dcpl);
+ /* verifying the close of the dcpl */
+ if (hrc < 0) {
+ HDfprintf(stderr, "HDF5 Property List Close failed\n");
+ GOTOERROR(FAIL);
+ }
+ break;
+
+ default:
+ /* unknown request */
+ HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)parms->io_type);
+ GOTOERROR(FAIL);
+ break;
+ }
+
+ /* Start "raw data" write timer */
+ set_time(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, TSTART);
+
+ /* Perform write */
+ hrc = dset_write(rank-1, fd, parms, buffer);
+
+ if (hrc < 0) {
+ fprintf(stderr, "Error in dataset write\n");
+ GOTOERROR(FAIL);
+ }
+
+
+ /* Stop "raw data" write timer */
+ set_time(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, TSTOP);
+
+ /* Calculate write time */
+
+ /* Close dataset. Only HDF5 needs to do an explicit close. */
+ if (parms->io_type == HDF5) {
+ hrc = H5Dclose(h5ds_id);
+
+ if (hrc < 0) {
+ fprintf(stderr, "HDF5 Dataset Close failed\n");
+ GOTOERROR(FAIL);
+ }
+
+ h5ds_id = -1;
+ } /* end if */
+
+done:
+
+ /* release HDF5 objects */
+ if (h5dset_space_id != -1) {
+ hrc = H5Sclose(h5dset_space_id);
+ if (hrc < 0){
+ fprintf(stderr, "HDF5 Dataset Space Close failed\n");
+ ret_code = FAIL;
+ } else {
+ h5dset_space_id = -1;
+ }
+ }
+
+ if (h5mem_space_id != -1) {
+ hrc = H5Sclose(h5mem_space_id);
+ if (hrc < 0) {
+ fprintf(stderr, "HDF5 Memory Space Close failed\n");
+ ret_code = FAIL;
+ } else {
+ h5mem_space_id = -1;
+ }
+ }
+
+ if (h5dxpl != -1) {
+ hrc = H5Pclose(h5dxpl);
+ if (hrc < 0) {
+ fprintf(stderr, "HDF5 Dataset Transfer Property List Close failed\n");
+ ret_code = FAIL;
+ } else {
+ h5dxpl = -1;
+ }
+ }
+
+ return ret_code;
+}
+
+/*
+ * Function: dset_write
+ * Purpose: Write buffer into the dataset.
+ * Return: SUCCESS or FAIL
+ * Programmer: Christian Chilan, April, 2008
+ * Modifications:
+ */
+static herr_t
+dset_write(int local_dim, file_descr *fd, parameters *parms, void *buffer)
+{
+ int cur_dim = order[local_dim]-1;
+ int ret_code = SUCCESS;
+ int k;
+ hsize_t dims[MAX_DIMS], maxdims[MAX_DIMS];
+ hsize_t i;
+ int j;
+ herr_t hrc;
+
+ /* iterates according to the dimensions in order array */
+ for (i=0; i < parms->dset_size[cur_dim]; i += parms->buf_size[cur_dim]){
+
+ h5offset[cur_dim] = (hssize_t)i;
+ offset[cur_dim] = (HDoff_t)i;
+
+ if (local_dim > 0){
+
+ dset_write(local_dim-1, fd, parms, buffer);
+
+ }else{
+
+ switch (parms->io_type) {
+
+ case POSIXIO:
+ /* initialize POSIX offset in the buffer */
+ for(j = 0; j < parms->rank; j++)
+ buf_offset[j] = 0;
+ buf_p = (unsigned char *)buffer;
+ /* write POSIX buffer */
+ posix_buffer_write(0, fd, parms, buffer);
+ break;
+
+ case HDF5:
+ /* if dimensions are extendable, extend them as needed during access */
+ if (parms->h5_use_chunks && parms->h5_extendable) {
+
+ hrc=H5Sget_simple_extent_dims(h5dset_space_id,dims,maxdims);
+ VRFY((hrc >= 0), "H5Sget_simple_extent_dims");
+
+ for (k=0; k < parms->rank; k++){
+
+ HDassert(h5offset[k] >= 0);
+ if (dims[k] <= (hsize_t)h5offset[k]) {
+ dims[k] = dims[k]+h5count[k];
+ hrc=H5Sset_extent_simple(h5dset_space_id,parms->rank,dims,maxdims);
+ VRFY((hrc >= 0), "H5Sset_extent_simple");
+ hrc=H5Dset_extent(h5ds_id,dims);
+ VRFY((hrc >= 0), "H5Dextend");
+ }
+ }
+ }
+ /* applies offset */
+ hrc = H5Soffset_simple(h5dset_space_id, h5offset);
+ VRFY((hrc >= 0), "H5Soffset_simple");
+
+ /* Write the buffer out */
+ hrc=H5Sget_simple_extent_dims(h5dset_space_id,dims,maxdims);
+ hrc = H5Dwrite(h5ds_id, ELMT_H5_TYPE, h5mem_space_id,
+ h5dset_space_id, h5dxpl, buffer);
+ VRFY((hrc >= 0), "H5Dwrite");
+
+ break;
+
+ default:
+ /* unknown request */
+ HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)parms->io_type);
+ HDassert(0 && "Unknown IO type");
+ break;
+ } /* switch (parms->io_type) */
+ }
+ }
+done:
+ return ret_code;
+}
+
+/*
+ * Function: posix_buffer_write
+ * Purpose: Write buffer into the POSIX file considering contiguity.
+ * Return: SUCCESS or FAIL
+ * Programmer: Christian Chilan, April, 2008
+ * Modifications:
+ */
+
+static herr_t
+posix_buffer_write(int local_dim, file_descr *fd, parameters *parms, void *buffer)
+{
+ int ret_code = SUCCESS;
+
+ /* if dimension is not contiguous, call recursively */
+ if (local_dim < parms->rank-1 && local_dim != cont_dim) {
+ size_t u;
+
+ for(u = 0; u < parms->buf_size[local_dim]; u ++) {
+ buf_offset[local_dim] = u;
+ posix_buffer_write(local_dim+1, fd, parms, buffer);
+
+ /* if next dimension is cont_dim, it will fill out the buffer
+ traversing the entire dimension local_dim without the need
+ of performing iteration */
+ if (local_dim+1==cont_dim)
+ break;
+ }
+ /* otherwise, perform contiguous POSIX access */
+ } else {
+ HDoff_t d_offset;
+ HDoff_t linear_dset_offset = 0;
+ int i, j, rc;
+
+ buf_offset[local_dim] = 0;
+
+ /* determine offset in the buffer */
+ for(i = 0; i < parms->rank; i++) {
+ d_offset = 1;
+
+ for(j = i + 1; j < parms->rank; j++)
+ d_offset *= (HDoff_t)parms->dset_size[j];
+
+ linear_dset_offset += (offset[i] + (HDoff_t)buf_offset[i]) * d_offset;
+ }
+
+ /* only care if seek returns error */
+ rc = POSIXSEEK(fd->posixfd, linear_dset_offset) < 0 ? -1 : 0;
+ VRFY((rc==0), "POSIXSEEK");
+ /* check if all bytes are written */
+ rc = ((ssize_t)cont_size ==
+ POSIXWRITE(fd->posixfd, buf_p, cont_size));
+ VRFY((rc != 0), "POSIXWRITE");
+
+ /* Advance location in buffer */
+ buf_p += cont_size;
+
+ }
+
+done:
+ return ret_code;
+}
+
+/*
+ * Function: do_read
+ * Purpose: Read the required amount of data to the file.
+ * Return: SUCCESS or FAIL
+ * Programmer: Christian Chilan, April, 2008
+ * Modifications:
+ */
+static herr_t
+do_read(results *res, file_descr *fd, parameters *parms, void *buffer)
+{
+ char *buffer2 = NULL; /* Buffer for data verification */
+ int ret_code = SUCCESS;
+ char dname[64];
+ int i;
+ size_t u;
+ /* HDF5 variables */
+ herr_t hrc; /*HDF5 return code */
+ hsize_t h5dims[MAX_DIMS]; /*dataset dim sizes */
+ hsize_t h5block[MAX_DIMS]; /*dataspace selection */
+ hsize_t h5stride[MAX_DIMS]; /*selection stride */
+ hsize_t h5start[MAX_DIMS]; /*selection start */
+ int rank;
+
+ /* Allocate data verification buffer */
+ if(NULL == (buffer2 = (char *)malloc(linear_buf_size))) {
+ HDfprintf(stderr, "malloc for data verification buffer size (%Zu) failed\n", linear_buf_size);
+ GOTOERROR(FAIL);
+ } /* end if */
+
+ /* Prepare buffer for verifying data */
+ for(u = 0; u < linear_buf_size; u++)
+ buffer2[u] = (char)(u % 128);
+
+ rank = parms->rank;
+ for(i = 0; i < rank; i++)
+ h5offset[i] = offset[i] = 0;
+
+ /* I/O Access specific setup */
+ switch (parms->io_type) {
+ case POSIXIO:
+ cont_dim = rank;
+
+ for (i=rank-1; i>=0; i--) {
+ if (parms->buf_size[i]==parms->dset_size[i])
+ cont_dim = i;
+ else
+ break;
+ }
+ cont_size = (!cont_dim)? 1 : parms->buf_size[cont_dim-1];
+ for (i=cont_dim; i<rank; i++)
+ cont_size *= parms->buf_size[i];
+
+ break;
+
+ case HDF5: /* HDF5 setup */
+ for (i=0; i < rank; i++){
+ h5dims[i] = parms->dset_size[i];
+ h5start[i] = 0;
+ h5stride[i] = 1;
+ h5block[i] = 1;
+ h5count[i] = parms->buf_size[i];
+ }
+
+ h5dset_space_id = H5Screate_simple(rank, h5dims, NULL);
+ VRFY((h5dset_space_id >= 0), "H5Screate_simple");
+
+ hrc = H5Sselect_hyperslab(h5dset_space_id, H5S_SELECT_SET,
+ h5start, h5stride, h5count, h5block);
+ VRFY((hrc >= 0), "H5Sselect_hyperslab");
+
+ /* Create the memory dataspace that corresponds to the xfer buffer */
+ h5mem_space_id = H5Screate_simple(rank, h5count, NULL);
+ VRFY((h5mem_space_id >= 0), "H5Screate_simple");
+
+ /* Create the dataset transfer property list */
+ h5dxpl = H5Pcreate(H5P_DATASET_XFER);
+ if (h5dxpl < 0) {
+ fprintf(stderr, "HDF5 Property List Create failed\n");
+ GOTOERROR(FAIL);
+ }
+ break;
+
+ default:
+ /* unknown request */
+ HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)parms->io_type);
+ GOTOERROR(FAIL);
+ break;
+ } /* end switch */
+
+
+ /* create dataset */
+ switch (parms->io_type) {
+ case POSIXIO:
+ break;
+
+ case HDF5:
+ sprintf(dname, "Dataset_%ld", (long)parms->num_bytes);
+ h5ds_id = H5Dopen2(fd->h5fd, dname, H5P_DEFAULT);
+ if (h5ds_id < 0) {
+ HDfprintf(stderr, "HDF5 Dataset open failed\n");
+ GOTOERROR(FAIL);
+ }
+ break;
+
+ default:
+ /* unknown request */
+ HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)parms->io_type);
+ GOTOERROR(FAIL);
+ break;
+ } /* end switch */
+
+ /* Start "raw data" read timer */
+ set_time(res->timers, HDF5_RAW_READ_FIXED_DIMS, TSTART);
+ hrc = dset_read(rank-1, fd, parms, buffer, buffer2);
+
+ if (hrc < 0) {
+ fprintf(stderr, "Error in dataset read\n");
+ GOTOERROR(FAIL);
+ }
+
+ /* Stop "raw data" read timer */
+ set_time(res->timers, HDF5_RAW_READ_FIXED_DIMS, TSTOP);
+
+ /* Calculate read time */
+
+ /* Close dataset. Only HDF5 needs to do an explicit close. */
+ if (parms->io_type == HDF5) {
+ hrc = H5Dclose(h5ds_id);
+
+ if (hrc < 0) {
+ fprintf(stderr, "HDF5 Dataset Close failed\n");
+ GOTOERROR(FAIL);
+ }
+
+ h5ds_id = -1;
+ } /* end if */
+
+done:
+
+ /* release HDF5 objects */
+ if (h5dset_space_id != -1) {
+ hrc = H5Sclose(h5dset_space_id);
+ if (hrc < 0){
+ fprintf(stderr, "HDF5 Dataset Space Close failed\n");
+ ret_code = FAIL;
+ } else {
+ h5dset_space_id = -1;
+ }
+ }
+
+ if (h5mem_space_id != -1) {
+ hrc = H5Sclose(h5mem_space_id);
+ if (hrc < 0) {
+ fprintf(stderr, "HDF5 Memory Space Close failed\n");
+ ret_code = FAIL;
+ } else {
+ h5mem_space_id = -1;
+ }
+ }
+
+ if (h5dxpl != -1) {
+ hrc = H5Pclose(h5dxpl);
+ if (hrc < 0) {
+ fprintf(stderr, "HDF5 Dataset Transfer Property List Close failed\n");
+ ret_code = FAIL;
+ } else {
+ h5dxpl = -1;
+ }
+ }
+
+ /* release generic resources */
+ if(buffer2)
+ free(buffer2);
+
+ return ret_code;
+}
+
+/*
+ * Function: dset_read
+ * Purpose: Read buffer into the dataset.
+ * Return: SUCCESS or FAIL
+ * Programmer: Christian Chilan, April, 2008
+ * Modifications:
+ */
+
+static herr_t
+dset_read(int local_dim, file_descr *fd, parameters *parms, void *buffer,
+ const char *buffer2)
+{
+ int cur_dim = order[local_dim]-1;
+ hsize_t i;
+ int j;
+ herr_t hrc;
+ int ret_code = SUCCESS;
+
+ /* iterate on the current dimension */
+ for (i=0; i < parms->dset_size[cur_dim]; i += parms->buf_size[cur_dim]){
+
+ h5offset[cur_dim] = (hssize_t)i;
+ offset[cur_dim] = (HDoff_t)i;
+
+ /* if traverse in order array is incomplete, recurse */
+ if (local_dim > 0){
+
+ ret_code = dset_read(local_dim-1, fd, parms, buffer, buffer2);
+
+ /* otherwise, write buffer into dataset */
+ }else{
+
+ switch (parms->io_type) {
+
+ case POSIXIO:
+ for (j=0; j<parms->rank; j++) {
+ buf_offset[j] = 0;
+ }
+ buf_p = (unsigned char*)buffer;
+ posix_buffer_read(0, fd, parms, buffer);
+ break;
+
+ case HDF5:
+ hrc = H5Soffset_simple(h5dset_space_id, h5offset);
+ VRFY((hrc >= 0), "H5Soffset_simple");
+ /* Read the buffer out */
+ hrc = H5Dread(h5ds_id, ELMT_H5_TYPE, h5mem_space_id,
+ h5dset_space_id, h5dxpl, buffer);
+ VRFY((hrc >= 0), "H5Dread");
+ break;
+
+ default:
+ /* unknown request */
+ HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)parms->io_type);
+ HDassert(0 && "Unknown IO type");
+ break;
+ } /* switch (parms->io_type) */
+ }
+ }
+done:
+ return ret_code;
+}
+
+/*
+ * Function: posix_buffer_read
+ * Purpose: Read buffer into the POSIX file considering contiguity.
+ * Return: SUCCESS or FAIL
+ * Programmer: Christian Chilan, April, 2008
+ * Modifications:
+ */
+
+static herr_t
+posix_buffer_read(int local_dim, file_descr *fd, parameters *parms, void *buffer)
+{
+ int ret_code = SUCCESS;
+
+ /* if local dimension is not contiguous, recurse */
+ if (local_dim < parms->rank-1 && local_dim != cont_dim) {
+ size_t u;
+
+ for(u = 0; u < parms->buf_size[local_dim]; u++) {
+ buf_offset[local_dim] = u;
+ ret_code = posix_buffer_read(local_dim+1, fd, parms, buffer);
+ if (local_dim+1==cont_dim)
+ break;
+ }
+ /* otherwise, perform contiguous POSIX access */
+ } else {
+ HDoff_t d_offset;
+ HDoff_t linear_dset_offset = 0;
+ int i, j, rc;
+
+ buf_offset[local_dim] = 0;
+ /* determine offset in buffer */
+ for (i=0; i<parms->rank; i++){
+ d_offset=1;
+
+ for (j=i+1; j<parms->rank; j++)
+ d_offset *= (HDoff_t)parms->dset_size[j];
+
+ linear_dset_offset += (offset[i] + (HDoff_t)buf_offset[i]) * d_offset;
+ }
+
+ /* only care if seek returns error */
+ rc = POSIXSEEK(fd->posixfd, linear_dset_offset) < 0 ? -1 : 0;
+ VRFY((rc==0), "POSIXSEEK");
+ /* check if all bytes are read */
+ rc = ((ssize_t)cont_size ==
+ POSIXREAD(fd->posixfd, buf_p, cont_size));
+ VRFY((rc != 0), "POSIXREAD");
+
+ /* Advance location in buffer */
+ buf_p += cont_size;
+
+ }
+done:
+ return ret_code;
+}
+
+
+/*
+ * Function: do_fopen
+ * Purpose: Open the specified file.
+ * Return: SUCCESS or FAIL
+ * Programmer: Albert Cheng, Bill Wendling, 2001/12/13
+ * Modifications: Support for file drivers, Christian Chilan, April, 2008
+ */
+ static herr_t
+do_fopen(parameters *param, char *fname, file_descr *fd /*out*/, int flags)
+{
+ int ret_code = SUCCESS;
+
+ switch (param->io_type) {
+ case POSIXIO:
+ if (flags & (SIO_CREATE | SIO_WRITE))
+ fd->posixfd = POSIXCREATE(fname);
+ else
+ fd->posixfd = POSIXOPEN(fname, O_RDONLY);
+
+ if (fd->posixfd < 0 ) {
+ HDfprintf(stderr, "POSIX File Open failed(%s)\n", fname);
+ GOTOERROR(FAIL);
+ }
+
+ break;
+
+ case HDF5:
+
+ fapl = set_vfd(param);
+
+ if (fapl < 0) {
+ fprintf(stderr, "HDF5 Property List Create failed\n");
+ GOTOERROR(FAIL);
+ }
+
+ /* create the parallel file */
+ if (flags & (SIO_CREATE | SIO_WRITE)) {
+ fd->h5fd = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
+ } else {
+ fd->h5fd = H5Fopen(fname, H5F_ACC_RDONLY, fapl);
+ }
+
+
+ if (fd->h5fd < 0) {
+ fprintf(stderr, "HDF5 File Create failed(%s)\n", fname);
+ GOTOERROR(FAIL);
+ }
+ break;
+
+ default:
+ /* unknown request */
+ HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)param->io_type);
+ GOTOERROR(FAIL);
+ break;
+ }
+
+done:
+ return ret_code;
+}
+
+/*
+ * Function: set_vfd
+ * Purpose: Sets file driver.
+ * Return: SUCCESS or FAIL
+ * Programmer: Christian Chilan, April, 2008
+ * Modifications:
+ */
+
+hid_t
+set_vfd(parameters *param)
+{
+ hid_t my_fapl = -1;
+ vfdtype vfd;
+
+ vfd = param->vfd;
+
+ if ((my_fapl=H5Pcreate(H5P_FILE_ACCESS))<0) return -1;
+
+ if (vfd == sec2) {
+ /* Unix read() and write() system calls */
+ if (H5Pset_fapl_sec2(my_fapl)<0) return -1;
+ } else if (vfd == stdio) {
+ /* Standard C fread() and fwrite() system calls */
+ if (H5Pset_fapl_stdio(my_fapl)<0) return -1;
+ } else if (vfd == core) {
+ /* In-core temporary file with 1MB increment */
+ if (H5Pset_fapl_core(my_fapl, (size_t)1024*1024, TRUE)<0) return -1;
+ } else if (vfd == split) {
+ /* Split meta data and raw data each using default driver */
+ if (H5Pset_fapl_split(my_fapl,
+ "-m.h5", H5P_DEFAULT,
+ "-r.h5", H5P_DEFAULT)<0)
+ return -1;
+ } else if (vfd == multi) {
+ /* Multi-file driver, general case of the split driver */
+ H5FD_mem_t memb_map[H5FD_MEM_NTYPES];
+ hid_t memb_fapl[H5FD_MEM_NTYPES];
+ const char *memb_name[H5FD_MEM_NTYPES];
+ char sv[H5FD_MEM_NTYPES][1024];
+ haddr_t memb_addr[H5FD_MEM_NTYPES];
+ H5FD_mem_t mt;
+
+ HDmemset(memb_map, 0, sizeof memb_map);
+ HDmemset(memb_fapl, 0, sizeof memb_fapl);
+ HDmemset(memb_name, 0, sizeof memb_name);
+ HDmemset(memb_addr, 0, sizeof memb_addr);
+
+ HDassert(HDstrlen(multi_letters)==H5FD_MEM_NTYPES);
+ for (mt=H5FD_MEM_DEFAULT; mt<H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,mt)) {
+ memb_fapl[mt] = H5P_DEFAULT;
+ sprintf(sv[mt], "%%s-%c.h5", multi_letters[mt]);
+ memb_name[mt] = sv[mt];
+ memb_addr[mt] = (haddr_t)MAX(mt - 1,0) * (HADDR_MAX / 10);
+ }
+
+ if (H5Pset_fapl_multi(my_fapl, memb_map, memb_fapl, memb_name,
+ memb_addr, FALSE)<0) {
+ return -1;
+ }
+ } else if (vfd == family) {
+ hsize_t fam_size = 1*1024*1024; /*100 MB*/
+
+ /* Family of files, each 1MB and using the default driver */
+ /* if ((val=HDstrtok(NULL, " \t\n\r")))
+ fam_size = (hsize_t)(HDstrtod(val, NULL) * 1024*1024); */
+ if (H5Pset_fapl_family(my_fapl, fam_size, H5P_DEFAULT)<0)
+ return -1;
+ } else if (vfd == direct) {
+#ifdef H5_HAVE_DIRECT
+ /* Linux direct read() and write() system calls. Set memory boundary, file block size,
+ * and copy buffer size to the default values. */
+ if (H5Pset_fapl_direct(my_fapl, 1024, 4096, 8*4096)<0) return -1;
+#endif
+ } else {
+ /* Unknown driver */
+ return -1;
+ }
+
+ return my_fapl;
+}
+
+/*
+ * Function: do_fclose
+ * Purpose: Close the specified file descriptor.
+ * Return: SUCCESS or FAIL
+ * Programmer: Albert Cheng, Bill Wendling, 2001/12/13
+ * Modifications:
+ */
+ static herr_t
+do_fclose(iotype iot, file_descr *fd /*out*/)
+{
+ herr_t ret_code = SUCCESS, hrc;
+ int rc = 0;
+
+ switch (iot) {
+ case POSIXIO:
+ rc = POSIXCLOSE(fd->posixfd);
+
+ if (rc != 0){
+ fprintf(stderr, "POSIX File Close failed\n");
+ GOTOERROR(FAIL);
+ }
+
+ fd->posixfd = -1;
+ break;
+
+ case HDF5:
+ hrc = H5Fclose(fd->h5fd);
+
+ if (hrc < 0) {
+ fprintf(stderr, "HDF5 File Close failed\n");
+ GOTOERROR(FAIL);
+ }
+
+ fd->h5fd = -1;
+ break;
+
+ default:
+ /* unknown request */
+ HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)iot);
+ GOTOERROR(FAIL);
+ break;
+ }
+
+done:
+ return ret_code;
+}
+
+
+/*
+ * Function: do_cleanupfile
+ * Purpose: Cleanup temporary file unless HDF5_NOCLEANUP is set.
+ * Return: void
+ * Programmer: Albert Cheng 2001/12/12
+ * Modifications: Support for file drivers. Christian Chilan, April, 2008
+ */
+ static void
+do_cleanupfile(iotype iot, char *filename)
+{
+ char temp[2048];
+ int j;
+ hid_t driver;
+
+ if (clean_file_g == -1)
+ clean_file_g = (HDgetenv("HDF5_NOCLEANUP")==NULL) ? 1 : 0;
+
+ if (clean_file_g){
+
+ switch (iot) {
+ case POSIXIO:
+ HDremove(filename);
+ break;
+
+ case HDF5:
+ driver = H5Pget_driver(fapl);
+
+ if (driver == H5FD_FAMILY) {
+ for (j = 0; /*void*/; j++) {
+ HDsnprintf(temp, sizeof temp, filename, j);
+
+ if (HDaccess(temp, F_OK) < 0)
+ break;
+
+ HDremove(temp);
+ }
+ } else if (driver == H5FD_CORE) {
+ hbool_t backing; /* Whether the core file has backing store */
+
+ H5Pget_fapl_core(fapl,NULL,&backing);
+
+ /* If the file was stored to disk with bacing store, remove it */
+ if(backing)
+ HDremove(filename);
+
+ } else if (driver == H5FD_MULTI) {
+ H5FD_mem_t mt;
+ assert(HDstrlen(multi_letters)==H5FD_MEM_NTYPES);
+
+ for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,mt)) {
+ HDsnprintf(temp, sizeof temp, "%s-%c.h5",
+ filename, multi_letters[mt]);
+ HDremove(temp); /*don't care if it fails*/
+ }
+ } else {
+ HDremove(filename);
+ }
+ H5Pclose(fapl);
+ break;
+
+ default:
+ /* unknown request */
+ HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)iot);
+ HDassert(0 && "Unknown IO type");
+ break;
+ }
+ }
+}
+
diff --git a/tools/test/perform/sio_perf.c b/tools/test/perform/sio_perf.c
new file mode 100644
index 0000000..aceccb0
--- /dev/null
+++ b/tools/test/perform/sio_perf.c
@@ -0,0 +1,1412 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Serial HDF5 Performance Testing Code
+ * --------------------------------------
+ *
+ * Portable code to test performance on the different platforms we support.
+ * This is what the report should look like:
+ *
+ * nprocs = Max#Procs
+ * IO API = POSIXIO
+ * # Files = 1, # of dsets = 1000, Elements per dset = 37000
+ * Write Results = x MB/s
+ * Read Results = x MB/s
+ * # Files = 1, # of dsets = 3000, Elements per dset = 37000
+ * Write Results = x MB/s
+ * Read Results = x MB/s
+ *
+ * . . .
+ *
+ *
+ * IO API = HDF5
+ * # Files = 1, # of dsets = 1000, Elements per dset = 37000
+ * Write Results = x MB/s
+ * Read Results = x MB/s
+ * # Files = 1, # of dsets = 3000, Elements per dset = 37000
+ * Write Results = x MB/s
+ * Read Results = x MB/s
+ *
+ * . . .
+ *
+ *
+ * . . .
+ *
+ */
+
+/* system header files */
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "hdf5.h"
+
+
+/* our header files */
+#include "sio_perf.h"
+
+/* useful macros */
+#define TAB_SPACE 4
+
+#define ONE_KB 1024
+#define ONE_MB (ONE_KB * ONE_KB)
+#define ONE_GB (ONE_MB * ONE_KB)
+
+#define SIO_POSIX 0x1
+#define SIO_HDF5 0x4
+
+/* report 0.0 in case t is zero too */
+#define MB_PER_SEC(bytes,t) (H5_DBL_ABS_EQUAL(t, (double)0.0F) ? (double)0.0F : ((((double)bytes) / (double)ONE_MB) / (t)))
+
+#ifndef TRUE
+#define TRUE 1
+#endif /* TRUE */
+#ifndef FALSE
+#define FALSE (!TRUE)
+#endif /* FALSE */
+
+/* global variables */
+FILE *output; /* output file */
+int sio_debug_level = 0;/* The debug level:
+ * 0 - Off
+ * 1 - Minimal
+ * 2 - Some more
+ * 3 - Maximal
+ * 4 - Maximal & then some
+ */
+
+/* local variables */
+static const char *progname = "h5perf_serial";
+
+/*
+ * Command-line options: The user can specify short or long-named
+ * parameters. The long-named ones can be partially spelled. When
+ * adding more, make sure that they don't clash with each other.
+ */
+
+/*
+ * It seems that only the options that accept additional information
+ * such as dataset size (-e) require the colon next to it.
+ */
+#if 1
+static const char *s_opts = "a:A:B:c:Cd:D:e:F:ghi:Imno:p:P:r:stT:v:wx:X:";
+#else
+static const char *s_opts = "a:A:bB:c:Cd:D:e:F:ghi:Imno:p:P:r:stT:wx:X:";
+#endif /* 1 */
+static struct long_options l_opts[] = {
+ { "align", require_arg, 'a' },
+ { "alig", require_arg, 'a' },
+ { "ali", require_arg, 'a' },
+ { "al", require_arg, 'a' },
+ { "api", require_arg, 'A' },
+ { "ap", require_arg, 'A' },
+#if 0
+ /* a sighting of the elusive binary option */
+ { "binary", no_arg, 'b' },
+ { "binar", no_arg, 'b' },
+ { "bina", no_arg, 'b' },
+ { "bin", no_arg, 'b' },
+ { "bi", no_arg, 'b' },
+#endif /* 0 */
+ { "block-size", require_arg, 'B' },
+ { "block-siz", require_arg, 'B' },
+ { "block-si", require_arg, 'B' },
+ { "block-s", require_arg, 'B' },
+ { "block-", require_arg, 'B' },
+ { "block", require_arg, 'B' },
+ { "bloc", require_arg, 'B' },
+ { "blo", require_arg, 'B' },
+ { "bl", require_arg, 'B' },
+ { "chunk", no_arg, 'c' },
+ { "chun", no_arg, 'c' },
+ { "chu", no_arg, 'c' },
+ { "ch", no_arg, 'c' },
+ { "collective", no_arg, 'C' },
+ { "collectiv", no_arg, 'C' },
+ { "collecti", no_arg, 'C' },
+ { "collect", no_arg, 'C' },
+ { "collec", no_arg, 'C' },
+ { "colle", no_arg, 'C' },
+ { "coll", no_arg, 'C' },
+ { "col", no_arg, 'C' },
+ { "co", no_arg, 'C' },
+ { "debug", require_arg, 'D' },
+ { "debu", require_arg, 'D' },
+ { "deb", require_arg, 'D' },
+ { "de", require_arg, 'D' },
+ { "file-driver", require_arg, 'v' },
+ { "file-drive", require_arg, 'v' },
+ { "file-driv", require_arg, 'v' },
+ { "file-dri", require_arg, 'v' },
+ { "file-dr", require_arg, 'v' },
+ { "file-d", require_arg, 'v' },
+ { "file-", require_arg, 'v' },
+ { "file", require_arg, 'v' },
+ { "fil", require_arg, 'v' },
+ { "fi", require_arg, 'v' },
+ { "geometry", no_arg, 'g' },
+ { "geometr", no_arg, 'g' },
+ { "geomet", no_arg, 'g' },
+ { "geome", no_arg, 'g' },
+ { "geom", no_arg, 'g' },
+ { "geo", no_arg, 'g' },
+ { "ge", no_arg, 'g' },
+ { "help", no_arg, 'h' },
+ { "hel", no_arg, 'h' },
+ { "he", no_arg, 'h' },
+ { "interleaved", require_arg, 'I' },
+ { "interleave", require_arg, 'I' },
+ { "interleav", require_arg, 'I' },
+ { "interlea", require_arg, 'I' },
+ { "interle", require_arg, 'I' },
+ { "interl", require_arg, 'I' },
+ { "inter", require_arg, 'I' },
+ { "inte", require_arg, 'I' },
+ { "int", require_arg, 'I' },
+ { "in", require_arg, 'I' },
+ { "max-num-processes", require_arg, 'P' },
+ { "max-num-processe", require_arg, 'P' },
+ { "max-num-process", require_arg, 'P' },
+ { "max-num-proces", require_arg, 'P' },
+ { "max-num-proce", require_arg, 'P' },
+ { "max-num-proc", require_arg, 'P' },
+ { "max-num-pro", require_arg, 'P' },
+ { "max-num-pr", require_arg, 'P' },
+ { "max-num-p", require_arg, 'P' },
+ { "min-num-processes", require_arg, 'p' },
+ { "min-num-processe", require_arg, 'p' },
+ { "min-num-process", require_arg, 'p' },
+ { "min-num-proces", require_arg, 'p' },
+ { "min-num-proce", require_arg, 'p' },
+ { "min-num-proc", require_arg, 'p' },
+ { "min-num-pro", require_arg, 'p' },
+ { "min-num-pr", require_arg, 'p' },
+ { "min-num-p", require_arg, 'p' },
+ { "max-xfer-size", require_arg, 'X' },
+ { "max-xfer-siz", require_arg, 'X' },
+ { "max-xfer-si", require_arg, 'X' },
+ { "max-xfer-s", require_arg, 'X' },
+ { "max-xfer", require_arg, 'X' },
+ { "max-xfe", require_arg, 'X' },
+ { "max-xf", require_arg, 'X' },
+ { "max-x", require_arg, 'X' },
+ { "min-xfer-size", require_arg, 'x' },
+ { "min-xfer-siz", require_arg, 'x' },
+ { "min-xfer-si", require_arg, 'x' },
+ { "min-xfer-s", require_arg, 'x' },
+ { "min-xfer", require_arg, 'x' },
+ { "min-xfe", require_arg, 'x' },
+ { "min-xf", require_arg, 'x' },
+ { "min-x", require_arg, 'x' },
+ { "num-bytes", require_arg, 'e' },
+ { "num-byte", require_arg, 'e' },
+ { "num-byt", require_arg, 'e' },
+ { "num-by", require_arg, 'e' },
+ { "num-b", require_arg, 'e' },
+ { "num-dsets", require_arg, 'd' },
+ { "num-dset", require_arg, 'd' },
+ { "num-dse", require_arg, 'd' },
+ { "num-ds", require_arg, 'd' },
+ { "num-d", require_arg, 'd' },
+ { "num-files", require_arg, 'F' },
+ { "num-file", require_arg, 'F' },
+ { "num-fil", require_arg, 'F' },
+ { "num-fi", require_arg, 'F' },
+ { "num-f", require_arg, 'F' },
+ { "num-iterations", require_arg, 'i' },
+ { "num-iteration", require_arg, 'i' },
+ { "num-iteratio", require_arg, 'i' },
+ { "num-iterati", require_arg, 'i' },
+ { "num-iterat", require_arg, 'i' },
+ { "num-itera", require_arg, 'i' },
+ { "num-iter", require_arg, 'i' },
+ { "num-ite", require_arg, 'i' },
+ { "num-it", require_arg, 'i' },
+ { "num-i", require_arg, 'i' },
+ { "order", require_arg, 'r' },
+ { "orde", require_arg, 'r' },
+ { "ord", require_arg, 'r' },
+ { "or", require_arg, 'r' },
+ { "output", require_arg, 'o' },
+ { "outpu", require_arg, 'o' },
+ { "outp", require_arg, 'o' },
+ { "out", require_arg, 'o' },
+ { "ou", require_arg, 'o' },
+ { "extendable", no_arg, 't' },
+ { "extendabl", no_arg, 't' },
+ { "extendab", no_arg, 't' },
+ { "extenda", no_arg, 't' },
+ { "extend", no_arg, 't' },
+ { "exten", no_arg, 't' },
+ { "exte", no_arg, 't' },
+ { "ext", no_arg, 't' },
+ { "ex", no_arg, 't' },
+ { "threshold", require_arg, 'T' },
+ { "threshol", require_arg, 'T' },
+ { "thresho", require_arg, 'T' },
+ { "thresh", require_arg, 'T' },
+ { "thres", require_arg, 'T' },
+ { "thre", require_arg, 'T' },
+ { "thr", require_arg, 'T' },
+ { "th", require_arg, 'T' },
+ { "write-only", require_arg, 'w' },
+ { "write-onl", require_arg, 'w' },
+ { "write-on", require_arg, 'w' },
+ { "write-o", require_arg, 'w' },
+ { "write", require_arg, 'w' },
+ { "writ", require_arg, 'w' },
+ { "wri", require_arg, 'w' },
+ { "wr", require_arg, 'w' },
+ { NULL, 0, '\0' }
+};
+
+struct options {
+ long io_types; /* bitmask of which I/O types to test */
+ const char *output_file; /* file to print report to */
+ long num_dsets; /* number of datasets */
+ long num_files; /* number of files */
+ off_t num_bpp; /* number of bytes per proc per dset */
+ int num_iters; /* number of iterations */
+ hsize_t dset_size[MAX_DIMS]; /* Dataset size */
+ size_t buf_size[MAX_DIMS]; /* Buffer size */
+ size_t chk_size[MAX_DIMS]; /* Chunk size */
+ int order[MAX_DIMS]; /* Dimension access order */
+ int dset_rank; /* Rank */
+ int buf_rank; /* Rank */
+ int order_rank; /* Rank */
+ int chk_rank; /* Rank */
+ int print_times; /* print times as well as throughputs */
+ int print_raw; /* print raw data throughput info */
+ hsize_t h5_alignment; /* alignment in HDF5 file */
+ hsize_t h5_threshold; /* threshold for alignment in HDF5 file */
+ int h5_use_chunks; /* Make HDF5 dataset chunked */
+ int h5_write_only; /* Perform the write tests only */
+ int h5_extendable; /* Perform the write tests only */
+ int verify; /* Verify data correctness */
+ vfdtype vfd; /* File driver */
+
+};
+
+typedef struct _minmax {
+ double min;
+ double max;
+ double sum;
+ int num;
+} minmax;
+
+/* local functions */
+static hsize_t parse_size_directive(const char *size);
+static struct options *parse_command_line(int argc, char *argv[]);
+static void run_test_loop(struct options *options);
+static int run_test(iotype iot, parameters parms, struct options *opts);
+static void output_all_info(minmax *mm, int count, int indent_level);
+static void get_minmax(minmax *mm, double val);
+static void accumulate_minmax_stuff(const minmax *mm, int count, minmax *total_mm);
+static void output_results(const struct options *options, const char *name,
+ minmax *table, int table_size, off_t data_size);
+static void output_report(const char *fmt, ...);
+static void print_indent(register int indent);
+static void usage(const char *prog);
+static void report_parameters(struct options *opts);
+
+/*
+ * Function: main
+ * Purpose: Start things up.
+ * Return: EXIT_SUCCESS or EXIT_FAILURE
+ * Programmer: Bill Wendling, 30. October 2001
+ * Modifications:
+ */
+int
+main(int argc, char **argv)
+{
+ int exit_value = EXIT_SUCCESS;
+ struct options *opts = NULL;
+
+#ifndef STANDALONE
+ /* Initialize h5tools lib */
+ h5tools_init();
+#endif
+
+ output = stdout;
+
+ opts = parse_command_line(argc, argv);
+
+ if (!opts) {
+ exit_value = EXIT_FAILURE;
+ goto finish;
+ }
+
+ if (opts->output_file) {
+ if ((output = HDfopen(opts->output_file, "w")) == NULL) {
+ fprintf(stderr, "%s: cannot open output file\n", progname);
+ perror(opts->output_file);
+ goto finish;
+ }
+ }
+
+ report_parameters(opts);
+
+ run_test_loop(opts);
+
+finish:
+ free(opts);
+ return exit_value;
+}
+
+/*
+ * Function: run_test_loop
+ * Purpose: Run the I/O tests. Write the results to OUTPUT.
+ *
+ * - The slowest changing part of the test is the number of
+ * processors to use. For each loop iteration, we divide that
+ * number by 2 and rerun the test.
+ *
+ * - The second slowest is what type of IO API to perform. We have
+ * three choices: POSIXIO, and HDF5.
+ *
+ * - Then we change the size of the buffer. This information is
+ * inferred from the number of datasets to create and the number
+ * of integers to put into each dataset. The backend code figures
+ * this out.
+ *
+ * Return: Nothing
+ * Programmer: Bill Wendling, 30. October 2001
+ * Modifications:
+ * Added multidimensional testing (Christian Chilan, April, 2008)
+ */
+static void
+run_test_loop(struct options *opts)
+{
+ parameters parms;
+ int i;
+ size_t buf_bytes;
+
+ /* load options into parameter structure */
+ parms.num_files = opts->num_files;
+ parms.num_dsets = opts->num_dsets;
+ parms.num_iters = opts->num_iters;
+ parms.rank = opts->dset_rank;
+ parms.h5_align = opts->h5_alignment;
+ parms.h5_thresh = opts->h5_threshold;
+ parms.h5_use_chunks = opts->h5_use_chunks;
+ parms.h5_extendable = opts->h5_extendable;
+ parms.h5_write_only = opts->h5_write_only;
+ parms.verify = opts->verify;
+ parms.vfd = opts->vfd;
+
+ /* load multidimensional options */
+ parms.num_bytes = 1;
+ buf_bytes = 1;
+ for (i=0; i<parms.rank; i++){
+ parms.buf_size[i] = opts->buf_size[i];
+ parms.dset_size[i] = opts->dset_size[i];
+ parms.chk_size[i] = opts->chk_size[i];
+ parms.order[i] = opts->order[i];
+ parms.num_bytes *= opts->dset_size[i];
+ buf_bytes *= opts->buf_size[i];
+ }
+
+ /* print size information */
+ output_report("Transfer Buffer Size (bytes): %d\n", buf_bytes);
+ output_report("File Size(MB): %.2f\n",((double)parms.num_bytes) / ONE_MB);
+
+ print_indent(0);
+ if (opts->io_types & SIO_POSIX)
+ run_test(POSIXIO, parms, opts);
+
+ print_indent(0);
+ if (opts->io_types & SIO_HDF5)
+ run_test(HDF5, parms, opts);
+}
+
+/*
+ * Function: run_test
+ * Purpose: Inner loop call to actually run the I/O test.
+ * Return: Nothing
+ * Programmer: Bill Wendling, 18. December 2001
+ * Modifications:
+ */
+static int
+run_test(iotype iot, parameters parms, struct options *opts)
+{
+ results res;
+ register int i, ret_value = SUCCESS;
+ off_t raw_size;
+ minmax *write_sys_mm_table=NULL;
+ minmax *write_mm_table=NULL;
+ minmax *write_gross_mm_table=NULL;
+ minmax *write_raw_mm_table=NULL;
+ minmax *read_sys_mm_table=NULL;
+ minmax *read_mm_table=NULL;
+ minmax *read_gross_mm_table=NULL;
+ minmax *read_raw_mm_table=NULL;
+ minmax write_sys_mm = {0.0F, 0.0F, 0.0F, 0};
+ minmax write_mm = {0.0F, 0.0F, 0.0F, 0};
+ minmax write_gross_mm = {0.0F, 0.0F, 0.0F, 0};
+ minmax write_raw_mm = {0.0F, 0.0F, 0.0F, 0};
+ minmax read_sys_mm = {0.0F, 0.0F, 0.0F, 0};
+ minmax read_mm = {0.0F, 0.0F, 0.0F, 0};
+ minmax read_gross_mm = {0.0F, 0.0F, 0.0F, 0};
+ minmax read_raw_mm = {0.0F, 0.0F, 0.0F, 0};
+
+ raw_size = (off_t)parms.num_bytes;
+ parms.io_type = iot;
+ print_indent(2);
+ output_report("IO API = ");
+
+ switch (iot) {
+ case POSIXIO:
+ output_report("POSIX\n");
+ break;
+ case HDF5:
+ output_report("HDF5\n");
+ break;
+ default:
+ /* unknown request */
+ HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)iot);
+ HDassert(0 && "Unknown IO tpe");
+ break;
+ }
+
+ /* allocate space for tables minmax and that it is sufficient */
+ /* to initialize all elements to zeros by calloc. */
+ write_sys_mm_table = (minmax *)calloc((size_t)parms.num_iters , sizeof(minmax));
+ write_mm_table = (minmax *)calloc((size_t)parms.num_iters , sizeof(minmax));
+ write_gross_mm_table = (minmax *)calloc((size_t)parms.num_iters , sizeof(minmax));
+ write_raw_mm_table = (minmax *)calloc((size_t)parms.num_iters , sizeof(minmax));
+
+ if (!parms.h5_write_only) {
+ read_sys_mm_table = (minmax *)calloc((size_t)parms.num_iters , sizeof(minmax));
+ read_mm_table = (minmax *)calloc((size_t)parms.num_iters , sizeof(minmax));
+ read_gross_mm_table = (minmax *)calloc((size_t)parms.num_iters , sizeof(minmax));
+ read_raw_mm_table = (minmax *)calloc((size_t)parms.num_iters , sizeof(minmax));
+ }
+
+ /* Do IO iteration times, collecting statistics each time */
+ for (i = 0; i < parms.num_iters; ++i) {
+ double t;
+
+ do_sio(parms, &res);
+
+ /* gather all of the "sys write" times */
+ t = get_time(res.timers, HDF5_MPI_WRITE);
+ get_minmax(&write_sys_mm, t);
+
+ write_sys_mm_table[i] = write_sys_mm;
+
+ /* gather all of the "write" times */
+ t = get_time(res.timers, HDF5_FINE_WRITE_FIXED_DIMS);
+ get_minmax(&write_mm, t);
+
+ write_mm_table[i] = write_mm;
+
+ /* gather all of the "write" times from open to close */
+ t = get_time(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS);
+ get_minmax(&write_gross_mm, t);
+
+ write_gross_mm_table[i] = write_gross_mm;
+
+ /* gather all of the raw "write" times */
+ t = get_time(res.timers, HDF5_RAW_WRITE_FIXED_DIMS);
+ get_minmax(&write_raw_mm, t);
+
+ write_raw_mm_table[i] = write_raw_mm;
+
+ if (!parms.h5_write_only) {
+ /* gather all of the "mpi read" times */
+ t = get_time(res.timers, HDF5_MPI_READ);
+ get_minmax(&read_sys_mm, t);
+
+ read_sys_mm_table[i] = read_sys_mm;
+
+ /* gather all of the "read" times */
+ t = get_time(res.timers, HDF5_FINE_READ_FIXED_DIMS);
+ get_minmax(&read_mm, t);
+
+ read_mm_table[i] = read_mm;
+
+ /* gather all of the "read" times from open to close */
+ t = get_time(res.timers, HDF5_GROSS_READ_FIXED_DIMS);
+ get_minmax(&read_gross_mm, t);
+
+ read_gross_mm_table[i] = read_gross_mm;
+
+ /* gather all of the raw "read" times */
+ t = get_time(res.timers, HDF5_RAW_READ_FIXED_DIMS);
+ get_minmax(&read_raw_mm, t);
+
+ read_raw_mm_table[i] = read_gross_mm;
+ }
+ io_time_destroy(res.timers);
+ }
+
+ /*
+ * Show various statistics
+ */
+ /* Write statistics */
+ /* Print the raw data throughput if desired */
+ if (opts->print_raw) {
+ /* accumulate and output the max, min, and average "raw write" times */
+ if (sio_debug_level >= 3) {
+ /* output all of the times for all iterations */
+ print_indent(3);
+ output_report("Raw Data Write details:\n");
+ output_all_info(write_raw_mm_table, parms.num_iters, 4);
+ }
+
+ output_results(opts,"Raw Data Write",write_raw_mm_table,parms.num_iters,raw_size);
+ } /* end if */
+
+ /* show sys write statics */
+#if 0
+ if (sio_debug_level >= 3) {
+ /* output all of the times for all iterations */
+ print_indent(3);
+ output_report("MPI Write details:\n");
+ output_all_info(write_sys_mm_table, parms.num_iters, 4);
+ }
+#endif
+ /* We don't currently output the MPI write results */
+
+ /* accumulate and output the max, min, and average "write" times */
+ if (sio_debug_level >= 3) {
+ /* output all of the times for all iterations */
+ print_indent(3);
+ output_report("Write details:\n");
+ output_all_info(write_mm_table, parms.num_iters, 4);
+ }
+
+ output_results(opts,"Write",write_mm_table,parms.num_iters,raw_size);
+
+ /* accumulate and output the max, min, and average "gross write" times */
+ if (sio_debug_level >= 3) {
+ /* output all of the times for all iterations */
+ print_indent(3);
+ output_report("Write Open-Close details:\n");
+ output_all_info(write_gross_mm_table, parms.num_iters, 4);
+ }
+
+ output_results(opts,"Write Open-Close",write_gross_mm_table,parms.num_iters,raw_size);
+
+ if (!parms.h5_write_only) {
+ /* Read statistics */
+ /* Print the raw data throughput if desired */
+ if (opts->print_raw) {
+ /* accumulate and output the max, min, and average "raw read" times */
+ if (sio_debug_level >= 3) {
+ /* output all of the times for all iterations */
+ print_indent(3);
+ output_report("Raw Data Read details:\n");
+ output_all_info(read_raw_mm_table, parms.num_iters, 4);
+ }
+
+ output_results(opts, "Raw Data Read", read_raw_mm_table,
+ parms.num_iters, raw_size);
+ } /* end if */
+
+ /* show mpi read statics */
+#if 0
+ if (sio_debug_level >= 3) {
+ /* output all of the times for all iterations */
+ print_indent(3);
+ output_report("MPI Read details:\n");
+ output_all_info(read_sys_mm_table, parms.num_iters, 4);
+ }
+#endif
+ /* We don't currently output the MPI read results */
+
+ /* accumulate and output the max, min, and average "read" times */
+ if (sio_debug_level >= 3) {
+ /* output all of the times for all iterations */
+ print_indent(3);
+ output_report("Read details:\n");
+ output_all_info(read_mm_table, parms.num_iters, 4);
+ }
+
+ output_results(opts, "Read", read_mm_table, parms.num_iters, raw_size);
+
+ /* accumulate and output the max, min, and average "gross read" times */
+ if (sio_debug_level >= 3) {
+ /* output all of the times for all iterations */
+ print_indent(3);
+ output_report("Read Open-Close details:\n");
+ output_all_info(read_gross_mm_table, parms.num_iters, 4);
+ }
+
+ output_results(opts, "Read Open-Close", read_gross_mm_table,
+ parms.num_iters, raw_size);
+ }
+
+ /* clean up our mess */
+ free(write_sys_mm_table);
+ free(write_mm_table);
+ free(write_gross_mm_table);
+ free(write_raw_mm_table);
+
+ if (!parms.h5_write_only) {
+ free(read_sys_mm_table);
+ free(read_mm_table);
+ free(read_gross_mm_table);
+ free(read_raw_mm_table);
+ }
+
+ return ret_value;
+}
+
+/*
+ * Function: output_all_info
+ * Purpose:
+ * Return: Nothing
+ * Programmer: Bill Wendling, 29. January 2002
+ * Modifications:
+ */
+static void
+output_all_info(minmax *mm, int count, int indent_level)
+{
+ int i;
+
+ for (i = 0; i < count; ++i) {
+ print_indent(indent_level);
+ output_report("Iteration %d:\n", i + 1);
+ print_indent(indent_level + 1);
+ output_report("Minimum Time: %.2fs\n", mm[i].min);
+ print_indent(indent_level + 1);
+ output_report("Maximum Time: %.2fs\n", mm[i].max);
+ }
+}
+
+/*
+ * Function: get_minmax
+ * Purpose: Gather all the min, max and total of val.
+ * Return: Nothing
+ * Programmer: Bill Wendling, 21. December 2001
+ * Modifications:
+ * Use MPI_Allreduce to do it. -akc, 2002/01/11
+ */
+
+static void
+get_minmax(minmax *mm, double val)
+{
+ mm->max = val;
+ mm->min = val;
+ mm->sum = val;
+}
+
+/*
+ * Function: accumulate_minmax_stuff
+ * Purpose: Accumulate the minimum, maximum, and average of the times
+ * across all processes.
+ * Return: TOTAL_MM - the total of all of these.
+ * Programmer: Bill Wendling, 21. December 2001
+ * Modifications:
+ * Changed to use seconds instead of MB/s - QAK, 5/9/02
+ */
+static void
+accumulate_minmax_stuff(const minmax *mm, int count, minmax *total_mm)
+{
+ int i;
+
+ total_mm->sum = 0.0F;
+ total_mm->max = -DBL_MAX;
+ total_mm->min = DBL_MAX;
+ total_mm->num = count;
+
+ for (i = 0; i < count; ++i) {
+ double m = mm[i].max;
+
+ total_mm->sum += m;
+
+ if (m < total_mm->min)
+ total_mm->min = m;
+
+ if (m > total_mm->max)
+ total_mm->max = m;
+ }
+}
+
+
+/*
+ * Function: output_results
+ * Purpose: Print information about the time & bandwidth for a given
+ * minmax & # of iterations.
+ * Return: Nothing
+ * Programmer: Quincey Koziol, 9. May 2002
+ * Modifications:
+ */
+static void
+output_results(const struct options *opts, const char *name, minmax *table,
+ int table_size,off_t data_size)
+{
+ minmax total_mm;
+
+ accumulate_minmax_stuff(table, table_size, &total_mm);
+
+ print_indent(3);
+ output_report("%s (%d iteration(s)):\n", name,table_size);
+
+ /* Note: The maximum throughput uses the minimum amount of time & vice versa */
+
+ print_indent(4);
+ output_report("Maximum Throughput: %6.2f MB/s", MB_PER_SEC(data_size,total_mm.min));
+ if(opts->print_times)
+ output_report(" (%7.3f s)\n", total_mm.min);
+ else
+ output_report("\n");
+
+ print_indent(4);
+ output_report("Average Throughput: %6.2f MB/s",
+ MB_PER_SEC(data_size,total_mm.sum / total_mm.num));
+ if(opts->print_times)
+ output_report(" (%7.3f s)\n", (total_mm.sum / total_mm.num));
+ else
+ output_report("\n");
+
+ print_indent(4);
+ output_report("Minimum Throughput: %6.2f MB/s", MB_PER_SEC(data_size,total_mm.max));
+ if(opts->print_times)
+ output_report(" (%7.3f s)\n", total_mm.max);
+ else
+ output_report("\n");
+}
+
+/*
+ * Function: output_report
+ * Purpose: Print a line of the report. Only do so if I'm the 0 process.
+ * Return: Nothing
+ * Programmer: Bill Wendling, 19. December 2001
+ * Modifications:
+ */
+static void
+output_report(const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ vfprintf(output, fmt, ap);
+ va_end(ap);
+}
+
+/*
+ * Function: print_indent
+ * Purpose: Print spaces to indent a new line of text for pretty printing
+ * things.
+ * Return: Nothing
+ * Programmer: Bill Wendling, 29. October 2001
+ * Modifications:
+ */
+static void
+print_indent(register int indent)
+{
+ indent *= TAB_SPACE;
+
+ for (; indent > 0; --indent)
+ fputc(' ', output);
+}
+
+static void
+recover_size_and_print(long long val, const char *end)
+{
+ if (val >= ONE_KB && (val % ONE_KB) == 0) {
+ if (val >= ONE_MB && (val % ONE_MB) == 0) {
+ if (val >= ONE_GB && (val % ONE_GB) == 0)
+ HDfprintf(output, "%" H5_PRINTF_LL_WIDTH "d""GB%s", val / ONE_GB, end);
+ else
+ HDfprintf(output, "%" H5_PRINTF_LL_WIDTH "d""MB%s", val / ONE_MB, end);
+ } else {
+ HDfprintf(output, "%" H5_PRINTF_LL_WIDTH "d""KB%s", val / ONE_KB, end);
+ }
+ } else {
+ HDfprintf(output, "%" H5_PRINTF_LL_WIDTH "d""%s", val, end);
+ }
+}
+
+static void
+print_io_api(long io_types)
+{
+ if (io_types & SIO_POSIX)
+ HDfprintf(output, "posix ");
+ if (io_types & SIO_HDF5)
+ HDfprintf(output, "hdf5 ");
+ HDfprintf(output, "\n");
+}
+
+static void
+report_parameters(struct options *opts)
+{
+ int i, rank;
+ rank = opts->dset_rank;
+
+ print_version("HDF5 Library"); /* print library version */
+ HDfprintf(output, "==== Parameters ====\n");
+
+ HDfprintf(output, "IO API=");
+ print_io_api(opts->io_types);
+
+ HDfprintf(output, "Number of iterations=%d\n",
+ opts->num_iters);
+
+ HDfprintf(output, "Dataset size=");
+
+ for (i=0; i<rank; i++)
+ recover_size_and_print((long long)opts->dset_size[i], " ");
+ HDfprintf(output, "\n");
+
+
+ HDfprintf(output, "Transfer buffer size=");
+ for (i=0; i<rank; i++)
+ recover_size_and_print((long long)opts->buf_size[i], " ");
+ HDfprintf(output, "\n");
+
+ HDfprintf(output, "Dimension access order=");
+ for (i=0; i<rank; i++)
+ recover_size_and_print((long long)opts->order[i], " ");
+ HDfprintf(output, "\n");
+
+ if (opts->io_types & SIO_HDF5) {
+
+ HDfprintf(output, "HDF5 data storage method=");
+
+ if (opts->h5_use_chunks){
+
+ HDfprintf(output, "Chunked\n");
+ HDfprintf(output, "HDF5 chunk size=");
+ for (i=0; i<rank; i++)
+ recover_size_and_print((long long)opts->chk_size[i], " ");
+ HDfprintf(output, "\n");
+
+ HDfprintf(output, "HDF5 dataset dimensions=");
+ if (opts->h5_extendable) {
+ HDfprintf(output, "Extendable\n");
+ }
+ else {
+ HDfprintf(output, "Fixed\n");
+ }
+ }
+ else {
+ HDfprintf(output, "Contiguous\n");
+ }
+
+ HDfprintf(output, "HDF5 file driver=");
+ if (opts->vfd==sec2) {
+ HDfprintf(output, "sec2\n");
+ } else if (opts->vfd==stdio) {
+ HDfprintf(output, "stdio\n");
+ } else if (opts->vfd==core) {
+ HDfprintf(output, "core\n");
+ } else if (opts->vfd==split) {
+ HDfprintf(output, "split\n");
+ } else if (opts->vfd==multi) {
+ HDfprintf(output, "multi\n");
+ } else if (opts->vfd==family) {
+ HDfprintf(output, "family\n");
+ } else if (opts->vfd==direct) {
+ HDfprintf(output, "direct\n");
+ }
+ }
+
+ {
+ char *prefix = HDgetenv("HDF5_PREFIX");
+
+ HDfprintf(output, "Env HDF5_PREFIX=%s\n",
+ (prefix ? prefix : "not set"));
+ }
+
+ HDfprintf(output, "==== End of Parameters ====\n");
+ HDfprintf(output, "\n");
+}
+
+/*
+ * Function: parse_command_line
+ * Purpose: Parse the command line options and return a STRUCT OPTIONS
+ * structure which will need to be freed by the calling function.
+ * Return: Pointer to an OPTIONS structure
+ * Programmer: Bill Wendling, 31. October 2001
+ * Modifications:
+ * Added multidimensional testing (Christian Chilan, April, 2008)
+ */
+static struct options *
+parse_command_line(int argc, char *argv[])
+{
+ int opt;
+ struct options *cl_opts;
+ int i, default_rank, actual_rank, ranks[4];
+
+ cl_opts = (struct options *)HDmalloc(sizeof(struct options));
+
+ cl_opts->output_file = NULL;
+ cl_opts->io_types = 0; /* will set default after parsing options */
+ cl_opts->num_iters = 1;
+
+ default_rank = 2;
+
+ cl_opts->dset_rank = 0;
+ cl_opts->buf_rank = 0;
+ cl_opts->chk_rank = 0;
+ cl_opts->order_rank = 0;
+
+ for(i = 0; i < MAX_DIMS; i++) {
+ cl_opts->buf_size[i] = (size_t)((i + 1) * 10);
+ cl_opts->dset_size[i] = (hsize_t)((i + 1) * 100);
+ cl_opts->chk_size[i] = (size_t)((i + 1) * 10);
+ cl_opts->order[i] = i + 1;
+ }
+
+ cl_opts->vfd = sec2;
+
+ cl_opts->print_times = FALSE; /* Printing times is off by default */
+ cl_opts->print_raw = FALSE; /* Printing raw data throughput is off by default */
+ cl_opts->h5_alignment = 1; /* No alignment for HDF5 objects by default */
+ cl_opts->h5_threshold = 1; /* No threshold for aligning HDF5 objects by default */
+ cl_opts->h5_use_chunks = FALSE; /* Don't chunk the HDF5 dataset by default */
+ cl_opts->h5_write_only = FALSE; /* Do both read and write by default */
+ cl_opts->h5_extendable = FALSE; /* Use extendable dataset */
+ cl_opts->verify = FALSE; /* No Verify data correctness by default */
+
+ while ((opt = get_option(argc, (const char **)argv, s_opts, l_opts)) != EOF) {
+ switch ((char)opt) {
+ case 'a':
+ cl_opts->h5_alignment = parse_size_directive(opt_arg);
+ break;
+ case 'A':
+ {
+ const char *end = opt_arg;
+ while (end && *end != '\0') {
+ char buf[10];
+
+ HDmemset(buf, '\0', sizeof(buf));
+
+ for (i = 0; *end != '\0' && *end != ','; ++end)
+ if (isalnum(*end) && i < 10)
+ buf[i++] = *end;
+
+ if (!HDstrcasecmp(buf, "hdf5")) {
+ cl_opts->io_types |= SIO_HDF5;
+ } else if (!HDstrcasecmp(buf, "posix")) {
+ cl_opts->io_types |= SIO_POSIX;
+ } else {
+ fprintf(stderr, "sio_perf: invalid --api option %s\n",
+ buf);
+ exit(EXIT_FAILURE);
+ }
+
+ if (*end == '\0')
+ break;
+
+ end++;
+ }
+ }
+
+ break;
+#if 0
+ case 'b':
+ /* the future "binary" option */
+ break;
+#endif /* 0 */
+ case 'c':
+ /* Turn on chunked HDF5 dataset creation */
+ cl_opts->h5_use_chunks = 1;
+ {
+ const char *end = opt_arg;
+ int j = 0;
+
+ while (end && *end != '\0') {
+ char buf[10];
+
+ HDmemset(buf, '\0', sizeof(buf));
+
+ for (i = 0; *end != '\0' && *end != ','; ++end)
+ if (isalnum(*end) && i < 10)
+ buf[i++] = *end;
+
+ cl_opts->chk_size[j] = parse_size_directive(buf);
+
+ j++;
+
+ if (*end == '\0')
+ break;
+
+ end++;
+ }
+ cl_opts->chk_rank = j;
+ }
+
+ break;
+
+
+ case 'D':
+ {
+ const char *end = opt_arg;
+
+ while (end && *end != '\0') {
+ char buf[10];
+
+ HDmemset(buf, '\0', sizeof(buf));
+
+ for (i = 0; *end != '\0' && *end != ','; ++end)
+ if (isalnum(*end) && i < 10)
+ buf[i++] = *end;
+
+ if (strlen(buf) > 1 || isdigit(buf[0])) {
+ size_t j;
+
+ for (j = 0; j < 10 && buf[j] != '\0'; ++j)
+ if (!isdigit(buf[j])) {
+ fprintf(stderr, "sio_perf: invalid --debug option %s\n",
+ buf);
+ exit(EXIT_FAILURE);
+ }
+
+ sio_debug_level = atoi(buf);
+
+ if (sio_debug_level > 4)
+ sio_debug_level = 4;
+ else if (sio_debug_level < 0)
+ sio_debug_level = 0;
+ } else {
+ switch (*buf) {
+ case 'r':
+ /* Turn on raw data throughput info */
+ cl_opts->print_raw = TRUE;
+ break;
+ case 't':
+ /* Turn on time printing */
+ cl_opts->print_times = TRUE;
+ break;
+ case 'v':
+ /* Turn on verify data correctness*/
+ cl_opts->verify = TRUE;
+ break;
+ default:
+ fprintf(stderr, "sio_perf: invalid --debug option %s\n", buf);
+ exit(EXIT_FAILURE);
+ }
+ }
+
+ if (*end == '\0')
+ break;
+
+ end++;
+ }
+ }
+
+ break;
+ case 'e':
+ {
+ const char *end = opt_arg;
+ int j = 0;
+
+ while (end && *end != '\0') {
+ char buf[10];
+
+ HDmemset(buf, '\0', sizeof(buf));
+
+ for (i = 0; *end != '\0' && *end != ','; ++end)
+ if (isalnum(*end) && i < 10)
+ buf[i++] = *end;
+
+ cl_opts->dset_size[j] = parse_size_directive(buf);
+
+ j++;
+
+ if (*end == '\0')
+ break;
+
+ end++;
+ }
+ cl_opts->dset_rank = j;
+ }
+
+ break;
+
+ case 'i':
+ cl_opts->num_iters = atoi(opt_arg);
+ break;
+ case 'o':
+ cl_opts->output_file = opt_arg;
+ break;
+ case 'T':
+ cl_opts->h5_threshold = parse_size_directive(opt_arg);
+ break;
+ case 'v':
+ if (!HDstrcasecmp(opt_arg, "sec2")) {
+ cl_opts->vfd=sec2;
+ } else if (!HDstrcasecmp(opt_arg, "stdio")) {
+ cl_opts->vfd=stdio;
+ } else if (!HDstrcasecmp(opt_arg, "core")) {
+ cl_opts->vfd=core;
+ } else if (!HDstrcasecmp(opt_arg, "split")) {
+ cl_opts->vfd=split;
+ } else if (!HDstrcasecmp(opt_arg, "multi")) {
+ cl_opts->vfd=multi;
+ } else if (!HDstrcasecmp(opt_arg, "family")) {
+ cl_opts->vfd=family;
+ } else if (!HDstrcasecmp(opt_arg, "direct")) {
+ cl_opts->vfd=direct;
+ } else {
+ fprintf(stderr, "sio_perf: invalid --api option %s\n",
+ opt_arg);
+ exit(EXIT_FAILURE);
+ }
+ break;
+ case 'w':
+ cl_opts->h5_write_only = TRUE;
+ break;
+ case 't':
+ cl_opts->h5_extendable = TRUE;
+ break;
+ case 'x':
+ {
+ const char *end = opt_arg;
+ int j = 0;
+
+ while (end && *end != '\0') {
+ char buf[10];
+
+ HDmemset(buf, '\0', sizeof(buf));
+
+ for (i = 0; *end != '\0' && *end != ','; ++end)
+ if (isalnum(*end) && i < 10)
+ buf[i++] = *end;
+
+ cl_opts->buf_size[j] = parse_size_directive(buf);
+
+ j++;
+
+ if (*end == '\0')
+ break;
+
+ end++;
+ }
+ cl_opts->buf_rank = j;
+ }
+
+ break;
+
+ case 'r':
+ {
+ const char *end = opt_arg;
+ int j = 0;
+
+ while (end && *end != '\0') {
+ char buf[10];
+
+ HDmemset(buf, '\0', sizeof(buf));
+
+ for (i = 0; *end != '\0' && *end != ','; ++end)
+ if (isalnum(*end) && i < 10)
+ buf[i++] = *end;
+
+ cl_opts->order[j] = (int)parse_size_directive(buf);
+
+ j++;
+
+ if (*end == '\0')
+ break;
+
+ end++;
+ }
+
+ cl_opts->order_rank = j;
+ }
+
+ break;
+
+ case 'h':
+ case '?':
+ default:
+ usage(progname);
+ free(cl_opts);
+ return NULL;
+ }
+ }
+
+ /* perform rank consistency analysis */
+ actual_rank = 0;
+
+ ranks[0] = cl_opts->dset_rank;
+ ranks[1] = cl_opts->buf_rank;
+ ranks[2] = cl_opts->order_rank;
+ ranks[3] = cl_opts->chk_rank;
+
+ for (i=0; i<4; i++) {
+ if (ranks[i]>0) {
+ if (!actual_rank) {
+ actual_rank = ranks[i];
+ }
+ else {
+ if (actual_rank != ranks[i])
+ exit(EXIT_FAILURE);
+ }
+ }
+ }
+
+ if (!actual_rank)
+ actual_rank = default_rank;
+
+ cl_opts->dset_rank = actual_rank;
+ cl_opts->buf_rank = actual_rank;
+ cl_opts->order_rank = actual_rank;
+ cl_opts->chk_rank = actual_rank;
+
+ for (i=0; i<actual_rank; i++) {
+ if (cl_opts->order[i] > actual_rank) {
+ exit(EXIT_FAILURE);
+ }
+ }
+
+ /* set default if none specified yet */
+ if (!cl_opts->io_types)
+ cl_opts->io_types = SIO_HDF5 | SIO_POSIX; /* run all API */
+
+ /* verify parameters sanity. Adjust if needed. */
+ /* cap xfer_size with bytes per process */
+ if (cl_opts->num_iters <= 0)
+ cl_opts->num_iters = 1;
+
+ return cl_opts;
+}
+
+/*
+ * Function: parse_size_directive
+ * Purpose: Parse the size directive passed on the commandline. The size
+ * directive is an integer followed by a size indicator:
+ *
+ * K, k - Kilobyte
+ * M, m - Megabyte
+ * G, g - Gigabyte
+ *
+ * Return: The size as a off_t because this is related to file size.
+ * If an unknown size indicator is used, then the program will
+ * exit with EXIT_FAILURE as the return value.
+ * Programmer: Bill Wendling, 18. December 2001
+ * Modifications:
+ */
+
+static hsize_t
+parse_size_directive(const char *size)
+{
+ hsize_t s;
+ char *endptr;
+
+ s = HDstrtoull(size, &endptr, 10);
+
+ if (endptr && *endptr) {
+ while (*endptr != '\0' && (*endptr == ' ' || *endptr == '\t'))
+ ++endptr;
+
+ switch (*endptr) {
+ case 'K':
+ case 'k':
+ s *= ONE_KB;
+ break;
+
+ case 'M':
+ case 'm':
+ s *= ONE_MB;
+ break;
+
+ case 'G':
+ case 'g':
+ s *= ONE_GB;
+ break;
+
+ default:
+ fprintf(stderr, "Illegal size specifier '%c'\n", *endptr);
+ exit(EXIT_FAILURE);
+ }
+ }
+
+ return s;
+}
+
+/*
+ * Function: usage
+ * Purpose: Print a usage message and then exit.
+ * Return: Nothing
+ * Programmer: Bill Wendling, 31. October 2001
+ * Modifications:
+ */
+static void
+usage(const char *prog)
+{
+ print_version(prog);
+ printf("usage: %s [OPTIONS]\n", prog);
+ printf(" OPTIONS\n");
+ printf(" -h Print an usage message and exit\n");
+ printf(" -A AL Which APIs to test\n");
+ printf(" [default: all of them]\n");
+ printf(" -c SL Selects chunked storage and defines chunks dimensions\n");
+ printf(" and sizes\n");
+ printf(" [default: Off]\n");
+ printf(" -e SL Dimensions and sizes of dataset\n");
+ printf(" [default: 100,200]\n");
+ printf(" -i N Number of iterations to perform\n");
+ printf(" [default: 1]\n");
+ printf(" -r NL Dimension access order (see below for description)\n");
+ printf(" [default: 1,2]\n");
+ printf(" -t Selects extendable dimensions for HDF5 dataset\n");
+ printf(" [default: Off]\n");
+ printf(" -v VFD Selects file driver for HDF5 access\n");
+ printf(" [default: sec2]\n");
+ printf(" -w Perform write tests, not the read tests\n");
+ printf(" [default: Off]\n");
+ printf(" -x SL Dimensions and sizes of the transfer buffer\n");
+ printf(" [default: 10,20]\n");
+ printf("\n");
+ printf(" N - is an integer > 0.\n");
+ printf("\n");
+ printf(" S - is a size specifier, an integer > 0 followed by a size indicator:\n");
+ printf(" K - Kilobyte (%d)\n", ONE_KB);
+ printf(" M - Megabyte (%d)\n", ONE_MB);
+ printf(" G - Gigabyte (%d)\n", ONE_GB);
+ printf("\n");
+ printf(" Example: '37M' is 37 megabytes or %d bytes\n", 37*ONE_MB);
+ printf("\n");
+ printf(" AL - is an API list. Valid values are:\n");
+ printf(" hdf5 - HDF5\n");
+ printf(" posix - POSIX\n");
+ printf("\n");
+ printf(" Example: -A posix,hdf5\n");
+ printf("\n");
+ printf(" NL - is list of integers (N) separated by commas.\n");
+ printf("\n");
+ printf(" Example: 1,2,3\n");
+ printf("\n");
+ printf(" SL - is list of size specifiers (S) separated by commas.\n");
+ printf("\n");
+ printf(" Example: 2K,2K,3K\n");
+ printf("\n");
+ printf(" The example defines an object (dataset, tranfer buffer) with three\n");
+ printf(" dimensions. Be aware that as the number of dimensions increases, the\n");
+ printf(" the total size of the object increases exponentially.\n");
+ printf("\n");
+ printf(" VFD - is an HDF5 file driver specifier. Valid values are:\n");
+ printf(" sec2, stdio, core, split, multi, family, direct\n");
+ printf("\n");
+ printf(" Dimension access order:\n");
+ printf(" Data access starts at the cardinal origin of the dataset using the\n");
+ printf(" transfer buffer. The next access occurs on a dataset region next to\n");
+ printf(" the previous one. For a multidimensional dataset, there are several\n");
+ printf(" directions as to where to proceed. This can be specified in the dimension\n");
+ printf(" access order. For example, -r 1,2 states that the tool should traverse\n");
+ printf(" dimension 1 first, and then dimension 2.\n");
+ printf("\n");
+ printf(" Environment variables:\n");
+ printf(" HDF5_NOCLEANUP Do not remove data files if set [default remove]\n");
+ printf(" HDF5_PREFIX Data file prefix\n");
+ printf("\n");
+ fflush(stdout);
+} /* end usage() */
+
diff --git a/tools/test/perform/sio_perf.h b/tools/test/perform/sio_perf.h
new file mode 100644
index 0000000..7a7d708
--- /dev/null
+++ b/tools/test/perform/sio_perf.h
@@ -0,0 +1,104 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifndef SIO_PERF_H__
+#define SIO_PERF_H__
+
+#include "io_timer.h"
+#ifndef STANDALONE
+#include "H5private.h"
+#include "h5test.h"
+#include "h5tools.h"
+#include "h5tools_utils.h"
+#else
+#include "sio_standalone.h"
+#endif
+
+/* setup the dataset no fill option if this is v1.5 or more */
+#if H5_VERS_MAJOR > 1 || H5_VERS_MINOR > 4
+#define H5_HAVE_NOFILL 1
+#endif
+
+#define MAX_DIMS 32
+
+typedef enum iotype_ {
+ POSIXIO,
+ HDF5
+ /*NUM_TYPES*/
+} iotype;
+
+typedef enum vfdtype_ {
+ sec2,
+ stdio,
+ core,
+ split,
+ multi,
+ family,
+ direct
+ /*NUM_TYPES*/
+} vfdtype;
+
+typedef struct parameters_ {
+ iotype io_type; /* The type of IO test to perform */
+ vfdtype vfd;
+ long num_files; /* Number of files to create */
+ long num_dsets; /* Number of datasets to create */
+ hsize_t num_bytes; /* Number of bytes in each dset */
+ int num_iters; /* Number of times to loop doing the IO */
+ int rank; /* Rank of dataset */
+ hsize_t dset_size[MAX_DIMS]; /* Dataset size */
+ size_t buf_size[MAX_DIMS]; /* Buffer size */
+ size_t chk_size[MAX_DIMS]; /* Chunk size */
+ int order[MAX_DIMS]; /* Buffer size */
+ hsize_t h5_align; /* HDF5 object alignment */
+ hsize_t h5_thresh; /* HDF5 object alignment threshold */
+ int h5_use_chunks; /* Make HDF5 dataset chunked */
+ int h5_extendable; /* Make HDF5 dataset chunked */
+ int h5_write_only; /* Perform the write tests only */
+ int verify; /* Verify data correctness */
+} parameters;
+
+typedef struct results_ {
+ herr_t ret_code;
+ io_time_t *timers;
+} results;
+
+#ifndef SUCCESS
+#define SUCCESS 0
+#endif /* !SUCCESS */
+
+#ifndef FAIL
+#define FAIL -1
+#endif /* !FAIL */
+
+extern FILE *output; /* output file */
+extern io_time_t *timer_g; /* timer: global for stub functions */
+extern int sio_debug_level; /* The debug level:
+ * 0 - Off
+ * 1 - Minimal
+ * 2 - Some more
+ * 3 - Maximal
+ * 4 - Even More Debugging (timer stuff)
+ */
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+extern void do_sio(parameters param, results *res);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* PIO_PERF_H__ */
diff --git a/tools/test/perform/sio_standalone.c b/tools/test/perform/sio_standalone.c
new file mode 100644
index 0000000..d92ed30
--- /dev/null
+++ b/tools/test/perform/sio_standalone.c
@@ -0,0 +1,285 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+
+/* This file contains the definition of functions required to build h5perf in
+ * STANDALONE mode.
+ * Created: Christian Chilan, 2005/5/18.
+ */
+
+#include "sio_perf.h"
+
+
+/** From h5tools_utils.c **/
+
+/* global variables */
+int nCols = 80;
+
+/* ``get_option'' variables */
+int opt_err = 1; /*get_option prints errors if this is on */
+int opt_ind = 1; /*token pointer */
+const char *opt_arg; /*flag argument (or value) */
+
+
+int
+get_option(int argc, const char **argv, const char *opts, const struct long_options *l_opts)
+{
+ static int sp = 1; /* character index in current token */
+ int opt_opt = '?'; /* option character passed back to user */
+
+ if (sp == 1) {
+ /* check for more flag-like tokens */
+ if (opt_ind >= argc || argv[opt_ind][0] != '-' || argv[opt_ind][1] == '\0') {
+ return EOF;
+ } else if (HDstrcmp(argv[opt_ind], "--") == 0) {
+ opt_ind++;
+ return EOF;
+ }
+ }
+
+ if (sp == 1 && argv[opt_ind][0] == '-' && argv[opt_ind][1] == '-') {
+ /* long command line option */
+ const char *arg = &argv[opt_ind][2];
+ int i;
+
+ for (i = 0; l_opts && l_opts[i].name; i++) {
+ size_t len = HDstrlen(l_opts[i].name);
+
+ if (HDstrncmp(arg, l_opts[i].name, len) == 0) {
+ /* we've found a matching long command line flag */
+ opt_opt = l_opts[i].shortval;
+
+ if (l_opts[i].has_arg != no_arg) {
+ if (arg[len] == '=') {
+ opt_arg = &arg[len + 1];
+ } else if (opt_ind < (argc - 1) && argv[opt_ind + 1][0] != '-') {
+ opt_arg = argv[++opt_ind];
+ } else if (l_opts[i].has_arg == require_arg) {
+ if (opt_err)
+ HDfprintf(stderr,
+ "%s: option required for \"--%s\" flag\n",
+ argv[0], arg);
+
+ opt_opt = '?';
+ }
+ } else {
+ if (arg[len] == '=') {
+ if (opt_err)
+ HDfprintf(stderr,
+ "%s: no option required for \"%s\" flag\n",
+ argv[0], arg);
+
+ opt_opt = '?';
+ }
+
+ opt_arg = NULL;
+ }
+
+ break;
+ }
+ }
+
+ if (l_opts[i].name == NULL) {
+ /* exhausted all of the l_opts we have and still didn't match */
+ if (opt_err)
+ HDfprintf(stderr, "%s: unknown option \"%s\"\n", argv[0], arg);
+
+ opt_opt = '?';
+ }
+
+ opt_ind++;
+ sp = 1;
+ } else {
+ register char *cp; /* pointer into current token */
+
+ /* short command line option */
+ opt_opt = argv[opt_ind][sp];
+
+ if (opt_opt == ':' || (cp = strchr(opts, opt_opt)) == 0) {
+
+ if (opt_err)
+ HDfprintf(stderr, "%s: unknown option \"%c\"\n",
+ argv[0], opt_opt);
+
+ /* if no chars left in this token, move to next token */
+ if (argv[opt_ind][++sp] == '\0') {
+ opt_ind++;
+ sp = 1;
+ }
+
+ return '?';
+ }
+
+ if (*++cp == ':') {
+ /* if a value is expected, get it */
+ if (argv[opt_ind][sp + 1] != '\0') {
+ /* flag value is rest of current token */
+ opt_arg = &argv[opt_ind++][sp + 1];
+ } else if (++opt_ind >= argc) {
+ if (opt_err)
+ HDfprintf(stderr,
+ "%s: value expected for option \"%c\"\n",
+ argv[0], opt_opt);
+
+ opt_opt = '?';
+ } else {
+ /* flag value is next token */
+ opt_arg = argv[opt_ind++];
+ }
+
+ sp = 1;
+ } else {
+ /* set up to look at next char in token, next time */
+ if (argv[opt_ind][++sp] == '\0') {
+ /* no more in current token, so setup next token */
+ opt_ind++;
+ sp = 1;
+ }
+
+ opt_arg = NULL;
+ }
+ }
+
+ /* return the current flag character found */
+ return opt_opt;
+}
+
+
+void
+print_version(const char *progname)
+{
+ printf("%s: Version %u.%u.%u%s%s\n",
+ progname, H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE,
+ H5_VERS_SUBRELEASE[0] ? "-" : "", H5_VERS_SUBRELEASE);
+}
+
+
+
+/** From h5test.c **/
+
+#ifdef H5_HAVE_PARALLEL
+MPI_Info h5_io_info_g=MPI_INFO_NULL;/* MPI INFO object for IO */
+#endif
+
+#if 0
+int
+h5_set_info_object(void)
+{
+ char *envp; /* environment pointer */
+ int ret_value=0;
+
+ /* handle any MPI INFO hints via $HDF5_MPI_INFO */
+ if ((envp = getenv("HDF5_MPI_INFO")) != NULL){
+ char *next, *valp;
+
+
+ valp = envp = next = HDstrdup(envp);
+
+ /* create an INFO object if not created yet */
+ if (h5_io_info_g == MPI_INFO_NULL)
+ MPI_Info_create(&h5_io_info_g);
+
+ do {
+ size_t len;
+ char *key_val, *endp, *namep;
+
+ if (*valp == ';')
+ valp++;
+
+ /* copy key/value pair into temporary buffer */
+ len = strcspn(valp, ";");
+ next = &valp[len];
+ key_val = calloc(1, len + 1);
+
+ /* increment the next pointer past the terminating semicolon */
+ if (*next == ';')
+ ++next;
+
+ namep = HDstrncpy(key_val, valp, len);
+
+ /* pass up any beginning whitespaces */
+ while (*namep && (*namep == ' ' || *namep == '\t'))
+ namep++;
+
+ /* eat up any ending white spaces */
+ endp = &namep[strlen(namep) - 1];
+
+ while (endp && (*endp == ' ' || *endp == '\t'))
+ *endp-- = '\0';
+
+ /* find the '=' */
+
+ valp = HDstrchr(namep, '=');
+
+ if (valp != NULL) { /* it's a valid key/value pairing */
+ char *tmp_val = valp + 1;
+
+ /* change '=' to \0, move valp down one */
+ *valp-- = '\0';
+
+ /* eat up ending whitespace on the "key" part */
+ while (*valp == ' ' || *valp == '\t')
+ *valp-- = '\0';
+
+ valp = tmp_val;
+
+ /* eat up beginning whitespace on the "value" part */
+ while (*valp == ' ' || *valp == '\t')
+ *valp++ = '\0';
+
+ /* actually set the darned thing */
+ if (MPI_SUCCESS != MPI_Info_set(h5_io_info_g, namep, valp)) {
+ printf("MPI_Info_set failed\n");
+ ret_value = -1;
+ }
+ }
+
+ valp = next;
+ HDfree(key_val);
+ } while (next && *next);
+
+ HDfree(envp);
+ }
+
+ return ret_value;
+}
+
+
+void
+h5_dump_info_object(MPI_Info info)
+{
+ char key[MPI_MAX_INFO_KEY+1];
+ char value[MPI_MAX_INFO_VAL+1];
+ int flag;
+ int i, nkeys;
+
+ printf("Dumping MPI Info Object(%d) (up to %d bytes per item):\n", (int)info,
+ MPI_MAX_INFO_VAL);
+ if (info==MPI_INFO_NULL){
+ printf("object is MPI_INFO_NULL\n");
+ }
+ else {
+ MPI_Info_get_nkeys(info, &nkeys);
+ printf("object has %d items\n", nkeys);
+ for (i=0; i<nkeys; i++){
+ MPI_Info_get_nthkey(info, i, key);
+ MPI_Info_get(info, key, MPI_MAX_INFO_VAL, value, &flag);
+ printf("%s=%s\n", key, value);
+ }
+
+ }
+}
+
+#endif
+
diff --git a/tools/test/perform/sio_standalone.h b/tools/test/perform/sio_standalone.h
new file mode 100644
index 0000000..63dc7b0
--- /dev/null
+++ b/tools/test/perform/sio_standalone.h
@@ -0,0 +1,541 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifndef SIO_STANDALONE_H__
+#define SIO_PERF_H__
+
+/* Header file for building h5perf by standalone mode.
+ * Created: Christian Chilan, 2005/5/18.
+ */
+
+/** From H5private.h **/
+
+#include "H5public.h" /* Include Public Definitions */
+
+
+/*
+ * Include ANSI-C header files.
+ */
+#ifdef H5_STDC_HEADERS
+# include <assert.h>
+# include <ctype.h>
+# include <errno.h>
+# include <fcntl.h>
+# include <float.h>
+# include <limits.h>
+# include <math.h>
+# include <signal.h>
+# include <stdarg.h>
+# include <stdio.h>
+# include <stdlib.h>
+# include <string.h>
+#endif
+
+/* maximum of two, three, or four values */
+#undef MAX
+#define MAX(a,b) (((a)>(b)) ? (a) : (b))
+#define MAX2(a,b) MAX(a,b)
+#define MAX3(a,b,c) MAX(a,MAX(b,c))
+#define MAX4(a,b,c,d) MAX(MAX(a,b),MAX(c,d))
+
+/*
+ * A macro to portably increment enumerated types.
+ */
+#ifndef H5_INC_ENUM
+# define H5_INC_ENUM(TYPE,VAR) (VAR)=((TYPE)((VAR)+1))
+#endif
+
+#define H5_FLT_ABS_EQUAL(X,Y) (HDfabsf((X)-(Y)) < FLT_EPSILON)
+#define H5_DBL_ABS_EQUAL(X,Y) (HDfabs ((X)-(Y)) < DBL_EPSILON)
+#define H5_LDBL_ABS_EQUAL(X,Y) (HDfabsl((X)-(Y)) < LDBL_EPSILON)
+
+#define H5_FLT_REL_EQUAL(X,Y,M) (HDfabsf(((Y)-(X)) / (X)) < (M))
+#define H5_DBL_REL_EQUAL(X,Y,M) (HDfabs (((Y)-(X)) / (X)) < (M))
+#define H5_LDBL_REL_EQUAL(X,Y,M) (HDfabsl(((Y)-(X)) / (X)) < (M))
+
+/*
+ * Redefine all the POSIX functions. We should never see a POSIX
+ * function (or any other non-HDF5 function) in the source!
+ */
+#define HDabort() abort()
+#define HDabs(X) abs(X)
+#ifdef H5_HAVE_WIN32_API
+#define HDaccess(F,M) _access(F, M)
+#define R_OK 4 /* Test for read permission. */
+#define W_OK 2 /* Test for write permission. */
+#define X_OK 1 /* Test for execute permission. */
+#define F_OK 0 /* Test for existence. */
+#else /* H5_HAVE_WIN32_API */
+#define HDaccess(F,M) access(F, M)
+#endif /* H5_HAVE_WIN32_API */
+#define HDacos(X) acos(X)
+#ifdef H5_HAVE_ALARM
+#define HDalarm(N) alarm(N)
+#else /* H5_HAVE_ALARM */
+#define HDalarm(N) (0)
+#endif /* H5_HAVE_ALARM */
+#define HDasctime(T) asctime(T)
+#define HDasin(X) asin(X)
+#define HDasprintf asprintf /*varargs*/
+#define HDassert(X) assert(X)
+#define HDatan(X) atan(X)
+#define HDatan2(X,Y) atan2(X,Y)
+#define HDatexit(F) atexit(F)
+#define HDatof(S) atof(S)
+#define HDatoi(S) atoi(S)
+#define HDatol(S) atol(S)
+#define HDbsearch(K,B,N,Z,F) bsearch(K,B,N,Z,F)
+#define HDcalloc(N,Z) calloc(N,Z)
+#define HDceil(X) ceil(X)
+#define HDcfgetispeed(T) cfgetispeed(T)
+#define HDcfgetospeed(T) cfgetospeed(T)
+#define HDcfsetispeed(T,S) cfsetispeed(T,S)
+#define HDcfsetospeed(T,S) cfsetospeed(T,S)
+#define HDchdir(S) chdir(S)
+#define HDchmod(S,M) chmod(S,M)
+#define HDchown(S,O,G) chown(S,O,G)
+#define HDclearerr(F) clearerr(F)
+#define HDclock() clock()
+#define HDclose(F) close(F)
+#define HDclosedir(D) closedir(D)
+#define HDcos(X) cos(X)
+#define HDcosh(X) cosh(X)
+#define HDcreat(S,M) creat(S,M)
+#define HDctermid(S) ctermid(S)
+#define HDctime(T) ctime(T)
+#define HDcuserid(S) cuserid(S)
+#ifdef H5_HAVE_DIFFTIME
+#define HDdifftime(X,Y) difftime(X,Y)
+#else
+#define HDdifftime(X,Y) ((double)(X)-(double)(Y))
+#endif
+#define HDdiv(X,Y) div(X,Y)
+#define HDdup(F) dup(F)
+#define HDdup2(F,I) dup2(F,I)
+/* execl() variable arguments */
+/* execle() variable arguments */
+/* execlp() variable arguments */
+#define HDexecv(S,AV) execv(S,AV)
+#define HDexecve(S,AV,E) execve(S,AV,E)
+#define HDexecvp(S,AV) execvp(S,AV)
+#define HDexit(N) exit(N)
+#define HD_exit(N) _exit(N)
+#define HDexp(X) exp(X)
+#define HDfabs(X) fabs(X)
+/* use ABS() because fabsf() fabsl() are not common yet. */
+#define HDfabsf(X) ABS(X)
+#define HDfabsl(X) ABS(X)
+#define HDfclose(F) fclose(F)
+/* fcntl() variable arguments */
+#define HDfdopen(N,S) fdopen(N,S)
+#define HDfeof(F) feof(F)
+#define HDferror(F) ferror(F)
+#define HDfflush(F) fflush(F)
+#define HDfgetc(F) fgetc(F)
+#define HDfgetpos(F,P) fgetpos(F,P)
+#define HDfgets(S,N,F) fgets(S,N,F)
+#ifdef H5_HAVE_WIN32_API
+#define HDfileno(F) _fileno(F)
+#else /* H5_HAVE_WIN32_API */
+#define HDfileno(F) fileno(F)
+#endif /* H5_HAVE_WIN32_API */
+#define HDfloor(X) floor(X)
+#define HDfmod(X,Y) fmod(X,Y)
+#define HDfopen(S,M) fopen(S,M)
+#define HDfork() fork()
+#define HDfpathconf(F,N) fpathconf(F,N)
+H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...);
+#define HDfputc(C,F) fputc(C,F)
+#define HDfputs(S,F) fputs(S,F)
+#define HDfread(M,Z,N,F) fread(M,Z,N,F)
+#define HDfree(M) free(M)
+#define HDfreopen(S,M,F) freopen(S,M,F)
+#define HDfrexp(X,N) frexp(X,N)
+/* Check for Cray-specific 'frexpf()' and 'frexpl()' routines */
+#ifdef H5_HAVE_FREXPF
+#define HDfrexpf(X,N) frexpf(X,N)
+#else /* H5_HAVE_FREXPF */
+#define HDfrexpf(X,N) frexp(X,N)
+#endif /* H5_HAVE_FREXPF */
+#ifdef H5_HAVE_FREXPL
+#define HDfrexpl(X,N) frexpl(X,N)
+#else /* H5_HAVE_FREXPL */
+#define HDfrexpl(X,N) frexp(X,N)
+#endif /* H5_HAVE_FREXPL */
+/* fscanf() variable arguments */
+#ifdef H5_HAVE_FSEEKO
+ #define HDfseek(F,O,W) fseeko(F,O,W)
+#else
+ #define HDfseek(F,O,W) fseek(F,O,W)
+#endif
+#define HDfsetpos(F,P) fsetpos(F,P)
+/* definitions related to the file stat utilities.
+ * Windows have its own function names.
+ * For Unix, if off_t is not 64bit big, try use the pseudo-standard
+ * xxx64 versions if available.
+ */
+#ifdef H5_HAVE_WIN32_API
+ #define HDfstat(F,B) _fstati64(F,B)
+ #define HDlstat(S,B) _lstati64(S,B)
+ #define HDstat(S,B) _stati64(S,B)
+ typedef struct _stati64 h5_stat_t;
+ typedef __int64 h5_stat_size_t;
+ #define HDoff_t __int64
+#elif H5_SIZEOF_OFF_T!=8 && H5_SIZEOF_OFF64_T==8 && defined(H5_HAVE_STAT64)
+ #define HDfstat(F,B) fstat64(F,B)
+ #define HDlstat(S,B) lstat64(S,B)
+ #define HDstat(S,B) stat64(S,B)
+ typedef struct stat64 h5_stat_t;
+ typedef off64_t h5_stat_size_t;
+ #define HDoff_t off64_t
+#else
+ #define HDfstat(F,B) fstat(F,B)
+ #define HDlstat(S,B) lstat(S,B)
+ #define HDstat(S,B) stat(S,B)
+ typedef struct stat h5_stat_t;
+ typedef off_t h5_stat_size_t;
+ #define HDoff_t off_t
+#endif
+
+#ifndef H5_HAVE_WIN32_API
+/* These definitions differ in Windows and are defined in
+ * H5win32defs for that platform.
+ */
+typedef struct stat h5_stat_t;
+typedef off_t h5_stat_size_t;
+#define HDoff_t off_t
+#endif /* H5_HAVE_WIN32_API */
+
+#define HDftell(F) ftell(F)
+#define HDftruncate(F,L) ftruncate(F,L)
+#define HDfwrite(M,Z,N,F) fwrite(M,Z,N,F)
+#define HDgetc(F) getc(F)
+#define HDgetchar() getchar()
+#define HDgetcwd(S,Z) getcwd(S,Z)
+#define HDgetegid() getegid()
+#define HDgetenv(S) getenv(S)
+#define HDgeteuid() geteuid()
+#define HDgetgid() getgid()
+#define HDgetgrgid(G) getgrgid(G)
+#define HDgetgrnam(S) getgrnam(S)
+#define HDgetgroups(Z,G) getgroups(Z,G)
+#ifdef H5_HAVE_WIN32_API
+#define HDgetlogin() Wgetlogin()
+#else /* H5_HAVE_WIN32_API */
+#define HDgetlogin() getlogin()
+#endif /* H5_HAVE_WIN32_API */
+#define HDgetpgrp() getpgrp()
+#define HDgetpid() getpid()
+#define HDgetppid() getppid()
+#define HDgetpwnam(S) getpwnam(S)
+#define HDgetpwuid(U) getpwuid(U)
+#define HDgetrusage(X,S) getrusage(X,S)
+#define HDgets(S) gets(S)
+#ifdef H5_HAVE_WIN32_API
+ H5_DLL int Wgettimeofday(struct timeval *tv, struct timezone *tz);
+#define HDgettimeofday(V,Z) Wgettimeofday(V,Z)
+#else /* H5_HAVE_WIN32_API */
+#define HDgettimeofday(S,P) gettimeofday(S,P)
+#endif /* H5_HAVE_WIN32_API */
+#define HDgetuid() getuid()
+#define HDgmtime(T) gmtime(T)
+#define HDisalnum(C) isalnum((int)(C)) /*cast for solaris warning*/
+#define HDisalpha(C) isalpha((int)(C)) /*cast for solaris warning*/
+#define HDisatty(F) isatty(F)
+#define HDiscntrl(C) iscntrl((int)(C)) /*cast for solaris warning*/
+#define HDisdigit(C) isdigit((int)(C)) /*cast for solaris warning*/
+#define HDisgraph(C) isgraph((int)(C)) /*cast for solaris warning*/
+#define HDislower(C) islower((int)(C)) /*cast for solaris warning*/
+#define HDisprint(C) isprint((int)(C)) /*cast for solaris warning*/
+#define HDispunct(C) ispunct((int)(C)) /*cast for solaris warning*/
+#define HDisspace(C) isspace((int)(C)) /*cast for solaris warning*/
+#define HDisupper(C) isupper((int)(C)) /*cast for solaris warning*/
+#define HDisxdigit(C) isxdigit((int)(C)) /*cast for solaris warning*/
+#define HDkill(P,S) kill(P,S)
+#define HDlabs(X) labs(X)
+#define HDldexp(X,N) ldexp(X,N)
+#define HDldiv(X,Y) ldiv(X,Y)
+#define HDlink(OLD,NEW) link(OLD,NEW)
+#define HDlocaleconv() localeconv()
+#define HDlocaltime(T) localtime(T)
+#define HDlog(X) log(X)
+#define HDlog10(X) log10(X)
+#define HDlongjmp(J,N) longjmp(J,N)
+#ifdef H5_HAVE_WIN32_API
+ #define HDlseek(F,O,W) _lseeki64(F,O,W)
+#else
+ #ifdef H5_HAVE_LSEEK64
+ #define HDlseek(F,O,W) lseek64(F,O,W)
+ #else
+ #define HDlseek(F,O,W) lseek(F,O,W)
+ #endif
+#endif
+#define HDmalloc(Z) malloc(Z)
+#define HDposix_memalign(P,A,Z) posix_memalign(P,A,Z)
+#define HDmblen(S,N) mblen(S,N)
+#define HDmbstowcs(P,S,Z) mbstowcs(P,S,Z)
+#define HDmbtowc(P,S,Z) mbtowc(P,S,Z)
+#define HDmemchr(S,C,Z) memchr(S,C,Z)
+#define HDmemcmp(X,Y,Z) memcmp(X,Y,Z)
+/*
+ * The (char*) casts are required for the DEC when optimizations are turned
+ * on and the source and/or destination are not aligned.
+ */
+#define HDmemcpy(X,Y,Z) memcpy((char*)(X),(const char*)(Y),Z)
+#define HDmemmove(X,Y,Z) memmove((char*)(X),(const char*)(Y),Z)
+/*
+ * The (void*) cast just avoids a compiler warning in H5_HAVE_VISUAL_STUDIO
+ */
+#ifdef H5_HAVE_VISUAL_STUDIO
+#define HDmemset(X,C,Z) memset((void*)(X),C,Z)
+#else /* H5_HAVE_VISUAL_STUDIO */
+#define HDmemset(X,C,Z) memset(X,C,Z)
+#endif /* H5_HAVE_VISUAL_STUDIO */
+#ifdef H5_HAVE_WIN32_API
+#define HDmkdir(S,M) _mkdir(S)
+#else /* H5_HAVE_WIN32_API */
+#define HDmkdir(S,M) mkdir(S,M)
+#endif /* H5_HAVE_WIN32_API */
+#define HDmkfifo(S,M) mkfifo(S,M)
+#define HDmktime(T) mktime(T)
+#define HDmodf(X,Y) modf(X,Y)
+#ifdef _O_BINARY
+#define HDopen(S,F,M) open(S,F|_O_BINARY,M)
+#else
+#define HDopen(S,F,M) open(S,F,M)
+#endif
+#define HDopendir(S) opendir(S)
+#define HDpathconf(S,N) pathconf(S,N)
+#define HDpause() pause()
+#define HDperror(S) perror(S)
+#define HDpipe(F) pipe(F)
+#define HDpow(X,Y) pow(X,Y)
+/* printf() variable arguments */
+#define HDputc(C,F) putc(C,F)
+#define HDputchar(C) putchar(C)
+#define HDputs(S) puts(S)
+#define HDqsort(M,N,Z,F) qsort(M,N,Z,F)
+#define HDraise(N) raise(N)
+
+#ifdef H5_HAVE_RAND_R
+#define HDrandom() HDrand()
+H5_DLL int HDrand(void);
+#elif H5_HAVE_RANDOM
+#define HDrand() random()
+#define HDrandom() random()
+#else
+#define HDrand() rand()
+#define HDrandom() rand()
+#endif
+
+#define HDread(F,M,Z) read(F,M,Z)
+#define HDreaddir(D) readdir(D)
+#define HDrealloc(M,Z) realloc(M,Z)
+#define HDremove(S) remove(S)
+#define HDrename(OLD,NEW) rename(OLD,NEW)
+#define HDrewind(F) rewind(F)
+#define HDrewinddir(D) rewinddir(D)
+#define HDrmdir(S) rmdir(S)
+/* scanf() variable arguments */
+#define HDsetbuf(F,S) setbuf(F,S)
+#define HDsetgid(G) setgid(G)
+#define HDsetjmp(J) setjmp(J)
+#define HDsetlocale(N,S) setlocale(N,S)
+#define HDsetpgid(P,PG) setpgid(P,PG)
+#define HDsetsid() setsid()
+#define HDsetuid(U) setuid(U)
+/* Windows does not permit setting the buffer size to values
+ less than 2. */
+#ifndef H5_HAVE_WIN32_API
+#define HDsetvbuf(F,S,M,Z) setvbuf(F,S,M,Z)
+#else
+#define HDsetvbuf(F,S,M,Z) setvbuf(F,S,M,(Z>1?Z:2))
+#endif
+#define HDsigaddset(S,N) sigaddset(S,N)
+#define HDsigdelset(S,N) sigdelset(S,N)
+#define HDsigemptyset(S) sigemptyset(S)
+#define HDsigfillset(S) sigfillset(S)
+#define HDsigismember(S,N) sigismember(S,N)
+#define HDsiglongjmp(J,N) siglongjmp(J,N)
+#define HDsignal(N,F) signal(N,F)
+#define HDsigpending(S) sigpending(S)
+#define HDsigprocmask(H,S,O) sigprocmask(H,S,O)
+#define HDsigsetjmp(J,N) sigsetjmp(J,N)
+#define HDsigsuspend(S) sigsuspend(S)
+#define HDsin(X) sin(X)
+#define HDsinh(X) sinh(X)
+#define HDsleep(N) sleep(N)
+#ifdef H5_HAVE_WIN32_API
+H5_DLL int c99_snprintf(char* str, size_t size, const char* format, ...);
+#define HDsnprintf c99_snprintf /*varargs*/
+#else
+#define HDsnprintf snprintf /*varargs*/
+#endif
+/* sprintf() variable arguments */
+#define HDsqrt(X) sqrt(X)
+#ifdef H5_HAVE_RAND_R
+H5_DLL void HDsrand(unsigned int seed);
+#define HDsrandom(S) HDsrand(S)
+#elif H5_HAVE_RANDOM
+#define HDsrand(S) srandom(S)
+#define HDsrandom(S) srandom(S)
+#else
+#define HDsrand(S) srand(S)
+#define HDsrandom(S) srand(S)
+#endif
+/* sscanf() variable arguments */
+
+#ifdef H5_HAVE_WIN32_API
+#define HDstrcasecmp(A,B) _stricmp(A,B)
+#else
+#define HDstrcasecmp(X,Y) strcasecmp(X,Y)
+#endif
+#define HDstrcat(X,Y) strcat(X,Y)
+#define HDstrchr(S,C) strchr(S,C)
+#define HDstrcmp(X,Y) strcmp(X,Y)
+#define HDstrcoll(X,Y) strcoll(X,Y)
+#define HDstrcpy(X,Y) strcpy(X,Y)
+#define HDstrcspn(X,Y) strcspn(X,Y)
+#define HDstrerror(N) strerror(N)
+#define HDstrftime(S,Z,F,T) strftime(S,Z,F,T)
+#define HDstrlen(S) strlen(S)
+#define HDstrncat(X,Y,Z) strncat(X,Y,Z)
+#define HDstrncmp(X,Y,Z) strncmp(X,Y,Z)
+#define HDstrncpy(X,Y,Z) strncpy(X,Y,Z)
+#define HDstrpbrk(X,Y) strpbrk(X,Y)
+#define HDstrrchr(S,C) strrchr(S,C)
+#define HDstrspn(X,Y) strspn(X,Y)
+#define HDstrstr(X,Y) strstr(X,Y)
+#define HDstrtod(S,R) strtod(S,R)
+#define HDstrtok(X,Y) strtok(X,Y)
+#define HDstrtol(S,R,N) strtol(S,R,N)
+H5_DLL int64_t HDstrtoll (const char *s, const char **rest, int base);
+#define HDstrtoul(S,R,N) strtoul(S,R,N)
+#ifdef H5_HAVE_WIN32_API
+#define HDstrtoull(S,R,N) _strtoui64(S,R,N)
+#else
+#define HDstrtoull(S,R,N) strtoull(S,R,N)
+#endif
+#define HDstrxfrm(X,Y,Z) strxfrm(X,Y,Z)
+#define HDsysconf(N) sysconf(N)
+#define HDsystem(S) system(S)
+#define HDtan(X) tan(X)
+#define HDtanh(X) tanh(X)
+#define HDtcdrain(F) tcdrain(F)
+#define HDtcflow(F,A) tcflow(F,A)
+#define HDtcflush(F,N) tcflush(F,N)
+#define HDtcgetattr(F,T) tcgetattr(F,T)
+#define HDtcgetpgrp(F) tcgetpgrp(F)
+#define HDtcsendbreak(F,N) tcsendbreak(F,N)
+#define HDtcsetattr(F,O,T) tcsetattr(F,O,T)
+#define HDtcsetpgrp(F,N) tcsetpgrp(F,N)
+#define HDtime(T) time(T)
+#define HDtimes(T) times(T)
+#define HDtmpfile() tmpfile()
+#define HDtmpnam(S) tmpnam(S)
+#define HDtolower(C) tolower(C)
+#define HDtoupper(C) toupper(C)
+#define HDttyname(F) ttyname(F)
+#define HDtzset() tzset()
+#define HDumask(N) umask(N)
+#define HDuname(S) uname(S)
+#define HDungetc(C,F) ungetc(C,F)
+#ifdef H5_HAVE_WIN32_API
+#define HDunlink(S) _unlink(S)
+#else
+#define HDunlink(S) unlink(S)
+#endif
+#define HDutime(S,T) utime(S,T)
+#define HDva_arg(A,T) va_arg(A,T)
+#define HDva_end(A) va_end(A)
+#define HDva_start(A,P) va_start(A,P)
+#define HDvasprintf(RET,FMT,A) vasprintf(RET,FMT,A)
+#define HDvfprintf(F,FMT,A) vfprintf(F,FMT,A)
+#define HDvprintf(FMT,A) vprintf(FMT,A)
+#define HDvsprintf(S,FMT,A) vsprintf(S,FMT,A)
+#ifdef H5_HAVE_WIN32_API
+H5_DLL int c99_vsnprintf(char* str, size_t size, const char* format, va_list ap);
+#define HDvsnprintf c99_vsnprintf
+#else
+# define HDvsnprintf(S,N,FMT,A) vsnprintf(S,N,FMT,A)
+#endif
+#define HDwait(W) wait(W)
+#define HDwaitpid(P,W,O) waitpid(P,W,O)
+#define HDwcstombs(S,P,Z) wcstombs(S,P,Z)
+#define HDwctomb(S,C) wctomb(S,C)
+#define HDwrite(F,M,Z) write(F,M,Z)
+
+/*
+ * And now for a couple non-Posix functions... Watch out for systems that
+ * define these in terms of macros.
+ */
+#ifdef H5_HAVE_WIN32_API
+#define HDstrdup(S) _strdup(S)
+#else /* H5_HAVE_WIN32_API */
+
+#if !defined strdup && !defined H5_HAVE_STRDUP
+extern char *strdup(const char *s);
+#endif
+
+#define HDstrdup(S) strdup(S)
+
+#endif /* H5_HAVE_WIN32_API */
+
+/*
+ * HDF Boolean type.
+ */
+#ifndef FALSE
+# define FALSE false
+#endif
+#ifndef TRUE
+# define TRUE true
+#endif
+
+/** From h5test.h **/
+
+#ifdef H5_HAVE_PARALLEL
+extern MPI_Info h5_io_info_g; /* MPI INFO object for IO */
+#endif
+
+#ifdef H5_HAVE_PARALLEL
+H5TEST_DLL int h5_set_info_object(void);
+H5TEST_DLL void h5_dump_info_object(MPI_Info info);
+#endif
+
+
+
+/** From h5tools_utils.h **/
+
+extern int opt_err; /* getoption prints errors if this is on */
+extern int opt_ind; /* token pointer */
+extern const char *opt_arg; /* flag argument (or value) */
+
+
+enum {
+ no_arg = 0, /* doesn't take an argument */
+ require_arg, /* requires an argument */
+ optional_arg /* argument is optional */
+};
+
+
+typedef struct long_options {
+ const char *name; /* name of the long option */
+ int has_arg; /* whether we should look for an arg */
+ char shortval; /* the shortname equivalent of long arg
+ * this gets returned from get_option */
+} long_options;
+
+extern int get_option(int argc, const char **argv, const char *opt,
+ const struct long_options *l_opt);
+#endif
diff --git a/tools/test/perform/zip_perf.c b/tools/test/perform/zip_perf.c
new file mode 100644
index 0000000..d9b1fa2
--- /dev/null
+++ b/tools/test/perform/zip_perf.c
@@ -0,0 +1,644 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* ===========================================================================
+ * Usage: zip_perf [-d] [-f] [-h] [-1 to -9] [files...]
+ * -d : decompress
+ * -f : compress with Z_FILTERED
+ * -h : compress with Z_HUFFMAN_ONLY
+ * -1 to -9 : compression level
+ */
+
+/* our header files */
+#include "h5test.h"
+#include "h5tools.h"
+#include "h5tools_utils.h"
+
+#ifdef H5_HAVE_FILTER_DEFLATE
+
+#include <zlib.h>
+
+#define ONE_KB 1024
+#define ONE_MB (ONE_KB * ONE_KB)
+#define ONE_GB (ONE_MB * ONE_KB)
+
+#define MICROSECOND 1000000.0F
+
+/* report 0.0 in case t is zero too */
+#define MB_PER_SEC(bytes,t) ((fabs(t) < (double)0.0000000001F) ? (double)0.0F : ((((double)bytes) / (double)ONE_MB) / (t)))
+
+#ifndef TRUE
+#define TRUE 1
+#endif /* TRUE */
+
+#ifndef FALSE
+#define FALSE (!TRUE)
+#endif /* FALSE */
+
+#ifndef S_IRWXU
+#define S_IRWXU (_S_IREAD|_S_IWRITE)
+#endif
+
+/* internal variables */
+static const char *prog=NULL;
+static const char *option_prefix=NULL;
+static char *filename=NULL;
+static int compress_percent = 0;
+static int compress_level = Z_DEFAULT_COMPRESSION;
+static int output, random_test = FALSE;
+static int report_once_flag;
+static double compression_time;
+
+/* internal functions */
+static void error(const char *fmt, ...);
+static void compress_buffer(Bytef *dest, uLongf *destLen, const Bytef *source,
+ uLong sourceLen);
+
+/* commandline options : long and short form */
+static const char *s_opts = "hB:b:c:p:rs:0123456789";
+static struct long_options l_opts[] = {
+ { "help", no_arg, 'h' },
+ { "compressability", require_arg, 'c' },
+ { "compressabilit", require_arg, 'c' },
+ { "compressabili", require_arg, 'c' },
+ { "compressabil", require_arg, 'c' },
+ { "compressabi", require_arg, 'c' },
+ { "compressab", require_arg, 'c' },
+ { "compressa", require_arg, 'c' },
+ { "compress", require_arg, 'c' },
+ { "compres", require_arg, 'c' },
+ { "compre", require_arg, 'c' },
+ { "compr", require_arg, 'c' },
+ { "comp", require_arg, 'c' },
+ { "com", require_arg, 'c' },
+ { "co", require_arg, 'c' },
+ { "file-size", require_arg, 's' },
+ { "file-siz", require_arg, 's' },
+ { "file-si", require_arg, 's' },
+ { "file-s", require_arg, 's' },
+ { "file", require_arg, 's' },
+ { "fil", require_arg, 's' },
+ { "fi", require_arg, 's' },
+ { "max-buffer-size", require_arg, 'B' },
+ { "max-buffer-siz", require_arg, 'B' },
+ { "max-buffer-si", require_arg, 'B' },
+ { "max-buffer-s", require_arg, 'B' },
+ { "max-buffer", require_arg, 'B' },
+ { "max-buffe", require_arg, 'B' },
+ { "max-buff", require_arg, 'B' },
+ { "max-buf", require_arg, 'B' },
+ { "max-bu", require_arg, 'B' },
+ { "max-b", require_arg, 'B' },
+ { "max", require_arg, 'B' },
+ { "min-buffer-size", require_arg, 'b' },
+ { "min-buffer-siz", require_arg, 'b' },
+ { "min-buffer-si", require_arg, 'b' },
+ { "min-buffer-s", require_arg, 'b' },
+ { "min-buffer", require_arg, 'b' },
+ { "min-buffe", require_arg, 'b' },
+ { "min-buff", require_arg, 'b' },
+ { "min-buf", require_arg, 'b' },
+ { "min-bu", require_arg, 'b' },
+ { "min-b", require_arg, 'b' },
+ { "min", require_arg, 'b' },
+ { "prefix", require_arg, 'p' },
+ { "prefi", require_arg, 'p' },
+ { "pref", require_arg, 'p' },
+ { "pre", require_arg, 'p' },
+ { "pr", require_arg, 'p' },
+ { "random-test", no_arg, 'r' },
+ { "random-tes", no_arg, 'r' },
+ { "random-te", no_arg, 'r' },
+ { "random-t", no_arg, 'r' },
+ { "random", no_arg, 'r' },
+ { "rando", no_arg, 'r' },
+ { "rand", no_arg, 'r' },
+ { "ran", no_arg, 'r' },
+ { "ra", no_arg, 'r' },
+ { NULL, 0, '\0' }
+};
+
+/*
+ * Function: error
+ * Purpose: Display error message and exit.
+ * Programmer: Bill Wendling, 05. June 2002
+ * Modifications:
+ */
+static void
+error(const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ HDfprintf(stderr, "%s: error: ", prog);
+ HDvfprintf(stderr, fmt, ap);
+ HDfprintf(stderr, "\n");
+ va_end(ap);
+ HDexit(EXIT_FAILURE);
+}
+
+/*
+ * Function: cleanup
+ * Purpose: Cleanup the output file.
+ * Returns: Nothing
+ * Programmer: Bill Wendling, 06. June 2002
+ * Modifications:
+ */
+static void
+cleanup(void)
+{
+ if (!HDgetenv("HDF5_NOCLEANUP"))
+ HDunlink(filename);
+ HDfree(filename);
+}
+
+static void
+write_file(Bytef *source, uLongf sourceLen)
+{
+ Bytef *d_ptr, *dest;
+ uLongf d_len, destLen;
+ struct timeval timer_start, timer_stop;
+
+ /* destination buffer needs to be at least 0.1% larger than sourceLen
+ * plus 12 bytes */
+ destLen = (uLongf)((double)sourceLen + ((double)sourceLen * (double)0.1F)) + 12;
+ dest = (Bytef *)HDmalloc(destLen);
+
+ if (!dest)
+ error("out of memory");
+
+ HDgettimeofday(&timer_start, NULL);
+ compress_buffer(dest, &destLen, source, sourceLen);
+ HDgettimeofday(&timer_stop, NULL);
+
+ compression_time += ((double)timer_stop.tv_sec +
+ ((double)timer_stop.tv_usec) / (double)MICROSECOND) -
+ ((double)timer_start.tv_sec +
+ ((double)timer_start.tv_usec) / (double)MICROSECOND);
+
+ if (report_once_flag) {
+ HDfprintf(stdout, "\tCompression Ratio: %g\n", ((double)destLen) / (double)sourceLen);
+ report_once_flag = 0;
+ }
+
+ d_ptr = dest;
+ d_len = destLen;
+
+ /* loop to make sure we write everything out that we want to write */
+ for (;;) {
+ int rc = (int)HDwrite(output, d_ptr, (size_t)d_len);
+
+ if (rc == -1)
+ error(HDstrerror(errno));
+
+ if (rc == (int)d_len)
+ break;
+
+ d_len -= (size_t)rc;
+ d_ptr += rc;
+ }
+
+ HDfree(dest);
+}
+
+/*
+ * Function: compress_buffer
+ * Purpose: Compress the buffer.
+ * Returns: Z_OK - success
+ * Z_MEM_ERROR - not enough memory
+ * Z_BUF_ERROR - not enough room in the output buffer
+ * Z_STREAM_ERROR - level parameter is invalid
+ * Programmer: Bill Wendling, 05. June 2002
+ * Modifications:
+ */
+static void
+compress_buffer(Bytef *dest, uLongf *destLen, const Bytef *source,
+ uLong sourceLen)
+{
+ int rc = compress2(dest, destLen, source, sourceLen, compress_level);
+
+ if (rc != Z_OK) {
+ /* compress2 failed - cleanup and tell why */
+ cleanup();
+
+ switch (rc) {
+ case Z_MEM_ERROR:
+ error("not enough memory");
+ break;
+ case Z_BUF_ERROR:
+ error("not enough room in the output buffer");
+ break;
+ case Z_STREAM_ERROR:
+ error("level parameter (%d) is invalid", compress_level);
+ break;
+ default:
+ error("unknown compression error");
+ break;
+ }
+ }
+}
+
+#ifdef LATER
+/*
+ * Function: uncompress_buffer
+ * Purpose: Uncompress the buffer.
+ * Returns: Z_OK - success
+ * Z_MEM_ERROR - not enough memory
+ * Z_BUF_ERROR - not enough room in the output buffer
+ * Z_DATA_ERROR - the input data was corrupted
+ * Programmer: Bill Wendling, 05. June 2002
+ * Modifications:
+ */
+static int
+uncompress_buffer(Bytef *dest, uLongf *destLen, const Bytef *source,
+ uLong sourceLen)
+{
+ int rc = uncompress(dest, destLen, source, sourceLen);
+
+ return rc;
+}
+#endif /* LATER */
+
+/*
+ * Function: get_unique_name
+ * Purpose: Create a new file who's name doesn't conflict with
+ * pre-existing files.
+ * Returns: Nothing
+ * Programmer: Bill Wendling, 06. June 2002
+ * Modifications:
+ */
+#define ZIP_PERF_FILE "zip_perf.data"
+static void
+get_unique_name(void)
+{
+ const char *prefix = NULL;
+ const char *env = HDgetenv("HDF5_PREFIX");
+
+ if (env)
+ prefix = env;
+
+ if (option_prefix)
+ prefix = option_prefix;
+
+ if (prefix)
+ /* 2 = 1 for '/' + 1 for null terminator */
+ filename = (char *) HDmalloc(HDstrlen(prefix) + HDstrlen(ZIP_PERF_FILE) + 2);
+ else
+ filename = (char *) HDmalloc(HDstrlen(ZIP_PERF_FILE) + 1);
+
+ if (!filename)
+ error("out of memory");
+
+ filename[0] = 0;
+ if (prefix){
+ HDstrcpy(filename, prefix);
+ HDstrcat(filename, "/");
+ }
+ HDstrcat(filename, ZIP_PERF_FILE);
+}
+
+/*
+ * Function: usage
+ * Purpose: Print a usage message and then exit.
+ * Return: Nothing
+ * Programmer: Bill Wendling, 05. June 2002
+ * Modifications:
+ */
+static void
+usage(void)
+{
+ HDfprintf(stdout, "usage: %s [OPTIONS]\n", prog);
+ HDfprintf(stdout, " OPTIONS\n");
+ HDfprintf(stdout, " -h, --help Print this usage message and exit\n");
+ HDfprintf(stdout, " -1...-9 Level of compression, from 1 to 9\n");
+ HDfprintf(stdout, " -c P, --compressability=P Percentage of compressability of the random\n");
+ HDfprintf(stdout, " data you want [default: 0]");
+ HDfprintf(stdout, " -s S, --file-size=S Maximum size of uncompressed file [default: 64M]\n");
+ HDfprintf(stdout, " -B S, --max-buffer_size=S Maximum size of buffer [default: 1M]\n");
+ HDfprintf(stdout, " -b S, --min-buffer_size=S Minumum size of buffer [default: 128K]\n");
+ HDfprintf(stdout, " -p D, --prefix=D The directory prefix to place the file\n");
+ HDfprintf(stdout, " -r, --random-test Use random data to write to the file\n");
+ HDfprintf(stdout, " [default: no]\n");
+ HDfprintf(stdout, "\n");
+ HDfprintf(stdout, " D - a directory which exists\n");
+ HDfprintf(stdout, " P - a number between 0 and 100\n");
+ HDfprintf(stdout, " S - is a size specifier, an integer >=0 followed by a size indicator:\n");
+ HDfprintf(stdout, "\n");
+ HDfprintf(stdout, " K - Kilobyte (%d)\n", ONE_KB);
+ HDfprintf(stdout, " M - Megabyte (%d)\n", ONE_MB);
+ HDfprintf(stdout, " G - Gigabyte (%d)\n", ONE_GB);
+ HDfprintf(stdout, "\n");
+ HDfprintf(stdout, " Example: 37M = 37 Megabytes = %d bytes\n", 37 * ONE_MB);
+ HDfprintf(stdout, "\n");
+ HDfflush(stdout);
+}
+
+/*
+ * Function: parse_size_directive
+ * Purpose: Parse the size directive passed on the commandline. The size
+ * directive is an integer followed by a size indicator:
+ *
+ * K, k - Kilobyte
+ * M, m - Megabyte
+ *
+ * Return: The size as a size_t because this is related to buffer size.
+ * If an unknown size indicator is used, then the program will
+ * exit with EXIT_FAILURE as the return value.
+ * Programmer: Bill Wendling, 05. June 2002
+ * Modifications:
+ */
+static unsigned long
+parse_size_directive(const char *size)
+{
+ unsigned long s;
+ char *endptr;
+
+ s = HDstrtoul(size, &endptr, 10);
+
+ if (endptr && *endptr) {
+ while (*endptr != '\0' && (*endptr == ' ' || *endptr == '\t'))
+ ++endptr;
+
+ switch (*endptr) {
+ case 'K':
+ case 'k':
+ s *= ONE_KB;
+ break;
+ case 'M':
+ case 'm':
+ s *= ONE_MB;
+ break;
+ case 'G':
+ case 'g':
+ s *= ONE_GB;
+ break;
+ default:
+ error("illegal size specifier '%c'", *endptr);
+ break;
+ }
+ }
+
+ return s;
+}
+
+static void
+fill_with_random_data(Bytef *src, uLongf src_len)
+{
+ register unsigned u;
+ h5_stat_t stat_buf;
+
+ if (HDstat("/dev/urandom", &stat_buf) == 0) {
+ uLongf len = src_len;
+ Bytef *buf = src;
+ int fd = HDopen("/dev/urandom", O_RDONLY, 0);
+
+ HDfprintf(stdout, "Using /dev/urandom for random data\n");
+
+ if (fd < 0)
+ error(HDstrerror(errno));
+
+ for (;;) {
+ ssize_t rc = HDread(fd, buf, src_len);
+
+ if (rc == -1)
+ error(HDstrerror(errno));
+
+ if (rc == (ssize_t)len)
+ break;
+
+ buf += rc;
+ len -= (size_t)rc;
+ }
+ } else {
+ HDfprintf(stdout, "Using random() for random data\n");
+
+ for (u = 0; u < src_len; ++u)
+ src[u] = (Bytef)(0xff & HDrandom());
+ }
+
+ if (compress_percent) {
+ size_t s = (size_t)((src_len * (uLongf)compress_percent) / 100);
+
+ HDmemset(src, '\0', s);
+ }
+}
+
+static void
+do_write_test(unsigned long file_size, unsigned long min_buf_size,
+ unsigned long max_buf_size)
+{
+ uLongf src_len, total_len;
+ struct timeval timer_start, timer_stop;
+ double total_time;
+ Bytef *src;
+
+ for (src_len = min_buf_size; src_len <= max_buf_size; src_len <<= 1) {
+ register unsigned long i, iters;
+
+ iters = file_size / src_len;
+ src = (Bytef *)HDcalloc(1, sizeof(Bytef) * src_len);
+
+ if (!src) {
+ cleanup();
+ error("out of memory");
+ }
+
+ compression_time = 0.0F;
+
+ if (random_test)
+ fill_with_random_data(src, src_len);
+
+ HDfprintf(stdout, "Buffer size == ");
+
+ if (src_len >= ONE_KB && (src_len % ONE_KB) == 0) {
+ if (src_len >= ONE_MB && (src_len % ONE_MB) == 0) {
+ HDfprintf(stdout, "%ldMB", src_len / ONE_MB);
+ } else {
+ HDfprintf(stdout, "%ldKB", src_len / ONE_KB);
+ }
+ } else {
+ HDfprintf(stdout, "%ld", src_len);
+ }
+
+ HDfprintf(stdout, "\n");
+
+ /* do uncompressed data write */
+ HDgettimeofday(&timer_start, NULL);
+ output = HDopen(filename, O_RDWR | O_CREAT, S_IRWXU);
+
+ if (output == -1)
+ error(HDstrerror(errno));
+
+ for (i = 0; i <= iters; ++i) {
+ Bytef *s_ptr = src;
+ uLong s_len = src_len;
+
+ /* loop to make sure we write everything out that we want to write */
+ for (;;) {
+ ssize_t rc = HDwrite(output, s_ptr, s_len);
+
+ if (rc == -1)
+ error(HDstrerror(errno));
+
+ if (rc == (ssize_t)s_len)
+ break;
+
+ s_len -= (size_t)rc;
+ s_ptr += rc;
+ }
+ }
+
+ HDclose(output);
+ HDgettimeofday(&timer_stop, NULL);
+
+ total_time = ((double)timer_stop.tv_sec +
+ ((double)timer_stop.tv_usec) / (double)MICROSECOND) -
+ ((double)timer_start.tv_sec +
+ ((double)timer_start.tv_usec) / (double)MICROSECOND);
+
+ HDfprintf(stdout, "\tUncompressed Write Time: %.2fs\n", total_time);
+ HDfprintf(stdout, "\tUncompressed Write Throughput: %.2fMB/s\n",
+ MB_PER_SEC(file_size, total_time));
+
+ HDunlink(filename);
+
+ /* do compressed data write */
+ output = HDopen(filename, O_RDWR | O_CREAT, S_IRWXU);
+
+ if (output == -1)
+ error(HDstrerror(errno));
+
+ report_once_flag = 1;
+ HDgettimeofday(&timer_start, NULL);
+
+ for (total_len = 0; total_len < file_size; total_len += src_len)
+ write_file(src, src_len);
+
+ HDclose(output);
+ HDgettimeofday(&timer_stop, NULL);
+
+ total_time = ((double)timer_stop.tv_sec +
+ ((double)timer_stop.tv_usec) / (double)MICROSECOND) -
+ ((double)timer_start.tv_sec +
+ ((double)timer_start.tv_usec) / (double)MICROSECOND);
+
+ HDfprintf(stdout, "\tCompressed Write Time: %.2fs\n", total_time);
+ HDfprintf(stdout, "\tCompressed Write Throughput: %.2fMB/s\n",
+ MB_PER_SEC(file_size, total_time));
+ HDfprintf(stdout, "\tCompression Time: %gs\n", compression_time);
+
+ HDunlink(filename);
+ HDfree(src);
+ }
+}
+
+/*
+ * Function: main
+ * Purpose: Run the program
+ * Return: EXIT_SUCCESS or EXIT_FAILURE
+ * Programmer: Bill Wendling, 05. June 2002
+ * Modifications:
+ */
+int
+main(int argc, char **argv)
+{
+ unsigned long min_buf_size = 128 * ONE_KB, max_buf_size = ONE_MB;
+ unsigned long file_size = 64 * ONE_MB;
+ int opt;
+
+ prog = argv[0];
+
+ /* Initialize h5tools lib */
+ h5tools_init();
+
+ while ((opt = get_option(argc, (const char **)argv, s_opts, l_opts)) > 0) {
+ switch ((char)opt) {
+ case '0': case '1': case '2':
+ case '3': case '4': case '5':
+ case '6': case '7': case '8':
+ case '9':
+ compress_level = opt - '0';
+ break;
+ case 'B':
+ max_buf_size = parse_size_directive(opt_arg);
+ break;
+ case 'b':
+ min_buf_size = parse_size_directive(opt_arg);
+ break;
+ case 'c':
+ compress_percent = (int)HDstrtol(opt_arg, NULL, 10);
+
+ if (compress_percent < 0)
+ compress_percent = 0;
+ else if (compress_percent > 100)
+ compress_percent = 100;
+
+ break;
+ case 'p':
+ option_prefix = opt_arg;
+ break;
+ case 'r':
+ random_test = TRUE;
+ break;
+ case 's':
+ file_size = parse_size_directive(opt_arg);
+ break;
+ case '?':
+ usage();
+ exit(EXIT_FAILURE);
+ break;
+ case 'h':
+ default:
+ usage();
+ exit(EXIT_SUCCESS);
+ break;
+ }
+ }
+
+ if (min_buf_size > max_buf_size)
+ error("minmum buffer size (%d) exceeds maximum buffer size (%d)",
+ min_buf_size, max_buf_size);
+
+ HDfprintf(stdout, "Filesize: %ld\n", file_size);
+
+ if (compress_level == Z_DEFAULT_COMPRESSION)
+ HDfprintf(stdout, "Compression Level: 6\n");
+ else
+ HDfprintf(stdout, "Compression Level: %d\n", compress_level);
+
+ get_unique_name();
+ do_write_test(file_size, min_buf_size, max_buf_size);
+ cleanup();
+ return EXIT_SUCCESS;
+}
+
+#else
+
+/*
+ * Function: main
+ * Purpose: Dummy main() function for if HDF5 was configured without
+ * zlib stuff.
+ * Return: EXIT_SUCCESS
+ * Programmer: Bill Wendling, 10. June 2002
+ * Modifications:
+ */
+int
+main(void)
+{
+ HDfprintf(stdout, "No compression IO performance because zlib was not configured\n");
+ return EXIT_SUCCESS;
+}
+
+#endif /* !H5_HAVE_FILTER_DEFLATE */