[svn-r22514] Correct failure REGEX test to test value of TEST_EXPECT

This commit is contained in:
Allen Byrne 2012-07-05 09:36:53 -05:00
parent ce47ef777f
commit 862d74c6ff

View File

@ -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")