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
=== modified file 'src/server/graphics/gbm/gbm_display.cpp'
--- src/server/graphics/gbm/gbm_display.cpp 2013-07-30 14:23:10 +0000
+++ src/server/graphics/gbm/gbm_display.cpp 2013-08-01 16:23:26 +0000
@@ -27,7 +27,6 @@
27#include "video_devices.h"27#include "video_devices.h"
28#include "overlapping_output_grouping.h"28#include "overlapping_output_grouping.h"
2929
30#include "mir/main_loop.h"
31#include "mir/graphics/display_report.h"30#include "mir/graphics/display_report.h"
32#include "mir/graphics/gl_context.h"31#include "mir/graphics/gl_context.h"
33#include "mir/graphics/display_configuration_policy.h"32#include "mir/graphics/display_configuration_policy.h"
3433
=== modified file 'src/server/graphics/gbm/gbm_display_helpers.cpp'
--- src/server/graphics/gbm/gbm_display_helpers.cpp 2013-07-04 22:50:11 +0000
+++ src/server/graphics/gbm/gbm_display_helpers.cpp 2013-08-01 16:23:26 +0000
@@ -89,7 +89,7 @@
89 close(auth_fd);89 close(auth_fd);
90 BOOST_THROW_EXCEPTION(90 BOOST_THROW_EXCEPTION(
91 boost::enable_error_info(91 boost::enable_error_info(
92 std::runtime_error("Failed to get DRM device magic cookie")) << boost::errinfo_errno(ret));92 std::runtime_error("Failed to get DRM device magic cookie")) << boost::errinfo_errno(-ret));
93 }93 }
9494
95 if ((ret = drmAuthMagic(fd, magic)) < 0)95 if ((ret = drmAuthMagic(fd, magic)) < 0)
@@ -97,7 +97,7 @@
97 close(auth_fd);97 close(auth_fd);
98 BOOST_THROW_EXCEPTION(98 BOOST_THROW_EXCEPTION(
99 boost::enable_error_info(99 boost::enable_error_info(
100 std::runtime_error("Failed to authenticate DRM device magic cookie")) << boost::errinfo_errno(ret));100 std::runtime_error("Failed to authenticate DRM device magic cookie")) << boost::errinfo_errno(-ret));
101 }101 }
102102
103 return auth_fd;103 return auth_fd;
@@ -119,7 +119,7 @@
119 {119 {
120 BOOST_THROW_EXCEPTION(120 BOOST_THROW_EXCEPTION(
121 boost::enable_error_info(121 boost::enable_error_info(
122 std::runtime_error("Failed to authenticate DRM device magic cookie")) << boost::errinfo_errno(ret));122 std::runtime_error("Failed to authenticate DRM device magic cookie")) << boost::errinfo_errno(-ret));
123 }123 }
124}124}
125125
@@ -139,7 +139,7 @@
139 BOOST_THROW_EXCEPTION(139 BOOST_THROW_EXCEPTION(
140 boost::enable_error_info(140 boost::enable_error_info(
141 std::runtime_error("Failed to drop DRM master"))141 std::runtime_error("Failed to drop DRM master"))
142 << boost::errinfo_errno(errno));142 << boost::errinfo_errno(-ret));
143 }143 }
144}144}
145145
@@ -159,7 +159,7 @@
159 BOOST_THROW_EXCEPTION(159 BOOST_THROW_EXCEPTION(
160 boost::enable_error_info(160 boost::enable_error_info(
161 std::runtime_error("Failed to set DRM master"))161 std::runtime_error("Failed to set DRM master"))
162 << boost::errinfo_errno(errno));162 << boost::errinfo_errno(-ret));
163 }163 }
164}164}
165165
@@ -223,7 +223,7 @@
223 if ((error = udev_enumerate_scan_devices(enumerator)))223 if ((error = udev_enumerate_scan_devices(enumerator)))
224 BOOST_THROW_EXCEPTION(224 BOOST_THROW_EXCEPTION(
225 boost::enable_error_info(225 boost::enable_error_info(
226 std::runtime_error("Failed to enumerate udev devices")) << boost::errinfo_errno(error));226 std::runtime_error("Failed to enumerate udev devices")) << boost::errinfo_errno(-error));
227227
228 devices = udev_enumerate_get_list_entry(enumerator);228 devices = udev_enumerate_get_list_entry(enumerator);
229 udev_list_entry_foreach(device, devices)229 udev_list_entry_foreach(device, devices)
@@ -281,7 +281,7 @@
281 {281 {
282 BOOST_THROW_EXCEPTION(282 BOOST_THROW_EXCEPTION(
283 boost::enable_error_info(283 boost::enable_error_info(
284 std::runtime_error("Error opening DRM device")) << boost::errinfo_errno(error));284 std::runtime_error("Error opening DRM device")) << boost::errinfo_errno(-error));
285 }285 }
286286
287 return tmp_fd;287 return tmp_fd;
288288
=== modified file 'tests/unit-tests/graphics/gbm/test_gbm_display.cpp'
--- tests/unit-tests/graphics/gbm/test_gbm_display.cpp 2013-07-10 08:50:53 +0000
+++ tests/unit-tests/graphics/gbm/test_gbm_display.cpp 2013-08-01 16:23:26 +0000
@@ -671,10 +671,10 @@
671 using namespace testing;671 using namespace testing;
672672
673 EXPECT_CALL(mock_drm, drmDropMaster(_))673 EXPECT_CALL(mock_drm, drmDropMaster(_))
674 .WillOnce(SetErrnoAndReturn(EACCES, -1));674 .WillOnce(SetErrnoAndReturn(EACCES, -EACCES));
675675
676 EXPECT_CALL(mock_drm, drmSetMaster(_))676 EXPECT_CALL(mock_drm, drmSetMaster(_))
677 .WillOnce(SetErrnoAndReturn(EPERM, -1));677 .WillOnce(SetErrnoAndReturn(EPERM, -EPERM));
678678
679 EXPECT_CALL(*mock_report, report_drm_master_failure(EACCES));679 EXPECT_CALL(*mock_report, report_drm_master_failure(EACCES));
680 EXPECT_CALL(*mock_report, report_drm_master_failure(EPERM));680 EXPECT_CALL(*mock_report, report_drm_master_failure(EPERM));

Subscribers

People subscribed via source and target branches