on xenial help sign in
add "make xvfbtestSomething" target to run qml tests in xvfb
6860e75Michael Zanetti
cmake/modules/QmlTest.cmake+17−2
@@ -65,6 +65,7 @@ macro(add_qml_test SUBPATH COMPONENT_NAME)
65 cmake_parse_arguments(qmltest "${options}" "" "${multi_value_keywords}" ${ARGN})
65 cmake_parse_arguments(qmltest "${options}" "" "${multi_value_keywords}" ${ARGN})
66
66
67 set(qmltest_TARGET test${COMPONENT_NAME})
67 set(qmltest_TARGET test${COMPONENT_NAME})
68+ set(qmltest_xvfb_TARGET xvfbtest${COMPONENT_NAME})
68 set(qmltest_FILE ${SUBPATH}/tst_${COMPONENT_NAME})
69 set(qmltest_FILE ${SUBPATH}/tst_${COMPONENT_NAME})
69
70
70 set(qmltestrunner_imports "")
71 set(qmltestrunner_imports "")
@@ -87,6 +88,21 @@ macro(add_qml_test SUBPATH COMPONENT_NAME)
87 -o ${CMAKE_BINARY_DIR}/${qmltest_TARGET}.xml,xunitxml
88 -o ${CMAKE_BINARY_DIR}/${qmltest_TARGET}.xml,xunitxml
88 -o -,txt
89 -o -,txt
89 )
90 )
91+ set(qmltest_xvfb_command
92+ env ${qmltest_ENVIRONMENT}
93+ xvfb-run -l -s "-screen 0 1024x768x24"
94+ ${qmltestrunner_exe} -input ${CMAKE_CURRENT_SOURCE_DIR}/${qmltest_FILE}.qml
95+ ${qmltestrunner_imports}
96+ -o ${CMAKE_BINARY_DIR}/${qmltest_TARGET}.xml,xunitxml
97+ -o -,txt
98+ )
99+
100+ add_qmltest_target(${qmltest_TARGET} "${qmltest_command}")
101+ add_qmltest_target(${qmltest_xvfb_TARGET} "${qmltest_xvfb_command}")
102+ add_manual_qml_test(${SUBPATH} ${COMPONENT_NAME} ${ARGN})
103+endmacro(add_qml_test)
104+
105+macro(add_qmltest_target qmltest_TARGET qmltest_command)
90 add_custom_target(${qmltest_TARGET} ${qmltest_command})
106 add_custom_target(${qmltest_TARGET} ${qmltest_command})
91
107
92 if(NOT "${qmltest_PROPERTIES}" STREQUAL "")
108 if(NOT "${qmltest_PROPERTIES}" STREQUAL "")
@@ -117,5 +133,4 @@ macro(add_qml_test SUBPATH COMPONENT_NAME)
117 endif()
133 endif()
118 endif("${qmltest_NO_TARGETS}" STREQUAL "FALSE")
134 endif("${qmltest_NO_TARGETS}" STREQUAL "FALSE")
119
135
120− add_manual_qml_test(${SUBPATH} ${COMPONENT_NAME} ${ARGN})
136+endmacro(add_qmltest_target)
121−endmacro(add_qml_test)
tests/CMakeLists.txt+2−2
@@ -1,7 +1,7 @@
1−# QML tests that do not require graphical capabitlies.
1+# QML tests that do not require graphical capabilities.
2add_custom_target(qmlunittests)
2add_custom_target(qmlunittests)
3
3
4−# QML tests that require graphical capabitlies.
4+# QML tests that require graphical capabilities.
5add_custom_target(qmluitests)
5add_custom_target(qmluitests)
6
6
7add_custom_target(qmltests)
7add_custom_target(qmltests)