Mir

Merge lp:~alan-griffiths/mir/negate-negative-error-codes into lp:~mir-team/mir/trunk

Proposed by Alan Griffiths
Status: Merged
Approved by: Alexandros Frantzis
Approved revision: no longer in the source branch.
Merged at revision: 912
Proposed branch: lp:~alan-griffiths/mir/negate-negative-error-codes
Merge into: lp:~mir-team/mir/trunk
Diff against target: 95 lines (+9/-10)
3 files modified
src/server/graphics/gbm/gbm_display.cpp (+0/-1)
src/server/graphics/gbm/gbm_display_helpers.cpp (+7/-7)
tests/unit-tests/graphics/gbm/test_gbm_display.cpp (+2/-2)
To merge this branch: bzr merge lp:~alan-griffiths/mir/negate-negative-error-codes
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Alexandros Frantzis (community) Approve
Review via email: mp+178041@code.launchpad.net

Commit message

graphics/gbm: negate negative error codes returned by drm so they can be interpreted by boost

Description of the change

graphics/gbm: negate negative error codes returned by drm so they can be interpreted by boost

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Alexandros Frantzis (afrantzis) wrote :

FWIW, changing ".WillOnce(SetErrnoAndReturn(EACCES, -1));" to ".WillOnce(Return(-EACCES))" in tests/unit-tests/graphics/gbm/test_gbm_display.cpp should be enough to fix the build failure.

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

> FWIW, changing ".WillOnce(SetErrnoAndReturn(EACCES, -1));" to
> ".WillOnce(Return(-EACCES))" in tests/unit-
> tests/graphics/gbm/test_gbm_display.cpp should be enough to fix the build
> failure.

s/build failure/test failure/

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

On 01/08/13 13:57, Alexandros Frantzis wrote:
> FWIW, changing ".WillOnce(SetErrnoAndReturn(EACCES, -1));" to ".WillOnce(Return(-EACCES))" in tests/unit-tests/graphics/gbm/test_gbm_display.cpp should be enough to fix the build failure.
>

Thanks - was just wondering how I didn't see the test failure - it is
rock solid now.

--
Alan Griffiths +44 (0)798 9938 758
Octopull Ltd http://www.octopull.co.uk/

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

I was wondering how the tests passed, since we didn't change the .WillOnce(SetErrnoAndReturn(EPERM, -1)); line (a bit below the EACCES line). I then realized that EPERM = 1... So, to be absolutely correct we should also change this line to Return(-EPERM) :)

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

Looks good. (the test CI failure above is unrelated to this change)

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/server/graphics/gbm/gbm_display.cpp'
2--- src/server/graphics/gbm/gbm_display.cpp 2013-07-30 14:23:10 +0000
3+++ src/server/graphics/gbm/gbm_display.cpp 2013-08-01 16:23:26 +0000
4@@ -27,7 +27,6 @@
5 #include "video_devices.h"
6 #include "overlapping_output_grouping.h"
7
8-#include "mir/main_loop.h"
9 #include "mir/graphics/display_report.h"
10 #include "mir/graphics/gl_context.h"
11 #include "mir/graphics/display_configuration_policy.h"
12
13=== modified file 'src/server/graphics/gbm/gbm_display_helpers.cpp'
14--- src/server/graphics/gbm/gbm_display_helpers.cpp 2013-07-04 22:50:11 +0000
15+++ src/server/graphics/gbm/gbm_display_helpers.cpp 2013-08-01 16:23:26 +0000
16@@ -89,7 +89,7 @@
17 close(auth_fd);
18 BOOST_THROW_EXCEPTION(
19 boost::enable_error_info(
20- std::runtime_error("Failed to get DRM device magic cookie")) << boost::errinfo_errno(ret));
21+ std::runtime_error("Failed to get DRM device magic cookie")) << boost::errinfo_errno(-ret));
22 }
23
24 if ((ret = drmAuthMagic(fd, magic)) < 0)
25@@ -97,7 +97,7 @@
26 close(auth_fd);
27 BOOST_THROW_EXCEPTION(
28 boost::enable_error_info(
29- std::runtime_error("Failed to authenticate DRM device magic cookie")) << boost::errinfo_errno(ret));
30+ std::runtime_error("Failed to authenticate DRM device magic cookie")) << boost::errinfo_errno(-ret));
31 }
32
33 return auth_fd;
34@@ -119,7 +119,7 @@
35 {
36 BOOST_THROW_EXCEPTION(
37 boost::enable_error_info(
38- std::runtime_error("Failed to authenticate DRM device magic cookie")) << boost::errinfo_errno(ret));
39+ std::runtime_error("Failed to authenticate DRM device magic cookie")) << boost::errinfo_errno(-ret));
40 }
41 }
42
43@@ -139,7 +139,7 @@
44 BOOST_THROW_EXCEPTION(
45 boost::enable_error_info(
46 std::runtime_error("Failed to drop DRM master"))
47- << boost::errinfo_errno(errno));
48+ << boost::errinfo_errno(-ret));
49 }
50 }
51
52@@ -159,7 +159,7 @@
53 BOOST_THROW_EXCEPTION(
54 boost::enable_error_info(
55 std::runtime_error("Failed to set DRM master"))
56- << boost::errinfo_errno(errno));
57+ << boost::errinfo_errno(-ret));
58 }
59 }
60
61@@ -223,7 +223,7 @@
62 if ((error = udev_enumerate_scan_devices(enumerator)))
63 BOOST_THROW_EXCEPTION(
64 boost::enable_error_info(
65- std::runtime_error("Failed to enumerate udev devices")) << boost::errinfo_errno(error));
66+ std::runtime_error("Failed to enumerate udev devices")) << boost::errinfo_errno(-error));
67
68 devices = udev_enumerate_get_list_entry(enumerator);
69 udev_list_entry_foreach(device, devices)
70@@ -281,7 +281,7 @@
71 {
72 BOOST_THROW_EXCEPTION(
73 boost::enable_error_info(
74- std::runtime_error("Error opening DRM device")) << boost::errinfo_errno(error));
75+ std::runtime_error("Error opening DRM device")) << boost::errinfo_errno(-error));
76 }
77
78 return tmp_fd;
79
80=== modified file 'tests/unit-tests/graphics/gbm/test_gbm_display.cpp'
81--- tests/unit-tests/graphics/gbm/test_gbm_display.cpp 2013-07-10 08:50:53 +0000
82+++ tests/unit-tests/graphics/gbm/test_gbm_display.cpp 2013-08-01 16:23:26 +0000
83@@ -671,10 +671,10 @@
84 using namespace testing;
85
86 EXPECT_CALL(mock_drm, drmDropMaster(_))
87- .WillOnce(SetErrnoAndReturn(EACCES, -1));
88+ .WillOnce(SetErrnoAndReturn(EACCES, -EACCES));
89
90 EXPECT_CALL(mock_drm, drmSetMaster(_))
91- .WillOnce(SetErrnoAndReturn(EPERM, -1));
92+ .WillOnce(SetErrnoAndReturn(EPERM, -EPERM));
93
94 EXPECT_CALL(*mock_report, report_drm_master_failure(EACCES));
95 EXPECT_CALL(*mock_report, report_drm_master_failure(EPERM));

Subscribers

People subscribed via source and target branches