Mir

Merge lp:~kdub/mir/fix-1603145 into lp:mir

Proposed by Kevin DuBois
Status: Work in progress
Proposed branch: lp:~kdub/mir/fix-1603145
Merge into: lp:mir
Prerequisite: lp:~kdub/mir/fix-ci
Diff against target: 118 lines (+52/-38)
1 file modified
tests/privileged-tests/test_input_events.cpp (+52/-38)
To merge this branch: bzr merge lp:~kdub/mir/fix-1603145
Reviewer Review Type Date Requested Status
Mir CI Bot continuous-integration Approve
Mir development team Pending
Review via email: mp+300118@code.launchpad.net

Commit message

fix lp: #1603145 by ensuring client code runs in its own process as well, to work around android drivers that have load/unload problems.

fixes: LP: #1603145

Description of the change

fix lp: #1603145 by ensuring client code runs in its own process as well, to work around android drivers that have load/unload problems.

fixes: LP: #1603145

This seems to have been caused by a hybris update... maybe this is a result of hybris. Worth looking into upstream, but for now, this seems the best way to work around.

To post a comment you must log in.
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:3593
https://mir-jenkins.ubuntu.com/job/mir-ci/1288/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/1506
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/1559
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1550
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/1550
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/1550
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/1521
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/1521/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/1521
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/1521/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/1521
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/1521/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/1521
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/1521/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/1521
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/1521/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/1288/rebuild

review: Approve (continuous-integration)

Unmerged revisions

3593. By Kevin DuBois

re-enable test

3592. By Kevin DuBois

merge base

3591. By Kevin DuBois

fork off the client process in the privileged tests as well

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'tests/privileged-tests/test_input_events.cpp'
--- tests/privileged-tests/test_input_events.cpp 2016-07-14 19:23:24 +0000
+++ tests/privileged-tests/test_input_events.cpp 2016-07-14 19:23:24 +0000
@@ -225,6 +225,8 @@
225 static int const key_down = 1;225 static int const key_down = 1;
226 static int const key_up = 0;226 static int const key_up = 0;
227227
228 std::chrono::milliseconds const pause_time { 100 };
229
228 std::shared_ptr<mtf::Process> host_server;230 std::shared_ptr<mtf::Process> host_server;
229 std::shared_ptr<mtf::Process> nested_server;231 std::shared_ptr<mtf::Process> nested_server;
230 FakeInputDevice fake_keyboard;232 FakeInputDevice fake_keyboard;
@@ -236,55 +238,67 @@
236{238{
237 using namespace testing;239 using namespace testing;
238240
239 MockInputHandler handler;241 auto client = mtf::fork_and_run_in_a_different_process(
240242 [this]
241 MirConnectionUPtr host_connection{243 {
242 mir_connect_sync(host_socket.c_str(), "test"),244 MockInputHandler handler;
243 mir_connection_release};245
244 auto surface = create_surface_with_input_handler(host_connection.get(), &handler);246 MirConnectionUPtr host_connection{
245247 mir_connect_sync(host_socket.c_str(), "test"),
246 mt::Signal all_events_received;248 mir_connection_release};
247 InSequence seq;249 auto surface = create_surface_with_input_handler(host_connection.get(), &handler);
248 EXPECT_CALL(handler,250
249 handle_input(AllOf(mt::KeyDownEvent(), mt::KeyOfSymbol(XKB_KEY_a))));251 mt::Signal all_events_received;
250 EXPECT_CALL(handler,252 InSequence seq;
251 handle_input(AllOf(mt::KeyUpEvent(), mt::KeyOfSymbol(XKB_KEY_a))))253 EXPECT_CALL(handler,
252 .WillOnce(mt::WakeUp(&all_events_received));254 handle_input(AllOf(mt::KeyDownEvent(), mt::KeyOfSymbol(XKB_KEY_a))));
253255 EXPECT_CALL(handler,
256 handle_input(AllOf(mt::KeyUpEvent(), mt::KeyOfSymbol(XKB_KEY_a))))
257 .WillOnce(mt::WakeUp(&all_events_received));
258 all_events_received.wait_for(std::chrono::seconds{5});
259 },
260 [] { return EXIT_SUCCESS; });
261
262 std::this_thread::sleep_for(pause_time);
254 fake_keyboard.emit_event(EV_KEY, KEY_A, key_down);263 fake_keyboard.emit_event(EV_KEY, KEY_A, key_down);
255 fake_keyboard.emit_event(EV_KEY, KEY_A, key_up);264 fake_keyboard.emit_event(EV_KEY, KEY_A, key_up);
256 fake_keyboard.syn();265 fake_keyboard.syn();
257266 EXPECT_TRUE(client->wait_for_termination().succeeded());
258 all_events_received.wait_for(std::chrono::seconds{5});
259}267}
260268
261TEST_F(InputEvents, DISABLED_reach_nested_client)269TEST_F(InputEvents, reach_nested_client)
262{270{
263 using namespace testing;271 using namespace testing;
264
265 MockInputHandler handler;
266
267 MirConnectionUPtr nested_connection{
268 mir_connect_sync(nested_socket.c_str(), "test"),
269 mir_connection_release};
270 auto surface = create_surface_with_input_handler(nested_connection.get(), &handler);
271
272 // Give some time to the nested server to swap its framebuffer, so the nested272 // Give some time to the nested server to swap its framebuffer, so the nested
273 // server window becomes visible and focused and can accept input events.273 // server window becomes visible and focused and can accept input events.
274 // TODO: Find a more reliable way to wait for the nested server to gain focus274 // TODO: Find a more reliable way to wait for the nested server to gain focus
275 std::this_thread::sleep_for(100ms);275 std::this_thread::sleep_for(pause_time);
276276
277 mt::Signal all_events_received;277 auto client = mtf::fork_and_run_in_a_different_process(
278 InSequence seq;278 [this]
279 EXPECT_CALL(handler,279 {
280 handle_input(AllOf(mt::KeyDownEvent(), mt::KeyOfSymbol(XKB_KEY_a))));280 MockInputHandler handler;
281 EXPECT_CALL(handler,281
282 handle_input(AllOf(mt::KeyUpEvent(), mt::KeyOfSymbol(XKB_KEY_a))))282 MirConnectionUPtr nested_connection{
283 .WillOnce(mt::WakeUp(&all_events_received));283 mir_connect_sync(nested_socket.c_str(), "test"),
284284 mir_connection_release};
285 auto surface = create_surface_with_input_handler(nested_connection.get(), &handler);
286
287 mt::Signal all_events_received;
288 InSequence seq;
289 EXPECT_CALL(handler,
290 handle_input(AllOf(mt::KeyDownEvent(), mt::KeyOfSymbol(XKB_KEY_a))));
291 EXPECT_CALL(handler,
292 handle_input(AllOf(mt::KeyUpEvent(), mt::KeyOfSymbol(XKB_KEY_a))))
293 .WillOnce(mt::WakeUp(&all_events_received));
294
295 all_events_received.wait_for(std::chrono::seconds{5});
296 },
297 [] { return EXIT_SUCCESS; });
298
299 std::this_thread::sleep_for(pause_time);
285 fake_keyboard.emit_event(EV_KEY, KEY_A, key_down);300 fake_keyboard.emit_event(EV_KEY, KEY_A, key_down);
286 fake_keyboard.emit_event(EV_KEY, KEY_A, key_up);301 fake_keyboard.emit_event(EV_KEY, KEY_A, key_up);
287 fake_keyboard.syn();302 fake_keyboard.syn();
288303 EXPECT_TRUE(client->wait_for_termination().succeeded());
289 all_events_received.wait_for(std::chrono::seconds{5});
290}304}

Subscribers

People subscribed via source and target branches