summaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2012-12-19 20:05:03 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2012-12-19 20:05:03 (GMT)
commita50b051538a76ccfcf427b5fbf9b95e1ba8e81e4 (patch)
treee4ea6f07d40cab92bb73ff589032b41b3678d647 /config
parenta692fe88cd5e4ff138b927be9b275121d0d2a423 (diff)
downloadhdf5-a50b051538a76ccfcf427b5fbf9b95e1ba8e81e4.zip
hdf5-a50b051538a76ccfcf427b5fbf9b95e1ba8e81e4.tar.gz
hdf5-a50b051538a76ccfcf427b5fbf9b95e1ba8e81e4.tar.bz2
[svn-r23110] Correct comparison function
Diffstat (limited to 'config')
-rw-r--r--config/cmake/prunTest.cmake20
-rw-r--r--config/cmake/runTest.cmake38
2 files changed, 31 insertions, 27 deletions
diff --git a/config/cmake/prunTest.cmake b/config/cmake/prunTest.cmake
index 261f8a4..5669138 100644
--- a/config/cmake/prunTest.cmake
+++ b/config/cmake/prunTest.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)
@@ -105,18 +106,19 @@ IF (NOT TEST_SKIP_COMPARE)
# now compare the output with the reference
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}/P_${TEST_REFERENCE} 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})
+ 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})
IF (NOT ${len_act} STREQUAL ${len_ref})
SET (TEST_RESULT 1)
diff --git a/config/cmake/runTest.cmake b/config/cmake/runTest.cmake
index 78ccf9f..d53f23e 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)
@@ -110,18 +111,19 @@ IF (NOT TEST_SKIP_COMPARE)
# now compare the output with the reference
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)
+ 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})
+ 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})
IF (NOT ${len_act} STREQUAL ${len_ref})
SET (TEST_RESULT 1)
@@ -143,18 +145,19 @@ IF (NOT TEST_SKIP_COMPARE)
# now compare the error output with the error reference
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})
+ 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}")
- ENDIF (${str_res})
+ 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})
IF (NOT ${len_act} STREQUAL ${len_ref})
SET (TEST_RESULT 1)
@@ -171,4 +174,3 @@ ENDIF (NOT TEST_SKIP_COMPARE)
# everything went fine...
MESSAGE ("Passed: The output of ${TEST_PROGRAM} matches ${TEST_REFERENCE}")
-