Mir

Merge lp:~alan-griffiths/mir/workaround-1525003 into lp:mir

Proposed by Alan Griffiths
Status: Merged
Approved by: Alan Griffiths
Approved revision: no longer in the source branch.
Merged at revision: 3291
Proposed branch: lp:~alan-griffiths/mir/workaround-1525003
Merge into: lp:mir
Diff against target: 31 lines (+9/-4)
1 file modified
tests/acceptance-tests/throwback/test_client_cursor_api.cpp (+9/-4)
To merge this branch: bzr merge lp:~alan-griffiths/mir/workaround-1525003
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Alexandros Frantzis (community) Approve
Mir CI Bot continuous-integration Approve
Kevin DuBois (community) Approve
Daniel van Vugt Needs Information
Alberto Aguirre (community) Approve
Review via email: mp+284626@code.launchpad.net

Commit message

tests: Add a small delay to ensure the TestClientCursorAPI.cursor_passed_through_nested_server test conditions are set up correctly.

Description of the change

tests: Add a small delay to ensure the TestClientCursorAPI.cursor_passed_through_nested_server test conditions are set up correctly.

I'd really like a better approach, but I've not managed to identify a better approach, and chose to limit the time spent on this.

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

PASSED: Continuous integration, rev:3281
https://mir-jenkins.ubuntu.com/job/mir-ci/201/
Executed test runs:
    None: https://mir-jenkins.ubuntu.com/job/generic-update-mp/202/console

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

review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:3281
http://jenkins.qa.ubuntu.com/job/mir-ci/6176/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-android-vivid-i386-build/5756
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-clang-vivid-amd64-build/4663
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-mediumtests-vivid-touch/5712
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-mediumtests-xenial-touch/366
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-xenial-amd64-ci/500
        deb: http://jenkins.qa.ubuntu.com/job/mir-xenial-amd64-ci/500/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-xenial-i386-ci/500
        deb: http://jenkins.qa.ubuntu.com/job/mir-xenial-i386-ci/500/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-mediumtests-builder-vivid-armhf/5709
        deb: http://jenkins.qa.ubuntu.com/job/mir-mediumtests-builder-vivid-armhf/5709/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-mediumtests-runner-touch/8127
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/27206
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-mediumtests-builder-xenial-armhf/362
        deb: http://jenkins.qa.ubuntu.com/job/mir-mediumtests-builder-xenial-armhf/362/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-mediumtests-runner-xenial-touch/218
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/27211

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/mir-ci/6176/rebuild

review: Approve (continuous-integration)
Revision history for this message
Alberto Aguirre (albaguirre) wrote :

Yep I didn't see a better way either.

review: Approve
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

mir_surface_set_state is asynchronous and you're not waiting for it. That's a feature which is sometimes useful, but does it put your expectation at risk?

14 + mir_surface_set_state(surface, mir_surface_state_fullscreen);
15 auto conf = mir_cursor_configuration_from_name(mir_disabled_cursor_name);
16 - mir_wait_for(mir_surface_configure_cursor(surface, conf));
17 + mir_surface_configure_cursor(surface, conf);
18 mir_cursor_configuration_destroy(conf);

In theory at least our client API allows calls to complete out of order. Maybe none do just yet, but that's not something we should assume.

review: Needs Information
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

> mir_surface_set_state is asynchronous and you're not waiting for it. That's a
> feature which is sometimes useful, but does it put your expectation at risk?

No. Waiting for the RPC call to return doesn't add anything toward the expectation.

> In theory at least our client API allows calls to complete out of order. Maybe
> none do just yet, but that's not something we should assume.

I disagree with that theory. The server should handle calls in the order the client makes them.

Revision history for this message
Kevin DuBois (kdub) wrote :

lgtm, barring using some more rigging in the server side (which iirc, is tricky in throwback/)

review: Approve
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

I'm still not convinced this is theoretically correct. If the "mir_surface_set_state(surface, mir_surface_state_fullscreen);" contributes anything to the test then it will only do so if the request is completed in time. If the surface is not full screen before we do cursor tinkering then either some test may fail, or you didn't need the fullscreening in the first place.

I know that the server presently completes most requests in order, but don't think we document that, or should document that.

Needs another reviewer.

Revision history for this message
Alexandros Frantzis (afrantzis) wrote :

Given our current level of explicit guarantees (i.e. none), I agree with Daniel about this.

There are two questions of ordering/timing in the code:

1. Whether mir_surface_configure_cursor() will be processed by the server before mir_surface_set_state().
2. Whether mir_surface_configure_cursor() will have been processed by the server by the time we release the surface/connection.

We don't provide explicit guarantees for either of the above (AFAIK, please correct me if we do), although one could say that at least (1) is the expected behavior. We either need to make explicit guarantees about ordering (and ensure we keep our word == tests), or wait for each operation to complete.

Since providing the guarantees is outside the scope of this MP, I propose we just reinstated the waits for now, and have a discussion about the ordering topic.

review: Needs Fixing
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

> Since providing the guarantees is outside the scope of this MP, I propose we
> just reinstated the waits for now, and have a discussion about the ordering
> topic.

OK, but the mir_wait_for() calls do not address either of your points.

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

> Given our current level of explicit guarantees (i.e. none), I agree with
> Daniel about this.
>
> There are two questions of ordering/timing in the code:
>
> 1. Whether mir_surface_configure_cursor() will be processed by the server
> before mir_surface_set_state().

I say this is expected behavior - and would be surprised if we ever change that. Doing so would invalidate other tests - e.g. ClientLibrary.can_set_surface_state.

Further, if the server can re-order the requests, then waiting for the request submission to complete doesn't give any guarantee that the request has been handled.

> 2. Whether mir_surface_configure_cursor() will have been processed by the
> server by the time we release the surface/connection.

We wait (expectations_satisfied.wait_for_at_most_seconds(60);) for the server to process the call before closing the client.

Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:3282
https://mir-jenkins.ubuntu.com/job/mir-ci/216/
Executed test runs:
    None: https://mir-jenkins.ubuntu.com/job/generic-update-mp/217/console

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

review: Approve (continuous-integration)
Revision history for this message
Alexandros Frantzis (afrantzis) wrote :

> Further, if the server can re-order the requests, then waiting for the request submission
> to complete doesn't give any guarantee that the request has been handled.

Why not? (do you mean handled with success?)

> We wait (expectations_satisfied.wait_for_at_most_seconds(60);) for the server to process the
> call before closing the client.

Fair enough.

review: Approve
Revision history for this message
Alberto Aguirre (albaguirre) wrote :

The main issue is waiting for the nested display surface to become exposed and focused; there's currently no good way to capture those events. It's important because the nested server will eventually end up doing mgn::MirClientHostConnection::hide_cursor which will race with the surface being exposed+focused

The mir_surface_set_state and mir_surface_configure_cursor will happen in order at the server (by default ipc threads is 1).

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:3282
http://jenkins.qa.ubuntu.com/job/mir-ci/6194/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-android-vivid-i386-build/5786
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-clang-vivid-amd64-build/4693
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-mediumtests-vivid-touch/5742
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-mediumtests-xenial-touch/376
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-xenial-amd64-ci/518
        deb: http://jenkins.qa.ubuntu.com/job/mir-xenial-amd64-ci/518/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-xenial-i386-ci/518
        deb: http://jenkins.qa.ubuntu.com/job/mir-xenial-i386-ci/518/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-mediumtests-builder-vivid-armhf/5739
        deb: http://jenkins.qa.ubuntu.com/job/mir-mediumtests-builder-vivid-armhf/5739/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-mediumtests-runner-touch/8150
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/27279
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-mediumtests-builder-xenial-armhf/372
        deb: http://jenkins.qa.ubuntu.com/job/mir-mediumtests-builder-xenial-armhf/372/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-mediumtests-runner-xenial-touch/227
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/27286

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/mir-ci/6194/rebuild

review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/acceptance-tests/throwback/test_client_cursor_api.cpp'
2--- tests/acceptance-tests/throwback/test_client_cursor_api.cpp 2016-01-29 08:18:22 +0000
3+++ tests/acceptance-tests/throwback/test_client_cursor_api.cpp 2016-02-03 15:58:01 +0000
4@@ -463,6 +463,11 @@
5
6 void setup_cursor(MirSurface* surface) override
7 {
8+ // Workaround race condition (lp:1525003). I've tried, but I've not
9+ // found a better way to ensure that the host Mir server is "ready"
10+ // for the test logic. - alan_g
11+ std::this_thread::sleep_for(std::chrono::milliseconds(20));
12+
13 mir_wait_for(mir_surface_set_state(surface, mir_surface_state_fullscreen));
14 auto conf = mir_cursor_configuration_from_name(mir_disabled_cursor_name);
15 mir_wait_for(mir_surface_configure_cursor(surface, conf));
16@@ -483,11 +488,11 @@
17 .WillOnce(mt::WakeUp(&expectations_satisfied));
18
19 { // Ensure we finalize the client prior stopping the nested server
20- FullscreenDisabledCursorClient client{nested_mir.new_connection(), client_name_1};
21- client.run();
22+ FullscreenDisabledCursorClient client{nested_mir.new_connection(), client_name_1};
23+ client.run();
24
25- expectations_satisfied.wait_for_at_most_seconds(60);
26- expect_client_shutdown();
27+ expectations_satisfied.wait_for_at_most_seconds(60);
28+ expect_client_shutdown();
29 }
30
31 nested_mir.stop_server();

Subscribers

People subscribed via source and target branches