summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorScot Breitenfeld <brtnfld@hdfgroup.org>2022-04-08 14:25:14 (GMT)
committerGitHub <noreply@github.com>2022-04-08 14:25:14 (GMT)
commit6fad870737605a39103dc8f26b9799e158a3ee16 (patch)
tree1dc7a66327199cd9fa80c714243f33a83f13d1f5 /test
parent304d33f88b657c3a93da311c47a62cfca5af12c3 (diff)
downloadhdf5-feature/parallel_h5repack.zip
hdf5-feature/parallel_h5repack.tar.gz
hdf5-feature/parallel_h5repack.tar.bz2
Sync branch with develop (#1616)feature/parallel_h5repack
Sync branch with develop
Diffstat (limited to 'test')
-rw-r--r--test/AtomicWriterReader.txt2
-rw-r--r--test/CMakeLists.txt2
-rw-r--r--test/CMakeTests.cmake53
-rw-r--r--test/Makefile.am71
-rw-r--r--test/ShellTests.cmake58
-rw-r--r--test/app_ref.c4
-rw-r--r--test/cache_api.c2
-rw-r--r--test/cache_common.c148
-rw-r--r--test/cache_image.c16
-rw-r--r--test/chunk_info.c2
-rw-r--r--test/cmpd_dset.c12
-rw-r--r--test/del_many_dense_attrs.c4
-rw-r--r--test/dsets.c6
-rw-r--r--test/dt_arith.c2
-rw-r--r--test/dtransform.c17
-rw-r--r--test/dtypes.c8
-rw-r--r--test/earray.c9
-rw-r--r--test/enc_dec_plist.c4
-rw-r--r--test/event_set.c513
-rw-r--r--test/external.c11
-rw-r--r--test/external_common.c8
-rw-r--r--test/fheap.c146
-rw-r--r--test/filter_plugin.c10
-rw-r--r--test/flush1.c2
-rw-r--r--test/flush2.c2
-rw-r--r--test/flushrefresh.c4
-rw-r--r--test/genall5.c90
-rw-r--r--test/h5test.c75
-rw-r--r--test/links.c9
-rw-r--r--test/null_vfd_plugin.c75
-rw-r--r--test/page_buffer.c18
-rw-r--r--test/pool.c794
-rw-r--r--test/reserved.c6
-rw-r--r--test/swmr.c40
-rw-r--r--test/swmr_addrem_writer.c2
-rw-r--r--test/swmr_common.c5
-rw-r--r--test/swmr_generator.c2
-rw-r--r--test/swmr_reader.c4
-rw-r--r--test/swmr_remove_reader.c2
-rw-r--r--test/swmr_remove_writer.c2
-rw-r--r--test/swmr_sparse_reader.c4
-rw-r--r--test/swmr_sparse_writer.c2
-rw-r--r--test/swmr_start_write.c2
-rw-r--r--test/swmr_writer.c2
-rw-r--r--test/tattr.c153
-rw-r--r--test/test_abort_fail.sh.in (renamed from test/testabort_fail.sh.in)0
-rw-r--r--test/test_check_version.sh.in (renamed from test/testcheck_version.sh.in)0
-rw-r--r--test/test_error.sh.in (renamed from test/testerror.sh.in)0
-rw-r--r--test/test_external_env.sh.in (renamed from test/testexternal_env.sh.in)0
-rw-r--r--test/test_filter_plugin.sh.in113
-rw-r--r--test/test_flush_refresh.sh.in (renamed from test/testflushrefresh.sh.in)0
-rw-r--r--test/test_libinfo.sh.in (renamed from test/testlibinfo.sh.in)0
-rw-r--r--test/test_links_env.sh.in (renamed from test/testlinks_env.sh.in)0
-rw-r--r--test/test_plugin.sh.in140
-rw-r--r--test/test_swmr.pwsh.in (renamed from test/testswmr.pwsh.in)0
-rw-r--r--test/test_swmr.sh.in (renamed from test/testswmr.sh.in)0
-rw-r--r--test/test_use_cases.sh.in (renamed from test/test_usecases.sh.in)0
-rw-r--r--test/test_vds_env.sh.in (renamed from test/testvds_env.sh.in)0
-rw-r--r--test/test_vds_swmr.pwsh.in (renamed from test/testvdsswmr.pwsh.in)0
-rw-r--r--test/test_vds_swmr.sh.in (renamed from test/testvdsswmr.sh.in)0
-rw-r--r--test/test_vol_plugin.sh.in84
-rw-r--r--test/testhdf5.c1
-rw-r--r--test/testhdf5.h1
-rw-r--r--test/theap.c1081
-rw-r--r--test/tmisc.c6
-rw-r--r--test/trefstr.c10
-rw-r--r--test/tselect.c36
-rw-r--r--test/tvlstr.c10
-rw-r--r--test/twriteorder.c6
-rw-r--r--test/unregister.c2
-rw-r--r--test/use_append_chunk.c6
-rw-r--r--test/use_append_mchunks.c6
-rw-r--r--test/vds_env.c5
-rw-r--r--test/vfd.c2035
74 files changed, 3263 insertions, 2682 deletions
diff --git a/test/AtomicWriterReader.txt b/test/AtomicWriterReader.txt
index dc0a3bd..064ba39 100644
--- a/test/AtomicWriterReader.txt
+++ b/test/AtomicWriterReader.txt
@@ -11,7 +11,7 @@ atomic_reader.c: is the "read" part of the test.
Building the Tests
------------------
-The two test parts are automically built during configure and make process.
+The two test parts are automatically built during configure and make process.
But to build them individually, you can do in test/ directory:
$ gcc atomic_writer
$ gcc atomic_reader
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 4e543fd..f9e6e4b 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -266,7 +266,6 @@ set (testhdf5_SOURCES
${HDF5_TEST_SOURCE_DIR}/tgenprop.c
${HDF5_TEST_SOURCE_DIR}/th5o.c
${HDF5_TEST_SOURCE_DIR}/th5s.c
- ${HDF5_TEST_SOURCE_DIR}/theap.c
${HDF5_TEST_SOURCE_DIR}/tid.c
${HDF5_TEST_SOURCE_DIR}/titerate.c
${HDF5_TEST_SOURCE_DIR}/tmeta.c
@@ -318,7 +317,6 @@ set (H5_TESTS
earray
btree2
fheap
- pool
accum
hyperslab
istore
diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake
index b2ed8e8..a534e60 100644
--- a/test/CMakeTests.cmake
+++ b/test/CMakeTests.cmake
@@ -205,18 +205,12 @@ add_test (
)
set_tests_properties (H5TEST-testhdf5-clear-objects PROPERTIES FIXTURES_SETUP clear_testhdf5)
-add_test (NAME H5TEST-testhdf5-base COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:testhdf5> -x heap -x file -x select)
+add_test (NAME H5TEST-testhdf5-base COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:testhdf5> -x file -x select)
set_tests_properties (H5TEST-testhdf5-base PROPERTIES
FIXTURES_REQUIRED clear_testhdf5
ENVIRONMENT "HDF5_ALARM_SECONDS=3600;srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST"
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
)
-add_test (NAME H5TEST-testhdf5-heap COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:testhdf5> -o heap)
-set_tests_properties (H5TEST-testhdf5-heap PROPERTIES
- FIXTURES_REQUIRED clear_testhdf5
- ENVIRONMENT "HDF5_ALARM_SECONDS=3600;srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST"
- WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
-)
add_test (NAME H5TEST-testhdf5-file COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:testhdf5> -o file)
set_tests_properties (H5TEST-testhdf5-file PROPERTIES
FIXTURES_REQUIRED clear_testhdf5
@@ -649,10 +643,11 @@ set_tests_properties (H5TEST-tcheck_version-minor PROPERTIES
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
WILL_FAIL "true"
)
-# release + 1 should pass
+# release + 1 should pass on non-develop branches
add_test (NAME H5TEST-tcheck_version-release COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:tcheck_version> "-tr")
set_tests_properties (H5TEST-tcheck_version-release PROPERTIES
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
+ WILL_FAIL "true"
)
##############################################################################
@@ -673,18 +668,18 @@ set_tests_properties (H5TEST-tcheck_version-release PROPERTIES
# flushrefresh
##############################################################################
# autotools script tests
-# error_test and err_compat are built at the same time as the other tests, but executed by testerror.sh.
-# NOT CONVERTED accum_swmr_reader is used by accum.c.
-# NOT CONVERTED atomic_writer and atomic_reader are standalone programs.
-# links_env is used by testlinks_env.sh
-# filenotclosed and del_many_dense_attrs are used by testabort_fail.sh
-# NOT CONVERTED flushrefresh is used by testflushrefresh.sh.
-# NOT CONVERTED use_append_chunk, use_append_mchunks and use_disable_mdc_flushes are used by test_usecases.sh
-# NOT CONVERTED swmr_* files (besides swmr.c) are used by testswmr.sh.
-# NOT CONVERTED vds_swmr_* files are used by testvdsswmr.sh
-# NOT CONVERTED 'make check' doesn't run them directly, so they are not included in TEST_PROG.
-# NOT CONVERTED Also build testmeta, which is used for timings test. It builds quickly,
-# NOT CONVERTED and this lets automake keep all its test programs in one place.
+# error_test and err_compat are built at the same time as the other tests, but executed by test_error.sh
+# NOT CONVERTED accum_swmr_reader is used by accum.c
+# NOT CONVERTED atomic_writer and atomic_reader are stand-alone programs
+# links_env is used by test_links_env.sh
+# filenotclosed and del_many_dense_attrs are used by test_abort_fail.sh
+# NOT CONVERTED flushrefresh is used by test_flush_refresh.sh
+# NOT CONVERTED use_append_chunk, use_append_mchunks and use_disable_mdc_flushes are used by test_use_cases.sh
+# NOT CONVERTED swmr_* files (besides swmr.c) are used by test_swmr.sh
+# NOT CONVERTED vds_swmr_* files are used by test_vds_swmr.sh
+# 'make check' doesn't run them directly, so they are not included in TEST_PROG.
+# Also build testmeta, which is used for timings test. It builds quickly
+# and this lets automake keep all its test programs in one place.
##############################################################################
#-- Adding test for filenotclosed
@@ -852,16 +847,6 @@ if (BUILD_SHARED_LIBS)
ENVIRONMENT "HDF5_PLUGIN_PATH=${CMAKE_BINARY_DIR}/filter_plugin_dir1${CMAKE_SEP}${CMAKE_BINARY_DIR}/filter_plugin_dir2;srcdir=${HDF5_TEST_BINARY_DIR}"
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}
)
-
-##############################################################################
-# HDFFV-9655 relative plugin test disabled
-#
-# add_test (NAME H5PLUGIN-pluginRelative COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:plugin>)
-# set_tests_properties (H5PLUGIN-pluginRelative PROPERTIES
-# ENVIRONMENT "HDF5_PLUGIN_PATH=@/${BIN_REL_PATH}testdir1${CMAKE_SEP}@/${BIN_REL_PATH}testdir2;srcdir=${HDF5_TEST_BINARY_DIR}"
-# WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}
-# )
-##############################################################################
endif ()
option (TEST_SHELL_SCRIPTS "Enable shell script tests" ON)
@@ -874,10 +859,10 @@ if (ENABLE_EXTENDED_TESTS)
##############################################################################
### S W M R T E S T S
##############################################################################
-# testflushrefresh.sh: flushrefresh
-# test_usecases.sh: use_append_chunk, use_append_mchunks, use_disable_mdc_flushes
-# testswmr.sh: swmr*
-# testvdsswmr.sh: vds_swmr*
+# test_flush_refresh.sh: flushrefresh
+# test_use_cases.sh: use_append_chunk, use_append_mchunks, use_disable_mdc_flushes
+# test_swmr.sh: swmr*
+# test_vds_swmr.sh: vds_swmr*
#-- Adding test for flushrefresh
file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST/flushrefresh_test")
diff --git a/test/Makefile.am b/test/Makefile.am
index ff09003..fcfd34e 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -22,21 +22,23 @@ include $(top_srcdir)/config/commence.am
AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_builddir)/src
# Test scripts--
-# testerror.sh: err_compat, error_test
-# testlibinfo.sh:
-# testcheck_version.sh: tcheck_version
-# testlinks_env.sh: links_env
-# testexternal_env.sh: external_env
-# testflushrefresh.sh: flushrefresh
-# testvds_env.sh: vds_env
-# testswmr.sh: swmr*
-# testvdsswmr.sh: vds_swmr*
-# testabort_fail.sh: filenotclosed.c and del_many_dense_attrs.c
-# test_filter_plugin.sh: filter_plugin.c
+# test_abort_fail.sh: filenotclosed.c and del_many_dense_attrs.c
+# test_check_version.sh: tcheck_version
+# test_error.sh: err_compat, error_test
+# test_external_env.sh: external_env
+# test_flush_refresh.sh: flushrefresh
+# test_libinfo.sh:
+# test_links_env.sh: links_env
# test_mirror.sh: mirror_vfd ../utils/mirror_vfd/*
-# test_usecases.sh: use_append_chunk, use_append_mchunks, use_disable_mdc_flushes
-TEST_SCRIPT = testerror.sh testlibinfo.sh testcheck_version.sh testlinks_env.sh testexternal_env.sh \
- testswmr.sh testvds_env.sh testvdsswmr.sh testflushrefresh.sh test_usecases.sh testabort_fail.sh
+# test_plugin.sh: filter_plugin.c vfd_plugin.c vol_plugin.c
+# test_swmr.sh: swmr*
+# test_vds_env.sh: vds_env
+# test_vds_swmr.sh: vds_swmr*
+# test_use_cases.sh: use_append_chunk, use_append_mchunks, use_disable_mdc_flushes
+TEST_SCRIPT = test_abort_fail.sh test_check_version.sh test_error.sh \
+ test_flush_refresh.sh test_external_env.sh test_libinfo.sh \
+ test_links_env.sh test_swmr.sh test_vds_env.sh test_vds_swmr.sh \
+ test_use_cases.sh
SCRIPT_DEPEND = error_test$(EXEEXT) err_compat$(EXEEXT) links_env$(EXEEXT) \
external_env$(EXEEXT) filenotclosed$(EXEEXT) del_many_dense_attrs$(EXEEXT) \
flushrefresh$(EXEEXT) use_append_chunk$(EXEEXT) use_append_mchunks$(EXEEXT) use_disable_mdc_flushes$(EXEEXT) \
@@ -45,10 +47,9 @@ SCRIPT_DEPEND = error_test$(EXEEXT) err_compat$(EXEEXT) links_env$(EXEEXT) \
swmr_sparse_reader$(EXEEXT) swmr_sparse_writer$(EXEEXT) swmr_start_write$(EXEEXT) \
vds_env$(EXEEXT) vds_swmr_gen$(EXEEXT) vds_swmr_reader$(EXEEXT) vds_swmr_writer$(EXEEXT)
if HAVE_SHARED_CONDITIONAL
- TEST_SCRIPT += test_filter_plugin.sh test_vol_plugin.sh
- SCRIPT_DEPEND += filter_plugin$(EXEEXT) vol_plugin$(EXEEXT)
+ TEST_SCRIPT += test_plugin.sh
+ SCRIPT_DEPEND += filter_plugin$(EXEEXT) vfd_plugin $(EXEEXT) vol_plugin$(EXEEXT)
endif
-
if MIRROR_VFD_CONDITIONAL
TEST_SCRIPT += test_mirror.sh
endif
@@ -62,7 +63,7 @@ check_SCRIPTS = $(TEST_SCRIPT)
TEST_PROG= testhdf5 \
cache cache_api cache_image cache_tagging lheap ohdr \
stab gheap evict_on_close farray earray btree2 fheap \
- pool accum hyperslab istore bittests dt_arith page_buffer \
+ accum hyperslab istore bittests dt_arith page_buffer \
dtypes dsets chunk_info cmpd_dset cmpd_dtransform filter_fail extend direct_chunk \
external efc objcopy objcopy_ref links unlink twriteorder big mtime \
fillval mount \
@@ -71,22 +72,25 @@ TEST_PROG= testhdf5 \
dangle dtransform reserved cross_read freespace mf vds file_image \
unregister cache_logging cork swmr thread_id vol timer event_set
-# List programs to be built when testing here.
-# error_test and err_compat are built at the same time as the other tests, but executed by testerror.sh.
-# tcheck_version is used by testcheck_version.sh.
-# accum_swmr_reader is used by accum.c.
-# atomic_writer and atomic_reader are standalone programs.
-# links_env is used by testlinks_env.sh
-# external_env is used by testexternal_env.sh
-# filenotclosed and del_many_dense_attrs are used by testabort_fail.sh
-# flushrefresh is used by testflushrefresh.sh.
-# use_append_chunk, use_append_mchunks and use_disable_mdc_flushes are used by test_usecases.sh
-# swmr_* files (besides swmr.c) are used by testswmr.sh.
-# vds_swmr_* files are used by testvdsswmr.sh
-# vds_env is used by testvds_env.sh
+# List programs to be built when testing here
+#
+# error_test and err_compat are built at the same time as the other tests, but executed by test_error.sh
+# tcheck_version is used by test_check_version.sh
+# accum_swmr_reader is used by accum.c
+# atomic_writer and atomic_reader are stand-alone programs
+# links_env is used by test_links_env.sh
+# external_env is used by test_external_env.sh
+# filenotclosed and del_many_dense_attrs are used by test_abort_fail.sh
+# flushrefresh is used by test_flush_refresh.sh
+# use_append_chunk, use_append_mchunks and use_disable_mdc_flushes are used by test_use_cases.sh
+# swmr_* files (besides swmr.c) are used by test_swmr.sh
+# vds_swmr_* files are used by test_vds_swmr.sh
+# vds_env is used by test_vds_env.sh
# mirror_vfd is used by test_mirror.sh
+#
# 'make check' doesn't run them directly, so they are not included in TEST_PROG.
-# Also build testmeta, which is used for timings test. It builds quickly,
+#
+# Also build testmeta, which is used for the timing test. It builds quickly
# and this lets automake keep all its test programs in one place.
check_PROGRAMS=$(TEST_PROG) error_test err_compat tcheck_version \
testmeta accum_swmr_reader atomic_writer atomic_reader external_env \
@@ -98,7 +102,6 @@ check_PROGRAMS=$(TEST_PROG) error_test err_compat tcheck_version \
if HAVE_SHARED_CONDITIONAL
check_PROGRAMS+= filter_plugin vfd_plugin vol_plugin
endif
-
if MIRROR_VFD_CONDITIONAL
check_PROGRAMS+= mirror_vfd
endif
@@ -227,7 +230,7 @@ CHECK_CLEANFILES+=accum.h5 cmpd_dset.h5 compact_dataset.h5 dataset.h5 dset_offse
# Sources for testhdf5 executable
testhdf5_SOURCES=testhdf5.c tarray.c tattr.c tchecksum.c tconfig.c tfile.c \
- tgenprop.c th5o.c th5s.c tcoords.c theap.c tid.c titerate.c tmeta.c tmisc.c \
+ tgenprop.c th5o.c th5s.c tcoords.c tid.c titerate.c tmeta.c tmisc.c \
trefer.c trefer_deprec.c trefstr.c tselect.c tskiplist.c tsohm.c ttime.c tunicode.c \
tvlstr.c tvltypes.c
diff --git a/test/ShellTests.cmake b/test/ShellTests.cmake
index e7de735..140da6f 100644
--- a/test/ShellTests.cmake
+++ b/test/ShellTests.cmake
@@ -17,21 +17,21 @@
find_program (PWSH NAMES pwsh powershell)
if (PWSH)
- file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST/usecases_test")
+ file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST/use_cases_test")
file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST/swmr_test")
file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST/vds_swmr_test")
set (srcdir ${HDF5_TEST_SOURCE_DIR})
set (H5_UTILS_TEST_BUILDDIR ${CMAKE_TEST_OUTPUT_DIRECTORY})
set (H5_TEST_BUILDDIR ${HDF5_TEST_BINARY_DIR}/H5TEST)
- configure_file(${HDF5_TEST_SOURCE_DIR}/testswmr.pwsh.in ${HDF5_TEST_BINARY_DIR}/H5TEST/testswmr.ps1 @ONLY)
+ configure_file(${HDF5_TEST_SOURCE_DIR}/test_swmr.pwsh.in ${HDF5_TEST_BINARY_DIR}/H5TEST/test_swmr.ps1 @ONLY)
# test commented out as currently the programs are not allowing another access to the data file
#add_test (H5SHELL-testswmr ${PWSH} ${HDF5_TEST_BINARY_DIR}/H5TEST/testswmr.ps1)
#set_tests_properties (H5SHELL-testswmr PROPERTIES
# ENVIRONMENT "PATH=$ENV{PATH}:${CMAKE_RUNTIME_OUTPUT_DIRECTORY}"
# WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
#)
- configure_file(${HDF5_TEST_SOURCE_DIR}/testvdsswmr.pwsh.in ${HDF5_TEST_BINARY_DIR}/H5TEST/testvdsswmr.ps1 @ONLY)
+ configure_file(${HDF5_TEST_SOURCE_DIR}/test_vds_swmr.pwsh.in ${HDF5_TEST_BINARY_DIR}/H5TEST/test_vds_swmr.ps1 @ONLY)
# test commented out as currently the programs are not allowing another access to the data file
#add_test (H5SHELL-testvdsswmr ${PWSH} ${HDF5_TEST_BINARY_DIR}/H5TEST/testvdsswmr.ps1)
#set_tests_properties (H5SHELL-testvdsswmr PROPERTIES
@@ -48,11 +48,11 @@ elseif (UNIX)
# configure scripts to test dir
##############################################################################
if (H5_PERL_FOUND)
- configure_file(${HDF5_TEST_SOURCE_DIR}/testflushrefresh.sh.in ${HDF5_TEST_BINARY_DIR}/H5TEST/testflushrefresh.sh @ONLY)
+ configure_file(${HDF5_TEST_SOURCE_DIR}/test_flush_refresh.sh.in ${HDF5_TEST_BINARY_DIR}/H5TEST/test_flush_refresh.sh @ONLY)
endif ()
- configure_file(${HDF5_TEST_SOURCE_DIR}/test_usecases.sh.in ${HDF5_TEST_BINARY_DIR}/H5TEST/test_usecases.sh @ONLY)
- configure_file(${HDF5_TEST_SOURCE_DIR}/testswmr.sh.in ${HDF5_TEST_BINARY_DIR}/H5TEST/testswmr.sh @ONLY)
- configure_file(${HDF5_TEST_SOURCE_DIR}/testvdsswmr.sh.in ${HDF5_TEST_BINARY_DIR}/H5TEST/testvdsswmr.sh @ONLY)
+ configure_file(${HDF5_TEST_SOURCE_DIR}/test_use_cases.sh.in ${HDF5_TEST_BINARY_DIR}/H5TEST/test_use_cases.sh @ONLY)
+ configure_file(${HDF5_TEST_SOURCE_DIR}/test_swmr.sh.in ${HDF5_TEST_BINARY_DIR}/H5TEST/test_swmr.sh @ONLY)
+ configure_file(${HDF5_TEST_SOURCE_DIR}/test_vds_swmr.sh.in ${HDF5_TEST_BINARY_DIR}/H5TEST/test_vds_swmr.sh @ONLY)
##############################################################################
# copy test programs to test dir
@@ -78,44 +78,44 @@ elseif (UNIX)
# flushrefresh
##############################################################################
# autotools script tests
- # error_test and err_compat are built at the same time as the other tests, but executed by testerror.sh.
- # NOT CONVERTED accum_swmr_reader is used by accum.c.
- # NOT CONVERTED atomic_writer and atomic_reader are standalone programs.
- # links_env is used by testlinks_env.sh
- # filenotclosed and del_many_dense_attrs are used by testabort_fail.sh
- # NOT CONVERTED flushrefresh is used by testflushrefresh.sh.
- # NOT CONVERTED use_append_chunk, use_append_mchunks and use_disable_mdc_flushes are used by test_usecases.sh
- # NOT CONVERTED swmr_* files (besides swmr.c) are used by testswmr.sh.
- # NOT CONVERTED vds_swmr_* files are used by testvdsswmr.sh
+ # error_test and err_compat are built at the same time as the other tests, but executed by test_error.sh
+ # NOT CONVERTED accum_swmr_reader is used by accum.c
+ # NOT CONVERTED atomic_writer and atomic_reader are stand-alone programs
+ # links_env is used by test_links_env.sh
+ # filenotclosed and del_many_dense_attrs are used by test_abort_fail.sh
+ # NOT CONVERTED flushrefresh is used by test_flush_refresh.sh.
+ # NOT CONVERTED use_append_chunk, use_append_mchunks and use_disable_mdc_flushes are used by test_use_cases.sh
+ # NOT CONVERTED swmr_* files (besides swmr.c) are used by test_swmr.sh.
+ # NOT CONVERTED vds_swmr_* files are used by test_vds_swmr.sh
# NOT CONVERTED 'make check' doesn't run them directly, so they are not included in TEST_PROG.
- # NOT CONVERTED Also build testmeta, which is used for timings test. It builds quickly,
+ # NOT CONVERTED Also build testmeta, which is used for timing test. It builds quickly
# NOT CONVERTED and this lets automake keep all its test programs in one place.
##############################################################################
##############################################################################
### S W M R T E S T S
##############################################################################
- # testflushrefresh.sh: flushrefresh
- # test_usecases.sh: use_append_chunk, use_append_mchunks, use_disable_mdc_flushes
- # testswmr.sh: swmr*
- # testvdsswmr.sh: vds_swmr*
- add_test (H5SHELL-testflushrefresh ${SH_PROGRAM} ${HDF5_TEST_BINARY_DIR}/H5TEST/testflushrefresh.sh)
- set_tests_properties (H5SHELL-testflushrefresh PROPERTIES
+ # test_flush_refresh.sh: flushrefresh
+ # test_use_cases.sh: use_append_chunk, use_append_mchunks, use_disable_mdc_flushes
+ # test_swmr.sh: swmr*
+ # test_vds_swmr.sh: vds_swmr*
+ add_test (H5SHELL-test_flush_refresh ${SH_PROGRAM} ${HDF5_TEST_BINARY_DIR}/H5TEST/test_flush_refresh.sh)
+ set_tests_properties (H5SHELL-test_flush_refresh PROPERTIES
ENVIRONMENT "LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH}:${CMAKE_RUNTIME_OUTPUT_DIRECTORY}"
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
)
- add_test (H5SHELL-test_usecases ${SH_PROGRAM} ${HDF5_TEST_BINARY_DIR}/H5TEST/test_usecases.sh)
- set_tests_properties (H5SHELL-test_usecases PROPERTIES
+ add_test (H5SHELL-test_use_cases ${SH_PROGRAM} ${HDF5_TEST_BINARY_DIR}/H5TEST/test_use_cases.sh)
+ set_tests_properties (H5SHELL-test_use_cases PROPERTIES
ENVIRONMENT "LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH}:${CMAKE_RUNTIME_OUTPUT_DIRECTORY}"
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
)
- add_test (H5SHELL-testswmr ${SH_PROGRAM} ${HDF5_TEST_BINARY_DIR}/H5TEST/testswmr.sh)
- set_tests_properties (H5SHELL-testswmr PROPERTIES
+ add_test (H5SHELL-test_swmr ${SH_PROGRAM} ${HDF5_TEST_BINARY_DIR}/H5TEST/test_swmr.sh)
+ set_tests_properties (H5SHELL-test_swmr PROPERTIES
ENVIRONMENT "LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH}:${CMAKE_RUNTIME_OUTPUT_DIRECTORY}"
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
)
- add_test (H5SHELL-testvdsswmr ${SH_PROGRAM} ${HDF5_TEST_BINARY_DIR}/H5TEST/testvdsswmr.sh)
- set_tests_properties (H5SHELL-testvdsswmr PROPERTIES
+ add_test (H5SHELL-test_vds_swmr ${SH_PROGRAM} ${HDF5_TEST_BINARY_DIR}/H5TEST/test_vds_swmr.sh)
+ set_tests_properties (H5SHELL-test_vds_swmr PROPERTIES
ENVIRONMENT "LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH}:${CMAKE_RUNTIME_OUTPUT_DIRECTORY}"
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
)
diff --git a/test/app_ref.c b/test/app_ref.c
index 2777dc0..c4ac60c 100644
--- a/test/app_ref.c
+++ b/test/app_ref.c
@@ -69,8 +69,10 @@ Abrt_Handler(int H5_ATTR_UNUSED sig)
{
int i, n;
+ const char *string = " ID reference count: ";
for (i = 0; i < T_NUMCLASSES; i++) {
- HDfprintf(stderr, "%s ID reference count: %n", IDNAME[i], &n);
+ HDfprintf(stderr, "%s%s", IDNAME[i], string);
+ n = (int)(strlen(IDNAME[i]) + strlen(string));
HDfprintf(stderr, "%*d\n", (n < ERR_WIDTH) ? (ERR_WIDTH - n) : 0, rc[i]);
}
}
diff --git a/test/cache_api.c b/test/cache_api.c
index 2d642a6..6e897ec 100644
--- a/test/cache_api.c
+++ b/test/cache_api.c
@@ -1082,7 +1082,7 @@ mdc_api_call_smoke_check(int express_test, unsigned paged, hid_t fcpl_id)
/* create the dataset */
if (pass) {
- HDsprintf(dset_name, "/dset%03d", i);
+ HDsnprintf(dset_name, sizeof(dset_name), "/dset%03d", i);
dataset_ids[i] = H5Dcreate2(file_id, dset_name, H5T_STD_I32BE, dataspace_id, H5P_DEFAULT,
properties, H5P_DEFAULT);
diff --git a/test/cache_common.c b/test/cache_common.c
index 207daa1..9becfa8 100644
--- a/test/cache_common.c
+++ b/test/cache_common.c
@@ -2317,8 +2317,8 @@ verify_clean(void)
void
verify_entry_status(H5C_t *cache_ptr, int tag, int num_entries, struct expected_entry_status expected[])
{
- static char msg[256];
- int i;
+ char msg[256];
+ int i;
i = 0;
while ((pass) && (i < num_entries)) {
@@ -2330,14 +2330,15 @@ verify_entry_status(H5C_t *cache_ptr, int tag, int num_entries, struct expected_
if ((!expected[i].in_cache) && ((expected[i].is_protected) || (expected[i].is_pinned))) {
pass = FALSE;
- HDsprintf(msg, "%d: Contradictory data in expected[%d].\n", tag, i);
+ HDsnprintf(msg, sizeof(msg), "%d: Contradictory data in expected[%d].\n", tag, i);
failure_mssg = msg;
}
if ((!expected[i].in_cache) && (expected[i].is_dirty) && (!entry_ptr->expunged)) {
pass = FALSE;
- HDsprintf(msg, "%d: expected[%d] specs non-expunged, dirty, non-resident.\n", tag, i);
+ HDsnprintf(msg, sizeof(msg), "%d: expected[%d] specs non-expunged, dirty, non-resident.\n", tag,
+ i);
failure_mssg = msg;
}
@@ -2348,9 +2349,9 @@ verify_entry_status(H5C_t *cache_ptr, int tag, int num_entries, struct expected_
if (in_cache != expected[i].in_cache) {
pass = FALSE;
- HDsprintf(msg, "%d entry (%d, %d) in cache actual/expected = %d/%d.\n", tag,
- (int)expected[i].entry_type, (int)expected[i].entry_index, (int)in_cache,
- (int)expected[i].in_cache);
+ HDsnprintf(msg, sizeof(msg), "%d entry (%d, %d) in cache actual/expected = %d/%d.\n", tag,
+ (int)expected[i].entry_type, (int)expected[i].entry_index, (int)in_cache,
+ (int)expected[i].in_cache);
failure_mssg = msg;
}
}
@@ -2360,9 +2361,9 @@ verify_entry_status(H5C_t *cache_ptr, int tag, int num_entries, struct expected_
if (entry_ptr->size != expected[i].size) {
pass = FALSE;
- HDsprintf(msg, "%d entry (%d, %d) size actual/expected = %ld/%ld.\n", tag,
- (int)expected[i].entry_type, (int)expected[i].entry_index, (long)(entry_ptr->size),
- (long)expected[i].size);
+ HDsnprintf(msg, sizeof(msg), "%d entry (%d, %d) size actual/expected = %ld/%ld.\n", tag,
+ (int)expected[i].entry_type, (int)expected[i].entry_index, (long)(entry_ptr->size),
+ (long)expected[i].size);
failure_mssg = msg;
}
}
@@ -2372,9 +2373,9 @@ verify_entry_status(H5C_t *cache_ptr, int tag, int num_entries, struct expected_
if (entry_ptr->header.size != expected[i].size) {
pass = FALSE;
- HDsprintf(msg, "%d entry (%d, %d) header size actual/expected = %ld/%ld.\n", tag,
- (int)expected[i].entry_type, (int)expected[i].entry_index,
- (long)(entry_ptr->header.size), (long)expected[i].size);
+ HDsnprintf(msg, sizeof(msg), "%d entry (%d, %d) header size actual/expected = %ld/%ld.\n",
+ tag, (int)expected[i].entry_type, (int)expected[i].entry_index,
+ (long)(entry_ptr->header.size), (long)expected[i].size);
failure_mssg = msg;
}
}
@@ -2384,9 +2385,9 @@ verify_entry_status(H5C_t *cache_ptr, int tag, int num_entries, struct expected_
if (entry_ptr->at_main_addr != expected[i].at_main_addr) {
pass = FALSE;
- HDsprintf(msg, "%d entry (%d, %d) at main addr actual/expected = %d/%d.\n", tag,
- (int)expected[i].entry_type, (int)expected[i].entry_index,
- (int)(entry_ptr->at_main_addr), (int)expected[i].at_main_addr);
+ HDsnprintf(msg, sizeof(msg), "%d entry (%d, %d) at main addr actual/expected = %d/%d.\n", tag,
+ (int)expected[i].entry_type, (int)expected[i].entry_index,
+ (int)(entry_ptr->at_main_addr), (int)expected[i].at_main_addr);
failure_mssg = msg;
}
}
@@ -2396,9 +2397,9 @@ verify_entry_status(H5C_t *cache_ptr, int tag, int num_entries, struct expected_
if (entry_ptr->is_dirty != expected[i].is_dirty) {
pass = FALSE;
- HDsprintf(msg, "%d entry (%d, %d) is_dirty actual/expected = %d/%d.\n", tag,
- (int)expected[i].entry_type, (int)expected[i].entry_index,
- (int)(entry_ptr->is_dirty), (int)expected[i].is_dirty);
+ HDsnprintf(msg, sizeof(msg), "%d entry (%d, %d) is_dirty actual/expected = %d/%d.\n", tag,
+ (int)expected[i].entry_type, (int)expected[i].entry_index,
+ (int)(entry_ptr->is_dirty), (int)expected[i].is_dirty);
failure_mssg = msg;
}
}
@@ -2408,9 +2409,9 @@ verify_entry_status(H5C_t *cache_ptr, int tag, int num_entries, struct expected_
if (entry_ptr->header.is_dirty != expected[i].is_dirty) {
pass = FALSE;
- HDsprintf(msg, "%d entry (%d, %d) header is_dirty actual/expected = %d/%d.\n", tag,
- (int)expected[i].entry_type, (int)expected[i].entry_index,
- (int)(entry_ptr->header.is_dirty), (int)expected[i].is_dirty);
+ HDsnprintf(msg, sizeof(msg), "%d entry (%d, %d) header is_dirty actual/expected = %d/%d.\n",
+ tag, (int)expected[i].entry_type, (int)expected[i].entry_index,
+ (int)(entry_ptr->header.is_dirty), (int)expected[i].is_dirty);
failure_mssg = msg;
}
}
@@ -2420,9 +2421,9 @@ verify_entry_status(H5C_t *cache_ptr, int tag, int num_entries, struct expected_
if (entry_ptr->is_protected != expected[i].is_protected) {
pass = FALSE;
- HDsprintf(msg, "%d entry (%d, %d) is_protected actual/expected = %d/%d.\n", tag,
- (int)expected[i].entry_type, (int)expected[i].entry_index,
- (int)(entry_ptr->is_protected), (int)expected[i].is_protected);
+ HDsnprintf(msg, sizeof(msg), "%d entry (%d, %d) is_protected actual/expected = %d/%d.\n", tag,
+ (int)expected[i].entry_type, (int)expected[i].entry_index,
+ (int)(entry_ptr->is_protected), (int)expected[i].is_protected);
failure_mssg = msg;
}
}
@@ -2432,9 +2433,10 @@ verify_entry_status(H5C_t *cache_ptr, int tag, int num_entries, struct expected_
if (entry_ptr->header.is_protected != expected[i].is_protected) {
pass = FALSE;
- HDsprintf(msg, "%d entry (%d, %d) header is_protected actual/expected = %d/%d.\n", tag,
- (int)expected[i].entry_type, (int)expected[i].entry_index,
- (int)(entry_ptr->header.is_protected), (int)expected[i].is_protected);
+ HDsnprintf(msg, sizeof(msg),
+ "%d entry (%d, %d) header is_protected actual/expected = %d/%d.\n", tag,
+ (int)expected[i].entry_type, (int)expected[i].entry_index,
+ (int)(entry_ptr->header.is_protected), (int)expected[i].is_protected);
failure_mssg = msg;
}
}
@@ -2444,9 +2446,9 @@ verify_entry_status(H5C_t *cache_ptr, int tag, int num_entries, struct expected_
if (entry_ptr->is_pinned != expected[i].is_pinned) {
pass = FALSE;
- HDsprintf(msg, "%d entry (%d, %d) is_pinned actual/expected = %d/%d.\n", tag,
- (int)expected[i].entry_type, (int)expected[i].entry_index,
- (int)(entry_ptr->is_pinned), (int)expected[i].is_pinned);
+ HDsnprintf(msg, sizeof(msg), "%d entry (%d, %d) is_pinned actual/expected = %d/%d.\n", tag,
+ (int)expected[i].entry_type, (int)expected[i].entry_index,
+ (int)(entry_ptr->is_pinned), (int)expected[i].is_pinned);
failure_mssg = msg;
}
}
@@ -2456,9 +2458,9 @@ verify_entry_status(H5C_t *cache_ptr, int tag, int num_entries, struct expected_
if (entry_ptr->is_corked != expected[i].is_corked) {
pass = FALSE;
- HDsprintf(msg, "%d entry (%d, %d) is_corked actual/expected = %d/%d.\n", tag,
- (int)expected[i].entry_type, (int)expected[i].entry_index,
- (int)(entry_ptr->is_corked), (int)expected[i].is_corked);
+ HDsnprintf(msg, sizeof(msg), "%d entry (%d, %d) is_corked actual/expected = %d/%d.\n", tag,
+ (int)expected[i].entry_type, (int)expected[i].entry_index,
+ (int)(entry_ptr->is_corked), (int)expected[i].is_corked);
failure_mssg = msg;
}
}
@@ -2468,9 +2470,9 @@ verify_entry_status(H5C_t *cache_ptr, int tag, int num_entries, struct expected_
if (entry_ptr->header.is_pinned != expected[i].is_pinned) {
pass = FALSE;
- HDsprintf(msg, "%d entry (%d, %d) header is_pinned actual/expected = %d/%d.\n", tag,
- (int)expected[i].entry_type, (int)expected[i].entry_index,
- (int)(entry_ptr->header.is_pinned), (int)expected[i].is_pinned);
+ HDsnprintf(msg, sizeof(msg), "%d entry (%d, %d) header is_pinned actual/expected = %d/%d.\n",
+ tag, (int)expected[i].entry_type, (int)expected[i].entry_index,
+ (int)(entry_ptr->header.is_pinned), (int)expected[i].is_pinned);
failure_mssg = msg;
}
}
@@ -2482,11 +2484,12 @@ verify_entry_status(H5C_t *cache_ptr, int tag, int num_entries, struct expected_
(entry_ptr->destroyed != expected[i].destroyed)) {
pass = FALSE;
- HDsprintf(msg, "%d entry (%d,%d) deserialized = %d(%d), serialized = %d(%d), dest = %d(%d)\n",
- tag, (int)expected[i].entry_type, (int)expected[i].entry_index,
- (int)(entry_ptr->deserialized), (int)(expected[i].deserialized),
- (int)(entry_ptr->serialized), (int)(expected[i].serialized),
- (int)(entry_ptr->destroyed), (int)(expected[i].destroyed));
+ HDsnprintf(msg, sizeof(msg),
+ "%d entry (%d,%d) deserialized = %d(%d), serialized = %d(%d), dest = %d(%d)\n",
+ tag, (int)expected[i].entry_type, (int)expected[i].entry_index,
+ (int)(entry_ptr->deserialized), (int)(expected[i].deserialized),
+ (int)(entry_ptr->serialized), (int)(expected[i].serialized),
+ (int)(entry_ptr->destroyed), (int)(expected[i].destroyed));
failure_mssg = msg;
}
}
@@ -2497,18 +2500,19 @@ verify_entry_status(H5C_t *cache_ptr, int tag, int num_entries, struct expected_
if (pass) {
if (entry_ptr->flush_dep_npar != expected[i].flush_dep_npar) {
pass = FALSE;
- HDsprintf(msg, "%d entry (%d, %d) flush_dep_npar actual/expected = %u/%u.\n", tag,
- expected[i].entry_type, expected[i].entry_index, entry_ptr->flush_dep_npar,
- expected[i].flush_dep_npar);
+ HDsnprintf(msg, sizeof(msg), "%d entry (%d, %d) flush_dep_npar actual/expected = %u/%u.\n",
+ tag, expected[i].entry_type, expected[i].entry_index, entry_ptr->flush_dep_npar,
+ expected[i].flush_dep_npar);
failure_mssg = msg;
} /* end if */
} /* end if */
if ((pass) && (in_cache)) {
if (entry_ptr->header.flush_dep_nparents != expected[i].flush_dep_npar) {
pass = FALSE;
- HDsprintf(msg, "%d entry (%d, %d) header flush_dep_nparents actual/expected = %u/%u.\n", tag,
- expected[i].entry_type, expected[i].entry_index,
- entry_ptr->header.flush_dep_nparents, expected[i].flush_dep_npar);
+ HDsnprintf(msg, sizeof(msg),
+ "%d entry (%d, %d) header flush_dep_nparents actual/expected = %u/%u.\n", tag,
+ expected[i].entry_type, expected[i].entry_index,
+ entry_ptr->header.flush_dep_nparents, expected[i].flush_dep_npar);
failure_mssg = msg;
} /* end if */
} /* end if */
@@ -2519,9 +2523,10 @@ verify_entry_status(H5C_t *cache_ptr, int tag, int num_entries, struct expected_
for (u = 0; u < entry_ptr->flush_dep_npar; u++) {
if (entry_ptr->flush_dep_par_type[u] != expected[i].flush_dep_par_type[u]) {
pass = FALSE;
- HDsprintf(msg, "%d entry (%d, %d) flush_dep_par_type[%u] actual/expected = %d/%d.\n", tag,
- expected[i].entry_type, expected[i].entry_index, u,
- entry_ptr->flush_dep_par_type[u], expected[i].flush_dep_par_type[u]);
+ HDsnprintf(msg, sizeof(msg),
+ "%d entry (%d, %d) flush_dep_par_type[%u] actual/expected = %d/%d.\n", tag,
+ expected[i].entry_type, expected[i].entry_index, u,
+ entry_ptr->flush_dep_par_type[u], expected[i].flush_dep_par_type[u]);
failure_mssg = msg;
} /* end if */
} /* end for */
@@ -2530,9 +2535,10 @@ verify_entry_status(H5C_t *cache_ptr, int tag, int num_entries, struct expected_
for (u = 0; u < entry_ptr->flush_dep_npar; u++) {
if (entry_ptr->flush_dep_par_idx[u] != expected[i].flush_dep_par_idx[u]) {
pass = FALSE;
- HDsprintf(msg, "%d entry (%d, %d) flush_dep_par_idx[%u] actual/expected = %d/%d.\n", tag,
- expected[i].entry_type, expected[i].entry_index, u,
- entry_ptr->flush_dep_par_idx[u], expected[i].flush_dep_par_idx[u]);
+ HDsnprintf(msg, sizeof(msg),
+ "%d entry (%d, %d) flush_dep_par_idx[%u] actual/expected = %d/%d.\n", tag,
+ expected[i].entry_type, expected[i].entry_index, u,
+ entry_ptr->flush_dep_par_idx[u], expected[i].flush_dep_par_idx[u]);
failure_mssg = msg;
} /* end if */
} /* end for */
@@ -2542,37 +2548,39 @@ verify_entry_status(H5C_t *cache_ptr, int tag, int num_entries, struct expected_
if (pass) {
if (entry_ptr->flush_dep_nchd != expected[i].flush_dep_nchd) {
pass = FALSE;
- HDsprintf(msg, "%d entry (%d, %d) flush_dep_nchd actual/expected = %u/%u.\n", tag,
- expected[i].entry_type, expected[i].entry_index, entry_ptr->flush_dep_nchd,
- expected[i].flush_dep_nchd);
+ HDsnprintf(msg, sizeof(msg), "%d entry (%d, %d) flush_dep_nchd actual/expected = %u/%u.\n",
+ tag, expected[i].entry_type, expected[i].entry_index, entry_ptr->flush_dep_nchd,
+ expected[i].flush_dep_nchd);
failure_mssg = msg;
} /* end if */
} /* end if */
if ((pass) && (in_cache)) {
if (entry_ptr->header.flush_dep_nchildren != expected[i].flush_dep_nchd) {
pass = FALSE;
- HDsprintf(msg, "%d entry (%d, %d) header flush_dep_nchildren actual/expected = %u/%u.\n", tag,
- expected[i].entry_type, expected[i].entry_index,
- entry_ptr->header.flush_dep_nchildren, expected[i].flush_dep_nchd);
+ HDsnprintf(msg, sizeof(msg),
+ "%d entry (%d, %d) header flush_dep_nchildren actual/expected = %u/%u.\n", tag,
+ expected[i].entry_type, expected[i].entry_index,
+ entry_ptr->header.flush_dep_nchildren, expected[i].flush_dep_nchd);
failure_mssg = msg;
} /* end if */
} /* end if */
if (pass) {
if (entry_ptr->flush_dep_ndirty_chd != expected[i].flush_dep_ndirty_chd) {
pass = FALSE;
- HDsprintf(msg, "%d entry (%d, %d) flush_dep_ndirty_chd actual/expected = %u/%u.\n", tag,
- expected[i].entry_type, expected[i].entry_index, entry_ptr->flush_dep_ndirty_chd,
- expected[i].flush_dep_ndirty_chd);
+ HDsnprintf(msg, sizeof(msg),
+ "%d entry (%d, %d) flush_dep_ndirty_chd actual/expected = %u/%u.\n", tag,
+ expected[i].entry_type, expected[i].entry_index, entry_ptr->flush_dep_ndirty_chd,
+ expected[i].flush_dep_ndirty_chd);
failure_mssg = msg;
} /* end if */
} /* end if */
if ((pass) && (in_cache)) {
if (entry_ptr->header.flush_dep_ndirty_children != expected[i].flush_dep_ndirty_chd) {
pass = FALSE;
- HDsprintf(msg,
- "%d entry (%d, %d) header flush_dep_ndirty_children actual/expected = %u/%u.\n",
- tag, expected[i].entry_type, expected[i].entry_index,
- entry_ptr->header.flush_dep_ndirty_children, expected[i].flush_dep_ndirty_chd);
+ HDsnprintf(msg, sizeof(msg),
+ "%d entry (%d, %d) header flush_dep_ndirty_children actual/expected = %u/%u.\n",
+ tag, expected[i].entry_type, expected[i].entry_index,
+ entry_ptr->header.flush_dep_ndirty_children, expected[i].flush_dep_ndirty_chd);
failure_mssg = msg;
} /* end if */
} /* end if */
@@ -2581,9 +2589,9 @@ verify_entry_status(H5C_t *cache_ptr, int tag, int num_entries, struct expected_
if (pass) {
if (expected[i].flush_order >= 0 && entry_ptr->flush_order != (unsigned)expected[i].flush_order) {
pass = FALSE;
- HDsprintf(msg, "%d entry (%d, %d) flush_order actual/expected = %u/%d.\n", tag,
- expected[i].entry_type, expected[i].entry_index, entry_ptr->flush_order,
- expected[i].flush_order);
+ HDsnprintf(msg, sizeof(msg), "%d entry (%d, %d) flush_order actual/expected = %u/%d.\n", tag,
+ expected[i].entry_type, expected[i].entry_index, entry_ptr->flush_order,
+ expected[i].flush_order);
failure_mssg = msg;
} /* end if */
} /* end if */
diff --git a/test/cache_image.c b/test/cache_image.c
index d3961a8..419eb58 100644
--- a/test/cache_image.c
+++ b/test/cache_image.c
@@ -164,7 +164,7 @@ create_datasets(hid_t file_id, int min_dset, int max_dset)
/* create the dataset */
if (pass) {
- HDsprintf(dset_name, "/dset%03d", i);
+ HDsnprintf(dset_name, sizeof(dset_name), "/dset%03d", i);
dataset_ids[i] = H5Dcreate2(file_id, dset_name, H5T_STD_I32BE, dataspace_id, H5P_DEFAULT,
properties, H5P_DEFAULT);
@@ -443,7 +443,7 @@ delete_datasets(hid_t file_id, int min_dset, int max_dset)
i = min_dset;
while ((pass) && (i <= max_dset)) {
- HDsprintf(dset_name, "/dset%03d", i);
+ HDsnprintf(dset_name, sizeof(dset_name), "/dset%03d", i);
if (H5Ldelete(file_id, dset_name, H5P_DEFAULT) < 0) {
@@ -1019,7 +1019,7 @@ verify_datasets(hid_t file_id, int min_dset, int max_dset)
/* open the dataset */
if (pass) {
- HDsprintf(dset_name, "/dset%03d", i);
+ HDsnprintf(dset_name, sizeof(dset_name), "/dset%03d", i);
dataset_ids[i] = H5Dopen2(file_id, dset_name, H5P_DEFAULT);
if (dataset_ids[i] < 0) {
@@ -4624,7 +4624,7 @@ cache_image_smoke_check_5(hbool_t single_file_vfd)
/* 2) Create a process specific group. */
if (pass) {
- HDsprintf(process_group_name, "/process_%d", min_group);
+ HDsnprintf(process_group_name, sizeof(process_group_name), "/process_%d", min_group);
proc_gid = H5Gcreate2(file_id, process_group_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
@@ -4728,7 +4728,7 @@ cache_image_smoke_check_5(hbool_t single_file_vfd)
if (pass) {
max_group++;
- HDsprintf(process_group_name, "/process_%d", max_group);
+ HDsnprintf(process_group_name, sizeof(process_group_name), "/process_%d", max_group);
proc_gid = H5Gcreate2(file_id, process_group_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
@@ -4802,7 +4802,7 @@ cache_image_smoke_check_5(hbool_t single_file_vfd)
/* 11) Validate all the zoos. */
i = min_group;
while (pass && i <= max_group) {
- HDsprintf(process_group_name, "/process_%d", i);
+ HDsnprintf(process_group_name, sizeof(process_group_name), "/process_%d", i);
validate_zoo(file_id, process_group_name, i++);
}
@@ -4854,7 +4854,7 @@ cache_image_smoke_check_5(hbool_t single_file_vfd)
i = min_group;
while ((pass) && (i <= max_group)) {
- HDsprintf(process_group_name, "/process_%d", i);
+ HDsnprintf(process_group_name, sizeof(process_group_name), "/process_%d", i);
validate_zoo(file_id, process_group_name, i++);
}
@@ -4914,7 +4914,7 @@ cache_image_smoke_check_5(hbool_t single_file_vfd)
*/
i = min_group;
while ((pass) && (i <= max_group)) {
- HDsprintf(process_group_name, "/process_%d", i);
+ HDsnprintf(process_group_name, sizeof(process_group_name), "/process_%d", i);
validate_zoo(file_id, process_group_name, i++);
}
diff --git a/test/chunk_info.c b/test/chunk_info.c
index 148c577..2bec42d 100644
--- a/test/chunk_info.c
+++ b/test/chunk_info.c
@@ -421,7 +421,7 @@ verify_idx_nchunks(hid_t dset, hid_t dspace, H5D_chunk_index_t exp_idx_type, hsi
/* Ensure the correct chunk indexing scheme is used */
if (idx_type != exp_idx_type) {
char msg[256];
- HDsprintf(msg, "Should be using %s.\n", index_type_str(idx_type));
+ HDsnprintf(msg, sizeof(msg), "Should be using %s.\n", index_type_str(idx_type));
FAIL_PUTS_ERROR(msg);
}
diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c
index 04a931c..024b6c0 100644
--- a/test/cmpd_dset.c
+++ b/test/cmpd_dset.c
@@ -1766,7 +1766,7 @@ test_pack_ooo(void)
/* Insert the compound members in the random order previously generated */
for (i = 0; i < PACK_NMEMBS; i++) {
- HDsprintf(name, "%05d", i);
+ HDsnprintf(name, sizeof(name), "%05d", i);
if (i == sub_cmpd_order) {
if (H5Tinsert(cmpd, name, (size_t)(4 * order[i]), sub_cmpd) < 0)
PACK_OOO_ERROR
@@ -1799,7 +1799,7 @@ test_pack_ooo(void)
/* Insert the compound members in the random order previously generated */
for (i = 0; i < PACK_NMEMBS; i++) {
- HDsprintf(name, "%05d", i);
+ HDsnprintf(name, sizeof(name), "%05d", i);
if (i == sub_cmpd_order) {
if (H5Tinsert(cmpd, name, (size_t)(4 * order[i]), sub_cmpd) < 0)
PACK_OOO_ERROR
@@ -1834,7 +1834,7 @@ test_pack_ooo(void)
/* Insert the compound members in reverse order, with compound last */
for (i = 0; i < PACK_NMEMBS; i++) {
- HDsprintf(name, "%05d", i);
+ HDsnprintf(name, sizeof(name), "%05d", i);
if (i == PACK_NMEMBS - 1) {
if (H5Tinsert(cmpd, name, (size_t)(4 * (PACK_NMEMBS - i - 1)), sub_cmpd) < 0)
PACK_OOO_ERROR
@@ -1867,7 +1867,7 @@ test_pack_ooo(void)
/* Insert the compound members in reverse order, with compound last */
for (i = 0; i < PACK_NMEMBS; i++) {
- HDsprintf(name, "%05d", i);
+ HDsnprintf(name, sizeof(name), "%05d", i);
if (i == PACK_NMEMBS - 1) {
if (H5Tinsert(cmpd, name, (size_t)(4 * (PACK_NMEMBS - i - 1)), sub_cmpd) < 0)
PACK_OOO_ERROR
@@ -1902,7 +1902,7 @@ test_pack_ooo(void)
/* Insert the compound members in forward order, with compound first */
for (i = 0; i < PACK_NMEMBS; i++) {
- HDsprintf(name, "%05d", i);
+ HDsnprintf(name, sizeof(name), "%05d", i);
if (i == 0) {
if (H5Tinsert(cmpd, name, (size_t)(4 * i), sub_cmpd) < 0)
PACK_OOO_ERROR
@@ -1935,7 +1935,7 @@ test_pack_ooo(void)
/* Insert the compound members in forward order */
for (i = 0; i < PACK_NMEMBS; i++) {
- HDsprintf(name, "%05d", i);
+ HDsnprintf(name, sizeof(name), "%05d", i);
if (i == 0) {
if (H5Tinsert(cmpd, name, (size_t)(4 * i), sub_cmpd) < 0)
PACK_OOO_ERROR
diff --git a/test/del_many_dense_attrs.c b/test/del_many_dense_attrs.c
index cf7f607..78aba3b 100644
--- a/test/del_many_dense_attrs.c
+++ b/test/del_many_dense_attrs.c
@@ -119,7 +119,7 @@ main(void)
/* Create attributes in the group */
for (i = ATTR_COUNT; i >= 0; i--) {
/* Set up the attribute name */
- HDsprintf(aname, "%s%d", basename, i);
+ HDsnprintf(aname, sizeof(aname), "%s%d", basename, i);
/* Create the attribute */
if ((aid = H5Acreate2(gid, aname, tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
@@ -165,7 +165,7 @@ main(void)
/* Delete the attributes */
for (i = 0; i <= ATTR_COUNT; i++) {
/* Set up the attribute name */
- HDsprintf(aname, "%s%d", basename, i);
+ HDsnprintf(aname, sizeof(aname), "%s%d", basename, i);
/* Delete the attribute */
if (H5Adelete(gid, aname) < 0)
diff --git a/test/dsets.c b/test/dsets.c
index 88e3ce0..c24d746 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -8845,7 +8845,7 @@ test_chunk_cache(hid_t fapl)
if ((dsid = H5Dcreate2(fid, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl1)) < 0)
FAIL_STACK_ERROR
- /* Retrieve dapl from dataset, verfiy cache values are the same as on fapl_local */
+ /* Retrieve dapl from dataset, verify cache values are the same as on fapl_local */
if ((dapl2 = H5Dget_access_plist(dsid)) < 0)
FAIL_STACK_ERROR
if (H5Pget_chunk_cache(dapl2, &nslots_4, &nbytes_4, &w0_4) < 0)
@@ -8869,7 +8869,7 @@ test_chunk_cache(hid_t fapl)
if ((dsid = H5Oopen(fid, "dset", dapl1)) < 0)
FAIL_STACK_ERROR
- /* Retrieve dapl from dataset, verfiy cache values are the same as on dapl1 */
+ /* Retrieve dapl from dataset, verify cache values are the same as on dapl1 */
/* Note we rely on the knowledge that H5Pget_chunk_cache retrieves these
* values directly from the dataset structure, and not from a copy of the
* dapl used to open the dataset (which is not preserved).
@@ -8889,7 +8889,7 @@ test_chunk_cache(hid_t fapl)
if ((dsid = H5Dopen2(fid, "dset", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
- /* Retrieve dapl from dataset, verfiy cache values are the same on fapl_local */
+ /* Retrieve dapl from dataset, verify cache values are the same on fapl_local */
if ((dapl2 = H5Dget_access_plist(dsid)) < 0)
FAIL_STACK_ERROR
if (H5Pget_chunk_cache(dapl2, &nslots_4, &nbytes_4, &w0_4) < 0)
diff --git a/test/dt_arith.c b/test/dt_arith.c
index 3180123..993048a 100644
--- a/test/dt_arith.c
+++ b/test/dt_arith.c
@@ -79,7 +79,7 @@ typedef enum dtype_t {
* be allowed to continue (cf. Posix signals) so in order to recover from a
* SIGFPE we run tests that might generate one in a child process.
*/
-#ifdef H5_HAVE_UNISTD_H
+#if defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID)
#define HANDLE_SIGFPE
#endif
diff --git a/test/dtransform.c b/test/dtransform.c
index 9f7e659..1f6d48b 100644
--- a/test/dtransform.c
+++ b/test/dtransform.c
@@ -122,9 +122,8 @@ const int transformData[ROWS][COLS] = {{36, 31, 25, 19, 13, 7, 1, 5, 11, 16, 22,
{ \
TYPE array[ROWS][COLS]; \
const char *f_to_c = "(5/9.0)*(x-32)"; \
- /* utrans is a transform for unsigned types: no negative numbers involved and results are < 255 to \
- * fit into uchar */ \
- const char *utrans = "((x+100)/4)*3"; \
+ /* utrans is a transform for char types: numbers are restricted from -128 to 127, fits into char */ \
+ const char *utrans = "(x/4+25)*3"; \
\
hid_t dataspace, dxpl_id_f_to_c, dxpl_id_utrans, dset, dset_nn, dt_nn; \
H5T_order_t order; \
@@ -211,9 +210,8 @@ const int transformData[ROWS][COLS] = {{36, 31, 25, 19, 13, 7, 1, 5, 11, 16, 22,
{ \
TYPE array[ROWS][COLS]; \
const char *f_to_c = "(5/9.0)*(x-32)"; \
- /* utrans is a transform for unsigned types: no negative numbers involved and results are < 255 to \
- * fit into uchar */ \
- const char *utrans = "((x+100)/4)*3"; \
+ /* utrans is a transform for char types: numbers are restricted from -128 to 127, fits into char */ \
+ const char *utrans = "(x/4+25)*3"; \
\
hid_t dataspace, dxpl_id_f_to_c, dxpl_id_utrans, cparms, memspace, dset_chunk, filespace; \
hsize_t dim[2] = {ROWS, COLS}; \
@@ -314,7 +312,7 @@ main(void)
const char *simple = "(4/2) * ( (2 + 4)/(5 - 2.5))"; /* this equals 4.8 */
const char *polynomial = "(2+x)* ((x-8)/2)";
/* inverses the utrans transform in init_test to get back original array */
- const char *utrans_inv = "(x/3)*4 - 100";
+ const char *utrans_inv = "(x/3 - 25)*4";
if ((file_id = H5Fcreate("dtransform.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR;
@@ -436,9 +434,8 @@ static int
init_test(hid_t file_id)
{
const char *f_to_c = "(5/9.0)*(x-32)";
- /* utrans is a transform for unsigned types: no negative numbers involved and results are < 255 to fit
- * into uchar */
- const char *utrans = "((x+100)/4)*3";
+ /* utrans is a transform for char types: numbers are restricted from -128 to 127, fits into char */
+ const char *utrans = "(x/4+25)*3";
hid_t dataspace = -1;
hid_t dxpl_id_f_to_c = -1;
diff --git a/test/dtypes.c b/test/dtypes.c
index 5a4f2d6..d2064b7 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -2635,7 +2635,7 @@ test_compound_13(void)
HDmemset(&data_out, 0, sizeof(data_out));
for (u = 0; u < COMPOUND13_ARRAY_SIZE + 1; u++)
data_out.x[u] = (unsigned char)u;
- data_out.y = 99.99f;
+ data_out.y = 99.99F;
/* Set latest_format in access property list to enable the latest
* compound datatype format.
@@ -4969,7 +4969,7 @@ test_conv_str_2(void)
} /* end for */
/* Do the conversions */
- HDsprintf(s, "Testing random string conversion speed");
+ HDsnprintf(s, sizeof(s), "Testing random string conversion speed");
HDprintf("%-70s", s);
HDfflush(stdout);
if (H5Tconvert(c_type, f_type, nelmts, buf, NULL, H5P_DEFAULT) < 0)
@@ -5184,14 +5184,14 @@ test_conv_enum_1(void)
buf[u] = HDrand() % 26;
/* Conversions */
- HDsprintf(s, "Testing random enum conversion O(N)");
+ HDsnprintf(s, sizeof(s), "Testing random enum conversion O(N)");
HDprintf("%-70s", s);
HDfflush(stdout);
if (H5Tconvert(t1, t2, nelmts, buf, NULL, H5P_DEFAULT) < 0)
goto error;
PASSED();
- HDsprintf(s, "Testing random enum conversion O(N log N)");
+ HDsnprintf(s, sizeof(s), "Testing random enum conversion O(N log N)");
HDprintf("%-70s", s);
HDfflush(stdout);
if (H5Tconvert(t2, t1, nelmts, buf, NULL, H5P_DEFAULT) < 0)
diff --git a/test/earray.c b/test/earray.c
index 4763d51..7c8dd1f 100644
--- a/test/earray.c
+++ b/test/earray.c
@@ -2543,15 +2543,16 @@ main(void)
/* Test first element in data block */
nelmts = (hsize_t)((hsize_t)1 + cparam.idx_blk_elmts + tparam.sblk_info[sblk].start_idx +
(tparam.sblk_info[sblk].dblk_nelmts * dblk));
- HDsprintf(test_str, "setting first element of array's data block #%llu",
- (unsigned long long)ndblks);
+ HDsnprintf(test_str, sizeof(test_str),
+ "setting first element of array's data block #%llu",
+ (unsigned long long)ndblks);
nerrors += test_set_elmts(fapl, &cparam, &tparam, nelmts, test_str);
/* Test all elements in data block */
nelmts = (hsize_t)(cparam.idx_blk_elmts + tparam.sblk_info[sblk].start_idx +
(tparam.sblk_info[sblk].dblk_nelmts * (dblk + 1)));
- HDsprintf(test_str, "setting all elements of array's data block #%llu",
- (unsigned long long)ndblks);
+ HDsnprintf(test_str, sizeof(test_str), "setting all elements of array's data block #%llu",
+ (unsigned long long)ndblks);
nerrors += test_set_elmts(fapl, &cparam, &tparam, nelmts, test_str);
/* Increment data block being tested */
diff --git a/test/enc_dec_plist.c b/test/enc_dec_plist.c
index 60b229a..0a73273 100644
--- a/test/enc_dec_plist.c
+++ b/test/enc_dec_plist.c
@@ -199,8 +199,8 @@ main(void)
/* Display testing info */
low_string = h5_get_version_string(low);
high_string = h5_get_version_string(high);
- HDsprintf(msg, "Testing ENCODE/DECODE with file version bounds: (%s, %s):", low_string,
- high_string);
+ HDsnprintf(msg, sizeof(msg),
+ "Testing ENCODE/DECODE with file version bounds: (%s, %s):", low_string, high_string);
HDputs(msg);
if (VERBOSE_MED)
diff --git a/test/event_set.c b/test/event_set.c
index 5df49e9..c2a17b1 100644
--- a/test/event_set.c
+++ b/test/event_set.c
@@ -19,8 +19,157 @@
#include "h5test.h"
#include "H5srcdir.h"
+#define EVENT_SET_NUM_CONNECTOR_IDS 2
+
const char *FILENAME[] = {"event_set_1", NULL};
+hid_t connector_ids_g[EVENT_SET_NUM_CONNECTOR_IDS];
+
+herr_t fake_wait_request_wait(void *req, uint64_t timeout, H5VL_request_status_t *status);
+herr_t fake_wait_request_free(void *req);
+
+/* A VOL class struct that describes a VOL class with no
+ * functionality, other than a wait that returns success.
+ */
+static const H5VL_class_t fake_wait_vol_g = {
+ H5VL_VERSION, /* VOL class struct version */
+ ((H5VL_class_value_t)501), /* value */
+ "fake_wait", /* name */
+ 0, /* connector version */
+ 0, /* capability flags */
+ NULL, /* initialize */
+ NULL, /* terminate */
+ {
+ /* info_cls */
+ (size_t)0, /* size */
+ NULL, /* copy */
+ NULL, /* compare */
+ NULL, /* free */
+ NULL, /* to_str */
+ NULL, /* from_str */
+ },
+ {
+ /* wrap_cls */
+ NULL, /* get_object */
+ NULL, /* get_wrap_ctx */
+ NULL, /* wrap_object */
+ NULL, /* unwrap_object */
+ NULL, /* free_wrap_ctx */
+ },
+ {
+ /* attribute_cls */
+ NULL, /* create */
+ NULL, /* open */
+ NULL, /* read */
+ NULL, /* write */
+ NULL, /* get */
+ NULL, /* specific */
+ NULL, /* optional */
+ NULL /* close */
+ },
+ {
+ /* dataset_cls */
+ NULL, /* create */
+ NULL, /* open */
+ NULL, /* read */
+ NULL, /* write */
+ NULL, /* get */
+ NULL, /* specific */
+ NULL, /* optional */
+ NULL /* close */
+ },
+ {
+ /* datatype_cls */
+ NULL, /* commit */
+ NULL, /* open */
+ NULL, /* get */
+ NULL, /* specific */
+ NULL, /* optional */
+ NULL /* close */
+ },
+ {
+ /* file_cls */
+ NULL, /* create */
+ NULL, /* open */
+ NULL, /* get */
+ NULL, /* specific */
+ NULL, /* optional */
+ NULL /* close */
+ },
+ {
+ /* group_cls */
+ NULL, /* create */
+ NULL, /* open */
+ NULL, /* get */
+ NULL, /* specific */
+ NULL, /* optional */
+ NULL /* close */
+ },
+ {
+ /* link_cls */
+ NULL, /* create */
+ NULL, /* copy */
+ NULL, /* move */
+ NULL, /* get */
+ NULL, /* specific */
+ NULL /* optional */
+ },
+ {
+ /* object_cls */
+ NULL, /* open */
+ NULL, /* copy */
+ NULL, /* get */
+ NULL, /* specific */
+ NULL /* optional */
+ },
+ {
+ /* introspect_cls */
+ NULL, /* get_conn_cls */
+ NULL, /* get_cap_flags */
+ NULL, /* opt_query */
+ },
+ {
+ /* request_cls */
+ fake_wait_request_wait, /* wait */
+ NULL, /* notify */
+ NULL, /* cancel */
+ NULL, /* specific */
+ NULL, /* optional */
+ fake_wait_request_free /* free */
+ },
+ {
+ /* blob_cls */
+ NULL, /* put */
+ NULL, /* get */
+ NULL, /* specific */
+ NULL /* optional */
+ },
+ {
+ /* token_cls */
+ NULL, /* cmp */
+ NULL, /* to_str */
+ NULL /* from_str */
+ },
+ NULL /* optional */
+};
+
+herr_t
+fake_wait_request_wait(void H5_ATTR_UNUSED *req, uint64_t H5_ATTR_UNUSED timeout,
+ H5VL_request_status_t *status)
+{
+ /* Set status if requested */
+ if (status)
+ *status = H5VL_REQUEST_STATUS_SUCCEED;
+
+ return 0;
+} /* end H5_daos_req_wait() */
+
+herr_t
+fake_wait_request_free(void H5_ATTR_UNUSED *req)
+{
+ return 0;
+} /* end fake_wait_request_free() */
+
/*-------------------------------------------------------------------------
* Function: test_es_create
*
@@ -159,6 +308,348 @@ error:
}
/*-------------------------------------------------------------------------
+ * Function: test_es_get_requests
+ *
+ * Purpose: Tests getting requests from event set.
+ *
+ * Return: Success: 0
+ * Failure: number of errors
+ *
+ * Programmer: Neil Fortner
+ * Wednesday, November 24, 2021
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+test_es_get_requests(void)
+{
+ hid_t es_id; /* Event set ID */
+ hid_t connector_ids[2]; /* Connector IDs */
+ void * requests[2]; /* Requests */
+ int req_targets[2]; /* Dummy targets for void * requests */
+ size_t count; /* # of events in set */
+ hbool_t op_failed; /* Whether an operation failed (unused) */
+
+ TESTING("event set get requests");
+
+ /* Create an event set */
+ if ((es_id = H5EScreate()) < 0)
+ TEST_ERROR
+
+ /* Get number of requests in event set */
+ count = 3;
+ if (H5ESget_requests(es_id, H5_ITER_NATIVE, NULL, NULL, 0, &count) < 0)
+ TEST_ERROR
+ if (count != 0)
+ TEST_ERROR
+
+ /* Get only connector IDs */
+ count = 3;
+ connector_ids[0] = H5I_INVALID_HID;
+ connector_ids[1] = H5I_INVALID_HID;
+ if (H5ESget_requests(es_id, H5_ITER_NATIVE, connector_ids, NULL, 2, &count) < 0)
+ TEST_ERROR
+ if (count != 0)
+ TEST_ERROR
+ if (connector_ids[0] != H5I_INVALID_HID)
+ TEST_ERROR
+ if (connector_ids[1] != H5I_INVALID_HID)
+ TEST_ERROR
+
+ /* Get only requests */
+ count = 3;
+ requests[0] = NULL;
+ requests[1] = NULL;
+ if (H5ESget_requests(es_id, H5_ITER_NATIVE, NULL, requests, 2, &count) < 0)
+ TEST_ERROR
+ if (count != 0)
+ TEST_ERROR
+ if (requests[0] != NULL)
+ TEST_ERROR
+ if (requests[1] != NULL)
+ TEST_ERROR
+
+ /* Get both */
+ count = 3;
+ connector_ids[0] = H5I_INVALID_HID;
+ connector_ids[1] = H5I_INVALID_HID;
+ requests[0] = NULL;
+ requests[1] = NULL;
+ if (H5ESget_requests(es_id, H5_ITER_NATIVE, connector_ids, requests, 2, &count) < 0)
+ TEST_ERROR
+ if (count != 0)
+ TEST_ERROR
+ if (connector_ids[0] != H5I_INVALID_HID)
+ TEST_ERROR
+ if (connector_ids[1] != H5I_INVALID_HID)
+ TEST_ERROR
+ if (requests[0] != NULL)
+ TEST_ERROR
+ if (requests[1] != NULL)
+ TEST_ERROR
+
+ /* Insert event into event set */
+ if (H5ESinsert_request(es_id, connector_ids_g[0], &req_targets[0]) < 0)
+ TEST_ERROR
+
+ /* Get number of requests in event set */
+ count = 0;
+ if (H5ESget_requests(es_id, H5_ITER_NATIVE, NULL, NULL, 0, &count) < 0)
+ TEST_ERROR
+ if (count != 1)
+ TEST_ERROR
+
+ /* Get only connector IDs */
+ count = 0;
+ connector_ids[0] = H5I_INVALID_HID;
+ connector_ids[1] = H5I_INVALID_HID;
+ if (H5ESget_requests(es_id, H5_ITER_NATIVE, connector_ids, NULL, 2, &count) < 0)
+ TEST_ERROR
+ if (count != 1)
+ TEST_ERROR
+ if (connector_ids[0] != connector_ids_g[0])
+ TEST_ERROR
+ if (connector_ids[1] != H5I_INVALID_HID)
+ TEST_ERROR
+
+ /* Get only requests */
+ count = 0;
+ requests[0] = NULL;
+ requests[1] = NULL;
+ if (H5ESget_requests(es_id, H5_ITER_NATIVE, NULL, requests, 2, &count) < 0)
+ TEST_ERROR
+ if (count != 1)
+ TEST_ERROR
+ if (requests[0] != &req_targets[0])
+ TEST_ERROR
+ if (requests[1] != NULL)
+ TEST_ERROR
+
+ /* Get both */
+ count = 0;
+ connector_ids[0] = H5I_INVALID_HID;
+ connector_ids[1] = H5I_INVALID_HID;
+ requests[0] = NULL;
+ requests[1] = NULL;
+ if (H5ESget_requests(es_id, H5_ITER_NATIVE, connector_ids, requests, 2, &count) < 0)
+ TEST_ERROR
+ if (count != 1)
+ TEST_ERROR
+ if (connector_ids[0] != connector_ids_g[0])
+ TEST_ERROR
+ if (connector_ids[1] != H5I_INVALID_HID)
+ TEST_ERROR
+ if (requests[0] != &req_targets[0])
+ TEST_ERROR
+ if (requests[1] != NULL)
+ TEST_ERROR
+
+ /* Insert second event into event set */
+ if (H5ESinsert_request(es_id, connector_ids_g[1], &req_targets[1]) < 0)
+ TEST_ERROR
+
+ /* Get number of requests in event set */
+ count = 0;
+ if (H5ESget_requests(es_id, H5_ITER_NATIVE, NULL, NULL, 0, &count) < 0)
+ TEST_ERROR
+ if (count != 2)
+ TEST_ERROR
+
+ /* Get only connector IDs */
+ count = 0;
+ connector_ids[0] = H5I_INVALID_HID;
+ connector_ids[1] = H5I_INVALID_HID;
+ if (H5ESget_requests(es_id, H5_ITER_INC, connector_ids, NULL, 2, &count) < 0)
+ TEST_ERROR
+ if (count != 2)
+ TEST_ERROR
+ if (connector_ids[0] != connector_ids_g[0])
+ TEST_ERROR
+ if (connector_ids[1] != connector_ids_g[1])
+ TEST_ERROR
+
+ /* Try with H5_ITER_DEC */
+ count = 0;
+ connector_ids[0] = H5I_INVALID_HID;
+ connector_ids[1] = H5I_INVALID_HID;
+ if (H5ESget_requests(es_id, H5_ITER_DEC, connector_ids, NULL, 2, &count) < 0)
+ TEST_ERROR
+ if (count != 2)
+ TEST_ERROR
+ if (connector_ids[0] != connector_ids_g[1])
+ TEST_ERROR
+ if (connector_ids[1] != connector_ids_g[0])
+ TEST_ERROR
+
+ /* Get only requests */
+ count = 0;
+ requests[0] = NULL;
+ requests[1] = NULL;
+ if (H5ESget_requests(es_id, H5_ITER_INC, NULL, requests, 2, &count) < 0)
+ TEST_ERROR
+ if (count != 2)
+ TEST_ERROR
+ if (requests[0] != &req_targets[0])
+ TEST_ERROR
+ if (requests[1] != &req_targets[1])
+ TEST_ERROR
+
+ /* Try with H5_ITER_DEC */
+ count = 0;
+ requests[0] = NULL;
+ requests[1] = NULL;
+ if (H5ESget_requests(es_id, H5_ITER_DEC, NULL, requests, 2, &count) < 0)
+ TEST_ERROR
+ if (count != 2)
+ TEST_ERROR
+ if (requests[0] != &req_targets[1])
+ TEST_ERROR
+ if (requests[1] != &req_targets[0])
+ TEST_ERROR
+
+ /* Get both */
+ count = 0;
+ connector_ids[0] = H5I_INVALID_HID;
+ connector_ids[1] = H5I_INVALID_HID;
+ requests[0] = NULL;
+ requests[1] = NULL;
+ if (H5ESget_requests(es_id, H5_ITER_INC, connector_ids, requests, 2, &count) < 0)
+ TEST_ERROR
+ if (count != 2)
+ TEST_ERROR
+ if (connector_ids[0] != connector_ids_g[0])
+ TEST_ERROR
+ if (connector_ids[1] != connector_ids_g[1])
+ TEST_ERROR
+ if (requests[0] != &req_targets[0])
+ TEST_ERROR
+ if (requests[1] != &req_targets[1])
+ TEST_ERROR
+
+ /* Try with H5_ITER_DEC */
+ count = 0;
+ connector_ids[0] = H5I_INVALID_HID;
+ connector_ids[1] = H5I_INVALID_HID;
+ requests[0] = NULL;
+ requests[1] = NULL;
+ if (H5ESget_requests(es_id, H5_ITER_DEC, connector_ids, requests, 2, &count) < 0)
+ TEST_ERROR
+ if (count != 2)
+ TEST_ERROR
+ if (connector_ids[0] != connector_ids_g[1])
+ TEST_ERROR
+ if (connector_ids[1] != connector_ids_g[0])
+ TEST_ERROR
+ if (requests[0] != &req_targets[1])
+ TEST_ERROR
+ if (requests[1] != &req_targets[0])
+ TEST_ERROR
+
+ /* Get only first connector ID */
+ count = 0;
+ connector_ids[0] = H5I_INVALID_HID;
+ connector_ids[1] = H5I_INVALID_HID;
+ if (H5ESget_requests(es_id, H5_ITER_INC, connector_ids, NULL, 1, &count) < 0)
+ TEST_ERROR
+ if (count != 2)
+ TEST_ERROR
+ if (connector_ids[0] != connector_ids_g[0])
+ TEST_ERROR
+ if (connector_ids[1] != H5I_INVALID_HID)
+ TEST_ERROR
+
+ /* Try with H5_ITER_DEC */
+ count = 0;
+ connector_ids[0] = H5I_INVALID_HID;
+ connector_ids[1] = H5I_INVALID_HID;
+ if (H5ESget_requests(es_id, H5_ITER_DEC, connector_ids, NULL, 1, &count) < 0)
+ TEST_ERROR
+ if (count != 2)
+ TEST_ERROR
+ if (connector_ids[0] != connector_ids_g[1])
+ TEST_ERROR
+ if (connector_ids[1] != H5I_INVALID_HID)
+ TEST_ERROR
+
+ /* Get only first request */
+ count = 0;
+ requests[0] = NULL;
+ requests[1] = NULL;
+ if (H5ESget_requests(es_id, H5_ITER_INC, NULL, requests, 1, &count) < 0)
+ TEST_ERROR
+ if (count != 2)
+ TEST_ERROR
+ if (requests[0] != &req_targets[0])
+ TEST_ERROR
+ if (requests[1] != NULL)
+ TEST_ERROR
+
+ /* Try with H5_ITER_DEC */
+ count = 0;
+ requests[0] = NULL;
+ requests[1] = NULL;
+ if (H5ESget_requests(es_id, H5_ITER_DEC, NULL, requests, 1, &count) < 0)
+ TEST_ERROR
+ if (count != 2)
+ TEST_ERROR
+ if (requests[0] != &req_targets[1])
+ TEST_ERROR
+ if (requests[1] != NULL)
+ TEST_ERROR
+
+ /* Get only first of both */
+ count = 0;
+ connector_ids[0] = H5I_INVALID_HID;
+ connector_ids[1] = H5I_INVALID_HID;
+ requests[0] = NULL;
+ requests[1] = NULL;
+ if (H5ESget_requests(es_id, H5_ITER_INC, connector_ids, requests, 1, &count) < 0)
+ TEST_ERROR
+ if (connector_ids[0] != connector_ids_g[0])
+ TEST_ERROR
+ if (connector_ids[1] != H5I_INVALID_HID)
+ TEST_ERROR
+ if (requests[0] != &req_targets[0])
+ TEST_ERROR
+ if (requests[1] != NULL)
+ TEST_ERROR
+
+ /* Try with H5_ITER_DEC */
+ count = 0;
+ connector_ids[0] = H5I_INVALID_HID;
+ connector_ids[1] = H5I_INVALID_HID;
+ requests[0] = NULL;
+ requests[1] = NULL;
+ if (H5ESget_requests(es_id, H5_ITER_DEC, connector_ids, requests, 1, &count) < 0)
+ TEST_ERROR
+ if (connector_ids[0] != connector_ids_g[1])
+ TEST_ERROR
+ if (connector_ids[1] != H5I_INVALID_HID)
+ TEST_ERROR
+ if (requests[0] != &req_targets[1])
+ TEST_ERROR
+ if (requests[1] != NULL)
+ TEST_ERROR
+
+ /* Close the event set */
+ if (H5ESwait(es_id, 10000000, &count, &op_failed) < 0)
+ TEST_ERROR
+ if (H5ESclose(es_id) < 0)
+ TEST_ERROR
+
+ PASSED();
+ return 0;
+
+error:
+ H5E_BEGIN_TRY
+ {
+ H5ESclose(es_id);
+ }
+ H5E_END_TRY;
+ return 1;
+}
+
+/*-------------------------------------------------------------------------
* Function: main
*
* Purpose: Tests event sets
@@ -175,27 +666,41 @@ int
main(void)
{
hid_t fapl_id = H5I_INVALID_HID; /* File access property list */
+ int i; /* Local index variable */
int nerrors = 0; /* Error count */
/* Setup */
h5_reset();
fapl_id = h5_fileaccess();
+ /* Register dummy connector IDs */
+ for (i = 0; i < EVENT_SET_NUM_CONNECTOR_IDS; i++)
+ if ((connector_ids_g[i] = H5VLregister_connector(&fake_wait_vol_g, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+
/* Tests */
nerrors += test_es_create();
nerrors += test_es_none();
+ nerrors += test_es_get_requests();
+
+ /* Unregister dummy connectors */
+ for (i = 0; i < EVENT_SET_NUM_CONNECTOR_IDS; i++)
+ if (H5VLunregister_connector(connector_ids_g[i]) < 0)
+ TEST_ERROR
/* Cleanup */
h5_cleanup(FILENAME, fapl_id);
/* Check for any errors */
- if (nerrors) {
- HDputs("***** EVENT SET TESTS FAILED *****");
- HDexit(EXIT_FAILURE);
- } /* end if */
+ if (nerrors)
+ goto error;
/* Report status */
HDputs("All event set tests passed.");
HDexit(EXIT_SUCCESS);
+
+error:
+ HDputs("***** EVENT SET TESTS FAILED *****");
+ HDexit(EXIT_FAILURE);
} /* end main() */
diff --git a/test/external.c b/test/external.c
index 281593c..bb86cde 100644
--- a/test/external.c
+++ b/test/external.c
@@ -166,8 +166,7 @@ test_non_extendible(hid_t file)
if (file_size != (max_size[0] * sizeof(int))) {
H5_FAILED();
HDputs(" Wrong file size.");
- HDprintf(" got: %lu\n ans: %lu\n", (unsigned long)file_size,
- (unsigned long)max_size[0] * sizeof(int));
+ HDprintf(" got: %" PRIuHSIZE "\n ans: %" PRIuHSIZE "\n", file_size, max_size[0] * sizeof(int));
goto error;
}
@@ -890,8 +889,8 @@ test_write_file_set(hid_t fapl)
for (i = 0; i < N_EXT_FILES; i++) {
char name1[64], name2[64];
- HDsprintf(name1, "extern_%dr.raw", i + 1);
- HDsprintf(name2, "extern_%dw.raw", i + 1);
+ HDsnprintf(name1, sizeof(name1), "extern_%dr.raw", i + 1);
+ HDsnprintf(name2, sizeof(name2), "extern_%dw.raw", i + 1);
if (!files_have_same_contents(name1, name2))
FAIL_PUTS_ERROR(" Output differs from expected value.")
} /* end for */
@@ -986,11 +985,11 @@ test_path_absolute(hid_t fapl)
if (NULL == HDgetcwd(cwdpath, sizeof(cwdpath)))
TEST_ERROR
for (i = 0; i < N_EXT_FILES; i++) {
- HDsnprintf(filename, sizeof(filename), "%s%sextern_%dr.raw", cwdpath, H5_DIR_SEPS, (int)i + 1);
+ HDsnprintf(filename, sizeof(filename), "%s%sextern_%zur.raw", cwdpath, H5_DIR_SEPS, i + 1);
#if defined(H5_HAVE_WINDOW_PATH)
/* For windows, test path-absolute case (\dir\file.raw) for the second file */
if (i == 1)
- HDsnprintf(filename, sizeof(filename), "%s%sextern_%dr.raw", cwdpath + 2, H5_DIR_SEPS, i + 1);
+ HDsnprintf(filename, sizeof(filename), "%s%sextern_%zur.raw", cwdpath + 2, H5_DIR_SEPS, i + 1);
#endif
if (H5Pset_external(dcpl, filename, (off_t)(i * GARBAGE_PER_FILE), (hsize_t)sizeof(part)) < 0)
FAIL_STACK_ERROR
diff --git a/test/external_common.c b/test/external_common.c
index c37fd16..3f04260 100644
--- a/test/external_common.c
+++ b/test/external_common.c
@@ -59,9 +59,9 @@ reset_raw_data_files(hbool_t is_env)
/* Open file */
if (is_env)
- HDsprintf(filename, "extern_env_%lur.raw", (unsigned long)i + 1);
+ HDsnprintf(filename, sizeof(filename), "extern_env_%lur.raw", (unsigned long)i + 1);
else
- HDsprintf(filename, "extern_%lur.raw", (unsigned long)i + 1);
+ HDsnprintf(filename, sizeof(filename), "extern_%lur.raw", (unsigned long)i + 1);
if ((fd = HDopen(filename, O_RDWR | O_CREAT | O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0)
goto error;
@@ -96,9 +96,9 @@ reset_raw_data_files(hbool_t is_env)
/* Open file */
if (is_env)
- HDsprintf(filename, "extern_env_%luw.raw", (unsigned long)i + 1);
+ HDsnprintf(filename, sizeof(filename), "extern_env_%luw.raw", (unsigned long)i + 1);
else
- HDsprintf(filename, "extern_%luw.raw", (unsigned long)i + 1);
+ HDsnprintf(filename, sizeof(filename), "extern_%luw.raw", (unsigned long)i + 1);
if ((fd = HDopen(filename, O_RDWR | O_CREAT | O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0)
goto error;
diff --git a/test/fheap.c b/test/fheap.c
index 5ded20f..b897063 100644
--- a/test/fheap.c
+++ b/test/fheap.c
@@ -466,40 +466,24 @@ error:
return (1);
} /* add_obj() */
-/*-------------------------------------------------------------------------
- * Function: get_del_string
- *
- * Purpose: Return string describing the kind of deletion to perform
- *
- * Return: Success: 0
- *
- * Failure: 1
- *
- * Programmer: Quincey Koziol
- * Monday, June 6, 2006
- *
- *-------------------------------------------------------------------------
- */
-static char *
+/* Return a string describing the kind of deletion to perform. */
+static const char *
get_del_string(const fheap_test_param_t *tparam)
{
- char *str;
-
/* Remove half of total objects from heap */
if (tparam->del_dir == FHEAP_DEL_FORWARD)
if (tparam->drain_half == FHEAP_DEL_DRAIN_ALL)
- str = H5MM_strdup("(all - forward)");
+ return "(all - forward)";
else
- str = H5MM_strdup("(half, refill, all - forward)");
+ return "(half, refill, all - forward)";
else if (tparam->del_dir == FHEAP_DEL_REVERSE)
if (tparam->drain_half == FHEAP_DEL_DRAIN_ALL)
- str = H5MM_strdup("(all - reverse)");
+ return "(all - reverse)";
else
- str = H5MM_strdup("(half, refill, all - reverse)");
+ return "(half, refill, all - reverse)";
else
- str = H5MM_strdup("(all - deleting heap)");
+ return "(all - deleting heap)";
- return (str);
} /* get_del_string() */
/*-------------------------------------------------------------------------
@@ -547,28 +531,20 @@ get_fill_size(const fheap_test_param_t *tparam)
*
*-------------------------------------------------------------------------
*/
-/* Disable warning for "format not a string literal" here -QAK */
-/*
- * This pragma only needs to surround the snprintf() calls with
- * test_desc in the code below, but early (4.4.7, at least) gcc only
- * allows diagnostic pragmas to be toggled outside of functions.
- */
-H5_GCC_CLANG_DIAG_OFF("format-nonliteral")
static int
begin_test(fheap_test_param_t *tparam, const char *base_desc, fheap_heap_ids_t *keep_ids, size_t *fill_size)
{
- char *del_str = NULL; /* Deletion order description */
- char *test_desc = NULL; /* Test description */
+ char * test_desc; /* Test description */
+ const char *del_str = get_del_string(tparam);
/*
* Test filling & removing all (small) objects from root direct block of absolute heap
*/
- del_str = get_del_string(tparam);
- HDassert(del_str);
- test_desc = (char *)H5MM_malloc(HDstrlen(del_str) + HDstrlen(base_desc));
- HDsprintf(test_desc, base_desc, del_str);
+ size_t test_desc_len = strlen(base_desc) + sizeof(" ") + strlen(del_str);
+ test_desc = H5MM_malloc(test_desc_len);
+ (void)HDsnprintf(test_desc, test_desc_len, "%s %s", base_desc, del_str);
+
TESTING(test_desc);
- H5MM_xfree(del_str);
H5MM_xfree(test_desc);
/* Initialize the heap ID structure */
@@ -581,7 +557,6 @@ begin_test(fheap_test_param_t *tparam, const char *base_desc, fheap_heap_ids_t *
/* Success */
return (0);
} /* end begin_test() */
-H5_GCC_CLANG_DIAG_ON("format-nonliteral")
/*-------------------------------------------------------------------------
* Function: reopen_file
@@ -7769,7 +7744,7 @@ test_man_remove_root_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_
size_t fill_size; /* Size of objects for "bulk" filled blocks */
fheap_heap_state_t state; /* State of fractal heap */
/* Test description */
- const char *base_desc = "removing all objects from root direct block of absolute heap %s";
+ const char *base_desc = "removing all objects from root direct block of absolute heap";
/* Perform common test initialization operations */
if (begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
@@ -7842,7 +7817,7 @@ test_man_remove_two_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t
size_t fill_size; /* Size of objects for "bulk" filled blocks */
fheap_heap_state_t state; /* State of fractal heap */
/* Test description */
- const char *base_desc = "removing all objects from two direct blocks of absolute heap %s";
+ const char *base_desc = "removing all objects from two direct blocks of absolute heap";
/* Perform common test initialization operations */
if (begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
@@ -7930,7 +7905,7 @@ test_man_remove_first_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t
size_t fill_size; /* Size of objects for "bulk" filled blocks */
fheap_heap_state_t state; /* State of fractal heap */
/* Test description */
- const char *base_desc = "removing all objects from first row of direct blocks of absolute heap %s";
+ const char *base_desc = "removing all objects from first row of direct blocks of absolute heap";
/* Perform common test initialization operations */
if (begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
@@ -8000,7 +7975,7 @@ test_man_remove_first_two_rows(hid_t fapl, H5HF_create_t *cparam, fheap_test_par
size_t fill_size; /* Size of objects for "bulk" filled blocks */
fheap_heap_state_t state; /* State of fractal heap */
/* Test description */
- const char *base_desc = "removing all objects from first two rows of direct blocks of absolute heap %s";
+ const char *base_desc = "removing all objects from first two rows of direct blocks of absolute heap";
/* Perform common test initialization operations */
if (begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
@@ -8072,7 +8047,7 @@ test_man_remove_first_four_rows(hid_t fapl, H5HF_create_t *cparam, fheap_test_pa
size_t fill_size; /* Size of objects for "bulk" filled blocks */
fheap_heap_state_t state; /* State of fractal heap */
/* Test description */
- const char *base_desc = "removing all objects from first four rows of direct blocks of absolute heap %s";
+ const char *base_desc = "removing all objects from first four rows of direct blocks of absolute heap";
/* Perform common test initialization operations */
if (begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
@@ -8148,7 +8123,7 @@ test_man_remove_all_root_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_pa
size_t fill_size; /* Size of objects for "bulk" filled blocks */
fheap_heap_state_t state; /* State of fractal heap */
/* Test description */
- const char *base_desc = "removing all objects from all direct blocks of root group in absolute heap %s";
+ const char *base_desc = "removing all objects from all direct blocks of root group in absolute heap";
/* Perform common test initialization operations */
if (begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
@@ -8218,7 +8193,7 @@ test_man_remove_2nd_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_param
size_t fill_size; /* Size of objects for "bulk" filled blocks */
fheap_heap_state_t state; /* State of fractal heap */
/* Test description */
- const char *base_desc = "removing all objects from 2nd level indirect blocks of absolute heap %s";
+ const char *base_desc = "removing all objects from 2nd level indirect blocks of absolute heap";
/* Perform common test initialization operations */
if (begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
@@ -8292,7 +8267,7 @@ test_man_remove_3rd_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_param
size_t fill_size; /* Size of objects for "bulk" filled blocks */
fheap_heap_state_t state; /* State of fractal heap */
/* Test description */
- const char *base_desc = "removing all objects from 3rd level indirect blocks of absolute heap %s";
+ const char *base_desc = "removing all objects from 3rd level indirect blocks of absolute heap";
/* Perform common test initialization operations */
if (begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
@@ -8373,8 +8348,7 @@ test_man_skip_start_block(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t
size_t obj_size; /* Size of object */
fheap_heap_state_t state; /* State of fractal heap */
/* Test description */
- const char *base_desc =
- "inserting object that is too large for starting block, then remove all objects %s";
+ const char *base_desc = "inserting object that is too large for starting block, then remove all objects";
/* Perform common test initialization operations */
if (begin_test(tparam, base_desc, &keep_ids, NULL) < 0)
@@ -8453,7 +8427,7 @@ test_man_skip_start_block_add_back(hid_t fapl, H5HF_create_t *cparam, fheap_test
fheap_heap_state_t state; /* State of fractal heap */
/* Test description */
const char *base_desc =
- "skipping starting block, then adding object back to first block, then remove all objects %s";
+ "skipping starting block, then adding object back to first block, then remove all objects";
/* Perform common test initialization operations */
if (begin_test(tparam, base_desc, &keep_ids, NULL) < 0)
@@ -8553,7 +8527,7 @@ test_man_skip_start_block_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_t
fheap_heap_state_t state; /* State of fractal heap */
/* Test description */
const char *base_desc =
- "skipping starting block, then adding objects to backfill and extend, then remove all objects %s";
+ "skipping starting block, then adding objects to backfill and extend, then remove all objects";
/* Perform common test initialization operations */
if (begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
@@ -8662,7 +8636,7 @@ test_man_skip_2nd_block(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *t
fheap_heap_state_t state; /* State of fractal heap */
/* Test description */
const char *base_desc = "insert object to initial block, then add object too large for starting direct "
- "blocks, then remove all objects %s";
+ "blocks, then remove all objects";
/* Perform common test initialization operations */
if (begin_test(tparam, base_desc, &keep_ids, NULL) < 0)
@@ -8761,7 +8735,7 @@ test_man_skip_2nd_block_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_tes
unsigned v; /* Local index variables */
/* Test description */
const char *base_desc = "insert object to initial block, then add object too large for starting direct "
- "blocks, then backfill and extend, then remove all objects %s";
+ "blocks, then backfill and extend, then remove all objects";
/* Perform common test initialization operations */
if (begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
@@ -8907,7 +8881,7 @@ test_man_fill_one_partial_skip_2nd_block_add_skipped(hid_t fapl, H5HF_create_t *
unsigned u; /* Local index variable */
/* Test description */
const char *base_desc =
- "skipping blocks with indirect root, then backfill and extend, then remove all objects %s";
+ "skipping blocks with indirect root, then backfill and extend, then remove all objects";
/* Perform common test initialization operations */
if (begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
@@ -9072,7 +9046,7 @@ test_man_fill_row_skip_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test
fheap_heap_state_t state; /* State of fractal heap */
/* Test description */
const char *base_desc =
- "filling first row, then skipping rows, then backfill and extend, then remove all objects %s";
+ "filling first row, then skipping rows, then backfill and extend, then remove all objects";
/* Perform common test initialization operations */
if (begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
@@ -9202,7 +9176,7 @@ test_man_skip_direct_skip_indirect_two_rows_add_skipped(hid_t fapl, H5HF_create_
unsigned v; /* Local index variables */
/* Test description */
const char *base_desc = "skipping direct blocks to last row and skipping two rows of root indirect "
- "block, then backfill and extend, then remove all objects %s";
+ "block, then backfill and extend, then remove all objects";
/* Perform common test initialization operations */
if (begin_test(tparam, base_desc, &keep_ids, NULL) < 0)
@@ -9328,7 +9302,7 @@ test_man_fill_direct_skip_indirect_start_block_add_skipped(hid_t fapl, H5HF_crea
fheap_heap_state_t state; /* State of fractal heap */
/* Test description */
const char *base_desc = "filling direct blocks and skipping blocks in non-root indirect block, then "
- "backfill and extend, then remove all objects %s";
+ "backfill and extend, then remove all objects";
/* Perform common test initialization operations */
if (begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
@@ -9457,7 +9431,7 @@ test_man_fill_direct_skip_2nd_indirect_start_block_add_skipped(hid_t fapl, H5HF_
unsigned u; /* Local index variable */
/* Test description */
const char *base_desc = "filling direct blocks and skipping row of non-root indirect blocks, then "
- "backfill and extend, then remove all objects %s";
+ "backfill and extend, then remove all objects";
/* Perform common test initialization operations */
if (begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
@@ -9589,7 +9563,7 @@ test_man_fill_2nd_direct_less_one_wrap_start_block_add_skipped(hid_t fapl, H5HF_
/* Test description */
const char *base_desc =
"filling direct blocks, filling 2nd level indirect blocks, except last one, and insert object too "
- "large for 2nd level indirect blocks, then backfill and extend, then remove all objects %s";
+ "large for 2nd level indirect blocks, then backfill and extend, then remove all objects";
/* Perform common test initialization operations */
if (begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
@@ -9735,7 +9709,7 @@ test_man_fill_direct_skip_2nd_indirect_skip_2nd_block_add_skipped(hid_t fapl, H5
unsigned u; /* Local index variable */
/* Test description */
const char *base_desc = "filling direct blocks and skipping row of non-root indirect blocks, then skip "
- "row of direct blocks, then backfill and extend, then remove all objects %s";
+ "row of direct blocks, then backfill and extend, then remove all objects";
/* Perform common test initialization operations */
if (begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
@@ -9898,7 +9872,7 @@ test_man_fill_direct_skip_indirect_two_rows_add_skipped(hid_t fapl, H5HF_create_
unsigned u, v; /* Local index variables */
/* Test description */
const char *base_desc = "filling direct blocks and skipping two rows of root indirect block, then "
- "backfill and extend, then remove all objects %s";
+ "backfill and extend, then remove all objects";
/* Perform common test initialization operations */
if (begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
@@ -10055,7 +10029,7 @@ test_man_fill_direct_skip_indirect_two_rows_skip_indirect_row_add_skipped(hid_t
/* Test description */
const char *base_desc =
"filling direct blocks and skipping two rows of root indirect block, skip one row of root indirect "
- "block, then backfill and extend, then remove all objects %s";
+ "block, then backfill and extend, then remove all objects";
/* Perform common test initialization operations */
if (begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
@@ -10235,7 +10209,7 @@ test_man_fill_2nd_direct_skip_start_block_add_skipped(hid_t fapl, H5HF_create_t
/* Test description */
const char *base_desc =
"filling direct blocks, filling 2nd level indirect blocks, and skip first rows of direct blocks of "
- "3rd level indirect block, then backfill and extend, then remove all objects %s";
+ "3rd level indirect block, then backfill and extend, then remove all objects";
/* Perform common test initialization operations */
if (begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
@@ -10367,7 +10341,7 @@ test_man_fill_2nd_direct_skip_2nd_indirect_start_block_add_skipped(hid_t fapl, H
const char *base_desc =
"filling direct blocks, filling 2nd level indirect blocks, filling 3rd level indirect block's direct "
"blocks, and skip first rows of direct blocks of 3rd level indirect block's 2nd level indirect "
- "block, then backfill and extend, then remove all objects %s";
+ "block, then backfill and extend, then remove all objects";
/* Perform common test initialization operations */
if (begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
@@ -10511,7 +10485,7 @@ test_man_fill_2nd_direct_fill_direct_skip_3rd_indirect_start_block_add_skipped(h
/* Test description */
const char *base_desc = "filling direct blocks, filling 2nd level indirect blocks, filling 3rd level "
"indirect block's direct blocks, and skip first row of indirect blocks of 3rd "
- "level indirect block, then backfill and extend, then remove all objects %s";
+ "level indirect block, then backfill and extend, then remove all objects";
/* Perform common test initialization operations */
if (begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
@@ -10664,7 +10638,7 @@ test_man_fill_2nd_direct_fill_direct_skip2_3rd_indirect_start_block_add_skipped(
/* Test description */
const char *base_desc = "filling direct blocks, filling 2nd level indirect blocks, filling 3rd level "
"indirect block's direct blocks, and skip first two rows of indirect blocks of "
- "3rd level indirect block, then backfill and extend, then remove all objects %s";
+ "3rd level indirect block, then backfill and extend, then remove all objects";
/* Perform common test initialization operations */
if (begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
@@ -10822,7 +10796,7 @@ test_man_fill_3rd_direct_less_one_fill_direct_wrap_start_block_add_skipped(hid_t
const char *base_desc =
"filling direct blocks, filling 2nd level indirect blocks, filling first row of 3rd level indirect "
"blocks, except last one, fill all direct blocks in last 3rd level indirect block, and insert object "
- "too large for it's 2nd level indirect blocks, then backfill and extend, then remove all objects %s";
+ "too large for it's 2nd level indirect blocks, then backfill and extend, then remove all objects";
/* Perform common test initialization operations */
if (begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
@@ -10986,7 +10960,7 @@ test_man_fill_1st_row_3rd_direct_fill_2nd_direct_less_one_wrap_start_block_add_s
"filling direct blocks, filling 2nd level indirect blocks, filling first row of 3rd level indirect "
"blocks, fill all direct blocks in next 3rd level indirect block, fill all 1st row of 2nd level "
"indirect blocks, except last one, and insert object too large for 2nd level indirect block, then "
- "backfill and extend, then remove all objects %s";
+ "backfill and extend, then remove all objects";
/* Perform common test initialization operations */
if (begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
@@ -11154,7 +11128,7 @@ test_man_fill_3rd_direct_fill_direct_skip_start_block_add_skipped(hid_t fapl, H5
const char *base_desc =
"filling direct blocks, filling 2nd level indirect blocks, filling 3rd level indirect blocks, fill "
"4th level indirect block's direct blocks, and skip first row of 2nd indirect blocks of 4th level "
- "indirect block, then backfill and extend, then remove all objects %s";
+ "indirect block, then backfill and extend, then remove all objects";
/* Perform common test initialization operations */
if (begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
@@ -11318,7 +11292,7 @@ test_man_fill_3rd_direct_fill_2nd_direct_fill_direct_skip_3rd_indirect_start_blo
"filling direct blocks, filling 2nd level indirect blocks, filling 3rd level indirect blocks, fill "
"4th level indirect block's direct, 2nd level indirect blocks and 3rd level direct block, and skip "
"first row of 2nd indirect blocks of 4th level indirect block's 3rd level indirect block, then "
- "backfill and extend, then remove all objects %s";
+ "backfill and extend, then remove all objects";
/* Perform common test initialization operations */
if (begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
@@ -11502,7 +11476,7 @@ test_man_fill_3rd_direct_fill_2nd_direct_fill_direct_skip_3rd_indirect_two_rows_
"first row of 4th level indirect blocks, fill 2nd row 4th level indirect block's direct, 2nd level "
"indirect blocks, first row of 3rd level indirect blocks, 3rd level direct block in 2nd row, and "
"skip first row of 2nd indirect blocks of 4th level indirect block's 3rd level indirect block, then "
- "backfill and extend, then remove all objects %s";
+ "backfill and extend, then remove all objects";
/* Perform common test initialization operations */
if (begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
@@ -11721,7 +11695,7 @@ test_man_fill_3rd_direct_fill_2nd_direct_fill_direct_skip_3rd_indirect_wrap_star
"filling direct blocks, filling 2nd level indirect blocks, filling 3rd level indirect blocks, fill "
"first row of 3rd level indirect blocks in 4th level indirect block except last 3rd level block, "
"fill direct blocks in 3rd level block, and skip row of 2nd indirect blocks of 4th level indirect "
- "block's 3rd level indirect block, then backfill and extend, then remove all objects %s";
+ "block's 3rd level indirect block, then backfill and extend, then remove all objects";
/* Perform common test initialization operations */
if (begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
@@ -11922,7 +11896,7 @@ test_man_fill_4th_direct_less_one_fill_2nd_direct_fill_direct_skip_3rd_indirect_
"first row of 4th level indirect blocks, except last one, fill first row of 3rd level indirect "
"blocks in last 4th level indirect block except last 3rd level block, fill direct blocks in 3rd "
"level block, and skip row of 2nd indirect blocks of 4th level indirect block's 3rd level indirect "
- "block, then backfill and extend, then remove all objects %s";
+ "block, then backfill and extend, then remove all objects";
/* Perform common test initialization operations */
if (begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
@@ -12143,7 +12117,7 @@ test_man_frag_simple(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar
fheap_heap_state_t state; /* State of fractal heap */
unsigned u; /* Local index variables */
/* Test description */
- const char *base_desc = "fragmenting small blocks, then backfill and extend, then remove all objects %s";
+ const char *base_desc = "fragmenting small blocks, then backfill and extend, then remove all objects";
/* Perform common test initialization operations */
if (begin_test(tparam, base_desc, &keep_ids, NULL) < 0)
@@ -12275,7 +12249,7 @@ test_man_frag_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar
fheap_heap_state_t state; /* State of fractal heap */
unsigned u, v; /* Local index variables */
/* Test description */
- const char *base_desc = "fragmenting direct blocks, then backfill and extend, then remove all objects %s";
+ const char *base_desc = "fragmenting direct blocks, then backfill and extend, then remove all objects";
/* Perform common test initialization operations */
if (begin_test(tparam, base_desc, &keep_ids, NULL) < 0)
@@ -12449,7 +12423,7 @@ test_man_frag_2nd_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *
unsigned u, v; /* Local index variables */
/* Test description */
const char *base_desc = "fill root direct blocks, then fragment 2nd level indirect block's direct "
- "blocks, then backfill and extend, then remove all objects %s";
+ "blocks, then backfill and extend, then remove all objects";
/* Perform common test initialization operations */
if (begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
@@ -12561,7 +12535,7 @@ test_man_frag_3rd_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *
/* Test description */
const char *base_desc =
"fill root direct blocks and 2nd level indirect blocks, then fragment 3rd level indirect block's "
- "direct blocks, then backfill and extend, then remove all objects %s";
+ "direct blocks, then backfill and extend, then remove all objects";
/* Perform common test initialization operations */
if (begin_test(tparam, base_desc, &keep_ids, &fill_size) < 0)
@@ -12675,7 +12649,7 @@ test_huge_insert_one(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar
unsigned char obj_type; /* Type of storage for object */
fheap_heap_state_t state; /* State of fractal heap */
/* Test description */
- const char *base_desc = "insert one huge object, then remove %s";
+ const char *base_desc = "insert one huge object, then remove";
/* Perform common test initialization operations */
if (begin_test(tparam, base_desc, &keep_ids, NULL) < 0)
@@ -12826,7 +12800,7 @@ test_huge_insert_two(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar
unsigned char obj_type; /* Type of storage for object */
fheap_heap_state_t state; /* State of fractal heap */
/* Test description */
- const char *base_desc = "insert two huge objects, then remove %s";
+ const char *base_desc = "insert two huge objects, then remove";
/* Perform common test initialization operations */
if (begin_test(tparam, base_desc, &keep_ids, NULL) < 0)
@@ -13057,7 +13031,7 @@ test_huge_insert_three(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tp
unsigned char obj_type; /* Type of storage for object */
fheap_heap_state_t state; /* State of fractal heap */
/* Test description */
- const char *base_desc = "insert three huge objects, then remove %s";
+ const char *base_desc = "insert three huge objects, then remove";
/* Perform common test initialization operations */
if (begin_test(tparam, base_desc, &keep_ids, NULL) < 0)
@@ -13364,7 +13338,7 @@ test_huge_insert_mix(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar
unsigned char obj_type; /* Type of storage for object */
fheap_heap_state_t state; /* State of fractal heap */
/* Test description */
- const char *base_desc = "insert mix of normal & huge objects, then remove %s";
+ const char *base_desc = "insert mix of normal & huge objects, then remove";
/* Perform common test initialization operations */
if (begin_test(tparam, base_desc, &keep_ids, NULL) < 0)
@@ -13788,7 +13762,7 @@ test_filtered_huge(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam
hbool_t huge_ids_direct; /* Are 'huge' objects directly accessed? */
hbool_t pline_init = FALSE; /* Whether the I/O pipeline has been initialized */
/* Test description */
- const char *base_desc = "insert 'huge' object into heap with I/O filters, then remove %s";
+ const char *base_desc = "insert 'huge' object into heap with I/O filters, then remove";
/* Copy heap creation properties */
HDmemcpy(&tmp_cparam, cparam, sizeof(H5HF_create_t));
@@ -13996,7 +13970,7 @@ test_tiny_insert_one(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar
unsigned char obj_type; /* Type of storage for object */
fheap_heap_state_t state; /* State of fractal heap */
/* Test description */
- const char *base_desc = "insert one tiny object, then remove %s";
+ const char *base_desc = "insert one tiny object, then remove";
/* Perform common test initialization operations */
if (begin_test(tparam, base_desc, &keep_ids, NULL) < 0)
@@ -14147,7 +14121,7 @@ test_tiny_insert_two(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar
unsigned char obj_type; /* Type of storage for object */
fheap_heap_state_t state; /* State of fractal heap */
/* Test description */
- const char *base_desc = "insert two tiny objects, then remove %s";
+ const char *base_desc = "insert two tiny objects, then remove";
/* Perform common test initialization operations */
if (begin_test(tparam, base_desc, &keep_ids, NULL) < 0)
@@ -14383,7 +14357,7 @@ test_tiny_insert_mix(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar
unsigned char obj_type; /* Type of storage for object */
fheap_heap_state_t state; /* State of fractal heap */
/* Test description */
- const char *base_desc = "insert mix of normal, huge & tiny objects, then remove %s";
+ const char *base_desc = "insert mix of normal, huge & tiny objects, then remove";
/* Perform common test initialization operations */
if (begin_test(tparam, base_desc, &keep_ids, NULL) < 0)
@@ -14984,7 +14958,7 @@ test_filtered_man_root_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_para
fheap_heap_state_t state; /* State of fractal heap */
unsigned deflate_level; /* Deflation level */
/* Test description */
- const char *base_desc = "insert one 'managed' object into heap with I/O filters, then remove %s";
+ const char *base_desc = "insert one 'managed' object into heap with I/O filters, then remove";
/* Copy heap creation properties */
HDmemcpy(&tmp_cparam, cparam, sizeof(H5HF_create_t));
@@ -15158,7 +15132,7 @@ test_filtered_man_root_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_pa
fheap_heap_state_t state; /* State of fractal heap */
unsigned deflate_level; /* Deflation level */
/* Test description */
- const char *base_desc = "insert two 'managed' objects into heap with I/O filters, then remove %s";
+ const char *base_desc = "insert two 'managed' objects into heap with I/O filters, then remove";
/* Copy heap creation properties */
HDmemcpy(&tmp_cparam, cparam, sizeof(H5HF_create_t));
diff --git a/test/filter_plugin.c b/test/filter_plugin.c
index c373b3b..dd61a43 100644
--- a/test/filter_plugin.c
+++ b/test/filter_plugin.c
@@ -968,16 +968,6 @@ test_path_api_calls(void)
*/
n_starting_paths = 42;
- /* Check that initialization is correct */
- TESTING(" initialize");
-
- if (H5PLsize(&n_paths) < 0)
- TEST_ERROR;
- if (n_paths != 2)
- TEST_ERROR;
-
- PASSED();
-
/****************/
/* H5PLremove() */
/****************/
diff --git a/test/flush1.c b/test/flush1.c
index f5c4e2b..0ddceb6 100644
--- a/test/flush1.c
+++ b/test/flush1.c
@@ -81,7 +81,7 @@ create_file(const char *filename, hid_t fapl_id, hbool_t swmr)
if ((top_gid = H5Gcreate2(fid, "top_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
STACK_ERROR
for (i = 0; i < NGROUPS; i++) {
- HDsprintf(group_name, "group%02d", i);
+ HDsnprintf(group_name, sizeof(group_name), "group%02d", i);
if ((gid = H5Gcreate2(top_gid, group_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
STACK_ERROR
if (H5Gclose(gid) < 0)
diff --git a/test/flush2.c b/test/flush2.c
index bf1187b..b6c7761 100644
--- a/test/flush2.c
+++ b/test/flush2.c
@@ -144,7 +144,7 @@ file_ok(const char *filename, hid_t fapl_id, hbool_t check_second_dset)
if ((top_gid = H5Gopen2(fid, "top_group", H5P_DEFAULT)) < 0)
goto error;
for (i = 0; i < NGROUPS; i++) {
- HDsprintf(group_name, "group%02d", i);
+ HDsnprintf(group_name, sizeof(group_name), "group%02d", i);
if ((gid = H5Gopen2(top_gid, group_name, H5P_DEFAULT)) < 0)
goto error;
if (H5Gclose(gid) < 0)
diff --git a/test/flushrefresh.c b/test/flushrefresh.c
index 2757bbf..0c10238 100644
--- a/test/flushrefresh.c
+++ b/test/flushrefresh.c
@@ -93,7 +93,7 @@ FILE *errorfile;
/* ===================== */
/* Main */
-int main(int argc, const char *argv[]);
+int main(int argc, char *argv[]);
/* Flush Test Framework */
herr_t test_flush(void);
@@ -137,7 +137,7 @@ herr_t end_verification(void);
*-------------------------------------------------------------------------
*/
int
-main(int argc, const char *argv[])
+main(int argc, char *argv[])
{
/* Variables */
const char *envval = NULL;
diff --git a/test/genall5.c b/test/genall5.c
index f3b0e6a..ca96eeb 100644
--- a/test/genall5.c
+++ b/test/genall5.c
@@ -306,7 +306,7 @@ ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks)
while ((pass) && (u < nlinks)) {
char linkname[16];
- HDsprintf(linkname, "%u", u);
+ HDsnprintf(linkname, sizeof(linkname), "%u", u);
if (0 == (u % 3)) {
ret = H5Lcreate_soft(group_name, gid, linkname, H5P_DEFAULT, H5P_DEFAULT);
@@ -474,7 +474,7 @@ vrfy_ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks)
char linkname[16];
htri_t link_exists;
- HDsprintf(linkname, "%u", u);
+ HDsnprintf(linkname, sizeof(linkname), "%u", u);
link_exists = H5Lexists(gid, linkname, H5P_DEFAULT);
if (link_exists < 0) {
@@ -715,7 +715,7 @@ ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks)
while ((pass) && (u < nlinks)) {
char linkname[16];
- HDsprintf(linkname, "%u", u);
+ HDsnprintf(linkname, sizeof(linkname), "%u", u);
if (0 == (u % 3)) {
ret = H5Lcreate_soft(group_name, gid, linkname, H5P_DEFAULT, H5P_DEFAULT);
@@ -883,7 +883,7 @@ vrfy_ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks)
char linkname[16];
htri_t link_exists;
- HDsprintf(linkname, "%u", u);
+ HDsnprintf(linkname, sizeof(linkname), "%u", u);
link_exists = H5Lexists(gid, linkname, H5P_DEFAULT);
if (link_exists < 0) {
@@ -1321,7 +1321,7 @@ os_grp_n(hid_t fid, const char *group_name, int proc_num, unsigned nlinks)
while ((pass) && (u < nlinks)) {
char linkname[32];
- HDsprintf(linkname, "ln%d_%u", proc_num, u);
+ HDsnprintf(linkname, sizeof(linkname), "ln%d_%u", proc_num, u);
if (0 == (u % 2)) {
ret = H5Lcreate_soft(group_name, gid, linkname, H5P_DEFAULT, H5P_DEFAULT);
@@ -1479,7 +1479,7 @@ vrfy_os_grp_n(hid_t fid, const char *group_name, int proc_num, unsigned nlinks)
char linkname[32];
htri_t link_exists;
- HDsprintf(linkname, "ln%d_%u", proc_num, u);
+ HDsnprintf(linkname, sizeof(linkname), "ln%d_%u", proc_num, u);
link_exists = H5Lexists(gid, linkname, H5P_DEFAULT);
if (link_exists < 0) {
@@ -3056,26 +3056,26 @@ create_zoo(hid_t fid, const char *base_path, int proc_num)
/* Add & verify an empty "new style" group */
if (pass) {
- HDsprintf(full_path, "%s/A", base_path);
+ HDsnprintf(full_path, sizeof(full_path), "%s/A", base_path);
HDassert(HDstrlen(full_path) < 1024);
ns_grp_0(fid, full_path);
}
if (pass) {
- HDsprintf(full_path, "%s/A", base_path);
+ HDsnprintf(full_path, sizeof(full_path), "%s/A", base_path);
HDassert(HDstrlen(full_path) < 1024);
vrfy_ns_grp_0(fid, full_path);
}
/* Add & verify a compact "new style" group (3 link messages) */
if (pass) {
- HDsprintf(full_path, "%s/B", base_path);
+ HDsnprintf(full_path, sizeof(full_path), "%s/B", base_path);
HDassert(HDstrlen(full_path) < 1024);
ns_grp_c(fid, full_path, 3);
}
if (pass) {
- HDsprintf(full_path, "%s/B", base_path);
+ HDsnprintf(full_path, sizeof(full_path), "%s/B", base_path);
HDassert(HDstrlen(full_path) < 1024);
vrfy_ns_grp_c(fid, full_path, 3);
}
@@ -3084,26 +3084,26 @@ create_zoo(hid_t fid, const char *base_path, int proc_num)
* fractal heap)
*/
if (pass) {
- HDsprintf(full_path, "%s/C", base_path);
+ HDsnprintf(full_path, sizeof(full_path), "%s/C", base_path);
HDassert(HDstrlen(full_path) < 1024);
ns_grp_d(fid, full_path, 300);
}
if (pass) {
- HDsprintf(full_path, "%s/C", base_path);
+ HDsnprintf(full_path, sizeof(full_path), "%s/C", base_path);
HDassert(HDstrlen(full_path) < 1024);
vrfy_ns_grp_d(fid, full_path, 300);
}
/* Add & verify an empty "old style" group to file */
if (pass) {
- HDsprintf(full_path, "%s/D", base_path);
+ HDsnprintf(full_path, sizeof(full_path), "%s/D", base_path);
HDassert(HDstrlen(full_path) < 1024);
os_grp_0(fid, full_path);
}
if (pass) {
- HDsprintf(full_path, "%s/D", base_path);
+ HDsnprintf(full_path, sizeof(full_path), "%s/D", base_path);
HDassert(HDstrlen(full_path) < 1024);
vrfy_os_grp_0(fid, full_path);
}
@@ -3112,13 +3112,13 @@ create_zoo(hid_t fid, const char *base_path, int proc_num)
* local heap) to file
*/
if (pass) {
- HDsprintf(full_path, "%s/E", base_path);
+ HDsnprintf(full_path, sizeof(full_path), "%s/E", base_path);
HDassert(HDstrlen(full_path) < 1024);
os_grp_n(fid, full_path, proc_num, 300);
}
if (pass) {
- HDsprintf(full_path, "%s/E", base_path);
+ HDsnprintf(full_path, sizeof(full_path), "%s/E", base_path);
HDassert(HDstrlen(full_path) < 1024);
vrfy_os_grp_n(fid, full_path, proc_num, 300);
}
@@ -3127,13 +3127,13 @@ create_zoo(hid_t fid, const char *base_path, int proc_num)
* to file
*/
if (pass) {
- HDsprintf(full_path, "%s/F", base_path);
+ HDsnprintf(full_path, sizeof(full_path), "%s/F", base_path);
HDassert(HDstrlen(full_path) < 1024);
ds_ctg_i(fid, full_path, FALSE);
}
if (pass) {
- HDsprintf(full_path, "%s/F", base_path);
+ HDsnprintf(full_path, sizeof(full_path), "%s/F", base_path);
HDassert(HDstrlen(full_path) < 1024);
vrfy_ds_ctg_i(fid, full_path, FALSE);
}
@@ -3142,13 +3142,13 @@ create_zoo(hid_t fid, const char *base_path, int proc_num)
* to file
*/
if (pass) {
- HDsprintf(full_path, "%s/G", base_path);
+ HDsnprintf(full_path, sizeof(full_path), "%s/G", base_path);
HDassert(HDstrlen(full_path) < 1024);
ds_ctg_i(fid, full_path, TRUE);
}
if (pass) {
- HDsprintf(full_path, "%s/G", base_path);
+ HDsnprintf(full_path, sizeof(full_path), "%s/G", base_path);
HDassert(HDstrlen(full_path) < 1024);
vrfy_ds_ctg_i(fid, full_path, TRUE);
}
@@ -3157,13 +3157,13 @@ create_zoo(hid_t fid, const char *base_path, int proc_num)
* to file
*/
if (pass) {
- HDsprintf(full_path, "%s/H", base_path);
+ HDsnprintf(full_path, sizeof(full_path), "%s/H", base_path);
HDassert(HDstrlen(full_path) < 1024);
ds_chk_i(fid, full_path, FALSE);
}
if (pass) {
- HDsprintf(full_path, "%s/H", base_path);
+ HDsnprintf(full_path, sizeof(full_path), "%s/H", base_path);
HDassert(HDstrlen(full_path) < 1024);
vrfy_ds_chk_i(fid, full_path, FALSE);
}
@@ -3172,13 +3172,13 @@ create_zoo(hid_t fid, const char *base_path, int proc_num)
* to file
*/
if (pass) {
- HDsprintf(full_path, "%s/I", base_path);
+ HDsnprintf(full_path, sizeof(full_path), "%s/I", base_path);
HDassert(HDstrlen(full_path) < 1024);
ds_chk_i(fid, full_path, TRUE);
}
if (pass) {
- HDsprintf(full_path, "%s/I", base_path);
+ HDsnprintf(full_path, sizeof(full_path), "%s/I", base_path);
HDassert(HDstrlen(full_path) < 1024);
vrfy_ds_chk_i(fid, full_path, TRUE);
}
@@ -3187,13 +3187,13 @@ create_zoo(hid_t fid, const char *base_path, int proc_num)
* to file
*/
if (pass) {
- HDsprintf(full_path, "%s/J", base_path);
+ HDsnprintf(full_path, sizeof(full_path), "%s/J", base_path);
HDassert(HDstrlen(full_path) < 1024);
ds_cpt_i(fid, full_path, FALSE);
}
if (pass) {
- HDsprintf(full_path, "%s/J", base_path);
+ HDsnprintf(full_path, sizeof(full_path), "%s/J", base_path);
HDassert(HDstrlen(full_path) < 1024);
vrfy_ds_cpt_i(fid, full_path, FALSE);
}
@@ -3202,13 +3202,13 @@ create_zoo(hid_t fid, const char *base_path, int proc_num)
* to file
*/
if (pass) {
- HDsprintf(full_path, "%s/K", base_path);
+ HDsnprintf(full_path, sizeof(full_path), "%s/K", base_path);
HDassert(HDstrlen(full_path) < 1024);
ds_cpt_i(fid, full_path, TRUE);
}
if (pass) {
- HDsprintf(full_path, "%s/K", base_path);
+ HDsnprintf(full_path, sizeof(full_path), "%s/K", base_path);
HDassert(HDstrlen(full_path) < 1024);
vrfy_ds_cpt_i(fid, full_path, TRUE);
}
@@ -3217,13 +3217,13 @@ create_zoo(hid_t fid, const char *base_path, int proc_num)
* (but no data) to file
*/
if (pass) {
- HDsprintf(full_path, "%s/L", base_path);
+ HDsnprintf(full_path, sizeof(full_path), "%s/L", base_path);
HDassert(HDstrlen(full_path) < 1024);
ds_ctg_v(fid, full_path, FALSE);
}
if (pass) {
- HDsprintf(full_path, "%s/L", base_path);
+ HDsnprintf(full_path, sizeof(full_path), "%s/L", base_path);
HDassert(HDstrlen(full_path) < 1024);
vrfy_ds_ctg_v(fid, full_path, FALSE);
}
@@ -3232,13 +3232,13 @@ create_zoo(hid_t fid, const char *base_path, int proc_num)
* (and data) to file
*/
if (pass) {
- HDsprintf(full_path, "%s/M", base_path);
+ HDsnprintf(full_path, sizeof(full_path), "%s/M", base_path);
HDassert(HDstrlen(full_path) < 1024);
ds_ctg_v(fid, full_path, TRUE);
}
if (pass) {
- HDsprintf(full_path, "%s/M", base_path);
+ HDsnprintf(full_path, sizeof(full_path), "%s/M", base_path);
HDassert(HDstrlen(full_path) < 1024);
vrfy_ds_ctg_v(fid, full_path, TRUE);
}
@@ -3281,14 +3281,14 @@ validate_zoo(hid_t fid, const char *base_path, int proc_num)
/* validate an empty "new style" group */
if (pass) {
- HDsprintf(full_path, "%s/A", base_path);
+ HDsnprintf(full_path, sizeof(full_path), "%s/A", base_path);
HDassert(HDstrlen(full_path) < 1024);
vrfy_ns_grp_0(fid, full_path);
}
/* validate a compact "new style" group (3 link messages) */
if (pass) {
- HDsprintf(full_path, "%s/B", base_path);
+ HDsnprintf(full_path, sizeof(full_path), "%s/B", base_path);
HDassert(HDstrlen(full_path) < 1024);
vrfy_ns_grp_c(fid, full_path, 3);
}
@@ -3297,14 +3297,14 @@ validate_zoo(hid_t fid, const char *base_path, int proc_num)
* fractal heap)
*/
if (pass) {
- HDsprintf(full_path, "%s/C", base_path);
+ HDsnprintf(full_path, sizeof(full_path), "%s/C", base_path);
HDassert(HDstrlen(full_path) < 1024);
vrfy_ns_grp_d(fid, full_path, 300);
}
/* validate an empty "old style" group in file */
if (pass) {
- HDsprintf(full_path, "%s/D", base_path);
+ HDsnprintf(full_path, sizeof(full_path), "%s/D", base_path);
HDassert(HDstrlen(full_path) < 1024);
vrfy_os_grp_0(fid, full_path);
}
@@ -3313,7 +3313,7 @@ validate_zoo(hid_t fid, const char *base_path, int proc_num)
* local heap)
*/
if (pass) {
- HDsprintf(full_path, "%s/E", base_path);
+ HDsnprintf(full_path, sizeof(full_path), "%s/E", base_path);
HDassert(HDstrlen(full_path) < 1024);
vrfy_os_grp_n(fid, full_path, proc_num, 300);
}
@@ -3322,7 +3322,7 @@ validate_zoo(hid_t fid, const char *base_path, int proc_num)
* in file.
*/
if (pass) {
- HDsprintf(full_path, "%s/F", base_path);
+ HDsnprintf(full_path, sizeof(full_path), "%s/F", base_path);
HDassert(HDstrlen(full_path) < 1024);
vrfy_ds_ctg_i(fid, full_path, FALSE);
}
@@ -3331,7 +3331,7 @@ validate_zoo(hid_t fid, const char *base_path, int proc_num)
* in file.
*/
if (pass) {
- HDsprintf(full_path, "%s/G", base_path);
+ HDsnprintf(full_path, sizeof(full_path), "%s/G", base_path);
HDassert(HDstrlen(full_path) < 1024);
vrfy_ds_ctg_i(fid, full_path, TRUE);
}
@@ -3340,7 +3340,7 @@ validate_zoo(hid_t fid, const char *base_path, int proc_num)
* in file
*/
if (pass) {
- HDsprintf(full_path, "%s/H", base_path);
+ HDsnprintf(full_path, sizeof(full_path), "%s/H", base_path);
HDassert(HDstrlen(full_path) < 1024);
vrfy_ds_chk_i(fid, full_path, FALSE);
}
@@ -3349,7 +3349,7 @@ validate_zoo(hid_t fid, const char *base_path, int proc_num)
* in file
*/
if (pass) {
- HDsprintf(full_path, "%s/I", base_path);
+ HDsnprintf(full_path, sizeof(full_path), "%s/I", base_path);
HDassert(HDstrlen(full_path) < 1024);
vrfy_ds_chk_i(fid, full_path, TRUE);
}
@@ -3358,7 +3358,7 @@ validate_zoo(hid_t fid, const char *base_path, int proc_num)
* in file
*/
if (pass) {
- HDsprintf(full_path, "%s/J", base_path);
+ HDsnprintf(full_path, sizeof(full_path), "%s/J", base_path);
HDassert(HDstrlen(full_path) < 1024);
vrfy_ds_cpt_i(fid, full_path, FALSE);
}
@@ -3367,7 +3367,7 @@ validate_zoo(hid_t fid, const char *base_path, int proc_num)
* in file
*/
if (pass) {
- HDsprintf(full_path, "%s/K", base_path);
+ HDsnprintf(full_path, sizeof(full_path), "%s/K", base_path);
HDassert(HDstrlen(full_path) < 1024);
vrfy_ds_cpt_i(fid, full_path, TRUE);
}
@@ -3376,7 +3376,7 @@ validate_zoo(hid_t fid, const char *base_path, int proc_num)
* (but no data) to file
*/
if (pass) {
- HDsprintf(full_path, "%s/L", base_path);
+ HDsnprintf(full_path, sizeof(full_path), "%s/L", base_path);
HDassert(HDstrlen(full_path) < 1024);
vrfy_ds_ctg_v(fid, full_path, FALSE);
}
@@ -3385,7 +3385,7 @@ validate_zoo(hid_t fid, const char *base_path, int proc_num)
* (and data) to file
*/
if (pass) {
- HDsprintf(full_path, "%s/M", base_path);
+ HDsnprintf(full_path, sizeof(full_path), "%s/M", base_path);
HDassert(HDstrlen(full_path) < 1024);
vrfy_ds_ctg_v(fid, full_path, TRUE);
}
diff --git a/test/h5test.c b/test/h5test.c
index 0528623..ac15043 100644
--- a/test/h5test.c
+++ b/test/h5test.c
@@ -1773,41 +1773,46 @@ dummy_vfd_write(H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UNUSED type, hi
/* Dummy VFD with the minimum parameters to make a VFD that can be registered */
#define DUMMY_VFD_VALUE (H5FD_class_value_t)155
static const H5FD_class_t H5FD_dummy_g = {
- DUMMY_VFD_VALUE, /* value */
- "dummy", /* name */
- 1, /* maxaddr */
- H5F_CLOSE_WEAK, /* fc_degree */
- NULL, /* terminate */
- NULL, /* sb_size */
- NULL, /* sb_encode */
- NULL, /* sb_decode */
- 0, /* fapl_size */
- NULL, /* fapl_get */
- NULL, /* fapl_copy */
- NULL, /* fapl_free */
- 0, /* dxpl_size */
- NULL, /* dxpl_copy */
- NULL, /* dxpl_free */
- dummy_vfd_open, /* open */
- dummy_vfd_close, /* close */
- NULL, /* cmp */
- NULL, /* query */
- NULL, /* get_type_map */
- NULL, /* alloc */
- NULL, /* free */
- dummy_vfd_get_eoa, /* get_eoa */
- dummy_vfd_set_eoa, /* set_eoa */
- dummy_vfd_get_eof, /* get_eof */
- NULL, /* get_handle */
- dummy_vfd_read, /* read */
- dummy_vfd_write, /* write */
- NULL, /* flush */
- NULL, /* truncate */
- NULL, /* lock */
- NULL, /* unlock */
- NULL, /* del */
- NULL, /* ctl */
- H5FD_FLMAP_DICHOTOMY /* fl_map */
+ H5FD_CLASS_VERSION, /* struct version */
+ DUMMY_VFD_VALUE, /* value */
+ "dummy", /* name */
+ 1, /* maxaddr */
+ H5F_CLOSE_WEAK, /* fc_degree */
+ NULL, /* terminate */
+ NULL, /* sb_size */
+ NULL, /* sb_encode */
+ NULL, /* sb_decode */
+ 0, /* fapl_size */
+ NULL, /* fapl_get */
+ NULL, /* fapl_copy */
+ NULL, /* fapl_free */
+ 0, /* dxpl_size */
+ NULL, /* dxpl_copy */
+ NULL, /* dxpl_free */
+ dummy_vfd_open, /* open */
+ dummy_vfd_close, /* close */
+ NULL, /* cmp */
+ NULL, /* query */
+ NULL, /* get_type_map */
+ NULL, /* alloc */
+ NULL, /* free */
+ dummy_vfd_get_eoa, /* get_eoa */
+ dummy_vfd_set_eoa, /* set_eoa */
+ dummy_vfd_get_eof, /* get_eof */
+ NULL, /* get_handle */
+ dummy_vfd_read, /* read */
+ dummy_vfd_write, /* write */
+ NULL, /* read_vector */
+ NULL, /* write_vector */
+ NULL, /* read_selection */
+ NULL, /* write_selection */
+ NULL, /* flush */
+ NULL, /* truncate */
+ NULL, /* lock */
+ NULL, /* unlock */
+ NULL, /* del */
+ NULL, /* ctl */
+ H5FD_FLMAP_DICHOTOMY /* fl_map */
};
/*-------------------------------------------------------------------------
diff --git a/test/links.c b/test/links.c
index 2fead45..658f8d6 100644
--- a/test/links.c
+++ b/test/links.c
@@ -2144,6 +2144,7 @@ cklinks_deprec(hid_t fapl, hbool_t new_format)
char linkval[LINK_BUF_SIZE];
char filename[NAME_BUF_SIZE];
herr_t status;
+ htri_t exists;
if (new_format)
TESTING("link queries using deprecated routines (w/new group format)")
@@ -2183,20 +2184,20 @@ cklinks_deprec(hid_t fapl, hbool_t new_format)
FAIL_STACK_ERROR
H5E_BEGIN_TRY
{
- status = H5Lexists(file, "no_grp1/hard", H5P_DEFAULT);
+ exists = H5Lexists(file, "no_grp1/hard", H5P_DEFAULT);
}
H5E_END_TRY;
- if (status >= 0) {
+ if (exists >= 0) {
H5_FAILED();
HDputs(" H5Lexists() should have failed for a path with missing components.");
TEST_ERROR
} /* end if */
H5E_BEGIN_TRY
{
- status = H5Lexists(file, "/no_grp1/hard", H5P_DEFAULT);
+ exists = H5Lexists(file, "/no_grp1/hard", H5P_DEFAULT);
}
H5E_END_TRY;
- if (status >= 0) {
+ if (exists >= 0) {
H5_FAILED();
HDputs(" H5Lexists() should have failed for a path with missing components.");
TEST_ERROR
diff --git a/test/null_vfd_plugin.c b/test/null_vfd_plugin.c
index f41da00..ca59939 100644
--- a/test/null_vfd_plugin.c
+++ b/test/null_vfd_plugin.c
@@ -35,41 +35,46 @@ static herr_t H5FD_null_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr);
static haddr_t H5FD_null_get_eof(const H5FD_t *_file, H5FD_mem_t type);
static const H5FD_class_t H5FD_null_g = {
- NULL_VFD_VALUE, /* value */
- NULL_VFD_NAME, /* name */
- 1, /* maxaddr */
- H5F_CLOSE_WEAK, /* fc_degree */
- NULL, /* terminate */
- NULL, /* sb_size */
- NULL, /* sb_encode */
- NULL, /* sb_decode */
- 0, /* fapl_size */
- NULL, /* fapl_get */
- NULL, /* fapl_copy */
- NULL, /* fapl_free */
- 0, /* dxpl_size */
- NULL, /* dxpl_copy */
- NULL, /* dxpl_free */
- H5FD_null_open, /* open */
- H5FD_null_close, /* close */
- NULL, /* cmp */
- NULL, /* query */
- NULL, /* get_type_map */
- NULL, /* alloc */
- NULL, /* free */
- H5FD_null_get_eoa, /* get_eoa */
- H5FD_null_set_eoa, /* set_eoa */
- H5FD_null_get_eof, /* get_eof */
- NULL, /* get_handle */
- H5FD_null_read, /* read */
- H5FD_null_write, /* write */
- NULL, /* flush */
- NULL, /* truncate */
- NULL, /* lock */
- NULL, /* unlock */
- NULL, /* del */
- NULL, /* ctl */
- H5FD_FLMAP_DICHOTOMY /* fl_map */
+ H5FD_CLASS_VERSION, /* struct version */
+ NULL_VFD_VALUE, /* value */
+ NULL_VFD_NAME, /* name */
+ 1, /* maxaddr */
+ H5F_CLOSE_WEAK, /* fc_degree */
+ NULL, /* terminate */
+ NULL, /* sb_size */
+ NULL, /* sb_encode */
+ NULL, /* sb_decode */
+ 0, /* fapl_size */
+ NULL, /* fapl_get */
+ NULL, /* fapl_copy */
+ NULL, /* fapl_free */
+ 0, /* dxpl_size */
+ NULL, /* dxpl_copy */
+ NULL, /* dxpl_free */
+ H5FD_null_open, /* open */
+ H5FD_null_close, /* close */
+ NULL, /* cmp */
+ NULL, /* query */
+ NULL, /* get_type_map */
+ NULL, /* alloc */
+ NULL, /* free */
+ H5FD_null_get_eoa, /* get_eoa */
+ H5FD_null_set_eoa, /* set_eoa */
+ H5FD_null_get_eof, /* get_eof */
+ NULL, /* get_handle */
+ H5FD_null_read, /* read */
+ H5FD_null_write, /* write */
+ NULL, /* read_vector */
+ NULL, /* write_vector */
+ NULL, /* read_selection */
+ NULL, /* write_selection */
+ NULL, /* flush */
+ NULL, /* truncate */
+ NULL, /* lock */
+ NULL, /* unlock */
+ NULL, /* del */
+ NULL, /* ctl */
+ H5FD_FLMAP_DICHOTOMY /* fl_map */
};
static H5FD_t *
diff --git a/test/page_buffer.c b/test/page_buffer.c
index c078ce8..558b4e9 100644
--- a/test/page_buffer.c
+++ b/test/page_buffer.c
@@ -120,28 +120,28 @@ create_file(char *filename, hid_t fcpl, hid_t fapl)
for (i = 0; i < NUM_DSETS; i++) {
- HDsprintf(dset_name, "D1dset%d", i);
+ HDsnprintf(dset_name, sizeof(dset_name), "D1dset%d", i);
if ((dset_id = H5Dcreate2(grp_id, dset_name, H5T_NATIVE_INT, filespace, H5P_DEFAULT, dcpl,
H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
if (H5Dclose(dset_id) < 0)
FAIL_STACK_ERROR;
- HDsprintf(dset_name, "D2dset%d", i);
+ HDsnprintf(dset_name, sizeof(dset_name), "D2dset%d", i);
if ((dset_id = H5Dcreate2(grp_id, dset_name, H5T_NATIVE_INT, filespace, H5P_DEFAULT, dcpl,
H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
if (H5Dclose(dset_id) < 0)
FAIL_STACK_ERROR;
- HDsprintf(dset_name, "D3dset%d", i);
+ HDsnprintf(dset_name, sizeof(dset_name), "D3dset%d", i);
if ((dset_id = H5Dcreate2(grp_id, dset_name, H5T_NATIVE_INT, filespace, H5P_DEFAULT, dcpl,
H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
if (H5Dclose(dset_id) < 0)
FAIL_STACK_ERROR;
- HDsprintf(dset_name, "dset%d", i);
+ HDsnprintf(dset_name, sizeof(dset_name), "dset%d", i);
if ((dset_id = H5Dcreate2(grp_id, dset_name, H5T_NATIVE_INT, filespace, H5P_DEFAULT, dcpl,
H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
@@ -166,13 +166,13 @@ create_file(char *filename, hid_t fcpl, hid_t fapl)
}
}
- HDsprintf(dset_name, "D1dset%d", i);
+ HDsnprintf(dset_name, sizeof(dset_name), "D1dset%d", i);
if (H5Ldelete(grp_id, dset_name, H5P_DEFAULT) < 0)
FAIL_STACK_ERROR;
- HDsprintf(dset_name, "D2dset%d", i);
+ HDsnprintf(dset_name, sizeof(dset_name), "D2dset%d", i);
if (H5Ldelete(grp_id, dset_name, H5P_DEFAULT) < 0)
FAIL_STACK_ERROR;
- HDsprintf(dset_name, "D3dset%d", i);
+ HDsnprintf(dset_name, sizeof(dset_name), "D3dset%d", i);
if (H5Ldelete(grp_id, dset_name, H5P_DEFAULT) < 0)
FAIL_STACK_ERROR;
}
@@ -259,7 +259,7 @@ open_file(char *filename, hid_t fapl, hsize_t page_size, size_t page_buffer_size
for (i = 0; i < NUM_DSETS; i++) {
- HDsprintf(dset_name, "dset%d", i);
+ HDsnprintf(dset_name, sizeof(dset_name), "dset%d", i);
if ((dset_id = H5Dopen2(grp_id, dset_name, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
@@ -370,7 +370,7 @@ error:
* 1) verifying that API errors are caught.
*
* 2) verifying that the page buffer behaves more or less
- * as advertized.
+ * as advertised.
*
* Any data mis-matches or unexpected failures or successes
* reported by the HDF5 library result in test failure.
diff --git a/test/pool.c b/test/pool.c
deleted file mode 100644
index c508025..0000000
--- a/test/pool.c
+++ /dev/null
@@ -1,794 +0,0 @@
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * Copyright by The HDF Group. *
- * Copyright by the Board of Trustees of the University of Illinois. *
- * All rights reserved. *
- * *
- * This file is part of HDF5. The full HDF5 copyright notice, including *
- * terms governing use, modification, and redistribution, is contained in *
- * the 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. *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/* Programmer: Quincey Koziol
- * Tuesday, May 3, 2005
- */
-#include "h5test.h"
-
-/*
- * This file needs to access private datatypes from the H5MP package.
- * This file also needs to access the memory pool testing code.
- */
-#define H5MP_FRIEND /*suppress error about including H5MPpkg */
-#define H5MP_TESTING
-#include "H5MPpkg.h" /* Memory Pools */
-
-/* Other private headers that this test requires */
-
-/* Local macros */
-#define MPOOL_PAGE_SIZE H5MP_PAGE_SIZE_DEFAULT
-#define MPOOL_FLAGS H5MP_FLG_DEFAULT
-#define MPOOL_NUM_NORMAL_BLOCKS 15
-#define MPOOL_NORMAL_BLOCK 512
-#define MPOOL_LARGE_BLOCK (MPOOL_PAGE_SIZE * 3)
-#define MPOOL_NUM_SMALL_BLOCKS 64
-#define MPOOL_SMALL_BLOCK 1
-#define MPOOL_NUM_RANDOM (10 * 1024)
-#define MPOOL_RANDOM_MAX_SIZE (MPOOL_PAGE_SIZE * 2)
-
-/*-------------------------------------------------------------------------
- * Function: test_create
- *
- * Purpose: Test trivial creating & closing memory pool
- *
- * Return: Success: 0
- * Failure: 1
- *
- * Programmer: Quincey Koziol
- * Tuesday, May 3, 2005
- *
- *-------------------------------------------------------------------------
- */
-static int
-test_create(void)
-{
- H5MP_pool_t *mp; /* Memory pool */
- H5MP_page_t *page; /* Memory pool page */
- size_t free_size; /* Free size in pool */
-
- /*
- * Test memory pool creation
- */
- TESTING("memory pool creation");
-
- /* Create a memory pool */
- if (NULL == (mp = H5MP_create((size_t)MPOOL_PAGE_SIZE, MPOOL_FLAGS)))
- TEST_ERROR
-
- /* Check free space */
- if (H5MP_get_pool_free_size(mp, &free_size) < 0)
- TEST_ERROR
- if (free_size != 0)
- TEST_ERROR
-
- /* Check first page */
- if (H5MP_get_pool_first_page(mp, &page) < 0)
- TEST_ERROR
- if (page != NULL)
- TEST_ERROR
-
- /* Close the memory pool */
- if (H5MP_close(mp) < 0)
- TEST_ERROR
-
- PASSED();
-
- return 0;
-
-error:
- H5E_BEGIN_TRY
- {
- if (mp)
- H5MP_close(mp);
- }
- H5E_END_TRY;
-
- return 1;
-} /* test_create() */
-
-/*-------------------------------------------------------------------------
- * Function: test_close_one
- *
- * Purpose: Tests closing pool with one block allocated
- *
- * Return: Success: 0
- * Failure: 1
- *
- * Programmer: Quincey Koziol
- * Friday, May 6, 2005
- *
- *-------------------------------------------------------------------------
- */
-static int
-test_close_one(void)
-{
- H5MP_pool_t *mp; /* Memory pool */
-
- /*
- * Test memory pool closing
- */
- TESTING("closing pool with blocks still allocated in one page");
-
- /* Create a memory pool */
- if (NULL == (mp = H5MP_create((size_t)MPOOL_PAGE_SIZE, MPOOL_FLAGS)))
- TEST_ERROR
-
- /* Allocate space in pool */
- if (NULL == H5MP_malloc(mp, (size_t)MPOOL_NORMAL_BLOCK))
- TEST_ERROR
-
- /* Close the memory pool */
- if (H5MP_close(mp) < 0)
- TEST_ERROR
-
- PASSED();
-
- return 0;
-
-error:
- H5E_BEGIN_TRY
- {
- if (mp)
- H5MP_close(mp);
- }
- H5E_END_TRY;
-
- return 1;
-} /* test_close_one() */
-
-/*-------------------------------------------------------------------------
- * Function: test_allocate_first
- *
- * Purpose: Tests allocating first block in pool
- *
- * Return: Success: 0
- * Failure: 1
- *
- * Programmer: Quincey Koziol
- * Tuesday, May 3, 2005
- *
- *-------------------------------------------------------------------------
- */
-static int
-test_allocate_first(void)
-{
- H5MP_pool_t *mp; /* Memory pool */
- H5MP_page_t *page; /* Memory pool page */
- size_t free_size; /* Free size in pool */
- void * spc; /* Pointer to space allocated */
-
- /*
- * Test memory pool allocation
- */
- TESTING("allocating first block in pool");
-
- /* Create a memory pool */
- if (NULL == (mp = H5MP_create((size_t)MPOOL_PAGE_SIZE, MPOOL_FLAGS)))
- TEST_ERROR
-
- /* Allocate space in pool */
- if (NULL == (spc = H5MP_malloc(mp, (size_t)MPOOL_NORMAL_BLOCK)))
- TEST_ERROR
-
- /* Check pool's free space */
- if (H5MP_get_pool_free_size(mp, &free_size) < 0)
- TEST_ERROR
- if (free_size !=
- MPOOL_PAGE_SIZE - (H5MP_BLOCK_ALIGN(MPOOL_NORMAL_BLOCK) + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_blk_t)) +
- H5MP_BLOCK_ALIGN(sizeof(H5MP_page_t))))
- TEST_ERROR
-
- /* Get first page */
- if (H5MP_get_pool_first_page(mp, &page) < 0)
- TEST_ERROR
- if (page == NULL)
- TEST_ERROR
-
- /* Check page's free space */
- if (H5MP_get_page_free_size(page, &free_size) < 0)
- TEST_ERROR
- if (free_size !=
- MPOOL_PAGE_SIZE - (H5MP_BLOCK_ALIGN(MPOOL_NORMAL_BLOCK) + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_blk_t)) +
- H5MP_BLOCK_ALIGN(sizeof(H5MP_page_t))))
- TEST_ERROR
-
- /* Check that free space totals match */
- if (H5MP_pool_is_free_size_correct(mp) <= 0)
- TEST_ERROR
-
- /* Check next page */
- if (H5MP_get_page_next_page(page, &page) < 0)
- TEST_ERROR
- if (page != NULL)
- TEST_ERROR
-
- /* Free space in pool */
- H5MP_free(mp, spc);
-
- /* Check pool's free space */
- if (H5MP_get_pool_free_size(mp, &free_size) < 0)
- TEST_ERROR
- if (free_size != MPOOL_PAGE_SIZE - H5MP_BLOCK_ALIGN(sizeof(H5MP_page_t)))
- TEST_ERROR
-
- /* Check that free space totals match */
- if (H5MP_pool_is_free_size_correct(mp) <= 0)
- TEST_ERROR
-
- /* Close the memory pool */
- if (H5MP_close(mp) < 0)
- TEST_ERROR
-
- PASSED();
-
- TESTING("allocating large first block in pool");
-
- /* Create a memory pool */
- if (NULL == (mp = H5MP_create((size_t)MPOOL_PAGE_SIZE, MPOOL_FLAGS)))
- TEST_ERROR
-
- /* Allocate space in pool */
- if (NULL == (spc = H5MP_malloc(mp, (size_t)MPOOL_LARGE_BLOCK)))
- TEST_ERROR
-
- /* Check pool's free space */
- if (H5MP_get_pool_free_size(mp, &free_size) < 0)
- TEST_ERROR
- if (free_size != 0)
- TEST_ERROR
-
- /* Get first page */
- if (H5MP_get_pool_first_page(mp, &page) < 0)
- TEST_ERROR
- if (page == NULL)
- TEST_ERROR
-
- /* Check page's free space */
- if (H5MP_get_page_free_size(page, &free_size) < 0)
- TEST_ERROR
- if (free_size != 0)
- TEST_ERROR
-
- /* Check that free space totals match */
- if (H5MP_pool_is_free_size_correct(mp) <= 0)
- TEST_ERROR
-
- /* Check next page */
- if (H5MP_get_page_next_page(page, &page) < 0)
- TEST_ERROR
- if (page != NULL)
- TEST_ERROR
-
- /* Free space in pool */
- H5MP_free(mp, spc);
-
- /* Check pool's free space */
- if (H5MP_get_pool_free_size(mp, &free_size) < 0)
- TEST_ERROR
- if (free_size != MPOOL_LARGE_BLOCK + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_blk_t)))
- TEST_ERROR
-
- /* Check that free space totals match */
- if (H5MP_pool_is_free_size_correct(mp) <= 0)
- TEST_ERROR
-
- /* Close the memory pool */
- if (H5MP_close(mp) < 0)
- TEST_ERROR
-
- PASSED();
-
- return 0;
-
-error:
- H5E_BEGIN_TRY
- {
- if (mp)
- H5MP_close(mp);
- }
- H5E_END_TRY;
-
- return 1;
-} /* test_allocate_first() */
-
-/*-------------------------------------------------------------------------
- * Function: test_allocate_split
- *
- * Purpose: Tests allocating block in pool that requires splitting
- * existing block
- *
- * Return: Success: 0
- * Failure: 1
- *
- * Programmer: Quincey Koziol
- * Tuesday, May 3, 2005
- *
- *-------------------------------------------------------------------------
- */
-static int
-test_allocate_split(void)
-{
- H5MP_pool_t *mp; /* Memory pool */
- size_t free_size; /* Free size in pool */
- void * spc1; /* Pointer to space allocated */
- void * spc2; /* Pointer to space allocated */
-
- /*
- * Test memory pool allocation
- */
- TESTING("splitting block in pool");
-
- /* Create a memory pool */
- if (NULL == (mp = H5MP_create((size_t)MPOOL_PAGE_SIZE, MPOOL_FLAGS)))
- TEST_ERROR
-
- /* Allocate space in pool */
- if (NULL == (spc1 = H5MP_malloc(mp, (size_t)MPOOL_NORMAL_BLOCK)))
- TEST_ERROR
-
- /* Check pool's free space */
- if (H5MP_get_pool_free_size(mp, &free_size) < 0)
- TEST_ERROR
- if (free_size !=
- MPOOL_PAGE_SIZE - (H5MP_BLOCK_ALIGN(MPOOL_NORMAL_BLOCK) + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_blk_t)) +
- H5MP_BLOCK_ALIGN(sizeof(H5MP_page_t))))
- TEST_ERROR
-
- /* Check that free space totals match */
- if (H5MP_pool_is_free_size_correct(mp) <= 0)
- TEST_ERROR
-
- /* Allocate more space in pool */
- if (NULL == (spc2 = H5MP_malloc(mp, (size_t)MPOOL_NORMAL_BLOCK)))
- TEST_ERROR
-
- /* Check pool's free space */
- if (H5MP_get_pool_free_size(mp, &free_size) < 0)
- TEST_ERROR
- if (free_size !=
- MPOOL_PAGE_SIZE -
- (((H5MP_BLOCK_ALIGN(MPOOL_NORMAL_BLOCK) + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_blk_t))) * 2) +
- H5MP_BLOCK_ALIGN(sizeof(H5MP_page_t))))
- TEST_ERROR
-
- /* Check that free space totals match */
- if (H5MP_pool_is_free_size_correct(mp) <= 0)
- TEST_ERROR
-
- /* Free first block in pool */
- H5MP_free(mp, spc1);
-
- /* Check pool's free space */
- if (H5MP_get_pool_free_size(mp, &free_size) < 0)
- TEST_ERROR
- if (free_size !=
- MPOOL_PAGE_SIZE - (H5MP_BLOCK_ALIGN(MPOOL_NORMAL_BLOCK) + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_blk_t)) +
- H5MP_BLOCK_ALIGN(sizeof(H5MP_page_t))))
- TEST_ERROR
-
- /* Check that free space totals match */
- if (H5MP_pool_is_free_size_correct(mp) <= 0)
- TEST_ERROR
-
- /* Free second block in pool (should merge with first block) */
- H5MP_free(mp, spc2);
-
- /* Check pool's free space */
- if (H5MP_get_pool_free_size(mp, &free_size) < 0)
- TEST_ERROR
- if (free_size != MPOOL_PAGE_SIZE - H5MP_BLOCK_ALIGN(sizeof(H5MP_page_t)))
- TEST_ERROR
-
- /* Check that free space totals match */
- if (H5MP_pool_is_free_size_correct(mp) <= 0)
- TEST_ERROR
-
- /* Close the memory pool */
- if (H5MP_close(mp) < 0)
- TEST_ERROR
-
- PASSED();
-
- return 0;
-
-error:
- H5E_BEGIN_TRY
- {
- if (mp)
- H5MP_close(mp);
- }
- H5E_END_TRY;
-
- return 1;
-} /* test_allocate_split() */
-
-/*-------------------------------------------------------------------------
- * Function: test_allocate_many_small
- *
- * Purpose: Tests allocating many small blocks in a pool
- *
- * Return: Success: 0
- * Failure: 1
- *
- * Programmer: Quincey Koziol
- * Tuesday, May 6, 2005
- *
- *-------------------------------------------------------------------------
- */
-static int
-test_allocate_many_small(void)
-{
- H5MP_pool_t *mp; /* Memory pool */
- size_t free_size; /* Free size in pool */
- void * spc[MPOOL_NUM_SMALL_BLOCKS]; /* Pointers to space allocated */
- int i; /* Local index variable */
-
- /*
- * Test memory pool allocation
- */
- TESTING("allocating many small blocks");
-
- /* Create a memory pool */
- if (NULL == (mp = H5MP_create((size_t)MPOOL_PAGE_SIZE, MPOOL_FLAGS)))
- TEST_ERROR
-
- /* Allocate space in pool */
- for (i = 0; i < MPOOL_NUM_SMALL_BLOCKS; i++)
- if (NULL == (spc[i] = H5MP_malloc(mp, (size_t)MPOOL_SMALL_BLOCK)))
- TEST_ERROR
-
- /* Check pool's free space */
- if (H5MP_get_pool_free_size(mp, &free_size) < 0)
- TEST_ERROR
- if (free_size != MPOOL_PAGE_SIZE -
- (((H5MP_BLOCK_ALIGN(MPOOL_SMALL_BLOCK) + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_blk_t))) *
- MPOOL_NUM_SMALL_BLOCKS) +
- H5MP_BLOCK_ALIGN(sizeof(H5MP_page_t))))
- TEST_ERROR
-
- /* Check that free space totals match */
- if (H5MP_pool_is_free_size_correct(mp) <= 0)
- TEST_ERROR
-
- /* Free blocks in pool */
- /* (Tests free block merging with block after it */
- for (i = (MPOOL_NUM_SMALL_BLOCKS - 1); i >= 0; i--)
- H5MP_free(mp, spc[i]);
-
- /* Check pool's free space */
- if (H5MP_get_pool_free_size(mp, &free_size) < 0)
- TEST_ERROR
- if (free_size != MPOOL_PAGE_SIZE - H5MP_BLOCK_ALIGN(sizeof(H5MP_page_t)))
- TEST_ERROR
-
- /* Check that free space totals match */
- if (H5MP_pool_is_free_size_correct(mp) <= 0)
- TEST_ERROR
-
- /* Close the memory pool */
- if (H5MP_close(mp) < 0)
- TEST_ERROR
-
- PASSED();
-
- return 0;
-
-error:
- H5E_BEGIN_TRY
- {
- if (mp)
- H5MP_close(mp);
- }
- H5E_END_TRY;
-
- return 1;
-} /* test_allocate_many_small() */
-
-/*-------------------------------------------------------------------------
- * Function: test_allocate_new_page
- *
- * Purpose: Tests allocating block in pool that requires allocating
- * new page
- *
- * Return: Success: 0
- * Failure: 1
- *
- * Programmer: Quincey Koziol
- * Friday, May 6, 2005
- *
- *-------------------------------------------------------------------------
- */
-static int
-test_allocate_new_page(void)
-{
- H5MP_pool_t *mp; /* Memory pool */
- size_t free_size; /* Free size in pool */
- size_t u; /* Local index variable */
- void * spc[MPOOL_NUM_NORMAL_BLOCKS]; /* Pointer to space allocated */
- void * spc1; /* Pointer to space allocated */
- void * spc2; /* Pointer to space allocated */
-
- /*
- * Test memory pool allocation
- */
- TESTING("allocate normal-sized block in new page");
-
- /* Create a memory pool */
- if (NULL == (mp = H5MP_create((size_t)MPOOL_PAGE_SIZE, MPOOL_FLAGS)))
- TEST_ERROR
-
- /* Allocate space in pool */
- for (u = 0; u < MPOOL_NUM_NORMAL_BLOCKS; u++)
- if (NULL == (spc[u] = H5MP_malloc(mp, (size_t)MPOOL_NORMAL_BLOCK)))
- TEST_ERROR
-
- /* Check pool's free space */
- if (H5MP_get_pool_free_size(mp, &free_size) < 0)
- TEST_ERROR
- if (free_size != (MPOOL_PAGE_SIZE * 3) - (((H5MP_BLOCK_ALIGN(MPOOL_NORMAL_BLOCK) +
- H5MP_BLOCK_ALIGN(sizeof(H5MP_page_blk_t))) *
- MPOOL_NUM_NORMAL_BLOCKS) +
- (H5MP_BLOCK_ALIGN(sizeof(H5MP_page_t)) * 3)))
- TEST_ERROR
-
- /* Check that free space totals match */
- if (H5MP_pool_is_free_size_correct(mp) <= 0)
- TEST_ERROR
-
- /* Free blocks in pool */
- /* (Free alternating blocks, in two passes, which tests block merging w/both neighbors) */
- for (u = 0; u < MPOOL_NUM_NORMAL_BLOCKS; u += 2)
- H5MP_free(mp, spc[u]);
- for (u = 1; u < MPOOL_NUM_NORMAL_BLOCKS; u += 2)
- H5MP_free(mp, spc[u]);
-
- /* Check pool's free space */
- if (H5MP_get_pool_free_size(mp, &free_size) < 0)
- TEST_ERROR
- if (free_size != ((MPOOL_PAGE_SIZE - H5MP_BLOCK_ALIGN(sizeof(H5MP_page_t))) * 3))
- TEST_ERROR
-
- /* Check that free space totals match */
- if (H5MP_pool_is_free_size_correct(mp) <= 0)
- TEST_ERROR
-
- /* Close the memory pool */
- if (H5MP_close(mp) < 0)
- TEST_ERROR
-
- PASSED();
-
- TESTING("allocate large-sized block in new page");
-
- /* Create a memory pool */
- if (NULL == (mp = H5MP_create((size_t)MPOOL_PAGE_SIZE, MPOOL_FLAGS)))
- TEST_ERROR
-
- /* Allocate space in pool */
- /* (Normal sized block) */
- if (NULL == (spc1 = H5MP_malloc(mp, (size_t)MPOOL_NORMAL_BLOCK)))
- TEST_ERROR
- /* (Larger sized block) */
- if (NULL == (spc2 = H5MP_malloc(mp, (size_t)MPOOL_LARGE_BLOCK)))
- TEST_ERROR
-
- /* Check pool's free space */
- if (H5MP_get_pool_free_size(mp, &free_size) < 0)
- TEST_ERROR
- if (free_size !=
- MPOOL_PAGE_SIZE - (H5MP_BLOCK_ALIGN(MPOOL_NORMAL_BLOCK) + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_blk_t)) +
- H5MP_BLOCK_ALIGN(sizeof(H5MP_page_t))))
- TEST_ERROR
-
- /* Check that free space totals match */
- if (H5MP_pool_is_free_size_correct(mp) <= 0)
- TEST_ERROR
-
- /* Free blocks in pool */
- H5MP_free(mp, spc1);
- H5MP_free(mp, spc2);
-
- /* Check pool's free space */
- if (H5MP_get_pool_free_size(mp, &free_size) < 0)
- TEST_ERROR
- if (free_size != ((MPOOL_PAGE_SIZE - H5MP_BLOCK_ALIGN(sizeof(H5MP_page_t))) + MPOOL_LARGE_BLOCK +
- H5MP_BLOCK_ALIGN(sizeof(H5MP_page_blk_t))))
- TEST_ERROR
-
- /* Check that free space totals match */
- if (H5MP_pool_is_free_size_correct(mp) <= 0)
- TEST_ERROR
-
- /* Close the memory pool */
- if (H5MP_close(mp) < 0)
- TEST_ERROR
-
- PASSED();
-
- return 0;
-
-error:
- H5E_BEGIN_TRY
- {
- if (mp)
- H5MP_close(mp);
- }
- H5E_END_TRY;
-
- return 1;
-} /* test_allocate_new_page() */
-
-/*-------------------------------------------------------------------------
- * Function: test_allocate_random
- *
- * Purpose: Tests allocating random sized blocks in pool
- *
- * Return: Success: 0
- * Failure: 1
- *
- * Programmer: Quincey Koziol
- * Friday, May 6, 2005
- *
- *-------------------------------------------------------------------------
- */
-static int
-test_allocate_random(void)
-{
- H5MP_pool_t *mp; /* Memory pool */
- size_t u; /* Local index variable */
- time_t curr_time; /* Current time, for seeding random number generator */
- size_t * blk_size = NULL; /* Pointer to block sizes */
- void ** spc = NULL; /* Pointer to space allocated */
- size_t swap_idx; /* Location to swap with when shuffling */
- void * swap_ptr; /* Pointer to swap when shuffling */
-
- /*
- * Test memory pool allocation
- */
- TESTING("allocate many random sized blocks");
-
- /* Initialize random number seed */
- curr_time = HDtime(NULL);
-#if 0
-curr_time=1115412944;
-HDfprintf(stderr,"curr_time=%lu\n",(unsigned long)curr_time);
-#endif
- HDsrandom((unsigned)curr_time);
-
- /* Create a memory pool */
- if (NULL == (mp = H5MP_create((size_t)MPOOL_PAGE_SIZE, MPOOL_FLAGS)))
- TEST_ERROR
-
- /* Allocate space for the block sizes */
- if (NULL == (blk_size = (size_t *)HDmalloc(sizeof(size_t) * MPOOL_NUM_RANDOM)))
- TEST_ERROR
-
- /* Allocate space for the block pointers */
- if (NULL == (spc = (void **)HDmalloc(sizeof(void *) * MPOOL_NUM_RANDOM)))
- TEST_ERROR
-
- /* Initialize the block sizes with random values */
- for (u = 0; u < MPOOL_NUM_RANDOM; u++)
- blk_size[u] = (size_t)(HDrandom() % MPOOL_RANDOM_MAX_SIZE) + 1;
-
- /* Allocate space in pool */
- for (u = 0; u < MPOOL_NUM_RANDOM; u++)
- if (NULL == (spc[u] = H5MP_malloc(mp, blk_size[u])))
- TEST_ERROR
-
- /* Check that free space totals match */
- if (H5MP_pool_is_free_size_correct(mp) <= 0)
- TEST_ERROR
-
- /* Shuffle pointers to free */
- for (u = 0; u < MPOOL_NUM_RANDOM; u++) {
- swap_idx = (size_t)(HDrandom() % (int)(MPOOL_NUM_RANDOM - u)) + u;
- swap_ptr = spc[u];
- spc[u] = spc[swap_idx];
- spc[swap_idx] = swap_ptr;
- } /* end for */
-
- /* Free blocks in pool */
- for (u = 0; u < MPOOL_NUM_RANDOM; u++)
- H5MP_free(mp, spc[u]);
-
- /* Check that free space totals match */
- if (H5MP_pool_is_free_size_correct(mp) <= 0)
- TEST_ERROR
-
- /* Initialize the block sizes with random values */
- for (u = 0; u < MPOOL_NUM_RANDOM; u++)
- blk_size[u] = (size_t)(HDrandom() % MPOOL_RANDOM_MAX_SIZE) + 1;
-
- /* Allocate space in pool (again) */
- /* (Leave allocated to test closing pool with many blocks still allocated) */
- for (u = 0; u < MPOOL_NUM_RANDOM; u++)
- if (NULL == (spc[u] = H5MP_malloc(mp, blk_size[u])))
- TEST_ERROR
-
- /* Check that free space totals match */
- if (H5MP_pool_is_free_size_correct(mp) <= 0)
- TEST_ERROR
-
- /* Close the memory pool */
- if (H5MP_close(mp) < 0)
- TEST_ERROR
-
- /* Free memory for block sizes & pointers */
- HDfree(blk_size);
- HDfree(spc);
-
- PASSED();
-
- return 0;
-
-error:
- if (blk_size)
- HDfree(blk_size);
- if (spc)
- HDfree(spc);
- H5E_BEGIN_TRY
- {
- if (mp)
- H5MP_close(mp);
- }
- H5E_END_TRY;
-
- return 1;
-} /* test_allocate_random() */
-
-/*-------------------------------------------------------------------------
- * Function: main
- *
- * Purpose: Test the memory pool code
- *
- * Return: Success:
- * Failure:
- *
- * Programmer: Quincey Koziol
- * Tuesday, May 3, 2005
- *
- *-------------------------------------------------------------------------
- */
-int
-main(void)
-{
- int nerrors = 0;
-
- /* Reset library */
- h5_reset();
-
- /* Test memory pool creation */
- nerrors += test_create();
-
- /* Test memory pool space closing */
- nerrors += test_close_one();
-
- /* Test memory pool space allocation */
- nerrors += test_allocate_first();
- nerrors += test_allocate_split();
- nerrors += test_allocate_many_small();
- nerrors += test_allocate_new_page();
- nerrors += test_allocate_random();
-
- if (nerrors)
- goto error;
- HDputs("All memory pool tests passed.");
-
- return 0;
-
-error:
- HDputs("*** TESTS FAILED ***");
- return 1;
-}
diff --git a/test/reserved.c b/test/reserved.c
index f864329..08e747e 100644
--- a/test/reserved.c
+++ b/test/reserved.c
@@ -71,7 +71,7 @@ rsrv_heap(void)
}
H5E_END_TRY
- HDsprintf(dset_name, "Dset %d", i);
+ HDsnprintf(dset_name, sizeof(dset_name), "Dset %d", i);
H5E_BEGIN_TRY
{
@@ -115,7 +115,7 @@ rsrv_heap(void)
if (H5open() < 0)
TEST_ERROR;
- HDsprintf(dset_name, "Dset %d", i - 2);
+ HDsnprintf(dset_name, sizeof(dset_name), "Dset %d", i - 2);
file_id = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT);
if (file_id < 0)
@@ -218,7 +218,7 @@ rsrv_ohdr(void)
} /* end for */
for (i = 0; i < 2000; i++) {
- HDsprintf(attrname, "attr %d", i);
+ HDsnprintf(attrname, sizeof(attrname), "attr %d", i);
H5E_BEGIN_TRY
{
aid = H5Screate_simple(2, dims, NULL);
diff --git a/test/swmr.c b/test/swmr.c
index 693ddc7..dccd945 100644
--- a/test/swmr.c
+++ b/test/swmr.c
@@ -2395,7 +2395,7 @@ error:
* (5) Parent: open a file with write access; enable SWMR writing mode
* Child: concurrent open of the file with write and SWMR write access (fail)
*/
-#ifndef H5_HAVE_UNISTD_H
+#if !(defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID))
static int
test_start_swmr_write_concur(hid_t H5_ATTR_UNUSED in_fapl, hbool_t new_format)
@@ -2408,11 +2408,11 @@ test_start_swmr_write_concur(hid_t H5_ATTR_UNUSED in_fapl, hbool_t new_format)
}
SKIPPED();
- HDputs(" Test skipped due to a lack of unistd.h functionality.");
+ HDputs(" Test skipped due to fork or waitpid not defined.");
return 0;
} /* test_start_swmr_write_concur() */
-#else /* H5_HAVE_UNISTD_H */
+#else /* !defined(H5_HAVE_FORK && defined(H5_HAVE_WAITPID) */
static int
test_start_swmr_write_concur(hid_t in_fapl, hbool_t new_format)
@@ -3014,7 +3014,7 @@ error:
return -1;
} /* test_start_swmr_write_concur() */
-#endif /* H5_HAVE_UNISTD_H */
+#endif /* !defined(H5_HAVE_FORK && defined(H5_HAVE_WAITPID) */
/*
* test_start_swmr_write_stress_ohdr():
@@ -4809,7 +4809,7 @@ error:
** This is for concurrent access.
**
*****************************************************************/
-#ifndef H5_HAVE_UNISTD_H
+#if !(defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID) && defined(H5_HAVE_FLOCK))
static int
test_file_lock_concur(hid_t H5_ATTR_UNUSED in_fapl)
@@ -4817,12 +4817,12 @@ test_file_lock_concur(hid_t H5_ATTR_UNUSED in_fapl)
/* Output message about test being performed */
TESTING("File open with different combinations of flags--concurrent access");
SKIPPED();
- HDputs(" Test skipped due to a lack of unistd.h functionality.");
+ HDputs(" Test skipped due to fork or waitpid not defined.");
return 0;
} /* end test_file_lock_concur() */
-#else /* H5_HAVE_UNISTD_H */
+#else /* !(defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID) && defined(H5_HAVE_FLOCK)) */
static int
test_file_lock_concur(hid_t in_fapl)
@@ -5192,7 +5192,7 @@ error:
} /* end test_file_lock_concur() */
-#endif /* H5_HAVE_UNISTD_H */
+#endif /* #if !(defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID) && defined(H5_HAVE_FLOCK)) */
/****************************************************************
**
@@ -5202,7 +5202,7 @@ error:
** This is for concurrent access.
**
*****************************************************************/
-#ifndef H5_HAVE_UNISTD_H
+#if !(defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID))
static int
test_file_lock_swmr_concur(hid_t H5_ATTR_UNUSED in_fapl)
@@ -5210,12 +5210,12 @@ test_file_lock_swmr_concur(hid_t H5_ATTR_UNUSED in_fapl)
/* Output message about test being performed */
TESTING("File open with different combintations of flags + SWMR flags--concurrent access");
SKIPPED();
- HDputs(" Test skipped due to a lack of unistd.h functionality.");
+ HDputs(" Test skipped due to fork or waitpid not defined.");
return 0;
} /* end test_file_lock_swmr_concur() */
-#else /* H5_HAVE_UNISTD_H */
+#else /* !(defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID)) */
static int
test_file_lock_swmr_concur(hid_t in_fapl)
@@ -6215,7 +6215,7 @@ error:
} /* end test_file_lock_swmr_concur() */
-#endif /* H5_HAVE_UNISTD_H */
+#endif /* !(defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID)) */
/****************************************************************
**
@@ -6227,7 +6227,7 @@ error:
static int
test_file_locking(hid_t in_fapl, hbool_t turn_locking_on, hbool_t env_var_override)
{
-#ifndef H5_HAVE_UNISTD_H
+#if !(defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID))
if (turn_locking_on && env_var_override)
TESTING("File locking: ON w/ env var override")
else if (turn_locking_on && !env_var_override)
@@ -6237,9 +6237,9 @@ test_file_locking(hid_t in_fapl, hbool_t turn_locking_on, hbool_t env_var_overri
else
TESTING("File locking: OFF")
SKIPPED();
- HDputs(" Test skipped due to a lack of unistd.h functionality.");
+ HDputs(" Test skipped due to fork or waitpid not defined.");
return 0;
-#else /* H5_HAVE_UNISTD_H */
+#else /* !(defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID)) */
hid_t fid = -1; /* File ID */
hid_t fapl = -1; /* File access property list */
char filename[NAME_BUF_SIZE]; /* file name */
@@ -6405,7 +6405,7 @@ error:
return -1;
-#endif /* H5_HAVE_UNISTD_H */
+#endif /* !(defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID)) */
} /* end test_file_locking() */
@@ -6699,7 +6699,7 @@ error:
* (7) Refresh the dataset
* (8) Verify the dataset's dimension and data are correct
*/
-#ifndef H5_HAVE_UNISTD_H
+#if !(defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID))
static int
test_refresh_concur(hid_t H5_ATTR_UNUSED in_fapl, hbool_t new_format)
@@ -6712,11 +6712,11 @@ test_refresh_concur(hid_t H5_ATTR_UNUSED in_fapl, hbool_t new_format)
}
SKIPPED();
- HDputs(" Test skipped due to a lack of unistd.h functionality.");
+ HDputs(" Test skipped due to fork or waitpid not defined.");
return 0;
} /* test_refresh_concur() */
-#else /* H5_HAVE_UNISTD_H */
+#else /* !(defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID)) */
static int
test_refresh_concur(hid_t in_fapl, hbool_t new_format)
@@ -7016,7 +7016,7 @@ error:
return -1;
} /* test_refresh_concur() */
-#endif /* H5_HAVE_UNISTD_H */
+#endif /* !(defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID)) */
/*
* test_multiple_same():
diff --git a/test/swmr_addrem_writer.c b/test/swmr_addrem_writer.c
index d39a698..c705d6b 100644
--- a/test/swmr_addrem_writer.c
+++ b/test/swmr_addrem_writer.c
@@ -283,7 +283,7 @@ usage(void)
}
int
-main(int argc, const char *argv[])
+main(int argc, char *argv[])
{
hid_t fid; /* File ID for file opened */
long nops = 0; /* # of times to grow or shrink the dataset */
diff --git a/test/swmr_common.c b/test/swmr_common.c
index 2201427..b359bc6 100644
--- a/test/swmr_common.c
+++ b/test/swmr_common.c
@@ -202,13 +202,12 @@ generate_symbols(void)
unsigned u, v; /* Local index variables */
for (u = 0; u < NLEVELS; u++) {
- symbol_info[u] = (symbol_info_t *)HDmalloc(symbol_count[u] * sizeof(symbol_info_t));
+ symbol_info[u] = HDmalloc(symbol_count[u] * sizeof(symbol_info_t));
for (v = 0; v < symbol_count[u]; v++) {
char name_buf[64];
generate_name(name_buf, u, v);
- symbol_info[u][v].name = (char *)HDmalloc(HDstrlen(name_buf) + 1);
- HDstrcpy(symbol_info[u][v].name, name_buf);
+ symbol_info[u][v].name = HDstrdup(name_buf);
symbol_info[u][v].dsid = -1;
symbol_info[u][v].nrecords = 0;
} /* end for */
diff --git a/test/swmr_generator.c b/test/swmr_generator.c
index e1423b6..93cfa0f 100644
--- a/test/swmr_generator.c
+++ b/test/swmr_generator.c
@@ -258,7 +258,7 @@ usage(void)
} /* end usage() */
int
-main(int argc, const char *argv[])
+main(int argc, char *argv[])
{
int comp_level = -1; /* Compression level (-1 is no compression) */
hbool_t verbose = TRUE; /* Whether to emit some informational messages */
diff --git a/test/swmr_reader.c b/test/swmr_reader.c
index 836e1cc..db3eba0 100644
--- a/test/swmr_reader.c
+++ b/test/swmr_reader.c
@@ -275,7 +275,7 @@ read_records(const char *filename, hbool_t verbose, FILE *verbose_file, unsigned
if ((fapl = h5_fileaccess()) < 0)
return -1;
- /* Log I/O when verbose output it enbabled */
+ /* Log I/O when verbose output it enabled */
if (use_log_vfd) {
char verbose_name[1024];
@@ -387,7 +387,7 @@ usage(void)
}
int
-main(int argc, const char *argv[])
+main(int argc, char *argv[])
{
long nseconds = 0; /* # of seconds to test */
int poll_time = 1; /* # of seconds between polling */
diff --git a/test/swmr_remove_reader.c b/test/swmr_remove_reader.c
index 910bc74..94cb7f8 100644
--- a/test/swmr_remove_reader.c
+++ b/test/swmr_remove_reader.c
@@ -371,7 +371,7 @@ usage(void)
}
int
-main(int argc, const char *argv[])
+main(int argc, char *argv[])
{
long nseconds = 0; /* # of seconds to test */
int poll_time = 1; /* # of seconds between polling */
diff --git a/test/swmr_remove_writer.c b/test/swmr_remove_writer.c
index e52f4e2..3604935 100644
--- a/test/swmr_remove_writer.c
+++ b/test/swmr_remove_writer.c
@@ -217,7 +217,7 @@ usage(void)
}
int
-main(int argc, const char *argv[])
+main(int argc, char *argv[])
{
hid_t fid; /* File ID for file opened */
long nshrinks = 0; /* # of times to shrink the dataset */
diff --git a/test/swmr_sparse_reader.c b/test/swmr_sparse_reader.c
index 00eb2e0..8f1c781 100644
--- a/test/swmr_sparse_reader.c
+++ b/test/swmr_sparse_reader.c
@@ -117,7 +117,7 @@ check_dataset(hid_t fid, unsigned verbose, const symbol_info_t *symbol, symbol_t
(uintmax_t)start[0], (uintmax_t)start[1]);
/* Read record from dataset */
- record->rec_id = (uint64_t)ULLONG_MAX;
+ record->rec_id = UINT64_MAX;
if (H5Dread(dsid, symbol_tid, rec_sid, file_sid, H5P_DEFAULT, record) < 0)
return -1;
@@ -342,7 +342,7 @@ usage(void)
} /* end usage() */
int
-main(int argc, const char *argv[])
+main(int argc, char *argv[])
{
long nrecords = 0; /* # of records to read */
int poll_time = 1; /* # of seconds to sleep when waiting for writer */
diff --git a/test/swmr_sparse_writer.c b/test/swmr_sparse_writer.c
index a4fc93e..96eff6c 100644
--- a/test/swmr_sparse_writer.c
+++ b/test/swmr_sparse_writer.c
@@ -318,7 +318,7 @@ usage(void)
}
int
-main(int argc, const char *argv[])
+main(int argc, char *argv[])
{
hid_t fid; /* File ID for file opened */
long nrecords = 0; /* # of records to append */
diff --git a/test/swmr_start_write.c b/test/swmr_start_write.c
index 3ddd57a..d046b40 100644
--- a/test/swmr_start_write.c
+++ b/test/swmr_start_write.c
@@ -352,7 +352,7 @@ usage(void)
*H5Fstart_swmr_write(), add_records(), H5Fclose().
*/
int
-main(int argc, const char *argv[])
+main(int argc, char *argv[])
{
hid_t fid; /* File ID for file opened */
long nrecords = 0; /* # of records to append */
diff --git a/test/swmr_writer.c b/test/swmr_writer.c
index de8b054..c4178f0 100644
--- a/test/swmr_writer.c
+++ b/test/swmr_writer.c
@@ -275,7 +275,7 @@ usage(void)
}
int
-main(int argc, const char *argv[])
+main(int argc, char *argv[])
{
hid_t fid; /* File ID for file opened */
long nrecords = 0; /* # of records to append */
diff --git a/test/tattr.c b/test/tattr.c
index d66fcc3..2859f4c 100644
--- a/test/tattr.c
+++ b/test/tattr.c
@@ -2094,7 +2094,7 @@ test_attr_dense_verify(hid_t loc_id, unsigned max_attr)
/* Re-open all the attributes by name and verify the data */
for (u = 0; u < max_attr; u++) {
/* Open attribute */
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
attr = H5Aopen(loc_id, attrname, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Aopen");
@@ -2119,7 +2119,7 @@ test_attr_dense_verify(hid_t loc_id, unsigned max_attr)
CHECK(attr, FAIL, "H5Aopen_by_idx");
/* Verify Name */
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
name_len = H5Aget_name(attr, (size_t)ATTR_NAME_LEN, check_name);
VERIFY(name_len, HDstrlen(attrname), "H5Aget_name");
if (HDstrcmp(check_name, attrname) != 0)
@@ -2219,7 +2219,7 @@ test_attr_dense_create(hid_t fcpl, hid_t fapl)
/* Add attributes, until just before converting to dense storage */
for (u = 0; u < max_compact; u++) {
/* Create attribute */
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -2238,7 +2238,7 @@ test_attr_dense_create(hid_t fcpl, hid_t fapl)
/* Add one more attribute, to push into "dense" storage */
/* Create attribute */
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -2361,7 +2361,7 @@ test_attr_dense_open(hid_t fcpl, hid_t fapl)
/* Add attributes, until just before converting to dense storage */
for (u = 0; u < max_compact; u++) {
/* Create attribute */
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -2384,7 +2384,7 @@ test_attr_dense_open(hid_t fcpl, hid_t fapl)
/* Add one more attribute, to push into "dense" storage */
/* Create attribute */
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -2523,7 +2523,7 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl)
/* Add attributes, until well into dense storage */
for (u = 0; u < (max_compact * 2); u++) {
/* Create attribute */
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -2568,7 +2568,7 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl)
/* Delete attributes until the attributes revert to compact storage again */
for (u--; u >= min_dense; u--) {
/* Delete attribute */
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
ret = H5Adelete(dataset, attrname);
CHECK(ret, FAIL, "H5Adelete");
@@ -2582,7 +2582,7 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl)
VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test");
/* Delete one more attribute, which should cause reversion to compact storage */
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
ret = H5Adelete(dataset, attrname);
CHECK(ret, FAIL, "H5Adelete");
@@ -2595,7 +2595,7 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "test_attr_dense_verify");
/* Delete another attribute, to verify deletion in compact storage */
- HDsprintf(attrname, "attr %02u", (u - 1));
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", (u - 1));
ret = H5Adelete(dataset, attrname);
CHECK(ret, FAIL, "H5Adelete");
@@ -2724,7 +2724,7 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl)
/* Add attributes, until well into dense storage */
for (u = 0; u < (max_compact * 2); u++) {
/* Create attribute */
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, H5I_INVALID_HID, "H5Acreate2");
@@ -2790,7 +2790,7 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl)
unsigned value; /* Attribute value */
/* Open attribute */
- HDsprintf(attrname, "new attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "new attr %02u", u);
attr = H5Aopen(dataset, attrname, H5P_DEFAULT);
CHECK(attr, H5I_INVALID_HID, "H5Aopen");
@@ -2914,7 +2914,7 @@ test_attr_dense_unlink(hid_t fcpl, hid_t fapl)
/* Add attributes, until well into dense storage */
for (u = 0; u < (max_compact * 2); u++) {
/* Create attribute */
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -3057,7 +3057,7 @@ test_attr_dense_limits(hid_t fcpl, hid_t fapl)
/* Create attribute */
u = 0;
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -3077,7 +3077,7 @@ test_attr_dense_limits(hid_t fcpl, hid_t fapl)
/* Create attribute */
u = 1;
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -3107,7 +3107,7 @@ test_attr_dense_limits(hid_t fcpl, hid_t fapl)
/* Delete attribute */
u = 0;
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
ret = H5Adelete(dataset, attrname);
CHECK(ret, FAIL, "H5Adelete");
@@ -3216,7 +3216,7 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl)
/* Add attributes, until just before converting to dense storage */
for (u = 0; u < max_compact; u++) {
/* Create attribute */
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -3239,7 +3239,7 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl)
CHECK(sid2, FAIL, "H5Screate_simple");
/* Create attribute */
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
attr = H5Acreate2(dataset, attrname, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -3522,7 +3522,7 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl)
/* Delete a few attributes until the storage switches to compact */
for (u = min_dense - 1; u <= max_compact; u++) {
/* Create attribute */
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
add_attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(add_attr, FAIL, "H5Acreate2");
@@ -3590,7 +3590,7 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl)
/* Add attributes, until just before converting to dense storage */
for (u = 0; u < max_compact; u++) {
/* Create attribute */
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
attr = H5Acreate2(gid1, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -3756,7 +3756,7 @@ test_attr_big(hid_t fcpl, hid_t fapl)
/* Create attribute */
u = 0;
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -3774,7 +3774,7 @@ test_attr_big(hid_t fcpl, hid_t fapl)
/* Create attribute */
u = 1;
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -3792,7 +3792,7 @@ test_attr_big(hid_t fcpl, hid_t fapl)
/* Create attribute */
u = 2;
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, big_sid, H5P_DEFAULT, H5P_DEFAULT);
if (low == H5F_LIBVER_LATEST) {
CHECK(attr, FAIL, "H5Acreate2");
@@ -3815,7 +3815,7 @@ test_attr_big(hid_t fcpl, hid_t fapl)
/* Create attribute */
u = 3;
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, big_sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -3837,7 +3837,7 @@ test_attr_big(hid_t fcpl, hid_t fapl)
/* Delete attribute */
u = 1;
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
ret = H5Adelete(dataset, attrname);
CHECK(ret, FAIL, "H5Adelete");
@@ -3851,7 +3851,7 @@ test_attr_big(hid_t fcpl, hid_t fapl)
/* Delete attribute */
u = 3;
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
ret = H5Adelete(dataset, attrname);
CHECK(ret, FAIL, "H5Adelete");
@@ -3865,7 +3865,7 @@ test_attr_big(hid_t fcpl, hid_t fapl)
/* Delete attribute */
u = 2;
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
ret = H5Adelete(dataset, attrname);
CHECK(ret, FAIL, "H5Adelete");
@@ -3879,7 +3879,7 @@ test_attr_big(hid_t fcpl, hid_t fapl)
/* Delete attribute */
u = 0;
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
ret = H5Adelete(dataset, attrname);
CHECK(ret, FAIL, "H5Adelete");
@@ -4278,7 +4278,7 @@ test_attr_many(hbool_t new_format, hid_t fcpl, hid_t fapl)
/* Create many attributes */
for (u = 0; u < nattr; u++) {
- HDsprintf(attrname, "a-%06u", u);
+ HDsnprintf(attrname, sizeof(attrname), "a-%06u", u);
exists = H5Aexists(gid, attrname);
VERIFY(exists, FALSE, "H5Aexists");
@@ -4330,7 +4330,7 @@ test_attr_many(hbool_t new_format, hid_t fcpl, hid_t fapl)
for (u = 0; u < nattr; u++) {
unsigned value; /* Attribute value */
- HDsprintf(attrname, "a-%06u", u);
+ HDsnprintf(attrname, sizeof(attrname), "a-%06u", u);
exists = H5Aexists(gid, attrname);
VERIFY(exists, TRUE, "H5Aexists");
@@ -4578,7 +4578,7 @@ test_attr_corder_create_compact(hid_t fcpl, hid_t fapl)
/* Create several attributes, but keep storage in compact form */
for (u = 0; u < max_compact; u++) {
/* Create attribute */
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -4667,7 +4667,7 @@ test_attr_corder_create_compact(hid_t fcpl, hid_t fapl)
H5A_info_t ainfo; /* Attribute information */
/* Retrieve information for attribute */
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
ret = H5Aget_info_by_name(my_dataset, ".", attrname, &ainfo, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Aget_info_by_name");
@@ -4782,7 +4782,7 @@ test_attr_corder_create_dense(hid_t fcpl, hid_t fapl)
/* Create several attributes, but keep storage in compact form */
for (u = 0; u < max_compact; u++) {
/* Create attribute */
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -4805,7 +4805,7 @@ test_attr_corder_create_dense(hid_t fcpl, hid_t fapl)
} /* end for */
/* Create another attribute, to push into dense storage */
- HDsprintf(attrname, "attr %02u", max_compact);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", max_compact);
attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -4898,7 +4898,7 @@ test_attr_corder_create_dense(hid_t fcpl, hid_t fapl)
H5A_info_t ainfo; /* Attribute information */
/* Retrieve information for attribute */
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
ret = H5Aget_info_by_name(my_dataset, ".", attrname, &ainfo, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Aget_info_by_name");
@@ -5171,7 +5171,7 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl)
/* Create several attributes, but keep storage in compact form */
for (u = 0; u < max_compact; u++) {
/* Create attribute */
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -5194,7 +5194,7 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl)
} /* end for */
/* Create another attribute, to push into dense storage */
- HDsprintf(attrname, "attr %02u", max_compact);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", max_compact);
attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -5222,7 +5222,7 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl)
/* Delete several attributes from object, until attribute storage resumes compact form */
for (u = max_compact; u >= min_dense; u--) {
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
ret = H5Adelete(my_dataset, attrname);
CHECK(ret, FAIL, "H5Adelete");
@@ -5242,7 +5242,7 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl)
} /* end for */
/* Delete another attribute, to push attribute storage into compact form */
- HDsprintf(attrname, "attr %02u", (min_dense - 1));
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", (min_dense - 1));
ret = H5Adelete(my_dataset, attrname);
CHECK(ret, FAIL, "H5Adelete");
@@ -5258,7 +5258,7 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl)
/* Re-add attributes to get back into dense form */
for (u = (min_dense - 1); u < (max_compact + 1); u++) {
/* Create attribute */
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -5345,7 +5345,7 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl)
/* Delete several attributes from object, until attribute storage resumes compact form */
for (u = max_compact; u >= min_dense; u--) {
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
ret = H5Adelete(my_dataset, attrname);
CHECK(ret, FAIL, "H5Adelete");
@@ -5365,7 +5365,7 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl)
} /* end for */
/* Delete another attribute, to push attribute storage into compact form */
- HDsprintf(attrname, "attr %02u", (min_dense - 1));
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", (min_dense - 1));
ret = H5Adelete(my_dataset, attrname);
CHECK(ret, FAIL, "H5Adelete");
@@ -5381,7 +5381,7 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl)
/* Re-add attributes to get back into dense form */
for (u = (min_dense - 1); u < (max_compact + 1); u++) {
/* Create attribute */
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -5410,11 +5410,11 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl)
/* Delete all attributes */
for (u = max_compact; u > 0; u--) {
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
ret = H5Adelete(my_dataset, attrname);
CHECK(ret, FAIL, "H5Adelete");
} /* end for */
- HDsprintf(attrname, "attr %02u", 0);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", 0);
ret = H5Adelete(my_dataset, attrname);
CHECK(ret, FAIL, "H5Adelete");
} /* end for */
@@ -5554,7 +5554,7 @@ test_attr_corder_delete(hid_t fcpl, hid_t fapl)
/* Create attributes, until attribute storage is in dense form */
for (u = 0; u < max_compact * 2; u++) {
/* Create attribute */
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -5897,7 +5897,7 @@ test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
/* Create attributes, up to limit of compact form */
for (u = 0; u < max_compact; u++) {
/* Create attribute */
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -5937,7 +5937,7 @@ test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
/* Create more attributes, to push into dense form */
for (; u < (max_compact * 2); u++) {
/* Create attribute */
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -6381,7 +6381,7 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
/* Create attributes, up to limit of compact form */
for (u = 0; u < max_compact; u++) {
/* Create attribute */
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
attr =
H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -6456,9 +6456,9 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
ret = (herr_t)H5Aget_name_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0,
tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
if (order == H5_ITER_INC)
- HDsprintf(attrname, "attr %02u", (u + 1));
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", (u + 1));
else
- HDsprintf(attrname, "attr %02u", (max_compact - (u + 2)));
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", (max_compact - (u + 2)));
ret = HDstrcmp(attrname, tmpname);
VERIFY(ret, 0, "H5Aget_name_by_idx");
} /* end for */
@@ -6494,7 +6494,7 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
/* Create more attributes, to push into dense form */
for (u = 0; u < (max_compact * 2); u++) {
/* Create attribute */
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
attr =
H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -6584,9 +6584,10 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
ret = (herr_t)H5Aget_name_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0,
tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
if (order == H5_ITER_INC)
- HDsprintf(attrname, "attr %02u", (u + 1));
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", (u + 1));
else
- HDsprintf(attrname, "attr %02u", ((max_compact * 2) - (u + 2)));
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u",
+ ((max_compact * 2) - (u + 2)));
ret = HDstrcmp(attrname, tmpname);
VERIFY(ret, 0, "H5Aget_name_by_idx");
} /* end for */
@@ -6628,7 +6629,7 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
/* Create attributes, to push into dense form */
for (u = 0; u < (max_compact * 2); u++) {
/* Create attribute */
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
attr =
H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -6697,9 +6698,10 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
ret = (herr_t)H5Aget_name_by_idx(my_dataset, ".", idx_type, order, (hsize_t)u,
tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
if (order == H5_ITER_INC)
- HDsprintf(attrname, "attr %02u", ((u * 2) + 1));
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", ((u * 2) + 1));
else
- HDsprintf(attrname, "attr %02u", ((max_compact * 2) - ((u * 2) + 2)));
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u",
+ ((max_compact * 2) - ((u * 2) + 2)));
ret = HDstrcmp(attrname, tmpname);
VERIFY(ret, 0, "H5Aget_name_by_idx");
} /* end for */
@@ -6749,9 +6751,10 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
ret = (herr_t)H5Aget_name_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0,
tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
if (order == H5_ITER_INC)
- HDsprintf(attrname, "attr %02u", ((u * 2) + 3));
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", ((u * 2) + 3));
else
- HDsprintf(attrname, "attr %02u", ((max_compact * 2) - ((u * 2) + 4)));
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u",
+ ((max_compact * 2) - ((u * 2) + 4)));
ret = HDstrcmp(attrname, tmpname);
VERIFY(ret, 0, "H5Aget_name_by_idx");
} /* end for */
@@ -6832,7 +6835,7 @@ attr_iterate2_cb(hid_t loc_id, const char *attr_name, const H5A_info_t *info, vo
} /* end if */
/* Verify name of link */
- HDsprintf(attrname, "attr %02u", (unsigned)my_info.corder);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", (unsigned)my_info.corder);
if (HDstrcmp(attr_name, attrname) != 0)
return (H5_ITER_ERROR);
@@ -7342,7 +7345,7 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl)
/* Create attributes, up to limit of compact form */
for (u = 0; u < max_compact; u++) {
/* Create attribute */
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
attr =
H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -7414,7 +7417,7 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl)
/* Create more attributes, to push into dense form */
for (u = max_compact; u < (max_compact * 2); u++) {
/* Create attribute */
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
attr =
H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -7706,7 +7709,7 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
/* Create attributes, up to limit of compact form */
for (u = 0; u < max_compact; u++) {
/* Create attribute */
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
attr =
H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -7765,7 +7768,7 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
/* Create more attributes, to push into dense form */
for (u = max_compact; u < (max_compact * 2); u++) {
/* Create attribute */
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
attr =
H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -7870,7 +7873,7 @@ attr_open_check(hid_t fid, const char *dsetname, hid_t obj_id, unsigned max_attr
/* Open each attribute on object by index and check that it's the correct one */
for (u = 0; u < max_attrs; u++) {
/* Open the attribute */
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
attr_id = H5Aopen(obj_id, attrname, H5P_DEFAULT);
CHECK(attr_id, FAIL, "H5Aopen");
@@ -8039,7 +8042,7 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl)
/* Create attributes, up to limit of compact form */
for (u = 0; u < max_compact; u++) {
/* Create attribute */
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -8105,7 +8108,7 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl)
/* Create more attributes, to push into dense form */
for (u = max_compact; u < (max_compact * 2); u++) {
/* Create attribute */
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
@@ -8288,7 +8291,7 @@ test_attr_create_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl)
/* Create attributes, up to limit of compact form */
for (u = 0; u < max_compact; u++) {
/* Create attribute */
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
attr = H5Acreate_by_name(fid, dsetname, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT,
H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate_by_name");
@@ -8345,7 +8348,7 @@ test_attr_create_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl)
/* Create more attributes, to push into dense form */
for (u = max_compact; u < (max_compact * 2); u++) {
/* Create attribute */
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
attr = H5Acreate_by_name(fid, dsetname, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT,
H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate_by_name");
@@ -8570,7 +8573,7 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl)
/* Add attributes to each dataset, until after converting to dense storage */
for (u = 0; u < max_compact * 2; u++) {
/* Create attribute name */
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
/* Alternate between creating "small" & "big" attributes */
if (u % 2) {
@@ -8907,7 +8910,7 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl)
/* Add attributes to each dataset, until after converting to dense storage */
for (u = 0; u < max_compact * 2; u++) {
/* Create attribute name */
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
/* Alternate between creating "small" & "big" attributes */
if (u % 2) {
@@ -9354,7 +9357,7 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl)
/* Add attributes to each dataset, until after converting to dense storage */
for (u = 0; u < max_compact * 2; u++) {
/* Create attribute name */
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
/* Alternate between creating "small" & "big" attributes */
if (u % 2) {
@@ -9462,7 +9465,7 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl)
/* Delete attributes from second dataset */
for (u = 0; u < max_compact * 2; u++) {
/* Create attribute name */
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
/* Delete second dataset's attribute */
ret = H5Adelete_by_name(fid, DSET2_NAME, attrname, H5P_DEFAULT);
@@ -9726,7 +9729,7 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl)
/* Add attributes to each dataset, until after converting to dense storage */
for (u = 0; u < max_compact * 2; u++) {
/* Create attribute name */
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
/* Alternate between creating "small" & "big" attributes */
if (u % 2) {
@@ -9850,7 +9853,7 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl)
/* Check ref count on attributes of first dataset */
for (u = 0; u < max_compact * 2; u++) {
/* Create attribute name */
- HDsprintf(attrname, "attr %02u", u);
+ HDsnprintf(attrname, sizeof(attrname), "attr %02u", u);
/* Open attribute on first dataset */
attr = H5Aopen(dataset, attrname, H5P_DEFAULT);
diff --git a/test/testabort_fail.sh.in b/test/test_abort_fail.sh.in
index a866f9e..a866f9e 100644
--- a/test/testabort_fail.sh.in
+++ b/test/test_abort_fail.sh.in
diff --git a/test/testcheck_version.sh.in b/test/test_check_version.sh.in
index 273702e..273702e 100644
--- a/test/testcheck_version.sh.in
+++ b/test/test_check_version.sh.in
diff --git a/test/testerror.sh.in b/test/test_error.sh.in
index 4fb2a81..4fb2a81 100644
--- a/test/testerror.sh.in
+++ b/test/test_error.sh.in
diff --git a/test/testexternal_env.sh.in b/test/test_external_env.sh.in
index 94fbb88..94fbb88 100644
--- a/test/testexternal_env.sh.in
+++ b/test/test_external_env.sh.in
diff --git a/test/test_filter_plugin.sh.in b/test/test_filter_plugin.sh.in
deleted file mode 100644
index 78cdb3a..0000000
--- a/test/test_filter_plugin.sh.in
+++ /dev/null
@@ -1,113 +0,0 @@
-#! /bin/sh
-#
-# Copyright by The HDF Group.
-# All rights reserved.
-#
-# This file is part of HDF5. The full HDF5 copyright notice, including
-# terms governing use, modification, and redistribution, is contained in
-# the 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.
-#
-srcdir=@srcdir@
-TOP_BUILDDIR=@top_builddir@
-
-# Determine if backward compatibility options enabled
-DEPRECATED_SYMBOLS="@DEPRECATED_SYMBOLS@"
-
-EXIT_SUCCESS=0
-EXIT_FAILURE=1
-
-nerrors=0
-verbose=yes
-exit_code=$EXIT_SUCCESS
-
-TEST_NAME=filter_plugin
-TEST_BIN=`pwd`/$TEST_NAME
-FROM_DIR=`pwd`/.libs
-case $(uname) in
- CYGWIN* )
- PLUGINS_FOR_DIR1="$FROM_DIR/cygfilter_plugin1* $FROM_DIR/cygfilter_plugin3*"
- PLUGINS_FOR_DIR2="$FROM_DIR/cygfilter_plugin2* $FROM_DIR/cygfilter_plugin4*"
- ;;
- *)
- PLUGINS_FOR_DIR1="$FROM_DIR/libfilter_plugin1* $FROM_DIR/libfilter_plugin3*"
- PLUGINS_FOR_DIR2="$FROM_DIR/libfilter_plugin2* $FROM_DIR/libfilter_plugin4*"
- ;;
-esac
-PLUGIN_DIR1=filter_plugin_dir1
-PLUGIN_DIR2=filter_plugin_dir2
-CP="cp -p" # Use -p to preserve mode,ownership,timestamps
-RM="rm -rf"
-
-# Print a line-line message left justified in a field of 70 characters
-# beginning with the word "Testing".
-#
-TESTING() {
- SPACES=" "
- echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012'
-}
-
-# Main Body
-# Create test directories if necessary.
-test -d $PLUGIN_DIR1 || mkdir -p $PLUGIN_DIR1
-if [ $? != 0 ]; then
- echo "Failed to create filter plugin test directory ($PLUGIN_DIR1)"
- exit $EXIT_FAILURE
-fi
-
-test -d $PLUGIN_DIR2 || mkdir -p $PLUGIN_DIR2
-if [ $? != 0 ]; then
- echo "Failed to create filter plugin test directory ($PLUGIN_DIR2)"
- exit $EXIT_FAILURE
-fi
-
-# Copy plugins for the tests.
-$CP $PLUGINS_FOR_DIR1 $PLUGIN_DIR1
-if [ $? != 0 ]; then
- echo "Failed to copy filter plugins ($PLUGINS_FOR_DIR1) to test directory."
- exit $EXIT_FAILURE
-fi
-
-$CP $PLUGINS_FOR_DIR2 $PLUGIN_DIR2
-if [ $? != 0 ]; then
- echo "Failed to copy filter plugins ($PLUGINS_FOR_DIR2) to test directory."
- exit $EXIT_FAILURE
-fi
-
-# setup plugin path
-ENVCMD="env HDF5_PLUGIN_PATH=${PLUGIN_DIR1}:${PLUGIN_DIR2}"
-
-# Run the test
-$ENVCMD $TEST_BIN
-if [ $? != 0 ]; then
- nerrors=`expr $nerrors + 1`
-fi
-
-############################################
-# HDFFV-9655 test for relative path disabled
-# setup filter plugin path relative to test
-# actual executable is in the .libs folder
-#ENVCMD="env HDF5_PLUGIN_PATH=@/../${PLUGIN_DIR1}:@/../${PLUGIN_DIR2}"
-#
-# Run the test
-#$ENVCMD $TEST_BIN
-#if [ $? != 0 ]; then
-# nerrors=`expr $nerrors + 1`
-#fi
-#############################################
-
-# print results
-if test $nerrors -ne 0 ; then
- echo "$nerrors errors encountered"
- exit_code=$EXIT_FAILURE
-else
- echo "All filter plugin tests passed."
- exit_code=$EXIT_SUCCESS
-fi
-
-# Clean up temporary files/directories and leave
-$RM $PLUGIN_DIR1 $PLUGIN_DIR2
-
-exit $exit_code
diff --git a/test/testflushrefresh.sh.in b/test/test_flush_refresh.sh.in
index 209d370..209d370 100644
--- a/test/testflushrefresh.sh.in
+++ b/test/test_flush_refresh.sh.in
diff --git a/test/testlibinfo.sh.in b/test/test_libinfo.sh.in
index d9fee48..d9fee48 100644
--- a/test/testlibinfo.sh.in
+++ b/test/test_libinfo.sh.in
diff --git a/test/testlinks_env.sh.in b/test/test_links_env.sh.in
index 09074c3..09074c3 100644
--- a/test/testlinks_env.sh.in
+++ b/test/test_links_env.sh.in
diff --git a/test/test_plugin.sh.in b/test/test_plugin.sh.in
new file mode 100644
index 0000000..d958b4b
--- /dev/null
+++ b/test/test_plugin.sh.in
@@ -0,0 +1,140 @@
+#!/usr/bin/env bash
+#
+# Copyright by The HDF Group.
+# All rights reserved.
+#
+# This file is part of HDF5. The full HDF5 copyright notice, including
+# terms governing use, modification, and redistribution, is contained in
+# the 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.
+#
+# This shell script is for testing filter, VFD, and VOL plugins.
+#
+srcdir=@srcdir@
+TOP_BUILDDIR=@top_builddir@
+
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+
+CP="cp -p" # Use -p to preserve mode,ownership, timestamps
+RM="rm -rf"
+
+nerrors=0
+verbose=yes
+exit_code=$EXIT_SUCCESS
+
+# Test binary names
+FILTER_TEST_NAME=filter_plugin
+FILTER_TEST_BIN=`pwd`/$FILTER_TEST_NAME
+
+VFD_TEST_NAME=vfd_plugin
+VFD_TEST_BIN=`pwd`/$VFD_TEST_NAME
+
+VOL_TEST_NAME=vol_plugin
+VOL_TEST_BIN=`pwd`/$VOL_TEST_NAME
+
+# Paths to actual plugins ("libraries" in test directory are just stubs)
+FROM_DIR=`pwd`/.libs
+case $(uname) in
+ CYGWIN* )
+ NULL_VFD_PLUGIN="$FROM_DIR/cygnull_vfd_plugin*"
+ NULL_VOL_PLUGIN="$FROM_DIR/cygnull_vol_connector*"
+ PLUGINS_FOR_DIR1="$FROM_DIR/cygfilter_plugin1* $FROM_DIR/cygfilter_plugin3*"
+ PLUGINS_FOR_DIR2="$FROM_DIR/cygfilter_plugin2* $FROM_DIR/cygfilter_plugin4*"
+ ;;
+ *)
+ NULL_VFD_PLUGIN="$FROM_DIR/libnull_vfd_plugin*"
+ NULL_VOL_PLUGIN="$FROM_DIR/libnull_vol_connector*"
+ PLUGINS_FOR_DIR1="$FROM_DIR/libfilter_plugin1* $FROM_DIR/libfilter_plugin3*"
+ PLUGINS_FOR_DIR2="$FROM_DIR/libfilter_plugin2* $FROM_DIR/libfilter_plugin4*"
+ ;;
+esac
+
+# Directories where we'll copy plugins
+TEMP_PLUGIN_DIR=temp_plugins
+TEMP_FILTER_DIR1=temp_filter_plugin_dir1
+TEMP_FILTER_DIR2=temp_filter_plugin_dir2
+
+# Function to print a line-line message left justified in a field of
+# 70 characters beginning with the word "Testing".
+#
+TESTING() {
+ SPACES=" "
+ echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012'
+}
+
+#############
+# Main Body #
+#############
+
+# Create plugin directories
+test -d $TEMP_PLUGIN_DIR || mkdir -p $TEMP_PLUGIN_DIR
+if [ $? != 0 ]; then
+ echo "Failed to create plugin test directory ($TEMP_PLUGIN_DIR)"
+ exit $EXIT_FAILURE
+fi
+test -d $TEMP_FILTER_DIR1 || mkdir -p $TEMP_FILTER_DIR1
+if [ $? != 0 ]; then
+ echo "Failed to create filter plugin test directory ($TEMP_FILTER_DIR1)"
+ exit $EXIT_FAILURE
+fi
+test -d $TEMP_FILTER_DIR2 || mkdir -p $TEMP_FILTER_DIR2
+if [ $? != 0 ]; then
+ echo "Failed to create filter plugin test directory ($TEMP_FILTER_DIR2)"
+ exit $EXIT_FAILURE
+fi
+
+# Copy plugins for the tests
+$CP $NULL_VFD_PLUGIN $TEMP_PLUGIN_DIR
+if [ $? != 0 ]; then
+ echo "Failed to copy NULL VFD plugin ($NULL_VFD_PLUGIN) to test directory."
+ exit $EXIT_FAILURE
+fi
+$CP $NULL_VOL_PLUGIN $TEMP_PLUGIN_DIR
+if [ $? != 0 ]; then
+ echo "Failed to copy NULL VOL plugin ($NULL_VOL_PLUGIN) to test directory."
+ exit $EXIT_FAILURE
+fi
+$CP $PLUGINS_FOR_DIR1 $TEMP_FILTER_DIR1
+if [ $? != 0 ]; then
+ echo "Failed to copy filter plugins ($PLUGINS_FOR_DIR1) to test directory."
+ exit $EXIT_FAILURE
+fi
+$CP $PLUGINS_FOR_DIR2 $TEMP_FILTER_DIR2
+if [ $? != 0 ]; then
+ echo "Failed to copy filter plugins ($PLUGINS_FOR_DIR2) to test directory."
+ exit $EXIT_FAILURE
+fi
+
+# Set plugin path
+ENVCMD="env HDF5_PLUGIN_PATH=${TEMP_PLUGIN_DIR}:${TEMP_FILTER_DIR1}:${TEMP_FILTER_DIR2}"
+
+# Run the tests
+$ENVCMD $FILTER_TEST_BIN
+if [ $? != 0 ]; then
+ nerrors=`expr $nerrors + 1`
+fi
+$ENVCMD $VFD_TEST_BIN
+if [ $? != 0 ]; then
+ nerrors=`expr $nerrors + 1`
+fi
+$ENVCMD $VOL_TEST_BIN
+if [ $? != 0 ]; then
+ nerrors=`expr $nerrors + 1`
+fi
+
+# Print results
+if test $nerrors -ne 0 ; then
+ echo "$nerrors errors encountered"
+ exit_code=$EXIT_FAILURE
+else
+ echo "All plugin tests passed."
+ exit_code=$EXIT_SUCCESS
+fi
+
+# Clean up temporary files/directories and leave
+$RM $TEMP_PLUGIN_DIR $TEMP_FILTER_DIR1 $TEMP_FILTER_DIR2
+
+exit $exit_code
diff --git a/test/testswmr.pwsh.in b/test/test_swmr.pwsh.in
index de7a57a..de7a57a 100644
--- a/test/testswmr.pwsh.in
+++ b/test/test_swmr.pwsh.in
diff --git a/test/testswmr.sh.in b/test/test_swmr.sh.in
index 771fe4a..771fe4a 100644
--- a/test/testswmr.sh.in
+++ b/test/test_swmr.sh.in
diff --git a/test/test_usecases.sh.in b/test/test_use_cases.sh.in
index fd30afd..fd30afd 100644
--- a/test/test_usecases.sh.in
+++ b/test/test_use_cases.sh.in
diff --git a/test/testvds_env.sh.in b/test/test_vds_env.sh.in
index 39f13a5..39f13a5 100644
--- a/test/testvds_env.sh.in
+++ b/test/test_vds_env.sh.in
diff --git a/test/testvdsswmr.pwsh.in b/test/test_vds_swmr.pwsh.in
index bf5aabb..bf5aabb 100644
--- a/test/testvdsswmr.pwsh.in
+++ b/test/test_vds_swmr.pwsh.in
diff --git a/test/testvdsswmr.sh.in b/test/test_vds_swmr.sh.in
index 399fdef..399fdef 100644
--- a/test/testvdsswmr.sh.in
+++ b/test/test_vds_swmr.sh.in
diff --git a/test/test_vol_plugin.sh.in b/test/test_vol_plugin.sh.in
deleted file mode 100644
index d31646b..0000000
--- a/test/test_vol_plugin.sh.in
+++ /dev/null
@@ -1,84 +0,0 @@
-#! /bin/sh
-#
-# Copyright by The HDF Group.
-# All rights reserved.
-#
-# This file is part of HDF5. The full HDF5 copyright notice, including
-# terms governing use, modification, and redistribution, is contained in
-# the 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.
-#
-# This shell script is for testing VOL connector plugins.
-#
-srcdir=@srcdir@
-TOP_BUILDDIR=@top_builddir@
-
-EXIT_SUCCESS=0
-EXIT_FAILURE=1
-
-nerrors=0
-verbose=yes
-exit_code=$EXIT_SUCCESS
-
-TEST_NAME=vol_plugin
-TEST_BIN=`pwd`/$TEST_NAME
-FROM_DIR=`pwd`/.libs
-case $(uname) in
- CYGWIN* )
- NULL_VOL_PLUGIN="$FROM_DIR/cygnull_vol_connector*"
- ;;
- *)
- NULL_VOL_PLUGIN="$FROM_DIR/libnull_vol_connector*"
- ;;
-esac
-TEMP_PLUGIN_DIR=null_vol_plugin_dir
-CP="cp -p" # Use -p to preserve mode,ownership, timestamps
-RM="rm -rf"
-
-# Print a line-line message left justified in a field of 70 characters
-# beginning with the word "Testing".
-#
-TESTING() {
- SPACES=" "
- echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012'
-}
-
-# Main Body
-# Create test directory if necessary.
-test -d $TEMP_PLUGIN_DIR || mkdir -p $TEMP_PLUGIN_DIR
-if [ $? != 0 ]; then
- echo "Failed to create VOL connector plugin test directory ($TEMP_PLUGIN_DIR)"
- exit $EXIT_FAILURE
-fi
-
-# Copy plugin for the tests.
-$CP $NULL_VOL_PLUGIN $TEMP_PLUGIN_DIR
-if [ $? != 0 ]; then
- echo "Failed to copy NULL VOL plugin ($NULL_VOL_PLUGIN) to test directory."
- exit $EXIT_FAILURE
-fi
-
-# setup plugin path
-ENVCMD="env HDF5_PLUGIN_PATH=${TEMP_PLUGIN_DIR}"
-
-# Run the test
-$ENVCMD $TEST_BIN
-if [ $? != 0 ]; then
- nerrors=`expr $nerrors + 1`
-fi
-
-# print results
-if test $nerrors -ne 0 ; then
- echo "$nerrors errors encountered"
- exit_code=$EXIT_FAILURE
-else
- echo "All VOL plugin tests passed."
- exit_code=$EXIT_SUCCESS
-fi
-
-# Clean up temporary files/directories and leave
-$RM $TEMP_PLUGIN_DIR
-
-exit $exit_code
diff --git a/test/testhdf5.c b/test/testhdf5.c
index dc5f0aa..b5db71b 100644
--- a/test/testhdf5.c
+++ b/test/testhdf5.c
@@ -45,7 +45,6 @@ main(int argc, char *argv[])
AddTest("config", test_configure, cleanup_configure, "Configure definitions", NULL);
AddTest("metadata", test_metadata, cleanup_metadata, "Encoding/decoding metadata", NULL);
AddTest("checksum", test_checksum, cleanup_checksum, "Checksum algorithm", NULL);
- AddTest("heap", test_heap, NULL, "Memory Heaps", NULL);
AddTest("skiplist", test_skiplist, NULL, "Skip Lists", NULL);
AddTest("refstr", test_refstr, NULL, "Reference Counted Strings", NULL);
AddTest("file", test_file, cleanup_file, "Low-Level File I/O", NULL);
diff --git a/test/testhdf5.h b/test/testhdf5.h
index ba5fa71..c5b8246 100644
--- a/test/testhdf5.h
+++ b/test/testhdf5.h
@@ -203,7 +203,6 @@ extern "C" {
/* Prototypes for the test routines */
void test_metadata(void);
void test_checksum(void);
-void test_heap(void);
void test_refstr(void);
void test_file(void);
void test_h5o(void);
diff --git a/test/theap.c b/test/theap.c
deleted file mode 100644
index 9d5787b..0000000
--- a/test/theap.c
+++ /dev/null
@@ -1,1081 +0,0 @@
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * Copyright by The HDF Group. *
- * Copyright by the Board of Trustees of the University of Illinois. *
- * All rights reserved. *
- * *
- * This file is part of HDF5. The full HDF5 copyright notice, including *
- * terms governing use, modification, and redistribution, is contained in *
- * the 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. *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/*
- Test HDF Heap routines.
-
- REMARKS
-
- DESIGN
-
- BUGS/LIMITATIONS
-
- EXPORTED ROUTINES
-
- AUTHOR
- Quincey Koziol
-
- MODIFICATION HISTORY
- 2/18/03 - Started coding
- */
-
-#include "testhdf5.h"
-#include "H5HPprivate.h"
-
-/* The number of elements in testing arrays */
-#define NUM_ELEMS 1000
-
-/* Objects for testing in heaps */
-typedef struct test_obj {
- H5HP_info_t heap_info; /* Information required for heap. _MUST_ be first */
- int val; /* Actual information for object */
-} test_obj;
-
-/* Array of random element values */
-static test_obj *rand_num;
-
-/* Array of random elements values, sorted in increasing order */
-static test_obj *inc_sort_num;
-
-/* Array of random elements values, sorted in decreasing order */
-static test_obj *dec_sort_num;
-
-static int
-tst_dec_sort(const void *_i1, const void *_i2)
-{
- const test_obj *i1 = (const test_obj *)_i1;
- const test_obj *i2 = (const test_obj *)_i2;
-
- if (i1->val < i2->val)
- return (1);
- else if (i1->val > i2->val)
- return (-1);
- return (0);
-}
-
-static int
-tst_inc_sort(const void *_i1, const void *_i2)
-{
- const test_obj *i1 = (const test_obj *)_i1;
- const test_obj *i2 = (const test_obj *)_i2;
-
- if (i1->val < i2->val)
- return (-1);
- else if (i1->val > i2->val)
- return (1);
- return (0);
-}
-
-/****************************************************************
-**
-** test_heap_init(): Test H5HP (heap) code.
-** Initialize data for Heap testing
-**
-****************************************************************/
-static void
-test_heap_init(void)
-{
- time_t curr_time; /* Current time, for seeding random number generator */
- size_t u; /* Local index variables */
-
- /* Allocate arrays */
- rand_num = (test_obj *)HDmalloc(sizeof(test_obj) * NUM_ELEMS);
- CHECK_PTR(rand_num, "HDmalloc");
- inc_sort_num = (test_obj *)HDmalloc(sizeof(test_obj) * NUM_ELEMS);
- CHECK_PTR(inc_sort_num, "HDmalloc");
- dec_sort_num = (test_obj *)HDmalloc(sizeof(test_obj) * NUM_ELEMS);
- CHECK_PTR(dec_sort_num, "HDmalloc");
-
- /* Create randomized set of numbers */
- curr_time = HDtime(NULL);
- HDsrandom((unsigned)curr_time);
- for (u = 0; u < NUM_ELEMS; u++)
- /* Generate random numbers from -1000 to 1000 */
- rand_num[u].val = (int)(HDrandom() % 2001) - 1001;
-
- /* Sort random numbers into increasing order */
- HDmemcpy(inc_sort_num, rand_num, sizeof(test_obj) * NUM_ELEMS);
- HDqsort(inc_sort_num, (size_t)NUM_ELEMS, sizeof(test_obj), tst_inc_sort);
-
- /* Sort random numbers into decreasing order */
- HDmemcpy(dec_sort_num, rand_num, sizeof(test_obj) * NUM_ELEMS);
- HDqsort(dec_sort_num, (size_t)NUM_ELEMS, sizeof(test_obj), tst_dec_sort);
-} /* end test_heap_init() */
-
-/****************************************************************
-**
-** test_heap_create(): Test basic H5HP (heap) code.
-** Tests creating and closing heaps.
-**
-****************************************************************/
-static void
-test_heap_create(void)
-{
- H5HP_t *heap; /* Heap created */
- herr_t ret; /* Generic return value */
-
- /* Output message about test being performed */
- MESSAGE(6, ("Testing Creating & Closing Heaps\n"));
-
- /* Try creating a maximum Heap */
- heap = H5HP_create(H5HP_MAX_HEAP);
- CHECK_PTR(heap, "H5HP_create");
-
- /* Try closing the heap */
- ret = H5HP_close(heap);
- CHECK(ret, FAIL, "H5HP_close");
-
- /* Try creating a minimum Heap */
- heap = H5HP_create(H5HP_MIN_HEAP);
- CHECK_PTR(heap, "H5HP_create");
-
- /* Try closing the heap */
- ret = H5HP_close(heap);
- CHECK(ret, FAIL, "H5HP_close");
-
-} /* end test_heap_create() */
-
-/****************************************************************
-**
-** test_heap_insert_min(): Test H5HP (heap) code.
-** Tests basic inserting objects into minimum heaps.
-**
-****************************************************************/
-static void
-test_heap_insert_min(void)
-{
- H5HP_t * heap; /* Heap created */
- ssize_t num; /* Number of elements in heap */
- int val; /* Value of object on heap */
- test_obj obj1, obj2, obj3; /* Test objects to insert */
- herr_t ret; /* Generic return value */
-
- /* Output message about test being performed */
- MESSAGE(7, ("Testing Inserting Into Minimum Heaps\n"));
-
- /* Create a Heap */
- heap = H5HP_create(H5HP_MIN_HEAP);
- CHECK_PTR(heap, "H5HP_create");
-
- /* Check that the heap has no elements */
- num = H5HP_count(heap);
- VERIFY(num, 0, "H5HP_count");
-
- /* Insert an object into the heap */
- obj1.val = 100;
- ret = H5HP_insert(heap, 10, &obj1);
- CHECK(ret, FAIL, "H5HP_insert");
-
- /* Check that the heap has one element */
- num = H5HP_count(heap);
- VERIFY(num, 1, "H5HP_count");
-
- /* Check the minimum value on the heap */
- ret = H5HP_top(heap, &val);
- CHECK(ret, FAIL, "H5HP_top");
- VERIFY(val, 10, "H5HP_top");
-
- /* Insert another object into the heap, with value less than top element */
- obj2.val = 50;
- ret = H5HP_insert(heap, 5, &obj2);
- CHECK(ret, FAIL, "H5HP_insert");
-
- /* Check that the heap has two elements */
- num = H5HP_count(heap);
- VERIFY(num, 2, "H5HP_count");
-
- /* Check the minimum value on the heap */
- ret = H5HP_top(heap, &val);
- CHECK(ret, FAIL, "H5HP_top");
- VERIFY(val, 5, "H5HP_top");
-
- /* Insert third object into the heap, with value greater than top element */
- obj3.val = 200;
- ret = H5HP_insert(heap, 20, &obj3);
- CHECK(ret, FAIL, "H5HP_insert");
-
- /* Check that the heap has three elements */
- num = H5HP_count(heap);
- VERIFY(num, 3, "H5HP_count");
-
- /* Check the minimum value on the heap */
- ret = H5HP_top(heap, &val);
- CHECK(ret, FAIL, "H5HP_top");
- VERIFY(val, 5, "H5HP_top");
-
- /* Close the heap */
- ret = H5HP_close(heap);
- CHECK(ret, FAIL, "H5HP_close");
-
-} /* end test_heap_insert_min() */
-
-/****************************************************************
-**
-** test_heap_insert(): Test H5HP (heap) code.
-** Tests basic inserting objects into maximum heaps.
-**
-****************************************************************/
-static void
-test_heap_insert_max(void)
-{
- H5HP_t * heap; /* Heap created */
- ssize_t num; /* Number of elements in heap */
- int val; /* Value of object on heap */
- test_obj obj1, obj2, obj3; /* Test objects to insert */
- herr_t ret; /* Generic return value */
-
- /* Output message about test being performed */
- MESSAGE(7, ("Testing Inserting Into Maximum Heaps\n"));
-
- /* Create a Heap */
- heap = H5HP_create(H5HP_MAX_HEAP);
- CHECK_PTR(heap, "H5HP_create");
-
- /* Check that the heap has no elements */
- num = H5HP_count(heap);
- VERIFY(num, 0, "H5HP_count");
-
- /* Insert an object into the heap */
- obj1.val = 100;
- ret = H5HP_insert(heap, 10, &obj1);
- CHECK(ret, FAIL, "H5HP_insert");
-
- /* Check that the heap has one element */
- num = H5HP_count(heap);
- VERIFY(num, 1, "H5HP_count");
-
- /* Check the maximum value on the heap */
- ret = H5HP_top(heap, &val);
- CHECK(ret, FAIL, "H5HP_top");
- VERIFY(val, 10, "H5HP_top");
-
- /* Insert another object into the heap, with value less than top element */
- obj2.val = 50;
- ret = H5HP_insert(heap, 5, &obj2);
- CHECK(ret, FAIL, "H5HP_insert");
-
- /* Check that the heap has two elements */
- num = H5HP_count(heap);
- VERIFY(num, 2, "H5HP_count");
-
- /* Check the maximum value on the heap */
- ret = H5HP_top(heap, &val);
- CHECK(ret, FAIL, "H5HP_top");
- VERIFY(val, 10, "H5HP_top");
-
- /* Insert third object into the heap, with value greater than top element */
- obj3.val = 200;
- ret = H5HP_insert(heap, 20, &obj3);
- CHECK(ret, FAIL, "H5HP_insert");
-
- /* Check that the heap has three elements */
- num = H5HP_count(heap);
- VERIFY(num, 3, "H5HP_count");
-
- /* Check the maximum value on the heap */
- ret = H5HP_top(heap, &val);
- CHECK(ret, FAIL, "H5HP_top");
- VERIFY(val, 20, "H5HP_top");
-
- /* Close the heap */
- ret = H5HP_close(heap);
- CHECK(ret, FAIL, "H5HP_close");
-
-} /* end test_heap_insert_max() */
-
-/****************************************************************
-**
-** test_heap_insert(): Test H5HP (heap) code.
-** Tests basic inserting objects into heaps.
-**
-****************************************************************/
-static void
-test_heap_insert(void)
-{
- /* Output message about test being performed */
- MESSAGE(6, ("Testing Inserting Into Heaps\n"));
-
- /* Test insertions into minimum & maximum heaps */
- test_heap_insert_max();
- test_heap_insert_min();
-} /* end test_heap_insert() */
-
-/****************************************************************
-**
-** test_heap_insert_many_core (): Tests H5HP (heap) code.
-** "Core" routine called by test_heap_insert_many() routine.
-**
-****************************************************************/
-static void
-test_heap_insert_many_core(H5HP_type_t heap_type, test_obj *arr, size_t nelem, int top_val)
-{
- H5HP_t *heap; /* Heap created */
- ssize_t num; /* Number of elements in heap */
- int val; /* Value of object on heap */
- size_t u; /* Local index variable */
- herr_t ret; /* Generic return value */
-
- /* Create a Heap */
- heap = H5HP_create(heap_type);
- CHECK_PTR(heap, "H5HP_create");
-
- /* Check that the heap has no elements */
- num = H5HP_count(heap);
- VERIFY(num, 0, "H5HP_count");
-
- /* Insert the array elements into the heap */
- for (u = 0; u < nelem; u++) {
- ret = H5HP_insert(heap, arr[u].val, &arr[u]);
- CHECK(ret, FAIL, "H5HP_insert");
- } /* end for */
-
- /* Check that the heap has correct number of elements */
- num = H5HP_count(heap);
- CHECK(num, FAIL, "H5HP_count");
- VERIFY((size_t)num, nelem, "H5HP_count");
-
- /* Check the maximum value on the heap */
- ret = H5HP_top(heap, &val);
- CHECK(ret, FAIL, "H5HP_top");
- VERIFY(val, top_val, "H5HP_top");
-
- /* Close the heap */
- ret = H5HP_close(heap);
- CHECK(ret, FAIL, "H5HP_close");
-} /* end test_heap_insert_many_core() */
-
-/****************************************************************
-**
-** test_heap_insert_many (): Test H5HP (heap) code.
-** Tests inserting many objects into heaps.
-**
-****************************************************************/
-static void
-test_heap_insert_many(void)
-{
- /* Output message about test being performed */
- MESSAGE(6, ("Testing Inserting Many Objects Into Heaps\n"));
-
- /* Test creating a heap from random elements */
- test_heap_insert_many_core(H5HP_MAX_HEAP, rand_num, (size_t)NUM_ELEMS, dec_sort_num[0].val);
-
- /* Test creating a heap from elements in increasing order */
- test_heap_insert_many_core(H5HP_MAX_HEAP, inc_sort_num, (size_t)NUM_ELEMS, dec_sort_num[0].val);
-
- /* Test creating a heap from elements in decreasing order */
- test_heap_insert_many_core(H5HP_MAX_HEAP, dec_sort_num, (size_t)NUM_ELEMS, dec_sort_num[0].val);
-
- /* Test creating a heap from random elements */
- test_heap_insert_many_core(H5HP_MIN_HEAP, rand_num, (size_t)NUM_ELEMS, inc_sort_num[0].val);
-
- /* Test creating a heap from elements in increasing order */
- test_heap_insert_many_core(H5HP_MIN_HEAP, inc_sort_num, (size_t)NUM_ELEMS, inc_sort_num[0].val);
-
- /* Test creating a heap from elements in decreasing order */
- test_heap_insert_many_core(H5HP_MIN_HEAP, dec_sort_num, (size_t)NUM_ELEMS, inc_sort_num[0].val);
-
-} /* end test_heap_insert_many() */
-
-/****************************************************************
-**
-** test_heap_remove_min(): Test H5HP (heap) code.
-** Tests basic removal of objects from minimum heaps.
-**
-****************************************************************/
-static void
-test_heap_remove_min(void)
-{
- H5HP_t * heap; /* Heap created */
- ssize_t num; /* Number of elements in heap */
- int val; /* Value of object on heap */
- void * ptr; /* Pointer for object on heap */
- test_obj obj1, obj2, obj3; /* Test objects to insert */
- herr_t ret; /* Generic return value */
-
- /* Output message about test being performed */
- MESSAGE(7, ("Testing Removing From Minimum Heaps\n"));
-
- /* Create a Heap */
- heap = H5HP_create(H5HP_MIN_HEAP);
- CHECK_PTR(heap, "H5HP_create");
-
- /* Check that the heap has no elements */
- num = H5HP_count(heap);
- VERIFY(num, 0, "H5HP_count");
-
- /* Try removing an object from an empty heap */
- ret = H5HP_remove(heap, &val, &ptr);
- VERIFY(ret, FAIL, "H5HP_remove");
-
- /* Insert an object into the heap */
- obj1.val = 100;
- ret = H5HP_insert(heap, 10, &obj1);
- CHECK(ret, FAIL, "H5HP_insert");
-
- /* Insert another object into the heap, with value less than top element */
- obj2.val = 50;
- ret = H5HP_insert(heap, 5, &obj2);
- CHECK(ret, FAIL, "H5HP_insert");
-
- /* Insert third object into the heap, with value greater than top element */
- obj3.val = 200;
- ret = H5HP_insert(heap, 20, &obj3);
- CHECK(ret, FAIL, "H5HP_insert");
-
- /* Remove first maximum value from heap */
- ret = H5HP_remove(heap, &val, &ptr);
- CHECK(ret, FAIL, "H5HP_remove");
- VERIFY(val, 5, "H5HP_remove");
- CHECK_PTR_EQ(ptr, &obj2, "H5HP_remove");
-
- /* Remove second maximum value from heap */
- ret = H5HP_remove(heap, &val, &ptr);
- CHECK(ret, FAIL, "H5HP_remove");
- VERIFY(val, 10, "H5HP_remove");
- CHECK_PTR_EQ(ptr, &obj1, "H5HP_remove");
-
- /* Remove third maximum value from heap */
- ret = H5HP_remove(heap, &val, &ptr);
- CHECK(ret, FAIL, "H5HP_remove");
- VERIFY(val, 20, "H5HP_remove");
- CHECK_PTR_EQ(ptr, &obj3, "H5HP_remove");
-
- /* Try removing an object from an empty heap */
- ret = H5HP_remove(heap, &val, &ptr);
- VERIFY(ret, FAIL, "H5HP_remove");
-
- /* Close the heap */
- ret = H5HP_close(heap);
- CHECK(ret, FAIL, "H5HP_close");
-
-} /* end test_heap_remove_min() */
-
-/****************************************************************
-**
-** test_heap_remove_max(): Test H5HP (heap) code.
-** Tests basic removal of objects from maximum heaps.
-**
-****************************************************************/
-static void
-test_heap_remove_max(void)
-{
- H5HP_t * heap; /* Heap created */
- ssize_t num; /* Number of elements in heap */
- int val; /* Value of object on heap */
- void * ptr; /* Pointer for object on heap */
- test_obj obj1, obj2, obj3; /* Test objects to insert */
- herr_t ret; /* Generic return value */
-
- /* Output message about test being performed */
- MESSAGE(7, ("Testing Removing From Maximum Heaps\n"));
-
- /* Create a Heap */
- heap = H5HP_create(H5HP_MAX_HEAP);
- CHECK_PTR(heap, "H5HP_create");
-
- /* Check that the heap has no elements */
- num = H5HP_count(heap);
- VERIFY(num, 0, "H5HP_count");
-
- /* Try removing an object from an empty heap */
- ret = H5HP_remove(heap, &val, &ptr);
- VERIFY(ret, FAIL, "H5HP_remove");
-
- /* Insert an object into the heap */
- obj1.val = 100;
- ret = H5HP_insert(heap, 10, &obj1);
- CHECK(ret, FAIL, "H5HP_insert");
-
- /* Insert another object into the heap, with value less than top element */
- obj2.val = 50;
- ret = H5HP_insert(heap, 5, &obj2);
- CHECK(ret, FAIL, "H5HP_insert");
-
- /* Insert third object into the heap, with value greater than top element */
- obj3.val = 200;
- ret = H5HP_insert(heap, 20, &obj3);
- CHECK(ret, FAIL, "H5HP_insert");
-
- /* Remove first maximum value from heap */
- ret = H5HP_remove(heap, &val, &ptr);
- CHECK(ret, FAIL, "H5HP_remove");
- VERIFY(val, 20, "H5HP_remove");
- CHECK_PTR_EQ(ptr, &obj3, "H5HP_remove");
-
- /* Remove second maximum value from heap */
- ret = H5HP_remove(heap, &val, &ptr);
- CHECK(ret, FAIL, "H5HP_remove");
- VERIFY(val, 10, "H5HP_remove");
- CHECK_PTR_EQ(ptr, &obj1, "H5HP_remove");
-
- /* Remove third maximum value from heap */
- ret = H5HP_remove(heap, &val, &ptr);
- CHECK(ret, FAIL, "H5HP_remove");
- VERIFY(val, 5, "H5HP_remove");
- CHECK_PTR_EQ(ptr, &obj2, "H5HP_remove");
-
- /* Try removing an object from an empty heap */
- ret = H5HP_remove(heap, &val, &ptr);
- VERIFY(ret, FAIL, "H5HP_remove");
-
- /* Close the heap */
- ret = H5HP_close(heap);
- CHECK(ret, FAIL, "H5HP_close");
-
-} /* end test_heap_remove_max() */
-
-/****************************************************************
-**
-** test_heap_remove(): Test H5HP (heap) code.
-** Tests basic removal of objects from minimum & maximum heaps.
-**
-****************************************************************/
-static void
-test_heap_remove(void)
-{
- /* Output message about test being performed */
- MESSAGE(6, ("Testing Removing From Heaps\n"));
-
- /* Test removals from minimum & maximum heaps */
- test_heap_remove_max();
- test_heap_remove_min();
-} /* end test_heap_remove() */
-
-/****************************************************************
-**
-** test_heap_remove_many_core (): Tests H5HP (heap) code.
-** "Core" routine called by test_heap_remove_many() routine.
-**
-****************************************************************/
-static void
-test_heap_remove_many_core(H5HP_type_t heap_type, test_obj *arr, size_t nelem)
-{
- H5HP_t * heap; /* Heap created */
- ssize_t num; /* Number of elements in heap */
- int last_val; /* Last value from the heap */
- int val; /* Value of object on heap */
- test_obj *ptr; /* Pointer for object on heap */
- size_t u; /* Local index variable */
- herr_t ret; /* Generic return value */
-
- /* Create a Heap */
- heap = H5HP_create(heap_type);
- CHECK_PTR(heap, "H5HP_create");
-
- /* Check that the heap has no elements */
- num = H5HP_count(heap);
- VERIFY(num, 0, "H5HP_count");
-
- /* Insert the array elements into the heap */
- for (u = 0; u < nelem; u++) {
- ret = H5HP_insert(heap, arr[u].val, &arr[u]);
- CHECK(ret, FAIL, "H5HP_insert");
- } /* end for */
-
- /* Check that the heap has correct number of elements */
- num = H5HP_count(heap);
- CHECK(num, FAIL, "H5HP_count");
- VERIFY((size_t)num, nelem, "H5HP_count");
-
- /* Set an appropriate starting value for the "last" value from heap */
- if (heap_type == H5HP_MAX_HEAP)
- last_val = INT_MAX;
- else
- last_val = INT_MIN;
-
- /* Remove the objects from the heap */
- for (u = 0; u < nelem; u++) {
- ret = H5HP_remove(heap, &val, (void **)&ptr);
- CHECK(ret, FAIL, "H5HP_remove");
- VERIFY(val, ptr->val, "H5HP_remove");
-
- /* Check that the value is correct, based on the heap type */
- if (heap_type == H5HP_MAX_HEAP) {
- if (val > last_val)
- TestErrPrintf("Error on line %d: incorrect value from heap=%d, last_val=%d\n", __LINE__, val,
- last_val);
- } /* end if */
- else {
- if (val < last_val)
- TestErrPrintf("Error on line %d: incorrect value from heap=%d, last_val=%d\n", __LINE__, val,
- last_val);
- } /* end else */
-
- /* Update last value */
- last_val = val;
- } /* end for */
-
- /* Check that the heap has no elements */
- num = H5HP_count(heap);
- VERIFY(num, 0, "H5HP_count");
-
- /* Insert & remove again, to check that completely empty heaps can be added again */
-
- /* Set an appropriate starting value for the "last" value from heap */
- if (heap_type == H5HP_MAX_HEAP)
- last_val = INT_MAX;
- else
- last_val = INT_MIN;
-
- /* Insert the array elements into the heap */
- for (u = 0; u < nelem; u++) {
- ret = H5HP_insert(heap, arr[u].val, &arr[u]);
- CHECK(ret, FAIL, "H5HP_insert");
- } /* end for */
-
- /* Check that the heap has correct number of elements */
- num = H5HP_count(heap);
- CHECK(num, FAIL, "H5HP_count");
- VERIFY((size_t)num, nelem, "H5HP_count");
-
- /* Remove the objects from the heap */
- for (u = 0; u < nelem; u++) {
- ret = H5HP_remove(heap, &val, (void **)&ptr);
- CHECK(ret, FAIL, "H5HP_remove");
- VERIFY(val, ptr->val, "H5HP_remove");
-
- /* Check that the value is correct, based on the heap type */
- if (heap_type == H5HP_MAX_HEAP) {
- if (val > last_val)
- TestErrPrintf("Error on line %d: incorrect value from heap=%d, last_val=%d\n", __LINE__, val,
- last_val);
- } /* end if */
- else {
- if (val < last_val)
- TestErrPrintf("Error on line %d: incorrect value from heap=%d, last_val=%d\n", __LINE__, val,
- last_val);
- } /* end else */
-
- /* Update last value */
- last_val = val;
- } /* end for */
-
- /* Check that the heap has no elements */
- num = H5HP_count(heap);
- VERIFY(num, 0, "H5HP_count");
-
- /* Close the heap */
- ret = H5HP_close(heap);
- CHECK(ret, FAIL, "H5HP_close");
-} /* end test_heap_remove_many_core() */
-
-/****************************************************************
-**
-** test_heap_remove_many (): Test H5HP (heap) code.
-** Tests removing many objects into heaps.
-**
-****************************************************************/
-static void
-test_heap_remove_many(void)
-{
- /* Output message about test being performed */
- MESSAGE(6, ("Testing Removing Many Objects From Heaps\n"));
-
- /* Test removing objects from maximum heap with random elements */
- test_heap_remove_many_core(H5HP_MAX_HEAP, rand_num, (size_t)NUM_ELEMS);
-
- /* Test removing objects from maximum heap with elements already sorted in increasing order */
- test_heap_remove_many_core(H5HP_MAX_HEAP, inc_sort_num, (size_t)NUM_ELEMS);
-
- /* Test removing objects from maximum heap with elements already sorted in decreasing order */
- test_heap_remove_many_core(H5HP_MAX_HEAP, dec_sort_num, (size_t)NUM_ELEMS);
-
- /* Test removing objects from minimum heap with random elements */
- test_heap_remove_many_core(H5HP_MIN_HEAP, rand_num, (size_t)NUM_ELEMS);
-
- /* Test removing objects from minimum heap with elements already sorted in increasing order */
- test_heap_remove_many_core(H5HP_MIN_HEAP, inc_sort_num, (size_t)NUM_ELEMS);
-
- /* Test removing objects from minimum heap with elements already sorted in decreasing order */
- test_heap_remove_many_core(H5HP_MIN_HEAP, dec_sort_num, (size_t)NUM_ELEMS);
-
-} /* end test_heap_remove_many() */
-
-/****************************************************************
-**
-** test_heap_change_min (): Test H5HP (heap) code.
-** Tests changing the priority of an object in a minimum heap
-**
-****************************************************************/
-static void
-test_heap_change_min(void)
-{
- H5HP_t * heap; /* Heap created */
- ssize_t num; /* Number of elements in heap */
- int val; /* Value of object on heap */
- test_obj obj1, obj2, obj3; /* Test objects to insert */
- herr_t ret; /* Generic return value */
-
- /* Output message about test being performed */
- MESSAGE(7, ("Testing Changing Priority of Objects in Minimum Heaps\n"));
-
- /* Create a Heap */
- heap = H5HP_create(H5HP_MIN_HEAP);
- CHECK_PTR(heap, "H5HP_create");
-
- /* Check that the heap has no elements */
- num = H5HP_count(heap);
- VERIFY(num, 0, "H5HP_count");
-
- /* Insert an object into the heap */
- obj1.val = 100;
- ret = H5HP_insert(heap, 10, &obj1);
- CHECK(ret, FAIL, "H5HP_insert");
-
- /* Insert another object into the heap, with value less than top element */
- obj2.val = 50;
- ret = H5HP_insert(heap, 5, &obj2);
- CHECK(ret, FAIL, "H5HP_insert");
-
- /* Insert third object into the heap, with value greater than top element */
- obj3.val = 200;
- ret = H5HP_insert(heap, 20, &obj3);
- CHECK(ret, FAIL, "H5HP_insert");
-
- /* Change priority of first object on heap in way which shouldn't affect heap order */
- ret = H5HP_change(heap, 11, &obj1);
- CHECK(ret, FAIL, "H5HP_change");
-
- /* Check the minimum value on the heap */
- ret = H5HP_top(heap, &val);
- CHECK(ret, FAIL, "H5HP_top");
- VERIFY(val, 5, "H5HP_top");
-
- /* Change priority of first object on heap to be the top object on the heap */
- ret = H5HP_change(heap, 3, &obj1);
- CHECK(ret, FAIL, "H5HP_change");
-
- /* Check the maximum value on the heap */
- ret = H5HP_top(heap, &val);
- CHECK(ret, FAIL, "H5HP_top");
- VERIFY(val, 3, "H5HP_top");
-
- /* Change priority of first object on heap to not be the top object on the heap */
- ret = H5HP_change(heap, 10, &obj1);
- CHECK(ret, FAIL, "H5HP_change");
-
- /* Check the maximum value on the heap */
- ret = H5HP_top(heap, &val);
- CHECK(ret, FAIL, "H5HP_top");
- VERIFY(val, 5, "H5HP_top");
-
- /* Close the heap */
- ret = H5HP_close(heap);
- CHECK(ret, FAIL, "H5HP_close");
-
-} /* end test_heap_change_min() */
-
-/****************************************************************
-**
-** test_heap_change_max (): Test H5HP (heap) code.
-** Tests changing the priority of an object in a maximumheap
-**
-****************************************************************/
-static void
-test_heap_change_max(void)
-{
- H5HP_t * heap; /* Heap created */
- ssize_t num; /* Number of elements in heap */
- int val; /* Value of object on heap */
- test_obj obj1, obj2, obj3; /* Test objects to insert */
- herr_t ret; /* Generic return value */
-
- /* Output message about test being performed */
- MESSAGE(7, ("Testing Changing Priority of Objects in Maximum Heaps\n"));
-
- /* Create a Heap */
- heap = H5HP_create(H5HP_MAX_HEAP);
- CHECK_PTR(heap, "H5HP_create");
-
- /* Check that the heap has no elements */
- num = H5HP_count(heap);
- VERIFY(num, 0, "H5HP_count");
-
- /* Insert an object into the heap */
- obj1.val = 100;
- ret = H5HP_insert(heap, 10, &obj1);
- CHECK(ret, FAIL, "H5HP_insert");
-
- /* Insert another object into the heap, with value less than top element */
- obj2.val = 50;
- ret = H5HP_insert(heap, 5, &obj2);
- CHECK(ret, FAIL, "H5HP_insert");
-
- /* Insert third object into the heap, with value greater than top element */
- obj3.val = 200;
- ret = H5HP_insert(heap, 20, &obj3);
- CHECK(ret, FAIL, "H5HP_insert");
-
- /* Change priority of first object on heap in way which shouldn't affect heap order */
- ret = H5HP_change(heap, 11, &obj1);
- CHECK(ret, FAIL, "H5HP_change");
-
- /* Check the maximum value on the heap */
- ret = H5HP_top(heap, &val);
- CHECK(ret, FAIL, "H5HP_top");
- VERIFY(val, 20, "H5HP_top");
-
- /* Change priority of first object on heap to be the top object on the heap */
- ret = H5HP_change(heap, 21, &obj1);
- CHECK(ret, FAIL, "H5HP_change");
-
- /* Check the maximum value on the heap */
- ret = H5HP_top(heap, &val);
- CHECK(ret, FAIL, "H5HP_top");
- VERIFY(val, 21, "H5HP_top");
-
- /* Change priority of first object on heap to not be the top object on the heap */
- ret = H5HP_change(heap, 10, &obj1);
- CHECK(ret, FAIL, "H5HP_change");
-
- /* Check the maximum value on the heap */
- ret = H5HP_top(heap, &val);
- CHECK(ret, FAIL, "H5HP_top");
- VERIFY(val, 20, "H5HP_top");
-
- /* Close the heap */
- ret = H5HP_close(heap);
- CHECK(ret, FAIL, "H5HP_close");
-
-} /* end test_heap_change() */
-
-/****************************************************************
-**
-** test_heap_change (): Test H5HP (heap) code.
-** Tests changing the priority of an object in maximum & minimum heaps
-**
-****************************************************************/
-static void
-test_heap_change(void)
-{
- /* Output message about test being performed */
- MESSAGE(6, ("Testing Changing Priority of Objects in Heaps\n"));
-
- /* Test removals from minimum & maximum heaps */
- test_heap_change_max();
- test_heap_change_min();
-} /* end test_heap_change() */
-
-/****************************************************************
-**
-** test_heap_incdec_min (): Test H5HP (heap) code.
-** Tests incrementing & decrementing priority of objects on
-** a minimum heap.
-**
-****************************************************************/
-static void
-test_heap_incdec_min(void)
-{
- H5HP_t * heap; /* Heap created */
- ssize_t num; /* Number of elements in heap */
- int val; /* Value of object on heap */
- test_obj obj1, obj2, obj3; /* Test objects to insert */
- herr_t ret; /* Generic return value */
-
- /* Output message about test being performed */
- MESSAGE(7, ("Testing Incrementing & Decrementing Priority of Objects in Minimum Heaps\n"));
-
- /* Create a Heap */
- heap = H5HP_create(H5HP_MIN_HEAP);
- CHECK_PTR(heap, "H5HP_create");
-
- /* Check that the heap has no elements */
- num = H5HP_count(heap);
- VERIFY(num, 0, "H5HP_count");
-
- /* Insert an object into the heap */
- obj1.val = 100;
- ret = H5HP_insert(heap, 6, &obj1);
- CHECK(ret, FAIL, "H5HP_insert");
-
- /* Insert another object into the heap, with value less than top element */
- obj2.val = 50;
- ret = H5HP_insert(heap, 5, &obj2);
- CHECK(ret, FAIL, "H5HP_insert");
-
- /* Insert third object into the heap, with value greater than top element */
- obj3.val = 200;
- ret = H5HP_insert(heap, 20, &obj3);
- CHECK(ret, FAIL, "H5HP_insert");
-
- /* Decrement object one's priority by two to put it on top of the heap */
- ret = H5HP_decr(heap, 2, &obj1);
- CHECK(ret, FAIL, "H5HP_change");
-
- /* Check the minimum value on the heap */
- ret = H5HP_top(heap, &val);
- CHECK(ret, FAIL, "H5HP_top");
- VERIFY(val, 4, "H5HP_top");
-
- /* Decrement object two's priority by two to put it back on top of the heap */
- ret = H5HP_decr(heap, 2, &obj2);
- CHECK(ret, FAIL, "H5HP_change");
-
- /* Check the minimum value on the heap */
- ret = H5HP_top(heap, &val);
- CHECK(ret, FAIL, "H5HP_top");
- VERIFY(val, 3, "H5HP_top");
-
- /* Increment object two's priority by two to return object one to the top */
- ret = H5HP_incr(heap, 2, &obj2);
- CHECK(ret, FAIL, "H5HP_change");
-
- /* Check the minimum value on the heap */
- ret = H5HP_top(heap, &val);
- CHECK(ret, FAIL, "H5HP_top");
- VERIFY(val, 4, "H5HP_top");
-
- /* Close the heap */
- ret = H5HP_close(heap);
- CHECK(ret, FAIL, "H5HP_close");
-
-} /* end test_heap_incdec_min() */
-
-/****************************************************************
-**
-** test_heap_incdec_max (): Test H5HP (heap) code.
-** Tests incrementing & decrementing priority of objects on
-** a maximum heap.
-**
-****************************************************************/
-static void
-test_heap_incdec_max(void)
-{
- H5HP_t * heap; /* Heap created */
- ssize_t num; /* Number of elements in heap */
- int val; /* Value of object on heap */
- test_obj obj1, obj2, obj3; /* Test objects to insert */
- herr_t ret; /* Generic return value */
-
- /* Output message about test being performed */
- MESSAGE(7, ("Testing Incrementing & Decrementing Priority of Objects in Maximum Heaps\n"));
-
- /* Create a Heap */
- heap = H5HP_create(H5HP_MAX_HEAP);
- CHECK_PTR(heap, "H5HP_create");
-
- /* Check that the heap has no elements */
- num = H5HP_count(heap);
- VERIFY(num, 0, "H5HP_count");
-
- /* Insert an object into the heap */
- obj1.val = 100;
- ret = H5HP_insert(heap, 19, &obj1);
- CHECK(ret, FAIL, "H5HP_insert");
-
- /* Insert another object into the heap, with value less than top element */
- obj2.val = 50;
- ret = H5HP_insert(heap, 5, &obj2);
- CHECK(ret, FAIL, "H5HP_insert");
-
- /* Insert third object into the heap, with value greater than top element */
- obj3.val = 200;
- ret = H5HP_insert(heap, 20, &obj3);
- CHECK(ret, FAIL, "H5HP_insert");
-
- /* Increment object one's priority by two to put it on top of the heap */
- ret = H5HP_incr(heap, 2, &obj1);
- CHECK(ret, FAIL, "H5HP_change");
-
- /* Check the maximum value on the heap */
- ret = H5HP_top(heap, &val);
- CHECK(ret, FAIL, "H5HP_top");
- VERIFY(val, 21, "H5HP_top");
-
- /* Increment object three's priority by two to put it back on top of the heap */
- ret = H5HP_incr(heap, 2, &obj3);
- CHECK(ret, FAIL, "H5HP_change");
-
- /* Check the maximum value on the heap */
- ret = H5HP_top(heap, &val);
- CHECK(ret, FAIL, "H5HP_top");
- VERIFY(val, 22, "H5HP_top");
-
- /* Decrement object three's priority by two to return object one to the top */
- ret = H5HP_decr(heap, 2, &obj3);
- CHECK(ret, FAIL, "H5HP_change");
-
- /* Check the maximum value on the heap */
- ret = H5HP_top(heap, &val);
- CHECK(ret, FAIL, "H5HP_top");
- VERIFY(val, 21, "H5HP_top");
-
- /* Close the heap */
- ret = H5HP_close(heap);
- CHECK(ret, FAIL, "H5HP_close");
-
-} /* end test_heap_incdec_max() */
-
-/****************************************************************
-**
-** test_heap_incdec (): Test H5HP (heap) code.
-** Tests incrementing & decrementing priority of objects on
-** maximum & minimum heaps.
-**
-****************************************************************/
-static void
-test_heap_incdec(void)
-{
- /* Output message about test being performed */
- MESSAGE(6, ("Testing Incrementing & Decrementing Priority of Objects in Heaps\n"));
-
- /* Test increments & decrements in minimum & maximum heaps */
- test_heap_incdec_max();
- test_heap_incdec_min();
-} /* end test_heap_incdec() */
-
-/****************************************************************
-**
-** test_heap_term(): Test H5HP (heap) code.
-** Release data for Heap testing
-**
-****************************************************************/
-static void
-test_heap_term(void)
-{
- /* Release arrays */
- if (rand_num)
- HDfree(rand_num);
- if (inc_sort_num)
- HDfree(inc_sort_num);
- if (dec_sort_num)
- HDfree(dec_sort_num);
-} /* end test_heap_term() */
-
-/****************************************************************
-**
-** test_heap(): Main H5HP testing routine.
-**
-****************************************************************/
-void
-test_heap(void)
-{
- /* Output message about test being performed */
- MESSAGE(5, ("Testing Heaps\n"));
-
- /* Initialize Heap testing data */
- test_heap_init();
-
- /* Actual Heap tests */
- test_heap_create(); /* Test Heap creation */
- test_heap_insert(); /* Test basic Heap insertion */
- test_heap_insert_many(); /* Test Heap insertion of many items */
- test_heap_remove(); /* Test basic Heap removal */
- test_heap_remove_many(); /* Test Heap removal of many items */
- test_heap_change(); /* Test changing priority of objects on Heap */
- test_heap_incdec(); /* Test incrementing & decrementing priority of objects on Heap */
-
- /* Release Heap testing data */
- test_heap_term();
-
-} /* end test_heap() */
diff --git a/test/tmisc.c b/test/tmisc.c
index a28e12e..f8bf602 100644
--- a/test/tmisc.c
+++ b/test/tmisc.c
@@ -1083,7 +1083,7 @@ test_misc6(void)
/* Loop through adding attributes to each dataset */
for (u = 0; u < MISC6_NUMATTR; u++) {
/* Create name for attribute */
- HDsprintf(attr_name, "Attr#%u", u);
+ HDsnprintf(attr_name, sizeof(attr_name), "Attr#%u", u);
/* Open the file */
loc_id = H5Fopen(MISC6_FILE, H5F_ACC_RDWR, H5P_DEFAULT);
@@ -3034,7 +3034,7 @@ test_misc18(void)
/* Loop creating attributes on each dataset, flushing them to the file each time */
for (u = 0; u < 10; u++) {
/* Set up attribute name */
- HDsprintf(attr_name, "Attr %u", u);
+ HDsnprintf(attr_name, sizeof(attr_name), "Attr %u", u);
/* Create & close attribute on first dataset */
aid = H5Acreate2(did1, attr_name, H5T_STD_U32LE, sid, H5P_DEFAULT, H5P_DEFAULT);
@@ -5504,7 +5504,7 @@ test_misc30(void)
CHECK(ret, FAIL, "test_misc30_get_info");
}
- HDsprintf(gname, "/g0/group%d", i);
+ HDsnprintf(gname, sizeof(gname), "/g0/group%d", i);
gid = H5Gcreate2(fid, gname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(gid, FAIL, "H5Gcreate2");
diff --git a/test/trefstr.c b/test/trefstr.c
index d0575ab..89e62db 100644
--- a/test/trefstr.c
+++ b/test/trefstr.c
@@ -309,7 +309,7 @@ test_refstr_asprintf_cat(void)
/* Get pointer to raw string in ref-counted string */
s = H5RS_get_str(rs);
CHECK_PTR(s, "H5RS_get_str");
- HDsprintf(buf, "%d-%s", (int)10, "foo");
+ HDsnprintf(buf, sizeof(buf), "%d-%s", (int)10, "foo");
cmp = HDstrcmp(s, buf);
VERIFY(cmp, 0, "HDstrcmp");
@@ -320,7 +320,7 @@ test_refstr_asprintf_cat(void)
/* Get pointer to raw string in ref-counted string */
s = H5RS_get_str(rs);
CHECK_PTR(s, "H5RS_get_str");
- HDsprintf(buf, "%d-%s-%f", (int)10, "foo", (double)20.0);
+ HDsnprintf(buf, sizeof(buf), "%d-%s-%f", (int)10, "foo", (double)20.0);
cmp = HDstrcmp(s, buf);
VERIFY(cmp, 0, "HDstrcmp");
@@ -360,7 +360,7 @@ test_refstr_acat(void)
/* Get pointer to raw string in ref-counted string */
s = H5RS_get_str(rs);
CHECK_PTR(s, "H5RS_get_str");
- HDsprintf(buf, "%s", "foo");
+ HDsnprintf(buf, sizeof(buf), "%s", "foo");
cmp = HDstrcmp(s, buf);
VERIFY(cmp, 0, "HDstrcmp");
@@ -371,7 +371,7 @@ test_refstr_acat(void)
/* Get pointer to raw string in ref-counted string */
s = H5RS_get_str(rs);
CHECK_PTR(s, "H5RS_get_str");
- HDsprintf(buf, "%s", "foobar");
+ HDsnprintf(buf, sizeof(buf), "%s", "foobar");
cmp = HDstrcmp(s, buf);
VERIFY(cmp, 0, "HDstrcmp");
@@ -386,7 +386,7 @@ test_refstr_acat(void)
/* Get pointer to raw string in ref-counted string */
s = H5RS_get_str(rs);
CHECK_PTR(s, "H5RS_get_str");
- HDsprintf(buf, "%s", "foobar");
+ HDsnprintf(buf, sizeof(buf), "%s", "foobar");
large_str2 = HDmalloc(1024 + 6);
CHECK_PTR(large_str2, "HDmalloc");
HDstrcpy(large_str2, "foobar");
diff --git a/test/tselect.c b/test/tselect.c
index d9b625b..0d4176b 100644
--- a/test/tselect.c
+++ b/test/tselect.c
@@ -10862,13 +10862,15 @@ test_shape_same_dr__full_space_vs_slice(int test_num, int small_rank, int large_
HDassert(edge_size > 0);
HDassert(edge_size <= 1000);
- HDsprintf(test_desc_0, "\tn-cube slice through m-cube (n <= m) test %d.\n", test_num);
+ HDsnprintf(test_desc_0, sizeof(test_desc_0), "\tn-cube slice through m-cube (n <= m) test %d.\n",
+ test_num);
MESSAGE(7, (test_desc_0));
/* This statement must be updated if SS_DR_MAX_RANK is changed */
- HDsprintf(test_desc_1, "\t\tranks: %d/%d offset: %d dim_selected: %d/%d/%d/%d/%d.\n", small_rank,
- large_rank, offset, (int)dim_selected[0], (int)dim_selected[1], (int)dim_selected[2],
- (int)dim_selected[3], (int)dim_selected[4]);
+ HDsnprintf(test_desc_1, sizeof(test_desc_1),
+ "\t\tranks: %d/%d offset: %d dim_selected: %d/%d/%d/%d/%d.\n", small_rank, large_rank, offset,
+ (int)dim_selected[0], (int)dim_selected[1], (int)dim_selected[2], (int)dim_selected[3],
+ (int)dim_selected[4]);
MESSAGE(7, (test_desc_1));
/* copy the edge size into the dims array */
@@ -11120,15 +11122,16 @@ test_shape_same_dr__checkerboard(int test_num, int small_rank, int large_rank, i
HDassert(dims_selected >= 0);
HDassert(dims_selected <= large_rank);
- HDsprintf(test_desc_0, "\tcheckerboard n-cube slice through m-cube (n <= m) test %d.\n", test_num);
+ HDsnprintf(test_desc_0, sizeof(test_desc_0),
+ "\tcheckerboard n-cube slice through m-cube (n <= m) test %d.\n", test_num);
MESSAGE(7, (test_desc_0));
/* This statement must be updated if SS_DR_MAX_RANK is changed */
- HDsprintf(test_desc_1,
- "\tranks: %d/%d edge/chkr size: %d/%d offset: %d dim_selected: %d/%d/%d/%d/%d:%d.\n",
- small_rank, large_rank, (int)edge_size, (int)checker_size, offset, (int)dim_selected[0],
- (int)dim_selected[1], (int)dim_selected[2], (int)dim_selected[3], (int)dim_selected[4],
- dims_selected);
+ HDsnprintf(test_desc_1, sizeof(test_desc_1),
+ "\tranks: %d/%d edge/chkr size: %d/%d offset: %d dim_selected: %d/%d/%d/%d/%d:%d.\n",
+ small_rank, large_rank, (int)edge_size, (int)checker_size, offset, (int)dim_selected[0],
+ (int)dim_selected[1], (int)dim_selected[2], (int)dim_selected[3], (int)dim_selected[4],
+ dims_selected);
MESSAGE(7, (test_desc_1));
/* copy the edge size into the dims array */
@@ -11664,15 +11667,16 @@ test_shape_same_dr__irregular(int test_num, int small_rank, int large_rank, int
HDassert(dims_selected >= 0);
HDassert(dims_selected <= large_rank);
- HDsprintf(test_desc_0, "\tirregular sub set of n-cube slice through m-cube (n <= m) test %d.\n",
- test_num);
+ HDsnprintf(test_desc_0, sizeof(test_desc_0),
+ "\tirregular sub set of n-cube slice through m-cube (n <= m) test %d.\n", test_num);
MESSAGE(7, (test_desc_0));
/* This statement must be updated if SS_DR_MAX_RANK is changed */
- HDsprintf(test_desc_1, "\tranks: %d/%d edge: %d s/p offset: %d/%d dim_selected: %d/%d/%d/%d/%d:%d.\n",
- small_rank, large_rank, edge_size, slice_offset, pattern_offset, (int)dim_selected[0],
- (int)dim_selected[1], (int)dim_selected[2], (int)dim_selected[3], (int)dim_selected[4],
- dims_selected);
+ HDsnprintf(test_desc_1, sizeof(test_desc_1),
+ "\tranks: %d/%d edge: %d s/p offset: %d/%d dim_selected: %d/%d/%d/%d/%d:%d.\n", small_rank,
+ large_rank, edge_size, slice_offset, pattern_offset, (int)dim_selected[0],
+ (int)dim_selected[1], (int)dim_selected[2], (int)dim_selected[3], (int)dim_selected[4],
+ dims_selected);
MESSAGE(7, (test_desc_1));
/* copy the edge size into the dims array */
diff --git a/test/tvlstr.c b/test/tvlstr.c
index 68f6124..5168d39 100644
--- a/test/tvlstr.c
+++ b/test/tvlstr.c
@@ -817,33 +817,33 @@ test_vl_rewrite(void)
/* Create in file 1 */
for (i = 0; i < REWRITE_NDATASETS; i++) {
- HDsprintf(name, "/set_%d", i);
+ HDsnprintf(name, sizeof(name), "/set_%d", i);
write_scalar_dset(file1, type, space, name, name);
}
/* Effectively copy data from file 1 to 2 */
for (i = 0; i < REWRITE_NDATASETS; i++) {
- HDsprintf(name, "/set_%d", i);
+ HDsnprintf(name, sizeof(name), "/set_%d", i);
read_scalar_dset(file1, type, space, name, name);
write_scalar_dset(file2, type, space, name, name);
}
/* Read back from file 2 */
for (i = 0; i < REWRITE_NDATASETS; i++) {
- HDsprintf(name, "/set_%d", i);
+ HDsnprintf(name, sizeof(name), "/set_%d", i);
read_scalar_dset(file2, type, space, name, name);
} /* end for */
/* Remove from file 2. */
for (i = 0; i < REWRITE_NDATASETS; i++) {
- HDsprintf(name, "/set_%d", i);
+ HDsnprintf(name, sizeof(name), "/set_%d", i);
ret = H5Ldelete(file2, name, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Ldelete");
} /* end for */
/* Effectively copy from file 1 to file 2 */
for (i = 0; i < REWRITE_NDATASETS; i++) {
- HDsprintf(name, "/set_%d", i);
+ HDsnprintf(name, sizeof(name), "/set_%d", i);
read_scalar_dset(file1, type, space, name, name);
write_scalar_dset(file2, type, space, name, name);
} /* end for */
diff --git a/test/twriteorder.c b/test/twriteorder.c
index 497542a..c58b030 100644
--- a/test/twriteorder.c
+++ b/test/twriteorder.c
@@ -63,7 +63,7 @@
/* This test uses many POSIX things that are not available on
* Windows.
*/
-#ifdef H5_HAVE_UNISTD_H
+#if defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID)
#define DATAFILE "twriteorder.dat"
/* #define READERS_MAX 10 */ /* max number of readers */
@@ -466,7 +466,7 @@ done:
return ret_value;
}
-#else /* H5_HAVE_UNISTD_H */
+#else /* defined(H5_HAVE_FORK && defined(H5_HAVE_WAITPID) */
int
main(void)
@@ -475,4 +475,4 @@ main(void)
return EXIT_SUCCESS;
} /* end main() */
-#endif /* H5_HAVE_UNISTD_H */
+#endif /* defined(H5_HAVE_FORK && defined(H5_HAVE_WAITPID) */
diff --git a/test/unregister.c b/test/unregister.c
index 803f8373..ebb51b1 100644
--- a/test/unregister.c
+++ b/test/unregister.c
@@ -136,7 +136,7 @@ test_unregister_filters(hid_t fapl_id)
/* Create multiple groups under the main group */
for (i = 0; i < GROUP_ITERATION; i++) {
- HDsprintf(group_name, "group_%d", i);
+ HDsnprintf(group_name, sizeof(group_name), "group_%d", i);
if ((gid_loop = H5Gcreate2(gid, group_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto error;
if (H5Gclose(gid_loop) < 0)
diff --git a/test/use_append_chunk.c b/test/use_append_chunk.c
index 107615a..185cb26 100644
--- a/test/use_append_chunk.c
+++ b/test/use_append_chunk.c
@@ -63,7 +63,7 @@
/* This test uses many POSIX things that are not available on
* Windows.
*/
-#ifdef H5_HAVE_UNISTD_H
+#if defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID)
#include "use.h"
@@ -270,7 +270,7 @@ done:
return (ret_value);
}
-#else /* H5_HAVE_UNISTD_H */
+#else /* defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID) */
int
main(void)
@@ -279,4 +279,4 @@ main(void)
return EXIT_SUCCESS;
} /* end main() */
-#endif /* H5_HAVE_UNISTD_H */
+#endif /* defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID) */
diff --git a/test/use_append_mchunks.c b/test/use_append_mchunks.c
index 47c9f92..60f63c0 100644
--- a/test/use_append_mchunks.c
+++ b/test/use_append_mchunks.c
@@ -55,7 +55,7 @@
/* This test uses many POSIX things that are not available on
* Windows.
*/
-#ifdef H5_HAVE_UNISTD_H
+#if defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID)
#include "use.h"
@@ -265,7 +265,7 @@ done:
return (ret_value);
} /* end main() */
-#else /* H5_HAVE_UNISTD_H */
+#else /* defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID) */
int
main(void)
@@ -274,4 +274,4 @@ main(void)
return EXIT_SUCCESS;
} /* end main() */
-#endif /* H5_HAVE_UNISTD_H */
+#endif /* defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID) */
diff --git a/test/vds_env.c b/test/vds_env.c
index 17c3876..e01f2e0 100644
--- a/test/vds_env.c
+++ b/test/vds_env.c
@@ -346,8 +346,9 @@ main(void)
/* Display testing info */
low_string = h5_get_version_string(low);
high_string = h5_get_version_string(high);
- HDsprintf(msg, "Testing virtual dataset with file version bounds: (%s, %s):", low_string,
- high_string);
+ HDsnprintf(msg, sizeof(msg),
+ "Testing virtual dataset with file version bounds: (%s, %s):", low_string,
+ high_string);
HDputs(msg);
for (bit_config = 0; bit_config < TEST_IO_NTESTS; bit_config++) {
diff --git a/test/vfd.c b/test/vfd.c
index 4f28766..1b83228 100644
--- a/test/vfd.c
+++ b/test/vfd.c
@@ -86,6 +86,60 @@ static int __k;
HDprintf((__k % 4 == 0) ? " %02X" : " %02X", (unsigned char)(buf)[__k]); \
} /* end #define HEXPRINT() */
+/* Macro SET_SIZE()
+ *
+ * Helper macro to track the sizes of entries in a vector
+ * I/O call when stepping through the vector incrementally.
+ * Assuming that bool_size_fixed is initialized to FALSE
+ * before the scan, this macro will detect the sizes array
+ * optimization for the case in which all remaining entries
+ * are of the same size, and set size_value accordingly.
+ *
+ * JRM -- 3/11/21
+ */
+#define SET_SIZE(bool_size_fixed, sizes_array, size_value, idx) \
+ do { \
+ if (!(bool_size_fixed)) { \
+ \
+ if ((sizes_array)[idx] == 0) { \
+ \
+ HDassert((idx) > 0); \
+ (bool_size_fixed) = TRUE; \
+ } \
+ else { \
+ \
+ (size_value) = (sizes_array)[idx]; \
+ } \
+ } \
+ } while (FALSE)
+
+/* Macro SET_TYPE()
+ *
+ * Helper macro to track the types of entries in a vector
+ * I/O call when stepping through the vector incrementally.
+ * Assuming that bool_type_fixed is initialized to FALSE
+ * before the scan, this macro will detect the types array
+ * optimization for the case in which all remaining entries
+ * are of the same type, and set type_value accordingly.
+ *
+ * JRM -- 3/11/21
+ */
+#define SET_TYPE(bool_type_fixed, types_array, type_value, idx) \
+ do { \
+ if (!(bool_type_fixed)) { \
+ \
+ if ((types_array)[idx] == H5FD_MEM_NOLIST) { \
+ \
+ HDassert((idx) > 0); \
+ (bool_type_fixed) = TRUE; \
+ } \
+ else { \
+ \
+ (type_value) = (types_array)[idx]; \
+ } \
+ } \
+ } while (FALSE)
+
/* Helper structure to pass around dataset information.
*/
struct splitter_dataset_def {
@@ -3420,6 +3474,60 @@ error:
#undef SPLITTER_TEST_FAULT
+/*****************************************************************************
+ *
+ * Function setup_rand()
+ *
+ * Purpose: Use gettimeofday() to obtain a seed for rand(), print the
+ * seed to stdout, and then pass it to srand().
+ *
+ * This is a version of the same routine in
+ * testpar/t_cache.c modified for use in serial tests.
+ *
+ * Return: void.
+ *
+ * Programmer: JRM -- 6/20/20
+ *
+ *****************************************************************************/
+static void
+setup_rand(void)
+{
+ hbool_t use_predefined_seed = FALSE;
+ unsigned predefined_seed = 18669;
+ unsigned seed;
+ struct timeval tv;
+
+ if (use_predefined_seed) {
+
+ seed = predefined_seed;
+
+ HDfprintf(stdout, "\n%s: predefined_seed = %d.\n\n", __func__, seed);
+ HDfflush(stdout);
+
+ HDsrand(seed);
+ }
+ else {
+
+ if (HDgettimeofday(&tv, NULL) != 0) {
+
+ HDfprintf(stdout, "\n%s: gettimeofday() failed -- srand() not called.\n\n", __func__);
+ HDfflush(stdout);
+ }
+ else {
+
+ seed = (unsigned)tv.tv_usec;
+
+ HDfprintf(stdout, "\n%s: seed = %d.\n\n", __func__, seed);
+ HDfflush(stdout);
+
+ HDsrand(seed);
+ }
+ }
+
+ return;
+
+} /* setup_rand() */
+
/*
* Callback implementations for ctl feature testing VFD
*/
@@ -3488,6 +3596,7 @@ H5FD__ctl_test_vfd_ctl(H5FD_t H5_ATTR_UNUSED *_file, uint64_t op_code, uint64_t
/* Minimal VFD for ctl feature tests */
static const H5FD_class_t H5FD_ctl_test_vfd_g = {
+ H5FD_CLASS_VERSION, /* struct version */
(H5FD_class_value_t)201, /* value */
"ctl_test_vfd", /* name */
HADDR_MAX, /* maxaddr */
@@ -3516,6 +3625,10 @@ static const H5FD_class_t H5FD_ctl_test_vfd_g = {
NULL, /* get_handle */
H5FD__ctl_test_vfd_read, /* read */
H5FD__ctl_test_vfd_write, /* write */
+ NULL, /* read_vector */
+ NULL, /* write_vector */
+ NULL, /* read_selection */
+ NULL, /* write_selection */
NULL, /* flush */
NULL, /* truncate */
NULL, /* lock */
@@ -3915,6 +4028,1922 @@ error:
}
/*-------------------------------------------------------------------------
+ * Function: test_vector_io__setup_v
+ *
+ * Purpose: Construct and initialize a vector of I/O requests used
+ * to test vector I/O. Note that while the vectors are
+ * allocated and initialized, they are not assigned
+ * base addresses.
+ *
+ * All arrays parameters are presumed to be of length
+ * count.
+ *
+ * Return: Return TRUE if successful, and FALSE if any errors
+ * are encountered.
+ *
+ * Programmer: John Mainzer
+ * 6/21/20
+ *
+ * Modifications:
+ *
+ * None.
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static hbool_t
+test_vector_io__setup_v(uint32_t count, H5FD_mem_t types[], haddr_t addrs[], size_t sizes[],
+ void *write_bufs[], void *read_bufs[], char base_fill_char)
+{
+ hbool_t result = TRUE; /* will set to FALSE on failure */
+ char fill_char = base_fill_char;
+ uint32_t i;
+ uint32_t j;
+ H5FD_mem_t mem_types[6] = {H5FD_MEM_SUPER, H5FD_MEM_BTREE, H5FD_MEM_DRAW,
+ H5FD_MEM_GHEAP, H5FD_MEM_LHEAP, H5FD_MEM_OHDR};
+
+ /* set the arrays of pointers to the write and read buffers to NULL,
+ * so that we can release memory on failure.
+ */
+ for (i = 0; i < count; i++) {
+
+ write_bufs[i] = NULL;
+ read_bufs[i] = NULL;
+ }
+
+ for (i = 0; i < count; i++) {
+
+ types[i] = mem_types[i % 6];
+
+ addrs[i] = HADDR_UNDEF;
+
+ sizes[i] = (size_t)((rand() & 1023) + 1);
+
+ write_bufs[i] = HDmalloc(sizes[i] + 1);
+ read_bufs[i] = HDmalloc(sizes[i] + 1);
+
+ if ((NULL == write_bufs[i]) || (NULL == read_bufs[i])) {
+
+ HDfprintf(stderr, "%s: can't malloc read / write bufs.\n", __func__);
+ result = FALSE;
+ break;
+ }
+
+ for (j = 0; j < sizes[i]; j++) {
+
+ ((char *)(write_bufs[i]))[j] = fill_char;
+ ((char *)(read_bufs[i]))[j] = '\0';
+ }
+
+ ((char *)(write_bufs[i]))[sizes[i]] = '\0';
+ ((char *)(read_bufs[i]))[sizes[i]] = '\0';
+
+ fill_char++;
+ }
+
+ if (!result) { /* free buffers */
+
+ for (i = 0; i < count; i++) {
+
+ if (write_bufs[i]) {
+
+ HDfree(write_bufs[i]);
+ write_bufs[i] = NULL;
+ }
+
+ if (read_bufs[i]) {
+
+ HDfree(read_bufs[i]);
+ read_bufs[i] = NULL;
+ }
+ }
+ }
+
+ return (result);
+
+} /* end test_vector_io__setup_v() */
+
+/*-------------------------------------------------------------------------
+ * Function: test_vector_io__setup_fixed_size_v
+ *
+ * Purpose: To test the optimization allowing short sizes and types
+ * arrays, construct and initialize a vector of I/O requests
+ * with each request of the same size and type, and use the
+ * optimizatin to allow reduced length sizes and types
+ * vectors. Since the function is supplied with types and
+ * sizes vectors of length count, simulate shorter vectors
+ * by initializing the sizes and types vectors to values
+ * that will cause failure if used.
+ *
+ * All arrays parameters are presumed to be of length
+ * count. Count is presumed to be a power of 2, and at
+ * least 2.
+ *
+ * Return: Return TRUE if successful, and FALSE if any errors
+ * are encountered.
+ *
+ * Programmer: John Mainzer
+ * 3/10/21
+ *
+ * Modifications:
+ *
+ * None.
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static hbool_t
+test_vector_io__setup_fixed_size_v(uint32_t count, H5FD_mem_t types[], haddr_t addrs[], size_t sizes[],
+ void *write_bufs[], void *read_bufs[], char base_fill_char)
+{
+ hbool_t result = TRUE; /* will set to FALSE on failure */
+ char fill_char = base_fill_char;
+ uint32_t fix_point;
+ uint32_t i;
+ uint32_t j;
+ uint32_t k;
+ H5FD_mem_t mem_types[6] = {H5FD_MEM_SUPER, H5FD_MEM_BTREE, H5FD_MEM_DRAW,
+ H5FD_MEM_GHEAP, H5FD_MEM_LHEAP, H5FD_MEM_OHDR};
+
+ /* set the arrays of pointers to the write and read buffers to NULL,
+ * so that we can release memory on failure.
+ *
+ * Set the types[] and sizes[] arrays to invalid / improbable values
+ * so that use of these values will trigger failures.
+ */
+ for (i = 0; i < count; i++) {
+
+ write_bufs[i] = NULL;
+ read_bufs[i] = NULL;
+ types[i] = H5FD_MEM_NTYPES;
+ sizes[i] = SIZE_MAX;
+ }
+
+ /* randomly select the point in the vector after which all entries are
+ * fixed at the same size and type. Observe that 0 <= fix_point <
+ * count / 2.
+ */
+ fix_point = ((uint32_t)rand() & (count - 1)) / 2;
+
+ HDassert(fix_point < count / 2);
+
+ for (i = 0; i < count; i++) {
+
+ if (i <= fix_point) {
+
+ types[i] = mem_types[i % 6];
+
+ addrs[i] = HADDR_UNDEF;
+
+ sizes[i] = (size_t)((rand() & 1023) + 1);
+
+ write_bufs[i] = HDmalloc(sizes[i] + 1);
+ read_bufs[i] = HDmalloc(sizes[i] + 1);
+ }
+ else {
+
+ if (i == fix_point + 1) {
+
+ /* set the sentinels that indicate that all remaining
+ * types and sizes are the same as the previous value.
+ */
+ types[i] = H5FD_MEM_NOLIST;
+ sizes[i] = 0;
+ }
+
+ addrs[i] = HADDR_UNDEF;
+
+ write_bufs[i] = HDmalloc(sizes[fix_point] + 1);
+ read_bufs[i] = HDmalloc(sizes[fix_point] + 1);
+ }
+
+ if ((NULL == write_bufs[i]) || (NULL == read_bufs[i])) {
+
+ HDfprintf(stderr, "%s: can't malloc read / write bufs.\n", __func__);
+ result = FALSE;
+ break;
+ }
+
+ /* need to avoid examining sizes beyond the fix_point */
+ k = MIN(i, fix_point);
+
+ for (j = 0; j < sizes[k]; j++) {
+
+ ((char *)(write_bufs[i]))[j] = fill_char;
+ ((char *)(read_bufs[i]))[j] = '\0';
+ }
+
+ ((char *)(write_bufs[i]))[sizes[k]] = '\0';
+ ((char *)(read_bufs[i]))[sizes[k]] = '\0';
+
+ fill_char++;
+ }
+
+ if (!result) { /* free buffers */
+
+ for (i = 0; i < count; i++) {
+
+ if (write_bufs[i]) {
+
+ HDfree(write_bufs[i]);
+ write_bufs[i] = NULL;
+ }
+
+ if (read_bufs[i]) {
+
+ HDfree(read_bufs[i]);
+ read_bufs[i] = NULL;
+ }
+ }
+ }
+
+ return (result);
+
+} /* end test_vector_io__setup_fixed_size_v() */
+
+/*-------------------------------------------------------------------------
+ * Function: test_vector_io__read_v_indiv
+ *
+ * Purpose: Read the supplied vector as a sequence of individual
+ * reads.
+ *
+ * All arrays parameters are presumed to be of length
+ * count.
+ *
+ * Return: Return TRUE if successful, and FALSE if any errors
+ * are encountered.
+ *
+ * Programmer: John Mainzer
+ * 6/21/20
+ *
+ * Modifications:
+ *
+ * None.
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static hbool_t
+test_vector_io__read_v_indiv(H5FD_t *lf, uint32_t count, H5FD_mem_t types[], haddr_t addrs[], size_t sizes[],
+ void *read_bufs[])
+{
+ hbool_t size_fixed = FALSE;
+ hbool_t type_fixed = FALSE;
+ hbool_t result = TRUE; /* will set to FALSE on failure */
+ hbool_t verbose = FALSE;
+ uint32_t i;
+ size_t size = SIZE_MAX;
+ H5FD_mem_t type = H5FD_MEM_NTYPES;
+
+ for (i = 0; i < count; i++) {
+
+ SET_SIZE(size_fixed, sizes, size, i);
+
+ SET_TYPE(type_fixed, types, type, i);
+
+ if (H5FDread(lf, type, H5P_DEFAULT, addrs[i], size, read_bufs[i]) < 0) {
+
+ if (verbose) {
+
+ HDfprintf(stdout, "%s: H5FDread() failed on entry %d.\n", __func__, i);
+ }
+ result = FALSE;
+ break;
+ }
+ }
+
+ return (result);
+
+} /* end test_vector_io__read_v_indiv() */
+
+/*-------------------------------------------------------------------------
+ * Function: test_vector_io__write_v_indiv
+ *
+ * Purpose: Write the supplied vector as a sequence of individual
+ * writes.
+ *
+ * All arrays parameters are presumed to be of length
+ * count.
+ *
+ * Return: Return TRUE if successful, and FALSE if any errors
+ * are encountered.
+ *
+ * Programmer: John Mainzer
+ * 6/21/20
+ *
+ * Modifications:
+ *
+ * None.
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static hbool_t
+test_vector_io__write_v_indiv(H5FD_t *lf, uint32_t count, H5FD_mem_t types[], haddr_t addrs[], size_t sizes[],
+ void *write_bufs[])
+{
+ hbool_t size_fixed = FALSE;
+ hbool_t type_fixed = FALSE;
+ hbool_t result = TRUE; /* will set to FALSE on failure */
+ hbool_t verbose = FALSE;
+ uint32_t i;
+ size_t size = SIZE_MAX;
+ H5FD_mem_t type = H5FD_MEM_NTYPES;
+
+ for (i = 0; i < count; i++) {
+
+ SET_SIZE(size_fixed, sizes, size, i);
+
+ SET_TYPE(type_fixed, types, type, i);
+
+ if (H5FDwrite(lf, type, H5P_DEFAULT, addrs[i], size, write_bufs[i]) < 0) {
+
+ if (verbose) {
+
+ HDfprintf(stdout, "%s: HDwrite() failed on entry %d.\n", __func__, i);
+ }
+ result = FALSE;
+ break;
+ }
+ }
+
+ return (result);
+
+} /* end test_vector_io__write_v_indiv() */
+
+/*-------------------------------------------------------------------------
+ *
+ * Function: test_vector_io__verify_v
+ *
+ * Purpose: Verify that the read and write buffers of the supplied
+ * vectors are identical.
+ *
+ * Return: TRUE if the read and write vectors are identical, and
+ * FALSE otherwise.
+ *
+ * Programmer: John Mainzer
+ * 6/21/20
+ *
+ * Changes: None.
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static hbool_t
+test_vector_io__verify_v(uint32_t count, H5FD_mem_t types[], size_t sizes[], void *write_bufs[],
+ void *read_bufs[], const char *name)
+{
+ hbool_t size_fixed = FALSE;
+ hbool_t type_fixed = FALSE;
+ hbool_t identical = TRUE;
+ hbool_t verbose = TRUE;
+ uint32_t i;
+ size_t j;
+ char * w_buf;
+ char * r_buf;
+ const char *mem_type_names[7] = {"H5FD_MEM_DEFAULT", "H5FD_MEM_SUPER", "H5FD_MEM_BTREE", "H5FD_MEM_DRAW",
+ "H5FD_MEM_GHEAP", "H5FD_MEM_LHEAP", "H5FD_MEM_OHDR"};
+ size_t size = SIZE_MAX;
+ H5FD_mem_t type = H5FD_MEM_NTYPES;
+
+ i = 0;
+
+ while ((i < count) && (identical)) {
+
+ SET_SIZE(size_fixed, sizes, size, i);
+
+ SET_TYPE(type_fixed, types, type, i);
+
+ w_buf = (char *)(write_bufs[i]);
+ r_buf = (char *)(read_bufs[i]);
+
+ j = 0;
+ while ((j < size) && (identical)) {
+
+ if (w_buf[j] != r_buf[j]) {
+
+ identical = FALSE;
+
+ if (verbose) {
+
+ HDfprintf(stdout, "\n\nread/write buf mismatch in vector/entry");
+ HDfprintf(stdout, "\"%s\"/%u at offset %llu/%llu w/r = %c/%c type = %s\n\n", name,
+ (unsigned)i, (long long unsigned)j, (long long unsigned)size, w_buf[j],
+ r_buf[j], mem_type_names[type]);
+ }
+ }
+ j++;
+ }
+ i++;
+ }
+
+ return (identical);
+
+} /* end test_vector_io__verify_v() */
+
+/*-------------------------------------------------------------------------
+ *
+ * Function: test_vector_io__dump_test_vectors
+ *
+ * Purpose: Print a set of test vectors to stdout.
+ * Vectors are assumed to be of length count, and
+ * buffers must be either NULL, or null terminate strings
+ * of char.
+ *
+ * Return: void.
+ *
+ * Programmer: John Mainzer
+ * 6/21/20
+ *
+ * Changes: None.
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static void
+test_vector_io__dump_test_vectors(uint32_t count, H5FD_mem_t types[], haddr_t addrs[], size_t sizes[],
+ void *write_bufs[], void *read_bufs[], const char *name)
+{
+ hbool_t size_fixed = FALSE;
+ hbool_t type_fixed = FALSE;
+ uint32_t i;
+ const char *mem_type_names[7] = {"H5FD_MEM_DEFAULT", "H5FD_MEM_SUPER", "H5FD_MEM_BTREE", "H5FD_MEM_DRAW",
+ "H5FD_MEM_GHEAP", "H5FD_MEM_LHEAP", "H5FD_MEM_OHDR"};
+ size_t size = SIZE_MAX;
+ H5FD_mem_t type = H5FD_MEM_NTYPES;
+
+ char *w_buf;
+ char *r_buf;
+
+ HDfprintf(stdout, "\n\nDumping test vector \"%s\" of length %d\n\n", name, count);
+
+ for (i = 0; i < count; i++) {
+
+ SET_SIZE(size_fixed, sizes, size, i);
+
+ SET_TYPE(type_fixed, types, type, i);
+
+ HDassert((H5FD_MEM_DEFAULT <= type) && (type <= H5FD_MEM_OHDR));
+
+ w_buf = (char *)(write_bufs[i]);
+
+ if (read_bufs) {
+
+ r_buf = (char *)(read_bufs[i]);
+ }
+ else {
+
+ r_buf = NULL;
+ }
+
+ HDfprintf(stdout, "%u: addr/len = %llu/%llu, type = %s, w_buf = \"%s\"\n", (unsigned)i,
+ (long long unsigned)(addrs[i]), (long long unsigned)(size), mem_type_names[type], w_buf);
+
+ if (r_buf) {
+
+ HDfprintf(stdout, " r_buf = \"%s\"\n", r_buf);
+ }
+ }
+
+ return;
+
+} /* end test_vector_io__dump_test_vectors() */
+
+/*-------------------------------------------------------------------------
+ * Function: test_vector_io
+ *
+ * Purpose: Test I/O using the vector I/O VFD public VFD calls.
+ *
+ * Test proceeds as follows:
+ *
+ * 1) read / write vectors and verify results
+ *
+ * 2) write individual / read vector and verify results
+ *
+ * 3) write vector / read individual and verify results
+ *
+ * 4) Close and then re-open the file, verify data written
+ * above.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: John Mainzer
+ * 6/20/20
+ *
+ * Changes: None.
+ *
+ *-------------------------------------------------------------------------
+ */
+#define VECTOR_LEN 16
+
+static herr_t
+test_vector_io(const char *vfd_name)
+{
+ char test_title[80];
+ hbool_t size_fixed_0 = FALSE; /* whether remaining entry */
+ hbool_t size_fixed_1 = FALSE; /* sizes in vector are fixed. */
+ hbool_t size_fixed_2 = FALSE; /* */
+ hbool_t type_fixed_0 = FALSE; /* whether remaining entry */
+ hbool_t type_fixed_1 = FALSE; /* types in vector are fixed. */
+ hbool_t type_fixed_2 = FALSE; /* */
+ hbool_t verbose = FALSE;
+ hid_t fapl_id = -1; /* file access property list ID */
+ haddr_t eoa; /* file eoa */
+ char filename[1024]; /* filename */
+ char * buf; /* tmp ptr to buf */
+ unsigned flags = 0; /* file open flags */
+ H5FD_t * lf; /* VFD struct ptr */
+ uint32_t i; /* index */
+ uint32_t j; /* index */
+ uint32_t count = VECTOR_LEN; /* length of vectors */
+ H5FD_mem_t types_0[VECTOR_LEN]; /* types vector */
+ H5FD_mem_t types_1[VECTOR_LEN]; /* types vector */
+ H5FD_mem_t types_2[VECTOR_LEN]; /* types vector */
+ H5FD_mem_t f_types_0[VECTOR_LEN]; /* fixed types vector */
+ H5FD_mem_t f_types_1[VECTOR_LEN]; /* fixed types vector */
+ H5FD_mem_t f_types_2[VECTOR_LEN]; /* fixed types vector */
+ H5FD_mem_t f_type_0 = H5FD_MEM_NTYPES; /* current type for f vector 0 */
+ H5FD_mem_t f_type_1 = H5FD_MEM_NTYPES; /* current type for f vector 1 */
+ H5FD_mem_t f_type_2 = H5FD_MEM_NTYPES; /* current type for f vector 2 */
+ haddr_t addrs_0[VECTOR_LEN]; /* addresses vector */
+ haddr_t addrs_1[VECTOR_LEN]; /* addresses vector */
+ haddr_t addrs_2[VECTOR_LEN]; /* addresses vector */
+ haddr_t f_addrs_0[VECTOR_LEN]; /* fixed addresses vector */
+ haddr_t f_addrs_1[VECTOR_LEN]; /* fixed addresses vector */
+ haddr_t f_addrs_2[VECTOR_LEN]; /* fixed addresses vector */
+ size_t sizes_0[VECTOR_LEN]; /* sizes vector */
+ size_t sizes_1[VECTOR_LEN]; /* sizes vector */
+ size_t sizes_2[VECTOR_LEN]; /* sizes vector */
+ size_t f_sizes_0[VECTOR_LEN]; /* fixed sizes vector */
+ size_t f_sizes_1[VECTOR_LEN]; /* fixed sizes vector */
+ size_t f_sizes_2[VECTOR_LEN]; /* fixed sizes vector */
+ size_t f_size_0 = 0; /* current size for f vector 0 */
+ size_t f_size_1 = 0; /* current size for f vector 1 */
+ size_t f_size_2 = 0; /* current size for f vector 2 */
+ void * write_bufs_0[VECTOR_LEN]; /* write bufs vector */
+ void * write_bufs_1[VECTOR_LEN]; /* write bufs vector */
+ void * write_bufs_2[VECTOR_LEN]; /* write bufs vector */
+ void * f_write_bufs_0[VECTOR_LEN]; /* fixed write bufs vector */
+ void * f_write_bufs_1[VECTOR_LEN]; /* fixed write bufs vector */
+ void * f_write_bufs_2[VECTOR_LEN]; /* fixed write bufs vector */
+ void * read_bufs_0[VECTOR_LEN]; /* read bufs vector */
+ void * read_bufs_1[VECTOR_LEN]; /* read bufs vector */
+ void * read_bufs_2[VECTOR_LEN]; /* read bufs vector */
+ void * f_read_bufs_0[VECTOR_LEN]; /* fixed read bufs vector */
+ void * f_read_bufs_1[VECTOR_LEN]; /* fixed read bufs vector */
+ void * f_read_bufs_2[VECTOR_LEN]; /* fixed read bufs vector */
+
+ HDsnprintf(test_title, sizeof(test_title), "vector I/O with %s VFD", vfd_name);
+
+ TESTING(test_title);
+
+ /* Set property list and file name for target driver */
+
+ if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ TEST_ERROR;
+
+ if (HDstrcmp(vfd_name, "sec2") == 0) {
+
+ if (H5Pset_fapl_sec2(fapl_id) < 0)
+ TEST_ERROR;
+
+ h5_fixname(FILENAME[0], fapl_id, filename, sizeof(filename));
+ }
+ else if (HDstrcmp(vfd_name, "stdio") == 0) {
+
+ if (H5Pset_fapl_stdio(fapl_id) < 0)
+ TEST_ERROR;
+
+ h5_fixname(FILENAME[7], fapl_id, filename, sizeof filename);
+ }
+ else {
+
+ HDfprintf(stdout, "un-supported VFD\n");
+ TEST_ERROR
+ }
+
+ /* setup the test vectors -- note that addresses are not set until
+ * we allocate space via the file driver.
+ */
+ if (!(test_vector_io__setup_v(count, types_0, addrs_0, sizes_0, write_bufs_0, read_bufs_0, 'a') &&
+ test_vector_io__setup_v(count, types_1, addrs_1, sizes_1, write_bufs_1, read_bufs_1, 'e') &&
+ test_vector_io__setup_v(count, types_2, addrs_2, sizes_2, write_bufs_2, read_bufs_2, 'A')))
+ TEST_ERROR;
+
+ if (!(test_vector_io__setup_fixed_size_v(count, f_types_0, f_addrs_0, f_sizes_0, f_write_bufs_0,
+ f_read_bufs_0, 'b') &&
+ test_vector_io__setup_fixed_size_v(count, f_types_1, f_addrs_1, f_sizes_1, f_write_bufs_1,
+ f_read_bufs_1, 'f') &&
+ test_vector_io__setup_fixed_size_v(count, f_types_2, f_addrs_2, f_sizes_2, f_write_bufs_2,
+ f_read_bufs_2, 'B')))
+ TEST_ERROR;
+
+ flags = H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC;
+
+ if (NULL == (lf = H5FDopen(filename, flags, fapl_id, HADDR_UNDEF)))
+ TEST_ERROR;
+
+ /* allocate space for the data in the test vectors */
+ for (i = 0; i < count; i++) {
+
+ addrs_0[i] = H5FDalloc(lf, types_0[i], H5P_DEFAULT, (hsize_t)(sizes_0[i]));
+ addrs_1[i] = H5FDalloc(lf, types_1[i], H5P_DEFAULT, (hsize_t)(sizes_1[i]));
+ addrs_2[i] = H5FDalloc(lf, types_2[i], H5P_DEFAULT, (hsize_t)(sizes_2[i]));
+
+ if ((addrs_0[i] == HADDR_UNDEF) || (addrs_1[i] == HADDR_UNDEF) || (addrs_2[i] == HADDR_UNDEF))
+ TEST_ERROR;
+
+ SET_SIZE(size_fixed_0, f_sizes_0, f_size_0, i);
+ SET_SIZE(size_fixed_1, f_sizes_1, f_size_1, i);
+ SET_SIZE(size_fixed_2, f_sizes_2, f_size_2, i);
+
+ SET_TYPE(type_fixed_0, f_types_0, f_type_0, i);
+ SET_TYPE(type_fixed_1, f_types_1, f_type_1, i);
+ SET_TYPE(type_fixed_2, f_types_2, f_type_2, i);
+
+ f_addrs_0[i] = H5FDalloc(lf, f_type_0, H5P_DEFAULT, (hsize_t)(f_size_0));
+ f_addrs_1[i] = H5FDalloc(lf, f_type_1, H5P_DEFAULT, (hsize_t)(f_size_1));
+ f_addrs_2[i] = H5FDalloc(lf, f_type_2, H5P_DEFAULT, (hsize_t)(f_size_2));
+
+ if ((f_addrs_0[i] == HADDR_UNDEF) || (f_addrs_1[i] == HADDR_UNDEF) || (f_addrs_2[i] == HADDR_UNDEF))
+ TEST_ERROR;
+ }
+
+ if (verbose) {
+
+ test_vector_io__dump_test_vectors(count, types_0, addrs_0, sizes_0, write_bufs_0, NULL, "zero");
+
+ test_vector_io__dump_test_vectors(count, types_1, addrs_1, sizes_1, write_bufs_1, NULL, "one");
+
+ test_vector_io__dump_test_vectors(count, types_2, addrs_2, sizes_2, write_bufs_2, NULL, "two");
+
+ test_vector_io__dump_test_vectors(count, f_types_0, f_addrs_0, f_sizes_0, f_write_bufs_0, NULL,
+ "fixed zero");
+
+ test_vector_io__dump_test_vectors(count, f_types_1, f_addrs_1, f_sizes_1, f_write_bufs_1, NULL,
+ "fixed one");
+
+ test_vector_io__dump_test_vectors(count, f_types_2, f_addrs_2, f_sizes_2, f_write_bufs_2, NULL,
+ "fixed two");
+ }
+
+ /* write and then read using vector I/O. First, read/write vector
+ * of length 1, then of length 2, then remainder of vector
+ */
+ if (H5FDwrite_vector(lf, H5P_DEFAULT, 1, &(types_0[0]), &(addrs_0[0]), &(sizes_0[0]),
+ &(write_bufs_0[0])) < 0)
+ TEST_ERROR;
+
+ if (H5FDread_vector(lf, H5P_DEFAULT, 1, &(types_0[0]), &(addrs_0[0]), &(sizes_0[0]), &(read_bufs_0[0])) <
+ 0)
+ TEST_ERROR;
+
+ if (H5FDwrite_vector(lf, H5P_DEFAULT, 2, &(types_0[1]), &(addrs_0[1]), &(sizes_0[1]),
+ &(write_bufs_0[1])) < 0)
+ TEST_ERROR;
+
+ if (H5FDread_vector(lf, H5P_DEFAULT, 2, &(types_0[1]), &(addrs_0[1]), &(sizes_0[1]), &(read_bufs_0[1])) <
+ 0)
+ TEST_ERROR;
+
+ if (H5FDwrite_vector(lf, H5P_DEFAULT, count - 3, &(types_0[3]), &(addrs_0[3]), &(sizes_0[3]),
+ &(write_bufs_0[3])) < 0)
+ TEST_ERROR;
+
+ if (H5FDread_vector(lf, H5P_DEFAULT, count - 3, &(types_0[3]), &(addrs_0[3]), &(sizes_0[3]),
+ &(read_bufs_0[3])) < 0)
+ TEST_ERROR;
+
+ /* for fixed size / type vector, just write and read as single operations */
+ if (H5FDwrite_vector(lf, H5P_DEFAULT, count, f_types_0, f_addrs_0, f_sizes_0, f_write_bufs_0) < 0)
+ TEST_ERROR;
+
+ if (H5FDread_vector(lf, H5P_DEFAULT, count, f_types_0, f_addrs_0, f_sizes_0, f_read_bufs_0) < 0)
+ TEST_ERROR;
+
+ /* verify that the expected data is read */
+ if (!test_vector_io__verify_v(count, types_0, sizes_0, write_bufs_0, read_bufs_0, "zero"))
+ TEST_ERROR;
+
+ if (!test_vector_io__verify_v(count, f_types_0, f_sizes_0, f_write_bufs_0, f_read_bufs_0, "fixed zero"))
+ TEST_ERROR;
+
+ /* write the contents of a vector individually, and then read it back
+ * in several vector reads.
+ */
+ if (!test_vector_io__write_v_indiv(lf, count, types_1, addrs_1, sizes_1, write_bufs_1))
+ TEST_ERROR;
+
+ if (H5FDread_vector(lf, H5P_DEFAULT, 1, &(types_1[0]), &(addrs_1[0]), &(sizes_1[0]), &(read_bufs_1[0])) <
+ 0)
+ TEST_ERROR;
+
+ if (H5FDread_vector(lf, H5P_DEFAULT, 2, &(types_1[1]), &(addrs_1[1]), &(sizes_1[1]), &(read_bufs_1[1])) <
+ 0)
+ TEST_ERROR;
+
+ if (H5FDread_vector(lf, H5P_DEFAULT, count - 3, &(types_1[3]), &(addrs_1[3]), &(sizes_1[3]),
+ &(read_bufs_1[3])) < 0)
+ TEST_ERROR;
+
+ /* for fixed size, write individually, and the read back in a single call */
+ if (!test_vector_io__write_v_indiv(lf, count, f_types_1, f_addrs_1, f_sizes_1, f_write_bufs_1))
+ TEST_ERROR;
+
+ if (H5FDread_vector(lf, H5P_DEFAULT, count, f_types_1, f_addrs_1, f_sizes_1, f_read_bufs_1) < 0)
+ TEST_ERROR;
+
+ /* verify that the expected data is read */
+ if (!test_vector_io__verify_v(count, types_1, sizes_1, write_bufs_1, read_bufs_1, "one"))
+ TEST_ERROR;
+
+ if (!test_vector_io__verify_v(count, f_types_1, f_sizes_1, f_write_bufs_1, f_read_bufs_1, "fixed one"))
+ TEST_ERROR;
+
+ /* Write the contents of a vector as several vector writes, then
+ * read it back in individual reads.
+ */
+ if (H5FDwrite_vector(lf, H5P_DEFAULT, 1, &(types_2[0]), &(addrs_2[0]), &(sizes_2[0]),
+ &(write_bufs_2[0])) < 0)
+ TEST_ERROR;
+
+ if (H5FDwrite_vector(lf, H5P_DEFAULT, 2, &(types_2[1]), &(addrs_2[1]), &(sizes_2[1]),
+ &(write_bufs_2[1])) < 0)
+ TEST_ERROR;
+
+ if (H5FDwrite_vector(lf, H5P_DEFAULT, count - 3, &(types_2[3]), &(addrs_2[3]), &(sizes_2[3]),
+ &(write_bufs_2[3])) < 0)
+ TEST_ERROR;
+
+ if (!test_vector_io__read_v_indiv(lf, count, types_2, addrs_2, sizes_2, read_bufs_2))
+ TEST_ERROR;
+
+ /* for fixed size, write as a single vector, read back individually */
+ if (H5FDwrite_vector(lf, H5P_DEFAULT, count, f_types_2, f_addrs_2, f_sizes_2, f_write_bufs_2) < 0)
+ TEST_ERROR;
+
+ if (!test_vector_io__read_v_indiv(lf, count, f_types_2, f_addrs_2, f_sizes_2, f_read_bufs_2))
+ TEST_ERROR;
+
+ /* verify that the expected data is read */
+ if (!test_vector_io__verify_v(count, types_2, sizes_2, write_bufs_2, read_bufs_2, "two"))
+ TEST_ERROR;
+
+ if (!test_vector_io__verify_v(count, f_types_2, f_sizes_2, f_write_bufs_2, f_read_bufs_2, "fixed two"))
+ TEST_ERROR;
+
+ /* make note of eoa -- needed after we re-open the file */
+ if (HADDR_UNDEF == (eoa = H5FDget_eoa(lf, H5FD_MEM_DEFAULT)))
+ TEST_ERROR;
+
+ /* close the file and then re-open it */
+ if (H5FDclose(lf) < 0)
+ TEST_ERROR;
+
+ flags = H5F_ACC_RDWR;
+
+ if (NULL == (lf = H5FDopen(filename, flags, fapl_id, HADDR_UNDEF)))
+ TEST_ERROR;
+
+ /* The EOA is set to 0 on open. To avoid errors, we must set it
+ * to its correct value before we do any reads.
+ *
+ * Note: In the context of using the VFD layer without the HDF5
+ * library on top, this doesn't make much sense. Consider
+ * adding an open flag that sets the EOA to the current file
+ * size.
+ */
+ if (H5FDset_eoa(lf, H5FD_MEM_DEFAULT, eoa) < 0)
+ TEST_ERROR;
+
+ /* Null the read vectors */
+
+ size_fixed_0 = FALSE;
+ size_fixed_1 = FALSE;
+ size_fixed_2 = FALSE;
+
+ for (i = 0; i < count; i++) {
+
+ buf = read_bufs_0[i];
+ for (j = 0; j < sizes_0[i]; j++) {
+ buf[j] = '\0';
+ }
+
+ buf = read_bufs_1[i];
+ for (j = 0; j < sizes_1[i]; j++) {
+ buf[j] = '\0';
+ }
+
+ buf = read_bufs_2[i];
+ for (j = 0; j < sizes_2[i]; j++) {
+ buf[j] = '\0';
+ }
+
+ SET_SIZE(size_fixed_0, f_sizes_0, f_size_0, i);
+ SET_SIZE(size_fixed_1, f_sizes_1, f_size_1, i);
+ SET_SIZE(size_fixed_2, f_sizes_2, f_size_2, i);
+
+ buf = f_read_bufs_0[i];
+ for (j = 0; j < f_size_0; j++) {
+ buf[j] = '\0';
+ }
+
+ buf = f_read_bufs_1[i];
+ for (j = 0; j < f_size_1; j++) {
+ buf[j] = '\0';
+ }
+
+ buf = f_read_bufs_2[i];
+ for (j = 0; j < f_size_2; j++) {
+ buf[j] = '\0';
+ }
+ }
+
+ /* read the contents of the file */
+ if (H5FDread_vector(lf, H5P_DEFAULT, count, types_0, addrs_0, sizes_0, read_bufs_0) < 0)
+ TEST_ERROR;
+
+ if (H5FDread_vector(lf, H5P_DEFAULT, count, types_1, addrs_1, sizes_1, read_bufs_1) < 0)
+ TEST_ERROR;
+
+ if (H5FDread_vector(lf, H5P_DEFAULT, count, types_2, addrs_2, sizes_2, read_bufs_2) < 0)
+ TEST_ERROR;
+
+ if (H5FDread_vector(lf, H5P_DEFAULT, count, f_types_0, f_addrs_0, f_sizes_0, f_read_bufs_0) < 0)
+ TEST_ERROR;
+
+ if (H5FDread_vector(lf, H5P_DEFAULT, count, f_types_1, f_addrs_1, f_sizes_1, f_read_bufs_1) < 0)
+ TEST_ERROR;
+
+ if (H5FDread_vector(lf, H5P_DEFAULT, count, f_types_2, f_addrs_2, f_sizes_2, f_read_bufs_2) < 0)
+ TEST_ERROR;
+
+ /* verify the contents. */
+ if (!test_vector_io__verify_v(count, types_0, sizes_0, write_bufs_0, read_bufs_0, "zero-"))
+ TEST_ERROR;
+
+ if (!test_vector_io__verify_v(count, types_1, sizes_1, write_bufs_1, read_bufs_1, "one-"))
+ TEST_ERROR;
+
+ if (!test_vector_io__verify_v(count, types_2, sizes_2, write_bufs_2, read_bufs_2, "two-"))
+ TEST_ERROR;
+
+ if (!test_vector_io__verify_v(count, f_types_0, f_sizes_0, f_write_bufs_0, f_read_bufs_0, "fixed zero-"))
+ TEST_ERROR;
+
+ if (!test_vector_io__verify_v(count, f_types_1, f_sizes_1, f_write_bufs_1, f_read_bufs_1, "fixed one-"))
+ TEST_ERROR;
+
+ if (!test_vector_io__verify_v(count, f_types_2, f_sizes_2, f_write_bufs_2, f_read_bufs_2, "fixed two-"))
+ TEST_ERROR;
+
+ if (H5FDclose(lf) < 0)
+ TEST_ERROR;
+
+ h5_delete_test_file(FILENAME[0], fapl_id);
+
+ /* Close the fapl */
+ if (H5Pclose(fapl_id) < 0)
+ TEST_ERROR;
+
+ /* discard the read and write buffers */
+
+ for (i = 0; i < count; i++) {
+
+ HDfree(write_bufs_0[i]);
+ write_bufs_0[i] = NULL;
+
+ HDfree(write_bufs_1[i]);
+ write_bufs_1[i] = NULL;
+
+ HDfree(write_bufs_2[i]);
+ write_bufs_2[i] = NULL;
+
+ HDfree(read_bufs_0[i]);
+ read_bufs_0[i] = NULL;
+
+ HDfree(read_bufs_1[i]);
+ read_bufs_1[i] = NULL;
+
+ HDfree(read_bufs_2[i]);
+ read_bufs_2[i] = NULL;
+
+ HDfree(f_write_bufs_0[i]);
+ f_write_bufs_0[i] = NULL;
+
+ HDfree(f_write_bufs_1[i]);
+ f_write_bufs_1[i] = NULL;
+
+ HDfree(f_write_bufs_2[i]);
+ f_write_bufs_2[i] = NULL;
+
+ HDfree(f_read_bufs_0[i]);
+ f_read_bufs_0[i] = NULL;
+
+ HDfree(f_read_bufs_1[i]);
+ f_read_bufs_1[i] = NULL;
+
+ HDfree(f_read_bufs_2[i]);
+ f_read_bufs_2[i] = NULL;
+ }
+
+ PASSED();
+ return 0;
+
+error:
+ H5E_BEGIN_TRY
+ {
+ H5Pclose(fapl_id);
+ H5FDclose(lf);
+ }
+ H5E_END_TRY;
+ return -1;
+} /* end test_vector_io() */
+
+/*-------------------------------------------------------------------------
+ * Function: test_selection_io_write
+ *
+ * Purpose: Updates write buffers to ensure a unique value is written
+ * to each element and issues a selection write call.
+ *
+ * Return: Success: TRUE
+ * Failure: FALSE
+ *
+ * Programmer: Neil Fortner
+ * 7/1/21
+ *
+ * Changes: None.
+ *
+ *-------------------------------------------------------------------------
+ */
+/* Array dimensions, used for all selection I/O tests. Currently both must be
+ * even. 1-Dimensional arrays have a size of SEL_IO_DIM0 * SEL_IO_DIM1. */
+#define SEL_IO_DIM0 8
+#define SEL_IO_DIM1 10
+
+static herr_t
+test_selection_io_write(H5FD_t *lf, H5FD_mem_t type, uint32_t count, hid_t mem_spaces[], hid_t file_spaces[],
+ haddr_t offsets[], size_t element_sizes[], int *wbufs[])
+{
+ int i;
+ int j;
+
+ /* Update write buffer */
+ for (i = 0; i < (int)count; i++)
+ if (wbufs[i] && (i == 0 || wbufs[i] != wbufs[i - 1]))
+ for (j = 0; j < SEL_IO_DIM0 * SEL_IO_DIM1; j++)
+ wbufs[i][j] += 2 * SEL_IO_DIM0 * SEL_IO_DIM1;
+
+ /* Issue write call */
+ if (H5FDwrite_selection(lf, type, H5P_DEFAULT, count, mem_spaces, file_spaces, offsets, element_sizes,
+ (const void **)wbufs) < 0)
+ TEST_ERROR
+
+ return 0;
+
+error:
+ return -1;
+} /* end test_selection_io_write() */
+
+/*-------------------------------------------------------------------------
+ * Function: test_selection_io_read_verify
+ *
+ * Purpose: Issues a selection read call and compares the result to
+ * the arrays provided in erbufs. If rbufcount is less than
+ * count the last element in erbufs will be repeated to make
+ * up the difference.
+ *
+ * Return: Success: TRUE
+ * Failure: FALSE
+ *
+ * Programmer: Neil Fortner
+ * 7/1/21
+ *
+ * Changes: None.
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+test_selection_io_read_verify(H5FD_t *lf, H5FD_mem_t type, uint32_t count, hid_t mem_spaces[],
+ hid_t file_spaces[], haddr_t offsets[], size_t element_sizes[],
+ uint32_t rbufcount, int *erbufs[], hbool_t shorten_rbufs)
+{
+ int rbuf1[SEL_IO_DIM0 * SEL_IO_DIM1];
+ int rbuf2[SEL_IO_DIM0 * SEL_IO_DIM1];
+ int *rbufs[2] = {rbuf1, rbuf2};
+ int i;
+ int j;
+
+ /* Initialize read buffer */
+ for (i = 0; i < (int)rbufcount; i++)
+ for (j = 0; j < SEL_IO_DIM0 * SEL_IO_DIM1; j++)
+ rbufs[i][j] = -1;
+
+ /* Handle elements in count that are not part of rbufcount */
+ for (i = (int)rbufcount; i < (int)count; i++)
+ if (shorten_rbufs)
+ rbufs[i] = NULL;
+ else
+ rbufs[i] = rbufs[rbufcount - 1];
+
+ /* Issue read call */
+ if (H5FDread_selection(lf, type, H5P_DEFAULT, count, mem_spaces, file_spaces, offsets, element_sizes,
+ (void **)rbufs) < 0)
+ TEST_ERROR
+
+ /* Verify result */
+ for (i = 0; i < (int)rbufcount; i++)
+ for (j = 0; j < SEL_IO_DIM0 * SEL_IO_DIM1; j++)
+ if (rbufs[i][j] != erbufs[i][j]) {
+ H5_FAILED()
+ AT()
+ HDprintf("data read from file does not match expected values at mapping array location %d\n",
+ i);
+ HDprintf("expected data: \n");
+ for (j = 0; j < SEL_IO_DIM0 * SEL_IO_DIM1; j++) {
+ printf("%6d", erbufs[i][j]);
+ if (!((j + 1) % SEL_IO_DIM1))
+ printf("\n");
+ }
+ HDprintf("read data: \n");
+ for (j = 0; j < SEL_IO_DIM0 * SEL_IO_DIM1; j++) {
+ printf("%6d", rbufs[i][j]);
+ if (!((j + 1) % SEL_IO_DIM1))
+ printf("\n");
+ }
+ goto error;
+ }
+
+ return 0;
+
+error:
+ return -1;
+} /* end test_selection_io_read_verify() */
+
+/*-------------------------------------------------------------------------
+ * Function: test_selection_io
+ *
+ * Purpose: Test I/O using the selection I/O VFD public VFD calls.
+ *
+ * Tests various combinations of 1D, 2D, contiguous, and
+ * strided selections with different file data types and
+ * with and without shortened arrays.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Neil Fortner
+ * 7/1/21
+ *
+ * Changes: None.
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+test_selection_io(const char *vfd_name)
+{
+ char test_title[80];
+ hid_t fapl_id = -1; /* file access property list ID */
+ char filename[1024]; /* filename */
+ unsigned flags = 0; /* file open flags */
+ H5FD_t * lf; /* VFD struct ptr */
+ int i; /* index */
+ int j; /* index */
+ int i2; /* index */
+ int j2; /* index */
+ hid_t mem_spaces[2] = {H5I_INVALID_HID, H5I_INVALID_HID}; /* memory dataspaces vector */
+ hid_t file_spaces[2] = {H5I_INVALID_HID, H5I_INVALID_HID}; /* file dataspaces vector */
+ hsize_t dims1[1] = {SEL_IO_DIM0 * SEL_IO_DIM1}; /* 1D dataspace dimensions */
+ hsize_t dims2[2] = {SEL_IO_DIM0, SEL_IO_DIM1}; /* 1D dataspace dimensions */
+ hsize_t start[2]; /* start for hyperslab */
+ hsize_t stride[2]; /* stride for hyperslab */
+ hsize_t count[2]; /* count for hyperslab */
+ hsize_t block[2]; /* block for hyperslab */
+ H5FD_mem_t type; /* file data type */
+ haddr_t addrs[2]; /* addresses vector */
+ size_t element_sizes[2] = {sizeof(int), sizeof(int)}; /* element sizes vector */
+ int wbuf1[SEL_IO_DIM0 * SEL_IO_DIM1]; /* 1D write buffer */
+ int wbuf2[SEL_IO_DIM0][SEL_IO_DIM1]; /* 2D write buffer */
+ int * wbufs[2] = {wbuf1, wbuf2[0]}; /* Array of write buffers */
+ int fbuf1[SEL_IO_DIM0 * SEL_IO_DIM1]; /* 1D file buffer */
+ int fbuf2[SEL_IO_DIM0][SEL_IO_DIM1]; /* 2D file buffer */
+ int * fbufs[2] = {fbuf1, fbuf2[0]}; /* Array of file buffers */
+ int erbuf1[SEL_IO_DIM0 * SEL_IO_DIM1]; /* 1D expected read buffer */
+ int erbuf2[SEL_IO_DIM0][SEL_IO_DIM1]; /* 2D expected read buffer */
+ int * erbufs[2] = {erbuf1, erbuf2[0]}; /* Array of expected read buffers */
+ int shorten_element_sizes; /* Whether to shorten the element sizes array */
+
+ HDsnprintf(test_title, sizeof(test_title), "selection I/O with %s VFD", vfd_name);
+
+ TESTING(test_title);
+
+ /* Set property list and file name for target driver */
+
+ if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ TEST_ERROR
+
+ if (HDstrcmp(vfd_name, "sec2") == 0) {
+
+ if (H5Pset_fapl_sec2(fapl_id) < 0)
+ TEST_ERROR
+
+ h5_fixname(FILENAME[0], fapl_id, filename, sizeof(filename));
+ }
+ else if (HDstrcmp(vfd_name, "stdio") == 0) {
+
+ if (H5Pset_fapl_stdio(fapl_id) < 0)
+ TEST_ERROR
+
+ h5_fixname(FILENAME[7], fapl_id, filename, sizeof filename);
+ }
+ else {
+
+ HDfprintf(stdout, "un-supported VFD\n");
+ TEST_ERROR
+ }
+
+ /* Initialize write buffers */
+ for (i = 0; i < SEL_IO_DIM0; i++)
+ for (j = 0; j < SEL_IO_DIM1; j++) {
+ wbuf1[(i * SEL_IO_DIM1) + j] = (i * SEL_IO_DIM1) + j;
+ wbuf2[i][j] = (i * SEL_IO_DIM1) + j + (SEL_IO_DIM0 * SEL_IO_DIM1);
+ }
+
+ /* Create dataspaces - location 0 will be 1D and location 1 will be 2D */
+ if ((mem_spaces[0] = H5Screate_simple(1, dims1, NULL)) < 0)
+ TEST_ERROR
+ if ((mem_spaces[1] = H5Screate_simple(2, dims2, NULL)) < 0)
+ TEST_ERROR
+ if ((file_spaces[0] = H5Screate_simple(1, dims1, NULL)) < 0)
+ TEST_ERROR
+ if ((file_spaces[1] = H5Screate_simple(2, dims2, NULL)) < 0)
+ TEST_ERROR
+
+ /* Create file */
+ flags = H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC;
+
+ if (NULL == (lf = H5FDopen(filename, flags, fapl_id, HADDR_UNDEF)))
+ TEST_ERROR;
+
+ /* Loop over memory types */
+ for (type = 1; type < H5FD_MEM_NTYPES; type++) {
+ /* Allocate space for I/O */
+ addrs[0] = H5FDalloc(lf, type, H5P_DEFAULT, (hsize_t)(sizeof(int) * SEL_IO_DIM0 * SEL_IO_DIM1));
+ addrs[1] = H5FDalloc(lf, type, H5P_DEFAULT, (hsize_t)(sizeof(int) * SEL_IO_DIM0 * SEL_IO_DIM1));
+
+ /*
+ * Test 1: Simple 1D contiguous I/O
+ */
+ /* Issue write call */
+ if (test_selection_io_write(lf, type, 1, &mem_spaces[0], &file_spaces[0], &addrs[0], element_sizes,
+ (int **)&wbufs[0]) < 0)
+ TEST_ERROR
+
+ /* Update file buf */
+ for (i = 0; i < SEL_IO_DIM0 * SEL_IO_DIM1; i++)
+ fbuf1[i] = wbuf1[i];
+
+ /* Read and verify */
+ if (test_selection_io_read_verify(lf, type, 1, &mem_spaces[0], &file_spaces[0], &addrs[0],
+ element_sizes, 1, (int **)&fbufs[0], FALSE) < 0)
+ TEST_ERROR
+
+ /*
+ * Test 2: Simple 2D contiguous I/O
+ */
+ /* Issue write call */
+ if (test_selection_io_write(lf, type, 1, &mem_spaces[1], &file_spaces[1], &addrs[1], element_sizes,
+ (int **)&wbufs[1]) < 0)
+ TEST_ERROR
+
+ /* Update file buf */
+ for (i = 0; i < SEL_IO_DIM0; i++)
+ for (j = 0; j < SEL_IO_DIM1; j++)
+ fbuf2[i][j] = wbuf2[i][j];
+
+ /* Read and verify */
+ if (test_selection_io_read_verify(lf, type, 1, &mem_spaces[1], &file_spaces[1], &addrs[1],
+ element_sizes, 1, (int **)&fbufs[1], FALSE) < 0)
+ TEST_ERROR
+
+ /*
+ * Test 3: Strided <> Contiguous 1D I/O
+ */
+ /* SEL_IO_DIM1 must be even */
+ HDassert(SEL_IO_DIM1 / 2 == (SEL_IO_DIM1 + 1) / 2);
+
+ /* Strided selection in memory */
+ start[0] = 1;
+ stride[0] = 2;
+ count[0] = (SEL_IO_DIM0 * SEL_IO_DIM1) / 2;
+ block[0] = 1;
+ if (H5Sselect_hyperslab(mem_spaces[0], H5S_SELECT_SET, start, stride, count, block) < 0)
+ TEST_ERROR
+
+ /* Contiguous selection in file */
+ if (H5Sselect_hyperslab(file_spaces[0], H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ TEST_ERROR
+
+ /* Issue write call */
+ if (test_selection_io_write(lf, type, 1, &mem_spaces[0], &file_spaces[0], &addrs[0], element_sizes,
+ (int **)&wbufs[0]) < 0)
+ TEST_ERROR
+
+ /* Update file buf */
+ for (i = 0; i < (SEL_IO_DIM0 * SEL_IO_DIM1) / 2; i++)
+ fbuf1[i + 1] = wbuf1[(2 * i) + 1];
+
+ /* Update expected read buf */
+ for (i = 0; i < (SEL_IO_DIM0 * SEL_IO_DIM1); i++)
+ erbuf1[i] = -1;
+ for (i = 0; i < (SEL_IO_DIM0 * SEL_IO_DIM1) / 2; i++)
+ erbuf1[(2 * i) + 1] = wbuf1[(2 * i) + 1];
+
+ /* Read and verify */
+ if (test_selection_io_read_verify(lf, type, 1, &mem_spaces[0], &file_spaces[0], &addrs[0],
+ element_sizes, 1, (int **)&erbufs[0], FALSE) < 0)
+ TEST_ERROR
+
+ /* Reset selections */
+ if (H5Sselect_all(mem_spaces[0]) < 0)
+ TEST_ERROR
+ if (H5Sselect_all(file_spaces[0]) < 0)
+ TEST_ERROR
+
+ /* Read entire file buffer and verify */
+ if (test_selection_io_read_verify(lf, type, 1, &mem_spaces[0], &file_spaces[0], &addrs[0],
+ element_sizes, 1, (int **)&fbufs[0], FALSE) < 0)
+ TEST_ERROR
+
+ /*
+ * Test 4: Contiguous <> Strided 1D I/O
+ */
+ /* SEL_IO_DIM1 must be even */
+ HDassert(SEL_IO_DIM1 / 2 == (SEL_IO_DIM1 + 1) / 2);
+
+ /* Contiguous selection in memory */
+ start[0] = 1;
+ stride[0] = 2;
+ if (H5Sselect_hyperslab(mem_spaces[0], H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ TEST_ERROR
+
+ /* Strided selection in file */
+ count[0] = (SEL_IO_DIM0 * SEL_IO_DIM1) / 2;
+ block[0] = 1;
+ if (H5Sselect_hyperslab(file_spaces[0], H5S_SELECT_SET, start, stride, count, block) < 0)
+ TEST_ERROR
+
+ /* Issue write call */
+ if (test_selection_io_write(lf, type, 1, &mem_spaces[0], &file_spaces[0], &addrs[0], element_sizes,
+ (int **)&wbufs[0]) < 0)
+ TEST_ERROR
+
+ /* Update file buf */
+ for (i = 0; i < (SEL_IO_DIM0 * SEL_IO_DIM1) / 2; i++)
+ fbuf1[(2 * i) + 1] = wbuf1[i + 1];
+
+ /* Update expected read buf */
+ for (i = 0; i < (SEL_IO_DIM0 * SEL_IO_DIM1); i++)
+ erbuf1[i] = -1;
+ for (i = 0; i < (SEL_IO_DIM0 * SEL_IO_DIM1) / 2; i++)
+ erbuf1[i + 1] = wbuf1[i + 1];
+
+ /* Read and verify */
+ if (test_selection_io_read_verify(lf, type, 1, &mem_spaces[0], &file_spaces[0], &addrs[0],
+ element_sizes, 1, (int **)&erbufs[0], FALSE) < 0)
+ TEST_ERROR
+
+ /* Reset selections */
+ if (H5Sselect_all(mem_spaces[0]) < 0)
+ TEST_ERROR
+ if (H5Sselect_all(file_spaces[0]) < 0)
+ TEST_ERROR
+
+ /* Read entire file buffer and verify */
+ if (test_selection_io_read_verify(lf, type, 1, &mem_spaces[0], &file_spaces[0], &addrs[0],
+ element_sizes, 1, (int **)&fbufs[0], FALSE) < 0)
+ TEST_ERROR
+
+ /*
+ * Test 5: Strided <> Strided 1D I/O
+ */
+ /* SEL_IO_DIM1 must be even */
+ HDassert(SEL_IO_DIM1 / 2 == (SEL_IO_DIM1 + 1) / 2);
+
+ /* Strided selection in memory */
+ start[0] = 1;
+ stride[0] = 2;
+ count[0] = (SEL_IO_DIM0 * SEL_IO_DIM1) / 2;
+ block[0] = 1;
+ if (H5Sselect_hyperslab(mem_spaces[0], H5S_SELECT_SET, start, stride, count, block) < 0)
+ TEST_ERROR
+
+ /* Strided selection in file */
+ start[0] = 0;
+ if (H5Sselect_hyperslab(file_spaces[0], H5S_SELECT_SET, start, stride, count, block) < 0)
+ TEST_ERROR
+
+ /* Issue write call */
+ if (test_selection_io_write(lf, type, 1, &mem_spaces[0], &file_spaces[0], &addrs[0], element_sizes,
+ (int **)&wbufs[0]) < 0)
+ TEST_ERROR
+
+ /* Update file buf */
+ for (i = 0; i < (SEL_IO_DIM0 * SEL_IO_DIM1) / 2; i++)
+ fbuf1[2 * i] = wbuf1[(2 * i) + 1];
+
+ /* Update expected read buf */
+ for (i = 0; i < (SEL_IO_DIM0 * SEL_IO_DIM1); i++)
+ erbuf1[i] = -1;
+ for (i = 0; i < (SEL_IO_DIM0 * SEL_IO_DIM1) / 2; i++)
+ erbuf1[(2 * i) + 1] = wbuf1[(2 * i) + 1];
+
+ /* Read and verify */
+ if (test_selection_io_read_verify(lf, type, 1, &mem_spaces[0], &file_spaces[0], &addrs[0],
+ element_sizes, 1, (int **)&erbufs[0], FALSE) < 0)
+ TEST_ERROR
+
+ /* Reset selections */
+ if (H5Sselect_all(mem_spaces[0]) < 0)
+ TEST_ERROR
+ if (H5Sselect_all(file_spaces[0]) < 0)
+ TEST_ERROR
+
+ /* Read entire file buffer and verify */
+ if (test_selection_io_read_verify(lf, type, 1, &mem_spaces[0], &file_spaces[0], &addrs[0],
+ element_sizes, 1, (int **)&fbufs[0], FALSE) < 0)
+ TEST_ERROR
+
+ /*
+ * Test 6: Strided <> Contiguous 2D I/O
+ */
+ /* Strided selection in memory */
+ start[0] = 1;
+ start[1] = 0;
+ stride[0] = 2;
+ stride[1] = 1;
+ count[0] = SEL_IO_DIM0 / 2;
+ count[1] = SEL_IO_DIM1;
+ block[0] = 1;
+ block[1] = 1;
+ if (H5Sselect_hyperslab(mem_spaces[1], H5S_SELECT_SET, start, stride, count, block) < 0)
+ TEST_ERROR
+
+ /* Contiguous selection in file */
+ if (H5Sselect_hyperslab(file_spaces[1], H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ TEST_ERROR
+
+ /* Issue write call */
+ if (test_selection_io_write(lf, type, 1, &mem_spaces[1], &file_spaces[1], &addrs[1], element_sizes,
+ (int **)&wbufs[1]) < 0)
+ TEST_ERROR
+
+ /* Update file buf */
+ for (i = 0; i < SEL_IO_DIM0 / 2; i++)
+ for (j = 0; j < SEL_IO_DIM1; j++)
+ fbuf2[i + 1][j] = wbuf2[(2 * i) + 1][j];
+
+ /* Update expected read buf */
+ for (i = 0; i < SEL_IO_DIM0; i++)
+ for (j = 0; j < SEL_IO_DIM1; j++)
+ erbuf2[i][j] = -1;
+ for (i = 0; i < SEL_IO_DIM0 / 2; i++)
+ for (j = 0; j < SEL_IO_DIM1; j++)
+ erbuf2[(2 * i) + 1][j] = wbuf2[(2 * i) + 1][j];
+
+ /* Read and verify */
+ if (test_selection_io_read_verify(lf, type, 1, &mem_spaces[1], &file_spaces[1], &addrs[1],
+ element_sizes, 1, (int **)&erbufs[1], FALSE) < 0)
+ TEST_ERROR
+
+ /* Reset selections */
+ if (H5Sselect_all(mem_spaces[1]) < 0)
+ TEST_ERROR
+ if (H5Sselect_all(file_spaces[1]) < 0)
+ TEST_ERROR
+
+ /* Read entire file buffer and verify */
+ if (test_selection_io_read_verify(lf, type, 1, &mem_spaces[1], &file_spaces[1], &addrs[1],
+ element_sizes, 1, (int **)&fbufs[1], FALSE) < 0)
+ TEST_ERROR
+
+ /*
+ * Test 7: Contiguous <> Strided 2D I/O
+ */
+ /* Contiguous selection in memory */
+ start[0] = 0;
+ start[1] = 1;
+ count[0] = SEL_IO_DIM0;
+ count[1] = SEL_IO_DIM1 / 2;
+ if (H5Sselect_hyperslab(mem_spaces[1], H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ TEST_ERROR
+
+ /* Strided selection in file */
+ stride[0] = 1;
+ stride[1] = 2;
+ block[0] = 1;
+ block[1] = 1;
+ if (H5Sselect_hyperslab(file_spaces[1], H5S_SELECT_SET, start, stride, count, block) < 0)
+ TEST_ERROR
+
+ /* Issue write call */
+ if (test_selection_io_write(lf, type, 1, &mem_spaces[1], &file_spaces[1], &addrs[1], element_sizes,
+ (int **)&wbufs[1]) < 0)
+ TEST_ERROR
+
+ /* Update file buf */
+ for (i = 0; i < SEL_IO_DIM0; i++)
+ for (j = 0; j < SEL_IO_DIM1 / 2; j++)
+ fbuf2[i][(2 * j) + 1] = wbuf2[i][j + 1];
+
+ /* Update expected read buf */
+ for (i = 0; i < SEL_IO_DIM0; i++)
+ for (j = 0; j < SEL_IO_DIM1; j++)
+ erbuf2[i][j] = -1;
+ for (i = 0; i < SEL_IO_DIM0; i++)
+ for (j = 0; j < SEL_IO_DIM1 / 2; j++)
+ erbuf2[i][j + 1] = wbuf2[i][j + 1];
+
+ /* Read and verify */
+ if (test_selection_io_read_verify(lf, type, 1, &mem_spaces[1], &file_spaces[1], &addrs[1],
+ element_sizes, 1, (int **)&erbufs[1], FALSE) < 0)
+ TEST_ERROR
+
+ /* Reset selections */
+ if (H5Sselect_all(mem_spaces[1]) < 0)
+ TEST_ERROR
+ if (H5Sselect_all(file_spaces[1]) < 0)
+ TEST_ERROR
+
+ /* Read entire file buffer and verify */
+ if (test_selection_io_read_verify(lf, type, 1, &mem_spaces[1], &file_spaces[1], &addrs[1],
+ element_sizes, 1, (int **)&fbufs[1], FALSE) < 0)
+ TEST_ERROR
+
+ /*
+ * Test 8: Strided <> Strided 2D I/O
+ */
+ /* SEL_IO_DIM0 and SEL_IO_DIM1 must be even */
+ HDassert(SEL_IO_DIM0 / 2 == (SEL_IO_DIM0 + 1) / 2);
+ HDassert(SEL_IO_DIM1 / 2 == (SEL_IO_DIM1 + 1) / 2);
+
+ /* Strided selection (across dim 1) in memory */
+ start[0] = 0;
+ start[1] = 1;
+ stride[0] = 1;
+ stride[1] = 2;
+ count[0] = SEL_IO_DIM0;
+ count[1] = SEL_IO_DIM1 / 2;
+ block[0] = 1;
+ block[1] = 1;
+ if (H5Sselect_hyperslab(mem_spaces[1], H5S_SELECT_SET, start, stride, count, block) < 0)
+ TEST_ERROR
+
+ /* Strided selection (across dim 0) in file */
+ start[0] = 1;
+ start[1] = 0;
+ stride[0] = 2;
+ stride[1] = 1;
+ count[0] = SEL_IO_DIM0 / 2;
+ count[1] = SEL_IO_DIM1;
+ block[0] = 1;
+ block[1] = 1;
+ if (H5Sselect_hyperslab(file_spaces[1], H5S_SELECT_SET, start, stride, count, block) < 0)
+ TEST_ERROR
+
+ /* Issue write call */
+ if (test_selection_io_write(lf, type, 1, &mem_spaces[1], &file_spaces[1], &addrs[1], element_sizes,
+ (int **)&wbufs[1]) < 0)
+ TEST_ERROR
+
+ /* Update file buf */
+ for (i = 0, i2 = 1, j2 = 0; i < SEL_IO_DIM0; i++)
+ for (j = 1; j < SEL_IO_DIM1; j += 2) {
+ HDassert(i2 < SEL_IO_DIM0);
+ fbuf2[i2][j2] = wbuf2[i][j];
+ if (++j2 == SEL_IO_DIM1) {
+ i2 += 2;
+ j2 = 0;
+ }
+ }
+
+ /* Update expected read buf */
+ for (i = 0; i < SEL_IO_DIM0; i++)
+ for (j = 0; j < SEL_IO_DIM1; j++)
+ erbuf2[i][j] = -1;
+ for (i = 0; i < SEL_IO_DIM0; i++)
+ for (j = 1; j < SEL_IO_DIM1; j += 2)
+ erbuf2[i][j] = wbuf2[i][j];
+
+ /* Read and verify */
+ if (test_selection_io_read_verify(lf, type, 1, &mem_spaces[1], &file_spaces[1], &addrs[1],
+ element_sizes, 1, (int **)&erbufs[1], FALSE) < 0)
+ TEST_ERROR
+
+ /* Reset selections */
+ if (H5Sselect_all(mem_spaces[1]) < 0)
+ TEST_ERROR
+ if (H5Sselect_all(file_spaces[1]) < 0)
+ TEST_ERROR
+
+ /* Read entire file buffer and verify */
+ if (test_selection_io_read_verify(lf, type, 1, &mem_spaces[1], &file_spaces[1], &addrs[1],
+ element_sizes, 1, (int **)&fbufs[1], FALSE) < 0)
+ TEST_ERROR
+
+ /*
+ * Test 9: Strided 1D <> Strided 2D I/O
+ */
+ /* Strided selection in memory */
+ start[0] = 1;
+ stride[0] = 2;
+ count[0] = (SEL_IO_DIM0 * SEL_IO_DIM1) / 2;
+ block[0] = 1;
+ if (H5Sselect_hyperslab(mem_spaces[0], H5S_SELECT_SET, start, stride, count, block) < 0)
+ TEST_ERROR
+
+ /* Strided selection (across dim 1) in file */
+ start[0] = 0;
+ start[1] = 1;
+ stride[0] = 1;
+ stride[1] = 2;
+ count[0] = SEL_IO_DIM0;
+ count[1] = SEL_IO_DIM1 / 2;
+ block[0] = 1;
+ block[1] = 1;
+ if (H5Sselect_hyperslab(file_spaces[1], H5S_SELECT_SET, start, stride, count, block) < 0)
+ TEST_ERROR
+
+ /* Issue write call */
+ if (test_selection_io_write(lf, type, 1, &mem_spaces[0], &file_spaces[1], &addrs[1], element_sizes,
+ (int **)&wbufs[0]) < 0)
+ TEST_ERROR
+
+ /* Update file buf */
+ for (i = 1, i2 = 0, j2 = 1; i < (SEL_IO_DIM0 * SEL_IO_DIM1); i += 2) {
+ HDassert(i2 < SEL_IO_DIM0);
+ fbuf2[i2][j2] = wbuf1[i];
+ j2 += 2;
+ if (j2 >= SEL_IO_DIM1) {
+ i2++;
+ j2 = 1;
+ }
+ }
+
+ /* Update expected read buf */
+ for (i = 0; i < (SEL_IO_DIM0 * SEL_IO_DIM1); i++)
+ erbuf1[i] = -1;
+ for (i = 1; i < (SEL_IO_DIM0 * SEL_IO_DIM1); i += 2)
+ erbuf1[i] = wbuf1[i];
+
+ /* Read and verify */
+ if (test_selection_io_read_verify(lf, type, 1, &mem_spaces[0], &file_spaces[1], &addrs[1],
+ element_sizes, 1, (int **)&erbufs[0], FALSE) < 0)
+ TEST_ERROR
+
+ /* Reset selections */
+ if (H5Sselect_all(mem_spaces[0]) < 0)
+ TEST_ERROR
+ if (H5Sselect_all(file_spaces[1]) < 0)
+ TEST_ERROR
+
+ /* Read entire file buffer and verify */
+ if (test_selection_io_read_verify(lf, type, 1, &mem_spaces[0], &file_spaces[1], &addrs[1],
+ element_sizes, 1, (int **)&fbufs[1], FALSE) < 0)
+ TEST_ERROR
+
+ /*
+ * Test 10: Strided 2D <> Strided 1D I/O
+ */
+ /* Strided selection (across dim 0) in memory */
+ start[0] = 0;
+ start[1] = 0;
+ stride[0] = 2;
+ stride[1] = 1;
+ count[0] = SEL_IO_DIM0 / 2;
+ count[1] = SEL_IO_DIM1;
+ block[0] = 1;
+ block[1] = 1;
+ if (H5Sselect_hyperslab(mem_spaces[1], H5S_SELECT_SET, start, stride, count, block) < 0)
+ TEST_ERROR
+
+ /* Strided selection in file */
+ start[0] = 0;
+ stride[0] = 2;
+ count[0] = (SEL_IO_DIM0 * SEL_IO_DIM1) / 2;
+ block[0] = 1;
+ if (H5Sselect_hyperslab(file_spaces[0], H5S_SELECT_SET, start, stride, count, block) < 0)
+ TEST_ERROR
+
+ /* Issue write call */
+ if (test_selection_io_write(lf, type, 1, &mem_spaces[1], &file_spaces[0], &addrs[0], element_sizes,
+ (int **)&wbufs[1]) < 0)
+ TEST_ERROR
+
+ /* Update file buf */
+ for (i = 0, i2 = 0; i < SEL_IO_DIM0; i += 2)
+ for (j = 0; j < SEL_IO_DIM1; j++) {
+ HDassert(i2 < (SEL_IO_DIM0 * SEL_IO_DIM1));
+ fbuf1[i2] = wbuf2[i][j];
+ i2 += 2;
+ }
+
+ /* Update expected read buf */
+ for (i = 0; i < SEL_IO_DIM0; i++)
+ for (j = 0; j < SEL_IO_DIM1; j++)
+ erbuf2[i][j] = -1;
+ for (i = 0; i < SEL_IO_DIM0; i += 2)
+ for (j = 0; j < SEL_IO_DIM1; j++)
+ erbuf2[i][j] = wbuf2[i][j];
+
+ /* Read and verify */
+ if (test_selection_io_read_verify(lf, type, 1, &mem_spaces[1], &file_spaces[0], &addrs[0],
+ element_sizes, 1, (int **)&erbufs[1], FALSE) < 0)
+ TEST_ERROR
+
+ /* Reset selections */
+ if (H5Sselect_all(mem_spaces[1]) < 0)
+ TEST_ERROR
+ if (H5Sselect_all(file_spaces[0]) < 0)
+ TEST_ERROR
+
+ /* Read entire file buffer and verify */
+ if (test_selection_io_read_verify(lf, type, 1, &mem_spaces[1], &file_spaces[0], &addrs[0],
+ element_sizes, 1, (int **)&fbufs[0], FALSE) < 0)
+ TEST_ERROR
+
+ /* Run tests with full and partial element sizes array */
+ for (shorten_element_sizes = 0; shorten_element_sizes <= 1; shorten_element_sizes++) {
+ /*
+ * Test 11: Strided <> Strided 1D and 2D I/O
+ */
+ /* SEL_IO_DIM1 must be even */
+ HDassert(SEL_IO_DIM1 / 2 == (SEL_IO_DIM1 + 1) / 2);
+
+ /* Strided selection in memory (1D) */
+ start[0] = 0;
+ stride[0] = 2;
+ count[0] = (SEL_IO_DIM0 * SEL_IO_DIM1) / 2;
+ block[0] = 1;
+ if (H5Sselect_hyperslab(mem_spaces[0], H5S_SELECT_SET, start, stride, count, block) < 0)
+ TEST_ERROR
+
+ /* Strided selection in file (1D) */
+ start[0] = 1;
+ if (H5Sselect_hyperslab(file_spaces[0], H5S_SELECT_SET, start, stride, count, block) < 0)
+ TEST_ERROR
+
+ /* Strided selection (across dim 0) in memory (2D) */
+ start[0] = 1;
+ start[1] = 0;
+ stride[0] = 2;
+ stride[1] = 1;
+ count[0] = SEL_IO_DIM0 / 2;
+ count[1] = SEL_IO_DIM1;
+ block[0] = 1;
+ block[1] = 1;
+ if (H5Sselect_hyperslab(mem_spaces[1], H5S_SELECT_SET, start, stride, count, block) < 0)
+ TEST_ERROR
+
+ /* Strided selection (across dim 1) in file (2D) */
+ start[0] = 0;
+ start[1] = 1;
+ stride[0] = 1;
+ stride[1] = 2;
+ count[0] = SEL_IO_DIM0;
+ count[1] = SEL_IO_DIM1 / 2;
+ block[0] = 1;
+ block[1] = 1;
+ if (H5Sselect_hyperslab(file_spaces[1], H5S_SELECT_SET, start, stride, count, block) < 0)
+ TEST_ERROR
+
+ /* Issue write call */
+ if (test_selection_io_write(lf, type, 2, mem_spaces, file_spaces, addrs, element_sizes,
+ (int **)wbufs) < 0)
+ TEST_ERROR
+
+ /* Update file bufs */
+ for (i = 0; i < (SEL_IO_DIM0 * SEL_IO_DIM1) / 2; i++)
+ fbuf1[(2 * i) + 1] = wbuf1[2 * i];
+ for (i = 1, i2 = 0, j2 = 1; i < SEL_IO_DIM0; i += 2)
+ for (j = 0; j < SEL_IO_DIM1; j++) {
+ HDassert(i2 < SEL_IO_DIM0);
+ fbuf2[i2][j2] = wbuf2[i][j];
+ j2 += 2;
+ if (j2 >= SEL_IO_DIM1) {
+ i2++;
+ j2 = 1;
+ }
+ }
+
+ /* Update expected read bufs */
+ for (i = 0; i < (SEL_IO_DIM0 * SEL_IO_DIM1); i++)
+ erbuf1[i] = -1;
+ for (i = 0; i < (SEL_IO_DIM0 * SEL_IO_DIM1) / 2; i++)
+ erbuf1[2 * i] = wbuf1[2 * i];
+ for (i = 0; i < SEL_IO_DIM0; i++)
+ for (j = 0; j < SEL_IO_DIM1; j++)
+ erbuf2[i][j] = -1;
+ for (i = 1; i < SEL_IO_DIM0; i += 2)
+ for (j = 0; j < SEL_IO_DIM1; j++)
+ erbuf2[i][j] = wbuf2[i][j];
+
+ /* Read and verify */
+ if (test_selection_io_read_verify(lf, type, 2, mem_spaces, file_spaces, addrs, element_sizes, 2,
+ (int **)erbufs, FALSE) < 0)
+ TEST_ERROR
+
+ /* Reset selections */
+ if (H5Sselect_all(mem_spaces[0]) < 0)
+ TEST_ERROR
+ if (H5Sselect_all(file_spaces[0]) < 0)
+ TEST_ERROR
+ if (H5Sselect_all(mem_spaces[1]) < 0)
+ TEST_ERROR
+ if (H5Sselect_all(file_spaces[1]) < 0)
+ TEST_ERROR
+
+ /* Read entire file buffer and verify */
+ if (test_selection_io_read_verify(lf, type, 2, mem_spaces, file_spaces, addrs, element_sizes, 2,
+ (int **)fbufs, FALSE) < 0)
+ TEST_ERROR
+
+ /*
+ * Test 12: Strided <> Strided 2D I/O, 2 different selections in the same memory buffer
+ */
+ /* Switch mem and file spaces to both be 2D */
+ if (H5Sset_extent_simple(mem_spaces[0], 2, dims2, NULL) < 0)
+ TEST_ERROR
+ if (H5Sset_extent_simple(file_spaces[0], 2, dims2, NULL) < 0)
+ TEST_ERROR
+
+ /* Strided selection in memory (1st) */
+ start[0] = 0;
+ start[1] = 0;
+ stride[0] = 2;
+ stride[1] = 1;
+ count[0] = SEL_IO_DIM0 / 2;
+ count[1] = SEL_IO_DIM1;
+ block[0] = 1;
+ block[1] = 1;
+ if (H5Sselect_hyperslab(mem_spaces[0], H5S_SELECT_SET, start, stride, count, block) < 0)
+ TEST_ERROR
+
+ /* Strided selection (across dim 0) in memory (2nd) */
+ start[0] = 1;
+ if (H5Sselect_hyperslab(mem_spaces[1], H5S_SELECT_SET, start, stride, count, block) < 0)
+ TEST_ERROR
+
+ /* Strided selection in file (1st) */
+ start[0] = 0;
+ start[1] = 0;
+ stride[0] = 1;
+ stride[1] = 2;
+ count[0] = SEL_IO_DIM0;
+ count[1] = SEL_IO_DIM1 / 2;
+ block[0] = 1;
+ block[1] = 1;
+ if (H5Sselect_hyperslab(file_spaces[0], H5S_SELECT_SET, start, stride, count, block) < 0)
+ TEST_ERROR
+
+ /* Strided selection (across dim 1) in file (2nd) */
+ start[0] = 0;
+ start[1] = 1;
+ stride[0] = 1;
+ stride[1] = 2;
+ count[0] = SEL_IO_DIM0;
+ count[1] = SEL_IO_DIM1 / 2;
+ block[0] = 1;
+ block[1] = 1;
+ if (H5Sselect_hyperslab(file_spaces[1], H5S_SELECT_SET, start, stride, count, block) < 0)
+ TEST_ERROR
+
+ /* Use the same memory buffer for both selections */
+ wbufs[0] = wbuf2[0];
+
+ /* Shorten wbuf array */
+ if (shorten_element_sizes)
+ wbufs[1] = NULL;
+ else
+ wbufs[1] = wbufs[0];
+
+ /* Issue write call */
+ if (test_selection_io_write(lf, type, 2, mem_spaces, file_spaces, addrs, element_sizes,
+ (int **)wbufs) < 0)
+ TEST_ERROR
+
+ /* Update file bufs - need to reuse 1D array so data stays consistent, so use math to
+ * find 1D index into 2D array */
+ for (i = 0, i2 = 0, j2 = 0; i < SEL_IO_DIM0; i += 2)
+ for (j = 0; j < SEL_IO_DIM1; j++) {
+ HDassert(i2 < SEL_IO_DIM0);
+ fbuf1[(i2 * SEL_IO_DIM1) + j2] = wbuf2[i][j];
+ j2 += 2;
+ if (j2 >= SEL_IO_DIM1) {
+ i2++;
+ j2 = 0;
+ }
+ }
+ for (i = 1, i2 = 0, j2 = 1; i < SEL_IO_DIM0; i += 2)
+ for (j = 0; j < SEL_IO_DIM1; j++) {
+ HDassert(i2 < SEL_IO_DIM0);
+ fbuf2[i2][j2] = wbuf2[i][j];
+ j2 += 2;
+ if (j2 >= SEL_IO_DIM1) {
+ i2++;
+ j2 = 1;
+ }
+ }
+
+ /* Update expected read buf */
+ for (i = 0; i < SEL_IO_DIM0; i++)
+ for (j = 0; j < SEL_IO_DIM1; j++)
+ erbuf2[i][j] = -1;
+ for (i = 0; i < SEL_IO_DIM0; i += 2)
+ for (j = 0; j < SEL_IO_DIM1; j++)
+ erbuf2[i][j] = wbuf2[i][j];
+ for (i = 1; i < SEL_IO_DIM0; i += 2)
+ for (j = 0; j < SEL_IO_DIM1; j++)
+ erbuf2[i][j] = wbuf2[i][j];
+
+ /* Read and verify */
+ if (test_selection_io_read_verify(lf, type, 2, mem_spaces, file_spaces, addrs, element_sizes, 1,
+ (int **)&erbufs[1], shorten_element_sizes ? TRUE : FALSE) < 0)
+ TEST_ERROR
+
+ /* Reset selections */
+ if (H5Sselect_all(mem_spaces[0]) < 0)
+ TEST_ERROR
+ if (H5Sselect_all(file_spaces[0]) < 0)
+ TEST_ERROR
+ if (H5Sselect_all(mem_spaces[1]) < 0)
+ TEST_ERROR
+ if (H5Sselect_all(file_spaces[1]) < 0)
+ TEST_ERROR
+
+ /* Read entire file buffer and verify */
+ if (test_selection_io_read_verify(lf, type, 2, mem_spaces, file_spaces, addrs, element_sizes, 2,
+ (int **)fbufs, FALSE) < 0)
+ TEST_ERROR
+
+ /* Reset first spaces to 1D */
+ if (H5Sset_extent_simple(mem_spaces[0], 1, dims1, NULL) < 0)
+ TEST_ERROR
+ if (H5Sset_extent_simple(file_spaces[0], 1, dims1, NULL) < 0)
+ TEST_ERROR
+
+ /* Reset write buffer array */
+ wbufs[0] = wbuf1;
+ wbufs[1] = wbuf2[0];
+
+ /* Change to shortened element sizes array */
+ element_sizes[1] = 0;
+ }
+
+ /* Reset element sizes array */
+ element_sizes[1] = element_sizes[0];
+ }
+
+ /*
+ * Cleanup
+ */
+ /* Close file */
+ if (H5FDclose(lf) < 0)
+ TEST_ERROR;
+
+ h5_delete_test_file(FILENAME[0], fapl_id);
+
+ /* Close the fapl */
+ if (H5Pclose(fapl_id) < 0)
+ TEST_ERROR;
+
+ /* Close dataspaces */
+ for (i = 0; i < 2; i++) {
+ if (H5Sclose(mem_spaces[i]) < 0)
+ TEST_ERROR
+ if (H5Sclose(file_spaces[i]) < 0)
+ TEST_ERROR
+ }
+
+ PASSED();
+ return 0;
+
+error:
+ H5E_BEGIN_TRY
+ {
+ H5Pclose(fapl_id);
+ H5FDclose(lf);
+ for (i = 0; i < 2; i++) {
+ H5Sclose(mem_spaces[i]);
+ H5Sclose(file_spaces[i]);
+ }
+ }
+ H5E_END_TRY;
+ return -1;
+} /* end test_selection_io() */
+
+/*-------------------------------------------------------------------------
* Function: main
*
* Purpose: Tests the basic features of Virtual File Drivers
@@ -3943,6 +5972,8 @@ main(void)
HDprintf("Testing basic Virtual File Driver functionality.\n");
+ setup_rand();
+
nerrors += test_sec2() < 0 ? 1 : 0;
nerrors += test_core() < 0 ? 1 : 0;
nerrors += test_direct() < 0 ? 1 : 0;
@@ -3956,6 +5987,10 @@ main(void)
nerrors += test_windows() < 0 ? 1 : 0;
nerrors += test_ros3() < 0 ? 1 : 0;
nerrors += test_splitter() < 0 ? 1 : 0;
+ nerrors += test_vector_io("sec2") < 0 ? 1 : 0;
+ nerrors += test_vector_io("stdio") < 0 ? 1 : 0;
+ nerrors += test_selection_io("sec2") < 0 ? 1 : 0;
+ nerrors += test_selection_io("stdio") < 0 ? 1 : 0;
nerrors += test_ctl() < 0 ? 1 : 0;
if (nerrors) {