summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2016-04-19 19:45:07 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2016-04-19 19:45:07 (GMT)
commitb38491a7c2580661ea7117b093799d49c93e34c7 (patch)
treebd8ea5a2ec4312fb0ab5e15e82babb04cecc7eaa /test
parent32ff3431c7ebc3be08659008f27008e470bf0c8d (diff)
downloadhdf5-b38491a7c2580661ea7117b093799d49c93e34c7.zip
hdf5-b38491a7c2580661ea7117b093799d49c93e34c7.tar.gz
hdf5-b38491a7c2580661ea7117b093799d49c93e34c7.tar.bz2
[svn-r29748] HDFFV-9770: Fix h5watch and CMake for HL.
Convert CMake sources tags from _SRCS to _SOURCES(closer match to Makefile).
Diffstat (limited to 'test')
-rw-r--r--test/CMakeLists.txt298
-rw-r--r--test/CMakeTests.cmake537
-rw-r--r--test/atomic_reader.c332
-rw-r--r--test/atomic_writer.c233
4 files changed, 708 insertions, 692 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 2997fe4..aa05983 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -16,17 +16,20 @@ INCLUDE_DIRECTORIES (${CMAKE_CURRENT_BINARY_DIR})
#-----------------------------------------------------------------------------
# Define Test Library Sources
#-----------------------------------------------------------------------------
-set (TEST_LIB_SRCS
+set (TEST_LIB_SOURCES
${HDF5_TEST_SOURCE_DIR}/h5test.c
${HDF5_TEST_SOURCE_DIR}/testframe.c
${HDF5_TEST_SOURCE_DIR}/cache_common.c
+ ${HDF5_TEST_SOURCE_DIR}/swmr_common.c
)
set (TEST_LIB_HEADERS
${HDF5_TEST_SOURCE_DIR}/h5test.h
+ ${HDF5_TEST_SOURCE_DIR}/cache_common.h
+ ${HDF5_TEST_SOURCE_DIR}/swmr_common.h
)
-add_library (${HDF5_TEST_LIB_TARGET} STATIC ${TEST_LIB_SRCS} ${TEST_LIB_HEADERS})
+add_library (${HDF5_TEST_LIB_TARGET} STATIC ${TEST_LIB_SOURCES} ${TEST_LIB_HEADERS})
TARGET_C_PROPERTIES (${HDF5_TEST_LIB_TARGET} STATIC " " " ")
if (MSVC)
target_link_libraries (${HDF5_TEST_LIB_TARGET} "ws2_32.lib")
@@ -42,7 +45,7 @@ set_target_properties (${HDF5_TEST_LIB_TARGET} PROPERTIES
)
if (BUILD_SHARED_LIBS)
- add_library (${HDF5_TEST_LIBSH_TARGET} SHARED ${TEST_LIB_SRCS} ${TEST_LIB_HEADERS})
+ add_library (${HDF5_TEST_LIBSH_TARGET} SHARED ${TEST_LIB_SOURCES} ${TEST_LIB_HEADERS})
TARGET_C_PROPERTIES (${HDF5_TEST_LIBSH_TARGET} SHARED " " " ")
if (MSVC)
target_link_libraries (${HDF5_TEST_LIBSH_TARGET} "ws2_32.lib")
@@ -67,85 +70,6 @@ if (BUILD_SHARED_LIBS)
endif (BUILD_SHARED_LIBS)
#-----------------------------------------------------------------------------
-# Build SWMR test programs
-#
-# These programs are currently not used in CMake tests but we build them
-# here anyway for manual testing and to ensure that the code compiles
-# on all platforms.
-#-----------------------------------------------------------------------------
-MACRO (ADD_H5_SWMR_EXE file)
- add_executable (${file}
- ${HDF5_TEST_SOURCE_DIR}/${file}.c
- ${HDF5_TEST_SOURCE_DIR}/swmr_common.c
- ${HDF5_TEST_SOURCE_DIR}/swmr_common.h
- )
- TARGET_NAMING (${file} STATIC)
- TARGET_C_PROPERTIES (${file} STATIC " " " ")
- target_link_libraries (${file} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET})
- set_target_properties (${file} PROPERTIES FOLDER test)
- if (BUILD_SHARED_LIBS)
- add_executable (${file}-shared
- ${HDF5_TEST_SOURCE_DIR}/${file}.c
- ${HDF5_TEST_SOURCE_DIR}/swmr_common.c
- ${HDF5_TEST_SOURCE_DIR}/swmr_common.h
- )
- TARGET_NAMING (${file}-shared SHARED)
- TARGET_C_PROPERTIES (${file}-shared SHARED " " " ")
- target_link_libraries (${file}-shared ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
- set_target_properties (${file}-shared PROPERTIES FOLDER test)
- endif (BUILD_SHARED_LIBS)
-ENDMACRO (ADD_H5_SWMR_EXE file)
-
-set (H5_SWMR_TESTS
- swmr_addrem_writer
- swmr_check_compat_vfd
- swmr_generator
- swmr_reader
- swmr_remove_reader
- swmr_remove_writer
- swmr_sparse_reader
- swmr_sparse_writer
- swmr_start_write
- swmr_writer
-)
-
-foreach (test ${H5_SWMR_TESTS})
- ADD_H5_SWMR_EXE(${test})
-endforeach (test ${H5_SWMR_TESTS})
-
-#-----------------------------------------------------------------------------
-# Build VDS SWMR test programs
-#
-# These programs are currently not used in CMake tests but we build them
-# here anyway for manual testing and to ensure that the code compiles
-# on all platforms.
-#-----------------------------------------------------------------------------
-MACRO (ADD_H5_VDS_SWMR_EXE file)
- add_executable (${file} ${HDF5_TEST_SOURCE_DIR}/${file}.c)
- TARGET_NAMING (${file} STATIC)
- TARGET_C_PROPERTIES (${file} STATIC " " " ")
- target_link_libraries (${file} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET})
- set_target_properties (${file} PROPERTIES FOLDER test)
- if (BUILD_SHARED_LIBS)
- add_executable (${file}-shared ${HDF5_TEST_SOURCE_DIR}/${file}.c)
- TARGET_NAMING (${file}-shared SHARED)
- TARGET_C_PROPERTIES (${file}-shared SHARED " " " ")
- target_link_libraries (${file}-shared ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
- set_target_properties (${file}-shared PROPERTIES FOLDER test)
- endif (BUILD_SHARED_LIBS)
-ENDMACRO (ADD_H5_VDS_SWMR_EXE file)
-
-set (H5_VDS_SWMR_TESTS
- vds_swmr_gen
- vds_swmr_reader
- vds_swmr_writer
-)
-
-foreach (test ${H5_VDS_SWMR_TESTS})
- ADD_H5_VDS_SWMR_EXE(${test})
-endforeach (test ${H5_VDS_SWMR_TESTS})
-
-#-----------------------------------------------------------------------------
# If plugin library tests can be tested
#-----------------------------------------------------------------------------
# make plugins dir
@@ -215,7 +139,7 @@ endforeach (test ${H5_VDS_SWMR_TESTS})
)
endforeach (test_lib ${TEST2_PLUGIN_LIBS})
-set (testhdf5_SRCS
+set (testhdf5_SOURCES
${HDF5_TEST_SOURCE_DIR}/testhdf5.c
${HDF5_TEST_SOURCE_DIR}/tarray.c
${HDF5_TEST_SOURCE_DIR}/tattr.c
@@ -244,13 +168,13 @@ set (testhdf5_SRCS
)
#-- Adding test for testhdf5
-add_executable (testhdf5 ${testhdf5_SRCS})
+add_executable (testhdf5 ${testhdf5_SOURCES})
TARGET_NAMING (testhdf5 STATIC)
TARGET_C_PROPERTIES (testhdf5 STATIC " " " ")
target_link_libraries (testhdf5 ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET})
set_target_properties (testhdf5 PROPERTIES FOLDER test)
if (BUILD_SHARED_LIBS)
- add_executable (testhdf5-shared ${testhdf5_SRCS})
+ add_executable (testhdf5-shared ${testhdf5_SOURCES})
TARGET_NAMING (testhdf5-shared SHARED)
TARGET_C_PROPERTIES (testhdf5-shared SHARED " " " ")
target_link_libraries (testhdf5-shared ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
@@ -273,21 +197,27 @@ MACRO (ADD_H5_EXE file)
ENDMACRO (ADD_H5_EXE file)
set (H5_TESTS
- accum
+ #testhdf5
+ cache
+ cache_api
+ cache_tagging
lheap
ohdr
stab
gheap
- cache_logging
- cork
+ farray
+ earray
+ btree2
+ fheap
pool
+ accum
+ #hyperslab
istore
bittests
dt_arith
dtypes
dsets
cmpd_dset
- chunk_info
filter_fail
extend
external
@@ -295,6 +225,7 @@ set (H5_TESTS
objcopy
links
unlink
+ twriteorder
big
mtime
fillval
@@ -304,7 +235,9 @@ set (H5_TESTS
app_ref
enum
set_extent
- space_overflow
+ #ttsafe
+ enc_dec_plist
+ enc_dec_plist_cross_platform
getname
vfd
ntypes
@@ -315,16 +248,10 @@ set (H5_TESTS
freespace
mf
vds
- farray
- earray
- btree2
- fheap
- tcheck_version
- testmeta
file_image
- enc_dec_plist
- enc_dec_plist_cross_platform
unregister
+ cache_logging
+ cork
swmr
)
@@ -332,54 +259,39 @@ foreach (test ${H5_TESTS})
ADD_H5_EXE(${test})
endforeach (test ${H5_TESTS})
+set (H5_SWMR_TESTS
+ swmr_addrem_writer
+ swmr_check_compat_vfd
+ swmr_generator
+ swmr_reader
+ swmr_remove_reader
+ swmr_remove_writer
+ swmr_sparse_reader
+ swmr_sparse_writer
+ swmr_start_write
+ swmr_writer
+)
+
+foreach (test ${H5_SWMR_TESTS})
+ ADD_H5_EXE(${test})
+endforeach (test ${H5_SWMR_TESTS})
+
+set (H5_VDS_SWMR_TESTS
+ vds_swmr_gen
+ vds_swmr_reader
+ vds_swmr_writer
+)
+
+foreach (test ${H5_VDS_SWMR_TESTS})
+ ADD_H5_EXE(${test})
+endforeach (test ${H5_VDS_SWMR_TESTS})
+
##############################################################################
##############################################################################
### A D D I T I O N A L T E S T S ###
##############################################################################
##############################################################################
-#-- Adding test for cache
-add_executable (cache ${HDF5_TEST_SOURCE_DIR}/cache.c ${HDF5_TEST_SOURCE_DIR}/cache_common.c)
-TARGET_NAMING (cache STATIC)
-TARGET_C_PROPERTIES (cache STATIC " " " ")
-target_link_libraries (cache ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
-set_target_properties (cache PROPERTIES FOLDER test)
-if (BUILD_SHARED_LIBS)
- add_executable (cache-shared ${HDF5_TEST_SOURCE_DIR}/cache.c ${HDF5_TEST_SOURCE_DIR}/cache_common.c)
- TARGET_NAMING (cache-shared SHARED)
- TARGET_C_PROPERTIES (cache-shared SHARED " " " ")
- target_link_libraries (cache-shared ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
- set_target_properties (cache-shared PROPERTIES FOLDER test)
-endif (BUILD_SHARED_LIBS)
-
-#-- Adding test for cache_api
-add_executable (cache_api ${HDF5_TEST_SOURCE_DIR}/cache_api.c ${HDF5_TEST_SOURCE_DIR}/cache_common.c)
-TARGET_NAMING (cache_api STATIC)
-TARGET_C_PROPERTIES (cache_api STATIC " " " ")
-target_link_libraries (cache_api ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
-set_target_properties (cache_api PROPERTIES FOLDER test)
-if (BUILD_SHARED_LIBS)
- add_executable (cache_api-shared ${HDF5_TEST_SOURCE_DIR}/cache_api.c ${HDF5_TEST_SOURCE_DIR}/cache_common.c)
- TARGET_NAMING (cache_api-shared SHARED)
- TARGET_C_PROPERTIES (cache_api-shared SHARED " " " ")
- target_link_libraries (cache_api-shared ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
- set_target_properties (cache_api-shared PROPERTIES FOLDER test)
-endif (BUILD_SHARED_LIBS)
-
-#-- Adding test for cache_tagging
-add_executable (cache_tagging ${HDF5_TEST_SOURCE_DIR}/cache_tagging.c ${HDF5_TEST_SOURCE_DIR}/cache_common.c)
-TARGET_NAMING (cache_tagging STATIC)
-TARGET_C_PROPERTIES (cache_tagging STATIC " " " ")
-target_link_libraries (cache_tagging ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
-set_target_properties (cache_tagging PROPERTIES FOLDER test)
-if (BUILD_SHARED_LIBS)
- add_executable (cache_tagging-shared ${HDF5_TEST_SOURCE_DIR}/cache_tagging.c ${HDF5_TEST_SOURCE_DIR}/cache_common.c)
- TARGET_NAMING (cache_tagging-shared SHARED)
- TARGET_C_PROPERTIES (cache_tagging-shared SHARED " " " ")
- target_link_libraries (cache_tagging-shared ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
- set_target_properties (cache_tagging-shared PROPERTIES FOLDER test)
-endif (BUILD_SHARED_LIBS)
-
#-- Adding test for hyperslab
add_executable (hyperslab ${HDF5_TEST_SOURCE_DIR}/hyperslab.c)
TARGET_NAMING (hyperslab STATIC)
@@ -432,49 +344,24 @@ if (BUILD_SHARED_LIBS)
endif (HDF5_ENABLE_THREADSAFE)
endif (BUILD_SHARED_LIBS)
-#-- Adding test for err_compat
-if (HDF5_ENABLE_DEPRECATED_SYMBOLS)
- add_executable (err_compat ${HDF5_TEST_SOURCE_DIR}/err_compat.c)
- TARGET_NAMING (err_compat STATIC)
- TARGET_C_PROPERTIES (err_compat STATIC " " " ")
- target_link_libraries (err_compat ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
- set_target_properties (err_compat PROPERTIES FOLDER test)
- if (BUILD_SHARED_LIBS)
- add_executable (err_compat-shared ${HDF5_TEST_SOURCE_DIR}/err_compat.c)
- TARGET_NAMING (err_compat-shared SHARED)
- TARGET_C_PROPERTIES (err_compat-shared SHARED " " " ")
- target_link_libraries (err_compat-shared ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
- set_target_properties (err_compat-shared PROPERTIES FOLDER test)
- endif (BUILD_SHARED_LIBS)
-endif (HDF5_ENABLE_DEPRECATED_SYMBOLS)
-
-#-- Adding test for error_test
-add_executable (error_test ${HDF5_TEST_SOURCE_DIR}/error_test.c)
-TARGET_NAMING (error_test STATIC)
-TARGET_C_PROPERTIES (error_test STATIC " " " ")
-target_link_libraries (error_test ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
-set_target_properties (error_test PROPERTIES FOLDER test)
-if (BUILD_SHARED_LIBS)
- add_executable (error_test-shared ${HDF5_TEST_SOURCE_DIR}/error_test.c)
- TARGET_NAMING (error_test-shared SHARED)
- TARGET_C_PROPERTIES (error_test-shared SHARED " " " ")
- target_link_libraries (error_test-shared ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
- set_target_properties (error_test-shared PROPERTIES FOLDER test)
-endif (BUILD_SHARED_LIBS)
+set (H5_CHECK_TESTS
+ error_test
+ err_compat
+ tcheck_version
+ testmeta
+ #accum_swmr_reader
+ atomic_writer
+ atomic_reader
+ links_env
+ flushrefresh
+ #use_append_chunk
+ #use_append_mchunks
+ #use_disable_mdc_flushes
+)
-#-- Adding test for links_env
-add_executable (links_env ${HDF5_TEST_SOURCE_DIR}/links_env.c)
-TARGET_NAMING (links_env STATIC)
-TARGET_C_PROPERTIES (links_env STATIC " " " ")
-target_link_libraries (links_env ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
-set_target_properties (links_env PROPERTIES FOLDER test)
-if (BUILD_SHARED_LIBS)
- add_executable (links_env-shared ${HDF5_TEST_SOURCE_DIR}/links_env.c)
- TARGET_NAMING (links_env-shared SHARED)
- TARGET_C_PROPERTIES (links_env-shared SHARED " " " ")
- target_link_libraries (links_env-shared ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
- set_target_properties (links_env-shared PROPERTIES FOLDER test)
-endif (BUILD_SHARED_LIBS)
+foreach (test ${H5_CHECK_TESTS})
+ ADD_H5_EXE(${test})
+endforeach (test ${H5_CHECK_TESTS})
#-- Adding test for accum_swmr_reader
# This has to be copied to the test directory for execve() to find it
@@ -488,7 +375,7 @@ set_target_properties (accum_swmr_reader PROPERTIES FOLDER test)
#-- Set accum dependencies
set_target_properties (accum PROPERTIES DEPENDS accum_swmr_reader)
if (BUILD_SHARED_LIBS)
- set_target_properties (accum-shared PROPERTIES DEPENDS accum_swmr_reader-shared)
+ set_target_properties (accum-shared PROPERTIES DEPENDS accum_swmr_reader)
endif (BUILD_SHARED_LIBS)
#-- Adding test for libinfo
@@ -520,4 +407,49 @@ else (BUILD_SHARED_LIBS)
set_target_properties (plugin PROPERTIES FOLDER test)
endif (BUILD_SHARED_LIBS)
+##############################################################################
+### U S E C A S E S T E S T S
+##############################################################################
+set (use_append_chunk_SOURCES ${HDF5_TEST_SOURCE_DIR}/use_append_chunk.c ${HDF5_TEST_SOURCE_DIR}/use_common.c)
+add_executable (use_append_chunk ${use_append_chunk_SOURCES})
+TARGET_NAMING (use_append_chunk STATIC)
+TARGET_C_PROPERTIES (use_append_chunk STATIC " " " ")
+target_link_libraries (use_append_chunk ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
+set_target_properties (use_append_chunk PROPERTIES FOLDER test)
+if (BUILD_SHARED_LIBS)
+ add_executable (use_append_chunk-shared ${use_append_chunk_SOURCES})
+ TARGET_NAMING (use_append_chunk-shared SHARED)
+ TARGET_C_PROPERTIES (use_append_chunk-shared SHARED " " " ")
+ target_link_libraries (use_append_chunk-shared ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
+ set_target_properties (use_append_chunk-shared PROPERTIES FOLDER test)
+endif (BUILD_SHARED_LIBS)
+
+set (use_append_mchunks_SOURCES ${HDF5_TEST_SOURCE_DIR}/use_append_mchunks.c ${HDF5_TEST_SOURCE_DIR}/use_common.c)
+add_executable (use_append_mchunks ${use_append_mchunks_SOURCES})
+TARGET_NAMING (use_append_mchunks STATIC)
+TARGET_C_PROPERTIES (use_append_mchunks STATIC " " " ")
+target_link_libraries (use_append_mchunks ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
+set_target_properties (use_append_mchunks PROPERTIES FOLDER test)
+if (BUILD_SHARED_LIBS)
+ add_executable (use_append_mchunks-shared ${use_append_mchunks_SOURCES})
+ TARGET_NAMING (use_append_mchunks-shared SHARED)
+ TARGET_C_PROPERTIES (use_append_mchunks-shared SHARED " " " ")
+ target_link_libraries (use_append_mchunks-shared ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
+ set_target_properties (use_append_mchunks-shared PROPERTIES FOLDER test)
+endif (BUILD_SHARED_LIBS)
+
+set (use_disable_mdc_flushes_SOURCES ${HDF5_TEST_SOURCE_DIR}/use_disable_mdc_flushes.c)
+add_executable (use_disable_mdc_flushes ${use_disable_mdc_flushes_SOURCES})
+TARGET_NAMING (use_disable_mdc_flushes STATIC)
+TARGET_C_PROPERTIES (use_disable_mdc_flushes STATIC " " " ")
+target_link_libraries (use_disable_mdc_flushes ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
+set_target_properties (use_disable_mdc_flushes PROPERTIES FOLDER test)
+if (BUILD_SHARED_LIBS)
+ add_executable (use_disable_mdc_flushes-shared ${use_disable_mdc_flushes_SOURCES})
+ TARGET_NAMING (use_disable_mdc_flushes-shared SHARED)
+ TARGET_C_PROPERTIES (use_disable_mdc_flushes-shared SHARED " " " ")
+ target_link_libraries (use_disable_mdc_flushes-shared ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
+ set_target_properties (use_disable_mdc_flushes-shared PROPERTIES FOLDER test)
+endif (BUILD_SHARED_LIBS)
+
include (CMakeTests.cmake)
diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake
index fc8fdc3..6f62e9a 100644
--- a/test/CMakeTests.cmake
+++ b/test/CMakeTests.cmake
@@ -252,9 +252,9 @@ set (HDF5_REFERENCE_TEST_FILES
family_v16_00001.h5
family_v16_00002.h5
family_v16_00003.h5
+ file_image_core_test.h5
filespace_1_6.h5
filespace_1_8.h5
- file_image_core_test.h5
fill_old.h5
filter_error.h5
group_old.h5
@@ -417,76 +417,282 @@ endif (HDF5_ENABLE_USING_MEMCHECKER)
##############################################################################
##############################################################################
+set (test_CLEANFILES
+ accum.h5
+ cmpd_dset.h5
+ compact_dataset.h5
+ dataset.h5
+ dset_offset.h5
+ max_compact_dataset.h5
+ simple.h5
+ set_local.h5
+ random_chunks.h5
+ huge_chunks.h5
+ chunk_cache.h5
+ big_chunk.h5
+ chunk_fast.h5
+ chunk_expand.h5
+ chunk_fixed.h5
+ copy_dcpl_newfile.h5
+ partial_chunks.h5
+ layout_extend.h5
+ zero_chunk.h5
+ chunk_single.h5
+ swmr_non_latest.h5
+ earray_hdr_fd.h5
+ farray_hdr_fd.h5
+ bt2_hdr_fd.h5
+ storage_size.h5
+ dls_01_strings.h5
+ extend.h5
+ istore.h5
+ extlinks*.h5
+ frspace.h5
+ links*.h5
+ sys_file1
+ tfile*.h5
+ th5s*.h5
+ lheap.h5
+ fheap.h5
+ ohdr.h5
+ stab.h5
+ extern_*.h5
+ extern_*.raw
+ gheap*.h5
+ dt_arith1
+ dt_arith2
+ links.h5
+ links*.h5
+ extlinks16A00000.h5
+ extlinks16A00001.h5
+ extlinks16A00002.h5
+ extlinks16B-b.h5
+ extlinks16B-g.h5
+ extlinks16B-l.h5
+ extlinks16B-r.h5
+ extlinks16B-s.h5
+ extlinks19B00000.h5
+ extlinks19B00001.h5
+ extlinks19B00002.h5
+ extlinks19B00003.h5
+ extlinks19B00004.h5
+ extlinks19B00005.h5
+ extlinks19B00006.h5
+ extlinks19B00007.h5
+ extlinks19B00008.h5
+ extlinks19B00009.h5
+ extlinks19B00010.h5
+ extlinks19B00011.h5
+ extlinks19B00012.h5
+ extlinks19B00013.h5
+ extlinks19B00014.h5
+ extlinks19B00015.h5
+ extlinks19B00016.h5
+ extlinks19B00017.h5
+ extlinks19B00018.h5
+ extlinks19B00019.h5
+ extlinks19B00020.h5
+ extlinks19B00021.h5
+ extlinks19B00022.h5
+ extlinks19B00023.h5
+ extlinks19B00024.h5
+ extlinks19B00025.h5
+ extlinks19B00026.h5
+ extlinks19B00027.h5
+ extlinks19B00028.h5
+ tmp
+ big.data
+ big*.h5
+ stdio.h5
+ sec2.h5
+ dtypes0.h5
+ dtypes1.h5
+ dtypes2.h5
+ dtypes3.h5
+ dtypes4.h5
+ dtypes5.h5
+ dtypes6.h5
+ dtypes7.h5
+ dtypes8.h5
+ dtypes9.h5
+ dtypes10.h5
+ dt_arith1.h5
+ dt_arith2.h5
+ tattr.h5
+ tselect.h5
+ mtime.h5
+ unlink.h5
+ unicode.h5
+ coord.h5
+ fillval_*.h5
+ fillval.raw
+ mount_*.h5
+ testmeta.h5
+ ttime.h5
+ trefer1.h5
+ trefer2.h5
+ trefer3.h5
+ tvltypes.h5
+ tvlstr.h5
+ tvlstr2.h5
+ twriteorder.dat
+ flush.h5
+ enum1.h5
+ titerate.h5
+ ttsafe.h5
+ tarray1.h5
+ tgenprop.h5
+ tmisc*.h5
+ set_extent1.h5
+ set_extent2.h5
+ set_extent3.h5
+ set_extent4.h5
+ set_extent5.h5
+ ext1.bin
+ ext2.bin
+ getname.h5
+ getname1.h5
+ getname2.h5
+ getname3.h5
+ sec2_file.h5
+ direct_file.h5
+ family_file000*.h5
+ new_family_v16_000*.h5
+ multi_file-r.h5
+ multi_file-s.h5
+ core_file
+ plugin.h5
+ new_move_a.h5
+ new_move_b.h5
+ ntypes.h5
+ dangle.h5
+ error_test.h5
+ err_compat.h5
+ dtransform.h5
+ test_filters.h5
+ get_file_name.h5
+ tstint1.h5
+ tstint2.h5
+ unlink_chunked.h5
+ btree2.h5
+ btree2_tmp.h5
+ objcopy_src.h5
+ objcopy_dst.h5
+ objcopy_ext.dat
+ trefer1.h5
+ trefer2.h5
+ app_ref.h5
+ farray.h5
+ farray_tmp.h5
+ earray.h5
+ earray_tmp.h5
+ efc0.h5
+ efc1.h5
+ efc2.h5
+ efc3.h5
+ efc4.h5
+ efc5.h5
+ log_vfd_out.log
+ new_multi_file_v16-r.h5
+ new_multi_file_v16-s.h5
+ 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.h5
+ vds_src_1.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
+ test_swmr*.h5
+ cache_logging.h5
+ cache_logging.out
+ vds_swmr.h5
+ vds_swmr_src_*.h5
+)
+
# Remove any output file left over from previous test run
add_test (
NAME H5TEST-clear-objects
COMMAND ${CMAKE_COMMAND}
-E remove
- dt_arith1.h5
- dt_arith2.h5
- dtransform.h5
- dtypes3.h5
- dtypes4.h5
- dtypes5.h5
- efc0.h5
- efc1.h5
- efc2.h5
- efc3.h5
- efc4.h5
- efc5.h5
- extlinks16A00000.h5
- extlinks16A00001.h5
- extlinks16A00002.h5
- extlinks16B-b.h5
- extlinks16B-g.h5
- extlinks16B-l.h5
- extlinks16B-r.h5
- extlinks16B-s.h5
- extlinks19B00000.h5
- extlinks19B00001.h5
- extlinks19B00002.h5
- extlinks19B00003.h5
- extlinks19B00004.h5
- extlinks19B00005.h5
- extlinks19B00006.h5
- extlinks19B00007.h5
- extlinks19B00008.h5
- extlinks19B00009.h5
- extlinks19B00010.h5
- extlinks19B00011.h5
- extlinks19B00012.h5
- extlinks19B00013.h5
- extlinks19B00014.h5
- extlinks19B00015.h5
- extlinks19B00016.h5
- extlinks19B00017.h5
- extlinks19B00018.h5
- extlinks19B00019.h5
- extlinks19B00020.h5
- extlinks19B00021.h5
- extlinks19B00022.h5
- extlinks19B00023.h5
- extlinks19B00024.h5
- extlinks19B00025.h5
- extlinks19B00026.h5
- extlinks19B00027.h5
- extlinks19B00028.h5
- fheap.h5
- log_vfd_out.log
- new_multi_file_v16-r.h5
- new_multi_file_v16-s.h5
- objcopy_ext.dat
- testmeta.h5
- tstint1.h5
- tstint2.h5
- unregister_filter_1.h5
- unregister_filter_2.h5
- vds_1.h5
+ ${test_CLEANFILES}
WORKING_DIRECTORY
${HDF5_TEST_BINARY_DIR}/H5TEST
)
-foreach (test ${H5_TESTS})
+set (H5TEST_TESTS
+ #testhdf5
+ #cache
+ cache_api
+ cache_tagging
+ lheap
+ ohdr
+ stab
+ gheap
+ farray
+ earray
+ btree2
+ fheap
+ pool
+ accum
+ #hyperslab
+ istore
+ bittests
+ dt_arith
+ dtypes
+ dsets
+ cmpd_dset
+ filter_fail
+ extend
+ external
+ efc
+ objcopy
+ links
+ unlink
+ twriteorder
+ big
+ mtime
+ fillval
+ mount
+ flush1
+ flush2
+ app_ref
+ enum
+ set_extent
+ ttsafe
+ enc_dec_plist
+ enc_dec_plist_cross_platform
+ getname
+ vfd
+ ntypes
+ dangle
+ dtransform
+ reserved
+ cross_read
+ freespace
+ mf
+ vds
+ file_image
+ unregister
+ cache_logging
+ cork
+ swmr
+)
+
+foreach (test ${H5TEST_TESTS})
if (${test} STREQUAL "big" AND CYGWIN)
add_test (
NAME H5TEST-${test}
@@ -500,12 +706,12 @@ foreach (test ${H5_TESTS})
ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST"
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
)
-endforeach (test ${H5_TESTS})
+endforeach (test ${H5TEST_TESTS})
set_tests_properties (H5TEST-flush2 PROPERTIES DEPENDS H5TEST-flush1)
set_tests_properties (H5TEST-fheap PROPERTIES TIMEOUT 1800)
-set_tests_properties (H5TEST-testmeta PROPERTIES TIMEOUT 1800)
set_tests_properties (H5TEST-big PROPERTIES TIMEOUT 1800)
+set_tests_properties (H5TEST-btree2 PROPERTIES TIMEOUT 1800)
set_tests_properties (H5TEST-objcopy PROPERTIES TIMEOUT 2400)
if (BUILD_SHARED_LIBS)
@@ -514,70 +720,12 @@ if (BUILD_SHARED_LIBS)
NAME H5TEST-shared-clear-objects
COMMAND ${CMAKE_COMMAND}
-E remove
- dt_arith1.h5
- dt_arith2.h5
- dtransform.h5
- dtypes3.h5
- dtypes4.h5
- dtypes5.h5
- efc0.h5
- efc1.h5
- efc2.h5
- efc3.h5
- efc4.h5
- efc5.h5
- extlinks16A00000.h5
- extlinks16A00001.h5
- extlinks16A00002.h5
- extlinks16B-b.h5
- extlinks16B-g.h5
- extlinks16B-l.h5
- extlinks16B-r.h5
- extlinks16B-s.h5
- extlinks19B00000.h5
- extlinks19B00001.h5
- extlinks19B00002.h5
- extlinks19B00003.h5
- extlinks19B00004.h5
- extlinks19B00005.h5
- extlinks19B00006.h5
- extlinks19B00007.h5
- extlinks19B00008.h5
- extlinks19B00009.h5
- extlinks19B00010.h5
- extlinks19B00011.h5
- extlinks19B00012.h5
- extlinks19B00013.h5
- extlinks19B00014.h5
- extlinks19B00015.h5
- extlinks19B00016.h5
- extlinks19B00017.h5
- extlinks19B00018.h5
- extlinks19B00019.h5
- extlinks19B00020.h5
- extlinks19B00021.h5
- extlinks19B00022.h5
- extlinks19B00023.h5
- extlinks19B00024.h5
- extlinks19B00025.h5
- extlinks19B00026.h5
- extlinks19B00027.h5
- extlinks19B00028.h5
- fheap.h5
- log_vfd_out.log
- new_multi_file_v16-r.h5
- new_multi_file_v16-s.h5
- objcopy_ext.dat
- testmeta.h5
- tstint1.h5
- tstint2.h5
- unregister_filter_1.h5
- unregister_filter_2.h5
+ ${test_CLEANFILES}
WORKING_DIRECTORY
${HDF5_TEST_BINARY_DIR}/H5TEST-shared
)
- foreach (test ${H5_TESTS})
+ foreach (test ${H5TEST_TESTS})
if (${test} STREQUAL "big" AND CYGWIN)
add_test (
NAME H5TEST-shared-${test}
@@ -591,12 +739,12 @@ if (BUILD_SHARED_LIBS)
ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared"
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared
)
- endforeach (test ${H5_TESTS})
+ endforeach (test ${H5TEST_TESTS})
set_tests_properties (H5TEST-shared-flush2 PROPERTIES DEPENDS H5TEST-shared-flush1)
set_tests_properties (H5TEST-shared-fheap PROPERTIES TIMEOUT 1800)
- set_tests_properties (H5TEST-shared-testmeta PROPERTIES TIMEOUT 1800)
set_tests_properties (H5TEST-shared-big PROPERTIES TIMEOUT 1800)
+ set_tests_properties (H5TEST-shared-btree2 PROPERTIES TIMEOUT 1800)
set_tests_properties (H5TEST-shared-objcopy PROPERTIES TIMEOUT 2400)
endif (BUILD_SHARED_LIBS)
@@ -625,58 +773,6 @@ if (NOT CYGWIN)
set_tests_properties (H5TEST-cache PROPERTIES TIMEOUT 2400)
endif (NOT CYGWIN)
-#-- Adding test for cache_api
-add_test (
- NAME H5TEST-clear-cache_api-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
- cache_api_test.h5
- WORKING_DIRECTORY
- ${HDF5_TEST_BINARY_DIR}/H5TEST
-)
-add_test (NAME H5TEST-cache_api COMMAND $<TARGET_FILE:cache_api>)
-set_tests_properties (H5TEST-cache_api PROPERTIES
- DEPENDS H5TEST-clear-cache_api-objects
- ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST"
- WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
-)
-
-#-- Adding test for cache_tagging
-add_test (
- NAME H5TEST-clear-cache_tagging-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
- tagging_test.h5
- tagging_ext_test.h5
- WORKING_DIRECTORY
- ${HDF5_TEST_BINARY_DIR}/H5TEST
-)
-add_test (NAME H5TEST-cache_tagging COMMAND $<TARGET_FILE:cache_tagging>)
-set_tests_properties (H5TEST-cache_tagging PROPERTIES
- DEPENDS H5TEST-clear-cache_tagging-objects
- ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST"
- WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
-)
-
-#-- Adding test for ttsafe
-add_test (
- NAME H5TEST-clear-ttsafe-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
- ttsafe_error.h5
- ttsafe_dcreate.h5
- ttsafe_cancel.h5
- ttsafe_acreate.h5
- WORKING_DIRECTORY
- ${HDF5_TEST_BINARY_DIR}/H5TEST
-)
-add_test (NAME H5TEST-ttsafe COMMAND $<TARGET_FILE:ttsafe>)
-set_tests_properties (H5TEST-ttsafe PROPERTIES
- DEPENDS H5TEST-clear-ttsafe-objects
- ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST"
- WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
-)
-
#-- Adding test for err_compat
if (HDF5_ENABLE_DEPRECATED_SYMBOLS)
add_test (
@@ -789,58 +885,6 @@ if (BUILD_SHARED_LIBS)
set_tests_properties (H5TEST-shared-cache PROPERTIES TIMEOUT 2400)
endif (NOT CYGWIN)
- #-- Adding test for cache_api
- add_test (
- NAME H5TEST-shared-clear-cache_api-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
- cache_api_test.h5
- WORKING_DIRECTORY
- ${HDF5_TEST_BINARY_DIR}/H5TEST-shared
- )
- add_test (NAME H5TEST-shared-cache_api COMMAND $<TARGET_FILE:cache_api-shared>)
- set_tests_properties (H5TEST-shared-cache_api PROPERTIES
- DEPENDS H5TEST-shared-clear-cache_api-objects
- ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared"
- WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared
- )
-
- #-- Adding test for cache_tagging
- add_test (
- NAME H5TEST-shared-clear-cache_tagging-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
- tagging_test.h5
- tagging_ext_test.h5
- WORKING_DIRECTORY
- ${HDF5_TEST_BINARY_DIR}/H5TEST-shared
- )
- add_test (NAME H5TEST-shared-cache_tagging COMMAND $<TARGET_FILE:cache_tagging-shared>)
- set_tests_properties (H5TEST-shared-cache_tagging PROPERTIES
- DEPENDS H5TEST-shared-clear-cache_tagging-objects
- ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared"
- WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared
- )
-
- #-- Adding test for ttsafe
- add_test (
- NAME H5TEST-shared-clear-ttsafe-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
- ttsafe_error.h5
- ttsafe_dcreate.h5
- ttsafe_cancel.h5
- ttsafe_acreate.h5
- WORKING_DIRECTORY
- ${HDF5_TEST_BINARY_DIR}/H5TEST-shared
- )
- add_test (NAME H5TEST-shared-ttsafe COMMAND $<TARGET_FILE:ttsafe-shared>)
- set_tests_properties (H5TEST-shared-ttsafe PROPERTIES
- DEPENDS H5TEST-shared-clear-ttsafe-objects
- ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared"
- WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared
- )
-
#-- Adding test for err_compat
if (HDF5_ENABLE_DEPRECATED_SYMBOLS)
add_test (
@@ -950,6 +994,14 @@ set_tests_properties (H5PLUGIN-plugin PROPERTIES
)
##############################################################################
+### 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*
+
+##############################################################################
##############################################################################
### V F D T E S T S ###
##############################################################################
@@ -993,7 +1045,7 @@ if (HDF5_TEST_VFD)
set_extent
ttsafe
getname
- vfd
+# vfd
ntypes
dangle
dtransform
@@ -1005,11 +1057,11 @@ if (HDF5_TEST_VFD)
earray
btree2
#fheap
- error_test
- err_compat
- tcheck_version
- testmeta
- links_env
+# error_test
+# err_compat
+ #tcheck_version
+# testmeta
+# links_env
unregister
)
if (NOT CYGWIN)
@@ -1177,17 +1229,17 @@ if (HDF5_TEST_VFD)
set_tests_properties (VFD-${vfdname}-flush1 PROPERTIES TIMEOUT 10)
set_tests_properties (VFD-${vfdname}-flush2 PROPERTIES TIMEOUT 10)
set_tests_properties (VFD-${vfdname}-istore PROPERTIES TIMEOUT 1800)
- if (NOT CYGWIN)
- set_tests_properties (VFD-${vfdname}-cache PROPERTIES TIMEOUT 1800)
- endif (NOT CYGWIN)
+# if (NOT CYGWIN)
+# set_tests_properties (VFD-${vfdname}-cache PROPERTIES TIMEOUT 1800)
+# endif (NOT CYGWIN)
if (BUILD_SHARED_LIBS)
set_tests_properties (VFD-${vfdname}-flush2-shared PROPERTIES DEPENDS VFD-${vfdname}-flush1-shared)
set_tests_properties (VFD-${vfdname}-flush1-shared PROPERTIES TIMEOUT 10)
set_tests_properties (VFD-${vfdname}-flush2-shared PROPERTIES TIMEOUT 10)
set_tests_properties (VFD-${vfdname}-istore-shared PROPERTIES TIMEOUT 1800)
- if (NOT CYGWIN)
- set_tests_properties (VFD-${vfdname}-cache-shared PROPERTIES TIMEOUT 1800)
- endif (NOT CYGWIN)
+# if (NOT CYGWIN)
+# set_tests_properties (VFD-${vfdname}-cache-shared PROPERTIES TIMEOUT 1800)
+# endif (NOT CYGWIN)
endif (BUILD_SHARED_LIBS)
if (HDF5_TEST_FHEAP_VFD)
add_test (
@@ -1256,6 +1308,7 @@ if (HDF5_BUILD_GENERATORS)
gen_cross
gen_deflate
gen_filters
+ gen_idx
gen_new_array
gen_new_fill
gen_new_group
diff --git a/test/atomic_reader.c b/test/atomic_reader.c
index 5d9ea68..94d9c74 100644
--- a/test/atomic_reader.c
+++ b/test/atomic_reader.c
@@ -13,7 +13,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*-------------------------------------------------------------------------
*
- * Created: atomic_reader.c
+ * Created: atomic_reader.c
*
* Purpose: This is the "reader" part of the standalone test to check
* atomic read-write operation on a system.
@@ -28,15 +28,17 @@
/* Headers */
/***********/
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <assert.h>
+
+#if !defined(WIN32) && !defined(__MINGW32__)
+
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
/****************/
/* Local Macros */
@@ -83,23 +85,23 @@ usage(void)
* Function: verify
*
* Purpose: To verify that the data read is the pattern expected.
- * Each integer read should be the same as the index.
- * When a difference is encountered, the remaining integers
- * read should be the same as the previous index.
- * For example, the pattern expected should be either:
- * a) 01234567....n-1
- * or
- * b) if at index 4, a difference is encountered,
- * the remaining integers should be all "3"s as:
- * 012333333333333
+ * Each integer read should be the same as the index.
+ * When a difference is encountered, the remaining integers
+ * read should be the same as the previous index.
+ * For example, the pattern expected should be either:
+ * a) 01234567....n-1
+ * or
+ * b) if at index 4, a difference is encountered,
+ * the remaining integers should be all "3"s as:
+ * 012333333333333
*
* Parameters:
- * fd--the file descriptor
- * k--the number of integers to read
+ * fd -- the file descriptor
+ * k -- the number of integers to read
*
* Return:
- * positive on success
- * negative on failure
+ * positive on success
+ * negative on failure
*
*-------------------------------------------------------------------------
*/
@@ -112,55 +114,57 @@ verify(int fd, unsigned int k)
/* Allocate buffer for data read */
if((buf = (unsigned int *)malloc(k * sizeof(unsigned int))) == NULL) {
- printf("READER: error from malloc\n");
- goto error;
- }
+ printf("READER: error from malloc\n");
+ goto error;
+ } /* end if */
/* Position the file at the beginning */
if(lseek(fd, (off_t)0, SEEK_SET) < 0) {
- printf("READER: error from lseek\n");
- goto error;
- }
+ printf("READER: error from lseek\n");
+ goto error;
+ } /* end if */
/* Read the whole file */
if((bytes_read = read(fd, buf, (k * sizeof(unsigned int)))) < 0) {
- printf("READER: error from read\n");
- goto error;
- }
+ printf("READER: error from read\n");
+ goto error;
+ } /* end if */
/* Verify the bytes read are correct */
if(bytes_read != (ssize_t)(k*sizeof(unsigned int))) {
- printf("READER: error from bytes read=%lu\n", (unsigned long)bytes_read);
- goto error;
- }
+ printf("READER: error from bytes read=%lu\n", (unsigned long)bytes_read);
+ goto error;
+ } /* end if */
/* Verify data read */
for(i=0; i < k; i++) {
- if(buf[i] != i)
- break;
- }
+ if(buf[i] != i)
+ break;
+ } /* end for */
if(i < k) {
- /* Compare the beginning and ending sentinel values */
- if(buf[k-1] != (i-1)) {
- printf("FAIL IN READER: ...beginning sentinel value=%u, i=%u\n", (i-1), i);
- printf("FAIL IN READER: buf[%u]=%u\n", i-1, buf[i-1]);
- printf("FAIL IN READER: buf[%u]=%u\n", i, buf[i]);
- printf("FAIL IN READER: buf[%u]=%u\n", i+1, buf[i+1]);
- printf("FAIL IN READER: ...ending sentinel value=%u\n", buf[k-1]);
- goto error;
- }
- }
+ /* Compare the beginning and ending sentinel values */
+ if(buf[k-1] != (i-1)) {
+ printf("FAIL IN READER: ...beginning sentinel value=%u, i=%u\n", (i-1), i);
+ printf("FAIL IN READER: buf[%u]=%u\n", i-1, buf[i-1]);
+ printf("FAIL IN READER: buf[%u]=%u\n", i, buf[i]);
+ printf("FAIL IN READER: buf[%u]=%u\n", i+1, buf[i+1]);
+ printf("FAIL IN READER: ...ending sentinel value=%u\n", buf[k-1]);
+ goto error;
+ } /* end if */
+ } /* end if */
/* Free the buffer */
- if(buf) free(buf);
- return(0);
+ if(buf)
+ free(buf);
+ return 0;
error:
/* Free the buffer */
- if(buf) free(buf);
- return(-1);
-} /* verify() */
+ if(buf)
+ free(buf);
+ return -1;
+} /* end verify() */
@@ -170,11 +174,11 @@ error:
* Purpose: To print the statistics gathered for re-reads
*
* Parameters:
- * info--the array storing the statistics for re-reads
- * lastr--the last read completed
- * iteration--the current iteration
+ * info -- the array storing the statistics for re-reads
+ * lastr -- the last read completed
+ * iteration -- the current iteration
*
- * Return: void
+ * Return: void
*
*-------------------------------------------------------------------------
*/
@@ -186,7 +190,7 @@ print_info(int *info, unsigned int lastr, unsigned iteration)
printf("--------statistics for %u reads (iteration %u)--------\n", lastr, iteration);
for(j = 0; j <= READ_TRIES; j++)
- printf("# of %u re-tries = %u\n", j, info[j]);
+ printf("# of %u re-tries = %u\n", j, info[j]);
printf("--------end statistics for %u reads (iteration %u)--------\n", lastr, iteration);
} /* print_info() */
@@ -196,12 +200,12 @@ print_info(int *info, unsigned int lastr, unsigned iteration)
* Function: main
*
* Purpose: To verify that the data read is the pattern expected.
- * (1) Make sure the file opens successfully and the # of bytes read is as expected
- * (2) Iterate the reader with i iterations
- * (3) Read and verify n integers for each iteration
- * (4) On verification error, re-read the data at most READ_TRIES
- * times to see if correct data can be obtained
- * (5) Print out statistics for the number of re-retries for each iteration
+ * (1) Make sure the file opens successfully and the # of bytes read is as expected
+ * (2) Iterate the reader with i iterations
+ * (3) Read and verify n integers for each iteration
+ * (4) On verification error, re-read the data at most READ_TRIES
+ * times to see if correct data can be obtained
+ * (5) Print out statistics for the number of re-retries for each iteration
*
* Note:
* (a) The # of integers (via -n option) used by the writer and reader should be the same.
@@ -212,27 +216,27 @@ print_info(int *info, unsigned int lastr, unsigned iteration)
* 2) Use HDF library HD<system calls> instead of the system calls
* 3) Handle large sized buffer (gigabytes) if needed
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: EXIT_SUCCESS
+ * Failure: EXIT_FAILURE
*
*-------------------------------------------------------------------------
*/
int
main(int argc, char *argv[])
{
- int fd = -1; /* file descriptor */
- unsigned int j=0, i=0, m=0; /* local index variables */
- int temp; /* temporary variable */
- unsigned int iterations = 0; /* the input for "-i" */
- unsigned num = 0; /* the input for "-n" */
- int opt = 0; /* option char */
- int info[READ_TRIES+1]; /* re-tries statistics */
+ int fd = -1; /* file descriptor */
+ unsigned int j=0, i=0, m=0; /* local index variables */
+ int temp; /* temporary variable */
+ unsigned int iterations = 0; /* the input for "-i" */
+ unsigned num = 0; /* the input for "-n" */
+ int opt = 0; /* option char */
+ int info[READ_TRIES+1]; /* re-tries statistics */
/* Ensure the expected # of arguments */
if(argc != 5) {
usage();
- exit(-1);
- }
+ exit(EXIT_FAILURE);
+ } /* end if */
/* Parse command line options */
while((opt = getopt(argc, argv, "n:i:")) != -1) {
@@ -240,108 +244,120 @@ main(int argc, char *argv[])
case 'n':
if((temp = atoi(optarg)) < 0) {
usage();
- exit(-1);
- }
+ exit(EXIT_FAILURE);
+ } /* end if */
num = (unsigned int)temp;
break;
case 'i':
if((temp = atoi(optarg)) < 0) {
usage();
- exit(-1);
- }
+ exit(EXIT_FAILURE);
+ } /* end if */
iterations = (unsigned int)temp;
break;
default:
printf("Invalid option encountered\n");
break;
- }
- }
+ } /* end switch */
+ } /* end while */
printf("READER: number of integers to read = %u; # of iterations = %d\n", num, iterations);
printf("\n");
- for(i = 1; i <= iterations; i++) { /* iteration loop */
- unsigned opens = OPEN_TRIES;
-
- printf("READER: *****start iteration %u*****\n", i);
-
- /* Ensure open and file size are done properly */
- while(opens--) { /* open loop */
- struct stat sinfo;
-
- memset(&sinfo, 0, sizeof(sinfo));
-
- if((fd = open(FILENAME, O_RDONLY, 0644)) < 0) {
- printf("READER: error from open--retry open again\n");
- } else {
- printf("READER: open succeed\n");
-
- if((fstat(fd, &sinfo) == 0) &&
- (sinfo.st_size == (off_t)(num * sizeof(unsigned int)))) {
- printf("READER: file size is correct--%u\n", (unsigned int)sinfo.st_size);
- break;
- }
-
- printf("READER: error from fstat or file size of %u is incorrect--retry open again\n", (unsigned int)sinfo.st_size);
- if(close(fd) < 0) {
- printf("READER: error from close\n");
- return(-1);
- }
- fd = -1;
- }
-
- } /* end while */
-
- if(fd < 0) {
- printf("READER: *****open failure/incorrect file size for all %u tries, continue next iteration*****\n\n", OPEN_TRIES);
- continue;
- }
-
- memset(info, 0, sizeof(info));
-
- /* Read and verify data */
- for(j = 1; j <= num; j++) { /* read loop */
-
- printf("READER: doing read %u\n", j);
- if(verify(fd, num) < 0) {
- printf("READER: error from read %u\n", j);
-
- /* Perform re-read to see if correct data is obtained */
- for(m = 1; m <= READ_TRIES; m++) { /* re-read loop */
- printf("READER: ===============going to do re-read try %u\n", m);
- if(verify(fd, num) < 0)
- printf("READER: ===============error from re-read try %u\n", m);
- else {
- ++info[m];
- printf("READER: ===============SUCCESS from re-read try %u\n", m);
- break;
- }
- } /* end for */
-
- if(m > READ_TRIES) {
- printf("READER: ===============error from all re-read tries: %u\n", READ_TRIES);
- printf("READER:*****ERROR--stop on read %u\n", j);
- break;
- }
- } else {
- ++info[0];
- printf("READER: success from read %u\n", j);
- }
-
- } /* end for */
-
- /* Print the statistics for re-reads */
- print_info(info, j-1, i);
-
- /* Close the file */
- if(close(fd) < 0) {
- printf("READER: error from close\n");
- return(-1);
- }
-
- printf("READER: *****end iteration %u*****\n\n", i);
+ for(i = 1; i <= iterations; i++) {
+ unsigned opens = OPEN_TRIES;
+
+ printf("READER: *****start iteration %u*****\n", i);
+
+ /* Ensure open and file size are done properly */
+ while(opens--) {
+ struct stat sinfo;
+
+ memset(&sinfo, 0, sizeof(sinfo));
+
+ if((fd = open(FILENAME, O_RDONLY, 0644)) < 0) {
+ printf("READER: error from open--retry open again\n");
+ } else {
+ printf("READER: open succeed\n");
+
+ if((fstat(fd, &sinfo) == 0) &&
+ (sinfo.st_size == (off_t)(num * sizeof(unsigned int)))) {
+ printf("READER: file size is correct--%u\n", (unsigned int)sinfo.st_size);
+ break;
+ } /* end if */
+
+ printf("READER: error from fstat or file size of %u is incorrect--retry open again\n", (unsigned int)sinfo.st_size);
+ if(close(fd) < 0) {
+ printf("READER: error from close\n");
+ return EXIT_FAILURE;
+ } /* end if */
+ fd = -1;
+ } /* end else */
+
+ } /* end while */
+
+ if(fd < 0) {
+ printf("READER: *****open failure/incorrect file size for all %u tries, continue next iteration*****\n\n", OPEN_TRIES);
+ continue;
+ } /* end if */
+
+ memset(info, 0, sizeof(info));
+
+ /* Read and verify data */
+ for(j = 1; j <= num; j++) {
+
+ printf("READER: doing read %u\n", j);
+ if(verify(fd, num) < 0) {
+ printf("READER: error from read %u\n", j);
+
+ /* Perform re-read to see if correct data is obtained */
+ for(m = 1; m <= READ_TRIES; m++) {
+ printf("READER: ===============going to do re-read try %u\n", m);
+ if(verify(fd, num) < 0)
+ printf("READER: ===============error from re-read try %u\n", m);
+ else {
+ ++info[m];
+ printf("READER: ===============SUCCESS from re-read try %u\n", m);
+ break;
+ } /* end else */
+ } /* end for */
+
+ if(m > READ_TRIES) {
+ printf("READER: ===============error from all re-read tries: %u\n", READ_TRIES);
+ printf("READER:*****ERROR--stop on read %u\n", j);
+ break;
+ } /* end if */
+ } else {
+ ++info[0];
+ printf("READER: success from read %u\n", j);
+ } /* end else */
+
+ } /* end for */
+
+ /* Print the statistics for re-reads */
+ print_info(info, j-1, i);
+
+ /* Close the file */
+ if(close(fd) < 0) {
+ printf("READER: error from close\n");
+ return EXIT_FAILURE;
+ } /* end if */
+
+ printf("READER: *****end iteration %u*****\n\n", i);
} /* end for */
- return(0);
+ return EXIT_SUCCESS;
}
+
+#else /* WIN32 / MINGW32 */
+
+int
+main(void)
+{
+ printf("Non-POSIX platform. Exiting.\n");
+ return EXIT_FAILURE;
+} /* end main() */
+
+#endif /* WIN32 / MINGW32 */
+
diff --git a/test/atomic_writer.c b/test/atomic_writer.c
index 9f37ecc..ec1e8c9 100644
--- a/test/atomic_writer.c
+++ b/test/atomic_writer.c
@@ -14,14 +14,14 @@
/*-------------------------------------------------------------------------
*
- * Created: atomic_writer.c
+ * Created: atomic_writer.c
+ *
+ * Purpose: This is the "writer" part of the standalone test to check
+ * atomic read-write operation on a system.
+ * a) atomic_writer.c--the writer (this file)
+ * b) atomic_reader.c--the reader
+ * c) atomic_data--the name of the data file used by writer and reader
*
- * Purpose: This is the "writer" part of the standalone test to check
- * atomic read-write operation on a system.
- * a) atomic_writer.c--the writer (this file)
- * b) atomic_reader.c--the reader
- * c) atomic_data--the name of the data file used by writer and reader
- *
*-------------------------------------------------------------------------
*/
@@ -29,17 +29,19 @@
/* Headers */
/***********/
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/wait.h>
-#include <fcntl.h>
-#include <unistd.h>
#include <assert.h>
+#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <assert.h>
-#include <errno.h>
+
+#if !defined(WIN32) && !defined(__MINGW32__)
+
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
/****************/
/* Local Macros */
@@ -59,9 +61,9 @@ static void usage(void);
*
* Purpose: To print information about the command line options
*
- * Parameters: None
+ * Parameters: None
*
- * Return: void
+ * Return: void
*
*-------------------------------------------------------------------------
*/
@@ -81,21 +83,21 @@ usage(void)
/*-------------------------------------------------------------------------
* Function: main
*
- * Purpose: To write a series of integers to a file for the reader to verify the data.
- * A write is atomic if the whole amount written in one operation is not interleaved
- * with data from any other process.
- * (1) Iterate with i iterations
- * (2) Write a series of integers (0 to n-1) to the file with this pattern:
- * offset 0: 0000000000000000000000000000000
- * offset 1: 111111111111111111111111111111
- * offset 2: 22222222222222222222222222222
- * offset 3: 3333333333333333333333333333
- * ...
- * ...
- * offset n-1: (n-1)
+ * Purpose: To write a series of integers to a file for the reader to verify the data.
+ * A write is atomic if the whole amount written in one operation is not interleaved
+ * with data from any other process.
+ * (1) Iterate with i iterations
+ * (2) Write a series of integers (0 to n-1) to the file with this pattern:
+ * offset 0: 0000000000000000000000000000000
+ * offset 1: 111111111111111111111111111111
+ * offset 2: 22222222222222222222222222222
+ * offset 3: 3333333333333333333333333333
+ * ...
+ * ...
+ * offset n-1: (n-1)
*
- * At the end of the writes, the data in the file will be:
- * 01234567........(n-1)
+ * At the end of the writes, the data in the file will be:
+ * 01234567........(n-1)
*
* Note:
* (a) The # of integers (via -n option) used by the writer and reader should be the same.
@@ -105,126 +107,139 @@ usage(void)
* 1) Provide default values for n and i and allow user to run with either 0 or 1 option
* 2) Use HDF library HD<system calls> instead of the system calls
* 3) Handle large sized buffer (gigabytes) if needed
- *
- * Return: Success: 0
- * Failure: -1
+ *
+ * Return: Success: EXIT_SUCCESS
+ * Failure: EXIT_FAILURE
*
*-------------------------------------------------------------------------
*/
int
main(int argc, char *argv[])
{
- int fd = -1; /* file descriptor */
- ssize_t bytes_wrote; /* the nubmer of bytes written */
- unsigned int *buf = NULL; /* buffer to hold written data */
- unsigned int n, u, i; /* local index variable */
- int temp; /* temporary variable */
- unsigned int iterations = 0; /* the input for "-i" */
- unsigned int num = 0; /* the input for "-n" */
- int opt = 0; /* option char */
+ int fd = -1; /* file descriptor */
+ ssize_t bytes_wrote; /* the nubmer of bytes written */
+ unsigned int *buf = NULL; /* buffer to hold written data */
+ unsigned int n, u, i; /* local index variable */
+ int temp; /* temporary variable */
+ unsigned int iterations = 0; /* the input for "-i" */
+ unsigned int num = 0; /* the input for "-n" */
+ int opt = 0; /* option char */
/* Ensure the # of arguments is as expected */
if(argc != 5) {
usage();
- exit(-1);
- }
+ exit(EXIT_FAILURE);
+ } /* end if */
/* Parse command line options */
while((opt = getopt(argc, argv, "n:i:")) != -1) {
- switch(opt) {
- case 'n':
- if((temp = atoi(optarg)) < 0) {
- usage();
- exit(-1);
- }
- num = (unsigned int)temp;
- break;
- case 'i':
- if((temp = atoi(optarg)) < 0) {
- usage();
- exit(-1);
- }
- iterations = (unsigned int)temp;
- break;
- default:
- printf("Invalid option encountered\n");
- break;
- }
- }
+ switch(opt) {
+ case 'n':
+ if((temp = atoi(optarg)) < 0) {
+ usage();
+ exit(EXIT_FAILURE);
+ } /* end if */
+ num = (unsigned int)temp;
+ break;
+ case 'i':
+ if((temp = atoi(optarg)) < 0) {
+ usage();
+ exit(EXIT_FAILURE);
+ } /* end if */
+ iterations = (unsigned int)temp;
+ break;
+ default:
+ printf("Invalid option encountered\n");
+ break;
+ } /* end switch */
+ } /* end while */
printf("WRITER: # of integers to write = %u; # of iterations = %d\n", num, iterations);
/* Remove existing data file if needed */
if(remove(FILENAME) < 0) {
- if(errno == ENOENT)
- printf("WRITER: remove %s--%s\n", FILENAME, strerror(errno));
- else {
- printf("WRITER: error from remove: %d--%s\n", errno, strerror(errno));
- goto error;
- }
+ if(errno == ENOENT)
+ printf("WRITER: remove %s--%s\n", FILENAME, strerror(errno));
+ else {
+ printf("WRITER: error from remove: %d--%s\n", errno, strerror(errno));
+ goto error;
+ } /* end else */
} else
- printf("WRITER: %s is removed\n", FILENAME);
+ printf("WRITER: %s is removed\n", FILENAME);
/* Create the data file */
if((fd = open(FILENAME, O_RDWR|O_TRUNC|O_CREAT, 0664)) < 0) {
- printf("WRITER: error from open\n");
- goto error;
- }
+ printf("WRITER: error from open\n");
+ goto error;
+ } /* end if */
/* Allocate buffer for holding data to be written */
if((buf = (unsigned int *)malloc(num * sizeof(unsigned int))) == NULL) {
- printf("WRITER: error from malloc\n");
- if(fd >= 0 && close(fd) < 0)
- printf("WRITER: error from close\n");
- goto error;
- }
+ printf("WRITER: error from malloc\n");
+ if(fd >= 0 && close(fd) < 0)
+ printf("WRITER: error from close\n");
+ goto error;
+ } /* end if */
printf("\n");
- for(i = 1; i <= iterations; i++) { /* iteration loop */
- printf("WRITER: *****start iteration %u*****\n", i);
+ for(i = 1; i <= iterations; i++) {
+ printf("WRITER: *****start iteration %u*****\n", i);
- /* Write the series of integers to the file */
- for(n = 0; n < num; n++) { /* write loop */
+ /* Write the series of integers to the file */
+ for(n = 0; n < num; n++) {
- /* Set up data to be written */
- for(u=0; u < num; u++)
- buf[u] = n;
+ /* Set up data to be written */
+ for(u=0; u < num; u++)
+ buf[u] = n;
- /* Position the file to the proper location */
- if(lseek(fd, (off_t)(n*sizeof(unsigned int)), SEEK_SET) < 0) {
- printf("WRITER: error from lseek\n");
- goto error;
- }
+ /* Position the file to the proper location */
+ if(lseek(fd, (off_t)(n*sizeof(unsigned int)), SEEK_SET) < 0) {
+ printf("WRITER: error from lseek\n");
+ goto error;
+ } /* end if */
- /* Write the data */
- if((bytes_wrote = write(fd, buf, ((num-n) * sizeof(unsigned int)))) < 0) {
- printf("WRITER: error from write\n");
- goto error;
- }
+ /* Write the data */
+ if((bytes_wrote = write(fd, buf, ((num-n) * sizeof(unsigned int)))) < 0) {
+ printf("WRITER: error from write\n");
+ goto error;
+ } /* end if */
- /* Verify the bytes written is correct */
- if(bytes_wrote != (ssize_t)((num-n) * sizeof(unsigned int))) {
- printf("WRITER: error from bytes written\n");
- goto error;
- }
- } /* end for */
+ /* Verify the bytes written is correct */
+ if(bytes_wrote != (ssize_t)((num-n) * sizeof(unsigned int))) {
+ printf("WRITER: error from bytes written\n");
+ goto error;
+ } /* end if */
+ } /* end for */
- printf("WRITER: *****end iteration %u*****\n\n", i);
+ printf("WRITER: *****end iteration %u*****\n\n", i);
} /* end for */
/* Close the file */
if(close(fd) < 0) {
- printf("WRITER: error from close\n");
- goto error;
- }
+ printf("WRITER: error from close\n");
+ goto error;
+ } /* end if */
/* Free the buffer */
- if(buf) free(buf);
+ if(buf)
+ free(buf);
- return(0);
+ return EXIT_SUCCESS;
error:
- return(-1);
-} /* main() */
+ return EXIT_FAILURE;
+} /* end main() */
+
+#else /* WIN32 / MINGW32 */
+
+int
+main(void)
+{
+ printf("Non-POSIX platform. Exiting.\n");
+ return EXIT_FAILURE;
+} /* end main() */
+
+#endif /* WIN32 / MINGW32 */
+