Merge lp:~alan-griffiths/mir/tidy-code into lp:mir
- tidy-code
- Merge into development-branch
Status: | Merged |
---|---|
Approved by: | Daniel van Vugt |
Approved revision: | no longer in the source branch. |
Merged at revision: | 4094 |
Proposed branch: | lp:~alan-griffiths/mir/tidy-code |
Merge into: | lp:mir |
Diff against target: |
489 lines (+0/-420) 6 files modified
src/client/CMakeLists.txt (+0/-1) src/client/private.cpp (+0/-26) src/include/client/mir/client/private.h (+0/-47) tests/integration-tests/CMakeLists.txt (+0/-10) tests/integration-tests/test_protobuf.cpp (+0/-316) tests/integration-tests/test_protobuf.proto (+0/-20) |
To merge this branch: | bzr merge lp:~alan-griffiths/mir/tidy-code |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Daniel van Vugt | Approve | ||
Andreas Pokorny (community) | Approve | ||
Mir CI Bot | continuous-integration | Approve | |
Review via email: mp+320227@code.launchpad.net |
Commit message
Remove unused mechanism for exposing the protobuf RPC channel
Description of the change
Mir CI Bot (mir-ci-bot) wrote : | # |
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:4095
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:4095
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Andreas Pokorny (andreas-pokorny) wrote : | # |
lots of red..
Daniel van Vugt (vanvugt) wrote : | # |
Sure, if it really is unused.
Preview Diff
1 | === modified file 'src/client/CMakeLists.txt' | |||
2 | --- src/client/CMakeLists.txt 2017-01-24 13:43:12 +0000 | |||
3 | +++ src/client/CMakeLists.txt 2017-03-17 17:00:15 +0000 | |||
4 | @@ -66,7 +66,6 @@ | |||
5 | 66 | logging/perf_report.cpp | 66 | logging/perf_report.cpp |
6 | 67 | default_connection_configuration.cpp | 67 | default_connection_configuration.cpp |
7 | 68 | connection_surface_map.cpp | 68 | connection_surface_map.cpp |
8 | 69 | private.cpp | ||
9 | 70 | frame_clock.cpp | 69 | frame_clock.cpp |
10 | 71 | mir_screencast.cpp | 70 | mir_screencast.cpp |
11 | 72 | mir_screencast_api.cpp | 71 | mir_screencast_api.cpp |
12 | 73 | 72 | ||
13 | === removed file 'src/client/private.cpp' | |||
14 | --- src/client/private.cpp 2017-01-18 02:29:37 +0000 | |||
15 | +++ src/client/private.cpp 1970-01-01 00:00:00 +0000 | |||
16 | @@ -1,26 +0,0 @@ | |||
17 | 1 | /* | ||
18 | 2 | * Copyright © 2014 Canonical Ltd. | ||
19 | 3 | * | ||
20 | 4 | * This program is free software: you can redistribute it and/or modify | ||
21 | 5 | * it under the terms of the GNU Lesser General Public License version 3 as | ||
22 | 6 | * published by the Free Software Foundation. | ||
23 | 7 | * | ||
24 | 8 | * This program is distributed in the hope that it will be useful, | ||
25 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
26 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
27 | 11 | * GNU Lesser General Public License for more details. | ||
28 | 12 | * | ||
29 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
30 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
31 | 15 | * | ||
32 | 16 | * Authored by: Alan Griffiths <alan@octopull.co.uk> | ||
33 | 17 | */ | ||
34 | 18 | |||
35 | 19 | #include "mir/client/private.h" | ||
36 | 20 | #include "mir_connection.h" | ||
37 | 21 | |||
38 | 22 | auto mir::client::the_rpc_channel(MirConnection *connection) | ||
39 | 23 | -> std::shared_ptr<mir::client::rpc::MirBasicRpcChannel> | ||
40 | 24 | { | ||
41 | 25 | return connection->rpc_channel(); | ||
42 | 26 | } | ||
43 | 27 | 0 | ||
44 | === removed file 'src/include/client/mir/client/private.h' | |||
45 | --- src/include/client/mir/client/private.h 2016-01-29 08:18:22 +0000 | |||
46 | +++ src/include/client/mir/client/private.h 1970-01-01 00:00:00 +0000 | |||
47 | @@ -1,47 +0,0 @@ | |||
48 | 1 | /* | ||
49 | 2 | * Copyright © 2014 Canonical Ltd. | ||
50 | 3 | * | ||
51 | 4 | * This program is free software: you can redistribute it and/or modify | ||
52 | 5 | * it under the terms of the GNU Lesser General Public License version 3 as | ||
53 | 6 | * published by the Free Software Foundation. | ||
54 | 7 | * | ||
55 | 8 | * This program is distributed in the hope that it will be useful, | ||
56 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
57 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
58 | 11 | * GNU Lesser General Public License for more details. | ||
59 | 12 | * | ||
60 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
61 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
62 | 15 | * | ||
63 | 16 | * Authored by: Alan Griffiths <alan@octopull.co.uk> | ||
64 | 17 | */ | ||
65 | 18 | |||
66 | 19 | #ifndef MIR_CLIENT_PRIVATE_H_ | ||
67 | 20 | #define MIR_CLIENT_PRIVATE_H_ | ||
68 | 21 | |||
69 | 22 | #include <mir_toolkit/client_types.h> | ||
70 | 23 | |||
71 | 24 | #include <memory> | ||
72 | 25 | |||
73 | 26 | namespace mir | ||
74 | 27 | { | ||
75 | 28 | namespace client | ||
76 | 29 | { | ||
77 | 30 | namespace rpc | ||
78 | 31 | { | ||
79 | 32 | class MirBasicRpcChannel; | ||
80 | 33 | } | ||
81 | 34 | /** | ||
82 | 35 | * Get the the RpcChannel associated with the connection. | ||
83 | 36 | * This is a "private" function to support development of client-side protobuf RPC calls | ||
84 | 37 | * using the Mir infrastructure. This intended for internal prototyping and there is no | ||
85 | 38 | * commitment to long term support. | ||
86 | 39 | * | ||
87 | 40 | * @param connection - a connection to a Mir server | ||
88 | 41 | * @return the RpcChannel associated with the connection | ||
89 | 42 | */ | ||
90 | 43 | std::shared_ptr<mir::client::rpc::MirBasicRpcChannel> the_rpc_channel(MirConnection* connection); | ||
91 | 44 | } | ||
92 | 45 | } | ||
93 | 46 | |||
94 | 47 | #endif /* MIR_CLIENT_PRIVATE_H_ */ | ||
95 | 48 | 0 | ||
96 | === modified file 'tests/integration-tests/CMakeLists.txt' | |||
97 | --- tests/integration-tests/CMakeLists.txt 2017-02-15 14:45:41 +0000 | |||
98 | +++ tests/integration-tests/CMakeLists.txt 2017-03-17 17:00:15 +0000 | |||
99 | @@ -2,7 +2,6 @@ | |||
100 | 2 | 2 | ||
101 | 3 | include_directories( | 3 | include_directories( |
102 | 4 | ${CMAKE_SOURCE_DIR} | 4 | ${CMAKE_SOURCE_DIR} |
103 | 5 | ${PROTOBUF_INCLUDE_DIRS} | ||
104 | 6 | ${CMAKE_CURRENT_BINARY_DIR} | 5 | ${CMAKE_CURRENT_BINARY_DIR} |
105 | 7 | ${PROJECT_SOURCE_DIR}/include/cookie | 6 | ${PROJECT_SOURCE_DIR}/include/cookie |
106 | 8 | ${PROJECT_SOURCE_DIR}/src/include/platform | 7 | ${PROJECT_SOURCE_DIR}/src/include/platform |
107 | @@ -14,11 +13,6 @@ | |||
108 | 14 | ${PROJECT_SOURCE_DIR}/include/renderers/sw | 13 | ${PROJECT_SOURCE_DIR}/include/renderers/sw |
109 | 15 | ) | 14 | ) |
110 | 16 | 15 | ||
111 | 17 | protobuf_generate_cpp( | ||
112 | 18 | GENERATED_PROTOBUF_SRCS GENERATED_PROTOBUF_HDRS | ||
113 | 19 | test_protobuf.proto | ||
114 | 20 | ) | ||
115 | 21 | |||
116 | 22 | set( | 16 | set( |
117 | 23 | INTEGRATION_TESTS_SRCS | 17 | INTEGRATION_TESTS_SRCS |
118 | 24 | test_focus_selection.cpp | 18 | test_focus_selection.cpp |
119 | @@ -27,7 +21,6 @@ | |||
120 | 27 | test_buffer_scheduling.cpp | 21 | test_buffer_scheduling.cpp |
121 | 28 | test_client_screencast.cpp | 22 | test_client_screencast.cpp |
122 | 29 | test_large_messages.cpp | 23 | test_large_messages.cpp |
123 | 30 | test_protobuf.cpp | ||
124 | 31 | test_surfaceloop.cpp | 24 | test_surfaceloop.cpp |
125 | 32 | test_stale_frames.cpp | 25 | test_stale_frames.cpp |
126 | 33 | test_test_framework.cpp | 26 | test_test_framework.cpp |
127 | @@ -42,8 +35,6 @@ | |||
128 | 42 | test_server_shutdown.cpp | 35 | test_server_shutdown.cpp |
129 | 43 | test_session.cpp | 36 | test_session.cpp |
130 | 44 | session_management.cpp | 37 | session_management.cpp |
131 | 45 | ${GENERATED_PROTOBUF_SRCS} | ||
132 | 46 | ${GENERATED_PROTOBUF_HDRS} | ||
133 | 47 | ) | 38 | ) |
134 | 48 | 39 | ||
135 | 49 | add_subdirectory(client/) | 40 | add_subdirectory(client/) |
136 | @@ -77,7 +68,6 @@ | |||
137 | 77 | 68 | ||
138 | 78 | mircommon | 69 | mircommon |
139 | 79 | 70 | ||
140 | 80 | ${PROTOBUF_LITE_LIBRARIES} | ||
141 | 81 | ${Boost_LIBRARIES} | 71 | ${Boost_LIBRARIES} |
142 | 82 | ${GTEST_BOTH_LIBRARIES} | 72 | ${GTEST_BOTH_LIBRARIES} |
143 | 83 | ${GMOCK_LIBRARY} | 73 | ${GMOCK_LIBRARY} |
144 | 84 | 74 | ||
145 | === removed file 'tests/integration-tests/test_protobuf.cpp' | |||
146 | --- tests/integration-tests/test_protobuf.cpp 2017-01-18 02:29:37 +0000 | |||
147 | +++ tests/integration-tests/test_protobuf.cpp 1970-01-01 00:00:00 +0000 | |||
148 | @@ -1,316 +0,0 @@ | |||
149 | 1 | /* | ||
150 | 2 | * Copyright © 2014 Canonical Ltd. | ||
151 | 3 | * | ||
152 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
153 | 5 | * under the terms of the GNU General Public License version 3, | ||
154 | 6 | * as published by the Free Software Foundation. | ||
155 | 7 | * | ||
156 | 8 | * This program is distributed in the hope that it will be useful, | ||
157 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
158 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
159 | 11 | * GNU General Public License for more details. | ||
160 | 12 | * | ||
161 | 13 | * You should have received a copy of the GNU General Public License | ||
162 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
163 | 15 | * | ||
164 | 16 | * Authored by: Alan Griffiths <alan@octopull.co.uk> | ||
165 | 17 | */ | ||
166 | 18 | |||
167 | 19 | #include "test_protobuf.pb.h" | ||
168 | 20 | #include "src/client/rpc/mir_basic_rpc_channel.h" | ||
169 | 21 | |||
170 | 22 | #include "mir_toolkit/mir_client_library.h" | ||
171 | 23 | #include "mir/client/private.h" | ||
172 | 24 | #include "mir/frontend/protobuf_message_sender.h" | ||
173 | 25 | #include "mir/frontend/protobuf_connection_creator.h" | ||
174 | 26 | #include "mir/frontend/template_protobuf_message_processor.h" | ||
175 | 27 | |||
176 | 28 | #include "mir_test_framework/stubbed_server_configuration.h" | ||
177 | 29 | #include "mir_test_framework/in_process_server.h" | ||
178 | 30 | #include "mir/test/doubles/null_platform_ipc_operations.h" | ||
179 | 31 | |||
180 | 32 | #include <gtest/gtest.h> | ||
181 | 33 | #include <gmock/gmock.h> | ||
182 | 34 | |||
183 | 35 | #include <atomic> | ||
184 | 36 | |||
185 | 37 | namespace mf = mir::frontend; | ||
186 | 38 | namespace mfd = mir::frontend::detail; | ||
187 | 39 | namespace mtf = mir_test_framework; | ||
188 | 40 | |||
189 | 41 | /*************************************************************************/ | ||
190 | 42 | /*************************************************************************/ | ||
191 | 43 | /* Note that the functionality demonstrated here relies on "detail" and */ | ||
192 | 44 | /* is not guaranteed to be supported in future. */ | ||
193 | 45 | /*************************************************************************/ | ||
194 | 46 | /*************************************************************************/ | ||
195 | 47 | namespace | ||
196 | 48 | { | ||
197 | 49 | struct DemoMirServer | ||
198 | 50 | { | ||
199 | 51 | MOCK_CONST_METHOD1(on_call, std::string(std::string)); | ||
200 | 52 | |||
201 | 53 | DemoMirServer() | ||
202 | 54 | { | ||
203 | 55 | using namespace testing; | ||
204 | 56 | ON_CALL(*this, on_call(_)).WillByDefault(Return("ok")); | ||
205 | 57 | } | ||
206 | 58 | |||
207 | 59 | void function( | ||
208 | 60 | mir::protobuf::test::Parameters const* parameters, | ||
209 | 61 | mir::protobuf::test::Result* response, | ||
210 | 62 | google::protobuf::Closure* done) | ||
211 | 63 | { | ||
212 | 64 | response->set_value(on_call(parameters->name())); | ||
213 | 65 | done->Run(); | ||
214 | 66 | } | ||
215 | 67 | }; | ||
216 | 68 | |||
217 | 69 | struct AMirServer | ||
218 | 70 | { | ||
219 | 71 | AMirServer(std::shared_ptr<mir::client::rpc::MirBasicRpcChannel> const& channel) | ||
220 | 72 | : channel{channel} | ||
221 | 73 | { | ||
222 | 74 | } | ||
223 | 75 | |||
224 | 76 | void function( | ||
225 | 77 | mir::protobuf::test::Parameters const* parameters, | ||
226 | 78 | mir::protobuf::test::Result* response, | ||
227 | 79 | google::protobuf::Closure* done) | ||
228 | 80 | { | ||
229 | 81 | channel->call_method(std::string(__func__), parameters, response, done); | ||
230 | 82 | } | ||
231 | 83 | std::shared_ptr<mir::client::rpc::MirBasicRpcChannel> channel; | ||
232 | 84 | }; | ||
233 | 85 | |||
234 | 86 | // using a global for easy access from tests and DemoMessageProcessor::dispatch() | ||
235 | 87 | DemoMirServer* demo_mir_server; | ||
236 | 88 | |||
237 | 89 | struct DemoMessageProcessor : mfd::MessageProcessor | ||
238 | 90 | { | ||
239 | 91 | DemoMessageProcessor( | ||
240 | 92 | std::shared_ptr<mfd::ProtobufMessageSender> const& sender, | ||
241 | 93 | std::shared_ptr<mfd::MessageProcessor> const& wrapped) : | ||
242 | 94 | sender(sender), | ||
243 | 95 | wrapped(wrapped) {} | ||
244 | 96 | |||
245 | 97 | void client_pid(int /*pid*/) override {} | ||
246 | 98 | |||
247 | 99 | bool dispatch(mfd::Invocation const& invocation, std::vector<mir::Fd> const& fds) override | ||
248 | 100 | { | ||
249 | 101 | if ("function" == invocation.method_name()) | ||
250 | 102 | { | ||
251 | 103 | mfd::invoke( | ||
252 | 104 | this, | ||
253 | 105 | demo_mir_server, | ||
254 | 106 | &DemoMirServer::function, | ||
255 | 107 | invocation); | ||
256 | 108 | return true; | ||
257 | 109 | } | ||
258 | 110 | |||
259 | 111 | return wrapped->dispatch(invocation, fds); | ||
260 | 112 | } | ||
261 | 113 | |||
262 | 114 | void send_response(::google::protobuf::uint32 id, ::google::protobuf::MessageLite* response) | ||
263 | 115 | { | ||
264 | 116 | sender->send_response(id, response, {}); | ||
265 | 117 | } | ||
266 | 118 | |||
267 | 119 | std::shared_ptr<mfd::ProtobufMessageSender> const sender; | ||
268 | 120 | std::shared_ptr<mfd::MessageProcessor> const wrapped; | ||
269 | 121 | }; | ||
270 | 122 | |||
271 | 123 | struct DemoConnectionCreator : mf::ProtobufConnectionCreator | ||
272 | 124 | { | ||
273 | 125 | using ProtobufConnectionCreator::ProtobufConnectionCreator; | ||
274 | 126 | |||
275 | 127 | MOCK_CONST_METHOD3(create_processor, | ||
276 | 128 | std::shared_ptr<mfd::MessageProcessor>( | ||
277 | 129 | std::shared_ptr<mfd::ProtobufMessageSender> const& sender, | ||
278 | 130 | std::shared_ptr<mfd::DisplayServer> const& display_server, | ||
279 | 131 | std::shared_ptr<mf::MessageProcessorReport> const& report)); | ||
280 | 132 | |||
281 | 133 | std::shared_ptr<mfd::MessageProcessor> create_wrapped_processor( | ||
282 | 134 | std::shared_ptr<mfd::ProtobufMessageSender> const& sender, | ||
283 | 135 | std::shared_ptr<mfd::DisplayServer> const& display_server, | ||
284 | 136 | std::shared_ptr<mf::MessageProcessorReport> const& report) const | ||
285 | 137 | { | ||
286 | 138 | auto const wrapped = mf::ProtobufConnectionCreator::create_processor( | ||
287 | 139 | sender, | ||
288 | 140 | display_server, | ||
289 | 141 | report); | ||
290 | 142 | |||
291 | 143 | return std::make_shared<DemoMessageProcessor>(sender, wrapped); | ||
292 | 144 | } | ||
293 | 145 | |||
294 | 146 | std::shared_ptr<mfd::MessageProcessor> create_unwrapped_processor( | ||
295 | 147 | std::shared_ptr<mfd::ProtobufMessageSender> const& sender, | ||
296 | 148 | std::shared_ptr<mfd::DisplayServer> const& display_server, | ||
297 | 149 | std::shared_ptr<mf::MessageProcessorReport> const& report) const | ||
298 | 150 | { | ||
299 | 151 | return mf::ProtobufConnectionCreator::create_processor( | ||
300 | 152 | sender, | ||
301 | 153 | display_server, | ||
302 | 154 | report); | ||
303 | 155 | } | ||
304 | 156 | }; | ||
305 | 157 | |||
306 | 158 | struct DemoServerConfiguration : mtf::StubbedServerConfiguration | ||
307 | 159 | { | ||
308 | 160 | std::shared_ptr<mf::ConnectionCreator> the_connection_creator() override | ||
309 | 161 | { | ||
310 | 162 | return connection_creator([this] | ||
311 | 163 | { | ||
312 | 164 | return std::make_shared<DemoConnectionCreator>( | ||
313 | 165 | new_ipc_factory(the_session_authorizer()), | ||
314 | 166 | the_session_authorizer(), | ||
315 | 167 | std::make_shared<mir::test::doubles::NullPlatformIpcOperations>(), | ||
316 | 168 | the_message_processor_report()); | ||
317 | 169 | }); | ||
318 | 170 | } | ||
319 | 171 | |||
320 | 172 | }; | ||
321 | 173 | |||
322 | 174 | struct DemoPrivateProtobuf : mtf::InProcessServer | ||
323 | 175 | { | ||
324 | 176 | mir::DefaultServerConfiguration& server_config() override { return my_server_config; } | ||
325 | 177 | |||
326 | 178 | DemoServerConfiguration my_server_config; | ||
327 | 179 | |||
328 | 180 | std::shared_ptr<DemoConnectionCreator> demo_connection_creator; | ||
329 | 181 | |||
330 | 182 | void SetUp() override | ||
331 | 183 | { | ||
332 | 184 | ::demo_mir_server = &demo_mir_server; | ||
333 | 185 | |||
334 | 186 | mtf::InProcessServer::SetUp(); | ||
335 | 187 | demo_connection_creator = std::dynamic_pointer_cast<DemoConnectionCreator>(my_server_config.the_connection_creator()); | ||
336 | 188 | |||
337 | 189 | using namespace testing; | ||
338 | 190 | ASSERT_THAT(demo_connection_creator, NotNull()); | ||
339 | 191 | |||
340 | 192 | ON_CALL(*demo_connection_creator, create_processor(_, _, _)) | ||
341 | 193 | .WillByDefault(Invoke(demo_connection_creator.get(), &DemoConnectionCreator::create_unwrapped_processor)); | ||
342 | 194 | } | ||
343 | 195 | |||
344 | 196 | testing::NiceMock<DemoMirServer> demo_mir_server; | ||
345 | 197 | }; | ||
346 | 198 | |||
347 | 199 | void callback(std::atomic<bool>* called_back) { called_back->store(true); } | ||
348 | 200 | char const* const nothing_returned = "Nothing returned"; | ||
349 | 201 | } | ||
350 | 202 | |||
351 | 203 | TEST_F(DemoPrivateProtobuf, client_calls_server) | ||
352 | 204 | { | ||
353 | 205 | using namespace testing; | ||
354 | 206 | EXPECT_CALL(*demo_connection_creator, create_processor(_, _, _)); | ||
355 | 207 | |||
356 | 208 | auto const connection = mir_connect_sync(new_connection().c_str(), __PRETTY_FUNCTION__); | ||
357 | 209 | ASSERT_TRUE(mir_connection_is_valid(connection)); | ||
358 | 210 | |||
359 | 211 | auto const rpc_channel = mir::client::the_rpc_channel(connection); | ||
360 | 212 | |||
361 | 213 | using namespace mir::protobuf::test; | ||
362 | 214 | using namespace google::protobuf; | ||
363 | 215 | |||
364 | 216 | AMirServer server(rpc_channel); | ||
365 | 217 | |||
366 | 218 | Parameters parameters; | ||
367 | 219 | parameters.set_name(__PRETTY_FUNCTION__); | ||
368 | 220 | |||
369 | 221 | Result result; | ||
370 | 222 | result.set_error(nothing_returned); | ||
371 | 223 | std::atomic<bool> called_back{false}; | ||
372 | 224 | |||
373 | 225 | // After the call there's a race between the client releasing the connection | ||
374 | 226 | // and the server dropping the connection. | ||
375 | 227 | // If the latter wins we'll invoke the client's lifecycle_event_callback. | ||
376 | 228 | // As the default callback kills the process with SIGHUP, we need to | ||
377 | 229 | // replace it to ensure the test can continue. | ||
378 | 230 | mir_connection_set_lifecycle_event_callback( | ||
379 | 231 | connection, | ||
380 | 232 | [](MirConnection*, MirLifecycleState, void*){}, | ||
381 | 233 | nullptr); | ||
382 | 234 | |||
383 | 235 | // Note: | ||
384 | 236 | // As the default server won't recognise this call it drops the connection | ||
385 | 237 | // resulting in a callback when the connection drops (but result being unchanged) | ||
386 | 238 | server.function( | ||
387 | 239 | ¶meters, | ||
388 | 240 | &result, | ||
389 | 241 | NewCallback(&callback, &called_back)); | ||
390 | 242 | |||
391 | 243 | mir_connection_release(connection); | ||
392 | 244 | |||
393 | 245 | EXPECT_TRUE(called_back); | ||
394 | 246 | EXPECT_THAT(result.error(), Eq(nothing_returned)); | ||
395 | 247 | } | ||
396 | 248 | |||
397 | 249 | TEST_F(DemoPrivateProtobuf, wrapping_message_processor) | ||
398 | 250 | { | ||
399 | 251 | using namespace testing; | ||
400 | 252 | EXPECT_CALL(*demo_connection_creator, create_processor(_, _, _)) | ||
401 | 253 | .Times(1) | ||
402 | 254 | .WillOnce(Invoke(demo_connection_creator.get(), &DemoConnectionCreator::create_wrapped_processor)); | ||
403 | 255 | |||
404 | 256 | auto const connection = mir_connect_sync(new_connection().c_str(), __PRETTY_FUNCTION__); | ||
405 | 257 | |||
406 | 258 | mir_connection_release(connection); | ||
407 | 259 | } | ||
408 | 260 | |||
409 | 261 | TEST_F(DemoPrivateProtobuf, server_receives_function_call) | ||
410 | 262 | { | ||
411 | 263 | using namespace testing; | ||
412 | 264 | EXPECT_CALL(*demo_connection_creator, create_processor(_, _, _)) | ||
413 | 265 | .WillRepeatedly(Invoke(demo_connection_creator.get(), &DemoConnectionCreator::create_wrapped_processor)); | ||
414 | 266 | |||
415 | 267 | auto const connection = mir_connect_sync(new_connection().c_str(), __PRETTY_FUNCTION__); | ||
416 | 268 | ASSERT_TRUE(mir_connection_is_valid(connection)); | ||
417 | 269 | |||
418 | 270 | auto const rpc_channel = mir::client::the_rpc_channel(connection); | ||
419 | 271 | |||
420 | 272 | using namespace mir::protobuf::test; | ||
421 | 273 | using namespace google::protobuf; | ||
422 | 274 | |||
423 | 275 | AMirServer server(rpc_channel); | ||
424 | 276 | |||
425 | 277 | Parameters parameters; | ||
426 | 278 | Result result; | ||
427 | 279 | parameters.set_name(__PRETTY_FUNCTION__); | ||
428 | 280 | |||
429 | 281 | EXPECT_CALL(demo_mir_server, on_call(__PRETTY_FUNCTION__)).Times(1); | ||
430 | 282 | |||
431 | 283 | server.function(¶meters, &result, NewCallback([]{})); | ||
432 | 284 | |||
433 | 285 | mir_connection_release(connection); | ||
434 | 286 | } | ||
435 | 287 | |||
436 | 288 | |||
437 | 289 | TEST_F(DemoPrivateProtobuf, client_receives_result) | ||
438 | 290 | { | ||
439 | 291 | using namespace testing; | ||
440 | 292 | EXPECT_CALL(*demo_connection_creator, create_processor(_, _, _)) | ||
441 | 293 | .WillRepeatedly(Invoke(demo_connection_creator.get(), &DemoConnectionCreator::create_wrapped_processor)); | ||
442 | 294 | EXPECT_CALL(demo_mir_server, on_call(_)).WillRepeatedly(Return(__PRETTY_FUNCTION__)); | ||
443 | 295 | |||
444 | 296 | auto const connection = mir_connect_sync(new_connection().c_str(), __PRETTY_FUNCTION__); | ||
445 | 297 | ASSERT_TRUE(mir_connection_is_valid(connection)); | ||
446 | 298 | |||
447 | 299 | auto const rpc_channel = mir::client::the_rpc_channel(connection); | ||
448 | 300 | |||
449 | 301 | using namespace mir::protobuf::test; | ||
450 | 302 | using namespace google::protobuf; | ||
451 | 303 | |||
452 | 304 | AMirServer server(rpc_channel); | ||
453 | 305 | |||
454 | 306 | Parameters parameters; | ||
455 | 307 | Result result; | ||
456 | 308 | parameters.set_name(__PRETTY_FUNCTION__); | ||
457 | 309 | |||
458 | 310 | server.function(¶meters, &result, NewCallback([]{})); | ||
459 | 311 | |||
460 | 312 | mir_connection_release(connection); | ||
461 | 313 | |||
462 | 314 | EXPECT_THAT(result.has_error(), Eq(false)); | ||
463 | 315 | EXPECT_THAT(result.value(), Eq(__PRETTY_FUNCTION__)); | ||
464 | 316 | } | ||
465 | 317 | 0 | ||
466 | === removed file 'tests/integration-tests/test_protobuf.proto' | |||
467 | --- tests/integration-tests/test_protobuf.proto 2017-01-18 02:29:37 +0000 | |||
468 | +++ tests/integration-tests/test_protobuf.proto 1970-01-01 00:00:00 +0000 | |||
469 | @@ -1,20 +0,0 @@ | |||
470 | 1 | syntax = "proto2"; | ||
471 | 2 | option optimize_for = LITE_RUNTIME; | ||
472 | 3 | |||
473 | 4 | package mir.protobuf.test; | ||
474 | 5 | |||
475 | 6 | message Parameters { | ||
476 | 7 | required string name = 1; | ||
477 | 8 | } | ||
478 | 9 | |||
479 | 10 | message StructuredError { | ||
480 | 11 | optional uint32 domain = 1; | ||
481 | 12 | optional uint32 code = 2; | ||
482 | 13 | } | ||
483 | 14 | |||
484 | 15 | message Result { | ||
485 | 16 | optional string error = 127; | ||
486 | 17 | optional StructuredError structured_error = 128; | ||
487 | 18 | optional string value = 1; | ||
488 | 19 | } | ||
489 | 20 |
PASSED: Continuous integration, rev:4094 /mir-jenkins. ubuntu. com/job/ mir-ci/ 3183/ /mir-jenkins. ubuntu. com/job/ build-mir/ 4279 /mir-jenkins. ubuntu. com/job/ build-0- fetch/4366 /mir-jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= vivid+overlay/ 4356 /mir-jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= xenial+ overlay/ 4356 /mir-jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= zesty/4356 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= clang,platform= mesa,release= zesty/4306 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= clang,platform= mesa,release= zesty/4306/ artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= gcc,platform= mesa,release= xenial+ overlay/ 4306 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= gcc,platform= mesa,release= xenial+ overlay/ 4306/artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= gcc,platform= mesa,release= zesty/4306 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= gcc,platform= mesa,release= zesty/4306/ artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= cross-armhf, compiler= gcc,platform= android, release= vivid+overlay/ 4306 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= cross-armhf, compiler= gcc,platform= android, release= vivid+overlay/ 4306/artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= android, release= vivid+overlay/ 4306 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= android, release= vivid+overlay/ 4306/artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= mesa,release= xenial+ overlay/ 4306 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= mesa,release= xenial+ overlay/ 4306/artifact/ output/ *zip*/output. zip
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild: /mir-jenkins. ubuntu. com/job/ mir-ci/ 3183/rebuild
https:/