summaryrefslogtreecommitdiffstats
path: root/config/cmake/runTest.cmake
diff options
context:
space:
mode:
authorVailin Choi <vchoi@hdfgroup.org>2013-04-19 15:23:01 (GMT)
committerVailin Choi <vchoi@hdfgroup.org>2013-04-19 15:23:01 (GMT)
commit14d8e1c2b5ecaf2e298984f269094dd5f2bd735f (patch)
treecc250461294a2c9118b10a95d0459d7314fa5e50 /config/cmake/runTest.cmake
parent6ee0e05fb94445551840fcb80b9b1c254c736799 (diff)
downloadhdf5-14d8e1c2b5ecaf2e298984f269094dd5f2bd735f.zip
hdf5-14d8e1c2b5ecaf2e298984f269094dd5f2bd735f.tar.gz
hdf5-14d8e1c2b5ecaf2e298984f269094dd5f2bd735f.tar.bz2
[svn-r23600] Bring revisions #23085 - #23341 from trunk to revise_chunks.
h5committested.
Diffstat (limited to 'config/cmake/runTest.cmake')
-rw-r--r--config/cmake/runTest.cmake67
1 files changed, 43 insertions, 24 deletions
diff --git a/config/cmake/runTest.cmake b/config/cmake/runTest.cmake
index 78ccf9f..0a80873 100644
--- a/config/cmake/runTest.cmake
+++ b/config/cmake/runTest.cmake
@@ -1,5 +1,6 @@
# 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.
+cmake_policy(SET CMP0007 NEW)
# arguments checking
IF (NOT TEST_PROGRAM)
@@ -108,24 +109,33 @@ IF (NOT TEST_SKIP_COMPARE)
ENDIF (WIN32 AND NOT MINGW)
# now compare the output with the reference
+ EXECUTE_PROCESS (
+ COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_FOLDER}/${TEST_REFERENCE}
+ RESULT_VARIABLE TEST_RESULT
+ )
+ IF (NOT ${TEST_RESULT} STREQUAL 0)
SET (TEST_RESULT 0)
FILE (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} test_act)
- LIST (LENGTH "${test_act}" len_act)
+ LIST (LENGTH test_act len_act)
FILE (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} test_ref)
- LIST (LENGTH "${test_ref}" len_ref)
- MATH (EXPR _FP_LEN "${len_ref} - 1")
- FOREACH (line RANGE 0 ${_FP_LEN})
- LIST (GET "${test_act}" ${line} str_act)
- LIST (GET "${test_ref}" ${line} str_ref)
- STRING (COMPARE NOTEQUAL ${str_act} ${str_ref} str_res)
- IF (${str_res})
- SET (TEST_RESULT 1)
- MESSAGE ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}")
- ENDIF (${str_res})
- ENDFOREACH (line RANGE 0 ${_FP_LEN})
+ LIST (LENGTH test_ref len_ref)
+ IF (NOT ${len_act} STREQUAL "0")
+ MATH (EXPR _FP_LEN "${len_ref} - 1")
+ FOREACH (line RANGE 0 ${_FP_LEN})
+ LIST (GET test_act ${line} str_act)
+ LIST (GET test_ref ${line} str_ref)
+ IF (NOT "${str_act}" STREQUAL "${str_ref}")
+ IF (NOT "${str_act}" STREQUAL "")
+ SET (TEST_RESULT 1)
+ MESSAGE ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n")
+ ENDIF (NOT "${str_act}" STREQUAL "")
+ ENDIF (NOT "${str_act}" STREQUAL "${str_ref}")
+ ENDFOREACH (line RANGE 0 ${_FP_LEN})
+ ENDIF (NOT ${len_act} STREQUAL "0")
IF (NOT ${len_act} STREQUAL ${len_ref})
SET (TEST_RESULT 1)
ENDIF (NOT ${len_act} STREQUAL ${len_ref})
+ ENDIF (NOT ${TEST_RESULT} STREQUAL 0)
MESSAGE (STATUS "COMPARE Result: ${TEST_RESULT}")
@@ -141,24 +151,34 @@ IF (NOT TEST_SKIP_COMPARE)
ENDIF (WIN32 AND NOT MINGW)
# now compare the error output with the error reference
+ EXECUTE_PROCESS (
+ COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT}.err ${TEST_FOLDER}/${TEST_ERRREF}
+ RESULT_VARIABLE TEST_RESULT
+ )
+ IF (NOT ${TEST_RESULT} STREQUAL 0)
SET (TEST_RESULT 0)
FILE (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT}.err test_act)
- LIST (LENGTH "${test_act}" len_act)
+ LIST (LENGTH test_act len_act)
FILE (STRINGS ${TEST_FOLDER}/${TEST_ERRREF} test_ref)
- LIST (LENGTH "${test_ref}" len_ref)
+ LIST (LENGTH test_ref len_ref)
MATH (EXPR _FP_LEN "${len_ref} - 1")
- FOREACH (line RANGE 0 ${_FP_LEN})
- LIST (GET "${test_act}" ${line} str_act)
- LIST (GET "${test_ref}" ${line} str_ref)
- STRING (COMPARE NOTEQUAL ${str_act} ${str_ref} str_res)
- IF (${str_res})
- SET (TEST_RESULT 1)
- MESSAGE ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}")
- ENDIF (${str_res})
- ENDFOREACH (line RANGE 0 ${_FP_LEN})
+ IF (NOT ${len_act} STREQUAL "0")
+ MATH (EXPR _FP_LEN "${len_ref} - 1")
+ FOREACH (line RANGE 0 ${_FP_LEN})
+ LIST (GET test_act ${line} str_act)
+ LIST (GET test_ref ${line} str_ref)
+ IF (NOT "${str_act}" STREQUAL "${str_ref}")
+ IF (NOT "${str_act}" STREQUAL "")
+ SET (TEST_RESULT 1)
+ MESSAGE ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n")
+ ENDIF (NOT "${str_act}" STREQUAL "")
+ ENDIF (NOT "${str_act}" STREQUAL "${str_ref}")
+ ENDFOREACH (line RANGE 0 ${_FP_LEN})
+ ENDIF (NOT ${len_act} STREQUAL "0")
IF (NOT ${len_act} STREQUAL ${len_ref})
SET (TEST_RESULT 1)
ENDIF (NOT ${len_act} STREQUAL ${len_ref})
+ ENDIF (NOT ${TEST_RESULT} STREQUAL 0)
MESSAGE (STATUS "COMPARE Result: ${TEST_RESULT}")
@@ -171,4 +191,3 @@ ENDIF (NOT TEST_SKIP_COMPARE)
# everything went fine...
MESSAGE ("Passed: The output of ${TEST_PROGRAM} matches ${TEST_REFERENCE}")
-