diff options
author | Allen Winter <winter@kde.org> | 2007-08-31 14:47:42 +0000 |
---|---|---|
committer | Allen Winter <winter@kde.org> | 2007-08-31 14:47:42 +0000 |
commit | b36c90bd51bcd7d23a8bba16ae01def70e5314c6 (patch) | |
tree | 1d999f184646eac004bcc777c5abbebdec07c69e | |
parent | b5549bfda03d789db352d33ad6f46a6ffe9a737a (diff) | |
download | extra-cmake-modules-b36c90bd51bcd7d23a8bba16ae01def70e5314c6.tar.gz extra-cmake-modules-b36c90bd51bcd7d23a8bba16ae01def70e5314c6.tar.bz2 |
Add xml output to QTest unit tests, in order to produce a more readable report.
By Thibault.
CCMAIL: thibault.normand@gmail.com
svn path=/trunk/KDE/kdelibs/; revision=706909
-rw-r--r-- | modules/KDE4Macros.cmake | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/modules/KDE4Macros.cmake b/modules/KDE4Macros.cmake index d1383e70..f0347422 100644 --- a/modules/KDE4Macros.cmake +++ b/modules/KDE4Macros.cmake @@ -695,7 +695,22 @@ macro (KDE4_ADD_UNIT_TEST _test_NAME) list(REMOVE_AT _srcList 0 1) endif( ${ARGV1} STREQUAL "TESTNAME" ) kde4_add_test_executable( ${_test_NAME} ${_srcList} ) - add_test( ${_targetName} ${EXECUTABLE_OUTPUT_PATH}/${_test_NAME} ) + + SET(using_qtest "") + FOREACH(_filename ${_srcList}) + IF(NOT using_qtest) + FILE(READ ${_filename} file_CONTENT) + STRING(REGEX MATCH "QTEST_(KDE)?MAIN" using_qtest "${file_CONTENT}") + ENDIF(NOT using_qtest) + ENDFOREACH(_filename) + + if (using_qtest) + #MESSAGE(STATUS "${_targetName} : Using QTestLib, can produce XML report.") + add_test( ${_targetName} ${EXECUTABLE_OUTPUT_PATH}/${_test_NAME} -xml -o ${_targetName}.tml) + else (using_qtest) + #MESSAGE(STATUS "${_targetName} : NOT using QTestLib, can't produce XML report, please use QTestLib to write your unit tests.") + add_test( ${_targetName} ${EXECUTABLE_OUTPUT_PATH}/${_test_NAME} ) + endif (using_qtest) if (NOT MSVC_IDE) #not needed for the ide # if the tests are EXCLUDE_FROM_ALL, add a target "buildtests" to build all tests |