on xenial help sign in
abstract binary qml test targets into add_binary_qml_test macro
commit2064fe65e6a4f2764d7e91465e5fa15752bd9105 authorMichael Zanetti <michael.zanetti@canonical.com> dateFri 21 Mar 2014, 12:57 (13 years ago) parent98be688
4 files changed+31−47
cmake/modules/QmlTest.cmake+27−1 tests/plugins/Ubuntu/Gestures/CMakeLists.txt+2−23 tests/qmltests/CMakeLists.txt−1 tests/qmltests/Components/CMakeLists.txt+2−22
cmake/modules/QmlTest.cmake+27−1
@@ -96,8 +96,9 @@ macro(add_qml_test SUBPATH COMPONENT_NAME)
9696 -o -,txt
9797 ${function_ARGS}
9898 )
99+ exec_program( gcc ARGS "-dumpmachine" OUTPUT_VARIABLE ARCH_TRIPLET )
99100 set(qmltest_xvfb_command
100− env ${qmltest_ENVIRONMENT} LD_PRELOAD=/usr/lib/x86_64-linux-gnu/mesa/libGL.so.1
101+ env ${qmltest_ENVIRONMENT} LD_PRELOAD=/usr/lib/${ARCH_TRIPLET}/mesa/libGL.so.1
101102 xvfb-run --server-args "-screen 0 1024x768x24" --auto-servernum
102103 ${qmltestrunner_exe} -input ${CMAKE_CURRENT_SOURCE_DIR}/${qmltest_FILE}.qml
103104 ${qmltestrunner_imports}
@@ -111,6 +112,31 @@ macro(add_qml_test SUBPATH COMPONENT_NAME)
111112 add_manual_qml_test(${SUBPATH} ${COMPONENT_NAME} ${ARGN})
112113endmacro(add_qml_test)
113114
115+macro(add_binary_qml_test CLASS_NAME LD_PATH DEPS)
116+ set(testCommand
117+ LD_LIBRARY_PATH=${LD_PATH}
118+ ${CMAKE_CURRENT_BINARY_DIR}/${CLASS_NAME}TestExec
119+ -o ${CMAKE_BINARY_DIR}/${CLASSNAME}Test.xml,xunitxml
120+ -o -,txt)
121+
122+ add_custom_target(test${CLASS_NAME} ${testCommand})
123+ add_dependencies(test${CLASS_NAME} ${CLASS_NAME}TestExec ${DEPS})
124+
125+ set(xvfbtestCommand
126+ LD_PRELOAD=/usr/lib/x86_64-linux-gnu/mesa/libGL.so.1
127+ LD_LIBRARY_PATH=${LD_PATH}
128+ xvfb-run --server-args "-screen 0 1024x768x24" --auto-servernum
129+ ${CMAKE_CURRENT_BINARY_DIR}/${CLASS_NAME}TestExec
130+ -o ${CMAKE_BINARY_DIR}/${CLASS_NAME}Test.xml,xunitxml
131+ -o -,txt)
132+
133+ add_custom_target(xvfbtest${CLASS_NAME} ${xvfbtestCommand})
134+ add_dependencies(test${CLASS_NAME} ${CLASS_NAME}TestExec ${DEPS})
135+
136+ add_dependencies(qmluitests xvfbtest${CLASS_NAME})
137+ add_manual_qml_test(. ${CLASS_NAME} IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins)
138+endmacro(add_binary_qml_test)
139+
114140macro(add_qmltest_target qmltest_TARGET qmltest_command qmltest_NO_TARGETS qmltest_NO_ADD_TEST)
115141 add_custom_target(${qmltest_TARGET} ${qmltest_command})
116142
tests/plugins/Ubuntu/Gestures/CMakeLists.txt+2−23
@@ -15,32 +15,11 @@ add_custom_target(UbuntuGesturesTestQmlFiles ALL
1515add_definitions(-DUBUNTU_GESTURES_PLUGIN_DIR="${CMAKE_BINARY_DIR}/plugins")
1616
1717macro(add_gesture_ui_test CLASSNAME)
18− set(testCommand
19− LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/plugins/Ubuntu/Gestures
20− ${CMAKE_CURRENT_BINARY_DIR}/${CLASSNAME}TestExec
21− -o ${CMAKE_BINARY_DIR}/${CLASSNAME}Test.xml,xunitxml
22− -o -,txt)
23−
24− add_custom_target(test${CLASSNAME} ${testCommand})
25− add_dependencies(test${CLASSNAME} ${CLASSNAME}TestExec UbuntuGesturesTestQmlFiles)
26−
27− set(xvfbtestCommand
28− LD_PRELOAD=/usr/lib/x86_64-linux-gnu/mesa/libGL.so.1
29− LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/plugins/Ubuntu/Gestures
30− xvfb-run --server-args "-screen 0 1024x768x24" --auto-servernum
31− ${CMAKE_CURRENT_BINARY_DIR}/${CLASSNAME}TestExec
32− -o ${CMAKE_BINARY_DIR}/${CLASSNAME}Test.xml,xunitxml
33− -o -,txt)
34−
35− add_custom_target(xvfbtest${CLASSNAME} ${xvfbtestCommand})
36− add_dependencies(test${CLASSNAME} ${CLASSNAME}TestExec UbuntuGesturesTestQmlFiles)
37−
38− add_dependencies(qmluitests xvfbtest${CLASSNAME})
39−
4018 add_executable(${CLASSNAME}TestExec tst_${CLASSNAME}.cpp GestureTest.cpp)
4119 qt5_use_modules(${CLASSNAME}TestExec Test Core Qml Gui Quick)
4220 target_link_libraries(${CLASSNAME}TestExec UbuntuGestureQml)
43− add_manual_qml_test(. ${CLASSNAME} IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins)
21+
22+ add_binary_qml_test(${CLASSNAME} ${CMAKE_BINARY_DIR}/plugins/Ubuntu/Gestures UbuntuGesturesTestQmlFiles)
4423endmacro(add_gesture_ui_test)
4524
4625macro(add_gesture_test CLASSNAME)
tests/qmltests/CMakeLists.txt−1
@@ -24,7 +24,6 @@ set(qmltest_DEFAULT_PROPERTIES "")
2424
2525add_qml_test(. Shell IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_BINARY_DIR}/tests/mocks
2626 ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/LightDM/single")
27−add_manual_qml_test(Components DragHandle IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins)
2827add_qml_test(Components DraggingArea)
2928add_qml_test(Components EdgeDemoOverlay)
3029add_qml_test(Components FilterGrid IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_BINARY_DIR}/plugins)
tests/qmltests/Components/CMakeLists.txt+2−22
@@ -6,31 +6,11 @@ include_directories(
66 ${Qt5Gui_PRIVATE_INCLUDE_DIRS}
77 )
88
9−set(testCommand
10− LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/plugins/Ubuntu/Gestures
11− ${CMAKE_CURRENT_BINARY_DIR}/DragHandleTestExec
12− -o ${CMAKE_BINARY_DIR}/DragHandleTest.xml,xunitxml
13− -o -,txt)
14−
15−add_custom_target(testDragHandle ${testCommand})
16−add_dependencies(testDragHandle DragHandleTestExec)
17−
18−set(xvfbtestCommand
19− LD_PRELOAD=/usr/lib/x86_64-linux-gnu/mesa/libGL.so.1
20− LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/plugins/Ubuntu/Gestures
21− xvfb-run --server-args "-screen 0 1024x768x24" --auto-servernum
22− ${CMAKE_CURRENT_BINARY_DIR}/DragHandleTestExec
23− -o ${CMAKE_BINARY_DIR}/DragHandleTest.xml,xunitxml
24− -o -,txt)
25−
26−add_custom_target(xvfbtestDragHandle ${xvfbtestCommand})
27−add_dependencies(xvfbtestDragHandle DragHandleTestExec)
28−
29−add_dependencies(qmluitests xvfbtestDragHandle)
30−
319add_executable(DragHandleTestExec tst_DragHandle.cpp)
3210qt5_use_modules(DragHandleTestExec Test Core Qml Gui Quick)
3311target_link_libraries(DragHandleTestExec UbuntuGestureQml)
3412
13+add_binary_qml_test(DragHandle ${CMAKE_BINARY_DIR}/plugins/Ubuntu/Gestures "")
14+
3515add_definitions(-DUBUNTU_GESTURES_PLUGIN_DIR="${CMAKE_BINARY_DIR}/plugins")
3616add_definitions(-DTEST_DIR="${CMAKE_CURRENT_LIST_DIR}")