From 959ab2a8f17ad50906d71e89b830148a01aaff4e Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Sat, 18 Mar 2023 10:22:05 -0700 Subject: Rename test scripts like develop (#2589) --- configure.ac | 24 +- test/CMakeTests.cmake | 68 ++--- test/Makefile.am | 76 +++--- test/ShellTests.cmake | 52 ++-- test/test_abort_fail.sh.in | 65 +++++ test/test_check_version.sh.in | 260 +++++++++++++++++++ test/test_error.sh.in | 123 +++++++++ test/test_external_env.sh.in | 41 +++ test/test_filter_plugin.sh.in | 113 --------- test/test_flush_refresh.sh.in | 237 ++++++++++++++++++ test/test_libinfo.sh.in | 119 +++++++++ test/test_links_env.sh.in | 41 +++ test/test_plugin.sh.in | 113 +++++++++ test/test_swmr.sh.in | 562 ++++++++++++++++++++++++++++++++++++++++++ test/test_use_cases.sh.in | 219 ++++++++++++++++ test/test_usecases.sh.in | 219 ---------------- test/test_vds_env.sh.in | 43 ++++ test/test_vds_swmr.sh.in | 232 +++++++++++++++++ test/testabort_fail.sh.in | 65 ----- test/testcheck_version.sh.in | 260 ------------------- test/testerror.sh.in | 123 --------- test/testexternal_env.sh.in | 41 --- test/testflushrefresh.sh.in | 237 ------------------ test/testlibinfo.sh.in | 119 --------- test/testlinks_env.sh.in | 41 --- test/testswmr.sh.in | 562 ------------------------------------------ test/testvds_env.sh.in | 43 ---- test/testvdsswmr.sh.in | 232 ----------------- 28 files changed, 2168 insertions(+), 2162 deletions(-) create mode 100644 test/test_abort_fail.sh.in create mode 100644 test/test_check_version.sh.in create mode 100644 test/test_error.sh.in create mode 100644 test/test_external_env.sh.in delete mode 100644 test/test_filter_plugin.sh.in create mode 100644 test/test_flush_refresh.sh.in create mode 100644 test/test_libinfo.sh.in create mode 100644 test/test_links_env.sh.in create mode 100644 test/test_plugin.sh.in create mode 100644 test/test_swmr.sh.in create mode 100644 test/test_use_cases.sh.in delete mode 100644 test/test_usecases.sh.in create mode 100644 test/test_vds_env.sh.in create mode 100644 test/test_vds_swmr.sh.in delete mode 100644 test/testabort_fail.sh.in delete mode 100644 test/testcheck_version.sh.in delete mode 100644 test/testerror.sh.in delete mode 100644 test/testexternal_env.sh.in delete mode 100644 test/testflushrefresh.sh.in delete mode 100644 test/testlibinfo.sh.in delete mode 100644 test/testlinks_env.sh.in delete mode 100644 test/testswmr.sh.in delete mode 100644 test/testvds_env.sh.in delete mode 100644 test/testvdsswmr.sh.in diff --git a/configure.ac b/configure.ac index 1093812..4a320b3 100644 --- a/configure.ac +++ b/configure.ac @@ -3992,19 +3992,19 @@ AC_CONFIG_FILES([src/libhdf5.settings src/Makefile test/Makefile test/H5srcdir_str.h - test/testabort_fail.sh - test/testcheck_version.sh - test/testerror.sh - test/testexternal_env.sh - test/testflushrefresh.sh - test/testlibinfo.sh - test/testlinks_env.sh - test/testswmr.sh - test/testvds_env.sh - test/testvdsswmr.sh - test/test_filter_plugin.sh + test/test_abort_fail.sh + test/test_check_version.sh + test/test_error.sh + test/test_external_env.sh + test/test_flush_refresh.sh + test/test_libinfo.sh + test/test_links_env.sh test/test_mirror.sh - test/test_usecases.sh + test/test_plugin.sh + test/test_swmr.sh + test/test_use_cases.sh + test/test_vds_env.sh + test/test_vds_swmr.sh testpar/Makefile testpar/testpflush.sh utils/Makefile diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index 9e3533e..6e597b8 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -186,24 +186,24 @@ endforeach () add_custom_target(HDF5_TEST_LIB_files ALL COMMENT "Copying files needed by HDF5_TEST_LIB tests" DEPENDS ${HDF5_TEST_LIB_files_list}) set (testhdf5_CLEANFILES - coord.h5 - dtypes10.h5 - sys_file1 - tattr.h5 - tfile1.h5 - tfile2.h5 - tfile3.h5 - tfile4.h5 - tfile5.h5 - tfile6.h5 - tfile7.h5 - tfilespace.h5 - th5o_file - th5s1.h5 - tselect.h5 - tsohm.h5 - tsohm_dst.h5 - tsohm_src.h5 + coord.h5 + dtypes10.h5 + sys_file1 + tattr.h5 + tfile1.h5 + tfile2.h5 + tfile3.h5 + tfile4.h5 + tfile5.h5 + tfile6.h5 + tfile7.h5 + tfilespace.h5 + th5o_file + th5s1.h5 + tselect.h5 + tsohm.h5 + tsohm_dst.h5 + tsohm_src.h5 ) # Remove any output file left over from previous test run @@ -728,18 +728,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 @@ -929,10 +929,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 3888676..f08f032 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -21,21 +21,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 +# 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) \ @@ -44,10 +46,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_SCRIPT += test_plugin.sh SCRIPT_DEPEND += filter_plugin$(EXEEXT) endif - if MIRROR_VFD_CONDITIONAL TEST_SCRIPT += test_mirror.sh endif @@ -70,22 +71,25 @@ TEST_PROG= testhdf5 \ unregister cache_logging cork swmr thread_id timer \ version_bounds_1_10 -# 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 \ @@ -97,7 +101,6 @@ check_PROGRAMS=$(TEST_PROG) error_test err_compat tcheck_version \ if HAVE_SHARED_CONDITIONAL check_PROGRAMS+= filter_plugin endif - if MIRROR_VFD_CONDITIONAL check_PROGRAMS+= mirror_vfd endif @@ -205,7 +208,7 @@ CHECK_CLEANFILES+=accum.h5 cmpd_dset.h5 compact_dataset.h5 dataset.h5 dset_offse split_get_file_image_test-m.h5 split_get_file_image_test-r.h5 \ file_image_core_test.h5.copy unregister_filter_1.h5 unregister_filter_2.h5 \ vds_virt.h5 vds_dapl.h5 vds_src_[0-1].h5 \ - swmr_data.h5 use_use_append_chunk.h5 use_append_mchunks.h5 use_disable_mdc_flushes.h5 \ + swmr_data.h5 use_use_append_chunk.h5 use_append_mchunks.h5 use_disable_mdc_flushes.h5 \ flushrefresh.h5 flushrefresh_VERIFICATION_START \ flushrefresh_VERIFICATION_CHECKPOINT1 flushrefresh_VERIFICATION_CHECKPOINT2 \ flushrefresh_VERIFICATION_DONE atomic_data accum_swmr_big.h5 ohdr_swmr.h5 \ @@ -227,8 +230,11 @@ use_append_mchunks_SOURCES=use_append_mchunks.c use_common.c use_disable_mdc_flushes_SOURCES=use_disable_mdc_flushes.c # Temporary files. -DISTCLEANFILES=testerror.sh testlibinfo.sh testcheck_version.sh testlinks_env.sh test_filter_plugin.sh \ - testexternal_env.sh testswmr.sh testvds_env.sh testvdsswmr.sh test_usecases.sh testflushrefresh.sh \ - testabort_fail.sh test_mirror.sh +DISTCLEANFILES=test_abort_fail.sh test_check_version.sh test_error.sh test_external_env.sh \ + test_flush_refresh.sh test_libinfo.sh test_links_env.sh test_plugin.sh \ + test_swmr.sh test_use_cases.sh test_vds_env.sh test_vds_swmr.sh +if MIRROR_VFD_CONDITIONAL + DISTCLEANFILES+= test_mirror.sh +endif include $(top_srcdir)/config/conclude.am diff --git a/test/ShellTests.cmake b/test/ShellTests.cmake index bbb3f7c..99faa00 100644 --- a/test/ShellTests.cmake +++ b/test/ShellTests.cmake @@ -26,11 +26,11 @@ if (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 @@ -56,44 +56,44 @@ if (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/test_abort_fail.sh.in b/test/test_abort_fail.sh.in new file mode 100644 index 0000000..5d5a858 --- /dev/null +++ b/test/test_abort_fail.sh.in @@ -0,0 +1,65 @@ +#! /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. +# +# Test to verify that the assertion/abort failure is fixed when the application +# does not close the file. (See HDFFV-10160) +# +# Test to verify that the infinite loop closing library/abort failure is fixed +# when the application creates and removes dense attributes (See HDFFV-10659) + +srcdir=@srcdir@ + +nerrors=0 + +############################################################################## +############################################################################## +### T H E T E S T S ### +############################################################################## +############################################################################## +# +# +echo "Testing file not closed assertion/abort failure" +TEST_NAME=filenotclosed # The test name +TEST_BIN=`pwd`/$TEST_NAME # The path of the test binary +# +# Run the test +$RUNSERIAL $TEST_BIN >/dev/null 2>&1 +exitcode=$? +if [ $exitcode -eq 0 ]; then + echo "Test PASSED" +else + echo "Test FAILED" + nerrors="`expr $nerrors + 1`" +fi +# +# +echo "Testing infinite loop closing library/abort failure" +TEST_NAME=del_many_dense_attrs # The test name +TEST_BIN=`pwd`/$TEST_NAME # The path of the test binary +# Run the test +$RUNSERIAL $TEST_BIN >/dev/null 2>&1 +exitcode=$? +if [ $exitcode -eq 0 ]; then + echo "Test PASSED" +else + echo "Test FAILED" + nerrors="`expr $nerrors + 1`" +fi +# +# +if test $nerrors -eq 0 ; then + echo "All tests for abort failure passed." + exit 0 +else + echo "Tests for abort failure failed with $nerrors errors." + exit 1 +fi diff --git a/test/test_check_version.sh.in b/test/test_check_version.sh.in new file mode 100644 index 0000000..0889f74 --- /dev/null +++ b/test/test_check_version.sh.in @@ -0,0 +1,260 @@ +#! /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. + +# +# Tests for the H5check_version function. +# +# Programmer: Albert Cheng +# Sep 28, 2009 + +srcdir=@srcdir@ + +# Variables filled in by the configure process. +# Determine the configure options of the hdf5 library and executables. +Shared_Lib=@enable_shared@ +Static_Lib=@enable_static@ +Static_exec=@STATIC_EXEC@ +h5haveexitcode=yes # default is yes + +CMP='cmp -s' +DIFF='diff -c' +RM='rm -f' + +# Function definitions +# +# Show the purpose of this test script and a note about the abort messages. +PURPOSE() { + echo "Tests for the H5check_version function." + echo "Note that abort messages may appear due to the expected termination" + echo "of the program when it is tested with mis-matched version numbers." +} + +# Print a line-line message left justified in a field of 70 characters. +# +LINEMSG() { + SPACES=" " + echo "$* $SPACES" | cut -c1-70 | tr -d '\012' +} + + +# Print a "SKIP" message +SKIP() { + LINEMSG $* + echo " -SKIP-" +} + + +# Print warning message of version mismatch. +WarnMesg(){ + echo "Warning! ***HDF5 library version mismatched error***" + echo "The HDF5 header files used to compile this application do not match" + echo "the version used by the HDF5 library to which this application is linked." + echo "Data corruption or segmentation faults may occur if the application continues." + echo "This can happen when an application was compiled by one version of HDF5 but" + echo "linked with a different version of static or shared HDF5 library." + echo "You should recompile the application or check your shared library related" + echo "settings such as 'LD_LIBRARY_PATH'." + echo "You can, at your own risk, disable this warning by setting the environment" + echo "variable 'HDF5_DISABLE_VERSION_CHECK' to a value of '1'." + echo "Setting it to 2 or higher will suppress the warning messages totally." + echo "Headers are $xxh5versmajor.$xxh5versminor.$xxh5versrelease, library is $h5versmajor.$h5versminor.$h5versrelease" + test -n "$H5_HAVE_EMBEDDED_LIBINFO" && cat $h5libsettings + echo "Bye..." +} + + +# Print warning message2 of version mismatch. +WarnMesg2(){ + echo "Warning! ***HDF5 library version mismatched error***" + echo "The HDF5 header files used to compile this application do not match" + echo "the version used by the HDF5 library to which this application is linked." + echo "Data corruption or segmentation faults may occur if the application continues." + echo "This can happen when an application was compiled by one version of HDF5 but" + echo "linked with a different version of static or shared HDF5 library." + echo "You should recompile the application or check your shared library related" + echo "settings such as 'LD_LIBRARY_PATH'." + echo "'HDF5_DISABLE_VERSION_CHECK' environment variable is set to 1, application will" + echo "continue at your own risk." + echo "Headers are $xxh5versmajor.$xxh5versminor.$xxh5versrelease, library is $h5versmajor.$h5versminor.$h5versrelease" + test -n "$H5_HAVE_EMBEDDED_LIBINFO" && cat $h5libsettings +} + + +# Run a test and print PASS or *FAIL*. If a test fails then increment +# the `nerrors' global variable and (if $verbose is set) display the +# difference between the actual output and the expected output. The +# expected output generated according to the parameter values and compared +# against actual output. +# The expected and actual output files are removed unless $HDF5_NOCLEANUP +# has a non-zero value. +# $1: the set value of $HDF5_DISABLE_VERSION_CHECK. (unset means not to set +# it at all. +# $2: Change the version number(s) to cause a mismatch. (none means no +# mismatch). +# +# Expected results: +# Value of $HDF5_DISABLE_VERSION_CHECK +# unset "" -1 0 1 2 3 +# Matched OK OK OK OK OK OK OK +# Mismatched W/A W/A W/A W/A W2/OK OK W2/OK +# Result codes: +# OK: No warning, exit 0. +# W/A: Warning, abort and exit non-0. +# W2/OK: Different Warning, exit 0. +# +# Implemented only exit code matching. Still need to match output. +TESTING() { + DEBUGPRINT command is $0 $* + TEST_NAME=tcheck_version # The test name + TEST_BIN=`pwd`/$TEST_NAME # The path of the test binary + + expect=${TEST_NAME}_expect.out + actual=${TEST_NAME}_actual.out + actual_err=${TEST_NAME}_actual.err + arguments= + + h5DisableVersion="$1" + wrongversionnumbers="$2" + xxh5versmajor=$h5versmajor + xxh5versminor=$h5versminor + xxh5versrelease=$h5versrelease + + if [ "$h5DisableVersion" = unset ]; then + envcmd="" # noop + else + envcmd="env HDF5_DISABLE_VERSION_CHECK=$h5DisableVersion" + fi + + if [ "$wrongversionnumbers" = none ]; then + # OK: No warning, exit 0 + cp /dev/null $expect + expect_code=0 + else + arguments=-t"$wrongversionnumbers" + # calculate mismatched version numbers by listing. + case $wrongversionnumbers in + "M") xxh5versmajor=`expr $h5versmajor + 1` + ;; + "m") xxh5versminor=`expr $h5versminor + 1` + ;; + "r") xxh5versrelease=`expr $h5versrelease + 1` + ;; + esac + case "$h5DisableVersion" in + 1) + # W2/OK: Different Warning, exit 0. + WarnMesg2 > $expect + expect_code=0 + ;; + [2-9]|[1-9][0-9]*) + # OK: No warning, exit 0 + cp /dev/null $expect + expect_code=0 + ;; + *) # W/A: Warning, abort and exit non-0. + WarnMesg > $expect + expect_code=6 # Signal Abort exit code (128+6) + ;; + esac + fi + + # Run test. + LINEMSG $envcmd $TEST_NAME $arguments + ( + $envcmd $RUNSERIAL $TEST_BIN $arguments + ) >$actual 2>$actual_err + ret_code=$? + cat $actual_err >> $actual + + if [ $h5haveexitcode = 'yes' -a \( $expect_code -ne $ret_code \) ]; then + echo "*FAILED*" + echo " Expected exit code ($expect_code) differs from actual code ($ret_code)" + nerrors="`expr $nerrors + 1`" + elif $CMP $expect $actual; then + echo " PASSED" + else + echo "*FAILED*" + echo " Expected result differs from actual result" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' + fi + + # Clean up output file. + # Also clean the core file generated by H5check_version's abort. + if test -z "$HDF5_NOCLEANUP"; then + $RM $expect $actual $actual_err + $RM core + fi +} + + +# Echo parameters for debugging if verbose mode is on. +DEBUGPRINT() { + if [ -n "$debugmode" ]; then + echo $* + fi +} + + +# MAIN Body +nerrors=0 +verbose=yes # default on +debugmode= # default off +H5_HAVE_EMBEDDED_LIBINFO=`grep '#define H5_HAVE_EMBEDDED_LIBINFO ' ../src/H5pubconf.h` +h5libsettings=../src/libhdf5.settings + +PURPOSE + +# Figure out library version numbers from the header file. +h5versmajor=`grep '#define H5_VERS_MAJOR' $srcdir/../src/H5public.h | awk '{print $3}'` +h5versminor=`grep '#define H5_VERS_MINOR' $srcdir/../src/H5public.h | awk '{print $3}'` +h5versrelease=`grep '#define H5_VERS_RELEASE' $srcdir/../src/H5public.h | awk '{print $3}'` +DEBUGPRINT $h5versmajor.$h5versminor.$h5versrelease +case "$h5versmajor$h5versminor$h5versrelease" in + [0-9]*) # good. noop. + ;; + *) + echo "Illegal library version numbers($h5versmajor.$h5versminor.$h5versrelease)" + echo "Test aborted" + exit 1 + ;; +esac + +# RUNSERIAL is used. Check if it can return exit code from executalbe correctly. +if [ -n "$RUNSERIAL_NOEXITCODE" ]; then + echo "***Warning*** Serial Exit Code is not passed back to shell correctly." + echo "***Warning*** Exit code checking is skipped." + h5haveexitcode=no +fi + +# Three Categories of tests: +# Normal: where the version numbers all matched (wrong_version == none). +# Mismatched version numbers (could be Major or minor version +# or release numbers or a combination of all three.) +# Test all the above with different values of the environment variable, +# HDF5_DISABLE_VERSION_CHECK, as unset, "", -1, 0, 1, 2, 3 + +for val_disable_version_check in unset "" -1 0 1 2 3; do + for wrong_version in none M m; do + TESTING "$val_disable_version_check" "$wrong_version" + done +done + + +# Check and report results. +if [ $nerrors -gt 0 ]; then + echo "***$nerrors errors encountered***" + exit 1 +else + echo "No error encountered" + exit 0 +fi diff --git a/test/test_error.sh.in b/test/test_error.sh.in new file mode 100644 index 0000000..49c8884 --- /dev/null +++ b/test/test_error.sh.in @@ -0,0 +1,123 @@ +#! /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. +# +# Tests for test_error and err_compat + +srcdir=@srcdir@ + +# Determine backward compatibility options eneabled +DEPRECATED_SYMBOLS="@DEPRECATED_SYMBOLS@" + +CMP='cmp -s' +DIFF='diff -c' + +# Skip plugin module to test missing filter +ENVCMD="env HDF5_PLUGIN_PRELOAD=::" + +nerrors=0 +verbose=yes + +test -d ./testfiles || mkdir ./testfiles + +# Print a line-line message left justified in a field of 70 characters +# beginning with the word "Testing". +# +TESTING() { + SPACES=" " + echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012' +} + +# Run a test and print PASS or *FAIL*. If a test fails then increment +# the `nerrors' global variable and (if $verbose is set) display the +# difference between the actual output and the expected output. The +# expected output is given as the first argument to this function and +# the actual output file is calculated by replacing the `.ddl' with +# `.out'. The actual output is not removed if $HDF5_NOCLEANUP has a +# non-zero value. +# +TEST() { + TEST_ERR=$1 # The test name + TEST_ERR_BIN=`pwd`/$TEST_ERR # The path of the test binary + + expect1="$srcdir/testfiles/$1_1" + expect2="$srcdir/testfiles/$1_2" + actual="./`basename $1`.out" + actual_err="./`basename $1`.err" + actual_ext="./`basename $1`.ext" + shift + + # Run test. + TESTING $TEST_ERR + ( + # Skip the plugin for testing missing filter. + $ENVCMD $RUNSERIAL $TEST_ERR_BIN + ) >$actual 2>$actual_err + + # Check for core dump + if [ $? != 0 ]; then + nerrors=`expr $nerrors + 1` + fi + + # Extract file name, line number, version and thread IDs because they may be different + sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ + -e 's/line [0-9]*/line (number)/' \ + -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ + -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ + -e 's/H5Eget_auto[1-2]*/H5Eget_auto(1 or 2)/' \ + -e 's/H5Eset_auto[1-2]*/H5Eset_auto(1 or 2)/' \ + $actual_err > $actual_ext + cat $actual_ext >> $actual + + if $CMP $expect1 $actual; then + echo " PASSED" + elif $CMP $expect2 $actual; then + echo " PASSED" + else + echo "*FAILED*" + echo " Expected result differs from actual result" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF $expect1 $actual |sed 's/^/ /' + fi + + # Clean up output file + if test -z "$HDF5_NOCLEANUP"; then + rm -f $actual $actual_err $actual_ext + fi +} + +# Print a "SKIP" message +SKIP() { + TESTING $@ + echo " -SKIP-" +} + +############################################################################## +############################################################################## +### T H E T E S T S ### +############################################################################## +############################################################################## + +# test for err_compat +if test $DEPRECATED_SYMBOLS != "yes"; then +SKIP err_compat +else +TEST err_compat +fi + +# test for error_test. Skip the plugin for testing missing filter. +TEST error_test + +if test $nerrors -eq 0 ; then + echo "All Error API tests passed." +fi + +exit $nerrors diff --git a/test/test_external_env.sh.in b/test/test_external_env.sh.in new file mode 100644 index 0000000..41e04f1 --- /dev/null +++ b/test/test_external_env.sh.in @@ -0,0 +1,41 @@ +#! /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. +# +# Test for external file with environment variable: HDF5_EXTFILE_PREFIX + +srcdir=@srcdir@ + +nerrors=0 + +############################################################################## +############################################################################## +### T H E T E S T S ### +############################################################################## +############################################################################## + +# test for external file with HDF5_EXTFILE_PREFIX +echo "Testing external file with HDF5_EXTFILE_PREFIX" +TEST_NAME=external_env # The test name +TEST_BIN=`pwd`/$TEST_NAME # The path of the test binary +ENVCMD="env HDF5_EXTFILE_PREFIX=\${ORIGIN}" # The environment variable & value +# +# Run the test +# echo "$ENVCMD $RUNSERIAL $TEST_BIN" +$ENVCMD $RUNSERIAL $TEST_BIN +exitcode=$? +if [ $exitcode -eq 0 ]; then + echo "Test prefix for HDF5_EXTFILE_PREFIX PASSED" +else + nerrors="`expr $nerrors + 1`" + echo "***Error encountered for HDF5_EXTFILE_PREFIX test***" +fi +exit $nerrors 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/test_flush_refresh.sh.in b/test/test_flush_refresh.sh.in new file mode 100644 index 0000000..adbba4f --- /dev/null +++ b/test/test_flush_refresh.sh.in @@ -0,0 +1,237 @@ +#! /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. +# +# +# Test script for the flush/evict single objects feature. +# +# This test file doesn't actually perform any tests, rather, it acts +# as a process manager for the 'flushrefresh' test file, which is where +# the tests are actually housed. The reason this script exists is because +# the verification of this feature needs to occur in separate processes +# from the one in which the file is being manipulated in. (i.e., we have +# a single writer process, and various reader processes spawning off +# and doing the verification that individual objects are being +# correctly flushed). +# +# Programmer: +# Mike McGreevy +# Tuesday, July 20, 2010 + +############################################################################### +## test variables +############################################################################### + +# Number of errors encountered during test run. +nerrors=0 + +# Set up a function to check the current time since the epoch - ideally, we'd +# like to use Perl. If it wasn't detected by configure, then use date, though +# this is less portable and might cause problems on machines that don't +# recognize the +%s option (like Solaris). +# +# Note that PERL will resolve to true or false, not a path. +PERL=@PERL@ +if test -n "$PERL"; then + TimeStamp() + { + time=`perl -e 'print int(time)'` + echo "$time" + } +else + TimeStamp() + { + time=`date +%s` + echo "$time" + } +fi + +############################################################################### +## Main +############################################################################### +srcdir=@srcdir@ +utils_testdir=@abs_top_builddir@/@H5_UTILS_TEST_BUILDDIR@ +testdir=@abs_top_builddir@/@H5_TEST_BUILDDIR@ + +# Check to see if the VFD specified by the HDF5_DRIVER environment variable +# supports SWMR. +$utils_testdir/swmr_check_compat_vfd +rc=$? +if [ $rc -ne 0 ] ; then + echo + echo "The VFD specified by the HDF5_DRIVER environment variable" + echo "does not support SWMR." + echo + echo "flush/refresh tests skipped" + echo + exit 0 +fi + +# HDF5 has several tests that create and delete signal files to communicate +# between processes, and it seems that even though the names of the files are +# different, occasionally the wrong file is deleted, interrupting the flow of +# the test. Running each of these tests in its own directory should eliminate +# the problem. +mkdir -p flushrefresh_test +cp $testdir/flushrefresh flushrefresh_test + +# With the --disable-shared option, flushrefresh is built in the test directory, +# otherwise it is in test/.libs with a wrapper script named flushrefresh in +# the test directory. test/flushrefresh should always be copied, +# .libs/flushrefresh should be copied only if it exists. +if [ -f .libs/flushrefresh ]; then + mkdir -p flushrefresh_test/.libs + for FILE in .libs/flushrefresh*; do + case "$FILE" in + *.o) continue ;; ## don't copy the .o files + esac + if test -f "$FILE" ; then + cp $FILE flushrefresh_test/.libs + fi + done +fi +cd flushrefresh_test + +# ================================================= +# Set up/initialize some variables to be used later +# ================================================= +testfile=flushrefresh.h5 +startsignal=flushrefresh_VERIFICATION_START +endsignal=flushrefresh_VERIFICATION_DONE +timeout_length=300 +timedout=0 +verification_done=0 +if [ -e $testfile ]; then + rm $testfile +fi + +# ======================== +# Launch the Test Program. +# ======================== +$testdir/flushrefresh & +pid_main=$! + +# ======================================= +# Run flush verification on test program. +# ======================================= + +until [ $verification_done -eq 1 ]; do + + # Wait for signal from test program that verification routine can run. + before=`TimeStamp` + until [ -s $startsignal ]; do + after=`TimeStamp` + timediff=`expr $after - $before` + if [ $timediff -gt $timeout_length ]; then + nerrors=`expr $nerrors + 1` + timedout=1 + break + fi + done + + # Check to see if we timed out looking for the signal before continuing. + if [ $timedout -gt 0 ]; then + echo "timed out waiting for signal from test program (flush)." + break + fi + + # Read in test routine parameters from signal file, then delete signal file. + param1=`head -1 $startsignal` + param2=`tail -1 $startsignal` + rm $startsignal + + # Check if we're done with verifications, otherwise run the specified verification. + if [ "$param1" = "VERIFICATION_DONE" ]; then + verification_done=1 + echo "all flush verification complete" > $endsignal + else + $testdir/flushrefresh $param1 $param2 + + # Check for core dump + if [ $? -gt 0 ]; then + nerrors=`expr $nerrors + 1` + fi + + echo "verification flush process done" > $endsignal + fi + +done + +# ========================================= +# Run refresh verification on test program. +# ========================================= +if [ $timedout -eq 0 ]; then + until [ $verification_done -eq 2 ]; do + + # Wait for signal from test program that verification routine can run. + before=`TimeStamp` + until [ -s $startsignal ]; do + after=`TimeStamp` + timediff=`expr $after - $before` + if [ $timediff -gt $timeout_length ]; then + nerrors=`expr $nerrors + 1` + timedout=1 + break + fi + done + + # Check to see if we timed out looking for the signal before continuing. + if [ $timedout -gt 0 ]; then + echo "timed out waiting for signal from test program (refresh)." + break + fi + + # Read in test routine parameter from signal file, then delete signal file. + param1=`head -n 1 $startsignal` + rm $startsignal + + # Check if we're done with verifications, otherwise run the specified verification. + if [ "$param1" = "VERIFICATION_DONE" ]; then + verification_done=2 + echo "all refresh verification complete" > $endsignal + else + $testdir/flushrefresh $param1 + + # Check for core dump + if [ $? -gt 0 ]; then + nerrors=`expr $nerrors + 1` + fi + + echo "refresh verifiction process done" > $endsignal + fi + + done +fi + +# ============================================ +# Wait for main to finish up, and end testing. +# ============================================ +wait $pid_main +if test $? -ne 0; then + echo flushrefresh had error + nerrors=`expr $nerrors + 1` +fi + +############################################################################### +## Report and exit +############################################################################### + +if test $nerrors -eq 0 ; then + echo "flush/refresh objects tests passed." + if test -z "$HDF5_NOCLEANUP"; then + # delete the test directory + rm -rf flushrefresh_test + fi + exit 0 +else + echo "flush/refresh objects tests failed with $nerrors errors." + exit 1 +fi diff --git a/test/test_libinfo.sh.in b/test/test_libinfo.sh.in new file mode 100644 index 0000000..601992f --- /dev/null +++ b/test/test_libinfo.sh.in @@ -0,0 +1,119 @@ +#! /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. + + +# +# Tests for the embedded library information feature. +# Part 1: +# Verify the HDF5 library does contains an exact copy of the content of the +# libhdf5.settings file. +# Part 2: +# If executable is linked with the static hdf5 library (how to determine?), +# verify an executable indeed contains an exact copy of the content of the +# libhdf5.settings file. +# +# Programmer: Albert Cheng +# Sep 18, 2009 + +srcdir=@srcdir@ + +# Determine the configure options of the hdf5 library and executables. + +Shared_Lib=@enable_shared@ +Static_Lib=@enable_static@ +Static_exec=@STATIC_EXEC@ + + +# Print a line-line message left justified in a field of 70 characters. +# +LINEMSG() { + SPACES=" " + echo "Check file $* $SPACES" | cut -c1-70 | tr -d '\012' +} + + +# Print a "SKIP" message +SKIP() { + LINEMSG $* + echo " -SKIP-" +} + +# Function definitions +CHECK_LIBINFO(){ + LINEMSG $1 + # Some systems, like Mac, the strings command inspects library files. Older + # versions of strings may not know newer library format, resulting in + # command errors. Make it read the file as stdin to avoid the problem. + if strings < $1 | grep "SUMMARY OF THE HDF5 CONFIGURATION" > /dev/null; then + echo " PASSED" + else + echo " FAILED" + nerrors=`expr $nerrors + 1` + fi +} + + +# MAIN Body +nerrors=0 +H5_HAVE_EMBEDDED_LIBINFO=`grep '#define H5_HAVE_EMBEDDED_LIBINFO ' ../src/H5pubconf.h` + +# Skip the rest if embedded-libinfo is not enabled. +if [ -z "$H5_HAVE_EMBEDDED_LIBINFO" ]; then + echo "embedded-libinfo is not enabled. Test skipped." + exit 0 +fi + +# The location of HDF library file(s) depends on whether shared lib is +# built too. +if [ -n $Shared_Lib ]; then + h5libdir=../src/.libs + shlib=$(grep dlname ../src/libhdf5.la | sed -e "s/dlname='//" -e "s/'//") +else + h5libdir=../src +fi + +h5libsettings=../src/libhdf5.settings + +# Part 1: +# Verify the HDF5 library does contains an exact copy of the content of the +# libhdf5.settings file. +# Check dynamic library file if built. +if [ x-$Shared_Lib = x-yes ]; then + CHECK_LIBINFO ${h5libdir}/${shlib} +else + SKIP shlib +fi + +# Though rare, libhdf5.a may not have been built. +if [ x-$Static_Lib = x-yes ]; then + CHECK_LIBINFO ${h5libdir}/libhdf5.a +else + SKIP ${h5libdir}/libhdf5.a +fi + +# Check if executables has the lib information only if shared lib is not +# built or static-exec is used. (Don't care static-exec since it affects +# tools binary only.) +if [ x-$Shared_Lib != x-yes ]; then + CHECK_LIBINFO testhdf5 +else + SKIP testhdf5 +fi + + +if [ $nerrors -gt 0 ]; then + echo "***$nerrors errors encountered***" + exit 1 +else + echo "No error encountered" + exit 0 +fi diff --git a/test/test_links_env.sh.in b/test/test_links_env.sh.in new file mode 100644 index 0000000..060fcd5 --- /dev/null +++ b/test/test_links_env.sh.in @@ -0,0 +1,41 @@ +#! /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. +# +# Test for external link with environment variable: HDF5_EXT_PREFIX + +srcdir=@srcdir@ + +nerrors=0 + +############################################################################## +############################################################################## +### T H E T E S T S ### +############################################################################## +############################################################################## + +# test for external links with HDF5_EXT_PREFIX +echo "Testing external link with HDF5_EXT_PREFIX" +TEST_NAME=links_env # The test name +TEST_BIN=`pwd`/$TEST_NAME # The path of the test binary +ENVCMD="env HDF5_EXT_PREFIX=.:tmp_links_env" # The environment variable & value +# +# Run the test +echo "$ENVCMD $RUNSERIAL $TEST_BIN" +$ENVCMD $RUNSERIAL $TEST_BIN +exitcode=$? +if [ $exitcode -eq 0 ]; then + echo "Test for HDF5_EXT_PREFIX PASSED" +else + nerrors="`expr $nerrors + 1`" + echo "***Error encountered for HDF5_EXT_PREFIX test***" +fi +exit $nerrors diff --git a/test/test_plugin.sh.in b/test/test_plugin.sh.in new file mode 100644 index 0000000..78cdb3a --- /dev/null +++ b/test/test_plugin.sh.in @@ -0,0 +1,113 @@ +#! /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/test_swmr.sh.in b/test/test_swmr.sh.in new file mode 100644 index 0000000..33734b7 --- /dev/null +++ b/test/test_swmr.sh.in @@ -0,0 +1,562 @@ +#! /bin/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. +# +# Tests for the swmr feature. +# +# Created: +# Albert Cheng, 2009/07/22 + +srcdir=@srcdir@ +utils_testdir=@abs_top_builddir@/@H5_UTILS_TEST_BUILDDIR@ +testdir=@abs_top_builddir@/@H5_TEST_BUILDDIR@ + +############################################################################### +## test parameters +############################################################################### + +Nreaders=5 # number of readers to launch +Nrdrs_spa=3 # number of sparse readers to launch +Nrecords=200000 # number of records to write +Nrecs_rem=40000 # number of times to shrink +Nrecs_spa=20000 # number of records to write in the sparse test +Nsecs_add=5 # number of seconds per read interval +Nsecs_rem=3 # number of seconds per read interval +Nsecs_addrem=8 # number of seconds per read interval +nerrors=0 + +############################################################################### +## definitions for message file to coordinate test runs +############################################################################### +WRITER_MESSAGE=SWMR_WRITER_MESSAGE # The message file created by writer that the open is complete + # This should be the same as the define in "test/swmr_common.h" +MESSAGE_TIMEOUT=300 # Message timeout length in secs + # This should be the same as the define in "test/h5test.h" + +############################################################################### +## short hands and function definitions +############################################################################### +DPRINT=: # Set to "echo Debug:" for debugging printing, + # else ":" for noop. +IFDEBUG=: # Set to null to turn on debugging, else ":" for noop. + +# 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' +} + +# To wait for the writer message file or till the maximum # of seconds is reached +# $1 is the message file to wait for +# This performs similar function as the routine h5_wait_message() in test/h5test.c +WAIT_MESSAGE() { + message=$1 # Get the name of the message file to wait for + t0=`date +%s` # Get current time in seconds + difft=0 # Initialize the time difference + mexist=0 # Indicate whether the message file is found + while [ $difft -lt $MESSAGE_TIMEOUT ] ; # Loop till message times out + do + t1=`date +%s` # Get current time in seconds + difft=`expr $t1 - $t0` # Calculate the time difference + if [ -e $message ]; then # If message file is found: + mexist=1 # indicate the message file is found + rm $message # remove the message file + break # get out of the while loop + fi + done; + if test $mexist -eq 0; then + # Issue warning that the writer message file is not found, continue with launching the reader(s) + echo warning: $WRITER_MESSAGE is not found after waiting $MESSAGE_TIMEOUT seconds + else + echo $WRITER_MESSAGE is found + fi +} + +############################################################################### +## Main +## +## Modifications: +## Vailin Choi; July 2013 +## Add waiting of message file before launching the reader(s). +## Due to the implementation of file locking, coordination +## is needed in file opening for the writer/reader tests +## to proceed as expected. +## +############################################################################### + +# Check to see if the VFD specified by the HDF5_DRIVER environment variable +# supports SWMR. +$utils_testdir/swmr_check_compat_vfd +rc=$? +if [ $rc -ne 0 ] ; then + echo + echo "The VFD specified by the HDF5_DRIVER environment variable" + echo "does not support SWMR." + echo + echo "SWMR acceptance tests skipped" + echo + exit 0 +fi + +# Parse options (none accepted at this time) +while [ $# -gt 0 ]; do + case "$1" in + *) # unknown option + echo "$0: Unknown option ($1)" + exit 1 + ;; + esac +done + +# HDF5 has several tests that create and delete signal files to communicate +# between processes, and it seems that even though the names of the files are +# different, occasionally the wrong file is deleted, interrupting the flow of +# the test. Running each of these tests in its own directory should eliminate +# the problem. +mkdir swmr_test +for FILE in swmr*; do + case "$FILE" in + *.o) continue ;; ## don't copy the .o files + esac + if test -f "$FILE" ; then + cp $FILE swmr_test + fi +done + +# With the --disable-shared option, swmr program files are built in the test +# directory, otherwise they are in test/.libs with a corresponding wrapper +# script in the test directory. The programs or wrapper scripts in test should +# always be copied, swmr files in .libs should be copied only if they exists. +if [ -f .libs/swmr ]; then + mkdir swmr_test/.libs + for FILE in .libs/swmr*; do + case "$FILE" in + *.o) continue ;; ## don't copy the .o files + esac + if test -f "$FILE" ; then + cp $FILE swmr_test/.libs + fi + done +fi + +cd swmr_test + + +# Loop over index types +for index_type in "-i ea" "-i b2" +do + # Try with and without compression + for compress in "" "-c 5" + do + echo + echo "*******************************************************************************" + echo "** Loop testing parameters: $index_type $compress" + echo "*******************************************************************************" + echo + echo + echo "###############################################################################" + echo "## Generator test" + echo "###############################################################################" + # Launch the Generator without SWMR_WRITE + echo launch the swmr_generator + $testdir/swmr_generator $compress $index_type + if test $? -ne 0; then + echo generator had error + nerrors=`expr $nerrors + 1` + fi + + # Launch the Generator with SWMR_WRITE + echo launch the swmr_generator with SWMR_WRITE + $testdir/swmr_generator -s $compress $index_type + if test $? -ne 0; then + echo generator had error + nerrors=`expr $nerrors + 1` + fi + + # Check for error and exit if one occurred + $DPRINT nerrors=$nerrors + if test $nerrors -ne 0 ; then + echo "SWMR tests failed with $nerrors errors." + exit 1 + fi + + echo + echo "###############################################################################" + echo "## Use H5Fstart_swmr_write() to enable SWMR writing mode" + echo "###############################################################################" + + # Remove any possible writer message file before launching writer + rm -f $WRITER_MESSAGE + # + # Launch the Writer + echo launch the swmr_start_writer + seed="" # Put -r command here + $testdir/swmr_start_write $compress $index_type $Nrecords $seed 2>&1 |tee swmr_writer.out & + pid_writer=$! + $DPRINT pid_writer=$pid_writer + + # Wait for message from writer process before starting reader(s) + WAIT_MESSAGE $WRITER_MESSAGE + + # + # Launch the Readers + #declare -a seeds=( ... ) + echo launch $Nreaders swmr_readers + pid_readers="" + n=0 + while [ $n -lt $Nreaders ]; do + #seed="-r ${seeds[$n]}" + seed="" + $testdir/swmr_reader $Nsecs_add $seed 2>&1 |tee swmr_reader.out.$n & + pid_readers="$pid_readers $!" + n=`expr $n + 1` + done + $DPRINT pid_readers=$pid_readers + $IFDEBUG ps + + # Collect exit code of the readers first because they usually finish + # before the writer. + for xpid in $pid_readers; do + $DPRINT checked reader $xpid + wait $xpid + if test $? -ne 0; then + echo reader had error + nerrors=`expr $nerrors + 1` + fi + done + + # Collect exit code of the writer + $DPRINT checked writer $pid_writer + wait $pid_writer + if test $? -ne 0; then + echo writer had error + nerrors=`expr $nerrors + 1` + fi + + # Check for error and exit if one occurred + $DPRINT nerrors=$nerrors + if test $nerrors -ne 0 ; then + echo "SWMR tests failed with $nerrors errors." + echo "(Writer and reader output preserved)" + exit 1 + fi + + # Clean up output files + rm -f swmr_writer.out + rm -f swmr_reader.out.* + + echo + echo "###############################################################################" + echo "## Writer test - test expanding the dataset" + echo "###############################################################################" + + # Launch the Generator + echo launch the swmr_generator + $testdir/swmr_generator -s $compress $index_type + if test $? -ne 0; then + echo generator had error + nerrors=`expr $nerrors + 1` + fi + + # Remove any possible writer message file before launching writer + rm -f $WRITER_MESSAGE + # + # Launch the Writer + echo launch the swmr_writer + seed="" # Put -r command here + $testdir/swmr_writer -o $Nrecords $seed 2>&1 |tee swmr_writer.out & + pid_writer=$! + $DPRINT pid_writer=$pid_writer + + # Wait for message from writer process before starting reader(s) + WAIT_MESSAGE $WRITER_MESSAGE + # + # Launch the Readers + #declare -a seeds=( ... ) + echo launch $Nreaders swmr_readers + pid_readers="" + n=0 + while [ $n -lt $Nreaders ]; do + #seed="-r ${seeds[$n]}" + seed="" + $testdir/swmr_reader $Nsecs_add $seed 2>&1 |tee swmr_reader.out.$n & + pid_readers="$pid_readers $!" + n=`expr $n + 1` + done + $DPRINT pid_readers=$pid_readers + $IFDEBUG ps + + # Collect exit code of the readers first because they usually finish + # before the writer. + for xpid in $pid_readers; do + $DPRINT checked reader $xpid + wait $xpid + if test $? -ne 0; then + echo reader had error + nerrors=`expr $nerrors + 1` + fi + done + + # Collect exit code of the writer + $DPRINT checked writer $pid_writer + wait $pid_writer + if test $? -ne 0; then + echo writer had error + nerrors=`expr $nerrors + 1` + fi + + # Check for error and exit if one occurred + $DPRINT nerrors=$nerrors + if test $nerrors -ne 0 ; then + echo "SWMR tests failed with $nerrors errors." + echo "(Writer and reader output preserved)" + exit 1 + fi + + # Clean up output files + rm -f swmr_writer.out + rm -f swmr_reader.out.* + + echo + echo "###############################################################################" + echo "## Remove test - test shrinking the dataset" + echo "###############################################################################" + + # Remove any possible writer message file before launching writer + rm -f $WRITER_MESSAGE + # Launch the Remove Writer + echo launch the swmr_remove_writer + seed="" # Put -r command here + $testdir/swmr_remove_writer -o $Nrecs_rem $seed 2>&1 |tee swmr_writer.out & + pid_writer=$! + $DPRINT pid_writer=$pid_writer + + # Wait for message from writer process before starting reader(s) + WAIT_MESSAGE $WRITER_MESSAGE + # + # Launch the Remove Readers + #declare -a seeds=( ... ) + n=0 + pid_readers="" + echo launch $Nreaders swmr_remove_readers + while [ $n -lt $Nreaders ]; do + #seed="-r ${seeds[$n]}" + seed="" + $testdir/swmr_remove_reader $Nsecs_rem $seed 2>&1 |tee swmr_reader.out.$n & + pid_readers="$pid_readers $!" + n=`expr $n + 1` + done + $DPRINT pid_readers=$pid_readers + $IFDEBUG ps + + # Collect exit code of the readers first because they usually finish + # before the writer. + for xpid in $pid_readers; do + $DPRINT checked reader $xpid + wait $xpid + if test $? -ne 0; then + echo reader had error + nerrors=`expr $nerrors + 1` + fi + done + + # Collect exit code of the writer + $DPRINT checked writer $pid_writer + wait $pid_writer + if test $? -ne 0; then + echo writer had error + nerrors=`expr $nerrors + 1` + fi + + # Check for error and exit if one occurred + $DPRINT nerrors=$nerrors + if test $nerrors -ne 0 ; then + echo "SWMR tests failed with $nerrors errors." + echo "(Writer and reader output preserved)" + exit 1 + fi + + # Clean up output files + rm -f swmr_writer.out + rm -f swmr_reader.out.* + + echo + echo "###############################################################################" + echo "## Add/remove test - randomly grow or shrink the dataset" + echo "###############################################################################" + + # Launch the Generator + echo launch the swmr_generator + $testdir/swmr_generator $compress $index_type + if test $? -ne 0; then + echo generator had error + nerrors=`expr $nerrors + 1` + fi + + # Launch the Writer (not in parallel - just to rebuild the datasets) + echo launch the swmr_writer + seed="" # Put -r command here + $testdir/swmr_writer $Nrecords $seed + if test $? -ne 0; then + echo writer had error + nerrors=`expr $nerrors + 1` + fi + + # Remove any possible writer message file before launching writer + rm -f $WRITER_MESSAGE + # + # Launch the Add/Remove Writer + echo launch the swmr_addrem_writer + seed="" # Put -r command here + $testdir/swmr_addrem_writer $Nrecords $seed 2>&1 |tee swmr_writer.out & + pid_writer=$! + $DPRINT pid_writer=$pid_writer + + # Wait for message from writer process before starting reader(s) + WAIT_MESSAGE $WRITER_MESSAGE + # + # Launch the Add/Remove Readers + #declare -a seeds=( ... ) + n=0 + pid_readers="" + echo launch $Nreaders swmr_remove_readers + while [ $n -lt $Nreaders ]; do + #seed="-r ${seeds[$n]}" + seed="" + $testdir/swmr_remove_reader $Nsecs_addrem $seed 2>&1 |tee swmr_reader.out.$n & + pid_readers="$pid_readers $!" + n=`expr $n + 1` + done + $DPRINT pid_readers=$pid_readers + $IFDEBUG ps + + # Collect exit code of the readers first because they usually finish + # before the writer. + for xpid in $pid_readers; do + $DPRINT checked reader $xpid + wait $xpid + if test $? -ne 0; then + echo reader had error + nerrors=`expr $nerrors + 1` + fi + done + + # Collect exit code of the writer + $DPRINT checked writer $pid_writer + wait $pid_writer + if test $? -ne 0; then + echo writer had error + nerrors=`expr $nerrors + 1` + fi + + # Check for error and exit if one occurred + $DPRINT nerrors=$nerrors + if test $nerrors -ne 0 ; then + echo "SWMR tests failed with $nerrors errors." + echo "(Writer and reader output preserved)" + exit 1 + fi + + # Clean up output files + rm -f swmr_writer.out + rm -f swmr_reader.out.* + + echo + echo "###############################################################################" + echo "## Sparse writer test - test writing to random locations in the dataset" + echo "###############################################################################" + + # Launch the Generator + # NOTE: Random seed is shared between readers and writers and is + # created by the generator. + echo launch the swmr_generator + seed="" # Put -r command here + $testdir/swmr_generator $compress $index_type $seed + if test $? -ne 0; then + echo generator had error + nerrors=`expr $nerrors + 1` + fi + + # Remove any possible writer message file before launching writer + rm -f $WRITER_MESSAGE + # Launch the Sparse writer + echo launch the swmr_sparse_writer + nice -n 20 $testdir/swmr_sparse_writer $Nrecs_spa 2>&1 |tee swmr_writer.out & + pid_writer=$! + $DPRINT pid_writer=$pid_writer + + # Wait for message from writer process before starting reader(s) + WAIT_MESSAGE $WRITER_MESSAGE + # + # Launch the Sparse readers + n=0 + pid_readers="" + echo launch $Nrdrs_spa swmr_sparse_readers + while [ $n -lt $Nrdrs_spa ]; do + # The sparse reader spits out a LOT of data so it's set to 'quiet' + $testdir/swmr_sparse_reader -q $Nrecs_spa 2>&1 |tee swmr_reader.out.$n & + pid_readers="$pid_readers $!" + n=`expr $n + 1` + done + $DPRINT pid_readers=$pid_readers + $IFDEBUG ps + + # Collect exit code of the writer + $DPRINT checked writer $pid_writer + wait $pid_writer + if test $? -ne 0; then + echo writer had error + nerrors=`expr $nerrors + 1` + fi + + # Collect exit code of the readers + for xpid in $pid_readers; do + $DPRINT checked reader $xpid + wait $xpid + if test $? -ne 0; then + echo reader had error + nerrors=`expr $nerrors + 1` + fi + done + + # Check for error and exit if one occurred + $DPRINT nerrors=$nerrors + if test $nerrors -ne 0 ; then + echo "SWMR tests failed with $nerrors errors." + echo "(Writer and reader output preserved)" + exit 1 + fi + + # Clean up output files + rm -f swmr_writer.out + rm -f swmr_reader.out.* + done +done + +############################################################################### +## Report and exit +############################################################################### +cd .. +$DPRINT nerrors=$nerrors +if test $nerrors -eq 0 ; then + echo "SWMR tests passed." + if test -z "$HDF5_NOCLEANUP"; then + # delete the test directory + rm -rf swmr_test + fi + exit 0 +else + echo "SWMR tests failed with $nerrors errors." + exit 1 +fi + diff --git a/test/test_use_cases.sh.in b/test/test_use_cases.sh.in new file mode 100644 index 0000000..fd30afd --- /dev/null +++ b/test/test_use_cases.sh.in @@ -0,0 +1,219 @@ +#! /bin/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. +# +# Tests the use cases of swmr features. +# +# Created: +# Albert Cheng, 2013/06/01. +# Modified: +# + +# This is work in progress. +# For now, it shows how to run the test cases programs. It only verifies the +# exit codes are okay (0). + +############################################################################### +## test variables +############################################################################### + +# Number of errors encountered during test run. +nerrors=0 + +# Define variables +verbose=yes + +############################################################################### +## Main +############################################################################### +srcdir=@srcdir@ +utils_testdir=@abs_top_builddir@/@H5_UTILS_TEST_BUILDDIR@ +testdir=@abs_top_builddir@/@H5_TEST_BUILDDIR@ + +# Check to see if the VFD specified by the HDF5_DRIVER environment variable +# supports SWMR. +$utils_testdir/swmr_check_compat_vfd +rc=$? +if [[ $rc != 0 ]] ; then + echo + echo "The VFD specified by the HDF5_DRIVER environment variable" + echo "does not support SWMR" + echo + echo "SWMR use case tests skipped" + echo + exit 0 +fi + +# Define symbols +EXIT_SUCCESS=0 +EXIT_FAILURE=1 +EXIT_VALUE=$EXIT_SUCCESS # Default all tests succeed +RESULT_PASSED=" PASSED" +RESULT_FAILED="*FAILED*" +RESULT_SKIP="-SKIP-" +USECASES_PROGRAMS="use_append_chunk use_append_mchunks" +TESTNAME="Use Case" + +# Source in the output filter function definitions. +. $srcdir/../bin/output_filter.sh + +# Define functions +# Print a line-line message left justified in a field of 72 characters. +# Results can be " PASSED", "*FAILED*", "-SKIP-", up to 8 characters +# wide. +# SPACES should be at least 71 spaces. ($* + ' ' + 71 + 8 >= 80) +# +TESTING() { + SPACES=" " + echo "$* $SPACES" | cut -c1-72 | tr -d '\012' +} + +# Run a test and print PASS or *FAIL*. If a test fails then increment +# the `nerrors' global variable and (if $verbose is set) display the +# difference between the actual output and the expected output. The +# expected output is given as the first argument to this function and +# the actual output file is calculated by replacing the `.ddl' with +# `.out'. The actual output is not removed if $HDF5_NOCLEANUP has a +# non-zero value. +# ADD_H5_TEST +TOOLTEST() { + program=$1 + shift + + actual="$program.out" + actual_err="$program.err" + actual_sav=${actual}-sav + actual_err_sav=${actual_err}-sav + + # Run test. + TESTING $program $@ + ( + $RUNSERIAL $testdir/$program "$@" + ) >$actual 2>$actual_err + exit_code=$? + + # save actual and actual_err in case they are needed later. + cp $actual $actual_sav + STDOUT_FILTER $actual + cp $actual_err $actual_err_sav + STDERR_FILTER $actual_err + cat $actual_err >> $actual + + if [ $exit_code -eq 0 ];then + echo "$RESULT_PASSED" + test yes = "$verbose" && sed 's/^/ /' < $actual + else + echo "$RESULT_FAILED" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && sed 's/^/ /' < $actual + fi + + # Clean up output file + if test -z "$HDF5_NOCLEANUP"; then + rm -f $actual $actual_err $actual_sav $actual_err_sav $actual_ext + fi +} + +# HDF5 has several tests that create and delete signal files to communicate +# between processes, and it seems that even though the names of the files are +# different, occasionally the wrong file is deleted, interrupting the flow of +# the test. Running each of these tests in its own directory should eliminate +# the problem. +mkdir usecases_test +cp $testdir/twriteorder usecases_test +for FILE in use_*; do + case "$FILE" in + *.o) continue ;; ## don't copy the .o files + esac + if test -f "$FILE" ; then + cp $FILE usecases_test + fi +done + +# With the --disable-shared option, swmr program files are built in the test +# directory, otherwise they are in test/.libs with a corresponding wrapper +# script in the test directory. The programs or wrapper scripts in test should +# always be copied, swmr files in .libs should be copied only if they exists. +if [ -f .libs/use_append_chunk ]; then + mkdir usecases_test/.libs + for FILE in .libs/use_*; do + case "$FILE" in + *.o) continue ;; ## don't copy the .o files + esac + if test -f "$FILE" ; then + cp $FILE usecases_test/.libs + fi + done + cp .libs/twriteorder usecases_test/.libs +fi + +cd usecases_test + + +# run tests for H5Odisable_mdc_flushes/H5Oenable_mdc_flushes/H5Oare_mdc_flushes_disabled here temporary +USECORK=use_disable_mdc_flushes +for p in $USECORK; do + TOOLTEST $p + TOOLTEST $p -y 3 + TOOLTEST $p -n 3000 + TOOLTEST $p -n 5000 +done + +# run write order test here temporary +WRITEORDER=twriteorder +for p in $WRITEORDER; do + TOOLTEST $p + TOOLTEST $p -b 1000 + TOOLTEST $p -p 3000 + TOOLTEST $p -n 2000 + TOOLTEST $p -l w + TOOLTEST $p -l r +done + +# Report test results +if test $nerrors -eq 0 ; then + echo "$WRITEORDER test passed." +else + echo "$WRITEORDER test failed with $nerrors errors." + EXIT_VALUE=$EXIT_FAILURE + nerrors=0 # reset nerror for the regular tests below. +fi + +# main body +for p in $USECASES_PROGRAMS; do + TOOLTEST $p + TOOLTEST $p -z 256 + tmpfile=/tmp/datatfile.$$ + TOOLTEST $p -f $tmpfile; rm -f $tmpfile + TOOLTEST $p -l w + TOOLTEST $p -l r + # use case 1.9, testing with multi-planes chunks + TOOLTEST $p -z 256 -y 5 # 5 planes chunks + # cleanup temp datafile + if test -z "$HDF5_NOCLEANUP"; then + rm -f $p.h5 + fi +done + +cd .. +# Report test results and exit +if test $nerrors -eq 0 ; then + echo "All $TESTNAME tests passed." + if test -z "$HDF5_NOCLEANUP"; then + # delete the test directory + rm -rf usecases_test + fi +else + echo "$TESTNAME tests failed with $nerrors errors." + EXIT_VALUE=$EXIT_FAILURE +fi + +exit $EXIT_VALUE diff --git a/test/test_usecases.sh.in b/test/test_usecases.sh.in deleted file mode 100644 index fd30afd..0000000 --- a/test/test_usecases.sh.in +++ /dev/null @@ -1,219 +0,0 @@ -#! /bin/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. -# -# Tests the use cases of swmr features. -# -# Created: -# Albert Cheng, 2013/06/01. -# Modified: -# - -# This is work in progress. -# For now, it shows how to run the test cases programs. It only verifies the -# exit codes are okay (0). - -############################################################################### -## test variables -############################################################################### - -# Number of errors encountered during test run. -nerrors=0 - -# Define variables -verbose=yes - -############################################################################### -## Main -############################################################################### -srcdir=@srcdir@ -utils_testdir=@abs_top_builddir@/@H5_UTILS_TEST_BUILDDIR@ -testdir=@abs_top_builddir@/@H5_TEST_BUILDDIR@ - -# Check to see if the VFD specified by the HDF5_DRIVER environment variable -# supports SWMR. -$utils_testdir/swmr_check_compat_vfd -rc=$? -if [[ $rc != 0 ]] ; then - echo - echo "The VFD specified by the HDF5_DRIVER environment variable" - echo "does not support SWMR" - echo - echo "SWMR use case tests skipped" - echo - exit 0 -fi - -# Define symbols -EXIT_SUCCESS=0 -EXIT_FAILURE=1 -EXIT_VALUE=$EXIT_SUCCESS # Default all tests succeed -RESULT_PASSED=" PASSED" -RESULT_FAILED="*FAILED*" -RESULT_SKIP="-SKIP-" -USECASES_PROGRAMS="use_append_chunk use_append_mchunks" -TESTNAME="Use Case" - -# Source in the output filter function definitions. -. $srcdir/../bin/output_filter.sh - -# Define functions -# Print a line-line message left justified in a field of 72 characters. -# Results can be " PASSED", "*FAILED*", "-SKIP-", up to 8 characters -# wide. -# SPACES should be at least 71 spaces. ($* + ' ' + 71 + 8 >= 80) -# -TESTING() { - SPACES=" " - echo "$* $SPACES" | cut -c1-72 | tr -d '\012' -} - -# Run a test and print PASS or *FAIL*. If a test fails then increment -# the `nerrors' global variable and (if $verbose is set) display the -# difference between the actual output and the expected output. The -# expected output is given as the first argument to this function and -# the actual output file is calculated by replacing the `.ddl' with -# `.out'. The actual output is not removed if $HDF5_NOCLEANUP has a -# non-zero value. -# ADD_H5_TEST -TOOLTEST() { - program=$1 - shift - - actual="$program.out" - actual_err="$program.err" - actual_sav=${actual}-sav - actual_err_sav=${actual_err}-sav - - # Run test. - TESTING $program $@ - ( - $RUNSERIAL $testdir/$program "$@" - ) >$actual 2>$actual_err - exit_code=$? - - # save actual and actual_err in case they are needed later. - cp $actual $actual_sav - STDOUT_FILTER $actual - cp $actual_err $actual_err_sav - STDERR_FILTER $actual_err - cat $actual_err >> $actual - - if [ $exit_code -eq 0 ];then - echo "$RESULT_PASSED" - test yes = "$verbose" && sed 's/^/ /' < $actual - else - echo "$RESULT_FAILED" - nerrors="`expr $nerrors + 1`" - test yes = "$verbose" && sed 's/^/ /' < $actual - fi - - # Clean up output file - if test -z "$HDF5_NOCLEANUP"; then - rm -f $actual $actual_err $actual_sav $actual_err_sav $actual_ext - fi -} - -# HDF5 has several tests that create and delete signal files to communicate -# between processes, and it seems that even though the names of the files are -# different, occasionally the wrong file is deleted, interrupting the flow of -# the test. Running each of these tests in its own directory should eliminate -# the problem. -mkdir usecases_test -cp $testdir/twriteorder usecases_test -for FILE in use_*; do - case "$FILE" in - *.o) continue ;; ## don't copy the .o files - esac - if test -f "$FILE" ; then - cp $FILE usecases_test - fi -done - -# With the --disable-shared option, swmr program files are built in the test -# directory, otherwise they are in test/.libs with a corresponding wrapper -# script in the test directory. The programs or wrapper scripts in test should -# always be copied, swmr files in .libs should be copied only if they exists. -if [ -f .libs/use_append_chunk ]; then - mkdir usecases_test/.libs - for FILE in .libs/use_*; do - case "$FILE" in - *.o) continue ;; ## don't copy the .o files - esac - if test -f "$FILE" ; then - cp $FILE usecases_test/.libs - fi - done - cp .libs/twriteorder usecases_test/.libs -fi - -cd usecases_test - - -# run tests for H5Odisable_mdc_flushes/H5Oenable_mdc_flushes/H5Oare_mdc_flushes_disabled here temporary -USECORK=use_disable_mdc_flushes -for p in $USECORK; do - TOOLTEST $p - TOOLTEST $p -y 3 - TOOLTEST $p -n 3000 - TOOLTEST $p -n 5000 -done - -# run write order test here temporary -WRITEORDER=twriteorder -for p in $WRITEORDER; do - TOOLTEST $p - TOOLTEST $p -b 1000 - TOOLTEST $p -p 3000 - TOOLTEST $p -n 2000 - TOOLTEST $p -l w - TOOLTEST $p -l r -done - -# Report test results -if test $nerrors -eq 0 ; then - echo "$WRITEORDER test passed." -else - echo "$WRITEORDER test failed with $nerrors errors." - EXIT_VALUE=$EXIT_FAILURE - nerrors=0 # reset nerror for the regular tests below. -fi - -# main body -for p in $USECASES_PROGRAMS; do - TOOLTEST $p - TOOLTEST $p -z 256 - tmpfile=/tmp/datatfile.$$ - TOOLTEST $p -f $tmpfile; rm -f $tmpfile - TOOLTEST $p -l w - TOOLTEST $p -l r - # use case 1.9, testing with multi-planes chunks - TOOLTEST $p -z 256 -y 5 # 5 planes chunks - # cleanup temp datafile - if test -z "$HDF5_NOCLEANUP"; then - rm -f $p.h5 - fi -done - -cd .. -# Report test results and exit -if test $nerrors -eq 0 ; then - echo "All $TESTNAME tests passed." - if test -z "$HDF5_NOCLEANUP"; then - # delete the test directory - rm -rf usecases_test - fi -else - echo "$TESTNAME tests failed with $nerrors errors." - EXIT_VALUE=$EXIT_FAILURE -fi - -exit $EXIT_VALUE diff --git a/test/test_vds_env.sh.in b/test/test_vds_env.sh.in new file mode 100644 index 0000000..97518f1 --- /dev/null +++ b/test/test_vds_env.sh.in @@ -0,0 +1,43 @@ +#! /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. +# +# Test for external file with environment variable: HDF5_VDS_PREFIX + +srcdir=@srcdir@ + +nerrors=0 + +############################################################################## +############################################################################## +### T H E T E S T S ### +############################################################################## +############################################################################## + +# test for VDS with HDF5_VDS_PREFIX +echo "Testing basic virtual dataset I/O via H5Pset_vds_prefix(): all selection with ENV prefix" +TEST_NAME=vds_env # The test name +TEST_BIN=`pwd`/$TEST_NAME # The path of the test binary +ENVCMD="env HDF5_VDS_PREFIX=\${ORIGIN}/tmp_vds_env" # Set the environment variable & value +UNENVCMD="unset HDF5_VDS_PREFIX" # Unset the environment variable & value +# +# Run the test +# echo "$ENVCMD $RUNSERIAL $TEST_BIN" +$ENVCMD $RUNSERIAL $TEST_BIN +exitcode=$? +if [ $exitcode -eq 0 ]; then + echo "Test prefix for HDF5_VDS_PREFIX PASSED" +else + nerrors="`expr $nerrors + 1`" + echo "***Error encountered for HDF5_VDS_PREFIX test***" +fi +$UNENVCMD +exit $nerrors diff --git a/test/test_vds_swmr.sh.in b/test/test_vds_swmr.sh.in new file mode 100644 index 0000000..6cdecca --- /dev/null +++ b/test/test_vds_swmr.sh.in @@ -0,0 +1,232 @@ +#! /bin/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. +# +# Tests for the swmr feature using virtual datasets. +# +# Created: +# Dana Robinson, November 2015 + +srcdir=@srcdir@ +utils_testdir=@abs_top_builddir@/@H5_UTILS_TEST_BUILDDIR@ +testdir=@abs_top_builddir@/@H5_TEST_BUILDDIR@ + +############################################################################### +## test parameters +############################################################################### + +Nwriters=6 # number of writers (1 per source dataset) +Nreaders=5 # number of readers to launch +nerrors=0 + +############################################################################### +## definitions for message file to coordinate test runs +############################################################################### +WRITER_MESSAGE=SWMR_WRITER_MESSAGE # The message file created by writer that the open is complete + # This should be the same as the define in "test/swmr_common.h" +MESSAGE_TIMEOUT=300 # Message timeout length in secs + # This should be the same as the define in "test/h5test.h" + +############################################################################### +## short hands and function definitions +############################################################################### +DPRINT=: # Set to "echo Debug:" for debugging printing, + # else ":" for noop. +IFDEBUG=: # Set to null to turn on debugging, else ":" for noop. + +# 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' +} + +# To wait for the writer message file or till the maximum # of seconds is reached +# $1 is the message file to wait for +# This performs similar function as the routine h5_wait_message() in test/h5test.c +WAIT_MESSAGE() { + message=$1 # Get the name of the message file to wait for + t0=`date +%s` # Get current time in seconds + difft=0 # Initialize the time difference + mexist=0 # Indicate whether the message file is found + while [ $difft -lt $MESSAGE_TIMEOUT ] ; # Loop till message times out + do + t1=`date +%s` # Get current time in seconds + difft=`expr $t1 - $t0` # Calculate the time difference + if [ -e $message ]; then # If message file is found: + mexist=1 # indicate the message file is found + rm $message # remove the message file + break # get out of the while loop + fi + done; + if test $mexist -eq 0; then + # Issue warning that the writer message file is not found, continue with launching the reader(s) + echo warning: $WRITER_MESSAGE is not found after waiting $MESSAGE_TIMEOUT seconds + else + echo $WRITER_MESSAGE is found + fi +} + +############################################################################### +## Main +############################################################################### + +# Check to see if the VFD specified by the HDF5_DRIVER environment variable +# supports SWMR. +$utils_testdir/swmr_check_compat_vfd +rc=$? +if [ $rc -ne 0 ] ; then + echo + echo "The VFD specified by the HDF5_DRIVER environment variable" + echo "does not support SWMR." + echo + echo "SWMR acceptance tests skipped" + echo + exit 0 +fi + +# Parse options (none accepted at this time) +while [ $# -gt 0 ]; do + case "$1" in + *) # unknown option + echo "$0: Unknown option ($1)" + exit 1 + ;; + esac +done + +# HDF5 has several tests that create and delete signal files to communicate +# between processes, and it seems that even though the names of the files are +# different, occasionally the wrong file is deleted, interrupting the flow of +# the test. Running each of these tests in its own directory should eliminate +# the problem. +mkdir vds_swmr_test +for FILE in vds_swmr*; do + case "$FILE" in + *.o) continue ;; ## don't copy the .o files + esac + if test -f "$FILE" ; then + cp $FILE vds_swmr_test + fi +done + +# With the --disable-shared option, swmr program files are built in the test +# directory, otherwise they are in test/.libs with a corresponding wrapper +# script in the test directory. The programs or wrapper scripts in test should +# always be copied, swmr files in .libs should be copied only if they exists. +if [ -f .libs/vds_swmr_writer ]; then + mkdir vds_swmr_test/.libs + for FILE in .libs/vds_swmr*; do + case "$FILE" in + *.o) continue ;; ## don't copy the .o files + esac + if test -f "$FILE" ; then + cp $FILE vds_swmr_test/.libs + fi + done +fi + +cd vds_swmr_test + + +echo +echo "###############################################################################" +echo "## Basic VDS SWMR test - writing to a tiled plane" +echo "###############################################################################" + +# Launch the file generator +echo launch the generator +$testdir/vds_swmr_gen +if test $? -ne 0; then + echo generator had error + nerrors=`expr $nerrors + 1` +fi + +# Check for error and exit if one occurred +$DPRINT nerrors=$nerrors +if test $nerrors -ne 0 ; then + echo "VDS SWMR tests failed with $nerrors errors." + exit 1 +fi + +# Launch the writers +echo "launch the $Nwriters SWMR VDS writers (1 per source)" +pid_writers="" +n=0 +while [ $n -lt $Nwriters ]; do + $testdir/vds_swmr_writer $n & + pid_writers="$pid_writers $!" + n=`expr $n + 1` +done +$DPRINT pid_writers=$pid_writers +$IFDEBUG ps + +# Sleep to ensure that the writers have started +sleep 3 + +# Launch the readers +echo launch $Nreaders SWMR readers +pid_readers="" +n=0 +while [ $n -lt $Nreaders ]; do + $testdir/vds_swmr_reader & + pid_readers="$pid_readers $!" + n=`expr $n + 1` +done +$DPRINT pid_readers=$pid_readers +$IFDEBUG ps + +# Collect exit code of the writers +for xpid in $pid_writers; do + $DPRINT checked writer $xpid + wait $xpid + if test $? -ne 0; then + echo writer had error + nerrors=`expr $nerrors + 1` + fi +done + +# Collect exit code of the readers +# (they usually finish after the writers) +for xpid in $pid_readers; do + $DPRINT checked reader $xpid + wait $xpid + if test $? -ne 0; then + echo reader had error + nerrors=`expr $nerrors + 1` + fi +done + +# Check for error and exit if one occurred +$DPRINT nerrors=$nerrors +if test $nerrors -ne 0 ; then + echo "VDS SWMR tests failed with $nerrors errors." + exit 1 +fi + +############################################################################### +## Report and exit +############################################################################### +cd .. +$DPRINT nerrors=$nerrors +if test $nerrors -eq 0 ; then + echo "VDS SWMR tests passed." + if test -z "$HDF5_NOCLEANUP"; then + # delete the test directory + rm -rf vds_swmr_test + fi + exit 0 +else + echo "VDS SWMR tests failed with $nerrors errors." + exit 1 +fi + diff --git a/test/testabort_fail.sh.in b/test/testabort_fail.sh.in deleted file mode 100644 index 5d5a858..0000000 --- a/test/testabort_fail.sh.in +++ /dev/null @@ -1,65 +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. -# -# Test to verify that the assertion/abort failure is fixed when the application -# does not close the file. (See HDFFV-10160) -# -# Test to verify that the infinite loop closing library/abort failure is fixed -# when the application creates and removes dense attributes (See HDFFV-10659) - -srcdir=@srcdir@ - -nerrors=0 - -############################################################################## -############################################################################## -### T H E T E S T S ### -############################################################################## -############################################################################## -# -# -echo "Testing file not closed assertion/abort failure" -TEST_NAME=filenotclosed # The test name -TEST_BIN=`pwd`/$TEST_NAME # The path of the test binary -# -# Run the test -$RUNSERIAL $TEST_BIN >/dev/null 2>&1 -exitcode=$? -if [ $exitcode -eq 0 ]; then - echo "Test PASSED" -else - echo "Test FAILED" - nerrors="`expr $nerrors + 1`" -fi -# -# -echo "Testing infinite loop closing library/abort failure" -TEST_NAME=del_many_dense_attrs # The test name -TEST_BIN=`pwd`/$TEST_NAME # The path of the test binary -# Run the test -$RUNSERIAL $TEST_BIN >/dev/null 2>&1 -exitcode=$? -if [ $exitcode -eq 0 ]; then - echo "Test PASSED" -else - echo "Test FAILED" - nerrors="`expr $nerrors + 1`" -fi -# -# -if test $nerrors -eq 0 ; then - echo "All tests for abort failure passed." - exit 0 -else - echo "Tests for abort failure failed with $nerrors errors." - exit 1 -fi diff --git a/test/testcheck_version.sh.in b/test/testcheck_version.sh.in deleted file mode 100644 index 0889f74..0000000 --- a/test/testcheck_version.sh.in +++ /dev/null @@ -1,260 +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. - -# -# Tests for the H5check_version function. -# -# Programmer: Albert Cheng -# Sep 28, 2009 - -srcdir=@srcdir@ - -# Variables filled in by the configure process. -# Determine the configure options of the hdf5 library and executables. -Shared_Lib=@enable_shared@ -Static_Lib=@enable_static@ -Static_exec=@STATIC_EXEC@ -h5haveexitcode=yes # default is yes - -CMP='cmp -s' -DIFF='diff -c' -RM='rm -f' - -# Function definitions -# -# Show the purpose of this test script and a note about the abort messages. -PURPOSE() { - echo "Tests for the H5check_version function." - echo "Note that abort messages may appear due to the expected termination" - echo "of the program when it is tested with mis-matched version numbers." -} - -# Print a line-line message left justified in a field of 70 characters. -# -LINEMSG() { - SPACES=" " - echo "$* $SPACES" | cut -c1-70 | tr -d '\012' -} - - -# Print a "SKIP" message -SKIP() { - LINEMSG $* - echo " -SKIP-" -} - - -# Print warning message of version mismatch. -WarnMesg(){ - echo "Warning! ***HDF5 library version mismatched error***" - echo "The HDF5 header files used to compile this application do not match" - echo "the version used by the HDF5 library to which this application is linked." - echo "Data corruption or segmentation faults may occur if the application continues." - echo "This can happen when an application was compiled by one version of HDF5 but" - echo "linked with a different version of static or shared HDF5 library." - echo "You should recompile the application or check your shared library related" - echo "settings such as 'LD_LIBRARY_PATH'." - echo "You can, at your own risk, disable this warning by setting the environment" - echo "variable 'HDF5_DISABLE_VERSION_CHECK' to a value of '1'." - echo "Setting it to 2 or higher will suppress the warning messages totally." - echo "Headers are $xxh5versmajor.$xxh5versminor.$xxh5versrelease, library is $h5versmajor.$h5versminor.$h5versrelease" - test -n "$H5_HAVE_EMBEDDED_LIBINFO" && cat $h5libsettings - echo "Bye..." -} - - -# Print warning message2 of version mismatch. -WarnMesg2(){ - echo "Warning! ***HDF5 library version mismatched error***" - echo "The HDF5 header files used to compile this application do not match" - echo "the version used by the HDF5 library to which this application is linked." - echo "Data corruption or segmentation faults may occur if the application continues." - echo "This can happen when an application was compiled by one version of HDF5 but" - echo "linked with a different version of static or shared HDF5 library." - echo "You should recompile the application or check your shared library related" - echo "settings such as 'LD_LIBRARY_PATH'." - echo "'HDF5_DISABLE_VERSION_CHECK' environment variable is set to 1, application will" - echo "continue at your own risk." - echo "Headers are $xxh5versmajor.$xxh5versminor.$xxh5versrelease, library is $h5versmajor.$h5versminor.$h5versrelease" - test -n "$H5_HAVE_EMBEDDED_LIBINFO" && cat $h5libsettings -} - - -# Run a test and print PASS or *FAIL*. If a test fails then increment -# the `nerrors' global variable and (if $verbose is set) display the -# difference between the actual output and the expected output. The -# expected output generated according to the parameter values and compared -# against actual output. -# The expected and actual output files are removed unless $HDF5_NOCLEANUP -# has a non-zero value. -# $1: the set value of $HDF5_DISABLE_VERSION_CHECK. (unset means not to set -# it at all. -# $2: Change the version number(s) to cause a mismatch. (none means no -# mismatch). -# -# Expected results: -# Value of $HDF5_DISABLE_VERSION_CHECK -# unset "" -1 0 1 2 3 -# Matched OK OK OK OK OK OK OK -# Mismatched W/A W/A W/A W/A W2/OK OK W2/OK -# Result codes: -# OK: No warning, exit 0. -# W/A: Warning, abort and exit non-0. -# W2/OK: Different Warning, exit 0. -# -# Implemented only exit code matching. Still need to match output. -TESTING() { - DEBUGPRINT command is $0 $* - TEST_NAME=tcheck_version # The test name - TEST_BIN=`pwd`/$TEST_NAME # The path of the test binary - - expect=${TEST_NAME}_expect.out - actual=${TEST_NAME}_actual.out - actual_err=${TEST_NAME}_actual.err - arguments= - - h5DisableVersion="$1" - wrongversionnumbers="$2" - xxh5versmajor=$h5versmajor - xxh5versminor=$h5versminor - xxh5versrelease=$h5versrelease - - if [ "$h5DisableVersion" = unset ]; then - envcmd="" # noop - else - envcmd="env HDF5_DISABLE_VERSION_CHECK=$h5DisableVersion" - fi - - if [ "$wrongversionnumbers" = none ]; then - # OK: No warning, exit 0 - cp /dev/null $expect - expect_code=0 - else - arguments=-t"$wrongversionnumbers" - # calculate mismatched version numbers by listing. - case $wrongversionnumbers in - "M") xxh5versmajor=`expr $h5versmajor + 1` - ;; - "m") xxh5versminor=`expr $h5versminor + 1` - ;; - "r") xxh5versrelease=`expr $h5versrelease + 1` - ;; - esac - case "$h5DisableVersion" in - 1) - # W2/OK: Different Warning, exit 0. - WarnMesg2 > $expect - expect_code=0 - ;; - [2-9]|[1-9][0-9]*) - # OK: No warning, exit 0 - cp /dev/null $expect - expect_code=0 - ;; - *) # W/A: Warning, abort and exit non-0. - WarnMesg > $expect - expect_code=6 # Signal Abort exit code (128+6) - ;; - esac - fi - - # Run test. - LINEMSG $envcmd $TEST_NAME $arguments - ( - $envcmd $RUNSERIAL $TEST_BIN $arguments - ) >$actual 2>$actual_err - ret_code=$? - cat $actual_err >> $actual - - if [ $h5haveexitcode = 'yes' -a \( $expect_code -ne $ret_code \) ]; then - echo "*FAILED*" - echo " Expected exit code ($expect_code) differs from actual code ($ret_code)" - nerrors="`expr $nerrors + 1`" - elif $CMP $expect $actual; then - echo " PASSED" - else - echo "*FAILED*" - echo " Expected result differs from actual result" - nerrors="`expr $nerrors + 1`" - test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' - fi - - # Clean up output file. - # Also clean the core file generated by H5check_version's abort. - if test -z "$HDF5_NOCLEANUP"; then - $RM $expect $actual $actual_err - $RM core - fi -} - - -# Echo parameters for debugging if verbose mode is on. -DEBUGPRINT() { - if [ -n "$debugmode" ]; then - echo $* - fi -} - - -# MAIN Body -nerrors=0 -verbose=yes # default on -debugmode= # default off -H5_HAVE_EMBEDDED_LIBINFO=`grep '#define H5_HAVE_EMBEDDED_LIBINFO ' ../src/H5pubconf.h` -h5libsettings=../src/libhdf5.settings - -PURPOSE - -# Figure out library version numbers from the header file. -h5versmajor=`grep '#define H5_VERS_MAJOR' $srcdir/../src/H5public.h | awk '{print $3}'` -h5versminor=`grep '#define H5_VERS_MINOR' $srcdir/../src/H5public.h | awk '{print $3}'` -h5versrelease=`grep '#define H5_VERS_RELEASE' $srcdir/../src/H5public.h | awk '{print $3}'` -DEBUGPRINT $h5versmajor.$h5versminor.$h5versrelease -case "$h5versmajor$h5versminor$h5versrelease" in - [0-9]*) # good. noop. - ;; - *) - echo "Illegal library version numbers($h5versmajor.$h5versminor.$h5versrelease)" - echo "Test aborted" - exit 1 - ;; -esac - -# RUNSERIAL is used. Check if it can return exit code from executalbe correctly. -if [ -n "$RUNSERIAL_NOEXITCODE" ]; then - echo "***Warning*** Serial Exit Code is not passed back to shell correctly." - echo "***Warning*** Exit code checking is skipped." - h5haveexitcode=no -fi - -# Three Categories of tests: -# Normal: where the version numbers all matched (wrong_version == none). -# Mismatched version numbers (could be Major or minor version -# or release numbers or a combination of all three.) -# Test all the above with different values of the environment variable, -# HDF5_DISABLE_VERSION_CHECK, as unset, "", -1, 0, 1, 2, 3 - -for val_disable_version_check in unset "" -1 0 1 2 3; do - for wrong_version in none M m; do - TESTING "$val_disable_version_check" "$wrong_version" - done -done - - -# Check and report results. -if [ $nerrors -gt 0 ]; then - echo "***$nerrors errors encountered***" - exit 1 -else - echo "No error encountered" - exit 0 -fi diff --git a/test/testerror.sh.in b/test/testerror.sh.in deleted file mode 100644 index 49c8884..0000000 --- a/test/testerror.sh.in +++ /dev/null @@ -1,123 +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. -# -# Tests for test_error and err_compat - -srcdir=@srcdir@ - -# Determine backward compatibility options eneabled -DEPRECATED_SYMBOLS="@DEPRECATED_SYMBOLS@" - -CMP='cmp -s' -DIFF='diff -c' - -# Skip plugin module to test missing filter -ENVCMD="env HDF5_PLUGIN_PRELOAD=::" - -nerrors=0 -verbose=yes - -test -d ./testfiles || mkdir ./testfiles - -# Print a line-line message left justified in a field of 70 characters -# beginning with the word "Testing". -# -TESTING() { - SPACES=" " - echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012' -} - -# Run a test and print PASS or *FAIL*. If a test fails then increment -# the `nerrors' global variable and (if $verbose is set) display the -# difference between the actual output and the expected output. The -# expected output is given as the first argument to this function and -# the actual output file is calculated by replacing the `.ddl' with -# `.out'. The actual output is not removed if $HDF5_NOCLEANUP has a -# non-zero value. -# -TEST() { - TEST_ERR=$1 # The test name - TEST_ERR_BIN=`pwd`/$TEST_ERR # The path of the test binary - - expect1="$srcdir/testfiles/$1_1" - expect2="$srcdir/testfiles/$1_2" - actual="./`basename $1`.out" - actual_err="./`basename $1`.err" - actual_ext="./`basename $1`.ext" - shift - - # Run test. - TESTING $TEST_ERR - ( - # Skip the plugin for testing missing filter. - $ENVCMD $RUNSERIAL $TEST_ERR_BIN - ) >$actual 2>$actual_err - - # Check for core dump - if [ $? != 0 ]; then - nerrors=`expr $nerrors + 1` - fi - - # Extract file name, line number, version and thread IDs because they may be different - sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ - -e 's/line [0-9]*/line (number)/' \ - -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ - -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ - -e 's/H5Eget_auto[1-2]*/H5Eget_auto(1 or 2)/' \ - -e 's/H5Eset_auto[1-2]*/H5Eset_auto(1 or 2)/' \ - $actual_err > $actual_ext - cat $actual_ext >> $actual - - if $CMP $expect1 $actual; then - echo " PASSED" - elif $CMP $expect2 $actual; then - echo " PASSED" - else - echo "*FAILED*" - echo " Expected result differs from actual result" - nerrors="`expr $nerrors + 1`" - test yes = "$verbose" && $DIFF $expect1 $actual |sed 's/^/ /' - fi - - # Clean up output file - if test -z "$HDF5_NOCLEANUP"; then - rm -f $actual $actual_err $actual_ext - fi -} - -# Print a "SKIP" message -SKIP() { - TESTING $@ - echo " -SKIP-" -} - -############################################################################## -############################################################################## -### T H E T E S T S ### -############################################################################## -############################################################################## - -# test for err_compat -if test $DEPRECATED_SYMBOLS != "yes"; then -SKIP err_compat -else -TEST err_compat -fi - -# test for error_test. Skip the plugin for testing missing filter. -TEST error_test - -if test $nerrors -eq 0 ; then - echo "All Error API tests passed." -fi - -exit $nerrors diff --git a/test/testexternal_env.sh.in b/test/testexternal_env.sh.in deleted file mode 100644 index 41e04f1..0000000 --- a/test/testexternal_env.sh.in +++ /dev/null @@ -1,41 +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. -# -# Test for external file with environment variable: HDF5_EXTFILE_PREFIX - -srcdir=@srcdir@ - -nerrors=0 - -############################################################################## -############################################################################## -### T H E T E S T S ### -############################################################################## -############################################################################## - -# test for external file with HDF5_EXTFILE_PREFIX -echo "Testing external file with HDF5_EXTFILE_PREFIX" -TEST_NAME=external_env # The test name -TEST_BIN=`pwd`/$TEST_NAME # The path of the test binary -ENVCMD="env HDF5_EXTFILE_PREFIX=\${ORIGIN}" # The environment variable & value -# -# Run the test -# echo "$ENVCMD $RUNSERIAL $TEST_BIN" -$ENVCMD $RUNSERIAL $TEST_BIN -exitcode=$? -if [ $exitcode -eq 0 ]; then - echo "Test prefix for HDF5_EXTFILE_PREFIX PASSED" -else - nerrors="`expr $nerrors + 1`" - echo "***Error encountered for HDF5_EXTFILE_PREFIX test***" -fi -exit $nerrors diff --git a/test/testflushrefresh.sh.in b/test/testflushrefresh.sh.in deleted file mode 100644 index adbba4f..0000000 --- a/test/testflushrefresh.sh.in +++ /dev/null @@ -1,237 +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. -# -# -# Test script for the flush/evict single objects feature. -# -# This test file doesn't actually perform any tests, rather, it acts -# as a process manager for the 'flushrefresh' test file, which is where -# the tests are actually housed. The reason this script exists is because -# the verification of this feature needs to occur in separate processes -# from the one in which the file is being manipulated in. (i.e., we have -# a single writer process, and various reader processes spawning off -# and doing the verification that individual objects are being -# correctly flushed). -# -# Programmer: -# Mike McGreevy -# Tuesday, July 20, 2010 - -############################################################################### -## test variables -############################################################################### - -# Number of errors encountered during test run. -nerrors=0 - -# Set up a function to check the current time since the epoch - ideally, we'd -# like to use Perl. If it wasn't detected by configure, then use date, though -# this is less portable and might cause problems on machines that don't -# recognize the +%s option (like Solaris). -# -# Note that PERL will resolve to true or false, not a path. -PERL=@PERL@ -if test -n "$PERL"; then - TimeStamp() - { - time=`perl -e 'print int(time)'` - echo "$time" - } -else - TimeStamp() - { - time=`date +%s` - echo "$time" - } -fi - -############################################################################### -## Main -############################################################################### -srcdir=@srcdir@ -utils_testdir=@abs_top_builddir@/@H5_UTILS_TEST_BUILDDIR@ -testdir=@abs_top_builddir@/@H5_TEST_BUILDDIR@ - -# Check to see if the VFD specified by the HDF5_DRIVER environment variable -# supports SWMR. -$utils_testdir/swmr_check_compat_vfd -rc=$? -if [ $rc -ne 0 ] ; then - echo - echo "The VFD specified by the HDF5_DRIVER environment variable" - echo "does not support SWMR." - echo - echo "flush/refresh tests skipped" - echo - exit 0 -fi - -# HDF5 has several tests that create and delete signal files to communicate -# between processes, and it seems that even though the names of the files are -# different, occasionally the wrong file is deleted, interrupting the flow of -# the test. Running each of these tests in its own directory should eliminate -# the problem. -mkdir -p flushrefresh_test -cp $testdir/flushrefresh flushrefresh_test - -# With the --disable-shared option, flushrefresh is built in the test directory, -# otherwise it is in test/.libs with a wrapper script named flushrefresh in -# the test directory. test/flushrefresh should always be copied, -# .libs/flushrefresh should be copied only if it exists. -if [ -f .libs/flushrefresh ]; then - mkdir -p flushrefresh_test/.libs - for FILE in .libs/flushrefresh*; do - case "$FILE" in - *.o) continue ;; ## don't copy the .o files - esac - if test -f "$FILE" ; then - cp $FILE flushrefresh_test/.libs - fi - done -fi -cd flushrefresh_test - -# ================================================= -# Set up/initialize some variables to be used later -# ================================================= -testfile=flushrefresh.h5 -startsignal=flushrefresh_VERIFICATION_START -endsignal=flushrefresh_VERIFICATION_DONE -timeout_length=300 -timedout=0 -verification_done=0 -if [ -e $testfile ]; then - rm $testfile -fi - -# ======================== -# Launch the Test Program. -# ======================== -$testdir/flushrefresh & -pid_main=$! - -# ======================================= -# Run flush verification on test program. -# ======================================= - -until [ $verification_done -eq 1 ]; do - - # Wait for signal from test program that verification routine can run. - before=`TimeStamp` - until [ -s $startsignal ]; do - after=`TimeStamp` - timediff=`expr $after - $before` - if [ $timediff -gt $timeout_length ]; then - nerrors=`expr $nerrors + 1` - timedout=1 - break - fi - done - - # Check to see if we timed out looking for the signal before continuing. - if [ $timedout -gt 0 ]; then - echo "timed out waiting for signal from test program (flush)." - break - fi - - # Read in test routine parameters from signal file, then delete signal file. - param1=`head -1 $startsignal` - param2=`tail -1 $startsignal` - rm $startsignal - - # Check if we're done with verifications, otherwise run the specified verification. - if [ "$param1" = "VERIFICATION_DONE" ]; then - verification_done=1 - echo "all flush verification complete" > $endsignal - else - $testdir/flushrefresh $param1 $param2 - - # Check for core dump - if [ $? -gt 0 ]; then - nerrors=`expr $nerrors + 1` - fi - - echo "verification flush process done" > $endsignal - fi - -done - -# ========================================= -# Run refresh verification on test program. -# ========================================= -if [ $timedout -eq 0 ]; then - until [ $verification_done -eq 2 ]; do - - # Wait for signal from test program that verification routine can run. - before=`TimeStamp` - until [ -s $startsignal ]; do - after=`TimeStamp` - timediff=`expr $after - $before` - if [ $timediff -gt $timeout_length ]; then - nerrors=`expr $nerrors + 1` - timedout=1 - break - fi - done - - # Check to see if we timed out looking for the signal before continuing. - if [ $timedout -gt 0 ]; then - echo "timed out waiting for signal from test program (refresh)." - break - fi - - # Read in test routine parameter from signal file, then delete signal file. - param1=`head -n 1 $startsignal` - rm $startsignal - - # Check if we're done with verifications, otherwise run the specified verification. - if [ "$param1" = "VERIFICATION_DONE" ]; then - verification_done=2 - echo "all refresh verification complete" > $endsignal - else - $testdir/flushrefresh $param1 - - # Check for core dump - if [ $? -gt 0 ]; then - nerrors=`expr $nerrors + 1` - fi - - echo "refresh verifiction process done" > $endsignal - fi - - done -fi - -# ============================================ -# Wait for main to finish up, and end testing. -# ============================================ -wait $pid_main -if test $? -ne 0; then - echo flushrefresh had error - nerrors=`expr $nerrors + 1` -fi - -############################################################################### -## Report and exit -############################################################################### - -if test $nerrors -eq 0 ; then - echo "flush/refresh objects tests passed." - if test -z "$HDF5_NOCLEANUP"; then - # delete the test directory - rm -rf flushrefresh_test - fi - exit 0 -else - echo "flush/refresh objects tests failed with $nerrors errors." - exit 1 -fi diff --git a/test/testlibinfo.sh.in b/test/testlibinfo.sh.in deleted file mode 100644 index 601992f..0000000 --- a/test/testlibinfo.sh.in +++ /dev/null @@ -1,119 +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. - - -# -# Tests for the embedded library information feature. -# Part 1: -# Verify the HDF5 library does contains an exact copy of the content of the -# libhdf5.settings file. -# Part 2: -# If executable is linked with the static hdf5 library (how to determine?), -# verify an executable indeed contains an exact copy of the content of the -# libhdf5.settings file. -# -# Programmer: Albert Cheng -# Sep 18, 2009 - -srcdir=@srcdir@ - -# Determine the configure options of the hdf5 library and executables. - -Shared_Lib=@enable_shared@ -Static_Lib=@enable_static@ -Static_exec=@STATIC_EXEC@ - - -# Print a line-line message left justified in a field of 70 characters. -# -LINEMSG() { - SPACES=" " - echo "Check file $* $SPACES" | cut -c1-70 | tr -d '\012' -} - - -# Print a "SKIP" message -SKIP() { - LINEMSG $* - echo " -SKIP-" -} - -# Function definitions -CHECK_LIBINFO(){ - LINEMSG $1 - # Some systems, like Mac, the strings command inspects library files. Older - # versions of strings may not know newer library format, resulting in - # command errors. Make it read the file as stdin to avoid the problem. - if strings < $1 | grep "SUMMARY OF THE HDF5 CONFIGURATION" > /dev/null; then - echo " PASSED" - else - echo " FAILED" - nerrors=`expr $nerrors + 1` - fi -} - - -# MAIN Body -nerrors=0 -H5_HAVE_EMBEDDED_LIBINFO=`grep '#define H5_HAVE_EMBEDDED_LIBINFO ' ../src/H5pubconf.h` - -# Skip the rest if embedded-libinfo is not enabled. -if [ -z "$H5_HAVE_EMBEDDED_LIBINFO" ]; then - echo "embedded-libinfo is not enabled. Test skipped." - exit 0 -fi - -# The location of HDF library file(s) depends on whether shared lib is -# built too. -if [ -n $Shared_Lib ]; then - h5libdir=../src/.libs - shlib=$(grep dlname ../src/libhdf5.la | sed -e "s/dlname='//" -e "s/'//") -else - h5libdir=../src -fi - -h5libsettings=../src/libhdf5.settings - -# Part 1: -# Verify the HDF5 library does contains an exact copy of the content of the -# libhdf5.settings file. -# Check dynamic library file if built. -if [ x-$Shared_Lib = x-yes ]; then - CHECK_LIBINFO ${h5libdir}/${shlib} -else - SKIP shlib -fi - -# Though rare, libhdf5.a may not have been built. -if [ x-$Static_Lib = x-yes ]; then - CHECK_LIBINFO ${h5libdir}/libhdf5.a -else - SKIP ${h5libdir}/libhdf5.a -fi - -# Check if executables has the lib information only if shared lib is not -# built or static-exec is used. (Don't care static-exec since it affects -# tools binary only.) -if [ x-$Shared_Lib != x-yes ]; then - CHECK_LIBINFO testhdf5 -else - SKIP testhdf5 -fi - - -if [ $nerrors -gt 0 ]; then - echo "***$nerrors errors encountered***" - exit 1 -else - echo "No error encountered" - exit 0 -fi diff --git a/test/testlinks_env.sh.in b/test/testlinks_env.sh.in deleted file mode 100644 index 060fcd5..0000000 --- a/test/testlinks_env.sh.in +++ /dev/null @@ -1,41 +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. -# -# Test for external link with environment variable: HDF5_EXT_PREFIX - -srcdir=@srcdir@ - -nerrors=0 - -############################################################################## -############################################################################## -### T H E T E S T S ### -############################################################################## -############################################################################## - -# test for external links with HDF5_EXT_PREFIX -echo "Testing external link with HDF5_EXT_PREFIX" -TEST_NAME=links_env # The test name -TEST_BIN=`pwd`/$TEST_NAME # The path of the test binary -ENVCMD="env HDF5_EXT_PREFIX=.:tmp_links_env" # The environment variable & value -# -# Run the test -echo "$ENVCMD $RUNSERIAL $TEST_BIN" -$ENVCMD $RUNSERIAL $TEST_BIN -exitcode=$? -if [ $exitcode -eq 0 ]; then - echo "Test for HDF5_EXT_PREFIX PASSED" -else - nerrors="`expr $nerrors + 1`" - echo "***Error encountered for HDF5_EXT_PREFIX test***" -fi -exit $nerrors diff --git a/test/testswmr.sh.in b/test/testswmr.sh.in deleted file mode 100644 index 33734b7..0000000 --- a/test/testswmr.sh.in +++ /dev/null @@ -1,562 +0,0 @@ -#! /bin/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. -# -# Tests for the swmr feature. -# -# Created: -# Albert Cheng, 2009/07/22 - -srcdir=@srcdir@ -utils_testdir=@abs_top_builddir@/@H5_UTILS_TEST_BUILDDIR@ -testdir=@abs_top_builddir@/@H5_TEST_BUILDDIR@ - -############################################################################### -## test parameters -############################################################################### - -Nreaders=5 # number of readers to launch -Nrdrs_spa=3 # number of sparse readers to launch -Nrecords=200000 # number of records to write -Nrecs_rem=40000 # number of times to shrink -Nrecs_spa=20000 # number of records to write in the sparse test -Nsecs_add=5 # number of seconds per read interval -Nsecs_rem=3 # number of seconds per read interval -Nsecs_addrem=8 # number of seconds per read interval -nerrors=0 - -############################################################################### -## definitions for message file to coordinate test runs -############################################################################### -WRITER_MESSAGE=SWMR_WRITER_MESSAGE # The message file created by writer that the open is complete - # This should be the same as the define in "test/swmr_common.h" -MESSAGE_TIMEOUT=300 # Message timeout length in secs - # This should be the same as the define in "test/h5test.h" - -############################################################################### -## short hands and function definitions -############################################################################### -DPRINT=: # Set to "echo Debug:" for debugging printing, - # else ":" for noop. -IFDEBUG=: # Set to null to turn on debugging, else ":" for noop. - -# 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' -} - -# To wait for the writer message file or till the maximum # of seconds is reached -# $1 is the message file to wait for -# This performs similar function as the routine h5_wait_message() in test/h5test.c -WAIT_MESSAGE() { - message=$1 # Get the name of the message file to wait for - t0=`date +%s` # Get current time in seconds - difft=0 # Initialize the time difference - mexist=0 # Indicate whether the message file is found - while [ $difft -lt $MESSAGE_TIMEOUT ] ; # Loop till message times out - do - t1=`date +%s` # Get current time in seconds - difft=`expr $t1 - $t0` # Calculate the time difference - if [ -e $message ]; then # If message file is found: - mexist=1 # indicate the message file is found - rm $message # remove the message file - break # get out of the while loop - fi - done; - if test $mexist -eq 0; then - # Issue warning that the writer message file is not found, continue with launching the reader(s) - echo warning: $WRITER_MESSAGE is not found after waiting $MESSAGE_TIMEOUT seconds - else - echo $WRITER_MESSAGE is found - fi -} - -############################################################################### -## Main -## -## Modifications: -## Vailin Choi; July 2013 -## Add waiting of message file before launching the reader(s). -## Due to the implementation of file locking, coordination -## is needed in file opening for the writer/reader tests -## to proceed as expected. -## -############################################################################### - -# Check to see if the VFD specified by the HDF5_DRIVER environment variable -# supports SWMR. -$utils_testdir/swmr_check_compat_vfd -rc=$? -if [ $rc -ne 0 ] ; then - echo - echo "The VFD specified by the HDF5_DRIVER environment variable" - echo "does not support SWMR." - echo - echo "SWMR acceptance tests skipped" - echo - exit 0 -fi - -# Parse options (none accepted at this time) -while [ $# -gt 0 ]; do - case "$1" in - *) # unknown option - echo "$0: Unknown option ($1)" - exit 1 - ;; - esac -done - -# HDF5 has several tests that create and delete signal files to communicate -# between processes, and it seems that even though the names of the files are -# different, occasionally the wrong file is deleted, interrupting the flow of -# the test. Running each of these tests in its own directory should eliminate -# the problem. -mkdir swmr_test -for FILE in swmr*; do - case "$FILE" in - *.o) continue ;; ## don't copy the .o files - esac - if test -f "$FILE" ; then - cp $FILE swmr_test - fi -done - -# With the --disable-shared option, swmr program files are built in the test -# directory, otherwise they are in test/.libs with a corresponding wrapper -# script in the test directory. The programs or wrapper scripts in test should -# always be copied, swmr files in .libs should be copied only if they exists. -if [ -f .libs/swmr ]; then - mkdir swmr_test/.libs - for FILE in .libs/swmr*; do - case "$FILE" in - *.o) continue ;; ## don't copy the .o files - esac - if test -f "$FILE" ; then - cp $FILE swmr_test/.libs - fi - done -fi - -cd swmr_test - - -# Loop over index types -for index_type in "-i ea" "-i b2" -do - # Try with and without compression - for compress in "" "-c 5" - do - echo - echo "*******************************************************************************" - echo "** Loop testing parameters: $index_type $compress" - echo "*******************************************************************************" - echo - echo - echo "###############################################################################" - echo "## Generator test" - echo "###############################################################################" - # Launch the Generator without SWMR_WRITE - echo launch the swmr_generator - $testdir/swmr_generator $compress $index_type - if test $? -ne 0; then - echo generator had error - nerrors=`expr $nerrors + 1` - fi - - # Launch the Generator with SWMR_WRITE - echo launch the swmr_generator with SWMR_WRITE - $testdir/swmr_generator -s $compress $index_type - if test $? -ne 0; then - echo generator had error - nerrors=`expr $nerrors + 1` - fi - - # Check for error and exit if one occurred - $DPRINT nerrors=$nerrors - if test $nerrors -ne 0 ; then - echo "SWMR tests failed with $nerrors errors." - exit 1 - fi - - echo - echo "###############################################################################" - echo "## Use H5Fstart_swmr_write() to enable SWMR writing mode" - echo "###############################################################################" - - # Remove any possible writer message file before launching writer - rm -f $WRITER_MESSAGE - # - # Launch the Writer - echo launch the swmr_start_writer - seed="" # Put -r command here - $testdir/swmr_start_write $compress $index_type $Nrecords $seed 2>&1 |tee swmr_writer.out & - pid_writer=$! - $DPRINT pid_writer=$pid_writer - - # Wait for message from writer process before starting reader(s) - WAIT_MESSAGE $WRITER_MESSAGE - - # - # Launch the Readers - #declare -a seeds=( ... ) - echo launch $Nreaders swmr_readers - pid_readers="" - n=0 - while [ $n -lt $Nreaders ]; do - #seed="-r ${seeds[$n]}" - seed="" - $testdir/swmr_reader $Nsecs_add $seed 2>&1 |tee swmr_reader.out.$n & - pid_readers="$pid_readers $!" - n=`expr $n + 1` - done - $DPRINT pid_readers=$pid_readers - $IFDEBUG ps - - # Collect exit code of the readers first because they usually finish - # before the writer. - for xpid in $pid_readers; do - $DPRINT checked reader $xpid - wait $xpid - if test $? -ne 0; then - echo reader had error - nerrors=`expr $nerrors + 1` - fi - done - - # Collect exit code of the writer - $DPRINT checked writer $pid_writer - wait $pid_writer - if test $? -ne 0; then - echo writer had error - nerrors=`expr $nerrors + 1` - fi - - # Check for error and exit if one occurred - $DPRINT nerrors=$nerrors - if test $nerrors -ne 0 ; then - echo "SWMR tests failed with $nerrors errors." - echo "(Writer and reader output preserved)" - exit 1 - fi - - # Clean up output files - rm -f swmr_writer.out - rm -f swmr_reader.out.* - - echo - echo "###############################################################################" - echo "## Writer test - test expanding the dataset" - echo "###############################################################################" - - # Launch the Generator - echo launch the swmr_generator - $testdir/swmr_generator -s $compress $index_type - if test $? -ne 0; then - echo generator had error - nerrors=`expr $nerrors + 1` - fi - - # Remove any possible writer message file before launching writer - rm -f $WRITER_MESSAGE - # - # Launch the Writer - echo launch the swmr_writer - seed="" # Put -r command here - $testdir/swmr_writer -o $Nrecords $seed 2>&1 |tee swmr_writer.out & - pid_writer=$! - $DPRINT pid_writer=$pid_writer - - # Wait for message from writer process before starting reader(s) - WAIT_MESSAGE $WRITER_MESSAGE - # - # Launch the Readers - #declare -a seeds=( ... ) - echo launch $Nreaders swmr_readers - pid_readers="" - n=0 - while [ $n -lt $Nreaders ]; do - #seed="-r ${seeds[$n]}" - seed="" - $testdir/swmr_reader $Nsecs_add $seed 2>&1 |tee swmr_reader.out.$n & - pid_readers="$pid_readers $!" - n=`expr $n + 1` - done - $DPRINT pid_readers=$pid_readers - $IFDEBUG ps - - # Collect exit code of the readers first because they usually finish - # before the writer. - for xpid in $pid_readers; do - $DPRINT checked reader $xpid - wait $xpid - if test $? -ne 0; then - echo reader had error - nerrors=`expr $nerrors + 1` - fi - done - - # Collect exit code of the writer - $DPRINT checked writer $pid_writer - wait $pid_writer - if test $? -ne 0; then - echo writer had error - nerrors=`expr $nerrors + 1` - fi - - # Check for error and exit if one occurred - $DPRINT nerrors=$nerrors - if test $nerrors -ne 0 ; then - echo "SWMR tests failed with $nerrors errors." - echo "(Writer and reader output preserved)" - exit 1 - fi - - # Clean up output files - rm -f swmr_writer.out - rm -f swmr_reader.out.* - - echo - echo "###############################################################################" - echo "## Remove test - test shrinking the dataset" - echo "###############################################################################" - - # Remove any possible writer message file before launching writer - rm -f $WRITER_MESSAGE - # Launch the Remove Writer - echo launch the swmr_remove_writer - seed="" # Put -r command here - $testdir/swmr_remove_writer -o $Nrecs_rem $seed 2>&1 |tee swmr_writer.out & - pid_writer=$! - $DPRINT pid_writer=$pid_writer - - # Wait for message from writer process before starting reader(s) - WAIT_MESSAGE $WRITER_MESSAGE - # - # Launch the Remove Readers - #declare -a seeds=( ... ) - n=0 - pid_readers="" - echo launch $Nreaders swmr_remove_readers - while [ $n -lt $Nreaders ]; do - #seed="-r ${seeds[$n]}" - seed="" - $testdir/swmr_remove_reader $Nsecs_rem $seed 2>&1 |tee swmr_reader.out.$n & - pid_readers="$pid_readers $!" - n=`expr $n + 1` - done - $DPRINT pid_readers=$pid_readers - $IFDEBUG ps - - # Collect exit code of the readers first because they usually finish - # before the writer. - for xpid in $pid_readers; do - $DPRINT checked reader $xpid - wait $xpid - if test $? -ne 0; then - echo reader had error - nerrors=`expr $nerrors + 1` - fi - done - - # Collect exit code of the writer - $DPRINT checked writer $pid_writer - wait $pid_writer - if test $? -ne 0; then - echo writer had error - nerrors=`expr $nerrors + 1` - fi - - # Check for error and exit if one occurred - $DPRINT nerrors=$nerrors - if test $nerrors -ne 0 ; then - echo "SWMR tests failed with $nerrors errors." - echo "(Writer and reader output preserved)" - exit 1 - fi - - # Clean up output files - rm -f swmr_writer.out - rm -f swmr_reader.out.* - - echo - echo "###############################################################################" - echo "## Add/remove test - randomly grow or shrink the dataset" - echo "###############################################################################" - - # Launch the Generator - echo launch the swmr_generator - $testdir/swmr_generator $compress $index_type - if test $? -ne 0; then - echo generator had error - nerrors=`expr $nerrors + 1` - fi - - # Launch the Writer (not in parallel - just to rebuild the datasets) - echo launch the swmr_writer - seed="" # Put -r command here - $testdir/swmr_writer $Nrecords $seed - if test $? -ne 0; then - echo writer had error - nerrors=`expr $nerrors + 1` - fi - - # Remove any possible writer message file before launching writer - rm -f $WRITER_MESSAGE - # - # Launch the Add/Remove Writer - echo launch the swmr_addrem_writer - seed="" # Put -r command here - $testdir/swmr_addrem_writer $Nrecords $seed 2>&1 |tee swmr_writer.out & - pid_writer=$! - $DPRINT pid_writer=$pid_writer - - # Wait for message from writer process before starting reader(s) - WAIT_MESSAGE $WRITER_MESSAGE - # - # Launch the Add/Remove Readers - #declare -a seeds=( ... ) - n=0 - pid_readers="" - echo launch $Nreaders swmr_remove_readers - while [ $n -lt $Nreaders ]; do - #seed="-r ${seeds[$n]}" - seed="" - $testdir/swmr_remove_reader $Nsecs_addrem $seed 2>&1 |tee swmr_reader.out.$n & - pid_readers="$pid_readers $!" - n=`expr $n + 1` - done - $DPRINT pid_readers=$pid_readers - $IFDEBUG ps - - # Collect exit code of the readers first because they usually finish - # before the writer. - for xpid in $pid_readers; do - $DPRINT checked reader $xpid - wait $xpid - if test $? -ne 0; then - echo reader had error - nerrors=`expr $nerrors + 1` - fi - done - - # Collect exit code of the writer - $DPRINT checked writer $pid_writer - wait $pid_writer - if test $? -ne 0; then - echo writer had error - nerrors=`expr $nerrors + 1` - fi - - # Check for error and exit if one occurred - $DPRINT nerrors=$nerrors - if test $nerrors -ne 0 ; then - echo "SWMR tests failed with $nerrors errors." - echo "(Writer and reader output preserved)" - exit 1 - fi - - # Clean up output files - rm -f swmr_writer.out - rm -f swmr_reader.out.* - - echo - echo "###############################################################################" - echo "## Sparse writer test - test writing to random locations in the dataset" - echo "###############################################################################" - - # Launch the Generator - # NOTE: Random seed is shared between readers and writers and is - # created by the generator. - echo launch the swmr_generator - seed="" # Put -r command here - $testdir/swmr_generator $compress $index_type $seed - if test $? -ne 0; then - echo generator had error - nerrors=`expr $nerrors + 1` - fi - - # Remove any possible writer message file before launching writer - rm -f $WRITER_MESSAGE - # Launch the Sparse writer - echo launch the swmr_sparse_writer - nice -n 20 $testdir/swmr_sparse_writer $Nrecs_spa 2>&1 |tee swmr_writer.out & - pid_writer=$! - $DPRINT pid_writer=$pid_writer - - # Wait for message from writer process before starting reader(s) - WAIT_MESSAGE $WRITER_MESSAGE - # - # Launch the Sparse readers - n=0 - pid_readers="" - echo launch $Nrdrs_spa swmr_sparse_readers - while [ $n -lt $Nrdrs_spa ]; do - # The sparse reader spits out a LOT of data so it's set to 'quiet' - $testdir/swmr_sparse_reader -q $Nrecs_spa 2>&1 |tee swmr_reader.out.$n & - pid_readers="$pid_readers $!" - n=`expr $n + 1` - done - $DPRINT pid_readers=$pid_readers - $IFDEBUG ps - - # Collect exit code of the writer - $DPRINT checked writer $pid_writer - wait $pid_writer - if test $? -ne 0; then - echo writer had error - nerrors=`expr $nerrors + 1` - fi - - # Collect exit code of the readers - for xpid in $pid_readers; do - $DPRINT checked reader $xpid - wait $xpid - if test $? -ne 0; then - echo reader had error - nerrors=`expr $nerrors + 1` - fi - done - - # Check for error and exit if one occurred - $DPRINT nerrors=$nerrors - if test $nerrors -ne 0 ; then - echo "SWMR tests failed with $nerrors errors." - echo "(Writer and reader output preserved)" - exit 1 - fi - - # Clean up output files - rm -f swmr_writer.out - rm -f swmr_reader.out.* - done -done - -############################################################################### -## Report and exit -############################################################################### -cd .. -$DPRINT nerrors=$nerrors -if test $nerrors -eq 0 ; then - echo "SWMR tests passed." - if test -z "$HDF5_NOCLEANUP"; then - # delete the test directory - rm -rf swmr_test - fi - exit 0 -else - echo "SWMR tests failed with $nerrors errors." - exit 1 -fi - diff --git a/test/testvds_env.sh.in b/test/testvds_env.sh.in deleted file mode 100644 index 97518f1..0000000 --- a/test/testvds_env.sh.in +++ /dev/null @@ -1,43 +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. -# -# Test for external file with environment variable: HDF5_VDS_PREFIX - -srcdir=@srcdir@ - -nerrors=0 - -############################################################################## -############################################################################## -### T H E T E S T S ### -############################################################################## -############################################################################## - -# test for VDS with HDF5_VDS_PREFIX -echo "Testing basic virtual dataset I/O via H5Pset_vds_prefix(): all selection with ENV prefix" -TEST_NAME=vds_env # The test name -TEST_BIN=`pwd`/$TEST_NAME # The path of the test binary -ENVCMD="env HDF5_VDS_PREFIX=\${ORIGIN}/tmp_vds_env" # Set the environment variable & value -UNENVCMD="unset HDF5_VDS_PREFIX" # Unset the environment variable & value -# -# Run the test -# echo "$ENVCMD $RUNSERIAL $TEST_BIN" -$ENVCMD $RUNSERIAL $TEST_BIN -exitcode=$? -if [ $exitcode -eq 0 ]; then - echo "Test prefix for HDF5_VDS_PREFIX PASSED" -else - nerrors="`expr $nerrors + 1`" - echo "***Error encountered for HDF5_VDS_PREFIX test***" -fi -$UNENVCMD -exit $nerrors diff --git a/test/testvdsswmr.sh.in b/test/testvdsswmr.sh.in deleted file mode 100644 index 6cdecca..0000000 --- a/test/testvdsswmr.sh.in +++ /dev/null @@ -1,232 +0,0 @@ -#! /bin/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. -# -# Tests for the swmr feature using virtual datasets. -# -# Created: -# Dana Robinson, November 2015 - -srcdir=@srcdir@ -utils_testdir=@abs_top_builddir@/@H5_UTILS_TEST_BUILDDIR@ -testdir=@abs_top_builddir@/@H5_TEST_BUILDDIR@ - -############################################################################### -## test parameters -############################################################################### - -Nwriters=6 # number of writers (1 per source dataset) -Nreaders=5 # number of readers to launch -nerrors=0 - -############################################################################### -## definitions for message file to coordinate test runs -############################################################################### -WRITER_MESSAGE=SWMR_WRITER_MESSAGE # The message file created by writer that the open is complete - # This should be the same as the define in "test/swmr_common.h" -MESSAGE_TIMEOUT=300 # Message timeout length in secs - # This should be the same as the define in "test/h5test.h" - -############################################################################### -## short hands and function definitions -############################################################################### -DPRINT=: # Set to "echo Debug:" for debugging printing, - # else ":" for noop. -IFDEBUG=: # Set to null to turn on debugging, else ":" for noop. - -# 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' -} - -# To wait for the writer message file or till the maximum # of seconds is reached -# $1 is the message file to wait for -# This performs similar function as the routine h5_wait_message() in test/h5test.c -WAIT_MESSAGE() { - message=$1 # Get the name of the message file to wait for - t0=`date +%s` # Get current time in seconds - difft=0 # Initialize the time difference - mexist=0 # Indicate whether the message file is found - while [ $difft -lt $MESSAGE_TIMEOUT ] ; # Loop till message times out - do - t1=`date +%s` # Get current time in seconds - difft=`expr $t1 - $t0` # Calculate the time difference - if [ -e $message ]; then # If message file is found: - mexist=1 # indicate the message file is found - rm $message # remove the message file - break # get out of the while loop - fi - done; - if test $mexist -eq 0; then - # Issue warning that the writer message file is not found, continue with launching the reader(s) - echo warning: $WRITER_MESSAGE is not found after waiting $MESSAGE_TIMEOUT seconds - else - echo $WRITER_MESSAGE is found - fi -} - -############################################################################### -## Main -############################################################################### - -# Check to see if the VFD specified by the HDF5_DRIVER environment variable -# supports SWMR. -$utils_testdir/swmr_check_compat_vfd -rc=$? -if [ $rc -ne 0 ] ; then - echo - echo "The VFD specified by the HDF5_DRIVER environment variable" - echo "does not support SWMR." - echo - echo "SWMR acceptance tests skipped" - echo - exit 0 -fi - -# Parse options (none accepted at this time) -while [ $# -gt 0 ]; do - case "$1" in - *) # unknown option - echo "$0: Unknown option ($1)" - exit 1 - ;; - esac -done - -# HDF5 has several tests that create and delete signal files to communicate -# between processes, and it seems that even though the names of the files are -# different, occasionally the wrong file is deleted, interrupting the flow of -# the test. Running each of these tests in its own directory should eliminate -# the problem. -mkdir vds_swmr_test -for FILE in vds_swmr*; do - case "$FILE" in - *.o) continue ;; ## don't copy the .o files - esac - if test -f "$FILE" ; then - cp $FILE vds_swmr_test - fi -done - -# With the --disable-shared option, swmr program files are built in the test -# directory, otherwise they are in test/.libs with a corresponding wrapper -# script in the test directory. The programs or wrapper scripts in test should -# always be copied, swmr files in .libs should be copied only if they exists. -if [ -f .libs/vds_swmr_writer ]; then - mkdir vds_swmr_test/.libs - for FILE in .libs/vds_swmr*; do - case "$FILE" in - *.o) continue ;; ## don't copy the .o files - esac - if test -f "$FILE" ; then - cp $FILE vds_swmr_test/.libs - fi - done -fi - -cd vds_swmr_test - - -echo -echo "###############################################################################" -echo "## Basic VDS SWMR test - writing to a tiled plane" -echo "###############################################################################" - -# Launch the file generator -echo launch the generator -$testdir/vds_swmr_gen -if test $? -ne 0; then - echo generator had error - nerrors=`expr $nerrors + 1` -fi - -# Check for error and exit if one occurred -$DPRINT nerrors=$nerrors -if test $nerrors -ne 0 ; then - echo "VDS SWMR tests failed with $nerrors errors." - exit 1 -fi - -# Launch the writers -echo "launch the $Nwriters SWMR VDS writers (1 per source)" -pid_writers="" -n=0 -while [ $n -lt $Nwriters ]; do - $testdir/vds_swmr_writer $n & - pid_writers="$pid_writers $!" - n=`expr $n + 1` -done -$DPRINT pid_writers=$pid_writers -$IFDEBUG ps - -# Sleep to ensure that the writers have started -sleep 3 - -# Launch the readers -echo launch $Nreaders SWMR readers -pid_readers="" -n=0 -while [ $n -lt $Nreaders ]; do - $testdir/vds_swmr_reader & - pid_readers="$pid_readers $!" - n=`expr $n + 1` -done -$DPRINT pid_readers=$pid_readers -$IFDEBUG ps - -# Collect exit code of the writers -for xpid in $pid_writers; do - $DPRINT checked writer $xpid - wait $xpid - if test $? -ne 0; then - echo writer had error - nerrors=`expr $nerrors + 1` - fi -done - -# Collect exit code of the readers -# (they usually finish after the writers) -for xpid in $pid_readers; do - $DPRINT checked reader $xpid - wait $xpid - if test $? -ne 0; then - echo reader had error - nerrors=`expr $nerrors + 1` - fi -done - -# Check for error and exit if one occurred -$DPRINT nerrors=$nerrors -if test $nerrors -ne 0 ; then - echo "VDS SWMR tests failed with $nerrors errors." - exit 1 -fi - -############################################################################### -## Report and exit -############################################################################### -cd .. -$DPRINT nerrors=$nerrors -if test $nerrors -eq 0 ; then - echo "VDS SWMR tests passed." - if test -z "$HDF5_NOCLEANUP"; then - # delete the test directory - rm -rf vds_swmr_test - fi - exit 0 -else - echo "VDS SWMR tests failed with $nerrors errors." - exit 1 -fi - -- cgit v0.12