on xenial help sign in
Add gdbTestComponentName build targets
b60fed5Daniel d'Andrada
@@ -154,6 +154,10 @@ So, for the DragHandle component that would be:
154
154
155$ make testDragHandle
155$ make testDragHandle
156
156
157+To run the tests for a single component/class under gdb (so you can catch SEGFAULTS)
158+
159+$ make gdbTestComponentName
160+
157To run a test application that allow you to manually test or to simply try out
161To run a test application that allow you to manually test or to simply try out
158a given component:
162a given component:
159
163
cmake/modules/QmlTest.cmake+8
@@ -12,6 +12,7 @@
12# Two targets will be created:
12# Two targets will be created:
13# - testComponentName - Runs the test with qmltestrunner
13# - testComponentName - Runs the test with qmltestrunner
14# - tryComponentName - Runs the test with uqmlscene, for manual interaction
14# - tryComponentName - Runs the test with uqmlscene, for manual interaction
15+# - gdbTestComponentName - Runs the test with qmltestrunner under gdb
15#
16#
16# To change/set a default value for the whole test suite, prior to calling add_qml_test, set:
17# To change/set a default value for the whole test suite, prior to calling add_qml_test, set:
17# qmltest_DEFAULT_NO_ADD_TEST (default: FALSE)
18# qmltest_DEFAULT_NO_ADD_TEST (default: FALSE)
@@ -81,6 +82,7 @@ macro(add_qml_test_internal SUBPATH COMPONENT_NAME ITERATIONS)
81 cmake_parse_arguments(qmltest_default "${options}" "" "${multi_value_keywords}" ${qmltest_DEFAULT_PROPERTIES})
82 cmake_parse_arguments(qmltest_default "${options}" "" "${multi_value_keywords}" ${qmltest_DEFAULT_PROPERTIES})
82
83
83 set(qmltest_TARGET test${COMPONENT_NAME})
84 set(qmltest_TARGET test${COMPONENT_NAME})
85+ set(qmltest_gdb_TARGET gdbTest${COMPONENT_NAME})
84 set(qmltest_xvfb_TARGET xvfbtest${COMPONENT_NAME})
86 set(qmltest_xvfb_TARGET xvfbtest${COMPONENT_NAME})
85 set(qmltest_FILE ${SUBPATH}/tst_${COMPONENT_NAME})
87 set(qmltest_FILE ${SUBPATH}/tst_${COMPONENT_NAME})
86
88
@@ -138,8 +140,14 @@ macro(add_qml_test_internal SUBPATH COMPONENT_NAME ITERATIONS)
138 ${function_ARGS}
140 ${function_ARGS}
139 )
141 )
140
142
143+ set(qmltest_gdb_command
144+ env ${test_env} ${qmltest_ENVIRONMENT} ${LD_PRELOAD_PATH}
145+ gdb -e ${qmltestrunner_exe} -ex \"run -input ${CMAKE_CURRENT_SOURCE_DIR}/${qmltest_FILE}.qml ${qmltestrunner_imports} ${ITERATIONS_STRING}\"
146+ )
147+
141 add_qmltest_target(${qmltest_TARGET} "${qmltest_command}" TRUE ${qmltest_NO_ADD_TEST})
148 add_qmltest_target(${qmltest_TARGET} "${qmltest_command}" TRUE ${qmltest_NO_ADD_TEST})
142 add_qmltest_target(${qmltest_xvfb_TARGET} "${qmltest_xvfb_command}" ${qmltest_NO_TARGETS} TRUE)
149 add_qmltest_target(${qmltest_xvfb_TARGET} "${qmltest_xvfb_command}" ${qmltest_NO_TARGETS} TRUE)
150+ add_qmltest_target(${qmltest_gdb_TARGET} "${qmltest_gdb_command}" ${qmltest_NO_TARGETS} TRUE)
143 add_manual_qml_test(${SUBPATH} ${COMPONENT_NAME} ${ARGN})
151 add_manual_qml_test(${SUBPATH} ${COMPONENT_NAME} ${ARGN})
144endmacro(add_qml_test_internal)
152endmacro(add_qml_test_internal)
145
153