mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-03-31 17:10:47 +08:00
[svn-r22560] Changes to allow tests to compare error files!
This commit is contained in:
parent
7bed6ec213
commit
f1850c6156
@ -24,7 +24,9 @@ IF (NOT TEST_SKIP_COMPARE AND NOT TEST_REFERENCE)
|
||||
MESSAGE (FATAL_ERROR "Require TEST_REFERENCE to be defined")
|
||||
ENDIF (NOT TEST_SKIP_COMPARE AND NOT TEST_REFERENCE)
|
||||
|
||||
SET (ERROR_APPEND 1)
|
||||
IF (NOT TEST_ERRREF)
|
||||
SET (ERROR_APPEND 1)
|
||||
ENDIF (NOT TEST_ERRREF)
|
||||
|
||||
MESSAGE (STATUS "COMMAND: ${TEST_PROGRAM} ${TEST_ARGS}")
|
||||
|
||||
@ -74,7 +76,11 @@ IF (TEST_MASK_MOD)
|
||||
ENDIF (TEST_MASK_MOD)
|
||||
|
||||
IF (TEST_MASK_ERROR)
|
||||
FILE (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM)
|
||||
IF (NOT TEST_ERRREF)
|
||||
FILE (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM)
|
||||
ELSE (NOT TEST_ERRREF)
|
||||
FILE (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM)
|
||||
ENDIF (NOT TEST_ERRREF)
|
||||
STRING(REGEX REPLACE "thread [0-9]*:" "thread (IDs):" TEST_STREAM "${TEST_STREAM}")
|
||||
STRING(REGEX REPLACE ": ([^\n]*)[.]c " ": (file name) " TEST_STREAM "${TEST_STREAM}")
|
||||
STRING(REGEX REPLACE " line [0-9]*" " line (number)" TEST_STREAM "${TEST_STREAM}")
|
||||
@ -82,7 +88,11 @@ IF (TEST_MASK_ERROR)
|
||||
STRING(REGEX REPLACE "[1-9]*[.][0-9]*[.][0-9]*[^)]*" "version (number)" TEST_STREAM "${TEST_STREAM}")
|
||||
STRING(REGEX REPLACE "H5Eget_auto[1-2]*" "H5Eget_auto(1 or 2)" TEST_STREAM "${TEST_STREAM}")
|
||||
STRING(REGEX REPLACE "H5Eset_auto[1-2]*" "H5Eset_auto(1 or 2)" TEST_STREAM "${TEST_STREAM}")
|
||||
FILE (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}")
|
||||
IF (NOT TEST_ERRREF)
|
||||
FILE (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}")
|
||||
ELSE (NOT TEST_ERRREF)
|
||||
FILE (WRITE ${TEST_FOLDER}/${TEST_OUTPUT}.err "${TEST_STREAM}")
|
||||
ENDIF (NOT TEST_ERRREF)
|
||||
ENDIF (TEST_MASK_ERROR)
|
||||
|
||||
IF (TEST_FILTER)
|
||||
@ -109,6 +119,21 @@ IF (NOT TEST_SKIP_COMPARE)
|
||||
IF (NOT ${TEST_RESULT} STREQUAL 0)
|
||||
MESSAGE (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did not match ${TEST_REFERENCE}")
|
||||
ENDIF (NOT ${TEST_RESULT} STREQUAL 0)
|
||||
|
||||
IF (TEST_ERRREF)
|
||||
# now compare the error output with the error reference
|
||||
EXECUTE_PROCESS (
|
||||
COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT}.err ${TEST_FOLDER}/${TEST_ERRREF}
|
||||
RESULT_VARIABLE TEST_RESULT
|
||||
)
|
||||
|
||||
MESSAGE (STATUS "COMPARE Result: ${TEST_RESULT}")
|
||||
|
||||
# again, if return value is !=0 scream and shout
|
||||
IF (NOT ${TEST_RESULT} STREQUAL 0)
|
||||
MESSAGE (FATAL_ERROR "Failed: The error output of ${TEST_PROGRAM} did not match ${TEST_ERRREF}")
|
||||
ENDIF (NOT ${TEST_RESULT} STREQUAL 0)
|
||||
ENDIF (TEST_ERRREF)
|
||||
ENDIF (NOT TEST_SKIP_COMPARE)
|
||||
|
||||
# everything went fine...
|
||||
|
Loading…
x
Reference in New Issue
Block a user