Merge lp:~canonical-platform-qa/ubuntu-clock-app/xvfb_and_qml_tests into lp:ubuntu-clock-app

Proposed by Leo Arias
Status: Merged
Approved by: Nekhelesh Ramananthan
Approved revision: 104
Merged at revision: 118
Proposed branch: lp:~canonical-platform-qa/ubuntu-clock-app/xvfb_and_qml_tests
Merge into: lp:ubuntu-clock-app
Prerequisite: lp:~nik90/ubuntu-clock-app/focus-textfields-automatically
Diff against target: 132 lines (+55/-11)
6 files modified
CMakeLists.txt (+4/-9)
backend/CMakeLists.txt (+2/-0)
debian/control (+4/-0)
debian/rules (+1/-1)
tests/CMakeLists.txt (+6/-1)
tests/unit/CMakeLists.txt (+38/-0)
To merge this branch: bzr merge lp:~canonical-platform-qa/ubuntu-clock-app/xvfb_and_qml_tests
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Nekhelesh Ramananthan Approve
Francis Ginther Approve
Review via email: mp+235682@code.launchpad.net

This proposal supersedes a proposal from 2014-09-12.

Commit message

Copy the xvfb handling of QML tests from system apps.

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : Posted in a previous version of this proposal

FAILED: Continuous integration, rev:96
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~canonical-platform-qa/ubuntu-clock-app/xvfb_and_qml_tests/+merge/234421/+edit-commit-message

http://91.189.93.70:8080/job/ubuntu-clock-app-ci/457/
Executed test runs:
    SUCCESS: http://91.189.93.70:8080/job/generic-mediumtests-utopic-python3/303
        deb: http://91.189.93.70:8080/job/generic-mediumtests-utopic-python3/303/artifact/work/output/*zip*/output.zip
    SUCCESS: http://91.189.93.70:8080/job/ubuntu-clock-app-utopic-amd64-ci/104

Click here to trigger a rebuild:
http://91.189.93.70:8080/job/ubuntu-clock-app-ci/457/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : Posted in a previous version of this proposal
review: Approve (continuous-integration)
Revision history for this message
Nekhelesh Ramananthan (nik90) wrote : Posted in a previous version of this proposal

The test fails on my system as well. It is a known failure. I will fix asap. However jenkins at the moment is only configured to run AP tests. You will need to talk to fginther about enabling jenkins to run the qml tests as well.

Revision history for this message
Nekhelesh Ramananthan (nik90) wrote : Posted in a previous version of this proposal

67 -if(NOT CLICK_MODE)
68 - add_subdirectory(tests)
69 -endif(NOT CLICK_MODE)

I believe this was added in the first place to ensure that the tests folder does not make its way into the clock app click package since the click package doesn't need to also include tests. I see that you added,

102 +add_subdirectory(unit)
103 +
104 +if(NOT CLICK_MODE)
105 + add_subdirectory(autopilot)
106 +endif(NOT CLICK_MODE)

But doesn't that mean that the units directory is still included in the click package?

review: Needs Information
Revision history for this message
Leo Arias (elopio) wrote : Posted in a previous version of this proposal

I built the package with click-buddy, and then:

click contents com.ubuntu.clock_3.1.96_amd64.click | grep tst

There doesn't seem to be tst files added to the package. Do you know who added that if originally, to ask him?

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : Posted in a previous version of this proposal

FAILED: Continuous integration, rev:98
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~canonical-platform-qa/ubuntu-clock-app/xvfb_and_qml_tests/+merge/234529/+edit-commit-message

http://91.189.93.70:8080/job/ubuntu-clock-app-ci/464/
Executed test runs:
    SUCCESS: http://91.189.93.70:8080/job/generic-mediumtests-utopic-python3/310
        deb: http://91.189.93.70:8080/job/generic-mediumtests-utopic-python3/310/artifact/work/output/*zip*/output.zip
    SUCCESS: http://91.189.93.70:8080/job/ubuntu-clock-app-utopic-amd64-ci/111

Click here to trigger a rebuild:
http://91.189.93.70:8080/job/ubuntu-clock-app-ci/464/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : Posted in a previous version of this proposal

FAILED: Continuous integration, rev:100
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~canonical-platform-qa/ubuntu-clock-app/xvfb_and_qml_tests/+merge/234529/+edit-commit-message

http://91.189.93.70:8080/job/ubuntu-clock-app-ci/466/
Executed test runs:
    SUCCESS: http://91.189.93.70:8080/job/generic-mediumtests-utopic-python3/313
        deb: http://91.189.93.70:8080/job/generic-mediumtests-utopic-python3/313/artifact/work/output/*zip*/output.zip
    SUCCESS: http://91.189.93.70:8080/job/ubuntu-clock-app-utopic-amd64-ci/113

Click here to trigger a rebuild:
http://91.189.93.70:8080/job/ubuntu-clock-app-ci/466/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : Posted in a previous version of this proposal
review: Approve (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Francis Ginther (fginther) wrote :

Leo, I think this is a great approach for running the qml tests. From my perspective, it's better to run the tests during the build, as it's then easier for the developers to run the tests as well and is more likely to happen all the time.

Implementing a jenkins only solution means that most developers won't run tests until they submit the MP, which is an unnecessary delay. Developers now have a template for adding QML tests that should work for other projects.

review: Approve
Revision history for this message
Nekhelesh Ramananthan (nik90) wrote :

Works as expected with jenkins. With my limited knowledge of CMake it looks okay. And most of the changes are within in the limits of the unit test directory. So it should be fine.

Thanks for the MP leo. We can now have qml tests run everything jenkins build the deb package.

review: Approve
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2014-09-18 15:20:25 +0000
3+++ CMakeLists.txt 2014-09-23 17:48:17 +0000
4@@ -17,6 +17,9 @@
5
6 option(INSTALL_TESTS "Install the tests on make install" on)
7 option(CLICK_MODE "Build as a click package" on)
8+option(USE_XVFB "Use XVFB to run qml tests" on)
9+
10+enable_testing()
11
12 # Standard install paths
13 include(GNUInstallDirs)
14@@ -96,21 +99,13 @@
15 add_subdirectory(app)
16 add_subdirectory(backend)
17 add_subdirectory(po)
18-if(NOT CLICK_MODE)
19- add_subdirectory(tests)
20-endif(NOT CLICK_MODE)
21+add_subdirectory(tests)
22
23 add_custom_target("autopilot" chmod +x ${CMAKE_SOURCE_DIR}/tests/autopilot/run
24 COMMAND ${CMAKE_SOURCE_DIR}/tests/autopilot/run
25 DEPENDS timezone timezone-qmldir alarmsettings alarmsettings-qmldir datetime datetime-qmldir
26 WORKING_DIRECTORY ./app)
27
28-enable_testing()
29-add_test(NAME basic
30- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/app
31- COMMAND /usr/bin/qmltestrunner -input ${CMAKE_SOURCE_DIR}/tests/unit -import ${CMAKE_BINARY_DIR}/backend
32-)
33-
34 add_custom_target("run" /usr/bin/qmlscene -I ${CMAKE_BINARY_DIR}/backend ${CMAKE_SOURCE_DIR}/app/ubuntu-clock-app.qml
35 DEPENDS timezone timezone-qmldir alarmsettings alarmsettings-qmldir datetime datetime-qmldir
36 WORKING_DIRECTORY ./app)
37
38=== modified file 'backend/CMakeLists.txt'
39--- backend/CMakeLists.txt 2014-08-13 14:38:12 +0000
40+++ backend/CMakeLists.txt 2014-09-23 17:48:17 +0000
41@@ -1,3 +1,5 @@
42+project(backend)
43+
44 include_directories(
45 ${CMAKE_CURRENT_SOURCE_DIR}
46 )
47
48=== modified file 'debian/control'
49--- debian/control 2014-08-19 19:11:35 +0000
50+++ debian/control 2014-09-23 17:48:17 +0000
51@@ -7,9 +7,13 @@
52 intltool,
53 python3 | python3-all | python3-dev | python3-all-dev,
54 python3-minimal,
55+ qml-module-qttest,
56 qt5-default,
57 qtbase5-dev,
58 qtdeclarative5-dev,
59+ qtdeclarative5-dev-tools,
60+ qtdeclarative5-ubuntu-ui-toolkit-plugin,
61+ xvfb,
62 Standards-Version: 3.9.5
63 Section: misc
64 Homepage: https://launchpad.net/ubuntu-clock-app
65
66=== modified file 'debian/rules'
67--- debian/rules 2014-08-08 15:57:16 +0000
68+++ debian/rules 2014-09-23 17:48:17 +0000
69@@ -11,7 +11,7 @@
70 dh_auto_configure -- -DCLICK_MODE=OFF
71
72 override_dh_auto_test:
73- echo
74+ CTEST_OUTPUT_ON_FAILURE=1 make -C obj-$(DEB_HOST_GNU_TYPE) test
75
76 override_dh_install:
77 dh_install --fail-missing
78
79=== modified file 'tests/CMakeLists.txt'
80--- tests/CMakeLists.txt 2014-08-08 15:57:16 +0000
81+++ tests/CMakeLists.txt 2014-09-23 17:48:17 +0000
82@@ -1,1 +1,6 @@
83-add_subdirectory(autopilot)
84+add_subdirectory(unit)
85+
86+if(NOT CLICK_MODE)
87+ add_subdirectory(autopilot)
88+endif(NOT CLICK_MODE)
89+
90
91=== added file 'tests/unit/CMakeLists.txt'
92--- tests/unit/CMakeLists.txt 1970-01-01 00:00:00 +0000
93+++ tests/unit/CMakeLists.txt 2014-09-23 17:48:17 +0000
94@@ -0,0 +1,38 @@
95+find_program(QMLTESTRUNNER_BIN
96+ NAMES qmltestrunner
97+ PATHS /usr/lib/*/qt5/bin
98+ NO_DEFAULT_PATH
99+)
100+
101+find_program(XVFB_RUN_BIN
102+ NAMES xvfb-run
103+)
104+
105+macro(DECLARE_QML_TEST TST_NAME TST_QML_FILE)
106+ if(USE_XVFB)
107+ set(COMMAND_PREFIX ${XVFB_RUN_BIN} -a -s "-screen 0 1024x768x24")
108+ else()
109+ set(COMMAND_PREFIX "")
110+ endif()
111+ add_test(NAME ${TST_NAME}
112+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
113+ COMMAND ${COMMAND_PREFIX} ${QMLTESTRUNNER_BIN} -import ${backend_BINARY_DIR} -input ${CMAKE_CURRENT_SOURCE_DIR}/${TST_QML_FILE}
114+ )
115+endmacro()
116+
117+if(QMLTESTRUNNER_BIN AND XVFB_RUN_BIN)
118+ declare_qml_test("AlarmLabel" tst_alarmLabel.qml)
119+ declare_qml_test("AlarmRepeat" tst_alarmRepeat.qml)
120+else()
121+ if (NOT QMLTESTRUNNER_BIN)
122+ message(WARNING "Qml tests disabled: qmltestrunner not found")
123+ else()
124+ message(WARNING "Qml tests disabled: xvfb-run not found")
125+ endif()
126+endif()
127+
128+set(QML_TST_FILES
129+ tst_alarmLabel.qml
130+ tst_alarmRepeat.qml
131+)
132+add_custom_target(tst_QmlFiles ALL SOURCES ${QML_TST_FILES})

Subscribers

People subscribed via source and target branches