I noticed while trying to run some unit tests I'm sure ran fine a couple
of months ago, cmake/ctest was no longer able to find the executables
for them on OSX. Some more investigating showed that some change a few
months ago (the one that deprecated kde4_add_test_executable) changed
the semantics of kde4_add_unit_test to no longer always imply a NOGUI,
but have it as an optional parameter. With this change the executables
no longer end up in ${EXECUTABLE_OUTPUT_PATH}/${_test_NAME} but in
${EXECUTABLE_OUTPUT_PATH}/${_test_NAME}.app/Contents/MacOS/${_test_NAME},
so obviously the executables can't be found when running 'make test'. Of
course the easiest fix is to simply change all calls to
kde4_add_unit_test and add a NOGUI parameter, but I doubt that was
intended. I'm not sure if it makes any sense to have GUI unit tests, but
since it apparently is allowed, I think it should also be possible to
run them. The attached patch should make this possible I think, but
perhaps I'm missing something and this should be fixed some other way?
Marijn Kruisselbrink
Index: cmake/modules/KDE4Macros.cmake
===================================================================
--- cmake/modules/KDE4Macros.cmake (revision 757585)
+++ cmake/modules/KDE4Macros.cmake (working copy)
@@ -749,6 +749,13 @@
set(_targetName ${ARGV2})
list(REMOVE_AT _srcList 0 1)
endif( ${ARGV1} STREQUAL "TESTNAME" )
+
+ set(_nogui)
+ list(GET ${_srcList} 0 first_PARAM)
+ if( ${first_PARAM} STREQUAL "NOGUI" )
+ set(_nogui "NOGUI")
+ endif( ${first_PARAM} STREQUAL "NOGUI" )
+
kde4_add_executable( ${_test_NAME} TEST ${_srcList} )
if(NOT KDE4_TEST_OUTPUT)
@@ -766,12 +773,17 @@
endif(NOT using_qtest)
endforeach(_filename)
+ set(_executable ${EXECUTABLE_OUTPUT_PATH}/${_test_NAME})
+ if (Q_WS_MAC AND NOT _nogui)
+ set(_executable
${EXECUTABLE_OUTPUT_PATH}/${_test_NAME}.app/Contents/MacOS/${_test_NAME})
+ endif (Q_WS_MAC AND NOT _nogui)
+
if (using_qtest AND KDE4_TEST_OUTPUT STREQUAL "xml")
#MESSAGE(STATUS "${_targetName} : Using QTestLib, can produce XML
report.")
- add_test( ${_targetName} ${EXECUTABLE_OUTPUT_PATH}/${_test_NAME} -xml
-o ${_targetName}.tml)
+ add_test( ${_targetName} ${_executable} -xml -o ${_targetName}.tml)
else (using_qtest AND KDE4_TEST_OUTPUT STREQUAL "xml")
#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} )
+ add_test( ${_targetName} ${_executable} )
endif (using_qtest AND KDE4_TEST_OUTPUT STREQUAL "xml")
# add_test( ${_targetName} ${EXECUTABLE_OUTPUT_PATH}/${_test_NAME} -xml -o
${_test_NAME}.tml )
_______________________________________________
Kde-buildsystem mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/kde-buildsystem