diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2010-09-21 17:22:43 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2010-09-21 17:22:43 (GMT) |
commit | 937cfb0c26fe7f2a38cc379ae71a4c6a5f5d3087 (patch) | |
tree | 6d208135867cbea64aee590b215637cc517c0786 /config | |
parent | d6c6a34a8f5876d21dee052c74426b0606b62d13 (diff) | |
download | hdf5-937cfb0c26fe7f2a38cc379ae71a4c6a5f5d3087.zip hdf5-937cfb0c26fe7f2a38cc379ae71a4c6a5f5d3087.tar.gz hdf5-937cfb0c26fe7f2a38cc379ae71a4c6a5f5d3087.tar.bz2 |
[svn-r19458] Add CMake tests for check-vfd; includes new vfdTest.cmake script and OPTION HDF5_TEST_VFD
Tested: local linux
Diffstat (limited to 'config')
-rw-r--r-- | config/cmake/vfdTest.cmake | 41 |
1 files changed, 41 insertions, 0 deletions
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}") + |