Merge lp:~saviq/unity8/fix-parallel-build into lp:unity8

Proposed by Michał Sawicz
Status: Merged
Approved by: Michał Sawicz
Approved revision: 1637
Merged at revision: 1675
Proposed branch: lp:~saviq/unity8/fix-parallel-build
Merge into: lp:unity8
Diff against target: 238 lines (+103/-32)
6 files modified
plugins/LightDM/liblightdm/GreeterPrivate.cpp (+14/-5)
plugins/LightDM/liblightdm/GreeterPrivate.h (+1/-1)
tests/mocks/LightDM/CMakeLists.txt (+2/-5)
tests/mocks/Unity/Indicators/CMakeLists.txt (+1/-3)
tests/plugins/LightDM/CMakeLists.txt (+33/-18)
tests/plugins/LightDM/pam.cpp (+52/-0)
To merge this branch: bzr merge lp:~saviq/unity8/fix-parallel-build
Reviewer Review Type Date Requested Status
Albert Astals Cid (community) Approve
PS Jenkins bot (community) continuous-integration Needs Fixing
Review via email: mp+251455@code.launchpad.net

Commit message

Use targets instead of custom ld arguments for linking

This allows for implied dependencies

Description of the change

 * Are there any related MPs required for this MP to build/function as expected? Please list.
N/A
 * Did you perform an exploratory manual test run of your code change and any related functionality?
Y
 * Did you make sure that your branch does not contain spurious tags?
Y
 * If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
N/A
 * If you changed the UI, has there been a design review?
N/A

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Albert Astals Cid (aacid) wrote :

 * Did you perform an exploratory manual test run of the code change and any related functionality?
It's a build chain fix only

 * Did CI run pass?
Yes

 * Did you make sure that the branch does not contain spurious tags?
Yes

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/LightDM/liblightdm/GreeterPrivate.cpp'
2--- plugins/LightDM/liblightdm/GreeterPrivate.cpp 2015-01-20 11:50:19 +0000
3+++ plugins/LightDM/liblightdm/GreeterPrivate.cpp 2015-03-12 17:00:28 +0000
4@@ -56,7 +56,8 @@
5 this, SLOT(handleMessage(pam_handle *, QString, QLightDM::Greeter::MessageType)));
6 // This next connect is how we pass ResponseFutures between threads
7 connect(this, SIGNAL(showPrompt(pam_handle *, QString, QLightDM::Greeter::PromptType, QLightDM::GreeterImpl::ResponseFuture)),
8- this, SLOT(handlePrompt(pam_handle *, QString, QLightDM::Greeter::PromptType, QLightDM::GreeterImpl::ResponseFuture)));
9+ this, SLOT(handlePrompt(pam_handle *, QString, QLightDM::Greeter::PromptType, QLightDM::GreeterImpl::ResponseFuture)),
10+ Qt::BlockingQueuedConnection);
11 }
12
13 ~GreeterImpl()
14@@ -79,7 +80,7 @@
15
16 if (pam_start("lightdm", username.toUtf8(), &conversation, &pamHandle) == PAM_SUCCESS) {
17 appData->handle = pamHandle;
18- futureWatcher.setFuture(QtConcurrent::run(authenticateWithPam, pamHandle));
19+ futureWatcher.setFuture(QtConcurrent::mapped(QList<pam_handle*>() << pamHandle, authenticateWithPam));
20 } else {
21 delete appData;
22 greeterPrivate->authenticated = false;
23@@ -88,7 +89,7 @@
24 }
25 }
26
27- static int authenticateWithPam(pam_handle* pamHandle)
28+ static int authenticateWithPam(pam_handle* const& pamHandle)
29 {
30 int pamStatus = pam_authenticate(pamHandle, 0);
31 if (pamStatus == PAM_SUCCESS) {
32@@ -242,11 +243,14 @@
33 private:
34 void cancelPam()
35 {
36- // Unfortunately we can't simply cancel our QFuture because QtConcurrent::run doesn't support cancel
37 if (pamHandle != nullptr) {
38 pam_handle *handle = pamHandle;
39 pamHandle = nullptr; // to disable normal finishPam() handling
40- while (respond(QString())); // clear our local queue of QFutures
41+ futureWatcher.cancel();
42+ while (!futureWatcher.isFinished()) {
43+ QCoreApplication::processEvents(); // let signal/slot handling happen
44+ respond(QString());
45+ }
46 pam_end(handle, PAM_CONV_ERR);
47 }
48 }
49@@ -266,6 +270,11 @@
50 {
51 }
52
53+GreeterPrivate::~GreeterPrivate()
54+{
55+ delete m_impl;
56+}
57+
58 void GreeterPrivate::handleAuthenticate()
59 {
60 m_impl->start(authenticationUser);
61
62=== modified file 'plugins/LightDM/liblightdm/GreeterPrivate.h'
63--- plugins/LightDM/liblightdm/GreeterPrivate.h 2015-01-20 11:50:19 +0000
64+++ plugins/LightDM/liblightdm/GreeterPrivate.h 2015-03-12 17:00:28 +0000
65@@ -30,7 +30,7 @@
66 {
67 public:
68 explicit GreeterPrivate(Greeter* parent=0);
69- virtual ~GreeterPrivate() = default;
70+ virtual ~GreeterPrivate();
71
72 // These variables may not be used by all subclasses, that's no problem
73 bool authenticated;
74
75=== modified file 'tests/mocks/LightDM/CMakeLists.txt'
76--- tests/mocks/LightDM/CMakeLists.txt 2015-01-27 15:50:02 +0000
77+++ tests/mocks/LightDM/CMakeLists.txt 2015-03-12 17:00:28 +0000
78@@ -34,12 +34,9 @@
79 # installed on the system. So we make sure we link to our full fake version
80 # At run time, we can point to whichever version we happen to be using via
81 # LD_LIBRARY_PATH.
82-add_dependencies(MockLightDM-qml MockLightDM MockUserMetrics)
83 target_link_libraries(MockLightDM-qml
84- -L${CMAKE_CURRENT_BINARY_DIR}/liblightdm
85- -llightdm-qt5-2
86- -L${CMAKE_BINARY_DIR}/tests/mocks/libusermetrics
87- -lusermetricsoutput
88+ MockLightDM
89+ MockUserMetrics
90 unity8-private
91 )
92
93
94=== modified file 'tests/mocks/Unity/Indicators/CMakeLists.txt'
95--- tests/mocks/Unity/Indicators/CMakeLists.txt 2015-01-20 16:21:07 +0000
96+++ tests/mocks/Unity/Indicators/CMakeLists.txt 2015-03-12 17:00:28 +0000
97@@ -26,10 +26,8 @@
98 )
99 add_definitions(-DUNITYINDICATORS_LIBRARY)
100
101-add_dependencies(IndicatorsFakeQml QMenuModelQml)
102 target_link_libraries(IndicatorsFakeQml
103- -L${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel
104- -lqmenumodel
105+ QMenuModelQml
106 )
107
108 qt5_use_modules(IndicatorsFakeQml Core Qml Quick)
109
110=== modified file 'tests/plugins/LightDM/CMakeLists.txt'
111--- tests/plugins/LightDM/CMakeLists.txt 2015-02-05 21:13:16 +0000
112+++ tests/plugins/LightDM/CMakeLists.txt 2015-03-12 17:00:28 +0000
113@@ -1,8 +1,37 @@
114+add_definitions(
115+ -DCURRENT_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}"
116+ )
117+include_directories(
118+ ${CMAKE_CURRENT_BINARY_DIR}
119+ )
120+
121 add_executable(GreeterDBusTestExec
122 dbus.cpp
123 ${CMAKE_SOURCE_DIR}/plugins/LightDM/Greeter.cpp
124 )
125 qt5_use_modules(GreeterDBusTestExec Core DBus Quick Test)
126+target_link_libraries(GreeterDBusTestExec
127+ MockLightDM
128+ )
129+target_include_directories(GreeterDBusTestExec PUBLIC
130+ ${CMAKE_SOURCE_DIR}/plugins/LightDM
131+ ${CMAKE_SOURCE_DIR}/tests/mocks/LightDM
132+ )
133+add_binary_qml_test(GreeterDBus "${CMAKE_BINARY_DIR}/tests/mocks/LightDM/liblightdm" MockLightDM "QML2_IMPORT_PATH=${CMAKE_BINARY_DIR}/tests/mocks")
134+
135+add_executable(GreeterPamTestExec
136+ pam.cpp
137+ ${CMAKE_SOURCE_DIR}/plugins/LightDM/liblightdm/GreeterPrivate.cpp
138+ )
139+qt5_use_modules(GreeterPamTestExec Concurrent Core Test)
140+target_link_libraries(GreeterPamTestExec
141+ integratedLightDM
142+ )
143+target_include_directories(GreeterPamTestExec PUBLIC
144+ ${CMAKE_SOURCE_DIR}/plugins/LightDM/liblightdm
145+ )
146+add_qmltest_target(testGreeterPam "${CMAKE_CURRENT_BINARY_DIR}/GreeterPamTestExec" TRUE FALSE)
147+add_dependencies(testGreeterPam GreeterPamTestExec)
148
149 add_executable(GreeterUsersModelTestExec
150 usersmodel.cpp
151@@ -10,26 +39,12 @@
152 ${CMAKE_SOURCE_DIR}/plugins/Utils/unitysortfilterproxymodelqml.cpp
153 )
154 qt5_use_modules(GreeterUsersModelTestExec Core Test)
155-
156-include_directories(
157- ${CMAKE_CURRENT_BINARY_DIR}
158+target_link_libraries(GreeterUsersModelTestExec
159+ MockLightDM
160+ )
161+target_include_directories(GreeterUsersModelTestExec PUBLIC
162 ${CMAKE_SOURCE_DIR}/plugins/LightDM
163 ${CMAKE_SOURCE_DIR}/plugins/Utils
164 ${CMAKE_SOURCE_DIR}/tests/mocks/LightDM
165 )
166-
167-target_link_libraries(GreeterDBusTestExec
168- -L${CMAKE_BINARY_DIR}/tests/mocks/LightDM/liblightdm
169- -llightdm-qt5-2
170- )
171-
172-target_link_libraries(GreeterUsersModelTestExec
173- -L${CMAKE_BINARY_DIR}/tests/mocks/LightDM/liblightdm
174- -llightdm-qt5-2
175- )
176-
177-add_definitions(-DCURRENT_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}")
178-
179-add_binary_qml_test(GreeterDBus "${CMAKE_BINARY_DIR}/tests/mocks/LightDM/liblightdm" MockLightDM "QML2_IMPORT_PATH=${CMAKE_BINARY_DIR}/tests/mocks")
180-
181 add_binary_qml_test(GreeterUsersModel "${CMAKE_BINARY_DIR}/tests/mocks/LightDM/liblightdm" MockLightDM "LIBLIGHTDM_MOCK_MODE=full")
182
183=== added file 'tests/plugins/LightDM/pam.cpp'
184--- tests/plugins/LightDM/pam.cpp 1970-01-01 00:00:00 +0000
185+++ tests/plugins/LightDM/pam.cpp 2015-03-12 17:00:28 +0000
186@@ -0,0 +1,52 @@
187+/*
188+ * Copyright (C) 2015 Canonical, Ltd.
189+ *
190+ * This program is free software; you can redistribute it and/or modify
191+ * it under the terms of the GNU General Public License as published by
192+ * the Free Software Foundation; version 3.
193+ *
194+ * This program is distributed in the hope that it will be useful,
195+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
196+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
197+ * GNU General Public License for more details.
198+ *
199+ * You should have received a copy of the GNU General Public License
200+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
201+ */
202+
203+#include "GreeterPrivate.h"
204+
205+#include <QtTest>
206+
207+class GreeterPamTest : public QObject
208+{
209+ Q_OBJECT
210+
211+private Q_SLOTS:
212+
213+ void init()
214+ {
215+ m_greeterpriv = new QLightDM::GreeterPrivate();
216+ }
217+
218+ void cleanup()
219+ {
220+ delete m_greeterpriv;
221+ QTRY_COMPARE(QThreadPool::globalInstance()->activeThreadCount(), 0);
222+ }
223+
224+ void testRapidFireAuthentication()
225+ {
226+ m_greeterpriv->authenticationUser = qgetenv("USER");
227+ for (int i = 0; i < 100; i++) {
228+ m_greeterpriv->handleAuthenticate();
229+ }
230+ }
231+
232+private:
233+ QLightDM::GreeterPrivate *m_greeterpriv;
234+};
235+
236+QTEST_GUILESS_MAIN(GreeterPamTest)
237+
238+#include "pam.moc"

Subscribers

People subscribed via source and target branches