diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2010-09-21 17:23:53 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2010-09-21 17:23:53 (GMT) |
commit | f8e2dfd298b4121b102d984849fa3be7b059707b (patch) | |
tree | 0d425fb8d97fa26337dd3cbe763a88992160537d | |
parent | 353e910462962941d88ad90aea7ed6740eb420d9 (diff) | |
download | hdf5-f8e2dfd298b4121b102d984849fa3be7b059707b.zip hdf5-f8e2dfd298b4121b102d984849fa3be7b059707b.tar.gz hdf5-f8e2dfd298b4121b102d984849fa3be7b059707b.tar.bz2 |
[svn-r19459] Add CMake tests for check-vfd; includes new vfdTest.cmake script and OPTION HDF5_TEST_VFD
Tested: local linux
-rw-r--r-- | MANIFEST | 1 | ||||
-rw-r--r-- | config/cmake/runTest.cmake | 4 | ||||
-rw-r--r-- | config/cmake/vfdTest.cmake | 41 | ||||
-rw-r--r-- | test/CMakeLists.txt | 37 |
4 files changed, 81 insertions, 2 deletions
@@ -1922,6 +1922,7 @@ ./config/cmake/cacheinit.cmake ./config/cmake/grepTest.cmake ./config/cmake/runTest.cmake +./config/cmake/vfdTest.cmake ./config/cmake/CTestCustom.ctest ./config/cmake/ConfigureChecks.cmake ./CMakeLists.txt diff --git a/config/cmake/runTest.cmake b/config/cmake/runTest.cmake index 227ef9b..ed415f7 100644 --- a/config/cmake/runTest.cmake +++ b/config/cmake/runTest.cmake @@ -50,9 +50,9 @@ IF (TEST_APPEND) FILE (APPEND ${TEST_OUTPUT} "${TEST_APPEND} ${TEST_RESULT}\n") ENDIF (TEST_APPEND) -# if the return value is !=0 bail out +# if the return value is !=${TEST_EXPECT} bail out IF (NOT ${TEST_RESULT} STREQUAL ${TEST_EXPECT}) - MESSAGE ( FATAL_ERROR "Failed: Test program ${TEST_PROGRAM} exited != 0.\n${TEST_ERROR}") + MESSAGE ( FATAL_ERROR "Failed: Test program ${TEST_PROGRAM} exited != ${TEST_EXPECT}.\n${TEST_ERROR}") ENDIF (NOT ${TEST_RESULT} STREQUAL ${TEST_EXPECT}) MESSAGE (STATUS "COMMAND Error: ${TEST_ERROR}") diff --git a/config/cmake/vfdTest.cmake b/config/cmake/vfdTest.cmake new file mode 100644 index 0000000..eaa019a --- /dev/null +++ b/config/cmake/vfdTest.cmake @@ -0,0 +1,41 @@ +# 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 to be defined") +ENDIF (NOT TEST_PROGRAM) +#IF (NOT TEST_ARGS) +# MESSAGE (STATUS "Require TEST_ARGS to be defined") +#ENDIF (NOT TEST_ARGS) +#IF (NOT TEST_EXPECT) +# MESSAGE (STATUS "Require TEST_EXPECT to be defined") +#ENDIF (NOT TEST_EXPECT) +IF (NOT TEST_FOLDER) + MESSAGE ( FATAL_ERROR "Require TEST_FOLDER to be defined") +ENDIF (NOT TEST_FOLDER) +IF (NOT TEST_VFD) + MESSAGE (FATAL_ERROR "Require TEST_VFD to be defined") +ENDIF (NOT TEST_VFD) + +MESSAGE (STATUS "USING ${TEST_VFD} ON COMMAND: ${TEST_PROGRAM} ${TEST_ARGS}") + +SET (ENV{HDF5_DRIVER} "${TEST_VFD}") +# run the test program, capture the stdout/stderr and the result var +EXECUTE_PROCESS ( + COMMAND ${TEST_PROGRAM} ${TEST_ARGS} + WORKING_DIRECTORY ${TEST_FOLDER} + OUTPUT_VARIABLE TEST_ERROR + ERROR_VARIABLE TEST_ERROR +) + +MESSAGE (STATUS "COMMAND Result: ${TEST_RESULT}") + +# if the return value is !=${TEST_EXPECT} bail out +IF (NOT ${TEST_RESULT} STREQUAL ${TEST_EXPECT}) + MESSAGE ( FATAL_ERROR "Failed: Test program ${TEST_PROGRAM} exited != ${TEST_EXPECT}.\n${TEST_ERROR}") +ENDIF (NOT ${TEST_RESULT} STREQUAL ${TEST_EXPECT}) + +# everything went fine... +MESSAGE ("Passed: The ${TEST_PROGRAM} program used vfd ${TEST_VFD}") + diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index d62af49..ea9728d 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -259,6 +259,43 @@ TARGET_LINK_LIBRARIES (ttsafe ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) ADD_TEST (NAME ttsafe COMMAND $<TARGET_FILE:ttsafe>) +IF (HDF5_TEST_VFD) + + SET (VFD_LIST + sec2 + stdio + core + split + multi + family + ) + + IF (DIRECT_VFD) + SET (VFD_LIST ${VFD_LIST} direct) + ENDIF (DIRECT_VFD) + + MACRO (ADD_VFD_TEST vfdname resultcode) + FOREACH (test ${H5_TESTS}) + ADD_TEST ( + NAME VFD-${vfdname}-${test} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$<TARGET_FILE:${test}>" + -D "TEST_ARGS:STRING=" + -D "TEST_VFD:STRING=${vfdname}" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF5_RESOURCES_DIR}/vfdTest.cmake" + ) + ENDFOREACH (test ${H5_TESTS}) + ENDMACRO (ADD_VFD_TEST) + + # Run test with different Virtual File Driver + FOREACH (vfd ${VFD_LIST}) + ADD_VFD_TEST (${vfd} 0) + ENDFOREACH (vfd ${VFD_LIST}) + +ENDIF (HDF5_TEST_VFD) + ############################################################################## ############################################################################## ### T H E G E N E R A T O R S ### |