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
1=== modified file 'tests/privileged-tests/test_input_events.cpp'
2--- tests/privileged-tests/test_input_events.cpp 2016-07-14 19:23:24 +0000
3+++ tests/privileged-tests/test_input_events.cpp 2016-07-14 19:23:24 +0000
4@@ -225,6 +225,8 @@
5 static int const key_down = 1;
6 static int const key_up = 0;
7
8+ std::chrono::milliseconds const pause_time { 100 };
9+
10 std::shared_ptr<mtf::Process> host_server;
11 std::shared_ptr<mtf::Process> nested_server;
12 FakeInputDevice fake_keyboard;
13@@ -236,55 +238,67 @@
14 {
15 using namespace testing;
16
17- MockInputHandler handler;
18-
19- MirConnectionUPtr host_connection{
20- mir_connect_sync(host_socket.c_str(), "test"),
21- mir_connection_release};
22- auto surface = create_surface_with_input_handler(host_connection.get(), &handler);
23-
24- mt::Signal all_events_received;
25- InSequence seq;
26- EXPECT_CALL(handler,
27- handle_input(AllOf(mt::KeyDownEvent(), mt::KeyOfSymbol(XKB_KEY_a))));
28- EXPECT_CALL(handler,
29- handle_input(AllOf(mt::KeyUpEvent(), mt::KeyOfSymbol(XKB_KEY_a))))
30- .WillOnce(mt::WakeUp(&all_events_received));
31-
32+ auto client = mtf::fork_and_run_in_a_different_process(
33+ [this]
34+ {
35+ MockInputHandler handler;
36+
37+ MirConnectionUPtr host_connection{
38+ mir_connect_sync(host_socket.c_str(), "test"),
39+ mir_connection_release};
40+ auto surface = create_surface_with_input_handler(host_connection.get(), &handler);
41+
42+ mt::Signal all_events_received;
43+ InSequence seq;
44+ EXPECT_CALL(handler,
45+ handle_input(AllOf(mt::KeyDownEvent(), mt::KeyOfSymbol(XKB_KEY_a))));
46+ EXPECT_CALL(handler,
47+ handle_input(AllOf(mt::KeyUpEvent(), mt::KeyOfSymbol(XKB_KEY_a))))
48+ .WillOnce(mt::WakeUp(&all_events_received));
49+ all_events_received.wait_for(std::chrono::seconds{5});
50+ },
51+ [] { return EXIT_SUCCESS; });
52+
53+ std::this_thread::sleep_for(pause_time);
54 fake_keyboard.emit_event(EV_KEY, KEY_A, key_down);
55 fake_keyboard.emit_event(EV_KEY, KEY_A, key_up);
56 fake_keyboard.syn();
57-
58- all_events_received.wait_for(std::chrono::seconds{5});
59+ EXPECT_TRUE(client->wait_for_termination().succeeded());
60 }
61
62-TEST_F(InputEvents, DISABLED_reach_nested_client)
63+TEST_F(InputEvents, reach_nested_client)
64 {
65 using namespace testing;
66-
67- MockInputHandler handler;
68-
69- MirConnectionUPtr nested_connection{
70- mir_connect_sync(nested_socket.c_str(), "test"),
71- mir_connection_release};
72- auto surface = create_surface_with_input_handler(nested_connection.get(), &handler);
73-
74 // Give some time to the nested server to swap its framebuffer, so the nested
75 // server window becomes visible and focused and can accept input events.
76 // TODO: Find a more reliable way to wait for the nested server to gain focus
77- std::this_thread::sleep_for(100ms);
78-
79- mt::Signal all_events_received;
80- InSequence seq;
81- EXPECT_CALL(handler,
82- handle_input(AllOf(mt::KeyDownEvent(), mt::KeyOfSymbol(XKB_KEY_a))));
83- EXPECT_CALL(handler,
84- handle_input(AllOf(mt::KeyUpEvent(), mt::KeyOfSymbol(XKB_KEY_a))))
85- .WillOnce(mt::WakeUp(&all_events_received));
86-
87+ std::this_thread::sleep_for(pause_time);
88+
89+ auto client = mtf::fork_and_run_in_a_different_process(
90+ [this]
91+ {
92+ MockInputHandler handler;
93+
94+ MirConnectionUPtr nested_connection{
95+ mir_connect_sync(nested_socket.c_str(), "test"),
96+ mir_connection_release};
97+ auto surface = create_surface_with_input_handler(nested_connection.get(), &handler);
98+
99+ mt::Signal all_events_received;
100+ InSequence seq;
101+ EXPECT_CALL(handler,
102+ handle_input(AllOf(mt::KeyDownEvent(), mt::KeyOfSymbol(XKB_KEY_a))));
103+ EXPECT_CALL(handler,
104+ handle_input(AllOf(mt::KeyUpEvent(), mt::KeyOfSymbol(XKB_KEY_a))))
105+ .WillOnce(mt::WakeUp(&all_events_received));
106+
107+ all_events_received.wait_for(std::chrono::seconds{5});
108+ },
109+ [] { return EXIT_SUCCESS; });
110+
111+ std::this_thread::sleep_for(pause_time);
112 fake_keyboard.emit_event(EV_KEY, KEY_A, key_down);
113 fake_keyboard.emit_event(EV_KEY, KEY_A, key_up);
114 fake_keyboard.syn();
115-
116- all_events_received.wait_for(std::chrono::seconds{5});
117+ EXPECT_TRUE(client->wait_for_termination().succeeded());
118 }

Subscribers

People subscribed via source and target branches