summaryrefslogtreecommitdiffstats
path: root/config/cmake/grepTest.cmake
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2012-07-05 14:36:53 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2012-07-05 14:36:53 (GMT)
commit862d74c6ffa1c965a6be8d24560eae9605252623 (patch)
treed786f4255be7703010214fdb1000c4f1784c68e9 /config/cmake/grepTest.cmake
parentce47ef777fe04aeaaf9ccbfd9a9643bbfe1d9fbd (diff)
downloadhdf5-862d74c6ffa1c965a6be8d24560eae9605252623.zip
hdf5-862d74c6ffa1c965a6be8d24560eae9605252623.tar.gz
hdf5-862d74c6ffa1c965a6be8d24560eae9605252623.tar.bz2
[svn-r22514] Correct failure REGEX test to test value of TEST_EXPECT
Diffstat (limited to 'config/cmake/grepTest.cmake')
-rw-r--r--config/cmake/grepTest.cmake19
1 files changed, 11 insertions, 8 deletions
diff --git a/config/cmake/grepTest.cmake b/config/cmake/grepTest.cmake
index 9b5148c..365d9c3 100644
--- a/config/cmake/grepTest.cmake
+++ b/config/cmake/grepTest.cmake
@@ -43,18 +43,21 @@ MESSAGE (STATUS "COMMAND Error: ${TEST_ERROR}")
# now grep the output with the reference
FILE (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM)
+# TEST_REFERENCE should always be matched
+STRING(REGEX MATCH "${TEST_REFERENCE}" TEST_MATCH ${TEST_STREAM})
+STRING(COMPARE EQUAL "${TEST_REFERENCE}" "${TEST_MATCH}" TEST_RESULT)
+IF (${TEST_RESULT} STREQUAL "0")
+ MESSAGE (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did not contain ${TEST_REFERENCE}")
+ENDIF (${TEST_RESULT} STREQUAL "0")
+
STRING(REGEX MATCH "${TEST_FILTER}" TEST_MATCH ${TEST_STREAM})
-IF (${TEST_EXPECT})
+IF (${TEST_EXPECT} STREQUAL "1")
+ # TEST_EXPECT (1) interperts TEST_FILTER as NOT to match
STRING(LENGTH "${TEST_MATCH}" TEST_RESULT)
IF (NOT ${TEST_RESULT} STREQUAL "0")
- MESSAGE (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did contain ${TEST_REFERENCE}")
+ MESSAGE (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did contain ${TEST_FILTER}")
ENDIF (NOT ${TEST_RESULT} STREQUAL "0")
-ELSE (${TEST_EXPECT})
- STRING(COMPARE EQUAL "${TEST_REFERENCE}" "${TEST_MATCH}" TEST_RESULT)
- IF (${TEST_RESULT} STREQUAL "0")
- MESSAGE (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did not contain ${TEST_REFERENCE}")
- ENDIF (${TEST_RESULT} STREQUAL "0")
-ENDIF (${TEST_EXPECT})
+ENDIF (${TEST_EXPECT} STREQUAL "0")
# everything went fine...
MESSAGE ("Passed: The output of ${TEST_PROGRAM} matched")