summaryrefslogtreecommitdiffstats
path: root/tools/test/h5repack
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2022-04-13 21:17:29 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2022-04-13 21:17:29 (GMT)
commitcabc39c3e197e2591449d2604bfee26465fb60e1 (patch)
treed5f39f5f5965584bf9bf49646a2af617adfd3e4e /tools/test/h5repack
parent7355f4c505092a7a85474b47f18d5206028e2c95 (diff)
parentab69f5df770ee3cc6cd6c81d905a5317b894a002 (diff)
downloadhdf5-feature/coding_standards.zip
hdf5-feature/coding_standards.tar.gz
hdf5-feature/coding_standards.tar.bz2
Merge branch 'develop' into feature/coding_standardsfeature/coding_standards
Diffstat (limited to 'tools/test/h5repack')
-rw-r--r--tools/test/h5repack/CMakeLists.txt49
-rw-r--r--tools/test/h5repack/CMakeTests.cmake390
-rw-r--r--tools/test/h5repack/CMakeVFDTests.cmake18
-rw-r--r--tools/test/h5repack/Makefile.am9
-rw-r--r--tools/test/h5repack/dynlib_rpk.c64
-rw-r--r--tools/test/h5repack/dynlib_vrpk.c79
-rw-r--r--tools/test/h5repack/h5repack.sh.in432
-rw-r--r--tools/test/h5repack/h5repack_plugin.sh.in2
-rw-r--r--tools/test/h5repack/h5repackgentest.c350
-rw-r--r--tools/test/h5repack/h5repacktst.c5199
-rw-r--r--tools/test/h5repack/testfiles/README2
-rw-r--r--tools/test/h5repack/testfiles/attrregion.tattrreg.h5.ddl46
-rw-r--r--tools/test/h5repack/testfiles/dataregion.tdatareg.h5.ddl42
-rw-r--r--tools/test/h5repack/testfiles/h5copy_extlinks_src-base.h5copy_extlinks_src.h5.ddl28
-rw-r--r--tools/test/h5repack/testfiles/h5copy_extlinks_src-merge.h5copy_extlinks_src.h5.tst26
-rw-r--r--tools/test/h5repack/testfiles/h5copy_extlinks_src-mergeprune.h5copy_extlinks_src.h5.ddl28
-rw-r--r--tools/test/h5repack/testfiles/h5copy_extlinks_src-prune.h5copy_extlinks_src.h5.ddl6
-rw-r--r--tools/test/h5repack/testfiles/h5copy_extlinks_src.h5bin0 -> 2184 bytes
-rw-r--r--tools/test/h5repack/testfiles/h5copy_extlinks_trg.h5bin0 -> 2168 bytes
-rw-r--r--tools/test/h5repack/testfiles/h5repack-help.txt112
-rw-r--r--tools/test/h5repack/testfiles/h5repack_CVE-2018-14460.h5bin0 -> 2560 bytes
-rw-r--r--tools/test/h5repack/testfiles/h5repack_CVE-2018-17432.h5bin0 -> 7648 bytes
-rw-r--r--tools/test/h5repack/testfiles/h5repack_f32le.h5bin0 -> 2336 bytes
-rw-r--r--tools/test/h5repack/testfiles/h5repack_f32le_ex-0.datbin0 -> 288 bytes
-rw-r--r--tools/test/h5repack/testfiles/h5repack_f32le_ex.h5bin0 -> 1464 bytes
-rw-r--r--tools/test/h5repack/testfiles/h5repack_int32le_1d.h5bin0 -> 2096 bytes
-rw-r--r--tools/test/h5repack/testfiles/h5repack_int32le_1d_ex-0.dat1
-rw-r--r--tools/test/h5repack/testfiles/h5repack_int32le_1d_ex-1.datbin0 -> 24 bytes
-rw-r--r--tools/test/h5repack/testfiles/h5repack_int32le_1d_ex.h5bin0 -> 1504 bytes
-rw-r--r--tools/test/h5repack/testfiles/h5repack_int32le_2d.h5bin0 -> 2304 bytes
-rw-r--r--tools/test/h5repack/testfiles/h5repack_int32le_2d_ex-0.datbin0 -> 256 bytes
-rw-r--r--tools/test/h5repack/testfiles/h5repack_int32le_2d_ex.h5bin0 -> 1472 bytes
-rw-r--r--tools/test/h5repack/testfiles/h5repack_int32le_3d.h5bin0 -> 4096 bytes
-rw-r--r--tools/test/h5repack/testfiles/h5repack_int32le_3d_ex-0.datbin0 -> 2048 bytes
-rw-r--r--tools/test/h5repack/testfiles/h5repack_int32le_3d_ex.h5bin0 -> 1472 bytes
-rw-r--r--tools/test/h5repack/testfiles/h5repack_layout.h5-dset2_chunk_20x10-errstk.tst35
-rw-r--r--tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl14
-rw-r--r--tools/test/h5repack/testfiles/h5repack_uint8be.h5bin0 -> 2304 bytes
-rw-r--r--tools/test/h5repack/testfiles/h5repack_uint8be_ex-0.datbin0 -> 64 bytes
-rw-r--r--tools/test/h5repack/testfiles/h5repack_uint8be_ex-1.dat1
-rw-r--r--tools/test/h5repack/testfiles/h5repack_uint8be_ex-2.dat1
-rw-r--r--tools/test/h5repack/testfiles/h5repack_uint8be_ex-3.dat1
-rw-r--r--tools/test/h5repack/testfiles/h5repack_uint8be_ex.h5bin0 -> 1608 bytes
-rw-r--r--tools/test/h5repack/testfiles/textlink-base.textlink.h5.ddl12
-rw-r--r--tools/test/h5repack/testfiles/textlink-merge.textlink.h5.tst13
-rw-r--r--tools/test/h5repack/testfiles/textlink-mergeprune.textlink.h5.ddl4
-rw-r--r--tools/test/h5repack/testfiles/textlink-prune.textlink.h5.ddl4
-rw-r--r--tools/test/h5repack/testfiles/textlinkfar-base.textlinkfar.h5.ddl116
-rw-r--r--tools/test/h5repack/testfiles/textlinkfar-merge.textlinkfar.h5.tst20
-rw-r--r--tools/test/h5repack/testfiles/textlinkfar-mergeprune.textlinkfar.h5.ddl152
-rw-r--r--tools/test/h5repack/testfiles/textlinkfar-prune.textlinkfar.h5.ddl4
-rw-r--r--tools/test/h5repack/testfiles/textlinksrc-base.textlinksrc.h5.ddl150
-rw-r--r--tools/test/h5repack/testfiles/textlinksrc-merge.textlinksrc.h5.tst32
-rw-r--r--tools/test/h5repack/testfiles/textlinksrc-mergeprune.textlinksrc.h5.ddl187
-rw-r--r--tools/test/h5repack/testfiles/textlinksrc-prune.textlinksrc.h5.ddl4
-rw-r--r--tools/test/h5repack/testfiles/textlinktar-base.textlinktar.h5.ddl168
-rw-r--r--tools/test/h5repack/testfiles/textlinktar-merge.textlinktar.h5.tst44
-rw-r--r--tools/test/h5repack/testfiles/textlinktar-mergeprune.textlinktar.h5.ddl200
-rw-r--r--tools/test/h5repack/testfiles/textlinktar-prune.textlinktar.h5.ddl52
-rw-r--r--tools/test/h5repack/testfiles/tsoftlinks-base.tsoftlinks.h5.ddl77
-rw-r--r--tools/test/h5repack/testfiles/tsoftlinks-merge.tsoftlinks.h5.tst53
-rw-r--r--tools/test/h5repack/testfiles/tsoftlinks-mergeprune.tsoftlinks.h5.ddl127
-rw-r--r--tools/test/h5repack/testfiles/tsoftlinks-prune.tsoftlinks.h5.ddl47
-rw-r--r--tools/test/h5repack/testh5repack_detect_szip.c11
64 files changed, 5541 insertions, 2871 deletions
diff --git a/tools/test/h5repack/CMakeLists.txt b/tools/test/h5repack/CMakeLists.txt
index 92b61fc..0b90750 100644
--- a/tools/test/h5repack/CMakeLists.txt
+++ b/tools/test/h5repack/CMakeLists.txt
@@ -1,12 +1,12 @@
-cmake_minimum_required (VERSION 3.10)
+cmake_minimum_required (VERSION 3.12)
project (HDF5_TOOLS_TEST_H5REPACK C)
# --------------------------------------------------------------------
-# Add h5Repack test executables
+# Add h5repack test executables
# --------------------------------------------------------------------
add_executable (testh5repack_detect_szip ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testh5repack_detect_szip.c)
target_include_directories (testh5repack_detect_szip
- PRIVATE "${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR};${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
+ PRIVATE "${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR};${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
)
if (NOT ONLY_SHARED_LIBS)
TARGET_C_PROPERTIES (testh5repack_detect_szip STATIC)
@@ -17,6 +17,7 @@ else ()
endif ()
set_target_properties (testh5repack_detect_szip PROPERTIES FOLDER tools)
+# These are the same files used by the h5repack tool
set (REPACK_COMMON_SOURCES
${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack_copy.c
${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack_filters.c
@@ -28,7 +29,7 @@ set (REPACK_COMMON_SOURCES
)
add_executable (h5repacktest ${REPACK_COMMON_SOURCES} ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/h5repacktst.c)
target_include_directories (h5repacktest
- PRIVATE "${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR};${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
+ PRIVATE "${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR};${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_TEST_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
)
if (NOT ONLY_SHARED_LIBS)
TARGET_C_PROPERTIES (h5repacktest STATIC)
@@ -51,17 +52,25 @@ if (BUILD_SHARED_LIBS)
set (H5REPACK_TOOL_PLUGIN_LIB_VTARGET ${H5REPACK_TOOL_PLUGIN_LIB_VCORENAME})
add_library (${H5REPACK_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_rpk.c)
- target_include_directories (${H5REPACK_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (${H5REPACK_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
TARGET_C_PROPERTIES (${H5REPACK_TOOL_PLUGIN_LIB_TARGET} SHARED)
- target_link_libraries (${H5REPACK_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIBSH_TARGET})
+ target_link_libraries (${H5REPACK_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_LIBSH_TARGET})
H5_SET_LIB_OPTIONS (${H5REPACK_TOOL_PLUGIN_LIB_TARGET} ${H5REPACK_TOOL_PLUGIN_LIB_NAME} SHARED "LIB")
add_library (${H5REPACK_TOOL_PLUGIN_LIB_VTARGET} SHARED dynlib_vrpk.c)
- target_include_directories (${H5REPACK_TOOL_PLUGIN_LIB_VTARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (${H5REPACK_TOOL_PLUGIN_LIB_VTARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
TARGET_C_PROPERTIES (${H5REPACK_TOOL_PLUGIN_LIB_VTARGET} SHARED)
- target_link_libraries (${H5REPACK_TOOL_PLUGIN_LIB_VTARGET} PRIVATE ${HDF5_TEST_LIBSH_TARGET})
+ target_link_libraries (${H5REPACK_TOOL_PLUGIN_LIB_VTARGET} PRIVATE ${HDF5_LIBSH_TARGET})
H5_SET_LIB_OPTIONS (${H5REPACK_TOOL_PLUGIN_LIB_VTARGET} ${H5REPACK_TOOL_PLUGIN_LIB_VNAME} SHARED "LIB")
+ #-----------------------------------------------------------------------------
+ # Add Target to clang-format
+ #-----------------------------------------------------------------------------
+ if (HDF5_ENABLE_FORMATTERS)
+ clang_format (HDF5_TOOLS_TEST_H5REPACK_PLUGIN_FORMAT ${H5REPACK_TOOL_PLUGIN_LIB_TARGET})
+ clang_format (HDF5_TOOLS_TEST_H5REPACK_VPLUGIN_FORMAT ${H5REPACK_TOOL_PLUGIN_LIB_VTARGET})
+ endif ()
+
# make plugins dir
file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/plugins")
#-----------------------------------------------------------------------------
@@ -85,4 +94,26 @@ if (BUILD_SHARED_LIBS)
)
endif ()
-include (CMakeTests.cmake)
+# --------------------------------------------------------------------
+# Add the h5repack test executable
+# --------------------------------------------------------------------
+if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS)
+ add_executable (h5repackgentest ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/h5repackgentest.c)
+ target_include_directories (h5repackgentest PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ TARGET_C_PROPERTIES (h5repackgentest STATIC)
+ target_link_libraries (h5repackgentest PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+ set_target_properties (h5repackgentest PROPERTIES FOLDER generator/tools)
+
+ #-----------------------------------------------------------------------------
+ # Add Target to clang-format
+ #-----------------------------------------------------------------------------
+ if (HDF5_ENABLE_FORMATTERS)
+ clang_format (HDF5_TOOLS_TEST_H5REPACK_FORMAT h5repackgentest)
+ endif ()
+
+ #add_test (NAME h5repackgentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5repackgentest>)
+endif ()
+
+if (HDF5_TEST_TOOLS AND HDF5_TEST_SERIAL)
+ include (CMakeTests.cmake)
+endif ()
diff --git a/tools/test/h5repack/CMakeTests.cmake b/tools/test/h5repack/CMakeTests.cmake
index a28a282..09648ff 100644
--- a/tools/test/h5repack/CMakeTests.cmake
+++ b/tools/test/h5repack/CMakeTests.cmake
@@ -5,7 +5,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
@@ -26,10 +26,23 @@
${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_deflate.h5
${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_early.h5
${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_ext.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_f32le.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_f32le_ex-0.dat
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_f32le_ex.h5
${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_fill.h5
${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_filters.h5
${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_fletcher.h5
${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_hlink.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_int32le_1d.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_int32le_1d_ex-0.dat
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_int32le_1d_ex-1.dat
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_int32le_1d_ex.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_int32le_2d.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_int32le_2d_ex-0.dat
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_int32le_2d_ex.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_int32le_3d.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_int32le_3d_ex-0.dat
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_int32le_3d_ex.h5
${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_layout.h5
${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_layouto.h5
${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_layout2.h5
@@ -38,12 +51,20 @@
${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_named_dtypes.h5
${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_nested_8bit_enum.h5
${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_nested_8bit_enum_deflated.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_CVE-2018-17432.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_CVE-2018-14460.h5
${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_nbit.h5
${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_objs.h5
${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_refs.h5
${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_shuffle.h5
${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_soffset.h5
${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_szip.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_uint8be.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_uint8be_ex-0.dat
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_uint8be_ex-1.dat
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_uint8be_ex-2.dat
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_uint8be_ex-3.dat
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_uint8be_ex.h5
# fsm
${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_aggr.h5
${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_fsm_aggr_nopersist.h5
@@ -53,6 +74,14 @@
${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_paged_persist.h5
# h5diff/testfile
${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_attr1.h5
+ # tools/testfiles for external links
+ ${HDF5_TOOLS_DIR}/testfiles/tsoftlinks.h5
+ ${HDF5_TOOLS_DIR}/testfiles/textlinkfar.h5
+ ${HDF5_TOOLS_DIR}/testfiles/textlinksrc.h5
+ ${HDF5_TOOLS_DIR}/testfiles/textlinktar.h5
+ ${HDF5_TOOLS_DIR}/testfiles/textlink.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5copy_extlinks_src.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5copy_extlinks_trg.h5
# tools/testfiles
${HDF5_TOOLS_DIR}/testfiles/tfamily00000.h5
${HDF5_TOOLS_DIR}/testfiles/tfamily00001.h5
@@ -66,6 +95,9 @@
${HDF5_TOOLS_DIR}/testfiles/tfamily00009.h5
${HDF5_TOOLS_DIR}/testfiles/tfamily00010.h5
${HDF5_TOOLS_DIR}/testfiles/tordergr.h5
+ # reference conversion files
+ ${HDF5_TOOLS_DIR}/testfiles/tattrreg.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tdatareg.h5
# tools/testfiles/vds
${HDF5_TOOLS_DIR}/testfiles/vds/1_a.h5
${HDF5_TOOLS_DIR}/testfiles/vds/1_b.h5
@@ -106,6 +138,13 @@
${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/plugin_version_test.h5repack_layout.h5
${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/plugin_zero.h5repack_layout.h5
${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/plugin_none.h5repack_layout.UD.h5
+ # tools/testfiles for external links
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/tsoftlinks-merge.tsoftlinks.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/textlinkfar-merge.textlinkfar.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/textlinksrc-merge.textlinksrc.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/textlinktar-merge.textlinktar.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/textlink-merge.textlink.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5copy_extlinks_src-merge.h5copy_extlinks_src.h5
)
set (LIST_DDL_TEST_FILES
@@ -129,6 +168,28 @@
${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/3_1_vds.h5-vds_chunk2x5x8-v
${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/4_vds.h5-vds_compa-v
${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/4_vds.h5-vds_conti-v
+ # refs
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/attrregion.tattrreg.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/dataregion.tdatareg.h5
+ # tools/testfiles for external links
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/textlinkfar-base.textlinkfar.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/textlinksrc-base.textlinksrc.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/textlinktar-base.textlinktar.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/textlink-base.textlink.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/tsoftlinks-base.tsoftlinks.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5copy_extlinks_src-base.h5copy_extlinks_src.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/textlinkfar-prune.textlinkfar.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/textlinksrc-prune.textlinksrc.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/textlinktar-prune.textlinktar.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/textlink-prune.textlink.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/tsoftlinks-prune.tsoftlinks.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5copy_extlinks_src-prune.h5copy_extlinks_src.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/textlinkfar-mergeprune.textlinkfar.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/textlinksrc-mergeprune.textlinksrc.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/textlinktar-mergeprune.textlinktar.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/textlink-mergeprune.textlink.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/tsoftlinks-mergeprune.tsoftlinks.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5copy_extlinks_src-mergeprune.h5copy_extlinks_src.h5
)
foreach (h5_file ${LIST_HDF5_TEST_FILES})
@@ -157,16 +218,10 @@
##############################################################################
##############################################################################
- if (NOT BUILD_SHARED_LIBS)
- set (tgt_ext "")
- else ()
- set (tgt_ext "-shared")
- endif ()
-
macro (ADD_HELP_TEST testname resultcode)
# If using memchecker add tests without using scripts
if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME H5REPACK-h5repack-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5repack${tgt_ext}> ${ARGN})
+ add_test (NAME H5REPACK-h5repack-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5repack${tgt_file_ext}> ${ARGN})
set_tests_properties (H5REPACK-h5repack-${testname} PROPERTIES
WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles"
)
@@ -175,7 +230,7 @@
NAME H5REPACK-h5repack-${testname}
COMMAND "${CMAKE_COMMAND}"
-D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5repack${tgt_ext}>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5repack${tgt_file_ext}>"
-D "TEST_ARGS:STRING=${ARGN}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
-D "TEST_OUTPUT=h5repack-${testname}.out"
@@ -207,14 +262,14 @@
)
add_test (
NAME H5REPACK_OLD-${testname}
- COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5repack${tgt_ext}> ${ARGN} -i ${PROJECT_BINARY_DIR}/testfiles/${testfile} -o ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}
+ COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5repack${tgt_file_ext}> ${ARGN} -i ${PROJECT_BINARY_DIR}/testfiles/${testfile} -o ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}
)
set_tests_properties (H5REPACK_OLD-${testname} PROPERTIES
DEPENDS H5REPACK_OLD-${testname}-clear-objects
)
add_test (
NAME H5REPACK_OLD-${testname}_DFF
- COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5diff${tgt_ext}> ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}
+ COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5diff${tgt_file_ext}> ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}
)
set_tests_properties (H5REPACK_OLD-${testname}_DFF PROPERTIES
DEPENDS H5REPACK_OLD-${testname}
@@ -242,14 +297,14 @@
)
add_test (
NAME H5REPACK-${testname}
- COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5repack${tgt_ext}> --enable-error-stack ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}
+ COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5repack${tgt_file_ext}> --enable-error-stack ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}
)
set_tests_properties (H5REPACK-${testname} PROPERTIES
DEPENDS H5REPACK-${testname}-clear-objects
)
add_test (
NAME H5REPACK-${testname}_DFF
- COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5diff${tgt_ext}> --enable-error-stack ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}
+ COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5diff${tgt_file_ext}> --enable-error-stack ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}
)
set_tests_properties (H5REPACK-${testname}_DFF PROPERTIES
DEPENDS H5REPACK-${testname}
@@ -257,7 +312,7 @@
endif ()
endmacro ()
- macro (ADD_H5_CMP_TEST testname testfilter testtype resultcode resultfile)
+ macro (ADD_H5_FILTER_TEST testname testfilter testtype resultcode resultfile)
if ("${testtype}" STREQUAL "SKIP")
if (NOT HDF5_ENABLE_USING_MEMCHECKER)
add_test (
@@ -271,7 +326,7 @@
if (HDF5_ENABLE_USING_MEMCHECKER)
add_test (
NAME H5REPACK_CMP-${testname}
- COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5repack${tgt_ext}> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile}
+ COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5repack${tgt_file_ext}> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile}
)
else ()
add_test (
@@ -285,7 +340,7 @@
NAME H5REPACK_CMP-${testname}
COMMAND "${CMAKE_COMMAND}"
-D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5repack${tgt_ext}>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5repack${tgt_file_ext}>"
-D "TEST_ARGS:STRING=${ARGN};${resultfile};out-${testname}.${resultfile}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
-D "TEST_OUTPUT=${resultfile}-${testname}.out"
@@ -315,7 +370,7 @@
if (HDF5_ENABLE_USING_MEMCHECKER)
add_test (
NAME H5REPACK_MASK-${testname}
- COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5repack${tgt_ext}> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile}
+ COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5repack${tgt_file_ext}> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile}
)
set_tests_properties (H5REPACK_MASK-${testname} PROPERTIES
FIXTURES_REQUIRED clear_h5repack
@@ -332,7 +387,7 @@
NAME H5REPACK_MASK-${testname}
COMMAND "${CMAKE_COMMAND}"
-D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5repack${tgt_ext}>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5repack${tgt_file_ext}>"
-D "TEST_ARGS:STRING=${ARGN};${resultfile};out-${testname}.${resultfile}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
-D "TEST_OUTPUT=${resultfile}-${testname}.out"
@@ -366,7 +421,7 @@
)
add_test (
NAME H5REPACK_DMP-${testname}
- COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5repack${tgt_ext}> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile}
+ COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5repack${tgt_file_ext}> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile}
)
set_tests_properties (H5REPACK_DMP-${testname} PROPERTIES
DEPENDS H5REPACK_DMP-${testname}-clear-objects
@@ -376,7 +431,7 @@
NAME H5REPACK_DMP-h5dump-${testname}
COMMAND "${CMAKE_COMMAND}"
-D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5dump${tgt_ext}>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump${tgt_file_ext}>"
-D "TEST_ARGS:STRING=-q;creation_order;-pH;out-${testname}.${resultfile}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
-D "TEST_OUTPUT=${resultfile}-${testname}.out"
@@ -391,6 +446,48 @@
endif ()
endmacro ()
+ macro (ADD_H5_DIFF_TEST testname testtype resultcode testfile)
+ if ("${testtype}" STREQUAL "SKIP")
+ if (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (
+ NAME H5REPACK_DIFF-${testname}
+ COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}"
+ )
+ set_property(TEST H5REPACK_DIFF-${testname} PROPERTY DISABLED)
+ endif ()
+ else ()
+ add_test (
+ NAME H5REPACK_DIFF-${testname}-clear-objects
+ COMMAND ${CMAKE_COMMAND} -E remove testfiles/out-${testname}.${testfile}
+ )
+ set_tests_properties (H5REPACK_DIFF-${testname}-clear-objects PROPERTIES
+ FIXTURES_REQUIRED clear_h5repack
+ )
+ add_test (
+ NAME H5REPACK_DIFF-${testname}
+ COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5repack${tgt_file_ext}> --enable-error-stack ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}
+ )
+ set_tests_properties (H5REPACK_DIFF-${testname} PROPERTIES
+ DEPENDS H5REPACK_DIFF-${testname}-clear-objects
+ )
+ add_test (
+ NAME H5REPACK_DIFF-${testname}_DFF
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5diff${tgt_file_ext}>"
+ -D "TEST_ARGS:STRING=-v;--enable-error-stack;${testfile};out-${testname}.${testfile}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
+ -D "TEST_OUTPUT=out-${testname}.${testfile}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=${testname}.${testfile}.tst"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ set_tests_properties (H5REPACK_DIFF-${testname}_DFF PROPERTIES
+ DEPENDS H5REPACK_DIFF-${testname}
+ )
+ endif ()
+ endmacro ()
+
macro (ADD_H5_STAT_TEST testname testtype resultcode statarg resultfile)
if ("${testtype}" STREQUAL "SKIP")
if (NOT HDF5_ENABLE_USING_MEMCHECKER)
@@ -410,7 +507,7 @@
)
add_test (
NAME H5REPACK_STAT-${testname}
- COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5repack${tgt_ext}> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${statarg}.${resultfile}
+ COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5repack${tgt_file_ext}> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${statarg}.${resultfile}
)
set_tests_properties (H5REPACK_STAT-${testname} PROPERTIES
DEPENDS H5REPACK_STAT-${testname}-clear-objects
@@ -420,7 +517,7 @@
NAME H5REPACK_STAT-h5stat-${testname}
COMMAND "${CMAKE_COMMAND}"
-D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5stat${tgt_ext}>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5stat${tgt_file_ext}>"
-D "TEST_ARGS:STRING=-S;-s;out-${statarg}.${resultfile}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
-D "TEST_OUTPUT=${resultfile}-${testname}.out"
@@ -455,14 +552,14 @@
)
add_test (
NAME H5REPACK_VERIFY_LAYOUT-${testname}
- COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5repack${tgt_ext}> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}
+ COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5repack${tgt_file_ext}> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}
)
set_tests_properties (H5REPACK_VERIFY_LAYOUT-${testname} PROPERTIES
DEPENDS H5REPACK_VERIFY_LAYOUT-${testname}-clear-objects
)
add_test (
NAME H5REPACK_VERIFY_LAYOUT-${testname}_DFF
- COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5diff${tgt_ext}> ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}
+ COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5diff${tgt_file_ext}> ${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}
@@ -472,7 +569,7 @@
NAME H5REPACK_VERIFY_LAYOUT-${testname}_DMP
COMMAND "${CMAKE_COMMAND}"
-D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5dump${tgt_ext}>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump${tgt_file_ext}>"
-D "TEST_ARGS:STRING=-d;${testdset};-pH;out-${testname}.${testfile}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
-D "TEST_OUTPUT=${testfile}-${testname}-v.out"
@@ -498,7 +595,7 @@
NAME H5REPACK_VERIFY_LAYOUT-${testname}_DMP
COMMAND "${CMAKE_COMMAND}"
-D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5dump${tgt_ext}>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump${tgt_file_ext}>"
-D "TEST_ARGS:STRING=-pH;out-${testname}.${testfile}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
-D "TEST_OUTPUT=${testfile}-${testname}-v.out"
@@ -536,7 +633,7 @@
)
add_test (
NAME H5REPACK_VERIFY_LAYOUT_VDS-${testname}
- COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5repack${tgt_ext}> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}
+ COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5repack${tgt_file_ext}> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}
)
set_tests_properties (H5REPACK_VERIFY_LAYOUT_VDS-${testname} PROPERTIES
WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles"
@@ -546,7 +643,7 @@
NAME H5REPACK_VERIFY_LAYOUT_VDS-${testname}_DMP
COMMAND "${CMAKE_COMMAND}"
-D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5dump${tgt_ext}>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump${tgt_file_ext}>"
-D "TEST_ARGS:STRING=-d;${testdset};-p;out-${testname}.${testfile}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
-D "TEST_OUTPUT=${testfile}-${testname}-v.out"
@@ -574,7 +671,7 @@
)
add_test (
NAME H5REPACK_VERIFY_SUPERBLOCK-${testname}
- COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5repack${tgt_ext}> -j;${lowbound};-k;${highbound} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}
+ COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5repack${tgt_file_ext}> -j;${lowbound};-k;${highbound} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}
)
set_tests_properties (H5REPACK_VERIFY_SUPERBLOCK-${testname} PROPERTIES
DEPENDS H5REPACK_VERIFY_SUPERBLOCK-${testname}-clear-objects
@@ -583,7 +680,7 @@
NAME H5REPACK_VERIFY_SUPERBLOCK-${testname}_DMP
COMMAND "${CMAKE_COMMAND}"
-D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5dump${tgt_ext}>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump${tgt_file_ext}>"
-D "TEST_ARGS:STRING=-H;-B;out-${testname}.${testfile}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
-D "TEST_OUTPUT=${testfile}-${testname}-v.out"
@@ -608,7 +705,7 @@
)
add_test (
NAME ADD_H5_VERIFY_INVALIDBOUNDS-h5repack-${testname}
- COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5repack${tgt_ext}> -j;${lowbound};-k;${highbound} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}
+ COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5repack${tgt_file_ext}> -j;${lowbound};-k;${highbound} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}
)
set_tests_properties (ADD_H5_VERIFY_INVALIDBOUNDS-h5repack-${testname} PROPERTIES
DEPENDS ADD_H5_VERIFY_INVALIDBOUNDS-h5repack-${testname}-clear-objects
@@ -619,34 +716,78 @@
macro (ADD_H5_TEST_META testname testfile)
# Remove any output file left over from previous test run
add_test (
- NAME H5REPACK_META-${testname}_N-clear-objects
+ NAME H5REPACK_META-${testname}-clear-objects
COMMAND ${CMAKE_COMMAND} -E remove
testfiles/out-${testname}_N.${testname}.h5
+ testfiles/out-${testname}_N.${testname}.out
+ testfiles/out-${testname}_N.${testname}.out.err
testfiles/out-${testname}_M.${testname}.h5
+ testfiles/out-${testname}_M.${testname}.out
+ testfiles/out-${testname}_M.${testname}.out.err
)
- set_tests_properties (H5REPACK_META-${testname}_N-clear-objects PROPERTIES
+ set_tests_properties (H5REPACK_META-${testname}-clear-objects PROPERTIES
FIXTURES_REQUIRED clear_h5repack
)
add_test (
NAME H5REPACK_META-${testname}_N
- COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5repack${tgt_ext}> ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}_N.${testname}.h5
+ COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5repack${tgt_file_ext}> ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}_N.${testname}.h5
)
set_tests_properties (H5REPACK_META-${testname}_N PROPERTIES
- DEPENDS H5REPACK_META-${testname}_N-clear-objects
+ DEPENDS H5REPACK_META-${testname}-clear-objects
+ )
+ add_test (
+ NAME H5REPACK_META-${testname}_N_DFF
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5diff${tgt_file_ext}>"
+ -D "TEST_ARGS:STRING=-v;${testfile};out-${testname}_N.${testname}.h5"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
+ -D "TEST_OUTPUT=out-${testname}_N.${testname}.out"
+ -D "TEST_EXPECT=0"
+ -D "TEST_REFERENCE=out-${testname}_N.${testname}.txt"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ set_tests_properties (H5REPACK_META-${testname}_N_DFF PROPERTIES
+ DEPENDS H5REPACK_META-${testname}_N
)
add_test (
NAME H5REPACK_META-${testname}_M
- COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5repack${tgt_ext}> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}_M.${testname}.h5
+ COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5repack${tgt_file_ext}> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}_M.${testname}.h5
)
set_tests_properties (H5REPACK_META-${testname}_M PROPERTIES
- DEPENDS H5REPACK_META-${testname}_N
+ DEPENDS H5REPACK_META-${testname}_N_DFF
)
-
- 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"
+ add_test (
+ NAME H5REPACK_META-${testname}_M_DFF
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5diff${tgt_file_ext}>"
+ -D "TEST_ARGS:STRING=-v;${testfile};out-${testname}_M.${testname}.h5"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
+ -D "TEST_OUTPUT=out-${testname}_M.${testname}.out"
+ -D "TEST_EXPECT=0"
+ -D "TEST_REFERENCE=out-${testname}_M.${testname}.txt"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ set_tests_properties (H5REPACK_META-${testname}_M_DFF PROPERTIES
DEPENDS H5REPACK_META-${testname}_M
)
+ add_test (NAME H5REPACK_META-${testname}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
+ -D "TEST_ONEFILE=out-${testname}_N.${testname}.out"
+ -D "TEST_TWOFILE=out-${testname}_M.${testname}.h5"
+ -D "TEST_FUNCTION=LTEQ"
+ -P "${HDF_RESOURCES_DIR}/fileCompareTest.cmake"
+ )
+ if (CMAKE_VERSION VERSION_LESS "3.14.0")
+ set_tests_properties (H5REPACK_META-${testname} PROPERTIES
+ DISABLED "true"
+ )
+ endif ()
+ set_tests_properties (H5REPACK_META-${testname} PROPERTIES
+ DEPENDS H5REPACK_META-${testname}_M_DFF
+ )
endmacro ()
macro (ADD_H5_UD_TEST testname resultcode resultfile)
@@ -699,6 +840,104 @@
endif ()
endmacro ()
+ macro (ADD_H5_EXTERNAL_TEST testname testtype testfile)
+ if (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ # canonical file = h5repack_${testfile}.h5 - preexist
+ # external file = h5repack_${testfile}_ex.h5 - preexist
+ # repacked file = h5repack_${testfile}_rp.h5 - created
+ # external data file = h5repack_${testfile}_ex-0.dat
+ if ("${testtype}" STREQUAL "SKIP")
+ add_test (
+ NAME H5REPACK_EXTERNAL-${testname}
+ COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}"
+ )
+ set_property(TEST H5REPACK_EXTERNAL-${testname} PROPERTY DISABLED)
+ else ()
+ add_test (
+ NAME H5REPACK_EXTERNAL-${testname}-clear-objects
+ COMMAND ${CMAKE_COMMAND} -E remove h5repack_${testfile}_rp.h5
+ )
+ set_tests_properties (H5REPACK_EXTERNAL-${testname}-clear-objects PROPERTIES
+ WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles"
+ FIXTURES_REQUIRED clear_h5repack
+ )
+ # make sure external data file 0 is available
+ add_test (
+ NAME H5REPACK_EXTERNAL-${testname}_CPY
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different
+ "${PROJECT_SOURCE_DIR}/testfiles/h5repack_${testfile}_ex-0.dat" "${PROJECT_BINARY_DIR}/testfiles/h5repack_${testfile}_ex-0.dat"
+ )
+ set_tests_properties (H5REPACK_EXTERNAL-${testname}_CPY PROPERTIES
+ WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles"
+ DEPENDS H5REPACK_EXTERNAL-${testname}-clear-objects
+ )
+ # comparison of known files
+ add_test (
+ NAME H5REPACK_EXTERNAL-${testname}_DFF1
+ COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5diff${tgt_file_ext}> --enable-error-stack ${PROJECT_BINARY_DIR}/testfiles/h5repack_${testfile}.h5 ${PROJECT_BINARY_DIR}/testfiles/h5repack_${testfile}_ex.h5
+ )
+ set_tests_properties (H5REPACK_EXTERNAL-${testname}_DFF1 PROPERTIES
+ WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles"
+ DEPENDS H5REPACK_EXTERNAL-${testname}_CPY
+ )
+ # repack the external file to the repacked file
+ add_test (
+ NAME H5REPACK_EXTERNAL-${testname}
+ COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5repack${tgt_file_ext}> --enable-error-stack ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/h5repack_${testfile}_ex.h5 ${PROJECT_BINARY_DIR}/testfiles/h5repack_${testfile}_rp.h5
+ )
+ set_tests_properties (H5REPACK_EXTERNAL-${testname} PROPERTIES
+ WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles"
+ DEPENDS H5REPACK_EXTERNAL-${testname}_DFF1
+ )
+ # comparison of repacked file to known files
+ add_test (
+ NAME H5REPACK_EXTERNAL-${testname}_DFF2
+ COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5diff${tgt_file_ext}> --enable-error-stack ${PROJECT_BINARY_DIR}/testfiles/h5repack_${testfile}_rp.h5 ${PROJECT_BINARY_DIR}/testfiles/h5repack_${testfile}.h5
+ )
+ set_tests_properties (H5REPACK_EXTERNAL-${testname}_DFF2 PROPERTIES
+ WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles"
+ DEPENDS H5REPACK_EXTERNAL-${testname}
+ )
+ add_test (
+ NAME H5REPACK_EXTERNAL-${testname}_DFF3
+ COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5diff${tgt_file_ext}> --enable-error-stack ${PROJECT_BINARY_DIR}/testfiles/h5repack_${testfile}_rp.h5 ${PROJECT_BINARY_DIR}/testfiles/h5repack_${testfile}_ex.h5
+ )
+ set_tests_properties (H5REPACK_EXTERNAL-${testname}_DFF3 PROPERTIES
+ WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles"
+ DEPENDS H5REPACK_EXTERNAL-${testname}_DFF2
+ )
+ # invalidate external file by removing its first data file
+ add_test (
+ NAME H5REPACK_EXTERNAL-${testname}_DATA_RMV
+ COMMAND ${CMAKE_COMMAND} -E remove h5repack_${testfile}_ex-0.dat
+ )
+ set_tests_properties (H5REPACK_EXTERNAL-${testname}_DATA_RMV PROPERTIES
+ WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles"
+ DEPENDS H5REPACK_EXTERNAL-${testname}_DFF3
+ )
+ # verify comparison of repacked file to known file
+ add_test (
+ NAME H5REPACK_EXTERNAL-${testname}_DFF4
+ COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5diff${tgt_file_ext}> --enable-error-stack ${PROJECT_BINARY_DIR}/testfiles/h5repack_${testfile}_rp.h5 ${PROJECT_BINARY_DIR}/testfiles/h5repack_${testfile}.h5
+ )
+ set_tests_properties (H5REPACK_EXTERNAL-${testname}_DFF4 PROPERTIES
+ WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles"
+ DEPENDS H5REPACK_EXTERNAL-${testname}_DATA_RMV
+ )
+ # verify comparison of repacked file to known external file fails
+ add_test (
+ NAME H5REPACK_EXTERNAL-${testname}_DFF_FAIL
+ COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5diff${tgt_file_ext}> --enable-error-stack ${PROJECT_BINARY_DIR}/testfiles/h5repack_${testfile}_rp.h5 ${PROJECT_BINARY_DIR}/testfiles/h5repack_${testfile}_ex.h5
+ )
+ set_tests_properties (H5REPACK_EXTERNAL-${testname}_DFF_FAIL PROPERTIES
+ WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles"
+ DEPENDS H5REPACK_EXTERNAL-${testname}_DFF4
+ WILL_FAIL "true"
+ )
+ endif ()
+ endif ()
+ endmacro ()
+
##############################################################################
##############################################################################
### T H E T E S T S ###
@@ -987,7 +1226,7 @@
if (NOT USE_FILTER_DEFLATE)
set (TESTTYPE "SKIP")
endif ()
- ADD_H5_CMP_TEST (gzip_verbose_filters "O?...ing file[^\n]+\n" ${TESTTYPE} 0 ${arg})
+ ADD_H5_FILTER_TEST (gzip_verbose_filters "O?...ing file[^\n]+\n" ${TESTTYPE} 0 ${arg})
###########################################################
# the following tests assume the input files have filters
@@ -1302,16 +1541,26 @@
ADD_H5_TEST (bug1814 "TEST" ${FILE_REF})
# test attribute with various references (bug1797 / HDFFV-5932)
-# the references in attribute of compund or vlen datatype
+# the references in attribute of compound or vlen datatype
ADD_H5_TEST (HDFFV-5932 "TEST" ${FILE_ATTR_REF})
-# Add test for memory leak in attirbute. This test is verified by CTEST.
+# Add test for memory leak in attribute. This test is verified by CTEST.
# 1. leak from vlen string
# 2. leak from compound type without reference member
# (HDFFV-7840, )
# Note: this test is experimental for sharing test file among tools
ADD_H5_TEST (HDFFV-7840 "TEST" h5diff_attr1.h5)
+# test CVE-2018-17432 fix
+ set (arg h5repack_CVE-2018-17432.h5 --low=1 --high=2 -f GZIP=8 -l dset1:CHUNK=5x6)
+ set (TESTTYPE "TEST")
+ ADD_H5_FILTER_TEST (HDFFV-10590 "" ${TESTTYPE} 1 ${arg})
+
+# test CVE-2018-14460 fix
+ set (arg h5repack_CVE-2018-14460.h5)
+ set (TESTTYPE "TEST")
+ ADD_H5_FILTER_TEST (HDFFV-11223 "" ${TESTTYPE} 1 ${arg})
+
# tests for metadata block size option ('-M')
ADD_H5_TEST_META (meta_short h5repack_layout.h5 -M 8192)
ADD_H5_TEST_META (meta_long h5repack_layout.h5 --metadata_block_size=8192)
@@ -1351,6 +1600,12 @@
endif ()
ADD_H5_VERIFY_VDS (vds_conti ${TESTTYPE} 0 ${FILEV4} vds_dset CONTIGUOUS -l vds_dset:CONTI)
+################################################################
+# reference new api conversions
+###############################################################
+ADD_H5_DMP_TEST (attrregion "TEST" 0 tattrreg.h5)
+ADD_H5_DMP_TEST (dataregion "TEST" 0 tdatareg.h5)
+
##############################################################################
### V E R S I O N B O U N D S T E S T S
##############################################################################
@@ -1364,6 +1619,53 @@ ADD_H5_VERIFY_SUPERBLOCK (SB_IS_3 h5repack_layout.h5 2 2 3)
ADD_H5_VERIFY_INVALIDBOUNDS (latest_latest_invalid bounds_latest_latest.h5 0 1)
##############################################################################
+### E X T E R N A L S T O R A G E T E S T S
+##############################################################################
+ADD_H5_EXTERNAL_TEST (ext_f32le "TEST" f32le -l CONTI)
+ADD_H5_EXTERNAL_TEST (ext_int32le_1d "TEST" int32le_1d -l CONTI)
+ADD_H5_EXTERNAL_TEST (ext_int32le_2d "TEST" int32le_2d -l CONTI)
+ADD_H5_EXTERNAL_TEST (ext_int32le_3d "TEST" int32le_3d -l CONTI)
+ADD_H5_EXTERNAL_TEST (ext_uint8be "TEST" uint8be -l CONTI)
+
+##############################################################################
+### E X T E R N A L L I N K T E S T S
+##############################################################################
+### HDFFV-11128 needs fixed to enable the following test
+#ADD_H5_DMP_TEST (h5copy_extlinks_src-base "TEST" 0 h5copy_extlinks_src.h5 --enable-error-stack)
+ADD_H5_DMP_TEST (tsoftlinks-base "TEST" 0 tsoftlinks.h5 --enable-error-stack)
+ADD_H5_DMP_TEST (textlink-base "TEST" 0 textlink.h5 --enable-error-stack)
+ADD_H5_DMP_TEST (textlinkfar-base "TEST" 0 textlinkfar.h5 --enable-error-stack)
+ADD_H5_DMP_TEST (textlinksrc-base "TEST" 0 textlinksrc.h5 --enable-error-stack)
+ADD_H5_DMP_TEST (textlinktar-base "TEST" 0 textlinktar.h5 --enable-error-stack)
+
+ADD_H5_DIFF_TEST (h5copy_extlinks_src-merge "TEST" 0 h5copy_extlinks_src.h5 --merge)
+ADD_H5_DIFF_TEST (tsoftlinks-merge "TEST" 1 tsoftlinks.h5 --merge)
+ADD_H5_DIFF_TEST (textlink-merge "TEST" 0 textlink.h5 --merge)
+### HDFFV-11128 needs fixed to enable the following test
+#ADD_H5_DIFF_TEST (textlinkfar-merge "TEST" 1 textlinkfar.h5 --merge)
+### HDFFV-11128 needs fixed to enable the following test
+#ADD_H5_DIFF_TEST (textlinksrc-merge "TEST" 1 textlinksrc.h5 --merge)
+### HDFFV-11128 needs fixed to enable the following test
+#ADD_H5_DIFF_TEST (textlinktar-merge "TEST" 1 textlinktar.h5 --merge)
+
+ADD_H5_DMP_TEST (h5copy_extlinks_src-prune "TEST" 0 h5copy_extlinks_src.h5 --prune --enable-error-stack)
+ADD_H5_DMP_TEST (tsoftlinks-prune "TEST" 0 tsoftlinks.h5 --prune --enable-error-stack)
+ADD_H5_DMP_TEST (textlink-prune "TEST" 0 textlink.h5 --prune --enable-error-stack)
+ADD_H5_DMP_TEST (textlinkfar-prune "TEST" 0 textlinkfar.h5 --prune --enable-error-stack)
+ADD_H5_DMP_TEST (textlinksrc-prune "TEST" 0 textlinksrc.h5 --prune --enable-error-stack)
+ADD_H5_DMP_TEST (textlinktar-prune "TEST" 0 textlinktar.h5 --prune --enable-error-stack)
+
+ADD_H5_DMP_TEST (h5copy_extlinks_src-mergeprune "TEST" 0 h5copy_extlinks_src.h5 --merge --prune --enable-error-stack)
+ADD_H5_DMP_TEST (tsoftlinks-mergeprune "TEST" 0 tsoftlinks.h5 --merge --prune --enable-error-stack)
+ADD_H5_DMP_TEST (textlink-mergeprune "TEST" 0 textlink.h5 --merge --prune --enable-error-stack)
+### HDFFV-11128 needs fixed to enable the following test
+#ADD_H5_DMP_TEST (textlinkfar-mergeprune "TEST" 0 textlinkfar.h5 --merge --prune --enable-error-stack)
+### HDFFV-11128 needs fixed to enable the following test
+#ADD_H5_DMP_TEST (textlinksrc-mergeprune "TEST" 0 textlinksrc.h5 --merge --prune --enable-error-stack)
+### HDFFV-11128 needs fixed to enable the following test
+#ADD_H5_DMP_TEST (textlinktar-mergeprune "TEST" 0 textlinktar.h5 --merge --prune --enable-error-stack)
+
+##############################################################################
### P L U G I N T E S T S
##############################################################################
if (BUILD_SHARED_LIBS)
diff --git a/tools/test/h5repack/CMakeVFDTests.cmake b/tools/test/h5repack/CMakeVFDTests.cmake
index c1a280b..f8ac10b 100644
--- a/tools/test/h5repack/CMakeVFDTests.cmake
+++ b/tools/test/h5repack/CMakeVFDTests.cmake
@@ -5,7 +5,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
@@ -15,20 +15,7 @@
### T E S T I N G ###
##############################################################################
##############################################################################
-
-set (VFD_LIST
- sec2
- stdio
- core
- core_paged
- split
- multi
- family
-)
-
-if (DIRECT_VFD)
- set (VFD_LIST ${VFD_LIST} direct)
-endif ()
+H5_CREATE_VFD_DIR()
##############################################################################
##############################################################################
@@ -38,7 +25,6 @@ endif ()
macro (ADD_VFD_TEST vfdname resultcode)
if (NOT HDF5_ENABLE_USING_MEMCHECKER)
- file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdname}")
add_test (
NAME H5REPACK-${vfdname}-h5repacktest-clear-objects
COMMAND ${CMAKE_COMMAND} -E remove
diff --git a/tools/test/h5repack/Makefile.am b/tools/test/h5repack/Makefile.am
index 59d7a6a..dbd8478 100644
--- a/tools/test/h5repack/Makefile.am
+++ b/tools/test/h5repack/Makefile.am
@@ -6,7 +6,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
##
@@ -22,10 +22,12 @@ include $(top_srcdir)/config/commence.am
AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/test -I$(top_srcdir)/tools/lib -I$(top_srcdir)/tools/src/h5repack
# Test programs and scripts
+TEST_PROG=h5repackgentest
TEST_SCRIPT=h5repack.sh
noinst_PROGRAMS=h5repacktst testh5repack_detect_szip
+check_PROGRAMS=$(TEST_PROG)
SCRIPT_DEPEND=../../src/h5repack/h5repack$(EXEEXT) h5repacktst$(EXEEXT)
if HAVE_SHARED_CONDITIONAL
if USE_PLUGINS_CONDITIONAL
@@ -40,7 +42,7 @@ LDADD=../../src/h5repack/libh5repack.la $(LIBH5TOOLS) $(LIBH5TEST) $(LIBHDF5)
testh5repack_detect_szip_SOURCES=testh5repack_detect_szip.c
-h5repacktst_SOURCES=h5repacktst.c
+h5repacktst_SOURCES=h5repacktst.c
if HAVE_SHARED_CONDITIONAL
@@ -57,7 +59,8 @@ endif
# Temporary files. *.h5 are generated by h5repack. They should
# copied to the testfiles/ directory if update is required.
-CHECK_CLEANFILES+=*.h5 *.bin testfiles/h5diff_attr1.h5 testfiles/tfamily*.h5
+# *.dat files may be created by h5repackgentest.
+CHECK_CLEANFILES+=*.h5 *.dat *.bin testfiles/h5diff_attr1.h5 testfiles/tfamily*.h5
DISTCLEANFILES=h5repack.sh h5repack_plugin.sh
include $(top_srcdir)/config/conclude.am
diff --git a/tools/test/h5repack/dynlib_rpk.c b/tools/test/h5repack/dynlib_rpk.c
index 29c3eae..bef032a 100644
--- a/tools/test/h5repack/dynlib_rpk.c
+++ b/tools/test/h5repack/dynlib_rpk.c
@@ -5,7 +5,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -20,24 +20,32 @@
#include <stdio.h>
#include "H5PLextern.h"
-#define H5Z_FILTER_DYNLIB1 257
+#define H5Z_FILTER_DYNLIB1 257
-static size_t H5Z_filter_dynlib1(unsigned int flags, size_t cd_nelmts,
- const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
+static size_t H5Z_filter_dynlib1(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values,
+ size_t nbytes, size_t *buf_size, void **buf);
/* This message derives from H5Z */
const H5Z_class2_t H5Z_DYNLIB1[1] = {{
- H5Z_CLASS_T_VERS, /* H5Z_class_t version */
- H5Z_FILTER_DYNLIB1, /* Filter id number */
- 1, 1, /* Encoding and decoding enabled */
- "dynlib1", /* Filter name for debugging */
- NULL, /* The "can apply" callback */
- NULL, /* The "set local" callback */
- (H5Z_func_t)H5Z_filter_dynlib1, /* The actual filter function */
+ H5Z_CLASS_T_VERS, /* H5Z_class_t version */
+ H5Z_FILTER_DYNLIB1, /* Filter id number */
+ 1, 1, /* Encoding and decoding enabled */
+ "dynlib1", /* Filter name for debugging */
+ NULL, /* The "can apply" callback */
+ NULL, /* The "set local" callback */
+ H5Z_filter_dynlib1, /* The actual filter function */
}};
-H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;}
-const void *H5PLget_plugin_info(void) {return H5Z_DYNLIB1;}
+H5PL_type_t
+H5PLget_plugin_type(void)
+{
+ return H5PL_TYPE_FILTER;
+}
+const void *
+H5PLget_plugin_info(void)
+{
+ return H5Z_DYNLIB1;
+}
/*-------------------------------------------------------------------------
* Function: H5Z_filter_dynlib1
@@ -57,39 +65,37 @@ const void *H5PLget_plugin_info(void) {return H5Z_DYNLIB1;}
*-------------------------------------------------------------------------
*/
static size_t
-H5Z_filter_dynlib1(unsigned int flags, size_t cd_nelmts,
- const unsigned int *cd_values, size_t nbytes,
- size_t *buf_size, void **buf)
+H5Z_filter_dynlib1(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values, size_t nbytes,
+ size_t *buf_size, void **buf)
{
- int *int_ptr = (int *)*buf; /* Pointer to the data values */
- size_t buf_left = *buf_size; /* Amount of data buffer left to process */
- int add_on = 0;
+ int * int_ptr = (int *)*buf; /* Pointer to the data values */
+ size_t buf_left = *buf_size; /* Amount of data buffer left to process */
+ int add_on = 0;
/* Check for the correct number of parameters */
- if(cd_nelmts == 0)
+ if (cd_nelmts == 0)
return 0;
/* Check that permanent parameters are set correctly */
- if(cd_values[0] > 9)
+ if (cd_values[0] > 9)
return 0;
add_on = (int)cd_values[0];
- if(flags & H5Z_FLAG_REVERSE) { /*read*/
- /* Substract the "add on" value to all the data values */
- while(buf_left > 0) {
+ if (flags & H5Z_FLAG_REVERSE) { /*read*/
+ /* Subtract the "add on" value to all the data values */
+ while (buf_left > 0) {
*int_ptr++ -= add_on;
buf_left -= sizeof(int);
- } /* end while */
- } /* end if */
+ } /* end while */
+ } /* end if */
else { /*write*/
/* Add the "add on" value to all the data values */
- while(buf_left > 0) {
+ while (buf_left > 0) {
*int_ptr++ += add_on;
buf_left -= sizeof(int);
} /* end while */
- } /* end else */
+ } /* end else */
return nbytes;
} /* end H5Z_filter_dynlib1() */
-
diff --git a/tools/test/h5repack/dynlib_vrpk.c b/tools/test/h5repack/dynlib_vrpk.c
index 06d90ff..a45de65 100644
--- a/tools/test/h5repack/dynlib_vrpk.c
+++ b/tools/test/h5repack/dynlib_vrpk.c
@@ -5,7 +5,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -17,26 +17,35 @@
#include <stdio.h>
#include "H5PLextern.h"
-#define H5Z_FILTER_DYNLIB4 260
+#define H5Z_FILTER_DYNLIB4 260
-#define PUSH_ERR(func, minor, str) H5Epush2(H5E_DEFAULT, __FILE__, func, __LINE__, H5E_ERR_CLS, H5E_PLUGIN, minor, str)
+#define PUSH_ERR(func, minor, str) \
+ H5Epush2(H5E_DEFAULT, __FILE__, func, __LINE__, H5E_ERR_CLS, H5E_PLUGIN, minor, str)
-static size_t H5Z_filter_dynlib4(unsigned int flags, size_t cd_nelmts,
- const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
+static size_t H5Z_filter_dynlib4(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values,
+ size_t nbytes, size_t *buf_size, void **buf);
/* This message derives from H5Z */
const H5Z_class2_t H5Z_DYNLIB4[1] = {{
- H5Z_CLASS_T_VERS, /* H5Z_class_t version */
- H5Z_FILTER_DYNLIB4, /* Filter id number */
- 1, 1, /* Encoding and decoding enabled */
- "dynlib4", /* Filter name for debugging */
- NULL, /* The "can apply" callback */
- NULL, /* The "set local" callback */
- (H5Z_func_t)H5Z_filter_dynlib4, /* The actual filter function */
+ H5Z_CLASS_T_VERS, /* H5Z_class_t version */
+ H5Z_FILTER_DYNLIB4, /* Filter id number */
+ 1, 1, /* Encoding and decoding enabled */
+ "dynlib4", /* Filter name for debugging */
+ NULL, /* The "can apply" callback */
+ NULL, /* The "set local" callback */
+ H5Z_filter_dynlib4, /* The actual filter function */
}};
-H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;}
-const void *H5PLget_plugin_info(void) {return H5Z_DYNLIB4;}
+H5PL_type_t
+H5PLget_plugin_type(void)
+{
+ return H5PL_TYPE_FILTER;
+}
+const void *
+H5PLget_plugin_info(void)
+{
+ return H5Z_DYNLIB4;
+}
/*-------------------------------------------------------------------------
* Function: H5Z_filter_dynlib4
@@ -53,50 +62,48 @@ const void *H5PLget_plugin_info(void) {return H5Z_DYNLIB4;}
*-------------------------------------------------------------------------
*/
static size_t
-H5Z_filter_dynlib4(unsigned int flags, size_t cd_nelmts,
- const unsigned int *cd_values, size_t nbytes,
- size_t *buf_size, void **buf)
+H5Z_filter_dynlib4(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values, size_t nbytes,
+ size_t *buf_size, void **buf)
{
- int *int_ptr = (int *)*buf; /* Pointer to the data values */
- size_t buf_left = *buf_size; /* Amount of data buffer left to process */
- int add_on = 0;
+ int * int_ptr = (int *)*buf; /* Pointer to the data values */
+ size_t buf_left = *buf_size; /* Amount of data buffer left to process */
+ int add_on = 0;
unsigned ver_info[3];
/* Check for the library version */
- if(H5get_libversion(&ver_info[0], &ver_info[1], &ver_info[2]) < 0) {
+ if (H5get_libversion(&ver_info[0], &ver_info[1], &ver_info[2]) < 0) {
PUSH_ERR("dynlib4", H5E_CALLBACK, "H5get_libversion");
- return(0);
+ return (0);
}
/* Check for the correct number of parameters */
- if(cd_nelmts == 0)
- return(0);
+ if (cd_nelmts == 0)
+ return (0);
/* Check that permanent parameters are set correctly */
- if(cd_values[0] > 9)
- return(0);
+ if (cd_values[0] > 9)
+ return (0);
- if(ver_info[0] != cd_values[1] || ver_info[1] != cd_values[2]) {
+ if (ver_info[0] != cd_values[1] || ver_info[1] != cd_values[2]) {
PUSH_ERR("dynlib4", H5E_CALLBACK, "H5get_libversion does not match");
- return(0);
+ return (0);
}
add_on = (int)cd_values[0];
- if(flags & H5Z_FLAG_REVERSE) { /*read*/
- /* Substract the "add on" value to all the data values */
- while(buf_left > 0) {
+ if (flags & H5Z_FLAG_REVERSE) { /*read*/
+ /* Subtract the "add on" value to all the data values */
+ while (buf_left > 0) {
*int_ptr++ -= add_on;
buf_left -= sizeof(int);
- } /* end while */
- } /* end if */
+ } /* end while */
+ } /* end if */
else { /*write*/
/* Add the "add on" value to all the data values */
- while(buf_left > 0) {
+ while (buf_left > 0) {
*int_ptr++ += add_on;
buf_left -= sizeof(int);
} /* end while */
- } /* end else */
+ } /* end else */
return nbytes;
} /* end H5Z_filter_dynlib4() */
-
diff --git a/tools/test/h5repack/h5repack.sh.in b/tools/test/h5repack/h5repack.sh.in
index c515786..a241ea8 100644
--- a/tools/test/h5repack/h5repack.sh.in
+++ b/tools/test/h5repack/h5repack.sh.in
@@ -7,7 +7,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
@@ -92,10 +92,18 @@ $SRC_H5REPACK_TESTFILES/h5repack_attr_refs.h5
$SRC_H5REPACK_TESTFILES/h5repack_deflate.h5
$SRC_H5REPACK_TESTFILES/h5repack_early.h5
$SRC_H5REPACK_TESTFILES/h5repack_ext.h5
+$SRC_H5REPACK_TESTFILES/h5repack_f32le.h5
+$SRC_H5REPACK_TESTFILES/h5repack_f32le_ex.h5
$SRC_H5REPACK_TESTFILES/h5repack_fill.h5
$SRC_H5REPACK_TESTFILES/h5repack_filters.h5
$SRC_H5REPACK_TESTFILES/h5repack_fletcher.h5
$SRC_H5REPACK_TESTFILES/h5repack_hlink.h5
+$SRC_H5REPACK_TESTFILES/h5repack_int32le_1d.h5
+$SRC_H5REPACK_TESTFILES/h5repack_int32le_1d_ex.h5
+$SRC_H5REPACK_TESTFILES/h5repack_int32le_2d.h5
+$SRC_H5REPACK_TESTFILES/h5repack_int32le_2d_ex.h5
+$SRC_H5REPACK_TESTFILES/h5repack_int32le_3d.h5
+$SRC_H5REPACK_TESTFILES/h5repack_int32le_3d_ex.h5
$SRC_H5REPACK_TESTFILES/h5repack_layout.h5
$SRC_H5REPACK_TESTFILES/h5repack_layouto.h5
$SRC_H5REPACK_TESTFILES/h5repack_layout2.h5
@@ -109,13 +117,29 @@ $SRC_H5REPACK_TESTFILES/h5repack_refs.h5
$SRC_H5REPACK_TESTFILES/h5repack_shuffle.h5
$SRC_H5REPACK_TESTFILES/h5repack_soffset.h5
$SRC_H5REPACK_TESTFILES/h5repack_szip.h5
+$SRC_H5REPACK_TESTFILES/h5repack_uint8be.h5
+$SRC_H5REPACK_TESTFILES/h5repack_uint8be_ex.h5
+########fsm#files########
$SRC_H5REPACK_TESTFILES/h5repack_aggr.h5
$SRC_H5REPACK_TESTFILES/h5repack_fsm_aggr_nopersist.h5
$SRC_H5REPACK_TESTFILES/h5repack_fsm_aggr_persist.h5
$SRC_H5REPACK_TESTFILES/h5repack_none.h5
$SRC_H5REPACK_TESTFILES/h5repack_paged_nopersist.h5
$SRC_H5REPACK_TESTFILES/h5repack_paged_persist.h5
+########h5diff/testfile########
$SRC_H5DIFF_TESTFILES/h5diff_attr1.h5
+########test#HDFFV-10590########
+$SRC_H5REPACK_TESTFILES/h5repack_CVE-2018-17432.h5
+$SRC_H5REPACK_TESTFILES/h5repack_CVE-2018-14460.h5
+########tools/testfiles#for#external#links########
+$SRC_TOOLS_TESTFILES/tsoftlinks.h5
+$SRC_TOOLS_TESTFILES/textlinkfar.h5
+$SRC_TOOLS_TESTFILES/textlinksrc.h5
+$SRC_TOOLS_TESTFILES/textlinktar.h5
+$SRC_TOOLS_TESTFILES/textlink.h5
+$SRC_H5REPACK_TESTFILES/h5copy_extlinks_src.h5
+$SRC_H5REPACK_TESTFILES/h5copy_extlinks_trg.h5
+########tools/testfiles########
$SRC_TOOLS_TESTFILES/tfamily00000.h5
$SRC_TOOLS_TESTFILES/tfamily00001.h5
$SRC_TOOLS_TESTFILES/tfamily00002.h5
@@ -128,6 +152,8 @@ $SRC_TOOLS_TESTFILES/tfamily00008.h5
$SRC_TOOLS_TESTFILES/tfamily00009.h5
$SRC_TOOLS_TESTFILES/tfamily00010.h5
$SRC_TOOLS_TESTFILES/tordergr.h5
+########reference#conversion#files########
+########tools/testfiles/vds########
$SRC_TOOLS_TESTFILES/vds/1_a.h5
$SRC_TOOLS_TESTFILES/vds/1_b.h5
$SRC_TOOLS_TESTFILES/vds/1_c.h5
@@ -158,24 +184,73 @@ $SRC_H5REPACK_TESTFILES/h5repack-help.txt
$SRC_H5REPACK_TESTFILES/h5repack_ext.bin
$SRC_H5REPACK_TESTFILES/ublock.bin
$SRC_H5REPACK_TESTFILES/h5repack.info
+########dat#files########
+$SRC_H5REPACK_TESTFILES/h5repack_f32le_ex-0.dat
+$SRC_H5REPACK_TESTFILES/h5repack_int32le_1d_ex-0.dat
+$SRC_H5REPACK_TESTFILES/h5repack_int32le_1d_ex-1.dat
+$SRC_H5REPACK_TESTFILES/h5repack_int32le_2d_ex-0.dat
+$SRC_H5REPACK_TESTFILES/h5repack_int32le_3d_ex-0.dat
+$SRC_H5REPACK_TESTFILES/h5repack_uint8be_ex-0.dat
+$SRC_H5REPACK_TESTFILES/h5repack_uint8be_ex-1.dat
+$SRC_H5REPACK_TESTFILES/h5repack_uint8be_ex-2.dat
+$SRC_H5REPACK_TESTFILES/h5repack_uint8be_ex-3.dat
+###############
$SRC_H5REPACK_TESTFILES/crtorder.tordergr.h5.ddl
$SRC_H5REPACK_TESTFILES/deflate_limit.h5repack_layout.h5.ddl
$SRC_H5REPACK_TESTFILES/h5repack_layout.h5.ddl
-$SRC_H5REPACK_TESTFILES/h5repack_filters.h5-gzip_verbose_filters.tst
-$SRC_H5REPACK_TESTFILES/h5repack_layout.h5-dset2_chunk_20x10-errstk.tst
$SRC_H5REPACK_TESTFILES/h5repack_layout.h5-plugin_test.ddl
-$SRC_H5REPACK_TESTFILES/plugin_test.h5repack_layout.h5.tst
-$SRC_H5REPACK_TESTFILES/1_vds.h5-vds_dset_chunk20x10x5-v.ddl
-$SRC_H5REPACK_TESTFILES/2_vds.h5-vds_chunk3x6x9-v.ddl
-$SRC_H5REPACK_TESTFILES/3_1_vds.h5-vds_chunk2x5x8-v.ddl
-$SRC_H5REPACK_TESTFILES/4_vds.h5-vds_compa-v.ddl
-$SRC_H5REPACK_TESTFILES/4_vds.h5-vds_conti-v.ddl
+########fsm#files########
$SRC_H5REPACK_TESTFILES/SP.h5repack_fsm_aggr_nopersist.h5.ddl
$SRC_H5REPACK_TESTFILES/S.h5repack_fsm_aggr_persist.h5.ddl
$SRC_H5REPACK_TESTFILES/STG.h5repack_none.h5.ddl
$SRC_H5REPACK_TESTFILES/GS.h5repack_paged_nopersist.h5.ddl
$SRC_H5REPACK_TESTFILES/SP.h5repack_paged_persist.h5.ddl
$SRC_H5REPACK_TESTFILES/SPT.h5repack_aggr.h5.ddl
+########vds#files########
+$SRC_H5REPACK_TESTFILES/1_vds.h5-vds_dset_chunk20x10x5-v.ddl
+$SRC_H5REPACK_TESTFILES/2_vds.h5-vds_chunk3x6x9-v.ddl
+$SRC_H5REPACK_TESTFILES/3_1_vds.h5-vds_chunk2x5x8-v.ddl
+$SRC_H5REPACK_TESTFILES/4_vds.h5-vds_compa-v.ddl
+$SRC_H5REPACK_TESTFILES/4_vds.h5-vds_conti-v.ddl
+########refs#files########
+$SRC_H5REPACK_TESTFILES/attrregion.tattrreg.h5.ddl
+$SRC_H5REPACK_TESTFILES/dataregion.tdatareg.h5.ddl
+########external#links#files########
+$SRC_H5REPACK_TESTFILES/textlinkfar-base.textlinkfar.h5.ddl
+$SRC_H5REPACK_TESTFILES/textlinksrc-base.textlinksrc.h5.ddl
+$SRC_H5REPACK_TESTFILES/textlinktar-base.textlinktar.h5.ddl
+$SRC_H5REPACK_TESTFILES/textlink-base.textlink.h5.ddl
+$SRC_H5REPACK_TESTFILES/tsoftlinks-base.tsoftlinks.h5.ddl
+$SRC_H5REPACK_TESTFILES/h5copy_extlinks_src-base.h5copy_extlinks_src.h5.ddl
+$SRC_H5REPACK_TESTFILES/textlinkfar-merge.textlinkfar.h5.tst
+$SRC_H5REPACK_TESTFILES/textlinksrc-merge.textlinksrc.h5.tst
+$SRC_H5REPACK_TESTFILES/textlinktar-merge.textlinktar.h5.tst
+$SRC_H5REPACK_TESTFILES/textlink-merge.textlink.h5.tst
+$SRC_H5REPACK_TESTFILES/tsoftlinks-merge.tsoftlinks.h5.tst
+$SRC_H5REPACK_TESTFILES/h5copy_extlinks_src-merge.h5copy_extlinks_src.h5.tst
+$SRC_H5REPACK_TESTFILES/textlinkfar-prune.textlinkfar.h5.ddl
+$SRC_H5REPACK_TESTFILES/textlinksrc-prune.textlinksrc.h5.ddl
+$SRC_H5REPACK_TESTFILES/textlinktar-prune.textlinktar.h5.ddl
+$SRC_H5REPACK_TESTFILES/textlink-prune.textlink.h5.ddl
+$SRC_H5REPACK_TESTFILES/tsoftlinks-prune.tsoftlinks.h5.ddl
+$SRC_H5REPACK_TESTFILES/h5copy_extlinks_src-prune.h5copy_extlinks_src.h5.ddl
+$SRC_H5REPACK_TESTFILES/textlinkfar-mergeprune.textlinkfar.h5.ddl
+$SRC_H5REPACK_TESTFILES/textlinksrc-mergeprune.textlinksrc.h5.ddl
+$SRC_H5REPACK_TESTFILES/textlinktar-mergeprune.textlinktar.h5.ddl
+$SRC_H5REPACK_TESTFILES/textlink-mergeprune.textlink.h5.ddl
+$SRC_H5REPACK_TESTFILES/tsoftlinks-mergeprune.tsoftlinks.h5.ddl
+$SRC_H5REPACK_TESTFILES/h5copy_extlinks_src-mergeprune.h5copy_extlinks_src.h5.ddl
+########tst#files########
+$SRC_H5REPACK_TESTFILES/h5repack_filters.h5-gzip_verbose_filters.tst
+$SRC_H5REPACK_TESTFILES/h5repack_layout.h5-dset2_chunk_20x10-errstk.tst
+$SRC_H5REPACK_TESTFILES/plugin_test.h5repack_layout.h5.tst
+########external#links#tst#files########
+$SRC_H5REPACK_TESTFILES/tsoftlinks-merge.tsoftlinks.h5.tst
+$SRC_H5REPACK_TESTFILES/textlinkfar-merge.textlinkfar.h5.tst
+$SRC_H5REPACK_TESTFILES/textlinksrc-merge.textlinksrc.h5.tst
+$SRC_H5REPACK_TESTFILES/textlinktar-merge.textlinktar.h5.tst
+$SRC_H5REPACK_TESTFILES/textlink-merge.textlink.h5.tst
+$SRC_H5REPACK_TESTFILES/h5copy_extlinks_src-merge.h5copy_extlinks_src.h5.tst
"
#
@@ -252,6 +327,12 @@ SKIP() {
echo " -SKIP-"
}
+##############################################################################
+##############################################################################
+### T H E T E S T S M A C R O S ###
+##############################################################################
+##############################################################################
+
# Call the h5diff tool
#
DIFFTEST()
@@ -444,7 +525,7 @@ VERIFY_LAYOUT_ALL()
#---------------------------------
# check the layout from a dataset
- # check if the other layouts still exsit
+ # check if the other layouts still exist
VERIFY "layouts"
(
cd $TESTDIR
@@ -599,8 +680,95 @@ VERIFY_INVALIDBOUNDS()
} # end of VERIFY_INVALIDBOUNDS
+# -----------------------------------------------------------------------------
+# Expect h5diff to fail
+# Use only by VERIFY_EXTERNAL_CONSOLIDATION
+# -----------------------------------------------------------------------------
+DIFFFAIL()
+{
+ VERIFY h5diff unequal $@
+ (
+ cd $TESTDIR
+ $RUNSERIAL $H5DIFF_BIN -q "$@"
+ )
+ RET=$?
+ if [ $RET -eq 0 ] ; then
+ echo "*FAILED*"
+ nerrors="`expr $nerrors + 1`"
+ else
+ echo " PASSED"
+ fi
+}
+
+# -----------------------------------------------------------------------------
+# Catchall test for repacking with external files
+# Loops over all (internally-listed) cases and applies the given arguments
+# to h5repack.
+# Each test file family must be listed in the for loop at the start of the
+# 'function'.
+# Expects case files to be of format:
+# + h5repack_<NAME>.h5
+# + h5repack_<NAME>_ex.h5
+# + h5repack_<NAME>_ex-<N>.dat
+# ...where NAME is part of the internal list, and N is a positive decimal
+# number; multiple external files (*.dat) are allowed per file, but they must
+# follow the pattern and be in contiguous numerical sequence starting at 0.
+# -----------------------------------------------------------------------------
+VERIFY_EXTERNAL_CONSOLIDATION()
+{
+ for name in f32le int32le_1d int32le_2d int32le_3d uint8be
+ do
+ basename="h5repack_${name}"
+ base_ext="${basename}_ex"
+ base_rpkg="${basename}_rp"
+ canonical="${basename}.h5"
+ external="${base_ext}.h5"
+ ex_dat="${base_ext}-0.dat"
+ ex_dat_mv="__${ext_dat}"
+ repacked="${base_rpkg}.h5"
+ prev_nerrors=$nerrors
+
+ TESTING external consolidation on $name with h5repack $@
+ echo " . . ."
+
+ # baseline comparison of known files
+ DIFFTEST $canonical $external
+
+ # repack the external file, verify integrity
+ ( cd $TESTDIR
+ $H5REPACK_BIN $@ $external $repacked
+ )
+ DIFFTEST $repacked $canonical
+ DIFFTEST $repacked $external
+
+ # invalidate external file by moving its first data file; verify
+ ( cd $TESTDIR
+ mv $ex_dat $ex_dat_mv
+ )
+ DIFFFAIL $canonical $external
+ DIFFFAIL $repacked $external
+ DIFFTEST $canonical $repacked
+
+ # reset test state for re-runs with different h5repack arguments
+ ( cd $TESTDIR
+ mv $ex_dat_mv $ex_dat
+ rm $repacked
+ )
+
+ # flag if any of the above checks failed
+ if [ $prev_nerrors != $nerrors ]
+ then
+ echo ". . . *FAILED*"
+ nerrors="`expr $prev_nerrors + 1`"
+ else
+ echo ". . . PASSED"
+ fi
+ done
+} # end VERIFY_EXTERNAL_CONSOLIDATION
+
+# -----------------------------------------------------------------------------
# same as TOOLTEST, but it uses the old syntax -i input_file -o output_file
-#
+# -----------------------------------------------------------------------------
TOOLTEST0()
{
infile=$2
@@ -640,7 +808,7 @@ TOOLTEST1()
TESTING $H5REPACK $@
(
cd $TESTDIR
- $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile
+ $ENVCMD $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile
)
RET=$?
if [ $RET != 0 ] ; then
@@ -700,6 +868,160 @@ TOOLTESTV()
rm -f $outfile
}
+# Same as TOOLTEST, but expects h5repack fails
+#
+TOOLTEST_FAIL()
+{
+ infile=$1
+ outfile=$2
+ expect="$TESTDIR/$2-$1.ddl"
+ actual="$TESTDIR/$2-$1.out"
+ actual_err="$TESTDIR/$2-$1.err"
+ shift
+ shift
+
+ # Run test.
+ TESTING $H5REPACK $@
+ (
+ cd $TESTDIR
+ $ENVCMD $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile
+ ) >&$actual
+ RET=$?
+
+ # Normally h5repack of files tested with this function are expected
+ # to return not 0, but if the command results in "Segmentation fault"
+ # or "core dumped" it is a failure regardless of the return value.
+ failure=`grep -e 'Segmentation fault' -e 'core dumped' $actual`
+ if [ "$failure" != "" ]; then
+ nerrors="`expr $nerrors + 1`"
+ echo " FAILED"
+ echo " $failure"
+ else
+ if [ $RET == 0 ] ; then
+ nerrors="`expr $nerrors + 1`"
+ echo " FAILED"
+ else
+ echo " PASSED"
+ fi
+ fi
+ rm -f $outfile
+}
+
+# This is same as TOOLTESTV() with comparing display output
+# with actual filename swapped
+#
+TOOLTESTSV()
+{
+ expect="$TESTDIR/$1.$2.tst"
+ actual="$TESTDIR/`basename $2 .ddl`.out"
+ actual_err="$TESTDIR/`basename $2 .ddl`.err"
+
+ infile=$2
+ outfile=out-$1.$2
+ shift
+ shift
+
+ # Run test.
+ TESTING $H5REPACK $@
+ (
+ cd $TESTDIR
+ $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile
+ ) >$actual 2>$actual_err
+ RET=$?
+ if [ $RET != 0 ] ; then
+ echo "*FAILED*"
+ nerrors="`expr $nerrors + 1`"
+ else
+ echo " PASSED"
+ VERIFY h5diff equal $@
+ (
+ cd $TESTDIR
+ $RUNSERIAL $H5DIFF_BIN -v $infile $outfile
+ ) >$actual 2>$actual_err
+ RET=$?
+ if [ $RET != 0 ] ; then
+ echo "*FAILED*"
+ nerrors="`expr $nerrors + 1`"
+ else
+ echo " PASSED"
+ fi
+ fi
+
+ # display output compare
+ STDOUT_FILTER $actual
+ cat $actual_err >> $actual
+
+ VERIFY output from $H5REPACK $@
+ if cmp -s $expect $actual; then
+ echo " PASSED"
+ else
+ echo "*FAILED*"
+ echo " Expected result (*.tst) differs from actual result (*.out)"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && diff -c $expect $actual |sed 's/^/ /'
+ fi
+
+ rm -f $actual $actual_err
+ rm -f $outfile
+}
+
+# This is same as TOOLTESTSV() but expects a diff fail
+#
+TOOLFAILSV()
+{
+ expect="$TESTDIR/$1.$2.tst"
+ actual="$TESTDIR/`basename $2 .ddl`.out"
+ actual_err="$TESTDIR/`basename $2 .ddl`.err"
+
+ infile=$2
+ outfile=out-$1.$2
+ shift
+ shift
+
+ # Run test.
+ TESTING $H5REPACK $@
+ (
+ cd $TESTDIR
+ $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile
+ ) >$actual 2>$actual_err
+ RET=$?
+ if [ $RET != 0 ] ; then
+ echo "*FAILED*"
+ nerrors="`expr $nerrors + 1`"
+ else
+ echo " PASSED"
+ VERIFY h5diff unequal $@
+ (
+ cd $TESTDIR
+ $RUNSERIAL $H5DIFF_BIN -v $infile $outfile
+ ) >$actual 2>$actual_err
+ RET=$?
+ if [ $RET == 0 ] ; then
+ echo "*FAILED*"
+ nerrors="`expr $nerrors + 1`"
+ else
+ echo " PASSED"
+ fi
+ fi
+
+ # display output compare
+ STDOUT_FILTER $actual
+ cat $actual_err >> $actual
+
+ VERIFY output from $H5REPACK $@
+ if cmp -s $expect $actual; then
+ echo " PASSED"
+ else
+ echo "*FAILED*"
+ echo " Expected result (*.tst) differs from actual result (*.out)"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && diff -c $expect $actual |sed 's/^/ /'
+ fi
+
+ rm -f $actual $actual_err
+ rm -f $outfile
+}
+
# same as TOOLTESTV but filters error stack output and compares to an error file
# Extract file name, line number, version and thread IDs because they may be different
# ADD_H5ERR_MASK_TEST
@@ -1251,44 +1573,28 @@ TOOLTEST_STAT SPT $arg
# layout options (these files have no filters)
#########################################################
VERIFY_LAYOUT_DSET dset2_chunk_20x10 h5repack_layout.h5 dset2 CHUNKED --layout dset2:CHUNK=20x10
-
VERIFY_LAYOUT_ALL chunk_20x10 h5repack_layout.h5 CHUNKED -l CHUNK=20x10
-
VERIFY_LAYOUT_DSET dset2_conti h5repack_layout.h5 dset2 CONTIGUOUS -l dset2:CONTI
-
VERIFY_LAYOUT_ALL conti h5repack_layout.h5 CONTIGUOUS -l CONTI
-
VERIFY_LAYOUT_DSET dset2_compa h5repack_layout.h5 dset2 COMPACT -l dset2:COMPA
-
VERIFY_LAYOUT_ALL compa h5repack_layout.h5 COMPACT -l COMPA
-
TOOLTESTM dset2_chunk_20x10-errstk h5repack_layout.h5 --layout=dset2:CHUNK=20x10x5 --enable-error-stack
################################################################
# layout conversions (file has no filters)
###############################################################
-
VERIFY_LAYOUT_DSET dset_compa_conti h5repack_layout.h5 dset_compact CONTIGUOUS -l dset_compact:CONTI
-
VERIFY_LAYOUT_DSET dset_compa_chunk h5repack_layout.h5 dset_compact CHUNKED -l dset_compact:CHUNK=2x5
-
VERIFY_LAYOUT_DSET dset_compa_compa h5repack_layout.h5 dset_compact COMPACT -l dset_compact:COMPA
-
VERIFY_LAYOUT_DSET dset_conti_compa h5repack_layout.h5 dset_contiguous COMPACT -l dset_contiguous:COMPA
-
VERIFY_LAYOUT_DSET dset_conti_chunk h5repack_layout.h5 dset_contiguous CHUNKED -l dset_contiguous:CHUNK=3x6
-
VERIFY_LAYOUT_DSET dset_conti_conti h5repack_layout.h5 dset_contiguous CONTIGUOUS -l dset_contiguous:CONTI
-
VERIFY_LAYOUT_DSET chunk_compa h5repack_layout.h5 dset_chunk COMPACT -l dset_chunk:COMPA
-
VERIFY_LAYOUT_DSET chunk_conti h5repack_layout.h5 dset_chunk CONTIGUOUS -l dset_chunk:CONTI
-
VERIFY_LAYOUT_DSET chunk_18x13 h5repack_layout.h5 dset_chunk CHUNKED -l dset_chunk:CHUNK=18x13
# test convert small size dataset ( < 1k) to compact layout without -m
VERIFY_LAYOUT_DSET contig_small_compa h5repack_layout2.h5 contig_small COMPACT -l contig_small:COMPA
-
VERIFY_LAYOUT_DSET contig_small_fixed_compa h5repack_layout2.h5 chunked_small_fixed COMPACT -l chunked_small_fixed:COMPA
#---------------------------------------------------------------------------
@@ -1316,6 +1622,7 @@ VERIFY_LAYOUT_DSET chunk2compa h5repack_layout3.h5 chunk_unlimit1 CHUNK -l chunk
# chunk dim is bigger than dataset dim. ( dset size < 64k )
VERIFY_LAYOUT_DSET error1 h5repack_layout3.h5 chunk_unlimit1 H5S_UNLIMITED -f chunk_unlimit1:NONE
# chunk dim is bigger than dataset dim. ( dset size > 64k )
+
VERIFY_LAYOUT_DSET error2 h5repack_layout3.h5 chunk_unlimit2 H5S_UNLIMITED -f chunk_unlimit2:NONE
# chunk dims are smaller than dataset dims. ( dset size < 64k )
@@ -1330,7 +1637,6 @@ TOOLTEST error4 h5repack_layout3.h5 -f NONE
# (dset size < 64K) and with unlimited max dims on a condition as follow.
# (HDFFV-8214)
#--------------------------------------------------------------------------
-
# chunk dim is bigger than dataset dim. should succeed.
VERIFY_LAYOUT_DSET ckdim_biger h5repack_layout3.h5 chunk_unlimit2 CONTI -l chunk_unlimit2:CONTI
# chunk dim is smaller than dataset dim. should succeed.
@@ -1361,7 +1667,6 @@ else
fi
# several global filters
-
arg="h5repack_layout.h5 --filter GZIP=1 --filter SHUF"
if test $USE_FILTER_DEFLATE != "yes" ; then
SKIP $arg
@@ -1408,16 +1713,24 @@ TOOLTEST1 family tfamily%05d.h5
TOOLTEST bug1814 h5repack_refs.h5
# test attribute with various references (bug1797 / HDFFV-5932)
-# the references in attribute of compund or vlen datatype
+# the references in attribute of compound or vlen datatype
TOOLTEST HDFFV-5932 h5repack_attr_refs.h5
-# Add test for memory leak in attirbute. This test is verified by CTEST.
+# Add test for memory leak in attribute. This test is verified by CTEST.
# 1. leak from vlen string
# 2. leak from compound type without reference member
# (HDFFV-7840, )
# Note: this test is experimental for sharing test file among tools
TOOLTEST HDFFV-7840 h5diff_attr1.h5
+# test HDFFV-10590
+arg="h5repack_CVE-2018-17432.h5 h5repack_CVE-2018-17432_out.h5 --low=1 --high=2 -f GZIP=8 -l dset1:CHUNK=5x6"
+TOOLTEST_FAIL $arg
+
+# test HDFFV-11223
+arg="h5repack_CVE-2018-14460.h5 h5repack_CVE-2018-14460_out.h5"
+TOOLTEST_FAIL $arg
+
# tests for metadata block size option
TOOLTEST_META meta_short h5repack_layout.h5 -M 8192
TOOLTEST_META meta_long h5repack_layout.h5 --metadata_block_size=8192
@@ -1457,9 +1770,15 @@ else
VERIFY_LAYOUT_VDS vds_conti 4_vds.h5 vds_dset CONTIGUOUS -l vds_dset:CONTI
fi
-#########################################################
-# Testing version bounds
-#########################################################
+################################################################
+# reference new api conversions
+###############################################################
+#TOOLTEST_DUMP attrregion tattrreg.h5
+#TOOLTEST_DUMP dataregion tdatareg.h5
+
+##############################################################################
+### V E R S I O N B O U N D S T E S T S
+##############################################################################
# -j 0 -k 2, superblock will be 0
VERIFY_SUPERBLOCK 0 2 0 h5repack_layout.h5 -j 0 -k 2 h5repack_layout.h5
# -j 1 -k 2, superblock will be 2
@@ -1469,6 +1788,49 @@ VERIFY_SUPERBLOCK 2 2 3 h5repack_layout.h5 -j 2 -k 2 h5repack_layout.h5
# -j 0 -k 1, file cannot be opened
VERIFY_INVALIDBOUNDS 0 1 bounds_latest_latest.h5
+##############################################################################
+### E X T E R N A L S T O R A G E T E S T S
+##############################################################################
+VERIFY_EXTERNAL_CONSOLIDATION -l CONTI
+
+##############################################################################
+### E X T E R N A L L I N K T E S T S
+##############################################################################
+### HDFFV-11128 needs fixed to enable the following test
+#TOOLTEST_DUMP h5copy_extlinks_src-base h5copy_extlinks_src.h5 --enable-error-stack
+TOOLTEST_DUMP tsoftlinks-base tsoftlinks.h5 --enable-error-stack
+TOOLTEST_DUMP textlink-base textlink.h5 --enable-error-stack
+TOOLTEST_DUMP textlinkfar-base textlinkfar.h5 --enable-error-stack
+TOOLTEST_DUMP textlinksrc-base textlinksrc.h5 --enable-error-stack
+TOOLTEST_DUMP textlinktar-base textlinktar.h5 --enable-error-stack
+
+TOOLTESTSV h5copy_extlinks_src-merge h5copy_extlinks_src.h5 --merge
+TOOLFAILSV tsoftlinks-merge tsoftlinks.h5 --merge
+TOOLTESTSV textlink-merge textlink.h5 --merge
+### HDFFV-11128 needs fixed to enable the following test
+#TOOLFAILSV textlinkfar-merge textlinkfar.h5 --merge
+### HDFFV-11128 needs fixed to enable the following test
+#TOOLFAILSV textlinksrc-merge textlinksrc.h5 --merge
+### HDFFV-11128 needs fixed to enable the following test
+#TOOLFAILSV textlinktar-merge textlinktar.h5 --merge
+
+TOOLTEST_DUMP h5copy_extlinks_src-prune h5copy_extlinks_src.h5 --prune --enable-error-stack
+TOOLTEST_DUMP tsoftlinks-prune tsoftlinks.h5 --prune --enable-error-stack
+TOOLTEST_DUMP textlink-prune textlink.h5 --prune --enable-error-stack
+TOOLTEST_DUMP textlinkfar-prune textlinkfar.h5 --prune --enable-error-stack
+TOOLTEST_DUMP textlinksrc-prune textlinksrc.h5 --prune --enable-error-stack
+TOOLTEST_DUMP textlinktar-prune textlinktar.h5 --prune --enable-error-stack
+
+TOOLTEST_DUMP h5copy_extlinks_src-mergeprune h5copy_extlinks_src.h5 --merge --prune --enable-error-stack
+TOOLTEST_DUMP tsoftlinks-mergeprune tsoftlinks.h5 --merge --prune --enable-error-stack
+TOOLTEST_DUMP textlink-mergeprune textlink.h5 --merge --prune --enable-error-stack
+### HDFFV-11128 needs fixed to enable the following test
+#TOOLTEST_DUMP textlinkfar-mergeprune textlinkfar.h5 --merge --prune --enable-error-stack
+### HDFFV-11128 needs fixed to enable the following test
+#TOOLTEST_DUMP textlinksrc-mergeprune textlinksrc.h5 --merge --prune --enable-error-stack
+### HDFFV-11128 needs fixed to enable the following test
+#TOOLTEST_DUMP textlinktar-mergeprune textlinktar.h5 --merge --prune --enable-error-stack
+
# Clean up temporary files/directories
CLEAN_TESTFILES_AND_TESTDIR
diff --git a/tools/test/h5repack/h5repack_plugin.sh.in b/tools/test/h5repack/h5repack_plugin.sh.in
index 5efd9e8..0331d85 100644
--- a/tools/test/h5repack/h5repack_plugin.sh.in
+++ b/tools/test/h5repack/h5repack_plugin.sh.in
@@ -6,7 +6,7 @@
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# distribution tree, or in https://www.hdfgroup.org/licenses.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
diff --git a/tools/test/h5repack/h5repackgentest.c b/tools/test/h5repack/h5repackgentest.c
new file mode 100644
index 0000000..c025891
--- /dev/null
+++ b/tools/test/h5repack/h5repackgentest.c
@@ -0,0 +1,350 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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 COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* For generating files for verifying h5repack with external storage. . .
+ *
+ * Each case file should follow the format of:
+ * + h5repack_<NAME>.h5
+ * + h5repack_<NAME>_ex.h5
+ * + h5repack_<NAME>_ex-<N>.dat
+ * ...where NAME idenfities the type, and N is a positive decimal number;
+ * multiple external files (*.dat) are allowed per file, but they must
+ * follow the pattern and be in contiguous numerical sequence starting at 0.
+ *
+ * Each file typename must be added to the listing for
+ * `VERIFY_EXTERNAL_CONSOLIDATION` in h5repack.sh
+ *
+ * There is no restriction on the name, number, or structure of datasets and
+ * groups in HDF5 file.
+ *
+ * The included datatypes should be more than adequate to verify the correctness
+ * of the behavior -- if one type can be consolidated from external storage,
+ * then they all can.
+ */
+
+#include "hdf5.h"
+#include "H5private.h"
+
+#define MAX_NAME_SIZE 256
+#define FILE_INT32LE_1 "h5repack_int32le_1d"
+#define FILE_INT32LE_2 "h5repack_int32le_2d"
+#define FILE_INT32LE_3 "h5repack_int32le_3d"
+#define FILE_UINT8BE "h5repack_uint8be"
+#define FILE_F32LE "h5repack_f32le"
+
+#define H5REPACKGENTEST_OOPS \
+ { \
+ ret_value = -1; \
+ goto done; \
+ }
+
+#define H5REPACKGENTEST_COMMON_CLEANUP(dcpl, file, space) \
+ { \
+ if ((dcpl) != H5P_DEFAULT && (dcpl) != H5I_INVALID_HID) { \
+ (void)H5Pclose((dcpl)); \
+ } \
+ if ((file) != H5I_INVALID_HID) { \
+ (void)H5Fclose((file)); \
+ } \
+ if ((space) != H5I_INVALID_HID) { \
+ (void)H5Sclose((space)); \
+ } \
+ }
+
+struct external_def {
+ hsize_t type_size;
+ unsigned n_elts_per_file;
+ unsigned n_elts_total;
+};
+
+/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ * Helper function to create and write a dataset to file.
+ * Returns 0 on success, -1 on failure.
+ */
+static int
+make_dataset(hid_t file_id, const char *dset_name, hid_t mem_type_id, hid_t space_id, hid_t dcpl_id,
+ void *wdata)
+{
+ hid_t dset_id = H5I_INVALID_HID;
+ int ret_value = 0;
+
+ dset_id = H5Dcreate2(file_id, dset_name, mem_type_id, space_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT);
+ if (dset_id == H5I_INVALID_HID)
+ H5REPACKGENTEST_OOPS;
+
+ if (H5Dwrite(dset_id, mem_type_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata) < 0)
+ H5REPACKGENTEST_OOPS;
+
+done:
+ if (dset_id != H5I_INVALID_HID)
+ (void)H5Dclose(dset_id);
+
+ return ret_value;
+} /* end make_dataset() */
+
+/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ * Helper function to populate the DCPL external storage list.
+ * Creates external files for the DCPL, with each file name following the
+ * convention "<filename>_ex-<num>.dat". Will append `n_external_files` to
+ * the filename list, with each file having space for `n_elts` items of the
+ * type (of size `elt_size`). The numeric inputs are not sanity-checked.
+ * Returns 0 on success, -1 on failure.
+ */
+static int
+set_dcpl_external_list(hid_t dcpl, const char *filename, unsigned n_elts_per_file, unsigned n_elts_total,
+ hsize_t elt_size)
+{
+ char name[MAX_NAME_SIZE];
+ unsigned n_external_files = 0;
+ unsigned i = 0;
+
+ if (NULL == filename || '\0' == *filename)
+ return -1;
+
+ n_external_files = n_elts_total / n_elts_per_file;
+ if (n_elts_total != (n_external_files * n_elts_per_file))
+ return -1;
+
+ for (i = 0; i < n_external_files; i++) {
+ if (HDsnprintf(name, MAX_NAME_SIZE, "%s_ex-%u.dat", filename, i) >= MAX_NAME_SIZE)
+ return -1;
+
+ if (H5Pset_external(dcpl, name, 0, n_elts_per_file * elt_size) < 0)
+ return -1;
+ }
+ return 0;
+} /* end set_dcpl_external_list() */
+
+/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ * Generalized utility function to write a file with the specified data and
+ * dataset configuration. If `ext` is provided, will attempt to use external
+ * storage.
+ * Returns 0 on success, -1 on failure.
+ */
+static int
+make_file(const char *basename, struct external_def *ext, hid_t type_id, hsize_t rank, hsize_t *dims,
+ void *wdata)
+{
+ char filename[MAX_NAME_SIZE];
+ hid_t file_id = H5I_INVALID_HID;
+ hid_t dcpl_id = H5P_DEFAULT;
+ hid_t space_id = H5I_INVALID_HID;
+ int ret_value = 0;
+
+ if (HDsnprintf(filename, MAX_NAME_SIZE, "%s%s.h5", basename, (NULL != ext) ? "_ex" : "") >= MAX_NAME_SIZE)
+ H5REPACKGENTEST_OOPS;
+
+ if (NULL != ext) {
+ dcpl_id = H5Pcreate(H5P_DATASET_CREATE);
+ if (dcpl_id == H5I_INVALID_HID)
+ H5REPACKGENTEST_OOPS;
+
+ if (set_dcpl_external_list(dcpl_id, basename, ext->n_elts_per_file, ext->n_elts_total,
+ ext->type_size) < 0)
+ H5REPACKGENTEST_OOPS;
+ }
+
+ space_id = H5Screate_simple((int)rank, dims, NULL);
+ if (space_id == H5I_INVALID_HID)
+ H5REPACKGENTEST_OOPS;
+
+ file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ if (file_id == H5I_INVALID_HID)
+ H5REPACKGENTEST_OOPS;
+
+ if (make_dataset(file_id, "dset", type_id, space_id, dcpl_id, wdata) < 0)
+ H5REPACKGENTEST_OOPS;
+
+done:
+ H5REPACKGENTEST_COMMON_CLEANUP(dcpl_id, file_id, space_id);
+ return ret_value;
+} /* end make_file() */
+
+/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ * Returns 0 on success, -1 on failure.
+ */
+static int
+generate_int32le_1d(hbool_t external)
+{
+ int32_t wdata[12];
+ hsize_t dims[] = {12};
+ struct external_def *def_ptr = NULL;
+ struct external_def def = {(hsize_t)sizeof(int32_t), 6, 12};
+ int32_t n = 0;
+ int ret_value = 0;
+
+ /* Generate values
+ */
+ for (n = 0; n < 12; n++) {
+ wdata[n] = n - 6;
+ }
+
+ def_ptr = (TRUE == external) ? (&def) : NULL;
+ if (make_file(FILE_INT32LE_1, def_ptr, H5T_STD_I32LE, 1, dims, wdata) < 0)
+ ret_value = -1;
+
+ return ret_value;
+} /* end generate_int32le_1d() */
+
+/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ * Returns 0 on success, -1 on failure.
+ */
+static int
+generate_int32le_2d(hbool_t external)
+{
+ int32_t wdata[64];
+ hsize_t dims[] = {8, 8};
+ struct external_def *def_ptr = NULL;
+ struct external_def def = {(hsize_t)sizeof(int32_t), 64, 64};
+ int32_t n = 0;
+ int ret_value = 0;
+
+ /* Generate values
+ */
+ for (n = 0; n < 64; n++) {
+ wdata[n] = n - 32;
+ }
+
+ def_ptr = (TRUE == external) ? (&def) : NULL;
+ if (make_file(FILE_INT32LE_2, def_ptr, H5T_STD_I32LE, 2, dims, wdata) < 0)
+ ret_value = -1;
+
+ return ret_value;
+} /* end generate_int32le_2d() */
+
+/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ * Returns 0 on success, -1 on failure.
+ */
+static int
+generate_int32le_3d(hbool_t external)
+{
+ hsize_t dims[] = {8, 8, 8};
+ int32_t wdata[512]; /* 8^3, from dims */
+ struct external_def *def_ptr = NULL;
+ struct external_def def = {(hsize_t)sizeof(int32_t), 512, 512};
+ int32_t n = 0;
+ int i = 0;
+ int j = 0;
+ int k = 0;
+ int ret_value = 0;
+
+ /* generate values, alternating positive and negative
+ */
+ for (i = 0, n = 0; (hsize_t)i < dims[0]; i++) {
+ for (j = 0; (hsize_t)j < dims[1]; j++) {
+ for (k = 0; (hsize_t)k < dims[2]; k++, n++) {
+ wdata[n] = (k + j * 512 + i * 4096) * ((n & 1) ? (-1) : (1));
+ }
+ }
+ }
+
+ def_ptr = (TRUE == external) ? (&def) : NULL;
+ if (make_file(FILE_INT32LE_3, def_ptr, H5T_STD_I32LE, 3, dims, wdata) < 0)
+ ret_value = -1;
+
+ return ret_value;
+} /* end generate_int32le_3d() */
+
+/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ * Returns 0 on success, -1 on failure.
+ */
+static int
+generate_uint8be(hbool_t external)
+{
+ hsize_t dims[] = {4, 8, 8};
+ uint8_t wdata[256]; /* 4*8*8, from dims */
+ struct external_def *def_ptr = NULL;
+ struct external_def def = {(hsize_t)sizeof(uint8_t), 64, 256};
+ uint8_t n = 0;
+ int i = 0;
+ int j = 0;
+ int k = 0;
+ int ret_value = 0;
+
+ /* Generate values, ping-pong from ends of range
+ */
+ for (i = 0, n = 0; (hsize_t)i < dims[0]; i++) {
+ for (j = 0; (hsize_t)j < dims[1]; j++) {
+ for (k = 0; (hsize_t)k < dims[2]; k++, n++) {
+ wdata[n] = (uint8_t)((n & 1) ? -n : n);
+ }
+ }
+ }
+
+ def_ptr = (TRUE == external) ? (&def) : NULL;
+ if (make_file(FILE_UINT8BE, def_ptr, H5T_STD_U8BE, 3, dims, wdata) < 0)
+ ret_value = -1;
+
+ return ret_value;
+} /* end generate_uint8be() */
+
+/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ * Returns 0 on success, -1 on failure.
+ */
+static int
+generate_f32le(hbool_t external)
+{
+ hsize_t dims[] = {12, 6};
+ float wdata[72]; /* 12*6, from dims */
+ struct external_def *def_ptr = NULL;
+ struct external_def def = {(hsize_t)sizeof(float), 72, 72};
+ float n = 0;
+ int i = 0;
+ int j = 0;
+ int k = 0;
+ int ret_value = 0;
+
+ /* Generate values */
+ for (i = 0, k = 0, n = 0; (hsize_t)i < dims[0]; i++) {
+ for (j = 0; (hsize_t)j < dims[1]; j++, k++, n++) {
+ wdata[k] = n * 801.1F * ((k % 5 == 1) ? (-1) : (1));
+ }
+ }
+
+ def_ptr = (TRUE == external) ? (&def) : NULL;
+ if (make_file(FILE_F32LE, def_ptr, H5T_IEEE_F32LE, 2, dims, wdata) < 0)
+ ret_value = -1;
+
+ return ret_value;
+} /* end generate_f32le() */
+
+/* ----------------------------------------------------------------------------
+ * Create files.
+ * Return 0 on success, nonzero on failure.
+ */
+int
+main(void)
+{
+ int i = 0;
+
+ for (i = 0; i < 2; i++) {
+ hbool_t external = (i & 1) ? TRUE : FALSE;
+ if (generate_int32le_1d(external) < 0)
+ HDprintf("A generate_int32le_1d failed!\n");
+
+ if (generate_int32le_2d(external) < 0)
+ HDprintf("A generate_int32le_2d failed!\n");
+
+ if (generate_int32le_3d(external) < 0)
+ HDprintf("A generate_int32le_3d failed!\n");
+
+ if (generate_uint8be(external) < 0)
+ HDprintf("A generate_uint8be failed!\n");
+
+ if (generate_f32le(external) < 0)
+ HDprintf("A generate_f32le failed!\n");
+
+ } /* end for external data storage or not */
+
+ return EXIT_SUCCESS;
+} /* end main() */
diff --git a/tools/test/h5repack/h5repacktst.c b/tools/test/h5repack/h5repacktst.c
index ec8df3c..8b114e4 100644
--- a/tools/test/h5repack/h5repacktst.c
+++ b/tools/test/h5repack/h5repacktst.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -17,39 +17,42 @@
#include "h5tools.h"
#include "h5tools_utils.h"
-#define GOERROR {H5_FAILED(); goto error;}
-
+#define GOERROR \
+ { \
+ H5_FAILED(); \
+ goto error; \
+ }
/* fill value test */
-#define FNAME0 "h5repack_fill.h5"
-#define FNAME0OUT "h5repack_fill_out.h5"
+#define FNAME0 "h5repack_fill.h5"
+#define FNAME0OUT "h5repack_fill_out.h5"
/* HDF5 objects and all dataset datatypes */
-#define FNAME1 "h5repack_objs.h5"
-#define FNAME1OUT "h5repack_objs_out.h5"
+#define FNAME1 "h5repack_objs.h5"
+#define FNAME1OUT "h5repack_objs_out.h5"
/* attributes, all datatypes */
-#define FNAME2 "h5repack_attr.h5"
-#define FNAME2OUT "h5repack_attr_out.h5"
+#define FNAME2 "h5repack_attr.h5"
+#define FNAME2OUT "h5repack_attr_out.h5"
/* hard links */
-#define FNAME3 "h5repack_hlink.h5"
-#define FNAME3OUT "h5repack_hlink_out.h5"
+#define FNAME3 "h5repack_hlink.h5"
+#define FNAME3OUT "h5repack_hlink_out.h5"
/* layout */
-#define FNAME4 "h5repack_layout.h5"
-#define FNAME4OUT "h5repack_layout_out.h5"
+#define FNAME4 "h5repack_layout.h5"
+#define FNAME4OUT "h5repack_layout_out.h5"
/* H5D_ALLOC_TIME_EARLY */
-#define FNAME5 "h5repack_early.h5"
-#define FNAME5OUT "h5repack_early_out.h5"
-#define FNAME6 "h5repack_early2.h5"
+#define FNAME5 "h5repack_early.h5"
+#define FNAME5OUT "h5repack_early_out.h5"
+#define FNAME6 "h5repack_early2.h5"
#ifdef H5_HAVE_FILTER_SZIP
/* SZIP filter */
-#define FNAME7 "h5repack_szip.h5"
-#define FNAME7OUT "h5repack_szip_out.h5"
+#define FNAME7 "h5repack_szip.h5"
+#define FNAME7OUT "h5repack_szip_out.h5"
#endif
/* GZIP filter */
-#define FNAME8 "h5repack_deflate.h5"
-#define FNAME8OUT "h5repack_deflate_out.h5"
+#define FNAME8 "h5repack_deflate.h5"
+#define FNAME8OUT "h5repack_deflate_out.h5"
/* GZIP filter */
-#define FNAME9 "h5repack_shuffle.h5"
-#define FNAME9OUT "h5repack_shuffle_out.h5"
+#define FNAME9 "h5repack_shuffle.h5"
+#define FNAME9OUT "h5repack_shuffle_out.h5"
/* Fletcher filter */
#define FNAME10 "h5repack_fletcher.h5"
#define FNAME10OUT "h5repack_fletcher_out.h5"
@@ -72,58 +75,55 @@
#define FNAME16 "h5repack_ub.h5"
#define FNAME16OUT "h5repack_ub_out.h5"
/* Named datatypes */
-#define FNAME17 "h5repack_named_dtypes.h5"
-#define FNAME17OUT "h5repack_named_dtypes_out.h5"
+#define FNAME17 "h5repack_named_dtypes.h5"
+#define FNAME17OUT "h5repack_named_dtypes_out.h5"
-#define FNAME18 "h5repack_layout2.h5"
+#define FNAME18 "h5repack_layout2.h5"
/* Files for testing file space paging */
-#define FSPACE_OUT "h5repack_fspace_OUT.h5" /* The output file */
-#define NELMTS(X) (sizeof(X)/sizeof(X[0])) /* # of elements */
+#define FSPACE_OUT "h5repack_fspace_OUT.h5" /* The output file */
+#define NELMTS(X) (sizeof(X) / sizeof(X[0])) /* # of elements */
const char *H5REPACK_FSPACE_FNAMES[] = {
- "h5repack_latest.h5", /* 0 */
- "h5repack_default.h5", /* 1 */
- "h5repack_page_persist.h5", /* 2 */
- "h5repack_fsm_aggr_persist.h5", /* 3 */
- "h5repack_page_threshold.h5", /* 4 */
- "h5repack_fsm_aggr_threshold.h5", /* 5 */
- "h5repack_aggr.h5", /* 6 */
- "h5repack_none.h5" /* 7 */
+ "h5repack_latest.h5", /* 0 */
+ "h5repack_default.h5", /* 1 */
+ "h5repack_page_persist.h5", /* 2 */
+ "h5repack_fsm_aggr_persist.h5", /* 3 */
+ "h5repack_page_threshold.h5", /* 4 */
+ "h5repack_fsm_aggr_threshold.h5", /* 5 */
+ "h5repack_aggr.h5", /* 6 */
+ "h5repack_none.h5" /* 7 */
};
-#define FNAME_UB "ublock.bin"
+#define FNAME_UB "ublock.bin"
/* obj and region references */
-#define FNAME_REF "h5repack_refs.h5"
+#define FNAME_REF "h5repack_refs.h5"
/* obj and region references in attr of compound and vlen type */
-#define FNAME_ATTR_REF "h5repack_attr_refs.h5"
+#define FNAME_ATTR_REF "h5repack_attr_refs.h5"
-const char *H5REPACK_FILENAMES[] = {
- "h5repack_big_out",
- NULL
-};
+const char *H5REPACK_FILENAMES[] = {"h5repack_big_out", NULL};
#define H5REPACK_EXTFILE "h5repack_ext.bin"
/* Name of tool */
#define PROGRAMNAME "h5repacktst"
-#define DIM1 40
-#define DIM2 20
-#define CDIM1 DIM1/2
-#define CDIM2 DIM2/2
-#define RANK 2
+#define DIM1 40
+#define DIM2 20
+#define CDIM1 (DIM1 / 2)
+#define CDIM2 (DIM2 / 2)
+#define RANK 2
/* Size of userblock (for userblock test) */
-#define USERBLOCK_SIZE 2048
+#define USERBLOCK_SIZE 2048
/* obj and region references */
-#define NAME_OBJ_DS1 "Dset1"
-#define NAME_OBJ_GRP "Group"
+#define NAME_OBJ_DS1 "Dset1"
+#define NAME_OBJ_GRP "Group"
#define NAME_OBJ_NDTYPE "NamedDatatype"
-#define NAME_OBJ_DS2 "Dset2"
-#define REG_REF_DS1 "Dset_REGREF"
+#define NAME_OBJ_DS2 "Dset2"
+#define REG_REF_DS1 "Dset_REGREF"
/*-------------------------------------------------------------------------
* prototypes
@@ -148,21 +148,20 @@ static int make_all_filters(hid_t loc_id);
static int make_fill(hid_t loc_id);
static int make_big(hid_t loc_id);
static int make_testfiles(void);
-static int write_dset_in(hid_t loc_id,const char* dset_name,hid_t file_id,int make_diffs );
-static int write_attr_in(hid_t loc_id,const char* dset_name,hid_t fid,int make_diffs );
-static int write_dset(hid_t loc_id,int rank,hsize_t *dims,const char *dset_name,hid_t tid,void *buf );
-static int make_dset(hid_t loc_id,const char *name,hid_t sid,hid_t dcpl,void *buf);
-static int make_attr(hid_t loc_id,int rank,hsize_t *dims,const char *attr_name,hid_t tid,void *buf);
+static int write_dset_in(hid_t loc_id, const char *dset_name, hid_t file_id, int make_diffs);
+static int write_attr_in(hid_t loc_id, const char *dset_name, hid_t fid, int make_diffs);
+static int write_dset(hid_t loc_id, int rank, hsize_t *dims, const char *dset_name, hid_t tid, void *buf);
+static int make_dset(hid_t loc_id, const char *name, hid_t sid, hid_t dcpl, void *buf);
+static int make_attr(hid_t loc_id, int rank, hsize_t *dims, const char *attr_name, hid_t tid, void *buf);
static int make_dset_reg_ref(hid_t loc_id);
static int make_external(hid_t loc_id);
static int make_userblock(void);
-static int verify_userblock( const char* filename);
+static int verify_userblock(const char *filename);
static int make_userblock_file(void);
static int make_named_dtype(hid_t loc_id);
static int make_references(hid_t loc_id);
static int make_complex_attr_references(hid_t loc_id);
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -173,18 +172,19 @@ static int make_complex_attr_references(hid_t loc_id);
*-------------------------------------------------------------------------
*/
-int main (void)
+int
+main(void)
{
- pack_opt_t pack_options;
- diff_opt_t diff_options;
+ pack_opt_t pack_options;
+ diff_opt_t diff_options;
- unsigned j; /* Local index variable for testing file space */
- const char *fname; /* File name for testing file space */
+ unsigned j; /* Local index variable for testing file space */
+ const char *fname; /* File name for testing file space */
- h5_stat_t file_stat;
- h5_stat_size_t fsize1, fsize2; /* file sizes */
-#if defined (H5_HAVE_FILTER_SZIP)
- int szip_can_encode = 0;
+ h5_stat_t file_stat;
+ h5_stat_size_t fsize1, fsize2; /* file sizes */
+#if defined(H5_HAVE_FILTER_SZIP)
+ int szip_can_encode = 0;
#endif
h5tools_setprogname(PROGRAMNAME);
@@ -194,8 +194,8 @@ int main (void)
h5tools_init();
/* initialize */
- HDmemset(&diff_options, 0, sizeof (diff_opt_t));
- HDmemset(&pack_options, 0, sizeof (pack_opt_t));
+ HDmemset(&diff_options, 0, sizeof(diff_opt_t));
+ HDmemset(&pack_options, 0, sizeof(pack_opt_t));
/* run tests */
puts("Testing h5repack:");
@@ -218,155 +218,154 @@ int main (void)
*-------------------------------------------------------------------------
*/
TESTING(" files with file space info setting--no options (-S, -P, -T, -G) are set");
- j = 0; /* #0 */
+ j = 0; /* #0 */
HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
fname = H5REPACK_FSPACE_FNAMES[j];
- if(h5repack_init(&pack_options, 0, FALSE) < 0)
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
- if(h5repack(fname, FSPACE_OUT, &pack_options) < 0)
+ if (h5repack(fname, FSPACE_OUT, &pack_options) < 0)
GOERROR;
- if(h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0)
+ if (h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if(h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0)
+ if (h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0)
GOERROR;
- if(h5repack_end(&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
-
TESTING(" files with file space info setting--all options -S, -P, -T, -G are set");
- ++j; /* #1 */
+ ++j; /* #1 */
HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
fname = H5REPACK_FSPACE_FNAMES[j];
- if(h5repack_init(&pack_options, 0, FALSE) < 0)
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
- pack_options.fs_strategy = H5F_FSPACE_STRATEGY_NONE;
- pack_options.fs_persist = -1; /* "FALSE" is set via -P 0 */
+ pack_options.fs_strategy = H5F_FSPACE_STRATEGY_NONE;
+ pack_options.fs_persist = -1; /* "FALSE" is set via -P 0 */
pack_options.fs_threshold = 1;
- pack_options.fs_pagesize = 8192;
- if(h5repack(fname, FSPACE_OUT, &pack_options) < 0)
+ pack_options.fs_pagesize = 8192;
+ if (h5repack(fname, FSPACE_OUT, &pack_options) < 0)
GOERROR;
- if(h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0)
+ if (h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if(h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0)
+ if (h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0)
GOERROR;
- if(h5repack_end(&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
-
TESTING(" files with file space info setting--options -S and -T are set");
- ++j; /* #2 */
+ ++j; /* #2 */
HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
fname = H5REPACK_FSPACE_FNAMES[j];
- if(h5repack_init(&pack_options, 0, FALSE) < 0)
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
- pack_options.fs_strategy = (H5F_fspace_strategy_t)-1; /* "FSM_AGGR" specified via -S FSM_AGGR */
- pack_options.fs_threshold = -1; /* "0" specified via -T 0 */
- if(h5repack(fname, FSPACE_OUT, &pack_options) < 0)
+ pack_options.fs_strategy = (H5F_fspace_strategy_t)-1; /* "FSM_AGGR" specified via -S FSM_AGGR */
+ pack_options.fs_threshold = -1; /* "0" specified via -T 0 */
+ if (h5repack(fname, FSPACE_OUT, &pack_options) < 0)
GOERROR;
- if(h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0)
+ if (h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if(h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0)
+ if (h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0)
GOERROR;
- if(h5repack_end(&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
+ if (h5_using_default_driver(NULL)) {
+ TESTING(" files with file space info setting-- options -S and -P are set & -L");
+ ++j; /* #3 */
+ HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
+ fname = H5REPACK_FSPACE_FNAMES[j];
+ if (h5repack_init(&pack_options, 0, TRUE) < 0)
+ GOERROR;
+ pack_options.fs_strategy = H5F_FSPACE_STRATEGY_PAGE; /* "PAGE" specified via -S */
+ pack_options.fs_persist = TRUE;
+ if (h5repack(fname, FSPACE_OUT, &pack_options) < 0)
+ GOERROR;
+ if (h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0)
+ GOERROR;
+ if (h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0)
+ GOERROR;
+ if (h5repack_end(&pack_options) < 0)
+ GOERROR;
+ PASSED();
- TESTING(" files with file space info setting-- options -S and -P are set & -L");
- ++j; /* #3 */
- HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
- fname = H5REPACK_FSPACE_FNAMES[j];
- if(h5repack_init(&pack_options, 0, TRUE) < 0)
- GOERROR;
- pack_options.fs_strategy = H5F_FSPACE_STRATEGY_PAGE; /* "PAGE" specified via -S */
- pack_options.fs_persist = TRUE;
- if(h5repack(fname, FSPACE_OUT, &pack_options) < 0)
- GOERROR;
- if(h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0)
- GOERROR;
- if(h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0)
- GOERROR;
- if(h5repack_end(&pack_options) < 0)
- GOERROR;
- PASSED();
-
- TESTING(" files with file space info setting-- options -P and -T are set & -L");
- ++j; /* #4 */
- HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
- fname = H5REPACK_FSPACE_FNAMES[j];
- if(h5repack_init(&pack_options, 0, TRUE) < 0)
- GOERROR;
- pack_options.fs_persist = -1; /* "FALSE" is set via -P 0 */
- pack_options.fs_threshold = 2;
- if(h5repack(fname, FSPACE_OUT, &pack_options) < 0)
- GOERROR;
- if(h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0)
- GOERROR;
- if(h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0)
- GOERROR;
- if(h5repack_end(&pack_options) < 0)
- GOERROR;
- PASSED();
+ TESTING(" files with file space info setting-- options -P and -T are set & -L");
+ ++j; /* #4 */
+ HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
+ fname = H5REPACK_FSPACE_FNAMES[j];
+ if (h5repack_init(&pack_options, 0, TRUE) < 0)
+ GOERROR;
+ pack_options.fs_persist = -1; /* "FALSE" is set via -P 0 */
+ pack_options.fs_threshold = 2;
+ if (h5repack(fname, FSPACE_OUT, &pack_options) < 0)
+ GOERROR;
+ if (h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0)
+ GOERROR;
+ if (h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0)
+ GOERROR;
+ if (h5repack_end(&pack_options) < 0)
+ GOERROR;
+ PASSED();
- TESTING(" files with file space info setting-- options -S and -G are set & -L");
- ++j; /* #5 */
- HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
- fname = H5REPACK_FSPACE_FNAMES[j];
- if(h5repack_init(&pack_options, 0, TRUE) < 0)
- GOERROR;
- pack_options.fs_strategy = H5F_FSPACE_STRATEGY_PAGE;
- pack_options.fs_pagesize = 8192;
- if(h5repack(fname, FSPACE_OUT, &pack_options) < 0)
- GOERROR;
- if(h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0)
- GOERROR;
- if(h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0)
- GOERROR;
- if(h5repack_end(&pack_options) < 0)
- GOERROR;
- PASSED();
+ TESTING(" files with file space info setting-- options -S and -G are set & -L");
+ ++j; /* #5 */
+ HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
+ fname = H5REPACK_FSPACE_FNAMES[j];
+ if (h5repack_init(&pack_options, 0, TRUE) < 0)
+ GOERROR;
+ pack_options.fs_strategy = H5F_FSPACE_STRATEGY_PAGE;
+ pack_options.fs_pagesize = 8192;
+ if (h5repack(fname, FSPACE_OUT, &pack_options) < 0)
+ GOERROR;
+ if (h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0)
+ GOERROR;
+ if (h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0)
+ GOERROR;
+ if (h5repack_end(&pack_options) < 0)
+ GOERROR;
+ PASSED();
- TESTING(" files with file space info setting-- options -S, -P, -T, -G are set");
- ++j; /* #6 */
- HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
- fname = H5REPACK_FSPACE_FNAMES[j];
- if(h5repack_init(&pack_options, 0, FALSE) < 0)
- GOERROR;
- pack_options.fs_strategy = H5F_FSPACE_STRATEGY_NONE;
- pack_options.fs_persist = -1; /* "FALSE" is set via -P 0 */
- pack_options.fs_threshold = 1;
- pack_options.fs_pagesize = 8192;
- if(h5repack(fname, FSPACE_OUT, &pack_options) < 0)
- GOERROR;
- if(h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0)
- GOERROR;
- if(h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0)
- GOERROR;
- if(h5repack_end(&pack_options) < 0)
- GOERROR;
- PASSED();
+ TESTING(" files with file space info setting-- options -S, -P, -T, -G are set");
+ ++j; /* #6 */
+ HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
+ fname = H5REPACK_FSPACE_FNAMES[j];
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
+ GOERROR;
+ pack_options.fs_strategy = H5F_FSPACE_STRATEGY_NONE;
+ pack_options.fs_persist = -1; /* "FALSE" is set via -P 0 */
+ pack_options.fs_threshold = 1;
+ pack_options.fs_pagesize = 8192;
+ if (h5repack(fname, FSPACE_OUT, &pack_options) < 0)
+ GOERROR;
+ if (h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0)
+ GOERROR;
+ if (h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0)
+ GOERROR;
+ if (h5repack_end(&pack_options) < 0)
+ GOERROR;
+ PASSED();
- TESTING(" files with file space info setting-- options -S, -T, -G are set & -L");
- ++j; /* #7 */
- HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
- fname = H5REPACK_FSPACE_FNAMES[j];
- if(h5repack_init(&pack_options, 0, TRUE) < 0)
- GOERROR;
- pack_options.fs_strategy = H5F_FSPACE_STRATEGY_AGGR;
- pack_options.fs_threshold = 1;
- pack_options.fs_pagesize = 4096;
- if(h5repack(fname, FSPACE_OUT, &pack_options) < 0)
- GOERROR;
- if(h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0)
- GOERROR;
- if(h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0)
- GOERROR;
- if(h5repack_end(&pack_options) < 0)
- GOERROR;
- PASSED();
+ TESTING(" files with file space info setting-- options -S, -T, -G are set & -L");
+ ++j; /* #7 */
+ HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
+ fname = H5REPACK_FSPACE_FNAMES[j];
+ if (h5repack_init(&pack_options, 0, TRUE) < 0)
+ GOERROR;
+ pack_options.fs_strategy = H5F_FSPACE_STRATEGY_AGGR;
+ pack_options.fs_threshold = 1;
+ pack_options.fs_pagesize = 4096;
+ if (h5repack(fname, FSPACE_OUT, &pack_options) < 0)
+ GOERROR;
+ if (h5diff(fname, FSPACE_OUT, NULL, NULL, &diff_options) > 0)
+ GOERROR;
+ if (h5repack_verify(fname, FSPACE_OUT, &pack_options) <= 0)
+ GOERROR;
+ if (h5repack_end(&pack_options) < 0)
+ GOERROR;
+ PASSED();
+ }
/*-------------------------------------------------------------------------
* file with fill values
@@ -382,32 +381,32 @@ int main (void)
GOERROR;
if (h5repack_verify(FNAME0, FNAME0OUT, &pack_options) <= 0)
GOERROR;
- if (h5repack_cmp_pl(FNAME0, FNAME0OUT) <= 0)
+ if (h5repack_cmp_pl(FNAME0, pack_options.fin_fapl, FNAME0OUT, pack_options.fout_fapl) <= 0)
GOERROR;
if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
-
/*-------------------------------------------------------------------------
* file with all kinds of dataset datatypes
*-------------------------------------------------------------------------
*/
- TESTING(" copy of datasets (all datatypes)");
- if (h5repack_init(&pack_options, 0, FALSE) < 0)
- GOERROR;
- if (h5repack(FNAME1, FNAME1OUT, &pack_options) < 0)
- GOERROR;
- if (h5diff(FNAME1, FNAME1OUT, NULL, NULL, &diff_options) > 0)
- GOERROR;
- if (h5repack_verify(FNAME1, FNAME1OUT, &pack_options) <= 0)
- GOERROR;
- if (h5repack_cmp_pl(FNAME1, FNAME1OUT) <= 0)
- GOERROR;
- if (h5repack_end(&pack_options) < 0)
- GOERROR;
- PASSED();
-
+ if (!h5_using_parallel_driver(NULL)) {
+ TESTING(" copy of datasets (all datatypes)");
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
+ GOERROR;
+ if (h5repack(FNAME1, FNAME1OUT, &pack_options) < 0)
+ GOERROR;
+ if (h5diff(FNAME1, FNAME1OUT, NULL, NULL, &diff_options) > 0)
+ GOERROR;
+ if (h5repack_verify(FNAME1, FNAME1OUT, &pack_options) <= 0)
+ GOERROR;
+ if (h5repack_cmp_pl(FNAME1, pack_options.fin_fapl, FNAME1OUT, pack_options.fout_fapl) <= 0)
+ GOERROR;
+ if (h5repack_end(&pack_options) < 0)
+ GOERROR;
+ PASSED();
+ }
/*-------------------------------------------------------------------------
* file with attributes
@@ -422,7 +421,7 @@ int main (void)
GOERROR;
if (h5repack_verify(FNAME2, FNAME2OUT, &pack_options) <= 0)
GOERROR;
- if (h5repack_cmp_pl(FNAME2, FNAME2OUT) <= 0)
+ if (h5repack_cmp_pl(FNAME2, pack_options.fin_fapl, FNAME2OUT, pack_options.fout_fapl) <= 0)
GOERROR;
if (h5repack_end(&pack_options) < 0)
GOERROR;
@@ -441,7 +440,7 @@ int main (void)
GOERROR;
if (h5repack_verify(FNAME3, FNAME3OUT, &pack_options) <= 0)
GOERROR;
- if (h5repack_cmp_pl(FNAME3, FNAME3OUT) <= 0)
+ if (h5repack_cmp_pl(FNAME3, pack_options.fin_fapl, FNAME3OUT, pack_options.fout_fapl) <= 0)
GOERROR;
if (h5repack_end(&pack_options) < 0)
GOERROR;
@@ -565,7 +564,7 @@ int main (void)
TESTING(" adding szip filter");
-#if defined (H5_HAVE_FILTER_SZIP)
+#if defined(H5_HAVE_FILTER_SZIP)
if (h5tools_can_encode(H5Z_FILTER_SZIP) > 0)
szip_can_encode = 1;
@@ -575,7 +574,7 @@ int main (void)
*/
if (szip_can_encode) {
- if (h5repack_init (&pack_options, 0, FALSE) < 0)
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
if (h5repack_addfilter("dset2:SZIP=8,EC", &pack_options) < 0)
GOERROR;
@@ -587,7 +586,7 @@ int main (void)
GOERROR;
if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0)
GOERROR;
- if (h5repack_end (&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
@@ -599,14 +598,13 @@ int main (void)
SKIPPED();
#endif
-
/*-------------------------------------------------------------------------
* test all objects option
*-------------------------------------------------------------------------
*/
TESTING(" adding szip filter to all");
-#if defined (H5_HAVE_FILTER_SZIP)
+#if defined(H5_HAVE_FILTER_SZIP)
if (szip_can_encode) {
if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
@@ -630,8 +628,7 @@ int main (void)
SKIPPED();
#endif
-
- TESTING(" addding shuffle filter");
+ TESTING(" adding shuffle filter");
/*-------------------------------------------------------------------------
* test an individual object option
@@ -660,7 +657,7 @@ int main (void)
*-------------------------------------------------------------------------
*/
- TESTING(" addding shuffle filter to all");
+ TESTING(" adding shuffle filter to all");
if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
@@ -679,7 +676,6 @@ int main (void)
PASSED();
-
TESTING(" adding checksum filter");
/*-------------------------------------------------------------------------
@@ -726,7 +722,6 @@ int main (void)
PASSED();
-
TESTING(" filter queue fletcher, shuffle, deflate, szip");
/*-------------------------------------------------------------------------
@@ -743,7 +738,7 @@ int main (void)
if (h5repack_addfilter("dset1:SHUF", &pack_options) < 0)
GOERROR;
-#if defined (H5_HAVE_FILTER_SZIP)
+#if defined(H5_HAVE_FILTER_SZIP)
if (szip_can_encode) {
if (h5repack_addfilter("dset1:SZIP=8,NN", &pack_options) < 0)
GOERROR;
@@ -766,7 +761,6 @@ int main (void)
PASSED();
-
TESTING(" adding layout chunked (old format)");
/*-------------------------------------------------------------------------
@@ -782,7 +776,7 @@ int main (void)
GOERROR;
if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options ) <= 0)
+ if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0)
GOERROR;
if (h5repack_end(&pack_options) < 0)
GOERROR;
@@ -804,7 +798,7 @@ int main (void)
GOERROR;
if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options ) <= 0)
+ if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0)
GOERROR;
if (h5repack_end(&pack_options) < 0)
GOERROR;
@@ -933,7 +927,6 @@ int main (void)
PASSED();
-
TESTING(" layout compact to contiguous conversion");
/*-------------------------------------------------------------------------
@@ -986,9 +979,9 @@ int main (void)
GOERROR;
if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0)
GOERROR;
- if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) >0)
+ if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options)<= 0)
+ if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0)
GOERROR;
if (h5repack_end(&pack_options) < 0)
GOERROR;
@@ -1110,7 +1103,6 @@ int main (void)
GOERROR;
PASSED();
-
/*-------------------------------------------------------------------------
* the following tests assume the input files have filters
* FNAME7
@@ -1122,7 +1114,7 @@ int main (void)
*/
TESTING(" copy of szip filter");
-#if defined (H5_HAVE_FILTER_SZIP)
+#if defined(H5_HAVE_FILTER_SZIP)
if (szip_can_encode) {
if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
@@ -1132,7 +1124,7 @@ int main (void)
GOERROR;
if (h5repack_verify(FNAME7, FNAME7OUT, &pack_options) <= 0)
GOERROR;
- if (h5repack_cmp_pl(FNAME7, FNAME7OUT) <= 0)
+ if (h5repack_cmp_pl(FNAME7, pack_options.fin_fapl, FNAME7OUT, pack_options.fout_fapl) <= 0)
GOERROR;
if (h5repack_end(&pack_options) < 0)
GOERROR;
@@ -1148,7 +1140,7 @@ int main (void)
TESTING(" removing szip filter");
-#if defined (H5_HAVE_FILTER_SZIP)
+#if defined(H5_HAVE_FILTER_SZIP)
if (szip_can_encode) {
if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
@@ -1172,7 +1164,6 @@ int main (void)
SKIPPED();
#endif
-
TESTING(" copy of deflate filter");
#ifdef H5_HAVE_FILTER_DEFLATE
@@ -1192,7 +1183,6 @@ int main (void)
SKIPPED();
#endif
-
TESTING(" removing deflate filter");
#ifdef H5_HAVE_FILTER_DEFLATE
@@ -1214,8 +1204,6 @@ int main (void)
SKIPPED();
#endif
-
-
TESTING(" copy of shuffle filter");
if (h5repack_init(&pack_options, 0, FALSE) < 0)
@@ -1231,7 +1219,6 @@ int main (void)
PASSED();
-
TESTING(" removing shuffle filter");
if (h5repack_init(&pack_options, 0, FALSE) < 0)
@@ -1249,7 +1236,6 @@ int main (void)
PASSED();
-
TESTING(" copy of fletcher filter");
if (h5repack_init(&pack_options, 0, FALSE) < 0)
@@ -1265,7 +1251,6 @@ int main (void)
PASSED();
-
TESTING(" removing fletcher filter");
if (h5repack_init(&pack_options, 0, FALSE) < 0)
@@ -1283,7 +1268,6 @@ int main (void)
PASSED();
-
TESTING(" copy of nbit filter");
if (h5repack_init(&pack_options, 0, FALSE) < 0)
@@ -1299,7 +1283,6 @@ int main (void)
PASSED();
-
TESTING(" removing nbit filter");
if (h5repack_init(&pack_options, 0, FALSE) < 0)
@@ -1317,7 +1300,6 @@ int main (void)
PASSED();
-
TESTING(" adding nbit filter");
if (h5repack_init(&pack_options, 0, FALSE) < 0)
@@ -1328,14 +1310,13 @@ int main (void)
GOERROR;
if (h5diff(FNAME12, FNAME12OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if (h5repack_verify(FNAME12, FNAME12OUT, &pack_options)<= 0)
+ if (h5repack_verify(FNAME12, FNAME12OUT, &pack_options) <= 0)
GOERROR;
if (h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();
-
TESTING(" copy of scaleoffset filter");
if (h5repack_init(&pack_options, 0, FALSE) < 0)
@@ -1351,7 +1332,6 @@ int main (void)
PASSED();
-
TESTING(" removing scaleoffset filter");
if (h5repack_init(&pack_options, 0, FALSE) < 0)
@@ -1369,7 +1349,6 @@ int main (void)
PASSED();
-
TESTING(" adding scaleoffset filter");
if (h5repack_init(&pack_options, 0, FALSE) < 0)
@@ -1387,7 +1366,6 @@ int main (void)
PASSED();
-
/*-------------------------------------------------------------------------
* file with all filters
* dset_all
@@ -1399,7 +1377,7 @@ int main (void)
*/
TESTING(" filter conversion from deflate to szip");
-#if defined (H5_HAVE_FILTER_SZIP) && defined (H5_HAVE_FILTER_DEFLATE)
+#if defined(H5_HAVE_FILTER_SZIP) && defined(H5_HAVE_FILTER_DEFLATE)
if (szip_can_encode) {
if (h5repack_init(&pack_options, 0, FALSE) < 0)
@@ -1426,7 +1404,7 @@ int main (void)
TESTING(" filter conversion from szip to deflate");
-#if defined (H5_HAVE_FILTER_SZIP) && defined (H5_HAVE_FILTER_DEFLATE)
+#if defined(H5_HAVE_FILTER_SZIP) && defined(H5_HAVE_FILTER_DEFLATE)
if (szip_can_encode) {
if (h5repack_init(&pack_options, 0, FALSE) < 0)
@@ -1451,7 +1429,6 @@ int main (void)
SKIPPED();
#endif
-
/*-------------------------------------------------------------------------
* test the NONE global option
*-------------------------------------------------------------------------
@@ -1459,7 +1436,7 @@ int main (void)
TESTING(" removing all filters");
-#if defined (H5_HAVE_FILTER_SZIP) && defined (H5_HAVE_FILTER_DEFLATE)
+#if defined(H5_HAVE_FILTER_SZIP) && defined(H5_HAVE_FILTER_DEFLATE)
if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
@@ -1514,50 +1491,53 @@ int main (void)
GOERROR;
PASSED();
- /*-------------------------------------------------------------------------
- * test file with userblock
- *-------------------------------------------------------------------------
- */
- TESTING(" file with userblock");
- if(h5repack_init(&pack_options, 0, FALSE) < 0)
- GOERROR;
- if(h5repack(FNAME16, FNAME16OUT, &pack_options) < 0)
- GOERROR;
- if(h5diff(FNAME16, FNAME16OUT, NULL, NULL, &diff_options) > 0)
- GOERROR;
- if(h5repack_verify(FNAME16, FNAME16OUT, &pack_options) <= 0)
- GOERROR;
- if(verify_userblock(FNAME16OUT) < 0)
- GOERROR;
- if(h5repack_end(&pack_options) < 0)
- GOERROR;
- PASSED();
+ if (h5_using_default_driver(NULL)) {
+ /*-------------------------------------------------------------------------
+ * test file with userblock
+ *-------------------------------------------------------------------------
+ */
+ TESTING(" file with userblock");
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
+ GOERROR;
+ if (h5repack(FNAME16, FNAME16OUT, &pack_options) < 0)
+ GOERROR;
+ if (h5diff(FNAME16, FNAME16OUT, NULL, NULL, &diff_options) > 0)
+ GOERROR;
+ if (h5repack_verify(FNAME16, FNAME16OUT, &pack_options) <= 0)
+ GOERROR;
+ if (verify_userblock(FNAME16OUT) < 0)
+ GOERROR;
+ if (h5repack_end(&pack_options) < 0)
+ GOERROR;
+ PASSED();
+ }
/*-------------------------------------------------------------------------
* test --latest options
*-------------------------------------------------------------------------
*/
- TESTING(" latest file format options");
- if (h5repack_init(&pack_options, 0, FALSE) < 0)
- GOERROR;
- pack_options.latest = 1;
- pack_options.grp_compact = 10;
- pack_options.grp_indexed = 5;
- pack_options.msg_size[0] = 10;
- pack_options.msg_size[1] = 20;
- pack_options.msg_size[2] = 30;
- pack_options.msg_size[3] = 40;
- pack_options.msg_size[4] = 50;
- if (h5repack(FNAME1, FNAME1OUT, &pack_options) < 0)
- GOERROR;
- if (h5diff(FNAME1, FNAME1OUT, NULL, NULL, &diff_options) > 0)
- GOERROR;
- if (h5repack_verify(FNAME1, FNAME1OUT, &pack_options)<=0)
- GOERROR;
- if (h5repack_end(&pack_options) < 0)
- GOERROR;
- PASSED();
-
+ if (!h5_using_parallel_driver(NULL)) {
+ TESTING(" latest file format options");
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
+ GOERROR;
+ pack_options.latest = 1;
+ pack_options.grp_compact = 10;
+ pack_options.grp_indexed = 5;
+ pack_options.msg_size[0] = 10;
+ pack_options.msg_size[1] = 20;
+ pack_options.msg_size[2] = 30;
+ pack_options.msg_size[3] = 40;
+ pack_options.msg_size[4] = 50;
+ if (h5repack(FNAME1, FNAME1OUT, &pack_options) < 0)
+ GOERROR;
+ if (h5diff(FNAME1, FNAME1OUT, NULL, NULL, &diff_options) > 0)
+ GOERROR;
+ if (h5repack_verify(FNAME1, FNAME1OUT, &pack_options) <= 0)
+ GOERROR;
+ if (h5repack_end(&pack_options) < 0)
+ GOERROR;
+ PASSED();
+ }
/*-------------------------------------------------------------------------
* test several global filters
@@ -1566,7 +1546,7 @@ int main (void)
TESTING(" several global filters");
-#if defined (H5_HAVE_FILTER_DEFLATE)
+#if defined(H5_HAVE_FILTER_DEFLATE)
if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
@@ -1588,63 +1568,62 @@ int main (void)
SKIPPED();
#endif
-
- /*-------------------------------------------------------------------------
- * test file with userblock
- *-------------------------------------------------------------------------
- */
- TESTING(" file with added userblock");
+ if (h5_using_default_driver(NULL)) {
+ /*-------------------------------------------------------------------------
+ * test file with userblock
+ *-------------------------------------------------------------------------
+ */
+ TESTING(" file with added userblock");
#ifdef H5_HAVE_FILTER_DEFLATE
- if(h5repack_init(&pack_options, 0, FALSE) < 0)
- GOERROR;
-
- /* add the options for a user block size and user block filename */
- pack_options.ublock_size = USERBLOCK_SIZE;
- pack_options.ublock_filename = FNAME_UB;
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
+ GOERROR;
- if(h5repack(FNAME8, FNAME8OUT, &pack_options) < 0)
- GOERROR;
- if(h5diff(FNAME8, FNAME8OUT, NULL, NULL, &diff_options) > 0)
- GOERROR;
- if(h5repack_verify(FNAME8, FNAME8OUT, &pack_options) <= 0)
- GOERROR;
- if(verify_userblock(FNAME8OUT) < 0)
- GOERROR;
- if(h5repack_end(&pack_options) < 0)
- GOERROR;
+ /* add the options for a user block size and user block filename */
+ pack_options.ublock_size = USERBLOCK_SIZE;
+ pack_options.ublock_filename = FNAME_UB;
+ if (h5repack(FNAME8, FNAME8OUT, &pack_options) < 0)
+ GOERROR;
+ if (h5diff(FNAME8, FNAME8OUT, NULL, NULL, &diff_options) > 0)
+ GOERROR;
+ if (h5repack_verify(FNAME8, FNAME8OUT, &pack_options) <= 0)
+ GOERROR;
+ if (verify_userblock(FNAME8OUT) < 0)
+ GOERROR;
+ if (h5repack_end(&pack_options) < 0)
+ GOERROR;
- PASSED();
+ PASSED();
#else
- SKIPPED();
+ SKIPPED();
#endif
-
+ }
/*-------------------------------------------------------------------------
- * test file with aligment
+ * test file with alignment
*-------------------------------------------------------------------------
*/
- TESTING(" file with aligment");
+ TESTING(" file with alignment");
#ifdef H5_HAVE_FILTER_DEFLATE
- if(h5repack_init(&pack_options, 0, FALSE) < 0)
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
- /* add the options for aligment */
+ /* add the options for alignment */
pack_options.alignment = 1;
pack_options.threshold = 1;
- if(h5repack(FNAME8, FNAME8OUT, &pack_options) < 0)
+ if (h5repack(FNAME8, FNAME8OUT, &pack_options) < 0)
GOERROR;
- if(h5diff(FNAME8, FNAME8OUT, NULL, NULL, &diff_options) > 0)
+ if (h5diff(FNAME8, FNAME8OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if(h5repack_verify(FNAME8, FNAME8OUT, &pack_options) <= 0)
+ if (h5repack_verify(FNAME8, FNAME8OUT, &pack_options) <= 0)
GOERROR;
- /* verify aligment */
+ /* verify alignment */
{
hsize_t threshold;
hsize_t alignment;
@@ -1655,7 +1634,7 @@ int main (void)
GOERROR;
if ((fapl = H5Fget_access_plist(fid)) < 0)
GOERROR;
- if (H5Pget_alignment(fapl, &threshold, &alignment) < 0)
+ if (H5Pget_alignment(fapl, &threshold, &alignment) < 0)
GOERROR;
if (threshold != 1)
GOERROR;
@@ -1665,14 +1644,11 @@ int main (void)
GOERROR;
if (H5Fclose(fid) < 0)
GOERROR;
-
}
-
- if(h5repack_end(&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
-
PASSED();
#else
SKIPPED();
@@ -1684,75 +1660,74 @@ int main (void)
*/
TESTING(" file with committed datatypes");
- if(h5repack_init(&pack_options, 0, FALSE) < 0)
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
GOERROR;
- if(h5repack(FNAME17, FNAME17OUT, &pack_options) < 0)
+ if (h5repack(FNAME17, FNAME17OUT, &pack_options) < 0)
GOERROR;
- if(h5diff(FNAME17, FNAME17OUT, NULL, NULL, &diff_options) > 0)
+ if (h5diff(FNAME17, FNAME17OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
- if(h5repack_verify(FNAME17, FNAME17OUT, &pack_options) <= 0)
+ if (h5repack_verify(FNAME17, FNAME17OUT, &pack_options) <= 0)
GOERROR;
- if(h5repack_end(&pack_options) < 0)
+ if (h5repack_end(&pack_options) < 0)
GOERROR;
-
PASSED();
- /*-------------------------------------------------------------------------
- * test --metadata_block_size option
- * Also verify that output file using the metadata_block_size option is
- * larger than the output file one not using it.
- * FNAME4 is used because it is the same as the test file used for the
- * shell script version of this test (h5repack.sh).
- *-------------------------------------------------------------------------
- */
- TESTING(" metadata block size option");
- /* First run without metadata option. No need to verify the correctness */
- /* since this has been verified by earlier tests. Just record the file */
- /* size of the output file. */
- if(h5repack_init(&pack_options, 0, FALSE) < 0)
- GOERROR;
- if(h5repack(FNAME4, FNAME4OUT, &pack_options) < 0)
- GOERROR;
- if(HDstat(FNAME4OUT, &file_stat) < 0)
- GOERROR;
- fsize1 = file_stat.st_size;
- if(h5repack_end(&pack_options) < 0)
- GOERROR;
-
- /* run it again with metadata option */
- if(h5repack_init(&pack_options, 0, FALSE) < 0)
- GOERROR;
- pack_options.meta_block_size = 8192;
- if(h5repack(FNAME4, FNAME4OUT, &pack_options) < 0)
- GOERROR;
- if(h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0)
- GOERROR;
- if(h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0)
- GOERROR;
- /* record the file size of the output file */
- if(HDstat(FNAME4OUT, &file_stat) < 0)
- GOERROR;
- fsize2 = file_stat.st_size;
- /* verify second file size is larger than the first one */
- if(fsize2 <= fsize1)
- GOERROR;
- if(h5repack_end(&pack_options) < 0)
- GOERROR;
- PASSED();
+ if (h5_using_default_driver(NULL)) {
+ /*-------------------------------------------------------------------------
+ * test --metadata_block_size option
+ * Also verify that output file using the metadata_block_size option is
+ * larger than the output file one not using it.
+ * FNAME4 is used because it is the same as the test file used for the
+ * shell script version of this test (h5repack.sh).
+ *-------------------------------------------------------------------------
+ */
+ TESTING(" metadata block size option");
+ /* First run without metadata option. No need to verify the correctness */
+ /* since this has been verified by earlier tests. Just record the file */
+ /* size of the output file. */
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
+ GOERROR;
+ if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0)
+ GOERROR;
+ if (HDstat(FNAME4OUT, &file_stat) < 0)
+ GOERROR;
+ fsize1 = file_stat.st_size;
+ if (h5repack_end(&pack_options) < 0)
+ GOERROR;
+ /* run it again with metadata option */
+ if (h5repack_init(&pack_options, 0, FALSE) < 0)
+ GOERROR;
+ pack_options.meta_block_size = 8192;
+ if (h5repack(FNAME4, FNAME4OUT, &pack_options) < 0)
+ GOERROR;
+ if (h5diff(FNAME4, FNAME4OUT, NULL, NULL, &diff_options) > 0)
+ GOERROR;
+ if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0)
+ GOERROR;
+ /* record the file size of the output file */
+ if (HDstat(FNAME4OUT, &file_stat) < 0)
+ GOERROR;
+ fsize2 = file_stat.st_size;
+ /* verify second file size is larger than the first one */
+ if (fsize2 <= fsize1)
+ GOERROR;
+ if (h5repack_end(&pack_options) < 0)
+ GOERROR;
+ PASSED();
+ }
/*-------------------------------------------------------------------------
* clean temporary test files
*-------------------------------------------------------------------------
*/
{
- hid_t fapl;
+ hid_t fapl;
fapl = h5_fileaccess();
h5_clean_files(H5REPACK_FILENAMES, fapl);
-
}
puts("All h5repack tests passed.");
@@ -1762,107 +1737,110 @@ int main (void)
return 0;
error:
+ h5tools_close();
+
puts("***** H5REPACK TESTS FAILED *****");
- return 1;
+ return 1;
}
-
/*-------------------------------------------------------------------------
-* Function: make_testfiles
-*
-* Purpose: make a test file with all types of HDF5 objects,
-* datatypes and filters
-*
-*-------------------------------------------------------------------------
-*/
-static
-int make_testfiles(void)
+ * Function: make_testfiles
+ *
+ * Purpose: make a test file with all types of HDF5 objects,
+ * datatypes and filters
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+make_testfiles(void)
{
- hid_t fid = -1;
- hid_t fcpl = -1; /* File creation property list */
- hid_t fapl = -1; /* File access property list */
- unsigned j; /* Local index variable */
+ hid_t fid = H5I_INVALID_HID;
+ hid_t fcpl = H5I_INVALID_HID; /* File creation property list */
+ hid_t fapl = H5I_INVALID_HID; /* File access property list */
+ unsigned j; /* Local index variable */
/*-------------------------------------------------------------------------
* create a file for general copy test
*-------------------------------------------------------------------------
*/
- if((fid = H5Fcreate(FNAME0, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(FNAME0, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
if (make_fill(fid) < 0)
goto out;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
return -1;
/*-------------------------------------------------------------------------
* create another file for general copy test (all datatypes)
*-------------------------------------------------------------------------
*/
- if((fid = H5Fcreate(FNAME1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- return -1;
- if (make_all_objects(fid) < 0)
- goto out;
- if(H5Fclose(fid) < 0)
- return -1;
+ if (!h5_using_parallel_driver(NULL)) {
+ if ((fid = H5Fcreate(FNAME1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ return -1;
+ if (make_all_objects(fid) < 0)
+ goto out;
+ if (H5Fclose(fid) < 0)
+ return -1;
+ }
/*-------------------------------------------------------------------------
* create a file for attributes copy test
*-------------------------------------------------------------------------
*/
- if((fid = H5Fcreate(FNAME2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(FNAME2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
if (make_attributes(fid) < 0)
goto out;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
return -1;
/*-------------------------------------------------------------------------
* create a file for hard links test
*-------------------------------------------------------------------------
*/
- if((fid = H5Fcreate(FNAME3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(FNAME3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
if (make_hlinks(fid) < 0)
goto out;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
return -1;
/*-------------------------------------------------------------------------
* create a file for layouts test
*-------------------------------------------------------------------------
*/
- if((fid = H5Fcreate(FNAME4, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(FNAME4, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
if (make_layout(fid) < 0)
goto out;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
return -1;
/*-------------------------------------------------------------------------
* create a file for layout conversion test
*-------------------------------------------------------------------------
*/
- if((fid = H5Fcreate(FNAME18, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(FNAME18, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
- if(make_layout2(fid) < 0)
+ if (make_layout2(fid) < 0)
goto out;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
return -1;
/*-------------------------------------------------------------------------
* for test layout conversions form chunk with unlimited max dims
*-------------------------------------------------------------------------
*/
- if((fid = H5Fcreate("h5repack_layout3.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate("h5repack_layout3.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
- if(make_layout3(fid) < 0)
+ if (make_layout3(fid) < 0)
goto out;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
return -1;
/*-------------------------------------------------------------------------
@@ -1872,168 +1850,171 @@ int make_testfiles(void)
if (make_early() < 0)
goto out;
- /*-------------------------------------------------------------------------
- * create a file with the SZIP filter
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * create a file with the SZIP filter
+ *-------------------------------------------------------------------------
+ */
#ifdef H5_HAVE_FILTER_SZIP
- if((fid = H5Fcreate(FNAME7, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(FNAME7, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
if (make_szip(fid) < 0)
goto out;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
return -1;
#endif /* H5_HAVE_FILTER_SZIP */
-
/*-------------------------------------------------------------------------
* create a file with the deflate filter
*-------------------------------------------------------------------------
*/
- if((fid = H5Fcreate(FNAME8, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(FNAME8, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
if (make_deflate(fid) < 0)
goto out;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
return -1;
/*-------------------------------------------------------------------------
* create a file with the shuffle filter
*-------------------------------------------------------------------------
*/
- if((fid = H5Fcreate(FNAME9, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(FNAME9, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
if (make_shuffle(fid) < 0)
goto out;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
return -1;
/*-------------------------------------------------------------------------
* create a file with the fletcher32 filter
*-------------------------------------------------------------------------
*/
- if((fid = H5Fcreate(FNAME10, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(FNAME10, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
if (make_fletcher32(fid) < 0)
goto out;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
return -1;
/*-------------------------------------------------------------------------
* create a file with all the filters
*-------------------------------------------------------------------------
*/
- if((fid = H5Fcreate(FNAME11, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(FNAME11, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
if (make_all_filters(fid) < 0)
goto out;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
return -1;
/*-------------------------------------------------------------------------
* create a file with the nbit filter
*-------------------------------------------------------------------------
*/
- if((fid = H5Fcreate(FNAME12, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(FNAME12, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
if (make_nbit(fid) < 0)
goto out;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
return -1;
/*-------------------------------------------------------------------------
* create a file with the scaleoffset filter
*-------------------------------------------------------------------------
*/
- if((fid = H5Fcreate(FNAME13, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(FNAME13, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
if (make_scaleoffset(fid) < 0)
goto out;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
return -1;
/*-------------------------------------------------------------------------
* create a big dataset
*-------------------------------------------------------------------------
*/
- if((fid = H5Fcreate(FNAME14, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(FNAME14, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
if (make_big(fid) < 0)
goto out;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
return -1;
/*-------------------------------------------------------------------------
* create a file with external dataset
*-------------------------------------------------------------------------
*/
- if((fid = H5Fcreate(FNAME15, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(FNAME15, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
if (make_external(fid) < 0)
goto out;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
return -1;
- /*-------------------------------------------------------------------------
- * create a file with userblock
- *-------------------------------------------------------------------------
- */
- if(make_userblock() < 0)
- goto out;
+ if (h5_using_default_driver(NULL)) {
+ /*-------------------------------------------------------------------------
+ * create a file with userblock
+ *-------------------------------------------------------------------------
+ */
+ if (make_userblock() < 0)
+ goto out;
- /*-------------------------------------------------------------------------
- * create a userblock file
- *-------------------------------------------------------------------------
- */
- if(make_userblock_file() < 0)
- goto out;
+ /*-------------------------------------------------------------------------
+ * create a userblock file
+ *-------------------------------------------------------------------------
+ */
+ if (make_userblock_file() < 0)
+ goto out;
+ }
/*-------------------------------------------------------------------------
* create a file with named datatypes
*-------------------------------------------------------------------------
*/
- if((fid = H5Fcreate(FNAME17, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(FNAME17, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
if (make_named_dtype(fid) < 0)
goto out;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
return -1;
- /*-------------------------------------------------------------------------
- * create obj and region reference type datasets (bug1814)
- * add attribute with int type (bug1726)
- * add attribute with obj and region reference type (bug1726)
- *-------------------------------------------------------------------------
- */
- if((fid = H5Fcreate(FNAME_REF, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- return -1;
- /* create reference type datasets */
- if (make_references(fid) < 0)
- goto out;
- if(H5Fclose(fid) < 0)
- return -1;
+ if (!h5_using_parallel_driver(NULL)) {
+ /*-------------------------------------------------------------------------
+ * create obj and region reference type datasets (bug1814)
+ * add attribute with int type (bug1726)
+ * add attribute with obj and region reference type (bug1726)
+ *-------------------------------------------------------------------------
+ */
+ if ((fid = H5Fcreate(FNAME_REF, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ return -1;
+ /* create reference type datasets */
+ if (make_references(fid) < 0)
+ goto out;
+ if (H5Fclose(fid) < 0)
+ return -1;
- /*-------------------------------------------------------------------------
- * create a file with obj and region references in attribute of compound and
- * vlen datatype
- *-------------------------------------------------------------------------*/
- if((fid = H5Fcreate(FNAME_ATTR_REF, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- return -1;
- if (make_complex_attr_references(fid) < 0)
- goto out;
- if(H5Fclose(fid) < 0)
- return -1;
+ /*-------------------------------------------------------------------------
+ * create a file with obj and region references in attribute of compound and
+ * vlen datatype
+ *-------------------------------------------------------------------------*/
+ if ((fid = H5Fcreate(FNAME_ATTR_REF, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ return -1;
+ if (make_complex_attr_references(fid) < 0)
+ goto out;
+ if (H5Fclose(fid) < 0)
+ return -1;
+ }
/*-------------------------------------------------------------------------
* create 8 files with combinations ???
*------------------------------------------------------------------------- */
/* Create file access property list */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
return -1;
/* Set to use latest library format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
return -1;
/*
@@ -2042,9 +2023,9 @@ int make_testfiles(void)
* default: inpage=4096
*/
j = 0;
- if((fid = H5Fcreate(H5REPACK_FSPACE_FNAMES[j], H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(H5REPACK_FSPACE_FNAMES[j], H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
return -1;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
return -1;
/*
@@ -2053,118 +2034,118 @@ int make_testfiles(void)
* default: inpage=4096
*/
HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
- if((fid = H5Fcreate(H5REPACK_FSPACE_FNAMES[++j], H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- return -1;
- if(H5Fclose(fid) < 0)
- return -1;
-
- /*
- * #2 -- h5repack_page_persist.h5
- * Setting:
- * strategy=PAGE, persist=TRUE, threshold=1
- * inpage=512
- * latest format
- */
- /* Create file creation property list */
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
- return -1;
- if(H5Pset_file_space_page_size(fcpl, (hsize_t)512) < 0)
- return -1;
- if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, TRUE, (hsize_t)1) < 0)
- return -1;
- HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
- if((fid = H5Fcreate(H5REPACK_FSPACE_FNAMES[++j], H5F_ACC_TRUNC, fcpl, fapl)) < 0)
- return -1;
- if(H5Fclose(fid) < 0)
+ if ((fid = H5Fcreate(H5REPACK_FSPACE_FNAMES[++j], H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
- if(H5Pclose(fcpl) < 0)
+ if (H5Fclose(fid) < 0)
return -1;
+ if (h5_using_default_driver(NULL)) {
+ /*
+ * #2 -- h5repack_page_persist.h5
+ * Setting:
+ * strategy=PAGE, persist=TRUE, threshold=1
+ * inpage=512
+ * latest format
+ */
+ /* Create file creation property list */
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ return -1;
+ if (H5Pset_file_space_page_size(fcpl, (hsize_t)512) < 0)
+ return -1;
+ if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, TRUE, (hsize_t)1) < 0)
+ return -1;
+ HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
+ if ((fid = H5Fcreate(H5REPACK_FSPACE_FNAMES[++j], H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ return -1;
+ if (H5Fclose(fid) < 0)
+ return -1;
+ if (H5Pclose(fcpl) < 0)
+ return -1;
- /*
- * #3 -- h5repack_fsm_aggr_persist.h5
- * Setting:
- * strategy=FSM_AGGR, persist=TRUE, threshold=1
- * default: inpage=4096
- */
- /* Create file creation property list */
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
- return -1;
- if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, TRUE, (hsize_t)1) < 0)
- return -1;
- HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
- if((fid = H5Fcreate(H5REPACK_FSPACE_FNAMES[++j], H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0)
- return -1;
- if(H5Fclose(fid) < 0)
- return -1;
- if(H5Pclose(fcpl) < 0)
- return -1;
-
+ /*
+ * #3 -- h5repack_fsm_aggr_persist.h5
+ * Setting:
+ * strategy=FSM_AGGR, persist=TRUE, threshold=1
+ * default: inpage=4096
+ */
+ /* Create file creation property list */
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ return -1;
+ if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, TRUE, (hsize_t)1) < 0)
+ return -1;
+ HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
+ if ((fid = H5Fcreate(H5REPACK_FSPACE_FNAMES[++j], H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0)
+ return -1;
+ if (H5Fclose(fid) < 0)
+ return -1;
+ if (H5Pclose(fcpl) < 0)
+ return -1;
- /*
- * #4 -- h5repack_page_threshold.h5
- * Setting:
- * strategy=PAGE, persist=FALSE, threshold=3
- * inpage=8192
- * latest format
- */
+ /*
+ * #4 -- h5repack_page_threshold.h5
+ * Setting:
+ * strategy=PAGE, persist=FALSE, threshold=3
+ * inpage=8192
+ * latest format
+ */
- /* Create file creation property list */
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
- return -1;
- if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, FALSE, (hsize_t)3) < 0)
- return -1;
- if(H5Pset_file_space_page_size(fcpl, (hsize_t)8192) < 0)
- return -1;
- HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
- if((fid = H5Fcreate(H5REPACK_FSPACE_FNAMES[++j], H5F_ACC_TRUNC, fcpl, fapl)) < 0)
- return -1;
- if(H5Fclose(fid) < 0)
- return -1;
- if(H5Pclose(fcpl) < 0)
- return -1;
+ /* Create file creation property list */
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ return -1;
+ if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, FALSE, (hsize_t)3) < 0)
+ return -1;
+ if (H5Pset_file_space_page_size(fcpl, (hsize_t)8192) < 0)
+ return -1;
+ HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
+ if ((fid = H5Fcreate(H5REPACK_FSPACE_FNAMES[++j], H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ return -1;
+ if (H5Fclose(fid) < 0)
+ return -1;
+ if (H5Pclose(fcpl) < 0)
+ return -1;
- /*
- * #5 -- h5repack_fsm_aggr_threshold.h5
- * Setting:
- * strategy=FSM_AGGR, persist=FALSE, threshold=3
- * inpage=4096
- */
+ /*
+ * #5 -- h5repack_fsm_aggr_threshold.h5
+ * Setting:
+ * strategy=FSM_AGGR, persist=FALSE, threshold=3
+ * inpage=4096
+ */
- /* Create file creation property list */
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
- return -1;
- if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, FALSE, (hsize_t)3) < 0)
- return -1;
- if(H5Pset_file_space_page_size(fcpl, (hsize_t)FS_PAGESIZE_DEF) < 0)
- return -1;
- HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
- if((fid = H5Fcreate(H5REPACK_FSPACE_FNAMES[++j], H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0)
- return -1;
- if(H5Fclose(fid) < 0)
- return -1;
- if(H5Pclose(fcpl) < 0)
- return -1;
+ /* Create file creation property list */
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ return -1;
+ if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, FALSE, (hsize_t)3) < 0)
+ return -1;
+ if (H5Pset_file_space_page_size(fcpl, (hsize_t)FS_PAGESIZE_DEF) < 0)
+ return -1;
+ HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
+ if ((fid = H5Fcreate(H5REPACK_FSPACE_FNAMES[++j], H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0)
+ return -1;
+ if (H5Fclose(fid) < 0)
+ return -1;
+ if (H5Pclose(fcpl) < 0)
+ return -1;
- /*
- * #6 -- h5repack_aggr.h5
- * Setting:
- * strategy=AGGR, persist=FALSE, threshold=1
- * latest format
- */
+ /*
+ * #6 -- h5repack_aggr.h5
+ * Setting:
+ * strategy=AGGR, persist=FALSE, threshold=1
+ * latest format
+ */
- /* Create file creation property list */
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
- return -1;
- if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_AGGR, FALSE, (hsize_t)1) < 0)
- return -1;
- HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
- if((fid = H5Fcreate(H5REPACK_FSPACE_FNAMES[++j], H5F_ACC_TRUNC, fcpl, fapl)) < 0)
- return -1;
- if(H5Fclose(fid) < 0)
- return -1;
- if(H5Pclose(fcpl) < 0)
- return -1;
+ /* Create file creation property list */
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ return -1;
+ if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_AGGR, FALSE, (hsize_t)1) < 0)
+ return -1;
+ HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
+ if ((fid = H5Fcreate(H5REPACK_FSPACE_FNAMES[++j], H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ return -1;
+ if (H5Fclose(fid) < 0)
+ return -1;
+ if (H5Pclose(fcpl) < 0)
+ return -1;
+ }
/*
* #7 -- h5repack_none.h5
@@ -2174,21 +2155,21 @@ int make_testfiles(void)
*/
/* Create file creation property list */
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
return -1;
- if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_NONE, FALSE, (hsize_t)1) < 0)
+ if (H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_NONE, FALSE, (hsize_t)1) < 0)
return -1;
- if(H5Pset_file_space_page_size(fcpl, (hsize_t)8192) < 0)
+ if (H5Pset_file_space_page_size(fcpl, (hsize_t)8192) < 0)
return -1;
HDassert(j < NELMTS(H5REPACK_FSPACE_FNAMES));
- if((fid = H5Fcreate(H5REPACK_FSPACE_FNAMES[++j], H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(H5REPACK_FSPACE_FNAMES[++j], H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0)
return -1;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
return -1;
- if(H5Pclose(fcpl) < 0)
+ if (H5Pclose(fcpl) < 0)
return -1;
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
return -1;
return 0;
@@ -2198,47 +2179,44 @@ out:
return -1;
}
-
-
/*-------------------------------------------------------------------------
-* Function: make_all_objects
-*
-* Purpose: make a test file with all types of HDF5 objects
-*
-*-------------------------------------------------------------------------
-*/
-static
-int make_all_objects(hid_t loc_id)
+ * Function: make_all_objects
+ *
+ * Purpose: make a test file with all types of HDF5 objects
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+make_all_objects(hid_t loc_id)
{
- hid_t did = -1;
- hid_t gid = -1;
- hid_t tid = -1;
- hid_t rid = -1;
- hid_t sid = -1;
- hid_t gcplid = -1;
+ hid_t did = H5I_INVALID_HID;
+ hid_t gid = H5I_INVALID_HID;
+ hid_t tid = H5I_INVALID_HID;
+ hid_t rid = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ hid_t gcplid = H5I_INVALID_HID;
hsize_t dims[1] = {2};
/* compound datatype */
- typedef struct s_t
- {
- int a;
- float b;
+ typedef struct s_t {
+ int a;
+ float b;
} s_t;
/*-------------------------------------------------------------------------
- * H5G_DATASET
- *-------------------------------------------------------------------------
- */
+ * H5G_DATASET
+ *-------------------------------------------------------------------------
+ */
if ((sid = H5Screate_simple(1, dims, NULL)) < 0)
goto out;
- if ((did = H5Dcreate2(loc_id, "dset_referenced", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(loc_id, "dset_referenced", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
goto out;
-
/*-------------------------------------------------------------------------
- * H5G_GROUP
- *-------------------------------------------------------------------------
- */
- if ((gid = H5Gcreate2(loc_id, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ * H5G_GROUP
+ *-------------------------------------------------------------------------
+ */
+ if ((gid = H5Gcreate2(loc_id, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
if (H5Gclose(gid) < 0)
goto out;
@@ -2254,9 +2232,9 @@ int make_all_objects(hid_t loc_id)
goto out;
/*-------------------------------------------------------------------------
- * H5G_TYPE
- *-------------------------------------------------------------------------
- */
+ * H5G_TYPE
+ *-------------------------------------------------------------------------
+ */
/* create a compound datatype */
if ((tid = H5Tcreate(H5T_COMPOUND, sizeof(s_t))) < 0)
@@ -2269,27 +2247,27 @@ int make_all_objects(hid_t loc_id)
goto out;
/*-------------------------------------------------------------------------
- * H5G_LINK
- *-------------------------------------------------------------------------
- */
+ * H5G_LINK
+ *-------------------------------------------------------------------------
+ */
if (H5Lcreate_soft("dset", loc_id, "link", H5P_DEFAULT, H5P_DEFAULT) < 0)
goto out;
/*-------------------------------------------------------------------------
- * H5G_UDLINK
- *-------------------------------------------------------------------------
- */
+ * H5G_UDLINK
+ *-------------------------------------------------------------------------
+ */
/* Create an external link. Other UD links are not supported by h5repack */
if (H5Lcreate_external("file", "path", loc_id, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0)
goto out;
/*-------------------------------------------------------------------------
- * write a series of datasetes at root
- *-------------------------------------------------------------------------
- */
+ * write a series of datasetes at root
+ *-------------------------------------------------------------------------
+ */
- if ((rid = H5Gopen2(loc_id, "/", H5P_DEFAULT)) < 0)
+ if ((rid = H5Gopen2(loc_id, "/", H5P_DEFAULT)) < 0)
goto out;
if (write_dset_in(rid, "dset_referenced", loc_id, 0) < 0)
goto out;
@@ -2317,58 +2295,58 @@ out:
H5Sclose(sid);
H5Tclose(tid);
H5Pclose(gcplid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
}
-
/*-------------------------------------------------------------------------
-* Function: make_attributes
-*
-* Purpose: make a test file with all types of attributes
-*
-*-------------------------------------------------------------------------
-*/
-static
-int make_attributes(hid_t loc_id)
+ * Function: make_attributes
+ *
+ * Purpose: make a test file with all types of attributes
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+make_attributes(hid_t loc_id)
{
- hid_t did = -1;
- hid_t gid = -1;
- hid_t rid = -1;
- hid_t sid = -1;
+ hid_t did = H5I_INVALID_HID;
+ hid_t gid = H5I_INVALID_HID;
+ hid_t rid = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
hsize_t dims[1] = {2};
/*-------------------------------------------------------------------------
- * H5G_DATASET
- *-------------------------------------------------------------------------
- */
+ * H5G_DATASET
+ *-------------------------------------------------------------------------
+ */
if ((sid = H5Screate_simple(1, dims, NULL)) < 0)
goto out;
- if ((did = H5Dcreate2(loc_id, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(loc_id, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/*-------------------------------------------------------------------------
- * H5G_GROUP
- *-------------------------------------------------------------------------
- */
- if ((gid = H5Gcreate2(loc_id, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ * H5G_GROUP
+ *-------------------------------------------------------------------------
+ */
+ if ((gid = H5Gcreate2(loc_id, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
- if ((rid = H5Gopen2(loc_id, "/", H5P_DEFAULT)) < 0)
+ if ((rid = H5Gopen2(loc_id, "/", H5P_DEFAULT)) < 0)
goto out;
/*-------------------------------------------------------------------------
- * write a series of attributes on the dataset, group, and root group
- *-------------------------------------------------------------------------
- */
+ * write a series of attributes on the dataset, group, and root group
+ *-------------------------------------------------------------------------
+ */
- if ( write_attr_in(did, "dset", loc_id, 0) < 0)
+ if (write_attr_in(did, "dset", loc_id, 0) < 0)
goto out;
if (write_attr_in(gid, "dset", loc_id, 0) < 0)
goto out;
if (write_attr_in(rid, "dset", loc_id, 0) < 0)
goto out;
- /* close */
+ /* close */
if (H5Dclose(did) < 0)
goto out;
if (H5Gclose(gid) < 0)
@@ -2387,59 +2365,58 @@ out:
H5Gclose(gid);
H5Gclose(rid);
H5Sclose(sid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
-
}
/*-------------------------------------------------------------------------
-* Function: make_hlinks
-*
-* Purpose: make a test file with hard links
-*
-*-------------------------------------------------------------------------
-*/
-static
-int make_hlinks(hid_t loc_id)
+ * Function: make_hlinks
+ *
+ * Purpose: make a test file with hard links
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+make_hlinks(hid_t loc_id)
{
- hid_t g1id =- 1;
- hid_t g2id = -1;
- hid_t g3id = -1;
- hsize_t dims[2] = {3,2};
- int buf[3][2] = {{1,1}, {1,2}, {2,2}};
+ hid_t g1id = -1;
+ hid_t g2id = H5I_INVALID_HID;
+ hid_t g3id = H5I_INVALID_HID;
+ hsize_t dims[2] = {3, 2};
+ int buf[3][2] = {{1, 1}, {1, 2}, {2, 2}};
/*-------------------------------------------------------------------------
- * create a dataset and some hard links to it
- *-------------------------------------------------------------------------
- */
+ * create a dataset and some hard links to it
+ *-------------------------------------------------------------------------
+ */
- if(write_dset(loc_id, 2, dims, "dset", H5T_NATIVE_INT, buf) < 0)
+ if (write_dset(loc_id, 2, dims, "dset", H5T_NATIVE_INT, buf) < 0)
return -1;
- if(H5Lcreate_hard(loc_id, "dset", H5L_SAME_LOC, "link1 to dset", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Lcreate_hard(loc_id, "dset", H5L_SAME_LOC, "link1 to dset", H5P_DEFAULT, H5P_DEFAULT) < 0)
return -1;
- if(H5Lcreate_hard(loc_id, "dset", H5L_SAME_LOC, "link2 to dset", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Lcreate_hard(loc_id, "dset", H5L_SAME_LOC, "link2 to dset", H5P_DEFAULT, H5P_DEFAULT) < 0)
return -1;
- if(H5Lcreate_hard(loc_id, "dset", H5L_SAME_LOC, "link3 to dset", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Lcreate_hard(loc_id, "dset", H5L_SAME_LOC, "link3 to dset", H5P_DEFAULT, H5P_DEFAULT) < 0)
return -1;
/*-------------------------------------------------------------------------
- * create a group and some hard links to it
- *-------------------------------------------------------------------------
- */
+ * create a group and some hard links to it
+ *-------------------------------------------------------------------------
+ */
- if((g1id = H5Gcreate2(loc_id, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((g1id = H5Gcreate2(loc_id, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
- if((g2id = H5Gcreate2(g1id, "g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((g2id = H5Gcreate2(g1id, "g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
- if((g3id = H5Gcreate2(g2id, "g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((g3id = H5Gcreate2(g2id, "g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
- if(H5Lcreate_hard(loc_id, "g1", g2id, "link1 to g1", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Lcreate_hard(loc_id, "g1", g2id, "link1 to g1", H5P_DEFAULT, H5P_DEFAULT) < 0)
goto out;
- if(H5Lcreate_hard(g1id, "g2", g3id, "link1 to g2", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Lcreate_hard(g1id, "g2", g3id, "link1 to g2", H5P_DEFAULT, H5P_DEFAULT) < 0)
goto out;
-
/* close */
if (H5Gclose(g1id) < 0)
goto out;
@@ -2456,635 +2433,708 @@ out:
H5Gclose(g1id);
H5Gclose(g2id);
H5Gclose(g3id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
-
}
-
/*-------------------------------------------------------------------------
-* Function: make_szip
-*
-* Purpose: make a dataset with the SZIP filter
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: make_szip
+ *
+ * Purpose: make a dataset with the SZIP filter
+ *
+ *-------------------------------------------------------------------------
+ */
#ifdef H5_HAVE_FILTER_SZIP
-static
-int make_szip(hid_t loc_id)
+static int
+make_szip(hid_t loc_id)
{
- hid_t dcpl = -1; /* dataset creation property list */
- hid_t sid = -1; /* dataspace ID */
- unsigned szip_options_mask = H5_SZIP_ALLOW_K13_OPTION_MASK | H5_SZIP_NN_OPTION_MASK;
+ hid_t dcpl = H5I_INVALID_HID; /* dataset creation property list */
+ hid_t sid = H5I_INVALID_HID; /* dataspace ID */
+ unsigned szip_options_mask = H5_SZIP_ALLOW_K13_OPTION_MASK | H5_SZIP_NN_OPTION_MASK;
unsigned szip_pixels_per_block = 8;
- hsize_t dims[RANK] = {DIM1, DIM2};
- hsize_t chunk_dims[RANK] = {CDIM1, CDIM2};
- int buf[DIM1][DIM2];
- int i, j, n;
- int szip_can_encode = 0;
-
- for (i = n = 0; i < DIM1; i++) {
- for (j = 0; j < DIM2; j++) {
- buf[i][j] = n++;
- }
- }
+ hsize_t dims[RANK] = {DIM1, DIM2};
+ hsize_t chunk_dims[RANK] = {CDIM1, CDIM2};
+ int szip_can_encode = 0;
+
+ /* Create and fill array */
+ struct {
+ int arr[DIM1][DIM2];
+ } *buf = malloc(sizeof(*buf));
+ if (NULL == buf)
+ goto error;
+ H5TEST_FILL_2D_HEAP_ARRAY(buf, int);
+
/* create a space */
- if((sid = H5Screate_simple(RANK, dims, NULL)) < 0)
- return -1;
+ if ((sid = H5Screate_simple(RANK, dims, NULL)) < 0)
+ goto error;
/* create a dcpl */
if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- goto out;
+ goto error;
/* set up chunk */
- if(H5Pset_chunk(dcpl, RANK, chunk_dims) < 0)
- goto out;
+ if (H5Pset_chunk(dcpl, RANK, chunk_dims) < 0)
+ goto error;
/*-------------------------------------------------------------------------
- * SZIP
- *-------------------------------------------------------------------------
- */
+ * SZIP
+ *-------------------------------------------------------------------------
+ */
/* Make sure encoding is enabled */
if (h5tools_can_encode(H5Z_FILTER_SZIP) == 1)
szip_can_encode = 1;
if (szip_can_encode) {
/* set szip data */
- if(H5Pset_szip (dcpl, szip_options_mask, szip_pixels_per_block) < 0)
- goto out;
+ if (H5Pset_szip(dcpl, szip_options_mask, szip_pixels_per_block) < 0)
+ goto error;
if (make_dset(loc_id, "dset_szip", sid, dcpl, buf) < 0)
- goto out;
+ goto error;
}
else
/* WARNING? SZIP is decoder only, can't generate test files */
- if(H5Sclose(sid) < 0)
- goto out;
- if(H5Pclose(dcpl) < 0)
- goto out;
+ if (H5Sclose(sid) < 0)
+ goto error;
+ if (H5Pclose(dcpl) < 0)
+ goto error;
+
+ HDfree(buf);
return 0;
-out:
- H5E_BEGIN_TRY {
+error:
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Sclose(sid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
+
+ HDfree(buf);
+
return -1;
}
#endif /* H5_HAVE_FILTER_SZIP */
-
-
/*-------------------------------------------------------------------------
-* Function: make_deflate
-*
-* Purpose: make a dataset with the deflate filter
-*
-*-------------------------------------------------------------------------
-*/
-static
-int make_deflate(hid_t loc_id)
+ * Function: make_deflate
+ *
+ * Purpose: make a dataset with the deflate filter
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+make_deflate(hid_t loc_id)
{
- hid_t dcpl = -1; /* dataset creation property list */
- hid_t sid = -1; /* dataspace ID */
- hsize_t dims[RANK] = {DIM1,DIM2};
- hsize_t chunk_dims[RANK] = {CDIM1,CDIM2};
- int buf[DIM1][DIM2];
+ hid_t dcpl = H5I_INVALID_HID; /* dataset creation property list */
+ hid_t sid = H5I_INVALID_HID; /* dataspace ID */
+ hsize_t dims[RANK] = {DIM1, DIM2};
+ hsize_t chunk_dims[RANK] = {CDIM1, CDIM2};
hobj_ref_t bufref[1]; /* reference */
hsize_t dims1r[1] = {1};
- int i, j, n;
- for (i = n = 0; i < DIM1; i++) {
- for (j = 0; j < DIM2; j++) {
- buf[i][j] = n++;
- }
- }
+ /* Create and fill array */
+ struct {
+ int arr[DIM1][DIM2];
+ } *buf = malloc(sizeof(*buf));
+ if (NULL == buf)
+ goto error;
+ H5TEST_FILL_2D_HEAP_ARRAY(buf, int);
/* create a space */
- if((sid = H5Screate_simple(RANK, dims, NULL)) < 0)
- return -1;
+ if ((sid = H5Screate_simple(RANK, dims, NULL)) < 0)
+ goto error;
/* create a dcpl */
if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- goto out;
+ goto error;
/* set up chunk */
- if(H5Pset_chunk(dcpl, RANK, chunk_dims) < 0)
- goto out;
+ if (H5Pset_chunk(dcpl, RANK, chunk_dims) < 0)
+ goto error;
- /*-------------------------------------------------------------------------
- * GZIP
- *-------------------------------------------------------------------------
- */
-#if defined (H5_HAVE_FILTER_DEFLATE)
+ /*-------------------------------------------------------------------------
+ * GZIP
+ *-------------------------------------------------------------------------
+ */
+#if defined(H5_HAVE_FILTER_DEFLATE)
/* set deflate data */
- if(H5Pset_deflate(dcpl, 9) < 0)
- goto out;
+ if (H5Pset_deflate(dcpl, 9) < 0)
+ goto error;
if (make_dset(loc_id, "dset_deflate", sid, dcpl, buf) < 0)
- goto out;
+ goto error;
/* create a reference to the dataset, test second seeep of file for references */
if (H5Rcreate(&bufref[0], loc_id, "dset_deflate", H5R_OBJECT, (hid_t)-1) < 0)
- goto out;
+ goto error;
if (write_dset(loc_id, 1, dims1r, "ref", H5T_STD_REF_OBJ, bufref) < 0)
- goto out;
+ goto error;
#endif
-
/*-------------------------------------------------------------------------
- * close space and dcpl
- *-------------------------------------------------------------------------
- */
- if(H5Sclose(sid) < 0)
- goto out;
- if(H5Pclose(dcpl) < 0)
- goto out;
+ * close space and dcpl
+ *-------------------------------------------------------------------------
+ */
+ if (H5Sclose(sid) < 0)
+ goto error;
+ if (H5Pclose(dcpl) < 0)
+ goto error;
+
+ HDfree(buf);
return 0;
-out:
- H5E_BEGIN_TRY {
+error:
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Sclose(sid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
+
+ HDfree(buf);
+
return -1;
}
-
/*-------------------------------------------------------------------------
-* Function: make_shuffle
-*
-* Purpose: make a dataset with the shuffle filter
-*
-*-------------------------------------------------------------------------
-*/
-static
-int make_shuffle(hid_t loc_id)
+ * Function: make_shuffle
+ *
+ * Purpose: make a dataset with the shuffle filter
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+make_shuffle(hid_t loc_id)
{
- hid_t dcpl; /* dataset creation property list */
- hid_t sid; /* dataspace ID */
- hsize_t dims[RANK]={DIM1,DIM2};
- hsize_t chunk_dims[RANK]={CDIM1,CDIM2};
- int buf[DIM1][DIM2];
- int i, j, n;
-
- for (i=n=0; i<DIM1; i++)
- {
- for (j=0; j<DIM2; j++)
- {
- buf[i][j]=n++;
- }
- }
+ hid_t dcpl = H5I_INVALID_HID; /* dataset creation property list */
+ hid_t sid = H5I_INVALID_HID; /* dataspace ID */
+ hsize_t dims[RANK] = {DIM1, DIM2};
+ hsize_t chunk_dims[RANK] = {CDIM1, CDIM2};
+
+ /* Create and fill array */
+ struct {
+ int arr[DIM1][DIM2];
+ } *buf = malloc(sizeof(*buf));
+ if (NULL == buf)
+ goto error;
+ H5TEST_FILL_2D_HEAP_ARRAY(buf, int);
+
/* create a space */
- if((sid = H5Screate_simple(RANK, dims, NULL)) < 0)
- return -1;
+ if ((sid = H5Screate_simple(RANK, dims, NULL)) < 0)
+ goto error;
/* create a dcpl */
if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- goto out;
+ goto error;
/* set up chunk */
- if(H5Pset_chunk(dcpl, RANK, chunk_dims) < 0)
- goto out;
+ if (H5Pset_chunk(dcpl, RANK, chunk_dims) < 0)
+ goto error;
/*-------------------------------------------------------------------------
- * shuffle
- *-------------------------------------------------------------------------
- */
+ * shuffle
+ *-------------------------------------------------------------------------
+ */
/* set the shuffle filter */
if (H5Pset_shuffle(dcpl) < 0)
- goto out;
- if (make_dset(loc_id,"dset_shuffle",sid,dcpl,buf) < 0)
- goto out;
-
+ goto error;
+ if (make_dset(loc_id, "dset_shuffle", sid, dcpl, buf) < 0)
+ goto error;
/*-------------------------------------------------------------------------
- * close space and dcpl
- *-------------------------------------------------------------------------
- */
- if(H5Sclose(sid) < 0)
- goto out;
- if(H5Pclose(dcpl) < 0)
- goto out;
+ * close space and dcpl
+ *-------------------------------------------------------------------------
+ */
+ if (H5Sclose(sid) < 0)
+ goto error;
+ if (H5Pclose(dcpl) < 0)
+ goto error;
+
+ HDfree(buf);
return 0;
-out:
- H5E_BEGIN_TRY {
+error:
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Sclose(sid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
+
+ HDfree(buf);
+
return -1;
}
/*-------------------------------------------------------------------------
-* Function: make_fletcher32
-*
-* Purpose: make a dataset with the fletcher32 filter
-*
-*-------------------------------------------------------------------------
-*/
-static
-int make_fletcher32(hid_t loc_id)
+ * Function: make_fletcher32
+ *
+ * Purpose: make a dataset with the fletcher32 filter
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+make_fletcher32(hid_t loc_id)
{
- hid_t dcpl = -1; /* dataset creation property list */
- hid_t sid = -1; /* dataspace ID */
- hsize_t dims[RANK]={DIM1,DIM2};
- hsize_t chunk_dims[RANK]={CDIM1,CDIM2};
- int buf[DIM1][DIM2];
- int i, j, n;
-
- for (i = n = 0; i < DIM1; i++) {
- for (j = 0; j < DIM2; j++) {
- buf[i][j] = n++;
- }
- }
+ hid_t dcpl = H5I_INVALID_HID; /* dataset creation property list */
+ hid_t sid = H5I_INVALID_HID; /* dataspace ID */
+ hsize_t dims[RANK] = {DIM1, DIM2};
+ hsize_t chunk_dims[RANK] = {CDIM1, CDIM2};
+
+ /* Create and fill array */
+ struct {
+ int arr[DIM1][DIM2];
+ } *buf = malloc(sizeof(*buf));
+ if (NULL == buf)
+ goto error;
+ H5TEST_FILL_2D_HEAP_ARRAY(buf, int);
+
/* create a space */
- if((sid = H5Screate_simple(RANK, dims, NULL)) < 0)
- return -1;
+ if ((sid = H5Screate_simple(RANK, dims, NULL)) < 0)
+ goto error;
/* create a dataset creation property list; the same DCPL is used for all dsets */
if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- goto out;
+ goto error;
/* set up chunk */
- if(H5Pset_chunk(dcpl, RANK, chunk_dims) < 0)
- goto out;
-
+ if (H5Pset_chunk(dcpl, RANK, chunk_dims) < 0)
+ goto error;
/*-------------------------------------------------------------------------
- * fletcher32
- *-------------------------------------------------------------------------
- */
+ * fletcher32
+ *-------------------------------------------------------------------------
+ */
/* remove the filters from the dcpl */
- if (H5Premove_filter(dcpl,H5Z_FILTER_ALL) < 0)
- goto out;
+ if (H5Premove_filter(dcpl, H5Z_FILTER_ALL) < 0)
+ goto error;
/* set the checksum filter */
if (H5Pset_fletcher32(dcpl) < 0)
- goto out;
- if (make_dset(loc_id,"dset_fletcher32",sid,dcpl,buf) < 0)
- goto out;
+ goto error;
+ if (make_dset(loc_id, "dset_fletcher32", sid, dcpl, buf) < 0)
+ goto error;
/*-------------------------------------------------------------------------
- * close space and dcpl
- *-------------------------------------------------------------------------
- */
- if(H5Sclose(sid) < 0)
- goto out;
- if(H5Pclose(dcpl) < 0)
- goto out;
+ * close space and dcpl
+ *-------------------------------------------------------------------------
+ */
+ if (H5Sclose(sid) < 0)
+ goto error;
+ if (H5Pclose(dcpl) < 0)
+ goto error;
+
+ HDfree(buf);
return 0;
-out:
- H5E_BEGIN_TRY {
+error:
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Sclose(sid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
+
+ HDfree(buf);
+
return -1;
}
-
/*-------------------------------------------------------------------------
-* Function: make_nbit
-*
-* Purpose: make a dataset with the nbit filter
-*
-*-------------------------------------------------------------------------
-*/
-static
-int make_nbit(hid_t loc_id)
+ * Function: make_nbit
+ *
+ * Purpose: make a dataset with the nbit filter
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+make_nbit(hid_t loc_id)
{
- hid_t dcpl = -1; /* dataset creation property list */
- hid_t sid = -1; /* dataspace ID */
- hid_t dtid = -1;
- hid_t dsid = -1;
- hsize_t dims[RANK]={DIM1,DIM2};
- hsize_t chunk_dims[RANK]={CDIM1,CDIM2};
- int buf[DIM1][DIM2];
- int i, j, n;
-
- for (i = n = 0; i < DIM1; i++) {
- for (j = 0; j < DIM2; j++) {
- buf[i][j] = n++;
- }
- }
+ hid_t dcpl = H5I_INVALID_HID; /* dataset creation property list */
+ hid_t sid = H5I_INVALID_HID; /* dataspace ID */
+ hid_t dtid = H5I_INVALID_HID;
+ hid_t dsid = H5I_INVALID_HID;
+ hid_t dxpl = H5P_DEFAULT;
+ hsize_t dims[RANK] = {DIM1, DIM2};
+ hsize_t chunk_dims[RANK] = {CDIM1, CDIM2};
+
+ /* Create and fill array */
+ struct {
+ int arr[DIM1][DIM2];
+ } *buf = malloc(sizeof(*buf));
+ if (NULL == buf)
+ goto error;
+ H5TEST_FILL_2D_HEAP_ARRAY(buf, int);
+
/* create a space */
- if((sid = H5Screate_simple(RANK, dims, NULL)) < 0)
- return -1;
+ if ((sid = H5Screate_simple(RANK, dims, NULL)) < 0)
+ goto error;
/* create a dataset creation property list; the same DCPL is used for all dsets */
if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- goto out;
+ goto error;
/* set up chunk */
- if(H5Pset_chunk(dcpl, RANK, chunk_dims) < 0)
- goto out;
+ if (H5Pset_chunk(dcpl, RANK, chunk_dims) < 0)
+ goto error;
+
+#ifdef H5_HAVE_PARALLEL
+ /* Set up collective writes for parallel driver */
+ if (h5_using_parallel_driver(NULL)) {
+ if ((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ goto error;
+ if (H5Pset_dxpl_mpio(dxpl, H5FD_MPIO_COLLECTIVE) < 0)
+ goto error;
+ }
+#endif
dtid = H5Tcopy(H5T_NATIVE_INT);
- if (H5Tset_precision(dtid,(H5Tget_precision(dtid) - 1)) < 0)
- goto out;
+ if (H5Tset_precision(dtid, (H5Tget_precision(dtid) - 1)) < 0)
+ goto error;
/* remove the filters from the dcpl */
- if(H5Premove_filter(dcpl, H5Z_FILTER_ALL) < 0)
- goto out;
- if(H5Pset_nbit(dcpl) < 0)
- goto out;
- if((dsid = H5Dcreate2(loc_id, "dset_nbit", dtid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
- goto out;
- if(H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
- goto out;
+ if (H5Premove_filter(dcpl, H5Z_FILTER_ALL) < 0)
+ goto error;
+ if (H5Pset_nbit(dcpl) < 0)
+ goto error;
+ if ((dsid = H5Dcreate2(loc_id, "dset_nbit", dtid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
+ if (H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, dxpl, buf) < 0)
+ goto error;
H5Dclose(dsid);
- if(H5Premove_filter(dcpl, H5Z_FILTER_ALL) < 0)
- goto out;
- if((dsid = H5Dcreate2(loc_id, "dset_int31", dtid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
- goto out;
- if(H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
- goto out;
+ if (H5Premove_filter(dcpl, H5Z_FILTER_ALL) < 0)
+ goto error;
+ if ((dsid = H5Dcreate2(loc_id, "dset_int31", dtid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
+ if (H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, dxpl, buf) < 0)
+ goto error;
H5Dclose(dsid);
/*-------------------------------------------------------------------------
- * close
- *-------------------------------------------------------------------------
- */
- if(H5Sclose(sid) < 0)
- goto out;
- if(H5Pclose(dcpl) < 0)
- goto out;
+ * close
+ *-------------------------------------------------------------------------
+ */
+ if (dxpl != H5P_DEFAULT && H5Pclose(dxpl) < 0)
+ goto error;
+ if (H5Sclose(sid) < 0)
+ goto error;
+ if (H5Pclose(dcpl) < 0)
+ goto error;
if (H5Tclose(dtid) < 0)
- goto out;
+ goto error;
+
+ HDfree(buf);
return 0;
-out:
- H5E_BEGIN_TRY {
+error:
+ H5E_BEGIN_TRY
+ {
H5Tclose(dtid);
+ H5Pclose(dxpl);
H5Pclose(dcpl);
H5Sclose(sid);
H5Dclose(dsid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
+
+ HDfree(buf);
+
return -1;
}
-
/*-------------------------------------------------------------------------
-* Function: make_scaleoffset
-*
-* Purpose: make a dataset with the scaleoffset filter
-*
-*-------------------------------------------------------------------------
-*/
-static
-int make_scaleoffset(hid_t loc_id)
+ * Function: make_scaleoffset
+ *
+ * Purpose: make a dataset with the scaleoffset filter
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+make_scaleoffset(hid_t loc_id)
{
- hid_t dcpl = -1; /* dataset creation property list */
- hid_t sid = -1; /* dataspace ID */
- hid_t dtid = -1;
- hid_t dsid = -1;
- hsize_t dims[RANK] = {DIM1,DIM2};
- hsize_t chunk_dims[RANK] = {CDIM1,CDIM2};
- int buf[DIM1][DIM2];
- int i, j, n;
-
- for (i = n = 0; i < DIM1; i++) {
- for (j = 0; j < DIM2; j++) {
- buf[i][j] = n++;
- }
- }
+ hid_t dcpl = H5I_INVALID_HID; /* dataset creation property list */
+ hid_t sid = H5I_INVALID_HID; /* dataspace ID */
+ hid_t dtid = H5I_INVALID_HID;
+ hid_t dsid = H5I_INVALID_HID;
+ hid_t dxpl = H5P_DEFAULT;
+ hsize_t dims[RANK] = {DIM1, DIM2};
+ hsize_t chunk_dims[RANK] = {CDIM1, CDIM2};
+
+ /* Create and fill array */
+ struct {
+ int arr[DIM1][DIM2];
+ } *buf = malloc(sizeof(*buf));
+ if (NULL == buf)
+ goto error;
+ H5TEST_FILL_2D_HEAP_ARRAY(buf, int);
+
/* create a space */
- if((sid = H5Screate_simple(RANK, dims, NULL)) < 0)
- return -1;
+ if ((sid = H5Screate_simple(RANK, dims, NULL)) < 0)
+ goto error;
/* create a dataset creation property list; the same DCPL is used for all dsets */
if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- goto out;
+ goto error;
/* set up chunk */
- if(H5Pset_chunk(dcpl, RANK, chunk_dims) < 0)
- goto out;
+ if (H5Pset_chunk(dcpl, RANK, chunk_dims) < 0)
+ goto error;
+
+#ifdef H5_HAVE_PARALLEL
+ /* Set up collective writes for parallel driver */
+ if (h5_using_parallel_driver(NULL)) {
+ if ((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ goto error;
+ if (H5Pset_dxpl_mpio(dxpl, H5FD_MPIO_COLLECTIVE) < 0)
+ goto error;
+ }
+#endif
dtid = H5Tcopy(H5T_NATIVE_INT);
/* remove the filters from the dcpl */
- if(H5Premove_filter(dcpl, H5Z_FILTER_ALL) < 0)
- goto out;
- if(H5Pset_scaleoffset(dcpl, H5Z_SO_INT, 31) < 0)
- goto out;
- if((dsid = H5Dcreate2(loc_id, "dset_scaleoffset", dtid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
- goto out;
- if(H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
- goto out;
+ if (H5Premove_filter(dcpl, H5Z_FILTER_ALL) < 0)
+ goto error;
+ if (H5Pset_scaleoffset(dcpl, H5Z_SO_INT, 31) < 0)
+ goto error;
+ if ((dsid = H5Dcreate2(loc_id, "dset_scaleoffset", dtid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
+ if (H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, dxpl, buf) < 0)
+ goto error;
H5Dclose(dsid);
- if((dsid = H5Dcreate2(loc_id, "dset_none", dtid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto out;
- if(H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
- goto out;
+ if ((dsid = H5Dcreate2(loc_id, "dset_none", dtid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+ if (H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, dxpl, buf) < 0)
+ goto error;
H5Tclose(dtid);
H5Dclose(dsid);
/*-------------------------------------------------------------------------
- * close space and dcpl
- *-------------------------------------------------------------------------
- */
- if(H5Sclose(sid) < 0)
- goto out;
- if(H5Pclose(dcpl) < 0)
- goto out;
+ * close space, dxpl and dcpl
+ *-------------------------------------------------------------------------
+ */
+ if (dxpl != H5P_DEFAULT && H5Pclose(dxpl) < 0)
+ goto error;
+ if (H5Sclose(sid) < 0)
+ goto error;
+ if (H5Pclose(dcpl) < 0)
+ goto error;
+
+ HDfree(buf);
return 0;
-out:
- H5E_BEGIN_TRY {
+error:
+ H5E_BEGIN_TRY
+ {
+ H5Pclose(dxpl);
H5Dclose(dsid);
H5Tclose(dtid);
H5Pclose(dcpl);
H5Sclose(sid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
+
+ HDfree(buf);
+
return -1;
}
-
/*-------------------------------------------------------------------------
-* Function: make_all_filters
-*
-* Purpose: make a file with all filters
-*
-*-------------------------------------------------------------------------
-*/
-static
-int make_all_filters(hid_t loc_id)
+ * Function: make_all_filters
+ *
+ * Purpose: make a file with all filters
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+make_all_filters(hid_t loc_id)
{
- hid_t dcpl = H5I_INVALID_HID; /* dataset creation property list */
- hid_t sid = H5I_INVALID_HID; /* dataspace ID */
- hid_t dtid = H5I_INVALID_HID;
- hid_t dsid = H5I_INVALID_HID;
-#if defined (H5_HAVE_FILTER_SZIP)
- unsigned szip_options_mask=H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_NN_OPTION_MASK;
- unsigned szip_pixels_per_block=8;
+ hid_t dcpl = H5I_INVALID_HID; /* dataset creation property list */
+ hid_t sid = H5I_INVALID_HID; /* dataspace ID */
+ hid_t dtid = H5I_INVALID_HID;
+ hid_t dsid = H5I_INVALID_HID;
+ hid_t dxpl = H5P_DEFAULT;
+#if defined(H5_HAVE_FILTER_SZIP)
+ unsigned szip_options_mask = H5_SZIP_ALLOW_K13_OPTION_MASK | H5_SZIP_NN_OPTION_MASK;
+ unsigned szip_pixels_per_block = 8;
#endif /* H5_HAVE_FILTER_SZIP */
- hsize_t dims[RANK]={DIM1,DIM2};
- hsize_t chunk_dims[RANK]={CDIM1,CDIM2};
- int buf[DIM1][DIM2];
- int i, j, n;
-#if defined (H5_HAVE_FILTER_SZIP)
+ hsize_t dims[RANK] = {DIM1, DIM2};
+ hsize_t chunk_dims[RANK] = {CDIM1, CDIM2};
+#if defined(H5_HAVE_FILTER_SZIP)
int szip_can_encode = 0;
#endif
- for (i=n=0; i<DIM1; i++)
- {
- for (j=0; j<DIM2; j++)
- {
- buf[i][j]=n++;
- }
- }
+ /* Create and fill array */
+ struct {
+ int arr[DIM1][DIM2];
+ } *buf = malloc(sizeof(*buf));
+ if (NULL == buf)
+ goto error;
+ H5TEST_FILL_2D_HEAP_ARRAY(buf, int);
+
/* create a space */
- if((sid = H5Screate_simple(RANK, dims, NULL)) < 0)
- return -1;
+ if ((sid = H5Screate_simple(RANK, dims, NULL)) < 0)
+ goto error;
/* create a dataset creation property list; the same DCPL is used for all dsets */
if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- goto out;
+ goto error;
/* set up chunk */
if (H5Pset_chunk(dcpl, RANK, chunk_dims) < 0)
- goto out;
+ goto error;
+
+#ifdef H5_HAVE_PARALLEL
+ /* Set up collective writes for parallel driver */
+ if (h5_using_parallel_driver(NULL)) {
+ if ((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ goto error;
+ if (H5Pset_dxpl_mpio(dxpl, H5FD_MPIO_COLLECTIVE) < 0)
+ goto error;
+ }
+#endif
/* set the shuffle filter */
if (H5Pset_shuffle(dcpl) < 0)
- goto out;
+ goto error;
/* set the checksum filter */
if (H5Pset_fletcher32(dcpl) < 0)
- goto out;
+ goto error;
-#if defined (H5_HAVE_FILTER_SZIP)
- if (h5tools_can_encode(H5Z_FILTER_SZIP) == 1)
- {
+#if defined(H5_HAVE_FILTER_SZIP)
+ if (h5tools_can_encode(H5Z_FILTER_SZIP) == 1) {
szip_can_encode = 1;
}
- if (szip_can_encode)
- {
+ if (szip_can_encode) {
/* set szip data */
- if(H5Pset_szip (dcpl,szip_options_mask,szip_pixels_per_block) < 0)
- goto out;
- } else {
+ if (H5Pset_szip(dcpl, szip_options_mask, szip_pixels_per_block) < 0)
+ goto error;
+ }
+ else {
/* WARNING? SZIP is decoder only, can't generate test data using szip */
}
#endif
-#if defined (H5_HAVE_FILTER_DEFLATE)
+#if defined(H5_HAVE_FILTER_DEFLATE)
/* set deflate data */
- if(H5Pset_deflate(dcpl, 9) < 0)
- goto out;
+ if (H5Pset_deflate(dcpl, 9) < 0)
+ goto error;
#endif
- if (make_dset(loc_id,"dset_all",sid,dcpl,buf) < 0)
- goto out;
+ if (make_dset(loc_id, "dset_all", sid, dcpl, buf) < 0)
+ goto error;
/* remove the filters from the dcpl */
- if (H5Premove_filter(dcpl,H5Z_FILTER_ALL) < 0)
- goto out;
+ if (H5Premove_filter(dcpl, H5Z_FILTER_ALL) < 0)
+ goto error;
/* set the checksum filter */
if (H5Pset_fletcher32(dcpl) < 0)
- goto out;
- if (make_dset(loc_id,"dset_fletcher32",sid,dcpl,buf) < 0)
- goto out;
-
+ goto error;
+ if (make_dset(loc_id, "dset_fletcher32", sid, dcpl, buf) < 0)
+ goto error;
- /* Make sure encoding is enabled */
-#if defined (H5_HAVE_FILTER_SZIP)
- if (szip_can_encode)
- {
+ /* Make sure encoding is enabled */
+#if defined(H5_HAVE_FILTER_SZIP)
+ if (szip_can_encode) {
/* remove the filters from the dcpl */
- if (H5Premove_filter(dcpl,H5Z_FILTER_ALL) < 0)
- goto out;
+ if (H5Premove_filter(dcpl, H5Z_FILTER_ALL) < 0)
+ goto error;
/* set szip data */
- if(H5Pset_szip (dcpl,szip_options_mask,szip_pixels_per_block) < 0)
- goto out;
- if (make_dset(loc_id,"dset_szip",sid,dcpl,buf) < 0)
- goto out;
- } else
- {
+ if (H5Pset_szip(dcpl, szip_options_mask, szip_pixels_per_block) < 0)
+ goto error;
+ if (make_dset(loc_id, "dset_szip", sid, dcpl, buf) < 0)
+ goto error;
+ }
+ else {
/* WARNING? SZIP is decoder only, can't generate test dataset */
}
#endif
-
/* remove the filters from the dcpl */
- if (H5Premove_filter(dcpl,H5Z_FILTER_ALL) < 0)
- goto out;
+ if (H5Premove_filter(dcpl, H5Z_FILTER_ALL) < 0)
+ goto error;
/* set the shuffle filter */
if (H5Pset_shuffle(dcpl) < 0)
- goto out;
- if (make_dset(loc_id,"dset_shuffle",sid,dcpl,buf) < 0)
- goto out;
+ goto error;
+ if (make_dset(loc_id, "dset_shuffle", sid, dcpl, buf) < 0)
+ goto error;
-
-#if defined (H5_HAVE_FILTER_DEFLATE)
+#if defined(H5_HAVE_FILTER_DEFLATE)
/* remove the filters from the dcpl */
- if (H5Premove_filter(dcpl,H5Z_FILTER_ALL) < 0)
- goto out;
+ if (H5Premove_filter(dcpl, H5Z_FILTER_ALL) < 0)
+ goto error;
/* set deflate data */
- if(H5Pset_deflate(dcpl, 1) < 0)
- goto out;
- if (make_dset(loc_id,"dset_deflate",sid,dcpl,buf) < 0)
- goto out;
+ if (H5Pset_deflate(dcpl, 1) < 0)
+ goto error;
+ if (make_dset(loc_id, "dset_deflate", sid, dcpl, buf) < 0)
+ goto error;
#endif
-
-
/* remove the filters from the dcpl */
if (H5Premove_filter(dcpl, H5Z_FILTER_ALL) < 0)
- goto out;
+ goto error;
/* set the shuffle filter */
if (H5Pset_nbit(dcpl) < 0)
- goto out;
+ goto error;
if ((dtid = H5Tcopy(H5T_NATIVE_INT)) < 0)
- goto out;
+ goto error;
if (H5Tset_precision(dtid, (H5Tget_precision(dtid) - 1)) < 0)
- goto out;
- if((dsid = H5Dcreate2(loc_id, "dset_nbit", dtid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
- goto out;
- if(H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
- goto out;
+ goto error;
+ if ((dsid = H5Dcreate2(loc_id, "dset_nbit", dtid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
+ if (H5Dwrite(dsid, dtid, H5S_ALL, H5S_ALL, dxpl, buf) < 0)
+ goto error;
/* close */
- if(H5Tclose(dtid) < 0)
- goto out;
- if(H5Dclose(dsid) < 0)
- goto out;
+ if (H5Tclose(dtid) < 0)
+ goto error;
+ if (H5Dclose(dsid) < 0)
+ goto error;
- if(H5Sclose(sid) < 0)
- goto out;
- if(H5Pclose(dcpl) < 0)
- goto out;
+ if (H5Sclose(sid) < 0)
+ goto error;
+ if (dxpl != H5P_DEFAULT && H5Pclose(dxpl) < 0)
+ goto error;
+ if (H5Pclose(dcpl) < 0)
+ goto error;
+
+ HDfree(buf);
return 0;
-out:
+error:
H5E_BEGIN_TRY
{
H5Tclose(dtid);
H5Dclose(dsid);
+ H5Pclose(dxpl);
H5Pclose(dcpl);
H5Sclose(sid);
- } H5E_END_TRY;
- return -1;
-}
+ }
+ H5E_END_TRY;
+ HDfree(buf);
+ return -1;
+}
/*-------------------------------------------------------------------------
-* Function: make_early
-*
-* Purpose: create a file for the H5D_ALLOC_TIME_EARLY test
-*
-*-------------------------------------------------------------------------
-*/
-static
-int make_early(void)
+ * Function: make_early
+ *
+ * Purpose: create a file for the H5D_ALLOC_TIME_EARLY test
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+make_early(void)
{
- hsize_t dims[1] ={3000};
- hsize_t cdims[1]={30};
- hid_t fid=-1;
- hid_t did=-1;
- hid_t sid=-1;
- hid_t tid=-1;
- hid_t dcpl=-1;
+ hsize_t dims[1] = {3000};
+ hsize_t cdims[1] = {30};
+ hid_t fid = H5I_INVALID_HID;
+ hid_t did = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ hid_t tid = H5I_INVALID_HID;
+ hid_t dcpl = H5I_INVALID_HID;
int i;
char name[16];
- int iter=100;
+ int iter = 100;
if ((fid = H5Fcreate(FNAME5, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
@@ -3100,8 +3150,7 @@ int make_early(void)
if (H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY) < 0)
goto out;
- for(i = 0; i < iter; i++)
- {
+ for (i = 0; i < iter; i++) {
if ((fid = H5Fopen(FNAME5, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
goto out;
if ((did = H5Dcreate2(fid, "early", H5T_NATIVE_DOUBLE, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
@@ -3122,15 +3171,14 @@ int make_early(void)
}
/*-------------------------------------------------------------------------
- * do the same without close/opening the file and creating the dataset
- *-------------------------------------------------------------------------
- */
+ * do the same without close/opening the file and creating the dataset
+ *-------------------------------------------------------------------------
+ */
if ((fid = H5Fcreate(FNAME6, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
- for(i = 0; i < iter; i++)
- {
+ for (i = 0; i < iter; i++) {
if ((tid = H5Tcopy(H5T_NATIVE_DOUBLE)) < 0)
goto out;
HDsprintf(name, "%d", i);
@@ -3157,113 +3205,107 @@ out:
H5Sclose(sid);
H5Dclose(did);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
}
-
/*-------------------------------------------------------------------------
-* Function: make_layout
-*
-* Purpose: make several datasets with several layouts in location LOC_ID
-*
-*-------------------------------------------------------------------------
-*/
-static
-int make_layout(hid_t loc_id)
+ * Function: make_layout
+ *
+ * Purpose: make several datasets with several layouts in location LOC_ID
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+make_layout(hid_t loc_id)
{
- hid_t dcpl=-1; /* dataset creation property list */
- hid_t sid=-1; /* dataspace ID */
- hsize_t dims[RANK]={DIM1,DIM2};
- hsize_t chunk_dims[RANK]={CDIM1,CDIM2};
- int buf[DIM1][DIM2];
- int i, j, n;
- char name[16];
-
+ hid_t dcpl = H5I_INVALID_HID; /* dataset creation property list */
+ hid_t sid = H5I_INVALID_HID; /* dataspace ID */
+ hsize_t dims[RANK] = {DIM1, DIM2};
+ hsize_t chunk_dims[RANK] = {CDIM1, CDIM2};
+ int i;
+ char name[16];
- for (i=n=0; i<DIM1; i++)
- {
- for (j=0; j<DIM2; j++)
- {
- buf[i][j]=n++;
- }
- }
+ /* Create and fill array */
+ struct {
+ int arr[DIM1][DIM2];
+ } *buf = malloc(sizeof(*buf));
+ if (NULL == buf)
+ goto error;
+ H5TEST_FILL_2D_HEAP_ARRAY(buf, int);
/*-------------------------------------------------------------------------
- * make several dataset with no filters
- *-------------------------------------------------------------------------
- */
- for (i=0; i<4; i++)
- {
- HDsprintf(name,"dset%d",i+1);
- if (write_dset(loc_id,RANK,dims,name,H5T_NATIVE_INT,buf) < 0)
- return -1;
+ * make several dataset with no filters
+ *-------------------------------------------------------------------------
+ */
+ for (i = 0; i < 4; i++) {
+ HDsprintf(name, "dset%d", i + 1);
+ if (write_dset(loc_id, RANK, dims, name, H5T_NATIVE_INT, buf) < 0)
+ goto error;
}
-
/*-------------------------------------------------------------------------
- * make several dataset with several layout options
- *-------------------------------------------------------------------------
- */
+ * make several dataset with several layout options
+ *-------------------------------------------------------------------------
+ */
/* create a space */
- if((sid = H5Screate_simple(RANK, dims, NULL)) < 0)
- return -1;
+ if ((sid = H5Screate_simple(RANK, dims, NULL)) < 0)
+ goto error;
/* create a dataset creation property list; the same DCPL is used for all dsets */
if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- {
- goto out;
- }
+ goto error;
/*-------------------------------------------------------------------------
- * H5D_COMPACT
- *-------------------------------------------------------------------------
- */
- if(H5Pset_layout (dcpl,H5D_COMPACT) < 0)
- goto out;
- if (make_dset(loc_id,"dset_compact",sid,dcpl,buf) < 0)
- {
- goto out;
- }
+ * H5D_COMPACT
+ *-------------------------------------------------------------------------
+ */
+ if (H5Pset_layout(dcpl, H5D_COMPACT) < 0)
+ goto error;
+ if (make_dset(loc_id, "dset_compact", sid, dcpl, buf) < 0)
+ goto error;
/*-------------------------------------------------------------------------
- * H5D_CONTIGUOUS
- *-------------------------------------------------------------------------
- */
- if(H5Pset_layout (dcpl,H5D_CONTIGUOUS) < 0)
- goto out;
- if (make_dset(loc_id,"dset_contiguous",sid,dcpl,buf) < 0)
- {
- goto out;
- }
+ * H5D_CONTIGUOUS
+ *-------------------------------------------------------------------------
+ */
+ if (H5Pset_layout(dcpl, H5D_CONTIGUOUS) < 0)
+ goto error;
+ if (make_dset(loc_id, "dset_contiguous", sid, dcpl, buf) < 0)
+ goto error;
/*-------------------------------------------------------------------------
- * H5D_CHUNKED
- *-------------------------------------------------------------------------
- */
- if(H5Pset_chunk(dcpl, RANK, chunk_dims) < 0)
- goto out;
- if (make_dset(loc_id,"dset_chunk",sid,dcpl,buf) < 0)
- {
- goto out;
- }
+ * H5D_CHUNKED
+ *-------------------------------------------------------------------------
+ */
+ if (H5Pset_chunk(dcpl, RANK, chunk_dims) < 0)
+ goto error;
+ if (make_dset(loc_id, "dset_chunk", sid, dcpl, buf) < 0)
+ goto error;
/*-------------------------------------------------------------------------
- * close space and dcpl
- *-------------------------------------------------------------------------
- */
- if(H5Sclose(sid) < 0)
- goto out;
- if(H5Pclose(dcpl) < 0)
- goto out;
+ * close space and dcpl
+ *-------------------------------------------------------------------------
+ */
+ if (H5Sclose(sid) < 0)
+ goto error;
+ if (H5Pclose(dcpl) < 0)
+ goto error;
+
+ HDfree(buf);
return 0;
-out:
+error:
H5E_BEGIN_TRY
{
H5Pclose(dcpl);
H5Sclose(sid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
+
+ HDfree(buf);
+
return -1;
}
@@ -3277,202 +3319,197 @@ out:
*
*-------------------------------------------------------------------------
*/
-#define S_DIM1 4
-#define S_DIM2 10
-#define CONTIG_S "contig_small"
-#define CHUNKED_S_FIX "chunked_small_fixed"
+#define S_DIM1 4
+#define S_DIM2 10
+#define CONTIG_S "contig_small"
+#define CHUNKED_S_FIX "chunked_small_fixed"
-static
-int make_layout2(hid_t loc_id)
+static int
+make_layout2(hid_t loc_id)
{
- hid_t contig_dcpl = -1; /* dataset creation property list */
- hid_t chunked_dcpl = -1; /* dataset creation property list */
+ hid_t contig_dcpl = H5I_INVALID_HID; /* dataset creation property list */
+ hid_t chunked_dcpl = H5I_INVALID_HID; /* dataset creation property list */
- int i, j, n; /* Local index variables */
- int ret_value = -1; /* Return value */
- hid_t s_sid = -1; /* dataspace ID */
+ int ret_value = -1; /* Return value */
+ hid_t s_sid = H5I_INVALID_HID; /* dataspace ID */
- hsize_t s_dims[RANK] = {S_DIM1,S_DIM2}; /* Dataspace (< 1 k) */
- hsize_t chunk_dims[RANK] = {S_DIM1/2, S_DIM2/2}; /* Dimension sizes for chunks */
+ hsize_t s_dims[RANK] = {S_DIM1, S_DIM2}; /* Dataspace (< 1 k) */
+ hsize_t chunk_dims[RANK] = {S_DIM1 / 2, S_DIM2 / 2}; /* Dimension sizes for chunks */
- int s_buf[S_DIM1][S_DIM2]; /* Temporary buffer */
-
- for(i = n = 0; i < S_DIM1; i++) {
- for (j = 0; j < S_DIM2; j++) {
- s_buf[i][j] = n++;
- }
- }
+ /* Create and fill array */
+ struct {
+ int arr[S_DIM1][S_DIM2];
+ } *s_buf = malloc(sizeof(*s_buf));
+ if (NULL == s_buf)
+ goto error;
+ H5TEST_FILL_2D_HEAP_ARRAY(s_buf, int);
/* Create dataspaces */
- if((s_sid = H5Screate_simple(RANK, s_dims, NULL)) < 0)
- goto out;
+ if ((s_sid = H5Screate_simple(RANK, s_dims, NULL)) < 0)
+ goto error;
/* Create contiguous datasets */
- if((contig_dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- goto out;
- if(H5Pset_layout(contig_dcpl, H5D_CONTIGUOUS) < 0)
- goto out;
- if(make_dset(loc_id, CONTIG_S, s_sid, contig_dcpl, s_buf) < 0)
- goto out;
+ if ((contig_dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto error;
+ if (H5Pset_layout(contig_dcpl, H5D_CONTIGUOUS) < 0)
+ goto error;
+ if (make_dset(loc_id, CONTIG_S, s_sid, contig_dcpl, s_buf) < 0)
+ goto error;
/* Create chunked datasets */
- if((chunked_dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- goto out;
- if(H5Pset_chunk(chunked_dcpl, RANK, chunk_dims) < 0)
- goto out;
- if(make_dset(loc_id, CHUNKED_S_FIX, s_sid, chunked_dcpl, s_buf) < 0)
- goto out;
+ if ((chunked_dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto error;
+ if (H5Pset_chunk(chunked_dcpl, RANK, chunk_dims) < 0)
+ goto error;
+ if (make_dset(loc_id, CHUNKED_S_FIX, s_sid, chunked_dcpl, s_buf) < 0)
+ goto error;
ret_value = 0;
-out:
- H5E_BEGIN_TRY {
+error:
+ H5E_BEGIN_TRY
+ {
H5Pclose(contig_dcpl);
H5Pclose(chunked_dcpl);
H5Sclose(s_sid);
+ }
+ H5E_END_TRY;
- } H5E_END_TRY;
+ HDfree(s_buf);
- return(ret_value);
+ return (ret_value);
} /* make_layout2() */
/*-------------------------------------------------------------------------
-* Function: make_layout3
-*
-* Purpose: make chunked datasets with unlimited max dim and chunk dim is
-* bigger than current dim. (HDFFV-7933)
-* Test for converting chunk to chunk , chunk to conti and chunk
-* to compact.
-* - The chunk to chunk changes layout bigger than any current dim
-* again.
-* - The chunk to compact test dataset bigger than 64K, should
-* remain original layout.*
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: make_layout3
+ *
+ * Purpose: make chunked datasets with unlimited max dim and chunk dim is
+ * bigger than current dim. (HDFFV-7933)
+ * Test for converting chunk to chunk , chunk to conti and chunk
+ * to compact.
+ * - The chunk to chunk changes layout bigger than any current dim
+ * again.
+ * - The chunk to compact test dataset bigger than 64K, should
+ * remain original layout.*
+ *
+ *-------------------------------------------------------------------------
+ */
#define DIM1_L3 300
#define DIM2_L3 200
/* small size */
#define SDIM1_L3 4
#define SDIM2_L3 50
-static
-int make_layout3(hid_t loc_id)
+static int
+make_layout3(hid_t loc_id)
{
- hid_t dcpl1=-1; /* dataset creation property list */
- hid_t dcpl2=-1; /* dataset creation property list */
- hid_t dcpl3=-1; /* dataset creation property list */
- hid_t sid1=-1; /* dataspace ID */
- hid_t sid2=-1; /* dataspace ID */
- hsize_t dims1[RANK]={DIM1_L3,DIM2_L3};
- hsize_t dims2[RANK]={SDIM1_L3,SDIM2_L3};
- hsize_t maxdims[RANK]={H5S_UNLIMITED, H5S_UNLIMITED};
- hsize_t chunk_dims1[RANK]={DIM1_L3*2,5};
- hsize_t chunk_dims2[RANK]={SDIM1_L3 + 2, SDIM2_L3/2};
- hsize_t chunk_dims3[RANK]={SDIM1_L3 - 2, SDIM2_L3/2};
- int buf1[DIM1_L3][DIM2_L3];
- int buf2[SDIM1_L3][SDIM2_L3];
- int i, j, n;
-
- /* init buf1 */
- for (i=n=0; i<DIM1_L3; i++)
- {
- for (j=0; j<DIM2_L3; j++)
- {
- buf1[i][j]=n++;
- }
- }
-
- /* init buf2 */
- for (i=n=0; i<SDIM1_L3; i++)
- {
- for (j=0; j<SDIM2_L3; j++)
- {
- buf2[i][j]=n++;
- }
- }
-
- /*-------------------------------------------------------------------------
- * make chunked dataset with
- * - dset maxdims are UNLIMIT
- * - a chunk dim is bigger than dset dim
- * - dset size bigger than compact max (64K)
- *-------------------------------------------------------------------------
- */
+ hid_t dcpl1 = H5I_INVALID_HID; /* dataset creation property list */
+ hid_t dcpl2 = H5I_INVALID_HID; /* dataset creation property list */
+ hid_t dcpl3 = H5I_INVALID_HID; /* dataset creation property list */
+ hid_t sid1 = H5I_INVALID_HID; /* dataspace ID */
+ hid_t sid2 = H5I_INVALID_HID; /* dataspace ID */
+ hsize_t dims1[RANK] = {DIM1_L3, DIM2_L3};
+ hsize_t dims2[RANK] = {SDIM1_L3, SDIM2_L3};
+ hsize_t maxdims[RANK] = {H5S_UNLIMITED, H5S_UNLIMITED};
+ hsize_t chunk_dims1[RANK] = {DIM1_L3 * 2, 5};
+ hsize_t chunk_dims2[RANK] = {SDIM1_L3 + 2, SDIM2_L3 / 2};
+ hsize_t chunk_dims3[RANK] = {SDIM1_L3 - 2, SDIM2_L3 / 2};
+
+ /* Create arrays */
+ struct {
+ int arr[DIM1_L3][DIM2_L3];
+ } *buf1 = malloc(sizeof(*buf1));
+ struct {
+ int arr[SDIM1_L3][SDIM2_L3];
+ } *buf2 = malloc(sizeof(*buf2));
+
+ if (NULL == buf1 || NULL == buf2)
+ goto error;
+
+ /* Fill arrays */
+ H5TEST_FILL_2D_HEAP_ARRAY(buf1, int);
+ H5TEST_FILL_2D_HEAP_ARRAY(buf2, int);
+
+ /*-------------------------------------------------------------------------
+ * make chunked dataset with
+ * - dset maxdims are UNLIMIT
+ * - a chunk dim is bigger than dset dim
+ * - dset size bigger than compact max (64K)
+ *-------------------------------------------------------------------------
+ */
/* create a space */
- if((sid1 = H5Screate_simple(RANK, dims1, maxdims)) < 0)
- return -1;
+ if ((sid1 = H5Screate_simple(RANK, dims1, maxdims)) < 0)
+ goto error;
/* create a dataset creation property list; the same DCPL is used for all dsets */
if ((dcpl1 = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- {
- goto out;
- }
+ goto error;
- if(H5Pset_chunk(dcpl1, RANK, chunk_dims1) < 0)
- goto out;
- if (make_dset(loc_id,"chunk_unlimit1",sid1,dcpl1,buf1) < 0)
- {
- goto out;
- }
+ if (H5Pset_chunk(dcpl1, RANK, chunk_dims1) < 0)
+ goto error;
+ if (make_dset(loc_id, "chunk_unlimit1", sid1, dcpl1, buf1) < 0)
+ goto error;
/*-------------------------------------------------------------------------
- * make chunked dataset with
- * - dset maxdims are UNLIMIT
- * - a chunk dim is bigger than dset dim
- * - dset size smaller than compact (64K)
- *-------------------------------------------------------------------------
- */
+ * make chunked dataset with
+ * - dset maxdims are UNLIMIT
+ * - a chunk dim is bigger than dset dim
+ * - dset size smaller than compact (64K)
+ *-------------------------------------------------------------------------
+ */
/* create a space */
- if((sid2 = H5Screate_simple(RANK, dims2, maxdims)) < 0)
- return -1;
+ if ((sid2 = H5Screate_simple(RANK, dims2, maxdims)) < 0)
+ goto error;
/* create a dataset creation property list; the same DCPL is used for all dsets */
if ((dcpl2 = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- goto out;
+ goto error;
- if(H5Pset_chunk(dcpl2, RANK, chunk_dims2) < 0)
- goto out;
+ if (H5Pset_chunk(dcpl2, RANK, chunk_dims2) < 0)
+ goto error;
- if (make_dset(loc_id,"chunk_unlimit2",sid2,dcpl2,buf2) < 0)
- goto out;
+ if (make_dset(loc_id, "chunk_unlimit2", sid2, dcpl2, buf2) < 0)
+ goto error;
/*-------------------------------------------------------------------------
- * make chunked dataset with
- * - dset maxdims are UNLIMIT
- * - a chunk dims are smaller than dset dims
- * - dset size smaller than compact (64K)
- *-------------------------------------------------------------------------
- */
+ * make chunked dataset with
+ * - dset maxdims are UNLIMIT
+ * - a chunk dims are smaller than dset dims
+ * - dset size smaller than compact (64K)
+ *-------------------------------------------------------------------------
+ */
/* create a dataset creation property list; the same DCPL is used for all dsets */
if ((dcpl3 = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- goto out;
+ goto error;
- if(H5Pset_chunk(dcpl3, RANK, chunk_dims3) < 0)
- goto out;
+ if (H5Pset_chunk(dcpl3, RANK, chunk_dims3) < 0)
+ goto error;
- if (make_dset(loc_id,"chunk_unlimit3",sid2,dcpl3,buf2) < 0)
- goto out;
+ if (make_dset(loc_id, "chunk_unlimit3", sid2, dcpl3, buf2) < 0)
+ goto error;
/*-------------------------------------------------------------------------
- * close space and dcpl
- *-------------------------------------------------------------------------
- */
- if(H5Sclose(sid1) < 0)
- goto out;
- if(H5Sclose(sid2) < 0)
- goto out;
- if(H5Pclose(dcpl1) < 0)
- goto out;
- if(H5Pclose(dcpl2) < 0)
- goto out;
- if(H5Pclose(dcpl3) < 0)
- goto out;
+ * close space and dcpl
+ *-------------------------------------------------------------------------
+ */
+ if (H5Sclose(sid1) < 0)
+ goto error;
+ if (H5Sclose(sid2) < 0)
+ goto error;
+ if (H5Pclose(dcpl1) < 0)
+ goto error;
+ if (H5Pclose(dcpl2) < 0)
+ goto error;
+ if (H5Pclose(dcpl3) < 0)
+ goto error;
+
+ HDfree(buf1);
+ HDfree(buf2);
return 0;
-out:
+error:
H5E_BEGIN_TRY
{
H5Sclose(sid1);
@@ -3480,183 +3517,189 @@ out:
H5Pclose(dcpl1);
H5Pclose(dcpl2);
H5Pclose(dcpl3);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
+
+ HDfree(buf1);
+ HDfree(buf2);
+
return -1;
}
/*-------------------------------------------------------------------------
-* Function: make a file with an integer dataset with a fill value
-*
-* Purpose: test copy of fill values
-*
-*-------------------------------------------------------------------------
-*/
-static
-int make_fill(hid_t loc_id)
+ * Function: make a file with an integer dataset with a fill value
+ *
+ * Purpose: test copy of fill values
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+make_fill(hid_t loc_id)
{
- hid_t did=-1;
- hid_t sid=-1;
+ hid_t did = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
hid_t dcpl;
- hsize_t dims[2]={3,2};
- int buf[3][2]= {{1,1},{1,2},{2,2}};
+ hsize_t dims[2] = {3, 2};
+ int buf[3][2] = {{1, 1}, {1, 2}, {2, 2}};
int fillvalue = 2;
/*-------------------------------------------------------------------------
- * H5T_INTEGER, write a fill value
- *-------------------------------------------------------------------------
- */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ * H5T_INTEGER, write a fill value
+ *-------------------------------------------------------------------------
+ */
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto out;
- if(H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillvalue) < 0)
+ if (H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillvalue) < 0)
goto out;
- if((sid = H5Screate_simple(2,dims,NULL)) < 0)
+ if ((sid = H5Screate_simple(2, dims, NULL)) < 0)
goto out;
- if((did = H5Dcreate2(loc_id, "dset_fill", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(loc_id, "dset_fill", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
goto out;
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
goto out;
/* close */
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
goto out;
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
goto out;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
return 0;
out:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Sclose(sid);
H5Dclose(did);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
-
}
/*-------------------------------------------------------------------------
-* Function: make_big
-*
-* Purpose: used in test read by hyperslabs. Creates a 128MB dataset.
-* Only 1 1024Kb hyperslab is written.
-*
-*-------------------------------------------------------------------------
-*/
-static
-int make_big(hid_t loc_id)
+ * Function: make_big
+ *
+ * Purpose: used in test read by hyperslabs. Creates a 128MB dataset.
+ * Only 1 1024Kb hyperslab is written.
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+make_big(hid_t loc_id)
{
- hid_t did=-1;
- hid_t f_sid=-1;
- hid_t m_sid=-1;
- hid_t tid;
- hid_t dcpl;
- hsize_t dims[1]={ H5TOOLS_MALLOCSIZE + 1}; /* dataset dimensions */
- hsize_t hs_size[1]; /* hyperslab dimensions */
- hsize_t hs_start[1]; /* hyperslab start */
- hsize_t chunk_dims[1]={1024}; /* chunk dimensions */
- size_t size;
- size_t nelmts=(size_t)1024;
- signed char fillvalue=-1;
- signed char *buf=NULL;
+ hid_t did = H5I_INVALID_HID;
+ hid_t f_sid = H5I_INVALID_HID;
+ hid_t m_sid = H5I_INVALID_HID;
+ hid_t tid;
+ hid_t dcpl;
+ hsize_t dims[1] = {H5TOOLS_MALLOCSIZE + 1}; /* dataset dimensions */
+ hsize_t hs_size[1]; /* hyperslab dimensions */
+ hsize_t hs_start[1]; /* hyperslab start */
+ hsize_t chunk_dims[1] = {1024}; /* chunk dimensions */
+ size_t size;
+ size_t nelmts = (size_t)1024;
+ signed char fillvalue = -1;
+ signed char *buf = NULL;
/* write one 1024 byte hyperslab */
hs_start[0] = 0;
hs_size[0] = 1024;
/* create */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto out;
- if(H5Pset_fill_value(dcpl, H5T_NATIVE_SCHAR, &fillvalue) < 0)
+ if (H5Pset_fill_value(dcpl, H5T_NATIVE_SCHAR, &fillvalue) < 0)
goto out;
- if(H5Pset_chunk(dcpl, 1, chunk_dims) < 0)
+ if (H5Pset_chunk(dcpl, 1, chunk_dims) < 0)
goto out;
- if((f_sid = H5Screate_simple(1,dims,NULL)) < 0)
+ if ((f_sid = H5Screate_simple(1, dims, NULL)) < 0)
goto out;
- if((did = H5Dcreate2(loc_id, "dset", H5T_NATIVE_SCHAR, f_sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(loc_id, "dset", H5T_NATIVE_SCHAR, f_sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
goto out;
- if((m_sid = H5Screate_simple(1, hs_size, hs_size)) < 0)
+ if ((m_sid = H5Screate_simple(1, hs_size, hs_size)) < 0)
goto out;
- if((tid = H5Dget_type(did)) < 0)
+ if ((tid = H5Dget_type(did)) < 0)
goto out;
- if((size = H5Tget_size(tid))<=0)
+ if ((size = H5Tget_size(tid)) <= 0)
goto out;
/* initialize buffer to 0 */
- buf=(signed char *) HDcalloc( nelmts, size);
+ buf = (signed char *)HDcalloc(nelmts, size);
- if (H5Sselect_hyperslab (f_sid,H5S_SELECT_SET,hs_start,NULL,hs_size, NULL) < 0)
+ if (H5Sselect_hyperslab(f_sid, H5S_SELECT_SET, hs_start, NULL, hs_size, NULL) < 0)
goto out;
- if (H5Dwrite (did,H5T_NATIVE_SCHAR,m_sid,f_sid,H5P_DEFAULT,buf) < 0)
+ if (H5Dwrite(did, H5T_NATIVE_SCHAR, m_sid, f_sid, H5P_DEFAULT, buf) < 0)
goto out;
HDfree(buf);
- buf=NULL;
+ buf = NULL;
/* close */
- if(H5Sclose(f_sid) < 0)
+ if (H5Sclose(f_sid) < 0)
goto out;
- if(H5Sclose(m_sid) < 0)
+ if (H5Sclose(m_sid) < 0)
goto out;
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
goto out;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
return 0;
out:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Sclose(f_sid);
H5Sclose(m_sid);
H5Dclose(did);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
-
}
-
/*-------------------------------------------------------------------------
-* Function: make_external
-*
-* Purpose: create a external dataset
-*
-*-------------------------------------------------------------------------
-*/
-static
-int make_external(hid_t loc_id)
+ * Function: make_external
+ *
+ * Purpose: create a external dataset
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+make_external(hid_t loc_id)
{
- hid_t did=-1;
- hid_t sid=-1;
+ hid_t did = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
hid_t dcpl;
- int buf[2]={1,2};
- hsize_t cur_size[1]; /* data space current size */
- hsize_t max_size[1]; /* data space maximum size */
+ int buf[2] = {1, 2};
+ hsize_t cur_size[1]; /* data space current size */
+ hsize_t max_size[1]; /* data space maximum size */
hsize_t size;
cur_size[0] = max_size[0] = 2;
- size = max_size[0] * sizeof(int);
+ size = max_size[0] * sizeof(int);
/* create */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto out;
- if(H5Pset_external(dcpl, H5REPACK_EXTFILE, (off_t)0, size) < 0)
+ if (H5Pset_external(dcpl, H5REPACK_EXTFILE, (off_t)0, size) < 0)
goto out;
- if((sid = H5Screate_simple(1,cur_size, max_size)) < 0)
+ if ((sid = H5Screate_simple(1, cur_size, max_size)) < 0)
goto out;
- if((did = H5Dcreate2(loc_id, "external", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(loc_id, "external", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
goto out;
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
goto out;
/* close */
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
goto out;
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
goto out;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
return 0;
@@ -3667,51 +3710,50 @@ out:
H5Pclose(dcpl);
H5Sclose(sid);
H5Dclose(did);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
-
}
/*-------------------------------------------------------------------------
-* Function: make_userblock
-*
-* Purpose: create a file for the userblock copying test
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: make_userblock
+ *
+ * Purpose: create a file for the userblock copying test
+ *
+ *-------------------------------------------------------------------------
+ */
static int
make_userblock(void)
{
- hid_t fid = -1;
- hid_t fcpl = -1;
- int fd = -1; /* File descriptor for writing userblock */
- char ub[USERBLOCK_SIZE]; /* User block data */
- ssize_t nwritten; /* # of bytes written */
- size_t u; /* Local index variable */
+ hid_t fid = H5I_INVALID_HID;
+ hid_t fcpl = H5I_INVALID_HID;
+ int fd = -1; /* File descriptor for writing userblock */
+ char ub[USERBLOCK_SIZE]; /* User block data */
+ ssize_t H5_ATTR_NDEBUG_UNUSED nwritten; /* # of bytes written */
+ size_t u; /* Local index variable */
/* Create file creation property list with userblock set */
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
goto out;
- if(H5Pset_userblock(fcpl, (hsize_t)USERBLOCK_SIZE) < 0)
+ if (H5Pset_userblock(fcpl, (hsize_t)USERBLOCK_SIZE) < 0)
goto out;
/* Create file with userblock */
- if((fid = H5Fcreate(FNAME16, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(FNAME16, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0)
goto out;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
goto out;
/* Close file creation property list */
- if(H5Pclose(fcpl) < 0)
+ if (H5Pclose(fcpl) < 0)
goto out;
-
/* Initialize userblock data */
- for(u = 0; u < USERBLOCK_SIZE; u++)
+ for (u = 0; u < USERBLOCK_SIZE; u++)
ub[u] = (char)('a' + (char)(u % 26));
/* Re-open HDF5 file, as "plain" file */
- if((fd = HDopen(FNAME16, O_WRONLY)) < 0)
+ if ((fd = HDopen(FNAME16, O_WRONLY)) < 0)
goto out;
/* Write userblock data */
@@ -3724,58 +3766,59 @@ make_userblock(void)
return 0;
out:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fcpl);
H5Fclose(fid);
- } H5E_END_TRY;
- if(fd >= 0)
+ }
+ H5E_END_TRY;
+ if (fd >= 0)
HDclose(fd);
return -1;
} /* end make_userblock() */
/*-------------------------------------------------------------------------
-* Function: verify_userblock
-*
-* Purpose: Verify that the userblock was copied correctly
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: verify_userblock
+ *
+ * Purpose: Verify that the userblock was copied correctly
+ *
+ *-------------------------------------------------------------------------
+ */
static int
-verify_userblock( const char* filename)
+verify_userblock(const char *filename)
{
- hid_t fid = -1;
- hid_t fcpl = -1;
- int fd = -1; /* File descriptor for writing userblock */
- char ub[USERBLOCK_SIZE]; /* User block data */
- hsize_t ub_size = 0; /* User block size */
- ssize_t nread; /* # of bytes read */
- size_t u; /* Local index variable */
+ hid_t fid = H5I_INVALID_HID;
+ hid_t fcpl = H5I_INVALID_HID;
+ int fd = -1; /* File descriptor for writing userblock */
+ char ub[USERBLOCK_SIZE]; /* User block data */
+ hsize_t ub_size = 0; /* User block size */
+ ssize_t H5_ATTR_NDEBUG_UNUSED nread; /* # of bytes read */
+ size_t u; /* Local index variable */
/* Open file with userblock */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
goto out;
/* Retrieve file creation property list & userblock size */
- if((fcpl = H5Fget_create_plist(fid)) < 0)
+ if ((fcpl = H5Fget_create_plist(fid)) < 0)
goto out;
- if(H5Pget_userblock(fcpl, &ub_size) < 0)
+ if (H5Pget_userblock(fcpl, &ub_size) < 0)
goto out;
/* Verify userblock size is correct */
- if(ub_size != USERBLOCK_SIZE)
+ if (ub_size != USERBLOCK_SIZE)
goto out;
/* Close file creation property list */
- if(H5Pclose(fcpl) < 0)
+ if (H5Pclose(fcpl) < 0)
goto out;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
goto out;
-
/* Re-open HDF5 file, as "plain" file */
- if((fd = HDopen(filename, O_RDONLY)) < 0)
+ if ((fd = HDopen(filename, O_RDONLY)) < 0)
goto out;
/* Read userblock data */
@@ -3783,8 +3826,8 @@ verify_userblock( const char* filename)
HDassert(nread == USERBLOCK_SIZE);
/* Verify userblock data */
- for(u = 0; u < USERBLOCK_SIZE; u++)
- if(ub[u] != (char)('a' + (u % 26)))
+ for (u = 0; u < USERBLOCK_SIZE; u++)
+ if (ub[u] != (char)('a' + (u % 26)))
goto out;
/* Close file */
@@ -3793,38 +3836,39 @@ verify_userblock( const char* filename)
return 0;
out:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fcpl);
H5Fclose(fid);
- } H5E_END_TRY;
- if(fd >= 0)
+ }
+ H5E_END_TRY;
+ if (fd >= 0)
HDclose(fd);
return -1;
} /* end verify_userblock() */
-
/*-------------------------------------------------------------------------
-* Function: make_userblock_file
-*
-* Purpose: create a file for the userblock add test
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: make_userblock_file
+ *
+ * Purpose: create a file for the userblock add test
+ *
+ *-------------------------------------------------------------------------
+ */
static int
make_userblock_file(void)
{
- int fd = -1; /* File descriptor for writing userblock */
- char ub[USERBLOCK_SIZE]; /* User block data */
- ssize_t nwritten; /* # of bytes written */
- size_t u; /* Local index variable */
+ int fd = -1; /* File descriptor for writing userblock */
+ char ub[USERBLOCK_SIZE]; /* User block data */
+ ssize_t H5_ATTR_NDEBUG_UNUSED nwritten; /* # of bytes written */
+ size_t u; /* Local index variable */
/* initialize userblock data */
- for(u = 0; u < USERBLOCK_SIZE; u++)
+ for (u = 0; u < USERBLOCK_SIZE; u++)
ub[u] = (char)('a' + (char)(u % 26));
/* open file */
- if((fd = HDopen(FNAME_UB, O_WRONLY|O_CREAT|O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0)
+ if ((fd = HDopen(FNAME_UB, O_WRONLY | O_CREAT | O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0)
goto out;
/* write userblock data */
@@ -3838,147 +3882,135 @@ make_userblock_file(void)
out:
- if(fd >= 0)
+ if (fd >= 0)
HDclose(fd);
return -1;
}
/*-------------------------------------------------------------------------
-* Function: write_dset_in
-*
-* Purpose: write datasets in LOC_ID
-*
-* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
-*
-* Date: November 12, 2003
-*
-*-------------------------------------------------------------------------
-*/
-static
-int write_dset_in(hid_t loc_id,
- const char* dset_name, /* for saving reference to dataset*/
- hid_t file_id,
- int make_diffs /* flag to modify data buffers */)
+ * Function: write_dset_in
+ *
+ * Purpose: write datasets in LOC_ID
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: November 12, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+write_dset_in(hid_t loc_id, const char *dset_name, /* for saving reference to dataset*/
+ hid_t file_id, int make_diffs /* flag to modify data buffers */)
{
/* compound datatype */
- typedef struct s_t
- {
+ typedef struct s_t {
char a;
double b;
} s_t;
- typedef enum
- {
- RED,
- GREEN
- } e_t;
-
- hid_t did=-1;
- hid_t sid=-1;
- hid_t tid=-1;
- hid_t pid=-1;
+ typedef enum { RED, GREEN } e_t;
+
+ hid_t did = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ hid_t tid = H5I_INVALID_HID;
+ hid_t pid = H5I_INVALID_HID;
unsigned i, j;
- int val, k, n;
- float f;
+ int val, k, n;
+ float f;
/* create 1D attributes with dimension [2], 2 elements */
- hsize_t dims[1]={2};
- hsize_t dims1r[1]={2};
- char buf1[2][3]= {"ab","de"}; /* string */
- char buf2[2]= {1,2}; /* bitfield, opaque */
- s_t buf3[2]= {{1,2},{3,4}}; /* compound */
- hobj_ref_t buf4[2]; /* reference */
- e_t buf45[2]= {RED,GREEN}; /* enum */
- hvl_t buf5[2]; /* vlen */
- hsize_t dimarray[1]={3}; /* array dimension */
- int buf6[2][3]= {{1,2,3},{4,5,6}}; /* array */
- int buf7[2]= {1,2}; /* integer */
- float buf8[2]= {1,2}; /* float */
+ hsize_t dims[1] = {2};
+ hsize_t dims1r[1] = {2};
+ char buf1[2][3] = {"ab", "de"}; /* string */
+ char buf2[2] = {1, 2}; /* bitfield, opaque */
+ s_t buf3[2] = {{1, 2}, {3, 4}}; /* compound */
+ hobj_ref_t buf4[2]; /* reference */
+ e_t buf45[2] = {RED, GREEN}; /* enum */
+ hvl_t buf5[2]; /* vlen */
+ hsize_t dimarray[1] = {3}; /* array dimension */
+ int buf6[2][3] = {{1, 2, 3}, {4, 5, 6}}; /* array */
+ int buf7[2] = {1, 2}; /* integer */
+ float buf8[2] = {1, 2}; /* float */
/* create 2D attributes with dimension [3][2], 6 elements */
- hsize_t dims2[2]={3,2};
- hsize_t dims2r[2]={1,1};
- char buf12[6][3]= {"ab","cd","ef","gh","ij","kl"}; /* string */
- char buf22[3][2]= {{1,2},{3,4},{5,6}}; /* bitfield, opaque */
- s_t buf32[6]= {{1,2},{3,4},{5,6},{7,8},{9,10},{11,12}}; /* compound */
- hobj_ref_t buf42[1][1]; /* reference */
- hvl_t buf52[3][2]; /* vlen */
- int buf62[6][3]= {{1,2,3},{4,5,6},{7,8,9},{10,11,12},{13,14,15},{16,17,18}}; /* array */
- int buf72[3][2]= {{1,2},{3,4},{5,6}}; /* integer */
- float buf82[3][2]= {{1,2},{3,4},{5,6}}; /* float */
+ hsize_t dims2[2] = {3, 2};
+ hsize_t dims2r[2] = {1, 1};
+ char buf12[6][3] = {"ab", "cd", "ef", "gh", "ij", "kl"}; /* string */
+ char buf22[3][2] = {{1, 2}, {3, 4}, {5, 6}}; /* bitfield, opaque */
+ s_t buf32[6] = {{1, 2}, {3, 4}, {5, 6}, {7, 8}, {9, 10}, {11, 12}}; /* compound */
+ hobj_ref_t buf42[1][1]; /* reference */
+ hvl_t buf52[3][2]; /* vlen */
+ int buf62[6][3] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}, {10, 11, 12}, {13, 14, 15}, {16, 17, 18}}; /* array */
+ int buf72[3][2] = {{1, 2}, {3, 4}, {5, 6}}; /* integer */
+ float buf82[3][2] = {{1, 2}, {3, 4}, {5, 6}}; /* float */
/* create 3D attributes with dimension [4][3][2], 24 elements */
- hsize_t dims3[3]={4,3,2};
- hsize_t dims3r[3]={1,1,1};
- char buf13[24][3]= {"ab","cd","ef","gh","ij","kl","mn","pq",
- "rs","tu","vw","xz","AB","CD","EF","GH",
- "IJ","KL","MN","PQ","RS","TU","VW","XZ"}; /* string */
- char buf23[4][3][2]; /* bitfield, opaque */
- s_t buf33[4][3][2]; /* compound */
- hobj_ref_t buf43[1][1][1]; /* reference */
- hvl_t buf53[4][3][2]; /* vlen */
- int buf63[24][3]; /* array */
- int buf73[4][3][2]; /* integer */
- float buf83[4][3][2]; /* float */
-
-
- /*-------------------------------------------------------------------------
- * 1D
- *-------------------------------------------------------------------------
- */
+ hsize_t dims3[3] = {4, 3, 2};
+ hsize_t dims3r[3] = {1, 1, 1};
+ char buf13[24][3] = {"ab", "cd", "ef", "gh", "ij", "kl", "mn", "pq", "rs", "tu", "vw", "xz",
+ "AB", "CD", "EF", "GH", "IJ", "KL", "MN", "PQ", "RS", "TU", "VW", "XZ"}; /* string */
+ char buf23[4][3][2]; /* bitfield, opaque */
+ s_t buf33[4][3][2]; /* compound */
+ hobj_ref_t buf43[1][1][1]; /* reference */
+ hvl_t buf53[4][3][2]; /* vlen */
+ int buf63[24][3]; /* array */
+ int buf73[4][3][2]; /* integer */
+ float buf83[4][3][2]; /* float */
+
+ /*-------------------------------------------------------------------------
+ * 1D
+ *-------------------------------------------------------------------------
+ */
/*-------------------------------------------------------------------------
- * H5T_STRING
- *-------------------------------------------------------------------------
- */
-
+ * H5T_STRING
+ *-------------------------------------------------------------------------
+ */
- if(make_diffs) {
- for(i = 0; i < 2; i++)
- for(j = 0; j < 2; j++)
+ if (make_diffs) {
+ for (i = 0; i < 2; i++)
+ for (j = 0; j < 2; j++)
buf1[i][j] = 'z';
}
-
if ((tid = H5Tcopy(H5T_C_S1)) < 0)
goto out;
if (H5Tset_size(tid, (size_t)2) < 0)
goto out;
- if (write_dset(loc_id,1,dims,"string",tid,buf1) < 0)
+ if (write_dset(loc_id, 1, dims, "string", tid, buf1) < 0)
goto out;
if (H5Tclose(tid) < 0)
goto out;
-
/* create hard link */
if (H5Lcreate_hard(loc_id, "string", H5L_SAME_LOC, "string_link", H5P_DEFAULT, H5P_DEFAULT) < 0)
goto out;
/*-------------------------------------------------------------------------
- * H5T_BITFIELD
- *-------------------------------------------------------------------------
- */
+ * H5T_BITFIELD
+ *-------------------------------------------------------------------------
+ */
- if(make_diffs) {
- for(i = 0; i < 2; i++)
+ if (make_diffs) {
+ for (i = 0; i < 2; i++)
buf2[i] = buf2[1] = 0;
}
if ((tid = H5Tcopy(H5T_STD_B8LE)) < 0)
goto out;
- if (write_dset(loc_id,1,dims,"bitfield",tid,buf2) < 0)
+ if (write_dset(loc_id, 1, dims, "bitfield", tid, buf2) < 0)
goto out;
if (H5Tclose(tid) < 0)
goto out;
/*-------------------------------------------------------------------------
- * H5T_OPAQUE
- *-------------------------------------------------------------------------
- */
+ * H5T_OPAQUE
+ *-------------------------------------------------------------------------
+ */
- if(make_diffs) {
- for(i = 0; i < 2; i++) {
+ if (make_diffs) {
+ for (i = 0; i < 2; i++) {
buf3[i].a = 0;
buf3[i].b = 0;
}
@@ -3988,45 +4020,43 @@ int write_dset_in(hid_t loc_id,
goto out;
if (H5Tset_tag(tid, "1-byte opaque type") < 0)
goto out;
- if (write_dset(loc_id,1,dims,"opaque",tid,buf2) < 0)
+ if (write_dset(loc_id, 1, dims, "opaque", tid, buf2) < 0)
goto out;
if (H5Tclose(tid) < 0)
goto out;
/*-------------------------------------------------------------------------
- * H5T_COMPOUND
- *-------------------------------------------------------------------------
- */
-
+ * H5T_COMPOUND
+ *-------------------------------------------------------------------------
+ */
- if(make_diffs) {
- for(i = 0; i < 2; i++)
+ if (make_diffs) {
+ for (i = 0; i < 2; i++)
buf45[i] = GREEN;
}
- if ((tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t))) < 0)
+ if ((tid = H5Tcreate(H5T_COMPOUND, sizeof(s_t))) < 0)
goto out;
if (H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR) < 0)
goto out;
if (H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE) < 0)
goto out;
- if (write_dset(loc_id,1,dims,"compound",tid,buf3) < 0)
+ if (write_dset(loc_id, 1, dims, "compound", tid, buf3) < 0)
goto out;
if (H5Tclose(tid) < 0)
goto out;
/*-------------------------------------------------------------------------
- * H5T_REFERENCE
- *-------------------------------------------------------------------------
- */
+ * H5T_REFERENCE
+ *-------------------------------------------------------------------------
+ */
/* object references ( H5R_OBJECT ) */
- buf4[0]=0;
- buf4[1]=0;
- if (dset_name)
- {
- if (H5Rcreate(&buf4[0],file_id,dset_name,H5R_OBJECT,(hid_t)-1) < 0)
+ buf4[0] = 0;
+ buf4[1] = 0;
+ if (dset_name) {
+ if (H5Rcreate(&buf4[0], file_id, dset_name, H5R_OBJECT, (hid_t)-1) < 0)
goto out;
- if (write_dset(loc_id,1,dims1r,"refobj",H5T_STD_REF_OBJ,buf4) < 0)
+ if (write_dset(loc_id, 1, dims1r, "refobj", H5T_STD_REF_OBJ, buf4) < 0)
goto out;
}
@@ -4034,38 +4064,37 @@ int write_dset_in(hid_t loc_id,
if (make_dset_reg_ref(loc_id) < 0)
goto out;
-
/*-------------------------------------------------------------------------
- * H5T_ENUM
- *-------------------------------------------------------------------------
- */
+ * H5T_ENUM
+ *-------------------------------------------------------------------------
+ */
if ((tid = H5Tcreate(H5T_ENUM, sizeof(e_t))) < 0)
goto out;
- if (H5Tenum_insert(tid, "RED", (val = 0, &val)) < 0)
+ if (H5Tenum_insert(tid, "RED", (val = 0, &val)) < 0)
goto out;
if (H5Tenum_insert(tid, "GREEN", (val = 1, &val)) < 0)
goto out;
- if (write_dset(loc_id,1,dims,"enum",tid,buf45) < 0)
+ if (write_dset(loc_id, 1, dims, "enum", tid, buf45) < 0)
goto out;
if (H5Tclose(tid) < 0)
goto out;
/*-------------------------------------------------------------------------
- * H5T_VLEN
- *-------------------------------------------------------------------------
- */
+ * H5T_VLEN
+ *-------------------------------------------------------------------------
+ */
/* Allocate and initialize VL dataset to write */
- buf5[0].len = 1;
- buf5[0].p = HDmalloc( 1 * sizeof(int));
- ((int *)buf5[0].p)[0]=1;
- buf5[1].len = 2;
- buf5[1].p = HDmalloc( 2 * sizeof(int));
+ buf5[0].len = 1;
+ buf5[0].p = HDmalloc(1 * sizeof(int));
+ ((int *)buf5[0].p)[0] = 1;
+ buf5[1].len = 2;
+ buf5[1].p = HDmalloc(2 * sizeof(int));
((int *)buf5[1].p)[0] = 2;
((int *)buf5[1].p)[1] = 3;
- if(make_diffs) {
+ if (make_diffs) {
((int *)buf5[0].p)[0] = 0;
((int *)buf5[1].p)[0] = 0;
((int *)buf5[1].p)[1] = 0;
@@ -4079,7 +4108,7 @@ int write_dset_in(hid_t loc_id,
goto out;
if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf5) < 0)
goto out;
- if (H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf5) < 0)
+ if (H5Treclaim(tid, sid, H5P_DEFAULT, buf5) < 0)
goto out;
if (H5Dclose(did) < 0)
goto out;
@@ -4089,13 +4118,13 @@ int write_dset_in(hid_t loc_id,
goto out;
/*-------------------------------------------------------------------------
- * H5T_ARRAY
- *-------------------------------------------------------------------------
- */
+ * H5T_ARRAY
+ *-------------------------------------------------------------------------
+ */
- if(make_diffs) {
- for(i = 0; i < 2; i++)
- for(j = 0; j < 3; j++)
+ if (make_diffs) {
+ for (i = 0; i < 2; i++)
+ for (j = 0; j < 3; j++)
buf6[i][j] = 0;
}
@@ -4108,27 +4137,26 @@ int write_dset_in(hid_t loc_id,
{
- hsize_t TEST_BUFSIZE = (128 * 1024 * 1024); /* 128MB */
- double *dbuf; /* information to write */
+ hsize_t TEST_BUFSIZE = (128 * 1024 * 1024); /* 128MB */
+ double * dbuf; /* information to write */
size_t size;
hsize_t sdims[] = {1};
hsize_t tdims[] = {TEST_BUFSIZE / sizeof(double) + 1};
unsigned u;
/* allocate and initialize array data to write */
- size = ( TEST_BUFSIZE / sizeof(double) + 1 ) * sizeof(double);
- dbuf = (double*)HDmalloc( size );
- if (NULL == dbuf)
- {
- HDprintf ("\nError: Cannot allocate memory for \"arrayd\" data buffer size %dMB.\n", (int) size / 1000000 );
+ size = (TEST_BUFSIZE / sizeof(double) + 1) * sizeof(double);
+ dbuf = (double *)HDmalloc(size);
+ if (NULL == dbuf) {
+ HDprintf("\nError: Cannot allocate memory for \"arrayd\" data buffer size %dMB.\n",
+ (int)size / 1000000);
goto out;
}
- for( u = 0; u < TEST_BUFSIZE / sizeof(double) + 1; u++)
+ for (u = 0; u < TEST_BUFSIZE / sizeof(double) + 1; u++)
dbuf[u] = u;
- if (make_diffs)
- {
+ if (make_diffs) {
dbuf[5] = 0;
dbuf[6] = 0;
}
@@ -4159,107 +4187,100 @@ int write_dset_in(hid_t loc_id,
}
/*-------------------------------------------------------------------------
- * H5T_INTEGER and H5T_FLOAT
- *-------------------------------------------------------------------------
- */
+ * H5T_INTEGER and H5T_FLOAT
+ *-------------------------------------------------------------------------
+ */
- if(make_diffs) {
- for(i = 0; i < 2; i++) {
+ if (make_diffs) {
+ for (i = 0; i < 2; i++) {
buf7[i] = 0;
buf8[i] = 0;
}
}
- if (write_dset(loc_id,1,dims,"integer",H5T_NATIVE_INT,buf7) < 0)
+ if (write_dset(loc_id, 1, dims, "integer", H5T_NATIVE_INT, buf7) < 0)
goto out;
- if (write_dset(loc_id,1,dims,"float",H5T_NATIVE_FLOAT,buf8) < 0)
+ if (write_dset(loc_id, 1, dims, "float", H5T_NATIVE_FLOAT, buf8) < 0)
goto out;
-
/*-------------------------------------------------------------------------
- * 2D
- *-------------------------------------------------------------------------
- */
+ * 2D
+ *-------------------------------------------------------------------------
+ */
/*-------------------------------------------------------------------------
- * H5T_STRING
- *-------------------------------------------------------------------------
- */
+ * H5T_STRING
+ *-------------------------------------------------------------------------
+ */
- if (make_diffs)
- {
+ if (make_diffs) {
HDmemset(buf12, 'z', sizeof buf12);
}
-
if ((tid = H5Tcopy(H5T_C_S1)) < 0)
goto out;
if (H5Tset_size(tid, (size_t)2) < 0)
goto out;
- if (write_dset(loc_id,2,dims2,"string2D",tid,buf12) < 0)
+ if (write_dset(loc_id, 2, dims2, "string2D", tid, buf12) < 0)
goto out;
if (H5Tclose(tid) < 0)
goto out;
/*-------------------------------------------------------------------------
- * H5T_BITFIELD
- *-------------------------------------------------------------------------
- */
-
+ * H5T_BITFIELD
+ *-------------------------------------------------------------------------
+ */
- if (make_diffs)
- {
- HDmemset(buf22,0,sizeof buf22);
+ if (make_diffs) {
+ HDmemset(buf22, 0, sizeof buf22);
}
if ((tid = H5Tcopy(H5T_STD_B8LE)) < 0)
goto out;
- if (write_dset(loc_id,2,dims2,"bitfield2D",tid,buf22) < 0)
+ if (write_dset(loc_id, 2, dims2, "bitfield2D", tid, buf22) < 0)
goto out;
if (H5Tclose(tid) < 0)
goto out;
/*-------------------------------------------------------------------------
- * H5T_OPAQUE
- *-------------------------------------------------------------------------
- */
+ * H5T_OPAQUE
+ *-------------------------------------------------------------------------
+ */
if ((tid = H5Tcreate(H5T_OPAQUE, (size_t)1)) < 0)
goto out;
if (H5Tset_tag(tid, "1-byte opaque type") < 0)
goto out;
- if (write_dset(loc_id,2,dims2,"opaque2D",tid,buf22) < 0)
+ if (write_dset(loc_id, 2, dims2, "opaque2D", tid, buf22) < 0)
goto out;
if (H5Tclose(tid) < 0)
goto out;
/*-------------------------------------------------------------------------
- * H5T_COMPOUND
- *-------------------------------------------------------------------------
- */
+ * H5T_COMPOUND
+ *-------------------------------------------------------------------------
+ */
- if (make_diffs)
- {
- HDmemset(buf32,0,sizeof buf32);
+ if (make_diffs) {
+ HDmemset(buf32, 0, sizeof buf32);
}
- if ((tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t))) < 0)
+ if ((tid = H5Tcreate(H5T_COMPOUND, sizeof(s_t))) < 0)
goto out;
if (H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR) < 0)
goto out;
if (H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE) < 0)
goto out;
- if (write_dset(loc_id,2,dims2,"compound2D",tid,buf32) < 0)
+ if (write_dset(loc_id, 2, dims2, "compound2D", tid, buf32) < 0)
goto out;
if (H5Tclose(tid) < 0)
goto out;
/*-------------------------------------------------------------------------
- * H5T_REFERENCE
- *-------------------------------------------------------------------------
- */
+ * H5T_REFERENCE
+ *-------------------------------------------------------------------------
+ */
/* Create references to dataset */
- if (dset_name)
- {
+ if (dset_name) {
if (H5Rcreate(&buf42[0][0], file_id, dset_name, H5R_OBJECT, (hid_t)-1) < 0)
goto out;
if (write_dset(loc_id, 2, dims2r, "refobj2D", H5T_STD_REF_OBJ, buf42) < 0)
@@ -4267,36 +4288,36 @@ int write_dset_in(hid_t loc_id,
}
/*-------------------------------------------------------------------------
- * H5T_ENUM
- *-------------------------------------------------------------------------
- */
+ * H5T_ENUM
+ *-------------------------------------------------------------------------
+ */
if ((tid = H5Tcreate(H5T_ENUM, sizeof(e_t))) < 0)
goto out;
- if (H5Tenum_insert(tid, "RED", (val = 0, &val)) < 0)
+ if (H5Tenum_insert(tid, "RED", (val = 0, &val)) < 0)
goto out;
if (H5Tenum_insert(tid, "GREEN", (val = 1, &val)) < 0)
goto out;
- if (write_dset(loc_id,2,dims2,"enum2D",tid,0) < 0)
+ if (write_dset(loc_id, 2, dims2, "enum2D", tid, 0) < 0)
goto out;
if (H5Tclose(tid) < 0)
goto out;
/*-------------------------------------------------------------------------
- * H5T_VLEN
- *-------------------------------------------------------------------------
- */
+ * H5T_VLEN
+ *-------------------------------------------------------------------------
+ */
/* Allocate and initialize VL dataset to write */
n = 0;
- for(i = 0; i < 3; i++) {
- for(j = 0; j < 2; j++) {
+ for (i = 0; i < 3; i++) {
+ for (j = 0; j < 2; j++) {
unsigned l;
- buf52[i][j].p = HDmalloc((i + 1) * sizeof(int));
+ buf52[i][j].p = HDmalloc((i + 1) * sizeof(int));
buf52[i][j].len = (size_t)(i + 1);
- for(l = 0; l < i + 1; l++) {
- if(make_diffs)
+ for (l = 0; l < i + 1; l++) {
+ if (make_diffs)
((int *)buf52[i][j].p)[l] = 0;
else
((int *)buf52[i][j].p)[l] = n++;
@@ -4312,7 +4333,7 @@ int write_dset_in(hid_t loc_id,
goto out;
if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf52) < 0)
goto out;
- if (H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf52) < 0)
+ if (H5Treclaim(tid, sid, H5P_DEFAULT, buf52) < 0)
goto out;
if (H5Dclose(did) < 0)
goto out;
@@ -4322,16 +4343,14 @@ int write_dset_in(hid_t loc_id,
goto out;
/*-------------------------------------------------------------------------
- * H5T_ARRAY
- *-------------------------------------------------------------------------
- */
+ * H5T_ARRAY
+ *-------------------------------------------------------------------------
+ */
- if (make_diffs)
- {
- HDmemset(buf62,0,sizeof buf62);
+ if (make_diffs) {
+ HDmemset(buf62, 0, sizeof buf62);
}
-
if ((tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray)) < 0)
goto out;
if (write_dset(loc_id, 2, dims2, "array2D", tid, buf62) < 0)
@@ -4340,17 +4359,15 @@ int write_dset_in(hid_t loc_id,
goto out;
/*-------------------------------------------------------------------------
- * H5T_INTEGER, write a fill value
- *-------------------------------------------------------------------------
- */
-
+ * H5T_INTEGER, write a fill value
+ *-------------------------------------------------------------------------
+ */
- if(make_diffs) {
+ if (make_diffs) {
HDmemset(buf72, 0, sizeof buf72);
HDmemset(buf82, 0, sizeof buf82);
}
-
if ((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto out;
if ((sid = H5Screate_simple(2, dims2, NULL)) < 0)
@@ -4367,49 +4384,46 @@ int write_dset_in(hid_t loc_id,
goto out;
/*-------------------------------------------------------------------------
- * H5T_FLOAT
- *-------------------------------------------------------------------------
- */
+ * H5T_FLOAT
+ *-------------------------------------------------------------------------
+ */
- if (write_dset(loc_id,2,dims2,"float2D",H5T_NATIVE_FLOAT,buf82) < 0)
+ if (write_dset(loc_id, 2, dims2, "float2D", H5T_NATIVE_FLOAT, buf82) < 0)
goto out;
-
/*-------------------------------------------------------------------------
- * 3D
- *-------------------------------------------------------------------------
- */
+ * 3D
+ *-------------------------------------------------------------------------
+ */
/*-------------------------------------------------------------------------
- * H5T_STRING
- *-------------------------------------------------------------------------
- */
+ * H5T_STRING
+ *-------------------------------------------------------------------------
+ */
- if (make_diffs)
- {
- HDmemset(buf13,'z',sizeof buf13);
+ if (make_diffs) {
+ HDmemset(buf13, 'z', sizeof buf13);
}
if ((tid = H5Tcopy(H5T_C_S1)) < 0)
goto out;
if (H5Tset_size(tid, (size_t)2) < 0)
goto out;
- if (write_dset(loc_id,3,dims3,"string3D",tid,buf13) < 0)
+ if (write_dset(loc_id, 3, dims3, "string3D", tid, buf13) < 0)
goto out;
if (H5Tclose(tid) < 0)
goto out;
/*-------------------------------------------------------------------------
- * H5T_BITFIELD
- *-------------------------------------------------------------------------
- */
-
+ * H5T_BITFIELD
+ *-------------------------------------------------------------------------
+ */
- n=1;
- for(i = 0; i < 4; i++) {
- for(j = 0; j < 3; j++) {
- for(k = 0; k < 2; k++) {
- if(make_diffs)
+ n = 1;
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < 3; j++) {
+ for (k = 0; k < 2; k++) {
+ if (make_diffs)
buf23[i][j][k] = 0;
else
buf23[i][j][k] = (char)(n++);
@@ -4417,37 +4431,36 @@ int write_dset_in(hid_t loc_id,
}
}
-
if ((tid = H5Tcopy(H5T_STD_B8LE)) < 0)
goto out;
- if (write_dset(loc_id,3,dims3,"bitfield3D",tid,buf23) < 0)
+ if (write_dset(loc_id, 3, dims3, "bitfield3D", tid, buf23) < 0)
goto out;
if (H5Tclose(tid) < 0)
goto out;
/*-------------------------------------------------------------------------
- * H5T_OPAQUE
- *-------------------------------------------------------------------------
- */
+ * H5T_OPAQUE
+ *-------------------------------------------------------------------------
+ */
if ((tid = H5Tcreate(H5T_OPAQUE, (size_t)1)) < 0)
goto out;
if (H5Tset_tag(tid, "1-byte opaque type") < 0)
goto out;
- if (write_dset(loc_id,3,dims3,"opaque3D",tid,buf23) < 0)
+ if (write_dset(loc_id, 3, dims3, "opaque3D", tid, buf23) < 0)
goto out;
if (H5Tclose(tid) < 0)
goto out;
/*-------------------------------------------------------------------------
- * H5T_COMPOUND
- *-------------------------------------------------------------------------
- */
+ * H5T_COMPOUND
+ *-------------------------------------------------------------------------
+ */
- n=1;
- for(i = 0; i < 4; i++) {
- for(j = 0; j < 3; j++) {
- for(k = 0; k < 2; k++) {
- if(make_diffs) {
+ n = 1;
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < 3; j++) {
+ for (k = 0; k < 2; k++) {
+ if (make_diffs) {
buf33[i][j][k].a = 0;
buf33[i][j][k].b = 0;
}
@@ -4459,25 +4472,23 @@ int write_dset_in(hid_t loc_id,
}
}
-
- if ((tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t))) < 0)
+ if ((tid = H5Tcreate(H5T_COMPOUND, sizeof(s_t))) < 0)
goto out;
if (H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR) < 0)
goto out;
if (H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE) < 0)
goto out;
- if (write_dset(loc_id,3,dims3,"compound3D",tid,buf33) < 0)
+ if (write_dset(loc_id, 3, dims3, "compound3D", tid, buf33) < 0)
goto out;
if (H5Tclose(tid) < 0)
goto out;
/*-------------------------------------------------------------------------
- * H5T_REFERENCE
- *-------------------------------------------------------------------------
- */
+ * H5T_REFERENCE
+ *-------------------------------------------------------------------------
+ */
/* Create references to dataset */
- if (dset_name)
- {
+ if (dset_name) {
if (H5Rcreate(&buf43[0][0][0], file_id, dset_name, H5R_OBJECT, (hid_t)-1) < 0)
goto out;
if (write_dset(loc_id, 3, dims3r, "refobj3D", H5T_STD_REF_OBJ, buf43) < 0)
@@ -4485,37 +4496,37 @@ int write_dset_in(hid_t loc_id,
}
/*-------------------------------------------------------------------------
- * H5T_ENUM
- *-------------------------------------------------------------------------
- */
+ * H5T_ENUM
+ *-------------------------------------------------------------------------
+ */
if ((tid = H5Tcreate(H5T_ENUM, sizeof(e_t))) < 0)
goto out;
- if (H5Tenum_insert(tid, "RED", (val = 0, &val)) < 0)
+ if (H5Tenum_insert(tid, "RED", (val = 0, &val)) < 0)
goto out;
if (H5Tenum_insert(tid, "GREEN", (val = 1, &val)) < 0)
goto out;
- if (write_dset(loc_id,3,dims3,"enum3D",tid,0) < 0)
+ if (write_dset(loc_id, 3, dims3, "enum3D", tid, 0) < 0)
goto out;
if (H5Tclose(tid) < 0)
goto out;
/*-------------------------------------------------------------------------
- * H5T_VLEN
- *-------------------------------------------------------------------------
- */
+ * H5T_VLEN
+ *-------------------------------------------------------------------------
+ */
/* Allocate and initialize VL dataset to write */
n = 0;
- for(i = 0; i < 4; i++) {
- for(j = 0; j < 3; j++) {
- for(k = 0; k < 2; k++) {
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < 3; j++) {
+ for (k = 0; k < 2; k++) {
unsigned l;
- buf53[i][j][k].p = HDmalloc((i + 1) * sizeof(int));
+ buf53[i][j][k].p = HDmalloc((i + 1) * sizeof(int));
buf53[i][j][k].len = (size_t)(i + 1);
- for(l = 0; l < i + 1; l++) {
- if(make_diffs)
+ for (l = 0; l < i + 1; l++) {
+ if (make_diffs)
((int *)buf53[i][j][k].p)[l] = 0;
else
((int *)buf53[i][j][k].p)[l] = n++;
@@ -4533,7 +4544,7 @@ int write_dset_in(hid_t loc_id,
if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf53) < 0)
goto out;
- if (H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf53) < 0)
+ if (H5Treclaim(tid, sid, H5P_DEFAULT, buf53) < 0)
goto out;
if (H5Dclose(did) < 0)
@@ -4544,15 +4555,14 @@ int write_dset_in(hid_t loc_id,
goto out;
/*-------------------------------------------------------------------------
- * H5T_ARRAY
- *-------------------------------------------------------------------------
- */
-
+ * H5T_ARRAY
+ *-------------------------------------------------------------------------
+ */
n = 1;
- for(i = 0; i < 24; i++) {
- for(j = 0; j < dimarray[0]; j++) {
- if(make_diffs)
+ for (i = 0; i < 24; i++) {
+ for (j = 0; j < dimarray[0]; j++) {
+ if (make_diffs)
buf63[i][j] = 0;
else
buf63[i][j] = n++;
@@ -4567,76 +4577,77 @@ int write_dset_in(hid_t loc_id,
goto out;
/*-------------------------------------------------------------------------
- * H5T_INTEGER and H5T_FLOAT
- *-------------------------------------------------------------------------
- */
- n=1; f=1;
+ * H5T_INTEGER and H5T_FLOAT
+ *-------------------------------------------------------------------------
+ */
+ n = 1;
+ f = 1;
for (i = 0; i < 4; i++) {
for (j = 0; j < 3; j++) {
for (k = 0; k < 2; k++) {
if (make_diffs) {
- buf73[i][j][k]=0;
- buf83[i][j][k]=0;
+ buf73[i][j][k] = 0;
+ buf83[i][j][k] = 0;
}
else {
- buf73[i][j][k]=n++;
- buf83[i][j][k]=f++;
+ buf73[i][j][k] = n++;
+ buf83[i][j][k] = f++;
}
}
}
}
- if (write_dset(loc_id,3,dims3,"integer3D",H5T_NATIVE_INT,buf73) < 0)
+ if (write_dset(loc_id, 3, dims3, "integer3D", H5T_NATIVE_INT, buf73) < 0)
goto out;
- if (write_dset(loc_id,3,dims3,"float3D",H5T_NATIVE_FLOAT,buf83) < 0)
+ if (write_dset(loc_id, 3, dims3, "float3D", H5T_NATIVE_FLOAT, buf83) < 0)
goto out;
return 0;
out:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(pid);
H5Sclose(sid);
H5Dclose(did);
H5Tclose(tid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
}
-
-
/*-------------------------------------------------------------------------
-* Function: make_dset_reg_ref
-*
-* Purpose: write dataset region references
-*
-*-------------------------------------------------------------------------
-*/
+ * Function: make_dset_reg_ref
+ *
+ * Purpose: write dataset region references
+ *
+ *-------------------------------------------------------------------------
+ */
#define SPACE1_RANK 1
#define SPACE1_DIM1 1
#define SPACE2_RANK 2
#define SPACE2_DIM1 10
#define SPACE2_DIM2 10
-static
-int make_dset_reg_ref(hid_t loc_id)
+static int
+make_dset_reg_ref(hid_t loc_id)
{
- hid_t did1=-1; /* Dataset ID */
- hid_t did2=-1; /* Dereferenced dataset ID */
- hid_t sid1=-1; /* Dataspace ID #1 */
- hid_t sid2=-1; /* Dataspace ID #2 */
- hsize_t dims1[] = {SPACE1_DIM1};
- hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
- hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */
- hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */
- hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */
- hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */
- hdset_reg_ref_t *wbuf=NULL; /* buffer to write to disk */
- int *dwbuf=NULL; /* Buffer for writing numeric data to disk */
- int i; /* counting variables */
- int retval = -1; /* return value */
+ hid_t did1 = H5I_INVALID_HID; /* Dataset ID */
+ hid_t did2 = H5I_INVALID_HID; /* Dereferenced dataset ID */
+ hid_t sid1 = H5I_INVALID_HID; /* Dataspace ID #1 */
+ hid_t sid2 = H5I_INVALID_HID; /* Dataspace ID #2 */
+ hsize_t dims1[] = {SPACE1_DIM1};
+ hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
+ hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */
+ hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */
+ hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */
+ hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */
+ hdset_reg_ref_t *wbuf = NULL; /* buffer to write to disk */
+ int * dwbuf = NULL; /* Buffer for writing numeric data to disk */
+ int i; /* counting variables */
+ int retval = -1; /* return value */
/* Allocate write & read buffers */
- wbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)SPACE1_DIM1);
+ wbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)SPACE1_DIM1);
dwbuf = (int *)HDmalloc(sizeof(int) * SPACE2_DIM1 * SPACE2_DIM2);
/* Create dataspace for datasets */
@@ -4644,7 +4655,8 @@ int make_dset_reg_ref(hid_t loc_id)
goto out;
/* Create a dataset */
- if ((did2 = H5Dcreate2(loc_id, "dsetreg", H5T_NATIVE_UCHAR, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((did2 = H5Dcreate2(loc_id, "dsetreg", H5T_NATIVE_UCHAR, sid2, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
goto out;
for (i = 0; i < SPACE2_DIM1 * SPACE2_DIM2; i++)
@@ -4659,24 +4671,28 @@ int make_dset_reg_ref(hid_t loc_id)
goto out;
/* Create a dataset */
- if ((did1 = H5Dcreate2(loc_id, "refreg", H5T_STD_REF_DSETREG, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((did1 = H5Dcreate2(loc_id, "refreg", H5T_STD_REF_DSETREG, sid1, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
goto out;
/* Select 6x6 hyperslab for first reference */
- start[0] = 2; start[1] = 2;
- stride[0] = 1; stride[1] = 1;
- count[0] = 6; count[1] = 6;
- block[0] = 1; block[1] = 1;
+ start[0] = 2;
+ start[1] = 2;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 6;
+ count[1] = 6;
+ block[0] = 1;
+ block[1] = 1;
if (H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block) < 0)
goto out;
-
/* Store dataset region */
if (H5Rcreate(&wbuf[0], loc_id, "dsetreg", H5R_DATASET_REGION, sid2) < 0)
goto out;
/* Write selection to disk */
- if (H5Dwrite(did1,H5T_STD_REF_DSETREG,H5S_ALL,H5S_ALL,H5P_DEFAULT,wbuf) < 0)
+ if (H5Dwrite(did1, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0)
goto out;
/* Close all objects */
@@ -4692,9 +4708,9 @@ int make_dset_reg_ref(hid_t loc_id)
retval = 0;
out:
- if(wbuf)
+ if (wbuf)
HDfree(wbuf);
- if(dwbuf)
+ if (dwbuf)
HDfree(dwbuf);
H5E_BEGIN_TRY
@@ -4703,105 +4719,96 @@ out:
H5Sclose(sid2);
H5Dclose(did1);
H5Dclose(did2);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return retval;
}
/*-------------------------------------------------------------------------
-* Function: write_attr_in
-*
-* Purpose: write attributes in LOC_ID (dataset, group, named datatype)
-*
-* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
-*
-* Date: November 12, 2003
-*
-*-------------------------------------------------------------------------
-*/
-
-static
-int write_attr_in(hid_t loc_id,
- const char* dset_name, /* for saving reference to dataset*/
- hid_t fid, /* for reference create */
- int make_diffs /* flag to modify data buffers */)
+ * Function: write_attr_in
+ *
+ * Purpose: write attributes in LOC_ID (dataset, group, named datatype)
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: November 12, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static int
+write_attr_in(hid_t loc_id, const char *dset_name, /* for saving reference to dataset*/
+ hid_t fid, /* for reference create */
+ int make_diffs /* flag to modify data buffers */)
{
/* Compound datatype */
- typedef struct s_t
- {
+ typedef struct s_t {
char a;
double b;
} s_t;
- typedef enum
- {
- RED,
- GREEN
- } e_t;
-
- hid_t aid = -1;
- hid_t sid = -1;
- hid_t tid = -1;
- int val, j, k, n;
+ typedef enum { RED, GREEN } e_t;
+
+ hid_t aid = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ hid_t tid = H5I_INVALID_HID;
+ int val, j, k, n;
unsigned i;
- float f;
+ float f;
/* create 1D attributes with dimension [2], 2 elements */
- hsize_t dims[1]={2};
- char buf1[2][3]= {"ab","de"}; /* string */
- char buf2[2]= {1,2}; /* bitfield, opaque */
- s_t buf3[2]= {{1,2},{3,4}}; /* compound */
- hobj_ref_t buf4[2]; /* reference */
- e_t buf45[2]= {RED,RED}; /* enum */
- hvl_t buf5[2]; /* vlen */
- hsize_t dimarray[1]={3}; /* array dimension */
- int buf6[2][3]= {{1,2,3},{4,5,6}}; /* array */
- int buf7[2]= {1,2}; /* integer */
- float buf8[2]= {1,2}; /* float */
+ hsize_t dims[1] = {2};
+ char buf1[2][3] = {"ab", "de"}; /* string */
+ char buf2[2] = {1, 2}; /* bitfield, opaque */
+ s_t buf3[2] = {{1, 2}, {3, 4}}; /* compound */
+ hobj_ref_t buf4[2]; /* reference */
+ e_t buf45[2] = {RED, RED}; /* enum */
+ hvl_t buf5[2]; /* vlen */
+ hsize_t dimarray[1] = {3}; /* array dimension */
+ int buf6[2][3] = {{1, 2, 3}, {4, 5, 6}}; /* array */
+ int buf7[2] = {1, 2}; /* integer */
+ float buf8[2] = {1, 2}; /* float */
/* create 2D attributes with dimension [3][2], 6 elements */
- hsize_t dims2[2]={3,2};
- char buf12[6][3]= {"ab","cd","ef","gh","ij","kl"}; /* string */
- char buf22[3][2]= {{1,2},{3,4},{5,6}}; /* bitfield, opaque */
- s_t buf32[6]= {{1,2},{3,4},{5,6},{7,8},{9,10},{11,12}}; /* compound */
- hobj_ref_t buf42[3][2]; /* reference */
- e_t buf452[3][2]; /* enum */
- hvl_t buf52[3][2]; /* vlen */
- int buf62[6][3]= {{1,2,3},{4,5,6},{7,8,9},{10,11,12},{13,14,15},{16,17,18}}; /* array */
- int buf72[3][2]= {{1,2},{3,4},{5,6}}; /* integer */
- float buf82[3][2]= {{1,2},{3,4},{5,6}}; /* float */
+ hsize_t dims2[2] = {3, 2};
+ char buf12[6][3] = {"ab", "cd", "ef", "gh", "ij", "kl"}; /* string */
+ char buf22[3][2] = {{1, 2}, {3, 4}, {5, 6}}; /* bitfield, opaque */
+ s_t buf32[6] = {{1, 2}, {3, 4}, {5, 6}, {7, 8}, {9, 10}, {11, 12}}; /* compound */
+ hobj_ref_t buf42[3][2]; /* reference */
+ e_t buf452[3][2]; /* enum */
+ hvl_t buf52[3][2]; /* vlen */
+ int buf62[6][3] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}, {10, 11, 12}, {13, 14, 15}, {16, 17, 18}}; /* array */
+ int buf72[3][2] = {{1, 2}, {3, 4}, {5, 6}}; /* integer */
+ float buf82[3][2] = {{1, 2}, {3, 4}, {5, 6}}; /* float */
/* create 3D attributes with dimension [4][3][2], 24 elements */
- hsize_t dims3[3]={4,3,2};
- char buf13[24][3]= {"ab","cd","ef","gh","ij","kl","mn","pq",
- "rs","tu","vw","xz","AB","CD","EF","GH",
- "IJ","KL","MN","PQ","RS","TU","VW","XZ"}; /* string */
- char buf23[4][3][2]; /* bitfield, opaque */
- s_t buf33[4][3][2]; /* compound */
- hobj_ref_t buf43[4][3][2]; /* reference */
- e_t buf453[4][3][2]; /* enum */
- hvl_t buf53[4][3][2]; /* vlen */
- int buf63[24][3]; /* array */
- int buf73[4][3][2]; /* integer */
- float buf83[4][3][2]; /* float */
-
-
- /*-------------------------------------------------------------------------
- * 1D attributes
- *-------------------------------------------------------------------------
- */
+ hsize_t dims3[3] = {4, 3, 2};
+ char buf13[24][3] = {"ab", "cd", "ef", "gh", "ij", "kl", "mn", "pq", "rs", "tu", "vw", "xz",
+ "AB", "CD", "EF", "GH", "IJ", "KL", "MN", "PQ", "RS", "TU", "VW", "XZ"}; /* string */
+ char buf23[4][3][2]; /* bitfield, opaque */
+ s_t buf33[4][3][2]; /* compound */
+ hobj_ref_t buf43[4][3][2]; /* reference */
+ e_t buf453[4][3][2]; /* enum */
+ hvl_t buf53[4][3][2]; /* vlen */
+ int buf63[24][3]; /* array */
+ int buf73[4][3][2]; /* integer */
+ float buf83[4][3][2]; /* float */
+
+ /*-------------------------------------------------------------------------
+ * 1D attributes
+ *-------------------------------------------------------------------------
+ */
/*-------------------------------------------------------------------------
- * H5T_STRING
- *-------------------------------------------------------------------------
- */
+ * H5T_STRING
+ *-------------------------------------------------------------------------
+ */
- if (make_diffs)
- {
- for (i=0; i<2; i++)
- for (j=0; j<2; j++)
- {
- buf1[i][j]='z';
+ if (make_diffs) {
+ for (i = 0; i < 2; i++)
+ for (j = 0; j < 2; j++) {
+ buf1[i][j] = 'z';
}
}
/*
@@ -4820,21 +4827,20 @@ int write_attr_in(hid_t loc_id,
goto out;
if (H5Tset_size(tid, (size_t)2) < 0)
goto out;
- if (make_attr(loc_id,1,dims,"string",tid,buf1) < 0)
+ if (make_attr(loc_id, 1, dims, "string", tid, buf1) < 0)
goto out;
if (H5Tclose(tid) < 0)
goto out;
- tid = -1;
+ tid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
- * H5T_BITFIELD
- *-------------------------------------------------------------------------
- */
+ * H5T_BITFIELD
+ *-------------------------------------------------------------------------
+ */
- if (make_diffs)
- {
- for (i=0; i<2; i++)
- buf2[i]=buf2[1]=0;
+ if (make_diffs) {
+ for (i = 0; i < 2; i++)
+ buf2[i] = buf2[1] = 0;
}
/*
buf2[2]= {1,2};
@@ -4850,16 +4856,16 @@ int write_attr_in(hid_t loc_id,
if ((tid = H5Tcopy(H5T_STD_B8LE)) < 0)
goto out;
- if (make_attr(loc_id,1,dims,"bitfield",tid,buf2) < 0)
+ if (make_attr(loc_id, 1, dims, "bitfield", tid, buf2) < 0)
goto out;
if (H5Tclose(tid) < 0)
goto out;
- tid = -1;
+ tid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
- * H5T_OPAQUE
- *-------------------------------------------------------------------------
- */
+ * H5T_OPAQUE
+ *-------------------------------------------------------------------------
+ */
/*
buf2[2]= {1,2};
@@ -4877,22 +4883,21 @@ int write_attr_in(hid_t loc_id,
goto out;
if (H5Tset_tag(tid, "1-byte opaque type") < 0)
goto out;
- if (make_attr(loc_id,1,dims,"opaque",tid,buf2) < 0)
+ if (make_attr(loc_id, 1, dims, "opaque", tid, buf2) < 0)
goto out;
if (H5Tclose(tid) < 0)
goto out;
- tid = -1;
+ tid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
- * H5T_COMPOUND
- *-------------------------------------------------------------------------
- */
+ * H5T_COMPOUND
+ *-------------------------------------------------------------------------
+ */
- if (make_diffs)
- {
- for (i=0; i<2; i++)
- {
- buf3[i].a=0; buf3[i].b=0;
+ if (make_diffs) {
+ for (i = 0; i < 2; i++) {
+ buf3[i].a = 0;
+ buf3[i].b = 0;
}
}
@@ -4909,43 +4914,39 @@ int write_attr_in(hid_t loc_id,
[ 1 ] 4 5 1
*/
- if ((tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t))) < 0)
+ if ((tid = H5Tcreate(H5T_COMPOUND, sizeof(s_t))) < 0)
goto out;
if (H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR) < 0)
goto out;
if (H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE) < 0)
goto out;
- if (make_attr(loc_id,1,dims,"compound",tid,buf3) < 0)
+ if (make_attr(loc_id, 1, dims, "compound", tid, buf3) < 0)
goto out;
if (H5Tclose(tid) < 0)
goto out;
- tid = -1;
+ tid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
- * H5T_REFERENCE
- *-------------------------------------------------------------------------
- */
+ * H5T_REFERENCE
+ *-------------------------------------------------------------------------
+ */
/* object references ( H5R_OBJECT */
- if (dset_name)
- {
- if (H5Rcreate(&buf4[0],fid,dset_name,H5R_OBJECT,(hid_t)-1) < 0)
+ if (dset_name) {
+ if (H5Rcreate(&buf4[0], fid, dset_name, H5R_OBJECT, (hid_t)-1) < 0)
goto out;
- if (H5Rcreate(&buf4[1],fid,dset_name,H5R_OBJECT,(hid_t)-1) < 0)
+ if (H5Rcreate(&buf4[1], fid, dset_name, H5R_OBJECT, (hid_t)-1) < 0)
goto out;
- if (make_attr(loc_id,1,dims,"reference",H5T_STD_REF_OBJ,buf4) < 0)
+ if (make_attr(loc_id, 1, dims, "reference", H5T_STD_REF_OBJ, buf4) < 0)
goto out;
}
-
/*-------------------------------------------------------------------------
- * H5T_ENUM
- *-------------------------------------------------------------------------
- */
- if (make_diffs)
- {
- for (i=0; i<2; i++)
- {
- buf45[i]=GREEN;
+ * H5T_ENUM
+ *-------------------------------------------------------------------------
+ */
+ if (make_diffs) {
+ for (i = 0; i < 2; i++) {
+ buf45[i] = GREEN;
}
}
/*
@@ -4960,33 +4961,32 @@ int write_attr_in(hid_t loc_id,
*/
if ((tid = H5Tcreate(H5T_ENUM, sizeof(e_t))) < 0)
goto out;
- if (H5Tenum_insert(tid, "RED", (val = 0, &val)) < 0)
+ if (H5Tenum_insert(tid, "RED", (val = 0, &val)) < 0)
goto out;
if (H5Tenum_insert(tid, "GREEN", (val = 1, &val)) < 0)
goto out;
- if (make_attr(loc_id,1,dims,"enum",tid,buf45) < 0)
+ if (make_attr(loc_id, 1, dims, "enum", tid, buf45) < 0)
goto out;
if (H5Tclose(tid) < 0)
goto out;
- tid = -1;
+ tid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
- * H5T_VLEN
- *-------------------------------------------------------------------------
- */
+ * H5T_VLEN
+ *-------------------------------------------------------------------------
+ */
/* Allocate and initialize VL dataset to write */
- buf5[0].len = 1;
- buf5[0].p = HDmalloc( 1 * sizeof(int));
- ((int *)buf5[0].p)[0]=1;
- buf5[1].len = 2;
- buf5[1].p = HDmalloc(2 * sizeof(int));
+ buf5[0].len = 1;
+ buf5[0].p = HDmalloc(1 * sizeof(int));
+ ((int *)buf5[0].p)[0] = 1;
+ buf5[1].len = 2;
+ buf5[1].p = HDmalloc(2 * sizeof(int));
((int *)buf5[1].p)[0] = 2;
((int *)buf5[1].p)[1] = 3;
- if(make_diffs)
- {
+ if (make_diffs) {
((int *)buf5[0].p)[0] = 0;
((int *)buf5[1].p)[0] = 0;
((int *)buf5[1].p)[1] = 0;
@@ -5009,29 +5009,27 @@ int write_attr_in(hid_t loc_id,
goto out;
if (H5Awrite(aid, tid, buf5) < 0)
goto out;
- if (H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf5) < 0)
+ if (H5Treclaim(tid, sid, H5P_DEFAULT, buf5) < 0)
goto out;
if (H5Aclose(aid) < 0)
goto out;
- aid = -1;
+ aid = H5I_INVALID_HID;
if (H5Tclose(tid) < 0)
goto out;
- tid = -1;
+ tid = H5I_INVALID_HID;
if (H5Sclose(sid) < 0)
goto out;
- sid = -1;
+ sid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
- * H5T_ARRAY
- *-------------------------------------------------------------------------
- */
+ * H5T_ARRAY
+ *-------------------------------------------------------------------------
+ */
- if (make_diffs)
- {
- for (i=0; i<2; i++)
- for (j=0; j<3; j++)
- {
- buf6[i][j]=0;
+ if (make_diffs) {
+ for (i = 0; i < 2; i++)
+ for (j = 0; j < 3; j++) {
+ buf6[i][j] = 0;
}
}
/*
@@ -5054,19 +5052,17 @@ int write_attr_in(hid_t loc_id,
goto out;
if (H5Tclose(tid) < 0)
goto out;
- tid = -1;
+ tid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
- * H5T_INTEGER and H5T_FLOAT
- *-------------------------------------------------------------------------
- */
+ * H5T_INTEGER and H5T_FLOAT
+ *-------------------------------------------------------------------------
+ */
- if(make_diffs)
- {
- for(i = 0; i < 2; i++)
- {
- buf7[i]=0;
- buf8[i]=0;
+ if (make_diffs) {
+ for (i = 0; i < 2; i++) {
+ buf7[i] = 0;
+ buf8[i] = 0;
}
}
@@ -5084,23 +5080,21 @@ int write_attr_in(hid_t loc_id,
[ 0 ] 1 0 1
[ 1 ] 2 0 2
*/
- if (make_attr(loc_id,1,dims,"integer",H5T_NATIVE_INT,buf7) < 0)
+ if (make_attr(loc_id, 1, dims, "integer", H5T_NATIVE_INT, buf7) < 0)
goto out;
- if (make_attr(loc_id,1,dims,"float",H5T_NATIVE_FLOAT,buf8) < 0)
+ if (make_attr(loc_id, 1, dims, "float", H5T_NATIVE_FLOAT, buf8) < 0)
goto out;
-
/*-------------------------------------------------------------------------
- * 2D attributes
- *-------------------------------------------------------------------------
- */
+ * 2D attributes
+ *-------------------------------------------------------------------------
+ */
/*-------------------------------------------------------------------------
- * H5T_STRING
- *-------------------------------------------------------------------------
- */
- if (make_diffs)
- {
+ * H5T_STRING
+ *-------------------------------------------------------------------------
+ */
+ if (make_diffs) {
HDmemset(buf12, 'z', sizeof buf12);
}
@@ -5128,20 +5122,19 @@ int write_attr_in(hid_t loc_id,
goto out;
if (H5Tset_size(tid, (size_t)2) < 0)
goto out;
- if (make_attr(loc_id,2,dims2,"string2D",tid,buf12) < 0)
+ if (make_attr(loc_id, 2, dims2, "string2D", tid, buf12) < 0)
goto out;
if (H5Tclose(tid) < 0)
goto out;
- tid = -1;
+ tid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
- * H5T_BITFIELD
- *-------------------------------------------------------------------------
- */
+ * H5T_BITFIELD
+ *-------------------------------------------------------------------------
+ */
- if (make_diffs)
- {
- HDmemset(buf22,0,sizeof buf22);
+ if (make_diffs) {
+ HDmemset(buf22, 0, sizeof buf22);
}
/*
@@ -5158,19 +5151,18 @@ int write_attr_in(hid_t loc_id,
[ 2 1 ] 6 0 6
*/
-
if ((tid = H5Tcopy(H5T_STD_B8LE)) < 0)
goto out;
- if (make_attr(loc_id,2,dims2,"bitfield2D",tid,buf22) < 0)
+ if (make_attr(loc_id, 2, dims2, "bitfield2D", tid, buf22) < 0)
goto out;
if (H5Tclose(tid) < 0)
goto out;
- tid = -1;
+ tid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
- * H5T_OPAQUE
- *-------------------------------------------------------------------------
- */
+ * H5T_OPAQUE
+ *-------------------------------------------------------------------------
+ */
/*
buf22[3][2]= {{1,2},{3,4},{5,6}};
@@ -5189,19 +5181,18 @@ int write_attr_in(hid_t loc_id,
goto out;
if (H5Tset_tag(tid, "1-byte opaque type") < 0)
goto out;
- if (make_attr(loc_id,2,dims2,"opaque2D",tid,buf22) < 0)
+ if (make_attr(loc_id, 2, dims2, "opaque2D", tid, buf22) < 0)
goto out;
if (H5Tclose(tid) < 0)
goto out;
- tid = -1;
+ tid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
- * H5T_COMPOUND
- *-------------------------------------------------------------------------
- */
- if (make_diffs)
- {
- HDmemset(buf32,0,sizeof buf32);
+ * H5T_COMPOUND
+ *-------------------------------------------------------------------------
+ */
+ if (make_diffs) {
+ HDmemset(buf32, 0, sizeof buf32);
}
/*
@@ -5218,47 +5209,44 @@ int write_attr_in(hid_t loc_id,
[ 2 1 ] 6 0 6
*/
-
- if ((tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t))) < 0)
+ if ((tid = H5Tcreate(H5T_COMPOUND, sizeof(s_t))) < 0)
goto out;
if (H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR) < 0)
goto out;
if (H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE) < 0)
goto out;
- if (make_attr(loc_id,2,dims2,"compound2D",tid,buf32) < 0)
+ if (make_attr(loc_id, 2, dims2, "compound2D", tid, buf32) < 0)
goto out;
if (H5Tclose(tid) < 0)
goto out;
- tid = -1;
+ tid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
- * H5T_REFERENCE
- *-------------------------------------------------------------------------
- */
+ * H5T_REFERENCE
+ *-------------------------------------------------------------------------
+ */
/* Create references to dataset */
- if (dset_name)
- {
- for (i = 0; i < 3; i++)
- {
- for (j = 0; j < 2; j++)
- {
- if (H5Rcreate(&buf42[i][j],fid,dset_name,H5R_OBJECT,(hid_t)-1) < 0)
+ if (dset_name) {
+ for (i = 0; i < 3; i++) {
+ for (j = 0; j < 2; j++) {
+ if (H5Rcreate(&buf42[i][j], fid, dset_name, H5R_OBJECT, (hid_t)-1) < 0)
goto out;
}
}
- if (make_attr(loc_id,2,dims2,"reference2D",H5T_STD_REF_OBJ,buf42) < 0)
+ if (make_attr(loc_id, 2, dims2, "reference2D", H5T_STD_REF_OBJ, buf42) < 0)
goto out;
}
/*-------------------------------------------------------------------------
- * H5T_ENUM
- *-------------------------------------------------------------------------
- */
- for (i=0; i<3; i++)
- {
- for (j=0; j<2; j++)
- {
- if (make_diffs) buf452[i][j]=GREEN; else buf452[i][j]=RED;
+ * H5T_ENUM
+ *-------------------------------------------------------------------------
+ */
+ for (i = 0; i < 3; i++) {
+ for (j = 0; j < 2; j++) {
+ if (make_diffs)
+ buf452[i][j] = GREEN;
+ else
+ buf452[i][j] = RED;
}
}
@@ -5276,31 +5264,31 @@ int write_attr_in(hid_t loc_id,
if ((tid = H5Tcreate(H5T_ENUM, sizeof(e_t))) < 0)
goto out;
- if (H5Tenum_insert(tid, "RED", (val = 0, &val)) < 0)
+ if (H5Tenum_insert(tid, "RED", (val = 0, &val)) < 0)
goto out;
if (H5Tenum_insert(tid, "GREEN", (val = 1, &val)) < 0)
goto out;
- if (make_attr(loc_id,2,dims2,"enum2D",tid,buf452) < 0)
+ if (make_attr(loc_id, 2, dims2, "enum2D", tid, buf452) < 0)
goto out;
if (H5Tclose(tid) < 0)
goto out;
- tid = -1;
+ tid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
- * H5T_VLEN
- *-------------------------------------------------------------------------
- */
+ * H5T_VLEN
+ *-------------------------------------------------------------------------
+ */
/* Allocate and initialize VL dataset to write */
- n=0;
- for(i = 0; i < 3; i++) {
- for(j = 0; j < 2; j++) {
+ n = 0;
+ for (i = 0; i < 3; i++) {
+ for (j = 0; j < 2; j++) {
unsigned l;
- buf52[i][j].p = HDmalloc((i + 1) * sizeof(int));
+ buf52[i][j].p = HDmalloc((i + 1) * sizeof(int));
buf52[i][j].len = (size_t)(i + 1);
- for(l = 0; l < i + 1; l++)
- if(make_diffs)
+ for (l = 0; l < i + 1; l++)
+ if (make_diffs)
((int *)buf52[i][j].p)[l] = 0;
else
((int *)buf52[i][j].p)[l] = n++;
@@ -5331,26 +5319,25 @@ int write_attr_in(hid_t loc_id,
goto out;
if (H5Awrite(aid, tid, buf52) < 0)
goto out;
- if (H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf52) < 0)
+ if (H5Treclaim(tid, sid, H5P_DEFAULT, buf52) < 0)
goto out;
if (H5Aclose(aid) < 0)
goto out;
- aid = -1;
+ aid = H5I_INVALID_HID;
if (H5Tclose(tid) < 0)
goto out;
- tid = -1;
+ tid = H5I_INVALID_HID;
if (H5Sclose(sid) < 0)
goto out;
- sid = -1;
+ sid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
- * H5T_ARRAY
- *-------------------------------------------------------------------------
- */
+ * H5T_ARRAY
+ *-------------------------------------------------------------------------
+ */
- if (make_diffs)
- {
- HDmemset(buf62,0,sizeof buf62);
+ if (make_diffs) {
+ HDmemset(buf62, 0, sizeof buf62);
}
/*
buf62[6][3]= {{1,2,3},{4,5,6},{7,8,9},{10,11,12},{13,14,15},{16,17,18}};
@@ -5384,15 +5371,14 @@ int write_attr_in(hid_t loc_id,
goto out;
if (H5Tclose(tid) < 0)
goto out;
- tid = -1;
+ tid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
- * H5T_INTEGER and H5T_FLOAT
- *-------------------------------------------------------------------------
- */
+ * H5T_INTEGER and H5T_FLOAT
+ *-------------------------------------------------------------------------
+ */
- if(make_diffs)
- {
+ if (make_diffs) {
HDmemset(buf72, 0, sizeof buf72);
HDmemset(buf82, 0, sizeof buf82);
}
@@ -5418,25 +5404,23 @@ int write_attr_in(hid_t loc_id,
[ 2 1 ] 6 0 6
*/
- if (make_attr(loc_id,2,dims2,"integer2D",H5T_NATIVE_INT,buf72) < 0)
+ if (make_attr(loc_id, 2, dims2, "integer2D", H5T_NATIVE_INT, buf72) < 0)
goto out;
- if (make_attr(loc_id,2,dims2,"float2D",H5T_NATIVE_FLOAT,buf82) < 0)
+ if (make_attr(loc_id, 2, dims2, "float2D", H5T_NATIVE_FLOAT, buf82) < 0)
goto out;
-
/*-------------------------------------------------------------------------
- * 3D attributes
- *-------------------------------------------------------------------------
- */
+ * 3D attributes
+ *-------------------------------------------------------------------------
+ */
/*-------------------------------------------------------------------------
- * H5T_STRING
- *-------------------------------------------------------------------------
- */
+ * H5T_STRING
+ *-------------------------------------------------------------------------
+ */
- if (make_diffs)
- {
- HDmemset(buf13,'z',sizeof buf13);
+ if (make_diffs) {
+ HDmemset(buf13, 'z', sizeof buf13);
}
/*
@@ -5500,22 +5484,22 @@ int write_attr_in(hid_t loc_id,
goto out;
if (H5Tset_size(tid, (size_t)2) < 0)
goto out;
- if (make_attr(loc_id,3,dims3,"string3D",tid,buf13) < 0)
+ if (make_attr(loc_id, 3, dims3, "string3D", tid, buf13) < 0)
goto out;
if (H5Tclose(tid) < 0)
goto out;
- tid = -1;
+ tid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
- * H5T_BITFIELD
- *-------------------------------------------------------------------------
- */
+ * H5T_BITFIELD
+ *-------------------------------------------------------------------------
+ */
- n=1;
- for(i = 0; i < 4; i++) {
- for(j = 0; j < 3; j++) {
- for(k = 0; k < 2; k++) {
- if(make_diffs)
+ n = 1;
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < 3; j++) {
+ for (k = 0; k < 2; k++) {
+ if (make_diffs)
buf23[i][j][k] = 0;
else
buf23[i][j][k] = (char)(n++);
@@ -5554,36 +5538,36 @@ int write_attr_in(hid_t loc_id,
if ((tid = H5Tcopy(H5T_STD_B8LE)) < 0)
goto out;
- if (make_attr(loc_id,3,dims3,"bitfield3D",tid,buf23) < 0)
+ if (make_attr(loc_id, 3, dims3, "bitfield3D", tid, buf23) < 0)
goto out;
if (H5Tclose(tid) < 0)
goto out;
- tid = -1;
+ tid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
- * H5T_OPAQUE
- *-------------------------------------------------------------------------
- */
+ * H5T_OPAQUE
+ *-------------------------------------------------------------------------
+ */
if ((tid = H5Tcreate(H5T_OPAQUE, (size_t)1)) < 0)
goto out;
if (H5Tset_tag(tid, "1-byte opaque type") < 0)
goto out;
- if (make_attr(loc_id,3,dims3,"opaque3D",tid,buf23) < 0)
+ if (make_attr(loc_id, 3, dims3, "opaque3D", tid, buf23) < 0)
goto out;
if (H5Tclose(tid) < 0)
goto out;
- tid = -1;
+ tid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
- * H5T_COMPOUND
- *-------------------------------------------------------------------------
- */
+ * H5T_COMPOUND
+ *-------------------------------------------------------------------------
+ */
- n=1;
- for(i = 0; i < 4; i++) {
- for(j = 0; j < 3; j++) {
- for(k = 0; k < 2; k++) {
- if(make_diffs) {
+ n = 1;
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < 3; j++) {
+ for (k = 0; k < 2; k++) {
+ if (make_diffs) {
buf33[i][j][k].a = 0;
buf33[i][j][k].b = 0;
}
@@ -5646,58 +5630,48 @@ int write_attr_in(hid_t loc_id,
[ 3 2 1 ] 48 0 48
*/
-
-
- if ((tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t))) < 0)
+ if ((tid = H5Tcreate(H5T_COMPOUND, sizeof(s_t))) < 0)
goto out;
if (H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR) < 0)
goto out;
if (H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE) < 0)
goto out;
- if (make_attr(loc_id,3,dims3,"compound3D",tid,buf33) < 0)
+ if (make_attr(loc_id, 3, dims3, "compound3D", tid, buf33) < 0)
goto out;
if (H5Tclose(tid) < 0)
goto out;
- tid = -1;
+ tid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
- * H5T_REFERENCE
- *-------------------------------------------------------------------------
- */
+ * H5T_REFERENCE
+ *-------------------------------------------------------------------------
+ */
/* Create references to dataset */
- if (dset_name)
- {
- for (i = 0; i < 4; i++)
- {
- for (j = 0; j < 3; j++)
- {
+ if (dset_name) {
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < 3; j++) {
for (k = 0; k < 2; k++)
- if (H5Rcreate(&buf43[i][j][k],fid,dset_name,H5R_OBJECT,(hid_t)-1) < 0)
+ if (H5Rcreate(&buf43[i][j][k], fid, dset_name, H5R_OBJECT, (hid_t)-1) < 0)
goto out;
}
}
- if (make_attr(loc_id,3,dims3,"reference3D",H5T_STD_REF_OBJ,buf43) < 0)
+ if (make_attr(loc_id, 3, dims3, "reference3D", H5T_STD_REF_OBJ, buf43) < 0)
goto out;
}
/*-------------------------------------------------------------------------
- * H5T_ENUM
- *-------------------------------------------------------------------------
- */
+ * H5T_ENUM
+ *-------------------------------------------------------------------------
+ */
- for (i = 0; i < 4; i++)
- {
- for (j = 0; j < 3; j++)
- {
- for (k = 0; k < 2; k++)
- {
- if (make_diffs)
- {
- buf453[i][j][k]=RED;
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < 3; j++) {
+ for (k = 0; k < 2; k++) {
+ if (make_diffs) {
+ buf453[i][j][k] = RED;
}
- else
- {
- buf453[i][j][k]=GREEN;
+ else {
+ buf453[i][j][k] = GREEN;
}
}
}
@@ -5732,35 +5706,31 @@ int write_attr_in(hid_t loc_id,
[ 3 2 1 ] GREEN RED
*/
-
if ((tid = H5Tcreate(H5T_ENUM, sizeof(e_t))) < 0)
goto out;
- if (H5Tenum_insert(tid, "RED", (val = 0, &val)) < 0)
+ if (H5Tenum_insert(tid, "RED", (val = 0, &val)) < 0)
goto out;
if (H5Tenum_insert(tid, "GREEN", (val = 1, &val)) < 0)
goto out;
- if (make_attr(loc_id,3,dims3,"enum3D",tid,buf453) < 0)
+ if (make_attr(loc_id, 3, dims3, "enum3D", tid, buf453) < 0)
goto out;
if (H5Tclose(tid) < 0)
goto out;
- tid = -1;
+ tid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
- * H5T_VLEN
- *-------------------------------------------------------------------------
- */
+ * H5T_VLEN
+ *-------------------------------------------------------------------------
+ */
/* Allocate and initialize VL dataset to write */
- n=0;
- for (i = 0; i < 4; i++)
- {
- for (j = 0; j < 3; j++)
- {
- for (k = 0; k < 2; k++)
- {
+ n = 0;
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < 3; j++) {
+ for (k = 0; k < 2; k++) {
unsigned l;
- buf53[i][j][k].p = HDmalloc((i + 1) * sizeof(int));
+ buf53[i][j][k].p = HDmalloc((i + 1) * sizeof(int));
buf53[i][j][k].len = (size_t)i + 1;
for (l = 0; l < i + 1; l++)
if (make_diffs)
@@ -5793,29 +5763,29 @@ int write_attr_in(hid_t loc_id,
goto out;
if (H5Awrite(aid, tid, buf53) < 0)
goto out;
- if (H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf53) < 0)
+ if (H5Treclaim(tid, sid, H5P_DEFAULT, buf53) < 0)
goto out;
if (H5Aclose(aid) < 0)
goto out;
- aid = -1;
+ aid = H5I_INVALID_HID;
if (H5Tclose(tid) < 0)
goto out;
- tid = -1;
+ tid = H5I_INVALID_HID;
if (H5Sclose(sid) < 0)
goto out;
- sid = -1;
+ sid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
- * H5T_ARRAY
- *-------------------------------------------------------------------------
- */
- n=1;
- for (i = 0; i < 24; i++)
- {
- for (j = 0; j < (int)dimarray[0]; j++)
- {
- if (make_diffs) buf63[i][j]=0;
- else buf63[i][j]=n++;
+ * H5T_ARRAY
+ *-------------------------------------------------------------------------
+ */
+ n = 1;
+ for (i = 0; i < 24; i++) {
+ for (j = 0; j < (int)dimarray[0]; j++) {
+ if (make_diffs)
+ buf63[i][j] = 0;
+ else
+ buf63[i][j] = n++;
}
}
/*
@@ -5837,26 +5807,22 @@ int write_attr_in(hid_t loc_id,
goto out;
if (H5Tclose(tid) < 0)
goto out;
- tid = -1;
+ tid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
- * H5T_INTEGER and H5T_FLOAT
- *-------------------------------------------------------------------------
- */
- n = 1; f = 1;
- for(i = 0; i < 4; i++)
- {
- for(j = 0; j < 3; j++)
- {
- for(k = 0; k < 2; k++)
- {
- if(make_diffs)
- {
+ * H5T_INTEGER and H5T_FLOAT
+ *-------------------------------------------------------------------------
+ */
+ n = 1;
+ f = 1;
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < 3; j++) {
+ for (k = 0; k < 2; k++) {
+ if (make_diffs) {
buf73[i][j][k] = 0;
buf83[i][j][k] = 0;
}
- else
- {
+ else {
buf73[i][j][k] = n++;
buf83[i][j][k] = f++;
}
@@ -5879,93 +5845,109 @@ int write_attr_in(hid_t loc_id,
[ 1 1 1 ] 10 0 10
etc
*/
- if (make_attr(loc_id,3,dims3,"integer3D",H5T_NATIVE_INT,buf73) < 0)
+ if (make_attr(loc_id, 3, dims3, "integer3D", H5T_NATIVE_INT, buf73) < 0)
goto out;
- if (make_attr(loc_id,3,dims3,"float3D",H5T_NATIVE_FLOAT,buf83) < 0)
+ if (make_attr(loc_id, 3, dims3, "float3D", H5T_NATIVE_FLOAT, buf83) < 0)
goto out;
-
return 0;
out:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Aclose(aid);
H5Sclose(sid);
H5Tclose(tid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
}
-
-
-
/*-------------------------------------------------------------------------
-* Function: make_dset
-*
-* Purpose: utility function to create and write a dataset in LOC_ID
-*
-* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
-*
-* Date: November 12, 2003
-*
-*-------------------------------------------------------------------------
-*/
-static
-int make_dset(hid_t loc_id,
- const char *name,
- hid_t sid,
- hid_t dcpl,
- void *buf)
+ * Function: make_dset
+ *
+ * Purpose: utility function to create and write a dataset in LOC_ID
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: November 12, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+make_dset(hid_t loc_id, const char *name, hid_t sid, hid_t dcpl, void *buf)
{
- hid_t did=-1;
+ hid_t did = H5I_INVALID_HID;
+ hid_t dxpl_id = H5P_DEFAULT;
if ((did = H5Dcreate2(loc_id, name, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
return -1;
- if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+
+#ifdef H5_HAVE_PARALLEL
+ /* Set up collective writes for parallel driver */
+ if (h5_using_parallel_driver(NULL)) {
+ if ((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ goto out;
+ if (H5Pset_dxpl_mpio(dxpl_id, H5FD_MPIO_COLLECTIVE) < 0)
+ goto out;
+ }
+#endif
+
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id, buf) < 0)
+ goto out;
+ if (dxpl_id != H5P_DEFAULT && H5Pclose(dxpl_id) < 0)
goto out;
if (H5Dclose(did) < 0)
return -1;
return 0;
out:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
}
-
/*-------------------------------------------------------------------------
-* Function: write_dset
-*
-* Purpose: utility function to create and write a dataset in LOC_ID
-*
-* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
-*
-* Date: November 12, 2003
-*
-*-------------------------------------------------------------------------
-*/
-static
-int write_dset( hid_t loc_id,
- int rank,
- hsize_t *dims,
- const char *dset_name,
- hid_t tid,
- void *buf )
+ * Function: write_dset
+ *
+ * Purpose: utility function to create and write a dataset in LOC_ID
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: November 12, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+write_dset(hid_t loc_id, int rank, hsize_t *dims, const char *dset_name, hid_t tid, void *buf)
{
- hid_t did=-1;
- hid_t sid=-1;
+ hid_t did = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ hid_t dxpl_id = H5P_DEFAULT;
if ((sid = H5Screate_simple(rank, dims, NULL)) < 0)
return -1;
if ((did = H5Dcreate2(loc_id, dset_name, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
- if (buf)
- {
- if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ if (buf) {
+#ifdef H5_HAVE_PARALLEL
+ /* Set up collective writes for parallel driver */
+ if (h5_using_parallel_driver(NULL)) {
+ if ((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ goto out;
+ if (H5Pset_dxpl_mpio(dxpl_id, H5FD_MPIO_COLLECTIVE) < 0)
+ goto out;
+ }
+#endif
+
+ if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, dxpl_id, buf) < 0)
goto out;
}
+ if (dxpl_id != H5P_DEFAULT && H5Pclose(dxpl_id) < 0)
+ goto out;
if (H5Dclose(did) < 0)
goto out;
if (H5Sclose(sid) < 0)
@@ -5974,44 +5956,39 @@ int write_dset( hid_t loc_id,
return 0;
out:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
+ H5Pclose(dxpl_id);
H5Dclose(did);
H5Sclose(sid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
}
-
-
/*-------------------------------------------------------------------------
-* Function: make_attr
-*
-* Purpose: utility function to write an attribute in LOC_ID
-*
-* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
-*
-* Date: November 12, 2003
-*
-*-------------------------------------------------------------------------
-*/
-static
-int make_attr(hid_t loc_id,
- int rank,
- hsize_t *dims,
- const char *attr_name,
- hid_t tid,
- void *buf)
+ * Function: make_attr
+ *
+ * Purpose: utility function to write an attribute in LOC_ID
+ *
+ * Programmer: Pedro Vicente
+ *
+ * Date: November 12, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+make_attr(hid_t loc_id, int rank, hsize_t *dims, const char *attr_name, hid_t tid, void *buf)
{
- hid_t aid;
- hid_t sid;
+ hid_t aid;
+ hid_t sid;
if ((sid = H5Screate_simple(rank, dims, NULL)) < 0)
return -1;
if ((aid = H5Acreate2(loc_id, attr_name, tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
- if(buf)
- {
- if(H5Awrite(aid, tid, buf) < 0)
+ if (buf) {
+ if (H5Awrite(aid, tid, buf) < 0)
goto out;
}
if (H5Aclose(aid) < 0)
@@ -6021,119 +5998,120 @@ int make_attr(hid_t loc_id,
return 0;
out:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Aclose(aid);
H5Sclose(sid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
}
-
/*-------------------------------------------------------------------------
-* Function: make_named_dtype
-*
-* Purpose: create a file with named datatypes in various configurations
-*
-*-------------------------------------------------------------------------
-*/
-static
-int make_named_dtype(hid_t loc_id)
+ * Function: make_named_dtype
+ *
+ * Purpose: create a file with named datatypes in various configurations
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+make_named_dtype(hid_t loc_id)
{
- hsize_t dims[1] ={3};
- hid_t did=-1;
- hid_t aid=-1;
- hid_t sid=-1;
- hid_t tid=-1;
- hid_t gid=-1;
+ hsize_t dims[1] = {3};
+ hid_t did = H5I_INVALID_HID;
+ hid_t aid = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ hid_t tid = H5I_INVALID_HID;
+ hid_t gid = H5I_INVALID_HID;
if ((sid = H5Screate_simple(1, dims, NULL)) < 0)
goto out;
/* Create a dataset with an anonymous committed datatype as the first thing
* h5repack sees */
- if((tid = H5Tcopy(H5T_STD_I16LE)) < 0)
+ if ((tid = H5Tcopy(H5T_STD_I16LE)) < 0)
goto out;
- if(H5Tcommit_anon(loc_id, tid, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Tcommit_anon(loc_id, tid, H5P_DEFAULT, H5P_DEFAULT) < 0)
goto out;
if ((did = H5Dcreate2(loc_id, "A", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
- if(H5Tclose(tid) < 0)
+ if (H5Tclose(tid) < 0)
goto out;
/* Create an attribute on that dataset that uses a committed datatype in
* a remote group */
- if((gid = H5Gcreate2(loc_id, "M", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(loc_id, "M", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
goto out;
- if((gid = H5Gcreate2(loc_id, "M/M", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(loc_id, "M/M", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
goto out;
- if((tid = H5Tcopy(H5T_STD_I16BE)) < 0)
+ if ((tid = H5Tcopy(H5T_STD_I16BE)) < 0)
goto out;
- if(H5Tcommit2(loc_id, "/M/M/A", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Tcommit2(loc_id, "/M/M/A", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
goto out;
- if((aid = H5Acreate2(did, "A", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((aid = H5Acreate2(did, "A", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
- if(H5Aclose(aid) < 0)
+ if (H5Aclose(aid) < 0)
goto out;
- if(H5Tclose(tid) < 0)
+ if (H5Tclose(tid) < 0)
goto out;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
/* Create a dataset in the remote group that uses a committed datatype in
* the root group */
- if((tid = H5Tcopy(H5T_STD_I32LE)) < 0)
+ if ((tid = H5Tcopy(H5T_STD_I32LE)) < 0)
goto out;
- if(H5Tcommit2(loc_id, "N", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Tcommit2(loc_id, "N", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
goto out;
- if((did = H5Dcreate2(loc_id, "M/M/B", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(loc_id, "M/M/B", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
- if(H5Tclose(tid) < 0)
+ if (H5Tclose(tid) < 0)
goto out;
/* Create an attribute on the remote dataset that uses an anonymous
* committed datatype */
- if((tid = H5Tcopy(H5T_STD_I32BE)) < 0)
+ if ((tid = H5Tcopy(H5T_STD_I32BE)) < 0)
goto out;
- if(H5Tcommit_anon(loc_id, tid, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Tcommit_anon(loc_id, tid, H5P_DEFAULT, H5P_DEFAULT) < 0)
goto out;
- if((aid = H5Acreate2(did, "A", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((aid = H5Acreate2(did, "A", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
- if(H5Aclose(aid) < 0)
+ if (H5Aclose(aid) < 0)
goto out;
/* Create another attribute that uses the same anonymous datatype */
- if((aid = H5Acreate2(did, "B", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((aid = H5Acreate2(did, "B", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
- if(H5Aclose(aid) < 0)
+ if (H5Aclose(aid) < 0)
goto out;
- if(H5Tclose(tid) < 0)
+ if (H5Tclose(tid) < 0)
goto out;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
/* Create a dataset in the root group that uses the committed datatype in
* the root group */
- if((tid = H5Topen2(loc_id, "N", H5P_DEFAULT)) < 0)
+ if ((tid = H5Topen2(loc_id, "N", H5P_DEFAULT)) < 0)
goto out;
- if((did = H5Dcreate2(loc_id, "O", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(loc_id, "O", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
goto out;
/* Create 2 attributes on the committed datatype that use that datatype */
- if((aid = H5Acreate2(tid, "A", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((aid = H5Acreate2(tid, "A", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
- if(H5Aclose(aid) < 0)
+ if (H5Aclose(aid) < 0)
goto out;
- if((aid = H5Acreate2(tid, "B", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((aid = H5Acreate2(tid, "B", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
- if(H5Aclose(aid) < 0)
+ if (H5Aclose(aid) < 0)
goto out;
- if(H5Tclose(tid) < 0)
+ if (H5Tclose(tid) < 0)
goto out;
/* Close */
@@ -6150,7 +6128,8 @@ out:
H5Sclose(sid);
H5Dclose(did);
H5Gclose(gid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
} /* end make_named_dtype() */
@@ -6167,49 +6146,46 @@ out:
*
* Programmer: Jonathan Kim (March 23, 2010)
*------------------------------------------------------------------------*/
-static herr_t add_attr_with_objref(hid_t file_id, hid_t obj_id)
+static herr_t
+add_attr_with_objref(hid_t file_id, hid_t obj_id)
{
int ret = SUCCEED;
int status;
/* attr obj ref */
- hsize_t dim_attr_objref[1]={3};
+ hsize_t dim_attr_objref[1] = {3};
hobj_ref_t data_attr_objref[3];
/* --------------------------------
* add attribute with obj ref type
*/
/* ref to dset */
- status = H5Rcreate(&data_attr_objref[0],file_id,NAME_OBJ_DS1,H5R_OBJECT,(hid_t)-1);
- if (status < 0)
- {
- HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
+ status = H5Rcreate(&data_attr_objref[0], file_id, NAME_OBJ_DS1, H5R_OBJECT, (hid_t)-1);
+ if (status < 0) {
+ HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", __func__, __LINE__);
ret = FAIL;
goto out;
}
/* ref to group */
- status = H5Rcreate(&data_attr_objref[1],file_id,NAME_OBJ_GRP,H5R_OBJECT,(hid_t)-1);
- if (status < 0)
- {
- HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
+ status = H5Rcreate(&data_attr_objref[1], file_id, NAME_OBJ_GRP, H5R_OBJECT, (hid_t)-1);
+ if (status < 0) {
+ HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", __func__, __LINE__);
ret = FAIL;
goto out;
}
/* ref to datatype */
- status = H5Rcreate(&data_attr_objref[2],file_id,NAME_OBJ_NDTYPE,H5R_OBJECT,(hid_t)-1);
- if (status < 0)
- {
- HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
+ status = H5Rcreate(&data_attr_objref[2], file_id, NAME_OBJ_NDTYPE, H5R_OBJECT, (hid_t)-1);
+ if (status < 0) {
+ HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", __func__, __LINE__);
ret = FAIL;
goto out;
}
/* create attr with obj ref type */
- status = make_attr(obj_id,1,dim_attr_objref,"Attr_OBJREF",H5T_STD_REF_OBJ,data_attr_objref);
- if (status < 0)
- {
- HDfprintf(stderr, "Error: %s %d> make_attr failed.\n", FUNC, __LINE__);
+ status = make_attr(obj_id, 1, dim_attr_objref, "Attr_OBJREF", H5T_STD_REF_OBJ, data_attr_objref);
+ if (status < 0) {
+ HDfprintf(stderr, "Error: %s %d> make_attr failed.\n", __func__, __LINE__);
ret = FAIL;
goto out;
}
@@ -6217,7 +6193,6 @@ static herr_t add_attr_with_objref(hid_t file_id, hid_t obj_id)
out:
return ret;
-
}
/*-------------------------------------------------------------------------
@@ -6232,63 +6207,58 @@ out:
*
* Programmer: Jonathan Kim (March 23, 2010)
*------------------------------------------------------------------------*/
-static herr_t add_attr_with_regref(hid_t file_id, hid_t obj_id)
+static herr_t
+add_attr_with_regref(hid_t file_id, hid_t obj_id)
{
int ret = SUCCEED;
int status;
/* attr region ref */
- hid_t sid_regrefed_dset=0;
- hsize_t dim_regrefed_dset[2]={3,6};
- hsize_t coords_regrefed_dset[3][2] = {{0,1},{1,2},{2,3}};
- hsize_t dim_attr_regref[1]= {1}; /* dim of */
+ hid_t sid_regrefed_dset = 0;
+ hsize_t dim_regrefed_dset[2] = {3, 6};
+ hsize_t coords_regrefed_dset[3][2] = {{0, 1}, {1, 2}, {2, 3}};
+ hsize_t dim_attr_regref[1] = {1}; /* dim of */
hdset_reg_ref_t data_attr_regref[1];
-
/* -----------------------------------
* add attribute with region ref type
*/
- sid_regrefed_dset = H5Screate_simple (2, dim_regrefed_dset, NULL);
- if (sid_regrefed_dset < 0)
- {
- HDfprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__);
+ sid_regrefed_dset = H5Screate_simple(2, dim_regrefed_dset, NULL);
+ if (sid_regrefed_dset < 0) {
+ HDfprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", __func__, __LINE__);
ret = FAIL;
goto out;
}
/* select elements space for reference */
- status = H5Sselect_elements (sid_regrefed_dset, H5S_SELECT_SET, (size_t)3, coords_regrefed_dset[0]);
- if (status < 0)
- {
- HDfprintf(stderr, "Error: %s %d> H5Sselect_elements failed.\n", FUNC, __LINE__);
+ status = H5Sselect_elements(sid_regrefed_dset, H5S_SELECT_SET, (size_t)3, coords_regrefed_dset[0]);
+ if (status < 0) {
+ HDfprintf(stderr, "Error: %s %d> H5Sselect_elements failed.\n", __func__, __LINE__);
ret = FAIL;
goto out;
}
/* create region reference from elements space */
- status = H5Rcreate (&data_attr_regref[0], file_id, NAME_OBJ_DS2, H5R_DATASET_REGION, sid_regrefed_dset);
- if (status < 0)
- {
- HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
+ status = H5Rcreate(&data_attr_regref[0], file_id, NAME_OBJ_DS2, H5R_DATASET_REGION, sid_regrefed_dset);
+ if (status < 0) {
+ HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", __func__, __LINE__);
ret = FAIL;
goto out;
}
/* create attr with region ref type */
- status = make_attr(obj_id,1,dim_attr_regref,"Attr_REGREF",H5T_STD_REF_DSETREG,data_attr_regref);
- if (status < 0)
- {
- HDfprintf(stderr, "Error: %s %d> make_attr failed.\n", FUNC, __LINE__);
+ status = make_attr(obj_id, 1, dim_attr_regref, "Attr_REGREF", H5T_STD_REF_DSETREG, data_attr_regref);
+ if (status < 0) {
+ HDfprintf(stderr, "Error: %s %d> make_attr failed.\n", __func__, __LINE__);
ret = FAIL;
goto out;
}
out:
if (sid_regrefed_dset > 0)
- H5Sclose (sid_regrefed_dset);
+ H5Sclose(sid_regrefed_dset);
return ret;
-
}
/*-------------------------------------------------------------------------
@@ -6302,45 +6272,43 @@ out:
*
* Programmer: Jonathan Kim (March 23, 2010)
*------------------------------------------------------------------------*/
-static herr_t gen_refered_objs(hid_t loc_id)
+static herr_t
+gen_refered_objs(hid_t loc_id)
{
- int status;
+ int status;
herr_t ret = SUCCEED;
/* objects (dset, group, datatype) */
- hid_t sid=0, did1=0, gid=0, tid=0;
- hsize_t dims1[1]={3};
- int data[3] = {10,20,30};
+ hid_t sid = 0, did1 = 0, gid = 0, tid = 0;
+ hsize_t dims1[1] = {3};
+ int data[3] = {10, 20, 30};
/* Dset2 */
- hid_t sid2=0, did2=0;
- hsize_t dims2[2] = {3,16};
- char data2[3][16] = {"The quick brown", "fox jumps over ", "the 5 lazy dogs"};
+ hid_t sid2 = 0, did2 = 0;
+ hsize_t dims2[2] = {3, 16};
+ char data2[3][16] = {"The quick brown", "fox jumps over ", "the 5 lazy dogs"};
/*-----------------------
* add short dataset
* (define NAME_OBJ_DS1)
*/
sid = H5Screate_simple(1, dims1, NULL);
- if (sid < 0)
- {
- HDfprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__);
+ if (sid < 0) {
+ HDfprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", __func__, __LINE__);
ret = FAIL;
goto out;
}
- did1 = H5Dcreate2 (loc_id, NAME_OBJ_DS1, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if (did1 < 0)
- {
- HDfprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", FUNC, __LINE__);
+ did1 = H5Dcreate2(loc_id, NAME_OBJ_DS1, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (did1 < 0) {
+ HDfprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", __func__, __LINE__);
ret = FAIL;
goto out;
}
status = H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data);
- if (status < 0)
- {
- HDfprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__);
+ if (status < 0) {
+ HDfprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", __func__, __LINE__);
ret = FAIL;
goto out;
}
@@ -6349,10 +6317,9 @@ static herr_t gen_refered_objs(hid_t loc_id)
* add group
* (define NAME_OBJ_GRP)
*/
- gid = H5Gcreate2 (loc_id, NAME_OBJ_GRP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if (gid < 0)
- {
- HDfprintf(stderr, "Error: %s %d> H5Gcreate2 failed.\n", FUNC, __LINE__);
+ gid = H5Gcreate2(loc_id, NAME_OBJ_GRP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (gid < 0) {
+ HDfprintf(stderr, "Error: %s %d> H5Gcreate2 failed.\n", __func__, __LINE__);
ret = FAIL;
goto out;
}
@@ -6361,62 +6328,56 @@ static herr_t gen_refered_objs(hid_t loc_id)
* add named datatype
* (define NAME_OBJ_NDTYPE)
*/
- tid = H5Tcopy(H5T_NATIVE_INT);
- status = H5Tcommit2(loc_id, NAME_OBJ_NDTYPE, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if (status < 0)
- {
- HDfprintf(stderr, "Error: %s %d> H5Tcommit2 failed.\n", FUNC, __LINE__);
+ tid = H5Tcopy(H5T_NATIVE_INT);
+ status = H5Tcommit2(loc_id, NAME_OBJ_NDTYPE, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0) {
+ HDfprintf(stderr, "Error: %s %d> H5Tcommit2 failed.\n", __func__, __LINE__);
ret = FAIL;
goto out;
- }
-
+ }
- /*--------------------------
- * create long dataset
- * (define NAME_OBJ_DS2)
- */
- sid2 = H5Screate_simple (2, dims2, NULL);
- if (sid2 < 0)
- {
- HDfprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__);
+ /*--------------------------
+ * create long dataset
+ * (define NAME_OBJ_DS2)
+ */
+ sid2 = H5Screate_simple(2, dims2, NULL);
+ if (sid2 < 0) {
+ HDfprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", __func__, __LINE__);
ret = FAIL;
goto out;
}
- /* create normal dataset which is refered */
- did2 = H5Dcreate2 (loc_id, NAME_OBJ_DS2, H5T_STD_I8LE, sid2, H5P_DEFAULT,H5P_DEFAULT,H5P_DEFAULT);
- if (did2 < 0)
- {
- HDfprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", FUNC, __LINE__);
+ /* create normal dataset which is referred */
+ did2 = H5Dcreate2(loc_id, NAME_OBJ_DS2, H5T_STD_I8LE, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (did2 < 0) {
+ HDfprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", __func__, __LINE__);
ret = FAIL;
goto out;
}
/* write values to dataset */
- status = H5Dwrite (did2, H5T_NATIVE_CHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, data2);
- if (status < 0)
- {
- HDfprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__);
+ status = H5Dwrite(did2, H5T_NATIVE_CHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, data2);
+ if (status < 0) {
+ HDfprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", __func__, __LINE__);
ret = FAIL;
goto out;
}
out:
- if(did1 > 0)
+ if (did1 > 0)
H5Dclose(did1);
- if(gid > 0)
+ if (gid > 0)
H5Gclose(gid);
- if(tid > 0)
+ if (tid > 0)
H5Tclose(tid);
- if(sid > 0)
+ if (sid > 0)
H5Sclose(sid);
- if(did2 > 0)
+ if (did2 > 0)
H5Dclose(did2);
- if(sid2 > 0)
+ if (sid2 > 0)
H5Sclose(sid2);
return ret;
-
}
/*-------------------------------------------------------------------------
@@ -6426,21 +6387,22 @@ out:
* Generate object references to objects (dataset,group and named datatype)
*
* Note:
- * copied from h5copygentest.c and upate to create named datatype
+ * copied from h5copygentest.c and update to create named datatype
*
* Programmer: Jonathan Kim (March 18, 2010)
*------------------------------------------------------------------------*/
-static herr_t gen_obj_ref(hid_t loc_id)
+static herr_t
+gen_obj_ref(hid_t loc_id)
{
- int status;
+ int status;
herr_t ret = SUCCEED;
- hid_t sid=0, oid=0;
- hsize_t dims_dset_objref[1]={3};
+ hid_t sid = 0, oid = 0;
+ hsize_t dims_dset_objref[1] = {3};
/* attr with int type */
- hsize_t dim_attr_int[1]={2};
- int data_attr_int[2] = {10,20};
+ hsize_t dim_attr_int[1] = {2};
+ int data_attr_int[2] = {10, 20};
/* write buffer for obj reference */
hobj_ref_t objref_buf[3];
@@ -6450,28 +6412,25 @@ static herr_t gen_obj_ref(hid_t loc_id)
* Passing -1 as reference is an object.*/
/* obj ref to dataset */
- status = H5Rcreate (&objref_buf[0], loc_id, NAME_OBJ_DS1, H5R_OBJECT, (hid_t)-1);
- if (status < 0)
- {
- HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
+ status = H5Rcreate(&objref_buf[0], loc_id, NAME_OBJ_DS1, H5R_OBJECT, (hid_t)-1);
+ if (status < 0) {
+ HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", __func__, __LINE__);
ret = FAIL;
goto out;
}
/* obj ref to group */
- status = H5Rcreate (&objref_buf[1], loc_id, NAME_OBJ_GRP, H5R_OBJECT, (hid_t)-1);
- if (status < 0)
- {
- HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
+ status = H5Rcreate(&objref_buf[1], loc_id, NAME_OBJ_GRP, H5R_OBJECT, (hid_t)-1);
+ if (status < 0) {
+ HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", __func__, __LINE__);
ret = FAIL;
goto out;
}
/* obj ref to named-datatype */
- status = H5Rcreate (&objref_buf[2], loc_id, NAME_OBJ_NDTYPE, H5R_OBJECT, (hid_t)-1);
- if (status < 0)
- {
- HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
+ status = H5Rcreate(&objref_buf[2], loc_id, NAME_OBJ_NDTYPE, H5R_OBJECT, (hid_t)-1);
+ if (status < 0) {
+ HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", __func__, __LINE__);
ret = FAIL;
goto out;
}
@@ -6479,62 +6438,56 @@ static herr_t gen_obj_ref(hid_t loc_id)
/*---------------------------------------------------------
* create dataset contain references
*/
- sid = H5Screate_simple (1, dims_dset_objref, NULL);
- if (sid < 0)
- {
- HDfprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__);
+ sid = H5Screate_simple(1, dims_dset_objref, NULL);
+ if (sid < 0) {
+ HDfprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", __func__, __LINE__);
ret = FAIL;
goto out;
}
- oid = H5Dcreate2 (loc_id, "Dset_OBJREF", H5T_STD_REF_OBJ, sid, H5P_DEFAULT,H5P_DEFAULT,H5P_DEFAULT);
- if (oid < 0)
- {
- HDfprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", FUNC, __LINE__);
+ oid = H5Dcreate2(loc_id, "Dset_OBJREF", H5T_STD_REF_OBJ, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (oid < 0) {
+ HDfprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", __func__, __LINE__);
ret = FAIL;
goto out;
}
status = H5Dwrite(oid, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, objref_buf);
- if (status < 0)
- {
- HDfprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__);
+ if (status < 0) {
+ HDfprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", __func__, __LINE__);
ret = FAIL;
goto out;
}
/* add attribute with int type */
- if (make_attr(oid,1,dim_attr_int,"integer",H5T_NATIVE_INT,data_attr_int) < 0)
+ if (make_attr(oid, 1, dim_attr_int, "integer", H5T_NATIVE_INT, data_attr_int) < 0)
goto out;
/* add attribute with obj ref */
status = add_attr_with_objref(loc_id, oid);
- if (status < 0)
- {
- HDfprintf(stderr, "Error: %s %d> add_attr_with_objref failed.\n", FUNC, __LINE__);
+ if (status < 0) {
+ HDfprintf(stderr, "Error: %s %d> add_attr_with_objref failed.\n", __func__, __LINE__);
ret = FAIL;
goto out;
}
/* add attribute with region ref */
status = add_attr_with_regref(loc_id, oid);
- if (status < 0)
- {
- HDfprintf(stderr, "Error: %s %d> add_attr_with_regref failed.\n", FUNC, __LINE__);
+ if (status < 0) {
+ HDfprintf(stderr, "Error: %s %d> add_attr_with_regref failed.\n", __func__, __LINE__);
ret = FAIL;
goto out;
}
out:
- if(oid > 0)
+ if (oid > 0)
H5Dclose(oid);
- if(sid > 0)
+ if (sid > 0)
H5Sclose(sid);
return ret;
}
-
/*-------------------------------------------------------------------------
* Function: gen_region_ref
*
@@ -6545,168 +6498,158 @@ out:
*
* Programmer: Jonathan Kim (March 18, 2010)
*------------------------------------------------------------------------*/
-static herr_t gen_region_ref(hid_t loc_id)
+static herr_t
+gen_region_ref(hid_t loc_id)
{
- int status;
+ int status;
herr_t ret = SUCCEED;
/* target dataset */
- hid_t sid_trg=0;
- hsize_t dims_trg[2] = {3,16};
+ hid_t sid_trg = 0;
+ hsize_t dims_trg[2] = {3, 16};
/* dset with region ref type */
- hid_t sid_ref=0, oid_ref=0;
+ hid_t sid_ref = 0, oid_ref = 0;
/* region ref to target dataset */
- hsize_t coords[4][2] = { {0,1}, {2,11}, {1,0}, {2,4} };
- hdset_reg_ref_t rr_data[2];
- hsize_t start[2] = {0,0};
- hsize_t stride[2] = {2,11};
- hsize_t count[2] = {2,2};
- hsize_t block[2] = {1,3};
- hsize_t dims1[1] = {2};
+ hsize_t coords[4][2] = {{0, 1}, {2, 11}, {1, 0}, {2, 4}};
+ hdset_reg_ref_t rr_data[2];
+ hsize_t start[2] = {0, 0};
+ hsize_t stride[2] = {2, 11};
+ hsize_t count[2] = {2, 2};
+ hsize_t block[2] = {1, 3};
+ hsize_t dims1[1] = {2};
/* attr with int type */
- hsize_t dim_attr_int[1]={2};
- int data_attr_int[2] = {10,20};
+ hsize_t dim_attr_int[1] = {2};
+ int data_attr_int[2] = {10, 20};
- sid_trg = H5Screate_simple (2, dims_trg, NULL);
- if (sid_trg < 0)
- {
- HDfprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__);
+ sid_trg = H5Screate_simple(2, dims_trg, NULL);
+ if (sid_trg < 0) {
+ HDfprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", __func__, __LINE__);
ret = FAIL;
goto out;
}
/* select elements space for reference */
- status = H5Sselect_elements (sid_trg, H5S_SELECT_SET, (size_t)4, coords[0]);
- if (status < 0)
- {
- HDfprintf(stderr, "Error: %s %d> H5Sselect_elements failed.\n", FUNC, __LINE__);
+ status = H5Sselect_elements(sid_trg, H5S_SELECT_SET, (size_t)4, coords[0]);
+ if (status < 0) {
+ HDfprintf(stderr, "Error: %s %d> H5Sselect_elements failed.\n", __func__, __LINE__);
ret = FAIL;
goto out;
}
/* create region reference from elements space */
- status = H5Rcreate (&rr_data[0], loc_id, NAME_OBJ_DS2, H5R_DATASET_REGION, sid_trg);
- if (status < 0)
- {
- HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
+ status = H5Rcreate(&rr_data[0], loc_id, NAME_OBJ_DS2, H5R_DATASET_REGION, sid_trg);
+ if (status < 0) {
+ HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", __func__, __LINE__);
ret = FAIL;
goto out;
}
/* select hyperslab space for reference */
- status = H5Sselect_hyperslab (sid_trg, H5S_SELECT_SET, start, stride, count, block);
- if (status < 0)
- {
- HDfprintf(stderr, "Error: %s %d> H5Sselect_hyperslab failed.\n", FUNC, __LINE__);
+ status = H5Sselect_hyperslab(sid_trg, H5S_SELECT_SET, start, stride, count, block);
+ if (status < 0) {
+ HDfprintf(stderr, "Error: %s %d> H5Sselect_hyperslab failed.\n", __func__, __LINE__);
ret = FAIL;
goto out;
}
/* create region reference from hyperslab space */
- status = H5Rcreate (&rr_data[1], loc_id, NAME_OBJ_DS2, H5R_DATASET_REGION, sid_trg);
- if (status < 0)
- {
- HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
+ status = H5Rcreate(&rr_data[1], loc_id, NAME_OBJ_DS2, H5R_DATASET_REGION, sid_trg);
+ if (status < 0) {
+ HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", __func__, __LINE__);
ret = FAIL;
goto out;
}
/* Create dataspace. */
- sid_ref = H5Screate_simple (1, dims1, NULL);
- if (sid_ref < 0)
- {
- HDfprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__);
+ sid_ref = H5Screate_simple(1, dims1, NULL);
+ if (sid_ref < 0) {
+ HDfprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", __func__, __LINE__);
ret = FAIL;
goto out;
}
/* create region reference dataset */
- oid_ref = H5Dcreate2 (loc_id, REG_REF_DS1, H5T_STD_REF_DSETREG, sid_ref, H5P_DEFAULT,H5P_DEFAULT,H5P_DEFAULT);
- if (oid_ref < 0)
- {
- HDfprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", FUNC, __LINE__);
+ oid_ref =
+ H5Dcreate2(loc_id, REG_REF_DS1, H5T_STD_REF_DSETREG, sid_ref, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (oid_ref < 0) {
+ HDfprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", __func__, __LINE__);
ret = FAIL;
goto out;
}
/* write data as region references */
- status = H5Dwrite (oid_ref, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, rr_data);
- if (status < 0)
- {
- HDfprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__);
+ status = H5Dwrite(oid_ref, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, rr_data);
+ if (status < 0) {
+ HDfprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", __func__, __LINE__);
ret = FAIL;
goto out;
}
/* add attribute with int type */
- if (make_attr(oid_ref,1,dim_attr_int,"integer",H5T_NATIVE_INT,data_attr_int) < 0)
+ if (make_attr(oid_ref, 1, dim_attr_int, "integer", H5T_NATIVE_INT, data_attr_int) < 0)
goto out;
/* add attribute with obj ref */
status = add_attr_with_objref(loc_id, oid_ref);
- if (status < 0)
- {
- HDfprintf(stderr, "Error: %s %d> add_attr_with_objref failed.\n", FUNC, __LINE__);
+ if (status < 0) {
+ HDfprintf(stderr, "Error: %s %d> add_attr_with_objref failed.\n", __func__, __LINE__);
ret = FAIL;
goto out;
}
/* add attribute with region ref */
status = add_attr_with_regref(loc_id, oid_ref);
- if (status < 0)
- {
- HDfprintf(stderr, "Error: %s %d> add_attr_with_regref failed.\n", FUNC, __LINE__);
+ if (status < 0) {
+ HDfprintf(stderr, "Error: %s %d> add_attr_with_regref failed.\n", __func__, __LINE__);
ret = FAIL;
goto out;
}
out:
if (oid_ref > 0)
- H5Dclose (oid_ref);
+ H5Dclose(oid_ref);
if (sid_ref > 0)
- H5Sclose (sid_ref);
+ H5Sclose(sid_ref);
if (sid_trg > 0)
- H5Sclose (sid_trg);
+ H5Sclose(sid_trg);
return ret;
}
/*-------------------------------------------------------------------------
-* Function: make_references
-*
-* Purpose: create a file with obj and region references
-*
-* Programmer: Jonathan Kim (March 18, 2010)
-*-------------------------------------------------------------------------
-*/
-static herr_t make_references(hid_t loc_id)
+ * Function: make_references
+ *
+ * Purpose: create a file with obj and region references
+ *
+ * Programmer: Jonathan Kim (March 18, 2010)
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+make_references(hid_t loc_id)
{
herr_t ret = SUCCEED;
herr_t status;
/* add target objects */
status = gen_refered_objs(loc_id);
- if (status == FAIL)
- {
+ if (status == FAIL) {
HDfprintf(stderr, "Failed to generate referenced object.\n");
ret = FAIL;
}
/* add object reference */
status = gen_obj_ref(loc_id);
- if (status == FAIL)
- {
+ if (status == FAIL) {
HDfprintf(stderr, "Failed to generate object reference.\n");
ret = FAIL;
}
/* add region reference */
status = gen_region_ref(loc_id);
- if (status == FAIL)
- {
+ if (status == FAIL) {
HDfprintf(stderr, "Failed to generate region reference.\n");
ret = FAIL;
}
@@ -6715,110 +6658,107 @@ static herr_t make_references(hid_t loc_id)
}
/*-------------------------------------------------------------------------
-* Function: make_complex_attr_references
-*
-* Purpose:
-* create a file with :
-* 1. obj ref in attribute of compound type
-* 2. region ref in attribute of compound type
-* 3. obj ref in attribute of vlen type
-* 4. region ref in attribute of vlen type
-*
-* Programmer: Jonathan (March 25, 2010)
-*-------------------------------------------------------------------------
-*/
+ * Function: make_complex_attr_references
+ *
+ * Purpose:
+ * create a file with :
+ * 1. obj ref in attribute of compound type
+ * 2. region ref in attribute of compound type
+ * 3. obj ref in attribute of vlen type
+ * 4. region ref in attribute of vlen type
+ *
+ * Programmer: Jonathan (March 25, 2010)
+ *-------------------------------------------------------------------------
+ */
/* obj dset */
#define RANK_OBJ 2
#define DIM0_OBJ 6
#define DIM1_OBJ 10
/* container dset */
#define RANK_DSET 1
-#define DIM_DSET 4
+#define DIM_DSET 4
/* 1. obj references in compound attr */
#define RANK_COMP_OBJREF 1
-#define DIM_COMP_OBJREF 3 /* for dataset, group, datatype */
+#define DIM_COMP_OBJREF 3 /* for dataset, group, datatype */
/* 2. region references in compound attr */
#define RANK_COMP_REGREF 1
-#define DIM_COMP_REGREF 1 /* for element region */
+#define DIM_COMP_REGREF 1 /* for element region */
/* 3. obj references in vlen attr */
#define RANK_VLEN_OBJREF 1
-#define DIM_VLEN_OBJREF 3 /* for dataset, group, datatype */
-#define LEN0_VLEN_OBJREF 1 /* dataset */
-#define LEN1_VLEN_OBJREF 1 /* group */
-#define LEN2_VLEN_OBJREF 1 /* datatype */
+#define DIM_VLEN_OBJREF 3 /* for dataset, group, datatype */
+#define LEN0_VLEN_OBJREF 1 /* dataset */
+#define LEN1_VLEN_OBJREF 1 /* group */
+#define LEN2_VLEN_OBJREF 1 /* datatype */
/* 4. region references in vlen attr */
#define RANK_VLEN_REGREF 1
-#define DIM_VLEN_REGREF 1 /* for element region */
-#define LEN0_VLEN_REGREF 1 /* element region */
+#define DIM_VLEN_REGREF 1 /* for element region */
+#define LEN0_VLEN_REGREF 1 /* element region */
-static herr_t make_complex_attr_references(hid_t loc_id)
+static herr_t
+make_complex_attr_references(hid_t loc_id)
{
herr_t ret = SUCCEED;
herr_t status;
/*
* for objects
*/
- hid_t objgid=0, objdid=0, objtid=0, objsid=0;
- hsize_t obj_dims[RANK_OBJ] = {DIM0_OBJ, DIM1_OBJ};
- int obj_data[DIM0_OBJ][DIM1_OBJ]=
- {{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
- {10,11,12,13,14,15,16,17,18,19},
- {20,21,22,23,24,25,26,27,28,29},
- {30,31,32,33,34,35,36,37,38,39},
- {40,41,42,43,44,45,46,47,48,49},
- {50,51,52,53,54,55,56,57,58,59}};
+ hid_t objgid = 0, objdid = 0, objtid = 0, objsid = 0;
+ hsize_t obj_dims[RANK_OBJ] = {DIM0_OBJ, DIM1_OBJ};
+ int obj_data[DIM0_OBJ][DIM1_OBJ] = {
+ {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, {10, 11, 12, 13, 14, 15, 16, 17, 18, 19},
+ {20, 21, 22, 23, 24, 25, 26, 27, 28, 29}, {30, 31, 32, 33, 34, 35, 36, 37, 38, 39},
+ {40, 41, 42, 43, 44, 45, 46, 47, 48, 49}, {50, 51, 52, 53, 54, 55, 56, 57, 58, 59}};
/*
* group main
*/
- hid_t main_gid=0;
+ hid_t main_gid = 0;
/*
* dataset which the attribute will be attached to
*/
hsize_t main_dset_dims[RANK_DSET] = {DIM_DSET};
- hid_t main_sid=0, main_did=0;
+ hid_t main_sid = 0, main_did = 0;
/*
* 1. obj references in compound attr
*/
- hid_t comp_objref_tid=0, comp_objref_aid=0;
+ hid_t comp_objref_tid = 0, comp_objref_aid = 0;
typedef struct comp_objref_t {
hobj_ref_t val_objref;
- int val_int;
+ int val_int;
} comp_objref_t;
comp_objref_t comp_objref_data[DIM_COMP_OBJREF];
- hid_t comp_objref_attr_sid=0;
- hsize_t comp_objref_dim[RANK_COMP_OBJREF] = {DIM_COMP_OBJREF};
+ hid_t comp_objref_attr_sid = 0;
+ hsize_t comp_objref_dim[RANK_COMP_OBJREF] = {DIM_COMP_OBJREF};
/*
* 2. region references in compound attr
*/
- hid_t comp_regref_tid=0, comp_regref_aid=0;
+ hid_t comp_regref_tid = 0, comp_regref_aid = 0;
typedef struct comp_regref_t {
hdset_reg_ref_t val_regref;
- int val_int;
+ int val_int;
} comp_regref_t;
comp_regref_t comp_regref_data[DIM_COMP_REGREF];
- hid_t comp_regref_attr_sid=0;
- hsize_t comp_regref_dim[RANK_COMP_REGREF] = {DIM_COMP_REGREF};
- hsize_t coords[4][2] = { {0,1}, {2,3}, {3,4}, {4,5} };
+ hid_t comp_regref_attr_sid = 0;
+ hsize_t comp_regref_dim[RANK_COMP_REGREF] = {DIM_COMP_REGREF};
+ hsize_t coords[4][2] = {{0, 1}, {2, 3}, {3, 4}, {4, 5}};
/*
* 3. obj references in vlen attr
*/
- hid_t vlen_objref_attr_tid=0, vlen_objref_attr_sid=0;
- hid_t vlen_objref_attr_id=0;
- hvl_t vlen_objref_data[DIM_VLEN_OBJREF];
+ hid_t vlen_objref_attr_tid = 0, vlen_objref_attr_sid = 0;
+ hid_t vlen_objref_attr_id = 0;
+ hvl_t vlen_objref_data[DIM_VLEN_OBJREF];
hsize_t vlen_objref_dims[RANK_VLEN_OBJREF] = {DIM_VLEN_OBJREF};
/*
* 4. region references in vlen attr
*/
- hid_t vlen_regref_attr_tid=0, vlen_regref_attr_sid=0;
- hid_t vlen_regref_attr_id=0;
- hvl_t vlen_regref_data[DIM_VLEN_REGREF];
+ hid_t vlen_regref_attr_tid = 0, vlen_regref_attr_sid = 0;
+ hid_t vlen_regref_attr_id = 0;
+ hvl_t vlen_regref_data[DIM_VLEN_REGREF];
hsize_t vlen_regref_dim[RANK_VLEN_REGREF] = {DIM_VLEN_REGREF};
-
/* ---------------------------------------
* create objects which to be referenced
*/
@@ -6829,9 +6769,8 @@ static herr_t make_complex_attr_references(hid_t loc_id)
objsid = H5Screate_simple(RANK_OBJ, obj_dims, NULL);
objdid = H5Dcreate2(loc_id, NAME_OBJ_DS1, H5T_NATIVE_INT, objsid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
status = H5Dwrite(objdid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, obj_data[0]);
- if (status < 0)
- {
- HDfprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__);
+ if (status < 0) {
+ HDfprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", __func__, __LINE__);
ret = FAIL;
goto out;
}
@@ -6839,22 +6778,19 @@ static herr_t make_complex_attr_references(hid_t loc_id)
/* object3 named datatype */
objtid = H5Tcopy(H5T_NATIVE_INT);
status = H5Tcommit2(loc_id, NAME_OBJ_NDTYPE, objtid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if (status < 0)
- {
- HDfprintf(stderr, "Error: %s %d> H5Tcommit2 failed.\n", FUNC, __LINE__);
+ if (status < 0) {
+ HDfprintf(stderr, "Error: %s %d> H5Tcommit2 failed.\n", __func__, __LINE__);
ret = FAIL;
goto out;
}
-
/* ---------------------------------------------
* Put testing objs in this group
* create group contain dataset with attribute and the attribute has
* compound type which contain obj and region reference */
main_gid = H5Gcreate2(loc_id, "group_main", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if (main_gid < 0)
- {
- HDfprintf(stderr, "Error: %s %d> H5Gcreate2 failed.\n", FUNC, __LINE__);
+ if (main_gid < 0) {
+ HDfprintf(stderr, "Error: %s %d> H5Gcreate2 failed.\n", __func__, __LINE__);
ret = FAIL;
goto out;
}
@@ -6864,12 +6800,12 @@ static herr_t make_complex_attr_references(hid_t loc_id)
*/
main_sid = H5Screate_simple(RANK_DSET, main_dset_dims, NULL);
- main_did = H5Dcreate2(main_gid, "dset_main", H5T_NATIVE_INT, main_sid, H5P_DEFAULT,H5P_DEFAULT, H5P_DEFAULT);
+ main_did =
+ H5Dcreate2(main_gid, "dset_main", H5T_NATIVE_INT, main_sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
status = H5Dwrite(main_did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, obj_data[0]);
- if (status < 0)
- {
- HDfprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__);
+ if (status < 0) {
+ HDfprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", __func__, __LINE__);
ret = FAIL;
goto out;
}
@@ -6881,7 +6817,7 @@ static herr_t make_complex_attr_references(hid_t loc_id)
/*
* create compound type for attribute
*/
- comp_objref_tid = H5Tcreate (H5T_COMPOUND, sizeof(comp_objref_t));
+ comp_objref_tid = H5Tcreate(H5T_COMPOUND, sizeof(comp_objref_t));
H5Tinsert(comp_objref_tid, "value_objref", HOFFSET(comp_objref_t, val_objref), H5T_STD_REF_OBJ);
H5Tinsert(comp_objref_tid, "value_int", HOFFSET(comp_objref_t, val_int), H5T_NATIVE_INT);
@@ -6889,31 +6825,28 @@ static herr_t make_complex_attr_references(hid_t loc_id)
/*
* Create the object references into compound type
*/
- /* references to dataset */
- status = H5Rcreate (&(comp_objref_data[0].val_objref), loc_id, NAME_OBJ_DS1, H5R_OBJECT,(hid_t)-1);
- if (status < 0)
- {
- HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
+ /* references to dataset */
+ status = H5Rcreate(&(comp_objref_data[0].val_objref), loc_id, NAME_OBJ_DS1, H5R_OBJECT, (hid_t)-1);
+ if (status < 0) {
+ HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", __func__, __LINE__);
ret = FAIL;
goto out;
}
comp_objref_data[0].val_int = 0;
- /* references to group */
- status = H5Rcreate (&(comp_objref_data[1].val_objref), loc_id, NAME_OBJ_GRP, H5R_OBJECT,(hid_t)-1);
- if (status < 0)
- {
- HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
+ /* references to group */
+ status = H5Rcreate(&(comp_objref_data[1].val_objref), loc_id, NAME_OBJ_GRP, H5R_OBJECT, (hid_t)-1);
+ if (status < 0) {
+ HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", __func__, __LINE__);
ret = FAIL;
goto out;
}
comp_objref_data[1].val_int = 10;
- /* references to datatype */
- status = H5Rcreate (&(comp_objref_data[2].val_objref), loc_id, NAME_OBJ_NDTYPE, H5R_OBJECT,(hid_t)-1);
- if (status < 0)
- {
- HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
+ /* references to datatype */
+ status = H5Rcreate(&(comp_objref_data[2].val_objref), loc_id, NAME_OBJ_NDTYPE, H5R_OBJECT, (hid_t)-1);
+ if (status < 0) {
+ HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", __func__, __LINE__);
ret = FAIL;
goto out;
}
@@ -6922,12 +6855,12 @@ static herr_t make_complex_attr_references(hid_t loc_id)
/*
* create attribute and write the object ref
*/
- comp_objref_attr_sid = H5Screate_simple (RANK_COMP_OBJREF, comp_objref_dim, NULL);
- comp_objref_aid = H5Acreate2 (main_did, "Comp_OBJREF", comp_objref_tid, comp_objref_attr_sid, H5P_DEFAULT, H5P_DEFAULT);
- status = H5Awrite (comp_objref_aid, comp_objref_tid, comp_objref_data);
- if (status < 0)
- {
- HDfprintf(stderr, "Error: %s %d> H5Awrite failed.\n", FUNC, __LINE__);
+ comp_objref_attr_sid = H5Screate_simple(RANK_COMP_OBJREF, comp_objref_dim, NULL);
+ comp_objref_aid =
+ H5Acreate2(main_did, "Comp_OBJREF", comp_objref_tid, comp_objref_attr_sid, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Awrite(comp_objref_aid, comp_objref_tid, comp_objref_data);
+ if (status < 0) {
+ HDfprintf(stderr, "Error: %s %d> H5Awrite failed.\n", __func__, __LINE__);
ret = FAIL;
goto out;
}
@@ -6938,7 +6871,7 @@ static herr_t make_complex_attr_references(hid_t loc_id)
/*
* create compound type for attribute
*/
- comp_regref_tid = H5Tcreate (H5T_COMPOUND, sizeof(comp_regref_t));
+ comp_regref_tid = H5Tcreate(H5T_COMPOUND, sizeof(comp_regref_t));
H5Tinsert(comp_regref_tid, "value_regref", HOFFSET(comp_regref_t, val_regref), H5T_STD_REF_DSETREG);
H5Tinsert(comp_regref_tid, "value_int", HOFFSET(comp_regref_t, val_int), H5T_NATIVE_INT);
@@ -6946,17 +6879,15 @@ static herr_t make_complex_attr_references(hid_t loc_id)
/*
* create the region reference
*/
- status = H5Sselect_elements (objsid, H5S_SELECT_SET, (size_t)4, coords[0]);
- if (status < 0)
- {
- HDfprintf(stderr, "Error: %s %d> H5Sselect_elements failed.\n", FUNC, __LINE__);
+ status = H5Sselect_elements(objsid, H5S_SELECT_SET, (size_t)4, coords[0]);
+ if (status < 0) {
+ HDfprintf(stderr, "Error: %s %d> H5Sselect_elements failed.\n", __func__, __LINE__);
ret = FAIL;
goto out;
}
- status = H5Rcreate (&(comp_regref_data[0].val_regref), loc_id, NAME_OBJ_DS1, H5R_DATASET_REGION, objsid);
- if (status < 0)
- {
- HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
+ status = H5Rcreate(&(comp_regref_data[0].val_regref), loc_id, NAME_OBJ_DS1, H5R_DATASET_REGION, objsid);
+ if (status < 0) {
+ HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", __func__, __LINE__);
ret = FAIL;
goto out;
}
@@ -6965,81 +6896,79 @@ static herr_t make_complex_attr_references(hid_t loc_id)
/*
* create attribute and write the region ref
*/
- comp_regref_attr_sid = H5Screate_simple (RANK_COMP_REGREF, comp_regref_dim, NULL);
- comp_regref_aid = H5Acreate2 (main_did, "Comp_REGREF", comp_regref_tid, comp_regref_attr_sid, H5P_DEFAULT, H5P_DEFAULT);
- status = H5Awrite (comp_regref_aid, comp_regref_tid, comp_regref_data);
- if (status < 0)
- {
- HDfprintf(stderr, "Error: %s %d> H5Awrite failed.\n", FUNC, __LINE__);
+ comp_regref_attr_sid = H5Screate_simple(RANK_COMP_REGREF, comp_regref_dim, NULL);
+ comp_regref_aid =
+ H5Acreate2(main_did, "Comp_REGREF", comp_regref_tid, comp_regref_attr_sid, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Awrite(comp_regref_aid, comp_regref_tid, comp_regref_data);
+ if (status < 0) {
+ HDfprintf(stderr, "Error: %s %d> H5Awrite failed.\n", __func__, __LINE__);
ret = FAIL;
goto out;
}
-
/*-------------------------------------------------------------------
* 3. create obj references in attribute of vlen type
*/
/*
* prepare vlen data
*/
- vlen_objref_data[0].len = LEN0_VLEN_OBJREF;
- vlen_objref_data[0].p = HDmalloc (vlen_objref_data[0].len * sizeof(hobj_ref_t));
- vlen_objref_data[1].len = LEN1_VLEN_OBJREF;
- vlen_objref_data[1].p = HDmalloc (vlen_objref_data[1].len * sizeof(hobj_ref_t));
- vlen_objref_data[2].len = LEN2_VLEN_OBJREF;
- vlen_objref_data[2].p = HDmalloc (vlen_objref_data[2].len * sizeof(hobj_ref_t));
-
- /*
- * create obj references
- */
- /* reference to dataset */
- status = H5Rcreate (&((hobj_ref_t*)vlen_objref_data[0].p)[0], loc_id, NAME_OBJ_DS1, H5R_OBJECT, (hid_t)-1);
- if (status < 0)
- {
- HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
+ vlen_objref_data[0].len = LEN0_VLEN_OBJREF;
+ vlen_objref_data[0].p = HDmalloc(vlen_objref_data[0].len * sizeof(hobj_ref_t));
+ vlen_objref_data[1].len = LEN1_VLEN_OBJREF;
+ vlen_objref_data[1].p = HDmalloc(vlen_objref_data[1].len * sizeof(hobj_ref_t));
+ vlen_objref_data[2].len = LEN2_VLEN_OBJREF;
+ vlen_objref_data[2].p = HDmalloc(vlen_objref_data[2].len * sizeof(hobj_ref_t));
+
+ /*
+ * create obj references
+ */
+ /* reference to dataset */
+ status =
+ H5Rcreate(&((hobj_ref_t *)vlen_objref_data[0].p)[0], loc_id, NAME_OBJ_DS1, H5R_OBJECT, (hid_t)-1);
+ if (status < 0) {
+ HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", __func__, __LINE__);
ret = FAIL;
goto out;
}
- /* reference to group */
- status = H5Rcreate (&((hobj_ref_t*)vlen_objref_data[1].p)[0], loc_id, NAME_OBJ_GRP, H5R_OBJECT, (hid_t)-1);
- if (status < 0)
- {
- HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
+ /* reference to group */
+ status =
+ H5Rcreate(&((hobj_ref_t *)vlen_objref_data[1].p)[0], loc_id, NAME_OBJ_GRP, H5R_OBJECT, (hid_t)-1);
+ if (status < 0) {
+ HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", __func__, __LINE__);
ret = FAIL;
goto out;
}
- /* reference to datatype */
- status = H5Rcreate (&((hobj_ref_t*)vlen_objref_data[2].p)[0], loc_id, NAME_OBJ_NDTYPE, H5R_OBJECT, (hid_t)-1);
- if (status < 0)
- {
- HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
+ /* reference to datatype */
+ status =
+ H5Rcreate(&((hobj_ref_t *)vlen_objref_data[2].p)[0], loc_id, NAME_OBJ_NDTYPE, H5R_OBJECT, (hid_t)-1);
+ if (status < 0) {
+ HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", __func__, __LINE__);
ret = FAIL;
goto out;
}
- /*
- * create vlen type with obj reference
- */
- vlen_objref_attr_tid = H5Tvlen_create (H5T_STD_REF_OBJ);
- vlen_objref_attr_sid = H5Screate_simple (RANK_VLEN_OBJREF, vlen_objref_dims, NULL);
+ /*
+ * create vlen type with obj reference
+ */
+ vlen_objref_attr_tid = H5Tvlen_create(H5T_STD_REF_OBJ);
+ vlen_objref_attr_sid = H5Screate_simple(RANK_VLEN_OBJREF, vlen_objref_dims, NULL);
- /*
+ /*
* create attribute and write the object reference
*/
- vlen_objref_attr_id = H5Acreate2(main_did, "Vlen_OBJREF", vlen_objref_attr_tid, vlen_objref_attr_sid, H5P_DEFAULT, H5P_DEFAULT);
- status = H5Awrite (vlen_objref_attr_id, vlen_objref_attr_tid, vlen_objref_data);
- if (status < 0)
- {
- HDfprintf(stderr, "Error: %s %d> H5Awrite failed.\n", FUNC, __LINE__);
+ vlen_objref_attr_id = H5Acreate2(main_did, "Vlen_OBJREF", vlen_objref_attr_tid, vlen_objref_attr_sid,
+ H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Awrite(vlen_objref_attr_id, vlen_objref_attr_tid, vlen_objref_data);
+ if (status < 0) {
+ HDfprintf(stderr, "Error: %s %d> H5Awrite failed.\n", __func__, __LINE__);
ret = FAIL;
goto out;
}
/* close resource for vlen data */
- status = H5Dvlen_reclaim (vlen_objref_attr_tid, vlen_objref_attr_sid, H5P_DEFAULT, vlen_objref_data);
- if (status < 0)
- {
- HDfprintf(stderr, "Error: %s %d> H5Dvlen_reclaim failed.\n", FUNC, __LINE__);
+ status = H5Treclaim(vlen_objref_attr_tid, vlen_objref_attr_sid, H5P_DEFAULT, vlen_objref_data);
+ if (status < 0) {
+ HDfprintf(stderr, "Error: %s %d> H5Treclaim failed.\n", __func__, __LINE__);
ret = FAIL;
goto out;
}
@@ -7052,22 +6981,21 @@ static herr_t make_complex_attr_references(hid_t loc_id)
* prepare vlen data
*/
vlen_regref_data[0].len = LEN0_VLEN_REGREF;
- vlen_regref_data[0].p = HDmalloc (vlen_regref_data[0].len * sizeof(hdset_reg_ref_t));
+ vlen_regref_data[0].p = HDmalloc(vlen_regref_data[0].len * sizeof(hdset_reg_ref_t));
/*
* create region reference
*/
status = H5Sselect_elements(objsid, H5S_SELECT_SET, (size_t)4, coords[0]);
- if (status < 0)
- {
- HDfprintf(stderr, "Error: %s %d> H5Sselect_elements failed.\n", FUNC, __LINE__);
+ if (status < 0) {
+ HDfprintf(stderr, "Error: %s %d> H5Sselect_elements failed.\n", __func__, __LINE__);
ret = FAIL;
goto out;
}
- status = H5Rcreate (&((hdset_reg_ref_t*)vlen_regref_data[0].p)[0], loc_id, NAME_OBJ_DS1, H5R_DATASET_REGION, objsid);
- if (status < 0)
- {
- HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
+ status = H5Rcreate(&((hdset_reg_ref_t *)vlen_regref_data[0].p)[0], loc_id, NAME_OBJ_DS1,
+ H5R_DATASET_REGION, objsid);
+ if (status < 0) {
+ HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", __func__, __LINE__);
ret = FAIL;
goto out;
}
@@ -7081,20 +7009,19 @@ static herr_t make_complex_attr_references(hid_t loc_id)
/*
* create attribute and write the region reference
*/
- vlen_regref_attr_id = H5Acreate2(main_did, "Vlen_REGREF", vlen_regref_attr_tid, vlen_regref_attr_sid, H5P_DEFAULT, H5P_DEFAULT);
- status = H5Awrite(vlen_regref_attr_id, vlen_regref_attr_tid, vlen_regref_data);
- if (status < 0)
- {
- HDfprintf(stderr, "Error: %s %d> H5Awrite failed.\n", FUNC, __LINE__);
+ vlen_regref_attr_id = H5Acreate2(main_did, "Vlen_REGREF", vlen_regref_attr_tid, vlen_regref_attr_sid,
+ H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Awrite(vlen_regref_attr_id, vlen_regref_attr_tid, vlen_regref_data);
+ if (status < 0) {
+ HDfprintf(stderr, "Error: %s %d> H5Awrite failed.\n", __func__, __LINE__);
ret = FAIL;
goto out;
}
/* close resource for vlen data */
- status = H5Dvlen_reclaim (vlen_regref_attr_tid, vlen_regref_attr_sid, H5P_DEFAULT, vlen_regref_data);
- if (status < 0)
- {
- HDfprintf(stderr, "Error: %s %d> H5Dvlen_reclaim failed.\n", FUNC, __LINE__);
+ status = H5Treclaim(vlen_regref_attr_tid, vlen_regref_attr_sid, H5P_DEFAULT, vlen_regref_data);
+ if (status < 0) {
+ HDfprintf(stderr, "Error: %s %d> H5Treclaim failed.\n", __func__, __LINE__);
ret = FAIL;
goto out;
}
diff --git a/tools/test/h5repack/testfiles/README b/tools/test/h5repack/testfiles/README
index 4096dee..4cb66f4 100644
--- a/tools/test/h5repack/testfiles/README
+++ b/tools/test/h5repack/testfiles/README
@@ -1,5 +1,5 @@
h5repack_nested_8bit_enum_deflated.h5:
h5repack_nested_8bit_enum.h5:
- enuberated 8bit type nested in compount type. Original file provided
+ enuberated 8bit type nested in compound type. Original file provided
by a user (HDFFV-8667) as a test file. Used h5copy to extract only the
Compound type dataset. The non-deflated version is produced by h5repack.
diff --git a/tools/test/h5repack/testfiles/attrregion.tattrreg.h5.ddl b/tools/test/h5repack/testfiles/attrregion.tattrreg.h5.ddl
new file mode 100644
index 0000000..7cab02b
--- /dev/null
+++ b/tools/test/h5repack/testfiles/attrregion.tattrreg.h5.ddl
@@ -0,0 +1,46 @@
+HDF5 "out-attrregion.tattrreg.h5" {
+GROUP "/" {
+ DATASET "Dataset1" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE NULL
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 0
+ OFFSET HADDR_UNDEF
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ ATTRIBUTE "Attribute1" {
+ DATATYPE H5T_REFERENCE { H5T_STD_REF_DSETREG }
+ DATASPACE SIMPLE { ( 4 ) / ( 4 ) }
+ }
+ }
+ DATASET "Dataset2" {
+ DATATYPE H5T_STD_U8BE
+ DATASPACE SIMPLE { ( 10, 10 ) / ( 10, 10 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 100
+ OFFSET 2048
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+}
+}
diff --git a/tools/test/h5repack/testfiles/dataregion.tdatareg.h5.ddl b/tools/test/h5repack/testfiles/dataregion.tdatareg.h5.ddl
new file mode 100644
index 0000000..bd31118
--- /dev/null
+++ b/tools/test/h5repack/testfiles/dataregion.tdatareg.h5.ddl
@@ -0,0 +1,42 @@
+HDF5 "out-dataregion.tdatareg.h5" {
+GROUP "/" {
+ DATASET "Dataset1" {
+ DATATYPE H5T_REFERENCE { H5T_STD_REF_DSETREG }
+ DATASPACE SIMPLE { ( 4 ) / ( 4 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 48
+ OFFSET 6244
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_UNDEFINED
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ DATASET "Dataset2" {
+ DATATYPE H5T_STD_U8BE
+ DATASPACE SIMPLE { ( 10, 10 ) / ( 10, 10 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 100
+ OFFSET 2048
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_UNDEFINED
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+}
+}
diff --git a/tools/test/h5repack/testfiles/h5copy_extlinks_src-base.h5copy_extlinks_src.h5.ddl b/tools/test/h5repack/testfiles/h5copy_extlinks_src-base.h5copy_extlinks_src.h5.ddl
new file mode 100644
index 0000000..ad8a320
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5copy_extlinks_src-base.h5copy_extlinks_src.h5.ddl
@@ -0,0 +1,28 @@
+HDF5 "out-h5copy_extlinks_src-mergeprune.h5copy_extlinks_src.h5" {
+GROUP "/" {
+ GROUP "group_ext" {
+ DATATYPE "extlink_datatype" H5T_STD_I32LE;
+ DATASET "extlink_dset" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 6 ) / ( 6 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 24
+ OFFSET 2200
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ GROUP "extlink_grp" {
+ }
+ }
+}
+}
diff --git a/tools/test/h5repack/testfiles/h5copy_extlinks_src-merge.h5copy_extlinks_src.h5.tst b/tools/test/h5repack/testfiles/h5copy_extlinks_src-merge.h5copy_extlinks_src.h5.tst
new file mode 100644
index 0000000..52f215d
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5copy_extlinks_src-merge.h5copy_extlinks_src.h5.tst
@@ -0,0 +1,26 @@
+
+file1 file2
+---------------------------------------
+ x x /
+ x x /group_ext
+ x x /group_ext/extlink_datatype
+ x x /group_ext/extlink_dset
+ x x /group_ext/extlink_grp
+ x x /group_ext/extlink_notyet1
+ x x /group_ext/extlink_notyet2
+
+group : </> and </>
+0 differences found
+group : </group_ext> and </group_ext>
+0 differences found
+Not comparable: </group_ext/extlink_datatype> is of type H5G_UDLINK and </group_ext/extlink_datatype> is of type H5G_TYPE
+Not comparable: </group_ext/extlink_dset> is of type H5G_UDLINK and </group_ext/extlink_dset> is of type H5G_DATASET
+Not comparable: </group_ext/extlink_grp> is of type H5G_UDLINK and </group_ext/extlink_grp> is of type H5G_GROUP
+external link: </group_ext/extlink_notyet1> and </group_ext/extlink_notyet1>
+0 differences found
+external link: </group_ext/extlink_notyet2> and </group_ext/extlink_notyet2>
+0 differences found
+--------------------------------
+Some objects are not comparable
+--------------------------------
+Use -c for a list of objects without details of differences.
diff --git a/tools/test/h5repack/testfiles/h5copy_extlinks_src-mergeprune.h5copy_extlinks_src.h5.ddl b/tools/test/h5repack/testfiles/h5copy_extlinks_src-mergeprune.h5copy_extlinks_src.h5.ddl
new file mode 100644
index 0000000..ad8a320
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5copy_extlinks_src-mergeprune.h5copy_extlinks_src.h5.ddl
@@ -0,0 +1,28 @@
+HDF5 "out-h5copy_extlinks_src-mergeprune.h5copy_extlinks_src.h5" {
+GROUP "/" {
+ GROUP "group_ext" {
+ DATATYPE "extlink_datatype" H5T_STD_I32LE;
+ DATASET "extlink_dset" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 6 ) / ( 6 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 24
+ OFFSET 2200
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ GROUP "extlink_grp" {
+ }
+ }
+}
+}
diff --git a/tools/test/h5repack/testfiles/h5copy_extlinks_src-prune.h5copy_extlinks_src.h5.ddl b/tools/test/h5repack/testfiles/h5copy_extlinks_src-prune.h5copy_extlinks_src.h5.ddl
new file mode 100644
index 0000000..b7d7bca
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5copy_extlinks_src-prune.h5copy_extlinks_src.h5.ddl
@@ -0,0 +1,6 @@
+HDF5 "out-h5copy_extlinks_src-prune.h5copy_extlinks_src.h5" {
+GROUP "/" {
+ GROUP "group_ext" {
+ }
+}
+}
diff --git a/tools/test/h5repack/testfiles/h5copy_extlinks_src.h5 b/tools/test/h5repack/testfiles/h5copy_extlinks_src.h5
new file mode 100644
index 0000000..7b8621e
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5copy_extlinks_src.h5
Binary files differ
diff --git a/tools/test/h5repack/testfiles/h5copy_extlinks_trg.h5 b/tools/test/h5repack/testfiles/h5copy_extlinks_trg.h5
new file mode 100644
index 0000000..3a0242d
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5copy_extlinks_trg.h5
Binary files differ
diff --git a/tools/test/h5repack/testfiles/h5repack-help.txt b/tools/test/h5repack/testfiles/h5repack-help.txt
index 2381865..bff70af 100644
--- a/tools/test/h5repack/testfiles/h5repack-help.txt
+++ b/tools/test/h5repack/testfiles/h5repack-help.txt
@@ -1,18 +1,51 @@
usage: h5repack [OPTIONS] file1 file2
file1 Input HDF5 File
file2 Output HDF5 File
+ ERROR
+ --enable-error-stack Prints messages from the HDF5 error stack as they occur.
+ Optional value 2 also prints file open errors.
OPTIONS
-h, --help Print a usage message and exit
- -v, --verbose Verbose mode, print object information
+ -v N, --verbose=N Verbose mode, print object information.
+ N - is an integer greater than 1, 2 displays read/write timing
-V, --version Print version number and exit
-n, --native Use a native HDF5 type when repacking
- --enable-error-stack Prints messages from the HDF5 error stack as they occur
+ --src-vol-value Value (ID) of the VOL connector to use for opening the
+ input HDF5 file specified
+ --src-vol-name Name of the VOL connector to use for opening the input
+ HDF5 file specified
+ --src-vol-info VOL-specific info to pass to the VOL connector used for
+ opening the input HDF5 file specified
+ --dst-vol-value Value (ID) of the VOL connector to use for opening the
+ output HDF5 file specified
+ --dst-vol-name Name of the VOL connector to use for opening the output
+ HDF5 file specified
+ --dst-vol-info VOL-specific info to pass to the VOL connector used for
+ opening the output HDF5 file specified
+ --src-vfd-value Value (ID) of the VFL driver to use for opening the
+ input HDF5 file specified
+ --src-vfd-name Name of the VFL driver to use for opening the input
+ HDF5 file specified
+ --src-vfd-info VFD-specific info to pass to the VFL driver used for
+ opening the input HDF5 file specified
+ --dst-vfd-value Value (ID) of the VFL driver to use for opening the
+ output HDF5 file specified
+ --dst-vfd-name Name of the VFL driver to use for opening the output
+ HDF5 file specified
+ --dst-vfd-info VFD-specific info to pass to the VFL driver used for
+ opening the output HDF5 file specified
-L, --latest Use latest version of file format
- This option will take precedence over the -j and -k options
- --low=BOUND The low bound for library release versions to use when creating
- objects in the file (default is H5F_LIBVER_EARLIEST)
- --high=BOUND The high bound for library release versions to use when creating
- objects in the file (default is H5F_LIBVER_LATEST)
+ This option will take precedence over the options
+ --low and --high
+ --low=BOUND The low bound for library release versions to use
+ when creating objects in the file
+ (default is H5F_LIBVER_EARLIEST)
+ --high=BOUND The high bound for library release versions to use
+ when creating objects in the file
+ (default is H5F_LIBVER_LATEST)
+ --merge Follow external soft link recursively and merge data
+ --prune Do not follow external soft links and remove link
+ --merge --prune Follow external link, merge data and remove dangling link
-c L1, --compact=L1 Maximum number of links in header messages
-d L2, --indexed=L2 Minimum number of links in the indexed format
-s S[:F], --ssize=S[:F] Shared object header message minimum size
@@ -27,10 +60,14 @@ usage: h5repack [OPTIONS] file1 file2
-z Z, --sort_order=Z Sort groups and attributes by order Z
-f FILT, --filter=FILT Filter type
-l LAYT, --layout=LAYT Layout type
- -S FS_STRATEGY, --fs_strategy=FS_STRATEGY File space management strategy for H5Pset_file_space_strategy
- -P FS_PERSIST, --fs_persist=FS_PERSIST Persisting or not persisting free-space for H5Pset_file_space_strategy
- -T FS_THRESHOLD, --fs_threshold=FS_THRESHOLD Free-space section threshold for H5Pset_file_space_strategy
- -G FS_PAGESIZE, --fs_pagesize=FS_PAGESIZE File space page size for H5Pset_file_space_page_size
+ -S FS_STRATEGY, --fs_strategy=FS_STRATEGY File space management strategy for
+ H5Pset_file_space_strategy
+ -P FS_PERSIST, --fs_persist=FS_PERSIST Persisting or not persisting free-
+ space for H5Pset_file_space_strategy
+ -T FS_THRESHOLD, --fs_threshold=FS_THRESHOLD Free-space section threshold
+ for H5Pset_file_space_strategy
+ -G FS_PAGESIZE, --fs_pagesize=FS_PAGESIZE File space page size for
+ H5Pset_file_space_page_size
M - is an integer greater than 1, size of dataset in bytes (default is 0)
E - is a filename.
@@ -38,41 +75,51 @@ usage: h5repack [OPTIONS] file1 file2
U - is a filename.
T - is an integer
A - is an integer greater than zero
- Q - is the sort index type for the input file. It can be "name" or "creation_order" (default)
- Z - is the sort order type for the input file. It can be "descending" or "ascending" (default)
+ Q - is the sort index type for the input file. It can be "name" or
+ "creation_order" (default)
+ Z - is the sort order type for the input file. It can be "descending" or
+ "ascending" (default)
B - is the user block size, any value that is 512 or greater and is
a power of 2 (1024 default)
F - is the shared object header message type, any of <dspace|dtype|fill|
pline|attr>. If F is not specified, S applies to all messages
- BOUND is an integer indicating the library release versions to use when creating
- objects in the file (see H5Pset_libver_bounds()):
+ BOUND is an integer indicating the library release versions to use when
+ creating objects in the file (see H5Pset_libver_bounds()):
0: This is H5F_LIBVER_EARLIEST in H5F_libver_t struct
1: This is H5F_LIBVER_V18 in H5F_libver_t struct
2: This is H5F_LIBVER_V110 in H5F_libver_t struct
3: This is H5F_LIBVER_V112 in H5F_libver_t struct
- (H5F_LIBVER_LATEST is aliased to H5F_LIBVER_V112 for this release
+ 4: This is H5F_LIBVER_V114 in H5F_libver_t struct
+ (H5F_LIBVER_LATEST is aliased to H5F_LIBVER_V114 for this release
FS_STRATEGY is a string indicating the file space strategy used:
FSM_AGGR:
- The mechanisms used in managing file space are free-space managers, aggregators and virtual file driver.
+ The mechanisms used in managing file space are free-space
+ managers, aggregators and virtual file driver.
PAGE:
- The mechanisms used in managing file space are free-space managers with embedded paged aggregation and virtual file driver.
+ The mechanisms used in managing file space are free-space
+ managers with embedded paged aggregation and virtual file driver.
AGGR:
- The mechanisms used in managing file space are aggregators and virtual file driver.
+ The mechanisms used in managing file space are aggregators and
+ virtual file driver.
NONE:
- The mechanisms used in managing file space are virtual file driver.
- The default strategy when not set is FSM_AGGR without persisting free-space.
+ The mechanisms used in managing file space are virtual file
+ driver.
+ The default strategy when not set is FSM_AGGR without persisting free-
+ space.
FS_PERSIST is 1 to persisting free-space or 0 to not persisting free-space.
The default when not set is not persisting free-space.
The value is ignored for AGGR and NONE strategies.
- FS_THRESHOLD is the minimum size (in bytes) of free-space sections to be tracked by the library.
+ FS_THRESHOLD is the minimum size (in bytes) of free-space sections to be
+ tracked by the library.
The default when not set is 1.
The value is ignored for AGGR and NONE strategies.
- FS_PAGESIZE is the size (in bytes) >=512 that is used by the library when the file space strategy PAGE is used.
+ FS_PAGESIZE is the size (in bytes) >=512 that is used by the library when
+ the file space strategy PAGE is used.
The default when not set is 4096.
FILT - is a string with the format:
@@ -100,9 +147,10 @@ usage: h5repack [OPTIONS] file1 file2
NBIT (no parameter)
SOFF=<scale_factor,scale_type> scale_factor is an integer and scale_type
is either IN or DS
- UD=<filter_number,filter_flag,cd_value_count,value_1[,value_2,...,value_N]>
- required values for filter_number,filter_flag,cd_value_count,value_1
- optional values for value_2 to value_N
+ UD=<filter_number,filter_flag,cd_value_count,value1[,value2,...,valueN]>
+ Required values: filter_number, filter_flag, cd_value_count, value1
+ Optional values: value2 to valueN
+ filter_flag: 1 is OPTIONAL or 0 is MANDATORY
NONE (no parameter)
LAYT - is a string with the format:
@@ -139,12 +187,7 @@ Examples of use:
4) h5repack -L -c 10 -s 20:dtype file1 file2
Using latest file format with maximum compact group size of 10 and
- and minimum shared datatype size of 20
-
-5) h5repack --low=0 --high=1 file1 file2
-
- Set low=H5F_LIBVER_EARLIEST and high=H5F_LIBVER_V18 via H5Pset_libver_bounds() when
- creating the repacked file: file2
+ minimum shared datatype size of 20
5) h5repack -f SHUF -f GZIP=1 file1 file2
@@ -154,3 +197,8 @@ Examples of use:
Add bzip2 filter to all datasets
+7) h5repack --low=0 --high=1 file1 file2
+
+ Set low=H5F_LIBVER_EARLIEST and high=H5F_LIBVER_V18 via
+ H5Pset_libver_bounds() when creating the repacked file, file2
+
diff --git a/tools/test/h5repack/testfiles/h5repack_CVE-2018-14460.h5 b/tools/test/h5repack/testfiles/h5repack_CVE-2018-14460.h5
new file mode 100644
index 0000000..f4093b5
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5repack_CVE-2018-14460.h5
Binary files differ
diff --git a/tools/test/h5repack/testfiles/h5repack_CVE-2018-17432.h5 b/tools/test/h5repack/testfiles/h5repack_CVE-2018-17432.h5
new file mode 100644
index 0000000..7a815ba
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5repack_CVE-2018-17432.h5
Binary files differ
diff --git a/tools/test/h5repack/testfiles/h5repack_f32le.h5 b/tools/test/h5repack/testfiles/h5repack_f32le.h5
new file mode 100644
index 0000000..03a9b57
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5repack_f32le.h5
Binary files differ
diff --git a/tools/test/h5repack/testfiles/h5repack_f32le_ex-0.dat b/tools/test/h5repack/testfiles/h5repack_f32le_ex-0.dat
new file mode 100644
index 0000000..8378fc2
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5repack_f32le_ex-0.dat
Binary files differ
diff --git a/tools/test/h5repack/testfiles/h5repack_f32le_ex.h5 b/tools/test/h5repack/testfiles/h5repack_f32le_ex.h5
new file mode 100644
index 0000000..ca6c49d
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5repack_f32le_ex.h5
Binary files differ
diff --git a/tools/test/h5repack/testfiles/h5repack_int32le_1d.h5 b/tools/test/h5repack/testfiles/h5repack_int32le_1d.h5
new file mode 100644
index 0000000..7d60566
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5repack_int32le_1d.h5
Binary files differ
diff --git a/tools/test/h5repack/testfiles/h5repack_int32le_1d_ex-0.dat b/tools/test/h5repack/testfiles/h5repack_int32le_1d_ex-0.dat
new file mode 100644
index 0000000..f75ada5
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5repack_int32le_1d_ex-0.dat
@@ -0,0 +1 @@
+úÿÿÿûÿÿÿüÿÿÿýÿÿÿþÿÿÿÿÿÿÿ \ No newline at end of file
diff --git a/tools/test/h5repack/testfiles/h5repack_int32le_1d_ex-1.dat b/tools/test/h5repack/testfiles/h5repack_int32le_1d_ex-1.dat
new file mode 100644
index 0000000..1f8f3b6
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5repack_int32le_1d_ex-1.dat
Binary files differ
diff --git a/tools/test/h5repack/testfiles/h5repack_int32le_1d_ex.h5 b/tools/test/h5repack/testfiles/h5repack_int32le_1d_ex.h5
new file mode 100644
index 0000000..ba4b534
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5repack_int32le_1d_ex.h5
Binary files differ
diff --git a/tools/test/h5repack/testfiles/h5repack_int32le_2d.h5 b/tools/test/h5repack/testfiles/h5repack_int32le_2d.h5
new file mode 100644
index 0000000..2f32bd1
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5repack_int32le_2d.h5
Binary files differ
diff --git a/tools/test/h5repack/testfiles/h5repack_int32le_2d_ex-0.dat b/tools/test/h5repack/testfiles/h5repack_int32le_2d_ex-0.dat
new file mode 100644
index 0000000..c6bfc64
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5repack_int32le_2d_ex-0.dat
Binary files differ
diff --git a/tools/test/h5repack/testfiles/h5repack_int32le_2d_ex.h5 b/tools/test/h5repack/testfiles/h5repack_int32le_2d_ex.h5
new file mode 100644
index 0000000..f6cce59
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5repack_int32le_2d_ex.h5
Binary files differ
diff --git a/tools/test/h5repack/testfiles/h5repack_int32le_3d.h5 b/tools/test/h5repack/testfiles/h5repack_int32le_3d.h5
new file mode 100644
index 0000000..7a61ef5
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5repack_int32le_3d.h5
Binary files differ
diff --git a/tools/test/h5repack/testfiles/h5repack_int32le_3d_ex-0.dat b/tools/test/h5repack/testfiles/h5repack_int32le_3d_ex-0.dat
new file mode 100644
index 0000000..b505eb4
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5repack_int32le_3d_ex-0.dat
Binary files differ
diff --git a/tools/test/h5repack/testfiles/h5repack_int32le_3d_ex.h5 b/tools/test/h5repack/testfiles/h5repack_int32le_3d_ex.h5
new file mode 100644
index 0000000..7c4b750
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5repack_int32le_3d_ex.h5
Binary files differ
diff --git a/tools/test/h5repack/testfiles/h5repack_layout.h5-dset2_chunk_20x10-errstk.tst b/tools/test/h5repack/testfiles/h5repack_layout.h5-dset2_chunk_20x10-errstk.tst
index 4e69148..3d9f0c2 100644
--- a/tools/test/h5repack/testfiles/h5repack_layout.h5-dset2_chunk_20x10-errstk.tst
+++ b/tools/test/h5repack/testfiles/h5repack_layout.h5-dset2_chunk_20x10-errstk.tst
@@ -1,47 +1,50 @@
HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
- #000: (file name) line (number) in H5Dcreate2(): unable to create dataset
+ #000: (file name) line (number) in H5Dcreate2(): unable to synchronously create dataset
major: Dataset
- minor: Unable to initialize object
- #001: (file name) line (number) in H5VL_dataset_create(): dataset create failed
+ minor: Unable to create file
+ #001: (file name) line (number) in H5D__create_api_common(): unable to create dataset
+ major: Dataset
+ minor: Unable to create file
+ #002: (file name) line (number) in H5VL_dataset_create(): dataset create failed
major: Virtual Object Layer
minor: Unable to create file
- #002: (file name) line (number) in H5VL__dataset_create(): dataset create failed
+ #003: (file name) line (number) in H5VL__dataset_create(): dataset create failed
major: Virtual Object Layer
minor: Unable to create file
- #003: (file name) line (number) in H5VL__native_dataset_create(): unable to create dataset
+ #004: (file name) line (number) in H5VL__native_dataset_create(): unable to create dataset
major: Dataset
minor: Unable to initialize object
- #004: (file name) line (number) in H5D__create_named(): unable to create and link to dataset
+ #005: (file name) line (number) in H5D__create_named(): unable to create and link to dataset
major: Dataset
minor: Unable to initialize object
- #005: (file name) line (number) in H5L_link_object(): unable to create new link to object
+ #006: (file name) line (number) in H5L_link_object(): unable to create new link to object
major: Links
minor: Unable to initialize object
- #006: (file name) line (number) in H5L__create_real(): can't insert link
+ #007: (file name) line (number) in H5L__create_real(): can't insert link
major: Links
minor: Unable to insert object
- #007: (file name) line (number) in H5G_traverse(): internal path traversal failed
+ #008: (file name) line (number) in H5G_traverse(): internal path traversal failed
major: Symbol table
minor: Object not found
- #008: (file name) line (number) in H5G__traverse_real(): traversal operator failed
+ #009: (file name) line (number) in H5G__traverse_real(): traversal operator failed
major: Symbol table
minor: Callback failed
- #009: (file name) line (number) in H5L__link_cb(): unable to create object
+ #010: (file name) line (number) in H5L__link_cb(): unable to create object
major: Links
minor: Unable to initialize object
- #010: (file name) line (number) in H5O_obj_create(): unable to open object
+ #011: (file name) line (number) in H5O_obj_create(): unable to open object
major: Object header
minor: Can't open object
- #011: (file name) line (number) in H5O__dset_create(): unable to create dataset
+ #012: (file name) line (number) in H5O__dset_create(): unable to create dataset
major: Dataset
minor: Unable to initialize object
- #012: (file name) line (number) in H5D__create(): unable to construct layout information
+ #013: (file name) line (number) in H5D__create(): unable to construct layout information
major: Dataset
minor: Unable to initialize object
- #013: (file name) line (number) in H5D__chunk_construct(): dimensionality of chunks doesn't match the dataspace
+ #014: (file name) line (number) in H5D__chunk_construct(): dimensionality of chunks doesn't match the dataspace
major: Dataset
minor: Bad value
H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs):
#000: (file name) line (number) in do_copy_objects(): H5Dcreate2 failed
major: Failure in tools library
- minor: error in function
+ minor: function info
diff --git a/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl b/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl
index 3ff2170..0992a0c 100644
--- a/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl
+++ b/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl
@@ -11,7 +11,7 @@ GROUP "/" {
USER_DEFINED_FILTER {
FILTER_ID 260
COMMENT dynlib4
- PARAMS { 9 1 11 6 }
+ PARAMS { 9 1 13 2 }
}
}
FILLVALUE {
@@ -33,7 +33,7 @@ GROUP "/" {
USER_DEFINED_FILTER {
FILTER_ID 260
COMMENT dynlib4
- PARAMS { 9 1 11 6 }
+ PARAMS { 9 1 13 2 }
}
}
FILLVALUE {
@@ -55,7 +55,7 @@ GROUP "/" {
USER_DEFINED_FILTER {
FILTER_ID 260
COMMENT dynlib4
- PARAMS { 9 1 11 6 }
+ PARAMS { 9 1 13 2 }
}
}
FILLVALUE {
@@ -77,7 +77,7 @@ GROUP "/" {
USER_DEFINED_FILTER {
FILTER_ID 260
COMMENT dynlib4
- PARAMS { 9 1 11 6 }
+ PARAMS { 9 1 13 2 }
}
}
FILLVALUE {
@@ -99,7 +99,7 @@ GROUP "/" {
USER_DEFINED_FILTER {
FILTER_ID 260
COMMENT dynlib4
- PARAMS { 9 1 11 6 }
+ PARAMS { 9 1 13 2 }
}
}
FILLVALUE {
@@ -121,7 +121,7 @@ GROUP "/" {
USER_DEFINED_FILTER {
FILTER_ID 260
COMMENT dynlib4
- PARAMS { 9 1 11 6 }
+ PARAMS { 9 1 13 2 }
}
}
FILLVALUE {
@@ -143,7 +143,7 @@ GROUP "/" {
USER_DEFINED_FILTER {
FILTER_ID 260
COMMENT dynlib4
- PARAMS { 9 1 11 6 }
+ PARAMS { 9 1 13 2 }
}
}
FILLVALUE {
diff --git a/tools/test/h5repack/testfiles/h5repack_uint8be.h5 b/tools/test/h5repack/testfiles/h5repack_uint8be.h5
new file mode 100644
index 0000000..0e25211
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5repack_uint8be.h5
Binary files differ
diff --git a/tools/test/h5repack/testfiles/h5repack_uint8be_ex-0.dat b/tools/test/h5repack/testfiles/h5repack_uint8be_ex-0.dat
new file mode 100644
index 0000000..f95b90a
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5repack_uint8be_ex-0.dat
Binary files differ
diff --git a/tools/test/h5repack/testfiles/h5repack_uint8be_ex-1.dat b/tools/test/h5repack/testfiles/h5repack_uint8be_ex-1.dat
new file mode 100644
index 0000000..011ab48
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5repack_uint8be_ex-1.dat
@@ -0,0 +1 @@
+@¿B½D»F¹H·JµL³N±P¯R­T«V©X§Z¥\£^¡`Ÿbd›f™h—j•l“n‘prt‹v‰x‡z…|ƒ~ \ No newline at end of file
diff --git a/tools/test/h5repack/testfiles/h5repack_uint8be_ex-2.dat b/tools/test/h5repack/testfiles/h5repack_uint8be_ex-2.dat
new file mode 100644
index 0000000..069b96d
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5repack_uint8be_ex-2.dat
@@ -0,0 +1 @@
+€‚}„{†yˆwŠuŒsŽqo’m”k–i˜gšeœcža _¢]¤[¦Y¨WªU¬S®Q°O²M´K¶I¸GºE¼C¾A \ No newline at end of file
diff --git a/tools/test/h5repack/testfiles/h5repack_uint8be_ex-3.dat b/tools/test/h5repack/testfiles/h5repack_uint8be_ex-3.dat
new file mode 100644
index 0000000..240d8ca
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5repack_uint8be_ex-3.dat
@@ -0,0 +1 @@
+À?Â=Ä;Æ9È7Ê5Ì3Î1Ð/Ò-Ô+Ö)Ø'Ú%Ü#Þ!àâäæèêìîðò ô ö øúüþ \ No newline at end of file
diff --git a/tools/test/h5repack/testfiles/h5repack_uint8be_ex.h5 b/tools/test/h5repack/testfiles/h5repack_uint8be_ex.h5
new file mode 100644
index 0000000..8787188
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5repack_uint8be_ex.h5
Binary files differ
diff --git a/tools/test/h5repack/testfiles/textlink-base.textlink.h5.ddl b/tools/test/h5repack/testfiles/textlink-base.textlink.h5.ddl
new file mode 100644
index 0000000..b87a17d
--- /dev/null
+++ b/tools/test/h5repack/testfiles/textlink-base.textlink.h5.ddl
@@ -0,0 +1,12 @@
+HDF5 "out-textlink-base.textlink.h5" {
+GROUP "/" {
+ EXTERNAL_LINK "extlink1" {
+ TARGETFILE "filename"
+ TARGETPATH "objname"
+ }
+ EXTERNAL_LINK "extlink2" {
+ TARGETFILE "anotherfile"
+ TARGETPATH "anotherobj"
+ }
+}
+}
diff --git a/tools/test/h5repack/testfiles/textlink-merge.textlink.h5.tst b/tools/test/h5repack/testfiles/textlink-merge.textlink.h5.tst
new file mode 100644
index 0000000..a7ff71d
--- /dev/null
+++ b/tools/test/h5repack/testfiles/textlink-merge.textlink.h5.tst
@@ -0,0 +1,13 @@
+
+file1 file2
+---------------------------------------
+ x x /
+ x x /extlink1
+ x x /extlink2
+
+group : </> and </>
+0 differences found
+external link: </extlink1> and </extlink1>
+0 differences found
+external link: </extlink2> and </extlink2>
+0 differences found
diff --git a/tools/test/h5repack/testfiles/textlink-mergeprune.textlink.h5.ddl b/tools/test/h5repack/testfiles/textlink-mergeprune.textlink.h5.ddl
new file mode 100644
index 0000000..7206ae9
--- /dev/null
+++ b/tools/test/h5repack/testfiles/textlink-mergeprune.textlink.h5.ddl
@@ -0,0 +1,4 @@
+HDF5 "out-textlink-mergeprune.textlink.h5" {
+GROUP "/" {
+}
+}
diff --git a/tools/test/h5repack/testfiles/textlink-prune.textlink.h5.ddl b/tools/test/h5repack/testfiles/textlink-prune.textlink.h5.ddl
new file mode 100644
index 0000000..83db344
--- /dev/null
+++ b/tools/test/h5repack/testfiles/textlink-prune.textlink.h5.ddl
@@ -0,0 +1,4 @@
+HDF5 "out-textlink-prune.textlink.h5" {
+GROUP "/" {
+}
+}
diff --git a/tools/test/h5repack/testfiles/textlinkfar-base.textlinkfar.h5.ddl b/tools/test/h5repack/testfiles/textlinkfar-base.textlinkfar.h5.ddl
new file mode 100644
index 0000000..a5eb497
--- /dev/null
+++ b/tools/test/h5repack/testfiles/textlinkfar-base.textlinkfar.h5.ddl
@@ -0,0 +1,116 @@
+HDF5 "out-textlinkfar-base.textlinkfar.h5" {
+GROUP "/" {
+ EXTERNAL_LINK "src_file" {
+ TARGETFILE "textlinksrc.h5"
+ TARGETPATH "/"
+ GROUP "/" {
+ EXTERNAL_LINK "ext2soft_link1" {
+ TARGETFILE "tsoftlinks.h5"
+ TARGETPATH "/soft_dset1"
+ DATASET "/soft_dset1" {
+ DATATYPE H5T_STD_I32BE
+ DATASPACE SIMPLE { ( 4, 2 ) / ( 4, 2 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 32
+ OFFSET 2848
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ }
+ EXTERNAL_LINK "ext2softdangle_link1" {
+ TARGETFILE "tsoftlinks.h5"
+ TARGETPATH "/soft_dangle"
+ }
+ EXTERNAL_LINK "ext_link1" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "group"
+ GROUP "group" {
+ DATASET "dset" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 6 ) / ( 6 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 24
+ OFFSET 3136
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ EXTERNAL_LINK "elink_t1" {
+ TARGETFILE "textlinksrc.h5"
+ TARGETPATH "/"
+ GROUP "/" {
+ HARDLINK "/"
+ }
+ }
+ EXTERNAL_LINK "elink_t2" {
+ TARGETFILE "textlinksrc.h5"
+ TARGETPATH "/ext_link4"
+ }
+ GROUP "subgroup" {
+ GROUP "link_to_group" {
+ HARDLINK "/group"
+ }
+ }
+ }
+ }
+ EXTERNAL_LINK "ext_link2" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "dset"
+ DATASET "dset" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 6 ) / ( 6 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 24
+ OFFSET 3160
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ }
+ EXTERNAL_LINK "ext_link3" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "type"
+ DATATYPE "type" H5T_STD_I32LE;
+ }
+ EXTERNAL_LINK "ext_link4" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "group/elink_t2"
+ }
+ EXTERNAL_LINK "ext_link5" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "empty_group"
+ GROUP "empty_group" {
+ }
+ }
+ }
+ }
+}
+}
diff --git a/tools/test/h5repack/testfiles/textlinkfar-merge.textlinkfar.h5.tst b/tools/test/h5repack/testfiles/textlinkfar-merge.textlinkfar.h5.tst
new file mode 100644
index 0000000..6673d39
--- /dev/null
+++ b/tools/test/h5repack/testfiles/textlinkfar-merge.textlinkfar.h5.tst
@@ -0,0 +1,20 @@
+
+file1 file2
+---------------------------------------
+ x x /
+ x x /src_file
+ x /src_file/ext2soft_link1
+ x /src_file/ext2softdangle_link1
+ x /src_file/ext_link1
+ x /src_file/ext_link2
+ x /src_file/ext_link3
+ x /src_file/ext_link4
+ x /src_file/ext_link5
+
+group : </> and </>
+0 differences found
+Not comparable: </src_file> is of type H5G_UDLINK and </src_file> is of type H5G_GROUP
+--------------------------------
+Some objects are not comparable
+--------------------------------
+Use -c for a list of objects without details of differences.
diff --git a/tools/test/h5repack/testfiles/textlinkfar-mergeprune.textlinkfar.h5.ddl b/tools/test/h5repack/testfiles/textlinkfar-mergeprune.textlinkfar.h5.ddl
new file mode 100644
index 0000000..7ba3308
--- /dev/null
+++ b/tools/test/h5repack/testfiles/textlinkfar-mergeprune.textlinkfar.h5.ddl
@@ -0,0 +1,152 @@
+HDF5 "out-textlinkfar-mergeprune.textlinkfar.h5" {
+GROUP "/" {
+ GROUP "src_file" {
+ EXTERNAL_LINK "ext2soft_link1" {
+ TARGETFILE "tsoftlinks.h5"
+ TARGETPATH "/soft_dset1"
+ DATASET "/soft_dset1" {
+ DATATYPE H5T_STD_I32BE
+ DATASPACE SIMPLE { ( 4, 2 ) / ( 4, 2 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 32
+ OFFSET 2848
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ }
+ EXTERNAL_LINK "ext2softdangle_link1" {
+ TARGETFILE "tsoftlinks.h5"
+ TARGETPATH "/soft_dangle"
+ }
+ EXTERNAL_LINK "ext_link1" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "group"
+ GROUP "group" {
+ DATASET "dset" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 6 ) / ( 6 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 24
+ OFFSET 3136
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ EXTERNAL_LINK "elink_t1" {
+ TARGETFILE "textlinksrc.h5"
+ TARGETPATH "/"
+ GROUP "/" {
+ EXTERNAL_LINK "ext2soft_link1" {
+ TARGETFILE "tsoftlinks.h5"
+ TARGETPATH "/soft_dset1"
+ DATASET "/soft_dset1" {
+ HARDLINK "/dset1"
+ }
+ }
+ EXTERNAL_LINK "ext2softdangle_link1" {
+ TARGETFILE "tsoftlinks.h5"
+ TARGETPATH "/soft_dangle"
+ }
+ EXTERNAL_LINK "ext_link1" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "group"
+ GROUP "group" {
+ HARDLINK "/group"
+ }
+ }
+ EXTERNAL_LINK "ext_link2" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "dset"
+ DATASET "dset" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 6 ) / ( 6 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 24
+ OFFSET 3160
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ }
+ EXTERNAL_LINK "ext_link3" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "type"
+ DATATYPE "type" H5T_STD_I32LE;
+ }
+ EXTERNAL_LINK "ext_link4" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "group/elink_t2"
+ }
+ EXTERNAL_LINK "ext_link5" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "empty_group"
+ GROUP "empty_group" {
+ }
+ }
+ }
+ }
+ EXTERNAL_LINK "elink_t2" {
+ TARGETFILE "textlinksrc.h5"
+ TARGETPATH "/ext_link4"
+ }
+ GROUP "subgroup" {
+ GROUP "link_to_group" {
+ HARDLINK "/group"
+ }
+ }
+ }
+ }
+ EXTERNAL_LINK "ext_link2" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "dset"
+ DATASET "dset" {
+ HARDLINK "/dset"
+ }
+ }
+ EXTERNAL_LINK "ext_link3" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "type"
+ DATATYPE "type" HARDLINK "/type"
+ }
+ EXTERNAL_LINK "ext_link4" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "group/elink_t2"
+ }
+ EXTERNAL_LINK "ext_link5" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "empty_group"
+ GROUP "empty_group" {
+ HARDLINK "/empty_group"
+ }
+ }
+ }
+}
+}
diff --git a/tools/test/h5repack/testfiles/textlinkfar-prune.textlinkfar.h5.ddl b/tools/test/h5repack/testfiles/textlinkfar-prune.textlinkfar.h5.ddl
new file mode 100644
index 0000000..30f8f1b
--- /dev/null
+++ b/tools/test/h5repack/testfiles/textlinkfar-prune.textlinkfar.h5.ddl
@@ -0,0 +1,4 @@
+HDF5 "out-textlinkfar-prune.textlinkfar.h5" {
+GROUP "/" {
+}
+}
diff --git a/tools/test/h5repack/testfiles/textlinksrc-base.textlinksrc.h5.ddl b/tools/test/h5repack/testfiles/textlinksrc-base.textlinksrc.h5.ddl
new file mode 100644
index 0000000..9a9a9aa
--- /dev/null
+++ b/tools/test/h5repack/testfiles/textlinksrc-base.textlinksrc.h5.ddl
@@ -0,0 +1,150 @@
+HDF5 "out-textlinksrc-base.textlinksrc.h5" {
+GROUP "/" {
+ EXTERNAL_LINK "ext2soft_link1" {
+ TARGETFILE "tsoftlinks.h5"
+ TARGETPATH "/soft_dset1"
+ DATASET "/soft_dset1" {
+ DATATYPE H5T_STD_I32BE
+ DATASPACE SIMPLE { ( 4, 2 ) / ( 4, 2 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 32
+ OFFSET 2848
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ }
+ EXTERNAL_LINK "ext2softdangle_link1" {
+ TARGETFILE "tsoftlinks.h5"
+ TARGETPATH "/soft_dangle"
+ }
+ EXTERNAL_LINK "ext_link1" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "group"
+ GROUP "group" {
+ DATASET "dset" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 6 ) / ( 6 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 24
+ OFFSET 3136
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ EXTERNAL_LINK "elink_t1" {
+ TARGETFILE "textlinksrc.h5"
+ TARGETPATH "/"
+ GROUP "/" {
+ EXTERNAL_LINK "ext2soft_link1" {
+ TARGETFILE "tsoftlinks.h5"
+ TARGETPATH "/soft_dset1"
+ DATASET "/soft_dset1" {
+ HARDLINK "/dset1"
+ }
+ }
+ EXTERNAL_LINK "ext2softdangle_link1" {
+ TARGETFILE "tsoftlinks.h5"
+ TARGETPATH "/soft_dangle"
+ }
+ EXTERNAL_LINK "ext_link1" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "group"
+ GROUP "group" {
+ HARDLINK "/group"
+ }
+ }
+ EXTERNAL_LINK "ext_link2" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "dset"
+ DATASET "dset" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 6 ) / ( 6 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 24
+ OFFSET 3160
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ }
+ EXTERNAL_LINK "ext_link3" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "type"
+ DATATYPE "type" H5T_STD_I32LE;
+ }
+ EXTERNAL_LINK "ext_link4" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "group/elink_t2"
+ }
+ EXTERNAL_LINK "ext_link5" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "empty_group"
+ GROUP "empty_group" {
+ }
+ }
+ }
+ }
+ EXTERNAL_LINK "elink_t2" {
+ TARGETFILE "textlinksrc.h5"
+ TARGETPATH "/ext_link4"
+ }
+ GROUP "subgroup" {
+ GROUP "link_to_group" {
+ HARDLINK "/group"
+ }
+ }
+ }
+ }
+ EXTERNAL_LINK "ext_link2" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "dset"
+ DATASET "dset" {
+ HARDLINK "/dset"
+ }
+ }
+ EXTERNAL_LINK "ext_link3" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "type"
+ DATATYPE "type" HARDLINK "/type"
+ }
+ EXTERNAL_LINK "ext_link4" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "group/elink_t2"
+ }
+ EXTERNAL_LINK "ext_link5" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "empty_group"
+ GROUP "empty_group" {
+ HARDLINK "/empty_group"
+ }
+ }
+}
+}
diff --git a/tools/test/h5repack/testfiles/textlinksrc-merge.textlinksrc.h5.tst b/tools/test/h5repack/testfiles/textlinksrc-merge.textlinksrc.h5.tst
new file mode 100644
index 0000000..d5a5902
--- /dev/null
+++ b/tools/test/h5repack/testfiles/textlinksrc-merge.textlinksrc.h5.tst
@@ -0,0 +1,32 @@
+
+file1 file2
+---------------------------------------
+ x x /
+ x x /ext2soft_link1
+ x x /ext2softdangle_link1
+ x x /ext_link1
+ x /ext_link1/dset
+ x /ext_link1/elink_t1
+ x /ext_link1/elink_t2
+ x /ext_link1/subgroup
+ x /ext_link1/subgroup/link_to_group
+ x x /ext_link2
+ x x /ext_link3
+ x x /ext_link4
+ x x /ext_link5
+
+group : </> and </>
+0 differences found
+Not comparable: </ext2soft_link1> is of type H5G_UDLINK and </ext2soft_link1> is of type H5G_DATASET
+external link: </ext2softdangle_link1> and </ext2softdangle_link1>
+0 differences found
+Not comparable: </ext_link1> is of type H5G_UDLINK and </ext_link1> is of type H5G_GROUP
+Not comparable: </ext_link2> is of type H5G_UDLINK and </ext_link2> is of type H5G_DATASET
+Not comparable: </ext_link3> is of type H5G_UDLINK and </ext_link3> is of type H5G_TYPE
+external link: </ext_link4> and </ext_link4>
+0 differences found
+Not comparable: </ext_link5> is of type H5G_UDLINK and </ext_link5> is of type H5G_GROUP
+--------------------------------
+Some objects are not comparable
+--------------------------------
+Use -c for a list of objects without details of differences.
diff --git a/tools/test/h5repack/testfiles/textlinksrc-mergeprune.textlinksrc.h5.ddl b/tools/test/h5repack/testfiles/textlinksrc-mergeprune.textlinksrc.h5.ddl
new file mode 100644
index 0000000..5b3c740
--- /dev/null
+++ b/tools/test/h5repack/testfiles/textlinksrc-mergeprune.textlinksrc.h5.ddl
@@ -0,0 +1,187 @@
+HDF5 "out-textlinksrc-mergeprune.textlinksrc.h5" {
+GROUP "/" {
+ DATASET "ext2soft_link1" {
+ DATATYPE H5T_STD_I32BE
+ DATASPACE SIMPLE { ( 4, 2 ) / ( 4, 2 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 32
+ OFFSET 2048
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ GROUP "ext_link1" {
+ DATASET "dset" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 6 ) / ( 6 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 24
+ OFFSET 2080
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ EXTERNAL_LINK "elink_t1" {
+ TARGETFILE "textlinksrc.h5"
+ TARGETPATH "/"
+ GROUP "/" {
+ EXTERNAL_LINK "ext2soft_link1" {
+ TARGETFILE "tsoftlinks.h5"
+ TARGETPATH "/soft_dset1"
+ DATASET "/soft_dset1" {
+ DATATYPE H5T_STD_I32BE
+ DATASPACE SIMPLE { ( 4, 2 ) / ( 4, 2 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 32
+ OFFSET 2848
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ }
+ EXTERNAL_LINK "ext2softdangle_link1" {
+ TARGETFILE "tsoftlinks.h5"
+ TARGETPATH "/soft_dangle"
+ }
+ EXTERNAL_LINK "ext_link1" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "group"
+ GROUP "group" {
+ DATASET "dset" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 6 ) / ( 6 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 24
+ OFFSET 3136
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ EXTERNAL_LINK "elink_t1" {
+ TARGETFILE "textlinksrc.h5"
+ TARGETPATH "/"
+ GROUP "/" {
+ HARDLINK "/"
+ }
+ }
+ EXTERNAL_LINK "elink_t2" {
+ TARGETFILE "textlinksrc.h5"
+ TARGETPATH "/ext_link4"
+ }
+ GROUP "subgroup" {
+ GROUP "link_to_group" {
+ HARDLINK "/group"
+ }
+ }
+ }
+ }
+ EXTERNAL_LINK "ext_link2" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "dset"
+ DATASET "dset" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 6 ) / ( 6 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 24
+ OFFSET 3160
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ }
+ EXTERNAL_LINK "ext_link3" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "type"
+ DATATYPE "type" H5T_STD_I32LE;
+ }
+ EXTERNAL_LINK "ext_link4" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "group/elink_t2"
+ }
+ EXTERNAL_LINK "ext_link5" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "empty_group"
+ GROUP "empty_group" {
+ }
+ }
+ }
+ }
+ EXTERNAL_LINK "elink_t2" {
+ TARGETFILE "textlinksrc.h5"
+ TARGETPATH "/ext_link4"
+ }
+ GROUP "subgroup" {
+ GROUP "link_to_group" {
+ HARDLINK "/ext_link1"
+ }
+ }
+ }
+ DATASET "ext_link2" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 6 ) / ( 6 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 24
+ OFFSET 2104
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ DATATYPE "ext_link3" H5T_STD_I32LE;
+ GROUP "ext_link5" {
+ }
+}
+}
diff --git a/tools/test/h5repack/testfiles/textlinksrc-prune.textlinksrc.h5.ddl b/tools/test/h5repack/testfiles/textlinksrc-prune.textlinksrc.h5.ddl
new file mode 100644
index 0000000..65d35ef
--- /dev/null
+++ b/tools/test/h5repack/testfiles/textlinksrc-prune.textlinksrc.h5.ddl
@@ -0,0 +1,4 @@
+HDF5 "out-textlinksrc-prune.textlinksrc.h5" {
+GROUP "/" {
+}
+}
diff --git a/tools/test/h5repack/testfiles/textlinktar-base.textlinktar.h5.ddl b/tools/test/h5repack/testfiles/textlinktar-base.textlinktar.h5.ddl
new file mode 100644
index 0000000..3f02ff2
--- /dev/null
+++ b/tools/test/h5repack/testfiles/textlinktar-base.textlinktar.h5.ddl
@@ -0,0 +1,168 @@
+HDF5 "out-textlinktar-base.textlinktar.h5" {
+GROUP "/" {
+ DATASET "dset" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 6 ) / ( 6 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 24
+ OFFSET 2048
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ GROUP "empty_group" {
+ }
+ GROUP "group" {
+ DATASET "dset" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 6 ) / ( 6 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 24
+ OFFSET 2072
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ EXTERNAL_LINK "elink_t1" {
+ TARGETFILE "textlinksrc.h5"
+ TARGETPATH "/"
+ GROUP "/" {
+ EXTERNAL_LINK "ext2soft_link1" {
+ TARGETFILE "tsoftlinks.h5"
+ TARGETPATH "/soft_dset1"
+ DATASET "/soft_dset1" {
+ DATATYPE H5T_STD_I32BE
+ DATASPACE SIMPLE { ( 4, 2 ) / ( 4, 2 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 32
+ OFFSET 2848
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ }
+ EXTERNAL_LINK "ext2softdangle_link1" {
+ TARGETFILE "tsoftlinks.h5"
+ TARGETPATH "/soft_dangle"
+ }
+ EXTERNAL_LINK "ext_link1" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "group"
+ GROUP "group" {
+ DATASET "dset" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 6 ) / ( 6 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 24
+ OFFSET 3136
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ EXTERNAL_LINK "elink_t1" {
+ TARGETFILE "textlinksrc.h5"
+ TARGETPATH "/"
+ GROUP "/" {
+ HARDLINK "/"
+ }
+ }
+ EXTERNAL_LINK "elink_t2" {
+ TARGETFILE "textlinksrc.h5"
+ TARGETPATH "/ext_link4"
+ }
+ GROUP "subgroup" {
+ GROUP "link_to_group" {
+ HARDLINK "/group"
+ }
+ }
+ }
+ }
+ EXTERNAL_LINK "ext_link2" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "dset"
+ DATASET "dset" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 6 ) / ( 6 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 24
+ OFFSET 3160
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ }
+ EXTERNAL_LINK "ext_link3" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "type"
+ DATATYPE "type" H5T_STD_I32LE;
+ }
+ EXTERNAL_LINK "ext_link4" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "group/elink_t2"
+ }
+ EXTERNAL_LINK "ext_link5" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "empty_group"
+ GROUP "empty_group" {
+ }
+ }
+ }
+ }
+ EXTERNAL_LINK "elink_t2" {
+ TARGETFILE "textlinksrc.h5"
+ TARGETPATH "/ext_link4"
+ }
+ GROUP "subgroup" {
+ GROUP "link_to_group" {
+ HARDLINK "/group"
+ }
+ }
+ }
+ DATATYPE "type" H5T_STD_I32LE;
+}
+}
diff --git a/tools/test/h5repack/testfiles/textlinktar-merge.textlinktar.h5.tst b/tools/test/h5repack/testfiles/textlinktar-merge.textlinktar.h5.tst
new file mode 100644
index 0000000..ccf4f7b
--- /dev/null
+++ b/tools/test/h5repack/testfiles/textlinktar-merge.textlinktar.h5.tst
@@ -0,0 +1,44 @@
+
+file1 file2
+---------------------------------------
+ x x /
+ x x /dset
+ x x /empty_group
+ x x /group
+ x x /group/dset
+ x x /group/elink_t1
+ x /group/elink_t1/ext2soft_link1
+ x /group/elink_t1/ext2softdangle_link1
+ x /group/elink_t1/ext_link1
+ x /group/elink_t1/ext_link2
+ x /group/elink_t1/ext_link3
+ x /group/elink_t1/ext_link4
+ x /group/elink_t1/ext_link5
+ x x /group/elink_t2
+ x x /group/subgroup
+ x x /group/subgroup/link_to_group
+ x x /type
+
+group : </> and </>
+0 differences found
+dataset: </dset> and </dset>
+0 differences found
+group : </empty_group> and </empty_group>
+0 differences found
+group : </group> and </group>
+0 differences found
+dataset: </group/dset> and </group/dset>
+0 differences found
+Not comparable: </group/elink_t1> is of type H5G_UDLINK and </group/elink_t1> is of type H5G_GROUP
+external link: </group/elink_t2> and </group/elink_t2>
+0 differences found
+group : </group/subgroup> and </group/subgroup>
+0 differences found
+group : </group/subgroup/link_to_group> and </group/subgroup/link_to_group>
+0 differences found
+datatype: </type> and </type>
+0 differences found
+--------------------------------
+Some objects are not comparable
+--------------------------------
+Use -c for a list of objects without details of differences.
diff --git a/tools/test/h5repack/testfiles/textlinktar-mergeprune.textlinktar.h5.ddl b/tools/test/h5repack/testfiles/textlinktar-mergeprune.textlinktar.h5.ddl
new file mode 100644
index 0000000..c52e34d
--- /dev/null
+++ b/tools/test/h5repack/testfiles/textlinktar-mergeprune.textlinktar.h5.ddl
@@ -0,0 +1,200 @@
+HDF5 "out-textlinktar-mergeprune.textlinktar.h5" {
+GROUP "/" {
+ DATASET "dset" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 6 ) / ( 6 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 24
+ OFFSET 2048
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ GROUP "empty_group" {
+ }
+ GROUP "group" {
+ DATASET "dset" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 6 ) / ( 6 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 24
+ OFFSET 2072
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ GROUP "elink_t1" {
+ EXTERNAL_LINK "ext2soft_link1" {
+ TARGETFILE "tsoftlinks.h5"
+ TARGETPATH "/soft_dset1"
+ DATASET "/soft_dset1" {
+ DATATYPE H5T_STD_I32BE
+ DATASPACE SIMPLE { ( 4, 2 ) / ( 4, 2 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 32
+ OFFSET 2848
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ }
+ EXTERNAL_LINK "ext2softdangle_link1" {
+ TARGETFILE "tsoftlinks.h5"
+ TARGETPATH "/soft_dangle"
+ }
+ EXTERNAL_LINK "ext_link1" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "group"
+ GROUP "group" {
+ DATASET "dset" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 6 ) / ( 6 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 24
+ OFFSET 3136
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ EXTERNAL_LINK "elink_t1" {
+ TARGETFILE "textlinksrc.h5"
+ TARGETPATH "/"
+ GROUP "/" {
+ EXTERNAL_LINK "ext2soft_link1" {
+ TARGETFILE "tsoftlinks.h5"
+ TARGETPATH "/soft_dset1"
+ DATASET "/soft_dset1" {
+ HARDLINK "/dset1"
+ }
+ }
+ EXTERNAL_LINK "ext2softdangle_link1" {
+ TARGETFILE "tsoftlinks.h5"
+ TARGETPATH "/soft_dangle"
+ }
+ EXTERNAL_LINK "ext_link1" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "group"
+ GROUP "group" {
+ HARDLINK "/group"
+ }
+ }
+ EXTERNAL_LINK "ext_link2" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "dset"
+ DATASET "dset" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 6 ) / ( 6 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 24
+ OFFSET 3160
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ }
+ EXTERNAL_LINK "ext_link3" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "type"
+ DATATYPE "type" H5T_STD_I32LE;
+ }
+ EXTERNAL_LINK "ext_link4" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "group/elink_t2"
+ }
+ EXTERNAL_LINK "ext_link5" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "empty_group"
+ GROUP "empty_group" {
+ }
+ }
+ }
+ }
+ EXTERNAL_LINK "elink_t2" {
+ TARGETFILE "textlinksrc.h5"
+ TARGETPATH "/ext_link4"
+ }
+ GROUP "subgroup" {
+ GROUP "link_to_group" {
+ HARDLINK "/group"
+ }
+ }
+ }
+ }
+ EXTERNAL_LINK "ext_link2" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "dset"
+ DATASET "dset" {
+ HARDLINK "/dset"
+ }
+ }
+ EXTERNAL_LINK "ext_link3" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "type"
+ DATATYPE "type" HARDLINK "/type"
+ }
+ EXTERNAL_LINK "ext_link4" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "group/elink_t2"
+ }
+ EXTERNAL_LINK "ext_link5" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "empty_group"
+ GROUP "empty_group" {
+ HARDLINK "/empty_group"
+ }
+ }
+ }
+ GROUP "subgroup" {
+ GROUP "link_to_group" {
+ HARDLINK "/group"
+ }
+ }
+ }
+ DATATYPE "type" H5T_STD_I32LE;
+}
+}
diff --git a/tools/test/h5repack/testfiles/textlinktar-prune.textlinktar.h5.ddl b/tools/test/h5repack/testfiles/textlinktar-prune.textlinktar.h5.ddl
new file mode 100644
index 0000000..6787784
--- /dev/null
+++ b/tools/test/h5repack/testfiles/textlinktar-prune.textlinktar.h5.ddl
@@ -0,0 +1,52 @@
+HDF5 "out-textlinktar-prune.textlinktar.h5" {
+GROUP "/" {
+ DATASET "dset" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 6 ) / ( 6 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 24
+ OFFSET 2048
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ GROUP "empty_group" {
+ }
+ GROUP "group" {
+ DATASET "dset" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 6 ) / ( 6 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 24
+ OFFSET 2072
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ GROUP "subgroup" {
+ GROUP "link_to_group" {
+ HARDLINK "/group"
+ }
+ }
+ }
+ DATATYPE "type" H5T_STD_I32LE;
+}
+}
diff --git a/tools/test/h5repack/testfiles/tsoftlinks-base.tsoftlinks.h5.ddl b/tools/test/h5repack/testfiles/tsoftlinks-base.tsoftlinks.h5.ddl
new file mode 100644
index 0000000..b0cd32d
--- /dev/null
+++ b/tools/test/h5repack/testfiles/tsoftlinks-base.tsoftlinks.h5.ddl
@@ -0,0 +1,77 @@
+HDF5 "out-tsoftlinks-base.tsoftlinks.h5" {
+GROUP "/" {
+ DATASET "dset1" {
+ DATATYPE H5T_STD_I32BE
+ DATASPACE SIMPLE { ( 4, 2 ) / ( 4, 2 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 32
+ OFFSET 2048
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ DATASET "dset2" {
+ DATATYPE H5T_STD_I32BE
+ DATASPACE SIMPLE { ( 4, 2 ) / ( 4, 2 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 32
+ OFFSET 2080
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ DATATYPE "dtype" H5T_STD_I32BE;
+ GROUP "group1" {
+ SOFTLINK "soft_dangle" {
+ LINKTARGET "not_yet"
+ }
+ SOFTLINK "soft_dset1" {
+ LINKTARGET "/dset1"
+ }
+ SOFTLINK "soft_dset2" {
+ LINKTARGET "/dset2"
+ }
+ SOFTLINK "soft_dtype" {
+ LINKTARGET "/dtype"
+ }
+ SOFTLINK "soft_empty_grp" {
+ LINKTARGET "/group_empty"
+ }
+ }
+ GROUP "group_empty" {
+ }
+ SOFTLINK "soft_dangle" {
+ LINKTARGET "not_yet"
+ }
+ SOFTLINK "soft_dset1" {
+ LINKTARGET "/dset1"
+ }
+ SOFTLINK "soft_dtype" {
+ LINKTARGET "/dtype"
+ }
+ SOFTLINK "soft_empty_grp" {
+ LINKTARGET "/group_empty"
+ }
+ SOFTLINK "soft_group1" {
+ LINKTARGET "/group1"
+ }
+}
+}
diff --git a/tools/test/h5repack/testfiles/tsoftlinks-merge.tsoftlinks.h5.tst b/tools/test/h5repack/testfiles/tsoftlinks-merge.tsoftlinks.h5.tst
new file mode 100644
index 0000000..27c33d7
--- /dev/null
+++ b/tools/test/h5repack/testfiles/tsoftlinks-merge.tsoftlinks.h5.tst
@@ -0,0 +1,53 @@
+
+file1 file2
+---------------------------------------
+ x x /
+ x x /dset1
+ x x /dset2
+ x x /dtype
+ x x /group1
+ x x /group1/soft_dangle
+ x x /group1/soft_dset1
+ x x /group1/soft_dset2
+ x x /group1/soft_dtype
+ x x /group1/soft_empty_grp
+ x x /group_empty
+ x x /soft_dangle
+ x x /soft_dset1
+ x x /soft_dtype
+ x x /soft_empty_grp
+ x x /soft_group1
+ x /soft_group1/soft_dangle
+ x /soft_group1/soft_dset1
+ x /soft_group1/soft_dset2
+ x /soft_group1/soft_dtype
+ x /soft_group1/soft_empty_grp
+
+group : </> and </>
+0 differences found
+dataset: </dset1> and </dset1>
+0 differences found
+dataset: </dset2> and </dset2>
+0 differences found
+datatype: </dtype> and </dtype>
+0 differences found
+group : </group1> and </group1>
+0 differences found
+link : </group1/soft_dangle> and </group1/soft_dangle>
+0 differences found
+Not comparable: </group1/soft_dset1> is of type H5G_LINK and </group1/soft_dset1> is of type H5G_DATASET
+Not comparable: </group1/soft_dset2> is of type H5G_LINK and </group1/soft_dset2> is of type H5G_DATASET
+Not comparable: </group1/soft_dtype> is of type H5G_LINK and </group1/soft_dtype> is of type H5G_TYPE
+Not comparable: </group1/soft_empty_grp> is of type H5G_LINK and </group1/soft_empty_grp> is of type H5G_GROUP
+group : </group_empty> and </group_empty>
+0 differences found
+link : </soft_dangle> and </soft_dangle>
+0 differences found
+Not comparable: </soft_dset1> is of type H5G_LINK and </soft_dset1> is of type H5G_DATASET
+Not comparable: </soft_dtype> is of type H5G_LINK and </soft_dtype> is of type H5G_TYPE
+Not comparable: </soft_empty_grp> is of type H5G_LINK and </soft_empty_grp> is of type H5G_GROUP
+Not comparable: </soft_group1> is of type H5G_LINK and </soft_group1> is of type H5G_GROUP
+--------------------------------
+Some objects are not comparable
+--------------------------------
+Use -c for a list of objects without details of differences.
diff --git a/tools/test/h5repack/testfiles/tsoftlinks-mergeprune.tsoftlinks.h5.ddl b/tools/test/h5repack/testfiles/tsoftlinks-mergeprune.tsoftlinks.h5.ddl
new file mode 100644
index 0000000..fa4e12d
--- /dev/null
+++ b/tools/test/h5repack/testfiles/tsoftlinks-mergeprune.tsoftlinks.h5.ddl
@@ -0,0 +1,127 @@
+HDF5 "out-tsoftlinks-mergeprune.tsoftlinks.h5" {
+GROUP "/" {
+ DATASET "dset1" {
+ DATATYPE H5T_STD_I32BE
+ DATASPACE SIMPLE { ( 4, 2 ) / ( 4, 2 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 32
+ OFFSET 2048
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ DATASET "dset2" {
+ DATATYPE H5T_STD_I32BE
+ DATASPACE SIMPLE { ( 4, 2 ) / ( 4, 2 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 32
+ OFFSET 2080
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ DATATYPE "dtype" H5T_STD_I32BE;
+ GROUP "group1" {
+ DATASET "soft_dset1" {
+ DATATYPE H5T_STD_I32BE
+ DATASPACE SIMPLE { ( 4, 2 ) / ( 4, 2 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 32
+ OFFSET 2112
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ DATASET "soft_dset2" {
+ DATATYPE H5T_STD_I32BE
+ DATASPACE SIMPLE { ( 4, 2 ) / ( 4, 2 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 32
+ OFFSET 2144
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ DATATYPE "soft_dtype" H5T_STD_I32BE;
+ GROUP "soft_empty_grp" {
+ }
+ }
+ GROUP "group_empty" {
+ }
+ DATASET "soft_dset1" {
+ DATATYPE H5T_STD_I32BE
+ DATASPACE SIMPLE { ( 4, 2 ) / ( 4, 2 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 32
+ OFFSET 2176
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ DATATYPE "soft_dtype" H5T_STD_I32BE;
+ GROUP "soft_empty_grp" {
+ }
+ GROUP "soft_group1" {
+ SOFTLINK "soft_dangle" {
+ LINKTARGET "not_yet"
+ }
+ SOFTLINK "soft_dset1" {
+ LINKTARGET "/dset1"
+ }
+ SOFTLINK "soft_dset2" {
+ LINKTARGET "/dset2"
+ }
+ SOFTLINK "soft_dtype" {
+ LINKTARGET "/dtype"
+ }
+ SOFTLINK "soft_empty_grp" {
+ LINKTARGET "/group_empty"
+ }
+ }
+}
+}
diff --git a/tools/test/h5repack/testfiles/tsoftlinks-prune.tsoftlinks.h5.ddl b/tools/test/h5repack/testfiles/tsoftlinks-prune.tsoftlinks.h5.ddl
new file mode 100644
index 0000000..de58ef2
--- /dev/null
+++ b/tools/test/h5repack/testfiles/tsoftlinks-prune.tsoftlinks.h5.ddl
@@ -0,0 +1,47 @@
+HDF5 "out-tsoftlinks-prune.tsoftlinks.h5" {
+GROUP "/" {
+ DATASET "dset1" {
+ DATATYPE H5T_STD_I32BE
+ DATASPACE SIMPLE { ( 4, 2 ) / ( 4, 2 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 32
+ OFFSET 2048
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ DATASET "dset2" {
+ DATATYPE H5T_STD_I32BE
+ DATASPACE SIMPLE { ( 4, 2 ) / ( 4, 2 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 32
+ OFFSET 2080
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ DATATYPE "dtype" H5T_STD_I32BE;
+ GROUP "group1" {
+ }
+ GROUP "group_empty" {
+ }
+}
+}
diff --git a/tools/test/h5repack/testh5repack_detect_szip.c b/tools/test/h5repack/testh5repack_detect_szip.c
index 6b86dd5..29414b4 100644
--- a/tools/test/h5repack/testh5repack_detect_szip.c
+++ b/tools/test/h5repack/testh5repack_detect_szip.c
@@ -6,7 +6,7 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -16,7 +16,6 @@
#include "h5tools_utils.h"
#include "h5test.h"
-
/* Name of tool */
#define PROGRAMNAME "h5repack_detect_szip"
@@ -39,8 +38,8 @@
*-------------------------------------------------------------------------
*/
-
-int main(void)
+int
+main(void)
{
h5tools_setprogname(PROGRAMNAME);
h5tools_setstatus(EXIT_SUCCESS);
@@ -51,9 +50,9 @@ int main(void)
#ifdef H5_HAVE_FILTER_SZIP
if (h5tools_can_encode(H5Z_FILTER_SZIP) == 1) {
HDprintf("yes\n");
- return(1);
+ return (1);
}
#endif /* H5_HAVE_FILTER_SZIP */
HDprintf("no\n");
- return(0);
+ return (0);
}