From 862d74c6ffa1c965a6be8d24560eae9605252623 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 5 Jul 2012 09:36:53 -0500 Subject: [svn-r22514] Correct failure REGEX test to test value of TEST_EXPECT --- config/cmake/grepTest.cmake | 19 +++++++++++-------- 1 file 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") -- cgit v0.12