Hello everybody,

This patch add parameters to unit tests that use QTestLib Framework.
In the case that the developer use QTestLib for his unit tests, it
will produce a file <testname>.tml, in the directory to be parse using
an XSL stylesheet for example, to produce reports.

This feature will be used in the EBN Quality checking dashboard.

Thanks for all.
-- 
Thibault Normand ( http://thibault.normand.free.fr/ )
Tel : 06 68 66 63 96
Index: KDE4Macros.cmake
===================================================================
--- KDE4Macros.cmake	(révision 704170)
+++ KDE4Macros.cmake	(copie de travail)
@@ -695,8 +695,25 @@
         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)
+
+#    add_test( ${_targetName} ${EXECUTABLE_OUTPUT_PATH}/${_test_NAME} -xml -o ${_test_NAME}.tml ) 
+
     if (NOT MSVC_IDE)   #not needed for the ide
         # if the tests are EXCLUDE_FROM_ALL, add a target "buildtests" to build all tests
         if (NOT KDE4_BUILD_TESTS)
_______________________________________________
Kde-buildsystem mailing list
Kde-buildsystem@kde.org
https://mail.kde.org/mailman/listinfo/kde-buildsystem

Reply via email to