diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2017-01-11 20:02:34 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2017-01-11 20:02:34 (GMT) |
commit | 244faaa0d048e7e06fb5aec8d4f661f1893c3030 (patch) | |
tree | 50d18b730a41e3f644f4d2729ea30ebe387bdfba /config/cmake | |
parent | e1bcae8a6a804490aa941a654e99b1dd18251411 (diff) | |
download | hdf5-244faaa0d048e7e06fb5aec8d4f661f1893c3030.zip hdf5-244faaa0d048e7e06fb5aec8d4f661f1893c3030.tar.gz hdf5-244faaa0d048e7e06fb5aec8d4f661f1893c3030.tar.bz2 |
HDFFV-10094: upgrade cmake command conventions
Also converted tests to use macros
Diffstat (limited to 'config/cmake')
-rw-r--r-- | config/cmake/vfdTest.cmake | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/config/cmake/vfdTest.cmake b/config/cmake/vfdTest.cmake index bcbb441..9c93fb7 100644 --- a/config/cmake/vfdTest.cmake +++ b/config/cmake/vfdTest.cmake @@ -5,12 +5,6 @@ if (NOT TEST_PROGRAM) message (FATAL_ERROR "Require TEST_PROGRAM to be defined") endif () -#if (NOT TEST_ARGS) -# message (STATUS "Require TEST_ARGS to be defined") -#endif () -#if (NOT TEST_EXPECT) -# message (STATUS "Require TEST_EXPECT to be defined") -#endif () if (NOT TEST_FOLDER) message ( FATAL_ERROR "Require TEST_FOLDER to be defined") endif () @@ -18,15 +12,28 @@ if (NOT TEST_VFD) message (FATAL_ERROR "Require TEST_VFD to be defined") endif () -set (ERROR_APPEND 1) +if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}) + file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}) +endif () + +if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) + file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}.err) +endif () + +# if there is not an error reference file add the error output to the stdout file +if (NOT TEST_ERRREF) + set (ERROR_APPEND 1) +endif () 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 ( +execute_process ( COMMAND ${TEST_PROGRAM} ${TEST_ARGS} WORKING_DIRECTORY ${TEST_FOLDER} + RESULT_VARIABLE TEST_RESULT OUTPUT_FILE ${TEST_OUTPUT}_${TEST_VFD}.out ERROR_FILE ${TEST_OUTPUT}_${TEST_VFD}.err OUTPUT_VARIABLE TEST_OUT @@ -35,6 +42,7 @@ EXECUTE_PROCESS ( message (STATUS "COMMAND Result: ${TEST_RESULT}") +# if the .err file exists and ERRROR_APPEND is enabled if (ERROR_APPEND AND EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}_${TEST_VFD}.err) file (READ ${TEST_FOLDER}/${TEST_OUTPUT}_${TEST_VFD}.err TEST_STREAM) file (APPEND ${TEST_FOLDER}/${TEST_OUTPUT}_${TEST_VFD}.out "${TEST_STREAM}") @@ -42,8 +50,16 @@ endif () # 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}") + if (NOT TEST_NOERRDISPLAY) + if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}_${TEST_VFD}.out) + file (READ ${TEST_FOLDER}/${TEST_OUTPUT}_${TEST_VFD}.out TEST_STREAM) + message (STATUS "Output USING ${TEST_VFD}:\n${TEST_STREAM}") + endif() + endif() + message (FATAL_ERROR "Failed: Test program ${TEST_PROGRAM} exited != ${TEST_EXPECT}.\n${TEST_ERROR}") endif () +message (STATUS "COMMAND Error: ${TEST_ERROR}") + # everything went fine... message ("Passed: The ${TEST_PROGRAM} program used vfd ${TEST_VFD}") |