Mir

Merge lp:~vanvugt/mir/catchup-1570698 into lp:mir

Proposed by Daniel van Vugt
Status: Merged
Approved by: Daniel van Vugt
Approved revision: no longer in the source branch.
Merged at revision: 3714
Proposed branch: lp:~vanvugt/mir/catchup-1570698
Merge into: lp:mir
Diff against target: 35 lines (+12/-6)
1 file modified
tests/acceptance-tests/test_client_input.cpp (+12/-6)
To merge this branch: bzr merge lp:~vanvugt/mir/catchup-1570698
Reviewer Review Type Date Requested Status
Mir CI Bot continuous-integration Approve
Chris Halse Rogers Approve
Review via email: mp+306572@code.launchpad.net

Commit message

Improve the robustness of acceptance test:
  TestClientInput.receives_one_touch_event_per_frame
so that it is now less likely to fail on a heavily loaded or slow system.
(LP: #1570698)

Description of the change

In reality we haven't seen this test actually fail for almost three months but this is aimed at helping Brandon to get one of his branches to pass.

I actually started out trying to introduce fake server timestamps but found they created a lot of failures under Valgrind, presumably because the client wasn't using the same fake clock. But we should try to do that in future.

To post a comment you must log in.
Revision history for this message
Chris Halse Rogers (raof) wrote :

I think you could probably introduce a fake clock via a LD_PRELOAD library; https://github.com/wolfcw/libfaketime would be one such (which I don't think does *exactly* what we want, but could be cribbed from/patched to make something useful to us).

This seems to be a strict improvement on the status quo, though.

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

PASSED: Continuous integration, rev:3713
https://mir-jenkins.ubuntu.com/job/mir-ci/1798/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/2248
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/2311
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/2302
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/2302
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/2302
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=yakkety/2276
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=yakkety/2276/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/2276
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/2276/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=yakkety/2276
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=yakkety/2276/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/2276
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/2276/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/2276
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/2276/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/1798/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/test_client_input.cpp'
2--- tests/acceptance-tests/test_client_input.cpp 2016-06-02 08:20:22 +0000
3+++ tests/acceptance-tests/test_client_input.cpp 2016-09-23 04:09:36 +0000
4@@ -617,19 +617,25 @@
5
6 ASSERT_THAT(input_rate, Ge(2 * frame_rate));
7 ASSERT_THAT(ninputs, Gt(2 * nframes));
8+
9+ auto start_time = std::chrono::steady_clock::now();
10+
11 for (int i = 0; i < ninputs; ++i)
12 {
13+ /*
14+ * Sleep until the correct time for the frame. We use sleep_until
15+ * so that even on a very slow system it will catch up to the
16+ * correct real time for the frame and not drift out causing
17+ * test failures.
18+ */
19+ int frame_no = i / inputs_per_frame;
20+ std::this_thread::sleep_until(start_time + frame_no*frame_time);
21+
22 int const x = i;
23 int const y = 2 * i;
24 fake_touch_screen->emit_event(mis::a_touch_event()
25 .with_action(mis::TouchParameters::Action::Move)
26 .at_position({x,y}));
27-
28- // I would like to:
29- //std::this_thread::sleep_for(1000ms/input_rate);
30- // but this is more robust under Valgrind:
31- if (!((i+1) % inputs_per_frame))
32- std::this_thread::sleep_for(frame_time);
33 }
34
35 // Wait for the expected minimum number of events (should be quick)

Subscribers

People subscribed via source and target branches