diff options
-rw-r--r-- | config/cmake/grepTest.cmake | 19 |
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") |