diff options
author | Vailin Choi <vchoi@hdfgroup.org> | 2013-08-22 20:44:25 (GMT) |
---|---|---|
committer | Vailin Choi <vchoi@hdfgroup.org> | 2013-08-22 20:44:25 (GMT) |
commit | 1220779c318ab305b956833131e5be9027f07cfe (patch) | |
tree | 5a49a2ac01fca56f1e0f9fb998c3aa8fbc703466 /hl | |
parent | 4df44aafaf8572814e705d0f259da2c0d081aae4 (diff) | |
download | hdf5-1220779c318ab305b956833131e5be9027f07cfe.zip hdf5-1220779c318ab305b956833131e5be9027f07cfe.tar.gz hdf5-1220779c318ab305b956833131e5be9027f07cfe.tar.bz2 |
[svn-r24060] Bring revisions #24002 - 24029 from trunk to revise_chunks.
h5committested.
Diffstat (limited to 'hl')
-rw-r--r-- | hl/c++/examples/CMakeLists.txt | 2 | ||||
-rw-r--r-- | hl/c++/examples/CMakeTests.cmake | 8 | ||||
-rw-r--r-- | hl/c++/test/CMakeLists.txt | 36 | ||||
-rw-r--r-- | hl/c++/test/CMakeTests.cmake | 8 | ||||
-rw-r--r-- | hl/examples/CMakeLists.txt | 36 | ||||
-rw-r--r-- | hl/examples/CMakeTests.cmake | 28 | ||||
-rw-r--r-- | hl/fortran/examples/CMakeLists.txt | 10 | ||||
-rw-r--r-- | hl/fortran/examples/CMakeTests.cmake | 10 | ||||
-rw-r--r-- | hl/fortran/src/H5LTf90proto.h | 11 | ||||
-rw-r--r-- | hl/fortran/test/CMakeLists.txt | 22 | ||||
-rw-r--r-- | hl/fortran/test/CMakeTests.cmake | 28 | ||||
-rw-r--r-- | hl/src/H5DS.c | 8 | ||||
-rw-r--r-- | hl/src/H5LT.c | 1 | ||||
-rw-r--r-- | hl/src/H5LTprivate.h | 1 | ||||
-rw-r--r-- | hl/test/CMakeLists.txt | 70 | ||||
-rw-r--r-- | hl/test/CMakeTests.cmake | 70 | ||||
-rw-r--r-- | hl/test/test_ds.c | 2 | ||||
-rw-r--r-- | hl/test/test_lite.c | 4 | ||||
-rw-r--r-- | hl/tools/CMakeLists.txt | 30 | ||||
-rw-r--r-- | hl/tools/CMakeTests.cmake | 40 |
20 files changed, 253 insertions, 172 deletions
diff --git a/hl/c++/examples/CMakeLists.txt b/hl/c++/examples/CMakeLists.txt index aa4221f..f762839 100644 --- a/hl/c++/examples/CMakeLists.txt +++ b/hl/c++/examples/CMakeLists.txt @@ -22,5 +22,5 @@ TARGET_LINK_LIBRARIES ( SET_TARGET_PROPERTIES (ptExampleFL PROPERTIES FOLDER examples/hl/cpp) IF (BUILD_TESTING) - ADD_TEST (NAME cpp_hl_ex_ptExampleFL COMMAND $<TARGET_FILE:ptExampleFL>) + INCLUDE (CMakeTests.cmake) ENDIF (BUILD_TESTING) diff --git a/hl/c++/examples/CMakeTests.cmake b/hl/c++/examples/CMakeTests.cmake new file mode 100644 index 0000000..95cc8b4 --- /dev/null +++ b/hl/c++/examples/CMakeTests.cmake @@ -0,0 +1,8 @@ + +############################################################################## +############################################################################## +### T E S T I N G ### +############################################################################## +############################################################################## + +ADD_TEST (NAME cpp_hl_ex_ptExampleFL COMMAND $<TARGET_FILE:ptExampleFL>) diff --git a/hl/c++/test/CMakeLists.txt b/hl/c++/test/CMakeLists.txt index 6633426..46229ba 100644 --- a/hl/c++/test/CMakeLists.txt +++ b/hl/c++/test/CMakeLists.txt @@ -11,23 +11,21 @@ INCLUDE_DIRECTORIES (${HDF5_HL_SRC_DIR}/c++/src) # Add in the unit tests for the packet table c++ wrapper # -------------------------------------------------------------------- -IF (BUILD_TESTING) - INCLUDE_DIRECTORIES (${HDF5_TEST_SRC_DIR}) - INCLUDE_DIRECTORIES (${HDF5_HL_SRC_DIR}/test) - INCLUDE_DIRECTORIES (${HDF5_CPP_SRC_DIR}/src) +INCLUDE_DIRECTORIES (${HDF5_TEST_SRC_DIR}) +INCLUDE_DIRECTORIES (${HDF5_HL_SRC_DIR}/test) +INCLUDE_DIRECTORIES (${HDF5_CPP_SRC_DIR}/src) - ADD_EXECUTABLE (hl_ptableTest ${HDF5_HL_CPP_TEST_SOURCE_DIR}/ptableTest.cpp) - TARGET_C_PROPERTIES (hl_ptableTest " " " ") - TARGET_NAMING (hl_ptableTest ${LIB_TYPE}) - TARGET_LINK_LIBRARIES ( - hl_ptableTest - ${HDF5_LIB_TARGET} - ${HDF5_TEST_LIB_TARGET} - ${HDF5_CPP_LIB_TARGET} - ${HDF5_HL_LIB_TARGET} - ${HDF5_HL_CPP_LIB_TARGET} - ) - SET_TARGET_PROPERTIES (hl_ptableTest PROPERTIES FOLDER test/hl/cpp) - - ADD_TEST (NAME hl_ptableTest COMMAND $<TARGET_FILE:hl_ptableTest>) -ENDIF (BUILD_TESTING) +ADD_EXECUTABLE (hl_ptableTest ${HDF5_HL_CPP_TEST_SOURCE_DIR}/ptableTest.cpp) +TARGET_C_PROPERTIES (hl_ptableTest " " " ") +TARGET_NAMING (hl_ptableTest ${LIB_TYPE}) +TARGET_LINK_LIBRARIES ( + hl_ptableTest + ${HDF5_LIB_TARGET} + ${HDF5_TEST_LIB_TARGET} + ${HDF5_CPP_LIB_TARGET} + ${HDF5_HL_LIB_TARGET} + ${HDF5_HL_CPP_LIB_TARGET} +) +SET_TARGET_PROPERTIES (hl_ptableTest PROPERTIES FOLDER test/hl/cpp) + +INCLUDE (CMakeTests.cmake) diff --git a/hl/c++/test/CMakeTests.cmake b/hl/c++/test/CMakeTests.cmake new file mode 100644 index 0000000..cb9454b --- /dev/null +++ b/hl/c++/test/CMakeTests.cmake @@ -0,0 +1,8 @@ + +############################################################################## +############################################################################## +### T E S T I N G ### +############################################################################## +############################################################################## + + ADD_TEST (NAME hl_ptableTest COMMAND $<TARGET_FILE:hl_ptableTest>) diff --git a/hl/examples/CMakeLists.txt b/hl/examples/CMakeLists.txt index b702754..36c799d 100644 --- a/hl/examples/CMakeLists.txt +++ b/hl/examples/CMakeLists.txt @@ -1,20 +1,6 @@ cmake_minimum_required (VERSION 2.8.10) PROJECT (HDF5_HL_EXAMPLES ) -SET (HDF5_TEST_FILES -) - -FOREACH (h5_file ${HDF5_TEST_FILES}) - SET (dest "${PROJECT_BINARY_DIR}/${h5_file}") - #MESSAGE (STATUS " Copying ${h5_file}") - ADD_CUSTOM_COMMAND ( - TARGET h5dump - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/${h5_file} ${dest} - ) -ENDFOREACH (h5_file ${HDF5_TEST_FILES}) - #----------------------------------------------------------------------------- # Define Sources #----------------------------------------------------------------------------- @@ -46,30 +32,10 @@ FOREACH (example ${examples}) TARGET_C_PROPERTIES (hl_ex_${example} " " " ") TARGET_LINK_LIBRARIES (hl_ex_${example} ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET}) SET_TARGET_PROPERTIES (hl_ex_${example} PROPERTIES FOLDER examples/hl) - - IF (BUILD_TESTING) - ADD_TEST (NAME hl_ex_${example} COMMAND $<TARGET_FILE:hl_ex_${example}>) - ENDIF (BUILD_TESTING) ENDFOREACH (example ${examples}) IF (BUILD_TESTING) - SET_TESTS_PROPERTIES (hl_ex_ex_lite2 PROPERTIES DEPENDS hl_ex_ex_lite1) -ENDIF (BUILD_TESTING) -IF (BUILD_TESTING) - SET (HDF5_TEST_FILES - image24pixel.txt - image8.txt - ) + INCLUDE (CMakeTests.cmake) - FOREACH (h5_file ${HDF5_TEST_FILES}) - SET (dest "${PROJECT_BINARY_DIR}/${h5_file}") - #MESSAGE (STATUS " Copying ${h5_file}") - ADD_CUSTOM_COMMAND ( - TARGET hl_ex_ex_ds1 - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/${h5_file} ${dest} - ) - ENDFOREACH (h5_file ${HDF5_TEST_FILES}) ENDIF (BUILD_TESTING) diff --git a/hl/examples/CMakeTests.cmake b/hl/examples/CMakeTests.cmake new file mode 100644 index 0000000..e1ccba0 --- /dev/null +++ b/hl/examples/CMakeTests.cmake @@ -0,0 +1,28 @@ + +############################################################################## +############################################################################## +### T E S T I N G ### +############################################################################## +############################################################################## + +SET (HDF5_TEST_FILES + image24pixel.txt + image8.txt +) + +FOREACH (h5_file ${HDF5_TEST_FILES}) + SET (dest "${PROJECT_BINARY_DIR}/${h5_file}") + #MESSAGE (STATUS " Copying ${h5_file}") + ADD_CUSTOM_COMMAND ( + TARGET hl_ex_ex_ds1 + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/${h5_file} ${dest} + ) +ENDFOREACH (h5_file ${HDF5_TEST_FILES}) + +FOREACH (example ${examples}) + ADD_TEST (NAME hl_ex_${example} COMMAND $<TARGET_FILE:hl_ex_${example}>) +ENDFOREACH (example ${examples}) + +SET_TESTS_PROPERTIES (hl_ex_ex_lite2 PROPERTIES DEPENDS hl_ex_ex_lite1) diff --git a/hl/fortran/examples/CMakeLists.txt b/hl/fortran/examples/CMakeLists.txt index df7fd24..0f663c7 100644 --- a/hl/fortran/examples/CMakeLists.txt +++ b/hl/fortran/examples/CMakeLists.txt @@ -27,8 +27,10 @@ FOREACH (example ${examples}) SET_TARGET_PROPERTIES (hl_f90_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran) SET_TARGET_PROPERTIES (hl_f90_ex_${example} PROPERTIES FOLDER examples/hl/fortran) - IF (BUILD_TESTING) - ADD_TEST (NAME hl_f90_ex_${example} COMMAND $<TARGET_FILE:hl_f90_ex_${example}>) - ENDIF (BUILD_TESTING) - ENDFOREACH (example ${examples}) + +IF (BUILD_TESTING) + + INCLUDE (CMakeTests.cmake) + +ENDIF (BUILD_TESTING) diff --git a/hl/fortran/examples/CMakeTests.cmake b/hl/fortran/examples/CMakeTests.cmake new file mode 100644 index 0000000..7e6c348 --- /dev/null +++ b/hl/fortran/examples/CMakeTests.cmake @@ -0,0 +1,10 @@ + +############################################################################## +############################################################################## +### T E S T I N G ### +############################################################################## +############################################################################## + +FOREACH (example ${examples}) + ADD_TEST (NAME hl_f90_ex_${example} COMMAND $<TARGET_FILE:hl_f90_ex_${example}>) +ENDFOREACH (example ${examples}) diff --git a/hl/fortran/src/H5LTf90proto.h b/hl/fortran/src/H5LTf90proto.h index 8618fc6..332a7e2 100644 --- a/hl/fortran/src/H5LTf90proto.h +++ b/hl/fortran/src/H5LTf90proto.h @@ -212,10 +212,6 @@ nh5dsattach_scale_c( hid_t_f *did, hid_t_f *dsid, int_f *idx); HDF5_HL_F90CSTUBDLL int_f -nh5dsattach_scale_c( hid_t_f *did, hid_t_f *dsid, int_f *idx); - -HDF5_HL_F90CSTUBDLL -int_f nh5dsdetach_scale_c( hid_t_f *did, hid_t_f *dsid, int_f *idx); HDF5_HL_F90CSTUBDLL @@ -224,16 +220,15 @@ nh5dsis_attached_c( hid_t_f *did, hid_t_f *dsid, int_f *idx, int_f *c_is_attache HDF5_HL_F90CSTUBDLL int_f -nh5dsget_label_c(hid_t_f *did, int_f *idx, _fcd label, size_t_f *size); +nh5dsis_scale_c(hid_t_f *did, int_f *is_scale); HDF5_HL_F90CSTUBDLL int_f -nh5dsis_scale_c(hid_t_f *did, int_f *is_scale); - +nh5dsset_label_c(hid_t_f *did, int_f *idx, _fcd label, int_f *labellen); HDF5_HL_F90CSTUBDLL int_f -nh5dsset_label_c(hid_t_f *did, int_f *idx, _fcd label, int_f *labellen); +nh5dsget_label_c(hid_t_f *did, int_f *idx, _fcd label, size_t_f *size); HDF5_HL_F90CSTUBDLL int_f diff --git a/hl/fortran/test/CMakeLists.txt b/hl/fortran/test/CMakeLists.txt index 7e7aa1d..2084162 100644 --- a/hl/fortran/test/CMakeLists.txt +++ b/hl/fortran/test/CMakeLists.txt @@ -6,20 +6,6 @@ PROJECT (HDF5_HL_FORTRAN_TESTS C CXX Fortran) #----------------------------------------------------------------------------- INCLUDE_DIRECTORIES (${CMAKE_Fortran_MODULE_DIRECTORY} ${HDF5_F90_BINARY_DIR} ${HDF5_F90_SRC_DIR}/src) -# Remove any output file left over from previous test run -ADD_TEST ( - NAME hl_fortran_test-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - dsetf1.h5 - dsetf2.h5 - dsetf3.h5 - dsetf4.h5 - dsetf5.h5 - f1image.h5 - f1tab.h5 -) - #-- Adding test for hl_f90_tstds ADD_EXECUTABLE (hl_f90_tstds tstds.f90) TARGET_NAMING (hl_f90_tstds ${LIB_TYPE}) @@ -28,8 +14,6 @@ TARGET_LINK_LIBRARIES (hl_f90_tstds ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TAR SET_TARGET_PROPERTIES (hl_f90_tstds PROPERTIES LINKER_LANGUAGE Fortran) SET_TARGET_PROPERTIES (hl_f90_tstds PROPERTIES FOLDER test/hl/fortran) -ADD_TEST (NAME hl_f90_tstds COMMAND $<TARGET_FILE:hl_f90_tstds>) - #-- Adding test for hl_f90_tstlite ADD_EXECUTABLE (hl_f90_tstlite tstlite.f90) TARGET_NAMING (hl_f90_tstlite ${LIB_TYPE}) @@ -38,8 +22,6 @@ TARGET_LINK_LIBRARIES (hl_f90_tstlite ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_T SET_TARGET_PROPERTIES (hl_f90_tstlite PROPERTIES LINKER_LANGUAGE Fortran) SET_TARGET_PROPERTIES (hl_f90_tstlite PROPERTIES FOLDER test/hl/fortran) -ADD_TEST (NAME hl_f90_tstlite COMMAND $<TARGET_FILE:hl_f90_tstlite>) - #-- Adding test for hl_f90_tstimage ADD_EXECUTABLE (hl_f90_tstimage tstimage.f90) TARGET_NAMING (hl_f90_tstimage ${LIB_TYPE}) @@ -48,8 +30,6 @@ TARGET_LINK_LIBRARIES (hl_f90_tstimage ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB SET_TARGET_PROPERTIES (hl_f90_tstimage PROPERTIES LINKER_LANGUAGE Fortran) SET_TARGET_PROPERTIES (hl_f90_tstimage PROPERTIES FOLDER test/hl/fortran) -ADD_TEST (NAME hl_f90_tstimage COMMAND $<TARGET_FILE:hl_f90_tstimage>) - #-- Adding test for hl_f90_tsttable ADD_EXECUTABLE (hl_f90_tsttable tsttable.f90) TARGET_NAMING (hl_f90_tsttable ${LIB_TYPE}) @@ -58,4 +38,4 @@ TARGET_LINK_LIBRARIES (hl_f90_tsttable ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_ SET_TARGET_PROPERTIES (hl_f90_tsttable PROPERTIES LINKER_LANGUAGE Fortran) SET_TARGET_PROPERTIES (hl_f90_tsttable PROPERTIES FOLDER test/hl/fortran) -ADD_TEST (NAME hl_f90_tsttable COMMAND $<TARGET_FILE:hl_f90_tsttable>) +INCLUDE (CMakeTests.cmake) diff --git a/hl/fortran/test/CMakeTests.cmake b/hl/fortran/test/CMakeTests.cmake new file mode 100644 index 0000000..96209aa --- /dev/null +++ b/hl/fortran/test/CMakeTests.cmake @@ -0,0 +1,28 @@ + +############################################################################## +############################################################################## +### T E S T I N G ### +############################################################################## +############################################################################## + +# Remove any output file left over from previous test run +ADD_TEST ( + NAME hl_fortran_test-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + dsetf1.h5 + dsetf2.h5 + dsetf3.h5 + dsetf4.h5 + dsetf5.h5 + f1image.h5 + f1tab.h5 +) + +ADD_TEST (NAME hl_f90_tstds COMMAND $<TARGET_FILE:hl_f90_tstds>) + +ADD_TEST (NAME hl_f90_tstlite COMMAND $<TARGET_FILE:hl_f90_tstlite>) + +ADD_TEST (NAME hl_f90_tstimage COMMAND $<TARGET_FILE:hl_f90_tstimage>) + +ADD_TEST (NAME hl_f90_tsttable COMMAND $<TARGET_FILE:hl_f90_tsttable>) diff --git a/hl/src/H5DS.c b/hl/src/H5DS.c index cb3a1ce..5f8cd50 100644 --- a/hl/src/H5DS.c +++ b/hl/src/H5DS.c @@ -1872,12 +1872,9 @@ ssize_t H5DSget_scale_name(hid_t did, if (H5Sclose(sid) < 0) goto out; if (buf) - { free(buf); - buf=NULL; - } - return (ssize_t) MAX(0,nbytes-1); + return (ssize_t)(nbytes - 1); /* error zone */ out: @@ -1887,10 +1884,7 @@ out: H5Sclose(sid); } H5E_END_TRY; if (buf) - { free(buf); - buf=NULL; - } return FAIL; } diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c index b2c8949..98f2ff2 100644 --- a/hl/src/H5LT.c +++ b/hl/src/H5LT.c @@ -2161,7 +2161,6 @@ out: */ hid_t H5LTtext_to_dtype(const char *text, H5LT_lang_t lang_type) { - extern int H5LTyyparse(void); hid_t type_id; if(lang_type <= H5LT_LANG_ERR || lang_type >= H5LT_NO_LANG) diff --git a/hl/src/H5LTprivate.h b/hl/src/H5LTprivate.h index 69616b1..0ee6b5c 100644 --- a/hl/src/H5LTprivate.h +++ b/hl/src/H5LTprivate.h @@ -48,5 +48,6 @@ H5_HLDLL herr_t H5LT_find_attribute( hid_t loc_id, const char *name ); H5_HLDLL char* H5LT_dtype_to_text(hid_t dtype, char *dt_str, H5LT_lang_t lang, size_t *slen, hbool_t no_user_buf); +H5_HLDLL int H5LTyyparse(void); #endif diff --git a/hl/test/CMakeLists.txt b/hl/test/CMakeLists.txt index 9cb61e0..f969dbf 100644 --- a/hl/test/CMakeLists.txt +++ b/hl/test/CMakeLists.txt @@ -20,7 +20,7 @@ INCLUDE_DIRECTORIES (${HDF5_TEST_SRC_DIR}) # -------------------------------------------------------------------- # Macro used to add a unit test # -------------------------------------------------------------------- -MACRO (HL_ADD_TEST hl_name files) +MACRO (HL_ADD_EXE hl_name) ADD_EXECUTABLE (hl_${hl_name} ${hl_name}.c) TARGET_NAMING (hl_${hl_name} ${LIB_TYPE}) TARGET_C_PROPERTIES (hl_${hl_name} " " " ") @@ -30,66 +30,14 @@ MACRO (HL_ADD_TEST hl_name files) ${HDF5_TEST_LIB_TARGET} ) SET_TARGET_PROPERTIES (hl_${hl_name} PROPERTIES FOLDER test/hl) +ENDMACRO (HL_ADD_EXE) - ADD_TEST (NAME hl_${hl_name} COMMAND $<TARGET_FILE:hl_${hl_name}>) - IF (NOT "${last_test}" STREQUAL "") - SET_TESTS_PROPERTIES (hl_${hl_name} PROPERTIES DEPENDS ${last_test}) - ENDIF (NOT "${last_test}" STREQUAL "") - - # -------------------------------------------------------------------- - #-- Copy the necessary files. - # -------------------------------------------------------------------- - FOREACH (h5_file ${files}) - SET (dest "${HDF5_HL_TEST_BINARY_DIR}/${h5_file}") - #MESSAGE (STATUS " Copying HL Test File ${h5_file} to ${dest}") - ADD_CUSTOM_COMMAND ( - TARGET hl_${hl_name} - PRE_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${HDF5_HL_TEST_SOURCE_DIR}/${h5_file} ${dest} - ) - - ENDFOREACH (h5_file ${HL_REFERENCE_TEST_FILES}) -ENDMACRO (HL_ADD_TEST) - -# Remove any output file left over from previous test run -ADD_TEST ( - NAME hl_test-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - combine_tables1.h5 - combine_tables2.h5 - test_detach.h5 - test_ds1.h5 - test_ds2.h5 - test_ds3.h5 - test_ds4.h5 - test_ds5.h5 - test_ds6.h5 - test_ds7.h5 - test_ds8.h5 - test_ds9.h5 - test_dectris.h5 - test_image1.h5 - test_image2.h5 - test_image3.h5 - test_lite1.h5 - test_lite2.h5 - test_packet_compress.h5 - test_packet_table.h5 - test_table.h5 -) -IF (NOT "${last_test}" STREQUAL "") - SET_TESTS_PROPERTIES (hl_test-clear-objects PROPERTIES DEPENDS ${last_test}) -ENDIF (NOT "${last_test}" STREQUAL "") -SET (last_test "hl_test-clear-objects") - -HL_ADD_TEST (test_ds "dsdata.txt;dslat.txt;dslon.txt;test_ds_be.h5;test_ds_le.h5") -HL_ADD_TEST (test_dset_opt "") -HL_ADD_TEST (test_image "image8.txt;sepia.pal;earth.pal;image24pixel.txt;image24plane.txt;usa.wri") -HL_ADD_TEST (test_lite "dtype_file.txt") -HL_ADD_TEST (test_packet "") -HL_ADD_TEST (test_table "test_table_be.h5;test_table_cray.h5;test_table_le.h5") +HL_ADD_EXE (test_ds) +HL_ADD_EXE (test_dset_opt) +HL_ADD_EXE (test_image) +HL_ADD_EXE (test_lite) +HL_ADD_EXE (test_packet) +HL_ADD_EXE (test_table) # -------------------------------------------------------------------- # This executable is used to generate test files for the test_ds test. @@ -106,3 +54,5 @@ IF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) ) SET_TARGET_PROPERTIES (hl_gen_test_ds PROPERTIES FOLDER test/hl/gen) ENDIF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) + +INCLUDE (CMakeTests.cmake) diff --git a/hl/test/CMakeTests.cmake b/hl/test/CMakeTests.cmake new file mode 100644 index 0000000..aa9c1c3 --- /dev/null +++ b/hl/test/CMakeTests.cmake @@ -0,0 +1,70 @@ + +############################################################################## +############################################################################## +### T E S T I N G ### +############################################################################## +############################################################################## + +# -------------------------------------------------------------------- +# Macro used to add a unit test +# -------------------------------------------------------------------- +MACRO (HL_ADD_TEST hl_name files) + ADD_TEST (NAME hl_${hl_name} COMMAND $<TARGET_FILE:hl_${hl_name}>) + IF (NOT "${last_test}" STREQUAL "") + SET_TESTS_PROPERTIES (hl_${hl_name} PROPERTIES DEPENDS ${last_test}) + ENDIF (NOT "${last_test}" STREQUAL "") + + # -------------------------------------------------------------------- + #-- Copy the necessary files. + # -------------------------------------------------------------------- + FOREACH (h5_file ${files}) + SET (dest "${HDF5_HL_TEST_BINARY_DIR}/${h5_file}") + #MESSAGE (STATUS " Copying HL Test File ${h5_file} to ${dest}") + ADD_CUSTOM_COMMAND ( + TARGET hl_${hl_name} + PRE_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different ${HDF5_HL_TEST_SOURCE_DIR}/${h5_file} ${dest} + ) + + ENDFOREACH (h5_file ${HL_REFERENCE_TEST_FILES}) +ENDMACRO (HL_ADD_TEST) + +# Remove any output file left over from previous test run +ADD_TEST ( + NAME hl_test-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + combine_tables1.h5 + combine_tables2.h5 + test_detach.h5 + test_ds1.h5 + test_ds2.h5 + test_ds3.h5 + test_ds4.h5 + test_ds5.h5 + test_ds6.h5 + test_ds7.h5 + test_ds8.h5 + test_ds9.h5 + test_dectris.h5 + test_image1.h5 + test_image2.h5 + test_image3.h5 + test_lite1.h5 + test_lite2.h5 + test_packet_compress.h5 + test_packet_table.h5 + test_table.h5 +) +IF (NOT "${last_test}" STREQUAL "") + SET_TESTS_PROPERTIES (hl_test-clear-objects PROPERTIES DEPENDS ${last_test}) +ENDIF (NOT "${last_test}" STREQUAL "") +SET (last_test "hl_test-clear-objects") + +HL_ADD_TEST (test_ds "dsdata.txt;dslat.txt;dslon.txt;test_ds_be.h5;test_ds_le.h5") +HL_ADD_TEST (test_dset_opt "") +HL_ADD_TEST (test_image "image8.txt;sepia.pal;earth.pal;image24pixel.txt;image24plane.txt;usa.wri") +HL_ADD_TEST (test_lite "dtype_file.txt") +HL_ADD_TEST (test_packet "") +HL_ADD_TEST (test_table "test_table_be.h5;test_table_cray.h5;test_table_le.h5") diff --git a/hl/test/test_ds.c b/hl/test/test_ds.c index 1bfa23f..57a2b89 100644 --- a/hl/test/test_ds.c +++ b/hl/test/test_ds.c @@ -3126,7 +3126,7 @@ static int test_simple(void) if(H5DSget_scale_name(dsid, name_out, (size_t)name_len+1) < 0) goto out; - if(HDstrncmp("Latitude set 0",name_out, sizeof(name_out))!=0) + if(HDstrncmp("Latitude set 0",name_out, name_len)!=0) goto out; if(name_out) { HDfree(name_out); diff --git a/hl/test/test_lite.c b/hl/test/test_lite.c index b649462..bcf6663 100644 --- a/hl/test/test_lite.c +++ b/hl/test/test_lite.c @@ -1812,7 +1812,6 @@ out: static int test_valid_path(void) { hid_t file_id, group; - herr_t status; htri_t path_valid; const char *data_string_in = "test"; @@ -1943,7 +1942,8 @@ static int test_valid_path(void) /* * Close the file. */ - status = H5Fclose (file_id); + if(H5Fclose (file_id) < 0) + goto out; /* Create another file for checking external links */ diff --git a/hl/tools/CMakeLists.txt b/hl/tools/CMakeLists.txt index 1deff23..256ff89 100644 --- a/hl/tools/CMakeLists.txt +++ b/hl/tools/CMakeLists.txt @@ -34,20 +34,24 @@ TARGET_C_PROPERTIES (h52gif " " " ") TARGET_LINK_LIBRARIES (h52gif ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) SET_TARGET_PROPERTIES (h52gif PROPERTIES FOLDER tools/hl) -# -------------------------------------------------------------------- -# This executable can generate the actual test files - Currently not -# used in the CMake Build system as we rely on the test files that are -# shipped with HDF5 source archives -# -------------------------------------------------------------------- -IF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) - ADD_EXECUTABLE (hl_h52gifgentest ${HDF5_HL_TOOLS_SOURCE_DIR}/gif2h5/h52gifgentst.c) - TARGET_NAMING (hl_h52gifgentest ${LIB_TYPE}) - TARGET_C_PROPERTIES (hl_h52gifgentest " " " ") - TARGET_LINK_LIBRARIES (hl_h52gifgentest ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET}) - SET_TARGET_PROPERTIES (hl_h52gifgentest PROPERTIES FOLDER generator/tools/hl) +IF (BUILD_TESTING) + # -------------------------------------------------------------------- + # This executable can generate the actual test files - Currently not + # used in the CMake Build system as we rely on the test files that are + # shipped with HDF5 source archives + # -------------------------------------------------------------------- + IF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) + ADD_EXECUTABLE (hl_h52gifgentest ${HDF5_HL_TOOLS_SOURCE_DIR}/gif2h5/h52gifgentst.c) + TARGET_NAMING (hl_h52gifgentest ${LIB_TYPE}) + TARGET_C_PROPERTIES (hl_h52gifgentest " " " ") + TARGET_LINK_LIBRARIES (hl_h52gifgentest ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET}) + SET_TARGET_PROPERTIES (hl_h52gifgentest PROPERTIES FOLDER generator/tools/hl) -# ADD_TEST (NAME hl_h52gifgentest COMMAND $<TARGET_FILE:hl_h52gifgentest>) -ENDIF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) +# ADD_TEST (NAME hl_h52gifgentest COMMAND $<TARGET_FILE:hl_h52gifgentest>) + ENDIF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) + + INCLUDE (CMakeTests.cmake) +ENDIF (BUILD_TESTING) #----------------------------------------------------------------------------- # Add file(s) to CMake Install diff --git a/hl/tools/CMakeTests.cmake b/hl/tools/CMakeTests.cmake new file mode 100644 index 0000000..9f987fd --- /dev/null +++ b/hl/tools/CMakeTests.cmake @@ -0,0 +1,40 @@ + +############################################################################## +############################################################################## +### T E S T I N G ### +############################################################################## +############################################################################## + +# Make testfiles dir under build dir +FILE (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") + +# +# copy test files from source to build dir +# + +ADD_CUSTOM_COMMAND ( + TARGET gif2h5 + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different ${HDF5_HL_TOOLS_SOURCE_DIR}/gif2h5/testfiles/image1.gif ${PROJECT_BINARY_DIR}/testfiles/image1.gif +) + +ADD_CUSTOM_COMMAND ( + TARGET h52gif + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different ${HDF5_HL_TOOLS_SOURCE_DIR}/gif2h5/testfiles/h52giftst.h5 ${PROJECT_BINARY_DIR}/testfiles/h52giftst.h5 +) + +# Remove any output file left over from previous test run +ADD_TEST ( + NAME HL_TOOLS-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + image1.gif + image1.h5 +) + +ADD_TEST (NAME HL_TOOLS_h52gif COMMAND $<TARGET_FILE:h52gif> testfiles/h52giftst.h5 image1.gif -i image) + +ADD_TEST (NAME HL_TOOLS_gif2h5 COMMAND $<TARGET_FILE:gif2h5> testfiles/image1.gif image1.h5) |