From 14d8e1c2b5ecaf2e298984f269094dd5f2bd735f Mon Sep 17 00:00:00 2001 From: Vailin Choi Date: Fri, 19 Apr 2013 10:23:01 -0500 Subject: [svn-r23600] Bring revisions #23085 - #23341 from trunk to revise_chunks. h5committested. --- CMakeLists.txt | 23 +- COPYING | 2 +- CTestConfig.cmake | 2 + MANIFEST | 81 +- Makefile.in | 2 +- README.txt | 2 +- bin/checkposix | 2 +- bin/cmakehdf5 | 223 +++++ bin/trace | 2 + c++/CMakeLists.txt | 2 +- c++/Makefile.in | 2 +- c++/examples/CMakeLists.txt | 2 +- c++/examples/Makefile.in | 2 +- c++/src/CMakeLists.txt | 2 +- c++/src/H5CommonFG.cpp | 49 +- c++/src/Makefile.in | 4 +- c++/test/CMakeLists.txt | 2 +- c++/test/Makefile.in | 2 +- config/apple | 10 +- config/cmake/CPack.cmake | 597 +++++++----- config/cmake/CTestCustom.cmake | 68 +- config/cmake/ConfigureChecks.cmake | 7 +- config/cmake/H5pubconf.h.in | 3 + config/cmake/HDF5UseFortran.cmake | 4 + config/cmake/grepTest.cmake | 2 +- config/cmake/mccacheinit.cmake | 7 +- config/cmake/prunTest.cmake | 34 +- config/cmake/runTest.cmake | 67 +- config/cmake/userblockTest.cmake | 10 +- config/lt_vers.am | 2 +- configure | 224 +++-- configure.ac | 204 ++-- examples/CMakeLists.txt | 16 +- examples/Makefile.am | 22 +- examples/Makefile.in | 24 +- examples/h5_cmprss.c | 125 +++ examples/h5_crtatt.c | 63 ++ examples/h5_crtdat.c | 51 + examples/h5_crtgrp.c | 40 + examples/h5_crtgrpar.c | 48 + examples/h5_crtgrpd.c | 91 ++ examples/h5_extend.c | 146 +++ examples/h5_rdwt.c | 53 + examples/h5_subset.c | 153 +++ examples/run-c-ex.sh.in | 20 +- fortran/CMakeLists.txt | 2 +- fortran/Makefile.in | 2 +- fortran/examples/CMakeLists.txt | 18 +- fortran/examples/Makefile.am | 40 +- fortran/examples/Makefile.in | 42 +- fortran/examples/attrexample.f90 | 117 --- fortran/examples/dsetexample.f90 | 85 -- fortran/examples/fileexample.f90 | 49 - fortran/examples/groupexample.f90 | 64 -- fortran/examples/grpdsetexample.f90 | 156 --- fortran/examples/grpsexample.f90 | 83 -- fortran/examples/h5_cmprss.f90 | 131 +++ fortran/examples/h5_crtatt.f90 | 106 ++ fortran/examples/h5_crtdat.f90 | 86 ++ fortran/examples/h5_crtgrp.f90 | 64 ++ fortran/examples/h5_crtgrpar.f90 | 83 ++ fortran/examples/h5_crtgrpd.f90 | 155 +++ fortran/examples/h5_extend.f90 | 233 +++++ fortran/examples/h5_rdwt.f90 | 96 ++ fortran/examples/h5_subset.f90 | 184 ++++ fortran/examples/run-fortran-ex.sh.in | 32 +- fortran/examples/rwdsetexample.f90 | 96 -- fortran/src/CMakeLists.txt | 3 +- fortran/src/H5Aff.f90 | 2 +- fortran/src/H5Aff_F03.f90 | 2 +- fortran/src/H5Aff_F90.f90 | 2 +- fortran/src/H5Dff.f90 | 2 +- fortran/src/H5Dff_F03.f90 | 2 +- fortran/src/H5Dff_F90.f90 | 2 +- fortran/src/H5Eff.f90 | 2 +- fortran/src/H5Eff_F03.f90 | 2 +- fortran/src/H5Eff_F90.f90 | 2 +- fortran/src/H5FDmpioff.f90 | 2 +- fortran/src/H5Ff.c | 34 + fortran/src/H5Fff.f90 | 2 +- fortran/src/H5Fff_F03.f90 | 104 ++ fortran/src/H5Fff_F90.f90 | 43 + fortran/src/H5Gff.f90 | 2 +- fortran/src/H5Iff.f90 | 2 +- fortran/src/H5Lf.c | 2 +- fortran/src/H5Lff.f90 | 2 +- fortran/src/H5Lff_F03.f90 | 2 +- fortran/src/H5Lff_F90.f90 | 2 +- fortran/src/H5Off.f90 | 2 +- fortran/src/H5Off_F03.f90 | 2 +- fortran/src/H5Off_F90.f90 | 2 +- fortran/src/H5Pf.c | 38 +- fortran/src/H5Pff.f90 | 23 +- fortran/src/H5Pff_F03.f90 | 2 +- fortran/src/H5Pff_F90.f90 | 2 +- fortran/src/H5Rff.f90 | 2 +- fortran/src/H5Rff_F03.f90 | 114 +-- fortran/src/H5Rff_F90.f90 | 30 +- fortran/src/H5Sff.f90 | 2 +- fortran/src/H5Tff.f90 | 2 +- fortran/src/H5Tff_F03.f90 | 2 +- fortran/src/H5Tff_F90.f90 | 2 +- fortran/src/H5Zff.f90 | 2 +- fortran/src/H5_ff.f90 | 2 +- fortran/src/H5_ff_F03.f90 | 2 +- fortran/src/H5f90proto.h | 6 +- fortran/src/H5match_types.c | 13 + fortran/src/H5test_kind_SIZEOF.f90 | 4 +- fortran/src/HDF5.f90 | 1 + fortran/src/Makefile.am | 9 +- fortran/src/Makefile.in | 26 +- fortran/src/hdf5_fortrandll.def.in | 1 + fortran/test/CMakeLists.txt | 3 +- fortran/test/Makefile.am | 2 +- fortran/test/Makefile.in | 9 +- fortran/test/fortranlib_test_F03.f90 | 14 +- fortran/test/tH5F_F03.f90 | 175 ++++ fortran/test/tH5P.f90 | 842 ++++++++-------- fortran/test/tH5P_F03.f90 | 141 +++ fortran/test/tH5T_F03.f90 | 385 +++++++- fortran/testpar/CMakeLists.txt | 2 +- fortran/testpar/Makefile.in | 2 +- hl/CMakeLists.txt | 2 +- hl/Makefile.in | 2 +- hl/c++/CMakeLists.txt | 2 +- hl/c++/Makefile.in | 2 +- hl/c++/examples/CMakeLists.txt | 13 +- hl/c++/examples/Makefile.am | 5 +- hl/c++/examples/Makefile.in | 7 +- hl/c++/examples/ptExampleVL.cpp | 112 --- hl/c++/examples/run-hlc++-ex.sh.in | 4 +- hl/c++/src/CMakeLists.txt | 2 +- hl/c++/src/Makefile.in | 4 +- hl/c++/test/CMakeLists.txt | 2 +- hl/c++/test/Makefile.in | 2 +- hl/examples/CMakeLists.txt | 3 +- hl/examples/Makefile.am | 5 +- hl/examples/Makefile.in | 7 +- hl/examples/ptExampleVL.c | 126 --- hl/examples/run-hlc-ex.sh.in | 2 - hl/fortran/CMakeLists.txt | 2 +- hl/fortran/Makefile.in | 2 +- hl/fortran/examples/CMakeLists.txt | 2 +- hl/fortran/examples/Makefile.in | 2 +- hl/fortran/src/CMakeLists.txt | 2 +- hl/fortran/src/H5DSfc.c | 8 +- hl/fortran/src/Makefile.in | 4 +- hl/fortran/test/CMakeLists.txt | 2 +- hl/fortran/test/Makefile.in | 2 +- hl/src/CMakeLists.txt | 4 +- hl/src/H5DO.c | 137 +++ hl/src/H5DOprivate.h | 37 + hl/src/H5DOpublic.h | 42 + hl/src/H5DS.c | 4 +- hl/src/Makefile.am | 4 +- hl/src/Makefile.in | 13 +- hl/src/hdf5_hl.h | 1 + hl/test/CMakeLists.txt | 6 +- hl/test/Makefile.am | 5 +- hl/test/Makefile.in | 36 +- hl/test/dectris_hl_perf.c | 643 ++++++++++++ hl/test/test_ds.c | 8 +- hl/test/test_dset_opt.c | 1138 ++++++++++++++++++++++ hl/test/test_lite.c | 4 - hl/test/test_table.c | 6 +- hl/test/test_table_be.h5 | Bin 0 -> 55912 bytes hl/test/test_table_be.hdf5 | Bin 55912 -> 0 bytes hl/test/test_table_cray.h5 | Bin 0 -> 55912 bytes hl/test/test_table_cray.hdf5 | Bin 55912 -> 0 bytes hl/test/test_table_le.h5 | Bin 0 -> 53880 bytes hl/test/test_table_le.hdf5 | Bin 53880 -> 0 bytes hl/tools/CMakeLists.txt | 2 +- hl/tools/Makefile.in | 2 +- hl/tools/gif2h5/Makefile.in | 2 +- hl/tools/h5watch/Makefile.in | 2 +- perform/CMakeLists.txt | 2 +- perform/Makefile.in | 2 +- release_docs/CMake.txt | 450 ++++++++- release_docs/INSTALL_Windows.txt | 3 - release_docs/INSTALL_parallel | 28 +- release_docs/RELEASE.txt | 50 +- release_docs/USING_CMake.txt | 88 +- release_docs/USING_Windows.txt | 643 +----------- src/CMakeLists.txt | 2 +- src/H5.c | 10 +- src/H5Dchunk.c | 102 ++ src/H5Dio.c | 169 +++- src/H5Dprivate.h | 3 + src/H5Dpublic.h | 19 + src/H5Dscatgath.c | 204 +++- src/H5FDcore.c | 558 +++++------ src/H5FDlog.c | 412 ++++---- src/H5FDmpi.c | 5 - src/H5FDmpi.h | 53 - src/H5FDmpio.c | 5 + src/H5FDmpio.h | 3 - src/H5FDmpiposix.c | 62 +- src/H5FDmpiposix.h | 3 - src/H5FDmulti.c | 102 +- src/H5FDprivate.h | 41 + src/H5FDsec2.c | 381 ++++---- src/H5FDstdio.c | 58 +- src/H5Fmpi.c | 1 - src/H5Gint.c | 4 +- src/H5Gname.c | 55 +- src/H5Gtest.c | 2 +- src/H5HFdbg.c | 14 +- src/H5Lexternal.c | 47 +- src/H5Ocopy.c | 2 +- src/H5Oname.c | 12 +- src/H5Pdxpl.c | 38 +- src/H5T.c | 4 +- src/H5config.h.in | 3 + src/H5private.h | 73 +- src/H5public.h | 4 +- src/H5system.c | 536 +++++----- src/Makefile.in | 4 +- test/CMakeLists.txt | 26 +- test/Makefile.in | 2 +- test/accum.c | 22 +- test/dsets.c | 1032 +++++++++++++++++++- test/stab.c | 9 +- test/test_filters_be.h5 | Bin 0 -> 5720 bytes test/test_filters_be.hdf5 | Bin 5720 -> 0 bytes test/test_filters_le.h5 | Bin 0 -> 5720 bytes test/test_filters_le.hdf5 | Bin 5720 -> 0 bytes test/testfiles/err_compat_1 | 5 +- test/testframe.c | 4 +- test/testhdf5.h | 2 +- test/testlibinfo.sh.in | 5 +- test/tfile.c | 11 +- test/th5o.c | 4 + test/th5s.c | 15 +- test/tsohm.c | 14 + test/vfd.c | 219 +++-- testpar/CMakeLists.txt | 2 +- testpar/Makefile.in | 2 +- tools/CMakeLists.txt | 2 +- tools/Makefile.in | 2 +- tools/h5copy/CMakeLists.txt | 411 ++++---- tools/h5copy/Makefile.in | 2 +- tools/h5copy/testfiles/h5copy_misc1.out | 2 +- tools/h5copy/testh5copy.sh.in | 367 +++---- tools/h5diff/CMakeLists.txt | 32 +- tools/h5diff/Makefile.in | 2 +- tools/h5diff/testfiles/h5diff_706.txt | 2 +- tools/h5diff/testfiles/h5diff_708.txt | 2 +- tools/h5dump/CMakeLists.txt | 644 +++++++----- tools/h5dump/Makefile.in | 2 +- tools/h5dump/h5dump.c | 382 +++++--- tools/h5dump/h5dump_ddl.c | 99 +- tools/h5dump/h5dump_defines.h | 10 +- tools/h5dump/testh5dump.sh.in | 169 +++- tools/h5dump/testh5dumppbits.sh.in | 4 +- tools/h5dump/testh5dumpxml.sh.in | 30 +- tools/h5import/CMakeLists.txt | 266 +++-- tools/h5import/Makefile.in | 2 +- tools/h5jam/CMakeLists.txt | 534 +++++----- tools/h5jam/Makefile.in | 2 +- tools/h5jam/h5unjam.c | 163 ++-- tools/h5jam/testh5jam.sh.in | 31 +- tools/h5ls/CMakeLists.txt | 7 +- tools/h5ls/Makefile.in | 2 +- tools/h5ls/h5ls.c | 12 +- tools/h5repack/CMakeLists.txt | 399 ++++---- tools/h5repack/Makefile.in | 2 +- tools/h5repack/h5repack.sh.in | 357 ++++--- tools/h5stat/CMakeLists.txt | 7 +- tools/h5stat/Makefile.in | 2 +- tools/lib/CMakeLists.txt | 2 +- tools/lib/Makefile.in | 2 +- tools/lib/h5diff_attr.c | 7 + tools/lib/h5tools.c | 136 +-- tools/lib/h5tools.h | 7 + tools/lib/h5tools_dump.c | 8 +- tools/lib/h5tools_str.c | 379 ++++--- tools/lib/h5tools_utils.c | 20 +- tools/misc/CMakeLists.txt | 283 +++--- tools/misc/Makefile.in | 2 +- tools/misc/h5perf_gentest.c | 598 ++++++++++++ tools/misc/testh5mkgrp.sh.in | 126 ++- tools/testfiles/h5dump-help.txt | 2 + tools/testfiles/h5mkgrp_help.ls | 4 - tools/testfiles/h5mkgrp_nested.ls | 13 - tools/testfiles/h5mkgrp_nested_latest.ls | 16 - tools/testfiles/h5mkgrp_nested_lp.ls | 13 + tools/testfiles/h5mkgrp_nested_mult.ls | 19 - tools/testfiles/h5mkgrp_nested_mult_latest.ls | 24 - tools/testfiles/h5mkgrp_nested_mult_lp.ls | 21 + tools/testfiles/h5mkgrp_nested_mult_p.ls | 16 + tools/testfiles/h5mkgrp_nested_p.ls | 10 + tools/testfiles/h5mkgrp_several.ls | 5 +- tools/testfiles/h5mkgrp_several_l.ls | 13 + tools/testfiles/h5mkgrp_several_latest.ls | 16 - tools/testfiles/h5mkgrp_several_p.ls | 10 + tools/testfiles/h5mkgrp_several_v.ls | 10 + tools/testfiles/h5mkgrp_single.ls | 5 +- tools/testfiles/h5mkgrp_single_l.ls | 9 + tools/testfiles/h5mkgrp_single_latest.ls | 12 - tools/testfiles/h5mkgrp_single_p.ls | 7 + tools/testfiles/h5mkgrp_single_v.ls | 7 + tools/testfiles/h5mkgrp_version.ls | 4 - tools/testfiles/help-1.ls | 4 +- tools/testfiles/help-2.ls | 4 +- tools/testfiles/help-3.ls | 4 +- tools/testfiles/tall-6.exp | 11 + tools/testfiles/textlinksrc-nodangle-1.ls | 4 +- tools/testfiles/tgroup-1.ls | 4 +- tools/testfiles/tnoattrdata.ddl | 39 + tools/testfiles/tnoattrddl.ddl | 7 + tools/testfiles/tnodata.ddl | 58 ++ tools/testfiles/tnoddl.ddl | 402 ++++++++ tools/testfiles/tnoddlfile.ddl | 0 tools/testfiles/tnoddlfile.exp | 402 ++++++++ tools/testfiles/tnofilename-with-packed-bits.ddl | 2 + tools/testfiles/tpbitsIncomplete.ddl | 2 + tools/testfiles/tpbitsLengthExceeded.ddl | 2 + tools/testfiles/tpbitsLengthPositive.ddl | 2 + tools/testfiles/tpbitsMaxExceeded.ddl | 2 + tools/testfiles/tpbitsOffsetExceeded.ddl | 2 + tools/testfiles/tpbitsOffsetNegative.ddl | 2 + tools/testfiles/trawdatafile.ddl | 58 ++ tools/testfiles/trawdatafile.exp | 402 ++++++++ tools/testfiles/tstr2bin2.exp | 1 + tools/testfiles/tstr2bin6.exp | 1 + tools/testfiles/twithddl.exp | 58 ++ tools/testfiles/twithddlfile.ddl | 0 tools/testfiles/twithddlfile.exp | 402 ++++++++ vms/src/h5pubconf.h | 6 +- 329 files changed, 15547 insertions(+), 6650 deletions(-) create mode 100755 bin/cmakehdf5 create mode 100644 examples/h5_cmprss.c create mode 100644 examples/h5_crtatt.c create mode 100644 examples/h5_crtdat.c create mode 100644 examples/h5_crtgrp.c create mode 100644 examples/h5_crtgrpar.c create mode 100644 examples/h5_crtgrpd.c create mode 100644 examples/h5_extend.c create mode 100644 examples/h5_rdwt.c create mode 100644 examples/h5_subset.c delete mode 100644 fortran/examples/attrexample.f90 delete mode 100644 fortran/examples/dsetexample.f90 delete mode 100644 fortran/examples/fileexample.f90 delete mode 100644 fortran/examples/groupexample.f90 delete mode 100644 fortran/examples/grpdsetexample.f90 delete mode 100644 fortran/examples/grpsexample.f90 create mode 100644 fortran/examples/h5_cmprss.f90 create mode 100644 fortran/examples/h5_crtatt.f90 create mode 100644 fortran/examples/h5_crtdat.f90 create mode 100644 fortran/examples/h5_crtgrp.f90 create mode 100644 fortran/examples/h5_crtgrpar.f90 create mode 100644 fortran/examples/h5_crtgrpd.f90 create mode 100644 fortran/examples/h5_extend.f90 create mode 100644 fortran/examples/h5_rdwt.f90 create mode 100644 fortran/examples/h5_subset.f90 delete mode 100644 fortran/examples/rwdsetexample.f90 create mode 100644 fortran/src/H5Fff_F03.f90 create mode 100644 fortran/src/H5Fff_F90.f90 create mode 100644 fortran/test/tH5F_F03.f90 delete mode 100644 hl/c++/examples/ptExampleVL.cpp delete mode 100644 hl/examples/ptExampleVL.c create mode 100644 hl/src/H5DO.c create mode 100644 hl/src/H5DOprivate.h create mode 100644 hl/src/H5DOpublic.h create mode 100644 hl/test/dectris_hl_perf.c create mode 100644 hl/test/test_dset_opt.c create mode 100644 hl/test/test_table_be.h5 delete mode 100644 hl/test/test_table_be.hdf5 create mode 100644 hl/test/test_table_cray.h5 delete mode 100644 hl/test/test_table_cray.hdf5 create mode 100644 hl/test/test_table_le.h5 delete mode 100644 hl/test/test_table_le.hdf5 create mode 100644 test/test_filters_be.h5 delete mode 100644 test/test_filters_be.hdf5 create mode 100644 test/test_filters_le.h5 delete mode 100644 test/test_filters_le.hdf5 create mode 100755 tools/misc/h5perf_gentest.c delete mode 100644 tools/testfiles/h5mkgrp_help.ls delete mode 100644 tools/testfiles/h5mkgrp_nested.ls delete mode 100644 tools/testfiles/h5mkgrp_nested_latest.ls create mode 100644 tools/testfiles/h5mkgrp_nested_lp.ls delete mode 100644 tools/testfiles/h5mkgrp_nested_mult.ls delete mode 100644 tools/testfiles/h5mkgrp_nested_mult_latest.ls create mode 100644 tools/testfiles/h5mkgrp_nested_mult_lp.ls create mode 100644 tools/testfiles/h5mkgrp_nested_mult_p.ls create mode 100644 tools/testfiles/h5mkgrp_nested_p.ls create mode 100644 tools/testfiles/h5mkgrp_several_l.ls delete mode 100644 tools/testfiles/h5mkgrp_several_latest.ls create mode 100644 tools/testfiles/h5mkgrp_several_p.ls create mode 100644 tools/testfiles/h5mkgrp_several_v.ls create mode 100644 tools/testfiles/h5mkgrp_single_l.ls delete mode 100644 tools/testfiles/h5mkgrp_single_latest.ls create mode 100644 tools/testfiles/h5mkgrp_single_p.ls create mode 100644 tools/testfiles/h5mkgrp_single_v.ls delete mode 100644 tools/testfiles/h5mkgrp_version.ls create mode 100644 tools/testfiles/tall-6.exp create mode 100644 tools/testfiles/tnoattrdata.ddl create mode 100644 tools/testfiles/tnoattrddl.ddl create mode 100644 tools/testfiles/tnodata.ddl create mode 100644 tools/testfiles/tnoddl.ddl create mode 100644 tools/testfiles/tnoddlfile.ddl create mode 100644 tools/testfiles/tnoddlfile.exp create mode 100644 tools/testfiles/trawdatafile.ddl create mode 100644 tools/testfiles/trawdatafile.exp create mode 100644 tools/testfiles/tstr2bin2.exp create mode 100644 tools/testfiles/tstr2bin6.exp create mode 100644 tools/testfiles/twithddl.exp create mode 100644 tools/testfiles/twithddlfile.ddl create mode 100644 tools/testfiles/twithddlfile.exp diff --git a/CMakeLists.txt b/CMakeLists.txt index 3ddef9b..60655ae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.6) +cmake_minimum_required (VERSION 2.8.10) PROJECT (HDF5 C CXX) #----------------------------------------------------------------------------- @@ -563,9 +563,9 @@ IF (HDF5_ENABLE_Z_LIB_SUPPORT) IF (NOT H5_ZLIB_HEADER) IF (NOT ZLIB_USE_EXTERNAL) FIND_PACKAGE (ZLIB NAMES ${ZLIB_PACKAGE_NAME}${HDF_PACKAGE_EXT}) - IF (NOT ZLIB_FOUND) - FIND_PACKAGE (ZLIB) # Legacy find - ENDIF (NOT ZLIB_FOUND) + IF (NOT ZLIB_FOUND) + FIND_PACKAGE (ZLIB) # Legacy find + ENDIF (NOT ZLIB_FOUND) ENDIF (NOT ZLIB_USE_EXTERNAL) IF (ZLIB_FOUND) SET (H5_HAVE_FILTER_DEFLATE 1) @@ -666,7 +666,7 @@ IF (WIN32 AND NOT CYGWIN) IF (HDF5_ENABLE_THREADSAFE) # check for unsupported options IF (HDF5_ENABLE_PARALLEL) - MESSAGE (FATAL " **** Parallel and Threadsafe options are mutually exclusive **** ") + MESSAGE (FATAL_ERROR " **** Parallel and Threadsafe options are mutually exclusive **** ") ENDIF (HDF5_ENABLE_PARALLEL) SET (H5_HAVE_THREADSAFE 1) IF (H5_HAVE_IOEO) @@ -675,7 +675,7 @@ IF (WIN32 AND NOT CYGWIN) ELSE (H5_HAVE_IOEO) IF (NOT H5_HAVE_PTHREAD_H) SET (H5_HAVE_THREADSAFE 0) - MESSAGE (FATAL " **** Threadsafe option requires thread library **** ") + MESSAGE (FATAL_ERROR " **** Threadsafe option requires thread library **** ") ENDIF (NOT H5_HAVE_PTHREAD_H) ENDIF (H5_HAVE_IOEO) ENDIF (HDF5_ENABLE_THREADSAFE) @@ -757,6 +757,9 @@ SET (H5_FC_FUNC_ "H5_FC_FUNC_(name,NAME) name ## _") IF (EXISTS "${HDF5_SOURCE_DIR}/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/fortran") OPTION (HDF5_BUILD_FORTRAN "Build FORTRAN support" OFF) IF (HDF5_BUILD_FORTRAN) + IF (BUILD_SHARED_LIBS AND APPLE) + MESSAGE (FATAL_ERROR " **** Shared FORTRAN libraries are unsupported **** ") + ENDIF (BUILD_SHARED_LIBS AND APPLE) OPTION (HDF5_ENABLE_F2003 "Enable FORTRAN 2003 Standard" OFF) INCLUDE (${HDF5_RESOURCES_DIR}/HDF5UseFortran.cmake) IF (HDF5_ENABLE_F2003) @@ -798,7 +801,7 @@ IF (EXISTS "${HDF5_SOURCE_DIR}/c++" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/c++") IF (HDF5_BUILD_CPP_LIB) # check for unsupported options IF (HDF5_ENABLE_PARALLEL) - MESSAGE (FATAL " **** Parallel and C++ options are mutually exclusive **** ") + MESSAGE (FATAL_ERROR " **** Parallel and C++ options are mutually exclusive **** ") ENDIF (HDF5_ENABLE_PARALLEL) IF (CMAKE_NO_STD_NAMESPACE) SET (H5_NO_STD 1) @@ -999,7 +1002,6 @@ IF (NOT HDF5_EXTERNALLY_CONFIGURED AND NOT HDF5_NO_PACKAGES) SET (CPACK_PACKAGE_VENDOR "HDF_Group") SET (CPACK_PACKAGE_NAME "${HDF5_PACKAGE_NAME}") SET (CPACK_PACKAGE_INSTALL_DIRECTORY "${HDF5_PACKAGE_NAME}") - SET (CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${HDF5_PACKAGE_NAME}-${HDF5_PACKAGE_VERSION}-${LIB_TYPE}") SET (CPACK_PACKAGE_VERSION "${HDF5_PACKAGE_VERSION}") SET (CPACK_PACKAGE_VERSION_MAJOR "${HDF5_PACKAGE_VERSION_MAJOR}") SET (CPACK_PACKAGE_VERSION_MINOR "${HDF5_PACKAGE_VERSION_MINOR}") @@ -1012,10 +1014,15 @@ IF (NOT HDF5_EXTERNALLY_CONFIGURED AND NOT HDF5_NO_PACKAGES) SET (CPACK_PACKAGE_RELOCATABLE TRUE) IF (WIN32) + SET (CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${HDF5_PACKAGE_NAME}-${HDF5_PACKAGE_VERSION}-${LIB_TYPE}") SET (CPACK_MONOLITHIC_INSTALL ON) SET (CPACK_NSIS_CONTACT "${HDF5_PACKAGE_BUGREPORT}") SET (CPACK_NSIS_MODIFY_PATH ON) SET (CPACK_NSIS_PACKAGE_NAME "HDF5 ${HDF5_PACKAGE_VERSION}") + ELSEIF (APPLE) + SET (CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE ON) + SET (CPACK_PACKAGE_DEFAULT_LOCATION "/opt/${CPACK_PACKAGE_NAME}") + SET (CPACK_PACKAGING_INSTALL_PREFIX "/") ELSE (WIN32) SET (CPACK_PACKAGING_INSTALL_PREFIX "/usr") SET (CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE ON) diff --git a/COPYING b/COPYING index 9e816c8..25e79e7 100644 --- a/COPYING +++ b/COPYING @@ -4,7 +4,7 @@ HDF5 (Hierarchical Data Format 5) Software Library and Utilities ----------------------------------------------------------------------------- HDF5 (Hierarchical Data Format 5) Software Library and Utilities -Copyright 2006-2012 by The HDF Group. +Copyright 2006-2013 by The HDF Group. NCSA HDF5 (Hierarchical Data Format 5) Software Library and Utilities Copyright 1998-2006 by the Board of Trustees of the University of Illinois. diff --git a/CTestConfig.cmake b/CTestConfig.cmake index 8d00095..5d8f25c 100644 --- a/CTestConfig.cmake +++ b/CTestConfig.cmake @@ -20,6 +20,8 @@ SET (CTEST_DROP_SITE_CDASH TRUE) SET (UPDATE_TYPE svn) SET (VALGRIND_COMMAND "/usr/bin/valgrind") SET (VALGRIND_COMMAND_OPTIONS "-v --tool=memcheck --leak-check=full --track-fds=yes --num-callers=50 --show-reachable=yes --track-origins=yes --malloc-fill=0xff --free-fill=0xfe") +SET (CTEST_MEMORYCHECK_COMMAND "/usr/bin/valgrind") +SET (CTEST_MEMORYCHECK_COMMAND_OPTIONS "-v --tool=memcheck --leak-check=full --track-fds=yes --num-callers=50 --show-reachable=yes --track-origins=yes --malloc-fill=0xff --free-fill=0xfe") SET (CTEST_TEST_TIMEOUT 3600 CACHE STRING "Maximum time allowed before CTest will kill the test.") diff --git a/MANIFEST b/MANIFEST index 4bbea49..8ec08d5 100644 --- a/MANIFEST +++ b/MANIFEST @@ -46,6 +46,7 @@ ./bin/chkconfigure _DO_NOT_DISTRIBUTE_ ./bin/chkcopyright _DO_NOT_DISTRIBUTE_ ./bin/chkmanifest +./bin/cmakehdf5 ./bin/compile ./bin/config.guess ./bin/config.sub @@ -121,6 +122,15 @@ ./examples/Makefile.in ./examples/h5_chunk_read.c ./examples/h5_compound.c +./examples/h5_crtgrpd.c +./examples/h5_subset.c +./examples/h5_cmprss.c +./examples/h5_rdwt.c +./examples/h5_crtgrpar.c +./examples/h5_extend.c +./examples/h5_crtatt.c +./examples/h5_crtgrp.c +./examples/h5_crtdat.c ./examples/h5_drivers.c ./examples/h5_dtransform.c ./examples/h5_elink_unix2win.c @@ -238,22 +248,24 @@ ./fortran/examples/Makefile.am ./fortran/examples/Makefile.in -./fortran/examples/attrexample.f90 ./fortran/examples/compound.f90 ./fortran/examples/compound_fortran2003.f90 ./fortran/examples/compound_complex_fortran2003.f90 -./fortran/examples/dsetexample.f90 -./fortran/examples/fileexample.f90 -./fortran/examples/groupexample.f90 -./fortran/examples/grpdsetexample.f90 -./fortran/examples/grpsexample.f90 +./fortran/examples/h5_cmprss.f90 +./fortran/examples/h5_crtatt.f90 +./fortran/examples/h5_crtdat.f90 +./fortran/examples/h5_crtgrp.f90 +./fortran/examples/h5_crtgrpar.f90 +./fortran/examples/h5_crtgrpd.f90 +./fortran/examples/h5_extend.f90 +./fortran/examples/h5_rdwt.f90 +./fortran/examples/h5_subset.f90 ./fortran/examples/hyperslab.f90 ./fortran/examples/mountexample.f90 ./fortran/examples/ph5example.f90 ./fortran/examples/refobjexample.f90 ./fortran/examples/refregexample.f90 ./fortran/examples/run-fortran-ex.sh.in -./fortran/examples/rwdsetexample.f90 ./fortran/examples/selectele.f90 ./fortran/examples/testh5fc.sh.in ./fortran/examples/nested_derived_type.f90 @@ -281,6 +293,8 @@ ./fortran/src/H5FDmpioff.f90 ./fortran/src/H5Ff.c ./fortran/src/H5Fff.f90 +./fortran/src/H5Fff_F90.f90 +./fortran/src/H5Fff_F03.f90 ./fortran/src/H5Gf.c ./fortran/src/H5Gff.f90 ./fortran/src/H5If.c @@ -342,6 +356,7 @@ ./fortran/test/tH5E_F03.f90 ./fortran/test/tH5E.f90 ./fortran/test/tH5F.f90 +./fortran/test/tH5F_F03.f90 ./fortran/test/tH5G.f90 ./fortran/test/tH5G_1_8.f90 ./fortran/test/tH5I.f90 @@ -1099,8 +1114,8 @@ ./test/tvltypes.c ./test/unlink.c ./test/vfd.c -./test/test_filters_le.hdf5 -./test/test_filters_be.hdf5 +./test/test_filters_le.h5 +./test/test_filters_be.h5 ./test/gen_filters.c ./test/chunk_info.c @@ -1317,6 +1332,8 @@ ./tools/misc/talign.c ./tools/misc/testfiles/h5mkgrp_help.txt ./tools/misc/testfiles/h5mkgrp_version.txt.in +./tools/misc/h5perf_gentest.c + # h5stat sources ./tools/h5stat/Makefile.am @@ -1380,6 +1397,7 @@ ./tools/testfiles/tall-4s.ddl ./tools/testfiles/tall-5s.ddl ./tools/testfiles/tall-6.ddl +./tools/testfiles/tall-6.exp ./tools/testfiles/tall.h5 ./tools/testfiles/tarray1.ddl ./tools/testfiles/tarray1.h5 @@ -1501,12 +1519,20 @@ ./tools/testfiles/tnestedcomp.h5 ./tools/testfiles/tnestedcmpddt.ddl ./tools/testfiles/tnestedcmpddt.h5 +./tools/testfiles/tnoattrdata.ddl +./tools/testfiles/tnoattrddl.ddl +./tools/testfiles/tnodata.ddl +./tools/testfiles/tnoddl.ddl +./tools/testfiles/tnoddlfile.ddl +./tools/testfiles/tnoddlfile.exp ./tools/testfiles/tno-subset.h5 ./tools/testfiles/tno-subset.ddl ./tools/testfiles/tnullspace.h5 ./tools/testfiles/tnullspace.ddl ./tools/testfiles/tobjref.h5 ./tools/testfiles/topaque.h5 +./tools/testfiles/trawdatafile.ddl +./tools/testfiles/trawdatafile.exp ./tools/testfiles/tsaf.ddl ./tools/testfiles/tsaf.h5 ./tools/testfiles/tscalarattrintsize.ddl @@ -1527,6 +1553,8 @@ ./tools/testfiles/tstr.h5 ./tools/testfiles/tstr2.h5 ./tools/testfiles/tstr-2.ddl +./tools/testfiles/tstr2bin2.exp +./tools/testfiles/tstr2bin6.exp ./tools/testfiles/tvldtypes1.ddl ./tools/testfiles/tvldtypes1.h5 ./tools/testfiles/tvldtypes2.ddl @@ -1596,6 +1624,9 @@ ./tools/testfiles/tbigdims.h5 ./tools/testfiles/thyperslab.h5 ./tools/testfiles/twidedisplay.ddl +./tools/testfiles/twithddl.exp +./tools/testfiles/twithddlfile.ddl +./tools/testfiles/twithddlfile.exp # h5dump test error files ./tools/h5dump/errfiles/filter_fail.err @@ -2139,16 +2170,18 @@ ./tools/h5copy/testfiles/h5copytst_new.out.ls # test files for h5mkgrp -./tools/testfiles/h5mkgrp_help.ls -./tools/testfiles/h5mkgrp_nested.ls -./tools/testfiles/h5mkgrp_nested_latest.ls -./tools/testfiles/h5mkgrp_nested_mult.ls -./tools/testfiles/h5mkgrp_nested_mult_latest.ls +./tools/testfiles/h5mkgrp_nested_p.ls +./tools/testfiles/h5mkgrp_nested_lp.ls +./tools/testfiles/h5mkgrp_nested_mult_p.ls +./tools/testfiles/h5mkgrp_nested_mult_lp.ls ./tools/testfiles/h5mkgrp_several.ls -./tools/testfiles/h5mkgrp_several_latest.ls +./tools/testfiles/h5mkgrp_several_v.ls +./tools/testfiles/h5mkgrp_several_p.ls +./tools/testfiles/h5mkgrp_several_l.ls ./tools/testfiles/h5mkgrp_single.ls -./tools/testfiles/h5mkgrp_single_latest.ls -./tools/testfiles/h5mkgrp_version.ls +./tools/testfiles/h5mkgrp_single_v.ls +./tools/testfiles/h5mkgrp_single_p.ls +./tools/testfiles/h5mkgrp_single_l.ls # high level libraries @@ -2179,12 +2212,14 @@ ./hl/examples/image8.txt ./hl/examples/pal_rgb.h ./hl/examples/ptExampleFL.c -./hl/examples/ptExampleVL.c ./hl/examples/run-hl-ex.sh ./hl/examples/run-hlc-ex.sh.in ./hl/src/COPYING ./hl/src/Makefile.am ./hl/src/Makefile.in +./hl/src/H5DO.c +./hl/src/H5DOprivate.h +./hl/src/H5DOpublic.h ./hl/src/H5DS.c ./hl/src/H5DSprivate.h ./hl/src/H5DSpublic.h @@ -2230,7 +2265,10 @@ ./hl/test/ld_monitor.c ./hl/test/pal_rgb.h ./hl/test/sepia.pal +./hl/test/dectris_hl_perf.c +./hl/test/gen_test_ds.c ./hl/test/test_ds.c +./hl/test/test_dset_opt.c ./hl/test/test_file_image.c ./hl/test/test_image.c ./hl/test/test_ld.c @@ -2243,9 +2281,9 @@ ./hl/test/test_table.c ./hl/test/test_ds_le.h5 ./hl/test/test_ds_be.h5 -./hl/test/test_table_le.hdf5 -./hl/test/test_table_be.hdf5 -./hl/test/test_table_cray.hdf5 +./hl/test/test_table_le.h5 +./hl/test/test_table_be.h5 +./hl/test/test_table_cray.h5 ./hl/test/usa.wri # tools @@ -2360,7 +2398,6 @@ ./hl/c++/examples/Makefile.am ./hl/c++/examples/Makefile.in ./hl/c++/examples/ptExampleFL.cpp -./hl/c++/examples/ptExampleVL.cpp ./hl/c++/examples/run-hlc++-ex.sh.in ./hl/c++/src/H5PacketTable.h ./hl/c++/src/H5PacketTable.cpp diff --git a/Makefile.in b/Makefile.in index 1472be5..a53e904 100644 --- a/Makefile.in +++ b/Makefile.in @@ -262,6 +262,7 @@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ +HAVE_PTHREAD = @HAVE_PTHREAD@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF_CXX = @HDF_CXX@ @@ -313,7 +314,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PARALLEL = @PARALLEL@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ -PTHREAD = @PTHREAD@ RANLIB = @RANLIB@ ROOT = @ROOT@ RUNPARALLEL = @RUNPARALLEL@ diff --git a/README.txt b/README.txt index 6ce1c80..d703d87 100644 --- a/README.txt +++ b/README.txt @@ -1,4 +1,4 @@ -HDF5 version 1.9.137-FA_a5 currently under development +HDF5 version 1.9.148-FA_a5 currently under development Please refer to the release_docs/INSTALL file for installation instructions. ------------------------------------------------------------------------------ diff --git a/bin/checkposix b/bin/checkposix index 3912e9f..b295d7d 100755 --- a/bin/checkposix +++ b/bin/checkposix @@ -1,4 +1,4 @@ -#!/usr/local/bin/perl -w +#!/usr/bin/perl -w require 5.003; # diff --git a/bin/cmakehdf5 b/bin/cmakehdf5 new file mode 100755 index 0000000..c024ad1 --- /dev/null +++ b/bin/cmakehdf5 @@ -0,0 +1,223 @@ +#! /bin/sh +# Build and Test HDF5 using cmake. +# Author: Allen Byrne +# Albert Cheng +# Creation Date: Nov 2012 + +# Copyright: The HDF Group, 2012 + +# Debug: remove the comment hash if you want DPRINT to do echo +DPRINT=: +#DPRINT=echo + +# variable names +progname=`basename $0` # program name +cminfile="cmakemin.$$" # Cmake minimum file +cfgfile=$progname.$$ # configure file +$DPRINT $cfgfile + +# Remove temporary generated files if exit 0 +trap "rm -f $cminfile $cfgfile" 0 + +#============= +# Function definitions +#============= +TIMESTAMP() +{ + echo "=====" "`date`" "=====" +} + + +#========== +# main +#========== +# Show a start time stamp +TIMESTAMP + +# Explain what and where log files are. +cat <.log: output of configure + LastBuild_.log: output of build + LastTest_.log: output of testing + LastTestsFailed_.log: list of failed tests + +EOF + +# First generate the two needed input files, the $cimnfile and $cfgfile. +# Then use ctest to use the two input files. + +#========== +# create the configure file +#========== +# Create the cmake minimum required file to be used by the following +# configure file. Though not absolute needed, it is better to generate +# this file before the configure file. Quote the EOF to preven substitution +# in the text. +#========== +#========== +cat > $cfgfile <<'EOF' +cmake_minimum_required(VERSION 2.8.10 FATAL_ERROR) +######################################################## +# This dashboard is maintained by The HDF Group +# For any comments please contact cdashhelp@hdfgroup.org +# +######################################################## + +set (CTEST_DASHBOARD_ROOT ${CTEST_SCRIPT_DIRECTORY}) +set (CTEST_SOURCE_DIRECTORY "../hdf5") +set (CTEST_BINARY_DIRECTORY ".") +set (CTEST_CMAKE_GENERATOR "Unix Makefiles") +set (CTEST_BUILD_CONFIGURATION "Release") + +# -- CDash variables +set (LOCAL_NO_SUBMIT TRUE) # No CDash submit. +set (MODEL "Experimental") +set (CDASH_LOCAL TRUE) +set (SITE_BUILDNAME_SUFFIX "SHARED") + +# -- URL set for internal check, default is to not update +set (LOCAL_SKIP_UPDATE TRUE) +set (REPOSITORY_URL "http://svn.hdfgroup.uiuc.edu/hdf5/branches/hdf5_1_8") +# -- Standard build options +set (ADD_BUILD_OPTIONS "-DCMAKE_INSTALL_PREFIX:PATH=/usr/local/hdf5.1.8 -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING=\"SVN\" -DHDF5_PACKAGE_EXTLIBS:BOOL=ON") + +# Use multiple CPU cores to build +include(ProcessorCount) +ProcessorCount(N) +if(NOT N EQUAL 0) + set(CTEST_BUILD_FLAGS -j${N}) + set(ctest_test_args ${ctest_test_args} PARALLEL_LEVEL ${N}) +endif() + +# ----------------------------------------------------------- +# -- Get environment +# ----------------------------------------------------------- + ## -- set hostname + ## -------------------------- + find_program (HOSTNAME_CMD NAMES hostname) + exec_program (${HOSTNAME_CMD} ARGS OUTPUT_VARIABLE HOSTNAME) + set (CTEST_SITE "${HOSTNAME}${CTEST_SITE_EXT}") + find_program (UNAME NAMES uname) + macro (getuname name flag) + exec_program ("${UNAME}" ARGS "${flag}" OUTPUT_VARIABLE "${name}") + endmacro (getuname) + + getuname (osname -s) + getuname (osrel -r) + getuname (cpu -m) + + if (SITE_BUILDNAME_SUFFIX) + set (CTEST_BUILD_NAME "${osname}-${osrel}-${cpu}-${SITE_BUILDNAME_SUFFIX}") + else (SITE_BUILDNAME_SUFFIX) + set (CTEST_BUILD_NAME "${osname}-${osrel}-${cpu}") + endif (SITE_BUILDNAME_SUFFIX) +# ----------------------------------------------------------- + +set (BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DSITE:STRING=${CTEST_SITE} -DBUILDNAME:STRING=${CTEST_BUILD_NAME}") + +#----------------------------------------------------------------------------- +# MAC machines need special option +#----------------------------------------------------------------------------- +if (APPLE) + # Compiler choice + execute_process(COMMAND xcrun --find cc OUTPUT_VARIABLE XCODE_CC OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process(COMMAND xcrun --find c++ OUTPUT_VARIABLE XCODE_CXX OUTPUT_STRIP_TRAILING_WHITESPACE) + SET(ENV{CC} "${XCODE_CC}") + SET(ENV{CXX} "${XCODE_CXX}") + # Shared fortran is not supported, build static + set (BUILD_OPTIONS "${BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_ANSI_CFLAGS:STRING=-fPIC") + set (BUILD_OPTIONS "${BUILD_OPTIONS} -DCTEST_USE_LAUNCHERS:BOOL=ON -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF") +endif (APPLE) + + +# ----------------------------------------------------------- +find_package (Subversion) +set (CTEST_UPDATE_COMMAND "${Subversion_SVN_EXECUTABLE}") +# -- Only clean build folder if LOCAL_CLEAR_BUILD is set +if (LOCAL_CLEAR_BUILD) + set (CTEST_START_WITH_EMPTY_BINARY_DIRECTORY TRUE) + ctest_empty_binary_directory (${CTEST_BINARY_DIRECTORY}) +endif (LOCAL_CLEAR_BUILD) + +#----------------------------------------------------------------------------- +# Send the main script as a note. +list (APPEND CTEST_NOTES_FILES + "${CMAKE_CURRENT_LIST_FILE}" + "${CTEST_SOURCE_DIRECTORY}/config/cmake/cacheinit.cmake" + ) + +# Check for required variables. +foreach (req + CTEST_CMAKE_GENERATOR + CTEST_SITE + CTEST_BUILD_NAME + ) + if (NOT DEFINED ${req}) + message(FATAL_ERROR "The containing script must set ${req}") + endif (NOT DEFINED ${req}) +endforeach (req) + +## -- set output to english +set($ENV{LC_MESSAGES} "en_EN") + +#----------------------------------------------------------------------------- +# Initialize the CTEST commands +#------------------------------ +SET (CTEST_CMAKE_COMMAND "\"${CMAKE_COMMAND}\"") +SET (CTEST_CONFIGURE_COMMAND + "${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/cacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_BUILD_CONFIGURATION} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_SOURCE_DIRECTORY}\"") + +# Print summary information. +foreach (v + CTEST_SITE + CTEST_BUILD_NAME + CTEST_SOURCE_DIRECTORY + CTEST_BINARY_DIRECTORY + CTEST_CMAKE_GENERATOR + CTEST_BUILD_CONFIGURATION + CTEST_CONFIGURE_COMMAND + CTEST_SCRIPT_DIRECTORY + ) + set (vars "${vars} ${v}=[${${v}}]\n") +endforeach (v) +message ("Dashboard script configuration:\n${vars}\n") + +CTEST_START (${MODEL} TRACK ${MODEL}) +if (NOT LOCAL_SKIP_UPDATE) + CTEST_UPDATE (SOURCE "${CTEST_SOURCE_DIRECTORY}") +endif (NOT LOCAL_SKIP_UPDATE) +CTEST_CONFIGURE (BUILD "${CTEST_BINARY_DIRECTORY}") +message ("Configure DONE") +CTEST_READ_CUSTOM_FILES ("${CTEST_BINARY_DIRECTORY}") +if (NOT LOCAL_NO_SUBMIT) + CTEST_SUBMIT (PARTS Update Configure Notes) +endif (NOT LOCAL_NO_SUBMIT) +CTEST_BUILD (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND) +if (NOT LOCAL_NO_SUBMIT) + CTEST_SUBMIT (PARTS Build) +endif (NOT LOCAL_NO_SUBMIT) +message ("build DONE") +if (NOT LOCAL_SKIP_TEST) + CTEST_TEST (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND) + if (NOT LOCAL_NO_SUBMIT) + CTEST_SUBMIT (PARTS Test) + endif (NOT LOCAL_NO_SUBMIT) + message ("test DONE") +endif (NOT LOCAL_SKIP_TEST) + +message ("DONE") +EOF + + +# Run ctest +ctest -S $cfgfile -C Release -O ctest.log +exit_code=$? +if [ $exit_code = 0 ]; then + echo Complete without error +else + echo Error encountered +fi +TIMESTAMP +exit $exit_code diff --git a/bin/trace b/bin/trace index 67aeb17..657ac92 100755 --- a/bin/trace +++ b/bin/trace @@ -99,7 +99,9 @@ $Source = ""; "H5A_operator2_t" => "x", "H5A_info_t" => "x", "H5AC_cache_config_t" => "x", + "H5D_gather_func_t" => "x", "H5D_operator_t" => "x", + "H5D_scatter_func_t" => "x", "H5E_auto_t" => "x", "H5E_auto1_t" => "x", "H5E_auto2_t" => "x", diff --git a/c++/CMakeLists.txt b/c++/CMakeLists.txt index 0076335..50ea838 100644 --- a/c++/CMakeLists.txt +++ b/c++/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.6) +cmake_minimum_required (VERSION 2.8.10) PROJECT (HDF5_CPP) #----------------------------------------------------------------------------- diff --git a/c++/Makefile.in b/c++/Makefile.in index 8c82ca9..232299d 100644 --- a/c++/Makefile.in +++ b/c++/Makefile.in @@ -227,6 +227,7 @@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ +HAVE_PTHREAD = @HAVE_PTHREAD@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF_CXX = @HDF_CXX@ @@ -278,7 +279,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PARALLEL = @PARALLEL@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ -PTHREAD = @PTHREAD@ RANLIB = @RANLIB@ ROOT = @ROOT@ RUNPARALLEL = @RUNPARALLEL@ diff --git a/c++/examples/CMakeLists.txt b/c++/examples/CMakeLists.txt index f60d96e..f45251b 100644 --- a/c++/examples/CMakeLists.txt +++ b/c++/examples/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.6) +cmake_minimum_required (VERSION 2.8.10) # -------------------------------------------------------------------- # Notes: When creating examples they should be prefixed # with "cpp_ex_". This allows for easier filtering of the examples. diff --git a/c++/examples/Makefile.in b/c++/examples/Makefile.in index e9bbf47..e8aa093 100644 --- a/c++/examples/Makefile.in +++ b/c++/examples/Makefile.in @@ -194,6 +194,7 @@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ +HAVE_PTHREAD = @HAVE_PTHREAD@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF_CXX = @HDF_CXX@ @@ -245,7 +246,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PARALLEL = @PARALLEL@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ -PTHREAD = @PTHREAD@ RANLIB = @RANLIB@ ROOT = @ROOT@ RUNPARALLEL = @RUNPARALLEL@ diff --git a/c++/src/CMakeLists.txt b/c++/src/CMakeLists.txt index d983d1e..fea68cd 100644 --- a/c++/src/CMakeLists.txt +++ b/c++/src/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.6) +cmake_minimum_required (VERSION 2.8.10) PROJECT (HDF5_CPP_SRC) #----------------------------------------------------------------------------- diff --git a/c++/src/H5CommonFG.cpp b/c++/src/H5CommonFG.cpp index dcc331f..b3889a0 100644 --- a/c++/src/H5CommonFG.cpp +++ b/c++/src/H5CommonFG.cpp @@ -130,9 +130,7 @@ Group CommonFG::openGroup( const char* name ) const // If the opening of the group failed, throw an exception if( group_id < 0 ) - { throwException("openGroup", "H5Gopen2 failed"); - } // No failure, create and return the Group object Group group( group_id ); @@ -174,9 +172,7 @@ DataSet CommonFG::createDataSet( const char* name, const DataType& data_type, co // If the creation of the dataset failed, throw an exception if( dataset_id < 0 ) - { throwException("createDataSet", "H5Dcreate2 failed"); - } // No failure, create and return the DataSet object DataSet dataset( dataset_id ); @@ -270,9 +266,8 @@ void CommonFG::link( H5L_type_t link_type, const char* curr_name, const char* ne break; } /* end switch */ - if( ret_value < 0 ) { + if( ret_value < 0 ) throwException("link", "creating link failed"); - } } //-------------------------------------------------------------------------- @@ -300,9 +295,7 @@ void CommonFG::unlink( const char* name ) const { herr_t ret_value = H5Ldelete( getLocId(), name, H5P_DEFAULT ); if( ret_value < 0 ) - { throwException("unlink", "H5Ldelete failed"); - } } //-------------------------------------------------------------------------- @@ -336,9 +329,7 @@ void CommonFG::move( const char* src, const char* dst ) const { herr_t ret_value = H5Lmove( getLocId(), src, H5L_SAME_LOC, dst, H5P_DEFAULT, H5P_DEFAULT ); if( ret_value < 0 ) - { throwException("move", "H5Lmove failed"); - } } //-------------------------------------------------------------------------- @@ -371,9 +362,7 @@ void CommonFG::getObjinfo( const char* name, hbool_t follow_link, H5G_stat_t& st { herr_t ret_value = H5Gget_objinfo( getLocId(), name, follow_link, &statbuf ); if( ret_value < 0 ) - { throwException("getObjinfo", "H5Gget_objinfo failed"); - } } //-------------------------------------------------------------------------- @@ -400,9 +389,7 @@ void CommonFG::getObjinfo( const char* name, H5G_stat_t& statbuf ) const { herr_t ret_value = H5Gget_objinfo( getLocId(), name, 0, &statbuf ); if( ret_value < 0 ) - { throwException("getObjinfo", "H5Gget_objinfo failed"); - } } //-------------------------------------------------------------------------- @@ -440,9 +427,8 @@ H5std_string CommonFG::getLinkval( const char* name, size_t size ) const { ret_value = H5Lget_info(getLocId(), name, &linkinfo, H5P_DEFAULT); if( ret_value < 0 ) - { throwException("getLinkval", "H5Lget_info to find buffer size failed"); - } + val_size = linkinfo.u.val_size; } @@ -453,9 +439,8 @@ H5std_string CommonFG::getLinkval( const char* name, size_t size ) const ret_value = H5Lget_val(getLocId(), name, value_C, val_size, H5P_DEFAULT); if( ret_value < 0 ) - { throwException("getLinkval", "H5Lget_val failed"); - } + value = H5std_string(value_C); delete []value_C; } @@ -498,9 +483,7 @@ void CommonFG::setComment( const char* name, const char* comment ) const { herr_t ret_value = H5Oset_comment_by_name( getLocId(), name, comment, H5P_DEFAULT ); if( ret_value < 0 ) - { throwException("setComment", "H5Oset_comment_by_name failed"); - } } //-------------------------------------------------------------------------- @@ -530,9 +513,7 @@ void CommonFG::removeComment(const char* name) const { herr_t ret_value = H5Oset_comment_by_name(getLocId(), name, NULL, H5P_DEFAULT); if( ret_value < 0 ) - { throwException("removeComment", "H5Oset_comment_by_name failed"); - } } //-------------------------------------------------------------------------- @@ -588,9 +569,8 @@ H5std_string CommonFG::getComment( const char* name, size_t bufsize ) const // if H5Oget_comment_by_name returns SUCCEED, return the string comment, // otherwise, throw an exception if( ret_value < 0 ) - { throwException("getComment", "H5Oget_comment_by_name failed"); - } + H5std_string comment = H5std_string(comment_C); delete []comment_C; return (comment); @@ -628,9 +608,7 @@ void CommonFG::mount( const char* name, H5File& child, PropList& plist ) const // Raise exception if H5Fmount returns negative value if( ret_value < 0 ) - { throwException("mount", "H5Fmount failed"); - } } //-------------------------------------------------------------------------- @@ -659,9 +637,7 @@ void CommonFG::unmount( const char* name ) const // Raise exception if H5Funmount returns negative value if( ret_value < 0 ) - { throwException("unmount", "H5Funmount failed"); - } } //-------------------------------------------------------------------------- @@ -1006,9 +982,7 @@ hsize_t CommonFG::getNumObjs() const herr_t ret_value = H5Gget_info(getLocId(), &ginfo); if(ret_value < 0) - { throwException("getNumObjs", "H5Gget_info failed"); - } return (ginfo.nlinks); } @@ -1032,9 +1006,7 @@ H5std_string CommonFG::getObjnameByIdx(hsize_t idx) const // call H5Lget_name_by_idx with name as NULL to get its length ssize_t name_len = H5Lget_name_by_idx(getLocId(), ".", H5_INDEX_NAME, H5_ITER_INC, idx, NULL, 0, H5P_DEFAULT); if(name_len < 0) - { throwException("getObjnameByIdx", "H5Lget_name_by_idx failed"); - } // now, allocate C buffer to get the name char* name_C = new char[name_len+1]; @@ -1067,9 +1039,8 @@ ssize_t CommonFG::getObjnameByIdx(hsize_t idx, char* name, size_t size) const { ssize_t name_len = H5Lget_name_by_idx(getLocId(), ".", H5_INDEX_NAME, H5_ITER_INC, idx, name, size, H5P_DEFAULT); if(name_len < 0) - { throwException("getObjnameByIdx", "H5Lget_name_by_idx failed"); - } + return (name_len); } @@ -1085,9 +1056,8 @@ ssize_t CommonFG::getObjnameByIdx(hsize_t idx, H5std_string& name, size_t size) char* name_C = new char[size]; ssize_t name_len = getObjnameByIdx(idx, name_C, size); if(name_len < 0) - { throwException("getObjnameByIdx", "H5Lget_name_by_idx failed"); - } + name = H5std_string(name_C); delete []name_C; return (name_len); @@ -1107,9 +1077,8 @@ H5G_obj_t CommonFG::getObjTypeByIdx(hsize_t idx) const { H5G_obj_t obj_type = H5Gget_objtype_by_idx(getLocId(), idx); if (obj_type == H5G_UNKNOWN) - { throwException("getObjTypeByIdx", "H5Gget_objtype_by_idx failed"); - } + return (obj_type); } @@ -1135,9 +1104,7 @@ H5G_obj_t CommonFG::getObjTypeByIdx(hsize_t idx, char* type_name) const case H5G_TYPE: HDstrcpy(type_name, "datatype"); break; case H5G_UNKNOWN: default: - { throwException("getObjTypeByIdx", "H5Gget_objtype_by_idx failed"); - } } return (obj_type); } @@ -1163,9 +1130,7 @@ H5G_obj_t CommonFG::getObjTypeByIdx(hsize_t idx, H5std_string& type_name) const case H5G_TYPE: type_name = H5std_string("datatype"); break; case H5G_UNKNOWN: default: - { throwException("getObjTypeByIdx", "H5Gget_objtype_by_idx failed"); - } } return (obj_type); } diff --git a/c++/src/Makefile.in b/c++/src/Makefile.in index d8b2367..b025f0b 100644 --- a/c++/src/Makefile.in +++ b/c++/src/Makefile.in @@ -269,6 +269,7 @@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ +HAVE_PTHREAD = @HAVE_PTHREAD@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF_CXX = @HDF_CXX@ @@ -320,7 +321,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PARALLEL = @PARALLEL@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ -PTHREAD = @PTHREAD@ RANLIB = @RANLIB@ ROOT = @ROOT@ RUNPARALLEL = @RUNPARALLEL@ @@ -467,7 +467,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 127 +LT_VERS_REVISION = 138 LT_VERS_AGE = 0 # Include src directory diff --git a/c++/test/CMakeLists.txt b/c++/test/CMakeLists.txt index 7f4437c..124edb9 100644 --- a/c++/test/CMakeLists.txt +++ b/c++/test/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.6) +cmake_minimum_required (VERSION 2.8.10) PROJECT (HDF5_CPP_TEST) # -------------------------------------------------------------------- # Notes: When creating unit test executables they should be prefixed diff --git a/c++/test/Makefile.in b/c++/test/Makefile.in index 00a8056..ef1455c 100644 --- a/c++/test/Makefile.in +++ b/c++/test/Makefile.in @@ -230,6 +230,7 @@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ +HAVE_PTHREAD = @HAVE_PTHREAD@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF_CXX = @HDF_CXX@ @@ -281,7 +282,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PARALLEL = @PARALLEL@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ -PTHREAD = @PTHREAD@ RANLIB = @RANLIB@ ROOT = @ROOT@ RUNPARALLEL = @RUNPARALLEL@ diff --git a/config/apple b/config/apple index 34085e0..c5c0a19 100644 --- a/config/apple +++ b/config/apple @@ -58,10 +58,6 @@ if test "X-" = "X-$FC"; then ;; esac fi -# Figure out compiler flags -. $srcdir/config/gnu-fflags - -. $srcdir/config/intel-fflags # compiler version strings case $CC in @@ -79,20 +75,22 @@ case $CC in echo "No match to get cc_version_info for $CC" ;; esac - +# Figure out Fortran compiler flags and version strings case $FC in *gfortran*) + . $srcdir/config/gnu-fflags fc_version_info=`$FC $FCFLAGS $H5_FCFLAGS --version 2>&1 |\ grep 'GCC' | sed 's/\(.*(GCC) [-a-z0-9\. ]*\).*/\1/'` ;; *ifc*|*ifort*) + . $srcdir/config/intel-fflags fc_version_info=`$FC $FCFLAGS $H5_FCFLAGS -V 2>&1 | grep 'Version' |\ sed 's/\(Intel.* Compiler\).*\( Version [a-z0-9\.]*\).*\( Build [0-9]*\)/\1\2\3/'` ;; *) - echo "No match to get fc_version_info for $FC" + echo "No match to get fc_version_info and flags for $FC" ;; esac diff --git a/config/cmake/CPack.cmake b/config/cmake/CPack.cmake index 2e6b23a..d96fe43 100644 --- a/config/cmake/CPack.cmake +++ b/config/cmake/CPack.cmake @@ -1,5 +1,7 @@ -# - Build binary and source package installers -# +##section Variables common to all CPack generators +##end +##module +# - Build binary and source package installers. # The CPack module generates binary and source installers in a variety # of formats using the cpack program. Inclusion of the CPack module # adds two new targets to the resulting makefiles, package and @@ -29,16 +31,16 @@ # on a per-generator basis. It only need contain overrides. # # Here's how it works: -# - cpack runs -# - it includes CPackConfig.cmake -# - it iterates over the generators listed in that file's -# CPACK_GENERATOR list variable (unless told to use just a -# specific one via -G on the command line...) +# - cpack runs +# - it includes CPackConfig.cmake +# - it iterates over the generators listed in that file's +# CPACK_GENERATOR list variable (unless told to use just a +# specific one via -G on the command line...) # -# - foreach generator, it then -# - sets CPACK_GENERATOR to the one currently being iterated -# - includes the CPACK_PROJECT_CONFIG_FILE -# - produces the package for that generator +# - foreach generator, it then +# - sets CPACK_GENERATOR to the one currently being iterated +# - includes the CPACK_PROJECT_CONFIG_FILE +# - produces the package for that generator # # This is the key: For each generator listed in CPACK_GENERATOR # in CPackConfig.cmake, cpack will *reset* CPACK_GENERATOR @@ -48,174 +50,225 @@ # Before including this CPack module in your CMakeLists.txt file, # there are a variety of variables that can be set to customize # the resulting installers. The most commonly-used variables are: -# -# CPACK_PACKAGE_NAME - The name of the package (or application). If -# not specified, defaults to the project name. -# -# CPACK_PACKAGE_VENDOR - The name of the package vendor (e.g., -# "Kitware"). -# -# CPACK_PACKAGE_VERSION_MAJOR - Package major Version -# -# CPACK_PACKAGE_VERSION_MINOR - Package minor Version -# -# CPACK_PACKAGE_VERSION_PATCH - Package patch Version -# -# CPACK_PACKAGE_DESCRIPTION_FILE - A text file used to describe the -# project. Used, for example, the introduction screen of a -# CPack-generated Windows installer to describe the project. -# -# CPACK_PACKAGE_DESCRIPTION_SUMMARY - Short description of the -# project (only a few words). -# -# CPACK_PACKAGE_FILE_NAME - The name of the package file to generate, -# not including the extension. For example, cmake-2.6.1-Linux-i686. -# -# CPACK_PACKAGE_INSTALL_DIRECTORY - Installation directory on the -# target system, e.g., "CMake 2.5". -# -# CPACK_PROJECT_CONFIG_FILE - File included at cpack time, once per -# generator after setting CPACK_GENERATOR to the actual generator -# being used. Allows per-generator setting of CPACK_* variables at -# cpack time. -# -# CPACK_RESOURCE_FILE_LICENSE - License file for the project, which -# will typically be displayed to the user (often with an explicit -# "Accept" button, for graphical installers) prior to installation. -# -# CPACK_RESOURCE_FILE_README - ReadMe file for the project, which -# typically describes in some detail -# -# CPACK_RESOURCE_FILE_WELCOME - Welcome file for the project, which -# welcomes users to this installer. Typically used in the graphical -# installers on Windows and Mac OS X. -# -# CPACK_MONOLITHIC_INSTALL - Disables the component-based -# installation mechanism, so that all components are always installed. -# -# CPACK_GENERATOR - List of CPack generators to use. If not -# specified, CPack will create a set of options (e.g., -# CPACK_BINARY_NSIS) allowing the user to enable/disable individual -# generators. -# -# CPACK_OUTPUT_CONFIG_FILE - The name of the CPack configuration file -# for binary installers that will be generated by the CPack -# module. Defaults to CPackConfig.cmake. -# -# CPACK_PACKAGE_EXECUTABLES - Lists each of the executables along -# with a text label, to be used to create Start Menu shortcuts on -# Windows. For example, setting this to the list ccmake;CMake will -# create a shortcut named "CMake" that will execute the installed -# executable ccmake. -# -# CPACK_STRIP_FILES - List of files to be stripped. Starting with -# CMake 2.6.0 CPACK_STRIP_FILES will be a boolean variable which -# enables stripping of all files (a list of files evaluates to TRUE -# in CMake, so this change is compatible). -# -# The following CPack variables are specific to source packages, and +##end +# +##variable +# CPACK_PACKAGE_NAME - The name of the package (or application). If +# not specified, defaults to the project name. +##end +# +##variable +# CPACK_PACKAGE_VENDOR - The name of the package vendor. (e.g., +# "Kitware"). +##end +# +##variable +# CPACK_PACKAGE_DIRECTORY - The directory in which CPack is doing its +# packaging. If it is not set then this will default (internally) to the +# build dir. This variable may be defined in CPack config file or from +# the cpack command line option "-B". If set the command line option +# override the value found in the config file. +##end +# +##variable +# CPACK_PACKAGE_VERSION_MAJOR - Package major Version +##end +# +##variable +# CPACK_PACKAGE_VERSION_MINOR - Package minor Version +##end +# +##variable +# CPACK_PACKAGE_VERSION_PATCH - Package patch Version +##end +# +##variable +# CPACK_PACKAGE_DESCRIPTION_FILE - A text file used to describe the +# project. Used, for example, the introduction screen of a +# CPack-generated Windows installer to describe the project. +##end +# +##variable +# CPACK_PACKAGE_DESCRIPTION_SUMMARY - Short description of the +# project (only a few words). +##end +# +##variable +# CPACK_PACKAGE_FILE_NAME - The name of the package file to generate, +# not including the extension. For example, cmake-2.6.1-Linux-i686. +# The default value is +# +# ${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_SYSTEM_NAME}. +##end +# +##variable +# CPACK_PACKAGE_INSTALL_DIRECTORY - Installation directory on the +# target system. This may be used by some CPack generators +# like NSIS to create an installation directory e.g., "CMake 2.5" +# below the installation prefix. All installed element will be +# put inside this directory. +##end +# +##variable +# CPACK_PACKAGE_ICON - A branding image that will be displayed inside +# the installer (used by GUI installers). +##end +# +##variable +# CPACK_PROJECT_CONFIG_FILE - CPack-time project CPack configuration +# file. This file included at cpack time, once per +# generator after CPack has set CPACK_GENERATOR to the actual generator +# being used. It allows per-generator setting of CPACK_* variables at +# cpack time. +##end +# +##variable +# CPACK_RESOURCE_FILE_LICENSE - License to be embedded in the installer. It +# will typically be displayed to the user by the produced installer +# (often with an explicit "Accept" button, for graphical installers) +# prior to installation. This license file is NOT added to installed +# file but is used by some CPack generators like NSIS. If you want +# to install a license file (may be the same as this one) +# along with your project you must add an appropriate CMake INSTALL +# command in your CMakeLists.txt. +##end +# +##variable +# CPACK_RESOURCE_FILE_README - ReadMe file to be embedded in the installer. It +# typically describes in some detail the purpose of the project +# during the installation. Not all CPack generators uses +# this file. +##end +# +##variable +# CPACK_RESOURCE_FILE_WELCOME - Welcome file to be embedded in the +# installer. It welcomes users to this installer. +# Typically used in the graphical installers on Windows and Mac OS X. +##end +# +##variable +# CPACK_MONOLITHIC_INSTALL - Disables the component-based +# installation mechanism. When set the component specification is ignored +# and all installed items are put in a single "MONOLITHIC" package. +# Some CPack generators do monolithic packaging by default and +# may be asked to do component packaging by setting +# CPACK__COMPONENT_INSTALL to 1/TRUE. +##end +# +##variable +# CPACK_GENERATOR - List of CPack generators to use. If not +# specified, CPack will create a set of options CPACK_BINARY_ (e.g., +# CPACK_BINARY_NSIS) allowing the user to enable/disable individual +# generators. This variable may be used on the command line +# as well as in: +# +# cpack -D CPACK_GENERATOR="ZIP;TGZ" /path/to/build/tree +##end +# +##variable +# CPACK_OUTPUT_CONFIG_FILE - The name of the CPack binary configuration +# file. This file is the CPack configuration generated by the CPack module +# for binary installers. Defaults to CPackConfig.cmake. +##end +# +##variable +# CPACK_PACKAGE_EXECUTABLES - Lists each of the executables and associated +# text label to be used to create Start Menu shortcuts. For example, +# setting this to the list ccmake;CMake will +# create a shortcut named "CMake" that will execute the installed +# executable ccmake. Not all CPack generators use it (at least NSIS and +# OSXX11 do). +##end +# +##variable +# CPACK_STRIP_FILES - List of files to be stripped. Starting with +# CMake 2.6.0 CPACK_STRIP_FILES will be a boolean variable which +# enables stripping of all files (a list of files evaluates to TRUE +# in CMake, so this change is compatible). +##end +# +# The following CPack variables are specific to source packages, and # will not affect binary packages: # -# CPACK_SOURCE_PACKAGE_FILE_NAME - The name of the source package, -# e.g., cmake-2.6.1 -# -# CPACK_SOURCE_STRIP_FILES - List of files in the source tree that -# will be stripped. Starting with CMake 2.6.0 -# CPACK_SOURCE_STRIP_FILES will be a boolean variable which enables -# stripping of all files (a list of files evaluates to TRUE in CMake, -# so this change is compatible). -# -# CPACK_SOURCE_GENERATOR - List of generators used for the source -# packages. As with CPACK_GENERATOR, if this is not specified then -# CPack will create a set of options (e.g., CPACK_SOURCE_ZIP) -# allowing users to select which packages will be generated. -# -# CPACK_SOURCE_OUTPUT_CONFIG_FILE - The name of the CPack -# configuration file for source installers that will be generated by -# the CPack module. Defaults to CPackSourceConfig.cmake. -# -# CPACK_SOURCE_IGNORE_FILES - Pattern of files in the source tree -# that won't be packaged when building a source package. This is a -# list of patterns, e.g., /CVS/;/\\.svn/;\\.swp$;\\.#;/#;.*~;cscope.* -# -# The following variables are specific to the DragNDrop installers -# built on Mac OS X: -# -# CPACK_DMG_VOLUME_NAME - The volume name of the generated disk -# image. Defaults to CPACK_PACKAGE_FILE_NAME. -# -# CPACK_DMG_FORMAT - The disk image format. Common values are UDRO -# (UDIF read-only), UDZO (UDIF zlib-compressed) or UDBZ (UDIF -# bzip2-compressed). Refer to hdiutil(1) for more information on -# other available formats. -# -# CPACK_DMG_DS_STORE - Path to a custom .DS_Store file which e.g. -# can be used to specify the Finder window position/geometry and -# layout (such as hidden toolbars, placement of the icons etc.). -# This file has to be generated by the Finder (either manually or -# through OSA-script) using a normal folder from which the .DS_Store -# file can then be extracted. -# -# CPACK_DMG_BACKGROUND_IMAGE - Path to an image file which is to be -# used as the background for the Finder Window when the disk image -# is opened. By default no background image is set. The background -# image is applied after applying the custom .DS_Store file. -# -# CPACK_COMMAND_HDIUTIL - Path to the hdiutil(1) command used to -# operate on disk image files on Mac OS X. This variable can be used -# to override the automatically detected command (or specify its -# location if the auto-detection fails to find it.) -# -# CPACK_COMMAND_SETFILE - Path to the SetFile(1) command used to set -# extended attributes on files and directories on Mac OS X. This -# variable can be used to override the automatically detected -# command (or specify its location if the auto-detection fails to -# find it.) -# -# CPACK_COMMAND_REZ - Path to the Rez(1) command used to compile -# resources on Mac OS X. This variable can be used to override the -# automatically detected command (or specify its location if the -# auto-detection fails to find it.) -# -# The following variable is specific to installers build on Mac OS X -# using PackageMaker: -# -# CPACK_OSX_PACKAGE_VERSION - The version of Mac OS X that the -# resulting PackageMaker archive should be compatible -# with. Different versions of Mac OS X support different -# features. For example, CPack can only build component-based -# installers for Mac OS X 10.4 or newer, and can only build -# installers that download component son-the-fly for Mac OS X 10.5 -# or newer. If left blank, this value will be set to the minimum -# version of Mac OS X that supports the requested features. Set this -# variable to some value (e.g., 10.4) only if you want to guarantee -# that your installer will work on that version of Mac OS X, and -# don't mind missing extra features available in the installer -# shipping with later versions of Mac OS X. +##variable +# CPACK_SOURCE_PACKAGE_FILE_NAME - The name of the source package. For +# example cmake-2.6.1. +##end +# +##variable +# CPACK_SOURCE_STRIP_FILES - List of files in the source tree that +# will be stripped. Starting with CMake 2.6.0 +# CPACK_SOURCE_STRIP_FILES will be a boolean variable which enables +# stripping of all files (a list of files evaluates to TRUE in CMake, +# so this change is compatible). +##end +# +##variable +# CPACK_SOURCE_GENERATOR - List of generators used for the source +# packages. As with CPACK_GENERATOR, if this is not specified then +# CPack will create a set of options (e.g., CPACK_SOURCE_ZIP) +# allowing users to select which packages will be generated. +##end +# +##variable +# CPACK_SOURCE_OUTPUT_CONFIG_FILE - The name of the CPack source +# configuration file. This file is the CPack configuration generated by the +# CPack module for source installers. Defaults to CPackSourceConfig.cmake. +##end +# +##variable +# CPACK_SOURCE_IGNORE_FILES - Pattern of files in the source tree +# that won't be packaged when building a source package. This is a +# list of regular expression patterns (that must be properly escaped), +# e.g., /CVS/;/\\.svn/;\\.swp$;\\.#;/#;.*~;cscope.* +##end # # The following variables are for advanced uses of CPack: # -# CPACK_CMAKE_GENERATOR - What CMake generator should be used if the -# project is CMake project. Defaults to the value of CMAKE_GENERATOR; -# few users will want to change this setting. -# -# CPACK_INSTALL_CMAKE_PROJECTS - List of four values that specify -# what project to install. The four values are: Build directory, -# Project Name, Project Component, Directory. If omitted, CPack will -# build an installer that installers everything. -# -# CPACK_SYSTEM_NAME - System name, defaults to the value of -# ${CMAKE_SYSTEM_NAME}. -# -# CPACK_PACKAGE_VERSION - Package full version, used internally. By -# default, this is built from CPACK_PACKAGE_VERSION_MAJOR, -# CPACK_PACKAGE_VERSION_MINOR, and CPACK_PACKAGE_VERSION_PATCH. -# -# CPACK_TOPLEVEL_TAG - Directory for the installed files. -# -# CPACK_INSTALL_COMMANDS - Extra commands to install components. -# -# CPACK_INSTALLED_DIRECTORIES - Extra directories to install. +##variable +# CPACK_CMAKE_GENERATOR - What CMake generator should be used if the +# project is CMake project. Defaults to the value of CMAKE_GENERATOR +# few users will want to change this setting. +##end +# +##variable +# CPACK_INSTALL_CMAKE_PROJECTS - List of four values that specify +# what project to install. The four values are: Build directory, +# Project Name, Project Component, Directory. If omitted, CPack will +# build an installer that installers everything. +##end +# +##variable +# CPACK_SYSTEM_NAME - System name, defaults to the value of +# ${CMAKE_SYSTEM_NAME}. +##end +# +##variable +# CPACK_PACKAGE_VERSION - Package full version, used internally. By +# default, this is built from CPACK_PACKAGE_VERSION_MAJOR, +# CPACK_PACKAGE_VERSION_MINOR, and CPACK_PACKAGE_VERSION_PATCH. +##end +# +##variable +# CPACK_TOPLEVEL_TAG - Directory for the installed files. +##end +# +##variable +# CPACK_INSTALL_COMMANDS - Extra commands to install components. +##end +# +##variable +# CPACK_INSTALLED_DIRECTORIES - Extra directories to install. +##end +# +##variable +# CPACK_PACKAGE_INSTALL_REGISTRY_KEY - Registry key used when +# installing this project. This is only used +# by installer for Windows. +##end +##variable +# CPACK_CREATE_DESKTOP_LINKS - List of desktop links to create. +##end # #============================================================================= @@ -232,48 +285,48 @@ # License text for the above reference.) # Define this var in order to avoid (or warn) concerning multiple inclusion -IF(CPack_CMake_INCLUDED) - MESSAGE(WARNING "CPack.cmake has already been included!!") -ELSE(CPack_CMake_INCLUDED) - SET(CPack_CMake_INCLUDED 1) -ENDIF(CPack_CMake_INCLUDED) +if(CPack_CMake_INCLUDED) + message(WARNING "CPack.cmake has already been included!!") +else() + set(CPack_CMake_INCLUDED 1) +endif() # Pick a configuration file -SET(cpack_input_file "${CMAKE_ROOT}/Templates/CPackConfig.cmake.in") -IF(EXISTS "${CMAKE_SOURCE_DIR}/CPackConfig.cmake.in") - SET(cpack_input_file "${CMAKE_SOURCE_DIR}/CPackConfig.cmake.in") -ENDIF(EXISTS "${CMAKE_SOURCE_DIR}/CPackConfig.cmake.in") -SET(cpack_source_input_file "${CMAKE_ROOT}/Templates/CPackConfig.cmake.in") -IF(EXISTS "${CMAKE_SOURCE_DIR}/CPackSourceConfig.cmake.in") - SET(cpack_source_input_file "${CMAKE_SOURCE_DIR}/CPackSourceConfig.cmake.in") -ENDIF(EXISTS "${CMAKE_SOURCE_DIR}/CPackSourceConfig.cmake.in") +set(cpack_input_file "${CMAKE_ROOT}/Templates/CPackConfig.cmake.in") +if(EXISTS "${CMAKE_SOURCE_DIR}/CPackConfig.cmake.in") + set(cpack_input_file "${CMAKE_SOURCE_DIR}/CPackConfig.cmake.in") +endif() +set(cpack_source_input_file "${CMAKE_ROOT}/Templates/CPackConfig.cmake.in") +if(EXISTS "${CMAKE_SOURCE_DIR}/CPackSourceConfig.cmake.in") + set(cpack_source_input_file "${CMAKE_SOURCE_DIR}/CPackSourceConfig.cmake.in") +endif() # Backward compatibility # Include CPackComponent macros if it has not already been included before. include(CPackComponent) # Macro for setting values if a user did not overwrite them -MACRO(cpack_set_if_not_set name value) - IF(NOT DEFINED "${name}") - SET(${name} "${value}") - ENDIF(NOT DEFINED "${name}") -ENDMACRO(cpack_set_if_not_set) +macro(cpack_set_if_not_set name value) + if(NOT DEFINED "${name}") + set(${name} "${value}") + endif() +endmacro() -# Macro to encode variables for the configuration file +# cpack_encode_variables - Macro to encode variables for the configuration file # find any variable that starts with CPACK and create a variable # _CPACK_OTHER_VARIABLES_ that contains SET commands for # each cpack variable. _CPACK_OTHER_VARIABLES_ is then # used as an @ replacment in configure_file for the CPackConfig. -MACRO(cpack_encode_variables) - SET(_CPACK_OTHER_VARIABLES_) - GET_CMAKE_PROPERTY(res VARIABLES) - FOREACH(var ${res}) - IF("xxx${var}" MATCHES "xxxCPACK") - SET(_CPACK_OTHER_VARIABLES_ +macro(cpack_encode_variables) + set(_CPACK_OTHER_VARIABLES_) + get_cmake_property(res VARIABLES) + foreach(var ${res}) + if("xxx${var}" MATCHES "xxxCPACK") + set(_CPACK_OTHER_VARIABLES_ "${_CPACK_OTHER_VARIABLES_}\nSET(${var} \"${${var}}\")") - ENDIF("xxx${var}" MATCHES "xxxCPACK") - ENDFOREACH(var ${res}) -ENDMACRO(cpack_encode_variables) + endif() + endforeach() +endmacro() # Set the package name cpack_set_if_not_set(CPACK_PACKAGE_NAME "${CMAKE_PROJECT_NAME}") @@ -297,27 +350,31 @@ cpack_set_if_not_set(CPACK_RESOURCE_FILE_WELCOME cpack_set_if_not_set(CPACK_MODULE_PATH "${CMAKE_MODULE_PATH}") -IF(CPACK_NSIS_MODIFY_PATH) - SET(CPACK_NSIS_MODIFY_PATH ON) -ENDIF(CPACK_NSIS_MODIFY_PATH) - -SET(__cpack_system_name ${CMAKE_SYSTEM_NAME}) -IF(${__cpack_system_name} MATCHES Windows) - IF(CMAKE_CL_64) - SET(__cpack_system_name win64) - ELSE(CMAKE_CL_64) - SET(__cpack_system_name win32) - ENDIF(CMAKE_CL_64) -ENDIF(${__cpack_system_name} MATCHES Windows) +if(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL) + set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON) +endif() + +if(CPACK_NSIS_MODIFY_PATH) + set(CPACK_NSIS_MODIFY_PATH ON) +endif() + +set(__cpack_system_name ${CMAKE_SYSTEM_NAME}) +if(${__cpack_system_name} MATCHES Windows) + if(CMAKE_CL_64) + set(__cpack_system_name win64) + else() + set(__cpack_system_name win32) + endif() +endif() cpack_set_if_not_set(CPACK_SYSTEM_NAME "${__cpack_system_name}") # Root dir: default value should be the string literal "$PROGRAMFILES" # for backwards compatibility. Projects may set this value to anything. if(CMAKE_CL_64) set(__cpack_root_default "$PROGRAMFILES64") -else(CMAKE_CL_64) +else() set(__cpack_root_default "$PROGRAMFILES") -endif(CMAKE_CL_64) +endif() cpack_set_if_not_set(CPACK_NSIS_INSTALL_ROOT "${__cpack_root_default}") # -..--. @@ -333,15 +390,15 @@ cpack_set_if_not_set(CPACK_PACKAGE_RELOCATABLE "true") # always force to exactly "true" or "false" for CPack.Info.plist.in: if(CPACK_PACKAGE_RELOCATABLE) set(CPACK_PACKAGE_RELOCATABLE "true") -else(CPACK_PACKAGE_RELOCATABLE) +else() set(CPACK_PACKAGE_RELOCATABLE "false") -endif(CPACK_PACKAGE_RELOCATABLE) +endif() macro(cpack_check_file_exists file description) if(NOT EXISTS "${file}") message(SEND_ERROR "CPack ${description} file: \"${file}\" could not be found.") - endif(NOT EXISTS "${file}") -endmacro(cpack_check_file_exists) + endif() +endmacro() cpack_check_file_exists("${CPACK_PACKAGE_DESCRIPTION_FILE}" "package description") cpack_check_file_exists("${CPACK_RESOURCE_FILE_LICENSE}" "license resource") @@ -351,9 +408,15 @@ cpack_check_file_exists("${CPACK_RESOURCE_FILE_WELCOME}" "welcome resource") macro(cpack_optional_append _list _cond _item) if(${_cond}) set(${_list} ${${_list}} ${_item}) - endif(${_cond}) -endmacro(cpack_optional_append _list _cond _item) - + endif() +endmacro() + +##variable +# CPACK_BINARY_ - CPack generated options for binary generators. The +# CPack.cmake module generates (when CPACK_GENERATOR is not set) +# a set of CMake options (see CMake option command) which may then be used to +# select the CPack generator(s) to be used when launching the package target. +##end # Provide options to choose generators # we might check here if the required tools for the generates exist # and set the defaults according to the results @@ -361,27 +424,27 @@ if(NOT CPACK_GENERATOR) if(UNIX) if(CYGWIN) option(CPACK_BINARY_CYGWIN "Enable to build Cygwin binary packages" ON) - else(CYGWIN) + else() if(APPLE) option(CPACK_BINARY_BUNDLE "Enable to build OSX bundles" OFF) option(CPACK_BINARY_DRAGNDROP "Enable to build OSX Drag And Drop package" OFF) option(CPACK_BINARY_PACKAGEMAKER "Enable to build PackageMaker packages" ON) option(CPACK_BINARY_OSXX11 "Enable to build OSX X11 packages" OFF) - else(APPLE) + else() option(CPACK_BINARY_TZ "Enable to build TZ packages" ON) - endif(APPLE) + endif() option(CPACK_BINARY_STGZ "Enable to build STGZ packages" ON) option(CPACK_BINARY_TGZ "Enable to build TGZ packages" ON) option(CPACK_BINARY_TBZ2 "Enable to build TBZ2 packages" OFF) option(CPACK_BINARY_DEB "Enable to build Debian packages" OFF) option(CPACK_BINARY_RPM "Enable to build RPM packages" OFF) option(CPACK_BINARY_NSIS "Enable to build NSIS packages" OFF) - endif(CYGWIN) - else(UNIX) + endif() + else() option(CPACK_BINARY_NSIS "Enable to build NSIS packages" ON) option(CPACK_BINARY_ZIP "Enable to build ZIP packages" OFF) - endif(UNIX) - + endif() + cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_BUNDLE Bundle) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_DRAGNDROP DragNDrop) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_PACKAGEMAKER PackageMaker) @@ -395,37 +458,37 @@ if(NOT CPACK_GENERATOR) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_TBZ2 TBZ2) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_TZ TZ) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_ZIP ZIP) - -endif(NOT CPACK_GENERATOR) + +endif() # Provide options to choose source generators if(NOT CPACK_SOURCE_GENERATOR) if(UNIX) if(CYGWIN) option(CPACK_SOURCE_CYGWIN "Enable to build Cygwin source packages" ON) - else(CYGWIN) + else() option(CPACK_SOURCE_TBZ2 "Enable to build TBZ2 source packages" ON) option(CPACK_SOURCE_TGZ "Enable to build TGZ source packages" ON) option(CPACK_SOURCE_TZ "Enable to build TZ source packages" ON) option(CPACK_SOURCE_ZIP "Enable to build ZIP source packages" OFF) - endif(CYGWIN) - else(UNIX) + endif() + else() option(CPACK_SOURCE_ZIP "Enable to build ZIP source packages" ON) - endif(UNIX) + endif() cpack_optional_append(CPACK_SOURCE_GENERATOR CPACK_SOURCE_CYGWIN CygwinSource) cpack_optional_append(CPACK_SOURCE_GENERATOR CPACK_SOURCE_TGZ TGZ) cpack_optional_append(CPACK_SOURCE_GENERATOR CPACK_SOURCE_TBZ2 TBZ2) cpack_optional_append(CPACK_SOURCE_GENERATOR CPACK_SOURCE_TZ TZ) cpack_optional_append(CPACK_SOURCE_GENERATOR CPACK_SOURCE_ZIP ZIP) -endif(NOT CPACK_SOURCE_GENERATOR) +endif() # mark the above options as advanced mark_as_advanced(CPACK_BINARY_CYGWIN CPACK_BINARY_PACKAGEMAKER CPACK_BINARY_OSXX11 - CPACK_BINARY_STGZ CPACK_BINARY_TGZ CPACK_BINARY_TBZ2 - CPACK_BINARY_DEB CPACK_BINARY_RPM CPACK_BINARY_TZ + CPACK_BINARY_STGZ CPACK_BINARY_TGZ CPACK_BINARY_TBZ2 + CPACK_BINARY_DEB CPACK_BINARY_RPM CPACK_BINARY_TZ CPACK_BINARY_NSIS CPACK_BINARY_ZIP CPACK_BINARY_BUNDLE - CPACK_SOURCE_CYGWIN CPACK_SOURCE_TBZ2 CPACK_SOURCE_TGZ + CPACK_SOURCE_CYGWIN CPACK_SOURCE_TBZ2 CPACK_SOURCE_TGZ CPACK_SOURCE_TZ CPACK_SOURCE_ZIP CPACK_BINARY_DRAGNDROP) # Set some other variables @@ -435,16 +498,16 @@ cpack_set_if_not_set(CPACK_CMAKE_GENERATOR "${CMAKE_GENERATOR}") cpack_set_if_not_set(CPACK_TOPLEVEL_TAG "${CPACK_SYSTEM_NAME}") # if the user has set CPACK_NSIS_DISPLAY_NAME remember it if(DEFINED CPACK_NSIS_DISPLAY_NAME) - SET(CPACK_NSIS_DISPLAY_NAME_SET TRUE) + set(CPACK_NSIS_DISPLAY_NAME_SET TRUE) endif() # if the user has set CPACK_NSIS_DISPLAY # explicitly, then use that as the default # value of CPACK_NSIS_PACKAGE_NAME instead -# of CPACK_PACKAGE_INSTALL_DIRECTORY +# of CPACK_PACKAGE_INSTALL_DIRECTORY cpack_set_if_not_set(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY}") if(CPACK_NSIS_DISPLAY_NAME_SET) - string(REPLACE "\\" "\\\\" + string(REPLACE "\\" "\\\\" _NSIS_DISPLAY_NAME_TMP "${CPACK_NSIS_DISPLAY_NAME}") cpack_set_if_not_set(CPACK_NSIS_PACKAGE_NAME "${_NSIS_DISPLAY_NAME_TMP}") else() @@ -463,31 +526,31 @@ cpack_set_if_not_set(CPACK_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") cpack_set_if_not_set(CPACK_NSIS_INSTALLER_ICON_CODE "") cpack_set_if_not_set(CPACK_NSIS_INSTALLER_MUI_ICON_CODE "") -IF(DEFINED CPACK_COMPONENTS_ALL) - IF(CPACK_MONOLITHIC_INSTALL) - MESSAGE("CPack warning: both CPACK_COMPONENTS_ALL and CPACK_MONOLITHIC_INSTALL have been set.\nDefaulting to a monolithic installation.") - SET(CPACK_COMPONENTS_ALL) - ELSE(CPACK_MONOLITHIC_INSTALL) +if(DEFINED CPACK_COMPONENTS_ALL) + if(CPACK_MONOLITHIC_INSTALL) + message("CPack warning: both CPACK_COMPONENTS_ALL and CPACK_MONOLITHIC_INSTALL have been set.\nDefaulting to a monolithic installation.") + set(CPACK_COMPONENTS_ALL) + else() # The user has provided the set of components to be installed as # part of a component-based installation; trust her. - SET(CPACK_COMPONENTS_ALL_SET_BY_USER TRUE) - ENDIF(CPACK_MONOLITHIC_INSTALL) -ELSE(DEFINED CPACK_COMPONENTS_ALL) + set(CPACK_COMPONENTS_ALL_SET_BY_USER TRUE) + endif() +else() # If the user has not specifically requested a monolithic installer # but has specified components in various "install" commands, tell # CPack about those components. - IF(NOT CPACK_MONOLITHIC_INSTALL) - GET_CMAKE_PROPERTY(CPACK_COMPONENTS_ALL COMPONENTS) - LIST(LENGTH CPACK_COMPONENTS_ALL CPACK_COMPONENTS_LEN) - IF(CPACK_COMPONENTS_LEN EQUAL 1) + if(NOT CPACK_MONOLITHIC_INSTALL) + get_cmake_property(CPACK_COMPONENTS_ALL COMPONENTS) + list(LENGTH CPACK_COMPONENTS_ALL CPACK_COMPONENTS_LEN) + if(CPACK_COMPONENTS_LEN EQUAL 1) # Only one component: this is not a component-based installation # (at least, it isn't a component-based installation, but may # become one later if the user uses the cpack_add_* commands). - SET(CPACK_COMPONENTS_ALL) - ENDIF(CPACK_COMPONENTS_LEN EQUAL 1) - SET(CPACK_COMPONENTS_LEN) - ENDIF(NOT CPACK_MONOLITHIC_INSTALL) -ENDIF(DEFINED CPACK_COMPONENTS_ALL) + set(CPACK_COMPONENTS_ALL) + endif() + set(CPACK_COMPONENTS_LEN) + endif() +endif() # CMake always generates a component named "Unspecified", which is # used to install everything that doesn't have an explicitly-provided @@ -507,13 +570,13 @@ cpack_set_if_not_set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-Source") cpack_set_if_not_set(CPACK_SOURCE_IGNORE_FILES "/CVS/;/\\\\\\\\.svn/;/\\\\\\\\.bzr/;/\\\\\\\\.hg/;/\\\\\\\\.git/;\\\\\\\\.swp$;\\\\\\\\.#;/#") -SET(CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_SOURCE_INSTALL_CMAKE_PROJECTS}") -SET(CPACK_INSTALLED_DIRECTORIES "${CPACK_SOURCE_INSTALLED_DIRECTORIES}") -SET(CPACK_GENERATOR "${CPACK_SOURCE_GENERATOR}") -SET(CPACK_TOPLEVEL_TAG "${CPACK_SOURCE_TOPLEVEL_TAG}") -SET(CPACK_PACKAGE_FILE_NAME "${CPACK_SOURCE_PACKAGE_FILE_NAME}") -SET(CPACK_IGNORE_FILES "${CPACK_SOURCE_IGNORE_FILES}") -SET(CPACK_STRIP_FILES "${CPACK_SOURCE_STRIP_FILES}") +set(CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_SOURCE_INSTALL_CMAKE_PROJECTS}") +set(CPACK_INSTALLED_DIRECTORIES "${CPACK_SOURCE_INSTALLED_DIRECTORIES}") +set(CPACK_GENERATOR "${CPACK_SOURCE_GENERATOR}") +set(CPACK_TOPLEVEL_TAG "${CPACK_SOURCE_TOPLEVEL_TAG}") +set(CPACK_PACKAGE_FILE_NAME "${CPACK_SOURCE_PACKAGE_FILE_NAME}") +set(CPACK_IGNORE_FILES "${CPACK_SOURCE_IGNORE_FILES}") +set(CPACK_STRIP_FILES "${CPACK_SOURCE_STRIP_FILES}") cpack_encode_variables() configure_file("${cpack_source_input_file}" diff --git a/config/cmake/CTestCustom.cmake b/config/cmake/CTestCustom.cmake index 6b6acc2..ec7b10e 100755 --- a/config/cmake/CTestCustom.cmake +++ b/config/cmake/CTestCustom.cmake @@ -13,6 +13,7 @@ SET (CTEST_CUSTOM_WARNING_EXCEPTION "disabling jobserver mode" "config.cmake.xlatefile.c" "warning.*implicit declaration of function" + "note: expanded from macro" # "fpp:[ \t]*warning:[ \t]*cannot remove H5_DEBUG_API - not a predefined macro" ) @@ -37,35 +38,15 @@ SET (CTEST_CUSTOM_MEMCHECK_IGNORE hl_test-clear-objects hl_fortran_test-clear-objects ######### tools/h5copy ######### - H5COPY-clear-refs - H5COPY-clear-ext-links - H5COPY-clear-misc + H5COPY-clearall-objects ######### tools/h5diff ######### H5DIFF-clearall-objects ######### tools/h5dump ######### H5DUMP-clearall-objects - H5DUMP-clear-out1 - H5DUMP-clear-out3 - H5DUMP-clear-objects H5DUMP_PACKED_BITS-clearall-objects H5DUMP-XML-clearall-objects ######### tools/h5import ######### - H5IMPORT-ASCII_I32-clear-objects - H5IMPORT-ASCII_I16-clear-objects - H5IMPORT-ASCII_I8-clear-objects - H5IMPORT-ASCII_UI16-clear-objects - H5IMPORT-ASCII_UI32-clear-objects - H5IMPORT-ASCII_F32-clear-objects - H5IMPORT-ASCII_F64-clear-objects - H5IMPORT-BINARY_F64-clear-objects - H5IMPORT-BINARY_I8-clear-objects - H5IMPORT-BINARY_I16-clear-objects - H5IMPORT-BINARY_I32-clear-objects - H5IMPORT-BINARY_UI16-clear-objects - H5IMPORT-BINARY_UI32-clear-objects - H5IMPORT-STR-clear-objects - H5IMPORT-BINARY_I8_EOF-clear-objects - H5IMPORT-ASCII_F64_R1-clear-objects + H5IMPORT-clear-objects ######### tools/h5jam ######### H5JAM-SETUP-N_twithub_u10_c-clear-objects H5JAM-SETUP-N_twithub_u10_c @@ -224,47 +205,8 @@ SET (CTEST_CUSTOM_MEMCHECK_IGNORE ######### tools/h5stat ######### H5STAT-clearall-objects ######### tools/misc ######### - h5repart_20K-clear-objects - h5repart_5K-clear-objects - h5repart_sec2-clear-objects - H5MKGRP_CMP-clear-h5mkgrp_help - H5MKGRP_CMP-clear-h5mkgrp_version - H5MKGRP-clear-h5mkgrp_single - H5MKGRP-h5mkgrp_single #uses runTest.cmake - H5MKGRP-h5ls-h5mkgrp_single #uses runTest.cmake - H5MKGRP-clear-h5mkgrp_single-v - H5MKGRP-h5mkgrp_single-v #uses runTest.cmake - H5MKGRP-h5ls-h5mkgrp_single-v #uses runTest.cmake - H5MKGRP-clear-h5mkgrp_single-p - H5MKGRP-h5mkgrp_single-p #uses runTest.cmake - H5MKGRP-h5ls-h5mkgrp_single-p #uses runTest.cmake - H5MKGRP-clear-h5mkgrp_single_latest-l - H5MKGRP-h5mkgrp_single_latest-l #uses runTest.cmake - H5MKGRP-h5ls-h5mkgrp_single_latest-l #uses runTest.cmake - H5MKGRP-clear-h5mkgrp_several - H5MKGRP-h5mkgrp_several #uses runTest.cmake - H5MKGRP-h5ls-h5mkgrp_several #uses runTest.cmake - H5MKGRP-clear-h5mkgrp_several-v - H5MKGRP-h5mkgrp_several-v #uses runTest.cmake - H5MKGRP-h5ls-h5mkgrp_several-v #uses runTest.cmake - H5MKGRP-clear-h5mkgrp_several-p - H5MKGRP-h5mkgrp_several-p #uses runTest.cmake - H5MKGRP-h5ls-h5mkgrp_several-p #uses runTest.cmake - H5MKGRP-clear-h5mkgrp_several_latest-l - H5MKGRP-h5mkgrp_several_latest-l #uses runTest.cmake - H5MKGRP-h5ls-h5mkgrp_several_latest-l #uses runTest.cmake - H5MKGRP-clear-h5mkgrp_nested-p - H5MKGRP-h5mkgrp_nested-p #uses runTest.cmake - H5MKGRP-h5ls-h5mkgrp_nested-p #uses runTest.cmake - H5MKGRP-clear-h5mkgrp_nested_latest-lp - H5MKGRP-h5mkgrp_nested_latest-lp #uses runTest.cmake - H5MKGRP-h5ls-h5mkgrp_nested_latest-lp #uses runTest.cmake - H5MKGRP-clear-h5mkgrp_nested_mult-p - H5MKGRP-h5mkgrp_nested_mult-p #uses runTest.cmake - H5MKGRP-h5ls-h5mkgrp_nested_mult-p #uses runTest.cmake - H5MKGRP-clear-h5mkgrp_nested_mult_latest-lp - H5MKGRP-h5mkgrp_nested_mult_latest-lp #uses runTest.cmake - H5MKGRP-h5ls-h5mkgrp_nested_mult_latest-lp #uses runTest.cmake + H5REPART-clearall-objects + H5MKGRP-clearall-objects ######### examples ######### EXAMPLES-clear-objects cpp_ex-clear-objects diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index 4f4f759..6db6d78 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -14,7 +14,7 @@ INCLUDE (${CMAKE_ROOT}/Modules/TestBigEndian.cmake) INCLUDE (${CMAKE_ROOT}/Modules/TestForSTDNamespace.cmake) #----------------------------------------------------------------------------- -# Always SET this for now IF we are on an OS X box +# APPLE/Darwin setup #----------------------------------------------------------------------------- IF (APPLE) LIST(LENGTH CMAKE_OSX_ARCHITECTURES ARCH_LENGTH) @@ -28,6 +28,11 @@ IF (APPLE) SET (H5_AC_APPLE_UNIVERSAL_BUILD 0) ENDIF (APPLE) +# Check for Darwin (not just Apple - we also want to catch OpenDarwin) +IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + SET (H5_HAVE_DARWIN 1) +ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + #----------------------------------------------------------------------------- # Option to Clear File Buffers before write --enable-clear-file-buffers #----------------------------------------------------------------------------- diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index 6fca1ae..d9f0997 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -111,6 +111,9 @@ /* Define if the function stack tracing code is to be compiled in */ #cmakedefine H5_HAVE_CODESTACK @H5_HAVE_CODESTACK@ +/* Define if Darwin or Mac OS X */ +#cmakedefine H5_HAVE_DARWIN @H5_HAVE_DARWIN@ + /* Define to 1 if you have the declaration of `tzname', and to 0 if you don't. */ #cmakedefine H5_HAVE_DECL_TZNAME @H5_HAVE_DECL_TZNAME@ diff --git a/config/cmake/HDF5UseFortran.cmake b/config/cmake/HDF5UseFortran.cmake index 323c9ef..8fa76b8 100644 --- a/config/cmake/HDF5UseFortran.cmake +++ b/config/cmake/HDF5UseFortran.cmake @@ -110,6 +110,9 @@ CHECK_FORTRAN_FEATURE(RealIsNotDouble FORTRAN_DEFAULT_REAL_NOT_DOUBLE ) +#----------------------------------------------------------------------------- +# Checks if the ISO_C_BINDING module meets all the requirements +#----------------------------------------------------------------------------- CHECK_FORTRAN_FEATURE(iso_c_binding " PROGRAM main @@ -117,6 +120,7 @@ CHECK_FORTRAN_FEATURE(iso_c_binding IMPLICIT NONE TYPE(C_PTR) :: ptr TYPE(C_FUNPTR) :: funptr + INTEGER(C_INT64_T) :: c_int64_type CHARACTER(LEN=80, KIND=c_char), TARGET :: ichr ptr = C_LOC(ichr(1:1)) END PROGRAM diff --git a/config/cmake/grepTest.cmake b/config/cmake/grepTest.cmake index 365d9c3..74ac912 100644 --- a/config/cmake/grepTest.cmake +++ b/config/cmake/grepTest.cmake @@ -57,7 +57,7 @@ IF (${TEST_EXPECT} STREQUAL "1") IF (NOT ${TEST_RESULT} STREQUAL "0") MESSAGE (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did contain ${TEST_FILTER}") ENDIF (NOT ${TEST_RESULT} STREQUAL "0") -ENDIF (${TEST_EXPECT} STREQUAL "0") +ENDIF (${TEST_EXPECT} STREQUAL "1") # everything went fine... MESSAGE ("Passed: The output of ${TEST_PROGRAM} matched") diff --git a/config/cmake/mccacheinit.cmake b/config/cmake/mccacheinit.cmake index b472acf..8ca3879 100755 --- a/config/cmake/mccacheinit.cmake +++ b/config/cmake/mccacheinit.cmake @@ -8,6 +8,8 @@ SET (BUILD_SHARED_LIBS OFF CACHE BOOL "Build Shared Libraries" FORCE) SET (BUILD_TESTING ON CACHE BOOL "Build HDF5 Unit Testing" FORCE) +SET (HDF_PACKAGE_EXT "" CACHE STRING "Name of HDF package extension" FORCE) + SET (HDF5_BUILD_CPP_LIB ON CACHE BOOL "Build HDF5 C++ Library" FORCE) SET (HDF5_BUILD_EXAMPLES ON CACHE BOOL "Build HDF5 Library Examples" FORCE) @@ -58,7 +60,7 @@ SET (HDF5_ENABLE_THREADSAFE OFF CACHE BOOL "(WINDOWS)Enable Threadsafety" FORCE) SET (HDF5_PACKAGE_EXTLIBS OFF CACHE BOOL "(WINDOWS)CPACK - include external libraries" FORCE) -SET (HDF5_NO_PACKAGES OFF CACHE BOOL "CPACK - Disable packaging" FORCE) +SET (HDF5_NO_PACKAGES ON CACHE BOOL "CPACK - Disable packaging" FORCE) SET (HDF5_ALLOW_EXTERNAL_SUPPORT "NO" CACHE STRING "Allow External Library Building" FORCE) @@ -74,3 +76,6 @@ SET (CMAKE_BUILD_TYPE "Debug" CACHE STRING "Build Debug" FORCE) SET (CTEST_BUILD_CONFIGURATION "Debug" CACHE STRING "Build Debug" FORCE) +SET (ZLIB_PACKAGE_NAME "zlib" CACHE STRING "Name of ZLIB package" FORCE) + +SET (SZIP_PACKAGE_NAME "szip" CACHE STRING "Name of SZIP package" FORCE) diff --git a/config/cmake/prunTest.cmake b/config/cmake/prunTest.cmake index 261f8a4..b9ead6f 100644 --- a/config/cmake/prunTest.cmake +++ b/config/cmake/prunTest.cmake @@ -1,5 +1,6 @@ # runTest.cmake executes a command and captures the output in a file. File is then compared # against a reference file. Exit status of command can also be compared. +cmake_policy(SET CMP0007 NEW) # arguments checking IF (NOT TEST_PROGRAM) @@ -103,24 +104,33 @@ IF (NOT TEST_SKIP_COMPARE) ENDIF (WIN32 AND NOT MINGW) # now compare the output with the reference + EXECUTE_PROCESS ( + COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_FOLDER}/P_${TEST_REFERENCE} + RESULT_VARIABLE TEST_RESULT + ) + IF (NOT ${TEST_RESULT} STREQUAL 0) SET (TEST_RESULT 0) FILE (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} test_act) - LIST (LENGTH "${test_act}" len_act) + LIST (LENGTH test_act len_act) FILE (STRINGS ${TEST_FOLDER}/P_${TEST_REFERENCE} test_ref) - LIST (LENGTH "${test_ref}" len_ref) - MATH (EXPR _FP_LEN "${len_ref} - 1") - FOREACH (line RANGE 0 ${_FP_LEN}) - LIST (GET "${test_act}" ${line} str_act) - LIST (GET "${test_ref}" ${line} str_ref) - STRING (COMPARE NOTEQUAL ${str_act} ${str_ref} str_res) - IF (${str_res}) - SET (TEST_RESULT 1) - MESSAGE ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}") - ENDIF (${str_res}) - ENDFOREACH (line RANGE 0 ${_FP_LEN}) + LIST (LENGTH test_ref len_ref) + IF (NOT ${len_act} STREQUAL "0") + MATH (EXPR _FP_LEN "${len_ref} - 1") + FOREACH (line RANGE 0 ${_FP_LEN}) + LIST (GET test_act ${line} str_act) + LIST (GET test_ref ${line} str_ref) + IF (NOT "${str_act}" STREQUAL "${str_ref}") + IF (NOT "${str_act}" STREQUAL "") + SET (TEST_RESULT 1) + MESSAGE ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n") + ENDIF (NOT "${str_act}" STREQUAL "") + ENDIF (NOT "${str_act}" STREQUAL "${str_ref}") + ENDFOREACH (line RANGE 0 ${_FP_LEN}) + ENDIF (NOT ${len_act} STREQUAL "0") IF (NOT ${len_act} STREQUAL ${len_ref}) SET (TEST_RESULT 1) ENDIF (NOT ${len_act} STREQUAL ${len_ref}) + ENDIF (NOT ${TEST_RESULT} STREQUAL 0) MESSAGE (STATUS "COMPARE Result: ${TEST_RESULT}") diff --git a/config/cmake/runTest.cmake b/config/cmake/runTest.cmake index 78ccf9f..0a80873 100644 --- a/config/cmake/runTest.cmake +++ b/config/cmake/runTest.cmake @@ -1,5 +1,6 @@ # runTest.cmake executes a command and captures the output in a file. File is then compared # against a reference file. Exit status of command can also be compared. +cmake_policy(SET CMP0007 NEW) # arguments checking IF (NOT TEST_PROGRAM) @@ -108,24 +109,33 @@ IF (NOT TEST_SKIP_COMPARE) ENDIF (WIN32 AND NOT MINGW) # now compare the output with the reference + EXECUTE_PROCESS ( + COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_FOLDER}/${TEST_REFERENCE} + RESULT_VARIABLE TEST_RESULT + ) + IF (NOT ${TEST_RESULT} STREQUAL 0) SET (TEST_RESULT 0) FILE (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} test_act) - LIST (LENGTH "${test_act}" len_act) + LIST (LENGTH test_act len_act) FILE (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} test_ref) - LIST (LENGTH "${test_ref}" len_ref) - MATH (EXPR _FP_LEN "${len_ref} - 1") - FOREACH (line RANGE 0 ${_FP_LEN}) - LIST (GET "${test_act}" ${line} str_act) - LIST (GET "${test_ref}" ${line} str_ref) - STRING (COMPARE NOTEQUAL ${str_act} ${str_ref} str_res) - IF (${str_res}) - SET (TEST_RESULT 1) - MESSAGE ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}") - ENDIF (${str_res}) - ENDFOREACH (line RANGE 0 ${_FP_LEN}) + LIST (LENGTH test_ref len_ref) + IF (NOT ${len_act} STREQUAL "0") + MATH (EXPR _FP_LEN "${len_ref} - 1") + FOREACH (line RANGE 0 ${_FP_LEN}) + LIST (GET test_act ${line} str_act) + LIST (GET test_ref ${line} str_ref) + IF (NOT "${str_act}" STREQUAL "${str_ref}") + IF (NOT "${str_act}" STREQUAL "") + SET (TEST_RESULT 1) + MESSAGE ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n") + ENDIF (NOT "${str_act}" STREQUAL "") + ENDIF (NOT "${str_act}" STREQUAL "${str_ref}") + ENDFOREACH (line RANGE 0 ${_FP_LEN}) + ENDIF (NOT ${len_act} STREQUAL "0") IF (NOT ${len_act} STREQUAL ${len_ref}) SET (TEST_RESULT 1) ENDIF (NOT ${len_act} STREQUAL ${len_ref}) + ENDIF (NOT ${TEST_RESULT} STREQUAL 0) MESSAGE (STATUS "COMPARE Result: ${TEST_RESULT}") @@ -141,24 +151,34 @@ IF (NOT TEST_SKIP_COMPARE) ENDIF (WIN32 AND NOT MINGW) # now compare the error output with the error reference + EXECUTE_PROCESS ( + COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT}.err ${TEST_FOLDER}/${TEST_ERRREF} + RESULT_VARIABLE TEST_RESULT + ) + IF (NOT ${TEST_RESULT} STREQUAL 0) SET (TEST_RESULT 0) FILE (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT}.err test_act) - LIST (LENGTH "${test_act}" len_act) + LIST (LENGTH test_act len_act) FILE (STRINGS ${TEST_FOLDER}/${TEST_ERRREF} test_ref) - LIST (LENGTH "${test_ref}" len_ref) + LIST (LENGTH test_ref len_ref) MATH (EXPR _FP_LEN "${len_ref} - 1") - FOREACH (line RANGE 0 ${_FP_LEN}) - LIST (GET "${test_act}" ${line} str_act) - LIST (GET "${test_ref}" ${line} str_ref) - STRING (COMPARE NOTEQUAL ${str_act} ${str_ref} str_res) - IF (${str_res}) - SET (TEST_RESULT 1) - MESSAGE ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}") - ENDIF (${str_res}) - ENDFOREACH (line RANGE 0 ${_FP_LEN}) + IF (NOT ${len_act} STREQUAL "0") + MATH (EXPR _FP_LEN "${len_ref} - 1") + FOREACH (line RANGE 0 ${_FP_LEN}) + LIST (GET test_act ${line} str_act) + LIST (GET test_ref ${line} str_ref) + IF (NOT "${str_act}" STREQUAL "${str_ref}") + IF (NOT "${str_act}" STREQUAL "") + SET (TEST_RESULT 1) + MESSAGE ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n") + ENDIF (NOT "${str_act}" STREQUAL "") + ENDIF (NOT "${str_act}" STREQUAL "${str_ref}") + ENDFOREACH (line RANGE 0 ${_FP_LEN}) + ENDIF (NOT ${len_act} STREQUAL "0") IF (NOT ${len_act} STREQUAL ${len_ref}) SET (TEST_RESULT 1) ENDIF (NOT ${len_act} STREQUAL ${len_ref}) + ENDIF (NOT ${TEST_RESULT} STREQUAL 0) MESSAGE (STATUS "COMPARE Result: ${TEST_RESULT}") @@ -171,4 +191,3 @@ ENDIF (NOT TEST_SKIP_COMPARE) # everything went fine... MESSAGE ("Passed: The output of ${TEST_PROGRAM} matches ${TEST_REFERENCE}") - diff --git a/config/cmake/userblockTest.cmake b/config/cmake/userblockTest.cmake index 5e8a808..8910bb2 100644 --- a/config/cmake/userblockTest.cmake +++ b/config/cmake/userblockTest.cmake @@ -65,17 +65,17 @@ IF (TEST_CHECKUB STREQUAL "YES") COMMAND ${TEST_GET_PROGRAM} -c ${TEST_O_STRING_LEN} ${TEST_OFILE} WORKING_DIRECTORY ${TEST_FOLDER} RESULT_VARIABLE TEST_RESULT - OUTPUT_FILE ${TEST_UFILE}.cmp + OUTPUT_FILE ${TEST_HFILE}-ub.cmp OUTPUT_VARIABLE TEST_ERROR ERROR_VARIABLE TEST_ERROR OUTPUT_STRIP_TRAILING_WHITESPACE ) #cat $ufile >> $cmpfile FILE (STRINGS ${TEST_UFILE} TEST_STREAM NEWLINE_CONSUME) - FILE (APPEND ${TEST_UFILE}.cmp "${TEST_STREAM}") + FILE (APPEND ${TEST_HFILE}-ub.cmp "${TEST_STREAM}") ELSE (NOT TEST_O_STRING_LEN STREQUAL "0") FILE (STRINGS ${TEST_UFILE} TEST_STREAM NEWLINE_CONSUME) - FILE (WRITE ${TEST_UFILE}.cmp ${TEST_STREAM}) + FILE (WRITE ${TEST_HFILE}-ub.cmp ${TEST_STREAM}) ENDIF (NOT TEST_O_STRING_LEN STREQUAL "0") #$JAM_BIN/getub -c $size $hfile > $tfile @@ -91,14 +91,14 @@ IF (TEST_CHECKUB STREQUAL "YES") # now compare the outputs EXECUTE_PROCESS ( - COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_UFILE}.cmp ${TEST_HFILE}.cmp + COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_HFILE}-ub.cmp ${TEST_HFILE}.cmp RESULT_VARIABLE TEST_RESULT ) MESSAGE (STATUS "COMPARE Result: ${TEST_RESULT}: ${TEST_STRING_SIZE}=${TEST_U_STRING_LEN}+${TEST_O_STRING_LEN}") # if the return value is !=${TEST_EXPECT} bail out IF (NOT ${TEST_RESULT} STREQUAL ${TEST_EXPECT}) - MESSAGE (FATAL_ERROR "Failed: The output of ${TEST_UFILE} did not match ${TEST_HFILE}.\n${TEST_ERROR}") + MESSAGE (FATAL_ERROR "Failed: The output of ${TEST_HFILE}-ub did not match ${TEST_HFILE}.\n${TEST_ERROR}") ENDIF (NOT ${TEST_RESULT} STREQUAL ${TEST_EXPECT}) ELSE (TEST_CHECKUB STREQUAL "YES") # call 'ubsize' to get the size of the user block diff --git a/config/lt_vers.am b/config/lt_vers.am index 461ac3a..37b5b68 100644 --- a/config/lt_vers.am +++ b/config/lt_vers.am @@ -17,7 +17,7 @@ # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 127 +LT_VERS_REVISION = 138 LT_VERS_AGE = 0 ## If the API changes *at all*, increment LT_VERS_INTERFACE and diff --git a/configure b/configure index 9b8b289..e42b8b7 100755 --- a/configure +++ b/configure @@ -1,7 +1,7 @@ #! /bin/sh # From configure.ac Id: configure.ac 22697 2012-08-19 14:35:47Z hdftest . # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for HDF5 1.9.137-FA_a5. +# Generated by GNU Autoconf 2.69 for HDF5 1.9.148-FA_a5. # # Report bugs to . # @@ -591,8 +591,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='HDF5' PACKAGE_TARNAME='hdf5' -PACKAGE_VERSION='1.9.137-FA_a5' -PACKAGE_STRING='HDF5 1.9.137-FA_a5' +PACKAGE_VERSION='1.9.148-FA_a5' +PACKAGE_STRING='HDF5 1.9.148-FA_a5' PACKAGE_BUGREPORT='help@hdfgroup.org' PACKAGE_URL='' @@ -681,7 +681,7 @@ INSTRUMENT_LIBRARY TRACE_API DEBUG_PKG H5_LONE_COLON -PTHREAD +HAVE_PTHREAD BUILD_SHARED_SZIP_CONDITIONAL_FALSE BUILD_SHARED_SZIP_CONDITIONAL_TRUE LL_PATH @@ -1484,7 +1484,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures HDF5 1.9.137-FA_a5 to adapt to many kinds of systems. +\`configure' configures HDF5 1.9.148-FA_a5 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1554,7 +1554,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of HDF5 1.9.137-FA_a5:";; + short | recursive ) echo "Configuration of HDF5 1.9.148-FA_a5:";; esac cat <<\_ACEOF @@ -1750,7 +1750,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -HDF5 configure 1.9.137-FA_a5 +HDF5 configure 1.9.148-FA_a5 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2844,7 +2844,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by HDF5 $as_me 1.9.137-FA_a5, which was +It was created by HDF5 $as_me 1.9.148-FA_a5, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3676,7 +3676,7 @@ fi # Define the identity of the package. PACKAGE='hdf5' - VERSION='1.9.137-FA_a5' + VERSION='1.9.148-FA_a5' cat >>confdefs.h <<_ACEOF @@ -22754,6 +22754,14 @@ fi done +## Also need to detect Darwin for pubconf +case $host_os in + darwin*) + +$as_echo "#define HAVE_DARWIN 1" >>confdefs.h + + ;; +esac ## Windows case "`uname`" in @@ -25265,11 +25273,14 @@ if test "x$ac_cv_header_dmalloc_h" = xyes; then : #define HAVE_DMALLOC_H 1 _ACEOF +else + unset HAVE_DMALLOC fi done - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dmalloc_shutdown in -ldmalloc" >&5 + if test "x$HAVE_DMALLOC" = "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dmalloc_shutdown in -ldmalloc" >&5 $as_echo_n "checking for dmalloc_shutdown in -ldmalloc... " >&6; } if ${ac_cv_lib_dmalloc_dmalloc_shutdown+:} false; then : $as_echo_n "(cached) " >&6 @@ -25324,7 +25335,7 @@ else unset HAVE_DMALLOC fi - + fi if test -z "$HAVE_DMALLOC" -a -n "$HDF5_CONFIG_ABORT"; then as_fn_error $? "couldn't find dmalloc library" "$LINENO" 5 fi @@ -25379,18 +25390,19 @@ if test "x$ac_cv_header_dmalloc_h" = xyes; then : _ACEOF else - CPPFLAGS="$saved_CPPFLAGS"; AM_CPPFLAGS="$saved_AM_CPPFLAGS" + CPPFLAGS="$saved_CPPFLAGS"; AM_CPPFLAGS="$saved_AM_CPPFLAGS" unset HAVE_DMALLOC fi done - if test -n "$dmalloc_lib"; then - LDFLAGS="$LDFLAGS -L$dmalloc_lib" - AM_LDFLAGS="$AM_LDFLAGS -L$dmalloc_lib" - fi + if test "x$HAVE_DMALLOC" = "xyes"; then + if test -n "$dmalloc_lib"; then + LDFLAGS="$LDFLAGS -L$dmalloc_lib" + AM_LDFLAGS="$AM_LDFLAGS -L$dmalloc_lib" + fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dmalloc_shutdown in -ldmalloc" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dmalloc_shutdown in -ldmalloc" >&5 $as_echo_n "checking for dmalloc_shutdown in -ldmalloc... " >&6; } if ${ac_cv_lib_dmalloc_dmalloc_shutdown+:} false; then : $as_echo_n "(cached) " >&6 @@ -25445,6 +25457,7 @@ else LDFLAGS="$saved_LDFLAGS"; AM_LDFLAGS="$saved_AM_LDFLAGS"; unset HAVE_DMALLOC fi + fi if test -z "$HAVE_DMALLOC" -a -n "$HDF5_CONFIG_ABORT"; then as_fn_error $? "couldn't find dmalloc library" "$LINENO" 5 @@ -25479,11 +25492,14 @@ if test "x$ac_cv_header_zlib_h" = xyes; then : #define HAVE_ZLIB_H 1 _ACEOF HAVE_ZLIB_H="yes" +else + unset HAVE_ZLIB fi done - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for compress2 in -lz" >&5 + if test "x$HAVE_ZLIB" = "xyes" -a "x$HAVE_ZLIB_H" = "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for compress2 in -lz" >&5 $as_echo_n "checking for compress2 in -lz... " >&6; } if ${ac_cv_lib_z_compress2+:} false; then : $as_echo_n "(cached) " >&6 @@ -25538,14 +25554,17 @@ else unset HAVE_ZLIB fi - ac_fn_c_check_func "$LINENO" "compress2" "ac_cv_func_compress2" + fi + if test -z "$HAVE_ZLIB"; then + if test -n "$HDF5_CONFIG_ABORT"; then + as_fn_error $? "couldn't find zlib library" "$LINENO" 5 + fi + else + ac_fn_c_check_func "$LINENO" "compress2" "ac_cv_func_compress2" if test "x$ac_cv_func_compress2" = xyes; then : HAVE_COMPRESS2="yes" fi - - if test -z "$HAVE_ZLIB" -a -n "$HDF5_CONFIG_ABORT"; then - as_fn_error $? "couldn't find zlib library" "$LINENO" 5 fi ;; no) @@ -25559,8 +25578,8 @@ $as_echo "suppressed" >&6; } HAVE_ZLIB="yes" case "$withval" in *,*) - zlib_inc="`echo $withval |cut -f1 -d,`" - zlib_lib="`echo $withval |cut -f2 -d, -s`" + zlib_inc="`echo $withval | cut -f1 -d,`" + zlib_lib="`echo $withval | cut -f2 -d, -s`" ;; *) if test -n "$withval"; then @@ -25598,7 +25617,7 @@ if test "x$ac_cv_header_zlib_h" = xyes; then : _ACEOF HAVE_ZLIB_H="yes" else - CPPFLAGS="$saved_CPPFLAGS"; AM_CPPFLAGS="$saved_AM_CPPFLAGS" + CPPFLAGS="$saved_CPPFLAGS"; AM_CPPFLAGS="$saved_AM_CPPFLAGS" unset HAVE_ZLIB fi done @@ -25609,7 +25628,8 @@ done AM_LDFLAGS="$AM_LDFLAGS -L$zlib_lib" fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for compress2 in -lz" >&5 + if test "x$HAVE_ZLIB" = "xyes" -a "x$HAVE_ZLIB_H" = "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for compress2 in -lz" >&5 $as_echo_n "checking for compress2 in -lz... " >&6; } if ${ac_cv_lib_z_compress2+:} false; then : $as_echo_n "(cached) " >&6 @@ -25664,14 +25684,18 @@ else LDFLAGS="$saved_LDFLAGS"; AM_LDFLAGS="$saved_AM_LDFLAGS"; unset HAVE_ZLIB fi - ac_fn_c_check_func "$LINENO" "compress2" "ac_cv_func_compress2" + fi + + if test -z "$HAVE_ZLIB"; then + if test -n "$HDF5_CONFIG_ABORT"; then + as_fn_error $? "couldn't find zlib library" "$LINENO" 5 + fi + else + ac_fn_c_check_func "$LINENO" "compress2" "ac_cv_func_compress2" if test "x$ac_cv_func_compress2" = xyes; then : HAVE_COMPRESS2="yes" fi - - if test -z "$HAVE_ZLIB" -a -n "$HDF5_CONFIG_ABORT"; then - as_fn_error $? "couldn't find zlib library" "$LINENO" 5 fi ;; esac @@ -25680,13 +25704,13 @@ if test "x$HAVE_ZLIB" = "xyes" -a "x$HAVE_ZLIB_H" = "xyes" -a "x$HAVE_COMPRESS2" $as_echo "#define HAVE_FILTER_DEFLATE 1" >>confdefs.h - USE_FILTER_DEFLATE="yes" + USE_FILTER_DEFLATE="yes" - ## Add "deflate" to external filter list - if test "X$EXTERNAL_FILTERS" != "X"; then - EXTERNAL_FILTERS="${EXTERNAL_FILTERS}," - fi - EXTERNAL_FILTERS="${EXTERNAL_FILTERS}deflate(zlib)" + ## Add "deflate" to external filter list + if test "X$EXTERNAL_FILTERS" != "X"; then + EXTERNAL_FILTERS="${EXTERNAL_FILTERS}," + fi + EXTERNAL_FILTERS="${EXTERNAL_FILTERS}deflate(zlib)" fi @@ -25717,11 +25741,14 @@ if test "x$ac_cv_header_szlib_h" = xyes; then : #define HAVE_SZLIB_H 1 _ACEOF HAVE_SZLIB_H="yes" +else + unset HAVE_SZLIB fi done - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SZ_BufftoBuffCompress in -lsz" >&5 + if test "x$HAVE_SZLIB" = "xyes" -a "x$HAVE_SZLIB_H" = "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SZ_BufftoBuffCompress in -lsz" >&5 $as_echo_n "checking for SZ_BufftoBuffCompress in -lsz... " >&6; } if ${ac_cv_lib_sz_SZ_BufftoBuffCompress+:} false; then : $as_echo_n "(cached) " >&6 @@ -25776,7 +25803,7 @@ else unset HAVE_SZLIB fi - + fi if test -z "$HAVE_SZLIB" -a -n "$HDF5_CONFIG_ABORT"; then as_fn_error $? "couldn't find szlib library" "$LINENO" 5 fi @@ -25831,7 +25858,7 @@ if test "x$ac_cv_header_szlib_h" = xyes; then : _ACEOF HAVE_SZLIB_H="yes" else - CPPFLAGS="$saved_CPPFLAGS"; AM_CPPFLAGS="$saved_AM_CPPFLAGS" + CPPFLAGS="$saved_CPPFLAGS"; AM_CPPFLAGS="$saved_AM_CPPFLAGS" unset HAVE_SZIP fi done @@ -25842,7 +25869,8 @@ done AM_LDFLAGS="$AM_LDFLAGS -L$szlib_lib" fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SZ_BufftoBuffCompress in -lsz" >&5 + if test "x$HAVE_SZLIB" = "xyes" -a "x$HAVE_SZLIB_H" = "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SZ_BufftoBuffCompress in -lsz" >&5 $as_echo_n "checking for SZ_BufftoBuffCompress in -lsz... " >&6; } if ${ac_cv_lib_sz_SZ_BufftoBuffCompress+:} false; then : $as_echo_n "(cached) " >&6 @@ -25897,6 +25925,7 @@ else LDFLAGS="$saved_LDFLAGS"; AM_LDFLAGS="$saved_AM_LDFLAGS"; unset HAVE_SZLIB fi + fi if test -z "$HAVE_SZLIB" -a -n "$HDF5_CONFIG_ABORT"; then as_fn_error $? "couldn't find szlib library" "$LINENO" 5 @@ -25905,22 +25934,22 @@ fi esac if test "x$HAVE_SZLIB" = "xyes" -a "x$HAVE_SZLIB_H" = "xyes"; then - ## SZLIB library is available. Check if it can encode - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for szlib encoder" >&5 + ## SZLIB library is available. Check if it can encode + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for szlib encoder" >&5 $as_echo_n "checking for szlib encoder... " >&6; } - ## Set LD_LIBRARY_PATH so encoder test can find the library and run. - ## Also add LL_PATH substitution to Makefiles so they can use the - ## path as well, for testing examples. - if test -z "$LD_LIBRARY_PATH"; then + ## Set LD_LIBRARY_PATH so encoder test can find the library and run. + ## Also add LL_PATH substitution to Makefiles so they can use the + ## path as well, for testing examples. + if test -z "$LD_LIBRARY_PATH"; then export LD_LIBRARY_PATH="$szlib_lib" - else + else export LD_LIBRARY_PATH="$szlib_lib:$LD_LIBRARY_PATH" - fi + fi - LL_PATH="$LD_LIBRARY_PATH" + LL_PATH="$LD_LIBRARY_PATH" - if ${hdf5_cv_szlib_can_encode+:} false; then : + if ${hdf5_cv_szlib_can_encode+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -25959,31 +25988,30 @@ fi $as_echo "#define HAVE_FILTER_SZIP 1" >>confdefs.h - USE_FILTER_SZIP="yes" + USE_FILTER_SZIP="yes" - if test ${hdf5_cv_szlib_can_encode} = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 + if test ${hdf5_cv_szlib_can_encode} = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - fi - if test ${hdf5_cv_szlib_can_encode} = "no"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + fi + if test ${hdf5_cv_szlib_can_encode} = "no"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - fi + fi - ## Add "szip" to external filter list - if test ${hdf5_cv_szlib_can_encode} = "yes"; then - if test "X$EXTERNAL_FILTERS" != "X"; then - EXTERNAL_FILTERS="${EXTERNAL_FILTERS}," - fi - EXTERNAL_FILTERS="${EXTERNAL_FILTERS}szip(encoder)" + ## Add "szip" to external filter list + if test ${hdf5_cv_szlib_can_encode} = "yes"; then + if test "X$EXTERNAL_FILTERS" != "X"; then + EXTERNAL_FILTERS="${EXTERNAL_FILTERS}," fi - if test ${hdf5_cv_szlib_can_encode} = "no"; then - if test "X$EXTERNAL_FILTERS" != "X"; then - EXTERNAL_FILTERS="${EXTERNAL_FILTERS}," - fi - EXTERNAL_FILTERS="${EXTERNAL_FILTERS}szip(no encoder)" + EXTERNAL_FILTERS="${EXTERNAL_FILTERS}szip(encoder)" + fi + if test ${hdf5_cv_szlib_can_encode} = "no"; then + if test "X$EXTERNAL_FILTERS" != "X"; then + EXTERNAL_FILTERS="${EXTERNAL_FILTERS}," fi - + EXTERNAL_FILTERS="${EXTERNAL_FILTERS}szip(no encoder)" + fi fi if test "X$USE_FILTER_SZIP" = "Xyes" && test "X$LL_PATH" != "X"; then @@ -26089,7 +26117,7 @@ rm -f confcache ## and/or a library path. If the library path is specified then it must ## be preceded by a comma. ## - PTHREAD=yes + HAVE_PTHREAD=yes # Check whether --with-pthread was given. if test "${with_pthread+set}" = set; then : @@ -26109,11 +26137,14 @@ if test "x$ac_cv_header_pthread_h" = xyes; then : #define HAVE_PTHREAD_H 1 _ACEOF +else + unset HAVE_PTHREAD fi done - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_self in -lpthread" >&5 + if test "x$HAVE_DMALLOC" = "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_self in -lpthread" >&5 $as_echo_n "checking for pthread_self in -lpthread... " >&6; } if ${ac_cv_lib_pthread_pthread_self+:} false; then : $as_echo_n "(cached) " >&6 @@ -26165,16 +26196,17 @@ _ACEOF LIBS="-lpthread $LIBS" else - unset PTHREAD + unset HAVE_PTHREAD fi + fi ;; no) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread" >&5 $as_echo_n "checking for pthread... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: suppressed" >&5 $as_echo "suppressed" >&6; } - unset PTHREAD + unset HAVE_PTHREAD ;; *) case "$withval" in @@ -26213,7 +26245,7 @@ if test "x$ac_cv_header_pthread_h" = xyes; then : _ACEOF else - CPPFLAGS="$saved_CPPFLAGS"; AM_CPPFLAGS="$saved_AM_CPPFLAGS"; unset PTHREAD + CPPFLAGS="$saved_CPPFLAGS"; AM_CPPFLAGS="$saved_AM_CPPFLAGS"; unset HAVE_PTHREAD fi done @@ -26228,19 +26260,20 @@ if test "x$ac_cv_header_pthread_h" = xyes; then : _ACEOF else - unset PTHREAD + unset HAVE_PTHREAD fi done fi - if test -n "$pthread_lib"; then - saved_LDFLAGS="$LDFLAGS" - saved_AM_LDFLAGS="$AM_LDFLAGS" - LDFLAGS="$LDFLAGS -L$pthread_lib" - AM_LDFLAGS="$AM_LDFLAGS -L$pthread_lib" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_self in -lpthread" >&5 + if test "x$HAVE_DMALLOC" = "xyes"; then + if test -n "$pthread_lib"; then + saved_LDFLAGS="$LDFLAGS" + saved_AM_LDFLAGS="$AM_LDFLAGS" + LDFLAGS="$LDFLAGS -L$pthread_lib" + AM_LDFLAGS="$AM_LDFLAGS -L$pthread_lib" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_self in -lpthread" >&5 $as_echo_n "checking for pthread_self in -lpthread... " >&6; } if ${ac_cv_lib_pthread_pthread_self+:} false; then : $as_echo_n "(cached) " >&6 @@ -26292,12 +26325,11 @@ _ACEOF LIBS="-lpthread $LIBS" else - LDFLAGS="$saved_LDFLAGS"; AM_LDFLAGS="$saved_AM_LDFLAGS"; unset PTHREAD + LDFLAGS="$saved_LDFLAGS"; AM_LDFLAGS="$saved_AM_LDFLAGS"; unset HAVE_PTHREAD fi - - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_self in -lpthread" >&5 + else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_self in -lpthread" >&5 $as_echo_n "checking for pthread_self in -lpthread... " >&6; } if ${ac_cv_lib_pthread_pthread_self+:} false; then : $as_echo_n "(cached) " >&6 @@ -26349,9 +26381,10 @@ _ACEOF LIBS="-lpthread $LIBS" else - unset PTHREAD + unset HAVE_PTHREAD fi + fi fi ;; esac @@ -27152,19 +27185,12 @@ if ${hdf5_cv_lone_colon+:} false; then : else echo "int main(int argc, char * argv) {return 0;}" > conftest.c - $CC $CFLAGS conftest.c > /dev/null 2> /dev/null -case "`uname`" in - CYGWIN*) - echo "./a.exe :" > conftest.sh - ;; - *) - echo "./a.out :" > conftest.sh - ;; -esac + $CC $CFLAGS conftest.c -o a.out> /dev/null 2> /dev/null + echo "./a.out :" > conftest.sh chmod 700 conftest.sh ./conftest.sh 2> conftest.out - rm -f a.out a.exe + rm -f a.out TEST_OUTPUT=`cat conftest.out` if test "X$TEST_OUTPUT" = "X"; then @@ -31722,7 +31748,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by HDF5 $as_me 1.9.137-FA_a5, which was +This file was extended by HDF5 $as_me 1.9.148-FA_a5, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -31788,7 +31814,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -HDF5 config.status 1.9.137-FA_a5 +HDF5 config.status 1.9.148-FA_a5 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" @@ -34565,7 +34591,7 @@ Usage: $0 [OPTIONS] Report bugs to ." lt_cl_version="\ -HDF5 config.lt 1.9.137-FA_a5 +HDF5 config.lt 1.9.148-FA_a5 configured by $0, generated by GNU Autoconf 2.69. Copyright (C) 2011 Free Software Foundation, Inc. diff --git a/configure.ac b/configure.ac index 492473c..ac8a72f 100644 --- a/configure.ac +++ b/configure.ac @@ -26,7 +26,7 @@ AC_PREREQ([2.69]) ## NOTE: Do not forget to change the version number here when we do a ## release!!! ## -AC_INIT([HDF5], [1.9.137-FA_a5], [help@hdfgroup.org]) +AC_INIT([HDF5], [1.9.148-FA_a5], [help@hdfgroup.org]) AC_CONFIG_SRCDIR([src/H5.c]) AC_CONFIG_HEADER([src/H5config.h]) @@ -1278,6 +1278,12 @@ AC_CHECK_HEADERS([stdint.h], [C9x=yes]) ## Darwin AC_CHECK_HEADERS([mach/mach_time.h]) +## Also need to detect Darwin for pubconf +case $host_os in + darwin*) + AC_DEFINE([HAVE_DARWIN], [1], [Define if Darwin or Mac OS X]) + ;; +esac ## Windows case "`uname`" in @@ -1609,9 +1615,10 @@ AC_ARG_WITH([dmalloc], case $withval in yes) HAVE_DMALLOC="yes" - AC_CHECK_HEADERS([dmalloc.h]) - AC_CHECK_LIB([dmalloc], [dmalloc_shutdown],, [unset HAVE_DMALLOC]) - + AC_CHECK_HEADERS([dmalloc.h],, [unset HAVE_DMALLOC]) + if test "x$HAVE_DMALLOC" = "xyes"; then + AC_CHECK_LIB([dmalloc], [dmalloc_shutdown],, [unset HAVE_DMALLOC]) + fi if test -z "$HAVE_DMALLOC" -a -n "$HDF5_CONFIG_ABORT"; then AC_MSG_ERROR([couldn't find dmalloc library]) fi @@ -1655,14 +1662,16 @@ case $withval in AM_CPPFLAGS="$AM_CPPFLAGS -I$dmalloc_inc" fi - AC_CHECK_HEADERS([dmalloc.h],,[CPPFLAGS="$saved_CPPFLAGS"; AM_CPPFLAGS="$saved_AM_CPPFLAGS"]) + AC_CHECK_HEADERS([dmalloc.h],,[CPPFLAGS="$saved_CPPFLAGS"; AM_CPPFLAGS="$saved_AM_CPPFLAGS"] [unset HAVE_DMALLOC]) - if test -n "$dmalloc_lib"; then - LDFLAGS="$LDFLAGS -L$dmalloc_lib" - AM_LDFLAGS="$AM_LDFLAGS -L$dmalloc_lib" - fi + if test "x$HAVE_DMALLOC" = "xyes"; then + if test -n "$dmalloc_lib"; then + LDFLAGS="$LDFLAGS -L$dmalloc_lib" + AM_LDFLAGS="$AM_LDFLAGS -L$dmalloc_lib" + fi - AC_CHECK_LIB([dmalloc], [dmalloc_shutdown],, [LDFLAGS="$saved_LDFLAGS"; AM_LDFLAGS="$saved_AM_LDFLAGS"; unset HAVE_DMALLOC]) + AC_CHECK_LIB([dmalloc], [dmalloc_shutdown],, [LDFLAGS="$saved_LDFLAGS"; AM_LDFLAGS="$saved_AM_LDFLAGS"; unset HAVE_DMALLOC]) + fi if test -z "$HAVE_DMALLOC" -a -n "$HDF5_CONFIG_ABORT"; then AC_MSG_ERROR([couldn't find dmalloc library]) @@ -1686,12 +1695,16 @@ AC_ARG_WITH([zlib], case $withval in yes) HAVE_ZLIB="yes" - AC_CHECK_HEADERS([zlib.h], [HAVE_ZLIB_H="yes"]) - AC_CHECK_LIB([z], [compress2],, [unset HAVE_ZLIB]) - AC_CHECK_FUNC([compress2], [HAVE_COMPRESS2="yes"]) - - if test -z "$HAVE_ZLIB" -a -n "$HDF5_CONFIG_ABORT"; then - AC_MSG_ERROR([couldn't find zlib library]) + AC_CHECK_HEADERS([zlib.h], [HAVE_ZLIB_H="yes"], [unset HAVE_ZLIB]) + if test "x$HAVE_ZLIB" = "xyes" -a "x$HAVE_ZLIB_H" = "xyes"; then + AC_CHECK_LIB([z], [compress2],, [unset HAVE_ZLIB]) + fi + if test -z "$HAVE_ZLIB"; then + if test -n "$HDF5_CONFIG_ABORT"; then + AC_MSG_ERROR([couldn't find zlib library]) + fi + else + AC_CHECK_FUNC([compress2], [HAVE_COMPRESS2="yes"]) fi ;; no) @@ -1703,8 +1716,8 @@ case $withval in HAVE_ZLIB="yes" case "$withval" in *,*) - zlib_inc="`echo $withval |cut -f1 -d,`" - zlib_lib="`echo $withval |cut -f2 -d, -s`" + zlib_inc="`echo $withval | cut -f1 -d,`" + zlib_lib="`echo $withval | cut -f2 -d, -s`" ;; *) if test -n "$withval"; then @@ -1735,32 +1748,37 @@ case $withval in AC_CHECK_HEADERS([zlib.h], [HAVE_ZLIB_H="yes"], - [CPPFLAGS="$saved_CPPFLAGS"; AM_CPPFLAGS="$saved_AM_CPPFLAGS"]) + [CPPFLAGS="$saved_CPPFLAGS"; AM_CPPFLAGS="$saved_AM_CPPFLAGS"] [unset HAVE_ZLIB]) if test -n "$zlib_lib"; then LDFLAGS="$LDFLAGS -L$zlib_lib" AM_LDFLAGS="$AM_LDFLAGS -L$zlib_lib" fi - AC_CHECK_LIB([z], [compress2],, - [LDFLAGS="$saved_LDFLAGS"; AM_LDFLAGS="$saved_AM_LDFLAGS"; unset HAVE_ZLIB]) - AC_CHECK_FUNC([compress2], [HAVE_COMPRESS2="yes"]) + if test "x$HAVE_ZLIB" = "xyes" -a "x$HAVE_ZLIB_H" = "xyes"; then + AC_CHECK_LIB([z], [compress2],, + [LDFLAGS="$saved_LDFLAGS"; AM_LDFLAGS="$saved_AM_LDFLAGS"; unset HAVE_ZLIB]) + fi - if test -z "$HAVE_ZLIB" -a -n "$HDF5_CONFIG_ABORT"; then - AC_MSG_ERROR([couldn't find zlib library]) + if test -z "$HAVE_ZLIB"; then + if test -n "$HDF5_CONFIG_ABORT"; then + AC_MSG_ERROR([couldn't find zlib library]) + fi + else + AC_CHECK_FUNC([compress2], [HAVE_COMPRESS2="yes"]) fi ;; esac if test "x$HAVE_ZLIB" = "xyes" -a "x$HAVE_ZLIB_H" = "xyes" -a "x$HAVE_COMPRESS2" = "xyes"; then - AC_DEFINE([HAVE_FILTER_DEFLATE], [1], [Define if support for deflate (zlib) filter is enabled]) - USE_FILTER_DEFLATE="yes" + AC_DEFINE([HAVE_FILTER_DEFLATE], [1], [Define if support for deflate (zlib) filter is enabled]) + USE_FILTER_DEFLATE="yes" - ## Add "deflate" to external filter list - if test "X$EXTERNAL_FILTERS" != "X"; then - EXTERNAL_FILTERS="${EXTERNAL_FILTERS}," - fi - EXTERNAL_FILTERS="${EXTERNAL_FILTERS}deflate(zlib)" + ## Add "deflate" to external filter list + if test "X$EXTERNAL_FILTERS" != "X"; then + EXTERNAL_FILTERS="${EXTERNAL_FILTERS}," + fi + EXTERNAL_FILTERS="${EXTERNAL_FILTERS}deflate(zlib)" fi @@ -1780,9 +1798,10 @@ AC_ARG_WITH([szlib], case $withval in yes) HAVE_SZLIB="yes" - AC_CHECK_HEADERS([szlib.h], [HAVE_SZLIB_H="yes"]) - AC_CHECK_LIB([sz], [SZ_BufftoBuffCompress],, [unset HAVE_SZLIB]) - + AC_CHECK_HEADERS([szlib.h], [HAVE_SZLIB_H="yes"], [unset HAVE_SZLIB]) + if test "x$HAVE_SZLIB" = "xyes" -a "x$HAVE_SZLIB_H" = "xyes"; then + AC_CHECK_LIB([sz], [SZ_BufftoBuffCompress],, [unset HAVE_SZLIB]) + fi if test -z "$HAVE_SZLIB" -a -n "$HDF5_CONFIG_ABORT"; then AC_MSG_ERROR([couldn't find szlib library]) fi @@ -1828,15 +1847,17 @@ case $withval in AC_CHECK_HEADERS([szlib.h], [HAVE_SZLIB_H="yes"], - [CPPFLAGS="$saved_CPPFLAGS"; AM_CPPFLAGS="$saved_AM_CPPFLAGS"]) + [CPPFLAGS="$saved_CPPFLAGS"; AM_CPPFLAGS="$saved_AM_CPPFLAGS"] [unset HAVE_SZIP]) if test -n "$szlib_lib"; then LDFLAGS="$LDFLAGS -L$szlib_lib" AM_LDFLAGS="$AM_LDFLAGS -L$szlib_lib" fi - AC_CHECK_LIB([sz], [SZ_BufftoBuffCompress],, - [LDFLAGS="$saved_LDFLAGS"; AM_LDFLAGS="$saved_AM_LDFLAGS"; unset HAVE_SZLIB]) + if test "x$HAVE_SZLIB" = "xyes" -a "x$HAVE_SZLIB_H" = "xyes"; then + AC_CHECK_LIB([sz], [SZ_BufftoBuffCompress],, + [LDFLAGS="$saved_LDFLAGS"; AM_LDFLAGS="$saved_AM_LDFLAGS"; unset HAVE_SZLIB]) + fi if test -z "$HAVE_SZLIB" -a -n "$HDF5_CONFIG_ABORT"; then AC_MSG_ERROR([couldn't find szlib library]) @@ -1845,21 +1866,21 @@ case $withval in esac if test "x$HAVE_SZLIB" = "xyes" -a "x$HAVE_SZLIB_H" = "xyes"; then - ## SZLIB library is available. Check if it can encode - AC_MSG_CHECKING([for szlib encoder]) + ## SZLIB library is available. Check if it can encode + AC_MSG_CHECKING([for szlib encoder]) - ## Set LD_LIBRARY_PATH so encoder test can find the library and run. - ## Also add LL_PATH substitution to Makefiles so they can use the - ## path as well, for testing examples. - if test -z "$LD_LIBRARY_PATH"; then + ## Set LD_LIBRARY_PATH so encoder test can find the library and run. + ## Also add LL_PATH substitution to Makefiles so they can use the + ## path as well, for testing examples. + if test -z "$LD_LIBRARY_PATH"; then export LD_LIBRARY_PATH="$szlib_lib" - else + else export LD_LIBRARY_PATH="$szlib_lib:$LD_LIBRARY_PATH" - fi + fi - AC_SUBST([LL_PATH]) LL_PATH="$LD_LIBRARY_PATH" + AC_SUBST([LL_PATH]) LL_PATH="$LD_LIBRARY_PATH" - AC_CACHE_VAL([hdf5_cv_szlib_can_encode], + AC_CACHE_VAL([hdf5_cv_szlib_can_encode], [AC_TRY_RUN([ #include @@ -1873,31 +1894,30 @@ if test "x$HAVE_SZLIB" = "xyes" -a "x$HAVE_SZLIB_H" = "xyes"; then } ], [hdf5_cv_szlib_can_encode=yes], [hdf5_cv_szlib_can_encode=no],)]) - AC_DEFINE([HAVE_FILTER_SZIP], [1], + AC_DEFINE([HAVE_FILTER_SZIP], [1], [Define if support for szip filter is enabled]) - USE_FILTER_SZIP="yes" + USE_FILTER_SZIP="yes" - if test ${hdf5_cv_szlib_can_encode} = "yes"; then - AC_MSG_RESULT([yes]) - fi - if test ${hdf5_cv_szlib_can_encode} = "no"; then - AC_MSG_RESULT([no]) - fi + if test ${hdf5_cv_szlib_can_encode} = "yes"; then + AC_MSG_RESULT([yes]) + fi + if test ${hdf5_cv_szlib_can_encode} = "no"; then + AC_MSG_RESULT([no]) + fi - ## Add "szip" to external filter list - if test ${hdf5_cv_szlib_can_encode} = "yes"; then - if test "X$EXTERNAL_FILTERS" != "X"; then - EXTERNAL_FILTERS="${EXTERNAL_FILTERS}," - fi - EXTERNAL_FILTERS="${EXTERNAL_FILTERS}szip(encoder)" - fi - if test ${hdf5_cv_szlib_can_encode} = "no"; then - if test "X$EXTERNAL_FILTERS" != "X"; then - EXTERNAL_FILTERS="${EXTERNAL_FILTERS}," - fi - EXTERNAL_FILTERS="${EXTERNAL_FILTERS}szip(no encoder)" + ## Add "szip" to external filter list + if test ${hdf5_cv_szlib_can_encode} = "yes"; then + if test "X$EXTERNAL_FILTERS" != "X"; then + EXTERNAL_FILTERS="${EXTERNAL_FILTERS}," fi - + EXTERNAL_FILTERS="${EXTERNAL_FILTERS}szip(encoder)" + fi + if test ${hdf5_cv_szlib_can_encode} = "no"; then + if test "X$EXTERNAL_FILTERS" != "X"; then + EXTERNAL_FILTERS="${EXTERNAL_FILTERS}," + fi + EXTERNAL_FILTERS="${EXTERNAL_FILTERS}szip(no encoder)" + fi fi AM_CONDITIONAL([BUILD_SHARED_SZIP_CONDITIONAL], [test "X$USE_FILTER_SZIP" = "Xyes" && test "X$LL_PATH" != "X"]) @@ -1912,7 +1932,7 @@ AC_CACHE_SAVE ## and/or a library path. If the library path is specified then it must ## be preceded by a comma. ## -AC_SUBST([PTHREAD]) PTHREAD=yes +AC_SUBST([HAVE_PTHREAD]) HAVE_PTHREAD=yes AC_ARG_WITH([pthread], [AS_HELP_STRING([--with-pthread=DIR], [Use the Pthreads library [default=no]])],, @@ -1920,13 +1940,15 @@ AC_ARG_WITH([pthread], case "$withval" in yes) - AC_CHECK_HEADERS([pthread.h]) - AC_CHECK_LIB([pthread], [pthread_self],, [unset PTHREAD]) + AC_CHECK_HEADERS([pthread.h],, [unset HAVE_PTHREAD]) + if test "x$HAVE_DMALLOC" = "xyes"; then + AC_CHECK_LIB([pthread], [pthread_self],, [unset HAVE_PTHREAD]) + fi ;; no) AC_MSG_CHECKING([for pthread]) AC_MSG_RESULT([suppressed]) - unset PTHREAD + unset HAVE_PTHREAD ;; *) case "$withval" in @@ -1956,21 +1978,22 @@ case "$withval" in saved_AM_CPPFLAGS="$AM_CPPFLAGS" CPPFLAGS="$CPPFLAGS -I$pthread_inc" AM_CPPFLAGS="$AM_CPPFLAGS -I$pthread_inc" - AC_CHECK_HEADERS([pthread.h],, [CPPFLAGS="$saved_CPPFLAGS"; AM_CPPFLAGS="$saved_AM_CPPFLAGS"; unset PTHREAD]) + AC_CHECK_HEADERS([pthread.h],, [CPPFLAGS="$saved_CPPFLAGS"; AM_CPPFLAGS="$saved_AM_CPPFLAGS"; unset HAVE_PTHREAD]) else - AC_CHECK_HEADERS([pthread.h],, [unset PTHREAD]) + AC_CHECK_HEADERS([pthread.h],, [unset HAVE_PTHREAD]) fi - if test -n "$pthread_lib"; then - saved_LDFLAGS="$LDFLAGS" - saved_AM_LDFLAGS="$AM_LDFLAGS" - LDFLAGS="$LDFLAGS -L$pthread_lib" - AM_LDFLAGS="$AM_LDFLAGS -L$pthread_lib" - AC_CHECK_LIB([pthread], [pthread_self],, - [LDFLAGS="$saved_LDFLAGS"; AM_LDFLAGS="$saved_AM_LDFLAGS"; unset PTHREAD]) - - else - AC_CHECK_LIB([pthread], [pthread_self],, [unset PTHREAD]) + if test "x$HAVE_DMALLOC" = "xyes"; then + if test -n "$pthread_lib"; then + saved_LDFLAGS="$LDFLAGS" + saved_AM_LDFLAGS="$AM_LDFLAGS" + LDFLAGS="$LDFLAGS -L$pthread_lib" + AM_LDFLAGS="$AM_LDFLAGS -L$pthread_lib" + AC_CHECK_LIB([pthread], [pthread_self],, + [LDFLAGS="$saved_LDFLAGS"; AM_LDFLAGS="$saved_AM_LDFLAGS"; unset HAVE_PTHREAD]) + else + AC_CHECK_LIB([pthread], [pthread_self],, [unset HAVE_PTHREAD]) + fi fi ;; esac @@ -2232,19 +2255,12 @@ AC_CACHE_CHECK([if lone colon can be used as an argument], [hdf5_cv_lone_colon], [ echo "int main(int argc, char * argv[]) {return 0;}" > conftest.c - $CC $CFLAGS conftest.c > /dev/null 2> /dev/null -case "`uname`" in - CYGWIN*) - echo "./a.exe :" > conftest.sh - ;; - *) - echo "./a.out :" > conftest.sh - ;; -esac + $CC $CFLAGS conftest.c -o a.out> /dev/null 2> /dev/null + echo "./a.out :" > conftest.sh chmod 700 conftest.sh ./conftest.sh 2> conftest.out - rm -f a.out a.exe + rm -f a.out TEST_OUTPUT=`cat conftest.out` if test "X$TEST_OUTPUT" = "X"; then diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index b23c6f8..3abf97a 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.6) +cmake_minimum_required (VERSION 2.8.10) PROJECT (HDF5_EXAMPLES) #----------------------------------------------------------------------------- @@ -10,6 +10,15 @@ ADD_DEFINITIONS (${HDF5_EXTRA_C_FLAGS}) # Define Sources #----------------------------------------------------------------------------- SET (examples + h5_crtdat + h5_rdwt + h5_crtatt + h5_crtgrp + h5_crtgrpar + h5_crtgrpd + h5_cmprss + h5_extend + h5_subset h5_write h5_read h5_extend_write @@ -51,11 +60,15 @@ IF (BUILD_TESTING) -E remove Attributes.h5 btrees_file.h5 + cmprss.h5 default_file.h5 + dset.h5 + extend.h5 extlink_prefix_source.h5 extlink_source.h5 extlink_target.h5 group.h5 + groups.h5 hard_link.h5 mount1.h5 mount2.h5 @@ -71,6 +84,7 @@ IF (BUILD_TESTING) separate_indexes_file.h5 small_lists_file.h5 soft_link.h5 + subset.h5 unix2win.h5 ) IF (NOT "${last_test}" STREQUAL "") diff --git a/examples/Makefile.am b/examples/Makefile.am index 58f50e7..d8eac95 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -29,7 +29,9 @@ endif # Don't tell automake about them, because if it knew they were programs, # it would try to compile them instead of using the h5cc script. # Use the boilerplate in config/examples.am instead. -EXAMPLE_PROG = h5_write h5_read h5_extend_write h5_chunk_read h5_compound \ +EXAMPLE_PROG = h5_write h5_read h5_extend_write h5_chunk_read h5_compound \ + h5_crtgrpd h5_subset h5_cmprss h5_rdwt h5_crtgrpar h5_extend \ + h5_crtatt h5_crtgrp h5_crtdat \ h5_group h5_select h5_attribute h5_mount h5_reference h5_drivers \ h5_ref2reg h5_extlink h5_elink_unix2win h5_shared_mesg TEST_SCRIPT=testh5cc.sh @@ -37,6 +39,8 @@ TEST_SCRIPT=testh5cc.sh # Install files # List all file that should be installed in examples directory INSTALL_FILES = h5_write.c h5_read.c h5_extend_write.c h5_chunk_read.c \ + h5_crtgrpd.c h5_subset.c h5_cmprss.c h5_rdwt.c h5_crtgrpar.c \ + h5_extend.c h5_crtatt.c h5_crtgrp.c h5_crtdat.c \ h5_compound.c h5_group.c h5_select.c h5_attribute.c h5_mount.c \ h5_reference.c h5_drivers.c h5_extlink.c h5_elink_unix2win.c \ h5_ref2reg.c h5_shared_mesg.c ph5example.c @@ -55,9 +59,14 @@ $(EXTRA_PROG): $(H5CC) $(H5CC) $(H5CCFLAGS) $(CFLAGS) -o $@ $(srcdir)/$@.c; endif -# Two of the examples depend on files created by other examples. +# Some examples depend on files created by other examples. h5_read.chkexe_: h5_write.chkexe_ h5_chunk_read.chkexe_: h5_extend_write.chkexe_ +h5_crtgrpd.chkexe_: h5_crtgrpar.chkexe_ +# h5_rdwt and h5_crtatt both modify the same file created by +# h5_crtdat. Serialize them. +h5_rdwt.chkexe_: h5_crtdat.chkexe_ +h5_crtatt.chkexe_: h5_rdwt.chkexe_ # The external link examples demonstrate how to use paths; they need # directories to be created to do this. @@ -82,6 +91,15 @@ EXAMPLETOPDIR=${DESTDIR}$(exec_prefix)/share/hdf5_examples # library above. h5_chunk_read: $(srcdir)/h5_chunk_read.c h5_compound: $(srcdir)/h5_compound.c +h5_crtgrpd: $(srcdir)/h5_crtgrpd.c +h5_subset: $(srcdir)/h5_subset.c +h5_cmprss: $(srcdir)/h5_cmprss.c +h5_rdwt: $(srcdir)/h5_rdwt.c +h5_crtgrpar: $(srcdir)/h5_crtgrpar.c +h5_extend: $(srcdir)/h5_extend.c +h5_crtatt: $(srcdir)/h5_crtatt.c +h5_crtgrp: $(srcdir)/h5_crtgrp.c +h5_crtdat: $(srcdir)/h5_crtdat.c h5_extend_write: $(srcdir)/h5_extend_write.c h5_group: $(srcdir)/h5_group.c h5_write: $(srcdir)/h5_write.c diff --git a/examples/Makefile.in b/examples/Makefile.in index 04c010d..064cb84 100644 --- a/examples/Makefile.in +++ b/examples/Makefile.in @@ -194,6 +194,7 @@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ +HAVE_PTHREAD = @HAVE_PTHREAD@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF_CXX = @HDF_CXX@ @@ -245,7 +246,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PARALLEL = @PARALLEL@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ -PTHREAD = @PTHREAD@ RANLIB = @RANLIB@ ROOT = @ROOT@ RUNPARALLEL = @RUNPARALLEL@ @@ -394,7 +394,9 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog $(EXTLINK_DIRS) *.h5 # Don't tell automake about them, because if it knew they were programs, # it would try to compile them instead of using the h5cc script. # Use the boilerplate in config/examples.am instead. -EXAMPLE_PROG = h5_write h5_read h5_extend_write h5_chunk_read h5_compound \ +EXAMPLE_PROG = h5_write h5_read h5_extend_write h5_chunk_read h5_compound \ + h5_crtgrpd h5_subset h5_cmprss h5_rdwt h5_crtgrpar h5_extend \ + h5_crtatt h5_crtgrp h5_crtdat \ h5_group h5_select h5_attribute h5_mount h5_reference h5_drivers \ h5_ref2reg h5_extlink h5_elink_unix2win h5_shared_mesg @@ -403,6 +405,8 @@ TEST_SCRIPT = testh5cc.sh # Install files # List all file that should be installed in examples directory INSTALL_FILES = h5_write.c h5_read.c h5_extend_write.c h5_chunk_read.c \ + h5_crtgrpd.c h5_subset.c h5_cmprss.c h5_rdwt.c h5_crtgrpar.c \ + h5_extend.c h5_crtatt.c h5_crtgrp.c h5_crtdat.c \ h5_compound.c h5_group.c h5_select.c h5_attribute.c h5_mount.c \ h5_reference.c h5_drivers.c h5_extlink.c h5_elink_unix2win.c \ h5_ref2reg.c h5_shared_mesg.c ph5example.c @@ -668,9 +672,14 @@ help: @BUILD_PARALLEL_CONDITIONAL_FALSE@$(EXTRA_PROG): $(H5CC) @BUILD_PARALLEL_CONDITIONAL_FALSE@ $(H5CC) $(H5CCFLAGS) $(CFLAGS) -o $@ $(srcdir)/$@.c; -# Two of the examples depend on files created by other examples. +# Some examples depend on files created by other examples. h5_read.chkexe_: h5_write.chkexe_ h5_chunk_read.chkexe_: h5_extend_write.chkexe_ +h5_crtgrpd.chkexe_: h5_crtgrpar.chkexe_ +# h5_rdwt and h5_crtatt both modify the same file created by +# h5_crtdat. Serialize them. +h5_rdwt.chkexe_: h5_crtdat.chkexe_ +h5_crtatt.chkexe_: h5_rdwt.chkexe_ $(EXTLINK_DIRS): echo $(mkdir_p) $@ @@ -684,6 +693,15 @@ $(EXTLINK_DIRS): # library above. h5_chunk_read: $(srcdir)/h5_chunk_read.c h5_compound: $(srcdir)/h5_compound.c +h5_crtgrpd: $(srcdir)/h5_crtgrpd.c +h5_subset: $(srcdir)/h5_subset.c +h5_cmprss: $(srcdir)/h5_cmprss.c +h5_rdwt: $(srcdir)/h5_rdwt.c +h5_crtgrpar: $(srcdir)/h5_crtgrpar.c +h5_extend: $(srcdir)/h5_extend.c +h5_crtatt: $(srcdir)/h5_crtatt.c +h5_crtgrp: $(srcdir)/h5_crtgrp.c +h5_crtdat: $(srcdir)/h5_crtdat.c h5_extend_write: $(srcdir)/h5_extend_write.c h5_group: $(srcdir)/h5_group.c h5_write: $(srcdir)/h5_write.c diff --git a/examples/h5_cmprss.c b/examples/h5_cmprss.c new file mode 100644 index 0000000..4a2f982 --- /dev/null +++ b/examples/h5_cmprss.c @@ -0,0 +1,125 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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 example illustrates how to create a compressed dataset. + * It is used in the HDF5 Tutorial. + */ + +#include "hdf5.h" + +#define FILE "cmprss.h5" +#define RANK 2 +#define DIM0 100 +#define DIM1 20 + +int main () { + + hid_t file_id, dataset_id, dataspace_id; /* identifiers */ + hid_t plist_id; + + size_t nelmts; + unsigned flags, filter_info; + H5Z_filter_t filter_type; + + herr_t status; + hsize_t dims[2]; + hsize_t cdims[2]; + + int idx; + int i,j, numfilt; + int buf[DIM0][DIM1]; + int rbuf [DIM0][DIM1]; + + /* Uncomment these variables to use SZIP compression + unsigned szip_options_mask; + unsigned szip_pixels_per_block; + */ + + /* Create a file. */ + file_id = H5Fcreate (FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + + + /* Create dataset "Compressed Data" in the group using absolute name. */ + dims[0] = DIM0; + dims[1] = DIM1; + dataspace_id = H5Screate_simple (RANK, dims, NULL); + + plist_id = H5Pcreate (H5P_DATASET_CREATE); + + /* Dataset must be chunked for compression */ + cdims[0] = 20; + cdims[1] = 20; + status = H5Pset_chunk (plist_id, 2, cdims); + + /* Set ZLIB / DEFLATE Compression using compression level 6. + * To use SZIP Compression comment out these lines. + */ + status = H5Pset_deflate (plist_id, 6); + + /* Uncomment these lines to set SZIP Compression + szip_options_mask = H5_SZIP_NN_OPTION_MASK; + szip_pixels_per_block = 16; + status = H5Pset_szip (plist_id, szip_options_mask, szip_pixels_per_block); + */ + + dataset_id = H5Dcreate2 (file_id, "Compressed_Data", H5T_STD_I32BE, + dataspace_id, H5P_DEFAULT, plist_id, H5P_DEFAULT); + + for (i = 0; i< DIM0; i++) + for (j=0; j= 8 + writeToFiles("OFF_T", "off_t_f", 8, H5_FORTRAN_HAS_INTEGER_8_KIND); +#elif defined H5_FORTRAN_HAS_INTEGER_4_KIND && H5_SIZEOF_OFF_T >= 4 + writeToFiles("OFF_T", "off_t_f", 4, H5_FORTRAN_HAS_INTEGER_4_KIND); +#elif defined H5_FORTRAN_HAS_INTEGER_2_KIND && H5_SIZEOF_OFF_T >= 2 + writeToFiles("OFF_T", "off_t_f", 2, H5_FORTRAN_HAS_INTEGER_2_KIND); +#elif defined H5_FORTRAN_HAS_INTEGER_1_KIND && H5_SIZEOF_OFF_T >= 1 + writeToFiles("OFF_T", "off_t_f", 1, H5_FORTRAN_HAS_INTEGER_1_KIND); +#else + /* Error: couldn't find a size for off_t */ + return -1; +#endif /* size_t */ #if defined H5_FORTRAN_HAS_INTEGER_8_KIND && H5_SIZEOF_SIZE_T >= 8 diff --git a/fortran/src/H5test_kind_SIZEOF.f90 b/fortran/src/H5test_kind_SIZEOF.f90 index ba982ee..867ec1e 100644 --- a/fortran/src/H5test_kind_SIZEOF.f90 +++ b/fortran/src/H5test_kind_SIZEOF.f90 @@ -15,7 +15,9 @@ ! NOTES ! This program is used in place of H5test_kind.f90 when the Fortran intrinsic ! function SIZEOF is available. It generates code that makes use of SIZEOF in -! H5fortran_detect.f90 which is a portable solution. +! H5fortran_detect.f90 which is a portable solution but is not standard +! compliant. The program H5test_kind_C_SIZEOF uses F2008 standard intrinsic +! function instead, which is the preferred method. ! ! The availability of SIZEOF is checked at configure time and the TRUE/FALSE ! condition is set in the configure variable "FORTRAN_HAVE_SIZEOF". diff --git a/fortran/src/HDF5.f90 b/fortran/src/HDF5.f90 index cb3d8bf..75af333 100644 --- a/fortran/src/HDF5.f90 +++ b/fortran/src/HDF5.f90 @@ -30,6 +30,7 @@ MODULE HDF5 USE H5GLOBAL USE H5F + USE H5F_PROVISIONAL USE H5G USE H5E USE H5E_PROVISIONAL diff --git a/fortran/src/Makefile.am b/fortran/src/Makefile.am index e6ef610..12c38e2 100644 --- a/fortran/src/Makefile.am +++ b/fortran/src/Makefile.am @@ -76,7 +76,7 @@ libhdf5_fortran_la_SOURCES=H5f90global.f90 \ H5_DBLE_Interface$(F_DBLE).f90 \ H5f90kit.c H5_f.c H5Af.c H5Df.c H5Ef.c H5Ff.c H5Gf.c \ H5If.c H5Lf.c H5Of.c H5Pf.c H5Rf.c H5Sf.c H5Tf.c H5Zf.c \ - H5Aff$(F_STATUS).f90 H5Dff$(F_STATUS).f90 H5Eff$(F_STATUS).f90 H5Lff$(F_STATUS).f90 \ + H5Aff$(F_STATUS).f90 H5Dff$(F_STATUS).f90 H5Eff$(F_STATUS).f90 H5Fff$(F_STATUS).f90 H5Lff$(F_STATUS).f90 \ H5Off$(F_STATUS).f90 H5Pff$(F_STATUS).f90 H5Rff$(F_STATUS).f90 H5Tff$(F_STATUS).f90 $(PARALLEL_COND_SRC) # HDF5 Fortran library depends on HDF5 Library. @@ -201,6 +201,7 @@ H5Dff.lo: $(srcdir)/H5Dff.f90 H5f90global.lo H5Aff$(F_STATUS).lo: $(srcdir)/H5Aff$(F_STATUS).f90 H5f90global.lo H5Dff$(F_STATUS).lo: $(srcdir)/H5Dff$(F_STATUS).f90 H5f90global.lo H5Eff$(F_STATUS).lo: $(srcdir)/H5Eff$(F_STATUS).f90 H5f90global.lo +H5Fff$(F_STATUS).lo: $(srcdir)/H5Fff$(F_STATUS).f90 H5f90global.lo H5Lff$(F_STATUS).lo: $(srcdir)/H5Lff$(F_STATUS).f90 H5f90global.lo H5Off$(F_STATUS).lo: $(srcdir)/H5Off$(F_STATUS).f90 H5f90global.lo H5Pff$(F_STATUS).lo: $(srcdir)/H5Pff$(F_STATUS).f90 H5f90global.lo @@ -217,11 +218,11 @@ H5Rff.lo: $(srcdir)/H5Rff.f90 H5f90global.lo H5Sff.lo: $(srcdir)/H5Sff.f90 H5f90global.lo H5Tff.lo: $(srcdir)/H5Tff.f90 H5f90global.lo H5Zff.lo: $(srcdir)/H5Zff.f90 H5f90global.lo -H5_DBLE_Interface$(F_DBLE).lo: $(srcdir)/H5_DBLE_Interface$(F_DBLE).f90 H5Aff$(F_STATUS).lo H5Dff$(F_STATUS).lo H5Eff$(F_STATUS).lo H5Pff$(F_STATUS).lo +H5_DBLE_Interface$(F_DBLE).lo: $(srcdir)/H5_DBLE_Interface$(F_DBLE).f90 H5Aff$(F_STATUS).lo H5Dff$(F_STATUS).lo H5Fff$(F_STATUS).lo H5Eff$(F_STATUS).lo H5Pff$(F_STATUS).lo HDF5.lo: $(srcdir)/HDF5.f90 H5f90global.lo H5_ff$(F_STATUS).lo H5_ff.lo H5Aff.lo H5Aff$(F_STATUS).lo \ H5Dff.lo H5Dff$(F_STATUS).lo \ H5Eff.lo H5Eff$(F_STATUS).lo \ - H5Fff.lo H5Gff.lo H5Iff.lo H5Lff.lo H5Lff$(F_STATUS).lo \ + H5Fff.lo H5Fff$(F_STATUS).lo H5Gff.lo H5Iff.lo H5Lff.lo H5Lff$(F_STATUS).lo \ H5Off.lo H5Off$(F_STATUS).lo H5Pff.lo H5Pff$(F_STATUS).lo H5Rff$(F_STATUS).lo H5Rff.lo \ H5Sff.lo H5Tff.lo H5Tff$(F_STATUS).lo H5Zff.lo \ H5_DBLE_Interface$(F_DBLE).lo @@ -230,7 +231,7 @@ HDF5mpio.lo: $(srcdir)/H5FDmpioff.f90 H5f90global.lo H5_ff$(F_STATUS).lo H5Aff.lo H5Aff$(F_STATUS).lo \ H5Dff.lo H5Dff$(F_STATUS).lo \ H5Eff.lo H5Eff$(F_STATUS).lo \ - H5Fff.lo H5Gff.lo H5Iff.lo H5Lff.lo H5Lff$(F_STATUS).lo \ + H5Fff.lo H5Fff$(F_STATUS).lo H5Gff.lo H5Iff.lo H5Lff.lo H5Lff$(F_STATUS).lo \ H5Off.lo H5Off$(F_STATUS).lo H5Pff.lo H5Pff$(F_STATUS).lo H5Rff$(F_STATUS).lo H5Rff.lo \ H5Sff.lo H5Tff.lo H5Tff$(F_STATUS).lo H5Zff.lo \ H5_DBLE_Interface$(F_DBLE).lo H5FDmpioff.lo diff --git a/fortran/src/Makefile.in b/fortran/src/Makefile.in index c2cd64c..c41653f 100644 --- a/fortran/src/Makefile.in +++ b/fortran/src/Makefile.in @@ -128,9 +128,10 @@ am__libhdf5_fortran_la_SOURCES_DIST = H5f90global.f90 \ H5_DBLE_Interface$(F_DBLE).f90 H5f90kit.c H5_f.c H5Af.c H5Df.c \ H5Ef.c H5Ff.c H5Gf.c H5If.c H5Lf.c H5Of.c H5Pf.c H5Rf.c H5Sf.c \ H5Tf.c H5Zf.c H5Aff$(F_STATUS).f90 H5Dff$(F_STATUS).f90 \ - H5Eff$(F_STATUS).f90 H5Lff$(F_STATUS).f90 H5Off$(F_STATUS).f90 \ - H5Pff$(F_STATUS).f90 H5Rff$(F_STATUS).f90 H5Tff$(F_STATUS).f90 \ - HDF5.f90 H5FDmpiof.c HDF5mpio.f90 H5FDmpioff.f90 + H5Eff$(F_STATUS).f90 H5Fff$(F_STATUS).f90 H5Lff$(F_STATUS).f90 \ + H5Off$(F_STATUS).f90 H5Pff$(F_STATUS).f90 H5Rff$(F_STATUS).f90 \ + H5Tff$(F_STATUS).f90 HDF5.f90 H5FDmpiof.c HDF5mpio.f90 \ + H5FDmpioff.f90 @BUILD_PARALLEL_CONDITIONAL_FALSE@am__objects_1 = HDF5.lo @BUILD_PARALLEL_CONDITIONAL_TRUE@am__objects_1 = H5FDmpiof.lo \ @BUILD_PARALLEL_CONDITIONAL_TRUE@ HDF5mpio.lo H5FDmpioff.lo @@ -141,9 +142,9 @@ am_libhdf5_fortran_la_OBJECTS = H5f90global.lo H5fortran_types.lo \ H5f90kit.lo H5_f.lo H5Af.lo H5Df.lo H5Ef.lo H5Ff.lo H5Gf.lo \ H5If.lo H5Lf.lo H5Of.lo H5Pf.lo H5Rf.lo H5Sf.lo H5Tf.lo \ H5Zf.lo H5Aff$(F_STATUS).lo H5Dff$(F_STATUS).lo \ - H5Eff$(F_STATUS).lo H5Lff$(F_STATUS).lo H5Off$(F_STATUS).lo \ - H5Pff$(F_STATUS).lo H5Rff$(F_STATUS).lo H5Tff$(F_STATUS).lo \ - $(am__objects_1) + H5Eff$(F_STATUS).lo H5Fff$(F_STATUS).lo H5Lff$(F_STATUS).lo \ + H5Off$(F_STATUS).lo H5Pff$(F_STATUS).lo H5Rff$(F_STATUS).lo \ + H5Tff$(F_STATUS).lo $(am__objects_1) libhdf5_fortran_la_OBJECTS = $(am_libhdf5_fortran_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) @@ -319,6 +320,7 @@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ +HAVE_PTHREAD = @HAVE_PTHREAD@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF_CXX = @HDF_CXX@ @@ -370,7 +372,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PARALLEL = @PARALLEL@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ -PTHREAD = @PTHREAD@ RANLIB = @RANLIB@ ROOT = @ROOT@ RUNPARALLEL = @RUNPARALLEL@ @@ -517,7 +518,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 127 +LT_VERS_REVISION = 138 LT_VERS_AGE = 0 # Include src directory in both Fortran and C flags (C compiler is used @@ -556,7 +557,7 @@ libhdf5_fortran_la_SOURCES = H5f90global.f90 \ H5_DBLE_Interface$(F_DBLE).f90 \ H5f90kit.c H5_f.c H5Af.c H5Df.c H5Ef.c H5Ff.c H5Gf.c \ H5If.c H5Lf.c H5Of.c H5Pf.c H5Rf.c H5Sf.c H5Tf.c H5Zf.c \ - H5Aff$(F_STATUS).f90 H5Dff$(F_STATUS).f90 H5Eff$(F_STATUS).f90 H5Lff$(F_STATUS).f90 \ + H5Aff$(F_STATUS).f90 H5Dff$(F_STATUS).f90 H5Eff$(F_STATUS).f90 H5Fff$(F_STATUS).f90 H5Lff$(F_STATUS).f90 \ H5Off$(F_STATUS).f90 H5Pff$(F_STATUS).f90 H5Rff$(F_STATUS).f90 H5Tff$(F_STATUS).f90 $(PARALLEL_COND_SRC) @@ -1101,6 +1102,7 @@ H5Dff.lo: $(srcdir)/H5Dff.f90 H5f90global.lo H5Aff$(F_STATUS).lo: $(srcdir)/H5Aff$(F_STATUS).f90 H5f90global.lo H5Dff$(F_STATUS).lo: $(srcdir)/H5Dff$(F_STATUS).f90 H5f90global.lo H5Eff$(F_STATUS).lo: $(srcdir)/H5Eff$(F_STATUS).f90 H5f90global.lo +H5Fff$(F_STATUS).lo: $(srcdir)/H5Fff$(F_STATUS).f90 H5f90global.lo H5Lff$(F_STATUS).lo: $(srcdir)/H5Lff$(F_STATUS).f90 H5f90global.lo H5Off$(F_STATUS).lo: $(srcdir)/H5Off$(F_STATUS).f90 H5f90global.lo H5Pff$(F_STATUS).lo: $(srcdir)/H5Pff$(F_STATUS).f90 H5f90global.lo @@ -1117,11 +1119,11 @@ H5Rff.lo: $(srcdir)/H5Rff.f90 H5f90global.lo H5Sff.lo: $(srcdir)/H5Sff.f90 H5f90global.lo H5Tff.lo: $(srcdir)/H5Tff.f90 H5f90global.lo H5Zff.lo: $(srcdir)/H5Zff.f90 H5f90global.lo -H5_DBLE_Interface$(F_DBLE).lo: $(srcdir)/H5_DBLE_Interface$(F_DBLE).f90 H5Aff$(F_STATUS).lo H5Dff$(F_STATUS).lo H5Eff$(F_STATUS).lo H5Pff$(F_STATUS).lo +H5_DBLE_Interface$(F_DBLE).lo: $(srcdir)/H5_DBLE_Interface$(F_DBLE).f90 H5Aff$(F_STATUS).lo H5Dff$(F_STATUS).lo H5Fff$(F_STATUS).lo H5Eff$(F_STATUS).lo H5Pff$(F_STATUS).lo HDF5.lo: $(srcdir)/HDF5.f90 H5f90global.lo H5_ff$(F_STATUS).lo H5_ff.lo H5Aff.lo H5Aff$(F_STATUS).lo \ H5Dff.lo H5Dff$(F_STATUS).lo \ H5Eff.lo H5Eff$(F_STATUS).lo \ - H5Fff.lo H5Gff.lo H5Iff.lo H5Lff.lo H5Lff$(F_STATUS).lo \ + H5Fff.lo H5Fff$(F_STATUS).lo H5Gff.lo H5Iff.lo H5Lff.lo H5Lff$(F_STATUS).lo \ H5Off.lo H5Off$(F_STATUS).lo H5Pff.lo H5Pff$(F_STATUS).lo H5Rff$(F_STATUS).lo H5Rff.lo \ H5Sff.lo H5Tff.lo H5Tff$(F_STATUS).lo H5Zff.lo \ H5_DBLE_Interface$(F_DBLE).lo @@ -1130,7 +1132,7 @@ HDF5mpio.lo: $(srcdir)/H5FDmpioff.f90 H5f90global.lo H5_ff$(F_STATUS).lo H5Aff.lo H5Aff$(F_STATUS).lo \ H5Dff.lo H5Dff$(F_STATUS).lo \ H5Eff.lo H5Eff$(F_STATUS).lo \ - H5Fff.lo H5Gff.lo H5Iff.lo H5Lff.lo H5Lff$(F_STATUS).lo \ + H5Fff.lo H5Fff$(F_STATUS).lo H5Gff.lo H5Iff.lo H5Lff.lo H5Lff$(F_STATUS).lo \ H5Off.lo H5Off$(F_STATUS).lo H5Pff.lo H5Pff$(F_STATUS).lo H5Rff$(F_STATUS).lo H5Rff.lo \ H5Sff.lo H5Tff.lo H5Tff$(F_STATUS).lo H5Zff.lo \ H5_DBLE_Interface$(F_DBLE).lo H5FDmpioff.lo diff --git a/fortran/src/hdf5_fortrandll.def.in b/fortran/src/hdf5_fortrandll.def.in index bf7596d..4ce185b 100644 --- a/fortran/src/hdf5_fortrandll.def.in +++ b/fortran/src/hdf5_fortrandll.def.in @@ -228,6 +228,7 @@ H5F_mp_H5FGET_ACCESS_PLIST_F H5F_mp_H5FIS_HDF5_F H5F_mp_H5FGET_NAME_F H5F_mp_H5FGET_FILESIZE_F +@H5_NOF03EXP@H5F_PROVISIONAL_mp_H5FGET_FILE_IMAGE_F ; H5G H5G_mp_H5GOPEN_F H5G_mp_H5GCREATE_F diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index 92ba651..5b9ca11 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.6) +cmake_minimum_required (VERSION 2.8.10) PROJECT (HDF5_FORTRAN_TESTS C CXX Fortran) #----------------------------------------------------------------------------- @@ -105,6 +105,7 @@ IF (HDF5_ENABLE_F2003) fortranlib_test_F03.f90 tH5F.f90 tH5E_F03.f90 + tH5F_F03.f90 tH5L_F03.f90 tH5O_F03.f90 tH5P_F03.f90 diff --git a/fortran/test/Makefile.am b/fortran/test/Makefile.am index 42dd127..84f55e5 100644 --- a/fortran/test/Makefile.am +++ b/fortran/test/Makefile.am @@ -68,7 +68,7 @@ fortranlib_test_1_8_SOURCES = fortranlib_test_1_8.f90 \ if FORTRAN_2003_CONDITIONAL_F fortranlib_test_F03_SOURCES = fortranlib_test_F03.f90 \ - tH5F.f90 tH5E_F03.f90 tH5L_F03.f90 tH5O_F03.f90 tH5P_F03.f90 tH5T_F03.f90 + tH5F.f90 tH5E_F03.f90 tH5F_F03.f90 tH5L_F03.f90 tH5O_F03.f90 tH5P_F03.f90 tH5T_F03.f90 endif diff --git a/fortran/test/Makefile.in b/fortran/test/Makefile.in index b9f05e3..6c226bc 100644 --- a/fortran/test/Makefile.in +++ b/fortran/test/Makefile.in @@ -136,11 +136,12 @@ fortranlib_test_1_8_LDADD = $(LDADD) fortranlib_test_1_8_DEPENDENCIES = libh5test_fortran.la $(LIBH5TEST) \ $(LIBH5F) $(LIBHDF5) am__fortranlib_test_F03_SOURCES_DIST = fortranlib_test_F03.f90 \ - tH5F.f90 tH5E_F03.f90 tH5L_F03.f90 tH5O_F03.f90 tH5P_F03.f90 \ - tH5T_F03.f90 + tH5F.f90 tH5E_F03.f90 tH5F_F03.f90 tH5L_F03.f90 tH5O_F03.f90 \ + tH5P_F03.f90 tH5T_F03.f90 @FORTRAN_2003_CONDITIONAL_F_TRUE@am_fortranlib_test_F03_OBJECTS = fortranlib_test_F03.$(OBJEXT) \ @FORTRAN_2003_CONDITIONAL_F_TRUE@ tH5F.$(OBJEXT) \ @FORTRAN_2003_CONDITIONAL_F_TRUE@ tH5E_F03.$(OBJEXT) \ +@FORTRAN_2003_CONDITIONAL_F_TRUE@ tH5F_F03.$(OBJEXT) \ @FORTRAN_2003_CONDITIONAL_F_TRUE@ tH5L_F03.$(OBJEXT) \ @FORTRAN_2003_CONDITIONAL_F_TRUE@ tH5O_F03.$(OBJEXT) \ @FORTRAN_2003_CONDITIONAL_F_TRUE@ tH5P_F03.$(OBJEXT) \ @@ -304,6 +305,7 @@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ +HAVE_PTHREAD = @HAVE_PTHREAD@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF_CXX = @HDF_CXX@ @@ -355,7 +357,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PARALLEL = @PARALLEL@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ -PTHREAD = @PTHREAD@ RANLIB = @RANLIB@ ROOT = @ROOT@ RUNPARALLEL = @RUNPARALLEL@ @@ -527,7 +528,7 @@ fortranlib_test_1_8_SOURCES = fortranlib_test_1_8.f90 \ tH5F.f90 tH5O.f90 tH5A_1_8.f90 tH5G_1_8.f90 @FORTRAN_2003_CONDITIONAL_F_TRUE@fortranlib_test_F03_SOURCES = fortranlib_test_F03.f90 \ -@FORTRAN_2003_CONDITIONAL_F_TRUE@ tH5F.f90 tH5E_F03.f90 tH5L_F03.f90 tH5O_F03.f90 tH5P_F03.f90 tH5T_F03.f90 +@FORTRAN_2003_CONDITIONAL_F_TRUE@ tH5F.f90 tH5E_F03.f90 tH5F_F03.f90 tH5L_F03.f90 tH5O_F03.f90 tH5P_F03.f90 tH5T_F03.f90 fflush1_SOURCES = fflush1.f90 fflush2_SOURCES = fflush2.f90 diff --git a/fortran/test/fortranlib_test_F03.f90 b/fortran/test/fortranlib_test_F03.f90 index a03241c..1d9615f 100644 --- a/fortran/test/fortranlib_test_F03.f90 +++ b/fortran/test/fortranlib_test_F03.f90 @@ -82,6 +82,10 @@ PROGRAM fortranlibtest_F03 CALL write_test_status(ret_total_error, ' Testing writing/reading enum dataset, using C_LOC', total_error) ret_total_error = 0 + CALL t_enum_conv(ret_total_error) + CALL write_test_status(ret_total_error, ' Testing enumeration conversions', total_error) + + ret_total_error = 0 CALL t_bit(ret_total_error) CALL write_test_status(ret_total_error, ' Testing writing/reading bitfield dataset, using C_LOC', total_error) @@ -141,7 +145,10 @@ PROGRAM fortranlibtest_F03 CALL test_nbit(ret_total_error) CALL write_test_status(ret_total_error, ' Testing nbit filter', total_error) - + ret_total_error = 0 + CALL external_test_offset(cleanup, ret_total_error) + CALL write_test_status(ret_total_error, ' Testing external dataset with offset', total_error) + ! write(*,*) ! write(*,*) '=========================================' ! write(*,*) 'Testing GROUP interface ' @@ -159,6 +166,11 @@ PROGRAM fortranlibtest_F03 CALL obj_info(ret_total_error) CALL write_test_status(ret_total_error, ' Testing object info functions ', total_error) + ret_total_error = 0 + CALL test_get_file_image(ret_total_error) + CALL write_test_status(ret_total_error, ' Testing get file image ', total_error) + + WRITE(*,*) WRITE(*,*) ' ============================================ ' diff --git a/fortran/test/tH5F_F03.f90 b/fortran/test/tH5F_F03.f90 new file mode 100644 index 0000000..dea9a5d --- /dev/null +++ b/fortran/test/tH5F_F03.f90 @@ -0,0 +1,175 @@ +!****h* root/fortran/test/tH5F_F03.f90 +! +! NAME +! tH5F_F03.f90 +! +! FUNCTION +! Test FORTRAN HDF5 H5F APIs which are dependent on FORTRAN 2003 +! features. +! +! COPYRIGHT +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! 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. * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! +! NOTES +! Tests the H5F APIs functionalities of: +! h5fget_file_image_f +! +! CONTAINS SUBROUTINES +! test_get_file_image +! +!***** + +! ***************************************** +! *** H 5 F T E S T S +! ***************************************** + +SUBROUTINE test_get_file_image(total_error) + ! + ! Tests the wrapper for h5fget_file_image + ! + USE HDF5 + USE ISO_C_BINDING + + IMPLICIT NONE + + INTEGER, INTENT(INOUT) :: total_error ! returns error + + CHARACTER(kind=c_char), ALLOCATABLE, DIMENSION(:), TARGET :: file_image_ptr ! Image from file + CHARACTER(kind=c_char), ALLOCATABLE, DIMENSION(:), TARGET :: image_ptr ! Image from h5fget_file_image_f + + INTEGER, DIMENSION(1:100), TARGET :: data ! Write data + INTEGER :: i, file_sz + INTEGER(hid_t) :: file_id = -1 ! File identifier + INTEGER(hid_t) :: dset_id = -1 ! Dataset identifier + INTEGER(hid_t) :: space_id = -1 ! Dataspace identifier + INTEGER(hsize_t), DIMENSION(1:2) :: dims ! Dataset dimensions + INTEGER(size_t) :: itmp_a, itmp_b ! General purpose integers + INTEGER(size_t) :: image_size ! Size of image + TYPE(C_PTR) :: f_ptr ! Pointer + INTEGER(hid_t) :: fapl ! File access property + INTEGER :: error ! Error flag + + + RETURN ! DEBUG, PGI COMPILERS seem to have a bug in the INQUIRE functions, + ! waiting for an answer from PGI how to resolve the problem. + + ! Create new properties for file access + CALL h5pcreate_f(H5P_FILE_ACCESS_F, fapl, error) + CALL check("h5pcreate_f", error, total_error) + + ! Set standard I/O driver + CALL h5pset_fapl_stdio_f(fapl, error) + CALL check("h5pset_fapl_stdio_f", error, total_error) + + ! Create the file + CALL h5fcreate_f("tget_file_image.h5", H5F_ACC_TRUNC_F, file_id, error, H5P_DEFAULT_F, fapl) + CALL check("h5fcreate_f", error, total_error) + + ! Set up data space for new data set + dims(1:2) = (/10,10/) + + CALL h5screate_simple_f(2, dims, space_id, error) + CALL check("h5screate_simple_f", error, total_error) + + ! Create a dataset + CALL h5dcreate_f(file_id, "dset 0", H5T_NATIVE_INTEGER, space_id, dset_id, error) + CALL check("h5dcreate_f", error, total_error) + + ! Write some data to the data set + DO i = 1, 100 + data(i) = i + ENDDO + + f_ptr = C_LOC(data(1)) + CALL h5dwrite_f(dset_id, H5T_NATIVE_INTEGER, f_ptr, error) + CALL check("h5dwrite_f",error, total_error) + + ! Flush the file + CALL h5fflush_f(file_id, H5F_SCOPE_GLOBAL_F, error) + CALL check("h5fflush_f",error, total_error) + + ! Open the test file using standard I/O calls + OPEN(UNIT=10,FILE='tget_file_image.h5', ACCESS='STREAM') + ! Get the size of the test file + ! + ! Since we use the eoa to calculate the image size, the file size + ! may be larger. This is OK, as long as (in this specialized instance) + ! the remainder of the file is all '\0's. + ! + ! With latest mods to truncate call in core file drive, + ! file size should match image size; get the file size + INQUIRE(UNIT=10, SIZE=file_sz) + CLOSE(UNIT=10) + + ! I. Get buffer size needed to hold the buffer + + ! A. Preferred way to get the size + f_ptr = C_NULL_PTR + CALL h5fget_file_image_f(file_id, f_ptr, INT(0, size_t), error, image_size) + CALL check("h5fget_file_image_f",error, total_error) + CALL verify("h5fget_file_image_f", file_sz, INT(image_size), total_error) + + ! B. f_ptr set to point to an incorrect buffer, should pass anyway + f_ptr = C_LOC(data(1)) + itmp_a = 1 + CALL h5fget_file_image_f(file_id, f_ptr, itmp_a, error, image_size) + CALL check("h5fget_file_image_f",error, total_error) + CALL VERIFY("h5fget_file_image_f", INT(itmp_a), 1, total_error) ! Routine should not change the value + CALL VERIFY("h5fget_file_image_f", file_sz, INT(image_size), total_error) + + ! Allocate a buffer of the appropriate size + ALLOCATE(image_ptr(1:image_size)) + + ! Load the image of the file into the buffer + f_ptr = C_LOC(image_ptr(1)(1:1)) + CALL h5fget_file_image_f(file_id, f_ptr, image_size, error) + CALL check("h5fget_file_image_f",error, total_error) + + ! Close dset and space + CALL h5dclose_f(dset_id, error) + CALL check("h5dclose_f", error, total_error) + CALL h5sclose_f(space_id, error) + CALL check("h5sclose_f", error, total_error) + ! Close the test file + CALL h5fclose_f(file_id, error) + CALL check("h5fclose_f",error, total_error) + + ! Allocate a buffer for the test file image + ALLOCATE(file_image_ptr(1:image_size)) + + ! Open the test file using standard I/O calls + OPEN(UNIT=10,FILE='tget_file_image.h5', ACCESS='STREAM') + + ! Read the test file from disk into the buffer + DO i = 1, image_size + READ(10) file_image_ptr(i) + ENDDO + + CLOSE(10) + + ! verify the file and the image contain the same data + DO i = 1, image_size + ! convert one byte to an unsigned integer + IF( ICHAR(file_image_ptr(i)) .NE. ICHAR(image_ptr(i)))THEN + total_error = total_error + 1 + EXIT + ENDIF + ENDDO + + ! release resources + DEALLOCATE(file_image_ptr,image_ptr) + +END SUBROUTINE test_get_file_image diff --git a/fortran/test/tH5P.f90 b/fortran/test/tH5P.f90 index 3faaac2..4c78334 100644 --- a/fortran/test/tH5P.f90 +++ b/fortran/test/tH5P.f90 @@ -27,385 +27,376 @@ ! !***** - SUBROUTINE external_test(cleanup, total_error) +SUBROUTINE external_test(cleanup, total_error) ! This subroutine tests following functionalities: ! h5pset_external_f, h5pget_external_count_f, ! h5pget_external_f - USE HDF5 ! This module contains all necessary modules - - IMPLICIT NONE - LOGICAL, INTENT(IN) :: cleanup - INTEGER, INTENT(OUT) :: total_error - - CHARACTER(LEN=8), PARAMETER :: filename = "external" - CHARACTER(LEN=80) :: fix_filename - INTEGER(HID_T) :: file_id - INTEGER(HID_T) :: plist_id - INTEGER(HID_T) :: space_id - INTEGER(HID_T) :: dataset_id - INTEGER(HSIZE_T), DIMENSION(1) :: cur_size !data space current size - INTEGER(HSIZE_T), DIMENSION(1) :: max_size !data space maximum size - CHARACTER(LEN=256) :: name !external file name - INTEGER :: file_offset !external file offset - INTEGER(HSIZE_T) :: file_size !sizeof external file segment - INTEGER :: error !error code - INTEGER(SIZE_T) :: int_size !size of integer - INTEGER(HSIZE_T) :: file_bytes !Number of bytes reserved - !in the file for the data - INTEGER :: RANK = 1 !dataset rank - INTEGER :: count !number of external files for the - !specified dataset - INTEGER(SIZE_T) :: namesize - INTEGER(HSIZE_T) :: size, buf_size - INTEGER :: idx - - buf_size = 4*1024*1024 - - ! - !Create file "external.h5" using default properties. - ! - CALL h5_fixname_f(filename, fix_filename, H5P_DEFAULT_F, error) - if (error .ne. 0) then - write(*,*) "Cannot modify filename" - stop - endif - CALL h5fcreate_f(fix_filename, H5F_ACC_TRUNC_F, file_id, error) - CALL check("h5fcreate_f",error,total_error) - - - CALL h5pcreate_f(H5P_DATASET_XFER_F, plist_id, error) - CALL check("h5pcreate_f", error, total_error) - CALL h5pset_buffer_f(plist_id, buf_size, error) - CALL check("h5pset_buffer_f", error, total_error) - CALL h5pget_buffer_f(plist_id, size, error) - CALL check("h5pget_buffer_f", error, total_error) - if (size .ne.buf_size) then - total_error = total_error + 1 - write(*,*) "h5pget_buffer_f returned wrong size, error" - endif - CALL h5pclose_f(plist_id, error) - CALL check("h5pclose_f", error, total_error) - - CALL h5pcreate_f(H5P_DATASET_CREATE_F, plist_id, error) - CALL check("h5pcreate_f",error,total_error) - cur_size(1) =100 - max_size(1) = 100; - call h5tget_size_f(H5T_NATIVE_INTEGER, int_size, error) - CALL check("h5tget_size_f",error,total_error) - file_size = int_size * max_size(1); - CALL h5pset_external_f(plist_id, "ext1.data", 0, file_size, error) - CALL check("h5pset_external_f",error,total_error) - CALL h5screate_simple_f(RANK, cur_size, space_id, error, max_size) - CALL check("h5screate_simple_f", error, total_error) - CALL h5dcreate_f(file_id, "dset1", H5T_NATIVE_INTEGER, space_id, & - dataset_id, error, plist_id) - CALL check("h5dcreate_f", error, total_error) - - CALL h5dclose_f(dataset_id, error) - CALL check("h5dclose_f", error, total_error) - CALL h5pclose_f(plist_id, error) - CALL check("h5pclose_f", error, total_error) - CALL h5sclose_f(space_id, error) - CALL check("h5sclose_f", error, total_error) - CALL h5fclose_f(file_id, error) - - CALL h5fopen_f(fix_filename, H5F_ACC_RDWR_F, file_id, error) - CALL h5dopen_f(file_id, "dset1", dataset_id, error) - CALL check("h5dopen_f",error,total_error) - - ! Read dataset creation information - CALL h5dget_create_plist_f(dataset_id, plist_id, error) - CALL check("h5dget_create_plist_f",error,total_error) - CALL h5pget_external_count_f(plist_id, count, error) - CALL check("h5pget_external_count_f",error,total_error) - if(count .ne. 1 ) then - write (*,*) "got external_count is not correct" - total_error = total_error + 1 - end if - namesize = 10 - idx = 0 - CALL h5pget_external_f(plist_id, idx, namesize, name, file_offset, & - file_bytes, error) - CALL check("h5pget_external_f",error,total_error) - if(file_offset .ne. 0 ) then - write (*,*) "got external file offset is not correct" - total_error = total_error + 1 - end if - if(file_bytes .ne. file_size ) then - write (*,*) "got external file size is not correct" - total_error = total_error + 1 - end if - - CALL h5dclose_f(dataset_id, error) - CALL check("h5dclose_f", error, total_error) - CALL h5pclose_f(plist_id, error) - CALL check("h5pclose_f", error, total_error) - CALL h5fclose_f(file_id, error) - CALL check("h5fclose_f", error, total_error) - - - if(cleanup) CALL h5_cleanup_f(filename, H5P_DEFAULT_F, error) - CALL check("h5_cleanup_f", error, total_error) + USE HDF5 ! This module contains all necessary modules + + IMPLICIT NONE + LOGICAL, INTENT(IN) :: cleanup + INTEGER, INTENT(OUT) :: total_error + + CHARACTER(LEN=8), PARAMETER :: filename = "external" + CHARACTER(LEN=80) :: fix_filename + INTEGER(HID_T) :: file_id + INTEGER(HID_T) :: plist_id + INTEGER(HID_T) :: space_id + INTEGER(HID_T) :: dataset_id + INTEGER(HSIZE_T), DIMENSION(1) :: cur_size !data space current size + INTEGER(HSIZE_T), DIMENSION(1) :: max_size !data space maximum size + CHARACTER(LEN=256) :: name !external file name + INTEGER(OFF_T) :: file_offset !external file offset + INTEGER(HSIZE_T) :: file_size !sizeof external file segment + INTEGER :: error !error code + INTEGER(SIZE_T) :: int_size !size of integer + INTEGER(HSIZE_T) :: file_bytes !Number of bytes reserved + !in the file for the data + INTEGER :: RANK = 1 !dataset rank + INTEGER :: count !number of external files for the + !specified dataset + INTEGER(SIZE_T) :: namesize + INTEGER(HSIZE_T) :: size, buf_size + INTEGER :: idx + + buf_size = 4*1024*1024 + + ! + !Create file "external.h5" using default properties. + ! + CALL h5_fixname_f(filename, fix_filename, H5P_DEFAULT_F, error) + IF (error .NE. 0) THEN + STOP "Cannot modify filename" + ENDIF + CALL h5fcreate_f(fix_filename, H5F_ACC_TRUNC_F, file_id, error) + CALL check("h5fcreate_f",error,total_error) + + CALL h5pcreate_f(H5P_DATASET_XFER_F, plist_id, error) + CALL check("h5pcreate_f", error, total_error) + CALL h5pset_buffer_f(plist_id, buf_size, error) + CALL check("h5pset_buffer_f", error, total_error) + CALL h5pget_buffer_f(plist_id, size, error) + CALL check("h5pget_buffer_f", error, total_error) + IF (size .NE.buf_size) THEN + total_error = total_error + 1 + WRITE(*,*) "h5pget_buffer_f returned wrong size, error" + ENDIF + CALL h5pclose_f(plist_id, error) + CALL check("h5pclose_f", error, total_error) + + CALL h5pcreate_f(H5P_DATASET_CREATE_F, plist_id, error) + CALL check("h5pcreate_f",error,total_error) + cur_size(1) =100 + max_size(1) = 100 + CALL h5tget_size_f(H5T_NATIVE_INTEGER, int_size, error) + CALL check("h5tget_size_f",error,total_error) + file_size = int_size * max_size(1) + CALL h5pset_external_f(plist_id, "ext1.data", INT(0,off_t), file_size, error) + CALL check("h5pset_external_f",error,total_error) + CALL h5screate_simple_f(RANK, cur_size, space_id, error, max_size) + CALL check("h5screate_simple_f", error, total_error) + CALL h5dcreate_f(file_id, "dset1", H5T_NATIVE_INTEGER, space_id, & + dataset_id, error, plist_id) + CALL check("h5dcreate_f", error, total_error) + + CALL h5dclose_f(dataset_id, error) + CALL check("h5dclose_f", error, total_error) + CALL h5pclose_f(plist_id, error) + CALL check("h5pclose_f", error, total_error) + CALL h5sclose_f(space_id, error) + CALL check("h5sclose_f", error, total_error) + CALL h5fclose_f(file_id, error) + + CALL h5fopen_f(fix_filename, H5F_ACC_RDWR_F, file_id, error) + CALL h5dopen_f(file_id, "dset1", dataset_id, error) + CALL check("h5dopen_f",error,total_error) + + ! Read dataset creation information + CALL h5dget_create_plist_f(dataset_id, plist_id, error) + CALL check("h5dget_create_plist_f",error,total_error) + CALL h5pget_external_count_f(plist_id, count, error) + CALL check("h5pget_external_count_f",error,total_error) + IF(count .NE. 1 ) THEN + WRITE (*,*) "got external_count is not correct" + total_error = total_error + 1 + END IF + namesize = 10 + idx = 0 + CALL h5pget_external_f(plist_id, idx, namesize, name, file_offset, & + file_bytes, error) + CALL check("h5pget_external_f",error,total_error) + IF(file_offset .NE. 0 ) THEN + WRITE (*,*) "got external file offset is not correct" + total_error = total_error + 1 + END IF + IF(file_bytes .NE. file_size ) THEN + WRITE (*,*) "got external file size is not correct" + total_error = total_error + 1 + END IF + + CALL h5dclose_f(dataset_id, error) + CALL check("h5dclose_f", error, total_error) + CALL h5pclose_f(plist_id, error) + CALL check("h5pclose_f", error, total_error) + CALL h5fclose_f(file_id, error) + CALL check("h5fclose_f", error, total_error) + + IF(cleanup) CALL h5_cleanup_f(filename, H5P_DEFAULT_F, error) + CALL check("h5_cleanup_f", error, total_error) + RETURN +END SUBROUTINE external_test + +SUBROUTINE multi_file_test(cleanup, total_error) + USE HDF5 ! This module contains all necessary modules + + IMPLICIT NONE + LOGICAL, INTENT(IN) :: cleanup + INTEGER, INTENT(OUT) :: total_error + + CHARACTER(LEN=9), PARAMETER :: filename = "multidset" ! File name + CHARACTER(LEN=80) :: fix_filename + CHARACTER(LEN=4), PARAMETER :: dsetname = "dset" ! Dataset name + + INTEGER(HID_T) :: file_id ! File identifier + INTEGER(HID_T) :: dset_id ! Dataset identifier + INTEGER(HID_T) :: dspace_id ! Dataspace identifier + INTEGER(HID_T) :: dtype_id ! Datatype identifier + INTEGER(HID_T) :: fapl, fapl_1 ! File access property list identifier + INTEGER, DIMENSION(0:H5FD_MEM_NTYPES_F-1) :: memb_map, memb_map_out + INTEGER(HID_T), DIMENSION(0:H5FD_MEM_NTYPES_F-1) :: memb_fapl, memb_fapl_out + CHARACTER(LEN=20), DIMENSION(0:H5FD_MEM_NTYPES_F-1) :: memb_name, memb_name_out + REAL, DIMENSION(0:H5FD_MEM_NTYPES_F-1) :: memb_addr, memb_addr_out + !INTEGER(HADDR_T), DIMENSION(0:H5FD_MEM_NTYPES_F) :: memb_addr + LOGICAL :: relax = .TRUE. + LOGICAL :: relax_out = .TRUE. + + INTEGER(HSIZE_T), DIMENSION(2) :: dims = (/4,6/) ! Dataset dimensions + INTEGER :: rank = 2 ! Dataset rank + + INTEGER, DIMENSION(4,6) :: dset_data, data_out ! Data buffers + INTEGER :: error ! Error flag + INTEGER(HID_T) :: driver + INTEGER :: i, j !general purpose integers + INTEGER(HSIZE_T), DIMENSION(2) :: data_dims + INTEGER :: mdc_nelmts + INTEGER(SIZE_T) :: rdcc_nelmts + INTEGER(SIZE_T) :: rdcc_nbytes + REAL :: rdcc_w0 + memb_fapl = H5P_DEFAULT_F + memb_map = H5FD_MEM_SUPER_F + memb_addr = 0. + memb_map(H5FD_MEM_SUPER_F) = H5FD_MEM_SUPER_F + memb_addr(H5FD_MEM_SUPER_F) = 0. + memb_map(H5FD_MEM_BTREE_F) = H5FD_MEM_BTREE_F + memb_addr(H5FD_MEM_BTREE_F) = 0.1 + memb_map(H5FD_MEM_DRAW_F) = H5FD_MEM_DRAW_F + memb_addr(H5FD_MEM_DRAW_F) = 0.5 + memb_map(H5FD_MEM_GHEAP_F) = H5FD_MEM_GHEAP_F + memb_addr(H5FD_MEM_GHEAP_F) = 0.2 + memb_map(H5FD_MEM_LHEAP_F) = H5FD_MEM_LHEAP_F + memb_addr(H5FD_MEM_LHEAP_F) = 0.3 + memb_map(H5FD_MEM_OHDR_F) = H5FD_MEM_OHDR_F + memb_addr(H5FD_MEM_OHDR_F) = 0.4 + + memb_name = ' ' + memb_name(H5FD_MEM_SUPER_F) = '%s-s.h5' + memb_name(H5FD_MEM_BTREE_F) = '%s-b.h5' + memb_name(H5FD_MEM_DRAW_F) = '%s-r.h5' + memb_name(H5FD_MEM_GHEAP_F) = '%s-g.h5' + memb_name(H5FD_MEM_LHEAP_F) = '%s-l.h5' + memb_name(H5FD_MEM_OHDR_F) = '%s-o.h5' + + ! + ! Initialize the dset_data array. + ! + DO i = 1, 4 + DO j = 1, 6 + dset_data(i,j) = (i-1)*6 + j + END DO + END DO + + ! + ! Create a new file using default properties. + ! + CALL h5_fixname_f(filename, fix_filename, H5P_DEFAULT_F, error) + IF (error .NE. 0) THEN + WRITE(*,*) "Cannot modify filename" + STOP + ENDIF + CALL h5pcreate_f(H5P_FILE_ACCESS_F, fapl, error) + CALL check("h5pcreate_f", error, total_error) + CALL h5pset_fapl_multi_f(fapl, memb_map, memb_fapl, memb_name, memb_addr, relax, error) + CALL check("h5pset_fapl_multi_f", error, total_error) + CALL h5pget_fapl_multi_f(fapl, memb_map_out, memb_fapl_out, memb_name_out, & + memb_addr_out, relax_out, error) + CALL check("h5pget_fapl_multi_f", error, total_error) + CALL h5pget_driver_f(fapl, driver, error) + CALL check("h5pget_driver_f",error, total_error) + IF(driver .NE. H5FD_MULTI_F) THEN + WRITE(*,*) "Wrong value for driver" + ENDIF + ! + ! Let's check h5pget(set)cache_f APIs here for now + ! + CALL h5pget_cache_f(fapl, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, & + rdcc_w0, error) + CALL check("h5pget_cache_f", error, total_error) + + ! + ! Set cache to some number + ! + rdcc_nbytes = 1024*1024 + CALL h5pset_cache_f(fapl, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, & + rdcc_w0, error) + CALL check("h5pset_cache_f", error, total_error) + CALL h5fcreate_f(fix_filename, H5F_ACC_TRUNC_F, file_id, error, access_prp = fapl) + CALL check("h5fcreate_f", error, total_error) + IF(error .NE. 0) THEN + WRITE(*,*) "Cannot create file using multi-file driver... Exiting...." + total_error = 1 + CALL h5pclose_f(fapl, error) RETURN - END SUBROUTINE external_test - - SUBROUTINE multi_file_test(cleanup, total_error) - USE HDF5 ! This module contains all necessary modules - - IMPLICIT NONE - LOGICAL, INTENT(IN) :: cleanup - INTEGER, INTENT(OUT) :: total_error - - CHARACTER(LEN=9), PARAMETER :: filename = "multidset" ! File name - CHARACTER(LEN=80) :: fix_filename - CHARACTER(LEN=4), PARAMETER :: dsetname = "dset" ! Dataset name - - INTEGER(HID_T) :: file_id ! File identifier - INTEGER(HID_T) :: dset_id ! Dataset identifier - INTEGER(HID_T) :: dspace_id ! Dataspace identifier - INTEGER(HID_T) :: dtype_id ! Datatype identifier - INTEGER(HID_T) :: fapl, fapl_1 ! File access property list identifier - INTEGER, DIMENSION(0:H5FD_MEM_NTYPES_F-1) :: memb_map, memb_map_out - INTEGER(HID_T), DIMENSION(0:H5FD_MEM_NTYPES_F-1) :: memb_fapl, memb_fapl_out - CHARACTER(LEN=20), DIMENSION(0:H5FD_MEM_NTYPES_F-1) :: memb_name, memb_name_out - REAL, DIMENSION(0:H5FD_MEM_NTYPES_F-1) :: memb_addr, memb_addr_out - !INTEGER(HADDR_T), DIMENSION(0:H5FD_MEM_NTYPES_F) :: memb_addr - LOGICAL :: relax = .TRUE. - LOGICAL :: relax_out = .TRUE. - - INTEGER(HSIZE_T), DIMENSION(2) :: dims = (/4,6/) ! Dataset dimensions - INTEGER :: rank = 2 ! Dataset rank - - INTEGER, DIMENSION(4,6) :: dset_data, data_out ! Data buffers - INTEGER :: error ! Error flag - INTEGER(HID_T) :: driver - INTEGER :: i, j !general purpose integers - INTEGER(HSIZE_T), DIMENSION(2) :: data_dims - INTEGER :: mdc_nelmts - INTEGER(SIZE_T) :: rdcc_nelmts - INTEGER(SIZE_T) :: rdcc_nbytes - REAL :: rdcc_w0 - memb_fapl = H5P_DEFAULT_F - memb_map = H5FD_MEM_SUPER_F - memb_addr = 0. - memb_map(H5FD_MEM_SUPER_F) = H5FD_MEM_SUPER_F - memb_addr(H5FD_MEM_SUPER_F) = 0. - memb_map(H5FD_MEM_BTREE_F) = H5FD_MEM_BTREE_F - memb_addr(H5FD_MEM_BTREE_F) = 0.1 - memb_map(H5FD_MEM_DRAW_F) = H5FD_MEM_DRAW_F - memb_addr(H5FD_MEM_DRAW_F) = 0.5 - memb_map(H5FD_MEM_GHEAP_F) = H5FD_MEM_GHEAP_F - memb_addr(H5FD_MEM_GHEAP_F) = 0.2 - memb_map(H5FD_MEM_LHEAP_F) = H5FD_MEM_LHEAP_F - memb_addr(H5FD_MEM_LHEAP_F) = 0.3 - memb_map(H5FD_MEM_OHDR_F) = H5FD_MEM_OHDR_F - memb_addr(H5FD_MEM_OHDR_F) = 0.4 - - memb_name = ' ' - memb_name(H5FD_MEM_SUPER_F) = '%s-s.h5' - memb_name(H5FD_MEM_BTREE_F) = '%s-b.h5' - memb_name(H5FD_MEM_DRAW_F) = '%s-r.h5' - memb_name(H5FD_MEM_GHEAP_F) = '%s-g.h5' - memb_name(H5FD_MEM_LHEAP_F) = '%s-l.h5' - memb_name(H5FD_MEM_OHDR_F) = '%s-o.h5' - - ! - ! Initialize the dset_data array. - ! - do i = 1, 4 - do j = 1, 6 - dset_data(i,j) = (i-1)*6 + j; - end do - end do - - ! - ! Create a new file using default properties. - ! - CALL h5_fixname_f(filename, fix_filename, H5P_DEFAULT_F, error) - if (error .ne. 0) then - write(*,*) "Cannot modify filename" - stop - endif - CALL h5pcreate_f(H5P_FILE_ACCESS_F, fapl, error) - CALL check("h5pcreate_f", error, total_error) - CALL h5pset_fapl_multi_f(fapl, memb_map, memb_fapl, memb_name, memb_addr, relax, error) - CALL check("h5pset_fapl_multi_f", error, total_error) - CALL h5pget_fapl_multi_f(fapl, memb_map_out, memb_fapl_out, memb_name_out, & - memb_addr_out, relax_out, error) - CALL check("h5pget_fapl_multi_f", error, total_error) - CALL h5pget_driver_f(fapl, driver, error) - CALL check("h5pget_driver_f",error, total_error) - if(driver .ne. H5FD_MULTI_F) then - write(*,*) "Wrong value for driver" - endif - ! - ! Let's check h5pget(set)cache_f APIs here for now - ! - CALL h5pget_cache_f(fapl, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, & - rdcc_w0, error) - CALL check("h5pget_cache_f", error, total_error) - - - ! Set cache to some number - ! - rdcc_nbytes = 1024*1024 - CALL h5pset_cache_f(fapl, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, & - rdcc_w0, error) - CALL check("h5pset_cache_f", error, total_error) - CALL h5fcreate_f(fix_filename, H5F_ACC_TRUNC_F, file_id, error, access_prp = fapl) - CALL check("h5fcreate_f", error, total_error) - if(error .ne. 0) then - write(*,*) "Cannot create file using multi-file driver... Exiting...." - total_error = 1 - call h5pclose_f(fapl, error) - return - endif - - ! - ! Create the dataspace. - ! - CALL h5screate_simple_f(rank, dims, dspace_id, error) - CALL check("h5screate_simple_f", error, total_error) - - - ! - ! Create the dataset with default properties. - ! - CALL h5dcreate_f(file_id, dsetname, H5T_NATIVE_INTEGER, dspace_id, & - dset_id, error) - CALL check("h5dcreate_f", error, total_error) - - ! - ! Write the dataset. - ! - data_dims(1) = 4 - data_dims(2) = 6 - CALL h5dwrite_f(dset_id, H5T_NATIVE_INTEGER, dset_data, data_dims, error) - CALL check("h5dwrite_f", error, total_error) - - - ! - ! End access to the dataset and release resources used by it. - ! - CALL h5dclose_f(dset_id, error) - CALL check("h5dclose_f", error, total_error) - - ! - ! Terminate access to the data space. - ! - CALL h5sclose_f(dspace_id, error) - CALL check("h5sclose_f", error, total_error) - - ! - ! Close the file. - ! - CALL h5fclose_f(file_id, error) - CALL check("h5fclose_f", error, total_error) - CALL h5pclose_f(fapl, error) - CALL check("h5pclose_f", error, total_error) - ! - ! Open the existing file. - ! - CALL h5pcreate_f(H5P_FILE_ACCESS_F, fapl, error) - CALL check("h5pcreate_f", error, total_error) - CALL h5pset_fapl_multi_f(fapl, relax, error) - CALL check("h5pset_fapl_multi_f", error, total_error) - CALL h5fopen_f (fix_filename, H5F_ACC_RDWR_F, file_id, error, access_prp = fapl) - CALL check("h5fopen_f", error, total_error) - ! - CALL h5fget_access_plist_f(file_id, fapl_1, error) - CALL check("h5fget_access_plist_f", error, total_error) - !It doesn't work on Windows. - !CALL h5pget_fapl_multi_f(fapl_1, memb_map_out, memb_fapl_out, memb_name_out, & - ! memb_addr_out, relax_out, error) - ! write(*,*) memb_map_out - ! write(*,*) memb_fapl_out - ! write(*,*) memb_name_out - ! write(*,*) memb_addr_out - ! CALL check("h5pget_fapl_multi_f", error, total_error) - - ! - ! Open the existing dataset. - ! - CALL h5dopen_f(file_id, dsetname, dset_id, error) - CALL check("h5dopen_f", error, total_error) - - ! - ! Get the dataset type. - ! - CALL h5dget_type_f(dset_id, dtype_id, error) - CALL check("h5dget_type_f", error, total_error) - - ! - ! Get the data space. - ! - CALL h5dget_space_f(dset_id, dspace_id, error) - CALL check("h5dget_space_f", error, total_error) - - ! - ! Read the dataset. - ! - CALL h5dread_f(dset_id, H5T_NATIVE_INTEGER, data_out, data_dims, error) - CALL check("h5dread_f", error, total_error) - - ! - !Compare the data. - ! - do i = 1, 4 - do j = 1, 6 - IF (data_out(i,j) .NE. dset_data(i, j)) THEN - write(*, *) "dataset test error occured" - write(*,*) "data read is not the same as the data writen" - END IF - end do - end do - - ! - ! End access to the dataset and release resources used by it. - ! - CALL h5dclose_f(dset_id, error) - CALL check("h5dclose_f", error, total_error) - - ! - ! Terminate access to the data space. - ! - CALL h5sclose_f(dspace_id, error) - CALL check("h5sclose_f", error, total_error) - - ! - ! Terminate access to the data type. - ! - CALL h5tclose_f(dtype_id, error) - CALL check("h5tclose_f", error, total_error) - ! - ! Close the file. - ! - CALL h5fclose_f(file_id, error) - CALL check("h5fclose_f", error, total_error) - CALL h5pclose_f(fapl, error) - CALL check("h5pclose_f", error, total_error) - CALL h5pclose_f(fapl_1, error) - CALL check("h5pclose_f", error, total_error) - IF(cleanup) CALL h5_cleanup_f(filename, H5P_DEFAULT_F, error) - CALL check("h5_cleanup_f", error, total_error) - - IF(cleanup) CALL h5_cleanup_f(filename//'.h5-b', H5P_DEFAULT_F, error) - CALL check("h5_cleanup_f", error, total_error) - IF(cleanup) CALL h5_cleanup_f(filename//'.h5-g', H5P_DEFAULT_F, error) - CALL check("h5_cleanup_f", error, total_error) - IF(cleanup) CALL h5_cleanup_f(filename//'.h5-l', H5P_DEFAULT_F, error) - CALL check("h5_cleanup_f", error, total_error) - IF(cleanup) CALL h5_cleanup_f(filename//'.h5-o', H5P_DEFAULT_F, error) - CALL check("h5_cleanup_f", error, total_error) - IF(cleanup) CALL h5_cleanup_f(filename//'.h5-r', H5P_DEFAULT_F, error) - CALL check("h5_cleanup_f", error, total_error) - IF(cleanup) CALL h5_cleanup_f(filename//'.h5-s', H5P_DEFAULT_F, error) - CALL check("h5_cleanup_f", error, total_error) - - RETURN - END SUBROUTINE multi_file_test + ENDIF + ! + ! Create the dataspace. + ! + CALL h5screate_simple_f(rank, dims, dspace_id, error) + CALL check("h5screate_simple_f", error, total_error) + ! + ! Create the dataset with default properties. + ! + CALL h5dcreate_f(file_id, dsetname, H5T_NATIVE_INTEGER, dspace_id, & + dset_id, error) + CALL check("h5dcreate_f", error, total_error) + ! + ! Write the dataset. + ! + data_dims(1) = 4 + data_dims(2) = 6 + CALL h5dwrite_f(dset_id, H5T_NATIVE_INTEGER, dset_data, data_dims, error) + CALL check("h5dwrite_f", error, total_error) + ! + ! End access to the dataset and release resources used by it. + ! + CALL h5dclose_f(dset_id, error) + CALL check("h5dclose_f", error, total_error) + + ! + ! Terminate access to the data space. + ! + CALL h5sclose_f(dspace_id, error) + CALL check("h5sclose_f", error, total_error) + + ! + ! Close the file. + ! + CALL h5fclose_f(file_id, error) + CALL check("h5fclose_f", error, total_error) + CALL h5pclose_f(fapl, error) + CALL check("h5pclose_f", error, total_error) + ! + ! Open the existing file. + ! + CALL h5pcreate_f(H5P_FILE_ACCESS_F, fapl, error) + CALL check("h5pcreate_f", error, total_error) + CALL h5pset_fapl_multi_f(fapl, relax, error) + CALL check("h5pset_fapl_multi_f", error, total_error) + CALL h5fopen_f (fix_filename, H5F_ACC_RDWR_F, file_id, error, access_prp = fapl) + CALL check("h5fopen_f", error, total_error) + ! + CALL h5fget_access_plist_f(file_id, fapl_1, error) + CALL check("h5fget_access_plist_f", error, total_error) + !It doesn't work on Windows. + !CALL h5pget_fapl_multi_f(fapl_1, memb_map_out, memb_fapl_out, memb_name_out, & + ! memb_addr_out, relax_out, error) + ! write(*,*) memb_map_out + ! write(*,*) memb_fapl_out + ! write(*,*) memb_name_out + ! write(*,*) memb_addr_out + ! CALL check("h5pget_fapl_multi_f", error, total_error) + + ! + ! Open the existing dataset. + ! + CALL h5dopen_f(file_id, dsetname, dset_id, error) + CALL check("h5dopen_f", error, total_error) + + ! + ! Get the dataset type. + ! + CALL h5dget_type_f(dset_id, dtype_id, error) + CALL check("h5dget_type_f", error, total_error) + + ! + ! Get the data space. + ! + CALL h5dget_space_f(dset_id, dspace_id, error) + CALL check("h5dget_space_f", error, total_error) + + ! + ! Read the dataset. + ! + CALL h5dread_f(dset_id, H5T_NATIVE_INTEGER, data_out, data_dims, error) + CALL check("h5dread_f", error, total_error) + + ! + !Compare the data. + ! + DO i = 1, 4 + DO j = 1, 6 + IF (data_out(i,j) .NE. dset_data(i, j)) THEN + WRITE(*, *) "dataset test error occured" + WRITE(*,*) "data read is not the same as the data writen" + END IF + END DO + END DO + + ! + ! End access to the dataset and release resources used by it. + ! + CALL h5dclose_f(dset_id, error) + CALL check("h5dclose_f", error, total_error) + + ! + ! Terminate access to the data space. + ! + CALL h5sclose_f(dspace_id, error) + CALL check("h5sclose_f", error, total_error) + + ! + ! Terminate access to the data type. + ! + CALL h5tclose_f(dtype_id, error) + CALL check("h5tclose_f", error, total_error) + ! + ! Close the file. + ! + CALL h5fclose_f(file_id, error) + CALL check("h5fclose_f", error, total_error) + CALL h5pclose_f(fapl, error) + CALL check("h5pclose_f", error, total_error) + CALL h5pclose_f(fapl_1, error) + CALL check("h5pclose_f", error, total_error) + IF(cleanup) CALL h5_cleanup_f(filename, H5P_DEFAULT_F, error) + CALL check("h5_cleanup_f", error, total_error) + + IF(cleanup) CALL h5_cleanup_f(filename//'.h5-b', H5P_DEFAULT_F, error) + CALL check("h5_cleanup_f", error, total_error) + IF(cleanup) CALL h5_cleanup_f(filename//'.h5-g', H5P_DEFAULT_F, error) + CALL check("h5_cleanup_f", error, total_error) + IF(cleanup) CALL h5_cleanup_f(filename//'.h5-l', H5P_DEFAULT_F, error) + CALL check("h5_cleanup_f", error, total_error) + IF(cleanup) CALL h5_cleanup_f(filename//'.h5-o', H5P_DEFAULT_F, error) + CALL check("h5_cleanup_f", error, total_error) + IF(cleanup) CALL h5_cleanup_f(filename//'.h5-r', H5P_DEFAULT_F, error) + CALL check("h5_cleanup_f", error, total_error) + IF(cleanup) CALL h5_cleanup_f(filename//'.h5-s', H5P_DEFAULT_F, error) + CALL check("h5_cleanup_f", error, total_error) + + RETURN +END SUBROUTINE multi_file_test !------------------------------------------------------------------------- ! Function: test_chunk_cache @@ -432,24 +423,24 @@ SUBROUTINE test_chunk_cache(cleanup, total_error) IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup INTEGER, INTENT(OUT) :: total_error - + CHARACTER(LEN=14), PARAMETER :: filename="chunk_cache" CHARACTER(LEN=80) :: fix_filename - INTEGER(hid_t) :: fid = -1 ! /* File ID */ + INTEGER(hid_t) :: fid = -1 ! File ID INTEGER(hid_t) :: file - INTEGER(hid_t) :: fapl_local = -1 ! /* Local fapl */ - INTEGER(hid_t) :: fapl_def = -1 ! /* Default fapl */ - INTEGER(hid_t) :: dcpl = -1 !/* Dataset creation property list ID */ - INTEGER(hid_t) :: dapl1 = -1 !/* Dataset access property list ID */ - INTEGER(hid_t) :: dapl2 = -1 !/* Dataset access property list ID */ - INTEGER(hid_t) :: sid = -1 !/* Dataspace ID */ - INTEGER(hid_t) :: dsid = -1 !/* Dataset ID */ - INTEGER(hsize_t), DIMENSION(1:1) :: chunk_dim, NDIM = (/100/) !/* Dataset and chunk dimensions */ - INTEGER(size_t) :: nslots_1, nslots_2, nslots_3, nslots_4 !/* rdcc number of elements */ - INTEGER(size_t) :: nbytes_1, nbytes_2, nbytes_3, nbytes_4 !/* rdcc number of bytes */ + INTEGER(hid_t) :: fapl_local = -1 ! Local fapl + INTEGER(hid_t) :: fapl_def = -1 ! Default fapl + INTEGER(hid_t) :: dcpl = -1 ! Dataset creation property list ID + INTEGER(hid_t) :: dapl1 = -1 ! Dataset access property list ID + INTEGER(hid_t) :: dapl2 = -1 ! Dataset access property list ID + INTEGER(hid_t) :: sid = -1 ! Dataspace ID + INTEGER(hid_t) :: dsid = -1 ! Dataset ID + INTEGER(hsize_t), DIMENSION(1:1) :: chunk_dim, NDIM = (/100/) ! Dataset and chunk dimensions + INTEGER(size_t) :: nslots_1, nslots_2, nslots_3, nslots_4 ! rdcc number of elements + INTEGER(size_t) :: nbytes_1, nbytes_2, nbytes_3, nbytes_4 ! rdcc number of bytes INTEGER :: mdc_nelmts - INTEGER(size_t) ::nlinks !/* Number of link traversals */ - REAL :: w0_1, w0_2, w0_3, w0_4; !/* rdcc preemption policy */ + INTEGER(size_t) ::nlinks ! Number of link traversals + REAL :: w0_1, w0_2, w0_3, w0_4 ! rdcc preemption policy INTEGER :: error INTEGER(size_t) rdcc_nelmts INTEGER(size_t) rdcc_nbytes @@ -462,7 +453,7 @@ SUBROUTINE test_chunk_cache(cleanup, total_error) STOP ENDIF - !/* Create a default fapl and dapl */ + ! Create a default fapl and dapl CALL H5Pcreate_f(H5P_FILE_ACCESS_F, fapl_def, error) CALL check("H5Pcreate_f", error, total_error) CALL H5Pcreate_f(H5P_DATASET_ACCESS_F, dapl1, error) @@ -481,7 +472,7 @@ SUBROUTINE test_chunk_cache(cleanup, total_error) CALL VERIFYlogical("H5Pget_chunk_cache_f", .TRUE., .FALSE., total_error) ENDIF - ! /* Set a lapl property on dapl1 (to verify inheritance) */ + ! Set a lapl property on dapl1 (to verify inheritance) CALL H5Pset_nlinks_f(dapl1, 134_size_t , error) CALL check("H5Pset_nlinks_f", error, total_error) CALL H5Pget_nlinks_f(dapl1, nlinks, error) @@ -494,7 +485,7 @@ SUBROUTINE test_chunk_cache(cleanup, total_error) ! Turn off the chunk cache, so all the chunks are immediately written to disk CALL H5Pget_cache_f(fapl_local, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, rdcc_w0, error) CALL check("H5Pget_cache_f", error, total_error) - rdcc_nbytes = 0; + rdcc_nbytes = 0 CALL H5Pset_cache_f(fapl_local, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, rdcc_w0, error) CALL check("H5Pset_cache_f", error, total_error) @@ -506,29 +497,29 @@ SUBROUTINE test_chunk_cache(cleanup, total_error) CALL H5Pset_cache_f(fapl_local, 0, nslots_2, nbytes_2, w0_2, error) CALL check("H5Pset_cache_f", error, total_error) - !/* Create file */ + ! Create file CALL H5Fcreate_f(fix_filename, H5F_ACC_TRUNC_F, fid, error, H5P_DEFAULT_F, fapl_local) CALL check("H5Fcreate_f", error, total_error) - !/* Create dataset creation property list */ + ! Create dataset creation property list CALL H5Pcreate_f(H5P_DATASET_CREATE_F, dcpl, error) CALL check("H5Pcreate_f", error, total_error) - !/* Set chunking */ - chunk_dim(1) = 10; + ! Set chunking + chunk_dim(1) = 10 CALL H5Pset_chunk_f(dcpl, 1, chunk_dim, error) CALL check("H5Pset_chunk_f", error, total_error) - !/* Create 1-D dataspace */ + ! Create 1-D dataspace ndim(1) = 100 CALL H5Screate_simple_f(1, ndim, sid, error) CALL check("H5Pcreate_f", error, total_error) - ! /* Create dataset with default dapl */ + ! Create dataset with default dapl CALL H5Dcreate_f(fid, "dset", H5T_NATIVE_INTEGER, sid, dsid, error, dcpl, H5P_DEFAULT_F, dapl1) CALL check("H5Pcreate_f", error, total_error) - ! /* Retrieve dapl from dataset, verify cache values are the same as on fapl_local */ + ! Retrieve dapl from dataset, verify cache values are the same as on fapl_local CALL H5Dget_access_plist_f(dsid, dapl2, error) CALL check("H5Dget_access_plist_f", error, total_error) CALL H5Pget_chunk_cache_f(dapl2, nslots_4, nbytes_4, w0_4, error) @@ -538,7 +529,8 @@ SUBROUTINE test_chunk_cache(cleanup, total_error) IF(w0_2.NE.w0_4)THEN CALL VERIFYlogical("H5Pget_chunk_cache_f", .TRUE., .FALSE., total_error) ENDIF - CALL H5Pclose_f(dapl2,error); CALL check("H5Pclose_f", error, total_error) + CALL H5Pclose_f(dapl2,error) + CALL check("H5Pclose_f", error, total_error) ! Set new values on dapl1. nbytes will be set to default, so the file ! property will override this setting @@ -550,7 +542,7 @@ SUBROUTINE test_chunk_cache(cleanup, total_error) CALL H5Pset_chunk_cache_f(dapl1, nslots_3, nbytes_3, w0_3, error) CALL check("H5Pset_chunk_cache_f", error, total_error) - ! Close dataset, reopen with dapl1. Note the use of a dapl with H5Oopen */ + ! Close dataset, reopen with dapl1. Note the use of a dapl with H5Oopen CALL H5Dclose_f(dsid, error) CALL H5Oopen_f(fid, "dset", dsid, error, dapl1) @@ -569,10 +561,12 @@ SUBROUTINE test_chunk_cache(cleanup, total_error) IF(w0_3.NE.w0_4)THEN CALL VERIFYlogical("H5Pget_chunk_cache_f4", .TRUE., .FALSE., total_error) ENDIF - CALL H5Pclose_f(dapl2,error); CALL check("H5Pclose_f", error, total_error) + CALL H5Pclose_f(dapl2,error) + CALL check("H5Pclose_f", error, total_error) ! Close dataset, reopen with H5P_DEFAULT as dapl - CALL H5Dclose_f(dsid, error); CALL check("H5Dclose_f", error, total_error) + CALL H5Dclose_f(dsid, error) + CALL check("H5Dclose_f", error, total_error) CALL H5Oopen_f(fid, "dset", dsid, error) CALL check("H5Oopen_f", error, total_error) @@ -587,10 +581,12 @@ SUBROUTINE test_chunk_cache(cleanup, total_error) IF(w0_2.NE.w0_4)THEN CALL VERIFYlogical("H5Pget_chunk_cache_f", .TRUE., .FALSE., total_error) ENDIF - CALL H5Pclose_f(dapl2,error); CALL check("H5Pclose_f", error, total_error) + CALL H5Pclose_f(dapl2,error) + CALL check("H5Pclose_f", error, total_error) ! Similary, test use of H5Dcreate2 with H5P_DEFAULT - CALL H5Dclose_f(dsid, error); CALL check("H5Dclose_f", error, total_error) + CALL H5Dclose_f(dsid, error) + CALL check("H5Dclose_f", error, total_error) CALL H5Dcreate_f(fid, "dset2", H5T_NATIVE_INTEGER, sid, dsid, error, dcpl, H5P_DEFAULT_F, H5P_DEFAULT_F) CALL check("H5Pcreate_f", error, total_error) @@ -615,8 +611,10 @@ SUBROUTINE test_chunk_cache(cleanup, total_error) ! Close and reopen file with new fapl_local - CALL H5Dclose_f(dsid, error); CALL check("H5Dclose_f", error, total_error) - CALL H5Fclose_f(fid,error); CALL check("h5fclose_f", error, total_error) + CALL H5Dclose_f(dsid, error) + CALL check("H5Dclose_f", error, total_error) + CALL H5Fclose_f(fid,error) + CALL check("h5fclose_f", error, total_error) CALL H5Fopen_f (fix_filename, H5F_ACC_RDWR_F, fid, error, fapl_local) CALL check("h5fopen_f", error, total_error) @@ -628,7 +626,8 @@ SUBROUTINE test_chunk_cache(cleanup, total_error) CALL h5dopen_f (fid, "dset", dsid, error, dapl2) CALL check("h5dopen_f", error, total_error) - CALL H5Pclose_f(dapl2,error); CALL check("H5Pclose_f", error, total_error) ! Close dapl2, to avoid id leak + CALL H5Pclose_f(dapl2,error) + CALL check("H5Pclose_f", error, total_error) ! Close dapl2, to avoid id leak CALL H5Dget_access_plist_f(dsid, dapl2, error) CALL check("H5Dget_access_plist_f", error, total_error) @@ -647,11 +646,13 @@ SUBROUTINE test_chunk_cache(cleanup, total_error) CALL H5Pset_chunk_cache_f(dapl2, nslots_2, nbytes_2, w0_2, error) CALL check("H5Pset_chunk_cache_f", error, total_error) - CALL H5Dclose_f(dsid, error); CALL check("H5Dclose_f", error, total_error) + CALL H5Dclose_f(dsid, error) + CALL check("H5Dclose_f", error, total_error) CALL h5dopen_f (fid, "dset", dsid, error, dapl2) CALL check("h5dopen_f", error, total_error) - CALL H5Pclose_f(dapl2,error); CALL check("H5Pclose_f", error, total_error) + CALL H5Pclose_f(dapl2,error) + CALL check("H5Pclose_f", error, total_error) CALL H5Dget_access_plist_f(dsid, dapl2, error) CALL check("H5Dget_access_plist_f", error, total_error) @@ -665,17 +666,24 @@ SUBROUTINE test_chunk_cache(cleanup, total_error) ! Close - CALL H5Dclose_f(dsid, error); CALL check("H5Dclose_f", error, total_error) - CALL H5Sclose_f(sid,error); CALL check("H5Sclose_f", error, total_error) - CALL H5Pclose_f(fapl_local,error); CALL check("H5Pclose_f", error, total_error) - CALL H5Pclose_f(fapl_def,error); CALL check("H5Pclose_f", error, total_error) - CALL H5Pclose_f(dapl1,error); CALL check("H5Pclose_f", error, total_error) - CALL H5Pclose_f(dapl2,error); CALL check("H5Pclose_f", error, total_error) - CALL H5Pclose_f(dcpl,error); CALL check("H5Pclose_f", error, total_error) - CALL H5Fclose_f(fid,error); CALL check("H5Fclose_f", error, total_error) + CALL H5Dclose_f(dsid, error) + CALL check("H5Dclose_f", error, total_error) + CALL H5Sclose_f(sid,error) + CALL check("H5Sclose_f", error, total_error) + CALL H5Pclose_f(fapl_local,error) + CALL check("H5Pclose_f", error, total_error) + CALL H5Pclose_f(fapl_def,error) + CALL check("H5Pclose_f", error, total_error) + CALL H5Pclose_f(dapl1,error) + CALL check("H5Pclose_f", error, total_error) + CALL H5Pclose_f(dapl2,error) + CALL check("H5Pclose_f", error, total_error) + CALL H5Pclose_f(dcpl,error) + CALL check("H5Pclose_f", error, total_error) + CALL H5Fclose_f(fid,error) + CALL check("H5Fclose_f", error, total_error) IF(cleanup) CALL h5_cleanup_f(filename, H5P_DEFAULT_F, error) CALL check("h5_cleanup_f", error, total_error) END SUBROUTINE test_chunk_cache - diff --git a/fortran/test/tH5P_F03.f90 b/fortran/test/tH5P_F03.f90 index aec8a26..02ca9dc 100644 --- a/fortran/test/tH5P_F03.f90 +++ b/fortran/test/tH5P_F03.f90 @@ -362,3 +362,144 @@ SUBROUTINE test_genprop_class_callback(total_error) CALL check("h5pclose_class_f", error, total_error) END SUBROUTINE test_genprop_class_callback + +!------------------------------------------------------------------------- +! Function: external_test_offset +! +! Purpose: Tests APIs: +! h5pset_external_f (with offsets not equal to zero), h5pget_external_f +! +! Return: Success: 0 +! Failure: -1 +! +! FORTRAN Programmer: M. Scot Breitenfeld +! January 10, 2012 +!------------------------------------------------------------------------- +! +SUBROUTINE external_test_offset(cleanup,total_error) + + USE ISO_C_BINDING + USE HDF5 ! This module contains all necessary modules + + IMPLICIT NONE + INTEGER, INTENT(OUT) :: total_error + LOGICAL, INTENT(IN) :: cleanup + + INTEGER(hid_t) :: fapl=-1 ! file access property list + INTEGER(hid_t) :: file=-1 ! file to write to + INTEGER(hid_t) :: dcpl=-1 ! dataset creation properties + INTEGER(hid_t) :: space=-1 ! data space + INTEGER(hid_t) :: dset=-1 ! dataset + INTEGER(hid_t) :: grp=-1 ! group to emit diagnostics + INTEGER(size_t) :: i, j ! miscellaneous counters + CHARACTER(LEN=180) :: filename ! file names + INTEGER, DIMENSION(1:25) :: part ! raw data buffers + INTEGER, DIMENSION(1:100), TARGET :: whole ! raw data buffers + INTEGER(hsize_t), DIMENSION(1:1) :: cur_size ! current data space size + INTEGER(hid_t) :: hs_space ! hyperslab data space + INTEGER(hsize_t), DIMENSION(1:1) :: hs_start = (/30/) ! hyperslab starting offset + INTEGER(hsize_t), DIMENSION(1:1) :: hs_count = (/25/) ! hyperslab size + CHARACTER(LEN=1) :: ichr1 ! character conversion holder + INTEGER :: error ! error status + TYPE(C_PTR) :: f_ptr ! fortran pointer + + CHARACTER(LEN=1,KIND=C_CHAR), DIMENSION(1:30) :: temparray + + temparray(1:30)(1:1) = '0' ! 1 byte character + + ! Write the data to external files directly + DO i = 1, 4 + DO j = 1, 25 + part(j) = (i-1)*25+(j-1) + ENDDO + WRITE(ichr1,'(I1.1)') i + filename = "extern_"//ichr1//"a.raw" + OPEN(10, FILE=filename, ACCESS='STREAM', form='UNFORMATTED') + + WRITE(10) temparray(1:(i-1)*10) + WRITE(10) part + CLOSE(10) + ENDDO + ! + ! Create the file and an initial group. + CALL h5pcreate_f(H5P_FILE_ACCESS_F, fapl, error) + CALL h5fcreate_f('extren_raw.h5', H5F_ACC_TRUNC_F, file, error, access_prp=fapl) + CALL check("h5fcreate_f",error,total_error) + + CALL h5gcreate_f(file, "emit-diagnostics", grp, error) + CALL check("h5gcreate_f",error, total_error) + + ! Create the dataset + CALL h5pcreate_f(H5P_DATASET_CREATE_F, dcpl, error) + CALL check("h5pcreate_f", error, total_error) + CALL h5pset_external_f(dcpl, "extern_1a.raw", INT(0,off_t), INT(SIZEOF(part), hsize_t), error) + CALL check("h5pset_external_f",error,total_error) + CALL h5pset_external_f(dcpl, "extern_2a.raw", INT(10,off_t), INT(SIZEOF(part), hsize_t), error) + CALL check("h5pset_external_f",error,total_error) + CALL h5pset_external_f(dcpl, "extern_3a.raw", INT(20,off_t), INT(SIZEOF(part), hsize_t), error) + CALL check("h5pset_external_f",error,total_error) + CALL h5pset_external_f(dcpl, "extern_4a.raw", INT(30,off_t), INT(SIZEOF(part), hsize_t), error) + CALL check("h5pset_external_f",error,total_error) + + cur_size(1) = 100 + CALL h5screate_simple_f(1, cur_size, space, error) + CALL check("h5screate_simple_f", error, total_error) + CALL h5dcreate_f(file, "dset1", H5T_NATIVE_INTEGER, space, dset,error,dcpl_id=dcpl) + CALL check("h5dcreate_f", error, total_error) + + ! + ! Read the entire dataset and compare with the original + whole(:) = 0 + f_ptr = C_LOC(whole(1)) + CALL h5dread_f(dset, H5T_NATIVE_INTEGER, f_ptr, error, mem_space_id=space, file_space_id=space) + CALL check("h5dread_f", error, total_error) + + DO i = 1, 100 + IF(whole(i) .NE. i-1)THEN + WRITE(*,*) "Incorrect value(s) read." + total_error = total_error + 1 + EXIT + ENDIF + ENDDO + ! + ! Read the middle of the dataset + CALL h5scopy_f(space, hs_space, error) + CALL check("h5scopy_f", error, total_error) + CALL h5sselect_hyperslab_f(hs_space, H5S_SELECT_SET_F, hs_start, hs_count, error) + CALL check("h5sselect_hyperslab_f", error, total_error) + + whole(:) = 0 + f_ptr = C_LOC(whole(1)) + CALL h5dread_f(dset, H5T_NATIVE_INTEGER, f_ptr, error, mem_space_id=hs_space, file_space_id=hs_space) + CALL check("h5dread_f", error, total_error) + + CALL h5sclose_f(hs_space, error) + CALL check("h5sclose_f", error, total_error) + DO i = hs_start(1)+1, hs_start(1)+hs_count(1) + IF(whole(i) .NE. i-1)THEN + WRITE(*,*) "Incorrect value(s) read." + total_error = total_error + 1 + EXIT + ENDIF + ENDDO + + CALL h5dclose_f(dset, error) + CALL check("h5dclose_f", error, total_error) + CALL h5pclose_f(dcpl, error) + CALL check("h5pclose_f", error, total_error) + CALL h5sclose_f(space, error) + CALL check("h5sclose_f", error, total_error) + CALL h5fclose_f(file, error) + CALL check("h5fclose_f", error, total_error) + + ! cleanup + DO i = 1, 4 + WRITE(ichr1,'(I1.1)') i + filename = "extern_"//ichr1//"a.raw" + CALL h5_cleanup_f(filename, H5P_DEFAULT_F, error) + CALL check("h5_cleanup_f", error, total_error) + ENDDO + IF(cleanup) CALL h5_cleanup_f("extren_raw.h5", H5P_DEFAULT_F, error) + CALL check("h5_cleanup_f", error, total_error) + +END SUBROUTINE external_test_offset diff --git a/fortran/test/tH5T_F03.f90 b/fortran/test/tH5T_F03.f90 index 1c4da8b..f7efcc4 100644 --- a/fortran/test/tH5T_F03.f90 +++ b/fortran/test/tH5T_F03.f90 @@ -405,7 +405,7 @@ END SUBROUTINE test_array_compound_atomic CALL check("h5tarray_create_f", error, total_error) ! Insert character array field - CALL h5tinsert_f(tid2, "c", H5OFFSETOF(C_LOC(wdata(1,1)),C_LOC(wdata(1,1)%c(1))), tid4, error) + CALL h5tinsert_f(tid2, "c", H5OFFSETOF(C_LOC(wdata(1,1)),C_LOC(wdata(1,1)%c(1)(1:1))), tid4, error) CALL check("h5tinsert2_f", error, total_error) ! Close array of floats field datatype @@ -551,7 +551,7 @@ END SUBROUTINE test_array_compound_atomic CALL H5Tget_member_offset_f(tid2, 2, off, error) CALL check("H5Tget_member_offset_f", error, total_error) CALL VERIFY("H5Tget_member_offset_f",INT(off),& - INT(H5OFFSETOF(C_LOC(wdata(1,1)),C_LOC(wdata(1,1)%c(1)))), total_error) + INT(H5OFFSETOF(C_LOC(wdata(1,1)),C_LOC(wdata(1,1)%c(1)(1:1)))), total_error) ! Check the 3rd field's datatype CALL H5Tget_member_type_f(tid2, 2, mtid2, error) @@ -1028,8 +1028,8 @@ END SUBROUTINE test_array_compound_atomic INTEGER, PARAMETER :: int_kind_8 = SELECTED_INT_KIND(Fortran_INTEGER_4) !should map to INTEGER*4 on most modern processors INTEGER, PARAMETER :: int_kind_16 = SELECTED_INT_KIND(Fortran_INTEGER_8) !should map to INTEGER*8 on most modern processors - INTEGER, PARAMETER :: real_kind_7 = SELECTED_REAL_KIND(Fortran_REAL_4) !should map to REAL*4 on most modern processors - INTEGER, PARAMETER :: real_kind_15 = SELECTED_REAL_KIND(Fortran_REAL_8) !should map to REAL*8 on most modern processors + INTEGER, PARAMETER :: real_kind_7 = SELECTED_REAL_KIND(Fortran_REAL_4) !should map to REAL*4 on most modern processors + INTEGER, PARAMETER :: real_kind_15 = SELECTED_REAL_KIND(Fortran_REAL_8) !should map to REAL*8 on most modern processors CHARACTER(LEN=12), PARAMETER :: filename = "dsetf_F03.h5" ! File name CHARACTER(LEN=5), PARAMETER :: dsetname1 = "dset1" ! Dataset name @@ -1710,7 +1710,7 @@ SUBROUTINE t_opaque(total_error) ! CALL h5dcreate_f(file, dataset, dtype, space, dset, error) CALL check("h5dcreate_f",error, total_error) - f_ptr = C_LOC(wdata(1)) + f_ptr = C_LOC(wdata(1)(1:1)) CALL h5dwrite_f(dset, dtype, f_ptr, error) CALL check("h5dwrite_f",error, total_error) ! @@ -1774,7 +1774,7 @@ SUBROUTINE t_opaque(total_error) ! ! Read the data. ! - f_ptr = C_LOC(rdata(1)) + f_ptr = C_LOC(rdata(1)(1:1)) CALL h5dread_f(dset, dtype, f_ptr, error) CALL check("H5Dread_f",error, total_error) ! @@ -2123,7 +2123,7 @@ SUBROUTINE t_regref(total_error) CALL h5screate_simple_f(1, dims3, memspace, error) CALL check("h5screate_simple_f",error, total_error) - f_ptr = C_LOC(rdata2(1)) + f_ptr = C_LOC(rdata2(1)(1:1)) CALL h5dread_f( dset2, H5T_NATIVE_INTEGER_1, f_ptr, error, memspace, space) CALL check("H5Dread_f",error, total_error) CALL verifystring("h5dread_f",rdata2(1)(1:npoints),TRIM(chrref_correct(i)), total_error) @@ -2473,24 +2473,24 @@ SUBROUTINE t_vlstring_readwrite(total_error) ! Initialize array of C pointers - wdata(1) = C_LOC(A(1)) - wdata(2) = C_LOC(B(1)) - wdata(3) = C_LOC(C(1)) - wdata(4) = C_LOC(D(1)) + wdata(1) = C_LOC(A(1)(1:1)) + wdata(2) = C_LOC(B(1)(1:1)) + wdata(3) = C_LOC(C(1)(1:1)) + wdata(4) = C_LOC(D(1)(1:1)) data_w(1) = A(1) data_w(2) = B(1) data_w(3) = C(1) data_w(4) = D(1) - wdata2D(1,1) = C_LOC(A11(1)) - wdata2D(1,2) = C_LOC(A12(1)) - wdata2D(1,3) = C_LOC(A13(1)) - wdata2D(1,4) = C_LOC(A14(1)) - wdata2D(2,1) = C_LOC(A21(1)) - wdata2D(2,2) = C_LOC(A22(1)) - wdata2D(2,3) = C_LOC(A23(1)) - wdata2D(2,4) = C_LOC(A24(1)) + wdata2D(1,1) = C_LOC(A11(1)(1:1)) + wdata2D(1,2) = C_LOC(A12(1)(1:1)) + wdata2D(1,3) = C_LOC(A13(1)(1:1)) + wdata2D(1,4) = C_LOC(A14(1)(1:1)) + wdata2D(2,1) = C_LOC(A21(1)(1:1)) + wdata2D(2,2) = C_LOC(A22(1)(1:1)) + wdata2D(2,3) = C_LOC(A23(1)(1:1)) + wdata2D(2,4) = C_LOC(A24(1)(1:1)) data2D_w(1,1) = A11(1) data2D_w(1,2) = A12(1) @@ -3092,3 +3092,350 @@ SUBROUTINE test_nbit(cleanup, total_error ) END SUBROUTINE test_nbit +SUBROUTINE t_enum_conv(total_error) + +!------------------------------------------------------------------------- +! Subroutine: t_enum_conv +! +! Purpose: Tests converting data from enumeration datatype +! to numeric (integer or floating-point number) +! datatype. Tests various KINDs of INTEGERs +! and REALs. Checks reading enum data into +! INTEGER and REAL KINDs. +! +! Return: Success: 0 +! Failure: number of errors +! +! Programmer: M. Scot Breitenfeld +! October 27, 2012 +! +! Note: Adapted from C test (enum.c -- test_conv) +! No reliance on C tests. +!------------------------------------------------------------------------- +! + USE HDF5 + USE ISO_C_BINDING + + IMPLICIT NONE + + INTEGER, INTENT(INOUT) :: total_error + + INTEGER, PARAMETER :: int_kind_8 = SELECTED_INT_KIND(Fortran_INTEGER_4) !should map to INTEGER*4 on most modern processors + INTEGER, PARAMETER :: int_kind_16 = SELECTED_INT_KIND(Fortran_INTEGER_8)!should map to INTEGER*8 on most modern processors + + INTEGER, PARAMETER :: real_kind_7 = SELECTED_REAL_KIND(Fortran_REAL_4) !should map to REAL*4 on most modern processors + + INTEGER(hid_t) :: cwg=-1, dtype=-1, space=-1, dset=-1, memtype ! Handles + INTEGER(hid_t) :: file ! Handles + + ! Enumerated type + ENUM, BIND(C) + ENUMERATOR :: E1_RED, E1_GREEN, E1_BLUE, E1_WHITE, E1_BLACK + END ENUM + + INTEGER :: val + + ! Enumerated data array + ! Some values are out of range for testing. The library should accept them + INTEGER(KIND(E1_RED)), DIMENSION(1:20), TARGET :: data1 = (/E1_RED, E1_GREEN, E1_BLUE, E1_GREEN, E1_WHITE,& + E1_WHITE, E1_BLACK, E1_GREEN, E1_BLUE, E1_RED,& + E1_RED, E1_BLUE, E1_GREEN, E1_BLACK, E1_WHITE,& + E1_RED, E1_WHITE, INT(0,KIND(E1_RED)), INT(-1,KIND(E1_RED)), INT(-2,KIND(E1_RED))/) + + ! Reading array for enum data + INTEGER(KIND(E1_RED)), DIMENSION(1:20), TARGET :: data2 + + ! Reading array's for converted enum data + INTEGER(C_SHORT), DIMENSION(1:20), TARGET :: data_short + INTEGER(C_INT), DIMENSION(1:20), TARGET :: data_int + REAL(C_DOUBLE), DIMENSION(1:20), TARGET :: data_double + + INTEGER(int_kind_8), DIMENSION(1:20), TARGET :: data_i8 + INTEGER(int_kind_16), DIMENSION(1:20), TARGET :: data_i16 + REAL(real_kind_7), DIMENSION(1:20), TARGET :: data_r7 + + INTEGER(hsize_t), DIMENSION(1:1) :: ds_size = (/20/) + INTEGER(size_t) :: i + INTEGER :: error + TYPE(C_PTR) :: f_ptr + INTEGER(HID_T) :: m_baset ! Memory base type + ! + ! Create a new file using the default properties. + ! + CALL h5fcreate_f("enum1.h5", H5F_ACC_TRUNC_F, file, error) + CALL check("h5fcreate_f", error, total_error) + ! + ! Create a new group using the default properties. + ! + CALL h5gcreate_f(file, "test_conv", cwg, error) + CALL check("h5gcreate_f",error, total_error) + ! + ! Create a enum type + ! + CALL H5Tcreate_f(H5T_ENUM_F, H5OFFSETOF(C_LOC(data1(1)), C_LOC(data1(2))), dtype, error) + CALL check("h5tcreate_f",error, total_error) + ! + ! Initialize enum data. + ! + val = E1_RED + CALL H5Tenum_insert_f(dtype, "RED", val, error) + CALL check("h5tenum_insert_f",error, total_error) + val = E1_GREEN + CALL H5Tenum_insert_f(dtype, "GREEN", val, error) + CALL check("h5tenum_insert_f",error, total_error) + val = E1_BLUE + CALL H5Tenum_insert_f(dtype, "BLUE", val, error) + CALL check("h5tenum_insert_f",error, total_error) + val = E1_WHITE + CALL H5Tenum_insert_f(dtype, "WHITE", val, error) + CALL check("h5tenum_insert_f",error, total_error) + val = E1_BLACK + CALL H5Tenum_insert_f(dtype, "BLACK", val, error) + CALL check("h5tenum_insert_f",error, total_error) + ! + ! Create dataspace. Setting maximum size to be the current size. + ! + CALL h5screate_simple_f(1, ds_size, space, error) + CALL check("h5screate_simple_f", error, total_error) + + ! *************************************** + ! * Dataset of enumeration type + ! *************************************** + ! + ! Create a dataset of enum type and write enum data to it + + CALL h5dcreate_f(cwg, "color_table1", dtype, space, dset, error) + CALL check("h5dcreate_f", error, total_error) + + f_ptr = C_LOC(data1(1)) + CALL h5dwrite_f(dset, dtype, f_ptr, error, space, space) + CALL check(" h5dwrite_f", error, total_error) + + ! Test reading back the data with no conversion + + f_ptr = C_LOC(data2(1)) + CALL h5dread_f(dset, dtype, f_ptr, error, space, space) + CALL check(" h5dread_f", error, total_error) + + ! Check values + DO i = 1, ds_size(1) + IF(data1(i) .NE. data2(i))THEN + total_error = total_error + 1 + WRITE(*,'(" 1. data1(",I0,")=",I0," .NE. data2(",I0,")=",I0)') i, data1(i),i,data2(i) + EXIT + ENDIF + ENDDO + + ! Test converting the data to integer (KIND=C_SHORT). Read enum data back as integer + m_baset = h5kind_to_type(KIND(data_short(1)), H5_INTEGER_KIND) ! Memory base type + f_ptr = C_LOC(data_short(1)) + CALL h5dread_f(dset, m_baset, f_ptr, error, space, space) + CALL check("h5dread_f", error, total_error) + ! Check values + DO i = 1, ds_size(1) + IF(data1(i) .NE. data_short(i))THEN + total_error = total_error + 1 + WRITE(*,'(" 2. data1(",I0,")=",I0," .NE. data_short(",I0,")=",I0)') i, data1(i),i,data_short(i) + EXIT + ENDIF + ENDDO + + ! Test converting the data to (KIND=C_double) number. + ! Read enum data back as (KIND=C_double) number + + m_baset = h5kind_to_type(KIND(data_double(1)), H5_REAL_KIND) ! Memory base type + f_ptr = C_LOC(data_double(1)) + CALL h5dread_f(dset, m_baset, f_ptr, error, space, space) + CALL check("h5dread_f", error, total_error) + ! Check values + DO i = 1, ds_size(1) + IF(data1(i) .NE. INT(data_double(i)))THEN + total_error = total_error + 1 + WRITE(*,'(" 3. data_double(",I0,")=",I0," .NE. data_double(",I0,")=",I0)') & + i, INT(data1(i)), i, INT(data_double(i)) + EXIT + ENDIF + ENDDO + + ! Test converting the data to (SELECTED_INT_KIND(Fortran_INTEGER_4)) number. + ! Read enum data back as (SELECTED_INT_KIND(Fortran_INTEGER_4)) number + + m_baset = h5kind_to_type(int_kind_8, H5_INTEGER_KIND) ! Memory base type + f_ptr = C_LOC(data_i8(1)) + CALL h5dread_f(dset, m_baset, f_ptr, error, space, space) + CALL check("h5dread_f", error, total_error) + ! Check values + DO i = 1, ds_size(1) + IF(data1(i) .NE. INT(data_i8(i)))THEN + total_error = total_error + 1 + WRITE(*,'(" 4. data_i8(",I0,")=",I0," .NE. data_i8(",I0,")=",I0)') & + i, INT(data1(i)), i, INT(data_i8(i)) + EXIT + ENDIF + ENDDO + + ! Test converting the data to (SELECTED_INT_KIND(Fortran_INTEGER_8)) number. + ! Read enum data back as (SELECTED_INT_KIND(Fortran_INTEGER_8)) number + + m_baset = h5kind_to_type(int_kind_16, H5_INTEGER_KIND) ! Memory base type + f_ptr = C_LOC(data_i16(1)) + CALL h5dread_f(dset, m_baset, f_ptr, error, space, space) + CALL check("h5dread_f", error, total_error) + ! Check values + DO i = 1, ds_size(1) + IF(data1(i) .NE. INT(data_i16(i)))THEN + total_error = total_error + 1 + WRITE(*,'(" 5. data_i16(",I0,")=",I0," .NE. data_i16(",I0,")=",I0)') & + i, INT(data1(i)), i, INT(data_i16(i)) + EXIT + ENDIF + ENDDO + + ! Test converting the data to SELECTED_REAL_KIND(Fortran_REAL_4) number. + ! Read enum data back as SELECTED_REAL_KIND(Fortran_REAL_4) number + + m_baset = h5kind_to_type(KIND(data_r7(1)), H5_REAL_KIND) ! Memory base type + f_ptr = C_LOC(data_r7(1)) + CALL h5dread_f(dset, m_baset, f_ptr, error, space, space) + CALL check("h5dread_f", error, total_error) + ! Check values + DO i = 1, ds_size(1) + IF(data1(i) .NE. INT(data_r7(i)))THEN + total_error = total_error + 1 + WRITE(*,'(" 6. data_r7(",I0,")=",I0," .NE. data_r7(",I0,")=",I0)') & + i, INT(data1(i)), i, INT(data_r7(i)) + EXIT + ENDIF + ENDDO + + CALL h5dclose_f(dset, error) + CALL check("h5dclose_f", error, total_error) + + ! *************************************** + ! * Dataset of C_int type + ! *************************************** + + ! Create a integer dataset of KIND=C_INT and write enum data to it + m_baset = h5kind_to_type(KIND(data_int(1)), H5_INTEGER_KIND) ! Memory base type + CALL h5dcreate_f(cwg, "color_table2", m_baset, space, dset, error) + CALL check("h5dcreate_f", error, total_error) + + ! Write the enum data + f_ptr = C_LOC(data1(1)) + CALL h5dwrite_f(dset, dtype, f_ptr, error, space, space) + CALL check("h5dwrite_f", error, total_error) + + ! Test reading back the data with no conversion + f_ptr = C_LOC(data_int(1)) + CALL h5dread_f(dset, m_baset, f_ptr, error, space, space) + CALL check("h5dread_f", error, total_error) + + DO i = 1, ds_size(1) + IF(data1(i) .NE. data_int(i))THEN + total_error = total_error + 1 + WRITE(*,'(" 7. data1(",I0,")=",I0," .NE. data_int(",I0,")=",I0)') i, data1(i),i,data_int(i) + EXIT + ENDIF + ENDDO + CALL h5dclose_f(dset, error) + CALL check("h5dclose_f", error, total_error) + + !************************************** + !* Dataset of C_double type + !************************************** + + ! Create a dataset of KIND=C_DOUBLE and write enum data to it + m_baset = h5kind_to_type(KIND(data_double(1)), H5_REAL_KIND) ! Memory base type + CALL h5dcreate_f(cwg, "color_table3", m_baset, space, dset, error) + CALL check("h5dcreate_f", error, total_error) + + f_ptr = C_LOC(data1(1)) + CALL h5dwrite_f(dset, dtype, f_ptr, error, space, space) + CALL check("h5dwrite_f", error, total_error) + + ! Test reading back the data with no conversion + f_ptr = C_LOC(data_double(1)) + CALL h5dread_f(dset, m_baset, f_ptr, error, space, space) + CALL check("h5dread_f", error, total_error) + + DO i = 1, ds_size(1) + IF(data1(i) .NE. INT(data_double(i)))THEN + total_error = total_error + 1 + WRITE(*,'(" 8. data1(",I0,")=",I0," .NE. data_double(",I0,")=",I0)') i, data1(i),i,INT(data_double(i)) + EXIT + ENDIF + ENDDO + CALL h5dclose_f(dset, error) + CALL check("h5dclose_f", error, total_error) + + !********************************************************* + !* Dataset of real SELECTED_REAL_KIND(Fortran_REAL_4) type + !********************************************************* + + ! Create a dataset of SELECTED_REAL_KIND(Fortran_REAL_4) and write enum data to it + m_baset = h5kind_to_type(KIND(data_r7(1)), H5_REAL_KIND) ! Memory base type + CALL h5dcreate_f(cwg, "color_table4", m_baset, space, dset, error) + CALL check("h5dcreate_f", error, total_error) + + f_ptr = C_LOC(data1(1)) + CALL h5dwrite_f(dset, dtype, f_ptr, error, space, space) + CALL check("h5dwrite_f", error, total_error) + + ! Test reading back the data with no conversion + f_ptr = C_LOC(data_r7(1)) + CALL h5dread_f(dset, m_baset, f_ptr, error, space, space) + CALL check("h5dread_f", error, total_error) + + DO i = 1, ds_size(1) + IF(data1(i) .NE. INT(data_r7(i)))THEN + total_error = total_error + 1 + WRITE(*,'(" 9. data1(",I0,")=",I0," .NE. data_r7(",I0,")=",I0)') i, data1(i),i,INT(data_r7(i)) + EXIT + ENDIF + ENDDO + CALL h5dclose_f(dset, error) + CALL check("h5dclose_f", error, total_error) + + ! ***************************************************************** + ! * Dataset of integer SELECTED_INT_KIND(Fortran_INTEGER_8) type + ! ***************************************************************** + + ! Create a integer dataset of (SELECTED_INT_KIND(Fortran_INTEGER_8)) and write enum data to it + m_baset = h5kind_to_type(KIND(data_i16(1)), H5_INTEGER_KIND) ! Memory base type + CALL h5dcreate_f(cwg, "color_table5", m_baset, space, dset, error) + CALL check("h5dcreate_f", error, total_error) + + ! Write the enum data + f_ptr = C_LOC(data1(1)) + CALL h5dwrite_f(dset, dtype, f_ptr, error, space, space) + CALL check("h5dwrite_f", error, total_error) + + ! Test reading back the data with no conversion + f_ptr = C_LOC(data_i16(1)) + CALL h5dread_f(dset, m_baset, f_ptr, error, space, space) + CALL check("h5dread_f", error, total_error) + + DO i = 1, ds_size(1) + IF(data1(i) .NE. data_i16(i))THEN + total_error = total_error + 1 + WRITE(*,'(" 10. data1(",I0,")=",I0," .NE. data_i16(",I0,")=",I0)') i, data1(i),i,data_i16(i) + EXIT + ENDIF + ENDDO + CALL h5dclose_f(dset, error) + CALL check("h5dclose_f", error, total_error) + + ! + ! Close and release resources. + ! + CALL h5sclose_f(space, error) + CALL check("H5Sclose_f", error, total_error) + CALL h5tclose_f(dtype, error) + CALL check("H5Tclose_f", error, total_error) + CALL h5gclose_f(cwg, error) + CALL check("h5gclose_f",error, total_error) + CALL h5fclose_f(file, error) + CALL check("H5Fclose_f", error, total_error) + +END SUBROUTINE t_enum_conv + diff --git a/fortran/testpar/CMakeLists.txt b/fortran/testpar/CMakeLists.txt index b112db3..1c7248c 100644 --- a/fortran/testpar/CMakeLists.txt +++ b/fortran/testpar/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.6) +cmake_minimum_required (VERSION 2.8.10) PROJECT (HDF5_FORTRAN_TESTPAR C CXX Fortran) #----------------------------------------------------------------------------- diff --git a/fortran/testpar/Makefile.in b/fortran/testpar/Makefile.in index 1cbc87e..9a93367 100644 --- a/fortran/testpar/Makefile.in +++ b/fortran/testpar/Makefile.in @@ -229,6 +229,7 @@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ +HAVE_PTHREAD = @HAVE_PTHREAD@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF_CXX = @HDF_CXX@ @@ -280,7 +281,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PARALLEL = @PARALLEL@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ -PTHREAD = @PTHREAD@ RANLIB = @RANLIB@ ROOT = @ROOT@ RUNPARALLEL = @RUNPARALLEL@ diff --git a/hl/CMakeLists.txt b/hl/CMakeLists.txt index e66329e..5c9403d 100644 --- a/hl/CMakeLists.txt +++ b/hl/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.6) +cmake_minimum_required (VERSION 2.8.10) PROJECT (HDF5_HL C CXX) #----------------------------------------------------------------------------- diff --git a/hl/Makefile.in b/hl/Makefile.in index dddd693..786bfba 100644 --- a/hl/Makefile.in +++ b/hl/Makefile.in @@ -231,6 +231,7 @@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ +HAVE_PTHREAD = @HAVE_PTHREAD@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF_CXX = @HDF_CXX@ @@ -282,7 +283,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PARALLEL = @PARALLEL@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ -PTHREAD = @PTHREAD@ RANLIB = @RANLIB@ ROOT = @ROOT@ RUNPARALLEL = @RUNPARALLEL@ diff --git a/hl/c++/CMakeLists.txt b/hl/c++/CMakeLists.txt index 3601a91..8d68dd0 100644 --- a/hl/c++/CMakeLists.txt +++ b/hl/c++/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.6) +cmake_minimum_required (VERSION 2.8.10) PROJECT (HDF5_HL_CPP) #----------------------------------------------------------------------------- diff --git a/hl/c++/Makefile.in b/hl/c++/Makefile.in index 4a33b33..60baefe 100644 --- a/hl/c++/Makefile.in +++ b/hl/c++/Makefile.in @@ -227,6 +227,7 @@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ +HAVE_PTHREAD = @HAVE_PTHREAD@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF_CXX = @HDF_CXX@ @@ -278,7 +279,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PARALLEL = @PARALLEL@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ -PTHREAD = @PTHREAD@ RANLIB = @RANLIB@ ROOT = @ROOT@ RUNPARALLEL = @RUNPARALLEL@ diff --git a/hl/c++/examples/CMakeLists.txt b/hl/c++/examples/CMakeLists.txt index 3034a78..4c60165 100644 --- a/hl/c++/examples/CMakeLists.txt +++ b/hl/c++/examples/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.6) +cmake_minimum_required (VERSION 2.8.10) PROJECT (HDF5_HL_CPP_EXAMPLES) #----------------------------------------------------------------------------- @@ -20,17 +20,6 @@ TARGET_LINK_LIBRARIES ( ) SET_TARGET_PROPERTIES (ptExampleFL PROPERTIES FOLDER examples/hl/cpp) -ADD_EXECUTABLE (ptExampleVL ${HDF5_HL_CPP_EXAMPLES_SOURCE_DIR}/ptExampleVL.cpp) -TARGET_NAMING (ptExampleVL ${LIB_TYPE}) -TARGET_LINK_LIBRARIES ( - ptExampleVL - ${HDF5_HL_CPP_LIB_TARGET} - ${HDF5_HL_LIB_TARGET} - ${HDF5_LIB_TARGET} -) -SET_TARGET_PROPERTIES (ptExampleVL PROPERTIES FOLDER examples/hl/cpp) - IF (BUILD_TESTING) ADD_TEST (NAME cpp_hl_ex_ptExampleFL COMMAND $) - ADD_TEST (NAME cpp_hl_ex_ptExampleVL COMMAND $) ENDIF (BUILD_TESTING) diff --git a/hl/c++/examples/Makefile.am b/hl/c++/examples/Makefile.am index 5dd5a75..df15257 100644 --- a/hl/c++/examples/Makefile.am +++ b/hl/c++/examples/Makefile.am @@ -23,10 +23,10 @@ include $(top_srcdir)/config/commence.am # These are the programs that 'make all' or 'make prog' will build and # which 'make check' will run. List them in the order they should be run. -EXAMPLE_PROG=ptExampleFL ptExampleVL +EXAMPLE_PROG=ptExampleFL # These are the example files to be installed -INSTALL_FILES=ptExampleFL.cpp ptExampleVL.cpp +INSTALL_FILES=ptExampleFL.cpp INSTALL_SCRIPT_FILES = run-hlc++-ex.sh # Tell conclude.am that these are C++ tests. @@ -45,7 +45,6 @@ $(EXTRA_PROG): $(H5CPP) # will try to build them with the normal C++ compiler, not h5c++. This is # an inelegant way of solving the problem, unfortunately. ptExampleFL: ptExampleFL.cpp -ptExampleVL: ptExampleVL.cpp include $(top_srcdir)/config/examples.am include $(top_srcdir)/config/conclude.am diff --git a/hl/c++/examples/Makefile.in b/hl/c++/examples/Makefile.in index bd0edf0..8297d0a 100644 --- a/hl/c++/examples/Makefile.in +++ b/hl/c++/examples/Makefile.in @@ -193,6 +193,7 @@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ +HAVE_PTHREAD = @HAVE_PTHREAD@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF_CXX = @HDF_CXX@ @@ -244,7 +245,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PARALLEL = @PARALLEL@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ -PTHREAD = @PTHREAD@ RANLIB = @RANLIB@ ROOT = @ROOT@ RUNPARALLEL = @RUNPARALLEL@ @@ -390,10 +390,10 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog *.h5 # These are the programs that 'make all' or 'make prog' will build and # which 'make check' will run. List them in the order they should be run. -EXAMPLE_PROG = ptExampleFL ptExampleVL +EXAMPLE_PROG = ptExampleFL # These are the example files to be installed -INSTALL_FILES = ptExampleFL.cpp ptExampleVL.cpp +INSTALL_FILES = ptExampleFL.cpp INSTALL_SCRIPT_FILES = run-hlc++-ex.sh # Tell conclude.am that these are C++ tests. @@ -651,7 +651,6 @@ $(EXTRA_PROG): $(H5CPP) # will try to build them with the normal C++ compiler, not h5c++. This is # an inelegant way of solving the problem, unfortunately. ptExampleFL: ptExampleFL.cpp -ptExampleVL: ptExampleVL.cpp # How to create EXAMPLEDIR if it doesn't already exist $(EXAMPLEDIR): diff --git a/hl/c++/examples/ptExampleVL.cpp b/hl/c++/examples/ptExampleVL.cpp deleted file mode 100644 index c3feccd..0000000 --- a/hl/c++/examples/ptExampleVL.cpp +++ /dev/null @@ -1,112 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * 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 "H5PacketTable.h" - -/*------------------------------------------------------------------------- - * Packet Table Variable-Length Example - * - * Example program that creates a packet table and performs - * writes and reads. - * - *------------------------------------------------------------------------- - */ - -int main(void) -{ -#ifdef VLPT_REMOVED - herr_t err; /* Return value from function calls */ - hid_t fileID; /* HDF5 identifier for file */ - hsize_t count; /* Number of records in table */ - int x; /* Loop variable */ - - /* This example has two different sizes of "record": longs and shorts */ - long longBuffer[5]; - short shortBuffer[5]; - - /* Buffer of hvl_t structs to read back records */ - hvl_t readBuffer[5]; - - /* Initialize buffers */ - for(x=0; x<5; x++) - { - longBuffer[x] = -x; - shortBuffer[x] = x; - } - - /* Create a new HDF5 file */ - fileID = H5Fcreate("PTcppexampleVL.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - if(fileID <0) - fprintf(stderr, "Couldn't create file.\n"); - - /* Create a variable-length packet table. */ - VL_PacketTable ptable(fileID, "/examplePacketTable", 1); - - if(! ptable.IsValid()) - fprintf(stderr, "Unable to create packet table."); - - /* Append five packets to the packet table. */ - /* In C++, there is no need to package data into hvl_t structs. */ - err = ptable.AppendPacket( &(longBuffer[0]), sizeof(long)); - if(err < 0) - fprintf(stderr, "Error adding record."); - err = ptable.AppendPacket( &(shortBuffer[1]), sizeof(short)); - if(err < 0) - fprintf(stderr, "Error adding record."); - err = ptable.AppendPacket( &(longBuffer[2]), sizeof(long)); - if(err < 0) - fprintf(stderr, "Error adding record."); - err = ptable.AppendPacket( &(longBuffer[3]), sizeof(long)); - if(err < 0) - fprintf(stderr, "Error adding record."); - err = ptable.AppendPacket( &(shortBuffer[4]), sizeof(short)); - if(err < 0) - fprintf(stderr, "Error adding record."); - - /* Get the number of packets in the packet table. This should be five. */ - count = ptable.GetPacketCount(err); - if(err < 0) - fprintf(stderr, "Error getting packet count."); - - printf("Number of packets in packet table after five appends: %d\n", count); - - /* Initialize packet table's "current record" */ - ptable.ResetIndex(); - - /* Iterate through packets, read each one back */ - for(x=0; x<5; x++) - { - err = ptable.GetNextPacket( &(readBuffer[x]) ); - if(err < 0) - fprintf(stderr, "Error reading record."); - - printf("Packet %d's length is %d.\n", x, readBuffer[x].len); - if(readBuffer[x].len == sizeof(long)) - printf("Packet %d's value is %d.\n", x, *((long *) readBuffer[x].p) ); - else - printf("Packet %d's value is %d.\n", x, *((short *) readBuffer[x].p) ); - } - - /* The packet table will close automatically when its object goes */ - /* out of scope. */ - - err = H5Fclose(fileID); - if( err < 0 ) - fprintf(stderr, "Failed to close file.\n"); - -#endif /* VLPT_REMOVED */ - return 0; -} - diff --git a/hl/c++/examples/run-hlc++-ex.sh.in b/hl/c++/examples/run-hlc++-ex.sh.in index 7742f99..103dd76 100644 --- a/hl/c++/examples/run-hlc++-ex.sh.in +++ b/hl/c++/examples/run-hlc++-ex.sh.in @@ -64,9 +64,7 @@ RunTest() if [ $? -eq 0 ] then if (RunTest ptExampleFL &&\ - rm ptExampleFL &&\ - RunTest ptExampleVL &&\ - rm ptExampleVL); then + rm ptExampleFL); then EXIT_VALUE=${EXIT_SUCCESS} else EXIT_VALUE=${EXIT_FAILURE} diff --git a/hl/c++/src/CMakeLists.txt b/hl/c++/src/CMakeLists.txt index e0ca0e9..5a2a7c4 100644 --- a/hl/c++/src/CMakeLists.txt +++ b/hl/c++/src/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.6) +cmake_minimum_required (VERSION 2.8.10) PROJECT (HDF5_HL_CPP_SRC) #----------------------------------------------------------------------------- diff --git a/hl/c++/src/Makefile.in b/hl/c++/src/Makefile.in index 7943459..89aee46 100644 --- a/hl/c++/src/Makefile.in +++ b/hl/c++/src/Makefile.in @@ -260,6 +260,7 @@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ +HAVE_PTHREAD = @HAVE_PTHREAD@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF_CXX = @HDF_CXX@ @@ -311,7 +312,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PARALLEL = @PARALLEL@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ -PTHREAD = @PTHREAD@ RANLIB = @RANLIB@ ROOT = @ROOT@ RUNPARALLEL = @RUNPARALLEL@ @@ -458,7 +458,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 127 +LT_VERS_REVISION = 138 LT_VERS_AGE = 0 # Include src directory diff --git a/hl/c++/test/CMakeLists.txt b/hl/c++/test/CMakeLists.txt index 7d29035..0f82748 100644 --- a/hl/c++/test/CMakeLists.txt +++ b/hl/c++/test/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.6) +cmake_minimum_required (VERSION 2.8.10) PROJECT (HDF5_HL_CPP_TEST) #----------------------------------------------------------------------------- diff --git a/hl/c++/test/Makefile.in b/hl/c++/test/Makefile.in index 0213f38..f8ad89b 100644 --- a/hl/c++/test/Makefile.in +++ b/hl/c++/test/Makefile.in @@ -226,6 +226,7 @@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ +HAVE_PTHREAD = @HAVE_PTHREAD@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF_CXX = @HDF_CXX@ @@ -277,7 +278,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PARALLEL = @PARALLEL@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ -PTHREAD = @PTHREAD@ RANLIB = @RANLIB@ ROOT = @ROOT@ RUNPARALLEL = @RUNPARALLEL@ diff --git a/hl/examples/CMakeLists.txt b/hl/examples/CMakeLists.txt index c95322c..1f4807a 100644 --- a/hl/examples/CMakeLists.txt +++ b/hl/examples/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.6) +cmake_minimum_required (VERSION 2.8.10) PROJECT (HDF5_HL_EXAMPLES ) SET (HDF5_TEST_FILES @@ -23,7 +23,6 @@ SET (examples ex_lite2 ex_lite3 ptExampleFL - ptExampleVL ex_image1 ex_image2 ex_table_01 diff --git a/hl/examples/Makefile.am b/hl/examples/Makefile.am index 1c51f05..5108c5e 100644 --- a/hl/examples/Makefile.am +++ b/hl/examples/Makefile.am @@ -34,7 +34,7 @@ EXAMPLETOPDIR=${DESTDIR}$(exec_prefix)/share/hdf5_examples/hl # Don't tell automake about them, because if it knew they were programs, # it would try to compile them instead of using the h5cc script. # Use the boilerplate in config/examples.am instead. -EXAMPLE_PROG = ex_lite1 ex_lite2 ex_lite3 ptExampleFL ptExampleVL \ +EXAMPLE_PROG = ex_lite1 ex_lite2 ex_lite3 ptExampleFL \ ex_image1 ex_image2 \ ex_table_01 ex_table_02 ex_table_03 ex_table_04 \ ex_table_05 ex_table_06 ex_table_07 ex_table_08 \ @@ -43,7 +43,7 @@ EXAMPLE_PROG = ex_lite1 ex_lite2 ex_lite3 ptExampleFL ptExampleVL \ # Install files # List all file that should be installed in examples directory -INSTALL_FILES = ex_lite1.c ex_lite2.c ex_lite3.c ptExampleFL.c ptExampleVL.c \ +INSTALL_FILES = ex_lite1.c ex_lite2.c ex_lite3.c ptExampleFL.c \ ex_image1.c ex_image2.c \ ex_table_01.c ex_table_02.c ex_table_03.c ex_table_04.c \ ex_table_05.c ex_table_06.c ex_table_07.c ex_table_08.c \ @@ -75,7 +75,6 @@ ex_lite1: $(srcdir)/ex_lite1.c ex_lite2: $(srcdir)/ex_lite2.c ex_lite3: $(srcdir)/ex_lite3.c ptExampleFL: $(srcdir)/ptExampleFL.c -ptExampleVL: $(srcdir)/ptExampleVL.c ex_image1: $(srcdir)/ex_image1.c ex_image2: $(srcdir)/ex_image2.c ex_table01: $(srcdir)/ex_table01.c diff --git a/hl/examples/Makefile.in b/hl/examples/Makefile.in index 1794e38..2713377 100644 --- a/hl/examples/Makefile.in +++ b/hl/examples/Makefile.in @@ -193,6 +193,7 @@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ +HAVE_PTHREAD = @HAVE_PTHREAD@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF_CXX = @HDF_CXX@ @@ -244,7 +245,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PARALLEL = @PARALLEL@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ -PTHREAD = @PTHREAD@ RANLIB = @RANLIB@ ROOT = @ROOT@ RUNPARALLEL = @RUNPARALLEL@ @@ -398,7 +398,7 @@ EXAMPLETOPDIR = ${DESTDIR}$(exec_prefix)/share/hdf5_examples/hl # Don't tell automake about them, because if it knew they were programs, # it would try to compile them instead of using the h5cc script. # Use the boilerplate in config/examples.am instead. -EXAMPLE_PROG = ex_lite1 ex_lite2 ex_lite3 ptExampleFL ptExampleVL \ +EXAMPLE_PROG = ex_lite1 ex_lite2 ex_lite3 ptExampleFL \ ex_image1 ex_image2 \ ex_table_01 ex_table_02 ex_table_03 ex_table_04 \ ex_table_05 ex_table_06 ex_table_07 ex_table_08 \ @@ -408,7 +408,7 @@ EXAMPLE_PROG = ex_lite1 ex_lite2 ex_lite3 ptExampleFL ptExampleVL \ # Install files # List all file that should be installed in examples directory -INSTALL_FILES = ex_lite1.c ex_lite2.c ex_lite3.c ptExampleFL.c ptExampleVL.c \ +INSTALL_FILES = ex_lite1.c ex_lite2.c ex_lite3.c ptExampleFL.c \ ex_image1.c ex_image2.c \ ex_table_01.c ex_table_02.c ex_table_03.c ex_table_04.c \ ex_table_05.c ex_table_06.c ex_table_07.c ex_table_08.c \ @@ -677,7 +677,6 @@ ex_lite1: $(srcdir)/ex_lite1.c ex_lite2: $(srcdir)/ex_lite2.c ex_lite3: $(srcdir)/ex_lite3.c ptExampleFL: $(srcdir)/ptExampleFL.c -ptExampleVL: $(srcdir)/ptExampleVL.c ex_image1: $(srcdir)/ex_image1.c ex_image2: $(srcdir)/ex_image2.c ex_table01: $(srcdir)/ex_table01.c diff --git a/hl/examples/ptExampleVL.c b/hl/examples/ptExampleVL.c deleted file mode 100644 index 310aa07..0000000 --- a/hl/examples/ptExampleVL.c +++ /dev/null @@ -1,126 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * 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 "hdf5_hl.h" -#include - -/*------------------------------------------------------------------------- - * Packet Table Variable-Length Example - * - * Example program that creates a variable-length packet table and performs - * writes and reads. - * - *------------------------------------------------------------------------- - */ - -int main(void) -{ -#ifdef VLPT_REMOVED - hid_t fid; /* File identifier */ - hid_t ptable; /* Packet table identifier */ - - herr_t err; /* Function return status */ - hsize_t count; /* Number of records in the table */ - int x; /* Loop variable */ - - /* Buffers to hold data */ - hvl_t writeBuffer[5]; - hvl_t readBuffer[5]; - - /* This example has two different sizes of "record": longs and shorts */ - long longBuffer[5]; - short shortBuffer[5]; - - /* Initialize buffers */ - for(x=0; x<5; x++) - { - longBuffer[x] = -x; - shortBuffer[x] = x; - } - - /* Fill the write buffer with a mix of longs and shorts */ - /* We need to supply the length of each record and a pointer to */ - /* the beginning of each record. */ - writeBuffer[0].len = sizeof(long); - writeBuffer[0].p = &(longBuffer[0]); - writeBuffer[1].len = sizeof(short); - writeBuffer[1].p = &(shortBuffer[1]); - writeBuffer[2].len = sizeof(long); - writeBuffer[2].p = &(longBuffer[2]); - writeBuffer[3].len = sizeof(long); - writeBuffer[3].p = &(longBuffer[3]); - writeBuffer[4].len = sizeof(short); - writeBuffer[4].p = &(shortBuffer[4]); - - /* Create a file using default properties */ - fid=H5Fcreate("packet_table_VLexample.h5",H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT); - - /* Create a variable-length packet table within the file */ - ptable = H5PTcreate_vl(fid, "Packet Test Dataset", (hsize_t)1); - if(ptable == H5I_INVALID_HID) - goto out; - - /* Write the entire buffer to the packet table */ - err = H5PTappend(ptable, (hsize_t)5, writeBuffer ); - if(err < 0) - goto out; - - /* Get the number of packets in the packet table. This should be five. */ - err = H5PTget_num_packets(ptable, &count); - if(err < 0) - goto out; - - printf("Number of packets in packet table after five appends: %d\n", count); - - /* Read all five packets back */ - err = H5PTread_packets(ptable, (hsize_t)0, (hsize_t)5, readBuffer ); - if(err < 0) - goto out; - - for(x=0; x<5; x++) - { - printf("Packet %d's length is %d\n", x, readBuffer[x].len); - if(readBuffer[x].len == sizeof(long)) - printf("Packet %d's value is %d\n", x, *( (long *) readBuffer[x].p) ); - else - printf("Packet %d's value is %d\n", x, *( (short *) readBuffer[x].p) ); - } - - /* Before we close the packet table, we must free the memory that */ - /* the pointers in readBuffer point to. */ - err = H5PTfree_vlen_readbuff(ptable, (hsize_t)5, readBuffer); - if(err < 0) - goto out; - - /* Close the packet table */ - err = H5PTclose(ptable); - if(err < 0) - goto out; - - /* Close the file */ - H5Fclose(fid); -#endif /* VLPT_REMOVED */ - - return 0; - -#ifdef VLPT_REMOVED - out: /* An error has occurred. Clean up and exit. */ - fprintf(stderr, "An error has occurred!\n"); - H5PTclose(ptable); - H5Fclose(fid); - return -1; -#endif /* VLPT_REMOVED */ -} diff --git a/hl/examples/run-hlc-ex.sh.in b/hl/examples/run-hlc-ex.sh.in index a82e591..a79f67a 100644 --- a/hl/examples/run-hlc-ex.sh.in +++ b/hl/examples/run-hlc-ex.sh.in @@ -76,8 +76,6 @@ then rm ex_lite3 &&\ RunTest ptExampleFL &&\ rm ptExampleFL &&\ - RunTest ptExampleVL &&\ - rm ptExampleVL &&\ RunTest ex_image1 &&\ rm ex_image1 &&\ RunTest ex_image2 &&\ diff --git a/hl/fortran/CMakeLists.txt b/hl/fortran/CMakeLists.txt index ae38588..0da0825 100644 --- a/hl/fortran/CMakeLists.txt +++ b/hl/fortran/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.6) +cmake_minimum_required (VERSION 2.8.10) PROJECT (HDF5_HL_F90 C CXX Fortran) #----------------------------------------------------------------------------- diff --git a/hl/fortran/Makefile.in b/hl/fortran/Makefile.in index 6fe288c..8b7f728 100644 --- a/hl/fortran/Makefile.in +++ b/hl/fortran/Makefile.in @@ -231,6 +231,7 @@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ +HAVE_PTHREAD = @HAVE_PTHREAD@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF_CXX = @HDF_CXX@ @@ -282,7 +283,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PARALLEL = @PARALLEL@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ -PTHREAD = @PTHREAD@ RANLIB = @RANLIB@ ROOT = @ROOT@ RUNPARALLEL = @RUNPARALLEL@ diff --git a/hl/fortran/examples/CMakeLists.txt b/hl/fortran/examples/CMakeLists.txt index 7098119..03b9e9b 100644 --- a/hl/fortran/examples/CMakeLists.txt +++ b/hl/fortran/examples/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.6) +cmake_minimum_required (VERSION 2.8.10) PROJECT (HDF5_HL_F90_EXAMPLES C CXX Fortran) #----------------------------------------------------------------------------- diff --git a/hl/fortran/examples/Makefile.in b/hl/fortran/examples/Makefile.in index 7dd855b..9f08f21 100644 --- a/hl/fortran/examples/Makefile.in +++ b/hl/fortran/examples/Makefile.in @@ -194,6 +194,7 @@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ +HAVE_PTHREAD = @HAVE_PTHREAD@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF_CXX = @HDF_CXX@ @@ -245,7 +246,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PARALLEL = @PARALLEL@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ -PTHREAD = @PTHREAD@ RANLIB = @RANLIB@ ROOT = @ROOT@ RUNPARALLEL = @RUNPARALLEL@ diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt index ec54d8c..c580516 100644 --- a/hl/fortran/src/CMakeLists.txt +++ b/hl/fortran/src/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.6) +cmake_minimum_required (VERSION 2.8.10) PROJECT(HDF5_HL_F90_SRC C CXX Fortran) #----------------------------------------------------------------------------- diff --git a/hl/fortran/src/H5DSfc.c b/hl/fortran/src/H5DSfc.c index 3135cfa..2e38939 100644 --- a/hl/fortran/src/H5DSfc.c +++ b/hl/fortran/src/H5DSfc.c @@ -331,12 +331,8 @@ nh5dsget_scale_name_c(hid_t_f *did, _fcd name, size_t_f *size) /* * Convert C name to FORTRAN and place it in the given buffer */ - if(size_c != 0) { - HD5packFstring(c_scale_name, _fcdtocp(name), (size_t)*size); - *size = (size_t_f)size_c-1; /* (-1) because we don't include the NULL ending in the length*/ - } else { - *size = (size_t_f)size_c; /* if NULL then no name was found */ - } + HD5packFstring(c_scale_name, _fcdtocp(name), (size_t)*size); + *size = (size_t_f)size_c; done: if(c_scale_name) HDfree(c_scale_name); diff --git a/hl/fortran/src/Makefile.in b/hl/fortran/src/Makefile.in index be84073..fc734df 100644 --- a/hl/fortran/src/Makefile.in +++ b/hl/fortran/src/Makefile.in @@ -276,6 +276,7 @@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ +HAVE_PTHREAD = @HAVE_PTHREAD@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF_CXX = @HDF_CXX@ @@ -327,7 +328,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PARALLEL = @PARALLEL@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ -PTHREAD = @PTHREAD@ RANLIB = @RANLIB@ ROOT = @ROOT@ RUNPARALLEL = @RUNPARALLEL@ @@ -474,7 +474,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 127 +LT_VERS_REVISION = 138 LT_VERS_AGE = 0 INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/hl/src -I$(top_builddir)/hl/src \ -I$(top_srcdir)/fortran/src -I$(top_builddir)/fortran/src diff --git a/hl/fortran/test/CMakeLists.txt b/hl/fortran/test/CMakeLists.txt index c9b0533..d76e7f2 100644 --- a/hl/fortran/test/CMakeLists.txt +++ b/hl/fortran/test/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.6) +cmake_minimum_required (VERSION 2.8.10) PROJECT (HDF5_HL_FORTRAN_TESTS C CXX Fortran) #----------------------------------------------------------------------------- diff --git a/hl/fortran/test/Makefile.in b/hl/fortran/test/Makefile.in index 7e69b79..2acee8c 100644 --- a/hl/fortran/test/Makefile.in +++ b/hl/fortran/test/Makefile.in @@ -240,6 +240,7 @@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ +HAVE_PTHREAD = @HAVE_PTHREAD@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF_CXX = @HDF_CXX@ @@ -291,7 +292,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PARALLEL = @PARALLEL@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ -PTHREAD = @PTHREAD@ RANLIB = @RANLIB@ ROOT = @ROOT@ RUNPARALLEL = @RUNPARALLEL@ diff --git a/hl/src/CMakeLists.txt b/hl/src/CMakeLists.txt index 2df2c23..edba042 100644 --- a/hl/src/CMakeLists.txt +++ b/hl/src/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.6) +cmake_minimum_required (VERSION 2.8.10) PROJECT (HDF5_HL_SRC) #----------------------------------------------------------------------------- @@ -14,6 +14,7 @@ ENDIF (BUILD_SHARED_LIBS) INCLUDE_DIRECTORIES (${HDF5_HL_SRC_DIR}/src) SET (HL_SRCS + ${HDF5_HL_SRC_SOURCE_DIR}/H5DO.c ${HDF5_HL_SRC_SOURCE_DIR}/H5DS.c ${HDF5_HL_SRC_SOURCE_DIR}/H5IM.c ${HDF5_HL_SRC_SOURCE_DIR}/H5LT.c @@ -24,6 +25,7 @@ SET (HL_SRCS ) SET (HL_HEADERS + ${HDF5_HL_SRC_SOURCE_DIR}/H5DOpublic.h ${HDF5_HL_SRC_SOURCE_DIR}/H5DSpublic.h ${HDF5_HL_SRC_SOURCE_DIR}/H5IMpublic.h ${HDF5_HL_SRC_SOURCE_DIR}/H5LTparse.h diff --git a/hl/src/H5DO.c b/hl/src/H5DO.c new file mode 100644 index 0000000..9cfd8c1 --- /dev/null +++ b/hl/src/H5DO.c @@ -0,0 +1,137 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +* 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 +#include +#include +#include + +#include "H5DOprivate.h" + +/*------------------------------------------------------------------------- + * Function: H5DOwrite_chunk + * + * Purpose: Writes an entire chunk to the file directly. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Raymond Lu + * 30 July 2012 + * + * Modifications: + *------------------------------------------------------------------------- + */ +herr_t +H5DOwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *offset, + size_t data_size, const void *buf) +{ + hbool_t created_dxpl = FALSE; + herr_t ret_value = SUCCEED; /* Return value */ + + if(dset_id < 0) { + ret_value = FAIL; + goto done; + } + + if(!buf) { + ret_value = FAIL; + goto done; + } + + if(!offset) { + ret_value = FAIL; + goto done; + } + + if(!data_size) { + ret_value = FAIL; + goto done; + } + + if(H5P_DEFAULT == dxpl_id) { + if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) { + ret_value = FAIL; + goto done; + } + + created_dxpl = TRUE; + } + + if(H5DO_write_chunk(dset_id, dxpl_id, filters, offset, data_size, buf) < 0) { + ret_value = FAIL; + goto done; + } + +done: + if(created_dxpl) { + if(H5Pclose(dxpl_id) < 0) + ret_value = FAIL; + } + + return ret_value; +} + +/*------------------------------------------------------------------------- + * Function: H5DO_write_chunk + * + * Purpose: Private function for H5DOwrite_chunk + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Raymond Lu + * 30 July 2012 + * + * Modifications: + *------------------------------------------------------------------------- + */ +herr_t +H5DO_write_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *offset, + size_t data_size, const void *buf) +{ + hbool_t do_direct_write = TRUE; + herr_t ret_value = SUCCEED; /* Return value */ + + if(H5Pset(dxpl_id, H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_NAME, &do_direct_write) < 0) { + ret_value = FAIL; + goto done; + } + + if(H5Pset(dxpl_id, H5D_XFER_DIRECT_CHUNK_WRITE_FILTERS_NAME, &filters) < 0) { + ret_value = FAIL; + goto done; + } + + if(H5Pset(dxpl_id, H5D_XFER_DIRECT_CHUNK_WRITE_OFFSET_NAME, &offset) < 0) { + ret_value = FAIL; + goto done; + } + + if(H5Pset(dxpl_id, H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_NAME, &data_size) < 0) { + ret_value = FAIL; + goto done; + } + + if(H5Dwrite(dset_id, 0, H5S_ALL, H5S_ALL, dxpl_id, buf) < 0) { + ret_value = FAIL; + goto done; + } + +done: + do_direct_write = FALSE; + if(H5Pset(dxpl_id, H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_NAME, &do_direct_write) < 0) + ret_value = FAIL; + + return ret_value; +} diff --git a/hl/src/H5DOprivate.h b/hl/src/H5DOprivate.h new file mode 100644 index 0000000..fcea585 --- /dev/null +++ b/hl/src/H5DOprivate.h @@ -0,0 +1,37 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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 _H5DOprivate_H +#define _H5DOprivate_H + +/* High-level library internal header file */ +#include "H5HLprivate2.h" + +/* public LT prototypes */ +#include "H5DOpublic.h" + +/*------------------------------------------------------------------------- + * Private functions + *------------------------------------------------------------------------- + */ + +H5_HLDLL herr_t H5DO_write_chunk(hid_t dset_id, + hid_t dxpl_id, + uint32_t filters, + const hsize_t *offset, + size_t data_size, + const void *buf); + +#endif diff --git a/hl/src/H5DOpublic.h b/hl/src/H5DOpublic.h new file mode 100644 index 0000000..774709e --- /dev/null +++ b/hl/src/H5DOpublic.h @@ -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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef _H5DOpublic_H +#define _H5DOpublic_H + +#ifdef __cplusplus +extern "C" { +#endif + +/*------------------------------------------------------------------------- + * + * Direct chunk write function + * + *------------------------------------------------------------------------- + */ + +H5_HLDLL herr_t H5DOwrite_chunk(hid_t dset_id, + hid_t dxpl_id, + uint32_t filters, + const hsize_t *offset, + size_t data_size, + const void *buf); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/hl/src/H5DS.c b/hl/src/H5DS.c index e9ea9cf..cb3a1ce 100644 --- a/hl/src/H5DS.c +++ b/hl/src/H5DS.c @@ -1779,6 +1779,8 @@ out: * Comments: * * Modifications: +* The size of the name returned should not include the NULL termination +* in its value so as to be consistent with other HDF5 APIs. * *------------------------------------------------------------------------- */ @@ -1875,7 +1877,7 @@ ssize_t H5DSget_scale_name(hid_t did, buf=NULL; } - return (ssize_t) nbytes; + return (ssize_t) MAX(0,nbytes-1); /* error zone */ out: diff --git a/hl/src/Makefile.am b/hl/src/Makefile.am index 4c120b1..c1e6810 100644 --- a/hl/src/Makefile.am +++ b/hl/src/Makefile.am @@ -31,12 +31,12 @@ lib_LTLIBRARIES=libhdf5_hl.la libhdf5_hl_la_LDFLAGS= -version-info $(LT_VERS_INTERFACE):$(LT_VERS_REVISION):$(LT_VERS_AGE) $(AM_LDFLAGS) # List sources to include in the HDF5 HL Library. -libhdf5_hl_la_SOURCES=H5DS.c H5IM.c H5LT.c H5LTanalyze.c H5LTparse.c H5PT.c H5TB.c H5LD.c +libhdf5_hl_la_SOURCES=H5DO.c H5DS.c H5IM.c H5LT.c H5LTanalyze.c H5LTparse.c H5PT.c H5TB.c H5LD.c # HDF5 HL library depends on HDF5 Library. libhdf5_hl_la_LIBADD=$(LIBHDF5) # Public header files (to be installed) -include_HEADERS=hdf5_hl.h H5IMpublic.h H5LTpublic.h H5TBpublic.h H5DSpublic.h H5PTpublic.h H5LDpublic.h +include_HEADERS=hdf5_hl.h H5DOpublic.h H5IMpublic.h H5LTpublic.h H5TBpublic.h H5DSpublic.h H5PTpublic.h H5LDpublic.h include $(top_srcdir)/config/conclude.am diff --git a/hl/src/Makefile.in b/hl/src/Makefile.in index 9fb86a5..34db4c0 100644 --- a/hl/src/Makefile.in +++ b/hl/src/Makefile.in @@ -114,8 +114,8 @@ am__uninstall_files_from_dir = { \ am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)" LTLIBRARIES = $(lib_LTLIBRARIES) libhdf5_hl_la_DEPENDENCIES = $(LIBHDF5) -am_libhdf5_hl_la_OBJECTS = H5DS.lo H5IM.lo H5LT.lo H5LTanalyze.lo \ - H5LTparse.lo H5PT.lo H5TB.lo H5LD.lo +am_libhdf5_hl_la_OBJECTS = H5DO.lo H5DS.lo H5IM.lo H5LT.lo \ + H5LTanalyze.lo H5LTparse.lo H5PT.lo H5TB.lo H5LD.lo libhdf5_hl_la_OBJECTS = $(am_libhdf5_hl_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) @@ -259,6 +259,7 @@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ +HAVE_PTHREAD = @HAVE_PTHREAD@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF_CXX = @HDF_CXX@ @@ -310,7 +311,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PARALLEL = @PARALLEL@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ -PTHREAD = @PTHREAD@ RANLIB = @RANLIB@ ROOT = @ROOT@ RUNPARALLEL = @RUNPARALLEL@ @@ -457,7 +457,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 127 +LT_VERS_REVISION = 138 LT_VERS_AGE = 0 # This library is our main target. @@ -467,13 +467,13 @@ lib_LTLIBRARIES = libhdf5_hl.la libhdf5_hl_la_LDFLAGS = -version-info $(LT_VERS_INTERFACE):$(LT_VERS_REVISION):$(LT_VERS_AGE) $(AM_LDFLAGS) # List sources to include in the HDF5 HL Library. -libhdf5_hl_la_SOURCES = H5DS.c H5IM.c H5LT.c H5LTanalyze.c H5LTparse.c H5PT.c H5TB.c H5LD.c +libhdf5_hl_la_SOURCES = H5DO.c H5DS.c H5IM.c H5LT.c H5LTanalyze.c H5LTparse.c H5PT.c H5TB.c H5LD.c # HDF5 HL library depends on HDF5 Library. libhdf5_hl_la_LIBADD = $(LIBHDF5) # Public header files (to be installed) -include_HEADERS = hdf5_hl.h H5IMpublic.h H5LTpublic.h H5TBpublic.h H5DSpublic.h H5PTpublic.h H5LDpublic.h +include_HEADERS = hdf5_hl.h H5DOpublic.h H5IMpublic.h H5LTpublic.h H5TBpublic.h H5DSpublic.h H5PTpublic.h H5LDpublic.h # Automake needs to be taught how to build lib, progs, and tests targets. # These will be filled in automatically for the most part (e.g., @@ -572,6 +572,7 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5DO.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5DS.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5IM.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5LD.Plo@am__quote@ diff --git a/hl/src/hdf5_hl.h b/hl/src/hdf5_hl.h index 3b3a2a0..6693b14 100644 --- a/hl/src/hdf5_hl.h +++ b/hl/src/hdf5_hl.h @@ -22,6 +22,7 @@ #ifndef _HDF5_HL_H #define _HDF5_HL_H +#include "H5DOpublic.h" /* dataset optimization */ #include "H5DSpublic.h" /* dimension scales */ #include "H5LTpublic.h" /* lite */ #include "H5IMpublic.h" /* image */ diff --git a/hl/test/CMakeLists.txt b/hl/test/CMakeLists.txt index 89baac4..39a3811 100644 --- a/hl/test/CMakeLists.txt +++ b/hl/test/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.6) +cmake_minimum_required (VERSION 2.8.10) PROJECT (HDF5_HL_TEST) # -------------------------------------------------------------------- # Notes: When creating unit test executables they should be prefixed @@ -65,6 +65,7 @@ ADD_TEST ( test_ds7.h5 test_ds8.h5 test_ds9.h5 + test_dectris.h5 test_image1.h5 test_image2.h5 test_image3.h5 @@ -76,10 +77,11 @@ ADD_TEST ( ) HL_ADD_TEST (test_ds "dsdata.txt;dslat.txt;dslon.txt;test_ds_be.h5;test_ds_le.h5") +HL_ADD_TEST (test_dset_opt "") HL_ADD_TEST (test_image "image8.txt;sepia.pal;earth.pal;image24pixel.txt;image24plane.txt;usa.wri") HL_ADD_TEST (test_lite "dtype_file.txt") HL_ADD_TEST (test_packet "") -HL_ADD_TEST (test_table "test_table_be.hdf5;test_table_cray.hdf5;test_table_le.hdf5") +HL_ADD_TEST (test_table "test_table_be.h5;test_table_cray.h5;test_table_le.h5") # -------------------------------------------------------------------- # This executable is used to generate test files for the test_ds test. diff --git a/hl/test/Makefile.am b/hl/test/Makefile.am index c546513..b933c44 100644 --- a/hl/test/Makefile.am +++ b/hl/test/Makefile.am @@ -33,7 +33,7 @@ LDADD=$(LIBH5_HL) $(LIBH5TEST) $(LIBHDF5) # Test programs. These are our main targets. They should be listed in the # order to be executed, generally most specific tests to least specific tests. -TEST_PROG=test_lite test_image test_file_image test_table test_ds test_packet \ +TEST_PROG=test_lite test_image test_file_image test_table test_ds test_packet test_dset_opt test_ld check_PROGRAMS=$(TEST_PROG) ld_monitor ld_extend @@ -51,7 +51,8 @@ endif # Temporary files. These files are the ones created by running `make test'. CHECK_CLEANFILES+=combine_tables[1-2].h5 test_ds[1-9].h5 test_ds10.h5 \ test_image[1-3].h5 file_img[1-2].h5 test_lite[1-4].h5 test_table.h5 \ - test_packet_table.h5 test_packet_compress.h5 test_detach.h5 + test_packet_table.h5 test_packet_compress.h5 test_detach.h5 \ + test_dectris.h5 DISTCLEANFILES=test_ld.sh include $(top_srcdir)/config/conclude.am diff --git a/hl/test/Makefile.in b/hl/test/Makefile.in index 61ddff7..a19cdad 100644 --- a/hl/test/Makefile.in +++ b/hl/test/Makefile.in @@ -88,7 +88,7 @@ CONFIG_CLEAN_FILES = H5srcdir_str.h test_ld.sh CONFIG_CLEAN_VPATH_FILES = am__EXEEXT_1 = test_lite$(EXEEXT) test_image$(EXEEXT) \ test_file_image$(EXEEXT) test_table$(EXEEXT) test_ds$(EXEEXT) \ - test_packet$(EXEEXT) test_ld$(EXEEXT) + test_packet$(EXEEXT) test_dset_opt$(EXEEXT) am__EXEEXT_2 = gen_test_ds$(EXEEXT) gen_test_ld$(EXEEXT) PROGRAMS = $(noinst_PROGRAMS) gen_test_ds_SOURCES = gen_test_ds.c @@ -115,6 +115,10 @@ test_ds_SOURCES = test_ds.c test_ds_OBJECTS = test_ds.$(OBJEXT) test_ds_LDADD = $(LDADD) test_ds_DEPENDENCIES = $(LIBH5_HL) $(LIBH5TEST) $(LIBHDF5) +test_dset_opt_SOURCES = test_dset_opt.c +test_dset_opt_OBJECTS = test_dset_opt.$(OBJEXT) +test_dset_opt_LDADD = $(LDADD) +test_dset_opt_DEPENDENCIES = $(LIBH5_HL) $(LIBH5TEST) $(LIBHDF5) test_file_image_SOURCES = test_file_image.c test_file_image_OBJECTS = test_file_image.$(OBJEXT) test_file_image_LDADD = $(LDADD) @@ -123,10 +127,6 @@ test_image_SOURCES = test_image.c test_image_OBJECTS = test_image.$(OBJEXT) test_image_LDADD = $(LDADD) test_image_DEPENDENCIES = $(LIBH5_HL) $(LIBH5TEST) $(LIBHDF5) -test_ld_SOURCES = test_ld.c -test_ld_OBJECTS = test_ld.$(OBJEXT) -test_ld_LDADD = $(LDADD) -test_ld_DEPENDENCIES = $(LIBH5_HL) $(LIBH5TEST) $(LIBHDF5) test_lite_SOURCES = test_lite.c test_lite_OBJECTS = test_lite.$(OBJEXT) test_lite_LDADD = $(LDADD) @@ -174,11 +174,11 @@ am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = gen_test_ds.c gen_test_ld.c ld_extend.c ld_monitor.c \ - test_ds.c test_file_image.c test_image.c test_ld.c test_lite.c \ - test_packet.c test_table.c + test_ds.c test_dset_opt.c test_file_image.c test_image.c \ + test_lite.c test_packet.c test_table.c DIST_SOURCES = gen_test_ds.c gen_test_ld.c ld_extend.c ld_monitor.c \ - test_ds.c test_file_image.c test_image.c test_ld.c test_lite.c \ - test_packet.c test_table.c + test_ds.c test_dset_opt.c test_file_image.c test_image.c \ + test_lite.c test_packet.c test_table.c am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -280,6 +280,7 @@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ +HAVE_PTHREAD = @HAVE_PTHREAD@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF_CXX = @HDF_CXX@ @@ -331,7 +332,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PARALLEL = @PARALLEL@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ -PTHREAD = @PTHREAD@ RANLIB = @RANLIB@ ROOT = @ROOT@ RUNPARALLEL = @RUNPARALLEL@ @@ -478,7 +478,8 @@ TRACE = perl $(top_srcdir)/bin/trace CHECK_CLEANFILES = *.chkexe *.chklog *.clog combine_tables[1-2].h5 \ test_ds[1-9].h5 test_ds10.h5 test_image[1-3].h5 \ file_img[1-2].h5 test_lite[1-4].h5 test_table.h5 \ - test_packet_table.h5 test_packet_compress.h5 test_detach.h5 + test_packet_table.h5 test_packet_compress.h5 test_detach.h5 \ + test_dectris.h5 # Test script TEST_SCRIPT = test_ld.sh @@ -490,9 +491,7 @@ LDADD = $(LIBH5_HL) $(LIBH5TEST) $(LIBHDF5) # Test programs. These are our main targets. They should be listed in the # order to be executed, generally most specific tests to least specific tests. -TEST_PROG = test_lite test_image test_file_image test_table test_ds test_packet \ - test_ld - +TEST_PROG = test_lite test_image test_file_image test_table test_ds test_packet test_dset_opt # These programs generate test files for the tests. They don't need to be # compiled every time we want to test the library. However, putting @@ -593,15 +592,15 @@ ld_monitor$(EXEEXT): $(ld_monitor_OBJECTS) $(ld_monitor_DEPENDENCIES) $(EXTRA_ld test_ds$(EXEEXT): $(test_ds_OBJECTS) $(test_ds_DEPENDENCIES) $(EXTRA_test_ds_DEPENDENCIES) @rm -f test_ds$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_ds_OBJECTS) $(test_ds_LDADD) $(LIBS) +test_dset_opt$(EXEEXT): $(test_dset_opt_OBJECTS) $(test_dset_opt_DEPENDENCIES) $(EXTRA_test_dset_opt_DEPENDENCIES) + @rm -f test_dset_opt$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_dset_opt_OBJECTS) $(test_dset_opt_LDADD) $(LIBS) test_file_image$(EXEEXT): $(test_file_image_OBJECTS) $(test_file_image_DEPENDENCIES) $(EXTRA_test_file_image_DEPENDENCIES) @rm -f test_file_image$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_file_image_OBJECTS) $(test_file_image_LDADD) $(LIBS) test_image$(EXEEXT): $(test_image_OBJECTS) $(test_image_DEPENDENCIES) $(EXTRA_test_image_DEPENDENCIES) @rm -f test_image$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_image_OBJECTS) $(test_image_LDADD) $(LIBS) -test_ld$(EXEEXT): $(test_ld_OBJECTS) $(test_ld_DEPENDENCIES) $(EXTRA_test_ld_DEPENDENCIES) - @rm -f test_ld$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(test_ld_OBJECTS) $(test_ld_LDADD) $(LIBS) test_lite$(EXEEXT): $(test_lite_OBJECTS) $(test_lite_DEPENDENCIES) $(EXTRA_test_lite_DEPENDENCIES) @rm -f test_lite$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_lite_OBJECTS) $(test_lite_LDADD) $(LIBS) @@ -623,9 +622,9 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ld_extend.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ld_monitor.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_ds.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_dset_opt.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_file_image.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_image.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_ld.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_lite.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_packet.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_table.Po@am__quote@ @@ -889,6 +888,7 @@ uninstall-am: help: @$(top_srcdir)/bin/makehelp + test_ld # lib/progs/tests targets recurse into subdirectories. build-* targets # build files in this directory. diff --git a/hl/test/dectris_hl_perf.c b/hl/test/dectris_hl_perf.c new file mode 100644 index 0000000..a3e382a --- /dev/null +++ b/hl/test/dectris_hl_perf.c @@ -0,0 +1,643 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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 test is for the DECTRIS project to the H5DOwrite_chunk function + * + */ + +#include "hdf5.h" +#include "hdf5_hl.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +const char *FILENAME[] = { + "dectris_perf", + "unix.raw", + NULL +}; + +/* + * Print the current location on the standard output stream. + */ +#define FUNC __func__ +#define AT() printf (" at %s:%d in %s()...\n", \ + __FILE__, __LINE__, FUNC); +#define H5_FAILED() {puts("*FAILED*");fflush(stdout);} +#define TEST_ERROR {H5_FAILED(); AT(); goto error;} +#define TESTING(WHAT) {printf("Testing %-62s",WHAT); fflush(stdout);} +#define PASSED() {puts(" PASSED");fflush(stdout);} + +#define DIRECT_UNCOMPRESSED_DSET "direct_uncompressed_dset" +#define DIRECT_COMPRESSED_DSET "direct_compressed_dset" +#define REG_COMPRESSED_DSET "reg_compressed_dset" +#define REG_NO_COMPRESS_DSET "reg_no_compress_dset" +#define RANK 3 +#define NX 100 +#define NY 1000 +#define NZ 250 +#define CHUNK_NX 1 +#define CHUNK_NY 1000 +#define CHUNK_NZ 250 + +#define DEFLATE_SIZE_ADJUST(s) (ceil(((double)(s))*1.001)+12) +char filename[1024]; +unsigned int *outbuf[NX]; +size_t data_size[NX]; +double total_size = 0.0; +unsigned int *direct_buf[NX]; +double MB = 1048576.0; + +/*-------------------------------------------------- + * Function to report IO rate + *-------------------------------------------------- + */ +void reportTime(struct timeval start, double mbytes) +{ + struct timeval timeval_stop,timeval_diff; + + /*end timing*/ + gettimeofday(&timeval_stop,NULL); + + /* Calculate the elapsed gettimeofday time */ + timeval_diff.tv_usec=timeval_stop.tv_usec-start.tv_usec; + timeval_diff.tv_sec=timeval_stop.tv_sec-start.tv_sec; + + if(timeval_diff.tv_usec<0) { + timeval_diff.tv_usec+=1000000; + timeval_diff.tv_sec--; + } /* end if */ + +/*printf("mbytes=%lf, sec=%lf, usec=%lf\n", mbytes, (double)timeval_diff.tv_sec, (double)timeval_diff.tv_usec);*/ + printf("MBytes/second: %lf\n", (double)mbytes/((double)timeval_diff.tv_sec+((double)timeval_diff.tv_usec/(double)1000000.0))); +} + +/*-------------------------------------------------- + * Create file, datasets, and initialize data + *-------------------------------------------------- + */ +int create_file(hid_t fapl_id) +{ + hid_t file; /* handles */ + hid_t fapl; + hid_t cparms; + hid_t dataspace, dataset; + hsize_t dims[RANK] = {NX, NY, NZ}; + hsize_t chunk_dims[RANK] ={CHUNK_NX, CHUNK_NY, CHUNK_NZ}; + unsigned int aggression = 9; /* Compression aggression setting */ + int ret; + int i, j, n; + + int flag; + int unix_file; + + unsigned int *p; + size_t buf_size = CHUNK_NY*CHUNK_NZ*sizeof(unsigned int); + + const Bytef *z_src; + Bytef *z_dst; /*destination buffer */ + uLongf z_dst_nbytes = (uLongf)DEFLATE_SIZE_ADJUST(buf_size); + uLong z_src_nbytes = (uLong)buf_size; + + TESTING("Create a file and dataset"); + + /* + * Create the data space with unlimited dimensions. + */ + if((dataspace = H5Screate_simple(RANK, dims, NULL)) < 0) + TEST_ERROR; + + /* + * Create a new file. If file exists its contents will be overwritten. + */ + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) + TEST_ERROR; + + /* + * Modify dataset creation properties, i.e. enable chunking and compression + */ + if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0) + TEST_ERROR; + + if(H5Pset_chunk( cparms, RANK, chunk_dims) < 0) + TEST_ERROR; + + /* + * Create a new dataset within the file using cparms + * creation properties. + */ + if((dataset = H5Dcreate2(file, DIRECT_UNCOMPRESSED_DSET, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, + cparms, H5P_DEFAULT)) < 0) + TEST_ERROR; + + if(H5Dclose(dataset) < 0) + TEST_ERROR; + + if((dataset = H5Dcreate2(file, REG_NO_COMPRESS_DSET, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, + cparms, H5P_DEFAULT)) < 0) + TEST_ERROR; + + if(H5Dclose(dataset) < 0) + TEST_ERROR; + + /* Set compression */ + if(H5Pset_deflate( cparms, aggression) < 0) + TEST_ERROR; + + if((dataset = H5Dcreate2(file, DIRECT_COMPRESSED_DSET, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, + cparms, H5P_DEFAULT)) < 0) + TEST_ERROR; + + if(H5Dclose(dataset) < 0) + TEST_ERROR; + + + if((dataset = H5Dcreate2(file, REG_COMPRESSED_DSET, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, + cparms, H5P_DEFAULT)) < 0) + TEST_ERROR; + + if(H5Dclose(dataset) < 0) + TEST_ERROR; + + if(H5Fclose(file) < 0) + TEST_ERROR; + + if(H5Sclose(dataspace) < 0) + TEST_ERROR; + + if(H5Pclose(cparms) < 0) + TEST_ERROR; + + /* create a unix file*/ + flag = O_CREAT|O_TRUNC|O_WRONLY; + + if ((unix_file=open(FILENAME[1],flag,S_IRWXU))== -1) + TEST_ERROR; + + if (close(unix_file) < 0) + { + printf(" unable to close the file\n"); + TEST_ERROR; + } + + + /* Initialize data for chunks */ + for(i = 0; i < NX; i++) { + p = direct_buf[i] = (unsigned int*)malloc(CHUNK_NY*CHUNK_NZ*sizeof(unsigned int)); + + for(j=0; j < CHUNK_NY*CHUNK_NZ; j++, p++) + *p = rand() % 65000; + + z_src = (const Bytef*)direct_buf[i]; + + z_dst_nbytes = (uLongf)DEFLATE_SIZE_ADJUST(buf_size); + /* Allocate output (compressed) buffer */ + outbuf[i] = (unsigned int*)malloc((size_t)z_dst_nbytes); + z_dst = (Bytef *)outbuf[i]; + + /* Perform compression from the source to the destination buffer */ + ret = compress2(z_dst, &z_dst_nbytes, z_src, z_src_nbytes, aggression); + + data_size[i] = (size_t)z_dst_nbytes; + total_size += data_size[i]; + + /* Check for various zlib errors */ + if(Z_BUF_ERROR == ret) { + fprintf(stderr, "overflow"); + TEST_ERROR; + } else if(Z_MEM_ERROR == ret) { + fprintf(stderr, "deflate memory error"); + TEST_ERROR; + } else if(Z_OK != ret) { + fprintf(stderr, "other deflate error"); + TEST_ERROR; + } + } + + + PASSED(); + +error: + H5E_BEGIN_TRY { + H5Dclose(dataset); + H5Sclose(dataspace); + H5Pclose(cparms); + H5Fclose(file); + } H5E_END_TRY; + return 1; +} + +/*-------------------------------------------------- + * Benchmark the performance of the new function + * with precompressed data. + *-------------------------------------------------- + */ +int +test_direct_write_uncompressed_data(hid_t fapl_id) +{ + hid_t file; /* handles */ + hid_t dataspace, dataset; + hid_t dxpl; + herr_t status; + int i; + + unsigned filter_mask = 0; + hsize_t offset[RANK] = {0, 0, 0}; + + struct timeval timeval_start; + + TESTING("H5DOwrite_chunk for uncompressed data"); + + if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0) + TEST_ERROR; + + /* Start the timer */ + gettimeofday(&timeval_start,NULL); + + /* Reopen the file and dataset */ + if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0) + TEST_ERROR; + + if((dataset = H5Dopen2(file, DIRECT_UNCOMPRESSED_DSET, H5P_DEFAULT)) < 0) + TEST_ERROR; + + + /* Write the compressed chunk data repeatedly to cover all the chunks in the + * dataset, using the direct writing function. */ + for(i=0; i= 0) { if(H5DSis_attached(did, dsid, idx) == 1) { if((name_len=H5DSget_scale_name(dsid,NULL,(size_t)0)) > 0) { - name_out = (char*)HDmalloc(name_len * sizeof (char)); + name_out = (char*)HDmalloc((name_len+1) * sizeof (char)); if(name_out != NULL) { - if(H5DSget_scale_name(dsid, name_out, (size_t)name_len) >= 0) { + if(H5DSget_scale_name(dsid, name_out, (size_t)name_len+1) >= 0) { if(HDstrcmp(scalename,name_out)==0) { ret_value = SUCCEED; } @@ -3232,12 +3232,12 @@ static int test_simple(void) goto out; /* allocate a buffer */ - name_out = (char*)HDmalloc(name_len * sizeof (char)); + name_out = (char*)HDmalloc((name_len+1) * sizeof (char)); if(name_out == NULL) goto out; /* get the scale name using this buffer */ - if(H5DSget_scale_name(dsid, name_out, (size_t)name_len) < 0) + if(H5DSget_scale_name(dsid, name_out, (size_t)name_len+1) < 0) goto out; if(HDstrcmp("Latitude set 0",name_out)!=0) diff --git a/hl/test/test_dset_opt.c b/hl/test/test_dset_opt.c new file mode 100644 index 0000000..9a0ffb0 --- /dev/null +++ b/hl/test/test_dset_opt.c @@ -0,0 +1,1138 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +* 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 +#include +#include "h5hltest.h" +#include "H5srcdir.h" +#include "H5DOpublic.h" +#include + +#if defined(H5_HAVE_ZLIB_H) && !defined(H5_ZLIB_HEADER) +# define H5_ZLIB_HEADER "zlib.h" +#endif +#if defined(H5_ZLIB_HEADER) +# include H5_ZLIB_HEADER /* "zlib.h" */ +#endif + +#define FILE_NAME "test_dectris.h5" + +#define DATASETNAME1 "direct_write" +#define DATASETNAME2 "skip_one_filter" +#define DATASETNAME3 "skip_two_filters" +#define DATASETNAME4 "data_conv" +#define DATASETNAME5 "contiguous_dset" +#define DATASETNAME6 "invalid_argue" +#define RANK 2 +#define NX 16 +#define NY 16 +#define CHUNK_NX 4 +#define CHUNK_NY 4 + +#define DEFLATE_SIZE_ADJUST(s) (ceil(((double)(s))*1.001)+12) + +/* Temporary filter IDs used for testing */ +#define H5Z_FILTER_BOGUS1 305 +#define H5Z_FILTER_BOGUS2 306 +#define ADD_ON 7 +#define FACTOR 3 + +/* Local prototypes for filter functions */ +static size_t filter_bogus1(unsigned int flags, size_t cd_nelmts, + const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf); +static size_t filter_bogus2(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_BOGUS1[1] = {{ + H5Z_CLASS_T_VERS, /* H5Z_class_t version */ + H5Z_FILTER_BOGUS1, /* Filter id number */ + 1, 1, /* Encoding and decoding enabled */ + "bogus1", /* Filter name for debugging */ + NULL, /* The "can apply" callback */ + NULL, /* The "set local" callback */ + filter_bogus1, /* The actual filter function */ +}}; + +const H5Z_class2_t H5Z_BOGUS2[1] = {{ + H5Z_CLASS_T_VERS, /* H5Z_class_t version */ + H5Z_FILTER_BOGUS2, /* Filter id number */ + 1, 1, /* Encoding and decoding enabled */ + "bogus2", /* Filter name for debugging */ + NULL, /* The "can apply" callback */ + NULL, /* The "set local" callback */ + filter_bogus2, /* The actual filter function */ +}}; + +/*------------------------------------------------------------------------- + * Function: test_direct_chunk_write + * + * Purpose: Test the basic functionality of H5DOwrite_chunk + * + * Return: Success: 0 + * + * Failure: 1 + * + * Programmer: Raymond Lu + * 30 November 2012 + * + *------------------------------------------------------------------------- + */ +#ifdef H5_HAVE_FILTER_DEFLATE +static int +test_direct_chunk_write (hid_t file) +{ + hid_t dataspace = -1, dataset = -1; + hid_t mem_space = -1; + hid_t cparms = -1, dxpl = -1; + hsize_t dims[2] = {NX, NY}; + hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; + hsize_t chunk_dims[2] ={CHUNK_NX, CHUNK_NY}; + herr_t status; + int ret; + int data[NX][NY]; + int i, j, n; + + unsigned filter_mask = 0; + int direct_buf[CHUNK_NX][CHUNK_NY]; + int check_chunk[CHUNK_NX][CHUNK_NY]; + hsize_t offset[2] = {0, 0}; + size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int); + + const Bytef *z_src = (const Bytef*)(direct_buf); + Bytef *z_dst; /*destination buffer */ + uLongf z_dst_nbytes = (uLongf)DEFLATE_SIZE_ADJUST(buf_size); + uLong z_src_nbytes = (uLong)buf_size; + int aggression = 9; /* Compression aggression setting */ + void *outbuf = NULL; /* Pointer to new buffer */ + + hsize_t start[2]; /* Start of hyperslab */ + hsize_t stride[2]; /* Stride of hyperslab */ + hsize_t count[2]; /* Block count */ + hsize_t block[2]; /* Block sizes */ + + TESTING("basic functionality of H5DOwrite_chunk"); + + /* + * Create the data space with unlimited dimensions. + */ + if((dataspace = H5Screate_simple(RANK, dims, maxdims)) < 0) + goto error; + + if((mem_space = H5Screate_simple(RANK, chunk_dims, NULL)) < 0) + goto error; + + /* + * Modify dataset creation properties, i.e. enable chunking and compression + */ + if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0) + goto error; + + if((status = H5Pset_chunk( cparms, RANK, chunk_dims)) < 0) + goto error; + + if((status = H5Pset_deflate( cparms, (unsigned) aggression)) < 0) + goto error; + + /* + * Create a new dataset within the file using cparms + * creation properties. + */ + if((dataset = H5Dcreate2(file, DATASETNAME1, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, + cparms, H5P_DEFAULT)) < 0) + goto error; + + /* Initialize the dataset */ + for(i = n = 0; i < NX; i++) + for(j = 0; j < NY; j++) + data[i][j] = n++; + + if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0) + goto error; + + /* + * Write the data for the dataset. It should stay in the chunk cache. + * It will be evicted from the cache by the H5DOwrite_chunk calls. + */ + if((status = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, + dxpl, data)) < 0) + goto error; + + /* Initialize data for one chunk */ + for(i = n = 0; i < CHUNK_NX; i++) + for(j = 0; j < CHUNK_NY; j++) + direct_buf[i][j] = n++; + + /* Allocate output (compressed) buffer */ + outbuf = malloc(z_dst_nbytes); + z_dst = (Bytef *)outbuf; + + /* Perform compression from the source to the destination buffer */ + ret = compress2(z_dst, &z_dst_nbytes, z_src, z_src_nbytes, aggression); + + /* Check for various zlib errors */ + if(Z_BUF_ERROR == ret) { + fprintf(stderr, "overflow"); + goto error; + } else if(Z_MEM_ERROR == ret) { + fprintf(stderr, "deflate memory error"); + goto error; + } else if(Z_OK != ret) { + fprintf(stderr, "other deflate error"); + goto error; + } + + /* Write the compressed chunk data repeatedly to cover all the chunks in the + * dataset, using the direct writing function. */ + for(i=0; i0) { + *int_ptr++ -= (int)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++ += (int)ADD_ON; + buf_left -= sizeof(int); + } /* end while */ + } /* end else */ + + return nbytes; +} + +/*------------------------------------------------------------------------- + * Function: filter_bogus2 + * + * Purpose: A bogus filter that multiplies the original value by FACTOR. + * + * Return: Success: Data chunk size + * + * Programmer: Raymond Lu + * 30 November 2012 + *------------------------------------------------------------------------- + */ +static size_t +filter_bogus2(unsigned int flags, size_t UNUSED cd_nelmts, + const unsigned int UNUSED *cd_values, size_t nbytes, + size_t *buf_size, void **buf) +{ + int *int_ptr=(int *)*buf; /* Pointer to the data values */ + ssize_t buf_left=*buf_size; /* Amount of data buffer left to process */ + + if(flags & H5Z_FLAG_REVERSE) { /* read */ + /* Substract the "add on" value to all the data values */ + while(buf_left>0) { + *int_ptr++ /= (int)FACTOR; + 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++ *= (int)FACTOR; + buf_left -= sizeof(int); + } /* end while */ + } /* end else */ + + return nbytes; +} + +/*------------------------------------------------------------------------- + * Function: test_skip_compress_write2 + * + * Purpose: Test skipping compression filter when there are three filters + * for the dataset + * + * Return: Success: 0 + * + * Failure: 1 + * + * Programmer: Raymond Lu + * 30 November 2012 + * + *------------------------------------------------------------------------- + */ +static int +test_skip_compress_write2(hid_t file) +{ + hid_t dataspace = -1, dataset = -1; + hid_t mem_space = -1; + hid_t cparms = -1, dxpl = -1; + hsize_t dims[2] = {NX, NY}; + hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; + hsize_t chunk_dims[2] ={CHUNK_NX, CHUNK_NY}; + herr_t status; + int i, j, n; + + unsigned filter_mask = 0; + int origin_direct_buf[CHUNK_NX][CHUNK_NY]; + int direct_buf[CHUNK_NX][CHUNK_NY]; + int check_chunk[CHUNK_NX][CHUNK_NY]; + hsize_t offset[2] = {0, 0}; + size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int); + int aggression = 9; /* Compression aggression setting */ + + hsize_t start[2]; /* Start of hyperslab */ + hsize_t stride[2]; /* Stride of hyperslab */ + hsize_t count[2]; /* Block count */ + hsize_t block[2]; /* Block sizes */ + + TESTING("skipping compression filters but keep two other filters"); + + /* + * Create the data space with unlimited dimensions. + */ + if((dataspace = H5Screate_simple(RANK, dims, maxdims)) < 0) + goto error; + + if((mem_space = H5Screate_simple(RANK, chunk_dims, NULL)) < 0) + goto error; + + /* + * Modify dataset creation properties, i.e. enable chunking and compression. + * The order of filters is bogus 1 + deflate + bogus 2. + */ + if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0) + goto error; + + if((status = H5Pset_chunk( cparms, RANK, chunk_dims)) < 0) + goto error; + + /* Register and enable first bogus filter */ + if(H5Zregister (H5Z_BOGUS1) < 0) + goto error; + + if(H5Pset_filter(cparms, H5Z_FILTER_BOGUS1, 0, (size_t)0, NULL) < 0) + goto error; + + /* Enable compression filter */ + if((status = H5Pset_deflate( cparms, (unsigned) aggression)) < 0) + goto error; + + /* Register and enable second bogus filter */ + if(H5Zregister (H5Z_BOGUS2) < 0) + goto error; + + if(H5Pset_filter(cparms, H5Z_FILTER_BOGUS2, 0, (size_t)0, NULL) < 0) + goto error; + + /* + * Create a new dataset within the file using cparms + * creation properties. + */ + if((dataset = H5Dcreate2(file, DATASETNAME3, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, + cparms, H5P_DEFAULT)) < 0) + goto error; + + if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0) + goto error; + + /* Initialize data for one chunk. Apply operations of two bogus filters to the chunk */ + for(i = n = 0; i < CHUNK_NX; i++) + for(j = 0; j < CHUNK_NY; j++) { + origin_direct_buf[i][j] = n++; + direct_buf[i][j] = (origin_direct_buf[i][j] + ADD_ON) * FACTOR; + } + + /* write the uncompressed chunk data repeatedly to dataset, using the direct writing function. + * Indicate skipping the compression filter but keep the other two bogus filters */ + offset[0] = CHUNK_NX; + offset[1] = CHUNK_NY; + + /* compression filter is the middle one to be skipped */ + filter_mask = 0x00000002; + + if((status = H5DOwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, direct_buf)) < 0) + goto error; + + if(H5Fflush(dataset, H5F_SCOPE_LOCAL) < 0) + goto error; + + if(H5Dclose(dataset) < 0) + goto error; + + if((dataset = H5Dopen2(file, DATASETNAME3, H5P_DEFAULT)) < 0) + goto error; + + /* + * Select hyperslab for one chunk in the file + */ + start[0] = CHUNK_NX; start[1] = CHUNK_NY; + stride[0] = 1; stride[1] = 1; + count[0] = 1; count[1] = 1; + block[0] = CHUNK_NX; block[1] = CHUNK_NY; + if((status = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, start, stride, count, block)) < 0) + goto error; + + /* Read the chunk back */ + if((status = H5Dread(dataset, H5T_NATIVE_INT, mem_space, dataspace, H5P_DEFAULT, check_chunk)) < 0) + goto error; + + /* Check that the values read are the same as the values written */ + for(i = 0; i < CHUNK_NX; i++) { + for(j = 0; j < CHUNK_NY; j++) { + if(origin_direct_buf[i][j] != check_chunk[i][j]) { + printf(" 1. Read different values than written."); + printf(" At index %d,%d\n", i, j); + printf(" origin_direct_buf=%d, check_chunk=%d\n", origin_direct_buf[i][j], check_chunk[i][j]); + goto error; + } + } + } + + /* + * Close/release resources. + */ + H5Dclose(dataset); + H5Sclose(mem_space); + H5Sclose(dataspace); + H5Pclose(cparms); + H5Pclose(dxpl); + + PASSED(); + return 0; + +error: + H5E_BEGIN_TRY { + H5Dclose(dataset); + H5Sclose(mem_space); + H5Sclose(dataspace); + H5Pclose(cparms); + H5Pclose(dxpl); + } H5E_END_TRY; + + return 1; +} + +/*------------------------------------------------------------------------- + * Function: test_data_conv + * + * Purpose: Test data conversion + * + * Return: Success: 0 + * + * Failure: 1 + * + * Programmer: Raymond Lu + * 30 November 2012 + * + *------------------------------------------------------------------------- + */ +static int +test_data_conv(hid_t file) +{ + typedef struct { + int a, b, c[4], d, e; + } src_type_t; + typedef struct { + int a, c[4], e; + } dst_type_t; + + hid_t dataspace = -1, dataset = -1; + hid_t mem_space = -1; + hid_t cparms = -1, dxpl = -1; + hsize_t dims[2] = {NX, NY}; + hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; + hsize_t chunk_dims[2] ={CHUNK_NX, CHUNK_NY}; + herr_t status; + int i, j, n; + const hsize_t four = 4; + hid_t st=-1, dt=-1; + hid_t array_dt; + + unsigned filter_mask = 0; + src_type_t direct_buf[CHUNK_NX][CHUNK_NY]; + dst_type_t check_chunk[CHUNK_NX][CHUNK_NY]; + hsize_t offset[2] = {0, 0}; + size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(src_type_t); + + hsize_t start[2]; /* Start of hyperslab */ + hsize_t stride[2]; /* Stride of hyperslab */ + hsize_t count[2]; /* Block count */ + hsize_t block[2]; /* Block sizes */ + + TESTING("data conversion for H5DOwrite_chunk"); + + /* + * Create the data space with unlimited dimensions. + */ + if((dataspace = H5Screate_simple(RANK, dims, maxdims)) < 0) + goto error; + + if((mem_space = H5Screate_simple(RANK, chunk_dims, NULL)) < 0) + goto error; + + /* + * Modify dataset creation properties, i.e. enable chunking + */ + if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0) + goto error; + + if((status = H5Pset_chunk( cparms, RANK, chunk_dims)) < 0) + goto error; + + /* Build hdf5 datatypes */ + array_dt = H5Tarray_create2(H5T_NATIVE_INT, 1, &four); + if((st = H5Tcreate(H5T_COMPOUND, sizeof(src_type_t))) < 0 || + H5Tinsert(st, "a", HOFFSET(src_type_t, a), H5T_NATIVE_INT) < 0 || + H5Tinsert(st, "b", HOFFSET(src_type_t, b), H5T_NATIVE_INT) < 0 || + H5Tinsert(st, "c", HOFFSET(src_type_t, c), array_dt) < 0 || + H5Tinsert(st, "d", HOFFSET(src_type_t, d), H5T_NATIVE_INT) < 0 || + H5Tinsert(st, "e", HOFFSET(src_type_t, e), H5T_NATIVE_INT) < 0) + goto error; + + if(H5Tclose(array_dt) < 0) + goto error; + + array_dt = H5Tarray_create2(H5T_NATIVE_INT, 1, &four); + if((dt = H5Tcreate(H5T_COMPOUND, sizeof(dst_type_t))) < 0 || + H5Tinsert(dt, "a", HOFFSET(dst_type_t, a), H5T_NATIVE_INT) < 0 || + H5Tinsert(dt, "c", HOFFSET(dst_type_t, c), array_dt) < 0 || + H5Tinsert(dt, "e", HOFFSET(dst_type_t, e), H5T_NATIVE_INT) < 0) + goto error; + + if(H5Tclose(array_dt) < 0) + goto error; + + /* + * Create a new dataset within the file using cparms + * creation properties. + */ + if((dataset = H5Dcreate2(file, DATASETNAME4, st, dataspace, H5P_DEFAULT, + cparms, H5P_DEFAULT)) < 0) + goto error; + + if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0) + goto error; + + /* Initialize data for one chunk */ + for(i = n = 0; i < CHUNK_NX; i++) { + for(j = 0; j < CHUNK_NY; j++) { + (direct_buf[i][j]).a = i*j+0; + (direct_buf[i][j]).b = i*j+1; + (direct_buf[i][j]).c[0] = i*j+2; + (direct_buf[i][j]).c[1] = i*j+3; + (direct_buf[i][j]).c[2] = i*j+4; + (direct_buf[i][j]).c[3] = i*j+5; + (direct_buf[i][j]).d = i*j+6; + (direct_buf[i][j]).e = i*j+7; + } + } + + /* write the chunk data to dataset, using the direct writing function. + * There should be no data conversion involved. */ + offset[0] = CHUNK_NX; + offset[1] = CHUNK_NY; + + if((status = H5DOwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, direct_buf)) < 0) + goto error; + + if(H5Fflush(dataset, H5F_SCOPE_LOCAL) < 0) + goto error; + + if(H5Dclose(dataset) < 0) + goto error; + + if((dataset = H5Dopen2(file, DATASETNAME4, H5P_DEFAULT)) < 0) + goto error; + + /* + * Select hyperslab for the chunk just written in the file + */ + start[0] = CHUNK_NX; start[1] = CHUNK_NY; + stride[0] = 1; stride[1] = 1; + count[0] = 1; count[1] = 1; + block[0] = CHUNK_NX; block[1] = CHUNK_NY; + if((status = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, start, stride, count, block)) < 0) + goto error; + + /* Read the chunk back. Data should be converted */ + if((status = H5Dread(dataset, dt, mem_space, dataspace, H5P_DEFAULT, check_chunk)) < 0) + goto error; + + /* Check that the values read are the same as the values written */ + for(i = 0; i < CHUNK_NX; i++) { + for(j = 0; j < CHUNK_NY; j++) { + if ((direct_buf[i][j]).a != (check_chunk[i][j]).a || + (direct_buf[i][j]).c[0] != (check_chunk[i][j]).c[0] || + (direct_buf[i][j]).c[1] != (check_chunk[i][j]).c[1] || + (direct_buf[i][j]).c[2] != (check_chunk[i][j]).c[2] || + (direct_buf[i][j]).c[3] != (check_chunk[i][j]).c[3] || + (direct_buf[i][j]).e != (check_chunk[i][j]).e) { + printf(" 1. Read different values than written."); + printf(" At index %d,%d\n", i, j); + printf(" src={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n", + (direct_buf[i][j]).a, (direct_buf[i][j]).b, (direct_buf[i][j]).c[0], (direct_buf[i][j]).c[1], + (direct_buf[i][j]).c[2], (direct_buf[i][j]).c[3], (direct_buf[i][j]).d, (direct_buf[i][j]).e); + printf(" dst={a=%d, c=[%d,%d,%d,%d], e=%d\n", + (check_chunk[i][j]).a, (check_chunk[i][j]).c[0], (check_chunk[i][j]).c[1], (check_chunk[i][j]).c[2], + (check_chunk[i][j]).c[3], (check_chunk[i][j]).e); + + goto error; + } + } + } + + /* + * Close/release resources. + */ + H5Dclose(dataset); + H5Sclose(mem_space); + H5Sclose(dataspace); + H5Pclose(cparms); + H5Pclose(dxpl); + H5Tclose(st); + H5Tclose(dt); + + + PASSED(); + return 0; + +error: + H5E_BEGIN_TRY { + H5Dclose(dataset); + H5Sclose(mem_space); + H5Sclose(dataspace); + H5Pclose(cparms); + H5Pclose(dxpl); + H5Tclose(st); + H5Tclose(dt); + } H5E_END_TRY; + + return 1; +} + +/*------------------------------------------------------------------------- + * Function: test_invalid_parameters + * + * Purpose: Test invalid parameters for H5DOwrite_chunk + * + * Return: Success: 0 + * + * Failure: 1 + * + * Programmer: Raymond Lu + * 30 November 2012 + * + *------------------------------------------------------------------------- + */ +static int +test_invalid_parameters(hid_t file) +{ + hid_t dataspace = -1, dataset = -1; + hid_t mem_space = -1; + hid_t cparms = -1, dxpl = -1; + hsize_t dims[2] = {NX, NY}; + hsize_t chunk_dims[2] ={CHUNK_NX, CHUNK_NY}; + herr_t status; + int i, j, n; + + unsigned filter_mask = 0; + int direct_buf[CHUNK_NX][CHUNK_NY]; + hsize_t offset[2] = {0, 0}; + size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int); + int aggression = 9; /* Compression aggression setting */ + + TESTING("invalid parameters for H5DOwrite_chunk"); + + /* + * Create the data space with unlimited dimensions. + */ + if((dataspace = H5Screate_simple(RANK, dims, NULL)) < 0) + goto error; + + if((mem_space = H5Screate_simple(RANK, chunk_dims, NULL)) < 0) + goto error; + + /* + * Modify dataset creation properties + */ + if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0) + goto error; + + /* + * Create a new contiguous dataset to verify H5DOwrite_chunk doesn't work + */ + if((dataset = H5Dcreate2(file, DATASETNAME5, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, + cparms, H5P_DEFAULT)) < 0) + goto error; + + if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0) + goto error; + + /* Initialize data for one chunk */ + for(i = n = 0; i < CHUNK_NX; i++) + for(j = 0; j < CHUNK_NY; j++) { + direct_buf[i][j] = n++; + } + + /* Try to write the chunk data to contiguous dataset. It should fail */ + offset[0] = CHUNK_NX; + offset[1] = CHUNK_NY; + + H5E_BEGIN_TRY { + if((status = H5DOwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, direct_buf)) != FAIL) + goto error; + } H5E_END_TRY; + + if(H5Dclose(dataset) < 0) + goto error; + + /* Create a chunked dataset with compression filter */ + if((status = H5Pset_chunk( cparms, RANK, chunk_dims)) < 0) + goto error; + + if((status = H5Pset_deflate( cparms, (unsigned ) aggression)) < 0) + goto error; + + /* + * Create a new dataset within the file using cparms + * creation properties. + */ + if((dataset = H5Dcreate2(file, DATASETNAME6, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, + cparms, H5P_DEFAULT)) < 0) + goto error; + + /* Check invalid dataset ID */ + H5E_BEGIN_TRY { + if((status = H5DOwrite_chunk(-1, dxpl, filter_mask, offset, buf_size, direct_buf)) != FAIL) + goto error; + } H5E_END_TRY; + + /* Check invalid DXPL ID */ + H5E_BEGIN_TRY { + if((status = H5DOwrite_chunk(dataset, -1, filter_mask, offset, buf_size, direct_buf)) != FAIL) + goto error; + } H5E_END_TRY; + + /* Check invalid OFFSET */ + H5E_BEGIN_TRY { + if((status = H5DOwrite_chunk(dataset, dxpl, filter_mask, NULL, buf_size, direct_buf)) != FAIL) + goto error; + } H5E_END_TRY; + + /* Check when OFFSET is out of dataset range */ + offset[0] = NX + 1; + offset[1] = NY; + H5E_BEGIN_TRY { + if((status = H5DOwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, direct_buf)) != FAIL) + goto error; + } H5E_END_TRY; + + /* Check when OFFSET is not on chunk boundary */ + offset[0] = CHUNK_NX; + offset[1] = CHUNK_NY + 1; + H5E_BEGIN_TRY { + if((status = H5DOwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, direct_buf)) != FAIL) + goto error; + } H5E_END_TRY; + + /* Check invalid buffer size */ + offset[0] = CHUNK_NX; + offset[1] = CHUNK_NY; + buf_size = 0; + H5E_BEGIN_TRY { + if((status = H5DOwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, direct_buf)) != FAIL) + goto error; + } H5E_END_TRY; + + /* Check invalid data buffer */ + buf_size = CHUNK_NX*CHUNK_NY*sizeof(int); + H5E_BEGIN_TRY { + if((status = H5DOwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, NULL)) != FAIL) + goto error; + } H5E_END_TRY; + + if(H5Dclose(dataset) < 0) + goto error; + + /* + * Close/release resources. + */ + H5Sclose(mem_space); + H5Sclose(dataspace); + H5Pclose(cparms); + H5Pclose(dxpl); + + PASSED(); + return 0; + +error: + H5E_BEGIN_TRY { + H5Dclose(dataset); + H5Sclose(mem_space); + H5Sclose(dataspace); + H5Pclose(cparms); + H5Pclose(dxpl); + } H5E_END_TRY; + + return 1; +} + +/*------------------------------------------------------------------------- + * Function: Main function + * + * Purpose: Test direct chunk write function H5DOwrite_chunk + * + * Return: Success: 0 + * + * Failure: 1 + * + * Programmer: Raymond Lu + * 30 November 2012 + * + *------------------------------------------------------------------------- + */ +int main( void ) +{ + hid_t file_id; + int nerrors=0; + + /* + * Create a new file. If file exists its contents will be overwritten. + */ + if((file_id = H5Fcreate(FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; + + /* Test direct chunk write */ +#ifdef H5_HAVE_FILTER_DEFLATE + nerrors += test_direct_chunk_write(file_id); +#endif /* H5_HAVE_FILTER_DEFLATE */ + nerrors += test_skip_compress_write1(file_id); + nerrors += test_skip_compress_write2(file_id); + nerrors += test_data_conv(file_id); + nerrors += test_invalid_parameters(file_id); + + if(H5Fclose(file_id) < 0) + goto error; + + /* check for errors */ + if (nerrors) + goto error; + + return 0; + +error: + return 1; +} diff --git a/hl/test/test_lite.c b/hl/test/test_lite.c index a611088..282755e 100644 --- a/hl/test/test_lite.c +++ b/hl/test/test_lite.c @@ -51,7 +51,6 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name ); - /*------------------------------------------------------------------------- * test dataset functions *------------------------------------------------------------------------- @@ -2137,7 +2136,6 @@ static int test_valid_path(void) return -1; } - /*------------------------------------------------------------------------- * the main program *------------------------------------------------------------------------- @@ -2166,6 +2164,4 @@ int main( void ) error: return 1; - - } diff --git a/hl/test/test_table.c b/hl/test/test_table.c index cdae768..488cbe2 100644 --- a/hl/test/test_table.c +++ b/hl/test/test_table.c @@ -19,9 +19,9 @@ #include "H5srcdir.h" #include "H5TBpublic.h" -#define TEST_FILE_BE "test_table_be.hdf5" -#define TEST_FILE_LE "test_table_le.hdf5" -#define TEST_FILE_CRAY "test_table_cray.hdf5" +#define TEST_FILE_BE "test_table_be.h5" +#define TEST_FILE_LE "test_table_le.h5" +#define TEST_FILE_CRAY "test_table_cray.h5" /*------------------------------------------------------------------------- diff --git a/hl/test/test_table_be.h5 b/hl/test/test_table_be.h5 new file mode 100644 index 0000000..3639695 Binary files /dev/null and b/hl/test/test_table_be.h5 differ diff --git a/hl/test/test_table_be.hdf5 b/hl/test/test_table_be.hdf5 deleted file mode 100644 index 3639695..0000000 Binary files a/hl/test/test_table_be.hdf5 and /dev/null differ diff --git a/hl/test/test_table_cray.h5 b/hl/test/test_table_cray.h5 new file mode 100644 index 0000000..d22dce3 Binary files /dev/null and b/hl/test/test_table_cray.h5 differ diff --git a/hl/test/test_table_cray.hdf5 b/hl/test/test_table_cray.hdf5 deleted file mode 100644 index d22dce3..0000000 Binary files a/hl/test/test_table_cray.hdf5 and /dev/null differ diff --git a/hl/test/test_table_le.h5 b/hl/test/test_table_le.h5 new file mode 100644 index 0000000..6c330fd Binary files /dev/null and b/hl/test/test_table_le.h5 differ diff --git a/hl/test/test_table_le.hdf5 b/hl/test/test_table_le.hdf5 deleted file mode 100644 index 6c330fd..0000000 Binary files a/hl/test/test_table_le.hdf5 and /dev/null differ diff --git a/hl/tools/CMakeLists.txt b/hl/tools/CMakeLists.txt index 28943d6..4887b6c 100644 --- a/hl/tools/CMakeLists.txt +++ b/hl/tools/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.6) +cmake_minimum_required (VERSION 2.8.10) PROJECT (HDF5_HL_TOOLS) #----------------------------------------------------------------------------- diff --git a/hl/tools/Makefile.in b/hl/tools/Makefile.in index 08d8827..e32dc7c 100644 --- a/hl/tools/Makefile.in +++ b/hl/tools/Makefile.in @@ -228,6 +228,7 @@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ +HAVE_PTHREAD = @HAVE_PTHREAD@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF_CXX = @HDF_CXX@ @@ -279,7 +280,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PARALLEL = @PARALLEL@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ -PTHREAD = @PTHREAD@ RANLIB = @RANLIB@ ROOT = @ROOT@ RUNPARALLEL = @RUNPARALLEL@ diff --git a/hl/tools/gif2h5/Makefile.in b/hl/tools/gif2h5/Makefile.in index 8b98276..3d7e7fe 100644 --- a/hl/tools/gif2h5/Makefile.in +++ b/hl/tools/gif2h5/Makefile.in @@ -242,6 +242,7 @@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ +HAVE_PTHREAD = @HAVE_PTHREAD@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF_CXX = @HDF_CXX@ @@ -293,7 +294,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PARALLEL = @PARALLEL@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ -PTHREAD = @PTHREAD@ RANLIB = @RANLIB@ ROOT = @ROOT@ RUNPARALLEL = @RUNPARALLEL@ diff --git a/hl/tools/h5watch/Makefile.in b/hl/tools/h5watch/Makefile.in index c7a4120..2cb8c41 100644 --- a/hl/tools/h5watch/Makefile.in +++ b/hl/tools/h5watch/Makefile.in @@ -239,6 +239,7 @@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ +HAVE_PTHREAD = @HAVE_PTHREAD@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF_CXX = @HDF_CXX@ @@ -290,7 +291,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PARALLEL = @PARALLEL@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ -PTHREAD = @PTHREAD@ RANLIB = @RANLIB@ ROOT = @ROOT@ RUNPARALLEL = @RUNPARALLEL@ diff --git a/perform/CMakeLists.txt b/perform/CMakeLists.txt index 0a34677..3f8b9b7 100644 --- a/perform/CMakeLists.txt +++ b/perform/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.6) +cmake_minimum_required (VERSION 2.8.10) PROJECT (HDF5_PERFORM ) #----------------------------------------------------------------------------- diff --git a/perform/Makefile.in b/perform/Makefile.in index 230469c..4cc5b2b 100644 --- a/perform/Makefile.in +++ b/perform/Makefile.in @@ -268,6 +268,7 @@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ +HAVE_PTHREAD = @HAVE_PTHREAD@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF_CXX = @HDF_CXX@ @@ -319,7 +320,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PARALLEL = @PARALLEL@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ -PTHREAD = @PTHREAD@ RANLIB = @RANLIB@ ROOT = @ROOT@ RUNPARALLEL = @RUNPARALLEL@ diff --git a/release_docs/CMake.txt b/release_docs/CMake.txt index 1d36e21..81dfb61 100644 --- a/release_docs/CMake.txt +++ b/release_docs/CMake.txt @@ -10,7 +10,7 @@ Notes: This short instruction is written for users who want to quickly build www.cmake.org. CMake uses the command line, however the visual CMake tool is - recommended for the configuration step. The steps are similiar for + recommended for the configuration step. The steps are similar for all the operating systems supported by CMake. NOTES: @@ -25,27 +25,26 @@ Notes: This short instruction is written for users who want to quickly build Please send us any comments on how CMake support can be improved on any system. Visit the KitWare site for more information about CMake. - 3. If you are building HDF5 on Windows, do NOT use or execute any - files from the windows folder. - - 4. Build and test results can be submitted to our CDash server at: + 3. Build and test results can be submitted to our CDash server at: cdash.hdfgroup.uiuc.edu. Please read the HDF and CDash document at: www.hdfgroup.org/CDash/HowToSubmit. + 4. See the appendix at the bottom of this file for examples of using + a ctest script for building and testing. + ======================================================================== Preconditions ======================================================================== 1. We suggest you obtain the latest CMake for windows from the Kitware - web site. The HDF5 1.8.x product requires CMake version 2.8.6. + web site. The HDF5 1.8.x product requires CMake version 2.8.10. 2. If you plan to use Zlib or Szip; A. Download the packages and install them in a central location. For example on Windows, create a folder extlibs - and install the packages there. Windows users should also read Section V - in INSTALL_Windows.txt. + and install the packages there. B. Use source packages from a SVN server by adding the following CMake options: HDF5_ALLOW_EXTERNAL_SUPPORT:STRING="SVN" @@ -61,6 +60,15 @@ Notes: This short instruction is written for users who want to quickly build where "some_location" is the URL or full path to the compressed file and ext is the type of compression file. + 3. Building on Apple Darwin platforms should add the following options: + Compiler choice - use xcode by setting the ENV variables of CC and CXX + Shared fortran is not supported, build static: + BUILD_SHARED_LIBS:BOOL=OFF + Additional options: + CMAKE_ANSI_CFLAGS:STRING=-fPIC + CTEST_USE_LAUNCHERS:BOOL=ON + CMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF + ======================================================================== Building HDF5 C/C++ Libraries with CMake @@ -72,8 +80,9 @@ Notes: This short instruction is written for users who want to quickly build available in your Start menu. For Linux, UNIX, and Mac users the executable is named "cmake-gui" and can be found where CMake was installed. - Specify the source and build directories. It is recommemded that you - choose a build directory different then the source directory + Specify the source and build directories. + ***** It is recommemded that you choose a build directory ****** + ***** different then the source directory ****** (for example on Windows, if the source is at c:\MyHDFstuff\hdf5, then use c:\MyHDFstuff\hdf5\build or c:\MyHDFstuff\build\hdf5). @@ -110,24 +119,46 @@ Notes: This short instruction is written for users who want to quickly build * :BOOL=[ON | OFF] is: - # This is the CMakeCache file. - ######################## - # EXTERNAL cache entries - ######################## - SET (BUILD_SHARED_LIBS ON CACHE BOOL "Build Shared Libraries" FORCE) - SET (BUILD_TESTING ON CACHE BOOL "Build HDF5 Unit Testing" FORCE) - SET (HDF5_BUILD_CPP_LIB ON CACHE BOOL "Build HDF5 C++ Library" FORCE) - SET (HDF5_BUILD_EXAMPLES ON CACHE BOOL "Build HDF5 Library Examples" FORCE) - SET (HDF5_BUILD_FORTRAN ON CACHE BOOL "Build FORTRAN support" FORCE) - SET (HDF5_BUILD_HL_LIB ON CACHE BOOL "Build HIGH Level HDF5 Library" FORCE) - SET (HDF5_BUILD_TOOLS ON CACHE BOOL "Build HDF5 Tools" FORCE) - SET (HDF5_DISABLE_COMPILER_WARNINGS OFF CACHE BOOL "Disable compiler warnings" FORCE) - SET (HDF5_ENABLE_HSIZET ON CACHE BOOL "Enable datasets larger than memory" FORCE) - SET (HDF5_ENABLE_PARALLEL OFF CACHE BOOL "Enable parallel build (requires MPI)" FORCE) - SET (HDF5_ENABLE_SZIP_ENCODING ON CACHE BOOL "Use SZip Encoding" FORCE) - SET (HDF5_ENABLE_SZIP_SUPPORT ON CACHE BOOL "Use SZip Filter" FORCE) - SET (HDF5_ENABLE_Z_LIB_SUPPORT ON CACHE BOOL "Enable Zlib Filters" FORCE) - SET (HDF5_ENABLE_COVERAGE OFF CACHE BOOL "Enable code coverage for Libraries and Programs" FORCE) + # This is the CMakeCache file. + ######################## + # EXTERNAL cache entries + ######################## + SET (BUILD_SHARED_LIBS ON CACHE BOOL "Build Shared Libraries" FORCE) + SET (BUILD_TESTING ON CACHE BOOL "Build HDF5 Unit Testing" FORCE) + SET (HDF_PACKAGE_EXT "" CACHE STRING "Name of HDF package extension" FORCE) + SET (HDF5_BUILD_CPP_LIB ON CACHE BOOL "Build HDF5 C++ Library" FORCE) + SET (HDF5_BUILD_EXAMPLES ON CACHE BOOL "Build HDF5 Library Examples" FORCE) + SET (HDF5_BUILD_FORTRAN ON CACHE BOOL "Build FORTRAN support" FORCE) + SET (HDF5_ENABLE_F2003 OFF CACHE BOOL "Enable FORTRAN 2003 Standard" FORCE) + SET (HDF5_BUILD_HL_LIB ON CACHE BOOL "Build HIGH Level HDF5 Library" FORCE) + SET (HDF5_BUILD_TOOLS ON CACHE BOOL "Build HDF5 Tools" FORCE) + SET (HDF5_BUILD_GENERATORS OFF CACHE BOOL "Build Test Generators" FORCE) + SET (HDF5_ENABLE_Z_LIB_SUPPORT ON CACHE BOOL "Enable Zlib Filters" FORCE) + SET (HDF5_ENABLE_SZIP_SUPPORT ON CACHE BOOL "Use SZip Filter" FORCE) + SET (HDF5_ENABLE_SZIP_ENCODING ON CACHE BOOL "Use SZip Encoding" FORCE) + SET (HDF5_ENABLE_HSIZET ON CACHE BOOL "Enable datasets larger than memory" FORCE) + SET (HDF5_ENABLE_UNSUPPORTED OFF CACHE BOOL "Enable unsupported combinations of configuration options" FORCE) + SET (HDF5_ENABLE_DEPRECATED_SYMBOLS ON CACHE BOOL "Enable deprecated public API symbols" FORCE) + SET (HDF5_ENABLE_DIRECT_VFD OFF CACHE BOOL "Build the Direct I/O Virtual File Driver" FORCE) + SET (HDF5_ENABLE_PARALLEL OFF CACHE BOOL "Enable parallel build (requires MPI)" FORCE) + SET (MPIEXEC_MAX_NUMPROCS "3" CACHE STRING "Minimum number of processes for HDF parallel tests" FORCE) + SET (HDF5_BUILD_PARALLEL_ALL OFF CACHE BOOL "Build Parallel Programs" FORCE) + SET (HDF5_ENABLE_COVERAGE OFF CACHE BOOL "Enable code coverage for Libraries and Programs" FORCE) + SET (HDF5_ENABLE_USING_MEMCHECKER OFF CACHE BOOL "Indicate that a memory checker is used" FORCE) + SET (HDF5_DISABLE_COMPILER_WARNINGS OFF CACHE BOOL "Disable compiler warnings" FORCE) + SET (HDF5_USE_FOLDERS ON CACHE BOOL "Enable folder grouping of projects in IDEs." FORCE) + SET (HDF5_USE_16_API_DEFAULT OFF CACHE BOOL "Use the HDF5 1.6.x API by default" FORCE) + SET (HDF5_USE_18_API_DEFAULT OFF CACHE BOOL "Use the HDF5 1.8.x API by default" FORCE) + SET (HDF5_ENABLE_THREADSAFE OFF CACHE BOOL "(WINDOWS)Enable Threadsafety" FORCE) + SET (HDF5_PACKAGE_EXTLIBS OFF CACHE BOOL "(WINDOWS)CPACK - include external libraries" FORCE) + SET (HDF5_NO_PACKAGES OFF CACHE BOOL "CPACK - Disable packaging" FORCE) + SET (HDF5_ALLOW_EXTERNAL_SUPPORT "NO" CACHE STRING "Allow External Library Building" FORCE) + SET (ZLIB_SVN_URL "http://svn.hdfgroup.uiuc.edu/zlib/trunk" CACHE STRING "Use ZLib from HDF repository" FORCE) + SET (SZIP_SVN_URL "http://svn.hdfgroup.uiuc.edu/szip/trunk" CACHE STRING "Use SZip from HDF repository" FORCE) + SET (ZLIB_TGZ_NAME "ZLib.tar.gz" CACHE STRING "Use ZLib from compressed file" FORCE) + SET (SZIP_TGZ_NAME "SZip.tar.gz" CACHE STRING "Use SZip from compressed file" FORCE) + SET (ZLIB_PACKAGE_NAME "zlib" CACHE STRING "Name of ZLIB package" FORCE) + SET (SZIP_PACKAGE_NAME "szip" CACHE STRING "Name of SZIP package" FORCE) 2. Configure the cache settings @@ -286,7 +317,7 @@ HDF5_STRICT_FORMAT_CHECKS "Whether to perform strict file format checks" OFF HDF5_TEST_VFD "Execute tests with different VFDs" OFF HDF5_USE_16_API_DEFAULT "Use the HDF5 1.6.x API by default" OFF HDF5_USE_18_API_DEFAULT "Use the HDF5 1.8.x API by default" OFF -HDF5_USE_FOLDERS "Do not include CPack Packaging" OFF +HDF5_USE_FOLDERS "Enable folder grouping of projects in IDEs." OFF HDF5_WANT_DATA_ACCURACY "IF data accuracy is guaranteed during data conversions" ON HDF5_WANT_DCONV_EXCEPTION "exception handling functions is checked during data conversions" ON IF (APPLE) @@ -294,7 +325,7 @@ IF (APPLE) IF (CMAKE_BUILD_TYPE MATCHES Debug) HDF5_ENABLE_TRACE "Enable API tracing capability" ON IF (HDF5_TEST_VFD) - HDF5_TEST_FHEAP_VFD "Execute tests with different VFDs" ON + HDF5_TEST_FHEAP_VFD "Execute fheap test with different VFDs" ON IF (WIN32 AND NOT CYGWIN) HDF_LEGACY_NAMING "Use Legacy Names for Libraries and Programs" OFF HDF5_ENABLE_THREADSAFE "Enable Threadsafety" OFF @@ -314,6 +345,365 @@ IF (HDF5_ENABLE_SZIP_SUPPORT) ************************************************************************ + APPENDIX + +Below are examples of the ctest scripts used by The HDF Group. +See the script, cmakehdf5, in the bin folder for a smaller and limited +function shell script version of the following general scripts. +The example is for a linux machine, but the same scripts can be used on +a windows machine by adjusting the CTEST_CMAKE_GENERATOR option in the +product specific script. + +************************************************************************ + +CTestScript.cmake: common ctest script used to build, test and package +======================================================================== + +cmake_minimum_required(VERSION 2.8.6 FATAL_ERROR) +######################################################## +# This dashboard is maintained by The HDF Group +# For any comments please contact cdashhelp@hdfgroup.org +# +######################################################## +# ----------------------------------------------------------- +# -- Get environment +# ----------------------------------------------------------- +if(NOT SITE_OS_NAME) + ## machine name not provided - attempt to discover with uname + ## -- set hostname + ## -------------------------- + find_program(HOSTNAME_CMD NAMES hostname) + exec_program(${HOSTNAME_CMD} ARGS OUTPUT_VARIABLE HOSTNAME) + set(CTEST_SITE "${HOSTNAME}${CTEST_SITE_EXT}") + find_program(UNAME NAMES uname) + macro(getuname name flag) + exec_program("${UNAME}" ARGS "${flag}" OUTPUT_VARIABLE "${name}") + endmacro(getuname) + + getuname(osname -s) + getuname(osrel -r) + getuname(cpu -m) + message("Dashboard script uname output: ${osname}-${osrel}-${cpu}\n") + + set(CTEST_BUILD_NAME "${osname}-${osrel}-${cpu}") + if(USE_AUTOTOOLS) + set(CTEST_BUILD_NAME "AT-${CTEST_BUILD_NAME}") + endif(USE_AUTOTOOLS) + if(SITE_BUILDNAME_SUFFIX) + set(CTEST_BUILD_NAME "${CTEST_BUILD_NAME}-${SITE_BUILDNAME_SUFFIX}") + endif(SITE_BUILDNAME_SUFFIX) + set(BUILD_OPTIONS "${ADD_BUILD_OPTIONS}") +else(NOT SITE_OS_NAME) + ## machine name provided + ## -------------------------- + if(CMAKE_HOST_UNIX) + set(CTEST_BUILD_NAME "${SITE_OS_NAME}-${SITE_OS_VERSION}-${SITE_OS_BITS}-${SITE_COMPILER_NAME}-${SITE_COMPILER_VERSION}") + else(CMAKE_HOST_UNIX) + set(CTEST_BUILD_NAME "${SITE_OS_NAME}-${SITE_OS_VERSION}-${SITE_COMPILER_NAME}") + endif(CMAKE_HOST_UNIX) + if(SITE_BUILDNAME_SUFFIX) + set(CTEST_BUILD_NAME ${CTEST_BUILD_NAME}-${SITE_BUILDNAME_SUFFIX}) + endif() + set(BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DSITE:STRING=${CTEST_SITE} -DBUILDNAME:STRING=${CTEST_BUILD_NAME}") +endif(NOT SITE_OS_NAME) + +#----------------------------------------------------------------------------- +# MAC machines need special option +#----------------------------------------------------------------------------- +if(APPLE) + # Compiler choice + execute_process(COMMAND xcrun --find cc OUTPUT_VARIABLE XCODE_CC OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process(COMMAND xcrun --find c++ OUTPUT_VARIABLE XCODE_CXX OUTPUT_STRIP_TRAILING_WHITESPACE) + SET(ENV{CC} "${XCODE_CC}") + SET(ENV{CXX} "${XCODE_CXX}") + # Shared fortran is not supported, build static + set (BUILD_OPTIONS "${BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_ANSI_CFLAGS:STRING=-fPIC") + set(BUILD_OPTIONS "${BUILD_OPTIONS} -DCTEST_USE_LAUNCHERS:BOOL=ON -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF") +endif(APPLE) + +#----------------------------------------------------------------------------- +## cygwin does not handle the find_package() call +## -------------------------- +if(NOT SITE_CYGWIN}) + find_package (Subversion) + set(CTEST_UPDATE_COMMAND "${Subversion_SVN_EXECUTABLE}") +else(NOT SITE_CYGWIN}) + set(CTEST_UPDATE_COMMAND "/usr/bin/svn") +endif(NOT SITE_CYGWIN}) + +#----------------------------------------------------------------------------- +set(NEED_REPOSITORY_CHECKOUT 0) +set(CTEST_CMAKE_COMMAND "\"${CMAKE_COMMAND}\"") +if (CTEST_USE_TAR_SOURCE) + ## Uncompress source if tar file provided + ## -------------------------- + if(WIN32) + set(CTEST_7Z_COMMAND "C:/Program Files/7-Zip/7z.exe") + message("extracting... [${CTEST_7Z_COMMAND} x ${CTEST_USE_TAR_SOURCE}.zip]") + execute_process(COMMAND ${CTEST_7Z_COMMAND} x ${CTEST_USE_TAR_SOURCE}.zip RESULT_VARIABLE rv) + else(WIN32) + message("extracting... [${CTEST_CMAKE_COMMAND} -E tar -xvf ${CTEST_USE_TAR_SOURCE}.tar]") + execute_process(COMMAND tar -xvf ${CTEST_USE_TAR_SOURCE}.tar RESULT_VARIABLE rv) + endif(WIN32) + + if(NOT rv EQUAL 0) + message("extracting... [error-(${rv}) clean up]") + file(REMOVE_RECURSE "${CTEST_SOURCE_DIRECTORY}") + message(FATAL_ERROR "error: extract of ${CTEST_USE_TAR_SOURCE} failed") + endif(NOT rv EQUAL 0) + + file(RENAME ${CTEST_USE_TAR_SOURCE} ${CTEST_SOURCE_DIRECTORY}) + set(LOCAL_SKIP_UPDATE "TRUE") +else (CTEST_USE_TAR_SOURCE) + ## use subversion to get source + ## -------------------------- + if (NOT EXISTS "${CTEST_SOURCE_DIRECTORY}") + set (NEED_REPOSITORY_CHECKOUT 1) + endif (NOT EXISTS "${CTEST_SOURCE_DIRECTORY}") + + if (${NEED_REPOSITORY_CHECKOUT}) + set (CTEST_CHECKOUT_COMMAND + "${CTEST_UPDATE_COMMAND} co ${REPOSITORY_URL} \"${CTEST_SOURCE_DIRECTORY}\" -r HEAD") + else (${NEED_REPOSITORY_CHECKOUT}) + set (CTEST_CHECKOUT_COMMAND "${CTEST_UPDATE_COMMAND} update") + endif (${NEED_REPOSITORY_CHECKOUT}) +endif (CTEST_USE_TAR_SOURCE) + +#----------------------------------------------------------------------------- +## Clear the build directory +## -------------------------- +set(CTEST_START_WITH_EMPTY_BINARY_DIRECTORY TRUE) +file(MAKE_DIRECTORY "${CTEST_BINARY_DIRECTORY}") +#include(${CTEST_SOURCE_DIRECTORY}/CTestConfig.cmake) +ctest_empty_binary_directory(${CTEST_BINARY_DIRECTORY}) + +# Use multiple CPU cores to build +include(ProcessorCount) +ProcessorCount(N) +if(NOT N EQUAL 0) + if(NOT WIN32) + set(CTEST_BUILD_FLAGS -j${N}) + endif(NOT WIN32) + set(ctest_test_args ${ctest_test_args} PARALLEL_LEVEL ${N}) +endif() + +#----------------------------------------------------------------------------- +# Send the main script as a note. +if(USE_AUTOTOOLS) + ## autotools builds need to use make and does not use the cacheinit.cmake file + ## -- make command + ## ----------------- + find_program(MAKE NAMES make) + + list(APPEND CTEST_NOTES_FILES + "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}" + "${CMAKE_CURRENT_LIST_FILE}" + ) +else(USE_AUTOTOOLS) + list(APPEND CTEST_NOTES_FILES + "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}" + "${CMAKE_CURRENT_LIST_FILE}" + "${CTEST_SOURCE_DIRECTORY}/config/cmake/cacheinit.cmake" + ) +endif(USE_AUTOTOOLS) + +#----------------------------------------------------------------------------- +# Check for required variables. +# -------------------------- +foreach(req + CTEST_CMAKE_GENERATOR + CTEST_SITE + CTEST_BUILD_NAME + ) + if(NOT DEFINED ${req}) + message(FATAL_ERROR "The containing script must set ${req}") + endif(NOT DEFINED ${req}) +endforeach(req) + +#----------------------------------------------------------------------------- +# Initialize the CTEST commands +#------------------------------ +if(USE_AUTOTOOLS) + set(CTEST_CONFIGURE_COMMAND "${CTEST_SOURCE_DIRECTORY}/configure ${ADD_BUILD_OPTIONS}") + set(CTEST_BUILD_COMMAND "${MAKE} ${CTEST_BUILD_FLAGS}") + ## -- CTest Config + #configure_file($ENV{HOME}/CTestConfiguration/CTestConfig.cmake ${CTEST_SOURCE_DIRECTORY}/CTestConfig.cmake) + configure_file(${CTEST_SOURCE_DIRECTORY}/config/cmake/CTestCustom.cmake ${CTEST_BINARY_DIRECTORY}/CTestCustom.cmake) + ## -- CTest Testfile +# configure_file(${CTEST_SCRIPT_DIRECTORY}/CTestTestfile.cmake ${CTEST_BINARY_DIRECTORY}/CTestTestfile.cmake) + file(WRITE ${CTEST_BINARY_DIRECTORY}/CTestTestfile.cmake "ADD_TEST(makecheck \"${MAKE}\" \"${CTEST_BUILD_FLAGS}\" \"-i\" \"check\")") +else(USE_AUTOTOOLS) + if(LOCAL_MEMCHECK_TEST) + find_program(CTEST_MEMORYCHECK_COMMAND NAMES valgrind) + set (CTEST_CONFIGURE_COMMAND + "${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/mccacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_BUILD_CONFIGURATION} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_SOURCE_DIRECTORY}\"" + ) + else(LOCAL_MEMCHECK_TEST) + find_program(CTEST_COVERAGE_COMMAND NAMES gcov) + set (CTEST_CONFIGURE_COMMAND + "${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/cacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_BUILD_CONFIGURATION} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_SOURCE_DIRECTORY}\"" + ) + endif(LOCAL_MEMCHECK_TEST) +endif(USE_AUTOTOOLS) + +#----------------------------------------------------------------------------- +## -- set output to english +set($ENV{LC_MESSAGES} "en_EN") + +# Print summary information. +foreach(v + CTEST_SITE + CTEST_BUILD_NAME + CTEST_SOURCE_DIRECTORY + CTEST_BINARY_DIRECTORY + CTEST_CMAKE_GENERATOR + CTEST_BUILD_CONFIGURATION + CTEST_GIT_COMMAND + CTEST_CHECKOUT_COMMAND + CTEST_CONFIGURE_COMMAND + CTEST_SCRIPT_DIRECTORY + CTEST_USE_LAUNCHERS + ) + set(vars "${vars} ${v}=[${${v}}]\n") +endforeach(v) +message("Dashboard script configuration:\n${vars}\n") + +#----------------------------------------------------------------------------- +if(${MODEL} STREQUAL "Continuous") + ## Continuous mode is used for commit test processing + ## -------------------------- + while (${CTEST_ELAPSED_TIME} LESS 36000) + set(START_TIME ${CTEST_ELAPSED_TIME}) + CTEST_START (Continuous) + CTEST_UPDATE (SOURCE "${CTEST_SOURCE_DIRECTORY}" RETURN_VALUE res) + set (CTEST_CHECKOUT_COMMAND) # checkout on first iteration only + message("Dashboard updated files: ${res}\n") + if(res GREATER 0) + CTEST_CONFIGURE (BUILD "${CTEST_BINARY_DIRECTORY}") + CTEST_READ_CUSTOM_FILES ("${CTEST_BINARY_DIRECTORY}") + CTEST_SUBMIT (PARTS Update Configure Notes) + CTEST_BUILD (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND) + CTEST_SUBMIT (PARTS Build) + CTEST_TEST (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND ${ctest_test_args}) + CTEST_SUBMIT (PARTS Test) + + execute_process (COMMAND cpack -C ${CTEST_BUILD_CONFIGURATION} + WORKING_DIRECTORY ${CTEST_BINARY_DIRECTORY} + RESULT_VARIABLE cpackResult + OUTPUT_VARIABLE cpackLog + ERROR_VARIABLE cpackLog.err + ) + file (WRITE ${CTEST_BINARY_DIRECTORY}/cpack.log "${cpackLog.err}" "${cpackLog}") + endif(${res} GREATER 0) + + CTEST_SLEEP(${START_TIME} 300 ${CTEST_ELAPSED_TIME}) + endwhile (${CTEST_ELAPSED_TIME} LESS 36000) +#----------------------------------------------------------------------------- +else(${MODEL} STREQUAL "Continuous") +#----------------------------------------------------------------------------- + ## NORMAL process + ## -- LOCAL_SKIP_UPDATE skips updating the source folder from svn + ## -- LOCAL_NO_SUBMIT skips reporting to CDash server + ## -- LOCAL_SKIP_TEST skips the test process (only builds) + ## -- LOCAL_MEMCHECK_TEST executes the Valgrind testing + ## -- LOCAL_COVERAGE_TEST executes code coverage process + ## -------------------------- + CTEST_START (${MODEL} TRACK ${MODEL}) + if(NOT LOCAL_SKIP_UPDATE) + CTEST_UPDATE (SOURCE "${CTEST_SOURCE_DIRECTORY}") + endif(NOT LOCAL_SKIP_UPDATE) + CTEST_CONFIGURE (BUILD "${CTEST_BINARY_DIRECTORY}") + CTEST_READ_CUSTOM_FILES ("${CTEST_BINARY_DIRECTORY}") + if(NOT LOCAL_NO_SUBMIT) + CTEST_SUBMIT (PARTS Update Configure Notes) + endif(NOT LOCAL_NO_SUBMIT) + CTEST_BUILD (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND) + if(NOT LOCAL_NO_SUBMIT) + CTEST_SUBMIT (PARTS Build) + endif(NOT LOCAL_NO_SUBMIT) + if(NOT LOCAL_SKIP_TEST) + if(NOT LOCAL_MEMCHECK_TEST) + CTEST_TEST (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND ${ctest_test_args}) + if(NOT LOCAL_NO_SUBMIT) + CTEST_SUBMIT (PARTS Test) + endif(NOT LOCAL_NO_SUBMIT) + else(NOT LOCAL_MEMCHECK_TEST) + CTEST_MEMCHECK (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND ${ctest_test_args}) + if(NOT LOCAL_NO_SUBMIT) + CTEST_SUBMIT (PARTS MemCheck) + endif(NOT LOCAL_NO_SUBMIT) + endif(NOT LOCAL_MEMCHECK_TEST) + if(LOCAL_COVERAGE_TEST) + CTEST_COVERAGE (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND) + if(NOT LOCAL_NO_SUBMIT) + CTEST_SUBMIT (PARTS Coverage) + endif(NOT LOCAL_NO_SUBMIT) + endif(LOCAL_COVERAGE_TEST) + endif(NOT LOCAL_SKIP_TEST) + if(NOT LOCAL_MEMCHECK_TEST) + ##----------------------------------------------- + ## Package the product + ##----------------------------------------------- + execute_process(COMMAND cpack -C ${CTEST_BUILD_CONFIGURATION} -V + WORKING_DIRECTORY ${CTEST_BINARY_DIRECTORY} + RESULT_VARIABLE cpackResult + OUTPUT_VARIABLE cpackLog + ERROR_VARIABLE cpackLog.err + ) + file(WRITE ${CTEST_BINARY_DIRECTORY}/cpack.log "${cpackLog.err}" "${cpackLog}") + endif(NOT LOCAL_MEMCHECK_TEST) +endif(${MODEL} STREQUAL "Continuous") +#----------------------------------------------------------------------------- + +message("DONE:CTestScript") +************************************************************************ + +************************************************************************ +Product specific script, HDF518Static.cmake, that uses the +CTestScript.cmake file (see above). Usage: +"ctest -S HDF518Static.cmake,hdf518 -C Release -O hdf518static.log" +where hdf518 is the source folder relative to the location of these scripts +======================================================================== + +cmake_minimum_required(VERSION 2.8.6 FATAL_ERROR) + +# CTEST_SCRIPT_ARG is the source folder passed on the command line +set(CTEST_SOURCE_NAME ${CTEST_SCRIPT_ARG}) +set(CTEST_BINARY_NAME ${CTEST_SOURCE_NAME}/buildstatic) +set(CTEST_DASHBOARD_ROOT ${CTEST_SCRIPT_DIRECTORY}) +set(CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_SOURCE_NAME}") +set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_BINARY_NAME}") +set(CTEST_BUILD_CONFIGURATION "Release") +set(MODEL "Experimental") + +# build generator name, see cmake generator list +set(CTEST_CMAKE_GENERATOR "Unix Makefiles") + +# machine description, can be removed on linux +set(CTEST_SITE "machine.domain") +set(SITE_OS_NAME "os name") +set(SITE_OS_VERSION "os version") +set(SITE_OS_BITS "os size") +set(SITE_COMPILER_NAME "compiler name") +set(SITE_COMPILER_VERSION "compiler version") + +# extra CDash build name description +set(SITE_BUILDNAME_SUFFIX "STATIC") + +# needed for source updates, change as required +set(REPOSITORY_URL "http://svn.hdfgroup.uiuc.edu/hdf5/branches/hdf5_1_8") + +# options to add/change from the cacheinit.cmake in the config/cmake folder +set(ADD_BUILD_OPTIONS "-DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_INSTALL_PREFIX:PATH=/usr/local/hdf5.1.8_static") +set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_ANSI_CFLAGS:STRING=-fPIC -DHDF5_PACKAGE_EXTLIBS:BOOL=ON") +set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING=\"SVN\"") + +# include common script file +include(${CTEST_SCRIPT_DIRECTORY}/CTestScript.cmake) + +message("DONE") + +************************************************************************ Need further assistance, send email to help@hdfgroup.org diff --git a/release_docs/INSTALL_Windows.txt b/release_docs/INSTALL_Windows.txt index 967675f..4344ea4 100644 --- a/release_docs/INSTALL_Windows.txt +++ b/release_docs/INSTALL_Windows.txt @@ -9,8 +9,5 @@ We now recommend that users build, test and install HDF5 using CMake. Instructions for building and testing HDF5 using CMake can be found in the CMake.txt file found in this folder. -The old solutions and projects found in the windows\ folder will be -maintained for legacy users until HDF5 1.10. - The old INSTALL_Windows documentation can be found in the obsolete_windows_docs\ folder located with this document. diff --git a/release_docs/INSTALL_parallel b/release_docs/INSTALL_parallel index b2e1eec..eacaf68 100644 --- a/release_docs/INSTALL_parallel +++ b/release_docs/INSTALL_parallel @@ -17,12 +17,14 @@ of running the parallel test suites. 1.1. Requirements ----------------- -PHDF5 requires an MPI compiler with MPI-IO support and a parallel file system. -If you don't know yet, you should first consult with your system support staff -of information how to compile an MPI program, how to run an MPI application, -and how to access the parallel file system. There are sample MPI-IO C and -Fortran programs in the appendix section of "Sample programs". You can use -them to run simple tests of your MPI compilers and the parallel file system. +PHDF5 requires an MPI compiler with MPI-IO support and a POSIX compliant +(Ref. 1) parallel file system. If you don't know yet, you should first consult +with your system support staff of information how to compile an MPI program, +how to run an MPI application, and how to access the parallel file system. +There are sample MPI-IO C and Fortran programs in the appendix section of +"Sample programs". You can use them to run simple tests of your MPI compilers +and the parallel file system. Also, the t_posix_compliant test in testpar +verifies if the file system is POSIX compliant. 1.2. Further Help @@ -274,6 +276,20 @@ if the tests should use directory /PFS/user/me, do shell initial files like .profile, .cshrc, etc.) +Reference +--------- +1. POSIX Compliant. A good explanation is by Donald Lewin, + After a write() to a regular file has successfully returned, any + successful read() from each byte position on the file that was modified + by that write() will return the date that was written by the write(). A + subsequent write() to the same byte will overwrite the file data. If a + read() of a file data can be proven by any means [e.g., MPI_Barrier()] + to occur after a write() of that data, it must reflect that write(), + even if the calls are made by a different process. + Lewin, D. (1994). "POSIX Programmer's Guide (pg. 513-4)". O'Reilly + & Associates. + + Appendix A. Sample programs --------------------------- Here are sample MPI-IO C and Fortran programs. You may use them to run simple diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 4742542..d2901ab 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -1,4 +1,4 @@ -HDF5 version 1.9.137-FA_a5 currently under development +HDF5 version 1.9.148-FA_a5 currently under development INTRODUCTION @@ -40,6 +40,10 @@ New Features Configuration: ------------- + - CMake minimum is now 2.8.10. (ADB 2013/1/14) + - A new tool, cmakehdf5, which is a build command script similar to + buildhdf5 is added and is available in the bin directory. + (AKC - 2012/12/12) - Fixed AIX Fortran compiler flags to use appropriate settings for debugging, profiling, optimization situations. HDFFV-8069. (AKC 2012/09/27) @@ -101,6 +105,9 @@ New Features Library: -------- + - Added new API functions H5Dscatter and H5Dgather to scatter data to and + and gather data from a selection within a memory buffer. + (NAF - 2013/02/05) - The library now supports the data conversion from enumeration to numeric (integer and floating-point number) datatypes. See Issue 8221. (SLU - 2012/10/23) @@ -363,9 +370,9 @@ New Features High-Level APIs: ------ - Table: In version 3.0 of Table, "NROWS" (used to store number of records) was - deprecated (PVN - 2008/11/24) + deprecated (PVN - 2008/11/24) - - Added Fortran wrappers for Dimension Scale APIs. HDFFV-3797 + - Added Fortran wrappers for Dimension Scale APIs. HDFFV-3797 h5dsset_scale_f h5dsattach_scale_f h5dsdetach_scale_f @@ -378,9 +385,15 @@ New Features (EIP for SB - 2011/10/13) - New API: h5ltpath_valid (Fortran: h5ltpath_valid_f) which checks - if a path is correct and determines if a link resolves to a valid - object and checks that the link does not dangle. (MSB- 2012/3/15) - + if a path is correct and determines if a link resolves to a valid + object and checks that the link does not dangle. (MSB- 2012/3/15) + + - A new API function H5DOwrite_chunk. It writes a data chunk directly + into a file bypassing hyperslab selection, data conversion, and + filter pipeline. The user must be careful with the function and + clearly understand the I/O process of the library. + (SLU - 2013/2/11) + Documentation ------------- @@ -737,9 +750,12 @@ Bug Fixes since HDF5-1.8.0 release Tools ----- + - h5diff: Fixed to return correct exit code 1 when detect unique extra + attribute. Prior to this fix, h5diff returned exit code 0 indicating + two files are identical. HDFFV-7643 (JKM 2013/02/15) - h5diff: Improved speed when comparing HDF5 files with lots of - attributes. Much slower performance was identified with release version - from 1.8.7 to 1.8.10 compared to 1.8.6. (JKM 2012/10/19) + attributes. Much slower performance was identified with release + version from 1.8.7 to 1.8.10 compared to 1.8.6. (JKM 2012/10/19) - h5repack: "h5repack -f NONE file1.h5 out.h5" command failed if source file contains chunked dataset and a chunk dim is bigger than the dataset dim. Another issue is that the command changed max dims @@ -967,7 +983,10 @@ Bug Fixes since HDF5-1.8.0 release High-Level APIs: ------ - + - Fixed problem with H5DSget_scale_name including the NULL terminator in + the size calculation returned by the function. The API does not + include the NULL terminator in the size returned (MSB- 2013/2/10) + - Fixed problem with H5TBdelete_record destroying all data following the deletion of a row. (MSB- 2012/7/26) @@ -1051,6 +1070,19 @@ Bug Fixes since HDF5-1.8.0 release in "New Features" section. (BMR - 2008/08/10) + Testing + ------- + - In some Mac system, testlibinfo.sh failed with this error: + Check file ../src/.libs/libhdf5.7.dylib + strings: object: ../src/.libs/libhdf5.7.dylib malformed object \ + (unknown load command 15) + The strings command of Mac inspects library files and older + versions of strings may not know newer library format, resulting + in errors. Fixed by sending the library file as stdin to the strings + coommand to avoid this problem. (AKC - 2013/03/08 HDFFV-8305) + + - Fixed a typo in the ERROR macro in test/testhdf5.h. It segmentation + faulted when used before. (AKC - 2013/02/12 HDFFV-8267) Supported Platforms diff --git a/release_docs/USING_CMake.txt b/release_docs/USING_CMake.txt index 71f2fcf..0e980ea 100644 --- a/release_docs/USING_CMake.txt +++ b/release_docs/USING_CMake.txt @@ -4,14 +4,14 @@ Notes: This short instruction is written for users who want to quickly build HDF5 Applications from the HDF5 Examples package using the CMake tools. - Users can adapt these instructions for their own applicaltions, see the + Users can adapt these instructions for their own applications, see the "Minimum Project Files" section. More information about using CMake can be found at the KitWare site, www.cmake.org. CMake uses the command line, however the visual CMake tool is - available for the configuration step. The steps are similiar for + available for the configuration step. The steps are similar for all the operating systems supported by CMake. NOTES: @@ -31,13 +31,17 @@ Notes: This short instruction is written for users who want to quickly build Please read the HDF and CDash document at: www.hdfgroup.org/CDash/HowToSubmit. + 4. See the appendix at the bottom of this file for an example of using + a ctest script for building and testing. See CMake.txt for more + information. + ======================================================================== Preconditions ======================================================================== 1. We suggest you obtain the latest CMake for windows from the Kitware - web site. The HDF5 1.8.x product requires CMake version 2.8.6 (minimum). + web site. The HDF5 1.8.x product requires CMake version 2.8.10 (minimum). 2. You have installed the HDF5 library built with CMake, by executing the HDF Install Utility (The *.exe file in the binary package for Windows). @@ -62,7 +66,7 @@ Notes: This short instruction is written for users who want to quickly build available in your Start menu. For Linux, UNIX, and Mac users the executable is named "cmake-gui" and can be found where CMake was installed. - Specify the source and build directories. It is recommemded that you + Specify the source and build directories. It is recommended that you choose a build directory different then the source directory (for example on Windows, if the source is at c:\MyHDFstuff\hdf5, then use c:\MyHDFstuff\hdf5\build or c:\MyHDFstuff\build\hdf5). @@ -156,7 +160,7 @@ Notes: This short instruction is written for users who want to quickly build ======================================================================== - Using HDF5 Libraries with Visual Studio 2008 + Using Visual Studio 2008 with HDF5 Libraries built with Visual Studio 2008 ======================================================================== 8. Set up path for external libraries and headers @@ -168,11 +172,11 @@ Notes: This short instruction is written for users who want to quickly build and select "x64". 8.2 Find the box "Show directories for", choose "Include files", add the - header path (i.e. c:\Program Files\HDF Group\HDF5\hdf5-1.8.7\include) + header path (i.e. c:\Program Files\HDF Group\HDF5\hdf5-1.8.x\include) to the included directories. 8.3 Find the box "Show directories for", choose "Library files", add the - library path (i.e. c:\Program Files\HDF Group\HDF5\hdf5-1.8.7\lib) + library path (i.e. c:\Program Files\HDF Group\HDF5\hdf5-1.8.x\lib) to the library directories. 8.4 If using Fortran libraries, you will also need to setup the path @@ -180,12 +184,30 @@ Notes: This short instruction is written for users who want to quickly build ======================================================================== + Using Visual Studio 2010 with HDF5 Libraries built with Visual Studio 2010 +======================================================================== + + 9. Set up path for external libraries and headers + + The path settings will need to be in project property sheets per project. + Go to "Project" and select "Properties", find "Configuration Properties", + and then "VC++ Directories". + + 9.1 If you are building on 64-bit Windows, find the "Platform" dropdown + and select "x64". + + 9.2 Add the header path to the "Include Directories" setting. + + 9.3 Add the library path to the "Library Directories" setting. + + +======================================================================== Minimum C Project Files for CMake ======================================================================== - 9. Create a CMakeLists.txt file at the source root. + 10. Create a CMakeLists.txt file at the source root. .......................................................................... -cmake_minimum_required (VERSION 2.8.6) +cmake_minimum_required (VERSION 2.8.10) PROJECT (HDF5MyApp C CXX) FIND_PACKAGE (HDF5 REQURIED) @@ -196,7 +218,55 @@ ADD_EXECUTABLE (hdf_example ${PROJECT_SOURCE_DIR}/hdf_example.c) TARGET_LINK_LIBRARIES (hdf_example ${LINK_LIBS}) .......................................................................... + +************************************************************************ + APPENDIX + +Below ia an example of the ctest script used by The HDF Group. See the +Appendix in the CMake.txt file for the CTestScript.cmake file used by this +script. + ************************************************************************ +Product specific script, HDF518Example.cmake, that uses the +CTestScript.cmake file (see Appendix in the CMake.txt). Usage: +"ctest -S HDF518Example.cmake,hdf518Examples -C Release -O hdf518EX.log" +where hdf518Examples is the source folder relative to the location of these scripts +======================================================================== + +cmake_minimum_required(VERSION 2.8.6 FATAL_ERROR) + +set(CTEST_SOURCE_NAME ${CTEST_SCRIPT_ARG}) +set(CTEST_BINARY_NAME ${CTEST_SOURCE_NAME}/build) +set(CTEST_DASHBOARD_ROOT ${CTEST_SCRIPT_DIRECTORY}) +set(CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_SOURCE_NAME}") +set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_BINARY_NAME}") +set(CTEST_BUILD_CONFIGURATION "Release") +set(MODEL "Experimental") + +# build generator name, see cmake generator list +set(CTEST_CMAKE_GENERATOR "Unix Makefiles") + +# machine description, can be removed on linux +set(CTEST_SITE "machine.domain") +set(SITE_OS_NAME "os name") +set(SITE_OS_VERSION "os version") +set(SITE_OS_BITS "os size") +set(SITE_COMPILER_NAME "compiler name") +set(SITE_COMPILER_VERSION "compiler version") + + +# needed for source updates, change as required +set(REPOSITORY_URL "http://svn.hdfgroup.uiuc.edu/hdf5-examples/trunk/1_8") + +set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_INSTALL_PREFIX:PATH=/usr/local/hdf5Examples-1.8") + +# location of the installed hdf5 (cmake configuration folder) +set(ENV{HDF5_DIR} "/usr/share/cmake/hdf5") + +include(${CTEST_SCRIPT_DIRECTORY}/CTestScript.cmake) + +message("DONE") + Need further assistance, send email to help@hdfgroup.org diff --git a/release_docs/USING_Windows.txt b/release_docs/USING_Windows.txt index 9afbeb1..97ac4ad 100644 --- a/release_docs/USING_Windows.txt +++ b/release_docs/USING_Windows.txt @@ -4,626 +4,10 @@ * (Full Version) * *********************************************************************** -The following instructions assume that the HDF5 binary code package from -HDF website (http://hdfgroup.org) is used. +We now recommend that users build, test and install HDF5 using CMake. -Warnings: -Please read CAREFULLY about the following preconditions and notes first. - -Contents: - - Section : Preconditions and Notes - Section I : What do we provide? - Section II : How to build examples (optional) - Section III : How to build an application using the HDF5 library or DLL - Section IV : How to build HDF5 for 64-bit Windows - Section V : How to build HDF5 applications using Visual Studio 2010 - Section VI : Misc. - - -======================================================================== - Preconditions and Notes -======================================================================== - -Preconditions: - - 1. Installed Microsoft Visual Studio. This document is written for Visual - Studio 2008. Express Editions may work with the project files - but not from the command line. We do not support the Express Editions. - - 2. (Optional) Installed Intel Compiler 10.1 or 11.1 if you want to use HDF5 - Fortran libraries. - - 3. Install Winzip or 7-zip for extracting source tarball. - - Note: 1. 7zip is an open-source alternative to WinZip. Some of the - advanced functionality is disabled in WinZip unless you buy the - software. With 7zip, most of this functionality is included for - free. - - 5. Set up a directory structure to unpack the library. For example: - - c:\ (any drive) - MyHDFstuff\ (any folder name) - - 6. Download the hdf5-1.8.x binary code package and use 7zip or WinZip to - extract the HDF5 package into c:\MyHDFstuff. This creates a directory - called 'hdf5-1.8.x' under MyHDFstuff which contains several files and - directories. Rename "hdf5-1.8.x" to "hdf5". - - 7. HDF5 provide options to do in-memory compression within HDF5 library. - Currently, two external compression libraries Zlib and Szip can be used - with HDF5. - - 7.1 HDF5 uses Zlib version 1.2.5 for compression and Zlib is - distributed with HDF5 library in 1.8.x release. - - 7.2 HDF5 uses Szip version 2.1 for compression and Szip compression - software is provided with HDF5 products in 1.8.x release. - - Please note that Szip is not a totally open-source free software. - For licensing issue of Szip, please check "Licensing terms" at - http://hdfgroup.org/doc_resource/SZIP/index.html. - - Szip compression feature inside HDF5 is enabled by default. - - 8. Define the following environment variables: - - HDF5_EXT_ZLIB - HDF5_EXT_SZIP - - In this section, Zlib and Szip compression packages are assumed to be - used. Please read Section V as well as this section if you do not want - to use compression feature inside HDF5. - - To define these environment variables: - - Click "Start", click "Control Panel", and then double-click "System". - On the "Advanced" tab, click "Environment Variables". - - If you are logged on as administrator to the local computer AND want to - let all other users use these two environment variables, click "New" - under "System Variables" box; otherwise, click "New" under "User - Variables" box. - - In the New Variable window, set "Variable name" as HDF5_EXT_ZLIB and - "Variable value" as zlib.lib, then click OK. - - Similarly, you can set: - - HDF5_EXT_SZIP environment variable as szip.lib - - Notes: - - a. You will have to close and reopen running programs for the new - environment variable settings to take effect. - - b. c:\zlib\zlib.dll and c:\szip\dll\szip.dll should be copied - into a location that the application can find. - - 9. Set up path for libraries and headers - - Invoke Microsoft Visual Studio and go to "Tools" and select "Options", - find "Projects", and then "VC++ Directories". - - 9.1 If you are building on 64-bit Windows, find the "Platform" dropdown - and select "x64". - - 9.2 Find the box "Show directories for", choose "Include files", if you - can not find your HDF5 header path (for example, - c:\MyHDFstuff\include) from the directory list, add the - header path (c:\MyHDFstuff\include) to the included - directories. - - 9.3 Find the box "Show directories for", choose "Library files". If you - cannot find your HDF5 library path (for example, - c:\MyHDFstuff\dll for dynamic-shared and c:\MyHDFstuff\lib for static) - from the directory list, add the library - path (c:\MyHDFstuff\dll or c:\MyHDFstuff\lib) to the library directories. - - 9.4 If building Fortran applications, you will also need to setup the path - for the Intel Fortran compiler. Please see Section VI. - - NOTE: - If you are using VS2010, the path settings will need to be in project - property sheets per project. Go to "Project" and select "Properties", find - "Configuration Properties", and then "VC++ Directories". - - 9.1 If you are building on 64-bit Windows, find the "Platform" dropdown - and select "x64". - 9.2 Add the header path to the "Include Directories" setting. - 9.3 Add the library path to the "Library Directories" setting. - -Notes: - - 1. HDF4-related tools are not built and released with HDF5 library packages - any more. To obtain HDF4 related tools, please check - http://hdfgroup.org/h4toh5/ and ftp://ftp.hdfgroup.org/HDF5/h4toh5 - - 2. For Fortran users, Intel Fortran Compiler 10.1 is currently supported - -- please see Section VI. Intel Compiler 11.1 can be used but the project files - must be upgraded within the Visual Studio IDE. - - 3. The szip and zlib dlls must be in the PATH for using the tools (including static). - - -======================================================================== - Section I: What do we provide? -======================================================================== - - 1. Provide - - HDF5 static library: - release version - - HDF5 Dynamic Link Library(DLL): - release version as well as export libraries for DLL - - HDF5 High-Level Library (Optional): - HDF5 C++ Library - HDF5 HL-Fortran Library - - HDF5 tools: - HDF5 tools - - HDF5 tool library: - release version - - HDF5 tool export library for DLL: - release version - - 2. Examples (Included in the binary distribution as a zip file) - - Unpack the examples, hdf5-examples.zip, into your "hdf5" folder - (c:\MyHDFstuff\hdf5). - The resulting structure under this folder should be: - c++ - c++/examples - examples - fortran - fortran/examples - hl - hl/c++ - hl/c++/examples - hl/examples - hl/fortran - hl/fortran/examples - windows - windows/c++ - windows/c++/examples - windows/examples - windows/fortran - windows/fortran/examples - windows/hl - windows/hl/examples - windows/hl/fortran - windows/hl/fortran/examples - hdf5build_examples.bat - InstallExamples.bat - - HDF5 examples: - Simple HDF5 C/C++/Fortran and High level C/Fortran examples - -======================================================================== - Section II: How To Build Examples (Optional) -======================================================================== - -Simple examples have been provided for users to test HDF5 C/C++/Fortran and -High level C/Fortran library and tools. - -Note: - 1) To build HDF5 C++ examples, HDF5 C++ library must have been installed in - Step I. - - 2) To build HDF5 Fortran or HL Fortran examples, please see Section VI, - Step 3. - - 3) To build HDF5 High Level C examples, HDF5 High level library must have - been installed in step I. - - 4) By default, the HDF5 binary distribution only includes the release - versions of HDF5 C/C++ libraries and DLLs. - -To build and test HDF5 C examples: ----------------------------------- - 1. Invoke Microsoft Visual Studio, go to "File" and select the "Open - Solution" option. - - Then open the solution - c:\MyHDFstuff\hdf5examples\windows\examples\allexamples\allexamples.sln. - - 2. Select "Build", and "Configuration Manager". - - To build release versions of C examples. - - In "Active Solution Configuration", select "Release". Select "Close". - Select "Build" -> "Build Solution" or "Rebuild Solution" to build - release version of project "allexamples". - - When the release build is done, there should be the following - subdirectories in c:\MyHDFstuff\hdf5examples\examples\ - - attributetest - attributetestdll - chunkread - chunkreaddll - compoundtest - compoundtestdll - extendwritetest - extendwritetestdll - grouptest - grouptestdll - readtest - readtestdll - selectest - selectestdll - writetest - writetestdll - - 3. Invoke a command prompt window and run the batch file InstallExamples.bat - which resides in the top level directory (c:\MyHDFstuff\hdf5examples). This file - creates new directories, examplesREL, examplesRELDLL in the - c:\MyHDFstuff\hdf5examples\examples directory and places - all the executables in it. - - 4. We provide a batch file named testExamples.bat and an expected examples - tests output file named testExamples_exp_output.txt in - c:\MyHDFstuff\hdf5\examples directory for you to test HDF5 C examples. - - testExamples.bat batch file has options: - - testExamples release -- for release version - - testExamples release dll -- for release DLL version - - Invoke a command prompt and run testExamples.bat with appropriate options. - You should get "All HDF5 C examples tests passed." when the C examples are - built successfully. Otherwise, the difference between the expected - outputs and actual outputs will be given. - -To build and test HDF5 C++ examples: ------------------------------------- - - 1. Invoke Microsoft Visual Studio, go to "File" and select the "Open - Solution" option. - - Then open the solution - c:\MyHDFstuff\hdf5examples\windows\examples\allexamples\allcppexamples.sln. - - 2. Select "Build", and "Configuration Manager". - - To build release versions of C examples. - - In "Active Solution Configuration", select "Release". Select "Close". - Select "Build" -> "Build Solution" or "Rebuild Solution" to build - release version of project "allcppexamples". - - When the release build is done, there should be the following - subdirectories in c:\MyHDFstuff\hdf5examples\c++\examples\ - - chunks - chunksdll - compound - compounddll - create - createdll - extend_ds - extend_dsll - h5group - h5groupdll - readdata - readdatadll - writedata - writedatadll - - 3. Invoke a command prompt window and run the batch file - InstallcppExamples.bat which resides in the top level directory - (c:\MyHDFstuff\hdf5examples). This file creates new directories, - cppexamplesREL, cppexamplesRELDLL in the - c:\MyHDFstuff\hdf5examples\c++\examples directory and places all - the executables in it. - - 4. We provide a batch file named testcppExamples.bat in - c:\MyHDFstuff\hdf5examples\c++\examples directory for you to test HDF5 C++ - examples. - - testcppExamples.bat batch file has options: - - testcppExamples release -- for release version - - testcppExamples release dll -- for release DLL version - - Invoke a command prompt and run testcppExamples.bat with appropriate - options. You should get "All HDF5 C++ examples tests passed." when the - C++ examples are built successfully. Otherwise, the difference between - the expected outputs and actual outputs will be given. - - -To build and test HDF5 High Level C examples: ---------------------------------------------- - - 1. Invoke Microsoft Visual Studio, go to "File" and select the "Open - Solution" option. - - Then open the solution - c:\MyHDFstuff\hdf5examples\windows\hl\examples\allhlcexamples\allhlcexamples.sln - - 2. Select "Build", and "Configuration Manager". - - To build release versions of C examples. - - In "Active Solution Configuration", select "Release". Select "Close". - Select "Build" -> "Build Solution" or "Rebuild Solution" to build - release version of project "allhlcexamples". - - When the release build is done, binaries will be built in the - following subdirectories of c:\MyHDFstuff\hdf5\examples\ - - ex_image[1-2](dll) - ex_lite1(dll) - ex_table[01-12](dll) - ex_ds1(dll) - ptExample[FL+VL](dll) - - 3. Invoke a command prompt and run the batch file Install_hlcexamples.bat - which resides in the top level directory (c:\MyHDFstuff\hdf5examples). This file - creates new directories, HLCexamplesRELEASE, HLCexamplesRELEASEDLL in the - c:\MyHDFstuff\hdf5examples\hl\examples directory and places all the executables in - it. - - 4. We provide a batch file named test_hl_cexamples.bat in - c:\MyHDFstuff\hdf5examples\hl\examples directory for you to test HDF5 high level C - examples. - - test_hl_cexamples.bat batch file has options: - - Options purpose - - test_hl_cexamples release -- for release version - - test_hl_cexamples release dll -- for release DLL version - - Invoke a command prompt window and run test_hl_cexamples with - appropriate options. - - Invoke a command prompt and run testExamples.bat with appropriate options. - You should get "All of the HL C Examples Passed!" when the HL C examples - are built successfully. Otherwise, the difference between the expected - outputs and actual outputs will be given. - - -======================================================================== - Section III: Building an application using the HDF5 library or DLL -======================================================================== - -Waring: The instructions below will only describe how to build an application - using the release version of the HDF5 library or DLL. To use the debug - version of the HDF5 library or DLL, you need to substitute the release - version of the HDF5 library or DLL with the debug version. - - -To build an application that uses the HDF5 static library the following -locations will need to be specified for locating header files and linking with -the HDF static library, for example: - -c:\MyHDFstuff\hdf5\hdf5lib\release\include -c:\MyHDFstuff\hdf5\hdf5lib\release\lib - -We assume that you will use Zlib and Szip compression with HDF5 library. - -1. Specifying Include Directories - -To specify the include directories in the settings for your Visual Studio -project, you may choose one of the following two methods. - - Method One: Project-wide Settings - - 1. Open your project in Microsoft Visual Studio and make sure it is the - active project. - - 2. Go to the Project menu and chose the "Properties" option. - - 3. Choose the build configuration you would like to modify in the drop - down menu labeled "Configuration:" - - 4. Choose the "C/C++" tab, and select "General". - - 5. In a text-area labeled with "Additional Include Directories:", add - HDF5, Zlib, and Szip header files directories. For example: - - c:\MyHDFstuff\hdf5\hdf5lib\release\include - c:\zlib\include - c:\szip\include - - Then click OK. - - 6. (Optional) To use HDF5 Fortran static library, the location of - Fortran module files should be specified by following Project-> - Settings->Fortran->Preprocessor, and in the text-area labeled - "Additional Include Directories", add HDF5 Fortran module files - directories. For example: - - c:\MyHDFstuff\hdf5\hdf5lib\release\include - - Method Two: Visual Studio Settings - - 1. In Visual STudio, go to Tools->Options->Projects-> - VC++ Directories. Under "Show Directories For", select "Include files" - - 2. Insert the correct HDF5, Zlib, Szip paths for headers(include). For - example, - - c:\MyHDFstuff\hdf5\hdf5lib\release\include - c:\zlib\include - c:\szip\include - - -2. Specifying Library Directories - -To specify the library directories in the settings for your Visual Studio -project, you may choose one of the following two methods. - - Method One: Project-wide Settings - - 1. Open your project in Microsoft Visual Studio and make sure it is the - active project. - - 2. Go to the Project menu and chose the "Properties" option. - - 3. Choose the build configuration you would like to modify in the drop - down menu labeled "Configuration:" - - 4. Choose the "Linker" tab, and select "General". - - 5. In a text-area labeled with "Additional Library Directories:", add - HDF5, Zlib, and Szip library files directories. For example: - - c:\MyHDFstuff\hdf5\hdf5lib\release\lib - c:\zlib\dll - c:\szip\dll - - Note: To link with HDF5 DLLs rathern that static libraries, simply - specify the "dll" directory rather than "lib", and link with the - corresponding DLL link library below. - - Then click OK. - - - Method Two: Visual Studio Settings - - 1. In Visual STudio, go to Tools->Options->Projects-> - VC++ Directories. Under "Show Directories For", select "Library files" - - 2. Insert the correct HDF5, Zlib, Szip paths for link libraries. For - example, - - c:\MyHDFstuff\hdf5\hdf5lib\release\lib - c:\zlib\dll - c:\szip\dll - - Note: To link with HDF5 DLLs rathern that static libraries, simply - specify the "dll" directory rather than "lib", and link with the - corresponding DLL link library below. - - -3. Specifying Libraries to Link - - To link the HDF5 static library with your application: - - 1. In Visual Studio, go to the Project menu and choose "Properties". - - 2. Find the "Link" option and "Input" category. In the "Additional - Dependencies" field, insert "zlib.lib, libszip.lib, hdf5.lib". - - 3. (Optional) Also insert "hdf5_cpp.lib" if you want to use HDF5 C++ - static library. - - 4. (Optional) Also insert "hdf5_fortran.lib" if you want to use HDF5 - Fortran static library. - - 5. (Optional) Also insert "hdf5_hl.lib" if you want to use HDF5 high - level static library. - - 6. (Optional) Also insert "hdf5_hl_cpp.lib" if you want to use HDF5 High - Level C++ static library. - - 7. (Optional) Also insert "hdf5_hl_fortran.lib" if you want to use HDF5 - High Level Fortran static library. - - - To link the HDF5 DLL library with your application: - - 1. Follow the steps for linking the HDF5 static library as shown above, - except now link the export library that is created with the DLL. - - The export library is called hdf5dll.lib for HDF5 C libray, - hdf5_cppdll.lib for HDF5 C++ library, and hdf5_fortrandll.lib - for HDF5 Fortran library. - - 2. In the Project Properties dialog, go to the C/C++ > Preprocessor - subsection. In the "Preprocessor Definitions" box, add "_HDF5USEDLL_" - to the list. - - 3. (Optional) Also add HDF5CPP_USEDLL to use HDF5 C++ DLL. - - 4. (Optional) Also add _HDF5USEHLDLL_ to use HDF5 high level DLL. - - 5. (Optional) Also add HDF5USE_HLCPPDLL use HDF5 high level C++ DLL. - - 6. (Optional) Follow Project->Settings->Fortran->Category->General-> - Predefined Preprocess or Symbols, and add "HDF5F90_WINDOWS" to use HDF5 - Fortran DLL. - - 7. Place the DLLs in a location that Windows will be able to locate. The - searched path and order for DLL's is - - a) The directory where the executable module for the current - process is located. - b) The current directory. - c} The Windows system directory. The GetSystemDirectory function - retrieves the path of this directory. - d) The Windows directory. The GetWindowsDirectory function - retrieves the path of this directory. - e) The directories listed in the PATH environment variable. - - -======================================================================== - Section IV: How to build HDF5 for 64-bit Windows -======================================================================== - -HDF5 is available for 64-bit Windows in Visual Studio 2008. - -Prerequisites: - - 1. A 64-bit Windows machine. - - 2. Microsoft Visual Studio 2008 installed with x64 Extensions. - - -Building: - - Building 64-bit Windows binaries is very similar to the process for 32-bit. - Therefore, you may follow the instructions in Section II with the following - modifications. - - 1. The x64 platform must be selected in the build configuration for - debug and release versions. Before building, go to "Build", - "Configuration Manager". In the "Active solution platform" box, - select "x64", and press "Close". - - 2. 64-bit HDF5 applications must be built with 64-bit external libraries. - You must add the include and - library paths for x64 configurations as you have in the - "Prerequisites" section. This is also true for Intel Fortran if - Fortran libraries are to be built. - -======================================================================== - Section V: How to build HDF5 applications using Visual Studio 2010 -======================================================================== -Building with Visual Studio 2010 is very similar to building with Visual Studio -2008, with some minor changes. Therefore, follow the build instructions above, -with the following considerations: - - 1. Visual Studio 2010 uses a new format for project files, but Visual Studio - 2008 project files can be converted. The HDF5 project files - will need to be converted on first use. To do so: - - 1.1. Open the HDF5 Visual Studio 2008 solution file as in Section II - (all.sln) - - NOTE. Intel Fortran 11.1 currently does not integrate with Visual Studio 2010. - - 1.2. You will be prompted with an automatic conversion wizard. Click - through, accepting the default values. You may choose to create - backups of the project files, although it isn't necessary. - - 1.3. When it is finished, it should state that all projects were - converted successfully with no errors. Warnings can be ignored. - - 2. Once the project files have been converted you will need to create project - property sheets for the library and include paths. Then build and test normally. - Note that the converted project files aren't backwards compatible with - previous versions of Visual Studio. +Instructions for building and testing HDF5 applications using CMake can be found in +the USING_CMake.txt file found in this folder. ======================================================================== @@ -635,26 +19,7 @@ with the following considerations: Here are some helpful notes if you are not familiar with using the Visual C++ Development Environment. - 1.1 Project name and location issues: - - It is recommended that you use the given directory structure for building - HDF5 Examples. However, it is possible to create your own structure. If you must - install all.sln and all.vcproj in another directory, relative to hdf5 - directory, you will be asked to locate the sub-project files, when you open - the project all.sln. - - If you want to rename "all" (the entire project), you will need to modify - two files all.sln and all.vcproj as text (contrary to the explicit warnings - in the files). - - - 1.2 Settings... details: - - If you create your own project, the necessary settings can be read - from the all.vcproj file (as text), or from the Project Settings in the - Visual Studio project settings dialog. - - 1.3 FAQ + 1.1 FAQ Many other common questions and hints are located online and being updated in the HDF5 FAQ. For Windows-specific questions, please see: diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3cbfe7e..31b7f3d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.6) +cmake_minimum_required (VERSION 2.8.10) PROJECT (HDF5_SRC C CXX) #----------------------------------------------------------------------------- diff --git a/src/H5.c b/src/H5.c index 4176d96..14ec7ca 100644 --- a/src/H5.c +++ b/src/H5.c @@ -714,14 +714,14 @@ H5check_version(unsigned majnum, unsigned minnum, unsigned relnum) if (!disable_version_check){ /* - *verify if H5_VERS_INFO is consistent with the other version information. - *Check only the first sizeof(lib_str) char. Assume the information - *will fit within this size or enough significance. + * Verify if H5_VERS_INFO is consistent with the other version information. + * Check only the first sizeof(lib_str) char. Assume the information + * will fit within this size or enough significance. */ - sprintf(lib_str, "HDF5 library version: %d.%d.%d", + HDsnprintf(lib_str, sizeof(lib_str), "HDF5 library version: %d.%d.%d", H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE); if(*substr) { - HDstrcat(lib_str, "-"); + HDstrncat(lib_str, "-", 1); HDstrncat(lib_str, substr, (sizeof(lib_str) - HDstrlen(lib_str)) - 1); } /* end if */ if (HDstrcmp(lib_str, H5_lib_vers_info_g)){ diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 0471ccd..fb4f35f 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -287,6 +287,108 @@ H5FL_DEFINE(H5D_chunk_info_t); /* Declare a free list to manage the chunk sequence information */ H5FL_BLK_DEFINE_STATIC(chunk); + +/*------------------------------------------------------------------------- + * Function: H5D__chunk_direct_write + * + * Purpose: Internal routine to write a chunk + * directly into the file. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Raymond Lu + * 30 July 2012 + * + *------------------------------------------------------------------------- + */ +herr_t +H5D__chunk_direct_write(const H5D_t *dset, hid_t dxpl_id, uint32_t filters, hsize_t *offset, + size_t data_size, const void *buf) +{ + const H5O_layout_t *layout = &(dset->shared->layout); /* Dataset layout */ + H5D_chunk_ud_t udata; /* User data for querying chunk info */ + hsize_t chunk_idx; + H5D_dxpl_cache_t _dxpl_cache; /* Data transfer property cache buffer */ + H5D_dxpl_cache_t *dxpl_cache = &_dxpl_cache; /* Data transfer property cache */ + const H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); /*raw data chunk cache */ + int space_ndims; /* Dataset's space rank */ + hsize_t space_dim[H5O_LAYOUT_NDIMS]; /* Dataset's dataspace dimensions */ + H5FD_t *lf; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC_TAG(dxpl_id, dset->oloc.addr, FAIL) + + /* Allocate data space and initialize it if it hasn't been. */ + if(!(*dset->shared->layout.ops->is_space_alloc)(&dset->shared->layout.storage)) { + /* Allocate storage */ + if(H5D__alloc_storage(dset, dxpl_id, H5D_ALLOC_WRITE, FALSE, NULL) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize storage") + } /* end if */ + + + /* Retrieve the dataset dimensions */ + if((space_ndims = H5S_get_simple_extent_dims(dset->shared->space, space_dim, NULL)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to get simple dataspace info") + + /* Calculate the index of this chunk */ + if(H5V_chunk_index((unsigned)space_ndims, offset, + layout->u.chunk.dim, layout->u.chunk.down_chunks, &chunk_idx) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't get chunk index") + + /* Find out the file address of the chunk */ + if(H5D__chunk_lookup(dset, dxpl_id, offset, chunk_idx, + &udata) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address") + + udata.filter_mask = filters; + + /* Check if the chunk needs to be 'inserted' (could exist already and + * the 'insert' operation could resize it) + */ + { + H5D_chk_idx_info_t idx_info; /* Chunked index info */ + + /* Compose chunked index info struct */ + idx_info.f = dset->oloc.file; + idx_info.dxpl_id = dxpl_id; + idx_info.pline = &(dset->shared->dcpl_cache.pline); + idx_info.layout = &(dset->shared->layout.u.chunk); + idx_info.storage = &(dset->shared->layout.storage.u.chunk); + + /* Set up the size of chunk for user data */ + udata.nbytes = data_size; + + /* Create the chunk it if it doesn't exist, or reallocate the chunk + * if its size changed. + */ + if((dset->shared->layout.storage.u.chunk.ops->insert)(&idx_info, &udata) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert/resize chunk") + + /* Make sure the address of the chunk is returned. */ + if(!H5F_addr_defined(udata.addr)) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "chunk address isn't defined") + } /* end if */ + + /* Fill the DXPL cache values for later use */ + if(H5D__get_dxpl_cache(dxpl_id, &dxpl_cache) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't fill dxpl cache") + + /* Evict the entry from the cache if present, but do not flush + * it to disk */ + if(UINT_MAX != udata.idx_hint) { + if(H5D__chunk_cache_evict(dset, dxpl_id, dxpl_cache, + rdcc->slot[udata.idx_hint], FALSE) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTREMOVE, FAIL, "unable to evict chunk") + } /* end if */ + + /* Write the data to the file */ + if(H5F_block_write(dset->oloc.file, H5FD_MEM_DRAW, udata.addr, data_size, dxpl_id, buf) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to write raw data to file") + + +done: + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) +} /*------------------------------------------------------------------------- diff --git a/src/H5Dio.c b/src/H5Dio.c index 1bd6dae..df1c4a3 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -28,6 +28,8 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5FLprivate.h" /* Free Lists */ #include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Sprivate.h" /* Dataspace */ #ifdef H5_HAVE_PARALLEL /* Remove this if H5R_DATASET_REGION is no longer used in this file */ @@ -56,6 +58,8 @@ static herr_t H5D__read(H5D_t *dataset, hid_t mem_type_id, static herr_t H5D__write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, const H5S_t *file_space, hid_t dset_xfer_plist, const void *buf); +static herr_t H5D__pre_write(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, + hid_t file_space_id, hid_t dxpl_id, const void *buf); /* Setup/teardown routines */ static herr_t H5D__ioinfo_init(H5D_t *dset, const H5D_dxpl_cache_t *dxpl_cache, @@ -136,6 +140,10 @@ H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") if(NULL == dset->oloc.file) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") + + if(mem_space_id < 0 || file_space_id < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space") + if(H5S_ALL != mem_space_id) { if(NULL == (mem_space = (const H5S_t *)H5I_object_verify(mem_space_id, H5I_DATASPACE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space") @@ -213,37 +221,51 @@ herr_t H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id, const void *buf) { - H5D_t *dset = NULL; - const H5S_t *mem_space = NULL; - const H5S_t *file_space = NULL; - char fake_char; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE6("e", "iiiii*x", dset_id, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf); + if(!dset_id) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") + + if(H5D__pre_write(dset_id, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't prepare for writing data") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Dwrite() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__pre_write + * + * Purpose: Preparation for writing data. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Raymond Lu + * 2 November 2012 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__pre_write(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, + hid_t file_space_id, hid_t dxpl_id, const void *buf) +{ + H5D_t *dset = NULL; + H5P_genplist_t *plist; /* Property list pointer */ + hbool_t direct_write = FALSE; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + /* check arguments */ if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") if(NULL == dset->oloc.file) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") - if(H5S_ALL != mem_space_id) { - if(NULL == (mem_space = (const H5S_t *)H5I_object_verify(mem_space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space") - - /* Check for valid selection */ - if(H5S_SELECT_VALID(mem_space) != TRUE) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "memory selection+offset not within extent") - } /* end if */ - if(H5S_ALL != file_space_id) { - if(NULL == (file_space = (const H5S_t *)H5I_object_verify(file_space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space") - - /* Check for valid selection */ - if(H5S_SELECT_VALID(file_space) != TRUE) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "file selection+offset not within extent") - } /* end if */ + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") /* Get the default dataset transfer property list if the user didn't provide one */ if(H5P_DEFAULT == dxpl_id) @@ -251,23 +273,102 @@ H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, else if(TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms") - if(!buf && (NULL == file_space || H5S_GET_SELECT_NPOINTS(file_space) != 0)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no output buffer") - /* If the buffer is nil, and 0 element is selected, make a fake buffer. - * This is for some MPI package like ChaMPIon on NCSA's tungsten which - * doesn't support this feature. - */ - if(!buf) - buf = &fake_char; + /* Get the dataset transfer property list */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list") + + if(H5P_get(plist, H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_NAME, &direct_write) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "error getting flag for direct chunk write") + + /* Direct chunk write */ + if(direct_write) { + uint32_t direct_filters = 0; + hsize_t *direct_offset; + size_t direct_datasize = 0; + int ndims = 0; + hsize_t dims[H5O_LAYOUT_NDIMS]; + hsize_t internal_offset[H5O_LAYOUT_NDIMS]; + int i; + + if(H5D_CHUNKED != dset->shared->layout.type) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset") + + if(H5P_get(plist, H5D_XFER_DIRECT_CHUNK_WRITE_FILTERS_NAME, &direct_filters) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "error getting filter info for direct chunk write") + + if(H5P_get(plist, H5D_XFER_DIRECT_CHUNK_WRITE_OFFSET_NAME, &direct_offset) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "error getting offset info for direct chunk write") + + if(H5P_get(plist, H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_NAME, &direct_datasize) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "error getting data size for direct chunk write") + + /* The library's chunking code requires the offset terminates with a zero. So transfer the + * offset array to an internal offset array */ + if((ndims = H5S_get_simple_extent_dims(dset->shared->space, dims, NULL)) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't retrieve dataspace extent dims") + + for(i=0; i dims[i]) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "offset exceeds dimensions of dataset") + + /* Make sure the offset fall right on a chunk's boundary */ + if(direct_offset[i] % dset->shared->layout.u.chunk.dim[i]) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "offset doesn't fall on chunks's boundary") + + internal_offset[i] = direct_offset[i]; + } + + /* Terminate the offset with a zero */ + internal_offset[ndims] = 0; + + /* write raw data */ + if(H5D__chunk_direct_write(dset, dxpl_id, direct_filters, internal_offset, direct_datasize, buf) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write chunk directly") + } else { /* Normal write */ + const H5S_t *mem_space = NULL; + const H5S_t *file_space = NULL; + char fake_char; + + if(mem_space_id < 0 || file_space_id < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space") - /* write raw data */ - if(H5D__write(dset, mem_type_id, mem_space, file_space, dxpl_id, buf) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write data") + if(H5S_ALL != mem_space_id) { + if(NULL == (mem_space = (const H5S_t *)H5I_object_verify(mem_space_id, H5I_DATASPACE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space") + + /* Check for valid selection */ + if(H5S_SELECT_VALID(mem_space) != TRUE) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "memory selection+offset not within extent") + } /* end if */ + if(H5S_ALL != file_space_id) { + if(NULL == (file_space = (const H5S_t *)H5I_object_verify(file_space_id, H5I_DATASPACE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space") + + /* Check for valid selection */ + if(H5S_SELECT_VALID(file_space) != TRUE) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "file selection+offset not within extent") + } /* end if */ + + if(!buf && (NULL == file_space || H5S_GET_SELECT_NPOINTS(file_space) != 0)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no output buffer") + + /* If the buffer is nil, and 0 element is selected, make a fake buffer. + * This is for some MPI package like ChaMPIon on NCSA's tungsten which + * doesn't support this feature. + */ + if(!buf) + buf = &fake_char; + + /* write raw data */ + if(H5D__write(dset, mem_type_id, mem_space, file_space, dxpl_id, buf) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write data") + } done: - FUNC_LEAVE_API(ret_value) -} /* end H5Dwrite() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__pre_write() */ /*------------------------------------------------------------------------- diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h index ae55c44..2f0cceb 100644 --- a/src/H5Dprivate.h +++ b/src/H5Dprivate.h @@ -175,5 +175,8 @@ H5_DLL herr_t H5D_chunk_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_ad H5_DLL herr_t H5D_btree_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent, int fwidth, unsigned ndims); +H5_DLL herr_t H5D__chunk_direct_write(const H5D_t *dset, hid_t dxpl_id, uint32_t filters, + hsize_t *offset, size_t data_size, const void *buf); + #endif /* _H5Dprivate_H */ diff --git a/src/H5Dpublic.h b/src/H5Dpublic.h index a96755a..9a97627 100644 --- a/src/H5Dpublic.h +++ b/src/H5Dpublic.h @@ -37,6 +37,12 @@ /* Bit flags for the H5Pset_chunk_opts() and H5Pget_chunk_opts() */ #define H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS (0x0002u) +/* Property names for H5LTDdirect_chunk_write */ +#define H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_NAME "direct_chunk_flag" +#define H5D_XFER_DIRECT_CHUNK_WRITE_FILTERS_NAME "direct_chunk_filters" +#define H5D_XFER_DIRECT_CHUNK_WRITE_OFFSET_NAME "direct_chunk_offset" +#define H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_NAME "direct_chunk_datasize" + /*******************/ /* Public Typedefs */ /*******************/ @@ -109,6 +115,15 @@ extern "C" { typedef herr_t (*H5D_operator_t)(void *elem, hid_t type_id, unsigned ndim, const hsize_t *point, void *operator_data); +/* Define the operator function pointer for H5Dscatter() */ +typedef herr_t (*H5D_scatter_func_t)(void **src_buf/*out*/, + size_t *src_buf_bytes_used/*out*/, + void *op_data); + +/* Define the operator function pointer for H5Dgather() */ +typedef herr_t (*H5D_gather_func_t)(const void *dst_buf, + size_t dst_buf_bytes_used, void *op_data); + H5_DLL hid_t H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, hid_t lcpl_id, hid_t dcpl_id, hid_t dapl_id); H5_DLL hid_t H5Dcreate_anon(hid_t file_id, hid_t type_id, hid_t space_id, @@ -135,6 +150,10 @@ H5_DLL herr_t H5Dfill(const void *fill, hid_t fill_type, void *buf, H5_DLL herr_t H5Dset_extent(hid_t dset_id, const hsize_t size[]); H5_DLL herr_t H5Dflush(hid_t dset_id); H5_DLL herr_t H5Drefresh(hid_t dset_id); +H5_DLL herr_t H5Dscatter(H5D_scatter_func_t op, void *op_data, hid_t type_id, + hid_t dst_space_id, void *dst_buf); +H5_DLL herr_t H5Dgather(hid_t src_space_id, void *src_buf, hid_t type_id, + size_t dst_buf_size, void *dst_buf, H5D_gather_func_t op, void *op_data); H5_DLL herr_t H5Ddebug(hid_t dset_id); /* Symbols defined for compatibility with previous versions of the HDF5 API. diff --git a/src/H5Dscatgath.c b/src/H5Dscatgath.c index 49b6132..60a8800 100644 --- a/src/H5Dscatgath.c +++ b/src/H5Dscatgath.c @@ -27,6 +27,7 @@ #include "H5Dpkg.h" /* Dataset functions */ #include "H5Eprivate.h" /* Error handling */ #include "H5FLprivate.h" /* Free Lists */ +#include "H5Iprivate.h" /* IDs */ /****************/ @@ -361,7 +362,7 @@ done: * copies them into the gather buffer TGATH_BUF. * Each element is ELMT_SIZE bytes and arranged in application * memory according to SPACE. - * The caller is requesting that at most NELMTS be gathered. + * The caller is requesting that exactly NELMTS be gathered. * * Return: Success: Number of elements copied. * Failure: 0 @@ -899,3 +900,204 @@ H5D__compound_opt_write(size_t nelmts, const H5D_type_info_t *type_info) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5D__compound_opt_write() */ + +/*------------------------------------------------------------------------- + * Function: H5Dscatter + * + * Purpose: Scatters data provided by the callback op to the + * destination buffer dst_buf, where the dimensions of + * dst_buf and the selection to be scattered to are specified + * by the dataspace dst_space_id. The type of the data to be + * scattered is specified by type_id. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Neil Fortner + * 14 Jan 2013 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Dscatter(H5D_scatter_func_t op, void *op_data, hid_t type_id, + hid_t dst_space_id, void *dst_buf) +{ + H5T_t *type; /* Datatype */ + H5S_t *dst_space; /* Dataspace */ + H5S_sel_iter_t iter; /* Selection iteration info*/ + hbool_t iter_init = FALSE; /* Selection iteration info has been initialized */ + void *src_buf = NULL; /* Source (contiguous) data buffer */ + size_t src_buf_nbytes = 0; /* Size of src_buf */ + size_t type_size; /* Datatype element size */ + hssize_t nelmts; /* Number of remaining elements in selection */ + size_t nelmts_scatter = 0; /* Number of elements to scatter to dst_buf */ + H5D_dxpl_cache_t _dxpl_cache; /* Data transfer property cache buffer */ + H5D_dxpl_cache_t *dxpl_cache = &_dxpl_cache; /* Data transfer property cache */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE5("e", "x*xii*x", op, op_data, type_id, dst_space_id, dst_buf); + + /* Check args */ + if(op == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid callback function pointer") + if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + if(NULL == (dst_space= (H5S_t *)H5I_object_verify(dst_space_id, H5I_DATASPACE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + if(dst_buf == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no destination buffer provided") + + /* Fill the DXPL cache values for later use */ + if(H5D__get_dxpl_cache(H5P_DATASET_XFER_DEFAULT, &dxpl_cache) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't fill dxpl cache") + + /* Get datatype element size */ + if(0 == (type_size = H5T_GET_SIZE(type))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get datatype size") + + /* Get number of elements in dataspace */ + if((nelmts = (hssize_t)H5S_GET_SELECT_NPOINTS(dst_space)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "unable to get number of elements in selection") + + /* Initialize selection iterator */ + if(H5S_select_iter_init(&iter, dst_space, type_size) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize selection iterator information") + iter_init = TRUE; + + /* Loop until all data has been scattered */ + while(nelmts > 0) { + /* Make callback to retrieve data */ + if(op(&src_buf, &src_buf_nbytes, op_data) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CALLBACK, FAIL, "callback operator returned failure") + + /* Calculate number of elements */ + nelmts_scatter = src_buf_nbytes / type_size; + + /* Check callback results */ + if(!src_buf) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "callback did not return a buffer") + if(src_buf_nbytes == 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "callback returned a buffer size of 0") + if(src_buf_nbytes % type_size) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "buffer size is not a multiple of datatype size") + if(nelmts_scatter > (size_t)nelmts) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "callback returned more elements than in selection") + + /* Scatter data */ + if(H5D__scatter_mem(src_buf, dst_space, &iter, nelmts_scatter, dxpl_cache, dst_buf) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "scatter failed") + + nelmts -= (hssize_t)nelmts_scatter; + } /* end while */ + +done: + /* Release selection iterator */ + if(iter_init) { + if(H5S_SELECT_ITER_RELEASE(&iter) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator") + } /* end if */ + + FUNC_LEAVE_API(ret_value) +} /* H5Dscatter() */ + + +/*------------------------------------------------------------------------- + * Function: H5Dgather + * + * Purpose: Gathers data provided from the source buffer src_buf to + * contiguous buffer dst_buf, then calls the callback op. + * The dimensions of src_buf and the selection to be gathered + * are specified by the dataspace src_space_id. The type of + * the data to be gathered is specified by type_id. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Neil Fortner + * 16 Jan 2013 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Dgather(hid_t src_space_id, void *src_buf, hid_t type_id, size_t dst_buf_size, + void *dst_buf, H5D_gather_func_t op, void *op_data) +{ + H5T_t *type; /* Datatype */ + H5S_t *src_space; /* Dataspace */ + H5S_sel_iter_t iter; /* Selection iteration info*/ + hbool_t iter_init = FALSE; /* Selection iteration info has been initialized */ + size_t type_size; /* Datatype element size */ + hssize_t nelmts; /* Number of remaining elements in selection */ + size_t dst_buf_nelmts; /* Number of elements that can fit in dst_buf */ + size_t nelmts_gathered; /* Number of elements gathered from src_buf */ + H5D_dxpl_cache_t _dxpl_cache; /* Data transfer property cache buffer */ + H5D_dxpl_cache_t *dxpl_cache = &_dxpl_cache; /* Data transfer property cache */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE7("e", "i*xiz*xx*x", src_space_id, src_buf, type_id, dst_buf_size, + dst_buf, op, op_data); + + /* Check args */ + if(NULL == (src_space= (H5S_t *)H5I_object_verify(src_space_id, H5I_DATASPACE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + if(src_buf == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no source buffer provided") + if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + if(dst_buf_size == 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "destination buffer size is 0") + if(dst_buf == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no destination buffer provided") + + /* Fill the DXPL cache values for later use */ + if(H5D__get_dxpl_cache(H5P_DATASET_XFER_DEFAULT, &dxpl_cache) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't fill dxpl cache") + + /* Get datatype element size */ + if(0 == (type_size = H5T_GET_SIZE(type))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get datatype size") + + /* Get number of elements in dst_buf_size */ + dst_buf_nelmts = dst_buf_size / type_size; + if(dst_buf_nelmts == 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "destination buffer is not large enough to hold one element") + + /* Get number of elements in dataspace */ + if((nelmts = (hssize_t)H5S_GET_SELECT_NPOINTS(src_space)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "unable to get number of elements in selection") + + /* If dst_buf is not large enough to hold all the elements, make sure there + * is a callback */ + if(((size_t)nelmts > dst_buf_nelmts) && (op == NULL)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback supplied and destination buffer too small") + + /* Initialize selection iterator */ + if(H5S_select_iter_init(&iter, src_space, type_size) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize selection iterator information") + iter_init = TRUE; + + /* Loop until all data has been scattered */ + while(nelmts > 0) { + /* Gather data */ + if(0 == (nelmts_gathered = H5D__gather_mem(src_buf, src_space, &iter, MIN(dst_buf_nelmts, (size_t)nelmts), dxpl_cache, dst_buf))) + HGOTO_ERROR(H5E_IO, H5E_CANTCOPY, FAIL, "gather failed") + HDassert(nelmts_gathered == MIN(dst_buf_nelmts, (size_t)nelmts)); + + /* Make callback to process dst_buf */ + if(op && op(dst_buf, nelmts_gathered * type_size, op_data) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CALLBACK, FAIL, "callback operator returned failure") + + nelmts -= (hssize_t)nelmts_gathered; + HDassert(op || (nelmts == 0)); + } /* end while */ + +done: + /* Release selection iterator */ + if(iter_init) { + if(H5S_SELECT_ITER_RELEASE(&iter) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator") + } /* end if */ + + FUNC_LEAVE_API(ret_value) +} /* H5Dgather() */ + diff --git a/src/H5FDcore.c b/src/H5FDcore.c index 9b4aadc..b51ea8c 100644 --- a/src/H5FDcore.c +++ b/src/H5FDcore.c @@ -17,57 +17,40 @@ * Programmer: Robb Matzke * Tuesday, August 10, 1999 * - * Purpose: A driver which stores the HDF5 data in main memory using - * only the HDF5 public API. This driver is useful for fast - * access to small, temporary hdf5 files. + * Purpose: A driver which stores the HDF5 data in main memory using + * only the HDF5 public API. This driver is useful for fast + * access to small, temporary hdf5 files. */ /* Interface initialization */ #define H5_INTERFACE_INIT_FUNC H5FD_core_init_interface -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fprivate.h" /* File access */ -#include "H5FDprivate.h" /* File drivers */ -#include "H5FDcore.h" /* Core file driver */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Pprivate.h" /* Property lists */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* File access */ +#include "H5FDprivate.h" /* File drivers */ +#include "H5FDcore.h" /* Core file driver */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Pprivate.h" /* Property lists */ /* The driver identification number, initialized at runtime */ static hid_t H5FD_CORE_g = 0; -/* Since Windows doesn't follow the rest of the world when it comes - * to POSIX I/O types, some typedefs and constants are needed to avoid - * making the code messy with #ifdefs. - * NOTE: These are only used when writing data to the backing store on - * file close. - */ -#ifdef H5_HAVE_WIN32_API -typedef unsigned int h5_core_io_t; -typedef int h5_core_io_ret_t; -static int H5_CORE_MAX_IO_BYTES_g = INT_MAX; -#else -/* Unix, everyone else */ -typedef size_t h5_core_io_t; -typedef ssize_t h5_core_io_ret_t; -static size_t H5_CORE_MAX_IO_BYTES_g = SSIZET_MAX; -#endif /* H5_HAVE_WIN32_API */ - -/* The description of a file belonging to this driver. The `eoa' and `eof' +/* The description of a file belonging to this driver. The 'eoa' and 'eof' * determine the amount of hdf5 address space in use and the high-water mark * of the file (the current size of the underlying memory). */ typedef struct H5FD_core_t { - H5FD_t pub; /*public stuff, must be first */ - char *name; /*for equivalence testing */ - unsigned char *mem; /*the underlying memory */ - haddr_t eoa; /*end of allocated region */ - haddr_t eof; /*current allocated size */ - size_t increment; /*multiples for mem allocation */ - hbool_t backing_store; /*write to file name on flush */ - int fd; /*backing store file descriptor */ + H5FD_t pub; /* public stuff, must be first */ + char *name; /* for equivalence testing */ + unsigned char *mem; /* the underlying memory */ + haddr_t eoa; /* end of allocated region */ + haddr_t eof; /* current allocated size */ + size_t increment; /* multiples for mem allocation */ + hbool_t backing_store; /* write to file name on flush */ + int fd; /* backing store file descriptor */ /* Information for determining uniqueness of a file with a backing store */ #ifndef H5_HAVE_WIN32_API /* On most systems the combination of device and i-node number uniquely @@ -100,8 +83,8 @@ typedef struct H5FD_core_t { HANDLE hFile; /* Native windows file handle */ #endif /* H5_HAVE_WIN32_API */ - hbool_t dirty; /*changes not saved? */ - H5FD_file_image_callbacks_t fi_callbacks; /* file image callbacks */ + hbool_t dirty; /* changes not saved? */ + H5FD_file_image_callbacks_t fi_callbacks; /* file image callbacks */ /* Information from file open flags, for SWMR access */ hbool_t swmr_read; /* Whether the file is open for SWMR read access */ @@ -109,38 +92,38 @@ typedef struct H5FD_core_t { /* Driver-specific file access properties */ typedef struct H5FD_core_fapl_t { - size_t increment; /*how much to grow memory */ - hbool_t backing_store; /*write to file name on flush */ + size_t increment; /* how much to grow memory */ + hbool_t backing_store; /* write to file name on flush */ } H5FD_core_fapl_t; /* Allocate memory in multiples of this size by default */ -#define H5FD_CORE_INCREMENT 8192 +#define H5FD_CORE_INCREMENT 8192 /* These macros check for overflow of various quantities. These macros * assume that file_offset_t is signed and haddr_t and size_t are unsigned. * - * ADDR_OVERFLOW: Checks whether a file address of type `haddr_t' - * is too large to be represented by the second argument - * of the file seek function. + * ADDR_OVERFLOW: Checks whether a file address of type `haddr_t' + * is too large to be represented by the second argument + * of the file seek function. * - * SIZE_OVERFLOW: Checks whether a buffer size of type `hsize_t' is too - * large to be represented by the `size_t' type. + * SIZE_OVERFLOW: Checks whether a buffer size of type `hsize_t' is too + * large to be represented by the `size_t' type. * - * REGION_OVERFLOW: Checks whether an address and size pair describe data - * which can be addressed entirely in memory. + * REGION_OVERFLOW: Checks whether an address and size pair describe data + * which can be addressed entirely in memory. */ -#define MAXADDR ((haddr_t)((~(size_t)0)-1)) -#define ADDR_OVERFLOW(A) (HADDR_UNDEF==(A) || (A) > (haddr_t)MAXADDR) -#define SIZE_OVERFLOW(Z) ((Z) > (hsize_t)MAXADDR) -#define REGION_OVERFLOW(A,Z) (ADDR_OVERFLOW(A) || SIZE_OVERFLOW(Z) || \ - HADDR_UNDEF==(A)+(Z) || \ - (size_t)((A)+(Z))<(size_t)(A)) +#define MAXADDR ((haddr_t)((~(size_t)0)-1)) +#define ADDR_OVERFLOW(A) (HADDR_UNDEF==(A) || (A) > (haddr_t)MAXADDR) +#define SIZE_OVERFLOW(Z) ((Z) > (hsize_t)MAXADDR) +#define REGION_OVERFLOW(A,Z) (ADDR_OVERFLOW(A) || SIZE_OVERFLOW(Z) || \ + HADDR_UNDEF==(A)+(Z) || \ + (size_t)((A)+(Z))<(size_t)(A)) /* Prototypes */ static herr_t H5FD_core_term(void); static void *H5FD_core_fapl_get(H5FD_t *_file); static H5FD_t *H5FD_core_open(const char *name, unsigned flags, hid_t fapl_id, - haddr_t maxaddr); + haddr_t maxaddr); static herr_t H5FD_core_close(H5FD_t *_file); static int H5FD_core_cmp(const H5FD_t *_f1, const H5FD_t *_f2); static herr_t H5FD_core_query(const H5FD_t *_f1, unsigned long *flags); @@ -149,61 +132,58 @@ static herr_t H5FD_core_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr); static haddr_t H5FD_core_get_eof(const H5FD_t *_file); static herr_t H5FD_core_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle); static herr_t H5FD_core_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, - size_t size, void *buf); + size_t size, void *buf); static herr_t H5FD_core_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, - size_t size, const void *buf); + size_t size, const void *buf); static herr_t H5FD_core_flush(H5FD_t *_file, hid_t dxpl_id, unsigned closing); static herr_t H5FD_core_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); static const H5FD_class_t H5FD_core_g = { - "core", /*name */ - MAXADDR, /*maxaddr */ - H5F_CLOSE_WEAK, /*fc_degree */ - H5FD_core_term, /*terminate */ - NULL, /*sb_size */ - NULL, /*sb_encode */ - NULL, /*sb_decode */ - sizeof(H5FD_core_fapl_t), /*fapl_size */ - H5FD_core_fapl_get, /*fapl_get */ - NULL, /*fapl_copy */ - NULL, /*fapl_free */ - 0, /*dxpl_size */ - NULL, /*dxpl_copy */ - NULL, /*dxpl_free */ - H5FD_core_open, /*open */ - H5FD_core_close, /*close */ - H5FD_core_cmp, /*cmp */ - H5FD_core_query, /*query */ - NULL, /*get_type_map */ - NULL, /*alloc */ - NULL, /*free */ - H5FD_core_get_eoa, /*get_eoa */ - H5FD_core_set_eoa, /*set_eoa */ - H5FD_core_get_eof, /*get_eof */ - H5FD_core_get_handle, /*get_handle */ - H5FD_core_read, /*read */ - H5FD_core_write, /*write */ - H5FD_core_flush, /*flush */ - H5FD_core_truncate, /*truncate */ - NULL, /*lock */ - NULL, /*unlock */ - H5FD_FLMAP_DICHOTOMY /*fl_map */ + "core", /* name */ + MAXADDR, /* maxaddr */ + H5F_CLOSE_WEAK, /* fc_degree */ + H5FD_core_term, /* terminate */ + NULL, /* sb_size */ + NULL, /* sb_encode */ + NULL, /* sb_decode */ + sizeof(H5FD_core_fapl_t), /* fapl_size */ + H5FD_core_fapl_get, /* fapl_get */ + NULL, /* fapl_copy */ + NULL, /* fapl_free */ + 0, /* dxpl_size */ + NULL, /* dxpl_copy */ + NULL, /* dxpl_free */ + H5FD_core_open, /* open */ + H5FD_core_close, /* close */ + H5FD_core_cmp, /* cmp */ + H5FD_core_query, /* query */ + NULL, /* get_type_map */ + NULL, /* alloc */ + NULL, /* free */ + H5FD_core_get_eoa, /* get_eoa */ + H5FD_core_set_eoa, /* set_eoa */ + H5FD_core_get_eof, /* get_eof */ + H5FD_core_get_handle, /* get_handle */ + H5FD_core_read, /* read */ + H5FD_core_write, /* write */ + H5FD_core_flush, /* flush */ + H5FD_core_truncate, /* truncate */ + NULL, /* lock */ + NULL, /* unlock */ + H5FD_FLMAP_DICHOTOMY /* fl_map */ }; -/*-------------------------------------------------------------------------- -NAME - H5FD_core_init_interface -- Initialize interface-specific information -USAGE - herr_t H5FD_core_init_interface() - -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5FD_core_init currently). - ---------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------- + * Function: H5FD_core_init_interface + * + * Purpose: Initializes any interface-specific data or routines. + * + * Return: Success: The driver ID for the core driver. + * Failure: Negative. + * + *------------------------------------------------------------------------- + */ static herr_t H5FD_core_init_interface(void) { @@ -214,16 +194,15 @@ H5FD_core_init_interface(void) /*------------------------------------------------------------------------- - * Function: H5FD_core_init + * Function: H5FD_core_init * - * Purpose: Initialize this driver by registering the driver with the - * library. + * Purpose: Initialize this driver by registering the driver with the + * library. * - * Return: Success: The driver ID for the core driver. + * Return: Success: The driver ID for the core driver. + * Failure: Negative. * - * Failure: Negative. - * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, July 29, 1999 * *------------------------------------------------------------------------- @@ -231,15 +210,15 @@ H5FD_core_init_interface(void) hid_t H5FD_core_init(void) { - hid_t ret_value=H5FD_CORE_g; /* Return value */ + hid_t ret_value = H5FD_CORE_g; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - if (H5I_VFL!=H5Iget_type(H5FD_CORE_g)) + if(H5I_VFL != H5Iget_type(H5FD_CORE_g)) H5FD_CORE_g = H5FD_register(&H5FD_core_g,sizeof(H5FD_class_t),FALSE); /* Set return value */ - ret_value=H5FD_CORE_g; + ret_value = H5FD_CORE_g; done: FUNC_LEAVE_NOAPI(ret_value) @@ -247,11 +226,11 @@ done: /*--------------------------------------------------------------------------- - * Function: H5FD_core_term + * Function: H5FD_core_term * - * Purpose: Shut down the VFD + * Purpose: Shut down the VFD * - * Returns: Non-negative on success or negative on failure + * Returns: SUCCEED (Can't fail) * * Programmer: Quincey Koziol * Friday, Jan 30, 2004 @@ -264,32 +243,32 @@ H5FD_core_term(void) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Reset VFL ID */ - H5FD_CORE_g=0; + H5FD_CORE_g = 0; FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5FD_core_term() */ /*------------------------------------------------------------------------- - * Function: H5Pset_fapl_core + * Function: H5Pset_fapl_core * - * Purpose: Modify the file access property list to use the H5FD_CORE - * driver defined in this source file. The INCREMENT specifies - * how much to grow the memory each time we need more. + * Purpose: Modify the file access property list to use the H5FD_CORE + * driver defined in this source file. The INCREMENT specifies + * how much to grow the memory each time we need more. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Robb Matzke - * Thursday, February 19, 1998 + * Programmer: Robb Matzke + * Thursday, February 19, 1998 * *------------------------------------------------------------------------- */ herr_t H5Pset_fapl_core(hid_t fapl_id, size_t increment, hbool_t backing_store) { - H5FD_core_fapl_t fa; - H5P_genplist_t *plist; /* Property list pointer */ - herr_t ret_value; + H5FD_core_fapl_t fa; + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value; FUNC_ENTER_API(FAIL) H5TRACE3("e", "izb", fapl_id, increment, backing_store); @@ -309,26 +288,23 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_fapl_core - * - * Purpose: Queries properties set by the H5Pset_fapl_core() function. + * Function: H5Pget_fapl_core * - * Return: Success: Non-negative + * Purpose: Queries properties set by the H5Pset_fapl_core() function. * - * Failure: Negative + * Return: SUCCEED/FAIL * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, August 10, 1999 * *------------------------------------------------------------------------- */ herr_t -H5Pget_fapl_core(hid_t fapl_id, size_t *increment/*out*/, - hbool_t *backing_store/*out*/) +H5Pget_fapl_core(hid_t fapl_id, size_t *increment /*out*/, hbool_t *backing_store /*out*/) { - H5FD_core_fapl_t *fa; - H5P_genplist_t *plist; /* Property list pointer */ - herr_t ret_value=SUCCEED; /* Return value */ + H5FD_core_fapl_t *fa; + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("e", "ixx", fapl_id, increment, backing_store); @@ -351,15 +327,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_core_fapl_get + * Function: H5FD_core_fapl_get * - * Purpose: Returns a copy of the file access properties. + * Purpose: Returns a copy of the file access properties. * - * Return: Success: Ptr to new file access properties. + * Return: Success: Ptr to new file access properties. * - * Failure: NULL + * Failure: NULL * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, August 13, 1999 * *------------------------------------------------------------------------- @@ -367,9 +343,9 @@ done: static void * H5FD_core_fapl_get(H5FD_t *_file) { - H5FD_core_t *file = (H5FD_core_t*)_file; - H5FD_core_fapl_t *fa; - void *ret_value; /* Return value */ + H5FD_core_t *file = (H5FD_core_t*)_file; + H5FD_core_fapl_t *fa; + void *ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -380,7 +356,7 @@ H5FD_core_fapl_get(H5FD_t *_file) fa->backing_store = (hbool_t)(file->fd >= 0); /* Set return value */ - ret_value=fa; + ret_value = fa; done: FUNC_LEAVE_NOAPI(ret_value) @@ -388,36 +364,35 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_core_open + * Function: H5FD_core_open * - * Purpose: Create memory as an HDF5 file. + * Purpose: Create memory as an HDF5 file. * - * Return: Success: A pointer to a new file data structure. The - * public fields will be initialized by the - * caller, which is always H5FD_open(). + * Return: Success: A pointer to a new file data structure. The + * public fields will be initialized by the + * caller, which is always H5FD_open(). * - * Failure: NULL + * Failure: NULL * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, July 29, 1999 * *------------------------------------------------------------------------- */ static H5FD_t * -H5FD_core_open(const char *name, unsigned flags, hid_t fapl_id, - haddr_t maxaddr) +H5FD_core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) { - int o_flags; - H5FD_core_t *file=NULL; - H5FD_core_fapl_t *fa=NULL; - H5P_genplist_t *plist; /* Property list pointer */ + int o_flags; + H5FD_core_t *file = NULL; + H5FD_core_fapl_t *fa = NULL; + H5P_genplist_t *plist; /* Property list pointer */ #ifdef H5_HAVE_WIN32_API struct _BY_HANDLE_FILE_INFORMATION fileinfo; #endif - h5_stat_t sb; - int fd=-1; - H5FD_file_image_info_t file_image_info; - H5FD_t *ret_value; + h5_stat_t sb; + int fd = -1; + H5FD_file_image_info_t file_image_info; + H5FD_t *ret_value; FUNC_ENTER_NOAPI_NOINIT @@ -557,20 +532,23 @@ H5FD_core_open(const char *name, unsigned flags, hid_t fapl_id, /* Read in existing data, being careful of interrupted system calls, * partial results, and the end of the file. */ + + uint8_t *mem = file->mem; /* memory pointer for writes */ + while(size > 0) { - h5_core_io_t bytes_in = 0; /* # of bytes to read */ - h5_core_io_ret_t bytes_read = -1; /* # of bytes actually read */ + h5_posix_io_t bytes_in = 0; /* # of bytes to read */ + h5_posix_io_ret_t bytes_read = -1; /* # of bytes actually read */ /* Trying to read more bytes than the return type can handle is * undefined behavior in POSIX. */ - if(size > H5_CORE_MAX_IO_BYTES_g) - bytes_in = H5_CORE_MAX_IO_BYTES_g; + if(size > H5_POSIX_MAX_IO_BYTES) + bytes_in = H5_POSIX_MAX_IO_BYTES; else - bytes_in = (h5_core_io_t)size; + bytes_in = (h5_posix_io_t)size; do { - bytes_read = HDread(file->fd, file->mem, bytes_in); + bytes_read = HDread(file->fd, mem, bytes_in); } while(-1 == bytes_read && EINTR == errno); if(-1 == bytes_read) { /* error */ @@ -578,12 +556,13 @@ H5FD_core_open(const char *name, unsigned flags, hid_t fapl_id, time_t mytime = HDtime(NULL); HDoff_t myoffset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR); - HGOTO_ERROR(H5E_IO, H5E_READERROR, NULL, "file read failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, error message = '%s', file->mem = %p, size = %lu, offset = %llu", HDctime(&mytime), file->name, file->fd, myerrno, HDstrerror(myerrno), file->mem, (unsigned long)size, (unsigned long long)myoffset); + HGOTO_ERROR(H5E_IO, H5E_READERROR, NULL, "file read failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, error message = '%s', file->mem = %p, total read size = %llu, bytes this sub-read = %llu, bytes actually read = %llu, offset = %llu", HDctime(&mytime), file->name, file->fd, myerrno, HDstrerror(myerrno), file->mem, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_read, (unsigned long long)myoffset); } /* end if */ HDassert(bytes_read >= 0); HDassert((size_t)bytes_read <= size); + mem += bytes_read; size -= (size_t)bytes_read; } /* end while */ } /* end else */ @@ -598,20 +577,26 @@ H5FD_core_open(const char *name, unsigned flags, hid_t fapl_id, ret_value = (H5FD_t *)file; done: + if(!ret_value && file) { + if(file->fd >= 0) + HDclose(file->fd); + H5MM_xfree(file->name); + H5MM_xfree(file->mem); + H5MM_xfree(file); + } /* end if */ + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_core_open() */ /*------------------------------------------------------------------------- - * Function: H5FD_core_close + * Function: H5FD_core_close * - * Purpose: Closes the file. + * Purpose: Closes the file. * - * Return: Success: 0 + * Return: SUCCEED/FAIL * - * Failure: -1 - * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, July 29, 1999 * *------------------------------------------------------------------------- @@ -619,8 +604,8 @@ done: static herr_t H5FD_core_close(H5FD_t *_file) { - H5FD_core_t *file = (H5FD_core_t*)_file; - herr_t ret_value = SUCCEED; /* Return value */ + H5FD_core_t *file = (H5FD_core_t*)_file; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -651,19 +636,19 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_core_cmp + * Function: H5FD_core_cmp * - * Purpose: Compares two files belonging to this driver by name. If one - * file doesn't have a name then it is less than the other file. - * If neither file has a name then the comparison is by file - * address. + * Purpose: Compares two files belonging to this driver by name. If one + * file doesn't have a name then it is less than the other file. + * If neither file has a name then the comparison is by file + * address. * - * Return: Success: A value like strcmp() + * Return: Success: A value like strcmp() * - * Failure: never fails (arguments were checked by the - * caller). + * Failure: never fails (arguments were checked by the + * caller). * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, July 29, 1999 * *------------------------------------------------------------------------- @@ -671,9 +656,9 @@ done: static int H5FD_core_cmp(const H5FD_t *_f1, const H5FD_t *_f2) { - const H5FD_core_t *f1 = (const H5FD_core_t*)_f1; - const H5FD_core_t *f2 = (const H5FD_core_t*)_f2; - int ret_value = 0; + const H5FD_core_t *f1 = (const H5FD_core_t*)_f1; + const H5FD_core_t *f2 = (const H5FD_core_t*)_f2; + int ret_value = 0; FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -735,15 +720,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_core_query + * Function: H5FD_core_query * - * Purpose: Set the flags that this VFL driver is capable of supporting. + * Purpose: Set the flags that this VFL driver is capable of supporting. * (listed in H5FDpublic.h) * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED (Can't fail) * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, October 7, 2008 * *------------------------------------------------------------------------- @@ -751,7 +735,7 @@ done: static herr_t H5FD_core_query(const H5FD_t * _file, unsigned long *flags /* out */) { - const H5FD_core_t *file = (const H5FD_core_t*)_file; + const H5FD_core_t *file = (const H5FD_core_t*)_file; FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -775,17 +759,15 @@ H5FD_core_query(const H5FD_t * _file, unsigned long *flags /* out */) /*------------------------------------------------------------------------- - * Function: H5FD_core_get_eoa - * - * Purpose: Gets the end-of-address marker for the file. The EOA marker - * is the first address past the last byte allocated in the - * format address space. + * Function: H5FD_core_get_eoa * - * Return: Success: The end-of-address marker. + * Purpose: Gets the end-of-address marker for the file. The EOA marker + * is the first address past the last byte allocated in the + * format address space. * - * Failure: HADDR_UNDEF + * Return: The end-of-address marker. (Can't fail) * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, August 2, 1999 * *------------------------------------------------------------------------- @@ -793,7 +775,7 @@ H5FD_core_query(const H5FD_t * _file, unsigned long *flags /* out */) static haddr_t H5FD_core_get_eoa(const H5FD_t *_file, H5FD_mem_t UNUSED type) { - const H5FD_core_t *file = (const H5FD_core_t*)_file; + const H5FD_core_t *file = (const H5FD_core_t*)_file; FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -802,17 +784,15 @@ H5FD_core_get_eoa(const H5FD_t *_file, H5FD_mem_t UNUSED type) /*------------------------------------------------------------------------- - * Function: H5FD_core_set_eoa + * Function: H5FD_core_set_eoa * - * Purpose: Set the end-of-address marker for the file. This function is - * called shortly after an existing HDF5 file is opened in order - * to tell the driver where the end of the HDF5 data is located. + * Purpose: Set the end-of-address marker for the file. This function is + * called shortly after an existing HDF5 file is opened in order + * to tell the driver where the end of the HDF5 data is located. * - * Return: Success: 0 + * Return: SUCCEED/FAIL * - * Failure: -1 - * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, July 29, 1999 * *------------------------------------------------------------------------- @@ -820,8 +800,8 @@ H5FD_core_get_eoa(const H5FD_t *_file, H5FD_mem_t UNUSED type) static herr_t H5FD_core_set_eoa(H5FD_t *_file, H5FD_mem_t UNUSED type, haddr_t addr) { - H5FD_core_t *file = (H5FD_core_t*)_file; - herr_t ret_value = SUCCEED; /* Return value */ + H5FD_core_t *file = (H5FD_core_t*)_file; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -836,19 +816,17 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_core_get_eof - * - * Purpose: Returns the end-of-file marker, which is the greater of - * either the size of the underlying memory or the HDF5 - * end-of-address markers. + * Function: H5FD_core_get_eof * - * Return: Success: End of file address, the first address past - * the end of the "file", either the memory - * or the HDF5 file. + * Purpose: Returns the end-of-file marker, which is the greater of + * either the size of the underlying memory or the HDF5 + * end-of-address markers. * - * Failure: HADDR_UNDEF + * Return: End of file address, the first address past + * the end of the "file", either the memory + * or the HDF5 file. (Can't fail) * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, July 29, 1999 * *------------------------------------------------------------------------- @@ -856,7 +834,7 @@ done: static haddr_t H5FD_core_get_eof(const H5FD_t *_file) { - const H5FD_core_t *file = (const H5FD_core_t*)_file; + const H5FD_core_t *file = (const H5FD_core_t*)_file; FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -867,9 +845,9 @@ H5FD_core_get_eof(const H5FD_t *_file) /*------------------------------------------------------------------------- * Function: H5FD_core_get_handle * - * Purpose: Returns the file handle of CORE file driver. + * Purpose: Gets the file handle of CORE file driver. * - * Returns: Non-negative if succeed or negative if fails. + * Returns: SUCCEED/FAIL * * Programmer: Raymond Lu * Sept. 16, 2002 @@ -880,7 +858,7 @@ static herr_t H5FD_core_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle) { H5FD_core_t *file = (H5FD_core_t *)_file; /* core VFD info */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -925,26 +903,25 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_core_read + * Function: H5FD_core_read * - * Purpose: Reads SIZE bytes of data from FILE beginning at address ADDR - * into buffer BUF according to data transfer properties in - * DXPL_ID. + * Purpose: Reads SIZE bytes of data from FILE beginning at address ADDR + * into buffer BUF according to data transfer properties in + * DXPL_ID. * - * Return: Success: Zero. Result is stored in caller-supplied - * buffer BUF. + * Return: Success: SUCCEED. Result is stored in caller-supplied + * buffer BUF. * - * Failure: -1, Contents of buffer BUF are undefined. + * Failure: FAIL, Contents of buffer BUF are undefined. * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, July 29, 1999 * *------------------------------------------------------------------------- */ -/* ARGSUSED */ static herr_t H5FD_core_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, haddr_t addr, - size_t size, void *buf/*out*/) + size_t size, void *buf/*out*/) { H5FD_core_t *file = (H5FD_core_t*)_file; herr_t ret_value=SUCCEED; /* Return value */ @@ -997,28 +974,25 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_core_write - * - * Purpose: Writes SIZE bytes of data to FILE beginning at address ADDR - * from buffer BUF according to data transfer properties in - * DXPL_ID. + * Function: H5FD_core_write * - * Return: Success: Zero + * Purpose: Writes SIZE bytes of data to FILE beginning at address ADDR + * from buffer BUF according to data transfer properties in + * DXPL_ID. * - * Failure: -1 + * Return: SUCCEED/FAIL * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, July 29, 1999 * *------------------------------------------------------------------------- */ -/* ARGSUSED */ static herr_t H5FD_core_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, haddr_t addr, - size_t size, const void *buf) + size_t size, const void *buf) { H5FD_core_t *file = (H5FD_core_t*)_file; - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1057,7 +1031,7 @@ H5FD_core_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, had } /* end else */ #ifdef H5_CLEAR_MEMORY -HDmemset(x + file->eof, 0, (size_t)(new_eof - file->eof)); + HDmemset(x + file->eof, 0, (size_t)(new_eof - file->eof)); #endif /* H5_CLEAR_MEMORY */ file->mem = x; @@ -1076,49 +1050,46 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_core_flush + * Function: H5FD_core_flush * - * Purpose: Flushes the file to backing store if there is any and if the - * dirty flag is set. + * Purpose: Flushes the file to backing store if there is any and if the + * dirty flag is set. * - * Return: Success: 0 + * Return: SUCCEED/FAIL * - * Failure: -1 - * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, October 15, 1999 * *------------------------------------------------------------------------- */ -/* ARGSUSED */ static herr_t H5FD_core_flush(H5FD_t *_file, hid_t UNUSED dxpl_id, unsigned UNUSED closing) { - H5FD_core_t *file = (H5FD_core_t*)_file; - herr_t ret_value=SUCCEED; /* Return value */ + H5FD_core_t *file = (H5FD_core_t*)_file; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT /* Write to backing store */ - if (file->dirty && file->fd>=0 && file->backing_store) { + if (file->dirty && file->fd >= 0 && file->backing_store) { haddr_t size = file->eof; unsigned char *ptr = file->mem; - if (0!=HDlseek(file->fd, (off_t)0, SEEK_SET)) + if(0 != HDlseek(file->fd, (off_t)0, SEEK_SET)) HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "error seeking in backing store") while (size > 0) { - h5_core_io_t bytes_in = 0; /* # of bytes to write */ - h5_core_io_ret_t bytes_wrote = -1; /* # of bytes written */ + h5_posix_io_t bytes_in = 0; /* # of bytes to write */ + h5_posix_io_ret_t bytes_wrote = -1; /* # of bytes written */ /* Trying to write more bytes than the return type can handle is * undefined behavior in POSIX. */ - if(size > H5_CORE_MAX_IO_BYTES_g) - bytes_in = H5_CORE_MAX_IO_BYTES_g; + if(size > H5_POSIX_MAX_IO_BYTES) + bytes_in = H5_POSIX_MAX_IO_BYTES; else - bytes_in = (h5_core_io_t)size; + bytes_in = (h5_posix_io_t)size; do { bytes_wrote = HDwrite(file->fd, ptr, bytes_in); @@ -1129,7 +1100,7 @@ H5FD_core_flush(H5FD_t *_file, hid_t UNUSED dxpl_id, unsigned UNUSED closing) time_t mytime = HDtime(NULL); HDoff_t myoffset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR); - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "write to backing store failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, error message = '%s', ptr = %p, size = %lu, offset = %llu", HDctime(&mytime), file->name, file->fd, myerrno, HDstrerror(myerrno), ptr, (unsigned long)size, (unsigned long long)myoffset); + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "write to backing store failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, error message = '%s', ptr = %p, total write size = %llu, bytes this sub-write = %llu, bytes actually written = %llu, offset = %llu", HDctime(&mytime), file->name, file->fd, myerrno, HDstrerror(myerrno), ptr, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_wrote, (unsigned long long)myoffset); } /* end if */ HDassert(bytes_wrote > 0); @@ -1149,42 +1120,40 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_core_truncate + * Function: H5FD_core_truncate * - * Purpose: Makes sure that the true file size is the same (or larger) - * than the end-of-address. + * Purpose: Makes sure that the true file size is the same (or larger) + * than the end-of-address. * - * Addendum -- 12/2/11 - * For file images opened with the core file driver, it is - * necessary that we avoid reallocating the core file driver's - * buffer uneccessarily. + * Addendum -- 12/2/11 + * For file images opened with the core file driver, it is + * necessary that we avoid reallocating the core file driver's + * buffer uneccessarily. * - * To this end, I have made the following functional changes - * to this function. + * To this end, I have made the following functional changes + * to this function. * - * If we are closing, and there is no backing store, this - * function becomes a no-op. + * If we are closing, and there is no backing store, this + * function becomes a no-op. * - * If we are closing, and there is backing store, we set the - * eof to equal the eoa, and truncate the backing store to - * the new eof + * If we are closing, and there is backing store, we set the + * eof to equal the eoa, and truncate the backing store to + * the new eof * - * If we are not closing, we realloc the buffer to size equal - * to the smallest multiple of the allocation increment that - * equals or exceeds the eoa and set the eof accordingly. - * Note that we no longer truncate the backing store to the - * new eof if applicable. - * -- JRM + * If we are not closing, we realloc the buffer to size equal + * to the smallest multiple of the allocation increment that + * equals or exceeds the eoa and set the eof accordingly. + * Note that we no longer truncate the backing store to the + * new eof if applicable. + * -- JRM * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, October 7, 2008 * *------------------------------------------------------------------------- */ -/* ARGSUSED */ static herr_t H5FD_core_truncate(H5FD_t *_file, hid_t UNUSED dxpl_id, hbool_t closing) { @@ -1275,4 +1244,3 @@ H5FD_core_truncate(H5FD_t *_file, hid_t UNUSED dxpl_id, hbool_t closing) done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_core_truncate() */ - diff --git a/src/H5FDlog.c b/src/H5FDlog.c index 89a0a28..ac55427 100644 --- a/src/H5FDlog.c +++ b/src/H5FDlog.c @@ -14,50 +14,35 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, April 17, 2000 * - * Purpose: The POSIX unbuffered file driver using only the HDF5 public - * API and with a few optimizations: the lseek() call is made - * only when the current file position is unknown or needs to be - * changed based on previous I/O through this driver (don't mix - * I/O from this driver with I/O from other parts of the - * application to the same file). - * With custom modifications... + * Purpose: The POSIX unbuffered file driver using only the HDF5 public + * API and with a few optimizations: the lseek() call is made + * only when the current file position is unknown or needs to be + * changed based on previous I/O through this driver (don't mix + * I/O from this driver with I/O from other parts of the + * application to the same file). + * With custom modifications... */ /* Interface initialization */ #define H5_INTERFACE_INIT_FUNC H5FD_log_init_interface -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fprivate.h" /* File access */ -#include "H5FDprivate.h" /* File drivers */ -#include "H5FDlog.h" /* Logging file driver */ -#include "H5FLprivate.h" /* Free Lists */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Pprivate.h" /* Property lists */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* File access */ +#include "H5FDprivate.h" /* File drivers */ +#include "H5FDlog.h" /* Logging file driver */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Pprivate.h" /* Property lists */ /* The driver identification number, initialized at runtime */ static hid_t H5FD_LOG_g = 0; -/* Since Windows doesn't follow the rest of the world when it comes - * to POSIX I/O types, some typedefs and constants are needed to avoid - * making the code messy with #ifdefs. - */ -#ifdef H5_HAVE_WIN32_API -typedef unsigned int h5_log_io_t; -typedef int h5_log_io_ret_t; -static int H5_LOG_MAX_IO_BYTES_g = INT_MAX; -#else -/* Unix, everyone else */ -typedef size_t h5_log_io_t; -typedef ssize_t h5_log_io_ret_t; -static size_t H5_LOG_MAX_IO_BYTES_g = SSIZET_MAX; -#endif /* H5_HAVE_WIN32_API */ - /* Driver-specific file access properties */ typedef struct H5FD_log_fapl_t { char *logfile; /* Allocated log file name */ @@ -167,24 +152,23 @@ typedef struct H5FD_log_t { * These macros check for overflow of various quantities. These macros * assume that HDoff_t is signed and haddr_t and size_t are unsigned. * - * ADDR_OVERFLOW: Checks whether a file address of type `haddr_t' - * is too large to be represented by the second argument - * of the file seek function. + * ADDR_OVERFLOW: Checks whether a file address of type `haddr_t' + * is too large to be represented by the second argument + * of the file seek function. * - * SIZE_OVERFLOW: Checks whether a buffer size of type `hsize_t' is too - * large to be represented by the `size_t' type. + * SIZE_OVERFLOW: Checks whether a buffer size of type `hsize_t' is too + * large to be represented by the `size_t' type. * - * REGION_OVERFLOW: Checks whether an address and size pair describe data - * which can be addressed entirely by the second - * argument of the file seek function. + * REGION_OVERFLOW: Checks whether an address and size pair describe data + * which can be addressed entirely by the second + * argument of the file seek function. */ -#define MAXADDR (((haddr_t)1<<(8*sizeof(HDoff_t)-1))-1) -#define ADDR_OVERFLOW(A) (HADDR_UNDEF==(A) || \ - ((A) & ~(haddr_t)MAXADDR)) -#define SIZE_OVERFLOW(Z) ((Z) & ~(hsize_t)MAXADDR) -#define REGION_OVERFLOW(A,Z) (ADDR_OVERFLOW(A) || SIZE_OVERFLOW(Z) || \ - HADDR_UNDEF==(A)+(Z) || \ - (HDoff_t)((A)+(Z))<(HDoff_t)(A)) +#define MAXADDR (((haddr_t)1<<(8*sizeof(HDoff_t)-1))-1) +#define ADDR_OVERFLOW(A) (HADDR_UNDEF==(A) || ((A) & ~(haddr_t)MAXADDR)) +#define SIZE_OVERFLOW(Z) ((Z) & ~(hsize_t)MAXADDR) +#define REGION_OVERFLOW(A,Z) (ADDR_OVERFLOW(A) || SIZE_OVERFLOW(Z) || \ + HADDR_UNDEF==(A)+(Z) || \ + (HDoff_t)((A)+(Z))<(HDoff_t)(A)) /* Prototypes */ static herr_t H5FD_log_term(void); @@ -192,7 +176,7 @@ static void *H5FD_log_fapl_get(H5FD_t *file); static void *H5FD_log_fapl_copy(const void *_old_fa); static herr_t H5FD_log_fapl_free(void *_fa); static H5FD_t *H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id, - haddr_t maxaddr); + haddr_t maxaddr); static herr_t H5FD_log_close(H5FD_t *_file); static int H5FD_log_cmp(const H5FD_t *_f1, const H5FD_t *_f2); static herr_t H5FD_log_query(const H5FD_t *_f1, unsigned long *flags); @@ -202,9 +186,9 @@ static herr_t H5FD_log_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr); static haddr_t H5FD_log_get_eof(const H5FD_t *_file); static herr_t H5FD_log_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle); static herr_t H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, - size_t size, void *buf); + size_t size, void *buf); static herr_t H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, - size_t size, const void *buf); + size_t size, const void *buf); static herr_t H5FD_log_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); static const H5FD_class_t H5FD_log_g = { @@ -246,19 +230,16 @@ static const H5FD_class_t H5FD_log_g = { H5FL_DEFINE_STATIC(H5FD_log_t); -/*-------------------------------------------------------------------------- -NAME - H5FD_log_init_interface -- Initialize interface-specific information -USAGE - herr_t H5FD_log_init_interface() - -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5FD_log_init currently). - ---------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------- + * Function: H5FD_log_init_interface + * + * Purpose: Initializes any interface-specific data or routines. + * + * Return: Success: The driver ID for the log driver. + * Failure: Negative. + * + *------------------------------------------------------------------------- + */ static herr_t H5FD_log_init_interface(void) { @@ -269,15 +250,15 @@ H5FD_log_init_interface(void) /*------------------------------------------------------------------------- - * Function: H5FD_log_init + * Function: H5FD_log_init * - * Purpose: Initialize this driver by registering the driver with the - * library. + * Purpose: Initialize this driver by registering the driver with the + * library. * - * Return: Success: The driver ID for the log driver. - * Failure: Negative. + * Return: Success: The driver ID for the log driver. + * Failure: Negative. * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, July 29, 1999 * *------------------------------------------------------------------------- @@ -301,11 +282,11 @@ done: /*--------------------------------------------------------------------------- - * Function: H5FD_log_term + * Function: H5FD_log_term * - * Purpose: Shut down the VFD + * Purpose: Shut down the VFD * - * Returns: Non-negative on success or negative on failure + * Returns: SUCCEED (Can't fail) * * Programmer: Quincey Koziol * Friday, Jan 30, 2004 @@ -325,15 +306,15 @@ H5FD_log_term(void) /*------------------------------------------------------------------------- - * Function: H5Pset_fapl_log + * Function: H5Pset_fapl_log * - * Purpose: Modify the file access property list to use the H5FD_LOG - * driver defined in this source file. + * Purpose: Modify the file access property list to use the H5FD_LOG + * driver defined in this source file. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Robb Matzke - * Thursday, February 19, 1998 + * Programmer: Robb Matzke + * Thursday, February 19, 1998 * *------------------------------------------------------------------------- */ @@ -366,17 +347,17 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_log_fapl_get + * Function: H5FD_log_fapl_get * - * Purpose: Returns a file access property list which indicates how the - * specified file is being accessed. The return list could be - * used to access another file the same way. + * Purpose: Returns a file access property list which indicates how the + * specified file is being accessed. The return list could be + * used to access another file the same way. * - * Return: Success: Ptr to new file access property list with all - * members copied from the file struct. - * Failure: NULL + * Return: Success: Ptr to new file access property list with all + * members copied from the file struct. + * Failure: NULL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, April 20, 2000 * *------------------------------------------------------------------------- @@ -384,8 +365,8 @@ done: static void * H5FD_log_fapl_get(H5FD_t *_file) { - H5FD_log_t *file = (H5FD_log_t *)_file; - void *ret_value; /* Return value */ + H5FD_log_t *file = (H5FD_log_t *)_file; + void *ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -397,14 +378,14 @@ H5FD_log_fapl_get(H5FD_t *_file) /*------------------------------------------------------------------------- - * Function: H5FD_log_fapl_copy + * Function: H5FD_log_fapl_copy * - * Purpose: Copies the log-specific file access properties. + * Purpose: Copies the log-specific file access properties. * - * Return: Success: Ptr to a new property list - * Failure: NULL + * Return: Success: Ptr to a new property list + * Failure: NULL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, April 20, 2000 * *------------------------------------------------------------------------- @@ -412,9 +393,9 @@ H5FD_log_fapl_get(H5FD_t *_file) static void * H5FD_log_fapl_copy(const void *_old_fa) { - const H5FD_log_fapl_t *old_fa = (const H5FD_log_fapl_t*)_old_fa; - H5FD_log_fapl_t *new_fa = NULL; /* New FAPL info */ - void *ret_value; /* Return value */ + const H5FD_log_fapl_t *old_fa = (const H5FD_log_fapl_t*)_old_fa; + H5FD_log_fapl_t *new_fa = NULL; /* New FAPL info */ + void *ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -448,14 +429,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_log_fapl_free + * Function: H5FD_log_fapl_free * - * Purpose: Frees the log-specific file access properties. + * Purpose: Frees the log-specific file access properties. * - * Return: Success: 0 - * Failure: -1 + * Return: SUCCEED (Can't fail) * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, April 20, 2000 * *------------------------------------------------------------------------- @@ -477,16 +457,16 @@ H5FD_log_fapl_free(void *_fa) /*------------------------------------------------------------------------- - * Function: H5FD_log_open + * Function: H5FD_log_open * - * Purpose: Create and/or opens a file as an HDF5 file. + * Purpose: Create and/or opens a file as an HDF5 file. * - * Return: Success: A pointer to a new file data structure. The - * public fields will be initialized by the - * caller, which is always H5FD_open(). - * Failure: NULL + * Return: Success: A pointer to a new file data structure. The + * public fields will be initialized by the + * caller, which is always H5FD_open(). + * Failure: NULL * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, July 29, 1999 * *------------------------------------------------------------------------- @@ -494,11 +474,11 @@ H5FD_log_fapl_free(void *_fa) static H5FD_t * H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) { - H5FD_log_t *file = NULL; - H5P_genplist_t *plist; /* Property list */ - H5FD_log_fapl_t *fa; /* File access property list information */ - int fd = (-1); /* File descriptor */ - int o_flags; /* Flags for open() call */ + H5FD_log_t *file = NULL; + H5P_genplist_t *plist; /* Property list */ + H5FD_log_fapl_t *fa; /* File access property list information */ + int fd = -1; /* File descriptor */ + int o_flags; /* Flags for open() call */ #ifdef H5_HAVE_WIN32_API struct _BY_HANDLE_FILE_INFORMATION fileinfo; #endif @@ -507,8 +487,8 @@ H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) struct timeval open_timeval_diff; struct timeval stat_timeval_diff; #endif /* H5_HAVE_GETTIMEOFDAY */ - h5_stat_t sb; - H5FD_t *ret_value; /* Return value */ + h5_stat_t sb; + H5FD_t *ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -689,14 +669,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_log_close + * Function: H5FD_log_close * - * Purpose: Closes an HDF5 file. + * Purpose: Closes an HDF5 file. * - * Return: Success: 0 - * Failure: -1, file not closed. + * Return: Success: SUCCEED + * Failure: FAIL, file not closed. * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, July 29, 1999 * *------------------------------------------------------------------------- @@ -837,16 +817,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_log_cmp + * Function: H5FD_log_cmp * - * Purpose: Compares two files belonging to this driver using an - * arbitrary (but consistent) ordering. + * Purpose: Compares two files belonging to this driver using an + * arbitrary (but consistent) ordering. * - * Return: Success: A value like strcmp() - * Failure: never fails (arguments were checked by the - * caller). + * Return: Success: A value like strcmp() + * Failure: never fails (arguments were checked by the + * caller). * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, July 29, 1999 * *------------------------------------------------------------------------- @@ -854,8 +834,8 @@ done: static int H5FD_log_cmp(const H5FD_t *_f1, const H5FD_t *_f2) { - const H5FD_log_t *f1 = (const H5FD_log_t *)_f1; - const H5FD_log_t *f2 = (const H5FD_log_t *)_f2; + const H5FD_log_t *f1 = (const H5FD_log_t *)_f1; + const H5FD_log_t *f2 = (const H5FD_log_t *)_f2; int ret_value = 0; FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -898,15 +878,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_log_query + * Function: H5FD_log_query * - * Purpose: Set the flags that this VFL driver is capable of supporting. + * Purpose: Set the flags that this VFL driver is capable of supporting. * (listed in H5FDpublic.h) * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED (Can't fail) * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, August 25, 2000 * *------------------------------------------------------------------------- @@ -914,7 +893,7 @@ done: static herr_t H5FD_log_query(const H5FD_t *_file, unsigned long *flags /* out */) { - const H5FD_log_t *file = (const H5FD_log_t *)_file; + const H5FD_log_t *file = (const H5FD_log_t *)_file; FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -937,19 +916,18 @@ H5FD_log_query(const H5FD_t *_file, unsigned long *flags /* out */) /*------------------------------------------------------------------------- - * Function: H5FD_log_alloc + * Function: H5FD_log_alloc * - * Purpose: Allocate file memory. + * Purpose: Allocate file memory. * - * Return: Success: Address of new memory - * Failure: HADDR_UNDEF + * Return: Success: Address of new memory + * Failure: HADDR_UNDEF * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, April 17, 2000 * *------------------------------------------------------------------------- */ -/* ARGSUSED */ static haddr_t H5FD_log_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t UNUSED dxpl_id, hsize_t size) { @@ -991,16 +969,16 @@ H5FD_log_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t UNUSED dxpl_id, hsize_t siz /*------------------------------------------------------------------------- - * Function: H5FD_log_get_eoa + * Function: H5FD_log_get_eoa * - * Purpose: Gets the end-of-address marker for the file. The EOA marker - * is the first address past the last byte allocated in the - * format address space. + * Purpose: Gets the end-of-address marker for the file. The EOA marker + * is the first address past the last byte allocated in the + * format address space. * - * Return: Success: The end-of-address marker. - * Failure: HADDR_UNDEF + * Return: Success: The end-of-address marker. + * Failure: HADDR_UNDEF * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, August 2, 1999 * *------------------------------------------------------------------------- @@ -1008,7 +986,7 @@ H5FD_log_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t UNUSED dxpl_id, hsize_t siz static haddr_t H5FD_log_get_eoa(const H5FD_t *_file, H5FD_mem_t UNUSED type) { - const H5FD_log_t *file = (const H5FD_log_t *)_file; + const H5FD_log_t *file = (const H5FD_log_t *)_file; FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -1017,16 +995,15 @@ H5FD_log_get_eoa(const H5FD_t *_file, H5FD_mem_t UNUSED type) /*------------------------------------------------------------------------- - * Function: H5FD_log_set_eoa + * Function: H5FD_log_set_eoa * - * Purpose: Set the end-of-address marker for the file. This function is - * called shortly after an existing HDF5 file is opened in order - * to tell the driver where the end of the HDF5 data is located. + * Purpose: Set the end-of-address marker for the file. This function is + * called shortly after an existing HDF5 file is opened in order + * to tell the driver where the end of the HDF5 data is located. * - * Return: Success: 0 - * Failure: -1 + * Return: SUCCEED (Can't fail) * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, July 29, 1999 * *------------------------------------------------------------------------- @@ -1034,25 +1011,25 @@ H5FD_log_get_eoa(const H5FD_t *_file, H5FD_mem_t UNUSED type) static herr_t H5FD_log_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr) { - H5FD_log_t *file = (H5FD_log_t *)_file; + H5FD_log_t *file = (H5FD_log_t *)_file; FUNC_ENTER_NOAPI_NOINIT_NOERR if(file->fa.flags != 0) { - if(H5F_addr_gt(addr, file->eoa) && H5F_addr_gt(addr, 0)) { - hsize_t size = addr - file->eoa; + if(H5F_addr_gt(addr, file->eoa) && H5F_addr_gt(addr, 0)) { + hsize_t size = addr - file->eoa; /* Retain the flavor of the space allocated by the extension */ - if(file->fa.flags & H5FD_LOG_FLAVOR) { - HDassert(addr < file->iosize); - H5_CHECK_OVERFLOW(size, hsize_t, size_t); - HDmemset(&file->flavor[file->eoa], (int)type, (size_t)size); - } /* end if */ + if(file->fa.flags & H5FD_LOG_FLAVOR) { + HDassert(addr < file->iosize); + H5_CHECK_OVERFLOW(size, hsize_t, size_t); + HDmemset(&file->flavor[file->eoa], (int)type, (size_t)size); + } /* end if */ /* Log the extension like an allocation */ - if(file->fa.flags & H5FD_LOG_ALLOC) - HDfprintf(file->logfp, "%10a-%10a (%10Hu bytes) (%s) Allocated\n", file->eoa, addr, size, flavors[type]); - } /* end if */ + if(file->fa.flags & H5FD_LOG_ALLOC) + HDfprintf(file->logfp, "%10a-%10a (%10Hu bytes) (%s) Allocated\n", file->eoa, addr, size, flavors[type]); + } /* end if */ } /* end if */ file->eoa = addr; @@ -1062,18 +1039,18 @@ H5FD_log_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr) /*------------------------------------------------------------------------- - * Function: H5FD_log_get_eof + * Function: H5FD_log_get_eof * - * Purpose: Returns the end-of-file marker, which is the greater of - * either the filesystem end-of-file or the HDF5 end-of-address - * markers. + * Purpose: Returns the end-of-file marker, which is the greater of + * either the filesystem end-of-file or the HDF5 end-of-address + * markers. * - * Return: Success: End of file address, the first address past - * the end of the "file", either the filesystem file - * or the HDF5 file. - * Failure: HADDR_UNDEF + * Return: Success: End of file address, the first address past + * the end of the "file", either the filesystem file + * or the HDF5 file. + * Failure: HADDR_UNDEF * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, July 29, 1999 * *------------------------------------------------------------------------- @@ -1094,14 +1071,13 @@ H5FD_log_get_eof(const H5FD_t *_file) * * Purpose: Returns the file handle of LOG file driver. * - * Returns: Non-negative if succeed or negative if fails. + * Returns: SUCCEED/FAIL * * Programmer: Raymond Lu * Sept. 16, 2002 * *------------------------------------------------------------------------- */ -/* ARGSUSED */ static herr_t H5FD_log_get_handle(H5FD_t *_file, hid_t UNUSED fapl, void **file_handle) { @@ -1121,27 +1097,26 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_log_read + * Function: H5FD_log_read * - * Purpose: Reads SIZE bytes of data from FILE beginning at address ADDR - * into buffer BUF according to data transfer properties in - * DXPL_ID. + * Purpose: Reads SIZE bytes of data from FILE beginning at address ADDR + * into buffer BUF according to data transfer properties in + * DXPL_ID. * - * Return: Success: Zero. Result is stored in caller-supplied - * buffer BUF. - * Failure: -1, Contents of buffer BUF are undefined. + * Return: Success: SUCCEED. Result is stored in caller-supplied + * buffer BUF. + * Failure: FAIL, Contents of buffer BUF are undefined. * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, July 29, 1999 * *------------------------------------------------------------------------- */ -/* ARGSUSED */ static herr_t H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t UNUSED dxpl_id, haddr_t addr, - size_t size, void *buf/*out*/) + size_t size, void *buf/*out*/) { - H5FD_log_t *file = (H5FD_log_t *)_file; + H5FD_log_t *file = (H5FD_log_t *)_file; size_t orig_size = size; /* Save the original size for later */ haddr_t orig_addr = addr; #ifdef H5_HAVE_GETTIMEOFDAY @@ -1235,16 +1210,16 @@ H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t UNUSED dxpl_id, haddr_t addr #endif /* H5_HAVE_GETTIMEOFDAY */ while(size > 0) { - h5_log_io_t bytes_in = 0; /* # of bytes to read */ - h5_log_io_ret_t bytes_read = -1; /* # of bytes actually read */ + h5_posix_io_t bytes_in = 0; /* # of bytes to read */ + h5_posix_io_ret_t bytes_read = -1; /* # of bytes actually read */ /* Trying to read more bytes than the return type can handle is * undefined behavior in POSIX. */ - if(size > H5_LOG_MAX_IO_BYTES_g) - bytes_in = H5_LOG_MAX_IO_BYTES_g; + if(size > H5_POSIX_MAX_IO_BYTES) + bytes_in = H5_POSIX_MAX_IO_BYTES; else - bytes_in = (h5_log_io_t)size; + bytes_in = (h5_posix_io_t)size; do { bytes_read = HDread(file->fd, buf, bytes_in); @@ -1258,7 +1233,7 @@ H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t UNUSED dxpl_id, haddr_t addr if(file->fa.flags & H5FD_LOG_LOC_READ) HDfprintf(file->logfp, "Error! Reading: %10a-%10a (%10Zu bytes)\n", orig_addr, (orig_addr + orig_size) - 1, orig_size); - HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, error message = '%s', buf = %p, size = %lu, offset = %llu", HDctime(&mytime), file->filename, file->fd, myerrno, HDstrerror(myerrno), buf, (unsigned long)size, (unsigned long long)myoffset); + HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, error message = '%s', buf = %p, total read size = %llu, bytes this sub-read = %llu, bytes actually read = %llu, offset = %llu", HDctime(&mytime), file->filename, file->fd, myerrno, HDstrerror(myerrno), buf, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_read, (unsigned long long)myoffset); } /* end if */ if(0 == bytes_read) { @@ -1329,26 +1304,24 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_log_write + * Function: H5FD_log_write * - * Purpose: Writes SIZE bytes of data to FILE beginning at address ADDR - * from buffer BUF according to data transfer properties in - * DXPL_ID. + * Purpose: Writes SIZE bytes of data to FILE beginning at address ADDR + * from buffer BUF according to data transfer properties in + * DXPL_ID. * - * Return: Success: Zero - * Failure: -1 + * Return: SUCCEED/FAIL * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, July 29, 1999 * *------------------------------------------------------------------------- */ -/* ARGSUSED */ static herr_t H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t UNUSED dxpl_id, haddr_t addr, - size_t size, const void *buf) + size_t size, const void *buf) { - H5FD_log_t *file = (H5FD_log_t *)_file; + H5FD_log_t *file = (H5FD_log_t *)_file; size_t orig_size = size; /* Save the original size for later */ haddr_t orig_addr = addr; #ifdef H5_HAVE_GETTIMEOFDAY @@ -1441,16 +1414,16 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t UNUSED dxpl_id, haddr_t add #endif /* H5_HAVE_GETTIMEOFDAY */ while(size > 0) { - h5_log_io_t bytes_in = 0; /* # of bytes to write */ - h5_log_io_ret_t bytes_wrote = -1; /* # of bytes written */ + h5_posix_io_t bytes_in = 0; /* # of bytes to write */ + h5_posix_io_ret_t bytes_wrote = -1; /* # of bytes written */ /* Trying to write more bytes than the return type can handle is * undefined behavior in POSIX. */ - if(size > H5_LOG_MAX_IO_BYTES_g) - bytes_in = H5_LOG_MAX_IO_BYTES_g; + if(size > H5_POSIX_MAX_IO_BYTES) + bytes_in = H5_POSIX_MAX_IO_BYTES; else - bytes_in = (h5_log_io_t)size; + bytes_in = (h5_posix_io_t)size; do { bytes_wrote = HDwrite(file->fd, buf, bytes_in); @@ -1464,7 +1437,7 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t UNUSED dxpl_id, haddr_t add if(file->fa.flags & H5FD_LOG_LOC_WRITE) HDfprintf(file->logfp, "Error! Writing: %10a-%10a (%10Zu bytes)\n", orig_addr, (orig_addr + orig_size) - 1, orig_size); - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, error message = '%s', buf = %p, size = %lu, offset = %llu", HDctime(&mytime), file->filename, file->fd, myerrno, HDstrerror(myerrno), buf, (unsigned long)size, (unsigned long long)myoffset); + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, error message = '%s', buf = %p, total write size = %llu, bytes this sub-write = %llu, bytes actually written = %llu, offset = %llu", HDctime(&mytime), file->filename, file->fd, myerrno, HDstrerror(myerrno), buf, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_wrote, (unsigned long long)myoffset); } /* end if */ HDassert(bytes_wrote > 0); @@ -1534,25 +1507,23 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_log_truncate + * Function: H5FD_log_truncate * - * Purpose: Makes sure that the true file size is the same (or larger) - * than the end-of-address. + * Purpose: Makes sure that the true file size is the same (or larger) + * than the end-of-address. * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, August 4, 1999 * *------------------------------------------------------------------------- */ -/* ARGSUSED */ static herr_t H5FD_log_truncate(H5FD_t *_file, hid_t UNUSED dxpl_id, hbool_t UNUSED closing) { - H5FD_log_t *file = (H5FD_log_t *)_file; - herr_t ret_value = SUCCEED; /* Return value */ + H5FD_log_t *file = (H5FD_log_t *)_file; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1613,4 +1584,3 @@ H5FD_log_truncate(H5FD_t *_file, hid_t UNUSED dxpl_id, hbool_t UNUSED closing) done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_log_truncate() */ - diff --git a/src/H5FDmpi.c b/src/H5FDmpi.c index 866a2cf..295e3c9f 100644 --- a/src/H5FDmpi.c +++ b/src/H5FDmpi.c @@ -29,11 +29,6 @@ #include "H5FDmpi.h" /* Common MPI file driver */ #include "H5Pprivate.h" /* Property lists */ -/* - * The view is set to this value - */ -char H5FD_mpi_native_g[] = "native"; - #ifdef H5_HAVE_PARALLEL diff --git a/src/H5FDmpi.h b/src/H5FDmpi.h index 4140671..dcb8df9 100644 --- a/src/H5FDmpi.h +++ b/src/H5FDmpi.h @@ -55,62 +55,9 @@ typedef enum H5FD_mpio_collective_opt_t { H5FD_MPIO_INDIVIDUAL_IO /*zero is the default*/ } H5FD_mpio_collective_opt_t; - -#ifdef H5_HAVE_PARALLEL - -/* Sub-class the H5FD_class_t to add more specific functions for MPI-based VFDs */ -typedef struct H5FD_class_mpi_t { - H5FD_class_t super; /* Superclass information & methods */ - int (*get_rank)(const H5FD_t *file); /* Get the MPI rank of a process */ - int (*get_size)(const H5FD_t *file); /* Get the MPI size of a communicator */ - MPI_Comm (*get_comm)(const H5FD_t *file); /* Get the communicator for a file */ -} H5FD_class_mpi_t; -#endif /* H5_HAVE_PARALLEL */ - /* Include all the MPI VFL headers */ #include "H5FDmpio.h" /* MPI I/O file driver */ #include "H5FDmpiposix.h" /* MPI/posix I/O file driver */ -/* Macros */ - -#ifdef H5_HAVE_PARALLEL -/* ======== Temporary data transfer properties ======== */ -/* Definitions for memory MPI type property */ -#define H5FD_MPI_XFER_MEM_MPI_TYPE_NAME "H5FD_mpi_mem_mpi_type" -/* Definitions for file MPI type property */ -#define H5FD_MPI_XFER_FILE_MPI_TYPE_NAME "H5FD_mpi_file_mpi_type" - -/* - * The view is set to this value - */ -H5_DLLVAR char H5FD_mpi_native_g[]; - -/* Function prototypes */ -#ifdef __cplusplus -extern "C" { -#endif -/* General routines */ -H5_DLL haddr_t H5FD_mpi_MPIOff_to_haddr(MPI_Offset mpi_off); -H5_DLL herr_t H5FD_mpi_haddr_to_MPIOff(haddr_t addr, MPI_Offset *mpi_off/*out*/); -H5_DLL herr_t H5FD_mpi_comm_info_dup(MPI_Comm comm, MPI_Info info, - MPI_Comm *comm_new, MPI_Info *info_new); -H5_DLL herr_t H5FD_mpi_comm_info_free(MPI_Comm *comm, MPI_Info *info); -#ifdef NOT_YET -H5_DLL herr_t H5FD_mpio_wait_for_left_neighbor(H5FD_t *file); -H5_DLL herr_t H5FD_mpio_signal_right_neighbor(H5FD_t *file); -#endif /* NOT_YET */ -H5_DLL herr_t H5FD_mpi_setup_collective(hid_t dxpl_id, MPI_Datatype *btype, - MPI_Datatype *ftype); - -/* Driver specific methods */ -H5_DLL int H5FD_mpi_get_rank(const H5FD_t *file); -H5_DLL int H5FD_mpi_get_size(const H5FD_t *file); -H5_DLL MPI_Comm H5FD_mpi_get_comm(const H5FD_t *_file); -#ifdef __cplusplus -} -#endif - -#endif /* H5_HAVE_PARALLEL */ - #endif /* H5FDmpi_H */ diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index 2db77c9..878bf82 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -45,6 +45,11 @@ static hid_t H5FD_MPIO_g = 0; /* + * The view is set to this value + */ +static char H5FD_mpi_native_g[] = "native"; + +/* * The description of a file belonging to this driver. * The EOF value is only used just after the file is opened in order for the * library to determine whether the file is empty, truncated, or okay. The MPIO diff --git a/src/H5FDmpio.h b/src/H5FDmpio.h index fe2d11f..d836086 100644 --- a/src/H5FDmpio.h +++ b/src/H5FDmpio.h @@ -30,9 +30,6 @@ /* Macros */ -#define IS_H5FD_MPIO(f) /* (H5F_t *f) */ \ - (H5FD_MPIO==H5F_DRIVER_ID(f)) - #ifdef H5_HAVE_PARALLEL /*Turn on H5FDmpio_debug if H5F_DEBUG is on */ #ifdef H5F_DEBUG diff --git a/src/H5FDmpiposix.c b/src/H5FDmpiposix.c index 88a5886..b1d68f6 100644 --- a/src/H5FDmpiposix.c +++ b/src/H5FDmpiposix.c @@ -71,21 +71,6 @@ */ static hid_t H5FD_MPIPOSIX_g = 0; -/* Since Windows doesn't follow the rest of the world when it comes - * to POSIX I/O types, some typedefs and constants are needed to avoid - * making the code messy with #ifdefs. - */ -#ifdef H5_HAVE_WIN32_API -typedef unsigned int h5_mpiposix_io_t; -typedef int h5_mpiposix_io_ret_t; -static int H5_MPIPOSIX_MAX_IO_BYTES_g = INT_MAX; -#else -/* Unix, everyone else */ -typedef size_t h5_mpiposix_io_t; -typedef ssize_t h5_mpiposix_io_ret_t; -static size_t H5_MPIPOSIX_MAX_IO_BYTES_g = SSIZET_MAX; -#endif /* H5_HAVE_WIN32_API */ - /* * The description of a file belonging to this driver. * The EOF value is only used just after the file is opened in order for the @@ -241,19 +226,16 @@ static const H5FD_class_mpi_t H5FD_mpiposix_g = { }; -/*-------------------------------------------------------------------------- -NAME - H5FD_mpiposix_init_interface -- Initialize interface-specific information -USAGE - herr_t H5FD_mpiposix_init_interface() - -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5FD_mpiposix_init currently). - ---------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------- + * Function: H5FD_mpiposix_init_interface + * + * Purpose: Initializes any interface-specific data or routines. + * + * Return: Success: The driver ID for the mpiposix driver. + * Failure: Negative. + * + *------------------------------------------------------------------------- + */ static herr_t H5FD_mpiposix_init_interface(void) { @@ -1094,16 +1076,16 @@ H5FD_mpiposix_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, */ while(size > 0) { - h5_mpiposix_io_t bytes_in = 0; /* # of bytes to read */ - h5_mpiposix_io_ret_t bytes_read = -1; /* # of bytes actually read */ + h5_posix_io_t bytes_in = 0; /* # of bytes to read */ + h5_posix_io_ret_t bytes_read = -1; /* # of bytes actually read */ /* Trying to read more bytes than the return type can handle is * undefined behavior in POSIX. */ - if(size > H5_MPIPOSIX_MAX_IO_BYTES_g) - bytes_in = H5_MPIPOSIX_MAX_IO_BYTES_g; + if(size > H5_POSIX_MAX_IO_BYTES) + bytes_in = H5_POSIX_MAX_IO_BYTES; else - bytes_in = (h5_mpiposix_io_t)size; + bytes_in = (h5_posix_io_t)size; do { bytes_read = HDread(file->fd, buf, bytes_in); @@ -1114,7 +1096,7 @@ H5FD_mpiposix_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, time_t mytime = HDtime(NULL); HDoff_t myoffset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR); - HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed: time = %s, file descriptor = %d, errno = %d, error message = '%s', buf = %p, size = %lu, offset = %llu", HDctime(&mytime), file->fd, myerrno, HDstrerror(myerrno), buf, (unsigned long)size, (unsigned long long)myoffset); + HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed: time = %s, file descriptor = %d, errno = %d, error message = '%s', buf = %p, total read size = %llu, bytes this sub-read = %llu, bytes actually read = %llu, offset = %llu", HDctime(&mytime), file->fd, myerrno, HDstrerror(myerrno), buf, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_read, (unsigned long long)myoffset); } /* end if */ if(0 == bytes_read) { @@ -1278,16 +1260,16 @@ H5FD_mpiposix_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, */ while(size > 0) { - h5_mpiposix_io_t bytes_in = 0; /* # of bytes to write */ - h5_mpiposix_io_ret_t bytes_wrote = -1; /* # of bytes actually written */ + h5_posix_io_t bytes_in = 0; /* # of bytes to write */ + h5_posix_io_ret_t bytes_wrote = -1; /* # of bytes actually written */ /* Trying to write more bytes than the return type can handle is * undefined behavior in POSIX. */ - if(size > H5_MPIPOSIX_MAX_IO_BYTES_g) - bytes_in = H5_MPIPOSIX_MAX_IO_BYTES_g; + if(size > H5_POSIX_MAX_IO_BYTES) + bytes_in = H5_POSIX_MAX_IO_BYTES; else - bytes_in = (h5_mpiposix_io_t)size; + bytes_in = (h5_posix_io_t)size; do { bytes_wrote = HDwrite(file->fd, buf, bytes_in); @@ -1298,7 +1280,7 @@ H5FD_mpiposix_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, time_t mytime = HDtime(NULL); HDoff_t myoffset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR); - HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file write failed: time = %s, file descriptor = %d, errno = %d, error message = '%s', buf = %p, size = %lu, offset = %llu", HDctime(&mytime), file->fd, myerrno, HDstrerror(myerrno), buf, (unsigned long)size, (unsigned long long)myoffset); + HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file write failed: time = %s, file descriptor = %d, errno = %d, error message = '%s', buf = %p, total write size = %llu, bytes this sub-write = %llu, bytes actually written = %llu, offset = %llu", HDctime(&mytime), file->fd, myerrno, HDstrerror(myerrno), buf, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_wrote, (unsigned long long)myoffset); } /* end if */ if(0 == bytes_wrote) { diff --git a/src/H5FDmpiposix.h b/src/H5FDmpiposix.h index e3764e1..12ff206 100644 --- a/src/H5FDmpiposix.h +++ b/src/H5FDmpiposix.h @@ -31,9 +31,6 @@ /* Macros */ -#define IS_H5FD_MPIPOSIX(f) /* (H5F_t *f) */ \ - (H5FD_MPIPOSIX==H5F_DRIVER_ID(f)) - #ifdef H5_HAVE_PARALLEL /* Function prototypes */ diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c index 16934e3..5bdfbbe 100644 --- a/src/H5FDmulti.c +++ b/src/H5FDmulti.c @@ -77,6 +77,7 @@ #define H5FD_MULTI_DXPL_PROP_NAME "H5FD_MULTI_DXPL" #define H5FD_MULTI_DXPL_PROP_SIZE sizeof(H5FD_multi_dxpl_t) +#define H5FD_MULT_MAX_FILE_NAME_LEN 1024 /* The driver identification number, initialized at runtime */ static hid_t H5FD_MULTI_g = 0; @@ -207,12 +208,14 @@ static char * my_strdup(const char *s) { char *x; + size_t str_len; if(!s) return NULL; - if(NULL == (x = (char *)malloc(strlen(s) + 1))) + str_len = strlen(s) + 1; + if(NULL == (x = (char *)malloc(str_len))) return NULL; - strcpy(x, s); + memcpy(x, s, str_len); return x; } @@ -301,7 +304,7 @@ H5Pset_fapl_split(hid_t fapl, const char *meta_ext, hid_t meta_plist_id, H5FD_mem_t memb_map[H5FD_MEM_NTYPES]; hid_t memb_fapl[H5FD_MEM_NTYPES]; const char *memb_name[H5FD_MEM_NTYPES]; - char meta_name[1024], raw_name[1024]; + char meta_name[H5FD_MULT_MAX_FILE_NAME_LEN], raw_name[H5FD_MULT_MAX_FILE_NAME_LEN]; haddr_t memb_addr[H5FD_MEM_NTYPES]; /*NO TRACE*/ @@ -324,25 +327,39 @@ H5Pset_fapl_split(hid_t fapl, const char *meta_ext, hid_t meta_plist_id, /* The names */ /* process meta filename */ - if (meta_ext){ - if (strstr(meta_ext, "%s")) - strcpy(meta_name, meta_ext); + if(meta_ext) { + if(strstr(meta_ext, "%s")) { + /* Note: this doesn't accommodate for when the '%s' in the user's + * string is at a position >sizeof(meta_name) - QK & JK - 2013/01/17 + */ + strncpy(meta_name, meta_ext, sizeof(meta_name)); + meta_name[sizeof(meta_name) - 1] = '\0'; + } else sprintf(meta_name, "%%s%s", meta_ext); } - else - strcpy(meta_name, "%s.meta"); + else { + strncpy(meta_name, "%s.meta", sizeof(meta_name)); + meta_name[sizeof(meta_name) - 1] = '\0'; + } memb_name[H5FD_MEM_SUPER] = meta_name; /* process raw filename */ - if (raw_ext){ - if (strstr(raw_ext, "%s")) - strcpy(raw_name, raw_ext); + if(raw_ext) { + if(strstr(raw_ext, "%s")) { + /* Note: this doesn't accommodate for when the '%s' in the user's + * string is at a position >sizeof(raw_name) - QK & JK - 2013/01/17 + */ + strncpy(raw_name, raw_ext, sizeof(raw_name)); + raw_name[sizeof(raw_name) - 1] = '\0'; + } else sprintf(raw_name, "%%s%s", raw_ext); } - else - strcpy(raw_name, "%s.raw"); + else { + strncpy(raw_name, "%s.raw", sizeof(raw_name)); + raw_name[sizeof(raw_name) - 1] = '\0'; + } memb_name[H5FD_MEM_DRAW] = raw_name; /* The sizes */ @@ -573,12 +590,11 @@ H5Pget_fapl_multi(hid_t fapl_id, H5FD_mem_t *memb_map/*out*/, memb_fapl[mt] = fa->memb_fapl[mt]; /*default or bad ID*/ } } - if (memb_name) { - for (mt=H5FD_MEM_DEFAULT; mtmemb_name[mt]) { - memb_name[mt] = (char *)malloc(strlen(fa->memb_name[mt])+1); - strcpy(memb_name[mt], fa->memb_name[mt]); - } else + if(memb_name) { + for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt = (H5FD_mem_t)(mt + 1)) { + if(fa->memb_name[mt]) + memb_name[mt] = my_strdup(fa->memb_name[mt]); + else memb_name[mt] = NULL; } } @@ -969,17 +985,17 @@ H5FD_multi_sb_encode(H5FD_t *_file, char *name/*out*/, p += sizeof(haddr_t); nseen++; } END_MEMBERS; - if (H5Tconvert(H5T_NATIVE_HADDR, H5T_STD_U64LE, nseen*2, buf+8, NULL, - H5P_DEFAULT)<0) + if (H5Tconvert(H5T_NATIVE_HADDR, H5T_STD_U64LE, nseen*2, buf+8, NULL, H5P_DEFAULT)<0) H5Epush_ret(func, H5E_ERR_CLS, H5E_DATATYPE, H5E_CANTCONVERT, "can't convert superblock info", -1) /* Encode all name templates */ p = buf + 8 + nseen*2*8; UNIQUE_MEMBERS(file->fa.memb_map, mt) { size_t n = strlen(file->fa.memb_name[mt]) + 1; - strcpy((char *)p, file->fa.memb_name[mt]); + strncpy((char *)p, file->fa.memb_name[mt], n); p += n; - for (i=n; i%8; i++) *p++ = '\0'; + for (i=n; i%8; i++) + *p++ = '\0'; } END_MEMBERS; return 0; @@ -1209,19 +1225,21 @@ H5FD_multi_fapl_copy(const void *_old_fa) ALL_MEMBERS(mt) { if (old_fa->memb_fapl[mt]>=0) { new_fa->memb_fapl[mt] = H5Pcopy(old_fa->memb_fapl[mt]); - if (new_fa->memb_fapl[mt]<0) nerrors++; + if(new_fa->memb_fapl[mt]<0) + nerrors++; } if (old_fa->memb_name[mt]) { - new_fa->memb_name[mt] = (char *)malloc(strlen(old_fa->memb_name[mt])+1); + new_fa->memb_name[mt] = my_strdup(old_fa->memb_name[mt]); assert(new_fa->memb_name[mt]); - strcpy(new_fa->memb_name[mt], old_fa->memb_name[mt]); } } END_MEMBERS; if (nerrors) { ALL_MEMBERS(mt) { - if (new_fa->memb_fapl[mt]>=0) (void)H5Pclose(new_fa->memb_fapl[mt]); - if (new_fa->memb_name[mt]) free(new_fa->memb_name[mt]); + if (new_fa->memb_fapl[mt]>=0) + (void)H5Pclose(new_fa->memb_fapl[mt]); + if (new_fa->memb_name[mt]) + free(new_fa->memb_name[mt]); } END_MEMBERS; free(new_fa); H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "invalid freespace objects", NULL) @@ -2191,7 +2209,7 @@ compute_next(H5FD_multi_t *file) static int open_members(H5FD_multi_t *file) { - char tmp[1024]; + char tmp[H5FD_MULT_MAX_FILE_NAME_LEN]; int nerrors=0; static const char *func="(H5FD_multi)open_members"; /* Function Name for error reporting */ @@ -2199,30 +2217,28 @@ open_members(H5FD_multi_t *file) H5Eclear2(H5E_DEFAULT); UNIQUE_MEMBERS(file->fa.memb_map, mt) { - if (file->memb[mt]) continue; /*already open*/ + if(file->memb[mt]) + continue; /*already open*/ assert(file->fa.memb_name[mt]); + /* Note: This truncates the user's filename down to only sizeof(tmp) + * characters. -QK & JK, 2013/01/17 + */ sprintf(tmp, file->fa.memb_name[mt], file->name); #ifdef H5FD_MULTI_DEBUG - if (file->flags & H5F_ACC_DEBUG) { - fprintf(stderr, "H5FD_MULTI: open member %d \"%s\"\n", - (int)mt, tmp); - } + if(file->flags & H5F_ACC_DEBUG) + fprintf(stderr, "H5FD_MULTI: open member %d \"%s\"\n", (int)mt, tmp); #endif H5E_BEGIN_TRY { - file->memb[mt] = H5FDopen(tmp, file->flags, file->fa.memb_fapl[mt], - HADDR_UNDEF); + file->memb[mt] = H5FDopen(tmp, file->flags, file->fa.memb_fapl[mt], HADDR_UNDEF); } H5E_END_TRY; - if (!file->memb[mt]) { + if(!file->memb[mt]) { #ifdef H5FD_MULTI_DEBUG - if (file->flags & H5F_ACC_DEBUG) { - fprintf(stderr, "H5FD_MULTI: open failed for member %d\n", - (int)mt); - } + if(file->flags & H5F_ACC_DEBUG) + fprintf(stderr, "H5FD_MULTI: open failed for member %d\n", (int)mt); #endif - if (!file->fa.relax || (file->flags & H5F_ACC_RDWR)) { + if(!file->fa.relax || (file->flags & H5F_ACC_RDWR)) nerrors++; - } } } END_MEMBERS; if (nerrors) diff --git a/src/H5FDprivate.h b/src/H5FDprivate.h index 64b71d4..600cae1 100644 --- a/src/H5FDprivate.h +++ b/src/H5FDprivate.h @@ -39,6 +39,28 @@ /* Length of filename buffer */ #define H5FD_MAX_FILENAME_LEN 1024 +/* MPI based VFDs */ +#define IS_H5FD_MPIO(f) /* (H5F_t *f) */ \ + (H5FD_MPIO==H5F_DRIVER_ID(f)) + +#define IS_H5FD_MPIPOSIX(f) /* (H5F_t *f) */ \ + (H5FD_MPIPOSIX==H5F_DRIVER_ID(f)) + +#ifdef H5_HAVE_PARALLEL +/* ======== Temporary data transfer properties ======== */ +/* Definitions for memory MPI type property */ +#define H5FD_MPI_XFER_MEM_MPI_TYPE_NAME "H5FD_mpi_mem_mpi_type" +/* Definitions for file MPI type property */ +#define H5FD_MPI_XFER_FILE_MPI_TYPE_NAME "H5FD_mpi_file_mpi_type" + +/* Sub-class the H5FD_class_t to add more specific functions for MPI-based VFDs */ +typedef struct H5FD_class_mpi_t { + H5FD_class_t super; /* Superclass information & methods */ + int (*get_rank)(const H5FD_t *file); /* Get the MPI rank of a process */ + int (*get_size)(const H5FD_t *file); /* Get the MPI size of a communicator */ + MPI_Comm (*get_comm)(const H5FD_t *file); /* Get the communicator for a file */ +} H5FD_class_mpi_t; +#endif /****************************/ /* Library Private Typedefs */ @@ -123,9 +145,28 @@ H5_DLL herr_t H5FD_get_fileno(const H5FD_t *file, unsigned long *filenum); H5_DLL herr_t H5FD_get_vfd_handle(H5FD_t *file, hid_t fapl, void** file_handle); H5_DLL herr_t H5FD_set_base_addr(H5FD_t *file, haddr_t base_addr); H5_DLL haddr_t H5FD_get_base_addr(const H5FD_t *file); + +/* Function prototypes for MPI based VFDs*/ #ifdef H5_HAVE_PARALLEL +/* General routines */ +H5_DLL haddr_t H5FD_mpi_MPIOff_to_haddr(MPI_Offset mpi_off); +H5_DLL herr_t H5FD_mpi_haddr_to_MPIOff(haddr_t addr, MPI_Offset *mpi_off/*out*/); +H5_DLL herr_t H5FD_mpi_comm_info_dup(MPI_Comm comm, MPI_Info info, + MPI_Comm *comm_new, MPI_Info *info_new); +H5_DLL herr_t H5FD_mpi_comm_info_free(MPI_Comm *comm, MPI_Info *info); +#ifdef NOT_YET +H5_DLL herr_t H5FD_mpio_wait_for_left_neighbor(H5FD_t *file); +H5_DLL herr_t H5FD_mpio_signal_right_neighbor(H5FD_t *file); +#endif /* NOT_YET */ +H5_DLL herr_t H5FD_mpi_setup_collective(hid_t dxpl_id, MPI_Datatype *btype, + MPI_Datatype *ftype); H5_DLL herr_t H5FD_set_mpio_atomicity(H5FD_t *file, hbool_t flag); H5_DLL herr_t H5FD_get_mpio_atomicity(H5FD_t *file, hbool_t *flag); + +/* Driver specific methods */ +H5_DLL int H5FD_mpi_get_rank(const H5FD_t *file); +H5_DLL int H5FD_mpi_get_size(const H5FD_t *file); +H5_DLL MPI_Comm H5FD_mpi_get_comm(const H5FD_t *_file); #endif /* H5_HAVE_PARALLEL */ #endif /* !_H5FDprivate_H */ diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c index afe745b..86ef6c6 100644 --- a/src/H5FDsec2.c +++ b/src/H5FDsec2.c @@ -17,56 +17,41 @@ * Programmer: Robb Matzke * Thursday, July 29, 1999 * - * Purpose: The POSIX unbuffered file driver using only the HDF5 public - * API and with a few optimizations: the lseek() call is made - * only when the current file position is unknown or needs to be - * changed based on previous I/O through this driver (don't mix - * I/O from this driver with I/O from other parts of the - * application to the same file). + * Purpose: The POSIX unbuffered file driver using only the HDF5 public + * API and with a few optimizations: the lseek() call is made + * only when the current file position is unknown or needs to be + * changed based on previous I/O through this driver (don't mix + * I/O from this driver with I/O from other parts of the + * application to the same file). */ /* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5FD_sec2_init_interface +#define H5_INTERFACE_INIT_FUNC H5FD_sec2_init_interface -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fprivate.h" /* File access */ -#include "H5FDprivate.h" /* File drivers */ -#include "H5FDsec2.h" /* Sec2 file driver */ -#include "H5FLprivate.h" /* Free Lists */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Pprivate.h" /* Property lists */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* File access */ +#include "H5FDprivate.h" /* File drivers */ +#include "H5FDsec2.h" /* Sec2 file driver */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Pprivate.h" /* Property lists */ /* The driver identification number, initialized at runtime */ static hid_t H5FD_SEC2_g = 0; -/* Since Windows doesn't follow the rest of the world when it comes - * to POSIX I/O types, some typedefs and constants are needed to avoid - * making the code messy with #ifdefs. - */ -#ifdef H5_HAVE_WIN32_API -typedef unsigned int h5_sec2_io_t; -typedef int h5_sec2_io_ret_t; -static int H5_SEC2_MAX_IO_BYTES_g = INT_MAX; -#else -/* Unix, everyone else */ -typedef size_t h5_sec2_io_t; -typedef ssize_t h5_sec2_io_ret_t; -static size_t H5_SEC2_MAX_IO_BYTES_g = SSIZET_MAX; -#endif /* H5_HAVE_WIN32_API */ - -/* The description of a file belonging to this driver. The `eoa' and `eof' +/* The description of a file belonging to this driver. The 'eoa' and 'eof' * determine the amount of hdf5 address space in use and the high-water mark * of the file (the current size of the underlying filesystem file). The - * `pos' value is used to eliminate file position updates when they would be a + * 'pos' value is used to eliminate file position updates when they would be a * no-op. Unfortunately we've found systems that use separate file position * indicators for reading and writing so the lseek can only be eliminated if * the current operation is the same as the previous operation. When opening - * a file the `eof' will be set to the current file size, `eoa' will be set - * to zero, `pos' will be set to H5F_ADDR_UNDEF (as it is when an error - * occurs), and `op' will be set to H5F_OP_UNKNOWN. + * a file the 'eof' will be set to the current file size, `eoa' will be set + * to zero, 'pos' will be set to H5F_ADDR_UNDEF (as it is when an error + * occurs), and 'op' will be set to H5F_OP_UNKNOWN. */ typedef struct H5FD_sec2_t { H5FD_t pub; /* public stuff, must be first */ @@ -129,29 +114,28 @@ typedef struct H5FD_sec2_t { * These macros check for overflow of various quantities. These macros * assume that HDoff_t is signed and haddr_t and size_t are unsigned. * - * ADDR_OVERFLOW: Checks whether a file address of type `haddr_t' - * is too large to be represented by the second argument - * of the file seek function. + * ADDR_OVERFLOW: Checks whether a file address of type `haddr_t' + * is too large to be represented by the second argument + * of the file seek function. * - * SIZE_OVERFLOW: Checks whether a buffer size of type `hsize_t' is too - * large to be represented by the `size_t' type. + * SIZE_OVERFLOW: Checks whether a buffer size of type `hsize_t' is too + * large to be represented by the `size_t' type. * - * REGION_OVERFLOW: Checks whether an address and size pair describe data - * which can be addressed entirely by the second - * argument of the file seek function. + * REGION_OVERFLOW: Checks whether an address and size pair describe data + * which can be addressed entirely by the second + * argument of the file seek function. */ #define MAXADDR (((haddr_t)1<<(8*sizeof(HDoff_t)-1))-1) -#define ADDR_OVERFLOW(A) (HADDR_UNDEF==(A) || \ - ((A) & ~(haddr_t)MAXADDR)) -#define SIZE_OVERFLOW(Z) ((Z) & ~(hsize_t)MAXADDR) -#define REGION_OVERFLOW(A,Z) (ADDR_OVERFLOW(A) || SIZE_OVERFLOW(Z) || \ - HADDR_UNDEF==(A)+(Z) || \ - (HDoff_t)((A)+(Z))<(HDoff_t)(A)) +#define ADDR_OVERFLOW(A) (HADDR_UNDEF==(A) || ((A) & ~(haddr_t)MAXADDR)) +#define SIZE_OVERFLOW(Z) ((Z) & ~(hsize_t)MAXADDR) +#define REGION_OVERFLOW(A,Z) (ADDR_OVERFLOW(A) || SIZE_OVERFLOW(Z) || \ + HADDR_UNDEF==(A)+(Z) || \ + (HDoff_t)((A)+(Z))<(HDoff_t)(A)) /* Prototypes */ static herr_t H5FD_sec2_term(void); static H5FD_t *H5FD_sec2_open(const char *name, unsigned flags, hid_t fapl_id, - haddr_t maxaddr); + haddr_t maxaddr); static herr_t H5FD_sec2_close(H5FD_t *_file); static int H5FD_sec2_cmp(const H5FD_t *_f1, const H5FD_t *_f2); static herr_t H5FD_sec2_query(const H5FD_t *_f1, unsigned long *flags); @@ -160,63 +144,60 @@ static herr_t H5FD_sec2_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr); static haddr_t H5FD_sec2_get_eof(const H5FD_t *_file); static herr_t H5FD_sec2_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle); static herr_t H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, - size_t size, void *buf); + size_t size, void *buf); static herr_t H5FD_sec2_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, - size_t size, const void *buf); + size_t size, const void *buf); static herr_t H5FD_sec2_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); static const H5FD_class_t H5FD_sec2_g = { - "sec2", /*name */ - MAXADDR, /*maxaddr */ - H5F_CLOSE_WEAK, /* fc_degree */ - H5FD_sec2_term, /*terminate */ - NULL, /*sb_size */ - NULL, /*sb_encode */ - NULL, /*sb_decode */ - 0, /*fapl_size */ - NULL, /*fapl_get */ - NULL, /*fapl_copy */ - NULL, /*fapl_free */ - 0, /*dxpl_size */ - NULL, /*dxpl_copy */ - NULL, /*dxpl_free */ - H5FD_sec2_open, /*open */ - H5FD_sec2_close, /*close */ - H5FD_sec2_cmp, /*cmp */ - H5FD_sec2_query, /*query */ - NULL, /*get_type_map */ - NULL, /*alloc */ - NULL, /*free */ - H5FD_sec2_get_eoa, /*get_eoa */ - H5FD_sec2_set_eoa, /*set_eoa */ - H5FD_sec2_get_eof, /*get_eof */ - H5FD_sec2_get_handle, /*get_handle */ - H5FD_sec2_read, /*read */ - H5FD_sec2_write, /*write */ - NULL, /*flush */ - H5FD_sec2_truncate, /*truncate */ - NULL, /*lock */ - NULL, /*unlock */ - H5FD_FLMAP_DICHOTOMY /*fl_map */ + "sec2", /* name */ + MAXADDR, /* maxaddr */ + H5F_CLOSE_WEAK, /* fc_degree */ + H5FD_sec2_term, /* terminate */ + NULL, /* sb_size */ + NULL, /* sb_encode */ + NULL, /* sb_decode */ + 0, /* fapl_size */ + NULL, /* fapl_get */ + NULL, /* fapl_copy */ + NULL, /* fapl_free */ + 0, /* dxpl_size */ + NULL, /* dxpl_copy */ + NULL, /* dxpl_free */ + H5FD_sec2_open, /* open */ + H5FD_sec2_close, /* close */ + H5FD_sec2_cmp, /* cmp */ + H5FD_sec2_query, /* query */ + NULL, /* get_type_map */ + NULL, /* alloc */ + NULL, /* free */ + H5FD_sec2_get_eoa, /* get_eoa */ + H5FD_sec2_set_eoa, /* set_eoa */ + H5FD_sec2_get_eof, /* get_eof */ + H5FD_sec2_get_handle, /* get_handle */ + H5FD_sec2_read, /* read */ + H5FD_sec2_write, /* write */ + NULL, /* flush */ + H5FD_sec2_truncate, /* truncate */ + NULL, /* lock */ + NULL, /* unlock */ + H5FD_FLMAP_DICHOTOMY /* fl_map */ }; /* Declare a free list to manage the H5FD_sec2_t struct */ H5FL_DEFINE_STATIC(H5FD_sec2_t); -/*-------------------------------------------------------------------------- -NAME - H5FD_sec2_init_interface -- Initialize interface-specific information -USAGE - herr_t H5FD_sec2_init_interface() - -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5FD_sec2_init currently). - ---------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------- + * Function: H5FD_sec2_init_interface + * + * Purpose: Initializes any interface-specific data or routines. + * + * Return: Success: The driver ID for the sec2 driver. + * Failure: Negative + * + *------------------------------------------------------------------------- + */ static herr_t H5FD_sec2_init_interface(void) { @@ -227,15 +208,15 @@ H5FD_sec2_init_interface(void) /*------------------------------------------------------------------------- - * Function: H5FD_sec2_init + * Function: H5FD_sec2_init * - * Purpose: Initialize this driver by registering the driver with the - * library. + * Purpose: Initialize this driver by registering the driver with the + * library. * - * Return: Success: The driver ID for the sec2 driver. - * Failure: Negative. + * Return: Success: The driver ID for the sec2 driver. + * Failure: Negative * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, July 29, 1999 * *------------------------------------------------------------------------- @@ -259,11 +240,11 @@ done: /*--------------------------------------------------------------------------- - * Function: H5FD_sec2_term + * Function: H5FD_sec2_term * - * Purpose: Shut down the VFD + * Purpose: Shut down the VFD * - * Returns: Non-negative on success or negative on failure + * Returns: SUCCEED (Can't fail) * * Programmer: Quincey Koziol * Friday, Jan 30, 2004 @@ -283,16 +264,16 @@ H5FD_sec2_term(void) /*------------------------------------------------------------------------- - * Function: H5Pset_fapl_sec2 + * Function: H5Pset_fapl_sec2 * - * Purpose: Modify the file access property list to use the H5FD_SEC2 - * driver defined in this source file. There are no driver - * specific properties. + * Purpose: Modify the file access property list to use the H5FD_SEC2 + * driver defined in this source file. There are no driver + * specific properties. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Robb Matzke - * Thursday, February 19, 1998 + * Programmer: Robb Matzke + * Thursday, February 19, 1998 * *------------------------------------------------------------------------- */ @@ -316,16 +297,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_sec2_open + * Function: H5FD_sec2_open * - * Purpose: Create and/or opens a file as an HDF5 file. + * Purpose: Create and/or opens a file as an HDF5 file. * - * Return: Success: A pointer to a new file data structure. The - * public fields will be initialized by the - * caller, which is always H5FD_open(). - * Failure: NULL + * Return: Success: A pointer to a new file data structure. The + * public fields will be initialized by the + * caller, which is always H5FD_open(). + * Failure: NULL * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, July 29, 1999 * *------------------------------------------------------------------------- @@ -445,14 +426,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_sec2_close + * Function: H5FD_sec2_close * - * Purpose: Closes an HDF5 file. + * Purpose: Closes an HDF5 file. * - * Return: Success: 0 - * Failure: -1, file not closed. + * Return: Success: SUCCEED + * Failure: FAIL, file not closed. * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, July 29, 1999 * *------------------------------------------------------------------------- @@ -460,8 +441,8 @@ done: static herr_t H5FD_sec2_close(H5FD_t *_file) { - H5FD_sec2_t *file = (H5FD_sec2_t *)_file; - herr_t ret_value = SUCCEED; /* Return value */ + H5FD_sec2_t *file = (H5FD_sec2_t *)_file; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -481,16 +462,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_sec2_cmp + * Function: H5FD_sec2_cmp * - * Purpose: Compares two files belonging to this driver using an - * arbitrary (but consistent) ordering. + * Purpose: Compares two files belonging to this driver using an + * arbitrary (but consistent) ordering. * - * Return: Success: A value like strcmp() - * Failure: never fails (arguments were checked by the - * caller). + * Return: Success: A value like strcmp() + * Failure: never fails (arguments were checked by the + * caller). * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, July 29, 1999 * *------------------------------------------------------------------------- @@ -498,8 +479,8 @@ done: static int H5FD_sec2_cmp(const H5FD_t *_f1, const H5FD_t *_f2) { - const H5FD_sec2_t *f1 = (const H5FD_sec2_t *)_f1; - const H5FD_sec2_t *f2 = (const H5FD_sec2_t *)_f2; + const H5FD_sec2_t *f1 = (const H5FD_sec2_t *)_f1; + const H5FD_sec2_t *f2 = (const H5FD_sec2_t *)_f2; int ret_value = 0; FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -540,15 +521,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_sec2_query + * Function: H5FD_sec2_query * - * Purpose: Set the flags that this VFL driver is capable of supporting. + * Purpose: Set the flags that this VFL driver is capable of supporting. * (listed in H5FDpublic.h) * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED (Can't fail) * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, August 25, 2000 * *------------------------------------------------------------------------- @@ -579,21 +559,19 @@ H5FD_sec2_query(const H5FD_t *_file, unsigned long *flags /* out */) /*------------------------------------------------------------------------- - * Function: H5FD_sec2_get_eoa + * Function: H5FD_sec2_get_eoa * - * Purpose: Gets the end-of-address marker for the file. The EOA marker - * is the first address past the last byte allocated in the - * format address space. + * Purpose: Gets the end-of-address marker for the file. The EOA marker + * is the first address past the last byte allocated in the + * format address space. * - * Return: Success: The end-of-address marker. - * Failure: HADDR_UNDEF + * Return: The end-of-address marker. * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, August 2, 1999 * *------------------------------------------------------------------------- */ -/* ARGSUSED */ static haddr_t H5FD_sec2_get_eoa(const H5FD_t *_file, H5FD_mem_t UNUSED type) { @@ -606,21 +584,19 @@ H5FD_sec2_get_eoa(const H5FD_t *_file, H5FD_mem_t UNUSED type) /*------------------------------------------------------------------------- - * Function: H5FD_sec2_set_eoa + * Function: H5FD_sec2_set_eoa * - * Purpose: Set the end-of-address marker for the file. This function is - * called shortly after an existing HDF5 file is opened in order - * to tell the driver where the end of the HDF5 data is located. + * Purpose: Set the end-of-address marker for the file. This function is + * called shortly after an existing HDF5 file is opened in order + * to tell the driver where the end of the HDF5 data is located. * - * Return: Success: 0 - * Failure: -1 + * Return: SUCCEED (Can't fail) * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, July 29, 1999 * *------------------------------------------------------------------------- */ -/* ARGSUSED */ static herr_t H5FD_sec2_set_eoa(H5FD_t *_file, H5FD_mem_t UNUSED type, haddr_t addr) { @@ -635,18 +611,16 @@ H5FD_sec2_set_eoa(H5FD_t *_file, H5FD_mem_t UNUSED type, haddr_t addr) /*------------------------------------------------------------------------- - * Function: H5FD_sec2_get_eof + * Function: H5FD_sec2_get_eof * - * Purpose: Returns the end-of-file marker, which is the greater of - * either the filesystem end-of-file or the HDF5 end-of-address - * markers. + * Purpose: Returns the end-of-file marker, which is the greater of + * either the filesystem end-of-file or the HDF5 end-of-address + * markers. * - * Return: Success: End of file address, the first address past - * the end of the "file", either the filesystem file - * or the HDF5 file. - * Failure: HADDR_UNDEF + * Return: End of file address, the first address past the end of the + * "file", either the filesystem file or the HDF5 file. * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, July 29, 1999 * *------------------------------------------------------------------------- @@ -654,7 +628,7 @@ H5FD_sec2_set_eoa(H5FD_t *_file, H5FD_mem_t UNUSED type, haddr_t addr) static haddr_t H5FD_sec2_get_eof(const H5FD_t *_file) { - const H5FD_sec2_t *file = (const H5FD_sec2_t *)_file; + const H5FD_sec2_t *file = (const H5FD_sec2_t *)_file; FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -667,14 +641,13 @@ H5FD_sec2_get_eof(const H5FD_t *_file) * * Purpose: Returns the file handle of sec2 file driver. * - * Returns: Non-negative if succeed or negative if fails. + * Returns: SUCCEED/FAIL * * Programmer: Raymond Lu * Sept. 16, 2002 * *------------------------------------------------------------------------- */ -/* ARGSUSED */ static herr_t H5FD_sec2_get_handle(H5FD_t *_file, hid_t UNUSED fapl, void **file_handle) { @@ -694,22 +667,21 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_sec2_read + * Function: H5FD_sec2_read * - * Purpose: Reads SIZE bytes of data from FILE beginning at address ADDR - * into buffer BUF according to data transfer properties in - * DXPL_ID. + * Purpose: Reads SIZE bytes of data from FILE beginning at address ADDR + * into buffer BUF according to data transfer properties in + * DXPL_ID. * - * Return: Success: Zero. Result is stored in caller-supplied - * buffer BUF. - * Failure: -1, Contents of buffer BUF are undefined. + * Return: Success: SUCCEED. Result is stored in caller-supplied + * buffer BUF. + * Failure: FAIL, Contents of buffer BUF are undefined. * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, July 29, 1999 * *------------------------------------------------------------------------- */ -/* ARGSUSED */ static herr_t H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, haddr_t addr, size_t size, void *buf /*out*/) @@ -748,16 +720,16 @@ H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, */ while(size > 0) { - h5_sec2_io_t bytes_in = 0; /* # of bytes to read */ - h5_sec2_io_ret_t bytes_read = -1; /* # of bytes actually read */ + h5_posix_io_t bytes_in = 0; /* # of bytes to read */ + h5_posix_io_ret_t bytes_read = -1; /* # of bytes actually read */ /* Trying to read more bytes than the return type can handle is * undefined behavior in POSIX. */ - if(size > H5_SEC2_MAX_IO_BYTES_g) - bytes_in = H5_SEC2_MAX_IO_BYTES_g; + if(size > H5_POSIX_MAX_IO_BYTES) + bytes_in = H5_POSIX_MAX_IO_BYTES; else - bytes_in = (h5_sec2_io_t)size; + bytes_in = (h5_posix_io_t)size; do { bytes_read = HDread(file->fd, buf, bytes_in); @@ -768,7 +740,7 @@ H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, time_t mytime = HDtime(NULL); HDoff_t myoffset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR); - HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, error message = '%s', buf = %p, size = %lu, offset = %llu", HDctime(&mytime), file->filename, file->fd, myerrno, HDstrerror(myerrno), buf, (unsigned long)size, (unsigned long long)myoffset); + HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, error message = '%s', buf = %p, total read size = %llu, bytes this sub-read = %llu, bytes actually read = %llu, offset = %llu", HDctime(&mytime), file->filename, file->fd, myerrno, HDstrerror(myerrno), buf, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_read, (unsigned long long)myoffset); } /* end if */ if(0 == bytes_read) { @@ -801,21 +773,19 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_sec2_write + * Function: H5FD_sec2_write * - * Purpose: Writes SIZE bytes of data to FILE beginning at address ADDR - * from buffer BUF according to data transfer properties in - * DXPL_ID. + * Purpose: Writes SIZE bytes of data to FILE beginning at address ADDR + * from buffer BUF according to data transfer properties in + * DXPL_ID. * - * Return: Success: Zero - * Failure: -1 + * Return: SUCCEED/FAIL * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, July 29, 1999 * *------------------------------------------------------------------------- */ -/* ARGSUSED */ static herr_t H5FD_sec2_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, haddr_t addr, size_t size, const void *buf) @@ -847,16 +817,16 @@ H5FD_sec2_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, */ while(size > 0) { - h5_sec2_io_t bytes_in = 0; /* # of bytes to write */ - h5_sec2_io_ret_t bytes_wrote = -1; /* # of bytes written */ + h5_posix_io_t bytes_in = 0; /* # of bytes to write */ + h5_posix_io_ret_t bytes_wrote = -1; /* # of bytes written */ /* Trying to write more bytes than the return type can handle is * undefined behavior in POSIX. */ - if(size > H5_SEC2_MAX_IO_BYTES_g) - bytes_in = H5_SEC2_MAX_IO_BYTES_g; + if(size > H5_POSIX_MAX_IO_BYTES) + bytes_in = H5_POSIX_MAX_IO_BYTES; else - bytes_in = (h5_sec2_io_t)size; + bytes_in = (h5_posix_io_t)size; do { bytes_wrote = HDwrite(file->fd, buf, bytes_in); @@ -867,7 +837,7 @@ H5FD_sec2_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, time_t mytime = HDtime(NULL); HDoff_t myoffset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR); - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, error message = '%s', buf = %p, size = %lu, offset = %llu", HDctime(&mytime), file->filename, file->fd, myerrno, HDstrerror(myerrno), buf, (unsigned long)size, (unsigned long long)myoffset); + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, error message = '%s', buf = %p, total write size = %llu, bytes this sub-write = %llu, bytes actually written = %llu, offset = %llu", HDctime(&mytime), file->filename, file->fd, myerrno, HDstrerror(myerrno), buf, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_wrote, (unsigned long long)myoffset); } /* end if */ HDassert(bytes_wrote > 0); @@ -896,20 +866,18 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_sec2_truncate + * Function: H5FD_sec2_truncate * - * Purpose: Makes sure that the true file size is the same (or larger) - * than the end-of-address. + * Purpose: Makes sure that the true file size is the same (or larger) + * than the end-of-address. * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, August 4, 1999 * *------------------------------------------------------------------------- */ -/* ARGSUSED */ static herr_t H5FD_sec2_truncate(H5FD_t *_file, hid_t UNUSED dxpl_id, hbool_t UNUSED closing) { @@ -970,4 +938,3 @@ H5FD_sec2_truncate(H5FD_t *_file, hid_t UNUSED dxpl_id, hbool_t UNUSED closing) done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_sec2_truncate() */ - diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c index 6dbc515..9b1dbf9 100644 --- a/src/H5FDstdio.c +++ b/src/H5FDstdio.c @@ -368,26 +368,35 @@ H5FD_stdio_open( const char *name, unsigned flags, hid_t fapl_id, if (ADDR_OVERFLOW(maxaddr)) H5Epush_ret(func, H5E_ERR_CLS, H5E_ARGS, H5E_OVERFLOW, "maxaddr too large", NULL) - /* Attempt to open/create the file */ - if (access(name, F_OK) < 0) { - if ((flags & H5F_ACC_CREAT) && (flags & H5F_ACC_RDWR)) { + /* Tentatively open file in read-only mode, to check for existence */ + if(flags & H5F_ACC_RDWR) + f = fopen(name, "rb+"); + else + f = fopen(name, "rb"); + + if(!f) { + /* File doesn't exist */ + if(flags & H5F_ACC_CREAT) { + assert(flags & H5F_ACC_RDWR); f = fopen(name, "wb+"); write_access = 1; /* Note the write access */ } else H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_CANTOPENFILE, "file doesn't exist and CREAT wasn't specified", NULL) - } else if ((flags & H5F_ACC_CREAT) && (flags & H5F_ACC_EXCL)) { + } else if(flags & H5F_ACC_EXCL) { + /* File exists, but EXCL is passed. Fail. */ + assert(flags & H5F_ACC_CREAT); + fclose(f); H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_FILEEXISTS, "file exists but CREAT and EXCL were specified", NULL) - } else if (flags & H5F_ACC_RDWR) { - if (flags & H5F_ACC_TRUNC) - f = fopen(name, "wb+"); - else - f = fopen(name, "rb+"); + } else if(flags & H5F_ACC_RDWR) { + if(flags & H5F_ACC_TRUNC) + f = freopen(name, "wb+", f); write_access = 1; /* Note the write access */ - } else { - f = fopen(name, "rb"); - } - if (!f) + } /* end if */ + /* Note there is no need to reopen if neither TRUNC nor EXCL are specified, + * as the tentative open will work */ + + if(!f) H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_CANTOPENFILE, "fopen failed", NULL) /* Build the return value */ @@ -409,23 +418,36 @@ H5FD_stdio_open( const char *name, unsigned flags, hid_t fapl_id, /* Get the file descriptor (needed for truncate and some Windows information) */ file->fd = fileno(file->fp); - if(file->fd < 0) + if(file->fd < 0) { + free(file); + fclose(f); H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_CANTOPENFILE, "unable to get file descriptor", NULL); + } /* end if */ #ifdef H5_HAVE_WIN32_API file->hFile = (HANDLE)_get_osfhandle(file->fd); - if(INVALID_HANDLE_VALUE == file->hFile) + if(INVALID_HANDLE_VALUE == file->hFile) { + free(file); + fclose(f); H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_CANTOPENFILE, "unable to get Windows file handle", NULL); + } /* end if */ - if(!GetFileInformationByHandle((HANDLE)file->hFile, &fileinfo)) - H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_CANTOPENFILE, "unable to get Windows file desinformationcriptor", NULL); + if(!GetFileInformationByHandle((HANDLE)file->hFile, &fileinfo)) { + free(file); + fclose(f); + H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_CANTOPENFILE, "unable to get Windows file descriptor information", NULL); + } /* end if */ file->nFileIndexHigh = fileinfo.nFileIndexHigh; file->nFileIndexLow = fileinfo.nFileIndexLow; file->dwVolumeSerialNumber = fileinfo.dwVolumeSerialNumber; #else /* H5_HAVE_WIN32_API */ - fstat(file->fd, &sb); + if(fstat(file->fd, &sb) < 0) { + free(file); + fclose(f); + H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_BADFILE, "unable to fstat file", NULL) + } /* end if */ file->device = sb.st_dev; #ifdef H5_VMS file->inode[0] = sb.st_ino[0]; diff --git a/src/H5Fmpi.c b/src/H5Fmpi.c index 966528a..07d29f2 100644 --- a/src/H5Fmpi.c +++ b/src/H5Fmpi.c @@ -37,7 +37,6 @@ #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ #include "H5Fpkg.h" /* File access */ -#include "H5FDmpi.h" /* MPI-based file drivers */ #include "H5FDprivate.h" /* File drivers */ #include "H5Iprivate.h" /* IDs */ diff --git a/src/H5Gint.c b/src/H5Gint.c index ad2e57e..fe8b995 100644 --- a/src/H5Gint.c +++ b/src/H5Gint.c @@ -928,7 +928,7 @@ H5G_visit_cb(const H5O_link_t *lnk, void *_udata) /* Build the link's relative path name */ HDassert(udata->path[old_path_len] == '\0'); - HDstrcpy(&(udata->path[old_path_len]), lnk->name); + HDstrncpy(&(udata->path[old_path_len]), lnk->name, link_name_len + 1); udata->curr_path_len += link_name_len; /* Construct the link info from the link message */ @@ -992,7 +992,7 @@ H5G_visit_cb(const H5O_link_t *lnk, void *_udata) /* Add the path separator to the current path */ HDassert(udata->path[udata->curr_path_len] == '\0'); - HDstrcpy(&(udata->path[udata->curr_path_len]), "/"); + HDstrncpy(&(udata->path[udata->curr_path_len]), "/", 2); udata->curr_path_len++; /* Attempt to get the link info for this group */ diff --git a/src/H5Gname.c b/src/H5Gname.c index 576d866..72da498 100644 --- a/src/H5Gname.c +++ b/src/H5Gname.c @@ -293,7 +293,9 @@ static H5RS_str_t * H5G_build_fullpath(const char *prefix, const char *name) { char *full_path; /* Full user path built */ + size_t orig_path_len; /* Original length of the path */ size_t path_len; /* Length of the path */ + size_t name_len; /* Length of the name */ unsigned need_sep; /* Flag to indicate if separator is needed */ H5RS_str_t *ret_value; /* Return value */ @@ -304,7 +306,7 @@ H5G_build_fullpath(const char *prefix, const char *name) HDassert(name); /* Get the length of the prefix */ - path_len = HDstrlen(prefix); + orig_path_len = path_len = HDstrlen(prefix); /* Determine if there is a trailing separator in the name */ if(prefix[path_len - 1] == '/') @@ -313,20 +315,21 @@ H5G_build_fullpath(const char *prefix, const char *name) need_sep = 1; /* Add in the length needed for the '/' separator and the relative path */ - path_len += HDstrlen(name) + need_sep; + name_len = HDstrlen(name); + path_len += name_len + need_sep; /* Allocate space for the path */ if(NULL == (full_path = (char *)H5FL_BLK_MALLOC(str_buf, path_len + 1))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Build full path */ - HDstrcpy(full_path, prefix); + HDstrncpy(full_path, prefix, orig_path_len + 1); if(need_sep) - HDstrcat(full_path, "/"); - HDstrcat(full_path, name); + HDstrncat(full_path, "/", 1); + HDstrncat(full_path, name, name_len); /* Create reference counted string for path */ - if((ret_value = H5RS_own(full_path)) == NULL) + if(NULL == (ret_value = H5RS_own(full_path))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") done: @@ -423,7 +426,7 @@ H5G_build_fullpath_refstr_refstr(const H5RS_str_t *prefix_r, const H5RS_str_t *n herr_t H5G__name_init(H5G_name_t *name, const char *path) { - FUNC_ENTER_PACKAGE + FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ HDassert(name); @@ -717,6 +720,7 @@ H5G_name_move_path(H5RS_str_t **path_r_ptr, const char *full_suffix, const char path_len = HDstrlen(path); if(full_suffix_len < path_len) { const char *dst_suffix; /* Destination suffix that changes */ + size_t dst_suffix_len; /* Length of destination suffix */ const char *src_suffix; /* Source suffix that changes */ size_t path_prefix_len; /* Length of path prefix */ const char *path_prefix2; /* 2nd prefix for path */ @@ -747,25 +751,26 @@ H5G_name_move_path(H5RS_str_t **path_r_ptr, const char *full_suffix, const char /* Determine destination suffix */ dst_suffix = dst_path + (common_prefix_len - 1); + dst_suffix_len = HDstrlen(dst_suffix); /* Compute path prefix before src suffix*/ path_prefix2 = path; path_prefix2_len = path_prefix_len - HDstrlen(src_suffix); /* Allocate space for the new path */ - new_path_len = path_prefix2_len + HDstrlen(dst_suffix) + full_suffix_len; + new_path_len = path_prefix2_len + dst_suffix_len + full_suffix_len; if(NULL == (new_path = (char *)H5FL_BLK_MALLOC(str_buf, new_path_len + 1))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") /* Create the new path */ if(path_prefix2_len > 0) { - HDstrncpy(new_path, path_prefix2, path_prefix2_len); - HDstrcpy(new_path + path_prefix2_len, dst_suffix); + HDstrncpy(new_path, path_prefix2, path_prefix2_len + 1); + HDstrncpy(new_path + path_prefix2_len, dst_suffix, dst_suffix_len + 1); } /* end if */ else - HDstrcpy(new_path, dst_suffix); + HDstrncpy(new_path, dst_suffix, dst_suffix_len + 1); if(full_suffix_len > 0) - HDstrcat(new_path, full_suffix); + HDstrncat(new_path, full_suffix, full_suffix_len); /* Release previous path */ H5RS_decr(*path_r_ptr); @@ -887,23 +892,25 @@ H5G_name_replace_cb(void *obj_ptr, hid_t obj_id, void *key) if(obj_in_child) { const char *full_path; /* Full path of current object */ const char *src_path; /* Full path of source object */ + size_t src_path_len; /* Length of source full path */ char *new_full_path; /* New full path of object */ size_t new_full_len; /* Length of new full path */ /* Get pointers to paths of interest */ full_path = H5RS_get_str(obj_path->full_path_r); src_path = H5RS_get_str(names->src_full_path_r); + src_path_len = HDstrlen(src_path); /* Build new full path */ /* Allocate space for the new full path */ - new_full_len = HDstrlen(src_path) + HDstrlen(full_path); + new_full_len = src_path_len + HDstrlen(full_path); if(NULL == (new_full_path = (char *)H5FL_BLK_MALLOC(str_buf, new_full_len + 1))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") /* Create the new full path */ - HDstrcpy(new_full_path, src_path); - HDstrcat(new_full_path, full_path); + HDstrncpy(new_full_path, src_path, src_path_len + 1); + HDstrncat(new_full_path, full_path, new_full_len); /* Release previous full path */ H5RS_decr(obj_path->full_path_r); @@ -931,6 +938,7 @@ H5G_name_replace_cb(void *obj_ptr, hid_t obj_id, void *key) if(obj_in_child) { const char *full_path; /* Full path of current object */ const char *full_suffix; /* Full path after source path */ + size_t full_suffix_len; /* Length of full path after source path */ const char *src_path; /* Full path of source object */ char *new_full_path; /* New full path of object */ @@ -940,13 +948,14 @@ H5G_name_replace_cb(void *obj_ptr, hid_t obj_id, void *key) /* Construct full path suffix */ full_suffix = full_path + HDstrlen(src_path); + full_suffix_len = HDstrlen(full_suffix); /* Build new full path */ /* Create the new full path */ - if(NULL == (new_full_path = (char *)H5FL_BLK_MALLOC(str_buf, HDstrlen(full_suffix) + 1))) + if(NULL == (new_full_path = (char *)H5FL_BLK_MALLOC(str_buf, full_suffix_len + 1))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") - HDstrcpy(new_full_path, full_suffix); + HDstrncpy(new_full_path, full_suffix, full_suffix_len + 1); /* Release previous full path */ H5RS_decr(obj_path->full_path_r); @@ -992,10 +1001,12 @@ H5G_name_replace_cb(void *obj_ptr, hid_t obj_id, void *key) if(H5G_common_path(obj_path->full_path_r, names->src_full_path_r)) { const char *full_path; /* Full path of current object */ const char *full_suffix; /* Suffix of full path, after src_path */ + size_t full_suffix_len; /* Length of suffix of full path after src_path*/ char *new_full_path; /* New full path of object */ size_t new_full_len; /* Length of new full path */ const char *src_path; /* Full path of source object */ const char *dst_path; /* Full path of destination object */ + size_t dst_path_len; /* Length of destination's full path */ /* Sanity check */ HDassert(names->dst_full_path_r); @@ -1004,6 +1015,7 @@ H5G_name_replace_cb(void *obj_ptr, hid_t obj_id, void *key) full_path = H5RS_get_str(obj_path->full_path_r); src_path = H5RS_get_str(names->src_full_path_r); dst_path = H5RS_get_str(names->dst_full_path_r); + dst_path_len = HDstrlen(dst_path); /* Make certain that the source and destination names are full (not relative) paths */ HDassert(*src_path == '/'); @@ -1011,6 +1023,7 @@ H5G_name_replace_cb(void *obj_ptr, hid_t obj_id, void *key) /* Get pointer to "full suffix" */ full_suffix = full_path + HDstrlen(src_path); + full_suffix_len = HDstrlen(full_suffix); /* Update the user path, if one exists */ if(obj_path->user_path_r) @@ -1020,13 +1033,13 @@ H5G_name_replace_cb(void *obj_ptr, hid_t obj_id, void *key) /* Build new full path */ /* Allocate space for the new full path */ - new_full_len = HDstrlen(dst_path) + HDstrlen(full_suffix); + new_full_len = dst_path_len + full_suffix_len; if(NULL == (new_full_path = (char *)H5FL_BLK_MALLOC(str_buf, new_full_len + 1))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") /* Create the new full path */ - HDstrcpy(new_full_path, dst_path); - HDstrcat(new_full_path, full_suffix); + HDstrncpy(new_full_path, dst_path, dst_path_len + 1); + HDstrncat(new_full_path, full_suffix, full_suffix_len); /* Release previous full path */ H5RS_decr(obj_path->full_path_r); @@ -1318,7 +1331,7 @@ H5G_get_name_by_addr(hid_t file, hid_t lapl_id, hid_t dxpl_id, const H5O_loc_t * /* If there's a buffer provided, copy into it, up to the limit of its size */ if(name) { /* Copy the initial path separator */ - HDstrcpy(name, "/"); + HDstrncpy(name, "/", 2); /* Append the rest of the path */ /* (less one character, for the initial path separator) */ diff --git a/src/H5Gtest.c b/src/H5Gtest.c index e83097e..ccfca9d 100644 --- a/src/H5Gtest.c +++ b/src/H5Gtest.c @@ -568,7 +568,7 @@ H5G__user_path_test(hid_t obj_id, char *user_path, size_t *user_path_len, unsign /* Set the user path, if given */ if(user_path) - HDstrcpy(user_path, H5RS_get_str(obj_path->user_path_r)); + HDstrncpy(user_path, H5RS_get_str(obj_path->user_path_r), (size_t)(len + 1)); /* Set the length of the path */ *user_path_len = (size_t)len; diff --git a/src/H5HFdbg.c b/src/H5HFdbg.c index 8d2b6fa..5d68fd1 100644 --- a/src/H5HFdbg.c +++ b/src/H5HFdbg.c @@ -381,7 +381,7 @@ H5HF_dblock_debug_cb(H5FS_section_info_t *_sect, void *_udata) size_t start, end; /* Start & end of the overlapping area */ size_t len; /* Length of the overlapping area */ size_t overlap; /* Track any overlaps */ - unsigned u; /* Local index variable */ + size_t u; /* Local index variable */ /* Calculate the starting & ending */ if(sect_start < dblock_start) @@ -396,7 +396,7 @@ H5HF_dblock_debug_cb(H5FS_section_info_t *_sect, void *_udata) /* Calculate the length */ len = end - start; - sprintf(temp_str, "Section #%u:", (unsigned)udata->sect_count); + HDsnprintf(temp_str, sizeof(temp_str), "Section #%u:", (unsigned)udata->sect_count); HDfprintf(udata->stream, "%*s%-*s %8Zu, %8Zu\n", udata->indent + 3, "", MAX(0, udata->fwidth - 9), temp_str, start, len); @@ -530,7 +530,7 @@ H5HF_dblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, HDfprintf(stream, "%*s%-*s %.2f%%\n", indent, "", fwidth, "Percent of available space for data used:", - (100.0 * (double)((dblock->size - blk_prefix_size) - amount_free) / (double)(dblock->size - blk_prefix_size))); + ((double)100.0f * (double)((dblock->size - blk_prefix_size) - amount_free) / (double)(dblock->size - blk_prefix_size))); /* * Print the data in a VMS-style octal dump. @@ -614,13 +614,13 @@ H5HF_iblock_print(const H5HF_indirect_t *iblock, else HDfprintf(stream, "%*sDirect Block Entries: (address)\n", indent, ""); for(u = 0; u < hdr->man_dtable.max_direct_rows && u < iblock->nrows; u++) { - sprintf(temp_str, "Row #%u: (block size: %lu)", (unsigned)u, (unsigned long)hdr->man_dtable.row_block_size[u]); + HDsnprintf(temp_str, sizeof(temp_str), "Row #%u: (block size: %lu)", (unsigned)u, (unsigned long)hdr->man_dtable.row_block_size[u]); HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3), temp_str); for(v = 0; v < hdr->man_dtable.cparam.width; v++) { size_t off = (u * hdr->man_dtable.cparam.width) + v; - sprintf(temp_str, "Col #%u:", (unsigned)v); + HDsnprintf(temp_str, sizeof(temp_str), "Col #%u:", (unsigned)v); if(hdr->filter_len > 0) HDfprintf(stream, "%*s%-*s %9a/%6Zu/%x\n", indent + 6, "", MAX(0, fwidth - 6), temp_str, @@ -642,13 +642,13 @@ H5HF_iblock_print(const H5HF_indirect_t *iblock, H5V_log2_of2(hdr->man_dtable.cparam.width); for(u = hdr->man_dtable.max_direct_rows; u < iblock->nrows; u++) { num_indirect_rows = (H5V_log2_gen(hdr->man_dtable.row_block_size[u]) - first_row_bits) + 1; - sprintf(temp_str, "Row #%u: (# of rows: %u)", (unsigned)u, num_indirect_rows); + HDsnprintf(temp_str, sizeof(temp_str), "Row #%u: (# of rows: %u)", (unsigned)u, num_indirect_rows); HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3), temp_str); for(v = 0; v < hdr->man_dtable.cparam.width; v++) { size_t off = (u * hdr->man_dtable.cparam.width) + v; - sprintf(temp_str, "Col #%u:", (unsigned)v); + HDsnprintf(temp_str, sizeof(temp_str), "Col #%u:", (unsigned)v); HDfprintf(stream, "%*s%-*s %9a\n", indent + 6, "", MAX(0, fwidth - 6), temp_str, iblock->ents[off].addr); diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c index 365124d..2f42bf1 100644 --- a/src/H5Lexternal.c +++ b/src/H5Lexternal.c @@ -102,7 +102,7 @@ H5L_getenv_prefix_name(char **env_prefix/*in,out*/) FUNC_ENTER_NOAPI_NOINIT_NOERR - strret = HDstrchr(*env_prefix, COLON_SEPC); + strret = HDstrchr(*env_prefix, H5_COLON_SEPC); if (strret == NULL) { retptr = *env_prefix; *env_prefix = strret; @@ -144,14 +144,9 @@ H5L_build_name(char *prefix, char *file_name, char **full_name/*out*/) if(NULL == (*full_name = (char *)H5MM_malloc(prefix_len + fname_len + 2))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate filename buffer") - /* Copy the prefix into the buffer */ - HDstrcpy(*full_name, prefix); - - if (!CHECK_DELIMITER(prefix[prefix_len-1])) - HDstrcat(*full_name, DIR_SEPS); - - /* Add the external link's filename to the prefix supplied */ - HDstrcat(*full_name, file_name); + /* Compose the full file name */ + HDsnprintf(*full_name, (prefix_len + fname_len + 2), "%s%s%s", prefix, + (H5_CHECK_DELIMITER(prefix[prefix_len - 1]) ? "" : H5_DIR_SEPS), file_name); done: FUNC_LEAVE_NOAPI(ret_value) @@ -319,24 +314,32 @@ H5L_extern_traverse(const char UNUSED *link_name, hid_t cur_group, HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") /* target file_name is an absolute pathname: see RM for detailed description */ - if(CHECK_ABSOLUTE(file_name) || CHECK_ABS_PATH(file_name)) { + if(H5_CHECK_ABSOLUTE(file_name) || H5_CHECK_ABS_PATH(file_name)) { /* Try opening file */ if(NULL == (ext_file = H5F_efc_open(loc.oloc->file, file_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, H5AC_dxpl_id))) { - char *ptr = NULL; + char *ptr; H5E_clear_stack(NULL); /* get last component of file_name */ - GET_LAST_DELIMITER(file_name, ptr) + H5_GET_LAST_DELIMITER(file_name, ptr) HDassert(ptr); - HDstrcpy(temp_file_name, ++ptr); + + /* Increment past delimiter */ + ptr++; + + /* Copy into the temp. file name */ + HDstrncpy(temp_file_name, ptr, HDstrlen(ptr) + 1); } /* end if */ } /* end if */ - else if(CHECK_ABS_DRIVE(file_name)) { + else if(H5_CHECK_ABS_DRIVE(file_name)) { + /* Try opening file */ if(NULL == (ext_file = H5F_efc_open(loc.oloc->file, file_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, H5AC_dxpl_id))) { + H5E_clear_stack(NULL); + /* strip ":" */ - HDstrcpy(temp_file_name, &file_name[2]); + HDstrncpy(temp_file_name, &file_name[2], (HDstrlen(file_name) - 2) + 1); } /* end if */ } /* end if */ @@ -414,7 +417,7 @@ H5L_extern_traverse(const char UNUSED *link_name, hid_t cur_group, HGOTO_ERROR(H5E_LINK, H5E_CANTALLOC, FAIL, "can't duplicate resolved file name string") /* get last component of file_name */ - GET_LAST_DELIMITER(actual_file_name, ptr) + H5_GET_LAST_DELIMITER(actual_file_name, ptr) if(!ptr) HGOTO_ERROR(H5E_LINK, H5E_CANTOPENFILE, FAIL, "unable to open external file, external link file name = '%s', temp_file_name = '%s'", file_name, temp_file_name) @@ -543,6 +546,8 @@ H5Lcreate_external(const char *file_name, const char *obj_name, char *norm_obj_name = NULL; /* Pointer to normalized current name */ void *ext_link_buf = NULL; /* Buffer to contain external link */ size_t buf_size; /* Size of buffer to hold external link */ + size_t file_name_len; /* Length of file name string */ + size_t norm_obj_name_len; /* Length of normalized object name string */ uint8_t *p; /* Pointer into external link buffer */ herr_t ret_value = SUCCEED; /* Return value */ @@ -565,16 +570,18 @@ H5Lcreate_external(const char *file_name, const char *obj_name, HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "can't normalize object name") /* Combine the filename and link name into a single buffer to give to the UD link */ - buf_size = 1 + (HDstrlen(file_name) + 1) + (HDstrlen(norm_obj_name) + 1); + file_name_len = HDstrlen(file_name) + 1; + norm_obj_name_len = HDstrlen(norm_obj_name) + 1; + buf_size = 1 + file_name_len + norm_obj_name_len; if(NULL == (ext_link_buf = H5MM_malloc(buf_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate udata buffer") /* Encode the external link information */ p = (uint8_t *)ext_link_buf; *p++ = (H5L_EXT_VERSION << 4) | H5L_EXT_FLAGS_ALL; /* External link version & flags */ - HDstrcpy((char *)p, file_name); /* Name of file containing external link's object */ - p += HDstrlen(file_name) + 1; - HDstrcpy((char *)p, norm_obj_name); /* External link's object */ + HDstrncpy((char *)p, file_name, file_name_len); /* Name of file containing external link's object */ + p += file_name_len; + HDstrncpy((char *)p, norm_obj_name, norm_obj_name_len); /* External link's object */ /* Create an external link */ if(H5L_create_ud(&link_loc, link_name, ext_link_buf, buf_size, H5L_TYPE_EXTERNAL, lcpl_id, lapl_id, H5AC_dxpl_id) < 0) diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c index d54f454..f131be2 100644 --- a/src/H5Ocopy.c +++ b/src/H5Ocopy.c @@ -1254,7 +1254,7 @@ H5O_copy_obj_by_ref(H5O_loc_t *src_oloc, hid_t dxpl_id, H5O_loc_t *dst_oloc, new_oloc.addr = dst_oloc->addr; /* Pick a default name for the new object */ - sprintf(tmp_obj_name, "~obj_pointed_by_%llu", (unsigned long long)dst_oloc->addr); + HDsnprintf(tmp_obj_name, sizeof(tmp_obj_name), "~obj_pointed_by_%llu", (unsigned long long)dst_oloc->addr); /* Create a link to the newly copied object */ /* Note: since H5O_copy_header_map actually copied the target object, it diff --git a/src/H5Oname.c b/src/H5Oname.c index fb44000..c1cb8c8 100644 --- a/src/H5Oname.c +++ b/src/H5Oname.c @@ -97,10 +97,10 @@ H5O_name_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, HDassert(p); /* decode */ - if(NULL == (mesg = (H5O_name_t *)H5MM_calloc(sizeof(H5O_name_t))) || - NULL == (mesg->s = (char *)H5MM_malloc(HDstrlen((const char *)p) + 1))) + if(NULL == (mesg = (H5O_name_t *)H5MM_calloc(sizeof(H5O_name_t)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + if(NULL == (mesg->s = (char *)H5MM_strdup((const char *)p))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - HDstrcpy(mesg->s, (const char *)p); /* Set return value */ ret_value = mesg; @@ -138,9 +138,9 @@ H5O_name_encode(H5F_t UNUSED *f, hbool_t UNUSED disable_shared, uint8_t *p, cons FUNC_ENTER_NOAPI_NOINIT_NOERR /* check args */ - assert(f); - assert(p); - assert(mesg && mesg->s); + HDassert(f); + HDassert(p); + HDassert(mesg && mesg->s); /* encode */ HDstrcpy((char*)p, mesg->s); diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c index ec7def8..4754aa5 100644 --- a/src/H5Pdxpl.c +++ b/src/H5Pdxpl.c @@ -158,6 +158,15 @@ #define H5D_XFER_XFORM_COPY H5P__dxfr_xform_copy #define H5D_XFER_XFORM_CMP H5P__dxfr_xform_cmp #define H5D_XFER_XFORM_CLOSE H5P__dxfr_xform_close +/* Definitions for properties of direct chunk write */ +#define H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_SIZE sizeof(hbool_t) +#define H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_DEF FALSE +#define H5D_XFER_DIRECT_CHUNK_WRITE_FILTERS_SIZE sizeof(uint32_t) +#define H5D_XFER_DIRECT_CHUNK_WRITE_FILTERS_DEF 0 +#define H5D_XFER_DIRECT_CHUNK_WRITE_OFFSET_SIZE sizeof(hsize_t *) +#define H5D_XFER_DIRECT_CHUNK_WRITE_OFFSET_DEF NULL +#define H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_SIZE sizeof(size_t) +#define H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_DEF 0 /******************/ /* Local Typedefs */ @@ -254,7 +263,10 @@ static const H5Z_EDC_t H5D_def_enable_edc_g = H5D_XFER_EDC_DEF; /* De static const H5Z_cb_t H5D_def_filter_cb_g = H5D_XFER_FILTER_CB_DEF; /* Default value for filter callback */ static const H5T_conv_cb_t H5D_def_conv_cb_g = H5D_XFER_CONV_CB_DEF; /* Default value for datatype conversion callback */ static const void *H5D_def_xfer_xform_g = H5D_XFER_XFORM_DEF; /* Default value for data transform */ - +static const hbool_t H5D_def_direct_chunk_flag_g = H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_DEF; /* Default value for the flag of direct chunk write */ +static const uint32_t H5D_def_direct_chunk_filters_g = H5D_XFER_DIRECT_CHUNK_WRITE_FILTERS_DEF; /* Default value for the filters of direct chunk write */ +static const hsize_t *H5D_def_direct_chunk_offset_g = H5D_XFER_DIRECT_CHUNK_WRITE_OFFSET_DEF; /* Default value for the offset of direct chunk write */ +static const size_t H5D_def_direct_chunk_datasize_g = H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_DEF; /* Default value for the datasize of direct chunk write */ /*------------------------------------------------------------------------- @@ -424,6 +436,30 @@ H5P__dxfr_reg_prop(H5P_genclass_t *pclass) H5D_XFER_XFORM_DEL, H5D_XFER_XFORM_COPY, H5D_XFER_XFORM_CMP, H5D_XFER_XFORM_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + /* Register the property of flag for direct chunk write */ + /* (Note: this property should not have an encode/decode callback -QAK) */ + if(H5P_register_real(pclass, H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_NAME, H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_SIZE, &H5D_def_direct_chunk_flag_g, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register the property of filter for direct chunk write */ + /* (Note: this property should not have an encode/decode callback -QAK) */ + if(H5P_register_real(pclass, H5D_XFER_DIRECT_CHUNK_WRITE_FILTERS_NAME, H5D_XFER_DIRECT_CHUNK_WRITE_FILTERS_SIZE, &H5D_def_direct_chunk_filters_g, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register the property of offset for direct chunk write */ + /* (Note: this property should not have an encode/decode callback -QAK) */ + if(H5P_register_real(pclass, H5D_XFER_DIRECT_CHUNK_WRITE_OFFSET_NAME, H5D_XFER_DIRECT_CHUNK_WRITE_OFFSET_SIZE, &H5D_def_direct_chunk_offset_g, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register the property of datasize for direct chunk write */ + /* (Note: this property should not have an encode/decode callback -QAK) */ + if(H5P_register_real(pclass, H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_NAME, H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_SIZE, &H5D_def_direct_chunk_datasize_g, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__dxfr_reg_prop() */ diff --git a/src/H5T.c b/src/H5T.c index 9006b49..e2e04a8 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -4389,7 +4389,7 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name, H5T_g.apaths = 128; if(NULL == (H5T_g.path[0] = H5FL_CALLOC(H5T_path_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for no-op conversion path") - HDstrcpy(H5T_g.path[0]->name, "no-op"); + HDsnprintf(H5T_g.path[0]->name, sizeof(H5T_g.path[0]->name), "no-op"); H5T_g.path[0]->func = H5T__conv_noop; H5T_g.path[0]->cdata.command = H5T_CONV_INIT; if(H5T__conv_noop(FAIL, FAIL, &(H5T_g.path[0]->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL, dxpl_id) < 0) { @@ -4457,7 +4457,7 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name, path->name[H5T_NAMELEN - 1] = '\0'; } /* end if */ else - HDstrcpy(path->name, "NONAME"); + HDsnprintf(path->name, sizeof(path->name), "NONAME"); if(NULL == (path->src = H5T_copy(src, H5T_COPY_ALL))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy datatype for conversion path") if(NULL == (path->dst = H5T_copy(dst, H5T_COPY_ALL))) diff --git a/src/H5config.h.in b/src/H5config.h.in index fdbcd49..0308b38 100644 --- a/src/H5config.h.in +++ b/src/H5config.h.in @@ -74,6 +74,9 @@ /* Define if the function stack tracing code is to be compiled in */ #undef HAVE_CODESTACK +/* Define if Darwin or Mac OS X */ +#undef HAVE_DARWIN + /* Define to 1 if you have the declaration of `tzname', and to 0 if you don't. */ #undef HAVE_DECL_TZNAME diff --git a/src/H5private.h b/src/H5private.h index b8b1754..711cea8 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -430,6 +430,24 @@ #define HSSIZET_MIN (~(HSSIZET_MAX)) /* + * Types and max sizes for POSIX I/O. + * OS X (Darwin) is odd since the max I/O size does not match the types. + */ +#if defined(H5_HAVE_WIN32_API) +# define h5_posix_io_t unsigned int +# define h5_posix_io_ret_t int +# define H5_POSIX_MAX_IO_BYTES INT_MAX +#elif defined(H5_HAVE_DARWIN) +# define h5_posix_io_t size_t +# define h5_posix_io_ret_t ssize_t +# define H5_POSIX_MAX_IO_BYTES INT_MAX +#else +# define h5_posix_io_t size_t +# define h5_posix_io_ret_t ssize_t +# define H5_POSIX_MAX_IO_BYTES SSIZET_MAX +#endif + +/* * A macro to portably increment enumerated types. */ #ifndef H5_INC_ENUM @@ -1455,19 +1473,20 @@ extern char *strdup(const char *s); #if defined(H5_HAVE_WINDOW_PATH) /* directory delimiter for Windows: slash and backslash are acceptable on Windows */ -#define DIR_SLASH_SEPC '/' -#define DIR_SEPC '\\' -#define DIR_SEPS "\\" -#define CHECK_DELIMITER(SS) ((SS == DIR_SEPC)||(SS == DIR_SLASH_SEPC)) -#define CHECK_ABSOLUTE(NAME) ((isalpha(NAME[0])) && (NAME[1] == ':') && (CHECK_DELIMITER(NAME[2]))) -#define CHECK_ABS_DRIVE(NAME) ((isalpha(NAME[0])) && (NAME[1] == ':')) -#define CHECK_ABS_PATH(NAME) (CHECK_DELIMITER(NAME[0])) - -#define GET_LAST_DELIMITER(NAME, ptr) { \ +#define H5_DIR_SLASH_SEPC '/' +#define H5_DIR_SEPC '\\' +#define H5_DIR_SEPS "\\" +#define H5_CHECK_DELIMITER(SS) ((SS == H5_DIR_SEPC) || (SS == H5_DIR_SLASH_SEPC)) +#define H5_CHECK_ABSOLUTE(NAME) ((HDisalpha(NAME[0])) && (NAME[1] == ':') && (H5_CHECK_DELIMITER(NAME[2]))) +#define H5_CHECK_ABS_DRIVE(NAME) ((HDisalpha(NAME[0])) && (NAME[1] == ':')) +#define H5_CHECK_ABS_PATH(NAME) (H5_CHECK_DELIMITER(NAME[0])) + +#define H5_GET_LAST_DELIMITER(NAME, ptr) { \ char *slash, *backslash; \ - slash = strrchr(NAME, DIR_SLASH_SEPC); \ - backslash = strrchr(NAME, DIR_SEPC); \ - if (backslash > slash) \ + \ + slash = HDstrrchr(NAME, H5_DIR_SLASH_SEPC); \ + backslash = HDstrrchr(NAME, H5_DIR_SEPC); \ + if(backslash > slash) \ (ptr = backslash); \ else \ (ptr = slash); \ @@ -1477,27 +1496,27 @@ extern char *strdup(const char *s); /* OpenVMS pathname: $:[path] * i.g. SYS$SYSUSERS:[LU.HDF5.SRC]H5system.c */ -#define DIR_SEPC ']' -#define DIR_SEPS "]" -#define CHECK_DELIMITER(SS) (SS == DIR_SEPC) -#define CHECK_ABSOLUTE(NAME) (strrchr(NAME, ':') && strrchr(NAME, '[')) -#define CHECK_ABS_DRIVE(NAME) (0) -#define CHECK_ABS_PATH(NAME) (0) -#define GET_LAST_DELIMITER(NAME, ptr) ptr = strrchr(NAME, DIR_SEPC); +#define H5_DIR_SEPC ']' +#define H5_DIR_SEPS "]" +#define H5_CHECK_DELIMITER(SS) (SS == H5_DIR_SEPC) +#define H5_CHECK_ABSOLUTE(NAME) (HDstrrchr(NAME, ':') && HDstrrchr(NAME, '[')) +#define H5_CHECK_ABS_DRIVE(NAME) (0) +#define H5_CHECK_ABS_PATH(NAME) (0) +#define H5_GET_LAST_DELIMITER(NAME, ptr) ptr = HDstrrchr(NAME, H5_DIR_SEPC); #else -#define DIR_SEPC '/' -#define DIR_SEPS "/" -#define CHECK_DELIMITER(SS) (SS == DIR_SEPC) -#define CHECK_ABSOLUTE(NAME) (CHECK_DELIMITER(*NAME)) -#define CHECK_ABS_DRIVE(NAME) (0) -#define CHECK_ABS_PATH(NAME) (0) -#define GET_LAST_DELIMITER(NAME, ptr) ptr = strrchr(NAME, DIR_SEPC); +#define H5_DIR_SEPC '/' +#define H5_DIR_SEPS "/" +#define H5_CHECK_DELIMITER(SS) (SS == H5_DIR_SEPC) +#define H5_CHECK_ABSOLUTE(NAME) (H5_CHECK_DELIMITER(*NAME)) +#define H5_CHECK_ABS_DRIVE(NAME) (0) +#define H5_CHECK_ABS_PATH(NAME) (0) +#define H5_GET_LAST_DELIMITER(NAME, ptr) ptr = HDstrrchr(NAME, H5_DIR_SEPC); #endif -#define COLON_SEPC ':' +#define H5_COLON_SEPC ':' /* Use FUNC to safely handle variations of C99 __func__ keyword handling */ diff --git a/src/H5public.h b/src/H5public.h index 54cd0b6..0a4e9c0 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -75,10 +75,10 @@ extern "C" { /* Version numbers */ #define H5_VERS_MAJOR 1 /* For major interface/format changes */ #define H5_VERS_MINOR 9 /* For minor interface/format changes */ -#define H5_VERS_RELEASE 137 /* For tweaks, bug-fixes, or development */ +#define H5_VERS_RELEASE 148 /* For tweaks, bug-fixes, or development */ #define H5_VERS_SUBRELEASE "FA_a5" /* For pre-releases like snap0 */ /* Empty string for real releases. */ -#define H5_VERS_INFO "HDF5 library version: 1.9.137-FA_a5" /* Full version string */ +#define H5_VERS_INFO "HDF5 library version: 1.9.148-FA_a5" /* Full version string */ #define H5check() H5check_version(H5_VERS_MAJOR,H5_VERS_MINOR, \ H5_VERS_RELEASE) diff --git a/src/H5system.c b/src/H5system.c index c0baee1..3ffe411 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -122,24 +122,24 @@ HDfprintf(FILE *stream, const char *fmt, ...) va_start (ap, fmt); while (*fmt) { - fwidth = prec = 0; - zerofill = 0; - leftjust = 0; - plussign = 0; - prefix = 0; - ldspace = 0; - modifier[0] = '\0'; - - if ('%'==fmt[0] && '%'==fmt[1]) { - HDputc ('%', stream); - fmt += 2; - nout++; - } else if ('%'==fmt[0]) { - s = fmt + 1; - - /* Flags */ - while(HDstrchr ("-+ #", *s)) { - switch(*s) { + fwidth = prec = 0; + zerofill = 0; + leftjust = 0; + plussign = 0; + prefix = 0; + ldspace = 0; + modifier[0] = '\0'; + + if ('%'==fmt[0] && '%'==fmt[1]) { + HDputc ('%', stream); + fmt += 2; + nout++; + } else if ('%'==fmt[0]) { + s = fmt + 1; + + /* Flags */ + while(HDstrchr ("-+ #", *s)) { + switch(*s) { case '-': leftjust = 1; break; @@ -155,244 +155,251 @@ HDfprintf(FILE *stream, const char *fmt, ...) case '#': prefix = 1; break; - } /* end switch */ /*lint !e744 Switch statement doesn't _need_ default */ - s++; - } /* end while */ - - /* Field width */ - if (HDisdigit (*s)) { - zerofill = ('0'==*s); - fwidth = (int)HDstrtol (s, &rest, 10); - s = rest; - } else if ('*'==*s) { - fwidth = va_arg (ap, int); - if (fwidth<0) { - leftjust = 1; - fwidth = -fwidth; - } - s++; - } + } /* end switch */ /*lint !e744 Switch statement doesn't _need_ default */ + s++; + } /* end while */ + + /* Field width */ + if(HDisdigit(*s)) { + zerofill = ('0' == *s); + fwidth = (int)HDstrtol (s, &rest, 10); + s = rest; + } /* end if */ + else if ('*'==*s) { + fwidth = va_arg (ap, int); + if(fwidth < 0) { + leftjust = 1; + fwidth = -fwidth; + } + s++; + } + + /* Precision */ + if('.'==*s) { + s++; + if(HDisdigit(*s)) { + prec = (int)HDstrtol(s, &rest, 10); + s = rest; + } else if('*'==*s) { + prec = va_arg(ap, int); + s++; + } + if(prec < 1) + prec = 1; + } + + /* Extra type modifiers */ + if(HDstrchr("ZHhlqLI", *s)) { + switch(*s) { + /*lint --e{506} Don't issue warnings about constant value booleans */ + /*lint --e{774} Don't issue warnings boolean within 'if' always evaluates false/true */ + case 'H': + if(sizeof(hsize_t) < sizeof(long)) + modifier[0] = '\0'; + else if(sizeof(hsize_t) == sizeof(long)) + HDstrncpy(modifier, "l", 2); + else + HDstrncpy(modifier, H5_PRINTF_LL_WIDTH, HDstrlen(H5_PRINTF_LL_WIDTH) + 1); + break; - /* Precision */ - if ('.'==*s) { - s++; - if (HDisdigit (*s)) { - prec = (int)HDstrtol (s, &rest, 10); - s = rest; - } else if ('*'==*s) { - prec = va_arg (ap, int); - s++; - } - if (prec<1) prec = 1; - } + case 'Z': + if(sizeof(size_t) < sizeof(long)) + modifier[0] = '\0'; + else if(sizeof(size_t) == sizeof(long)) + HDstrncpy(modifier, "l", 2); + else + HDstrncpy(modifier, H5_PRINTF_LL_WIDTH, HDstrlen(H5_PRINTF_LL_WIDTH) + 1); + break; - /* Extra type modifiers */ - if (HDstrchr ("ZHhlqLI", *s)) { - switch (*s) { - /*lint --e{506} Don't issue warnings about constant value booleans */ - /*lint --e{774} Don't issue warnings boolean within 'if' always evaluates false/true */ - case 'H': - if (sizeof(hsize_t)0) - sprintf (format_templ+HDstrlen(format_templ), "%d", fwidth); - if (prec>0) - sprintf (format_templ+HDstrlen(format_templ), ".%d", prec); - if (*modifier) - sprintf (format_templ+HDstrlen(format_templ), "%s", modifier); - sprintf (format_templ+HDstrlen(format_templ), "%c", conv); - - - /* Conversion */ - switch (conv) { - case 'd': - case 'i': - if (!HDstrcmp(modifier, "h")) { - short x = (short)va_arg (ap, int); - n = fprintf (stream, format_templ, x); - } else if (!*modifier) { - int x = va_arg (ap, int); - n = fprintf (stream, format_templ, x); - } else if (!HDstrcmp (modifier, "l")) { - long x = va_arg (ap, long); - n = fprintf (stream, format_templ, x); - } else { - int64_t x = va_arg(ap, int64_t); - n = fprintf (stream, format_templ, x); - } - break; - - case 'o': - case 'u': - case 'x': - case 'X': - if (!HDstrcmp (modifier, "h")) { - unsigned short x = (unsigned short)va_arg (ap, unsigned int); - n = fprintf (stream, format_templ, x); - } else if (!*modifier) { - unsigned int x = va_arg (ap, unsigned int); /*lint !e732 Loss of sign not really occuring */ - n = fprintf (stream, format_templ, x); - } else if (!HDstrcmp (modifier, "l")) { - unsigned long x = va_arg (ap, unsigned long); /*lint !e732 Loss of sign not really occuring */ - n = fprintf (stream, format_templ, x); - } else { - uint64_t x = va_arg(ap, uint64_t); /*lint !e732 Loss of sign not really occuring */ - n = fprintf (stream, format_templ, x); - } - break; - - case 'f': - case 'e': - case 'E': - case 'g': - case 'G': - if (!HDstrcmp (modifier, "h")) { - float x = (float) va_arg (ap, double); - n = fprintf (stream, format_templ, x); - } else if (!*modifier || !HDstrcmp (modifier, "l")) { - double x = va_arg (ap, double); - n = fprintf (stream, format_templ, x); - } else { - /* - * Some compilers complain when `long double' and - * `double' are the same thing. - */ + break; + } + s++; + } + + /* Conversion */ + conv = *s++; + + /* Create the format template */ + sprintf(format_templ, "%%%s%s%s%s%s", (leftjust ? "-" : ""), + (plussign ? "+" : ""), (ldspace ? " " : ""), + (prefix ? "#" : ""), (zerofill ? "0" : "")); + if(fwidth > 0) + sprintf(format_templ+HDstrlen(format_templ), "%d", fwidth); + if(prec > 0) + sprintf(format_templ+HDstrlen(format_templ), ".%d", prec); + if(*modifier) + sprintf(format_templ+HDstrlen(format_templ), "%s", modifier); + sprintf (format_templ+HDstrlen(format_templ), "%c", conv); + + + /* Conversion */ + switch (conv) { + case 'd': + case 'i': + if(!HDstrcmp(modifier, "h")) { + short x = (short)va_arg (ap, int); + n = fprintf (stream, format_templ, x); + } else if(!*modifier) { + int x = va_arg (ap, int); + n = fprintf (stream, format_templ, x); + } else if(!HDstrcmp (modifier, "l")) { + long x = va_arg (ap, long); + n = fprintf (stream, format_templ, x); + } else { + int64_t x = va_arg(ap, int64_t); + n = fprintf (stream, format_templ, x); + } + break; + + case 'o': + case 'u': + case 'x': + case 'X': + if(!HDstrcmp(modifier, "h")) { + unsigned short x = (unsigned short)va_arg (ap, unsigned int); + n = fprintf(stream, format_templ, x); + } else if(!*modifier) { + unsigned int x = va_arg (ap, unsigned int); /*lint !e732 Loss of sign not really occuring */ + n = fprintf(stream, format_templ, x); + } else if(!HDstrcmp(modifier, "l")) { + unsigned long x = va_arg (ap, unsigned long); /*lint !e732 Loss of sign not really occuring */ + n = fprintf(stream, format_templ, x); + } else { + uint64_t x = va_arg(ap, uint64_t); /*lint !e732 Loss of sign not really occuring */ + n = fprintf(stream, format_templ, x); + } + break; + + case 'f': + case 'e': + case 'E': + case 'g': + case 'G': + if(!HDstrcmp(modifier, "h")) { + float x = (float)va_arg(ap, double); + n = fprintf(stream, format_templ, x); + } else if(!*modifier || !HDstrcmp(modifier, "l")) { + double x = va_arg(ap, double); + n = fprintf(stream, format_templ, x); + } else { + /* + * Some compilers complain when `long double' and + * `double' are the same thing. + */ #if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE - long double x = va_arg (ap, long double); - n = fprintf (stream, format_templ, x); + long double x = va_arg(ap, long double); + n = fprintf(stream, format_templ, x); #else - double x = va_arg (ap, double); - n = fprintf (stream, format_templ, x); + double x = va_arg(ap, double); + n = fprintf(stream, format_templ, x); #endif - } - break; - - case 'a': - { - haddr_t x = va_arg (ap, haddr_t); /*lint !e732 Loss of sign not really occuring */ - if (H5F_addr_defined(x)) { - sprintf(format_templ, "%%%s%s%s%s%s", - leftjust?"-":"", plussign?"+":"", - ldspace?" ":"", prefix?"#":"", - zerofill?"0":""); - if (fwidth>0) - sprintf(format_templ+HDstrlen(format_templ), "%d", fwidth); - - /*lint --e{506} Don't issue warnings about constant value booleans */ - /*lint --e{774} Don't issue warnings boolean within 'if' always evaluates false/true */ - if (sizeof(x)==H5_SIZEOF_INT) { - HDstrcat(format_templ, "u"); - } else if (sizeof(x)==H5_SIZEOF_LONG) { - HDstrcat(format_templ, "lu"); - } else if (sizeof(x)==H5_SIZEOF_LONG_LONG) { - HDstrcat(format_templ, H5_PRINTF_LL_WIDTH); - HDstrcat(format_templ, "u"); - } - n = fprintf(stream, format_templ, x); + } + break; + + case 'a': + { + haddr_t x = va_arg (ap, haddr_t); /*lint !e732 Loss of sign not really occuring */ + + if(H5F_addr_defined(x)) { + sprintf(format_templ, "%%%s%s%s%s%s", + (leftjust ? "-" : ""), (plussign ? "+" : ""), + (ldspace ? " " : ""), (prefix ? "#" : ""), + (zerofill ? "0" : "")); + if(fwidth > 0) + sprintf(format_templ + HDstrlen(format_templ), "%d", fwidth); + + /*lint --e{506} Don't issue warnings about constant value booleans */ + /*lint --e{774} Don't issue warnings boolean within 'if' always evaluates false/true */ + if(sizeof(x) == H5_SIZEOF_INT) + HDstrcat(format_templ, "u"); + else if(sizeof(x) == H5_SIZEOF_LONG) + HDstrcat(format_templ, "lu"); + else if(sizeof(x) == H5_SIZEOF_LONG_LONG) { + HDstrcat(format_templ, H5_PRINTF_LL_WIDTH); + HDstrcat(format_templ, "u"); + } + n = fprintf(stream, format_templ, x); + } else { + HDstrcpy(format_templ, "%"); + if(leftjust) + HDstrcat(format_templ, "-"); + if(fwidth) + sprintf(format_templ+HDstrlen(format_templ), "%d", fwidth); + HDstrcat(format_templ, "s"); + fprintf(stream, format_templ, "UNDEF"); + } + } + break; + + case 'c': + { + char x = (char)va_arg(ap, int); + n = fprintf(stream, format_templ, x); + } + break; + + case 's': + case 'p': + { + char *x = va_arg(ap, char*); /*lint !e64 Type mismatch not really occuring */ + n = fprintf(stream, format_templ, x); + } + break; + + case 'n': + format_templ[HDstrlen(format_templ) - 1] = 'u'; + n = fprintf(stream, format_templ, nout); + break; + + case 't': + { + htri_t tri_var = va_arg(ap, htri_t); + + if(tri_var > 0) + fprintf (stream, "TRUE"); + else if(!tri_var) + fprintf(stream, "FALSE"); + else + fprintf(stream, "FAIL(%d)", (int)tri_var); + } + break; + + default: + HDfputs(format_templ, stream); + n = (int)HDstrlen(format_templ); + break; + } + nout += n; + fmt = s; } else { - HDstrcpy(format_templ, "%"); - if (leftjust) - HDstrcat(format_templ, "-"); - if (fwidth) - sprintf(format_templ+HDstrlen(format_templ), "%d", fwidth); - HDstrcat(format_templ, "s"); - fprintf(stream, format_templ, "UNDEF"); + HDputc(*fmt, stream); + fmt++; + nout++; } } - break; - - case 'c': - { - char x = (char)va_arg (ap, int); - n = fprintf (stream, format_templ, x); - } - break; - - case 's': - case 'p': - { - char *x = va_arg (ap, char*); /*lint !e64 Type mismatch not really occuring */ - n = fprintf (stream, format_templ, x); - } - break; - - case 'n': - format_templ[HDstrlen(format_templ)-1] = 'u'; - n = fprintf (stream, format_templ, nout); - break; - - case 't': - { - htri_t tri_var = va_arg (ap, htri_t); - if (tri_var > 0) fprintf (stream, "TRUE"); - else if (!tri_var) fprintf (stream, "FALSE"); - else fprintf (stream, "FAIL(%d)", (int)tri_var); - } - break; - - default: - HDfputs (format_templ, stream); - n = (int)HDstrlen (format_templ); - break; - } - nout += n; - fmt = s; - } else { - HDputc (*fmt, stream); - fmt++; - nout++; - } - } - va_end (ap); + va_end(ap); return nout; } /* end HDfprintf() */ @@ -700,7 +707,7 @@ H5_build_extpath(const char *name, char **extpath/*out*/) * OpenVMS: $:[path] * i.g. SYS$SYSUSERS:[LU.HDF5.SRC]H5system.c */ - if(CHECK_ABSOLUTE(name)) { + if(H5_CHECK_ABSOLUTE(name)) { if(NULL == (full_path = (char *)H5MM_strdup(name))) HGOTO_ERROR(H5E_INTERNAL, H5E_NOSPACE, FAIL, "memory allocation failed") } /* end if */ @@ -713,24 +720,24 @@ H5_build_extpath(const char *name, char **extpath/*out*/) if(NULL == (new_name = (char *)H5MM_strdup(name))) HGOTO_ERROR(H5E_INTERNAL, H5E_NOSPACE, FAIL, "memory allocation failed") - /* - * Windows: name[0-1] is ":" - * Get current working directory on the drive specified in NAME - * Unix: does not apply + /* + * Windows: name[0-1] is ":" + * Get current working directory on the drive specified in NAME + * Unix: does not apply * OpenVMS: does not apply - */ - if(CHECK_ABS_DRIVE(name)) { + */ + if(H5_CHECK_ABS_DRIVE(name)) { drive = name[0] - 'A' + 1; retcwd = HDgetdcwd(drive, cwdpath, MAX_PATH_LEN); HDstrcpy(new_name, &name[2]); } /* end if */ - /* - * Windows: name[0] is a '/' or '\' - * Get current drive - * Unix: does not apply - * OpenVMS: does not apply - */ - else if(CHECK_ABS_PATH(name) && (0 != (drive = HDgetdrive()))) { + /* + * Windows: name[0] is a '/' or '\' + * Get current drive + * Unix: does not apply + * OpenVMS: does not apply + */ + else if(H5_CHECK_ABS_PATH(name) && (0 != (drive = HDgetdrive()))) { sprintf(cwdpath, "%c:%c", (drive+'A'-1), name[0]); retcwd = cwdpath; HDstrcpy(new_name, &name[1]); @@ -749,7 +756,7 @@ H5_build_extpath(const char *name, char **extpath/*out*/) if(NULL == (full_path = (char *)H5MM_malloc(path_len))) HGOTO_ERROR(H5E_INTERNAL, H5E_NOSPACE, FAIL, "memory allocation failed") - HDstrcpy(full_path, cwdpath); + HDstrncpy(full_path, cwdpath, cwdlen + 1); #ifdef H5_VMS /* If the file name contains relative path, cut off the beginning bracket. Also cut off the * ending bracket of CWDPATH to combine the full path name. i.g. @@ -759,15 +766,16 @@ H5_build_extpath(const char *name, char **extpath/*out*/) */ if(new_name[0] == '[') { char *tmp = new_name; + full_path[cwdlen - 1] = '\0'; HDstrcat(full_path, ++tmp); } /* end if */ else - HDstrcat(full_path, new_name); + HDstrncat(full_path, new_name, HDstrlen(new_name)); #else - if(!CHECK_DELIMITER(cwdpath[cwdlen - 1])) - HDstrcat(full_path, DIR_SEPS); - HDstrcat(full_path, new_name); + if(!H5_CHECK_DELIMITER(cwdpath[cwdlen - 1])) + HDstrncat(full_path, H5_DIR_SEPS, HDstrlen(H5_DIR_SEPS)); + HDstrncat(full_path, new_name, HDstrlen(new_name)); #endif } /* end if */ } /* end else */ @@ -776,7 +784,7 @@ H5_build_extpath(const char *name, char **extpath/*out*/) if(full_path) { char *ptr = NULL; - GET_LAST_DELIMITER(full_path, ptr) + H5_GET_LAST_DELIMITER(full_path, ptr) HDassert(ptr); *++ptr = '\0'; *extpath = full_path; diff --git a/src/Makefile.in b/src/Makefile.in index 1393026..db1d143 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -327,6 +327,7 @@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ +HAVE_PTHREAD = @HAVE_PTHREAD@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF_CXX = @HDF_CXX@ @@ -378,7 +379,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PARALLEL = @PARALLEL@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ -PTHREAD = @PTHREAD@ RANLIB = @RANLIB@ ROOT = @ROOT@ RUNPARALLEL = @RUNPARALLEL@ @@ -525,7 +525,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 127 +LT_VERS_REVISION = 138 LT_VERS_AGE = 0 H5detect_CFLAGS = -g $(AM_CFLAGS) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 5551fa3..6af1e94 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.6) +cmake_minimum_required (VERSION 2.8.10) PROJECT (HDF5_TEST) #----------------------------------------------------------------------------- @@ -148,8 +148,8 @@ SET (HDF5_REFERENCE_TEST_FILES tarrold.h5 tbad_msg_count.h5 tbogus.h5 - test_filters_be.hdf5 - test_filters_le.hdf5 + test_filters_be.h5 + test_filters_le.h5 th5s.h5 tlayouto.h5 tmtimen.h5 @@ -223,8 +223,24 @@ ADD_TEST ( tsohm_dst.h5 tsohm_src.h5 ) -ADD_TEST (NAME testhdf5 COMMAND $) -SET_TESTS_PROPERTIES(testhdf5 PROPERTIES DEPENDS h5test-clear-testhdf5-objects) + +IF (HDF5_ENABLE_USING_MEMCHECKER) + ADD_TEST (NAME testhdf5-base COMMAND $ -x heap -x file -x select) + SET_TESTS_PROPERTIES(testhdf5-base PROPERTIES DEPENDS h5test-clear-testhdf5-objects) + SET_TESTS_PROPERTIES(testhdf5-base PROPERTIES ENVIRONMENT HDF5_ALARM_SECONDS=3600) + ADD_TEST (NAME testhdf5-heap COMMAND $ -o heap) + SET_TESTS_PROPERTIES(testhdf5-heap PROPERTIES DEPENDS h5test-clear-testhdf5-objects) + SET_TESTS_PROPERTIES(testhdf5-heap PROPERTIES ENVIRONMENT HDF5_ALARM_SECONDS=3600) + ADD_TEST (NAME testhdf5-file COMMAND $ -o file) + SET_TESTS_PROPERTIES(testhdf5-file PROPERTIES DEPENDS h5test-clear-testhdf5-objects) + SET_TESTS_PROPERTIES(testhdf5-file PROPERTIES ENVIRONMENT HDF5_ALARM_SECONDS=3600) + ADD_TEST (NAME testhdf5-select COMMAND $ -o select) + SET_TESTS_PROPERTIES(testhdf5-select PROPERTIES DEPENDS h5test-clear-testhdf5-objects) + SET_TESTS_PROPERTIES(testhdf5-select PROPERTIES ENVIRONMENT HDF5_ALARM_SECONDS=3600) +ELSE (HDF5_ENABLE_USING_MEMCHECKER) + ADD_TEST (NAME testhdf5 COMMAND $) + SET_TESTS_PROPERTIES(testhdf5 PROPERTIES DEPENDS h5test-clear-testhdf5-objects) +ENDIF (HDF5_ENABLE_USING_MEMCHECKER) ############################################################################## ############################################################################## diff --git a/test/Makefile.in b/test/Makefile.in index 13b07ba..346750f 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -647,6 +647,7 @@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ +HAVE_PTHREAD = @HAVE_PTHREAD@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF_CXX = @HDF_CXX@ @@ -698,7 +699,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PARALLEL = @PARALLEL@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ -PTHREAD = @PTHREAD@ RANLIB = @RANLIB@ ROOT = @ROOT@ RUNPARALLEL = @RUNPARALLEL@ diff --git a/test/accum.c b/test/accum.c index e4c1bd8..488b866 100644 --- a/test/accum.c +++ b/test/accum.c @@ -470,8 +470,11 @@ test_free(void) if(HDmemcmp(expect + 76, rbuf, 116 * sizeof(int32_t)) != 0) TEST_ERROR; HDfree(wbuf); + wbuf = NULL; HDfree(rbuf); + rbuf = NULL; HDfree(expect); + expect = NULL; if(accum_reset() < 0) FAIL_STACK_ERROR; @@ -480,9 +483,12 @@ test_free(void) return 0; error: - HDfree(wbuf); - HDfree(rbuf); - HDfree(expect); + if(wbuf) + HDfree(wbuf); + if(rbuf) + HDfree(rbuf); + if(expect) + HDfree(expect); return 1; } /* test_free */ @@ -1646,7 +1652,7 @@ unsigned test_random_write(void) { uint8_t *wbuf, *rbuf; /* Buffers for reading & writing */ - unsigned long seed = 0; /* Random # seed */ + unsigned seed = 0; /* Random # seed */ size_t *off; /* Offset of buffer segments to write */ size_t *len; /* Size of buffer segments to write */ size_t cur_off; /* Current offset */ @@ -1667,10 +1673,10 @@ test_random_write(void) TESTING("random writes to accumulator"); /* Choose random # seed */ - seed = (unsigned long)HDtime(NULL); + seed = (unsigned)HDtime(NULL); #ifdef QAK -/* seed = (unsigned long)1155438845; */ -HDfprintf(stderr, "Random # seed was: %lu\n", seed); +/* seed = (unsigned)1155438845; */ +HDfprintf(stderr, "Random # seed was: %u\n", seed); #endif /* QAK */ HDsrandom(seed); @@ -1762,7 +1768,7 @@ error: HDfree(off); HDfree(len); - HDfprintf(stderr, "Random # seed was: %lu\n", seed); + HDfprintf(stderr, "Random # seed was: %u\n", seed); return 1; } /* end test_random_write() */ diff --git a/test/dsets.c b/test/dsets.c index 70d610b..369673b 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -6657,7 +6657,7 @@ test_filters_endianess(void) hid_t dsid=-1; /* dataset ID */ hid_t sid=-1; /* dataspace ID */ hid_t dcpl=-1; /* dataset creation property list ID */ - const char *data_file = H5_get_srcdir_filename("test_filters_le.hdf5"); /* Corrected test file name */ + const char *data_file = H5_get_srcdir_filename("test_filters_le.h5"); /* Corrected test file name */ TESTING("filters with big-endian/little-endian data"); @@ -6682,7 +6682,7 @@ test_filters_endianess(void) */ /* compose the name of the file to open, using the srcdir, if appropriate */ - data_file = H5_get_srcdir_filename("test_filters_be.hdf5"); /* Corrected test file name */ + data_file = H5_get_srcdir_filename("test_filters_be.h5"); /* Corrected test file name */ /* open */ if((fid = H5Fopen(data_file, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR @@ -10003,6 +10003,1028 @@ error: /*------------------------------------------------------------------------- + * Function: test_scatter + * + * Purpose: Tests H5Dscatter with a variety of different selections + * and source buffer sizes. + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Neil Fortner + * Wednesday, January 16, 2013 + * + *------------------------------------------------------------------------- + */ +typedef struct scatter_info_t { + int *src_buf; /* Source data buffer */ + size_t block; /* Maximum number of elements to return to H5Dscatter() */ + size_t size; /* Remaining number of elements to return */ +} scatter_info_t; + +#define TEST_SCATTER_CHECK_ARR(ARR, EXP) \ + for(i=0; i<(int)(sizeof(ARR)/sizeof(ARR[0])); i++) \ + for(j=0; j<(int)(sizeof(ARR[0])/sizeof(ARR[0][0])); j++) \ + for(k=0; k<(int)(sizeof(ARR[0][0])/sizeof(ARR[0][0][0])); k++) \ + if(ARR[i][j][k] != EXP[i][j][k]) { \ + H5_FAILED(); AT(); \ + printf(" " #ARR "[%d][%d][%d] == %d, " #EXP "[%d][%d][%d] == %d\n", i, j, k, ARR[i][j][k], i, j, k, EXP[i][j][k]); \ + goto error; \ + } + +static herr_t +scatter_cb(void **src_buf/*out*/, size_t *src_buf_bytes_used/*out*/, + void *_scatter_info) +{ + scatter_info_t *scatter_info = (scatter_info_t *)_scatter_info; + size_t nelmts; /* Number of elements to return in src_buf */ + + /* Calculate number of elements */ + nelmts = MIN(scatter_info->block, scatter_info->size); + HDassert(nelmts > 0); + + /* Set output variables */ + *src_buf = (void *)scatter_info->src_buf; + *src_buf_bytes_used = nelmts * sizeof(scatter_info->src_buf[0]); + + /* Update scatter_info */ + scatter_info->src_buf += nelmts; + scatter_info->size -= nelmts; + + return SUCCEED; +} + +static herr_t +test_scatter(void) +{ + hid_t sid = -1; /* Dataspace ID */ + hsize_t dim[3] = {8, 5, 8}; /* Dataspace dimensions */ + hsize_t start[3] = {0, 0, 0}; + hsize_t stride[3] = {0, 0, 0}; + hsize_t count[3] = {0, 0, 0}; + hsize_t block[3] = {0, 0, 0}; + hsize_t start2[3] = {0, 0, 0}; + hsize_t count2[3] = {0, 0, 0}; + hsize_t point[4][3] = {{2, 3, 2}, {3, 0, 2}, {7, 2, 0}, {0, 1, 5}}; + size_t src_buf_size; + int src_buf[36]; /* Source data buffer */ + int dst_buf[8][5][8]; /* Destination data buffer */ + int expect_dst_buf[8][5][8]; /* Expected destination data buffer */ + scatter_info_t scatter_info; /* Operator data for callback */ + int i, j, k, src_i; /* Local index variables */ + + TESTING("H5Dscatter()"); + + /* Create dataspace */ + if((sid = H5Screate_simple(3, dim, NULL)) < 0) TEST_ERROR + + /* Initialize src_buf */ + for(i=0; i<(int)(sizeof(src_buf)/sizeof(src_buf[0])); i++) + src_buf[i] = i + 1; + + + /* + * Test 1: Simple case + */ + /* Select hyperslab */ + count[0] = 1; + count[1] = 1; + count[2] = 8; + if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, NULL ,count, NULL) < 0) + TEST_ERROR + + /* Initialize dst_buf and expect_dst_buf */ + (void)HDmemset(expect_dst_buf, 0, sizeof(expect_dst_buf)); + for(i=0; i<8; i++) + expect_dst_buf[0][0][i] = src_buf[i]; + + /* Loop over buffer sizes */ + for(src_buf_size=1; src_buf_size<=9; src_buf_size++) { + /* Reset dst_buf */ + (void)HDmemset(dst_buf, 0, sizeof(dst_buf)); + + /* Set up scatter info */ + scatter_info.src_buf = src_buf; + scatter_info.block = src_buf_size; + scatter_info.size = 8; + + /* Scatter data */ + if(H5Dscatter(scatter_cb, &scatter_info, H5T_NATIVE_INT, sid, dst_buf) < 0) + TEST_ERROR + + /* Verify data */ + TEST_SCATTER_CHECK_ARR(dst_buf, expect_dst_buf) + } /* end for */ + + + /* + * Test 2: Single block in dataset + */ + /* Select hyperslab */ + start[0] = 3; + start[1] = 2; + start[2] = 4; + count[0] = 2; + count[1] = 3; + count[2] = 2; + if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, NULL ,count, NULL) < 0) + TEST_ERROR + + /* Initialize expect_dst_buf */ + (void)HDmemset(expect_dst_buf, 0, sizeof(expect_dst_buf)); + src_i = 0; + for(i=3; i<5; i++) + for(j=2; j<5; j++) + for(k=4; k<6; k++) + expect_dst_buf[i][j][k] = src_buf[src_i++]; + + /* Loop over buffer sizes */ + for(src_buf_size=1; src_buf_size<=13; src_buf_size++) { + /* Reset dst_buf */ + (void)HDmemset(dst_buf, 0, sizeof(dst_buf)); + + /* Set up scatter info */ + scatter_info.src_buf = src_buf; + scatter_info.block = src_buf_size; + scatter_info.size = 12; + + /* Scatter data */ + if(H5Dscatter(scatter_cb, &scatter_info, H5T_NATIVE_INT, sid, dst_buf) < 0) + TEST_ERROR + + /* Verify data */ + TEST_SCATTER_CHECK_ARR(dst_buf, expect_dst_buf) + } /* end for */ + + + /* + * Test 3: Multiple blocks + */ + /* Select hyperslab */ + start[0] = 1; + start[1] = 1; + start[2] = 1; + stride[0] = 3; + stride[1] = 4; + stride[2] = 5; + count[0] = 3; + count[1] = 1; + count[2] = 2; + block[0] = 1; + block[1] = 3; + block[2] = 2; + if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, stride ,count, block) < 0) + TEST_ERROR + + /* Initialize expect_dst_buf */ + /* Iterate over block containing selection, checking if each element is in + * selection. Note that the algorithm used here (if statement) would not + * work for overlapping hyperslabs. */ + (void)HDmemset(expect_dst_buf, 0, sizeof(expect_dst_buf)); + src_i = 0; + for(i=1; i<8; i++) + for(j=1; j<4; j++) + for(k=1; k<8; k++) + if((hsize_t)i >= start[0] + && ((hsize_t)i - start[0]) % stride[0] < block[0] + && ((hsize_t)i - start[0]) / stride[0] < count[0] + && (hsize_t)j >= start[1] + && ((hsize_t)j - start[1]) % stride[1] < block[1] + && ((hsize_t)j - start[1]) / stride[1] < count[1] + && (hsize_t)k >= start[2] + && ((hsize_t)k - start[2]) % stride[2] < block[2] + && ((hsize_t)k - start[2]) / stride[2] < count[2]) + expect_dst_buf[i][j][k] = src_buf[src_i++]; + + /* Loop over buffer sizes */ + for(src_buf_size=1; src_buf_size<=37; src_buf_size++) { + /* Reset dst_buf */ + (void)HDmemset(dst_buf, 0, sizeof(dst_buf)); + + /* Set up scatter info */ + scatter_info.src_buf = src_buf; + scatter_info.block = src_buf_size; + scatter_info.size = 36; + + /* Scatter data */ + if(H5Dscatter(scatter_cb, &scatter_info, H5T_NATIVE_INT, sid, dst_buf) < 0) + TEST_ERROR + + /* Verify data */ + TEST_SCATTER_CHECK_ARR(dst_buf, expect_dst_buf) + } /* end for */ + + + /* + * Test 4: Compound selection + */ + /* Select hyperslabs */ + start[0] = 2; + start[1] = 1; + start[2] = 1; + count[0] = 2; + count[1] = 3; + count[2] = 2; + if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, NULL ,count, NULL) < 0) + TEST_ERROR + start2[0] = 1; + start2[1] = 2; + start2[2] = 2; + count2[0] = 3; + count2[1] = 2; + count2[2] = 2; + if(H5Sselect_hyperslab(sid, H5S_SELECT_XOR, start2, NULL ,count2, NULL) < 0) + TEST_ERROR + + /* Initialize expect_dst_buf */ + /* Iterate over block containing selection, checking if each element is in + * selection. */ + (void)HDmemset(expect_dst_buf, 0, sizeof(expect_dst_buf)); + src_i = 0; + for(i=1; i<4; i++) + for(j=1; j<4; j++) + for(k=1; k<4; k++) + if(!(((hsize_t)i >= start[0] && (hsize_t)i < start[0] + count[0]) + && ((hsize_t)j >= start[1] && (hsize_t)j < start[1] + count[1]) + && ((hsize_t)k >= start[2] && (hsize_t)k < start[2] + count[2])) + != !(((hsize_t)i >= start2[0] && (hsize_t)i < start2[0] + count2[0]) + && ((hsize_t)j >= start2[1] && (hsize_t)j < start2[1] + count2[1]) + && ((hsize_t)k >= start2[2] && (hsize_t)k < start2[2] + count2[2]))) + expect_dst_buf[i][j][k] = src_buf[src_i++]; + + /* Loop over buffer sizes */ + for(src_buf_size=1; src_buf_size<=17; src_buf_size++) { + /* Reset dst_buf */ + (void)HDmemset(dst_buf, 0, sizeof(dst_buf)); + + /* Set up scatter info */ + scatter_info.src_buf = src_buf; + scatter_info.block = src_buf_size; + scatter_info.size = 16; + + /* Scatter data */ + if(H5Dscatter(scatter_cb, &scatter_info, H5T_NATIVE_INT, sid, dst_buf) < 0) + TEST_ERROR + + /* Verify data */ + TEST_SCATTER_CHECK_ARR(dst_buf, expect_dst_buf) + } /* end for */ + + + /* + * Test 5: Point selection + */ + /* Select hyperslabs */ + if(H5Sselect_elements(sid, H5S_SELECT_SET, sizeof(point) / sizeof(point[0]), (hsize_t *)point) < 0) + TEST_ERROR + + /* Initialize expect_dst_buf */ + /* Iterate over block containing selection, checking if each element is in + * selection. */ + (void)HDmemset(expect_dst_buf, 0, sizeof(expect_dst_buf)); + for(i=0; i<(int)(sizeof(point) / sizeof(point[0])); i++) + expect_dst_buf[point[i][0]][point[i][1]][point[i][2]] + = src_buf[i]; + + /* Loop over buffer sizes */ + for(src_buf_size=1; src_buf_size<=5; src_buf_size++) { + /* Reset dst_buf */ + (void)HDmemset(dst_buf, 0, sizeof(dst_buf)); + + /* Set up scatter info */ + scatter_info.src_buf = src_buf; + scatter_info.block = src_buf_size; + scatter_info.size = 4; + + /* Scatter data */ + if(H5Dscatter(scatter_cb, &scatter_info, H5T_NATIVE_INT, sid, dst_buf) < 0) + TEST_ERROR + + /* Verify data */ + TEST_SCATTER_CHECK_ARR(dst_buf, expect_dst_buf) + } /* end for */ + + + /* Close everything */ + if(H5Sclose(sid) < 0) TEST_ERROR + + PASSED(); + + return 0; + +error: + H5E_BEGIN_TRY { + H5Sclose(sid); + } H5E_END_TRY; + return -1; +} /* end test_scatter() */ + + +/*------------------------------------------------------------------------- + * Function: test_gather + * + * Purpose: Tests H5Dgather with a variety of different selections and + * destination buffer sizes. + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Neil Fortner + * Wednesday, January 16, 2013 + * + *------------------------------------------------------------------------- + */ +typedef struct gather_info_t { + int *expect_dst_buf; /* Expected destination data buffer */ + size_t max_nelmts; /* Maximum number of elements passed to callback */ + hbool_t last_call; /* Whether this should be the last time the callback is called */ +} gather_info_t; + +static herr_t +gather_cb(const void *dst_buf, size_t dst_buf_bytes_used, + void *_gather_info) +{ + gather_info_t *gather_info = (gather_info_t *)_gather_info; + size_t nelmts; /* Number of elements in src_buf */ + int i; /* Local index variable */ + + HDassert(dst_buf_bytes_used > 0); + + /* Calculate number of elements */ + nelmts = dst_buf_bytes_used / sizeof(gather_info->expect_dst_buf[0]); + + /* Make sure the number of bytes is a multiple of the number of elements */ + if(nelmts * sizeof(gather_info->expect_dst_buf[0]) != dst_buf_bytes_used) + TEST_ERROR + + /* Make sure we weren't passed more data than we requested to be passed at + * once */ + if(nelmts > gather_info->max_nelmts) + TEST_ERROR + + /* If we were passed less data than requested, make sure this is the last + * time the callback was called */ + if(gather_info->last_call) + TEST_ERROR + if(nelmts < gather_info->max_nelmts) + gather_info->last_call = TRUE; + + /* Compare data and expected data */ + for(i=0; i<(int)nelmts; i++) + if(((const int *)dst_buf)[i] != *((gather_info->expect_dst_buf)++)) + TEST_ERROR + + return SUCCEED; + +error: + return FAIL; +} + +static herr_t +test_gather(void) +{ + hid_t sid = -1; /* Dataspace ID */ + hsize_t dim[3] = {8, 5, 8}; /* Dataspace dimensions */ + hsize_t start[3] = {0, 0, 0}; + hsize_t stride[3] = {0, 0, 0}; + hsize_t count[3] = {0, 0, 0}; + hsize_t block[3] = {0, 0, 0}; + hsize_t start2[3] = {0, 0, 0}; + hsize_t count2[3] = {0, 0, 0}; + hsize_t point[4][3] = {{2, 3, 2}, {3, 0, 2}, {7, 2, 0}, {0, 1, 5}}; + size_t dst_buf_size; + int src_buf[8][5][8]; /* Source data buffer */ + int dst_buf[36]; /* Destination data buffer */ + int expect_dst_buf[36]; /* Expected destination data buffer */ + gather_info_t gather_info; /* Operator data for callback */ + int i, j, k, dst_i; /* Local index variables */ + + TESTING("H5Dgather()"); + + /* Create dataspace */ + if((sid = H5Screate_simple(3, dim, NULL)) < 0) TEST_ERROR + + /* Initialize src_buf */ + for(i=0; i<(int)(sizeof(src_buf)/sizeof(src_buf[0])); i++) + for(j=0; j<(int)(sizeof(src_buf[0])/sizeof(src_buf[0][0])); j++) + for(k=0; k<(int)(sizeof(src_buf[0][0])/sizeof(src_buf[0][0][0])); k++) + src_buf[i][j][k] = 1 + k + + (int)(sizeof(src_buf[0][0]) / sizeof(src_buf[0][0][0])) * j + + (int)(sizeof(src_buf[0]) / sizeof(src_buf[0][0][0])) * i; + + + /* + * Test 1: Simple case + */ + /* Select hyperslab */ + count[0] = 1; + count[1] = 1; + count[2] = 8; + if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, NULL ,count, NULL) < 0) + TEST_ERROR + + /* Initialize expect_dst_buf */ + (void)HDmemset(expect_dst_buf, 0, sizeof(expect_dst_buf)); + for(i=0; i<8; i++) + expect_dst_buf[i] = src_buf[0][0][i]; + + /* Loop over buffer sizes */ + for(dst_buf_size=1; dst_buf_size<=9; dst_buf_size++) { + /* Reset dst_buf */ + (void)HDmemset(dst_buf, 0, sizeof(dst_buf)); + + /* Initialize gather_info */ + gather_info.expect_dst_buf = expect_dst_buf; + gather_info.max_nelmts = dst_buf_size; + gather_info.last_call = FALSE; + + /* Gather data */ + if(H5Dgather(sid, src_buf, H5T_NATIVE_INT, dst_buf_size * sizeof(dst_buf[0]), dst_buf, gather_cb, &gather_info) < 0) + TEST_ERROR + + /* Verify that all data has been gathered (and verified) */ + if(gather_info.expect_dst_buf - expect_dst_buf != 8) TEST_ERROR + } /* end for */ + + /* Test without a callback */ + /* Loop over buffer sizes */ + for(dst_buf_size=8; dst_buf_size<=9; dst_buf_size++) { + /* Reset dst_buf */ + (void)HDmemset(dst_buf, 0, sizeof(dst_buf)); + + /* Gather data */ + if(H5Dgather(sid, src_buf, H5T_NATIVE_INT, dst_buf_size * sizeof(dst_buf[0]), dst_buf, NULL, NULL) < 0) + TEST_ERROR + + /* Verify data */ + for(i=0; i<(int)(sizeof(dst_buf)/sizeof(dst_buf[0])); i++) + if(dst_buf[i] != expect_dst_buf[i]) + TEST_ERROR + } /* end for */ + + /* Test with a dst_buf_size that is not a multiple of the datatype size */ + /* Reset dst_buf */ + dst_buf_size = 7; + (void)HDmemset(dst_buf, 0, sizeof(dst_buf)); + + /* Initialize gather_info */ + gather_info.expect_dst_buf = expect_dst_buf; + gather_info.max_nelmts = dst_buf_size - 1; + gather_info.last_call = FALSE; + + /* Gather data */ + if(H5Dgather(sid, src_buf, H5T_NATIVE_INT, dst_buf_size * sizeof(dst_buf[0]) - 1, dst_buf, gather_cb, &gather_info) < 0) + TEST_ERROR + + /* Verify that all data has been gathered (and verified) */ + if(gather_info.expect_dst_buf - expect_dst_buf != 8) TEST_ERROR + + + /* + * Test 2: Single block in dataset + */ + /* Select hyperslab */ + start[0] = 3; + start[1] = 2; + start[2] = 4; + count[0] = 2; + count[1] = 3; + count[2] = 2; + if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, NULL ,count, NULL) < 0) + TEST_ERROR + + /* Initialize expect_dst_buf */ + (void)HDmemset(expect_dst_buf, 0, sizeof(expect_dst_buf)); + dst_i = 0; + for(i=3; i<5; i++) + for(j=2; j<5; j++) + for(k=4; k<6; k++) + expect_dst_buf[dst_i++] = src_buf[i][j][k]; + + /* Loop over buffer sizes */ + for(dst_buf_size=1; dst_buf_size<=13; dst_buf_size++) { + /* Reset dst_buf */ + (void)HDmemset(dst_buf, 0, sizeof(dst_buf)); + + /* Initialize gather_info */ + gather_info.expect_dst_buf = expect_dst_buf; + gather_info.max_nelmts = dst_buf_size; + gather_info.last_call = FALSE; + + /* Gather data */ + if(H5Dgather(sid, src_buf, H5T_NATIVE_INT, dst_buf_size * sizeof(dst_buf[0]), dst_buf, gather_cb, &gather_info) < 0) + TEST_ERROR + + /* Verify that all data has been gathered (and verified) */ + if(gather_info.expect_dst_buf - expect_dst_buf != 12) TEST_ERROR + } /* end for */ + + + /* + * Test 3: Multiple blocks + */ + /* Select hyperslab */ + start[0] = 1; + start[1] = 1; + start[2] = 1; + stride[0] = 3; + stride[1] = 4; + stride[2] = 5; + count[0] = 3; + count[1] = 1; + count[2] = 2; + block[0] = 1; + block[1] = 3; + block[2] = 2; + if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, stride ,count, block) < 0) + TEST_ERROR + + /* Initialize expect_dst_buf */ + /* Iterate over block containing selection, checking if each element is in + * selection. Note that the algorithm used here (if statement) would not + * work for overlapping hyperslabs. */ + (void)HDmemset(expect_dst_buf, 0, sizeof(expect_dst_buf)); + dst_i = 0; + for(i=1; i<8; i++) + for(j=1; j<4; j++) + for(k=1; k<8; k++) + if((hsize_t)i >= start[0] + && ((hsize_t)i - start[0]) % stride[0] < block[0] + && ((hsize_t)i - start[0]) / stride[0] < count[0] + && (hsize_t)j >= start[1] + && ((hsize_t)j - start[1]) % stride[1] < block[1] + && ((hsize_t)j - start[1]) / stride[1] < count[1] + && (hsize_t)k >= start[2] + && ((hsize_t)k - start[2]) % stride[2] < block[2] + && ((hsize_t)k - start[2]) / stride[2] < count[2]) + expect_dst_buf[dst_i++] = src_buf[i][j][k]; + + /* Loop over buffer sizes */ + for(dst_buf_size=1; dst_buf_size<=37; dst_buf_size++) { + /* Reset dst_buf */ + (void)HDmemset(dst_buf, 0, sizeof(dst_buf)); + + /* Initialize gather_info */ + gather_info.expect_dst_buf = expect_dst_buf; + gather_info.max_nelmts = dst_buf_size; + gather_info.last_call = FALSE; + + /* Gather data */ + if(H5Dgather(sid, src_buf, H5T_NATIVE_INT, dst_buf_size * sizeof(dst_buf[0]), dst_buf, gather_cb, &gather_info) < 0) + TEST_ERROR + + /* Verify that all data has been gathered (and verified) */ + if(gather_info.expect_dst_buf - expect_dst_buf != 36) TEST_ERROR + } /* end for */ + + + /* + * Test 4: Compound selection + */ + /* Select hyperslabs */ + start[0] = 2; + start[1] = 1; + start[2] = 1; + count[0] = 2; + count[1] = 3; + count[2] = 2; + if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, NULL ,count, NULL) < 0) + TEST_ERROR + start2[0] = 1; + start2[1] = 2; + start2[2] = 2; + count2[0] = 3; + count2[1] = 2; + count2[2] = 2; + if(H5Sselect_hyperslab(sid, H5S_SELECT_XOR, start2, NULL ,count2, NULL) < 0) + TEST_ERROR + + /* Initialize expect_dst_buf */ + /* Iterate over block containing selection, checking if each element is in + * selection. */ + (void)HDmemset(expect_dst_buf, 0, sizeof(expect_dst_buf)); + dst_i = 0; + for(i=1; i<4; i++) + for(j=1; j<4; j++) + for(k=1; k<4; k++) + if(!(((hsize_t)i >= start[0] && (hsize_t)i < start[0] + count[0]) + && ((hsize_t)j >= start[1] && (hsize_t)j < start[1] + count[1]) + && ((hsize_t)k >= start[2] && (hsize_t)k < start[2] + count[2])) + != !(((hsize_t)i >= start2[0] && (hsize_t)i < start2[0] + count2[0]) + && ((hsize_t)j >= start2[1] && (hsize_t)j < start2[1] + count2[1]) + && ((hsize_t)k >= start2[2] && (hsize_t)k < start2[2] + count2[2]))) + expect_dst_buf[dst_i++] = src_buf[i][j][k]; + + /* Loop over buffer sizes */ + for(dst_buf_size=1; dst_buf_size<=17; dst_buf_size++) { + /* Reset dst_buf */ + (void)HDmemset(dst_buf, 0, sizeof(dst_buf)); + + /* Initialize gather_info */ + gather_info.expect_dst_buf = expect_dst_buf; + gather_info.max_nelmts = dst_buf_size; + gather_info.last_call = FALSE; + + /* Gather data */ + if(H5Dgather(sid, src_buf, H5T_NATIVE_INT, dst_buf_size * sizeof(dst_buf[0]), dst_buf, gather_cb, &gather_info) < 0) + TEST_ERROR + + /* Verify that all data has been gathered (and verified) */ + if(gather_info.expect_dst_buf - expect_dst_buf != 16) TEST_ERROR + } /* end for */ + + + /* + * Test 5: Point selection + */ + /* Select hyperslabs */ + if(H5Sselect_elements(sid, H5S_SELECT_SET, sizeof(point) / sizeof(point[0]), (hsize_t *)point) < 0) + TEST_ERROR + + /* Initialize expect_dst_buf */ + /* Iterate over block containing selection, checking if each element is in + * selection. */ + (void)HDmemset(expect_dst_buf, 0, sizeof(expect_dst_buf)); + for(i=0; i<(int)(sizeof(point) / sizeof(point[0])); i++) + expect_dst_buf[i] = src_buf[point[i][0]][point[i][1]][point[i][2]]; + + /* Loop over buffer sizes */ + for(dst_buf_size=1; dst_buf_size<=5; dst_buf_size++) { + /* Reset dst_buf */ + (void)HDmemset(dst_buf, 0, sizeof(dst_buf)); + + /* Initialize gather_info */ + gather_info.expect_dst_buf = expect_dst_buf; + gather_info.max_nelmts = dst_buf_size; + gather_info.last_call = FALSE; + + /* Gather data */ + if(H5Dgather(sid, src_buf, H5T_NATIVE_INT, dst_buf_size * sizeof(dst_buf[0]), dst_buf, gather_cb, &gather_info) < 0) + TEST_ERROR + + /* Verify that all data has been gathered (and verified) */ + if(gather_info.expect_dst_buf - expect_dst_buf != 4) TEST_ERROR + } /* end for */ + + + /* Close everything */ + if(H5Sclose(sid) < 0) TEST_ERROR + + PASSED(); + + return 0; + +error: + H5E_BEGIN_TRY { + H5Sclose(sid); + } H5E_END_TRY; + return -1; +} /* end test_gather() */ + + +/*------------------------------------------------------------------------- + * Function: test_scatter_error + * + * Purpose: Tests H5Dscatter with a variety of different conditions + * that should cause errors. + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Neil Fortner + * Monday, February 4, 2013 + * + *------------------------------------------------------------------------- + */ +static herr_t +scatter_error_cb_fail(void **src_buf/*out*/, size_t *src_buf_bytes_used/*out*/, + void *_scatter_info) +{ + scatter_info_t *scatter_info = (scatter_info_t *)_scatter_info; + size_t nelmts; /* Number of elements to return in src_buf */ + + /* Calculate number of elements */ + nelmts = MIN(scatter_info->block, scatter_info->size); + HDassert(nelmts > 0); + + /* Set output variables */ + *src_buf = (void *)scatter_info->src_buf; + *src_buf_bytes_used = nelmts * sizeof(scatter_info->src_buf[0]); + + return FAIL; +} + +static herr_t +scatter_error_cb_null(void **src_buf/*out*/, size_t *src_buf_bytes_used/*out*/, + void *_scatter_info) +{ + scatter_info_t *scatter_info = (scatter_info_t *)_scatter_info; + size_t nelmts; /* Number of elements to return in src_buf */ + + /* Calculate number of elements */ + nelmts = MIN(scatter_info->block, scatter_info->size); + HDassert(nelmts > 0); + + /* Set output variables */ + *src_buf = NULL; + *src_buf_bytes_used = nelmts * sizeof(scatter_info->src_buf[0]); + + return SUCCEED; +} + +static herr_t +scatter_error_cb_unalign(void **src_buf/*out*/, size_t *src_buf_bytes_used/*out*/, + void *_src_buf_bytes_used) +{ + /* Set output variables */ + *src_buf = _src_buf_bytes_used; + *src_buf_bytes_used = *(size_t *)_src_buf_bytes_used; + + return SUCCEED; +} + +static herr_t +test_scatter_error(void) +{ + hid_t sid = -1; /* Dataspace ID */ + hsize_t dim[1] = {10}; /* Dataspace dimensions */ + hsize_t start[3] = {2}; + hsize_t count[3] = {6}; + int src_buf[7]; /* Source data buffer */ + int dst_buf[10]; /* Destination data buffer */ + scatter_info_t scatter_info; /* Operator data for callback */ + size_t cb_unalign_nbytes; /* Number of bytes to return for unaligned test */ + herr_t ret; /* Return value */ + int i; /* Local index variable */ + + TESTING("H5Dscatter() error conditions"); + + /* Create dataspace */ + if((sid = H5Screate_simple(1, dim, NULL)) < 0) TEST_ERROR + + /* Initialize src_buf */ + for(i=0; i<(int)(sizeof(src_buf)/sizeof(src_buf[0])); i++) + src_buf[i] = i + 1; + + /* Select hyperslab */ + if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, NULL ,count, NULL) < 0) + TEST_ERROR + + /* Verify that base configuration passes */ + scatter_info.src_buf = src_buf; + scatter_info.block = sizeof(src_buf)/sizeof(src_buf[0]); + scatter_info.size = 6; + if(H5Dscatter(scatter_cb, &scatter_info, H5T_NATIVE_INT, sid, dst_buf) < 0) + TEST_ERROR + + + /* + * Test invalid parameters + */ + scatter_info.src_buf = src_buf; + scatter_info.size = 6; + H5E_BEGIN_TRY { + ret = H5Dscatter(NULL, NULL, H5T_NATIVE_INT, sid, dst_buf); + } H5E_END_TRY + if(ret >= 0) TEST_ERROR + + scatter_info.src_buf = src_buf; + scatter_info.size = 6; + H5E_BEGIN_TRY { + ret = H5Dscatter(scatter_cb, &scatter_info, sid, sid, dst_buf); + } H5E_END_TRY + if(ret >= 0) TEST_ERROR + + scatter_info.src_buf = src_buf; + scatter_info.size = 6; + H5E_BEGIN_TRY { + ret = H5Dscatter(scatter_cb, &scatter_info, H5T_NATIVE_INT, H5T_NATIVE_INT, dst_buf); + } H5E_END_TRY + if(ret >= 0) TEST_ERROR + + scatter_info.src_buf = src_buf; + scatter_info.size = 6; + H5E_BEGIN_TRY { + ret = H5Dscatter(scatter_cb, &scatter_info, H5T_NATIVE_INT, sid, NULL); + } H5E_END_TRY + if(ret >= 0) TEST_ERROR + + + /* + * Test returning too many elements in callback + */ + scatter_info.src_buf = src_buf; + scatter_info.size = 7; + H5E_BEGIN_TRY { + ret = H5Dscatter(scatter_cb, &scatter_info, H5T_NATIVE_INT, sid, dst_buf); + } H5E_END_TRY + if(ret >= 0) TEST_ERROR + + + /* + * Test callback returns failure + */ + scatter_info.src_buf = src_buf; + scatter_info.size = 6; + H5E_BEGIN_TRY { + ret = H5Dscatter(scatter_error_cb_fail, &scatter_info, H5T_NATIVE_INT, sid, dst_buf); + } H5E_END_TRY + if(ret >= 0) TEST_ERROR + + + /* + * Test callback returns NULL buffer + */ + scatter_info.src_buf = src_buf; + scatter_info.size = 6; + H5E_BEGIN_TRY { + ret = H5Dscatter(scatter_error_cb_null, &scatter_info, H5T_NATIVE_INT, sid, dst_buf); + } H5E_END_TRY + if(ret >= 0) TEST_ERROR + + + /* + * Test callback returns 0 for src_buf_bytes_used + */ + cb_unalign_nbytes = 0; + H5E_BEGIN_TRY { + ret = H5Dscatter(scatter_error_cb_unalign, &cb_unalign_nbytes, H5T_NATIVE_INT, sid, dst_buf); + } H5E_END_TRY + if(ret >= 0) TEST_ERROR + + + /* + * Test callback returns src_buf_bytes_used that is not a multiple of + * datatype size + */ + cb_unalign_nbytes = sizeof(src_buf[0]) - 1; + H5E_BEGIN_TRY { + ret = H5Dscatter(scatter_error_cb_unalign, &cb_unalign_nbytes, H5T_NATIVE_INT, sid, dst_buf); + } H5E_END_TRY + if(ret >= 0) TEST_ERROR + + cb_unalign_nbytes = sizeof(src_buf[0]) + 1; + H5E_BEGIN_TRY { + ret = H5Dscatter(scatter_error_cb_unalign, &cb_unalign_nbytes, H5T_NATIVE_INT, sid, dst_buf); + } H5E_END_TRY + if(ret >= 0) TEST_ERROR + + + /* Close everything */ + if(H5Sclose(sid) < 0) TEST_ERROR + + PASSED(); + + return 0; + +error: + H5E_BEGIN_TRY { + H5Sclose(sid); + } H5E_END_TRY; + return -1; +} /* end test_scatter_error() */ + + +/*------------------------------------------------------------------------- + * Function: test_gather_error + * + * Purpose: Tests H5Dgather with a variety of different conditions + * that should cause errors. + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Neil Fortner + * Monday, February 4, 2013 + * + *------------------------------------------------------------------------- + */ +static herr_t +gather_error_cb_fail(const void UNUSED *dst_buf, + size_t UNUSED dst_buf_bytes_used, void UNUSED *op_data) +{ + return FAIL; +} + +static herr_t +test_gather_error(void) +{ + hid_t sid = -1; /* Dataspace ID */ + hsize_t dim[1] = {10}; /* Dataspace dimensions */ + hsize_t start[1] = {2}; + hsize_t count[1] = {6}; + int src_buf[10]; /* Source data buffer */ + int dst_buf[6]; /* Destination data buffer */ + int expect_dst_buf[6]; /* Expected destination data buffer */ + gather_info_t gather_info; /* Operator data for callback */ + herr_t ret; /* Return value */ + int i; /* Local index variable */ + + TESTING("H5Dgather() error conditions"); + + /* Create dataspace */ + if((sid = H5Screate_simple(1, dim, NULL)) < 0) TEST_ERROR + + /* Initialize src_buf */ + for(i=0; i<(int)(sizeof(src_buf)/sizeof(src_buf[0])); i++) + src_buf[i] = 1 + i; + + /* Select hyperslab */ + if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, NULL ,count, NULL) < 0) + TEST_ERROR + + /* Initialize expect_dst_buf */ + (void)HDmemset(expect_dst_buf, 0, sizeof(expect_dst_buf)); + for(i=0; i<6; i++) + expect_dst_buf[i] = src_buf[i + 2]; + + /* Verify that base configuration passes */ + gather_info.expect_dst_buf = expect_dst_buf; + gather_info.max_nelmts = 6; + gather_info.last_call = FALSE; + if(H5Dgather(sid, src_buf, H5T_NATIVE_INT, 6 * sizeof(dst_buf[0]), dst_buf, gather_cb, &gather_info) < 0) + TEST_ERROR + + /* + * Test invalid parameters + */ + gather_info.expect_dst_buf = expect_dst_buf; + gather_info.last_call = FALSE; + H5E_BEGIN_TRY { + ret = H5Dgather(H5T_NATIVE_INT, src_buf, H5T_NATIVE_INT, 6 * sizeof(dst_buf[0]), dst_buf, gather_cb, &gather_info); + } H5E_END_TRY + if(ret >= 0) TEST_ERROR + + gather_info.expect_dst_buf = expect_dst_buf; + gather_info.last_call = FALSE; + H5E_BEGIN_TRY { + ret = H5Dgather(sid, NULL, H5T_NATIVE_INT, 6 * sizeof(dst_buf[0]), dst_buf, gather_cb, &gather_info); + } H5E_END_TRY + if(ret >= 0) TEST_ERROR + + gather_info.expect_dst_buf = expect_dst_buf; + gather_info.last_call = FALSE; + H5E_BEGIN_TRY { + ret = H5Dgather(sid, src_buf, sid, 6 * sizeof(dst_buf[0]), dst_buf, gather_cb, &gather_info); + } H5E_END_TRY + if(ret >= 0) TEST_ERROR + + gather_info.expect_dst_buf = expect_dst_buf; + gather_info.last_call = FALSE; + H5E_BEGIN_TRY { + ret = H5Dgather(sid, src_buf, H5T_NATIVE_INT, 0, dst_buf, gather_cb, &gather_info); + } H5E_END_TRY + if(ret >= 0) TEST_ERROR + + gather_info.expect_dst_buf = expect_dst_buf; + gather_info.last_call = FALSE; + H5E_BEGIN_TRY { + ret = H5Dgather(sid, src_buf, H5T_NATIVE_INT, 1, dst_buf, gather_cb, &gather_info); + } H5E_END_TRY + if(ret >= 0) TEST_ERROR + + gather_info.expect_dst_buf = expect_dst_buf; + gather_info.last_call = FALSE; + H5E_BEGIN_TRY { + ret = H5Dgather(sid, src_buf, H5T_NATIVE_INT, 6 * sizeof(dst_buf[0]), NULL, gather_cb, &gather_info); + } H5E_END_TRY + if(ret >= 0) TEST_ERROR + + gather_info.expect_dst_buf = expect_dst_buf; + gather_info.last_call = FALSE; + H5E_BEGIN_TRY { + ret = H5Dgather(sid, src_buf, H5T_NATIVE_INT, 5 * sizeof(dst_buf[0]), dst_buf, NULL, &gather_info); + } H5E_END_TRY + if(ret >= 0) TEST_ERROR + + + /* + * Test callback returns failure + */ + gather_info.expect_dst_buf = expect_dst_buf; + gather_info.last_call = FALSE; + H5E_BEGIN_TRY { + ret = H5Dgather(sid, src_buf, H5T_NATIVE_INT, 6 * sizeof(dst_buf[0]), dst_buf, gather_error_cb_fail, NULL); + } H5E_END_TRY + if(ret >= 0) TEST_ERROR + + + /* Close everything */ + if(H5Sclose(sid) < 0) TEST_ERROR + + PASSED(); + + return 0; + +error: + H5E_BEGIN_TRY { + H5Sclose(sid); + } H5E_END_TRY; + return -1; +} /* end test_gather_error() */ + + +/*------------------------------------------------------------------------- * Function: main * * Purpose: Tests the dataset interface (H5D) @@ -10143,6 +11165,12 @@ main(void) /* Close 2nd FAPL */ if(H5Pclose(fapl2) < 0) TEST_ERROR + /* Tests that do not use files */ + nerrors += (test_scatter() < 0 ? 1 : 0); + nerrors += (test_gather() < 0 ? 1 : 0); + nerrors += (test_scatter_error() < 0 ? 1 : 0); + nerrors += (test_gather_error() < 0 ? 1 : 0); + /* Verify symbol table messages are cached */ nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); diff --git a/test/stab.c b/test/stab.c index a42ee5e..48b58b1 100644 --- a/test/stab.c +++ b/test/stab.c @@ -539,7 +539,7 @@ long_compact(hid_t fapl2) hid_t fid = (-1); /* File ID */ hid_t gid = (-1); /* Group ID */ hid_t gid2 = (-1); /* Group ID */ - char *objname; /* Object name */ + char *objname = NULL; /* Object name */ char filename[NAME_BUF_SIZE]; h5_stat_size_t empty_size; /* Size of an empty file */ h5_stat_size_t file_size; /* Size of each file created */ @@ -557,7 +557,7 @@ long_compact(hid_t fapl2) if((empty_size = h5_get_file_size(filename, fapl2)) < 0) TEST_ERROR /* Construct very long object name template */ - if((objname = (char *)HDmalloc((size_t)(LONG_COMPACT_LENGTH + 1))) == NULL) TEST_ERROR + if(NULL == (objname = (char *)HDmalloc((size_t)(LONG_COMPACT_LENGTH + 1)))) TEST_ERROR HDmemset(objname, 'a', (size_t)LONG_COMPACT_LENGTH); objname[LONG_COMPACT_LENGTH] = '\0'; @@ -620,6 +620,7 @@ long_compact(hid_t fapl2) /* Free object name */ HDfree(objname); + objname = NULL; /* Close top group */ if(H5Gclose(gid) < 0) TEST_ERROR @@ -645,6 +646,10 @@ error: H5Gclose(gid); H5Fclose(fid); } H5E_END_TRY; + + if(objname) + HDfree(objname); + return 1; } /* end long_compact() */ diff --git a/test/test_filters_be.h5 b/test/test_filters_be.h5 new file mode 100644 index 0000000..c4c127b Binary files /dev/null and b/test/test_filters_be.h5 differ diff --git a/test/test_filters_be.hdf5 b/test/test_filters_be.hdf5 deleted file mode 100644 index c4c127b..0000000 Binary files a/test/test_filters_be.hdf5 and /dev/null differ diff --git a/test/test_filters_le.h5 b/test/test_filters_le.h5 new file mode 100644 index 0000000..ff8b846 Binary files /dev/null and b/test/test_filters_le.h5 differ diff --git a/test/test_filters_le.hdf5 b/test/test_filters_le.hdf5 deleted file mode 100644 index ff8b846..0000000 Binary files a/test/test_filters_le.hdf5 and /dev/null differ diff --git a/test/testfiles/err_compat_1 b/test/testfiles/err_compat_1 index e2b37ab..5f4fd47 100644 --- a/test/testfiles/err_compat_1 +++ b/test/testfiles/err_compat_1 @@ -57,6 +57,9 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #001: (file name) line (number) in test_error2(): H5Dwrite shouldn't succeed major: Error API minor: Write failed - #002: (file name) line (number) in H5Dwrite(): not a dataset + #002: (file name) line (number) in H5Dwrite(): can't prepare for writing data + major: Dataset + minor: Write failed + #003: (file name) line (number) in H5D__pre_write(): not a dataset major: Invalid arguments to routine minor: Inappropriate type diff --git a/test/testframe.c b/test/testframe.c index 5835b73..8ab7a5b 100644 --- a/test/testframe.c +++ b/test/testframe.c @@ -155,8 +155,8 @@ void TestUsage(void) print_func("Usage: %s [-v[erbose] (l[ow]|m[edium]|h[igh]|0-9)] %s\n", TestProgName, (TestPrivateUsage ? "" : "")); - print_func(" [-[e]x[clude] name+] \n"); - print_func(" [-o[nly] name+] \n"); + print_func(" [-[e]x[clude] name]+ \n"); + print_func(" [-o[nly] name]+ \n"); print_func(" [-b[egin] name] \n"); print_func(" [-s[ummary]] \n"); print_func(" [-c[leanoff]] \n"); diff --git a/test/testhdf5.h b/test/testhdf5.h index c92c0f0..907fce9 100644 --- a/test/testhdf5.h +++ b/test/testhdf5.h @@ -142,7 +142,7 @@ if(VERBOSE_HI) \ print_func(" Call to routine: %15s at line %4d in %s returned " \ "invalid result\n", where, (int)__LINE__, __FILE__); \ - TestErrPrintf("*** UNEXPECTED RESULT from %s at line %4d in %s\n" \ + TestErrPrintf("*** UNEXPECTED RESULT from %s at line %4d in %s\n", \ where, (int)__LINE__, __FILE__); \ } while(0) diff --git a/test/testlibinfo.sh.in b/test/testlibinfo.sh.in index fba1794..b7aa6c4 100644 --- a/test/testlibinfo.sh.in +++ b/test/testlibinfo.sh.in @@ -53,7 +53,10 @@ SKIP() { # Function definitions CHECK_LIBINFO(){ LINEMSG $1 - if strings $1 | grep "SUMMARY OF THE HDF5 CONFIGURATION" > /dev/null; then + # Some systems, like Mac, the strings command inspects library files. Older + # versions of strings may not know newer library format, resulting in + # command errors. Make it read the file as stdin to avoid the problem. + if strings < $1 | grep "SUMMARY OF THE HDF5 CONFIGURATION" > /dev/null; then echo " PASSED" else echo " FAILED" diff --git a/test/tfile.c b/test/tfile.c index 6424fa3..0ce6e0b 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -526,6 +526,9 @@ test_file_open(void) /* Close dataset from first open */ ret = H5Dclose(did); CHECK(ret, FAIL, "H5Dclose"); + + ret = H5Pclose(fapl_id); + CHECK(ret, FAIL, "H5Pclose"); } /* test_file_open() */ /**************************************************************** @@ -1060,6 +1063,9 @@ test_get_file_id(void) VERIFY(fid2, FAIL, "H5Iget_file_id"); /* Close objects */ + ret = H5Pclose(plist); + CHECK(ret, FAIL, "H5Pclose"); + ret = H5Tclose(datatype_id); CHECK(ret, FAIL, "H5Tclose"); @@ -2855,7 +2861,7 @@ test_filespace_sects(void) test_free_sections(fapl_stdio, filename); /* close fapl and remove the file */ - h5_cleanup(FILENAME, fapl_split); + h5_cleanup(FILENAME, fapl_stdio); /* CORE */ MESSAGE(5, ("Testing File free space information for a core file\n")); @@ -3223,6 +3229,9 @@ test_libver_bounds_real(H5F_libver_t libver_create, unsigned oh_vers_create, ret = H5Fclose(file); CHECK(ret, FAIL, "H5Fclose"); + + ret = H5Pclose(fapl); + CHECK(ret, FAIL, "H5Pclose"); } /* end test_libver_bounds_real() */ /**************************************************************** diff --git a/test/th5o.c b/test/th5o.c index c46751e..a470f4c 100644 --- a/test/th5o.c +++ b/test/th5o.c @@ -111,6 +111,8 @@ test_h5o_open(void) CHECK(dspace, FAIL, "H5Dget_space"); /* Close the IDs */ + ret = H5Sclose(dspace); + CHECK(ret, FAIL, "H5Sclose"); ret = H5Gclose(grp); CHECK(ret, FAIL, "H5Gclose"); ret = H5Tclose(dtype); @@ -324,6 +326,8 @@ test_h5o_open_by_addr(void) CHECK(dspace, FAIL, "H5Dget_space"); /* Close the IDs */ + ret = H5Sclose(dspace); + CHECK(ret, FAIL, "H5Sclose"); ret = H5Gclose(grp); CHECK(ret, FAIL, "H5Gclose"); ret = H5Tclose(dtype); diff --git a/test/th5s.c b/test/th5s.c index 87aa0f1..ebbaa37 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -182,14 +182,13 @@ test_h5s_basic(void) fid1 = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT); CHECK_I(fid1, "H5Fopen"); if (fid1 >= 0){ - dset1 = H5Dopen2(fid1, "dset", H5P_DEFAULT); - VERIFY(dset1, FAIL, "H5Dopen2"); - ret = H5Fclose(fid1); - CHECK_I(ret, "H5Fclose"); + dset1 = H5Dopen2(fid1, "dset", H5P_DEFAULT); + VERIFY(dset1, FAIL, "H5Dopen2"); + ret = H5Fclose(fid1); + CHECK_I(ret, "H5Fclose"); } else - printf("***cannot open the pre-created H5S_MAX_RANK test file (%s)\n", - testfile); + printf("***cannot open the pre-created H5S_MAX_RANK test file (%s)\n", testfile); } /* Verify that incorrect dimensions don't work */ @@ -725,8 +724,8 @@ test_h5s_zero_dim(void) ret = H5Pset_chunk(plist_id, SPACE1_RANK, chunk_dims); CHECK(ret, FAIL, "H5Pset_chunk"); - // ret = H5Pset_alloc_time(plist_id, alloc_time); - // CHECK(ret, FAIL, "H5Pset_alloc_time"); + /* ret = H5Pset_alloc_time(plist_id, alloc_time); */ + /* CHECK(ret, FAIL, "H5Pset_alloc_time"); */ dset1 = H5Dcreate2(fid1, BASICDATASET1, H5T_NATIVE_INT, sid_chunk, H5P_DEFAULT, plist_id, H5P_DEFAULT); CHECK(dset1, FAIL, "H5Dcreate2"); diff --git a/test/tsohm.c b/test/tsohm.c index fddb552..eb5f7c5 100644 --- a/test/tsohm.c +++ b/test/tsohm.c @@ -1280,6 +1280,9 @@ static void size2_verify_plist1(hid_t plist) ret = memcmp(&fill1, &fill1_correct, sizeof(fill1_correct)); VERIFY(ret, 0, memcmp); + + ret = H5Tclose(dtype1_id); + CHECK_I(ret, "H5Tclose"); } /*------------------------------------------------------------------------- @@ -1348,6 +1351,9 @@ static void size2_verify_plist2(hid_t plist) ret = HDmemcmp(&fill2, &fill2_correct, (size_t)DTYPE2_SIZE); VERIFY(ret, 0, memcmp); + + ret = H5Tclose(dtype2_id); + CHECK_I(ret, "H5Tclose"); } #ifdef NOT_NOW @@ -3138,6 +3144,8 @@ static void test_sohm_extlink_helper(hid_t src_fcpl_id, hid_t dst_fcpl_id) /* Close the dataset and both files to make sure everything gets flushed * out of memory */ + ret = H5Sclose(space_id); + CHECK_I(ret, "H5Sclose"); ret = H5Dclose(dset_id); CHECK_I(ret, "H5Dclose"); ret = H5Fclose(src_file_id); @@ -3195,6 +3203,9 @@ test_sohm_extlink(void) test_sohm_extlink_helper(fcpl_id, H5P_DEFAULT); test_sohm_extlink_helper(H5P_DEFAULT, fcpl_id); test_sohm_extlink_helper(fcpl_id, fcpl_id); + + ret = H5Pclose(fcpl_id); + CHECK_I(ret, "H5Pclose"); } @@ -3782,6 +3793,9 @@ test_sohm_extend_dset(void) CHECK_I(ret, "test_sohm_extend_dset_helper"); ret = test_sohm_extend_dset_helper(fcpl_id, TRUE); CHECK_I(ret, "test_sohm_extend_dset_helper"); + + ret = H5Pclose(fcpl_id); + CHECK_I(ret, "H5Pclose"); } diff --git a/test/vfd.c b/test/vfd.c index ca354d9..b85c054 100644 --- a/test/vfd.c +++ b/test/vfd.c @@ -28,17 +28,20 @@ #define FAMILY_SIZE2 (5*KB) #define MULTI_SIZE 128 #define CORE_INCREMENT (4*KB) +#define DSET1_NAME "dset1" +#define DSET1_DIM1 1024 +#define DSET1_DIM2 32 +#define DSET3_NAME "dset3" -/*Macros for Direct VFD*/ +/* Macros for Direct VFD */ +#ifdef H5_HAVE_DIRECT #define MBOUNDARY 512 #define FBSIZE (4*KB) #define CBSIZE (8*KB) #define THRESHOLD 1 -#define DSET1_NAME "dset1" -#define DSET1_DIM1 1024 -#define DSET1_DIM2 32 #define DSET2_NAME "dset2" #define DSET2_DIM 4 +#endif /* H5_HAVE_DIRECT */ const char *FILENAME[] = { "sec2_file", /*0*/ @@ -165,7 +168,7 @@ test_direct(void) size_t mbound; size_t fbsize; size_t cbsize; - int *points, *check, *p1, *p2; + int *points = NULL, *check = NULL, *p1, *p2; int wdata2[DSET2_DIM] = {11,12,13,14}; int rdata2[DSET2_DIM]; int i, j, n; @@ -189,10 +192,10 @@ test_direct(void) if(H5Pget_fapl_direct(fapl, &mbound, &fbsize, &cbsize) < 0) TEST_ERROR; if(mbound != MBOUNDARY || fbsize != FBSIZE || cbsize != CBSIZE) - TEST_ERROR; + TEST_ERROR; if(H5Pset_alignment(fapl, (hsize_t)THRESHOLD, (hsize_t)FBSIZE) < 0) - TEST_ERROR; + TEST_ERROR; H5E_BEGIN_TRY { file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); @@ -235,17 +238,16 @@ test_direct(void) /* Allocate aligned memory for data set 1. For data set 1, everything is aligned including * memory address, size of data, and file address. */ - if(posix_memalign(&points, (size_t)FBSIZE, (size_t)(DSET1_DIM1*DSET1_DIM2*sizeof(int)))!=0) + if(0 != HDposix_memalign(&points, (size_t)FBSIZE, (size_t)(DSET1_DIM1 * DSET1_DIM2 * sizeof(int)))) TEST_ERROR; - - if(posix_memalign(&check, (size_t)FBSIZE, (size_t)(DSET1_DIM1*DSET1_DIM2*sizeof(int)))!=0) + if(0 != HDposix_memalign(&check, (size_t)FBSIZE, (size_t)(DSET1_DIM1 * DSET1_DIM2 * sizeof(int)))) TEST_ERROR; /* Initialize the dset1 */ p1 = points; for(i = n = 0; i < DSET1_DIM1; i++) - for(j = 0; j < DSET1_DIM2; j++) - *p1++ = n++; + for(j = 0; j < DSET1_DIM2; j++) + *p1++ = n++; /* Create the data space1 */ dims1[0] = DSET1_DIM1; @@ -275,13 +277,13 @@ test_direct(void) p1 = points; p2 = check; for(i = 0; i < DSET1_DIM1; i++) - for(j = 0; j < DSET1_DIM2; j++) - if(*p1++ != *p2++) { - H5_FAILED(); - printf(" Read different values than written in data set 1.\n"); - printf(" At index %d,%d\n", i, j); - TEST_ERROR; - } /* end if */ + for(j = 0; j < DSET1_DIM2; j++) + if(*p1++ != *p2++) { + H5_FAILED(); + printf(" Read different values than written in data set 1.\n"); + printf(" At index %d,%d\n", i, j); + TEST_ERROR; + } /* end if */ /* Create the data space2. For data set 2, memory address and data size are not aligned. */ dims2[0] = DSET2_DIM; @@ -308,12 +310,12 @@ test_direct(void) /* Check that the values read are the same as the values written */ for(i = 0; i < DSET2_DIM; i++) - if(wdata2[i] != rdata2[i]) { - H5_FAILED(); - printf(" Read different values than written in data set 2.\n"); - printf(" At index %d\n", i); + if(wdata2[i] != rdata2[i]) { + H5_FAILED(); + printf(" Read different values than written in data set 2.\n"); + printf(" At index %d\n", i); TEST_ERROR; - } /* end if */ + } /* end if */ if(H5Sclose(space1) < 0) TEST_ERROR; @@ -325,10 +327,10 @@ test_direct(void) TEST_ERROR; if(H5Fclose(file) < 0) TEST_ERROR; - if(points) - free(points); - if(check) - free(check); + HDassert(points); + HDfree(points); + HDassert(check); + HDfree(check); h5_cleanup(FILENAME, fapl); PASSED(); @@ -336,13 +338,19 @@ test_direct(void) error: H5E_BEGIN_TRY { - H5Pclose (fapl); + H5Pclose(fapl); H5Sclose(space1); H5Dclose(dset1); H5Sclose(space2); H5Dclose(dset2); H5Fclose(file); } H5E_END_TRY; + + if(points) + HDfree(points); + if(check) + HDfree(check); + return -1; #endif /*H5_HAVE_DIRECT*/ } @@ -368,7 +376,7 @@ test_core(void) char filename[1024]; void *fhandle=NULL; hsize_t file_size; - int *points, *check, *p1, *p2; + int *points = NULL, *check = NULL, *p1, *p2; hid_t dset1=-1, space1=-1; hsize_t dims1[2]; int i, j, n; @@ -427,14 +435,16 @@ test_core(void) TEST_ERROR; /* Allocate memory for data set. */ - points=(int*)malloc(DSET1_DIM1*DSET1_DIM2*sizeof(int)); - check=(int*)malloc(DSET1_DIM1*DSET1_DIM2*sizeof(int)); + if(NULL == (points = (int *)HDmalloc(DSET1_DIM1 * DSET1_DIM2 * sizeof(int)))) + TEST_ERROR; + if(NULL == (check = (int *)HDmalloc(DSET1_DIM1 * DSET1_DIM2 * sizeof(int)))) + TEST_ERROR; /* Initialize the dset1 */ p1 = points; for(i = n = 0; i < DSET1_DIM1; i++) - for(j = 0; j < DSET1_DIM2; j++) - *p1++ = n++; + for(j = 0; j < DSET1_DIM2; j++) + *p1++ = n++; /* Create the data space1 */ dims1[0] = DSET1_DIM1; @@ -464,13 +474,13 @@ test_core(void) p1 = points; p2 = check; for(i = 0; i < DSET1_DIM1; i++) - for(j = 0; j < DSET1_DIM2; j++) - if(*p1++ != *p2++) { - H5_FAILED(); - printf(" Read different values than written in data set 1.\n"); - printf(" At index %d,%d\n", i, j); - TEST_ERROR; - } /* end if */ + for(j = 0; j < DSET1_DIM2; j++) + if(*p1++ != *p2++) { + H5_FAILED(); + printf(" Read different values than written in data set 1.\n"); + printf(" At index %d,%d\n", i, j); + TEST_ERROR; + } /* end if */ if(H5Dclose(dset1) < 0) TEST_ERROR; @@ -501,10 +511,10 @@ test_core(void) TEST_ERROR; /* Reallocate memory for reading buffer. */ - if(check) - free(check); - - check = (int*)malloc(DSET1_DIM1 * DSET1_DIM2 * sizeof(int)); + HDassert(check); + HDfree(check); + if(NULL == (check = (int *)HDmalloc(DSET1_DIM1 * DSET1_DIM2 * sizeof(int)))) + TEST_ERROR; /* Read the data back from dset1 */ if(H5Dread(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0) @@ -514,13 +524,13 @@ test_core(void) p1 = points; p2 = check; for(i = 0; i < DSET1_DIM1; i++) - for(j = 0; j < DSET1_DIM2; j++) - if(*p1++ != *p2++) { - H5_FAILED(); - printf(" Read different values than written in data set 1.\n"); - printf(" At index %d,%d\n", i, j); - TEST_ERROR; - } /* end if */ + for(j = 0; j < DSET1_DIM2; j++) + if(*p1++ != *p2++) { + H5_FAILED(); + printf(" Read different values than written in data set 1.\n"); + printf(" At index %d,%d\n", i, j); + TEST_ERROR; + } /* end if */ /* Check file size API */ if(H5Fget_filesize(file, &file_size) < 0) @@ -537,10 +547,10 @@ test_core(void) TEST_ERROR; if(H5Fclose(file) < 0) TEST_ERROR; - if(points) - free(points); - if(check) - free(check); + HDassert(points); + HDfree(points); + HDassert(check); + HDfree(check); h5_cleanup(FILENAME, fapl); @@ -549,9 +559,15 @@ test_core(void) error: H5E_BEGIN_TRY { - H5Pclose (fapl); + H5Pclose(fapl); H5Fclose(file); } H5E_END_TRY; + + if(points) + HDfree(points); + if(check) + HDfree(check); + return -1; } @@ -579,27 +595,30 @@ test_family_opens(char *fname, hid_t fa_pl) int i; /* Case 1: reopen file with 1st member file name and default property list */ - sprintf(first_name, fname, 0); + HDsnprintf(first_name, sizeof(first_name), fname, 0); H5E_BEGIN_TRY { - file=H5Fopen(first_name, H5F_ACC_RDWR, H5P_DEFAULT); + file = H5Fopen(first_name, H5F_ACC_RDWR, H5P_DEFAULT); } H5E_END_TRY; - if(file >= 0) TEST_ERROR + if(file >= 0) + TEST_ERROR /* Case 2: reopen file with correct name template but default property list */ H5E_BEGIN_TRY { - file=H5Fopen(fname, H5F_ACC_RDWR, H5P_DEFAULT); + file = H5Fopen(fname, H5F_ACC_RDWR, H5P_DEFAULT); } H5E_END_TRY; - if(file >= 0) TEST_ERROR + if(file >= 0) + TEST_ERROR /* Case 3: reopen file with wrong member size */ if(H5Pset_fapl_family(fa_pl, (hsize_t)128, H5P_DEFAULT) < 0) TEST_ERROR; H5E_BEGIN_TRY { - file=H5Fopen(fname, H5F_ACC_RDWR, fa_pl); + file = H5Fopen(fname, H5F_ACC_RDWR, fa_pl); } H5E_END_TRY; - if(file >= 0) TEST_ERROR + if(file >= 0) + TEST_ERROR /* Case 4: reopen file with wrong name template */ HDstrcpy(wrong_name, fname); @@ -613,9 +632,10 @@ test_family_opens(char *fname, hid_t fa_pl) TEST_ERROR; H5E_BEGIN_TRY { - file=H5Fopen(wrong_name, H5F_ACC_RDWR, fa_pl); + file = H5Fopen(wrong_name, H5F_ACC_RDWR, fa_pl); } H5E_END_TRY; - if(file >= 0) TEST_ERROR + if(file >= 0) + TEST_ERROR return 0; @@ -704,44 +724,44 @@ test_family(void) if((dset=H5Dcreate2(file, dname, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; - for(i=0; i20*KB) - TEST_ERROR; - } else if(sizeof(int)>=8) { - if(file_size<32*KB || file_size>40*KB) - TEST_ERROR; - } +#if H5_SIZEOF_INT <= 4 + if(file_size < (18 * KB) || file_size > (20 * KB)) + TEST_ERROR; +#elif H5_SIZEOF_INT >= 8 + if(file_size < (32 * KB) || file_size > (40 * KB)) + TEST_ERROR; +#endif if(H5Sclose(space) < 0) TEST_ERROR; @@ -761,7 +781,7 @@ test_family(void) if(H5Pset_fapl_family(fapl, (hsize_t)FAMILY_SIZE, H5P_DEFAULT) < 0) TEST_ERROR; - if((file=H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) + if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR; if(H5Fclose(file) < 0) @@ -829,13 +849,13 @@ test_family_compat(void) * Since we're going to open the files with write mode, this protects the original * files. */ - sprintf(newname_individual, newname, counter); - sprintf(pathname_individual, pathname, counter); + HDsnprintf(newname_individual, sizeof(newname_individual), newname, counter); + HDsnprintf(pathname_individual, sizeof(pathname_individual), pathname, counter); - while (h5_make_local_copy(pathname_individual, newname_individual) >= 0) { + while(h5_make_local_copy(pathname_individual, newname_individual) >= 0) { counter++; - sprintf(newname_individual, newname, counter); - sprintf(pathname_individual, pathname, counter); + HDsnprintf(newname_individual, sizeof(newname_individual), newname, counter); + HDsnprintf(pathname_individual, sizeof(pathname_individual), pathname, counter); } /* Make sure we can open the file. Use the read and write mode to flush the @@ -888,7 +908,7 @@ error: * reopening multi file. * * Return: Success: 0 - * Failure: 1 + * Failure: -1 * * Programmer: Raymond Lu * Thursday, May 19, 2005 @@ -903,14 +923,14 @@ test_multi_opens(char *fname) char sf_name[1024]; /*name string "multi_file-s.h5"*/ /* Case: reopen with the name of super file and default property list */ - sprintf(super_name, "%%s-%c.h5", 's'); - sprintf(sf_name, super_name, fname); + HDsnprintf(super_name, sizeof(super_name), "%%s-%c.h5", 's'); + HDsnprintf(sf_name, sizeof(sf_name), super_name, fname); H5E_BEGIN_TRY { - file=H5Fopen(sf_name, H5F_ACC_RDWR, H5P_DEFAULT); + file = H5Fopen(sf_name, H5F_ACC_RDWR, H5P_DEFAULT); } H5E_END_TRY; - return 0; + return(file >= 0 ? -1 : 0); } @@ -999,11 +1019,11 @@ test_multi(void) TEST_ERROR; /* Reopen the file */ - if((file=H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) + if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR; /* Create and write data set */ - if((space=H5Screate_simple(2, dims, NULL)) < 0) + if((space = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR; /* Retrieve the access property list... */ @@ -1146,19 +1166,16 @@ error: static herr_t test_multi_compat(void) { - hid_t file=(-1), fapl, fapl2=(-1), dset=(-1), space=(-1); - hid_t access_fapl = -1; + hid_t file=(-1), fapl, dset=(-1), space=(-1); char newname[1024]; char filename_s[1024], newname_s[1024]; char filename_r[1024], newname_r[1024]; - int *fhandle2=NULL, *fhandle=NULL; H5FD_mem_t mt, memb_map[H5FD_MEM_NTYPES]; hid_t memb_fapl[H5FD_MEM_NTYPES]; haddr_t memb_addr[H5FD_MEM_NTYPES]; const char *memb_name[H5FD_MEM_NTYPES]; char sv[H5FD_MEM_NTYPES][32]; hsize_t dims[2]={MULTI_SIZE, MULTI_SIZE}; - char dname[]="dataset2"; int i, j; int buf[MULTI_SIZE][MULTI_SIZE]; @@ -1238,7 +1255,7 @@ test_multi_compat(void) if((space=H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR; - if((dset=H5Dcreate2(file, DSET2_NAME, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if((dset=H5Dcreate2(file, DSET3_NAME, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; for(i=0; i -f ${fparam} -i ./testfiles/${infile} -o ./testfiles/${outfile} ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN} + COMMAND $ -f ${fparam} -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN} ) - IF (NOT "${last_test}" STREQUAL "") - SET_TESTS_PROPERTIES (H5COPY_F-${testname} PROPERTIES DEPENDS ${last_test}) - ENDIF (NOT "${last_test}" STREQUAL "") - SET (last_test "H5COPY_F-${testname}") - ADD_H5_DIFF_TEST (${testname} ${resultcode} ${last_test} ${infile} ${outfile} ${srcname} ${dstname}) + 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 $ -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 outfile vparam sparam srcname dparam dstname) + 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 $ -i ./testfiles/${infile} -o ./testfiles/${outfile} ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN} + COMMAND $ -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN} ) - IF (NOT "${last_test}" STREQUAL "") - SET_TESTS_PROPERTIES (H5COPY-${testname} PROPERTIES DEPENDS ${last_test}) - ENDIF (NOT "${last_test}" STREQUAL "") - SET (last_test "H5COPY-${testname}") - ADD_H5_DIFF_TEST (${testname} ${resultcode} ${last_test} ${infile} ${outfile} ${srcname} ${dstname}) + 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 $ -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_DIFF_TEST testname resultcode testdepends infile outfile srcname dstname) + 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 $ -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 $ -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-DIFF_${testname} - COMMAND $ -q ./testfiles/${infile} ./testfiles/${outfile} ${srcname} ${dstname} + NAME H5COPY-${testname}-DIFF + COMMAND $ -q ./testfiles/${infile} ./testfiles/${testname}.out.h5 ${srcname} ${dstname} ) - SET_TESTS_PROPERTIES(H5COPY-DIFF_${testname} PROPERTIES DEPENDS ${testdepends}) - SET (last_test "H5COPY-DIFF_${testname}") + SET_TESTS_PROPERTIES(H5COPY-${testname}-DIFF PROPERTIES DEPENDS H5COPY-${testname}) IF (${resultcode} STREQUAL "1") - SET_TESTS_PROPERTIES (H5COPY-DIFF_${testname} PROPERTIES WILL_FAIL "true") + SET_TESTS_PROPERTIES (H5COPY-${testname}-DIFF PROPERTIES WILL_FAIL "true") ENDIF (${resultcode} STREQUAL "1") ENDIF (NOT ${resultcode} STREQUAL "2") - ENDMACRO (ADD_H5_DIFF_TEST) + 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) - # - # Test result with h5ls - # - MACRO (ADD_H5LS_TEST file filetest) - # If using memchecker add tests without using scripts + ADD_TEST ( + NAME H5COPY_SAME-${testname}-prefill + COMMAND $ -i ./testfiles/${pfile} -o ./testfiles/${testname}.out.h5 -v -s ${psparam} -d ${pdparam} + ) IF (HDF5_ENABLE_USING_MEMCHECKER) - ADD_TEST (NAME H5COPY-h5ls_${file}-${filetest} COMMAND $ -Svr ./testfiles/${file}.out.h5) + 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 $ -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-h5ls_${file}-${filetest} - COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS=-Svr;./testfiles/${file}.out.h5" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -D "TEST_OUTPUT=./testfiles/${file}.out.out" - -D "TEST_EXPECT=0" - -D "TEST_REFERENCE=./testfiles/${file}.out.ls" - -D "TEST_MASK=true" - -P "${HDF5_RESOURCES_DIR}/runTest.cmake" + NAME H5COPY_SAME-${testname}-DIFF + COMMAND $ -q ./testfiles/${testname}.out.h5 ./testfiles/${testname}.out.h5 ${srcname} ${dstname} ) - ENDIF (HDF5_ENABLE_USING_MEMCHECKER) - IF (NOT "${last_test}" STREQUAL "") - SET_TESTS_PROPERTIES (H5COPY-h5ls_${file}-${filetest} PROPERTIES DEPENDS ${last_test}) - ENDIF (NOT "${last_test}" STREQUAL "") - SET (last_test "H5COPY-h5ls_${file}-${filetest}") - ENDMACRO (ADD_H5LS_TEST) + 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 outfile vparam sparam srcname dparam dstname) + 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 $ -i ./testfiles/${infile} -o ./testfiles/${outfile} ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN}) + ADD_TEST (NAME H5COPY-CMP-${testname} COMMAND $ -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 + ./testfiles/${testname}.out.out + ./testfiles/${testname}.out.out.err + ) ADD_TEST ( NAME H5COPY-CMP-${testname} COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$" - -D "TEST_ARGS=-i;./testfiles/${infile};-o;./testfiles/${outfile};${vparam};${sparam};${srcname};${dparam};${dstname}" + -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}" @@ -176,11 +259,8 @@ IF (BUILD_TESTING) -D "TEST_MASK=true" -P "${HDF5_RESOURCES_DIR}/runTest.cmake" ) + SET_TESTS_PROPERTIES (H5COPY-CMP-${testname} PROPERTIES DEPENDS H5COPY-CMP-${testname}-clear-objects) ENDIF (HDF5_ENABLE_USING_MEMCHECKER) - IF (NOT "${last_test}" STREQUAL "") - SET_TESTS_PROPERTIES (H5COPY-CMP-${testname} PROPERTIES DEPENDS ${last_test}) - ENDIF (NOT "${last_test}" STREQUAL "") - SET (last_test "H5COPY-CMP-${testname}") ENDMACRO (ADD_H5_CMP_TEST) ############################################################################## @@ -197,172 +277,135 @@ IF (BUILD_TESTING) SET (HDF_EXT_SRC_FILE h5copy_extlinks_src) SET (HDF_EXT_TRG_FILE h5copy_extlinks_trg) - # Remove any output file left over from previous test run - ADD_TEST ( - NAME H5COPY-clearall-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ./testfiles/${HDF_FILE1}.out.h5 - ./testfiles/${HDF_FILE1}.out.out - ./testfiles/${HDF_FILE1}.out.out.err - ./testfiles/${HDF_FILE2}.out.h5 - ./testfiles/${HDF_FILE2}.out.out - ./testfiles/${HDF_FILE2}.out.out.err - ./testfiles/${HDF_EXT_SRC_FILE}.out.h5 - ./testfiles/${HDF_EXT_SRC_FILE}.out.out - ./testfiles/${HDF_EXT_SRC_FILE}.out.out.err - ) - 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") + 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 ${HDF_FILE1}.out.h5 -v -s simple -d simple) - ADD_H5_TEST (chunk 0 ${HDF_FILE1}.h5 ${HDF_FILE1}.out.h5 -v -s chunk -d chunk) - ADD_H5_TEST (compact 0 ${HDF_FILE1}.h5 ${HDF_FILE1}.out.h5 -v -s compact -d compact) - ADD_H5_TEST (compound 0 ${HDF_FILE1}.h5 ${HDF_FILE1}.out.h5 -v -s compound -d compound) - ADD_H5_TEST (compressed 0 ${HDF_FILE1}.h5 ${HDF_FILE1}.out.h5 -v -s compressed -d compressed) - ADD_H5_TEST (named_vl 0 ${HDF_FILE1}.h5 ${HDF_FILE1}.out.h5 -v -s named_vl -d named_vl) - ADD_H5_TEST (nested_vl 0 ${HDF_FILE1}.h5 ${HDF_FILE1}.out.h5 -v -s nested_vl -d nested_vl) + 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 ${HDF_FILE1}.out.h5 -v -s grp_dsets/simple -d simple_top) + ADD_H5_TEST (simple_top 0 ${HDF_FILE1}.h5 -v -s grp_dsets/simple -d simple_top) # "Test copying & renaming dataset" - ADD_H5_TEST (rename 0 ${HDF_FILE1}.h5 ${HDF_FILE1}.out.h5 -v -s compound -d rename) + 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 ${HDF_FILE1}.out.h5 -v -s grp_empty -d grp_empty) - ADD_H5_TEST (grp_dsets 0 ${HDF_FILE1}.h5 ${HDF_FILE1}.out.h5 -v -s grp_dsets -d grp_dsets) - ADD_H5_TEST (grp_nested 0 ${HDF_FILE1}.h5 ${HDF_FILE1}.out.h5 -v -s grp_nested -d grp_nested) + 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_TEST (simple_group 0 ${HDF_FILE1}.h5 ${HDF_FILE1}.out.h5 -v -s /grp_dsets/simple -d /grp_dsets/simple_group) + 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 ${HDF_FILE1}.out.h5 -v -s grp_dsets -d grp_rename) + 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_TEST (grp_dsets_rename 0 ${HDF_FILE1}.h5 ${HDF_FILE1}.out.h5 -v -s grp_dsets -d /grp_rename/grp_dsets) + 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 ${HDF_FILE1}.out.h5 -vp -s simple -d /A/B1/simple) - ADD_H5_TEST (A_B2_simple2 0 ${HDF_FILE1}.h5 ${HDF_FILE1}.out.h5 -vp -s simple -d /A/B2/simple2) - ADD_H5_TEST (C_D_simple 0 ${HDF_FILE1}.h5 ${HDF_FILE1}.out.h5 -vp -s /grp_dsets/simple -d /C/D/simple) - ADD_H5_TEST (E_F_grp_dsets 0 ${HDF_FILE1}.h5 ${HDF_FILE1}.out.h5 -vp -s /grp_dsets -d /E/F/grp_dsets) - ADD_H5_TEST (G_H_grp_nested 0 ${HDF_FILE1}.h5 ${HDF_FILE1}.out.h5 -vp -s /grp_nested -d /G/H/grp_nested) - - # Verify that the file created above is correct - ADD_H5LS_TEST (${HDF_FILE1} basic) + 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 ############## - # Remove any output file left over from previous test run - ADD_TEST ( - NAME H5COPY-clear-refs - COMMAND ${CMAKE_COMMAND} - -E remove - ./testfiles/${HDF_FILE2}.out.h5 - ./testfiles/${HDF_FILE2}.out.out - ./testfiles/${HDF_FILE2}.out.out.err - ) - IF (NOT "${last_test}" STREQUAL "") - SET_TESTS_PROPERTIES (H5COPY-clear-refs PROPERTIES DEPENDS ${last_test}) - ENDIF (NOT "${last_test}" STREQUAL "") - SET (last_test "H5COPY-clear-refs") - # "Test copying object and region references" - ADD_H5_F_TEST (region_ref 2 ${HDF_FILE2}.h5 ${HDF_FILE2}.out.h5 ref -v -s / -d /COPY) - - # Verify that the file created above is correct - ADD_H5LS_TEST (${HDF_FILE2} refs) + ADD_H5_F_TEST (region_ref 2 ${HDF_FILE2}.h5 ref -v -s / -d /COPY) ############# COPY EXT LINKS ############## - # Remove any output file left over from previous test run - ADD_TEST ( - NAME H5COPY-clear-ext-links - COMMAND ${CMAKE_COMMAND} - -E remove - ./testfiles/${HDF_EXT_SRC_FILE}.out.h5 - ./testfiles/${HDF_EXT_SRC_FILE}.out.out - ./testfiles/${HDF_EXT_SRC_FILE}.out.out.err - ) - IF (NOT "${last_test}" STREQUAL "") - SET_TESTS_PROPERTIES (H5COPY-clear-ext-links PROPERTIES DEPENDS ${last_test}) - ENDIF (NOT "${last_test}" STREQUAL "") - SET (last_test "H5COPY-clear-ext-links") - # "Test copying external link directly without -f ext" - ADD_H5_TEST (ext_link 2 ${HDF_EXT_SRC_FILE}.h5 ${HDF_EXT_SRC_FILE}.out.h5 -v -s /group_ext/extlink_dset -d /copy1_dset) + 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 ${HDF_EXT_SRC_FILE}.out.h5 ext -v -s /group_ext/extlink_dset -d /copy2_dset) + 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 ${HDF_EXT_SRC_FILE}.out.h5 -v -s /group_ext/extlink_notyet1 -d /copy_dangle1_1) + 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 ${HDF_EXT_SRC_FILE}.out.h5 ext -v -s /group_ext/extlink_notyet1 -d /copy_dangle1_2) + 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 ${HDF_EXT_SRC_FILE}.out.h5 -v -s /group_ext/extlink_notyet2 -d /copy_dangle2_1) + 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 ${HDF_EXT_SRC_FILE}.out.h5 ext -v -s /group_ext/extlink_notyet2 -d /copy_dangle2_2) + 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 ${HDF_EXT_SRC_FILE}.out.h5 -v -s /group_ext -d /copy1_group) + 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 ${HDF_EXT_SRC_FILE}.out.h5 ext -v -s /group_ext -d /copy2_group) - - # Verify that the file created above is correct - ADD_H5LS_TEST (${HDF_EXT_SRC_FILE} links) + ADD_H5_F_TEST (ext_link_group_f 2 ${HDF_EXT_SRC_FILE}.h5 ext -v -s /group_ext -d /copy2_group) ############# Test misc. ############## - # Remove any output file left over from previous test run - ADD_TEST ( - NAME H5COPY-clear-misc - COMMAND ${CMAKE_COMMAND} - -E remove - ./testfiles/h5copy_misc1.out.out - ./testfiles/h5copy_misc1.out.out.err - ./testfiles/${HDF_FILE1}.out.h5 - ) - IF (NOT "${last_test}" STREQUAL "") - SET_TESTS_PROPERTIES (H5COPY-clear-misc PROPERTIES DEPENDS ${last_test}) - ENDIF (NOT "${last_test}" STREQUAL "") - SET (last_test "H5COPY-clear-misc") #----------------------------------------------------------------- # "Test copying object into group which doesn't exist, without -p" # - ADD_H5_CMP_TEST (h5copy_misc1 1 ${HDF_FILE1}.h5 ${HDF_FILE1}.out.h5 -v -s /simple -d /g1/g2/simple) - # Remove any output file left over from previous test run - ADD_TEST ( - NAME H5COPY-clear-samefile - COMMAND ${CMAKE_COMMAND} - -E remove - ./testfiles/${HDF_FILE1}.out.h5 - ) - IF (NOT "${last_test}" STREQUAL "") - SET_TESTS_PROPERTIES (H5COPY-clear-samefile PROPERTIES DEPENDS ${last_test}) - ENDIF (NOT "${last_test}" STREQUAL "") - SET (last_test "H5COPY-clear-samefile") + ADD_H5_CMP_TEST (h5copy_misc1 1 ${HDF_FILE1}.h5 -v -s /simple -d /g1/g2/simple) #------------------------------------------- # "Test copying objects to the same file " # - # create temporary test file with some objects - ADD_H5_TEST (samefile1_pre 0 ${HDF_FILE1}.h5 ${HDF_FILE1}.out.h5 -v -s /simple -d /simple) - ADD_H5_TEST (samefile2_pre 0 ${HDF_FILE1}.h5 ${HDF_FILE1}.out.h5 -v -s /grp_dsets -d /grp_dsets) - # actual test cases # - dataset - ADD_H5_TEST (samefile1 0 ${HDF_FILE1}.out.h5 ${HDF_FILE1}.out.h5 -v -s /simple -d /simple_cp) + ADD_H5_TEST_SAME (samefile1 0 ${HDF_FILE1}.h5 /simple /simple -v -s /simple -d /simple_cp) # - group with some datasets - ADD_H5_TEST (samefile2 0 ${HDF_FILE1}.out.h5 ${HDF_FILE1}.out.h5 -v -s /grp_dsets -d /grp_dsets_cp) + ADD_H5_TEST_SAME (samefile2 0 ${HDF_FILE1}.h5 /grp_dsets /grp_dsets -v -s /grp_dsets -d /grp_dsets_cp) ENDIF (BUILD_TESTING) ############################################################################## diff --git a/tools/h5copy/Makefile.in b/tools/h5copy/Makefile.in index da9d0b7..3278f80 100644 --- a/tools/h5copy/Makefile.in +++ b/tools/h5copy/Makefile.in @@ -234,6 +234,7 @@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ +HAVE_PTHREAD = @HAVE_PTHREAD@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF_CXX = @HDF_CXX@ @@ -285,7 +286,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PARALLEL = @PARALLEL@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ -PTHREAD = @PTHREAD@ RANLIB = @RANLIB@ ROOT = @ROOT@ RUNPARALLEL = @RUNPARALLEL@ diff --git a/tools/h5copy/testfiles/h5copy_misc1.out b/tools/h5copy/testfiles/h5copy_misc1.out index 10dd1a6..1624f2b 100644 --- a/tools/h5copy/testfiles/h5copy_misc1.out +++ b/tools/h5copy/testfiles/h5copy_misc1.out @@ -1,3 +1,3 @@ -Copying file <./testfiles/h5copytst.h5> and object to file <./testfiles/h5copytst.out.h5> and object +Copying file <./testfiles/h5copytst.h5> and object to file <./testfiles/h5copy_misc1.out.h5> and object Error in copy...Exiting h5copy error: group doesn't exist. Use -p to create parent groups. diff --git a/tools/h5copy/testh5copy.sh.in b/tools/h5copy/testh5copy.sh.in index c7acd9a..d30d8d8 100644 --- a/tools/h5copy/testh5copy.sh.in +++ b/tools/h5copy/testh5copy.sh.in @@ -57,9 +57,6 @@ $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_extlinks_src.out.ls -$SRC_H5COPY_TESTFILES/h5copy_ref.out.ls -$SRC_H5COPY_TESTFILES/h5copytst.out.ls $SRC_H5COPY_TESTFILES/h5copy_misc1.out " @@ -151,15 +148,6 @@ VERIFY() # 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' -} - -# Print a line-line message left justified in a field of 70 characters -# beginning with the word "Verifying". -# VERIFY_OUTPUT() { SPACES=" " @@ -183,24 +171,34 @@ TOOLTEST() { 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 + 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 $@ + echo "#############################" + echo " output for '$H5COPY $@'" + echo "#############################" + $RUNSERIAL $H5COPY_BIN $@ ) > $actualout 2> $actualerr RET=$? if [ $RET != 0 ]; then @@ -210,15 +208,141 @@ TOOLTEST() 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 + 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 - if [ $runh5diff != no ]; then - H5DIFFTEST $inputfile $outputfile $7 $9 + 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 } @@ -259,18 +383,18 @@ TOOLTEST_FAIL() actualerr_sav=${actualerr}-sav shift if [ "$1" = -i ]; then - inputfile=$2 + inputfile=$2 fi if [ "$3" = -o ]; then - outputfile=$4 + outputfile=$4 fi TESTING $H5COPY $@ ( - #echo "#############################" - #echo " output for '$H5COPY $@'" - #echo "#############################" - $RUNSERIAL $H5COPY_BIN $@ + #echo "#############################" + #echo " output for '$H5COPY $@'" + #echo "#############################" + $RUNSERIAL $H5COPY_BIN $@ ) > $actualout 2> $actualerr RET=$? @@ -298,7 +422,7 @@ TOOLTEST_FAIL() # Clean up output file if test -z "$HDF5_NOCLEANUP"; then - rm -f $actualout $actualerr $actualout_sav $actualerr_sav + rm -f $actualout $actualerr $actualout_sav $actualerr_sav $outputfile fi } @@ -311,10 +435,10 @@ H5DIFFTEST() $RUNSERIAL $H5DIFF_BIN -q "$@" RET=$? if [ $RET != 0 ] ; then - echo "*FAILED*" - nerrors="`expr $nerrors + 1`" + echo "*FAILED*" + nerrors="`expr $nerrors + 1`" else - echo " PASSED" + echo " PASSED" fi } @@ -327,50 +451,13 @@ H5DIFFTEST_FAIL() RET=$? if [ $h5haveexitcode = 'yes' -a $RET != 1 ] ; then - echo "*FAILED*" - nerrors="`expr $nerrors + 1`" + echo "*FAILED*" + nerrors="`expr $nerrors + 1`" else - echo " PASSED" + echo " PASSED" 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`.ls.actualout" - - # Stderr is included in stdout so that the diff can detect - # any unexpected output from that stream too. - # - # Note: The modification time and storage utilization are masked off - # so that the output is more portable - VERIFY_H5LS $@ - ( - $RUNSERIAL $H5LS_BIN $H5LS_ARGS $@ - ) 2>&1 |sed 's/Modified:.*/Modified: XXXX-XX-XX XX:XX:XX XXX/' |sed 's/Storage:.*/Storage:
/' >$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_err - fi -} - # Copy single datasets of various forms from one group to another, # adding object copied to the destination file each time # @@ -379,82 +466,54 @@ H5LSTEST() COPY_OBJECTS() { TESTFILE="$TESTDIR/h5copytst.h5" - FILEOUT="$TESTDIR/`basename h5copytst.h5 .h5`.out.h5" - - # Remove any output file left over from previous test run - rm -f $FILEOUT - echo "Testing from `basename $TESTFILE` to `basename $FILEOUT` for the following tests:" echo "Test copying various forms of datasets" - TOOLTEST -i $TESTFILE -o $FILEOUT -v -s simple -d simple - TOOLTEST -i $TESTFILE -o $FILEOUT -v -s chunk -d chunk - TOOLTEST -i $TESTFILE -o $FILEOUT -v -s compact -d compact - TOOLTEST -i $TESTFILE -o $FILEOUT -v -s compound -d compound - TOOLTEST -i $TESTFILE -o $FILEOUT -v -s compressed -d compressed - TOOLTEST -i $TESTFILE -o $FILEOUT -v -s named_vl -d named_vl - TOOLTEST -i $TESTFILE -o $FILEOUT -v -s nested_vl -d nested_vl + 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 echo "Test copying dataset within group in source file to root of destination" - TOOLTEST -i $TESTFILE -o $FILEOUT -v -s grp_dsets/simple -d simple_top + 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 $FILEOUT -v -s compound -d rename + TOOLTEST -i $TESTFILE -o $TESTDIR/dsrename.out.h5 -v -s compound -d rename echo "Test copying empty, 'full' & 'nested' groups" - TOOLTEST -i $TESTFILE -o $FILEOUT -v -s grp_empty -d grp_empty - TOOLTEST -i $TESTFILE -o $FILEOUT -v -s grp_dsets -d grp_dsets - TOOLTEST -i $TESTFILE -o $FILEOUT -v -s grp_nested -d grp_nested + 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 echo "Test copying dataset within group in source file to group in destination" - TOOLTEST -i $TESTFILE -o $FILEOUT -v -s /grp_dsets/simple -d /grp_dsets/simple_group + 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 $FILEOUT -v -s grp_dsets -d grp_rename + 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 -i $TESTFILE -o $FILEOUT -v -s grp_dsets -d /grp_rename/grp_dsets + 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 $FILEOUT -vp -s simple -d /A/B1/simple - TOOLTEST -i $TESTFILE -o $FILEOUT -vp -s simple -d /A/B2/simple2 - TOOLTEST -i $TESTFILE -o $FILEOUT -vp -s /grp_dsets/simple -d /C/D/simple - TOOLTEST -i $TESTFILE -o $FILEOUT -vp -s /grp_dsets -d /E/F/grp_dsets - TOOLTEST -i $TESTFILE -o $FILEOUT -vp -s /grp_nested -d /G/H/grp_nested - - # Verify that the file created above is correct - H5LSTEST $FILEOUT - - # Remove output file created, if the "no cleanup" environment variable is - # not defined - if test -z "$HDF5_NOCLEANUP"; then - rm -f $FILEOUT - fi + 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. -# adding to the destination file each time compare the result # # Assumed arguments: # COPY_REFERENCES() { TESTFILE="$TESTDIR/h5copy_ref.h5" - FILEOUT="$TESTDIR/`basename h5copy_ref.h5 .h5`.out.h5" - - # Remove any output file left over from previous test run - rm -f $FILEOUT echo "Test copying object and region references" - TOOLTEST -f ref -i $TESTFILE -o $FILEOUT -v -s / -d /COPY - - # Verify that the file created above is correct - H5LSTEST $FILEOUT - - # Remove output file created, if the "no cleanup" environment variable is - # not defined - if test -z "$HDF5_NOCLEANUP"; then - rm -f $FILEOUT - fi + TOOLTEST_F -f ref -i $TESTFILE -o $TESTDIR/region_ref.out.h5 -v -s / -d /COPY } # Copy external links. @@ -465,43 +524,30 @@ COPY_REFERENCES() COPY_EXT_LINKS() { TESTFILE="$TESTDIR/h5copy_extlinks_src.h5" - FILEOUT="$TESTDIR/`basename h5copy_extlinks_src.h5 .h5`.out.h5" - - # Remove any output file left over from previous test run - rm -f $FILEOUT echo "Test copying external link directly without -f ext" - TOOLTEST -v -i $TESTFILE -o $FILEOUT -s /group_ext/extlink_dset -d /copy1_dset + 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 $FILEOUT -v -s /group_ext/extlink_dset -d /copy2_dset + TOOLTEST_F -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 $FILEOUT -s /group_ext/extlink_notyet1 -d /copy_dangle1_1 + 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 $FILEOUT -v -s /group_ext/extlink_notyet1 -d /copy_dangle1_2 + TOOLTEST_F -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 $FILEOUT -s /group_ext/extlink_notyet2 -d /copy_dangle2_1 + 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 $FILEOUT -v -s /group_ext/extlink_notyet2 -d /copy_dangle2_2 + TOOLTEST_F -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 $FILEOUT -s /group_ext -d /copy1_group + 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 -v -i $TESTFILE -o $FILEOUT -s /group_ext -d /copy2_group - - # Verify that the file created above is correct - H5LSTEST $FILEOUT - - # Remove output file created, if the "no cleanup" environment variable is - # not defined - if test -z "$HDF5_NOCLEANUP"; then - rm -f $FILEOUT - fi + TOOLTEST_F -f ext -i $TESTFILE -o $TESTDIR/ext_link_group_f.out.h5 -v -s /group_ext -d /copy2_group } # Test misc. @@ -511,28 +557,13 @@ COPY_EXT_LINKS() TEST_MISC() { TESTFILE="$TESTDIR/h5copytst.h5" - FILEOUT="$TESTDIR/`basename h5copytst.h5 .h5`.out.h5" - - # Remove any output file left over from previous test run - rm -f $FILEOUT echo "Test copying object into group which doesn't exist, without -p" - TOOLTEST_FAIL h5copy_misc1.out -v -i $TESTFILE -o $FILEOUT -s /simple -d /g1/g2/simple + 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 " - rm -f $FILEOUT - # create temporary test file ($FILEOUT) with some objects - TOOLTEST -i $TESTFILE -o $FILEOUT -v -s /simple -d /simple - TOOLTEST -i $TESTFILE -o $FILEOUT -v -s /grp_dsets -d /grp_dsets - # actual test cases - TOOLTEST -i $FILEOUT -o $FILEOUT -v -s /simple -d /simple_cp - TOOLTEST -i $FILEOUT -o $FILEOUT -v -s /grp_dsets -d /grp_dsets_cp - - # Remove output file created, if the "no cleanup" environment variable is - # not defined - if test -z "$HDF5_NOCLEANUP"; then - rm -f $FILEOUT - fi + 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 } ############################################################################## diff --git a/tools/h5diff/CMakeLists.txt b/tools/h5diff/CMakeLists.txt index 994a6f2..8eb5ad1 100644 --- a/tools/h5diff/CMakeLists.txt +++ b/tools/h5diff/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.6) +cmake_minimum_required (VERSION 2.8.10) PROJECT (HDF5_TOOLS_H5DIFF) #----------------------------------------------------------------------------- @@ -344,10 +344,9 @@ IF (BUILD_TESTING) IF (NOT "${last_test}" STREQUAL "") SET_TESTS_PROPERTIES (H5DIFF-${resultfile} PROPERTIES DEPENDS ${last_test}) ENDIF (NOT "${last_test}" STREQUAL "") - SET (last_test "H5DIFF-${resultfile}") ELSE (HDF5_ENABLE_USING_MEMCHECKER) ADD_TEST ( - NAME H5DIFF-clear-${resultfile}-objects + NAME H5DIFF-${resultfile}-clear-objects COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/${resultfile}.out ./testfiles/${resultfile}.out.err ) @@ -363,7 +362,7 @@ IF (BUILD_TESTING) -D "TEST_APPEND=EXIT CODE:" -P "${HDF5_RESOURCES_DIR}/runTest.cmake" ) - SET_TESTS_PROPERTIES (H5DIFF-${resultfile} PROPERTIES DEPENDS "H5DIFF-clear-${resultfile}-objects") + SET_TESTS_PROPERTIES (H5DIFF-${resultfile} PROPERTIES DEPENDS "H5DIFF-${resultfile}-clear-objects") ENDIF (HDF5_ENABLE_USING_MEMCHECKER) IF (H5_HAVE_PARALLEL) ADD_PH5_TEST (${resultfile} ${resultcode} ${ARGN}) @@ -381,10 +380,9 @@ IF (BUILD_TESTING) IF (NOT "${last_test}" STREQUAL "") SET_TESTS_PROPERTIES (PH5DIFF-${resultfile} PROPERTIES DEPENDS ${last_test}) ENDIF (NOT "${last_test}" STREQUAL "") - SET (last_test "PH5DIFF-${resultfile}") ELSE (HDF5_ENABLE_USING_MEMCHECKER) ADD_TEST ( - NAME PH5DIFF-clear-${resultfile}-objects + NAME PH5DIFF-${resultfile}-clear-objects COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/${resultfile}_p.out ./testfiles/${resultfile}_p.out.err ) @@ -402,7 +400,7 @@ IF (BUILD_TESTING) -D "TEST_SKIP_COMPARE=TRUE" -P "${HDF5_RESOURCES_DIR}/prunTest.cmake" ) - SET_TESTS_PROPERTIES (PH5DIFF-${resultfile} PROPERTIES DEPENDS "PH5DIFF-clear-${resultfile}-objects") + SET_TESTS_PROPERTIES (PH5DIFF-${resultfile} PROPERTIES DEPENDS "PH5DIFF-${resultfile}-clear-objects") ENDIF (HDF5_ENABLE_USING_MEMCHECKER) ENDMACRO (ADD_PH5_TEST file) @@ -413,15 +411,14 @@ IF (BUILD_TESTING) # If using memchecker add tests without using scripts IF (NOT HDF5_ENABLE_USING_MEMCHECKER) ADD_TEST ( - NAME H5DIFF-clear-${testname}-objects + NAME H5DIFF-${testname}-clear-objects COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/${testname}.out ./testfiles/${testname}.out.err ) # if there was a previous test IF (NOT "${last_test}" STREQUAL "") - SET_TESTS_PROPERTIES (H5DIFF-clear-${testname}-objects PROPERTIES DEPENDS ${last_test}) + SET_TESTS_PROPERTIES (H5DIFF-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) ENDIF (NOT "${last_test}" STREQUAL "") - SET (last_test "H5DIFF-clear-${testname}-objects") ENDIF (NOT HDF5_ENABLE_USING_MEMCHECKER) ADD_TEST (NAME H5DIFF-${testname} COMMAND $ ${ARGN}) @@ -429,10 +426,13 @@ IF (BUILD_TESTING) SET_TESTS_PROPERTIES (H5DIFF-${testname} PROPERTIES WILL_FAIL "true") ENDIF (NOT ${resultcode} STREQUAL "0") - IF (NOT "${last_test}" STREQUAL "") - SET_TESTS_PROPERTIES (H5DIFF-${testname} PROPERTIES DEPENDS ${last_test}) - ENDIF (NOT "${last_test}" STREQUAL "") - SET (last_test "H5DIFF-${testname}") + IF (HDF5_ENABLE_USING_MEMCHECKER) + IF (NOT "${last_test}" STREQUAL "") + SET_TESTS_PROPERTIES (H5DIFF-${testname} PROPERTIES DEPENDS ${last_test}) + ENDIF (NOT "${last_test}" STREQUAL "") + ELSE (HDF5_ENABLE_USING_MEMCHECKER) + SET_TESTS_PROPERTIES (H5DIFF-${testname} PROPERTIES DEPENDS H5DIFF-${testname}-clear-objects) + ENDIF (HDF5_ENABLE_USING_MEMCHECKER) ENDMACRO (ADD_H5_NO_OUTPUT_TEST) ############################################################################## @@ -1092,13 +1092,13 @@ ADD_H5_TEST (h5diff_704 1 -v2 ${ATTR_VERBOSE_LEVEL_FILE1} ${ATTR_VERBOSE_LEVEL_F 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 0 -v2 ${ATTR_VERBOSE_LEVEL_FILE1} ${ATTR_VERBOSE_LEVEL_FILE2} /ntype) +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 0 -v2 ${ATTR_VERBOSE_LEVEL_FILE1} ${ATTR_VERBOSE_LEVEL_FILE2} /g3) +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) diff --git a/tools/h5diff/Makefile.in b/tools/h5diff/Makefile.in index 4676341..5567ceb 100644 --- a/tools/h5diff/Makefile.in +++ b/tools/h5diff/Makefile.in @@ -241,6 +241,7 @@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ +HAVE_PTHREAD = @HAVE_PTHREAD@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF_CXX = @HDF_CXX@ @@ -292,7 +293,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PARALLEL = @PARALLEL@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ -PTHREAD = @PTHREAD@ RANLIB = @RANLIB@ ROOT = @ROOT@ RUNPARALLEL = @RUNPARALLEL@ diff --git a/tools/h5diff/testfiles/h5diff_706.txt b/tools/h5diff/testfiles/h5diff_706.txt index 38eeac5..5825150 100644 --- a/tools/h5diff/testfiles/h5diff_706.txt +++ b/tools/h5diff/testfiles/h5diff_706.txt @@ -10,4 +10,4 @@ datatype: and x integer1 x integer4 Attributes status: 0 common, 3 only in obj1, 3 only in obj2 -EXIT CODE: 0 +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_708.txt b/tools/h5diff/testfiles/h5diff_708.txt index add386b..a10a8b7 100644 --- a/tools/h5diff/testfiles/h5diff_708.txt +++ b/tools/h5diff/testfiles/h5diff_708.txt @@ -14,4 +14,4 @@ group : and x integer10 x integer3 Attributes status: 0 common, 3 only in obj1, 2 only in obj2 -EXIT CODE: 0 +EXIT CODE: 1 diff --git a/tools/h5dump/CMakeLists.txt b/tools/h5dump/CMakeLists.txt index e1ade89..f5837d4 100644 --- a/tools/h5dump/CMakeLists.txt +++ b/tools/h5dump/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.6) +cmake_minimum_required (VERSION 2.8.10) PROJECT (HDF5_TOOLS_H5DUMP) #----------------------------------------------------------------------------- @@ -139,8 +139,14 @@ IF (BUILD_TESTING) ${HDF5_TOOLS_SRC_DIR}/testfiles/tnestcomp-1.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tnestedcmpddt.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tnbit.ddl + ${HDF5_TOOLS_SRC_DIR}/testfiles/tnoattrdata.ddl + ${HDF5_TOOLS_SRC_DIR}/testfiles/tnoattrddl.ddl + ${HDF5_TOOLS_SRC_DIR}/testfiles/tnodata.ddl + ${HDF5_TOOLS_SRC_DIR}/testfiles/tnoddl.ddl + ${HDF5_TOOLS_SRC_DIR}/testfiles/tnoddlfile.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tno-subset.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tnullspace.ddl + ${HDF5_TOOLS_SRC_DIR}/testfiles/trawdatafile.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/zerodim.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tordergr1.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tordergr2.ddl @@ -184,9 +190,19 @@ IF (BUILD_TESTING) ${HDF5_TOOLS_SRC_DIR}/testfiles/tvlstr.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tvms.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/twidedisplay.ddl + ${HDF5_TOOLS_SRC_DIR}/testfiles/twithddlfile.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/h5dump-help.txt ${HDF5_TOOLS_SRC_DIR}/testfiles/out3.h5import ) + SET (HDF5_REFERENCE_EXP_FILES + tall-6.exp + tnoddlfile.exp + trawdatafile.exp + tstr2bin2.exp + tstr2bin6.exp + twithddl.exp + twithddlfile.exp + ) SET (HDF5_REFERENCE_TEST_FILES ${HDF5_TOOLS_SRC_DIR}/testfiles/charsets.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/file_space.h5 @@ -313,7 +329,7 @@ IF (BUILD_TESTING) # FOREACH (tst_h5_file ${HDF5_REFERENCE_TEST_FILES}) GET_FILENAME_COMPONENT(fname "${tst_h5_file}" NAME) - SET (dest "${PROJECT_BINARY_DIR}/testfiles/${fname}") + SET (dest "${PROJECT_BINARY_DIR}/testfiles/std/${fname}") #MESSAGE (STATUS " Copying ${tst_h5_file}") ADD_CUSTOM_COMMAND ( TARGET h5dump @@ -322,10 +338,24 @@ IF (BUILD_TESTING) ARGS -E copy_if_different ${tst_h5_file} ${dest} ) ENDFOREACH (tst_h5_file ${HDF5_REFERENCE_TEST_FILES}) + + FOREACH (tst_exp_file ${HDF5_REFERENCE_EXP_FILES}) + IF (WIN32 AND NOT CYGWIN) + FILE (READ ${HDF5_TOOLS_SRC_DIR}/testfiles/${tst_exp_file} TEST_STREAM) + FILE (WRITE ${PROJECT_BINARY_DIR}/testfiles/std/${tst_exp_file} "${TEST_STREAM}") + ELSE (WIN32 AND NOT CYGWIN) + ADD_CUSTOM_COMMAND ( + TARGET h5dump + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different ${HDF5_TOOLS_SRC_DIR}/testfiles/${tst_exp_file} ${PROJECT_BINARY_DIR}/testfiles/std/${tst_exp_file} + ) + ENDIF (WIN32 AND NOT CYGWIN) + ENDFOREACH (tst_exp_file ${HDF5_REFERENCE_EXP_FILES}) FOREACH (tst_other_file ${HDF5_REFERENCE_FILES}) GET_FILENAME_COMPONENT(fname "${tst_other_file}" NAME) - SET (dest "${PROJECT_BINARY_DIR}/testfiles/${fname}") + SET (dest "${PROJECT_BINARY_DIR}/testfiles/std/${fname}") #MESSAGE (STATUS " Copying ${tst_other_file}") ADD_CUSTOM_COMMAND ( TARGET h5dump @@ -337,7 +367,7 @@ IF (BUILD_TESTING) FOREACH (tst_error_file ${HDF5_ERROR_REFERENCE_TEST_FILES}) GET_FILENAME_COMPONENT(fname "${tst_error_file}" NAME) - SET (dest "${PROJECT_BINARY_DIR}/testfiles/${fname}") + SET (dest "${PROJECT_BINARY_DIR}/testfiles/std/${fname}") #MESSAGE (STATUS " Copying ${tst_error_file}") ADD_CUSTOM_COMMAND ( TARGET h5dump @@ -347,15 +377,53 @@ IF (BUILD_TESTING) ) ENDFOREACH (tst_error_file ${HDF5_ERROR_REFERENCE_TEST_FILES}) + # -------------------------------------------------------------------- + # Special file handling + # -------------------------------------------------------------------- + ADD_CUSTOM_COMMAND ( + TARGET h5dump + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different ${HDF5_TOOLS_SOURCE_DIR}/testfiles/tbin1.ddl ${PROJECT_BINARY_DIR}/testfiles/std/tbin1LE.ddl + ) + + IF (WIN32 AND NOT CYGWIN) + FILE (READ ${HDF5_TOOLS_SRC_DIR}/testfiles/tbinregR.exp TEST_STREAM) + FILE (WRITE ${PROJECT_BINARY_DIR}/testfiles/std/tbinregR.exp "${TEST_STREAM}") + ELSE (WIN32 AND NOT CYGWIN) + ADD_CUSTOM_COMMAND ( + TARGET h5dump + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different ${HDF5_TOOLS_SRC_DIR}/testfiles/tbinregR.exp ${PROJECT_BINARY_DIR}/testfiles/std/tbinregR.exp + ) + ENDIF (WIN32 AND NOT CYGWIN) + # # copy XML test files from source dir to test dir # SET (HDF5_XML_REFERENCE_TEST_FILES + ${HDF5_TOOLS_SRC_DIR}/testfiles/tall.h5 + ${HDF5_TOOLS_SRC_DIR}/testfiles/tarray1.h5 + ${HDF5_TOOLS_SRC_DIR}/testfiles/tarray2.h5 + ${HDF5_TOOLS_SRC_DIR}/testfiles/tarray3.h5 + ${HDF5_TOOLS_SRC_DIR}/testfiles/tarray6.h5 + ${HDF5_TOOLS_SRC_DIR}/testfiles/tarray7.h5 + ${HDF5_TOOLS_SRC_DIR}/testfiles/tattr.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/tbitfields.h5 + ${HDF5_TOOLS_SRC_DIR}/testfiles/tcompound.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/tcompound2.h5 + ${HDF5_TOOLS_SRC_DIR}/testfiles/tcompound_complex.h5 + ${HDF5_TOOLS_SRC_DIR}/testfiles/tdatareg.h5 + ${HDF5_TOOLS_SRC_DIR}/testfiles/tdset.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/tdset2.h5 + ${HDF5_TOOLS_SRC_DIR}/testfiles/tempty.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/tenum.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/textlink.h5 + ${HDF5_TOOLS_SRC_DIR}/testfiles/tfpformat.h5 + ${HDF5_TOOLS_SRC_DIR}/testfiles/tgroup.h5 + ${HDF5_TOOLS_SRC_DIR}/testfiles/thlink.h5 + ${HDF5_TOOLS_SRC_DIR}/testfiles/tloop.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/tloop2.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/tmany.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/tname-amp.h5 @@ -364,14 +432,28 @@ IF (BUILD_TESTING) ${HDF5_TOOLS_SRC_DIR}/testfiles/tname-lt.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/tname-quot.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/tname-sp.h5 + ${HDF5_TOOLS_SRC_DIR}/testfiles/tnamed_dtype_attr.h5 + ${HDF5_TOOLS_SRC_DIR}/testfiles/tnestedcomp.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/tnodata.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/tobjref.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/topaque.h5 + ${HDF5_TOOLS_SRC_DIR}/testfiles/torderattr.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/tref.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/tref-escapes.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/tref-escapes-at.h5 + ${HDF5_TOOLS_SRC_DIR}/testfiles/tsaf.h5 + ${HDF5_TOOLS_SRC_DIR}/testfiles/tslink.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/tstring.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/tstring-at.h5 + ${HDF5_TOOLS_SRC_DIR}/testfiles/tstr.h5 + ${HDF5_TOOLS_SRC_DIR}/testfiles/tstr2.h5 + ${HDF5_TOOLS_SRC_DIR}/testfiles/tudlink.h5 + ${HDF5_TOOLS_SRC_DIR}/testfiles/tvldtypes1.h5 + ${HDF5_TOOLS_SRC_DIR}/testfiles/tvldtypes2.h5 + ${HDF5_TOOLS_SRC_DIR}/testfiles/tvldtypes3.h5 + ${HDF5_TOOLS_SRC_DIR}/testfiles/tvldtypes4.h5 + ${HDF5_TOOLS_SRC_DIR}/testfiles/tvldtypes5.h5 + ${HDF5_TOOLS_SRC_DIR}/testfiles/tvlstr.h5 ) SET (HDF5_XML_REFERENCE_FILES ${HDF5_TOOLS_SRC_DIR}/testfiles/tall.h5.xml @@ -441,7 +523,7 @@ IF (BUILD_TESTING) FOREACH (tst_xml_h5_file ${HDF5_XML_REFERENCE_TEST_FILES}) GET_FILENAME_COMPONENT(fname "${tst_xml_h5_file}" NAME) - SET (dest "${PROJECT_BINARY_DIR}/testfiles/${fname}") + SET (dest "${PROJECT_BINARY_DIR}/testfiles/xml/${fname}") #MESSAGE (STATUS " Copying ${tst_xml_h5_file}") ADD_CUSTOM_COMMAND ( TARGET h5dump @@ -453,7 +535,7 @@ IF (BUILD_TESTING) FOREACH (tst_xml_other_file ${HDF5_XML_REFERENCE_FILES}) GET_FILENAME_COMPONENT(fname "${tst_xml_other_file}" NAME) - SET (dest "${PROJECT_BINARY_DIR}/testfiles/${fname}") + SET (dest "${PROJECT_BINARY_DIR}/testfiles/xml/${fname}") #MESSAGE (STATUS " Copying ${tst_xml_other_file}") ADD_CUSTOM_COMMAND ( TARGET h5dump @@ -462,28 +544,6 @@ IF (BUILD_TESTING) ARGS -E copy_if_different ${tst_xml_other_file} ${dest} ) ENDFOREACH (tst_xml_other_file ${HDF5_XML_REFERENCE_FILES}) - - # -------------------------------------------------------------------- - # Special file handling - # -------------------------------------------------------------------- - ADD_CUSTOM_COMMAND ( - TARGET h5dump - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${HDF5_TOOLS_SOURCE_DIR}/testfiles/tbin1.ddl ${PROJECT_BINARY_DIR}/testfiles/tbin1LE.ddl - ) - - IF (WIN32 AND NOT CYGWIN) - FILE (READ ${HDF5_TOOLS_SRC_DIR}/testfiles/tbinregR.exp TEST_STREAM) - FILE (WRITE ${PROJECT_BINARY_DIR}/testfiles/tbinregR.exp "${TEST_STREAM}") - ELSE (WIN32 AND NOT CYGWIN) - ADD_CUSTOM_COMMAND ( - TARGET h5dump - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${HDF5_TOOLS_SRC_DIR}/testfiles/tbinregR.exp ${PROJECT_BINARY_DIR}/testfiles/tbinregR.exp - ) - ENDIF (WIN32 AND NOT CYGWIN) # -------------------------------------------------------------------- # Packed Bits @@ -544,6 +604,11 @@ IF (BUILD_TESTING) ${HDF5_TOOLS_SRC_DIR}/testfiles/tpbitsSignedLongLong16.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tpbitsUnsignedLongLong16.ddl ) + SET (HDF5_REFERENCE_TEST_PBITS + ${HDF5_TOOLS_SRC_DIR}/testfiles/packedbits.h5 + ${HDF5_TOOLS_SRC_DIR}/testfiles/tarray1.h5 + ${HDF5_TOOLS_SRC_DIR}/testfiles/tcompound.h5 + ) SET (HDF5_ERROR_REFERENCE_PBITS ${PROJECT_SOURCE_DIR}/errfiles/tnofilename-with-packed-bits.err ${PROJECT_SOURCE_DIR}/errfiles/tpbitsCharLengthExceeded.err @@ -560,9 +625,22 @@ IF (BUILD_TESTING) ${PROJECT_SOURCE_DIR}/errfiles/tpbitsOffsetNegative.err ) + FOREACH (pbits_h5_file ${HDF5_REFERENCE_TEST_PBITS}) + GET_FILENAME_COMPONENT(fname "${pbits_h5_file}" NAME) + SET (dest "${PROJECT_BINARY_DIR}/testfiles/pbits/${fname}") + #MESSAGE (STATUS " Copying ${pbits_h5_file}") + ADD_CUSTOM_COMMAND ( + TARGET h5dump + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different ${pbits_h5_file} ${dest} + ) + ENDFOREACH (pbits_h5_file ${HDF5_REFERENCE_TEST_PBITS}) + + FOREACH (ddl_pbits ${HDF5_REFERENCE_PBITS}) GET_FILENAME_COMPONENT(fname "${ddl_pbits}" NAME) - SET (ddldest "${PROJECT_BINARY_DIR}/testfiles/${fname}") + SET (ddldest "${PROJECT_BINARY_DIR}/testfiles/pbits/${fname}") #MESSAGE (STATUS " Copying ${ddl_pbits}") ADD_CUSTOM_COMMAND ( TARGET h5dump @@ -574,7 +652,7 @@ IF (BUILD_TESTING) FOREACH (ddl_pbits ${HDF5_ERROR_REFERENCE_PBITS}) GET_FILENAME_COMPONENT(fname "${ddl_pbits}" NAME) - SET (ddldest "${PROJECT_BINARY_DIR}/testfiles/${fname}") + SET (ddldest "${PROJECT_BINARY_DIR}/testfiles/pbits/${fname}") #MESSAGE (STATUS " Copying ${ddl_pbits}") ADD_CUSTOM_COMMAND ( TARGET h5dump @@ -594,30 +672,30 @@ IF (BUILD_TESTING) # If using memchecker add tests without using scripts IF (HDF5_ENABLE_USING_MEMCHECKER) ADD_TEST (NAME H5DUMP-${testname} COMMAND $ ${ARGN}) - SET_TESTS_PROPERTIES (H5DUMP-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") + 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-clear-h5dump-${testname}-objects + NAME H5DUMP-h5dump-${testname}-clear-objects COMMAND ${CMAKE_COMMAND} -E remove h5dump-${testname}.out h5dump-${testname}.out.err ) - SET_TESTS_PROPERTIES (H5DUMP-clear-h5dump-${testname}-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") + SET_TESTS_PROPERTIES (H5DUMP-h5dump-${testname}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") ADD_TEST ( NAME H5DUMP-h5dump-${testname} COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" + -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 "${HDF5_RESOURCES_DIR}/runTest.cmake" ) - SET_TESTS_PROPERTIES (H5DUMP-h5dump-${testname} PROPERTIES DEPENDS "H5DUMP-clear-h5dump-${testname}-objects") + SET_TESTS_PROPERTIES (H5DUMP-h5dump-${testname} PROPERTIES DEPENDS "H5DUMP-h5dump-${testname}-clear-objects") ENDIF (HDF5_ENABLE_USING_MEMCHECKER) ENDMACRO (ADD_HELP_TEST) @@ -638,97 +716,184 @@ IF (BUILD_TESTING) # If using memchecker add tests without using scripts IF (HDF5_ENABLE_USING_MEMCHECKER) ADD_TEST (NAME H5DUMP-${resultfile} COMMAND $ ${ARGN}) - SET_TESTS_PROPERTIES (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") + 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 "") - SET (last_test "H5DUMP-${resultfile}") ELSE (HDF5_ENABLE_USING_MEMCHECKER) ADD_TEST ( - NAME H5DUMP-clear-${resultfile}-objects + NAME H5DUMP-${resultfile}-clear-objects COMMAND ${CMAKE_COMMAND} - -E remove ${resultfile}.out ${resultfile}.out.err + -E remove ${resultfile}.bin ${resultfile}.out ${resultfile}.out.err ) - SET_TESTS_PROPERTIES (H5DUMP-clear-${resultfile}-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") + 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=$" -D "TEST_ARGS:STRING=${ARGN}" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std" -D "TEST_OUTPUT=${resultfile}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}.ddl" -P "${HDF5_RESOURCES_DIR}/runTest.cmake" ) - SET_TESTS_PROPERTIES (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-clear-${resultfile}-objects") + 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_EXPORT resultfile targetfile resultcode) + # If using memchecker add tests without using scripts + IF (HDF5_ENABLE_USING_MEMCHECKER) + ADD_TEST (NAME H5DUMP-${resultfile} COMMAND $ ${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 ${resultfile}.out ${resultfile}.out.err + ) + 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=$" + -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 "${HDF5_RESOURCES_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 $ --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 ${resultfile}.out ${resultfile}.out.err + ) + 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=$" + -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 "${HDF5_RESOURCES_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) - ADD_TEST ( - NAME H5DUMP-output-${resultfile} - COMMAND $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile}.txt ${PROJECT_BINARY_DIR}/testfiles/${targetfile} - ) - SET_TESTS_PROPERTIES (H5DUMP-output-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - IF (NOT "${last_test}" STREQUAL "") - SET_TESTS_PROPERTIES (H5DUMP-output-${resultfile} PROPERTIES DEPENDS ${last_test}) - ENDIF (NOT "${last_test}" STREQUAL "") - SET (last_test "H5DUMP-output-${resultfile}") 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 $ ${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 ${PROJECT_BINARY_DIR}/testfiles/${resultfile}.txt ${PROJECT_BINARY_DIR}/testfiles/${resultfile}.exp + -E compare_files ${resultfile}.txt ${resultfile}.exp ) - IF (NOT "${last_test}" STREQUAL "") - SET_TESTS_PROPERTIES (H5DUMP-output-cmp-${resultfile} PROPERTIES DEPENDS ${last_test}) - ENDIF (NOT "${last_test}" STREQUAL "") - SET (last_test "H5DUMP-output-cmp-${resultfile}") + 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-clear-${resultfile}-objects + NAME H5DUMP-${resultfile}-clear-objects COMMAND ${CMAKE_COMMAND} -E remove ${resultfile}.out ${resultfile}.out.err ) - SET_TESTS_PROPERTIES (H5DUMP-clear-${resultfile}-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") + 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=$" -D "TEST_ARGS:STRING=${ARGN}" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" + -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 "${HDF5_RESOURCES_DIR}/runTest.cmake" ) - SET_TESTS_PROPERTIES (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-clear-${resultfile}-objects") + SET_TESTS_PROPERTIES (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-${resultfile}-clear-objects") 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-clear-${resultfile}-objects + NAME H5DUMP-${resultfile}-clear-objects COMMAND ${CMAKE_COMMAND} -E remove ${resultfile}.out ${resultfile}.out.err ) - SET_TESTS_PROPERTIES (H5DUMP-clear-${resultfile}-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") + 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=$" -D "TEST_ARGS:STRING=${ARGN}" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std" -D "TEST_OUTPUT=${resultfile}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}.ddl" @@ -736,10 +901,73 @@ IF (BUILD_TESTING) -D "TEST_MASK_ERROR=true" -P "${HDF5_RESOURCES_DIR}/runTest.cmake" ) - SET_TESTS_PROPERTIES (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-clear-${resultfile}-objects") + SET_TESTS_PROPERTIES (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-${resultfile}-clear-objects") ENDIF (NOT HDF5_ENABLE_USING_MEMCHECKER) ENDMACRO (ADD_H5ERR_MASK_TEST file) + 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 ${conffile}.out ${conffile}.out.err ${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=$" + -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 "${HDF5_RESOURCES_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) + + 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 $ ${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 (NOT ${resultcode} STREQUAL "0") + IF (NOT "${last_pbits_test}" STREQUAL "") + SET_TESTS_PROPERTIES (H5DUMP-${resultfile} PROPERTIES DEPENDS ${last_pbits_test}) + ENDIF (NOT "${last_pbits_test}" STREQUAL "") + ELSE (HDF5_ENABLE_USING_MEMCHECKER) + ADD_TEST ( + NAME H5DUMP-${resultfile}-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove ${resultfile}.out ${resultfile}.out.err + ) + SET_TESTS_PROPERTIES (H5DUMP-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/pbits") + ADD_TEST ( + NAME H5DUMP-${resultfile} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -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 "${HDF5_RESOURCES_DIR}/runTest.cmake" + ) + SET_TESTS_PROPERTIES (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-${resultfile}-clear-objects") + ENDIF (HDF5_ENABLE_USING_MEMCHECKER) + ENDMACRO (ADD_H5_PBITS_TEST file) + MACRO (ADD_XML_SKIP_H5_TEST skipresultfile skipresultcode testtype) IF (${testtype} STREQUAL "SKIP") IF (NOT HDF5_ENABLE_USING_MEMCHECKER) @@ -756,33 +984,32 @@ IF (BUILD_TESTING) MACRO (ADD_XML_H5_TEST resultfile resultcode) IF (HDF5_ENABLE_USING_MEMCHECKER) ADD_TEST (NAME H5DUMP-XML-${resultfile} COMMAND $ --xml ${ARGN}) - SET_TESTS_PROPERTIES (H5DUMP-XML-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") + 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 (NOT ${resultcode} STREQUAL "0") - IF (NOT "${last_test}" STREQUAL "") - SET_TESTS_PROPERTIES (H5DUMP-XML-${resultfile} PROPERTIES DEPENDS ${last_test}) - ENDIF (NOT "${last_test}" STREQUAL "") - SET (last_test "H5DUMP-XML-${resultfile}") + IF (NOT "${last_xml_test}" STREQUAL "") + SET_TESTS_PROPERTIES (H5DUMP-XML-${resultfile} PROPERTIES DEPENDS ${last_xml_test}) + ENDIF (NOT "${last_xml_test}" STREQUAL "") ELSE (HDF5_ENABLE_USING_MEMCHECKER) ADD_TEST ( - NAME H5DUMP-XML-clear-${resultfile}-objects + NAME H5DUMP-XML-${resultfile}-clear-objects COMMAND ${CMAKE_COMMAND} -E remove ${resultfile}.out ${resultfile}.out.err ) - SET_TESTS_PROPERTIES (H5DUMP-XML-clear-${resultfile}-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") + SET_TESTS_PROPERTIES (H5DUMP-XML-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/xml") ADD_TEST ( NAME H5DUMP-XML-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=--xml;${ARGN}" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/xml" -D "TEST_OUTPUT=${resultfile}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}.xml" -P "${HDF5_RESOURCES_DIR}/runTest.cmake" ) - SET_TESTS_PROPERTIES (H5DUMP-XML-${resultfile} PROPERTIES DEPENDS "H5DUMP-XML-clear-${resultfile}-objects") + SET_TESTS_PROPERTIES (H5DUMP-XML-${resultfile} PROPERTIES DEPENDS "H5DUMP-XML-${resultfile}-clear-objects") ENDIF (HDF5_ENABLE_USING_MEMCHECKER) ENDMACRO (ADD_XML_H5_TEST file) @@ -821,6 +1048,7 @@ IF (BUILD_TESTING) tall-4s.out.err tall-5s.out tall-5s.out.err + tall-6.txt tall-6.out tall-6.out.err tallfilters.out @@ -861,6 +1089,8 @@ IF (BUILD_TESTING) tattrreg.out.err tattrregR.out tattrregR.out.err + tbin1LE.bin + tbinregR.txt tbinregR.out tbinregR.out.err tbigdims.out @@ -983,6 +1213,19 @@ IF (BUILD_TESTING) tnestedcmpddt.out.err tnbit.out tnbit.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 + trawdatafile.out + trawdatafile.out.err + trawdatafile.txt tno-subset.out tno-subset.out.err tnullspace.out @@ -1043,6 +1286,8 @@ IF (BUILD_TESTING) tstr-1.out.err tstr-2.out tstr-2.out.err + tstr2bin2.txt + tstr2bin6.txt tstring.out tstring.out.err tstring2.out @@ -1073,8 +1318,12 @@ IF (BUILD_TESTING) tvms.out.err twidedisplay.out twidedisplay.out.err + twithddl.txt + twithddlfile.out + twithddlfile.out.err + twithddlfile.txt ) - SET_TESTS_PROPERTIES (H5DUMP-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") + 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 "") @@ -1083,6 +1332,18 @@ IF (BUILD_TESTING) 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_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) @@ -1332,106 +1593,31 @@ IF (BUILD_TESTING) 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 out1LE.bin -b LE tbinary.h5) + 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 (tbin1 0 --enable-error-stack -d integer -o out1.bin -b tbinary.h5) - IF (NOT "${last_test}" STREQUAL "") - SET_TESTS_PROPERTIES (H5DUMP-tbin1 PROPERTIES DEPENDS ${last_test}) - ENDIF (NOT "${last_test}" STREQUAL "") - SET (last_test "H5DUMP-tbin1") - + ADD_H5_TEST_IMPORT (tbin1 out1D tbinary.h5 0 --enable-error-stack -d integer -b) + IF (NOT HDF5_ENABLE_USING_MEMCHECKER) - ADD_TEST (NAME H5DUMP-clear-out1D COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/out1D.h5) - SET_TESTS_PROPERTIES (H5DUMP-clear-out1D PROPERTIES DEPENDS H5DUMP-tbin1) - ADD_TEST (NAME H5DUMP-h5import-out1D COMMAND h5import out1.bin -c tbin1.out -o out1D.h5) - SET_TESTS_PROPERTIES (H5DUMP-h5import-out1D PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - SET_TESTS_PROPERTIES (H5DUMP-h5import-out1D PROPERTIES DEPENDS H5DUMP-clear-out1D) - ADD_TEST (NAME H5DUMP-h5diff-out1D COMMAND h5diff tbinary.h5 out1D.h5 /integer /integer) - SET_TESTS_PROPERTIES (H5DUMP-h5diff-out1D PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - SET_TESTS_PROPERTIES (H5DUMP-h5diff-out1D PROPERTIES DEPENDS H5DUMP-h5import-out1D) - SET (last_test "H5DUMP-h5diff-out1D") - ENDIF (NOT HDF5_ENABLE_USING_MEMCHECKER) - - ADD_TEST (NAME H5DUMP-clear-out1 COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/out1.h5) - IF (NOT "${last_test}" STREQUAL "") - SET_TESTS_PROPERTIES (H5DUMP-clear-out1 PROPERTIES DEPENDS ${last_test}) - ENDIF (NOT "${last_test}" STREQUAL "") - ADD_TEST (NAME H5DUMP-h5import-out1 COMMAND h5import out1.bin -c out3.h5import -o out1.h5) - SET_TESTS_PROPERTIES (H5DUMP-h5import-out1 PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - SET_TESTS_PROPERTIES (H5DUMP-h5import-out1 PROPERTIES DEPENDS H5DUMP-clear-out1) - ADD_TEST (NAME H5DUMP-h5diff-out1 COMMAND h5diff tbinary.h5 out1.h5 /integer /integer) - SET_TESTS_PROPERTIES (H5DUMP-h5diff-out1 PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - SET_TESTS_PROPERTIES (H5DUMP-h5diff-out1 PROPERTIES DEPENDS H5DUMP-h5import-out1) - SET (last_test "H5DUMP-h5diff-out1") - - ADD_H5_TEST (tbin2 0 --enable-error-stack -b BE -d float -o out2.bin tbinary.h5) - IF (NOT HDF5_ENABLE_USING_MEMCHECKER) - IF (NOT "${last_test}" STREQUAL "") - SET_TESTS_PROPERTIES (H5DUMP-tbin2 PROPERTIES DEPENDS ${last_test}) - ENDIF (NOT "${last_test}" STREQUAL "") - SET (last_test "H5DUMP-tbin2") + ADD_TEST (NAME H5DUMP-tbin2-bin-clear-objects COMMAND ${CMAKE_COMMAND} -E remove out2.bin) + SET_TESTS_PROPERTIES (H5DUMP-tbin2-bin-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") + ADD_H5_TEST (tbin2 0 --enable-error-stack -b BE -d float -o out2.bin tbinary.h5) + SET_TESTS_PROPERTIES (H5DUMP-tbin2 PROPERTIES DEPENDS H5DUMP-tbin2-bin-clear-objects) ENDIF (NOT HDF5_ENABLE_USING_MEMCHECKER) # the NATIVE test can be validated with h5import/h5diff - ADD_H5_TEST (tbin3 0 --enable-error-stack -d integer -o out3.bin -b NATIVE tbinary.h5) - IF (NOT "${last_test}" STREQUAL "") - SET_TESTS_PROPERTIES (H5DUMP-tbin3 PROPERTIES DEPENDS ${last_test}) - ENDIF (NOT "${last_test}" STREQUAL "") - SET (last_test "H5DUMP-tbin3") - - IF (NOT HDF5_ENABLE_USING_MEMCHECKER) - ADD_TEST (NAME H5DUMP-clear-out3D COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/out3D.h5) - SET_TESTS_PROPERTIES (H5DUMP-clear-out3D PROPERTIES DEPENDS H5DUMP-tbin3) - ADD_TEST (NAME H5DUMP-h5import-out3D COMMAND h5import out3.bin -c tbin3.out -o out3D.h5) - SET_TESTS_PROPERTIES (H5DUMP-h5import-out3D PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - SET_TESTS_PROPERTIES (H5DUMP-h5import-out3D PROPERTIES DEPENDS H5DUMP-clear-out3D) - ADD_TEST (NAME H5DUMP-h5diff-out3D COMMAND h5diff tbinary.h5 out3D.h5 /integer /integer -q) - SET_TESTS_PROPERTIES (H5DUMP-h5diff-out3D PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - SET_TESTS_PROPERTIES (H5DUMP-h5diff-out3D PROPERTIES DEPENDS H5DUMP-h5import-out3D) - SET (last_test "H5DUMP-h5diff-out3D") - ENDIF (NOT HDF5_ENABLE_USING_MEMCHECKER) - - ADD_TEST (NAME H5DUMP-clear-out3 COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/out3.h5) - IF (NOT "${last_test}" STREQUAL "") - SET_TESTS_PROPERTIES (H5DUMP-clear-out3 PROPERTIES DEPENDS ${last_test}) - ENDIF (NOT "${last_test}" STREQUAL "") - ADD_TEST (NAME H5DUMP-h5import-out3 COMMAND h5import out3.bin -c out3.h5import -o out3.h5) - SET_TESTS_PROPERTIES (H5DUMP-h5import-out3 PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - SET_TESTS_PROPERTIES (H5DUMP-h5import-out3 PROPERTIES DEPENDS H5DUMP-clear-out3) - ADD_TEST (NAME H5DUMP-h5diff-out3 COMMAND h5diff tbinary.h5 out3.h5 /integer /integer -q) - SET_TESTS_PROPERTIES (H5DUMP-h5diff-out3 PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - SET_TESTS_PROPERTIES (H5DUMP-h5diff-out3 PROPERTIES DEPENDS H5DUMP-h5import-out3) - SET (last_test "H5DUMP-h5diff-out3") - - ADD_H5_TEST (tbin4 0 --enable-error-stack -d double -b FILE -o out4.bin tbinary.h5) + ADD_H5_TEST_IMPORT (tbin3 out3D tbinary.h5 0 --enable-error-stack -d integer -b NATIVE) + IF (NOT HDF5_ENABLE_USING_MEMCHECKER) - IF (NOT "${last_test}" STREQUAL "") - SET_TESTS_PROPERTIES (H5DUMP-tbin4 PROPERTIES DEPENDS ${last_test}) - ENDIF (NOT "${last_test}" STREQUAL "") - SET (last_test "H5DUMP-tbin4") + ADD_TEST (NAME H5DUMP-tbin4-bin-clear-objects COMMAND ${CMAKE_COMMAND} -E remove out4.bin) + SET_TESTS_PROPERTIES (H5DUMP-tbin4-bin-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") + ADD_H5_TEST (tbin4 0 --enable-error-stack -d double -b FILE -o out4.bin tbinary.h5) + SET_TESTS_PROPERTIES (H5DUMP-tbin4 PROPERTIES DEPENDS H5DUMP-tbin4-bin-clear-objects) ENDIF (NOT HDF5_ENABLE_USING_MEMCHECKER) - - # Clean up binary output files - IF (NOT HDF5_NOCLEANUP) - ADD_TEST ( - NAME H5DUMP-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - out1.bin - out1LE.bin - out2.bin - out3.bin - out4.bin - out1.h5 - out3.h5 - ) - SET_TESTS_PROPERTIES (H5DUMP-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - IF (NOT "${last_test}" STREQUAL "") - SET_TESTS_PROPERTIES (H5DUMP-clear-objects PROPERTIES DEPENDS ${last_test}) - ENDIF (NOT "${last_test}" STREQUAL "") - SET (last_test "H5DUMP-clear-objects") - ENDIF (NOT HDF5_NOCLEANUP) # test for dataset region references ADD_H5_TEST (tdatareg 0 --enable-error-stack tdatareg.h5) @@ -1471,7 +1657,7 @@ IF (BUILD_TESTING) ADD_H5ERR_MASK_TEST (filter_fail 1 --enable-error-stack filter_fail.h5) # test for -o -y for dataset with attributes - ADD_H5_TEST (tall-6 0 --enable-error-stack -y -o data -d /g1/g1.1/dset1.1.1 tall.h5) + ADD_H5_TEST_EXPORT (tall-6 tall.h5 0 --enable-error-stack -d /g1/g1.1/dset1.1.1 -y -o) ####### test for dataset packed bits ###### IF (HDF5_ENABLE_USING_MEMCHECKER) @@ -1587,16 +1773,16 @@ IF (BUILD_TESTING) tpbitsUnsignedLongLong16.out tpbitsUnsignedLongLong16.out.err ) - SET_TESTS_PROPERTIES (H5DUMP_PACKED_BITS-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - IF (NOT "${last_test}" STREQUAL "") - SET_TESTS_PROPERTIES (H5DUMP_PACKED_BITS-clearall-objects PROPERTIES DEPENDS ${last_test}) - ENDIF (NOT "${last_test}" STREQUAL "") - SET (last_test "H5DUMP_PACKED_BITS-clearall-objects") + 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_TEST (tnofilename-with-packed-bits 1 --enable-error-stack) + 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). @@ -1606,72 +1792,72 @@ IF (BUILD_TESTING) # Normal operation on both signed and unsigned int datasets. # Sanity check # Their rawdata output should be the same. - ADD_H5_TEST (tpbitsSignedWhole 0 --enable-error-stack -d /DS08BITS -M 0,8 packedbits.h5) - ADD_H5_TEST (tpbitsUnsignedWhole 0 --enable-error-stack -d /DU08BITS -M 0,8 packedbits.h5) - ADD_H5_TEST (tpbitsSignedIntWhole 0 --enable-error-stack -d /DS16BITS -M 0,16 packedbits.h5) - ADD_H5_TEST (tpbitsUnsignedIntWhole 0 --enable-error-stack -d /DU16BITS -M 0,16 packedbits.h5) - ADD_H5_TEST (tpbitsSignedLongWhole 0 --enable-error-stack -d /DS32BITS -M 0,32 packedbits.h5) - ADD_H5_TEST (tpbitsUnsignedLongWhole 0 --enable-error-stack -d /DU32BITS -M 0,32 packedbits.h5) - ADD_H5_TEST (tpbitsSignedLongLongWhole 0 --enable-error-stack -d /DS64BITS -M 0,64 packedbits.h5) - ADD_H5_TEST (tpbitsUnsignedLongLongWhole 0 --enable-error-stack -d /DU64BITS -M 0,64 packedbits.h5) - ADD_H5_TEST (tpbitsSignedLongLongWhole63 0 --enable-error-stack -d /DS64BITS -M 0,63 packedbits.h5) - ADD_H5_TEST (tpbitsUnsignedLongLongWhole63 0 --enable-error-stack -d /DU64BITS -M 0,63 packedbits.h5) - ADD_H5_TEST (tpbitsSignedLongLongWhole1 0 --enable-error-stack -d /DS64BITS -M 1,63 packedbits.h5) - ADD_H5_TEST (tpbitsUnsignedLongLongWhole1 0 --enable-error-stack -d /DU64BITS -M 1,63 packedbits.h5) + 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_TEST (tpbitsSigned4 0 --enable-error-stack -d /DS08BITS -M 0,4,4,4 packedbits.h5) - ADD_H5_TEST (tpbitsUnsigned4 0 --enable-error-stack -d /DU08BITS -M 0,4,4,4 packedbits.h5) - ADD_H5_TEST (tpbitsSignedInt8 0 --enable-error-stack -d /DS16BITS -M 0,8,8,8 packedbits.h5) - ADD_H5_TEST (tpbitsUnsignedInt8 0 --enable-error-stack -d /DU16BITS -M 0,8,8,8 packedbits.h5) - ADD_H5_TEST (tpbitsSignedLong16 0 --enable-error-stack -d /DS32BITS -M 0,16,16,16 packedbits.h5) - ADD_H5_TEST (tpbitsUnsignedLong16 0 --enable-error-stack -d /DU32BITS -M 0,16,16,16 packedbits.h5) - ADD_H5_TEST (tpbitsSignedLongLong32 0 --enable-error-stack -d /DS64BITS -M 0,32,32,32 packedbits.h5) - ADD_H5_TEST (tpbitsUnsignedLongLong32 0 --enable-error-stack -d /DU64BITS -M 0,32,32,32 packedbits.h5) + 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_TEST (tpbitsSigned2 0 --enable-error-stack -d /DS08BITS -M 0,2,2,2,4,2,6,2 packedbits.h5) - ADD_H5_TEST (tpbitsUnsigned2 0 --enable-error-stack -d /DU08BITS -M 0,2,2,2,4,2,6,2 packedbits.h5) - ADD_H5_TEST (tpbitsSignedInt4 0 --enable-error-stack -d /DS16BITS -M 0,4,4,4,8,4,12,4 packedbits.h5) - ADD_H5_TEST (tpbitsUnsignedInt4 0 --enable-error-stack -d /DU16BITS -M 0,4,4,4,8,4,12,4 packedbits.h5) - ADD_H5_TEST (tpbitsSignedLong8 0 --enable-error-stack -d /DS32BITS -M 0,8,8,8,16,8,24,8 packedbits.h5) - ADD_H5_TEST (tpbitsUnsignedLong8 0 --enable-error-stack -d /DU32BITS -M 0,8,8,8,16,8,24,8 packedbits.h5) - ADD_H5_TEST (tpbitsSignedLongLong16 0 --enable-error-stack -d /DS64BITS -M 0,16,16,16,32,16,48,16 packedbits.h5) - ADD_H5_TEST (tpbitsUnsignedLongLong16 0 --enable-error-stack -d /DU64BITS -M 0,16,16,16,32,16,48,16 packedbits.h5) + 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_TEST (tpbitsSigned 0 --enable-error-stack -d /DS08BITS -M 0,2,2,6 packedbits.h5) - ADD_H5_TEST (tpbitsUnsigned 0 --enable-error-stack -d /DU08BITS -M 0,2,2,6 packedbits.h5) - ADD_H5_TEST (tpbitsSignedInt 0 --enable-error-stack -d /DS16BITS -M 0,2,10,6 packedbits.h5) - ADD_H5_TEST (tpbitsUnsignedInt 0 --enable-error-stack -d /DU16BITS -M 0,2,10,6 packedbits.h5) - ADD_H5_TEST (tpbitsSignedLong 0 --enable-error-stack -d /DS32BITS -M 0,2,26,6 packedbits.h5) - ADD_H5_TEST (tpbitsUnsignedLong 0 --enable-error-stack -d /DU32BITS -M 0,2,26,6 packedbits.h5) - ADD_H5_TEST (tpbitsSignedLongLong 0 --enable-error-stack -d /DS64BITS -M 0,2,58,6 packedbits.h5) - ADD_H5_TEST (tpbitsUnsignedLongLong 0 --enable-error-stack -d /DU64BITS -M 0,2,58,6 packedbits.h5) + 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_TEST (tpbitsOverlapped 0 --enable-error-stack -d /DS08BITS -M 0,1,1,1,2,1,0,3 packedbits.h5) + 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_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) + 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_TEST (tpbitsCompound 0 --enable-error-stack -d /dset1 -M 0,1,1,1 tcompound.h5) + ADD_H5_PBITS_TEST (tpbitsCompound 0 --enable-error-stack -d /dset1 -M 0,1,1,1 tcompound.h5) # Array type. - ADD_H5_TEST (tpbitsArray 0 --enable-error-stack -d /Dataset1 -M 0,1,1,1 tarray1.h5) + 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_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) + 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_TEST (tpbitsOffsetExceeded 1 --enable-error-stack -d /DS08BITS -M 64,1 packedbits.h5) - ADD_H5_TEST (tpbitsCharOffsetExceeded 0 --enable-error-stack -d /DS08BITS -M 8,1 packedbits.h5) - ADD_H5_TEST (tpbitsIntOffsetExceeded 0 --enable-error-stack -d /DS16BITS -M 16,1 packedbits.h5) - ADD_H5_TEST (tpbitsLongOffsetExceeded 0 --enable-error-stack -d /DS32BITS -M 32,1 packedbits.h5) + 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_TEST (tpbitsOffsetNegative 1 --enable-error-stack -d /DS08BITS -M -1,1 packedbits.h5) + ADD_H5_PBITS_TEST (tpbitsOffsetNegative 1 --enable-error-stack -d /DS08BITS -M -1,1 packedbits.h5) # Bad length, must not be positive. - ADD_H5_TEST (tpbitsLengthPositive 1 --enable-error-stack -d /DS08BITS -M 4,0 packedbits.h5) + 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_TEST (tpbitsLengthExceeded 1 --enable-error-stack -d /DS08BITS -M 37,28 packedbits.h5) - ADD_H5_TEST (tpbitsCharLengthExceeded 0 --enable-error-stack -d /DS08BITS -M 2,7 packedbits.h5) - ADD_H5_TEST (tpbitsIntLengthExceeded 0 --enable-error-stack -d /DS16BITS -M 10,7 packedbits.h5) - ADD_H5_TEST (tpbitsLongLengthExceeded 0 --enable-error-stack -d /DS32BITS -M 26,7 packedbits.h5) + 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_TEST (tpbitsIncomplete 1 --enable-error-stack -d /DS08BITS -M 0,2,2,1,0,2,2, packedbits.h5) + ADD_H5_PBITS_TEST (tpbitsIncomplete 1 --enable-error-stack -d /DS08BITS -M 0,2,2,1,0,2,2, packedbits.h5) IF (HDF5_ENABLE_USING_MEMCHECKER) # Remove any output file left over from previous test run @@ -1808,10 +1994,10 @@ IF (BUILD_TESTING) tvlstr.h5.out tvlstr.h5.out.err ) - SET_TESTS_PROPERTIES (H5DUMP-XML-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - IF (NOT "${last_test}" STREQUAL "") - SET_TESTS_PROPERTIES (H5DUMP-XML-clearall-objects PROPERTIES DEPENDS ${last_test}) - ENDIF (NOT "${last_test}" STREQUAL "") + 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) diff --git a/tools/h5dump/Makefile.in b/tools/h5dump/Makefile.in index 6b4a6e6..4741683 100644 --- a/tools/h5dump/Makefile.in +++ b/tools/h5dump/Makefile.in @@ -240,6 +240,7 @@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ +HAVE_PTHREAD = @HAVE_PTHREAD@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF_CXX = @HDF_CXX@ @@ -291,7 +292,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PARALLEL = @PARALLEL@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ -PTHREAD = @PTHREAD@ RANLIB = @RANLIB@ ROOT = @ROOT@ RUNPARALLEL = @RUNPARALLEL@ diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index 34b8bc4..d89202c 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -71,7 +71,7 @@ struct handler_t { */ /* 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:Aq:z:m:RECM:"; +static const char *s_opts = "hn*peyBHirVa:c:d:f:g:k:l:t:w:xD:uX:o*b*F:s:S:Aq:z:m:RECM:O*"; static struct long_options l_opts[] = { { "help", no_arg, 'h' }, { "hel", no_arg, 'h' }, @@ -139,11 +139,11 @@ static struct long_options l_opts[] = { { "grou", require_arg, 'g' }, { "gro", require_arg, 'g' }, { "gr", require_arg, 'g' }, - { "output", require_arg, 'o' }, - { "outpu", require_arg, 'o' }, - { "outp", require_arg, 'o' }, - { "out", require_arg, 'o' }, - { "ou", require_arg, 'o' }, + { "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' }, @@ -187,6 +187,7 @@ static struct long_options l_opts[] = { { "enable-error-stack", no_arg, 'E' }, { "packed-bits", require_arg, 'M' }, { "no-compact-subset", no_arg, 'C' }, + { "ddl", optional_arg, 'O' }, { NULL, 0, '\0' } }; @@ -230,39 +231,39 @@ leave(int ret) static void usage(const char *prog) { - HDfflush(rawoutstream); - HDfprintf(rawoutstream, "usage: %s [OPTIONS] files\n", prog); - HDfprintf(rawoutstream, " OPTIONS\n"); - HDfprintf(rawoutstream, " -h, --help Print a usage message and exit\n"); - HDfprintf(rawoutstream, " -n, --contents Print a list of the file contents and exit\n"); - HDfprintf(rawoutstream, " Optional value 1 also prints attributes.\n"); - HDfprintf(rawoutstream, " -B, --superblock Print the content of the super block\n"); - HDfprintf(rawoutstream, " -H, --header Print the header only; no data is displayed\n"); - HDfprintf(rawoutstream, " -A, --onlyattr Print the header and value of attributes\n"); - HDfprintf(rawoutstream, " -i, --object-ids Print the object ids\n"); - HDfprintf(rawoutstream, " -r, --string Print 1-byte integer datasets as ASCII\n"); - HDfprintf(rawoutstream, " -e, --escape Escape non printing characters\n"); - HDfprintf(rawoutstream, " -V, --version Print version number and exit\n"); - HDfprintf(rawoutstream, " -a P, --attribute=P Print the specified attribute\n"); - HDfprintf(rawoutstream, " If an attribute name contains a slash (/), escape the\n"); - HDfprintf(rawoutstream, " slash with a preceding backslash (\\).\n"); - HDfprintf(rawoutstream, " (See example section below.)\n"); - HDfprintf(rawoutstream, " -d P, --dataset=P Print the specified dataset\n"); - HDfprintf(rawoutstream, " -y, --noindex Do not print array indices with the data\n"); - HDfprintf(rawoutstream, " -p, --properties Print dataset filters, storage layout and fill value\n"); - HDfprintf(rawoutstream, " -f D, --filedriver=D Specify which driver to open the file with\n"); - HDfprintf(rawoutstream, " -g P, --group=P Print the specified group and all members\n"); - HDfprintf(rawoutstream, " -l P, --soft-link=P Print the value(s) of the specified soft link\n"); - HDfprintf(rawoutstream, " -o F, --output=F Output raw data into file F\n"); - HDfprintf(rawoutstream, " -b B, --binary=B Binary file output, of form B\n"); - HDfprintf(rawoutstream, " -t P, --datatype=P Print the specified named datatype\n"); - HDfprintf(rawoutstream, " -w N, --width=N Set the number of columns of output. A value of 0 (zero)\n"); - HDfprintf(rawoutstream, " sets the number of columns to the maximum (65535).\n"); - HDfprintf(rawoutstream, " Default width is 80 columns.\n"); - HDfprintf(rawoutstream, " -m T, --format=T Set the floating point output format\n"); - HDfprintf(rawoutstream, " -q Q, --sort_by=Q Sort groups and attributes by index Q\n"); - HDfprintf(rawoutstream, " -z Z, --sort_order=Z Sort groups and attributes by order Z\n"); - HDfprintf(rawoutstream, + 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, " -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, " -A, --onlyattr Print the header and value of attributes\n"); + PRINTVALSTREAM(rawoutstream, " -i, --object-ids Print the object ids\n"); + PRINTVALSTREAM(rawoutstream, " -r, --string Print 1-byte integer datasets as ASCII\n"); + PRINTVALSTREAM(rawoutstream, " -e, --escape Escape non printing characters\n"); + PRINTVALSTREAM(rawoutstream, " -V, --version Print version number and exit\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, " -y, --noindex Do not print array indices with the data\n"); + PRINTVALSTREAM(rawoutstream, " -p, --properties Print dataset filters, storage layout and fill value\n"); + PRINTVALSTREAM(rawoutstream, " -f D, --filedriver=D Specify which driver to open the file with\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, " -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, " -t P, --datatype=P Print the specified named datatype\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, " -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, " -M L, --packedbits=L Print packed bits as unsigned integers, using mask\n" " format L for an integer dataset specified with\n" " option -d. L is a list of offset,length values,\n" @@ -270,92 +271,94 @@ usage(const char *prog) " the data value and length is the number of bits of\n" " the mask.\n" ); - HDfprintf(rawoutstream, " -R, --region Print dataset pointed by region references\n"); - HDfprintf(rawoutstream, " -x, --xml Output in XML using Schema\n"); - HDfprintf(rawoutstream, " -u, --use-dtd Output in XML using DTD\n"); - HDfprintf(rawoutstream, " -D U, --xml-dtd=U Use the DTD or schema at U\n"); - HDfprintf(rawoutstream, " -X S, --xml-ns=S (XML Schema) Use qualified names n the XML\n"); - HDfprintf(rawoutstream, " \":\": no namespace, default: \"hdf5:\"\n"); - HDfprintf(rawoutstream, " E.g., to dump a file called `-f', use h5dump -- -f\n"); - HDfprintf(rawoutstream, " --enable-error-stack Prints messages from the HDF5 error stack as they\n"); - HDfprintf(rawoutstream, " occur.\n"); - HDfprintf(rawoutstream, " --no-compact-subset Disable compact form of subsetting and allow the use\n"); - HDfprintf(rawoutstream, " of \"[\" in dataset names.\n"); - HDfprintf(rawoutstream, "\n"); - HDfprintf(rawoutstream, " Subsetting is available by using the following options with a dataset\n"); - HDfprintf(rawoutstream, " attribute. Subsetting is done by selecting a hyperslab from the data.\n"); - HDfprintf(rawoutstream, " Thus, the options mirror those for performing a hyperslab selection.\n"); - HDfprintf(rawoutstream, " One of the START, COUNT, STRIDE, or BLOCK parameters are mandatory if you do subsetting.\n"); - HDfprintf(rawoutstream, " The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 in\n"); - HDfprintf(rawoutstream, " each dimension. START is optional and will default to 0 in each dimension.\n"); - HDfprintf(rawoutstream, "\n"); - HDfprintf(rawoutstream, " -s START, --start=START Offset of start of subsetting selection\n"); - HDfprintf(rawoutstream, " -S STRIDE, --stride=STRIDE Hyperslab stride\n"); - HDfprintf(rawoutstream, " -c COUNT, --count=COUNT Number of blocks to include in selection\n"); - HDfprintf(rawoutstream, " -k BLOCK, --block=BLOCK Size of block in hyperslab\n"); - HDfprintf(rawoutstream, " START, COUNT, STRIDE, and BLOCK - is a list of integers the number of which are equal to the\n"); - HDfprintf(rawoutstream, " number of dimensions in the dataspace being queried\n"); - HDfprintf(rawoutstream, " (Alternate compact form of subsetting is described in the Reference Manual)\n"); - HDfprintf(rawoutstream, "\n"); - HDfprintf(rawoutstream, " D - is the file driver to use in opening the file. Acceptable values\n"); - HDfprintf(rawoutstream, " are \"sec2\", \"family\", \"split\", \"multi\", \"direct\", and \"stream\". Without\n"); - HDfprintf(rawoutstream, " the file driver flag, the file will be opened with each driver in\n"); - HDfprintf(rawoutstream, " turn and in the order specified above until one driver succeeds\n"); - HDfprintf(rawoutstream, " in opening the file.\n"); - HDfprintf(rawoutstream, " These are the letters that are appended to the file name(without .h5) when opening\n"); - HDfprintf(rawoutstream, " names for the split(m,r) and multi(s,b,r,g,l,o) drivers. They are:\n"); - HDfprintf(rawoutstream, " m: All meta data when using the split driver.\n"); - HDfprintf(rawoutstream, " s: The userblock, superblock, and driver info block\n"); - HDfprintf(rawoutstream, " b: B-tree nodes\n"); - HDfprintf(rawoutstream, " r: Dataset raw data\n"); - HDfprintf(rawoutstream, " g: Global heap\n"); - HDfprintf(rawoutstream, " l: local heap (object names)\n"); - HDfprintf(rawoutstream, " o: object headers\n"); - HDfprintf(rawoutstream, "\n"); - HDfprintf(rawoutstream, " F - is a filename.\n"); - HDfprintf(rawoutstream, " P - is the full path from the root group to the object.\n"); - HDfprintf(rawoutstream, " N - is an integer greater than 1.\n"); - HDfprintf(rawoutstream, " T - is a string containing the floating point format, e.g '%%.3f'\n"); - HDfprintf(rawoutstream, " U - is a URI reference (as defined in [IETF RFC 2396],\n"); - HDfprintf(rawoutstream, " updated by [IETF RFC 2732])\n"); - HDfprintf(rawoutstream, " B - is the form of binary output: NATIVE for a memory type, FILE for the\n"); - HDfprintf(rawoutstream, " file type, LE or BE for pre-existing little or big endian types.\n"); - HDfprintf(rawoutstream, " Must be used with -o (output file) and it is recommended that\n"); - HDfprintf(rawoutstream, " -d (dataset) is used. B is an optional argument, defaults to NATIVE\n"); - HDfprintf(rawoutstream, " Q - is the sort index type. It can be \"creation_order\" or \"name\" (default)\n"); - HDfprintf(rawoutstream, " Z - is the sort order type. It can be \"descending\" or \"ascending\" (default)\n"); - HDfprintf(rawoutstream, "\n"); - HDfprintf(rawoutstream, " Examples:\n"); - HDfprintf(rawoutstream, "\n"); - HDfprintf(rawoutstream, " 1) Attribute foo of the group /bar_none in file quux.h5\n"); - HDfprintf(rawoutstream, "\n"); - HDfprintf(rawoutstream, " h5dump -a /bar_none/foo quux.h5\n"); - HDfprintf(rawoutstream, "\n"); - HDfprintf(rawoutstream, " Attribute \"high/low\" of the group /bar_none in the file quux.h5\n"); - HDfprintf(rawoutstream, "\n"); - HDfprintf(rawoutstream, " h5dump -a \"/bar_none/high\\/low\" quux.h5\n"); - HDfprintf(rawoutstream, "\n"); - HDfprintf(rawoutstream, " 2) Selecting a subset from dataset /foo in file quux.h5\n"); - HDfprintf(rawoutstream, "\n"); - HDfprintf(rawoutstream, " h5dump -d /foo -s \"0,1\" -S \"1,1\" -c \"2,3\" -k \"2,2\" quux.h5\n"); - HDfprintf(rawoutstream, "\n"); - HDfprintf(rawoutstream, " 3) Saving dataset 'dset' in file quux.h5 to binary file 'out.bin'\n"); - HDfprintf(rawoutstream, " using a little-endian type\n"); - HDfprintf(rawoutstream, "\n"); - HDfprintf(rawoutstream, " h5dump -d /dset -b LE -o out.bin quux.h5\n"); - HDfprintf(rawoutstream, "\n"); - HDfprintf(rawoutstream, " 4) Display two packed bits (bits 0-1 and bits 4-6) in the dataset /dset\n"); - HDfprintf(rawoutstream, "\n"); - HDfprintf(rawoutstream, " h5dump -d /dset -M 0,1,4,3 quux.h5\n"); - HDfprintf(rawoutstream, "\n"); - HDfprintf(rawoutstream, " 5) Dataset foo in files file1.h5 file2.h5 file3.h5\n"); - HDfprintf(rawoutstream, "\n"); - HDfprintf(rawoutstream, " h5dump -d /foo file1.h5 file2.h5 file3.h5\n"); - HDfprintf(rawoutstream, "\n"); - HDfprintf(rawoutstream, " 6) Dataset foo in split files splitfile-m.h5 splitfile-r.h5\n"); - HDfprintf(rawoutstream, "\n"); - HDfprintf(rawoutstream, " h5dump -d /foo -f split splitfile\n"); - HDfprintf(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, " -R, --region Print dataset pointed by region references\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, " --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, " -O F, --ddl=F Output ddl text into file F\n"); + PRINTVALSTREAM(rawoutstream, " Do not use filename F to suppress ddl display\n"); + PRINTVALSTREAM(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, " Subsetting is available by using the following options with a dataset\n"); + PRINTVALSTREAM(rawoutstream, " attribute. 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, " 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, " These are the letters that are appended to the file name(without .h5) when opening\n"); + PRINTVALSTREAM(rawoutstream, " names for the split(m,r) and multi(s,b,r,g,l,o) drivers. They are:\n"); + PRINTVALSTREAM(rawoutstream, " m: All meta data when using the split driver.\n"); + PRINTVALSTREAM(rawoutstream, " s: The userblock, superblock, and driver info block\n"); + PRINTVALSTREAM(rawoutstream, " b: B-tree nodes\n"); + PRINTVALSTREAM(rawoutstream, " r: Dataset raw data\n"); + PRINTVALSTREAM(rawoutstream, " g: Global heap\n"); + PRINTVALSTREAM(rawoutstream, " l: local heap (object names)\n"); + PRINTVALSTREAM(rawoutstream, " o: object headers\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"); } @@ -500,6 +503,7 @@ table_list_free(void) static int set_data_output_file(const char *fname, int is_bin) { + int retvalue = FAIL; FILE *f; /* temporary holding place for the stream pointer * so that rawdatastream is changed only when succeeded */ @@ -510,21 +514,68 @@ set_data_output_file(const char *fname, int is_bin) rawdatastream = NULL; } - /* binary output */ - if (is_bin) { - if ((f = HDfopen(fname, "wb")) != NULL) { - rawdatastream = f; - return 0; + /* First check if filename is string "NULL" */ + if (fname != NULL) { + /* binary output */ + if (is_bin) { + if ((f = HDfopen(fname, "wb")) != NULL) { + rawdatastream = f; + retvalue = SUCCEED; + } + } + else { + if ((f = HDfopen(fname, "w")) != NULL) { + rawdatastream = f; + retvalue = SUCCEED; + } } } else { + rawdatastream = NULL; + retvalue = SUCCEED; + } + + return retvalue; +} + +/*------------------------------------------------------------------------- + * Function: set_attr_output_file + * + * Purpose: Open fname as the output file for attribute raw data. + * Set rawattrstream as its file stream. + * + * Return: 0 -- succeeded + * negative -- failed + * + *------------------------------------------------------------------------- + */ +static int +set_attr_output_file(const char *fname, int is_bin) +{ + int retvalue = FAIL; + FILE *f; /* temporary holding place for the stream pointer + * so that rawattrstream is changed only when succeeded */ + + if (rawattrstream && rawattrstream != stdout) { + if (HDfclose(rawattrstream)) + HDperror("closing rawattrstream"); + else + rawattrstream = NULL; + } + + /* First check if filename is string "NULL" */ + if (fname != NULL) { if ((f = HDfopen(fname, "w")) != NULL) { - rawdatastream = f; - return 0; + rawattrstream = f; + retvalue = SUCCEED; } } + else { + rawattrstream = NULL; + retvalue = SUCCEED; + } - return -1; + return retvalue; } /*------------------------------------------------------------------------- @@ -541,6 +592,7 @@ set_data_output_file(const char *fname, int is_bin) static int set_output_file(const char *fname) { + int retvalue = FAIL; FILE *f; /* temporary holding place for the stream pointer * so that rawoutstream is changed only when succeeded */ @@ -550,13 +602,19 @@ set_output_file(const char *fname) else rawoutstream = NULL; } - - if ((f = HDfopen(fname, "w")) != NULL) { - rawoutstream = f; - return 0; + /* First check if filename is string "NULL" */ + if (fname != NULL) { + if ((f = HDfopen(fname, "w")) != NULL) { + rawoutstream = f; + retvalue = SUCCEED; + } + } + else { + rawoutstream = NULL; + retvalue = SUCCEED; } - return -1; + return retvalue; } /*------------------------------------------------------------------------- @@ -573,6 +631,7 @@ set_output_file(const char *fname) static int set_error_file(const char *fname) { + int retvalue = FAIL; FILE *f; /* temporary holding place for the stream pointer * so that rawerrorstream is changed only when succeeded */ @@ -585,10 +644,10 @@ set_error_file(const char *fname) if ((f = HDfopen(fname, "w")) != NULL) { rawerrorstream = f; - return 0; + retvalue = SUCCEED; } - return -1; + return retvalue; } /*------------------------------------------------------------------------- @@ -1125,6 +1184,13 @@ parse_start: last_was_dset = FALSE; break; + case 'O': + if (set_output_file(opt_arg) < 0) { + usage(h5tools_getprogname()); + goto error; + } + break; + case 'o': if ( bin_output ) { if (set_data_output_file(opt_arg, 1) < 0) { @@ -1133,9 +1199,17 @@ parse_start: } } else { - if (set_data_output_file(opt_arg, 0) < 0) { - usage(h5tools_getprogname()); - goto error; + if(display_attr_data && !display_data) { + if (set_attr_output_file(opt_arg, 0) < 0) { + usage(h5tools_getprogname()); + goto error; + } + } + if(display_data || display_all) { + if (set_data_output_file(opt_arg, 0) < 0) { + usage(h5tools_getprogname()); + goto error; + } } } @@ -1558,12 +1632,12 @@ main(int argc, const char *argv[]) begin_obj(h5tools_dump_header_format->filebegin, fname, h5tools_dump_header_format->fileblockbegin); } else { - HDfprintf(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, "\n"); /* alternative first element, depending on schema or DTD. */ if (useschema) { if (HDstrcmp(xmlnsprefix,"") == 0) { - HDfprintf(rawoutstream, "\n", + PRINTSTREAM(rawoutstream, "\n", xml_dtd_uri); } else { @@ -1575,7 +1649,7 @@ main(int argc, const char *argv[]) indx = HDstrrchr(ns,(int)':'); if (indx) *indx = '\0'; - HDfprintf(rawoutstream, "<%sHDF5-File xmlns:%s=\"http://hdfgroup.org/HDF5/XML/schema/HDF5-File\" " + PRINTSTREAM(rawoutstream, "<%sHDF5-File xmlns:%s=\"http://hdfgroup.org/HDF5/XML/schema/HDF5-File\" " "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); @@ -1583,17 +1657,17 @@ main(int argc, const char *argv[]) } } else { - HDfprintf(rawoutstream, "\n", xml_dtd_uri); - HDfprintf(rawoutstream, "\n"); + PRINTSTREAM(rawoutstream, "\n", xml_dtd_uri); + PRINTVALSTREAM(rawoutstream, "\n"); } } if (!doxml) { if (display_fi) { - HDfprintf(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, "\n"); dump_fcontents(fid); end_obj(h5tools_dump_header_format->fileend,h5tools_dump_header_format->fileblockend); - HDfprintf(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, "\n"); goto done; } @@ -1612,7 +1686,7 @@ main(int argc, const char *argv[]) dump_function_table->dump_group_function(gid, "/" ); if (!doxml) dump_indent -= COL; - HDfprintf(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, "\n"); } if(H5Gclose(gid) < 0) { @@ -1634,15 +1708,15 @@ main(int argc, const char *argv[]) hand[i].func(fid, hand[i].obj, hand[i].subset_info, 1, NULL); } } - HDfprintf(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, "\n"); } if (!doxml) { end_obj(h5tools_dump_header_format->fileend, h5tools_dump_header_format->fileblockend); - HDfprintf(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, "\n"); } else { - HDfprintf(rawoutstream, "\n", xmlnsprefix); + PRINTSTREAM(rawoutstream, "\n", xmlnsprefix); } /* Free tables for objects */ table_list_free(); diff --git a/tools/h5dump/h5dump_ddl.c b/tools/h5dump/h5dump_ddl.c index 6f5fd3f..c4a9ecb 100644 --- a/tools/h5dump/h5dump_ddl.c +++ b/tools/h5dump/h5dump_ddl.c @@ -1168,23 +1168,23 @@ dump_fcpl(hid_t fid) * SUPER_BLOCK *------------------------------------------------------------------------- */ - HDfprintf(rawoutstream, "\n%s %s\n",SUPER_BLOCK, BEGIN); + PRINTSTREAM(rawoutstream, "\n%s %s\n",SUPER_BLOCK, BEGIN); indentation(dump_indent + COL); - HDfprintf(rawoutstream, "%s %u\n","SUPERBLOCK_VERSION", finfo.super.version); + PRINTSTREAM(rawoutstream, "%s %u\n","SUPERBLOCK_VERSION", finfo.super.version); indentation(dump_indent + COL); - HDfprintf(rawoutstream, "%s %u\n","FREELIST_VERSION", finfo.free.version); + PRINTSTREAM(rawoutstream, "%s %u\n","FREELIST_VERSION", finfo.free.version); indentation(dump_indent + COL); - HDfprintf(rawoutstream, "%s %u\n","SYMBOLTABLE_VERSION", 0); /* Retain this for backward compatibility, for now (QAK) */ + PRINTSTREAM(rawoutstream, "%s %u\n","SYMBOLTABLE_VERSION", 0); /* Retain this for backward compatibility, for now (QAK) */ indentation(dump_indent + COL); - HDfprintf(rawoutstream, "%s %u\n","OBJECTHEADER_VERSION", finfo.sohm.version); + PRINTSTREAM(rawoutstream, "%s %u\n","OBJECTHEADER_VERSION", finfo.sohm.version); indentation(dump_indent + COL); - HDfprintf(rawoutstream,"%s %Hd\n","OFFSET_SIZE", (long long)off_size); + PRINTSTREAM(rawoutstream,"%s %Hd\n","OFFSET_SIZE", (long long)off_size); indentation(dump_indent + COL); - HDfprintf(rawoutstream,"%s %Hd\n","LENGTH_SIZE", (long long)len_size); + PRINTSTREAM(rawoutstream,"%s %Hd\n","LENGTH_SIZE", (long long)len_size); indentation(dump_indent + COL); - HDfprintf(rawoutstream, "%s %u\n","BTREE_RANK", sym_ik); + PRINTSTREAM(rawoutstream, "%s %u\n","BTREE_RANK", sym_ik); indentation(dump_indent + COL); - HDfprintf(rawoutstream, "%s %d\n","BTREE_LEAF", sym_lk); + PRINTSTREAM(rawoutstream, "%s %d\n","BTREE_LEAF", sym_lk); #ifdef SHOW_FILE_DRIVER if (H5FD_CORE==fdriver) @@ -1215,37 +1215,42 @@ dump_fcpl(hid_t fid) /* Take out this because the driver used can be different from the * standard output. */ /*indentation(dump_indent + COL); - HDfprintf(rawoutstream, "%s %s\n","FILE_DRIVER", dname);*/ + PRINTSTREAM(rawoutstream, "%s %s\n","FILE_DRIVER", dname);*/ #endif indentation(dump_indent + COL); - HDfprintf(rawoutstream, "%s %u\n","ISTORE_K", istore_ik); + PRINTSTREAM(rawoutstream, "%s %u\n","ISTORE_K", istore_ik); indentation(dump_indent + COL); - if(fs_strategy == H5F_FILE_SPACE_ALL_PERSIST) - HDfprintf(rawoutstream, "%s %s\n", "FILE_SPACE_STRATEGY", "H5F_FILE_SPACE_ALL_PERSIST"); - else if(fs_strategy == H5F_FILE_SPACE_ALL) - HDfprintf(rawoutstream, "%s %s\n", "FILE_SPACE_STRATEGY", "H5F_FILE_SPACE_ALL"); - else if(fs_strategy == H5F_FILE_SPACE_AGGR_VFD) - HDfprintf(rawoutstream, "%s %s\n", "FILE_SPACE_STRATEGY", "H5F_FILE_SPACE_AGGR_VFD"); - else if(fs_strategy == H5F_FILE_SPACE_VFD) - HDfprintf(rawoutstream, "%s %s\n", "FILE_SPACE_STRATEGY", "H5F_FILE_SPACE_VFD"); - else - HDfprintf(rawoutstream, "%s %s\n", "FILE_SPACE_STRATEGY", "Unknown strategy"); + 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); - HDfprintf(rawoutstream, "%s %Hu\n","FREE_SPACE_THRESHOLD", fs_threshold); + PRINTSTREAM(rawoutstream, "%s %Hu\n","FREE_SPACE_THRESHOLD", fs_threshold); /*------------------------------------------------------------------------- * USER_BLOCK *------------------------------------------------------------------------- */ indentation(dump_indent + COL); - HDfprintf(rawoutstream, "USER_BLOCK %s\n",BEGIN); + PRINTSTREAM(rawoutstream, "USER_BLOCK %s\n",BEGIN); indentation(dump_indent + COL + COL); - HDfprintf(rawoutstream,"%s %Hu\n","USERBLOCK_SIZE", userblock); + PRINTSTREAM(rawoutstream,"%s %Hu\n","USERBLOCK_SIZE", userblock); indentation(dump_indent + COL); - HDfprintf(rawoutstream, "%s\n",END); + PRINTSTREAM(rawoutstream, "%s\n",END); - HDfprintf(rawoutstream, "%s",END); + PRINTSTREAM(rawoutstream, "%s",END); } /*------------------------------------------------------------------------- @@ -1264,7 +1269,7 @@ dump_fcpl(hid_t fid) void dump_fcontents(hid_t fid) { - HDfprintf(rawoutstream, "%s %s\n",FILE_CONTENTS, BEGIN); + PRINTSTREAM(rawoutstream, "%s %s\n",FILE_CONTENTS, BEGIN); /* special case of unamed types in root group */ if (unamedtype) { @@ -1272,14 +1277,14 @@ dump_fcontents(hid_t fid) for (u = 0; u < type_table->nobjs; u++) { if (!type_table->objs[u].recorded) - HDfprintf(rawoutstream, " %-10s /#"H5_PRINTF_HADDR_FMT"\n", "datatype", type_table->objs[u].objno); + PRINTSTREAM(rawoutstream, " %-10s /#"H5_PRINTF_HADDR_FMT"\n", "datatype", type_table->objs[u].objno); } } /* print objects in the files */ h5trav_print(fid); - HDfprintf(rawoutstream, " %s\n",END); + PRINTSTREAM(rawoutstream, " %s\n",END); } /*------------------------------------------------------------------------- @@ -1564,12 +1569,12 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis if(found_obj) { if (found_obj->displayed) { - HDfprintf(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, "\n"); indentation(dump_indent); begin_obj(h5tools_dump_header_format->datasetbegin, real_name, h5tools_dump_header_format->datasetblockbegin); - HDfprintf(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, "\n"); indentation(dump_indent + COL); - HDfprintf(rawoutstream, "%s \"%s\"\n", HARDLINK, found_obj->objname); + PRINTSTREAM(rawoutstream, "%s \"%s\"\n", HARDLINK, found_obj->objname); indentation(dump_indent); end_obj(h5tools_dump_header_format->datasetend, h5tools_dump_header_format->datasetblockend); } @@ -1621,9 +1626,9 @@ handle_groups(hid_t fid, const char *group, void UNUSED *data, int pe, const cha if((gid = H5Gopen2(fid, group, H5P_DEFAULT)) < 0) { if (pe) { - HDfprintf(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, "\n"); begin_obj(h5tools_dump_header_format->groupbegin, real_name, h5tools_dump_header_format->groupblockbegin); - HDfprintf(rawoutstream, "\n"); + 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); @@ -1678,15 +1683,15 @@ handle_links(hid_t fid, const char *links, void UNUSED * data, int UNUSED pe, co } else { char *buf = (char *)HDmalloc(linfo.u.val_size); - HDfprintf(rawoutstream, "\n"); + 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); - HDfprintf(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, "\n"); indentation(COL); if(H5Lget_val(fid, links, buf, linfo.u.val_size, H5P_DEFAULT) >= 0) - HDfprintf(rawoutstream, "LINKTARGET \"%s\"\n", buf); + PRINTSTREAM(rawoutstream, "LINKTARGET \"%s\"\n", buf); else { error_msg("h5dump error: unable to get link value for \"%s\"\n", links); h5tools_setstatus(EXIT_FAILURE); @@ -1696,21 +1701,21 @@ handle_links(hid_t fid, const char *links, void UNUSED * data, int UNUSED pe, co case H5L_TYPE_EXTERNAL: begin_obj(h5tools_dump_header_format->udlinkbegin, links, h5tools_dump_header_format->udlinkblockbegin); - HDfprintf(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, "\n"); indentation(COL); begin_obj(h5tools_dump_header_format->extlinkbegin, links, h5tools_dump_header_format->extlinkblockbegin); - HDfprintf(rawoutstream, "\n"); + 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); - HDfprintf(rawoutstream, "LINKCLASS %d\n", linfo.type); + PRINTSTREAM(rawoutstream, "LINKCLASS %d\n", linfo.type); indentation(COL); - HDfprintf(rawoutstream, "TARGETFILE \"%s\"\n", elink_file); + PRINTSTREAM(rawoutstream, "TARGETFILE \"%s\"\n", elink_file); indentation(COL); - HDfprintf(rawoutstream, "TARGETPATH \"%s\"\n", elink_path); + PRINTSTREAM(rawoutstream, "TARGETPATH \"%s\"\n", elink_path); } else { error_msg("h5dump error: unable to unpack external link value for \"%s\"\n", links); @@ -1726,12 +1731,12 @@ handle_links(hid_t fid, const char *links, void UNUSED * data, int UNUSED pe, co default: begin_obj(h5tools_dump_header_format->udlinkbegin, links, h5tools_dump_header_format->udlinkblockbegin); - HDfprintf(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, "\n"); indentation(COL); begin_obj(h5tools_dump_header_format->udlinkbegin, links, h5tools_dump_header_format->udlinkblockbegin); - HDfprintf(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, "\n"); indentation(COL); - HDfprintf(rawoutstream, "LINKCLASS %d\n", linfo.type); + PRINTSTREAM(rawoutstream, "LINKCLASS %d\n", linfo.type); end_obj(h5tools_dump_header_format->udlinkend, h5tools_dump_header_format->udlinkblockend); break; } /* end switch */ @@ -1785,9 +1790,9 @@ handle_datatypes(hid_t fid, const char *type, void UNUSED * data, int pe, const if(idx == type_table->nobjs) { if (pe) { /* unknown type */ - HDfprintf(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, "\n"); begin_obj(h5tools_dump_header_format->datatypebegin, real_name, h5tools_dump_header_format->datatypeblockbegin); - HDfprintf(rawoutstream, "\n"); + 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); diff --git a/tools/h5dump/h5dump_defines.h b/tools/h5dump/h5dump_defines.h index 4af5360..66d73e3 100644 --- a/tools/h5dump/h5dump_defines.h +++ b/tools/h5dump/h5dump_defines.h @@ -26,20 +26,20 @@ #define begin_obj(obj,name,begin) \ do { \ if (name) \ - HDfprintf(rawoutstream, "%s \"%s\" %s", (obj), (name), (begin)); \ + PRINTSTREAM(rawoutstream, "%s \"%s\" %s", (obj), (name), (begin)); \ else \ - HDfprintf(rawoutstream, "%s %s", (obj), (begin)); \ + PRINTSTREAM(rawoutstream, "%s %s", (obj), (begin)); \ } while(0); #define end_obj(obj,end) \ do { \ if(HDstrlen(end)) { \ - HDfprintf(rawoutstream, "%s", end); \ + PRINTSTREAM(rawoutstream, "%s", end); \ if(HDstrlen(obj)) \ - HDfprintf(rawoutstream, " "); \ + PRINTVALSTREAM(rawoutstream, " "); \ } \ if(HDstrlen(obj)) \ - HDfprintf(rawoutstream, "%s", obj); \ + PRINTSTREAM(rawoutstream, "%s", obj); \ } while(0); diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in index 8a2483b..238eee9 100644 --- a/tools/h5dump/testh5dump.sh.in +++ b/tools/h5dump/testh5dump.sh.in @@ -31,7 +31,7 @@ H5IMPORT=../h5import/h5import # The h5import tool name H5IMPORT_BIN=`pwd`/$H5IMPORT # The path of the h5import tool binary -CMP='cmp -s' +CMP='cmp' DIFF='diff -c' CP='cp' DIRNAME='dirname' @@ -56,8 +56,8 @@ 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 +TESTDIR=./testfiles/std +test -d $TESTDIR || mkdir -p $TESTDIR ###################################################################### # test files @@ -160,7 +160,6 @@ $SRC_H5DUMP_TESTFILES/tvldtypes4.h5 $SRC_H5DUMP_TESTFILES/tvldtypes5.h5 $SRC_H5DUMP_TESTFILES/tvlstr.h5 $SRC_H5DUMP_TESTFILES/tvms.h5 -$SRC_H5DUMP_TESTFILES/twidedisplay.ddl " LIST_OTHER_TEST_FILES=" @@ -176,6 +175,7 @@ $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/tallfilters.ddl $SRC_H5DUMP_TESTFILES/tarray1.ddl $SRC_H5DUMP_TESTFILES/tarray1_big.ddl @@ -261,8 +261,16 @@ $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/zerodim.ddl $SRC_H5DUMP_TESTFILES/tordergr1.ddl $SRC_H5DUMP_TESTFILES/tordergr2.ddl @@ -291,6 +299,8 @@ $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 @@ -305,6 +315,10 @@ $SRC_H5DUMP_TESTFILES/tvldtypes4.ddl $SRC_H5DUMP_TESTFILES/tvldtypes5.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 @@ -387,7 +401,7 @@ TESTING() { # 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. -# +# ADD_H5_TEST TOOLTEST() { expect="$TESTDIR/$1" actual="$TESTDIR/`basename $1 .ddl`.out" @@ -419,13 +433,13 @@ TOOLTEST() { else echo "*FAILED*" echo " Expected result (*.ddl) differs from actual result (*.out)" - nerrors="`expr $nerrors + 1`" - test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' + 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 + rm -f $actual $actual_err $actual_sav $actual_err_sav $actual_ext fi } @@ -434,6 +448,7 @@ TOOLTEST() { # 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" @@ -482,6 +497,111 @@ TOOLTEST2() { } +# 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() { @@ -539,6 +659,7 @@ TOOLTEST3() { # 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" @@ -669,7 +790,7 @@ IMPORTTEST() ############################################################################## ############################################################################## -### T H E T E S T S ### +### T H E T E S T S ### ############################################################################## ############################################################################## # prepare for test @@ -677,6 +798,15 @@ COPY_TESTFILES_TO_TESTDIR #TOOLTEST 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 + # test for maximum display datasets TOOLTEST twidedisplay.ddl --enable-error-stack -w0 packedbits.h5 @@ -783,7 +913,7 @@ 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 +#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 @@ -924,17 +1054,21 @@ TOOLTEST zerodim.ddl --enable-error-stack zerodim.h5 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 +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 +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 +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 @@ -954,12 +1088,11 @@ if test -z "$HDF5_NOCLEANUP"; then fi # test for dataset region references -TOOLTEST tdatareg.ddl --enable-error-stack tdatareg.h5 +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 +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 +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 @@ -998,7 +1131,7 @@ TOOLTEST4 textlink.ddl --enable-error-stack textlink.h5 TOOLTEST4 filter_fail.ddl --enable-error-stack filter_fail.h5 # test for -o -y for dataset with attributes -TOOLTEST tall-6.ddl --enable-error-stack -y -o data -d /g1/g1.1/dset1.1.1 tall.h5 +TOOLTEST2 tall-6.exp --enable-error-stack -y -o tall-6.txt -d /g1/g1.1/dset1.1.1 tall.h5 # Report test results and exit diff --git a/tools/h5dump/testh5dumppbits.sh.in b/tools/h5dump/testh5dumppbits.sh.in index a390766..8e8e0c0 100644 --- a/tools/h5dump/testh5dumppbits.sh.in +++ b/tools/h5dump/testh5dumppbits.sh.in @@ -64,8 +64,8 @@ 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 +TESTDIR=./testfiles/pbits +test -d $TESTDIR || mkdir -p $TESTDIR ###################################################################### # test files diff --git a/tools/h5dump/testh5dumpxml.sh.in b/tools/h5dump/testh5dumpxml.sh.in index 374f504..a70d31c 100644 --- a/tools/h5dump/testh5dumpxml.sh.in +++ b/tools/h5dump/testh5dumpxml.sh.in @@ -50,8 +50,8 @@ 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 +TESTDIR=./testfiles/xml +test -d $TESTDIR || mkdir -p $TESTDIR ###################################################################### # test files @@ -223,6 +223,9 @@ TESTING() { 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 @@ -232,18 +235,17 @@ TESTING() { # non-zero value. # TOOLTEST() { - expect="$srcdir/../testfiles/$1" - actual="../testfiles/`basename $1 .ddl`.out" - actual_err="../testfiles/`basename $1 .ddl`.err" + expect="$TESTDIR/$1" + actual="$TESTDIR/`basename $1 .xml`.out" + actual_err="$TESTDIR/`basename $1 .xml`.err" shift - # Run test. - TESTING $DUMPER $@ - ( - cd $srcdir/../testfiles - $RUNSERIAL $DUMPER_BIN $@ - ) >$actual 2>$actual_err - cat $actual_err >> $actual + # Run test. + TESTING $DUMPER $@ + ( + cd $TESTDIR + $RUNSERIAL $DUMPER_BIN "$@" + ) >$actual 2>$actual_err if [ ! -f $expect ]; then @@ -254,7 +256,7 @@ TOOLTEST() { echo " PASSED" else echo "*FAILED*" - echo " Expected result (*.ddl) differs from actual result (*.out)" + echo " Expected result (*.xml) differs from actual result (*.out)" nerrors="`expr $nerrors + 1`" test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' fi @@ -277,6 +279,8 @@ 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 diff --git a/tools/h5import/CMakeLists.txt b/tools/h5import/CMakeLists.txt index bc47244..97f7be9 100644 --- a/tools/h5import/CMakeLists.txt +++ b/tools/h5import/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.6) +cmake_minimum_required (VERSION 2.8.10) PROJECT (HDF5_TOOLS_H5IMPORT) #----------------------------------------------------------------------------- @@ -128,31 +128,29 @@ IF (BUILD_TESTING) ############################################################################## ############################################################################## MACRO (ADD_H5_TEST testname importfile conffile testfile) - ADD_TEST ( - NAME H5IMPORT-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${testfile} - ${testfile}.new - ${testfile}.new.err - ${testfile}.out - ${testfile}.out.err - ) - IF (NOT "${last_test}" STREQUAL "") - SET_TESTS_PROPERTIES (H5IMPORT-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) - ENDIF (NOT "${last_test}" STREQUAL "") - SET (last_test "H5IMPORT-${testname}-clear-objects") - - ADD_TEST (NAME H5IMPORT-${testname} COMMAND $ ${importfile} -c ${conffile} -o ${testfile}) - IF (NOT "${last_test}" STREQUAL "") - SET_TESTS_PROPERTIES (H5IMPORT-${testname} PROPERTIES DEPENDS ${last_test}) - ENDIF (NOT "${last_test}" STREQUAL "") - SET (last_test "H5IMPORT-${testname}") - - # If using memchecker add tests without using scripts - IF (NOT HDF5_ENABLE_USING_MEMCHECKER) + # If using memchecker skip macro based tests + IF (HDF5_ENABLE_USING_MEMCHECKER) + ADD_TEST (NAME H5IMPORT-${testname} COMMAND $ ${importfile} -c ${conffile} -o ${testfile}) + IF (NOT "${last_test}" STREQUAL "") + SET_TESTS_PROPERTIES (H5IMPORT-${testname} PROPERTIES DEPENDS ${last_test}) + ENDIF (NOT "${last_test}" STREQUAL "") + ELSE (HDF5_ENABLE_USING_MEMCHECKER) ADD_TEST ( - NAME H5IMPORT-H5DMP-${testname} + NAME H5IMPORT-${testname}-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + ${testfile} + ${testfile}.new + ${testfile}.new.err + ${testfile}.out + ${testfile}.out.err + ) + + ADD_TEST (NAME H5IMPORT-${testname} COMMAND $ ${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=$" -D "TEST_ARGS:STRING=${testfile}" @@ -163,9 +161,9 @@ IF (BUILD_TESTING) -D "TEST_SKIP_COMPARE=TRUE" -P "${HDF5_RESOURCES_DIR}/runTest.cmake" ) - SET_TESTS_PROPERTIES (H5IMPORT-H5DMP-${testname} PROPERTIES DEPENDS H5IMPORT-${testname}) + SET_TESTS_PROPERTIES (H5IMPORT-${testname}-H5DMP PROPERTIES DEPENDS H5IMPORT-${testname}) ADD_TEST ( - NAME H5IMPORT-H5DMP_CMP-${testname} + NAME H5IMPORT-${testname}-H5DMP_CMP COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=testfiles/${testfile}" @@ -176,13 +174,12 @@ IF (BUILD_TESTING) -D "TEST_REFERENCE=${testfile}.new" -P "${HDF5_RESOURCES_DIR}/runTest.cmake" ) - SET_TESTS_PROPERTIES (H5IMPORT-H5DMP_CMP-${testname} PROPERTIES DEPENDS H5IMPORT-H5DMP-${testname}) - SET (last_test "H5IMPORT-H5DMP_CMP-${testname}") - ENDIF (NOT HDF5_ENABLE_USING_MEMCHECKER) + 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 add tests without using scripts + # If using memchecker skip tests IF (NOT HDF5_ENABLE_USING_MEMCHECKER) ADD_TEST ( NAME H5IMPORT-DUMP-${testname}-clear-objects @@ -197,13 +194,10 @@ IF (BUILD_TESTING) d${testfile}.dff d${testfile}.dff.err ) - IF (NOT "${last_test}" STREQUAL "") - SET_TESTS_PROPERTIES (H5IMPORT-DUMP-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) - ENDIF (NOT "${last_test}" STREQUAL "") IF ("${ARGN}" STREQUAL "BINARY") ADD_TEST ( - NAME H5IMPORT-DUMP-${testname}-H5DUMP + NAME H5IMPORT-DUMP-${testname}-H5DMP COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-p;-d;${datasetname};-o;d${testfile}.bin;-b;testfiles/${testfile}" @@ -215,7 +209,7 @@ IF (BUILD_TESTING) ) ELSE ("${ARGN}" STREQUAL "BINARY") ADD_TEST ( - NAME H5IMPORT-DUMP-${testname}-H5DUMP + NAME H5IMPORT-DUMP-${testname}-H5DMP COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-p;-d;${datasetname};-o;d${testfile}.bin;-y;--width=1;testfiles/${testfile}" @@ -226,7 +220,7 @@ IF (BUILD_TESTING) -P "${HDF5_RESOURCES_DIR}/runTest.cmake" ) ENDIF ("${ARGN}" STREQUAL "BINARY") - SET_TESTS_PROPERTIES (H5IMPORT-DUMP-${testname}-H5DUMP PROPERTIES DEPENDS "H5IMPORT-DUMP-${testname}-clear-objects") + SET_TESTS_PROPERTIES (H5IMPORT-DUMP-${testname}-H5DMP PROPERTIES DEPENDS "H5IMPORT-DUMP-${testname}-clear-objects") ADD_TEST ( NAME H5IMPORT-DUMP-${testname} @@ -239,10 +233,10 @@ IF (BUILD_TESTING) -D "TEST_SKIP_COMPARE=TRUE" -P "${HDF5_RESOURCES_DIR}/runTest.cmake" ) - SET_TESTS_PROPERTIES (H5IMPORT-DUMP-${testname} PROPERTIES DEPENDS "H5IMPORT-DUMP-${testname}-H5DUMP") + SET_TESTS_PROPERTIES (H5IMPORT-DUMP-${testname} PROPERTIES DEPENDS "H5IMPORT-DUMP-${testname}-H5DMP") ADD_TEST ( - NAME H5IMPORT-DUMP-${testname}-H5DIFF + NAME H5IMPORT-DUMP-${testname}-H5DFF COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-v;d${testfile};testfiles/${testfile};${datasetname};${datasetname}" @@ -253,21 +247,17 @@ IF (BUILD_TESTING) -D "TEST_REFERENCE=testfiles/d${testfile}.txt" -P "${HDF5_RESOURCES_DIR}/runTest.cmake" ) - SET_TESTS_PROPERTIES (H5IMPORT-DUMP-${testname}-H5DIFF PROPERTIES DEPENDS "H5IMPORT-DUMP-${testname}") - SET (last_test "H5IMPORT-DUMP-${testname}-H5DIFF") - ELSE (NOT HDF5_ENABLE_USING_MEMCHECKER) - ADD_TEST ( - NAME H5IMPORT-DUMP-${testname}-SKIPPED - COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${testname} ${datasetname} ${testfile}" - ) + 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) - ADD_TEST ( - NAME H5IMPORT-DUMP-${testname}-SKIPPED - COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${testname} ${datasetname} ${testfile} --- DEFLATE filter not available" - ) + 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) # -------------------------------------------------------------------- @@ -283,27 +273,171 @@ IF (BUILD_TESTING) ############################################################################## ############################################################################## - # 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 - ${HDF5_REFERENCE_TEST_FILES} - ) - SET (last_test "H5IMPORT-clear-objects") + 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 COMMAND $) IF (NOT "${last_test}" STREQUAL "") SET_TESTS_PROPERTIES (H5IMPORT-h5importtest PROPERTIES DEPENDS ${last_test}) ENDIF (NOT "${last_test}" STREQUAL "") - SET (last_test "H5IMPORT-h5importtest") # ----- TESTING "ASCII I32 rank 3 - Output BE " ; ADD_H5_TEST (ASCII_I32 testfiles/txtin32.txt testfiles/txtin32.conf txtin32.h5) diff --git a/tools/h5import/Makefile.in b/tools/h5import/Makefile.in index 16e8901..9ad2341 100644 --- a/tools/h5import/Makefile.in +++ b/tools/h5import/Makefile.in @@ -234,6 +234,7 @@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ +HAVE_PTHREAD = @HAVE_PTHREAD@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF_CXX = @HDF_CXX@ @@ -285,7 +286,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PARALLEL = @PARALLEL@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ -PTHREAD = @PTHREAD@ RANLIB = @RANLIB@ ROOT = @ROOT@ RUNPARALLEL = @RUNPARALLEL@ diff --git a/tools/h5jam/CMakeLists.txt b/tools/h5jam/CMakeLists.txt index b44e734..95777b3 100644 --- a/tools/h5jam/CMakeLists.txt +++ b/tools/h5jam/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.6) +cmake_minimum_required (VERSION 2.8.10) PROJECT (HDF5_TOOLS_H5JAM) #----------------------------------------------------------------------------- @@ -112,6 +112,13 @@ IF (BUILD_TESTING) ENDIF (NOT "${resultcode}" STREQUAL "0") ELSE (HDF5_ENABLE_USING_MEMCHECKER) ADD_TEST ( + NAME H5JAM-${expectfile}-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + ${expectfile}.out + ${expectfile}.out.err + ) + ADD_TEST ( NAME H5JAM-${expectfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$" @@ -122,6 +129,7 @@ IF (BUILD_TESTING) -D "TEST_REFERENCE=testfiles/${expectfile}.txt" -P "${HDF5_RESOURCES_DIR}/runTest.cmake" ) + SET_TESTS_PROPERTIES (H5JAM-${expectfile} PROPERTIES DEPENDS H5JAM-${expectfile}-clear-objects) ENDIF (HDF5_ENABLE_USING_MEMCHECKER) ENDMACRO (TEST_H5JAM_OUTPUT) @@ -138,6 +146,13 @@ IF (BUILD_TESTING) ENDIF (NOT "${resultcode}" STREQUAL "0") ELSE (HDF5_ENABLE_USING_MEMCHECKER) ADD_TEST ( + NAME H5JAM-UNJAM-${expectfile}-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + ${expectfile}.out + ${expectfile}.out.err + ) + ADD_TEST ( NAME H5JAM-UNJAM-${expectfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$" @@ -148,50 +163,38 @@ IF (BUILD_TESTING) -D "TEST_REFERENCE=testfiles/${expectfile}.txt" -P "${HDF5_RESOURCES_DIR}/runTest.cmake" ) + SET_TESTS_PROPERTIES (H5JAM-UNJAM-${expectfile} PROPERTIES DEPENDS H5JAM-UNJAM-${expectfile}-clear-objects) ENDIF (HDF5_ENABLE_USING_MEMCHECKER) ENDMACRO (TEST_H5UNJAM_OUTPUT) - MACRO (CLEANUP testname) - ADD_TEST ( - NAME H5JAM-CLEANUP-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} -E remove ${ARGN} - ) - IF (NOT "${last_test}" STREQUAL "") - SET_TESTS_PROPERTIES (H5JAM-CLEANUP-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) - ENDIF (NOT "${last_test}" STREQUAL "") - SET (last_test "H5JAM-CLEANUP-${testname}-clear-objects") - ENDMACRO(CLEANUP testname testfile) - - MACRO (CHECKFILE testname expected actual) + MACRO (CHECKFILE testname testdepends expected actual) # If using memchecker add tests without using scripts IF (NOT HDF5_ENABLE_USING_MEMCHECKER) ADD_TEST ( - NAME H5JAM-CHECKFILE-${testname}-clear-objects + NAME H5JAM-${testname}-CHECKFILE-clear-objects COMMAND ${CMAKE_COMMAND} -E remove - ${expected}.new - ${expected}.new.err + ${actual}.new + ${actual}.new.err ${actual}.out ${actual}.out.err ) - IF (NOT "${last_test}" STREQUAL "") - SET_TESTS_PROPERTIES (H5JAM-CHECKFILE-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) - ENDIF (NOT "${last_test}" STREQUAL "") + SET_TESTS_PROPERTIES (H5JAM-${testname}-CHECKFILE-clear-objects PROPERTIES DEPENDS ${testdepends}) ADD_TEST ( - NAME H5JAM-CHECKFILE-H5DMP-${testname} + NAME H5JAM-${testname}-CHECKFILE-H5DMP COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=testfiles/${expected}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -D "TEST_OUTPUT=${expected}.new" + -D "TEST_OUTPUT=${actual}.new" -D "TEST_EXPECT=0" -D "TEST_FILTER=(^(HDF5)[^\n]*)" -D "TEST_SKIP_COMPARE=TRUE" -P "${HDF5_RESOURCES_DIR}/runTest.cmake" ) - SET_TESTS_PROPERTIES (H5JAM-CHECKFILE-H5DMP-${testname} PROPERTIES DEPENDS H5JAM-CHECKFILE-${testname}-clear-objects) + SET_TESTS_PROPERTIES (H5JAM-${testname}-CHECKFILE-H5DMP PROPERTIES DEPENDS H5JAM-${testname}-CHECKFILE-clear-objects) ADD_TEST ( - NAME H5JAM-CHECKFILE-H5DMP_CMP-${testname} + NAME H5JAM-${testname}-CHECKFILE-H5DMP_CMP COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${actual}" @@ -199,168 +202,210 @@ IF (BUILD_TESTING) -D "TEST_OUTPUT=${actual}.out" -D "TEST_EXPECT=0" -D "TEST_FILTER=(^(HDF5)[^\n]*)" - -D "TEST_REFERENCE=${expected}.new" + -D "TEST_REFERENCE=${actual}.new" -P "${HDF5_RESOURCES_DIR}/runTest.cmake" ) - SET_TESTS_PROPERTIES (H5JAM-CHECKFILE-H5DMP_CMP-${testname} PROPERTIES DEPENDS H5JAM-CHECKFILE-H5DMP-${testname}) - SET (last_test "H5JAM-CHECKFILE-H5DMP_CMP-${testname}") + SET_TESTS_PROPERTIES (H5JAM-${testname}-CHECKFILE-H5DMP_CMP PROPERTIES DEPENDS H5JAM-${testname}-CHECKFILE-H5DMP) ENDIF (NOT HDF5_ENABLE_USING_MEMCHECKER) - ENDMACRO(CHECKFILE testname expected actual) - - MACRO (SETUP testname infile outfile) - ADD_TEST ( - NAME H5JAM-SETUP-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} -E remove ${outfile} - ) - IF (NOT "${last_test}" STREQUAL "") - SET_TESTS_PROPERTIES (H5JAM-SETUP-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) - ENDIF (NOT "${last_test}" STREQUAL "") - ADD_TEST ( - NAME H5JAM-SETUP-${testname} - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${HDF5_TOOLS_H5JAM_SOURCE_DIR}/testfiles/${infile} ${PROJECT_BINARY_DIR}/${outfile} - ) - SET_TESTS_PROPERTIES (H5JAM-SETUP-${testname} PROPERTIES DEPENDS H5JAM-SETUP-${testname}-clear-objects) - SET (last_test "H5JAM-SETUP-${testname}") - ENDMACRO(SETUP testname infile outfile) + ENDMACRO(CHECKFILE testname testdepends expected actual) - MACRO (CHECK_UB_1 testname testfile ufile) + MACRO (UNJAMTEST testname setfile infile ufile chkfile outfile) IF (NOT HDF5_ENABLE_USING_MEMCHECKER) ADD_TEST ( - NAME H5JAM-CHECK_UB_1-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${testfile}.len.txt - ${testfile}.cmp - ${ufile}.cmp + 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_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} ) - IF (NOT "${last_test}" STREQUAL "") - SET_TESTS_PROPERTIES (H5JAM-CHECK_UB_1-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) - ENDIF (NOT "${last_test}" STREQUAL "") + 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 $ -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_D-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove ${outfile}.ufile.txt ${outfile}.ufile.txt.err + ) + SET_TESTS_PROPERTIES (H5JAM-${testname}-UNJAM_D-clear-objects PROPERTIES DEPENDS H5JAM-${testname}-UNJAM-clear-objects) + ADD_TEST ( + NAME H5JAM-${testname}-UNJAM + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -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 "${HDF5_RESOURCES_DIR}/runTest.cmake" + ) + SET_TESTS_PROPERTIES (H5JAM-${testname}-UNJAM PROPERTIES DEPENDS H5JAM-${testname}-UNJAM_D-clear-objects) + SET (compare_test "${outfile}.ufile.txt") + ELSE (NOT "${ARGN}" STREQUAL "--delete") + ADD_TEST (NAME H5JAM-${testname}-UNJAM COMMAND $ -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=$" + -D "TEST_GET_PROGRAM=$" + -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 "${HDF5_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-CHECK_UB_1-${testname} + NAME H5JAM-${testname}-UNJAM-CHECK_NOUB COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$" -D "TEST_GET_PROGRAM=$" - -D "TEST_CHECKUB=YES" + -D "TEST_CHECKUB=NO" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -D "TEST_HFILE=${testfile}" - -D "TEST_UFILE=${ufile}" + -D "TEST_HFILE=${outfile}" -D "TEST_EXPECT=0" - -D "TEST_OFILE=${ARGN}" + -D "TEST_UFILE=NULL" + -D "TEST_OFILE=NULL" -P "${HDF5_RESOURCES_DIR}/userblockTest.cmake" ) - SET_TESTS_PROPERTIES (H5JAM-CHECK_UB_1-${testname} PROPERTIES DEPENDS H5JAM-CHECK_UB_1-${testname}-clear-objects) - SET (last_test "H5JAM-CHECK_UB_1-${testname}") + 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(CHECK_UB_1 testname testfile ufile) + ENDMACRO(UNJAMTEST testname infile ufile outfile) - MACRO (CHECK_NOUB testname testfile) + MACRO (JAMTEST testname jamfile infile chkfile outfile) IF (NOT HDF5_ENABLE_USING_MEMCHECKER) ADD_TEST ( - NAME H5JAM-CHECK_NOUB-${testname} + 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 $ -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=$" -D "TEST_GET_PROGRAM=$" - -D "TEST_CHECKUB=NO" + -D "TEST_CHECKUB=YES" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -D "TEST_HFILE=${testfile}" + -D "TEST_HFILE=${compare_test}" + -D "TEST_UFILE=testfiles/${jamfile}" -D "TEST_EXPECT=0" - -D "TEST_UFILE=NULL" - -D "TEST_OFILE=NULL" + -D "TEST_OFILE=${compare_orig}" -P "${HDF5_RESOURCES_DIR}/userblockTest.cmake" ) - IF (NOT "${last_test}" STREQUAL "") - SET_TESTS_PROPERTIES (H5JAM-CHECK_NOUB-${testname} PROPERTIES DEPENDS ${last_test}) - ENDIF (NOT "${last_test}" STREQUAL "") - SET (last_test "H5JAM-CHECK_NOUB-${testname}") + 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(CHECK_NOUB testname testfile) + ENDMACRO (JAMTEST testname jamfile infile outfile) - MACRO (UNJAMTEST testname infile ufile outfile) - ADD_TEST ( - NAME H5JAM-UNJAM-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} -E remove ${outfile} - ) - IF (NOT "${last_test}" STREQUAL "") - SET_TESTS_PROPERTIES (H5JAM-UNJAM-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) - ENDIF (NOT "${last_test}" STREQUAL "") - IF (NOT "${ufile}" STREQUAL "NONE") + MACRO (JAMTEST_NONE testname jamfile infile setfile chkfile) + IF (NOT HDF5_ENABLE_USING_MEMCHECKER) ADD_TEST ( - NAME H5JAM-UNJAM_D-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} -E remove ${ufile} + NAME H5JAM-${testname}_NONE-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove + ${chkfile} ${chkfile}.cpy.h5 ) - SET_TESTS_PROPERTIES (H5JAM-UNJAM_D-${testname}-clear-objects PROPERTIES DEPENDS H5JAM-UNJAM-${testname}-clear-objects) - ADD_TEST (NAME H5JAM-UNJAM-${testname} COMMAND $ -i ${infile} -u ${ufile} -o ${outfile}) - SET_TESTS_PROPERTIES (H5JAM-UNJAM-${testname} PROPERTIES DEPENDS H5JAM-UNJAM_D-${testname}-clear-objects) - SET (compare_test ${ufile}) - ELSE (NOT "${ufile}" STREQUAL "NONE") - IF (NOT "${ARGN}" STREQUAL "--delete") - ADD_TEST ( - NAME H5JAM-UNJAM_D-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} -E remove ${outfile}.ufile.txt ${outfile}.ufile.txt.err - ) - SET_TESTS_PROPERTIES (H5JAM-UNJAM_D-${testname}-clear-objects PROPERTIES DEPENDS H5JAM-UNJAM-${testname}-clear-objects) - IF (HDF5_ENABLE_USING_MEMCHECKER) - ADD_TEST (NAME H5JAM-UNJAM-${testname} COMMAND $ -i ${infile} -o ${outfile}) - ELSE (HDF5_ENABLE_USING_MEMCHECKER) - ADD_TEST ( - NAME H5JAM-UNJAM-${testname} - COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -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 "${HDF5_RESOURCES_DIR}/runTest.cmake" - ) - ENDIF (HDF5_ENABLE_USING_MEMCHECKER) - SET_TESTS_PROPERTIES (H5JAM-UNJAM-${testname} PROPERTIES DEPENDS H5JAM-UNJAM_D-${testname}-clear-objects) - SET (compare_test "${outfile}.ufile.txt") - ELSE (NOT "${ARGN}" STREQUAL "--delete") - ADD_TEST (NAME H5JAM-UNJAM-${testname} COMMAND $ -i ${infile} -o ${outfile}) - SET_TESTS_PROPERTIES (H5JAM-UNJAM-${testname} PROPERTIES DEPENDS H5JAM-UNJAM-${testname}-clear-objects) - SET (compare_test "") - ENDIF (NOT "${ARGN}" STREQUAL "--delete") - ENDIF (NOT "${ufile}" STREQUAL "NONE") - SET (last_test "H5JAM-UNJAM-${testname}") - IF (NOT "${compare_test}" STREQUAL "") - CHECK_UB_1 (${testname} ${infile} ${compare_test}) - ENDIF (NOT "${compare_test}" STREQUAL "") - CHECK_NOUB (${testname} ${outfile}) - ENDMACRO(UNJAMTEST testname infile ufile outfile) + 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) - MACRO (JAMTEST testname jamfile infile outfile) - ADD_TEST ( - NAME H5JAM-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} -E remove ${outfile} ${infile}.cpy.h5 - ) - IF (NOT "${last_test}" STREQUAL "") - SET_TESTS_PROPERTIES (H5JAM-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) - ENDIF (NOT "${last_test}" STREQUAL "") - SET (last_test "H5JAM-${testname}-clear-objects") - IF ("${outfile}" STREQUAL "NONE") ADD_TEST ( - NAME H5JAM-NONE_COPY-${testname} - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${infile} ${infile}.cpy.h5 + NAME H5JAM-${testname}_NONE_COPY + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${chkfile} ${chkfile}.cpy.h5 ) - SET_TESTS_PROPERTIES (H5JAM-NONE_COPY-${testname} PROPERTIES DEPENDS ${last_test}) - SET (last_test "H5JAM-NONE_COPY-${testname}") - ADD_TEST (NAME H5JAM-${testname} COMMAND $ -u testfiles/${jamfile} -i ${infile} ${ARGN}) - SET (compare_test ${infile}) - SET (compare_orig ${infile}.cpy.h5) - ELSE ("${outfile}" STREQUAL "NONE") - ADD_TEST (NAME H5JAM-${testname} COMMAND $ -u testfiles/${jamfile} -i testfiles/${infile} -o ${outfile} ${ARGN}) - SET (compare_test ${outfile}) - SET (compare_orig testfiles/${infile}) - ENDIF ("${outfile}" STREQUAL "NONE") - SET_TESTS_PROPERTIES (H5JAM-${testname} PROPERTIES DEPENDS ${last_test}) - SET (last_test "H5JAM-${testname}") - IF ("${ARGN}" STREQUAL "--clobber") - SET (compare_orig "") - ENDIF ("${ARGN}" STREQUAL "--clobber") - CHECK_UB_1 (${testname} ${compare_test} testfiles/${jamfile} ${compare_orig}) - ENDMACRO (JAMTEST testname jamfile infile outfile) + SET_TESTS_PROPERTIES (H5JAM-${testname}_NONE_COPY PROPERTIES DEPENDS H5JAM-${testname}_NONE-SETUP) + + ADD_TEST (NAME H5JAM-${testname}_NONE COMMAND $ -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=$" + -D "TEST_GET_PROGRAM=$" + -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 "${HDF5_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) ############################################################################## ############################################################################## @@ -377,118 +422,45 @@ IF (BUILD_TESTING) # 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 ta2.h5) - CHECKFILE (tall_u10 tall.h5 ta2.h5) -# CLEANUP (tall_u10 ta2.h5) - JAMTEST (tall_u511 u511.txt tall.h5 ta3.h5) - CHECKFILE (tall_u511 tall.h5 ta3.h5) -# CLEANUP (tall_u511 ta3.h5) - JAMTEST (tall_u512 u512.txt tall.h5 ta4.h5) - CHECKFILE (tall_u512 tall.h5 ta4.h5) -# CLEANUP (tall_u512 ta4.h5) - JAMTEST (tall_u513 u513.txt tall.h5 ta5.h5) - CHECKFILE (tall_u513 tall.h5 ta5.h5) -# CLEANUP (tall_u513 ta5.h5) - - SETUP (ta_u10 tall.h5 ta.h5) - JAMTEST (ta_u10 u10.txt ta.h5 NONE) - CHECKFILE (ta_u10 tall.h5 ta.h5) - SETUP (ta_u511 tall.h5 ta.h5 NOCLEAN) - JAMTEST (ta_u511 u511.txt ta.h5 NONE) - CHECKFILE (ta_u511 tall.h5 ta.h5) - SETUP (ta_u512 tall.h5 ta.h5 NOCLEAN) - JAMTEST (ta_u512 u512.txt ta.h5 NONE) - CHECKFILE (ta_u512 tall.h5 ta.h5) - SETUP (ta_u513 tall.h5 ta.h5 NOCLEAN) - JAMTEST (ta_u513 u513.txt ta.h5 NONE) - CHECKFILE (ta_u513 tall.h5 ta.h5) -# CLEANUP (ta ta.h5) - - JAMTEST (twithub_u10 u10.txt twithub.h5 tax2.h5) - CHECKFILE (twithub_u10 tall.h5 tax2.h5) -# CLEANUP (twithub_u10 tax2.h5) - JAMTEST (twithub_u511 u511.txt twithub.h5 tax3.h5) - CHECKFILE (twithub_u511 tall.h5 tax3.h5) -# CLEANUP (twithub_u511 tax3.h5) - JAMTEST (twithub_u512 u512.txt twithub.h5 tax4.h5) - CHECKFILE (twithub_u512 tall.h5 tax4.h5) -# CLEANUP (twithub_u512 tax4.h5) - JAMTEST (twithub_u513 u513.txt twithub.h5 tax5.h5) - CHECKFILE (twithub_u513 tall.h5 tax5.h5) -# CLEANUP (twithub_u513 tax5.h5) - - JAMTEST (twithub513_u10 u10.txt twithub513.h5 tax6.h5) - CHECKFILE (twithub513_u10 tall.h5 tax6.h5) -# CLEANUP (twithub513_u10 tax6.h5) - JAMTEST (twithub513_u511 u511.txt twithub513.h5 tax7.h5) - CHECKFILE (twithub513_u511 tall.h5 tax7.h5) -# CLEANUP (twithub513_u511 tax7.h5) - JAMTEST (twithub513_u512 u512.txt twithub513.h5 tax8.h5) - CHECKFILE (twithub513_u512 tall.h5 tax8.h5) -# CLEANUP (twithub513_u512 tax8.h5) - JAMTEST (twithub513_u513 u513.txt twithub513.h5 tax9.h5) - CHECKFILE (twithub513_u513 tall.h5 tax9.h5) -# CLEANUP (twithub513_u513 tax9.h5) - - JAMTEST (twithub_u10_c u10.txt twithub.h5 taz2.h5 --clobber) - CHECKFILE (twithub_u10_c tall.h5 taz2.h5) -# CLEANUP (twithub_u10_c taz2.h5) - JAMTEST (twithub_u511_c u511.txt twithub.h5 taz3.h5 --clobber) - CHECKFILE (twithub_u511_c tall.h5 taz3.h5) -# CLEANUP (twithub_u511_c taz3.h5) - JAMTEST (twithub_u512_c u512.txt twithub.h5 taz4.h5 --clobber) - CHECKFILE (twithub_u512_c tall.h5 taz4.h5) -# CLEANUP (twithub_u512_c taz4.h5) - JAMTEST (twithub_u513_c u513.txt twithub.h5 taz5.h5 --clobber) - CHECKFILE (twithub_u513_c tall.h5 taz5.h5) -# CLEANUP (twithub_u513_c taz5.h5) - - JAMTEST (twithub513_u10_c u10.txt twithub513.h5 taz6.h5 --clobber) - CHECKFILE (twithub513_u10_c tall.h5 taz6.h5) -# CLEANUP (twithub513_u10_c taz6.h5) - JAMTEST (twithub513_u511_c u511.txt twithub513.h5 taz7.h5 --clobber) - CHECKFILE (twithub513_u511_c tall.h5 taz7.h5) -# CLEANUP (twithub513_u511_c taz7.h5) - JAMTEST (twithub513_u512_c u512.txt twithub513.h5 taz8.h5 --clobber) - CHECKFILE (twithub513_u512_c tall.h5 taz8.h5) -# CLEANUP (twithub513_u512_c taz8.h5) - JAMTEST (twithub513_u513_c u513.txt twithub513.h5 taz9.h5 --clobber) - CHECKFILE (twithub513_u513_c tall.h5 taz9.h5) -# CLEANUP (twithub513_u513_c taz9.h5) - - SETUP (N_twithub_u10_c twithub.h5 tay2.h5) - JAMTEST (N_twithub_u10_c u10.txt tay2.h5 NONE --clobber) - CHECKFILE (N_twithub_u10_c tall.h5 tay2.h5) -# CLEANUP (N_twithub_u10_c tay2.h5) - SETUP (N_twithub_u511_c twithub.h5 tay3.h5) - JAMTEST (N_twithub_u511_c u511.txt tay3.h5 NONE --clobber) - CHECKFILE (N_twithub_u511_c tall.h5 tay3.h5) -# CLEANUP (N_twithub_u511_c tay3.h5) - SETUP (N_twithub_u512_c twithub.h5 tay4.h5) - JAMTEST (N_twithub_u512_c u512.txt tay4.h5 NONE --clobber) - CHECKFILE (N_twithub_u512_c tall.h5 tay4.h5) -# CLEANUP (N_twithub_u512_c tay4.h5) - SETUP (N_twithub_u513_c twithub.h5 tay5.h5) - JAMTEST (N_twithub_u513_c u513.txt tay5.h5 NONE --clobber) - CHECKFILE (N_twithub_u513_c tall.h5 tay5.h5) -# CLEANUP (N_twithub_u513_c tay5.h5) - - SETUP (N_twithub513_u10_c twithub513.h5 tay6.h5) - JAMTEST (N_twithub513_u10_c u10.txt tay6.h5 NONE --clobber) - CHECKFILE (N_twithub513_u10_c tall.h5 tay6.h5) -# CLEANUP (N_twithub513_u10_c tay6.h5) - SETUP (N_twithub513_u511_c twithub513.h5 tay7.h5) - JAMTEST (N_twithub513_u511_c u511.txt tay7.h5 NONE --clobber) - CHECKFILE (N_twithub513_u511_c tall.h5 tay7.h5) -# CLEANUP (N_twithub513_u511_c tay7.h5) - SETUP (N_twithub513_u512_c twithub513.h5 tay8.h5) - JAMTEST (N_twithub513_u512_c u512.txt tay8.h5 NONE --clobber) - CHECKFILE (N_twithub513_u512_c tall.h5 tay8.h5) -# CLEANUP (N_twithub513_u512_c tay8.h5) - SETUP (N_twithub513_u513_c twithub513.h5 tay9.h5) - JAMTEST (N_twithub513_u513_c u513.txt tay9.h5 NONE --clobber) - CHECKFILE (N_twithub513_u513_c tall.h5 tay9.h5) -# CLEANUP (N_twithub513_u513_c tay9.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 @@ -496,32 +468,14 @@ IF (BUILD_TESTING) # help page TEST_H5UNJAM_OUTPUT(h5unjam-help 0 -h) - SETUP (twithub_tall twithub.h5 tai1.h5) - UNJAMTEST (twithub_tall tai1.h5 o10.txt taa1.h5) - CHECKFILE (twithub_tall tall.h5 taa1.h5) -# CLEANUP (twithub_tall taa1.h5 tai1.h5 o10.txt) - SETUP (twithub513_tall twithub513.h5 tai2.h5) - UNJAMTEST (twithub513_tall tai2.h5 o512.txt taa2.h5) - CHECKFILE (twithub513_tall tall.h5 taa2.h5) -# CLEANUP (twithub513_tall taa2.h5 tai2.h5 o512.txt) - - SETUP (N_twithub_tall twithub.h5 tai3.h5) - UNJAMTEST (N_twithub_tall tai3.h5 NONE taa3.h5) - CHECKFILE (N_twithub_tall tall.h5 taa3.h5) -# CLEANUP (N_twithub_tall taa3.h5 tai3.h5) - SETUP (N_twithub513_tall twithub513.h5 tai4.h5) - UNJAMTEST (N_twithub513_tall tai4.h5 NONE taa4.h5) - CHECKFILE (N_twithub513_tall tall.h5 taa4.h5) -# CLEANUP (N_twithub513_tall taa4.h5 tai4.h5) - - SETUP (D_twithub_tall twithub.h5 taj2.h5) - UNJAMTEST (D_twithub_tall taj2.h5 NONE tac2.h5 --delete) - CHECKFILE (D_twithub_tall tall.h5 tac2.h5) -# CLEANUP (D_twithub_tall tac2.h5 taj2.h5) - SETUP (D_twithub513_tall twithub513.h5 taj3.h5) - UNJAMTEST (D_twithub513_tall taj3.h5 NONE tac3.h5 --delete) - CHECKFILE (D_twithub513_tall tall.h5 tac3.h5) -# CLEANUP (D_twithub513_tall tac3.h5 taj3.h5) + 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) ENDIF (BUILD_TESTING) diff --git a/tools/h5jam/Makefile.in b/tools/h5jam/Makefile.in index ff8b089..fd170fd 100644 --- a/tools/h5jam/Makefile.in +++ b/tools/h5jam/Makefile.in @@ -248,6 +248,7 @@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ +HAVE_PTHREAD = @HAVE_PTHREAD@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF_CXX = @HDF_CXX@ @@ -299,7 +300,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PARALLEL = @PARALLEL@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ -PTHREAD = @PTHREAD@ RANLIB = @RANLIB@ ROOT = @ROOT@ RUNPARALLEL = @RUNPARALLEL@ diff --git a/tools/h5jam/h5unjam.c b/tools/h5jam/h5unjam.c index c304045..691e2f2 100644 --- a/tools/h5jam/h5unjam.c +++ b/tools/h5jam/h5unjam.c @@ -43,14 +43,14 @@ 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'}, + {"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' } }; @@ -123,86 +123,69 @@ usage(const char *prog) } /*------------------------------------------------------------------------- - * 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: + * Return: Success: EXIT_SUCCESS; * - * Failure: Exits program with EXIT_FAILURE value. - * - * Programmer: - * - * Modifications: + * Failure: Exits function with EXIT_FAILURE value. * *------------------------------------------------------------------------- */ - -static void +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); - break; - case 'i': - input_file = HDstrdup (opt_arg); - break; - case 'u': - ub_file = HDstrdup (opt_arg); - break; - case 'd': - do_delete = 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); + 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 '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; } } - /* check for file name to be processed */ -/* - if (argc <= opt_ind+2) { - error_msg("missing file name\n"); - usage(h5tools_getprogname()); - HDexit(EXIT_FAILURE); - } -*/ + 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; } /*------------------------------------------------------------------------- @@ -246,13 +229,15 @@ main(int argc, const char *argv[]) /* Initialize h5tools lib */ h5tools_init(); - parse_command_line(argc, argv); + 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); - leave (EXIT_FAILURE); + h5tools_setstatus(EXIT_FAILURE); + goto done; } testval = H5Fis_hdf5(input_file); @@ -286,8 +271,10 @@ main(int argc, const char *argv[]) goto done; } - H5Pclose(plist); - H5Fclose(ifile); + status = H5Pclose(plist); + HDassert(status >= 0); + status = H5Fclose(ifile); + HDassert(status >= 0); if (usize == 0) { /* no user block to remove: message? */ @@ -371,17 +358,25 @@ main(int argc, const char *argv[]) } done: - if (ub_file) { - HDfree (ub_file); - if (ufid >= 0) HDclose(ufid); + if(input_file) + HDfree(input_file); + if(output_file) + HDfree(output_file); + if(ub_file) { + HDfree(ub_file); + if(ufid >= 0) + status = HDclose(ufid); + HDassert(status >= 0); } - if (input_file) - HDfree (input_file); - if (output_file) - HDfree (output_file); - if (h5fid >= 0) HDclose(h5fid); - if (ifid >= 0) HDclose(ifid); + if(h5fid >= 0) { + status = HDclose(h5fid); + HDassert(status >= 0); + } + if(ifid >= 0) { + status = HDclose(ifid); + HDassert(status >= 0); + } return h5tools_getstatus(); } diff --git a/tools/h5jam/testh5jam.sh.in b/tools/h5jam/testh5jam.sh.in index b2c6bec..86edbee 100644 --- a/tools/h5jam/testh5jam.sh.in +++ b/tools/h5jam/testh5jam.sh.in @@ -377,7 +377,7 @@ JAMTEST() { compare_orig="xxofile.h5" cleanup="$cleanup $compare_orig" else - # output goes to $4, compare ofile to ubfile + # output goes to $3, compare ofile to ubfile ofile="$3" compare_test="$ofile" compare_orig="$ifile" @@ -539,19 +539,22 @@ JAMTEST $TESTDIR/u513.txt $TESTDIR/tall.h5 ta5.h5 CHECKFILE $TESTDIR/tall.h5 ta5.h5 CLEANUP ta5.h5 -SETUP $TESTDIR/tall.h5 ta.h5 -JAMTEST $TESTDIR/u10.txt ta.h5 -CHECKFILE $TESTDIR/tall.h5 ta.h5 -SETUP $TESTDIR/tall.h5 ta.h5 -JAMTEST $TESTDIR/u511.txt ta.h5 -CHECKFILE $TESTDIR/tall.h5 ta.h5 -SETUP $TESTDIR/tall.h5 ta.h5 -JAMTEST $TESTDIR/u512.txt ta.h5 -CHECKFILE $TESTDIR/tall.h5 ta.h5 -SETUP $TESTDIR/tall.h5 ta.h5 -JAMTEST $TESTDIR/u513.txt ta.h5 -CHECKFILE $TESTDIR/tall.h5 ta.h5 -CLEANUP ta.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 diff --git a/tools/h5ls/CMakeLists.txt b/tools/h5ls/CMakeLists.txt index e2b3285..70943b5 100644 --- a/tools/h5ls/CMakeLists.txt +++ b/tools/h5ls/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.6) +cmake_minimum_required (VERSION 2.8.10) PROJECT (HDF5_TOOLS_H5LS) #----------------------------------------------------------------------------- @@ -145,10 +145,9 @@ IF (BUILD_TESTING) IF (NOT "${last_test}" STREQUAL "") SET_TESTS_PROPERTIES (H5LS-${resultfile} PROPERTIES DEPENDS ${last_test}) ENDIF (NOT "${last_test}" STREQUAL "") - SET (last_test "H5LS-${resultfile}") ELSE (HDF5_ENABLE_USING_MEMCHECKER) ADD_TEST ( - NAME H5LS-clear-${resultfile}-objects + NAME H5LS-${resultfile}-clear-objects COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/${resultfile}.out ./testfiles/${resultfile}.out.err ) @@ -163,7 +162,7 @@ IF (BUILD_TESTING) -D "TEST_REFERENCE=${resultfile}.ls" -P "${HDF5_RESOURCES_DIR}/runTest.cmake" ) - SET_TESTS_PROPERTIES (H5LS-${resultfile} PROPERTIES DEPENDS "H5LS-clear-${resultfile}-objects") + SET_TESTS_PROPERTIES (H5LS-${resultfile} PROPERTIES DEPENDS "H5LS-${resultfile}-clear-objects") ENDIF (HDF5_ENABLE_USING_MEMCHECKER) ENDMACRO (ADD_H5_TEST file) diff --git a/tools/h5ls/Makefile.in b/tools/h5ls/Makefile.in index 7aa4329..1861b03 100644 --- a/tools/h5ls/Makefile.in +++ b/tools/h5ls/Makefile.in @@ -228,6 +228,7 @@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ +HAVE_PTHREAD = @HAVE_PTHREAD@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF_CXX = @HDF_CXX@ @@ -279,7 +280,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PARALLEL = @PARALLEL@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ -PTHREAD = @PTHREAD@ RANLIB = @RANLIB@ ROOT = @ROOT@ RUNPARALLEL = @RUNPARALLEL@ diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c index 19ae99a..f14a667 100644 --- a/tools/h5ls/h5ls.c +++ b/tools/h5ls/h5ls.c @@ -178,7 +178,7 @@ static void usage (void) { HDfprintf(rawerrorstream, "\ -usage: %s [OPTIONS] [OBJECTS...]\n\ +usage: %s [OPTIONS] file[/OBJECT] [file[/[OBJECT]...]\n\ OPTIONS\n\ -h, -?, --help Print a usage message and exit\n\ -a, --address Print raw data address. If dataset is contiguous, address\n\ @@ -218,7 +218,7 @@ usage: %s [OPTIONS] [OBJECTS...]\n\ --vfd=DRIVER Use the specified virtual file driver\n\ -x, --hexdump Show raw data in hexadecimal format\n\ \n\ - OBJECTS\n\ + file/OBJECT\n\ Each object consists of an HDF5 file name optionally followed by a\n\ slash and an object name within the file (if no object is specified\n\ within the file then the contents of the root group are displayed).\n\ @@ -1454,7 +1454,7 @@ dump_dataset_values(hid_t dset) h5tools_str_close(&buffer); - HDfprintf(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, "\n"); } @@ -1638,7 +1638,7 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t UNUSED *ainfo, } h5tools_str_close(&buffer); - HDfprintf(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, "\n"); return 0; } @@ -2264,7 +2264,7 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter) grp_literal_g = orig_grp_literal; } else - HDfprintf(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, "\n"); } break; @@ -2750,7 +2750,7 @@ main(int argc, const char *argv[]) if(file >= 0) { if(verbose_g) - HDfprintf(rawoutstream, "Opened \"%s\" with %s driver.\n", fname, drivername); + PRINTSTREAM(rawoutstream, "Opened \"%s\" with %s driver.\n", fname, drivername); break; /*success*/ } /* end if */ diff --git a/tools/h5repack/CMakeLists.txt b/tools/h5repack/CMakeLists.txt index 7351fd5..156f6d8 100644 --- a/tools/h5repack/CMakeLists.txt +++ b/tools/h5repack/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.6) +cmake_minimum_required (VERSION 2.8.10) PROJECT (HDF5_TOOLS_H5REPACK) #----------------------------------------------------------------------------- @@ -150,24 +150,23 @@ IF (BUILD_TESTING) IF (${testtype} STREQUAL "SKIP") IF (NOT HDF5_ENABLE_USING_MEMCHECKER) ADD_TEST ( - NAME H5REPACK-${testname}-SKIPPED - COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${ARGN} -i ${PROJECT_BINARY_DIR}/testfiles/${testfile} -o ${PROJECT_BINARY_DIR}/testfiles/out.${testfile}" + 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-${testname} - COMMAND $ ${ARGN} -i ${PROJECT_BINARY_DIR}/testfiles/${testfile} -o ${PROJECT_BINARY_DIR}/testfiles/out.${testfile} + NAME H5REPACK_OLD-${testname} + COMMAND $ ${ARGN} -i ${PROJECT_BINARY_DIR}/testfiles/${testfile} -o ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} ) IF (NOT "${last_test}" STREQUAL "") - SET_TESTS_PROPERTIES (H5REPACK-${testname} PROPERTIES DEPENDS ${last_test}) + SET_TESTS_PROPERTIES (H5REPACK_OLD-${testname} PROPERTIES DEPENDS ${last_test}) ENDIF (NOT "${last_test}" STREQUAL "") ADD_TEST ( - NAME H5REPACK-DIFF_${testname} - COMMAND $ ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out.${testfile} + NAME H5REPACK_OLD-${testname}_DFF + COMMAND $ ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} ) - SET_TESTS_PROPERTIES (H5REPACK-DIFF_${testname} PROPERTIES DEPENDS H5REPACK-${testname}) - SET (last_test "H5REPACK-DIFF_${testname}") + SET_TESTS_PROPERTIES (H5REPACK_OLD-${testname}_DFF PROPERTIES DEPENDS H5REPACK_OLD-${testname}) ENDIF (${testtype} STREQUAL "SKIP") ENDMACRO (ADD_H5_TEST_OLD) @@ -176,23 +175,22 @@ IF (BUILD_TESTING) 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.${testfile}" + 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 $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out.${testfile} + COMMAND $ ${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 (NOT "${last_test}" STREQUAL "") ADD_TEST ( - NAME H5REPACK-DIFF_${testname} - COMMAND $ ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out.${testfile} + NAME H5REPACK-${testname}_DFF + COMMAND $ ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} ) - SET_TESTS_PROPERTIES (H5REPACK-DIFF_${testname} PROPERTIES DEPENDS H5REPACK-${testname}) - SET (last_test "H5REPACK-DIFF_${testname}") + SET_TESTS_PROPERTIES (H5REPACK-${testname}_DFF PROPERTIES DEPENDS H5REPACK-${testname}) ENDIF (${testtype} STREQUAL "SKIP") ENDMACRO (ADD_H5_TEST) @@ -200,22 +198,22 @@ IF (BUILD_TESTING) 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/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out.${resultfile}" + 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-${testname} COMMAND $ ${ARGN} testfiles/${resultfile} testfiles/out.${resultfile}) + ADD_TEST (NAME H5REPACK_CMP-${testname} COMMAND $ ${ARGN} testfiles/${resultfile} testfiles/out-${testname}.${resultfile}) ELSE (HDF5_ENABLE_USING_MEMCHECKER) ADD_TEST ( - NAME H5REPACK-${testname} + NAME H5REPACK_CMP-${testname} COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=${ARGN};testfiles/${resultfile};testfiles/out.${resultfile}" + -D "TEST_ARGS:STRING=${ARGN};testfiles/${resultfile};testfiles/out-${testname}.${resultfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -D "TEST_OUTPUT=./testfiles/${resultfile}.out" + -D "TEST_OUTPUT=./testfiles/${resultfile}-${testname}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_FILTER:STRING=${testfilter}" -D "TEST_REFERENCE=testfiles/${resultfile}.ddl" @@ -223,9 +221,8 @@ IF (BUILD_TESTING) ) ENDIF (HDF5_ENABLE_USING_MEMCHECKER) IF (NOT "${last_test}" STREQUAL "") - SET_TESTS_PROPERTIES (H5REPACK-${testname} PROPERTIES DEPENDS ${last_test}) + SET_TESTS_PROPERTIES (H5REPACK_CMP-${testname} PROPERTIES DEPENDS ${last_test}) ENDIF (NOT "${last_test}" STREQUAL "") - SET (last_test "H5REPACK-${testname}") ENDIF (${testtype} STREQUAL "SKIP") ENDMACRO (ADD_H5_CMP_TEST) @@ -234,28 +231,37 @@ IF (BUILD_TESTING) 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.${resultfile}" + 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 $ ${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 (NOT "${last_test}" STREQUAL "") + ADD_TEST ( + NAME H5REPACK_VERIFY_LAYOUT-${testname}_DFF + COMMAND $ ${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} + NAME H5REPACK_VERIFY_LAYOUT-${testname}_DMP COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=-d;${testdset};-pH;testfiles/out.${testfile}" + -D "TEST_ARGS:STRING=-d;${testdset};-pH;testfiles/out-${testname}.${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -D "TEST_OUTPUT=./testfiles/${testfile}-v.out" + -D "TEST_OUTPUT=./testfiles/${testfile}-${testname}-v.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_FILTER:STRING=${testfilter}" -D "TEST_REFERENCE=${testfilter}" -P "${HDF5_RESOURCES_DIR}/grepTest.cmake" ) - IF (NOT "${last_test}" STREQUAL "") - SET_TESTS_PROPERTIES (H5REPACK_VERIFY_LAYOUT-${testname} PROPERTIES DEPENDS ${last_test}) - ENDIF (NOT "${last_test}" STREQUAL "") - SET (last_test "H5REPACK_VERIFY_LAYOUT-${testname}") + 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)") @@ -267,21 +273,18 @@ IF (BUILD_TESTING) SET (nottestfilter "(CONTIGUOUS|CHUNK)") ENDIF (${testfilter} STREQUAL "COMPACT") ADD_TEST ( - NAME H5REPACK_VERIFY_LAYOUT_ALL-${testname} + NAME H5REPACK_VERIFY_LAYOUT-${testname}_DMP COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=-pH;testfiles/out.${testfile}" + -D "TEST_ARGS:STRING=-pH;testfiles/out-${testname}.${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -D "TEST_OUTPUT=./testfiles/${testfile}-v.out" + -D "TEST_OUTPUT=./testfiles/${testfile}-${testname}-v.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_FILTER:STRING=${nottestfilter}" -D "TEST_REFERENCE=${testfilter}" -P "${HDF5_RESOURCES_DIR}/grepTest.cmake" ) - IF (NOT "${last_test}" STREQUAL "") - SET_TESTS_PROPERTIES (H5REPACK_VERIFY_LAYOUT_ALL-${testname} PROPERTIES DEPENDS ${last_test}) - ENDIF (NOT "${last_test}" STREQUAL "") - SET (last_test "H5REPACK_VERIFY_LAYOUT_ALL-${testname}") + 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") @@ -289,25 +292,21 @@ IF (BUILD_TESTING) MACRO (ADD_H5_TEST_META testname testfile) ADD_TEST ( - NAME H5REPACK-${testname}_N - COMMAND $ ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out_N.${testname}.h5 + NAME H5REPACK_META-${testname}_N + COMMAND $ ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}_N.${testname}.h5 ) IF (NOT "${last_test}" STREQUAL "") - SET_TESTS_PROPERTIES (H5REPACK-${testname}_N PROPERTIES DEPENDS ${last_test}) + SET_TESTS_PROPERTIES (H5REPACK_META-${testname}_N PROPERTIES DEPENDS ${last_test}) ENDIF (NOT "${last_test}" STREQUAL "") ADD_TEST ( - NAME H5REPACK-${testname}_M - COMMAND $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out_M.${testname}.h5 + NAME H5REPACK_META-${testname}_M + COMMAND $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}_M.${testname}.h5 ) - IF (NOT "${last_test}" STREQUAL "") - SET_TESTS_PROPERTIES (H5REPACK-${testname}_M PROPERTIES DEPENDS ${last_test}) - ENDIF (NOT "${last_test}" STREQUAL "") - ADD_TEST (NAME H5REPACK-${testname} COMMAND ${CMAKE_COMMAND} -E compare_files ${PROJECT_BINARY_DIR}/testfiles/out_N.${testname}.h5 ${PROJECT_BINARY_DIR}/testfiles/out_M.${testname}.h5) - SET_TESTS_PROPERTIES (H5REPACK-${testname} PROPERTIES WILL_FAIL "true") - IF (NOT "${last_test}" STREQUAL "") - SET_TESTS_PROPERTIES (H5REPACK-${testname} PROPERTIES DEPENDS ${last_test}) - ENDIF (NOT "${last_test}" STREQUAL "") - SET (last_test "H5REPACK-${testname}") + 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) ############################################################################## @@ -316,43 +315,158 @@ IF (BUILD_TESTING) ############################################################################## ############################################################################## + # -------------------------------------------------------------------- + # 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) + # Remove any output file left over from previous test run ADD_TEST ( NAME H5REPACK-clearall-objects COMMAND ${CMAKE_COMMAND} -E remove - ./testfiles/h5repack_filters.h5.out - ./testfiles/h5repack_filters.h5.out.err - ./testfiles/h5repack_layout.h5-v.out - ./testfiles/h5repack_layout.h5-v.out.err - ./testfiles/h5repack_layout2.h5-v.out - ./testfiles/h5repack_layout2.h5-v.out.err - ./testfiles/h5repack_layout3.h5-v.out - ./testfiles/h5repack_layout3.h5-v.out.err - ./testfiles/out.tfamily%05d.h5 - ./testfiles/out.h5diff_attr1.h5 - ./testfiles/out.h5repack_attr.h5 - ./testfiles/out.h5repack_attr_refs.h5 - ./testfiles/out.h5repack_deflate.h5 - ./testfiles/out.h5repack_early.h5 - ./testfiles/out.h5repack_fill.h5 - ./testfiles/out.h5repack_filters.h5 - ./testfiles/out.h5repack_fletcher.h5 - ./testfiles/out.h5repack_hlink.h5 - ./testfiles/out.h5repack_layout.h5 - ./testfiles/out.h5repack_layouto.h5 - ./testfiles/out.h5repack_layout2.h5 - ./testfiles/out.h5repack_layout3.h5 - ./testfiles/out.h5repack_named_dtypes.h5 - ./testfiles/out.h5repack_nbit.h5 - ./testfiles/out.h5repack_objs.h5 - ./testfiles/out.h5repack_refs.h5 - ./testfiles/out.h5repack_shuffle.h5 - ./testfiles/out.h5repack_soffset.h5 - ./testfiles/out_M.meta_short.h5 - ./testfiles/out_N.meta_short.h5 - ./testfiles/out_M.meta_long.h5 - ./testfiles/out_N.meta_long.h5 + ./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-dset2_chunk_20x10-v.out + ./testfiles/h5repack_layout.h5-dset2_chunk_20x10-v.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_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-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-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-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 # from the h5repacktst h5repack_attr.h5 h5repack_attr_out.h5 @@ -398,32 +512,6 @@ IF (BUILD_TESTING) IF (NOT "${last_test}" STREQUAL "") SET_TESTS_PROPERTIES (H5REPACK-clearall-objects PROPERTIES DEPENDS ${last_test}) ENDIF (NOT "${last_test}" STREQUAL "") - SET (last_test "H5REPACK-clearall-objects") - - # -------------------------------------------------------------------- - # 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) ADD_TEST (NAME H5REPACK-testh5repack_detect_szip COMMAND $) IF (HDF5_ENABLE_SZIP_SUPPORT) @@ -438,15 +526,10 @@ IF (BUILD_TESTING) SET (passRegex "no") SET_TESTS_PROPERTIES (H5REPACK-testh5repack_detect_szip PROPERTIES PASS_REGULAR_EXPRESSION "no") ENDIF (HDF5_ENABLE_SZIP_SUPPORT) - IF (NOT "${last_test}" STREQUAL "") - SET_TESTS_PROPERTIES (H5REPACK-testh5repack_detect_szip PROPERTIES DEPENDS ${last_test}) - ENDIF (NOT "${last_test}" STREQUAL "") - SET (last_test "H5REPACK-testh5repack_detect_szip") + SET_TESTS_PROPERTIES (H5REPACK-testh5repack_detect_szip PROPERTIES DEPENDS H5REPACK-clearall-objects) ADD_TEST (NAME H5REPACK-h5repacktest COMMAND $) - IF (NOT "${last_test}" STREQUAL "") - SET_TESTS_PROPERTIES (H5REPACK-h5repacktest PROPERTIES DEPENDS ${last_test}) - ENDIF (NOT "${last_test}" STREQUAL "") + SET_TESTS_PROPERTIES (H5REPACK-h5repacktest PROPERTIES DEPENDS H5REPACK-testh5repack_detect_szip) SET (last_test "H5REPACK-h5repacktest") # @@ -740,47 +823,29 @@ IF (BUILD_TESTING) ######################################################### # layout options (these files have no filters) ######################################################### - ADD_H5_TEST (dset2_chunk_20x10 "TEST" ${FILE4} --layout=dset2:CHUNK=20x10) - ADD_H5_VERIFY_TEST (dset2_chunk_20x10 "TEST" 0 ${FILE4} dset2 CHUNKED) - ADD_H5_TEST (chunk_20x10 "TEST" ${FILE4} -l CHUNK=20x10) - ADD_H5_VERIFY_TEST (chunk_20x10 "TEST" 1 ${FILE4} null CHUNKED) - ADD_H5_TEST (dset2_conti "TEST" ${FILE4} -l dset2:CONTI) - ADD_H5_VERIFY_TEST (dset2_conti "TEST" 0 ${FILE4} dset2 CONTIGUOUS) - ADD_H5_TEST (conti "TEST" ${FILE4} -l CONTI) - ADD_H5_VERIFY_TEST (conti "TEST" 1 ${FILE4} null CONTIGUOUS) - ADD_H5_TEST (dset2_compa "TEST" ${FILE4} -l dset2:COMPA) - ADD_H5_VERIFY_TEST (dset2_compa "TEST" 0 ${FILE4} dset2 COMPACT) - ADD_H5_TEST (compa "TEST" ${FILE4} -l COMPA) - ADD_H5_VERIFY_TEST (compa "TEST" 1 ${FILE4} null COMPACT) + 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) ################################################################ # layout conversions (file has no filters) ############################################################### - ADD_H5_TEST (dset_compa_conti "TEST" ${FILE4} -l dset_compact:CONTI) - ADD_H5_VERIFY_TEST (dset_compa_conti "TEST" 0 ${FILE4} dset_compact CONTIGUOUS) - ADD_H5_TEST (dset_compa_chunk "TEST" ${FILE4} -l dset_compact:CHUNK=2x5) - ADD_H5_VERIFY_TEST (dset_compa_chunk "TEST" 0 ${FILE4} dset_compact CHUNKED) - ADD_H5_TEST (dset_compa_compa "TEST" ${FILE4} -l dset_compact:COMPA) - ADD_H5_VERIFY_TEST (dset_compa_compa "TEST" 0 ${FILE4} dset_compact COMPACT) - ADD_H5_TEST (dset_conti_compa "TEST" ${FILE4} -l dset_contiguous:COMPA) - ADD_H5_VERIFY_TEST (dset_conti_compa "TEST" 0 ${FILE4} dset_contiguous COMPACT) - ADD_H5_TEST (dset_conti_chunk "TEST" ${FILE4} -l dset_contiguous:CHUNK=3x6) - ADD_H5_VERIFY_TEST (dset_conti_chunk "TEST" 0 ${FILE4} dset_contiguous CHUNKED) - ADD_H5_TEST (dset_conti_conti "TEST" ${FILE4} -l dset_contiguous:CONTI) - ADD_H5_VERIFY_TEST (dset_conti_conti "TEST" 0 ${FILE4} dset_contiguous CONTIGUOUS) - ADD_H5_TEST (chunk_compa "TEST" ${FILE4} -l dset_chunk:COMPA) - ADD_H5_VERIFY_TEST (chunk_compa "TEST" 0 ${FILE4} dset_chunk COMPACT) - ADD_H5_TEST (chunk_conti "TEST" ${FILE4} -l dset_chunk:CONTI) - ADD_H5_VERIFY_TEST (chunk_conti "TEST" 0 ${FILE4} dset_chunk CONTIGUOUS) - ADD_H5_TEST (chunk_18x13 "TEST" ${FILE4} -l dset_chunk:CHUNK=18x13) - ADD_H5_VERIFY_TEST (chunk_18x13 "TEST" 0 ${FILE4} dset_chunk CHUNKED) + 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_TEST (contig_small_compa "TEST" ${FILE18} -l contig_small:COMPA) - ADD_H5_VERIFY_TEST (contig_small_compa "TEST" 0 ${FILE18} contig_small COMPACT) - - ADD_H5_TEST (contig_small_fixed_compa "TEST" ${FILE18} -l chunked_small_fixed:COMPA) - ADD_H5_VERIFY_TEST (contig_small_fixed_compa "TEST" 0 ${FILE18} chunked_small_fixed COMPACT) + 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 @@ -788,17 +853,14 @@ IF (BUILD_TESTING) # Use first dset to test. #--------------------------------------------------------------------------- # chunk to chunk - specify chunk dim bigger than any current dim -ADD_H5_TEST (chunk2chunk "TEST" h5repack_layout3.h5 -l chunk_unlimit1:CHUNK=100x300) -ADD_H5_VERIFY_TEST (chunk2chunk "TEST" 0 h5repack_layout3.h5 chunk_unlimit1 CHUNK) +ADD_H5_VERIFY_TEST (chunk2chunk "TEST" 0 h5repack_layout3.h5 chunk_unlimit1 CHUNK -l chunk_unlimit1:CHUNK=100x300) # chunk to contiguous -ADD_H5_TEST (chunk2conti "TEST" h5repack_layout3.h5 -l chunk_unlimit1:CONTI) -ADD_H5_VERIFY_TEST (chunk2conti "TEST" 0 h5repack_layout3.h5 chunk_unlimit1 CONTI) +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_TEST (chunk2compa "TEST" h5repack_layout3.h5 -l chunk_unlimit1:COMPA) -ADD_H5_VERIFY_TEST (chunk2compa "TEST" 0 h5repack_layout3.h5 chunk_unlimit1 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. @@ -808,16 +870,13 @@ ADD_H5_VERIFY_TEST (chunk2compa "TEST" 0 h5repack_layout3.h5 chunk_unlimit1 CHUN # - should not change max dims from unlimit # chunk dim is bigger than dataset dim. ( dset size < 64k ) -ADD_H5_TEST (error1 "TEST" h5repack_layout3.h5 -f chunk_unlimit1:NONE) -ADD_H5_VERIFY_TEST (error1 "TEST" 0 h5repack_layout3.h5 chunk_unlimit1 H5S_UNLIMITED) +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_TEST (error2 "TEST" h5repack_layout3.h5 -f chunk_unlimit2:NONE) -ADD_H5_VERIFY_TEST (error2 "TEST" 0 h5repack_layout3.h5 chunk_unlimit2 H5S_UNLIMITED) +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_TEST (error3 "TEST" h5repack_layout3.h5 -f chunk_unlimit3:NONE) -ADD_H5_VERIFY_TEST (error3 "TEST" 0 h5repack_layout3.h5 chunk_unlimit3 H5S_UNLIMITED) +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) @@ -829,22 +888,20 @@ ADD_H5_TEST (error4 "TEST" h5repack_layout3.h5 -f NONE) ADD_H5_TEST (native_attr "TEST" ${FILE2} -n) # latest file format with long switches. use FILE4=h5repack_layout.h5 (no filters) - SET (arg ${FILE4} --layout CHUNK=20x10 --filter GZIP=1 --minimum=10 --native --latest --compact=8 --indexed=6 --ssize=8[:dtype]) + 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_TEST (layout_long_switches ${TESTTYPE} ${arg}) - ADD_H5_VERIFY_TEST (layout_long_switches ${TESTTYPE} 1 ${FILE4} null CHUNKED) + 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 ${FILE4} -l CHUNK=20x10 -f GZIP=1 -m 10 -n -L -c 8 -d 6 -s 8[:dtype]) + 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_TEST (layout_short_switches ${TESTTYPE} ${arg}) - ADD_H5_VERIFY_TEST (layout_short_switches ${TESTTYPE} 1 ${FILE4} null CHUNKED) + ADD_H5_VERIFY_TEST (layout_short_switches ${TESTTYPE} 1 ${FILE4} null CHUNKED ${arg}) # several global filters SET (arg ${FILE4} --filter GZIP=1 --filter SHUF) diff --git a/tools/h5repack/Makefile.in b/tools/h5repack/Makefile.in index 389339f..fe3a11c 100644 --- a/tools/h5repack/Makefile.in +++ b/tools/h5repack/Makefile.in @@ -248,6 +248,7 @@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ +HAVE_PTHREAD = @HAVE_PTHREAD@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF_CXX = @HDF_CXX@ @@ -299,7 +300,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PARALLEL = @PARALLEL@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ -PTHREAD = @PTHREAD@ RANLIB = @RANLIB@ ROOT = @ROOT@ RUNPARALLEL = @RUNPARALLEL@ diff --git a/tools/h5repack/h5repack.sh.in b/tools/h5repack/h5repack.sh.in index a732ffb..dc90426 100644 --- a/tools/h5repack/h5repack.sh.in +++ b/tools/h5repack/h5repack.sh.in @@ -189,7 +189,9 @@ SKIP() { DIFFTEST() { VERIFY h5diff output $@ - $RUNSERIAL $H5DIFF_BIN -q "$@" + ( + $RUNSERIAL $H5DIFF_BIN -q "$@" + ) RET=$? if [ $RET != 0 ] ; then echo "*FAILED*" @@ -208,44 +210,57 @@ DIFFTEST() TOOLTEST() { echo $@ - TOOLTEST_MAIN $@ - outfile=$TESTDIR/out.$1 - rm -f $outfile -} + infile=$TESTDIR/$2 + outfile=$TESTDIR/out-$1.$2 + shift + shift -# TOOLTEST main function, doesn't delete $output file -TOOLTEST_MAIN() -{ # Run test. TESTING $H5REPACK $@ - - infile=$TESTDIR/$1 - outfile=$TESTDIR/out.$1 - shift - $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile + ( + $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile + ) RET=$? if [ $RET != 0 ] ; then - echo "*FAILED*" - nerrors="`expr $nerrors + 1`" + echo "*FAILED*" + nerrors="`expr $nerrors + 1`" else - echo " PASSED" - DIFFTEST $infile $outfile + echo " PASSED" + DIFFTEST $infile $outfile fi + rm -f $outfile } #------------------------------------------ # Verifying layouts of a dataset VERIFY_LAYOUT_DSET() { - outfile=$TESTDIR/out.$1 - layoutfile=$TESTDIR/layout.$1 - dset=$2 - expectlayout=$3 + layoutfile=$TESTDIR/layout-$1.$2 + dset=$3 + expectlayout=$4 + infile=$TESTDIR/$2 + outfile=$TESTDIR/out-$1.$2 + shift + shift + shift + shift + + $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" - $RUNSERIAL $H5DUMP_BIN -d $dset -pH $outfile > $layoutfile + ( + $RUNSERIAL $H5DUMP_BIN -d $dset -pH $outfile > $layoutfile + ) $GREP $expectlayout $layoutfile > /dev/null if [ $? -eq 0 ]; then echo " PASSED" @@ -262,17 +277,35 @@ VERIFY_LAYOUT_DSET() # Verifying layouts from entire file VERIFY_LAYOUT_ALL() { - outfile=$TESTDIR/out.$1 - layoutfile=$TESTDIR/layout.$1 - expectlayout=$2 + outfile=$TESTDIR/out-$1.$2 + layoutfile=$TESTDIR/layout-$1.$2 + expectlayout=$3 + shift + shift + shift + + $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" + ( # if CONTIGUOUS if [ $expectlayout = "CONTIGUOUS" ]; then - $RUNSERIAL $H5DUMP_BIN -pH $outfile > $layoutfile + TESTING $H5DUMP_BIN -pH $outfile + ( + $RUNSERIAL $H5DUMP_BIN -pH $outfile > $layoutfile + ) $GREP "COMPACT" $layoutfile > /dev/null if [ $? -eq 0 ]; then echo " FAILED" @@ -287,7 +320,10 @@ VERIFY_LAYOUT_ALL() else # if COMPACT if [ $expectlayout = "COMPACT" ]; then - $RUNSERIAL $H5DUMP_BIN -pH $outfile > $layoutfile + TESTING $H5DUMP_BIN -pH $outfile + ( + $RUNSERIAL $H5DUMP_BIN -pH $outfile > $layoutfile + ) $GREP "CHUNKED" $layoutfile > /dev/null if [ $? -eq 0 ]; then echo " FAILED" @@ -302,7 +338,10 @@ VERIFY_LAYOUT_ALL() else # if CHUNKED if [ $expectlayout = "CHUNKED" ]; then - $RUNSERIAL $H5DUMP_BIN -pH $outfile > $layoutfile + TESTING $H5DUMP_BIN -pH $outfile + ( + $RUNSERIAL $H5DUMP_BIN -pH $outfile > $layoutfile + ) $GREP "CONTIGUOUS" $layoutfile > /dev/null if [ $? -eq 0 ]; then echo " FAILED" @@ -317,6 +356,7 @@ VERIFY_LAYOUT_ALL() fi fi fi + ) # clean up tmp files rm -f $outfile @@ -327,13 +367,16 @@ VERIFY_LAYOUT_ALL() # TOOLTEST0() { + infile=$TESTDIR/$2 + outfile=$TESTDIR/out-$1.$2 + shift + shift + # Run test. TESTING $H5REPACK $@ - - infile=$TESTDIR/$1 - outfile=$TESTDIR/out.$1 - shift - $RUNSERIAL $H5REPACK_BIN -i $infile -o $outfile "$@" + ( + $RUNSERIAL $H5REPACK_BIN -i $infile -o $outfile "$@" + ) RET=$? if [ $RET != 0 ] ; then echo "*FAILED*" @@ -351,13 +394,16 @@ TOOLTEST0() # TOOLTEST1() { + infile=$TESTDIR/$2 + outfile=$TESTDIR/out-$1.$2 + shift + shift + # Run test. TESTING $H5REPACK $@ - - infile=$TESTDIR/$1 - outfile=$TESTDIR/out.$1 - shift - $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile + ( + $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile + ) RET=$? if [ $RET != 0 ] ; then echo "*FAILED*" @@ -374,16 +420,20 @@ TOOLTEST1() # TOOLTESTV() { - # Run test. - TESTING $H5REPACK $@ - expect="$TESTDIR/$1.ddl" - actual="$TESTDIR/`basename $1 .ddl`.out" - actual_err="$TESTDIR/`basename $1 .ddl`.err" + expect="$TESTDIR/$2.ddl" + actual="$TESTDIR/`basename $2 .ddl`.out" + actual_err="$TESTDIR/`basename $2 .ddl`.err" - infile=$TESTDIR/$1 - outfile=$TESTDIR/out.$1 + infile=$TESTDIR/$2 + outfile=$TESTDIR/out-$1.$2 + shift shift - $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile >$actual 2>$actual_err + + # Run test. + TESTING $H5REPACK $@ + ( + $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile + ) >$actual 2>$actual_err RET=$? if [ $RET != 0 ] ; then echo "*FAILED*" @@ -427,17 +477,41 @@ TOOLTESTV() # Verify the output file of second run is larger than the one of 1st run. TOOLTEST_META() { - input_file=$1 - outfile="$TESTDIR/out.$1" + infile=$TESTDIR/$2 + outfile=$TESTDIR/out-$1.$2 + shift + shift - # Use TOOLTEST_MAIN to run because it does not remove the output file. - # 1st run, without metadata option - TOOLTEST_MAIN $1 + # Run test. + TESTING $H5REPACK $@ + ( + $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 $outfile | cut -d' ' -f1` # 2nd run with metadata option - TOOLTEST_MAIN $* + # Run test. + TESTING $H5REPACK $@ + ( + $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 $outfile | cut -d' ' -f1` @@ -492,12 +566,12 @@ fi COPY_TESTFILES_TO_TESTDIR # copy files (these files have no filters) -TOOLTEST h5repack_fill.h5 -TOOLTEST h5repack_objs.h5 -TOOLTEST h5repack_attr.h5 -TOOLTEST h5repack_hlink.h5 -TOOLTEST h5repack_layout.h5 -TOOLTEST h5repack_early.h5 +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 # use h5repack_layout.h5 to write some filters (this file has no filters) @@ -507,7 +581,7 @@ arg="h5repack_layout.h5 -f dset1:GZIP=1 -l dset1:CHUNK=20x10" if test $USE_FILTER_DEFLATE != "yes" ; then SKIP $arg else - TOOLTEST $arg + TOOLTEST gzip_individual $arg fi # gzip for all @@ -515,7 +589,7 @@ arg="h5repack_layout.h5 -f GZIP=1" if test $USE_FILTER_DEFLATE != "yes" ; then SKIP $arg else - TOOLTEST $arg + TOOLTEST gzip_all $arg fi # szip with individual object @@ -523,7 +597,7 @@ 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 $arg + TOOLTEST szip_individual $arg fi # szip for all @@ -531,7 +605,7 @@ 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 $arg + TOOLTEST szip_all $arg fi # shuffle with individual object @@ -539,7 +613,7 @@ arg="h5repack_layout.h5 -f dset2:SHUF -l dset2:CHUNK=20x10" if test $USE_FILTER_SHUFFLE != "yes" ; then SKIP $arg else - TOOLTEST $arg + TOOLTEST shuffle_individual $arg fi @@ -548,7 +622,7 @@ arg="h5repack_layout.h5 -f SHUF" if test $USE_FILTER_SHUFFLE != "yes" ; then SKIP $arg else - TOOLTEST $arg + TOOLTEST shuffle_all $arg fi # fletcher32 with individual object @@ -556,7 +630,7 @@ arg="h5repack_layout.h5 -f dset2:FLET -l dset2:CHUNK=20x10" if test $USE_FILTER_FLETCHER32 != "yes" ; then SKIP $arg else - TOOLTEST $arg + TOOLTEST fletcher_individual $arg fi # fletcher32 for all @@ -564,7 +638,7 @@ arg="h5repack_layout.h5 -f FLET" if test $USE_FILTER_FLETCHER32 != "yes" ; then SKIP $arg else - TOOLTEST $arg + TOOLTEST fletcher_all $arg fi # all filters @@ -572,7 +646,7 @@ arg="h5repack_layout.h5 -f dset2:SHUF -f dset2:FLET -f dset2:SZIP=8,NN -f dset2: if test $USE_FILTER_SZIP_ENCODER != "yes" -o $USE_FILTER_SZIP != "yes" -o $USE_FILTER_SHUFFLE != "yes" -o $USE_FILTER_FLETCHER32 != "yes" -o $USE_FILTER_DEFLATE != "yes" ; then SKIP $arg else - TOOLTEST $arg + TOOLTEST all_filters $arg fi # verbose gzip with individual object @@ -581,7 +655,7 @@ if test $USE_FILTER_DEFLATE != "yes" ; then SKIP $arg else # compare output - TOOLTESTV $arg + TOOLTESTV gzip_verbose_filters $arg fi ########################################################### @@ -593,7 +667,7 @@ arg="h5repack_szip.h5" if test $USE_FILTER_SZIP_ENCODER != "yes" -o $USE_FILTER_SZIP != "yes" ; then SKIP $arg else - TOOLTEST $arg + TOOLTEST szip_copy $arg fi # szip remove @@ -601,7 +675,7 @@ 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 $arg + TOOLTEST szip_remove $arg fi # deflate copy @@ -609,7 +683,7 @@ arg="h5repack_deflate.h5" if test $USE_FILTER_DEFLATE != "yes" ; then SKIP $arg else - TOOLTEST $arg + TOOLTEST deflate_copy $arg fi # deflate remove @@ -617,7 +691,7 @@ arg="h5repack_deflate.h5 -f dset_deflate:NONE" if test $USE_FILTER_DEFLATE != "yes" ; then SKIP $arg else - TOOLTEST $arg + TOOLTEST deflate_remove $arg fi # shuffle copy @@ -625,7 +699,7 @@ arg="h5repack_shuffle.h5" if test $USE_FILTER_SHUFFLE != "yes" ; then SKIP $arg else - TOOLTEST $arg + TOOLTEST shuffle_copy $arg fi # shuffle remove @@ -633,7 +707,7 @@ arg="h5repack_shuffle.h5 -f dset_shuffle:NONE" if test $USE_FILTER_SHUFFLE != "yes" ; then SKIP $arg else - TOOLTEST $arg + TOOLTEST shuffle_remove $arg fi # fletcher32 copy @@ -641,7 +715,7 @@ arg="h5repack_fletcher.h5" if test $USE_FILTER_FLETCHER32 != "yes" ; then SKIP $arg else - TOOLTEST $arg + TOOLTEST fletcher_copy $arg fi # fletcher32 remove @@ -649,7 +723,7 @@ arg="h5repack_fletcher.h5 -f dset_fletcher32:NONE" if test $USE_FILTER_FLETCHER32 != "yes" ; then SKIP $arg else - TOOLTEST $arg + TOOLTEST fletcher_remove $arg fi # nbit copy @@ -657,7 +731,7 @@ arg="h5repack_nbit.h5" if test $USE_FILTER_NBIT != "yes" ; then SKIP $arg else - TOOLTEST $arg + TOOLTEST nbit_copy $arg fi # nbit remove @@ -665,7 +739,7 @@ arg="h5repack_nbit.h5 -f dset_nbit:NONE" if test $USE_FILTER_NBIT != "yes" ; then SKIP $arg else - TOOLTEST $arg + TOOLTEST nbit_remove $arg fi # nbit add @@ -673,7 +747,7 @@ arg="h5repack_nbit.h5 -f dset_int31:NBIT" if test $USE_FILTER_NBIT != "yes" ; then SKIP $arg else - TOOLTEST $arg + TOOLTEST nbit_add $arg fi # scaleoffset copy @@ -681,7 +755,7 @@ arg="h5repack_soffset.h5" if test $USE_FILTER_SCALEOFFSET != "yes" ; then SKIP $arg else - TOOLTEST $arg + TOOLTEST scale_copy $arg fi # scaleoffset add @@ -689,7 +763,7 @@ arg="h5repack_soffset.h5 -f dset_none:SOFF=31,IN" if test $USE_FILTER_SCALEOFFSET != "yes" ; then SKIP $arg else - TOOLTEST $arg + TOOLTEST scale_add $arg fi # scaleoffset remove @@ -697,7 +771,7 @@ arg="h5repack_soffset.h5 -f dset_scaleoffset:NONE" if test $USE_FILTER_SCALEOFFSET != "yes" ; then SKIP $arg else - TOOLTEST $arg + TOOLTEST scale_remove $arg fi # remove all filters @@ -705,7 +779,7 @@ arg="h5repack_filters.h5 -f NONE" if test $USE_FILTER_FLETCHER32 != "yes" -o $USE_FILTER_DEFLATE != "yes" -o $USE_FILTER_SZIP != "yes" -o $USE_FILTER_SZIP_ENCODER != "yes" -o $USE_FILTER_SHUFFLE != "yes" -o $USE_FILTER_NBIT != "yes" -o $USE_FILTER_SCALEOFFSET != "yes" ; then SKIP $arg else - TOOLTEST $arg + TOOLTEST remove_all $arg fi #filter conversions @@ -714,14 +788,14 @@ 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 $arg + 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 $arg + TOOLTEST szip_convert $arg fi @@ -730,7 +804,7 @@ arg="h5repack_layout.h5 -f GZIP=1 -m 1024" if test $USE_FILTER_DEFLATE != "yes" ; then SKIP $arg else - TOOLTEST $arg + TOOLTEST deflate_limit $arg fi #file @@ -738,67 +812,50 @@ arg="h5repack_layout.h5 -e $TESTDIR/h5repack.info" if test $USE_FILTER_DEFLATE != "yes" ; then SKIP $arg else - TOOLTEST $arg + TOOLTEST deflate_file $arg fi ######################################################### # layout options (these files have no filters) ######################################################### -TOOLTEST_MAIN h5repack_layout.h5 --layout dset2:CHUNK=20x10 -VERIFY_LAYOUT_DSET h5repack_layout.h5 dset2 CHUNKED +VERIFY_LAYOUT_DSET dset2_chunk_20x10 h5repack_layout.h5 dset2 CHUNKED --layout dset2:CHUNK=20x10 -TOOLTEST_MAIN h5repack_layout.h5 -l CHUNK=20x10 -VERIFY_LAYOUT_ALL h5repack_layout.h5 CHUNKED +VERIFY_LAYOUT_ALL chunk_20x10 h5repack_layout.h5 CHUNKED -l CHUNK=20x10 -TOOLTEST_MAIN h5repack_layout.h5 -l dset2:CONTI -VERIFY_LAYOUT_DSET h5repack_layout.h5 dset2 CONTIGUOUS +VERIFY_LAYOUT_DSET dset2_conti h5repack_layout.h5 dset2 CONTIGUOUS -l dset2:CONTI -TOOLTEST_MAIN h5repack_layout.h5 -l CONTI -VERIFY_LAYOUT_ALL h5repack_layout.h5 CONTIGUOUS +VERIFY_LAYOUT_ALL conti h5repack_layout.h5 CONTIGUOUS -l CONTI -TOOLTEST_MAIN h5repack_layout.h5 -l dset2:COMPA -VERIFY_LAYOUT_DSET h5repack_layout.h5 dset2 COMPACT +VERIFY_LAYOUT_DSET dset2_compa h5repack_layout.h5 dset2 COMPACT -l dset2:COMPA -TOOLTEST_MAIN h5repack_layout.h5 -l COMPA -VERIFY_LAYOUT_ALL h5repack_layout.h5 COMPACT +VERIFY_LAYOUT_ALL compa h5repack_layout.h5 COMPACT -l COMPA ################################################################ # layout conversions (file has no filters) ############################################################### -TOOLTEST_MAIN h5repack_layout.h5 -l dset_compact:CONTI -VERIFY_LAYOUT_DSET h5repack_layout.h5 dset_compact CONTIGUOUS +VERIFY_LAYOUT_DSET dset_compa_conti h5repack_layout.h5 dset_compact CONTIGUOUS -l dset_compact:CONTI -TOOLTEST_MAIN h5repack_layout.h5 -l dset_compact:CHUNK=2x5 -VERIFY_LAYOUT_DSET h5repack_layout.h5 dset_compact CHUNKED +VERIFY_LAYOUT_DSET dset_compa_chunk h5repack_layout.h5 dset_compact CHUNKED -l dset_compact:CHUNK=2x5 -TOOLTEST_MAIN h5repack_layout.h5 -l dset_compact:COMPA -VERIFY_LAYOUT_DSET h5repack_layout.h5 dset_compact COMPACT +VERIFY_LAYOUT_DSET dset_compa_compa h5repack_layout.h5 dset_compact COMPACT -l dset_compact:COMPA -TOOLTEST_MAIN h5repack_layout.h5 -l dset_contiguous:COMPA -VERIFY_LAYOUT_DSET h5repack_layout.h5 dset_contiguous COMPACT +VERIFY_LAYOUT_DSET dset_conti_compa h5repack_layout.h5 dset_contiguous COMPACT -l dset_contiguous:COMPA -TOOLTEST_MAIN h5repack_layout.h5 -l dset_contiguous:CHUNK=3x6 -VERIFY_LAYOUT_DSET h5repack_layout.h5 dset_contiguous CHUNKED +VERIFY_LAYOUT_DSET dset_conti_chunk h5repack_layout.h5 dset_contiguous CHUNKED -l dset_contiguous:CHUNK=3x6 -TOOLTEST_MAIN h5repack_layout.h5 -l dset_contiguous:CONTI -VERIFY_LAYOUT_DSET h5repack_layout.h5 dset_contiguous CONTIGUOUS +VERIFY_LAYOUT_DSET dset_conti_conti h5repack_layout.h5 dset_contiguous CONTIGUOUS -l dset_contiguous:CONTI -TOOLTEST_MAIN h5repack_layout.h5 -l dset_chunk:COMPA -VERIFY_LAYOUT_DSET h5repack_layout.h5 dset_chunk COMPACT +VERIFY_LAYOUT_DSET chunk_compa h5repack_layout.h5 dset_chunk COMPACT -l dset_chunk:COMPA -TOOLTEST_MAIN h5repack_layout.h5 -l dset_chunk:CONTI -VERIFY_LAYOUT_DSET h5repack_layout.h5 dset_chunk CONTIGUOUS +VERIFY_LAYOUT_DSET chunk_conti h5repack_layout.h5 dset_chunk CONTIGUOUS -l dset_chunk:CONTI -TOOLTEST_MAIN h5repack_layout.h5 -l dset_chunk:CHUNK=18x13 -VERIFY_LAYOUT_DSET h5repack_layout.h5 dset_chunk CHUNKED +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 -TOOLTEST_MAIN h5repack_layout2.h5 -l contig_small:COMPA -VERIFY_LAYOUT_DSET h5repack_layout2.h5 contig_small COMPACT +VERIFY_LAYOUT_DSET contig_small_compa h5repack_layout2.h5 contig_small COMPACT -l contig_small:COMPA -TOOLTEST_MAIN h5repack_layout2.h5 -l chunked_small_fixed:COMPA -VERIFY_LAYOUT_DSET h5repack_layout2.h5 chunked_small_fixed COMPACT +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 @@ -806,17 +863,14 @@ VERIFY_LAYOUT_DSET h5repack_layout2.h5 chunked_small_fixed COMPACT # Use first dset to test. #--------------------------------------------------------------------------- # chunk to chunk - specify chunk dim bigger than any current dim -TOOLTEST_MAIN h5repack_layout3.h5 -l chunk_unlimit1:CHUNK=100x300 -VERIFY_LAYOUT_DSET h5repack_layout3.h5 chunk_unlimit1 CHUNK +VERIFY_LAYOUT_DSET chunk2chunk h5repack_layout3.h5 chunk_unlimit1 CHUNK -l chunk_unlimit1:CHUNK=100x300 # chunk to contiguous -TOOLTEST_MAIN h5repack_layout3.h5 -l chunk_unlimit1:CONTI -VERIFY_LAYOUT_DSET h5repack_layout3.h5 chunk_unlimit1 CONTI +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) -TOOLTEST_MAIN h5repack_layout3.h5 -l chunk_unlimit1:COMPA -VERIFY_LAYOUT_DSET h5repack_layout3.h5 chunk_unlimit1 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. @@ -826,24 +880,22 @@ VERIFY_LAYOUT_DSET h5repack_layout3.h5 chunk_unlimit1 CHUNK # - should not change max dims from unlimit # chunk dim is bigger than dataset dim. ( dset size < 64k ) -TOOLTEST_MAIN h5repack_layout3.h5 -f chunk_unlimit1:NONE -VERIFY_LAYOUT_DSET h5repack_layout3.h5 chunk_unlimit1 H5S_UNLIMITED +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 ) -TOOLTEST_MAIN h5repack_layout3.h5 -f chunk_unlimit2:NONE -VERIFY_LAYOUT_DSET h5repack_layout3.h5 chunk_unlimit2 H5S_UNLIMITED +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 h5repack_layout3.h5 chunk_unlimit3 H5S_UNLIMITED +#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 h5repack_layout3.h5 -f NONE +TOOLTEST error4 h5repack_layout3.h5 -f NONE # Native option # Do not use FILE1, as the named dtype will be converted to native, and h5diff will # report a difference. -TOOLTEST h5repack_fill.h5 -n -TOOLTEST h5repack_attr.h5 -n +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) @@ -851,8 +903,7 @@ arg="h5repack_layout.h5 --layout CHUNK=20x10 --filter GZIP=1 --minimum=10 --nati if test $USE_FILTER_DEFLATE != "yes" ; then SKIP $arg else - TOOLTEST_MAIN $arg - VERIFY_LAYOUT_ALL h5repack_layout.h5 CHUNKED + 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) @@ -860,8 +911,7 @@ arg="h5repack_layout.h5 -l CHUNK=20x10 -f GZIP=1 -m 10 -n -L -c 8 -d 6 -s 8[:dty if test $USE_FILTER_DEFLATE != "yes" ; then SKIP $arg else - TOOLTEST_MAIN $arg - VERIFY_LAYOUT_ALL h5repack_layout.h5 CHUNKED + 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 @@ -870,7 +920,7 @@ arg="h5repack_layout.h5 --filter GZIP=1 --filter SHUF" if test $USE_FILTER_DEFLATE != "yes" -o $USE_FILTER_SHUFFLE != "yes" ; then SKIP $arg else - TOOLTEST $arg + TOOLTEST global_filters $arg fi # syntax of -i infile -o outfile @@ -879,46 +929,47 @@ arg="h5repack_layout.h5 -l CHUNK=20x10 -f GZIP=1 -m 10 -n -L -c 8 -d 6 -s 8[:dty if test $USE_FILTER_DEFLATE != "yes" ; then SKIP $arg else - TOOLTEST0 $arg + TOOLTEST0 old_style_layout_short_switches $arg fi # add a userblock to file -arg="h5repack_objs.h5 -u ublock.bin -b 2048" -TOOLTEST $arg +arg="h5repack_objs.h5 -u $TESTDIR/ublock.bin -b 2048" +TOOLTEST add_userblock $arg # add alignment arg="h5repack_objs.h5 -t 1 -a 1 " -TOOLTEST $arg +TOOLTEST add_alignment $arg # Check repacking file with old version of layout message (should get upgraded # to new version and be readable, etc.) -TOOLTEST h5repack_layouto.h5 +TOOLTEST pgrade_layout h5repack_layouto.h5 # test for datum size > H5TOOLS_MALLOCSIZE -TOOLTEST h5repack_objs.h5 -f GZIP=1 +TOOLTEST gt_mallocsize h5repack_objs.h5 -f GZIP=1 # Check repacking file with committed datatypes in odd configurations -TOOLTEST h5repack_named_dtypes.h5 +TOOLTEST committed_dt h5repack_named_dtypes.h5 # tests family driver (file is located in common testfiles folder, uses TOOLTEST1 -TOOLTEST1 tfamily%05d.h5 +TOOLTEST1 family tfamily%05d.h5 # test various references (bug 1814 and 1726) -TOOLTEST h5repack_refs.h5 +TOOLTEST bug1814 h5repack_refs.h5 # test attribute with various references (bug1797 / HDFFV-5932) # the references in attribute of compund or vlen datatype -TOOLTEST h5repack_attr_refs.h5 +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 h5diff_attr1.h5 +TOOLTEST HDFFV-7840 h5diff_attr1.h5 # tests for metadata block size option -TOOLTEST_META h5repack_layout.h5 --metadata_block_size=8192 +TOOLTEST_META meta_short h5repack_layout.h5 -M 8192 +TOOLTEST_META meta_long h5repack_layout.h5 --metadata_block_size=8192 if test $nerrors -eq 0 ; then echo "All $TESTNAME tests passed." diff --git a/tools/h5stat/CMakeLists.txt b/tools/h5stat/CMakeLists.txt index 3518cfd..447df70 100644 --- a/tools/h5stat/CMakeLists.txt +++ b/tools/h5stat/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.6) +cmake_minimum_required (VERSION 2.8.10) PROJECT (HDF5_TOOLS_H5STAT) #----------------------------------------------------------------------------- @@ -99,10 +99,9 @@ IF (BUILD_TESTING) IF (NOT "${last_test}" STREQUAL "") SET_TESTS_PROPERTIES (H5STAT-${resultfile} PROPERTIES DEPENDS ${last_test}) ENDIF (NOT "${last_test}" STREQUAL "") - SET (last_test "H5STAT-${resultfile}") ELSE (HDF5_ENABLE_USING_MEMCHECKER) ADD_TEST ( - NAME H5STAT-clear-${resultfile}-objects + NAME H5STAT-${resultfile}-clear-objects COMMAND ${CMAKE_COMMAND} -E remove ${resultfile}.out ${resultfile}.out.err ) @@ -117,7 +116,7 @@ IF (BUILD_TESTING) -D "TEST_REFERENCE=${resultfile}.ddl" -P "${HDF5_RESOURCES_DIR}/runTest.cmake" ) - SET_TESTS_PROPERTIES (H5STAT-${resultfile} PROPERTIES DEPENDS "H5STAT-clear-${resultfile}-objects") + SET_TESTS_PROPERTIES (H5STAT-${resultfile} PROPERTIES DEPENDS "H5STAT-${resultfile}-clear-objects") ENDIF (HDF5_ENABLE_USING_MEMCHECKER) ENDMACRO (ADD_H5_TEST file) diff --git a/tools/h5stat/Makefile.in b/tools/h5stat/Makefile.in index 389e460..ec77732 100644 --- a/tools/h5stat/Makefile.in +++ b/tools/h5stat/Makefile.in @@ -263,6 +263,7 @@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ +HAVE_PTHREAD = @HAVE_PTHREAD@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF_CXX = @HDF_CXX@ @@ -314,7 +315,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PARALLEL = @PARALLEL@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ -PTHREAD = @PTHREAD@ RANLIB = @RANLIB@ ROOT = @ROOT@ RUNPARALLEL = @RUNPARALLEL@ diff --git a/tools/lib/CMakeLists.txt b/tools/lib/CMakeLists.txt index 7f7b451..f0d0d01 100644 --- a/tools/lib/CMakeLists.txt +++ b/tools/lib/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.6) +cmake_minimum_required (VERSION 2.8.10) PROJECT (HDF5_TOOLS_LIB) #----------------------------------------------------------------------------- diff --git a/tools/lib/Makefile.in b/tools/lib/Makefile.in index 6a76e1d..743e158 100644 --- a/tools/lib/Makefile.in +++ b/tools/lib/Makefile.in @@ -226,6 +226,7 @@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ +HAVE_PTHREAD = @HAVE_PTHREAD@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF_CXX = @HDF_CXX@ @@ -277,7 +278,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PARALLEL = @PARALLEL@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ -PTHREAD = @PTHREAD@ RANLIB = @RANLIB@ ROOT = @ROOT@ RUNPARALLEL = @RUNPARALLEL@ diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c index 130a0d8..4899200 100644 --- a/tools/lib/h5diff_attr.c +++ b/tools/lib/h5diff_attr.c @@ -350,6 +350,13 @@ hsize_t diff_attr(hid_t loc1_id, if( build_match_list_attrs(loc1_id, loc2_id, &match_list_attrs, options) < 0) goto error; + /* if detect any unique extra attr */ + if(match_list_attrs->nattrs_only1 || match_list_attrs->nattrs_only2) + { + /* exit will be 1 */ + options->contents = 0; + } + for(u = 0; u < (unsigned)match_list_attrs->nattrs; u++) { if( (match_list_attrs->attrs[u].exist[0]) && (match_list_attrs->attrs[u].exist[1]) ) diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index 7b6098d..5f4227c 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -30,16 +30,13 @@ #include "h5tools_utils.h" #include "H5private.h" -#define SANITY_CHECK - -#define ALIGN(A,Z) ((((A) + (Z) - 1) / (Z)) * (Z)) - /* global variables */ hid_t H5tools_ERR_STACK_g = 0; hid_t H5tools_ERR_CLS_g = -1; hid_t H5E_tools_g = -1; hid_t H5E_tools_min_id_g = -1; int compound_data; +FILE *rawattrstream; /* should initialize to stdout but gcc moans about it */ FILE *rawdatastream; /* should initialize to stdout but gcc moans about it */ FILE *rawoutstream; /* should initialize to stdout but gcc moans about it */ FILE *rawerrorstream; /* should initialize to stderr but gcc moans about it */ @@ -119,6 +116,8 @@ h5tools_init(void) H5tools_ERR_STACK_g = H5Ecreate_stack(); H5TOOLS_INIT_ERROR() + if (!rawattrstream) + rawattrstream = stdout; if (!rawdatastream) rawdatastream = stdout; if (!rawoutstream) @@ -154,9 +153,19 @@ h5tools_close(void) H5E_auto2_t tools_func; void *tools_edata; if (h5tools_init_g) { + /* special case where only data is output to stdout */ + if((rawoutstream == NULL) && rawdatastream && (rawdatastream == stdout)) + HDfprintf(rawdatastream, "\n"); + H5Eget_auto2(H5tools_ERR_STACK_g, &tools_func, &tools_edata); if(tools_func!=NULL) H5Eprint2(H5tools_ERR_STACK_g, rawerrorstream); + if (rawattrstream && rawattrstream != stdout) { + if (fclose(rawattrstream)) + perror("closing rawattrstream"); + else + rawattrstream = NULL; + } if (rawdatastream && rawdatastream != stdout) { if (fclose(rawdatastream)) perror("closing rawdatastream"); @@ -573,6 +582,9 @@ h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info, size_t templength = 0; int i, indentlevel = 0; + if (stream == NULL) + return; + if (!ctx->need_prefix) return; @@ -581,9 +593,9 @@ h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info, /* Terminate previous line, if any */ if (ctx->cur_column) { - HDfputs(OPT(info->line_suf, ""), stream); + PUTSTREAM(OPT(info->line_suf, ""), stream); HDputc('\n', stream); - HDfputs(OPT(info->line_sep, ""), stream); + PUTSTREAM(OPT(info->line_sep, ""), stream); } /* Calculate new prefix */ @@ -607,23 +619,26 @@ h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info, the prefix is printed one indentation level before */ if (info->pindex) { for (i = 0; i < indentlevel - 1; i++) { - HDfputs(h5tools_str_fmt(&str, 0, info->line_indent), stream); + PUTSTREAM(h5tools_str_fmt(&str, 0, info->line_indent), stream); } } - if (elmtno == 0 && secnum == 0 && info->line_1st) - HDfputs(h5tools_str_fmt(&prefix, 0, info->line_1st), stream); - else if (secnum && info->line_cont) - HDfputs(h5tools_str_fmt(&prefix, 0, info->line_cont), stream); - else - HDfputs(h5tools_str_fmt(&prefix, 0, info->line_pre), stream); + if (elmtno == 0 && secnum == 0 && info->line_1st) { + PUTSTREAM(h5tools_str_fmt(&prefix, 0, info->line_1st), stream); + } + else if (secnum && info->line_cont) { + PUTSTREAM(h5tools_str_fmt(&prefix, 0, info->line_cont), stream); + } + else { + PUTSTREAM(h5tools_str_fmt(&prefix, 0, info->line_pre), stream); + } templength = h5tools_str_len(&prefix); for (i = 0; i < indentlevel; i++) { /*we already made the indent for the array indices case */ if (!info->pindex) { - HDfputs(h5tools_str_fmt(&prefix, 0, info->line_indent), stream); + PUTSTREAM(h5tools_str_fmt(&prefix, 0, info->line_indent), stream); templength += h5tools_str_len(&prefix); } else { @@ -662,6 +677,9 @@ h5tools_region_simple_prefix(FILE *stream, const h5tool_format_t *info, size_t templength = 0; int i, indentlevel = 0; + if (stream == NULL) + return; + if (!ctx->need_prefix) return; @@ -670,9 +688,9 @@ h5tools_region_simple_prefix(FILE *stream, const h5tool_format_t *info, /* Terminate previous line, if any */ if (ctx->cur_column) { - HDfputs(OPT(info->line_suf, ""), stream); + PUTSTREAM(OPT(info->line_suf, ""), stream); HDputc('\n', stream); - HDfputs(OPT(info->line_sep, ""), stream); + PUTSTREAM(OPT(info->line_sep, ""), stream); } /* Calculate new prefix */ @@ -696,23 +714,26 @@ h5tools_region_simple_prefix(FILE *stream, const h5tool_format_t *info, the prefix is printed one indentation level before */ if (info->pindex) { for (i = 0; i < indentlevel - 1; i++) { - HDfputs(h5tools_str_fmt(&str, 0, info->line_indent), stream); + PUTSTREAM(h5tools_str_fmt(&str, 0, info->line_indent), stream); } } - if (elmtno == 0 && secnum == 0 && info->line_1st) - HDfputs(h5tools_str_fmt(&prefix, 0, info->line_1st), stream); - else if (secnum && info->line_cont) - HDfputs(h5tools_str_fmt(&prefix, 0, info->line_cont), stream); - else - HDfputs(h5tools_str_fmt(&prefix, 0, info->line_pre), stream); + if (elmtno == 0 && secnum == 0 && info->line_1st) { + PUTSTREAM(h5tools_str_fmt(&prefix, 0, info->line_1st), stream); + } + else if (secnum && info->line_cont) { + PUTSTREAM(h5tools_str_fmt(&prefix, 0, info->line_cont), stream); + } + else { + PUTSTREAM(h5tools_str_fmt(&prefix, 0, info->line_pre), stream); + } templength = h5tools_str_len(&prefix); for (i = 0; i < indentlevel; i++) { /*we already made the indent for the array indices case */ if (!info->pindex) { - HDfputs(h5tools_str_fmt(&prefix, 0, info->line_indent), stream); + PUTSTREAM(h5tools_str_fmt(&prefix, 0, info->line_indent), stream); templength += h5tools_str_len(&prefix); } else { @@ -766,6 +787,9 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info, int secnum; /*section sequence number */ int multiline; /*datum was multiline */ + if (stream == NULL) + return dimension_break; + s = h5tools_str_fmt(buffer, 0, "%s"); /* @@ -870,12 +894,12 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info, h5tools_simple_prefix(stream, info, ctx, *curr_pos, secnum); } else if ((local_elmt_counter || ctx->continuation) && secnum == 0) { - HDfputs(OPT(info->elmt_suf2, " "), stream); + PUTSTREAM(OPT(info->elmt_suf2, " "), stream); ctx->cur_column += HDstrlen(OPT(info->elmt_suf2, " ")); } /* Print the section */ - HDfputs(section, stream); + PUTSTREAM(section, stream); ctx->cur_column += HDstrlen(section); } @@ -1026,12 +1050,12 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, h5tools_region_simple_prefix(stream, info, ctx, local_elmt_counter, ptdata, secnum); } else if ((local_elmt_counter || ctx->continuation) && secnum == 0) { - HDfputs(OPT(info->elmt_suf2, " "), stream); + PUTSTREAM(OPT(info->elmt_suf2, " "), stream); ctx->cur_column += HDstrlen(OPT(info->elmt_suf2, " ")); } /* Print the section */ - HDfputs(section, stream); + PUTSTREAM(section, stream); ctx->cur_column += HDstrlen(section); } @@ -1095,7 +1119,6 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t while(block_index > 0) { size_t bytes_in = 0; /* # of bytes to write */ size_t bytes_wrote = 0; /* # of bytes written */ - size_t item_size = size; /* size of items in bytes */ if(block_index > sizeof(size_t)) bytes_in = sizeof(size_t); @@ -1133,7 +1156,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t } for (i = 0; i < size && (s[i] || pad != H5T_STR_NULLTERM); i++) { HDmemcpy(&tempuchar, &s[i], sizeof(unsigned char)); - if (1 != HDfwrite(&tempuchar, size, 1, stream)) + if (1 != HDfwrite(&tempuchar, sizeof(unsigned char), 1, stream)) H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed"); } /* i */ } /* for (block_index = 0; block_index < block_nelmts; block_index++) */ @@ -1141,16 +1164,21 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t break; case H5T_COMPOUND: { - unsigned j; - hid_t memb; + int snmembs; unsigned nmembs; - size_t offset; - nmembs = H5Tget_nmembers(tid); + if((snmembs = H5Tget_nmembers(tid)) < 0) + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers of compound failed"); + nmembs = (unsigned)snmembs; for (block_index = 0; block_index < block_nelmts; block_index++) { + unsigned j; + mem = ((unsigned char*)_mem) + block_index * size; for (j = 0; j < nmembs; j++) { + hid_t memb; + size_t offset; + offset = H5Tget_member_offset(tid, j); memb = H5Tget_member_type(tid, j); @@ -1165,7 +1193,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t case H5T_ARRAY: { int k, ndims; - hsize_t i, dims[H5S_MAX_RANK], temp_nelmts, nelmts; + hsize_t dims[H5S_MAX_RANK], temp_nelmts, nelmts; hid_t memb; /* get the array's base datatype for each element */ @@ -1192,7 +1220,6 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t break; case H5T_VLEN: { - unsigned int i; hsize_t nelmts; hid_t memb; @@ -1213,7 +1240,8 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t break; case H5T_REFERENCE: { - if (H5Tequal(tid, H5T_STD_REF_DSETREG)) { + if (size == H5R_DSET_REG_REF_BUF_SIZE) { + /* if (H5Tequal(tid, H5T_STD_REF_DSETREG)) */ if (region_output) { /* region data */ hid_t region_id, region_space; @@ -1237,7 +1265,8 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t } } /* end if (region_output... */ } - else if (H5Tequal(tid, H5T_STD_REF_OBJ)) { + else if (size == H5R_OBJ_REF_BUF_SIZE) { + /* if (H5Tequal(tid, H5T_STD_REF_OBJ)) */ ; } } @@ -1276,10 +1305,9 @@ render_bin_output_region_data_blocks(hid_t region_id, FILE *stream, hsize_t *start = NULL; hsize_t *count = NULL; hsize_t numelem; - hsize_t numindex; hsize_t total_size[H5S_MAX_RANK]; int jndx; - int type_size; + size_t type_size; hid_t mem_space = -1; void *region_buf = NULL; int blkndx; @@ -1370,15 +1398,17 @@ render_bin_output_region_blocks(hid_t region_space, hid_t region_id, FILE *stream, hid_t container) { HERR_INIT(hbool_t, TRUE) - hssize_t nblocks; + hssize_t snblocks; + hsize_t nblocks; hsize_t alloc_size; - hsize_t *ptdata = NULL; + hsize_t *ptdata; int ndims; hid_t dtype; hid_t type_id; - if((nblocks = H5Sget_select_hyper_nblocks(region_space)) <= 0) + if((snblocks = H5Sget_select_hyper_nblocks(region_space)) <= 0) H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_select_hyper_nblocks failed"); + nblocks = (hsize_t)snblocks; /* Print block information */ if((ndims = H5Sget_simple_extent_ndims(region_space)) < 0) @@ -1434,13 +1464,12 @@ render_bin_output_region_blocks(hid_t region_space, hid_t region_id, * hssize_t npoints is the number of points in the region *------------------------------------------------------------------------- */ -int +static int render_bin_output_region_data_points(hid_t region_space, hid_t region_id, FILE *stream, hid_t container, - int ndims, hid_t type_id, hssize_t npoints, hsize_t *ptdata) + int ndims, hid_t type_id, hssize_t npoints) { hsize_t *dims1 = NULL; - int jndx; int type_size; hid_t mem_space = -1; void *region_buf = NULL; @@ -1496,8 +1525,6 @@ render_bin_output_region_points(hid_t region_space, hid_t region_id, { HERR_INIT(hbool_t, TRUE) hssize_t npoints; - hsize_t alloc_size; - hsize_t *ptdata; int ndims; hid_t dtype; hid_t type_id; @@ -1509,15 +1536,6 @@ render_bin_output_region_points(hid_t region_space, hid_t region_id, if((ndims = H5Sget_simple_extent_ndims(region_space)) < 0) H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); - alloc_size = npoints * ndims * sizeof(ptdata[0]); - HDassert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/ - if(NULL == (ptdata = (hsize_t *)HDmalloc((size_t) alloc_size))) - HGOTO_ERROR(FALSE, H5E_tools_min_id_g, "Could not allocate buffer for ptdata"); - - H5_CHECK_OVERFLOW(npoints, hssize_t, hsize_t); - if(H5Sget_select_elem_pointlist(region_space, (hsize_t) 0, (hsize_t) npoints, ptdata) < 0) - HGOTO_ERROR(FALSE, H5E_tools_min_id_g, "H5Sget_select_elem_pointlist failed"); - if((dtype = H5Dget_type(region_id)) < 0) HGOTO_ERROR(FALSE, H5E_tools_min_id_g, "H5Dget_type failed"); @@ -1525,11 +1543,9 @@ render_bin_output_region_points(hid_t region_space, hid_t region_id, HGOTO_ERROR(FALSE, H5E_tools_min_id_g, "H5Tget_native_type failed"); render_bin_output_region_data_points(region_space, region_id, - stream, container, ndims, type_id, npoints, ptdata); + stream, container, ndims, type_id, npoints); done: - HDfree(ptdata); - if(H5Tclose(type_id) < 0) HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h index 1a2b81c..8e5b9c8 100644 --- a/tools/lib/h5tools.h +++ b/tools/lib/h5tools.h @@ -36,6 +36,12 @@ #define H5TOOLS_DUMP_MAX_RANK H5S_MAX_RANK +/* Stream macros */ +#define FLUSHSTREAM(S) if(S != NULL) HDfflush(S) +#define PRINTSTREAM(S, F, ...) if(S != NULL) HDfprintf(S, F, __VA_ARGS__) +#define PRINTVALSTREAM(S, V) if(S != NULL) HDfprintf(S, V) +#define PUTSTREAM(X,S) if(S != NULL) HDfputs(X, S); + /* * Strings for output - these were duplicated from the h5dump.h * file in order to support region reference data display @@ -533,6 +539,7 @@ H5TOOLS_DLLVAR int packed_bits_num; /* number of packed bits to display H5TOOLS_DLLVAR int packed_data_offset; /* offset of packed bits to display */ H5TOOLS_DLLVAR int packed_data_length; /* lengtht of packed bits to display */ H5TOOLS_DLLVAR unsigned long long packed_data_mask; /* mask in which packed bits to display */ +H5TOOLS_DLLVAR FILE *rawattrstream; /* output stream for raw attribute data */ H5TOOLS_DLLVAR FILE *rawdatastream; /* output stream for raw data */ H5TOOLS_DLLVAR FILE *rawoutstream; /* output stream for raw output */ H5TOOLS_DLLVAR FILE *rawerrorstream; /* output stream for raw error */ diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c index 33fef3c..e1f71eb 100644 --- a/tools/lib/h5tools_dump.c +++ b/tools/lib/h5tools_dump.c @@ -284,9 +284,9 @@ h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t contai *to the ctx->size_last_dim. */ /* binary dump */ - if (bin_output) { + if (bin_output && (rawdatastream != NULL)) { if (render_bin_output(rawdatastream, container, type, _mem, nelmts) < 0) { - HDfprintf(rawoutstream,"\nError in writing binary stream\n"); + PRINTVALSTREAM(rawoutstream, "\nError in writing binary stream\n"); } } /* end if */ else { @@ -303,7 +303,7 @@ h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t contai */ curr_pos = ctx->sm_pos; - if (region_output && H5Tequal(type, H5T_STD_REF_DSETREG)) { + if (region_output && (size == H5R_DSET_REG_REF_BUF_SIZE)) { for (i = 0; i < nelmts; i++, ctx->cur_elmt++, elmt_counter++) { void* memref = mem + i * size; char ref_name[1024]; @@ -1838,7 +1838,7 @@ h5tools_dump_mem(FILE *stream, const h5tool_format_t *info, h5tools_context_t *c if (H5Sis_simple(space) <= 0) H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sis_simple failed") - H5_LEAVE(h5tools_dump_simple_mem(stream, info, ctx, obj_id, type, space, mem)) + H5_LEAVE(h5tools_dump_simple_mem(rawattrstream, info, ctx, obj_id, type, space, mem)) CATCH return ret_value; diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index 11850f2..b46dc18 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -700,7 +700,8 @@ char * h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t container, hid_t type, void *vp, h5tools_context_t *ctx) { - size_t n, offset, size=0, nelmts, start; + size_t nsize, offset, size=0, nelmts, start; + H5T_sign_t nsign; char *name; unsigned char *ucp_vp = (unsigned char *)vp; char *cp_vp = (char *)vp; @@ -730,15 +731,16 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai /* Append value depending on data type */ start = h5tools_str_len(str); + nsize = H5Tget_size(type); + nsign = H5Tget_sign(type); if (info->raw) { size_t i; - n = H5Tget_size(type); - if (1 == n) { + if (1 == nsize) { h5tools_str_append(str, OPT(info->fmt_raw, "0x%02x"), ucp_vp[0]); } else { - for (i = 0; i < n; i++) { + for (i = 0; i < nsize; i++) { if (i) h5tools_str_append(str, ":"); h5tools_str_append(str, OPT(info->fmt_raw, "%02x"), ucp_vp[i]); @@ -750,20 +752,23 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai return NULL; switch (type_class) { case H5T_FLOAT: - if (H5Tequal(type, H5T_NATIVE_FLOAT)) { + if (sizeof(float) == nsize) { + /* if (H5Tequal(type, H5T_NATIVE_FLOAT)) */ float tempfloat; HDmemcpy(&tempfloat, vp, sizeof(float)); h5tools_str_append(str, OPT(info->fmt_float, "%g"), tempfloat); } - else if (H5Tequal(type, H5T_NATIVE_DOUBLE)) { + else if (sizeof(double) == nsize) { + /* if (H5Tequal(type, H5T_NATIVE_DOUBLE)) */ double tempdouble; HDmemcpy(&tempdouble, vp, sizeof(double)); h5tools_str_append(str, OPT(info->fmt_double, "%g"), tempdouble); #if H5_SIZEOF_LONG_DOUBLE !=0 } - else if (H5Tequal(type, H5T_NATIVE_LDOUBLE)) { + else if (sizeof(long double) == nsize) { + /* if (H5Tequal(type, H5T_NATIVE_LDOUBLE)) */ long double templdouble; HDmemcpy(&templdouble, vp, sizeof(long double)); @@ -848,147 +853,140 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai } break; case H5T_INTEGER: - if (H5Tequal(type, H5T_NATIVE_INT)) { - HDmemcpy(&tempint, vp, sizeof(int)); - if (packed_bits_num) { - if (packed_data_offset >= 8 * sizeof(int)) - tempint = 0; - else - tempint = (tempint >> packed_data_offset) & packed_data_mask; - } - h5tools_str_append(str, OPT(info->fmt_int, "%d"), tempint); - } - else if (H5Tequal(type, H5T_NATIVE_UINT)) { - HDmemcpy(&tempuint, vp, sizeof(unsigned int)); - if (packed_bits_num) { - if (packed_data_offset >= 8 * sizeof(unsigned int)) - tempuint = 0; - else - tempuint = (tempuint >> packed_data_offset) & packed_data_mask; - } - h5tools_str_append(str, OPT(info->fmt_uint, "%u"), tempuint); - } - else if (info->ascii && (H5Tequal(type, H5T_NATIVE_SCHAR) || H5Tequal(type, H5T_NATIVE_UCHAR))) { - h5tools_print_char(str, info, (char) (*ucp_vp)); - } - else if (H5Tequal(type, H5T_NATIVE_SCHAR)) { - signed char tempchar; - HDmemcpy(&tempchar, cp_vp, sizeof(char)); - if (packed_bits_num) { - if (packed_data_offset >= 8 * sizeof(char)) - tempchar = 0; - else - tempchar = (tempchar >> packed_data_offset) & packed_data_mask; - } -#ifdef H5_VMS - h5tools_str_append(str, OPT(info->fmt_schar, "%hd"), tempchar); -#else - h5tools_str_append(str, OPT(info->fmt_schar, "%hhd"), tempchar); -#endif - } - else if (H5Tequal(type, H5T_NATIVE_UCHAR)) { - unsigned char tempuchar; - HDmemcpy(&tempuchar, ucp_vp, sizeof(unsigned char)); - if (packed_bits_num) { - if (packed_data_offset >= 8 * sizeof(unsigned char)) - tempuchar = 0; - else - tempuchar = (tempuchar >> packed_data_offset) & packed_data_mask; - } - h5tools_str_append(str, OPT(info->fmt_uchar, "%u"), tempuchar); - } - else if (H5Tequal(type, H5T_NATIVE_SHORT)) { - short tempshort; - - HDmemcpy(&tempshort, vp, sizeof(short)); - if (packed_bits_num) { - if (packed_data_offset >= 8 * sizeof(short)) - tempshort = 0; - else - tempshort = (tempshort >> packed_data_offset) & packed_data_mask; - } - h5tools_str_append(str, OPT(info->fmt_short, "%d"), tempshort); - } - else if (H5Tequal(type, H5T_NATIVE_USHORT)) { - unsigned short tempushort; - - HDmemcpy(&tempushort, vp, sizeof(unsigned short)); - if (packed_bits_num) { - if (packed_data_offset >= 8 * sizeof(unsigned short)) - tempushort = 0; - else - tempushort = (tempushort >> packed_data_offset) & packed_data_mask; - } - h5tools_str_append(str, OPT(info->fmt_ushort, "%u"), tempushort); - } - else if (H5Tequal(type, H5T_NATIVE_LONG)) { - HDmemcpy(&templong, vp, sizeof(long)); - if (packed_bits_num) { - if (packed_data_offset >= 8 * sizeof(long)) - templong = 0; - else - templong = (templong >> packed_data_offset) & packed_data_mask; + if (sizeof(char) == nsize) { + /* if ((H5Tequal(type, H5T_NATIVE_SCHAR) || H5Tequal(type, H5T_NATIVE_UCHAR))) */ + if (info->ascii) { + h5tools_print_char(str, info, (char) (*ucp_vp)); } - h5tools_str_append(str, OPT(info->fmt_long, "%ld"), templong); - } - else if (H5Tequal(type, H5T_NATIVE_ULONG)) { - HDmemcpy(&tempulong, vp, sizeof(unsigned long)); - if (packed_bits_num) { - if (packed_data_offset >= 8 * sizeof(unsigned long)) - tempulong = 0; - else - tempulong = (tempulong >> packed_data_offset) & packed_data_mask; + else if(H5T_SGN_NONE == nsign) { + /* if (H5Tequal(type, H5T_NATIVE_UCHAR)) */ + unsigned char tempuchar; + HDmemcpy(&tempuchar, ucp_vp, sizeof(unsigned char)); + if (packed_bits_num) { + if (packed_data_offset >= 8 * sizeof(unsigned char)) + tempuchar = 0; + else + tempuchar = (tempuchar >> packed_data_offset) & packed_data_mask; + } + h5tools_str_append(str, OPT(info->fmt_uchar, "%u"), tempuchar); } - h5tools_str_append(str, OPT(info->fmt_ulong, "%lu"), tempulong); - } - else if (H5Tequal(type, H5T_NATIVE_LLONG)) { - HDmemcpy(&templlong, vp, sizeof(long long)); - if (packed_bits_num) { - if (packed_data_offset >= 8 * sizeof(long long)) - templlong = 0; - else - templlong = (templlong >> packed_data_offset) & packed_data_mask; + else { + /* if (H5Tequal(type, H5T_NATIVE_SCHAR)) */ + signed char tempchar; + HDmemcpy(&tempchar, cp_vp, sizeof(char)); + if (packed_bits_num) { + if (packed_data_offset >= 8 * sizeof(char)) + tempchar = 0; + else + tempchar = (tempchar >> packed_data_offset) & packed_data_mask; + } + #ifdef H5_VMS + h5tools_str_append(str, OPT(info->fmt_schar, "%hd"), tempchar); + #else + h5tools_str_append(str, OPT(info->fmt_schar, "%hhd"), tempchar); + #endif } - h5tools_str_append(str, OPT(info->fmt_llong, fmt_llong), templlong); - } - else if (H5Tequal(type, H5T_NATIVE_ULLONG)) { - HDmemcpy(&tempullong, vp, sizeof(unsigned long long)); - if (packed_bits_num) { - if (packed_data_offset >= 8 * sizeof(unsigned long long)) - tempullong = 0; - else - tempullong = (tempullong >> packed_data_offset) & packed_data_mask; + } /* end if (sizeof(char) == nsize) */ + else if (sizeof(int) == nsize) { + if(H5T_SGN_NONE == nsign) { + /* if (H5Tequal(type, H5T_NATIVE_UINT)) */ + HDmemcpy(&tempuint, vp, sizeof(unsigned int)); + if (packed_bits_num) { + if (packed_data_offset >= 8 * sizeof(unsigned int)) + tempuint = 0; + else + tempuint = (tempuint >> packed_data_offset) & packed_data_mask; + } + h5tools_str_append(str, OPT(info->fmt_uint, "%u"), tempuint); } - h5tools_str_append(str, OPT(info->fmt_ullong, fmt_ullong), tempullong); - } - else if (H5Tequal(type, H5T_NATIVE_HSSIZE)) { - if (sizeof(hssize_t) == sizeof(int)) { + else { + /* if (H5Tequal(type, H5T_NATIVE_INT)) */ HDmemcpy(&tempint, vp, sizeof(int)); + if (packed_bits_num) { + if (packed_data_offset >= 8 * sizeof(int)) + tempint = 0; + else + tempint = (tempint >> packed_data_offset) & packed_data_mask; + } h5tools_str_append(str, OPT(info->fmt_int, "%d"), tempint); } - else if (sizeof(hssize_t) == sizeof(long)) { - HDmemcpy(&templong, vp, sizeof(long)); - h5tools_str_append(str, OPT(info->fmt_long, "%ld"), templong); + } /* end if (sizeof(int) == nsize) */ + else if (sizeof(short) == nsize) { + if(H5T_SGN_NONE == nsign) { + /* if (H5Tequal(type, H5T_NATIVE_USHORT)) */ + unsigned short tempushort; + + HDmemcpy(&tempushort, vp, sizeof(unsigned short)); + if (packed_bits_num) { + if (packed_data_offset >= 8 * sizeof(unsigned short)) + tempushort = 0; + else + tempushort = (tempushort >> packed_data_offset) & packed_data_mask; + } + h5tools_str_append(str, OPT(info->fmt_ushort, "%u"), tempushort); } else { - HDmemcpy(&templlong, vp, sizeof(long long)); - h5tools_str_append(str, OPT(info->fmt_llong, fmt_llong), templlong); - } - } - else if (H5Tequal(type, H5T_NATIVE_HSIZE)) { - if (sizeof(hsize_t) == sizeof(int)) { - HDmemcpy(&tempuint, vp, sizeof(unsigned int)); - h5tools_str_append(str, OPT(info->fmt_uint, "%u"), tempuint); + /* if (H5Tequal(type, H5T_NATIVE_SHORT)) */ + short tempshort; + + HDmemcpy(&tempshort, vp, sizeof(short)); + if (packed_bits_num) { + if (packed_data_offset >= 8 * sizeof(short)) + tempshort = 0; + else + tempshort = (tempshort >> packed_data_offset) & packed_data_mask; + } + h5tools_str_append(str, OPT(info->fmt_short, "%d"), tempshort); } - else if (sizeof(hsize_t) == sizeof(long)) { - HDmemcpy(&tempulong, vp, sizeof(long)); + } /* end if (sizeof(short) == nsize) */ + else if (sizeof(long) == nsize) { + if(H5T_SGN_NONE == nsign) { + /* if (H5Tequal(type, H5T_NATIVE_ULONG)) */ + HDmemcpy(&tempulong, vp, sizeof(unsigned long)); + if (packed_bits_num) { + if (packed_data_offset >= 8 * sizeof(unsigned long)) + tempulong = 0; + else + tempulong = (tempulong >> packed_data_offset) & packed_data_mask; + } h5tools_str_append(str, OPT(info->fmt_ulong, "%lu"), tempulong); } else { + /* if (H5Tequal(type, H5T_NATIVE_LONG)) */ + HDmemcpy(&templong, vp, sizeof(long)); + if (packed_bits_num) { + if (packed_data_offset >= 8 * sizeof(long)) + templong = 0; + else + templong = (templong >> packed_data_offset) & packed_data_mask; + } + h5tools_str_append(str, OPT(info->fmt_long, "%ld"), templong); + } + } /* end if (sizeof(long) == nsize) */ + else if (sizeof(long long) == nsize) { + if(H5T_SGN_NONE == nsign) { + /* if (H5Tequal(type, H5T_NATIVE_ULLONG)) */ HDmemcpy(&tempullong, vp, sizeof(unsigned long long)); + if (packed_bits_num) { + if (packed_data_offset >= 8 * sizeof(unsigned long long)) + tempullong = 0; + else + tempullong = (tempullong >> packed_data_offset) & packed_data_mask; + } h5tools_str_append(str, OPT(info->fmt_ullong, fmt_ullong), tempullong); } - } + else { + /* if (H5Tequal(type, H5T_NATIVE_LLONG)) */ + HDmemcpy(&templlong, vp, sizeof(long long)); + if (packed_bits_num) { + if (packed_data_offset >= 8 * sizeof(long long)) + templlong = 0; + else + templlong = (templlong >> packed_data_offset) & packed_data_mask; + } + h5tools_str_append(str, OPT(info->fmt_llong, fmt_llong), templlong); + } + } /* end if (sizeof(long long) == nsize) */ break; case H5T_COMPOUND: if(ctx->cmpd_listv) { /* there is */ @@ -1089,75 +1087,71 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai } else { size_t i; - n = H5Tget_size(type); - if (1 == n) { + if (1 == nsize) { h5tools_str_append(str, "0x%02x", ucp_vp[0]); } else { - for (i = 0; i < n; i++) + for (i = 0; i < nsize; i++) h5tools_str_append(str, "%s%02x", i ? ":" : "", ucp_vp[i]); } } } break; case H5T_REFERENCE: - if (H5Tequal(type, H5T_STD_REF_DSETREG)) { - if (h5tools_str_is_zero(vp, H5Tget_size(type))) { - h5tools_str_append(str, "NULL"); - } - else { - h5tools_str_sprint_region(str, info, container, vp); - } + if (h5tools_str_is_zero(vp, nsize)) { + h5tools_str_append(str, "NULL"); } - else if (H5Tequal(type, H5T_STD_REF_OBJ)) { - /* - * Object references -- show the type and OID of the referenced - * object. - */ - if (h5tools_str_is_zero(vp, H5Tget_size(type))) { - h5tools_str_append(str, "NULL"); + else { + if (nsize == H5R_DSET_REG_REF_BUF_SIZE) { + /* if (H5Tequal(type, H5T_STD_REF_DSETREG)) */ + h5tools_str_sprint_region(str, info, container, vp); } - else { - H5O_info_t oi; - const char *path; - - obj = H5Rdereference2(container, H5P_DEFAULT, H5R_OBJECT, vp); - H5Oget_info(obj, &oi); - - /* Print object type and close object */ - switch (oi.type) { - case H5O_TYPE_GROUP: - h5tools_str_append(str, H5_TOOLS_GROUP); - break; - - case H5O_TYPE_DATASET: - h5tools_str_append(str, H5_TOOLS_DATASET); - break; - - case H5O_TYPE_NAMED_DATATYPE: - h5tools_str_append(str, H5_TOOLS_DATATYPE); - break; - - default: - h5tools_str_append(str, "%u-", (unsigned) oi.type); - break; - } /* end switch */ - H5Oclose(obj); - - /* Print OID */ - if (info->obj_hidefileno) - h5tools_str_append(str, info->obj_format, oi.addr); - else - h5tools_str_append(str, info->obj_format, oi.fileno, oi.addr); - - /* Print name */ - path = lookup_ref_path(*(haddr_t *) vp); - if (path) { - h5tools_str_append(str, " "); - h5tools_str_append(str, path); - h5tools_str_append(str, " "); - } /* end if */ - } /* end else */ + else if (nsize == H5R_OBJ_REF_BUF_SIZE) { + /* if (H5Tequal(type, H5T_STD_REF_OBJ)) */ + /* + * Object references -- show the type and OID of the referenced + * object. + */ + H5O_info_t oi; + const char *path; + + obj = H5Rdereference2(container, H5P_DEFAULT, H5R_OBJECT, vp); + H5Oget_info(obj, &oi); + + /* Print object type and close object */ + switch (oi.type) { + case H5O_TYPE_GROUP: + h5tools_str_append(str, H5_TOOLS_GROUP); + break; + + case H5O_TYPE_DATASET: + h5tools_str_append(str, H5_TOOLS_DATASET); + break; + + case H5O_TYPE_NAMED_DATATYPE: + h5tools_str_append(str, H5_TOOLS_DATATYPE); + break; + + default: + h5tools_str_append(str, "%u-", (unsigned) oi.type); + break; + } /* end switch */ + H5Oclose(obj); + + /* Print OID */ + if (info->obj_hidefileno) + h5tools_str_append(str, info->obj_format, oi.addr); + else + h5tools_str_append(str, info->obj_format, oi.fileno, oi.addr); + + /* Print name */ + path = lookup_ref_path(*(haddr_t *) vp); + if (path) { + h5tools_str_append(str, " "); + h5tools_str_append(str, path); + h5tools_str_append(str, " "); + } /* end if */ + } /* end else if (H5Tequal(type, H5T_STD_REF_OBJ)) */ } break; case H5T_ARRAY: @@ -1271,12 +1265,11 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai { /* All other types get printed as hexadecimal */ size_t i; - n = H5Tget_size(type); - if (1 == n) { + if (1 == nsize) { h5tools_str_append(str, "0x%02x", ucp_vp[0]); } else { - for (i = 0; i < n; i++) + for (i = 0; i < nsize; i++) h5tools_str_append(str, "%s%02x", i ? ":" : "", ucp_vp[i]); } } diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c index 79322bc..d7c5adb 100644 --- a/tools/lib/h5tools_utils.c +++ b/tools/lib/h5tools_utils.c @@ -152,8 +152,9 @@ error_msg(const char *fmt, ...) va_list ap; HDva_start(ap, fmt); - HDfflush(rawdatastream); - HDfflush(rawoutstream); + FLUSHSTREAM(rawattrstream); + FLUSHSTREAM(rawdatastream); + FLUSHSTREAM(rawoutstream); HDfprintf(rawerrorstream, "%s error: ", h5tools_getprogname()); HDvfprintf(rawerrorstream, fmt, ap); @@ -182,8 +183,9 @@ warn_msg(const char *fmt, ...) va_list ap; HDva_start(ap, fmt); - HDfflush(rawdatastream); - HDfflush(rawoutstream); + FLUSHSTREAM(rawattrstream); + FLUSHSTREAM(rawdatastream); + FLUSHSTREAM(rawoutstream); HDfprintf(rawerrorstream, "%s warning: ", h5tools_getprogname()); HDvfprintf(rawerrorstream, fmt, ap); HDva_end(ap); @@ -275,6 +277,8 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti opt_opt = '?'; } + else + opt_arg = NULL; } else { if (arg[len] == '=') { @@ -388,7 +392,7 @@ indentation(int x) { if (x < h5tools_nCols) { while (x-- > 0) - HDfprintf(rawoutstream, " "); + PRINTVALSTREAM(rawoutstream, " "); } else { HDfprintf(rawerrorstream, "error: the indentation exceeds the number of cols.\n"); @@ -414,7 +418,7 @@ indentation(int x) void print_version(const char *progname) { - HDfprintf(rawoutstream, "%s: Version %u.%u.%u%s%s\n", + PRINTSTREAM(rawoutstream, "%s: Version %u.%u.%u%s%s\n", progname, H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE, ((char *)H5_VERS_SUBRELEASE)[0] ? "-" : "", H5_VERS_SUBRELEASE); } @@ -494,9 +498,9 @@ dump_table(char* tablename, table_t *table) { unsigned u; - HDfprintf(rawoutstream,"%s: # of entries = %d\n", tablename,table->nobjs); + PRINTSTREAM(rawoutstream,"%s: # of entries = %d\n", tablename,table->nobjs); for (u = 0; u < table->nobjs; u++) - HDfprintf(rawoutstream,"%a %s %d %d\n", table->objs[u].objno, + PRINTSTREAM(rawoutstream,"%a %s %d %d\n", table->objs[u].objno, table->objs[u].objname, table->objs[u].displayed, table->objs[u].recorded); } diff --git a/tools/misc/CMakeLists.txt b/tools/misc/CMakeLists.txt index 909b2ca..e778d2f 100644 --- a/tools/misc/CMakeLists.txt +++ b/tools/misc/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.6) +cmake_minimum_required (VERSION 2.8.10) PROJECT (HDF5_TOOLS_MISC) #----------------------------------------------------------------------------- @@ -62,7 +62,7 @@ IF (BUILD_TESTING) SET_TARGET_PROPERTIES (h5repart_test PROPERTIES FOLDER tools) # -------------------------------------------------------------------- - # Copy all the HDF5 files from the test directory into the source directory + # Copy all the HDF5 files from the source directory into the test directory # -------------------------------------------------------------------- SET (HDF5_REFERENCE_TEST_FILES family_file00000.h5 @@ -97,37 +97,43 @@ IF (BUILD_TESTING) ENDFOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES}) SET (HDF5_MKGRP_TEST_FILES - #h5mkgrp_help + #h5mkgrp_help.txt #h5mkgrp_version - h5mkgrp_single - h5mkgrp_single_latest - h5mkgrp_several - h5mkgrp_several_latest - h5mkgrp_nested - h5mkgrp_nested_latest - h5mkgrp_nested_mult - h5mkgrp_nested_mult_latest + 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 ) - FILE (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/../testfiles") + # make test dir + FILE (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") + FOREACH (h5_mkgrp_file ${HDF5_MKGRP_TEST_FILES}) - SET (dest "${PROJECT_BINARY_DIR}/${h5_mkgrp_file}") + SET (dest "${PROJECT_BINARY_DIR}/testfiles/${h5_mkgrp_file}") #MESSAGE (STATUS " Copying ${h5_mkgrp_file}") ADD_CUSTOM_COMMAND ( TARGET h5mkgrp POST_BUILD - COMMAND ${XLATE_UTILITY} - ARGS ${HDF5_TOOLS_SRC_DIR}/testfiles/${h5_mkgrp_file}.ls ${dest}.ls -l3 + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different ${HDF5_TOOLS_SRC_DIR}/testfiles/${h5_mkgrp_file} ${dest} ) ENDFOREACH (h5_mkgrp_file ${HDF5_MKGRP_TEST_FILES}) ADD_CUSTOM_COMMAND ( TARGET h5mkgrp POST_BUILD - COMMAND ${XLATE_UTILITY} - ARGS ${PROJECT_SOURCE_DIR}/testfiles/h5mkgrp_help.txt ${PROJECT_BINARY_DIR}/h5mkgrp_help.txt -l0 + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/testfiles/h5mkgrp_help.txt ${PROJECT_BINARY_DIR}/testfiles/h5mkgrp_help.txt ) - CONFIGURE_FILE (${PROJECT_SOURCE_DIR}/testfiles/h5mkgrp_version.txt.in ${PROJECT_BINARY_DIR}/h5mkgrp_version.txt @ONLY) + CONFIGURE_FILE (${PROJECT_SOURCE_DIR}/testfiles/h5mkgrp_version.txt.in ${PROJECT_BINARY_DIR}/testfiles/h5mkgrp_version.txt @ONLY) ############################################################################## ############################################################################## @@ -136,102 +142,71 @@ IF (BUILD_TESTING) ############################################################################## MACRO (ADD_H5_TEST resultfile resultcode resultoption) - IF (NOT ${resultoption} STREQUAL " ") - ADD_TEST ( - NAME H5MKGRP-clear-${resultfile}${resultoption} - COMMAND ${CMAKE_COMMAND} - -E remove - ${PROJECT_BINARY_DIR}/../testfiles/${resultfile}.h5 - ${PROJECT_BINARY_DIR}/${resultfile}.out - ${PROJECT_BINARY_DIR}/${resultfile}.out.err - ) - IF (NOT "${last_test}" STREQUAL "") - SET_TESTS_PROPERTIES (H5MKGRP-clear-${resultfile}${resultoption} PROPERTIES DEPENDS ${last_test}) - ENDIF (NOT "${last_test}" STREQUAL "") - ADD_TEST ( - NAME H5MKGRP-${resultfile}${resultoption} - COMMAND $ ${resultoption} ${PROJECT_BINARY_DIR}/../testfiles/${resultfile}.h5 ${ARGN} - ) - SET_TESTS_PROPERTIES (H5MKGRP-${resultfile}${resultoption} PROPERTIES DEPENDS H5MKGRP-clear-${resultfile}${resultoption}) - SET (last_test "H5MKGRP-${resultfile}${resultoption}") - IF (NOT HDF5_ENABLE_USING_MEMCHECKER) - ADD_TEST ( - NAME H5MKGRP-h5ls-${resultfile}${resultoption} - COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=-v;-r;../testfiles/${resultfile}.h5" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -D "TEST_OUTPUT=${resultfile}.out" - -D "TEST_EXPECT=${resultcode}" - -D "TEST_MASK_MOD=true" - -D "TEST_REFERENCE=${resultfile}.ls" - -P "${HDF5_RESOURCES_DIR}/runTest.cmake" - ) - SET_TESTS_PROPERTIES (H5MKGRP-h5ls-${resultfile}${resultoption} PROPERTIES DEPENDS H5MKGRP-${resultfile}${resultoption}) - SET (last_test "H5MKGRP-h5ls-${resultfile}${resultoption}") - ENDIF (NOT HDF5_ENABLE_USING_MEMCHECKER) - ELSE (NOT ${resultoption} STREQUAL " ") + IF (NOT HDF5_ENABLE_USING_MEMCHECKER) ADD_TEST ( - NAME H5MKGRP-clear-${resultfile} + NAME H5MKGRP-${resultfile}-clear-objects COMMAND ${CMAKE_COMMAND} -E remove - ${PROJECT_BINARY_DIR}/../testfiles/${resultfile}.h5 - ${PROJECT_BINARY_DIR}/${resultfile}.out - ${PROJECT_BINARY_DIR}/${resultfile}.out.err + ${resultfile}.h5 + ${resultfile}.out + ${resultfile}.out.err ) + 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 $ ${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-clear-${resultfile} PROPERTIES DEPENDS ${last_test}) + 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} - COMMAND $ ${PROJECT_BINARY_DIR}/../testfiles/${resultfile}.h5 ${ARGN} + NAME H5MKGRP-${resultfile}-h5ls + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -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 "${HDF5_RESOURCES_DIR}/runTest.cmake" ) - SET_TESTS_PROPERTIES (H5MKGRP-${resultfile} PROPERTIES DEPENDS H5MKGRP-clear-${resultfile}) - SET (last_test "H5MKGRP-${resultfile}") - IF (NOT HDF5_ENABLE_USING_MEMCHECKER) - ADD_TEST ( - NAME H5MKGRP-h5ls-${resultfile} - COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=-v;-r;../testfiles/${resultfile}.h5" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -D "TEST_OUTPUT=${resultfile}.out" - -D "TEST_EXPECT=${resultcode}" - -D "TEST_MASK_MOD=true" - -D "TEST_REFERENCE=${resultfile}.ls" - -P "${HDF5_RESOURCES_DIR}/runTest.cmake" - ) - SET_TESTS_PROPERTIES (H5MKGRP-h5ls-${resultfile} PROPERTIES DEPENDS H5MKGRP-${resultfile}) - SET (last_test "H5MKGRP-h5ls-${resultfile}") - ENDIF (NOT HDF5_ENABLE_USING_MEMCHECKER) - ENDIF (NOT ${resultoption} STREQUAL " ") + 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) - ADD_TEST ( - NAME H5MKGRP_CMP-clear-${resultfile} - COMMAND ${CMAKE_COMMAND} - -E remove - ${PROJECT_BINARY_DIR}/../testfiles/${resultfile}.h5 - ${PROJECT_BINARY_DIR}/${resultfile}.out - ${PROJECT_BINARY_DIR}/${resultfile}.out.err - ) IF (HDF5_ENABLE_USING_MEMCHECKER) ADD_TEST (NAME H5MKGRP_CMP-${resultfile} COMMAND $ ${ARGN}) ELSE (HDF5_ENABLE_USING_MEMCHECKER) ADD_TEST ( + NAME H5MKGRP_CMP-${resultfile}-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + ${resultfile}.h5 + ${resultfile}.out + ${resultfile}.out.err + ) + 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=$" -D "TEST_ARGS:STRING=${ARGN}" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${resultfile}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}.txt" -P "${HDF5_RESOURCES_DIR}/runTest.cmake" ) + SET_TESTS_PROPERTIES (H5MKGRP_CMP-${resultfile} PROPERTIES DEPENDS H5MKGRP_CMP-${resultfile}-clear-objects) ENDIF (HDF5_ENABLE_USING_MEMCHECKER) - SET_TESTS_PROPERTIES (H5MKGRP_CMP-${resultfile} PROPERTIES DEPENDS H5MKGRP_CMP-clear-${resultfile}) ENDMACRO (ADD_H5_CMP resultfile resultcode) ############################################################################## @@ -242,71 +217,115 @@ IF (BUILD_TESTING) # Remove any output file left over from previous test run ADD_TEST ( - NAME h5repart_20K-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - fst_family00000.h5 + 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_20K COMMAND $ -m 20000 family_file%05d.h5 fst_family%05d.h5) - SET_TESTS_PROPERTIES (h5repart_20K PROPERTIES DEPENDS h5repart_20K-clear-objects) + ADD_TEST (NAME H5REPART-h5repart_20K COMMAND $ -m 20000 family_file%05d.h5 fst_family%05d.h5) + SET_TESTS_PROPERTIES (H5REPART-h5repart_20K PROPERTIES DEPENDS H5REPART-clearall-objects) - # Remove any output file left over from previous test run - ADD_TEST ( - NAME h5repart_5K-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - scd_family00000.h5 - scd_family00001.h5 - scd_family00002.h5 - scd_family00003.h5 - ) - SET_TESTS_PROPERTIES (h5repart_5K-clear-objects PROPERTIES DEPENDS h5repart_20K) # repartition family member size to 5 KB. - ADD_TEST (NAME h5repart_5K COMMAND $ -m 5k family_file%05d.h5 scd_family%05d.h5) - SET_TESTS_PROPERTIES (h5repart_5K PROPERTIES DEPENDS h5repart_5K-clear-objects) + ADD_TEST (NAME H5REPART-h5repart_5K COMMAND $ -m 5k family_file%05d.h5 scd_family%05d.h5) + SET_TESTS_PROPERTIES (H5REPART-h5repart_5K PROPERTIES DEPENDS H5REPART-clearall-objects) - # Remove any output file left over from previous test run - ADD_TEST ( - NAME h5repart_sec2-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - family_to_sec2.h5 - ) - SET_TESTS_PROPERTIES (h5repart_sec2-clear-objects PROPERTIES DEPENDS h5repart_5K) # convert family file to sec2 file of 20,000 bytes - ADD_TEST (NAME h5repart_sec2 COMMAND $ -m 20000 -family_to_sec2 family_file%05d.h5 family_to_sec2.h5) - SET_TESTS_PROPERTIES (h5repart_sec2 PROPERTIES DEPENDS h5repart_sec2-clear-objects) + ADD_TEST (NAME H5REPART-h5repart_sec2 COMMAND $ -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_test COMMAND $) - SET_TESTS_PROPERTIES (h5repart_test PROPERTIES DEPENDS h5repart_sec2) + ADD_TEST (NAME H5REPART-h5repart_test COMMAND $) + SET_TESTS_PROPERTIES (H5REPART-h5repart_test PROPERTIES DEPENDS H5REPART-clearall-objects DEPENDS H5REPART-h5repart_20K DEPENDS H5REPART-h5repart_5K DEPENDS 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 0 "-v" single) - ADD_H5_TEST (h5mkgrp_single 0 "-p" single) - ADD_H5_TEST (h5mkgrp_single_latest 0 "-l" latest) + 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 0 "-v" one two) - ADD_H5_TEST (h5mkgrp_several 0 "-p" one two) - ADD_H5_TEST (h5mkgrp_several_latest 0 "-l" one two) + 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 0 "-p" /one/two) - ADD_H5_TEST (h5mkgrp_nested_latest 0 "-lp" /one/two) - ADD_H5_TEST (h5mkgrp_nested_mult 0 "-p" /one/two /three/four) - ADD_H5_TEST (h5mkgrp_nested_mult_latest 0 "-lp" /one/two /three/four) + 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) ENDIF (BUILD_TESTING) ############################################################################## diff --git a/tools/misc/Makefile.in b/tools/misc/Makefile.in index 8c2e1c1..3320276 100644 --- a/tools/misc/Makefile.in +++ b/tools/misc/Makefile.in @@ -288,6 +288,7 @@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ +HAVE_PTHREAD = @HAVE_PTHREAD@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF_CXX = @HDF_CXX@ @@ -339,7 +340,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PARALLEL = @PARALLEL@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ -PTHREAD = @PTHREAD@ RANLIB = @RANLIB@ ROOT = @ROOT@ RUNPARALLEL = @RUNPARALLEL@ diff --git a/tools/misc/h5perf_gentest.c b/tools/misc/h5perf_gentest.c new file mode 100755 index 0000000..6a080d0 --- /dev/null +++ b/tools/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 , Jan. 2013 + ****************************************************************************/ + +#include "hdf5.h" +#include +#include + +#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, 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 (ngrpsdim0) 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; i0) { + 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 /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 +} # Print a line-line message left justified in a field of 70 characters # beginning with the word "Testing". @@ -71,9 +141,7 @@ TOOLTEST() { TESTING $H5MKGRP $@ ( - echo "#############################" - echo " output for '$H5MKGRP $@'" - echo "#############################" + cd $TESTDIR $RUNSERIAL $H5MKGRP_BIN $@ ) > output.out RET=$? @@ -96,17 +164,15 @@ TOOLTEST() # H5LSTEST() { - expect="$INDIR/`basename $1 .h5`.ls" - actual="$OUTDIR/`basename $1 .h5`.out" + 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 $@ ( - echo "#############################" - echo "Expected output for '$H5LS $@'" - echo "#############################" + cd $TESTDIR $RUNSERIAL $H5LS_BIN $H5LS_ARGS $@ ) 2>&1 |sed 's/Modified:.*/Modified: XXXX-XX-XX XX:XX:XX XXX/' >$actual @@ -142,7 +208,7 @@ H5LSTEST() # $* are groups to create RUNTEST() { - FILEOUT=$OUTDIR/$1 + FILEOUT=$1 shift H5MKGRP_ARGS=$1 shift @@ -158,9 +224,8 @@ RUNTEST() # Remove output file created, if the "no cleanup" environment variable is # not defined -echo "FILEOUT=" $FILEOUT if test -z "$HDF5_NOCLEANUP"; then - rm -f $FILEOUT + rm -f $TESTDIR/$FILEOUT fi } @@ -172,16 +237,17 @@ echo "FILEOUT=" $FILEOUT # $* are groups to create CMPTEST() { - FILEOUT=$OUTDIR/$1 - expect="$srcdir/testfiles/`basename $1 .h5`.txt" - actual="$OUTDIR/`basename $1 .h5`.out" - actual_err="$OUTDIR/`basename $1 .h5`.err" + 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 @@ -208,28 +274,30 @@ CMPTEST() ############################################################################## ### 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" -RUNTEST h5mkgrp_version.h5 "-V" +#CMPTEST h5mkgrp_version.h5 "-V" # Create single group at root level RUNTEST h5mkgrp_single.h5 " " single -RUNTEST h5mkgrp_single.h5 "-v" single -RUNTEST h5mkgrp_single.h5 "-p" single -RUNTEST h5mkgrp_single_latest.h5 "-l" latest +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.h5 "-v" one two -RUNTEST h5mkgrp_several.h5 "-p" one two -RUNTEST h5mkgrp_several_latest.h5 "-l" 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.h5 "-p" /one/two -RUNTEST h5mkgrp_nested_latest.h5 "-lp" /one/two -RUNTEST h5mkgrp_nested_mult.h5 "-p" /one/two /three/four -RUNTEST h5mkgrp_nested_mult_latest.h5 "-lp" /one/two /three/four +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 if test $nerrors -eq 0 ; then diff --git a/tools/testfiles/h5dump-help.txt b/tools/testfiles/h5dump-help.txt index 74fc104..40510a4 100644 --- a/tools/testfiles/h5dump-help.txt +++ b/tools/testfiles/h5dump-help.txt @@ -46,6 +46,8 @@ usage: h5dump [OPTIONS] files occur. --no-compact-subset Disable compact form of subsetting and allow the use of "[" in dataset names. + -O F, --ddl=F Output ddl text into file F + Do not use filename F to suppress ddl display Subsetting is available by using the following options with a dataset attribute. Subsetting is done by selecting a hyperslab from the data. diff --git a/tools/testfiles/h5mkgrp_help.ls b/tools/testfiles/h5mkgrp_help.ls deleted file mode 100644 index ad2bd0f..0000000 --- a/tools/testfiles/h5mkgrp_help.ls +++ /dev/null @@ -1,4 +0,0 @@ -############################# -Expected output for 'h5ls ../testfiles/h5mkgrp_help.h5' -############################# -../testfiles/h5mkgrp_help.h5: unable to open file diff --git a/tools/testfiles/h5mkgrp_nested.ls b/tools/testfiles/h5mkgrp_nested.ls deleted file mode 100644 index 472656d..0000000 --- a/tools/testfiles/h5mkgrp_nested.ls +++ /dev/null @@ -1,13 +0,0 @@ -############################# -Expected output for 'h5ls ../testfiles/h5mkgrp_nested.h5' -############################# -Opened "../testfiles/h5mkgrp_nested.h5" with sec2 driver. -/ Group - Location: 1:96 - Links: 1 -/one Group - Location: 1:800 - Links: 1 -/one/two Group - Location: 1:1832 - Links: 1 diff --git a/tools/testfiles/h5mkgrp_nested_latest.ls b/tools/testfiles/h5mkgrp_nested_latest.ls deleted file mode 100644 index c00292d..0000000 --- a/tools/testfiles/h5mkgrp_nested_latest.ls +++ /dev/null @@ -1,16 +0,0 @@ -############################# -Expected output for 'h5ls ../testfiles/h5mkgrp_nested_latest.h5' -############################# -Opened "../testfiles/h5mkgrp_nested_latest.h5" with sec2 driver. -/ Group - Location: 1:48 - Links: 1 - Modified: XXXX-XX-XX XX:XX:XX XXX -/one Group - Location: 1:195 - Links: 1 - Modified: XXXX-XX-XX XX:XX:XX XXX -/one/two Group - Location: 1:342 - Links: 1 - Modified: XXXX-XX-XX XX:XX:XX XXX diff --git a/tools/testfiles/h5mkgrp_nested_lp.ls b/tools/testfiles/h5mkgrp_nested_lp.ls new file mode 100644 index 0000000..1fe8ce8 --- /dev/null +++ b/tools/testfiles/h5mkgrp_nested_lp.ls @@ -0,0 +1,13 @@ +Opened "h5mkgrp_nested_lp.h5" with sec2 driver. +/ Group + Location: 1:48 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX +/one Group + Location: 1:195 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX +/one/two Group + Location: 1:342 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX diff --git a/tools/testfiles/h5mkgrp_nested_mult.ls b/tools/testfiles/h5mkgrp_nested_mult.ls deleted file mode 100644 index 6a22ffd..0000000 --- a/tools/testfiles/h5mkgrp_nested_mult.ls +++ /dev/null @@ -1,19 +0,0 @@ -############################# -Expected output for 'h5ls ../testfiles/h5mkgrp_nested_mult.h5' -############################# -Opened "../testfiles/h5mkgrp_nested_mult.h5" with sec2 driver. -/ Group - Location: 1:96 - Links: 1 -/one Group - Location: 1:800 - Links: 1 -/one/two Group - Location: 1:1832 - Links: 1 -/three Group - Location: 1:2864 - Links: 1 -/three/four Group - Location: 1:3568 - Links: 1 diff --git a/tools/testfiles/h5mkgrp_nested_mult_latest.ls b/tools/testfiles/h5mkgrp_nested_mult_latest.ls deleted file mode 100644 index 0b19ff9..0000000 --- a/tools/testfiles/h5mkgrp_nested_mult_latest.ls +++ /dev/null @@ -1,24 +0,0 @@ -############################# -Expected output for 'h5ls ../testfiles/h5mkgrp_nested_mult_latest.h5' -############################# -Opened "../testfiles/h5mkgrp_nested_mult_latest.h5" with sec2 driver. -/ Group - Location: 1:48 - Links: 1 - Modified: XXXX-XX-XX XX:XX:XX XXX -/one Group - Location: 1:195 - Links: 1 - Modified: XXXX-XX-XX XX:XX:XX XXX -/one/two Group - Location: 1:342 - Links: 1 - Modified: XXXX-XX-XX XX:XX:XX XXX -/three Group - Location: 1:489 - Links: 1 - Modified: XXXX-XX-XX XX:XX:XX XXX -/three/four Group - Location: 1:636 - Links: 1 - Modified: XXXX-XX-XX XX:XX:XX XXX diff --git a/tools/testfiles/h5mkgrp_nested_mult_lp.ls b/tools/testfiles/h5mkgrp_nested_mult_lp.ls new file mode 100644 index 0000000..50380ec --- /dev/null +++ b/tools/testfiles/h5mkgrp_nested_mult_lp.ls @@ -0,0 +1,21 @@ +Opened "h5mkgrp_nested_mult_lp.h5" with sec2 driver. +/ Group + Location: 1:48 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX +/one Group + Location: 1:195 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX +/one/two Group + Location: 1:342 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX +/three Group + Location: 1:489 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX +/three/four Group + Location: 1:636 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX diff --git a/tools/testfiles/h5mkgrp_nested_mult_p.ls b/tools/testfiles/h5mkgrp_nested_mult_p.ls new file mode 100644 index 0000000..f2b3b4b --- /dev/null +++ b/tools/testfiles/h5mkgrp_nested_mult_p.ls @@ -0,0 +1,16 @@ +Opened "h5mkgrp_nested_mult_p.h5" with sec2 driver. +/ Group + Location: 1:96 + Links: 1 +/one Group + Location: 1:800 + Links: 1 +/one/two Group + Location: 1:1832 + Links: 1 +/three Group + Location: 1:2864 + Links: 1 +/three/four Group + Location: 1:3568 + Links: 1 diff --git a/tools/testfiles/h5mkgrp_nested_p.ls b/tools/testfiles/h5mkgrp_nested_p.ls new file mode 100644 index 0000000..3034dbb --- /dev/null +++ b/tools/testfiles/h5mkgrp_nested_p.ls @@ -0,0 +1,10 @@ +Opened "h5mkgrp_nested_p.h5" with sec2 driver. +/ Group + Location: 1:96 + Links: 1 +/one Group + Location: 1:800 + Links: 1 +/one/two Group + Location: 1:1832 + Links: 1 diff --git a/tools/testfiles/h5mkgrp_several.ls b/tools/testfiles/h5mkgrp_several.ls index bbf5c92..68a3f9c 100644 --- a/tools/testfiles/h5mkgrp_several.ls +++ b/tools/testfiles/h5mkgrp_several.ls @@ -1,7 +1,4 @@ -############################# -Expected output for 'h5ls ../testfiles/h5mkgrp_several.h5' -############################# -Opened "../testfiles/h5mkgrp_several.h5" with sec2 driver. +Opened "h5mkgrp_several.h5" with sec2 driver. / Group Location: 1:96 Links: 1 diff --git a/tools/testfiles/h5mkgrp_several_l.ls b/tools/testfiles/h5mkgrp_several_l.ls new file mode 100644 index 0000000..5e1b4be --- /dev/null +++ b/tools/testfiles/h5mkgrp_several_l.ls @@ -0,0 +1,13 @@ +Opened "h5mkgrp_several_l.h5" with sec2 driver. +/ Group + Location: 1:48 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX +/one Group + Location: 1:195 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX +/two Group + Location: 1:342 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX diff --git a/tools/testfiles/h5mkgrp_several_latest.ls b/tools/testfiles/h5mkgrp_several_latest.ls deleted file mode 100644 index a3b5224..0000000 --- a/tools/testfiles/h5mkgrp_several_latest.ls +++ /dev/null @@ -1,16 +0,0 @@ -############################# -Expected output for 'h5ls ../testfiles/h5mkgrp_several_latest.h5' -############################# -Opened "../testfiles/h5mkgrp_several_latest.h5" with sec2 driver. -/ Group - Location: 1:48 - Links: 1 - Modified: XXXX-XX-XX XX:XX:XX XXX -/one Group - Location: 1:195 - Links: 1 - Modified: XXXX-XX-XX XX:XX:XX XXX -/two Group - Location: 1:342 - Links: 1 - Modified: XXXX-XX-XX XX:XX:XX XXX diff --git a/tools/testfiles/h5mkgrp_several_p.ls b/tools/testfiles/h5mkgrp_several_p.ls new file mode 100644 index 0000000..43f1ce5 --- /dev/null +++ b/tools/testfiles/h5mkgrp_several_p.ls @@ -0,0 +1,10 @@ +Opened "h5mkgrp_several_p.h5" with sec2 driver. +/ Group + Location: 1:96 + Links: 1 +/one Group + Location: 1:800 + Links: 1 +/two Group + Location: 1:1832 + Links: 1 diff --git a/tools/testfiles/h5mkgrp_several_v.ls b/tools/testfiles/h5mkgrp_several_v.ls new file mode 100644 index 0000000..a6df87b --- /dev/null +++ b/tools/testfiles/h5mkgrp_several_v.ls @@ -0,0 +1,10 @@ +Opened "h5mkgrp_several_v.h5" with sec2 driver. +/ Group + Location: 1:96 + Links: 1 +/one Group + Location: 1:800 + Links: 1 +/two Group + Location: 1:1832 + Links: 1 diff --git a/tools/testfiles/h5mkgrp_single.ls b/tools/testfiles/h5mkgrp_single.ls index e9932f7..f2bd01c 100644 --- a/tools/testfiles/h5mkgrp_single.ls +++ b/tools/testfiles/h5mkgrp_single.ls @@ -1,7 +1,4 @@ -############################# -Expected output for 'h5ls ../testfiles/h5mkgrp_single.h5' -############################# -Opened "../testfiles/h5mkgrp_single.h5" with sec2 driver. +Opened "h5mkgrp_single.h5" with sec2 driver. / Group Location: 1:96 Links: 1 diff --git a/tools/testfiles/h5mkgrp_single_l.ls b/tools/testfiles/h5mkgrp_single_l.ls new file mode 100644 index 0000000..1763a61 --- /dev/null +++ b/tools/testfiles/h5mkgrp_single_l.ls @@ -0,0 +1,9 @@ +Opened "h5mkgrp_single_l.h5" with sec2 driver. +/ Group + Location: 1:48 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX +/latest Group + Location: 1:195 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX diff --git a/tools/testfiles/h5mkgrp_single_latest.ls b/tools/testfiles/h5mkgrp_single_latest.ls deleted file mode 100644 index b6e6ea4..0000000 --- a/tools/testfiles/h5mkgrp_single_latest.ls +++ /dev/null @@ -1,12 +0,0 @@ -############################# -Expected output for 'h5ls ../testfiles/h5mkgrp_single_latest.h5' -############################# -Opened "../testfiles/h5mkgrp_single_latest.h5" with sec2 driver. -/ Group - Location: 1:48 - Links: 1 - Modified: XXXX-XX-XX XX:XX:XX XXX -/latest Group - Location: 1:195 - Links: 1 - Modified: XXXX-XX-XX XX:XX:XX XXX diff --git a/tools/testfiles/h5mkgrp_single_p.ls b/tools/testfiles/h5mkgrp_single_p.ls new file mode 100644 index 0000000..e82dc31 --- /dev/null +++ b/tools/testfiles/h5mkgrp_single_p.ls @@ -0,0 +1,7 @@ +Opened "h5mkgrp_single_p.h5" with sec2 driver. +/ Group + Location: 1:96 + Links: 1 +/single Group + Location: 1:800 + Links: 1 diff --git a/tools/testfiles/h5mkgrp_single_v.ls b/tools/testfiles/h5mkgrp_single_v.ls new file mode 100644 index 0000000..7360865 --- /dev/null +++ b/tools/testfiles/h5mkgrp_single_v.ls @@ -0,0 +1,7 @@ +Opened "h5mkgrp_single_v.h5" with sec2 driver. +/ Group + Location: 1:96 + Links: 1 +/single Group + Location: 1:800 + Links: 1 diff --git a/tools/testfiles/h5mkgrp_version.ls b/tools/testfiles/h5mkgrp_version.ls deleted file mode 100644 index 907f0ad..0000000 --- a/tools/testfiles/h5mkgrp_version.ls +++ /dev/null @@ -1,4 +0,0 @@ -############################# -Expected output for 'h5ls ../testfiles/h5mkgrp_version.h5' -############################# -../testfiles/h5mkgrp_version.h5: unable to open file diff --git a/tools/testfiles/help-1.ls b/tools/testfiles/help-1.ls index aaba608..491f696 100644 --- a/tools/testfiles/help-1.ls +++ b/tools/testfiles/help-1.ls @@ -1,4 +1,4 @@ -usage: h5ls [OPTIONS] [OBJECTS...] +usage: h5ls [OPTIONS] file[/OBJECT] [file[/[OBJECT]...] OPTIONS -h, -?, --help Print a usage message and exit -a, --address Print raw data address. If dataset is contiguous, address @@ -38,7 +38,7 @@ usage: h5ls [OPTIONS] [OBJECTS...] --vfd=DRIVER Use the specified virtual file driver -x, --hexdump Show raw data in hexadecimal format - OBJECTS + file/OBJECT Each object consists of an HDF5 file name optionally followed by a slash and an object name within the file (if no object is specified within the file then the contents of the root group are displayed). diff --git a/tools/testfiles/help-2.ls b/tools/testfiles/help-2.ls index aaba608..491f696 100644 --- a/tools/testfiles/help-2.ls +++ b/tools/testfiles/help-2.ls @@ -1,4 +1,4 @@ -usage: h5ls [OPTIONS] [OBJECTS...] +usage: h5ls [OPTIONS] file[/OBJECT] [file[/[OBJECT]...] OPTIONS -h, -?, --help Print a usage message and exit -a, --address Print raw data address. If dataset is contiguous, address @@ -38,7 +38,7 @@ usage: h5ls [OPTIONS] [OBJECTS...] --vfd=DRIVER Use the specified virtual file driver -x, --hexdump Show raw data in hexadecimal format - OBJECTS + file/OBJECT Each object consists of an HDF5 file name optionally followed by a slash and an object name within the file (if no object is specified within the file then the contents of the root group are displayed). diff --git a/tools/testfiles/help-3.ls b/tools/testfiles/help-3.ls index aaba608..491f696 100644 --- a/tools/testfiles/help-3.ls +++ b/tools/testfiles/help-3.ls @@ -1,4 +1,4 @@ -usage: h5ls [OPTIONS] [OBJECTS...] +usage: h5ls [OPTIONS] file[/OBJECT] [file[/[OBJECT]...] OPTIONS -h, -?, --help Print a usage message and exit -a, --address Print raw data address. If dataset is contiguous, address @@ -38,7 +38,7 @@ usage: h5ls [OPTIONS] [OBJECTS...] --vfd=DRIVER Use the specified virtual file driver -x, --hexdump Show raw data in hexadecimal format - OBJECTS + file/OBJECT Each object consists of an HDF5 file name optionally followed by a slash and an object name within the file (if no object is specified within the file then the contents of the root group are displayed). diff --git a/tools/testfiles/tall-6.exp b/tools/testfiles/tall-6.exp new file mode 100644 index 0000000..8580cd6 --- /dev/null +++ b/tools/testfiles/tall-6.exp @@ -0,0 +1,11 @@ + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, + 0, 3, 6, 9, 12, 15, 18, 21, 24, 27, + 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, + 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, + 0, 6, 12, 18, 24, 30, 36, 42, 48, 54, + 0, 7, 14, 21, 28, 35, 42, 49, 56, 63, + 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, + 0, 9, 18, 27, 36, 45, 54, 63, 72, 81 \ No newline at end of file diff --git a/tools/testfiles/textlinksrc-nodangle-1.ls b/tools/testfiles/textlinksrc-nodangle-1.ls index 7427e1c..9c19957 100644 --- a/tools/testfiles/textlinksrc-nodangle-1.ls +++ b/tools/testfiles/textlinksrc-nodangle-1.ls @@ -1,6 +1,6 @@ Error: --no-dangling-links must be used along with --follow-symlinks option! -usage: h5ls [OPTIONS] [OBJECTS...] +usage: h5ls [OPTIONS] file[/OBJECT] [file[/[OBJECT]...] OPTIONS -h, -?, --help Print a usage message and exit -a, --address Print raw data address. If dataset is contiguous, address @@ -40,7 +40,7 @@ usage: h5ls [OPTIONS] [OBJECTS...] --vfd=DRIVER Use the specified virtual file driver -x, --hexdump Show raw data in hexadecimal format - OBJECTS + file/OBJECT Each object consists of an HDF5 file name optionally followed by a slash and an object name within the file (if no object is specified within the file then the contents of the root group are displayed). diff --git a/tools/testfiles/tgroup-1.ls b/tools/testfiles/tgroup-1.ls index effaf5a..893c9ce 100644 --- a/tools/testfiles/tgroup-1.ls +++ b/tools/testfiles/tgroup-1.ls @@ -1,6 +1,6 @@ Error: 'recursive' option not compatible with 'group info' option! -usage: h5ls [OPTIONS] [OBJECTS...] +usage: h5ls [OPTIONS] file[/OBJECT] [file[/[OBJECT]...] OPTIONS -h, -?, --help Print a usage message and exit -a, --address Print raw data address. If dataset is contiguous, address @@ -40,7 +40,7 @@ usage: h5ls [OPTIONS] [OBJECTS...] --vfd=DRIVER Use the specified virtual file driver -x, --hexdump Show raw data in hexadecimal format - OBJECTS + file/OBJECT Each object consists of an HDF5 file name optionally followed by a slash and an object name within the file (if no object is specified within the file then the contents of the root group are displayed). diff --git a/tools/testfiles/tnoattrdata.ddl b/tools/testfiles/tnoattrdata.ddl new file mode 100644 index 0000000..a5d40fe --- /dev/null +++ b/tools/testfiles/tnoattrdata.ddl @@ -0,0 +1,39 @@ +HDF5 "tattr.h5" { +GROUP "/" { + ATTRIBUTE "/attr1" { + DATATYPE H5T_STD_I8BE + DATASPACE SIMPLE { ( 24 ) / ( 24 ) } + DATA { + } + } + ATTRIBUTE "attr2" { + DATATYPE H5T_STD_I32BE + DATASPACE SIMPLE { ( 10 ) / ( 10 ) } + DATA { + } + } + ATTRIBUTE "attr3" { + DATATYPE H5T_IEEE_F64BE + DATASPACE SIMPLE { ( 10 ) / ( 10 ) } + DATA { + } + } + ATTRIBUTE "attr4" { + DATATYPE H5T_STD_I32BE + DATASPACE SCALAR + DATA { + } + } + ATTRIBUTE "attr5" { + DATATYPE H5T_STRING { + STRSIZE 17; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } + DATASPACE SCALAR + DATA { + } + } +} +} diff --git a/tools/testfiles/tnoattrddl.ddl b/tools/testfiles/tnoattrddl.ddl new file mode 100644 index 0000000..f7326d0 --- /dev/null +++ b/tools/testfiles/tnoattrddl.ddl @@ -0,0 +1,7 @@ + + 97, 116, 116, 114, 105, 98, 117, 116, 101, 32, 111, 102, 32, 114, 111, + 111, 116, 32, 103, 114, 111, 117, 112, 0 + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 + 0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9 + 100 + "string attribute" diff --git a/tools/testfiles/tnodata.ddl b/tools/testfiles/tnodata.ddl new file mode 100644 index 0000000..f99d906 --- /dev/null +++ b/tools/testfiles/tnodata.ddl @@ -0,0 +1,58 @@ +HDF5 "packedbits.h5" { +GROUP "/" { + DATASET "DS08BITS" { + DATATYPE H5T_STD_I8LE + DATASPACE SIMPLE { ( 8, 8 ) / ( 8, 8 ) } + DATA { + } + } + DATASET "DS16BITS" { + DATATYPE H5T_STD_I16LE + DATASPACE SIMPLE { ( 8, 16 ) / ( 8, 16 ) } + DATA { + } + } + DATASET "DS32BITS" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 8, 32 ) / ( 8, 32 ) } + DATA { + } + } + DATASET "DS64BITS" { + DATATYPE H5T_STD_I64LE + DATASPACE SIMPLE { ( 8, 64 ) / ( 8, 64 ) } + DATA { + } + } + DATASET "DU08BITS" { + DATATYPE H5T_STD_U8LE + DATASPACE SIMPLE { ( 8, 8 ) / ( 8, 8 ) } + DATA { + } + } + DATASET "DU16BITS" { + DATATYPE H5T_STD_U16LE + DATASPACE SIMPLE { ( 8, 16 ) / ( 8, 16 ) } + DATA { + } + } + DATASET "DU32BITS" { + DATATYPE H5T_STD_U32LE + DATASPACE SIMPLE { ( 8, 32 ) / ( 8, 32 ) } + DATA { + } + } + DATASET "DU64BITS" { + DATATYPE H5T_STD_U64LE + DATASPACE SIMPLE { ( 8, 64 ) / ( 8, 64 ) } + DATA { + } + } + DATASET "DummyDBL" { + DATATYPE H5T_IEEE_F64BE + DATASPACE SIMPLE { ( 8, 8 ) / ( 8, 8 ) } + DATA { + } + } +} +} diff --git a/tools/testfiles/tnoddl.ddl b/tools/testfiles/tnoddl.ddl new file mode 100644 index 0000000..5238777 --- /dev/null +++ b/tools/testfiles/tnoddl.ddl @@ -0,0 +1,402 @@ + + -1, -2, -4, -8, -16, -32, -64, -128, + -2, -4, -8, -16, -32, -64, -128, 0, + -4, -8, -16, -32, -64, -128, 0, 0, + -8, -16, -32, -64, -128, 0, 0, 0, + -16, -32, -64, -128, 0, 0, 0, 0, + -32, -64, -128, 0, 0, 0, 0, 0, + -64, -128, 0, 0, 0, 0, 0, 0, + -128, 0, 0, 0, 0, 0, 0, 0 + -1, -2, -4, -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, + -8192, -16384, -32768, + -2, -4, -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, + -8192, -16384, -32768, 0, + -4, -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, + -16384, -32768, 0, 0, + -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, + -16384, -32768, 0, 0, 0, + -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, -16384, + -32768, 0, 0, 0, 0, + -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, -16384, -32768, + 0, 0, 0, 0, 0, + -64, -128, -256, -512, -1024, -2048, -4096, -8192, -16384, -32768, 0, + 0, 0, 0, 0, 0, + -128, -256, -512, -1024, -2048, -4096, -8192, -16384, -32768, 0, 0, 0, + 0, 0, 0, 0 + -1, -2, -4, -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, + -8192, -16384, -32768, -65536, -131072, -262144, -524288, -1048576, + -2097152, -4194304, -8388608, -16777216, -33554432, -67108864, + -134217728, -268435456, -536870912, -1073741824, -2147483648, + -2, -4, -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, + -8192, -16384, -32768, -65536, -131072, -262144, -524288, -1048576, + -2097152, -4194304, -8388608, -16777216, -33554432, -67108864, + -134217728, -268435456, -536870912, -1073741824, -2147483648, 0, + -4, -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, + -16384, -32768, -65536, -131072, -262144, -524288, -1048576, -2097152, + -4194304, -8388608, -16777216, -33554432, -67108864, -134217728, + -268435456, -536870912, -1073741824, -2147483648, 0, 0, + -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, + -16384, -32768, -65536, -131072, -262144, -524288, -1048576, -2097152, + -4194304, -8388608, -16777216, -33554432, -67108864, -134217728, + -268435456, -536870912, -1073741824, -2147483648, 0, 0, 0, + -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, -16384, + -32768, -65536, -131072, -262144, -524288, -1048576, -2097152, + -4194304, -8388608, -16777216, -33554432, -67108864, -134217728, + -268435456, -536870912, -1073741824, -2147483648, 0, 0, 0, 0, + -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, -16384, -32768, + -65536, -131072, -262144, -524288, -1048576, -2097152, -4194304, + -8388608, -16777216, -33554432, -67108864, -134217728, -268435456, + -536870912, -1073741824, -2147483648, 0, 0, 0, 0, 0, + -64, -128, -256, -512, -1024, -2048, -4096, -8192, -16384, -32768, + -65536, -131072, -262144, -524288, -1048576, -2097152, -4194304, + -8388608, -16777216, -33554432, -67108864, -134217728, -268435456, + -536870912, -1073741824, -2147483648, 0, 0, 0, 0, 0, 0, + -128, -256, -512, -1024, -2048, -4096, -8192, -16384, -32768, -65536, + -131072, -262144, -524288, -1048576, -2097152, -4194304, -8388608, + -16777216, -33554432, -67108864, -134217728, -268435456, -536870912, + -1073741824, -2147483648, 0, 0, 0, 0, 0, 0, 0 + -1, -2, -4, -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, + -8192, -16384, -32768, -65536, -131072, -262144, -524288, -1048576, + -2097152, -4194304, -8388608, -16777216, -33554432, -67108864, + -134217728, -268435456, -536870912, -1073741824, -2147483648, + -4294967296, -8589934592, -17179869184, -34359738368, -68719476736, + -137438953472, -274877906944, -549755813888, -1099511627776, + -2199023255552, -4398046511104, -8796093022208, -17592186044416, + -35184372088832, -70368744177664, -140737488355328, -281474976710656, + -562949953421312, -1125899906842624, -2251799813685248, + -4503599627370496, -9007199254740992, -18014398509481984, + -36028797018963968, -72057594037927936, -144115188075855872, + -288230376151711744, -576460752303423488, -1152921504606846976, + -2305843009213693952, -4611686018427387904, -9223372036854775808, + -2, -4, -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, + -8192, -16384, -32768, -65536, -131072, -262144, -524288, -1048576, + -2097152, -4194304, -8388608, -16777216, -33554432, -67108864, + -134217728, -268435456, -536870912, -1073741824, -2147483648, + -4294967296, -8589934592, -17179869184, -34359738368, -68719476736, + -137438953472, -274877906944, -549755813888, -1099511627776, + -2199023255552, -4398046511104, -8796093022208, -17592186044416, + -35184372088832, -70368744177664, -140737488355328, -281474976710656, + -562949953421312, -1125899906842624, -2251799813685248, + -4503599627370496, -9007199254740992, -18014398509481984, + -36028797018963968, -72057594037927936, -144115188075855872, + -288230376151711744, -576460752303423488, -1152921504606846976, + -2305843009213693952, -4611686018427387904, -9223372036854775808, 0, + -4, -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, + -16384, -32768, -65536, -131072, -262144, -524288, -1048576, -2097152, + -4194304, -8388608, -16777216, -33554432, -67108864, -134217728, + -268435456, -536870912, -1073741824, -2147483648, -4294967296, + -8589934592, -17179869184, -34359738368, -68719476736, -137438953472, + -274877906944, -549755813888, -1099511627776, -2199023255552, + -4398046511104, -8796093022208, -17592186044416, -35184372088832, + -70368744177664, -140737488355328, -281474976710656, -562949953421312, + -1125899906842624, -2251799813685248, -4503599627370496, + -9007199254740992, -18014398509481984, -36028797018963968, + -72057594037927936, -144115188075855872, -288230376151711744, + -576460752303423488, -1152921504606846976, -2305843009213693952, + -4611686018427387904, -9223372036854775808, 0, 0, + -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, + -16384, -32768, -65536, -131072, -262144, -524288, -1048576, -2097152, + -4194304, -8388608, -16777216, -33554432, -67108864, -134217728, + -268435456, -536870912, -1073741824, -2147483648, -4294967296, + -8589934592, -17179869184, -34359738368, -68719476736, -137438953472, + -274877906944, -549755813888, -1099511627776, -2199023255552, + -4398046511104, -8796093022208, -17592186044416, -35184372088832, + -70368744177664, -140737488355328, -281474976710656, -562949953421312, + -1125899906842624, -2251799813685248, -4503599627370496, + -9007199254740992, -18014398509481984, -36028797018963968, + -72057594037927936, -144115188075855872, -288230376151711744, + -576460752303423488, -1152921504606846976, -2305843009213693952, + -4611686018427387904, -9223372036854775808, 0, 0, 0, + -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, -16384, + -32768, -65536, -131072, -262144, -524288, -1048576, -2097152, + -4194304, -8388608, -16777216, -33554432, -67108864, -134217728, + -268435456, -536870912, -1073741824, -2147483648, -4294967296, + -8589934592, -17179869184, -34359738368, -68719476736, -137438953472, + -274877906944, -549755813888, -1099511627776, -2199023255552, + -4398046511104, -8796093022208, -17592186044416, -35184372088832, + -70368744177664, -140737488355328, -281474976710656, -562949953421312, + -1125899906842624, -2251799813685248, -4503599627370496, + -9007199254740992, -18014398509481984, -36028797018963968, + -72057594037927936, -144115188075855872, -288230376151711744, + -576460752303423488, -1152921504606846976, -2305843009213693952, + -4611686018427387904, -9223372036854775808, 0, 0, 0, 0, + -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, -16384, -32768, + -65536, -131072, -262144, -524288, -1048576, -2097152, -4194304, + -8388608, -16777216, -33554432, -67108864, -134217728, -268435456, + -536870912, -1073741824, -2147483648, -4294967296, -8589934592, + -17179869184, -34359738368, -68719476736, -137438953472, -274877906944, + -549755813888, -1099511627776, -2199023255552, -4398046511104, + -8796093022208, -17592186044416, -35184372088832, -70368744177664, + -140737488355328, -281474976710656, -562949953421312, + -1125899906842624, -2251799813685248, -4503599627370496, + -9007199254740992, -18014398509481984, -36028797018963968, + -72057594037927936, -144115188075855872, -288230376151711744, + -576460752303423488, -1152921504606846976, -2305843009213693952, + -4611686018427387904, -9223372036854775808, 0, 0, 0, 0, 0, + -64, -128, -256, -512, -1024, -2048, -4096, -8192, -16384, -32768, + -65536, -131072, -262144, -524288, -1048576, -2097152, -4194304, + -8388608, -16777216, -33554432, -67108864, -134217728, -268435456, + -536870912, -1073741824, -2147483648, -4294967296, -8589934592, + -17179869184, -34359738368, -68719476736, -137438953472, -274877906944, + -549755813888, -1099511627776, -2199023255552, -4398046511104, + -8796093022208, -17592186044416, -35184372088832, -70368744177664, + -140737488355328, -281474976710656, -562949953421312, + -1125899906842624, -2251799813685248, -4503599627370496, + -9007199254740992, -18014398509481984, -36028797018963968, + -72057594037927936, -144115188075855872, -288230376151711744, + -576460752303423488, -1152921504606846976, -2305843009213693952, + -4611686018427387904, -9223372036854775808, 0, 0, 0, 0, 0, 0, + -128, -256, -512, -1024, -2048, -4096, -8192, -16384, -32768, -65536, + -131072, -262144, -524288, -1048576, -2097152, -4194304, -8388608, + -16777216, -33554432, -67108864, -134217728, -268435456, -536870912, + -1073741824, -2147483648, -4294967296, -8589934592, -17179869184, + -34359738368, -68719476736, -137438953472, -274877906944, + -549755813888, -1099511627776, -2199023255552, -4398046511104, + -8796093022208, -17592186044416, -35184372088832, -70368744177664, + -140737488355328, -281474976710656, -562949953421312, + -1125899906842624, -2251799813685248, -4503599627370496, + -9007199254740992, -18014398509481984, -36028797018963968, + -72057594037927936, -144115188075855872, -288230376151711744, + -576460752303423488, -1152921504606846976, -2305843009213693952, + -4611686018427387904, -9223372036854775808, 0, 0, 0, 0, 0, 0, 0 + 255, 254, 252, 248, 240, 224, 192, 128, + 254, 252, 248, 240, 224, 192, 128, 0, + 252, 248, 240, 224, 192, 128, 0, 0, + 248, 240, 224, 192, 128, 0, 0, 0, + 240, 224, 192, 128, 0, 0, 0, 0, + 224, 192, 128, 0, 0, 0, 0, 0, + 192, 128, 0, 0, 0, 0, 0, 0, + 128, 0, 0, 0, 0, 0, 0, 0 + 65535, 65534, 65532, 65528, 65520, 65504, 65472, 65408, 65280, 65024, + 64512, 63488, 61440, 57344, 49152, 32768, + 65534, 65532, 65528, 65520, 65504, 65472, 65408, 65280, 65024, 64512, + 63488, 61440, 57344, 49152, 32768, 0, + 65532, 65528, 65520, 65504, 65472, 65408, 65280, 65024, 64512, 63488, + 61440, 57344, 49152, 32768, 0, 0, + 65528, 65520, 65504, 65472, 65408, 65280, 65024, 64512, 63488, 61440, + 57344, 49152, 32768, 0, 0, 0, + 65520, 65504, 65472, 65408, 65280, 65024, 64512, 63488, 61440, 57344, + 49152, 32768, 0, 0, 0, 0, + 65504, 65472, 65408, 65280, 65024, 64512, 63488, 61440, 57344, 49152, + 32768, 0, 0, 0, 0, 0, + 65472, 65408, 65280, 65024, 64512, 63488, 61440, 57344, 49152, 32768, + 0, 0, 0, 0, 0, 0, + 65408, 65280, 65024, 64512, 63488, 61440, 57344, 49152, 32768, 0, 0, 0, + 0, 0, 0, 0 + 4294967295, 4294967294, 4294967292, 4294967288, 4294967280, 4294967264, + 4294967232, 4294967168, 4294967040, 4294966784, 4294966272, 4294965248, + 4294963200, 4294959104, 4294950912, 4294934528, 4294901760, 4294836224, + 4294705152, 4294443008, 4293918720, 4292870144, 4290772992, 4286578688, + 4278190080, 4261412864, 4227858432, 4160749568, 4026531840, 3758096384, + 3221225472, 2147483648, + 4294967294, 4294967292, 4294967288, 4294967280, 4294967264, 4294967232, + 4294967168, 4294967040, 4294966784, 4294966272, 4294965248, 4294963200, + 4294959104, 4294950912, 4294934528, 4294901760, 4294836224, 4294705152, + 4294443008, 4293918720, 4292870144, 4290772992, 4286578688, 4278190080, + 4261412864, 4227858432, 4160749568, 4026531840, 3758096384, 3221225472, + 2147483648, 0, + 4294967292, 4294967288, 4294967280, 4294967264, 4294967232, 4294967168, + 4294967040, 4294966784, 4294966272, 4294965248, 4294963200, 4294959104, + 4294950912, 4294934528, 4294901760, 4294836224, 4294705152, 4294443008, + 4293918720, 4292870144, 4290772992, 4286578688, 4278190080, 4261412864, + 4227858432, 4160749568, 4026531840, 3758096384, 3221225472, 2147483648, + 0, 0, + 4294967288, 4294967280, 4294967264, 4294967232, 4294967168, 4294967040, + 4294966784, 4294966272, 4294965248, 4294963200, 4294959104, 4294950912, + 4294934528, 4294901760, 4294836224, 4294705152, 4294443008, 4293918720, + 4292870144, 4290772992, 4286578688, 4278190080, 4261412864, 4227858432, + 4160749568, 4026531840, 3758096384, 3221225472, 2147483648, 0, 0, 0, + 4294967280, 4294967264, 4294967232, 4294967168, 4294967040, 4294966784, + 4294966272, 4294965248, 4294963200, 4294959104, 4294950912, 4294934528, + 4294901760, 4294836224, 4294705152, 4294443008, 4293918720, 4292870144, + 4290772992, 4286578688, 4278190080, 4261412864, 4227858432, 4160749568, + 4026531840, 3758096384, 3221225472, 2147483648, 0, 0, 0, 0, + 4294967264, 4294967232, 4294967168, 4294967040, 4294966784, 4294966272, + 4294965248, 4294963200, 4294959104, 4294950912, 4294934528, 4294901760, + 4294836224, 4294705152, 4294443008, 4293918720, 4292870144, 4290772992, + 4286578688, 4278190080, 4261412864, 4227858432, 4160749568, 4026531840, + 3758096384, 3221225472, 2147483648, 0, 0, 0, 0, 0, + 4294967232, 4294967168, 4294967040, 4294966784, 4294966272, 4294965248, + 4294963200, 4294959104, 4294950912, 4294934528, 4294901760, 4294836224, + 4294705152, 4294443008, 4293918720, 4292870144, 4290772992, 4286578688, + 4278190080, 4261412864, 4227858432, 4160749568, 4026531840, 3758096384, + 3221225472, 2147483648, 0, 0, 0, 0, 0, 0, + 4294967168, 4294967040, 4294966784, 4294966272, 4294965248, 4294963200, + 4294959104, 4294950912, 4294934528, 4294901760, 4294836224, 4294705152, + 4294443008, 4293918720, 4292870144, 4290772992, 4286578688, 4278190080, + 4261412864, 4227858432, 4160749568, 4026531840, 3758096384, 3221225472, + 2147483648, 0, 0, 0, 0, 0, 0, 0 + 18446744073709551615, 18446744073709551614, 18446744073709551612, + 18446744073709551608, 18446744073709551600, 18446744073709551584, + 18446744073709551552, 18446744073709551488, 18446744073709551360, + 18446744073709551104, 18446744073709550592, 18446744073709549568, + 18446744073709547520, 18446744073709543424, 18446744073709535232, + 18446744073709518848, 18446744073709486080, 18446744073709420544, + 18446744073709289472, 18446744073709027328, 18446744073708503040, + 18446744073707454464, 18446744073705357312, 18446744073701163008, + 18446744073692774400, 18446744073675997184, 18446744073642442752, + 18446744073575333888, 18446744073441116160, 18446744073172680704, + 18446744072635809792, 18446744071562067968, 18446744069414584320, + 18446744065119617024, 18446744056529682432, 18446744039349813248, + 18446744004990074880, 18446743936270598144, 18446743798831644672, + 18446743523953737728, 18446742974197923840, 18446741874686296064, + 18446739675663040512, 18446735277616529408, 18446726481523507200, + 18446708889337462784, 18446673704965373952, 18446603336221196288, + 18446462598732840960, 18446181123756130304, 18445618173802708992, + 18444492273895866368, 18442240474082181120, 18437736874454810624, + 18428729675200069632, 18410715276690587648, 18374686479671623680, + 18302628885633695744, 18158513697557839872, 17870283321406128128, + 17293822569102704640, 16140901064495857664, 13835058055282163712, + 9223372036854775808, + 18446744073709551614, 18446744073709551612, 18446744073709551608, + 18446744073709551600, 18446744073709551584, 18446744073709551552, + 18446744073709551488, 18446744073709551360, 18446744073709551104, + 18446744073709550592, 18446744073709549568, 18446744073709547520, + 18446744073709543424, 18446744073709535232, 18446744073709518848, + 18446744073709486080, 18446744073709420544, 18446744073709289472, + 18446744073709027328, 18446744073708503040, 18446744073707454464, + 18446744073705357312, 18446744073701163008, 18446744073692774400, + 18446744073675997184, 18446744073642442752, 18446744073575333888, + 18446744073441116160, 18446744073172680704, 18446744072635809792, + 18446744071562067968, 18446744069414584320, 18446744065119617024, + 18446744056529682432, 18446744039349813248, 18446744004990074880, + 18446743936270598144, 18446743798831644672, 18446743523953737728, + 18446742974197923840, 18446741874686296064, 18446739675663040512, + 18446735277616529408, 18446726481523507200, 18446708889337462784, + 18446673704965373952, 18446603336221196288, 18446462598732840960, + 18446181123756130304, 18445618173802708992, 18444492273895866368, + 18442240474082181120, 18437736874454810624, 18428729675200069632, + 18410715276690587648, 18374686479671623680, 18302628885633695744, + 18158513697557839872, 17870283321406128128, 17293822569102704640, + 16140901064495857664, 13835058055282163712, 9223372036854775808, 0, + 18446744073709551612, 18446744073709551608, 18446744073709551600, + 18446744073709551584, 18446744073709551552, 18446744073709551488, + 18446744073709551360, 18446744073709551104, 18446744073709550592, + 18446744073709549568, 18446744073709547520, 18446744073709543424, + 18446744073709535232, 18446744073709518848, 18446744073709486080, + 18446744073709420544, 18446744073709289472, 18446744073709027328, + 18446744073708503040, 18446744073707454464, 18446744073705357312, + 18446744073701163008, 18446744073692774400, 18446744073675997184, + 18446744073642442752, 18446744073575333888, 18446744073441116160, + 18446744073172680704, 18446744072635809792, 18446744071562067968, + 18446744069414584320, 18446744065119617024, 18446744056529682432, + 18446744039349813248, 18446744004990074880, 18446743936270598144, + 18446743798831644672, 18446743523953737728, 18446742974197923840, + 18446741874686296064, 18446739675663040512, 18446735277616529408, + 18446726481523507200, 18446708889337462784, 18446673704965373952, + 18446603336221196288, 18446462598732840960, 18446181123756130304, + 18445618173802708992, 18444492273895866368, 18442240474082181120, + 18437736874454810624, 18428729675200069632, 18410715276690587648, + 18374686479671623680, 18302628885633695744, 18158513697557839872, + 17870283321406128128, 17293822569102704640, 16140901064495857664, + 13835058055282163712, 9223372036854775808, 0, 0, + 18446744073709551608, 18446744073709551600, 18446744073709551584, + 18446744073709551552, 18446744073709551488, 18446744073709551360, + 18446744073709551104, 18446744073709550592, 18446744073709549568, + 18446744073709547520, 18446744073709543424, 18446744073709535232, + 18446744073709518848, 18446744073709486080, 18446744073709420544, + 18446744073709289472, 18446744073709027328, 18446744073708503040, + 18446744073707454464, 18446744073705357312, 18446744073701163008, + 18446744073692774400, 18446744073675997184, 18446744073642442752, + 18446744073575333888, 18446744073441116160, 18446744073172680704, + 18446744072635809792, 18446744071562067968, 18446744069414584320, + 18446744065119617024, 18446744056529682432, 18446744039349813248, + 18446744004990074880, 18446743936270598144, 18446743798831644672, + 18446743523953737728, 18446742974197923840, 18446741874686296064, + 18446739675663040512, 18446735277616529408, 18446726481523507200, + 18446708889337462784, 18446673704965373952, 18446603336221196288, + 18446462598732840960, 18446181123756130304, 18445618173802708992, + 18444492273895866368, 18442240474082181120, 18437736874454810624, + 18428729675200069632, 18410715276690587648, 18374686479671623680, + 18302628885633695744, 18158513697557839872, 17870283321406128128, + 17293822569102704640, 16140901064495857664, 13835058055282163712, + 9223372036854775808, 0, 0, 0, + 18446744073709551600, 18446744073709551584, 18446744073709551552, + 18446744073709551488, 18446744073709551360, 18446744073709551104, + 18446744073709550592, 18446744073709549568, 18446744073709547520, + 18446744073709543424, 18446744073709535232, 18446744073709518848, + 18446744073709486080, 18446744073709420544, 18446744073709289472, + 18446744073709027328, 18446744073708503040, 18446744073707454464, + 18446744073705357312, 18446744073701163008, 18446744073692774400, + 18446744073675997184, 18446744073642442752, 18446744073575333888, + 18446744073441116160, 18446744073172680704, 18446744072635809792, + 18446744071562067968, 18446744069414584320, 18446744065119617024, + 18446744056529682432, 18446744039349813248, 18446744004990074880, + 18446743936270598144, 18446743798831644672, 18446743523953737728, + 18446742974197923840, 18446741874686296064, 18446739675663040512, + 18446735277616529408, 18446726481523507200, 18446708889337462784, + 18446673704965373952, 18446603336221196288, 18446462598732840960, + 18446181123756130304, 18445618173802708992, 18444492273895866368, + 18442240474082181120, 18437736874454810624, 18428729675200069632, + 18410715276690587648, 18374686479671623680, 18302628885633695744, + 18158513697557839872, 17870283321406128128, 17293822569102704640, + 16140901064495857664, 13835058055282163712, 9223372036854775808, 0, 0, + 0, 0, + 18446744073709551584, 18446744073709551552, 18446744073709551488, + 18446744073709551360, 18446744073709551104, 18446744073709550592, + 18446744073709549568, 18446744073709547520, 18446744073709543424, + 18446744073709535232, 18446744073709518848, 18446744073709486080, + 18446744073709420544, 18446744073709289472, 18446744073709027328, + 18446744073708503040, 18446744073707454464, 18446744073705357312, + 18446744073701163008, 18446744073692774400, 18446744073675997184, + 18446744073642442752, 18446744073575333888, 18446744073441116160, + 18446744073172680704, 18446744072635809792, 18446744071562067968, + 18446744069414584320, 18446744065119617024, 18446744056529682432, + 18446744039349813248, 18446744004990074880, 18446743936270598144, + 18446743798831644672, 18446743523953737728, 18446742974197923840, + 18446741874686296064, 18446739675663040512, 18446735277616529408, + 18446726481523507200, 18446708889337462784, 18446673704965373952, + 18446603336221196288, 18446462598732840960, 18446181123756130304, + 18445618173802708992, 18444492273895866368, 18442240474082181120, + 18437736874454810624, 18428729675200069632, 18410715276690587648, + 18374686479671623680, 18302628885633695744, 18158513697557839872, + 17870283321406128128, 17293822569102704640, 16140901064495857664, + 13835058055282163712, 9223372036854775808, 0, 0, 0, 0, 0, + 18446744073709551552, 18446744073709551488, 18446744073709551360, + 18446744073709551104, 18446744073709550592, 18446744073709549568, + 18446744073709547520, 18446744073709543424, 18446744073709535232, + 18446744073709518848, 18446744073709486080, 18446744073709420544, + 18446744073709289472, 18446744073709027328, 18446744073708503040, + 18446744073707454464, 18446744073705357312, 18446744073701163008, + 18446744073692774400, 18446744073675997184, 18446744073642442752, + 18446744073575333888, 18446744073441116160, 18446744073172680704, + 18446744072635809792, 18446744071562067968, 18446744069414584320, + 18446744065119617024, 18446744056529682432, 18446744039349813248, + 18446744004990074880, 18446743936270598144, 18446743798831644672, + 18446743523953737728, 18446742974197923840, 18446741874686296064, + 18446739675663040512, 18446735277616529408, 18446726481523507200, + 18446708889337462784, 18446673704965373952, 18446603336221196288, + 18446462598732840960, 18446181123756130304, 18445618173802708992, + 18444492273895866368, 18442240474082181120, 18437736874454810624, + 18428729675200069632, 18410715276690587648, 18374686479671623680, + 18302628885633695744, 18158513697557839872, 17870283321406128128, + 17293822569102704640, 16140901064495857664, 13835058055282163712, + 9223372036854775808, 0, 0, 0, 0, 0, 0, + 18446744073709551488, 18446744073709551360, 18446744073709551104, + 18446744073709550592, 18446744073709549568, 18446744073709547520, + 18446744073709543424, 18446744073709535232, 18446744073709518848, + 18446744073709486080, 18446744073709420544, 18446744073709289472, + 18446744073709027328, 18446744073708503040, 18446744073707454464, + 18446744073705357312, 18446744073701163008, 18446744073692774400, + 18446744073675997184, 18446744073642442752, 18446744073575333888, + 18446744073441116160, 18446744073172680704, 18446744072635809792, + 18446744071562067968, 18446744069414584320, 18446744065119617024, + 18446744056529682432, 18446744039349813248, 18446744004990074880, + 18446743936270598144, 18446743798831644672, 18446743523953737728, + 18446742974197923840, 18446741874686296064, 18446739675663040512, + 18446735277616529408, 18446726481523507200, 18446708889337462784, + 18446673704965373952, 18446603336221196288, 18446462598732840960, + 18446181123756130304, 18445618173802708992, 18444492273895866368, + 18442240474082181120, 18437736874454810624, 18428729675200069632, + 18410715276690587648, 18374686479671623680, 18302628885633695744, + 18158513697557839872, 17870283321406128128, 17293822569102704640, + 16140901064495857664, 13835058055282163712, 9223372036854775808, 0, 0, + 0, 0, 0, 0, 0 + 0, 0.0001, 0.0002, 0.0003, 0.0004, 0.0005, 0.0006, 0.0007, + 1, 1.0001, 1.0002, 1.0003, 1.0004, 1.0005, 1.0006, 1.0007, + 2, 2.0001, 2.0002, 2.0003, 2.0004, 2.0005, 2.0006, 2.0007, + 3, 3.0001, 3.0002, 3.0003, 3.0004, 3.0005, 3.0006, 3.0007, + 4, 4.0001, 4.0002, 4.0003, 4.0004, 4.0005, 4.0006, 4.0007, + 5, 5.0001, 5.0002, 5.0003, 5.0004, 5.0005, 5.0006, 5.0007, + 6, 6.0001, 6.0002, 6.0003, 6.0004, 6.0005, 6.0006, 6.0007, + 7, 7.0001, 7.0002, 7.0003, 7.0004, 7.0005, 7.0006, 7.0007 diff --git a/tools/testfiles/tnoddlfile.ddl b/tools/testfiles/tnoddlfile.ddl new file mode 100644 index 0000000..e69de29 diff --git a/tools/testfiles/tnoddlfile.exp b/tools/testfiles/tnoddlfile.exp new file mode 100644 index 0000000..dc19888 --- /dev/null +++ b/tools/testfiles/tnoddlfile.exp @@ -0,0 +1,402 @@ + + -1, -2, -4, -8, -16, -32, -64, -128, + -2, -4, -8, -16, -32, -64, -128, 0, + -4, -8, -16, -32, -64, -128, 0, 0, + -8, -16, -32, -64, -128, 0, 0, 0, + -16, -32, -64, -128, 0, 0, 0, 0, + -32, -64, -128, 0, 0, 0, 0, 0, + -64, -128, 0, 0, 0, 0, 0, 0, + -128, 0, 0, 0, 0, 0, 0, 0 + -1, -2, -4, -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, + -8192, -16384, -32768, + -2, -4, -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, + -8192, -16384, -32768, 0, + -4, -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, + -16384, -32768, 0, 0, + -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, + -16384, -32768, 0, 0, 0, + -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, -16384, + -32768, 0, 0, 0, 0, + -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, -16384, -32768, + 0, 0, 0, 0, 0, + -64, -128, -256, -512, -1024, -2048, -4096, -8192, -16384, -32768, 0, + 0, 0, 0, 0, 0, + -128, -256, -512, -1024, -2048, -4096, -8192, -16384, -32768, 0, 0, 0, + 0, 0, 0, 0 + -1, -2, -4, -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, + -8192, -16384, -32768, -65536, -131072, -262144, -524288, -1048576, + -2097152, -4194304, -8388608, -16777216, -33554432, -67108864, + -134217728, -268435456, -536870912, -1073741824, -2147483648, + -2, -4, -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, + -8192, -16384, -32768, -65536, -131072, -262144, -524288, -1048576, + -2097152, -4194304, -8388608, -16777216, -33554432, -67108864, + -134217728, -268435456, -536870912, -1073741824, -2147483648, 0, + -4, -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, + -16384, -32768, -65536, -131072, -262144, -524288, -1048576, -2097152, + -4194304, -8388608, -16777216, -33554432, -67108864, -134217728, + -268435456, -536870912, -1073741824, -2147483648, 0, 0, + -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, + -16384, -32768, -65536, -131072, -262144, -524288, -1048576, -2097152, + -4194304, -8388608, -16777216, -33554432, -67108864, -134217728, + -268435456, -536870912, -1073741824, -2147483648, 0, 0, 0, + -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, -16384, + -32768, -65536, -131072, -262144, -524288, -1048576, -2097152, + -4194304, -8388608, -16777216, -33554432, -67108864, -134217728, + -268435456, -536870912, -1073741824, -2147483648, 0, 0, 0, 0, + -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, -16384, -32768, + -65536, -131072, -262144, -524288, -1048576, -2097152, -4194304, + -8388608, -16777216, -33554432, -67108864, -134217728, -268435456, + -536870912, -1073741824, -2147483648, 0, 0, 0, 0, 0, + -64, -128, -256, -512, -1024, -2048, -4096, -8192, -16384, -32768, + -65536, -131072, -262144, -524288, -1048576, -2097152, -4194304, + -8388608, -16777216, -33554432, -67108864, -134217728, -268435456, + -536870912, -1073741824, -2147483648, 0, 0, 0, 0, 0, 0, + -128, -256, -512, -1024, -2048, -4096, -8192, -16384, -32768, -65536, + -131072, -262144, -524288, -1048576, -2097152, -4194304, -8388608, + -16777216, -33554432, -67108864, -134217728, -268435456, -536870912, + -1073741824, -2147483648, 0, 0, 0, 0, 0, 0, 0 + -1, -2, -4, -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, + -8192, -16384, -32768, -65536, -131072, -262144, -524288, -1048576, + -2097152, -4194304, -8388608, -16777216, -33554432, -67108864, + -134217728, -268435456, -536870912, -1073741824, -2147483648, + -4294967296, -8589934592, -17179869184, -34359738368, -68719476736, + -137438953472, -274877906944, -549755813888, -1099511627776, + -2199023255552, -4398046511104, -8796093022208, -17592186044416, + -35184372088832, -70368744177664, -140737488355328, -281474976710656, + -562949953421312, -1125899906842624, -2251799813685248, + -4503599627370496, -9007199254740992, -18014398509481984, + -36028797018963968, -72057594037927936, -144115188075855872, + -288230376151711744, -576460752303423488, -1152921504606846976, + -2305843009213693952, -4611686018427387904, -9223372036854775808, + -2, -4, -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, + -8192, -16384, -32768, -65536, -131072, -262144, -524288, -1048576, + -2097152, -4194304, -8388608, -16777216, -33554432, -67108864, + -134217728, -268435456, -536870912, -1073741824, -2147483648, + -4294967296, -8589934592, -17179869184, -34359738368, -68719476736, + -137438953472, -274877906944, -549755813888, -1099511627776, + -2199023255552, -4398046511104, -8796093022208, -17592186044416, + -35184372088832, -70368744177664, -140737488355328, -281474976710656, + -562949953421312, -1125899906842624, -2251799813685248, + -4503599627370496, -9007199254740992, -18014398509481984, + -36028797018963968, -72057594037927936, -144115188075855872, + -288230376151711744, -576460752303423488, -1152921504606846976, + -2305843009213693952, -4611686018427387904, -9223372036854775808, 0, + -4, -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, + -16384, -32768, -65536, -131072, -262144, -524288, -1048576, -2097152, + -4194304, -8388608, -16777216, -33554432, -67108864, -134217728, + -268435456, -536870912, -1073741824, -2147483648, -4294967296, + -8589934592, -17179869184, -34359738368, -68719476736, -137438953472, + -274877906944, -549755813888, -1099511627776, -2199023255552, + -4398046511104, -8796093022208, -17592186044416, -35184372088832, + -70368744177664, -140737488355328, -281474976710656, -562949953421312, + -1125899906842624, -2251799813685248, -4503599627370496, + -9007199254740992, -18014398509481984, -36028797018963968, + -72057594037927936, -144115188075855872, -288230376151711744, + -576460752303423488, -1152921504606846976, -2305843009213693952, + -4611686018427387904, -9223372036854775808, 0, 0, + -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, + -16384, -32768, -65536, -131072, -262144, -524288, -1048576, -2097152, + -4194304, -8388608, -16777216, -33554432, -67108864, -134217728, + -268435456, -536870912, -1073741824, -2147483648, -4294967296, + -8589934592, -17179869184, -34359738368, -68719476736, -137438953472, + -274877906944, -549755813888, -1099511627776, -2199023255552, + -4398046511104, -8796093022208, -17592186044416, -35184372088832, + -70368744177664, -140737488355328, -281474976710656, -562949953421312, + -1125899906842624, -2251799813685248, -4503599627370496, + -9007199254740992, -18014398509481984, -36028797018963968, + -72057594037927936, -144115188075855872, -288230376151711744, + -576460752303423488, -1152921504606846976, -2305843009213693952, + -4611686018427387904, -9223372036854775808, 0, 0, 0, + -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, -16384, + -32768, -65536, -131072, -262144, -524288, -1048576, -2097152, + -4194304, -8388608, -16777216, -33554432, -67108864, -134217728, + -268435456, -536870912, -1073741824, -2147483648, -4294967296, + -8589934592, -17179869184, -34359738368, -68719476736, -137438953472, + -274877906944, -549755813888, -1099511627776, -2199023255552, + -4398046511104, -8796093022208, -17592186044416, -35184372088832, + -70368744177664, -140737488355328, -281474976710656, -562949953421312, + -1125899906842624, -2251799813685248, -4503599627370496, + -9007199254740992, -18014398509481984, -36028797018963968, + -72057594037927936, -144115188075855872, -288230376151711744, + -576460752303423488, -1152921504606846976, -2305843009213693952, + -4611686018427387904, -9223372036854775808, 0, 0, 0, 0, + -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, -16384, -32768, + -65536, -131072, -262144, -524288, -1048576, -2097152, -4194304, + -8388608, -16777216, -33554432, -67108864, -134217728, -268435456, + -536870912, -1073741824, -2147483648, -4294967296, -8589934592, + -17179869184, -34359738368, -68719476736, -137438953472, -274877906944, + -549755813888, -1099511627776, -2199023255552, -4398046511104, + -8796093022208, -17592186044416, -35184372088832, -70368744177664, + -140737488355328, -281474976710656, -562949953421312, + -1125899906842624, -2251799813685248, -4503599627370496, + -9007199254740992, -18014398509481984, -36028797018963968, + -72057594037927936, -144115188075855872, -288230376151711744, + -576460752303423488, -1152921504606846976, -2305843009213693952, + -4611686018427387904, -9223372036854775808, 0, 0, 0, 0, 0, + -64, -128, -256, -512, -1024, -2048, -4096, -8192, -16384, -32768, + -65536, -131072, -262144, -524288, -1048576, -2097152, -4194304, + -8388608, -16777216, -33554432, -67108864, -134217728, -268435456, + -536870912, -1073741824, -2147483648, -4294967296, -8589934592, + -17179869184, -34359738368, -68719476736, -137438953472, -274877906944, + -549755813888, -1099511627776, -2199023255552, -4398046511104, + -8796093022208, -17592186044416, -35184372088832, -70368744177664, + -140737488355328, -281474976710656, -562949953421312, + -1125899906842624, -2251799813685248, -4503599627370496, + -9007199254740992, -18014398509481984, -36028797018963968, + -72057594037927936, -144115188075855872, -288230376151711744, + -576460752303423488, -1152921504606846976, -2305843009213693952, + -4611686018427387904, -9223372036854775808, 0, 0, 0, 0, 0, 0, + -128, -256, -512, -1024, -2048, -4096, -8192, -16384, -32768, -65536, + -131072, -262144, -524288, -1048576, -2097152, -4194304, -8388608, + -16777216, -33554432, -67108864, -134217728, -268435456, -536870912, + -1073741824, -2147483648, -4294967296, -8589934592, -17179869184, + -34359738368, -68719476736, -137438953472, -274877906944, + -549755813888, -1099511627776, -2199023255552, -4398046511104, + -8796093022208, -17592186044416, -35184372088832, -70368744177664, + -140737488355328, -281474976710656, -562949953421312, + -1125899906842624, -2251799813685248, -4503599627370496, + -9007199254740992, -18014398509481984, -36028797018963968, + -72057594037927936, -144115188075855872, -288230376151711744, + -576460752303423488, -1152921504606846976, -2305843009213693952, + -4611686018427387904, -9223372036854775808, 0, 0, 0, 0, 0, 0, 0 + 255, 254, 252, 248, 240, 224, 192, 128, + 254, 252, 248, 240, 224, 192, 128, 0, + 252, 248, 240, 224, 192, 128, 0, 0, + 248, 240, 224, 192, 128, 0, 0, 0, + 240, 224, 192, 128, 0, 0, 0, 0, + 224, 192, 128, 0, 0, 0, 0, 0, + 192, 128, 0, 0, 0, 0, 0, 0, + 128, 0, 0, 0, 0, 0, 0, 0 + 65535, 65534, 65532, 65528, 65520, 65504, 65472, 65408, 65280, 65024, + 64512, 63488, 61440, 57344, 49152, 32768, + 65534, 65532, 65528, 65520, 65504, 65472, 65408, 65280, 65024, 64512, + 63488, 61440, 57344, 49152, 32768, 0, + 65532, 65528, 65520, 65504, 65472, 65408, 65280, 65024, 64512, 63488, + 61440, 57344, 49152, 32768, 0, 0, + 65528, 65520, 65504, 65472, 65408, 65280, 65024, 64512, 63488, 61440, + 57344, 49152, 32768, 0, 0, 0, + 65520, 65504, 65472, 65408, 65280, 65024, 64512, 63488, 61440, 57344, + 49152, 32768, 0, 0, 0, 0, + 65504, 65472, 65408, 65280, 65024, 64512, 63488, 61440, 57344, 49152, + 32768, 0, 0, 0, 0, 0, + 65472, 65408, 65280, 65024, 64512, 63488, 61440, 57344, 49152, 32768, + 0, 0, 0, 0, 0, 0, + 65408, 65280, 65024, 64512, 63488, 61440, 57344, 49152, 32768, 0, 0, 0, + 0, 0, 0, 0 + 4294967295, 4294967294, 4294967292, 4294967288, 4294967280, 4294967264, + 4294967232, 4294967168, 4294967040, 4294966784, 4294966272, 4294965248, + 4294963200, 4294959104, 4294950912, 4294934528, 4294901760, 4294836224, + 4294705152, 4294443008, 4293918720, 4292870144, 4290772992, 4286578688, + 4278190080, 4261412864, 4227858432, 4160749568, 4026531840, 3758096384, + 3221225472, 2147483648, + 4294967294, 4294967292, 4294967288, 4294967280, 4294967264, 4294967232, + 4294967168, 4294967040, 4294966784, 4294966272, 4294965248, 4294963200, + 4294959104, 4294950912, 4294934528, 4294901760, 4294836224, 4294705152, + 4294443008, 4293918720, 4292870144, 4290772992, 4286578688, 4278190080, + 4261412864, 4227858432, 4160749568, 4026531840, 3758096384, 3221225472, + 2147483648, 0, + 4294967292, 4294967288, 4294967280, 4294967264, 4294967232, 4294967168, + 4294967040, 4294966784, 4294966272, 4294965248, 4294963200, 4294959104, + 4294950912, 4294934528, 4294901760, 4294836224, 4294705152, 4294443008, + 4293918720, 4292870144, 4290772992, 4286578688, 4278190080, 4261412864, + 4227858432, 4160749568, 4026531840, 3758096384, 3221225472, 2147483648, + 0, 0, + 4294967288, 4294967280, 4294967264, 4294967232, 4294967168, 4294967040, + 4294966784, 4294966272, 4294965248, 4294963200, 4294959104, 4294950912, + 4294934528, 4294901760, 4294836224, 4294705152, 4294443008, 4293918720, + 4292870144, 4290772992, 4286578688, 4278190080, 4261412864, 4227858432, + 4160749568, 4026531840, 3758096384, 3221225472, 2147483648, 0, 0, 0, + 4294967280, 4294967264, 4294967232, 4294967168, 4294967040, 4294966784, + 4294966272, 4294965248, 4294963200, 4294959104, 4294950912, 4294934528, + 4294901760, 4294836224, 4294705152, 4294443008, 4293918720, 4292870144, + 4290772992, 4286578688, 4278190080, 4261412864, 4227858432, 4160749568, + 4026531840, 3758096384, 3221225472, 2147483648, 0, 0, 0, 0, + 4294967264, 4294967232, 4294967168, 4294967040, 4294966784, 4294966272, + 4294965248, 4294963200, 4294959104, 4294950912, 4294934528, 4294901760, + 4294836224, 4294705152, 4294443008, 4293918720, 4292870144, 4290772992, + 4286578688, 4278190080, 4261412864, 4227858432, 4160749568, 4026531840, + 3758096384, 3221225472, 2147483648, 0, 0, 0, 0, 0, + 4294967232, 4294967168, 4294967040, 4294966784, 4294966272, 4294965248, + 4294963200, 4294959104, 4294950912, 4294934528, 4294901760, 4294836224, + 4294705152, 4294443008, 4293918720, 4292870144, 4290772992, 4286578688, + 4278190080, 4261412864, 4227858432, 4160749568, 4026531840, 3758096384, + 3221225472, 2147483648, 0, 0, 0, 0, 0, 0, + 4294967168, 4294967040, 4294966784, 4294966272, 4294965248, 4294963200, + 4294959104, 4294950912, 4294934528, 4294901760, 4294836224, 4294705152, + 4294443008, 4293918720, 4292870144, 4290772992, 4286578688, 4278190080, + 4261412864, 4227858432, 4160749568, 4026531840, 3758096384, 3221225472, + 2147483648, 0, 0, 0, 0, 0, 0, 0 + 18446744073709551615, 18446744073709551614, 18446744073709551612, + 18446744073709551608, 18446744073709551600, 18446744073709551584, + 18446744073709551552, 18446744073709551488, 18446744073709551360, + 18446744073709551104, 18446744073709550592, 18446744073709549568, + 18446744073709547520, 18446744073709543424, 18446744073709535232, + 18446744073709518848, 18446744073709486080, 18446744073709420544, + 18446744073709289472, 18446744073709027328, 18446744073708503040, + 18446744073707454464, 18446744073705357312, 18446744073701163008, + 18446744073692774400, 18446744073675997184, 18446744073642442752, + 18446744073575333888, 18446744073441116160, 18446744073172680704, + 18446744072635809792, 18446744071562067968, 18446744069414584320, + 18446744065119617024, 18446744056529682432, 18446744039349813248, + 18446744004990074880, 18446743936270598144, 18446743798831644672, + 18446743523953737728, 18446742974197923840, 18446741874686296064, + 18446739675663040512, 18446735277616529408, 18446726481523507200, + 18446708889337462784, 18446673704965373952, 18446603336221196288, + 18446462598732840960, 18446181123756130304, 18445618173802708992, + 18444492273895866368, 18442240474082181120, 18437736874454810624, + 18428729675200069632, 18410715276690587648, 18374686479671623680, + 18302628885633695744, 18158513697557839872, 17870283321406128128, + 17293822569102704640, 16140901064495857664, 13835058055282163712, + 9223372036854775808, + 18446744073709551614, 18446744073709551612, 18446744073709551608, + 18446744073709551600, 18446744073709551584, 18446744073709551552, + 18446744073709551488, 18446744073709551360, 18446744073709551104, + 18446744073709550592, 18446744073709549568, 18446744073709547520, + 18446744073709543424, 18446744073709535232, 18446744073709518848, + 18446744073709486080, 18446744073709420544, 18446744073709289472, + 18446744073709027328, 18446744073708503040, 18446744073707454464, + 18446744073705357312, 18446744073701163008, 18446744073692774400, + 18446744073675997184, 18446744073642442752, 18446744073575333888, + 18446744073441116160, 18446744073172680704, 18446744072635809792, + 18446744071562067968, 18446744069414584320, 18446744065119617024, + 18446744056529682432, 18446744039349813248, 18446744004990074880, + 18446743936270598144, 18446743798831644672, 18446743523953737728, + 18446742974197923840, 18446741874686296064, 18446739675663040512, + 18446735277616529408, 18446726481523507200, 18446708889337462784, + 18446673704965373952, 18446603336221196288, 18446462598732840960, + 18446181123756130304, 18445618173802708992, 18444492273895866368, + 18442240474082181120, 18437736874454810624, 18428729675200069632, + 18410715276690587648, 18374686479671623680, 18302628885633695744, + 18158513697557839872, 17870283321406128128, 17293822569102704640, + 16140901064495857664, 13835058055282163712, 9223372036854775808, 0, + 18446744073709551612, 18446744073709551608, 18446744073709551600, + 18446744073709551584, 18446744073709551552, 18446744073709551488, + 18446744073709551360, 18446744073709551104, 18446744073709550592, + 18446744073709549568, 18446744073709547520, 18446744073709543424, + 18446744073709535232, 18446744073709518848, 18446744073709486080, + 18446744073709420544, 18446744073709289472, 18446744073709027328, + 18446744073708503040, 18446744073707454464, 18446744073705357312, + 18446744073701163008, 18446744073692774400, 18446744073675997184, + 18446744073642442752, 18446744073575333888, 18446744073441116160, + 18446744073172680704, 18446744072635809792, 18446744071562067968, + 18446744069414584320, 18446744065119617024, 18446744056529682432, + 18446744039349813248, 18446744004990074880, 18446743936270598144, + 18446743798831644672, 18446743523953737728, 18446742974197923840, + 18446741874686296064, 18446739675663040512, 18446735277616529408, + 18446726481523507200, 18446708889337462784, 18446673704965373952, + 18446603336221196288, 18446462598732840960, 18446181123756130304, + 18445618173802708992, 18444492273895866368, 18442240474082181120, + 18437736874454810624, 18428729675200069632, 18410715276690587648, + 18374686479671623680, 18302628885633695744, 18158513697557839872, + 17870283321406128128, 17293822569102704640, 16140901064495857664, + 13835058055282163712, 9223372036854775808, 0, 0, + 18446744073709551608, 18446744073709551600, 18446744073709551584, + 18446744073709551552, 18446744073709551488, 18446744073709551360, + 18446744073709551104, 18446744073709550592, 18446744073709549568, + 18446744073709547520, 18446744073709543424, 18446744073709535232, + 18446744073709518848, 18446744073709486080, 18446744073709420544, + 18446744073709289472, 18446744073709027328, 18446744073708503040, + 18446744073707454464, 18446744073705357312, 18446744073701163008, + 18446744073692774400, 18446744073675997184, 18446744073642442752, + 18446744073575333888, 18446744073441116160, 18446744073172680704, + 18446744072635809792, 18446744071562067968, 18446744069414584320, + 18446744065119617024, 18446744056529682432, 18446744039349813248, + 18446744004990074880, 18446743936270598144, 18446743798831644672, + 18446743523953737728, 18446742974197923840, 18446741874686296064, + 18446739675663040512, 18446735277616529408, 18446726481523507200, + 18446708889337462784, 18446673704965373952, 18446603336221196288, + 18446462598732840960, 18446181123756130304, 18445618173802708992, + 18444492273895866368, 18442240474082181120, 18437736874454810624, + 18428729675200069632, 18410715276690587648, 18374686479671623680, + 18302628885633695744, 18158513697557839872, 17870283321406128128, + 17293822569102704640, 16140901064495857664, 13835058055282163712, + 9223372036854775808, 0, 0, 0, + 18446744073709551600, 18446744073709551584, 18446744073709551552, + 18446744073709551488, 18446744073709551360, 18446744073709551104, + 18446744073709550592, 18446744073709549568, 18446744073709547520, + 18446744073709543424, 18446744073709535232, 18446744073709518848, + 18446744073709486080, 18446744073709420544, 18446744073709289472, + 18446744073709027328, 18446744073708503040, 18446744073707454464, + 18446744073705357312, 18446744073701163008, 18446744073692774400, + 18446744073675997184, 18446744073642442752, 18446744073575333888, + 18446744073441116160, 18446744073172680704, 18446744072635809792, + 18446744071562067968, 18446744069414584320, 18446744065119617024, + 18446744056529682432, 18446744039349813248, 18446744004990074880, + 18446743936270598144, 18446743798831644672, 18446743523953737728, + 18446742974197923840, 18446741874686296064, 18446739675663040512, + 18446735277616529408, 18446726481523507200, 18446708889337462784, + 18446673704965373952, 18446603336221196288, 18446462598732840960, + 18446181123756130304, 18445618173802708992, 18444492273895866368, + 18442240474082181120, 18437736874454810624, 18428729675200069632, + 18410715276690587648, 18374686479671623680, 18302628885633695744, + 18158513697557839872, 17870283321406128128, 17293822569102704640, + 16140901064495857664, 13835058055282163712, 9223372036854775808, 0, 0, + 0, 0, + 18446744073709551584, 18446744073709551552, 18446744073709551488, + 18446744073709551360, 18446744073709551104, 18446744073709550592, + 18446744073709549568, 18446744073709547520, 18446744073709543424, + 18446744073709535232, 18446744073709518848, 18446744073709486080, + 18446744073709420544, 18446744073709289472, 18446744073709027328, + 18446744073708503040, 18446744073707454464, 18446744073705357312, + 18446744073701163008, 18446744073692774400, 18446744073675997184, + 18446744073642442752, 18446744073575333888, 18446744073441116160, + 18446744073172680704, 18446744072635809792, 18446744071562067968, + 18446744069414584320, 18446744065119617024, 18446744056529682432, + 18446744039349813248, 18446744004990074880, 18446743936270598144, + 18446743798831644672, 18446743523953737728, 18446742974197923840, + 18446741874686296064, 18446739675663040512, 18446735277616529408, + 18446726481523507200, 18446708889337462784, 18446673704965373952, + 18446603336221196288, 18446462598732840960, 18446181123756130304, + 18445618173802708992, 18444492273895866368, 18442240474082181120, + 18437736874454810624, 18428729675200069632, 18410715276690587648, + 18374686479671623680, 18302628885633695744, 18158513697557839872, + 17870283321406128128, 17293822569102704640, 16140901064495857664, + 13835058055282163712, 9223372036854775808, 0, 0, 0, 0, 0, + 18446744073709551552, 18446744073709551488, 18446744073709551360, + 18446744073709551104, 18446744073709550592, 18446744073709549568, + 18446744073709547520, 18446744073709543424, 18446744073709535232, + 18446744073709518848, 18446744073709486080, 18446744073709420544, + 18446744073709289472, 18446744073709027328, 18446744073708503040, + 18446744073707454464, 18446744073705357312, 18446744073701163008, + 18446744073692774400, 18446744073675997184, 18446744073642442752, + 18446744073575333888, 18446744073441116160, 18446744073172680704, + 18446744072635809792, 18446744071562067968, 18446744069414584320, + 18446744065119617024, 18446744056529682432, 18446744039349813248, + 18446744004990074880, 18446743936270598144, 18446743798831644672, + 18446743523953737728, 18446742974197923840, 18446741874686296064, + 18446739675663040512, 18446735277616529408, 18446726481523507200, + 18446708889337462784, 18446673704965373952, 18446603336221196288, + 18446462598732840960, 18446181123756130304, 18445618173802708992, + 18444492273895866368, 18442240474082181120, 18437736874454810624, + 18428729675200069632, 18410715276690587648, 18374686479671623680, + 18302628885633695744, 18158513697557839872, 17870283321406128128, + 17293822569102704640, 16140901064495857664, 13835058055282163712, + 9223372036854775808, 0, 0, 0, 0, 0, 0, + 18446744073709551488, 18446744073709551360, 18446744073709551104, + 18446744073709550592, 18446744073709549568, 18446744073709547520, + 18446744073709543424, 18446744073709535232, 18446744073709518848, + 18446744073709486080, 18446744073709420544, 18446744073709289472, + 18446744073709027328, 18446744073708503040, 18446744073707454464, + 18446744073705357312, 18446744073701163008, 18446744073692774400, + 18446744073675997184, 18446744073642442752, 18446744073575333888, + 18446744073441116160, 18446744073172680704, 18446744072635809792, + 18446744071562067968, 18446744069414584320, 18446744065119617024, + 18446744056529682432, 18446744039349813248, 18446744004990074880, + 18446743936270598144, 18446743798831644672, 18446743523953737728, + 18446742974197923840, 18446741874686296064, 18446739675663040512, + 18446735277616529408, 18446726481523507200, 18446708889337462784, + 18446673704965373952, 18446603336221196288, 18446462598732840960, + 18446181123756130304, 18445618173802708992, 18444492273895866368, + 18442240474082181120, 18437736874454810624, 18428729675200069632, + 18410715276690587648, 18374686479671623680, 18302628885633695744, + 18158513697557839872, 17870283321406128128, 17293822569102704640, + 16140901064495857664, 13835058055282163712, 9223372036854775808, 0, 0, + 0, 0, 0, 0, 0 + 0, 0.0001, 0.0002, 0.0003, 0.0004, 0.0005, 0.0006, 0.0007, + 1, 1.0001, 1.0002, 1.0003, 1.0004, 1.0005, 1.0006, 1.0007, + 2, 2.0001, 2.0002, 2.0003, 2.0004, 2.0005, 2.0006, 2.0007, + 3, 3.0001, 3.0002, 3.0003, 3.0004, 3.0005, 3.0006, 3.0007, + 4, 4.0001, 4.0002, 4.0003, 4.0004, 4.0005, 4.0006, 4.0007, + 5, 5.0001, 5.0002, 5.0003, 5.0004, 5.0005, 5.0006, 5.0007, + 6, 6.0001, 6.0002, 6.0003, 6.0004, 6.0005, 6.0006, 6.0007, + 7, 7.0001, 7.0002, 7.0003, 7.0004, 7.0005, 7.0006, 7.0007 \ No newline at end of file diff --git a/tools/testfiles/tnofilename-with-packed-bits.ddl b/tools/testfiles/tnofilename-with-packed-bits.ddl index 5e6f580..440e3d9 100644 --- a/tools/testfiles/tnofilename-with-packed-bits.ddl +++ b/tools/testfiles/tnofilename-with-packed-bits.ddl @@ -46,6 +46,8 @@ usage: h5dump [OPTIONS] files occur. --no-compact-subset Disable compact form of subsetting and allow the use of "[" in dataset names. + -O F, --ddl=F Output ddl text into file F + Do not use filename F to suppress ddl display Subsetting is available by using the following options with a dataset attribute. Subsetting is done by selecting a hyperslab from the data. diff --git a/tools/testfiles/tpbitsIncomplete.ddl b/tools/testfiles/tpbitsIncomplete.ddl index 10b5a23..758b6b4 100644 --- a/tools/testfiles/tpbitsIncomplete.ddl +++ b/tools/testfiles/tpbitsIncomplete.ddl @@ -46,6 +46,8 @@ usage: h5dump [OPTIONS] files occur. --no-compact-subset Disable compact form of subsetting and allow the use of "[" in dataset names. + -O F, --ddl=F Output ddl text into file F + Do not use filename F to suppress ddl display Subsetting is available by using the following options with a dataset attribute. Subsetting is done by selecting a hyperslab from the data. diff --git a/tools/testfiles/tpbitsLengthExceeded.ddl b/tools/testfiles/tpbitsLengthExceeded.ddl index 17dd963..a85ba49 100644 --- a/tools/testfiles/tpbitsLengthExceeded.ddl +++ b/tools/testfiles/tpbitsLengthExceeded.ddl @@ -46,6 +46,8 @@ usage: h5dump [OPTIONS] files occur. --no-compact-subset Disable compact form of subsetting and allow the use of "[" in dataset names. + -O F, --ddl=F Output ddl text into file F + Do not use filename F to suppress ddl display Subsetting is available by using the following options with a dataset attribute. Subsetting is done by selecting a hyperslab from the data. diff --git a/tools/testfiles/tpbitsLengthPositive.ddl b/tools/testfiles/tpbitsLengthPositive.ddl index 6d05b47..d5a1c88 100644 --- a/tools/testfiles/tpbitsLengthPositive.ddl +++ b/tools/testfiles/tpbitsLengthPositive.ddl @@ -46,6 +46,8 @@ usage: h5dump [OPTIONS] files occur. --no-compact-subset Disable compact form of subsetting and allow the use of "[" in dataset names. + -O F, --ddl=F Output ddl text into file F + Do not use filename F to suppress ddl display Subsetting is available by using the following options with a dataset attribute. Subsetting is done by selecting a hyperslab from the data. diff --git a/tools/testfiles/tpbitsMaxExceeded.ddl b/tools/testfiles/tpbitsMaxExceeded.ddl index eca1248..e24245c 100644 --- a/tools/testfiles/tpbitsMaxExceeded.ddl +++ b/tools/testfiles/tpbitsMaxExceeded.ddl @@ -46,6 +46,8 @@ usage: h5dump [OPTIONS] files occur. --no-compact-subset Disable compact form of subsetting and allow the use of "[" in dataset names. + -O F, --ddl=F Output ddl text into file F + Do not use filename F to suppress ddl display Subsetting is available by using the following options with a dataset attribute. Subsetting is done by selecting a hyperslab from the data. diff --git a/tools/testfiles/tpbitsOffsetExceeded.ddl b/tools/testfiles/tpbitsOffsetExceeded.ddl index b0c655d..8f58c47 100644 --- a/tools/testfiles/tpbitsOffsetExceeded.ddl +++ b/tools/testfiles/tpbitsOffsetExceeded.ddl @@ -46,6 +46,8 @@ usage: h5dump [OPTIONS] files occur. --no-compact-subset Disable compact form of subsetting and allow the use of "[" in dataset names. + -O F, --ddl=F Output ddl text into file F + Do not use filename F to suppress ddl display Subsetting is available by using the following options with a dataset attribute. Subsetting is done by selecting a hyperslab from the data. diff --git a/tools/testfiles/tpbitsOffsetNegative.ddl b/tools/testfiles/tpbitsOffsetNegative.ddl index 213641b..6df8cce 100644 --- a/tools/testfiles/tpbitsOffsetNegative.ddl +++ b/tools/testfiles/tpbitsOffsetNegative.ddl @@ -46,6 +46,8 @@ usage: h5dump [OPTIONS] files occur. --no-compact-subset Disable compact form of subsetting and allow the use of "[" in dataset names. + -O F, --ddl=F Output ddl text into file F + Do not use filename F to suppress ddl display Subsetting is available by using the following options with a dataset attribute. Subsetting is done by selecting a hyperslab from the data. diff --git a/tools/testfiles/trawdatafile.ddl b/tools/testfiles/trawdatafile.ddl new file mode 100644 index 0000000..f99d906 --- /dev/null +++ b/tools/testfiles/trawdatafile.ddl @@ -0,0 +1,58 @@ +HDF5 "packedbits.h5" { +GROUP "/" { + DATASET "DS08BITS" { + DATATYPE H5T_STD_I8LE + DATASPACE SIMPLE { ( 8, 8 ) / ( 8, 8 ) } + DATA { + } + } + DATASET "DS16BITS" { + DATATYPE H5T_STD_I16LE + DATASPACE SIMPLE { ( 8, 16 ) / ( 8, 16 ) } + DATA { + } + } + DATASET "DS32BITS" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 8, 32 ) / ( 8, 32 ) } + DATA { + } + } + DATASET "DS64BITS" { + DATATYPE H5T_STD_I64LE + DATASPACE SIMPLE { ( 8, 64 ) / ( 8, 64 ) } + DATA { + } + } + DATASET "DU08BITS" { + DATATYPE H5T_STD_U8LE + DATASPACE SIMPLE { ( 8, 8 ) / ( 8, 8 ) } + DATA { + } + } + DATASET "DU16BITS" { + DATATYPE H5T_STD_U16LE + DATASPACE SIMPLE { ( 8, 16 ) / ( 8, 16 ) } + DATA { + } + } + DATASET "DU32BITS" { + DATATYPE H5T_STD_U32LE + DATASPACE SIMPLE { ( 8, 32 ) / ( 8, 32 ) } + DATA { + } + } + DATASET "DU64BITS" { + DATATYPE H5T_STD_U64LE + DATASPACE SIMPLE { ( 8, 64 ) / ( 8, 64 ) } + DATA { + } + } + DATASET "DummyDBL" { + DATATYPE H5T_IEEE_F64BE + DATASPACE SIMPLE { ( 8, 8 ) / ( 8, 8 ) } + DATA { + } + } +} +} diff --git a/tools/testfiles/trawdatafile.exp b/tools/testfiles/trawdatafile.exp new file mode 100644 index 0000000..dc19888 --- /dev/null +++ b/tools/testfiles/trawdatafile.exp @@ -0,0 +1,402 @@ + + -1, -2, -4, -8, -16, -32, -64, -128, + -2, -4, -8, -16, -32, -64, -128, 0, + -4, -8, -16, -32, -64, -128, 0, 0, + -8, -16, -32, -64, -128, 0, 0, 0, + -16, -32, -64, -128, 0, 0, 0, 0, + -32, -64, -128, 0, 0, 0, 0, 0, + -64, -128, 0, 0, 0, 0, 0, 0, + -128, 0, 0, 0, 0, 0, 0, 0 + -1, -2, -4, -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, + -8192, -16384, -32768, + -2, -4, -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, + -8192, -16384, -32768, 0, + -4, -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, + -16384, -32768, 0, 0, + -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, + -16384, -32768, 0, 0, 0, + -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, -16384, + -32768, 0, 0, 0, 0, + -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, -16384, -32768, + 0, 0, 0, 0, 0, + -64, -128, -256, -512, -1024, -2048, -4096, -8192, -16384, -32768, 0, + 0, 0, 0, 0, 0, + -128, -256, -512, -1024, -2048, -4096, -8192, -16384, -32768, 0, 0, 0, + 0, 0, 0, 0 + -1, -2, -4, -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, + -8192, -16384, -32768, -65536, -131072, -262144, -524288, -1048576, + -2097152, -4194304, -8388608, -16777216, -33554432, -67108864, + -134217728, -268435456, -536870912, -1073741824, -2147483648, + -2, -4, -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, + -8192, -16384, -32768, -65536, -131072, -262144, -524288, -1048576, + -2097152, -4194304, -8388608, -16777216, -33554432, -67108864, + -134217728, -268435456, -536870912, -1073741824, -2147483648, 0, + -4, -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, + -16384, -32768, -65536, -131072, -262144, -524288, -1048576, -2097152, + -4194304, -8388608, -16777216, -33554432, -67108864, -134217728, + -268435456, -536870912, -1073741824, -2147483648, 0, 0, + -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, + -16384, -32768, -65536, -131072, -262144, -524288, -1048576, -2097152, + -4194304, -8388608, -16777216, -33554432, -67108864, -134217728, + -268435456, -536870912, -1073741824, -2147483648, 0, 0, 0, + -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, -16384, + -32768, -65536, -131072, -262144, -524288, -1048576, -2097152, + -4194304, -8388608, -16777216, -33554432, -67108864, -134217728, + -268435456, -536870912, -1073741824, -2147483648, 0, 0, 0, 0, + -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, -16384, -32768, + -65536, -131072, -262144, -524288, -1048576, -2097152, -4194304, + -8388608, -16777216, -33554432, -67108864, -134217728, -268435456, + -536870912, -1073741824, -2147483648, 0, 0, 0, 0, 0, + -64, -128, -256, -512, -1024, -2048, -4096, -8192, -16384, -32768, + -65536, -131072, -262144, -524288, -1048576, -2097152, -4194304, + -8388608, -16777216, -33554432, -67108864, -134217728, -268435456, + -536870912, -1073741824, -2147483648, 0, 0, 0, 0, 0, 0, + -128, -256, -512, -1024, -2048, -4096, -8192, -16384, -32768, -65536, + -131072, -262144, -524288, -1048576, -2097152, -4194304, -8388608, + -16777216, -33554432, -67108864, -134217728, -268435456, -536870912, + -1073741824, -2147483648, 0, 0, 0, 0, 0, 0, 0 + -1, -2, -4, -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, + -8192, -16384, -32768, -65536, -131072, -262144, -524288, -1048576, + -2097152, -4194304, -8388608, -16777216, -33554432, -67108864, + -134217728, -268435456, -536870912, -1073741824, -2147483648, + -4294967296, -8589934592, -17179869184, -34359738368, -68719476736, + -137438953472, -274877906944, -549755813888, -1099511627776, + -2199023255552, -4398046511104, -8796093022208, -17592186044416, + -35184372088832, -70368744177664, -140737488355328, -281474976710656, + -562949953421312, -1125899906842624, -2251799813685248, + -4503599627370496, -9007199254740992, -18014398509481984, + -36028797018963968, -72057594037927936, -144115188075855872, + -288230376151711744, -576460752303423488, -1152921504606846976, + -2305843009213693952, -4611686018427387904, -9223372036854775808, + -2, -4, -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, + -8192, -16384, -32768, -65536, -131072, -262144, -524288, -1048576, + -2097152, -4194304, -8388608, -16777216, -33554432, -67108864, + -134217728, -268435456, -536870912, -1073741824, -2147483648, + -4294967296, -8589934592, -17179869184, -34359738368, -68719476736, + -137438953472, -274877906944, -549755813888, -1099511627776, + -2199023255552, -4398046511104, -8796093022208, -17592186044416, + -35184372088832, -70368744177664, -140737488355328, -281474976710656, + -562949953421312, -1125899906842624, -2251799813685248, + -4503599627370496, -9007199254740992, -18014398509481984, + -36028797018963968, -72057594037927936, -144115188075855872, + -288230376151711744, -576460752303423488, -1152921504606846976, + -2305843009213693952, -4611686018427387904, -9223372036854775808, 0, + -4, -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, + -16384, -32768, -65536, -131072, -262144, -524288, -1048576, -2097152, + -4194304, -8388608, -16777216, -33554432, -67108864, -134217728, + -268435456, -536870912, -1073741824, -2147483648, -4294967296, + -8589934592, -17179869184, -34359738368, -68719476736, -137438953472, + -274877906944, -549755813888, -1099511627776, -2199023255552, + -4398046511104, -8796093022208, -17592186044416, -35184372088832, + -70368744177664, -140737488355328, -281474976710656, -562949953421312, + -1125899906842624, -2251799813685248, -4503599627370496, + -9007199254740992, -18014398509481984, -36028797018963968, + -72057594037927936, -144115188075855872, -288230376151711744, + -576460752303423488, -1152921504606846976, -2305843009213693952, + -4611686018427387904, -9223372036854775808, 0, 0, + -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, + -16384, -32768, -65536, -131072, -262144, -524288, -1048576, -2097152, + -4194304, -8388608, -16777216, -33554432, -67108864, -134217728, + -268435456, -536870912, -1073741824, -2147483648, -4294967296, + -8589934592, -17179869184, -34359738368, -68719476736, -137438953472, + -274877906944, -549755813888, -1099511627776, -2199023255552, + -4398046511104, -8796093022208, -17592186044416, -35184372088832, + -70368744177664, -140737488355328, -281474976710656, -562949953421312, + -1125899906842624, -2251799813685248, -4503599627370496, + -9007199254740992, -18014398509481984, -36028797018963968, + -72057594037927936, -144115188075855872, -288230376151711744, + -576460752303423488, -1152921504606846976, -2305843009213693952, + -4611686018427387904, -9223372036854775808, 0, 0, 0, + -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, -16384, + -32768, -65536, -131072, -262144, -524288, -1048576, -2097152, + -4194304, -8388608, -16777216, -33554432, -67108864, -134217728, + -268435456, -536870912, -1073741824, -2147483648, -4294967296, + -8589934592, -17179869184, -34359738368, -68719476736, -137438953472, + -274877906944, -549755813888, -1099511627776, -2199023255552, + -4398046511104, -8796093022208, -17592186044416, -35184372088832, + -70368744177664, -140737488355328, -281474976710656, -562949953421312, + -1125899906842624, -2251799813685248, -4503599627370496, + -9007199254740992, -18014398509481984, -36028797018963968, + -72057594037927936, -144115188075855872, -288230376151711744, + -576460752303423488, -1152921504606846976, -2305843009213693952, + -4611686018427387904, -9223372036854775808, 0, 0, 0, 0, + -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, -16384, -32768, + -65536, -131072, -262144, -524288, -1048576, -2097152, -4194304, + -8388608, -16777216, -33554432, -67108864, -134217728, -268435456, + -536870912, -1073741824, -2147483648, -4294967296, -8589934592, + -17179869184, -34359738368, -68719476736, -137438953472, -274877906944, + -549755813888, -1099511627776, -2199023255552, -4398046511104, + -8796093022208, -17592186044416, -35184372088832, -70368744177664, + -140737488355328, -281474976710656, -562949953421312, + -1125899906842624, -2251799813685248, -4503599627370496, + -9007199254740992, -18014398509481984, -36028797018963968, + -72057594037927936, -144115188075855872, -288230376151711744, + -576460752303423488, -1152921504606846976, -2305843009213693952, + -4611686018427387904, -9223372036854775808, 0, 0, 0, 0, 0, + -64, -128, -256, -512, -1024, -2048, -4096, -8192, -16384, -32768, + -65536, -131072, -262144, -524288, -1048576, -2097152, -4194304, + -8388608, -16777216, -33554432, -67108864, -134217728, -268435456, + -536870912, -1073741824, -2147483648, -4294967296, -8589934592, + -17179869184, -34359738368, -68719476736, -137438953472, -274877906944, + -549755813888, -1099511627776, -2199023255552, -4398046511104, + -8796093022208, -17592186044416, -35184372088832, -70368744177664, + -140737488355328, -281474976710656, -562949953421312, + -1125899906842624, -2251799813685248, -4503599627370496, + -9007199254740992, -18014398509481984, -36028797018963968, + -72057594037927936, -144115188075855872, -288230376151711744, + -576460752303423488, -1152921504606846976, -2305843009213693952, + -4611686018427387904, -9223372036854775808, 0, 0, 0, 0, 0, 0, + -128, -256, -512, -1024, -2048, -4096, -8192, -16384, -32768, -65536, + -131072, -262144, -524288, -1048576, -2097152, -4194304, -8388608, + -16777216, -33554432, -67108864, -134217728, -268435456, -536870912, + -1073741824, -2147483648, -4294967296, -8589934592, -17179869184, + -34359738368, -68719476736, -137438953472, -274877906944, + -549755813888, -1099511627776, -2199023255552, -4398046511104, + -8796093022208, -17592186044416, -35184372088832, -70368744177664, + -140737488355328, -281474976710656, -562949953421312, + -1125899906842624, -2251799813685248, -4503599627370496, + -9007199254740992, -18014398509481984, -36028797018963968, + -72057594037927936, -144115188075855872, -288230376151711744, + -576460752303423488, -1152921504606846976, -2305843009213693952, + -4611686018427387904, -9223372036854775808, 0, 0, 0, 0, 0, 0, 0 + 255, 254, 252, 248, 240, 224, 192, 128, + 254, 252, 248, 240, 224, 192, 128, 0, + 252, 248, 240, 224, 192, 128, 0, 0, + 248, 240, 224, 192, 128, 0, 0, 0, + 240, 224, 192, 128, 0, 0, 0, 0, + 224, 192, 128, 0, 0, 0, 0, 0, + 192, 128, 0, 0, 0, 0, 0, 0, + 128, 0, 0, 0, 0, 0, 0, 0 + 65535, 65534, 65532, 65528, 65520, 65504, 65472, 65408, 65280, 65024, + 64512, 63488, 61440, 57344, 49152, 32768, + 65534, 65532, 65528, 65520, 65504, 65472, 65408, 65280, 65024, 64512, + 63488, 61440, 57344, 49152, 32768, 0, + 65532, 65528, 65520, 65504, 65472, 65408, 65280, 65024, 64512, 63488, + 61440, 57344, 49152, 32768, 0, 0, + 65528, 65520, 65504, 65472, 65408, 65280, 65024, 64512, 63488, 61440, + 57344, 49152, 32768, 0, 0, 0, + 65520, 65504, 65472, 65408, 65280, 65024, 64512, 63488, 61440, 57344, + 49152, 32768, 0, 0, 0, 0, + 65504, 65472, 65408, 65280, 65024, 64512, 63488, 61440, 57344, 49152, + 32768, 0, 0, 0, 0, 0, + 65472, 65408, 65280, 65024, 64512, 63488, 61440, 57344, 49152, 32768, + 0, 0, 0, 0, 0, 0, + 65408, 65280, 65024, 64512, 63488, 61440, 57344, 49152, 32768, 0, 0, 0, + 0, 0, 0, 0 + 4294967295, 4294967294, 4294967292, 4294967288, 4294967280, 4294967264, + 4294967232, 4294967168, 4294967040, 4294966784, 4294966272, 4294965248, + 4294963200, 4294959104, 4294950912, 4294934528, 4294901760, 4294836224, + 4294705152, 4294443008, 4293918720, 4292870144, 4290772992, 4286578688, + 4278190080, 4261412864, 4227858432, 4160749568, 4026531840, 3758096384, + 3221225472, 2147483648, + 4294967294, 4294967292, 4294967288, 4294967280, 4294967264, 4294967232, + 4294967168, 4294967040, 4294966784, 4294966272, 4294965248, 4294963200, + 4294959104, 4294950912, 4294934528, 4294901760, 4294836224, 4294705152, + 4294443008, 4293918720, 4292870144, 4290772992, 4286578688, 4278190080, + 4261412864, 4227858432, 4160749568, 4026531840, 3758096384, 3221225472, + 2147483648, 0, + 4294967292, 4294967288, 4294967280, 4294967264, 4294967232, 4294967168, + 4294967040, 4294966784, 4294966272, 4294965248, 4294963200, 4294959104, + 4294950912, 4294934528, 4294901760, 4294836224, 4294705152, 4294443008, + 4293918720, 4292870144, 4290772992, 4286578688, 4278190080, 4261412864, + 4227858432, 4160749568, 4026531840, 3758096384, 3221225472, 2147483648, + 0, 0, + 4294967288, 4294967280, 4294967264, 4294967232, 4294967168, 4294967040, + 4294966784, 4294966272, 4294965248, 4294963200, 4294959104, 4294950912, + 4294934528, 4294901760, 4294836224, 4294705152, 4294443008, 4293918720, + 4292870144, 4290772992, 4286578688, 4278190080, 4261412864, 4227858432, + 4160749568, 4026531840, 3758096384, 3221225472, 2147483648, 0, 0, 0, + 4294967280, 4294967264, 4294967232, 4294967168, 4294967040, 4294966784, + 4294966272, 4294965248, 4294963200, 4294959104, 4294950912, 4294934528, + 4294901760, 4294836224, 4294705152, 4294443008, 4293918720, 4292870144, + 4290772992, 4286578688, 4278190080, 4261412864, 4227858432, 4160749568, + 4026531840, 3758096384, 3221225472, 2147483648, 0, 0, 0, 0, + 4294967264, 4294967232, 4294967168, 4294967040, 4294966784, 4294966272, + 4294965248, 4294963200, 4294959104, 4294950912, 4294934528, 4294901760, + 4294836224, 4294705152, 4294443008, 4293918720, 4292870144, 4290772992, + 4286578688, 4278190080, 4261412864, 4227858432, 4160749568, 4026531840, + 3758096384, 3221225472, 2147483648, 0, 0, 0, 0, 0, + 4294967232, 4294967168, 4294967040, 4294966784, 4294966272, 4294965248, + 4294963200, 4294959104, 4294950912, 4294934528, 4294901760, 4294836224, + 4294705152, 4294443008, 4293918720, 4292870144, 4290772992, 4286578688, + 4278190080, 4261412864, 4227858432, 4160749568, 4026531840, 3758096384, + 3221225472, 2147483648, 0, 0, 0, 0, 0, 0, + 4294967168, 4294967040, 4294966784, 4294966272, 4294965248, 4294963200, + 4294959104, 4294950912, 4294934528, 4294901760, 4294836224, 4294705152, + 4294443008, 4293918720, 4292870144, 4290772992, 4286578688, 4278190080, + 4261412864, 4227858432, 4160749568, 4026531840, 3758096384, 3221225472, + 2147483648, 0, 0, 0, 0, 0, 0, 0 + 18446744073709551615, 18446744073709551614, 18446744073709551612, + 18446744073709551608, 18446744073709551600, 18446744073709551584, + 18446744073709551552, 18446744073709551488, 18446744073709551360, + 18446744073709551104, 18446744073709550592, 18446744073709549568, + 18446744073709547520, 18446744073709543424, 18446744073709535232, + 18446744073709518848, 18446744073709486080, 18446744073709420544, + 18446744073709289472, 18446744073709027328, 18446744073708503040, + 18446744073707454464, 18446744073705357312, 18446744073701163008, + 18446744073692774400, 18446744073675997184, 18446744073642442752, + 18446744073575333888, 18446744073441116160, 18446744073172680704, + 18446744072635809792, 18446744071562067968, 18446744069414584320, + 18446744065119617024, 18446744056529682432, 18446744039349813248, + 18446744004990074880, 18446743936270598144, 18446743798831644672, + 18446743523953737728, 18446742974197923840, 18446741874686296064, + 18446739675663040512, 18446735277616529408, 18446726481523507200, + 18446708889337462784, 18446673704965373952, 18446603336221196288, + 18446462598732840960, 18446181123756130304, 18445618173802708992, + 18444492273895866368, 18442240474082181120, 18437736874454810624, + 18428729675200069632, 18410715276690587648, 18374686479671623680, + 18302628885633695744, 18158513697557839872, 17870283321406128128, + 17293822569102704640, 16140901064495857664, 13835058055282163712, + 9223372036854775808, + 18446744073709551614, 18446744073709551612, 18446744073709551608, + 18446744073709551600, 18446744073709551584, 18446744073709551552, + 18446744073709551488, 18446744073709551360, 18446744073709551104, + 18446744073709550592, 18446744073709549568, 18446744073709547520, + 18446744073709543424, 18446744073709535232, 18446744073709518848, + 18446744073709486080, 18446744073709420544, 18446744073709289472, + 18446744073709027328, 18446744073708503040, 18446744073707454464, + 18446744073705357312, 18446744073701163008, 18446744073692774400, + 18446744073675997184, 18446744073642442752, 18446744073575333888, + 18446744073441116160, 18446744073172680704, 18446744072635809792, + 18446744071562067968, 18446744069414584320, 18446744065119617024, + 18446744056529682432, 18446744039349813248, 18446744004990074880, + 18446743936270598144, 18446743798831644672, 18446743523953737728, + 18446742974197923840, 18446741874686296064, 18446739675663040512, + 18446735277616529408, 18446726481523507200, 18446708889337462784, + 18446673704965373952, 18446603336221196288, 18446462598732840960, + 18446181123756130304, 18445618173802708992, 18444492273895866368, + 18442240474082181120, 18437736874454810624, 18428729675200069632, + 18410715276690587648, 18374686479671623680, 18302628885633695744, + 18158513697557839872, 17870283321406128128, 17293822569102704640, + 16140901064495857664, 13835058055282163712, 9223372036854775808, 0, + 18446744073709551612, 18446744073709551608, 18446744073709551600, + 18446744073709551584, 18446744073709551552, 18446744073709551488, + 18446744073709551360, 18446744073709551104, 18446744073709550592, + 18446744073709549568, 18446744073709547520, 18446744073709543424, + 18446744073709535232, 18446744073709518848, 18446744073709486080, + 18446744073709420544, 18446744073709289472, 18446744073709027328, + 18446744073708503040, 18446744073707454464, 18446744073705357312, + 18446744073701163008, 18446744073692774400, 18446744073675997184, + 18446744073642442752, 18446744073575333888, 18446744073441116160, + 18446744073172680704, 18446744072635809792, 18446744071562067968, + 18446744069414584320, 18446744065119617024, 18446744056529682432, + 18446744039349813248, 18446744004990074880, 18446743936270598144, + 18446743798831644672, 18446743523953737728, 18446742974197923840, + 18446741874686296064, 18446739675663040512, 18446735277616529408, + 18446726481523507200, 18446708889337462784, 18446673704965373952, + 18446603336221196288, 18446462598732840960, 18446181123756130304, + 18445618173802708992, 18444492273895866368, 18442240474082181120, + 18437736874454810624, 18428729675200069632, 18410715276690587648, + 18374686479671623680, 18302628885633695744, 18158513697557839872, + 17870283321406128128, 17293822569102704640, 16140901064495857664, + 13835058055282163712, 9223372036854775808, 0, 0, + 18446744073709551608, 18446744073709551600, 18446744073709551584, + 18446744073709551552, 18446744073709551488, 18446744073709551360, + 18446744073709551104, 18446744073709550592, 18446744073709549568, + 18446744073709547520, 18446744073709543424, 18446744073709535232, + 18446744073709518848, 18446744073709486080, 18446744073709420544, + 18446744073709289472, 18446744073709027328, 18446744073708503040, + 18446744073707454464, 18446744073705357312, 18446744073701163008, + 18446744073692774400, 18446744073675997184, 18446744073642442752, + 18446744073575333888, 18446744073441116160, 18446744073172680704, + 18446744072635809792, 18446744071562067968, 18446744069414584320, + 18446744065119617024, 18446744056529682432, 18446744039349813248, + 18446744004990074880, 18446743936270598144, 18446743798831644672, + 18446743523953737728, 18446742974197923840, 18446741874686296064, + 18446739675663040512, 18446735277616529408, 18446726481523507200, + 18446708889337462784, 18446673704965373952, 18446603336221196288, + 18446462598732840960, 18446181123756130304, 18445618173802708992, + 18444492273895866368, 18442240474082181120, 18437736874454810624, + 18428729675200069632, 18410715276690587648, 18374686479671623680, + 18302628885633695744, 18158513697557839872, 17870283321406128128, + 17293822569102704640, 16140901064495857664, 13835058055282163712, + 9223372036854775808, 0, 0, 0, + 18446744073709551600, 18446744073709551584, 18446744073709551552, + 18446744073709551488, 18446744073709551360, 18446744073709551104, + 18446744073709550592, 18446744073709549568, 18446744073709547520, + 18446744073709543424, 18446744073709535232, 18446744073709518848, + 18446744073709486080, 18446744073709420544, 18446744073709289472, + 18446744073709027328, 18446744073708503040, 18446744073707454464, + 18446744073705357312, 18446744073701163008, 18446744073692774400, + 18446744073675997184, 18446744073642442752, 18446744073575333888, + 18446744073441116160, 18446744073172680704, 18446744072635809792, + 18446744071562067968, 18446744069414584320, 18446744065119617024, + 18446744056529682432, 18446744039349813248, 18446744004990074880, + 18446743936270598144, 18446743798831644672, 18446743523953737728, + 18446742974197923840, 18446741874686296064, 18446739675663040512, + 18446735277616529408, 18446726481523507200, 18446708889337462784, + 18446673704965373952, 18446603336221196288, 18446462598732840960, + 18446181123756130304, 18445618173802708992, 18444492273895866368, + 18442240474082181120, 18437736874454810624, 18428729675200069632, + 18410715276690587648, 18374686479671623680, 18302628885633695744, + 18158513697557839872, 17870283321406128128, 17293822569102704640, + 16140901064495857664, 13835058055282163712, 9223372036854775808, 0, 0, + 0, 0, + 18446744073709551584, 18446744073709551552, 18446744073709551488, + 18446744073709551360, 18446744073709551104, 18446744073709550592, + 18446744073709549568, 18446744073709547520, 18446744073709543424, + 18446744073709535232, 18446744073709518848, 18446744073709486080, + 18446744073709420544, 18446744073709289472, 18446744073709027328, + 18446744073708503040, 18446744073707454464, 18446744073705357312, + 18446744073701163008, 18446744073692774400, 18446744073675997184, + 18446744073642442752, 18446744073575333888, 18446744073441116160, + 18446744073172680704, 18446744072635809792, 18446744071562067968, + 18446744069414584320, 18446744065119617024, 18446744056529682432, + 18446744039349813248, 18446744004990074880, 18446743936270598144, + 18446743798831644672, 18446743523953737728, 18446742974197923840, + 18446741874686296064, 18446739675663040512, 18446735277616529408, + 18446726481523507200, 18446708889337462784, 18446673704965373952, + 18446603336221196288, 18446462598732840960, 18446181123756130304, + 18445618173802708992, 18444492273895866368, 18442240474082181120, + 18437736874454810624, 18428729675200069632, 18410715276690587648, + 18374686479671623680, 18302628885633695744, 18158513697557839872, + 17870283321406128128, 17293822569102704640, 16140901064495857664, + 13835058055282163712, 9223372036854775808, 0, 0, 0, 0, 0, + 18446744073709551552, 18446744073709551488, 18446744073709551360, + 18446744073709551104, 18446744073709550592, 18446744073709549568, + 18446744073709547520, 18446744073709543424, 18446744073709535232, + 18446744073709518848, 18446744073709486080, 18446744073709420544, + 18446744073709289472, 18446744073709027328, 18446744073708503040, + 18446744073707454464, 18446744073705357312, 18446744073701163008, + 18446744073692774400, 18446744073675997184, 18446744073642442752, + 18446744073575333888, 18446744073441116160, 18446744073172680704, + 18446744072635809792, 18446744071562067968, 18446744069414584320, + 18446744065119617024, 18446744056529682432, 18446744039349813248, + 18446744004990074880, 18446743936270598144, 18446743798831644672, + 18446743523953737728, 18446742974197923840, 18446741874686296064, + 18446739675663040512, 18446735277616529408, 18446726481523507200, + 18446708889337462784, 18446673704965373952, 18446603336221196288, + 18446462598732840960, 18446181123756130304, 18445618173802708992, + 18444492273895866368, 18442240474082181120, 18437736874454810624, + 18428729675200069632, 18410715276690587648, 18374686479671623680, + 18302628885633695744, 18158513697557839872, 17870283321406128128, + 17293822569102704640, 16140901064495857664, 13835058055282163712, + 9223372036854775808, 0, 0, 0, 0, 0, 0, + 18446744073709551488, 18446744073709551360, 18446744073709551104, + 18446744073709550592, 18446744073709549568, 18446744073709547520, + 18446744073709543424, 18446744073709535232, 18446744073709518848, + 18446744073709486080, 18446744073709420544, 18446744073709289472, + 18446744073709027328, 18446744073708503040, 18446744073707454464, + 18446744073705357312, 18446744073701163008, 18446744073692774400, + 18446744073675997184, 18446744073642442752, 18446744073575333888, + 18446744073441116160, 18446744073172680704, 18446744072635809792, + 18446744071562067968, 18446744069414584320, 18446744065119617024, + 18446744056529682432, 18446744039349813248, 18446744004990074880, + 18446743936270598144, 18446743798831644672, 18446743523953737728, + 18446742974197923840, 18446741874686296064, 18446739675663040512, + 18446735277616529408, 18446726481523507200, 18446708889337462784, + 18446673704965373952, 18446603336221196288, 18446462598732840960, + 18446181123756130304, 18445618173802708992, 18444492273895866368, + 18442240474082181120, 18437736874454810624, 18428729675200069632, + 18410715276690587648, 18374686479671623680, 18302628885633695744, + 18158513697557839872, 17870283321406128128, 17293822569102704640, + 16140901064495857664, 13835058055282163712, 9223372036854775808, 0, 0, + 0, 0, 0, 0, 0 + 0, 0.0001, 0.0002, 0.0003, 0.0004, 0.0005, 0.0006, 0.0007, + 1, 1.0001, 1.0002, 1.0003, 1.0004, 1.0005, 1.0006, 1.0007, + 2, 2.0001, 2.0002, 2.0003, 2.0004, 2.0005, 2.0006, 2.0007, + 3, 3.0001, 3.0002, 3.0003, 3.0004, 3.0005, 3.0006, 3.0007, + 4, 4.0001, 4.0002, 4.0003, 4.0004, 4.0005, 4.0006, 4.0007, + 5, 5.0001, 5.0002, 5.0003, 5.0004, 5.0005, 5.0006, 5.0007, + 6, 6.0001, 6.0002, 6.0003, 6.0004, 6.0005, 6.0006, 6.0007, + 7, 7.0001, 7.0002, 7.0003, 7.0004, 7.0005, 7.0006, 7.0007 \ No newline at end of file diff --git a/tools/testfiles/tstr2bin2.exp b/tools/testfiles/tstr2bin2.exp new file mode 100644 index 0000000..5d4c544 --- /dev/null +++ b/tools/testfiles/tstr2bin2.exp @@ -0,0 +1 @@ +This is row 0 of type H5T_STR_NULLTERM of string This is row 1 of type H5T_STR_NULLTERM of string This is row 2 of type H5T_STR_NULLTERM of string This is row 3 of type H5T_STR_NULLTERM of string This is row 4 of type H5T_STR_NULLTERM of string This is row 5 of type H5T_STR_NULLTERM of string This is row 6 of type H5T_STR_NULLTERM of string This is row 7 of type H5T_STR_NULLTERM of string This is row 8 of type H5T_STR_NULLTERM of string This is row 9 of type H5T_STR_NULLTERM of string \ No newline at end of file diff --git a/tools/testfiles/tstr2bin6.exp b/tools/testfiles/tstr2bin6.exp new file mode 100644 index 0000000..5c6c22a --- /dev/null +++ b/tools/testfiles/tstr2bin6.exp @@ -0,0 +1 @@ +This is row 0 of type H5T_STR_SPACEPAD of string aThis is row 1 of type H5T_STR_SPACEPAD of string aThis is row 2 of type H5T_STR_SPACEPAD of string aThis is row 3 of type H5T_STR_SPACEPAD of string aThis is row 4 of type H5T_STR_SPACEPAD of string aThis is row 5 of type H5T_STR_SPACEPAD of string aThis is row 6 of type H5T_STR_SPACEPAD of string aThis is row 7 of type H5T_STR_SPACEPAD of string aThis is row 8 of type H5T_STR_SPACEPAD of string aThis is row 9 of type H5T_STR_SPACEPAD of string a \ No newline at end of file diff --git a/tools/testfiles/twithddl.exp b/tools/testfiles/twithddl.exp new file mode 100644 index 0000000..f99d906 --- /dev/null +++ b/tools/testfiles/twithddl.exp @@ -0,0 +1,58 @@ +HDF5 "packedbits.h5" { +GROUP "/" { + DATASET "DS08BITS" { + DATATYPE H5T_STD_I8LE + DATASPACE SIMPLE { ( 8, 8 ) / ( 8, 8 ) } + DATA { + } + } + DATASET "DS16BITS" { + DATATYPE H5T_STD_I16LE + DATASPACE SIMPLE { ( 8, 16 ) / ( 8, 16 ) } + DATA { + } + } + DATASET "DS32BITS" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 8, 32 ) / ( 8, 32 ) } + DATA { + } + } + DATASET "DS64BITS" { + DATATYPE H5T_STD_I64LE + DATASPACE SIMPLE { ( 8, 64 ) / ( 8, 64 ) } + DATA { + } + } + DATASET "DU08BITS" { + DATATYPE H5T_STD_U8LE + DATASPACE SIMPLE { ( 8, 8 ) / ( 8, 8 ) } + DATA { + } + } + DATASET "DU16BITS" { + DATATYPE H5T_STD_U16LE + DATASPACE SIMPLE { ( 8, 16 ) / ( 8, 16 ) } + DATA { + } + } + DATASET "DU32BITS" { + DATATYPE H5T_STD_U32LE + DATASPACE SIMPLE { ( 8, 32 ) / ( 8, 32 ) } + DATA { + } + } + DATASET "DU64BITS" { + DATATYPE H5T_STD_U64LE + DATASPACE SIMPLE { ( 8, 64 ) / ( 8, 64 ) } + DATA { + } + } + DATASET "DummyDBL" { + DATATYPE H5T_IEEE_F64BE + DATASPACE SIMPLE { ( 8, 8 ) / ( 8, 8 ) } + DATA { + } + } +} +} diff --git a/tools/testfiles/twithddlfile.ddl b/tools/testfiles/twithddlfile.ddl new file mode 100644 index 0000000..e69de29 diff --git a/tools/testfiles/twithddlfile.exp b/tools/testfiles/twithddlfile.exp new file mode 100644 index 0000000..dc19888 --- /dev/null +++ b/tools/testfiles/twithddlfile.exp @@ -0,0 +1,402 @@ + + -1, -2, -4, -8, -16, -32, -64, -128, + -2, -4, -8, -16, -32, -64, -128, 0, + -4, -8, -16, -32, -64, -128, 0, 0, + -8, -16, -32, -64, -128, 0, 0, 0, + -16, -32, -64, -128, 0, 0, 0, 0, + -32, -64, -128, 0, 0, 0, 0, 0, + -64, -128, 0, 0, 0, 0, 0, 0, + -128, 0, 0, 0, 0, 0, 0, 0 + -1, -2, -4, -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, + -8192, -16384, -32768, + -2, -4, -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, + -8192, -16384, -32768, 0, + -4, -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, + -16384, -32768, 0, 0, + -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, + -16384, -32768, 0, 0, 0, + -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, -16384, + -32768, 0, 0, 0, 0, + -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, -16384, -32768, + 0, 0, 0, 0, 0, + -64, -128, -256, -512, -1024, -2048, -4096, -8192, -16384, -32768, 0, + 0, 0, 0, 0, 0, + -128, -256, -512, -1024, -2048, -4096, -8192, -16384, -32768, 0, 0, 0, + 0, 0, 0, 0 + -1, -2, -4, -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, + -8192, -16384, -32768, -65536, -131072, -262144, -524288, -1048576, + -2097152, -4194304, -8388608, -16777216, -33554432, -67108864, + -134217728, -268435456, -536870912, -1073741824, -2147483648, + -2, -4, -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, + -8192, -16384, -32768, -65536, -131072, -262144, -524288, -1048576, + -2097152, -4194304, -8388608, -16777216, -33554432, -67108864, + -134217728, -268435456, -536870912, -1073741824, -2147483648, 0, + -4, -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, + -16384, -32768, -65536, -131072, -262144, -524288, -1048576, -2097152, + -4194304, -8388608, -16777216, -33554432, -67108864, -134217728, + -268435456, -536870912, -1073741824, -2147483648, 0, 0, + -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, + -16384, -32768, -65536, -131072, -262144, -524288, -1048576, -2097152, + -4194304, -8388608, -16777216, -33554432, -67108864, -134217728, + -268435456, -536870912, -1073741824, -2147483648, 0, 0, 0, + -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, -16384, + -32768, -65536, -131072, -262144, -524288, -1048576, -2097152, + -4194304, -8388608, -16777216, -33554432, -67108864, -134217728, + -268435456, -536870912, -1073741824, -2147483648, 0, 0, 0, 0, + -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, -16384, -32768, + -65536, -131072, -262144, -524288, -1048576, -2097152, -4194304, + -8388608, -16777216, -33554432, -67108864, -134217728, -268435456, + -536870912, -1073741824, -2147483648, 0, 0, 0, 0, 0, + -64, -128, -256, -512, -1024, -2048, -4096, -8192, -16384, -32768, + -65536, -131072, -262144, -524288, -1048576, -2097152, -4194304, + -8388608, -16777216, -33554432, -67108864, -134217728, -268435456, + -536870912, -1073741824, -2147483648, 0, 0, 0, 0, 0, 0, + -128, -256, -512, -1024, -2048, -4096, -8192, -16384, -32768, -65536, + -131072, -262144, -524288, -1048576, -2097152, -4194304, -8388608, + -16777216, -33554432, -67108864, -134217728, -268435456, -536870912, + -1073741824, -2147483648, 0, 0, 0, 0, 0, 0, 0 + -1, -2, -4, -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, + -8192, -16384, -32768, -65536, -131072, -262144, -524288, -1048576, + -2097152, -4194304, -8388608, -16777216, -33554432, -67108864, + -134217728, -268435456, -536870912, -1073741824, -2147483648, + -4294967296, -8589934592, -17179869184, -34359738368, -68719476736, + -137438953472, -274877906944, -549755813888, -1099511627776, + -2199023255552, -4398046511104, -8796093022208, -17592186044416, + -35184372088832, -70368744177664, -140737488355328, -281474976710656, + -562949953421312, -1125899906842624, -2251799813685248, + -4503599627370496, -9007199254740992, -18014398509481984, + -36028797018963968, -72057594037927936, -144115188075855872, + -288230376151711744, -576460752303423488, -1152921504606846976, + -2305843009213693952, -4611686018427387904, -9223372036854775808, + -2, -4, -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, + -8192, -16384, -32768, -65536, -131072, -262144, -524288, -1048576, + -2097152, -4194304, -8388608, -16777216, -33554432, -67108864, + -134217728, -268435456, -536870912, -1073741824, -2147483648, + -4294967296, -8589934592, -17179869184, -34359738368, -68719476736, + -137438953472, -274877906944, -549755813888, -1099511627776, + -2199023255552, -4398046511104, -8796093022208, -17592186044416, + -35184372088832, -70368744177664, -140737488355328, -281474976710656, + -562949953421312, -1125899906842624, -2251799813685248, + -4503599627370496, -9007199254740992, -18014398509481984, + -36028797018963968, -72057594037927936, -144115188075855872, + -288230376151711744, -576460752303423488, -1152921504606846976, + -2305843009213693952, -4611686018427387904, -9223372036854775808, 0, + -4, -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, + -16384, -32768, -65536, -131072, -262144, -524288, -1048576, -2097152, + -4194304, -8388608, -16777216, -33554432, -67108864, -134217728, + -268435456, -536870912, -1073741824, -2147483648, -4294967296, + -8589934592, -17179869184, -34359738368, -68719476736, -137438953472, + -274877906944, -549755813888, -1099511627776, -2199023255552, + -4398046511104, -8796093022208, -17592186044416, -35184372088832, + -70368744177664, -140737488355328, -281474976710656, -562949953421312, + -1125899906842624, -2251799813685248, -4503599627370496, + -9007199254740992, -18014398509481984, -36028797018963968, + -72057594037927936, -144115188075855872, -288230376151711744, + -576460752303423488, -1152921504606846976, -2305843009213693952, + -4611686018427387904, -9223372036854775808, 0, 0, + -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, + -16384, -32768, -65536, -131072, -262144, -524288, -1048576, -2097152, + -4194304, -8388608, -16777216, -33554432, -67108864, -134217728, + -268435456, -536870912, -1073741824, -2147483648, -4294967296, + -8589934592, -17179869184, -34359738368, -68719476736, -137438953472, + -274877906944, -549755813888, -1099511627776, -2199023255552, + -4398046511104, -8796093022208, -17592186044416, -35184372088832, + -70368744177664, -140737488355328, -281474976710656, -562949953421312, + -1125899906842624, -2251799813685248, -4503599627370496, + -9007199254740992, -18014398509481984, -36028797018963968, + -72057594037927936, -144115188075855872, -288230376151711744, + -576460752303423488, -1152921504606846976, -2305843009213693952, + -4611686018427387904, -9223372036854775808, 0, 0, 0, + -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, -16384, + -32768, -65536, -131072, -262144, -524288, -1048576, -2097152, + -4194304, -8388608, -16777216, -33554432, -67108864, -134217728, + -268435456, -536870912, -1073741824, -2147483648, -4294967296, + -8589934592, -17179869184, -34359738368, -68719476736, -137438953472, + -274877906944, -549755813888, -1099511627776, -2199023255552, + -4398046511104, -8796093022208, -17592186044416, -35184372088832, + -70368744177664, -140737488355328, -281474976710656, -562949953421312, + -1125899906842624, -2251799813685248, -4503599627370496, + -9007199254740992, -18014398509481984, -36028797018963968, + -72057594037927936, -144115188075855872, -288230376151711744, + -576460752303423488, -1152921504606846976, -2305843009213693952, + -4611686018427387904, -9223372036854775808, 0, 0, 0, 0, + -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, -16384, -32768, + -65536, -131072, -262144, -524288, -1048576, -2097152, -4194304, + -8388608, -16777216, -33554432, -67108864, -134217728, -268435456, + -536870912, -1073741824, -2147483648, -4294967296, -8589934592, + -17179869184, -34359738368, -68719476736, -137438953472, -274877906944, + -549755813888, -1099511627776, -2199023255552, -4398046511104, + -8796093022208, -17592186044416, -35184372088832, -70368744177664, + -140737488355328, -281474976710656, -562949953421312, + -1125899906842624, -2251799813685248, -4503599627370496, + -9007199254740992, -18014398509481984, -36028797018963968, + -72057594037927936, -144115188075855872, -288230376151711744, + -576460752303423488, -1152921504606846976, -2305843009213693952, + -4611686018427387904, -9223372036854775808, 0, 0, 0, 0, 0, + -64, -128, -256, -512, -1024, -2048, -4096, -8192, -16384, -32768, + -65536, -131072, -262144, -524288, -1048576, -2097152, -4194304, + -8388608, -16777216, -33554432, -67108864, -134217728, -268435456, + -536870912, -1073741824, -2147483648, -4294967296, -8589934592, + -17179869184, -34359738368, -68719476736, -137438953472, -274877906944, + -549755813888, -1099511627776, -2199023255552, -4398046511104, + -8796093022208, -17592186044416, -35184372088832, -70368744177664, + -140737488355328, -281474976710656, -562949953421312, + -1125899906842624, -2251799813685248, -4503599627370496, + -9007199254740992, -18014398509481984, -36028797018963968, + -72057594037927936, -144115188075855872, -288230376151711744, + -576460752303423488, -1152921504606846976, -2305843009213693952, + -4611686018427387904, -9223372036854775808, 0, 0, 0, 0, 0, 0, + -128, -256, -512, -1024, -2048, -4096, -8192, -16384, -32768, -65536, + -131072, -262144, -524288, -1048576, -2097152, -4194304, -8388608, + -16777216, -33554432, -67108864, -134217728, -268435456, -536870912, + -1073741824, -2147483648, -4294967296, -8589934592, -17179869184, + -34359738368, -68719476736, -137438953472, -274877906944, + -549755813888, -1099511627776, -2199023255552, -4398046511104, + -8796093022208, -17592186044416, -35184372088832, -70368744177664, + -140737488355328, -281474976710656, -562949953421312, + -1125899906842624, -2251799813685248, -4503599627370496, + -9007199254740992, -18014398509481984, -36028797018963968, + -72057594037927936, -144115188075855872, -288230376151711744, + -576460752303423488, -1152921504606846976, -2305843009213693952, + -4611686018427387904, -9223372036854775808, 0, 0, 0, 0, 0, 0, 0 + 255, 254, 252, 248, 240, 224, 192, 128, + 254, 252, 248, 240, 224, 192, 128, 0, + 252, 248, 240, 224, 192, 128, 0, 0, + 248, 240, 224, 192, 128, 0, 0, 0, + 240, 224, 192, 128, 0, 0, 0, 0, + 224, 192, 128, 0, 0, 0, 0, 0, + 192, 128, 0, 0, 0, 0, 0, 0, + 128, 0, 0, 0, 0, 0, 0, 0 + 65535, 65534, 65532, 65528, 65520, 65504, 65472, 65408, 65280, 65024, + 64512, 63488, 61440, 57344, 49152, 32768, + 65534, 65532, 65528, 65520, 65504, 65472, 65408, 65280, 65024, 64512, + 63488, 61440, 57344, 49152, 32768, 0, + 65532, 65528, 65520, 65504, 65472, 65408, 65280, 65024, 64512, 63488, + 61440, 57344, 49152, 32768, 0, 0, + 65528, 65520, 65504, 65472, 65408, 65280, 65024, 64512, 63488, 61440, + 57344, 49152, 32768, 0, 0, 0, + 65520, 65504, 65472, 65408, 65280, 65024, 64512, 63488, 61440, 57344, + 49152, 32768, 0, 0, 0, 0, + 65504, 65472, 65408, 65280, 65024, 64512, 63488, 61440, 57344, 49152, + 32768, 0, 0, 0, 0, 0, + 65472, 65408, 65280, 65024, 64512, 63488, 61440, 57344, 49152, 32768, + 0, 0, 0, 0, 0, 0, + 65408, 65280, 65024, 64512, 63488, 61440, 57344, 49152, 32768, 0, 0, 0, + 0, 0, 0, 0 + 4294967295, 4294967294, 4294967292, 4294967288, 4294967280, 4294967264, + 4294967232, 4294967168, 4294967040, 4294966784, 4294966272, 4294965248, + 4294963200, 4294959104, 4294950912, 4294934528, 4294901760, 4294836224, + 4294705152, 4294443008, 4293918720, 4292870144, 4290772992, 4286578688, + 4278190080, 4261412864, 4227858432, 4160749568, 4026531840, 3758096384, + 3221225472, 2147483648, + 4294967294, 4294967292, 4294967288, 4294967280, 4294967264, 4294967232, + 4294967168, 4294967040, 4294966784, 4294966272, 4294965248, 4294963200, + 4294959104, 4294950912, 4294934528, 4294901760, 4294836224, 4294705152, + 4294443008, 4293918720, 4292870144, 4290772992, 4286578688, 4278190080, + 4261412864, 4227858432, 4160749568, 4026531840, 3758096384, 3221225472, + 2147483648, 0, + 4294967292, 4294967288, 4294967280, 4294967264, 4294967232, 4294967168, + 4294967040, 4294966784, 4294966272, 4294965248, 4294963200, 4294959104, + 4294950912, 4294934528, 4294901760, 4294836224, 4294705152, 4294443008, + 4293918720, 4292870144, 4290772992, 4286578688, 4278190080, 4261412864, + 4227858432, 4160749568, 4026531840, 3758096384, 3221225472, 2147483648, + 0, 0, + 4294967288, 4294967280, 4294967264, 4294967232, 4294967168, 4294967040, + 4294966784, 4294966272, 4294965248, 4294963200, 4294959104, 4294950912, + 4294934528, 4294901760, 4294836224, 4294705152, 4294443008, 4293918720, + 4292870144, 4290772992, 4286578688, 4278190080, 4261412864, 4227858432, + 4160749568, 4026531840, 3758096384, 3221225472, 2147483648, 0, 0, 0, + 4294967280, 4294967264, 4294967232, 4294967168, 4294967040, 4294966784, + 4294966272, 4294965248, 4294963200, 4294959104, 4294950912, 4294934528, + 4294901760, 4294836224, 4294705152, 4294443008, 4293918720, 4292870144, + 4290772992, 4286578688, 4278190080, 4261412864, 4227858432, 4160749568, + 4026531840, 3758096384, 3221225472, 2147483648, 0, 0, 0, 0, + 4294967264, 4294967232, 4294967168, 4294967040, 4294966784, 4294966272, + 4294965248, 4294963200, 4294959104, 4294950912, 4294934528, 4294901760, + 4294836224, 4294705152, 4294443008, 4293918720, 4292870144, 4290772992, + 4286578688, 4278190080, 4261412864, 4227858432, 4160749568, 4026531840, + 3758096384, 3221225472, 2147483648, 0, 0, 0, 0, 0, + 4294967232, 4294967168, 4294967040, 4294966784, 4294966272, 4294965248, + 4294963200, 4294959104, 4294950912, 4294934528, 4294901760, 4294836224, + 4294705152, 4294443008, 4293918720, 4292870144, 4290772992, 4286578688, + 4278190080, 4261412864, 4227858432, 4160749568, 4026531840, 3758096384, + 3221225472, 2147483648, 0, 0, 0, 0, 0, 0, + 4294967168, 4294967040, 4294966784, 4294966272, 4294965248, 4294963200, + 4294959104, 4294950912, 4294934528, 4294901760, 4294836224, 4294705152, + 4294443008, 4293918720, 4292870144, 4290772992, 4286578688, 4278190080, + 4261412864, 4227858432, 4160749568, 4026531840, 3758096384, 3221225472, + 2147483648, 0, 0, 0, 0, 0, 0, 0 + 18446744073709551615, 18446744073709551614, 18446744073709551612, + 18446744073709551608, 18446744073709551600, 18446744073709551584, + 18446744073709551552, 18446744073709551488, 18446744073709551360, + 18446744073709551104, 18446744073709550592, 18446744073709549568, + 18446744073709547520, 18446744073709543424, 18446744073709535232, + 18446744073709518848, 18446744073709486080, 18446744073709420544, + 18446744073709289472, 18446744073709027328, 18446744073708503040, + 18446744073707454464, 18446744073705357312, 18446744073701163008, + 18446744073692774400, 18446744073675997184, 18446744073642442752, + 18446744073575333888, 18446744073441116160, 18446744073172680704, + 18446744072635809792, 18446744071562067968, 18446744069414584320, + 18446744065119617024, 18446744056529682432, 18446744039349813248, + 18446744004990074880, 18446743936270598144, 18446743798831644672, + 18446743523953737728, 18446742974197923840, 18446741874686296064, + 18446739675663040512, 18446735277616529408, 18446726481523507200, + 18446708889337462784, 18446673704965373952, 18446603336221196288, + 18446462598732840960, 18446181123756130304, 18445618173802708992, + 18444492273895866368, 18442240474082181120, 18437736874454810624, + 18428729675200069632, 18410715276690587648, 18374686479671623680, + 18302628885633695744, 18158513697557839872, 17870283321406128128, + 17293822569102704640, 16140901064495857664, 13835058055282163712, + 9223372036854775808, + 18446744073709551614, 18446744073709551612, 18446744073709551608, + 18446744073709551600, 18446744073709551584, 18446744073709551552, + 18446744073709551488, 18446744073709551360, 18446744073709551104, + 18446744073709550592, 18446744073709549568, 18446744073709547520, + 18446744073709543424, 18446744073709535232, 18446744073709518848, + 18446744073709486080, 18446744073709420544, 18446744073709289472, + 18446744073709027328, 18446744073708503040, 18446744073707454464, + 18446744073705357312, 18446744073701163008, 18446744073692774400, + 18446744073675997184, 18446744073642442752, 18446744073575333888, + 18446744073441116160, 18446744073172680704, 18446744072635809792, + 18446744071562067968, 18446744069414584320, 18446744065119617024, + 18446744056529682432, 18446744039349813248, 18446744004990074880, + 18446743936270598144, 18446743798831644672, 18446743523953737728, + 18446742974197923840, 18446741874686296064, 18446739675663040512, + 18446735277616529408, 18446726481523507200, 18446708889337462784, + 18446673704965373952, 18446603336221196288, 18446462598732840960, + 18446181123756130304, 18445618173802708992, 18444492273895866368, + 18442240474082181120, 18437736874454810624, 18428729675200069632, + 18410715276690587648, 18374686479671623680, 18302628885633695744, + 18158513697557839872, 17870283321406128128, 17293822569102704640, + 16140901064495857664, 13835058055282163712, 9223372036854775808, 0, + 18446744073709551612, 18446744073709551608, 18446744073709551600, + 18446744073709551584, 18446744073709551552, 18446744073709551488, + 18446744073709551360, 18446744073709551104, 18446744073709550592, + 18446744073709549568, 18446744073709547520, 18446744073709543424, + 18446744073709535232, 18446744073709518848, 18446744073709486080, + 18446744073709420544, 18446744073709289472, 18446744073709027328, + 18446744073708503040, 18446744073707454464, 18446744073705357312, + 18446744073701163008, 18446744073692774400, 18446744073675997184, + 18446744073642442752, 18446744073575333888, 18446744073441116160, + 18446744073172680704, 18446744072635809792, 18446744071562067968, + 18446744069414584320, 18446744065119617024, 18446744056529682432, + 18446744039349813248, 18446744004990074880, 18446743936270598144, + 18446743798831644672, 18446743523953737728, 18446742974197923840, + 18446741874686296064, 18446739675663040512, 18446735277616529408, + 18446726481523507200, 18446708889337462784, 18446673704965373952, + 18446603336221196288, 18446462598732840960, 18446181123756130304, + 18445618173802708992, 18444492273895866368, 18442240474082181120, + 18437736874454810624, 18428729675200069632, 18410715276690587648, + 18374686479671623680, 18302628885633695744, 18158513697557839872, + 17870283321406128128, 17293822569102704640, 16140901064495857664, + 13835058055282163712, 9223372036854775808, 0, 0, + 18446744073709551608, 18446744073709551600, 18446744073709551584, + 18446744073709551552, 18446744073709551488, 18446744073709551360, + 18446744073709551104, 18446744073709550592, 18446744073709549568, + 18446744073709547520, 18446744073709543424, 18446744073709535232, + 18446744073709518848, 18446744073709486080, 18446744073709420544, + 18446744073709289472, 18446744073709027328, 18446744073708503040, + 18446744073707454464, 18446744073705357312, 18446744073701163008, + 18446744073692774400, 18446744073675997184, 18446744073642442752, + 18446744073575333888, 18446744073441116160, 18446744073172680704, + 18446744072635809792, 18446744071562067968, 18446744069414584320, + 18446744065119617024, 18446744056529682432, 18446744039349813248, + 18446744004990074880, 18446743936270598144, 18446743798831644672, + 18446743523953737728, 18446742974197923840, 18446741874686296064, + 18446739675663040512, 18446735277616529408, 18446726481523507200, + 18446708889337462784, 18446673704965373952, 18446603336221196288, + 18446462598732840960, 18446181123756130304, 18445618173802708992, + 18444492273895866368, 18442240474082181120, 18437736874454810624, + 18428729675200069632, 18410715276690587648, 18374686479671623680, + 18302628885633695744, 18158513697557839872, 17870283321406128128, + 17293822569102704640, 16140901064495857664, 13835058055282163712, + 9223372036854775808, 0, 0, 0, + 18446744073709551600, 18446744073709551584, 18446744073709551552, + 18446744073709551488, 18446744073709551360, 18446744073709551104, + 18446744073709550592, 18446744073709549568, 18446744073709547520, + 18446744073709543424, 18446744073709535232, 18446744073709518848, + 18446744073709486080, 18446744073709420544, 18446744073709289472, + 18446744073709027328, 18446744073708503040, 18446744073707454464, + 18446744073705357312, 18446744073701163008, 18446744073692774400, + 18446744073675997184, 18446744073642442752, 18446744073575333888, + 18446744073441116160, 18446744073172680704, 18446744072635809792, + 18446744071562067968, 18446744069414584320, 18446744065119617024, + 18446744056529682432, 18446744039349813248, 18446744004990074880, + 18446743936270598144, 18446743798831644672, 18446743523953737728, + 18446742974197923840, 18446741874686296064, 18446739675663040512, + 18446735277616529408, 18446726481523507200, 18446708889337462784, + 18446673704965373952, 18446603336221196288, 18446462598732840960, + 18446181123756130304, 18445618173802708992, 18444492273895866368, + 18442240474082181120, 18437736874454810624, 18428729675200069632, + 18410715276690587648, 18374686479671623680, 18302628885633695744, + 18158513697557839872, 17870283321406128128, 17293822569102704640, + 16140901064495857664, 13835058055282163712, 9223372036854775808, 0, 0, + 0, 0, + 18446744073709551584, 18446744073709551552, 18446744073709551488, + 18446744073709551360, 18446744073709551104, 18446744073709550592, + 18446744073709549568, 18446744073709547520, 18446744073709543424, + 18446744073709535232, 18446744073709518848, 18446744073709486080, + 18446744073709420544, 18446744073709289472, 18446744073709027328, + 18446744073708503040, 18446744073707454464, 18446744073705357312, + 18446744073701163008, 18446744073692774400, 18446744073675997184, + 18446744073642442752, 18446744073575333888, 18446744073441116160, + 18446744073172680704, 18446744072635809792, 18446744071562067968, + 18446744069414584320, 18446744065119617024, 18446744056529682432, + 18446744039349813248, 18446744004990074880, 18446743936270598144, + 18446743798831644672, 18446743523953737728, 18446742974197923840, + 18446741874686296064, 18446739675663040512, 18446735277616529408, + 18446726481523507200, 18446708889337462784, 18446673704965373952, + 18446603336221196288, 18446462598732840960, 18446181123756130304, + 18445618173802708992, 18444492273895866368, 18442240474082181120, + 18437736874454810624, 18428729675200069632, 18410715276690587648, + 18374686479671623680, 18302628885633695744, 18158513697557839872, + 17870283321406128128, 17293822569102704640, 16140901064495857664, + 13835058055282163712, 9223372036854775808, 0, 0, 0, 0, 0, + 18446744073709551552, 18446744073709551488, 18446744073709551360, + 18446744073709551104, 18446744073709550592, 18446744073709549568, + 18446744073709547520, 18446744073709543424, 18446744073709535232, + 18446744073709518848, 18446744073709486080, 18446744073709420544, + 18446744073709289472, 18446744073709027328, 18446744073708503040, + 18446744073707454464, 18446744073705357312, 18446744073701163008, + 18446744073692774400, 18446744073675997184, 18446744073642442752, + 18446744073575333888, 18446744073441116160, 18446744073172680704, + 18446744072635809792, 18446744071562067968, 18446744069414584320, + 18446744065119617024, 18446744056529682432, 18446744039349813248, + 18446744004990074880, 18446743936270598144, 18446743798831644672, + 18446743523953737728, 18446742974197923840, 18446741874686296064, + 18446739675663040512, 18446735277616529408, 18446726481523507200, + 18446708889337462784, 18446673704965373952, 18446603336221196288, + 18446462598732840960, 18446181123756130304, 18445618173802708992, + 18444492273895866368, 18442240474082181120, 18437736874454810624, + 18428729675200069632, 18410715276690587648, 18374686479671623680, + 18302628885633695744, 18158513697557839872, 17870283321406128128, + 17293822569102704640, 16140901064495857664, 13835058055282163712, + 9223372036854775808, 0, 0, 0, 0, 0, 0, + 18446744073709551488, 18446744073709551360, 18446744073709551104, + 18446744073709550592, 18446744073709549568, 18446744073709547520, + 18446744073709543424, 18446744073709535232, 18446744073709518848, + 18446744073709486080, 18446744073709420544, 18446744073709289472, + 18446744073709027328, 18446744073708503040, 18446744073707454464, + 18446744073705357312, 18446744073701163008, 18446744073692774400, + 18446744073675997184, 18446744073642442752, 18446744073575333888, + 18446744073441116160, 18446744073172680704, 18446744072635809792, + 18446744071562067968, 18446744069414584320, 18446744065119617024, + 18446744056529682432, 18446744039349813248, 18446744004990074880, + 18446743936270598144, 18446743798831644672, 18446743523953737728, + 18446742974197923840, 18446741874686296064, 18446739675663040512, + 18446735277616529408, 18446726481523507200, 18446708889337462784, + 18446673704965373952, 18446603336221196288, 18446462598732840960, + 18446181123756130304, 18445618173802708992, 18444492273895866368, + 18442240474082181120, 18437736874454810624, 18428729675200069632, + 18410715276690587648, 18374686479671623680, 18302628885633695744, + 18158513697557839872, 17870283321406128128, 17293822569102704640, + 16140901064495857664, 13835058055282163712, 9223372036854775808, 0, 0, + 0, 0, 0, 0, 0 + 0, 0.0001, 0.0002, 0.0003, 0.0004, 0.0005, 0.0006, 0.0007, + 1, 1.0001, 1.0002, 1.0003, 1.0004, 1.0005, 1.0006, 1.0007, + 2, 2.0001, 2.0002, 2.0003, 2.0004, 2.0005, 2.0006, 2.0007, + 3, 3.0001, 3.0002, 3.0003, 3.0004, 3.0005, 3.0006, 3.0007, + 4, 4.0001, 4.0002, 4.0003, 4.0004, 4.0005, 4.0006, 4.0007, + 5, 5.0001, 5.0002, 5.0003, 5.0004, 5.0005, 5.0006, 5.0007, + 6, 6.0001, 6.0002, 6.0003, 6.0004, 6.0005, 6.0006, 6.0007, + 7, 7.0001, 7.0002, 7.0003, 7.0004, 7.0005, 7.0006, 7.0007 \ No newline at end of file diff --git a/vms/src/h5pubconf.h b/vms/src/h5pubconf.h index d7c2119..e432421 100644 --- a/vms/src/h5pubconf.h +++ b/vms/src/h5pubconf.h @@ -502,7 +502,7 @@ #define H5_PACKAGE_NAME "HDF5" /* Define to the full name and version of this package. */ -#define H5_PACKAGE_STRING "HDF5 1.9.137-FA_a5" +#define H5_PACKAGE_STRING "HDF5 1.9.148-FA_a5" /* Define to the one symbol short name of this package. */ #define H5_PACKAGE_TARNAME "hdf5" @@ -511,7 +511,7 @@ #define H5_PACKAGE_URL "" /* Define to the version of this package. */ -#define H5_PACKAGE_VERSION "1.9.137-FA_a5" +#define H5_PACKAGE_VERSION "1.9.148-FA_a5" /* Width for printf() for type `long long' or `__int64', use `ll' */ #define H5_PRINTF_LL_WIDTH "ll" @@ -674,7 +674,7 @@ /* #undef H5_USING_MEMCHECKER */ /* Version number of package */ -#define H5_VERSION "1.9.137-FA_a5" +#define H5_VERSION "1.9.148-FA_a5" /* Define if vsnprintf() returns the correct value for formatted strings that don't fit into size allowed */ -- cgit v0.12