on xenial help sign in
Add autopkgtest definition and adapt unity8_ test macros
9c24f6dMichał Sawicz
debian/control+1
@@ -52,6 +52,7 @@ Build-Depends: cmake,
52 qtdeclarative5-ubuntu-web-plugin,
52 qtdeclarative5-ubuntu-web-plugin,
53 ttf-ubuntu-font-family,
53 ttf-ubuntu-font-family,
54Standards-Version: 3.9.4
54Standards-Version: 3.9.4
55+XS-Testsuite: autopkgtest
55Homepage: http://launchpad.net/unity
56Homepage: http://launchpad.net/unity
56# If you aren't a member of ~unity-team but need to upload
57# If you aren't a member of ~unity-team but need to upload
57# packaging changes, just go ahead. ~unity-team will notice
58# packaging changes, just go ahead. ~unity-team will notice
debian/tests/controlnew file+4
@@ -0,0 +1,4 @@
1+Tests: qmluitests.sh
2+Depends: @,
3+ @builddeps@,
4+ xvfb,
debian/tests/qmluitests.shnew file+15
@@ -0,0 +1,15 @@
1+#!/bin/sh
2+
3+SHELL_QML_PATH=$(pkg-config --variable=plugindir unity-shell-api)
4+
5+dh_auto_configure -- -DCMAKE_INSTALL_LOCALSTATEDIR="/var" \
6+ -DARTIFACTS_DIR=${ADT_ARTIFACTS} \
7+ -DUNITY_PLUGINPATH=${SHELL_QML_PATH} \
8+ -DUNITY_MOCKPATH=${SHELL_QML_PATH}/mocks \
9+ -DQUIET_LOGGER=ON
10+dh_auto_build -- -C tests/mocks 2>&1
11+dh_auto_build -- -C tests/plugins 2>&1
12+dh_auto_build -- -C tests/qmltests 2>&1
13+dh_auto_build -- -C tests/uqmlscene 2>&1
14+dh_auto_build -- -C tests/utils 2>&1
15+dh_auto_build -- xvfbuitests
tests/CMakeLists.txt+36−8
@@ -22,26 +22,54 @@ add_subdirectory(uqmlscene)
22add_executable(qmlscene ALIAS uqmlscene)
22add_executable(qmlscene ALIAS uqmlscene)
23import_executables(dbus-test-runner)
23import_executables(dbus-test-runner)
24
24
25+set(UNITY_PLUGINPATH "" CACHE PATH "Path to pre-built unity8 plugin dir.")
26+set(UNITY_MOCKPATH "" CACHE PATH "Path to pre-built unity8 mock dir.")
27+
28+# Pre-built mocks have preference, pre-built plugins replace local build
29+set(import_paths "")
30+if(UNITY_MOCKPATH)
31+ list(APPEND import_paths ${UNITY_MOCKPATH})
32+endif()
33+list(APPEND import_paths
34+ ${CMAKE_BINARY_DIR}/tests/mocks
35+ ${CMAKE_BINARY_DIR}/tests/utils/modules
36+)
37+if(UNITY_PLUGINPATH)
38+ list(APPEND import_paths ${UNITY_PLUGINPATH})
39+else()
40+ list(APPEND import_paths ${CMAKE_BINARY_DIR}/plugins)
41+endif()
42+
43+# Pre-built mocks replace local build
44+if(UNITY_MOCKPATH)
45+ set(ld_paths
46+ ${UNITY_MOCKPATH}/libusermetrics
47+ ${UNITY_MOCKPATH}/LightDM/liblightdm
48+ )
49+else()
50+ set(ld_paths
51+ ${CMAKE_BINARY_DIR}/tests/mocks/libusermetrics
52+ ${CMAKE_BINARY_DIR}/tests/mocks/LightDM/liblightdm
53+ )
54+endif()
55+list(APPEND ld_paths ${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel)
56+string(REPLACE ";" ":" ld_library_path "${ld_paths}")
57+
25# Base/default values
58# Base/default values
26set(base_environment
59set(base_environment
27 UNITY_TESTING=1
60 UNITY_TESTING=1
28 LANGUAGE=C
61 LANGUAGE=C
29 LC_ALL=C.UTF-8
62 LC_ALL=C.UTF-8
63+ LD_LIBRARY_PATH=${ld_library_path}
30)
64)
31
65
32−set(import_paths
33− ${CMAKE_BINARY_DIR}/tests/mocks
34− ${CMAKE_BINARY_DIR}/tests/utils/modules
35− ${CMAKE_BINARY_DIR}/plugins
36−)
37−
38−
39# add a non-graphical unit test
66# add a non-graphical unit test
40# see QmlTest.cmake for additional options
67# see QmlTest.cmake for additional options
41function(add_unity8_unittest COMPONENT_NAME TARGET)
68function(add_unity8_unittest COMPONENT_NAME TARGET)
42 cmake_parse_arguments(U8TEST "${QMLTEST_OPTIONS}" "${QMLTESTS_SINGLE}" "${QMLTEST_MULTI}" ${ARGN})
69 cmake_parse_arguments(U8TEST "${QMLTEST_OPTIONS}" "${QMLTESTS_SINGLE}" "${QMLTEST_MULTI}" ${ARGN})
43 add_executable_test(${COMPONENT_NAME} ${TARGET}
70 add_executable_test(${COMPONENT_NAME} ${TARGET}
44 ADD_TEST
71 ADD_TEST
72+ IMPORT_PATHS ${import_paths}
45 TARGETS unittests
73 TARGETS unittests
46 ${ARGN}
74 ${ARGN}
47 ENVIRONMENT ${base_environment}
75 ENVIRONMENT ${base_environment}
@@ -54,6 +82,7 @@ endfunction()
54function(add_unity8_uitest COMPONENT_NAME TARGET)
82function(add_unity8_uitest COMPONENT_NAME TARGET)
55 cmake_parse_arguments(U8TEST "${QMLTEST_OPTIONS}" "${QMLTESTS_SINGLE}" "${QMLTEST_MULTI}" ${ARGN})
83 cmake_parse_arguments(U8TEST "${QMLTEST_OPTIONS}" "${QMLTESTS_SINGLE}" "${QMLTEST_MULTI}" ${ARGN})
56 add_executable_test(${COMPONENT_NAME} ${TARGET}
84 add_executable_test(${COMPONENT_NAME} ${TARGET}
85+ IMPORT_PATHS ${import_paths}
57 TARGETS uitests
86 TARGETS uitests
58 ${ARGN}
87 ${ARGN}
59 ENVIRONMENT ${base_environment}
88 ENVIRONMENT ${base_environment}
@@ -83,7 +112,6 @@ function(add_unity8_qmltest PATH COMPONENT_NAME)
83 TARGETS uitests
112 TARGETS uitests
84 ${ARGN}
113 ${ARGN}
85 ENVIRONMENT ${base_environment}
114 ENVIRONMENT ${base_environment}
86− LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/libusermetrics:${CMAKE_BINARY_DIR}/tests/mocks/LightDM/liblightdm:${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel
87 ${U8TEST_ENVIRONMENT}
115 ${U8TEST_ENVIRONMENT}
88 )
116 )
89endfunction()
117endfunction()