diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2011-04-11 15:07:29 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2011-04-11 15:07:29 (GMT) |
commit | 47c80528facedd548666ebe87539f80e56968857 (patch) | |
tree | 9ab21eff6f0bb27cea30d1277f47440839d0275f /config/cmake | |
parent | 41a304212cd56c6aa7e923f041c5b397377e86bc (diff) | |
download | hdf5-47c80528facedd548666ebe87539f80e56968857.zip hdf5-47c80528facedd548666ebe87539f80e56968857.tar.gz hdf5-47c80528facedd548666ebe87539f80e56968857.tar.bz2 |
[svn-r20464] Merge cmake changes from trunk r20463, after weekend of tests on trunk.
Tested: local linux
Diffstat (limited to 'config/cmake')
-rw-r--r-- | config/cmake/ConfigureChecks.cmake | 17 | ||||
-rw-r--r-- | config/cmake/HDF5Tests.c | 2 | ||||
-rw-r--r-- | config/cmake/userblockTest.cmake | 120 |
3 files changed, 130 insertions, 9 deletions
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") + |