diff options
Diffstat (limited to 'tools/test/h5repack')
-rw-r--r-- | tools/test/h5repack/CMakeLists.txt | 76 | ||||
-rw-r--r-- | tools/test/h5repack/CMakeTests.cmake | 2 | ||||
-rw-r--r-- | tools/test/h5repack/h5repacktst.c | 20 | ||||
-rw-r--r-- | tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl | 14 |
4 files changed, 61 insertions, 51 deletions
diff --git a/tools/test/h5repack/CMakeLists.txt b/tools/test/h5repack/CMakeLists.txt index 2a168e9..890d5d2 100644 --- a/tools/test/h5repack/CMakeLists.txt +++ b/tools/test/h5repack/CMakeLists.txt @@ -32,45 +32,47 @@ set_target_properties (h5repacktest PROPERTIES FOLDER tools) #----------------------------------------------------------------------------- # If plugin library tests can be tested #----------------------------------------------------------------------------- -set (HDF5_TOOL_PLUGIN_LIB_CORENAME "dynlibadd") -set (HDF5_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TOOL_PLUGIN_LIB_CORENAME}") -set (HDF5_TOOL_PLUGIN_LIB_TARGET ${HDF5_TOOL_PLUGIN_LIB_CORENAME}) -set (HDF5_TOOL_PLUGIN_LIB_VCORENAME "dynlibvers") -set (HDF5_TOOL_PLUGIN_LIB_VNAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TOOL_PLUGIN_LIB_VCORENAME}") -set (HDF5_TOOL_PLUGIN_LIB_VTARGET ${HDF5_TOOL_PLUGIN_LIB_VCORENAME}) +if (BUILD_SHARED_LIBS) + set (HDF5_TOOL_PLUGIN_LIB_CORENAME "dynlibadd") + set (HDF5_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TOOL_PLUGIN_LIB_CORENAME}") + set (HDF5_TOOL_PLUGIN_LIB_TARGET ${HDF5_TOOL_PLUGIN_LIB_CORENAME}) + set (HDF5_TOOL_PLUGIN_LIB_VCORENAME "dynlibvers") + set (HDF5_TOOL_PLUGIN_LIB_VNAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TOOL_PLUGIN_LIB_VCORENAME}") + set (HDF5_TOOL_PLUGIN_LIB_VTARGET ${HDF5_TOOL_PLUGIN_LIB_VCORENAME}) -add_library (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_rpk.c) -target_include_directories(${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED) -target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIB_TARGET}) -H5_SET_LIB_OPTIONS (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TOOL_PLUGIN_LIB_NAME} SHARED "LIB") + add_library (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_rpk.c) + target_include_directories(${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED) + target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIB_TARGET}) + H5_SET_LIB_OPTIONS (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TOOL_PLUGIN_LIB_NAME} SHARED "LIB") -add_library (${HDF5_TOOL_PLUGIN_LIB_VTARGET} SHARED dynlib_vrpk.c) -target_include_directories(${HDF5_TOOL_PLUGIN_LIB_VTARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_VTARGET} SHARED) -target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_VTARGET} PRIVATE ${HDF5_TEST_LIB_TARGET}) -H5_SET_LIB_OPTIONS (${HDF5_TOOL_PLUGIN_LIB_VTARGET} ${HDF5_TOOL_PLUGIN_LIB_VNAME} SHARED "LIB") + add_library (${HDF5_TOOL_PLUGIN_LIB_VTARGET} SHARED dynlib_vrpk.c) + target_include_directories(${HDF5_TOOL_PLUGIN_LIB_VTARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_VTARGET} SHARED) + target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_VTARGET} PRIVATE ${HDF5_TEST_LIB_TARGET}) + H5_SET_LIB_OPTIONS (${HDF5_TOOL_PLUGIN_LIB_VTARGET} ${HDF5_TOOL_PLUGIN_LIB_VNAME} SHARED "LIB") -# make plugins dir -file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/plugins") -#----------------------------------------------------------------------------- -# Copy plugin library to a plugins folder -#----------------------------------------------------------------------------- -add_custom_command ( - TARGET ${HDF5_TOOL_PLUGIN_LIB_TARGET} - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different - "$<TARGET_FILE:${HDF5_TOOL_PLUGIN_LIB_TARGET}>" - "${CMAKE_BINARY_DIR}/plugins/$<TARGET_FILE_NAME:${HDF5_TOOL_PLUGIN_LIB_TARGET}>" -) -add_custom_command ( - TARGET ${HDF5_TOOL_PLUGIN_LIB_VTARGET} - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different - "$<TARGET_FILE:${HDF5_TOOL_PLUGIN_LIB_VTARGET}>" - "${CMAKE_BINARY_DIR}/plugins/$<TARGET_FILE_NAME:${HDF5_TOOL_PLUGIN_LIB_VTARGET}>" -) + # make plugins dir + file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/plugins") + #----------------------------------------------------------------------------- + # Copy plugin library to a plugins folder + #----------------------------------------------------------------------------- + add_custom_command ( + TARGET ${HDF5_TOOL_PLUGIN_LIB_TARGET} + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different + "$<TARGET_FILE:${HDF5_TOOL_PLUGIN_LIB_TARGET}>" + "${CMAKE_BINARY_DIR}/plugins/$<TARGET_FILE_NAME:${HDF5_TOOL_PLUGIN_LIB_TARGET}>" + ) + add_custom_command ( + TARGET ${HDF5_TOOL_PLUGIN_LIB_VTARGET} + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different + "$<TARGET_FILE:${HDF5_TOOL_PLUGIN_LIB_VTARGET}>" + "${CMAKE_BINARY_DIR}/plugins/$<TARGET_FILE_NAME:${HDF5_TOOL_PLUGIN_LIB_VTARGET}>" + ) +endif () include (CMakeTests.cmake) diff --git a/tools/test/h5repack/CMakeTests.cmake b/tools/test/h5repack/CMakeTests.cmake index a063e19..3ee5e27 100644 --- a/tools/test/h5repack/CMakeTests.cmake +++ b/tools/test/h5repack/CMakeTests.cmake @@ -1450,11 +1450,13 @@ ADD_H5_VERIFY_INVALIDBOUNDS (latest_latest_invalid bounds_latest_latest.h5 0 1) ############################################################################## ### P L U G I N T E S T S ############################################################################## +if (BUILD_SHARED_LIBS) ADD_H5_UD_TEST (plugin_version_test 0 h5repack_layout.h5 -v -f UD=260,0,4,9,${H5_VERS_MAJOR},${H5_VERS_MINOR},${H5_VERS_RELEASE}) ADD_H5_UD_TEST (plugin_test 0 h5repack_layout.h5 -v -f UD=257,0,1,9) ADD_H5_UD_TEST (plugin_none 0 h5repack_layout.UD.h5 -v -f NONE) # check for no parameters ADD_H5_UD_TEST (plugin_zero 0 h5repack_layout.h5 -v -f UD=250,0,0) +endif () if (HDF5_TEST_VFD) # Run test with different Virtual File Driver diff --git a/tools/test/h5repack/h5repacktst.c b/tools/test/h5repack/h5repacktst.c index f6166da..0ae570b 100644 --- a/tools/test/h5repack/h5repacktst.c +++ b/tools/test/h5repack/h5repacktst.c @@ -3728,7 +3728,7 @@ out: H5Pclose(fcpl); H5Fclose(fid); } H5E_END_TRY; - if(fd > 0) + if(fd >= 0) HDclose(fd); return -1; @@ -3797,7 +3797,7 @@ out: H5Pclose(fcpl); H5Fclose(fid); } H5E_END_TRY; - if(fd > 0) + if(fd >= 0) HDclose(fd); return -1; @@ -3838,7 +3838,7 @@ make_userblock_file(void) out: - if(fd > 0) + if(fd >= 0) HDclose(fd); return -1; @@ -4134,13 +4134,19 @@ int write_dset_in(hid_t loc_id, } /* create a type larger than TEST_BUFSIZE */ - if ((tid = H5Tarray_create2(H5T_NATIVE_DOUBLE, 1, tdims)) < 0) + if ((tid = H5Tarray_create2(H5T_NATIVE_DOUBLE, 1, tdims)) < 0) { + HDfree(dbuf); goto out; + } size = H5Tget_size(tid); - if ((sid = H5Screate_simple(1, sdims, NULL)) < 0) + if ((sid = H5Screate_simple(1, sdims, NULL)) < 0) { + HDfree(dbuf); goto out; - if ((did = H5Dcreate2(loc_id, "arrayd", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + } + if ((did = H5Dcreate2(loc_id, "arrayd", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) { + HDfree(dbuf); goto out; + } #if defined(WRITE_ARRAY) H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dbuf); #endif @@ -4149,7 +4155,7 @@ int write_dset_in(hid_t loc_id, H5Dclose(did); H5Tclose(tid); H5Sclose(sid); - HDfree( dbuf ); + HDfree(dbuf); } /*------------------------------------------------------------------------- diff --git a/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl b/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl index 8f48c37..1d2914b 100644 --- a/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl +++ b/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl @@ -11,7 +11,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 3 } + PARAMS { 9 1 11 4 } } } FILLVALUE { @@ -33,7 +33,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 3 } + PARAMS { 9 1 11 4 } } } FILLVALUE { @@ -55,7 +55,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 3 } + PARAMS { 9 1 11 4 } } } FILLVALUE { @@ -77,7 +77,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 3 } + PARAMS { 9 1 11 4 } } } FILLVALUE { @@ -99,7 +99,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 3 } + PARAMS { 9 1 11 4 } } } FILLVALUE { @@ -121,7 +121,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 3 } + PARAMS { 9 1 11 4 } } } FILLVALUE { @@ -143,7 +143,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 3 } + PARAMS { 9 1 11 4 } } } FILLVALUE { |