Mir

Merge lp:~vanvugt/mir/revive-trusty into lp:mir

Proposed by Daniel van Vugt
Status: Rejected
Rejected by: Daniel van Vugt
Proposed branch: lp:~vanvugt/mir/revive-trusty
Merge into: lp:mir
Diff against target: 196 lines (+55/-16)
9 files modified
debian/control (+1/-0)
doc/building_source_for_pc.md (+13/-4)
src/client/mir_screencast.h (+1/-0)
src/platforms/mesa/server/cursor.cpp (+5/-0)
src/server/symbols.map (+8/-0)
tests/acceptance-tests/test_client_surface_visibility.cpp (+1/-1)
tests/acceptance-tests/throwback/test_focus_selection.cpp (+1/-1)
tests/unit-tests/geometry/test-rectangles.cpp (+20/-10)
tests/unit-tests/graphics/mesa/test_cursor.cpp (+5/-0)
To merge this branch: bzr merge lp:~vanvugt/mir/revive-trusty
Reviewer Review Type Date Requested Status
Alan Griffiths Disapprove
PS Jenkins bot (community) continuous-integration Approve
Robert Carr (community) Abstain
Alexandros Frantzis (community) Needs Fixing
Chris Halse Rogers Needs Information
Marco Trevisan (TreviƱo) Pending
Review via email: mp+249789@code.launchpad.net

Commit message

Revive support for building on trusty and generally improve portability
of the source code (LP: #1418962)

Description of the change

In addition to 3v1n0's initial fixes, this proposal makes lp:mir buildable without any hacks. Just using standard trusty packages and gcc.

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

The test changes are making a non-trivial change to the expectations; presumably that's because the UnorderedElements matcher is a newly added feature?

review: Needs Information
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Yep, apparently UnorderedElementsAre is quite new (post-trusty). ElementsAre has been around longer.

Revision history for this message
Chris Halse Rogers (raof) wrote :

Rather than adding an unwanted constraint, could you implement UnorderedElementsAre when it doesn't already exist?

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

First of all we need to make an official decision about whether we want to support trusty, or, more generally, what's the oldest release we want to support at any point in time (perhaps there is a decision and I am not aware of it?).

Also, as discussed before, unless we have a trusty build as part of CI, we will keep on breaking compatibility.

> Rather than adding an unwanted constraint, could you implement UnorderedElementsAre when it doesn't already exist?

+1, Rectangles wasn't meant to guarantee a particular ordering of the contained rectangles (although the current implementation does retain input order, but that's a detail we should depend on).

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

> Rather than adding an unwanted constraint, could you implement
> UnorderedElementsAre when it doesn't already exist?

+1

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

> > Rather than adding an unwanted constraint, could you implement
> > UnorderedElementsAre when it doesn't already exist?
>
> +1

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

The test case is a trivial problem. I'd rather delete it than argue, but it can also be rewritten in other ways...

Yes, trusty is important. We need to give users like Trevinho the option of using the the latest LTS release and still be able to work with the Mir source. Even if we didn't care about trusty, the improved portability is worth having (until it becomes too painful as the Android headers have).

lp:~vanvugt/mir/revive-trusty updated
2320. By Daniel van Vugt

Merge latest trunk

2321. By Daniel van Vugt

Rewrite test case in a way that doesn't assume ordering.

2322. By Daniel van Vugt

Rewrite in the horizontal style

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

120 + static std::vector<Rectangle> unique_elements(Rectangles const& rects)

No need for static.

156 + EXPECT_THAT(unique_elements(rectangles),
157 + AllOf(SizeIs(2), Contains(rect[0]), Contains(rect[2])));

The test, as written before, checked exactly the post-conditions that were required from the Rectangles class. That is:

1. Rectangles can contain multiple equal rectangles.
2. Rectangles does not guarantee ordering of the rectangles.

The new version of the test ignores (1). Granted, we do check (1) in a dedicated test, but in the dedicated test we are dealing with a Rectangles object containing multiple rectangles of a single kind only. The changed test checks behavior in the presence of different kinds of rectangles.

It seems wrong to make a test less expressive only to work around backward compatibility issues.

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

> It seems wrong to make a test less expressive only to work around backward
> compatibility issues.

+1

Is it even useful? Who needs to be able to build /the tests/ on trusty?

review: Needs Fixing
Revision history for this message
Robert Carr (robertcarr) wrote :

We can settle the issue of whether this is required out of MP (as it'so pened on the mailing list now).

If required this seems ok to me. (though maybe its worth encapsulating Alf's comment in to a source code comment.

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

I think the needs fixing comments are debatable. But easier to satisfy than argue.

lp:~vanvugt/mir/revive-trusty updated
2323. By Daniel van Vugt

Merge latest trunk

2324. By Daniel van Vugt

Don't mention "static".
Also restore support for testing multiple identical rectangles.

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 :

The original version of the tests is easier to follow so this change needs more justification than has been presented to date.

review: Disapprove
Revision history for this message
Robert Carr (robertcarr) wrote :

If someone who hasn't reviewed this yet marks resubmit it could have one of each review status.

Unmerged revisions

2324. By Daniel van Vugt

Don't mention "static".
Also restore support for testing multiple identical rectangles.

2323. By Daniel van Vugt

Merge latest trunk

2322. By Daniel van Vugt

Rewrite in the horizontal style

2321. By Daniel van Vugt

Rewrite test case in a way that doesn't assume ordering.

2320. By Daniel van Vugt

Merge latest trunk

2319. By Daniel van Vugt

Update docs

2318. By Daniel van Vugt

Fully revive support for building on trusty (even with gcc). The only
caveat is that Android support is not available. So you need to build
with:
  cmake -DMIR_PLATFORM=mesa

2317. By Daniel van Vugt

Drop Android hacks. Android builds on trusty are too messy to support now.

2316. By Daniel van Vugt

Merge latest trunk

2315. By Daniel van Vugt

Start reviving trusty support. But it's getting messy.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2015-02-18 03:04:18 +0000
3+++ debian/control 2015-02-18 03:31:48 +0000
4@@ -37,6 +37,7 @@
5 umockdev (>= 0.8.7),
6 libudev-dev,
7 google-mock (>= 1.6.0+svn437),
8+ libgtest-dev,
9 valgrind [!arm64],
10 libglib2.0-dev,
11 Standards-Version: 3.9.4
12
13=== modified file 'doc/building_source_for_pc.md'
14--- doc/building_source_for_pc.md 2013-08-28 03:41:48 +0000
15+++ doc/building_source_for_pc.md 2015-02-18 03:31:48 +0000
16@@ -37,10 +37,19 @@
17
18 $ cmake-gui ..
19
20-The next step is to build the source and run the tests:
21-
22- $ make (-j8)
23- $ ctest
24+The next step is to build the source:
25+
26+ $ make
27+
28+If you get build failures in Android-related files (e.g. on trusty), you
29+can reconfigure the build to skip those and only build for desktop:
30+
31+ $ cmake .. -DMIR_PLATFORM=mesa
32+ $ make
33+
34+Run the tests:
35+
36+ $ make test # or ctest
37
38 To install Mir just use the normal make install command:
39
40
41=== modified file 'src/client/mir_screencast.h'
42--- src/client/mir_screencast.h 2015-02-13 06:12:34 +0000
43+++ src/client/mir_screencast.h 2015-02-18 03:31:48 +0000
44@@ -26,6 +26,7 @@
45 #include "mir/geometry/rectangle.h"
46
47 #include <EGL/eglplatform.h>
48+#include <memory>
49
50 namespace mir
51 {
52
53=== modified file 'src/platforms/mesa/server/cursor.cpp'
54--- src/platforms/mesa/server/cursor.cpp 2015-02-17 02:35:11 +0000
55+++ src/platforms/mesa/server/cursor.cpp 2015-02-18 03:31:48 +0000
56@@ -32,6 +32,11 @@
57 #include <stdexcept>
58 #include <vector>
59
60+// Detect older versions of gbm.h
61+#ifndef GBM_BO_IMPORT_FD // Unrelated, but the only detectable macro change
62+#define GBM_BO_USE_CURSOR GBM_BO_USE_CURSOR_64X64
63+#endif
64+
65 namespace mg = mir::graphics;
66 namespace mgm = mg::mesa;
67 namespace geom = mir::geometry;
68
69=== modified file 'src/server/symbols.map'
70--- src/server/symbols.map 2015-02-13 06:12:34 +0000
71+++ src/server/symbols.map 2015-02-18 03:31:48 +0000
72@@ -765,3 +765,11 @@
73 };
74 local: *;
75 };
76+
77+MIR_SERVER_29.1 {
78+ global:
79+ extern "C++" {
80+ vtable?for?mir::DefaultServerConfiguration;
81+ };
82+} MIR_SERVER_29;
83+
84
85=== modified file 'tests/acceptance-tests/test_client_surface_visibility.cpp'
86--- tests/acceptance-tests/test_client_surface_visibility.cpp 2015-02-13 06:12:34 +0000
87+++ tests/acceptance-tests/test_client_surface_visibility.cpp 2015-02-18 03:31:48 +0000
88@@ -50,7 +50,7 @@
89 StoringShell(
90 std::shared_ptr<msh::Shell> const& wrapped,
91 std::shared_ptr<ms::SurfaceCoordinator> const surface_coordinator) :
92- msh::ShellWrapper{wrapped},
93+ msh::ShellWrapper(wrapped),
94 surface_coordinator{surface_coordinator}
95 {}
96
97
98=== modified file 'tests/acceptance-tests/throwback/test_focus_selection.cpp'
99--- tests/acceptance-tests/throwback/test_focus_selection.cpp 2015-02-13 06:12:34 +0000
100+++ tests/acceptance-tests/throwback/test_focus_selection.cpp 2015-02-18 03:31:48 +0000
101@@ -49,7 +49,7 @@
102 struct MockShell : msh::ShellWrapper
103 {
104 explicit MockShell(std::shared_ptr<msh::Shell> const& wrapped) :
105- msh::ShellWrapper{wrapped}
106+ msh::ShellWrapper(wrapped)
107 {
108 ON_CALL(*this, open_session(_, _, _)).
109 WillByDefault(Invoke(this, &MockShell::unmocked_open_session));
110
111=== modified file 'tests/unit-tests/geometry/test-rectangles.cpp'
112--- tests/unit-tests/geometry/test-rectangles.cpp 2015-02-13 06:12:34 +0000
113+++ tests/unit-tests/geometry/test-rectangles.cpp 2015-02-18 03:31:48 +0000
114@@ -23,6 +23,7 @@
115
116 #include <iterator>
117 #include <algorithm>
118+#include <initializer_list>
119
120 using namespace mir::geometry;
121 using namespace testing;
122@@ -32,15 +33,24 @@
123 struct TestRectangles : Test
124 {
125 Rectangles rectangles;
126-
127- auto contents_of(Rectangles const& rects) ->
128- std::vector<Rectangle>
129- {
130- return {std::begin(rects), std::end(rects)};
131- }
132 };
133+
134+bool equivalent_unordered(Rectangles const& rects,
135+ std::initializer_list<Rectangle> const& expect)
136+{
137+ std::vector<Rectangle> check(rects.begin(), rects.end());
138+ for (auto const& e : expect)
139+ {
140+ auto it = std::find(check.begin(), check.end(), e);
141+ if (it == check.end())
142+ return false;
143+ check.erase(it);
144+ }
145+ return check.empty();
146 }
147
148+} // namespace
149+
150 TEST_F(TestRectangles, rectangles_empty)
151 {
152 EXPECT_EQ(0, std::distance(rectangles.begin(), rectangles.end()));
153@@ -240,23 +250,23 @@
154
155 rectangles = Rectangles{rect[0], rect[1], rect[2]};
156
157- EXPECT_THAT(contents_of(rectangles), UnorderedElementsAre(rect[0], rect[1], rect[2]));
158+ EXPECT_TRUE(equivalent_unordered(rectangles, {rect[0], rect[1], rect[2]}));
159 EXPECT_THAT(rectangles.bounding_rectangle(), Eq(Rectangle{{0,0}, {900,700}}));
160
161 rectangles.remove(rect[1]);
162
163- EXPECT_THAT(contents_of(rectangles), UnorderedElementsAre(rect[0], rect[2]));
164+ EXPECT_TRUE(equivalent_unordered(rectangles, {rect[0], rect[2]}));
165 EXPECT_THAT(rectangles.bounding_rectangle(), Eq(Rectangle{{0,0}, {900,600}}));
166
167 rectangles.add(rect[2]);
168
169- EXPECT_THAT(contents_of(rectangles), UnorderedElementsAre(rect[0], rect[2], rect[2]));
170+ EXPECT_TRUE(equivalent_unordered(rectangles, {rect[0], rect[2], rect[2]}));
171 EXPECT_THAT(rectangles.bounding_rectangle(), Eq(Rectangle{{0,0}, {900,600}}));
172
173 rectangles.add(rect[1]);
174 rectangles.remove(rect[2]);
175
176- EXPECT_THAT(contents_of(rectangles), UnorderedElementsAre(rect[0], rect[1], rect[2]));
177+ EXPECT_TRUE(equivalent_unordered(rectangles, {rect[0], rect[1], rect[2]}));
178 EXPECT_THAT(rectangles.bounding_rectangle(), Eq(Rectangle{{0,0}, {900,700}}));
179 }
180
181
182=== modified file 'tests/unit-tests/graphics/mesa/test_cursor.cpp'
183--- tests/unit-tests/graphics/mesa/test_cursor.cpp 2015-01-22 09:00:14 +0000
184+++ tests/unit-tests/graphics/mesa/test_cursor.cpp 2015-02-18 03:31:48 +0000
185@@ -35,6 +35,11 @@
186
187 #include <string.h>
188
189+// Detect older versions of gbm.h
190+#ifndef GBM_BO_IMPORT_FD // Unrelated, but the only detectable macro change
191+#define GBM_BO_USE_CURSOR GBM_BO_USE_CURSOR_64X64
192+#endif
193+
194 namespace mg = mir::graphics;
195 namespace mgm = mir::graphics::mesa;
196 namespace geom = mir::geometry;

Subscribers

People subscribed via source and target branches