diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/CMakeTests.cmake | 42 | ||||
-rw-r--r-- | test/Makefile.am | 68 | ||||
-rw-r--r-- | test/ShellTests.cmake | 58 | ||||
-rw-r--r-- | test/external.c | 7 | ||||
-rw-r--r-- | test/filter_plugin.c | 10 | ||||
-rw-r--r-- | test/supervise.subr | 42 | ||||
-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.in | 113 | ||||
-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.in | 140 | ||||
-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_vfd_swmr.sh.in (renamed from test/testvfdswmr.sh.in) | 25 | ||||
-rw-r--r-- | test/test_vol_plugin.sh.in | 84 | ||||
-rw-r--r-- | test/vfd_swmr.c | 3 | ||||
-rw-r--r-- | test/vfd_swmr_bigset_writer.c | 12 | ||||
-rw-r--r-- | test/vfd_swmr_common.c | 2 | ||||
-rw-r--r-- | test/vfd_swmr_dsetchks_writer.c | 4 | ||||
-rw-r--r-- | test/vfd_swmr_gfail_writer.c | 27 | ||||
-rw-r--r-- | test/vfd_swmr_gperf_writer.c | 371 | ||||
-rw-r--r-- | test/vfd_swmr_indep_rw_writer.c | 46 |
30 files changed, 482 insertions, 572 deletions
diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index 4e828f8..6abef3b 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -674,18 +674,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 @@ -853,16 +853,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) @@ -875,10 +865,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 2a22ac4..2b62cf0 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -22,22 +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 \ - testvfdswmr.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 test_vfd_swmr.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) \ @@ -58,10 +59,9 @@ SCRIPT_DEPEND = error_test$(EXEEXT) err_compat$(EXEEXT) links_env$(EXEEXT) \ vfd_swmr_indep_wr_p0$(EXEEXT) vfd_swmr_indep_wr_p1$(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 @@ -84,22 +84,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 \ @@ -124,7 +127,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 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/external.c b/test/external.c index 11185b3..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; } @@ -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/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/supervise.subr b/test/supervise.subr deleted file mode 100644 index 8fc526a..0000000 --- a/test/supervise.subr +++ /dev/null @@ -1,42 +0,0 @@ -#!/us/bin/env bash -# -# Copyright by Akadio, Inc. -# -# 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. -# -# Tests for the vfd swmr feature. - -# catch_out_err_and_rc outbase command [arguments] -# -# Run `command` with any `arguments` provided. Redirect `command`'s -# stderr and stdout to the file `outbase.out`. Record the result code -# of `command` in `outbase.rc`. -# -catch_out_err_and_rc() -{ - if [ $# -lt 2 ]; then - echo "usage: catch_output_and_rc outbase command [arguments]" \ - 1>&2 - exit 1 - fi - outbase=$1 - shift - { - "$@" < ${STDIN_PATH:-/dev/stdin} > ${STDOUT_PATH:-/dev/stdout} & - echo $! > ${outbase}.pid - wait $(cat ${outbase}.pid) - echo $? > ${outbase}.rc - } 2>&1 | tee ${outbase}.out -} - -#catch_out_err_and_rc xxlsxx ls smiles & - -#wait -#echo result=$(cat xxlsxx.rc) - -#exit 0 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/testvfdswmr.sh.in b/test/test_vfd_swmr.sh.in index 88a4ec1..4ae4085 100644 --- a/test/testvfdswmr.sh.in +++ b/test/test_vfd_swmr.sh.in @@ -19,8 +19,6 @@ srcdir=@srcdir@ -. ${srcdir}/supervise.subr - utils_testdir=@abs_top_builddir@/@H5_UTILS_TEST_BUILDDIR@ ############################################################################### @@ -122,6 +120,29 @@ WAIT_MESSAGE() { fi } +# catch_out_err_and_rc outbase command [arguments] +# +# Run `command` with any `arguments` provided. Redirect `command`'s +# stderr and stdout to the file `outbase.out`. Record the result code +# of `command` in `outbase.rc`. +# +catch_out_err_and_rc() +{ + if [ $# -lt 2 ]; then + echo "usage: catch_output_and_rc outbase command [arguments]" \ + 1>&2 + exit 1 + fi + outbase=$1 + shift + { + "$@" < ${STDIN_PATH:-/dev/stdin} > ${STDOUT_PATH:-/dev/stdout} & + echo $! > ${outbase}.pid + wait $(cat ${outbase}.pid) + echo $? > ${outbase}.rc + } 2>&1 | tee ${outbase}.out +} + ############################################################################### ## Main ## 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/vfd_swmr.c b/test/vfd_swmr.c index 0973dd8..c61a065 100644 --- a/test/vfd_swmr.c +++ b/test/vfd_swmr.c @@ -18,7 +18,6 @@ * *************************************************************/ -#include "H5queue.h" #include "h5test.h" #include "vfd_swmr_common.h" @@ -3391,7 +3390,7 @@ test_shadow_index_lookup(void) for (j = 0; j < cursize; j++) { H5FD_vfd_swmr_idx_entry_t *found; - found = vfd_swmr_pageno_to_mdf_idx_entry(idx, cursize, idx[j].hdf5_page_offset, FALSE); + found = H5FD_vfd_swmr_pageno_to_mdf_idx_entry(idx, cursize, idx[j].hdf5_page_offset, FALSE); if ((have_failj && failj == j) || found != &idx[j]) break; } diff --git a/test/vfd_swmr_bigset_writer.c b/test/vfd_swmr_bigset_writer.c index 357c3b1..3540c61 100644 --- a/test/vfd_swmr_bigset_writer.c +++ b/test/vfd_swmr_bigset_writer.c @@ -289,7 +289,7 @@ usage(const char *progname) "-w deflate_level: the level (0 - 9) of gzip compression\n" "\n", progname); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } static bool @@ -382,10 +382,10 @@ state_init(state_t *s, int argc, char **argv) s->use_named_pipe = false; break; case 'd': - if (strcmp(optarg, "1") == 0 || strcmp(optarg, "one") == 0) + if (HDstrcmp(optarg, "1") == 0 || HDstrcmp(optarg, "one") == 0) s->expand_2d = false; - else if (strcmp(optarg, "2") == 0 || strcmp(optarg, "two") == 0 || - strcmp(optarg, "both") == 0) + else if (HDstrcmp(optarg, "2") == 0 || HDstrcmp(optarg, "two") == 0 || + HDstrcmp(optarg, "both") == 0) s->expand_2d = true; else { HDfprintf(stderr, "bad -d argument %s\n", optarg); @@ -496,7 +496,7 @@ state_init(state_t *s, int argc, char **argv) #ifdef H5_HAVE_AUX_PROCESS if (s->vds == vds_multi) - exit(EXIT_SUCCESS); + HDexit(EXIT_SUCCESS); #endif if (s->vds != vds_off && s->expand_2d) { @@ -2703,7 +2703,7 @@ main(int argc, char **argv) /* Start to write chunks. The writer writes as many chunks as possible within a tick, then * notify the reader. But it doesn't receive back the reader's notice. */ if (!write_dsets(s, &np, mat)) { - fprintf(stderr, "write_dsets failed"); + HDfprintf(stderr, "write_dsets failed"); TEST_ERROR; } } diff --git a/test/vfd_swmr_common.c b/test/vfd_swmr_common.c index d0eca4f6..c89b078 100644 --- a/test/vfd_swmr_common.c +++ b/test/vfd_swmr_common.c @@ -51,7 +51,7 @@ below_speed_limit(struct timespec *last, const struct timespec *ival) /* NOTE: timespec_get() is C11. This may need further tweaks. */ #ifdef H5_HAVE_WIN32_API - if (timespec_get(&now, TIME_UTC) != TIME_UTC) { + if (HDtimespec_get(&now, TIME_UTC) != TIME_UTC) { #else if (HDclock_gettime(CLOCK_MONOTONIC, &now) == -1) { #endif diff --git a/test/vfd_swmr_dsetchks_writer.c b/test/vfd_swmr_dsetchks_writer.c index d649c3c..5c1f30d 100644 --- a/test/vfd_swmr_dsetchks_writer.c +++ b/test/vfd_swmr_dsetchks_writer.c @@ -254,7 +254,7 @@ usage(const char *progname) " -x <xincrs> or -y <ydecrs>\n" "\n"); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } /* usage() */ /* @@ -340,7 +340,7 @@ state_init(state_t *s, int argc, char **argv) case 'u': /* Ticks for reader to wait before verification */ case 'c': /* Communication interval */ errno = 0; - tmp = strtoul(optarg, &end, 0); + tmp = HDstrtoul(optarg, &end, 0); if (end == optarg || *end != '\0') { HDprintf("couldn't parse `-%c` argument `%s`\n", ch, optarg); TEST_ERROR; diff --git a/test/vfd_swmr_gfail_writer.c b/test/vfd_swmr_gfail_writer.c index 53b95d3..27d6c31 100644 --- a/test/vfd_swmr_gfail_writer.c +++ b/test/vfd_swmr_gfail_writer.c @@ -631,7 +631,7 @@ main(int argc, char **argv) /* Delete 1000 groups if the del_grp option is true. */ if (s.del_grp && s.nsteps > 1000) { - printf("Deleting groups. \n"); + HDprintf("Deleting groups. \n"); for (step = s.nsteps - 1; step >= (s.nsteps - 1000); step--) { dbgf(2, "writer: deleting step %d\n", step); @@ -667,21 +667,21 @@ main(int argc, char **argv) } if (HDclock_gettime(CLOCK_MONOTONIC, &start_time) == -1) { - fprintf(stderr, "HDclock_gettime failed"); + HDfprintf(stderr, "HDclock_gettime failed"); TEST_ERROR; } - printf("Reader: call back function: check group names.\n"); + HDprintf("Reader: call back function: check group names.\n"); if (H5Literate(s.file, H5_INDEX_NAME, H5_ITER_NATIVE, NULL, op_func, NULL) < 0) { - printf("H5Literate failed \n"); + HDprintf("H5Literate failed \n"); TEST_ERROR; } if (HDclock_gettime(CLOCK_MONOTONIC, &end_time) == -1) { - fprintf(stderr, "HDclock_gettime failed"); + HDfprintf(stderr, "HDclock_gettime failed"); TEST_ERROR; } temp_time = TIME_PASSED(start_time, end_time); - fprintf(stdout, "H5Literate: temp time = %lf\n", temp_time); + HDfprintf(stdout, "H5Literate: temp time = %lf\n", temp_time); } if (H5Pclose(fapl) < 0) { @@ -768,22 +768,11 @@ op_func(hid_t loc_id, const char *name, const H5L_info_t *info, void *operator_d (void)info; (void)operator_data; -#if 0 /* Kent for debugging purpose. */ - char * subname; - int grp_num; -#endif - - if (strncmp(name, "group", (size_t)5) != 0) { - printf("Iteration failed: group name is %s\n", name); + if (HDstrncmp(name, "group", (size_t)5) != 0) { + HDprintf("Iteration failed: group name is %s\n", name); return -1; } else { -#if 0 /* Kent for debugging purpose. */ - subname = name + 6; - grp_num = atoi((const char *)subname); - if (grp_num > 1450000 && grp_num % 5000 == 0) - dbgf(2, "Group name is %s\n", name); -#endif return 0; } } diff --git a/test/vfd_swmr_gperf_writer.c b/test/vfd_swmr_gperf_writer.c index dbceace..66fd22f 100644 --- a/test/vfd_swmr_gperf_writer.c +++ b/test/vfd_swmr_gperf_writer.c @@ -112,7 +112,7 @@ typedef struct { static void usage(const char *progname) { - fprintf( + HDfprintf( stderr, "usage: ./%s -P -n 1000 -N 5 -q (create 1000 groups, each group has 5 attributes)\n" "usage: ./%s -P -L -n 100000 -q (create 100000 groups and generate log message to file 'log-test')\n" @@ -197,7 +197,7 @@ usage(const char *progname) "-q: silence printouts, few messages\n" "\n", progname, progname); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } static bool @@ -212,7 +212,7 @@ state_init(state_t *s, int argc, char **argv) *s = ALL_HID_INITIALIZER; if (H5_basename(argv[0], &tfile) < 0) { - printf("H5_basename failed\n"); + HDprintf("H5_basename failed\n"); TEST_ERROR; } @@ -250,15 +250,15 @@ state_init(state_t *s, int argc, char **argv) errno = 0; tmp = HDstrtoul(optarg, &end, 0); if (end == optarg || *end != '\0') { - printf("couldn't parse `-%c` argument `%s`\n", ch, optarg); + HDprintf("couldn't parse `-%c` argument `%s`\n", ch, optarg); TEST_ERROR; } else if (errno != 0) { - printf("couldn't parse `-%c` argument `%s`\n", ch, optarg); + HDprintf("couldn't parse `-%c` argument `%s`\n", ch, optarg); TEST_ERROR; } else if (tmp > UINT_MAX) { - printf("`-%c` argument `%lu` too large\n", ch, tmp); + HDprintf("`-%c` argument `%lu` too large\n", ch, tmp); TEST_ERROR; } @@ -301,7 +301,7 @@ state_init(state_t *s, int argc, char **argv) else if (HDstrcmp(optarg, "grp-dense-t-compact") == 0) s->grp_op_pattern = 'T'; else { - printf("Invalid -O argument \"%s\"", optarg); + HDprintf("Invalid -O argument \"%s\"", optarg); TEST_ERROR; } break; @@ -331,7 +331,7 @@ state_init(state_t *s, int argc, char **argv) else if (HDstrcmp(optarg, "del-ohr-block") == 0) s->at_pattern = 'R'; else { - printf("Invalid -A argument \"%s\"", optarg); + HDprintf("Invalid -A argument \"%s\"", optarg); TEST_ERROR; } break; @@ -354,24 +354,24 @@ state_init(state_t *s, int argc, char **argv) if (!s->grp_op_test) { if (s->asteps < 1 || s->asteps > s->nsteps) { - printf("attribute interval is out of bounds\n"); + HDprintf("attribute interval is out of bounds\n"); TEST_ERROR; } } if (s->grp_op_test && s->attr_test) { - printf("Cannot test both group operation and attribute tests!\n"); - printf("Attribute tests are ignored.\n"); + HDprintf("Cannot test both group operation and attribute tests!\n"); + HDprintf("Attribute tests are ignored.\n"); } if (argc > 0) { - printf("unexpected command-line arguments\n"); + HDprintf("unexpected command-line arguments\n"); TEST_ERROR; } /* space for attributes */ if ((s->one_by_one_sid = H5Screate_simple(1, &dims, &dims)) < 0) { - printf("H5Screate_simple failed\n"); + HDprintf("H5Screate_simple failed\n"); TEST_ERROR; } @@ -395,11 +395,11 @@ error: * * bool one_chunk_ohr * flag to indicate if the object header chunk is 1 or greater - * 1: true - * greater than 1: false + * 1: TRUE + * greater than 1: FALSE * - * Return: Success: true - * Failure: false + * Return: Success: TRUE + * Failure: FALSE * *------------------------------------------------------------------------- */ @@ -412,19 +412,19 @@ check_ohr_num_chunk(hid_t g, bool one_chunk_ohr) /* Get the object information */ if (H5Oget_native_info(g, &ninfo, H5O_NATIVE_INFO_HDR) < 0) { - printf("H5Oget_native_info failed\n"); + HDprintf("H5Oget_native_info failed\n"); TEST_ERROR; } if (true == one_chunk_ohr) { if (ninfo.hdr.nchunks != 1) { - printf("Object header should have only one chunk,but it is not.\n"); + HDprintf("Object header should have only one chunk,but it is not.\n"); TEST_ERROR; } } else { if (ninfo.hdr.nchunks <= 1) { - printf("Object header should have more than one chunk,but it is not.\n"); + HDprintf("Object header should have more than one chunk,but it is not.\n"); TEST_ERROR; } } @@ -482,7 +482,7 @@ add_attr(state_t *s, hid_t oid, unsigned int which, unsigned num_attrs, const ch /* Need to obtain native datatype for H5Aread */ if ((amtype = H5Tget_native_type(atype, H5T_DIR_ASCEND)) < 0) { - printf("H5Tget_native_type failed\n"); + HDprintf("H5Tget_native_type failed\n"); TEST_ERROR; } @@ -492,7 +492,7 @@ add_attr(state_t *s, hid_t oid, unsigned int which, unsigned num_attrs, const ch /* Construct attribute name like attr-0-0 */ HDsprintf(attrname, aname_fmt, which, u); if ((aid = H5Acreate2(oid, attrname, atype, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) { - printf("H5Acreate2 failed\n"); + HDprintf("H5Acreate2 failed\n"); TEST_ERROR; } @@ -502,13 +502,13 @@ add_attr(state_t *s, hid_t oid, unsigned int which, unsigned num_attrs, const ch /* Write data into the attribute */ if (H5Awrite(aid, amtype, &attr_value) < 0) { - printf("H5Awrite failed\n"); + HDprintf("H5Awrite failed\n"); TEST_ERROR; } /* Close attribute */ if (H5Aclose(aid) < 0) { - printf("H5Aclose failed\n"); + HDprintf("H5Aclose failed\n"); TEST_ERROR; } @@ -516,8 +516,8 @@ add_attr(state_t *s, hid_t oid, unsigned int which, unsigned num_attrs, const ch * we need to check if this test behaves as expected. */ if (s->at_pattern == 'a' || s->at_pattern == 'R') { if (false == check_ohr_num_chunk(oid, false)) { - printf("An object header continuation block should be created. \n"); - printf("But it is not.\n"); + HDprintf("An object header continuation block should be created. \n"); + HDprintf("But it is not.\n"); TEST_ERROR; } } @@ -580,7 +580,7 @@ add_vlstr_attr(state_t *s, hid_t g, unsigned int which) /* Allocate buffer for the VL string value */ astr_val = HDmalloc(VS_ATTR_NAME_LEN); if (astr_val == NULL) { - printf("Allocate memory for VL string failed.\n"); + HDprintf("Allocate memory for VL string failed.\n"); TEST_ERROR; } @@ -592,32 +592,32 @@ add_vlstr_attr(state_t *s, hid_t g, unsigned int which) /* Create a datatype to refer to. */ if ((atype = H5Tcopy(H5T_C_S1)) < 0) { - printf("Cannot create variable length datatype.\n"); + HDprintf("Cannot create variable length datatype.\n"); TEST_ERROR; } if (H5Tset_size(atype, H5T_VARIABLE) < 0) { - printf("Cannot set variable length datatype.\n"); + HDprintf("Cannot set variable length datatype.\n"); TEST_ERROR; } /* Generate the VL string attribute.*/ if ((aid = H5Acreate2(g, name, atype, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) { - printf("H5Acreate2 failed.\n"); + HDprintf("H5Acreate2 failed.\n"); TEST_ERROR; } if (H5Awrite(aid, atype, &astr_val) < 0) { - printf("H5Awrite failed.\n"); + HDprintf("H5Awrite failed.\n"); TEST_ERROR; } if (H5Tclose(atype) < 0) { - printf("H5Tclose() failed\n"); + HDprintf("H5Tclose() failed\n"); TEST_ERROR; } if (H5Aclose(aid) < 0) { - printf("H5Aclose() failed\n"); + HDprintf("H5Aclose() failed\n"); TEST_ERROR; } @@ -785,7 +785,7 @@ del_one_attr(state_t *s, hid_t obj_id, bool is_dense, bool is_vl_or_ohrc, unsign /* Delete the attribute */ if (H5Adelete(obj_id, attrname) < 0) { - printf("H5Adelete() failed\n"); + HDprintf("H5Adelete() failed\n"); TEST_ERROR; } @@ -793,7 +793,7 @@ del_one_attr(state_t *s, hid_t obj_id, bool is_dense, bool is_vl_or_ohrc, unsign * we need to check if this test behaves as expected. */ if (s->at_pattern == 'R') { if (false == check_ohr_num_chunk(obj_id, true)) { - printf("The object header chunk should not continue. \n"); + HDprintf("The object header chunk should not continue. \n"); TEST_ERROR; } } @@ -881,12 +881,12 @@ modify_attr(state_t *s, hid_t g, const char *aname_fmt, unsigned int which) HDsprintf(attrname, aname_fmt, which, 0); if ((aid = H5Aopen(g, attrname, H5P_DEFAULT)) < 0) { - printf("H5Aopen failed\n"); + HDprintf("H5Aopen failed\n"); TEST_ERROR; } if ((amtype = H5Tget_native_type(s->filetype, H5T_DIR_ASCEND)) < 0) { - printf("H5Tget_native_type failed\n"); + HDprintf("H5Tget_native_type failed\n"); TEST_ERROR; } @@ -894,15 +894,15 @@ modify_attr(state_t *s, hid_t g, const char *aname_fmt, unsigned int which) modify_value = which + 10000; if (H5Awrite(aid, amtype, &modify_value) < 0) { - printf("H5Awrite failed\n"); + HDprintf("H5Awrite failed\n"); TEST_ERROR; } if (H5Tclose(amtype) < 0) { - printf("H5Tclose failed\n"); + HDprintf("H5Tclose failed\n"); TEST_ERROR; } if (H5Aclose(aid) < 0) { - printf("H5Aclose failed\n"); + HDprintf("H5Aclose failed\n"); TEST_ERROR; } @@ -949,7 +949,7 @@ modify_vlstr_attr(hid_t g, unsigned int which) astr_val = HDmalloc(VS_ATTR_NAME_LEN); if (astr_val == NULL) { - printf("Allocate memory for VL string failed.\n"); + HDprintf("Allocate memory for VL string failed.\n"); TEST_ERROR; } @@ -961,35 +961,35 @@ modify_vlstr_attr(hid_t g, unsigned int which) /* Create a datatype to refer to. */ if ((atype = H5Tcopy(H5T_C_S1)) < 0) { - printf("Cannot create variable length datatype.\n"); + HDprintf("Cannot create variable length datatype.\n"); TEST_ERROR; } if (H5Tset_size(atype, H5T_VARIABLE) < 0) { - printf("Cannot set variable length datatype.\n"); + HDprintf("Cannot set variable length datatype.\n"); TEST_ERROR; } /* Open this attribute. */ if ((aid = H5Aopen(g, name, H5P_DEFAULT)) < 0) { - printf("H5Aopen failed.\n"); + HDprintf("H5Aopen failed.\n"); TEST_ERROR; } dbgf(1, "The modified VL string value is %s \n", astr_val); if (H5Awrite(aid, atype, &astr_val) < 0) { - printf("H5Awrite failed.\n"); + HDprintf("H5Awrite failed.\n"); TEST_ERROR; } if (H5Tclose(atype) < 0) { - printf("H5Tclose() failed\n"); + HDprintf("H5Tclose() failed\n"); TEST_ERROR; } if (H5Aclose(aid) < 0) { - printf("H5Aclose() failed\n"); + HDprintf("H5Aclose() failed\n"); TEST_ERROR; } @@ -1098,7 +1098,7 @@ add_attrs_compact(state_t *s, hid_t g, hid_t gcpl, unsigned int which) * storage and the minimal number of attributes to be stored in * dense storage. */ if (H5Pget_attr_phase_change(gcpl, &max_compact, &min_dense) < 0) { - printf("H5Pget_attr_phase_change() failed\n"); + HDprintf("H5Pget_attr_phase_change() failed\n"); TEST_ERROR; } } @@ -1152,7 +1152,7 @@ add_attrs_compact_dense(state_t *s, hid_t g, hid_t gcpl, unsigned int which) bool ret_value = false; if (H5Pget_attr_phase_change(gcpl, &max_compact, &min_dense) < 0) { - printf("H5Pget_attr_phase_change failed\n"); + HDprintf("H5Pget_attr_phase_change failed\n"); TEST_ERROR; } @@ -1208,21 +1208,30 @@ del_attrs_compact_dense_compact(hid_t obj_id, hid_t gcpl, unsigned int which) char attrname[VS_ATTR_NAME_LEN]; const char *aname_format = "attr-%u-%u"; const char *adname_format = "attr-d-%u-%u"; + int sz; /* Obtain the maximal number of attributes to be stored in compact * storage and the minimal number of attributes to be stored in * dense storage. */ if (H5Pget_attr_phase_change(gcpl, &max_compact, &min_dense) < 0) { - printf("H5Pget_attr_phase_change failed\n"); + HDprintf("H5Pget_attr_phase_change failed\n"); TEST_ERROR; } u = max_compact + 1; - /* delete a number of attributes so that the attribute storage just becomes dense.*/ + /* Delete a number of attributes so that the attribute storage just becomes dense.*/ for (u--; u >= (min_dense - 1); u--) { - HDsprintf(attrname, aname_format, which, max_compact - u); + sz = HDsnprintf(attrname, VS_ATTR_NAME_LEN - 1, aname_format, which, max_compact - u); + if (sz < 0) { + HDprintf("snprintf format error\n"); + TEST_ERROR; + } + if (sz > VS_ATTR_NAME_LEN - 1) { + HDprintf("snprintf truncated string\n"); + TEST_ERROR; + } if (H5Adelete(obj_id, attrname) < 0) { - printf("H5Adelete failed\n"); + HDprintf("H5Adelete failed\n"); TEST_ERROR; } } @@ -1235,9 +1244,17 @@ del_attrs_compact_dense_compact(hid_t obj_id, hid_t gcpl, unsigned int which) * The attribute name to be deleted is attr-max_compact+which-0 */ - HDsprintf(attrname, adname_format, max_compact + which, 0); + sz = HDsnprintf(attrname, VS_ATTR_NAME_LEN - 1, adname_format, max_compact + which, 0); + if (sz < 0) { + HDprintf("snprintf format error\n"); + TEST_ERROR; + } + if (sz > VS_ATTR_NAME_LEN - 1) { + HDprintf("snprintf truncated string\n"); + TEST_ERROR; + } if (H5Adelete(obj_id, attrname) < 0) { - printf("H5Adelete failed\n"); + HDprintf("H5Adelete failed\n"); TEST_ERROR; } @@ -1333,7 +1350,7 @@ add_del_attrs_compact_dense(state_t *s, hid_t g, hid_t gcpl, unsigned int which) unsigned min_dense = 0; if (H5Pget_attr_phase_change(gcpl, &max_compact, &min_dense) < 0) { - printf("H5Pget_attr_phase_change failed\n"); + HDprintf("H5Pget_attr_phase_change failed\n"); TEST_ERROR; } @@ -1579,7 +1596,7 @@ write_group(state_t *s, unsigned int which) double temp_time; if (which >= s->nsteps) { - printf("Number of created groups is out of bounds\n"); + HDprintf("Number of created groups is out of bounds\n"); TEST_ERROR; } @@ -1590,14 +1607,14 @@ write_group(state_t *s, unsigned int which) else { gcpl = H5Pcreate(H5P_GROUP_CREATE); if (gcpl < 0) { - printf("H5Pcreate failed\n"); + HDprintf("H5Pcreate failed\n"); TEST_ERROR; } /* If we test the dense storage, change the attribute phase. */ if (s->at_pattern == 'd') { if (H5Pset_attr_phase_change(gcpl, 0, 0) < 0) { - printf("H5Pset_attr_phase_change failed for the dense storage.\n"); + HDprintf("H5Pset_attr_phase_change failed for the dense storage.\n"); TEST_ERROR; } } @@ -1607,14 +1624,14 @@ write_group(state_t *s, unsigned int which) if (HDclock_gettime(CLOCK_MONOTONIC, &start_time) == -1) { - fprintf(stderr, "HDclock_gettime failed"); + HDfprintf(stderr, "HDclock_gettime failed"); TEST_ERROR; } } if ((g = H5Gcreate2(s->file, name, H5P_DEFAULT, gcpl, H5P_DEFAULT)) < 0) { - printf("H5Gcreate2 failed\n"); + HDprintf("H5Gcreate2 failed\n"); TEST_ERROR; } @@ -1622,7 +1639,7 @@ write_group(state_t *s, unsigned int which) if (HDclock_gettime(CLOCK_MONOTONIC, &end_time) == -1) { - fprintf(stderr, "HDclock_gettime failed"); + HDfprintf(stderr, "HDclock_gettime failed"); TEST_ERROR; } @@ -1639,27 +1656,27 @@ write_group(state_t *s, unsigned int which) if (s->at_pattern == 'a' || s->at_pattern == 'R') { if ((dummy_d = H5Dcreate2(g, "Dataset", H5T_NATIVE_INT, s->one_by_one_sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) { - printf("H5Dcreate2 failed\n"); + HDprintf("H5Dcreate2 failed\n"); TEST_ERROR; } } /* We only need to check the first group */ if (which == 0) { if (H5Gget_info(g, &group_info) < 0) { - printf("H5Gget_info failed\n"); + HDprintf("H5Gget_info failed\n"); TEST_ERROR; } if (s->old_style_grp) { if (group_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE) { - printf("Old-styled group test: but the group is not in old-style. \n"); + HDprintf("Old-styled group test: but the group is not in old-style. \n"); TEST_ERROR; } dbgf(2, "Writer: group is created with the old-style.\n"); } else { if (group_info.storage_type == H5G_STORAGE_TYPE_SYMBOL_TABLE) { - printf("The created group should NOT be in old-style . \n"); + HDprintf("The created group should NOT be in old-style . \n"); TEST_ERROR; } dbgf(2, "Writer: group is created with the new-style.\n"); @@ -1670,8 +1687,8 @@ write_group(state_t *s, unsigned int which) * we need to check if this test behaves as expected. */ if (s->at_pattern == 'a' || s->at_pattern == 'R') { if (false == check_ohr_num_chunk(g, true)) { - printf("An object header continuation block should NOT be created. \n"); - printf("But it is created.\n"); + HDprintf("An object header continuation block should NOT be created. \n"); + HDprintf("But it is created.\n"); TEST_ERROR; } } @@ -1682,18 +1699,18 @@ write_group(state_t *s, unsigned int which) if (s->at_pattern == 'a' || s->at_pattern == 'R') { if (H5Dclose(dummy_d) < 0) { - printf("H5Dclose failed\n"); + HDprintf("H5Dclose failed\n"); TEST_ERROR; } } if (H5Gclose(g) < 0) { - printf("H5Gclose failed\n"); + HDprintf("H5Gclose failed\n"); TEST_ERROR; } if (!s->old_style_grp && H5Pclose(gcpl) < 0) { - printf("H5Pclose failed\n"); + HDprintf("H5Pclose failed\n"); TEST_ERROR; } @@ -1748,49 +1765,49 @@ create_group_id(state_t *s, unsigned int which, bool dense_to_compact) H5G_info_t group_info; if (which >= s->nsteps) { - printf("Number of created groups is out of bounds\n"); + HDprintf("Number of created groups is out of bounds\n"); TEST_ERROR; } gcpl = H5Pcreate(H5P_GROUP_CREATE); if (gcpl < 0) { - printf("H5Pcreate failed\n"); + HDprintf("H5Pcreate failed\n"); TEST_ERROR; } if (dense_to_compact) { if (H5Pset_link_phase_change(gcpl, 2, 2) < 0) { - printf("H5Pset_link_phase_change failed for dense to compact.\n"); + HDprintf("H5Pset_link_phase_change failed for dense to compact.\n"); TEST_ERROR; } } else { if (H5Pset_link_phase_change(gcpl, 1, 1) < 0) { - printf("H5Pset_attr_phase_change failed for compact to dense.\n"); + HDprintf("H5Pset_attr_phase_change failed for compact to dense.\n"); TEST_ERROR; } } esnprintf(name, sizeof(name), "/group-%u", which); if ((g = H5Gcreate2(s->file, name, H5P_DEFAULT, gcpl, H5P_DEFAULT)) < 0) { - printf("H5Gcreate2 failed\n"); + HDprintf("H5Gcreate2 failed\n"); TEST_ERROR; } if (H5Gget_info(g, &group_info) < 0) { - printf("H5Gget_info failed\n"); + HDprintf("H5Gget_info failed\n"); TEST_ERROR; } /* The storage type should always be compact when a group is created. */ if (group_info.storage_type != H5G_STORAGE_TYPE_COMPACT) { - printf("New-style group link storage test:. \n"); - printf(" still be compact after group creation. \n"); + HDprintf("New-style group link storage test:. \n"); + HDprintf(" still be compact after group creation. \n"); TEST_ERROR; } if (H5Pclose(gcpl) < 0) { - printf("H5Pclose failed\n"); + HDprintf("H5Pclose failed\n"); TEST_ERROR; } @@ -1827,7 +1844,7 @@ close_group_id(hid_t g) { if (H5Gclose(g) < 0) { - printf("H5Gclose failed\n"); + HDprintf("H5Gclose failed\n"); TEST_ERROR; } @@ -1866,38 +1883,38 @@ create_group(state_t *s, unsigned int which) H5G_info_t group_info; if (which >= s->nsteps) { - printf("Number of created groups is out of bounds\n"); + HDprintf("Number of created groups is out of bounds\n"); TEST_ERROR; } esnprintf(name, sizeof(name), "/group-%u", which); if ((g = H5Gcreate2(s->file, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) { - printf("H5Gcreate2 failed\n"); + HDprintf("H5Gcreate2 failed\n"); TEST_ERROR; } if (H5Gget_info(g, &group_info) < 0) { - printf("H5Gget_info failed\n"); + HDprintf("H5Gget_info failed\n"); TEST_ERROR; } if (s->old_style_grp) { if (group_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE) { - printf("Old-styled group test: but the group is not in old-style. \n"); + HDprintf("Old-styled group test: but the group is not in old-style. \n"); TEST_ERROR; } dbgf(2, "Writer: group is created with the old-style.\n"); } else { if (group_info.storage_type == H5G_STORAGE_TYPE_SYMBOL_TABLE) { - printf("The created group should NOT be in old-style . \n"); + HDprintf("The created group should NOT be in old-style . \n"); TEST_ERROR; } dbgf(2, "Writer: group is created with the new-style.\n"); } if (H5Gclose(g) < 0) { - printf("H5Gclose failed\n"); + HDprintf("H5Gclose failed\n"); TEST_ERROR; } @@ -1953,38 +1970,38 @@ delete_one_link(state_t *s, hid_t obj_id, const char *name, short link_storage, H5G_info_t group_info; if (which >= s->nsteps) { - printf("Number of created groups is out of bounds\n"); + HDprintf("Number of created groups is out of bounds\n"); TEST_ERROR; } if (H5Ldelete(obj_id, name, H5P_DEFAULT) < 0) { - printf("H5Ldelete failed\n"); + HDprintf("H5Ldelete failed\n"); TEST_ERROR; } if (link_storage > 0) { if (s->old_style_grp) { - printf("Old style group doesn't support the indexed storage.\n"); + HDprintf("Old style group doesn't support the indexed storage.\n"); TEST_ERROR; } if (H5Gget_info(obj_id, &group_info) < 0) { - printf("H5Gget_info failed\n"); + HDprintf("H5Gget_info failed\n"); TEST_ERROR; } if (link_storage == 1) { if (group_info.storage_type != H5G_STORAGE_TYPE_COMPACT) { - printf("The group link storage should be compact. \n"); + HDprintf("The group link storage should be compact. \n"); TEST_ERROR; } } else { if (group_info.storage_type != H5G_STORAGE_TYPE_DENSE) { - printf("The group link storage should be dense. \n"); + HDprintf("The group link storage should be dense. \n"); TEST_ERROR; } } @@ -2066,12 +2083,12 @@ move_one_group(state_t *s, hid_t obj_id, const char *name, const char *newname, { if (which >= s->nsteps) { - printf("Number of created groups is out of bounds\n"); + HDprintf("Number of created groups is out of bounds\n"); TEST_ERROR; } if (H5Lmove(obj_id, name, obj_id, newname, H5P_DEFAULT, H5P_DEFAULT) < 0) { - printf("H5Ldelete failed\n"); + HDprintf("H5Ldelete failed\n"); TEST_ERROR; } @@ -2163,7 +2180,7 @@ insert_one_link(state_t *s, hid_t obj_id, const char *name, const char *newname, H5G_info_t group_info; if (which >= s->nsteps) { - printf("Number of created groups is out of bounds\n"); + HDprintf("Number of created groups is out of bounds\n"); TEST_ERROR; } @@ -2173,13 +2190,13 @@ insert_one_link(state_t *s, hid_t obj_id, const char *name, const char *newname, if (is_hard) { if (link_storage > 0) { if (H5Lcreate_hard(s->file, name, obj_id, newname, H5P_DEFAULT, H5P_DEFAULT) < 0) { - printf("H5Lcreate_hard failed\n"); + HDprintf("H5Lcreate_hard failed\n"); TEST_ERROR; } } else { if (H5Lcreate_hard(obj_id, name, obj_id, newname, H5P_DEFAULT, H5P_DEFAULT) < 0) { - printf("H5Lcreate_hard failed\n"); + HDprintf("H5Lcreate_hard failed\n"); TEST_ERROR; } } @@ -2187,13 +2204,13 @@ insert_one_link(state_t *s, hid_t obj_id, const char *name, const char *newname, else { if (link_storage > 0) { if (H5Lcreate_soft("/", obj_id, newname, H5P_DEFAULT, H5P_DEFAULT) < 0) { - printf("H5Lcreate_soft failed\n"); + HDprintf("H5Lcreate_soft failed\n"); TEST_ERROR; } } else { if (H5Lcreate_soft(name, obj_id, newname, H5P_DEFAULT, H5P_DEFAULT) < 0) { - printf("H5Lcreate_soft failed.\n"); + HDprintf("H5Lcreate_soft failed.\n"); TEST_ERROR; } } @@ -2202,24 +2219,24 @@ insert_one_link(state_t *s, hid_t obj_id, const char *name, const char *newname, if (link_storage > 0) { if (s->old_style_grp) { - printf("Old style group doesn't support dense or compact storage.\n"); + HDprintf("Old style group doesn't support dense or compact storage.\n"); TEST_ERROR; } if (H5Gget_info(obj_id, &group_info) < 0) { - printf("H5Gget_info failed\n"); + HDprintf("H5Gget_info failed\n"); TEST_ERROR; } if (link_storage == 1) { if (group_info.storage_type != H5G_STORAGE_TYPE_COMPACT) { - printf("The group link storage should be compact. \n"); + HDprintf("The group link storage should be compact. \n"); TEST_ERROR; } } else { if (group_info.storage_type != H5G_STORAGE_TYPE_DENSE) { - printf("The group link storage should be dense. \n"); + HDprintf("The group link storage should be dense. \n"); TEST_ERROR; } } @@ -2343,7 +2360,7 @@ transit_storage_compact_to_dense(state_t *s, unsigned int which) hid_t g = create_group_id(s, which, false); if (g < 0) { - printf("create_group_id failed\n"); + HDprintf("create_group_id failed\n"); TEST_ERROR; } @@ -2351,19 +2368,19 @@ transit_storage_compact_to_dense(state_t *s, unsigned int which) esnprintf(name, sizeof(name), "/group-%u", which); esnprintf(hd_name, sizeof(hd_name), "hd-group-%u", which); if (insert_one_link(s, g, name, hd_name, true, 1, which) == false) { - printf("insert_one_link for compact storage failed\n"); + HDprintf("insert_one_link for compact storage failed\n"); TEST_ERROR; } /* Then insert a soft link, the storage becomes dense. */ esnprintf(st_name, sizeof(st_name), "st-group-%u", which); if (insert_one_link(s, g, name, st_name, false, 2, which) == false) { - printf("insert_one_link for dense storage failed\n"); + HDprintf("insert_one_link for dense storage failed\n"); TEST_ERROR; } if (close_group_id(g) == false) { - printf("insert_one_link for dense storage failed\n"); + HDprintf("insert_one_link for dense storage failed\n"); TEST_ERROR; } @@ -2410,7 +2427,7 @@ transit_storage_dense_to_compact(state_t *s, unsigned int which) hid_t g = create_group_id(s, which, true); if (g < 0) { - printf("create_group_id failed\n"); + HDprintf("create_group_id failed\n"); TEST_ERROR; } @@ -2418,38 +2435,38 @@ transit_storage_dense_to_compact(state_t *s, unsigned int which) esnprintf(name, sizeof(name), "/group-%u", which); esnprintf(hd_name, sizeof(hd_name), "hd-group-%u", which); if (insert_one_link(s, g, name, hd_name, true, 1, which) == false) { - printf("insert_one_link for compact storage failed\n"); + HDprintf("insert_one_link for compact storage failed\n"); TEST_ERROR; } /* Insert a link, storage is still compact. */ esnprintf(st_name, sizeof(st_name), "st-group-%u", which); if (insert_one_link(s, g, name, st_name, false, 1, which) == false) { - printf("insert_one_link for compact storage failed\n"); + HDprintf("insert_one_link for compact storage failed\n"); TEST_ERROR; } /* Insert a link, storage becomes dense. */ esnprintf(st2_name, sizeof(st2_name), "st2-group-%u", which); if (insert_one_link(s, g, name, st2_name, false, 2, which) == false) { - printf("insert_one_link for dense storage failed\n"); + HDprintf("insert_one_link for dense storage failed\n"); TEST_ERROR; } /* Delete a link, storage is still dense */ if (delete_one_link(s, g, st_name, 2, which) == false) { - printf("delete_one_link for dense storage failed\n"); + HDprintf("delete_one_link for dense storage failed\n"); TEST_ERROR; } /* Delete another link, storage becomes compact */ if (delete_one_link(s, g, st2_name, 1, which) == false) { - printf("delete_one_link for compact storage failed\n"); + HDprintf("delete_one_link for compact storage failed\n"); TEST_ERROR; } if (close_group_id(g) == false) { - printf("insert_one_link for dense storage failed\n"); + HDprintf("insert_one_link for dense storage failed\n"); TEST_ERROR; } @@ -2594,7 +2611,8 @@ static unsigned int obtain_tree_level_elems(unsigned int total_ele, unsigned int level) { - assert(level <= total_ele); + HDassert(level <= total_ele); + /* if every element is under the root, just return the total number of elements. */ if (level == 0) return total_ele; @@ -2654,7 +2672,7 @@ gen_tree_struct(state_t *s, unsigned int level, unsigned ne_per_level, hid_t pgr /* For each i a group is created. Use grp_counter to generate the group name. - printf("id: %u,level: %u, index: %u\n",id,level,i); + HDprintf("id: %u,level: %u, index: %u\n",id,level,i); */ esnprintf(name, sizeof(name), "group-%u", grp_counter); if (grp_counter == s->nsteps) @@ -2664,13 +2682,13 @@ gen_tree_struct(state_t *s, unsigned int level, unsigned ne_per_level, hid_t pgr if (s->gperf) { if (HDclock_gettime(CLOCK_MONOTONIC, &start_time) == -1) { - fprintf(stderr, "HDclock_gettime failed"); + HDfprintf(stderr, "HDclock_gettime failed"); TEST_ERROR; } } if ((grp_id = H5Gcreate2(pgrp_id, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) { - printf("H5Gcreate2 failed\n"); + HDprintf("H5Gcreate2 failed\n"); TEST_ERROR; } @@ -2678,7 +2696,7 @@ gen_tree_struct(state_t *s, unsigned int level, unsigned ne_per_level, hid_t pgr if (HDclock_gettime(CLOCK_MONOTONIC, &end_time) == -1) { - fprintf(stderr, "HDclock_gettime failed"); + HDfprintf(stderr, "HDclock_gettime failed"); TEST_ERROR; } @@ -2694,20 +2712,20 @@ gen_tree_struct(state_t *s, unsigned int level, unsigned ne_per_level, hid_t pgr /* Just check the first group information. */ if (grp_counter == 0) { if (H5Gget_info(grp_id, &group_info) < 0) { - printf("H5Gget_info failed\n"); + HDprintf("H5Gget_info failed\n"); TEST_ERROR; } if (s->old_style_grp) { if (group_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE) { - printf("Old-styled group test: but the group is not in old-style. \n"); + HDprintf("Old-styled group test: but the group is not in old-style. \n"); TEST_ERROR; } dbgf(2, "Writer: group is created with the old-style.\n"); } else { if (group_info.storage_type == H5G_STORAGE_TYPE_SYMBOL_TABLE) { - printf("The created group should NOT be in old-style . \n"); + HDprintf("The created group should NOT be in old-style . \n"); TEST_ERROR; } dbgf(2, "Writer: group is created with the new-style.\n"); @@ -2719,7 +2737,7 @@ gen_tree_struct(state_t *s, unsigned int level, unsigned ne_per_level, hid_t pgr result = add_default_group_attr(s, grp_id, grp_counter); if (result == false) { - printf("Cannot create group attributes. \n"); + HDprintf("Cannot create group attributes. \n"); TEST_ERROR; } grp_counter++; @@ -2727,13 +2745,13 @@ gen_tree_struct(state_t *s, unsigned int level, unsigned ne_per_level, hid_t pgr /* Generate groups in the next level */ result = gen_tree_struct(s, level - 1, ne_per_level, grp_id); if (result == false) { - printf("Cannot create nested groups. \n"); + HDprintf("Cannot create nested groups. \n"); TEST_ERROR; } /* close the group ID. No problem. */ if (H5Gclose(grp_id) < 0) { - printf("H5Gclose failed. \n"); + HDprintf("H5Gclose failed. \n"); TEST_ERROR; } } @@ -2766,7 +2784,7 @@ main(int argc, char **argv) unsigned int num_elems_per_level = 0; if (!state_init(&s, argc, argv)) { - printf("state_init failed\n"); + HDprintf("state_init failed\n"); TEST_ERROR; } @@ -2777,12 +2795,12 @@ main(int argc, char **argv) else if (personality != NULL && HDstrcmp(personality, "vfd_swmr_gperf_reader") == 0) writer = false; else { - printf("unknown personality, expected vfd_swmr_gperf_{reader,writer}\n"); + HDprintf("unknown personality, expected vfd_swmr_gperf_{reader,writer}\n"); TEST_ERROR; } if (writer == false) { - printf("Reader is skipped for the performance tests.\n"); + HDprintf("Reader is skipped for the performance tests.\n"); return EXIT_SUCCESS; } @@ -2801,7 +2819,7 @@ main(int argc, char **argv) * should be used as the second parameter of H5Pset_libver_bound(). * Also pass the use_vfd_swmr, only_meta_page, page buffer size, config to vfd_swmr_create_fapl().*/ if ((fapl = vfd_swmr_create_fapl(!s.old_style_grp, s.use_vfd_swmr, true, s.pbs, &config)) < 0) { - printf("vfd_swmr_create_fapl failed\n"); + HDprintf("vfd_swmr_create_fapl failed\n"); TEST_ERROR; } @@ -2813,8 +2831,8 @@ main(int argc, char **argv) if (s.nglevels > 0) { if (s.grp_op_pattern != ' ' || s.at_pattern != ' ') { - printf("For nested group creation test, only the default option is supported.\n"); - printf("Please re-run the tests with the appropriate option.\n"); + HDprintf("For nested group creation test, only the default option is supported.\n"); + HDprintf("Please re-run the tests with the appropriate option.\n"); TEST_ERROR; } } @@ -2822,7 +2840,7 @@ main(int argc, char **argv) if (s.gperf) { if (HDclock_gettime(CLOCK_MONOTONIC, &start_time) == -1) { - fprintf(stderr, "HDclock_gettime failed"); + HDfprintf(stderr, "HDclock_gettime failed"); TEST_ERROR; } } @@ -2832,7 +2850,7 @@ main(int argc, char **argv) if (s.gperf) { if (HDclock_gettime(CLOCK_MONOTONIC, &end_time) == -1) { - fprintf(stderr, "HDclock_gettime failed"); + HDfprintf(stderr, "HDclock_gettime failed"); TEST_ERROR; } @@ -2840,7 +2858,7 @@ main(int argc, char **argv) } if (s.file < 0) { - printf("H5Fcreate failed\n"); + HDprintf("H5Fcreate failed\n"); TEST_ERROR; } @@ -2852,7 +2870,7 @@ main(int argc, char **argv) if (s.gperf) { if (HDclock_gettime(CLOCK_MONOTONIC, &start_time) == -1) { - fprintf(stderr, "HDclock_gettime failed"); + HDfprintf(stderr, "HDclock_gettime failed"); TEST_ERROR; } } @@ -2863,7 +2881,7 @@ main(int argc, char **argv) /* for the recursive call, the groups under the root is treated as one level */ wg_ret = gen_tree_struct(&s, s.nglevels + 1, num_elems_per_level, s.file); if (wg_ret == false) { - printf("write nested group failed at group counter %u\n", grp_counter); + HDprintf("write nested group failed at group counter %u\n", grp_counter); TEST_ERROR; } } @@ -2873,7 +2891,7 @@ main(int argc, char **argv) dbgf(2, "writer: step %d\n", step); wg_ret = group_operations(&s, step); if (wg_ret == false) { - printf("write_group failed at step %d\n", step); + HDprintf("write_group failed at step %d\n", step); TEST_ERROR; } } @@ -2883,7 +2901,7 @@ main(int argc, char **argv) if (HDclock_gettime(CLOCK_MONOTONIC, &end_time) == -1) { - fprintf(stderr, "HDclock_gettime failed"); + HDfprintf(stderr, "HDclock_gettime failed"); TEST_ERROR; } @@ -2893,17 +2911,17 @@ main(int argc, char **argv) } if (H5Pclose(fapl) < 0) { - printf("H5Pclose failed\n"); + HDprintf("H5Pclose failed\n"); TEST_ERROR; } if (H5Pclose(fcpl) < 0) { - printf("H5Pclose failed\n"); + HDprintf("H5Pclose failed\n"); TEST_ERROR; } if (H5Sclose(s.one_by_one_sid) < 0) { - printf("H5Sclose failed\n"); + HDprintf("H5Sclose failed\n"); TEST_ERROR; } @@ -2911,14 +2929,14 @@ main(int argc, char **argv) if (HDclock_gettime(CLOCK_MONOTONIC, &start_time) == -1) { - fprintf(stderr, "HDclock_gettime failed"); + HDfprintf(stderr, "HDclock_gettime failed"); TEST_ERROR; } } if (H5Fclose(s.file) < 0) { - printf("H5Fclose failed\n"); + HDprintf("H5Fclose failed\n"); TEST_ERROR; } @@ -2926,7 +2944,7 @@ main(int argc, char **argv) if (HDclock_gettime(CLOCK_MONOTONIC, &end_time) == -1) { - fprintf(stderr, "HDclock_gettime failed"); + HDfprintf(stderr, "HDclock_gettime failed"); TEST_ERROR; } @@ -2939,48 +2957,49 @@ main(int argc, char **argv) if (verbosity != 0) { - fprintf(stdout, "\nPerformance Test Configuration: "); + HDfprintf(stdout, "\nPerformance Test Configuration: "); if (s.use_vfd_swmr) - fprintf(stdout, " Using VFD SWMR \n"); + HDfprintf(stdout, " Using VFD SWMR \n"); else - fprintf(stdout, " Not using VFD SWMR \n"); + HDfprintf(stdout, " Not using VFD SWMR \n"); if (s.old_style_grp) - fprintf(stdout, " Groups: Created via the earliest file format(old-style) \n"); + HDfprintf(stdout, " Groups: Created via the earliest file format(old-style) \n"); else - fprintf(stdout, " Groups: Created via the latest file format(new-style) \n"); - - fprintf(stdout, "\n"); - - fprintf(stdout, "The length of a tick = %u\n", s.tick_len); - fprintf(stdout, "The maximum expected lag(in ticks)= %u\n", s.max_lag); - fprintf(stdout, "The page size(in bytes) = %u\n", s.ps); - fprintf(stdout, "The page buffer size(in bytes) = %u\n", s.pbs); - fprintf(stdout, "\n"); - fprintf(stdout, "Number of groups = %u\n", s.nsteps); - fprintf(stdout, "Group Nested levels = %u\n", s.nglevels); - fprintf(stdout, "Number of attributes = %u\n", s.num_attrs); - fprintf(stdout, "Number of element per attribute = 1\n"); + HDfprintf(stdout, " Groups: Created via the latest file format(new-style) \n"); + + HDfprintf(stdout, "\n"); + + HDfprintf(stdout, "The length of a tick = %u\n", s.tick_len); + HDfprintf(stdout, "The maximum expected lag(in ticks)= %u\n", s.max_lag); + HDfprintf(stdout, "The page size(in bytes) = %u\n", s.ps); + HDfprintf(stdout, "The page buffer size(in bytes) = %u\n", s.pbs); + HDfprintf(stdout, "\n"); + HDfprintf(stdout, "Number of groups = %u\n", s.nsteps); + HDfprintf(stdout, "Group Nested levels = %u\n", s.nglevels); + HDfprintf(stdout, "Number of attributes = %u\n", s.num_attrs); + HDfprintf(stdout, "Number of element per attribute = 1\n"); if (s.vlstr_test) - fprintf(stdout, "Attribute datatype is variable length string. \n"); + HDfprintf(stdout, "Attribute datatype is variable length string. \n"); else if (s.filetype == H5T_STD_U32BE) - fprintf(stdout, "Attribute datatype is big-endian unsigned 32-bit integer.\n"); + HDfprintf(stdout, "Attribute datatype is big-endian unsigned 32-bit integer.\n"); else - fprintf(stdout, "Attribute datatype is native unsigned 32-bit integer.\n"); + HDfprintf(stdout, "Attribute datatype is native unsigned 32-bit integer.\n"); - fprintf(stdout, "\n"); - fprintf(stdout, - "(If the nested level is 0, all the groups are created directly under the root.)\n\n"); - fprintf(stdout, "group creation maximum time =%lf\n", s.max_gc_time); - fprintf(stdout, "group creation minimum time =%lf\n", s.min_gc_time); + HDfprintf(stdout, "\n"); + HDfprintf(stdout, + "(If the nested level is 0, all the groups are created directly under the root.)\n\n"); + HDfprintf(stdout, "group creation maximum time =%lf\n", s.max_gc_time); + HDfprintf(stdout, "group creation minimum time =%lf\n", s.min_gc_time); } - fprintf(stdout, "group creation total time = %lf\n", s.total_gc_time); - fprintf(stdout, "group creation mean time(per group) = %lf\n", s.mean_gc_time); - fprintf(stdout, "group creation and attributes generation total time = %lf\n", s.total_time); - fprintf(stdout, "group creation and attributes generation mean time(per group) = %lf\n", s.mean_time); - fprintf(stdout, "H5Fcreate time = %lf\n", s.fo_total_time); - fprintf(stdout, "H5Fclose time = %lf\n", s.fc_total_time); + HDfprintf(stdout, "group creation total time = %lf\n", s.total_gc_time); + HDfprintf(stdout, "group creation mean time(per group) = %lf\n", s.mean_gc_time); + HDfprintf(stdout, "group creation and attributes generation total time = %lf\n", s.total_time); + HDfprintf(stdout, "group creation and attributes generation mean time(per group) = %lf\n", + s.mean_time); + HDfprintf(stdout, "H5Fcreate time = %lf\n", s.fo_total_time); + HDfprintf(stdout, "H5Fclose time = %lf\n", s.fc_total_time); } return EXIT_SUCCESS; diff --git a/test/vfd_swmr_indep_rw_writer.c b/test/vfd_swmr_indep_rw_writer.c index c3572b6..9d004bc 100644 --- a/test/vfd_swmr_indep_rw_writer.c +++ b/test/vfd_swmr_indep_rw_writer.c @@ -220,26 +220,26 @@ verify_matrix(mat_t *mat, unsigned int which) static void usage(const char *progname) { - fprintf(stderr, - "usage: %s [-S] [-c cols] [-r rows] [-t tick_len] [-m max_lag] \n" - " [-B page_buffer_size] [-s page_size] [-u reader wait interval] [-q silent output] \n" - "\n" - "-S: do not use VFD SWMR\n" - "-c cols: `cols` columns for the dataset\n" - " The default value is 512.\n" - "-r rows: `rows` rows for the dataset\n" - " The default value is 256.\n" - "-t tick_len: length of a tick in tenths of a second.\n" - "-m max_lag: maximum expected lag(in ticks) between writer and readers\n" - "-B pbs: page buffer size in bytes:\n" - " The default value is 4K(4096).\n" - "-s ps: page size used by page aggregation, page buffer and \n" - " the metadata file. The default value is 4K(4096).\n" - "-u 0.1s: interval in tenth of seconds to check if a dataset is ready for the reader.\n" - "-q: silence printouts, few messages\n" - "\n", - progname); - exit(EXIT_FAILURE); + HDfprintf(stderr, + "usage: %s [-S] [-c cols] [-r rows] [-t tick_len] [-m max_lag] \n" + " [-B page_buffer_size] [-s page_size] [-u reader wait interval] [-q silent output] \n" + "\n" + "-S: do not use VFD SWMR\n" + "-c cols: `cols` columns for the dataset\n" + " The default value is 512.\n" + "-r rows: `rows` rows for the dataset\n" + " The default value is 256.\n" + "-t tick_len: length of a tick in tenths of a second.\n" + "-m max_lag: maximum expected lag(in ticks) between writer and readers\n" + "-B pbs: page buffer size in bytes:\n" + " The default value is 4K(4096).\n" + "-s ps: page size used by page aggregation, page buffer and \n" + " the metadata file. The default value is 4K(4096).\n" + "-u 0.1s: interval in tenth of seconds to check if a dataset is ready for the reader.\n" + "-q: silence printouts, few messages\n" + "\n", + progname); + HDexit(EXIT_FAILURE); } /* Initialize the state_t with different options specified by the user. */ @@ -368,7 +368,7 @@ indep_init_vfd_swmr_config_plist(state_t *s, bool writer, const char *mdf_path) /* Pass the use_vfd_swmr, only_meta_page, page buffer size, config to vfd_swmr_create_fapl().*/ if ((s->fapl = vfd_swmr_create_fapl(true, s->use_vfd_swmr, true, s->pbs, &config)) < 0) { - printf("vfd_swmr_create_fapl failed\n"); + HDprintf("vfd_swmr_create_fapl failed\n"); TEST_ERROR; } @@ -598,12 +598,12 @@ close_pl(const state_t *s) { if (H5Pclose(s->fapl) < 0) { - printf("H5Pclose failed\n"); + HDprintf("H5Pclose failed\n"); TEST_ERROR; } if (H5Pclose(s->fcpl) < 0) { - printf("H5Pclose failed\n"); + HDprintf("H5Pclose failed\n"); TEST_ERROR; } |