diff options
-rw-r--r-- | MANIFEST | 1 | ||||
-rw-r--r-- | config/cmake/ConfigureChecks.cmake | 17 | ||||
-rw-r--r-- | config/cmake/HDF5Tests.c | 2 | ||||
-rw-r--r-- | config/cmake/userblockTest.cmake | 120 | ||||
-rw-r--r-- | test/CMakeLists.txt | 3 | ||||
-rw-r--r-- | tools/h5copy/CMakeLists.txt | 152 | ||||
-rw-r--r-- | tools/h5import/CMakeLists.txt | 14 | ||||
-rw-r--r-- | tools/h5jam/CMakeLists.txt | 95 |
8 files changed, 282 insertions, 122 deletions
@@ -2009,6 +2009,7 @@ ./config/cmake/CTest.cmake ./config/cmake/grepTest.cmake ./config/cmake/runTest.cmake +./config/cmake/userblockTest.cmake ./config/cmake/vfdTest.cmake ./config/cmake/CTestCustom.cmake ./config/cmake/ConfigureChecks.cmake diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index e97912b..5bf0066 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -8,11 +8,9 @@ INCLUDE (${CMAKE_ROOT}/Modules/CheckIncludeFiles.cmake) INCLUDE (${CMAKE_ROOT}/Modules/CheckLibraryExists.cmake) INCLUDE (${CMAKE_ROOT}/Modules/CheckSymbolExists.cmake) INCLUDE (${CMAKE_ROOT}/Modules/CheckTypeSize.cmake) +INCLUDE (${CMAKE_ROOT}/Modules/CheckVariableExists.cmake) INCLUDE (${CMAKE_ROOT}/Modules/CheckFortranFunctionExists.cmake) -MESSAGE (STATUS "Configure Checks that still need to be implemented") -MESSAGE (STATUS " GetConsoleScreenBufferInfo function for Windows") - #----------------------------------------------------------------------------- # Always SET this for now IF we are on an OS X box #----------------------------------------------------------------------------- @@ -130,9 +128,9 @@ ENDMACRO (CHECK_LIBRARY_EXISTS_CONCAT) SET (WINDOWS) IF (WIN32) - IF (NOT UNIX AND NOT CYGWIN) + IF (NOT UNIX AND NOT CYGWIN AND NOT MINGW) SET (WINDOWS 1) - ENDIF (NOT UNIX AND NOT CYGWIN) + ENDIF (NOT UNIX AND NOT CYGWIN AND NOT MINGW) ENDIF (WIN32) #IF (WIN32) @@ -176,6 +174,7 @@ IF (WINDOWS) SET (H5_HAVE_LONGJMP 1) SET (H5_STDC_HEADERS 1) SET (H5_HAVE_GETHOSTNAME 1) + SET (H5_HAVE_GETCONSOLESCREENBUFFERINFO 1) SET (H5_HAVE_TIMEZONE 1) SET (H5_HAVE_FUNCTION 1) SET (H5_LONE_COLON 0) @@ -521,7 +520,7 @@ MACRO (HDF5_FUNCTION_TEST OTHER_TEST) ) ENDIF (LARGEFILE) - # (STATUS "Performing ${OTHER_TEST}") + #MESSAGE (STATUS "Performing ${OTHER_TEST}") TRY_COMPILE (${OTHER_TEST} ${CMAKE_BINARY_DIR} ${HDF5_RESOURCES_DIR}/HDF5Tests.c @@ -571,11 +570,11 @@ IF (NOT WINDOWS) LONE_COLON ) HDF5_FUNCTION_TEST (${test}) - IF (NOT CYGWIN) + ENDFOREACH (test) + IF (NOT CYGWIN AND NOT MINGW) HDF5_FUNCTION_TEST (HAVE_TIMEZONE) # HDF5_FUNCTION_TEST (HAVE_STAT_ST_BLOCKS) - ENDIF (NOT CYGWIN) - ENDFOREACH (test) + ENDIF (NOT CYGWIN AND NOT MINGW) ENDIF (NOT WINDOWS) #----------------------------------------------------------------------------- diff --git a/config/cmake/HDF5Tests.c b/config/cmake/HDF5Tests.c index 7fb5756..ea4a648 100644 --- a/config/cmake/HDF5Tests.c +++ b/config/cmake/HDF5Tests.c @@ -217,7 +217,9 @@ SIMPLE_TEST(struct tm tm; tm.tm_gmtoff=0); #ifdef HAVE_TIMEZONE +#ifdef HAVE_SYS_TIME_H #include <sys/time.h> +#endif #include <time.h> SIMPLE_TEST(timezone=0); diff --git a/config/cmake/userblockTest.cmake b/config/cmake/userblockTest.cmake new file mode 100644 index 0000000..5e8a808 --- /dev/null +++ b/config/cmake/userblockTest.cmake @@ -0,0 +1,120 @@ +# runTest.cmake executes a command and captures the output in a file. File is then compared +# against a reference file. Exit status of command can also be compared. + +# arguments checking +IF (NOT TEST_PROGRAM) + MESSAGE (FATAL_ERROR "Require TEST_PROGRAM tellub to be defined") +ENDIF (NOT TEST_PROGRAM) +IF (NOT TEST_GET_PROGRAM) + MESSAGE (FATAL_ERROR "Require TEST_GET_PROGRAM getub to be defined") +ENDIF (NOT TEST_GET_PROGRAM) +IF (NOT TEST_FOLDER) + MESSAGE ( FATAL_ERROR "Require TEST_FOLDER to be defined") +ENDIF (NOT TEST_FOLDER) +IF (NOT TEST_HFILE) + MESSAGE (FATAL_ERROR "Require TEST_HFILE the hdf file to be defined") +ENDIF (NOT TEST_HFILE) +IF (NOT TEST_UFILE) + MESSAGE (FATAL_ERROR "Require TEST_UFILE the ub file to be defined") +ENDIF (NOT TEST_UFILE) +IF (NOT TEST_CHECKUB) + MESSAGE (STATUS "Require TEST_CHECKUB - YES or NO - to be defined") +ENDIF (NOT TEST_CHECKUB) +#IF (NOT TEST_EXPECT) +# MESSAGE (STATUS "Require TEST_EXPECT to be defined") +#ENDIF (NOT TEST_EXPECT) +#IF (NOT TEST_OFILE) +# MESSAGE (FATAL_ERROR "Require TEST_OFILE the original hdf file to be defined") +#ENDIF (NOT TEST_OFILE) + +SET (TEST_U_STRING_LEN 0) +SET (TEST_O_STRING_LEN 0) +SET (TEST_H_STRING_LEN 0) +SET (TEST_STRING_SIZE 0) + +IF (TEST_CHECKUB STREQUAL "YES") + # find the length of the user block to check + #s1=`cat $ufile | wc -c | sed -e 's/ //g'` + FILE (STRINGS ${TEST_FOLDER}/${TEST_UFILE} TEST_U_STRING) + STRING (LENGTH ${TEST_U_STRING} TEST_U_STRING_LEN) + + # Get the size of the original user block, if any. + IF (TEST_OFILE) + # 'tellub' calls H5Fget_user_block to get the size + # of the user block + #s2=`$JAM_BIN/tellub $origfile` + EXECUTE_PROCESS ( + COMMAND ${TEST_PROGRAM} ${TEST_OFILE} + WORKING_DIRECTORY ${TEST_FOLDER} + RESULT_VARIABLE TEST_RESULT + OUTPUT_FILE ${TEST_HFILE}.len.txt + OUTPUT_VARIABLE TEST_ERROR + ERROR_VARIABLE TEST_ERROR + ) + IF (NOT ${TEST_RESULT} STREQUAL "0") + MESSAGE (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} ${TEST_OFILE} is: ${TEST_ERROR}") + ENDIF (NOT ${TEST_RESULT} STREQUAL "0") + FILE (READ ${TEST_HFILE}.len.txt TEST_O_STRING_LEN) + ENDIF (TEST_OFILE) + + MATH( EXPR TEST_STRING_SIZE "${TEST_U_STRING_LEN} + ${TEST_O_STRING_LEN}" ) + + IF (NOT TEST_O_STRING_LEN STREQUAL "0") + #$JAM_BIN/getub -c $s2 $origfile > $cmpfile + EXECUTE_PROCESS ( + COMMAND ${TEST_GET_PROGRAM} -c ${TEST_O_STRING_LEN} ${TEST_OFILE} + WORKING_DIRECTORY ${TEST_FOLDER} + RESULT_VARIABLE TEST_RESULT + OUTPUT_FILE ${TEST_UFILE}.cmp + OUTPUT_VARIABLE TEST_ERROR + ERROR_VARIABLE TEST_ERROR + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + #cat $ufile >> $cmpfile + FILE (STRINGS ${TEST_UFILE} TEST_STREAM NEWLINE_CONSUME) + FILE (APPEND ${TEST_UFILE}.cmp "${TEST_STREAM}") + ELSE (NOT TEST_O_STRING_LEN STREQUAL "0") + FILE (STRINGS ${TEST_UFILE} TEST_STREAM NEWLINE_CONSUME) + FILE (WRITE ${TEST_UFILE}.cmp ${TEST_STREAM}) + ENDIF (NOT TEST_O_STRING_LEN STREQUAL "0") + + #$JAM_BIN/getub -c $size $hfile > $tfile + EXECUTE_PROCESS ( + COMMAND ${TEST_GET_PROGRAM} -c ${TEST_STRING_SIZE} ${TEST_HFILE} + WORKING_DIRECTORY ${TEST_FOLDER} + RESULT_VARIABLE TEST_RESULT + OUTPUT_FILE ${TEST_HFILE}.cmp + OUTPUT_VARIABLE TEST_ERROR + ERROR_VARIABLE TEST_ERROR + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + + # now compare the outputs + EXECUTE_PROCESS ( + COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_UFILE}.cmp ${TEST_HFILE}.cmp + RESULT_VARIABLE TEST_RESULT + ) + + MESSAGE (STATUS "COMPARE Result: ${TEST_RESULT}: ${TEST_STRING_SIZE}=${TEST_U_STRING_LEN}+${TEST_O_STRING_LEN}") + # if the return value is !=${TEST_EXPECT} bail out + IF (NOT ${TEST_RESULT} STREQUAL ${TEST_EXPECT}) + MESSAGE (FATAL_ERROR "Failed: The output of ${TEST_UFILE} did not match ${TEST_HFILE}.\n${TEST_ERROR}") + ENDIF (NOT ${TEST_RESULT} STREQUAL ${TEST_EXPECT}) +ELSE (TEST_CHECKUB STREQUAL "YES") + # call 'ubsize' to get the size of the user block + #ubsize=`$JAM_BIN/tellub $hfile` + EXECUTE_PROCESS ( + COMMAND ${TEST_PROGRAM} ${TEST_HFILE} + WORKING_DIRECTORY ${TEST_FOLDER} + RESULT_VARIABLE TEST_H_STRING_LEN + OUTPUT_VARIABLE TEST_ERROR + ERROR_VARIABLE TEST_ERROR + ) + IF (NOT TEST_H_STRING_LEN STREQUAL "0") + MESSAGE (FATAL_ERROR "Failed: The output of ${TEST_HFILE} was NOT empty") + ENDIF (NOT TEST_H_STRING_LEN STREQUAL "0") +ENDIF (TEST_CHECKUB STREQUAL "YES") + +# everything went fine... +MESSAGE ("Passed: The output of CHECK matched expectation") + diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index b8b8ef6..8cb55a6 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -25,6 +25,9 @@ ADD_LIBRARY (${HDF5_TEST_LIB_TARGET} ${LIB_TYPE} ${TEST_LIB_SRCS} ${TEST_LIB_HEA IF (MSVC) TARGET_LINK_LIBRARIES (${HDF5_TEST_LIB_TARGET} "ws2_32.lib") ENDIF (MSVC) +IF (MINGW) + TARGET_LINK_LIBRARIES (${HDF5_TEST_LIB_TARGET} "wsock32.lib") +ENDIF (MINGW) TARGET_LINK_LIBRARIES (${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) SET_GLOBAL_VARIABLE (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_TEST_LIB_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_TEST_LIB_TARGET} ${HDF5_TEST_LIB_NAME} ${LIB_TYPE}) diff --git a/tools/h5copy/CMakeLists.txt b/tools/h5copy/CMakeLists.txt index 8a6ca11..b15f5c1 100644 --- a/tools/h5copy/CMakeLists.txt +++ b/tools/h5copy/CMakeLists.txt @@ -70,6 +70,13 @@ IF (BUILD_TESTING) ) ENDFOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES}) + ADD_CUSTOM_COMMAND ( + TARGET h5copy + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different ${HDF5_TOOLS_H5COPY_SOURCE_DIR}/testfiles/h5copytst.h5 ${PROJECT_BINARY_DIR}/h5copytst.h5 + ) + ############################################################################## ############################################################################## ### T H E T E S T S M A C R O S ### @@ -79,44 +86,44 @@ IF (BUILD_TESTING) # # Perform h5copy according to passing parmeters # - MACRO (ADD_H5COPY_TEST testname resultcode infile outfile vparam srcname dstname) + MACRO (ADD_H5_F_TEST testname resultcode infile outfile fparam vparam sparam srcname dparam dstname) + ADD_TEST ( + NAME H5COPY_F-${testname} + COMMAND $<TARGET_FILE:h5copy> -f ${fparam} -i ./testfiles/${infile} -o ./testfiles/${outfile} ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN} + ) + IF (NOT "${last_test}" STREQUAL "") + SET_TESTS_PROPERTIES (H5COPY_F-${testname} PROPERTIES DEPENDS ${last_test}) + ENDIF (NOT "${last_test}" STREQUAL "") + SET (last_test "H5COPY_F-${testname}") + ADD_H5_DIFF_TEST (${testname} ${resultcode} ${last_test} ${infile} ${outfile} ${srcname} ${dstname}) + ENDMACRO (ADD_H5_F_TEST) - IF (NOT "${ARGN}" STREQUAL "") - ADD_TEST ( - NAME H5COPY-${testname} - COMMAND $<TARGET_FILE:h5copy> -f ${ARGN} -i ./testfiles/${infile} -o ./testfiles/${outfile} -${vparam} -s ${srcname} -d ${dstname} - ) - ELSE (NOT "${ARGN}" STREQUAL "") - ADD_TEST ( - NAME H5COPY-${testname} - COMMAND $<TARGET_FILE:h5copy> -i ./testfiles/${infile} -o ./testfiles/${outfile} -${vparam} -s ${srcname} -d ${dstname} - ) - ENDIF (NOT "${ARGN}" STREQUAL "") + MACRO (ADD_H5_TEST testname resultcode infile outfile vparam sparam srcname dparam dstname) + ADD_TEST ( + NAME H5COPY-${testname} + COMMAND $<TARGET_FILE:h5copy> -i ./testfiles/${infile} -o ./testfiles/${outfile} ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN} + ) IF (NOT "${last_test}" STREQUAL "") SET_TESTS_PROPERTIES (H5COPY-${testname} PROPERTIES DEPENDS ${last_test}) ENDIF (NOT "${last_test}" STREQUAL "") SET (last_test "H5COPY-${testname}") + ADD_H5_DIFF_TEST (${testname} ${resultcode} ${last_test} ${infile} ${outfile} ${srcname} ${dstname}) + ENDMACRO (ADD_H5_TEST) + + MACRO (ADD_H5_DIFF_TEST testname resultcode testdepends infile outfile srcname dstname) # resultcode=2 will cause the test to skip the diff test IF (NOT ${resultcode} STREQUAL "2") ADD_TEST ( NAME H5COPY-DIFF_${testname} COMMAND $<TARGET_FILE:h5diff> -q ./testfiles/${infile} ./testfiles/${outfile} ${srcname} ${dstname} ) - SET_TESTS_PROPERTIES(H5COPY-DIFF_${testname} PROPERTIES DEPENDS H5COPY-${testname}) + SET_TESTS_PROPERTIES(H5COPY-DIFF_${testname} PROPERTIES DEPENDS ${testdepends}) SET (last_test "H5COPY-DIFF_${testname}") IF (${resultcode} STREQUAL "1") SET_TESTS_PROPERTIES (H5COPY-DIFF_${testname} PROPERTIES WILL_FAIL "true") ENDIF (${resultcode} STREQUAL "1") ENDIF (NOT ${resultcode} STREQUAL "2") - ENDMACRO (ADD_H5COPY_TEST) - - # - # call ADD_H5COPY_TEST macro with assumption that source and target file - # is different - # - MACRO (ADD_H5_TEST testname resultcode testfile vparam srcname dstname) - ADD_H5COPY_TEST (${testname} ${resultcode} ${testfile}.h5 ${testfile}.out.h5 ${vparam} ${srcname} ${dstname} ${ARGN}) - ENDMACRO (ADD_H5_TEST testname resultcode testfile vparam srcname dstname) + ENDMACRO (ADD_H5_DIFF_TEST) # # Test result with h5ls @@ -143,16 +150,16 @@ IF (BUILD_TESTING) SET_TESTS_PROPERTIES (H5COPY-H5LS_${file}-${filetest} PROPERTIES DEPENDS ${last_test}) ENDIF (NOT "${last_test}" STREQUAL "") SET (last_test "H5COPY-H5LS_${file}-${filetest}") - ENDMACRO (ADD_H5LS_TEST file filetest) + ENDMACRO (ADD_H5LS_TEST) # # Similiar to ADD_H5_TEST macro. Compare to outputs from source & target # files instead of checking with h5ls. # - MACRO (ADD_H5_CMP_TEST testname resultcode testfile vparam srcname dstname) + MACRO (ADD_H5_CMP_TEST testname resultcode infile outfile vparam sparam srcname dparam dstname) # If using memchecker add tests without using scripts IF (HDF5_ENABLE_USING_MEMCHECKER) - ADD_TEST (NAME H5COPY-CMP-${testname} COMMAND $<TARGET_FILE:h5copy> -i ${testfile}.h5 -o ./testfiles/${testfile}.out.h5 -${vparam} -s ${srcname} -d ${dstname}) + ADD_TEST (NAME H5COPY-CMP-${testname} COMMAND $<TARGET_FILE:h5copy> -i ${infile} -o ./testfiles/${outfile} ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN}) IF (${resultcode} STREQUAL "1") SET_TESTS_PROPERTIES (H5COPY-CMP-${testname} PROPERTIES WILL_FAIL "true") ENDIF (${resultcode} STREQUAL "1") @@ -161,7 +168,7 @@ IF (BUILD_TESTING) NAME H5COPY-CMP-${testname} COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$<TARGET_FILE:h5copy>" - -D "TEST_ARGS=-i;${testfile}.h5;-o;./testfiles/${testfile}.out.h5;-${vparam};-s;${srcname};-d;${dstname}" + -D "TEST_ARGS=-i;${infile};-o;./testfiles/${outfile};${vparam};${sparam};${srcname};${dparam};${dstname}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=./testfiles/${testname}.out.out" -D "TEST_EXPECT=${resultcode}" @@ -174,7 +181,7 @@ IF (BUILD_TESTING) SET_TESTS_PROPERTIES (H5COPY-CMP-${testname} PROPERTIES DEPENDS ${last_test}) ENDIF (NOT "${last_test}" STREQUAL "") SET (last_test "H5COPY-CMP-${testname}") - ENDMACRO (ADD_H5_CMP_TEST testname resultcode testfile vparam srcname dstname) + ENDMACRO (ADD_H5_CMP_TEST) ############################################################################## ############################################################################## @@ -189,7 +196,6 @@ IF (BUILD_TESTING) SET (HDF_FILE2 h5copy_ref) SET (HDF_EXT_SRC_FILE h5copy_extlinks_src) SET (HDF_EXT_TRG_FILE h5copy_extlinks_trg) - SET (HDF_FILE1_TMP h5copytst_tmp) # Remove any output file left over from previous test run ADD_TEST ( @@ -212,40 +218,40 @@ IF (BUILD_TESTING) SET (last_test "H5COPY-clearall-objects") # "Test copying various forms of datasets" - ADD_H5_TEST (simple 0 ${HDF_FILE1} v simple simple) - ADD_H5_TEST (chunk 0 ${HDF_FILE1} v chunk chunk) - ADD_H5_TEST (compact 0 ${HDF_FILE1} v compact compact) - ADD_H5_TEST (compound 0 ${HDF_FILE1} v compound compound) - ADD_H5_TEST (compressed 0 ${HDF_FILE1} v compressed compressed) - ADD_H5_TEST (named_vl 0 ${HDF_FILE1} v named_vl named_vl) - ADD_H5_TEST (nested_vl 0 ${HDF_FILE1} v nested_vl nested_vl) + ADD_H5_TEST (simple 0 ${HDF_FILE1}.h5 ${HDF_FILE1}.out.h5 -v -s simple -d simple) + ADD_H5_TEST (chunk 0 ${HDF_FILE1}.h5 ${HDF_FILE1}.out.h5 -v -s chunk -d chunk) + ADD_H5_TEST (compact 0 ${HDF_FILE1}.h5 ${HDF_FILE1}.out.h5 -v -s compact -d compact) + ADD_H5_TEST (compound 0 ${HDF_FILE1}.h5 ${HDF_FILE1}.out.h5 -v -s compound -d compound) + ADD_H5_TEST (compressed 0 ${HDF_FILE1}.h5 ${HDF_FILE1}.out.h5 -v -s compressed -d compressed) + ADD_H5_TEST (named_vl 0 ${HDF_FILE1}.h5 ${HDF_FILE1}.out.h5 -v -s named_vl -d named_vl) + ADD_H5_TEST (nested_vl 0 ${HDF_FILE1}.h5 ${HDF_FILE1}.out.h5 -v -s nested_vl -d nested_vl) # "Test copying dataset within group in source file to root of destination" - ADD_H5_TEST (simple_top 0 ${HDF_FILE1} v grp_dsets/simple simple_top) + ADD_H5_TEST (simple_top 0 ${HDF_FILE1}.h5 ${HDF_FILE1}.out.h5 -v -s grp_dsets/simple -d simple_top) # "Test copying & renaming dataset" - ADD_H5_TEST (rename 0 ${HDF_FILE1} v compound rename) + ADD_H5_TEST (rename 0 ${HDF_FILE1}.h5 ${HDF_FILE1}.out.h5 -v -s compound -d rename) # "Test copying empty, 'full' & 'nested' groups" - ADD_H5_TEST (grp_empty 0 ${HDF_FILE1} v grp_empty grp_empty) - ADD_H5_TEST (grp_dsets 0 ${HDF_FILE1} v grp_dsets grp_dsets) - ADD_H5_TEST (grp_nested 0 ${HDF_FILE1} v grp_nested grp_nested) + ADD_H5_TEST (grp_empty 0 ${HDF_FILE1}.h5 ${HDF_FILE1}.out.h5 -v -s grp_empty -d grp_empty) + ADD_H5_TEST (grp_dsets 0 ${HDF_FILE1}.h5 ${HDF_FILE1}.out.h5 -v -s grp_dsets -d grp_dsets) + ADD_H5_TEST (grp_nested 0 ${HDF_FILE1}.h5 ${HDF_FILE1}.out.h5 -v -s grp_nested -d grp_nested) # "Test copying dataset within group in source file to group in destination" - ADD_H5_TEST (simple_group 0 ${HDF_FILE1} v /grp_dsets/simple /grp_dsets/simple_group) + ADD_H5_TEST (simple_group 0 ${HDF_FILE1}.h5 ${HDF_FILE1}.out.h5 -v -s /grp_dsets/simple -d /grp_dsets/simple_group) # "Test copying & renaming group" - ADD_H5_TEST (grp_rename 0 ${HDF_FILE1} v grp_dsets grp_rename) + ADD_H5_TEST (grp_rename 0 ${HDF_FILE1}.h5 ${HDF_FILE1}.out.h5 -v -s grp_dsets -d grp_rename) # "Test copying 'full' group hierarchy into group in destination file" - ADD_H5_TEST (grp_dsets_rename 0 ${HDF_FILE1} v grp_dsets /grp_rename/grp_dsets) + ADD_H5_TEST (grp_dsets_rename 0 ${HDF_FILE1}.h5 ${HDF_FILE1}.out.h5 -v -s grp_dsets -d /grp_rename/grp_dsets) # "Test copying objects into group hier. that doesn't exist yet in destination file" - ADD_H5_TEST (A_B1_simple 0 ${HDF_FILE1} vp simple /A/B1/simple) - ADD_H5_TEST (A_B2_simple2 0 ${HDF_FILE1} vp simple /A/B2/simple2) - ADD_H5_TEST (C_D_simple 0 ${HDF_FILE1} vp /grp_dsets/simple /C/D/simple) - ADD_H5_TEST (E_F_grp_dsets 0 ${HDF_FILE1} vp /grp_dsets /E/F/grp_dsets) - ADD_H5_TEST (G_H_grp_nested 0 ${HDF_FILE1} vp /grp_nested /G/H/grp_nested) + ADD_H5_TEST (A_B1_simple 0 ${HDF_FILE1}.h5 ${HDF_FILE1}.out.h5 -vp -s simple -d /A/B1/simple) + ADD_H5_TEST (A_B2_simple2 0 ${HDF_FILE1}.h5 ${HDF_FILE1}.out.h5 -vp -s simple -d /A/B2/simple2) + ADD_H5_TEST (C_D_simple 0 ${HDF_FILE1}.h5 ${HDF_FILE1}.out.h5 -vp -s /grp_dsets/simple -d /C/D/simple) + ADD_H5_TEST (E_F_grp_dsets 0 ${HDF_FILE1}.h5 ${HDF_FILE1}.out.h5 -vp -s /grp_dsets -d /E/F/grp_dsets) + ADD_H5_TEST (G_H_grp_nested 0 ${HDF_FILE1}.h5 ${HDF_FILE1}.out.h5 -vp -s /grp_nested -d /G/H/grp_nested) # Verify that the file created above is correct ADD_H5LS_TEST (${HDF_FILE1} basic) @@ -267,7 +273,7 @@ IF (BUILD_TESTING) SET (last_test "H5COPY-clear-refs") # "Test copying object and region references" - ADD_H5_TEST (region_ref 2 ${HDF_FILE2} v / /COPY ref) + ADD_H5_F_TEST (region_ref 2 ${HDF_FILE2}.h5 ${HDF_FILE2}.out.h5 ref -v -s / -d /COPY) # Verify that the file created above is correct ADD_H5LS_TEST (${HDF_FILE2} refs) @@ -289,41 +295,33 @@ IF (BUILD_TESTING) SET (last_test "H5COPY-clear-ext-links") # "Test copying external link directly without -f ext" - ADD_H5_TEST (ext_link 2 ${HDF_EXT_SRC_FILE} v /group_ext/extlink_dset /copy1_dset) + ADD_H5_TEST (ext_link 2 ${HDF_EXT_SRC_FILE}.h5 ${HDF_EXT_SRC_FILE}.out.h5 -v -s /group_ext/extlink_dset -d /copy1_dset) # "Test copying external link directly with -f ext" - ADD_H5_TEST (ext_link_f 2 ${HDF_EXT_SRC_FILE} v /group_ext/extlink_dset /copy2_dset ext) + ADD_H5_F_TEST (ext_link_f 2 ${HDF_EXT_SRC_FILE}.h5 ${HDF_EXT_SRC_FILE}.out.h5 ext -v -s /group_ext/extlink_dset -d /copy2_dset) # "Test copying dangling external link (no obj) directly without -f ext" - ADD_H5_TEST (ext_dangle_noobj 2 ${HDF_EXT_SRC_FILE} v /group_ext/extlink_notyet1 /copy_dangle1_1) + ADD_H5_TEST (ext_dangle_noobj 2 ${HDF_EXT_SRC_FILE}.h5 ${HDF_EXT_SRC_FILE}.out.h5 -v -s /group_ext/extlink_notyet1 -d /copy_dangle1_1) # "Test copying dangling external link (no obj) directly with -f ext" - ADD_H5_TEST (ext_dangle_noobj_f 2 ${HDF_EXT_SRC_FILE} v /group_ext/extlink_notyet1 /copy_dangle1_2 ext) + ADD_H5_F_TEST (ext_dangle_noobj_f 2 ${HDF_EXT_SRC_FILE}.h5 ${HDF_EXT_SRC_FILE}.out.h5 ext -v -s /group_ext/extlink_notyet1 -d /copy_dangle1_2) # "Test copying dangling external link (no file) directly without -f ext" - ADD_H5_TEST (ext_dangle_nofile 2 ${HDF_EXT_SRC_FILE} v /group_ext/extlink_notyet2 /copy_dangle2_1) + ADD_H5_TEST (ext_dangle_nofile 2 ${HDF_EXT_SRC_FILE}.h5 ${HDF_EXT_SRC_FILE}.out.h5 -v -s /group_ext/extlink_notyet2 -d /copy_dangle2_1) # "Test copying dangling external link (no file) directly with -f ext" - ADD_H5_TEST (ext_dangle_nofile_f 2 ${HDF_EXT_SRC_FILE} v /group_ext/extlink_notyet2 /copy_dangle2_2 ext) + ADD_H5_F_TEST (ext_dangle_nofile_f 2 ${HDF_EXT_SRC_FILE}.h5 ${HDF_EXT_SRC_FILE}.out.h5 ext -v -s /group_ext/extlink_notyet2 -d /copy_dangle2_2) # "Test copying a group contains external links without -f ext" - ADD_H5_TEST (ext_link_group 2 ${HDF_EXT_SRC_FILE} v /group_ext /copy1_group) + ADD_H5_TEST (ext_link_group 2 ${HDF_EXT_SRC_FILE}.h5 ${HDF_EXT_SRC_FILE}.out.h5 -v -s /group_ext -d /copy1_group) # "Test copying a group contains external links with -f ext" - ADD_H5_TEST (ext_link_group_f 2 ${HDF_EXT_SRC_FILE} v /group_ext /copy2_group ext) + ADD_H5_F_TEST (ext_link_group_f 2 ${HDF_EXT_SRC_FILE}.h5 ${HDF_EXT_SRC_FILE}.out.h5 ext -v -s /group_ext -d /copy2_group) # Verify that the file created above is correct ADD_H5LS_TEST (${HDF_EXT_SRC_FILE} links) ############# Test misc. ############## - - ADD_CUSTOM_COMMAND ( - TARGET h5copy - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${HDF5_TOOLS_H5COPY_SOURCE_DIR}/testfiles/h5copytst.h5 ${PROJECT_BINARY_DIR}/h5copytst.h5 - ) - # Remove any output file left over from previous test run ADD_TEST ( NAME H5COPY-clear-misc @@ -331,8 +329,7 @@ IF (BUILD_TESTING) -E remove ./testfiles/h5copy_misc1.out.out ./testfiles/h5copy_misc1.out.out.err - ./testfiles/${HDF_FILE1_TMP}.h5 - ./testfiles/h5copy_misc1.out.h5 + ./testfiles/${HDF_FILE1}.out.h5 ) IF (NOT "${last_test}" STREQUAL "") SET_TESTS_PROPERTIES (H5COPY-clear-misc PROPERTIES DEPENDS ${last_test}) @@ -342,19 +339,30 @@ IF (BUILD_TESTING) #----------------------------------------------------------------- # "Test copying object into group which doesn't exist, without -p" # - ADD_H5_CMP_TEST (h5copy_misc1 1 ${HDF_FILE1} v /simple /g1/g2/simple) + ADD_H5_CMP_TEST (h5copy_misc1 1 ${HDF_FILE1}.h5 ${HDF_FILE1}.out.h5 -v -s /simple -d /g1/g2/simple) + # Remove any output file left over from previous test run + ADD_TEST ( + NAME H5COPY-clear-samefile + COMMAND ${CMAKE_COMMAND} + -E remove + ./testfiles/${HDF_FILE1}.out.h5 + ) + IF (NOT "${last_test}" STREQUAL "") + SET_TESTS_PROPERTIES (H5COPY-clear-samefile PROPERTIES DEPENDS ${last_test}) + ENDIF (NOT "${last_test}" STREQUAL "") + SET (last_test "H5COPY-clear-samefile") #------------------------------------------- # "Test copying objects to the same file " # # create temporary test file with some objects - ADD_H5COPY_TEST (samefile1_pre 0 ${HDF_FILE1}.h5 ${HDF_FILE1_TMP}.h5 v /simple /simple) - ADD_H5COPY_TEST (samefile2_pre 0 ${HDF_FILE1}.h5 ${HDF_FILE1_TMP}.h5 v /grp_dsets /grp_dsets) + ADD_H5_TEST (samefile1_pre 0 ${HDF_FILE1}.h5 ${HDF_FILE1}.out.h5 -v -s /simple -d /simple) + ADD_H5_TEST (samefile2_pre 0 ${HDF_FILE1}.h5 ${HDF_FILE1}.out.h5 -v -s /grp_dsets -d /grp_dsets) # actual test cases # - dataset - ADD_H5COPY_TEST (samefile1 0 ${HDF_FILE1_TMP}.h5 ${HDF_FILE1_TMP}.h5 v /simple /simple_cp) + ADD_H5_TEST (samefile1 0 ${HDF_FILE1}.out.h5 ${HDF_FILE1}.out.h5 -v -s /simple -d /simple_cp) # - group with some datasets - ADD_H5COPY_TEST (samefile2 0 ${HDF_FILE1_TMP}.h5 ${HDF_FILE1_TMP}.h5 v /grp_dsets /grp_dsets_cp) + ADD_H5_TEST (samefile2 0 ${HDF_FILE1}.out.h5 ${HDF_FILE1}.out.h5 -v -s /grp_dsets -d /grp_dsets_cp) ENDIF (BUILD_TESTING) ############################################################################## diff --git a/tools/h5import/CMakeLists.txt b/tools/h5import/CMakeLists.txt index 313151e..a2f8a6b 100644 --- a/tools/h5import/CMakeLists.txt +++ b/tools/h5import/CMakeLists.txt @@ -98,16 +98,7 @@ IF (BUILD_TESTING) ) ENDFOREACH (txt_file ${HDF5_REFERENCE_TXT_FILES}) - FILE (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/tmp_testfiles") FOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES}) - SET (tmpdest "${PROJECT_BINARY_DIR}/tmp_testfiles/${h5_file}") - #MESSAGE (STATUS " Copying ${h5_file}") - ADD_CUSTOM_COMMAND ( - TARGET h5import - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${HDF5_TOOLS_H5IMPORT_SOURCE_DIR}/testfiles/${h5_file} ${tmpdest} - ) SET (dest "${PROJECT_BINARY_DIR}/testfiles/${h5_file}") #MESSAGE (STATUS " Copying ${h5_file}") ADD_CUSTOM_COMMAND ( @@ -147,7 +138,7 @@ IF (BUILD_TESTING) NAME H5IMPORT-H5DUMP-${testname} COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>" - -D "TEST_ARGS:STRING=testfiles/${testfile}" + -D "TEST_ARGS:STRING=${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=${testfile}.new" -D "TEST_EXPECT=0" @@ -160,7 +151,7 @@ IF (BUILD_TESTING) NAME H5IMPORT-H5DUMP_CMP-${testname} COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>" - -D "TEST_ARGS:STRING=tmp_testfiles/${testfile}" + -D "TEST_ARGS:STRING=testfiles/${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=${testfile}.out" -D "TEST_EXPECT=0" @@ -193,6 +184,7 @@ IF (BUILD_TESTING) binuin32.bin txtin16.txt txtin32.txt + ${HDF5_REFERENCE_TEST_FILES} ) ADD_TEST (NAME H5IMPORT-h5importtest COMMAND $<TARGET_FILE:h5importtest>) diff --git a/tools/h5jam/CMakeLists.txt b/tools/h5jam/CMakeLists.txt index 0bdb558..81a624d 100644 --- a/tools/h5jam/CMakeLists.txt +++ b/tools/h5jam/CMakeLists.txt @@ -165,29 +165,56 @@ IF (BUILD_TESTING) ENDMACRO(SETUP testname infile outfile) MACRO (CHECK_UB_1 testname testfile ufile) - IF (NOT HDF5_ENABLE_USING_MEMCHECKER) #Temporary - ADD_TEST ( - NAME H5JAM-CHECK_UB_1-${testname} - COMMAND ${CMAKE_COMMAND} -E echo "CHECK_UB_1 ${testname} ${testfile} ${ufile} ${ARGN}" - ) - IF (NOT "${last_test}" STREQUAL "") - SET_TESTS_PROPERTIES (H5JAM-CHECK_UB_1-${testname} PROPERTIES DEPENDS ${last_test}) - ENDIF (NOT "${last_test}" STREQUAL "") - SET (last_test "H5JAM-CHECK_UB_1-${testname}") - ENDIF (NOT HDF5_ENABLE_USING_MEMCHECKER) #Temporary + IF (NOT HDF5_ENABLE_USING_MEMCHECKER) + ADD_TEST ( + NAME H5JAM-CHECK_UB_1-${testname}-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + ${testfile}.len.txt + ${testfile}.cmp + ${ufile}.cmp + ) + IF (NOT "${last_test}" STREQUAL "") + SET_TESTS_PROPERTIES (H5JAM-CHECK_UB_1-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) + ENDIF (NOT "${last_test}" STREQUAL "") + ADD_TEST ( + NAME H5JAM-CHECK_UB_1-${testname} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$<TARGET_FILE:tellub>" + -D "TEST_GET_PROGRAM=$<TARGET_FILE:getub>" + -D "TEST_CHECKUB=YES" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -D "TEST_HFILE=${testfile}" + -D "TEST_UFILE=${ufile}" + -D "TEST_EXPECT=0" + -D "TEST_OFILE=${ARGN}" + -P "${HDF5_RESOURCES_DIR}/userblockTest.cmake" + ) + SET_TESTS_PROPERTIES (H5JAM-CHECK_UB_1-${testname} PROPERTIES DEPENDS H5JAM-CHECK_UB_1-${testname}-clear-objects) + SET (last_test "H5JAM-CHECK_UB_1-${testname}") + ENDIF (NOT HDF5_ENABLE_USING_MEMCHECKER) ENDMACRO(CHECK_UB_1 testname testfile ufile) MACRO (CHECK_NOUB testname testfile) - IF (NOT HDF5_ENABLE_USING_MEMCHECKER) #Temporary - ADD_TEST ( - NAME H5JAM-CHECK_NOUB-${testname} - COMMAND ${CMAKE_COMMAND} -E echo "CHECK_NOUB ${testname} ${testfile} ${ARGN}" - ) - IF (NOT "${last_test}" STREQUAL "") - SET_TESTS_PROPERTIES (H5JAM-CHECK_NOUB-${testname} PROPERTIES DEPENDS ${last_test}) - ENDIF (NOT "${last_test}" STREQUAL "") - SET (last_test "H5JAM-CHECK_NOUB-${testname}") - ENDIF (NOT HDF5_ENABLE_USING_MEMCHECKER) #Temporary + IF (NOT HDF5_ENABLE_USING_MEMCHECKER) + ADD_TEST ( + NAME H5JAM-CHECK_NOUB-${testname} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$<TARGET_FILE:tellub>" + -D "TEST_GET_PROGRAM=$<TARGET_FILE:getub>" + -D "TEST_CHECKUB=NO" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -D "TEST_HFILE=${testfile}" + -D "TEST_EXPECT=0" + -D "TEST_UFILE=NULL" + -D "TEST_OFILE=NULL" + -P "${HDF5_RESOURCES_DIR}/userblockTest.cmake" + ) + IF (NOT "${last_test}" STREQUAL "") + SET_TESTS_PROPERTIES (H5JAM-CHECK_NOUB-${testname} PROPERTIES DEPENDS ${last_test}) + ENDIF (NOT "${last_test}" STREQUAL "") + SET (last_test "H5JAM-CHECK_NOUB-${testname}") + ENDIF (NOT HDF5_ENABLE_USING_MEMCHECKER) ENDMACRO(CHECK_NOUB testname testfile) MACRO (UNJAMTEST testname infile ufile outfile) @@ -204,7 +231,7 @@ IF (BUILD_TESTING) COMMAND ${CMAKE_COMMAND} -E remove ${ufile} ) SET_TESTS_PROPERTIES (H5JAM-UNJAM_D-${testname}-clear-objects PROPERTIES DEPENDS H5JAM-UNJAM-${testname}-clear-objects) - ADD_TEST (NAME H5JAM-UNJAM-${testname} COMMAND $<TARGET_FILE:h5unjam> -i ${infile} -u ${ufile} -o ${outfile} ${ARGN}) + ADD_TEST (NAME H5JAM-UNJAM-${testname} COMMAND $<TARGET_FILE:h5unjam> -i ${infile} -u ${ufile} -o ${outfile}) SET_TESTS_PROPERTIES (H5JAM-UNJAM-${testname} PROPERTIES DEPENDS H5JAM-UNJAM_D-${testname}-clear-objects) SET (compare_test ${ufile}) ELSE (NOT "${ufile}" STREQUAL "NONE") @@ -232,38 +259,46 @@ IF (BUILD_TESTING) SET_TESTS_PROPERTIES (H5JAM-UNJAM-${testname} PROPERTIES DEPENDS H5JAM-UNJAM_D-${testname}-clear-objects) SET (compare_test "${outfile}.ufile.txt") ELSE (NOT "${ARGN}" STREQUAL "--delete") - ADD_TEST (NAME H5JAM-UNJAM-${testname} COMMAND $<TARGET_FILE:h5unjam> -i ${infile} -o ${outfile} ${ARGN}) + ADD_TEST (NAME H5JAM-UNJAM-${testname} COMMAND $<TARGET_FILE:h5unjam> -i ${infile} -o ${outfile}) SET_TESTS_PROPERTIES (H5JAM-UNJAM-${testname} PROPERTIES DEPENDS H5JAM-UNJAM-${testname}-clear-objects) + SET (compare_test "") ENDIF (NOT "${ARGN}" STREQUAL "--delete") ENDIF (NOT "${ufile}" STREQUAL "NONE") SET (last_test "H5JAM-UNJAM-${testname}") IF (NOT "${compare_test}" STREQUAL "") CHECK_UB_1 (${testname} ${infile} ${compare_test}) ENDIF (NOT "${compare_test}" STREQUAL "") - CHECK_NOUB (${testname} ${compare_test}) + CHECK_NOUB (${testname} ${outfile}) ENDMACRO(UNJAMTEST testname infile ufile outfile) MACRO (JAMTEST testname jamfile infile outfile) ADD_TEST ( NAME H5JAM-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} -E remove ${outfile} + COMMAND ${CMAKE_COMMAND} -E remove ${outfile} ${infile}.cpy.h5 ) IF (NOT "${last_test}" STREQUAL "") SET_TESTS_PROPERTIES (H5JAM-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) ENDIF (NOT "${last_test}" STREQUAL "") + SET (last_test "H5JAM-${testname}-clear-objects") IF ("${outfile}" STREQUAL "NONE") + ADD_TEST ( + NAME H5JAM-NONE_COPY-${testname} + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${infile} ${infile}.cpy.h5 + ) + SET_TESTS_PROPERTIES (H5JAM-NONE_COPY-${testname} PROPERTIES DEPENDS ${last_test}) + SET (last_test "H5JAM-NONE_COPY-${testname}") ADD_TEST (NAME H5JAM-${testname} COMMAND $<TARGET_FILE:h5jam> -u testfiles/${jamfile} -i ${infile} ${ARGN}) - SET (compare_test testfiles/${infile}) + SET (compare_test ${infile}) + SET (compare_orig ${infile}.cpy.h5) ELSE ("${outfile}" STREQUAL "NONE") ADD_TEST (NAME H5JAM-${testname} COMMAND $<TARGET_FILE:h5jam> -u testfiles/${jamfile} -i testfiles/${infile} -o ${outfile} ${ARGN}) - SET (compare_test testfiles/${outfile}) + SET (compare_test ${outfile}) + SET (compare_orig testfiles/${infile}) ENDIF ("${outfile}" STREQUAL "NONE") - SET_TESTS_PROPERTIES (H5JAM-${testname} PROPERTIES DEPENDS H5JAM-${testname}-clear-objects) + SET_TESTS_PROPERTIES (H5JAM-${testname} PROPERTIES DEPENDS ${last_test}) SET (last_test "H5JAM-${testname}") IF ("${ARGN}" STREQUAL "--clobber") - SET (compare_orig "NONE") - ELSE ("${ARGN}" STREQUAL "--clobber") - SET (compare_orig testfiles/${infile}) + SET (compare_orig "") ENDIF ("${ARGN}" STREQUAL "--clobber") CHECK_UB_1 (${testname} ${compare_test} testfiles/${jamfile} ${compare_orig}) ENDMACRO (JAMTEST testname jamfile infile outfile) |