Mir

Merge lp:~afrantzis/mir/fix-1418002-slow-valgrind into lp:mir

Proposed by Alexandros Frantzis
Status: Merged
Approved by: Alan Griffiths
Approved revision: no longer in the source branch.
Merged at revision: 2297
Proposed branch: lp:~afrantzis/mir/fix-1418002-slow-valgrind
Merge into: lp:mir
Diff against target: 89 lines (+12/-21)
2 files modified
tests/include/mir_test_doubles/null_display_buffer_compositor_factory.h (+8/-1)
tests/unit-tests/compositor/test_multi_threaded_compositor.cpp (+4/-20)
To merge this branch: bzr merge lp:~afrantzis/mir/fix-1418002-slow-valgrind
Reviewer Review Type Date Requested Status
Alan Griffiths Approve
PS Jenkins bot (community) continuous-integration Approve
Daniel van Vugt Approve
Review via email: mp+248551@code.launchpad.net

Commit message

tests: Avoid busy loops to decrease runtime under valgrind

Description of the change

tests: Avoid busy loops to decrease runtime under valgrind

To post a comment you must log in.
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Approved. But is this a fix for the bug or just related?

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

> Approved. But is this a fix for the bug or just related?

It's a fix for this bug, in the sense that it fixes an effect of the change in compositing behavior. That being said, that behavior is inefficient/wrong, see https://bugs.launchpad.net/mir/+bug/1418081 .

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

OK for now, I guess.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/include/mir_test_doubles/null_display_buffer_compositor_factory.h'
2--- tests/include/mir_test_doubles/null_display_buffer_compositor_factory.h 2015-01-21 07:34:50 +0000
3+++ tests/include/mir_test_doubles/null_display_buffer_compositor_factory.h 2015-02-04 14:00:51 +0000
4@@ -22,6 +22,8 @@
5 #include "mir/compositor/display_buffer_compositor_factory.h"
6 #include "mir/compositor/display_buffer_compositor.h"
7
8+#include <thread>
9+
10 namespace mir
11 {
12 namespace test
13@@ -37,7 +39,12 @@
14 {
15 struct NullDisplayBufferCompositor : compositor::DisplayBufferCompositor
16 {
17- void composite(compositor::SceneElementSequence&&) {}
18+ void composite(compositor::SceneElementSequence&&)
19+ {
20+ // yield() is needed to ensure reasonable runtime under
21+ // valgrind for some tests
22+ std::this_thread::yield();
23+ }
24 };
25
26 auto raw = new NullDisplayBufferCompositor{};
27
28=== modified file 'tests/unit-tests/compositor/test_multi_threaded_compositor.cpp'
29--- tests/unit-tests/compositor/test_multi_threaded_compositor.cpp 2015-01-22 09:55:39 +0000
30+++ tests/unit-tests/compositor/test_multi_threaded_compositor.cpp 2015-02-04 14:00:51 +0000
31@@ -31,6 +31,7 @@
32 #include "mir_test_doubles/mock_compositor_report.h"
33 #include "mir_test_doubles/mock_scene.h"
34 #include "mir_test_doubles/stub_scene.h"
35+#include "mir_test_doubles/null_display_buffer_compositor_factory.h"
36
37 #include <boost/throw_exception.hpp>
38
39@@ -312,23 +313,6 @@
40 unsigned int render_count;
41 };
42
43-class NullDisplayBufferCompositorFactory : public mc::DisplayBufferCompositorFactory
44-{
45-public:
46- std::unique_ptr<mc::DisplayBufferCompositor> create_compositor_for(mg::DisplayBuffer&)
47- {
48- struct NullDisplayBufferCompositor : mc::DisplayBufferCompositor
49- {
50- void composite(mc::SceneElementSequence&&) override
51- {
52- }
53- };
54-
55- auto raw = new NullDisplayBufferCompositor{};
56- return std::unique_ptr<NullDisplayBufferCompositor>(raw);
57- }
58-};
59-
60 class ThreadNameDisplayBufferCompositorFactory : public mc::DisplayBufferCompositorFactory
61 {
62 public:
63@@ -650,7 +634,7 @@
64
65 auto display = std::make_shared<StubDisplayWithMockBuffers>(nbuffers);
66 auto scene = std::make_shared<StubScene>();
67- auto db_compositor_factory = std::make_shared<NullDisplayBufferCompositorFactory>();
68+ auto db_compositor_factory = std::make_shared<mtd::NullDisplayBufferCompositorFactory>();
69 mc::MultiThreadedCompositor compositor{display, scene, db_compositor_factory, null_report, true};
70
71 display->for_each_mock_buffer([](mtd::MockDisplayBuffer& mock_buf)
72@@ -672,7 +656,7 @@
73 unsigned int const nbuffers{3};
74 auto display = std::make_shared<StubDisplayWithMockBuffers>(nbuffers);
75 auto mock_scene = std::make_shared<mtd::MockScene>();
76- auto db_compositor_factory = std::make_shared<NullDisplayBufferCompositorFactory>();
77+ auto db_compositor_factory = std::make_shared<mtd::NullDisplayBufferCompositorFactory>();
78 auto mock_report = std::make_shared<testing::NiceMock<mtd::MockCompositorReport>>();
79
80 EXPECT_CALL(*mock_report, started())
81@@ -775,7 +759,7 @@
82 unsigned int const nbuffers{3};
83 auto display = std::make_shared<StubDisplayWithMockBuffers>(nbuffers);
84 auto mock_scene = std::make_shared<NiceMock<mtd::MockScene>>();
85- auto db_compositor_factory = std::make_shared<NullDisplayBufferCompositorFactory>();
86+ auto db_compositor_factory = std::make_shared<mtd::NullDisplayBufferCompositorFactory>();
87 auto mock_report = std::make_shared<testing::NiceMock<mtd::MockCompositorReport>>();
88
89 EXPECT_CALL(*mock_scene, register_compositor(_))

Subscribers

People subscribed via source and target branches